0.8.2
-
Allowed catching the initial realtime connect error as part of the
subscribe()Promise resolution. -
Reimplemented the default
EventSourceretry mechanism for better control and more consistent behavior across different browsers.
0.8.1
This release contains only documentation fixes:
-
Fixed code comment typos.
-
Added note about loadFromCookie that you may need to call authRefresh to validate the loaded cookie state server-side.
-
Updated the SSR examples to show the authRefresh call. For the examples the authRefresh call is not required but it is there to remind users that it needs to be called if you want to do permission checks in a node env (eg. SSR) and rely on the
pb.authStore.isValid.
0.8.0
⚠️ Please note that this release works only with the new PocketBase v0.8+ API!
See the breaking changes below for what has changed since v0.7.x.
Non breaking changes
-
Added support for optional custom
Recordtypes using TypeScript generics, eg.pb.collection('example').getList<Tasks>(). -
Added new
pb.autoCancellation(bool)method to globally enable or disable auto cancellation (trueby default). -
Added new crud method
getFirstListItem(filter)to fetch a single item by a list filter. -
You can now set additional account
createDatawhen authenticating with OAuth2. -
Added
AuthMethodsList.usernamePasswordreturn field (we now support combined username/email authentication; see belowauthWithPassword).
Breaking changes
-
Changed the contstructor from
PocketBase(url, lang?, store?)toPocketBase(url, store?, lang?)(aka. thelangoption is now last). -
For easier and more conventional parsing, all DateTime strings now have
Zas suffix, so that you can do directlynew Date('2022-01-01 01:02:03.456Z'). -
Moved
pb.records.getFileUrl()topb.getFileUrl(). -
Moved all
pb.records.*handlers underpb.collection().*:pb.records.getFullList('example'); => pb.collection('example').getFullList(); pb.records.getList('example'); => pb.collection('example').getList(); pb.records.getOne('example', 'RECORD_ID'); => pb.collection('example').getOne('RECORD_ID'); (no old equivalent) => pb.collection('example').getFirstListItem(filter); pb.records.create('example', {...}); => pb.collection('example').create({...}); pb.records.update('example', 'RECORD_ID', {...}); => pb.collection('example').update('RECORD_ID', {...}); pb.records.delete('example', 'RECORD_ID'); => pb.collection('example').delete('RECORD_ID'); -
The
pb.realtimeservice has now a more general callback form so that it can be used with custom realtime handlers. Dedicated records specific subscribtions could be found underpb.collection().*:Additionally,pb.realtime.subscribe('example', callback) => pb.collection('example').subscribe("*", callback) pb.realtime.subscribe('example/RECORD_ID', callback) => pb.collection('example').subscribe('RECORD_ID', callback) pb.realtime.unsubscribe('example') => pb.collection('example').unsubscribe("*") pb.realtime.unsubscribe('example/RECORD_ID') => pb.collection('example').unsubscribe('RECORD_ID') (no old equivalent) => pb.collection('example').unsubscribe()subscribe()now returnUnsubscribeFuncthat could be used to unsubscribe only from a single subscription listener. -
Moved all
pb.users.*handlers underpb.collection().*:pb.users.listAuthMethods() => pb.collection('users').listAuthMethods() pb.users.authViaEmail(email, password) => pb.collection('users').authWithPassword(usernameOrEmail, password) pb.users.authViaOAuth2(provider, code, codeVerifier, redirectUrl) => pb.collection('users').authWithOAuth2(provider, code, codeVerifier, redirectUrl, createData = {}) pb.users.refresh() => pb.collection('users').authRefresh() pb.users.requestPasswordReset(email) => pb.collection('users').requestPasswordReset(email) pb.users.confirmPasswordReset(resetToken, newPassword, newPasswordConfirm) => pb.collection('users').confirmPasswordReset(resetToken, newPassword, newPasswordConfirm) pb.users.requestVerification(email) => pb.collection('users').requestVerification(email) pb.users.confirmVerification(verificationToken) => pb.collection('users').confirmVerification(verificationToken) pb.users.requestEmailChange(newEmail) => pb.collection('users').requestEmailChange(newEmail) pb.users.confirmEmailChange(emailChangeToken, password) => pb.collection('users').confirmEmailChange(emailChangeToken, password) pb.users.listExternalAuths(recordId) => pb.collection('users').listExternalAuths(recordId) pb.users.unlinkExternalAuth(recordId, provider) => pb.collection('users').unlinkExternalAuth(recordId, provider) -
Changes in
pb.adminsfor consistency with the new auth handlers inpb.collection().*:pb.admins.authViaEmail(email, password); => pb.admins.authWithPassword(email, password); pb.admins.refresh(); => pb.admins.authRefresh();
-
To prevent confusion with the auth method responses, the following methods now returns 204 with empty body (previously 200 with token and auth model):
pb.admins.confirmPasswordReset(...): Promise<bool> pb.collection("users").confirmPasswordReset(...): Promise<bool> pb.collection("users").confirmVerification(...): Promise<bool> pb.collection("users").confirmEmailChange(...): Promise<bool>
-
Removed the
Usermodel because users are now regular records (aka.Record). The old user fieldslastResetSentAt,lastVerificationSentAtandprofileare no longer available (theprofilefields are available under theRecord.*property like any other fields). -
Renamed the special
Recordprops:@collectionId => collectionId @collectionName => collectionName @expand => expand
-
Since there is no longer
Usermodel,pb.authStore.modelcan now be of typeRecord,Adminornull. -
Removed
lastResetSentAtfrom theAdminmodel. -
Replaced
ExternalAuth.userIdwith 2 newrecordIdandcollectionIdprops. -
Removed the deprecated uppercase service aliases:
client.Users => client.collection(*) client.Records => client.collection(*) client.AuthStore => client.authStore client.Realtime => client.realtime client.Admins => client.admins client.Collections => client.collections client.Logs => client.logs client.Settings => client.settings