From 728c6474657cb12996dca192cc98f1cd6847e175 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Thu, 1 Jun 2023 13:18:00 +0300 Subject: [PATCH] [#204] cancel any pending submit requests on realtime disconnect --- CHANGELOG.md | 5 +++++ dist/pocketbase.cjs.d.ts | 1 + dist/pocketbase.cjs.js | 2 +- dist/pocketbase.cjs.js.map | 2 +- dist/pocketbase.es.d.mts | 1 + dist/pocketbase.es.js | 2 +- dist/pocketbase.es.js.map | 2 +- dist/pocketbase.es.mjs | 2 +- dist/pocketbase.es.mjs.map | 2 +- dist/pocketbase.iife.d.ts | 1 + dist/pocketbase.iife.js | 2 +- dist/pocketbase.iife.js.map | 2 +- dist/pocketbase.umd.d.ts | 1 + dist/pocketbase.umd.js | 2 +- dist/pocketbase.umd.js.map | 2 +- package.json | 2 +- src/services/RealtimeService.ts | 7 ++++++- 17 files changed, 26 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eab9005..f0c7022 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.15.1 + +- Cancel any pending submit requests on realtime disconnect ([#204](https://github.com/pocketbase/js-sdk/issues/204)). + + ## 0.15.0 - Added `fields` to the optional query parameters for limiting the returned API fields (_available with PocketBase v0.16.0_). diff --git a/dist/pocketbase.cjs.d.ts b/dist/pocketbase.cjs.d.ts index ef6d735..ea8e226 100644 --- a/dist/pocketbase.cjs.d.ts +++ b/dist/pocketbase.cjs.d.ts @@ -475,6 +475,7 @@ declare class RealtimeService extends BaseService { unsubscribeByTopicAndListener(topic: string, listener: EventListener): Promise; private hasSubscriptionListeners; private submitSubscriptions; + private getSubscriptionsCancelKey; private getNonEmptySubscriptionTopics; private addAllSubscriptionListeners; private removeAllSubscriptionListeners; diff --git a/dist/pocketbase.cjs.js b/dist/pocketbase.cjs.js index 5751e20..15f2694 100644 --- a/dist/pocketbase.cjs.js +++ b/dist/pocketbase.cjs.js @@ -1,2 +1,2 @@ -"use strict";var extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},extendStatics(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}var __assign=function(){return __assign=Object.assign||function __assign(e){for(var t,n=1,i=arguments.length;n0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var i=function(){function BaseModel(e){void 0===e&&(e={}),this.$load(e||{})}return BaseModel.prototype.load=function(e){return this.$load(e)},BaseModel.prototype.$load=function(e){for(var t=0,n=Object.entries(e);t0&&(!n.exp||n.exp-t>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),BaseAuthStore.prototype.save=function(e,t){this.baseToken=e||"",this.baseModel=null!==t&&"object"==typeof t?void 0!==t.collectionId?new o(t):new r(t):null,this.triggerChange()},BaseAuthStore.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},BaseAuthStore.prototype.loadFromCookie=function(e,t){void 0===t&&(t=s);var n=function cookieParse(e,t){var n={};if("string"!=typeof e)return n;for(var i=Object.assign({},t||{}).decode||defaultDecode,o=0;o4096&&(u.model={id:null===(i=null==u?void 0:u.model)||void 0===i?void 0:i.id,email:null===(r=null==u?void 0:u.model)||void 0===r?void 0:r.email},this.model instanceof o&&(u.model.username=this.model.username,u.model.verified=this.model.verified,u.model.collectionId=this.model.collectionId),l=cookieSerialize(t,JSON.stringify(u),e)),l},BaseAuthStore.prototype.onChange=function(e,t){var n=this;return void 0===t&&(t=!1),this._onChangeCallbacks.push(e),t&&e(this.token,this.model),function(){for(var t=n._onChangeCallbacks.length-1;t>=0;t--)if(n._onChangeCallbacks[t]==e)return delete n._onChangeCallbacks[t],void n._onChangeCallbacks.splice(t,1)}},BaseAuthStore.prototype.triggerChange=function(){for(var e=0,t=this._onChangeCallbacks;e0?e:1,this.perPage=t>=0?t:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},d=function(e){function CrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(CrudService,e),CrudService.prototype.getFullList=function(e,t){if("number"==typeof e)return this._getFullList(this.baseCrudPath,e,t);var n=Object.assign({},e,t);return this._getFullList(this.baseCrudPath,n.batch||200,n)},CrudService.prototype.getList=function(e,t,n){return void 0===e&&(e=1),void 0===t&&(t=30),void 0===n&&(n={}),this._getList(this.baseCrudPath,e,t,n)},CrudService.prototype.getFirstListItem=function(e,t){return void 0===t&&(t={}),this._getFirstListItem(this.baseCrudPath,e,t)},CrudService.prototype.getOne=function(e,t){return void 0===t&&(t={}),this._getOne(this.baseCrudPath,e,t)},CrudService.prototype.create=function(e,t){return void 0===e&&(e={}),void 0===t&&(t={}),this._create(this.baseCrudPath,e,t)},CrudService.prototype.update=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),this._update(this.baseCrudPath,e,t,n)},CrudService.prototype.delete=function(e,t){return void 0===t&&(t={}),this._delete(this.baseCrudPath,e,t)},CrudService}(function(e){function BaseCrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(BaseCrudService,e),BaseCrudService.prototype._getFullList=function(e,t,n){var i=this;void 0===t&&(t=200),void 0===n&&(n={});var o=[],request=function(r){return __awaiter(i,void 0,void 0,(function(){return __generator(this,(function(i){return[2,this._getList(e,r,t||200,n).then((function(e){var t=e,n=t.items,i=t.totalItems;return o=o.concat(n),n.length&&i>o.length?request(r+1):o}))]}))}))};return request(1)},BaseCrudService.prototype._getList=function(e,t,n,i){var o=this;return void 0===t&&(t=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:t,perPage:n},i),this.client.send(e,{method:"GET",params:i}).then((function(e){var t=[];if(null==e?void 0:e.items){e.items=e.items||[];for(var n=0,i=e.items;n1||"string"==typeof(null==e?void 0:e[0])?(console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),[2,this.authWithOAuth2Code((null==e?void 0:e[0])||"",(null==e?void 0:e[1])||"",(null==e?void 0:e[2])||"",(null==e?void 0:e[3])||"",(null==e?void 0:e[4])||{},(null==e?void 0:e[5])||{},(null==e?void 0:e[6])||{})]):(n=(null==e?void 0:e[0])||{},[4,this.listAuthMethods()]);case 1:if(i=a.sent(),!(o=i.authProviders.find((function(e){return e.name===n.provider}))))throw new t(new Error('Missing or invalid provider "'.concat(n.provider,'".')));return r=this.client.buildUrl("/api/oauth2-redirect"),[2,new Promise((function(e,i){return __awaiter(s,void 0,void 0,(function(){var s,a,c,u,l=this;return __generator(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),[4,this.client.realtime.subscribe("@oauth2",(function(a){return __awaiter(l,void 0,void 0,(function(){var c,u,l;return __generator(this,(function(d){switch(d.label){case 0:c=this.client.realtime.clientId,d.label=1;case 1:if(d.trys.push([1,3,,4]),s(),!a.state||c!==a.state)throw new Error("State parameters don't match.");return[4,this.authWithOAuth2Code(o.name,a.code,o.codeVerifier,r,n.createData,n.body,n.query)];case 2:return u=d.sent(),e(u),[3,4];case 3:return l=d.sent(),i(new t(l)),[3,4];case 4:return[2]}}))}))}))];case 1:return s=d.sent(),(a=new URL(o.authUrl+r)).searchParams.set("state",this.client.realtime.clientId),(null===(u=n.scopes)||void 0===u?void 0:u.length)&&a.searchParams.set("scope",n.scopes.join(" ")),[4,n.urlCallback?n.urlCallback(a.toString()):this._defaultUrlCallback(a.toString())];case 2:return d.sent(),[3,4];case 3:return c=d.sent(),i(new t(c)),[3,4];case 4:return[2]}}))}))}))]}}))}))},RecordService.prototype.authRefresh=function(e,t){var n=this;return void 0===e&&(e={}),void 0===t&&(t={}),this.client.send(this.baseCollectionPath+"/auth-refresh",{method:"POST",params:t,body:e}).then((function(e){return n.authResponse(e)}))},RecordService.prototype.requestPasswordReset=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-password-reset",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmPasswordReset=function(e,t,n,i,o){return void 0===i&&(i={}),void 0===o&&(o={}),i=Object.assign({token:e,password:t,passwordConfirm:n},i),this.client.send(this.baseCollectionPath+"/confirm-password-reset",{method:"POST",params:o,body:i}).then((function(){return!0}))},RecordService.prototype.requestVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({token:e},t),this.client.send(this.baseCollectionPath+"/confirm-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.requestEmailChange=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({newEmail:e},t),this.client.send(this.baseCollectionPath+"/request-email-change",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmEmailChange=function(e,t,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),n=Object.assign({token:e,password:t},n),this.client.send(this.baseCollectionPath+"/confirm-email-change",{method:"POST",params:i,body:n}).then((function(){return!0}))},RecordService.prototype.listExternalAuths=function(e,t){return void 0===t&&(t={}),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths",{method:"GET",params:t}).then((function(e){var t=[];if(Array.isArray(e))for(var n=0,i=e;no?o:n)/2,a=r/2-(i=i>r?r:i)/2;window.open(e,"oauth2-popup","width="+n+",height="+i+",top="+a+",left="+s+",resizable,menubar=no")},RecordService}(d),f=function f(e){void 0===e&&(e={}),this.id=void 0!==e.id?e.id:"",this.name=void 0!==e.name?e.name:"",this.type=void 0!==e.type?e.type:"text",this.system=!!e.system,this.required=!!e.required,this.options="object"==typeof e.options&&null!==e.options?e.options:{}},m=function(e){function Collection(){return null!==e&&e.apply(this,arguments)||this}return __extends(Collection,e),Collection.prototype.$load=function(t){e.prototype.$load.call(this,t),this.system=!!t.system,this.name="string"==typeof t.name?t.name:"",this.type="string"==typeof t.type?t.type:"base",this.options=void 0!==t.options&&null!==t.options?t.options:{},this.indexes=Array.isArray(t.indexes)?t.indexes:[],this.listRule="string"==typeof t.listRule?t.listRule:null,this.viewRule="string"==typeof t.viewRule?t.viewRule:null,this.createRule="string"==typeof t.createRule?t.createRule:null,this.updateRule="string"==typeof t.updateRule?t.updateRule:null,this.deleteRule="string"==typeof t.deleteRule?t.deleteRule:null,t.schema=Array.isArray(t.schema)?t.schema:[],this.schema=[];for(var n=0,i=t.schema;n=0;o--)this.subscriptions[e][o]===t&&(i=!0,delete this.subscriptions[e][o],this.subscriptions[e].splice(o,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(e,t));return i?(this.subscriptions[e].length||delete this.subscriptions[e],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(e)?[3,3]:[4,this.submitSubscriptions()];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},RealtimeService.prototype.hasSubscriptionListeners=function(e){var t,n;if(this.subscriptions=this.subscriptions||{},e)return!!(null===(t=this.subscriptions[e])||void 0===t?void 0:t.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},RealtimeService.prototype.submitSubscriptions=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return this.clientId?(this.addAllSubscriptionListeners(),this.lastSentTopics=this.getNonEmptySubscriptionTopics(),[2,this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentTopics},params:{$cancelKey:"realtime_"+this.clientId}}).catch((function(e){if(!(null==e?void 0:e.isAbort))throw e}))]):[2]}))}))},RealtimeService.prototype.getNonEmptySubscriptionTopics=function(){var e=[];for(var t in this.subscriptions)this.subscriptions[t].length&&e.push(t);return e},RealtimeService.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var e in this.removeAllSubscriptionListeners(),this.subscriptions)for(var t=0,n=this.subscriptions[e];t0?[2]:[2,new Promise((function(t,n){e.pendingConnects.push({resolve:t,reject:n}),e.pendingConnects.length>1||e.initConnect()}))]}))}))},RealtimeService.prototype.initConnect=function(){var e=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){e.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(t){e.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(t){var n=t;e.clientId=null==n?void 0:n.lastEventId,e.submitSubscriptions().then((function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=3,t.label=1;case 1:return this.hasUnsentSubscriptions()&&e>0?(e--,[4,this.submitSubscriptions()]):[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var t=0,n=e.pendingConnects;tthis.maxReconnectAttempts){for(var i=0,o=this.pendingConnects;i=400)throw new t({url:e.url,status:e.status,data:n});return[2,n]}}))}))})).catch((function(e){throw new t(e)}))]}}))}))},Client.prototype.getFileUrl=function(e,t,n){return void 0===n&&(n={}),this.files.getUrl(e,t,n)},Client.prototype.buildUrl=function(e){var t,n=this.baseUrl;return"undefined"==typeof window||!window.location||n.startsWith("https://")||n.startsWith("http://")||(n=(null===(t=window.location.origin)||void 0===t?void 0:t.endsWith("/"))?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(n+=window.location.pathname||"/",n+=n.endsWith("/")?"":"/"),n+=this.baseUrl),e&&(n+=n.endsWith("/")?"":"/",n+=e.startsWith("/")?e.substring(1):e),n},Client.prototype.isFormData=function(e){return e&&("FormData"===e.constructor.name||"undefined"!=typeof FormData&&e instanceof FormData)},Client.prototype.serializeQueryParams=function(e){var t=[];for(var n in e)if(null!==e[n]){var i=e[n],o=encodeURIComponent(n);if(Array.isArray(i))for(var r=0,s=i;r0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var i=function(){function BaseModel(e){void 0===e&&(e={}),this.$load(e||{})}return BaseModel.prototype.load=function(e){return this.$load(e)},BaseModel.prototype.$load=function(e){for(var t=0,n=Object.entries(e);t0&&(!n.exp||n.exp-t>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),BaseAuthStore.prototype.save=function(e,t){this.baseToken=e||"",this.baseModel=null!==t&&"object"==typeof t?void 0!==t.collectionId?new o(t):new r(t):null,this.triggerChange()},BaseAuthStore.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},BaseAuthStore.prototype.loadFromCookie=function(e,t){void 0===t&&(t=s);var n=function cookieParse(e,t){var n={};if("string"!=typeof e)return n;for(var i=Object.assign({},t||{}).decode||defaultDecode,o=0;o4096&&(u.model={id:null===(i=null==u?void 0:u.model)||void 0===i?void 0:i.id,email:null===(r=null==u?void 0:u.model)||void 0===r?void 0:r.email},this.model instanceof o&&(u.model.username=this.model.username,u.model.verified=this.model.verified,u.model.collectionId=this.model.collectionId),l=cookieSerialize(t,JSON.stringify(u),e)),l},BaseAuthStore.prototype.onChange=function(e,t){var n=this;return void 0===t&&(t=!1),this._onChangeCallbacks.push(e),t&&e(this.token,this.model),function(){for(var t=n._onChangeCallbacks.length-1;t>=0;t--)if(n._onChangeCallbacks[t]==e)return delete n._onChangeCallbacks[t],void n._onChangeCallbacks.splice(t,1)}},BaseAuthStore.prototype.triggerChange=function(){for(var e=0,t=this._onChangeCallbacks;e0?e:1,this.perPage=t>=0?t:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},d=function(e){function CrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(CrudService,e),CrudService.prototype.getFullList=function(e,t){if("number"==typeof e)return this._getFullList(this.baseCrudPath,e,t);var n=Object.assign({},e,t);return this._getFullList(this.baseCrudPath,n.batch||200,n)},CrudService.prototype.getList=function(e,t,n){return void 0===e&&(e=1),void 0===t&&(t=30),void 0===n&&(n={}),this._getList(this.baseCrudPath,e,t,n)},CrudService.prototype.getFirstListItem=function(e,t){return void 0===t&&(t={}),this._getFirstListItem(this.baseCrudPath,e,t)},CrudService.prototype.getOne=function(e,t){return void 0===t&&(t={}),this._getOne(this.baseCrudPath,e,t)},CrudService.prototype.create=function(e,t){return void 0===e&&(e={}),void 0===t&&(t={}),this._create(this.baseCrudPath,e,t)},CrudService.prototype.update=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),this._update(this.baseCrudPath,e,t,n)},CrudService.prototype.delete=function(e,t){return void 0===t&&(t={}),this._delete(this.baseCrudPath,e,t)},CrudService}(function(e){function BaseCrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(BaseCrudService,e),BaseCrudService.prototype._getFullList=function(e,t,n){var i=this;void 0===t&&(t=200),void 0===n&&(n={});var o=[],request=function(r){return __awaiter(i,void 0,void 0,(function(){return __generator(this,(function(i){return[2,this._getList(e,r,t||200,n).then((function(e){var t=e,n=t.items,i=t.totalItems;return o=o.concat(n),n.length&&i>o.length?request(r+1):o}))]}))}))};return request(1)},BaseCrudService.prototype._getList=function(e,t,n,i){var o=this;return void 0===t&&(t=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:t,perPage:n},i),this.client.send(e,{method:"GET",params:i}).then((function(e){var t=[];if(null==e?void 0:e.items){e.items=e.items||[];for(var n=0,i=e.items;n1||"string"==typeof(null==e?void 0:e[0])?(console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),[2,this.authWithOAuth2Code((null==e?void 0:e[0])||"",(null==e?void 0:e[1])||"",(null==e?void 0:e[2])||"",(null==e?void 0:e[3])||"",(null==e?void 0:e[4])||{},(null==e?void 0:e[5])||{},(null==e?void 0:e[6])||{})]):(n=(null==e?void 0:e[0])||{},[4,this.listAuthMethods()]);case 1:if(i=a.sent(),!(o=i.authProviders.find((function(e){return e.name===n.provider}))))throw new t(new Error('Missing or invalid provider "'.concat(n.provider,'".')));return r=this.client.buildUrl("/api/oauth2-redirect"),[2,new Promise((function(e,i){return __awaiter(s,void 0,void 0,(function(){var s,a,c,u,l=this;return __generator(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),[4,this.client.realtime.subscribe("@oauth2",(function(a){return __awaiter(l,void 0,void 0,(function(){var c,u,l;return __generator(this,(function(d){switch(d.label){case 0:c=this.client.realtime.clientId,d.label=1;case 1:if(d.trys.push([1,3,,4]),s(),!a.state||c!==a.state)throw new Error("State parameters don't match.");return[4,this.authWithOAuth2Code(o.name,a.code,o.codeVerifier,r,n.createData,n.body,n.query)];case 2:return u=d.sent(),e(u),[3,4];case 3:return l=d.sent(),i(new t(l)),[3,4];case 4:return[2]}}))}))}))];case 1:return s=d.sent(),(a=new URL(o.authUrl+r)).searchParams.set("state",this.client.realtime.clientId),(null===(u=n.scopes)||void 0===u?void 0:u.length)&&a.searchParams.set("scope",n.scopes.join(" ")),[4,n.urlCallback?n.urlCallback(a.toString()):this._defaultUrlCallback(a.toString())];case 2:return d.sent(),[3,4];case 3:return c=d.sent(),i(new t(c)),[3,4];case 4:return[2]}}))}))}))]}}))}))},RecordService.prototype.authRefresh=function(e,t){var n=this;return void 0===e&&(e={}),void 0===t&&(t={}),this.client.send(this.baseCollectionPath+"/auth-refresh",{method:"POST",params:t,body:e}).then((function(e){return n.authResponse(e)}))},RecordService.prototype.requestPasswordReset=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-password-reset",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmPasswordReset=function(e,t,n,i,o){return void 0===i&&(i={}),void 0===o&&(o={}),i=Object.assign({token:e,password:t,passwordConfirm:n},i),this.client.send(this.baseCollectionPath+"/confirm-password-reset",{method:"POST",params:o,body:i}).then((function(){return!0}))},RecordService.prototype.requestVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({token:e},t),this.client.send(this.baseCollectionPath+"/confirm-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.requestEmailChange=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({newEmail:e},t),this.client.send(this.baseCollectionPath+"/request-email-change",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmEmailChange=function(e,t,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),n=Object.assign({token:e,password:t},n),this.client.send(this.baseCollectionPath+"/confirm-email-change",{method:"POST",params:i,body:n}).then((function(){return!0}))},RecordService.prototype.listExternalAuths=function(e,t){return void 0===t&&(t={}),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths",{method:"GET",params:t}).then((function(e){var t=[];if(Array.isArray(e))for(var n=0,i=e;no?o:n)/2,a=r/2-(i=i>r?r:i)/2;window.open(e,"oauth2-popup","width="+n+",height="+i+",top="+a+",left="+s+",resizable,menubar=no")},RecordService}(d),f=function f(e){void 0===e&&(e={}),this.id=void 0!==e.id?e.id:"",this.name=void 0!==e.name?e.name:"",this.type=void 0!==e.type?e.type:"text",this.system=!!e.system,this.required=!!e.required,this.options="object"==typeof e.options&&null!==e.options?e.options:{}},m=function(e){function Collection(){return null!==e&&e.apply(this,arguments)||this}return __extends(Collection,e),Collection.prototype.$load=function(t){e.prototype.$load.call(this,t),this.system=!!t.system,this.name="string"==typeof t.name?t.name:"",this.type="string"==typeof t.type?t.type:"base",this.options=void 0!==t.options&&null!==t.options?t.options:{},this.indexes=Array.isArray(t.indexes)?t.indexes:[],this.listRule="string"==typeof t.listRule?t.listRule:null,this.viewRule="string"==typeof t.viewRule?t.viewRule:null,this.createRule="string"==typeof t.createRule?t.createRule:null,this.updateRule="string"==typeof t.updateRule?t.updateRule:null,this.deleteRule="string"==typeof t.deleteRule?t.deleteRule:null,t.schema=Array.isArray(t.schema)?t.schema:[],this.schema=[];for(var n=0,i=t.schema;n=0;o--)this.subscriptions[e][o]===t&&(i=!0,delete this.subscriptions[e][o],this.subscriptions[e].splice(o,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(e,t));return i?(this.subscriptions[e].length||delete this.subscriptions[e],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(e)?[3,3]:[4,this.submitSubscriptions()];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},RealtimeService.prototype.hasSubscriptionListeners=function(e){var t,n;if(this.subscriptions=this.subscriptions||{},e)return!!(null===(t=this.subscriptions[e])||void 0===t?void 0:t.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},RealtimeService.prototype.submitSubscriptions=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return this.clientId?(this.addAllSubscriptionListeners(),this.lastSentTopics=this.getNonEmptySubscriptionTopics(),[2,this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentTopics},params:{$cancelKey:this.getSubscriptionsCancelKey()}}).catch((function(e){if(!(null==e?void 0:e.isAbort))throw e}))]):[2]}))}))},RealtimeService.prototype.getSubscriptionsCancelKey=function(){return"realtime_"+this.clientId},RealtimeService.prototype.getNonEmptySubscriptionTopics=function(){var e=[];for(var t in this.subscriptions)this.subscriptions[t].length&&e.push(t);return e},RealtimeService.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var e in this.removeAllSubscriptionListeners(),this.subscriptions)for(var t=0,n=this.subscriptions[e];t0?[2]:[2,new Promise((function(t,n){e.pendingConnects.push({resolve:t,reject:n}),e.pendingConnects.length>1||e.initConnect()}))]}))}))},RealtimeService.prototype.initConnect=function(){var e=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){e.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(t){e.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(t){var n=t;e.clientId=null==n?void 0:n.lastEventId,e.submitSubscriptions().then((function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=3,t.label=1;case 1:return this.hasUnsentSubscriptions()&&e>0?(e--,[4,this.submitSubscriptions()]):[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var t=0,n=e.pendingConnects;tthis.maxReconnectAttempts){for(var i=0,o=this.pendingConnects;i=400)throw new t({url:e.url,status:e.status,data:n});return[2,n]}}))}))})).catch((function(e){throw new t(e)}))]}}))}))},Client.prototype.getFileUrl=function(e,t,n){return void 0===n&&(n={}),this.files.getUrl(e,t,n)},Client.prototype.buildUrl=function(e){var t,n=this.baseUrl;return"undefined"==typeof window||!window.location||n.startsWith("https://")||n.startsWith("http://")||(n=(null===(t=window.location.origin)||void 0===t?void 0:t.endsWith("/"))?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(n+=window.location.pathname||"/",n+=n.endsWith("/")?"":"/"),n+=this.baseUrl),e&&(n+=n.endsWith("/")?"":"/",n+=e.startsWith("/")?e.substring(1):e),n},Client.prototype.isFormData=function(e){return e&&("FormData"===e.constructor.name||"undefined"!=typeof FormData&&e instanceof FormData)},Client.prototype.serializeQueryParams=function(e){var t=[];for(var n in e)if(null!==e[n]){var i=e[n],o=encodeURIComponent(n);if(Array.isArray(i))for(var r=0,s=i;r= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","/**\n * ClientResponseError is a custom Error class that is intended to wrap\n * and normalize any error thrown by `Client.send()`.\n */\nexport default class ClientResponseError extends Error {\n url: string = '';\n status: number = 0;\n response: {[key: string]: any} = {};\n isAbort: boolean = false;\n originalError: any = null;\n\n constructor(errData?: any) {\n super(\"ClientResponseError\");\n\n // Set the prototype explicitly.\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, ClientResponseError.prototype);\n\n if (!(errData instanceof ClientResponseError)) {\n this.originalError = errData;\n }\n\n if (errData !== null && typeof errData === 'object') {\n this.url = typeof errData.url === 'string' ? errData.url : '';\n this.status = typeof errData.status === 'number' ? errData.status : 0;\n this.response = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\n this.isAbort = !!errData.isAbort;\n }\n\n if (typeof DOMException !== 'undefined' && errData instanceof DOMException) {\n this.isAbort = true;\n }\n\n this.name = \"ClientResponseError \" + this.status;\n this.message = this.response?.message;\n if (!this.message) {\n if (this.isAbort) {\n this.message = 'The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.';\n } else if (this.originalError?.cause?.message?.includes(\"ECONNREFUSED ::1\")) {\n this.message = 'Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).';\n } else {\n this.message = 'Something went wrong while processing your request.';\n }\n }\n }\n\n /**\n * Alias for `this.response` to preserve the backward compatibility.\n */\n get data() {\n return this.response;\n }\n\n /**\n * Make a POJO's copy of the current error class instance.\n * @see https://github.com/vuex-orm/vuex-orm/issues/255\n */\n toJSON() {\n return { ...this };\n }\n}\n","let atobPolyfill: Function;\nif (typeof atob === 'function') {\n atobPolyfill = atob\n} else {\n /**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n atobPolyfill = (input: any) => {\n const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n let str = String(input).replace(/=+$/, \"\");\n if (str.length % 4 == 1) {\n throw new Error(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = \"\";\n // get next character\n (buffer = str.charAt(idx++));\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? (bs as any) * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ?\n (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) :\n 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n\n return output;\n };\n}\n\n/**\n * Returns JWT token's payload data.\n */\nexport function getTokenPayload(token: string): { [key: string]: any } {\n if (token) {\n try {\n const encodedPayload = decodeURIComponent(atobPolyfill(token.split('.')[1]).split('').map(function (c: string) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n\n return JSON.parse(encodedPayload) || {};\n } catch (e) {\n }\n }\n\n return {};\n}\n\n/**\n * Checks whether a JWT token is expired or not.\n * Tokens without `exp` payload key are considered valid.\n * Tokens with empty payload (eg. invalid token strings) are considered expired.\n *\n * @param token The token to check.\n * @param [expirationThreshold] Time in seconds that will be subtracted from the token `exp` property.\n */\nexport function isTokenExpired(token: string, expirationThreshold = 0): boolean {\n let payload = getTokenPayload(token);\n\n if (\n Object.keys(payload).length > 0 &&\n (!payload.exp || (payload.exp - expirationThreshold) > (Date.now() / 1000))\n ) {\n return false;\n }\n\n return true;\n}\n","/**\n * -------------------------------------------------------------------\n * Simple cookie parse and serialize utilities mostly based on the\n * node module https://github.com/jshttp/cookie.\n * -------------------------------------------------------------------\n */\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\nexport interface ParseOptions{\n decode?: (val: string) => string,\n}\n\n/**\n* Parses the given cookie header string into an object\n* The object has the various cookies as keys(names) => values\n*/\nexport function cookieParse(str: string, options?: ParseOptions): { [key: string]: any } {\n const result: { [key: string]: any } = {};\n\n if (typeof str !== 'string') {\n return result;\n }\n\n const opt = Object.assign({}, options || {});\n const decode = opt.decode || defaultDecode;\n\n let index = 0;\n while (index < str.length) {\n const eqIdx = str.indexOf('=', index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = str.indexOf(';', index);\n\n if (endIdx === -1) {\n endIdx = str.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1;\n continue;\n }\n\n const key = str.slice(index, eqIdx).trim();\n\n // only assign once\n if (undefined === result[key]) {\n let val = str.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n result[key] = decode(val);\n } catch (_) {\n result[key] = val; // no decoding\n }\n }\n\n index = endIdx + 1;\n }\n\n return result;\n};\n\nexport interface SerializeOptions{\n encode?: (val: string | number | boolean) => string,\n maxAge?: number,\n domain?: string,\n path?: string,\n expires?: Date,\n httpOnly?: boolean,\n secure?: boolean,\n priority?: string,\n sameSite?: boolean|string,\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * ```js\n * cookieSerialize('foo', 'bar', { httpOnly: true }) // \"foo=bar; httpOnly\"\n * ```\n */\nexport function cookieSerialize(name: string, val: string, options?: SerializeOptions): string {\n const opt = Object.assign({}, options || {});\n const encode = opt.encode || defaultEncode;\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n const value = encode(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n let result = name + '=' + value;\n\n if (opt.maxAge != null) {\n const maxAge = opt.maxAge - 0;\n\n if (isNaN(maxAge) || !isFinite(maxAge)) {\n throw new TypeError('option maxAge is invalid');\n }\n\n result += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n result += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n result += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (!isDate(opt.expires) || isNaN(opt.expires.valueOf())) {\n throw new TypeError('option expires is invalid');\n }\n\n result += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n result += '; HttpOnly';\n }\n\n if (opt.secure) {\n result += '; Secure';\n }\n\n if (opt.priority) {\n const priority = typeof opt.priority === 'string' ? opt.priority.toLowerCase() : opt.priority;\n\n switch (priority) {\n case 'low':\n result += '; Priority=Low';\n break;\n case 'medium':\n result += '; Priority=Medium';\n break;\n case 'high':\n result += '; Priority=High';\n break;\n default:\n throw new TypeError('option priority is invalid');\n }\n }\n\n if (opt.sameSite) {\n const sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n result += '; SameSite=Strict';\n break;\n case 'lax':\n result += '; SameSite=Lax';\n break;\n case 'strict':\n result += '; SameSite=Strict';\n break;\n case 'none':\n result += '; SameSite=None';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return result;\n};\n\n/**\n * Default URL-decode string value function.\n * Optimized to skip native call when no `%`.\n */\nfunction defaultDecode(val: string): string {\n return val.indexOf('%') !== -1\n ? decodeURIComponent(val)\n : val;\n}\n\n/**\n * Default URL-encode value function.\n */\nfunction defaultEncode(val: string | number | boolean): string {\n return encodeURIComponent(val);\n}\n\n/**\n * Determines if value is a Date.\n */\nfunction isDate(val: any): boolean {\n return (\n Object.prototype.toString.call(val) === '[object Date]' ||\n val instanceof Date\n );\n}\n","export default abstract class BaseModel {\n [key: string]: any,\n\n id!: string;\n created!: string;\n updated!: string;\n\n constructor(data: { [key: string]: any } = {}) {\n this.$load(data || {});\n }\n\n /**\n * Alias of this.$load(data).\n */\n load(data: { [key: string]: any }) {\n return this.$load(data);\n }\n\n /**\n * Loads `data` into the current model.\n */\n $load(data: { [key: string]: any }) {\n for (const [key, value] of Object.entries(data)) {\n this[key] = value;\n }\n\n // normalize known fields\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.created = typeof data.created !== 'undefined' ? data.created : '';\n this.updated = typeof data.updated !== 'undefined' ? data.updated : '';\n }\n\n /**\n * Returns whether the current loaded data represent a stored db record.\n */\n get $isNew(): boolean {\n return !this.id;\n }\n\n /**\n * Alias of this.clone().\n */\n clone(): BaseModel {\n return this.$clone();\n }\n\n /**\n * Creates a deep clone of the current model.\n */\n $clone(): BaseModel {\n const clone = typeof structuredClone === 'function' ?\n structuredClone(this) : JSON.parse(JSON.stringify(this));\n\n return new (this.constructor as any)(clone);\n }\n\n /**\n * Alias of this.$export().\n */\n export(): { [key: string]: any } {\n return this.$export();\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n $export(): { [key: string]: any } {\n return typeof structuredClone === 'function' ?\n structuredClone(this) : Object.assign({}, this);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Record extends BaseModel {\n collectionId!: string;\n collectionName!: string;\n expand!: {[key: string]: Record|Array};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // normalize common fields\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.collectionName = typeof data.collectionName === 'string' ? data.collectionName : '';\n\n // normalize expand items\n this._loadExpand(data.expand);\n }\n\n /**\n * Loads the provided expand items and recursively normalizes each\n * item to a `Record|Array`.\n */\n private _loadExpand(expand: { [key: string]: any }) {\n expand = expand || {};\n this.expand = {};\n\n for (const key in expand) {\n if (Array.isArray(expand[key])) {\n this.expand[key] = expand[key].map((data: any) => new Record(data || {}));\n } else {\n this.expand[key] = new Record(expand[key] || {});\n }\n }\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Admin extends BaseModel {\n avatar!: number;\n email!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.avatar = typeof data.avatar === 'number' ? data.avatar : 0;\n this.email = typeof data.email === 'string' ? data.email : '';\n }\n}\n","import { cookieParse, cookieSerialize, SerializeOptions } from '@/stores/utils/cookie';\nimport { isTokenExpired, getTokenPayload } from '@/stores/utils/jwt';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\nexport type OnStoreChangeFunc = (token: string, model: Record|Admin|null) => void;\n\nconst defaultCookieKey = 'pb_auth';\n\n/**\n * Base AuthStore class that is intended to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore {\n protected baseToken: string = '';\n protected baseModel: Record|Admin|null = null;\n\n private _onChangeCallbacks: Array = [];\n\n /**\n * Retrieves the stored token (if any).\n */\n get token(): string {\n return this.baseToken;\n }\n\n /**\n * Retrieves the stored model data (if any).\n */\n get model(): Record|Admin|null {\n return this.baseModel;\n }\n\n /**\n * Loosely checks if the store has valid token (aka. existing and unexpired exp claim).\n */\n get isValid(): boolean {\n return !isTokenExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: Record|Admin|null): void {\n this.baseToken = token || '';\n\n // normalize the model instance\n if (model !== null && typeof model === 'object') {\n this.baseModel = typeof (model as any).collectionId !== 'undefined' ?\n new Record(model) : new Admin(model);\n } else {\n this.baseModel = null;\n }\n\n this.triggerChange();\n }\n\n /**\n * Removes the stored token and model data form the auth store.\n */\n clear(): void {\n this.baseToken = '';\n this.baseModel = null;\n this.triggerChange();\n }\n\n /**\n * Parses the provided cookie string and updates the store state\n * with the cookie's token and model data.\n *\n * NB! This function doesn't validate the token or its data.\n * Usually this isn't a concern if you are interacting only with the\n * PocketBase API because it has the proper server-side security checks in place,\n * but if you are using the store `isValid` state for permission controls\n * in a node server (eg. SSR), then it is recommended to call `authRefresh()`\n * after loading the cookie to ensure an up-to-date token and model state.\n * For example:\n *\n * ```js\n * pb.authStore.loadFromCookie(\"cookie string...\");\n *\n * try {\n * // get an up-to-date auth store state by veryfing and refreshing the loaded auth model (if any)\n * pb.authStore.isValid && await pb.collection('users').authRefresh();\n * } catch (_) {\n * // clear the auth store on failed refresh\n * pb.authStore.clear();\n * }\n * ```\n */\n loadFromCookie(cookie: string, key = defaultCookieKey): void {\n const rawData = cookieParse(cookie || '')[key] || '';\n\n let data: { [key: string]: any } = {};\n try {\n data = JSON.parse(rawData);\n // normalize\n if (typeof data === null || typeof data !== 'object' || Array.isArray(data)) {\n data = {};\n }\n } catch (_) {}\n\n this.save(data.token || '', data.model || null);\n }\n\n /**\n * Exports the current store state as cookie string.\n *\n * By default the following optional attributes are added:\n * - Secure\n * - HttpOnly\n * - SameSite=Strict\n * - Path=/\n * - Expires={the token expiration date}\n *\n * NB! If the generated cookie exceeds 4096 bytes, this method will\n * strip the model data to the bare minimum to try to fit within the\n * recommended size in https://www.rfc-editor.org/rfc/rfc6265#section-6.1.\n */\n exportToCookie(options?: SerializeOptions, key = defaultCookieKey): string {\n const defaultOptions: SerializeOptions = {\n secure: true,\n sameSite: true,\n httpOnly: true,\n path: \"/\",\n };\n\n // extract the token expiration date\n const payload = getTokenPayload(this.token);\n if (payload?.exp) {\n defaultOptions.expires = new Date(payload.exp * 1000);\n } else {\n defaultOptions.expires = new Date('1970-01-01');\n }\n\n // merge with the user defined options\n options = Object.assign({}, defaultOptions, options);\n\n const rawData = {\n token: this.token,\n model: this.model?.export() || null,\n };\n\n let result = cookieSerialize(key, JSON.stringify(rawData), options);\n\n const resultLength = typeof Blob !== 'undefined' ?\n (new Blob([result])).size : result.length;\n\n // strip down the model data to the bare minimum\n if (rawData.model && resultLength > 4096) {\n rawData.model = {id: rawData?.model?.id, email: rawData?.model?.email};\n if (this.model instanceof Record) {\n rawData.model.username = this.model.username;\n rawData.model.verified = this.model.verified;\n rawData.model.collectionId = this.model.collectionId;\n }\n result = cookieSerialize(key, JSON.stringify(rawData), options);\n }\n\n return result;\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * You can set the `fireImmediately` argument to true in order to invoke\n * the provided callback right after registration.\n *\n * Returns a removal function that you could call to \"unsubscribe\" from the changes.\n */\n onChange(callback: OnStoreChangeFunc, fireImmediately = false): () => void {\n this._onChangeCallbacks.push(callback);\n\n if (fireImmediately) {\n callback(this.token, this.model);\n }\n\n return () => {\n for (let i = this._onChangeCallbacks.length - 1; i >= 0; i--) {\n if (this._onChangeCallbacks[i] == callback) {\n delete this._onChangeCallbacks[i]; // removes the function reference\n this._onChangeCallbacks.splice(i, 1); // reindex the array\n return;\n }\n }\n }\n }\n\n protected triggerChange(): void {\n for (const callback of this._onChangeCallbacks) {\n callback && callback(this.token, this.model);\n }\n }\n}\n","import BaseAuthStore from '@/stores/BaseAuthStore';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\n/**\n * The default token store for browsers with auto fallback\n * to runtime/memory if local storage is undefined (eg. in node env).\n */\nexport default class LocalAuthStore extends BaseAuthStore {\n private storageFallback: { [key: string]: any } = {};\n private storageKey: string\n\n constructor(storageKey = \"pocketbase_auth\") {\n super();\n\n this.storageKey = storageKey;\n }\n\n /**\n * @inheritdoc\n */\n get token(): string {\n const data = this._storageGet(this.storageKey) || {};\n\n return data.token || '';\n }\n\n /**\n * @inheritdoc\n */\n get model(): Record|Admin|null {\n const data = this._storageGet(this.storageKey) || {};\n\n if (\n data === null ||\n typeof data !== 'object' ||\n data.model === null ||\n typeof data.model !== 'object'\n ) {\n return null;\n }\n\n // admins don't have `collectionId` prop\n if (typeof data.model?.collectionId === 'undefined') {\n return new Admin(data.model);\n }\n\n return new Record(data.model);\n }\n\n /**\n * @inheritdoc\n */\n save(token: string, model: Record|Admin|null) {\n this._storageSet(this.storageKey, {\n 'token': token,\n 'model': model,\n });\n\n super.save(token, model);\n }\n\n /**\n * @inheritdoc\n */\n clear() {\n this._storageRemove(this.storageKey);\n\n super.clear();\n }\n\n // ---------------------------------------------------------------\n // Internal helpers:\n // ---------------------------------------------------------------\n\n /**\n * Retrieves `key` from the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageGet(key: string): any {\n if (typeof window !== 'undefined' && window?.localStorage) {\n const rawValue = window.localStorage.getItem(key) || '';\n try {\n return JSON.parse(rawValue);\n } catch (e) { // not a json\n return rawValue;\n }\n }\n\n // fallback\n return this.storageFallback[key];\n }\n\n /**\n * Stores a new data in the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageSet(key: string, value: any) {\n if (typeof window !== 'undefined' && window?.localStorage) {\n // store in local storage\n let normalizedVal = value;\n if (typeof value !== 'string') {\n normalizedVal = JSON.stringify(value);\n }\n window.localStorage.setItem(key, normalizedVal);\n } else {\n // store in fallback\n this.storageFallback[key] = value;\n }\n }\n\n /**\n * Removes `key` from the browser's local storage and the runtime/memory.\n */\n private _storageRemove(key: string) {\n // delete from local storage\n if (typeof window !== 'undefined' && window?.localStorage) {\n window.localStorage?.removeItem(key);\n }\n\n // delete from fallback\n delete this.storageFallback[key];\n }\n}\n","import Client from '@/Client';\n\n/**\n * BaseService class that should be inherited from all API services.\n */\nexport default abstract class BaseService {\n readonly client: Client\n\n constructor(client: Client) {\n this.client = client;\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\ninterface appleClientSecret {\n secret: string;\n}\n\nexport default class SettingsService extends BaseService {\n /**\n * Fetch all available app settings.\n */\n getAll(queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Bulk updates app settings.\n */\n update(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Performs a S3 filesystem connection test.\n *\n * The currently supported `filesystem` are \"storage\" and \"backups\".\n */\n testS3(filesystem: string = \"storage\", queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'filesystem': filesystem,\n };\n\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends a test email.\n *\n * The possible `emailTemplate` values are:\n * - verification\n * - password-reset\n * - email-change\n */\n testEmail(toEmail: string, emailTemplate: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'email': toEmail,\n 'template': emailTemplate,\n };\n\n return this.client.send('/api/settings/test/email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Generates a new Apple OAuth2 client secret.\n */\n generateAppleClientSecret(\n clientId: string,\n teamId: string,\n keyId: string,\n privateKey: string,\n duration: number,\n bodyParams = {},\n queryParams: BaseQueryParams = {}\n ): Promise {\n bodyParams = Object.assign({\n clientId,\n teamId,\n keyId,\n privateKey,\n duration,\n }, bodyParams);\n\n return this.client.send('/api/settings/apple/generate-client-secret', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n });\n }\n}\n","import BaseModel from './BaseModel';\n\nexport default class ListResult {\n page!: number;\n perPage!: number;\n totalItems!: number;\n totalPages!: number;\n items!: Array;\n\n constructor(\n page: number,\n perPage: number,\n totalItems: number,\n totalPages: number,\n items: Array,\n ) {\n this.page = page > 0 ? page : 1;\n this.perPage = perPage >= 0 ? perPage : 0;\n this.totalItems = totalItems >= 0 ? totalItems : 0;\n this.totalPages = totalPages >= 0 ? totalPages : 0;\n this.items = items || [];\n }\n}\n","import ListResult from '@/models/utils/ListResult';\nimport BaseModel from '@/models/utils/BaseModel';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n FullListQueryParams\n} from '@/services/utils/QueryParams';\n\nexport default abstract class CrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/admins').\n */\n abstract get baseCrudPath(): string\n\n /**\n * Returns a promise with all list items batch fetched at once\n * (by default 200 items per request; to change it set the `batch` query param).\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(queryParams?: FullListQueryParams): Promise>\n\n /**\n * Legacy version of getFullList with explicitly specified batch size.\n */\n getFullList(batch?: number, queryParams?: ListQueryParams): Promise>\n\n getFullList(batchOrqueryParams?: number|FullListQueryParams, queryParams?: ListQueryParams): Promise> {\n if (typeof batchOrqueryParams == \"number\") {\n return this._getFullList(this.baseCrudPath, batchOrqueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrqueryParams, queryParams);\n\n return this._getFullList(this.baseCrudPath, params.batch || 200, params);\n }\n\n /**\n * Returns paginated items list.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n return this._getList(this.baseCrudPath, page, perPage, queryParams);\n }\n\n /**\n * Returns the first found item by the specified filter.\n *\n * Internally it calls `getList(1, 1, { filter })` and returns the\n * first found item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n *\n * For consistency with `getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n getFirstListItem(filter: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getFirstListItem(this.baseCrudPath, filter, queryParams);\n }\n\n /**\n * Returns single item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getOne(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getOne(this.baseCrudPath, id, queryParams);\n }\n\n /**\n * Creates a new item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n create(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._create(this.baseCrudPath, bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._update(this.baseCrudPath, id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._delete(this.baseCrudPath, id, queryParams);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\nimport {\n BaseQueryParams,\n ListQueryParams\n} from '@/services/utils/QueryParams';\n\n// @todo since there is no longer need of SubCrudService consider merging with CrudService in v0.9+\nexport default abstract class BaseCrudService extends BaseService {\n /**\n * Response data decoder.\n */\n abstract decode(data: { [key: string]: any }): M\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n protected _getFullList(basePath: string, batchSize = 200, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize || 200, queryParams).then((list) => {\n const castedList = (list as any as ListResult);\n const items = castedList.items;\n const totalItems = castedList.totalItems;\n\n result = result.concat(items);\n\n if (items.length && totalItems > result.length) {\n return request(page + 1);\n }\n\n return result;\n });\n }\n\n return request(1);\n }\n\n /**\n * Returns paginated items list.\n */\n protected _getList(basePath: string, page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send(basePath, {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData.items || [];\n for (const item of responseData.items) {\n items.push(this.decode(item) as any as T);\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns single item by its id.\n */\n protected _getOne(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Returns the first found item by a list filter.\n *\n * Internally it calls `_getList(basePath, 1, 1, { filter })` and returns its\n * first item.\n *\n * For consistency with `_getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n protected _getFirstListItem(basePath: string, filter: string, queryParams: BaseQueryParams = {}): Promise {\n queryParams = Object.assign({\n 'filter': filter,\n '$cancelKey': 'one_by_filter_' + basePath + \"_\" + filter,\n }, queryParams);\n\n return this._getList(basePath, 1, 1, queryParams)\n .then((result) => {\n if (!result?.items?.length) {\n throw new ClientResponseError({\n status: 404,\n data: {\n code: 404,\n message: \"The requested resource wasn't found.\",\n data: {},\n },\n });\n }\n\n return result.items[0];\n });\n }\n\n /**\n * Creates a new item.\n */\n protected _create(basePath: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath, {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Updates an existing item by its id.\n */\n protected _update(basePath: string, id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n protected _delete(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n}\n","import Admin from '@/models/Admin';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface AdminAuthResponse {\n [key: string]: any;\n\n token: string;\n admin: Admin;\n}\n\nexport default class AdminService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Admin {\n return new Admin(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/admins';\n }\n\n // ---------------------------------------------------------------\n // Post update/delete AuthStore sync\n // ---------------------------------------------------------------\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n // update the store state if the updated item id matches with the stored model\n if (\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === item?.id\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n // clear the store state if the deleted item id matches with the stored model\n if (\n success &&\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === id\n ) {\n this.client.authStore.clear();\n }\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful authorize response.\n */\n protected authResponse(responseData: any): AdminAuthResponse {\n const admin = this.decode(responseData?.admin || {});\n\n if (responseData?.token && responseData?.admin) {\n this.client.authStore.save(responseData.token, admin);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'admin': admin,\n });\n }\n\n /**\n * Authenticate an admin account with its email and password\n * and returns a new admin token and data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authWithPassword(\n email: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'identity': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Refreshes the current admin authenticated instance and\n * returns a new token and admin data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authRefresh(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCrudPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends admin password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms admin password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class ExternalAuth extends BaseModel {\n recordId!: string;\n collectionId!: string;\n provider!: string;\n providerId!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.recordId = typeof data.recordId === 'string' ? data.recordId : '';\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.provider = typeof data.provider === 'string' ? data.provider : '';\n this.providerId = typeof data.providerId === 'string' ? data.providerId : '';\n }\n}\n","import Client from '@/Client';\nimport ClientResponseError from '@/ClientResponseError';\nimport Record from '@/models/Record';\nimport ExternalAuth from '@/models/ExternalAuth';\nimport ListResult from '@/models/utils/ListResult';\nimport CrudService from '@/services/utils/CrudService';\nimport { UnsubscribeFunc } from '@/services/RealtimeService';\nimport {\n BaseQueryParams,\n RecordQueryParams,\n RecordListQueryParams,\n RecordFullListQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface RecordAuthResponse {\n record: T;\n token: string;\n meta?: {[key: string]: any};\n}\n\nexport interface AuthProviderInfo {\n name: string;\n state: string;\n codeVerifier: string;\n codeChallenge: string;\n codeChallengeMethod: string;\n authUrl: string;\n}\n\nexport interface AuthMethodsList {\n usernamePassword: boolean;\n emailPassword: boolean;\n authProviders: Array;\n}\n\nexport interface RecordSubscription {\n action: string; // eg. create, update, delete\n record: T;\n}\n\nexport type OAuth2UrlCallback = (url: string) => void|Promise;\n\nexport interface OAuth2AuthConfig {\n // the name of the OAuth2 provider (eg. \"google\")\n provider: string;\n\n // custom scopes to overwrite the default ones\n scopes?: Array;\n\n // optional record create data\n createData?: {[key: string]: any};\n\n // optional callback that is triggered after the OAuth2 sign-in/sign-up url generation\n urlCallback?: OAuth2UrlCallback;\n\n // optional query params to send with the PocketBase auth request (eg. fields, expand, etc.)\n query?: RecordQueryParams;\n\n // optional body params to send with the PocketBase auth request\n body?: {[key: string]: any};\n}\n\nexport default class RecordService extends CrudService {\n readonly collectionIdOrName: string;\n\n constructor(client: Client, collectionIdOrName: string) {\n super(client);\n\n this.collectionIdOrName = collectionIdOrName;\n }\n\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): T {\n return new Record(data) as any as T;\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return this.baseCollectionPath + '/records';\n }\n\n /**\n * Returns the current collection service base path.\n */\n get baseCollectionPath(): string {\n return '/api/collections/' + encodeURIComponent(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Realtime handlers\n // ---------------------------------------------------------------\n\n /**\n * @deprecated Use subscribe(recordId, callback) instead.\n *\n * Subscribe to the realtime changes of a single record in the collection.\n */\n async subscribeOne(recordId: string, callback: (data: RecordSubscription) => void): Promise {\n console.warn(\"PocketBase: subscribeOne(recordId, callback) is deprecated. Please replace it with subscribe(recordId, callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName + \"/\" + recordId, callback);\n }\n\n /**\n * @deprecated This form of subscribe is deprecated. Please use `subscribe(\"*\", callback)`.\n */\n async subscribe(callback: (data: RecordSubscription) => void): Promise\n\n /**\n * Subscribe to realtime changes to the specified topic (\"*\" or record id).\n *\n * If `topic` is the wildcard \"*\", then this method will subscribe to\n * any record changes in the collection.\n *\n * If `topic` is a record id, then this method will subscribe only\n * to changes of the specified record id.\n *\n * It's OK to subscribe multiple times to the same topic.\n * You can use the returned `UnsubscribeFunc` to remove only a single subscription.\n * Or use `unsubscribe(topic)` if you want to remove all subscriptions attached to the topic.\n */\n async subscribe(topic: string, callback: (data: RecordSubscription) => void): Promise\n\n async subscribe(\n topicOrCallback: string|((data: RecordSubscription) => void),\n callback?: (data: RecordSubscription) => void\n ): Promise {\n if (typeof topicOrCallback === 'function') {\n console.warn(\"PocketBase: subscribe(callback) is deprecated. Please replace it with subscribe('*', callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName, topicOrCallback);\n }\n\n if (!callback) {\n throw new Error(\"Missing subscription callback.\");\n }\n\n if (topicOrCallback === \"\") {\n throw new Error(\"Missing topic.\");\n }\n\n let topic = this.collectionIdOrName;\n if (topicOrCallback !== \"*\") {\n topic += ('/' + topicOrCallback);\n }\n\n return this.client.realtime.subscribe(topic, callback)\n }\n\n /**\n * Unsubscribe from all subscriptions of the specified topic\n * (\"*\" or record id).\n *\n * If `topic` is not set, then this method will unsubscribe from\n * all subscriptions associated to the current collection.\n */\n async unsubscribe(topic?: string): Promise {\n // unsubscribe wildcard topic\n if (topic === \"*\") {\n return this.client.realtime.unsubscribe(this.collectionIdOrName);\n }\n\n // unsubscribe recordId topic\n if (topic) {\n return this.client.realtime.unsubscribe(this.collectionIdOrName + \"/\" + topic);\n }\n\n // unsubscribe from everything related to the collection\n return this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Crud handers\n // ---------------------------------------------------------------\n /**\n * @inheritdoc\n */\n getFullList(queryParams?: RecordFullListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batch?: number, queryParams?: RecordListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batchOrQueryParams?: number|RecordFullListQueryParams, queryParams?: RecordListQueryParams): Promise> {\n if (typeof batchOrQueryParams == \"number\") {\n return super.getFullList(batchOrQueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrQueryParams, queryParams);\n\n return super.getFullList(params);\n }\n\n /**\n * @inheritdoc\n */\n getList(page = 1, perPage = 30, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getList(page, perPage, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getFirstListItem(filter: string, queryParams: RecordListQueryParams = {}): Promise {\n return super.getFirstListItem(filter, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getOne(id: string, queryParams: RecordQueryParams = {}): Promise {\n return super.getOne(id, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n create(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.create(bodyParams, queryParams);\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n if (\n // is record auth\n this.client.authStore.model?.id === item?.id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n if (\n success &&\n // is record auth\n this.client.authStore.model?.id === id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.clear();\n }\n\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful collection authorization response.\n */\n protected authResponse(responseData: any): RecordAuthResponse {\n const record = this.decode(responseData?.record || {});\n\n this.client.authStore.save(responseData?.token, record);\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'record': record as any as T,\n });\n }\n\n /**\n * Returns all available collection auth methods.\n */\n listAuthMethods(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCollectionPath + '/auth-methods', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n return Object.assign({}, responseData, {\n // normalize common fields\n 'usernamePassword': !!responseData?.usernamePassword,\n 'emailPassword': !!responseData?.emailPassword,\n 'authProviders': Array.isArray(responseData?.authProviders) ? responseData?.authProviders : [],\n });\n });\n }\n\n /**\n * Authenticate a single auth collection record via its username/email and password.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n */\n authWithPassword(\n usernameOrEmail: string,\n password: string,\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'identity': usernameOrEmail,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2 code.\n *\n * If you don't have an OAuth2 code you may also want to check `authWithOAuth2` method.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n */\n authWithOAuth2Code(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData = {},\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'provider': provider,\n 'code': code,\n 'codeVerifier': codeVerifier,\n 'redirectUrl': redirectUrl,\n 'createData': createData,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-oauth2', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * @deprecated This form of authWithOAuth2 is deprecated.\n *\n * Please use `authWithOAuth2Code()` OR its simplified realtime version\n * as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\n */\n async authWithOAuth2(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData?: {[key: string]: any},\n bodyParams?: {[key: string]: any},\n queryParams?: RecordQueryParams,\n ): Promise>\n\n /**\n * Authenticate a single auth collection record with OAuth2\n * **without custom redirects, deeplinks or even page reload**.\n *\n * This method initializes a one-off realtime subscription and will\n * open a popup window with the OAuth2 vendor page to authenticate.\n * Once the external OAuth2 sign-in/sign-up flow is completed, the popup\n * window will be automatically closed and the OAuth2 data sent back\n * to the user through the previously established realtime connection.\n *\n * You can specify an optional `urlCallback` prop to customize\n * the default url `window.open` behavior.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n *\n * Example:\n *\n * ```js\n * const authData = await pb.collection(\"users\").authWithOAuth2({\n * provider: \"google\",\n * })\n * ```\n *\n * _Site-note_: when creating the OAuth2 app in the provider dashboard\n * you have to configure `https://yourdomain.com/api/oauth2-redirect`\n * as redirect URL.\n */\n async authWithOAuth2(options: OAuth2AuthConfig): Promise>\n\n async authWithOAuth2(...args: any): Promise> {\n // fallback to legacy format\n if (args.length > 1 || typeof args?.[0] === 'string') {\n console.warn(\"PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\");\n return this.authWithOAuth2Code(\n args?.[0] || '',\n args?.[1] || '',\n args?.[2] || '',\n args?.[3] || '',\n args?.[4] || {},\n args?.[5] || {},\n args?.[6] || {},\n );\n }\n\n const config = args?.[0] || {};\n\n const authMethods = await this.listAuthMethods();\n\n const provider = authMethods.authProviders.find((p) => p.name === config.provider);\n if (!provider) {\n throw new ClientResponseError(new Error(`Missing or invalid provider \"${config.provider}\".`));\n }\n\n const redirectUrl = this.client.buildUrl('/api/oauth2-redirect');\n\n return new Promise(async (resolve, reject) => {\n try {\n // initialize a one-off @oauth2 realtime subscription\n const unsubscribe = await this.client.realtime.subscribe('@oauth2', async (e) => {\n const oldState = this.client.realtime.clientId;\n\n try {\n unsubscribe();\n\n if (!e.state || oldState !== e.state) {\n throw new Error(\"State parameters don't match.\");\n }\n\n const authData = await this.authWithOAuth2Code(\n provider.name,\n e.code,\n provider.codeVerifier,\n redirectUrl,\n config.createData,\n config.body,\n config.query,\n )\n\n resolve(authData);\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n\n const url = new URL(provider.authUrl + redirectUrl);\n url.searchParams.set(\"state\", this.client.realtime.clientId);\n if (config.scopes?.length) {\n url.searchParams.set(\"scope\", config.scopes.join(\" \"));\n }\n\n await (config.urlCallback ? config.urlCallback(url.toString()) : this._defaultUrlCallback(url.toString()));\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n }\n\n /**\n * Refreshes the current authenticated record instance and\n * returns a new token and record data.\n *\n * On success this method also automatically updates the client's AuthStore.\n */\n authRefresh(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise> {\n return this.client.send(this.baseCollectionPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Sends auth record password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends auth record verification email request.\n */\n requestVerification(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record email verification request.\n */\n confirmVerification(\n verificationToken: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': verificationToken,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends an email change request to the authenticated record model.\n */\n requestEmailChange(\n newEmail: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'newEmail': newEmail,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record's new email address.\n */\n confirmEmailChange(\n emailChangeToken: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': emailChangeToken,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Lists all linked external auth providers for the specified auth record.\n */\n listExternalAuths(\n recordId: string,\n queryParams: BaseQueryParams = {}\n ): Promise> {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => {\n const items: Array = [];\n\n if (Array.isArray(responseData)) {\n for (const item of responseData) {\n items.push(new ExternalAuth(item));\n }\n }\n\n return items;\n });\n }\n\n /**\n * Unlink a single external auth provider from the specified auth record.\n */\n unlinkExternalAuth(\n recordId: string,\n provider: string,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths/' + encodeURIComponent(provider), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n // ---------------------------------------------------------------\n\n private _defaultUrlCallback(url: string) {\n if (typeof window === \"undefined\" || !window?.open) {\n throw new ClientResponseError(new Error(`Not in a browser context - please pass a custom urlCallback function.`));\n }\n\n let width = 1024;\n let height = 768;\n\n let windowWidth = window.innerWidth;\n let windowHeight = window.innerHeight;\n\n // normalize window size\n width = width > windowWidth ? windowWidth : width;\n height = height > windowHeight ? windowHeight : height;\n\n let left = (windowWidth / 2) - (width / 2);\n let top = (windowHeight / 2) - (height / 2);\n\n window.open(\n url,\n \"oauth2-popup\",\n 'width='+width+',height='+height+',top='+top+',left='+left+',resizable,menubar=no'\n );\n }\n}\n","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.name = typeof data.name !== 'undefined' ? data.name : '';\n this.type = typeof data.type !== 'undefined' ? data.type : 'text';\n this.system = !!data.system;\n this.required = !!data.required;\n this.options = typeof data.options === 'object' && data.options !== null ? data.options : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport SchemaField from '@/models/utils/SchemaField';\n\nexport default class Collection extends BaseModel {\n name!: string;\n type!: string;\n schema!: Array;\n indexes!: Array;\n system!: boolean;\n listRule!: null|string;\n viewRule!: null|string;\n createRule!: null|string;\n updateRule!: null|string;\n deleteRule!: null|string;\n options!: {[key:string]: any};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.system = !!data.system;\n this.name = typeof data.name === 'string' ? data.name : '';\n this.type = typeof data.type === 'string' ? data.type : 'base';\n this.options = typeof data.options !== 'undefined' && data.options !== null ? data.options : {};\n this.indexes = Array.isArray(data.indexes) ? data.indexes : [];\n\n // rules\n this.listRule = typeof data.listRule === 'string' ? data.listRule : null;\n this.viewRule = typeof data.viewRule === 'string' ? data.viewRule : null;\n this.createRule = typeof data.createRule === 'string' ? data.createRule : null;\n this.updateRule = typeof data.updateRule === 'string' ? data.updateRule : null;\n this.deleteRule = typeof data.deleteRule === 'string' ? data.deleteRule : null;\n\n // schema\n data.schema = Array.isArray(data.schema) ? data.schema : [];\n this.schema = [];\n for (let field of data.schema) {\n this.schema.push(new SchemaField(field));\n }\n }\n\n /**\n * @deprecated Please use $isBase instead.\n */\n get isBase(): boolean {\n return this.$isBase;\n }\n\n /**\n * Checks if the current model is \"base\" collection.\n */\n get $isBase(): boolean {\n return this.type === 'base';\n }\n\n /**\n * @deprecated Please use $isAuth instead.\n */\n get isAuth(): boolean {\n return this.$isAuth;\n }\n\n /**\n * Checks if the current model is \"auth\" collection.\n */\n get $isAuth(): boolean {\n return this.type === 'auth';\n }\n\n /**\n * @deprecated Please use $isView instead.\n */\n get isView(): boolean {\n return this.$isView;\n }\n\n /**\n * Checks if the current model is \"view\" collection.\n */\n get $isView(): boolean {\n return this.type === 'view';\n }\n}\n","import Collection from '@/models/Collection';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport default class CollectionService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Collection {\n return new Collection(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/collections';\n }\n\n /**\n * Imports the provided collections.\n *\n * If `deleteMissing` is `true`, all local collections and schema fields,\n * that are not present in the imported configuration, WILL BE DELETED\n * (including their related records data)!\n */\n async import(\n collections: Array,\n deleteMissing: boolean = false,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/import', {\n 'method': 'PUT',\n 'params': queryParams,\n 'body': {\n 'collections': collections,\n 'deleteMissing': deleteMissing,\n }\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class LogRequest extends BaseModel {\n url!: string;\n method!: string;\n status!: number;\n auth!: string;\n remoteIp!: string;\n userIp!: string;\n referer!: string;\n userAgent!: string;\n meta!: { [key: string]: any };\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // fallback to the ip field for backward compatibility\n data.remoteIp = data.remoteIp || data.ip;\n\n this.url = typeof data.url === 'string' ? data.url : '';\n this.method = typeof data.method === 'string' ? data.method : 'GET';\n this.status = typeof data.status === 'number' ? data.status : 200;\n this.auth = typeof data.auth === 'string' ? data.auth : 'guest';\n this.remoteIp = typeof data.remoteIp === 'string' ? data.remoteIp : '';\n this.userIp = typeof data.userIp === 'string' ? data.userIp : '';\n this.referer = typeof data.referer === 'string' ? data.referer : '';\n this.userAgent = typeof data.userAgent === 'string' ? data.userAgent : '';\n this.meta = typeof data.meta === 'object' && data.meta !== null ? data.meta : {};\n }\n}\n","import LogRequest from '@/models/LogRequest';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n LogStatsQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface HourlyStats {\n total: number;\n date: string;\n}\n\nexport default class LogService extends BaseService {\n /**\n * Returns paginated logged requests list.\n */\n getRequestsList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send('/api/logs/requests', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData?.items || [];\n for (const item of responseData.items) {\n items.push(new LogRequest(item));\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns a single logged request by its id.\n */\n getRequest(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/logs/requests/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => new LogRequest(responseData));\n }\n\n /**\n * Returns request logs statistics.\n */\n getRequestsStats(queryParams: LogStatsQueryParams = {}): Promise> {\n return this.client.send('/api/logs/requests/stats', {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => responseData);\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\n\ninterface promiseCallbacks {\n resolve: Function\n reject: Function\n}\n\nexport type UnsubscribeFunc = () => Promise;\n\nexport default class RealtimeService extends BaseService {\n clientId: string = \"\";\n\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 15000;\n private reconnectTimeoutId: any;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number = Infinity;\n private predefinedReconnectIntervals: Array = [\n 200, 300, 500, 1000, 1200, 1500, 2000,\n ];\n private pendingConnects: Array = [];\n\n\n /**\n * Returns whether the realtime connection has been established.\n */\n get isConnected(): boolean {\n return !!this.eventSource && !!this.clientId && !this.pendingConnects.length;\n }\n\n /**\n * Register the subscription listener.\n *\n * You can subscribe multiple times to the same topic.\n *\n * If the SSE connection is not started yet,\n * this method will also initialize it.\n */\n async subscribe(topic: string, callback: (data: any) => void): Promise {\n if (!topic) {\n throw new Error('topic must be set.')\n }\n\n const listener = function (e: Event) {\n const msgEvent = (e as MessageEvent);\n\n let data;\n try {\n data = JSON.parse(msgEvent?.data);\n } catch {}\n\n callback(data || {});\n };\n\n // store the listener\n if (!this.subscriptions[topic]) {\n this.subscriptions[topic] = [];\n }\n this.subscriptions[topic].push(listener);\n\n if (!this.isConnected) {\n // initialize sse connection\n await this.connect();\n } else if (this.subscriptions[topic].length === 1) {\n // send the updated subscriptions (if it is the first for the topic)\n await this.submitSubscriptions();\n } else {\n // only register the listener\n this.eventSource?.addEventListener(topic, listener);\n }\n\n return async (): Promise => {\n return this.unsubscribeByTopicAndListener(topic, listener);\n };\n }\n\n /**\n * Unsubscribe from all subscription listeners with the specified topic.\n *\n * If `topic` is not provided, then this method will unsubscribe\n * from all active subscriptions.\n *\n * This method is no-op if there are no active subscriptions.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribe(topic?: string): Promise {\n if (!this.hasSubscriptionListeners(topic)) {\n return; // already unsubscribed\n }\n\n if (!topic) {\n // remove all subscriptions\n this.subscriptions = {};\n } else {\n // remove all topic listeners\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n /**\n * Unsubscribe from all subscription listeners starting with the specified topic prefix.\n *\n * This method is no-op if there are no active subscriptions with the specified topic prefix.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByPrefix(topicPrefix: string): Promise {\n let hasAtleastOneTopic = false;\n for (let topic in this.subscriptions) {\n if (!topic.startsWith(topicPrefix)) {\n continue;\n }\n\n hasAtleastOneTopic = true;\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!hasAtleastOneTopic) {\n return; // nothing to unsubscribe from\n }\n\n if (this.hasSubscriptionListeners()) {\n // submit the deleted subscriptions\n await this.submitSubscriptions();\n } else {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n }\n }\n\n /**\n * Unsubscribe from all subscriptions matching the specified topic and listener function.\n *\n * This method is no-op if there are no active subscription with\n * the specified topic and listener.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByTopicAndListener(topic: string, listener: EventListener): Promise {\n if (!Array.isArray(this.subscriptions[topic]) || !this.subscriptions[topic].length) {\n return; // already unsubscribed\n }\n\n let exist = false;\n for (let i = this.subscriptions[topic].length - 1; i >= 0; i--) {\n if (this.subscriptions[topic][i] !== listener) {\n continue;\n }\n\n exist = true; // has at least one matching listener\n delete this.subscriptions[topic][i]; // removes the function reference\n this.subscriptions[topic].splice(i, 1); // reindex the array\n this.eventSource?.removeEventListener(topic, listener);\n }\n if (!exist) {\n return;\n }\n\n // remove the topic from the subscriptions list if there are no other listeners\n if (!this.subscriptions[topic].length) {\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n private hasSubscriptionListeners(topicToCheck?: string): boolean {\n this.subscriptions = this.subscriptions || {};\n\n // check the specified topic\n if (topicToCheck) {\n return !!this.subscriptions[topicToCheck]?.length;\n }\n\n // check for at least one non-empty topic\n for (let topic in this.subscriptions) {\n if (!!this.subscriptions[topic]?.length) {\n return true\n }\n }\n\n return false;\n }\n\n private async submitSubscriptions(): Promise {\n if (!this.clientId) {\n return; // no client/subscriber\n }\n\n // optimistic update\n this.addAllSubscriptionListeners();\n\n this.lastSentTopics = this.getNonEmptySubscriptionTopics();\n\n return this.client.send('/api/realtime', {\n 'method': 'POST',\n 'body': {\n 'clientId': this.clientId,\n 'subscriptions': this.lastSentTopics,\n },\n 'params': {\n '$cancelKey': \"realtime_\" + this.clientId,\n },\n }).catch((err) => {\n if (err?.isAbort) {\n return; // silently ignore aborted pending requests\n }\n throw err;\n });\n }\n\n private getNonEmptySubscriptionTopics(): Array {\n const result : Array = [];\n\n for (let topic in this.subscriptions) {\n if (this.subscriptions[topic].length) {\n result.push(topic);\n }\n }\n\n return result;\n }\n\n private addAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n this.removeAllSubscriptionListeners();\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.addEventListener(topic, listener);\n }\n }\n }\n\n private removeAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.removeEventListener(topic, listener);\n }\n }\n }\n\n private async connect(): Promise {\n if (this.reconnectAttempts > 0) {\n // immediately resolve the promise to avoid indefinitely\n // blocking the client during reconnection\n return;\n }\n\n return new Promise((resolve, reject) => {\n this.pendingConnects.push({ resolve, reject });\n\n if (this.pendingConnects.length > 1) {\n // all promises will be resolved once the connection is established\n return;\n }\n\n this.initConnect();\n })\n }\n\n private initConnect() {\n this.disconnect(true);\n\n // wait up to 15s for connect\n clearTimeout(this.connectTimeoutId);\n this.connectTimeoutId = setTimeout(() => {\n this.connectErrorHandler(new Error(\"EventSource connect took too long.\"));\n }, this.maxConnectTimeout);\n\n this.eventSource = new EventSource(this.client.buildUrl('/api/realtime'))\n\n this.eventSource.onerror = (_) => {\n this.connectErrorHandler(new Error(\"Failed to establish realtime connection.\"));\n };\n\n this.eventSource.addEventListener('PB_CONNECT', (e) => {\n const msgEvent = (e as MessageEvent);\n this.clientId = msgEvent?.lastEventId;\n\n this.submitSubscriptions()\n .then(async () => {\n let retries = 3;\n while (this.hasUnsentSubscriptions() && retries > 0) {\n retries--;\n // resubscribe to ensure that the latest topics are submitted\n //\n // This is needed because missed topics could happen on reconnect\n // if after the pending sent `submitSubscriptions()` call another `subscribe()`\n // was made before the submit was able to complete.\n await this.submitSubscriptions();\n }\n }).then(() => {\n for (let p of this.pendingConnects) {\n p.resolve();\n }\n\n // reset connect meta\n this.pendingConnects = [];\n this.reconnectAttempts = 0;\n clearTimeout(this.reconnectTimeoutId);\n clearTimeout(this.connectTimeoutId);\n }).catch((err) => {\n this.clientId = \"\";\n this.connectErrorHandler(err);\n });\n });\n }\n\n private hasUnsentSubscriptions(): boolean {\n const latestTopics = this.getNonEmptySubscriptionTopics();\n if (latestTopics.length != this.lastSentTopics.length) {\n return true;\n }\n\n for (const t of latestTopics) {\n if (!this.lastSentTopics.includes(t)) {\n return true;\n }\n }\n\n return false;\n }\n\n private connectErrorHandler(err: any) {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n\n if (\n // wasn't previously connected -> direct reject\n (!this.clientId && !this.reconnectAttempts) ||\n // was previously connected but the max reconnection limit has been reached\n this.reconnectAttempts > this.maxReconnectAttempts\n ) {\n for (let p of this.pendingConnects) {\n p.reject(new ClientResponseError(err));\n }\n this.disconnect();\n return;\n }\n\n // otherwise -> reconnect in the background\n this.disconnect(true);\n const timeout = this.predefinedReconnectIntervals[this.reconnectAttempts] || this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length - 1];\n this.reconnectAttempts++;\n this.reconnectTimeoutId = setTimeout(() => {\n this.initConnect();\n }, timeout);\n }\n\n private disconnect(fromReconnect = false): void {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n this.removeAllSubscriptionListeners();\n this.eventSource?.close();\n this.eventSource = null;\n this.clientId = \"\";\n\n if (!fromReconnect) {\n this.reconnectAttempts = 0;\n\n // reject any remaining connect promises\n const err = new ClientResponseError(new Error(\"Realtime disconnected.\"));\n for (let p of this.pendingConnects) {\n p.reject(err);\n }\n this.pendingConnects = [];\n }\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface HealthCheckResponse {\n code: number;\n message: string;\n data: {[key: string]: any};\n}\n\nexport default class HealthService extends BaseService {\n /**\n * Checks the health status of the api.\n */\n check(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/health', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport default class FileService extends BaseService {\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n const parts = [];\n parts.push(\"api\")\n parts.push(\"files\")\n parts.push(encodeURIComponent(record.collectionId || record.collectionName))\n parts.push(encodeURIComponent(record.id))\n parts.push(encodeURIComponent(filename))\n\n let result = this.client.buildUrl(parts.join('/'));\n\n if (Object.keys(queryParams).length) {\n const params = new URLSearchParams(queryParams);\n result += (result.includes(\"?\") ? \"&\" : \"?\") + params;\n }\n\n return result\n }\n\n /**\n * Requests a new private file access token for the current auth model (admin or record).\n */\n getToken(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/files/token', {\n 'method': 'POST',\n 'params': queryParams,\n }).then((data) => data?.token || '');\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface BackupFileInfo {\n key: string;\n size: number;\n modified: string;\n}\n\nexport default class BackupService extends BaseService {\n /**\n * Returns list with all available backup files.\n */\n getFullList(queryParams: BaseQueryParams = {}): Promise> {\n return this.client.send('/api/backups', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n\n /**\n * Initializes a new backup.\n */\n create(basename: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'name': basename,\n };\n\n return this.client.send('/api/backups', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Deletes a single backup file.\n */\n delete(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}`, {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Initializes an app data restore from an existing backup.\n */\n restore(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}/restore`, {\n 'method': 'POST',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Builds a download url for a single existing backup using an\n * admin file token and the backup file key.\n *\n * The file token can be generated via `pb.files.getToken()`.\n */\n getDownloadUrl(token: string, key: string): string {\n return this.client.buildUrl(`/api/backups/${encodeURIComponent(key)}?token=${encodeURIComponent(token)}`);\n }\n}\n","import ClientResponseError from '@/ClientResponseError';\nimport BaseAuthStore from '@/stores/BaseAuthStore';\nimport LocalAuthStore from '@/stores/LocalAuthStore';\nimport SettingsService from '@/services/SettingsService';\nimport AdminService from '@/services/AdminService';\nimport RecordService from '@/services/RecordService';\nimport CollectionService from '@/services/CollectionService';\nimport LogService from '@/services/LogService';\nimport RealtimeService from '@/services/RealtimeService';\nimport HealthService from '@/services/HealthService';\nimport FileService from '@/services/FileService';\nimport BackupService from '@/services/BackupService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport interface SendOptions extends RequestInit {\n headers?: { [key: string]: string };\n body?: any;\n params?: BaseQueryParams;\n}\n\nexport interface BeforeSendResult {\n [key: string]: any, // for backward compatibility\n url?: string,\n options?: {[key: string]: any}\n}\n\n/**\n * PocketBase JS Client.\n */\nexport default class Client {\n /**\n * The base PocketBase backend url address (eg. 'http://127.0.0.1.8090').\n */\n baseUrl: string;\n\n /**\n * Hook that get triggered right before sending the fetch request,\n * allowing you to inspect and modify the url and request options.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * You can return a non-empty result object `{ url, options }` to replace the url and request options entirely.\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, options) {\n * options.headers = Object.assign({}, options.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return { url, options }\n * };\n * ```\n */\n beforeSend?: (url: string, options: SendOptions) => BeforeSendResult|Promise;\n\n /**\n * Hook that get triggered after successfully sending the fetch request,\n * allowing you to inspect/modify the response object and its parsed data.\n *\n * Returns the new Promise resolved `data` that will be returned to the client.\n *\n * Example:\n * ```js\n * client.afterSend = function (response, data) {\n * if (response.status != 200) {\n * throw new ClientResponseError({\n * url: response.url,\n * status: response.status,\n * data: data,\n * });\n * }\n *\n * return data;\n * };\n * ```\n */\n afterSend?: (response: Response, data: any) => any;\n\n /**\n * Optional language code (default to `en-US`) that will be sent\n * with the requests to the server as `Accept-Language` header.\n */\n lang: string;\n\n /**\n * A replaceable instance of the local auth store service.\n */\n authStore: BaseAuthStore;\n\n /**\n * An instance of the service that handles the **Settings APIs**.\n */\n readonly settings: SettingsService;\n\n /**\n * An instance of the service that handles the **Admin APIs**.\n */\n readonly admins: AdminService;\n\n /**\n * An instance of the service that handles the **Collection APIs**.\n */\n readonly collections: CollectionService;\n\n /**\n * An instance of the service that handles the **File APIs**.\n */\n readonly files: FileService;\n\n /**\n * An instance of the service that handles the **Log APIs**.\n */\n readonly logs: LogService;\n\n /**\n * An instance of the service that handles the **Realtime APIs**.\n */\n readonly realtime: RealtimeService;\n\n /**\n * An instance of the service that handles the **Health APIs**.\n */\n readonly health: HealthService;\n\n /**\n * An instance of the service that handles the **Backup APIs**.\n */\n readonly backups: BackupService;\n\n private cancelControllers: { [key: string]: AbortController } = {};\n private recordServices: { [key: string]: RecordService } = {};\n private enableAutoCancellation: boolean = true;\n\n constructor(\n baseUrl = '/',\n authStore?: BaseAuthStore | null,\n lang = 'en-US',\n ) {\n this.baseUrl = baseUrl;\n this.lang = lang;\n this.authStore = authStore || new LocalAuthStore();\n\n // services\n this.admins = new AdminService(this);\n this.collections = new CollectionService(this);\n this.files = new FileService(this);\n this.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(this);\n this.health = new HealthService(this);\n this.backups = new BackupService(this);\n }\n\n /**\n * Returns the RecordService associated to the specified collection.\n *\n * @param {string} idOrName\n * @return {RecordService}\n */\n collection(idOrName: string): RecordService {\n if (!this.recordServices[idOrName]) {\n this.recordServices[idOrName] = new RecordService(this, idOrName);\n }\n\n return this.recordServices[idOrName];\n }\n\n /**\n * Globally enable or disable auto cancellation for pending duplicated requests.\n */\n autoCancellation(enable: boolean): Client {\n this.enableAutoCancellation = !!enable;\n\n return this;\n }\n\n /**\n * Cancels single request by its cancellation key.\n */\n cancelRequest(cancelKey: string): Client {\n if (this.cancelControllers[cancelKey]) {\n this.cancelControllers[cancelKey].abort();\n delete this.cancelControllers[cancelKey];\n }\n\n return this;\n }\n\n /**\n * Cancels all pending requests.\n */\n cancelAllRequests(): Client {\n for (let k in this.cancelControllers) {\n this.cancelControllers[k].abort();\n }\n\n this.cancelControllers = {};\n\n return this;\n }\n\n /**\n * Sends an api http request.\n */\n async send(path: string, reqOptions: SendOptions): Promise {\n let options = Object.assign({ method: 'GET' } as SendOptions, reqOptions);\n\n // JSON serialize the body if needed and set the correct content type\n // (for FormData body the Content-Type header should be skipped since the boundary is autogenerated)\n if (!this.isFormData(options.body)) {\n if (options.body && typeof options.body !== 'string') {\n options.body = JSON.stringify(options.body);\n }\n\n // add the json header (if not already)\n if (typeof options?.headers?.['Content-Type'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof options?.headers?.['Accept-Language'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Accept-Language': this.lang,\n });\n }\n\n // check if Authorization header can be added\n if (\n // has stored token\n this.authStore?.token &&\n // auth header is not explicitly set\n (typeof options?.headers?.Authorization === 'undefined')\n ) {\n options.headers = Object.assign({}, options.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && options.params?.$autoCancel !== false) {\n const cancelKey = options.params?.$cancelKey || ((options.method || 'GET') + path);\n\n // cancel previous pending requests\n this.cancelRequest(cancelKey);\n\n const controller = new AbortController();\n this.cancelControllers[cancelKey] = controller;\n options.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete options.params?.$autoCancel;\n delete options.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof options.params !== 'undefined') {\n const query = this.serializeQueryParams(options.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete options.params;\n }\n\n if (this.beforeSend) {\n const result = Object.assign({}, await this.beforeSend(url, options));\n if (typeof result.url !== \"undefined\" || typeof result.options !== \"undefined\") {\n url = result.url || url;\n options = result.options || options;\n } else if (Object.keys(result).length) {\n // legacy behavior\n options = result as SendOptions;\n console?.warn && console.warn(\"Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`.\");\n }\n }\n\n // send the request\n return fetch(url, options)\n .then(async (response) => {\n let data : any = {};\n\n try {\n data = await response.json();\n } catch (_) {\n // all api responses are expected to return json\n // with the exception of the realtime event and 204\n }\n\n if (this.afterSend) {\n data = await this.afterSend(response, data);\n }\n\n if (response.status >= 400) {\n throw new ClientResponseError({\n url: response.url,\n status: response.status,\n data: data,\n });\n }\n\n return data as T;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Legacy alias of `pb.files.getUrl()`.\n */\n getFileUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n return this.files.getUrl(record, filename, queryParams);\n }\n\n /**\n * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl;\n\n // construct an absolute base url if in a browser environment\n if (\n typeof window !== 'undefined' &&\n !!window.location &&\n !url.startsWith('https://') &&\n !url.startsWith('http://')\n ) {\n url = window.location.origin?.endsWith('/') ?\n window.location.origin.substring(0, window.location.origin.length - 1) :\n (window.location.origin || '');\n\n if (!this.baseUrl.startsWith('/')) {\n url += window.location.pathname || '/';\n url += url.endsWith('/') ? '' : '/';\n }\n\n url += this.baseUrl;\n }\n\n // concatenate the path\n if (path) {\n url += url.endsWith('/') ? '' : '/'; // append trailing slash if missing\n url += path.startsWith('/') ? path.substring(1) : path;\n }\n\n return url;\n }\n\n /**\n * Loosely checks if the specified body is a FormData instance.\n */\n private isFormData(body: any): boolean {\n return body && (\n // we are checking the constructor name because FormData\n // is not available natively in some environments and the\n // polyfill(s) may not be globally accessible\n body.constructor.name === 'FormData' ||\n // fallback to global FormData instance check\n // note: this is needed because the constructor.name could be different in case of\n // custom global FormData implementation, eg. React Native on Android/iOS\n (typeof FormData !== \"undefined\" && body instanceof FormData)\n )\n }\n\n /**\n * Serializes the provided query parameters into a query string.\n */\n private serializeQueryParams(params: {[key: string]: any}): string {\n const result: Array = [];\n for (const key in params) {\n if (params[key] === null) {\n // skip null query params\n continue;\n }\n\n const value = params[key];\n const encodedKey = encodeURIComponent(key);\n\n if (Array.isArray(value)) {\n // \"repeat\" array params\n for (const v of value) {\n result.push(encodedKey + \"=\" + encodeURIComponent(v));\n }\n } else if (value instanceof Date) {\n result.push(encodedKey + \"=\" + encodeURIComponent(value.toISOString()));\n } else if (typeof value !== null && typeof value === 'object') {\n result.push(encodedKey + \"=\" + encodeURIComponent(JSON.stringify(value)));\n } else {\n result.push(encodedKey + \"=\" + encodeURIComponent(value));\n }\n }\n\n return result.join('&');\n }\n}\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__extends","TypeError","String","__","this","constructor","create","__assign","assign","t","s","i","n","arguments","length","apply","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","adopt","then","__generator","body","f","y","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","v","op","pop","push","atobPolyfill","ClientResponseError","_super","errData","_this","url","status","response","isAbort","originalError","data","DOMException","name","message","_a","_d","_c","_b","cause","includes","defineProperty","get","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","isDate","toString","Date","valueOf","toUTCString","httpOnly","secure","priority","toLowerCase","sameSite","defaultDecode","indexOf","decodeURIComponent","encodeURIComponent","getTokenPayload","token","encodedPayload","split","map","c","charCodeAt","slice","join","JSON","parse","atob","input","str","replace","bs","buffer","bc","idx","output","charAt","fromCharCode","BaseModel","$load","load","_i","entries","key","id","created","updated","clone","$clone","structuredClone","stringify","export","$export","Record","collectionId","collectionName","_loadExpand","expand","isArray","Admin","avatar","email","defaultCookieKey","LocalAuthStore","storageKey","storageFallback","_storageGet","model","save","_storageSet","clear","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","isTokenExpired","expirationThreshold","payload","keys","exp","now","triggerChange","loadFromCookie","cookie","rawData","cookieParse","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","exportToCookie","defaultOptions","resultLength","Blob","size","username","verified","onChange","callback","fireImmediately","splice","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","filesystem","testEmail","toEmail","emailTemplate","template","generateAppleClientSecret","clientId","teamId","keyId","privateKey","duration","ListResult","page","perPage","totalItems","totalPages","items","CrudService","getFullList","batchOrqueryParams","_getFullList","baseCrudPath","batch","getList","_getList","getFirstListItem","filter","_getFirstListItem","getOne","_getOne","_create","_update","delete","_delete","BaseCrudService","basePath","batchSize","request","list","castedList","concat","item","$cancelKey","code","AdminService","authStore","success","authResponse","admin","authWithPassword","password","identity","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","batchOrQueryParams","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2Code","codeVerifier","redirectUrl","createData","authWithOAuth2","args","config","authMethods","find","buildUrl","oldState","unsubscribe_1","state","query","authData","err_2","URL","authUrl","searchParams","set","scopes","urlCallback","_defaultUrlCallback","err_1","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","open","width","height","windowWidth","innerWidth","windowHeight","innerHeight","left","top","SchemaField","type","system","required","Collection","indexes","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","$isBase","$isAuth","$isView","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","eventSource","subscriptions","lastSentTopics","maxConnectTimeout","reconnectAttempts","maxReconnectAttempts","Infinity","predefinedReconnectIntervals","pendingConnects","listener","msgEvent","isConnected","connect","submitSubscriptions","addEventListener","unsubscribeByTopicAndListener","hasSubscriptionListeners","removeEventListener","disconnect","topicPrefix","hasAtleastOneTopic","startsWith","exist","topicToCheck","addAllSubscriptionListeners","getNonEmptySubscriptionTopics","catch","err","removeAllSubscriptionListeners","initConnect","clearTimeout","connectTimeoutId","setTimeout","connectErrorHandler","EventSource","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","timeout","fromReconnect","close","HealthService","check","FileService","getUrl","filename","parts","URLSearchParams","getToken","BackupService","basename","restore","getDownloadUrl","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","files","logs","settings","health","backups","collection","idOrName","autoCancellation","enable","cancelRequest","cancelKey","abort","cancelAllRequests","k","reqOptions","isFormData","headers","Authorization","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","serializeQueryParams","beforeSend","_k","_j","_l","_m","fetch","json","afterSend","getFileUrl","location","origin","endsWith","substring","pathname","FormData","encodedKey","value_1","toISOString"],"mappings":"aAgBA,IAAIA,cAAgB,SAASC,EAAGC,GAI5B,OAHAF,cAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,CAAE,GACzE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOC,OAAOK,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,KACzFP,cAAcC,EAAGC,EAC5B,EAEO,SAASS,UAAUV,EAAGC,GACzB,GAAiB,mBAANA,GAA0B,OAANA,EAC3B,MAAM,IAAIU,UAAU,uBAAyBC,OAAOX,GAAK,iCAE7D,SAASY,KAAOC,KAAKC,YAAcf,CAAI,CADvCD,cAAcC,EAAGC,GAEjBD,EAAEO,UAAkB,OAANN,EAAaC,OAAOc,OAAOf,IAAMY,GAAGN,UAAYN,EAAEM,UAAW,IAAIM,GACnF,CAEO,IAAII,SAAW,WAQlB,OAPAA,SAAWf,OAAOgB,QAAU,SAASD,SAASE,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAIf,KADTc,EAAIG,UAAUF,GACOnB,OAAOK,UAAUC,eAAeC,KAAKW,EAAGd,KAAIa,EAAEb,GAAKc,EAAEd,IAE9E,OAAOa,CACV,EACMF,SAASQ,MAAMX,KA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CvT,OAAOqT,SAASC,OAAOE,UAAU,EAAGxT,OAAOqT,SAASC,OAAO3c,OAAS,GACnEqJ,OAAOqT,SAASC,QAAU,GAE1Brd,KAAK0a,QAAQrC,WAAW,OACzB/U,GAAOyG,OAAOqT,SAASI,UAAY,IACnCla,GAAOA,EAAIga,SAAS,KAAO,GAAK,KAGpCha,GAAOtD,KAAK0a,SAIZnV,IACAjC,GAAOA,EAAIga,SAAS,KAAO,GAAK,IAChCha,GAAOiC,EAAK8S,WAAW,KAAO9S,EAAKgY,UAAU,GAAKhY,GAG/CjC,GAMHmX,OAAUhb,UAAAsc,WAAlB,SAAmBha,GACf,OAAOA,IAIuB,aAA1BA,EAAK9B,YAAY4D,MAII,oBAAb4Z,UAA4B1b,aAAgB0b,WAOpDhD,OAAoBhb,UAAAid,qBAA5B,SAA6B5P,GACzB,IAAMpL,EAAwB,GAC9B,IAAK,IAAMwG,KAAO4E,EACd,GAAoB,OAAhBA,EAAO5E,GAAX,CAKA,IAAM7G,EAAQyL,EAAO5E,GACfwV,EAAapX,mBAAmB4B,GAEtC,GAAI3I,MAAM0J,QAAQ5H,GAEd,IAAgB,QAAAsc,EAAAtc,EAAA2G,EAAK2V,EAAAjd,OAALsH,IAAO,CAAlB,IAAMnF,EAAC8a,EAAA3V,GACRtG,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBzD,GACrD,MACMxB,aAAiBsE,KACxBjE,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBjF,EAAMuc,gBAChC,cAAVvc,GAAmC,iBAAVA,EACvCK,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBU,KAAKyB,UAAUpH,KAEjEK,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBjF,GAfrD,CAmBL,OAAOK,EAAOqF,KAAK,MAE1B0T,MAAD"} \ No newline at end of file +{"version":3,"file":"pocketbase.cjs.js","sources":["../node_modules/tslib/tslib.es6.js","../src/ClientResponseError.ts","../src/stores/utils/jwt.ts","../src/stores/utils/cookie.ts","../src/models/utils/BaseModel.ts","../src/models/Record.ts","../src/models/Admin.ts","../src/stores/BaseAuthStore.ts","../src/stores/LocalAuthStore.ts","../src/services/utils/BaseService.ts","../src/services/SettingsService.ts","../src/models/utils/ListResult.ts","../src/services/utils/CrudService.ts","../src/services/utils/BaseCrudService.ts","../src/services/AdminService.ts","../src/models/ExternalAuth.ts","../src/services/RecordService.ts","../src/models/utils/SchemaField.ts","../src/models/Collection.ts","../src/services/CollectionService.ts","../src/models/LogRequest.ts","../src/services/LogService.ts","../src/services/RealtimeService.ts","../src/services/HealthService.ts","../src/services/FileService.ts","../src/services/BackupService.ts","../src/Client.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","/**\n * ClientResponseError is a custom Error class that is intended to wrap\n * and normalize any error thrown by `Client.send()`.\n */\nexport default class ClientResponseError extends Error {\n url: string = '';\n status: number = 0;\n response: {[key: string]: any} = {};\n isAbort: boolean = false;\n originalError: any = null;\n\n constructor(errData?: any) {\n super(\"ClientResponseError\");\n\n // Set the prototype explicitly.\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, ClientResponseError.prototype);\n\n if (!(errData instanceof ClientResponseError)) {\n this.originalError = errData;\n }\n\n if (errData !== null && typeof errData === 'object') {\n this.url = typeof errData.url === 'string' ? errData.url : '';\n this.status = typeof errData.status === 'number' ? errData.status : 0;\n this.response = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\n this.isAbort = !!errData.isAbort;\n }\n\n if (typeof DOMException !== 'undefined' && errData instanceof DOMException) {\n this.isAbort = true;\n }\n\n this.name = \"ClientResponseError \" + this.status;\n this.message = this.response?.message;\n if (!this.message) {\n if (this.isAbort) {\n this.message = 'The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.';\n } else if (this.originalError?.cause?.message?.includes(\"ECONNREFUSED ::1\")) {\n this.message = 'Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).';\n } else {\n this.message = 'Something went wrong while processing your request.';\n }\n }\n }\n\n /**\n * Alias for `this.response` to preserve the backward compatibility.\n */\n get data() {\n return this.response;\n }\n\n /**\n * Make a POJO's copy of the current error class instance.\n * @see https://github.com/vuex-orm/vuex-orm/issues/255\n */\n toJSON() {\n return { ...this };\n }\n}\n","let atobPolyfill: Function;\nif (typeof atob === 'function') {\n atobPolyfill = atob\n} else {\n /**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n atobPolyfill = (input: any) => {\n const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n let str = String(input).replace(/=+$/, \"\");\n if (str.length % 4 == 1) {\n throw new Error(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = \"\";\n // get next character\n (buffer = str.charAt(idx++));\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? (bs as any) * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ?\n (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) :\n 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n\n return output;\n };\n}\n\n/**\n * Returns JWT token's payload data.\n */\nexport function getTokenPayload(token: string): { [key: string]: any } {\n if (token) {\n try {\n const encodedPayload = decodeURIComponent(atobPolyfill(token.split('.')[1]).split('').map(function (c: string) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n\n return JSON.parse(encodedPayload) || {};\n } catch (e) {\n }\n }\n\n return {};\n}\n\n/**\n * Checks whether a JWT token is expired or not.\n * Tokens without `exp` payload key are considered valid.\n * Tokens with empty payload (eg. invalid token strings) are considered expired.\n *\n * @param token The token to check.\n * @param [expirationThreshold] Time in seconds that will be subtracted from the token `exp` property.\n */\nexport function isTokenExpired(token: string, expirationThreshold = 0): boolean {\n let payload = getTokenPayload(token);\n\n if (\n Object.keys(payload).length > 0 &&\n (!payload.exp || (payload.exp - expirationThreshold) > (Date.now() / 1000))\n ) {\n return false;\n }\n\n return true;\n}\n","/**\n * -------------------------------------------------------------------\n * Simple cookie parse and serialize utilities mostly based on the\n * node module https://github.com/jshttp/cookie.\n * -------------------------------------------------------------------\n */\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\nexport interface ParseOptions{\n decode?: (val: string) => string,\n}\n\n/**\n* Parses the given cookie header string into an object\n* The object has the various cookies as keys(names) => values\n*/\nexport function cookieParse(str: string, options?: ParseOptions): { [key: string]: any } {\n const result: { [key: string]: any } = {};\n\n if (typeof str !== 'string') {\n return result;\n }\n\n const opt = Object.assign({}, options || {});\n const decode = opt.decode || defaultDecode;\n\n let index = 0;\n while (index < str.length) {\n const eqIdx = str.indexOf('=', index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = str.indexOf(';', index);\n\n if (endIdx === -1) {\n endIdx = str.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1;\n continue;\n }\n\n const key = str.slice(index, eqIdx).trim();\n\n // only assign once\n if (undefined === result[key]) {\n let val = str.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n result[key] = decode(val);\n } catch (_) {\n result[key] = val; // no decoding\n }\n }\n\n index = endIdx + 1;\n }\n\n return result;\n};\n\nexport interface SerializeOptions{\n encode?: (val: string | number | boolean) => string,\n maxAge?: number,\n domain?: string,\n path?: string,\n expires?: Date,\n httpOnly?: boolean,\n secure?: boolean,\n priority?: string,\n sameSite?: boolean|string,\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * ```js\n * cookieSerialize('foo', 'bar', { httpOnly: true }) // \"foo=bar; httpOnly\"\n * ```\n */\nexport function cookieSerialize(name: string, val: string, options?: SerializeOptions): string {\n const opt = Object.assign({}, options || {});\n const encode = opt.encode || defaultEncode;\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n const value = encode(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n let result = name + '=' + value;\n\n if (opt.maxAge != null) {\n const maxAge = opt.maxAge - 0;\n\n if (isNaN(maxAge) || !isFinite(maxAge)) {\n throw new TypeError('option maxAge is invalid');\n }\n\n result += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n result += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n result += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (!isDate(opt.expires) || isNaN(opt.expires.valueOf())) {\n throw new TypeError('option expires is invalid');\n }\n\n result += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n result += '; HttpOnly';\n }\n\n if (opt.secure) {\n result += '; Secure';\n }\n\n if (opt.priority) {\n const priority = typeof opt.priority === 'string' ? opt.priority.toLowerCase() : opt.priority;\n\n switch (priority) {\n case 'low':\n result += '; Priority=Low';\n break;\n case 'medium':\n result += '; Priority=Medium';\n break;\n case 'high':\n result += '; Priority=High';\n break;\n default:\n throw new TypeError('option priority is invalid');\n }\n }\n\n if (opt.sameSite) {\n const sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n result += '; SameSite=Strict';\n break;\n case 'lax':\n result += '; SameSite=Lax';\n break;\n case 'strict':\n result += '; SameSite=Strict';\n break;\n case 'none':\n result += '; SameSite=None';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return result;\n};\n\n/**\n * Default URL-decode string value function.\n * Optimized to skip native call when no `%`.\n */\nfunction defaultDecode(val: string): string {\n return val.indexOf('%') !== -1\n ? decodeURIComponent(val)\n : val;\n}\n\n/**\n * Default URL-encode value function.\n */\nfunction defaultEncode(val: string | number | boolean): string {\n return encodeURIComponent(val);\n}\n\n/**\n * Determines if value is a Date.\n */\nfunction isDate(val: any): boolean {\n return (\n Object.prototype.toString.call(val) === '[object Date]' ||\n val instanceof Date\n );\n}\n","export default abstract class BaseModel {\n [key: string]: any,\n\n id!: string;\n created!: string;\n updated!: string;\n\n constructor(data: { [key: string]: any } = {}) {\n this.$load(data || {});\n }\n\n /**\n * Alias of this.$load(data).\n */\n load(data: { [key: string]: any }) {\n return this.$load(data);\n }\n\n /**\n * Loads `data` into the current model.\n */\n $load(data: { [key: string]: any }) {\n for (const [key, value] of Object.entries(data)) {\n this[key] = value;\n }\n\n // normalize known fields\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.created = typeof data.created !== 'undefined' ? data.created : '';\n this.updated = typeof data.updated !== 'undefined' ? data.updated : '';\n }\n\n /**\n * Returns whether the current loaded data represent a stored db record.\n */\n get $isNew(): boolean {\n return !this.id;\n }\n\n /**\n * Alias of this.clone().\n */\n clone(): BaseModel {\n return this.$clone();\n }\n\n /**\n * Creates a deep clone of the current model.\n */\n $clone(): BaseModel {\n const clone = typeof structuredClone === 'function' ?\n structuredClone(this) : JSON.parse(JSON.stringify(this));\n\n return new (this.constructor as any)(clone);\n }\n\n /**\n * Alias of this.$export().\n */\n export(): { [key: string]: any } {\n return this.$export();\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n $export(): { [key: string]: any } {\n return typeof structuredClone === 'function' ?\n structuredClone(this) : Object.assign({}, this);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Record extends BaseModel {\n collectionId!: string;\n collectionName!: string;\n expand!: {[key: string]: Record|Array};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // normalize common fields\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.collectionName = typeof data.collectionName === 'string' ? data.collectionName : '';\n\n // normalize expand items\n this._loadExpand(data.expand);\n }\n\n /**\n * Loads the provided expand items and recursively normalizes each\n * item to a `Record|Array`.\n */\n private _loadExpand(expand: { [key: string]: any }) {\n expand = expand || {};\n this.expand = {};\n\n for (const key in expand) {\n if (Array.isArray(expand[key])) {\n this.expand[key] = expand[key].map((data: any) => new Record(data || {}));\n } else {\n this.expand[key] = new Record(expand[key] || {});\n }\n }\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Admin extends BaseModel {\n avatar!: number;\n email!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.avatar = typeof data.avatar === 'number' ? data.avatar : 0;\n this.email = typeof data.email === 'string' ? data.email : '';\n }\n}\n","import { cookieParse, cookieSerialize, SerializeOptions } from '@/stores/utils/cookie';\nimport { isTokenExpired, getTokenPayload } from '@/stores/utils/jwt';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\nexport type OnStoreChangeFunc = (token: string, model: Record|Admin|null) => void;\n\nconst defaultCookieKey = 'pb_auth';\n\n/**\n * Base AuthStore class that is intended to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore {\n protected baseToken: string = '';\n protected baseModel: Record|Admin|null = null;\n\n private _onChangeCallbacks: Array = [];\n\n /**\n * Retrieves the stored token (if any).\n */\n get token(): string {\n return this.baseToken;\n }\n\n /**\n * Retrieves the stored model data (if any).\n */\n get model(): Record|Admin|null {\n return this.baseModel;\n }\n\n /**\n * Loosely checks if the store has valid token (aka. existing and unexpired exp claim).\n */\n get isValid(): boolean {\n return !isTokenExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: Record|Admin|null): void {\n this.baseToken = token || '';\n\n // normalize the model instance\n if (model !== null && typeof model === 'object') {\n this.baseModel = typeof (model as any).collectionId !== 'undefined' ?\n new Record(model) : new Admin(model);\n } else {\n this.baseModel = null;\n }\n\n this.triggerChange();\n }\n\n /**\n * Removes the stored token and model data form the auth store.\n */\n clear(): void {\n this.baseToken = '';\n this.baseModel = null;\n this.triggerChange();\n }\n\n /**\n * Parses the provided cookie string and updates the store state\n * with the cookie's token and model data.\n *\n * NB! This function doesn't validate the token or its data.\n * Usually this isn't a concern if you are interacting only with the\n * PocketBase API because it has the proper server-side security checks in place,\n * but if you are using the store `isValid` state for permission controls\n * in a node server (eg. SSR), then it is recommended to call `authRefresh()`\n * after loading the cookie to ensure an up-to-date token and model state.\n * For example:\n *\n * ```js\n * pb.authStore.loadFromCookie(\"cookie string...\");\n *\n * try {\n * // get an up-to-date auth store state by veryfing and refreshing the loaded auth model (if any)\n * pb.authStore.isValid && await pb.collection('users').authRefresh();\n * } catch (_) {\n * // clear the auth store on failed refresh\n * pb.authStore.clear();\n * }\n * ```\n */\n loadFromCookie(cookie: string, key = defaultCookieKey): void {\n const rawData = cookieParse(cookie || '')[key] || '';\n\n let data: { [key: string]: any } = {};\n try {\n data = JSON.parse(rawData);\n // normalize\n if (typeof data === null || typeof data !== 'object' || Array.isArray(data)) {\n data = {};\n }\n } catch (_) {}\n\n this.save(data.token || '', data.model || null);\n }\n\n /**\n * Exports the current store state as cookie string.\n *\n * By default the following optional attributes are added:\n * - Secure\n * - HttpOnly\n * - SameSite=Strict\n * - Path=/\n * - Expires={the token expiration date}\n *\n * NB! If the generated cookie exceeds 4096 bytes, this method will\n * strip the model data to the bare minimum to try to fit within the\n * recommended size in https://www.rfc-editor.org/rfc/rfc6265#section-6.1.\n */\n exportToCookie(options?: SerializeOptions, key = defaultCookieKey): string {\n const defaultOptions: SerializeOptions = {\n secure: true,\n sameSite: true,\n httpOnly: true,\n path: \"/\",\n };\n\n // extract the token expiration date\n const payload = getTokenPayload(this.token);\n if (payload?.exp) {\n defaultOptions.expires = new Date(payload.exp * 1000);\n } else {\n defaultOptions.expires = new Date('1970-01-01');\n }\n\n // merge with the user defined options\n options = Object.assign({}, defaultOptions, options);\n\n const rawData = {\n token: this.token,\n model: this.model?.export() || null,\n };\n\n let result = cookieSerialize(key, JSON.stringify(rawData), options);\n\n const resultLength = typeof Blob !== 'undefined' ?\n (new Blob([result])).size : result.length;\n\n // strip down the model data to the bare minimum\n if (rawData.model && resultLength > 4096) {\n rawData.model = {id: rawData?.model?.id, email: rawData?.model?.email};\n if (this.model instanceof Record) {\n rawData.model.username = this.model.username;\n rawData.model.verified = this.model.verified;\n rawData.model.collectionId = this.model.collectionId;\n }\n result = cookieSerialize(key, JSON.stringify(rawData), options);\n }\n\n return result;\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * You can set the `fireImmediately` argument to true in order to invoke\n * the provided callback right after registration.\n *\n * Returns a removal function that you could call to \"unsubscribe\" from the changes.\n */\n onChange(callback: OnStoreChangeFunc, fireImmediately = false): () => void {\n this._onChangeCallbacks.push(callback);\n\n if (fireImmediately) {\n callback(this.token, this.model);\n }\n\n return () => {\n for (let i = this._onChangeCallbacks.length - 1; i >= 0; i--) {\n if (this._onChangeCallbacks[i] == callback) {\n delete this._onChangeCallbacks[i]; // removes the function reference\n this._onChangeCallbacks.splice(i, 1); // reindex the array\n return;\n }\n }\n }\n }\n\n protected triggerChange(): void {\n for (const callback of this._onChangeCallbacks) {\n callback && callback(this.token, this.model);\n }\n }\n}\n","import BaseAuthStore from '@/stores/BaseAuthStore';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\n/**\n * The default token store for browsers with auto fallback\n * to runtime/memory if local storage is undefined (eg. in node env).\n */\nexport default class LocalAuthStore extends BaseAuthStore {\n private storageFallback: { [key: string]: any } = {};\n private storageKey: string\n\n constructor(storageKey = \"pocketbase_auth\") {\n super();\n\n this.storageKey = storageKey;\n }\n\n /**\n * @inheritdoc\n */\n get token(): string {\n const data = this._storageGet(this.storageKey) || {};\n\n return data.token || '';\n }\n\n /**\n * @inheritdoc\n */\n get model(): Record|Admin|null {\n const data = this._storageGet(this.storageKey) || {};\n\n if (\n data === null ||\n typeof data !== 'object' ||\n data.model === null ||\n typeof data.model !== 'object'\n ) {\n return null;\n }\n\n // admins don't have `collectionId` prop\n if (typeof data.model?.collectionId === 'undefined') {\n return new Admin(data.model);\n }\n\n return new Record(data.model);\n }\n\n /**\n * @inheritdoc\n */\n save(token: string, model: Record|Admin|null) {\n this._storageSet(this.storageKey, {\n 'token': token,\n 'model': model,\n });\n\n super.save(token, model);\n }\n\n /**\n * @inheritdoc\n */\n clear() {\n this._storageRemove(this.storageKey);\n\n super.clear();\n }\n\n // ---------------------------------------------------------------\n // Internal helpers:\n // ---------------------------------------------------------------\n\n /**\n * Retrieves `key` from the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageGet(key: string): any {\n if (typeof window !== 'undefined' && window?.localStorage) {\n const rawValue = window.localStorage.getItem(key) || '';\n try {\n return JSON.parse(rawValue);\n } catch (e) { // not a json\n return rawValue;\n }\n }\n\n // fallback\n return this.storageFallback[key];\n }\n\n /**\n * Stores a new data in the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageSet(key: string, value: any) {\n if (typeof window !== 'undefined' && window?.localStorage) {\n // store in local storage\n let normalizedVal = value;\n if (typeof value !== 'string') {\n normalizedVal = JSON.stringify(value);\n }\n window.localStorage.setItem(key, normalizedVal);\n } else {\n // store in fallback\n this.storageFallback[key] = value;\n }\n }\n\n /**\n * Removes `key` from the browser's local storage and the runtime/memory.\n */\n private _storageRemove(key: string) {\n // delete from local storage\n if (typeof window !== 'undefined' && window?.localStorage) {\n window.localStorage?.removeItem(key);\n }\n\n // delete from fallback\n delete this.storageFallback[key];\n }\n}\n","import Client from '@/Client';\n\n/**\n * BaseService class that should be inherited from all API services.\n */\nexport default abstract class BaseService {\n readonly client: Client\n\n constructor(client: Client) {\n this.client = client;\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\ninterface appleClientSecret {\n secret: string;\n}\n\nexport default class SettingsService extends BaseService {\n /**\n * Fetch all available app settings.\n */\n getAll(queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Bulk updates app settings.\n */\n update(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Performs a S3 filesystem connection test.\n *\n * The currently supported `filesystem` are \"storage\" and \"backups\".\n */\n testS3(filesystem: string = \"storage\", queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'filesystem': filesystem,\n };\n\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends a test email.\n *\n * The possible `emailTemplate` values are:\n * - verification\n * - password-reset\n * - email-change\n */\n testEmail(toEmail: string, emailTemplate: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'email': toEmail,\n 'template': emailTemplate,\n };\n\n return this.client.send('/api/settings/test/email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Generates a new Apple OAuth2 client secret.\n */\n generateAppleClientSecret(\n clientId: string,\n teamId: string,\n keyId: string,\n privateKey: string,\n duration: number,\n bodyParams = {},\n queryParams: BaseQueryParams = {}\n ): Promise {\n bodyParams = Object.assign({\n clientId,\n teamId,\n keyId,\n privateKey,\n duration,\n }, bodyParams);\n\n return this.client.send('/api/settings/apple/generate-client-secret', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n });\n }\n}\n","import BaseModel from './BaseModel';\n\nexport default class ListResult {\n page!: number;\n perPage!: number;\n totalItems!: number;\n totalPages!: number;\n items!: Array;\n\n constructor(\n page: number,\n perPage: number,\n totalItems: number,\n totalPages: number,\n items: Array,\n ) {\n this.page = page > 0 ? page : 1;\n this.perPage = perPage >= 0 ? perPage : 0;\n this.totalItems = totalItems >= 0 ? totalItems : 0;\n this.totalPages = totalPages >= 0 ? totalPages : 0;\n this.items = items || [];\n }\n}\n","import ListResult from '@/models/utils/ListResult';\nimport BaseModel from '@/models/utils/BaseModel';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n FullListQueryParams\n} from '@/services/utils/QueryParams';\n\nexport default abstract class CrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/admins').\n */\n abstract get baseCrudPath(): string\n\n /**\n * Returns a promise with all list items batch fetched at once\n * (by default 200 items per request; to change it set the `batch` query param).\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(queryParams?: FullListQueryParams): Promise>\n\n /**\n * Legacy version of getFullList with explicitly specified batch size.\n */\n getFullList(batch?: number, queryParams?: ListQueryParams): Promise>\n\n getFullList(batchOrqueryParams?: number|FullListQueryParams, queryParams?: ListQueryParams): Promise> {\n if (typeof batchOrqueryParams == \"number\") {\n return this._getFullList(this.baseCrudPath, batchOrqueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrqueryParams, queryParams);\n\n return this._getFullList(this.baseCrudPath, params.batch || 200, params);\n }\n\n /**\n * Returns paginated items list.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n return this._getList(this.baseCrudPath, page, perPage, queryParams);\n }\n\n /**\n * Returns the first found item by the specified filter.\n *\n * Internally it calls `getList(1, 1, { filter })` and returns the\n * first found item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n *\n * For consistency with `getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n getFirstListItem(filter: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getFirstListItem(this.baseCrudPath, filter, queryParams);\n }\n\n /**\n * Returns single item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getOne(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getOne(this.baseCrudPath, id, queryParams);\n }\n\n /**\n * Creates a new item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n create(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._create(this.baseCrudPath, bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._update(this.baseCrudPath, id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._delete(this.baseCrudPath, id, queryParams);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\nimport {\n BaseQueryParams,\n ListQueryParams\n} from '@/services/utils/QueryParams';\n\n// @todo since there is no longer need of SubCrudService consider merging with CrudService in v0.9+\nexport default abstract class BaseCrudService extends BaseService {\n /**\n * Response data decoder.\n */\n abstract decode(data: { [key: string]: any }): M\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n protected _getFullList(basePath: string, batchSize = 200, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize || 200, queryParams).then((list) => {\n const castedList = (list as any as ListResult);\n const items = castedList.items;\n const totalItems = castedList.totalItems;\n\n result = result.concat(items);\n\n if (items.length && totalItems > result.length) {\n return request(page + 1);\n }\n\n return result;\n });\n }\n\n return request(1);\n }\n\n /**\n * Returns paginated items list.\n */\n protected _getList(basePath: string, page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send(basePath, {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData.items || [];\n for (const item of responseData.items) {\n items.push(this.decode(item) as any as T);\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns single item by its id.\n */\n protected _getOne(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Returns the first found item by a list filter.\n *\n * Internally it calls `_getList(basePath, 1, 1, { filter })` and returns its\n * first item.\n *\n * For consistency with `_getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n protected _getFirstListItem(basePath: string, filter: string, queryParams: BaseQueryParams = {}): Promise {\n queryParams = Object.assign({\n 'filter': filter,\n '$cancelKey': 'one_by_filter_' + basePath + \"_\" + filter,\n }, queryParams);\n\n return this._getList(basePath, 1, 1, queryParams)\n .then((result) => {\n if (!result?.items?.length) {\n throw new ClientResponseError({\n status: 404,\n data: {\n code: 404,\n message: \"The requested resource wasn't found.\",\n data: {},\n },\n });\n }\n\n return result.items[0];\n });\n }\n\n /**\n * Creates a new item.\n */\n protected _create(basePath: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath, {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Updates an existing item by its id.\n */\n protected _update(basePath: string, id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n protected _delete(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n}\n","import Admin from '@/models/Admin';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface AdminAuthResponse {\n [key: string]: any;\n\n token: string;\n admin: Admin;\n}\n\nexport default class AdminService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Admin {\n return new Admin(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/admins';\n }\n\n // ---------------------------------------------------------------\n // Post update/delete AuthStore sync\n // ---------------------------------------------------------------\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n // update the store state if the updated item id matches with the stored model\n if (\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === item?.id\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n // clear the store state if the deleted item id matches with the stored model\n if (\n success &&\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === id\n ) {\n this.client.authStore.clear();\n }\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful authorize response.\n */\n protected authResponse(responseData: any): AdminAuthResponse {\n const admin = this.decode(responseData?.admin || {});\n\n if (responseData?.token && responseData?.admin) {\n this.client.authStore.save(responseData.token, admin);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'admin': admin,\n });\n }\n\n /**\n * Authenticate an admin account with its email and password\n * and returns a new admin token and data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authWithPassword(\n email: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'identity': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Refreshes the current admin authenticated instance and\n * returns a new token and admin data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authRefresh(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCrudPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends admin password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms admin password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class ExternalAuth extends BaseModel {\n recordId!: string;\n collectionId!: string;\n provider!: string;\n providerId!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.recordId = typeof data.recordId === 'string' ? data.recordId : '';\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.provider = typeof data.provider === 'string' ? data.provider : '';\n this.providerId = typeof data.providerId === 'string' ? data.providerId : '';\n }\n}\n","import Client from '@/Client';\nimport ClientResponseError from '@/ClientResponseError';\nimport Record from '@/models/Record';\nimport ExternalAuth from '@/models/ExternalAuth';\nimport ListResult from '@/models/utils/ListResult';\nimport CrudService from '@/services/utils/CrudService';\nimport { UnsubscribeFunc } from '@/services/RealtimeService';\nimport {\n BaseQueryParams,\n RecordQueryParams,\n RecordListQueryParams,\n RecordFullListQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface RecordAuthResponse {\n record: T;\n token: string;\n meta?: {[key: string]: any};\n}\n\nexport interface AuthProviderInfo {\n name: string;\n state: string;\n codeVerifier: string;\n codeChallenge: string;\n codeChallengeMethod: string;\n authUrl: string;\n}\n\nexport interface AuthMethodsList {\n usernamePassword: boolean;\n emailPassword: boolean;\n authProviders: Array;\n}\n\nexport interface RecordSubscription {\n action: string; // eg. create, update, delete\n record: T;\n}\n\nexport type OAuth2UrlCallback = (url: string) => void|Promise;\n\nexport interface OAuth2AuthConfig {\n // the name of the OAuth2 provider (eg. \"google\")\n provider: string;\n\n // custom scopes to overwrite the default ones\n scopes?: Array;\n\n // optional record create data\n createData?: {[key: string]: any};\n\n // optional callback that is triggered after the OAuth2 sign-in/sign-up url generation\n urlCallback?: OAuth2UrlCallback;\n\n // optional query params to send with the PocketBase auth request (eg. fields, expand, etc.)\n query?: RecordQueryParams;\n\n // optional body params to send with the PocketBase auth request\n body?: {[key: string]: any};\n}\n\nexport default class RecordService extends CrudService {\n readonly collectionIdOrName: string;\n\n constructor(client: Client, collectionIdOrName: string) {\n super(client);\n\n this.collectionIdOrName = collectionIdOrName;\n }\n\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): T {\n return new Record(data) as any as T;\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return this.baseCollectionPath + '/records';\n }\n\n /**\n * Returns the current collection service base path.\n */\n get baseCollectionPath(): string {\n return '/api/collections/' + encodeURIComponent(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Realtime handlers\n // ---------------------------------------------------------------\n\n /**\n * @deprecated Use subscribe(recordId, callback) instead.\n *\n * Subscribe to the realtime changes of a single record in the collection.\n */\n async subscribeOne(recordId: string, callback: (data: RecordSubscription) => void): Promise {\n console.warn(\"PocketBase: subscribeOne(recordId, callback) is deprecated. Please replace it with subscribe(recordId, callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName + \"/\" + recordId, callback);\n }\n\n /**\n * @deprecated This form of subscribe is deprecated. Please use `subscribe(\"*\", callback)`.\n */\n async subscribe(callback: (data: RecordSubscription) => void): Promise\n\n /**\n * Subscribe to realtime changes to the specified topic (\"*\" or record id).\n *\n * If `topic` is the wildcard \"*\", then this method will subscribe to\n * any record changes in the collection.\n *\n * If `topic` is a record id, then this method will subscribe only\n * to changes of the specified record id.\n *\n * It's OK to subscribe multiple times to the same topic.\n * You can use the returned `UnsubscribeFunc` to remove only a single subscription.\n * Or use `unsubscribe(topic)` if you want to remove all subscriptions attached to the topic.\n */\n async subscribe(topic: string, callback: (data: RecordSubscription) => void): Promise\n\n async subscribe(\n topicOrCallback: string|((data: RecordSubscription) => void),\n callback?: (data: RecordSubscription) => void\n ): Promise {\n if (typeof topicOrCallback === 'function') {\n console.warn(\"PocketBase: subscribe(callback) is deprecated. Please replace it with subscribe('*', callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName, topicOrCallback);\n }\n\n if (!callback) {\n throw new Error(\"Missing subscription callback.\");\n }\n\n if (topicOrCallback === \"\") {\n throw new Error(\"Missing topic.\");\n }\n\n let topic = this.collectionIdOrName;\n if (topicOrCallback !== \"*\") {\n topic += ('/' + topicOrCallback);\n }\n\n return this.client.realtime.subscribe(topic, callback)\n }\n\n /**\n * Unsubscribe from all subscriptions of the specified topic\n * (\"*\" or record id).\n *\n * If `topic` is not set, then this method will unsubscribe from\n * all subscriptions associated to the current collection.\n */\n async unsubscribe(topic?: string): Promise {\n // unsubscribe wildcard topic\n if (topic === \"*\") {\n return this.client.realtime.unsubscribe(this.collectionIdOrName);\n }\n\n // unsubscribe recordId topic\n if (topic) {\n return this.client.realtime.unsubscribe(this.collectionIdOrName + \"/\" + topic);\n }\n\n // unsubscribe from everything related to the collection\n return this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Crud handers\n // ---------------------------------------------------------------\n /**\n * @inheritdoc\n */\n getFullList(queryParams?: RecordFullListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batch?: number, queryParams?: RecordListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batchOrQueryParams?: number|RecordFullListQueryParams, queryParams?: RecordListQueryParams): Promise> {\n if (typeof batchOrQueryParams == \"number\") {\n return super.getFullList(batchOrQueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrQueryParams, queryParams);\n\n return super.getFullList(params);\n }\n\n /**\n * @inheritdoc\n */\n getList(page = 1, perPage = 30, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getList(page, perPage, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getFirstListItem(filter: string, queryParams: RecordListQueryParams = {}): Promise {\n return super.getFirstListItem(filter, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getOne(id: string, queryParams: RecordQueryParams = {}): Promise {\n return super.getOne(id, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n create(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.create(bodyParams, queryParams);\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n if (\n // is record auth\n this.client.authStore.model?.id === item?.id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n if (\n success &&\n // is record auth\n this.client.authStore.model?.id === id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.clear();\n }\n\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful collection authorization response.\n */\n protected authResponse(responseData: any): RecordAuthResponse {\n const record = this.decode(responseData?.record || {});\n\n this.client.authStore.save(responseData?.token, record);\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'record': record as any as T,\n });\n }\n\n /**\n * Returns all available collection auth methods.\n */\n listAuthMethods(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCollectionPath + '/auth-methods', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n return Object.assign({}, responseData, {\n // normalize common fields\n 'usernamePassword': !!responseData?.usernamePassword,\n 'emailPassword': !!responseData?.emailPassword,\n 'authProviders': Array.isArray(responseData?.authProviders) ? responseData?.authProviders : [],\n });\n });\n }\n\n /**\n * Authenticate a single auth collection record via its username/email and password.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n */\n authWithPassword(\n usernameOrEmail: string,\n password: string,\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'identity': usernameOrEmail,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2 code.\n *\n * If you don't have an OAuth2 code you may also want to check `authWithOAuth2` method.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n */\n authWithOAuth2Code(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData = {},\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'provider': provider,\n 'code': code,\n 'codeVerifier': codeVerifier,\n 'redirectUrl': redirectUrl,\n 'createData': createData,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-oauth2', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * @deprecated This form of authWithOAuth2 is deprecated.\n *\n * Please use `authWithOAuth2Code()` OR its simplified realtime version\n * as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\n */\n async authWithOAuth2(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData?: {[key: string]: any},\n bodyParams?: {[key: string]: any},\n queryParams?: RecordQueryParams,\n ): Promise>\n\n /**\n * Authenticate a single auth collection record with OAuth2\n * **without custom redirects, deeplinks or even page reload**.\n *\n * This method initializes a one-off realtime subscription and will\n * open a popup window with the OAuth2 vendor page to authenticate.\n * Once the external OAuth2 sign-in/sign-up flow is completed, the popup\n * window will be automatically closed and the OAuth2 data sent back\n * to the user through the previously established realtime connection.\n *\n * You can specify an optional `urlCallback` prop to customize\n * the default url `window.open` behavior.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n *\n * Example:\n *\n * ```js\n * const authData = await pb.collection(\"users\").authWithOAuth2({\n * provider: \"google\",\n * })\n * ```\n *\n * _Site-note_: when creating the OAuth2 app in the provider dashboard\n * you have to configure `https://yourdomain.com/api/oauth2-redirect`\n * as redirect URL.\n */\n async authWithOAuth2(options: OAuth2AuthConfig): Promise>\n\n async authWithOAuth2(...args: any): Promise> {\n // fallback to legacy format\n if (args.length > 1 || typeof args?.[0] === 'string') {\n console.warn(\"PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\");\n return this.authWithOAuth2Code(\n args?.[0] || '',\n args?.[1] || '',\n args?.[2] || '',\n args?.[3] || '',\n args?.[4] || {},\n args?.[5] || {},\n args?.[6] || {},\n );\n }\n\n const config = args?.[0] || {};\n\n const authMethods = await this.listAuthMethods();\n\n const provider = authMethods.authProviders.find((p) => p.name === config.provider);\n if (!provider) {\n throw new ClientResponseError(new Error(`Missing or invalid provider \"${config.provider}\".`));\n }\n\n const redirectUrl = this.client.buildUrl('/api/oauth2-redirect');\n\n return new Promise(async (resolve, reject) => {\n try {\n // initialize a one-off @oauth2 realtime subscription\n const unsubscribe = await this.client.realtime.subscribe('@oauth2', async (e) => {\n const oldState = this.client.realtime.clientId;\n\n try {\n unsubscribe();\n\n if (!e.state || oldState !== e.state) {\n throw new Error(\"State parameters don't match.\");\n }\n\n const authData = await this.authWithOAuth2Code(\n provider.name,\n e.code,\n provider.codeVerifier,\n redirectUrl,\n config.createData,\n config.body,\n config.query,\n )\n\n resolve(authData);\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n\n const url = new URL(provider.authUrl + redirectUrl);\n url.searchParams.set(\"state\", this.client.realtime.clientId);\n if (config.scopes?.length) {\n url.searchParams.set(\"scope\", config.scopes.join(\" \"));\n }\n\n await (config.urlCallback ? config.urlCallback(url.toString()) : this._defaultUrlCallback(url.toString()));\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n }\n\n /**\n * Refreshes the current authenticated record instance and\n * returns a new token and record data.\n *\n * On success this method also automatically updates the client's AuthStore.\n */\n authRefresh(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise> {\n return this.client.send(this.baseCollectionPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Sends auth record password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends auth record verification email request.\n */\n requestVerification(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record email verification request.\n */\n confirmVerification(\n verificationToken: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': verificationToken,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends an email change request to the authenticated record model.\n */\n requestEmailChange(\n newEmail: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'newEmail': newEmail,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record's new email address.\n */\n confirmEmailChange(\n emailChangeToken: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': emailChangeToken,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Lists all linked external auth providers for the specified auth record.\n */\n listExternalAuths(\n recordId: string,\n queryParams: BaseQueryParams = {}\n ): Promise> {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => {\n const items: Array = [];\n\n if (Array.isArray(responseData)) {\n for (const item of responseData) {\n items.push(new ExternalAuth(item));\n }\n }\n\n return items;\n });\n }\n\n /**\n * Unlink a single external auth provider from the specified auth record.\n */\n unlinkExternalAuth(\n recordId: string,\n provider: string,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths/' + encodeURIComponent(provider), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n // ---------------------------------------------------------------\n\n private _defaultUrlCallback(url: string) {\n if (typeof window === \"undefined\" || !window?.open) {\n throw new ClientResponseError(new Error(`Not in a browser context - please pass a custom urlCallback function.`));\n }\n\n let width = 1024;\n let height = 768;\n\n let windowWidth = window.innerWidth;\n let windowHeight = window.innerHeight;\n\n // normalize window size\n width = width > windowWidth ? windowWidth : width;\n height = height > windowHeight ? windowHeight : height;\n\n let left = (windowWidth / 2) - (width / 2);\n let top = (windowHeight / 2) - (height / 2);\n\n window.open(\n url,\n \"oauth2-popup\",\n 'width='+width+',height='+height+',top='+top+',left='+left+',resizable,menubar=no'\n );\n }\n}\n","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.name = typeof data.name !== 'undefined' ? data.name : '';\n this.type = typeof data.type !== 'undefined' ? data.type : 'text';\n this.system = !!data.system;\n this.required = !!data.required;\n this.options = typeof data.options === 'object' && data.options !== null ? data.options : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport SchemaField from '@/models/utils/SchemaField';\n\nexport default class Collection extends BaseModel {\n name!: string;\n type!: string;\n schema!: Array;\n indexes!: Array;\n system!: boolean;\n listRule!: null|string;\n viewRule!: null|string;\n createRule!: null|string;\n updateRule!: null|string;\n deleteRule!: null|string;\n options!: {[key:string]: any};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.system = !!data.system;\n this.name = typeof data.name === 'string' ? data.name : '';\n this.type = typeof data.type === 'string' ? data.type : 'base';\n this.options = typeof data.options !== 'undefined' && data.options !== null ? data.options : {};\n this.indexes = Array.isArray(data.indexes) ? data.indexes : [];\n\n // rules\n this.listRule = typeof data.listRule === 'string' ? data.listRule : null;\n this.viewRule = typeof data.viewRule === 'string' ? data.viewRule : null;\n this.createRule = typeof data.createRule === 'string' ? data.createRule : null;\n this.updateRule = typeof data.updateRule === 'string' ? data.updateRule : null;\n this.deleteRule = typeof data.deleteRule === 'string' ? data.deleteRule : null;\n\n // schema\n data.schema = Array.isArray(data.schema) ? data.schema : [];\n this.schema = [];\n for (let field of data.schema) {\n this.schema.push(new SchemaField(field));\n }\n }\n\n /**\n * @deprecated Please use $isBase instead.\n */\n get isBase(): boolean {\n return this.$isBase;\n }\n\n /**\n * Checks if the current model is \"base\" collection.\n */\n get $isBase(): boolean {\n return this.type === 'base';\n }\n\n /**\n * @deprecated Please use $isAuth instead.\n */\n get isAuth(): boolean {\n return this.$isAuth;\n }\n\n /**\n * Checks if the current model is \"auth\" collection.\n */\n get $isAuth(): boolean {\n return this.type === 'auth';\n }\n\n /**\n * @deprecated Please use $isView instead.\n */\n get isView(): boolean {\n return this.$isView;\n }\n\n /**\n * Checks if the current model is \"view\" collection.\n */\n get $isView(): boolean {\n return this.type === 'view';\n }\n}\n","import Collection from '@/models/Collection';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport default class CollectionService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Collection {\n return new Collection(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/collections';\n }\n\n /**\n * Imports the provided collections.\n *\n * If `deleteMissing` is `true`, all local collections and schema fields,\n * that are not present in the imported configuration, WILL BE DELETED\n * (including their related records data)!\n */\n async import(\n collections: Array,\n deleteMissing: boolean = false,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/import', {\n 'method': 'PUT',\n 'params': queryParams,\n 'body': {\n 'collections': collections,\n 'deleteMissing': deleteMissing,\n }\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class LogRequest extends BaseModel {\n url!: string;\n method!: string;\n status!: number;\n auth!: string;\n remoteIp!: string;\n userIp!: string;\n referer!: string;\n userAgent!: string;\n meta!: { [key: string]: any };\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // fallback to the ip field for backward compatibility\n data.remoteIp = data.remoteIp || data.ip;\n\n this.url = typeof data.url === 'string' ? data.url : '';\n this.method = typeof data.method === 'string' ? data.method : 'GET';\n this.status = typeof data.status === 'number' ? data.status : 200;\n this.auth = typeof data.auth === 'string' ? data.auth : 'guest';\n this.remoteIp = typeof data.remoteIp === 'string' ? data.remoteIp : '';\n this.userIp = typeof data.userIp === 'string' ? data.userIp : '';\n this.referer = typeof data.referer === 'string' ? data.referer : '';\n this.userAgent = typeof data.userAgent === 'string' ? data.userAgent : '';\n this.meta = typeof data.meta === 'object' && data.meta !== null ? data.meta : {};\n }\n}\n","import LogRequest from '@/models/LogRequest';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n LogStatsQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface HourlyStats {\n total: number;\n date: string;\n}\n\nexport default class LogService extends BaseService {\n /**\n * Returns paginated logged requests list.\n */\n getRequestsList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send('/api/logs/requests', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData?.items || [];\n for (const item of responseData.items) {\n items.push(new LogRequest(item));\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns a single logged request by its id.\n */\n getRequest(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/logs/requests/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => new LogRequest(responseData));\n }\n\n /**\n * Returns request logs statistics.\n */\n getRequestsStats(queryParams: LogStatsQueryParams = {}): Promise> {\n return this.client.send('/api/logs/requests/stats', {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => responseData);\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\n\ninterface promiseCallbacks {\n resolve: Function\n reject: Function\n}\n\nexport type UnsubscribeFunc = () => Promise;\n\nexport default class RealtimeService extends BaseService {\n clientId: string = \"\";\n\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 15000;\n private reconnectTimeoutId: any;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number = Infinity;\n private predefinedReconnectIntervals: Array = [\n 200, 300, 500, 1000, 1200, 1500, 2000,\n ];\n private pendingConnects: Array = [];\n\n\n /**\n * Returns whether the realtime connection has been established.\n */\n get isConnected(): boolean {\n return !!this.eventSource && !!this.clientId && !this.pendingConnects.length;\n }\n\n /**\n * Register the subscription listener.\n *\n * You can subscribe multiple times to the same topic.\n *\n * If the SSE connection is not started yet,\n * this method will also initialize it.\n */\n async subscribe(topic: string, callback: (data: any) => void): Promise {\n if (!topic) {\n throw new Error('topic must be set.')\n }\n\n const listener = function (e: Event) {\n const msgEvent = (e as MessageEvent);\n\n let data;\n try {\n data = JSON.parse(msgEvent?.data);\n } catch {}\n\n callback(data || {});\n };\n\n // store the listener\n if (!this.subscriptions[topic]) {\n this.subscriptions[topic] = [];\n }\n this.subscriptions[topic].push(listener);\n\n if (!this.isConnected) {\n // initialize sse connection\n await this.connect();\n } else if (this.subscriptions[topic].length === 1) {\n // send the updated subscriptions (if it is the first for the topic)\n await this.submitSubscriptions();\n } else {\n // only register the listener\n this.eventSource?.addEventListener(topic, listener);\n }\n\n return async (): Promise => {\n return this.unsubscribeByTopicAndListener(topic, listener);\n };\n }\n\n /**\n * Unsubscribe from all subscription listeners with the specified topic.\n *\n * If `topic` is not provided, then this method will unsubscribe\n * from all active subscriptions.\n *\n * This method is no-op if there are no active subscriptions.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribe(topic?: string): Promise {\n if (!this.hasSubscriptionListeners(topic)) {\n return; // already unsubscribed\n }\n\n if (!topic) {\n // remove all subscriptions\n this.subscriptions = {};\n } else {\n // remove all topic listeners\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n /**\n * Unsubscribe from all subscription listeners starting with the specified topic prefix.\n *\n * This method is no-op if there are no active subscriptions with the specified topic prefix.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByPrefix(topicPrefix: string): Promise {\n let hasAtleastOneTopic = false;\n for (let topic in this.subscriptions) {\n if (!topic.startsWith(topicPrefix)) {\n continue;\n }\n\n hasAtleastOneTopic = true;\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!hasAtleastOneTopic) {\n return; // nothing to unsubscribe from\n }\n\n if (this.hasSubscriptionListeners()) {\n // submit the deleted subscriptions\n await this.submitSubscriptions();\n } else {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n }\n }\n\n /**\n * Unsubscribe from all subscriptions matching the specified topic and listener function.\n *\n * This method is no-op if there are no active subscription with\n * the specified topic and listener.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByTopicAndListener(topic: string, listener: EventListener): Promise {\n if (!Array.isArray(this.subscriptions[topic]) || !this.subscriptions[topic].length) {\n return; // already unsubscribed\n }\n\n let exist = false;\n for (let i = this.subscriptions[topic].length - 1; i >= 0; i--) {\n if (this.subscriptions[topic][i] !== listener) {\n continue;\n }\n\n exist = true; // has at least one matching listener\n delete this.subscriptions[topic][i]; // removes the function reference\n this.subscriptions[topic].splice(i, 1); // reindex the array\n this.eventSource?.removeEventListener(topic, listener);\n }\n if (!exist) {\n return;\n }\n\n // remove the topic from the subscriptions list if there are no other listeners\n if (!this.subscriptions[topic].length) {\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n private hasSubscriptionListeners(topicToCheck?: string): boolean {\n this.subscriptions = this.subscriptions || {};\n\n // check the specified topic\n if (topicToCheck) {\n return !!this.subscriptions[topicToCheck]?.length;\n }\n\n // check for at least one non-empty topic\n for (let topic in this.subscriptions) {\n if (!!this.subscriptions[topic]?.length) {\n return true\n }\n }\n\n return false;\n }\n\n private async submitSubscriptions(): Promise {\n if (!this.clientId) {\n return; // no client/subscriber\n }\n\n // optimistic update\n this.addAllSubscriptionListeners();\n\n this.lastSentTopics = this.getNonEmptySubscriptionTopics();\n\n return this.client.send('/api/realtime', {\n 'method': 'POST',\n 'body': {\n 'clientId': this.clientId,\n 'subscriptions': this.lastSentTopics,\n },\n 'params': {\n '$cancelKey': this.getSubscriptionsCancelKey(),\n },\n }).catch((err) => {\n if (err?.isAbort) {\n return; // silently ignore aborted pending requests\n }\n throw err;\n });\n }\n\n private getSubscriptionsCancelKey(): string {\n return \"realtime_\" + this.clientId;\n }\n\n private getNonEmptySubscriptionTopics(): Array {\n const result : Array = [];\n\n for (let topic in this.subscriptions) {\n if (this.subscriptions[topic].length) {\n result.push(topic);\n }\n }\n\n return result;\n }\n\n private addAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n this.removeAllSubscriptionListeners();\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.addEventListener(topic, listener);\n }\n }\n }\n\n private removeAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.removeEventListener(topic, listener);\n }\n }\n }\n\n private async connect(): Promise {\n if (this.reconnectAttempts > 0) {\n // immediately resolve the promise to avoid indefinitely\n // blocking the client during reconnection\n return;\n }\n\n return new Promise((resolve, reject) => {\n this.pendingConnects.push({ resolve, reject });\n\n if (this.pendingConnects.length > 1) {\n // all promises will be resolved once the connection is established\n return;\n }\n\n this.initConnect();\n })\n }\n\n private initConnect() {\n this.disconnect(true);\n\n // wait up to 15s for connect\n clearTimeout(this.connectTimeoutId);\n this.connectTimeoutId = setTimeout(() => {\n this.connectErrorHandler(new Error(\"EventSource connect took too long.\"));\n }, this.maxConnectTimeout);\n\n this.eventSource = new EventSource(this.client.buildUrl('/api/realtime'))\n\n this.eventSource.onerror = (_) => {\n this.connectErrorHandler(new Error(\"Failed to establish realtime connection.\"));\n };\n\n this.eventSource.addEventListener('PB_CONNECT', (e) => {\n const msgEvent = (e as MessageEvent);\n this.clientId = msgEvent?.lastEventId;\n\n this.submitSubscriptions()\n .then(async () => {\n let retries = 3;\n while (this.hasUnsentSubscriptions() && retries > 0) {\n retries--;\n // resubscribe to ensure that the latest topics are submitted\n //\n // This is needed because missed topics could happen on reconnect\n // if after the pending sent `submitSubscriptions()` call another `subscribe()`\n // was made before the submit was able to complete.\n await this.submitSubscriptions();\n }\n }).then(() => {\n for (let p of this.pendingConnects) {\n p.resolve();\n }\n\n // reset connect meta\n this.pendingConnects = [];\n this.reconnectAttempts = 0;\n clearTimeout(this.reconnectTimeoutId);\n clearTimeout(this.connectTimeoutId);\n }).catch((err) => {\n this.clientId = \"\";\n this.connectErrorHandler(err);\n });\n });\n }\n\n private hasUnsentSubscriptions(): boolean {\n const latestTopics = this.getNonEmptySubscriptionTopics();\n if (latestTopics.length != this.lastSentTopics.length) {\n return true;\n }\n\n for (const t of latestTopics) {\n if (!this.lastSentTopics.includes(t)) {\n return true;\n }\n }\n\n return false;\n }\n\n private connectErrorHandler(err: any) {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n\n if (\n // wasn't previously connected -> direct reject\n (!this.clientId && !this.reconnectAttempts) ||\n // was previously connected but the max reconnection limit has been reached\n this.reconnectAttempts > this.maxReconnectAttempts\n ) {\n for (let p of this.pendingConnects) {\n p.reject(new ClientResponseError(err));\n }\n this.disconnect();\n return;\n }\n\n // otherwise -> reconnect in the background\n this.disconnect(true);\n const timeout = this.predefinedReconnectIntervals[this.reconnectAttempts] || this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length - 1];\n this.reconnectAttempts++;\n this.reconnectTimeoutId = setTimeout(() => {\n this.initConnect();\n }, timeout);\n }\n\n private disconnect(fromReconnect = false): void {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n this.removeAllSubscriptionListeners();\n this.client.cancelRequest(this.getSubscriptionsCancelKey());\n this.eventSource?.close();\n this.eventSource = null;\n this.clientId = \"\";\n\n if (!fromReconnect) {\n this.reconnectAttempts = 0;\n\n // reject any remaining connect promises\n const err = new ClientResponseError(new Error(\"Realtime disconnected.\"));\n for (let p of this.pendingConnects) {\n p.reject(err);\n }\n this.pendingConnects = [];\n }\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface HealthCheckResponse {\n code: number;\n message: string;\n data: {[key: string]: any};\n}\n\nexport default class HealthService extends BaseService {\n /**\n * Checks the health status of the api.\n */\n check(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/health', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport default class FileService extends BaseService {\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n const parts = [];\n parts.push(\"api\")\n parts.push(\"files\")\n parts.push(encodeURIComponent(record.collectionId || record.collectionName))\n parts.push(encodeURIComponent(record.id))\n parts.push(encodeURIComponent(filename))\n\n let result = this.client.buildUrl(parts.join('/'));\n\n if (Object.keys(queryParams).length) {\n const params = new URLSearchParams(queryParams);\n result += (result.includes(\"?\") ? \"&\" : \"?\") + params;\n }\n\n return result\n }\n\n /**\n * Requests a new private file access token for the current auth model (admin or record).\n */\n getToken(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/files/token', {\n 'method': 'POST',\n 'params': queryParams,\n }).then((data) => data?.token || '');\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface BackupFileInfo {\n key: string;\n size: number;\n modified: string;\n}\n\nexport default class BackupService extends BaseService {\n /**\n * Returns list with all available backup files.\n */\n getFullList(queryParams: BaseQueryParams = {}): Promise> {\n return this.client.send('/api/backups', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n\n /**\n * Initializes a new backup.\n */\n create(basename: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'name': basename,\n };\n\n return this.client.send('/api/backups', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Deletes a single backup file.\n */\n delete(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}`, {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Initializes an app data restore from an existing backup.\n */\n restore(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}/restore`, {\n 'method': 'POST',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Builds a download url for a single existing backup using an\n * admin file token and the backup file key.\n *\n * The file token can be generated via `pb.files.getToken()`.\n */\n getDownloadUrl(token: string, key: string): string {\n return this.client.buildUrl(`/api/backups/${encodeURIComponent(key)}?token=${encodeURIComponent(token)}`);\n }\n}\n","import ClientResponseError from '@/ClientResponseError';\nimport BaseAuthStore from '@/stores/BaseAuthStore';\nimport LocalAuthStore from '@/stores/LocalAuthStore';\nimport SettingsService from '@/services/SettingsService';\nimport AdminService from '@/services/AdminService';\nimport RecordService from '@/services/RecordService';\nimport CollectionService from '@/services/CollectionService';\nimport LogService from '@/services/LogService';\nimport RealtimeService from '@/services/RealtimeService';\nimport HealthService from '@/services/HealthService';\nimport FileService from '@/services/FileService';\nimport BackupService from '@/services/BackupService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport interface SendOptions extends RequestInit {\n headers?: { [key: string]: string };\n body?: any;\n params?: BaseQueryParams;\n}\n\nexport interface BeforeSendResult {\n [key: string]: any, // for backward compatibility\n url?: string,\n options?: {[key: string]: any}\n}\n\n/**\n * PocketBase JS Client.\n */\nexport default class Client {\n /**\n * The base PocketBase backend url address (eg. 'http://127.0.0.1.8090').\n */\n baseUrl: string;\n\n /**\n * Hook that get triggered right before sending the fetch request,\n * allowing you to inspect and modify the url and request options.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * You can return a non-empty result object `{ url, options }` to replace the url and request options entirely.\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, options) {\n * options.headers = Object.assign({}, options.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return { url, options }\n * };\n * ```\n */\n beforeSend?: (url: string, options: SendOptions) => BeforeSendResult|Promise;\n\n /**\n * Hook that get triggered after successfully sending the fetch request,\n * allowing you to inspect/modify the response object and its parsed data.\n *\n * Returns the new Promise resolved `data` that will be returned to the client.\n *\n * Example:\n * ```js\n * client.afterSend = function (response, data) {\n * if (response.status != 200) {\n * throw new ClientResponseError({\n * url: response.url,\n * status: response.status,\n * data: data,\n * });\n * }\n *\n * return data;\n * };\n * ```\n */\n afterSend?: (response: Response, data: any) => any;\n\n /**\n * Optional language code (default to `en-US`) that will be sent\n * with the requests to the server as `Accept-Language` header.\n */\n lang: string;\n\n /**\n * A replaceable instance of the local auth store service.\n */\n authStore: BaseAuthStore;\n\n /**\n * An instance of the service that handles the **Settings APIs**.\n */\n readonly settings: SettingsService;\n\n /**\n * An instance of the service that handles the **Admin APIs**.\n */\n readonly admins: AdminService;\n\n /**\n * An instance of the service that handles the **Collection APIs**.\n */\n readonly collections: CollectionService;\n\n /**\n * An instance of the service that handles the **File APIs**.\n */\n readonly files: FileService;\n\n /**\n * An instance of the service that handles the **Log APIs**.\n */\n readonly logs: LogService;\n\n /**\n * An instance of the service that handles the **Realtime APIs**.\n */\n readonly realtime: RealtimeService;\n\n /**\n * An instance of the service that handles the **Health APIs**.\n */\n readonly health: HealthService;\n\n /**\n * An instance of the service that handles the **Backup APIs**.\n */\n readonly backups: BackupService;\n\n private cancelControllers: { [key: string]: AbortController } = {};\n private recordServices: { [key: string]: RecordService } = {};\n private enableAutoCancellation: boolean = true;\n\n constructor(\n baseUrl = '/',\n authStore?: BaseAuthStore | null,\n lang = 'en-US',\n ) {\n this.baseUrl = baseUrl;\n this.lang = lang;\n this.authStore = authStore || new LocalAuthStore();\n\n // services\n this.admins = new AdminService(this);\n this.collections = new CollectionService(this);\n this.files = new FileService(this);\n this.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(this);\n this.health = new HealthService(this);\n this.backups = new BackupService(this);\n }\n\n /**\n * Returns the RecordService associated to the specified collection.\n *\n * @param {string} idOrName\n * @return {RecordService}\n */\n collection(idOrName: string): RecordService {\n if (!this.recordServices[idOrName]) {\n this.recordServices[idOrName] = new RecordService(this, idOrName);\n }\n\n return this.recordServices[idOrName];\n }\n\n /**\n * Globally enable or disable auto cancellation for pending duplicated requests.\n */\n autoCancellation(enable: boolean): Client {\n this.enableAutoCancellation = !!enable;\n\n return this;\n }\n\n /**\n * Cancels single request by its cancellation key.\n */\n cancelRequest(cancelKey: string): Client {\n if (this.cancelControllers[cancelKey]) {\n this.cancelControllers[cancelKey].abort();\n delete this.cancelControllers[cancelKey];\n }\n\n return this;\n }\n\n /**\n * Cancels all pending requests.\n */\n cancelAllRequests(): Client {\n for (let k in this.cancelControllers) {\n this.cancelControllers[k].abort();\n }\n\n this.cancelControllers = {};\n\n return this;\n }\n\n /**\n * Sends an api http request.\n */\n async send(path: string, reqOptions: SendOptions): Promise {\n let options = Object.assign({ method: 'GET' } as SendOptions, reqOptions);\n\n // JSON serialize the body if needed and set the correct content type\n // (for FormData body the Content-Type header should be skipped since the boundary is autogenerated)\n if (!this.isFormData(options.body)) {\n if (options.body && typeof options.body !== 'string') {\n options.body = JSON.stringify(options.body);\n }\n\n // add the json header (if not already)\n if (typeof options?.headers?.['Content-Type'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof options?.headers?.['Accept-Language'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Accept-Language': this.lang,\n });\n }\n\n // check if Authorization header can be added\n if (\n // has stored token\n this.authStore?.token &&\n // auth header is not explicitly set\n (typeof options?.headers?.Authorization === 'undefined')\n ) {\n options.headers = Object.assign({}, options.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && options.params?.$autoCancel !== false) {\n const cancelKey = options.params?.$cancelKey || ((options.method || 'GET') + path);\n\n // cancel previous pending requests\n this.cancelRequest(cancelKey);\n\n const controller = new AbortController();\n this.cancelControllers[cancelKey] = controller;\n options.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete options.params?.$autoCancel;\n delete options.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof options.params !== 'undefined') {\n const query = this.serializeQueryParams(options.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete options.params;\n }\n\n if (this.beforeSend) {\n const result = Object.assign({}, await this.beforeSend(url, options));\n if (typeof result.url !== \"undefined\" || typeof result.options !== \"undefined\") {\n url = result.url || url;\n options = result.options || options;\n } else if (Object.keys(result).length) {\n // legacy behavior\n options = result as SendOptions;\n console?.warn && console.warn(\"Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`.\");\n }\n }\n\n // send the request\n return fetch(url, options)\n .then(async (response) => {\n let data : any = {};\n\n try {\n data = await response.json();\n } catch (_) {\n // all api responses are expected to return json\n // with the exception of the realtime event and 204\n }\n\n if (this.afterSend) {\n data = await this.afterSend(response, data);\n }\n\n if (response.status >= 400) {\n throw new ClientResponseError({\n url: response.url,\n status: response.status,\n data: data,\n });\n }\n\n return data as T;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Legacy alias of `pb.files.getUrl()`.\n */\n getFileUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n return this.files.getUrl(record, filename, queryParams);\n }\n\n /**\n * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl;\n\n // construct an absolute base url if in a browser environment\n if (\n typeof window !== 'undefined' &&\n !!window.location &&\n !url.startsWith('https://') &&\n !url.startsWith('http://')\n ) {\n url = window.location.origin?.endsWith('/') ?\n window.location.origin.substring(0, window.location.origin.length - 1) :\n (window.location.origin || '');\n\n if (!this.baseUrl.startsWith('/')) {\n url += window.location.pathname || '/';\n url += url.endsWith('/') ? '' : '/';\n }\n\n url += this.baseUrl;\n }\n\n // concatenate the path\n if (path) {\n url += url.endsWith('/') ? '' : '/'; // append trailing slash if missing\n url += path.startsWith('/') ? path.substring(1) : path;\n }\n\n return url;\n }\n\n /**\n * Loosely checks if the specified body is a FormData instance.\n */\n private isFormData(body: any): boolean {\n return body && (\n // we are checking the constructor name because FormData\n // is not available natively in some environments and the\n // polyfill(s) may not be globally accessible\n body.constructor.name === 'FormData' ||\n // fallback to global FormData instance check\n // note: this is needed because the constructor.name could be different in case of\n // custom global FormData implementation, eg. React Native on Android/iOS\n (typeof FormData !== \"undefined\" && body instanceof FormData)\n )\n }\n\n /**\n * Serializes the provided query parameters into a query string.\n */\n private serializeQueryParams(params: {[key: string]: any}): string {\n const result: Array = [];\n for (const key in params) {\n if (params[key] === null) {\n // skip null query params\n continue;\n }\n\n const value = params[key];\n const encodedKey = encodeURIComponent(key);\n\n if (Array.isArray(value)) {\n // \"repeat\" array params\n for (const v of value) {\n result.push(encodedKey + \"=\" + encodeURIComponent(v));\n }\n } else if (value instanceof Date) {\n result.push(encodedKey + \"=\" + encodeURIComponent(value.toISOString()));\n } else if (typeof value !== null && typeof value === 'object') {\n result.push(encodedKey + \"=\" + encodeURIComponent(JSON.stringify(value)));\n } else {\n result.push(encodedKey + \"=\" + encodeURIComponent(value));\n }\n }\n\n return result.join('&');\n }\n}\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__extends","TypeError","String","__","this","constructor","create","__assign","assign","t","s","i","n","arguments","length","apply","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","adopt","then","__generator","body","f","y","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","v","op","pop","push","atobPolyfill","ClientResponseError","_super","errData","_this","url","status","response","isAbort","originalError","data","DOMException","name","message","_a","_d","_c","_b","cause","includes","defineProperty","get","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","isDate","toString","Date","valueOf","toUTCString","httpOnly","secure","priority","toLowerCase","sameSite","defaultDecode","indexOf","decodeURIComponent","encodeURIComponent","getTokenPayload","token","encodedPayload","split","map","c","charCodeAt","slice","join","JSON","parse","atob","input","str","replace","bs","buffer","bc","idx","output","charAt","fromCharCode","BaseModel","$load","load","_i","entries","key","id","created","updated","clone","$clone","structuredClone","stringify","export","$export","Record","collectionId","collectionName","_loadExpand","expand","isArray","Admin","avatar","email","defaultCookieKey","LocalAuthStore","storageKey","storageFallback","_storageGet","model","save","_storageSet","clear","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","isTokenExpired","expirationThreshold","payload","keys","exp","now","triggerChange","loadFromCookie","cookie","rawData","cookieParse","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","exportToCookie","defaultOptions","resultLength","Blob","size","username","verified","onChange","callback","fireImmediately","splice","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","filesystem","testEmail","toEmail","emailTemplate","template","generateAppleClientSecret","clientId","teamId","keyId","privateKey","duration","ListResult","page","perPage","totalItems","totalPages","items","CrudService","getFullList","batchOrqueryParams","_getFullList","baseCrudPath","batch","getList","_getList","getFirstListItem","filter","_getFirstListItem","getOne","_getOne","_create","_update","delete","_delete","BaseCrudService","basePath","batchSize","request","list","castedList","concat","item","$cancelKey","code","AdminService","authStore","success","authResponse","admin","authWithPassword","password","identity","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","batchOrQueryParams","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2Code","codeVerifier","redirectUrl","createData","authWithOAuth2","args","config","authMethods","find","buildUrl","oldState","unsubscribe_1","state","query","authData","err_2","URL","authUrl","searchParams","set","scopes","urlCallback","_defaultUrlCallback","err_1","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","open","width","height","windowWidth","innerWidth","windowHeight","innerHeight","left","top","SchemaField","type","system","required","Collection","indexes","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","$isBase","$isAuth","$isView","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","eventSource","subscriptions","lastSentTopics","maxConnectTimeout","reconnectAttempts","maxReconnectAttempts","Infinity","predefinedReconnectIntervals","pendingConnects","listener","msgEvent","isConnected","connect","submitSubscriptions","addEventListener","unsubscribeByTopicAndListener","hasSubscriptionListeners","removeEventListener","disconnect","topicPrefix","hasAtleastOneTopic","startsWith","exist","topicToCheck","addAllSubscriptionListeners","getNonEmptySubscriptionTopics","getSubscriptionsCancelKey","catch","err","removeAllSubscriptionListeners","initConnect","clearTimeout","connectTimeoutId","setTimeout","connectErrorHandler","EventSource","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","timeout","fromReconnect","cancelRequest","close","HealthService","check","FileService","getUrl","filename","parts","URLSearchParams","getToken","BackupService","basename","restore","getDownloadUrl","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","files","logs","settings","health","backups","collection","idOrName","autoCancellation","enable","cancelKey","abort","cancelAllRequests","k","reqOptions","isFormData","headers","Authorization","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","serializeQueryParams","beforeSend","_k","_j","_l","_m","fetch","json","afterSend","getFileUrl","location","origin","endsWith","substring","pathname","FormData","encodedKey","value_1","toISOString"],"mappings":"aAgBA,IAAIA,cAAgB,SAASC,EAAGC,GAI5B,OAHAF,cAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,CAAE,GACzE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOC,OAAOK,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,KACzFP,cAAcC,EAAGC,EA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wB,GAC9B,IAAK,IAAMwG,KAAO4E,EACd,GAAoB,OAAhBA,EAAO5E,GAAX,CAKA,IAAM7G,EAAQyL,EAAO5E,GACfyV,EAAarX,mBAAmB4B,GAEtC,GAAI3I,MAAM0J,QAAQ5H,GAEd,IAAgB,QAAAuc,EAAAvc,EAAA2G,EAAK4V,EAAAld,OAALsH,IAAO,CAAlB,IAAMnF,EAAC+a,EAAA5V,GACRtG,EAAOsB,KAAK2a,EAAa,IAAMrX,mBAAmBzD,GACrD,MACMxB,aAAiBsE,KACxBjE,EAAOsB,KAAK2a,EAAa,IAAMrX,mBAAmBjF,EAAMwc,gBAChC,cAAVxc,GAAmC,iBAAVA,EACvCK,EAAOsB,KAAK2a,EAAa,IAAMrX,mBAAmBU,KAAKyB,UAAUpH,KAEjEK,EAAOsB,KAAK2a,EAAa,IAAMrX,mBAAmBjF,GAfrD,CAmBL,OAAOK,EAAOqF,KAAK,MAE1B4T,MAAD"} \ No newline at end of file diff --git a/dist/pocketbase.es.d.mts b/dist/pocketbase.es.d.mts index 2ee0d1a..15f888b 100644 --- a/dist/pocketbase.es.d.mts +++ b/dist/pocketbase.es.d.mts @@ -475,6 +475,7 @@ declare class RealtimeService extends BaseService { unsubscribeByTopicAndListener(topic: string, listener: EventListener): Promise; private hasSubscriptionListeners; private submitSubscriptions; + private getSubscriptionsCancelKey; private getNonEmptySubscriptionTopics; private addAllSubscriptionListeners; private removeAllSubscriptionListeners; diff --git a/dist/pocketbase.es.js b/dist/pocketbase.es.js index 44811a4..30eee7a 100644 --- a/dist/pocketbase.es.js +++ b/dist/pocketbase.es.js @@ -1,2 +1,2 @@ -var extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},extendStatics(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}var __assign=function(){return __assign=Object.assign||function __assign(e){for(var t,n=1,i=arguments.length;n0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0&&(!n.exp||n.exp-t>Date.now()/1e3))}e="function"==typeof atob?atob:function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,i,o=0,r=0,s="";i=t.charAt(r++);~i&&(n=o%4?64*n+i:i,o++%4)?s+=String.fromCharCode(255&n>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var i=function(){function BaseModel(e){void 0===e&&(e={}),this.$load(e||{})}return BaseModel.prototype.load=function(e){return this.$load(e)},BaseModel.prototype.$load=function(e){for(var t=0,n=Object.entries(e);t4096&&(u.model={id:null===(i=null==u?void 0:u.model)||void 0===i?void 0:i.id,email:null===(r=null==u?void 0:u.model)||void 0===r?void 0:r.email},this.model instanceof o&&(u.model.username=this.model.username,u.model.verified=this.model.verified,u.model.collectionId=this.model.collectionId),l=cookieSerialize(t,JSON.stringify(u),e)),l},BaseAuthStore.prototype.onChange=function(e,t){var n=this;return void 0===t&&(t=!1),this._onChangeCallbacks.push(e),t&&e(this.token,this.model),function(){for(var t=n._onChangeCallbacks.length-1;t>=0;t--)if(n._onChangeCallbacks[t]==e)return delete n._onChangeCallbacks[t],void n._onChangeCallbacks.splice(t,1)}},BaseAuthStore.prototype.triggerChange=function(){for(var e=0,t=this._onChangeCallbacks;e0?e:1,this.perPage=t>=0?t:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},h=function(e){function CrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(CrudService,e),CrudService.prototype.getFullList=function(e,t){if("number"==typeof e)return this._getFullList(this.baseCrudPath,e,t);var n=Object.assign({},e,t);return this._getFullList(this.baseCrudPath,n.batch||200,n)},CrudService.prototype.getList=function(e,t,n){return void 0===e&&(e=1),void 0===t&&(t=30),void 0===n&&(n={}),this._getList(this.baseCrudPath,e,t,n)},CrudService.prototype.getFirstListItem=function(e,t){return void 0===t&&(t={}),this._getFirstListItem(this.baseCrudPath,e,t)},CrudService.prototype.getOne=function(e,t){return void 0===t&&(t={}),this._getOne(this.baseCrudPath,e,t)},CrudService.prototype.create=function(e,t){return void 0===e&&(e={}),void 0===t&&(t={}),this._create(this.baseCrudPath,e,t)},CrudService.prototype.update=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),this._update(this.baseCrudPath,e,t,n)},CrudService.prototype.delete=function(e,t){return void 0===t&&(t={}),this._delete(this.baseCrudPath,e,t)},CrudService}(function(e){function BaseCrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(BaseCrudService,e),BaseCrudService.prototype._getFullList=function(e,t,n){var i=this;void 0===t&&(t=200),void 0===n&&(n={});var o=[],request=function(r){return __awaiter(i,void 0,void 0,(function(){return __generator(this,(function(i){return[2,this._getList(e,r,t||200,n).then((function(e){var t=e,n=t.items,i=t.totalItems;return o=o.concat(n),n.length&&i>o.length?request(r+1):o}))]}))}))};return request(1)},BaseCrudService.prototype._getList=function(e,t,n,i){var o=this;return void 0===t&&(t=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:t,perPage:n},i),this.client.send(e,{method:"GET",params:i}).then((function(e){var t=[];if(null==e?void 0:e.items){e.items=e.items||[];for(var n=0,i=e.items;n1||"string"==typeof(null==e?void 0:e[0])?(console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),[2,this.authWithOAuth2Code((null==e?void 0:e[0])||"",(null==e?void 0:e[1])||"",(null==e?void 0:e[2])||"",(null==e?void 0:e[3])||"",(null==e?void 0:e[4])||{},(null==e?void 0:e[5])||{},(null==e?void 0:e[6])||{})]):(n=(null==e?void 0:e[0])||{},[4,this.listAuthMethods()]);case 1:if(i=a.sent(),!(o=i.authProviders.find((function(e){return e.name===n.provider}))))throw new t(new Error('Missing or invalid provider "'.concat(n.provider,'".')));return r=this.client.buildUrl("/api/oauth2-redirect"),[2,new Promise((function(e,i){return __awaiter(s,void 0,void 0,(function(){var s,a,c,u,l=this;return __generator(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),[4,this.client.realtime.subscribe("@oauth2",(function(a){return __awaiter(l,void 0,void 0,(function(){var c,u,l;return __generator(this,(function(d){switch(d.label){case 0:c=this.client.realtime.clientId,d.label=1;case 1:if(d.trys.push([1,3,,4]),s(),!a.state||c!==a.state)throw new Error("State parameters don't match.");return[4,this.authWithOAuth2Code(o.name,a.code,o.codeVerifier,r,n.createData,n.body,n.query)];case 2:return u=d.sent(),e(u),[3,4];case 3:return l=d.sent(),i(new t(l)),[3,4];case 4:return[2]}}))}))}))];case 1:return s=d.sent(),(a=new URL(o.authUrl+r)).searchParams.set("state",this.client.realtime.clientId),(null===(u=n.scopes)||void 0===u?void 0:u.length)&&a.searchParams.set("scope",n.scopes.join(" ")),[4,n.urlCallback?n.urlCallback(a.toString()):this._defaultUrlCallback(a.toString())];case 2:return d.sent(),[3,4];case 3:return c=d.sent(),i(new t(c)),[3,4];case 4:return[2]}}))}))}))]}}))}))},RecordService.prototype.authRefresh=function(e,t){var n=this;return void 0===e&&(e={}),void 0===t&&(t={}),this.client.send(this.baseCollectionPath+"/auth-refresh",{method:"POST",params:t,body:e}).then((function(e){return n.authResponse(e)}))},RecordService.prototype.requestPasswordReset=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-password-reset",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmPasswordReset=function(e,t,n,i,o){return void 0===i&&(i={}),void 0===o&&(o={}),i=Object.assign({token:e,password:t,passwordConfirm:n},i),this.client.send(this.baseCollectionPath+"/confirm-password-reset",{method:"POST",params:o,body:i}).then((function(){return!0}))},RecordService.prototype.requestVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({token:e},t),this.client.send(this.baseCollectionPath+"/confirm-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.requestEmailChange=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({newEmail:e},t),this.client.send(this.baseCollectionPath+"/request-email-change",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmEmailChange=function(e,t,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),n=Object.assign({token:e,password:t},n),this.client.send(this.baseCollectionPath+"/confirm-email-change",{method:"POST",params:i,body:n}).then((function(){return!0}))},RecordService.prototype.listExternalAuths=function(e,t){return void 0===t&&(t={}),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths",{method:"GET",params:t}).then((function(e){var t=[];if(Array.isArray(e))for(var n=0,i=e;no?o:n)/2,a=r/2-(i=i>r?r:i)/2;window.open(e,"oauth2-popup","width="+n+",height="+i+",top="+a+",left="+s+",resizable,menubar=no")},RecordService}(h),m=function m(e){void 0===e&&(e={}),this.id=void 0!==e.id?e.id:"",this.name=void 0!==e.name?e.name:"",this.type=void 0!==e.type?e.type:"text",this.system=!!e.system,this.required=!!e.required,this.options="object"==typeof e.options&&null!==e.options?e.options:{}},b=function(e){function Collection(){return null!==e&&e.apply(this,arguments)||this}return __extends(Collection,e),Collection.prototype.$load=function(t){e.prototype.$load.call(this,t),this.system=!!t.system,this.name="string"==typeof t.name?t.name:"",this.type="string"==typeof t.type?t.type:"base",this.options=void 0!==t.options&&null!==t.options?t.options:{},this.indexes=Array.isArray(t.indexes)?t.indexes:[],this.listRule="string"==typeof t.listRule?t.listRule:null,this.viewRule="string"==typeof t.viewRule?t.viewRule:null,this.createRule="string"==typeof t.createRule?t.createRule:null,this.updateRule="string"==typeof t.updateRule?t.updateRule:null,this.deleteRule="string"==typeof t.deleteRule?t.deleteRule:null,t.schema=Array.isArray(t.schema)?t.schema:[],this.schema=[];for(var n=0,i=t.schema;n=0;o--)this.subscriptions[e][o]===t&&(i=!0,delete this.subscriptions[e][o],this.subscriptions[e].splice(o,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(e,t));return i?(this.subscriptions[e].length||delete this.subscriptions[e],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(e)?[3,3]:[4,this.submitSubscriptions()];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},RealtimeService.prototype.hasSubscriptionListeners=function(e){var t,n;if(this.subscriptions=this.subscriptions||{},e)return!!(null===(t=this.subscriptions[e])||void 0===t?void 0:t.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},RealtimeService.prototype.submitSubscriptions=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return this.clientId?(this.addAllSubscriptionListeners(),this.lastSentTopics=this.getNonEmptySubscriptionTopics(),[2,this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentTopics},params:{$cancelKey:"realtime_"+this.clientId}}).catch((function(e){if(!(null==e?void 0:e.isAbort))throw e}))]):[2]}))}))},RealtimeService.prototype.getNonEmptySubscriptionTopics=function(){var e=[];for(var t in this.subscriptions)this.subscriptions[t].length&&e.push(t);return e},RealtimeService.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var e in this.removeAllSubscriptionListeners(),this.subscriptions)for(var t=0,n=this.subscriptions[e];t0?[2]:[2,new Promise((function(t,n){e.pendingConnects.push({resolve:t,reject:n}),e.pendingConnects.length>1||e.initConnect()}))]}))}))},RealtimeService.prototype.initConnect=function(){var e=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){e.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(t){e.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(t){var n=t;e.clientId=null==n?void 0:n.lastEventId,e.submitSubscriptions().then((function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=3,t.label=1;case 1:return this.hasUnsentSubscriptions()&&e>0?(e--,[4,this.submitSubscriptions()]):[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var t=0,n=e.pendingConnects;tthis.maxReconnectAttempts){for(var i=0,o=this.pendingConnects;i=400)throw new t({url:e.url,status:e.status,data:n});return[2,n]}}))}))})).catch((function(e){throw new t(e)}))]}}))}))},Client.prototype.getFileUrl=function(e,t,n){return void 0===n&&(n={}),this.files.getUrl(e,t,n)},Client.prototype.buildUrl=function(e){var t,n=this.baseUrl;return"undefined"==typeof window||!window.location||n.startsWith("https://")||n.startsWith("http://")||(n=(null===(t=window.location.origin)||void 0===t?void 0:t.endsWith("/"))?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(n+=window.location.pathname||"/",n+=n.endsWith("/")?"":"/"),n+=this.baseUrl),e&&(n+=n.endsWith("/")?"":"/",n+=e.startsWith("/")?e.substring(1):e),n},Client.prototype.isFormData=function(e){return e&&("FormData"===e.constructor.name||"undefined"!=typeof FormData&&e instanceof FormData)},Client.prototype.serializeQueryParams=function(e){var t=[];for(var n in e)if(null!==e[n]){var i=e[n],o=encodeURIComponent(n);if(Array.isArray(i))for(var r=0,s=i;r0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0&&(!n.exp||n.exp-t>Date.now()/1e3))}e="function"==typeof atob?atob:function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,i,o=0,r=0,s="";i=t.charAt(r++);~i&&(n=o%4?64*n+i:i,o++%4)?s+=String.fromCharCode(255&n>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var i=function(){function BaseModel(e){void 0===e&&(e={}),this.$load(e||{})}return BaseModel.prototype.load=function(e){return this.$load(e)},BaseModel.prototype.$load=function(e){for(var t=0,n=Object.entries(e);t4096&&(u.model={id:null===(i=null==u?void 0:u.model)||void 0===i?void 0:i.id,email:null===(r=null==u?void 0:u.model)||void 0===r?void 0:r.email},this.model instanceof o&&(u.model.username=this.model.username,u.model.verified=this.model.verified,u.model.collectionId=this.model.collectionId),l=cookieSerialize(t,JSON.stringify(u),e)),l},BaseAuthStore.prototype.onChange=function(e,t){var n=this;return void 0===t&&(t=!1),this._onChangeCallbacks.push(e),t&&e(this.token,this.model),function(){for(var t=n._onChangeCallbacks.length-1;t>=0;t--)if(n._onChangeCallbacks[t]==e)return delete n._onChangeCallbacks[t],void n._onChangeCallbacks.splice(t,1)}},BaseAuthStore.prototype.triggerChange=function(){for(var e=0,t=this._onChangeCallbacks;e0?e:1,this.perPage=t>=0?t:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},h=function(e){function CrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(CrudService,e),CrudService.prototype.getFullList=function(e,t){if("number"==typeof e)return this._getFullList(this.baseCrudPath,e,t);var n=Object.assign({},e,t);return this._getFullList(this.baseCrudPath,n.batch||200,n)},CrudService.prototype.getList=function(e,t,n){return void 0===e&&(e=1),void 0===t&&(t=30),void 0===n&&(n={}),this._getList(this.baseCrudPath,e,t,n)},CrudService.prototype.getFirstListItem=function(e,t){return void 0===t&&(t={}),this._getFirstListItem(this.baseCrudPath,e,t)},CrudService.prototype.getOne=function(e,t){return void 0===t&&(t={}),this._getOne(this.baseCrudPath,e,t)},CrudService.prototype.create=function(e,t){return void 0===e&&(e={}),void 0===t&&(t={}),this._create(this.baseCrudPath,e,t)},CrudService.prototype.update=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),this._update(this.baseCrudPath,e,t,n)},CrudService.prototype.delete=function(e,t){return void 0===t&&(t={}),this._delete(this.baseCrudPath,e,t)},CrudService}(function(e){function BaseCrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(BaseCrudService,e),BaseCrudService.prototype._getFullList=function(e,t,n){var i=this;void 0===t&&(t=200),void 0===n&&(n={});var o=[],request=function(r){return __awaiter(i,void 0,void 0,(function(){return __generator(this,(function(i){return[2,this._getList(e,r,t||200,n).then((function(e){var t=e,n=t.items,i=t.totalItems;return o=o.concat(n),n.length&&i>o.length?request(r+1):o}))]}))}))};return request(1)},BaseCrudService.prototype._getList=function(e,t,n,i){var o=this;return void 0===t&&(t=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:t,perPage:n},i),this.client.send(e,{method:"GET",params:i}).then((function(e){var t=[];if(null==e?void 0:e.items){e.items=e.items||[];for(var n=0,i=e.items;n1||"string"==typeof(null==e?void 0:e[0])?(console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),[2,this.authWithOAuth2Code((null==e?void 0:e[0])||"",(null==e?void 0:e[1])||"",(null==e?void 0:e[2])||"",(null==e?void 0:e[3])||"",(null==e?void 0:e[4])||{},(null==e?void 0:e[5])||{},(null==e?void 0:e[6])||{})]):(n=(null==e?void 0:e[0])||{},[4,this.listAuthMethods()]);case 1:if(i=a.sent(),!(o=i.authProviders.find((function(e){return e.name===n.provider}))))throw new t(new Error('Missing or invalid provider "'.concat(n.provider,'".')));return r=this.client.buildUrl("/api/oauth2-redirect"),[2,new Promise((function(e,i){return __awaiter(s,void 0,void 0,(function(){var s,a,c,u,l=this;return __generator(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),[4,this.client.realtime.subscribe("@oauth2",(function(a){return __awaiter(l,void 0,void 0,(function(){var c,u,l;return __generator(this,(function(d){switch(d.label){case 0:c=this.client.realtime.clientId,d.label=1;case 1:if(d.trys.push([1,3,,4]),s(),!a.state||c!==a.state)throw new Error("State parameters don't match.");return[4,this.authWithOAuth2Code(o.name,a.code,o.codeVerifier,r,n.createData,n.body,n.query)];case 2:return u=d.sent(),e(u),[3,4];case 3:return l=d.sent(),i(new t(l)),[3,4];case 4:return[2]}}))}))}))];case 1:return s=d.sent(),(a=new URL(o.authUrl+r)).searchParams.set("state",this.client.realtime.clientId),(null===(u=n.scopes)||void 0===u?void 0:u.length)&&a.searchParams.set("scope",n.scopes.join(" ")),[4,n.urlCallback?n.urlCallback(a.toString()):this._defaultUrlCallback(a.toString())];case 2:return d.sent(),[3,4];case 3:return c=d.sent(),i(new t(c)),[3,4];case 4:return[2]}}))}))}))]}}))}))},RecordService.prototype.authRefresh=function(e,t){var n=this;return void 0===e&&(e={}),void 0===t&&(t={}),this.client.send(this.baseCollectionPath+"/auth-refresh",{method:"POST",params:t,body:e}).then((function(e){return n.authResponse(e)}))},RecordService.prototype.requestPasswordReset=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-password-reset",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmPasswordReset=function(e,t,n,i,o){return void 0===i&&(i={}),void 0===o&&(o={}),i=Object.assign({token:e,password:t,passwordConfirm:n},i),this.client.send(this.baseCollectionPath+"/confirm-password-reset",{method:"POST",params:o,body:i}).then((function(){return!0}))},RecordService.prototype.requestVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({token:e},t),this.client.send(this.baseCollectionPath+"/confirm-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.requestEmailChange=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({newEmail:e},t),this.client.send(this.baseCollectionPath+"/request-email-change",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmEmailChange=function(e,t,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),n=Object.assign({token:e,password:t},n),this.client.send(this.baseCollectionPath+"/confirm-email-change",{method:"POST",params:i,body:n}).then((function(){return!0}))},RecordService.prototype.listExternalAuths=function(e,t){return void 0===t&&(t={}),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths",{method:"GET",params:t}).then((function(e){var t=[];if(Array.isArray(e))for(var n=0,i=e;no?o:n)/2,a=r/2-(i=i>r?r:i)/2;window.open(e,"oauth2-popup","width="+n+",height="+i+",top="+a+",left="+s+",resizable,menubar=no")},RecordService}(h),m=function m(e){void 0===e&&(e={}),this.id=void 0!==e.id?e.id:"",this.name=void 0!==e.name?e.name:"",this.type=void 0!==e.type?e.type:"text",this.system=!!e.system,this.required=!!e.required,this.options="object"==typeof e.options&&null!==e.options?e.options:{}},b=function(e){function Collection(){return null!==e&&e.apply(this,arguments)||this}return __extends(Collection,e),Collection.prototype.$load=function(t){e.prototype.$load.call(this,t),this.system=!!t.system,this.name="string"==typeof t.name?t.name:"",this.type="string"==typeof t.type?t.type:"base",this.options=void 0!==t.options&&null!==t.options?t.options:{},this.indexes=Array.isArray(t.indexes)?t.indexes:[],this.listRule="string"==typeof t.listRule?t.listRule:null,this.viewRule="string"==typeof t.viewRule?t.viewRule:null,this.createRule="string"==typeof t.createRule?t.createRule:null,this.updateRule="string"==typeof t.updateRule?t.updateRule:null,this.deleteRule="string"==typeof t.deleteRule?t.deleteRule:null,t.schema=Array.isArray(t.schema)?t.schema:[],this.schema=[];for(var n=0,i=t.schema;n=0;o--)this.subscriptions[e][o]===t&&(i=!0,delete this.subscriptions[e][o],this.subscriptions[e].splice(o,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(e,t));return i?(this.subscriptions[e].length||delete this.subscriptions[e],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(e)?[3,3]:[4,this.submitSubscriptions()];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},RealtimeService.prototype.hasSubscriptionListeners=function(e){var t,n;if(this.subscriptions=this.subscriptions||{},e)return!!(null===(t=this.subscriptions[e])||void 0===t?void 0:t.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},RealtimeService.prototype.submitSubscriptions=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return this.clientId?(this.addAllSubscriptionListeners(),this.lastSentTopics=this.getNonEmptySubscriptionTopics(),[2,this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentTopics},params:{$cancelKey:this.getSubscriptionsCancelKey()}}).catch((function(e){if(!(null==e?void 0:e.isAbort))throw e}))]):[2]}))}))},RealtimeService.prototype.getSubscriptionsCancelKey=function(){return"realtime_"+this.clientId},RealtimeService.prototype.getNonEmptySubscriptionTopics=function(){var e=[];for(var t in this.subscriptions)this.subscriptions[t].length&&e.push(t);return e},RealtimeService.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var e in this.removeAllSubscriptionListeners(),this.subscriptions)for(var t=0,n=this.subscriptions[e];t0?[2]:[2,new Promise((function(t,n){e.pendingConnects.push({resolve:t,reject:n}),e.pendingConnects.length>1||e.initConnect()}))]}))}))},RealtimeService.prototype.initConnect=function(){var e=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){e.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(t){e.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(t){var n=t;e.clientId=null==n?void 0:n.lastEventId,e.submitSubscriptions().then((function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=3,t.label=1;case 1:return this.hasUnsentSubscriptions()&&e>0?(e--,[4,this.submitSubscriptions()]):[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var t=0,n=e.pendingConnects;tthis.maxReconnectAttempts){for(var i=0,o=this.pendingConnects;i=400)throw new t({url:e.url,status:e.status,data:n});return[2,n]}}))}))})).catch((function(e){throw new t(e)}))]}}))}))},Client.prototype.getFileUrl=function(e,t,n){return void 0===n&&(n={}),this.files.getUrl(e,t,n)},Client.prototype.buildUrl=function(e){var t,n=this.baseUrl;return"undefined"==typeof window||!window.location||n.startsWith("https://")||n.startsWith("http://")||(n=(null===(t=window.location.origin)||void 0===t?void 0:t.endsWith("/"))?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(n+=window.location.pathname||"/",n+=n.endsWith("/")?"":"/"),n+=this.baseUrl),e&&(n+=n.endsWith("/")?"":"/",n+=e.startsWith("/")?e.substring(1):e),n},Client.prototype.isFormData=function(e){return e&&("FormData"===e.constructor.name||"undefined"!=typeof FormData&&e instanceof FormData)},Client.prototype.serializeQueryParams=function(e){var t=[];for(var n in e)if(null!==e[n]){var i=e[n],o=encodeURIComponent(n);if(Array.isArray(i))for(var r=0,s=i;r= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","/**\n * ClientResponseError is a custom Error class that is intended to wrap\n * and normalize any error thrown by `Client.send()`.\n */\nexport default class ClientResponseError extends Error {\n url: string = '';\n status: number = 0;\n response: {[key: string]: any} = {};\n isAbort: boolean = false;\n originalError: any = null;\n\n constructor(errData?: any) {\n super(\"ClientResponseError\");\n\n // Set the prototype explicitly.\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, ClientResponseError.prototype);\n\n if (!(errData instanceof ClientResponseError)) {\n this.originalError = errData;\n }\n\n if (errData !== null && typeof errData === 'object') {\n this.url = typeof errData.url === 'string' ? errData.url : '';\n this.status = typeof errData.status === 'number' ? errData.status : 0;\n this.response = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\n this.isAbort = !!errData.isAbort;\n }\n\n if (typeof DOMException !== 'undefined' && errData instanceof DOMException) {\n this.isAbort = true;\n }\n\n this.name = \"ClientResponseError \" + this.status;\n this.message = this.response?.message;\n if (!this.message) {\n if (this.isAbort) {\n this.message = 'The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.';\n } else if (this.originalError?.cause?.message?.includes(\"ECONNREFUSED ::1\")) {\n this.message = 'Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).';\n } else {\n this.message = 'Something went wrong while processing your request.';\n }\n }\n }\n\n /**\n * Alias for `this.response` to preserve the backward compatibility.\n */\n get data() {\n return this.response;\n }\n\n /**\n * Make a POJO's copy of the current error class instance.\n * @see https://github.com/vuex-orm/vuex-orm/issues/255\n */\n toJSON() {\n return { ...this };\n }\n}\n","let atobPolyfill: Function;\nif (typeof atob === 'function') {\n atobPolyfill = atob\n} else {\n /**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n atobPolyfill = (input: any) => {\n const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n let str = String(input).replace(/=+$/, \"\");\n if (str.length % 4 == 1) {\n throw new Error(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = \"\";\n // get next character\n (buffer = str.charAt(idx++));\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? (bs as any) * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ?\n (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) :\n 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n\n return output;\n };\n}\n\n/**\n * Returns JWT token's payload data.\n */\nexport function getTokenPayload(token: string): { [key: string]: any } {\n if (token) {\n try {\n const encodedPayload = decodeURIComponent(atobPolyfill(token.split('.')[1]).split('').map(function (c: string) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n\n return JSON.parse(encodedPayload) || {};\n } catch (e) {\n }\n }\n\n return {};\n}\n\n/**\n * Checks whether a JWT token is expired or not.\n * Tokens without `exp` payload key are considered valid.\n * Tokens with empty payload (eg. invalid token strings) are considered expired.\n *\n * @param token The token to check.\n * @param [expirationThreshold] Time in seconds that will be subtracted from the token `exp` property.\n */\nexport function isTokenExpired(token: string, expirationThreshold = 0): boolean {\n let payload = getTokenPayload(token);\n\n if (\n Object.keys(payload).length > 0 &&\n (!payload.exp || (payload.exp - expirationThreshold) > (Date.now() / 1000))\n ) {\n return false;\n }\n\n return true;\n}\n","/**\n * -------------------------------------------------------------------\n * Simple cookie parse and serialize utilities mostly based on the\n * node module https://github.com/jshttp/cookie.\n * -------------------------------------------------------------------\n */\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\nexport interface ParseOptions{\n decode?: (val: string) => string,\n}\n\n/**\n* Parses the given cookie header string into an object\n* The object has the various cookies as keys(names) => values\n*/\nexport function cookieParse(str: string, options?: ParseOptions): { [key: string]: any } {\n const result: { [key: string]: any } = {};\n\n if (typeof str !== 'string') {\n return result;\n }\n\n const opt = Object.assign({}, options || {});\n const decode = opt.decode || defaultDecode;\n\n let index = 0;\n while (index < str.length) {\n const eqIdx = str.indexOf('=', index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = str.indexOf(';', index);\n\n if (endIdx === -1) {\n endIdx = str.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1;\n continue;\n }\n\n const key = str.slice(index, eqIdx).trim();\n\n // only assign once\n if (undefined === result[key]) {\n let val = str.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n result[key] = decode(val);\n } catch (_) {\n result[key] = val; // no decoding\n }\n }\n\n index = endIdx + 1;\n }\n\n return result;\n};\n\nexport interface SerializeOptions{\n encode?: (val: string | number | boolean) => string,\n maxAge?: number,\n domain?: string,\n path?: string,\n expires?: Date,\n httpOnly?: boolean,\n secure?: boolean,\n priority?: string,\n sameSite?: boolean|string,\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * ```js\n * cookieSerialize('foo', 'bar', { httpOnly: true }) // \"foo=bar; httpOnly\"\n * ```\n */\nexport function cookieSerialize(name: string, val: string, options?: SerializeOptions): string {\n const opt = Object.assign({}, options || {});\n const encode = opt.encode || defaultEncode;\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n const value = encode(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n let result = name + '=' + value;\n\n if (opt.maxAge != null) {\n const maxAge = opt.maxAge - 0;\n\n if (isNaN(maxAge) || !isFinite(maxAge)) {\n throw new TypeError('option maxAge is invalid');\n }\n\n result += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n result += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n result += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (!isDate(opt.expires) || isNaN(opt.expires.valueOf())) {\n throw new TypeError('option expires is invalid');\n }\n\n result += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n result += '; HttpOnly';\n }\n\n if (opt.secure) {\n result += '; Secure';\n }\n\n if (opt.priority) {\n const priority = typeof opt.priority === 'string' ? opt.priority.toLowerCase() : opt.priority;\n\n switch (priority) {\n case 'low':\n result += '; Priority=Low';\n break;\n case 'medium':\n result += '; Priority=Medium';\n break;\n case 'high':\n result += '; Priority=High';\n break;\n default:\n throw new TypeError('option priority is invalid');\n }\n }\n\n if (opt.sameSite) {\n const sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n result += '; SameSite=Strict';\n break;\n case 'lax':\n result += '; SameSite=Lax';\n break;\n case 'strict':\n result += '; SameSite=Strict';\n break;\n case 'none':\n result += '; SameSite=None';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return result;\n};\n\n/**\n * Default URL-decode string value function.\n * Optimized to skip native call when no `%`.\n */\nfunction defaultDecode(val: string): string {\n return val.indexOf('%') !== -1\n ? decodeURIComponent(val)\n : val;\n}\n\n/**\n * Default URL-encode value function.\n */\nfunction defaultEncode(val: string | number | boolean): string {\n return encodeURIComponent(val);\n}\n\n/**\n * Determines if value is a Date.\n */\nfunction isDate(val: any): boolean {\n return (\n Object.prototype.toString.call(val) === '[object Date]' ||\n val instanceof Date\n );\n}\n","export default abstract class BaseModel {\n [key: string]: any,\n\n id!: string;\n created!: string;\n updated!: string;\n\n constructor(data: { [key: string]: any } = {}) {\n this.$load(data || {});\n }\n\n /**\n * Alias of this.$load(data).\n */\n load(data: { [key: string]: any }) {\n return this.$load(data);\n }\n\n /**\n * Loads `data` into the current model.\n */\n $load(data: { [key: string]: any }) {\n for (const [key, value] of Object.entries(data)) {\n this[key] = value;\n }\n\n // normalize known fields\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.created = typeof data.created !== 'undefined' ? data.created : '';\n this.updated = typeof data.updated !== 'undefined' ? data.updated : '';\n }\n\n /**\n * Returns whether the current loaded data represent a stored db record.\n */\n get $isNew(): boolean {\n return !this.id;\n }\n\n /**\n * Alias of this.clone().\n */\n clone(): BaseModel {\n return this.$clone();\n }\n\n /**\n * Creates a deep clone of the current model.\n */\n $clone(): BaseModel {\n const clone = typeof structuredClone === 'function' ?\n structuredClone(this) : JSON.parse(JSON.stringify(this));\n\n return new (this.constructor as any)(clone);\n }\n\n /**\n * Alias of this.$export().\n */\n export(): { [key: string]: any } {\n return this.$export();\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n $export(): { [key: string]: any } {\n return typeof structuredClone === 'function' ?\n structuredClone(this) : Object.assign({}, this);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Record extends BaseModel {\n collectionId!: string;\n collectionName!: string;\n expand!: {[key: string]: Record|Array};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // normalize common fields\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.collectionName = typeof data.collectionName === 'string' ? data.collectionName : '';\n\n // normalize expand items\n this._loadExpand(data.expand);\n }\n\n /**\n * Loads the provided expand items and recursively normalizes each\n * item to a `Record|Array`.\n */\n private _loadExpand(expand: { [key: string]: any }) {\n expand = expand || {};\n this.expand = {};\n\n for (const key in expand) {\n if (Array.isArray(expand[key])) {\n this.expand[key] = expand[key].map((data: any) => new Record(data || {}));\n } else {\n this.expand[key] = new Record(expand[key] || {});\n }\n }\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Admin extends BaseModel {\n avatar!: number;\n email!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.avatar = typeof data.avatar === 'number' ? data.avatar : 0;\n this.email = typeof data.email === 'string' ? data.email : '';\n }\n}\n","import { cookieParse, cookieSerialize, SerializeOptions } from '@/stores/utils/cookie';\nimport { isTokenExpired, getTokenPayload } from '@/stores/utils/jwt';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\nexport type OnStoreChangeFunc = (token: string, model: Record|Admin|null) => void;\n\nconst defaultCookieKey = 'pb_auth';\n\n/**\n * Base AuthStore class that is intended to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore {\n protected baseToken: string = '';\n protected baseModel: Record|Admin|null = null;\n\n private _onChangeCallbacks: Array = [];\n\n /**\n * Retrieves the stored token (if any).\n */\n get token(): string {\n return this.baseToken;\n }\n\n /**\n * Retrieves the stored model data (if any).\n */\n get model(): Record|Admin|null {\n return this.baseModel;\n }\n\n /**\n * Loosely checks if the store has valid token (aka. existing and unexpired exp claim).\n */\n get isValid(): boolean {\n return !isTokenExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: Record|Admin|null): void {\n this.baseToken = token || '';\n\n // normalize the model instance\n if (model !== null && typeof model === 'object') {\n this.baseModel = typeof (model as any).collectionId !== 'undefined' ?\n new Record(model) : new Admin(model);\n } else {\n this.baseModel = null;\n }\n\n this.triggerChange();\n }\n\n /**\n * Removes the stored token and model data form the auth store.\n */\n clear(): void {\n this.baseToken = '';\n this.baseModel = null;\n this.triggerChange();\n }\n\n /**\n * Parses the provided cookie string and updates the store state\n * with the cookie's token and model data.\n *\n * NB! This function doesn't validate the token or its data.\n * Usually this isn't a concern if you are interacting only with the\n * PocketBase API because it has the proper server-side security checks in place,\n * but if you are using the store `isValid` state for permission controls\n * in a node server (eg. SSR), then it is recommended to call `authRefresh()`\n * after loading the cookie to ensure an up-to-date token and model state.\n * For example:\n *\n * ```js\n * pb.authStore.loadFromCookie(\"cookie string...\");\n *\n * try {\n * // get an up-to-date auth store state by veryfing and refreshing the loaded auth model (if any)\n * pb.authStore.isValid && await pb.collection('users').authRefresh();\n * } catch (_) {\n * // clear the auth store on failed refresh\n * pb.authStore.clear();\n * }\n * ```\n */\n loadFromCookie(cookie: string, key = defaultCookieKey): void {\n const rawData = cookieParse(cookie || '')[key] || '';\n\n let data: { [key: string]: any } = {};\n try {\n data = JSON.parse(rawData);\n // normalize\n if (typeof data === null || typeof data !== 'object' || Array.isArray(data)) {\n data = {};\n }\n } catch (_) {}\n\n this.save(data.token || '', data.model || null);\n }\n\n /**\n * Exports the current store state as cookie string.\n *\n * By default the following optional attributes are added:\n * - Secure\n * - HttpOnly\n * - SameSite=Strict\n * - Path=/\n * - Expires={the token expiration date}\n *\n * NB! If the generated cookie exceeds 4096 bytes, this method will\n * strip the model data to the bare minimum to try to fit within the\n * recommended size in https://www.rfc-editor.org/rfc/rfc6265#section-6.1.\n */\n exportToCookie(options?: SerializeOptions, key = defaultCookieKey): string {\n const defaultOptions: SerializeOptions = {\n secure: true,\n sameSite: true,\n httpOnly: true,\n path: \"/\",\n };\n\n // extract the token expiration date\n const payload = getTokenPayload(this.token);\n if (payload?.exp) {\n defaultOptions.expires = new Date(payload.exp * 1000);\n } else {\n defaultOptions.expires = new Date('1970-01-01');\n }\n\n // merge with the user defined options\n options = Object.assign({}, defaultOptions, options);\n\n const rawData = {\n token: this.token,\n model: this.model?.export() || null,\n };\n\n let result = cookieSerialize(key, JSON.stringify(rawData), options);\n\n const resultLength = typeof Blob !== 'undefined' ?\n (new Blob([result])).size : result.length;\n\n // strip down the model data to the bare minimum\n if (rawData.model && resultLength > 4096) {\n rawData.model = {id: rawData?.model?.id, email: rawData?.model?.email};\n if (this.model instanceof Record) {\n rawData.model.username = this.model.username;\n rawData.model.verified = this.model.verified;\n rawData.model.collectionId = this.model.collectionId;\n }\n result = cookieSerialize(key, JSON.stringify(rawData), options);\n }\n\n return result;\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * You can set the `fireImmediately` argument to true in order to invoke\n * the provided callback right after registration.\n *\n * Returns a removal function that you could call to \"unsubscribe\" from the changes.\n */\n onChange(callback: OnStoreChangeFunc, fireImmediately = false): () => void {\n this._onChangeCallbacks.push(callback);\n\n if (fireImmediately) {\n callback(this.token, this.model);\n }\n\n return () => {\n for (let i = this._onChangeCallbacks.length - 1; i >= 0; i--) {\n if (this._onChangeCallbacks[i] == callback) {\n delete this._onChangeCallbacks[i]; // removes the function reference\n this._onChangeCallbacks.splice(i, 1); // reindex the array\n return;\n }\n }\n }\n }\n\n protected triggerChange(): void {\n for (const callback of this._onChangeCallbacks) {\n callback && callback(this.token, this.model);\n }\n }\n}\n","import BaseAuthStore from '@/stores/BaseAuthStore';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\n/**\n * The default token store for browsers with auto fallback\n * to runtime/memory if local storage is undefined (eg. in node env).\n */\nexport default class LocalAuthStore extends BaseAuthStore {\n private storageFallback: { [key: string]: any } = {};\n private storageKey: string\n\n constructor(storageKey = \"pocketbase_auth\") {\n super();\n\n this.storageKey = storageKey;\n }\n\n /**\n * @inheritdoc\n */\n get token(): string {\n const data = this._storageGet(this.storageKey) || {};\n\n return data.token || '';\n }\n\n /**\n * @inheritdoc\n */\n get model(): Record|Admin|null {\n const data = this._storageGet(this.storageKey) || {};\n\n if (\n data === null ||\n typeof data !== 'object' ||\n data.model === null ||\n typeof data.model !== 'object'\n ) {\n return null;\n }\n\n // admins don't have `collectionId` prop\n if (typeof data.model?.collectionId === 'undefined') {\n return new Admin(data.model);\n }\n\n return new Record(data.model);\n }\n\n /**\n * @inheritdoc\n */\n save(token: string, model: Record|Admin|null) {\n this._storageSet(this.storageKey, {\n 'token': token,\n 'model': model,\n });\n\n super.save(token, model);\n }\n\n /**\n * @inheritdoc\n */\n clear() {\n this._storageRemove(this.storageKey);\n\n super.clear();\n }\n\n // ---------------------------------------------------------------\n // Internal helpers:\n // ---------------------------------------------------------------\n\n /**\n * Retrieves `key` from the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageGet(key: string): any {\n if (typeof window !== 'undefined' && window?.localStorage) {\n const rawValue = window.localStorage.getItem(key) || '';\n try {\n return JSON.parse(rawValue);\n } catch (e) { // not a json\n return rawValue;\n }\n }\n\n // fallback\n return this.storageFallback[key];\n }\n\n /**\n * Stores a new data in the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageSet(key: string, value: any) {\n if (typeof window !== 'undefined' && window?.localStorage) {\n // store in local storage\n let normalizedVal = value;\n if (typeof value !== 'string') {\n normalizedVal = JSON.stringify(value);\n }\n window.localStorage.setItem(key, normalizedVal);\n } else {\n // store in fallback\n this.storageFallback[key] = value;\n }\n }\n\n /**\n * Removes `key` from the browser's local storage and the runtime/memory.\n */\n private _storageRemove(key: string) {\n // delete from local storage\n if (typeof window !== 'undefined' && window?.localStorage) {\n window.localStorage?.removeItem(key);\n }\n\n // delete from fallback\n delete this.storageFallback[key];\n }\n}\n","import Client from '@/Client';\n\n/**\n * BaseService class that should be inherited from all API services.\n */\nexport default abstract class BaseService {\n readonly client: Client\n\n constructor(client: Client) {\n this.client = client;\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\ninterface appleClientSecret {\n secret: string;\n}\n\nexport default class SettingsService extends BaseService {\n /**\n * Fetch all available app settings.\n */\n getAll(queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Bulk updates app settings.\n */\n update(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Performs a S3 filesystem connection test.\n *\n * The currently supported `filesystem` are \"storage\" and \"backups\".\n */\n testS3(filesystem: string = \"storage\", queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'filesystem': filesystem,\n };\n\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends a test email.\n *\n * The possible `emailTemplate` values are:\n * - verification\n * - password-reset\n * - email-change\n */\n testEmail(toEmail: string, emailTemplate: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'email': toEmail,\n 'template': emailTemplate,\n };\n\n return this.client.send('/api/settings/test/email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Generates a new Apple OAuth2 client secret.\n */\n generateAppleClientSecret(\n clientId: string,\n teamId: string,\n keyId: string,\n privateKey: string,\n duration: number,\n bodyParams = {},\n queryParams: BaseQueryParams = {}\n ): Promise {\n bodyParams = Object.assign({\n clientId,\n teamId,\n keyId,\n privateKey,\n duration,\n }, bodyParams);\n\n return this.client.send('/api/settings/apple/generate-client-secret', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n });\n }\n}\n","import BaseModel from './BaseModel';\n\nexport default class ListResult {\n page!: number;\n perPage!: number;\n totalItems!: number;\n totalPages!: number;\n items!: Array;\n\n constructor(\n page: number,\n perPage: number,\n totalItems: number,\n totalPages: number,\n items: Array,\n ) {\n this.page = page > 0 ? page : 1;\n this.perPage = perPage >= 0 ? perPage : 0;\n this.totalItems = totalItems >= 0 ? totalItems : 0;\n this.totalPages = totalPages >= 0 ? totalPages : 0;\n this.items = items || [];\n }\n}\n","import ListResult from '@/models/utils/ListResult';\nimport BaseModel from '@/models/utils/BaseModel';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n FullListQueryParams\n} from '@/services/utils/QueryParams';\n\nexport default abstract class CrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/admins').\n */\n abstract get baseCrudPath(): string\n\n /**\n * Returns a promise with all list items batch fetched at once\n * (by default 200 items per request; to change it set the `batch` query param).\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(queryParams?: FullListQueryParams): Promise>\n\n /**\n * Legacy version of getFullList with explicitly specified batch size.\n */\n getFullList(batch?: number, queryParams?: ListQueryParams): Promise>\n\n getFullList(batchOrqueryParams?: number|FullListQueryParams, queryParams?: ListQueryParams): Promise> {\n if (typeof batchOrqueryParams == \"number\") {\n return this._getFullList(this.baseCrudPath, batchOrqueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrqueryParams, queryParams);\n\n return this._getFullList(this.baseCrudPath, params.batch || 200, params);\n }\n\n /**\n * Returns paginated items list.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n return this._getList(this.baseCrudPath, page, perPage, queryParams);\n }\n\n /**\n * Returns the first found item by the specified filter.\n *\n * Internally it calls `getList(1, 1, { filter })` and returns the\n * first found item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n *\n * For consistency with `getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n getFirstListItem(filter: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getFirstListItem(this.baseCrudPath, filter, queryParams);\n }\n\n /**\n * Returns single item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getOne(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getOne(this.baseCrudPath, id, queryParams);\n }\n\n /**\n * Creates a new item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n create(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._create(this.baseCrudPath, bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._update(this.baseCrudPath, id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._delete(this.baseCrudPath, id, queryParams);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\nimport {\n BaseQueryParams,\n ListQueryParams\n} from '@/services/utils/QueryParams';\n\n// @todo since there is no longer need of SubCrudService consider merging with CrudService in v0.9+\nexport default abstract class BaseCrudService extends BaseService {\n /**\n * Response data decoder.\n */\n abstract decode(data: { [key: string]: any }): M\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n protected _getFullList(basePath: string, batchSize = 200, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize || 200, queryParams).then((list) => {\n const castedList = (list as any as ListResult);\n const items = castedList.items;\n const totalItems = castedList.totalItems;\n\n result = result.concat(items);\n\n if (items.length && totalItems > result.length) {\n return request(page + 1);\n }\n\n return result;\n });\n }\n\n return request(1);\n }\n\n /**\n * Returns paginated items list.\n */\n protected _getList(basePath: string, page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send(basePath, {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData.items || [];\n for (const item of responseData.items) {\n items.push(this.decode(item) as any as T);\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns single item by its id.\n */\n protected _getOne(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Returns the first found item by a list filter.\n *\n * Internally it calls `_getList(basePath, 1, 1, { filter })` and returns its\n * first item.\n *\n * For consistency with `_getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n protected _getFirstListItem(basePath: string, filter: string, queryParams: BaseQueryParams = {}): Promise {\n queryParams = Object.assign({\n 'filter': filter,\n '$cancelKey': 'one_by_filter_' + basePath + \"_\" + filter,\n }, queryParams);\n\n return this._getList(basePath, 1, 1, queryParams)\n .then((result) => {\n if (!result?.items?.length) {\n throw new ClientResponseError({\n status: 404,\n data: {\n code: 404,\n message: \"The requested resource wasn't found.\",\n data: {},\n },\n });\n }\n\n return result.items[0];\n });\n }\n\n /**\n * Creates a new item.\n */\n protected _create(basePath: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath, {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Updates an existing item by its id.\n */\n protected _update(basePath: string, id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n protected _delete(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n}\n","import Admin from '@/models/Admin';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface AdminAuthResponse {\n [key: string]: any;\n\n token: string;\n admin: Admin;\n}\n\nexport default class AdminService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Admin {\n return new Admin(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/admins';\n }\n\n // ---------------------------------------------------------------\n // Post update/delete AuthStore sync\n // ---------------------------------------------------------------\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n // update the store state if the updated item id matches with the stored model\n if (\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === item?.id\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n // clear the store state if the deleted item id matches with the stored model\n if (\n success &&\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === id\n ) {\n this.client.authStore.clear();\n }\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful authorize response.\n */\n protected authResponse(responseData: any): AdminAuthResponse {\n const admin = this.decode(responseData?.admin || {});\n\n if (responseData?.token && responseData?.admin) {\n this.client.authStore.save(responseData.token, admin);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'admin': admin,\n });\n }\n\n /**\n * Authenticate an admin account with its email and password\n * and returns a new admin token and data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authWithPassword(\n email: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'identity': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Refreshes the current admin authenticated instance and\n * returns a new token and admin data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authRefresh(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCrudPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends admin password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms admin password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class ExternalAuth extends BaseModel {\n recordId!: string;\n collectionId!: string;\n provider!: string;\n providerId!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.recordId = typeof data.recordId === 'string' ? data.recordId : '';\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.provider = typeof data.provider === 'string' ? data.provider : '';\n this.providerId = typeof data.providerId === 'string' ? data.providerId : '';\n }\n}\n","import Client from '@/Client';\nimport ClientResponseError from '@/ClientResponseError';\nimport Record from '@/models/Record';\nimport ExternalAuth from '@/models/ExternalAuth';\nimport ListResult from '@/models/utils/ListResult';\nimport CrudService from '@/services/utils/CrudService';\nimport { UnsubscribeFunc } from '@/services/RealtimeService';\nimport {\n BaseQueryParams,\n RecordQueryParams,\n RecordListQueryParams,\n RecordFullListQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface RecordAuthResponse {\n record: T;\n token: string;\n meta?: {[key: string]: any};\n}\n\nexport interface AuthProviderInfo {\n name: string;\n state: string;\n codeVerifier: string;\n codeChallenge: string;\n codeChallengeMethod: string;\n authUrl: string;\n}\n\nexport interface AuthMethodsList {\n usernamePassword: boolean;\n emailPassword: boolean;\n authProviders: Array;\n}\n\nexport interface RecordSubscription {\n action: string; // eg. create, update, delete\n record: T;\n}\n\nexport type OAuth2UrlCallback = (url: string) => void|Promise;\n\nexport interface OAuth2AuthConfig {\n // the name of the OAuth2 provider (eg. \"google\")\n provider: string;\n\n // custom scopes to overwrite the default ones\n scopes?: Array;\n\n // optional record create data\n createData?: {[key: string]: any};\n\n // optional callback that is triggered after the OAuth2 sign-in/sign-up url generation\n urlCallback?: OAuth2UrlCallback;\n\n // optional query params to send with the PocketBase auth request (eg. fields, expand, etc.)\n query?: RecordQueryParams;\n\n // optional body params to send with the PocketBase auth request\n body?: {[key: string]: any};\n}\n\nexport default class RecordService extends CrudService {\n readonly collectionIdOrName: string;\n\n constructor(client: Client, collectionIdOrName: string) {\n super(client);\n\n this.collectionIdOrName = collectionIdOrName;\n }\n\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): T {\n return new Record(data) as any as T;\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return this.baseCollectionPath + '/records';\n }\n\n /**\n * Returns the current collection service base path.\n */\n get baseCollectionPath(): string {\n return '/api/collections/' + encodeURIComponent(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Realtime handlers\n // ---------------------------------------------------------------\n\n /**\n * @deprecated Use subscribe(recordId, callback) instead.\n *\n * Subscribe to the realtime changes of a single record in the collection.\n */\n async subscribeOne(recordId: string, callback: (data: RecordSubscription) => void): Promise {\n console.warn(\"PocketBase: subscribeOne(recordId, callback) is deprecated. Please replace it with subscribe(recordId, callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName + \"/\" + recordId, callback);\n }\n\n /**\n * @deprecated This form of subscribe is deprecated. Please use `subscribe(\"*\", callback)`.\n */\n async subscribe(callback: (data: RecordSubscription) => void): Promise\n\n /**\n * Subscribe to realtime changes to the specified topic (\"*\" or record id).\n *\n * If `topic` is the wildcard \"*\", then this method will subscribe to\n * any record changes in the collection.\n *\n * If `topic` is a record id, then this method will subscribe only\n * to changes of the specified record id.\n *\n * It's OK to subscribe multiple times to the same topic.\n * You can use the returned `UnsubscribeFunc` to remove only a single subscription.\n * Or use `unsubscribe(topic)` if you want to remove all subscriptions attached to the topic.\n */\n async subscribe(topic: string, callback: (data: RecordSubscription) => void): Promise\n\n async subscribe(\n topicOrCallback: string|((data: RecordSubscription) => void),\n callback?: (data: RecordSubscription) => void\n ): Promise {\n if (typeof topicOrCallback === 'function') {\n console.warn(\"PocketBase: subscribe(callback) is deprecated. Please replace it with subscribe('*', callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName, topicOrCallback);\n }\n\n if (!callback) {\n throw new Error(\"Missing subscription callback.\");\n }\n\n if (topicOrCallback === \"\") {\n throw new Error(\"Missing topic.\");\n }\n\n let topic = this.collectionIdOrName;\n if (topicOrCallback !== \"*\") {\n topic += ('/' + topicOrCallback);\n }\n\n return this.client.realtime.subscribe(topic, callback)\n }\n\n /**\n * Unsubscribe from all subscriptions of the specified topic\n * (\"*\" or record id).\n *\n * If `topic` is not set, then this method will unsubscribe from\n * all subscriptions associated to the current collection.\n */\n async unsubscribe(topic?: string): Promise {\n // unsubscribe wildcard topic\n if (topic === \"*\") {\n return this.client.realtime.unsubscribe(this.collectionIdOrName);\n }\n\n // unsubscribe recordId topic\n if (topic) {\n return this.client.realtime.unsubscribe(this.collectionIdOrName + \"/\" + topic);\n }\n\n // unsubscribe from everything related to the collection\n return this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Crud handers\n // ---------------------------------------------------------------\n /**\n * @inheritdoc\n */\n getFullList(queryParams?: RecordFullListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batch?: number, queryParams?: RecordListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batchOrQueryParams?: number|RecordFullListQueryParams, queryParams?: RecordListQueryParams): Promise> {\n if (typeof batchOrQueryParams == \"number\") {\n return super.getFullList(batchOrQueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrQueryParams, queryParams);\n\n return super.getFullList(params);\n }\n\n /**\n * @inheritdoc\n */\n getList(page = 1, perPage = 30, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getList(page, perPage, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getFirstListItem(filter: string, queryParams: RecordListQueryParams = {}): Promise {\n return super.getFirstListItem(filter, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getOne(id: string, queryParams: RecordQueryParams = {}): Promise {\n return super.getOne(id, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n create(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.create(bodyParams, queryParams);\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n if (\n // is record auth\n this.client.authStore.model?.id === item?.id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n if (\n success &&\n // is record auth\n this.client.authStore.model?.id === id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.clear();\n }\n\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful collection authorization response.\n */\n protected authResponse(responseData: any): RecordAuthResponse {\n const record = this.decode(responseData?.record || {});\n\n this.client.authStore.save(responseData?.token, record);\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'record': record as any as T,\n });\n }\n\n /**\n * Returns all available collection auth methods.\n */\n listAuthMethods(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCollectionPath + '/auth-methods', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n return Object.assign({}, responseData, {\n // normalize common fields\n 'usernamePassword': !!responseData?.usernamePassword,\n 'emailPassword': !!responseData?.emailPassword,\n 'authProviders': Array.isArray(responseData?.authProviders) ? responseData?.authProviders : [],\n });\n });\n }\n\n /**\n * Authenticate a single auth collection record via its username/email and password.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n */\n authWithPassword(\n usernameOrEmail: string,\n password: string,\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'identity': usernameOrEmail,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2 code.\n *\n * If you don't have an OAuth2 code you may also want to check `authWithOAuth2` method.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n */\n authWithOAuth2Code(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData = {},\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'provider': provider,\n 'code': code,\n 'codeVerifier': codeVerifier,\n 'redirectUrl': redirectUrl,\n 'createData': createData,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-oauth2', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * @deprecated This form of authWithOAuth2 is deprecated.\n *\n * Please use `authWithOAuth2Code()` OR its simplified realtime version\n * as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\n */\n async authWithOAuth2(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData?: {[key: string]: any},\n bodyParams?: {[key: string]: any},\n queryParams?: RecordQueryParams,\n ): Promise>\n\n /**\n * Authenticate a single auth collection record with OAuth2\n * **without custom redirects, deeplinks or even page reload**.\n *\n * This method initializes a one-off realtime subscription and will\n * open a popup window with the OAuth2 vendor page to authenticate.\n * Once the external OAuth2 sign-in/sign-up flow is completed, the popup\n * window will be automatically closed and the OAuth2 data sent back\n * to the user through the previously established realtime connection.\n *\n * You can specify an optional `urlCallback` prop to customize\n * the default url `window.open` behavior.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n *\n * Example:\n *\n * ```js\n * const authData = await pb.collection(\"users\").authWithOAuth2({\n * provider: \"google\",\n * })\n * ```\n *\n * _Site-note_: when creating the OAuth2 app in the provider dashboard\n * you have to configure `https://yourdomain.com/api/oauth2-redirect`\n * as redirect URL.\n */\n async authWithOAuth2(options: OAuth2AuthConfig): Promise>\n\n async authWithOAuth2(...args: any): Promise> {\n // fallback to legacy format\n if (args.length > 1 || typeof args?.[0] === 'string') {\n console.warn(\"PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\");\n return this.authWithOAuth2Code(\n args?.[0] || '',\n args?.[1] || '',\n args?.[2] || '',\n args?.[3] || '',\n args?.[4] || {},\n args?.[5] || {},\n args?.[6] || {},\n );\n }\n\n const config = args?.[0] || {};\n\n const authMethods = await this.listAuthMethods();\n\n const provider = authMethods.authProviders.find((p) => p.name === config.provider);\n if (!provider) {\n throw new ClientResponseError(new Error(`Missing or invalid provider \"${config.provider}\".`));\n }\n\n const redirectUrl = this.client.buildUrl('/api/oauth2-redirect');\n\n return new Promise(async (resolve, reject) => {\n try {\n // initialize a one-off @oauth2 realtime subscription\n const unsubscribe = await this.client.realtime.subscribe('@oauth2', async (e) => {\n const oldState = this.client.realtime.clientId;\n\n try {\n unsubscribe();\n\n if (!e.state || oldState !== e.state) {\n throw new Error(\"State parameters don't match.\");\n }\n\n const authData = await this.authWithOAuth2Code(\n provider.name,\n e.code,\n provider.codeVerifier,\n redirectUrl,\n config.createData,\n config.body,\n config.query,\n )\n\n resolve(authData);\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n\n const url = new URL(provider.authUrl + redirectUrl);\n url.searchParams.set(\"state\", this.client.realtime.clientId);\n if (config.scopes?.length) {\n url.searchParams.set(\"scope\", config.scopes.join(\" \"));\n }\n\n await (config.urlCallback ? config.urlCallback(url.toString()) : this._defaultUrlCallback(url.toString()));\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n }\n\n /**\n * Refreshes the current authenticated record instance and\n * returns a new token and record data.\n *\n * On success this method also automatically updates the client's AuthStore.\n */\n authRefresh(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise> {\n return this.client.send(this.baseCollectionPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Sends auth record password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends auth record verification email request.\n */\n requestVerification(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record email verification request.\n */\n confirmVerification(\n verificationToken: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': verificationToken,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends an email change request to the authenticated record model.\n */\n requestEmailChange(\n newEmail: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'newEmail': newEmail,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record's new email address.\n */\n confirmEmailChange(\n emailChangeToken: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': emailChangeToken,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Lists all linked external auth providers for the specified auth record.\n */\n listExternalAuths(\n recordId: string,\n queryParams: BaseQueryParams = {}\n ): Promise> {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => {\n const items: Array = [];\n\n if (Array.isArray(responseData)) {\n for (const item of responseData) {\n items.push(new ExternalAuth(item));\n }\n }\n\n return items;\n });\n }\n\n /**\n * Unlink a single external auth provider from the specified auth record.\n */\n unlinkExternalAuth(\n recordId: string,\n provider: string,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths/' + encodeURIComponent(provider), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n // ---------------------------------------------------------------\n\n private _defaultUrlCallback(url: string) {\n if (typeof window === \"undefined\" || !window?.open) {\n throw new ClientResponseError(new Error(`Not in a browser context - please pass a custom urlCallback function.`));\n }\n\n let width = 1024;\n let height = 768;\n\n let windowWidth = window.innerWidth;\n let windowHeight = window.innerHeight;\n\n // normalize window size\n width = width > windowWidth ? windowWidth : width;\n height = height > windowHeight ? windowHeight : height;\n\n let left = (windowWidth / 2) - (width / 2);\n let top = (windowHeight / 2) - (height / 2);\n\n window.open(\n url,\n \"oauth2-popup\",\n 'width='+width+',height='+height+',top='+top+',left='+left+',resizable,menubar=no'\n );\n }\n}\n","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.name = typeof data.name !== 'undefined' ? data.name : '';\n this.type = typeof data.type !== 'undefined' ? data.type : 'text';\n this.system = !!data.system;\n this.required = !!data.required;\n this.options = typeof data.options === 'object' && data.options !== null ? data.options : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport SchemaField from '@/models/utils/SchemaField';\n\nexport default class Collection extends BaseModel {\n name!: string;\n type!: string;\n schema!: Array;\n indexes!: Array;\n system!: boolean;\n listRule!: null|string;\n viewRule!: null|string;\n createRule!: null|string;\n updateRule!: null|string;\n deleteRule!: null|string;\n options!: {[key:string]: any};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.system = !!data.system;\n this.name = typeof data.name === 'string' ? data.name : '';\n this.type = typeof data.type === 'string' ? data.type : 'base';\n this.options = typeof data.options !== 'undefined' && data.options !== null ? data.options : {};\n this.indexes = Array.isArray(data.indexes) ? data.indexes : [];\n\n // rules\n this.listRule = typeof data.listRule === 'string' ? data.listRule : null;\n this.viewRule = typeof data.viewRule === 'string' ? data.viewRule : null;\n this.createRule = typeof data.createRule === 'string' ? data.createRule : null;\n this.updateRule = typeof data.updateRule === 'string' ? data.updateRule : null;\n this.deleteRule = typeof data.deleteRule === 'string' ? data.deleteRule : null;\n\n // schema\n data.schema = Array.isArray(data.schema) ? data.schema : [];\n this.schema = [];\n for (let field of data.schema) {\n this.schema.push(new SchemaField(field));\n }\n }\n\n /**\n * @deprecated Please use $isBase instead.\n */\n get isBase(): boolean {\n return this.$isBase;\n }\n\n /**\n * Checks if the current model is \"base\" collection.\n */\n get $isBase(): boolean {\n return this.type === 'base';\n }\n\n /**\n * @deprecated Please use $isAuth instead.\n */\n get isAuth(): boolean {\n return this.$isAuth;\n }\n\n /**\n * Checks if the current model is \"auth\" collection.\n */\n get $isAuth(): boolean {\n return this.type === 'auth';\n }\n\n /**\n * @deprecated Please use $isView instead.\n */\n get isView(): boolean {\n return this.$isView;\n }\n\n /**\n * Checks if the current model is \"view\" collection.\n */\n get $isView(): boolean {\n return this.type === 'view';\n }\n}\n","import Collection from '@/models/Collection';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport default class CollectionService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Collection {\n return new Collection(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/collections';\n }\n\n /**\n * Imports the provided collections.\n *\n * If `deleteMissing` is `true`, all local collections and schema fields,\n * that are not present in the imported configuration, WILL BE DELETED\n * (including their related records data)!\n */\n async import(\n collections: Array,\n deleteMissing: boolean = false,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/import', {\n 'method': 'PUT',\n 'params': queryParams,\n 'body': {\n 'collections': collections,\n 'deleteMissing': deleteMissing,\n }\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class LogRequest extends BaseModel {\n url!: string;\n method!: string;\n status!: number;\n auth!: string;\n remoteIp!: string;\n userIp!: string;\n referer!: string;\n userAgent!: string;\n meta!: { [key: string]: any };\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // fallback to the ip field for backward compatibility\n data.remoteIp = data.remoteIp || data.ip;\n\n this.url = typeof data.url === 'string' ? data.url : '';\n this.method = typeof data.method === 'string' ? data.method : 'GET';\n this.status = typeof data.status === 'number' ? data.status : 200;\n this.auth = typeof data.auth === 'string' ? data.auth : 'guest';\n this.remoteIp = typeof data.remoteIp === 'string' ? data.remoteIp : '';\n this.userIp = typeof data.userIp === 'string' ? data.userIp : '';\n this.referer = typeof data.referer === 'string' ? data.referer : '';\n this.userAgent = typeof data.userAgent === 'string' ? data.userAgent : '';\n this.meta = typeof data.meta === 'object' && data.meta !== null ? data.meta : {};\n }\n}\n","import LogRequest from '@/models/LogRequest';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n LogStatsQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface HourlyStats {\n total: number;\n date: string;\n}\n\nexport default class LogService extends BaseService {\n /**\n * Returns paginated logged requests list.\n */\n getRequestsList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send('/api/logs/requests', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData?.items || [];\n for (const item of responseData.items) {\n items.push(new LogRequest(item));\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns a single logged request by its id.\n */\n getRequest(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/logs/requests/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => new LogRequest(responseData));\n }\n\n /**\n * Returns request logs statistics.\n */\n getRequestsStats(queryParams: LogStatsQueryParams = {}): Promise> {\n return this.client.send('/api/logs/requests/stats', {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => responseData);\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\n\ninterface promiseCallbacks {\n resolve: Function\n reject: Function\n}\n\nexport type UnsubscribeFunc = () => Promise;\n\nexport default class RealtimeService extends BaseService {\n clientId: string = \"\";\n\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 15000;\n private reconnectTimeoutId: any;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number = Infinity;\n private predefinedReconnectIntervals: Array = [\n 200, 300, 500, 1000, 1200, 1500, 2000,\n ];\n private pendingConnects: Array = [];\n\n\n /**\n * Returns whether the realtime connection has been established.\n */\n get isConnected(): boolean {\n return !!this.eventSource && !!this.clientId && !this.pendingConnects.length;\n }\n\n /**\n * Register the subscription listener.\n *\n * You can subscribe multiple times to the same topic.\n *\n * If the SSE connection is not started yet,\n * this method will also initialize it.\n */\n async subscribe(topic: string, callback: (data: any) => void): Promise {\n if (!topic) {\n throw new Error('topic must be set.')\n }\n\n const listener = function (e: Event) {\n const msgEvent = (e as MessageEvent);\n\n let data;\n try {\n data = JSON.parse(msgEvent?.data);\n } catch {}\n\n callback(data || {});\n };\n\n // store the listener\n if (!this.subscriptions[topic]) {\n this.subscriptions[topic] = [];\n }\n this.subscriptions[topic].push(listener);\n\n if (!this.isConnected) {\n // initialize sse connection\n await this.connect();\n } else if (this.subscriptions[topic].length === 1) {\n // send the updated subscriptions (if it is the first for the topic)\n await this.submitSubscriptions();\n } else {\n // only register the listener\n this.eventSource?.addEventListener(topic, listener);\n }\n\n return async (): Promise => {\n return this.unsubscribeByTopicAndListener(topic, listener);\n };\n }\n\n /**\n * Unsubscribe from all subscription listeners with the specified topic.\n *\n * If `topic` is not provided, then this method will unsubscribe\n * from all active subscriptions.\n *\n * This method is no-op if there are no active subscriptions.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribe(topic?: string): Promise {\n if (!this.hasSubscriptionListeners(topic)) {\n return; // already unsubscribed\n }\n\n if (!topic) {\n // remove all subscriptions\n this.subscriptions = {};\n } else {\n // remove all topic listeners\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n /**\n * Unsubscribe from all subscription listeners starting with the specified topic prefix.\n *\n * This method is no-op if there are no active subscriptions with the specified topic prefix.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByPrefix(topicPrefix: string): Promise {\n let hasAtleastOneTopic = false;\n for (let topic in this.subscriptions) {\n if (!topic.startsWith(topicPrefix)) {\n continue;\n }\n\n hasAtleastOneTopic = true;\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!hasAtleastOneTopic) {\n return; // nothing to unsubscribe from\n }\n\n if (this.hasSubscriptionListeners()) {\n // submit the deleted subscriptions\n await this.submitSubscriptions();\n } else {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n }\n }\n\n /**\n * Unsubscribe from all subscriptions matching the specified topic and listener function.\n *\n * This method is no-op if there are no active subscription with\n * the specified topic and listener.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByTopicAndListener(topic: string, listener: EventListener): Promise {\n if (!Array.isArray(this.subscriptions[topic]) || !this.subscriptions[topic].length) {\n return; // already unsubscribed\n }\n\n let exist = false;\n for (let i = this.subscriptions[topic].length - 1; i >= 0; i--) {\n if (this.subscriptions[topic][i] !== listener) {\n continue;\n }\n\n exist = true; // has at least one matching listener\n delete this.subscriptions[topic][i]; // removes the function reference\n this.subscriptions[topic].splice(i, 1); // reindex the array\n this.eventSource?.removeEventListener(topic, listener);\n }\n if (!exist) {\n return;\n }\n\n // remove the topic from the subscriptions list if there are no other listeners\n if (!this.subscriptions[topic].length) {\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n private hasSubscriptionListeners(topicToCheck?: string): boolean {\n this.subscriptions = this.subscriptions || {};\n\n // check the specified topic\n if (topicToCheck) {\n return !!this.subscriptions[topicToCheck]?.length;\n }\n\n // check for at least one non-empty topic\n for (let topic in this.subscriptions) {\n if (!!this.subscriptions[topic]?.length) {\n return true\n }\n }\n\n return false;\n }\n\n private async submitSubscriptions(): Promise {\n if (!this.clientId) {\n return; // no client/subscriber\n }\n\n // optimistic update\n this.addAllSubscriptionListeners();\n\n this.lastSentTopics = this.getNonEmptySubscriptionTopics();\n\n return this.client.send('/api/realtime', {\n 'method': 'POST',\n 'body': {\n 'clientId': this.clientId,\n 'subscriptions': this.lastSentTopics,\n },\n 'params': {\n '$cancelKey': \"realtime_\" + this.clientId,\n },\n }).catch((err) => {\n if (err?.isAbort) {\n return; // silently ignore aborted pending requests\n }\n throw err;\n });\n }\n\n private getNonEmptySubscriptionTopics(): Array {\n const result : Array = [];\n\n for (let topic in this.subscriptions) {\n if (this.subscriptions[topic].length) {\n result.push(topic);\n }\n }\n\n return result;\n }\n\n private addAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n this.removeAllSubscriptionListeners();\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.addEventListener(topic, listener);\n }\n }\n }\n\n private removeAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.removeEventListener(topic, listener);\n }\n }\n }\n\n private async connect(): Promise {\n if (this.reconnectAttempts > 0) {\n // immediately resolve the promise to avoid indefinitely\n // blocking the client during reconnection\n return;\n }\n\n return new Promise((resolve, reject) => {\n this.pendingConnects.push({ resolve, reject });\n\n if (this.pendingConnects.length > 1) {\n // all promises will be resolved once the connection is established\n return;\n }\n\n this.initConnect();\n })\n }\n\n private initConnect() {\n this.disconnect(true);\n\n // wait up to 15s for connect\n clearTimeout(this.connectTimeoutId);\n this.connectTimeoutId = setTimeout(() => {\n this.connectErrorHandler(new Error(\"EventSource connect took too long.\"));\n }, this.maxConnectTimeout);\n\n this.eventSource = new EventSource(this.client.buildUrl('/api/realtime'))\n\n this.eventSource.onerror = (_) => {\n this.connectErrorHandler(new Error(\"Failed to establish realtime connection.\"));\n };\n\n this.eventSource.addEventListener('PB_CONNECT', (e) => {\n const msgEvent = (e as MessageEvent);\n this.clientId = msgEvent?.lastEventId;\n\n this.submitSubscriptions()\n .then(async () => {\n let retries = 3;\n while (this.hasUnsentSubscriptions() && retries > 0) {\n retries--;\n // resubscribe to ensure that the latest topics are submitted\n //\n // This is needed because missed topics could happen on reconnect\n // if after the pending sent `submitSubscriptions()` call another `subscribe()`\n // was made before the submit was able to complete.\n await this.submitSubscriptions();\n }\n }).then(() => {\n for (let p of this.pendingConnects) {\n p.resolve();\n }\n\n // reset connect meta\n this.pendingConnects = [];\n this.reconnectAttempts = 0;\n clearTimeout(this.reconnectTimeoutId);\n clearTimeout(this.connectTimeoutId);\n }).catch((err) => {\n this.clientId = \"\";\n this.connectErrorHandler(err);\n });\n });\n }\n\n private hasUnsentSubscriptions(): boolean {\n const latestTopics = this.getNonEmptySubscriptionTopics();\n if (latestTopics.length != this.lastSentTopics.length) {\n return true;\n }\n\n for (const t of latestTopics) {\n if (!this.lastSentTopics.includes(t)) {\n return true;\n }\n }\n\n return false;\n }\n\n private connectErrorHandler(err: any) {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n\n if (\n // wasn't previously connected -> direct reject\n (!this.clientId && !this.reconnectAttempts) ||\n // was previously connected but the max reconnection limit has been reached\n this.reconnectAttempts > this.maxReconnectAttempts\n ) {\n for (let p of this.pendingConnects) {\n p.reject(new ClientResponseError(err));\n }\n this.disconnect();\n return;\n }\n\n // otherwise -> reconnect in the background\n this.disconnect(true);\n const timeout = this.predefinedReconnectIntervals[this.reconnectAttempts] || this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length - 1];\n this.reconnectAttempts++;\n this.reconnectTimeoutId = setTimeout(() => {\n this.initConnect();\n }, timeout);\n }\n\n private disconnect(fromReconnect = false): void {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n this.removeAllSubscriptionListeners();\n this.eventSource?.close();\n this.eventSource = null;\n this.clientId = \"\";\n\n if (!fromReconnect) {\n this.reconnectAttempts = 0;\n\n // reject any remaining connect promises\n const err = new ClientResponseError(new Error(\"Realtime disconnected.\"));\n for (let p of this.pendingConnects) {\n p.reject(err);\n }\n this.pendingConnects = [];\n }\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface HealthCheckResponse {\n code: number;\n message: string;\n data: {[key: string]: any};\n}\n\nexport default class HealthService extends BaseService {\n /**\n * Checks the health status of the api.\n */\n check(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/health', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport default class FileService extends BaseService {\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n const parts = [];\n parts.push(\"api\")\n parts.push(\"files\")\n parts.push(encodeURIComponent(record.collectionId || record.collectionName))\n parts.push(encodeURIComponent(record.id))\n parts.push(encodeURIComponent(filename))\n\n let result = this.client.buildUrl(parts.join('/'));\n\n if (Object.keys(queryParams).length) {\n const params = new URLSearchParams(queryParams);\n result += (result.includes(\"?\") ? \"&\" : \"?\") + params;\n }\n\n return result\n }\n\n /**\n * Requests a new private file access token for the current auth model (admin or record).\n */\n getToken(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/files/token', {\n 'method': 'POST',\n 'params': queryParams,\n }).then((data) => data?.token || '');\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface BackupFileInfo {\n key: string;\n size: number;\n modified: string;\n}\n\nexport default class BackupService extends BaseService {\n /**\n * Returns list with all available backup files.\n */\n getFullList(queryParams: BaseQueryParams = {}): Promise> {\n return this.client.send('/api/backups', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n\n /**\n * Initializes a new backup.\n */\n create(basename: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'name': basename,\n };\n\n return this.client.send('/api/backups', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Deletes a single backup file.\n */\n delete(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}`, {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Initializes an app data restore from an existing backup.\n */\n restore(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}/restore`, {\n 'method': 'POST',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Builds a download url for a single existing backup using an\n * admin file token and the backup file key.\n *\n * The file token can be generated via `pb.files.getToken()`.\n */\n getDownloadUrl(token: string, key: string): string {\n return this.client.buildUrl(`/api/backups/${encodeURIComponent(key)}?token=${encodeURIComponent(token)}`);\n }\n}\n","import ClientResponseError from '@/ClientResponseError';\nimport BaseAuthStore from '@/stores/BaseAuthStore';\nimport LocalAuthStore from '@/stores/LocalAuthStore';\nimport SettingsService from '@/services/SettingsService';\nimport AdminService from '@/services/AdminService';\nimport RecordService from '@/services/RecordService';\nimport CollectionService from '@/services/CollectionService';\nimport LogService from '@/services/LogService';\nimport RealtimeService from '@/services/RealtimeService';\nimport HealthService from '@/services/HealthService';\nimport FileService from '@/services/FileService';\nimport BackupService from '@/services/BackupService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport interface SendOptions extends RequestInit {\n headers?: { [key: string]: string };\n body?: any;\n params?: BaseQueryParams;\n}\n\nexport interface BeforeSendResult {\n [key: string]: any, // for backward compatibility\n url?: string,\n options?: {[key: string]: any}\n}\n\n/**\n * PocketBase JS Client.\n */\nexport default class Client {\n /**\n * The base PocketBase backend url address (eg. 'http://127.0.0.1.8090').\n */\n baseUrl: string;\n\n /**\n * Hook that get triggered right before sending the fetch request,\n * allowing you to inspect and modify the url and request options.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * You can return a non-empty result object `{ url, options }` to replace the url and request options entirely.\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, options) {\n * options.headers = Object.assign({}, options.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return { url, options }\n * };\n * ```\n */\n beforeSend?: (url: string, options: SendOptions) => BeforeSendResult|Promise;\n\n /**\n * Hook that get triggered after successfully sending the fetch request,\n * allowing you to inspect/modify the response object and its parsed data.\n *\n * Returns the new Promise resolved `data` that will be returned to the client.\n *\n * Example:\n * ```js\n * client.afterSend = function (response, data) {\n * if (response.status != 200) {\n * throw new ClientResponseError({\n * url: response.url,\n * status: response.status,\n * data: data,\n * });\n * }\n *\n * return data;\n * };\n * ```\n */\n afterSend?: (response: Response, data: any) => any;\n\n /**\n * Optional language code (default to `en-US`) that will be sent\n * with the requests to the server as `Accept-Language` header.\n */\n lang: string;\n\n /**\n * A replaceable instance of the local auth store service.\n */\n authStore: BaseAuthStore;\n\n /**\n * An instance of the service that handles the **Settings APIs**.\n */\n readonly settings: SettingsService;\n\n /**\n * An instance of the service that handles the **Admin APIs**.\n */\n readonly admins: AdminService;\n\n /**\n * An instance of the service that handles the **Collection APIs**.\n */\n readonly collections: CollectionService;\n\n /**\n * An instance of the service that handles the **File APIs**.\n */\n readonly files: FileService;\n\n /**\n * An instance of the service that handles the **Log APIs**.\n */\n readonly logs: LogService;\n\n /**\n * An instance of the service that handles the **Realtime APIs**.\n */\n readonly realtime: RealtimeService;\n\n /**\n * An instance of the service that handles the **Health APIs**.\n */\n readonly health: HealthService;\n\n /**\n * An instance of the service that handles the **Backup APIs**.\n */\n readonly backups: BackupService;\n\n private cancelControllers: { [key: string]: AbortController } = {};\n private recordServices: { [key: string]: RecordService } = {};\n private enableAutoCancellation: boolean = true;\n\n constructor(\n baseUrl = '/',\n authStore?: BaseAuthStore | null,\n lang = 'en-US',\n ) {\n this.baseUrl = baseUrl;\n this.lang = lang;\n this.authStore = authStore || new LocalAuthStore();\n\n // services\n this.admins = new AdminService(this);\n this.collections = new CollectionService(this);\n this.files = new FileService(this);\n this.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(this);\n this.health = new HealthService(this);\n this.backups = new BackupService(this);\n }\n\n /**\n * Returns the RecordService associated to the specified collection.\n *\n * @param {string} idOrName\n * @return {RecordService}\n */\n collection(idOrName: string): RecordService {\n if (!this.recordServices[idOrName]) {\n this.recordServices[idOrName] = new RecordService(this, idOrName);\n }\n\n return this.recordServices[idOrName];\n }\n\n /**\n * Globally enable or disable auto cancellation for pending duplicated requests.\n */\n autoCancellation(enable: boolean): Client {\n this.enableAutoCancellation = !!enable;\n\n return this;\n }\n\n /**\n * Cancels single request by its cancellation key.\n */\n cancelRequest(cancelKey: string): Client {\n if (this.cancelControllers[cancelKey]) {\n this.cancelControllers[cancelKey].abort();\n delete this.cancelControllers[cancelKey];\n }\n\n return this;\n }\n\n /**\n * Cancels all pending requests.\n */\n cancelAllRequests(): Client {\n for (let k in this.cancelControllers) {\n this.cancelControllers[k].abort();\n }\n\n this.cancelControllers = {};\n\n return this;\n }\n\n /**\n * Sends an api http request.\n */\n async send(path: string, reqOptions: SendOptions): Promise {\n let options = Object.assign({ method: 'GET' } as SendOptions, reqOptions);\n\n // JSON serialize the body if needed and set the correct content type\n // (for FormData body the Content-Type header should be skipped since the boundary is autogenerated)\n if (!this.isFormData(options.body)) {\n if (options.body && typeof options.body !== 'string') {\n options.body = JSON.stringify(options.body);\n }\n\n // add the json header (if not already)\n if (typeof options?.headers?.['Content-Type'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof options?.headers?.['Accept-Language'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Accept-Language': this.lang,\n });\n }\n\n // check if Authorization header can be added\n if (\n // has stored token\n this.authStore?.token &&\n // auth header is not explicitly set\n (typeof options?.headers?.Authorization === 'undefined')\n ) {\n options.headers = Object.assign({}, options.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && options.params?.$autoCancel !== false) {\n const cancelKey = options.params?.$cancelKey || ((options.method || 'GET') + path);\n\n // cancel previous pending requests\n this.cancelRequest(cancelKey);\n\n const controller = new AbortController();\n this.cancelControllers[cancelKey] = controller;\n options.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete options.params?.$autoCancel;\n delete options.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof options.params !== 'undefined') {\n const query = this.serializeQueryParams(options.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete options.params;\n }\n\n if (this.beforeSend) {\n const result = Object.assign({}, await this.beforeSend(url, options));\n if (typeof result.url !== \"undefined\" || typeof result.options !== \"undefined\") {\n url = result.url || url;\n options = result.options || options;\n } else if (Object.keys(result).length) {\n // legacy behavior\n options = result as SendOptions;\n console?.warn && console.warn(\"Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`.\");\n }\n }\n\n // send the request\n return fetch(url, options)\n .then(async (response) => {\n let data : any = {};\n\n try {\n data = await response.json();\n } catch (_) {\n // all api responses are expected to return json\n // with the exception of the realtime event and 204\n }\n\n if (this.afterSend) {\n data = await this.afterSend(response, data);\n }\n\n if (response.status >= 400) {\n throw new ClientResponseError({\n url: response.url,\n status: response.status,\n data: data,\n });\n }\n\n return data as T;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Legacy alias of `pb.files.getUrl()`.\n */\n getFileUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n return this.files.getUrl(record, filename, queryParams);\n }\n\n /**\n * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl;\n\n // construct an absolute base url if in a browser environment\n if (\n typeof window !== 'undefined' &&\n !!window.location &&\n !url.startsWith('https://') &&\n !url.startsWith('http://')\n ) {\n url = window.location.origin?.endsWith('/') ?\n window.location.origin.substring(0, window.location.origin.length - 1) :\n (window.location.origin || '');\n\n if (!this.baseUrl.startsWith('/')) {\n url += window.location.pathname || '/';\n url += url.endsWith('/') ? '' : '/';\n }\n\n url += this.baseUrl;\n }\n\n // concatenate the path\n if (path) {\n url += url.endsWith('/') ? '' : '/'; // append trailing slash if missing\n url += path.startsWith('/') ? path.substring(1) : path;\n }\n\n return url;\n }\n\n /**\n * Loosely checks if the specified body is a FormData instance.\n */\n private isFormData(body: any): boolean {\n return body && (\n // we are checking the constructor name because FormData\n // is not available natively in some environments and the\n // polyfill(s) may not be globally accessible\n body.constructor.name === 'FormData' ||\n // fallback to global FormData instance check\n // note: this is needed because the constructor.name could be different in case of\n // custom global FormData implementation, eg. React Native on Android/iOS\n (typeof FormData !== \"undefined\" && body instanceof FormData)\n )\n }\n\n /**\n * Serializes the provided query parameters into a query string.\n */\n private serializeQueryParams(params: {[key: string]: any}): string {\n const result: Array = [];\n for (const key in params) {\n if (params[key] === null) {\n // skip null query params\n continue;\n }\n\n const value = params[key];\n const encodedKey = encodeURIComponent(key);\n\n if (Array.isArray(value)) {\n // \"repeat\" array params\n for (const v of value) {\n result.push(encodedKey + \"=\" + encodeURIComponent(v));\n }\n } else if (value instanceof Date) {\n result.push(encodedKey + \"=\" + encodeURIComponent(value.toISOString()));\n } else if (typeof value !== null && typeof value === 'object') {\n result.push(encodedKey + \"=\" + encodeURIComponent(JSON.stringify(value)));\n } else {\n result.push(encodedKey + \"=\" + encodeURIComponent(value));\n }\n }\n\n return result.join('&');\n }\n}\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__extends","TypeError","String","__","this","constructor","create","__assign","assign","t","s","i","n","arguments","length","apply","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","adopt","then","__generator","body","f","y","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","v","op","pop","push","atobPolyfill","ClientResponseError","_super","errData","_this","url","status","response","isAbort","originalError","data","DOMException","name","message","_a","_d","_c","_b","cause","includes","defineProperty","get","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","isDate","toString","Date","valueOf","toUTCString","httpOnly","secure","priority","toLowerCase","sameSite","defaultDecode","indexOf","decodeURIComponent","encodeURIComponent","getTokenPayload","token","encodedPayload","split","map","c","charCodeAt","slice","join","JSON","parse","isTokenExpired","expirationThreshold","payload","keys","exp","now","atob","input","str","replace","bs","buffer","bc","idx","output","charAt","fromCharCode","BaseModel","$load","load","_i","entries","key","id","created","updated","clone","$clone","structuredClone","stringify","export","$export","Record","collectionId","collectionName","_loadExpand","expand","isArray","Admin","avatar","email","defaultCookieKey","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","save","model","triggerChange","clear","loadFromCookie","cookie","rawData","cookieParse","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","exportToCookie","defaultOptions","resultLength","Blob","size","username","verified","onChange","callback","fireImmediately","splice","LocalAuthStore","storageKey","storageFallback","_storageGet","_storageSet","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","filesystem","testEmail","toEmail","emailTemplate","template","generateAppleClientSecret","clientId","teamId","keyId","privateKey","duration","ListResult","page","perPage","totalItems","totalPages","items","CrudService","getFullList","batchOrqueryParams","_getFullList","baseCrudPath","batch","getList","_getList","getFirstListItem","filter","_getFirstListItem","getOne","_getOne","_create","_update","delete","_delete","BaseCrudService","basePath","batchSize","request","list","castedList","concat","item","$cancelKey","code","AdminService","authStore","success","authResponse","admin","authWithPassword","password","identity","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","batchOrQueryParams","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2Code","codeVerifier","redirectUrl","createData","authWithOAuth2","args","config","authMethods","find","buildUrl","oldState","unsubscribe_1","state","query","authData","err_2","URL","authUrl","searchParams","set","scopes","urlCallback","_defaultUrlCallback","err_1","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","open","width","height","windowWidth","innerWidth","windowHeight","innerHeight","left","top","SchemaField","type","system","required","Collection","indexes","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","$isBase","$isAuth","$isView","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","eventSource","subscriptions","lastSentTopics","maxConnectTimeout","reconnectAttempts","maxReconnectAttempts","Infinity","predefinedReconnectIntervals","pendingConnects","listener","msgEvent","isConnected","connect","submitSubscriptions","addEventListener","unsubscribeByTopicAndListener","hasSubscriptionListeners","removeEventListener","disconnect","topicPrefix","hasAtleastOneTopic","startsWith","exist","topicToCheck","addAllSubscriptionListeners","getNonEmptySubscriptionTopics","catch","err","removeAllSubscriptionListeners","initConnect","clearTimeout","connectTimeoutId","setTimeout","connectErrorHandler","EventSource","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","timeout","fromReconnect","close","HealthService","check","FileService","getUrl","filename","parts","URLSearchParams","getToken","BackupService","basename","restore","getDownloadUrl","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","files","logs","settings","health","backups","collection","idOrName","autoCancellation","enable","cancelRequest","cancelKey","abort","cancelAllRequests","k","reqOptions","isFormData","headers","Authorization","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","serializeQueryParams","beforeSend","_k","_j","_l","_m","fetch","json","afterSend","getFileUrl","location","origin","endsWith","substring","pathname","FormData","encodedKey","value_1","toISOString"],"mappings":"AAgBA,IAAIA,cAAgB,SAASC,EAAGC,GAI5B,OAHAF,cAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAY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qBAA5B,SAA6B5P,GACzB,IAAMpL,EAAwB,GAC9B,IAAK,IAAM8G,KAAOsE,EACd,GAAoB,OAAhBA,EAAOtE,GAAX,CAKA,IAAMnH,EAAQyL,EAAOtE,GACfkV,EAAapX,mBAAmBkC,GAEtC,GAAIjJ,MAAMgK,QAAQlI,GAEd,IAAgB,QAAAsc,EAAAtc,EAAAiH,EAAKqV,EAAAjd,OAAL4H,IAAO,CAAlB,IAAMzF,EAAC8a,EAAArV,GACR5G,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBzD,GACrD,MACMxB,aAAiBsE,KACxBjE,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBjF,EAAMuc,gBAChC,cAAVvc,GAAmC,iBAAVA,EACvCK,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBU,KAAK+B,UAAU1H,KAEjEK,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBjF,GAfrD,CAmBL,OAAOK,EAAOqF,KAAK,MAE1B0T,MAAD"} \ No newline at end of file +{"version":3,"file":"pocketbase.es.js","sources":["../node_modules/tslib/tslib.es6.js","../src/ClientResponseError.ts","../src/stores/utils/jwt.ts","../src/stores/utils/cookie.ts","../src/models/utils/BaseModel.ts","../src/models/Record.ts","../src/models/Admin.ts","../src/stores/BaseAuthStore.ts","../src/stores/LocalAuthStore.ts","../src/services/utils/BaseService.ts","../src/services/SettingsService.ts","../src/models/utils/ListResult.ts","../src/services/utils/CrudService.ts","../src/services/utils/BaseCrudService.ts","../src/services/AdminService.ts","../src/models/ExternalAuth.ts","../src/services/RecordService.ts","../src/models/utils/SchemaField.ts","../src/models/Collection.ts","../src/services/CollectionService.ts","../src/models/LogRequest.ts","../src/services/LogService.ts","../src/services/RealtimeService.ts","../src/services/HealthService.ts","../src/services/FileService.ts","../src/services/BackupService.ts","../src/Client.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","/**\n * ClientResponseError is a custom Error class that is intended to wrap\n * and normalize any error thrown by `Client.send()`.\n */\nexport default class ClientResponseError extends Error {\n url: string = '';\n status: number = 0;\n response: {[key: string]: any} = {};\n isAbort: boolean = false;\n originalError: any = null;\n\n constructor(errData?: any) {\n super(\"ClientResponseError\");\n\n // Set the prototype explicitly.\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, ClientResponseError.prototype);\n\n if (!(errData instanceof ClientResponseError)) {\n this.originalError = errData;\n }\n\n if (errData !== null && typeof errData === 'object') {\n this.url = typeof errData.url === 'string' ? errData.url : '';\n this.status = typeof errData.status === 'number' ? errData.status : 0;\n this.response = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\n this.isAbort = !!errData.isAbort;\n }\n\n if (typeof DOMException !== 'undefined' && errData instanceof DOMException) {\n this.isAbort = true;\n }\n\n this.name = \"ClientResponseError \" + this.status;\n this.message = this.response?.message;\n if (!this.message) {\n if (this.isAbort) {\n this.message = 'The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.';\n } else if (this.originalError?.cause?.message?.includes(\"ECONNREFUSED ::1\")) {\n this.message = 'Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).';\n } else {\n this.message = 'Something went wrong while processing your request.';\n }\n }\n }\n\n /**\n * Alias for `this.response` to preserve the backward compatibility.\n */\n get data() {\n return this.response;\n }\n\n /**\n * Make a POJO's copy of the current error class instance.\n * @see https://github.com/vuex-orm/vuex-orm/issues/255\n */\n toJSON() {\n return { ...this };\n }\n}\n","let atobPolyfill: Function;\nif (typeof atob === 'function') {\n atobPolyfill = atob\n} else {\n /**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n atobPolyfill = (input: any) => {\n const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n let str = String(input).replace(/=+$/, \"\");\n if (str.length % 4 == 1) {\n throw new Error(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = \"\";\n // get next character\n (buffer = str.charAt(idx++));\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? (bs as any) * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ?\n (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) :\n 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n\n return output;\n };\n}\n\n/**\n * Returns JWT token's payload data.\n */\nexport function getTokenPayload(token: string): { [key: string]: any } {\n if (token) {\n try {\n const encodedPayload = decodeURIComponent(atobPolyfill(token.split('.')[1]).split('').map(function (c: string) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n\n return JSON.parse(encodedPayload) || {};\n } catch (e) {\n }\n }\n\n return {};\n}\n\n/**\n * Checks whether a JWT token is expired or not.\n * Tokens without `exp` payload key are considered valid.\n * Tokens with empty payload (eg. invalid token strings) are considered expired.\n *\n * @param token The token to check.\n * @param [expirationThreshold] Time in seconds that will be subtracted from the token `exp` property.\n */\nexport function isTokenExpired(token: string, expirationThreshold = 0): boolean {\n let payload = getTokenPayload(token);\n\n if (\n Object.keys(payload).length > 0 &&\n (!payload.exp || (payload.exp - expirationThreshold) > (Date.now() / 1000))\n ) {\n return false;\n }\n\n return true;\n}\n","/**\n * -------------------------------------------------------------------\n * Simple cookie parse and serialize utilities mostly based on the\n * node module https://github.com/jshttp/cookie.\n * -------------------------------------------------------------------\n */\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\nexport interface ParseOptions{\n decode?: (val: string) => string,\n}\n\n/**\n* Parses the given cookie header string into an object\n* The object has the various cookies as keys(names) => values\n*/\nexport function cookieParse(str: string, options?: ParseOptions): { [key: string]: any } {\n const result: { [key: string]: any } = {};\n\n if (typeof str !== 'string') {\n return result;\n }\n\n const opt = Object.assign({}, options || {});\n const decode = opt.decode || defaultDecode;\n\n let index = 0;\n while (index < str.length) {\n const eqIdx = str.indexOf('=', index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = str.indexOf(';', index);\n\n if (endIdx === -1) {\n endIdx = str.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1;\n continue;\n }\n\n const key = str.slice(index, eqIdx).trim();\n\n // only assign once\n if (undefined === result[key]) {\n let val = str.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n result[key] = decode(val);\n } catch (_) {\n result[key] = val; // no decoding\n }\n }\n\n index = endIdx + 1;\n }\n\n return result;\n};\n\nexport interface SerializeOptions{\n encode?: (val: string | number | boolean) => string,\n maxAge?: number,\n domain?: string,\n path?: string,\n expires?: Date,\n httpOnly?: boolean,\n secure?: boolean,\n priority?: string,\n sameSite?: boolean|string,\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * ```js\n * cookieSerialize('foo', 'bar', { httpOnly: true }) // \"foo=bar; httpOnly\"\n * ```\n */\nexport function cookieSerialize(name: string, val: string, options?: SerializeOptions): string {\n const opt = Object.assign({}, options || {});\n const encode = opt.encode || defaultEncode;\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n const value = encode(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n let result = name + '=' + value;\n\n if (opt.maxAge != null) {\n const maxAge = opt.maxAge - 0;\n\n if (isNaN(maxAge) || !isFinite(maxAge)) {\n throw new TypeError('option maxAge is invalid');\n }\n\n result += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n result += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n result += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (!isDate(opt.expires) || isNaN(opt.expires.valueOf())) {\n throw new TypeError('option expires is invalid');\n }\n\n result += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n result += '; HttpOnly';\n }\n\n if (opt.secure) {\n result += '; Secure';\n }\n\n if (opt.priority) {\n const priority = typeof opt.priority === 'string' ? opt.priority.toLowerCase() : opt.priority;\n\n switch (priority) {\n case 'low':\n result += '; Priority=Low';\n break;\n case 'medium':\n result += '; Priority=Medium';\n break;\n case 'high':\n result += '; Priority=High';\n break;\n default:\n throw new TypeError('option priority is invalid');\n }\n }\n\n if (opt.sameSite) {\n const sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n result += '; SameSite=Strict';\n break;\n case 'lax':\n result += '; SameSite=Lax';\n break;\n case 'strict':\n result += '; SameSite=Strict';\n break;\n case 'none':\n result += '; SameSite=None';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return result;\n};\n\n/**\n * Default URL-decode string value function.\n * Optimized to skip native call when no `%`.\n */\nfunction defaultDecode(val: string): string {\n return val.indexOf('%') !== -1\n ? decodeURIComponent(val)\n : val;\n}\n\n/**\n * Default URL-encode value function.\n */\nfunction defaultEncode(val: string | number | boolean): string {\n return encodeURIComponent(val);\n}\n\n/**\n * Determines if value is a Date.\n */\nfunction isDate(val: any): boolean {\n return (\n Object.prototype.toString.call(val) === '[object Date]' ||\n val instanceof Date\n );\n}\n","export default abstract class BaseModel {\n [key: string]: any,\n\n id!: string;\n created!: string;\n updated!: string;\n\n constructor(data: { [key: string]: any } = {}) {\n this.$load(data || {});\n }\n\n /**\n * Alias of this.$load(data).\n */\n load(data: { [key: string]: any }) {\n return this.$load(data);\n }\n\n /**\n * Loads `data` into the current model.\n */\n $load(data: { [key: string]: any }) {\n for (const [key, value] of Object.entries(data)) {\n this[key] = value;\n }\n\n // normalize known fields\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.created = typeof data.created !== 'undefined' ? data.created : '';\n this.updated = typeof data.updated !== 'undefined' ? data.updated : '';\n }\n\n /**\n * Returns whether the current loaded data represent a stored db record.\n */\n get $isNew(): boolean {\n return !this.id;\n }\n\n /**\n * Alias of this.clone().\n */\n clone(): BaseModel {\n return this.$clone();\n }\n\n /**\n * Creates a deep clone of the current model.\n */\n $clone(): BaseModel {\n const clone = typeof structuredClone === 'function' ?\n structuredClone(this) : JSON.parse(JSON.stringify(this));\n\n return new (this.constructor as any)(clone);\n }\n\n /**\n * Alias of this.$export().\n */\n export(): { [key: string]: any } {\n return this.$export();\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n $export(): { [key: string]: any } {\n return typeof structuredClone === 'function' ?\n structuredClone(this) : Object.assign({}, this);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Record extends BaseModel {\n collectionId!: string;\n collectionName!: string;\n expand!: {[key: string]: Record|Array};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // normalize common fields\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.collectionName = typeof data.collectionName === 'string' ? data.collectionName : '';\n\n // normalize expand items\n this._loadExpand(data.expand);\n }\n\n /**\n * Loads the provided expand items and recursively normalizes each\n * item to a `Record|Array`.\n */\n private _loadExpand(expand: { [key: string]: any }) {\n expand = expand || {};\n this.expand = {};\n\n for (const key in expand) {\n if (Array.isArray(expand[key])) {\n this.expand[key] = expand[key].map((data: any) => new Record(data || {}));\n } else {\n this.expand[key] = new Record(expand[key] || {});\n }\n }\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Admin extends BaseModel {\n avatar!: number;\n email!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.avatar = typeof data.avatar === 'number' ? data.avatar : 0;\n this.email = typeof data.email === 'string' ? data.email : '';\n }\n}\n","import { cookieParse, cookieSerialize, SerializeOptions } from '@/stores/utils/cookie';\nimport { isTokenExpired, getTokenPayload } from '@/stores/utils/jwt';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\nexport type OnStoreChangeFunc = (token: string, model: Record|Admin|null) => void;\n\nconst defaultCookieKey = 'pb_auth';\n\n/**\n * Base AuthStore class that is intended to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore {\n protected baseToken: string = '';\n protected baseModel: Record|Admin|null = null;\n\n private _onChangeCallbacks: Array = [];\n\n /**\n * Retrieves the stored token (if any).\n */\n get token(): string {\n return this.baseToken;\n }\n\n /**\n * Retrieves the stored model data (if any).\n */\n get model(): Record|Admin|null {\n return this.baseModel;\n }\n\n /**\n * Loosely checks if the store has valid token (aka. existing and unexpired exp claim).\n */\n get isValid(): boolean {\n return !isTokenExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: Record|Admin|null): void {\n this.baseToken = token || '';\n\n // normalize the model instance\n if (model !== null && typeof model === 'object') {\n this.baseModel = typeof (model as any).collectionId !== 'undefined' ?\n new Record(model) : new Admin(model);\n } else {\n this.baseModel = null;\n }\n\n this.triggerChange();\n }\n\n /**\n * Removes the stored token and model data form the auth store.\n */\n clear(): void {\n this.baseToken = '';\n this.baseModel = null;\n this.triggerChange();\n }\n\n /**\n * Parses the provided cookie string and updates the store state\n * with the cookie's token and model data.\n *\n * NB! This function doesn't validate the token or its data.\n * Usually this isn't a concern if you are interacting only with the\n * PocketBase API because it has the proper server-side security checks in place,\n * but if you are using the store `isValid` state for permission controls\n * in a node server (eg. SSR), then it is recommended to call `authRefresh()`\n * after loading the cookie to ensure an up-to-date token and model state.\n * For example:\n *\n * ```js\n * pb.authStore.loadFromCookie(\"cookie string...\");\n *\n * try {\n * // get an up-to-date auth store state by veryfing and refreshing the loaded auth model (if any)\n * pb.authStore.isValid && await pb.collection('users').authRefresh();\n * } catch (_) {\n * // clear the auth store on failed refresh\n * pb.authStore.clear();\n * }\n * ```\n */\n loadFromCookie(cookie: string, key = defaultCookieKey): void {\n const rawData = cookieParse(cookie || '')[key] || '';\n\n let data: { [key: string]: any } = {};\n try {\n data = JSON.parse(rawData);\n // normalize\n if (typeof data === null || typeof data !== 'object' || Array.isArray(data)) {\n data = {};\n }\n } catch (_) {}\n\n this.save(data.token || '', data.model || null);\n }\n\n /**\n * Exports the current store state as cookie string.\n *\n * By default the following optional attributes are added:\n * - Secure\n * - HttpOnly\n * - SameSite=Strict\n * - Path=/\n * - Expires={the token expiration date}\n *\n * NB! If the generated cookie exceeds 4096 bytes, this method will\n * strip the model data to the bare minimum to try to fit within the\n * recommended size in https://www.rfc-editor.org/rfc/rfc6265#section-6.1.\n */\n exportToCookie(options?: SerializeOptions, key = defaultCookieKey): string {\n const defaultOptions: SerializeOptions = {\n secure: true,\n sameSite: true,\n httpOnly: true,\n path: \"/\",\n };\n\n // extract the token expiration date\n const payload = getTokenPayload(this.token);\n if (payload?.exp) {\n defaultOptions.expires = new Date(payload.exp * 1000);\n } else {\n defaultOptions.expires = new Date('1970-01-01');\n }\n\n // merge with the user defined options\n options = Object.assign({}, defaultOptions, options);\n\n const rawData = {\n token: this.token,\n model: this.model?.export() || null,\n };\n\n let result = cookieSerialize(key, JSON.stringify(rawData), options);\n\n const resultLength = typeof Blob !== 'undefined' ?\n (new Blob([result])).size : result.length;\n\n // strip down the model data to the bare minimum\n if (rawData.model && resultLength > 4096) {\n rawData.model = {id: rawData?.model?.id, email: rawData?.model?.email};\n if (this.model instanceof Record) {\n rawData.model.username = this.model.username;\n rawData.model.verified = this.model.verified;\n rawData.model.collectionId = this.model.collectionId;\n }\n result = cookieSerialize(key, JSON.stringify(rawData), options);\n }\n\n return result;\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * You can set the `fireImmediately` argument to true in order to invoke\n * the provided callback right after registration.\n *\n * Returns a removal function that you could call to \"unsubscribe\" from the changes.\n */\n onChange(callback: OnStoreChangeFunc, fireImmediately = false): () => void {\n this._onChangeCallbacks.push(callback);\n\n if (fireImmediately) {\n callback(this.token, this.model);\n }\n\n return () => {\n for (let i = this._onChangeCallbacks.length - 1; i >= 0; i--) {\n if (this._onChangeCallbacks[i] == callback) {\n delete this._onChangeCallbacks[i]; // removes the function reference\n this._onChangeCallbacks.splice(i, 1); // reindex the array\n return;\n }\n }\n }\n }\n\n protected triggerChange(): void {\n for (const callback of this._onChangeCallbacks) {\n callback && callback(this.token, this.model);\n }\n }\n}\n","import BaseAuthStore from '@/stores/BaseAuthStore';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\n/**\n * The default token store for browsers with auto fallback\n * to runtime/memory if local storage is undefined (eg. in node env).\n */\nexport default class LocalAuthStore extends BaseAuthStore {\n private storageFallback: { [key: string]: any } = {};\n private storageKey: string\n\n constructor(storageKey = \"pocketbase_auth\") {\n super();\n\n this.storageKey = storageKey;\n }\n\n /**\n * @inheritdoc\n */\n get token(): string {\n const data = this._storageGet(this.storageKey) || {};\n\n return data.token || '';\n }\n\n /**\n * @inheritdoc\n */\n get model(): Record|Admin|null {\n const data = this._storageGet(this.storageKey) || {};\n\n if (\n data === null ||\n typeof data !== 'object' ||\n data.model === null ||\n typeof data.model !== 'object'\n ) {\n return null;\n }\n\n // admins don't have `collectionId` prop\n if (typeof data.model?.collectionId === 'undefined') {\n return new Admin(data.model);\n }\n\n return new Record(data.model);\n }\n\n /**\n * @inheritdoc\n */\n save(token: string, model: Record|Admin|null) {\n this._storageSet(this.storageKey, {\n 'token': token,\n 'model': model,\n });\n\n super.save(token, model);\n }\n\n /**\n * @inheritdoc\n */\n clear() {\n this._storageRemove(this.storageKey);\n\n super.clear();\n }\n\n // ---------------------------------------------------------------\n // Internal helpers:\n // ---------------------------------------------------------------\n\n /**\n * Retrieves `key` from the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageGet(key: string): any {\n if (typeof window !== 'undefined' && window?.localStorage) {\n const rawValue = window.localStorage.getItem(key) || '';\n try {\n return JSON.parse(rawValue);\n } catch (e) { // not a json\n return rawValue;\n }\n }\n\n // fallback\n return this.storageFallback[key];\n }\n\n /**\n * Stores a new data in the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageSet(key: string, value: any) {\n if (typeof window !== 'undefined' && window?.localStorage) {\n // store in local storage\n let normalizedVal = value;\n if (typeof value !== 'string') {\n normalizedVal = JSON.stringify(value);\n }\n window.localStorage.setItem(key, normalizedVal);\n } else {\n // store in fallback\n this.storageFallback[key] = value;\n }\n }\n\n /**\n * Removes `key` from the browser's local storage and the runtime/memory.\n */\n private _storageRemove(key: string) {\n // delete from local storage\n if (typeof window !== 'undefined' && window?.localStorage) {\n window.localStorage?.removeItem(key);\n }\n\n // delete from fallback\n delete this.storageFallback[key];\n }\n}\n","import Client from '@/Client';\n\n/**\n * BaseService class that should be inherited from all API services.\n */\nexport default abstract class BaseService {\n readonly client: Client\n\n constructor(client: Client) {\n this.client = client;\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\ninterface appleClientSecret {\n secret: string;\n}\n\nexport default class SettingsService extends BaseService {\n /**\n * Fetch all available app settings.\n */\n getAll(queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Bulk updates app settings.\n */\n update(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Performs a S3 filesystem connection test.\n *\n * The currently supported `filesystem` are \"storage\" and \"backups\".\n */\n testS3(filesystem: string = \"storage\", queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'filesystem': filesystem,\n };\n\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends a test email.\n *\n * The possible `emailTemplate` values are:\n * - verification\n * - password-reset\n * - email-change\n */\n testEmail(toEmail: string, emailTemplate: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'email': toEmail,\n 'template': emailTemplate,\n };\n\n return this.client.send('/api/settings/test/email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Generates a new Apple OAuth2 client secret.\n */\n generateAppleClientSecret(\n clientId: string,\n teamId: string,\n keyId: string,\n privateKey: string,\n duration: number,\n bodyParams = {},\n queryParams: BaseQueryParams = {}\n ): Promise {\n bodyParams = Object.assign({\n clientId,\n teamId,\n keyId,\n privateKey,\n duration,\n }, bodyParams);\n\n return this.client.send('/api/settings/apple/generate-client-secret', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n });\n }\n}\n","import BaseModel from './BaseModel';\n\nexport default class ListResult {\n page!: number;\n perPage!: number;\n totalItems!: number;\n totalPages!: number;\n items!: Array;\n\n constructor(\n page: number,\n perPage: number,\n totalItems: number,\n totalPages: number,\n items: Array,\n ) {\n this.page = page > 0 ? page : 1;\n this.perPage = perPage >= 0 ? perPage : 0;\n this.totalItems = totalItems >= 0 ? totalItems : 0;\n this.totalPages = totalPages >= 0 ? totalPages : 0;\n this.items = items || [];\n }\n}\n","import ListResult from '@/models/utils/ListResult';\nimport BaseModel from '@/models/utils/BaseModel';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n FullListQueryParams\n} from '@/services/utils/QueryParams';\n\nexport default abstract class CrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/admins').\n */\n abstract get baseCrudPath(): string\n\n /**\n * Returns a promise with all list items batch fetched at once\n * (by default 200 items per request; to change it set the `batch` query param).\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(queryParams?: FullListQueryParams): Promise>\n\n /**\n * Legacy version of getFullList with explicitly specified batch size.\n */\n getFullList(batch?: number, queryParams?: ListQueryParams): Promise>\n\n getFullList(batchOrqueryParams?: number|FullListQueryParams, queryParams?: ListQueryParams): Promise> {\n if (typeof batchOrqueryParams == \"number\") {\n return this._getFullList(this.baseCrudPath, batchOrqueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrqueryParams, queryParams);\n\n return this._getFullList(this.baseCrudPath, params.batch || 200, params);\n }\n\n /**\n * Returns paginated items list.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n return this._getList(this.baseCrudPath, page, perPage, queryParams);\n }\n\n /**\n * Returns the first found item by the specified filter.\n *\n * Internally it calls `getList(1, 1, { filter })` and returns the\n * first found item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n *\n * For consistency with `getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n getFirstListItem(filter: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getFirstListItem(this.baseCrudPath, filter, queryParams);\n }\n\n /**\n * Returns single item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getOne(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getOne(this.baseCrudPath, id, queryParams);\n }\n\n /**\n * Creates a new item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n create(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._create(this.baseCrudPath, bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._update(this.baseCrudPath, id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._delete(this.baseCrudPath, id, queryParams);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\nimport {\n BaseQueryParams,\n ListQueryParams\n} from '@/services/utils/QueryParams';\n\n// @todo since there is no longer need of SubCrudService consider merging with CrudService in v0.9+\nexport default abstract class BaseCrudService extends BaseService {\n /**\n * Response data decoder.\n */\n abstract decode(data: { [key: string]: any }): M\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n protected _getFullList(basePath: string, batchSize = 200, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize || 200, queryParams).then((list) => {\n const castedList = (list as any as ListResult);\n const items = castedList.items;\n const totalItems = castedList.totalItems;\n\n result = result.concat(items);\n\n if (items.length && totalItems > result.length) {\n return request(page + 1);\n }\n\n return result;\n });\n }\n\n return request(1);\n }\n\n /**\n * Returns paginated items list.\n */\n protected _getList(basePath: string, page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send(basePath, {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData.items || [];\n for (const item of responseData.items) {\n items.push(this.decode(item) as any as T);\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns single item by its id.\n */\n protected _getOne(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Returns the first found item by a list filter.\n *\n * Internally it calls `_getList(basePath, 1, 1, { filter })` and returns its\n * first item.\n *\n * For consistency with `_getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n protected _getFirstListItem(basePath: string, filter: string, queryParams: BaseQueryParams = {}): Promise {\n queryParams = Object.assign({\n 'filter': filter,\n '$cancelKey': 'one_by_filter_' + basePath + \"_\" + filter,\n }, queryParams);\n\n return this._getList(basePath, 1, 1, queryParams)\n .then((result) => {\n if (!result?.items?.length) {\n throw new ClientResponseError({\n status: 404,\n data: {\n code: 404,\n message: \"The requested resource wasn't found.\",\n data: {},\n },\n });\n }\n\n return result.items[0];\n });\n }\n\n /**\n * Creates a new item.\n */\n protected _create(basePath: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath, {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Updates an existing item by its id.\n */\n protected _update(basePath: string, id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n protected _delete(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n}\n","import Admin from '@/models/Admin';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface AdminAuthResponse {\n [key: string]: any;\n\n token: string;\n admin: Admin;\n}\n\nexport default class AdminService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Admin {\n return new Admin(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/admins';\n }\n\n // ---------------------------------------------------------------\n // Post update/delete AuthStore sync\n // ---------------------------------------------------------------\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n // update the store state if the updated item id matches with the stored model\n if (\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === item?.id\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n // clear the store state if the deleted item id matches with the stored model\n if (\n success &&\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === id\n ) {\n this.client.authStore.clear();\n }\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful authorize response.\n */\n protected authResponse(responseData: any): AdminAuthResponse {\n const admin = this.decode(responseData?.admin || {});\n\n if (responseData?.token && responseData?.admin) {\n this.client.authStore.save(responseData.token, admin);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'admin': admin,\n });\n }\n\n /**\n * Authenticate an admin account with its email and password\n * and returns a new admin token and data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authWithPassword(\n email: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'identity': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Refreshes the current admin authenticated instance and\n * returns a new token and admin data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authRefresh(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCrudPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends admin password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms admin password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class ExternalAuth extends BaseModel {\n recordId!: string;\n collectionId!: string;\n provider!: string;\n providerId!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.recordId = typeof data.recordId === 'string' ? data.recordId : '';\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.provider = typeof data.provider === 'string' ? data.provider : '';\n this.providerId = typeof data.providerId === 'string' ? data.providerId : '';\n }\n}\n","import Client from '@/Client';\nimport ClientResponseError from '@/ClientResponseError';\nimport Record from '@/models/Record';\nimport ExternalAuth from '@/models/ExternalAuth';\nimport ListResult from '@/models/utils/ListResult';\nimport CrudService from '@/services/utils/CrudService';\nimport { UnsubscribeFunc } from '@/services/RealtimeService';\nimport {\n BaseQueryParams,\n RecordQueryParams,\n RecordListQueryParams,\n RecordFullListQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface RecordAuthResponse {\n record: T;\n token: string;\n meta?: {[key: string]: any};\n}\n\nexport interface AuthProviderInfo {\n name: string;\n state: string;\n codeVerifier: string;\n codeChallenge: string;\n codeChallengeMethod: string;\n authUrl: string;\n}\n\nexport interface AuthMethodsList {\n usernamePassword: boolean;\n emailPassword: boolean;\n authProviders: Array;\n}\n\nexport interface RecordSubscription {\n action: string; // eg. create, update, delete\n record: T;\n}\n\nexport type OAuth2UrlCallback = (url: string) => void|Promise;\n\nexport interface OAuth2AuthConfig {\n // the name of the OAuth2 provider (eg. \"google\")\n provider: string;\n\n // custom scopes to overwrite the default ones\n scopes?: Array;\n\n // optional record create data\n createData?: {[key: string]: any};\n\n // optional callback that is triggered after the OAuth2 sign-in/sign-up url generation\n urlCallback?: OAuth2UrlCallback;\n\n // optional query params to send with the PocketBase auth request (eg. fields, expand, etc.)\n query?: RecordQueryParams;\n\n // optional body params to send with the PocketBase auth request\n body?: {[key: string]: any};\n}\n\nexport default class RecordService extends CrudService {\n readonly collectionIdOrName: string;\n\n constructor(client: Client, collectionIdOrName: string) {\n super(client);\n\n this.collectionIdOrName = collectionIdOrName;\n }\n\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): T {\n return new Record(data) as any as T;\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return this.baseCollectionPath + '/records';\n }\n\n /**\n * Returns the current collection service base path.\n */\n get baseCollectionPath(): string {\n return '/api/collections/' + encodeURIComponent(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Realtime handlers\n // ---------------------------------------------------------------\n\n /**\n * @deprecated Use subscribe(recordId, callback) instead.\n *\n * Subscribe to the realtime changes of a single record in the collection.\n */\n async subscribeOne(recordId: string, callback: (data: RecordSubscription) => void): Promise {\n console.warn(\"PocketBase: subscribeOne(recordId, callback) is deprecated. Please replace it with subscribe(recordId, callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName + \"/\" + recordId, callback);\n }\n\n /**\n * @deprecated This form of subscribe is deprecated. Please use `subscribe(\"*\", callback)`.\n */\n async subscribe(callback: (data: RecordSubscription) => void): Promise\n\n /**\n * Subscribe to realtime changes to the specified topic (\"*\" or record id).\n *\n * If `topic` is the wildcard \"*\", then this method will subscribe to\n * any record changes in the collection.\n *\n * If `topic` is a record id, then this method will subscribe only\n * to changes of the specified record id.\n *\n * It's OK to subscribe multiple times to the same topic.\n * You can use the returned `UnsubscribeFunc` to remove only a single subscription.\n * Or use `unsubscribe(topic)` if you want to remove all subscriptions attached to the topic.\n */\n async subscribe(topic: string, callback: (data: RecordSubscription) => void): Promise\n\n async subscribe(\n topicOrCallback: string|((data: RecordSubscription) => void),\n callback?: (data: RecordSubscription) => void\n ): Promise {\n if (typeof topicOrCallback === 'function') {\n console.warn(\"PocketBase: subscribe(callback) is deprecated. Please replace it with subscribe('*', callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName, topicOrCallback);\n }\n\n if (!callback) {\n throw new Error(\"Missing subscription callback.\");\n }\n\n if (topicOrCallback === \"\") {\n throw new Error(\"Missing topic.\");\n }\n\n let topic = this.collectionIdOrName;\n if (topicOrCallback !== \"*\") {\n topic += ('/' + topicOrCallback);\n }\n\n return this.client.realtime.subscribe(topic, callback)\n }\n\n /**\n * Unsubscribe from all subscriptions of the specified topic\n * (\"*\" or record id).\n *\n * If `topic` is not set, then this method will unsubscribe from\n * all subscriptions associated to the current collection.\n */\n async unsubscribe(topic?: string): Promise {\n // unsubscribe wildcard topic\n if (topic === \"*\") {\n return this.client.realtime.unsubscribe(this.collectionIdOrName);\n }\n\n // unsubscribe recordId topic\n if (topic) {\n return this.client.realtime.unsubscribe(this.collectionIdOrName + \"/\" + topic);\n }\n\n // unsubscribe from everything related to the collection\n return this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Crud handers\n // ---------------------------------------------------------------\n /**\n * @inheritdoc\n */\n getFullList(queryParams?: RecordFullListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batch?: number, queryParams?: RecordListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batchOrQueryParams?: number|RecordFullListQueryParams, queryParams?: RecordListQueryParams): Promise> {\n if (typeof batchOrQueryParams == \"number\") {\n return super.getFullList(batchOrQueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrQueryParams, queryParams);\n\n return super.getFullList(params);\n }\n\n /**\n * @inheritdoc\n */\n getList(page = 1, perPage = 30, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getList(page, perPage, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getFirstListItem(filter: string, queryParams: RecordListQueryParams = {}): Promise {\n return super.getFirstListItem(filter, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getOne(id: string, queryParams: RecordQueryParams = {}): Promise {\n return super.getOne(id, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n create(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.create(bodyParams, queryParams);\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n if (\n // is record auth\n this.client.authStore.model?.id === item?.id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n if (\n success &&\n // is record auth\n this.client.authStore.model?.id === id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.clear();\n }\n\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful collection authorization response.\n */\n protected authResponse(responseData: any): RecordAuthResponse {\n const record = this.decode(responseData?.record || {});\n\n this.client.authStore.save(responseData?.token, record);\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'record': record as any as T,\n });\n }\n\n /**\n * Returns all available collection auth methods.\n */\n listAuthMethods(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCollectionPath + '/auth-methods', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n return Object.assign({}, responseData, {\n // normalize common fields\n 'usernamePassword': !!responseData?.usernamePassword,\n 'emailPassword': !!responseData?.emailPassword,\n 'authProviders': Array.isArray(responseData?.authProviders) ? responseData?.authProviders : [],\n });\n });\n }\n\n /**\n * Authenticate a single auth collection record via its username/email and password.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n */\n authWithPassword(\n usernameOrEmail: string,\n password: string,\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'identity': usernameOrEmail,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2 code.\n *\n * If you don't have an OAuth2 code you may also want to check `authWithOAuth2` method.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n */\n authWithOAuth2Code(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData = {},\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'provider': provider,\n 'code': code,\n 'codeVerifier': codeVerifier,\n 'redirectUrl': redirectUrl,\n 'createData': createData,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-oauth2', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * @deprecated This form of authWithOAuth2 is deprecated.\n *\n * Please use `authWithOAuth2Code()` OR its simplified realtime version\n * as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\n */\n async authWithOAuth2(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData?: {[key: string]: any},\n bodyParams?: {[key: string]: any},\n queryParams?: RecordQueryParams,\n ): Promise>\n\n /**\n * Authenticate a single auth collection record with OAuth2\n * **without custom redirects, deeplinks or even page reload**.\n *\n * This method initializes a one-off realtime subscription and will\n * open a popup window with the OAuth2 vendor page to authenticate.\n * Once the external OAuth2 sign-in/sign-up flow is completed, the popup\n * window will be automatically closed and the OAuth2 data sent back\n * to the user through the previously established realtime connection.\n *\n * You can specify an optional `urlCallback` prop to customize\n * the default url `window.open` behavior.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n *\n * Example:\n *\n * ```js\n * const authData = await pb.collection(\"users\").authWithOAuth2({\n * provider: \"google\",\n * })\n * ```\n *\n * _Site-note_: when creating the OAuth2 app in the provider dashboard\n * you have to configure `https://yourdomain.com/api/oauth2-redirect`\n * as redirect URL.\n */\n async authWithOAuth2(options: OAuth2AuthConfig): Promise>\n\n async authWithOAuth2(...args: any): Promise> {\n // fallback to legacy format\n if (args.length > 1 || typeof args?.[0] === 'string') {\n console.warn(\"PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\");\n return this.authWithOAuth2Code(\n args?.[0] || '',\n args?.[1] || '',\n args?.[2] || '',\n args?.[3] || '',\n args?.[4] || {},\n args?.[5] || {},\n args?.[6] || {},\n );\n }\n\n const config = args?.[0] || {};\n\n const authMethods = await this.listAuthMethods();\n\n const provider = authMethods.authProviders.find((p) => p.name === config.provider);\n if (!provider) {\n throw new ClientResponseError(new Error(`Missing or invalid provider \"${config.provider}\".`));\n }\n\n const redirectUrl = this.client.buildUrl('/api/oauth2-redirect');\n\n return new Promise(async (resolve, reject) => {\n try {\n // initialize a one-off @oauth2 realtime subscription\n const unsubscribe = await this.client.realtime.subscribe('@oauth2', async (e) => {\n const oldState = this.client.realtime.clientId;\n\n try {\n unsubscribe();\n\n if (!e.state || oldState !== e.state) {\n throw new Error(\"State parameters don't match.\");\n }\n\n const authData = await this.authWithOAuth2Code(\n provider.name,\n e.code,\n provider.codeVerifier,\n redirectUrl,\n config.createData,\n config.body,\n config.query,\n )\n\n resolve(authData);\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n\n const url = new URL(provider.authUrl + redirectUrl);\n url.searchParams.set(\"state\", this.client.realtime.clientId);\n if (config.scopes?.length) {\n url.searchParams.set(\"scope\", config.scopes.join(\" \"));\n }\n\n await (config.urlCallback ? config.urlCallback(url.toString()) : this._defaultUrlCallback(url.toString()));\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n }\n\n /**\n * Refreshes the current authenticated record instance and\n * returns a new token and record data.\n *\n * On success this method also automatically updates the client's AuthStore.\n */\n authRefresh(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise> {\n return this.client.send(this.baseCollectionPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Sends auth record password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends auth record verification email request.\n */\n requestVerification(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record email verification request.\n */\n confirmVerification(\n verificationToken: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': verificationToken,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends an email change request to the authenticated record model.\n */\n requestEmailChange(\n newEmail: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'newEmail': newEmail,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record's new email address.\n */\n confirmEmailChange(\n emailChangeToken: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': emailChangeToken,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Lists all linked external auth providers for the specified auth record.\n */\n listExternalAuths(\n recordId: string,\n queryParams: BaseQueryParams = {}\n ): Promise> {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => {\n const items: Array = [];\n\n if (Array.isArray(responseData)) {\n for (const item of responseData) {\n items.push(new ExternalAuth(item));\n }\n }\n\n return items;\n });\n }\n\n /**\n * Unlink a single external auth provider from the specified auth record.\n */\n unlinkExternalAuth(\n recordId: string,\n provider: string,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths/' + encodeURIComponent(provider), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n // ---------------------------------------------------------------\n\n private _defaultUrlCallback(url: string) {\n if (typeof window === \"undefined\" || !window?.open) {\n throw new ClientResponseError(new Error(`Not in a browser context - please pass a custom urlCallback function.`));\n }\n\n let width = 1024;\n let height = 768;\n\n let windowWidth = window.innerWidth;\n let windowHeight = window.innerHeight;\n\n // normalize window size\n width = width > windowWidth ? windowWidth : width;\n height = height > windowHeight ? windowHeight : height;\n\n let left = (windowWidth / 2) - (width / 2);\n let top = (windowHeight / 2) - (height / 2);\n\n window.open(\n url,\n \"oauth2-popup\",\n 'width='+width+',height='+height+',top='+top+',left='+left+',resizable,menubar=no'\n );\n }\n}\n","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.name = typeof data.name !== 'undefined' ? data.name : '';\n this.type = typeof data.type !== 'undefined' ? data.type : 'text';\n this.system = !!data.system;\n this.required = !!data.required;\n this.options = typeof data.options === 'object' && data.options !== null ? data.options : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport SchemaField from '@/models/utils/SchemaField';\n\nexport default class Collection extends BaseModel {\n name!: string;\n type!: string;\n schema!: Array;\n indexes!: Array;\n system!: boolean;\n listRule!: null|string;\n viewRule!: null|string;\n createRule!: null|string;\n updateRule!: null|string;\n deleteRule!: null|string;\n options!: {[key:string]: any};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.system = !!data.system;\n this.name = typeof data.name === 'string' ? data.name : '';\n this.type = typeof data.type === 'string' ? data.type : 'base';\n this.options = typeof data.options !== 'undefined' && data.options !== null ? data.options : {};\n this.indexes = Array.isArray(data.indexes) ? data.indexes : [];\n\n // rules\n this.listRule = typeof data.listRule === 'string' ? data.listRule : null;\n this.viewRule = typeof data.viewRule === 'string' ? data.viewRule : null;\n this.createRule = typeof data.createRule === 'string' ? data.createRule : null;\n this.updateRule = typeof data.updateRule === 'string' ? data.updateRule : null;\n this.deleteRule = typeof data.deleteRule === 'string' ? data.deleteRule : null;\n\n // schema\n data.schema = Array.isArray(data.schema) ? data.schema : [];\n this.schema = [];\n for (let field of data.schema) {\n this.schema.push(new SchemaField(field));\n }\n }\n\n /**\n * @deprecated Please use $isBase instead.\n */\n get isBase(): boolean {\n return this.$isBase;\n }\n\n /**\n * Checks if the current model is \"base\" collection.\n */\n get $isBase(): boolean {\n return this.type === 'base';\n }\n\n /**\n * @deprecated Please use $isAuth instead.\n */\n get isAuth(): boolean {\n return this.$isAuth;\n }\n\n /**\n * Checks if the current model is \"auth\" collection.\n */\n get $isAuth(): boolean {\n return this.type === 'auth';\n }\n\n /**\n * @deprecated Please use $isView instead.\n */\n get isView(): boolean {\n return this.$isView;\n }\n\n /**\n * Checks if the current model is \"view\" collection.\n */\n get $isView(): boolean {\n return this.type === 'view';\n }\n}\n","import Collection from '@/models/Collection';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport default class CollectionService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Collection {\n return new Collection(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/collections';\n }\n\n /**\n * Imports the provided collections.\n *\n * If `deleteMissing` is `true`, all local collections and schema fields,\n * that are not present in the imported configuration, WILL BE DELETED\n * (including their related records data)!\n */\n async import(\n collections: Array,\n deleteMissing: boolean = false,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/import', {\n 'method': 'PUT',\n 'params': queryParams,\n 'body': {\n 'collections': collections,\n 'deleteMissing': deleteMissing,\n }\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class LogRequest extends BaseModel {\n url!: string;\n method!: string;\n status!: number;\n auth!: string;\n remoteIp!: string;\n userIp!: string;\n referer!: string;\n userAgent!: string;\n meta!: { [key: string]: any };\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // fallback to the ip field for backward compatibility\n data.remoteIp = data.remoteIp || data.ip;\n\n this.url = typeof data.url === 'string' ? data.url : '';\n this.method = typeof data.method === 'string' ? data.method : 'GET';\n this.status = typeof data.status === 'number' ? data.status : 200;\n this.auth = typeof data.auth === 'string' ? data.auth : 'guest';\n this.remoteIp = typeof data.remoteIp === 'string' ? data.remoteIp : '';\n this.userIp = typeof data.userIp === 'string' ? data.userIp : '';\n this.referer = typeof data.referer === 'string' ? data.referer : '';\n this.userAgent = typeof data.userAgent === 'string' ? data.userAgent : '';\n this.meta = typeof data.meta === 'object' && data.meta !== null ? data.meta : {};\n }\n}\n","import LogRequest from '@/models/LogRequest';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n LogStatsQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface HourlyStats {\n total: number;\n date: string;\n}\n\nexport default class LogService extends BaseService {\n /**\n * Returns paginated logged requests list.\n */\n getRequestsList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send('/api/logs/requests', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData?.items || [];\n for (const item of responseData.items) {\n items.push(new LogRequest(item));\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns a single logged request by its id.\n */\n getRequest(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/logs/requests/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => new LogRequest(responseData));\n }\n\n /**\n * Returns request logs statistics.\n */\n getRequestsStats(queryParams: LogStatsQueryParams = {}): Promise> {\n return this.client.send('/api/logs/requests/stats', {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => responseData);\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\n\ninterface promiseCallbacks {\n resolve: Function\n reject: Function\n}\n\nexport type UnsubscribeFunc = () => Promise;\n\nexport default class RealtimeService extends BaseService {\n clientId: string = \"\";\n\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 15000;\n private reconnectTimeoutId: any;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number = Infinity;\n private predefinedReconnectIntervals: Array = [\n 200, 300, 500, 1000, 1200, 1500, 2000,\n ];\n private pendingConnects: Array = [];\n\n\n /**\n * Returns whether the realtime connection has been established.\n */\n get isConnected(): boolean {\n return !!this.eventSource && !!this.clientId && !this.pendingConnects.length;\n }\n\n /**\n * Register the subscription listener.\n *\n * You can subscribe multiple times to the same topic.\n *\n * If the SSE connection is not started yet,\n * this method will also initialize it.\n */\n async subscribe(topic: string, callback: (data: any) => void): Promise {\n if (!topic) {\n throw new Error('topic must be set.')\n }\n\n const listener = function (e: Event) {\n const msgEvent = (e as MessageEvent);\n\n let data;\n try {\n data = JSON.parse(msgEvent?.data);\n } catch {}\n\n callback(data || {});\n };\n\n // store the listener\n if (!this.subscriptions[topic]) {\n this.subscriptions[topic] = [];\n }\n this.subscriptions[topic].push(listener);\n\n if (!this.isConnected) {\n // initialize sse connection\n await this.connect();\n } else if (this.subscriptions[topic].length === 1) {\n // send the updated subscriptions (if it is the first for the topic)\n await this.submitSubscriptions();\n } else {\n // only register the listener\n this.eventSource?.addEventListener(topic, listener);\n }\n\n return async (): Promise => {\n return this.unsubscribeByTopicAndListener(topic, listener);\n };\n }\n\n /**\n * Unsubscribe from all subscription listeners with the specified topic.\n *\n * If `topic` is not provided, then this method will unsubscribe\n * from all active subscriptions.\n *\n * This method is no-op if there are no active subscriptions.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribe(topic?: string): Promise {\n if (!this.hasSubscriptionListeners(topic)) {\n return; // already unsubscribed\n }\n\n if (!topic) {\n // remove all subscriptions\n this.subscriptions = {};\n } else {\n // remove all topic listeners\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n /**\n * Unsubscribe from all subscription listeners starting with the specified topic prefix.\n *\n * This method is no-op if there are no active subscriptions with the specified topic prefix.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByPrefix(topicPrefix: string): Promise {\n let hasAtleastOneTopic = false;\n for (let topic in this.subscriptions) {\n if (!topic.startsWith(topicPrefix)) {\n continue;\n }\n\n hasAtleastOneTopic = true;\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!hasAtleastOneTopic) {\n return; // nothing to unsubscribe from\n }\n\n if (this.hasSubscriptionListeners()) {\n // submit the deleted subscriptions\n await this.submitSubscriptions();\n } else {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n }\n }\n\n /**\n * Unsubscribe from all subscriptions matching the specified topic and listener function.\n *\n * This method is no-op if there are no active subscription with\n * the specified topic and listener.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByTopicAndListener(topic: string, listener: EventListener): Promise {\n if (!Array.isArray(this.subscriptions[topic]) || !this.subscriptions[topic].length) {\n return; // already unsubscribed\n }\n\n let exist = false;\n for (let i = this.subscriptions[topic].length - 1; i >= 0; i--) {\n if (this.subscriptions[topic][i] !== listener) {\n continue;\n }\n\n exist = true; // has at least one matching listener\n delete this.subscriptions[topic][i]; // removes the function reference\n this.subscriptions[topic].splice(i, 1); // reindex the array\n this.eventSource?.removeEventListener(topic, listener);\n }\n if (!exist) {\n return;\n }\n\n // remove the topic from the subscriptions list if there are no other listeners\n if (!this.subscriptions[topic].length) {\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n private hasSubscriptionListeners(topicToCheck?: string): boolean {\n this.subscriptions = this.subscriptions || {};\n\n // check the specified topic\n if (topicToCheck) {\n return !!this.subscriptions[topicToCheck]?.length;\n }\n\n // check for at least one non-empty topic\n for (let topic in this.subscriptions) {\n if (!!this.subscriptions[topic]?.length) {\n return true\n }\n }\n\n return false;\n }\n\n private async submitSubscriptions(): Promise {\n if (!this.clientId) {\n return; // no client/subscriber\n }\n\n // optimistic update\n this.addAllSubscriptionListeners();\n\n this.lastSentTopics = this.getNonEmptySubscriptionTopics();\n\n return this.client.send('/api/realtime', {\n 'method': 'POST',\n 'body': {\n 'clientId': this.clientId,\n 'subscriptions': this.lastSentTopics,\n },\n 'params': {\n '$cancelKey': this.getSubscriptionsCancelKey(),\n },\n }).catch((err) => {\n if (err?.isAbort) {\n return; // silently ignore aborted pending requests\n }\n throw err;\n });\n }\n\n private getSubscriptionsCancelKey(): string {\n return \"realtime_\" + this.clientId;\n }\n\n private getNonEmptySubscriptionTopics(): Array {\n const result : Array = [];\n\n for (let topic in this.subscriptions) {\n if (this.subscriptions[topic].length) {\n result.push(topic);\n }\n }\n\n return result;\n }\n\n private addAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n this.removeAllSubscriptionListeners();\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.addEventListener(topic, listener);\n }\n }\n }\n\n private removeAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.removeEventListener(topic, listener);\n }\n }\n }\n\n private async connect(): Promise {\n if (this.reconnectAttempts > 0) {\n // immediately resolve the promise to avoid indefinitely\n // blocking the client during reconnection\n return;\n }\n\n return new Promise((resolve, reject) => {\n this.pendingConnects.push({ resolve, reject });\n\n if (this.pendingConnects.length > 1) {\n // all promises will be resolved once the connection is established\n return;\n }\n\n this.initConnect();\n })\n }\n\n private initConnect() {\n this.disconnect(true);\n\n // wait up to 15s for connect\n clearTimeout(this.connectTimeoutId);\n this.connectTimeoutId = setTimeout(() => {\n this.connectErrorHandler(new Error(\"EventSource connect took too long.\"));\n }, this.maxConnectTimeout);\n\n this.eventSource = new EventSource(this.client.buildUrl('/api/realtime'))\n\n this.eventSource.onerror = (_) => {\n this.connectErrorHandler(new Error(\"Failed to establish realtime connection.\"));\n };\n\n this.eventSource.addEventListener('PB_CONNECT', (e) => {\n const msgEvent = (e as MessageEvent);\n this.clientId = msgEvent?.lastEventId;\n\n this.submitSubscriptions()\n .then(async () => {\n let retries = 3;\n while (this.hasUnsentSubscriptions() && retries > 0) {\n retries--;\n // resubscribe to ensure that the latest topics are submitted\n //\n // This is needed because missed topics could happen on reconnect\n // if after the pending sent `submitSubscriptions()` call another `subscribe()`\n // was made before the submit was able to complete.\n await this.submitSubscriptions();\n }\n }).then(() => {\n for (let p of this.pendingConnects) {\n p.resolve();\n }\n\n // reset connect meta\n this.pendingConnects = [];\n this.reconnectAttempts = 0;\n clearTimeout(this.reconnectTimeoutId);\n clearTimeout(this.connectTimeoutId);\n }).catch((err) => {\n this.clientId = \"\";\n this.connectErrorHandler(err);\n });\n });\n }\n\n private hasUnsentSubscriptions(): boolean {\n const latestTopics = this.getNonEmptySubscriptionTopics();\n if (latestTopics.length != this.lastSentTopics.length) {\n return true;\n }\n\n for (const t of latestTopics) {\n if (!this.lastSentTopics.includes(t)) {\n return true;\n }\n }\n\n return false;\n }\n\n private connectErrorHandler(err: any) {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n\n if (\n // wasn't previously connected -> direct reject\n (!this.clientId && !this.reconnectAttempts) ||\n // was previously connected but the max reconnection limit has been reached\n this.reconnectAttempts > this.maxReconnectAttempts\n ) {\n for (let p of this.pendingConnects) {\n p.reject(new ClientResponseError(err));\n }\n this.disconnect();\n return;\n }\n\n // otherwise -> reconnect in the background\n this.disconnect(true);\n const timeout = this.predefinedReconnectIntervals[this.reconnectAttempts] || this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length - 1];\n this.reconnectAttempts++;\n this.reconnectTimeoutId = setTimeout(() => {\n this.initConnect();\n }, timeout);\n }\n\n private disconnect(fromReconnect = false): void {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n this.removeAllSubscriptionListeners();\n this.client.cancelRequest(this.getSubscriptionsCancelKey());\n this.eventSource?.close();\n this.eventSource = null;\n this.clientId = \"\";\n\n if (!fromReconnect) {\n this.reconnectAttempts = 0;\n\n // reject any remaining connect promises\n const err = new ClientResponseError(new Error(\"Realtime disconnected.\"));\n for (let p of this.pendingConnects) {\n p.reject(err);\n }\n this.pendingConnects = [];\n }\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface HealthCheckResponse {\n code: number;\n message: string;\n data: {[key: string]: any};\n}\n\nexport default class HealthService extends BaseService {\n /**\n * Checks the health status of the api.\n */\n check(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/health', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport default class FileService extends BaseService {\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n const parts = [];\n parts.push(\"api\")\n parts.push(\"files\")\n parts.push(encodeURIComponent(record.collectionId || record.collectionName))\n parts.push(encodeURIComponent(record.id))\n parts.push(encodeURIComponent(filename))\n\n let result = this.client.buildUrl(parts.join('/'));\n\n if (Object.keys(queryParams).length) {\n const params = new URLSearchParams(queryParams);\n result += (result.includes(\"?\") ? \"&\" : \"?\") + params;\n }\n\n return result\n }\n\n /**\n * Requests a new private file access token for the current auth model (admin or record).\n */\n getToken(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/files/token', {\n 'method': 'POST',\n 'params': queryParams,\n }).then((data) => data?.token || '');\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface BackupFileInfo {\n key: string;\n size: number;\n modified: string;\n}\n\nexport default class BackupService extends BaseService {\n /**\n * Returns list with all available backup files.\n */\n getFullList(queryParams: BaseQueryParams = {}): Promise> {\n return this.client.send('/api/backups', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n\n /**\n * Initializes a new backup.\n */\n create(basename: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'name': basename,\n };\n\n return this.client.send('/api/backups', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Deletes a single backup file.\n */\n delete(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}`, {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Initializes an app data restore from an existing backup.\n */\n restore(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}/restore`, {\n 'method': 'POST',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Builds a download url for a single existing backup using an\n * admin file token and the backup file key.\n *\n * The file token can be generated via `pb.files.getToken()`.\n */\n getDownloadUrl(token: string, key: string): string {\n return this.client.buildUrl(`/api/backups/${encodeURIComponent(key)}?token=${encodeURIComponent(token)}`);\n }\n}\n","import ClientResponseError from '@/ClientResponseError';\nimport BaseAuthStore from '@/stores/BaseAuthStore';\nimport LocalAuthStore from '@/stores/LocalAuthStore';\nimport SettingsService from '@/services/SettingsService';\nimport AdminService from '@/services/AdminService';\nimport RecordService from '@/services/RecordService';\nimport CollectionService from '@/services/CollectionService';\nimport LogService from '@/services/LogService';\nimport RealtimeService from '@/services/RealtimeService';\nimport HealthService from '@/services/HealthService';\nimport FileService from '@/services/FileService';\nimport BackupService from '@/services/BackupService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport interface SendOptions extends RequestInit {\n headers?: { [key: string]: string };\n body?: any;\n params?: BaseQueryParams;\n}\n\nexport interface BeforeSendResult {\n [key: string]: any, // for backward compatibility\n url?: string,\n options?: {[key: string]: any}\n}\n\n/**\n * PocketBase JS Client.\n */\nexport default class Client {\n /**\n * The base PocketBase backend url address (eg. 'http://127.0.0.1.8090').\n */\n baseUrl: string;\n\n /**\n * Hook that get triggered right before sending the fetch request,\n * allowing you to inspect and modify the url and request options.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * You can return a non-empty result object `{ url, options }` to replace the url and request options entirely.\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, options) {\n * options.headers = Object.assign({}, options.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return { url, options }\n * };\n * ```\n */\n beforeSend?: (url: string, options: SendOptions) => BeforeSendResult|Promise;\n\n /**\n * Hook that get triggered after successfully sending the fetch request,\n * allowing you to inspect/modify the response object and its parsed data.\n *\n * Returns the new Promise resolved `data` that will be returned to the client.\n *\n * Example:\n * ```js\n * client.afterSend = function (response, data) {\n * if (response.status != 200) {\n * throw new ClientResponseError({\n * url: response.url,\n * status: response.status,\n * data: data,\n * });\n * }\n *\n * return data;\n * };\n * ```\n */\n afterSend?: (response: Response, data: any) => any;\n\n /**\n * Optional language code (default to `en-US`) that will be sent\n * with the requests to the server as `Accept-Language` header.\n */\n lang: string;\n\n /**\n * A replaceable instance of the local auth store service.\n */\n authStore: BaseAuthStore;\n\n /**\n * An instance of the service that handles the **Settings APIs**.\n */\n readonly settings: SettingsService;\n\n /**\n * An instance of the service that handles the **Admin APIs**.\n */\n readonly admins: AdminService;\n\n /**\n * An instance of the service that handles the **Collection APIs**.\n */\n readonly collections: CollectionService;\n\n /**\n * An instance of the service that handles the **File APIs**.\n */\n readonly files: FileService;\n\n /**\n * An instance of the service that handles the **Log APIs**.\n */\n readonly logs: LogService;\n\n /**\n * An instance of the service that handles the **Realtime APIs**.\n */\n readonly realtime: RealtimeService;\n\n /**\n * An instance of the service that handles the **Health APIs**.\n */\n readonly health: HealthService;\n\n /**\n * An instance of the service that handles the **Backup APIs**.\n */\n readonly backups: BackupService;\n\n private cancelControllers: { [key: string]: AbortController } = {};\n private recordServices: { [key: string]: RecordService } = {};\n private enableAutoCancellation: boolean = true;\n\n constructor(\n baseUrl = '/',\n authStore?: BaseAuthStore | null,\n lang = 'en-US',\n ) {\n this.baseUrl = baseUrl;\n this.lang = lang;\n this.authStore = authStore || new LocalAuthStore();\n\n // services\n this.admins = new AdminService(this);\n this.collections = new CollectionService(this);\n this.files = new FileService(this);\n this.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(this);\n this.health = new HealthService(this);\n this.backups = new BackupService(this);\n }\n\n /**\n * Returns the RecordService associated to the specified collection.\n *\n * @param {string} idOrName\n * @return {RecordService}\n */\n collection(idOrName: string): RecordService {\n if (!this.recordServices[idOrName]) {\n this.recordServices[idOrName] = new RecordService(this, idOrName);\n }\n\n return this.recordServices[idOrName];\n }\n\n /**\n * Globally enable or disable auto cancellation for pending duplicated requests.\n */\n autoCancellation(enable: boolean): Client {\n this.enableAutoCancellation = !!enable;\n\n return this;\n }\n\n /**\n * Cancels single request by its cancellation key.\n */\n cancelRequest(cancelKey: string): Client {\n if (this.cancelControllers[cancelKey]) {\n this.cancelControllers[cancelKey].abort();\n delete this.cancelControllers[cancelKey];\n }\n\n return this;\n }\n\n /**\n * Cancels all pending requests.\n */\n cancelAllRequests(): Client {\n for (let k in this.cancelControllers) {\n this.cancelControllers[k].abort();\n }\n\n this.cancelControllers = {};\n\n return this;\n }\n\n /**\n * Sends an api http request.\n */\n async send(path: string, reqOptions: SendOptions): Promise {\n let options = Object.assign({ method: 'GET' } as SendOptions, reqOptions);\n\n // JSON serialize the body if needed and set the correct content type\n // (for FormData body the Content-Type header should be skipped since the boundary is autogenerated)\n if (!this.isFormData(options.body)) {\n if (options.body && typeof options.body !== 'string') {\n options.body = JSON.stringify(options.body);\n }\n\n // add the json header (if not already)\n if (typeof options?.headers?.['Content-Type'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof options?.headers?.['Accept-Language'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Accept-Language': this.lang,\n });\n }\n\n // check if Authorization header can be added\n if (\n // has stored token\n this.authStore?.token &&\n // auth header is not explicitly set\n (typeof options?.headers?.Authorization === 'undefined')\n ) {\n options.headers = Object.assign({}, options.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && options.params?.$autoCancel !== false) {\n const cancelKey = options.params?.$cancelKey || ((options.method || 'GET') + path);\n\n // cancel previous pending requests\n this.cancelRequest(cancelKey);\n\n const controller = new AbortController();\n this.cancelControllers[cancelKey] = controller;\n options.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete options.params?.$autoCancel;\n delete options.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof options.params !== 'undefined') {\n const query = this.serializeQueryParams(options.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete options.params;\n }\n\n if (this.beforeSend) {\n const result = Object.assign({}, await this.beforeSend(url, options));\n if (typeof result.url !== \"undefined\" || typeof result.options !== \"undefined\") {\n url = result.url || url;\n options = result.options || options;\n } else if (Object.keys(result).length) {\n // legacy behavior\n options = result as SendOptions;\n console?.warn && console.warn(\"Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`.\");\n }\n }\n\n // send the request\n return fetch(url, options)\n .then(async (response) => {\n let data : any = {};\n\n try {\n data = await response.json();\n } catch (_) {\n // all api responses are expected to return json\n // with the exception of the realtime event and 204\n }\n\n if (this.afterSend) {\n data = await this.afterSend(response, data);\n }\n\n if (response.status >= 400) {\n throw new ClientResponseError({\n url: response.url,\n status: response.status,\n data: data,\n });\n }\n\n return data as T;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Legacy alias of `pb.files.getUrl()`.\n */\n getFileUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n return this.files.getUrl(record, filename, queryParams);\n }\n\n /**\n * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl;\n\n // construct an absolute base url if in a browser environment\n if (\n typeof window !== 'undefined' &&\n !!window.location &&\n !url.startsWith('https://') &&\n !url.startsWith('http://')\n ) {\n url = window.location.origin?.endsWith('/') ?\n window.location.origin.substring(0, window.location.origin.length - 1) :\n (window.location.origin || '');\n\n if (!this.baseUrl.startsWith('/')) {\n url += window.location.pathname || '/';\n url += url.endsWith('/') ? '' : '/';\n }\n\n url += this.baseUrl;\n }\n\n // concatenate the path\n if (path) {\n url += url.endsWith('/') ? '' : '/'; // append trailing slash if missing\n url += path.startsWith('/') ? path.substring(1) : path;\n }\n\n return url;\n }\n\n /**\n * Loosely checks if the specified body is a FormData instance.\n */\n private isFormData(body: any): boolean {\n return body && (\n // we are checking the constructor name because FormData\n // is not available natively in some environments and the\n // polyfill(s) may not be globally accessible\n body.constructor.name === 'FormData' ||\n // fallback to global FormData instance check\n // note: this is needed because the constructor.name could be different in case of\n // custom global FormData implementation, eg. React Native on Android/iOS\n (typeof FormData !== \"undefined\" && body instanceof FormData)\n )\n }\n\n /**\n * Serializes the provided query parameters into a query string.\n */\n private serializeQueryParams(params: {[key: string]: any}): string {\n const result: Array = [];\n for (const key in params) {\n if (params[key] === null) {\n // skip null query params\n continue;\n }\n\n const value = params[key];\n const encodedKey = encodeURIComponent(key);\n\n if (Array.isArray(value)) {\n // \"repeat\" array params\n for (const v of value) {\n result.push(encodedKey + \"=\" + encodeURIComponent(v));\n }\n } else if (value instanceof Date) {\n result.push(encodedKey + \"=\" + encodeURIComponent(value.toISOString()));\n } else if (typeof value !== null && typeof value === 'object') {\n result.push(encodedKey + \"=\" + encodeURIComponent(JSON.stringify(value)));\n } else {\n result.push(encodedKey + \"=\" + encodeURIComponent(value));\n }\n }\n\n return result.join('&');\n }\n}\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__extends","TypeError","String","__","this","constructor","create","__assign","assign","t","s","i","n","arguments","length","apply","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","adopt","then","__generator","body","f","y","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","v","op","pop","push","atobPolyfill","ClientResponseError","_super","errData","_this","url","status","response","isAbort","originalError","data","DOMException","name","message","_a","_d","_c","_b","cause","includes","defineProperty","get","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","isDate","toString","Date","valueOf","toUTCString","httpOnly","secure","priority","toLowerCase","sameSite","defaultDecode","indexOf","decodeURIComponent","encodeURIComponent","getTokenPayload","token","encodedPayload","split","map","c","charCodeAt","slice","join","JSON","parse","isTokenExpired","expirationThreshold","payload","keys","exp","now","atob","input","str","replace","bs","buffer","bc","idx","output","charAt","fromCharCode","BaseModel","$load","load","_i","entries","key","id","created","updated","clone","$clone","structuredClone","stringify","export","$export","Record","collectionId","collectionName","_loadExpand","expand","isArray","Admin","avatar","email","defaultCookieKey","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","save","model","triggerChange","clear","loadFromCookie","cookie","rawData","cookieParse","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","exportToCookie","defaultOptions","resultLength","Blob","size","username","verified","onChange","callback","fireImmediately","splice","LocalAuthStore","storageKey","storageFallback","_storageGet","_storageSet","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","filesystem","testEmail","toEmail","emailTemplate","template","generateAppleClientSecret","clientId","teamId","keyId","privateKey","duration","ListResult","page","perPage","totalItems","totalPages","items","CrudService","getFullList","batchOrqueryParams","_getFullList","baseCrudPath","batch","getList","_getList","getFirstListItem","filter","_getFirstListItem","getOne","_getOne","_create","_update","delete","_delete","BaseCrudService","basePath","batchSize","request","list","castedList","concat","item","$cancelKey","code","AdminService","authStore","success","authResponse","admin","authWithPassword","password","identity","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","batchOrQueryParams","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2Code","codeVerifier","redirectUrl","createData","authWithOAuth2","args","config","authMethods","find","buildUrl","oldState","unsubscribe_1","state","query","authData","err_2","URL","authUrl","searchParams","set","scopes","urlCallback","_defaultUrlCallback","err_1","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","open","width","height","windowWidth","innerWidth","windowHeight","innerHeight","left","top","SchemaField","type","system","required","Collection","indexes","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","$isBase","$isAuth","$isView","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","eventSource","subscriptions","lastSentTopics","maxConnectTimeout","reconnectAttempts","maxReconnectAttempts","Infinity","predefinedReconnectIntervals","pendingConnects","listener","msgEvent","isConnected","connect","submitSubscriptions","addEventListener","unsubscribeByTopicAndListener","hasSubscriptionListeners","removeEventListener","disconnect","topicPrefix","hasAtleastOneTopic","startsWith","exist","topicToCheck","addAllSubscriptionListeners","getNonEmptySubscriptionTopics","getSubscriptionsCancelKey","catch","err","removeAllSubscriptionListeners","initConnect","clearTimeout","connectTimeoutId","setTimeout","connectErrorHandler","EventSource","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","timeout","fromReconnect","cancelRequest","close","HealthService","check","FileService","getUrl","filename","parts","URLSearchParams","getToken","BackupService","basename","restore","getDownloadUrl","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","files","logs","settings","health","backups","collection","idOrName","autoCancellation","enable","cancelKey","abort","cancelAllRequests","k","reqOptions","isFormData","headers","Authorization","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","serializeQueryParams","beforeSend","_k","_j","_l","_m","fetch","json","afterSend","getFileUrl","location","origin","endsWith","substring","pathname","FormData","encodedKey","value_1","toISOString"],"mappings":"AAgBA,IAAIA,cAAgB,SAASC,EAAGC,GAI5B,OAHAF,cAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,CAAE,GACzE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOC,OAAOK,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,KACzFP,cAAcC,EAAGC,EAC5B,EAEO,SAASS,UAAUV,EAAGC,GACzB,GAAiB,mBAANA,GAA0B,OAANA,EAC3B,MAAM,IAAIU,UAAU,uBAAyBC,OAAOX,GAAK,iCAE7D,SAASY,KAAOC,KAAKC,YAAcf,CAAI,CADvCD,cAAcC,EAAGC,GAEjBD,EAAEO,UAAkB,OAANN,EAAaC,OAAOc,OAAOf,IAAMY,GAAGN,UAAYN,EAAEM,UAAW,IAAIM,GACnF,CAEO,IAAII,SAAW,WAQlB,OAPAA,SAAWf,OAAOgB,QAAU,SAASD,SAASE,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAIf,KADTc,EAAIG,UAAUF,GACOnB,OAAOK,UAAUC,eAAeC,KAAKW,EAAGd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B,KAAK2a,EAAa,IAAMrX,mBAAmBjF,GAfrD,CAmBL,OAAOK,EAAOqF,KAAK,MAE1B4T,MAAD"} \ No newline at end of file diff --git a/dist/pocketbase.es.mjs b/dist/pocketbase.es.mjs index 04bf2d9..c3803ad 100644 --- a/dist/pocketbase.es.mjs +++ b/dist/pocketbase.es.mjs @@ -1,2 +1,2 @@ -var extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},extendStatics(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}var __assign=function(){return __assign=Object.assign||function __assign(e){for(var t,n=1,i=arguments.length;n0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0&&(!n.exp||n.exp-t>Date.now()/1e3))}e="function"==typeof atob?atob:function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,i,o=0,r=0,s="";i=t.charAt(r++);~i&&(n=o%4?64*n+i:i,o++%4)?s+=String.fromCharCode(255&n>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var i=function(){function BaseModel(e){void 0===e&&(e={}),this.$load(e||{})}return BaseModel.prototype.load=function(e){return this.$load(e)},BaseModel.prototype.$load=function(e){for(var t=0,n=Object.entries(e);t4096&&(u.model={id:null===(i=null==u?void 0:u.model)||void 0===i?void 0:i.id,email:null===(r=null==u?void 0:u.model)||void 0===r?void 0:r.email},this.model instanceof o&&(u.model.username=this.model.username,u.model.verified=this.model.verified,u.model.collectionId=this.model.collectionId),l=cookieSerialize(t,JSON.stringify(u),e)),l},BaseAuthStore.prototype.onChange=function(e,t){var n=this;return void 0===t&&(t=!1),this._onChangeCallbacks.push(e),t&&e(this.token,this.model),function(){for(var t=n._onChangeCallbacks.length-1;t>=0;t--)if(n._onChangeCallbacks[t]==e)return delete n._onChangeCallbacks[t],void n._onChangeCallbacks.splice(t,1)}},BaseAuthStore.prototype.triggerChange=function(){for(var e=0,t=this._onChangeCallbacks;e0?e:1,this.perPage=t>=0?t:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},h=function(e){function CrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(CrudService,e),CrudService.prototype.getFullList=function(e,t){if("number"==typeof e)return this._getFullList(this.baseCrudPath,e,t);var n=Object.assign({},e,t);return this._getFullList(this.baseCrudPath,n.batch||200,n)},CrudService.prototype.getList=function(e,t,n){return void 0===e&&(e=1),void 0===t&&(t=30),void 0===n&&(n={}),this._getList(this.baseCrudPath,e,t,n)},CrudService.prototype.getFirstListItem=function(e,t){return void 0===t&&(t={}),this._getFirstListItem(this.baseCrudPath,e,t)},CrudService.prototype.getOne=function(e,t){return void 0===t&&(t={}),this._getOne(this.baseCrudPath,e,t)},CrudService.prototype.create=function(e,t){return void 0===e&&(e={}),void 0===t&&(t={}),this._create(this.baseCrudPath,e,t)},CrudService.prototype.update=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),this._update(this.baseCrudPath,e,t,n)},CrudService.prototype.delete=function(e,t){return void 0===t&&(t={}),this._delete(this.baseCrudPath,e,t)},CrudService}(function(e){function BaseCrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(BaseCrudService,e),BaseCrudService.prototype._getFullList=function(e,t,n){var i=this;void 0===t&&(t=200),void 0===n&&(n={});var o=[],request=function(r){return __awaiter(i,void 0,void 0,(function(){return __generator(this,(function(i){return[2,this._getList(e,r,t||200,n).then((function(e){var t=e,n=t.items,i=t.totalItems;return o=o.concat(n),n.length&&i>o.length?request(r+1):o}))]}))}))};return request(1)},BaseCrudService.prototype._getList=function(e,t,n,i){var o=this;return void 0===t&&(t=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:t,perPage:n},i),this.client.send(e,{method:"GET",params:i}).then((function(e){var t=[];if(null==e?void 0:e.items){e.items=e.items||[];for(var n=0,i=e.items;n1||"string"==typeof(null==e?void 0:e[0])?(console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),[2,this.authWithOAuth2Code((null==e?void 0:e[0])||"",(null==e?void 0:e[1])||"",(null==e?void 0:e[2])||"",(null==e?void 0:e[3])||"",(null==e?void 0:e[4])||{},(null==e?void 0:e[5])||{},(null==e?void 0:e[6])||{})]):(n=(null==e?void 0:e[0])||{},[4,this.listAuthMethods()]);case 1:if(i=a.sent(),!(o=i.authProviders.find((function(e){return e.name===n.provider}))))throw new t(new Error('Missing or invalid provider "'.concat(n.provider,'".')));return r=this.client.buildUrl("/api/oauth2-redirect"),[2,new Promise((function(e,i){return __awaiter(s,void 0,void 0,(function(){var s,a,c,u,l=this;return __generator(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),[4,this.client.realtime.subscribe("@oauth2",(function(a){return __awaiter(l,void 0,void 0,(function(){var c,u,l;return __generator(this,(function(d){switch(d.label){case 0:c=this.client.realtime.clientId,d.label=1;case 1:if(d.trys.push([1,3,,4]),s(),!a.state||c!==a.state)throw new Error("State parameters don't match.");return[4,this.authWithOAuth2Code(o.name,a.code,o.codeVerifier,r,n.createData,n.body,n.query)];case 2:return u=d.sent(),e(u),[3,4];case 3:return l=d.sent(),i(new t(l)),[3,4];case 4:return[2]}}))}))}))];case 1:return s=d.sent(),(a=new URL(o.authUrl+r)).searchParams.set("state",this.client.realtime.clientId),(null===(u=n.scopes)||void 0===u?void 0:u.length)&&a.searchParams.set("scope",n.scopes.join(" ")),[4,n.urlCallback?n.urlCallback(a.toString()):this._defaultUrlCallback(a.toString())];case 2:return d.sent(),[3,4];case 3:return c=d.sent(),i(new t(c)),[3,4];case 4:return[2]}}))}))}))]}}))}))},RecordService.prototype.authRefresh=function(e,t){var n=this;return void 0===e&&(e={}),void 0===t&&(t={}),this.client.send(this.baseCollectionPath+"/auth-refresh",{method:"POST",params:t,body:e}).then((function(e){return n.authResponse(e)}))},RecordService.prototype.requestPasswordReset=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-password-reset",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmPasswordReset=function(e,t,n,i,o){return void 0===i&&(i={}),void 0===o&&(o={}),i=Object.assign({token:e,password:t,passwordConfirm:n},i),this.client.send(this.baseCollectionPath+"/confirm-password-reset",{method:"POST",params:o,body:i}).then((function(){return!0}))},RecordService.prototype.requestVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({token:e},t),this.client.send(this.baseCollectionPath+"/confirm-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.requestEmailChange=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({newEmail:e},t),this.client.send(this.baseCollectionPath+"/request-email-change",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmEmailChange=function(e,t,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),n=Object.assign({token:e,password:t},n),this.client.send(this.baseCollectionPath+"/confirm-email-change",{method:"POST",params:i,body:n}).then((function(){return!0}))},RecordService.prototype.listExternalAuths=function(e,t){return void 0===t&&(t={}),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths",{method:"GET",params:t}).then((function(e){var t=[];if(Array.isArray(e))for(var n=0,i=e;no?o:n)/2,a=r/2-(i=i>r?r:i)/2;window.open(e,"oauth2-popup","width="+n+",height="+i+",top="+a+",left="+s+",resizable,menubar=no")},RecordService}(h),m=function m(e){void 0===e&&(e={}),this.id=void 0!==e.id?e.id:"",this.name=void 0!==e.name?e.name:"",this.type=void 0!==e.type?e.type:"text",this.system=!!e.system,this.required=!!e.required,this.options="object"==typeof e.options&&null!==e.options?e.options:{}},b=function(e){function Collection(){return null!==e&&e.apply(this,arguments)||this}return __extends(Collection,e),Collection.prototype.$load=function(t){e.prototype.$load.call(this,t),this.system=!!t.system,this.name="string"==typeof t.name?t.name:"",this.type="string"==typeof t.type?t.type:"base",this.options=void 0!==t.options&&null!==t.options?t.options:{},this.indexes=Array.isArray(t.indexes)?t.indexes:[],this.listRule="string"==typeof t.listRule?t.listRule:null,this.viewRule="string"==typeof t.viewRule?t.viewRule:null,this.createRule="string"==typeof t.createRule?t.createRule:null,this.updateRule="string"==typeof t.updateRule?t.updateRule:null,this.deleteRule="string"==typeof t.deleteRule?t.deleteRule:null,t.schema=Array.isArray(t.schema)?t.schema:[],this.schema=[];for(var n=0,i=t.schema;n=0;o--)this.subscriptions[e][o]===t&&(i=!0,delete this.subscriptions[e][o],this.subscriptions[e].splice(o,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(e,t));return i?(this.subscriptions[e].length||delete this.subscriptions[e],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(e)?[3,3]:[4,this.submitSubscriptions()];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},RealtimeService.prototype.hasSubscriptionListeners=function(e){var t,n;if(this.subscriptions=this.subscriptions||{},e)return!!(null===(t=this.subscriptions[e])||void 0===t?void 0:t.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},RealtimeService.prototype.submitSubscriptions=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return this.clientId?(this.addAllSubscriptionListeners(),this.lastSentTopics=this.getNonEmptySubscriptionTopics(),[2,this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentTopics},params:{$cancelKey:"realtime_"+this.clientId}}).catch((function(e){if(!(null==e?void 0:e.isAbort))throw e}))]):[2]}))}))},RealtimeService.prototype.getNonEmptySubscriptionTopics=function(){var e=[];for(var t in this.subscriptions)this.subscriptions[t].length&&e.push(t);return e},RealtimeService.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var e in this.removeAllSubscriptionListeners(),this.subscriptions)for(var t=0,n=this.subscriptions[e];t0?[2]:[2,new Promise((function(t,n){e.pendingConnects.push({resolve:t,reject:n}),e.pendingConnects.length>1||e.initConnect()}))]}))}))},RealtimeService.prototype.initConnect=function(){var e=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){e.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(t){e.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(t){var n=t;e.clientId=null==n?void 0:n.lastEventId,e.submitSubscriptions().then((function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=3,t.label=1;case 1:return this.hasUnsentSubscriptions()&&e>0?(e--,[4,this.submitSubscriptions()]):[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var t=0,n=e.pendingConnects;tthis.maxReconnectAttempts){for(var i=0,o=this.pendingConnects;i=400)throw new t({url:e.url,status:e.status,data:n});return[2,n]}}))}))})).catch((function(e){throw new t(e)}))]}}))}))},Client.prototype.getFileUrl=function(e,t,n){return void 0===n&&(n={}),this.files.getUrl(e,t,n)},Client.prototype.buildUrl=function(e){var t,n=this.baseUrl;return"undefined"==typeof window||!window.location||n.startsWith("https://")||n.startsWith("http://")||(n=(null===(t=window.location.origin)||void 0===t?void 0:t.endsWith("/"))?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(n+=window.location.pathname||"/",n+=n.endsWith("/")?"":"/"),n+=this.baseUrl),e&&(n+=n.endsWith("/")?"":"/",n+=e.startsWith("/")?e.substring(1):e),n},Client.prototype.isFormData=function(e){return e&&("FormData"===e.constructor.name||"undefined"!=typeof FormData&&e instanceof FormData)},Client.prototype.serializeQueryParams=function(e){var t=[];for(var n in e)if(null!==e[n]){var i=e[n],o=encodeURIComponent(n);if(Array.isArray(i))for(var r=0,s=i;r0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0&&(!n.exp||n.exp-t>Date.now()/1e3))}e="function"==typeof atob?atob:function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,i,o=0,r=0,s="";i=t.charAt(r++);~i&&(n=o%4?64*n+i:i,o++%4)?s+=String.fromCharCode(255&n>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var i=function(){function BaseModel(e){void 0===e&&(e={}),this.$load(e||{})}return BaseModel.prototype.load=function(e){return this.$load(e)},BaseModel.prototype.$load=function(e){for(var t=0,n=Object.entries(e);t4096&&(u.model={id:null===(i=null==u?void 0:u.model)||void 0===i?void 0:i.id,email:null===(r=null==u?void 0:u.model)||void 0===r?void 0:r.email},this.model instanceof o&&(u.model.username=this.model.username,u.model.verified=this.model.verified,u.model.collectionId=this.model.collectionId),l=cookieSerialize(t,JSON.stringify(u),e)),l},BaseAuthStore.prototype.onChange=function(e,t){var n=this;return void 0===t&&(t=!1),this._onChangeCallbacks.push(e),t&&e(this.token,this.model),function(){for(var t=n._onChangeCallbacks.length-1;t>=0;t--)if(n._onChangeCallbacks[t]==e)return delete n._onChangeCallbacks[t],void n._onChangeCallbacks.splice(t,1)}},BaseAuthStore.prototype.triggerChange=function(){for(var e=0,t=this._onChangeCallbacks;e0?e:1,this.perPage=t>=0?t:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},h=function(e){function CrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(CrudService,e),CrudService.prototype.getFullList=function(e,t){if("number"==typeof e)return this._getFullList(this.baseCrudPath,e,t);var n=Object.assign({},e,t);return this._getFullList(this.baseCrudPath,n.batch||200,n)},CrudService.prototype.getList=function(e,t,n){return void 0===e&&(e=1),void 0===t&&(t=30),void 0===n&&(n={}),this._getList(this.baseCrudPath,e,t,n)},CrudService.prototype.getFirstListItem=function(e,t){return void 0===t&&(t={}),this._getFirstListItem(this.baseCrudPath,e,t)},CrudService.prototype.getOne=function(e,t){return void 0===t&&(t={}),this._getOne(this.baseCrudPath,e,t)},CrudService.prototype.create=function(e,t){return void 0===e&&(e={}),void 0===t&&(t={}),this._create(this.baseCrudPath,e,t)},CrudService.prototype.update=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),this._update(this.baseCrudPath,e,t,n)},CrudService.prototype.delete=function(e,t){return void 0===t&&(t={}),this._delete(this.baseCrudPath,e,t)},CrudService}(function(e){function BaseCrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(BaseCrudService,e),BaseCrudService.prototype._getFullList=function(e,t,n){var i=this;void 0===t&&(t=200),void 0===n&&(n={});var o=[],request=function(r){return __awaiter(i,void 0,void 0,(function(){return __generator(this,(function(i){return[2,this._getList(e,r,t||200,n).then((function(e){var t=e,n=t.items,i=t.totalItems;return o=o.concat(n),n.length&&i>o.length?request(r+1):o}))]}))}))};return request(1)},BaseCrudService.prototype._getList=function(e,t,n,i){var o=this;return void 0===t&&(t=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:t,perPage:n},i),this.client.send(e,{method:"GET",params:i}).then((function(e){var t=[];if(null==e?void 0:e.items){e.items=e.items||[];for(var n=0,i=e.items;n1||"string"==typeof(null==e?void 0:e[0])?(console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),[2,this.authWithOAuth2Code((null==e?void 0:e[0])||"",(null==e?void 0:e[1])||"",(null==e?void 0:e[2])||"",(null==e?void 0:e[3])||"",(null==e?void 0:e[4])||{},(null==e?void 0:e[5])||{},(null==e?void 0:e[6])||{})]):(n=(null==e?void 0:e[0])||{},[4,this.listAuthMethods()]);case 1:if(i=a.sent(),!(o=i.authProviders.find((function(e){return e.name===n.provider}))))throw new t(new Error('Missing or invalid provider "'.concat(n.provider,'".')));return r=this.client.buildUrl("/api/oauth2-redirect"),[2,new Promise((function(e,i){return __awaiter(s,void 0,void 0,(function(){var s,a,c,u,l=this;return __generator(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),[4,this.client.realtime.subscribe("@oauth2",(function(a){return __awaiter(l,void 0,void 0,(function(){var c,u,l;return __generator(this,(function(d){switch(d.label){case 0:c=this.client.realtime.clientId,d.label=1;case 1:if(d.trys.push([1,3,,4]),s(),!a.state||c!==a.state)throw new Error("State parameters don't match.");return[4,this.authWithOAuth2Code(o.name,a.code,o.codeVerifier,r,n.createData,n.body,n.query)];case 2:return u=d.sent(),e(u),[3,4];case 3:return l=d.sent(),i(new t(l)),[3,4];case 4:return[2]}}))}))}))];case 1:return s=d.sent(),(a=new URL(o.authUrl+r)).searchParams.set("state",this.client.realtime.clientId),(null===(u=n.scopes)||void 0===u?void 0:u.length)&&a.searchParams.set("scope",n.scopes.join(" ")),[4,n.urlCallback?n.urlCallback(a.toString()):this._defaultUrlCallback(a.toString())];case 2:return d.sent(),[3,4];case 3:return c=d.sent(),i(new t(c)),[3,4];case 4:return[2]}}))}))}))]}}))}))},RecordService.prototype.authRefresh=function(e,t){var n=this;return void 0===e&&(e={}),void 0===t&&(t={}),this.client.send(this.baseCollectionPath+"/auth-refresh",{method:"POST",params:t,body:e}).then((function(e){return n.authResponse(e)}))},RecordService.prototype.requestPasswordReset=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-password-reset",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmPasswordReset=function(e,t,n,i,o){return void 0===i&&(i={}),void 0===o&&(o={}),i=Object.assign({token:e,password:t,passwordConfirm:n},i),this.client.send(this.baseCollectionPath+"/confirm-password-reset",{method:"POST",params:o,body:i}).then((function(){return!0}))},RecordService.prototype.requestVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({token:e},t),this.client.send(this.baseCollectionPath+"/confirm-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.requestEmailChange=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({newEmail:e},t),this.client.send(this.baseCollectionPath+"/request-email-change",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmEmailChange=function(e,t,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),n=Object.assign({token:e,password:t},n),this.client.send(this.baseCollectionPath+"/confirm-email-change",{method:"POST",params:i,body:n}).then((function(){return!0}))},RecordService.prototype.listExternalAuths=function(e,t){return void 0===t&&(t={}),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths",{method:"GET",params:t}).then((function(e){var t=[];if(Array.isArray(e))for(var n=0,i=e;no?o:n)/2,a=r/2-(i=i>r?r:i)/2;window.open(e,"oauth2-popup","width="+n+",height="+i+",top="+a+",left="+s+",resizable,menubar=no")},RecordService}(h),m=function m(e){void 0===e&&(e={}),this.id=void 0!==e.id?e.id:"",this.name=void 0!==e.name?e.name:"",this.type=void 0!==e.type?e.type:"text",this.system=!!e.system,this.required=!!e.required,this.options="object"==typeof e.options&&null!==e.options?e.options:{}},b=function(e){function Collection(){return null!==e&&e.apply(this,arguments)||this}return __extends(Collection,e),Collection.prototype.$load=function(t){e.prototype.$load.call(this,t),this.system=!!t.system,this.name="string"==typeof t.name?t.name:"",this.type="string"==typeof t.type?t.type:"base",this.options=void 0!==t.options&&null!==t.options?t.options:{},this.indexes=Array.isArray(t.indexes)?t.indexes:[],this.listRule="string"==typeof t.listRule?t.listRule:null,this.viewRule="string"==typeof t.viewRule?t.viewRule:null,this.createRule="string"==typeof t.createRule?t.createRule:null,this.updateRule="string"==typeof t.updateRule?t.updateRule:null,this.deleteRule="string"==typeof t.deleteRule?t.deleteRule:null,t.schema=Array.isArray(t.schema)?t.schema:[],this.schema=[];for(var n=0,i=t.schema;n=0;o--)this.subscriptions[e][o]===t&&(i=!0,delete this.subscriptions[e][o],this.subscriptions[e].splice(o,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(e,t));return i?(this.subscriptions[e].length||delete this.subscriptions[e],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(e)?[3,3]:[4,this.submitSubscriptions()];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},RealtimeService.prototype.hasSubscriptionListeners=function(e){var t,n;if(this.subscriptions=this.subscriptions||{},e)return!!(null===(t=this.subscriptions[e])||void 0===t?void 0:t.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},RealtimeService.prototype.submitSubscriptions=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return this.clientId?(this.addAllSubscriptionListeners(),this.lastSentTopics=this.getNonEmptySubscriptionTopics(),[2,this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentTopics},params:{$cancelKey:this.getSubscriptionsCancelKey()}}).catch((function(e){if(!(null==e?void 0:e.isAbort))throw e}))]):[2]}))}))},RealtimeService.prototype.getSubscriptionsCancelKey=function(){return"realtime_"+this.clientId},RealtimeService.prototype.getNonEmptySubscriptionTopics=function(){var e=[];for(var t in this.subscriptions)this.subscriptions[t].length&&e.push(t);return e},RealtimeService.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var e in this.removeAllSubscriptionListeners(),this.subscriptions)for(var t=0,n=this.subscriptions[e];t0?[2]:[2,new Promise((function(t,n){e.pendingConnects.push({resolve:t,reject:n}),e.pendingConnects.length>1||e.initConnect()}))]}))}))},RealtimeService.prototype.initConnect=function(){var e=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){e.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(t){e.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(t){var n=t;e.clientId=null==n?void 0:n.lastEventId,e.submitSubscriptions().then((function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=3,t.label=1;case 1:return this.hasUnsentSubscriptions()&&e>0?(e--,[4,this.submitSubscriptions()]):[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var t=0,n=e.pendingConnects;tthis.maxReconnectAttempts){for(var i=0,o=this.pendingConnects;i=400)throw new t({url:e.url,status:e.status,data:n});return[2,n]}}))}))})).catch((function(e){throw new t(e)}))]}}))}))},Client.prototype.getFileUrl=function(e,t,n){return void 0===n&&(n={}),this.files.getUrl(e,t,n)},Client.prototype.buildUrl=function(e){var t,n=this.baseUrl;return"undefined"==typeof window||!window.location||n.startsWith("https://")||n.startsWith("http://")||(n=(null===(t=window.location.origin)||void 0===t?void 0:t.endsWith("/"))?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(n+=window.location.pathname||"/",n+=n.endsWith("/")?"":"/"),n+=this.baseUrl),e&&(n+=n.endsWith("/")?"":"/",n+=e.startsWith("/")?e.substring(1):e),n},Client.prototype.isFormData=function(e){return e&&("FormData"===e.constructor.name||"undefined"!=typeof FormData&&e instanceof FormData)},Client.prototype.serializeQueryParams=function(e){var t=[];for(var n in e)if(null!==e[n]){var i=e[n],o=encodeURIComponent(n);if(Array.isArray(i))for(var r=0,s=i;r= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","/**\n * ClientResponseError is a custom Error class that is intended to wrap\n * and normalize any error thrown by `Client.send()`.\n */\nexport default class ClientResponseError extends Error {\n url: string = '';\n status: number = 0;\n response: {[key: string]: any} = {};\n isAbort: boolean = false;\n originalError: any = null;\n\n constructor(errData?: any) {\n super(\"ClientResponseError\");\n\n // Set the prototype explicitly.\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, ClientResponseError.prototype);\n\n if (!(errData instanceof ClientResponseError)) {\n this.originalError = errData;\n }\n\n if (errData !== null && typeof errData === 'object') {\n this.url = typeof errData.url === 'string' ? errData.url : '';\n this.status = typeof errData.status === 'number' ? errData.status : 0;\n this.response = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\n this.isAbort = !!errData.isAbort;\n }\n\n if (typeof DOMException !== 'undefined' && errData instanceof DOMException) {\n this.isAbort = true;\n }\n\n this.name = \"ClientResponseError \" + this.status;\n this.message = this.response?.message;\n if (!this.message) {\n if (this.isAbort) {\n this.message = 'The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.';\n } else if (this.originalError?.cause?.message?.includes(\"ECONNREFUSED ::1\")) {\n this.message = 'Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).';\n } else {\n this.message = 'Something went wrong while processing your request.';\n }\n }\n }\n\n /**\n * Alias for `this.response` to preserve the backward compatibility.\n */\n get data() {\n return this.response;\n }\n\n /**\n * Make a POJO's copy of the current error class instance.\n * @see https://github.com/vuex-orm/vuex-orm/issues/255\n */\n toJSON() {\n return { ...this };\n }\n}\n","let atobPolyfill: Function;\nif (typeof atob === 'function') {\n atobPolyfill = atob\n} else {\n /**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n atobPolyfill = (input: any) => {\n const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n let str = String(input).replace(/=+$/, \"\");\n if (str.length % 4 == 1) {\n throw new Error(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = \"\";\n // get next character\n (buffer = str.charAt(idx++));\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? (bs as any) * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ?\n (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) :\n 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n\n return output;\n };\n}\n\n/**\n * Returns JWT token's payload data.\n */\nexport function getTokenPayload(token: string): { [key: string]: any } {\n if (token) {\n try {\n const encodedPayload = decodeURIComponent(atobPolyfill(token.split('.')[1]).split('').map(function (c: string) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n\n return JSON.parse(encodedPayload) || {};\n } catch (e) {\n }\n }\n\n return {};\n}\n\n/**\n * Checks whether a JWT token is expired or not.\n * Tokens without `exp` payload key are considered valid.\n * Tokens with empty payload (eg. invalid token strings) are considered expired.\n *\n * @param token The token to check.\n * @param [expirationThreshold] Time in seconds that will be subtracted from the token `exp` property.\n */\nexport function isTokenExpired(token: string, expirationThreshold = 0): boolean {\n let payload = getTokenPayload(token);\n\n if (\n Object.keys(payload).length > 0 &&\n (!payload.exp || (payload.exp - expirationThreshold) > (Date.now() / 1000))\n ) {\n return false;\n }\n\n return true;\n}\n","/**\n * -------------------------------------------------------------------\n * Simple cookie parse and serialize utilities mostly based on the\n * node module https://github.com/jshttp/cookie.\n * -------------------------------------------------------------------\n */\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\nexport interface ParseOptions{\n decode?: (val: string) => string,\n}\n\n/**\n* Parses the given cookie header string into an object\n* The object has the various cookies as keys(names) => values\n*/\nexport function cookieParse(str: string, options?: ParseOptions): { [key: string]: any } {\n const result: { [key: string]: any } = {};\n\n if (typeof str !== 'string') {\n return result;\n }\n\n const opt = Object.assign({}, options || {});\n const decode = opt.decode || defaultDecode;\n\n let index = 0;\n while (index < str.length) {\n const eqIdx = str.indexOf('=', index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = str.indexOf(';', index);\n\n if (endIdx === -1) {\n endIdx = str.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1;\n continue;\n }\n\n const key = str.slice(index, eqIdx).trim();\n\n // only assign once\n if (undefined === result[key]) {\n let val = str.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n result[key] = decode(val);\n } catch (_) {\n result[key] = val; // no decoding\n }\n }\n\n index = endIdx + 1;\n }\n\n return result;\n};\n\nexport interface SerializeOptions{\n encode?: (val: string | number | boolean) => string,\n maxAge?: number,\n domain?: string,\n path?: string,\n expires?: Date,\n httpOnly?: boolean,\n secure?: boolean,\n priority?: string,\n sameSite?: boolean|string,\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * ```js\n * cookieSerialize('foo', 'bar', { httpOnly: true }) // \"foo=bar; httpOnly\"\n * ```\n */\nexport function cookieSerialize(name: string, val: string, options?: SerializeOptions): string {\n const opt = Object.assign({}, options || {});\n const encode = opt.encode || defaultEncode;\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n const value = encode(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n let result = name + '=' + value;\n\n if (opt.maxAge != null) {\n const maxAge = opt.maxAge - 0;\n\n if (isNaN(maxAge) || !isFinite(maxAge)) {\n throw new TypeError('option maxAge is invalid');\n }\n\n result += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n result += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n result += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (!isDate(opt.expires) || isNaN(opt.expires.valueOf())) {\n throw new TypeError('option expires is invalid');\n }\n\n result += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n result += '; HttpOnly';\n }\n\n if (opt.secure) {\n result += '; Secure';\n }\n\n if (opt.priority) {\n const priority = typeof opt.priority === 'string' ? opt.priority.toLowerCase() : opt.priority;\n\n switch (priority) {\n case 'low':\n result += '; Priority=Low';\n break;\n case 'medium':\n result += '; Priority=Medium';\n break;\n case 'high':\n result += '; Priority=High';\n break;\n default:\n throw new TypeError('option priority is invalid');\n }\n }\n\n if (opt.sameSite) {\n const sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n result += '; SameSite=Strict';\n break;\n case 'lax':\n result += '; SameSite=Lax';\n break;\n case 'strict':\n result += '; SameSite=Strict';\n break;\n case 'none':\n result += '; SameSite=None';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return result;\n};\n\n/**\n * Default URL-decode string value function.\n * Optimized to skip native call when no `%`.\n */\nfunction defaultDecode(val: string): string {\n return val.indexOf('%') !== -1\n ? decodeURIComponent(val)\n : val;\n}\n\n/**\n * Default URL-encode value function.\n */\nfunction defaultEncode(val: string | number | boolean): string {\n return encodeURIComponent(val);\n}\n\n/**\n * Determines if value is a Date.\n */\nfunction isDate(val: any): boolean {\n return (\n Object.prototype.toString.call(val) === '[object Date]' ||\n val instanceof Date\n );\n}\n","export default abstract class BaseModel {\n [key: string]: any,\n\n id!: string;\n created!: string;\n updated!: string;\n\n constructor(data: { [key: string]: any } = {}) {\n this.$load(data || {});\n }\n\n /**\n * Alias of this.$load(data).\n */\n load(data: { [key: string]: any }) {\n return this.$load(data);\n }\n\n /**\n * Loads `data` into the current model.\n */\n $load(data: { [key: string]: any }) {\n for (const [key, value] of Object.entries(data)) {\n this[key] = value;\n }\n\n // normalize known fields\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.created = typeof data.created !== 'undefined' ? data.created : '';\n this.updated = typeof data.updated !== 'undefined' ? data.updated : '';\n }\n\n /**\n * Returns whether the current loaded data represent a stored db record.\n */\n get $isNew(): boolean {\n return !this.id;\n }\n\n /**\n * Alias of this.clone().\n */\n clone(): BaseModel {\n return this.$clone();\n }\n\n /**\n * Creates a deep clone of the current model.\n */\n $clone(): BaseModel {\n const clone = typeof structuredClone === 'function' ?\n structuredClone(this) : JSON.parse(JSON.stringify(this));\n\n return new (this.constructor as any)(clone);\n }\n\n /**\n * Alias of this.$export().\n */\n export(): { [key: string]: any } {\n return this.$export();\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n $export(): { [key: string]: any } {\n return typeof structuredClone === 'function' ?\n structuredClone(this) : Object.assign({}, this);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Record extends BaseModel {\n collectionId!: string;\n collectionName!: string;\n expand!: {[key: string]: Record|Array};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // normalize common fields\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.collectionName = typeof data.collectionName === 'string' ? data.collectionName : '';\n\n // normalize expand items\n this._loadExpand(data.expand);\n }\n\n /**\n * Loads the provided expand items and recursively normalizes each\n * item to a `Record|Array`.\n */\n private _loadExpand(expand: { [key: string]: any }) {\n expand = expand || {};\n this.expand = {};\n\n for (const key in expand) {\n if (Array.isArray(expand[key])) {\n this.expand[key] = expand[key].map((data: any) => new Record(data || {}));\n } else {\n this.expand[key] = new Record(expand[key] || {});\n }\n }\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Admin extends BaseModel {\n avatar!: number;\n email!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.avatar = typeof data.avatar === 'number' ? data.avatar : 0;\n this.email = typeof data.email === 'string' ? data.email : '';\n }\n}\n","import { cookieParse, cookieSerialize, SerializeOptions } from '@/stores/utils/cookie';\nimport { isTokenExpired, getTokenPayload } from '@/stores/utils/jwt';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\nexport type OnStoreChangeFunc = (token: string, model: Record|Admin|null) => void;\n\nconst defaultCookieKey = 'pb_auth';\n\n/**\n * Base AuthStore class that is intended to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore {\n protected baseToken: string = '';\n protected baseModel: Record|Admin|null = null;\n\n private _onChangeCallbacks: Array = [];\n\n /**\n * Retrieves the stored token (if any).\n */\n get token(): string {\n return this.baseToken;\n }\n\n /**\n * Retrieves the stored model data (if any).\n */\n get model(): Record|Admin|null {\n return this.baseModel;\n }\n\n /**\n * Loosely checks if the store has valid token (aka. existing and unexpired exp claim).\n */\n get isValid(): boolean {\n return !isTokenExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: Record|Admin|null): void {\n this.baseToken = token || '';\n\n // normalize the model instance\n if (model !== null && typeof model === 'object') {\n this.baseModel = typeof (model as any).collectionId !== 'undefined' ?\n new Record(model) : new Admin(model);\n } else {\n this.baseModel = null;\n }\n\n this.triggerChange();\n }\n\n /**\n * Removes the stored token and model data form the auth store.\n */\n clear(): void {\n this.baseToken = '';\n this.baseModel = null;\n this.triggerChange();\n }\n\n /**\n * Parses the provided cookie string and updates the store state\n * with the cookie's token and model data.\n *\n * NB! This function doesn't validate the token or its data.\n * Usually this isn't a concern if you are interacting only with the\n * PocketBase API because it has the proper server-side security checks in place,\n * but if you are using the store `isValid` state for permission controls\n * in a node server (eg. SSR), then it is recommended to call `authRefresh()`\n * after loading the cookie to ensure an up-to-date token and model state.\n * For example:\n *\n * ```js\n * pb.authStore.loadFromCookie(\"cookie string...\");\n *\n * try {\n * // get an up-to-date auth store state by veryfing and refreshing the loaded auth model (if any)\n * pb.authStore.isValid && await pb.collection('users').authRefresh();\n * } catch (_) {\n * // clear the auth store on failed refresh\n * pb.authStore.clear();\n * }\n * ```\n */\n loadFromCookie(cookie: string, key = defaultCookieKey): void {\n const rawData = cookieParse(cookie || '')[key] || '';\n\n let data: { [key: string]: any } = {};\n try {\n data = JSON.parse(rawData);\n // normalize\n if (typeof data === null || typeof data !== 'object' || Array.isArray(data)) {\n data = {};\n }\n } catch (_) {}\n\n this.save(data.token || '', data.model || null);\n }\n\n /**\n * Exports the current store state as cookie string.\n *\n * By default the following optional attributes are added:\n * - Secure\n * - HttpOnly\n * - SameSite=Strict\n * - Path=/\n * - Expires={the token expiration date}\n *\n * NB! If the generated cookie exceeds 4096 bytes, this method will\n * strip the model data to the bare minimum to try to fit within the\n * recommended size in https://www.rfc-editor.org/rfc/rfc6265#section-6.1.\n */\n exportToCookie(options?: SerializeOptions, key = defaultCookieKey): string {\n const defaultOptions: SerializeOptions = {\n secure: true,\n sameSite: true,\n httpOnly: true,\n path: \"/\",\n };\n\n // extract the token expiration date\n const payload = getTokenPayload(this.token);\n if (payload?.exp) {\n defaultOptions.expires = new Date(payload.exp * 1000);\n } else {\n defaultOptions.expires = new Date('1970-01-01');\n }\n\n // merge with the user defined options\n options = Object.assign({}, defaultOptions, options);\n\n const rawData = {\n token: this.token,\n model: this.model?.export() || null,\n };\n\n let result = cookieSerialize(key, JSON.stringify(rawData), options);\n\n const resultLength = typeof Blob !== 'undefined' ?\n (new Blob([result])).size : result.length;\n\n // strip down the model data to the bare minimum\n if (rawData.model && resultLength > 4096) {\n rawData.model = {id: rawData?.model?.id, email: rawData?.model?.email};\n if (this.model instanceof Record) {\n rawData.model.username = this.model.username;\n rawData.model.verified = this.model.verified;\n rawData.model.collectionId = this.model.collectionId;\n }\n result = cookieSerialize(key, JSON.stringify(rawData), options);\n }\n\n return result;\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * You can set the `fireImmediately` argument to true in order to invoke\n * the provided callback right after registration.\n *\n * Returns a removal function that you could call to \"unsubscribe\" from the changes.\n */\n onChange(callback: OnStoreChangeFunc, fireImmediately = false): () => void {\n this._onChangeCallbacks.push(callback);\n\n if (fireImmediately) {\n callback(this.token, this.model);\n }\n\n return () => {\n for (let i = this._onChangeCallbacks.length - 1; i >= 0; i--) {\n if (this._onChangeCallbacks[i] == callback) {\n delete this._onChangeCallbacks[i]; // removes the function reference\n this._onChangeCallbacks.splice(i, 1); // reindex the array\n return;\n }\n }\n }\n }\n\n protected triggerChange(): void {\n for (const callback of this._onChangeCallbacks) {\n callback && callback(this.token, this.model);\n }\n }\n}\n","import BaseAuthStore from '@/stores/BaseAuthStore';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\n/**\n * The default token store for browsers with auto fallback\n * to runtime/memory if local storage is undefined (eg. in node env).\n */\nexport default class LocalAuthStore extends BaseAuthStore {\n private storageFallback: { [key: string]: any } = {};\n private storageKey: string\n\n constructor(storageKey = \"pocketbase_auth\") {\n super();\n\n this.storageKey = storageKey;\n }\n\n /**\n * @inheritdoc\n */\n get token(): string {\n const data = this._storageGet(this.storageKey) || {};\n\n return data.token || '';\n }\n\n /**\n * @inheritdoc\n */\n get model(): Record|Admin|null {\n const data = this._storageGet(this.storageKey) || {};\n\n if (\n data === null ||\n typeof data !== 'object' ||\n data.model === null ||\n typeof data.model !== 'object'\n ) {\n return null;\n }\n\n // admins don't have `collectionId` prop\n if (typeof data.model?.collectionId === 'undefined') {\n return new Admin(data.model);\n }\n\n return new Record(data.model);\n }\n\n /**\n * @inheritdoc\n */\n save(token: string, model: Record|Admin|null) {\n this._storageSet(this.storageKey, {\n 'token': token,\n 'model': model,\n });\n\n super.save(token, model);\n }\n\n /**\n * @inheritdoc\n */\n clear() {\n this._storageRemove(this.storageKey);\n\n super.clear();\n }\n\n // ---------------------------------------------------------------\n // Internal helpers:\n // ---------------------------------------------------------------\n\n /**\n * Retrieves `key` from the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageGet(key: string): any {\n if (typeof window !== 'undefined' && window?.localStorage) {\n const rawValue = window.localStorage.getItem(key) || '';\n try {\n return JSON.parse(rawValue);\n } catch (e) { // not a json\n return rawValue;\n }\n }\n\n // fallback\n return this.storageFallback[key];\n }\n\n /**\n * Stores a new data in the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageSet(key: string, value: any) {\n if (typeof window !== 'undefined' && window?.localStorage) {\n // store in local storage\n let normalizedVal = value;\n if (typeof value !== 'string') {\n normalizedVal = JSON.stringify(value);\n }\n window.localStorage.setItem(key, normalizedVal);\n } else {\n // store in fallback\n this.storageFallback[key] = value;\n }\n }\n\n /**\n * Removes `key` from the browser's local storage and the runtime/memory.\n */\n private _storageRemove(key: string) {\n // delete from local storage\n if (typeof window !== 'undefined' && window?.localStorage) {\n window.localStorage?.removeItem(key);\n }\n\n // delete from fallback\n delete this.storageFallback[key];\n }\n}\n","import Client from '@/Client';\n\n/**\n * BaseService class that should be inherited from all API services.\n */\nexport default abstract class BaseService {\n readonly client: Client\n\n constructor(client: Client) {\n this.client = client;\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\ninterface appleClientSecret {\n secret: string;\n}\n\nexport default class SettingsService extends BaseService {\n /**\n * Fetch all available app settings.\n */\n getAll(queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Bulk updates app settings.\n */\n update(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Performs a S3 filesystem connection test.\n *\n * The currently supported `filesystem` are \"storage\" and \"backups\".\n */\n testS3(filesystem: string = \"storage\", queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'filesystem': filesystem,\n };\n\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends a test email.\n *\n * The possible `emailTemplate` values are:\n * - verification\n * - password-reset\n * - email-change\n */\n testEmail(toEmail: string, emailTemplate: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'email': toEmail,\n 'template': emailTemplate,\n };\n\n return this.client.send('/api/settings/test/email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Generates a new Apple OAuth2 client secret.\n */\n generateAppleClientSecret(\n clientId: string,\n teamId: string,\n keyId: string,\n privateKey: string,\n duration: number,\n bodyParams = {},\n queryParams: BaseQueryParams = {}\n ): Promise {\n bodyParams = Object.assign({\n clientId,\n teamId,\n keyId,\n privateKey,\n duration,\n }, bodyParams);\n\n return this.client.send('/api/settings/apple/generate-client-secret', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n });\n }\n}\n","import BaseModel from './BaseModel';\n\nexport default class ListResult {\n page!: number;\n perPage!: number;\n totalItems!: number;\n totalPages!: number;\n items!: Array;\n\n constructor(\n page: number,\n perPage: number,\n totalItems: number,\n totalPages: number,\n items: Array,\n ) {\n this.page = page > 0 ? page : 1;\n this.perPage = perPage >= 0 ? perPage : 0;\n this.totalItems = totalItems >= 0 ? totalItems : 0;\n this.totalPages = totalPages >= 0 ? totalPages : 0;\n this.items = items || [];\n }\n}\n","import ListResult from '@/models/utils/ListResult';\nimport BaseModel from '@/models/utils/BaseModel';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n FullListQueryParams\n} from '@/services/utils/QueryParams';\n\nexport default abstract class CrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/admins').\n */\n abstract get baseCrudPath(): string\n\n /**\n * Returns a promise with all list items batch fetched at once\n * (by default 200 items per request; to change it set the `batch` query param).\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(queryParams?: FullListQueryParams): Promise>\n\n /**\n * Legacy version of getFullList with explicitly specified batch size.\n */\n getFullList(batch?: number, queryParams?: ListQueryParams): Promise>\n\n getFullList(batchOrqueryParams?: number|FullListQueryParams, queryParams?: ListQueryParams): Promise> {\n if (typeof batchOrqueryParams == \"number\") {\n return this._getFullList(this.baseCrudPath, batchOrqueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrqueryParams, queryParams);\n\n return this._getFullList(this.baseCrudPath, params.batch || 200, params);\n }\n\n /**\n * Returns paginated items list.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n return this._getList(this.baseCrudPath, page, perPage, queryParams);\n }\n\n /**\n * Returns the first found item by the specified filter.\n *\n * Internally it calls `getList(1, 1, { filter })` and returns the\n * first found item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n *\n * For consistency with `getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n getFirstListItem(filter: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getFirstListItem(this.baseCrudPath, filter, queryParams);\n }\n\n /**\n * Returns single item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getOne(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getOne(this.baseCrudPath, id, queryParams);\n }\n\n /**\n * Creates a new item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n create(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._create(this.baseCrudPath, bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._update(this.baseCrudPath, id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._delete(this.baseCrudPath, id, queryParams);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\nimport {\n BaseQueryParams,\n ListQueryParams\n} from '@/services/utils/QueryParams';\n\n// @todo since there is no longer need of SubCrudService consider merging with CrudService in v0.9+\nexport default abstract class BaseCrudService extends BaseService {\n /**\n * Response data decoder.\n */\n abstract decode(data: { [key: string]: any }): M\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n protected _getFullList(basePath: string, batchSize = 200, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize || 200, queryParams).then((list) => {\n const castedList = (list as any as ListResult);\n const items = castedList.items;\n const totalItems = castedList.totalItems;\n\n result = result.concat(items);\n\n if (items.length && totalItems > result.length) {\n return request(page + 1);\n }\n\n return result;\n });\n }\n\n return request(1);\n }\n\n /**\n * Returns paginated items list.\n */\n protected _getList(basePath: string, page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send(basePath, {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData.items || [];\n for (const item of responseData.items) {\n items.push(this.decode(item) as any as T);\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns single item by its id.\n */\n protected _getOne(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Returns the first found item by a list filter.\n *\n * Internally it calls `_getList(basePath, 1, 1, { filter })` and returns its\n * first item.\n *\n * For consistency with `_getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n protected _getFirstListItem(basePath: string, filter: string, queryParams: BaseQueryParams = {}): Promise {\n queryParams = Object.assign({\n 'filter': filter,\n '$cancelKey': 'one_by_filter_' + basePath + \"_\" + filter,\n }, queryParams);\n\n return this._getList(basePath, 1, 1, queryParams)\n .then((result) => {\n if (!result?.items?.length) {\n throw new ClientResponseError({\n status: 404,\n data: {\n code: 404,\n message: \"The requested resource wasn't found.\",\n data: {},\n },\n });\n }\n\n return result.items[0];\n });\n }\n\n /**\n * Creates a new item.\n */\n protected _create(basePath: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath, {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Updates an existing item by its id.\n */\n protected _update(basePath: string, id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n protected _delete(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n}\n","import Admin from '@/models/Admin';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface AdminAuthResponse {\n [key: string]: any;\n\n token: string;\n admin: Admin;\n}\n\nexport default class AdminService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Admin {\n return new Admin(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/admins';\n }\n\n // ---------------------------------------------------------------\n // Post update/delete AuthStore sync\n // ---------------------------------------------------------------\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n // update the store state if the updated item id matches with the stored model\n if (\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === item?.id\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n // clear the store state if the deleted item id matches with the stored model\n if (\n success &&\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === id\n ) {\n this.client.authStore.clear();\n }\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful authorize response.\n */\n protected authResponse(responseData: any): AdminAuthResponse {\n const admin = this.decode(responseData?.admin || {});\n\n if (responseData?.token && responseData?.admin) {\n this.client.authStore.save(responseData.token, admin);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'admin': admin,\n });\n }\n\n /**\n * Authenticate an admin account with its email and password\n * and returns a new admin token and data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authWithPassword(\n email: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'identity': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Refreshes the current admin authenticated instance and\n * returns a new token and admin data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authRefresh(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCrudPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends admin password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms admin password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class ExternalAuth extends BaseModel {\n recordId!: string;\n collectionId!: string;\n provider!: string;\n providerId!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.recordId = typeof data.recordId === 'string' ? data.recordId : '';\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.provider = typeof data.provider === 'string' ? data.provider : '';\n this.providerId = typeof data.providerId === 'string' ? data.providerId : '';\n }\n}\n","import Client from '@/Client';\nimport ClientResponseError from '@/ClientResponseError';\nimport Record from '@/models/Record';\nimport ExternalAuth from '@/models/ExternalAuth';\nimport ListResult from '@/models/utils/ListResult';\nimport CrudService from '@/services/utils/CrudService';\nimport { UnsubscribeFunc } from '@/services/RealtimeService';\nimport {\n BaseQueryParams,\n RecordQueryParams,\n RecordListQueryParams,\n RecordFullListQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface RecordAuthResponse {\n record: T;\n token: string;\n meta?: {[key: string]: any};\n}\n\nexport interface AuthProviderInfo {\n name: string;\n state: string;\n codeVerifier: string;\n codeChallenge: string;\n codeChallengeMethod: string;\n authUrl: string;\n}\n\nexport interface AuthMethodsList {\n usernamePassword: boolean;\n emailPassword: boolean;\n authProviders: Array;\n}\n\nexport interface RecordSubscription {\n action: string; // eg. create, update, delete\n record: T;\n}\n\nexport type OAuth2UrlCallback = (url: string) => void|Promise;\n\nexport interface OAuth2AuthConfig {\n // the name of the OAuth2 provider (eg. \"google\")\n provider: string;\n\n // custom scopes to overwrite the default ones\n scopes?: Array;\n\n // optional record create data\n createData?: {[key: string]: any};\n\n // optional callback that is triggered after the OAuth2 sign-in/sign-up url generation\n urlCallback?: OAuth2UrlCallback;\n\n // optional query params to send with the PocketBase auth request (eg. fields, expand, etc.)\n query?: RecordQueryParams;\n\n // optional body params to send with the PocketBase auth request\n body?: {[key: string]: any};\n}\n\nexport default class RecordService extends CrudService {\n readonly collectionIdOrName: string;\n\n constructor(client: Client, collectionIdOrName: string) {\n super(client);\n\n this.collectionIdOrName = collectionIdOrName;\n }\n\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): T {\n return new Record(data) as any as T;\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return this.baseCollectionPath + '/records';\n }\n\n /**\n * Returns the current collection service base path.\n */\n get baseCollectionPath(): string {\n return '/api/collections/' + encodeURIComponent(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Realtime handlers\n // ---------------------------------------------------------------\n\n /**\n * @deprecated Use subscribe(recordId, callback) instead.\n *\n * Subscribe to the realtime changes of a single record in the collection.\n */\n async subscribeOne(recordId: string, callback: (data: RecordSubscription) => void): Promise {\n console.warn(\"PocketBase: subscribeOne(recordId, callback) is deprecated. Please replace it with subscribe(recordId, callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName + \"/\" + recordId, callback);\n }\n\n /**\n * @deprecated This form of subscribe is deprecated. Please use `subscribe(\"*\", callback)`.\n */\n async subscribe(callback: (data: RecordSubscription) => void): Promise\n\n /**\n * Subscribe to realtime changes to the specified topic (\"*\" or record id).\n *\n * If `topic` is the wildcard \"*\", then this method will subscribe to\n * any record changes in the collection.\n *\n * If `topic` is a record id, then this method will subscribe only\n * to changes of the specified record id.\n *\n * It's OK to subscribe multiple times to the same topic.\n * You can use the returned `UnsubscribeFunc` to remove only a single subscription.\n * Or use `unsubscribe(topic)` if you want to remove all subscriptions attached to the topic.\n */\n async subscribe(topic: string, callback: (data: RecordSubscription) => void): Promise\n\n async subscribe(\n topicOrCallback: string|((data: RecordSubscription) => void),\n callback?: (data: RecordSubscription) => void\n ): Promise {\n if (typeof topicOrCallback === 'function') {\n console.warn(\"PocketBase: subscribe(callback) is deprecated. Please replace it with subscribe('*', callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName, topicOrCallback);\n }\n\n if (!callback) {\n throw new Error(\"Missing subscription callback.\");\n }\n\n if (topicOrCallback === \"\") {\n throw new Error(\"Missing topic.\");\n }\n\n let topic = this.collectionIdOrName;\n if (topicOrCallback !== \"*\") {\n topic += ('/' + topicOrCallback);\n }\n\n return this.client.realtime.subscribe(topic, callback)\n }\n\n /**\n * Unsubscribe from all subscriptions of the specified topic\n * (\"*\" or record id).\n *\n * If `topic` is not set, then this method will unsubscribe from\n * all subscriptions associated to the current collection.\n */\n async unsubscribe(topic?: string): Promise {\n // unsubscribe wildcard topic\n if (topic === \"*\") {\n return this.client.realtime.unsubscribe(this.collectionIdOrName);\n }\n\n // unsubscribe recordId topic\n if (topic) {\n return this.client.realtime.unsubscribe(this.collectionIdOrName + \"/\" + topic);\n }\n\n // unsubscribe from everything related to the collection\n return this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Crud handers\n // ---------------------------------------------------------------\n /**\n * @inheritdoc\n */\n getFullList(queryParams?: RecordFullListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batch?: number, queryParams?: RecordListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batchOrQueryParams?: number|RecordFullListQueryParams, queryParams?: RecordListQueryParams): Promise> {\n if (typeof batchOrQueryParams == \"number\") {\n return super.getFullList(batchOrQueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrQueryParams, queryParams);\n\n return super.getFullList(params);\n }\n\n /**\n * @inheritdoc\n */\n getList(page = 1, perPage = 30, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getList(page, perPage, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getFirstListItem(filter: string, queryParams: RecordListQueryParams = {}): Promise {\n return super.getFirstListItem(filter, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getOne(id: string, queryParams: RecordQueryParams = {}): Promise {\n return super.getOne(id, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n create(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.create(bodyParams, queryParams);\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n if (\n // is record auth\n this.client.authStore.model?.id === item?.id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n if (\n success &&\n // is record auth\n this.client.authStore.model?.id === id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.clear();\n }\n\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful collection authorization response.\n */\n protected authResponse(responseData: any): RecordAuthResponse {\n const record = this.decode(responseData?.record || {});\n\n this.client.authStore.save(responseData?.token, record);\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'record': record as any as T,\n });\n }\n\n /**\n * Returns all available collection auth methods.\n */\n listAuthMethods(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCollectionPath + '/auth-methods', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n return Object.assign({}, responseData, {\n // normalize common fields\n 'usernamePassword': !!responseData?.usernamePassword,\n 'emailPassword': !!responseData?.emailPassword,\n 'authProviders': Array.isArray(responseData?.authProviders) ? responseData?.authProviders : [],\n });\n });\n }\n\n /**\n * Authenticate a single auth collection record via its username/email and password.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n */\n authWithPassword(\n usernameOrEmail: string,\n password: string,\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'identity': usernameOrEmail,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2 code.\n *\n * If you don't have an OAuth2 code you may also want to check `authWithOAuth2` method.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n */\n authWithOAuth2Code(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData = {},\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'provider': provider,\n 'code': code,\n 'codeVerifier': codeVerifier,\n 'redirectUrl': redirectUrl,\n 'createData': createData,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-oauth2', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * @deprecated This form of authWithOAuth2 is deprecated.\n *\n * Please use `authWithOAuth2Code()` OR its simplified realtime version\n * as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\n */\n async authWithOAuth2(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData?: {[key: string]: any},\n bodyParams?: {[key: string]: any},\n queryParams?: RecordQueryParams,\n ): Promise>\n\n /**\n * Authenticate a single auth collection record with OAuth2\n * **without custom redirects, deeplinks or even page reload**.\n *\n * This method initializes a one-off realtime subscription and will\n * open a popup window with the OAuth2 vendor page to authenticate.\n * Once the external OAuth2 sign-in/sign-up flow is completed, the popup\n * window will be automatically closed and the OAuth2 data sent back\n * to the user through the previously established realtime connection.\n *\n * You can specify an optional `urlCallback` prop to customize\n * the default url `window.open` behavior.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n *\n * Example:\n *\n * ```js\n * const authData = await pb.collection(\"users\").authWithOAuth2({\n * provider: \"google\",\n * })\n * ```\n *\n * _Site-note_: when creating the OAuth2 app in the provider dashboard\n * you have to configure `https://yourdomain.com/api/oauth2-redirect`\n * as redirect URL.\n */\n async authWithOAuth2(options: OAuth2AuthConfig): Promise>\n\n async authWithOAuth2(...args: any): Promise> {\n // fallback to legacy format\n if (args.length > 1 || typeof args?.[0] === 'string') {\n console.warn(\"PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\");\n return this.authWithOAuth2Code(\n args?.[0] || '',\n args?.[1] || '',\n args?.[2] || '',\n args?.[3] || '',\n args?.[4] || {},\n args?.[5] || {},\n args?.[6] || {},\n );\n }\n\n const config = args?.[0] || {};\n\n const authMethods = await this.listAuthMethods();\n\n const provider = authMethods.authProviders.find((p) => p.name === config.provider);\n if (!provider) {\n throw new ClientResponseError(new Error(`Missing or invalid provider \"${config.provider}\".`));\n }\n\n const redirectUrl = this.client.buildUrl('/api/oauth2-redirect');\n\n return new Promise(async (resolve, reject) => {\n try {\n // initialize a one-off @oauth2 realtime subscription\n const unsubscribe = await this.client.realtime.subscribe('@oauth2', async (e) => {\n const oldState = this.client.realtime.clientId;\n\n try {\n unsubscribe();\n\n if (!e.state || oldState !== e.state) {\n throw new Error(\"State parameters don't match.\");\n }\n\n const authData = await this.authWithOAuth2Code(\n provider.name,\n e.code,\n provider.codeVerifier,\n redirectUrl,\n config.createData,\n config.body,\n config.query,\n )\n\n resolve(authData);\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n\n const url = new URL(provider.authUrl + redirectUrl);\n url.searchParams.set(\"state\", this.client.realtime.clientId);\n if (config.scopes?.length) {\n url.searchParams.set(\"scope\", config.scopes.join(\" \"));\n }\n\n await (config.urlCallback ? config.urlCallback(url.toString()) : this._defaultUrlCallback(url.toString()));\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n }\n\n /**\n * Refreshes the current authenticated record instance and\n * returns a new token and record data.\n *\n * On success this method also automatically updates the client's AuthStore.\n */\n authRefresh(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise> {\n return this.client.send(this.baseCollectionPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Sends auth record password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends auth record verification email request.\n */\n requestVerification(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record email verification request.\n */\n confirmVerification(\n verificationToken: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': verificationToken,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends an email change request to the authenticated record model.\n */\n requestEmailChange(\n newEmail: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'newEmail': newEmail,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record's new email address.\n */\n confirmEmailChange(\n emailChangeToken: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': emailChangeToken,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Lists all linked external auth providers for the specified auth record.\n */\n listExternalAuths(\n recordId: string,\n queryParams: BaseQueryParams = {}\n ): Promise> {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => {\n const items: Array = [];\n\n if (Array.isArray(responseData)) {\n for (const item of responseData) {\n items.push(new ExternalAuth(item));\n }\n }\n\n return items;\n });\n }\n\n /**\n * Unlink a single external auth provider from the specified auth record.\n */\n unlinkExternalAuth(\n recordId: string,\n provider: string,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths/' + encodeURIComponent(provider), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n // ---------------------------------------------------------------\n\n private _defaultUrlCallback(url: string) {\n if (typeof window === \"undefined\" || !window?.open) {\n throw new ClientResponseError(new Error(`Not in a browser context - please pass a custom urlCallback function.`));\n }\n\n let width = 1024;\n let height = 768;\n\n let windowWidth = window.innerWidth;\n let windowHeight = window.innerHeight;\n\n // normalize window size\n width = width > windowWidth ? windowWidth : width;\n height = height > windowHeight ? windowHeight : height;\n\n let left = (windowWidth / 2) - (width / 2);\n let top = (windowHeight / 2) - (height / 2);\n\n window.open(\n url,\n \"oauth2-popup\",\n 'width='+width+',height='+height+',top='+top+',left='+left+',resizable,menubar=no'\n );\n }\n}\n","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.name = typeof data.name !== 'undefined' ? data.name : '';\n this.type = typeof data.type !== 'undefined' ? data.type : 'text';\n this.system = !!data.system;\n this.required = !!data.required;\n this.options = typeof data.options === 'object' && data.options !== null ? data.options : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport SchemaField from '@/models/utils/SchemaField';\n\nexport default class Collection extends BaseModel {\n name!: string;\n type!: string;\n schema!: Array;\n indexes!: Array;\n system!: boolean;\n listRule!: null|string;\n viewRule!: null|string;\n createRule!: null|string;\n updateRule!: null|string;\n deleteRule!: null|string;\n options!: {[key:string]: any};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.system = !!data.system;\n this.name = typeof data.name === 'string' ? data.name : '';\n this.type = typeof data.type === 'string' ? data.type : 'base';\n this.options = typeof data.options !== 'undefined' && data.options !== null ? data.options : {};\n this.indexes = Array.isArray(data.indexes) ? data.indexes : [];\n\n // rules\n this.listRule = typeof data.listRule === 'string' ? data.listRule : null;\n this.viewRule = typeof data.viewRule === 'string' ? data.viewRule : null;\n this.createRule = typeof data.createRule === 'string' ? data.createRule : null;\n this.updateRule = typeof data.updateRule === 'string' ? data.updateRule : null;\n this.deleteRule = typeof data.deleteRule === 'string' ? data.deleteRule : null;\n\n // schema\n data.schema = Array.isArray(data.schema) ? data.schema : [];\n this.schema = [];\n for (let field of data.schema) {\n this.schema.push(new SchemaField(field));\n }\n }\n\n /**\n * @deprecated Please use $isBase instead.\n */\n get isBase(): boolean {\n return this.$isBase;\n }\n\n /**\n * Checks if the current model is \"base\" collection.\n */\n get $isBase(): boolean {\n return this.type === 'base';\n }\n\n /**\n * @deprecated Please use $isAuth instead.\n */\n get isAuth(): boolean {\n return this.$isAuth;\n }\n\n /**\n * Checks if the current model is \"auth\" collection.\n */\n get $isAuth(): boolean {\n return this.type === 'auth';\n }\n\n /**\n * @deprecated Please use $isView instead.\n */\n get isView(): boolean {\n return this.$isView;\n }\n\n /**\n * Checks if the current model is \"view\" collection.\n */\n get $isView(): boolean {\n return this.type === 'view';\n }\n}\n","import Collection from '@/models/Collection';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport default class CollectionService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Collection {\n return new Collection(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/collections';\n }\n\n /**\n * Imports the provided collections.\n *\n * If `deleteMissing` is `true`, all local collections and schema fields,\n * that are not present in the imported configuration, WILL BE DELETED\n * (including their related records data)!\n */\n async import(\n collections: Array,\n deleteMissing: boolean = false,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/import', {\n 'method': 'PUT',\n 'params': queryParams,\n 'body': {\n 'collections': collections,\n 'deleteMissing': deleteMissing,\n }\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class LogRequest extends BaseModel {\n url!: string;\n method!: string;\n status!: number;\n auth!: string;\n remoteIp!: string;\n userIp!: string;\n referer!: string;\n userAgent!: string;\n meta!: { [key: string]: any };\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // fallback to the ip field for backward compatibility\n data.remoteIp = data.remoteIp || data.ip;\n\n this.url = typeof data.url === 'string' ? data.url : '';\n this.method = typeof data.method === 'string' ? data.method : 'GET';\n this.status = typeof data.status === 'number' ? data.status : 200;\n this.auth = typeof data.auth === 'string' ? data.auth : 'guest';\n this.remoteIp = typeof data.remoteIp === 'string' ? data.remoteIp : '';\n this.userIp = typeof data.userIp === 'string' ? data.userIp : '';\n this.referer = typeof data.referer === 'string' ? data.referer : '';\n this.userAgent = typeof data.userAgent === 'string' ? data.userAgent : '';\n this.meta = typeof data.meta === 'object' && data.meta !== null ? data.meta : {};\n }\n}\n","import LogRequest from '@/models/LogRequest';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n LogStatsQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface HourlyStats {\n total: number;\n date: string;\n}\n\nexport default class LogService extends BaseService {\n /**\n * Returns paginated logged requests list.\n */\n getRequestsList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send('/api/logs/requests', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData?.items || [];\n for (const item of responseData.items) {\n items.push(new LogRequest(item));\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns a single logged request by its id.\n */\n getRequest(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/logs/requests/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => new LogRequest(responseData));\n }\n\n /**\n * Returns request logs statistics.\n */\n getRequestsStats(queryParams: LogStatsQueryParams = {}): Promise> {\n return this.client.send('/api/logs/requests/stats', {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => responseData);\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\n\ninterface promiseCallbacks {\n resolve: Function\n reject: Function\n}\n\nexport type UnsubscribeFunc = () => Promise;\n\nexport default class RealtimeService extends BaseService {\n clientId: string = \"\";\n\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 15000;\n private reconnectTimeoutId: any;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number = Infinity;\n private predefinedReconnectIntervals: Array = [\n 200, 300, 500, 1000, 1200, 1500, 2000,\n ];\n private pendingConnects: Array = [];\n\n\n /**\n * Returns whether the realtime connection has been established.\n */\n get isConnected(): boolean {\n return !!this.eventSource && !!this.clientId && !this.pendingConnects.length;\n }\n\n /**\n * Register the subscription listener.\n *\n * You can subscribe multiple times to the same topic.\n *\n * If the SSE connection is not started yet,\n * this method will also initialize it.\n */\n async subscribe(topic: string, callback: (data: any) => void): Promise {\n if (!topic) {\n throw new Error('topic must be set.')\n }\n\n const listener = function (e: Event) {\n const msgEvent = (e as MessageEvent);\n\n let data;\n try {\n data = JSON.parse(msgEvent?.data);\n } catch {}\n\n callback(data || {});\n };\n\n // store the listener\n if (!this.subscriptions[topic]) {\n this.subscriptions[topic] = [];\n }\n this.subscriptions[topic].push(listener);\n\n if (!this.isConnected) {\n // initialize sse connection\n await this.connect();\n } else if (this.subscriptions[topic].length === 1) {\n // send the updated subscriptions (if it is the first for the topic)\n await this.submitSubscriptions();\n } else {\n // only register the listener\n this.eventSource?.addEventListener(topic, listener);\n }\n\n return async (): Promise => {\n return this.unsubscribeByTopicAndListener(topic, listener);\n };\n }\n\n /**\n * Unsubscribe from all subscription listeners with the specified topic.\n *\n * If `topic` is not provided, then this method will unsubscribe\n * from all active subscriptions.\n *\n * This method is no-op if there are no active subscriptions.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribe(topic?: string): Promise {\n if (!this.hasSubscriptionListeners(topic)) {\n return; // already unsubscribed\n }\n\n if (!topic) {\n // remove all subscriptions\n this.subscriptions = {};\n } else {\n // remove all topic listeners\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n /**\n * Unsubscribe from all subscription listeners starting with the specified topic prefix.\n *\n * This method is no-op if there are no active subscriptions with the specified topic prefix.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByPrefix(topicPrefix: string): Promise {\n let hasAtleastOneTopic = false;\n for (let topic in this.subscriptions) {\n if (!topic.startsWith(topicPrefix)) {\n continue;\n }\n\n hasAtleastOneTopic = true;\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!hasAtleastOneTopic) {\n return; // nothing to unsubscribe from\n }\n\n if (this.hasSubscriptionListeners()) {\n // submit the deleted subscriptions\n await this.submitSubscriptions();\n } else {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n }\n }\n\n /**\n * Unsubscribe from all subscriptions matching the specified topic and listener function.\n *\n * This method is no-op if there are no active subscription with\n * the specified topic and listener.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByTopicAndListener(topic: string, listener: EventListener): Promise {\n if (!Array.isArray(this.subscriptions[topic]) || !this.subscriptions[topic].length) {\n return; // already unsubscribed\n }\n\n let exist = false;\n for (let i = this.subscriptions[topic].length - 1; i >= 0; i--) {\n if (this.subscriptions[topic][i] !== listener) {\n continue;\n }\n\n exist = true; // has at least one matching listener\n delete this.subscriptions[topic][i]; // removes the function reference\n this.subscriptions[topic].splice(i, 1); // reindex the array\n this.eventSource?.removeEventListener(topic, listener);\n }\n if (!exist) {\n return;\n }\n\n // remove the topic from the subscriptions list if there are no other listeners\n if (!this.subscriptions[topic].length) {\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n private hasSubscriptionListeners(topicToCheck?: string): boolean {\n this.subscriptions = this.subscriptions || {};\n\n // check the specified topic\n if (topicToCheck) {\n return !!this.subscriptions[topicToCheck]?.length;\n }\n\n // check for at least one non-empty topic\n for (let topic in this.subscriptions) {\n if (!!this.subscriptions[topic]?.length) {\n return true\n }\n }\n\n return false;\n }\n\n private async submitSubscriptions(): Promise {\n if (!this.clientId) {\n return; // no client/subscriber\n }\n\n // optimistic update\n this.addAllSubscriptionListeners();\n\n this.lastSentTopics = this.getNonEmptySubscriptionTopics();\n\n return this.client.send('/api/realtime', {\n 'method': 'POST',\n 'body': {\n 'clientId': this.clientId,\n 'subscriptions': this.lastSentTopics,\n },\n 'params': {\n '$cancelKey': \"realtime_\" + this.clientId,\n },\n }).catch((err) => {\n if (err?.isAbort) {\n return; // silently ignore aborted pending requests\n }\n throw err;\n });\n }\n\n private getNonEmptySubscriptionTopics(): Array {\n const result : Array = [];\n\n for (let topic in this.subscriptions) {\n if (this.subscriptions[topic].length) {\n result.push(topic);\n }\n }\n\n return result;\n }\n\n private addAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n this.removeAllSubscriptionListeners();\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.addEventListener(topic, listener);\n }\n }\n }\n\n private removeAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.removeEventListener(topic, listener);\n }\n }\n }\n\n private async connect(): Promise {\n if (this.reconnectAttempts > 0) {\n // immediately resolve the promise to avoid indefinitely\n // blocking the client during reconnection\n return;\n }\n\n return new Promise((resolve, reject) => {\n this.pendingConnects.push({ resolve, reject });\n\n if (this.pendingConnects.length > 1) {\n // all promises will be resolved once the connection is established\n return;\n }\n\n this.initConnect();\n })\n }\n\n private initConnect() {\n this.disconnect(true);\n\n // wait up to 15s for connect\n clearTimeout(this.connectTimeoutId);\n this.connectTimeoutId = setTimeout(() => {\n this.connectErrorHandler(new Error(\"EventSource connect took too long.\"));\n }, this.maxConnectTimeout);\n\n this.eventSource = new EventSource(this.client.buildUrl('/api/realtime'))\n\n this.eventSource.onerror = (_) => {\n this.connectErrorHandler(new Error(\"Failed to establish realtime connection.\"));\n };\n\n this.eventSource.addEventListener('PB_CONNECT', (e) => {\n const msgEvent = (e as MessageEvent);\n this.clientId = msgEvent?.lastEventId;\n\n this.submitSubscriptions()\n .then(async () => {\n let retries = 3;\n while (this.hasUnsentSubscriptions() && retries > 0) {\n retries--;\n // resubscribe to ensure that the latest topics are submitted\n //\n // This is needed because missed topics could happen on reconnect\n // if after the pending sent `submitSubscriptions()` call another `subscribe()`\n // was made before the submit was able to complete.\n await this.submitSubscriptions();\n }\n }).then(() => {\n for (let p of this.pendingConnects) {\n p.resolve();\n }\n\n // reset connect meta\n this.pendingConnects = [];\n this.reconnectAttempts = 0;\n clearTimeout(this.reconnectTimeoutId);\n clearTimeout(this.connectTimeoutId);\n }).catch((err) => {\n this.clientId = \"\";\n this.connectErrorHandler(err);\n });\n });\n }\n\n private hasUnsentSubscriptions(): boolean {\n const latestTopics = this.getNonEmptySubscriptionTopics();\n if (latestTopics.length != this.lastSentTopics.length) {\n return true;\n }\n\n for (const t of latestTopics) {\n if (!this.lastSentTopics.includes(t)) {\n return true;\n }\n }\n\n return false;\n }\n\n private connectErrorHandler(err: any) {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n\n if (\n // wasn't previously connected -> direct reject\n (!this.clientId && !this.reconnectAttempts) ||\n // was previously connected but the max reconnection limit has been reached\n this.reconnectAttempts > this.maxReconnectAttempts\n ) {\n for (let p of this.pendingConnects) {\n p.reject(new ClientResponseError(err));\n }\n this.disconnect();\n return;\n }\n\n // otherwise -> reconnect in the background\n this.disconnect(true);\n const timeout = this.predefinedReconnectIntervals[this.reconnectAttempts] || this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length - 1];\n this.reconnectAttempts++;\n this.reconnectTimeoutId = setTimeout(() => {\n this.initConnect();\n }, timeout);\n }\n\n private disconnect(fromReconnect = false): void {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n this.removeAllSubscriptionListeners();\n this.eventSource?.close();\n this.eventSource = null;\n this.clientId = \"\";\n\n if (!fromReconnect) {\n this.reconnectAttempts = 0;\n\n // reject any remaining connect promises\n const err = new ClientResponseError(new Error(\"Realtime disconnected.\"));\n for (let p of this.pendingConnects) {\n p.reject(err);\n }\n this.pendingConnects = [];\n }\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface HealthCheckResponse {\n code: number;\n message: string;\n data: {[key: string]: any};\n}\n\nexport default class HealthService extends BaseService {\n /**\n * Checks the health status of the api.\n */\n check(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/health', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport default class FileService extends BaseService {\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n const parts = [];\n parts.push(\"api\")\n parts.push(\"files\")\n parts.push(encodeURIComponent(record.collectionId || record.collectionName))\n parts.push(encodeURIComponent(record.id))\n parts.push(encodeURIComponent(filename))\n\n let result = this.client.buildUrl(parts.join('/'));\n\n if (Object.keys(queryParams).length) {\n const params = new URLSearchParams(queryParams);\n result += (result.includes(\"?\") ? \"&\" : \"?\") + params;\n }\n\n return result\n }\n\n /**\n * Requests a new private file access token for the current auth model (admin or record).\n */\n getToken(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/files/token', {\n 'method': 'POST',\n 'params': queryParams,\n }).then((data) => data?.token || '');\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface BackupFileInfo {\n key: string;\n size: number;\n modified: string;\n}\n\nexport default class BackupService extends BaseService {\n /**\n * Returns list with all available backup files.\n */\n getFullList(queryParams: BaseQueryParams = {}): Promise> {\n return this.client.send('/api/backups', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n\n /**\n * Initializes a new backup.\n */\n create(basename: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'name': basename,\n };\n\n return this.client.send('/api/backups', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Deletes a single backup file.\n */\n delete(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}`, {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Initializes an app data restore from an existing backup.\n */\n restore(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}/restore`, {\n 'method': 'POST',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Builds a download url for a single existing backup using an\n * admin file token and the backup file key.\n *\n * The file token can be generated via `pb.files.getToken()`.\n */\n getDownloadUrl(token: string, key: string): string {\n return this.client.buildUrl(`/api/backups/${encodeURIComponent(key)}?token=${encodeURIComponent(token)}`);\n }\n}\n","import ClientResponseError from '@/ClientResponseError';\nimport BaseAuthStore from '@/stores/BaseAuthStore';\nimport LocalAuthStore from '@/stores/LocalAuthStore';\nimport SettingsService from '@/services/SettingsService';\nimport AdminService from '@/services/AdminService';\nimport RecordService from '@/services/RecordService';\nimport CollectionService from '@/services/CollectionService';\nimport LogService from '@/services/LogService';\nimport RealtimeService from '@/services/RealtimeService';\nimport HealthService from '@/services/HealthService';\nimport FileService from '@/services/FileService';\nimport BackupService from '@/services/BackupService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport interface SendOptions extends RequestInit {\n headers?: { [key: string]: string };\n body?: any;\n params?: BaseQueryParams;\n}\n\nexport interface BeforeSendResult {\n [key: string]: any, // for backward compatibility\n url?: string,\n options?: {[key: string]: any}\n}\n\n/**\n * PocketBase JS Client.\n */\nexport default class Client {\n /**\n * The base PocketBase backend url address (eg. 'http://127.0.0.1.8090').\n */\n baseUrl: string;\n\n /**\n * Hook that get triggered right before sending the fetch request,\n * allowing you to inspect and modify the url and request options.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * You can return a non-empty result object `{ url, options }` to replace the url and request options entirely.\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, options) {\n * options.headers = Object.assign({}, options.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return { url, options }\n * };\n * ```\n */\n beforeSend?: (url: string, options: SendOptions) => BeforeSendResult|Promise;\n\n /**\n * Hook that get triggered after successfully sending the fetch request,\n * allowing you to inspect/modify the response object and its parsed data.\n *\n * Returns the new Promise resolved `data` that will be returned to the client.\n *\n * Example:\n * ```js\n * client.afterSend = function (response, data) {\n * if (response.status != 200) {\n * throw new ClientResponseError({\n * url: response.url,\n * status: response.status,\n * data: data,\n * });\n * }\n *\n * return data;\n * };\n * ```\n */\n afterSend?: (response: Response, data: any) => any;\n\n /**\n * Optional language code (default to `en-US`) that will be sent\n * with the requests to the server as `Accept-Language` header.\n */\n lang: string;\n\n /**\n * A replaceable instance of the local auth store service.\n */\n authStore: BaseAuthStore;\n\n /**\n * An instance of the service that handles the **Settings APIs**.\n */\n readonly settings: SettingsService;\n\n /**\n * An instance of the service that handles the **Admin APIs**.\n */\n readonly admins: AdminService;\n\n /**\n * An instance of the service that handles the **Collection APIs**.\n */\n readonly collections: CollectionService;\n\n /**\n * An instance of the service that handles the **File APIs**.\n */\n readonly files: FileService;\n\n /**\n * An instance of the service that handles the **Log APIs**.\n */\n readonly logs: LogService;\n\n /**\n * An instance of the service that handles the **Realtime APIs**.\n */\n readonly realtime: RealtimeService;\n\n /**\n * An instance of the service that handles the **Health APIs**.\n */\n readonly health: HealthService;\n\n /**\n * An instance of the service that handles the **Backup APIs**.\n */\n readonly backups: BackupService;\n\n private cancelControllers: { [key: string]: AbortController } = {};\n private recordServices: { [key: string]: RecordService } = {};\n private enableAutoCancellation: boolean = true;\n\n constructor(\n baseUrl = '/',\n authStore?: BaseAuthStore | null,\n lang = 'en-US',\n ) {\n this.baseUrl = baseUrl;\n this.lang = lang;\n this.authStore = authStore || new LocalAuthStore();\n\n // services\n this.admins = new AdminService(this);\n this.collections = new CollectionService(this);\n this.files = new FileService(this);\n this.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(this);\n this.health = new HealthService(this);\n this.backups = new BackupService(this);\n }\n\n /**\n * Returns the RecordService associated to the specified collection.\n *\n * @param {string} idOrName\n * @return {RecordService}\n */\n collection(idOrName: string): RecordService {\n if (!this.recordServices[idOrName]) {\n this.recordServices[idOrName] = new RecordService(this, idOrName);\n }\n\n return this.recordServices[idOrName];\n }\n\n /**\n * Globally enable or disable auto cancellation for pending duplicated requests.\n */\n autoCancellation(enable: boolean): Client {\n this.enableAutoCancellation = !!enable;\n\n return this;\n }\n\n /**\n * Cancels single request by its cancellation key.\n */\n cancelRequest(cancelKey: string): Client {\n if (this.cancelControllers[cancelKey]) {\n this.cancelControllers[cancelKey].abort();\n delete this.cancelControllers[cancelKey];\n }\n\n return this;\n }\n\n /**\n * Cancels all pending requests.\n */\n cancelAllRequests(): Client {\n for (let k in this.cancelControllers) {\n this.cancelControllers[k].abort();\n }\n\n this.cancelControllers = {};\n\n return this;\n }\n\n /**\n * Sends an api http request.\n */\n async send(path: string, reqOptions: SendOptions): Promise {\n let options = Object.assign({ method: 'GET' } as SendOptions, reqOptions);\n\n // JSON serialize the body if needed and set the correct content type\n // (for FormData body the Content-Type header should be skipped since the boundary is autogenerated)\n if (!this.isFormData(options.body)) {\n if (options.body && typeof options.body !== 'string') {\n options.body = JSON.stringify(options.body);\n }\n\n // add the json header (if not already)\n if (typeof options?.headers?.['Content-Type'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof options?.headers?.['Accept-Language'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Accept-Language': this.lang,\n });\n }\n\n // check if Authorization header can be added\n if (\n // has stored token\n this.authStore?.token &&\n // auth header is not explicitly set\n (typeof options?.headers?.Authorization === 'undefined')\n ) {\n options.headers = Object.assign({}, options.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && options.params?.$autoCancel !== false) {\n const cancelKey = options.params?.$cancelKey || ((options.method || 'GET') + path);\n\n // cancel previous pending requests\n this.cancelRequest(cancelKey);\n\n const controller = new AbortController();\n this.cancelControllers[cancelKey] = controller;\n options.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete options.params?.$autoCancel;\n delete options.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof options.params !== 'undefined') {\n const query = this.serializeQueryParams(options.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete options.params;\n }\n\n if (this.beforeSend) {\n const result = Object.assign({}, await this.beforeSend(url, options));\n if (typeof result.url !== \"undefined\" || typeof result.options !== \"undefined\") {\n url = result.url || url;\n options = result.options || options;\n } else if (Object.keys(result).length) {\n // legacy behavior\n options = result as SendOptions;\n console?.warn && console.warn(\"Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`.\");\n }\n }\n\n // send the request\n return fetch(url, options)\n .then(async (response) => {\n let data : any = {};\n\n try {\n data = await response.json();\n } catch (_) {\n // all api responses are expected to return json\n // with the exception of the realtime event and 204\n }\n\n if (this.afterSend) {\n data = await this.afterSend(response, data);\n }\n\n if (response.status >= 400) {\n throw new ClientResponseError({\n url: response.url,\n status: response.status,\n data: data,\n });\n }\n\n return data as T;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Legacy alias of `pb.files.getUrl()`.\n */\n getFileUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n return this.files.getUrl(record, filename, queryParams);\n }\n\n /**\n * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl;\n\n // construct an absolute base url if in a browser environment\n if (\n typeof window !== 'undefined' &&\n !!window.location &&\n !url.startsWith('https://') &&\n !url.startsWith('http://')\n ) {\n url = window.location.origin?.endsWith('/') ?\n window.location.origin.substring(0, window.location.origin.length - 1) :\n (window.location.origin || '');\n\n if (!this.baseUrl.startsWith('/')) {\n url += window.location.pathname || '/';\n url += url.endsWith('/') ? '' : '/';\n }\n\n url += this.baseUrl;\n }\n\n // concatenate the path\n if (path) {\n url += url.endsWith('/') ? '' : '/'; // append trailing slash if missing\n url += path.startsWith('/') ? path.substring(1) : path;\n }\n\n return url;\n }\n\n /**\n * Loosely checks if the specified body is a FormData instance.\n */\n private isFormData(body: any): boolean {\n return body && (\n // we are checking the constructor name because FormData\n // is not available natively in some environments and the\n // polyfill(s) may not be globally accessible\n body.constructor.name === 'FormData' ||\n // fallback to global FormData instance check\n // note: this is needed because the constructor.name could be different in case of\n // custom global FormData implementation, eg. React Native on Android/iOS\n (typeof FormData !== \"undefined\" && body instanceof FormData)\n )\n }\n\n /**\n * Serializes the provided query parameters into a query string.\n */\n private serializeQueryParams(params: {[key: string]: any}): string {\n const result: Array = [];\n for (const key in params) {\n if (params[key] === null) {\n // skip null query params\n continue;\n }\n\n const value = params[key];\n const encodedKey = encodeURIComponent(key);\n\n if (Array.isArray(value)) {\n // \"repeat\" array params\n for (const v of value) {\n result.push(encodedKey + \"=\" + encodeURIComponent(v));\n }\n } else if (value instanceof Date) {\n result.push(encodedKey + \"=\" + encodeURIComponent(value.toISOString()));\n } else if (typeof value !== null && typeof value === 'object') {\n result.push(encodedKey + \"=\" + encodeURIComponent(JSON.stringify(value)));\n } else {\n result.push(encodedKey + \"=\" + encodeURIComponent(value));\n }\n }\n\n return result.join('&');\n }\n}\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__extends","TypeError","String","__","this","constructor","create","__assign","assign","t","s","i","n","arguments","length","apply","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","adopt","then","__generator","body","f","y","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","v","op","pop","push","atobPolyfill","ClientResponseError","_super","errData","_this","url","status","response","isAbort","originalError","data","DOMException","name","message","_a","_d","_c","_b","cause","includes","defineProperty","get","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","isDate","toString","Date","valueOf","toUTCString","httpOnly","secure","priority","toLowerCase","sameSite","defaultDecode","indexOf","decodeURIComponent","encodeURIComponent","getTokenPayload","token","encodedPayload","split","map","c","charCodeAt","slice","join","JSON","parse","isTokenExpired","expirationThreshold","payload","keys","exp","now","atob","input","str","replace","bs","buffer","bc","idx","output","charAt","fromCharCode","BaseModel","$load","load","_i","entries","key","id","created","updated","clone","$clone","structuredClone","stringify","export","$export","Record","collectionId","collectionName","_loadExpand","expand","isArray","Admin","avatar","email","defaultCookieKey","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","save","model","triggerChange","clear","loadFromCookie","cookie","rawData","cookieParse","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","exportToCookie","defaultOptions","resultLength","Blob","size","username","verified","onChange","callback","fireImmediately","splice","LocalAuthStore","storageKey","storageFallback","_storageGet","_storageSet","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","filesystem","testEmail","toEmail","emailTemplate","template","generateAppleClientSecret","clientId","teamId","keyId","privateKey","duration","ListResult","page","perPage","totalItems","totalPages","items","CrudService","getFullList","batchOrqueryParams","_getFullList","baseCrudPath","batch","getList","_getList","getFirstListItem","filter","_getFirstListItem","getOne","_getOne","_create","_update","delete","_delete","BaseCrudService","basePath","batchSize","request","list","castedList","concat","item","$cancelKey","code","AdminService","authStore","success","authResponse","admin","authWithPassword","password","identity","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","batchOrQueryParams","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2Code","codeVerifier","redirectUrl","createData","authWithOAuth2","args","config","authMethods","find","buildUrl","oldState","unsubscribe_1","state","query","authData","err_2","URL","authUrl","searchParams","set","scopes","urlCallback","_defaultUrlCallback","err_1","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","open","width","height","windowWidth","innerWidth","windowHeight","innerHeight","left","top","SchemaField","type","system","required","Collection","indexes","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","$isBase","$isAuth","$isView","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","eventSource","subscriptions","lastSentTopics","maxConnectTimeout","reconnectAttempts","maxReconnectAttempts","Infinity","predefinedReconnectIntervals","pendingConnects","listener","msgEvent","isConnected","connect","submitSubscriptions","addEventListener","unsubscribeByTopicAndListener","hasSubscriptionListeners","removeEventListener","disconnect","topicPrefix","hasAtleastOneTopic","startsWith","exist","topicToCheck","addAllSubscriptionListeners","getNonEmptySubscriptionTopics","catch","err","removeAllSubscriptionListeners","initConnect","clearTimeout","connectTimeoutId","setTimeout","connectErrorHandler","EventSource","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","timeout","fromReconnect","close","HealthService","check","FileService","getUrl","filename","parts","URLSearchParams","getToken","BackupService","basename","restore","getDownloadUrl","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","files","logs","settings","health","backups","collection","idOrName","autoCancellation","enable","cancelRequest","cancelKey","abort","cancelAllRequests","k","reqOptions","isFormData","headers","Authorization","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","serializeQueryParams","beforeSend","_k","_j","_l","_m","fetch","json","afterSend","getFileUrl","location","origin","endsWith","substring","pathname","FormData","encodedKey","value_1","toISOString"],"mappings":"AAgBA,IAAIA,cAAgB,SAASC,EAAGC,GAI5B,OAHAF,cAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,CAAE,GACzE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOC,OAAOK,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,KACzFP,cAAcC,EAAGC,EAC5B,EAEO,SAASS,UAAUV,EAAGC,GACzB,GAAiB,mBAANA,GAA0B,OAANA,EAC3B,MAAM,IAAIU,UAAU,uBAAyBC,OAAOX,GAAK,iCAE7D,SAASY,KAAOC,KAAKC,YAAcf,CAAI,CADvCD,cAAcC,EAAGC,GAEjBD,EAAEO,UAAkB,OAANN,EAAaC,OAAOc,OAAOf,IAAMY,GAAGN,UAAYN,EAAEM,UAAW,IAAIM,GACnF,CAEO,IAAII,SAAW,WAQlB,OAPAA,SAAWf,OAAOgB,QAAU,SAASD,SAASE,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAIf,KADTc,EAAIG,UAAUF,GACOnB,OAAOK,UAAUC,eAAeC,KAAKW,EAAGd,KAAIa,EAAEb,GAAKc,EAAEd,IAE9E,OAAOa,CACV,EACMF,SAASQ,MAAMX,KAAMS,UAChC,EA0EO,SAASG,UAAUC,EAASC,EAAYC,EAAGC,GAE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SAASC,OAAO3c,OAAS,GACnEsL,OAAOoR,SAASC,QAAU,GAE1Brd,KAAK0a,QAAQrC,WAAW,OACzB/U,GAAO0I,OAAOoR,SAASI,UAAY,IACnCla,GAAOA,EAAIga,SAAS,KAAO,GAAK,KAGpCha,GAAOtD,KAAK0a,SAIZnV,IACAjC,GAAOA,EAAIga,SAAS,KAAO,GAAK,IAChCha,GAAOiC,EAAK8S,WAAW,KAAO9S,EAAKgY,UAAU,GAAKhY,GAG/CjC,GAMHmX,OAAUhb,UAAAsc,WAAlB,SAAmBha,GACf,OAAOA,IAIuB,aAA1BA,EAAK9B,YAAY4D,MAII,oBAAb4Z,UAA4B1b,aAAgB0b,WAOpDhD,OAAoBhb,UAAAid,qBAA5B,SAA6B5P,GACzB,IAAMpL,EAAwB,GAC9B,IAAK,IAAM8G,KAAOsE,EACd,GAAoB,OAAhBA,EAAOtE,GAAX,CAKA,IAAMnH,EAAQyL,EAAOtE,GACfkV,EAAapX,mBAAmBkC,GAEtC,GAAIjJ,MAAMgK,QAAQlI,GAEd,IAAgB,QAAAsc,EAAAtc,EAAAiH,EAAKqV,EAAAjd,OAAL4H,IAAO,CAAlB,IAAMzF,EAAC8a,EAAArV,GACR5G,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBzD,GACrD,MACMxB,aAAiBsE,KACxBjE,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBjF,EAAMuc,gBAChC,cAAVvc,GAAmC,iBAAVA,EACvCK,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBU,KAAK+B,UAAU1H,KAEjEK,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBjF,GAfrD,CAmBL,OAAOK,EAAOqF,KAAK,MAE1B0T,MAAD"} \ No newline at end of file +{"version":3,"file":"pocketbase.es.mjs","sources":["../node_modules/tslib/tslib.es6.js","../src/ClientResponseError.ts","../src/stores/utils/jwt.ts","../src/stores/utils/cookie.ts","../src/models/utils/BaseModel.ts","../src/models/Record.ts","../src/models/Admin.ts","../src/stores/BaseAuthStore.ts","../src/stores/LocalAuthStore.ts","../src/services/utils/BaseService.ts","../src/services/SettingsService.ts","../src/models/utils/ListResult.ts","../src/services/utils/CrudService.ts","../src/services/utils/BaseCrudService.ts","../src/services/AdminService.ts","../src/models/ExternalAuth.ts","../src/services/RecordService.ts","../src/models/utils/SchemaField.ts","../src/models/Collection.ts","../src/services/CollectionService.ts","../src/models/LogRequest.ts","../src/services/LogService.ts","../src/services/RealtimeService.ts","../src/services/HealthService.ts","../src/services/FileService.ts","../src/services/BackupService.ts","../src/Client.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","/**\n * ClientResponseError is a custom Error class that is intended to wrap\n * and normalize any error thrown by `Client.send()`.\n */\nexport default class ClientResponseError extends Error {\n url: string = '';\n status: number = 0;\n response: {[key: string]: any} = {};\n isAbort: boolean = false;\n originalError: any = null;\n\n constructor(errData?: any) {\n super(\"ClientResponseError\");\n\n // Set the prototype explicitly.\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, ClientResponseError.prototype);\n\n if (!(errData instanceof ClientResponseError)) {\n this.originalError = errData;\n }\n\n if (errData !== null && typeof errData === 'object') {\n this.url = typeof errData.url === 'string' ? errData.url : '';\n this.status = typeof errData.status === 'number' ? errData.status : 0;\n this.response = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\n this.isAbort = !!errData.isAbort;\n }\n\n if (typeof DOMException !== 'undefined' && errData instanceof DOMException) {\n this.isAbort = true;\n }\n\n this.name = \"ClientResponseError \" + this.status;\n this.message = this.response?.message;\n if (!this.message) {\n if (this.isAbort) {\n this.message = 'The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.';\n } else if (this.originalError?.cause?.message?.includes(\"ECONNREFUSED ::1\")) {\n this.message = 'Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).';\n } else {\n this.message = 'Something went wrong while processing your request.';\n }\n }\n }\n\n /**\n * Alias for `this.response` to preserve the backward compatibility.\n */\n get data() {\n return this.response;\n }\n\n /**\n * Make a POJO's copy of the current error class instance.\n * @see https://github.com/vuex-orm/vuex-orm/issues/255\n */\n toJSON() {\n return { ...this };\n }\n}\n","let atobPolyfill: Function;\nif (typeof atob === 'function') {\n atobPolyfill = atob\n} else {\n /**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n atobPolyfill = (input: any) => {\n const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n let str = String(input).replace(/=+$/, \"\");\n if (str.length % 4 == 1) {\n throw new Error(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = \"\";\n // get next character\n (buffer = str.charAt(idx++));\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? (bs as any) * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ?\n (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) :\n 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n\n return output;\n };\n}\n\n/**\n * Returns JWT token's payload data.\n */\nexport function getTokenPayload(token: string): { [key: string]: any } {\n if (token) {\n try {\n const encodedPayload = decodeURIComponent(atobPolyfill(token.split('.')[1]).split('').map(function (c: string) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n\n return JSON.parse(encodedPayload) || {};\n } catch (e) {\n }\n }\n\n return {};\n}\n\n/**\n * Checks whether a JWT token is expired or not.\n * Tokens without `exp` payload key are considered valid.\n * Tokens with empty payload (eg. invalid token strings) are considered expired.\n *\n * @param token The token to check.\n * @param [expirationThreshold] Time in seconds that will be subtracted from the token `exp` property.\n */\nexport function isTokenExpired(token: string, expirationThreshold = 0): boolean {\n let payload = getTokenPayload(token);\n\n if (\n Object.keys(payload).length > 0 &&\n (!payload.exp || (payload.exp - expirationThreshold) > (Date.now() / 1000))\n ) {\n return false;\n }\n\n return true;\n}\n","/**\n * -------------------------------------------------------------------\n * Simple cookie parse and serialize utilities mostly based on the\n * node module https://github.com/jshttp/cookie.\n * -------------------------------------------------------------------\n */\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\nexport interface ParseOptions{\n decode?: (val: string) => string,\n}\n\n/**\n* Parses the given cookie header string into an object\n* The object has the various cookies as keys(names) => values\n*/\nexport function cookieParse(str: string, options?: ParseOptions): { [key: string]: any } {\n const result: { [key: string]: any } = {};\n\n if (typeof str !== 'string') {\n return result;\n }\n\n const opt = Object.assign({}, options || {});\n const decode = opt.decode || defaultDecode;\n\n let index = 0;\n while (index < str.length) {\n const eqIdx = str.indexOf('=', index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = str.indexOf(';', index);\n\n if (endIdx === -1) {\n endIdx = str.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1;\n continue;\n }\n\n const key = str.slice(index, eqIdx).trim();\n\n // only assign once\n if (undefined === result[key]) {\n let val = str.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n result[key] = decode(val);\n } catch (_) {\n result[key] = val; // no decoding\n }\n }\n\n index = endIdx + 1;\n }\n\n return result;\n};\n\nexport interface SerializeOptions{\n encode?: (val: string | number | boolean) => string,\n maxAge?: number,\n domain?: string,\n path?: string,\n expires?: Date,\n httpOnly?: boolean,\n secure?: boolean,\n priority?: string,\n sameSite?: boolean|string,\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * ```js\n * cookieSerialize('foo', 'bar', { httpOnly: true }) // \"foo=bar; httpOnly\"\n * ```\n */\nexport function cookieSerialize(name: string, val: string, options?: SerializeOptions): string {\n const opt = Object.assign({}, options || {});\n const encode = opt.encode || defaultEncode;\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n const value = encode(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n let result = name + '=' + value;\n\n if (opt.maxAge != null) {\n const maxAge = opt.maxAge - 0;\n\n if (isNaN(maxAge) || !isFinite(maxAge)) {\n throw new TypeError('option maxAge is invalid');\n }\n\n result += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n result += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n result += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (!isDate(opt.expires) || isNaN(opt.expires.valueOf())) {\n throw new TypeError('option expires is invalid');\n }\n\n result += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n result += '; HttpOnly';\n }\n\n if (opt.secure) {\n result += '; Secure';\n }\n\n if (opt.priority) {\n const priority = typeof opt.priority === 'string' ? opt.priority.toLowerCase() : opt.priority;\n\n switch (priority) {\n case 'low':\n result += '; Priority=Low';\n break;\n case 'medium':\n result += '; Priority=Medium';\n break;\n case 'high':\n result += '; Priority=High';\n break;\n default:\n throw new TypeError('option priority is invalid');\n }\n }\n\n if (opt.sameSite) {\n const sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n result += '; SameSite=Strict';\n break;\n case 'lax':\n result += '; SameSite=Lax';\n break;\n case 'strict':\n result += '; SameSite=Strict';\n break;\n case 'none':\n result += '; SameSite=None';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return result;\n};\n\n/**\n * Default URL-decode string value function.\n * Optimized to skip native call when no `%`.\n */\nfunction defaultDecode(val: string): string {\n return val.indexOf('%') !== -1\n ? decodeURIComponent(val)\n : val;\n}\n\n/**\n * Default URL-encode value function.\n */\nfunction defaultEncode(val: string | number | boolean): string {\n return encodeURIComponent(val);\n}\n\n/**\n * Determines if value is a Date.\n */\nfunction isDate(val: any): boolean {\n return (\n Object.prototype.toString.call(val) === '[object Date]' ||\n val instanceof Date\n );\n}\n","export default abstract class BaseModel {\n [key: string]: any,\n\n id!: string;\n created!: string;\n updated!: string;\n\n constructor(data: { [key: string]: any } = {}) {\n this.$load(data || {});\n }\n\n /**\n * Alias of this.$load(data).\n */\n load(data: { [key: string]: any }) {\n return this.$load(data);\n }\n\n /**\n * Loads `data` into the current model.\n */\n $load(data: { [key: string]: any }) {\n for (const [key, value] of Object.entries(data)) {\n this[key] = value;\n }\n\n // normalize known fields\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.created = typeof data.created !== 'undefined' ? data.created : '';\n this.updated = typeof data.updated !== 'undefined' ? data.updated : '';\n }\n\n /**\n * Returns whether the current loaded data represent a stored db record.\n */\n get $isNew(): boolean {\n return !this.id;\n }\n\n /**\n * Alias of this.clone().\n */\n clone(): BaseModel {\n return this.$clone();\n }\n\n /**\n * Creates a deep clone of the current model.\n */\n $clone(): BaseModel {\n const clone = typeof structuredClone === 'function' ?\n structuredClone(this) : JSON.parse(JSON.stringify(this));\n\n return new (this.constructor as any)(clone);\n }\n\n /**\n * Alias of this.$export().\n */\n export(): { [key: string]: any } {\n return this.$export();\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n $export(): { [key: string]: any } {\n return typeof structuredClone === 'function' ?\n structuredClone(this) : Object.assign({}, this);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Record extends BaseModel {\n collectionId!: string;\n collectionName!: string;\n expand!: {[key: string]: Record|Array};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // normalize common fields\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.collectionName = typeof data.collectionName === 'string' ? data.collectionName : '';\n\n // normalize expand items\n this._loadExpand(data.expand);\n }\n\n /**\n * Loads the provided expand items and recursively normalizes each\n * item to a `Record|Array`.\n */\n private _loadExpand(expand: { [key: string]: any }) {\n expand = expand || {};\n this.expand = {};\n\n for (const key in expand) {\n if (Array.isArray(expand[key])) {\n this.expand[key] = expand[key].map((data: any) => new Record(data || {}));\n } else {\n this.expand[key] = new Record(expand[key] || {});\n }\n }\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Admin extends BaseModel {\n avatar!: number;\n email!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.avatar = typeof data.avatar === 'number' ? data.avatar : 0;\n this.email = typeof data.email === 'string' ? data.email : '';\n }\n}\n","import { cookieParse, cookieSerialize, SerializeOptions } from '@/stores/utils/cookie';\nimport { isTokenExpired, getTokenPayload } from '@/stores/utils/jwt';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\nexport type OnStoreChangeFunc = (token: string, model: Record|Admin|null) => void;\n\nconst defaultCookieKey = 'pb_auth';\n\n/**\n * Base AuthStore class that is intended to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore {\n protected baseToken: string = '';\n protected baseModel: Record|Admin|null = null;\n\n private _onChangeCallbacks: Array = [];\n\n /**\n * Retrieves the stored token (if any).\n */\n get token(): string {\n return this.baseToken;\n }\n\n /**\n * Retrieves the stored model data (if any).\n */\n get model(): Record|Admin|null {\n return this.baseModel;\n }\n\n /**\n * Loosely checks if the store has valid token (aka. existing and unexpired exp claim).\n */\n get isValid(): boolean {\n return !isTokenExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: Record|Admin|null): void {\n this.baseToken = token || '';\n\n // normalize the model instance\n if (model !== null && typeof model === 'object') {\n this.baseModel = typeof (model as any).collectionId !== 'undefined' ?\n new Record(model) : new Admin(model);\n } else {\n this.baseModel = null;\n }\n\n this.triggerChange();\n }\n\n /**\n * Removes the stored token and model data form the auth store.\n */\n clear(): void {\n this.baseToken = '';\n this.baseModel = null;\n this.triggerChange();\n }\n\n /**\n * Parses the provided cookie string and updates the store state\n * with the cookie's token and model data.\n *\n * NB! This function doesn't validate the token or its data.\n * Usually this isn't a concern if you are interacting only with the\n * PocketBase API because it has the proper server-side security checks in place,\n * but if you are using the store `isValid` state for permission controls\n * in a node server (eg. SSR), then it is recommended to call `authRefresh()`\n * after loading the cookie to ensure an up-to-date token and model state.\n * For example:\n *\n * ```js\n * pb.authStore.loadFromCookie(\"cookie string...\");\n *\n * try {\n * // get an up-to-date auth store state by veryfing and refreshing the loaded auth model (if any)\n * pb.authStore.isValid && await pb.collection('users').authRefresh();\n * } catch (_) {\n * // clear the auth store on failed refresh\n * pb.authStore.clear();\n * }\n * ```\n */\n loadFromCookie(cookie: string, key = defaultCookieKey): void {\n const rawData = cookieParse(cookie || '')[key] || '';\n\n let data: { [key: string]: any } = {};\n try {\n data = JSON.parse(rawData);\n // normalize\n if (typeof data === null || typeof data !== 'object' || Array.isArray(data)) {\n data = {};\n }\n } catch (_) {}\n\n this.save(data.token || '', data.model || null);\n }\n\n /**\n * Exports the current store state as cookie string.\n *\n * By default the following optional attributes are added:\n * - Secure\n * - HttpOnly\n * - SameSite=Strict\n * - Path=/\n * - Expires={the token expiration date}\n *\n * NB! If the generated cookie exceeds 4096 bytes, this method will\n * strip the model data to the bare minimum to try to fit within the\n * recommended size in https://www.rfc-editor.org/rfc/rfc6265#section-6.1.\n */\n exportToCookie(options?: SerializeOptions, key = defaultCookieKey): string {\n const defaultOptions: SerializeOptions = {\n secure: true,\n sameSite: true,\n httpOnly: true,\n path: \"/\",\n };\n\n // extract the token expiration date\n const payload = getTokenPayload(this.token);\n if (payload?.exp) {\n defaultOptions.expires = new Date(payload.exp * 1000);\n } else {\n defaultOptions.expires = new Date('1970-01-01');\n }\n\n // merge with the user defined options\n options = Object.assign({}, defaultOptions, options);\n\n const rawData = {\n token: this.token,\n model: this.model?.export() || null,\n };\n\n let result = cookieSerialize(key, JSON.stringify(rawData), options);\n\n const resultLength = typeof Blob !== 'undefined' ?\n (new Blob([result])).size : result.length;\n\n // strip down the model data to the bare minimum\n if (rawData.model && resultLength > 4096) {\n rawData.model = {id: rawData?.model?.id, email: rawData?.model?.email};\n if (this.model instanceof Record) {\n rawData.model.username = this.model.username;\n rawData.model.verified = this.model.verified;\n rawData.model.collectionId = this.model.collectionId;\n }\n result = cookieSerialize(key, JSON.stringify(rawData), options);\n }\n\n return result;\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * You can set the `fireImmediately` argument to true in order to invoke\n * the provided callback right after registration.\n *\n * Returns a removal function that you could call to \"unsubscribe\" from the changes.\n */\n onChange(callback: OnStoreChangeFunc, fireImmediately = false): () => void {\n this._onChangeCallbacks.push(callback);\n\n if (fireImmediately) {\n callback(this.token, this.model);\n }\n\n return () => {\n for (let i = this._onChangeCallbacks.length - 1; i >= 0; i--) {\n if (this._onChangeCallbacks[i] == callback) {\n delete this._onChangeCallbacks[i]; // removes the function reference\n this._onChangeCallbacks.splice(i, 1); // reindex the array\n return;\n }\n }\n }\n }\n\n protected triggerChange(): void {\n for (const callback of this._onChangeCallbacks) {\n callback && callback(this.token, this.model);\n }\n }\n}\n","import BaseAuthStore from '@/stores/BaseAuthStore';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\n/**\n * The default token store for browsers with auto fallback\n * to runtime/memory if local storage is undefined (eg. in node env).\n */\nexport default class LocalAuthStore extends BaseAuthStore {\n private storageFallback: { [key: string]: any } = {};\n private storageKey: string\n\n constructor(storageKey = \"pocketbase_auth\") {\n super();\n\n this.storageKey = storageKey;\n }\n\n /**\n * @inheritdoc\n */\n get token(): string {\n const data = this._storageGet(this.storageKey) || {};\n\n return data.token || '';\n }\n\n /**\n * @inheritdoc\n */\n get model(): Record|Admin|null {\n const data = this._storageGet(this.storageKey) || {};\n\n if (\n data === null ||\n typeof data !== 'object' ||\n data.model === null ||\n typeof data.model !== 'object'\n ) {\n return null;\n }\n\n // admins don't have `collectionId` prop\n if (typeof data.model?.collectionId === 'undefined') {\n return new Admin(data.model);\n }\n\n return new Record(data.model);\n }\n\n /**\n * @inheritdoc\n */\n save(token: string, model: Record|Admin|null) {\n this._storageSet(this.storageKey, {\n 'token': token,\n 'model': model,\n });\n\n super.save(token, model);\n }\n\n /**\n * @inheritdoc\n */\n clear() {\n this._storageRemove(this.storageKey);\n\n super.clear();\n }\n\n // ---------------------------------------------------------------\n // Internal helpers:\n // ---------------------------------------------------------------\n\n /**\n * Retrieves `key` from the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageGet(key: string): any {\n if (typeof window !== 'undefined' && window?.localStorage) {\n const rawValue = window.localStorage.getItem(key) || '';\n try {\n return JSON.parse(rawValue);\n } catch (e) { // not a json\n return rawValue;\n }\n }\n\n // fallback\n return this.storageFallback[key];\n }\n\n /**\n * Stores a new data in the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageSet(key: string, value: any) {\n if (typeof window !== 'undefined' && window?.localStorage) {\n // store in local storage\n let normalizedVal = value;\n if (typeof value !== 'string') {\n normalizedVal = JSON.stringify(value);\n }\n window.localStorage.setItem(key, normalizedVal);\n } else {\n // store in fallback\n this.storageFallback[key] = value;\n }\n }\n\n /**\n * Removes `key` from the browser's local storage and the runtime/memory.\n */\n private _storageRemove(key: string) {\n // delete from local storage\n if (typeof window !== 'undefined' && window?.localStorage) {\n window.localStorage?.removeItem(key);\n }\n\n // delete from fallback\n delete this.storageFallback[key];\n }\n}\n","import Client from '@/Client';\n\n/**\n * BaseService class that should be inherited from all API services.\n */\nexport default abstract class BaseService {\n readonly client: Client\n\n constructor(client: Client) {\n this.client = client;\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\ninterface appleClientSecret {\n secret: string;\n}\n\nexport default class SettingsService extends BaseService {\n /**\n * Fetch all available app settings.\n */\n getAll(queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Bulk updates app settings.\n */\n update(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Performs a S3 filesystem connection test.\n *\n * The currently supported `filesystem` are \"storage\" and \"backups\".\n */\n testS3(filesystem: string = \"storage\", queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'filesystem': filesystem,\n };\n\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends a test email.\n *\n * The possible `emailTemplate` values are:\n * - verification\n * - password-reset\n * - email-change\n */\n testEmail(toEmail: string, emailTemplate: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'email': toEmail,\n 'template': emailTemplate,\n };\n\n return this.client.send('/api/settings/test/email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Generates a new Apple OAuth2 client secret.\n */\n generateAppleClientSecret(\n clientId: string,\n teamId: string,\n keyId: string,\n privateKey: string,\n duration: number,\n bodyParams = {},\n queryParams: BaseQueryParams = {}\n ): Promise {\n bodyParams = Object.assign({\n clientId,\n teamId,\n keyId,\n privateKey,\n duration,\n }, bodyParams);\n\n return this.client.send('/api/settings/apple/generate-client-secret', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n });\n }\n}\n","import BaseModel from './BaseModel';\n\nexport default class ListResult {\n page!: number;\n perPage!: number;\n totalItems!: number;\n totalPages!: number;\n items!: Array;\n\n constructor(\n page: number,\n perPage: number,\n totalItems: number,\n totalPages: number,\n items: Array,\n ) {\n this.page = page > 0 ? page : 1;\n this.perPage = perPage >= 0 ? perPage : 0;\n this.totalItems = totalItems >= 0 ? totalItems : 0;\n this.totalPages = totalPages >= 0 ? totalPages : 0;\n this.items = items || [];\n }\n}\n","import ListResult from '@/models/utils/ListResult';\nimport BaseModel from '@/models/utils/BaseModel';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n FullListQueryParams\n} from '@/services/utils/QueryParams';\n\nexport default abstract class CrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/admins').\n */\n abstract get baseCrudPath(): string\n\n /**\n * Returns a promise with all list items batch fetched at once\n * (by default 200 items per request; to change it set the `batch` query param).\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(queryParams?: FullListQueryParams): Promise>\n\n /**\n * Legacy version of getFullList with explicitly specified batch size.\n */\n getFullList(batch?: number, queryParams?: ListQueryParams): Promise>\n\n getFullList(batchOrqueryParams?: number|FullListQueryParams, queryParams?: ListQueryParams): Promise> {\n if (typeof batchOrqueryParams == \"number\") {\n return this._getFullList(this.baseCrudPath, batchOrqueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrqueryParams, queryParams);\n\n return this._getFullList(this.baseCrudPath, params.batch || 200, params);\n }\n\n /**\n * Returns paginated items list.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n return this._getList(this.baseCrudPath, page, perPage, queryParams);\n }\n\n /**\n * Returns the first found item by the specified filter.\n *\n * Internally it calls `getList(1, 1, { filter })` and returns the\n * first found item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n *\n * For consistency with `getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n getFirstListItem(filter: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getFirstListItem(this.baseCrudPath, filter, queryParams);\n }\n\n /**\n * Returns single item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getOne(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getOne(this.baseCrudPath, id, queryParams);\n }\n\n /**\n * Creates a new item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n create(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._create(this.baseCrudPath, bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._update(this.baseCrudPath, id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._delete(this.baseCrudPath, id, queryParams);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\nimport {\n BaseQueryParams,\n ListQueryParams\n} from '@/services/utils/QueryParams';\n\n// @todo since there is no longer need of SubCrudService consider merging with CrudService in v0.9+\nexport default abstract class BaseCrudService extends BaseService {\n /**\n * Response data decoder.\n */\n abstract decode(data: { [key: string]: any }): M\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n protected _getFullList(basePath: string, batchSize = 200, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize || 200, queryParams).then((list) => {\n const castedList = (list as any as ListResult);\n const items = castedList.items;\n const totalItems = castedList.totalItems;\n\n result = result.concat(items);\n\n if (items.length && totalItems > result.length) {\n return request(page + 1);\n }\n\n return result;\n });\n }\n\n return request(1);\n }\n\n /**\n * Returns paginated items list.\n */\n protected _getList(basePath: string, page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send(basePath, {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData.items || [];\n for (const item of responseData.items) {\n items.push(this.decode(item) as any as T);\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns single item by its id.\n */\n protected _getOne(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Returns the first found item by a list filter.\n *\n * Internally it calls `_getList(basePath, 1, 1, { filter })` and returns its\n * first item.\n *\n * For consistency with `_getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n protected _getFirstListItem(basePath: string, filter: string, queryParams: BaseQueryParams = {}): Promise {\n queryParams = Object.assign({\n 'filter': filter,\n '$cancelKey': 'one_by_filter_' + basePath + \"_\" + filter,\n }, queryParams);\n\n return this._getList(basePath, 1, 1, queryParams)\n .then((result) => {\n if (!result?.items?.length) {\n throw new ClientResponseError({\n status: 404,\n data: {\n code: 404,\n message: \"The requested resource wasn't found.\",\n data: {},\n },\n });\n }\n\n return result.items[0];\n });\n }\n\n /**\n * Creates a new item.\n */\n protected _create(basePath: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath, {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Updates an existing item by its id.\n */\n protected _update(basePath: string, id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n protected _delete(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n}\n","import Admin from '@/models/Admin';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface AdminAuthResponse {\n [key: string]: any;\n\n token: string;\n admin: Admin;\n}\n\nexport default class AdminService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Admin {\n return new Admin(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/admins';\n }\n\n // ---------------------------------------------------------------\n // Post update/delete AuthStore sync\n // ---------------------------------------------------------------\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n // update the store state if the updated item id matches with the stored model\n if (\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === item?.id\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n // clear the store state if the deleted item id matches with the stored model\n if (\n success &&\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === id\n ) {\n this.client.authStore.clear();\n }\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful authorize response.\n */\n protected authResponse(responseData: any): AdminAuthResponse {\n const admin = this.decode(responseData?.admin || {});\n\n if (responseData?.token && responseData?.admin) {\n this.client.authStore.save(responseData.token, admin);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'admin': admin,\n });\n }\n\n /**\n * Authenticate an admin account with its email and password\n * and returns a new admin token and data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authWithPassword(\n email: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'identity': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Refreshes the current admin authenticated instance and\n * returns a new token and admin data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authRefresh(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCrudPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends admin password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms admin password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class ExternalAuth extends BaseModel {\n recordId!: string;\n collectionId!: string;\n provider!: string;\n providerId!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.recordId = typeof data.recordId === 'string' ? data.recordId : '';\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.provider = typeof data.provider === 'string' ? data.provider : '';\n this.providerId = typeof data.providerId === 'string' ? data.providerId : '';\n }\n}\n","import Client from '@/Client';\nimport ClientResponseError from '@/ClientResponseError';\nimport Record from '@/models/Record';\nimport ExternalAuth from '@/models/ExternalAuth';\nimport ListResult from '@/models/utils/ListResult';\nimport CrudService from '@/services/utils/CrudService';\nimport { UnsubscribeFunc } from '@/services/RealtimeService';\nimport {\n BaseQueryParams,\n RecordQueryParams,\n RecordListQueryParams,\n RecordFullListQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface RecordAuthResponse {\n record: T;\n token: string;\n meta?: {[key: string]: any};\n}\n\nexport interface AuthProviderInfo {\n name: string;\n state: string;\n codeVerifier: string;\n codeChallenge: string;\n codeChallengeMethod: string;\n authUrl: string;\n}\n\nexport interface AuthMethodsList {\n usernamePassword: boolean;\n emailPassword: boolean;\n authProviders: Array;\n}\n\nexport interface RecordSubscription {\n action: string; // eg. create, update, delete\n record: T;\n}\n\nexport type OAuth2UrlCallback = (url: string) => void|Promise;\n\nexport interface OAuth2AuthConfig {\n // the name of the OAuth2 provider (eg. \"google\")\n provider: string;\n\n // custom scopes to overwrite the default ones\n scopes?: Array;\n\n // optional record create data\n createData?: {[key: string]: any};\n\n // optional callback that is triggered after the OAuth2 sign-in/sign-up url generation\n urlCallback?: OAuth2UrlCallback;\n\n // optional query params to send with the PocketBase auth request (eg. fields, expand, etc.)\n query?: RecordQueryParams;\n\n // optional body params to send with the PocketBase auth request\n body?: {[key: string]: any};\n}\n\nexport default class RecordService extends CrudService {\n readonly collectionIdOrName: string;\n\n constructor(client: Client, collectionIdOrName: string) {\n super(client);\n\n this.collectionIdOrName = collectionIdOrName;\n }\n\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): T {\n return new Record(data) as any as T;\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return this.baseCollectionPath + '/records';\n }\n\n /**\n * Returns the current collection service base path.\n */\n get baseCollectionPath(): string {\n return '/api/collections/' + encodeURIComponent(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Realtime handlers\n // ---------------------------------------------------------------\n\n /**\n * @deprecated Use subscribe(recordId, callback) instead.\n *\n * Subscribe to the realtime changes of a single record in the collection.\n */\n async subscribeOne(recordId: string, callback: (data: RecordSubscription) => void): Promise {\n console.warn(\"PocketBase: subscribeOne(recordId, callback) is deprecated. Please replace it with subscribe(recordId, callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName + \"/\" + recordId, callback);\n }\n\n /**\n * @deprecated This form of subscribe is deprecated. Please use `subscribe(\"*\", callback)`.\n */\n async subscribe(callback: (data: RecordSubscription) => void): Promise\n\n /**\n * Subscribe to realtime changes to the specified topic (\"*\" or record id).\n *\n * If `topic` is the wildcard \"*\", then this method will subscribe to\n * any record changes in the collection.\n *\n * If `topic` is a record id, then this method will subscribe only\n * to changes of the specified record id.\n *\n * It's OK to subscribe multiple times to the same topic.\n * You can use the returned `UnsubscribeFunc` to remove only a single subscription.\n * Or use `unsubscribe(topic)` if you want to remove all subscriptions attached to the topic.\n */\n async subscribe(topic: string, callback: (data: RecordSubscription) => void): Promise\n\n async subscribe(\n topicOrCallback: string|((data: RecordSubscription) => void),\n callback?: (data: RecordSubscription) => void\n ): Promise {\n if (typeof topicOrCallback === 'function') {\n console.warn(\"PocketBase: subscribe(callback) is deprecated. Please replace it with subscribe('*', callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName, topicOrCallback);\n }\n\n if (!callback) {\n throw new Error(\"Missing subscription callback.\");\n }\n\n if (topicOrCallback === \"\") {\n throw new Error(\"Missing topic.\");\n }\n\n let topic = this.collectionIdOrName;\n if (topicOrCallback !== \"*\") {\n topic += ('/' + topicOrCallback);\n }\n\n return this.client.realtime.subscribe(topic, callback)\n }\n\n /**\n * Unsubscribe from all subscriptions of the specified topic\n * (\"*\" or record id).\n *\n * If `topic` is not set, then this method will unsubscribe from\n * all subscriptions associated to the current collection.\n */\n async unsubscribe(topic?: string): Promise {\n // unsubscribe wildcard topic\n if (topic === \"*\") {\n return this.client.realtime.unsubscribe(this.collectionIdOrName);\n }\n\n // unsubscribe recordId topic\n if (topic) {\n return this.client.realtime.unsubscribe(this.collectionIdOrName + \"/\" + topic);\n }\n\n // unsubscribe from everything related to the collection\n return this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Crud handers\n // ---------------------------------------------------------------\n /**\n * @inheritdoc\n */\n getFullList(queryParams?: RecordFullListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batch?: number, queryParams?: RecordListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batchOrQueryParams?: number|RecordFullListQueryParams, queryParams?: RecordListQueryParams): Promise> {\n if (typeof batchOrQueryParams == \"number\") {\n return super.getFullList(batchOrQueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrQueryParams, queryParams);\n\n return super.getFullList(params);\n }\n\n /**\n * @inheritdoc\n */\n getList(page = 1, perPage = 30, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getList(page, perPage, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getFirstListItem(filter: string, queryParams: RecordListQueryParams = {}): Promise {\n return super.getFirstListItem(filter, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getOne(id: string, queryParams: RecordQueryParams = {}): Promise {\n return super.getOne(id, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n create(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.create(bodyParams, queryParams);\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n if (\n // is record auth\n this.client.authStore.model?.id === item?.id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n if (\n success &&\n // is record auth\n this.client.authStore.model?.id === id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.clear();\n }\n\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful collection authorization response.\n */\n protected authResponse(responseData: any): RecordAuthResponse {\n const record = this.decode(responseData?.record || {});\n\n this.client.authStore.save(responseData?.token, record);\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'record': record as any as T,\n });\n }\n\n /**\n * Returns all available collection auth methods.\n */\n listAuthMethods(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCollectionPath + '/auth-methods', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n return Object.assign({}, responseData, {\n // normalize common fields\n 'usernamePassword': !!responseData?.usernamePassword,\n 'emailPassword': !!responseData?.emailPassword,\n 'authProviders': Array.isArray(responseData?.authProviders) ? responseData?.authProviders : [],\n });\n });\n }\n\n /**\n * Authenticate a single auth collection record via its username/email and password.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n */\n authWithPassword(\n usernameOrEmail: string,\n password: string,\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'identity': usernameOrEmail,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2 code.\n *\n * If you don't have an OAuth2 code you may also want to check `authWithOAuth2` method.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n */\n authWithOAuth2Code(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData = {},\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'provider': provider,\n 'code': code,\n 'codeVerifier': codeVerifier,\n 'redirectUrl': redirectUrl,\n 'createData': createData,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-oauth2', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * @deprecated This form of authWithOAuth2 is deprecated.\n *\n * Please use `authWithOAuth2Code()` OR its simplified realtime version\n * as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\n */\n async authWithOAuth2(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData?: {[key: string]: any},\n bodyParams?: {[key: string]: any},\n queryParams?: RecordQueryParams,\n ): Promise>\n\n /**\n * Authenticate a single auth collection record with OAuth2\n * **without custom redirects, deeplinks or even page reload**.\n *\n * This method initializes a one-off realtime subscription and will\n * open a popup window with the OAuth2 vendor page to authenticate.\n * Once the external OAuth2 sign-in/sign-up flow is completed, the popup\n * window will be automatically closed and the OAuth2 data sent back\n * to the user through the previously established realtime connection.\n *\n * You can specify an optional `urlCallback` prop to customize\n * the default url `window.open` behavior.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n *\n * Example:\n *\n * ```js\n * const authData = await pb.collection(\"users\").authWithOAuth2({\n * provider: \"google\",\n * })\n * ```\n *\n * _Site-note_: when creating the OAuth2 app in the provider dashboard\n * you have to configure `https://yourdomain.com/api/oauth2-redirect`\n * as redirect URL.\n */\n async authWithOAuth2(options: OAuth2AuthConfig): Promise>\n\n async authWithOAuth2(...args: any): Promise> {\n // fallback to legacy format\n if (args.length > 1 || typeof args?.[0] === 'string') {\n console.warn(\"PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\");\n return this.authWithOAuth2Code(\n args?.[0] || '',\n args?.[1] || '',\n args?.[2] || '',\n args?.[3] || '',\n args?.[4] || {},\n args?.[5] || {},\n args?.[6] || {},\n );\n }\n\n const config = args?.[0] || {};\n\n const authMethods = await this.listAuthMethods();\n\n const provider = authMethods.authProviders.find((p) => p.name === config.provider);\n if (!provider) {\n throw new ClientResponseError(new Error(`Missing or invalid provider \"${config.provider}\".`));\n }\n\n const redirectUrl = this.client.buildUrl('/api/oauth2-redirect');\n\n return new Promise(async (resolve, reject) => {\n try {\n // initialize a one-off @oauth2 realtime subscription\n const unsubscribe = await this.client.realtime.subscribe('@oauth2', async (e) => {\n const oldState = this.client.realtime.clientId;\n\n try {\n unsubscribe();\n\n if (!e.state || oldState !== e.state) {\n throw new Error(\"State parameters don't match.\");\n }\n\n const authData = await this.authWithOAuth2Code(\n provider.name,\n e.code,\n provider.codeVerifier,\n redirectUrl,\n config.createData,\n config.body,\n config.query,\n )\n\n resolve(authData);\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n\n const url = new URL(provider.authUrl + redirectUrl);\n url.searchParams.set(\"state\", this.client.realtime.clientId);\n if (config.scopes?.length) {\n url.searchParams.set(\"scope\", config.scopes.join(\" \"));\n }\n\n await (config.urlCallback ? config.urlCallback(url.toString()) : this._defaultUrlCallback(url.toString()));\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n }\n\n /**\n * Refreshes the current authenticated record instance and\n * returns a new token and record data.\n *\n * On success this method also automatically updates the client's AuthStore.\n */\n authRefresh(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise> {\n return this.client.send(this.baseCollectionPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Sends auth record password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends auth record verification email request.\n */\n requestVerification(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record email verification request.\n */\n confirmVerification(\n verificationToken: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': verificationToken,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends an email change request to the authenticated record model.\n */\n requestEmailChange(\n newEmail: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'newEmail': newEmail,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record's new email address.\n */\n confirmEmailChange(\n emailChangeToken: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': emailChangeToken,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Lists all linked external auth providers for the specified auth record.\n */\n listExternalAuths(\n recordId: string,\n queryParams: BaseQueryParams = {}\n ): Promise> {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => {\n const items: Array = [];\n\n if (Array.isArray(responseData)) {\n for (const item of responseData) {\n items.push(new ExternalAuth(item));\n }\n }\n\n return items;\n });\n }\n\n /**\n * Unlink a single external auth provider from the specified auth record.\n */\n unlinkExternalAuth(\n recordId: string,\n provider: string,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths/' + encodeURIComponent(provider), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n // ---------------------------------------------------------------\n\n private _defaultUrlCallback(url: string) {\n if (typeof window === \"undefined\" || !window?.open) {\n throw new ClientResponseError(new Error(`Not in a browser context - please pass a custom urlCallback function.`));\n }\n\n let width = 1024;\n let height = 768;\n\n let windowWidth = window.innerWidth;\n let windowHeight = window.innerHeight;\n\n // normalize window size\n width = width > windowWidth ? windowWidth : width;\n height = height > windowHeight ? windowHeight : height;\n\n let left = (windowWidth / 2) - (width / 2);\n let top = (windowHeight / 2) - (height / 2);\n\n window.open(\n url,\n \"oauth2-popup\",\n 'width='+width+',height='+height+',top='+top+',left='+left+',resizable,menubar=no'\n );\n }\n}\n","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.name = typeof data.name !== 'undefined' ? data.name : '';\n this.type = typeof data.type !== 'undefined' ? data.type : 'text';\n this.system = !!data.system;\n this.required = !!data.required;\n this.options = typeof data.options === 'object' && data.options !== null ? data.options : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport SchemaField from '@/models/utils/SchemaField';\n\nexport default class Collection extends BaseModel {\n name!: string;\n type!: string;\n schema!: Array;\n indexes!: Array;\n system!: boolean;\n listRule!: null|string;\n viewRule!: null|string;\n createRule!: null|string;\n updateRule!: null|string;\n deleteRule!: null|string;\n options!: {[key:string]: any};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.system = !!data.system;\n this.name = typeof data.name === 'string' ? data.name : '';\n this.type = typeof data.type === 'string' ? data.type : 'base';\n this.options = typeof data.options !== 'undefined' && data.options !== null ? data.options : {};\n this.indexes = Array.isArray(data.indexes) ? data.indexes : [];\n\n // rules\n this.listRule = typeof data.listRule === 'string' ? data.listRule : null;\n this.viewRule = typeof data.viewRule === 'string' ? data.viewRule : null;\n this.createRule = typeof data.createRule === 'string' ? data.createRule : null;\n this.updateRule = typeof data.updateRule === 'string' ? data.updateRule : null;\n this.deleteRule = typeof data.deleteRule === 'string' ? data.deleteRule : null;\n\n // schema\n data.schema = Array.isArray(data.schema) ? data.schema : [];\n this.schema = [];\n for (let field of data.schema) {\n this.schema.push(new SchemaField(field));\n }\n }\n\n /**\n * @deprecated Please use $isBase instead.\n */\n get isBase(): boolean {\n return this.$isBase;\n }\n\n /**\n * Checks if the current model is \"base\" collection.\n */\n get $isBase(): boolean {\n return this.type === 'base';\n }\n\n /**\n * @deprecated Please use $isAuth instead.\n */\n get isAuth(): boolean {\n return this.$isAuth;\n }\n\n /**\n * Checks if the current model is \"auth\" collection.\n */\n get $isAuth(): boolean {\n return this.type === 'auth';\n }\n\n /**\n * @deprecated Please use $isView instead.\n */\n get isView(): boolean {\n return this.$isView;\n }\n\n /**\n * Checks if the current model is \"view\" collection.\n */\n get $isView(): boolean {\n return this.type === 'view';\n }\n}\n","import Collection from '@/models/Collection';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport default class CollectionService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Collection {\n return new Collection(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/collections';\n }\n\n /**\n * Imports the provided collections.\n *\n * If `deleteMissing` is `true`, all local collections and schema fields,\n * that are not present in the imported configuration, WILL BE DELETED\n * (including their related records data)!\n */\n async import(\n collections: Array,\n deleteMissing: boolean = false,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/import', {\n 'method': 'PUT',\n 'params': queryParams,\n 'body': {\n 'collections': collections,\n 'deleteMissing': deleteMissing,\n }\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class LogRequest extends BaseModel {\n url!: string;\n method!: string;\n status!: number;\n auth!: string;\n remoteIp!: string;\n userIp!: string;\n referer!: string;\n userAgent!: string;\n meta!: { [key: string]: any };\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // fallback to the ip field for backward compatibility\n data.remoteIp = data.remoteIp || data.ip;\n\n this.url = typeof data.url === 'string' ? data.url : '';\n this.method = typeof data.method === 'string' ? data.method : 'GET';\n this.status = typeof data.status === 'number' ? data.status : 200;\n this.auth = typeof data.auth === 'string' ? data.auth : 'guest';\n this.remoteIp = typeof data.remoteIp === 'string' ? data.remoteIp : '';\n this.userIp = typeof data.userIp === 'string' ? data.userIp : '';\n this.referer = typeof data.referer === 'string' ? data.referer : '';\n this.userAgent = typeof data.userAgent === 'string' ? data.userAgent : '';\n this.meta = typeof data.meta === 'object' && data.meta !== null ? data.meta : {};\n }\n}\n","import LogRequest from '@/models/LogRequest';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n LogStatsQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface HourlyStats {\n total: number;\n date: string;\n}\n\nexport default class LogService extends BaseService {\n /**\n * Returns paginated logged requests list.\n */\n getRequestsList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send('/api/logs/requests', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData?.items || [];\n for (const item of responseData.items) {\n items.push(new LogRequest(item));\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns a single logged request by its id.\n */\n getRequest(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/logs/requests/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => new LogRequest(responseData));\n }\n\n /**\n * Returns request logs statistics.\n */\n getRequestsStats(queryParams: LogStatsQueryParams = {}): Promise> {\n return this.client.send('/api/logs/requests/stats', {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => responseData);\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\n\ninterface promiseCallbacks {\n resolve: Function\n reject: Function\n}\n\nexport type UnsubscribeFunc = () => Promise;\n\nexport default class RealtimeService extends BaseService {\n clientId: string = \"\";\n\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 15000;\n private reconnectTimeoutId: any;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number = Infinity;\n private predefinedReconnectIntervals: Array = [\n 200, 300, 500, 1000, 1200, 1500, 2000,\n ];\n private pendingConnects: Array = [];\n\n\n /**\n * Returns whether the realtime connection has been established.\n */\n get isConnected(): boolean {\n return !!this.eventSource && !!this.clientId && !this.pendingConnects.length;\n }\n\n /**\n * Register the subscription listener.\n *\n * You can subscribe multiple times to the same topic.\n *\n * If the SSE connection is not started yet,\n * this method will also initialize it.\n */\n async subscribe(topic: string, callback: (data: any) => void): Promise {\n if (!topic) {\n throw new Error('topic must be set.')\n }\n\n const listener = function (e: Event) {\n const msgEvent = (e as MessageEvent);\n\n let data;\n try {\n data = JSON.parse(msgEvent?.data);\n } catch {}\n\n callback(data || {});\n };\n\n // store the listener\n if (!this.subscriptions[topic]) {\n this.subscriptions[topic] = [];\n }\n this.subscriptions[topic].push(listener);\n\n if (!this.isConnected) {\n // initialize sse connection\n await this.connect();\n } else if (this.subscriptions[topic].length === 1) {\n // send the updated subscriptions (if it is the first for the topic)\n await this.submitSubscriptions();\n } else {\n // only register the listener\n this.eventSource?.addEventListener(topic, listener);\n }\n\n return async (): Promise => {\n return this.unsubscribeByTopicAndListener(topic, listener);\n };\n }\n\n /**\n * Unsubscribe from all subscription listeners with the specified topic.\n *\n * If `topic` is not provided, then this method will unsubscribe\n * from all active subscriptions.\n *\n * This method is no-op if there are no active subscriptions.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribe(topic?: string): Promise {\n if (!this.hasSubscriptionListeners(topic)) {\n return; // already unsubscribed\n }\n\n if (!topic) {\n // remove all subscriptions\n this.subscriptions = {};\n } else {\n // remove all topic listeners\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n /**\n * Unsubscribe from all subscription listeners starting with the specified topic prefix.\n *\n * This method is no-op if there are no active subscriptions with the specified topic prefix.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByPrefix(topicPrefix: string): Promise {\n let hasAtleastOneTopic = false;\n for (let topic in this.subscriptions) {\n if (!topic.startsWith(topicPrefix)) {\n continue;\n }\n\n hasAtleastOneTopic = true;\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!hasAtleastOneTopic) {\n return; // nothing to unsubscribe from\n }\n\n if (this.hasSubscriptionListeners()) {\n // submit the deleted subscriptions\n await this.submitSubscriptions();\n } else {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n }\n }\n\n /**\n * Unsubscribe from all subscriptions matching the specified topic and listener function.\n *\n * This method is no-op if there are no active subscription with\n * the specified topic and listener.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByTopicAndListener(topic: string, listener: EventListener): Promise {\n if (!Array.isArray(this.subscriptions[topic]) || !this.subscriptions[topic].length) {\n return; // already unsubscribed\n }\n\n let exist = false;\n for (let i = this.subscriptions[topic].length - 1; i >= 0; i--) {\n if (this.subscriptions[topic][i] !== listener) {\n continue;\n }\n\n exist = true; // has at least one matching listener\n delete this.subscriptions[topic][i]; // removes the function reference\n this.subscriptions[topic].splice(i, 1); // reindex the array\n this.eventSource?.removeEventListener(topic, listener);\n }\n if (!exist) {\n return;\n }\n\n // remove the topic from the subscriptions list if there are no other listeners\n if (!this.subscriptions[topic].length) {\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n private hasSubscriptionListeners(topicToCheck?: string): boolean {\n this.subscriptions = this.subscriptions || {};\n\n // check the specified topic\n if (topicToCheck) {\n return !!this.subscriptions[topicToCheck]?.length;\n }\n\n // check for at least one non-empty topic\n for (let topic in this.subscriptions) {\n if (!!this.subscriptions[topic]?.length) {\n return true\n }\n }\n\n return false;\n }\n\n private async submitSubscriptions(): Promise {\n if (!this.clientId) {\n return; // no client/subscriber\n }\n\n // optimistic update\n this.addAllSubscriptionListeners();\n\n this.lastSentTopics = this.getNonEmptySubscriptionTopics();\n\n return this.client.send('/api/realtime', {\n 'method': 'POST',\n 'body': {\n 'clientId': this.clientId,\n 'subscriptions': this.lastSentTopics,\n },\n 'params': {\n '$cancelKey': this.getSubscriptionsCancelKey(),\n },\n }).catch((err) => {\n if (err?.isAbort) {\n return; // silently ignore aborted pending requests\n }\n throw err;\n });\n }\n\n private getSubscriptionsCancelKey(): string {\n return \"realtime_\" + this.clientId;\n }\n\n private getNonEmptySubscriptionTopics(): Array {\n const result : Array = [];\n\n for (let topic in this.subscriptions) {\n if (this.subscriptions[topic].length) {\n result.push(topic);\n }\n }\n\n return result;\n }\n\n private addAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n this.removeAllSubscriptionListeners();\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.addEventListener(topic, listener);\n }\n }\n }\n\n private removeAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.removeEventListener(topic, listener);\n }\n }\n }\n\n private async connect(): Promise {\n if (this.reconnectAttempts > 0) {\n // immediately resolve the promise to avoid indefinitely\n // blocking the client during reconnection\n return;\n }\n\n return new Promise((resolve, reject) => {\n this.pendingConnects.push({ resolve, reject });\n\n if (this.pendingConnects.length > 1) {\n // all promises will be resolved once the connection is established\n return;\n }\n\n this.initConnect();\n })\n }\n\n private initConnect() {\n this.disconnect(true);\n\n // wait up to 15s for connect\n clearTimeout(this.connectTimeoutId);\n this.connectTimeoutId = setTimeout(() => {\n this.connectErrorHandler(new Error(\"EventSource connect took too long.\"));\n }, this.maxConnectTimeout);\n\n this.eventSource = new EventSource(this.client.buildUrl('/api/realtime'))\n\n this.eventSource.onerror = (_) => {\n this.connectErrorHandler(new Error(\"Failed to establish realtime connection.\"));\n };\n\n this.eventSource.addEventListener('PB_CONNECT', (e) => {\n const msgEvent = (e as MessageEvent);\n this.clientId = msgEvent?.lastEventId;\n\n this.submitSubscriptions()\n .then(async () => {\n let retries = 3;\n while (this.hasUnsentSubscriptions() && retries > 0) {\n retries--;\n // resubscribe to ensure that the latest topics are submitted\n //\n // This is needed because missed topics could happen on reconnect\n // if after the pending sent `submitSubscriptions()` call another `subscribe()`\n // was made before the submit was able to complete.\n await this.submitSubscriptions();\n }\n }).then(() => {\n for (let p of this.pendingConnects) {\n p.resolve();\n }\n\n // reset connect meta\n this.pendingConnects = [];\n this.reconnectAttempts = 0;\n clearTimeout(this.reconnectTimeoutId);\n clearTimeout(this.connectTimeoutId);\n }).catch((err) => {\n this.clientId = \"\";\n this.connectErrorHandler(err);\n });\n });\n }\n\n private hasUnsentSubscriptions(): boolean {\n const latestTopics = this.getNonEmptySubscriptionTopics();\n if (latestTopics.length != this.lastSentTopics.length) {\n return true;\n }\n\n for (const t of latestTopics) {\n if (!this.lastSentTopics.includes(t)) {\n return true;\n }\n }\n\n return false;\n }\n\n private connectErrorHandler(err: any) {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n\n if (\n // wasn't previously connected -> direct reject\n (!this.clientId && !this.reconnectAttempts) ||\n // was previously connected but the max reconnection limit has been reached\n this.reconnectAttempts > this.maxReconnectAttempts\n ) {\n for (let p of this.pendingConnects) {\n p.reject(new ClientResponseError(err));\n }\n this.disconnect();\n return;\n }\n\n // otherwise -> reconnect in the background\n this.disconnect(true);\n const timeout = this.predefinedReconnectIntervals[this.reconnectAttempts] || this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length - 1];\n this.reconnectAttempts++;\n this.reconnectTimeoutId = setTimeout(() => {\n this.initConnect();\n }, timeout);\n }\n\n private disconnect(fromReconnect = false): void {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n this.removeAllSubscriptionListeners();\n this.client.cancelRequest(this.getSubscriptionsCancelKey());\n this.eventSource?.close();\n this.eventSource = null;\n this.clientId = \"\";\n\n if (!fromReconnect) {\n this.reconnectAttempts = 0;\n\n // reject any remaining connect promises\n const err = new ClientResponseError(new Error(\"Realtime disconnected.\"));\n for (let p of this.pendingConnects) {\n p.reject(err);\n }\n this.pendingConnects = [];\n }\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface HealthCheckResponse {\n code: number;\n message: string;\n data: {[key: string]: any};\n}\n\nexport default class HealthService extends BaseService {\n /**\n * Checks the health status of the api.\n */\n check(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/health', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport default class FileService extends BaseService {\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n const parts = [];\n parts.push(\"api\")\n parts.push(\"files\")\n parts.push(encodeURIComponent(record.collectionId || record.collectionName))\n parts.push(encodeURIComponent(record.id))\n parts.push(encodeURIComponent(filename))\n\n let result = this.client.buildUrl(parts.join('/'));\n\n if (Object.keys(queryParams).length) {\n const params = new URLSearchParams(queryParams);\n result += (result.includes(\"?\") ? \"&\" : \"?\") + params;\n }\n\n return result\n }\n\n /**\n * Requests a new private file access token for the current auth model (admin or record).\n */\n getToken(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/files/token', {\n 'method': 'POST',\n 'params': queryParams,\n }).then((data) => data?.token || '');\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface BackupFileInfo {\n key: string;\n size: number;\n modified: string;\n}\n\nexport default class BackupService extends BaseService {\n /**\n * Returns list with all available backup files.\n */\n getFullList(queryParams: BaseQueryParams = {}): Promise> {\n return this.client.send('/api/backups', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n\n /**\n * Initializes a new backup.\n */\n create(basename: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'name': basename,\n };\n\n return this.client.send('/api/backups', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Deletes a single backup file.\n */\n delete(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}`, {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Initializes an app data restore from an existing backup.\n */\n restore(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}/restore`, {\n 'method': 'POST',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Builds a download url for a single existing backup using an\n * admin file token and the backup file key.\n *\n * The file token can be generated via `pb.files.getToken()`.\n */\n getDownloadUrl(token: string, key: string): string {\n return this.client.buildUrl(`/api/backups/${encodeURIComponent(key)}?token=${encodeURIComponent(token)}`);\n }\n}\n","import ClientResponseError from '@/ClientResponseError';\nimport BaseAuthStore from '@/stores/BaseAuthStore';\nimport LocalAuthStore from '@/stores/LocalAuthStore';\nimport SettingsService from '@/services/SettingsService';\nimport AdminService from '@/services/AdminService';\nimport RecordService from '@/services/RecordService';\nimport CollectionService from '@/services/CollectionService';\nimport LogService from '@/services/LogService';\nimport RealtimeService from '@/services/RealtimeService';\nimport HealthService from '@/services/HealthService';\nimport FileService from '@/services/FileService';\nimport BackupService from '@/services/BackupService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport interface SendOptions extends RequestInit {\n headers?: { [key: string]: string };\n body?: any;\n params?: BaseQueryParams;\n}\n\nexport interface BeforeSendResult {\n [key: string]: any, // for backward compatibility\n url?: string,\n options?: {[key: string]: any}\n}\n\n/**\n * PocketBase JS Client.\n */\nexport default class Client {\n /**\n * The base PocketBase backend url address (eg. 'http://127.0.0.1.8090').\n */\n baseUrl: string;\n\n /**\n * Hook that get triggered right before sending the fetch request,\n * allowing you to inspect and modify the url and request options.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * You can return a non-empty result object `{ url, options }` to replace the url and request options entirely.\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, options) {\n * options.headers = Object.assign({}, options.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return { url, options }\n * };\n * ```\n */\n beforeSend?: (url: string, options: SendOptions) => BeforeSendResult|Promise;\n\n /**\n * Hook that get triggered after successfully sending the fetch request,\n * allowing you to inspect/modify the response object and its parsed data.\n *\n * Returns the new Promise resolved `data` that will be returned to the client.\n *\n * Example:\n * ```js\n * client.afterSend = function (response, data) {\n * if (response.status != 200) {\n * throw new ClientResponseError({\n * url: response.url,\n * status: response.status,\n * data: data,\n * });\n * }\n *\n * return data;\n * };\n * ```\n */\n afterSend?: (response: Response, data: any) => any;\n\n /**\n * Optional language code (default to `en-US`) that will be sent\n * with the requests to the server as `Accept-Language` header.\n */\n lang: string;\n\n /**\n * A replaceable instance of the local auth store service.\n */\n authStore: BaseAuthStore;\n\n /**\n * An instance of the service that handles the **Settings APIs**.\n */\n readonly settings: SettingsService;\n\n /**\n * An instance of the service that handles the **Admin APIs**.\n */\n readonly admins: AdminService;\n\n /**\n * An instance of the service that handles the **Collection APIs**.\n */\n readonly collections: CollectionService;\n\n /**\n * An instance of the service that handles the **File APIs**.\n */\n readonly files: FileService;\n\n /**\n * An instance of the service that handles the **Log APIs**.\n */\n readonly logs: LogService;\n\n /**\n * An instance of the service that handles the **Realtime APIs**.\n */\n readonly realtime: RealtimeService;\n\n /**\n * An instance of the service that handles the **Health APIs**.\n */\n readonly health: HealthService;\n\n /**\n * An instance of the service that handles the **Backup APIs**.\n */\n readonly backups: BackupService;\n\n private cancelControllers: { [key: string]: AbortController } = {};\n private recordServices: { [key: string]: RecordService } = {};\n private enableAutoCancellation: boolean = true;\n\n constructor(\n baseUrl = '/',\n authStore?: BaseAuthStore | null,\n lang = 'en-US',\n ) {\n this.baseUrl = baseUrl;\n this.lang = lang;\n this.authStore = authStore || new LocalAuthStore();\n\n // services\n this.admins = new AdminService(this);\n this.collections = new CollectionService(this);\n this.files = new FileService(this);\n this.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(this);\n this.health = new HealthService(this);\n this.backups = new BackupService(this);\n }\n\n /**\n * Returns the RecordService associated to the specified collection.\n *\n * @param {string} idOrName\n * @return {RecordService}\n */\n collection(idOrName: string): RecordService {\n if (!this.recordServices[idOrName]) {\n this.recordServices[idOrName] = new RecordService(this, idOrName);\n }\n\n return this.recordServices[idOrName];\n }\n\n /**\n * Globally enable or disable auto cancellation for pending duplicated requests.\n */\n autoCancellation(enable: boolean): Client {\n this.enableAutoCancellation = !!enable;\n\n return this;\n }\n\n /**\n * Cancels single request by its cancellation key.\n */\n cancelRequest(cancelKey: string): Client {\n if (this.cancelControllers[cancelKey]) {\n this.cancelControllers[cancelKey].abort();\n delete this.cancelControllers[cancelKey];\n }\n\n return this;\n }\n\n /**\n * Cancels all pending requests.\n */\n cancelAllRequests(): Client {\n for (let k in this.cancelControllers) {\n this.cancelControllers[k].abort();\n }\n\n this.cancelControllers = {};\n\n return this;\n }\n\n /**\n * Sends an api http request.\n */\n async send(path: string, reqOptions: SendOptions): Promise {\n let options = Object.assign({ method: 'GET' } as SendOptions, reqOptions);\n\n // JSON serialize the body if needed and set the correct content type\n // (for FormData body the Content-Type header should be skipped since the boundary is autogenerated)\n if (!this.isFormData(options.body)) {\n if (options.body && typeof options.body !== 'string') {\n options.body = JSON.stringify(options.body);\n }\n\n // add the json header (if not already)\n if (typeof options?.headers?.['Content-Type'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof options?.headers?.['Accept-Language'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Accept-Language': this.lang,\n });\n }\n\n // check if Authorization header can be added\n if (\n // has stored token\n this.authStore?.token &&\n // auth header is not explicitly set\n (typeof options?.headers?.Authorization === 'undefined')\n ) {\n options.headers = Object.assign({}, options.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && options.params?.$autoCancel !== false) {\n const cancelKey = options.params?.$cancelKey || ((options.method || 'GET') + path);\n\n // cancel previous pending requests\n this.cancelRequest(cancelKey);\n\n const controller = new AbortController();\n this.cancelControllers[cancelKey] = controller;\n options.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete options.params?.$autoCancel;\n delete options.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof options.params !== 'undefined') {\n const query = this.serializeQueryParams(options.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete options.params;\n }\n\n if (this.beforeSend) {\n const result = Object.assign({}, await this.beforeSend(url, options));\n if (typeof result.url !== \"undefined\" || typeof result.options !== \"undefined\") {\n url = result.url || url;\n options = result.options || options;\n } else if (Object.keys(result).length) {\n // legacy behavior\n options = result as SendOptions;\n console?.warn && console.warn(\"Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`.\");\n }\n }\n\n // send the request\n return fetch(url, options)\n .then(async (response) => {\n let data : any = {};\n\n try {\n data = await response.json();\n } catch (_) {\n // all api responses are expected to return json\n // with the exception of the realtime event and 204\n }\n\n if (this.afterSend) {\n data = await this.afterSend(response, data);\n }\n\n if (response.status >= 400) {\n throw new ClientResponseError({\n url: response.url,\n status: response.status,\n data: data,\n });\n }\n\n return data as T;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Legacy alias of `pb.files.getUrl()`.\n */\n getFileUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n return this.files.getUrl(record, filename, queryParams);\n }\n\n /**\n * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl;\n\n // construct an absolute base url if in a browser environment\n if (\n typeof window !== 'undefined' &&\n !!window.location &&\n !url.startsWith('https://') &&\n !url.startsWith('http://')\n ) {\n url = window.location.origin?.endsWith('/') ?\n window.location.origin.substring(0, window.location.origin.length - 1) :\n (window.location.origin || '');\n\n if (!this.baseUrl.startsWith('/')) {\n url += window.location.pathname || '/';\n url += url.endsWith('/') ? '' : '/';\n }\n\n url += this.baseUrl;\n }\n\n // concatenate the path\n if (path) {\n url += url.endsWith('/') ? '' : '/'; // append trailing slash if missing\n url += path.startsWith('/') ? path.substring(1) : path;\n }\n\n return url;\n }\n\n /**\n * Loosely checks if the specified body is a FormData instance.\n */\n private isFormData(body: any): boolean {\n return body && (\n // we are checking the constructor name because FormData\n // is not available natively in some environments and the\n // polyfill(s) may not be globally accessible\n body.constructor.name === 'FormData' ||\n // fallback to global FormData instance check\n // note: this is needed because the constructor.name could be different in case of\n // custom global FormData implementation, eg. React Native on Android/iOS\n (typeof FormData !== \"undefined\" && body instanceof FormData)\n )\n }\n\n /**\n * Serializes the provided query parameters into a query string.\n */\n private serializeQueryParams(params: {[key: string]: any}): string {\n const result: Array = [];\n for (const key in params) {\n if (params[key] === null) {\n // skip null query params\n continue;\n }\n\n const value = params[key];\n const encodedKey = encodeURIComponent(key);\n\n if (Array.isArray(value)) {\n // \"repeat\" array params\n for (const v of value) {\n result.push(encodedKey + \"=\" + encodeURIComponent(v));\n }\n } else if (value instanceof Date) {\n result.push(encodedKey + \"=\" + encodeURIComponent(value.toISOString()));\n } else if (typeof value !== null && typeof value === 'object') {\n result.push(encodedKey + \"=\" + encodeURIComponent(JSON.stringify(value)));\n } else {\n result.push(encodedKey + \"=\" + encodeURIComponent(value));\n }\n }\n\n return result.join('&');\n }\n}\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__extends","TypeError","String","__","this","constructor","create","__assign","assign","t","s","i","n","arguments","length","apply","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","adopt","then","__generator","body","f","y","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","v","op","pop","push","atobPolyfill","ClientResponseError","_super","errData","_this","url","status","response","isAbort","originalError","data","DOMException","name","message","_a","_d","_c","_b","cause","includes","defineProperty","get","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","isDate","toString","Date","valueOf","toUTCString","httpOnly","secure","priority","toLowerCase","sameSite","defaultDecode","indexOf","decodeURIComponent","encodeURIComponent","getTokenPayload","token","encodedPayload","split","map","c","charCodeAt","slice","join","JSON","parse","isTokenExpired","expirationThreshold","payload","keys","exp","now","atob","input","str","replace","bs","buffer","bc","idx","output","charAt","fromCharCode","BaseModel","$load","load","_i","entries","key","id","created","updated","clone","$clone","structuredClone","stringify","export","$export","Record","collectionId","collectionName","_loadExpand","expand","isArray","Admin","avatar","email","defaultCookieKey","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","save","model","triggerChange","clear","loadFromCookie","cookie","rawData","cookieParse","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","exportToCookie","defaultOptions","resultLength","Blob","size","username","verified","onChange","callback","fireImmediately","splice","LocalAuthStore","storageKey","storageFallback","_storageGet","_storageSet","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","filesystem","testEmail","toEmail","emailTemplate","template","generateAppleClientSecret","clientId","teamId","keyId","privateKey","duration","ListResult","page","perPage","totalItems","totalPages","items","CrudService","getFullList","batchOrqueryParams","_getFullList","baseCrudPath","batch","getList","_getList","getFirstListItem","filter","_getFirstListItem","getOne","_getOne","_create","_update","delete","_delete","BaseCrudService","basePath","batchSize","request","list","castedList","concat","item","$cancelKey","code","AdminService","authStore","success","authResponse","admin","authWithPassword","password","identity","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","batchOrQueryParams","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2Code","codeVerifier","redirectUrl","createData","authWithOAuth2","args","config","authMethods","find","buildUrl","oldState","unsubscribe_1","state","query","authData","err_2","URL","authUrl","searchParams","set","scopes","urlCallback","_defaultUrlCallback","err_1","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","open","width","height","windowWidth","innerWidth","windowHeight","innerHeight","left","top","SchemaField","type","system","required","Collection","indexes","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","$isBase","$isAuth","$isView","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","eventSource","subscriptions","lastSentTopics","maxConnectTimeout","reconnectAttempts","maxReconnectAttempts","Infinity","predefinedReconnectIntervals","pendingConnects","listener","msgEvent","isConnected","connect","submitSubscriptions","addEventListener","unsubscribeByTopicAndListener","hasSubscriptionListeners","removeEventListener","disconnect","topicPrefix","hasAtleastOneTopic","startsWith","exist","topicToCheck","addAllSubscriptionListeners","getNonEmptySubscriptionTopics","getSubscriptionsCancelKey","catch","err","removeAllSubscriptionListeners","initConnect","clearTimeout","connectTimeoutId","setTimeout","connectErrorHandler","EventSource","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","timeout","fromReconnect","cancelRequest","close","HealthService","check","FileService","getUrl","filename","parts","URLSearchParams","getToken","BackupService","basename","restore","getDownloadUrl","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","files","logs","settings","health","backups","collection","idOrName","autoCancellation","enable","cancelKey","abort","cancelAllRequests","k","reqOptions","isFormData","headers","Authorization","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","serializeQueryParams","beforeSend","_k","_j","_l","_m","fetch","json","afterSend","getFileUrl","location","origin","endsWith","substring","pathname","FormData","encodedKey","value_1","toISOString"],"mappings":"AAgBA,IAAIA,cAAgB,SAASC,EAAGC,GAI5B,OAHAF,cAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,CAAE,GACzE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOC,OAAOK,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,KACzFP,cAAcC,EAAGC,EAC5B,EAEO,SAASS,UAAUV,EAAGC,GACzB,GAAiB,mBAANA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hBA,EAAOtE,GAAX,CAKA,IAAMnH,EAAQyL,EAAOtE,GACfmV,EAAarX,mBAAmBkC,GAEtC,GAAIjJ,MAAMgK,QAAQlI,GAEd,IAAgB,QAAAuc,EAAAvc,EAAAiH,EAAKsV,EAAAld,OAAL4H,IAAO,CAAlB,IAAMzF,EAAC+a,EAAAtV,GACR5G,EAAOsB,KAAK2a,EAAa,IAAMrX,mBAAmBzD,GACrD,MACMxB,aAAiBsE,KACxBjE,EAAOsB,KAAK2a,EAAa,IAAMrX,mBAAmBjF,EAAMwc,gBAChC,cAAVxc,GAAmC,iBAAVA,EACvCK,EAAOsB,KAAK2a,EAAa,IAAMrX,mBAAmBU,KAAK+B,UAAU1H,KAEjEK,EAAOsB,KAAK2a,EAAa,IAAMrX,mBAAmBjF,GAfrD,CAmBL,OAAOK,EAAOqF,KAAK,MAE1B4T,MAAD"} \ No newline at end of file diff --git a/dist/pocketbase.iife.d.ts b/dist/pocketbase.iife.d.ts index ef6d735..ea8e226 100644 --- a/dist/pocketbase.iife.d.ts +++ b/dist/pocketbase.iife.d.ts @@ -475,6 +475,7 @@ declare class RealtimeService extends BaseService { unsubscribeByTopicAndListener(topic: string, listener: EventListener): Promise; private hasSubscriptionListeners; private submitSubscriptions; + private getSubscriptionsCancelKey; private getNonEmptySubscriptionTopics; private addAllSubscriptionListeners; private removeAllSubscriptionListeners; diff --git a/dist/pocketbase.iife.js b/dist/pocketbase.iife.js index 8372b5d..dcf7a44 100644 --- a/dist/pocketbase.iife.js +++ b/dist/pocketbase.iife.js @@ -1,2 +1,2 @@ -var PocketBase=function(){"use strict";var extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},extendStatics(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}var __assign=function(){return __assign=Object.assign||function __assign(e){for(var t,n=1,i=arguments.length;n0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var i=function(){function BaseModel(e){void 0===e&&(e={}),this.$load(e||{})}return BaseModel.prototype.load=function(e){return this.$load(e)},BaseModel.prototype.$load=function(e){for(var t=0,n=Object.entries(e);t0&&(!n.exp||n.exp-t>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),BaseAuthStore.prototype.save=function(e,t){this.baseToken=e||"",this.baseModel=null!==t&&"object"==typeof t?void 0!==t.collectionId?new o(t):new r(t):null,this.triggerChange()},BaseAuthStore.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},BaseAuthStore.prototype.loadFromCookie=function(e,t){void 0===t&&(t=s);var n=function cookieParse(e,t){var n={};if("string"!=typeof e)return n;for(var i=Object.assign({},t||{}).decode||defaultDecode,o=0;o4096&&(u.model={id:null===(i=null==u?void 0:u.model)||void 0===i?void 0:i.id,email:null===(r=null==u?void 0:u.model)||void 0===r?void 0:r.email},this.model instanceof o&&(u.model.username=this.model.username,u.model.verified=this.model.verified,u.model.collectionId=this.model.collectionId),l=cookieSerialize(t,JSON.stringify(u),e)),l},BaseAuthStore.prototype.onChange=function(e,t){var n=this;return void 0===t&&(t=!1),this._onChangeCallbacks.push(e),t&&e(this.token,this.model),function(){for(var t=n._onChangeCallbacks.length-1;t>=0;t--)if(n._onChangeCallbacks[t]==e)return delete n._onChangeCallbacks[t],void n._onChangeCallbacks.splice(t,1)}},BaseAuthStore.prototype.triggerChange=function(){for(var e=0,t=this._onChangeCallbacks;e0?e:1,this.perPage=t>=0?t:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},d=function(e){function BaseCrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(BaseCrudService,e),BaseCrudService.prototype._getFullList=function(e,t,n){var i=this;void 0===t&&(t=200),void 0===n&&(n={});var o=[],request=function(r){return __awaiter(i,void 0,void 0,(function(){return __generator(this,(function(i){return[2,this._getList(e,r,t||200,n).then((function(e){var t=e,n=t.items,i=t.totalItems;return o=o.concat(n),n.length&&i>o.length?request(r+1):o}))]}))}))};return request(1)},BaseCrudService.prototype._getList=function(e,t,n,i){var o=this;return void 0===t&&(t=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:t,perPage:n},i),this.client.send(e,{method:"GET",params:i}).then((function(e){var t=[];if(null==e?void 0:e.items){e.items=e.items||[];for(var n=0,i=e.items;n1||"string"==typeof(null==e?void 0:e[0])?(console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),[2,this.authWithOAuth2Code((null==e?void 0:e[0])||"",(null==e?void 0:e[1])||"",(null==e?void 0:e[2])||"",(null==e?void 0:e[3])||"",(null==e?void 0:e[4])||{},(null==e?void 0:e[5])||{},(null==e?void 0:e[6])||{})]):(n=(null==e?void 0:e[0])||{},[4,this.listAuthMethods()]);case 1:if(i=a.sent(),!(o=i.authProviders.find((function(e){return e.name===n.provider}))))throw new t(new Error('Missing or invalid provider "'.concat(n.provider,'".')));return r=this.client.buildUrl("/api/oauth2-redirect"),[2,new Promise((function(e,i){return __awaiter(s,void 0,void 0,(function(){var s,a,c,u,l=this;return __generator(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),[4,this.client.realtime.subscribe("@oauth2",(function(a){return __awaiter(l,void 0,void 0,(function(){var c,u,l;return __generator(this,(function(d){switch(d.label){case 0:c=this.client.realtime.clientId,d.label=1;case 1:if(d.trys.push([1,3,,4]),s(),!a.state||c!==a.state)throw new Error("State parameters don't match.");return[4,this.authWithOAuth2Code(o.name,a.code,o.codeVerifier,r,n.createData,n.body,n.query)];case 2:return u=d.sent(),e(u),[3,4];case 3:return l=d.sent(),i(new t(l)),[3,4];case 4:return[2]}}))}))}))];case 1:return s=d.sent(),(a=new URL(o.authUrl+r)).searchParams.set("state",this.client.realtime.clientId),(null===(u=n.scopes)||void 0===u?void 0:u.length)&&a.searchParams.set("scope",n.scopes.join(" ")),[4,n.urlCallback?n.urlCallback(a.toString()):this._defaultUrlCallback(a.toString())];case 2:return d.sent(),[3,4];case 3:return c=d.sent(),i(new t(c)),[3,4];case 4:return[2]}}))}))}))]}}))}))},RecordService.prototype.authRefresh=function(e,t){var n=this;return void 0===e&&(e={}),void 0===t&&(t={}),this.client.send(this.baseCollectionPath+"/auth-refresh",{method:"POST",params:t,body:e}).then((function(e){return n.authResponse(e)}))},RecordService.prototype.requestPasswordReset=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-password-reset",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmPasswordReset=function(e,t,n,i,o){return void 0===i&&(i={}),void 0===o&&(o={}),i=Object.assign({token:e,password:t,passwordConfirm:n},i),this.client.send(this.baseCollectionPath+"/confirm-password-reset",{method:"POST",params:o,body:i}).then((function(){return!0}))},RecordService.prototype.requestVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({token:e},t),this.client.send(this.baseCollectionPath+"/confirm-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.requestEmailChange=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({newEmail:e},t),this.client.send(this.baseCollectionPath+"/request-email-change",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmEmailChange=function(e,t,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),n=Object.assign({token:e,password:t},n),this.client.send(this.baseCollectionPath+"/confirm-email-change",{method:"POST",params:i,body:n}).then((function(){return!0}))},RecordService.prototype.listExternalAuths=function(e,t){return void 0===t&&(t={}),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths",{method:"GET",params:t}).then((function(e){var t=[];if(Array.isArray(e))for(var n=0,i=e;no?o:n)/2,a=r/2-(i=i>r?r:i)/2;window.open(e,"oauth2-popup","width="+n+",height="+i+",top="+a+",left="+s+",resizable,menubar=no")},RecordService}(h),m=function m(e){void 0===e&&(e={}),this.id=void 0!==e.id?e.id:"",this.name=void 0!==e.name?e.name:"",this.type=void 0!==e.type?e.type:"text",this.system=!!e.system,this.required=!!e.required,this.options="object"==typeof e.options&&null!==e.options?e.options:{}},b=function(e){function Collection(){return null!==e&&e.apply(this,arguments)||this}return __extends(Collection,e),Collection.prototype.$load=function(t){e.prototype.$load.call(this,t),this.system=!!t.system,this.name="string"==typeof t.name?t.name:"",this.type="string"==typeof t.type?t.type:"base",this.options=void 0!==t.options&&null!==t.options?t.options:{},this.indexes=Array.isArray(t.indexes)?t.indexes:[],this.listRule="string"==typeof t.listRule?t.listRule:null,this.viewRule="string"==typeof t.viewRule?t.viewRule:null,this.createRule="string"==typeof t.createRule?t.createRule:null,this.updateRule="string"==typeof t.updateRule?t.updateRule:null,this.deleteRule="string"==typeof t.deleteRule?t.deleteRule:null,t.schema=Array.isArray(t.schema)?t.schema:[],this.schema=[];for(var n=0,i=t.schema;n=0;o--)this.subscriptions[e][o]===t&&(i=!0,delete this.subscriptions[e][o],this.subscriptions[e].splice(o,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(e,t));return i?(this.subscriptions[e].length||delete this.subscriptions[e],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(e)?[3,3]:[4,this.submitSubscriptions()];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},RealtimeService.prototype.hasSubscriptionListeners=function(e){var t,n;if(this.subscriptions=this.subscriptions||{},e)return!!(null===(t=this.subscriptions[e])||void 0===t?void 0:t.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},RealtimeService.prototype.submitSubscriptions=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return this.clientId?(this.addAllSubscriptionListeners(),this.lastSentTopics=this.getNonEmptySubscriptionTopics(),[2,this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentTopics},params:{$cancelKey:"realtime_"+this.clientId}}).catch((function(e){if(!(null==e?void 0:e.isAbort))throw e}))]):[2]}))}))},RealtimeService.prototype.getNonEmptySubscriptionTopics=function(){var e=[];for(var t in this.subscriptions)this.subscriptions[t].length&&e.push(t);return e},RealtimeService.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var e in this.removeAllSubscriptionListeners(),this.subscriptions)for(var t=0,n=this.subscriptions[e];t0?[2]:[2,new Promise((function(t,n){e.pendingConnects.push({resolve:t,reject:n}),e.pendingConnects.length>1||e.initConnect()}))]}))}))},RealtimeService.prototype.initConnect=function(){var e=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){e.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(t){e.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(t){var n=t;e.clientId=null==n?void 0:n.lastEventId,e.submitSubscriptions().then((function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=3,t.label=1;case 1:return this.hasUnsentSubscriptions()&&e>0?(e--,[4,this.submitSubscriptions()]):[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var t=0,n=e.pendingConnects;tthis.maxReconnectAttempts){for(var i=0,o=this.pendingConnects;i=400)throw new t({url:e.url,status:e.status,data:n});return[2,n]}}))}))})).catch((function(e){throw new t(e)}))]}}))}))},Client.prototype.getFileUrl=function(e,t,n){return void 0===n&&(n={}),this.files.getUrl(e,t,n)},Client.prototype.buildUrl=function(e){var t,n=this.baseUrl;return"undefined"==typeof window||!window.location||n.startsWith("https://")||n.startsWith("http://")||(n=(null===(t=window.location.origin)||void 0===t?void 0:t.endsWith("/"))?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(n+=window.location.pathname||"/",n+=n.endsWith("/")?"":"/"),n+=this.baseUrl),e&&(n+=n.endsWith("/")?"":"/",n+=e.startsWith("/")?e.substring(1):e),n},Client.prototype.isFormData=function(e){return e&&("FormData"===e.constructor.name||"undefined"!=typeof FormData&&e instanceof FormData)},Client.prototype.serializeQueryParams=function(e){var t=[];for(var n in e)if(null!==e[n]){var i=e[n],o=encodeURIComponent(n);if(Array.isArray(i))for(var r=0,s=i;r0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var i=function(){function BaseModel(e){void 0===e&&(e={}),this.$load(e||{})}return BaseModel.prototype.load=function(e){return this.$load(e)},BaseModel.prototype.$load=function(e){for(var t=0,n=Object.entries(e);t0&&(!n.exp||n.exp-t>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),BaseAuthStore.prototype.save=function(e,t){this.baseToken=e||"",this.baseModel=null!==t&&"object"==typeof t?void 0!==t.collectionId?new o(t):new r(t):null,this.triggerChange()},BaseAuthStore.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},BaseAuthStore.prototype.loadFromCookie=function(e,t){void 0===t&&(t=s);var n=function cookieParse(e,t){var n={};if("string"!=typeof e)return n;for(var i=Object.assign({},t||{}).decode||defaultDecode,o=0;o4096&&(u.model={id:null===(i=null==u?void 0:u.model)||void 0===i?void 0:i.id,email:null===(r=null==u?void 0:u.model)||void 0===r?void 0:r.email},this.model instanceof o&&(u.model.username=this.model.username,u.model.verified=this.model.verified,u.model.collectionId=this.model.collectionId),l=cookieSerialize(t,JSON.stringify(u),e)),l},BaseAuthStore.prototype.onChange=function(e,t){var n=this;return void 0===t&&(t=!1),this._onChangeCallbacks.push(e),t&&e(this.token,this.model),function(){for(var t=n._onChangeCallbacks.length-1;t>=0;t--)if(n._onChangeCallbacks[t]==e)return delete n._onChangeCallbacks[t],void n._onChangeCallbacks.splice(t,1)}},BaseAuthStore.prototype.triggerChange=function(){for(var e=0,t=this._onChangeCallbacks;e0?e:1,this.perPage=t>=0?t:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},d=function(e){function BaseCrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(BaseCrudService,e),BaseCrudService.prototype._getFullList=function(e,t,n){var i=this;void 0===t&&(t=200),void 0===n&&(n={});var o=[],request=function(r){return __awaiter(i,void 0,void 0,(function(){return __generator(this,(function(i){return[2,this._getList(e,r,t||200,n).then((function(e){var t=e,n=t.items,i=t.totalItems;return o=o.concat(n),n.length&&i>o.length?request(r+1):o}))]}))}))};return request(1)},BaseCrudService.prototype._getList=function(e,t,n,i){var o=this;return void 0===t&&(t=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:t,perPage:n},i),this.client.send(e,{method:"GET",params:i}).then((function(e){var t=[];if(null==e?void 0:e.items){e.items=e.items||[];for(var n=0,i=e.items;n1||"string"==typeof(null==e?void 0:e[0])?(console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),[2,this.authWithOAuth2Code((null==e?void 0:e[0])||"",(null==e?void 0:e[1])||"",(null==e?void 0:e[2])||"",(null==e?void 0:e[3])||"",(null==e?void 0:e[4])||{},(null==e?void 0:e[5])||{},(null==e?void 0:e[6])||{})]):(n=(null==e?void 0:e[0])||{},[4,this.listAuthMethods()]);case 1:if(i=a.sent(),!(o=i.authProviders.find((function(e){return e.name===n.provider}))))throw new t(new Error('Missing or invalid provider "'.concat(n.provider,'".')));return r=this.client.buildUrl("/api/oauth2-redirect"),[2,new Promise((function(e,i){return __awaiter(s,void 0,void 0,(function(){var s,a,c,u,l=this;return __generator(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),[4,this.client.realtime.subscribe("@oauth2",(function(a){return __awaiter(l,void 0,void 0,(function(){var c,u,l;return __generator(this,(function(d){switch(d.label){case 0:c=this.client.realtime.clientId,d.label=1;case 1:if(d.trys.push([1,3,,4]),s(),!a.state||c!==a.state)throw new Error("State parameters don't match.");return[4,this.authWithOAuth2Code(o.name,a.code,o.codeVerifier,r,n.createData,n.body,n.query)];case 2:return u=d.sent(),e(u),[3,4];case 3:return l=d.sent(),i(new t(l)),[3,4];case 4:return[2]}}))}))}))];case 1:return s=d.sent(),(a=new URL(o.authUrl+r)).searchParams.set("state",this.client.realtime.clientId),(null===(u=n.scopes)||void 0===u?void 0:u.length)&&a.searchParams.set("scope",n.scopes.join(" ")),[4,n.urlCallback?n.urlCallback(a.toString()):this._defaultUrlCallback(a.toString())];case 2:return d.sent(),[3,4];case 3:return c=d.sent(),i(new t(c)),[3,4];case 4:return[2]}}))}))}))]}}))}))},RecordService.prototype.authRefresh=function(e,t){var n=this;return void 0===e&&(e={}),void 0===t&&(t={}),this.client.send(this.baseCollectionPath+"/auth-refresh",{method:"POST",params:t,body:e}).then((function(e){return n.authResponse(e)}))},RecordService.prototype.requestPasswordReset=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-password-reset",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmPasswordReset=function(e,t,n,i,o){return void 0===i&&(i={}),void 0===o&&(o={}),i=Object.assign({token:e,password:t,passwordConfirm:n},i),this.client.send(this.baseCollectionPath+"/confirm-password-reset",{method:"POST",params:o,body:i}).then((function(){return!0}))},RecordService.prototype.requestVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({token:e},t),this.client.send(this.baseCollectionPath+"/confirm-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.requestEmailChange=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({newEmail:e},t),this.client.send(this.baseCollectionPath+"/request-email-change",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmEmailChange=function(e,t,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),n=Object.assign({token:e,password:t},n),this.client.send(this.baseCollectionPath+"/confirm-email-change",{method:"POST",params:i,body:n}).then((function(){return!0}))},RecordService.prototype.listExternalAuths=function(e,t){return void 0===t&&(t={}),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths",{method:"GET",params:t}).then((function(e){var t=[];if(Array.isArray(e))for(var n=0,i=e;no?o:n)/2,a=r/2-(i=i>r?r:i)/2;window.open(e,"oauth2-popup","width="+n+",height="+i+",top="+a+",left="+s+",resizable,menubar=no")},RecordService}(h),m=function m(e){void 0===e&&(e={}),this.id=void 0!==e.id?e.id:"",this.name=void 0!==e.name?e.name:"",this.type=void 0!==e.type?e.type:"text",this.system=!!e.system,this.required=!!e.required,this.options="object"==typeof e.options&&null!==e.options?e.options:{}},b=function(e){function Collection(){return null!==e&&e.apply(this,arguments)||this}return __extends(Collection,e),Collection.prototype.$load=function(t){e.prototype.$load.call(this,t),this.system=!!t.system,this.name="string"==typeof t.name?t.name:"",this.type="string"==typeof t.type?t.type:"base",this.options=void 0!==t.options&&null!==t.options?t.options:{},this.indexes=Array.isArray(t.indexes)?t.indexes:[],this.listRule="string"==typeof t.listRule?t.listRule:null,this.viewRule="string"==typeof t.viewRule?t.viewRule:null,this.createRule="string"==typeof t.createRule?t.createRule:null,this.updateRule="string"==typeof t.updateRule?t.updateRule:null,this.deleteRule="string"==typeof t.deleteRule?t.deleteRule:null,t.schema=Array.isArray(t.schema)?t.schema:[],this.schema=[];for(var n=0,i=t.schema;n=0;o--)this.subscriptions[e][o]===t&&(i=!0,delete this.subscriptions[e][o],this.subscriptions[e].splice(o,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(e,t));return i?(this.subscriptions[e].length||delete this.subscriptions[e],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(e)?[3,3]:[4,this.submitSubscriptions()];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},RealtimeService.prototype.hasSubscriptionListeners=function(e){var t,n;if(this.subscriptions=this.subscriptions||{},e)return!!(null===(t=this.subscriptions[e])||void 0===t?void 0:t.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},RealtimeService.prototype.submitSubscriptions=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return this.clientId?(this.addAllSubscriptionListeners(),this.lastSentTopics=this.getNonEmptySubscriptionTopics(),[2,this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentTopics},params:{$cancelKey:this.getSubscriptionsCancelKey()}}).catch((function(e){if(!(null==e?void 0:e.isAbort))throw e}))]):[2]}))}))},RealtimeService.prototype.getSubscriptionsCancelKey=function(){return"realtime_"+this.clientId},RealtimeService.prototype.getNonEmptySubscriptionTopics=function(){var e=[];for(var t in this.subscriptions)this.subscriptions[t].length&&e.push(t);return e},RealtimeService.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var e in this.removeAllSubscriptionListeners(),this.subscriptions)for(var t=0,n=this.subscriptions[e];t0?[2]:[2,new Promise((function(t,n){e.pendingConnects.push({resolve:t,reject:n}),e.pendingConnects.length>1||e.initConnect()}))]}))}))},RealtimeService.prototype.initConnect=function(){var e=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){e.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(t){e.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(t){var n=t;e.clientId=null==n?void 0:n.lastEventId,e.submitSubscriptions().then((function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=3,t.label=1;case 1:return this.hasUnsentSubscriptions()&&e>0?(e--,[4,this.submitSubscriptions()]):[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var t=0,n=e.pendingConnects;tthis.maxReconnectAttempts){for(var i=0,o=this.pendingConnects;i=400)throw new t({url:e.url,status:e.status,data:n});return[2,n]}}))}))})).catch((function(e){throw new t(e)}))]}}))}))},Client.prototype.getFileUrl=function(e,t,n){return void 0===n&&(n={}),this.files.getUrl(e,t,n)},Client.prototype.buildUrl=function(e){var t,n=this.baseUrl;return"undefined"==typeof window||!window.location||n.startsWith("https://")||n.startsWith("http://")||(n=(null===(t=window.location.origin)||void 0===t?void 0:t.endsWith("/"))?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(n+=window.location.pathname||"/",n+=n.endsWith("/")?"":"/"),n+=this.baseUrl),e&&(n+=n.endsWith("/")?"":"/",n+=e.startsWith("/")?e.substring(1):e),n},Client.prototype.isFormData=function(e){return e&&("FormData"===e.constructor.name||"undefined"!=typeof FormData&&e instanceof FormData)},Client.prototype.serializeQueryParams=function(e){var t=[];for(var n in e)if(null!==e[n]){var i=e[n],o=encodeURIComponent(n);if(Array.isArray(i))for(var r=0,s=i;r= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","/**\n * ClientResponseError is a custom Error class that is intended to wrap\n * and normalize any error thrown by `Client.send()`.\n */\nexport default class ClientResponseError extends Error {\n url: string = '';\n status: number = 0;\n response: {[key: string]: any} = {};\n isAbort: boolean = false;\n originalError: any = null;\n\n constructor(errData?: any) {\n super(\"ClientResponseError\");\n\n // Set the prototype explicitly.\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, ClientResponseError.prototype);\n\n if (!(errData instanceof ClientResponseError)) {\n this.originalError = errData;\n }\n\n if (errData !== null && typeof errData === 'object') {\n this.url = typeof errData.url === 'string' ? errData.url : '';\n this.status = typeof errData.status === 'number' ? errData.status : 0;\n this.response = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\n this.isAbort = !!errData.isAbort;\n }\n\n if (typeof DOMException !== 'undefined' && errData instanceof DOMException) {\n this.isAbort = true;\n }\n\n this.name = \"ClientResponseError \" + this.status;\n this.message = this.response?.message;\n if (!this.message) {\n if (this.isAbort) {\n this.message = 'The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.';\n } else if (this.originalError?.cause?.message?.includes(\"ECONNREFUSED ::1\")) {\n this.message = 'Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).';\n } else {\n this.message = 'Something went wrong while processing your request.';\n }\n }\n }\n\n /**\n * Alias for `this.response` to preserve the backward compatibility.\n */\n get data() {\n return this.response;\n }\n\n /**\n * Make a POJO's copy of the current error class instance.\n * @see https://github.com/vuex-orm/vuex-orm/issues/255\n */\n toJSON() {\n return { ...this };\n }\n}\n","let atobPolyfill: Function;\nif (typeof atob === 'function') {\n atobPolyfill = atob\n} else {\n /**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n atobPolyfill = (input: any) => {\n const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n let str = String(input).replace(/=+$/, \"\");\n if (str.length % 4 == 1) {\n throw new Error(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = \"\";\n // get next character\n (buffer = str.charAt(idx++));\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? (bs as any) * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ?\n (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) :\n 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n\n return output;\n };\n}\n\n/**\n * Returns JWT token's payload data.\n */\nexport function getTokenPayload(token: string): { [key: string]: any } {\n if (token) {\n try {\n const encodedPayload = decodeURIComponent(atobPolyfill(token.split('.')[1]).split('').map(function (c: string) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n\n return JSON.parse(encodedPayload) || {};\n } catch (e) {\n }\n }\n\n return {};\n}\n\n/**\n * Checks whether a JWT token is expired or not.\n * Tokens without `exp` payload key are considered valid.\n * Tokens with empty payload (eg. invalid token strings) are considered expired.\n *\n * @param token The token to check.\n * @param [expirationThreshold] Time in seconds that will be subtracted from the token `exp` property.\n */\nexport function isTokenExpired(token: string, expirationThreshold = 0): boolean {\n let payload = getTokenPayload(token);\n\n if (\n Object.keys(payload).length > 0 &&\n (!payload.exp || (payload.exp - expirationThreshold) > (Date.now() / 1000))\n ) {\n return false;\n }\n\n return true;\n}\n","/**\n * -------------------------------------------------------------------\n * Simple cookie parse and serialize utilities mostly based on the\n * node module https://github.com/jshttp/cookie.\n * -------------------------------------------------------------------\n */\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\nexport interface ParseOptions{\n decode?: (val: string) => string,\n}\n\n/**\n* Parses the given cookie header string into an object\n* The object has the various cookies as keys(names) => values\n*/\nexport function cookieParse(str: string, options?: ParseOptions): { [key: string]: any } {\n const result: { [key: string]: any } = {};\n\n if (typeof str !== 'string') {\n return result;\n }\n\n const opt = Object.assign({}, options || {});\n const decode = opt.decode || defaultDecode;\n\n let index = 0;\n while (index < str.length) {\n const eqIdx = str.indexOf('=', index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = str.indexOf(';', index);\n\n if (endIdx === -1) {\n endIdx = str.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1;\n continue;\n }\n\n const key = str.slice(index, eqIdx).trim();\n\n // only assign once\n if (undefined === result[key]) {\n let val = str.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n result[key] = decode(val);\n } catch (_) {\n result[key] = val; // no decoding\n }\n }\n\n index = endIdx + 1;\n }\n\n return result;\n};\n\nexport interface SerializeOptions{\n encode?: (val: string | number | boolean) => string,\n maxAge?: number,\n domain?: string,\n path?: string,\n expires?: Date,\n httpOnly?: boolean,\n secure?: boolean,\n priority?: string,\n sameSite?: boolean|string,\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * ```js\n * cookieSerialize('foo', 'bar', { httpOnly: true }) // \"foo=bar; httpOnly\"\n * ```\n */\nexport function cookieSerialize(name: string, val: string, options?: SerializeOptions): string {\n const opt = Object.assign({}, options || {});\n const encode = opt.encode || defaultEncode;\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n const value = encode(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n let result = name + '=' + value;\n\n if (opt.maxAge != null) {\n const maxAge = opt.maxAge - 0;\n\n if (isNaN(maxAge) || !isFinite(maxAge)) {\n throw new TypeError('option maxAge is invalid');\n }\n\n result += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n result += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n result += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (!isDate(opt.expires) || isNaN(opt.expires.valueOf())) {\n throw new TypeError('option expires is invalid');\n }\n\n result += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n result += '; HttpOnly';\n }\n\n if (opt.secure) {\n result += '; Secure';\n }\n\n if (opt.priority) {\n const priority = typeof opt.priority === 'string' ? opt.priority.toLowerCase() : opt.priority;\n\n switch (priority) {\n case 'low':\n result += '; Priority=Low';\n break;\n case 'medium':\n result += '; Priority=Medium';\n break;\n case 'high':\n result += '; Priority=High';\n break;\n default:\n throw new TypeError('option priority is invalid');\n }\n }\n\n if (opt.sameSite) {\n const sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n result += '; SameSite=Strict';\n break;\n case 'lax':\n result += '; SameSite=Lax';\n break;\n case 'strict':\n result += '; SameSite=Strict';\n break;\n case 'none':\n result += '; SameSite=None';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return result;\n};\n\n/**\n * Default URL-decode string value function.\n * Optimized to skip native call when no `%`.\n */\nfunction defaultDecode(val: string): string {\n return val.indexOf('%') !== -1\n ? decodeURIComponent(val)\n : val;\n}\n\n/**\n * Default URL-encode value function.\n */\nfunction defaultEncode(val: string | number | boolean): string {\n return encodeURIComponent(val);\n}\n\n/**\n * Determines if value is a Date.\n */\nfunction isDate(val: any): boolean {\n return (\n Object.prototype.toString.call(val) === '[object Date]' ||\n val instanceof Date\n );\n}\n","export default abstract class BaseModel {\n [key: string]: any,\n\n id!: string;\n created!: string;\n updated!: string;\n\n constructor(data: { [key: string]: any } = {}) {\n this.$load(data || {});\n }\n\n /**\n * Alias of this.$load(data).\n */\n load(data: { [key: string]: any }) {\n return this.$load(data);\n }\n\n /**\n * Loads `data` into the current model.\n */\n $load(data: { [key: string]: any }) {\n for (const [key, value] of Object.entries(data)) {\n this[key] = value;\n }\n\n // normalize known fields\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.created = typeof data.created !== 'undefined' ? data.created : '';\n this.updated = typeof data.updated !== 'undefined' ? data.updated : '';\n }\n\n /**\n * Returns whether the current loaded data represent a stored db record.\n */\n get $isNew(): boolean {\n return !this.id;\n }\n\n /**\n * Alias of this.clone().\n */\n clone(): BaseModel {\n return this.$clone();\n }\n\n /**\n * Creates a deep clone of the current model.\n */\n $clone(): BaseModel {\n const clone = typeof structuredClone === 'function' ?\n structuredClone(this) : JSON.parse(JSON.stringify(this));\n\n return new (this.constructor as any)(clone);\n }\n\n /**\n * Alias of this.$export().\n */\n export(): { [key: string]: any } {\n return this.$export();\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n $export(): { [key: string]: any } {\n return typeof structuredClone === 'function' ?\n structuredClone(this) : Object.assign({}, this);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Record extends BaseModel {\n collectionId!: string;\n collectionName!: string;\n expand!: {[key: string]: Record|Array};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // normalize common fields\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.collectionName = typeof data.collectionName === 'string' ? data.collectionName : '';\n\n // normalize expand items\n this._loadExpand(data.expand);\n }\n\n /**\n * Loads the provided expand items and recursively normalizes each\n * item to a `Record|Array`.\n */\n private _loadExpand(expand: { [key: string]: any }) {\n expand = expand || {};\n this.expand = {};\n\n for (const key in expand) {\n if (Array.isArray(expand[key])) {\n this.expand[key] = expand[key].map((data: any) => new Record(data || {}));\n } else {\n this.expand[key] = new Record(expand[key] || {});\n }\n }\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Admin extends BaseModel {\n avatar!: number;\n email!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.avatar = typeof data.avatar === 'number' ? data.avatar : 0;\n this.email = typeof data.email === 'string' ? data.email : '';\n }\n}\n","import { cookieParse, cookieSerialize, SerializeOptions } from '@/stores/utils/cookie';\nimport { isTokenExpired, getTokenPayload } from '@/stores/utils/jwt';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\nexport type OnStoreChangeFunc = (token: string, model: Record|Admin|null) => void;\n\nconst defaultCookieKey = 'pb_auth';\n\n/**\n * Base AuthStore class that is intended to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore {\n protected baseToken: string = '';\n protected baseModel: Record|Admin|null = null;\n\n private _onChangeCallbacks: Array = [];\n\n /**\n * Retrieves the stored token (if any).\n */\n get token(): string {\n return this.baseToken;\n }\n\n /**\n * Retrieves the stored model data (if any).\n */\n get model(): Record|Admin|null {\n return this.baseModel;\n }\n\n /**\n * Loosely checks if the store has valid token (aka. existing and unexpired exp claim).\n */\n get isValid(): boolean {\n return !isTokenExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: Record|Admin|null): void {\n this.baseToken = token || '';\n\n // normalize the model instance\n if (model !== null && typeof model === 'object') {\n this.baseModel = typeof (model as any).collectionId !== 'undefined' ?\n new Record(model) : new Admin(model);\n } else {\n this.baseModel = null;\n }\n\n this.triggerChange();\n }\n\n /**\n * Removes the stored token and model data form the auth store.\n */\n clear(): void {\n this.baseToken = '';\n this.baseModel = null;\n this.triggerChange();\n }\n\n /**\n * Parses the provided cookie string and updates the store state\n * with the cookie's token and model data.\n *\n * NB! This function doesn't validate the token or its data.\n * Usually this isn't a concern if you are interacting only with the\n * PocketBase API because it has the proper server-side security checks in place,\n * but if you are using the store `isValid` state for permission controls\n * in a node server (eg. SSR), then it is recommended to call `authRefresh()`\n * after loading the cookie to ensure an up-to-date token and model state.\n * For example:\n *\n * ```js\n * pb.authStore.loadFromCookie(\"cookie string...\");\n *\n * try {\n * // get an up-to-date auth store state by veryfing and refreshing the loaded auth model (if any)\n * pb.authStore.isValid && await pb.collection('users').authRefresh();\n * } catch (_) {\n * // clear the auth store on failed refresh\n * pb.authStore.clear();\n * }\n * ```\n */\n loadFromCookie(cookie: string, key = defaultCookieKey): void {\n const rawData = cookieParse(cookie || '')[key] || '';\n\n let data: { [key: string]: any } = {};\n try {\n data = JSON.parse(rawData);\n // normalize\n if (typeof data === null || typeof data !== 'object' || Array.isArray(data)) {\n data = {};\n }\n } catch (_) {}\n\n this.save(data.token || '', data.model || null);\n }\n\n /**\n * Exports the current store state as cookie string.\n *\n * By default the following optional attributes are added:\n * - Secure\n * - HttpOnly\n * - SameSite=Strict\n * - Path=/\n * - Expires={the token expiration date}\n *\n * NB! If the generated cookie exceeds 4096 bytes, this method will\n * strip the model data to the bare minimum to try to fit within the\n * recommended size in https://www.rfc-editor.org/rfc/rfc6265#section-6.1.\n */\n exportToCookie(options?: SerializeOptions, key = defaultCookieKey): string {\n const defaultOptions: SerializeOptions = {\n secure: true,\n sameSite: true,\n httpOnly: true,\n path: \"/\",\n };\n\n // extract the token expiration date\n const payload = getTokenPayload(this.token);\n if (payload?.exp) {\n defaultOptions.expires = new Date(payload.exp * 1000);\n } else {\n defaultOptions.expires = new Date('1970-01-01');\n }\n\n // merge with the user defined options\n options = Object.assign({}, defaultOptions, options);\n\n const rawData = {\n token: this.token,\n model: this.model?.export() || null,\n };\n\n let result = cookieSerialize(key, JSON.stringify(rawData), options);\n\n const resultLength = typeof Blob !== 'undefined' ?\n (new Blob([result])).size : result.length;\n\n // strip down the model data to the bare minimum\n if (rawData.model && resultLength > 4096) {\n rawData.model = {id: rawData?.model?.id, email: rawData?.model?.email};\n if (this.model instanceof Record) {\n rawData.model.username = this.model.username;\n rawData.model.verified = this.model.verified;\n rawData.model.collectionId = this.model.collectionId;\n }\n result = cookieSerialize(key, JSON.stringify(rawData), options);\n }\n\n return result;\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * You can set the `fireImmediately` argument to true in order to invoke\n * the provided callback right after registration.\n *\n * Returns a removal function that you could call to \"unsubscribe\" from the changes.\n */\n onChange(callback: OnStoreChangeFunc, fireImmediately = false): () => void {\n this._onChangeCallbacks.push(callback);\n\n if (fireImmediately) {\n callback(this.token, this.model);\n }\n\n return () => {\n for (let i = this._onChangeCallbacks.length - 1; i >= 0; i--) {\n if (this._onChangeCallbacks[i] == callback) {\n delete this._onChangeCallbacks[i]; // removes the function reference\n this._onChangeCallbacks.splice(i, 1); // reindex the array\n return;\n }\n }\n }\n }\n\n protected triggerChange(): void {\n for (const callback of this._onChangeCallbacks) {\n callback && callback(this.token, this.model);\n }\n }\n}\n","import BaseAuthStore from '@/stores/BaseAuthStore';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\n/**\n * The default token store for browsers with auto fallback\n * to runtime/memory if local storage is undefined (eg. in node env).\n */\nexport default class LocalAuthStore extends BaseAuthStore {\n private storageFallback: { [key: string]: any } = {};\n private storageKey: string\n\n constructor(storageKey = \"pocketbase_auth\") {\n super();\n\n this.storageKey = storageKey;\n }\n\n /**\n * @inheritdoc\n */\n get token(): string {\n const data = this._storageGet(this.storageKey) || {};\n\n return data.token || '';\n }\n\n /**\n * @inheritdoc\n */\n get model(): Record|Admin|null {\n const data = this._storageGet(this.storageKey) || {};\n\n if (\n data === null ||\n typeof data !== 'object' ||\n data.model === null ||\n typeof data.model !== 'object'\n ) {\n return null;\n }\n\n // admins don't have `collectionId` prop\n if (typeof data.model?.collectionId === 'undefined') {\n return new Admin(data.model);\n }\n\n return new Record(data.model);\n }\n\n /**\n * @inheritdoc\n */\n save(token: string, model: Record|Admin|null) {\n this._storageSet(this.storageKey, {\n 'token': token,\n 'model': model,\n });\n\n super.save(token, model);\n }\n\n /**\n * @inheritdoc\n */\n clear() {\n this._storageRemove(this.storageKey);\n\n super.clear();\n }\n\n // ---------------------------------------------------------------\n // Internal helpers:\n // ---------------------------------------------------------------\n\n /**\n * Retrieves `key` from the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageGet(key: string): any {\n if (typeof window !== 'undefined' && window?.localStorage) {\n const rawValue = window.localStorage.getItem(key) || '';\n try {\n return JSON.parse(rawValue);\n } catch (e) { // not a json\n return rawValue;\n }\n }\n\n // fallback\n return this.storageFallback[key];\n }\n\n /**\n * Stores a new data in the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageSet(key: string, value: any) {\n if (typeof window !== 'undefined' && window?.localStorage) {\n // store in local storage\n let normalizedVal = value;\n if (typeof value !== 'string') {\n normalizedVal = JSON.stringify(value);\n }\n window.localStorage.setItem(key, normalizedVal);\n } else {\n // store in fallback\n this.storageFallback[key] = value;\n }\n }\n\n /**\n * Removes `key` from the browser's local storage and the runtime/memory.\n */\n private _storageRemove(key: string) {\n // delete from local storage\n if (typeof window !== 'undefined' && window?.localStorage) {\n window.localStorage?.removeItem(key);\n }\n\n // delete from fallback\n delete this.storageFallback[key];\n }\n}\n","import Client from '@/Client';\n\n/**\n * BaseService class that should be inherited from all API services.\n */\nexport default abstract class BaseService {\n readonly client: Client\n\n constructor(client: Client) {\n this.client = client;\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\ninterface appleClientSecret {\n secret: string;\n}\n\nexport default class SettingsService extends BaseService {\n /**\n * Fetch all available app settings.\n */\n getAll(queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Bulk updates app settings.\n */\n update(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Performs a S3 filesystem connection test.\n *\n * The currently supported `filesystem` are \"storage\" and \"backups\".\n */\n testS3(filesystem: string = \"storage\", queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'filesystem': filesystem,\n };\n\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends a test email.\n *\n * The possible `emailTemplate` values are:\n * - verification\n * - password-reset\n * - email-change\n */\n testEmail(toEmail: string, emailTemplate: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'email': toEmail,\n 'template': emailTemplate,\n };\n\n return this.client.send('/api/settings/test/email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Generates a new Apple OAuth2 client secret.\n */\n generateAppleClientSecret(\n clientId: string,\n teamId: string,\n keyId: string,\n privateKey: string,\n duration: number,\n bodyParams = {},\n queryParams: BaseQueryParams = {}\n ): Promise {\n bodyParams = Object.assign({\n clientId,\n teamId,\n keyId,\n privateKey,\n duration,\n }, bodyParams);\n\n return this.client.send('/api/settings/apple/generate-client-secret', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n });\n }\n}\n","import BaseModel from './BaseModel';\n\nexport default class ListResult {\n page!: number;\n perPage!: number;\n totalItems!: number;\n totalPages!: number;\n items!: Array;\n\n constructor(\n page: number,\n perPage: number,\n totalItems: number,\n totalPages: number,\n items: Array,\n ) {\n this.page = page > 0 ? page : 1;\n this.perPage = perPage >= 0 ? perPage : 0;\n this.totalItems = totalItems >= 0 ? totalItems : 0;\n this.totalPages = totalPages >= 0 ? totalPages : 0;\n this.items = items || [];\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\nimport {\n BaseQueryParams,\n ListQueryParams\n} from '@/services/utils/QueryParams';\n\n// @todo since there is no longer need of SubCrudService consider merging with CrudService in v0.9+\nexport default abstract class BaseCrudService extends BaseService {\n /**\n * Response data decoder.\n */\n abstract decode(data: { [key: string]: any }): M\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n protected _getFullList(basePath: string, batchSize = 200, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize || 200, queryParams).then((list) => {\n const castedList = (list as any as ListResult);\n const items = castedList.items;\n const totalItems = castedList.totalItems;\n\n result = result.concat(items);\n\n if (items.length && totalItems > result.length) {\n return request(page + 1);\n }\n\n return result;\n });\n }\n\n return request(1);\n }\n\n /**\n * Returns paginated items list.\n */\n protected _getList(basePath: string, page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send(basePath, {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData.items || [];\n for (const item of responseData.items) {\n items.push(this.decode(item) as any as T);\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns single item by its id.\n */\n protected _getOne(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Returns the first found item by a list filter.\n *\n * Internally it calls `_getList(basePath, 1, 1, { filter })` and returns its\n * first item.\n *\n * For consistency with `_getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n protected _getFirstListItem(basePath: string, filter: string, queryParams: BaseQueryParams = {}): Promise {\n queryParams = Object.assign({\n 'filter': filter,\n '$cancelKey': 'one_by_filter_' + basePath + \"_\" + filter,\n }, queryParams);\n\n return this._getList(basePath, 1, 1, queryParams)\n .then((result) => {\n if (!result?.items?.length) {\n throw new ClientResponseError({\n status: 404,\n data: {\n code: 404,\n message: \"The requested resource wasn't found.\",\n data: {},\n },\n });\n }\n\n return result.items[0];\n });\n }\n\n /**\n * Creates a new item.\n */\n protected _create(basePath: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath, {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Updates an existing item by its id.\n */\n protected _update(basePath: string, id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n protected _delete(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n}\n","import ListResult from '@/models/utils/ListResult';\nimport BaseModel from '@/models/utils/BaseModel';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n FullListQueryParams\n} from '@/services/utils/QueryParams';\n\nexport default abstract class CrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/admins').\n */\n abstract get baseCrudPath(): string\n\n /**\n * Returns a promise with all list items batch fetched at once\n * (by default 200 items per request; to change it set the `batch` query param).\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(queryParams?: FullListQueryParams): Promise>\n\n /**\n * Legacy version of getFullList with explicitly specified batch size.\n */\n getFullList(batch?: number, queryParams?: ListQueryParams): Promise>\n\n getFullList(batchOrqueryParams?: number|FullListQueryParams, queryParams?: ListQueryParams): Promise> {\n if (typeof batchOrqueryParams == \"number\") {\n return this._getFullList(this.baseCrudPath, batchOrqueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrqueryParams, queryParams);\n\n return this._getFullList(this.baseCrudPath, params.batch || 200, params);\n }\n\n /**\n * Returns paginated items list.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n return this._getList(this.baseCrudPath, page, perPage, queryParams);\n }\n\n /**\n * Returns the first found item by the specified filter.\n *\n * Internally it calls `getList(1, 1, { filter })` and returns the\n * first found item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n *\n * For consistency with `getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n getFirstListItem(filter: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getFirstListItem(this.baseCrudPath, filter, queryParams);\n }\n\n /**\n * Returns single item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getOne(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getOne(this.baseCrudPath, id, queryParams);\n }\n\n /**\n * Creates a new item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n create(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._create(this.baseCrudPath, bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._update(this.baseCrudPath, id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._delete(this.baseCrudPath, id, queryParams);\n }\n}\n","import Admin from '@/models/Admin';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface AdminAuthResponse {\n [key: string]: any;\n\n token: string;\n admin: Admin;\n}\n\nexport default class AdminService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Admin {\n return new Admin(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/admins';\n }\n\n // ---------------------------------------------------------------\n // Post update/delete AuthStore sync\n // ---------------------------------------------------------------\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n // update the store state if the updated item id matches with the stored model\n if (\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === item?.id\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n // clear the store state if the deleted item id matches with the stored model\n if (\n success &&\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === id\n ) {\n this.client.authStore.clear();\n }\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful authorize response.\n */\n protected authResponse(responseData: any): AdminAuthResponse {\n const admin = this.decode(responseData?.admin || {});\n\n if (responseData?.token && responseData?.admin) {\n this.client.authStore.save(responseData.token, admin);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'admin': admin,\n });\n }\n\n /**\n * Authenticate an admin account with its email and password\n * and returns a new admin token and data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authWithPassword(\n email: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'identity': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Refreshes the current admin authenticated instance and\n * returns a new token and admin data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authRefresh(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCrudPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends admin password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms admin password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class ExternalAuth extends BaseModel {\n recordId!: string;\n collectionId!: string;\n provider!: string;\n providerId!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.recordId = typeof data.recordId === 'string' ? data.recordId : '';\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.provider = typeof data.provider === 'string' ? data.provider : '';\n this.providerId = typeof data.providerId === 'string' ? data.providerId : '';\n }\n}\n","import Client from '@/Client';\nimport ClientResponseError from '@/ClientResponseError';\nimport Record from '@/models/Record';\nimport ExternalAuth from '@/models/ExternalAuth';\nimport ListResult from '@/models/utils/ListResult';\nimport CrudService from '@/services/utils/CrudService';\nimport { UnsubscribeFunc } from '@/services/RealtimeService';\nimport {\n BaseQueryParams,\n RecordQueryParams,\n RecordListQueryParams,\n RecordFullListQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface RecordAuthResponse {\n record: T;\n token: string;\n meta?: {[key: string]: any};\n}\n\nexport interface AuthProviderInfo {\n name: string;\n state: string;\n codeVerifier: string;\n codeChallenge: string;\n codeChallengeMethod: string;\n authUrl: string;\n}\n\nexport interface AuthMethodsList {\n usernamePassword: boolean;\n emailPassword: boolean;\n authProviders: Array;\n}\n\nexport interface RecordSubscription {\n action: string; // eg. create, update, delete\n record: T;\n}\n\nexport type OAuth2UrlCallback = (url: string) => void|Promise;\n\nexport interface OAuth2AuthConfig {\n // the name of the OAuth2 provider (eg. \"google\")\n provider: string;\n\n // custom scopes to overwrite the default ones\n scopes?: Array;\n\n // optional record create data\n createData?: {[key: string]: any};\n\n // optional callback that is triggered after the OAuth2 sign-in/sign-up url generation\n urlCallback?: OAuth2UrlCallback;\n\n // optional query params to send with the PocketBase auth request (eg. fields, expand, etc.)\n query?: RecordQueryParams;\n\n // optional body params to send with the PocketBase auth request\n body?: {[key: string]: any};\n}\n\nexport default class RecordService extends CrudService {\n readonly collectionIdOrName: string;\n\n constructor(client: Client, collectionIdOrName: string) {\n super(client);\n\n this.collectionIdOrName = collectionIdOrName;\n }\n\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): T {\n return new Record(data) as any as T;\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return this.baseCollectionPath + '/records';\n }\n\n /**\n * Returns the current collection service base path.\n */\n get baseCollectionPath(): string {\n return '/api/collections/' + encodeURIComponent(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Realtime handlers\n // ---------------------------------------------------------------\n\n /**\n * @deprecated Use subscribe(recordId, callback) instead.\n *\n * Subscribe to the realtime changes of a single record in the collection.\n */\n async subscribeOne(recordId: string, callback: (data: RecordSubscription) => void): Promise {\n console.warn(\"PocketBase: subscribeOne(recordId, callback) is deprecated. Please replace it with subscribe(recordId, callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName + \"/\" + recordId, callback);\n }\n\n /**\n * @deprecated This form of subscribe is deprecated. Please use `subscribe(\"*\", callback)`.\n */\n async subscribe(callback: (data: RecordSubscription) => void): Promise\n\n /**\n * Subscribe to realtime changes to the specified topic (\"*\" or record id).\n *\n * If `topic` is the wildcard \"*\", then this method will subscribe to\n * any record changes in the collection.\n *\n * If `topic` is a record id, then this method will subscribe only\n * to changes of the specified record id.\n *\n * It's OK to subscribe multiple times to the same topic.\n * You can use the returned `UnsubscribeFunc` to remove only a single subscription.\n * Or use `unsubscribe(topic)` if you want to remove all subscriptions attached to the topic.\n */\n async subscribe(topic: string, callback: (data: RecordSubscription) => void): Promise\n\n async subscribe(\n topicOrCallback: string|((data: RecordSubscription) => void),\n callback?: (data: RecordSubscription) => void\n ): Promise {\n if (typeof topicOrCallback === 'function') {\n console.warn(\"PocketBase: subscribe(callback) is deprecated. Please replace it with subscribe('*', callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName, topicOrCallback);\n }\n\n if (!callback) {\n throw new Error(\"Missing subscription callback.\");\n }\n\n if (topicOrCallback === \"\") {\n throw new Error(\"Missing topic.\");\n }\n\n let topic = this.collectionIdOrName;\n if (topicOrCallback !== \"*\") {\n topic += ('/' + topicOrCallback);\n }\n\n return this.client.realtime.subscribe(topic, callback)\n }\n\n /**\n * Unsubscribe from all subscriptions of the specified topic\n * (\"*\" or record id).\n *\n * If `topic` is not set, then this method will unsubscribe from\n * all subscriptions associated to the current collection.\n */\n async unsubscribe(topic?: string): Promise {\n // unsubscribe wildcard topic\n if (topic === \"*\") {\n return this.client.realtime.unsubscribe(this.collectionIdOrName);\n }\n\n // unsubscribe recordId topic\n if (topic) {\n return this.client.realtime.unsubscribe(this.collectionIdOrName + \"/\" + topic);\n }\n\n // unsubscribe from everything related to the collection\n return this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Crud handers\n // ---------------------------------------------------------------\n /**\n * @inheritdoc\n */\n getFullList(queryParams?: RecordFullListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batch?: number, queryParams?: RecordListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batchOrQueryParams?: number|RecordFullListQueryParams, queryParams?: RecordListQueryParams): Promise> {\n if (typeof batchOrQueryParams == \"number\") {\n return super.getFullList(batchOrQueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrQueryParams, queryParams);\n\n return super.getFullList(params);\n }\n\n /**\n * @inheritdoc\n */\n getList(page = 1, perPage = 30, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getList(page, perPage, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getFirstListItem(filter: string, queryParams: RecordListQueryParams = {}): Promise {\n return super.getFirstListItem(filter, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getOne(id: string, queryParams: RecordQueryParams = {}): Promise {\n return super.getOne(id, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n create(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.create(bodyParams, queryParams);\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n if (\n // is record auth\n this.client.authStore.model?.id === item?.id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n if (\n success &&\n // is record auth\n this.client.authStore.model?.id === id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.clear();\n }\n\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful collection authorization response.\n */\n protected authResponse(responseData: any): RecordAuthResponse {\n const record = this.decode(responseData?.record || {});\n\n this.client.authStore.save(responseData?.token, record);\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'record': record as any as T,\n });\n }\n\n /**\n * Returns all available collection auth methods.\n */\n listAuthMethods(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCollectionPath + '/auth-methods', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n return Object.assign({}, responseData, {\n // normalize common fields\n 'usernamePassword': !!responseData?.usernamePassword,\n 'emailPassword': !!responseData?.emailPassword,\n 'authProviders': Array.isArray(responseData?.authProviders) ? responseData?.authProviders : [],\n });\n });\n }\n\n /**\n * Authenticate a single auth collection record via its username/email and password.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n */\n authWithPassword(\n usernameOrEmail: string,\n password: string,\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'identity': usernameOrEmail,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2 code.\n *\n * If you don't have an OAuth2 code you may also want to check `authWithOAuth2` method.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n */\n authWithOAuth2Code(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData = {},\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'provider': provider,\n 'code': code,\n 'codeVerifier': codeVerifier,\n 'redirectUrl': redirectUrl,\n 'createData': createData,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-oauth2', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * @deprecated This form of authWithOAuth2 is deprecated.\n *\n * Please use `authWithOAuth2Code()` OR its simplified realtime version\n * as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\n */\n async authWithOAuth2(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData?: {[key: string]: any},\n bodyParams?: {[key: string]: any},\n queryParams?: RecordQueryParams,\n ): Promise>\n\n /**\n * Authenticate a single auth collection record with OAuth2\n * **without custom redirects, deeplinks or even page reload**.\n *\n * This method initializes a one-off realtime subscription and will\n * open a popup window with the OAuth2 vendor page to authenticate.\n * Once the external OAuth2 sign-in/sign-up flow is completed, the popup\n * window will be automatically closed and the OAuth2 data sent back\n * to the user through the previously established realtime connection.\n *\n * You can specify an optional `urlCallback` prop to customize\n * the default url `window.open` behavior.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n *\n * Example:\n *\n * ```js\n * const authData = await pb.collection(\"users\").authWithOAuth2({\n * provider: \"google\",\n * })\n * ```\n *\n * _Site-note_: when creating the OAuth2 app in the provider dashboard\n * you have to configure `https://yourdomain.com/api/oauth2-redirect`\n * as redirect URL.\n */\n async authWithOAuth2(options: OAuth2AuthConfig): Promise>\n\n async authWithOAuth2(...args: any): Promise> {\n // fallback to legacy format\n if (args.length > 1 || typeof args?.[0] === 'string') {\n console.warn(\"PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\");\n return this.authWithOAuth2Code(\n args?.[0] || '',\n args?.[1] || '',\n args?.[2] || '',\n args?.[3] || '',\n args?.[4] || {},\n args?.[5] || {},\n args?.[6] || {},\n );\n }\n\n const config = args?.[0] || {};\n\n const authMethods = await this.listAuthMethods();\n\n const provider = authMethods.authProviders.find((p) => p.name === config.provider);\n if (!provider) {\n throw new ClientResponseError(new Error(`Missing or invalid provider \"${config.provider}\".`));\n }\n\n const redirectUrl = this.client.buildUrl('/api/oauth2-redirect');\n\n return new Promise(async (resolve, reject) => {\n try {\n // initialize a one-off @oauth2 realtime subscription\n const unsubscribe = await this.client.realtime.subscribe('@oauth2', async (e) => {\n const oldState = this.client.realtime.clientId;\n\n try {\n unsubscribe();\n\n if (!e.state || oldState !== e.state) {\n throw new Error(\"State parameters don't match.\");\n }\n\n const authData = await this.authWithOAuth2Code(\n provider.name,\n e.code,\n provider.codeVerifier,\n redirectUrl,\n config.createData,\n config.body,\n config.query,\n )\n\n resolve(authData);\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n\n const url = new URL(provider.authUrl + redirectUrl);\n url.searchParams.set(\"state\", this.client.realtime.clientId);\n if (config.scopes?.length) {\n url.searchParams.set(\"scope\", config.scopes.join(\" \"));\n }\n\n await (config.urlCallback ? config.urlCallback(url.toString()) : this._defaultUrlCallback(url.toString()));\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n }\n\n /**\n * Refreshes the current authenticated record instance and\n * returns a new token and record data.\n *\n * On success this method also automatically updates the client's AuthStore.\n */\n authRefresh(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise> {\n return this.client.send(this.baseCollectionPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Sends auth record password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends auth record verification email request.\n */\n requestVerification(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record email verification request.\n */\n confirmVerification(\n verificationToken: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': verificationToken,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends an email change request to the authenticated record model.\n */\n requestEmailChange(\n newEmail: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'newEmail': newEmail,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record's new email address.\n */\n confirmEmailChange(\n emailChangeToken: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': emailChangeToken,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Lists all linked external auth providers for the specified auth record.\n */\n listExternalAuths(\n recordId: string,\n queryParams: BaseQueryParams = {}\n ): Promise> {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => {\n const items: Array = [];\n\n if (Array.isArray(responseData)) {\n for (const item of responseData) {\n items.push(new ExternalAuth(item));\n }\n }\n\n return items;\n });\n }\n\n /**\n * Unlink a single external auth provider from the specified auth record.\n */\n unlinkExternalAuth(\n recordId: string,\n provider: string,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths/' + encodeURIComponent(provider), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n // ---------------------------------------------------------------\n\n private _defaultUrlCallback(url: string) {\n if (typeof window === \"undefined\" || !window?.open) {\n throw new ClientResponseError(new Error(`Not in a browser context - please pass a custom urlCallback function.`));\n }\n\n let width = 1024;\n let height = 768;\n\n let windowWidth = window.innerWidth;\n let windowHeight = window.innerHeight;\n\n // normalize window size\n width = width > windowWidth ? windowWidth : width;\n height = height > windowHeight ? windowHeight : height;\n\n let left = (windowWidth / 2) - (width / 2);\n let top = (windowHeight / 2) - (height / 2);\n\n window.open(\n url,\n \"oauth2-popup\",\n 'width='+width+',height='+height+',top='+top+',left='+left+',resizable,menubar=no'\n );\n }\n}\n","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.name = typeof data.name !== 'undefined' ? data.name : '';\n this.type = typeof data.type !== 'undefined' ? data.type : 'text';\n this.system = !!data.system;\n this.required = !!data.required;\n this.options = typeof data.options === 'object' && data.options !== null ? data.options : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport SchemaField from '@/models/utils/SchemaField';\n\nexport default class Collection extends BaseModel {\n name!: string;\n type!: string;\n schema!: Array;\n indexes!: Array;\n system!: boolean;\n listRule!: null|string;\n viewRule!: null|string;\n createRule!: null|string;\n updateRule!: null|string;\n deleteRule!: null|string;\n options!: {[key:string]: any};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.system = !!data.system;\n this.name = typeof data.name === 'string' ? data.name : '';\n this.type = typeof data.type === 'string' ? data.type : 'base';\n this.options = typeof data.options !== 'undefined' && data.options !== null ? data.options : {};\n this.indexes = Array.isArray(data.indexes) ? data.indexes : [];\n\n // rules\n this.listRule = typeof data.listRule === 'string' ? data.listRule : null;\n this.viewRule = typeof data.viewRule === 'string' ? data.viewRule : null;\n this.createRule = typeof data.createRule === 'string' ? data.createRule : null;\n this.updateRule = typeof data.updateRule === 'string' ? data.updateRule : null;\n this.deleteRule = typeof data.deleteRule === 'string' ? data.deleteRule : null;\n\n // schema\n data.schema = Array.isArray(data.schema) ? data.schema : [];\n this.schema = [];\n for (let field of data.schema) {\n this.schema.push(new SchemaField(field));\n }\n }\n\n /**\n * @deprecated Please use $isBase instead.\n */\n get isBase(): boolean {\n return this.$isBase;\n }\n\n /**\n * Checks if the current model is \"base\" collection.\n */\n get $isBase(): boolean {\n return this.type === 'base';\n }\n\n /**\n * @deprecated Please use $isAuth instead.\n */\n get isAuth(): boolean {\n return this.$isAuth;\n }\n\n /**\n * Checks if the current model is \"auth\" collection.\n */\n get $isAuth(): boolean {\n return this.type === 'auth';\n }\n\n /**\n * @deprecated Please use $isView instead.\n */\n get isView(): boolean {\n return this.$isView;\n }\n\n /**\n * Checks if the current model is \"view\" collection.\n */\n get $isView(): boolean {\n return this.type === 'view';\n }\n}\n","import Collection from '@/models/Collection';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport default class CollectionService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Collection {\n return new Collection(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/collections';\n }\n\n /**\n * Imports the provided collections.\n *\n * If `deleteMissing` is `true`, all local collections and schema fields,\n * that are not present in the imported configuration, WILL BE DELETED\n * (including their related records data)!\n */\n async import(\n collections: Array,\n deleteMissing: boolean = false,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/import', {\n 'method': 'PUT',\n 'params': queryParams,\n 'body': {\n 'collections': collections,\n 'deleteMissing': deleteMissing,\n }\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class LogRequest extends BaseModel {\n url!: string;\n method!: string;\n status!: number;\n auth!: string;\n remoteIp!: string;\n userIp!: string;\n referer!: string;\n userAgent!: string;\n meta!: { [key: string]: any };\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // fallback to the ip field for backward compatibility\n data.remoteIp = data.remoteIp || data.ip;\n\n this.url = typeof data.url === 'string' ? data.url : '';\n this.method = typeof data.method === 'string' ? data.method : 'GET';\n this.status = typeof data.status === 'number' ? data.status : 200;\n this.auth = typeof data.auth === 'string' ? data.auth : 'guest';\n this.remoteIp = typeof data.remoteIp === 'string' ? data.remoteIp : '';\n this.userIp = typeof data.userIp === 'string' ? data.userIp : '';\n this.referer = typeof data.referer === 'string' ? data.referer : '';\n this.userAgent = typeof data.userAgent === 'string' ? data.userAgent : '';\n this.meta = typeof data.meta === 'object' && data.meta !== null ? data.meta : {};\n }\n}\n","import LogRequest from '@/models/LogRequest';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n LogStatsQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface HourlyStats {\n total: number;\n date: string;\n}\n\nexport default class LogService extends BaseService {\n /**\n * Returns paginated logged requests list.\n */\n getRequestsList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send('/api/logs/requests', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData?.items || [];\n for (const item of responseData.items) {\n items.push(new LogRequest(item));\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns a single logged request by its id.\n */\n getRequest(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/logs/requests/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => new LogRequest(responseData));\n }\n\n /**\n * Returns request logs statistics.\n */\n getRequestsStats(queryParams: LogStatsQueryParams = {}): Promise> {\n return this.client.send('/api/logs/requests/stats', {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => responseData);\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\n\ninterface promiseCallbacks {\n resolve: Function\n reject: Function\n}\n\nexport type UnsubscribeFunc = () => Promise;\n\nexport default class RealtimeService extends BaseService {\n clientId: string = \"\";\n\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 15000;\n private reconnectTimeoutId: any;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number = Infinity;\n private predefinedReconnectIntervals: Array = [\n 200, 300, 500, 1000, 1200, 1500, 2000,\n ];\n private pendingConnects: Array = [];\n\n\n /**\n * Returns whether the realtime connection has been established.\n */\n get isConnected(): boolean {\n return !!this.eventSource && !!this.clientId && !this.pendingConnects.length;\n }\n\n /**\n * Register the subscription listener.\n *\n * You can subscribe multiple times to the same topic.\n *\n * If the SSE connection is not started yet,\n * this method will also initialize it.\n */\n async subscribe(topic: string, callback: (data: any) => void): Promise {\n if (!topic) {\n throw new Error('topic must be set.')\n }\n\n const listener = function (e: Event) {\n const msgEvent = (e as MessageEvent);\n\n let data;\n try {\n data = JSON.parse(msgEvent?.data);\n } catch {}\n\n callback(data || {});\n };\n\n // store the listener\n if (!this.subscriptions[topic]) {\n this.subscriptions[topic] = [];\n }\n this.subscriptions[topic].push(listener);\n\n if (!this.isConnected) {\n // initialize sse connection\n await this.connect();\n } else if (this.subscriptions[topic].length === 1) {\n // send the updated subscriptions (if it is the first for the topic)\n await this.submitSubscriptions();\n } else {\n // only register the listener\n this.eventSource?.addEventListener(topic, listener);\n }\n\n return async (): Promise => {\n return this.unsubscribeByTopicAndListener(topic, listener);\n };\n }\n\n /**\n * Unsubscribe from all subscription listeners with the specified topic.\n *\n * If `topic` is not provided, then this method will unsubscribe\n * from all active subscriptions.\n *\n * This method is no-op if there are no active subscriptions.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribe(topic?: string): Promise {\n if (!this.hasSubscriptionListeners(topic)) {\n return; // already unsubscribed\n }\n\n if (!topic) {\n // remove all subscriptions\n this.subscriptions = {};\n } else {\n // remove all topic listeners\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n /**\n * Unsubscribe from all subscription listeners starting with the specified topic prefix.\n *\n * This method is no-op if there are no active subscriptions with the specified topic prefix.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByPrefix(topicPrefix: string): Promise {\n let hasAtleastOneTopic = false;\n for (let topic in this.subscriptions) {\n if (!topic.startsWith(topicPrefix)) {\n continue;\n }\n\n hasAtleastOneTopic = true;\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!hasAtleastOneTopic) {\n return; // nothing to unsubscribe from\n }\n\n if (this.hasSubscriptionListeners()) {\n // submit the deleted subscriptions\n await this.submitSubscriptions();\n } else {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n }\n }\n\n /**\n * Unsubscribe from all subscriptions matching the specified topic and listener function.\n *\n * This method is no-op if there are no active subscription with\n * the specified topic and listener.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByTopicAndListener(topic: string, listener: EventListener): Promise {\n if (!Array.isArray(this.subscriptions[topic]) || !this.subscriptions[topic].length) {\n return; // already unsubscribed\n }\n\n let exist = false;\n for (let i = this.subscriptions[topic].length - 1; i >= 0; i--) {\n if (this.subscriptions[topic][i] !== listener) {\n continue;\n }\n\n exist = true; // has at least one matching listener\n delete this.subscriptions[topic][i]; // removes the function reference\n this.subscriptions[topic].splice(i, 1); // reindex the array\n this.eventSource?.removeEventListener(topic, listener);\n }\n if (!exist) {\n return;\n }\n\n // remove the topic from the subscriptions list if there are no other listeners\n if (!this.subscriptions[topic].length) {\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n private hasSubscriptionListeners(topicToCheck?: string): boolean {\n this.subscriptions = this.subscriptions || {};\n\n // check the specified topic\n if (topicToCheck) {\n return !!this.subscriptions[topicToCheck]?.length;\n }\n\n // check for at least one non-empty topic\n for (let topic in this.subscriptions) {\n if (!!this.subscriptions[topic]?.length) {\n return true\n }\n }\n\n return false;\n }\n\n private async submitSubscriptions(): Promise {\n if (!this.clientId) {\n return; // no client/subscriber\n }\n\n // optimistic update\n this.addAllSubscriptionListeners();\n\n this.lastSentTopics = this.getNonEmptySubscriptionTopics();\n\n return this.client.send('/api/realtime', {\n 'method': 'POST',\n 'body': {\n 'clientId': this.clientId,\n 'subscriptions': this.lastSentTopics,\n },\n 'params': {\n '$cancelKey': \"realtime_\" + this.clientId,\n },\n }).catch((err) => {\n if (err?.isAbort) {\n return; // silently ignore aborted pending requests\n }\n throw err;\n });\n }\n\n private getNonEmptySubscriptionTopics(): Array {\n const result : Array = [];\n\n for (let topic in this.subscriptions) {\n if (this.subscriptions[topic].length) {\n result.push(topic);\n }\n }\n\n return result;\n }\n\n private addAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n this.removeAllSubscriptionListeners();\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.addEventListener(topic, listener);\n }\n }\n }\n\n private removeAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.removeEventListener(topic, listener);\n }\n }\n }\n\n private async connect(): Promise {\n if (this.reconnectAttempts > 0) {\n // immediately resolve the promise to avoid indefinitely\n // blocking the client during reconnection\n return;\n }\n\n return new Promise((resolve, reject) => {\n this.pendingConnects.push({ resolve, reject });\n\n if (this.pendingConnects.length > 1) {\n // all promises will be resolved once the connection is established\n return;\n }\n\n this.initConnect();\n })\n }\n\n private initConnect() {\n this.disconnect(true);\n\n // wait up to 15s for connect\n clearTimeout(this.connectTimeoutId);\n this.connectTimeoutId = setTimeout(() => {\n this.connectErrorHandler(new Error(\"EventSource connect took too long.\"));\n }, this.maxConnectTimeout);\n\n this.eventSource = new EventSource(this.client.buildUrl('/api/realtime'))\n\n this.eventSource.onerror = (_) => {\n this.connectErrorHandler(new Error(\"Failed to establish realtime connection.\"));\n };\n\n this.eventSource.addEventListener('PB_CONNECT', (e) => {\n const msgEvent = (e as MessageEvent);\n this.clientId = msgEvent?.lastEventId;\n\n this.submitSubscriptions()\n .then(async () => {\n let retries = 3;\n while (this.hasUnsentSubscriptions() && retries > 0) {\n retries--;\n // resubscribe to ensure that the latest topics are submitted\n //\n // This is needed because missed topics could happen on reconnect\n // if after the pending sent `submitSubscriptions()` call another `subscribe()`\n // was made before the submit was able to complete.\n await this.submitSubscriptions();\n }\n }).then(() => {\n for (let p of this.pendingConnects) {\n p.resolve();\n }\n\n // reset connect meta\n this.pendingConnects = [];\n this.reconnectAttempts = 0;\n clearTimeout(this.reconnectTimeoutId);\n clearTimeout(this.connectTimeoutId);\n }).catch((err) => {\n this.clientId = \"\";\n this.connectErrorHandler(err);\n });\n });\n }\n\n private hasUnsentSubscriptions(): boolean {\n const latestTopics = this.getNonEmptySubscriptionTopics();\n if (latestTopics.length != this.lastSentTopics.length) {\n return true;\n }\n\n for (const t of latestTopics) {\n if (!this.lastSentTopics.includes(t)) {\n return true;\n }\n }\n\n return false;\n }\n\n private connectErrorHandler(err: any) {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n\n if (\n // wasn't previously connected -> direct reject\n (!this.clientId && !this.reconnectAttempts) ||\n // was previously connected but the max reconnection limit has been reached\n this.reconnectAttempts > this.maxReconnectAttempts\n ) {\n for (let p of this.pendingConnects) {\n p.reject(new ClientResponseError(err));\n }\n this.disconnect();\n return;\n }\n\n // otherwise -> reconnect in the background\n this.disconnect(true);\n const timeout = this.predefinedReconnectIntervals[this.reconnectAttempts] || this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length - 1];\n this.reconnectAttempts++;\n this.reconnectTimeoutId = setTimeout(() => {\n this.initConnect();\n }, timeout);\n }\n\n private disconnect(fromReconnect = false): void {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n this.removeAllSubscriptionListeners();\n this.eventSource?.close();\n this.eventSource = null;\n this.clientId = \"\";\n\n if (!fromReconnect) {\n this.reconnectAttempts = 0;\n\n // reject any remaining connect promises\n const err = new ClientResponseError(new Error(\"Realtime disconnected.\"));\n for (let p of this.pendingConnects) {\n p.reject(err);\n }\n this.pendingConnects = [];\n }\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface HealthCheckResponse {\n code: number;\n message: string;\n data: {[key: string]: any};\n}\n\nexport default class HealthService extends BaseService {\n /**\n * Checks the health status of the api.\n */\n check(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/health', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport default class FileService extends BaseService {\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n const parts = [];\n parts.push(\"api\")\n parts.push(\"files\")\n parts.push(encodeURIComponent(record.collectionId || record.collectionName))\n parts.push(encodeURIComponent(record.id))\n parts.push(encodeURIComponent(filename))\n\n let result = this.client.buildUrl(parts.join('/'));\n\n if (Object.keys(queryParams).length) {\n const params = new URLSearchParams(queryParams);\n result += (result.includes(\"?\") ? \"&\" : \"?\") + params;\n }\n\n return result\n }\n\n /**\n * Requests a new private file access token for the current auth model (admin or record).\n */\n getToken(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/files/token', {\n 'method': 'POST',\n 'params': queryParams,\n }).then((data) => data?.token || '');\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface BackupFileInfo {\n key: string;\n size: number;\n modified: string;\n}\n\nexport default class BackupService extends BaseService {\n /**\n * Returns list with all available backup files.\n */\n getFullList(queryParams: BaseQueryParams = {}): Promise> {\n return this.client.send('/api/backups', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n\n /**\n * Initializes a new backup.\n */\n create(basename: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'name': basename,\n };\n\n return this.client.send('/api/backups', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Deletes a single backup file.\n */\n delete(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}`, {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Initializes an app data restore from an existing backup.\n */\n restore(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}/restore`, {\n 'method': 'POST',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Builds a download url for a single existing backup using an\n * admin file token and the backup file key.\n *\n * The file token can be generated via `pb.files.getToken()`.\n */\n getDownloadUrl(token: string, key: string): string {\n return this.client.buildUrl(`/api/backups/${encodeURIComponent(key)}?token=${encodeURIComponent(token)}`);\n }\n}\n","import ClientResponseError from '@/ClientResponseError';\nimport BaseAuthStore from '@/stores/BaseAuthStore';\nimport LocalAuthStore from '@/stores/LocalAuthStore';\nimport SettingsService from '@/services/SettingsService';\nimport AdminService from '@/services/AdminService';\nimport RecordService from '@/services/RecordService';\nimport CollectionService from '@/services/CollectionService';\nimport LogService from '@/services/LogService';\nimport RealtimeService from '@/services/RealtimeService';\nimport HealthService from '@/services/HealthService';\nimport FileService from '@/services/FileService';\nimport BackupService from '@/services/BackupService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport interface SendOptions extends RequestInit {\n headers?: { [key: string]: string };\n body?: any;\n params?: BaseQueryParams;\n}\n\nexport interface BeforeSendResult {\n [key: string]: any, // for backward compatibility\n url?: string,\n options?: {[key: string]: any}\n}\n\n/**\n * PocketBase JS Client.\n */\nexport default class Client {\n /**\n * The base PocketBase backend url address (eg. 'http://127.0.0.1.8090').\n */\n baseUrl: string;\n\n /**\n * Hook that get triggered right before sending the fetch request,\n * allowing you to inspect and modify the url and request options.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * You can return a non-empty result object `{ url, options }` to replace the url and request options entirely.\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, options) {\n * options.headers = Object.assign({}, options.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return { url, options }\n * };\n * ```\n */\n beforeSend?: (url: string, options: SendOptions) => BeforeSendResult|Promise;\n\n /**\n * Hook that get triggered after successfully sending the fetch request,\n * allowing you to inspect/modify the response object and its parsed data.\n *\n * Returns the new Promise resolved `data` that will be returned to the client.\n *\n * Example:\n * ```js\n * client.afterSend = function (response, data) {\n * if (response.status != 200) {\n * throw new ClientResponseError({\n * url: response.url,\n * status: response.status,\n * data: data,\n * });\n * }\n *\n * return data;\n * };\n * ```\n */\n afterSend?: (response: Response, data: any) => any;\n\n /**\n * Optional language code (default to `en-US`) that will be sent\n * with the requests to the server as `Accept-Language` header.\n */\n lang: string;\n\n /**\n * A replaceable instance of the local auth store service.\n */\n authStore: BaseAuthStore;\n\n /**\n * An instance of the service that handles the **Settings APIs**.\n */\n readonly settings: SettingsService;\n\n /**\n * An instance of the service that handles the **Admin APIs**.\n */\n readonly admins: AdminService;\n\n /**\n * An instance of the service that handles the **Collection APIs**.\n */\n readonly collections: CollectionService;\n\n /**\n * An instance of the service that handles the **File APIs**.\n */\n readonly files: FileService;\n\n /**\n * An instance of the service that handles the **Log APIs**.\n */\n readonly logs: LogService;\n\n /**\n * An instance of the service that handles the **Realtime APIs**.\n */\n readonly realtime: RealtimeService;\n\n /**\n * An instance of the service that handles the **Health APIs**.\n */\n readonly health: HealthService;\n\n /**\n * An instance of the service that handles the **Backup APIs**.\n */\n readonly backups: BackupService;\n\n private cancelControllers: { [key: string]: AbortController } = {};\n private recordServices: { [key: string]: RecordService } = {};\n private enableAutoCancellation: boolean = true;\n\n constructor(\n baseUrl = '/',\n authStore?: BaseAuthStore | null,\n lang = 'en-US',\n ) {\n this.baseUrl = baseUrl;\n this.lang = lang;\n this.authStore = authStore || new LocalAuthStore();\n\n // services\n this.admins = new AdminService(this);\n this.collections = new CollectionService(this);\n this.files = new FileService(this);\n this.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(this);\n this.health = new HealthService(this);\n this.backups = new BackupService(this);\n }\n\n /**\n * Returns the RecordService associated to the specified collection.\n *\n * @param {string} idOrName\n * @return {RecordService}\n */\n collection(idOrName: string): RecordService {\n if (!this.recordServices[idOrName]) {\n this.recordServices[idOrName] = new RecordService(this, idOrName);\n }\n\n return this.recordServices[idOrName];\n }\n\n /**\n * Globally enable or disable auto cancellation for pending duplicated requests.\n */\n autoCancellation(enable: boolean): Client {\n this.enableAutoCancellation = !!enable;\n\n return this;\n }\n\n /**\n * Cancels single request by its cancellation key.\n */\n cancelRequest(cancelKey: string): Client {\n if (this.cancelControllers[cancelKey]) {\n this.cancelControllers[cancelKey].abort();\n delete this.cancelControllers[cancelKey];\n }\n\n return this;\n }\n\n /**\n * Cancels all pending requests.\n */\n cancelAllRequests(): Client {\n for (let k in this.cancelControllers) {\n this.cancelControllers[k].abort();\n }\n\n this.cancelControllers = {};\n\n return this;\n }\n\n /**\n * Sends an api http request.\n */\n async send(path: string, reqOptions: SendOptions): Promise {\n let options = Object.assign({ method: 'GET' } as SendOptions, reqOptions);\n\n // JSON serialize the body if needed and set the correct content type\n // (for FormData body the Content-Type header should be skipped since the boundary is autogenerated)\n if (!this.isFormData(options.body)) {\n if (options.body && typeof options.body !== 'string') {\n options.body = JSON.stringify(options.body);\n }\n\n // add the json header (if not already)\n if (typeof options?.headers?.['Content-Type'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof options?.headers?.['Accept-Language'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Accept-Language': this.lang,\n });\n }\n\n // check if Authorization header can be added\n if (\n // has stored token\n this.authStore?.token &&\n // auth header is not explicitly set\n (typeof options?.headers?.Authorization === 'undefined')\n ) {\n options.headers = Object.assign({}, options.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && options.params?.$autoCancel !== false) {\n const cancelKey = options.params?.$cancelKey || ((options.method || 'GET') + path);\n\n // cancel previous pending requests\n this.cancelRequest(cancelKey);\n\n const controller = new AbortController();\n this.cancelControllers[cancelKey] = controller;\n options.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete options.params?.$autoCancel;\n delete options.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof options.params !== 'undefined') {\n const query = this.serializeQueryParams(options.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete options.params;\n }\n\n if (this.beforeSend) {\n const result = Object.assign({}, await this.beforeSend(url, options));\n if (typeof result.url !== \"undefined\" || typeof result.options !== \"undefined\") {\n url = result.url || url;\n options = result.options || options;\n } else if (Object.keys(result).length) {\n // legacy behavior\n options = result as SendOptions;\n console?.warn && console.warn(\"Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`.\");\n }\n }\n\n // send the request\n return fetch(url, options)\n .then(async (response) => {\n let data : any = {};\n\n try {\n data = await response.json();\n } catch (_) {\n // all api responses are expected to return json\n // with the exception of the realtime event and 204\n }\n\n if (this.afterSend) {\n data = await this.afterSend(response, data);\n }\n\n if (response.status >= 400) {\n throw new ClientResponseError({\n url: response.url,\n status: response.status,\n data: data,\n });\n }\n\n return data as T;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Legacy alias of `pb.files.getUrl()`.\n */\n getFileUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n return this.files.getUrl(record, filename, queryParams);\n }\n\n /**\n * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl;\n\n // construct an absolute base url if in a browser environment\n if (\n typeof window !== 'undefined' &&\n !!window.location &&\n !url.startsWith('https://') &&\n !url.startsWith('http://')\n ) {\n url = window.location.origin?.endsWith('/') ?\n window.location.origin.substring(0, window.location.origin.length - 1) :\n (window.location.origin || '');\n\n if (!this.baseUrl.startsWith('/')) {\n url += window.location.pathname || '/';\n url += url.endsWith('/') ? '' : '/';\n }\n\n url += this.baseUrl;\n }\n\n // concatenate the path\n if (path) {\n url += url.endsWith('/') ? '' : '/'; // append trailing slash if missing\n url += path.startsWith('/') ? path.substring(1) : path;\n }\n\n return url;\n }\n\n /**\n * Loosely checks if the specified body is a FormData instance.\n */\n private isFormData(body: any): boolean {\n return body && (\n // we are checking the constructor name because FormData\n // is not available natively in some environments and the\n // polyfill(s) may not be globally accessible\n body.constructor.name === 'FormData' ||\n // fallback to global FormData instance check\n // note: this is needed because the constructor.name could be different in case of\n // custom global FormData implementation, eg. React Native on Android/iOS\n (typeof FormData !== \"undefined\" && body instanceof FormData)\n )\n }\n\n /**\n * Serializes the provided query parameters into a query string.\n */\n private serializeQueryParams(params: {[key: string]: any}): string {\n const result: Array = [];\n for (const key in params) {\n if (params[key] === null) {\n // skip null query params\n continue;\n }\n\n const value = params[key];\n const encodedKey = encodeURIComponent(key);\n\n if (Array.isArray(value)) {\n // \"repeat\" array params\n for (const v of value) {\n result.push(encodedKey + \"=\" + encodeURIComponent(v));\n }\n } else if (value instanceof Date) {\n result.push(encodedKey + \"=\" + encodeURIComponent(value.toISOString()));\n } else if (typeof value !== null && typeof value === 'object') {\n result.push(encodedKey + \"=\" + encodeURIComponent(JSON.stringify(value)));\n } else {\n result.push(encodedKey + \"=\" + encodeURIComponent(value));\n }\n }\n\n return result.join('&');\n }\n}\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__extends","TypeError","String","__","this","constructor","create","__assign","assign","t","s","i","n","arguments","length","apply","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","adopt","then","__generator","body","f","y","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","v","op","pop","push","atobPolyfill","ClientResponseError","_super","errData","_this","url","status","response","isAbort","originalError","data","DOMException","name","message","_a","_d","_c","_b","cause","includes","defineProperty","get","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","isDate","toString","Date","valueOf","toUTCString","httpOnly","secure","priority","toLowerCase","sameSite","defaultDecode","indexOf","decodeURIComponent","encodeURIComponent","getTokenPayload","token","encodedPayload","split","map","c","charCodeAt","slice","join","JSON","parse","atob","input","str","replace","bs","buffer","bc","idx","output","charAt","fromCharCode","BaseModel","$load","load","_i","entries","key","id","created","updated","clone","$clone","structuredClone","stringify","export","$export","Record","collectionId","collectionName","_loadExpand","expand","isArray","Admin","avatar","email","defaultCookieKey","LocalAuthStore","storageKey","storageFallback","_storageGet","model","save","_storageSet","clear","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","isTokenExpired","expirationThreshold","payload","keys","exp","now","triggerChange","loadFromCookie","cookie","rawData","cookieParse","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","exportToCookie","defaultOptions","resultLength","Blob","size","username","verified","onChange","callback","fireImmediately","splice","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","filesystem","testEmail","toEmail","emailTemplate","template","generateAppleClientSecret","clientId","teamId","keyId","privateKey","duration","ListResult","page","perPage","totalItems","totalPages","items","BaseCrudService","_getFullList","basePath","batchSize","request","_getList","list","castedList","concat","item","_getOne","_getFirstListItem","filter","$cancelKey","code","_create","_update","_delete","CrudService","getFullList","batchOrqueryParams","baseCrudPath","batch","getList","getFirstListItem","getOne","delete","AdminService","authStore","success","authResponse","admin","authWithPassword","password","identity","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","batchOrQueryParams","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2Code","codeVerifier","redirectUrl","createData","authWithOAuth2","args","config","authMethods","find","buildUrl","oldState","unsubscribe_1","state","query","authData","err_2","URL","authUrl","searchParams","set","scopes","urlCallback","_defaultUrlCallback","err_1","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","open","width","height","windowWidth","innerWidth","windowHeight","innerHeight","left","top","SchemaField","type","system","required","Collection","indexes","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","$isBase","$isAuth","$isView","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","eventSource","subscriptions","lastSentTopics","maxConnectTimeout","reconnectAttempts","maxReconnectAttempts","Infinity","predefinedReconnectIntervals","pendingConnects","listener","msgEvent","isConnected","connect","submitSubscriptions","addEventListener","unsubscribeByTopicAndListener","hasSubscriptionListeners","removeEventListener","disconnect","topicPrefix","hasAtleastOneTopic","startsWith","exist","topicToCheck","addAllSubscriptionListeners","getNonEmptySubscriptionTopics","catch","err","removeAllSubscriptionListeners","initConnect","clearTimeout","connectTimeoutId","setTimeout","connectErrorHandler","EventSource","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","timeout","fromReconnect","close","HealthService","check","FileService","getUrl","filename","parts","URLSearchParams","getToken","BackupService","basename","restore","getDownloadUrl","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","files","logs","settings","health","backups","collection","idOrName","autoCancellation","enable","cancelRequest","cancelKey","abort","cancelAllRequests","k","reqOptions","isFormData","headers","Authorization","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","serializeQueryParams","beforeSend","_k","_j","_l","_m","fetch","json","afterSend","getFileUrl","location","origin","endsWith","substring","pathname","FormData","encodedKey","value_1","toISOString"],"mappings":"uCAgBA,IAAIA,cAAgB,SAASC,EAAGC,GAI5B,OAHAF,cAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,CAAE,GACzE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOC,OAAOK,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,KACzFP,cAAcC,EAAGC,EAC5B,EAEO,SAASS,UAAUV,EAAGC,GACzB,GAAiB,mBAANA,GAA0B,OAANA,EAC3B,MAAM,IAAIU,UAAU,uBAAyBC,OAAOX,GAAK,iCAE7D,SAASY,KAAOC,KAAKC,YAAcf,CAAI,CADvCD,cAAcC,EAAGC,GAEjBD,EAAEO,UAAkB,OAANN,EAAaC,OAAOc,OAAOf,IAAMY,GAAGN,UAAYN,EAAEM,UAAW,IAAIM,GACnF,CAEO,IAAII,SAAW,WAQlB,OAPAA,SAAWf,OAAOgB,QAAU,SAASD,SAASE,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAIf,KADTc,EAAIG,UAAUF,GACOnB,OAAOK,UAAUC,eAAeC,KAAKW,EAAGd,KAAIa,EAAEb,GAAKc,EAAEd,IAE9E,OAAOa,CACV,EACMF,SAASQ,MAAMX,KAAMS,UAChC,EA0EO,SAASG,UAAUC,EAASC,EAAYC,EAAGC,GAE9C,OAAO,IAAKD,IAAMA,EAAIE,WAAU,SAAUC,EAASC,GAC/C,SAASC,UAAUC,GAAS,IAAMC,KAAKN,EAAUO,KAAKF,GAAQ,CAAG,MAAOG,GAAKL,EAAOK,GAAO,CAC3F,SAASC,SAASJ,GAAS,IAAMC,KAAKN,EAAiB,MAAEK,GAAU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AOA,EAAIga,SAAS,KAAO,GAAK,IAChCha,GAAOiC,EAAK8S,WAAW,KAAO9S,EAAKgY,UAAU,GAAKhY,GAG/CjC,GAMHmX,OAAUhb,UAAAsc,WAAlB,SAAmBha,GACf,OAAOA,IAIuB,aAA1BA,EAAK9B,YAAY4D,MAII,oBAAb4Z,UAA4B1b,aAAgB0b,WAOpDhD,OAAoBhb,UAAAid,qBAA5B,SAA6B5P,GACzB,IAAMpL,EAAwB,GAC9B,IAAK,IAAMwG,KAAO4E,EACd,GAAoB,OAAhBA,EAAO5E,GAAX,CAKA,IAAM7G,EAAQyL,EAAO5E,GACfwV,EAAapX,mBAAmB4B,GAEtC,GAAI3I,MAAM0J,QAAQ5H,GAEd,IAAgB,QAAAsc,EAAAtc,EAAA2G,EAAK2V,EAAAjd,OAALsH,IAAO,CAAlB,IAAMnF,EAAC8a,EAAA3V,GACRtG,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBzD,GACrD,MACMxB,aAAiBsE,KACxBjE,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBjF,EAAMuc,gBAChC,cAAVvc,GAAmC,iBAAVA,EACvCK,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBU,KAAKyB,UAAUpH,KAEjEK,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBjF,GAfrD,CAmBL,OAAOK,EAAOqF,KAAK,MAE1B0T,MAAD"} \ No newline at end of file +{"version":3,"file":"pocketbase.iife.js","sources":["../node_modules/tslib/tslib.es6.js","../src/ClientResponseError.ts","../src/stores/utils/jwt.ts","../src/stores/utils/cookie.ts","../src/models/utils/BaseModel.ts","../src/models/Record.ts","../src/models/Admin.ts","../src/stores/BaseAuthStore.ts","../src/stores/LocalAuthStore.ts","../src/services/utils/BaseService.ts","../src/services/SettingsService.ts","../src/models/utils/ListResult.ts","../src/services/utils/BaseCrudService.ts","../src/services/utils/CrudService.ts","../src/services/AdminService.ts","../src/models/ExternalAuth.ts","../src/services/RecordService.ts","../src/models/utils/SchemaField.ts","../src/models/Collection.ts","../src/services/CollectionService.ts","../src/models/LogRequest.ts","../src/services/LogService.ts","../src/services/RealtimeService.ts","../src/services/HealthService.ts","../src/services/FileService.ts","../src/services/BackupService.ts","../src/Client.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","/**\n * ClientResponseError is a custom Error class that is intended to wrap\n * and normalize any error thrown by `Client.send()`.\n */\nexport default class ClientResponseError extends Error {\n url: string = '';\n status: number = 0;\n response: {[key: string]: any} = {};\n isAbort: boolean = false;\n originalError: any = null;\n\n constructor(errData?: any) {\n super(\"ClientResponseError\");\n\n // Set the prototype explicitly.\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, ClientResponseError.prototype);\n\n if (!(errData instanceof ClientResponseError)) {\n this.originalError = errData;\n }\n\n if (errData !== null && typeof errData === 'object') {\n this.url = typeof errData.url === 'string' ? errData.url : '';\n this.status = typeof errData.status === 'number' ? errData.status : 0;\n this.response = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\n this.isAbort = !!errData.isAbort;\n }\n\n if (typeof DOMException !== 'undefined' && errData instanceof DOMException) {\n this.isAbort = true;\n }\n\n this.name = \"ClientResponseError \" + this.status;\n this.message = this.response?.message;\n if (!this.message) {\n if (this.isAbort) {\n this.message = 'The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.';\n } else if (this.originalError?.cause?.message?.includes(\"ECONNREFUSED ::1\")) {\n this.message = 'Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).';\n } else {\n this.message = 'Something went wrong while processing your request.';\n }\n }\n }\n\n /**\n * Alias for `this.response` to preserve the backward compatibility.\n */\n get data() {\n return this.response;\n }\n\n /**\n * Make a POJO's copy of the current error class instance.\n * @see https://github.com/vuex-orm/vuex-orm/issues/255\n */\n toJSON() {\n return { ...this };\n }\n}\n","let atobPolyfill: Function;\nif (typeof atob === 'function') {\n atobPolyfill = atob\n} else {\n /**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n atobPolyfill = (input: any) => {\n const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n let str = String(input).replace(/=+$/, \"\");\n if (str.length % 4 == 1) {\n throw new Error(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = \"\";\n // get next character\n (buffer = str.charAt(idx++));\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? (bs as any) * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ?\n (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) :\n 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n\n return output;\n };\n}\n\n/**\n * Returns JWT token's payload data.\n */\nexport function getTokenPayload(token: string): { [key: string]: any } {\n if (token) {\n try {\n const encodedPayload = decodeURIComponent(atobPolyfill(token.split('.')[1]).split('').map(function (c: string) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n\n return JSON.parse(encodedPayload) || {};\n } catch (e) {\n }\n }\n\n return {};\n}\n\n/**\n * Checks whether a JWT token is expired or not.\n * Tokens without `exp` payload key are considered valid.\n * Tokens with empty payload (eg. invalid token strings) are considered expired.\n *\n * @param token The token to check.\n * @param [expirationThreshold] Time in seconds that will be subtracted from the token `exp` property.\n */\nexport function isTokenExpired(token: string, expirationThreshold = 0): boolean {\n let payload = getTokenPayload(token);\n\n if (\n Object.keys(payload).length > 0 &&\n (!payload.exp || (payload.exp - expirationThreshold) > (Date.now() / 1000))\n ) {\n return false;\n }\n\n return true;\n}\n","/**\n * -------------------------------------------------------------------\n * Simple cookie parse and serialize utilities mostly based on the\n * node module https://github.com/jshttp/cookie.\n * -------------------------------------------------------------------\n */\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\nexport interface ParseOptions{\n decode?: (val: string) => string,\n}\n\n/**\n* Parses the given cookie header string into an object\n* The object has the various cookies as keys(names) => values\n*/\nexport function cookieParse(str: string, options?: ParseOptions): { [key: string]: any } {\n const result: { [key: string]: any } = {};\n\n if (typeof str !== 'string') {\n return result;\n }\n\n const opt = Object.assign({}, options || {});\n const decode = opt.decode || defaultDecode;\n\n let index = 0;\n while (index < str.length) {\n const eqIdx = str.indexOf('=', index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = str.indexOf(';', index);\n\n if (endIdx === -1) {\n endIdx = str.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1;\n continue;\n }\n\n const key = str.slice(index, eqIdx).trim();\n\n // only assign once\n if (undefined === result[key]) {\n let val = str.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n result[key] = decode(val);\n } catch (_) {\n result[key] = val; // no decoding\n }\n }\n\n index = endIdx + 1;\n }\n\n return result;\n};\n\nexport interface SerializeOptions{\n encode?: (val: string | number | boolean) => string,\n maxAge?: number,\n domain?: string,\n path?: string,\n expires?: Date,\n httpOnly?: boolean,\n secure?: boolean,\n priority?: string,\n sameSite?: boolean|string,\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * ```js\n * cookieSerialize('foo', 'bar', { httpOnly: true }) // \"foo=bar; httpOnly\"\n * ```\n */\nexport function cookieSerialize(name: string, val: string, options?: SerializeOptions): string {\n const opt = Object.assign({}, options || {});\n const encode = opt.encode || defaultEncode;\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n const value = encode(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n let result = name + '=' + value;\n\n if (opt.maxAge != null) {\n const maxAge = opt.maxAge - 0;\n\n if (isNaN(maxAge) || !isFinite(maxAge)) {\n throw new TypeError('option maxAge is invalid');\n }\n\n result += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n result += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n result += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (!isDate(opt.expires) || isNaN(opt.expires.valueOf())) {\n throw new TypeError('option expires is invalid');\n }\n\n result += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n result += '; HttpOnly';\n }\n\n if (opt.secure) {\n result += '; Secure';\n }\n\n if (opt.priority) {\n const priority = typeof opt.priority === 'string' ? opt.priority.toLowerCase() : opt.priority;\n\n switch (priority) {\n case 'low':\n result += '; Priority=Low';\n break;\n case 'medium':\n result += '; Priority=Medium';\n break;\n case 'high':\n result += '; Priority=High';\n break;\n default:\n throw new TypeError('option priority is invalid');\n }\n }\n\n if (opt.sameSite) {\n const sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n result += '; SameSite=Strict';\n break;\n case 'lax':\n result += '; SameSite=Lax';\n break;\n case 'strict':\n result += '; SameSite=Strict';\n break;\n case 'none':\n result += '; SameSite=None';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return result;\n};\n\n/**\n * Default URL-decode string value function.\n * Optimized to skip native call when no `%`.\n */\nfunction defaultDecode(val: string): string {\n return val.indexOf('%') !== -1\n ? decodeURIComponent(val)\n : val;\n}\n\n/**\n * Default URL-encode value function.\n */\nfunction defaultEncode(val: string | number | boolean): string {\n return encodeURIComponent(val);\n}\n\n/**\n * Determines if value is a Date.\n */\nfunction isDate(val: any): boolean {\n return (\n Object.prototype.toString.call(val) === '[object Date]' ||\n val instanceof Date\n );\n}\n","export default abstract class BaseModel {\n [key: string]: any,\n\n id!: string;\n created!: string;\n updated!: string;\n\n constructor(data: { [key: string]: any } = {}) {\n this.$load(data || {});\n }\n\n /**\n * Alias of this.$load(data).\n */\n load(data: { [key: string]: any }) {\n return this.$load(data);\n }\n\n /**\n * Loads `data` into the current model.\n */\n $load(data: { [key: string]: any }) {\n for (const [key, value] of Object.entries(data)) {\n this[key] = value;\n }\n\n // normalize known fields\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.created = typeof data.created !== 'undefined' ? data.created : '';\n this.updated = typeof data.updated !== 'undefined' ? data.updated : '';\n }\n\n /**\n * Returns whether the current loaded data represent a stored db record.\n */\n get $isNew(): boolean {\n return !this.id;\n }\n\n /**\n * Alias of this.clone().\n */\n clone(): BaseModel {\n return this.$clone();\n }\n\n /**\n * Creates a deep clone of the current model.\n */\n $clone(): BaseModel {\n const clone = typeof structuredClone === 'function' ?\n structuredClone(this) : JSON.parse(JSON.stringify(this));\n\n return new (this.constructor as any)(clone);\n }\n\n /**\n * Alias of this.$export().\n */\n export(): { [key: string]: any } {\n return this.$export();\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n $export(): { [key: string]: any } {\n return typeof structuredClone === 'function' ?\n structuredClone(this) : Object.assign({}, this);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Record extends BaseModel {\n collectionId!: string;\n collectionName!: string;\n expand!: {[key: string]: Record|Array};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // normalize common fields\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.collectionName = typeof data.collectionName === 'string' ? data.collectionName : '';\n\n // normalize expand items\n this._loadExpand(data.expand);\n }\n\n /**\n * Loads the provided expand items and recursively normalizes each\n * item to a `Record|Array`.\n */\n private _loadExpand(expand: { [key: string]: any }) {\n expand = expand || {};\n this.expand = {};\n\n for (const key in expand) {\n if (Array.isArray(expand[key])) {\n this.expand[key] = expand[key].map((data: any) => new Record(data || {}));\n } else {\n this.expand[key] = new Record(expand[key] || {});\n }\n }\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Admin extends BaseModel {\n avatar!: number;\n email!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.avatar = typeof data.avatar === 'number' ? data.avatar : 0;\n this.email = typeof data.email === 'string' ? data.email : '';\n }\n}\n","import { cookieParse, cookieSerialize, SerializeOptions } from '@/stores/utils/cookie';\nimport { isTokenExpired, getTokenPayload } from '@/stores/utils/jwt';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\nexport type OnStoreChangeFunc = (token: string, model: Record|Admin|null) => void;\n\nconst defaultCookieKey = 'pb_auth';\n\n/**\n * Base AuthStore class that is intended to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore {\n protected baseToken: string = '';\n protected baseModel: Record|Admin|null = null;\n\n private _onChangeCallbacks: Array = [];\n\n /**\n * Retrieves the stored token (if any).\n */\n get token(): string {\n return this.baseToken;\n }\n\n /**\n * Retrieves the stored model data (if any).\n */\n get model(): Record|Admin|null {\n return this.baseModel;\n }\n\n /**\n * Loosely checks if the store has valid token (aka. existing and unexpired exp claim).\n */\n get isValid(): boolean {\n return !isTokenExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: Record|Admin|null): void {\n this.baseToken = token || '';\n\n // normalize the model instance\n if (model !== null && typeof model === 'object') {\n this.baseModel = typeof (model as any).collectionId !== 'undefined' ?\n new Record(model) : new Admin(model);\n } else {\n this.baseModel = null;\n }\n\n this.triggerChange();\n }\n\n /**\n * Removes the stored token and model data form the auth store.\n */\n clear(): void {\n this.baseToken = '';\n this.baseModel = null;\n this.triggerChange();\n }\n\n /**\n * Parses the provided cookie string and updates the store state\n * with the cookie's token and model data.\n *\n * NB! This function doesn't validate the token or its data.\n * Usually this isn't a concern if you are interacting only with the\n * PocketBase API because it has the proper server-side security checks in place,\n * but if you are using the store `isValid` state for permission controls\n * in a node server (eg. SSR), then it is recommended to call `authRefresh()`\n * after loading the cookie to ensure an up-to-date token and model state.\n * For example:\n *\n * ```js\n * pb.authStore.loadFromCookie(\"cookie string...\");\n *\n * try {\n * // get an up-to-date auth store state by veryfing and refreshing the loaded auth model (if any)\n * pb.authStore.isValid && await pb.collection('users').authRefresh();\n * } catch (_) {\n * // clear the auth store on failed refresh\n * pb.authStore.clear();\n * }\n * ```\n */\n loadFromCookie(cookie: string, key = defaultCookieKey): void {\n const rawData = cookieParse(cookie || '')[key] || '';\n\n let data: { [key: string]: any } = {};\n try {\n data = JSON.parse(rawData);\n // normalize\n if (typeof data === null || typeof data !== 'object' || Array.isArray(data)) {\n data = {};\n }\n } catch (_) {}\n\n this.save(data.token || '', data.model || null);\n }\n\n /**\n * Exports the current store state as cookie string.\n *\n * By default the following optional attributes are added:\n * - Secure\n * - HttpOnly\n * - SameSite=Strict\n * - Path=/\n * - Expires={the token expiration date}\n *\n * NB! If the generated cookie exceeds 4096 bytes, this method will\n * strip the model data to the bare minimum to try to fit within the\n * recommended size in https://www.rfc-editor.org/rfc/rfc6265#section-6.1.\n */\n exportToCookie(options?: SerializeOptions, key = defaultCookieKey): string {\n const defaultOptions: SerializeOptions = {\n secure: true,\n sameSite: true,\n httpOnly: true,\n path: \"/\",\n };\n\n // extract the token expiration date\n const payload = getTokenPayload(this.token);\n if (payload?.exp) {\n defaultOptions.expires = new Date(payload.exp * 1000);\n } else {\n defaultOptions.expires = new Date('1970-01-01');\n }\n\n // merge with the user defined options\n options = Object.assign({}, defaultOptions, options);\n\n const rawData = {\n token: this.token,\n model: this.model?.export() || null,\n };\n\n let result = cookieSerialize(key, JSON.stringify(rawData), options);\n\n const resultLength = typeof Blob !== 'undefined' ?\n (new Blob([result])).size : result.length;\n\n // strip down the model data to the bare minimum\n if (rawData.model && resultLength > 4096) {\n rawData.model = {id: rawData?.model?.id, email: rawData?.model?.email};\n if (this.model instanceof Record) {\n rawData.model.username = this.model.username;\n rawData.model.verified = this.model.verified;\n rawData.model.collectionId = this.model.collectionId;\n }\n result = cookieSerialize(key, JSON.stringify(rawData), options);\n }\n\n return result;\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * You can set the `fireImmediately` argument to true in order to invoke\n * the provided callback right after registration.\n *\n * Returns a removal function that you could call to \"unsubscribe\" from the changes.\n */\n onChange(callback: OnStoreChangeFunc, fireImmediately = false): () => void {\n this._onChangeCallbacks.push(callback);\n\n if (fireImmediately) {\n callback(this.token, this.model);\n }\n\n return () => {\n for (let i = this._onChangeCallbacks.length - 1; i >= 0; i--) {\n if (this._onChangeCallbacks[i] == callback) {\n delete this._onChangeCallbacks[i]; // removes the function reference\n this._onChangeCallbacks.splice(i, 1); // reindex the array\n return;\n }\n }\n }\n }\n\n protected triggerChange(): void {\n for (const callback of this._onChangeCallbacks) {\n callback && callback(this.token, this.model);\n }\n }\n}\n","import BaseAuthStore from '@/stores/BaseAuthStore';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\n/**\n * The default token store for browsers with auto fallback\n * to runtime/memory if local storage is undefined (eg. in node env).\n */\nexport default class LocalAuthStore extends BaseAuthStore {\n private storageFallback: { [key: string]: any } = {};\n private storageKey: string\n\n constructor(storageKey = \"pocketbase_auth\") {\n super();\n\n this.storageKey = storageKey;\n }\n\n /**\n * @inheritdoc\n */\n get token(): string {\n const data = this._storageGet(this.storageKey) || {};\n\n return data.token || '';\n }\n\n /**\n * @inheritdoc\n */\n get model(): Record|Admin|null {\n const data = this._storageGet(this.storageKey) || {};\n\n if (\n data === null ||\n typeof data !== 'object' ||\n data.model === null ||\n typeof data.model !== 'object'\n ) {\n return null;\n }\n\n // admins don't have `collectionId` prop\n if (typeof data.model?.collectionId === 'undefined') {\n return new Admin(data.model);\n }\n\n return new Record(data.model);\n }\n\n /**\n * @inheritdoc\n */\n save(token: string, model: Record|Admin|null) {\n this._storageSet(this.storageKey, {\n 'token': token,\n 'model': model,\n });\n\n super.save(token, model);\n }\n\n /**\n * @inheritdoc\n */\n clear() {\n this._storageRemove(this.storageKey);\n\n super.clear();\n }\n\n // ---------------------------------------------------------------\n // Internal helpers:\n // ---------------------------------------------------------------\n\n /**\n * Retrieves `key` from the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageGet(key: string): any {\n if (typeof window !== 'undefined' && window?.localStorage) {\n const rawValue = window.localStorage.getItem(key) || '';\n try {\n return JSON.parse(rawValue);\n } catch (e) { // not a json\n return rawValue;\n }\n }\n\n // fallback\n return this.storageFallback[key];\n }\n\n /**\n * Stores a new data in the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageSet(key: string, value: any) {\n if (typeof window !== 'undefined' && window?.localStorage) {\n // store in local storage\n let normalizedVal = value;\n if (typeof value !== 'string') {\n normalizedVal = JSON.stringify(value);\n }\n window.localStorage.setItem(key, normalizedVal);\n } else {\n // store in fallback\n this.storageFallback[key] = value;\n }\n }\n\n /**\n * Removes `key` from the browser's local storage and the runtime/memory.\n */\n private _storageRemove(key: string) {\n // delete from local storage\n if (typeof window !== 'undefined' && window?.localStorage) {\n window.localStorage?.removeItem(key);\n }\n\n // delete from fallback\n delete this.storageFallback[key];\n }\n}\n","import Client from '@/Client';\n\n/**\n * BaseService class that should be inherited from all API services.\n */\nexport default abstract class BaseService {\n readonly client: Client\n\n constructor(client: Client) {\n this.client = client;\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\ninterface appleClientSecret {\n secret: string;\n}\n\nexport default class SettingsService extends BaseService {\n /**\n * Fetch all available app settings.\n */\n getAll(queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Bulk updates app settings.\n */\n update(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Performs a S3 filesystem connection test.\n *\n * The currently supported `filesystem` are \"storage\" and \"backups\".\n */\n testS3(filesystem: string = \"storage\", queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'filesystem': filesystem,\n };\n\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends a test email.\n *\n * The possible `emailTemplate` values are:\n * - verification\n * - password-reset\n * - email-change\n */\n testEmail(toEmail: string, emailTemplate: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'email': toEmail,\n 'template': emailTemplate,\n };\n\n return this.client.send('/api/settings/test/email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Generates a new Apple OAuth2 client secret.\n */\n generateAppleClientSecret(\n clientId: string,\n teamId: string,\n keyId: string,\n privateKey: string,\n duration: number,\n bodyParams = {},\n queryParams: BaseQueryParams = {}\n ): Promise {\n bodyParams = Object.assign({\n clientId,\n teamId,\n keyId,\n privateKey,\n duration,\n }, bodyParams);\n\n return this.client.send('/api/settings/apple/generate-client-secret', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n });\n }\n}\n","import BaseModel from './BaseModel';\n\nexport default class ListResult {\n page!: number;\n perPage!: number;\n totalItems!: number;\n totalPages!: number;\n items!: Array;\n\n constructor(\n page: number,\n perPage: number,\n totalItems: number,\n totalPages: number,\n items: Array,\n ) {\n this.page = page > 0 ? page : 1;\n this.perPage = perPage >= 0 ? perPage : 0;\n this.totalItems = totalItems >= 0 ? totalItems : 0;\n this.totalPages = totalPages >= 0 ? totalPages : 0;\n this.items = items || [];\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\nimport {\n BaseQueryParams,\n ListQueryParams\n} from '@/services/utils/QueryParams';\n\n// @todo since there is no longer need of SubCrudService consider merging with CrudService in v0.9+\nexport default abstract class BaseCrudService extends BaseService {\n /**\n * Response data decoder.\n */\n abstract decode(data: { [key: string]: any }): M\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n protected _getFullList(basePath: string, batchSize = 200, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize || 200, queryParams).then((list) => {\n const castedList = (list as any as ListResult);\n const items = castedList.items;\n const totalItems = castedList.totalItems;\n\n result = result.concat(items);\n\n if (items.length && totalItems > result.length) {\n return request(page + 1);\n }\n\n return result;\n });\n }\n\n return request(1);\n }\n\n /**\n * Returns paginated items list.\n */\n protected _getList(basePath: string, page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send(basePath, {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData.items || [];\n for (const item of responseData.items) {\n items.push(this.decode(item) as any as T);\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns single item by its id.\n */\n protected _getOne(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Returns the first found item by a list filter.\n *\n * Internally it calls `_getList(basePath, 1, 1, { filter })` and returns its\n * first item.\n *\n * For consistency with `_getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n protected _getFirstListItem(basePath: string, filter: string, queryParams: BaseQueryParams = {}): Promise {\n queryParams = Object.assign({\n 'filter': filter,\n '$cancelKey': 'one_by_filter_' + basePath + \"_\" + filter,\n }, queryParams);\n\n return this._getList(basePath, 1, 1, queryParams)\n .then((result) => {\n if (!result?.items?.length) {\n throw new ClientResponseError({\n status: 404,\n data: {\n code: 404,\n message: \"The requested resource wasn't found.\",\n data: {},\n },\n });\n }\n\n return result.items[0];\n });\n }\n\n /**\n * Creates a new item.\n */\n protected _create(basePath: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath, {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Updates an existing item by its id.\n */\n protected _update(basePath: string, id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n protected _delete(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n}\n","import ListResult from '@/models/utils/ListResult';\nimport BaseModel from '@/models/utils/BaseModel';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n FullListQueryParams\n} from '@/services/utils/QueryParams';\n\nexport default abstract class CrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/admins').\n */\n abstract get baseCrudPath(): string\n\n /**\n * Returns a promise with all list items batch fetched at once\n * (by default 200 items per request; to change it set the `batch` query param).\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(queryParams?: FullListQueryParams): Promise>\n\n /**\n * Legacy version of getFullList with explicitly specified batch size.\n */\n getFullList(batch?: number, queryParams?: ListQueryParams): Promise>\n\n getFullList(batchOrqueryParams?: number|FullListQueryParams, queryParams?: ListQueryParams): Promise> {\n if (typeof batchOrqueryParams == \"number\") {\n return this._getFullList(this.baseCrudPath, batchOrqueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrqueryParams, queryParams);\n\n return this._getFullList(this.baseCrudPath, params.batch || 200, params);\n }\n\n /**\n * Returns paginated items list.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n return this._getList(this.baseCrudPath, page, perPage, queryParams);\n }\n\n /**\n * Returns the first found item by the specified filter.\n *\n * Internally it calls `getList(1, 1, { filter })` and returns the\n * first found item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n *\n * For consistency with `getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n getFirstListItem(filter: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getFirstListItem(this.baseCrudPath, filter, queryParams);\n }\n\n /**\n * Returns single item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getOne(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getOne(this.baseCrudPath, id, queryParams);\n }\n\n /**\n * Creates a new item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n create(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._create(this.baseCrudPath, bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._update(this.baseCrudPath, id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._delete(this.baseCrudPath, id, queryParams);\n }\n}\n","import Admin from '@/models/Admin';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface AdminAuthResponse {\n [key: string]: any;\n\n token: string;\n admin: Admin;\n}\n\nexport default class AdminService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Admin {\n return new Admin(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/admins';\n }\n\n // ---------------------------------------------------------------\n // Post update/delete AuthStore sync\n // ---------------------------------------------------------------\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n // update the store state if the updated item id matches with the stored model\n if (\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === item?.id\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n // clear the store state if the deleted item id matches with the stored model\n if (\n success &&\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === id\n ) {\n this.client.authStore.clear();\n }\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful authorize response.\n */\n protected authResponse(responseData: any): AdminAuthResponse {\n const admin = this.decode(responseData?.admin || {});\n\n if (responseData?.token && responseData?.admin) {\n this.client.authStore.save(responseData.token, admin);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'admin': admin,\n });\n }\n\n /**\n * Authenticate an admin account with its email and password\n * and returns a new admin token and data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authWithPassword(\n email: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'identity': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Refreshes the current admin authenticated instance and\n * returns a new token and admin data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authRefresh(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCrudPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends admin password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms admin password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class ExternalAuth extends BaseModel {\n recordId!: string;\n collectionId!: string;\n provider!: string;\n providerId!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.recordId = typeof data.recordId === 'string' ? data.recordId : '';\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.provider = typeof data.provider === 'string' ? data.provider : '';\n this.providerId = typeof data.providerId === 'string' ? data.providerId : '';\n }\n}\n","import Client from '@/Client';\nimport ClientResponseError from '@/ClientResponseError';\nimport Record from '@/models/Record';\nimport ExternalAuth from '@/models/ExternalAuth';\nimport ListResult from '@/models/utils/ListResult';\nimport CrudService from '@/services/utils/CrudService';\nimport { UnsubscribeFunc } from '@/services/RealtimeService';\nimport {\n BaseQueryParams,\n RecordQueryParams,\n RecordListQueryParams,\n RecordFullListQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface RecordAuthResponse {\n record: T;\n token: string;\n meta?: {[key: string]: any};\n}\n\nexport interface AuthProviderInfo {\n name: string;\n state: string;\n codeVerifier: string;\n codeChallenge: string;\n codeChallengeMethod: string;\n authUrl: string;\n}\n\nexport interface AuthMethodsList {\n usernamePassword: boolean;\n emailPassword: boolean;\n authProviders: Array;\n}\n\nexport interface RecordSubscription {\n action: string; // eg. create, update, delete\n record: T;\n}\n\nexport type OAuth2UrlCallback = (url: string) => void|Promise;\n\nexport interface OAuth2AuthConfig {\n // the name of the OAuth2 provider (eg. \"google\")\n provider: string;\n\n // custom scopes to overwrite the default ones\n scopes?: Array;\n\n // optional record create data\n createData?: {[key: string]: any};\n\n // optional callback that is triggered after the OAuth2 sign-in/sign-up url generation\n urlCallback?: OAuth2UrlCallback;\n\n // optional query params to send with the PocketBase auth request (eg. fields, expand, etc.)\n query?: RecordQueryParams;\n\n // optional body params to send with the PocketBase auth request\n body?: {[key: string]: any};\n}\n\nexport default class RecordService extends CrudService {\n readonly collectionIdOrName: string;\n\n constructor(client: Client, collectionIdOrName: string) {\n super(client);\n\n this.collectionIdOrName = collectionIdOrName;\n }\n\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): T {\n return new Record(data) as any as T;\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return this.baseCollectionPath + '/records';\n }\n\n /**\n * Returns the current collection service base path.\n */\n get baseCollectionPath(): string {\n return '/api/collections/' + encodeURIComponent(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Realtime handlers\n // ---------------------------------------------------------------\n\n /**\n * @deprecated Use subscribe(recordId, callback) instead.\n *\n * Subscribe to the realtime changes of a single record in the collection.\n */\n async subscribeOne(recordId: string, callback: (data: RecordSubscription) => void): Promise {\n console.warn(\"PocketBase: subscribeOne(recordId, callback) is deprecated. Please replace it with subscribe(recordId, callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName + \"/\" + recordId, callback);\n }\n\n /**\n * @deprecated This form of subscribe is deprecated. Please use `subscribe(\"*\", callback)`.\n */\n async subscribe(callback: (data: RecordSubscription) => void): Promise\n\n /**\n * Subscribe to realtime changes to the specified topic (\"*\" or record id).\n *\n * If `topic` is the wildcard \"*\", then this method will subscribe to\n * any record changes in the collection.\n *\n * If `topic` is a record id, then this method will subscribe only\n * to changes of the specified record id.\n *\n * It's OK to subscribe multiple times to the same topic.\n * You can use the returned `UnsubscribeFunc` to remove only a single subscription.\n * Or use `unsubscribe(topic)` if you want to remove all subscriptions attached to the topic.\n */\n async subscribe(topic: string, callback: (data: RecordSubscription) => void): Promise\n\n async subscribe(\n topicOrCallback: string|((data: RecordSubscription) => void),\n callback?: (data: RecordSubscription) => void\n ): Promise {\n if (typeof topicOrCallback === 'function') {\n console.warn(\"PocketBase: subscribe(callback) is deprecated. Please replace it with subscribe('*', callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName, topicOrCallback);\n }\n\n if (!callback) {\n throw new Error(\"Missing subscription callback.\");\n }\n\n if (topicOrCallback === \"\") {\n throw new Error(\"Missing topic.\");\n }\n\n let topic = this.collectionIdOrName;\n if (topicOrCallback !== \"*\") {\n topic += ('/' + topicOrCallback);\n }\n\n return this.client.realtime.subscribe(topic, callback)\n }\n\n /**\n * Unsubscribe from all subscriptions of the specified topic\n * (\"*\" or record id).\n *\n * If `topic` is not set, then this method will unsubscribe from\n * all subscriptions associated to the current collection.\n */\n async unsubscribe(topic?: string): Promise {\n // unsubscribe wildcard topic\n if (topic === \"*\") {\n return this.client.realtime.unsubscribe(this.collectionIdOrName);\n }\n\n // unsubscribe recordId topic\n if (topic) {\n return this.client.realtime.unsubscribe(this.collectionIdOrName + \"/\" + topic);\n }\n\n // unsubscribe from everything related to the collection\n return this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Crud handers\n // ---------------------------------------------------------------\n /**\n * @inheritdoc\n */\n getFullList(queryParams?: RecordFullListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batch?: number, queryParams?: RecordListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batchOrQueryParams?: number|RecordFullListQueryParams, queryParams?: RecordListQueryParams): Promise> {\n if (typeof batchOrQueryParams == \"number\") {\n return super.getFullList(batchOrQueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrQueryParams, queryParams);\n\n return super.getFullList(params);\n }\n\n /**\n * @inheritdoc\n */\n getList(page = 1, perPage = 30, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getList(page, perPage, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getFirstListItem(filter: string, queryParams: RecordListQueryParams = {}): Promise {\n return super.getFirstListItem(filter, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getOne(id: string, queryParams: RecordQueryParams = {}): Promise {\n return super.getOne(id, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n create(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.create(bodyParams, queryParams);\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n if (\n // is record auth\n this.client.authStore.model?.id === item?.id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n if (\n success &&\n // is record auth\n this.client.authStore.model?.id === id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.clear();\n }\n\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful collection authorization response.\n */\n protected authResponse(responseData: any): RecordAuthResponse {\n const record = this.decode(responseData?.record || {});\n\n this.client.authStore.save(responseData?.token, record);\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'record': record as any as T,\n });\n }\n\n /**\n * Returns all available collection auth methods.\n */\n listAuthMethods(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCollectionPath + '/auth-methods', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n return Object.assign({}, responseData, {\n // normalize common fields\n 'usernamePassword': !!responseData?.usernamePassword,\n 'emailPassword': !!responseData?.emailPassword,\n 'authProviders': Array.isArray(responseData?.authProviders) ? responseData?.authProviders : [],\n });\n });\n }\n\n /**\n * Authenticate a single auth collection record via its username/email and password.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n */\n authWithPassword(\n usernameOrEmail: string,\n password: string,\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'identity': usernameOrEmail,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2 code.\n *\n * If you don't have an OAuth2 code you may also want to check `authWithOAuth2` method.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n */\n authWithOAuth2Code(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData = {},\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'provider': provider,\n 'code': code,\n 'codeVerifier': codeVerifier,\n 'redirectUrl': redirectUrl,\n 'createData': createData,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-oauth2', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * @deprecated This form of authWithOAuth2 is deprecated.\n *\n * Please use `authWithOAuth2Code()` OR its simplified realtime version\n * as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\n */\n async authWithOAuth2(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData?: {[key: string]: any},\n bodyParams?: {[key: string]: any},\n queryParams?: RecordQueryParams,\n ): Promise>\n\n /**\n * Authenticate a single auth collection record with OAuth2\n * **without custom redirects, deeplinks or even page reload**.\n *\n * This method initializes a one-off realtime subscription and will\n * open a popup window with the OAuth2 vendor page to authenticate.\n * Once the external OAuth2 sign-in/sign-up flow is completed, the popup\n * window will be automatically closed and the OAuth2 data sent back\n * to the user through the previously established realtime connection.\n *\n * You can specify an optional `urlCallback` prop to customize\n * the default url `window.open` behavior.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n *\n * Example:\n *\n * ```js\n * const authData = await pb.collection(\"users\").authWithOAuth2({\n * provider: \"google\",\n * })\n * ```\n *\n * _Site-note_: when creating the OAuth2 app in the provider dashboard\n * you have to configure `https://yourdomain.com/api/oauth2-redirect`\n * as redirect URL.\n */\n async authWithOAuth2(options: OAuth2AuthConfig): Promise>\n\n async authWithOAuth2(...args: any): Promise> {\n // fallback to legacy format\n if (args.length > 1 || typeof args?.[0] === 'string') {\n console.warn(\"PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\");\n return this.authWithOAuth2Code(\n args?.[0] || '',\n args?.[1] || '',\n args?.[2] || '',\n args?.[3] || '',\n args?.[4] || {},\n args?.[5] || {},\n args?.[6] || {},\n );\n }\n\n const config = args?.[0] || {};\n\n const authMethods = await this.listAuthMethods();\n\n const provider = authMethods.authProviders.find((p) => p.name === config.provider);\n if (!provider) {\n throw new ClientResponseError(new Error(`Missing or invalid provider \"${config.provider}\".`));\n }\n\n const redirectUrl = this.client.buildUrl('/api/oauth2-redirect');\n\n return new Promise(async (resolve, reject) => {\n try {\n // initialize a one-off @oauth2 realtime subscription\n const unsubscribe = await this.client.realtime.subscribe('@oauth2', async (e) => {\n const oldState = this.client.realtime.clientId;\n\n try {\n unsubscribe();\n\n if (!e.state || oldState !== e.state) {\n throw new Error(\"State parameters don't match.\");\n }\n\n const authData = await this.authWithOAuth2Code(\n provider.name,\n e.code,\n provider.codeVerifier,\n redirectUrl,\n config.createData,\n config.body,\n config.query,\n )\n\n resolve(authData);\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n\n const url = new URL(provider.authUrl + redirectUrl);\n url.searchParams.set(\"state\", this.client.realtime.clientId);\n if (config.scopes?.length) {\n url.searchParams.set(\"scope\", config.scopes.join(\" \"));\n }\n\n await (config.urlCallback ? config.urlCallback(url.toString()) : this._defaultUrlCallback(url.toString()));\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n }\n\n /**\n * Refreshes the current authenticated record instance and\n * returns a new token and record data.\n *\n * On success this method also automatically updates the client's AuthStore.\n */\n authRefresh(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise> {\n return this.client.send(this.baseCollectionPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Sends auth record password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends auth record verification email request.\n */\n requestVerification(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record email verification request.\n */\n confirmVerification(\n verificationToken: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': verificationToken,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends an email change request to the authenticated record model.\n */\n requestEmailChange(\n newEmail: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'newEmail': newEmail,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record's new email address.\n */\n confirmEmailChange(\n emailChangeToken: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': emailChangeToken,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Lists all linked external auth providers for the specified auth record.\n */\n listExternalAuths(\n recordId: string,\n queryParams: BaseQueryParams = {}\n ): Promise> {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => {\n const items: Array = [];\n\n if (Array.isArray(responseData)) {\n for (const item of responseData) {\n items.push(new ExternalAuth(item));\n }\n }\n\n return items;\n });\n }\n\n /**\n * Unlink a single external auth provider from the specified auth record.\n */\n unlinkExternalAuth(\n recordId: string,\n provider: string,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths/' + encodeURIComponent(provider), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n // ---------------------------------------------------------------\n\n private _defaultUrlCallback(url: string) {\n if (typeof window === \"undefined\" || !window?.open) {\n throw new ClientResponseError(new Error(`Not in a browser context - please pass a custom urlCallback function.`));\n }\n\n let width = 1024;\n let height = 768;\n\n let windowWidth = window.innerWidth;\n let windowHeight = window.innerHeight;\n\n // normalize window size\n width = width > windowWidth ? windowWidth : width;\n height = height > windowHeight ? windowHeight : height;\n\n let left = (windowWidth / 2) - (width / 2);\n let top = (windowHeight / 2) - (height / 2);\n\n window.open(\n url,\n \"oauth2-popup\",\n 'width='+width+',height='+height+',top='+top+',left='+left+',resizable,menubar=no'\n );\n }\n}\n","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.name = typeof data.name !== 'undefined' ? data.name : '';\n this.type = typeof data.type !== 'undefined' ? data.type : 'text';\n this.system = !!data.system;\n this.required = !!data.required;\n this.options = typeof data.options === 'object' && data.options !== null ? data.options : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport SchemaField from '@/models/utils/SchemaField';\n\nexport default class Collection extends BaseModel {\n name!: string;\n type!: string;\n schema!: Array;\n indexes!: Array;\n system!: boolean;\n listRule!: null|string;\n viewRule!: null|string;\n createRule!: null|string;\n updateRule!: null|string;\n deleteRule!: null|string;\n options!: {[key:string]: any};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.system = !!data.system;\n this.name = typeof data.name === 'string' ? data.name : '';\n this.type = typeof data.type === 'string' ? data.type : 'base';\n this.options = typeof data.options !== 'undefined' && data.options !== null ? data.options : {};\n this.indexes = Array.isArray(data.indexes) ? data.indexes : [];\n\n // rules\n this.listRule = typeof data.listRule === 'string' ? data.listRule : null;\n this.viewRule = typeof data.viewRule === 'string' ? data.viewRule : null;\n this.createRule = typeof data.createRule === 'string' ? data.createRule : null;\n this.updateRule = typeof data.updateRule === 'string' ? data.updateRule : null;\n this.deleteRule = typeof data.deleteRule === 'string' ? data.deleteRule : null;\n\n // schema\n data.schema = Array.isArray(data.schema) ? data.schema : [];\n this.schema = [];\n for (let field of data.schema) {\n this.schema.push(new SchemaField(field));\n }\n }\n\n /**\n * @deprecated Please use $isBase instead.\n */\n get isBase(): boolean {\n return this.$isBase;\n }\n\n /**\n * Checks if the current model is \"base\" collection.\n */\n get $isBase(): boolean {\n return this.type === 'base';\n }\n\n /**\n * @deprecated Please use $isAuth instead.\n */\n get isAuth(): boolean {\n return this.$isAuth;\n }\n\n /**\n * Checks if the current model is \"auth\" collection.\n */\n get $isAuth(): boolean {\n return this.type === 'auth';\n }\n\n /**\n * @deprecated Please use $isView instead.\n */\n get isView(): boolean {\n return this.$isView;\n }\n\n /**\n * Checks if the current model is \"view\" collection.\n */\n get $isView(): boolean {\n return this.type === 'view';\n }\n}\n","import Collection from '@/models/Collection';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport default class CollectionService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Collection {\n return new Collection(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/collections';\n }\n\n /**\n * Imports the provided collections.\n *\n * If `deleteMissing` is `true`, all local collections and schema fields,\n * that are not present in the imported configuration, WILL BE DELETED\n * (including their related records data)!\n */\n async import(\n collections: Array,\n deleteMissing: boolean = false,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/import', {\n 'method': 'PUT',\n 'params': queryParams,\n 'body': {\n 'collections': collections,\n 'deleteMissing': deleteMissing,\n }\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class LogRequest extends BaseModel {\n url!: string;\n method!: string;\n status!: number;\n auth!: string;\n remoteIp!: string;\n userIp!: string;\n referer!: string;\n userAgent!: string;\n meta!: { [key: string]: any };\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // fallback to the ip field for backward compatibility\n data.remoteIp = data.remoteIp || data.ip;\n\n this.url = typeof data.url === 'string' ? data.url : '';\n this.method = typeof data.method === 'string' ? data.method : 'GET';\n this.status = typeof data.status === 'number' ? data.status : 200;\n this.auth = typeof data.auth === 'string' ? data.auth : 'guest';\n this.remoteIp = typeof data.remoteIp === 'string' ? data.remoteIp : '';\n this.userIp = typeof data.userIp === 'string' ? data.userIp : '';\n this.referer = typeof data.referer === 'string' ? data.referer : '';\n this.userAgent = typeof data.userAgent === 'string' ? data.userAgent : '';\n this.meta = typeof data.meta === 'object' && data.meta !== null ? data.meta : {};\n }\n}\n","import LogRequest from '@/models/LogRequest';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n LogStatsQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface HourlyStats {\n total: number;\n date: string;\n}\n\nexport default class LogService extends BaseService {\n /**\n * Returns paginated logged requests list.\n */\n getRequestsList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send('/api/logs/requests', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData?.items || [];\n for (const item of responseData.items) {\n items.push(new LogRequest(item));\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns a single logged request by its id.\n */\n getRequest(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/logs/requests/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => new LogRequest(responseData));\n }\n\n /**\n * Returns request logs statistics.\n */\n getRequestsStats(queryParams: LogStatsQueryParams = {}): Promise> {\n return this.client.send('/api/logs/requests/stats', {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => responseData);\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\n\ninterface promiseCallbacks {\n resolve: Function\n reject: Function\n}\n\nexport type UnsubscribeFunc = () => Promise;\n\nexport default class RealtimeService extends BaseService {\n clientId: string = \"\";\n\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 15000;\n private reconnectTimeoutId: any;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number = Infinity;\n private predefinedReconnectIntervals: Array = [\n 200, 300, 500, 1000, 1200, 1500, 2000,\n ];\n private pendingConnects: Array = [];\n\n\n /**\n * Returns whether the realtime connection has been established.\n */\n get isConnected(): boolean {\n return !!this.eventSource && !!this.clientId && !this.pendingConnects.length;\n }\n\n /**\n * Register the subscription listener.\n *\n * You can subscribe multiple times to the same topic.\n *\n * If the SSE connection is not started yet,\n * this method will also initialize it.\n */\n async subscribe(topic: string, callback: (data: any) => void): Promise {\n if (!topic) {\n throw new Error('topic must be set.')\n }\n\n const listener = function (e: Event) {\n const msgEvent = (e as MessageEvent);\n\n let data;\n try {\n data = JSON.parse(msgEvent?.data);\n } catch {}\n\n callback(data || {});\n };\n\n // store the listener\n if (!this.subscriptions[topic]) {\n this.subscriptions[topic] = [];\n }\n this.subscriptions[topic].push(listener);\n\n if (!this.isConnected) {\n // initialize sse connection\n await this.connect();\n } else if (this.subscriptions[topic].length === 1) {\n // send the updated subscriptions (if it is the first for the topic)\n await this.submitSubscriptions();\n } else {\n // only register the listener\n this.eventSource?.addEventListener(topic, listener);\n }\n\n return async (): Promise => {\n return this.unsubscribeByTopicAndListener(topic, listener);\n };\n }\n\n /**\n * Unsubscribe from all subscription listeners with the specified topic.\n *\n * If `topic` is not provided, then this method will unsubscribe\n * from all active subscriptions.\n *\n * This method is no-op if there are no active subscriptions.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribe(topic?: string): Promise {\n if (!this.hasSubscriptionListeners(topic)) {\n return; // already unsubscribed\n }\n\n if (!topic) {\n // remove all subscriptions\n this.subscriptions = {};\n } else {\n // remove all topic listeners\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n /**\n * Unsubscribe from all subscription listeners starting with the specified topic prefix.\n *\n * This method is no-op if there are no active subscriptions with the specified topic prefix.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByPrefix(topicPrefix: string): Promise {\n let hasAtleastOneTopic = false;\n for (let topic in this.subscriptions) {\n if (!topic.startsWith(topicPrefix)) {\n continue;\n }\n\n hasAtleastOneTopic = true;\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!hasAtleastOneTopic) {\n return; // nothing to unsubscribe from\n }\n\n if (this.hasSubscriptionListeners()) {\n // submit the deleted subscriptions\n await this.submitSubscriptions();\n } else {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n }\n }\n\n /**\n * Unsubscribe from all subscriptions matching the specified topic and listener function.\n *\n * This method is no-op if there are no active subscription with\n * the specified topic and listener.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByTopicAndListener(topic: string, listener: EventListener): Promise {\n if (!Array.isArray(this.subscriptions[topic]) || !this.subscriptions[topic].length) {\n return; // already unsubscribed\n }\n\n let exist = false;\n for (let i = this.subscriptions[topic].length - 1; i >= 0; i--) {\n if (this.subscriptions[topic][i] !== listener) {\n continue;\n }\n\n exist = true; // has at least one matching listener\n delete this.subscriptions[topic][i]; // removes the function reference\n this.subscriptions[topic].splice(i, 1); // reindex the array\n this.eventSource?.removeEventListener(topic, listener);\n }\n if (!exist) {\n return;\n }\n\n // remove the topic from the subscriptions list if there are no other listeners\n if (!this.subscriptions[topic].length) {\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n private hasSubscriptionListeners(topicToCheck?: string): boolean {\n this.subscriptions = this.subscriptions || {};\n\n // check the specified topic\n if (topicToCheck) {\n return !!this.subscriptions[topicToCheck]?.length;\n }\n\n // check for at least one non-empty topic\n for (let topic in this.subscriptions) {\n if (!!this.subscriptions[topic]?.length) {\n return true\n }\n }\n\n return false;\n }\n\n private async submitSubscriptions(): Promise {\n if (!this.clientId) {\n return; // no client/subscriber\n }\n\n // optimistic update\n this.addAllSubscriptionListeners();\n\n this.lastSentTopics = this.getNonEmptySubscriptionTopics();\n\n return this.client.send('/api/realtime', {\n 'method': 'POST',\n 'body': {\n 'clientId': this.clientId,\n 'subscriptions': this.lastSentTopics,\n },\n 'params': {\n '$cancelKey': this.getSubscriptionsCancelKey(),\n },\n }).catch((err) => {\n if (err?.isAbort) {\n return; // silently ignore aborted pending requests\n }\n throw err;\n });\n }\n\n private getSubscriptionsCancelKey(): string {\n return \"realtime_\" + this.clientId;\n }\n\n private getNonEmptySubscriptionTopics(): Array {\n const result : Array = [];\n\n for (let topic in this.subscriptions) {\n if (this.subscriptions[topic].length) {\n result.push(topic);\n }\n }\n\n return result;\n }\n\n private addAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n this.removeAllSubscriptionListeners();\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.addEventListener(topic, listener);\n }\n }\n }\n\n private removeAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.removeEventListener(topic, listener);\n }\n }\n }\n\n private async connect(): Promise {\n if (this.reconnectAttempts > 0) {\n // immediately resolve the promise to avoid indefinitely\n // blocking the client during reconnection\n return;\n }\n\n return new Promise((resolve, reject) => {\n this.pendingConnects.push({ resolve, reject });\n\n if (this.pendingConnects.length > 1) {\n // all promises will be resolved once the connection is established\n return;\n }\n\n this.initConnect();\n })\n }\n\n private initConnect() {\n this.disconnect(true);\n\n // wait up to 15s for connect\n clearTimeout(this.connectTimeoutId);\n this.connectTimeoutId = setTimeout(() => {\n this.connectErrorHandler(new Error(\"EventSource connect took too long.\"));\n }, this.maxConnectTimeout);\n\n this.eventSource = new EventSource(this.client.buildUrl('/api/realtime'))\n\n this.eventSource.onerror = (_) => {\n this.connectErrorHandler(new Error(\"Failed to establish realtime connection.\"));\n };\n\n this.eventSource.addEventListener('PB_CONNECT', (e) => {\n const msgEvent = (e as MessageEvent);\n this.clientId = msgEvent?.lastEventId;\n\n this.submitSubscriptions()\n .then(async () => {\n let retries = 3;\n while (this.hasUnsentSubscriptions() && retries > 0) {\n retries--;\n // resubscribe to ensure that the latest topics are submitted\n //\n // This is needed because missed topics could happen on reconnect\n // if after the pending sent `submitSubscriptions()` call another `subscribe()`\n // was made before the submit was able to complete.\n await this.submitSubscriptions();\n }\n }).then(() => {\n for (let p of this.pendingConnects) {\n p.resolve();\n }\n\n // reset connect meta\n this.pendingConnects = [];\n this.reconnectAttempts = 0;\n clearTimeout(this.reconnectTimeoutId);\n clearTimeout(this.connectTimeoutId);\n }).catch((err) => {\n this.clientId = \"\";\n this.connectErrorHandler(err);\n });\n });\n }\n\n private hasUnsentSubscriptions(): boolean {\n const latestTopics = this.getNonEmptySubscriptionTopics();\n if (latestTopics.length != this.lastSentTopics.length) {\n return true;\n }\n\n for (const t of latestTopics) {\n if (!this.lastSentTopics.includes(t)) {\n return true;\n }\n }\n\n return false;\n }\n\n private connectErrorHandler(err: any) {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n\n if (\n // wasn't previously connected -> direct reject\n (!this.clientId && !this.reconnectAttempts) ||\n // was previously connected but the max reconnection limit has been reached\n this.reconnectAttempts > this.maxReconnectAttempts\n ) {\n for (let p of this.pendingConnects) {\n p.reject(new ClientResponseError(err));\n }\n this.disconnect();\n return;\n }\n\n // otherwise -> reconnect in the background\n this.disconnect(true);\n const timeout = this.predefinedReconnectIntervals[this.reconnectAttempts] || this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length - 1];\n this.reconnectAttempts++;\n this.reconnectTimeoutId = setTimeout(() => {\n this.initConnect();\n }, timeout);\n }\n\n private disconnect(fromReconnect = false): void {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n this.removeAllSubscriptionListeners();\n this.client.cancelRequest(this.getSubscriptionsCancelKey());\n this.eventSource?.close();\n this.eventSource = null;\n this.clientId = \"\";\n\n if (!fromReconnect) {\n this.reconnectAttempts = 0;\n\n // reject any remaining connect promises\n const err = new ClientResponseError(new Error(\"Realtime disconnected.\"));\n for (let p of this.pendingConnects) {\n p.reject(err);\n }\n this.pendingConnects = [];\n }\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface HealthCheckResponse {\n code: number;\n message: string;\n data: {[key: string]: any};\n}\n\nexport default class HealthService extends BaseService {\n /**\n * Checks the health status of the api.\n */\n check(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/health', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport default class FileService extends BaseService {\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n const parts = [];\n parts.push(\"api\")\n parts.push(\"files\")\n parts.push(encodeURIComponent(record.collectionId || record.collectionName))\n parts.push(encodeURIComponent(record.id))\n parts.push(encodeURIComponent(filename))\n\n let result = this.client.buildUrl(parts.join('/'));\n\n if (Object.keys(queryParams).length) {\n const params = new URLSearchParams(queryParams);\n result += (result.includes(\"?\") ? \"&\" : \"?\") + params;\n }\n\n return result\n }\n\n /**\n * Requests a new private file access token for the current auth model (admin or record).\n */\n getToken(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/files/token', {\n 'method': 'POST',\n 'params': queryParams,\n }).then((data) => data?.token || '');\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface BackupFileInfo {\n key: string;\n size: number;\n modified: string;\n}\n\nexport default class BackupService extends BaseService {\n /**\n * Returns list with all available backup files.\n */\n getFullList(queryParams: BaseQueryParams = {}): Promise> {\n return this.client.send('/api/backups', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n\n /**\n * Initializes a new backup.\n */\n create(basename: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'name': basename,\n };\n\n return this.client.send('/api/backups', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Deletes a single backup file.\n */\n delete(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}`, {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Initializes an app data restore from an existing backup.\n */\n restore(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}/restore`, {\n 'method': 'POST',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Builds a download url for a single existing backup using an\n * admin file token and the backup file key.\n *\n * The file token can be generated via `pb.files.getToken()`.\n */\n getDownloadUrl(token: string, key: string): string {\n return this.client.buildUrl(`/api/backups/${encodeURIComponent(key)}?token=${encodeURIComponent(token)}`);\n }\n}\n","import ClientResponseError from '@/ClientResponseError';\nimport BaseAuthStore from '@/stores/BaseAuthStore';\nimport LocalAuthStore from '@/stores/LocalAuthStore';\nimport SettingsService from '@/services/SettingsService';\nimport AdminService from '@/services/AdminService';\nimport RecordService from '@/services/RecordService';\nimport CollectionService from '@/services/CollectionService';\nimport LogService from '@/services/LogService';\nimport RealtimeService from '@/services/RealtimeService';\nimport HealthService from '@/services/HealthService';\nimport FileService from '@/services/FileService';\nimport BackupService from '@/services/BackupService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport interface SendOptions extends RequestInit {\n headers?: { [key: string]: string };\n body?: any;\n params?: BaseQueryParams;\n}\n\nexport interface BeforeSendResult {\n [key: string]: any, // for backward compatibility\n url?: string,\n options?: {[key: string]: any}\n}\n\n/**\n * PocketBase JS Client.\n */\nexport default class Client {\n /**\n * The base PocketBase backend url address (eg. 'http://127.0.0.1.8090').\n */\n baseUrl: string;\n\n /**\n * Hook that get triggered right before sending the fetch request,\n * allowing you to inspect and modify the url and request options.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * You can return a non-empty result object `{ url, options }` to replace the url and request options entirely.\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, options) {\n * options.headers = Object.assign({}, options.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return { url, options }\n * };\n * ```\n */\n beforeSend?: (url: string, options: SendOptions) => BeforeSendResult|Promise;\n\n /**\n * Hook that get triggered after successfully sending the fetch request,\n * allowing you to inspect/modify the response object and its parsed data.\n *\n * Returns the new Promise resolved `data` that will be returned to the client.\n *\n * Example:\n * ```js\n * client.afterSend = function (response, data) {\n * if (response.status != 200) {\n * throw new ClientResponseError({\n * url: response.url,\n * status: response.status,\n * data: data,\n * });\n * }\n *\n * return data;\n * };\n * ```\n */\n afterSend?: (response: Response, data: any) => any;\n\n /**\n * Optional language code (default to `en-US`) that will be sent\n * with the requests to the server as `Accept-Language` header.\n */\n lang: string;\n\n /**\n * A replaceable instance of the local auth store service.\n */\n authStore: BaseAuthStore;\n\n /**\n * An instance of the service that handles the **Settings APIs**.\n */\n readonly settings: SettingsService;\n\n /**\n * An instance of the service that handles the **Admin APIs**.\n */\n readonly admins: AdminService;\n\n /**\n * An instance of the service that handles the **Collection APIs**.\n */\n readonly collections: CollectionService;\n\n /**\n * An instance of the service that handles the **File APIs**.\n */\n readonly files: FileService;\n\n /**\n * An instance of the service that handles the **Log APIs**.\n */\n readonly logs: LogService;\n\n /**\n * An instance of the service that handles the **Realtime APIs**.\n */\n readonly realtime: RealtimeService;\n\n /**\n * An instance of the service that handles the **Health APIs**.\n */\n readonly health: HealthService;\n\n /**\n * An instance of the service that handles the **Backup APIs**.\n */\n readonly backups: BackupService;\n\n private cancelControllers: { [key: string]: AbortController } = {};\n private recordServices: { [key: string]: RecordService } = {};\n private enableAutoCancellation: boolean = true;\n\n constructor(\n baseUrl = '/',\n authStore?: BaseAuthStore | null,\n lang = 'en-US',\n ) {\n this.baseUrl = baseUrl;\n this.lang = lang;\n this.authStore = authStore || new LocalAuthStore();\n\n // services\n this.admins = new AdminService(this);\n this.collections = new CollectionService(this);\n this.files = new FileService(this);\n this.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(this);\n this.health = new HealthService(this);\n this.backups = new BackupService(this);\n }\n\n /**\n * Returns the RecordService associated to the specified collection.\n *\n * @param {string} idOrName\n * @return {RecordService}\n */\n collection(idOrName: string): RecordService {\n if (!this.recordServices[idOrName]) {\n this.recordServices[idOrName] = new RecordService(this, idOrName);\n }\n\n return this.recordServices[idOrName];\n }\n\n /**\n * Globally enable or disable auto cancellation for pending duplicated requests.\n */\n autoCancellation(enable: boolean): Client {\n this.enableAutoCancellation = !!enable;\n\n return this;\n }\n\n /**\n * Cancels single request by its cancellation key.\n */\n cancelRequest(cancelKey: string): Client {\n if (this.cancelControllers[cancelKey]) {\n this.cancelControllers[cancelKey].abort();\n delete this.cancelControllers[cancelKey];\n }\n\n return this;\n }\n\n /**\n * Cancels all pending requests.\n */\n cancelAllRequests(): Client {\n for (let k in this.cancelControllers) {\n this.cancelControllers[k].abort();\n }\n\n this.cancelControllers = {};\n\n return this;\n }\n\n /**\n * Sends an api http request.\n */\n async send(path: string, reqOptions: SendOptions): Promise {\n let options = Object.assign({ method: 'GET' } as SendOptions, reqOptions);\n\n // JSON serialize the body if needed and set the correct content type\n // (for FormData body the Content-Type header should be skipped since the boundary is autogenerated)\n if (!this.isFormData(options.body)) {\n if (options.body && typeof options.body !== 'string') {\n options.body = JSON.stringify(options.body);\n }\n\n // add the json header (if not already)\n if (typeof options?.headers?.['Content-Type'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof options?.headers?.['Accept-Language'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Accept-Language': this.lang,\n });\n }\n\n // check if Authorization header can be added\n if (\n // has stored token\n this.authStore?.token &&\n // auth header is not explicitly set\n (typeof options?.headers?.Authorization === 'undefined')\n ) {\n options.headers = Object.assign({}, options.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && options.params?.$autoCancel !== false) {\n const cancelKey = options.params?.$cancelKey || ((options.method || 'GET') + path);\n\n // cancel previous pending requests\n this.cancelRequest(cancelKey);\n\n const controller = new AbortController();\n this.cancelControllers[cancelKey] = controller;\n options.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete options.params?.$autoCancel;\n delete options.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof options.params !== 'undefined') {\n const query = this.serializeQueryParams(options.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete options.params;\n }\n\n if (this.beforeSend) {\n const result = Object.assign({}, await this.beforeSend(url, options));\n if (typeof result.url !== \"undefined\" || typeof result.options !== \"undefined\") {\n url = result.url || url;\n options = result.options || options;\n } else if (Object.keys(result).length) {\n // legacy behavior\n options = result as SendOptions;\n console?.warn && console.warn(\"Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`.\");\n }\n }\n\n // send the request\n return fetch(url, options)\n .then(async (response) => {\n let data : any = {};\n\n try {\n data = await response.json();\n } catch (_) {\n // all api responses are expected to return json\n // with the exception of the realtime event and 204\n }\n\n if (this.afterSend) {\n data = await this.afterSend(response, data);\n }\n\n if (response.status >= 400) {\n throw new ClientResponseError({\n url: response.url,\n status: response.status,\n data: data,\n });\n }\n\n return data as T;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Legacy alias of `pb.files.getUrl()`.\n */\n getFileUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n return this.files.getUrl(record, filename, queryParams);\n }\n\n /**\n * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl;\n\n // construct an absolute base url if in a browser environment\n if (\n typeof window !== 'undefined' &&\n !!window.location &&\n !url.startsWith('https://') &&\n !url.startsWith('http://')\n ) {\n url = window.location.origin?.endsWith('/') ?\n window.location.origin.substring(0, window.location.origin.length - 1) :\n (window.location.origin || '');\n\n if (!this.baseUrl.startsWith('/')) {\n url += window.location.pathname || '/';\n url += url.endsWith('/') ? '' : '/';\n }\n\n url += this.baseUrl;\n }\n\n // concatenate the path\n if (path) {\n url += url.endsWith('/') ? '' : '/'; // append trailing slash if missing\n url += path.startsWith('/') ? path.substring(1) : path;\n }\n\n return url;\n }\n\n /**\n * Loosely checks if the specified body is a FormData instance.\n */\n private isFormData(body: any): boolean {\n return body && (\n // we are checking the constructor name because FormData\n // is not available natively in some environments and the\n // polyfill(s) may not be globally accessible\n body.constructor.name === 'FormData' ||\n // fallback to global FormData instance check\n // note: this is needed because the constructor.name could be different in case of\n // custom global FormData implementation, eg. React Native on Android/iOS\n (typeof FormData !== \"undefined\" && body instanceof FormData)\n )\n }\n\n /**\n * Serializes the provided query parameters into a query string.\n */\n private serializeQueryParams(params: {[key: string]: any}): string {\n const result: Array = [];\n for (const key in params) {\n if (params[key] === null) {\n // skip null query params\n continue;\n }\n\n const value = params[key];\n const encodedKey = encodeURIComponent(key);\n\n if (Array.isArray(value)) {\n // \"repeat\" array params\n for (const v of value) {\n result.push(encodedKey + \"=\" + encodeURIComponent(v));\n }\n } else if (value instanceof Date) {\n result.push(encodedKey + \"=\" + encodeURIComponent(value.toISOString()));\n } else if (typeof value !== null && typeof value === 'object') {\n result.push(encodedKey + \"=\" + encodeURIComponent(JSON.stringify(value)));\n } else {\n result.push(encodedKey + \"=\" + encodeURIComponent(value));\n }\n }\n\n return result.join('&');\n }\n}\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__extends","TypeError","String","__","this","constructor","create","__assign","assign","t","s","i","n","arguments","length","apply","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","adopt","then","__generator","body","f","y","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","v","op","pop","push","atobPolyfill","ClientResponseError","_super","errData","_this","url","status","response","isAbort","originalError","data","DOMException","name","message","_a","_d","_c","_b","cause","includes","defineProperty","get","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","isDate","toString","Date","valueOf","toUTCString","httpOnly","secure","priority","toLowerCase","sameSite","defaultDecode","indexOf","decodeURIComponent","encodeURIComponent","getTokenPayload","token","encodedPayload","split","map","c","charCodeAt","slice","join","JSON","parse","atob","input","str","replace","bs","buffer","bc","idx","output","charAt","fromCharCode","BaseModel","$load","load","_i","entries","key","id","created","updated","clone","$clone","structuredClone","stringify","export","$export","Record","collectionId","collectionName","_loadExpand","expand","isArray","Admin","avatar","email","defaultCookieKey","LocalAuthStore","storageKey","storageFallback","_storageGet","model","save","_storageSet","clear","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","isTokenExpired","expirationThreshold","payload","keys","exp","now","triggerChange","loadFromCookie","cookie","rawData","cookieParse","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","exportToCookie","defaultOptions","resultLength","Blob","size","username","verified","onChange","callback","fireImmediately","splice","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","filesystem","testEmail","toEmail","emailTemplate","template","generateAppleClientSecret","clientId","teamId","keyId","privateKey","duration","ListResult","page","perPage","totalItems","totalPages","items","BaseCrudService","_getFullList","basePath","batchSize","request","_getList","list","castedList","concat","item","_getOne","_getFirstListItem","filter","$cancelKey","code","_create","_update","_delete","CrudService","getFullList","batchOrqueryParams","baseCrudPath","batch","getList","getFirstListItem","getOne","delete","AdminService","authStore","success","authResponse","admin","authWithPassword","password","identity","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","batchOrQueryParams","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2Code","codeVerifier","redirectUrl","createData","authWithOAuth2","args","config","authMethods","find","buildUrl","oldState","unsubscribe_1","state","query","authData","err_2","URL","authUrl","searchParams","set","scopes","urlCallback","_defaultUrlCallback","err_1","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","open","width","height","windowWidth","innerWidth","windowHeight","innerHeight","left","top","SchemaField","type","system","required","Collection","indexes","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","$isBase","$isAuth","$isView","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","eventSource","subscriptions","lastSentTopics","maxConnectTimeout","reconnectAttempts","maxReconnectAttempts","Infinity","predefinedReconnectIntervals","pendingConnects","listener","msgEvent","isConnected","connect","submitSubscriptions","addEventListener","unsubscribeByTopicAndListener","hasSubscriptionListeners","removeEventListener","disconnect","topicPrefix","hasAtleastOneTopic","startsWith","exist","topicToCheck","addAllSubscriptionListeners","getNonEmptySubscriptionTopics","getSubscriptionsCancelKey","catch","err","removeAllSubscriptionListeners","initConnect","clearTimeout","connectTimeoutId","setTimeout","connectErrorHandler","EventSource","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","timeout","fromReconnect","cancelRequest","close","HealthService","check","FileService","getUrl","filename","parts","URLSearchParams","getToken","BackupService","basename","restore","getDownloadUrl","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","files","logs","settings","health","backups","collection","idOrName","autoCancellation","enable","cancelKey","abort","cancelAllRequests","k","reqOptions","isFormData","headers","Authorization","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","serializeQueryParams","beforeSend","_k","_j","_l","_m","fetch","json","afterSend","getFileUrl","location","origin","endsWith","substring","pathname","FormData","encodedKey","value_1","toISOString"],"mappings":"uCAgBA,IAAIA,cAAgB,SAASC,EAAGC,GAI5B,OAHAF,cAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,CAAE,GACzE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOC,OAAOK,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,KACzFP,cAAcC,EAAGC,EAC5B,EAEO,SAASS,UAAUV,EAAGC,GACzB,GAAiB,mBAANA,GAA0B,OAANA,EAC3B,MAAM,IAAIU,UAAU,uBAAyBC,OAAOX,GAAK,iCAE7D,SAASY,KAAOC,KAAKC,YAAcf,CAAI,CADvCD,cAAcC,EAAGC,GAEjBD,EAAEO,UAAkB,OAANN,EAAaC,OAAOc,OAAOf,IAAMY,GAAGN,UAAYN,EA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F,EAAC+a,EAAA5V,GACRtG,EAAOsB,KAAK2a,EAAa,IAAMrX,mBAAmBzD,GACrD,MACMxB,aAAiBsE,KACxBjE,EAAOsB,KAAK2a,EAAa,IAAMrX,mBAAmBjF,EAAMwc,gBAChC,cAAVxc,GAAmC,iBAAVA,EACvCK,EAAOsB,KAAK2a,EAAa,IAAMrX,mBAAmBU,KAAKyB,UAAUpH,KAEjEK,EAAOsB,KAAK2a,EAAa,IAAMrX,mBAAmBjF,GAfrD,CAmBL,OAAOK,EAAOqF,KAAK,MAE1B4T,MAAD"} \ No newline at end of file diff --git a/dist/pocketbase.umd.d.ts b/dist/pocketbase.umd.d.ts index ef6d735..ea8e226 100644 --- a/dist/pocketbase.umd.d.ts +++ b/dist/pocketbase.umd.d.ts @@ -475,6 +475,7 @@ declare class RealtimeService extends BaseService { unsubscribeByTopicAndListener(topic: string, listener: EventListener): Promise; private hasSubscriptionListeners; private submitSubscriptions; + private getSubscriptionsCancelKey; private getNonEmptySubscriptionTopics; private addAllSubscriptionListeners; private removeAllSubscriptionListeners; diff --git a/dist/pocketbase.umd.js b/dist/pocketbase.umd.js index acd2439..3d9164c 100644 --- a/dist/pocketbase.umd.js +++ b/dist/pocketbase.umd.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).PocketBase=t()}(this,(function(){"use strict";var extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},extendStatics(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}var __assign=function(){return __assign=Object.assign||function __assign(e){for(var t,n=1,i=arguments.length;n0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var i=function(){function BaseModel(e){void 0===e&&(e={}),this.$load(e||{})}return BaseModel.prototype.load=function(e){return this.$load(e)},BaseModel.prototype.$load=function(e){for(var t=0,n=Object.entries(e);t0&&(!n.exp||n.exp-t>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),BaseAuthStore.prototype.save=function(e,t){this.baseToken=e||"",this.baseModel=null!==t&&"object"==typeof t?void 0!==t.collectionId?new o(t):new r(t):null,this.triggerChange()},BaseAuthStore.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},BaseAuthStore.prototype.loadFromCookie=function(e,t){void 0===t&&(t=s);var n=function cookieParse(e,t){var n={};if("string"!=typeof e)return n;for(var i=Object.assign({},t||{}).decode||defaultDecode,o=0;o4096&&(u.model={id:null===(i=null==u?void 0:u.model)||void 0===i?void 0:i.id,email:null===(r=null==u?void 0:u.model)||void 0===r?void 0:r.email},this.model instanceof o&&(u.model.username=this.model.username,u.model.verified=this.model.verified,u.model.collectionId=this.model.collectionId),l=cookieSerialize(t,JSON.stringify(u),e)),l},BaseAuthStore.prototype.onChange=function(e,t){var n=this;return void 0===t&&(t=!1),this._onChangeCallbacks.push(e),t&&e(this.token,this.model),function(){for(var t=n._onChangeCallbacks.length-1;t>=0;t--)if(n._onChangeCallbacks[t]==e)return delete n._onChangeCallbacks[t],void n._onChangeCallbacks.splice(t,1)}},BaseAuthStore.prototype.triggerChange=function(){for(var e=0,t=this._onChangeCallbacks;e0?e:1,this.perPage=t>=0?t:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},d=function(e){function BaseCrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(BaseCrudService,e),BaseCrudService.prototype._getFullList=function(e,t,n){var i=this;void 0===t&&(t=200),void 0===n&&(n={});var o=[],request=function(r){return __awaiter(i,void 0,void 0,(function(){return __generator(this,(function(i){return[2,this._getList(e,r,t||200,n).then((function(e){var t=e,n=t.items,i=t.totalItems;return o=o.concat(n),n.length&&i>o.length?request(r+1):o}))]}))}))};return request(1)},BaseCrudService.prototype._getList=function(e,t,n,i){var o=this;return void 0===t&&(t=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:t,perPage:n},i),this.client.send(e,{method:"GET",params:i}).then((function(e){var t=[];if(null==e?void 0:e.items){e.items=e.items||[];for(var n=0,i=e.items;n1||"string"==typeof(null==e?void 0:e[0])?(console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),[2,this.authWithOAuth2Code((null==e?void 0:e[0])||"",(null==e?void 0:e[1])||"",(null==e?void 0:e[2])||"",(null==e?void 0:e[3])||"",(null==e?void 0:e[4])||{},(null==e?void 0:e[5])||{},(null==e?void 0:e[6])||{})]):(n=(null==e?void 0:e[0])||{},[4,this.listAuthMethods()]);case 1:if(i=a.sent(),!(o=i.authProviders.find((function(e){return e.name===n.provider}))))throw new t(new Error('Missing or invalid provider "'.concat(n.provider,'".')));return r=this.client.buildUrl("/api/oauth2-redirect"),[2,new Promise((function(e,i){return __awaiter(s,void 0,void 0,(function(){var s,a,c,u,l=this;return __generator(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),[4,this.client.realtime.subscribe("@oauth2",(function(a){return __awaiter(l,void 0,void 0,(function(){var c,u,l;return __generator(this,(function(d){switch(d.label){case 0:c=this.client.realtime.clientId,d.label=1;case 1:if(d.trys.push([1,3,,4]),s(),!a.state||c!==a.state)throw new Error("State parameters don't match.");return[4,this.authWithOAuth2Code(o.name,a.code,o.codeVerifier,r,n.createData,n.body,n.query)];case 2:return u=d.sent(),e(u),[3,4];case 3:return l=d.sent(),i(new t(l)),[3,4];case 4:return[2]}}))}))}))];case 1:return s=d.sent(),(a=new URL(o.authUrl+r)).searchParams.set("state",this.client.realtime.clientId),(null===(u=n.scopes)||void 0===u?void 0:u.length)&&a.searchParams.set("scope",n.scopes.join(" ")),[4,n.urlCallback?n.urlCallback(a.toString()):this._defaultUrlCallback(a.toString())];case 2:return d.sent(),[3,4];case 3:return c=d.sent(),i(new t(c)),[3,4];case 4:return[2]}}))}))}))]}}))}))},RecordService.prototype.authRefresh=function(e,t){var n=this;return void 0===e&&(e={}),void 0===t&&(t={}),this.client.send(this.baseCollectionPath+"/auth-refresh",{method:"POST",params:t,body:e}).then((function(e){return n.authResponse(e)}))},RecordService.prototype.requestPasswordReset=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-password-reset",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmPasswordReset=function(e,t,n,i,o){return void 0===i&&(i={}),void 0===o&&(o={}),i=Object.assign({token:e,password:t,passwordConfirm:n},i),this.client.send(this.baseCollectionPath+"/confirm-password-reset",{method:"POST",params:o,body:i}).then((function(){return!0}))},RecordService.prototype.requestVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({token:e},t),this.client.send(this.baseCollectionPath+"/confirm-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.requestEmailChange=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({newEmail:e},t),this.client.send(this.baseCollectionPath+"/request-email-change",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmEmailChange=function(e,t,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),n=Object.assign({token:e,password:t},n),this.client.send(this.baseCollectionPath+"/confirm-email-change",{method:"POST",params:i,body:n}).then((function(){return!0}))},RecordService.prototype.listExternalAuths=function(e,t){return void 0===t&&(t={}),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths",{method:"GET",params:t}).then((function(e){var t=[];if(Array.isArray(e))for(var n=0,i=e;no?o:n)/2,a=r/2-(i=i>r?r:i)/2;window.open(e,"oauth2-popup","width="+n+",height="+i+",top="+a+",left="+s+",resizable,menubar=no")},RecordService}(h),m=function m(e){void 0===e&&(e={}),this.id=void 0!==e.id?e.id:"",this.name=void 0!==e.name?e.name:"",this.type=void 0!==e.type?e.type:"text",this.system=!!e.system,this.required=!!e.required,this.options="object"==typeof e.options&&null!==e.options?e.options:{}},b=function(e){function Collection(){return null!==e&&e.apply(this,arguments)||this}return __extends(Collection,e),Collection.prototype.$load=function(t){e.prototype.$load.call(this,t),this.system=!!t.system,this.name="string"==typeof t.name?t.name:"",this.type="string"==typeof t.type?t.type:"base",this.options=void 0!==t.options&&null!==t.options?t.options:{},this.indexes=Array.isArray(t.indexes)?t.indexes:[],this.listRule="string"==typeof t.listRule?t.listRule:null,this.viewRule="string"==typeof t.viewRule?t.viewRule:null,this.createRule="string"==typeof t.createRule?t.createRule:null,this.updateRule="string"==typeof t.updateRule?t.updateRule:null,this.deleteRule="string"==typeof t.deleteRule?t.deleteRule:null,t.schema=Array.isArray(t.schema)?t.schema:[],this.schema=[];for(var n=0,i=t.schema;n=0;o--)this.subscriptions[e][o]===t&&(i=!0,delete this.subscriptions[e][o],this.subscriptions[e].splice(o,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(e,t));return i?(this.subscriptions[e].length||delete this.subscriptions[e],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(e)?[3,3]:[4,this.submitSubscriptions()];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},RealtimeService.prototype.hasSubscriptionListeners=function(e){var t,n;if(this.subscriptions=this.subscriptions||{},e)return!!(null===(t=this.subscriptions[e])||void 0===t?void 0:t.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},RealtimeService.prototype.submitSubscriptions=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return this.clientId?(this.addAllSubscriptionListeners(),this.lastSentTopics=this.getNonEmptySubscriptionTopics(),[2,this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentTopics},params:{$cancelKey:"realtime_"+this.clientId}}).catch((function(e){if(!(null==e?void 0:e.isAbort))throw e}))]):[2]}))}))},RealtimeService.prototype.getNonEmptySubscriptionTopics=function(){var e=[];for(var t in this.subscriptions)this.subscriptions[t].length&&e.push(t);return e},RealtimeService.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var e in this.removeAllSubscriptionListeners(),this.subscriptions)for(var t=0,n=this.subscriptions[e];t0?[2]:[2,new Promise((function(t,n){e.pendingConnects.push({resolve:t,reject:n}),e.pendingConnects.length>1||e.initConnect()}))]}))}))},RealtimeService.prototype.initConnect=function(){var e=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){e.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(t){e.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(t){var n=t;e.clientId=null==n?void 0:n.lastEventId,e.submitSubscriptions().then((function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=3,t.label=1;case 1:return this.hasUnsentSubscriptions()&&e>0?(e--,[4,this.submitSubscriptions()]):[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var t=0,n=e.pendingConnects;tthis.maxReconnectAttempts){for(var i=0,o=this.pendingConnects;i=400)throw new t({url:e.url,status:e.status,data:n});return[2,n]}}))}))})).catch((function(e){throw new t(e)}))]}}))}))},Client.prototype.getFileUrl=function(e,t,n){return void 0===n&&(n={}),this.files.getUrl(e,t,n)},Client.prototype.buildUrl=function(e){var t,n=this.baseUrl;return"undefined"==typeof window||!window.location||n.startsWith("https://")||n.startsWith("http://")||(n=(null===(t=window.location.origin)||void 0===t?void 0:t.endsWith("/"))?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(n+=window.location.pathname||"/",n+=n.endsWith("/")?"":"/"),n+=this.baseUrl),e&&(n+=n.endsWith("/")?"":"/",n+=e.startsWith("/")?e.substring(1):e),n},Client.prototype.isFormData=function(e){return e&&("FormData"===e.constructor.name||"undefined"!=typeof FormData&&e instanceof FormData)},Client.prototype.serializeQueryParams=function(e){var t=[];for(var n in e)if(null!==e[n]){var i=e[n],o=encodeURIComponent(n);if(Array.isArray(i))for(var r=0,s=i;r0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var i=function(){function BaseModel(e){void 0===e&&(e={}),this.$load(e||{})}return BaseModel.prototype.load=function(e){return this.$load(e)},BaseModel.prototype.$load=function(e){for(var t=0,n=Object.entries(e);t0&&(!n.exp||n.exp-t>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),BaseAuthStore.prototype.save=function(e,t){this.baseToken=e||"",this.baseModel=null!==t&&"object"==typeof t?void 0!==t.collectionId?new o(t):new r(t):null,this.triggerChange()},BaseAuthStore.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},BaseAuthStore.prototype.loadFromCookie=function(e,t){void 0===t&&(t=s);var n=function cookieParse(e,t){var n={};if("string"!=typeof e)return n;for(var i=Object.assign({},t||{}).decode||defaultDecode,o=0;o4096&&(u.model={id:null===(i=null==u?void 0:u.model)||void 0===i?void 0:i.id,email:null===(r=null==u?void 0:u.model)||void 0===r?void 0:r.email},this.model instanceof o&&(u.model.username=this.model.username,u.model.verified=this.model.verified,u.model.collectionId=this.model.collectionId),l=cookieSerialize(t,JSON.stringify(u),e)),l},BaseAuthStore.prototype.onChange=function(e,t){var n=this;return void 0===t&&(t=!1),this._onChangeCallbacks.push(e),t&&e(this.token,this.model),function(){for(var t=n._onChangeCallbacks.length-1;t>=0;t--)if(n._onChangeCallbacks[t]==e)return delete n._onChangeCallbacks[t],void n._onChangeCallbacks.splice(t,1)}},BaseAuthStore.prototype.triggerChange=function(){for(var e=0,t=this._onChangeCallbacks;e0?e:1,this.perPage=t>=0?t:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},d=function(e){function BaseCrudService(){return null!==e&&e.apply(this,arguments)||this}return __extends(BaseCrudService,e),BaseCrudService.prototype._getFullList=function(e,t,n){var i=this;void 0===t&&(t=200),void 0===n&&(n={});var o=[],request=function(r){return __awaiter(i,void 0,void 0,(function(){return __generator(this,(function(i){return[2,this._getList(e,r,t||200,n).then((function(e){var t=e,n=t.items,i=t.totalItems;return o=o.concat(n),n.length&&i>o.length?request(r+1):o}))]}))}))};return request(1)},BaseCrudService.prototype._getList=function(e,t,n,i){var o=this;return void 0===t&&(t=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:t,perPage:n},i),this.client.send(e,{method:"GET",params:i}).then((function(e){var t=[];if(null==e?void 0:e.items){e.items=e.items||[];for(var n=0,i=e.items;n1||"string"==typeof(null==e?void 0:e[0])?(console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),[2,this.authWithOAuth2Code((null==e?void 0:e[0])||"",(null==e?void 0:e[1])||"",(null==e?void 0:e[2])||"",(null==e?void 0:e[3])||"",(null==e?void 0:e[4])||{},(null==e?void 0:e[5])||{},(null==e?void 0:e[6])||{})]):(n=(null==e?void 0:e[0])||{},[4,this.listAuthMethods()]);case 1:if(i=a.sent(),!(o=i.authProviders.find((function(e){return e.name===n.provider}))))throw new t(new Error('Missing or invalid provider "'.concat(n.provider,'".')));return r=this.client.buildUrl("/api/oauth2-redirect"),[2,new Promise((function(e,i){return __awaiter(s,void 0,void 0,(function(){var s,a,c,u,l=this;return __generator(this,(function(d){switch(d.label){case 0:return d.trys.push([0,3,,4]),[4,this.client.realtime.subscribe("@oauth2",(function(a){return __awaiter(l,void 0,void 0,(function(){var c,u,l;return __generator(this,(function(d){switch(d.label){case 0:c=this.client.realtime.clientId,d.label=1;case 1:if(d.trys.push([1,3,,4]),s(),!a.state||c!==a.state)throw new Error("State parameters don't match.");return[4,this.authWithOAuth2Code(o.name,a.code,o.codeVerifier,r,n.createData,n.body,n.query)];case 2:return u=d.sent(),e(u),[3,4];case 3:return l=d.sent(),i(new t(l)),[3,4];case 4:return[2]}}))}))}))];case 1:return s=d.sent(),(a=new URL(o.authUrl+r)).searchParams.set("state",this.client.realtime.clientId),(null===(u=n.scopes)||void 0===u?void 0:u.length)&&a.searchParams.set("scope",n.scopes.join(" ")),[4,n.urlCallback?n.urlCallback(a.toString()):this._defaultUrlCallback(a.toString())];case 2:return d.sent(),[3,4];case 3:return c=d.sent(),i(new t(c)),[3,4];case 4:return[2]}}))}))}))]}}))}))},RecordService.prototype.authRefresh=function(e,t){var n=this;return void 0===e&&(e={}),void 0===t&&(t={}),this.client.send(this.baseCollectionPath+"/auth-refresh",{method:"POST",params:t,body:e}).then((function(e){return n.authResponse(e)}))},RecordService.prototype.requestPasswordReset=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-password-reset",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmPasswordReset=function(e,t,n,i,o){return void 0===i&&(i={}),void 0===o&&(o={}),i=Object.assign({token:e,password:t,passwordConfirm:n},i),this.client.send(this.baseCollectionPath+"/confirm-password-reset",{method:"POST",params:o,body:i}).then((function(){return!0}))},RecordService.prototype.requestVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({email:e},t),this.client.send(this.baseCollectionPath+"/request-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmVerification=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({token:e},t),this.client.send(this.baseCollectionPath+"/confirm-verification",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.requestEmailChange=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),t=Object.assign({newEmail:e},t),this.client.send(this.baseCollectionPath+"/request-email-change",{method:"POST",params:n,body:t}).then((function(){return!0}))},RecordService.prototype.confirmEmailChange=function(e,t,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),n=Object.assign({token:e,password:t},n),this.client.send(this.baseCollectionPath+"/confirm-email-change",{method:"POST",params:i,body:n}).then((function(){return!0}))},RecordService.prototype.listExternalAuths=function(e,t){return void 0===t&&(t={}),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths",{method:"GET",params:t}).then((function(e){var t=[];if(Array.isArray(e))for(var n=0,i=e;no?o:n)/2,a=r/2-(i=i>r?r:i)/2;window.open(e,"oauth2-popup","width="+n+",height="+i+",top="+a+",left="+s+",resizable,menubar=no")},RecordService}(h),m=function m(e){void 0===e&&(e={}),this.id=void 0!==e.id?e.id:"",this.name=void 0!==e.name?e.name:"",this.type=void 0!==e.type?e.type:"text",this.system=!!e.system,this.required=!!e.required,this.options="object"==typeof e.options&&null!==e.options?e.options:{}},b=function(e){function Collection(){return null!==e&&e.apply(this,arguments)||this}return __extends(Collection,e),Collection.prototype.$load=function(t){e.prototype.$load.call(this,t),this.system=!!t.system,this.name="string"==typeof t.name?t.name:"",this.type="string"==typeof t.type?t.type:"base",this.options=void 0!==t.options&&null!==t.options?t.options:{},this.indexes=Array.isArray(t.indexes)?t.indexes:[],this.listRule="string"==typeof t.listRule?t.listRule:null,this.viewRule="string"==typeof t.viewRule?t.viewRule:null,this.createRule="string"==typeof t.createRule?t.createRule:null,this.updateRule="string"==typeof t.updateRule?t.updateRule:null,this.deleteRule="string"==typeof t.deleteRule?t.deleteRule:null,t.schema=Array.isArray(t.schema)?t.schema:[],this.schema=[];for(var n=0,i=t.schema;n=0;o--)this.subscriptions[e][o]===t&&(i=!0,delete this.subscriptions[e][o],this.subscriptions[e].splice(o,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(e,t));return i?(this.subscriptions[e].length||delete this.subscriptions[e],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(e)?[3,3]:[4,this.submitSubscriptions()];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},RealtimeService.prototype.hasSubscriptionListeners=function(e){var t,n;if(this.subscriptions=this.subscriptions||{},e)return!!(null===(t=this.subscriptions[e])||void 0===t?void 0:t.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},RealtimeService.prototype.submitSubscriptions=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return this.clientId?(this.addAllSubscriptionListeners(),this.lastSentTopics=this.getNonEmptySubscriptionTopics(),[2,this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentTopics},params:{$cancelKey:this.getSubscriptionsCancelKey()}}).catch((function(e){if(!(null==e?void 0:e.isAbort))throw e}))]):[2]}))}))},RealtimeService.prototype.getSubscriptionsCancelKey=function(){return"realtime_"+this.clientId},RealtimeService.prototype.getNonEmptySubscriptionTopics=function(){var e=[];for(var t in this.subscriptions)this.subscriptions[t].length&&e.push(t);return e},RealtimeService.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var e in this.removeAllSubscriptionListeners(),this.subscriptions)for(var t=0,n=this.subscriptions[e];t0?[2]:[2,new Promise((function(t,n){e.pendingConnects.push({resolve:t,reject:n}),e.pendingConnects.length>1||e.initConnect()}))]}))}))},RealtimeService.prototype.initConnect=function(){var e=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){e.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(t){e.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(t){var n=t;e.clientId=null==n?void 0:n.lastEventId,e.submitSubscriptions().then((function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=3,t.label=1;case 1:return this.hasUnsentSubscriptions()&&e>0?(e--,[4,this.submitSubscriptions()]):[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var t=0,n=e.pendingConnects;tthis.maxReconnectAttempts){for(var i=0,o=this.pendingConnects;i=400)throw new t({url:e.url,status:e.status,data:n});return[2,n]}}))}))})).catch((function(e){throw new t(e)}))]}}))}))},Client.prototype.getFileUrl=function(e,t,n){return void 0===n&&(n={}),this.files.getUrl(e,t,n)},Client.prototype.buildUrl=function(e){var t,n=this.baseUrl;return"undefined"==typeof window||!window.location||n.startsWith("https://")||n.startsWith("http://")||(n=(null===(t=window.location.origin)||void 0===t?void 0:t.endsWith("/"))?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(n+=window.location.pathname||"/",n+=n.endsWith("/")?"":"/"),n+=this.baseUrl),e&&(n+=n.endsWith("/")?"":"/",n+=e.startsWith("/")?e.substring(1):e),n},Client.prototype.isFormData=function(e){return e&&("FormData"===e.constructor.name||"undefined"!=typeof FormData&&e instanceof FormData)},Client.prototype.serializeQueryParams=function(e){var t=[];for(var n in e)if(null!==e[n]){var i=e[n],o=encodeURIComponent(n);if(Array.isArray(i))for(var r=0,s=i;r= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","/**\n * ClientResponseError is a custom Error class that is intended to wrap\n * and normalize any error thrown by `Client.send()`.\n */\nexport default class ClientResponseError extends Error {\n url: string = '';\n status: number = 0;\n response: {[key: string]: any} = {};\n isAbort: boolean = false;\n originalError: any = null;\n\n constructor(errData?: any) {\n super(\"ClientResponseError\");\n\n // Set the prototype explicitly.\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, ClientResponseError.prototype);\n\n if (!(errData instanceof ClientResponseError)) {\n this.originalError = errData;\n }\n\n if (errData !== null && typeof errData === 'object') {\n this.url = typeof errData.url === 'string' ? errData.url : '';\n this.status = typeof errData.status === 'number' ? errData.status : 0;\n this.response = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\n this.isAbort = !!errData.isAbort;\n }\n\n if (typeof DOMException !== 'undefined' && errData instanceof DOMException) {\n this.isAbort = true;\n }\n\n this.name = \"ClientResponseError \" + this.status;\n this.message = this.response?.message;\n if (!this.message) {\n if (this.isAbort) {\n this.message = 'The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.';\n } else if (this.originalError?.cause?.message?.includes(\"ECONNREFUSED ::1\")) {\n this.message = 'Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).';\n } else {\n this.message = 'Something went wrong while processing your request.';\n }\n }\n }\n\n /**\n * Alias for `this.response` to preserve the backward compatibility.\n */\n get data() {\n return this.response;\n }\n\n /**\n * Make a POJO's copy of the current error class instance.\n * @see https://github.com/vuex-orm/vuex-orm/issues/255\n */\n toJSON() {\n return { ...this };\n }\n}\n","let atobPolyfill: Function;\nif (typeof atob === 'function') {\n atobPolyfill = atob\n} else {\n /**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n atobPolyfill = (input: any) => {\n const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n let str = String(input).replace(/=+$/, \"\");\n if (str.length % 4 == 1) {\n throw new Error(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = \"\";\n // get next character\n (buffer = str.charAt(idx++));\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? (bs as any) * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ?\n (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) :\n 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n\n return output;\n };\n}\n\n/**\n * Returns JWT token's payload data.\n */\nexport function getTokenPayload(token: string): { [key: string]: any } {\n if (token) {\n try {\n const encodedPayload = decodeURIComponent(atobPolyfill(token.split('.')[1]).split('').map(function (c: string) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n\n return JSON.parse(encodedPayload) || {};\n } catch (e) {\n }\n }\n\n return {};\n}\n\n/**\n * Checks whether a JWT token is expired or not.\n * Tokens without `exp` payload key are considered valid.\n * Tokens with empty payload (eg. invalid token strings) are considered expired.\n *\n * @param token The token to check.\n * @param [expirationThreshold] Time in seconds that will be subtracted from the token `exp` property.\n */\nexport function isTokenExpired(token: string, expirationThreshold = 0): boolean {\n let payload = getTokenPayload(token);\n\n if (\n Object.keys(payload).length > 0 &&\n (!payload.exp || (payload.exp - expirationThreshold) > (Date.now() / 1000))\n ) {\n return false;\n }\n\n return true;\n}\n","/**\n * -------------------------------------------------------------------\n * Simple cookie parse and serialize utilities mostly based on the\n * node module https://github.com/jshttp/cookie.\n * -------------------------------------------------------------------\n */\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\nexport interface ParseOptions{\n decode?: (val: string) => string,\n}\n\n/**\n* Parses the given cookie header string into an object\n* The object has the various cookies as keys(names) => values\n*/\nexport function cookieParse(str: string, options?: ParseOptions): { [key: string]: any } {\n const result: { [key: string]: any } = {};\n\n if (typeof str !== 'string') {\n return result;\n }\n\n const opt = Object.assign({}, options || {});\n const decode = opt.decode || defaultDecode;\n\n let index = 0;\n while (index < str.length) {\n const eqIdx = str.indexOf('=', index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = str.indexOf(';', index);\n\n if (endIdx === -1) {\n endIdx = str.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1;\n continue;\n }\n\n const key = str.slice(index, eqIdx).trim();\n\n // only assign once\n if (undefined === result[key]) {\n let val = str.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n result[key] = decode(val);\n } catch (_) {\n result[key] = val; // no decoding\n }\n }\n\n index = endIdx + 1;\n }\n\n return result;\n};\n\nexport interface SerializeOptions{\n encode?: (val: string | number | boolean) => string,\n maxAge?: number,\n domain?: string,\n path?: string,\n expires?: Date,\n httpOnly?: boolean,\n secure?: boolean,\n priority?: string,\n sameSite?: boolean|string,\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * ```js\n * cookieSerialize('foo', 'bar', { httpOnly: true }) // \"foo=bar; httpOnly\"\n * ```\n */\nexport function cookieSerialize(name: string, val: string, options?: SerializeOptions): string {\n const opt = Object.assign({}, options || {});\n const encode = opt.encode || defaultEncode;\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n const value = encode(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n let result = name + '=' + value;\n\n if (opt.maxAge != null) {\n const maxAge = opt.maxAge - 0;\n\n if (isNaN(maxAge) || !isFinite(maxAge)) {\n throw new TypeError('option maxAge is invalid');\n }\n\n result += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n result += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n result += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (!isDate(opt.expires) || isNaN(opt.expires.valueOf())) {\n throw new TypeError('option expires is invalid');\n }\n\n result += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n result += '; HttpOnly';\n }\n\n if (opt.secure) {\n result += '; Secure';\n }\n\n if (opt.priority) {\n const priority = typeof opt.priority === 'string' ? opt.priority.toLowerCase() : opt.priority;\n\n switch (priority) {\n case 'low':\n result += '; Priority=Low';\n break;\n case 'medium':\n result += '; Priority=Medium';\n break;\n case 'high':\n result += '; Priority=High';\n break;\n default:\n throw new TypeError('option priority is invalid');\n }\n }\n\n if (opt.sameSite) {\n const sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n result += '; SameSite=Strict';\n break;\n case 'lax':\n result += '; SameSite=Lax';\n break;\n case 'strict':\n result += '; SameSite=Strict';\n break;\n case 'none':\n result += '; SameSite=None';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return result;\n};\n\n/**\n * Default URL-decode string value function.\n * Optimized to skip native call when no `%`.\n */\nfunction defaultDecode(val: string): string {\n return val.indexOf('%') !== -1\n ? decodeURIComponent(val)\n : val;\n}\n\n/**\n * Default URL-encode value function.\n */\nfunction defaultEncode(val: string | number | boolean): string {\n return encodeURIComponent(val);\n}\n\n/**\n * Determines if value is a Date.\n */\nfunction isDate(val: any): boolean {\n return (\n Object.prototype.toString.call(val) === '[object Date]' ||\n val instanceof Date\n );\n}\n","export default abstract class BaseModel {\n [key: string]: any,\n\n id!: string;\n created!: string;\n updated!: string;\n\n constructor(data: { [key: string]: any } = {}) {\n this.$load(data || {});\n }\n\n /**\n * Alias of this.$load(data).\n */\n load(data: { [key: string]: any }) {\n return this.$load(data);\n }\n\n /**\n * Loads `data` into the current model.\n */\n $load(data: { [key: string]: any }) {\n for (const [key, value] of Object.entries(data)) {\n this[key] = value;\n }\n\n // normalize known fields\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.created = typeof data.created !== 'undefined' ? data.created : '';\n this.updated = typeof data.updated !== 'undefined' ? data.updated : '';\n }\n\n /**\n * Returns whether the current loaded data represent a stored db record.\n */\n get $isNew(): boolean {\n return !this.id;\n }\n\n /**\n * Alias of this.clone().\n */\n clone(): BaseModel {\n return this.$clone();\n }\n\n /**\n * Creates a deep clone of the current model.\n */\n $clone(): BaseModel {\n const clone = typeof structuredClone === 'function' ?\n structuredClone(this) : JSON.parse(JSON.stringify(this));\n\n return new (this.constructor as any)(clone);\n }\n\n /**\n * Alias of this.$export().\n */\n export(): { [key: string]: any } {\n return this.$export();\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n $export(): { [key: string]: any } {\n return typeof structuredClone === 'function' ?\n structuredClone(this) : Object.assign({}, this);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Record extends BaseModel {\n collectionId!: string;\n collectionName!: string;\n expand!: {[key: string]: Record|Array};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // normalize common fields\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.collectionName = typeof data.collectionName === 'string' ? data.collectionName : '';\n\n // normalize expand items\n this._loadExpand(data.expand);\n }\n\n /**\n * Loads the provided expand items and recursively normalizes each\n * item to a `Record|Array`.\n */\n private _loadExpand(expand: { [key: string]: any }) {\n expand = expand || {};\n this.expand = {};\n\n for (const key in expand) {\n if (Array.isArray(expand[key])) {\n this.expand[key] = expand[key].map((data: any) => new Record(data || {}));\n } else {\n this.expand[key] = new Record(expand[key] || {});\n }\n }\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Admin extends BaseModel {\n avatar!: number;\n email!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.avatar = typeof data.avatar === 'number' ? data.avatar : 0;\n this.email = typeof data.email === 'string' ? data.email : '';\n }\n}\n","import { cookieParse, cookieSerialize, SerializeOptions } from '@/stores/utils/cookie';\nimport { isTokenExpired, getTokenPayload } from '@/stores/utils/jwt';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\nexport type OnStoreChangeFunc = (token: string, model: Record|Admin|null) => void;\n\nconst defaultCookieKey = 'pb_auth';\n\n/**\n * Base AuthStore class that is intended to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore {\n protected baseToken: string = '';\n protected baseModel: Record|Admin|null = null;\n\n private _onChangeCallbacks: Array = [];\n\n /**\n * Retrieves the stored token (if any).\n */\n get token(): string {\n return this.baseToken;\n }\n\n /**\n * Retrieves the stored model data (if any).\n */\n get model(): Record|Admin|null {\n return this.baseModel;\n }\n\n /**\n * Loosely checks if the store has valid token (aka. existing and unexpired exp claim).\n */\n get isValid(): boolean {\n return !isTokenExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: Record|Admin|null): void {\n this.baseToken = token || '';\n\n // normalize the model instance\n if (model !== null && typeof model === 'object') {\n this.baseModel = typeof (model as any).collectionId !== 'undefined' ?\n new Record(model) : new Admin(model);\n } else {\n this.baseModel = null;\n }\n\n this.triggerChange();\n }\n\n /**\n * Removes the stored token and model data form the auth store.\n */\n clear(): void {\n this.baseToken = '';\n this.baseModel = null;\n this.triggerChange();\n }\n\n /**\n * Parses the provided cookie string and updates the store state\n * with the cookie's token and model data.\n *\n * NB! This function doesn't validate the token or its data.\n * Usually this isn't a concern if you are interacting only with the\n * PocketBase API because it has the proper server-side security checks in place,\n * but if you are using the store `isValid` state for permission controls\n * in a node server (eg. SSR), then it is recommended to call `authRefresh()`\n * after loading the cookie to ensure an up-to-date token and model state.\n * For example:\n *\n * ```js\n * pb.authStore.loadFromCookie(\"cookie string...\");\n *\n * try {\n * // get an up-to-date auth store state by veryfing and refreshing the loaded auth model (if any)\n * pb.authStore.isValid && await pb.collection('users').authRefresh();\n * } catch (_) {\n * // clear the auth store on failed refresh\n * pb.authStore.clear();\n * }\n * ```\n */\n loadFromCookie(cookie: string, key = defaultCookieKey): void {\n const rawData = cookieParse(cookie || '')[key] || '';\n\n let data: { [key: string]: any } = {};\n try {\n data = JSON.parse(rawData);\n // normalize\n if (typeof data === null || typeof data !== 'object' || Array.isArray(data)) {\n data = {};\n }\n } catch (_) {}\n\n this.save(data.token || '', data.model || null);\n }\n\n /**\n * Exports the current store state as cookie string.\n *\n * By default the following optional attributes are added:\n * - Secure\n * - HttpOnly\n * - SameSite=Strict\n * - Path=/\n * - Expires={the token expiration date}\n *\n * NB! If the generated cookie exceeds 4096 bytes, this method will\n * strip the model data to the bare minimum to try to fit within the\n * recommended size in https://www.rfc-editor.org/rfc/rfc6265#section-6.1.\n */\n exportToCookie(options?: SerializeOptions, key = defaultCookieKey): string {\n const defaultOptions: SerializeOptions = {\n secure: true,\n sameSite: true,\n httpOnly: true,\n path: \"/\",\n };\n\n // extract the token expiration date\n const payload = getTokenPayload(this.token);\n if (payload?.exp) {\n defaultOptions.expires = new Date(payload.exp * 1000);\n } else {\n defaultOptions.expires = new Date('1970-01-01');\n }\n\n // merge with the user defined options\n options = Object.assign({}, defaultOptions, options);\n\n const rawData = {\n token: this.token,\n model: this.model?.export() || null,\n };\n\n let result = cookieSerialize(key, JSON.stringify(rawData), options);\n\n const resultLength = typeof Blob !== 'undefined' ?\n (new Blob([result])).size : result.length;\n\n // strip down the model data to the bare minimum\n if (rawData.model && resultLength > 4096) {\n rawData.model = {id: rawData?.model?.id, email: rawData?.model?.email};\n if (this.model instanceof Record) {\n rawData.model.username = this.model.username;\n rawData.model.verified = this.model.verified;\n rawData.model.collectionId = this.model.collectionId;\n }\n result = cookieSerialize(key, JSON.stringify(rawData), options);\n }\n\n return result;\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * You can set the `fireImmediately` argument to true in order to invoke\n * the provided callback right after registration.\n *\n * Returns a removal function that you could call to \"unsubscribe\" from the changes.\n */\n onChange(callback: OnStoreChangeFunc, fireImmediately = false): () => void {\n this._onChangeCallbacks.push(callback);\n\n if (fireImmediately) {\n callback(this.token, this.model);\n }\n\n return () => {\n for (let i = this._onChangeCallbacks.length - 1; i >= 0; i--) {\n if (this._onChangeCallbacks[i] == callback) {\n delete this._onChangeCallbacks[i]; // removes the function reference\n this._onChangeCallbacks.splice(i, 1); // reindex the array\n return;\n }\n }\n }\n }\n\n protected triggerChange(): void {\n for (const callback of this._onChangeCallbacks) {\n callback && callback(this.token, this.model);\n }\n }\n}\n","import BaseAuthStore from '@/stores/BaseAuthStore';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\n/**\n * The default token store for browsers with auto fallback\n * to runtime/memory if local storage is undefined (eg. in node env).\n */\nexport default class LocalAuthStore extends BaseAuthStore {\n private storageFallback: { [key: string]: any } = {};\n private storageKey: string\n\n constructor(storageKey = \"pocketbase_auth\") {\n super();\n\n this.storageKey = storageKey;\n }\n\n /**\n * @inheritdoc\n */\n get token(): string {\n const data = this._storageGet(this.storageKey) || {};\n\n return data.token || '';\n }\n\n /**\n * @inheritdoc\n */\n get model(): Record|Admin|null {\n const data = this._storageGet(this.storageKey) || {};\n\n if (\n data === null ||\n typeof data !== 'object' ||\n data.model === null ||\n typeof data.model !== 'object'\n ) {\n return null;\n }\n\n // admins don't have `collectionId` prop\n if (typeof data.model?.collectionId === 'undefined') {\n return new Admin(data.model);\n }\n\n return new Record(data.model);\n }\n\n /**\n * @inheritdoc\n */\n save(token: string, model: Record|Admin|null) {\n this._storageSet(this.storageKey, {\n 'token': token,\n 'model': model,\n });\n\n super.save(token, model);\n }\n\n /**\n * @inheritdoc\n */\n clear() {\n this._storageRemove(this.storageKey);\n\n super.clear();\n }\n\n // ---------------------------------------------------------------\n // Internal helpers:\n // ---------------------------------------------------------------\n\n /**\n * Retrieves `key` from the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageGet(key: string): any {\n if (typeof window !== 'undefined' && window?.localStorage) {\n const rawValue = window.localStorage.getItem(key) || '';\n try {\n return JSON.parse(rawValue);\n } catch (e) { // not a json\n return rawValue;\n }\n }\n\n // fallback\n return this.storageFallback[key];\n }\n\n /**\n * Stores a new data in the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageSet(key: string, value: any) {\n if (typeof window !== 'undefined' && window?.localStorage) {\n // store in local storage\n let normalizedVal = value;\n if (typeof value !== 'string') {\n normalizedVal = JSON.stringify(value);\n }\n window.localStorage.setItem(key, normalizedVal);\n } else {\n // store in fallback\n this.storageFallback[key] = value;\n }\n }\n\n /**\n * Removes `key` from the browser's local storage and the runtime/memory.\n */\n private _storageRemove(key: string) {\n // delete from local storage\n if (typeof window !== 'undefined' && window?.localStorage) {\n window.localStorage?.removeItem(key);\n }\n\n // delete from fallback\n delete this.storageFallback[key];\n }\n}\n","import Client from '@/Client';\n\n/**\n * BaseService class that should be inherited from all API services.\n */\nexport default abstract class BaseService {\n readonly client: Client\n\n constructor(client: Client) {\n this.client = client;\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\ninterface appleClientSecret {\n secret: string;\n}\n\nexport default class SettingsService extends BaseService {\n /**\n * Fetch all available app settings.\n */\n getAll(queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Bulk updates app settings.\n */\n update(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Performs a S3 filesystem connection test.\n *\n * The currently supported `filesystem` are \"storage\" and \"backups\".\n */\n testS3(filesystem: string = \"storage\", queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'filesystem': filesystem,\n };\n\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends a test email.\n *\n * The possible `emailTemplate` values are:\n * - verification\n * - password-reset\n * - email-change\n */\n testEmail(toEmail: string, emailTemplate: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'email': toEmail,\n 'template': emailTemplate,\n };\n\n return this.client.send('/api/settings/test/email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Generates a new Apple OAuth2 client secret.\n */\n generateAppleClientSecret(\n clientId: string,\n teamId: string,\n keyId: string,\n privateKey: string,\n duration: number,\n bodyParams = {},\n queryParams: BaseQueryParams = {}\n ): Promise {\n bodyParams = Object.assign({\n clientId,\n teamId,\n keyId,\n privateKey,\n duration,\n }, bodyParams);\n\n return this.client.send('/api/settings/apple/generate-client-secret', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n });\n }\n}\n","import BaseModel from './BaseModel';\n\nexport default class ListResult {\n page!: number;\n perPage!: number;\n totalItems!: number;\n totalPages!: number;\n items!: Array;\n\n constructor(\n page: number,\n perPage: number,\n totalItems: number,\n totalPages: number,\n items: Array,\n ) {\n this.page = page > 0 ? page : 1;\n this.perPage = perPage >= 0 ? perPage : 0;\n this.totalItems = totalItems >= 0 ? totalItems : 0;\n this.totalPages = totalPages >= 0 ? totalPages : 0;\n this.items = items || [];\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\nimport {\n BaseQueryParams,\n ListQueryParams\n} from '@/services/utils/QueryParams';\n\n// @todo since there is no longer need of SubCrudService consider merging with CrudService in v0.9+\nexport default abstract class BaseCrudService extends BaseService {\n /**\n * Response data decoder.\n */\n abstract decode(data: { [key: string]: any }): M\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n protected _getFullList(basePath: string, batchSize = 200, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize || 200, queryParams).then((list) => {\n const castedList = (list as any as ListResult);\n const items = castedList.items;\n const totalItems = castedList.totalItems;\n\n result = result.concat(items);\n\n if (items.length && totalItems > result.length) {\n return request(page + 1);\n }\n\n return result;\n });\n }\n\n return request(1);\n }\n\n /**\n * Returns paginated items list.\n */\n protected _getList(basePath: string, page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send(basePath, {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData.items || [];\n for (const item of responseData.items) {\n items.push(this.decode(item) as any as T);\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns single item by its id.\n */\n protected _getOne(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Returns the first found item by a list filter.\n *\n * Internally it calls `_getList(basePath, 1, 1, { filter })` and returns its\n * first item.\n *\n * For consistency with `_getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n protected _getFirstListItem(basePath: string, filter: string, queryParams: BaseQueryParams = {}): Promise {\n queryParams = Object.assign({\n 'filter': filter,\n '$cancelKey': 'one_by_filter_' + basePath + \"_\" + filter,\n }, queryParams);\n\n return this._getList(basePath, 1, 1, queryParams)\n .then((result) => {\n if (!result?.items?.length) {\n throw new ClientResponseError({\n status: 404,\n data: {\n code: 404,\n message: \"The requested resource wasn't found.\",\n data: {},\n },\n });\n }\n\n return result.items[0];\n });\n }\n\n /**\n * Creates a new item.\n */\n protected _create(basePath: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath, {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Updates an existing item by its id.\n */\n protected _update(basePath: string, id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n protected _delete(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n}\n","import ListResult from '@/models/utils/ListResult';\nimport BaseModel from '@/models/utils/BaseModel';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n FullListQueryParams\n} from '@/services/utils/QueryParams';\n\nexport default abstract class CrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/admins').\n */\n abstract get baseCrudPath(): string\n\n /**\n * Returns a promise with all list items batch fetched at once\n * (by default 200 items per request; to change it set the `batch` query param).\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(queryParams?: FullListQueryParams): Promise>\n\n /**\n * Legacy version of getFullList with explicitly specified batch size.\n */\n getFullList(batch?: number, queryParams?: ListQueryParams): Promise>\n\n getFullList(batchOrqueryParams?: number|FullListQueryParams, queryParams?: ListQueryParams): Promise> {\n if (typeof batchOrqueryParams == \"number\") {\n return this._getFullList(this.baseCrudPath, batchOrqueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrqueryParams, queryParams);\n\n return this._getFullList(this.baseCrudPath, params.batch || 200, params);\n }\n\n /**\n * Returns paginated items list.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n return this._getList(this.baseCrudPath, page, perPage, queryParams);\n }\n\n /**\n * Returns the first found item by the specified filter.\n *\n * Internally it calls `getList(1, 1, { filter })` and returns the\n * first found item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n *\n * For consistency with `getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n getFirstListItem(filter: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getFirstListItem(this.baseCrudPath, filter, queryParams);\n }\n\n /**\n * Returns single item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getOne(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getOne(this.baseCrudPath, id, queryParams);\n }\n\n /**\n * Creates a new item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n create(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._create(this.baseCrudPath, bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._update(this.baseCrudPath, id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._delete(this.baseCrudPath, id, queryParams);\n }\n}\n","import Admin from '@/models/Admin';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface AdminAuthResponse {\n [key: string]: any;\n\n token: string;\n admin: Admin;\n}\n\nexport default class AdminService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Admin {\n return new Admin(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/admins';\n }\n\n // ---------------------------------------------------------------\n // Post update/delete AuthStore sync\n // ---------------------------------------------------------------\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n // update the store state if the updated item id matches with the stored model\n if (\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === item?.id\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n // clear the store state if the deleted item id matches with the stored model\n if (\n success &&\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === id\n ) {\n this.client.authStore.clear();\n }\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful authorize response.\n */\n protected authResponse(responseData: any): AdminAuthResponse {\n const admin = this.decode(responseData?.admin || {});\n\n if (responseData?.token && responseData?.admin) {\n this.client.authStore.save(responseData.token, admin);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'admin': admin,\n });\n }\n\n /**\n * Authenticate an admin account with its email and password\n * and returns a new admin token and data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authWithPassword(\n email: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'identity': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Refreshes the current admin authenticated instance and\n * returns a new token and admin data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authRefresh(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCrudPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends admin password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms admin password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class ExternalAuth extends BaseModel {\n recordId!: string;\n collectionId!: string;\n provider!: string;\n providerId!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.recordId = typeof data.recordId === 'string' ? data.recordId : '';\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.provider = typeof data.provider === 'string' ? data.provider : '';\n this.providerId = typeof data.providerId === 'string' ? data.providerId : '';\n }\n}\n","import Client from '@/Client';\nimport ClientResponseError from '@/ClientResponseError';\nimport Record from '@/models/Record';\nimport ExternalAuth from '@/models/ExternalAuth';\nimport ListResult from '@/models/utils/ListResult';\nimport CrudService from '@/services/utils/CrudService';\nimport { UnsubscribeFunc } from '@/services/RealtimeService';\nimport {\n BaseQueryParams,\n RecordQueryParams,\n RecordListQueryParams,\n RecordFullListQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface RecordAuthResponse {\n record: T;\n token: string;\n meta?: {[key: string]: any};\n}\n\nexport interface AuthProviderInfo {\n name: string;\n state: string;\n codeVerifier: string;\n codeChallenge: string;\n codeChallengeMethod: string;\n authUrl: string;\n}\n\nexport interface AuthMethodsList {\n usernamePassword: boolean;\n emailPassword: boolean;\n authProviders: Array;\n}\n\nexport interface RecordSubscription {\n action: string; // eg. create, update, delete\n record: T;\n}\n\nexport type OAuth2UrlCallback = (url: string) => void|Promise;\n\nexport interface OAuth2AuthConfig {\n // the name of the OAuth2 provider (eg. \"google\")\n provider: string;\n\n // custom scopes to overwrite the default ones\n scopes?: Array;\n\n // optional record create data\n createData?: {[key: string]: any};\n\n // optional callback that is triggered after the OAuth2 sign-in/sign-up url generation\n urlCallback?: OAuth2UrlCallback;\n\n // optional query params to send with the PocketBase auth request (eg. fields, expand, etc.)\n query?: RecordQueryParams;\n\n // optional body params to send with the PocketBase auth request\n body?: {[key: string]: any};\n}\n\nexport default class RecordService extends CrudService {\n readonly collectionIdOrName: string;\n\n constructor(client: Client, collectionIdOrName: string) {\n super(client);\n\n this.collectionIdOrName = collectionIdOrName;\n }\n\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): T {\n return new Record(data) as any as T;\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return this.baseCollectionPath + '/records';\n }\n\n /**\n * Returns the current collection service base path.\n */\n get baseCollectionPath(): string {\n return '/api/collections/' + encodeURIComponent(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Realtime handlers\n // ---------------------------------------------------------------\n\n /**\n * @deprecated Use subscribe(recordId, callback) instead.\n *\n * Subscribe to the realtime changes of a single record in the collection.\n */\n async subscribeOne(recordId: string, callback: (data: RecordSubscription) => void): Promise {\n console.warn(\"PocketBase: subscribeOne(recordId, callback) is deprecated. Please replace it with subscribe(recordId, callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName + \"/\" + recordId, callback);\n }\n\n /**\n * @deprecated This form of subscribe is deprecated. Please use `subscribe(\"*\", callback)`.\n */\n async subscribe(callback: (data: RecordSubscription) => void): Promise\n\n /**\n * Subscribe to realtime changes to the specified topic (\"*\" or record id).\n *\n * If `topic` is the wildcard \"*\", then this method will subscribe to\n * any record changes in the collection.\n *\n * If `topic` is a record id, then this method will subscribe only\n * to changes of the specified record id.\n *\n * It's OK to subscribe multiple times to the same topic.\n * You can use the returned `UnsubscribeFunc` to remove only a single subscription.\n * Or use `unsubscribe(topic)` if you want to remove all subscriptions attached to the topic.\n */\n async subscribe(topic: string, callback: (data: RecordSubscription) => void): Promise\n\n async subscribe(\n topicOrCallback: string|((data: RecordSubscription) => void),\n callback?: (data: RecordSubscription) => void\n ): Promise {\n if (typeof topicOrCallback === 'function') {\n console.warn(\"PocketBase: subscribe(callback) is deprecated. Please replace it with subscribe('*', callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName, topicOrCallback);\n }\n\n if (!callback) {\n throw new Error(\"Missing subscription callback.\");\n }\n\n if (topicOrCallback === \"\") {\n throw new Error(\"Missing topic.\");\n }\n\n let topic = this.collectionIdOrName;\n if (topicOrCallback !== \"*\") {\n topic += ('/' + topicOrCallback);\n }\n\n return this.client.realtime.subscribe(topic, callback)\n }\n\n /**\n * Unsubscribe from all subscriptions of the specified topic\n * (\"*\" or record id).\n *\n * If `topic` is not set, then this method will unsubscribe from\n * all subscriptions associated to the current collection.\n */\n async unsubscribe(topic?: string): Promise {\n // unsubscribe wildcard topic\n if (topic === \"*\") {\n return this.client.realtime.unsubscribe(this.collectionIdOrName);\n }\n\n // unsubscribe recordId topic\n if (topic) {\n return this.client.realtime.unsubscribe(this.collectionIdOrName + \"/\" + topic);\n }\n\n // unsubscribe from everything related to the collection\n return this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Crud handers\n // ---------------------------------------------------------------\n /**\n * @inheritdoc\n */\n getFullList(queryParams?: RecordFullListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batch?: number, queryParams?: RecordListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batchOrQueryParams?: number|RecordFullListQueryParams, queryParams?: RecordListQueryParams): Promise> {\n if (typeof batchOrQueryParams == \"number\") {\n return super.getFullList(batchOrQueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrQueryParams, queryParams);\n\n return super.getFullList(params);\n }\n\n /**\n * @inheritdoc\n */\n getList(page = 1, perPage = 30, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getList(page, perPage, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getFirstListItem(filter: string, queryParams: RecordListQueryParams = {}): Promise {\n return super.getFirstListItem(filter, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getOne(id: string, queryParams: RecordQueryParams = {}): Promise {\n return super.getOne(id, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n create(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.create(bodyParams, queryParams);\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n if (\n // is record auth\n this.client.authStore.model?.id === item?.id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n if (\n success &&\n // is record auth\n this.client.authStore.model?.id === id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.clear();\n }\n\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful collection authorization response.\n */\n protected authResponse(responseData: any): RecordAuthResponse {\n const record = this.decode(responseData?.record || {});\n\n this.client.authStore.save(responseData?.token, record);\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'record': record as any as T,\n });\n }\n\n /**\n * Returns all available collection auth methods.\n */\n listAuthMethods(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCollectionPath + '/auth-methods', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n return Object.assign({}, responseData, {\n // normalize common fields\n 'usernamePassword': !!responseData?.usernamePassword,\n 'emailPassword': !!responseData?.emailPassword,\n 'authProviders': Array.isArray(responseData?.authProviders) ? responseData?.authProviders : [],\n });\n });\n }\n\n /**\n * Authenticate a single auth collection record via its username/email and password.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n */\n authWithPassword(\n usernameOrEmail: string,\n password: string,\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'identity': usernameOrEmail,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2 code.\n *\n * If you don't have an OAuth2 code you may also want to check `authWithOAuth2` method.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n */\n authWithOAuth2Code(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData = {},\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'provider': provider,\n 'code': code,\n 'codeVerifier': codeVerifier,\n 'redirectUrl': redirectUrl,\n 'createData': createData,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-oauth2', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * @deprecated This form of authWithOAuth2 is deprecated.\n *\n * Please use `authWithOAuth2Code()` OR its simplified realtime version\n * as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\n */\n async authWithOAuth2(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData?: {[key: string]: any},\n bodyParams?: {[key: string]: any},\n queryParams?: RecordQueryParams,\n ): Promise>\n\n /**\n * Authenticate a single auth collection record with OAuth2\n * **without custom redirects, deeplinks or even page reload**.\n *\n * This method initializes a one-off realtime subscription and will\n * open a popup window with the OAuth2 vendor page to authenticate.\n * Once the external OAuth2 sign-in/sign-up flow is completed, the popup\n * window will be automatically closed and the OAuth2 data sent back\n * to the user through the previously established realtime connection.\n *\n * You can specify an optional `urlCallback` prop to customize\n * the default url `window.open` behavior.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n *\n * Example:\n *\n * ```js\n * const authData = await pb.collection(\"users\").authWithOAuth2({\n * provider: \"google\",\n * })\n * ```\n *\n * _Site-note_: when creating the OAuth2 app in the provider dashboard\n * you have to configure `https://yourdomain.com/api/oauth2-redirect`\n * as redirect URL.\n */\n async authWithOAuth2(options: OAuth2AuthConfig): Promise>\n\n async authWithOAuth2(...args: any): Promise> {\n // fallback to legacy format\n if (args.length > 1 || typeof args?.[0] === 'string') {\n console.warn(\"PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\");\n return this.authWithOAuth2Code(\n args?.[0] || '',\n args?.[1] || '',\n args?.[2] || '',\n args?.[3] || '',\n args?.[4] || {},\n args?.[5] || {},\n args?.[6] || {},\n );\n }\n\n const config = args?.[0] || {};\n\n const authMethods = await this.listAuthMethods();\n\n const provider = authMethods.authProviders.find((p) => p.name === config.provider);\n if (!provider) {\n throw new ClientResponseError(new Error(`Missing or invalid provider \"${config.provider}\".`));\n }\n\n const redirectUrl = this.client.buildUrl('/api/oauth2-redirect');\n\n return new Promise(async (resolve, reject) => {\n try {\n // initialize a one-off @oauth2 realtime subscription\n const unsubscribe = await this.client.realtime.subscribe('@oauth2', async (e) => {\n const oldState = this.client.realtime.clientId;\n\n try {\n unsubscribe();\n\n if (!e.state || oldState !== e.state) {\n throw new Error(\"State parameters don't match.\");\n }\n\n const authData = await this.authWithOAuth2Code(\n provider.name,\n e.code,\n provider.codeVerifier,\n redirectUrl,\n config.createData,\n config.body,\n config.query,\n )\n\n resolve(authData);\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n\n const url = new URL(provider.authUrl + redirectUrl);\n url.searchParams.set(\"state\", this.client.realtime.clientId);\n if (config.scopes?.length) {\n url.searchParams.set(\"scope\", config.scopes.join(\" \"));\n }\n\n await (config.urlCallback ? config.urlCallback(url.toString()) : this._defaultUrlCallback(url.toString()));\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n }\n\n /**\n * Refreshes the current authenticated record instance and\n * returns a new token and record data.\n *\n * On success this method also automatically updates the client's AuthStore.\n */\n authRefresh(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise> {\n return this.client.send(this.baseCollectionPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Sends auth record password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends auth record verification email request.\n */\n requestVerification(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record email verification request.\n */\n confirmVerification(\n verificationToken: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': verificationToken,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends an email change request to the authenticated record model.\n */\n requestEmailChange(\n newEmail: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'newEmail': newEmail,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record's new email address.\n */\n confirmEmailChange(\n emailChangeToken: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': emailChangeToken,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Lists all linked external auth providers for the specified auth record.\n */\n listExternalAuths(\n recordId: string,\n queryParams: BaseQueryParams = {}\n ): Promise> {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => {\n const items: Array = [];\n\n if (Array.isArray(responseData)) {\n for (const item of responseData) {\n items.push(new ExternalAuth(item));\n }\n }\n\n return items;\n });\n }\n\n /**\n * Unlink a single external auth provider from the specified auth record.\n */\n unlinkExternalAuth(\n recordId: string,\n provider: string,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths/' + encodeURIComponent(provider), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n // ---------------------------------------------------------------\n\n private _defaultUrlCallback(url: string) {\n if (typeof window === \"undefined\" || !window?.open) {\n throw new ClientResponseError(new Error(`Not in a browser context - please pass a custom urlCallback function.`));\n }\n\n let width = 1024;\n let height = 768;\n\n let windowWidth = window.innerWidth;\n let windowHeight = window.innerHeight;\n\n // normalize window size\n width = width > windowWidth ? windowWidth : width;\n height = height > windowHeight ? windowHeight : height;\n\n let left = (windowWidth / 2) - (width / 2);\n let top = (windowHeight / 2) - (height / 2);\n\n window.open(\n url,\n \"oauth2-popup\",\n 'width='+width+',height='+height+',top='+top+',left='+left+',resizable,menubar=no'\n );\n }\n}\n","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.name = typeof data.name !== 'undefined' ? data.name : '';\n this.type = typeof data.type !== 'undefined' ? data.type : 'text';\n this.system = !!data.system;\n this.required = !!data.required;\n this.options = typeof data.options === 'object' && data.options !== null ? data.options : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport SchemaField from '@/models/utils/SchemaField';\n\nexport default class Collection extends BaseModel {\n name!: string;\n type!: string;\n schema!: Array;\n indexes!: Array;\n system!: boolean;\n listRule!: null|string;\n viewRule!: null|string;\n createRule!: null|string;\n updateRule!: null|string;\n deleteRule!: null|string;\n options!: {[key:string]: any};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.system = !!data.system;\n this.name = typeof data.name === 'string' ? data.name : '';\n this.type = typeof data.type === 'string' ? data.type : 'base';\n this.options = typeof data.options !== 'undefined' && data.options !== null ? data.options : {};\n this.indexes = Array.isArray(data.indexes) ? data.indexes : [];\n\n // rules\n this.listRule = typeof data.listRule === 'string' ? data.listRule : null;\n this.viewRule = typeof data.viewRule === 'string' ? data.viewRule : null;\n this.createRule = typeof data.createRule === 'string' ? data.createRule : null;\n this.updateRule = typeof data.updateRule === 'string' ? data.updateRule : null;\n this.deleteRule = typeof data.deleteRule === 'string' ? data.deleteRule : null;\n\n // schema\n data.schema = Array.isArray(data.schema) ? data.schema : [];\n this.schema = [];\n for (let field of data.schema) {\n this.schema.push(new SchemaField(field));\n }\n }\n\n /**\n * @deprecated Please use $isBase instead.\n */\n get isBase(): boolean {\n return this.$isBase;\n }\n\n /**\n * Checks if the current model is \"base\" collection.\n */\n get $isBase(): boolean {\n return this.type === 'base';\n }\n\n /**\n * @deprecated Please use $isAuth instead.\n */\n get isAuth(): boolean {\n return this.$isAuth;\n }\n\n /**\n * Checks if the current model is \"auth\" collection.\n */\n get $isAuth(): boolean {\n return this.type === 'auth';\n }\n\n /**\n * @deprecated Please use $isView instead.\n */\n get isView(): boolean {\n return this.$isView;\n }\n\n /**\n * Checks if the current model is \"view\" collection.\n */\n get $isView(): boolean {\n return this.type === 'view';\n }\n}\n","import Collection from '@/models/Collection';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport default class CollectionService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Collection {\n return new Collection(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/collections';\n }\n\n /**\n * Imports the provided collections.\n *\n * If `deleteMissing` is `true`, all local collections and schema fields,\n * that are not present in the imported configuration, WILL BE DELETED\n * (including their related records data)!\n */\n async import(\n collections: Array,\n deleteMissing: boolean = false,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/import', {\n 'method': 'PUT',\n 'params': queryParams,\n 'body': {\n 'collections': collections,\n 'deleteMissing': deleteMissing,\n }\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class LogRequest extends BaseModel {\n url!: string;\n method!: string;\n status!: number;\n auth!: string;\n remoteIp!: string;\n userIp!: string;\n referer!: string;\n userAgent!: string;\n meta!: { [key: string]: any };\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // fallback to the ip field for backward compatibility\n data.remoteIp = data.remoteIp || data.ip;\n\n this.url = typeof data.url === 'string' ? data.url : '';\n this.method = typeof data.method === 'string' ? data.method : 'GET';\n this.status = typeof data.status === 'number' ? data.status : 200;\n this.auth = typeof data.auth === 'string' ? data.auth : 'guest';\n this.remoteIp = typeof data.remoteIp === 'string' ? data.remoteIp : '';\n this.userIp = typeof data.userIp === 'string' ? data.userIp : '';\n this.referer = typeof data.referer === 'string' ? data.referer : '';\n this.userAgent = typeof data.userAgent === 'string' ? data.userAgent : '';\n this.meta = typeof data.meta === 'object' && data.meta !== null ? data.meta : {};\n }\n}\n","import LogRequest from '@/models/LogRequest';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n LogStatsQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface HourlyStats {\n total: number;\n date: string;\n}\n\nexport default class LogService extends BaseService {\n /**\n * Returns paginated logged requests list.\n */\n getRequestsList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send('/api/logs/requests', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData?.items || [];\n for (const item of responseData.items) {\n items.push(new LogRequest(item));\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns a single logged request by its id.\n */\n getRequest(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/logs/requests/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => new LogRequest(responseData));\n }\n\n /**\n * Returns request logs statistics.\n */\n getRequestsStats(queryParams: LogStatsQueryParams = {}): Promise> {\n return this.client.send('/api/logs/requests/stats', {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => responseData);\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\n\ninterface promiseCallbacks {\n resolve: Function\n reject: Function\n}\n\nexport type UnsubscribeFunc = () => Promise;\n\nexport default class RealtimeService extends BaseService {\n clientId: string = \"\";\n\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 15000;\n private reconnectTimeoutId: any;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number = Infinity;\n private predefinedReconnectIntervals: Array = [\n 200, 300, 500, 1000, 1200, 1500, 2000,\n ];\n private pendingConnects: Array = [];\n\n\n /**\n * Returns whether the realtime connection has been established.\n */\n get isConnected(): boolean {\n return !!this.eventSource && !!this.clientId && !this.pendingConnects.length;\n }\n\n /**\n * Register the subscription listener.\n *\n * You can subscribe multiple times to the same topic.\n *\n * If the SSE connection is not started yet,\n * this method will also initialize it.\n */\n async subscribe(topic: string, callback: (data: any) => void): Promise {\n if (!topic) {\n throw new Error('topic must be set.')\n }\n\n const listener = function (e: Event) {\n const msgEvent = (e as MessageEvent);\n\n let data;\n try {\n data = JSON.parse(msgEvent?.data);\n } catch {}\n\n callback(data || {});\n };\n\n // store the listener\n if (!this.subscriptions[topic]) {\n this.subscriptions[topic] = [];\n }\n this.subscriptions[topic].push(listener);\n\n if (!this.isConnected) {\n // initialize sse connection\n await this.connect();\n } else if (this.subscriptions[topic].length === 1) {\n // send the updated subscriptions (if it is the first for the topic)\n await this.submitSubscriptions();\n } else {\n // only register the listener\n this.eventSource?.addEventListener(topic, listener);\n }\n\n return async (): Promise => {\n return this.unsubscribeByTopicAndListener(topic, listener);\n };\n }\n\n /**\n * Unsubscribe from all subscription listeners with the specified topic.\n *\n * If `topic` is not provided, then this method will unsubscribe\n * from all active subscriptions.\n *\n * This method is no-op if there are no active subscriptions.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribe(topic?: string): Promise {\n if (!this.hasSubscriptionListeners(topic)) {\n return; // already unsubscribed\n }\n\n if (!topic) {\n // remove all subscriptions\n this.subscriptions = {};\n } else {\n // remove all topic listeners\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n /**\n * Unsubscribe from all subscription listeners starting with the specified topic prefix.\n *\n * This method is no-op if there are no active subscriptions with the specified topic prefix.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByPrefix(topicPrefix: string): Promise {\n let hasAtleastOneTopic = false;\n for (let topic in this.subscriptions) {\n if (!topic.startsWith(topicPrefix)) {\n continue;\n }\n\n hasAtleastOneTopic = true;\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!hasAtleastOneTopic) {\n return; // nothing to unsubscribe from\n }\n\n if (this.hasSubscriptionListeners()) {\n // submit the deleted subscriptions\n await this.submitSubscriptions();\n } else {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n }\n }\n\n /**\n * Unsubscribe from all subscriptions matching the specified topic and listener function.\n *\n * This method is no-op if there are no active subscription with\n * the specified topic and listener.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByTopicAndListener(topic: string, listener: EventListener): Promise {\n if (!Array.isArray(this.subscriptions[topic]) || !this.subscriptions[topic].length) {\n return; // already unsubscribed\n }\n\n let exist = false;\n for (let i = this.subscriptions[topic].length - 1; i >= 0; i--) {\n if (this.subscriptions[topic][i] !== listener) {\n continue;\n }\n\n exist = true; // has at least one matching listener\n delete this.subscriptions[topic][i]; // removes the function reference\n this.subscriptions[topic].splice(i, 1); // reindex the array\n this.eventSource?.removeEventListener(topic, listener);\n }\n if (!exist) {\n return;\n }\n\n // remove the topic from the subscriptions list if there are no other listeners\n if (!this.subscriptions[topic].length) {\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n private hasSubscriptionListeners(topicToCheck?: string): boolean {\n this.subscriptions = this.subscriptions || {};\n\n // check the specified topic\n if (topicToCheck) {\n return !!this.subscriptions[topicToCheck]?.length;\n }\n\n // check for at least one non-empty topic\n for (let topic in this.subscriptions) {\n if (!!this.subscriptions[topic]?.length) {\n return true\n }\n }\n\n return false;\n }\n\n private async submitSubscriptions(): Promise {\n if (!this.clientId) {\n return; // no client/subscriber\n }\n\n // optimistic update\n this.addAllSubscriptionListeners();\n\n this.lastSentTopics = this.getNonEmptySubscriptionTopics();\n\n return this.client.send('/api/realtime', {\n 'method': 'POST',\n 'body': {\n 'clientId': this.clientId,\n 'subscriptions': this.lastSentTopics,\n },\n 'params': {\n '$cancelKey': \"realtime_\" + this.clientId,\n },\n }).catch((err) => {\n if (err?.isAbort) {\n return; // silently ignore aborted pending requests\n }\n throw err;\n });\n }\n\n private getNonEmptySubscriptionTopics(): Array {\n const result : Array = [];\n\n for (let topic in this.subscriptions) {\n if (this.subscriptions[topic].length) {\n result.push(topic);\n }\n }\n\n return result;\n }\n\n private addAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n this.removeAllSubscriptionListeners();\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.addEventListener(topic, listener);\n }\n }\n }\n\n private removeAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.removeEventListener(topic, listener);\n }\n }\n }\n\n private async connect(): Promise {\n if (this.reconnectAttempts > 0) {\n // immediately resolve the promise to avoid indefinitely\n // blocking the client during reconnection\n return;\n }\n\n return new Promise((resolve, reject) => {\n this.pendingConnects.push({ resolve, reject });\n\n if (this.pendingConnects.length > 1) {\n // all promises will be resolved once the connection is established\n return;\n }\n\n this.initConnect();\n })\n }\n\n private initConnect() {\n this.disconnect(true);\n\n // wait up to 15s for connect\n clearTimeout(this.connectTimeoutId);\n this.connectTimeoutId = setTimeout(() => {\n this.connectErrorHandler(new Error(\"EventSource connect took too long.\"));\n }, this.maxConnectTimeout);\n\n this.eventSource = new EventSource(this.client.buildUrl('/api/realtime'))\n\n this.eventSource.onerror = (_) => {\n this.connectErrorHandler(new Error(\"Failed to establish realtime connection.\"));\n };\n\n this.eventSource.addEventListener('PB_CONNECT', (e) => {\n const msgEvent = (e as MessageEvent);\n this.clientId = msgEvent?.lastEventId;\n\n this.submitSubscriptions()\n .then(async () => {\n let retries = 3;\n while (this.hasUnsentSubscriptions() && retries > 0) {\n retries--;\n // resubscribe to ensure that the latest topics are submitted\n //\n // This is needed because missed topics could happen on reconnect\n // if after the pending sent `submitSubscriptions()` call another `subscribe()`\n // was made before the submit was able to complete.\n await this.submitSubscriptions();\n }\n }).then(() => {\n for (let p of this.pendingConnects) {\n p.resolve();\n }\n\n // reset connect meta\n this.pendingConnects = [];\n this.reconnectAttempts = 0;\n clearTimeout(this.reconnectTimeoutId);\n clearTimeout(this.connectTimeoutId);\n }).catch((err) => {\n this.clientId = \"\";\n this.connectErrorHandler(err);\n });\n });\n }\n\n private hasUnsentSubscriptions(): boolean {\n const latestTopics = this.getNonEmptySubscriptionTopics();\n if (latestTopics.length != this.lastSentTopics.length) {\n return true;\n }\n\n for (const t of latestTopics) {\n if (!this.lastSentTopics.includes(t)) {\n return true;\n }\n }\n\n return false;\n }\n\n private connectErrorHandler(err: any) {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n\n if (\n // wasn't previously connected -> direct reject\n (!this.clientId && !this.reconnectAttempts) ||\n // was previously connected but the max reconnection limit has been reached\n this.reconnectAttempts > this.maxReconnectAttempts\n ) {\n for (let p of this.pendingConnects) {\n p.reject(new ClientResponseError(err));\n }\n this.disconnect();\n return;\n }\n\n // otherwise -> reconnect in the background\n this.disconnect(true);\n const timeout = this.predefinedReconnectIntervals[this.reconnectAttempts] || this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length - 1];\n this.reconnectAttempts++;\n this.reconnectTimeoutId = setTimeout(() => {\n this.initConnect();\n }, timeout);\n }\n\n private disconnect(fromReconnect = false): void {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n this.removeAllSubscriptionListeners();\n this.eventSource?.close();\n this.eventSource = null;\n this.clientId = \"\";\n\n if (!fromReconnect) {\n this.reconnectAttempts = 0;\n\n // reject any remaining connect promises\n const err = new ClientResponseError(new Error(\"Realtime disconnected.\"));\n for (let p of this.pendingConnects) {\n p.reject(err);\n }\n this.pendingConnects = [];\n }\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface HealthCheckResponse {\n code: number;\n message: string;\n data: {[key: string]: any};\n}\n\nexport default class HealthService extends BaseService {\n /**\n * Checks the health status of the api.\n */\n check(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/health', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport default class FileService extends BaseService {\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n const parts = [];\n parts.push(\"api\")\n parts.push(\"files\")\n parts.push(encodeURIComponent(record.collectionId || record.collectionName))\n parts.push(encodeURIComponent(record.id))\n parts.push(encodeURIComponent(filename))\n\n let result = this.client.buildUrl(parts.join('/'));\n\n if (Object.keys(queryParams).length) {\n const params = new URLSearchParams(queryParams);\n result += (result.includes(\"?\") ? \"&\" : \"?\") + params;\n }\n\n return result\n }\n\n /**\n * Requests a new private file access token for the current auth model (admin or record).\n */\n getToken(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/files/token', {\n 'method': 'POST',\n 'params': queryParams,\n }).then((data) => data?.token || '');\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface BackupFileInfo {\n key: string;\n size: number;\n modified: string;\n}\n\nexport default class BackupService extends BaseService {\n /**\n * Returns list with all available backup files.\n */\n getFullList(queryParams: BaseQueryParams = {}): Promise> {\n return this.client.send('/api/backups', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n\n /**\n * Initializes a new backup.\n */\n create(basename: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'name': basename,\n };\n\n return this.client.send('/api/backups', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Deletes a single backup file.\n */\n delete(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}`, {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Initializes an app data restore from an existing backup.\n */\n restore(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}/restore`, {\n 'method': 'POST',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Builds a download url for a single existing backup using an\n * admin file token and the backup file key.\n *\n * The file token can be generated via `pb.files.getToken()`.\n */\n getDownloadUrl(token: string, key: string): string {\n return this.client.buildUrl(`/api/backups/${encodeURIComponent(key)}?token=${encodeURIComponent(token)}`);\n }\n}\n","import ClientResponseError from '@/ClientResponseError';\nimport BaseAuthStore from '@/stores/BaseAuthStore';\nimport LocalAuthStore from '@/stores/LocalAuthStore';\nimport SettingsService from '@/services/SettingsService';\nimport AdminService from '@/services/AdminService';\nimport RecordService from '@/services/RecordService';\nimport CollectionService from '@/services/CollectionService';\nimport LogService from '@/services/LogService';\nimport RealtimeService from '@/services/RealtimeService';\nimport HealthService from '@/services/HealthService';\nimport FileService from '@/services/FileService';\nimport BackupService from '@/services/BackupService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport interface SendOptions extends RequestInit {\n headers?: { [key: string]: string };\n body?: any;\n params?: BaseQueryParams;\n}\n\nexport interface BeforeSendResult {\n [key: string]: any, // for backward compatibility\n url?: string,\n options?: {[key: string]: any}\n}\n\n/**\n * PocketBase JS Client.\n */\nexport default class Client {\n /**\n * The base PocketBase backend url address (eg. 'http://127.0.0.1.8090').\n */\n baseUrl: string;\n\n /**\n * Hook that get triggered right before sending the fetch request,\n * allowing you to inspect and modify the url and request options.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * You can return a non-empty result object `{ url, options }` to replace the url and request options entirely.\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, options) {\n * options.headers = Object.assign({}, options.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return { url, options }\n * };\n * ```\n */\n beforeSend?: (url: string, options: SendOptions) => BeforeSendResult|Promise;\n\n /**\n * Hook that get triggered after successfully sending the fetch request,\n * allowing you to inspect/modify the response object and its parsed data.\n *\n * Returns the new Promise resolved `data` that will be returned to the client.\n *\n * Example:\n * ```js\n * client.afterSend = function (response, data) {\n * if (response.status != 200) {\n * throw new ClientResponseError({\n * url: response.url,\n * status: response.status,\n * data: data,\n * });\n * }\n *\n * return data;\n * };\n * ```\n */\n afterSend?: (response: Response, data: any) => any;\n\n /**\n * Optional language code (default to `en-US`) that will be sent\n * with the requests to the server as `Accept-Language` header.\n */\n lang: string;\n\n /**\n * A replaceable instance of the local auth store service.\n */\n authStore: BaseAuthStore;\n\n /**\n * An instance of the service that handles the **Settings APIs**.\n */\n readonly settings: SettingsService;\n\n /**\n * An instance of the service that handles the **Admin APIs**.\n */\n readonly admins: AdminService;\n\n /**\n * An instance of the service that handles the **Collection APIs**.\n */\n readonly collections: CollectionService;\n\n /**\n * An instance of the service that handles the **File APIs**.\n */\n readonly files: FileService;\n\n /**\n * An instance of the service that handles the **Log APIs**.\n */\n readonly logs: LogService;\n\n /**\n * An instance of the service that handles the **Realtime APIs**.\n */\n readonly realtime: RealtimeService;\n\n /**\n * An instance of the service that handles the **Health APIs**.\n */\n readonly health: HealthService;\n\n /**\n * An instance of the service that handles the **Backup APIs**.\n */\n readonly backups: BackupService;\n\n private cancelControllers: { [key: string]: AbortController } = {};\n private recordServices: { [key: string]: RecordService } = {};\n private enableAutoCancellation: boolean = true;\n\n constructor(\n baseUrl = '/',\n authStore?: BaseAuthStore | null,\n lang = 'en-US',\n ) {\n this.baseUrl = baseUrl;\n this.lang = lang;\n this.authStore = authStore || new LocalAuthStore();\n\n // services\n this.admins = new AdminService(this);\n this.collections = new CollectionService(this);\n this.files = new FileService(this);\n this.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(this);\n this.health = new HealthService(this);\n this.backups = new BackupService(this);\n }\n\n /**\n * Returns the RecordService associated to the specified collection.\n *\n * @param {string} idOrName\n * @return {RecordService}\n */\n collection(idOrName: string): RecordService {\n if (!this.recordServices[idOrName]) {\n this.recordServices[idOrName] = new RecordService(this, idOrName);\n }\n\n return this.recordServices[idOrName];\n }\n\n /**\n * Globally enable or disable auto cancellation for pending duplicated requests.\n */\n autoCancellation(enable: boolean): Client {\n this.enableAutoCancellation = !!enable;\n\n return this;\n }\n\n /**\n * Cancels single request by its cancellation key.\n */\n cancelRequest(cancelKey: string): Client {\n if (this.cancelControllers[cancelKey]) {\n this.cancelControllers[cancelKey].abort();\n delete this.cancelControllers[cancelKey];\n }\n\n return this;\n }\n\n /**\n * Cancels all pending requests.\n */\n cancelAllRequests(): Client {\n for (let k in this.cancelControllers) {\n this.cancelControllers[k].abort();\n }\n\n this.cancelControllers = {};\n\n return this;\n }\n\n /**\n * Sends an api http request.\n */\n async send(path: string, reqOptions: SendOptions): Promise {\n let options = Object.assign({ method: 'GET' } as SendOptions, reqOptions);\n\n // JSON serialize the body if needed and set the correct content type\n // (for FormData body the Content-Type header should be skipped since the boundary is autogenerated)\n if (!this.isFormData(options.body)) {\n if (options.body && typeof options.body !== 'string') {\n options.body = JSON.stringify(options.body);\n }\n\n // add the json header (if not already)\n if (typeof options?.headers?.['Content-Type'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof options?.headers?.['Accept-Language'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Accept-Language': this.lang,\n });\n }\n\n // check if Authorization header can be added\n if (\n // has stored token\n this.authStore?.token &&\n // auth header is not explicitly set\n (typeof options?.headers?.Authorization === 'undefined')\n ) {\n options.headers = Object.assign({}, options.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && options.params?.$autoCancel !== false) {\n const cancelKey = options.params?.$cancelKey || ((options.method || 'GET') + path);\n\n // cancel previous pending requests\n this.cancelRequest(cancelKey);\n\n const controller = new AbortController();\n this.cancelControllers[cancelKey] = controller;\n options.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete options.params?.$autoCancel;\n delete options.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof options.params !== 'undefined') {\n const query = this.serializeQueryParams(options.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete options.params;\n }\n\n if (this.beforeSend) {\n const result = Object.assign({}, await this.beforeSend(url, options));\n if (typeof result.url !== \"undefined\" || typeof result.options !== \"undefined\") {\n url = result.url || url;\n options = result.options || options;\n } else if (Object.keys(result).length) {\n // legacy behavior\n options = result as SendOptions;\n console?.warn && console.warn(\"Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`.\");\n }\n }\n\n // send the request\n return fetch(url, options)\n .then(async (response) => {\n let data : any = {};\n\n try {\n data = await response.json();\n } catch (_) {\n // all api responses are expected to return json\n // with the exception of the realtime event and 204\n }\n\n if (this.afterSend) {\n data = await this.afterSend(response, data);\n }\n\n if (response.status >= 400) {\n throw new ClientResponseError({\n url: response.url,\n status: response.status,\n data: data,\n });\n }\n\n return data as T;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Legacy alias of `pb.files.getUrl()`.\n */\n getFileUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n return this.files.getUrl(record, filename, queryParams);\n }\n\n /**\n * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl;\n\n // construct an absolute base url if in a browser environment\n if (\n typeof window !== 'undefined' &&\n !!window.location &&\n !url.startsWith('https://') &&\n !url.startsWith('http://')\n ) {\n url = window.location.origin?.endsWith('/') ?\n window.location.origin.substring(0, window.location.origin.length - 1) :\n (window.location.origin || '');\n\n if (!this.baseUrl.startsWith('/')) {\n url += window.location.pathname || '/';\n url += url.endsWith('/') ? '' : '/';\n }\n\n url += this.baseUrl;\n }\n\n // concatenate the path\n if (path) {\n url += url.endsWith('/') ? '' : '/'; // append trailing slash if missing\n url += path.startsWith('/') ? path.substring(1) : path;\n }\n\n return url;\n }\n\n /**\n * Loosely checks if the specified body is a FormData instance.\n */\n private isFormData(body: any): boolean {\n return body && (\n // we are checking the constructor name because FormData\n // is not available natively in some environments and the\n // polyfill(s) may not be globally accessible\n body.constructor.name === 'FormData' ||\n // fallback to global FormData instance check\n // note: this is needed because the constructor.name could be different in case of\n // custom global FormData implementation, eg. React Native on Android/iOS\n (typeof FormData !== \"undefined\" && body instanceof FormData)\n )\n }\n\n /**\n * Serializes the provided query parameters into a query string.\n */\n private serializeQueryParams(params: {[key: string]: any}): string {\n const result: Array = [];\n for (const key in params) {\n if (params[key] === null) {\n // skip null query params\n continue;\n }\n\n const value = params[key];\n const encodedKey = encodeURIComponent(key);\n\n if (Array.isArray(value)) {\n // \"repeat\" array params\n for (const v of value) {\n result.push(encodedKey + \"=\" + encodeURIComponent(v));\n }\n } else if (value instanceof Date) {\n result.push(encodedKey + \"=\" + encodeURIComponent(value.toISOString()));\n } else if (typeof value !== null && typeof value === 'object') {\n result.push(encodedKey + \"=\" + encodeURIComponent(JSON.stringify(value)));\n } else {\n result.push(encodedKey + \"=\" + encodeURIComponent(value));\n }\n }\n\n return result.join('&');\n }\n}\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__extends","TypeError","String","__","this","constructor","create","__assign","assign","t","s","i","n","arguments","length","apply","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","adopt","then","__generator","body","f","y","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","v","op","pop","push","atobPolyfill","ClientResponseError","_super","errData","_this","url","status","response","isAbort","originalError","data","DOMException","name","message","_a","_d","_c","_b","cause","includes","defineProperty","get","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","isDate","toString","Date","valueOf","toUTCString","httpOnly","secure","priority","toLowerCase","sameSite","defaultDecode","indexOf","decodeURIComponent","encodeURIComponent","getTokenPayload","token","encodedPayload","split","map","c","charCodeAt","slice","join","JSON","parse","atob","input","str","replace","bs","buffer","bc","idx","output","charAt","fromCharCode","BaseModel","$load","load","_i","entries","key","id","created","updated","clone","$clone","structuredClone","stringify","export","$export","Record","collectionId","collectionName","_loadExpand","expand","isArray","Admin","avatar","email","defaultCookieKey","LocalAuthStore","storageKey","storageFallback","_storageGet","model","save","_storageSet","clear","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","isTokenExpired","expirationThreshold","payload","keys","exp","now","triggerChange","loadFromCookie","cookie","rawData","cookieParse","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","exportToCookie","defaultOptions","resultLength","Blob","size","username","verified","onChange","callback","fireImmediately","splice","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","filesystem","testEmail","toEmail","emailTemplate","template","generateAppleClientSecret","clientId","teamId","keyId","privateKey","duration","ListResult","page","perPage","totalItems","totalPages","items","BaseCrudService","_getFullList","basePath","batchSize","request","_getList","list","castedList","concat","item","_getOne","_getFirstListItem","filter","$cancelKey","code","_create","_update","_delete","CrudService","getFullList","batchOrqueryParams","baseCrudPath","batch","getList","getFirstListItem","getOne","delete","AdminService","authStore","success","authResponse","admin","authWithPassword","password","identity","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","batchOrQueryParams","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2Code","codeVerifier","redirectUrl","createData","authWithOAuth2","args","config","authMethods","find","buildUrl","oldState","unsubscribe_1","state","query","authData","err_2","URL","authUrl","searchParams","set","scopes","urlCallback","_defaultUrlCallback","err_1","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","open","width","height","windowWidth","innerWidth","windowHeight","innerHeight","left","top","SchemaField","type","system","required","Collection","indexes","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","$isBase","$isAuth","$isView","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","eventSource","subscriptions","lastSentTopics","maxConnectTimeout","reconnectAttempts","maxReconnectAttempts","Infinity","predefinedReconnectIntervals","pendingConnects","listener","msgEvent","isConnected","connect","submitSubscriptions","addEventListener","unsubscribeByTopicAndListener","hasSubscriptionListeners","removeEventListener","disconnect","topicPrefix","hasAtleastOneTopic","startsWith","exist","topicToCheck","addAllSubscriptionListeners","getNonEmptySubscriptionTopics","catch","err","removeAllSubscriptionListeners","initConnect","clearTimeout","connectTimeoutId","setTimeout","connectErrorHandler","EventSource","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","timeout","fromReconnect","close","HealthService","check","FileService","getUrl","filename","parts","URLSearchParams","getToken","BackupService","basename","restore","getDownloadUrl","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","files","logs","settings","health","backups","collection","idOrName","autoCancellation","enable","cancelRequest","cancelKey","abort","cancelAllRequests","k","reqOptions","isFormData","headers","Authorization","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","serializeQueryParams","beforeSend","_k","_j","_l","_m","fetch","json","afterSend","getFileUrl","location","origin","endsWith","substring","pathname","FormData","encodedKey","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Y,GAG/CjC,GAMHmX,OAAUhb,UAAAsc,WAAlB,SAAmBha,GACf,OAAOA,IAIuB,aAA1BA,EAAK9B,YAAY4D,MAII,oBAAb4Z,UAA4B1b,aAAgB0b,WAOpDhD,OAAoBhb,UAAAid,qBAA5B,SAA6B5P,GACzB,IAAMpL,EAAwB,GAC9B,IAAK,IAAMwG,KAAO4E,EACd,GAAoB,OAAhBA,EAAO5E,GAAX,CAKA,IAAM7G,EAAQyL,EAAO5E,GACfwV,EAAapX,mBAAmB4B,GAEtC,GAAI3I,MAAM0J,QAAQ5H,GAEd,IAAgB,QAAAsc,EAAAtc,EAAA2G,EAAK2V,EAAAjd,OAALsH,IAAO,CAAlB,IAAMnF,EAAC8a,EAAA3V,GACRtG,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBzD,GACrD,MACMxB,aAAiBsE,KACxBjE,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBjF,EAAMuc,gBAChC,cAAVvc,GAAmC,iBAAVA,EACvCK,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBU,KAAKyB,UAAUpH,KAEjEK,EAAOsB,KAAK0a,EAAa,IAAMpX,mBAAmBjF,GAfrD,CAmBL,OAAOK,EAAOqF,KAAK,MAE1B0T,MAAD"} \ No newline at end of file +{"version":3,"file":"pocketbase.umd.js","sources":["../node_modules/tslib/tslib.es6.js","../src/ClientResponseError.ts","../src/stores/utils/jwt.ts","../src/stores/utils/cookie.ts","../src/models/utils/BaseModel.ts","../src/models/Record.ts","../src/models/Admin.ts","../src/stores/BaseAuthStore.ts","../src/stores/LocalAuthStore.ts","../src/services/utils/BaseService.ts","../src/services/SettingsService.ts","../src/models/utils/ListResult.ts","../src/services/utils/BaseCrudService.ts","../src/services/utils/CrudService.ts","../src/services/AdminService.ts","../src/models/ExternalAuth.ts","../src/services/RecordService.ts","../src/models/utils/SchemaField.ts","../src/models/Collection.ts","../src/services/CollectionService.ts","../src/models/LogRequest.ts","../src/services/LogService.ts","../src/services/RealtimeService.ts","../src/services/HealthService.ts","../src/services/FileService.ts","../src/services/BackupService.ts","../src/Client.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.push(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.push(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","/**\n * ClientResponseError is a custom Error class that is intended to wrap\n * and normalize any error thrown by `Client.send()`.\n */\nexport default class ClientResponseError extends Error {\n url: string = '';\n status: number = 0;\n response: {[key: string]: any} = {};\n isAbort: boolean = false;\n originalError: any = null;\n\n constructor(errData?: any) {\n super(\"ClientResponseError\");\n\n // Set the prototype explicitly.\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, ClientResponseError.prototype);\n\n if (!(errData instanceof ClientResponseError)) {\n this.originalError = errData;\n }\n\n if (errData !== null && typeof errData === 'object') {\n this.url = typeof errData.url === 'string' ? errData.url : '';\n this.status = typeof errData.status === 'number' ? errData.status : 0;\n this.response = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\n this.isAbort = !!errData.isAbort;\n }\n\n if (typeof DOMException !== 'undefined' && errData instanceof DOMException) {\n this.isAbort = true;\n }\n\n this.name = \"ClientResponseError \" + this.status;\n this.message = this.response?.message;\n if (!this.message) {\n if (this.isAbort) {\n this.message = 'The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.';\n } else if (this.originalError?.cause?.message?.includes(\"ECONNREFUSED ::1\")) {\n this.message = 'Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).';\n } else {\n this.message = 'Something went wrong while processing your request.';\n }\n }\n }\n\n /**\n * Alias for `this.response` to preserve the backward compatibility.\n */\n get data() {\n return this.response;\n }\n\n /**\n * Make a POJO's copy of the current error class instance.\n * @see https://github.com/vuex-orm/vuex-orm/issues/255\n */\n toJSON() {\n return { ...this };\n }\n}\n","let atobPolyfill: Function;\nif (typeof atob === 'function') {\n atobPolyfill = atob\n} else {\n /**\n * The code was extracted from:\n * https://github.com/davidchambers/Base64.js\n */\n atobPolyfill = (input: any) => {\n const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n let str = String(input).replace(/=+$/, \"\");\n if (str.length % 4 == 1) {\n throw new Error(\"'atob' failed: The string to be decoded is not correctly encoded.\");\n }\n\n for (\n // initialize result and counters\n var bc = 0, bs, buffer, idx = 0, output = \"\";\n // get next character\n (buffer = str.charAt(idx++));\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? (bs as any) * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ?\n (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6)))) :\n 0\n ) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n\n return output;\n };\n}\n\n/**\n * Returns JWT token's payload data.\n */\nexport function getTokenPayload(token: string): { [key: string]: any } {\n if (token) {\n try {\n const encodedPayload = decodeURIComponent(atobPolyfill(token.split('.')[1]).split('').map(function (c: string) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n\n return JSON.parse(encodedPayload) || {};\n } catch (e) {\n }\n }\n\n return {};\n}\n\n/**\n * Checks whether a JWT token is expired or not.\n * Tokens without `exp` payload key are considered valid.\n * Tokens with empty payload (eg. invalid token strings) are considered expired.\n *\n * @param token The token to check.\n * @param [expirationThreshold] Time in seconds that will be subtracted from the token `exp` property.\n */\nexport function isTokenExpired(token: string, expirationThreshold = 0): boolean {\n let payload = getTokenPayload(token);\n\n if (\n Object.keys(payload).length > 0 &&\n (!payload.exp || (payload.exp - expirationThreshold) > (Date.now() / 1000))\n ) {\n return false;\n }\n\n return true;\n}\n","/**\n * -------------------------------------------------------------------\n * Simple cookie parse and serialize utilities mostly based on the\n * node module https://github.com/jshttp/cookie.\n * -------------------------------------------------------------------\n */\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\nexport interface ParseOptions{\n decode?: (val: string) => string,\n}\n\n/**\n* Parses the given cookie header string into an object\n* The object has the various cookies as keys(names) => values\n*/\nexport function cookieParse(str: string, options?: ParseOptions): { [key: string]: any } {\n const result: { [key: string]: any } = {};\n\n if (typeof str !== 'string') {\n return result;\n }\n\n const opt = Object.assign({}, options || {});\n const decode = opt.decode || defaultDecode;\n\n let index = 0;\n while (index < str.length) {\n const eqIdx = str.indexOf('=', index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = str.indexOf(';', index);\n\n if (endIdx === -1) {\n endIdx = str.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1;\n continue;\n }\n\n const key = str.slice(index, eqIdx).trim();\n\n // only assign once\n if (undefined === result[key]) {\n let val = str.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n result[key] = decode(val);\n } catch (_) {\n result[key] = val; // no decoding\n }\n }\n\n index = endIdx + 1;\n }\n\n return result;\n};\n\nexport interface SerializeOptions{\n encode?: (val: string | number | boolean) => string,\n maxAge?: number,\n domain?: string,\n path?: string,\n expires?: Date,\n httpOnly?: boolean,\n secure?: boolean,\n priority?: string,\n sameSite?: boolean|string,\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * ```js\n * cookieSerialize('foo', 'bar', { httpOnly: true }) // \"foo=bar; httpOnly\"\n * ```\n */\nexport function cookieSerialize(name: string, val: string, options?: SerializeOptions): string {\n const opt = Object.assign({}, options || {});\n const encode = opt.encode || defaultEncode;\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n const value = encode(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n let result = name + '=' + value;\n\n if (opt.maxAge != null) {\n const maxAge = opt.maxAge - 0;\n\n if (isNaN(maxAge) || !isFinite(maxAge)) {\n throw new TypeError('option maxAge is invalid');\n }\n\n result += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n result += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n result += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (!isDate(opt.expires) || isNaN(opt.expires.valueOf())) {\n throw new TypeError('option expires is invalid');\n }\n\n result += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n result += '; HttpOnly';\n }\n\n if (opt.secure) {\n result += '; Secure';\n }\n\n if (opt.priority) {\n const priority = typeof opt.priority === 'string' ? opt.priority.toLowerCase() : opt.priority;\n\n switch (priority) {\n case 'low':\n result += '; Priority=Low';\n break;\n case 'medium':\n result += '; Priority=Medium';\n break;\n case 'high':\n result += '; Priority=High';\n break;\n default:\n throw new TypeError('option priority is invalid');\n }\n }\n\n if (opt.sameSite) {\n const sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n result += '; SameSite=Strict';\n break;\n case 'lax':\n result += '; SameSite=Lax';\n break;\n case 'strict':\n result += '; SameSite=Strict';\n break;\n case 'none':\n result += '; SameSite=None';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return result;\n};\n\n/**\n * Default URL-decode string value function.\n * Optimized to skip native call when no `%`.\n */\nfunction defaultDecode(val: string): string {\n return val.indexOf('%') !== -1\n ? decodeURIComponent(val)\n : val;\n}\n\n/**\n * Default URL-encode value function.\n */\nfunction defaultEncode(val: string | number | boolean): string {\n return encodeURIComponent(val);\n}\n\n/**\n * Determines if value is a Date.\n */\nfunction isDate(val: any): boolean {\n return (\n Object.prototype.toString.call(val) === '[object Date]' ||\n val instanceof Date\n );\n}\n","export default abstract class BaseModel {\n [key: string]: any,\n\n id!: string;\n created!: string;\n updated!: string;\n\n constructor(data: { [key: string]: any } = {}) {\n this.$load(data || {});\n }\n\n /**\n * Alias of this.$load(data).\n */\n load(data: { [key: string]: any }) {\n return this.$load(data);\n }\n\n /**\n * Loads `data` into the current model.\n */\n $load(data: { [key: string]: any }) {\n for (const [key, value] of Object.entries(data)) {\n this[key] = value;\n }\n\n // normalize known fields\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.created = typeof data.created !== 'undefined' ? data.created : '';\n this.updated = typeof data.updated !== 'undefined' ? data.updated : '';\n }\n\n /**\n * Returns whether the current loaded data represent a stored db record.\n */\n get $isNew(): boolean {\n return !this.id;\n }\n\n /**\n * Alias of this.clone().\n */\n clone(): BaseModel {\n return this.$clone();\n }\n\n /**\n * Creates a deep clone of the current model.\n */\n $clone(): BaseModel {\n const clone = typeof structuredClone === 'function' ?\n structuredClone(this) : JSON.parse(JSON.stringify(this));\n\n return new (this.constructor as any)(clone);\n }\n\n /**\n * Alias of this.$export().\n */\n export(): { [key: string]: any } {\n return this.$export();\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n $export(): { [key: string]: any } {\n return typeof structuredClone === 'function' ?\n structuredClone(this) : Object.assign({}, this);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Record extends BaseModel {\n collectionId!: string;\n collectionName!: string;\n expand!: {[key: string]: Record|Array};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // normalize common fields\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.collectionName = typeof data.collectionName === 'string' ? data.collectionName : '';\n\n // normalize expand items\n this._loadExpand(data.expand);\n }\n\n /**\n * Loads the provided expand items and recursively normalizes each\n * item to a `Record|Array`.\n */\n private _loadExpand(expand: { [key: string]: any }) {\n expand = expand || {};\n this.expand = {};\n\n for (const key in expand) {\n if (Array.isArray(expand[key])) {\n this.expand[key] = expand[key].map((data: any) => new Record(data || {}));\n } else {\n this.expand[key] = new Record(expand[key] || {});\n }\n }\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Admin extends BaseModel {\n avatar!: number;\n email!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.avatar = typeof data.avatar === 'number' ? data.avatar : 0;\n this.email = typeof data.email === 'string' ? data.email : '';\n }\n}\n","import { cookieParse, cookieSerialize, SerializeOptions } from '@/stores/utils/cookie';\nimport { isTokenExpired, getTokenPayload } from '@/stores/utils/jwt';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\nexport type OnStoreChangeFunc = (token: string, model: Record|Admin|null) => void;\n\nconst defaultCookieKey = 'pb_auth';\n\n/**\n * Base AuthStore class that is intended to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore {\n protected baseToken: string = '';\n protected baseModel: Record|Admin|null = null;\n\n private _onChangeCallbacks: Array = [];\n\n /**\n * Retrieves the stored token (if any).\n */\n get token(): string {\n return this.baseToken;\n }\n\n /**\n * Retrieves the stored model data (if any).\n */\n get model(): Record|Admin|null {\n return this.baseModel;\n }\n\n /**\n * Loosely checks if the store has valid token (aka. existing and unexpired exp claim).\n */\n get isValid(): boolean {\n return !isTokenExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: Record|Admin|null): void {\n this.baseToken = token || '';\n\n // normalize the model instance\n if (model !== null && typeof model === 'object') {\n this.baseModel = typeof (model as any).collectionId !== 'undefined' ?\n new Record(model) : new Admin(model);\n } else {\n this.baseModel = null;\n }\n\n this.triggerChange();\n }\n\n /**\n * Removes the stored token and model data form the auth store.\n */\n clear(): void {\n this.baseToken = '';\n this.baseModel = null;\n this.triggerChange();\n }\n\n /**\n * Parses the provided cookie string and updates the store state\n * with the cookie's token and model data.\n *\n * NB! This function doesn't validate the token or its data.\n * Usually this isn't a concern if you are interacting only with the\n * PocketBase API because it has the proper server-side security checks in place,\n * but if you are using the store `isValid` state for permission controls\n * in a node server (eg. SSR), then it is recommended to call `authRefresh()`\n * after loading the cookie to ensure an up-to-date token and model state.\n * For example:\n *\n * ```js\n * pb.authStore.loadFromCookie(\"cookie string...\");\n *\n * try {\n * // get an up-to-date auth store state by veryfing and refreshing the loaded auth model (if any)\n * pb.authStore.isValid && await pb.collection('users').authRefresh();\n * } catch (_) {\n * // clear the auth store on failed refresh\n * pb.authStore.clear();\n * }\n * ```\n */\n loadFromCookie(cookie: string, key = defaultCookieKey): void {\n const rawData = cookieParse(cookie || '')[key] || '';\n\n let data: { [key: string]: any } = {};\n try {\n data = JSON.parse(rawData);\n // normalize\n if (typeof data === null || typeof data !== 'object' || Array.isArray(data)) {\n data = {};\n }\n } catch (_) {}\n\n this.save(data.token || '', data.model || null);\n }\n\n /**\n * Exports the current store state as cookie string.\n *\n * By default the following optional attributes are added:\n * - Secure\n * - HttpOnly\n * - SameSite=Strict\n * - Path=/\n * - Expires={the token expiration date}\n *\n * NB! If the generated cookie exceeds 4096 bytes, this method will\n * strip the model data to the bare minimum to try to fit within the\n * recommended size in https://www.rfc-editor.org/rfc/rfc6265#section-6.1.\n */\n exportToCookie(options?: SerializeOptions, key = defaultCookieKey): string {\n const defaultOptions: SerializeOptions = {\n secure: true,\n sameSite: true,\n httpOnly: true,\n path: \"/\",\n };\n\n // extract the token expiration date\n const payload = getTokenPayload(this.token);\n if (payload?.exp) {\n defaultOptions.expires = new Date(payload.exp * 1000);\n } else {\n defaultOptions.expires = new Date('1970-01-01');\n }\n\n // merge with the user defined options\n options = Object.assign({}, defaultOptions, options);\n\n const rawData = {\n token: this.token,\n model: this.model?.export() || null,\n };\n\n let result = cookieSerialize(key, JSON.stringify(rawData), options);\n\n const resultLength = typeof Blob !== 'undefined' ?\n (new Blob([result])).size : result.length;\n\n // strip down the model data to the bare minimum\n if (rawData.model && resultLength > 4096) {\n rawData.model = {id: rawData?.model?.id, email: rawData?.model?.email};\n if (this.model instanceof Record) {\n rawData.model.username = this.model.username;\n rawData.model.verified = this.model.verified;\n rawData.model.collectionId = this.model.collectionId;\n }\n result = cookieSerialize(key, JSON.stringify(rawData), options);\n }\n\n return result;\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * You can set the `fireImmediately` argument to true in order to invoke\n * the provided callback right after registration.\n *\n * Returns a removal function that you could call to \"unsubscribe\" from the changes.\n */\n onChange(callback: OnStoreChangeFunc, fireImmediately = false): () => void {\n this._onChangeCallbacks.push(callback);\n\n if (fireImmediately) {\n callback(this.token, this.model);\n }\n\n return () => {\n for (let i = this._onChangeCallbacks.length - 1; i >= 0; i--) {\n if (this._onChangeCallbacks[i] == callback) {\n delete this._onChangeCallbacks[i]; // removes the function reference\n this._onChangeCallbacks.splice(i, 1); // reindex the array\n return;\n }\n }\n }\n }\n\n protected triggerChange(): void {\n for (const callback of this._onChangeCallbacks) {\n callback && callback(this.token, this.model);\n }\n }\n}\n","import BaseAuthStore from '@/stores/BaseAuthStore';\nimport Record from '@/models/Record';\nimport Admin from '@/models/Admin';\n\n/**\n * The default token store for browsers with auto fallback\n * to runtime/memory if local storage is undefined (eg. in node env).\n */\nexport default class LocalAuthStore extends BaseAuthStore {\n private storageFallback: { [key: string]: any } = {};\n private storageKey: string\n\n constructor(storageKey = \"pocketbase_auth\") {\n super();\n\n this.storageKey = storageKey;\n }\n\n /**\n * @inheritdoc\n */\n get token(): string {\n const data = this._storageGet(this.storageKey) || {};\n\n return data.token || '';\n }\n\n /**\n * @inheritdoc\n */\n get model(): Record|Admin|null {\n const data = this._storageGet(this.storageKey) || {};\n\n if (\n data === null ||\n typeof data !== 'object' ||\n data.model === null ||\n typeof data.model !== 'object'\n ) {\n return null;\n }\n\n // admins don't have `collectionId` prop\n if (typeof data.model?.collectionId === 'undefined') {\n return new Admin(data.model);\n }\n\n return new Record(data.model);\n }\n\n /**\n * @inheritdoc\n */\n save(token: string, model: Record|Admin|null) {\n this._storageSet(this.storageKey, {\n 'token': token,\n 'model': model,\n });\n\n super.save(token, model);\n }\n\n /**\n * @inheritdoc\n */\n clear() {\n this._storageRemove(this.storageKey);\n\n super.clear();\n }\n\n // ---------------------------------------------------------------\n // Internal helpers:\n // ---------------------------------------------------------------\n\n /**\n * Retrieves `key` from the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageGet(key: string): any {\n if (typeof window !== 'undefined' && window?.localStorage) {\n const rawValue = window.localStorage.getItem(key) || '';\n try {\n return JSON.parse(rawValue);\n } catch (e) { // not a json\n return rawValue;\n }\n }\n\n // fallback\n return this.storageFallback[key];\n }\n\n /**\n * Stores a new data in the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageSet(key: string, value: any) {\n if (typeof window !== 'undefined' && window?.localStorage) {\n // store in local storage\n let normalizedVal = value;\n if (typeof value !== 'string') {\n normalizedVal = JSON.stringify(value);\n }\n window.localStorage.setItem(key, normalizedVal);\n } else {\n // store in fallback\n this.storageFallback[key] = value;\n }\n }\n\n /**\n * Removes `key` from the browser's local storage and the runtime/memory.\n */\n private _storageRemove(key: string) {\n // delete from local storage\n if (typeof window !== 'undefined' && window?.localStorage) {\n window.localStorage?.removeItem(key);\n }\n\n // delete from fallback\n delete this.storageFallback[key];\n }\n}\n","import Client from '@/Client';\n\n/**\n * BaseService class that should be inherited from all API services.\n */\nexport default abstract class BaseService {\n readonly client: Client\n\n constructor(client: Client) {\n this.client = client;\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\ninterface appleClientSecret {\n secret: string;\n}\n\nexport default class SettingsService extends BaseService {\n /**\n * Fetch all available app settings.\n */\n getAll(queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Bulk updates app settings.\n */\n update(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Performs a S3 filesystem connection test.\n *\n * The currently supported `filesystem` are \"storage\" and \"backups\".\n */\n testS3(filesystem: string = \"storage\", queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'filesystem': filesystem,\n };\n\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends a test email.\n *\n * The possible `emailTemplate` values are:\n * - verification\n * - password-reset\n * - email-change\n */\n testEmail(toEmail: string, emailTemplate: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'email': toEmail,\n 'template': emailTemplate,\n };\n\n return this.client.send('/api/settings/test/email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Generates a new Apple OAuth2 client secret.\n */\n generateAppleClientSecret(\n clientId: string,\n teamId: string,\n keyId: string,\n privateKey: string,\n duration: number,\n bodyParams = {},\n queryParams: BaseQueryParams = {}\n ): Promise {\n bodyParams = Object.assign({\n clientId,\n teamId,\n keyId,\n privateKey,\n duration,\n }, bodyParams);\n\n return this.client.send('/api/settings/apple/generate-client-secret', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n });\n }\n}\n","import BaseModel from './BaseModel';\n\nexport default class ListResult {\n page!: number;\n perPage!: number;\n totalItems!: number;\n totalPages!: number;\n items!: Array;\n\n constructor(\n page: number,\n perPage: number,\n totalItems: number,\n totalPages: number,\n items: Array,\n ) {\n this.page = page > 0 ? page : 1;\n this.perPage = perPage >= 0 ? perPage : 0;\n this.totalItems = totalItems >= 0 ? totalItems : 0;\n this.totalPages = totalPages >= 0 ? totalPages : 0;\n this.items = items || [];\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\nimport {\n BaseQueryParams,\n ListQueryParams\n} from '@/services/utils/QueryParams';\n\n// @todo since there is no longer need of SubCrudService consider merging with CrudService in v0.9+\nexport default abstract class BaseCrudService extends BaseService {\n /**\n * Response data decoder.\n */\n abstract decode(data: { [key: string]: any }): M\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n protected _getFullList(basePath: string, batchSize = 200, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize || 200, queryParams).then((list) => {\n const castedList = (list as any as ListResult);\n const items = castedList.items;\n const totalItems = castedList.totalItems;\n\n result = result.concat(items);\n\n if (items.length && totalItems > result.length) {\n return request(page + 1);\n }\n\n return result;\n });\n }\n\n return request(1);\n }\n\n /**\n * Returns paginated items list.\n */\n protected _getList(basePath: string, page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send(basePath, {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData.items || [];\n for (const item of responseData.items) {\n items.push(this.decode(item) as any as T);\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns single item by its id.\n */\n protected _getOne(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Returns the first found item by a list filter.\n *\n * Internally it calls `_getList(basePath, 1, 1, { filter })` and returns its\n * first item.\n *\n * For consistency with `_getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n protected _getFirstListItem(basePath: string, filter: string, queryParams: BaseQueryParams = {}): Promise {\n queryParams = Object.assign({\n 'filter': filter,\n '$cancelKey': 'one_by_filter_' + basePath + \"_\" + filter,\n }, queryParams);\n\n return this._getList(basePath, 1, 1, queryParams)\n .then((result) => {\n if (!result?.items?.length) {\n throw new ClientResponseError({\n status: 404,\n data: {\n code: 404,\n message: \"The requested resource wasn't found.\",\n data: {},\n },\n });\n }\n\n return result.items[0];\n });\n }\n\n /**\n * Creates a new item.\n */\n protected _create(basePath: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath, {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Updates an existing item by its id.\n */\n protected _update(basePath: string, id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData) as any as T);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n protected _delete(basePath: string, id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n}\n","import ListResult from '@/models/utils/ListResult';\nimport BaseModel from '@/models/utils/BaseModel';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n FullListQueryParams\n} from '@/services/utils/QueryParams';\n\nexport default abstract class CrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/admins').\n */\n abstract get baseCrudPath(): string\n\n /**\n * Returns a promise with all list items batch fetched at once\n * (by default 200 items per request; to change it set the `batch` query param).\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(queryParams?: FullListQueryParams): Promise>\n\n /**\n * Legacy version of getFullList with explicitly specified batch size.\n */\n getFullList(batch?: number, queryParams?: ListQueryParams): Promise>\n\n getFullList(batchOrqueryParams?: number|FullListQueryParams, queryParams?: ListQueryParams): Promise> {\n if (typeof batchOrqueryParams == \"number\") {\n return this._getFullList(this.baseCrudPath, batchOrqueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrqueryParams, queryParams);\n\n return this._getFullList(this.baseCrudPath, params.batch || 200, params);\n }\n\n /**\n * Returns paginated items list.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n return this._getList(this.baseCrudPath, page, perPage, queryParams);\n }\n\n /**\n * Returns the first found item by the specified filter.\n *\n * Internally it calls `getList(1, 1, { filter })` and returns the\n * first found item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n *\n * For consistency with `getOne`, this method will throw a 404\n * ClientResponseError if no item was found.\n */\n getFirstListItem(filter: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getFirstListItem(this.baseCrudPath, filter, queryParams);\n }\n\n /**\n * Returns single item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getOne(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._getOne(this.baseCrudPath, id, queryParams);\n }\n\n /**\n * Creates a new item.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n create(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._create(this.baseCrudPath, bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this._update(this.baseCrudPath, id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this._delete(this.baseCrudPath, id, queryParams);\n }\n}\n","import Admin from '@/models/Admin';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface AdminAuthResponse {\n [key: string]: any;\n\n token: string;\n admin: Admin;\n}\n\nexport default class AdminService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Admin {\n return new Admin(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/admins';\n }\n\n // ---------------------------------------------------------------\n // Post update/delete AuthStore sync\n // ---------------------------------------------------------------\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n // update the store state if the updated item id matches with the stored model\n if (\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === item?.id\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n // clear the store state if the deleted item id matches with the stored model\n if (\n success &&\n this.client.authStore.model &&\n typeof this.client.authStore.model?.collectionId === 'undefined' && // is not record auth\n this.client.authStore.model?.id === id\n ) {\n this.client.authStore.clear();\n }\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful authorize response.\n */\n protected authResponse(responseData: any): AdminAuthResponse {\n const admin = this.decode(responseData?.admin || {});\n\n if (responseData?.token && responseData?.admin) {\n this.client.authStore.save(responseData.token, admin);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'admin': admin,\n });\n }\n\n /**\n * Authenticate an admin account with its email and password\n * and returns a new admin token and data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authWithPassword(\n email: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'identity': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Refreshes the current admin authenticated instance and\n * returns a new token and admin data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authRefresh(bodyParams = {}, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCrudPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends admin password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms admin password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class ExternalAuth extends BaseModel {\n recordId!: string;\n collectionId!: string;\n provider!: string;\n providerId!: string;\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.recordId = typeof data.recordId === 'string' ? data.recordId : '';\n this.collectionId = typeof data.collectionId === 'string' ? data.collectionId : '';\n this.provider = typeof data.provider === 'string' ? data.provider : '';\n this.providerId = typeof data.providerId === 'string' ? data.providerId : '';\n }\n}\n","import Client from '@/Client';\nimport ClientResponseError from '@/ClientResponseError';\nimport Record from '@/models/Record';\nimport ExternalAuth from '@/models/ExternalAuth';\nimport ListResult from '@/models/utils/ListResult';\nimport CrudService from '@/services/utils/CrudService';\nimport { UnsubscribeFunc } from '@/services/RealtimeService';\nimport {\n BaseQueryParams,\n RecordQueryParams,\n RecordListQueryParams,\n RecordFullListQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface RecordAuthResponse {\n record: T;\n token: string;\n meta?: {[key: string]: any};\n}\n\nexport interface AuthProviderInfo {\n name: string;\n state: string;\n codeVerifier: string;\n codeChallenge: string;\n codeChallengeMethod: string;\n authUrl: string;\n}\n\nexport interface AuthMethodsList {\n usernamePassword: boolean;\n emailPassword: boolean;\n authProviders: Array;\n}\n\nexport interface RecordSubscription {\n action: string; // eg. create, update, delete\n record: T;\n}\n\nexport type OAuth2UrlCallback = (url: string) => void|Promise;\n\nexport interface OAuth2AuthConfig {\n // the name of the OAuth2 provider (eg. \"google\")\n provider: string;\n\n // custom scopes to overwrite the default ones\n scopes?: Array;\n\n // optional record create data\n createData?: {[key: string]: any};\n\n // optional callback that is triggered after the OAuth2 sign-in/sign-up url generation\n urlCallback?: OAuth2UrlCallback;\n\n // optional query params to send with the PocketBase auth request (eg. fields, expand, etc.)\n query?: RecordQueryParams;\n\n // optional body params to send with the PocketBase auth request\n body?: {[key: string]: any};\n}\n\nexport default class RecordService extends CrudService {\n readonly collectionIdOrName: string;\n\n constructor(client: Client, collectionIdOrName: string) {\n super(client);\n\n this.collectionIdOrName = collectionIdOrName;\n }\n\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): T {\n return new Record(data) as any as T;\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return this.baseCollectionPath + '/records';\n }\n\n /**\n * Returns the current collection service base path.\n */\n get baseCollectionPath(): string {\n return '/api/collections/' + encodeURIComponent(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Realtime handlers\n // ---------------------------------------------------------------\n\n /**\n * @deprecated Use subscribe(recordId, callback) instead.\n *\n * Subscribe to the realtime changes of a single record in the collection.\n */\n async subscribeOne(recordId: string, callback: (data: RecordSubscription) => void): Promise {\n console.warn(\"PocketBase: subscribeOne(recordId, callback) is deprecated. Please replace it with subscribe(recordId, callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName + \"/\" + recordId, callback);\n }\n\n /**\n * @deprecated This form of subscribe is deprecated. Please use `subscribe(\"*\", callback)`.\n */\n async subscribe(callback: (data: RecordSubscription) => void): Promise\n\n /**\n * Subscribe to realtime changes to the specified topic (\"*\" or record id).\n *\n * If `topic` is the wildcard \"*\", then this method will subscribe to\n * any record changes in the collection.\n *\n * If `topic` is a record id, then this method will subscribe only\n * to changes of the specified record id.\n *\n * It's OK to subscribe multiple times to the same topic.\n * You can use the returned `UnsubscribeFunc` to remove only a single subscription.\n * Or use `unsubscribe(topic)` if you want to remove all subscriptions attached to the topic.\n */\n async subscribe(topic: string, callback: (data: RecordSubscription) => void): Promise\n\n async subscribe(\n topicOrCallback: string|((data: RecordSubscription) => void),\n callback?: (data: RecordSubscription) => void\n ): Promise {\n if (typeof topicOrCallback === 'function') {\n console.warn(\"PocketBase: subscribe(callback) is deprecated. Please replace it with subscribe('*', callback).\");\n return this.client.realtime.subscribe(this.collectionIdOrName, topicOrCallback);\n }\n\n if (!callback) {\n throw new Error(\"Missing subscription callback.\");\n }\n\n if (topicOrCallback === \"\") {\n throw new Error(\"Missing topic.\");\n }\n\n let topic = this.collectionIdOrName;\n if (topicOrCallback !== \"*\") {\n topic += ('/' + topicOrCallback);\n }\n\n return this.client.realtime.subscribe(topic, callback)\n }\n\n /**\n * Unsubscribe from all subscriptions of the specified topic\n * (\"*\" or record id).\n *\n * If `topic` is not set, then this method will unsubscribe from\n * all subscriptions associated to the current collection.\n */\n async unsubscribe(topic?: string): Promise {\n // unsubscribe wildcard topic\n if (topic === \"*\") {\n return this.client.realtime.unsubscribe(this.collectionIdOrName);\n }\n\n // unsubscribe recordId topic\n if (topic) {\n return this.client.realtime.unsubscribe(this.collectionIdOrName + \"/\" + topic);\n }\n\n // unsubscribe from everything related to the collection\n return this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName);\n }\n\n // ---------------------------------------------------------------\n // Crud handers\n // ---------------------------------------------------------------\n /**\n * @inheritdoc\n */\n getFullList(queryParams?: RecordFullListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batch?: number, queryParams?: RecordListQueryParams): Promise>\n\n /**\n * @inheritdoc\n */\n getFullList(batchOrQueryParams?: number|RecordFullListQueryParams, queryParams?: RecordListQueryParams): Promise> {\n if (typeof batchOrQueryParams == \"number\") {\n return super.getFullList(batchOrQueryParams, queryParams);\n }\n\n const params = Object.assign({}, batchOrQueryParams, queryParams);\n\n return super.getFullList(params);\n }\n\n /**\n * @inheritdoc\n */\n getList(page = 1, perPage = 30, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getList(page, perPage, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getFirstListItem(filter: string, queryParams: RecordListQueryParams = {}): Promise {\n return super.getFirstListItem(filter, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n getOne(id: string, queryParams: RecordQueryParams = {}): Promise {\n return super.getOne(id, queryParams);\n }\n\n /**\n * @inheritdoc\n */\n create(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.create(bodyParams, queryParams);\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the updated id, then\n * on success the `client.authStore.model` will be updated with the result.\n */\n update(id: string, bodyParams = {}, queryParams: RecordQueryParams = {}): Promise {\n return super.update(id, bodyParams, queryParams).then((item) => {\n if (\n // is record auth\n this.client.authStore.model?.id === item?.id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.save(this.client.authStore.token, item);\n }\n\n return item as any as T;\n });\n }\n\n /**\n * @inheritdoc\n *\n * If the current `client.authStore.model` matches with the deleted id,\n * then on success the `client.authStore` will be cleared.\n */\n delete(id: string, queryParams: BaseQueryParams = {}): Promise {\n return super.delete(id, queryParams).then((success) => {\n if (\n success &&\n // is record auth\n this.client.authStore.model?.id === id &&\n (\n this.client.authStore.model?.collectionId === this.collectionIdOrName ||\n this.client.authStore.model?.collectionName === this.collectionIdOrName\n )\n ) {\n this.client.authStore.clear();\n }\n\n return success;\n });\n }\n\n // ---------------------------------------------------------------\n // Auth handlers\n // ---------------------------------------------------------------\n\n /**\n * Prepare successful collection authorization response.\n */\n protected authResponse(responseData: any): RecordAuthResponse {\n const record = this.decode(responseData?.record || {});\n\n this.client.authStore.save(responseData?.token, record);\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'record': record as any as T,\n });\n }\n\n /**\n * Returns all available collection auth methods.\n */\n listAuthMethods(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(this.baseCollectionPath + '/auth-methods', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n return Object.assign({}, responseData, {\n // normalize common fields\n 'usernamePassword': !!responseData?.usernamePassword,\n 'emailPassword': !!responseData?.emailPassword,\n 'authProviders': Array.isArray(responseData?.authProviders) ? responseData?.authProviders : [],\n });\n });\n }\n\n /**\n * Authenticate a single auth collection record via its username/email and password.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n */\n authWithPassword(\n usernameOrEmail: string,\n password: string,\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'identity': usernameOrEmail,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-password', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2 code.\n *\n * If you don't have an OAuth2 code you may also want to check `authWithOAuth2` method.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n */\n authWithOAuth2Code(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData = {},\n bodyParams = {},\n queryParams: RecordQueryParams = {},\n ): Promise> {\n bodyParams = Object.assign({\n 'provider': provider,\n 'code': code,\n 'codeVerifier': codeVerifier,\n 'redirectUrl': redirectUrl,\n 'createData': createData,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/auth-with-oauth2', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * @deprecated This form of authWithOAuth2 is deprecated.\n *\n * Please use `authWithOAuth2Code()` OR its simplified realtime version\n * as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\n */\n async authWithOAuth2(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n createData?: {[key: string]: any},\n bodyParams?: {[key: string]: any},\n queryParams?: RecordQueryParams,\n ): Promise>\n\n /**\n * Authenticate a single auth collection record with OAuth2\n * **without custom redirects, deeplinks or even page reload**.\n *\n * This method initializes a one-off realtime subscription and will\n * open a popup window with the OAuth2 vendor page to authenticate.\n * Once the external OAuth2 sign-in/sign-up flow is completed, the popup\n * window will be automatically closed and the OAuth2 data sent back\n * to the user through the previously established realtime connection.\n *\n * You can specify an optional `urlCallback` prop to customize\n * the default url `window.open` behavior.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - the authentication token\n * - the authenticated record model\n * - the OAuth2 account data (eg. name, email, avatar, etc.)\n *\n * Example:\n *\n * ```js\n * const authData = await pb.collection(\"users\").authWithOAuth2({\n * provider: \"google\",\n * })\n * ```\n *\n * _Site-note_: when creating the OAuth2 app in the provider dashboard\n * you have to configure `https://yourdomain.com/api/oauth2-redirect`\n * as redirect URL.\n */\n async authWithOAuth2(options: OAuth2AuthConfig): Promise>\n\n async authWithOAuth2(...args: any): Promise> {\n // fallback to legacy format\n if (args.length > 1 || typeof args?.[0] === 'string') {\n console.warn(\"PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration.\");\n return this.authWithOAuth2Code(\n args?.[0] || '',\n args?.[1] || '',\n args?.[2] || '',\n args?.[3] || '',\n args?.[4] || {},\n args?.[5] || {},\n args?.[6] || {},\n );\n }\n\n const config = args?.[0] || {};\n\n const authMethods = await this.listAuthMethods();\n\n const provider = authMethods.authProviders.find((p) => p.name === config.provider);\n if (!provider) {\n throw new ClientResponseError(new Error(`Missing or invalid provider \"${config.provider}\".`));\n }\n\n const redirectUrl = this.client.buildUrl('/api/oauth2-redirect');\n\n return new Promise(async (resolve, reject) => {\n try {\n // initialize a one-off @oauth2 realtime subscription\n const unsubscribe = await this.client.realtime.subscribe('@oauth2', async (e) => {\n const oldState = this.client.realtime.clientId;\n\n try {\n unsubscribe();\n\n if (!e.state || oldState !== e.state) {\n throw new Error(\"State parameters don't match.\");\n }\n\n const authData = await this.authWithOAuth2Code(\n provider.name,\n e.code,\n provider.codeVerifier,\n redirectUrl,\n config.createData,\n config.body,\n config.query,\n )\n\n resolve(authData);\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n\n const url = new URL(provider.authUrl + redirectUrl);\n url.searchParams.set(\"state\", this.client.realtime.clientId);\n if (config.scopes?.length) {\n url.searchParams.set(\"scope\", config.scopes.join(\" \"));\n }\n\n await (config.urlCallback ? config.urlCallback(url.toString()) : this._defaultUrlCallback(url.toString()));\n } catch (err) {\n reject(new ClientResponseError(err));\n }\n });\n }\n\n /**\n * Refreshes the current authenticated record instance and\n * returns a new token and record data.\n *\n * On success this method also automatically updates the client's AuthStore.\n */\n authRefresh(bodyParams = {}, queryParams: RecordQueryParams = {}): Promise> {\n return this.client.send(this.baseCollectionPath + '/auth-refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Sends auth record password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends auth record verification email request.\n */\n requestVerification(\n email: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record email verification request.\n */\n confirmVerification(\n verificationToken: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': verificationToken,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Sends an email change request to the authenticated record model.\n */\n requestEmailChange(\n newEmail: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'newEmail': newEmail,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/request-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms auth record's new email address.\n */\n confirmEmailChange(\n emailChangeToken: string,\n password: string,\n bodyParams = {},\n queryParams: BaseQueryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': emailChangeToken,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCollectionPath + '/confirm-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Lists all linked external auth providers for the specified auth record.\n */\n listExternalAuths(\n recordId: string,\n queryParams: BaseQueryParams = {}\n ): Promise> {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => {\n const items: Array = [];\n\n if (Array.isArray(responseData)) {\n for (const item of responseData) {\n items.push(new ExternalAuth(item));\n }\n }\n\n return items;\n });\n }\n\n /**\n * Unlink a single external auth provider from the specified auth record.\n */\n unlinkExternalAuth(\n recordId: string,\n provider: string,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/' + encodeURIComponent(recordId) + '/external-auths/' + encodeURIComponent(provider), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n // ---------------------------------------------------------------\n\n private _defaultUrlCallback(url: string) {\n if (typeof window === \"undefined\" || !window?.open) {\n throw new ClientResponseError(new Error(`Not in a browser context - please pass a custom urlCallback function.`));\n }\n\n let width = 1024;\n let height = 768;\n\n let windowWidth = window.innerWidth;\n let windowHeight = window.innerHeight;\n\n // normalize window size\n width = width > windowWidth ? windowWidth : width;\n height = height > windowHeight ? windowHeight : height;\n\n let left = (windowWidth / 2) - (width / 2);\n let top = (windowHeight / 2) - (height / 2);\n\n window.open(\n url,\n \"oauth2-popup\",\n 'width='+width+',height='+height+',top='+top+',left='+left+',resizable,menubar=no'\n );\n }\n}\n","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.name = typeof data.name !== 'undefined' ? data.name : '';\n this.type = typeof data.type !== 'undefined' ? data.type : 'text';\n this.system = !!data.system;\n this.required = !!data.required;\n this.options = typeof data.options === 'object' && data.options !== null ? data.options : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport SchemaField from '@/models/utils/SchemaField';\n\nexport default class Collection extends BaseModel {\n name!: string;\n type!: string;\n schema!: Array;\n indexes!: Array;\n system!: boolean;\n listRule!: null|string;\n viewRule!: null|string;\n createRule!: null|string;\n updateRule!: null|string;\n deleteRule!: null|string;\n options!: {[key:string]: any};\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n this.system = !!data.system;\n this.name = typeof data.name === 'string' ? data.name : '';\n this.type = typeof data.type === 'string' ? data.type : 'base';\n this.options = typeof data.options !== 'undefined' && data.options !== null ? data.options : {};\n this.indexes = Array.isArray(data.indexes) ? data.indexes : [];\n\n // rules\n this.listRule = typeof data.listRule === 'string' ? data.listRule : null;\n this.viewRule = typeof data.viewRule === 'string' ? data.viewRule : null;\n this.createRule = typeof data.createRule === 'string' ? data.createRule : null;\n this.updateRule = typeof data.updateRule === 'string' ? data.updateRule : null;\n this.deleteRule = typeof data.deleteRule === 'string' ? data.deleteRule : null;\n\n // schema\n data.schema = Array.isArray(data.schema) ? data.schema : [];\n this.schema = [];\n for (let field of data.schema) {\n this.schema.push(new SchemaField(field));\n }\n }\n\n /**\n * @deprecated Please use $isBase instead.\n */\n get isBase(): boolean {\n return this.$isBase;\n }\n\n /**\n * Checks if the current model is \"base\" collection.\n */\n get $isBase(): boolean {\n return this.type === 'base';\n }\n\n /**\n * @deprecated Please use $isAuth instead.\n */\n get isAuth(): boolean {\n return this.$isAuth;\n }\n\n /**\n * Checks if the current model is \"auth\" collection.\n */\n get $isAuth(): boolean {\n return this.type === 'auth';\n }\n\n /**\n * @deprecated Please use $isView instead.\n */\n get isView(): boolean {\n return this.$isView;\n }\n\n /**\n * Checks if the current model is \"view\" collection.\n */\n get $isView(): boolean {\n return this.type === 'view';\n }\n}\n","import Collection from '@/models/Collection';\nimport CrudService from '@/services/utils/CrudService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport default class CollectionService extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Collection {\n return new Collection(data);\n }\n\n /**\n * @inheritdoc\n */\n get baseCrudPath(): string {\n return '/api/collections';\n }\n\n /**\n * Imports the provided collections.\n *\n * If `deleteMissing` is `true`, all local collections and schema fields,\n * that are not present in the imported configuration, WILL BE DELETED\n * (including their related records data)!\n */\n async import(\n collections: Array,\n deleteMissing: boolean = false,\n queryParams: BaseQueryParams = {}\n ): Promise {\n return this.client.send(this.baseCrudPath + '/import', {\n 'method': 'PUT',\n 'params': queryParams,\n 'body': {\n 'collections': collections,\n 'deleteMissing': deleteMissing,\n }\n }).then(() => true);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class LogRequest extends BaseModel {\n url!: string;\n method!: string;\n status!: number;\n auth!: string;\n remoteIp!: string;\n userIp!: string;\n referer!: string;\n userAgent!: string;\n meta!: { [key: string]: any };\n\n /**\n * @inheritdoc\n */\n $load(data: { [key: string]: any }) {\n super.$load(data);\n\n // fallback to the ip field for backward compatibility\n data.remoteIp = data.remoteIp || data.ip;\n\n this.url = typeof data.url === 'string' ? data.url : '';\n this.method = typeof data.method === 'string' ? data.method : 'GET';\n this.status = typeof data.status === 'number' ? data.status : 200;\n this.auth = typeof data.auth === 'string' ? data.auth : 'guest';\n this.remoteIp = typeof data.remoteIp === 'string' ? data.remoteIp : '';\n this.userIp = typeof data.userIp === 'string' ? data.userIp : '';\n this.referer = typeof data.referer === 'string' ? data.referer : '';\n this.userAgent = typeof data.userAgent === 'string' ? data.userAgent : '';\n this.meta = typeof data.meta === 'object' && data.meta !== null ? data.meta : {};\n }\n}\n","import LogRequest from '@/models/LogRequest';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\nimport {\n BaseQueryParams,\n ListQueryParams,\n LogStatsQueryParams,\n} from '@/services/utils/QueryParams';\n\nexport interface HourlyStats {\n total: number;\n date: string;\n}\n\nexport default class LogService extends BaseService {\n /**\n * Returns paginated logged requests list.\n */\n getRequestsList(page = 1, perPage = 30, queryParams: ListQueryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send('/api/logs/requests', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData?.items || [];\n for (const item of responseData.items) {\n items.push(new LogRequest(item));\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns a single logged request by its id.\n */\n getRequest(id: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/logs/requests/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => new LogRequest(responseData));\n }\n\n /**\n * Returns request logs statistics.\n */\n getRequestsStats(queryParams: LogStatsQueryParams = {}): Promise> {\n return this.client.send('/api/logs/requests/stats', {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => responseData);\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport ClientResponseError from '@/ClientResponseError';\n\ninterface promiseCallbacks {\n resolve: Function\n reject: Function\n}\n\nexport type UnsubscribeFunc = () => Promise;\n\nexport default class RealtimeService extends BaseService {\n clientId: string = \"\";\n\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 15000;\n private reconnectTimeoutId: any;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number = Infinity;\n private predefinedReconnectIntervals: Array = [\n 200, 300, 500, 1000, 1200, 1500, 2000,\n ];\n private pendingConnects: Array = [];\n\n\n /**\n * Returns whether the realtime connection has been established.\n */\n get isConnected(): boolean {\n return !!this.eventSource && !!this.clientId && !this.pendingConnects.length;\n }\n\n /**\n * Register the subscription listener.\n *\n * You can subscribe multiple times to the same topic.\n *\n * If the SSE connection is not started yet,\n * this method will also initialize it.\n */\n async subscribe(topic: string, callback: (data: any) => void): Promise {\n if (!topic) {\n throw new Error('topic must be set.')\n }\n\n const listener = function (e: Event) {\n const msgEvent = (e as MessageEvent);\n\n let data;\n try {\n data = JSON.parse(msgEvent?.data);\n } catch {}\n\n callback(data || {});\n };\n\n // store the listener\n if (!this.subscriptions[topic]) {\n this.subscriptions[topic] = [];\n }\n this.subscriptions[topic].push(listener);\n\n if (!this.isConnected) {\n // initialize sse connection\n await this.connect();\n } else if (this.subscriptions[topic].length === 1) {\n // send the updated subscriptions (if it is the first for the topic)\n await this.submitSubscriptions();\n } else {\n // only register the listener\n this.eventSource?.addEventListener(topic, listener);\n }\n\n return async (): Promise => {\n return this.unsubscribeByTopicAndListener(topic, listener);\n };\n }\n\n /**\n * Unsubscribe from all subscription listeners with the specified topic.\n *\n * If `topic` is not provided, then this method will unsubscribe\n * from all active subscriptions.\n *\n * This method is no-op if there are no active subscriptions.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribe(topic?: string): Promise {\n if (!this.hasSubscriptionListeners(topic)) {\n return; // already unsubscribed\n }\n\n if (!topic) {\n // remove all subscriptions\n this.subscriptions = {};\n } else {\n // remove all topic listeners\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n /**\n * Unsubscribe from all subscription listeners starting with the specified topic prefix.\n *\n * This method is no-op if there are no active subscriptions with the specified topic prefix.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByPrefix(topicPrefix: string): Promise {\n let hasAtleastOneTopic = false;\n for (let topic in this.subscriptions) {\n if (!topic.startsWith(topicPrefix)) {\n continue;\n }\n\n hasAtleastOneTopic = true;\n for (let listener of this.subscriptions[topic]) {\n this.eventSource?.removeEventListener(topic, listener);\n }\n delete this.subscriptions[topic];\n }\n\n if (!hasAtleastOneTopic) {\n return; // nothing to unsubscribe from\n }\n\n if (this.hasSubscriptionListeners()) {\n // submit the deleted subscriptions\n await this.submitSubscriptions();\n } else {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n }\n }\n\n /**\n * Unsubscribe from all subscriptions matching the specified topic and listener function.\n *\n * This method is no-op if there are no active subscription with\n * the specified topic and listener.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operation there are no active subscriptions left.\n */\n async unsubscribeByTopicAndListener(topic: string, listener: EventListener): Promise {\n if (!Array.isArray(this.subscriptions[topic]) || !this.subscriptions[topic].length) {\n return; // already unsubscribed\n }\n\n let exist = false;\n for (let i = this.subscriptions[topic].length - 1; i >= 0; i--) {\n if (this.subscriptions[topic][i] !== listener) {\n continue;\n }\n\n exist = true; // has at least one matching listener\n delete this.subscriptions[topic][i]; // removes the function reference\n this.subscriptions[topic].splice(i, 1); // reindex the array\n this.eventSource?.removeEventListener(topic, listener);\n }\n if (!exist) {\n return;\n }\n\n // remove the topic from the subscriptions list if there are no other listeners\n if (!this.subscriptions[topic].length) {\n delete this.subscriptions[topic];\n }\n\n if (!this.hasSubscriptionListeners()) {\n // no other active subscriptions -> close the sse connection\n this.disconnect();\n } else if (!this.hasSubscriptionListeners(topic)) {\n // submit subscriptions change if there are no other active subscriptions related to the topic\n await this.submitSubscriptions();\n }\n }\n\n private hasSubscriptionListeners(topicToCheck?: string): boolean {\n this.subscriptions = this.subscriptions || {};\n\n // check the specified topic\n if (topicToCheck) {\n return !!this.subscriptions[topicToCheck]?.length;\n }\n\n // check for at least one non-empty topic\n for (let topic in this.subscriptions) {\n if (!!this.subscriptions[topic]?.length) {\n return true\n }\n }\n\n return false;\n }\n\n private async submitSubscriptions(): Promise {\n if (!this.clientId) {\n return; // no client/subscriber\n }\n\n // optimistic update\n this.addAllSubscriptionListeners();\n\n this.lastSentTopics = this.getNonEmptySubscriptionTopics();\n\n return this.client.send('/api/realtime', {\n 'method': 'POST',\n 'body': {\n 'clientId': this.clientId,\n 'subscriptions': this.lastSentTopics,\n },\n 'params': {\n '$cancelKey': this.getSubscriptionsCancelKey(),\n },\n }).catch((err) => {\n if (err?.isAbort) {\n return; // silently ignore aborted pending requests\n }\n throw err;\n });\n }\n\n private getSubscriptionsCancelKey(): string {\n return \"realtime_\" + this.clientId;\n }\n\n private getNonEmptySubscriptionTopics(): Array {\n const result : Array = [];\n\n for (let topic in this.subscriptions) {\n if (this.subscriptions[topic].length) {\n result.push(topic);\n }\n }\n\n return result;\n }\n\n private addAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n this.removeAllSubscriptionListeners();\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.addEventListener(topic, listener);\n }\n }\n }\n\n private removeAllSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n for (let topic in this.subscriptions) {\n for (let listener of this.subscriptions[topic]) {\n this.eventSource.removeEventListener(topic, listener);\n }\n }\n }\n\n private async connect(): Promise {\n if (this.reconnectAttempts > 0) {\n // immediately resolve the promise to avoid indefinitely\n // blocking the client during reconnection\n return;\n }\n\n return new Promise((resolve, reject) => {\n this.pendingConnects.push({ resolve, reject });\n\n if (this.pendingConnects.length > 1) {\n // all promises will be resolved once the connection is established\n return;\n }\n\n this.initConnect();\n })\n }\n\n private initConnect() {\n this.disconnect(true);\n\n // wait up to 15s for connect\n clearTimeout(this.connectTimeoutId);\n this.connectTimeoutId = setTimeout(() => {\n this.connectErrorHandler(new Error(\"EventSource connect took too long.\"));\n }, this.maxConnectTimeout);\n\n this.eventSource = new EventSource(this.client.buildUrl('/api/realtime'))\n\n this.eventSource.onerror = (_) => {\n this.connectErrorHandler(new Error(\"Failed to establish realtime connection.\"));\n };\n\n this.eventSource.addEventListener('PB_CONNECT', (e) => {\n const msgEvent = (e as MessageEvent);\n this.clientId = msgEvent?.lastEventId;\n\n this.submitSubscriptions()\n .then(async () => {\n let retries = 3;\n while (this.hasUnsentSubscriptions() && retries > 0) {\n retries--;\n // resubscribe to ensure that the latest topics are submitted\n //\n // This is needed because missed topics could happen on reconnect\n // if after the pending sent `submitSubscriptions()` call another `subscribe()`\n // was made before the submit was able to complete.\n await this.submitSubscriptions();\n }\n }).then(() => {\n for (let p of this.pendingConnects) {\n p.resolve();\n }\n\n // reset connect meta\n this.pendingConnects = [];\n this.reconnectAttempts = 0;\n clearTimeout(this.reconnectTimeoutId);\n clearTimeout(this.connectTimeoutId);\n }).catch((err) => {\n this.clientId = \"\";\n this.connectErrorHandler(err);\n });\n });\n }\n\n private hasUnsentSubscriptions(): boolean {\n const latestTopics = this.getNonEmptySubscriptionTopics();\n if (latestTopics.length != this.lastSentTopics.length) {\n return true;\n }\n\n for (const t of latestTopics) {\n if (!this.lastSentTopics.includes(t)) {\n return true;\n }\n }\n\n return false;\n }\n\n private connectErrorHandler(err: any) {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n\n if (\n // wasn't previously connected -> direct reject\n (!this.clientId && !this.reconnectAttempts) ||\n // was previously connected but the max reconnection limit has been reached\n this.reconnectAttempts > this.maxReconnectAttempts\n ) {\n for (let p of this.pendingConnects) {\n p.reject(new ClientResponseError(err));\n }\n this.disconnect();\n return;\n }\n\n // otherwise -> reconnect in the background\n this.disconnect(true);\n const timeout = this.predefinedReconnectIntervals[this.reconnectAttempts] || this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length - 1];\n this.reconnectAttempts++;\n this.reconnectTimeoutId = setTimeout(() => {\n this.initConnect();\n }, timeout);\n }\n\n private disconnect(fromReconnect = false): void {\n clearTimeout(this.connectTimeoutId);\n clearTimeout(this.reconnectTimeoutId);\n this.removeAllSubscriptionListeners();\n this.client.cancelRequest(this.getSubscriptionsCancelKey());\n this.eventSource?.close();\n this.eventSource = null;\n this.clientId = \"\";\n\n if (!fromReconnect) {\n this.reconnectAttempts = 0;\n\n // reject any remaining connect promises\n const err = new ClientResponseError(new Error(\"Realtime disconnected.\"));\n for (let p of this.pendingConnects) {\n p.reject(err);\n }\n this.pendingConnects = [];\n }\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface HealthCheckResponse {\n code: number;\n message: string;\n data: {[key: string]: any};\n}\n\nexport default class HealthService extends BaseService {\n /**\n * Checks the health status of the api.\n */\n check(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/health', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport default class FileService extends BaseService {\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n const parts = [];\n parts.push(\"api\")\n parts.push(\"files\")\n parts.push(encodeURIComponent(record.collectionId || record.collectionName))\n parts.push(encodeURIComponent(record.id))\n parts.push(encodeURIComponent(filename))\n\n let result = this.client.buildUrl(parts.join('/'));\n\n if (Object.keys(queryParams).length) {\n const params = new URLSearchParams(queryParams);\n result += (result.includes(\"?\") ? \"&\" : \"?\") + params;\n }\n\n return result\n }\n\n /**\n * Requests a new private file access token for the current auth model (admin or record).\n */\n getToken(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/files/token', {\n 'method': 'POST',\n 'params': queryParams,\n }).then((data) => data?.token || '');\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport { BaseQueryParams } from '@/services/utils/QueryParams';\n\nexport interface BackupFileInfo {\n key: string;\n size: number;\n modified: string;\n}\n\nexport default class BackupService extends BaseService {\n /**\n * Returns list with all available backup files.\n */\n getFullList(queryParams: BaseQueryParams = {}): Promise> {\n return this.client.send('/api/backups', {\n 'method': 'GET',\n 'params': queryParams,\n });\n }\n\n /**\n * Initializes a new backup.\n */\n create(basename: string, queryParams: BaseQueryParams = {}): Promise {\n const bodyParams = {\n 'name': basename,\n };\n\n return this.client.send('/api/backups', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Deletes a single backup file.\n */\n delete(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}`, {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Initializes an app data restore from an existing backup.\n */\n restore(key: string, queryParams: BaseQueryParams = {}): Promise {\n return this.client.send(`/api/backups/${encodeURIComponent(key)}/restore`, {\n 'method': 'POST',\n 'params': queryParams,\n }).then(() => true);\n }\n\n /**\n * Builds a download url for a single existing backup using an\n * admin file token and the backup file key.\n *\n * The file token can be generated via `pb.files.getToken()`.\n */\n getDownloadUrl(token: string, key: string): string {\n return this.client.buildUrl(`/api/backups/${encodeURIComponent(key)}?token=${encodeURIComponent(token)}`);\n }\n}\n","import ClientResponseError from '@/ClientResponseError';\nimport BaseAuthStore from '@/stores/BaseAuthStore';\nimport LocalAuthStore from '@/stores/LocalAuthStore';\nimport SettingsService from '@/services/SettingsService';\nimport AdminService from '@/services/AdminService';\nimport RecordService from '@/services/RecordService';\nimport CollectionService from '@/services/CollectionService';\nimport LogService from '@/services/LogService';\nimport RealtimeService from '@/services/RealtimeService';\nimport HealthService from '@/services/HealthService';\nimport FileService from '@/services/FileService';\nimport BackupService from '@/services/BackupService';\nimport Record from '@/models/Record';\nimport { BaseQueryParams, FileQueryParams } from '@/services/utils/QueryParams';\n\nexport interface SendOptions extends RequestInit {\n headers?: { [key: string]: string };\n body?: any;\n params?: BaseQueryParams;\n}\n\nexport interface BeforeSendResult {\n [key: string]: any, // for backward compatibility\n url?: string,\n options?: {[key: string]: any}\n}\n\n/**\n * PocketBase JS Client.\n */\nexport default class Client {\n /**\n * The base PocketBase backend url address (eg. 'http://127.0.0.1.8090').\n */\n baseUrl: string;\n\n /**\n * Hook that get triggered right before sending the fetch request,\n * allowing you to inspect and modify the url and request options.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * You can return a non-empty result object `{ url, options }` to replace the url and request options entirely.\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, options) {\n * options.headers = Object.assign({}, options.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return { url, options }\n * };\n * ```\n */\n beforeSend?: (url: string, options: SendOptions) => BeforeSendResult|Promise;\n\n /**\n * Hook that get triggered after successfully sending the fetch request,\n * allowing you to inspect/modify the response object and its parsed data.\n *\n * Returns the new Promise resolved `data` that will be returned to the client.\n *\n * Example:\n * ```js\n * client.afterSend = function (response, data) {\n * if (response.status != 200) {\n * throw new ClientResponseError({\n * url: response.url,\n * status: response.status,\n * data: data,\n * });\n * }\n *\n * return data;\n * };\n * ```\n */\n afterSend?: (response: Response, data: any) => any;\n\n /**\n * Optional language code (default to `en-US`) that will be sent\n * with the requests to the server as `Accept-Language` header.\n */\n lang: string;\n\n /**\n * A replaceable instance of the local auth store service.\n */\n authStore: BaseAuthStore;\n\n /**\n * An instance of the service that handles the **Settings APIs**.\n */\n readonly settings: SettingsService;\n\n /**\n * An instance of the service that handles the **Admin APIs**.\n */\n readonly admins: AdminService;\n\n /**\n * An instance of the service that handles the **Collection APIs**.\n */\n readonly collections: CollectionService;\n\n /**\n * An instance of the service that handles the **File APIs**.\n */\n readonly files: FileService;\n\n /**\n * An instance of the service that handles the **Log APIs**.\n */\n readonly logs: LogService;\n\n /**\n * An instance of the service that handles the **Realtime APIs**.\n */\n readonly realtime: RealtimeService;\n\n /**\n * An instance of the service that handles the **Health APIs**.\n */\n readonly health: HealthService;\n\n /**\n * An instance of the service that handles the **Backup APIs**.\n */\n readonly backups: BackupService;\n\n private cancelControllers: { [key: string]: AbortController } = {};\n private recordServices: { [key: string]: RecordService } = {};\n private enableAutoCancellation: boolean = true;\n\n constructor(\n baseUrl = '/',\n authStore?: BaseAuthStore | null,\n lang = 'en-US',\n ) {\n this.baseUrl = baseUrl;\n this.lang = lang;\n this.authStore = authStore || new LocalAuthStore();\n\n // services\n this.admins = new AdminService(this);\n this.collections = new CollectionService(this);\n this.files = new FileService(this);\n this.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(this);\n this.health = new HealthService(this);\n this.backups = new BackupService(this);\n }\n\n /**\n * Returns the RecordService associated to the specified collection.\n *\n * @param {string} idOrName\n * @return {RecordService}\n */\n collection(idOrName: string): RecordService {\n if (!this.recordServices[idOrName]) {\n this.recordServices[idOrName] = new RecordService(this, idOrName);\n }\n\n return this.recordServices[idOrName];\n }\n\n /**\n * Globally enable or disable auto cancellation for pending duplicated requests.\n */\n autoCancellation(enable: boolean): Client {\n this.enableAutoCancellation = !!enable;\n\n return this;\n }\n\n /**\n * Cancels single request by its cancellation key.\n */\n cancelRequest(cancelKey: string): Client {\n if (this.cancelControllers[cancelKey]) {\n this.cancelControllers[cancelKey].abort();\n delete this.cancelControllers[cancelKey];\n }\n\n return this;\n }\n\n /**\n * Cancels all pending requests.\n */\n cancelAllRequests(): Client {\n for (let k in this.cancelControllers) {\n this.cancelControllers[k].abort();\n }\n\n this.cancelControllers = {};\n\n return this;\n }\n\n /**\n * Sends an api http request.\n */\n async send(path: string, reqOptions: SendOptions): Promise {\n let options = Object.assign({ method: 'GET' } as SendOptions, reqOptions);\n\n // JSON serialize the body if needed and set the correct content type\n // (for FormData body the Content-Type header should be skipped since the boundary is autogenerated)\n if (!this.isFormData(options.body)) {\n if (options.body && typeof options.body !== 'string') {\n options.body = JSON.stringify(options.body);\n }\n\n // add the json header (if not already)\n if (typeof options?.headers?.['Content-Type'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof options?.headers?.['Accept-Language'] === 'undefined') {\n options.headers = Object.assign({}, options.headers, {\n 'Accept-Language': this.lang,\n });\n }\n\n // check if Authorization header can be added\n if (\n // has stored token\n this.authStore?.token &&\n // auth header is not explicitly set\n (typeof options?.headers?.Authorization === 'undefined')\n ) {\n options.headers = Object.assign({}, options.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && options.params?.$autoCancel !== false) {\n const cancelKey = options.params?.$cancelKey || ((options.method || 'GET') + path);\n\n // cancel previous pending requests\n this.cancelRequest(cancelKey);\n\n const controller = new AbortController();\n this.cancelControllers[cancelKey] = controller;\n options.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete options.params?.$autoCancel;\n delete options.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof options.params !== 'undefined') {\n const query = this.serializeQueryParams(options.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete options.params;\n }\n\n if (this.beforeSend) {\n const result = Object.assign({}, await this.beforeSend(url, options));\n if (typeof result.url !== \"undefined\" || typeof result.options !== \"undefined\") {\n url = result.url || url;\n options = result.options || options;\n } else if (Object.keys(result).length) {\n // legacy behavior\n options = result as SendOptions;\n console?.warn && console.warn(\"Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`.\");\n }\n }\n\n // send the request\n return fetch(url, options)\n .then(async (response) => {\n let data : any = {};\n\n try {\n data = await response.json();\n } catch (_) {\n // all api responses are expected to return json\n // with the exception of the realtime event and 204\n }\n\n if (this.afterSend) {\n data = await this.afterSend(response, data);\n }\n\n if (response.status >= 400) {\n throw new ClientResponseError({\n url: response.url,\n status: response.status,\n data: data,\n });\n }\n\n return data as T;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Legacy alias of `pb.files.getUrl()`.\n */\n getFileUrl(\n record: Pick,\n filename: string,\n queryParams: FileQueryParams = {}\n ): string {\n return this.files.getUrl(record, filename, queryParams);\n }\n\n /**\n * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl;\n\n // construct an absolute base url if in a browser environment\n if (\n typeof window !== 'undefined' &&\n !!window.location &&\n !url.startsWith('https://') &&\n !url.startsWith('http://')\n ) {\n url = window.location.origin?.endsWith('/') ?\n window.location.origin.substring(0, window.location.origin.length - 1) :\n (window.location.origin || '');\n\n if (!this.baseUrl.startsWith('/')) {\n url += window.location.pathname || '/';\n url += url.endsWith('/') ? '' : '/';\n }\n\n url += this.baseUrl;\n }\n\n // concatenate the path\n if (path) {\n url += url.endsWith('/') ? '' : '/'; // append trailing slash if missing\n url += path.startsWith('/') ? path.substring(1) : path;\n }\n\n return url;\n }\n\n /**\n * Loosely checks if the specified body is a FormData instance.\n */\n private isFormData(body: any): boolean {\n return body && (\n // we are checking the constructor name because FormData\n // is not available natively in some environments and the\n // polyfill(s) may not be globally accessible\n body.constructor.name === 'FormData' ||\n // fallback to global FormData instance check\n // note: this is needed because the constructor.name could be different in case of\n // custom global FormData implementation, eg. React Native on Android/iOS\n (typeof FormData !== \"undefined\" && body instanceof FormData)\n )\n }\n\n /**\n * Serializes the provided query parameters into a query string.\n */\n private serializeQueryParams(params: {[key: string]: any}): string {\n const result: Array = [];\n for (const key in params) {\n if (params[key] === null) {\n // skip null query params\n continue;\n }\n\n const value = params[key];\n const encodedKey = encodeURIComponent(key);\n\n if (Array.isArray(value)) {\n // \"repeat\" array params\n for (const v of value) {\n result.push(encodedKey + \"=\" + encodeURIComponent(v));\n }\n } else if (value instanceof Date) {\n result.push(encodedKey + \"=\" + encodeURIComponent(value.toISOString()));\n } else if (typeof value !== null && typeof value === 'object') {\n result.push(encodedKey + \"=\" + encodeURIComponent(JSON.stringify(value)));\n } else {\n result.push(encodedKey + \"=\" + encodeURIComponent(value));\n }\n }\n\n return result.join('&');\n }\n}\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__extends","TypeError","String","__","this","constructor","create","__assign","assign","t","s","i","n","arguments","length","apply","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","adopt","then","__generator","body","f","y","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","v","op","pop","push","atobPolyfill","ClientResponseError","_super","errData","_this","url","status","response","isAbort","originalError","data","DOMException","name","message","_a","_d","_c","_b","cause","includes","defineProperty","get","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","isDate","toString","Date","valueOf","toUTCString","httpOnly","secure","priority","toLowerCase","sameSite","defaultDecode","indexOf","decodeURIComponent","encodeURIComponent","getTokenPayload","token","encodedPayload","split","map","c","charCodeAt","slice","join","JSON","parse","atob","input","str","replace","bs","buffer","bc","idx","output","charAt","fromCharCode","BaseModel","$load","load","_i","entries","key","id","created","updated","clone","$clone","structuredClone","stringify","export","$export","Record","collectionId","collectionName","_loadExpand","expand","isArray","Admin","avatar","email","defaultCookieKey","LocalAuthStore","storageKey","storageFallback","_storageGet","model","save","_storageSet","clear","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","isTokenExpired","expirationThreshold","payload","keys","exp","now","triggerChange","loadFromCookie","cookie","rawData","cookieParse","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","exportToCookie","defaultOptions","resultLength","Blob","size","username","verified","onChange","callback","fireImmediately","splice","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","filesystem","testEmail","toEmail","emailTemplate","template","generateAppleClientSecret","clientId","teamId","keyId","privateKey","duration","ListResult","page","perPage","totalItems","totalPages","items","BaseCrudService","_getFullList","basePath","batchSize","request","_getList","list","castedList","concat","item","_getOne","_getFirstListItem","filter","$cancelKey","code","_create","_update","_delete","CrudService","getFullList","batchOrqueryParams","baseCrudPath","batch","getList","getFirstListItem","getOne","delete","AdminService","authStore","success","authResponse","admin","authWithPassword","password","identity","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","batchOrQueryParams","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2Code","codeVerifier","redirectUrl","createData","authWithOAuth2","args","config","authMethods","find","buildUrl","oldState","unsubscribe_1","state","query","authData","err_2","URL","authUrl","searchParams","set","scopes","urlCallback","_defaultUrlCallback","err_1","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","open","width","height","windowWidth","innerWidth","windowHeight","innerHeight","left","top","SchemaField","type","system","required","Collection","indexes","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","$isBase","$isAuth","$isView","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","eventSource","subscriptions","lastSentTopics","maxConnectTimeout","reconnectAttempts","maxReconnectAttempts","Infinity","predefinedReconnectIntervals","pendingConnects","listener","msgEvent","isConnected","connect","submitSubscriptions","addEventListener","unsubscribeByTopicAndListener","hasSubscriptionListeners","removeEventListener","disconnect","topicPrefix","hasAtleastOneTopic","startsWith","exist","topicToCheck","addAllSubscriptionListeners","getNonEmptySubscriptionTopics","getSubscriptionsCancelKey","catch","err","removeAllSubscriptionListeners","initConnect","clearTimeout","connectTimeoutId","setTimeout","connectErrorHandler","EventSource","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","timeout","fromReconnect","cancelRequest","close","HealthService","check","FileService","getUrl","filename","parts","URLSearchParams","getToken","BackupService","basename","restore","getDownloadUrl","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","files","logs","settings","health","backups","collection","idOrName","autoCancellation","enable","cancelKey","abort","cancelAllRequests","k","reqOptions","isFormData","headers","Authorization","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","serializeQueryParams","beforeSend","_k","_j","_l","_m","fetch","json","afterSend","getFileUrl","location","origin","endsWith","substring","pathname","FormData","encodedKey","value_1","toISOString"],"mappings":"2OAgBA,IAAIA,cAAgB,SAASC,EAAGC,GAI5B,OAHAF,cAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,CAAE,GACzE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOC,OAAOK,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,KACzFP,cAAcC,EAAGC,EAC5B,EAEO,SAASS,UAAUV,EAAGC,GACzB,GAAiB,mBAANA,GAA0B,OAANA,EAC3B,MAAM,IAAIU,UAAU,uBAAyBC,OAAOX,GAAK,iCAE7D,SAASY,KAAOC,KAAKC,YAAcf,CAAI,CADvCD,cAAcC,EAAGC,GAEjBD,EAAEO,UAAkB,OAANN,EAAaC,OAAOc,OAAOf,IAAMY,GAAGN,UAAYN,EAAEM,UAAW,IAAIM,GACnF,CAEO,IAAII,SAAW,WAQlB,OAPAA,SAAWf,OAAOgB,QAAU,SAASD,SAASE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E,KACxBjE,EAAOsB,KAAK2a,EAAa,IAAMrX,mBAAmBjF,EAAMwc,gBAChC,cAAVxc,GAAmC,iBAAVA,EACvCK,EAAOsB,KAAK2a,EAAa,IAAMrX,mBAAmBU,KAAKyB,UAAUpH,KAEjEK,EAAOsB,KAAK2a,EAAa,IAAMrX,mBAAmBjF,GAfrD,CAmBL,OAAOK,EAAOqF,KAAK,MAE1B4T,MAAD"} \ No newline at end of file diff --git a/package.json b/package.json index 1fda03d..93b7a8a 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.15.0", + "version": "0.15.1", "name": "pocketbase", "description": "PocketBase JavaScript SDK", "author": "Gani Georgiev", diff --git a/src/services/RealtimeService.ts b/src/services/RealtimeService.ts index 22bdf38..75d2f01 100644 --- a/src/services/RealtimeService.ts +++ b/src/services/RealtimeService.ts @@ -227,7 +227,7 @@ export default class RealtimeService extends BaseService { 'subscriptions': this.lastSentTopics, }, 'params': { - '$cancelKey': "realtime_" + this.clientId, + '$cancelKey': this.getSubscriptionsCancelKey(), }, }).catch((err) => { if (err?.isAbort) { @@ -237,6 +237,10 @@ export default class RealtimeService extends BaseService { }); } + private getSubscriptionsCancelKey(): string { + return "realtime_" + this.clientId; + } + private getNonEmptySubscriptionTopics(): Array { const result : Array = []; @@ -387,6 +391,7 @@ export default class RealtimeService extends BaseService { clearTimeout(this.connectTimeoutId); clearTimeout(this.reconnectTimeoutId); this.removeAllSubscriptionListeners(); + this.client.cancelRequest(this.getSubscriptionsCancelKey()); this.eventSource?.close(); this.eventSource = null; this.clientId = "";