From c9cf87093c3a6b9baad67d1ac892010a4e54fb9f Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Sun, 21 Aug 2022 14:18:48 +0300 Subject: [PATCH] updated logs and settings services --- README.md | 4 +++- dist/pocketbase.cjs.d.ts | 16 +++++++++++++++- dist/pocketbase.cjs.js | 2 +- dist/pocketbase.es.d.mts | 16 +++++++++++++++- dist/pocketbase.es.mjs | 2 +- dist/pocketbase.es.mjs.map | 2 +- dist/pocketbase.iife.d.ts | 16 +++++++++++++++- dist/pocketbase.iife.js | 2 +- dist/pocketbase.umd.d.ts | 16 +++++++++++++++- dist/pocketbase.umd.js | 2 +- package.json | 2 +- src/models/LogRequest.ts | 9 +++++++-- src/services/Settings.ts | 31 +++++++++++++++++++++++++++++++ tests/services/Settings.spec.ts | 31 +++++++++++++++++++++++++++++++ 14 files changed, 138 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 78f0a60..ba7e898 100644 --- a/README.md +++ b/README.md @@ -329,7 +329,7 @@ const client = new PocketBase( | 🔐`client.users.delete(id, queryParams = {})` | Deletes an existing user by its id. | | **[Realtime](https://pocketbase.io/docs/api-realtime)**
_(for node environments you'll have to install an EventSource polyfill beforehand, eg. https://github.com/EventSource/eventsource)_ | | | 🔓`client.realtime.subscribe(subscription, callback)` | Inits the sse connection (if not already) and register the subscription. | -| 🔓`client.realtime.unsubscribe(subscription = "")` | Unsubscribe from a subscription (if empty - unsubscribe from all registered subscriptions). | +| 🔓`client.realtime.unsubscribe(subscription = "")` | Unsubscribe from a subscription (if empty - unsubscribe from all registered subscriptions). | | **[Collections](https://pocketbase.io/docs/api-collections)** | | | 🔐`client.collections.getList(page = 1, perPage = 30, queryParams = {})` | Returns paginated collections list. | | 🔐`client.collections.getFullList(batchSize = 100, queryParams = {})` | Returns a list with all collections batch fetched at once. | @@ -352,6 +352,8 @@ const client = new PocketBase( | **[Settings](https://pocketbase.io/docs/api-records)** | | | 🔐`client.settings.getAll(queryParams = {})` | Fetch all available app settings. | | 🔐`client.settings.update(bodyParams = {}, queryParams = {})` | Bulk updates app settings. | +| 🔐`client.settings.testS3(queryParams = {})` | Performs a S3 storage connection test. | +| 🔐`client.settings.testEmail(toEmail, emailTemplate, queryParams = {})` | Sends a test email. | ## Development diff --git a/dist/pocketbase.cjs.d.ts b/dist/pocketbase.cjs.d.ts index d3d68d2..46eff9a 100644 --- a/dist/pocketbase.cjs.d.ts +++ b/dist/pocketbase.cjs.d.ts @@ -115,6 +115,19 @@ declare class Settings extends BaseService { update(bodyParams?: {}, queryParams?: {}): Promise<{ [key: string]: any; }>; + /** + * Performs a S3 storage connection test. + */ + testS3(queryParams?: {}): Promise; + /** + * Sends a test email. + * + * The possible `emailTemplate` values are: + * - verification + * - password-reset + * - email-change + */ + testEmail(toEmail: string, emailTemplate: string, queryParams?: {}): Promise; } declare class ListResult { page: number; @@ -424,7 +437,8 @@ declare class LogRequest extends BaseModel { method: string; status: number; auth: string; - ip: string; + remoteIp: string; + userIp: string; referer: string; userAgent: string; meta: null | { diff --git a/dist/pocketbase.cjs.js b/dist/pocketbase.cjs.js index 76a8bc4..c2f4822 100644 --- a/dist/pocketbase.cjs.js +++ b/dist/pocketbase.cjs.js @@ -1 +1 @@ -"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]0&&(!i.exp||i.exp-n>Date.now()/1e3))},t}(),a=function(){function t(){this.baseToken="",this.baseModel={},this._onChangeCallbacks=[]}return Object.defineProperty(t.prototype,"token",{get:function(){return this.baseToken},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.baseModel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isValid",{get:function(){return!u.isExpired(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t,this.baseModel=e,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel={},this.triggerChange()},t.prototype.onChange=function(t){var e=this;return this._onChangeCallbacks.push(t),function(){for(var n=e._onChangeCallbacks.length-1;n>=0;n--)if(e._onChangeCallbacks[n]==t)return delete e._onChangeCallbacks[n],void e._onChangeCallbacks.splice(n,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||[]},b=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=[],u=function(a){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,a,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?u(a+1):s}))]}))}))};return u(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=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},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]0&&(!i.exp||i.exp-n>Date.now()/1e3))},t}(),a=function(){function t(){this.baseToken="",this.baseModel={},this._onChangeCallbacks=[]}return Object.defineProperty(t.prototype,"token",{get:function(){return this.baseToken},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.baseModel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isValid",{get:function(){return!u.isExpired(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t,this.baseModel=e,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel={},this.triggerChange()},t.prototype.onChange=function(t){var e=this;return this._onChangeCallbacks.push(t),function(){for(var n=e._onChangeCallbacks.length-1;n>=0;n--)if(e._onChangeCallbacks[n]==t)return delete e._onChangeCallbacks[n],void e._onChangeCallbacks.splice(n,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||[]},b=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=[],u=function(a){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,a,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?u(a+1):s}))]}))}))};return u(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=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},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; + /** + * Performs a S3 storage connection test. + */ + testS3(queryParams?: {}): Promise; + /** + * Sends a test email. + * + * The possible `emailTemplate` values are: + * - verification + * - password-reset + * - email-change + */ + testEmail(toEmail: string, emailTemplate: string, queryParams?: {}): Promise; } declare class ListResult { page: number; @@ -424,7 +437,8 @@ declare class LogRequest extends BaseModel { method: string; status: number; auth: string; - ip: string; + remoteIp: string; + userIp: string; referer: string; userAgent: string; meta: null | { diff --git a/dist/pocketbase.es.mjs b/dist/pocketbase.es.mjs index 29f1dea..54544c8 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]0&&(!i.exp||i.exp-n>Date.now()/1e3))},t}(),a=function(){function t(){this.baseToken="",this.baseModel={},this._onChangeCallbacks=[]}return Object.defineProperty(t.prototype,"token",{get:function(){return this.baseToken},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.baseModel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isValid",{get:function(){return!u.isExpired(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t,this.baseModel=e,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel={},this.triggerChange()},t.prototype.onChange=function(t){var e=this;return this._onChangeCallbacks.push(t),function(){for(var n=e._onChangeCallbacks.length-1;n>=0;n--)if(e._onChangeCallbacks[n]==t)return delete e._onChangeCallbacks[n],void e._onChangeCallbacks.splice(n,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||[]},b=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=[],u=function(a){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,a,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?u(a+1):s}))]}))}))};return u(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=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},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]0&&(!i.exp||i.exp-n>Date.now()/1e3))},t}(),a=function(){function t(){this.baseToken="",this.baseModel={},this._onChangeCallbacks=[]}return Object.defineProperty(t.prototype,"token",{get:function(){return this.baseToken},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.baseModel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isValid",{get:function(){return!u.isExpired(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t,this.baseModel=e,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel={},this.triggerChange()},t.prototype.onChange=function(t){var e=this;return this._onChangeCallbacks.push(t),function(){for(var n=e._onChangeCallbacks.length-1;n>=0;n--)if(e._onChangeCallbacks[n]==t)return delete e._onChangeCallbacks[n],void e._onChangeCallbacks.splice(n,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||[]},b=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=[],u=function(a){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,a,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?u(a+1):s}))]}))}))};return u(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=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},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 Buffer.from(a, 'base64').toString('binary');\n}\n\nexport default class JWT {\n /**\n * Returns JWT token's payload data.\n */\n static getPayload(token: string): { [key: string]: any } {\n if (token) {\n try {\n\n let base64 = 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(base64) || {};\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 substracted from the token `exp` property.\n */\n static isExpired(token: string, expirationThreshold = 0): boolean {\n let payload = JWT.getPayload(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","import { AuthStore } from '@/stores/utils/AuthStore';\nimport JWT from '@/stores/utils/JWT';\nimport User from '@/models/User';\nimport Admin from '@/models/Admin';\n\ntype onChangeFunc = (token: string, model: User | Admin | {}) => void;\n\n/**\n * Base AuthStore class that is intented to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore implements AuthStore {\n protected baseToken: string = '';\n protected baseModel: User | Admin | {} = {};\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(): User | Admin | {} {\n return this.baseModel;\n }\n\n /**\n * Checks if the store has valid (aka. existing and unexpired) token.\n */\n get isValid(): boolean {\n return !JWT.isExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: User | Admin | {}): void {\n this.baseToken = token;\n this.baseModel = model;\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 = {};\n this.triggerChange();\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * Returns a removal function that you could call to \"unsubscribe\" from the changes.\n */\n onChange(callback: () => void): () => void {\n this._onChangeCallbacks.push(callback);\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","export default abstract class BaseModel {\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 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 (\n // id is not set\n !this.id ||\n // zero uuid value\n this.id === '00000000-0000-0000-0000-000000000000'\n );\n }\n\n /**\n * Robust deep clone of a 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 [key: string]: any,\n\n '@collectionId'!: string;\n '@collectionName'!: string;\n '@expand'!: {[key: string]: any};\n\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n for (const [key, value] of Object.entries(data)) {\n this[key] = value;\n }\n\n // normalize common fields\n this['@collectionId'] = typeof data['@collectionId'] !== 'undefined' ? data['@collectionId'] : '';\n this['@collectionName'] = typeof data['@collectionName'] !== 'undefined' ? data['@collectionName'] : '';\n this['@expand'] = typeof data['@expand'] !== 'undefined' ? data['@expand'] : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport Record from '@/models/Record';\n\nexport default class User extends BaseModel {\n email!: string;\n verified!: boolean;\n lastResetSentAt!: string;\n lastVerificationSentAt!: string;\n profile!: null|Record;\n\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n this.email = typeof data.email === 'string' ? data.email : '';\n this.verified = !!data.verified;\n this.lastResetSentAt = typeof data.lastResetSentAt === 'string' ? data.lastResetSentAt : '';\n this.lastVerificationSentAt = typeof data.lastVerificationSentAt === 'string' ? data.lastVerificationSentAt : '';\n this.profile = data.profile ? new Record(data.profile) : null;\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Admin extends BaseModel {\n avatar!: number;\n email!: string;\n lastResetSentAt!: 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 this.lastResetSentAt = typeof data.lastResetSentAt === 'string' ? data.lastResetSentAt : '';\n }\n}\n","import BaseAuthStore from '@/stores/BaseAuthStore';\nimport User from '@/models/User';\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 fallback: { [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(): User | Admin | {} {\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 {};\n }\n\n // admins don't have `verified` prop\n if (typeof data.model?.verified !== 'undefined') {\n return new User(data.model);\n }\n\n return new Admin(data.model);\n }\n\n /**\n * @inheritdoc\n */\n save(token: string, model: User | Admin | {}) {\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 to runtime/memory\n return this.fallback[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 runtime/memory\n this.fallback[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') {\n window?.localStorage?.removeItem(key);\n }\n\n // delete from runtime/memory\n delete this.fallback[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';\n\nexport default class Settings extends BaseService {\n /**\n * Fetch all available app settings.\n */\n getAll(queryParams = {}): 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 = {}): 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","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';\n\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 = {}): 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 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 = {}): 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));\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 = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => this.decode(responseData));\n }\n\n /**\n * Creates a new item.\n */\n protected _create(basePath: string, bodyParams = {}, queryParams = {}): Promise {\n return this.client.send(basePath, {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData));\n }\n\n /**\n * Updates an existing item by its id.\n */\n protected _update(basePath: string, id: string, bodyParams = {}, queryParams = {}): 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));\n }\n\n /**\n * Deletes an existing item by its id.\n */\n protected _delete(basePath: string, id: string, queryParams = {}): 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';\n\nexport default abstract class CrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/admins').\n */\n abstract baseCrudPath(): string\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n getFullList(batchSize = 100, queryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath(), batchSize, queryParams);\n }\n\n /**\n * Returns paginated items list.\n */\n getList(page = 1, perPage = 30, queryParams = {}): Promise> {\n return this._getList(this.baseCrudPath(), page, perPage, queryParams);\n }\n\n /**\n * Returns single item by its id.\n */\n getOne(id: string, queryParams = {}): Promise {\n return this._getOne(this.baseCrudPath(), id, queryParams);\n }\n\n /**\n * Creates a new item.\n */\n create(bodyParams = {}, queryParams = {}): Promise {\n return this._create(this.baseCrudPath(), bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n */\n update(id: string, bodyParams = {}, queryParams = {}): 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 = {}): Promise {\n return this._delete(this.baseCrudPath(), id, queryParams);\n }\n}\n","import CrudService from '@/services/utils/CrudService';\nimport Admin from '@/models/Admin';\n\nexport type AdminAuthResponse = {\n [key: string]: any,\n token: string,\n admin: Admin,\n}\n\nexport default class Admins 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 baseCrudPath(): string {\n return '/api/admins';\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 by 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 authViaEmail(\n email: string,\n password: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/auth-via-email', {\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 refresh(bodyParams = {}, queryParams = {}): Promise {\n return this.client.send(this.baseCrudPath() + '/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 = {},\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 = {},\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(this.authResponse.bind(this));\n }\n}\n","import CrudService from '@/services/utils/CrudService';\nimport User from '@/models/User';\n\nexport type UserAuthResponse = {\n [key: string]: any,\n token: string,\n user: User,\n}\n\nexport type AuthProviderInfo = {\n name: string,\n state: string,\n codeVerifier: string,\n codeChallenge: string,\n codeChallengeMethod: string,\n authUrl: string,\n}\n\nexport type AuthMethodsList = {\n [key: string]: any,\n emailPassword: boolean,\n authProviders: Array,\n}\n\nexport default class Users extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): User {\n return new User(data);\n }\n\n /**\n * @inheritdoc\n */\n baseCrudPath(): string {\n return '/api/users';\n }\n\n /**\n * Prepare successful authorization response.\n */\n protected authResponse(responseData: any): UserAuthResponse {\n const user = this.decode(responseData?.user || {});\n\n if (responseData?.token && responseData?.user) {\n this.client.authStore.save(responseData.token, user);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'user': user,\n });\n }\n\n /**\n * Returns all available application auth methods.\n */\n listAuthMethods(queryParams = {}): Promise {\n return this.client.send(this.baseCrudPath() + '/auth-methods', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n return Object.assign({}, responseData, {\n // normalize common fields\n 'emailPassword': !!responseData?.emailPassword,\n 'authProviders': Array.isArray(responseData?.authProviders) ? responseData?.authProviders : [],\n });\n });\n }\n\n /**\n * Authenticate a user via its email and password.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - new user authentication token\n * - the authenticated user model record\n */\n authViaEmail(\n email: string,\n password: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/auth-via-email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n 'headers': {\n 'Authorization': '',\n },\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Authenticate a user via OAuth2 client provider.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - new user authentication token\n * - the authenticated user model record\n * - the OAuth2 user profile data (eg. name, email, avatar, etc.)\n */\n authViaOAuth2(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'provider': provider,\n 'code': code,\n 'codeVerifier': codeVerifier,\n 'redirectUrl': redirectUrl,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/auth-via-oauth2', {\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 user authenticated instance and\n * returns a new token and user data.\n *\n * On success this method also automatically updates the client's AuthStore data.\n */\n refresh(bodyParams = {}, queryParams = {}): Promise {\n return this.client.send(this.baseCrudPath() + '/refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends user password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams = {},\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 user password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams = {},\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(this.authResponse.bind(this));\n }\n\n /**\n * Sends user verification email request.\n */\n requestVerification(\n email: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/request-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms user email verification request.\n */\n confirmVerification(\n verificationToken: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': verificationToken,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/confirm-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends an email change request to the authenticated user.\n */\n requestEmailChange(\n newEmail: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'newEmail': newEmail,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/request-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms user new email address.\n */\n confirmEmailChange(\n emailChangeToken: string,\n password: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': emailChangeToken,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/confirm-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\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 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\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n this.name = typeof data.name === 'string' ? data.name : '';\n this.system = !!data.system;\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","import CrudService from '@/services/utils/CrudService';\nimport Collection from '@/models/Collection';\n\nexport default class Collections 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 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(collections: Array, deleteMissing: boolean = false, queryParams = {}): 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 SubCrudService from '@/services/utils/SubCrudService';\nimport Record from '@/models/Record';\n\nexport default class Records extends SubCrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Record {\n return new Record(data);\n }\n\n /**\n * @inheritdoc\n */\n baseCrudPath(collectionIdOrName: string): string {\n return '/api/collections/' + encodeURIComponent(collectionIdOrName) + '/records';\n }\n\n /**\n * Builds and returns an absolute record file url.\n */\n getFileUrl(record: Record, filename: string, queryParams = {}): string {\n const parts = [];\n parts.push(this.client.baseUrl.replace(/\\/+$/gm, \"\"))\n parts.push(\"api\")\n parts.push(\"files\")\n parts.push(record[\"@collectionId\"])\n parts.push(record.id)\n parts.push(filename)\n let result = 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","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\n\nexport default abstract class SubCrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/collections/{:sub}/records').\n */\n abstract baseCrudPath(sub: string): string\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n getFullList(sub: string, batchSize = 100, queryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath(sub), batchSize, queryParams);\n }\n\n /**\n * Returns paginated items list.\n */\n getList(sub: string, page = 1, perPage = 30, queryParams = {}): Promise> {\n return this._getList(this.baseCrudPath(sub), page, perPage, queryParams);\n }\n\n /**\n * Returns single item by its id.\n */\n getOne(sub: string, id: string, queryParams = {}): Promise {\n return this._getOne(this.baseCrudPath(sub), id, queryParams);\n }\n\n /**\n * Creates a new item.\n */\n create(sub: string, bodyParams = {}, queryParams = {}): Promise {\n return this._create(this.baseCrudPath(sub), bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n */\n update(sub: string, id: string, bodyParams = {}, queryParams = {}): Promise {\n return this._update(this.baseCrudPath(sub), id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(sub: string, id: string, queryParams = {}): Promise {\n return this._delete(this.baseCrudPath(sub), id, queryParams);\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 ip!: string;\n referer!: string;\n userAgent!: string;\n meta!: null|{ [key: string]: any };\n\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\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.ip = typeof data.ip === 'string' ? data.ip : '';\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';\n\nexport type HourlyStats = {\n total: number,\n date: string,\n}\n\nexport default class Logs extends BaseService {\n /**\n * Returns paginated logged requests list.\n */\n getRequestsList(page = 1, perPage = 30, queryParams = {}): 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 = {}): 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 = {}): 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 Record from '@/models/Record';\n\nexport interface MessageData {\n [key: string]: any;\n action: string;\n record: Record;\n}\n\nexport interface SubscriptionFunc{\n (data: MessageData):void;\n}\n\nexport default class Realtime extends BaseService {\n private clientId: string = \"\";\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: EventListener } = {};\n\n /**\n * Inits the sse connection (if not already) and register the subscription.\n */\n async subscribe(subscription: string, callback: SubscriptionFunc): Promise {\n if (!subscription) {\n throw new Error('subscription must be set.')\n }\n\n // unsubscribe existing\n if (this.subscriptions[subscription]) {\n this.eventSource?.removeEventListener(subscription, this.subscriptions[subscription]);\n }\n\n // register subscription\n this.subscriptions[subscription] = 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 if (!this.eventSource) {\n // start a new sse connection\n this.connect();\n } else if (this.clientId) {\n // otherwise - just persist the updated subscriptions\n await this.submitSubscriptions();\n }\n }\n\n /**\n * Unsubscribe from a subscription.\n *\n * If the `subscription` argument is not set,\n * then the client will unsubscribe from all registered subscriptions.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operations there are no active subscriptions left.\n */\n async unsubscribe(subscription?: string): Promise {\n if (!subscription) {\n // remove all subscriptions\n this.removeSubscriptionListeners();\n this.subscriptions = {};\n } else if (this.subscriptions[subscription]) {\n // remove a single subscription\n this.eventSource?.removeEventListener(subscription, this.subscriptions[subscription]);\n delete this.subscriptions[subscription];\n } else {\n // not subscribed to the specified subscription\n return\n }\n\n if (this.clientId) {\n await this.submitSubscriptions();\n }\n\n // no more subscriptions -> close the sse connection\n if (!Object.keys(this.subscriptions).length) {\n this.disconnect();\n }\n }\n\n private async submitSubscriptions(): Promise {\n // optimistic update\n this.addSubscriptionListeners();\n\n return this.client.send('/api/realtime', {\n 'method': 'POST',\n 'body': {\n 'clientId': this.clientId,\n 'subscriptions': Object.keys(this.subscriptions),\n },\n }).then(() => true);\n }\n\n private addSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n this.removeSubscriptionListeners();\n\n for (let sub in this.subscriptions) {\n this.eventSource.addEventListener(sub, this.subscriptions[sub]);\n }\n }\n\n private removeSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n for (let sub in this.subscriptions) {\n this.eventSource.removeEventListener(sub, this.subscriptions[sub]);\n }\n }\n\n private connectHandler(e: Event): void {\n const msgEvent = (e as MessageEvent);\n this.clientId = msgEvent?.lastEventId;\n this.submitSubscriptions();\n }\n\n private connect(): void {\n this.disconnect();\n this.eventSource = new EventSource(this.client.buildUrl('/api/realtime'))\n this.eventSource.addEventListener('PB_CONNECT', (e) => this.connectHandler(e));\n }\n\n private disconnect(): void {\n this.removeSubscriptionListeners();\n this.eventSource?.removeEventListener('PB_CONNECT', (e) => this.connectHandler(e));\n this.eventSource?.close();\n this.eventSource = null;\n this.clientId = \"\";\n }\n}\n","import ClientResponseError from '@/ClientResponseError';\nimport { AuthStore } from '@/stores/utils/AuthStore';\nimport LocalAuthStore from '@/stores/LocalAuthStore';\nimport Settings from '@/services/Settings';\nimport Admins from '@/services/Admins';\nimport Users from '@/services/Users';\nimport Collections from '@/services/Collections';\nimport Records from '@/services/Records';\nimport Logs from '@/services/Logs';\nimport Realtime from '@/services/Realtime';\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 replacable instance of the local `AuthStore` service.\n */\n authStore: AuthStore;\n\n /**\n * An instance of the service that handles the **Settings APIs**.\n */\n readonly settings: Settings;\n\n /**\n * An instance of the service that handles the **Admin APIs**.\n */\n readonly admins: Admins;\n\n /**\n * An instance of the service that handles the **User APIs**.\n */\n readonly users: Users;\n\n /**\n * An instance of the service that handles the **Collection APIs**.\n */\n readonly collections: Collections;\n\n /**\n * An instance of the service that handles the **Record APIs**.\n */\n readonly records: Records;\n\n /**\n * An instance of the service that handles the **Log APIs**.\n */\n readonly logs: Logs;\n\n /**\n * An instance of the service that handles the **Realtime APIs**.\n */\n readonly realtime: Realtime;\n\n private cancelControllers: { [key: string]: AbortController } = {}\n\n constructor(\n baseUrl = '/',\n lang = 'en-US',\n authStore?: AuthStore | null,\n ) {\n this.baseUrl = baseUrl;\n this.lang = lang;\n this.authStore = authStore || new LocalAuthStore();\n\n // services\n this.admins = new Admins(this);\n this.users = new Users(this);\n this.records = new Records(this);\n this.collections = new Collections(this);\n this.logs = new Logs(this);\n this.settings = new Settings(this);\n this.realtime = new Realtime(this);\n }\n\n /**\n * @deprecated Legacy alias for `this.authStore`.\n */\n get AuthStore(): AuthStore {\n return this.authStore;\n };\n\n /**\n * @deprecated Legacy alias for `this.settings`.\n */\n get Settings(): Settings {\n return this.settings;\n };\n\n /**\n * @deprecated Legacy alias for `this.admins`.\n */\n get Admins(): Admins {\n return this.admins;\n };\n\n /**\n * @deprecated Legacy alias for `this.users`.\n */\n get Users(): Users {\n return this.users;\n };\n\n /**\n * @deprecated Legacy alias for `this.collections`.\n */\n get Collections(): Collections {\n return this.collections;\n };\n\n /**\n * @deprecated Legacy alias for `this.records`.\n */\n get Records(): Records {\n return this.records;\n };\n\n /**\n * @deprecated Legacy alias for `this.logs`.\n */\n get Logs(): Logs {\n return this.logs;\n };\n\n /**\n * @deprecated Legacy alias for `this.realtime`.\n */\n get Realtime(): Realtime {\n return this.realtime;\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 let authType = 'Admin';\n if (typeof (this.authStore.model as any)?.verified !== 'undefined') {\n authType = 'User'; // admins don't have verified\n }\n\n config.headers = Object.assign({}, config.headers, {\n 'Authorization': (authType + ' ' + this.authStore.token),\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (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 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":["atobPolyfill","ClientResponseError","_super","errData","_this","this","call","url","status","data","isAbort","originalError","Object","setPrototypeOf","prototype","DOMException","name","message","_a","__extends","toJSON","__assign","Error","atob","a","Buffer","from","toString","JWT","getPayload","token","base64","decodeURIComponent","split","map","c","charCodeAt","slice","join","JSON","parse","e","isExpired","expirationThreshold","payload","keys","length","exp","Date","now","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","defineProperty","get","save","model","triggerChange","clear","onChange","callback","push","i","splice","_i","BaseModel","load","id","created","updated","clone","constructor","stringify","export","assign","Record","entries","_b","key","value","User","email","verified","lastResetSentAt","lastVerificationSentAt","profile","Admin","avatar","LocalAuthStore","storageKey","fallback","_storageGet","_storageSet","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseService","client","Settings","getAll","queryParams","send","method","params","then","responseData","update","bodyParams","body","ListResult","page","perPage","totalItems","totalPages","items","BaseCrudService","_getFullList","basePath","batchSize","result","request","__awaiter","_getList","list","castedList","concat","item","decode","_getOne","encodeURIComponent","_create","_update","_delete","CrudService","getFullList","baseCrudPath","getList","getOne","create","delete","Admins","authResponse","admin","authStore","authViaEmail","password","headers","Authorization","bind","refresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","Users","user","listAuthMethods","emailPassword","authProviders","Array","isArray","authViaOAuth2","provider","code","codeVerifier","redirectUrl","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","SchemaField","type","system","required","unique","options","Collection","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","Collections","import","collections","deleteMissing","Records","collectionIdOrName","getFileUrl","record","filename","parts","baseUrl","replace","URLSearchParams","includes","SubCrudService","sub","LogRequest","auth","ip","referer","userAgent","meta","Logs","getRequestsList","getRequest","getRequestsStats","Realtime","apply","arguments","clientId","eventSource","subscriptions","subscribe","subscription","removeEventListener","msgEvent","connect","submitSubscriptions","sent","unsubscribe","removeSubscriptionListeners","disconnect","addSubscriptionListeners","addEventListener","connectHandler","lastEventId","EventSource","buildUrl","close","Client","lang","cancelControllers","admins","users","records","logs","settings","realtime","cancelRequest","cancelKey","abort","cancelAllRequests","k","path","reqConfig","config","_c","_d","authType","_e","_f","$autoCancel","_g","$cancelKey","controller","AbortController","signal","_h","_j","query","serializeQueryParams","beforeSend","fetch","response","json","afterSend","catch","err","endsWith","startsWith","substring","encodedKey","value_1","v","toISOString"],"mappings":"m+DAIA,ICJIA,EDIJC,EAAA,SAAAC,GAOI,SAAAD,EAAYE,GAAZ,MAuBCC,EAAAC,YAtBGD,EAAAF,EAAAI,KAAAD,KAAM,wBAAsBA,MAP7BE,IAA0B,GAC7BH,EAAMI,OAAuB,EAC7BJ,EAAIK,KAAyB,GAC7BL,EAAOM,SAAsB,EAC7BN,EAAaO,cAAgB,KAOzBC,OAAOC,eAAeT,EAAMH,EAAoBa,WAE1CX,aAAmBF,IACrBG,EAAKO,cAAgBR,GAGT,OAAZA,GAAuC,iBAAZA,IAC3BC,EAAKG,IAAgC,iBAAhBJ,EAAQI,IAAmBJ,EAAQI,IAAM,GAC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AAMF,KAAKsM,SAAWtM,KAAKsM,QAAQ8E,SAAS,KAAO,GAAK,KAI5D,OAHIzB,IACAzP,GAAQyP,EAAK0B,WAAW,KAAO1B,EAAK2B,UAAU,GAAK3B,GAEhDzP,GAMH2O,EAAoBpO,UAAAmQ,qBAA5B,SAA6BpK,GACzB,IAAMgB,EAAwB,GAC9B,IAAK,IAAM9C,KAAO8B,EACd,GAAoB,OAAhBA,EAAO9B,GAAX,CAKA,IAAMC,EAAQ6B,EAAO9B,GACf6M,EAAarJ,mBAAmBxD,GAEtC,GAAIsF,MAAMC,QAAQtF,GAEd,IAAgB,QAAA6M,EAAA7M,EAAAf,EAAK4N,EAAA/O,OAALmB,IAAO,CAAlB,IAAM6N,EAACD,EAAA5N,GACR4D,EAAO/D,KAAK8N,EAAa,IAAMrJ,mBAAmBuJ,GACrD,MACM9M,aAAiBhC,KACxB6E,EAAO/D,KAAK8N,EAAa,IAAMrJ,mBAAmBvD,EAAM+M,gBAChC,cAAV/M,GAAmC,iBAAVA,EACvC6C,EAAO/D,KAAK8N,EAAa,IAAMrJ,mBAAmBhG,KAAKkC,UAAUO,KAEjE6C,EAAO/D,KAAK8N,EAAa,IAAMrJ,mBAAmBvD,GAfrD,CAmBL,OAAO6C,EAAOvF,KAAK,MAE1B4M,CAAD"} \ No newline at end of file +{"version":3,"file":"pocketbase.es.mjs","sources":["../src/ClientResponseError.ts","../src/stores/utils/JWT.ts","../src/stores/BaseAuthStore.ts","../src/models/utils/BaseModel.ts","../src/models/Record.ts","../src/models/User.ts","../src/models/Admin.ts","../src/stores/LocalAuthStore.ts","../src/services/utils/BaseService.ts","../src/services/Settings.ts","../src/models/utils/ListResult.ts","../src/services/utils/BaseCrudService.ts","../src/services/utils/CrudService.ts","../src/services/Admins.ts","../src/services/Users.ts","../src/models/utils/SchemaField.ts","../src/models/Collection.ts","../src/services/Collections.ts","../src/services/Records.ts","../src/services/utils/SubCrudService.ts","../src/models/LogRequest.ts","../src/services/Logs.ts","../src/services/Realtime.ts","../src/Client.ts"],"sourcesContent":["/**\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 || 'Something went wrong while processing your request.'\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 atobPolyfill = (a: any) => Buffer.from(a, 'base64').toString('binary');\n}\n\nexport default class JWT {\n /**\n * Returns JWT token's payload data.\n */\n static getPayload(token: string): { [key: string]: any } {\n if (token) {\n try {\n\n let base64 = 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(base64) || {};\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 substracted from the token `exp` property.\n */\n static isExpired(token: string, expirationThreshold = 0): boolean {\n let payload = JWT.getPayload(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","import { AuthStore } from '@/stores/utils/AuthStore';\nimport JWT from '@/stores/utils/JWT';\nimport User from '@/models/User';\nimport Admin from '@/models/Admin';\n\ntype onChangeFunc = (token: string, model: User | Admin | {}) => void;\n\n/**\n * Base AuthStore class that is intented to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore implements AuthStore {\n protected baseToken: string = '';\n protected baseModel: User | Admin | {} = {};\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(): User | Admin | {} {\n return this.baseModel;\n }\n\n /**\n * Checks if the store has valid (aka. existing and unexpired) token.\n */\n get isValid(): boolean {\n return !JWT.isExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: User | Admin | {}): void {\n this.baseToken = token;\n this.baseModel = model;\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 = {};\n this.triggerChange();\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * Returns a removal function that you could call to \"unsubscribe\" from the changes.\n */\n onChange(callback: () => void): () => void {\n this._onChangeCallbacks.push(callback);\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","export default abstract class BaseModel {\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 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 (\n // id is not set\n !this.id ||\n // zero uuid value\n this.id === '00000000-0000-0000-0000-000000000000'\n );\n }\n\n /**\n * Robust deep clone of a 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 [key: string]: any,\n\n '@collectionId'!: string;\n '@collectionName'!: string;\n '@expand'!: {[key: string]: any};\n\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n for (const [key, value] of Object.entries(data)) {\n this[key] = value;\n }\n\n // normalize common fields\n this['@collectionId'] = typeof data['@collectionId'] !== 'undefined' ? data['@collectionId'] : '';\n this['@collectionName'] = typeof data['@collectionName'] !== 'undefined' ? data['@collectionName'] : '';\n this['@expand'] = typeof data['@expand'] !== 'undefined' ? data['@expand'] : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport Record from '@/models/Record';\n\nexport default class User extends BaseModel {\n email!: string;\n verified!: boolean;\n lastResetSentAt!: string;\n lastVerificationSentAt!: string;\n profile!: null|Record;\n\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n this.email = typeof data.email === 'string' ? data.email : '';\n this.verified = !!data.verified;\n this.lastResetSentAt = typeof data.lastResetSentAt === 'string' ? data.lastResetSentAt : '';\n this.lastVerificationSentAt = typeof data.lastVerificationSentAt === 'string' ? data.lastVerificationSentAt : '';\n this.profile = data.profile ? new Record(data.profile) : null;\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Admin extends BaseModel {\n avatar!: number;\n email!: string;\n lastResetSentAt!: 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 this.lastResetSentAt = typeof data.lastResetSentAt === 'string' ? data.lastResetSentAt : '';\n }\n}\n","import BaseAuthStore from '@/stores/BaseAuthStore';\nimport User from '@/models/User';\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 fallback: { [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(): User | Admin | {} {\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 {};\n }\n\n // admins don't have `verified` prop\n if (typeof data.model?.verified !== 'undefined') {\n return new User(data.model);\n }\n\n return new Admin(data.model);\n }\n\n /**\n * @inheritdoc\n */\n save(token: string, model: User | Admin | {}) {\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 to runtime/memory\n return this.fallback[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 runtime/memory\n this.fallback[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') {\n window?.localStorage?.removeItem(key);\n }\n\n // delete from runtime/memory\n delete this.fallback[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';\n\nexport default class Settings extends BaseService {\n /**\n * Fetch all available app settings.\n */\n getAll(queryParams = {}): 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 = {}): 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 = {}): 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 = {}): 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';\n\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 = {}): 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 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 = {}): 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));\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 = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => this.decode(responseData));\n }\n\n /**\n * Creates a new item.\n */\n protected _create(basePath: string, bodyParams = {}, queryParams = {}): Promise {\n return this.client.send(basePath, {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData));\n }\n\n /**\n * Updates an existing item by its id.\n */\n protected _update(basePath: string, id: string, bodyParams = {}, queryParams = {}): 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));\n }\n\n /**\n * Deletes an existing item by its id.\n */\n protected _delete(basePath: string, id: string, queryParams = {}): 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';\n\nexport default abstract class CrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/admins').\n */\n abstract baseCrudPath(): string\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n getFullList(batchSize = 100, queryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath(), batchSize, queryParams);\n }\n\n /**\n * Returns paginated items list.\n */\n getList(page = 1, perPage = 30, queryParams = {}): Promise> {\n return this._getList(this.baseCrudPath(), page, perPage, queryParams);\n }\n\n /**\n * Returns single item by its id.\n */\n getOne(id: string, queryParams = {}): Promise {\n return this._getOne(this.baseCrudPath(), id, queryParams);\n }\n\n /**\n * Creates a new item.\n */\n create(bodyParams = {}, queryParams = {}): Promise {\n return this._create(this.baseCrudPath(), bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n */\n update(id: string, bodyParams = {}, queryParams = {}): 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 = {}): Promise {\n return this._delete(this.baseCrudPath(), id, queryParams);\n }\n}\n","import CrudService from '@/services/utils/CrudService';\nimport Admin from '@/models/Admin';\n\nexport type AdminAuthResponse = {\n [key: string]: any,\n token: string,\n admin: Admin,\n}\n\nexport default class Admins 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 baseCrudPath(): string {\n return '/api/admins';\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 by 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 authViaEmail(\n email: string,\n password: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/auth-via-email', {\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 refresh(bodyParams = {}, queryParams = {}): Promise {\n return this.client.send(this.baseCrudPath() + '/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 = {},\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 = {},\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(this.authResponse.bind(this));\n }\n}\n","import CrudService from '@/services/utils/CrudService';\nimport User from '@/models/User';\n\nexport type UserAuthResponse = {\n [key: string]: any,\n token: string,\n user: User,\n}\n\nexport type AuthProviderInfo = {\n name: string,\n state: string,\n codeVerifier: string,\n codeChallenge: string,\n codeChallengeMethod: string,\n authUrl: string,\n}\n\nexport type AuthMethodsList = {\n [key: string]: any,\n emailPassword: boolean,\n authProviders: Array,\n}\n\nexport default class Users extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): User {\n return new User(data);\n }\n\n /**\n * @inheritdoc\n */\n baseCrudPath(): string {\n return '/api/users';\n }\n\n /**\n * Prepare successful authorization response.\n */\n protected authResponse(responseData: any): UserAuthResponse {\n const user = this.decode(responseData?.user || {});\n\n if (responseData?.token && responseData?.user) {\n this.client.authStore.save(responseData.token, user);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'user': user,\n });\n }\n\n /**\n * Returns all available application auth methods.\n */\n listAuthMethods(queryParams = {}): Promise {\n return this.client.send(this.baseCrudPath() + '/auth-methods', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n return Object.assign({}, responseData, {\n // normalize common fields\n 'emailPassword': !!responseData?.emailPassword,\n 'authProviders': Array.isArray(responseData?.authProviders) ? responseData?.authProviders : [],\n });\n });\n }\n\n /**\n * Authenticate a user via its email and password.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - new user authentication token\n * - the authenticated user model record\n */\n authViaEmail(\n email: string,\n password: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/auth-via-email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n 'headers': {\n 'Authorization': '',\n },\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Authenticate a user via OAuth2 client provider.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - new user authentication token\n * - the authenticated user model record\n * - the OAuth2 user profile data (eg. name, email, avatar, etc.)\n */\n authViaOAuth2(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'provider': provider,\n 'code': code,\n 'codeVerifier': codeVerifier,\n 'redirectUrl': redirectUrl,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/auth-via-oauth2', {\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 user authenticated instance and\n * returns a new token and user data.\n *\n * On success this method also automatically updates the client's AuthStore data.\n */\n refresh(bodyParams = {}, queryParams = {}): Promise {\n return this.client.send(this.baseCrudPath() + '/refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends user password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams = {},\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 user password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams = {},\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(this.authResponse.bind(this));\n }\n\n /**\n * Sends user verification email request.\n */\n requestVerification(\n email: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/request-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms user email verification request.\n */\n confirmVerification(\n verificationToken: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': verificationToken,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/confirm-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends an email change request to the authenticated user.\n */\n requestEmailChange(\n newEmail: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'newEmail': newEmail,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/request-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms user new email address.\n */\n confirmEmailChange(\n emailChangeToken: string,\n password: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': emailChangeToken,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/confirm-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\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 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\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n this.name = typeof data.name === 'string' ? data.name : '';\n this.system = !!data.system;\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","import CrudService from '@/services/utils/CrudService';\nimport Collection from '@/models/Collection';\n\nexport default class Collections 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 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(collections: Array, deleteMissing: boolean = false, queryParams = {}): 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 SubCrudService from '@/services/utils/SubCrudService';\nimport Record from '@/models/Record';\n\nexport default class Records extends SubCrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Record {\n return new Record(data);\n }\n\n /**\n * @inheritdoc\n */\n baseCrudPath(collectionIdOrName: string): string {\n return '/api/collections/' + encodeURIComponent(collectionIdOrName) + '/records';\n }\n\n /**\n * Builds and returns an absolute record file url.\n */\n getFileUrl(record: Record, filename: string, queryParams = {}): string {\n const parts = [];\n parts.push(this.client.baseUrl.replace(/\\/+$/gm, \"\"))\n parts.push(\"api\")\n parts.push(\"files\")\n parts.push(record[\"@collectionId\"])\n parts.push(record.id)\n parts.push(filename)\n let result = 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","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\n\nexport default abstract class SubCrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/collections/{:sub}/records').\n */\n abstract baseCrudPath(sub: string): string\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n getFullList(sub: string, batchSize = 100, queryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath(sub), batchSize, queryParams);\n }\n\n /**\n * Returns paginated items list.\n */\n getList(sub: string, page = 1, perPage = 30, queryParams = {}): Promise> {\n return this._getList(this.baseCrudPath(sub), page, perPage, queryParams);\n }\n\n /**\n * Returns single item by its id.\n */\n getOne(sub: string, id: string, queryParams = {}): Promise {\n return this._getOne(this.baseCrudPath(sub), id, queryParams);\n }\n\n /**\n * Creates a new item.\n */\n create(sub: string, bodyParams = {}, queryParams = {}): Promise {\n return this._create(this.baseCrudPath(sub), bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n */\n update(sub: string, id: string, bodyParams = {}, queryParams = {}): Promise {\n return this._update(this.baseCrudPath(sub), id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(sub: string, id: string, queryParams = {}): Promise {\n return this._delete(this.baseCrudPath(sub), id, queryParams);\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!: null|{ [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 compatability\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';\n\nexport type HourlyStats = {\n total: number,\n date: string,\n}\n\nexport default class Logs extends BaseService {\n /**\n * Returns paginated logged requests list.\n */\n getRequestsList(page = 1, perPage = 30, queryParams = {}): 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 = {}): 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 = {}): 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 Record from '@/models/Record';\n\nexport interface MessageData {\n [key: string]: any;\n action: string;\n record: Record;\n}\n\nexport interface SubscriptionFunc{\n (data: MessageData):void;\n}\n\nexport default class Realtime extends BaseService {\n private clientId: string = \"\";\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: EventListener } = {};\n\n /**\n * Inits the sse connection (if not already) and register the subscription.\n */\n async subscribe(subscription: string, callback: SubscriptionFunc): Promise {\n if (!subscription) {\n throw new Error('subscription must be set.')\n }\n\n // unsubscribe existing\n if (this.subscriptions[subscription]) {\n this.eventSource?.removeEventListener(subscription, this.subscriptions[subscription]);\n }\n\n // register subscription\n this.subscriptions[subscription] = 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 if (!this.eventSource) {\n // start a new sse connection\n this.connect();\n } else if (this.clientId) {\n // otherwise - just persist the updated subscriptions\n await this.submitSubscriptions();\n }\n }\n\n /**\n * Unsubscribe from a subscription.\n *\n * If the `subscription` argument is not set,\n * then the client will unsubscribe from all registered subscriptions.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operations there are no active subscriptions left.\n */\n async unsubscribe(subscription?: string): Promise {\n if (!subscription) {\n // remove all subscriptions\n this.removeSubscriptionListeners();\n this.subscriptions = {};\n } else if (this.subscriptions[subscription]) {\n // remove a single subscription\n this.eventSource?.removeEventListener(subscription, this.subscriptions[subscription]);\n delete this.subscriptions[subscription];\n } else {\n // not subscribed to the specified subscription\n return\n }\n\n if (this.clientId) {\n await this.submitSubscriptions();\n }\n\n // no more subscriptions -> close the sse connection\n if (!Object.keys(this.subscriptions).length) {\n this.disconnect();\n }\n }\n\n private async submitSubscriptions(): Promise {\n // optimistic update\n this.addSubscriptionListeners();\n\n return this.client.send('/api/realtime', {\n 'method': 'POST',\n 'body': {\n 'clientId': this.clientId,\n 'subscriptions': Object.keys(this.subscriptions),\n },\n }).then(() => true);\n }\n\n private addSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n this.removeSubscriptionListeners();\n\n for (let sub in this.subscriptions) {\n this.eventSource.addEventListener(sub, this.subscriptions[sub]);\n }\n }\n\n private removeSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n for (let sub in this.subscriptions) {\n this.eventSource.removeEventListener(sub, this.subscriptions[sub]);\n }\n }\n\n private connectHandler(e: Event): void {\n const msgEvent = (e as MessageEvent);\n this.clientId = msgEvent?.lastEventId;\n this.submitSubscriptions();\n }\n\n private connect(): void {\n this.disconnect();\n this.eventSource = new EventSource(this.client.buildUrl('/api/realtime'))\n this.eventSource.addEventListener('PB_CONNECT', (e) => this.connectHandler(e));\n }\n\n private disconnect(): void {\n this.removeSubscriptionListeners();\n this.eventSource?.removeEventListener('PB_CONNECT', (e) => this.connectHandler(e));\n this.eventSource?.close();\n this.eventSource = null;\n this.clientId = \"\";\n }\n}\n","import ClientResponseError from '@/ClientResponseError';\nimport { AuthStore } from '@/stores/utils/AuthStore';\nimport LocalAuthStore from '@/stores/LocalAuthStore';\nimport Settings from '@/services/Settings';\nimport Admins from '@/services/Admins';\nimport Users from '@/services/Users';\nimport Collections from '@/services/Collections';\nimport Records from '@/services/Records';\nimport Logs from '@/services/Logs';\nimport Realtime from '@/services/Realtime';\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 replacable instance of the local `AuthStore` service.\n */\n authStore: AuthStore;\n\n /**\n * An instance of the service that handles the **Settings APIs**.\n */\n readonly settings: Settings;\n\n /**\n * An instance of the service that handles the **Admin APIs**.\n */\n readonly admins: Admins;\n\n /**\n * An instance of the service that handles the **User APIs**.\n */\n readonly users: Users;\n\n /**\n * An instance of the service that handles the **Collection APIs**.\n */\n readonly collections: Collections;\n\n /**\n * An instance of the service that handles the **Record APIs**.\n */\n readonly records: Records;\n\n /**\n * An instance of the service that handles the **Log APIs**.\n */\n readonly logs: Logs;\n\n /**\n * An instance of the service that handles the **Realtime APIs**.\n */\n readonly realtime: Realtime;\n\n private cancelControllers: { [key: string]: AbortController } = {}\n\n constructor(\n baseUrl = '/',\n lang = 'en-US',\n authStore?: AuthStore | null,\n ) {\n this.baseUrl = baseUrl;\n this.lang = lang;\n this.authStore = authStore || new LocalAuthStore();\n\n // services\n this.admins = new Admins(this);\n this.users = new Users(this);\n this.records = new Records(this);\n this.collections = new Collections(this);\n this.logs = new Logs(this);\n this.settings = new Settings(this);\n this.realtime = new Realtime(this);\n }\n\n /**\n * @deprecated Legacy alias for `this.authStore`.\n */\n get AuthStore(): AuthStore {\n return this.authStore;\n };\n\n /**\n * @deprecated Legacy alias for `this.settings`.\n */\n get Settings(): Settings {\n return this.settings;\n };\n\n /**\n * @deprecated Legacy alias for `this.admins`.\n */\n get Admins(): Admins {\n return this.admins;\n };\n\n /**\n * @deprecated Legacy alias for `this.users`.\n */\n get Users(): Users {\n return this.users;\n };\n\n /**\n * @deprecated Legacy alias for `this.collections`.\n */\n get Collections(): Collections {\n return this.collections;\n };\n\n /**\n * @deprecated Legacy alias for `this.records`.\n */\n get Records(): Records {\n return this.records;\n };\n\n /**\n * @deprecated Legacy alias for `this.logs`.\n */\n get Logs(): Logs {\n return this.logs;\n };\n\n /**\n * @deprecated Legacy alias for `this.realtime`.\n */\n get Realtime(): Realtime {\n return this.realtime;\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 let authType = 'Admin';\n if (typeof (this.authStore.model as any)?.verified !== 'undefined') {\n authType = 'User'; // admins don't have verified\n }\n\n config.headers = Object.assign({}, config.headers, {\n 'Authorization': (authType + ' ' + this.authStore.token),\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (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 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":["atobPolyfill","ClientResponseError","_super","errData","_this","this","call","url","status","data","isAbort","originalError","Object","setPrototypeOf","prototype","DOMException","name","message","_a","__extends","toJSON","__assign","Error","atob","a","Buffer","from","toString","JWT","getPayload","token","base64","decodeURIComponent","split","map","c","charCodeAt","slice","join","JSON","parse","e","isExpired","expirationThreshold","payload","keys","length","exp","Date","now","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","defineProperty","get","save","model","triggerChange","clear","onChange","callback","push","i","splice","_i","BaseModel","load","id","created","updated","clone","constructor","stringify","export","assign","Record","entries","_b","key","value","User","email","verified","lastResetSentAt","lastVerificationSentAt","profile","Admin","avatar","LocalAuthStore","storageKey","fallback","_storageGet","_storageSet","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseService","client","Settings","getAll","queryParams","send","method","params","then","responseData","update","bodyParams","body","testS3","testEmail","toEmail","emailTemplate","template","ListResult","page","perPage","totalItems","totalPages","items","BaseCrudService","_getFullList","basePath","batchSize","result","request","__awaiter","_getList","list","castedList","concat","item","decode","_getOne","encodeURIComponent","_create","_update","_delete","CrudService","getFullList","baseCrudPath","getList","getOne","create","delete","Admins","authResponse","admin","authStore","authViaEmail","password","headers","Authorization","bind","refresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","Users","user","listAuthMethods","emailPassword","authProviders","Array","isArray","authViaOAuth2","provider","code","codeVerifier","redirectUrl","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","SchemaField","type","system","required","unique","options","Collection","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","Collections","import","collections","deleteMissing","Records","collectionIdOrName","getFileUrl","record","filename","parts","baseUrl","replace","URLSearchParams","includes","SubCrudService","sub","LogRequest","remoteIp","ip","auth","userIp","referer","userAgent","meta","Logs","getRequestsList","getRequest","getRequestsStats","Realtime","apply","arguments","clientId","eventSource","subscriptions","subscribe","subscription","removeEventListener","msgEvent","connect","submitSubscriptions","sent","unsubscribe","removeSubscriptionListeners","disconnect","addSubscriptionListeners","addEventListener","connectHandler","lastEventId","EventSource","buildUrl","close","Client","lang","cancelControllers","admins","users","records","logs","settings","realtime","cancelRequest","cancelKey","abort","cancelAllRequests","k","path","reqConfig","config","_c","_d","authType","_e","_f","$autoCancel","_g","$cancelKey","controller","AbortController","signal","_h","_j","query","serializeQueryParams","beforeSend","fetch","response","json","afterSend","catch","err","endsWith","startsWith","substring","encodedKey","value_1","v","toISOString"],"mappings":"m+DAIA,ICJIA,EDIJC,EAAA,SAAAC,GAOI,SAAAD,EAAYE,GAAZ,MAuBCC,EAAAC,YAtBGD,EAAAF,EAAAI,KAAAD,KAAM,wBAAsBA,MAP7BE,IAA0B,GAC7BH,EAAMI,OAAuB,EAC7BJ,EAAIK,KAAyB,GAC7BL,EAAOM,SAAsB,EAC7BN,EAAaO,cAAgB,KAOzBC,OAAOC,eAAeT,EAAMH,EAAoBa,WAE1CX,aAAmBF,IACrBG,EAAKO,cAAgBR,GAGT,OA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tN,GAAmC,iBAAVA,EACvCkD,EAAOpE,KAAKqO,EAAa,IAAMvJ,mBAAmBrG,KAAKkC,UAAUO,KAEjEkD,EAAOpE,KAAKqO,EAAa,IAAMvJ,mBAAmB5D,GAfrD,CAmBL,OAAOkD,EAAO5F,KAAK,MAE1BmN,CAAD"} \ No newline at end of file diff --git a/dist/pocketbase.iife.d.ts b/dist/pocketbase.iife.d.ts index d3d68d2..46eff9a 100644 --- a/dist/pocketbase.iife.d.ts +++ b/dist/pocketbase.iife.d.ts @@ -115,6 +115,19 @@ declare class Settings extends BaseService { update(bodyParams?: {}, queryParams?: {}): Promise<{ [key: string]: any; }>; + /** + * Performs a S3 storage connection test. + */ + testS3(queryParams?: {}): Promise; + /** + * Sends a test email. + * + * The possible `emailTemplate` values are: + * - verification + * - password-reset + * - email-change + */ + testEmail(toEmail: string, emailTemplate: string, queryParams?: {}): Promise; } declare class ListResult { page: number; @@ -424,7 +437,8 @@ declare class LogRequest extends BaseModel { method: string; status: number; auth: string; - ip: string; + remoteIp: string; + userIp: string; referer: string; userAgent: string; meta: null | { diff --git a/dist/pocketbase.iife.js b/dist/pocketbase.iife.js index b4184a0..1c62247 100644 --- a/dist/pocketbase.iife.js +++ b/dist/pocketbase.iife.js @@ -1 +1 @@ -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]0&&(!i.exp||i.exp-n>Date.now()/1e3))},t}(),a=function(){function t(){this.baseToken="",this.baseModel={},this._onChangeCallbacks=[]}return Object.defineProperty(t.prototype,"token",{get:function(){return this.baseToken},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.baseModel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isValid",{get:function(){return!u.isExpired(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t,this.baseModel=e,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel={},this.triggerChange()},t.prototype.onChange=function(t){var e=this;return this._onChangeCallbacks.push(t),function(){for(var n=e._onChangeCallbacks.length-1;n>=0;n--)if(e._onChangeCallbacks[n]==t)return delete e._onChangeCallbacks[n],void e._onChangeCallbacks.splice(n,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||[]},b=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=[],u=function(a){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,a,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?u(a+1):s}))]}))}))};return u(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=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},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]0&&(!i.exp||i.exp-n>Date.now()/1e3))},t}(),a=function(){function t(){this.baseToken="",this.baseModel={},this._onChangeCallbacks=[]}return Object.defineProperty(t.prototype,"token",{get:function(){return this.baseToken},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.baseModel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isValid",{get:function(){return!u.isExpired(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t,this.baseModel=e,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel={},this.triggerChange()},t.prototype.onChange=function(t){var e=this;return this._onChangeCallbacks.push(t),function(){for(var n=e._onChangeCallbacks.length-1;n>=0;n--)if(e._onChangeCallbacks[n]==t)return delete e._onChangeCallbacks[n],void e._onChangeCallbacks.splice(n,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||[]},b=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=[],u=function(a){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,a,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?u(a+1):s}))]}))}))};return u(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=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},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; + /** + * Performs a S3 storage connection test. + */ + testS3(queryParams?: {}): Promise; + /** + * Sends a test email. + * + * The possible `emailTemplate` values are: + * - verification + * - password-reset + * - email-change + */ + testEmail(toEmail: string, emailTemplate: string, queryParams?: {}): Promise; } declare class ListResult { page: number; @@ -424,7 +437,8 @@ declare class LogRequest extends BaseModel { method: string; status: number; auth: string; - ip: string; + remoteIp: string; + userIp: string; referer: string; userAgent: string; meta: null | { diff --git a/dist/pocketbase.umd.js b/dist/pocketbase.umd.js index b588cfc..137d74d 100644 --- a/dist/pocketbase.umd.js +++ b/dist/pocketbase.umd.js @@ -1 +1 @@ -!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]0&&(!i.exp||i.exp-n>Date.now()/1e3))},t}(),a=function(){function t(){this.baseToken="",this.baseModel={},this._onChangeCallbacks=[]}return Object.defineProperty(t.prototype,"token",{get:function(){return this.baseToken},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.baseModel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isValid",{get:function(){return!u.isExpired(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t,this.baseModel=e,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel={},this.triggerChange()},t.prototype.onChange=function(t){var e=this;return this._onChangeCallbacks.push(t),function(){for(var n=e._onChangeCallbacks.length-1;n>=0;n--)if(e._onChangeCallbacks[n]==t)return delete e._onChangeCallbacks[n],void e._onChangeCallbacks.splice(n,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||[]},b=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=[],u=function(a){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,a,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?u(a+1):s}))]}))}))};return u(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=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},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]0&&(!i.exp||i.exp-n>Date.now()/1e3))},t}(),a=function(){function t(){this.baseToken="",this.baseModel={},this._onChangeCallbacks=[]}return Object.defineProperty(t.prototype,"token",{get:function(){return this.baseToken},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return this.baseModel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isValid",{get:function(){return!u.isExpired(this.token)},enumerable:!1,configurable:!0}),t.prototype.save=function(t,e){this.baseToken=t,this.baseModel=e,this.triggerChange()},t.prototype.clear=function(){this.baseToken="",this.baseModel={},this.triggerChange()},t.prototype.onChange=function(t){var e=this;return this._onChangeCallbacks.push(t),function(){for(var n=e._onChangeCallbacks.length-1;n>=0;n--)if(e._onChangeCallbacks[n]==t)return delete e._onChangeCallbacks[n],void e._onChangeCallbacks.splice(n,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||[]},b=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=[],u=function(a){return i(r,void 0,void 0,(function(){return o(this,(function(i){return[2,this._getList(t,a,e,n).then((function(t){var e=t,n=e.items,i=e.totalItems;return s=s.concat(n),n.length&&i>s.length?u(a+1):s}))]}))}))};return u(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=400)throw new s({url:t.url,status:t.status,data:e});return[2,e]}}))}))})).catch((function(t){throw new s(t)}))]}))}))},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 responseData || {}); } + + /** + * Performs a S3 storage connection test. + */ + testS3(queryParams = {}): Promise { + return this.client.send('/api/settings/test/s3', { + 'method': 'POST', + 'params': queryParams, + }).then(() => true); + } + + /** + * Sends a test email. + * + * The possible `emailTemplate` values are: + * - verification + * - password-reset + * - email-change + */ + testEmail(toEmail: string, emailTemplate: string, queryParams = {}): Promise { + const bodyParams = { + 'email': toEmail, + 'template': emailTemplate, + }; + + return this.client.send('/api/settings/test/email', { + 'method': 'POST', + 'params': queryParams, + 'body': bodyParams, + }).then(() => true); + } } diff --git a/tests/services/Settings.spec.ts b/tests/services/Settings.spec.ts index bd5779e..7a0c0e0 100644 --- a/tests/services/Settings.spec.ts +++ b/tests/services/Settings.spec.ts @@ -50,4 +50,35 @@ describe('Settings', function () { assert.deepEqual(result, { 'test': 'abc' }); }); }); + + describe('testS3()', function () { + it('Should send S3 connection test request', async function () { + fetchMock.on({ + method: 'POST', + url: service.client.buildUrl('/api/settings/test/s3')+ '?q1=123', + replyCode: 204, + replyBody: true, + }); + + const result = await service.testS3({ 'q1': 123 }); + + assert.isTrue(result); + }); + }); + + describe('testEmail()', function () { + it('Should send a test email request', async function () { + fetchMock.on({ + method: 'POST', + url: service.client.buildUrl('/api/settings/test/email')+ '?q1=123', + body: { 'template': "abc", "email": "test@example.com" }, + replyCode: 204, + replyBody: true, + }); + + const result = await service.testEmail("test@example.com", "abc", { "q1": 123 }); + + assert.isTrue(result); + }); + }); });