Skip to content

Releases: pocketbase/js-sdk

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.

v0.10.2 Release

16 Feb 13:57
Compare
Choose a tag to compare
  • Updated getFileUrl() to accept custom types as record argument (#150).

v0.10.1 Release

21 Jan 10:13
Compare
Choose a tag to compare
  • Added check for the collection name before auto updating the pb.authStore state on auth record update/delete.

v0.10.0 Release

10 Jan 12:45
Compare
Choose a tag to compare
  • Added more helpful message for the ECONNREFUSED ::1 localhost error (related to #21).

  • Preserved the "original" function and class names in the minified output for those who rely on *.prototype.name.

  • Allowed sending the existing valid auth token with the authWithPassword() calls.

  • Updated the Nuxt3 SSR examples to use the built-in useCookie() helper.