Skip to content

Releases: pocketbase/js-sdk

v0.14.3 Release

28 Apr 16:48
Compare
Choose a tag to compare
  • Added OAuth2AuthConfig.query prop to send optional query parameters (eg. expand) with the authWithOAuth2(config) call.

v0.14.2 Release

28 Apr 13:24
Compare
Choose a tag to compare
  • Use location.origin + location.pathname instead of full location.href when constructing the browser absolute url to ignore any extra hash or query parameter from the base url.
    This is a small improvement to the earlier change from v0.14.1.

v0.14.1 Release

28 Apr 12:44
Compare
Choose a tag to compare
  • Use an absolute url when the SDK is initialized with a relative base path in a browser env to ensure that the generated OAuth2 redirect and file urls are absolute.

v0.14.0 Release

18 Apr 03:55
Compare
Choose a tag to compare
  • Added simplified authWithOAuth2() version without having to implement custom redirect, deeplink or even page reload:

    const authData = await pb.collection('users').authWithOAuth2({
      provider: 'google'
    })

    Works with PocketBase v0.15.0+.

    This method initializes a one-off realtime subscription and will
    open a popup window with the OAuth2 vendor page to authenticate.
    Once the external OAuth2 sign-in/sign-up flow is completed, the popup
    window will be automatically closed and the OAuth2 data sent back
    to the user through the previously established realtime connection.

    Site-note: when creating the OAuth2 app in the provider dashboard
    you have to configure https://yourdomain.com/api/oauth2-redirect
    as redirect URL.

    The "manual" code exchange flow is still supported as authWithOAuth2Code(provider, code, codeVerifier, redirectUrl).

    For backward compatibility it is also available as soft-deprecated function overload of authWithOAuth2(provider, code, codeVerifier, redirectUrl).

  • Added new pb.files service:

    // Builds and returns an absolute record file url for the provided filename.
    πŸ”“ pb.files.getUrl(record, filename, queryParams = {});
    
    // Requests a new private file access token for the current auth model (admin or record).
    πŸ” pb.files.getToken(queryParams = {});

    pb.getFileUrl() is soft-deprecated and acts as alias calling pb.files.getUrl() under the hood.

    Works with PocketBase v0.15.0+.

v0.13.1 Release

26 Mar 11:08
Compare
Choose a tag to compare
  • Added option to specify a generic send() return type and defined SendOptions type (#171; thanks @iamelevich).

  • Deprecated SchemaField.unique prop since its function is replaced by Collection.indexes in the upcoming PocketBase v0.14.0 release.

v0.13.0 Release

24 Mar 20:03
Compare
Choose a tag to compare
  • Aliased all BaseModel helpers with $ equivalent to avoid conflicts with the dynamic record props (#169).

    isNew      -> $isNew
    load(data) -> $load(data)
    clone()    -> $clone()
    export()   -> $export()
    // ...

    For backward compatibility, the old helpers will still continue to work if the record doesn't have a conflicting field name.

  • Updated pb.beforeSend and pb.afterSend signatures to allow returning and awaiting an optional Promise (#166; thanks @Bobby-McBobface).

  • Added Collection.indexes field for the new collection indexes support in the upcoming PocketBase v0.14.0.

  • Added pb.settings.generateAppleClientSecret() for sending a request to generate Apple OAuth2 client secret in the upcoming PocketBase v0.14.0.

v0.12.1 Release

09 Mar 12:00
Compare
Choose a tag to compare
  • Fixed request multipart/form-data body check to allow the React Native Android and iOS custom FormData implementation as valid fetch body (#2002).

v0.12.0 Release

27 Feb 12:12
Compare
Choose a tag to compare
  • Changed the return type of pb.beforeSend hook to allow modifying the request url (#1930).
    // old
    pb.beforeSend = function (url, options) {
      ...
      return options;
    }
    
    // new
    pb.beforeSend = function (url, options) {
      ...
      return { url, options };
    }
    The old return format is soft-deprecated and will still work, but you'll get a console.warn message to replace it.

v0.11.1 Release

23 Feb 09:47
Compare
Choose a tag to compare
  • Exported the services class definitions to allow being used as argument types (#153).
    CrudService
    AdminService
    CollectionService
    LogService
    RealtimeService
    RecordService
    SettingsService
    

v0.11.0 Release

19 Feb 14:52
Compare
Choose a tag to compare
  • Aliased/soft-deprecated ClientResponseError.data in favor of ClientResponseError.response to avoid the stuttering when accessing the inner error response data key (aka. err.data.data now is err.response.data).
    The ClientResponseError.data will still work but it is recommend for new code to use the response key.

  • Added getFullList(queryParams = {}) overload since the default batch size in most cases doesn't need to change (it can be defined as query parameter).
    The old form getFullList(batch = 200, queryParams = {}) will still work, but it is recommend for new code to use the shorter form.