From fb26dfc9488690abd79a06406e586fc7ebadb4da Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Fri, 16 Dec 2022 17:31:39 +0200 Subject: [PATCH] updated dist files --- dist/pocketbase.cjs.d.ts | 14 ++++++++++++++ dist/pocketbase.cjs.js | 2 +- dist/pocketbase.cjs.js.map | 2 +- dist/pocketbase.es.d.mts | 14 ++++++++++++++ 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 | 14 ++++++++++++++ dist/pocketbase.iife.js | 2 +- dist/pocketbase.iife.js.map | 2 +- dist/pocketbase.umd.d.ts | 14 ++++++++++++++ dist/pocketbase.umd.js | 2 +- dist/pocketbase.umd.js.map | 2 +- 14 files changed, 66 insertions(+), 10 deletions(-) diff --git a/dist/pocketbase.cjs.d.ts b/dist/pocketbase.cjs.d.ts index b540464..6b0a7e7 100644 --- a/dist/pocketbase.cjs.d.ts +++ b/dist/pocketbase.cjs.d.ts @@ -735,6 +735,16 @@ declare class LogService extends BaseService { */ getRequestsStats(queryParams?: LogStatsQueryParams): Promise>; } +interface healthCheckResponse { + code: number; + message: string; +} +declare class HealthService extends BaseService { + /** + * Checks the health status of the api. + */ + check(queryParams?: BaseQueryParams): Promise; +} /** * PocketBase JS Client. */ @@ -818,6 +828,10 @@ declare class Client { * An instance of the service that handles the **Realtime APIs**. */ readonly realtime: RealtimeService; + /** + * An instance of the service that handles the **Health APIs**. + */ + readonly health: HealthService; private cancelControllers; private recordServices; private enableAutoCancellation; diff --git a/dist/pocketbase.cjs.js b/dist/pocketbase.cjs.js index 71f36db..02f8aab 100644 --- a/dist/pocketbase.cjs.js +++ b/dist/pocketbase.cjs.js @@ -1,2 +1,2 @@ -"use strict";var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var h=function(){function t(t){void 0===t&&(t={}),this.load(t||{})}return t.prototype.load=function(t){for(var e=0,n=Object.entries(t);e0&&(!n.exp||n.exp-e>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t||"",this.baseModel=null!==e&&"object"==typeof e?void 0!==e.collectionId?new p(e):new f(e):null,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},t.prototype.loadFromCookie=function(t,e){void 0===e&&(e="pb_auth");var n=function(t,e){var n={};if("string"!=typeof t)return n;for(var i=Object.assign({},e||{}).decode||c,o=0;o4096&&(a.model={id:null===(i=null==a?void 0:a.model)||void 0===i?void 0:i.id,email:null===(o=null==a?void 0:a.model)||void 0===o?void 0:o.email},this.model instanceof p&&(a.model.username=this.model.username,a.model.verified=this.model.verified,a.model.collectionId=this.model.collectionId),c=u(e,JSON.stringify(a),t)),c},t.prototype.onChange=function(t,e){var n=this;return void 0===e&&(e=!1),this._onChangeCallbacks.push(t),e&&t(this.token,this.model),function(){for(var e=n._onChangeCallbacks.length-1;e>=0;e--)if(n._onChangeCallbacks[e]==t)return delete n._onChangeCallbacks[e],void n._onChangeCallbacks.splice(e,1)}},t.prototype.triggerChange=function(){for(var t=0,e=this._onChangeCallbacks;t0?t:1,this.perPage=e>=0?e:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},g=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.getFullList=function(t,e){return void 0===t&&(t=200),void 0===e&&(e={}),this._getFullList(this.baseCrudPath,t,e)},n.prototype.getList=function(t,e,n){return void 0===t&&(t=1),void 0===e&&(e=30),void 0===n&&(n={}),this._getList(this.baseCrudPath,t,e,n)},n.prototype.getFirstListItem=function(t,e){return void 0===e&&(e={}),this._getFirstListItem(this.baseCrudPath,t,e)},n.prototype.getOne=function(t,e){return void 0===e&&(e={}),this._getOne(this.baseCrudPath,t,e)},n.prototype.create=function(t,e){return void 0===t&&(t={}),void 0===e&&(e={}),this._create(this.baseCrudPath,t,e)},n.prototype.update=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),this._update(this.baseCrudPath,t,e,n)},n.prototype.delete=function(t,e){return void 0===e&&(e={}),this._delete(this.baseCrudPath,t,e)},n}(function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype._getFullList=function(t,e,n){var r=this;void 0===e&&(e=100),void 0===n&&(n={});var s=[],a=function(u){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,u,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?a(u+1):s}))]}))}))};return a(1)},n.prototype._getList=function(t,e,n,i){var o=this;return void 0===e&&(e=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:e,perPage:n},i),this.client.send(t,{method:"GET",params:i}).then((function(t){var e=[];if(null==t?void 0:t.items){t.items=t.items||[];for(var n=0,i=t.items;n=0;r--)this.subscriptions[t][r]===e&&(i=!0,delete this.subscriptions[t][r],this.subscriptions[t].splice(r,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(t,e));return i?(this.subscriptions[t].length||delete this.subscriptions[t],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(t)?[3,3]:[4,this.submitSubscriptions()];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},n.prototype.hasSubscriptionListeners=function(t){var e,n;if(this.subscriptions=this.subscriptions||{},t)return!!(null===(e=this.subscriptions[t])||void 0===e?void 0:e.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},n.prototype.submitSubscriptions=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){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(t){if(!(null==t?void 0:t.isAbort))throw t}))]):[2]}))}))},n.prototype.getNonEmptySubscriptionTopics=function(){var t=[];for(var e in this.subscriptions)this.subscriptions[e].length&&t.push(e);return t},n.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var t in this.removeAllSubscriptionListeners(),this.subscriptions)for(var e=0,n=this.subscriptions[t];e0?[2]:[2,new Promise((function(e,n){t.pendingConnects.push({resolve:e,reject:n}),t.pendingConnects.length>1||t.initConnect()}))]}))}))},n.prototype.initConnect=function(){var t=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){t.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(e){t.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(e){var n=e;t.clientId=null==n?void 0:n.lastEventId,t.submitSubscriptions().then((function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:t=3,e.label=1;case 1:return this.hasUnsentSubscriptions()&&t>0?(t--,[4,this.submitSubscriptions()]):[3,3];case 2:return e.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var e=0,n=t.pendingConnects;ethis.maxReconnectAttempts){for(var n=0,i=this.pendingConnects;n=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},t.prototype.getFileUrl=function(t,e,n){void 0===n&&(n={});var i=[];i.push("api"),i.push("files"),i.push(encodeURIComponent(t.collectionId||t.collectionName)),i.push(encodeURIComponent(t.id)),i.push(encodeURIComponent(e));var o=this.buildUrl(i.join("/"));if(Object.keys(n).length){var r=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+r}return o},t.prototype.buildUrl=function(t){var e=this.baseUrl+(this.baseUrl.endsWith("/")?"":"/");return t&&(e+=t.startsWith("/")?t.substring(1):t),e},t.prototype.serializeQueryParams=function(t){var e=[];for(var n in t)if(null!==t[n]){var i=t[n],o=encodeURIComponent(n);if(Array.isArray(i))for(var r=0,s=i;r0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var d=function(){function t(t){void 0===t&&(t={}),this.load(t||{})}return t.prototype.load=function(t){for(var e=0,n=Object.entries(t);e0&&(!n.exp||n.exp-e>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t||"",this.baseModel=null!==e&&"object"==typeof e?void 0!==e.collectionId?new p(e):new f(e):null,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},t.prototype.loadFromCookie=function(t,e){void 0===e&&(e="pb_auth");var n=function(t,e){var n={};if("string"!=typeof t)return n;for(var i=Object.assign({},e||{}).decode||c,o=0;o4096&&(a.model={id:null===(i=null==a?void 0:a.model)||void 0===i?void 0:i.id,email:null===(o=null==a?void 0:a.model)||void 0===o?void 0:o.email},this.model instanceof p&&(a.model.username=this.model.username,a.model.verified=this.model.verified,a.model.collectionId=this.model.collectionId),c=u(e,JSON.stringify(a),t)),c},t.prototype.onChange=function(t,e){var n=this;return void 0===e&&(e=!1),this._onChangeCallbacks.push(t),e&&t(this.token,this.model),function(){for(var e=n._onChangeCallbacks.length-1;e>=0;e--)if(n._onChangeCallbacks[e]==t)return delete n._onChangeCallbacks[e],void n._onChangeCallbacks.splice(e,1)}},t.prototype.triggerChange=function(){for(var t=0,e=this._onChangeCallbacks;t0?t:1,this.perPage=e>=0?e:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},g=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.getFullList=function(t,e){return void 0===t&&(t=200),void 0===e&&(e={}),this._getFullList(this.baseCrudPath,t,e)},n.prototype.getList=function(t,e,n){return void 0===t&&(t=1),void 0===e&&(e=30),void 0===n&&(n={}),this._getList(this.baseCrudPath,t,e,n)},n.prototype.getFirstListItem=function(t,e){return void 0===e&&(e={}),this._getFirstListItem(this.baseCrudPath,t,e)},n.prototype.getOne=function(t,e){return void 0===e&&(e={}),this._getOne(this.baseCrudPath,t,e)},n.prototype.create=function(t,e){return void 0===t&&(t={}),void 0===e&&(e={}),this._create(this.baseCrudPath,t,e)},n.prototype.update=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),this._update(this.baseCrudPath,t,e,n)},n.prototype.delete=function(t,e){return void 0===e&&(e={}),this._delete(this.baseCrudPath,t,e)},n}(function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype._getFullList=function(t,e,n){var r=this;void 0===e&&(e=100),void 0===n&&(n={});var s=[],a=function(u){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,u,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?a(u+1):s}))]}))}))};return a(1)},n.prototype._getList=function(t,e,n,i){var o=this;return void 0===e&&(e=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:e,perPage:n},i),this.client.send(t,{method:"GET",params:i}).then((function(t){var e=[];if(null==t?void 0:t.items){t.items=t.items||[];for(var n=0,i=t.items;n=0;r--)this.subscriptions[t][r]===e&&(i=!0,delete this.subscriptions[t][r],this.subscriptions[t].splice(r,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(t,e));return i?(this.subscriptions[t].length||delete this.subscriptions[t],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(t)?[3,3]:[4,this.submitSubscriptions()];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},n.prototype.hasSubscriptionListeners=function(t){var e,n;if(this.subscriptions=this.subscriptions||{},t)return!!(null===(e=this.subscriptions[t])||void 0===e?void 0:e.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},n.prototype.submitSubscriptions=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){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(t){if(!(null==t?void 0:t.isAbort))throw t}))]):[2]}))}))},n.prototype.getNonEmptySubscriptionTopics=function(){var t=[];for(var e in this.subscriptions)this.subscriptions[e].length&&t.push(e);return t},n.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var t in this.removeAllSubscriptionListeners(),this.subscriptions)for(var e=0,n=this.subscriptions[t];e0?[2]:[2,new Promise((function(e,n){t.pendingConnects.push({resolve:e,reject:n}),t.pendingConnects.length>1||t.initConnect()}))]}))}))},n.prototype.initConnect=function(){var t=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){t.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(e){t.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(e){var n=e;t.clientId=null==n?void 0:n.lastEventId,t.submitSubscriptions().then((function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:t=3,e.label=1;case 1:return this.hasUnsentSubscriptions()&&t>0?(t--,[4,this.submitSubscriptions()]):[3,3];case 2:return e.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var e=0,n=t.pendingConnects;ethis.maxReconnectAttempts){for(var n=0,i=this.pendingConnects;n=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},t.prototype.getFileUrl=function(t,e,n){void 0===n&&(n={});var i=[];i.push("api"),i.push("files"),i.push(encodeURIComponent(t.collectionId||t.collectionName)),i.push(encodeURIComponent(t.id)),i.push(encodeURIComponent(e));var o=this.buildUrl(i.join("/"));if(Object.keys(n).length){var r=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+r}return o},t.prototype.buildUrl=function(t){var e=this.baseUrl+(this.baseUrl.endsWith("/")?"":"/");return t&&(e+=t.startsWith("/")?t.substring(1):t),e},t.prototype.serializeQueryParams=function(t){var e=[];for(var n in t)if(null!==t[n]){var i=t[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 __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 (_) 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: n === \"return\" } : 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 data: {[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.data = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\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.data?.message;\n if (!this.message) {\n this.message = this.isAbort ?\n 'The request was autocancelled. More info you could find in https://github.com/pocketbase/js-sdk#auto-cancellation.' :\n 'Something went wrong while processing your request.';\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 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 * 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 * Creates a seep clone of the current model.\n */\n clone(): BaseModel {\n return new (this.constructor as any)(JSON.parse(JSON.stringify(this)));\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n export(): { [key: string]: any } {\n return 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 this.expand = typeof data.expand === 'object' && data.expand !== null ? data.expand : {};\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 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 { 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 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\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 storage connection test.\n */\n testS3(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\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","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} 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 *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(batch = 200, queryParams: ListQueryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath, batch, queryParams);\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 = 100, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize, 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 'headers': {\n 'Authorization': '',\n },\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 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} 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;\n record: T;\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(batch = 200, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getFullList(batch, queryParams);\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 typeof this.client.authStore.model?.collectionId !== 'undefined' && // is 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 if (\n success &&\n typeof this.client.authStore.model?.collectionId !== 'undefined' && // is record auth\n this.client.authStore.model?.id === id\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 'headers': {\n 'Authorization': '',\n },\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2.\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 authWithOAuth2(\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 * 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","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n unique!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.load(data || {});\n }\n\n /**\n * Loads `data` into the field.\n */\n load(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.unique = !!data.unique;\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 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 : {};\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 * Checks if the current model is \"base\" collection.\n */\n get isBase(): boolean {\n return this.type === 'base';\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 * Checks if the current model is \"single\" collection.\n */\n get isSingle(): boolean {\n return this.type === 'single';\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 private clientId: string = \"\";\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 10000;\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 * 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 10s 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 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 Record from '@/models/Record';\nimport { FileQueryParams } from '@/services/utils/QueryParams';\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/modify the request config.\n *\n * Returns the new modified config that will be used to send the request.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, reqConfig) {\n * reqConfig.headers = Object.assign({}, reqConfig.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return reqConfig;\n * };\n * ```\n */\n beforeSend?: (url: string, reqConfig: { [key: string]: any }) => { [key: string]: any };\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 **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 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.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(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, reqConfig: { [key: string]: any }): Promise {\n let config = Object.assign({ method: 'GET' } as { [key: string]: any }, reqConfig);\n\n // serialize the body if needed and set the correct content type\n // note1: for FormData body the Content-Type header should be skipped\n // note2: we are checking the constructor name because FormData is not available natively in node\n if (config.body && config.body.constructor.name !== 'FormData') {\n if (typeof config.body !== 'string') {\n config.body = JSON.stringify(config.body);\n }\n\n // add the json header (if not already)\n if (typeof config?.headers?.['Content-Type'] === 'undefined') {\n config.headers = Object.assign({}, config.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof config?.headers?.['Accept-Language'] === 'undefined') {\n config.headers = Object.assign({}, config.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 config?.headers?.Authorization === 'undefined')\n ) {\n config.headers = Object.assign({}, config.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && config.params?.$autoCancel !== false) {\n const cancelKey = config.params?.$cancelKey || ((config.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 config.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete config.params?.$autoCancel;\n delete config.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof config.params !== 'undefined') {\n const query = this.serializeQueryParams(config.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete config.params;\n }\n\n if (this.beforeSend) {\n config = Object.assign({}, this.beforeSend(url, config));\n }\n\n // send the request\n return fetch(url, config)\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 = 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;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getFileUrl(record: Record, filename: string, queryParams: FileQueryParams = {}): 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.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 * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl + (this.baseUrl.endsWith('/') ? '' : '/');\n if (path) {\n url += (path.startsWith('/') ? path.substring(1) : path);\n }\n return url;\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","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","data","isAbort","originalError","DOMException","name","message","_a","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","toString","Date","isDate","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","_i","entries","_b","key","id","created","updated","defineProperty","get","clone","stringify","export","Record","collectionId","collectionName","expand","Admin","avatar","email","LocalAuthStore","storageKey","storageFallback","_storageGet","model","save","_storageSet","clear","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","expirationThreshold","payload","keys","exp","now","isTokenExpired","triggerChange","loadFromCookie","cookie","rawData","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","cookieParse","isArray","exportToCookie","defaultOptions","resultLength","Blob","size","_c","username","verified","onChange","callback","fireImmediately","splice","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","testEmail","toEmail","emailTemplate","template","ListResult","page","perPage","totalItems","totalPages","items","CrudService","getFullList","batch","_getFullList","baseCrudPath","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","headers","Authorization","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2","codeVerifier","redirectUrl","createData","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","SchemaField","type","system","required","unique","Collection","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","clientId","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","buildUrl","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","includes","timeout","fromReconnect","close","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","logs","settings","collection","idOrName","autoCancellation","enable","cancelRequest","cancelKey","abort","cancelAllRequests","k","reqConfig","config","_d","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","query","serializeQueryParams","beforeSend","fetch","response","json","afterSend","getFileUrl","filename","parts","URLSearchParams","endsWith","substring","encodedKey","value_1","toISOString"],"mappings":"aAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,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,EAAcC,EAAGC,EAC5B,EAEO,SAASS,EAAUV,EAAGC,GACzB,GAAiB,mBAANA,GAA0B,OAANA,EAC3B,MAAM,IAAIU,UAAU,uBAAyBC,OAAOX,GAAK,iCAE7D,SAASY,IAAOC,KAAKC,YAAcf,CAAI,CADvCD,EAAcC,EAAGC,GAEjBD,EAAEO,UAAkB,OAANN,EAAaC,OAAOc,OAAOf,IAAMY,EAAGN,UAAYN,EAAEM,UAAW,IAAIM,EACnF,CAEO,IAAII,EAAW,WAQlB,OAPAA,EAAWf,OAAOgB,QAAU,SAAkBC,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAIf,KADTc,EAAIG,UAAUF,GACOnB,OAAOK,UAAUC,eAAeC,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UAAU3G,KAEjEK,EAAOqB,KAAKyW,EAAa,IAAM3T,mBAAmBxE,GAfrD,CAmBL,OAAOK,EAAO4E,KAAK,MAE1BwQ,CAAD"} \ 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/LocalAuthStore.ts","../src/stores/BaseAuthStore.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/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 __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 (_) 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: n === \"return\" } : 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 data: {[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.data = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\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.data?.message;\n if (!this.message) {\n this.message = this.isAbort ?\n 'The request was autocancelled. More info you could find in https://github.com/pocketbase/js-sdk#auto-cancellation.' :\n 'Something went wrong while processing your request.';\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 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 * 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 * Creates a seep clone of the current model.\n */\n clone(): BaseModel {\n return new (this.constructor as any)(JSON.parse(JSON.stringify(this)));\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n export(): { [key: string]: any } {\n return 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 this.expand = typeof data.expand === 'object' && data.expand !== null ? data.expand : {};\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 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 { 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 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\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 storage connection test.\n */\n testS3(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\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","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} 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 *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(batch = 200, queryParams: ListQueryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath, batch, queryParams);\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 = 100, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize, 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 'headers': {\n 'Authorization': '',\n },\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 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} 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;\n record: T;\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(batch = 200, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getFullList(batch, queryParams);\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 typeof this.client.authStore.model?.collectionId !== 'undefined' && // is 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 if (\n success &&\n typeof this.client.authStore.model?.collectionId !== 'undefined' && // is record auth\n this.client.authStore.model?.id === id\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 'headers': {\n 'Authorization': '',\n },\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2.\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 authWithOAuth2(\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 * 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","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n unique!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.load(data || {});\n }\n\n /**\n * Loads `data` into the field.\n */\n load(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.unique = !!data.unique;\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 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 : {};\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 * Checks if the current model is \"base\" collection.\n */\n get isBase(): boolean {\n return this.type === 'base';\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 * Checks if the current model is \"single\" collection.\n */\n get isSingle(): boolean {\n return this.type === 'single';\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 private clientId: string = \"\";\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 10000;\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 * 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 10s 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}\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 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 Record from '@/models/Record';\nimport { FileQueryParams } from '@/services/utils/QueryParams';\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/modify the request config.\n *\n * Returns the new modified config that will be used to send the request.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, reqConfig) {\n * reqConfig.headers = Object.assign({}, reqConfig.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return reqConfig;\n * };\n * ```\n */\n beforeSend?: (url: string, reqConfig: { [key: string]: any }) => { [key: string]: any };\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 **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 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.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(this);\n this.health = new HealthService(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, reqConfig: { [key: string]: any }): Promise {\n let config = Object.assign({ method: 'GET' } as { [key: string]: any }, reqConfig);\n\n // serialize the body if needed and set the correct content type\n // note1: for FormData body the Content-Type header should be skipped\n // note2: we are checking the constructor name because FormData is not available natively in node\n if (config.body && config.body.constructor.name !== 'FormData') {\n if (typeof config.body !== 'string') {\n config.body = JSON.stringify(config.body);\n }\n\n // add the json header (if not already)\n if (typeof config?.headers?.['Content-Type'] === 'undefined') {\n config.headers = Object.assign({}, config.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof config?.headers?.['Accept-Language'] === 'undefined') {\n config.headers = Object.assign({}, config.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 config?.headers?.Authorization === 'undefined')\n ) {\n config.headers = Object.assign({}, config.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && config.params?.$autoCancel !== false) {\n const cancelKey = config.params?.$cancelKey || ((config.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 config.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete config.params?.$autoCancel;\n delete config.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof config.params !== 'undefined') {\n const query = this.serializeQueryParams(config.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete config.params;\n }\n\n if (this.beforeSend) {\n config = Object.assign({}, this.beforeSend(url, config));\n }\n\n // send the request\n return fetch(url, config)\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 = 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;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getFileUrl(record: Record, filename: string, queryParams: FileQueryParams = {}): 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.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 * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl + (this.baseUrl.endsWith('/') ? '' : '/');\n if (path) {\n url += (path.startsWith('/') ? path.substring(1) : path);\n }\n return url;\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","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","data","isAbort","originalError","DOMException","name","message","_a","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","toString","Date","isDate","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","_i","entries","_b","key","id","created","updated","defineProperty","get","clone","stringify","export","Record","collectionId","collectionName","expand","Admin","avatar","email","LocalAuthStore","storageKey","storageFallback","_storageGet","model","save","_storageSet","clear","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","expirationThreshold","payload","keys","exp","now","isTokenExpired","triggerChange","loadFromCookie","cookie","rawData","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","cookieParse","isArray","exportToCookie","defaultOptions","resultLength","Blob","size","_c","username","verified","onChange","callback","fireImmediately","splice","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","testEmail","toEmail","emailTemplate","template","ListResult","page","perPage","totalItems","totalPages","items","CrudService","getFullList","batch","_getFullList","baseCrudPath","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","headers","Authorization","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2","codeVerifier","redirectUrl","createData","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","SchemaField","type","system","required","unique","Collection","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","clientId","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","buildUrl","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","includes","timeout","fromReconnect","close","HealthService","check","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","logs","settings","health","collection","idOrName","autoCancellation","enable","cancelRequest","cancelKey","abort","cancelAllRequests","k","reqConfig","config","_d","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","query","serializeQueryParams","beforeSend","fetch","response","json","afterSend","getFileUrl","filename","parts","URLSearchParams","endsWith","substring","encodedKey","value_1","toISOString"],"mappings":"aAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,CAAE,GACzE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOC,OAAOK,UA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AatL,OAAQ,CACjC,IAAMyL,EAAS,IAAIqN,gBAAgBxN,GACnCtK,IAAWA,EAAOgV,SAAS,KAAO,IAAM,KAAOvK,CAClD,CAED,OAAOzK,GAMXsV,EAAQvX,UAAAyW,SAAR,SAASpR,GACL,IAAIzB,EAAMrD,KAAKiX,SAAWjX,KAAKiX,QAAQwC,SAAS,KAAO,GAAK,KAI5D,OAHI3U,IACAzB,GAAQyB,EAAKsQ,WAAW,KAAOtQ,EAAK4U,UAAU,GAAK5U,GAEhDzB,GAMH2T,EAAoBvX,UAAAsZ,qBAA5B,SAA6B5M,GACzB,IAAMzK,EAAwB,GAC9B,IAAK,IAAM+F,KAAO0E,EACd,GAAoB,OAAhBA,EAAO1E,GAAX,CAKA,IAAMpG,EAAQ8K,EAAO1E,GACfkS,EAAa9T,mBAAmB4B,GAEtC,GAAIlI,MAAMwL,QAAQ1J,GAEd,IAAgB,QAAAuY,EAAAvY,EAAAiG,EAAKsS,EAAAlZ,OAAL4G,IAAO,CAAlB,IAAM1E,EAACgX,EAAAtS,GACR5F,EAAOqB,KAAK4W,EAAa,IAAM9T,mBAAmBjD,GACrD,MACMvB,aAAiB4D,KACxBvD,EAAOqB,KAAK4W,EAAa,IAAM9T,mBAAmBxE,EAAMwY,gBAChC,cAAVxY,GAAmC,iBAAVA,EACvCK,EAAOqB,KAAK4W,EAAa,IAAM9T,mBAAmBU,KAAKyB,UAAU3G,KAEjEK,EAAOqB,KAAK4W,EAAa,IAAM9T,mBAAmBxE,GAfrD,CAmBL,OAAOK,EAAO4E,KAAK,MAE1B0Q,CAAD"} \ No newline at end of file diff --git a/dist/pocketbase.es.d.mts b/dist/pocketbase.es.d.mts index a311d75..c55f0c0 100644 --- a/dist/pocketbase.es.d.mts +++ b/dist/pocketbase.es.d.mts @@ -735,6 +735,16 @@ declare class LogService extends BaseService { */ getRequestsStats(queryParams?: LogStatsQueryParams): Promise>; } +interface healthCheckResponse { + code: number; + message: string; +} +declare class HealthService extends BaseService { + /** + * Checks the health status of the api. + */ + check(queryParams?: BaseQueryParams): Promise; +} /** * PocketBase JS Client. */ @@ -818,6 +828,10 @@ declare class Client { * An instance of the service that handles the **Realtime APIs**. */ readonly realtime: RealtimeService; + /** + * An instance of the service that handles the **Health APIs**. + */ + readonly health: HealthService; private cancelControllers; private recordServices; private enableAutoCancellation; diff --git a/dist/pocketbase.es.js b/dist/pocketbase.es.js index 7ec6016..876c4f7 100644 --- a/dist/pocketbase.es.js +++ b/dist/pocketbase.es.js @@ -1,2 +1,2 @@ -var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var h=function(){function t(t){void 0===t&&(t={}),this.load(t||{})}return t.prototype.load=function(t){for(var e=0,n=Object.entries(t);e0&&(!n.exp||n.exp-e>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t||"",this.baseModel=null!==e&&"object"==typeof e?void 0!==e.collectionId?new p(e):new f(e):null,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},t.prototype.loadFromCookie=function(t,e){void 0===e&&(e="pb_auth");var n=function(t,e){var n={};if("string"!=typeof t)return n;for(var i=Object.assign({},e||{}).decode||c,o=0;o4096&&(a.model={id:null===(i=null==a?void 0:a.model)||void 0===i?void 0:i.id,email:null===(o=null==a?void 0:a.model)||void 0===o?void 0:o.email},this.model instanceof p&&(a.model.username=this.model.username,a.model.verified=this.model.verified,a.model.collectionId=this.model.collectionId),c=u(e,JSON.stringify(a),t)),c},t.prototype.onChange=function(t,e){var n=this;return void 0===e&&(e=!1),this._onChangeCallbacks.push(t),e&&t(this.token,this.model),function(){for(var e=n._onChangeCallbacks.length-1;e>=0;e--)if(n._onChangeCallbacks[e]==t)return delete n._onChangeCallbacks[e],void n._onChangeCallbacks.splice(e,1)}},t.prototype.triggerChange=function(){for(var t=0,e=this._onChangeCallbacks;t0?t:1,this.perPage=e>=0?e:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},w=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.getFullList=function(t,e){return void 0===t&&(t=200),void 0===e&&(e={}),this._getFullList(this.baseCrudPath,t,e)},n.prototype.getList=function(t,e,n){return void 0===t&&(t=1),void 0===e&&(e=30),void 0===n&&(n={}),this._getList(this.baseCrudPath,t,e,n)},n.prototype.getFirstListItem=function(t,e){return void 0===e&&(e={}),this._getFirstListItem(this.baseCrudPath,t,e)},n.prototype.getOne=function(t,e){return void 0===e&&(e={}),this._getOne(this.baseCrudPath,t,e)},n.prototype.create=function(t,e){return void 0===t&&(t={}),void 0===e&&(e={}),this._create(this.baseCrudPath,t,e)},n.prototype.update=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),this._update(this.baseCrudPath,t,e,n)},n.prototype.delete=function(t,e){return void 0===e&&(e={}),this._delete(this.baseCrudPath,t,e)},n}(function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype._getFullList=function(t,e,n){var r=this;void 0===e&&(e=100),void 0===n&&(n={});var s=[],a=function(u){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,u,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?a(u+1):s}))]}))}))};return a(1)},n.prototype._getList=function(t,e,n,i){var o=this;return void 0===e&&(e=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:e,perPage:n},i),this.client.send(t,{method:"GET",params:i}).then((function(t){var e=[];if(null==t?void 0:t.items){t.items=t.items||[];for(var n=0,i=t.items;n=0;r--)this.subscriptions[t][r]===e&&(i=!0,delete this.subscriptions[t][r],this.subscriptions[t].splice(r,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(t,e));return i?(this.subscriptions[t].length||delete this.subscriptions[t],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(t)?[3,3]:[4,this.submitSubscriptions()];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},n.prototype.hasSubscriptionListeners=function(t){var e,n;if(this.subscriptions=this.subscriptions||{},t)return!!(null===(e=this.subscriptions[t])||void 0===e?void 0:e.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},n.prototype.submitSubscriptions=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){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(t){if(!(null==t?void 0:t.isAbort))throw t}))]):[2]}))}))},n.prototype.getNonEmptySubscriptionTopics=function(){var t=[];for(var e in this.subscriptions)this.subscriptions[e].length&&t.push(e);return t},n.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var t in this.removeAllSubscriptionListeners(),this.subscriptions)for(var e=0,n=this.subscriptions[t];e0?[2]:[2,new Promise((function(e,n){t.pendingConnects.push({resolve:e,reject:n}),t.pendingConnects.length>1||t.initConnect()}))]}))}))},n.prototype.initConnect=function(){var t=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){t.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(e){t.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(e){var n=e;t.clientId=null==n?void 0:n.lastEventId,t.submitSubscriptions().then((function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:t=3,e.label=1;case 1:return this.hasUnsentSubscriptions()&&t>0?(t--,[4,this.submitSubscriptions()]):[3,3];case 2:return e.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var e=0,n=t.pendingConnects;ethis.maxReconnectAttempts){for(var n=0,i=this.pendingConnects;n=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},t.prototype.getFileUrl=function(t,e,n){void 0===n&&(n={});var i=[];i.push("api"),i.push("files"),i.push(encodeURIComponent(t.collectionId||t.collectionName)),i.push(encodeURIComponent(t.id)),i.push(encodeURIComponent(e));var o=this.buildUrl(i.join("/"));if(Object.keys(n).length){var r=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+r}return o},t.prototype.buildUrl=function(t){var e=this.baseUrl+(this.baseUrl.endsWith("/")?"":"/");return t&&(e+=t.startsWith("/")?t.substring(1):t),e},t.prototype.serializeQueryParams=function(t){var e=[];for(var n in t)if(null!==t[n]){var i=t[n],o=encodeURIComponent(n);if(Array.isArray(i))for(var r=0,s=i;r0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var d=function(){function t(t){void 0===t&&(t={}),this.load(t||{})}return t.prototype.load=function(t){for(var e=0,n=Object.entries(t);e0&&(!n.exp||n.exp-e>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t||"",this.baseModel=null!==e&&"object"==typeof e?void 0!==e.collectionId?new p(e):new f(e):null,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},t.prototype.loadFromCookie=function(t,e){void 0===e&&(e="pb_auth");var n=function(t,e){var n={};if("string"!=typeof t)return n;for(var i=Object.assign({},e||{}).decode||c,o=0;o4096&&(a.model={id:null===(i=null==a?void 0:a.model)||void 0===i?void 0:i.id,email:null===(o=null==a?void 0:a.model)||void 0===o?void 0:o.email},this.model instanceof p&&(a.model.username=this.model.username,a.model.verified=this.model.verified,a.model.collectionId=this.model.collectionId),c=u(e,JSON.stringify(a),t)),c},t.prototype.onChange=function(t,e){var n=this;return void 0===e&&(e=!1),this._onChangeCallbacks.push(t),e&&t(this.token,this.model),function(){for(var e=n._onChangeCallbacks.length-1;e>=0;e--)if(n._onChangeCallbacks[e]==t)return delete n._onChangeCallbacks[e],void n._onChangeCallbacks.splice(e,1)}},t.prototype.triggerChange=function(){for(var t=0,e=this._onChangeCallbacks;t0?t:1,this.perPage=e>=0?e:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},w=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.getFullList=function(t,e){return void 0===t&&(t=200),void 0===e&&(e={}),this._getFullList(this.baseCrudPath,t,e)},n.prototype.getList=function(t,e,n){return void 0===t&&(t=1),void 0===e&&(e=30),void 0===n&&(n={}),this._getList(this.baseCrudPath,t,e,n)},n.prototype.getFirstListItem=function(t,e){return void 0===e&&(e={}),this._getFirstListItem(this.baseCrudPath,t,e)},n.prototype.getOne=function(t,e){return void 0===e&&(e={}),this._getOne(this.baseCrudPath,t,e)},n.prototype.create=function(t,e){return void 0===t&&(t={}),void 0===e&&(e={}),this._create(this.baseCrudPath,t,e)},n.prototype.update=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),this._update(this.baseCrudPath,t,e,n)},n.prototype.delete=function(t,e){return void 0===e&&(e={}),this._delete(this.baseCrudPath,t,e)},n}(function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype._getFullList=function(t,e,n){var r=this;void 0===e&&(e=100),void 0===n&&(n={});var s=[],a=function(u){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,u,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?a(u+1):s}))]}))}))};return a(1)},n.prototype._getList=function(t,e,n,i){var o=this;return void 0===e&&(e=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:e,perPage:n},i),this.client.send(t,{method:"GET",params:i}).then((function(t){var e=[];if(null==t?void 0:t.items){t.items=t.items||[];for(var n=0,i=t.items;n=0;r--)this.subscriptions[t][r]===e&&(i=!0,delete this.subscriptions[t][r],this.subscriptions[t].splice(r,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(t,e));return i?(this.subscriptions[t].length||delete this.subscriptions[t],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(t)?[3,3]:[4,this.submitSubscriptions()];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},n.prototype.hasSubscriptionListeners=function(t){var e,n;if(this.subscriptions=this.subscriptions||{},t)return!!(null===(e=this.subscriptions[t])||void 0===e?void 0:e.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},n.prototype.submitSubscriptions=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){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(t){if(!(null==t?void 0:t.isAbort))throw t}))]):[2]}))}))},n.prototype.getNonEmptySubscriptionTopics=function(){var t=[];for(var e in this.subscriptions)this.subscriptions[e].length&&t.push(e);return t},n.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var t in this.removeAllSubscriptionListeners(),this.subscriptions)for(var e=0,n=this.subscriptions[t];e0?[2]:[2,new Promise((function(e,n){t.pendingConnects.push({resolve:e,reject:n}),t.pendingConnects.length>1||t.initConnect()}))]}))}))},n.prototype.initConnect=function(){var t=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){t.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(e){t.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(e){var n=e;t.clientId=null==n?void 0:n.lastEventId,t.submitSubscriptions().then((function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:t=3,e.label=1;case 1:return this.hasUnsentSubscriptions()&&t>0?(t--,[4,this.submitSubscriptions()]):[3,3];case 2:return e.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var e=0,n=t.pendingConnects;ethis.maxReconnectAttempts){for(var n=0,i=this.pendingConnects;n=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},t.prototype.getFileUrl=function(t,e,n){void 0===n&&(n={});var i=[];i.push("api"),i.push("files"),i.push(encodeURIComponent(t.collectionId||t.collectionName)),i.push(encodeURIComponent(t.id)),i.push(encodeURIComponent(e));var o=this.buildUrl(i.join("/"));if(Object.keys(n).length){var r=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+r}return o},t.prototype.buildUrl=function(t){var e=this.baseUrl+(this.baseUrl.endsWith("/")?"":"/");return t&&(e+=t.startsWith("/")?t.substring(1):t),e},t.prototype.serializeQueryParams=function(t){var e=[];for(var n in t)if(null!==t[n]){var i=t[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 __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 (_) 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: n === \"return\" } : 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 data: {[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.data = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\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.data?.message;\n if (!this.message) {\n this.message = this.isAbort ?\n 'The request was autocancelled. More info you could find in https://github.com/pocketbase/js-sdk#auto-cancellation.' :\n 'Something went wrong while processing your request.';\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 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 * 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 * Creates a seep clone of the current model.\n */\n clone(): BaseModel {\n return new (this.constructor as any)(JSON.parse(JSON.stringify(this)));\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n export(): { [key: string]: any } {\n return 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 this.expand = typeof data.expand === 'object' && data.expand !== null ? data.expand : {};\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\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 storage connection test.\n */\n testS3(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\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","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} 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 *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(batch = 200, queryParams: ListQueryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath, batch, queryParams);\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 = 100, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize, 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 'headers': {\n 'Authorization': '',\n },\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 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} 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;\n record: T;\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(batch = 200, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getFullList(batch, queryParams);\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 typeof this.client.authStore.model?.collectionId !== 'undefined' && // is 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 if (\n success &&\n typeof this.client.authStore.model?.collectionId !== 'undefined' && // is record auth\n this.client.authStore.model?.id === id\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 'headers': {\n 'Authorization': '',\n },\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2.\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 authWithOAuth2(\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 * 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","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n unique!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.load(data || {});\n }\n\n /**\n * Loads `data` into the field.\n */\n load(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.unique = !!data.unique;\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 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 : {};\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 * Checks if the current model is \"base\" collection.\n */\n get isBase(): boolean {\n return this.type === 'base';\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 * Checks if the current model is \"single\" collection.\n */\n get isSingle(): boolean {\n return this.type === 'single';\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 private clientId: string = \"\";\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 10000;\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 * 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 10s 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 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 Record from '@/models/Record';\nimport { FileQueryParams } from '@/services/utils/QueryParams';\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/modify the request config.\n *\n * Returns the new modified config that will be used to send the request.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, reqConfig) {\n * reqConfig.headers = Object.assign({}, reqConfig.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return reqConfig;\n * };\n * ```\n */\n beforeSend?: (url: string, reqConfig: { [key: string]: any }) => { [key: string]: any };\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 **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 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.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(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, reqConfig: { [key: string]: any }): Promise {\n let config = Object.assign({ method: 'GET' } as { [key: string]: any }, reqConfig);\n\n // serialize the body if needed and set the correct content type\n // note1: for FormData body the Content-Type header should be skipped\n // note2: we are checking the constructor name because FormData is not available natively in node\n if (config.body && config.body.constructor.name !== 'FormData') {\n if (typeof config.body !== 'string') {\n config.body = JSON.stringify(config.body);\n }\n\n // add the json header (if not already)\n if (typeof config?.headers?.['Content-Type'] === 'undefined') {\n config.headers = Object.assign({}, config.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof config?.headers?.['Accept-Language'] === 'undefined') {\n config.headers = Object.assign({}, config.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 config?.headers?.Authorization === 'undefined')\n ) {\n config.headers = Object.assign({}, config.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && config.params?.$autoCancel !== false) {\n const cancelKey = config.params?.$cancelKey || ((config.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 config.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete config.params?.$autoCancel;\n delete config.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof config.params !== 'undefined') {\n const query = this.serializeQueryParams(config.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete config.params;\n }\n\n if (this.beforeSend) {\n config = Object.assign({}, this.beforeSend(url, config));\n }\n\n // send the request\n return fetch(url, config)\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 = 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;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getFileUrl(record: Record, filename: string, queryParams: FileQueryParams = {}): 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.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 * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl + (this.baseUrl.endsWith('/') ? '' : '/');\n if (path) {\n url += (path.startsWith('/') ? path.substring(1) : path);\n }\n return url;\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","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","data","isAbort","originalError","DOMException","name","message","_a","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","toString","Date","isDate","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","_i","entries","_b","key","id","created","updated","defineProperty","get","clone","stringify","export","Record","collectionId","collectionName","expand","Admin","avatar","email","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","expirationThreshold","payload","keys","exp","now","isTokenExpired","save","model","triggerChange","clear","loadFromCookie","cookie","rawData","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","cookieParse","isArray","exportToCookie","defaultOptions","resultLength","Blob","size","_c","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","testEmail","toEmail","emailTemplate","template","ListResult","page","perPage","totalItems","totalPages","items","CrudService","getFullList","batch","_getFullList","baseCrudPath","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","headers","Authorization","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2","codeVerifier","redirectUrl","createData","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","SchemaField","type","system","required","unique","Collection","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","clientId","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","buildUrl","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","includes","timeout","fromReconnect","close","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","logs","settings","collection","idOrName","autoCancellation","enable","cancelRequest","cancelKey","abort","cancelAllRequests","k","reqConfig","config","_d","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","query","serializeQueryParams","beforeSend","fetch","response","json","afterSend","getFileUrl","filename","parts","URLSearchParams","endsWith","substring","encodedKey","value_1","toISOString"],"mappings":"AAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,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,EAAcC,EAAGC,EAC5B,EAEO,SAASS,EAAUV,EAAGC,GACzB,GAAiB,mBAAN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AAoB,OAAhBA,EAAO1E,GAAX,CAKA,IAAMpG,EAAQ8K,EAAO1E,GACf+R,EAAa3T,mBAAmB4B,GAEtC,GAAIlI,MAAM2K,QAAQ7I,GAEd,IAAgB,QAAAoY,EAAApY,EAAAiG,EAAKmS,EAAA/Y,OAAL4G,IAAO,CAAlB,IAAM1E,EAAC6W,EAAAnS,GACR5F,EAAOqB,KAAKyW,EAAa,IAAM3T,mBAAmBjD,GACrD,MACMvB,aAAiB4D,KACxBvD,EAAOqB,KAAKyW,EAAa,IAAM3T,mBAAmBxE,EAAMqY,gBAChC,cAAVrY,GAAmC,iBAAVA,EACvCK,EAAOqB,KAAKyW,EAAa,IAAM3T,mBAAmBU,KAAKyB,UAAU3G,KAEjEK,EAAOqB,KAAKyW,EAAa,IAAM3T,mBAAmBxE,GAfrD,CAmBL,OAAOK,EAAO4E,KAAK,MAE1BwQ,CAAD"} \ 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/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 __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 (_) 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: n === \"return\" } : 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 data: {[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.data = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\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.data?.message;\n if (!this.message) {\n this.message = this.isAbort ?\n 'The request was autocancelled. More info you could find in https://github.com/pocketbase/js-sdk#auto-cancellation.' :\n 'Something went wrong while processing your request.';\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 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 * 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 * Creates a seep clone of the current model.\n */\n clone(): BaseModel {\n return new (this.constructor as any)(JSON.parse(JSON.stringify(this)));\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n export(): { [key: string]: any } {\n return 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 this.expand = typeof data.expand === 'object' && data.expand !== null ? data.expand : {};\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\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 storage connection test.\n */\n testS3(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\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","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} 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 *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(batch = 200, queryParams: ListQueryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath, batch, queryParams);\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 = 100, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize, 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 'headers': {\n 'Authorization': '',\n },\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 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} 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;\n record: T;\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(batch = 200, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getFullList(batch, queryParams);\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 typeof this.client.authStore.model?.collectionId !== 'undefined' && // is 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 if (\n success &&\n typeof this.client.authStore.model?.collectionId !== 'undefined' && // is record auth\n this.client.authStore.model?.id === id\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 'headers': {\n 'Authorization': '',\n },\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2.\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 authWithOAuth2(\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 * 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","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n unique!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.load(data || {});\n }\n\n /**\n * Loads `data` into the field.\n */\n load(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.unique = !!data.unique;\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 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 : {};\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 * Checks if the current model is \"base\" collection.\n */\n get isBase(): boolean {\n return this.type === 'base';\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 * Checks if the current model is \"single\" collection.\n */\n get isSingle(): boolean {\n return this.type === 'single';\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 private clientId: string = \"\";\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 10000;\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 * 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 10s 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}\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 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 Record from '@/models/Record';\nimport { FileQueryParams } from '@/services/utils/QueryParams';\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/modify the request config.\n *\n * Returns the new modified config that will be used to send the request.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, reqConfig) {\n * reqConfig.headers = Object.assign({}, reqConfig.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return reqConfig;\n * };\n * ```\n */\n beforeSend?: (url: string, reqConfig: { [key: string]: any }) => { [key: string]: any };\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 **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 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.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(this);\n this.health = new HealthService(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, reqConfig: { [key: string]: any }): Promise {\n let config = Object.assign({ method: 'GET' } as { [key: string]: any }, reqConfig);\n\n // serialize the body if needed and set the correct content type\n // note1: for FormData body the Content-Type header should be skipped\n // note2: we are checking the constructor name because FormData is not available natively in node\n if (config.body && config.body.constructor.name !== 'FormData') {\n if (typeof config.body !== 'string') {\n config.body = JSON.stringify(config.body);\n }\n\n // add the json header (if not already)\n if (typeof config?.headers?.['Content-Type'] === 'undefined') {\n config.headers = Object.assign({}, config.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof config?.headers?.['Accept-Language'] === 'undefined') {\n config.headers = Object.assign({}, config.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 config?.headers?.Authorization === 'undefined')\n ) {\n config.headers = Object.assign({}, config.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && config.params?.$autoCancel !== false) {\n const cancelKey = config.params?.$cancelKey || ((config.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 config.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete config.params?.$autoCancel;\n delete config.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof config.params !== 'undefined') {\n const query = this.serializeQueryParams(config.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete config.params;\n }\n\n if (this.beforeSend) {\n config = Object.assign({}, this.beforeSend(url, config));\n }\n\n // send the request\n return fetch(url, config)\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 = 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;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getFileUrl(record: Record, filename: string, queryParams: FileQueryParams = {}): 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.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 * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl + (this.baseUrl.endsWith('/') ? '' : '/');\n if (path) {\n url += (path.startsWith('/') ? path.substring(1) : path);\n }\n return url;\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","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","data","isAbort","originalError","DOMException","name","message","_a","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","toString","Date","isDate","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","_i","entries","_b","key","id","created","updated","defineProperty","get","clone","stringify","export","Record","collectionId","collectionName","expand","Admin","avatar","email","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","expirationThreshold","payload","keys","exp","now","isTokenExpired","save","model","triggerChange","clear","loadFromCookie","cookie","rawData","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","cookieParse","isArray","exportToCookie","defaultOptions","resultLength","Blob","size","_c","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","testEmail","toEmail","emailTemplate","template","ListResult","page","perPage","totalItems","totalPages","items","CrudService","getFullList","batch","_getFullList","baseCrudPath","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","headers","Authorization","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2","codeVerifier","redirectUrl","createData","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","SchemaField","type","system","required","unique","Collection","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","clientId","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","buildUrl","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","includes","timeout","fromReconnect","close","HealthService","check","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","logs","settings","health","collection","idOrName","autoCancellation","enable","cancelRequest","cancelKey","abort","cancelAllRequests","k","reqConfig","config","_d","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","query","serializeQueryParams","beforeSend","fetch","response","json","afterSend","getFileUrl","filename","parts","URLSearchParams","endsWith","substring","encodedKey","value_1","toISOString"],"mappings":"AAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,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,EAAcC,EAAGC,EAC5B,EAEO,SAASS,EAAUV,EAAGC,GACzB,GAAiB,mBAANA,GAA0B,OAANA,EAC3B,MAAM,IAAIU,UAAU,uBAAyBC,OAAOX,GAAK,iCAE7D,SAASY,IAAOC,KAAKC,YAAcf,CAAI,CADvCD,EAAcC,EAAGC,GAEjBD,EAAEO,UAAkB,OAANN,EAAaC,OAAOc,OAAOf,IAAMY,EAAGN,UAAYN,EAAEM,UAAW,IAAIM,EACnF,CAEO,IAAII,EAAW,WAQlB,OAPAA,EAAWf,OAAOgB,QAAU,SAAkBC,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,EAASQ,MAAMX,KAAMS,UAChC,EA6BO,SAASG,EAAUC,EAASC,EAAYC,EAAGC,GAE9C,OAAO,IAAKD,IAAMA,EAAIE,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUC,GAAS,IAAMC,E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C,cAAVxY,GAAmC,iBAAVA,EACvCK,EAAOqB,KAAK4W,EAAa,IAAM9T,mBAAmBU,KAAKyB,UAAU3G,KAEjEK,EAAOqB,KAAK4W,EAAa,IAAM9T,mBAAmBxE,GAfrD,CAmBL,OAAOK,EAAO4E,KAAK,MAE1B0Q,CAAD"} \ No newline at end of file diff --git a/dist/pocketbase.es.mjs b/dist/pocketbase.es.mjs index 8bdea02..ae13eb1 100644 --- a/dist/pocketbase.es.mjs +++ b/dist/pocketbase.es.mjs @@ -1,2 +1,2 @@ -var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var h=function(){function t(t){void 0===t&&(t={}),this.load(t||{})}return t.prototype.load=function(t){for(var e=0,n=Object.entries(t);e0&&(!n.exp||n.exp-e>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t||"",this.baseModel=null!==e&&"object"==typeof e?void 0!==e.collectionId?new p(e):new f(e):null,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},t.prototype.loadFromCookie=function(t,e){void 0===e&&(e="pb_auth");var n=function(t,e){var n={};if("string"!=typeof t)return n;for(var i=Object.assign({},e||{}).decode||c,o=0;o4096&&(a.model={id:null===(i=null==a?void 0:a.model)||void 0===i?void 0:i.id,email:null===(o=null==a?void 0:a.model)||void 0===o?void 0:o.email},this.model instanceof p&&(a.model.username=this.model.username,a.model.verified=this.model.verified,a.model.collectionId=this.model.collectionId),c=u(e,JSON.stringify(a),t)),c},t.prototype.onChange=function(t,e){var n=this;return void 0===e&&(e=!1),this._onChangeCallbacks.push(t),e&&t(this.token,this.model),function(){for(var e=n._onChangeCallbacks.length-1;e>=0;e--)if(n._onChangeCallbacks[e]==t)return delete n._onChangeCallbacks[e],void n._onChangeCallbacks.splice(e,1)}},t.prototype.triggerChange=function(){for(var t=0,e=this._onChangeCallbacks;t0?t:1,this.perPage=e>=0?e:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},w=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.getFullList=function(t,e){return void 0===t&&(t=200),void 0===e&&(e={}),this._getFullList(this.baseCrudPath,t,e)},n.prototype.getList=function(t,e,n){return void 0===t&&(t=1),void 0===e&&(e=30),void 0===n&&(n={}),this._getList(this.baseCrudPath,t,e,n)},n.prototype.getFirstListItem=function(t,e){return void 0===e&&(e={}),this._getFirstListItem(this.baseCrudPath,t,e)},n.prototype.getOne=function(t,e){return void 0===e&&(e={}),this._getOne(this.baseCrudPath,t,e)},n.prototype.create=function(t,e){return void 0===t&&(t={}),void 0===e&&(e={}),this._create(this.baseCrudPath,t,e)},n.prototype.update=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),this._update(this.baseCrudPath,t,e,n)},n.prototype.delete=function(t,e){return void 0===e&&(e={}),this._delete(this.baseCrudPath,t,e)},n}(function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype._getFullList=function(t,e,n){var r=this;void 0===e&&(e=100),void 0===n&&(n={});var s=[],a=function(u){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,u,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?a(u+1):s}))]}))}))};return a(1)},n.prototype._getList=function(t,e,n,i){var o=this;return void 0===e&&(e=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:e,perPage:n},i),this.client.send(t,{method:"GET",params:i}).then((function(t){var e=[];if(null==t?void 0:t.items){t.items=t.items||[];for(var n=0,i=t.items;n=0;r--)this.subscriptions[t][r]===e&&(i=!0,delete this.subscriptions[t][r],this.subscriptions[t].splice(r,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(t,e));return i?(this.subscriptions[t].length||delete this.subscriptions[t],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(t)?[3,3]:[4,this.submitSubscriptions()];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},n.prototype.hasSubscriptionListeners=function(t){var e,n;if(this.subscriptions=this.subscriptions||{},t)return!!(null===(e=this.subscriptions[t])||void 0===e?void 0:e.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},n.prototype.submitSubscriptions=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){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(t){if(!(null==t?void 0:t.isAbort))throw t}))]):[2]}))}))},n.prototype.getNonEmptySubscriptionTopics=function(){var t=[];for(var e in this.subscriptions)this.subscriptions[e].length&&t.push(e);return t},n.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var t in this.removeAllSubscriptionListeners(),this.subscriptions)for(var e=0,n=this.subscriptions[t];e0?[2]:[2,new Promise((function(e,n){t.pendingConnects.push({resolve:e,reject:n}),t.pendingConnects.length>1||t.initConnect()}))]}))}))},n.prototype.initConnect=function(){var t=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){t.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(e){t.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(e){var n=e;t.clientId=null==n?void 0:n.lastEventId,t.submitSubscriptions().then((function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:t=3,e.label=1;case 1:return this.hasUnsentSubscriptions()&&t>0?(t--,[4,this.submitSubscriptions()]):[3,3];case 2:return e.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var e=0,n=t.pendingConnects;ethis.maxReconnectAttempts){for(var n=0,i=this.pendingConnects;n=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},t.prototype.getFileUrl=function(t,e,n){void 0===n&&(n={});var i=[];i.push("api"),i.push("files"),i.push(encodeURIComponent(t.collectionId||t.collectionName)),i.push(encodeURIComponent(t.id)),i.push(encodeURIComponent(e));var o=this.buildUrl(i.join("/"));if(Object.keys(n).length){var r=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+r}return o},t.prototype.buildUrl=function(t){var e=this.baseUrl+(this.baseUrl.endsWith("/")?"":"/");return t&&(e+=t.startsWith("/")?t.substring(1):t),e},t.prototype.serializeQueryParams=function(t){var e=[];for(var n in t)if(null!==t[n]){var i=t[n],o=encodeURIComponent(n);if(Array.isArray(i))for(var r=0,s=i;r0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var d=function(){function t(t){void 0===t&&(t={}),this.load(t||{})}return t.prototype.load=function(t){for(var e=0,n=Object.entries(t);e0&&(!n.exp||n.exp-e>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t||"",this.baseModel=null!==e&&"object"==typeof e?void 0!==e.collectionId?new p(e):new f(e):null,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},t.prototype.loadFromCookie=function(t,e){void 0===e&&(e="pb_auth");var n=function(t,e){var n={};if("string"!=typeof t)return n;for(var i=Object.assign({},e||{}).decode||c,o=0;o4096&&(a.model={id:null===(i=null==a?void 0:a.model)||void 0===i?void 0:i.id,email:null===(o=null==a?void 0:a.model)||void 0===o?void 0:o.email},this.model instanceof p&&(a.model.username=this.model.username,a.model.verified=this.model.verified,a.model.collectionId=this.model.collectionId),c=u(e,JSON.stringify(a),t)),c},t.prototype.onChange=function(t,e){var n=this;return void 0===e&&(e=!1),this._onChangeCallbacks.push(t),e&&t(this.token,this.model),function(){for(var e=n._onChangeCallbacks.length-1;e>=0;e--)if(n._onChangeCallbacks[e]==t)return delete n._onChangeCallbacks[e],void n._onChangeCallbacks.splice(e,1)}},t.prototype.triggerChange=function(){for(var t=0,e=this._onChangeCallbacks;t0?t:1,this.perPage=e>=0?e:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},w=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.getFullList=function(t,e){return void 0===t&&(t=200),void 0===e&&(e={}),this._getFullList(this.baseCrudPath,t,e)},n.prototype.getList=function(t,e,n){return void 0===t&&(t=1),void 0===e&&(e=30),void 0===n&&(n={}),this._getList(this.baseCrudPath,t,e,n)},n.prototype.getFirstListItem=function(t,e){return void 0===e&&(e={}),this._getFirstListItem(this.baseCrudPath,t,e)},n.prototype.getOne=function(t,e){return void 0===e&&(e={}),this._getOne(this.baseCrudPath,t,e)},n.prototype.create=function(t,e){return void 0===t&&(t={}),void 0===e&&(e={}),this._create(this.baseCrudPath,t,e)},n.prototype.update=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),this._update(this.baseCrudPath,t,e,n)},n.prototype.delete=function(t,e){return void 0===e&&(e={}),this._delete(this.baseCrudPath,t,e)},n}(function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype._getFullList=function(t,e,n){var r=this;void 0===e&&(e=100),void 0===n&&(n={});var s=[],a=function(u){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,u,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?a(u+1):s}))]}))}))};return a(1)},n.prototype._getList=function(t,e,n,i){var o=this;return void 0===e&&(e=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:e,perPage:n},i),this.client.send(t,{method:"GET",params:i}).then((function(t){var e=[];if(null==t?void 0:t.items){t.items=t.items||[];for(var n=0,i=t.items;n=0;r--)this.subscriptions[t][r]===e&&(i=!0,delete this.subscriptions[t][r],this.subscriptions[t].splice(r,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(t,e));return i?(this.subscriptions[t].length||delete this.subscriptions[t],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(t)?[3,3]:[4,this.submitSubscriptions()];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},n.prototype.hasSubscriptionListeners=function(t){var e,n;if(this.subscriptions=this.subscriptions||{},t)return!!(null===(e=this.subscriptions[t])||void 0===e?void 0:e.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},n.prototype.submitSubscriptions=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){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(t){if(!(null==t?void 0:t.isAbort))throw t}))]):[2]}))}))},n.prototype.getNonEmptySubscriptionTopics=function(){var t=[];for(var e in this.subscriptions)this.subscriptions[e].length&&t.push(e);return t},n.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var t in this.removeAllSubscriptionListeners(),this.subscriptions)for(var e=0,n=this.subscriptions[t];e0?[2]:[2,new Promise((function(e,n){t.pendingConnects.push({resolve:e,reject:n}),t.pendingConnects.length>1||t.initConnect()}))]}))}))},n.prototype.initConnect=function(){var t=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){t.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(e){t.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(e){var n=e;t.clientId=null==n?void 0:n.lastEventId,t.submitSubscriptions().then((function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:t=3,e.label=1;case 1:return this.hasUnsentSubscriptions()&&t>0?(t--,[4,this.submitSubscriptions()]):[3,3];case 2:return e.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var e=0,n=t.pendingConnects;ethis.maxReconnectAttempts){for(var n=0,i=this.pendingConnects;n=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},t.prototype.getFileUrl=function(t,e,n){void 0===n&&(n={});var i=[];i.push("api"),i.push("files"),i.push(encodeURIComponent(t.collectionId||t.collectionName)),i.push(encodeURIComponent(t.id)),i.push(encodeURIComponent(e));var o=this.buildUrl(i.join("/"));if(Object.keys(n).length){var r=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+r}return o},t.prototype.buildUrl=function(t){var e=this.baseUrl+(this.baseUrl.endsWith("/")?"":"/");return t&&(e+=t.startsWith("/")?t.substring(1):t),e},t.prototype.serializeQueryParams=function(t){var e=[];for(var n in t)if(null!==t[n]){var i=t[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 __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 (_) 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: n === \"return\" } : 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 data: {[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.data = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\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.data?.message;\n if (!this.message) {\n this.message = this.isAbort ?\n 'The request was autocancelled. More info you could find in https://github.com/pocketbase/js-sdk#auto-cancellation.' :\n 'Something went wrong while processing your request.';\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 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 * 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 * Creates a seep clone of the current model.\n */\n clone(): BaseModel {\n return new (this.constructor as any)(JSON.parse(JSON.stringify(this)));\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n export(): { [key: string]: any } {\n return 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 this.expand = typeof data.expand === 'object' && data.expand !== null ? data.expand : {};\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\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 storage connection test.\n */\n testS3(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\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","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} 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 *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(batch = 200, queryParams: ListQueryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath, batch, queryParams);\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 = 100, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize, 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 'headers': {\n 'Authorization': '',\n },\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 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} 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;\n record: T;\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(batch = 200, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getFullList(batch, queryParams);\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 typeof this.client.authStore.model?.collectionId !== 'undefined' && // is 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 if (\n success &&\n typeof this.client.authStore.model?.collectionId !== 'undefined' && // is record auth\n this.client.authStore.model?.id === id\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 'headers': {\n 'Authorization': '',\n },\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2.\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 authWithOAuth2(\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 * 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","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n unique!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.load(data || {});\n }\n\n /**\n * Loads `data` into the field.\n */\n load(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.unique = !!data.unique;\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 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 : {};\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 * Checks if the current model is \"base\" collection.\n */\n get isBase(): boolean {\n return this.type === 'base';\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 * Checks if the current model is \"single\" collection.\n */\n get isSingle(): boolean {\n return this.type === 'single';\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 private clientId: string = \"\";\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 10000;\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 * 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 10s 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 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 Record from '@/models/Record';\nimport { FileQueryParams } from '@/services/utils/QueryParams';\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/modify the request config.\n *\n * Returns the new modified config that will be used to send the request.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, reqConfig) {\n * reqConfig.headers = Object.assign({}, reqConfig.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return reqConfig;\n * };\n * ```\n */\n beforeSend?: (url: string, reqConfig: { [key: string]: any }) => { [key: string]: any };\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 **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 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.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(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, reqConfig: { [key: string]: any }): Promise {\n let config = Object.assign({ method: 'GET' } as { [key: string]: any }, reqConfig);\n\n // serialize the body if needed and set the correct content type\n // note1: for FormData body the Content-Type header should be skipped\n // note2: we are checking the constructor name because FormData is not available natively in node\n if (config.body && config.body.constructor.name !== 'FormData') {\n if (typeof config.body !== 'string') {\n config.body = JSON.stringify(config.body);\n }\n\n // add the json header (if not already)\n if (typeof config?.headers?.['Content-Type'] === 'undefined') {\n config.headers = Object.assign({}, config.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof config?.headers?.['Accept-Language'] === 'undefined') {\n config.headers = Object.assign({}, config.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 config?.headers?.Authorization === 'undefined')\n ) {\n config.headers = Object.assign({}, config.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && config.params?.$autoCancel !== false) {\n const cancelKey = config.params?.$cancelKey || ((config.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 config.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete config.params?.$autoCancel;\n delete config.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof config.params !== 'undefined') {\n const query = this.serializeQueryParams(config.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete config.params;\n }\n\n if (this.beforeSend) {\n config = Object.assign({}, this.beforeSend(url, config));\n }\n\n // send the request\n return fetch(url, config)\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 = 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;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getFileUrl(record: Record, filename: string, queryParams: FileQueryParams = {}): 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.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 * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl + (this.baseUrl.endsWith('/') ? '' : '/');\n if (path) {\n url += (path.startsWith('/') ? path.substring(1) : path);\n }\n return url;\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","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","data","isAbort","originalError","DOMException","name","message","_a","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","toString","Date","isDate","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","_i","entries","_b","key","id","created","updated","defineProperty","get","clone","stringify","export","Record","collectionId","collectionName","expand","Admin","avatar","email","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","expirationThreshold","payload","keys","exp","now","isTokenExpired","save","model","triggerChange","clear","loadFromCookie","cookie","rawData","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","cookieParse","isArray","exportToCookie","defaultOptions","resultLength","Blob","size","_c","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","testEmail","toEmail","emailTemplate","template","ListResult","page","perPage","totalItems","totalPages","items","CrudService","getFullList","batch","_getFullList","baseCrudPath","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","headers","Authorization","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2","codeVerifier","redirectUrl","createData","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","SchemaField","type","system","required","unique","Collection","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","clientId","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","buildUrl","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","includes","timeout","fromReconnect","close","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","logs","settings","collection","idOrName","autoCancellation","enable","cancelRequest","cancelKey","abort","cancelAllRequests","k","reqConfig","config","_d","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","query","serializeQueryParams","beforeSend","fetch","response","json","afterSend","getFileUrl","filename","parts","URLSearchParams","endsWith","substring","encodedKey","value_1","toISOString"],"mappings":"AAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,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,EAAcC,EAAGC,EAC5B,EAEO,SAASS,EAAUV,EAAGC,GACzB,GA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0E,EACd,GAAoB,OAAhBA,EAAO1E,GAAX,CAKA,IAAMpG,EAAQ8K,EAAO1E,GACf+R,EAAa3T,mBAAmB4B,GAEtC,GAAIlI,MAAM2K,QAAQ7I,GAEd,IAAgB,QAAAoY,EAAApY,EAAAiG,EAAKmS,EAAA/Y,OAAL4G,IAAO,CAAlB,IAAM1E,EAAC6W,EAAAnS,GACR5F,EAAOqB,KAAKyW,EAAa,IAAM3T,mBAAmBjD,GACrD,MACMvB,aAAiB4D,KACxBvD,EAAOqB,KAAKyW,EAAa,IAAM3T,mBAAmBxE,EAAMqY,gBAChC,cAAVrY,GAAmC,iBAAVA,EACvCK,EAAOqB,KAAKyW,EAAa,IAAM3T,mBAAmBU,KAAKyB,UAAU3G,KAEjEK,EAAOqB,KAAKyW,EAAa,IAAM3T,mBAAmBxE,GAfrD,CAmBL,OAAOK,EAAO4E,KAAK,MAE1BwQ,CAAD"} \ 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/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 __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 (_) 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: n === \"return\" } : 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 data: {[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.data = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\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.data?.message;\n if (!this.message) {\n this.message = this.isAbort ?\n 'The request was autocancelled. More info you could find in https://github.com/pocketbase/js-sdk#auto-cancellation.' :\n 'Something went wrong while processing your request.';\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 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 * 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 * Creates a seep clone of the current model.\n */\n clone(): BaseModel {\n return new (this.constructor as any)(JSON.parse(JSON.stringify(this)));\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n export(): { [key: string]: any } {\n return 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 this.expand = typeof data.expand === 'object' && data.expand !== null ? data.expand : {};\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\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 storage connection test.\n */\n testS3(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\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","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} 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 *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(batch = 200, queryParams: ListQueryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath, batch, queryParams);\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 = 100, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize, 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 'headers': {\n 'Authorization': '',\n },\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 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} 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;\n record: T;\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(batch = 200, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getFullList(batch, queryParams);\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 typeof this.client.authStore.model?.collectionId !== 'undefined' && // is 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 if (\n success &&\n typeof this.client.authStore.model?.collectionId !== 'undefined' && // is record auth\n this.client.authStore.model?.id === id\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 'headers': {\n 'Authorization': '',\n },\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2.\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 authWithOAuth2(\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 * 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","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n unique!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.load(data || {});\n }\n\n /**\n * Loads `data` into the field.\n */\n load(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.unique = !!data.unique;\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 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 : {};\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 * Checks if the current model is \"base\" collection.\n */\n get isBase(): boolean {\n return this.type === 'base';\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 * Checks if the current model is \"single\" collection.\n */\n get isSingle(): boolean {\n return this.type === 'single';\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 private clientId: string = \"\";\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 10000;\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 * 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 10s 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}\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 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 Record from '@/models/Record';\nimport { FileQueryParams } from '@/services/utils/QueryParams';\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/modify the request config.\n *\n * Returns the new modified config that will be used to send the request.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, reqConfig) {\n * reqConfig.headers = Object.assign({}, reqConfig.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return reqConfig;\n * };\n * ```\n */\n beforeSend?: (url: string, reqConfig: { [key: string]: any }) => { [key: string]: any };\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 **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 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.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(this);\n this.health = new HealthService(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, reqConfig: { [key: string]: any }): Promise {\n let config = Object.assign({ method: 'GET' } as { [key: string]: any }, reqConfig);\n\n // serialize the body if needed and set the correct content type\n // note1: for FormData body the Content-Type header should be skipped\n // note2: we are checking the constructor name because FormData is not available natively in node\n if (config.body && config.body.constructor.name !== 'FormData') {\n if (typeof config.body !== 'string') {\n config.body = JSON.stringify(config.body);\n }\n\n // add the json header (if not already)\n if (typeof config?.headers?.['Content-Type'] === 'undefined') {\n config.headers = Object.assign({}, config.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof config?.headers?.['Accept-Language'] === 'undefined') {\n config.headers = Object.assign({}, config.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 config?.headers?.Authorization === 'undefined')\n ) {\n config.headers = Object.assign({}, config.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && config.params?.$autoCancel !== false) {\n const cancelKey = config.params?.$cancelKey || ((config.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 config.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete config.params?.$autoCancel;\n delete config.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof config.params !== 'undefined') {\n const query = this.serializeQueryParams(config.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete config.params;\n }\n\n if (this.beforeSend) {\n config = Object.assign({}, this.beforeSend(url, config));\n }\n\n // send the request\n return fetch(url, config)\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 = 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;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getFileUrl(record: Record, filename: string, queryParams: FileQueryParams = {}): 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.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 * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl + (this.baseUrl.endsWith('/') ? '' : '/');\n if (path) {\n url += (path.startsWith('/') ? path.substring(1) : path);\n }\n return url;\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","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","data","isAbort","originalError","DOMException","name","message","_a","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","toString","Date","isDate","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","_i","entries","_b","key","id","created","updated","defineProperty","get","clone","stringify","export","Record","collectionId","collectionName","expand","Admin","avatar","email","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","expirationThreshold","payload","keys","exp","now","isTokenExpired","save","model","triggerChange","clear","loadFromCookie","cookie","rawData","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","cookieParse","isArray","exportToCookie","defaultOptions","resultLength","Blob","size","_c","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","testEmail","toEmail","emailTemplate","template","ListResult","page","perPage","totalItems","totalPages","items","CrudService","getFullList","batch","_getFullList","baseCrudPath","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","headers","Authorization","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2","codeVerifier","redirectUrl","createData","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","SchemaField","type","system","required","unique","Collection","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","clientId","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","buildUrl","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","includes","timeout","fromReconnect","close","HealthService","check","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","logs","settings","health","collection","idOrName","autoCancellation","enable","cancelRequest","cancelKey","abort","cancelAllRequests","k","reqConfig","config","_d","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","query","serializeQueryParams","beforeSend","fetch","response","json","afterSend","getFileUrl","filename","parts","URLSearchParams","endsWith","substring","encodedKey","value_1","toISOString"],"mappings":"AAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,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,EAAcC,EAAGC,EAC5B,EAEO,SAASS,EAAUV,EAAGC,GACzB,GAAiB,mBAANA,GAA0B,OAANA,EAC3B,MAAM,IAAIU,UAAU,uBAAyBC,OAAOX,GAAK,iCAE7D,SAASY,IAAOC,KAAKC,YAAcf,CAAI,CADvCD,EAAcC,EAAGC,GAEjBD,EAAEO,UAAkB,OAANN,EAAaC,OAAOc,OAAOf,IAAMY,EAAGN,UAAYN,EAAEM,UAAW,IAAIM,EACnF,CAEO,IAAII,EAAW,WAQlB,OAPAA,EAAWf,OAAOgB,QAAU,SAAkBC,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,EAASQ,MAAMX,KAAMS,UAChC,EA6BO,SAASG,EAAUC,EAASC,EAAYC,EAAGC,GAE9C,OAAO,IAAKD,IAAMA,EAAIE,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUC,GA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AAMwY,gBAChC,cAAVxY,GAAmC,iBAAVA,EACvCK,EAAOqB,KAAK4W,EAAa,IAAM9T,mBAAmBU,KAAKyB,UAAU3G,KAEjEK,EAAOqB,KAAK4W,EAAa,IAAM9T,mBAAmBxE,GAfrD,CAmBL,OAAOK,EAAO4E,KAAK,MAE1B0Q,CAAD"} \ No newline at end of file diff --git a/dist/pocketbase.iife.d.ts b/dist/pocketbase.iife.d.ts index b540464..6b0a7e7 100644 --- a/dist/pocketbase.iife.d.ts +++ b/dist/pocketbase.iife.d.ts @@ -735,6 +735,16 @@ declare class LogService extends BaseService { */ getRequestsStats(queryParams?: LogStatsQueryParams): Promise>; } +interface healthCheckResponse { + code: number; + message: string; +} +declare class HealthService extends BaseService { + /** + * Checks the health status of the api. + */ + check(queryParams?: BaseQueryParams): Promise; +} /** * PocketBase JS Client. */ @@ -818,6 +828,10 @@ declare class Client { * An instance of the service that handles the **Realtime APIs**. */ readonly realtime: RealtimeService; + /** + * An instance of the service that handles the **Health APIs**. + */ + readonly health: HealthService; private cancelControllers; private recordServices; private enableAutoCancellation; diff --git a/dist/pocketbase.iife.js b/dist/pocketbase.iife.js index 00c5057..c19ddeb 100644 --- a/dist/pocketbase.iife.js +++ b/dist/pocketbase.iife.js @@ -1,2 +1,2 @@ -var PocketBase=function(){"use strict";var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var h=function(){function t(t){void 0===t&&(t={}),this.load(t||{})}return t.prototype.load=function(t){for(var e=0,n=Object.entries(t);e0&&(!n.exp||n.exp-e>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t||"",this.baseModel=null!==e&&"object"==typeof e?void 0!==e.collectionId?new p(e):new f(e):null,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},t.prototype.loadFromCookie=function(t,e){void 0===e&&(e=v);var n=function(t,e){var n={};if("string"!=typeof t)return n;for(var i=Object.assign({},e||{}).decode||c,o=0;o4096&&(a.model={id:null===(i=null==a?void 0:a.model)||void 0===i?void 0:i.id,email:null===(o=null==a?void 0:a.model)||void 0===o?void 0:o.email},this.model instanceof p&&(a.model.username=this.model.username,a.model.verified=this.model.verified,a.model.collectionId=this.model.collectionId),c=u(e,JSON.stringify(a),t)),c},t.prototype.onChange=function(t,e){var n=this;return void 0===e&&(e=!1),this._onChangeCallbacks.push(t),e&&t(this.token,this.model),function(){for(var e=n._onChangeCallbacks.length-1;e>=0;e--)if(n._onChangeCallbacks[e]==t)return delete n._onChangeCallbacks[e],void n._onChangeCallbacks.splice(e,1)}},t.prototype.triggerChange=function(){for(var t=0,e=this._onChangeCallbacks;t0?t:1,this.perPage=e>=0?e:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},w=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype._getFullList=function(t,e,n){var r=this;void 0===e&&(e=100),void 0===n&&(n={});var s=[],a=function(u){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,u,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?a(u+1):s}))]}))}))};return a(1)},n.prototype._getList=function(t,e,n,i){var o=this;return void 0===e&&(e=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:e,perPage:n},i),this.client.send(t,{method:"GET",params:i}).then((function(t){var e=[];if(null==t?void 0:t.items){t.items=t.items||[];for(var n=0,i=t.items;n=0;r--)this.subscriptions[t][r]===e&&(i=!0,delete this.subscriptions[t][r],this.subscriptions[t].splice(r,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(t,e));return i?(this.subscriptions[t].length||delete this.subscriptions[t],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(t)?[3,3]:[4,this.submitSubscriptions()];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},n.prototype.hasSubscriptionListeners=function(t){var e,n;if(this.subscriptions=this.subscriptions||{},t)return!!(null===(e=this.subscriptions[t])||void 0===e?void 0:e.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},n.prototype.submitSubscriptions=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){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(t){if(!(null==t?void 0:t.isAbort))throw t}))]):[2]}))}))},n.prototype.getNonEmptySubscriptionTopics=function(){var t=[];for(var e in this.subscriptions)this.subscriptions[e].length&&t.push(e);return t},n.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var t in this.removeAllSubscriptionListeners(),this.subscriptions)for(var e=0,n=this.subscriptions[t];e0?[2]:[2,new Promise((function(e,n){t.pendingConnects.push({resolve:e,reject:n}),t.pendingConnects.length>1||t.initConnect()}))]}))}))},n.prototype.initConnect=function(){var t=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){t.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(e){t.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(e){var n=e;t.clientId=null==n?void 0:n.lastEventId,t.submitSubscriptions().then((function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:t=3,e.label=1;case 1:return this.hasUnsentSubscriptions()&&t>0?(t--,[4,this.submitSubscriptions()]):[3,3];case 2:return e.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var e=0,n=t.pendingConnects;ethis.maxReconnectAttempts){for(var n=0,i=this.pendingConnects;n=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},t.prototype.getFileUrl=function(t,e,n){void 0===n&&(n={});var i=[];i.push("api"),i.push("files"),i.push(encodeURIComponent(t.collectionId||t.collectionName)),i.push(encodeURIComponent(t.id)),i.push(encodeURIComponent(e));var o=this.buildUrl(i.join("/"));if(Object.keys(n).length){var r=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+r}return o},t.prototype.buildUrl=function(t){var e=this.baseUrl+(this.baseUrl.endsWith("/")?"":"/");return t&&(e+=t.startsWith("/")?t.substring(1):t),e},t.prototype.serializeQueryParams=function(t){var e=[];for(var n in t)if(null!==t[n]){var i=t[n],o=encodeURIComponent(n);if(Array.isArray(i))for(var r=0,s=i;r0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var d=function(){function t(t){void 0===t&&(t={}),this.load(t||{})}return t.prototype.load=function(t){for(var e=0,n=Object.entries(t);e0&&(!n.exp||n.exp-e>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t||"",this.baseModel=null!==e&&"object"==typeof e?void 0!==e.collectionId?new p(e):new f(e):null,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},t.prototype.loadFromCookie=function(t,e){void 0===e&&(e=v);var n=function(t,e){var n={};if("string"!=typeof t)return n;for(var i=Object.assign({},e||{}).decode||c,o=0;o4096&&(a.model={id:null===(i=null==a?void 0:a.model)||void 0===i?void 0:i.id,email:null===(o=null==a?void 0:a.model)||void 0===o?void 0:o.email},this.model instanceof p&&(a.model.username=this.model.username,a.model.verified=this.model.verified,a.model.collectionId=this.model.collectionId),c=u(e,JSON.stringify(a),t)),c},t.prototype.onChange=function(t,e){var n=this;return void 0===e&&(e=!1),this._onChangeCallbacks.push(t),e&&t(this.token,this.model),function(){for(var e=n._onChangeCallbacks.length-1;e>=0;e--)if(n._onChangeCallbacks[e]==t)return delete n._onChangeCallbacks[e],void n._onChangeCallbacks.splice(e,1)}},t.prototype.triggerChange=function(){for(var t=0,e=this._onChangeCallbacks;t0?t:1,this.perPage=e>=0?e:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},w=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype._getFullList=function(t,e,n){var r=this;void 0===e&&(e=100),void 0===n&&(n={});var s=[],a=function(u){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,u,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?a(u+1):s}))]}))}))};return a(1)},n.prototype._getList=function(t,e,n,i){var o=this;return void 0===e&&(e=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:e,perPage:n},i),this.client.send(t,{method:"GET",params:i}).then((function(t){var e=[];if(null==t?void 0:t.items){t.items=t.items||[];for(var n=0,i=t.items;n=0;r--)this.subscriptions[t][r]===e&&(i=!0,delete this.subscriptions[t][r],this.subscriptions[t].splice(r,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(t,e));return i?(this.subscriptions[t].length||delete this.subscriptions[t],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(t)?[3,3]:[4,this.submitSubscriptions()];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},n.prototype.hasSubscriptionListeners=function(t){var e,n;if(this.subscriptions=this.subscriptions||{},t)return!!(null===(e=this.subscriptions[t])||void 0===e?void 0:e.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},n.prototype.submitSubscriptions=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){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(t){if(!(null==t?void 0:t.isAbort))throw t}))]):[2]}))}))},n.prototype.getNonEmptySubscriptionTopics=function(){var t=[];for(var e in this.subscriptions)this.subscriptions[e].length&&t.push(e);return t},n.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var t in this.removeAllSubscriptionListeners(),this.subscriptions)for(var e=0,n=this.subscriptions[t];e0?[2]:[2,new Promise((function(e,n){t.pendingConnects.push({resolve:e,reject:n}),t.pendingConnects.length>1||t.initConnect()}))]}))}))},n.prototype.initConnect=function(){var t=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){t.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(e){t.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(e){var n=e;t.clientId=null==n?void 0:n.lastEventId,t.submitSubscriptions().then((function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:t=3,e.label=1;case 1:return this.hasUnsentSubscriptions()&&t>0?(t--,[4,this.submitSubscriptions()]):[3,3];case 2:return e.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var e=0,n=t.pendingConnects;ethis.maxReconnectAttempts){for(var n=0,i=this.pendingConnects;n=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},t.prototype.getFileUrl=function(t,e,n){void 0===n&&(n={});var i=[];i.push("api"),i.push("files"),i.push(encodeURIComponent(t.collectionId||t.collectionName)),i.push(encodeURIComponent(t.id)),i.push(encodeURIComponent(e));var o=this.buildUrl(i.join("/"));if(Object.keys(n).length){var r=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+r}return o},t.prototype.buildUrl=function(t){var e=this.baseUrl+(this.baseUrl.endsWith("/")?"":"/");return t&&(e+=t.startsWith("/")?t.substring(1):t),e},t.prototype.serializeQueryParams=function(t){var e=[];for(var n in t)if(null!==t[n]){var i=t[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 __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 (_) 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: n === \"return\" } : 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 data: {[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.data = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\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.data?.message;\n if (!this.message) {\n this.message = this.isAbort ?\n 'The request was autocancelled. More info you could find in https://github.com/pocketbase/js-sdk#auto-cancellation.' :\n 'Something went wrong while processing your request.';\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 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 * 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 * Creates a seep clone of the current model.\n */\n clone(): BaseModel {\n return new (this.constructor as any)(JSON.parse(JSON.stringify(this)));\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n export(): { [key: string]: any } {\n return 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 this.expand = typeof data.expand === 'object' && data.expand !== null ? data.expand : {};\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\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 storage connection test.\n */\n testS3(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\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","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 = 100, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize, 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} 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 *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(batch = 200, queryParams: ListQueryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath, batch, queryParams);\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 'headers': {\n 'Authorization': '',\n },\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 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} 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;\n record: T;\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(batch = 200, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getFullList(batch, queryParams);\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 typeof this.client.authStore.model?.collectionId !== 'undefined' && // is 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 if (\n success &&\n typeof this.client.authStore.model?.collectionId !== 'undefined' && // is record auth\n this.client.authStore.model?.id === id\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 'headers': {\n 'Authorization': '',\n },\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2.\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 authWithOAuth2(\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 * 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","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n unique!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.load(data || {});\n }\n\n /**\n * Loads `data` into the field.\n */\n load(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.unique = !!data.unique;\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 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 : {};\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 * Checks if the current model is \"base\" collection.\n */\n get isBase(): boolean {\n return this.type === 'base';\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 * Checks if the current model is \"single\" collection.\n */\n get isSingle(): boolean {\n return this.type === 'single';\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 private clientId: string = \"\";\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 10000;\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 * 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 10s 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 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 Record from '@/models/Record';\nimport { FileQueryParams } from '@/services/utils/QueryParams';\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/modify the request config.\n *\n * Returns the new modified config that will be used to send the request.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, reqConfig) {\n * reqConfig.headers = Object.assign({}, reqConfig.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return reqConfig;\n * };\n * ```\n */\n beforeSend?: (url: string, reqConfig: { [key: string]: any }) => { [key: string]: any };\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 **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 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.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(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, reqConfig: { [key: string]: any }): Promise {\n let config = Object.assign({ method: 'GET' } as { [key: string]: any }, reqConfig);\n\n // serialize the body if needed and set the correct content type\n // note1: for FormData body the Content-Type header should be skipped\n // note2: we are checking the constructor name because FormData is not available natively in node\n if (config.body && config.body.constructor.name !== 'FormData') {\n if (typeof config.body !== 'string') {\n config.body = JSON.stringify(config.body);\n }\n\n // add the json header (if not already)\n if (typeof config?.headers?.['Content-Type'] === 'undefined') {\n config.headers = Object.assign({}, config.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof config?.headers?.['Accept-Language'] === 'undefined') {\n config.headers = Object.assign({}, config.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 config?.headers?.Authorization === 'undefined')\n ) {\n config.headers = Object.assign({}, config.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && config.params?.$autoCancel !== false) {\n const cancelKey = config.params?.$cancelKey || ((config.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 config.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete config.params?.$autoCancel;\n delete config.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof config.params !== 'undefined') {\n const query = this.serializeQueryParams(config.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete config.params;\n }\n\n if (this.beforeSend) {\n config = Object.assign({}, this.beforeSend(url, config));\n }\n\n // send the request\n return fetch(url, config)\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 = 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;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getFileUrl(record: Record, filename: string, queryParams: FileQueryParams = {}): 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.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 * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl + (this.baseUrl.endsWith('/') ? '' : '/');\n if (path) {\n url += (path.startsWith('/') ? path.substring(1) : path);\n }\n return url;\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","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","data","isAbort","originalError","DOMException","name","message","_a","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","toString","Date","isDate","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","_i","entries","_b","key","id","created","updated","defineProperty","get","clone","stringify","export","Record","collectionId","collectionName","expand","Admin","avatar","email","defaultCookieKey","LocalAuthStore","storageKey","storageFallback","_storageGet","model","save","_storageSet","clear","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","expirationThreshold","payload","keys","exp","now","isTokenExpired","triggerChange","loadFromCookie","cookie","rawData","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","cookieParse","isArray","exportToCookie","defaultOptions","resultLength","Blob","size","_c","username","verified","onChange","callback","fireImmediately","splice","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","testEmail","toEmail","emailTemplate","template","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","batch","baseCrudPath","getList","getFirstListItem","getOne","delete","AdminService","authStore","success","authResponse","admin","authWithPassword","password","identity","headers","Authorization","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2","codeVerifier","redirectUrl","createData","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","SchemaField","type","system","required","unique","Collection","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","clientId","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","buildUrl","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","includes","timeout","fromReconnect","close","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","logs","settings","collection","idOrName","autoCancellation","enable","cancelRequest","cancelKey","abort","cancelAllRequests","k","reqConfig","config","_d","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","query","serializeQueryParams","beforeSend","fetch","response","json","afterSend","getFileUrl","filename","parts","URLSearchParams","endsWith","substring","encodedKey","value_1","toISOString"],"mappings":"uCAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,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,EAAcC,EAAGC,EAC5B,EAEO,SAASS,EAAUV,EAAGC,GACzB,GAAiB,mBAANA,GAA0B,OAANA,EAC3B,MAAM,IAAIU,UAAU,uBAAyBC,OAAOX,GAAK,iCAE7D,SAASY,IAAOC,KAAKC,YAAcf,CAAI,CADvCD,EAAcC,EAAGC,GAEjBD,EAAEO,UAAkB,OAANN,EAAaC,OAAOc,OAAOf,IAAMY,EAAGN,UAAYN,EAAEM,UAAW,IAAIM,EACnF,CAEO,IAAII,EAAW,WAQlB,OAPAA,EAAWf,OAAOgB,QAAU,SAAkBC,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,EAASQ,MAAMX,KAAMS,UAChC,EA6BO,SAASG,EAAUC,EAASC,EAAYC,EAAGC,GAE9C,OAAO,IAAKD,IAAMA,EAAI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D"} \ 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/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 __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 (_) 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: n === \"return\" } : 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 data: {[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.data = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\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.data?.message;\n if (!this.message) {\n this.message = this.isAbort ?\n 'The request was autocancelled. More info you could find in https://github.com/pocketbase/js-sdk#auto-cancellation.' :\n 'Something went wrong while processing your request.';\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 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 * 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 * Creates a seep clone of the current model.\n */\n clone(): BaseModel {\n return new (this.constructor as any)(JSON.parse(JSON.stringify(this)));\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n export(): { [key: string]: any } {\n return 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 this.expand = typeof data.expand === 'object' && data.expand !== null ? data.expand : {};\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\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 storage connection test.\n */\n testS3(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\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","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 = 100, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize, 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} 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 *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(batch = 200, queryParams: ListQueryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath, batch, queryParams);\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 'headers': {\n 'Authorization': '',\n },\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 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} 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;\n record: T;\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(batch = 200, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getFullList(batch, queryParams);\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 typeof this.client.authStore.model?.collectionId !== 'undefined' && // is 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 if (\n success &&\n typeof this.client.authStore.model?.collectionId !== 'undefined' && // is record auth\n this.client.authStore.model?.id === id\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 'headers': {\n 'Authorization': '',\n },\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2.\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 authWithOAuth2(\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 * 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","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n unique!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.load(data || {});\n }\n\n /**\n * Loads `data` into the field.\n */\n load(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.unique = !!data.unique;\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 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 : {};\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 * Checks if the current model is \"base\" collection.\n */\n get isBase(): boolean {\n return this.type === 'base';\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 * Checks if the current model is \"single\" collection.\n */\n get isSingle(): boolean {\n return this.type === 'single';\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 private clientId: string = \"\";\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 10000;\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 * 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 10s 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}\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 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 Record from '@/models/Record';\nimport { FileQueryParams } from '@/services/utils/QueryParams';\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/modify the request config.\n *\n * Returns the new modified config that will be used to send the request.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, reqConfig) {\n * reqConfig.headers = Object.assign({}, reqConfig.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return reqConfig;\n * };\n * ```\n */\n beforeSend?: (url: string, reqConfig: { [key: string]: any }) => { [key: string]: any };\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 **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 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.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(this);\n this.health = new HealthService(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, reqConfig: { [key: string]: any }): Promise {\n let config = Object.assign({ method: 'GET' } as { [key: string]: any }, reqConfig);\n\n // serialize the body if needed and set the correct content type\n // note1: for FormData body the Content-Type header should be skipped\n // note2: we are checking the constructor name because FormData is not available natively in node\n if (config.body && config.body.constructor.name !== 'FormData') {\n if (typeof config.body !== 'string') {\n config.body = JSON.stringify(config.body);\n }\n\n // add the json header (if not already)\n if (typeof config?.headers?.['Content-Type'] === 'undefined') {\n config.headers = Object.assign({}, config.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof config?.headers?.['Accept-Language'] === 'undefined') {\n config.headers = Object.assign({}, config.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 config?.headers?.Authorization === 'undefined')\n ) {\n config.headers = Object.assign({}, config.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && config.params?.$autoCancel !== false) {\n const cancelKey = config.params?.$cancelKey || ((config.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 config.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete config.params?.$autoCancel;\n delete config.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof config.params !== 'undefined') {\n const query = this.serializeQueryParams(config.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete config.params;\n }\n\n if (this.beforeSend) {\n config = Object.assign({}, this.beforeSend(url, config));\n }\n\n // send the request\n return fetch(url, config)\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 = 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;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getFileUrl(record: Record, filename: string, queryParams: FileQueryParams = {}): 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.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 * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl + (this.baseUrl.endsWith('/') ? '' : '/');\n if (path) {\n url += (path.startsWith('/') ? path.substring(1) : path);\n }\n return url;\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","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","data","isAbort","originalError","DOMException","name","message","_a","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","toString","Date","isDate","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","_i","entries","_b","key","id","created","updated","defineProperty","get","clone","stringify","export","Record","collectionId","collectionName","expand","Admin","avatar","email","defaultCookieKey","LocalAuthStore","storageKey","storageFallback","_storageGet","model","save","_storageSet","clear","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","expirationThreshold","payload","keys","exp","now","isTokenExpired","triggerChange","loadFromCookie","cookie","rawData","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","cookieParse","isArray","exportToCookie","defaultOptions","resultLength","Blob","size","_c","username","verified","onChange","callback","fireImmediately","splice","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","testEmail","toEmail","emailTemplate","template","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","batch","baseCrudPath","getList","getFirstListItem","getOne","delete","AdminService","authStore","success","authResponse","admin","authWithPassword","password","identity","headers","Authorization","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2","codeVerifier","redirectUrl","createData","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","SchemaField","type","system","required","unique","Collection","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","clientId","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","buildUrl","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","includes","timeout","fromReconnect","close","HealthService","check","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","logs","settings","health","collection","idOrName","autoCancellation","enable","cancelRequest","cancelKey","abort","cancelAllRequests","k","reqConfig","config","_d","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","query","serializeQueryParams","beforeSend","fetch","response","json","afterSend","getFileUrl","filename","parts","URLSearchParams","endsWith","substring","encodedKey","value_1","toISOString"],"mappings":"uCAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,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,EAAcC,EAAGC,EAC5B,EAEO,SAASS,EA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,gBAAgBxN,GACnCvK,IAAWA,EAAOiV,SAAS,KAAO,IAAM,KAAOvK,CAClD,CAED,OAAO1K,GAMXuV,EAAQxX,UAAA0W,SAAR,SAASrR,GACL,IAAIzB,EAAMrD,KAAKkX,SAAWlX,KAAKkX,QAAQwC,SAAS,KAAO,GAAK,KAI5D,OAHI5U,IACAzB,GAAQyB,EAAKuQ,WAAW,KAAOvQ,EAAK6U,UAAU,GAAK7U,GAEhDzB,GAMH4T,EAAoBxX,UAAAuZ,qBAA5B,SAA6B5M,GACzB,IAAM1K,EAAwB,GAC9B,IAAK,IAAM+F,KAAO2E,EACd,GAAoB,OAAhBA,EAAO3E,GAAX,CAKA,IAAMpG,EAAQ+K,EAAO3E,GACfmS,EAAa/T,mBAAmB4B,GAEtC,GAAIlI,MAAMyL,QAAQ3J,GAEd,IAAgB,QAAAwY,EAAAxY,EAAAiG,EAAKuS,EAAAnZ,OAAL4G,IAAO,CAAlB,IAAM1E,EAACiX,EAAAvS,GACR5F,EAAOqB,KAAK6W,EAAa,IAAM/T,mBAAmBjD,GACrD,MACMvB,aAAiB4D,KACxBvD,EAAOqB,KAAK6W,EAAa,IAAM/T,mBAAmBxE,EAAMyY,gBAChC,cAAVzY,GAAmC,iBAAVA,EACvCK,EAAOqB,KAAK6W,EAAa,IAAM/T,mBAAmBU,KAAKyB,UAAU3G,KAEjEK,EAAOqB,KAAK6W,EAAa,IAAM/T,mBAAmBxE,GAfrD,CAmBL,OAAOK,EAAO4E,KAAK,MAE1B2Q,CAAD"} \ No newline at end of file diff --git a/dist/pocketbase.umd.d.ts b/dist/pocketbase.umd.d.ts index b540464..6b0a7e7 100644 --- a/dist/pocketbase.umd.d.ts +++ b/dist/pocketbase.umd.d.ts @@ -735,6 +735,16 @@ declare class LogService extends BaseService { */ getRequestsStats(queryParams?: LogStatsQueryParams): Promise>; } +interface healthCheckResponse { + code: number; + message: string; +} +declare class HealthService extends BaseService { + /** + * Checks the health status of the api. + */ + check(queryParams?: BaseQueryParams): Promise; +} /** * PocketBase JS Client. */ @@ -818,6 +828,10 @@ declare class Client { * An instance of the service that handles the **Realtime APIs**. */ readonly realtime: RealtimeService; + /** + * An instance of the service that handles the **Health APIs**. + */ + readonly health: HealthService; private cancelControllers; private recordServices; private enableAutoCancellation; diff --git a/dist/pocketbase.umd.js b/dist/pocketbase.umd.js index cf70bb3..117abd3 100644 --- a/dist/pocketbase.umd.js +++ b/dist/pocketbase.umd.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).PocketBase=e()}(this,(function(){"use strict";var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var h=function(){function t(t){void 0===t&&(t={}),this.load(t||{})}return t.prototype.load=function(t){for(var e=0,n=Object.entries(t);e0&&(!n.exp||n.exp-e>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t||"",this.baseModel=null!==e&&"object"==typeof e?void 0!==e.collectionId?new p(e):new f(e):null,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},t.prototype.loadFromCookie=function(t,e){void 0===e&&(e=v);var n=function(t,e){var n={};if("string"!=typeof t)return n;for(var i=Object.assign({},e||{}).decode||c,o=0;o4096&&(a.model={id:null===(i=null==a?void 0:a.model)||void 0===i?void 0:i.id,email:null===(o=null==a?void 0:a.model)||void 0===o?void 0:o.email},this.model instanceof p&&(a.model.username=this.model.username,a.model.verified=this.model.verified,a.model.collectionId=this.model.collectionId),c=u(e,JSON.stringify(a),t)),c},t.prototype.onChange=function(t,e){var n=this;return void 0===e&&(e=!1),this._onChangeCallbacks.push(t),e&&t(this.token,this.model),function(){for(var e=n._onChangeCallbacks.length-1;e>=0;e--)if(n._onChangeCallbacks[e]==t)return delete n._onChangeCallbacks[e],void n._onChangeCallbacks.splice(e,1)}},t.prototype.triggerChange=function(){for(var t=0,e=this._onChangeCallbacks;t0?t:1,this.perPage=e>=0?e:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},w=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype._getFullList=function(t,e,n){var r=this;void 0===e&&(e=100),void 0===n&&(n={});var s=[],a=function(u){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,u,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?a(u+1):s}))]}))}))};return a(1)},n.prototype._getList=function(t,e,n,i){var o=this;return void 0===e&&(e=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:e,perPage:n},i),this.client.send(t,{method:"GET",params:i}).then((function(t){var e=[];if(null==t?void 0:t.items){t.items=t.items||[];for(var n=0,i=t.items;n=0;r--)this.subscriptions[t][r]===e&&(i=!0,delete this.subscriptions[t][r],this.subscriptions[t].splice(r,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(t,e));return i?(this.subscriptions[t].length||delete this.subscriptions[t],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(t)?[3,3]:[4,this.submitSubscriptions()];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},n.prototype.hasSubscriptionListeners=function(t){var e,n;if(this.subscriptions=this.subscriptions||{},t)return!!(null===(e=this.subscriptions[t])||void 0===e?void 0:e.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},n.prototype.submitSubscriptions=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){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(t){if(!(null==t?void 0:t.isAbort))throw t}))]):[2]}))}))},n.prototype.getNonEmptySubscriptionTopics=function(){var t=[];for(var e in this.subscriptions)this.subscriptions[e].length&&t.push(e);return t},n.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var t in this.removeAllSubscriptionListeners(),this.subscriptions)for(var e=0,n=this.subscriptions[t];e0?[2]:[2,new Promise((function(e,n){t.pendingConnects.push({resolve:e,reject:n}),t.pendingConnects.length>1||t.initConnect()}))]}))}))},n.prototype.initConnect=function(){var t=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){t.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(e){t.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(e){var n=e;t.clientId=null==n?void 0:n.lastEventId,t.submitSubscriptions().then((function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:t=3,e.label=1;case 1:return this.hasUnsentSubscriptions()&&t>0?(t--,[4,this.submitSubscriptions()]):[3,3];case 2:return e.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var e=0,n=t.pendingConnects;ethis.maxReconnectAttempts){for(var n=0,i=this.pendingConnects;n=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},t.prototype.getFileUrl=function(t,e,n){void 0===n&&(n={});var i=[];i.push("api"),i.push("files"),i.push(encodeURIComponent(t.collectionId||t.collectionName)),i.push(encodeURIComponent(t.id)),i.push(encodeURIComponent(e));var o=this.buildUrl(i.join("/"));if(Object.keys(n).length){var r=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+r}return o},t.prototype.buildUrl=function(t){var e=this.baseUrl+(this.baseUrl.endsWith("/")?"":"/");return t&&(e+=t.startsWith("/")?t.substring(1):t),e},t.prototype.serializeQueryParams=function(t){var e=[];for(var n in t)if(null!==t[n]){var i=t[n],o=encodeURIComponent(n);if(Array.isArray(i))for(var r=0,s=i;r0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var h=function(){function t(t){void 0===t&&(t={}),this.load(t||{})}return t.prototype.load=function(t){for(var e=0,n=Object.entries(t);e0&&(!n.exp||n.exp-e>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t||"",this.baseModel=null!==e&&"object"==typeof e?void 0!==e.collectionId?new p(e):new f(e):null,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},t.prototype.loadFromCookie=function(t,e){void 0===e&&(e=v);var n=function(t,e){var n={};if("string"!=typeof t)return n;for(var i=Object.assign({},e||{}).decode||c,o=0;o4096&&(a.model={id:null===(i=null==a?void 0:a.model)||void 0===i?void 0:i.id,email:null===(o=null==a?void 0:a.model)||void 0===o?void 0:o.email},this.model instanceof p&&(a.model.username=this.model.username,a.model.verified=this.model.verified,a.model.collectionId=this.model.collectionId),c=u(e,JSON.stringify(a),t)),c},t.prototype.onChange=function(t,e){var n=this;return void 0===e&&(e=!1),this._onChangeCallbacks.push(t),e&&t(this.token,this.model),function(){for(var e=n._onChangeCallbacks.length-1;e>=0;e--)if(n._onChangeCallbacks[e]==t)return delete n._onChangeCallbacks[e],void n._onChangeCallbacks.splice(e,1)}},t.prototype.triggerChange=function(){for(var t=0,e=this._onChangeCallbacks;t0?t:1,this.perPage=e>=0?e:0,this.totalItems=n>=0?n:0,this.totalPages=i>=0?i:0,this.items=o||[]},w=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype._getFullList=function(t,e,n){var r=this;void 0===e&&(e=100),void 0===n&&(n={});var s=[],a=function(u){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,u,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?a(u+1):s}))]}))}))};return a(1)},n.prototype._getList=function(t,e,n,i){var o=this;return void 0===e&&(e=1),void 0===n&&(n=30),void 0===i&&(i={}),i=Object.assign({page:e,perPage:n},i),this.client.send(t,{method:"GET",params:i}).then((function(t){var e=[];if(null==t?void 0:t.items){t.items=t.items||[];for(var n=0,i=t.items;n=0;r--)this.subscriptions[t][r]===e&&(i=!0,delete this.subscriptions[t][r],this.subscriptions[t].splice(r,1),null===(n=this.eventSource)||void 0===n||n.removeEventListener(t,e));return i?(this.subscriptions[t].length||delete this.subscriptions[t],this.hasSubscriptionListeners()?[3,1]:(this.disconnect(),[3,3])):[2];case 1:return this.hasSubscriptionListeners(t)?[3,3]:[4,this.submitSubscriptions()];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},n.prototype.hasSubscriptionListeners=function(t){var e,n;if(this.subscriptions=this.subscriptions||{},t)return!!(null===(e=this.subscriptions[t])||void 0===e?void 0:e.length);for(var i in this.subscriptions)if(null===(n=this.subscriptions[i])||void 0===n?void 0:n.length)return!0;return!1},n.prototype.submitSubscriptions=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){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(t){if(!(null==t?void 0:t.isAbort))throw t}))]):[2]}))}))},n.prototype.getNonEmptySubscriptionTopics=function(){var t=[];for(var e in this.subscriptions)this.subscriptions[e].length&&t.push(e);return t},n.prototype.addAllSubscriptionListeners=function(){if(this.eventSource)for(var t in this.removeAllSubscriptionListeners(),this.subscriptions)for(var e=0,n=this.subscriptions[t];e0?[2]:[2,new Promise((function(e,n){t.pendingConnects.push({resolve:e,reject:n}),t.pendingConnects.length>1||t.initConnect()}))]}))}))},n.prototype.initConnect=function(){var t=this;this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout((function(){t.connectErrorHandler(new Error("EventSource connect took too long."))}),this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=function(e){t.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",(function(e){var n=e;t.clientId=null==n?void 0:n.lastEventId,t.submitSubscriptions().then((function(){return i(t,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:t=3,e.label=1;case 1:return this.hasUnsentSubscriptions()&&t>0?(t--,[4,this.submitSubscriptions()]):[3,3];case 2:return e.sent(),[3,1];case 3:return[2]}}))}))})).then((function(){for(var e=0,n=t.pendingConnects;ethis.maxReconnectAttempts){for(var n=0,i=this.pendingConnects;n=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},t.prototype.getFileUrl=function(t,e,n){void 0===n&&(n={});var i=[];i.push("api"),i.push("files"),i.push(encodeURIComponent(t.collectionId||t.collectionName)),i.push(encodeURIComponent(t.id)),i.push(encodeURIComponent(e));var o=this.buildUrl(i.join("/"));if(Object.keys(n).length){var r=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+r}return o},t.prototype.buildUrl=function(t){var e=this.baseUrl+(this.baseUrl.endsWith("/")?"":"/");return t&&(e+=t.startsWith("/")?t.substring(1):t),e},t.prototype.serializeQueryParams=function(t){var e=[];for(var n in t)if(null!==t[n]){var i=t[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 __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 (_) 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: n === \"return\" } : 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 data: {[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.data = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\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.data?.message;\n if (!this.message) {\n this.message = this.isAbort ?\n 'The request was autocancelled. More info you could find in https://github.com/pocketbase/js-sdk#auto-cancellation.' :\n 'Something went wrong while processing your request.';\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 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 * 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 * Creates a seep clone of the current model.\n */\n clone(): BaseModel {\n return new (this.constructor as any)(JSON.parse(JSON.stringify(this)));\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n export(): { [key: string]: any } {\n return 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 this.expand = typeof data.expand === 'object' && data.expand !== null ? data.expand : {};\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\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 storage connection test.\n */\n testS3(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\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","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 = 100, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize, 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} 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 *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(batch = 200, queryParams: ListQueryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath, batch, queryParams);\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 'headers': {\n 'Authorization': '',\n },\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 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} 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;\n record: T;\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(batch = 200, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getFullList(batch, queryParams);\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 typeof this.client.authStore.model?.collectionId !== 'undefined' && // is 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 if (\n success &&\n typeof this.client.authStore.model?.collectionId !== 'undefined' && // is record auth\n this.client.authStore.model?.id === id\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 'headers': {\n 'Authorization': '',\n },\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2.\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 authWithOAuth2(\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 * 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","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n unique!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.load(data || {});\n }\n\n /**\n * Loads `data` into the field.\n */\n load(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.unique = !!data.unique;\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 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 : {};\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 * Checks if the current model is \"base\" collection.\n */\n get isBase(): boolean {\n return this.type === 'base';\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 * Checks if the current model is \"single\" collection.\n */\n get isSingle(): boolean {\n return this.type === 'single';\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 private clientId: string = \"\";\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 10000;\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 * 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 10s 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 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 Record from '@/models/Record';\nimport { FileQueryParams } from '@/services/utils/QueryParams';\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/modify the request config.\n *\n * Returns the new modified config that will be used to send the request.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, reqConfig) {\n * reqConfig.headers = Object.assign({}, reqConfig.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return reqConfig;\n * };\n * ```\n */\n beforeSend?: (url: string, reqConfig: { [key: string]: any }) => { [key: string]: any };\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 **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 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.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(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, reqConfig: { [key: string]: any }): Promise {\n let config = Object.assign({ method: 'GET' } as { [key: string]: any }, reqConfig);\n\n // serialize the body if needed and set the correct content type\n // note1: for FormData body the Content-Type header should be skipped\n // note2: we are checking the constructor name because FormData is not available natively in node\n if (config.body && config.body.constructor.name !== 'FormData') {\n if (typeof config.body !== 'string') {\n config.body = JSON.stringify(config.body);\n }\n\n // add the json header (if not already)\n if (typeof config?.headers?.['Content-Type'] === 'undefined') {\n config.headers = Object.assign({}, config.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof config?.headers?.['Accept-Language'] === 'undefined') {\n config.headers = Object.assign({}, config.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 config?.headers?.Authorization === 'undefined')\n ) {\n config.headers = Object.assign({}, config.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && config.params?.$autoCancel !== false) {\n const cancelKey = config.params?.$cancelKey || ((config.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 config.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete config.params?.$autoCancel;\n delete config.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof config.params !== 'undefined') {\n const query = this.serializeQueryParams(config.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete config.params;\n }\n\n if (this.beforeSend) {\n config = Object.assign({}, this.beforeSend(url, config));\n }\n\n // send the request\n return fetch(url, config)\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 = 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;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getFileUrl(record: Record, filename: string, queryParams: FileQueryParams = {}): 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.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 * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl + (this.baseUrl.endsWith('/') ? '' : '/');\n if (path) {\n url += (path.startsWith('/') ? path.substring(1) : path);\n }\n return url;\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","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","data","isAbort","originalError","DOMException","name","message","_a","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","toString","Date","isDate","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","_i","entries","_b","key","id","created","updated","defineProperty","get","clone","stringify","export","Record","collectionId","collectionName","expand","Admin","avatar","email","defaultCookieKey","LocalAuthStore","storageKey","storageFallback","_storageGet","model","save","_storageSet","clear","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","expirationThreshold","payload","keys","exp","now","isTokenExpired","triggerChange","loadFromCookie","cookie","rawData","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","cookieParse","isArray","exportToCookie","defaultOptions","resultLength","Blob","size","_c","username","verified","onChange","callback","fireImmediately","splice","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","testEmail","toEmail","emailTemplate","template","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","batch","baseCrudPath","getList","getFirstListItem","getOne","delete","AdminService","authStore","success","authResponse","admin","authWithPassword","password","identity","headers","Authorization","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2","codeVerifier","redirectUrl","createData","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","SchemaField","type","system","required","unique","Collection","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","clientId","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","buildUrl","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","includes","timeout","fromReconnect","close","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","logs","settings","collection","idOrName","autoCancellation","enable","cancelRequest","cancelKey","abort","cancelAllRequests","k","reqConfig","config","_d","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","query","serializeQueryParams","beforeSend","fetch","response","json","afterSend","getFileUrl","filename","parts","URLSearchParams","endsWith","substring","encodedKey","value_1","toISOString"],"mappings":"2OAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SA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UAAA0W,SAAR,SAASrR,GACL,IAAIzB,EAAMrD,KAAKgX,SAAWhX,KAAKgX,QAAQuC,SAAS,KAAO,GAAK,KAI5D,OAHIzU,IACAzB,GAAQyB,EAAKuQ,WAAW,KAAOvQ,EAAK0U,UAAU,GAAK1U,GAEhDzB,GAMH0T,EAAoBtX,UAAAoZ,qBAA5B,SAA6BzM,GACzB,IAAM1K,EAAwB,GAC9B,IAAK,IAAM+F,KAAO2E,EACd,GAAoB,OAAhBA,EAAO3E,GAAX,CAKA,IAAMpG,EAAQ+K,EAAO3E,GACfgS,EAAa5T,mBAAmB4B,GAEtC,GAAIlI,MAAMyL,QAAQ3J,GAEd,IAAgB,QAAAqY,EAAArY,EAAAiG,EAAKoS,EAAAhZ,OAAL4G,IAAO,CAAlB,IAAM1E,EAAC8W,EAAApS,GACR5F,EAAOqB,KAAK0W,EAAa,IAAM5T,mBAAmBjD,GACrD,MACMvB,aAAiB4D,KACxBvD,EAAOqB,KAAK0W,EAAa,IAAM5T,mBAAmBxE,EAAMsY,gBAChC,cAAVtY,GAAmC,iBAAVA,EACvCK,EAAOqB,KAAK0W,EAAa,IAAM5T,mBAAmBU,KAAKyB,UAAU3G,KAEjEK,EAAOqB,KAAK0W,EAAa,IAAM5T,mBAAmBxE,GAfrD,CAmBL,OAAOK,EAAO4E,KAAK,MAE1ByQ,CAAD"} \ 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/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 __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 (_) 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: n === \"return\" } : 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 data: {[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.data = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\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.data?.message;\n if (!this.message) {\n this.message = this.isAbort ?\n 'The request was autocancelled. More info you could find in https://github.com/pocketbase/js-sdk#auto-cancellation.' :\n 'Something went wrong while processing your request.';\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 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 * 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 * Creates a seep clone of the current model.\n */\n clone(): BaseModel {\n return new (this.constructor as any)(JSON.parse(JSON.stringify(this)));\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n export(): { [key: string]: any } {\n return 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 this.expand = typeof data.expand === 'object' && data.expand !== null ? data.expand : {};\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\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 storage connection test.\n */\n testS3(queryParams: BaseQueryParams = {}): Promise {\n return this.client.send('/api/settings/test/s3', {\n 'method': 'POST',\n 'params': queryParams,\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","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 = 100, queryParams: ListQueryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize, 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} 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 *\n * You can use the generic T to supply a wrapper type of the crud model.\n */\n getFullList(batch = 200, queryParams: ListQueryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath, batch, queryParams);\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 'headers': {\n 'Authorization': '',\n },\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 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} 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;\n record: T;\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(batch = 200, queryParams: RecordListQueryParams = {}): Promise> {\n return super.getFullList(batch, queryParams);\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 typeof this.client.authStore.model?.collectionId !== 'undefined' && // is 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 if (\n success &&\n typeof this.client.authStore.model?.collectionId !== 'undefined' && // is record auth\n this.client.authStore.model?.id === id\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 'headers': {\n 'Authorization': '',\n },\n }).then((data) => this.authResponse(data));\n }\n\n /**\n * Authenticate a single auth collection record with OAuth2.\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 authWithOAuth2(\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 * 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","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n unique!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.load(data || {});\n }\n\n /**\n * Loads `data` into the field.\n */\n load(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.unique = !!data.unique;\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 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 : {};\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 * Checks if the current model is \"base\" collection.\n */\n get isBase(): boolean {\n return this.type === 'base';\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 * Checks if the current model is \"single\" collection.\n */\n get isSingle(): boolean {\n return this.type === 'single';\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 private clientId: string = \"\";\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: Array } = {};\n private lastSentTopics: Array = [];\n private connectTimeoutId: any;\n private maxConnectTimeout: number = 10000;\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 * 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 10s 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}\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 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 Record from '@/models/Record';\nimport { FileQueryParams } from '@/services/utils/QueryParams';\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/modify the request config.\n *\n * Returns the new modified config that will be used to send the request.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, reqConfig) {\n * reqConfig.headers = Object.assign({}, reqConfig.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return reqConfig;\n * };\n * ```\n */\n beforeSend?: (url: string, reqConfig: { [key: string]: any }) => { [key: string]: any };\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 **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 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.logs = new LogService(this);\n this.settings = new SettingsService(this);\n this.realtime = new RealtimeService(this);\n this.health = new HealthService(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, reqConfig: { [key: string]: any }): Promise {\n let config = Object.assign({ method: 'GET' } as { [key: string]: any }, reqConfig);\n\n // serialize the body if needed and set the correct content type\n // note1: for FormData body the Content-Type header should be skipped\n // note2: we are checking the constructor name because FormData is not available natively in node\n if (config.body && config.body.constructor.name !== 'FormData') {\n if (typeof config.body !== 'string') {\n config.body = JSON.stringify(config.body);\n }\n\n // add the json header (if not already)\n if (typeof config?.headers?.['Content-Type'] === 'undefined') {\n config.headers = Object.assign({}, config.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof config?.headers?.['Accept-Language'] === 'undefined') {\n config.headers = Object.assign({}, config.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 config?.headers?.Authorization === 'undefined')\n ) {\n config.headers = Object.assign({}, config.headers, {\n 'Authorization': this.authStore.token,\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (this.enableAutoCancellation && config.params?.$autoCancel !== false) {\n const cancelKey = config.params?.$cancelKey || ((config.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 config.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete config.params?.$autoCancel;\n delete config.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof config.params !== 'undefined') {\n const query = this.serializeQueryParams(config.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete config.params;\n }\n\n if (this.beforeSend) {\n config = Object.assign({}, this.beforeSend(url, config));\n }\n\n // send the request\n return fetch(url, config)\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 = 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;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Builds and returns an absolute record file url for the provided filename.\n */\n getFileUrl(record: Record, filename: string, queryParams: FileQueryParams = {}): 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.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 * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl + (this.baseUrl.endsWith('/') ? '' : '/');\n if (path) {\n url += (path.startsWith('/') ? path.substring(1) : path);\n }\n return url;\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","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","data","isAbort","originalError","DOMException","name","message","_a","toJSON","Error","fieldContentRegExp","cookieSerialize","val","options","opt","encode","defaultEncode","test","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","toString","Date","isDate","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","_i","entries","_b","key","id","created","updated","defineProperty","get","clone","stringify","export","Record","collectionId","collectionName","expand","Admin","avatar","email","defaultCookieKey","LocalAuthStore","storageKey","storageFallback","_storageGet","model","save","_storageSet","clear","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","expirationThreshold","payload","keys","exp","now","isTokenExpired","triggerChange","loadFromCookie","cookie","rawData","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","cookieParse","isArray","exportToCookie","defaultOptions","resultLength","Blob","size","_c","username","verified","onChange","callback","fireImmediately","splice","BaseService","client","SettingsService","getAll","queryParams","send","method","params","responseData","update","bodyParams","testS3","testEmail","toEmail","emailTemplate","template","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","batch","baseCrudPath","getList","getFirstListItem","getOne","delete","AdminService","authStore","success","authResponse","admin","authWithPassword","password","identity","headers","Authorization","bind","authRefresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","ExternalAuth","recordId","provider","providerId","RecordService","collectionIdOrName","baseCollectionPath","subscribeOne","console","warn","realtime","subscribe","topicOrCallback","topic","unsubscribe","unsubscribeByPrefix","record","listAuthMethods","usernamePassword","emailPassword","authProviders","usernameOrEmail","authWithOAuth2","codeVerifier","redirectUrl","createData","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","listExternalAuths","responseData_1","unlinkExternalAuth","SchemaField","type","system","required","unique","Collection","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","CollectionService","import","collections","deleteMissing","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","LogService","getRequestsList","getRequest","getRequestsStats","RealtimeService","clientId","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","buildUrl","onerror","lastEventId","retries","hasUnsentSubscriptions","reconnectTimeoutId","latestTopics","latestTopics_1","includes","timeout","fromReconnect","close","HealthService","check","Client","baseUrl","lang","cancelControllers","recordServices","enableAutoCancellation","admins","logs","settings","health","collection","idOrName","autoCancellation","enable","cancelRequest","cancelKey","abort","cancelAllRequests","k","reqConfig","config","_d","_e","$autoCancel","_f","controller","AbortController","signal","_g","_h","query","serializeQueryParams","beforeSend","fetch","response","json","afterSend","getFileUrl","filename","parts","URLSearchParams","endsWith","substring","encodedKey","value_1","toISOString"],"mappings":"2OAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,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,EAAcC,EAAGC,EAC5B,EAEO,SAASS,EAAUV,EAAGC,GACzB,GAAiB,mBAANA,GAA0B,OAANA,EAC3B,MAAM,IAAIU,UAAU,uBAAyBC,OAAOX,GAAK,iCAE7D,SAASY,IAAOC,KAAKC,YAAcf,CAAI,CADvCD,EAAcC,EAAGC,GAEjBD,EAAEO,UAAkB,OAANN,EAAaC,OAAOc,OAAOf,IAAMY,EAAGN,UAAYN,EAAEM,UAAW,IAAIM,EACnF,CAEO,IAAII,EAAW,WAQlB,OAPAA,EAAWf,OAAOgB,QAAU,SAAkBC,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAA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