From 0aa9a3b1648ce2672399385caee060ee7488edd1 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Fri, 26 Aug 2022 15:11:36 +0300 Subject: [PATCH] removed the AuthStore type --- dist/pocketbase.cjs.d.ts | 49 +++------------------------------ dist/pocketbase.es.d.mts | 49 +++------------------------------ dist/pocketbase.es.mjs.map | 2 +- dist/pocketbase.iife.d.ts | 49 +++------------------------------ dist/pocketbase.umd.d.ts | 49 +++------------------------------ package.json | 2 +- src/Client.ts | 9 +++--- src/stores/utils/AuthStore.ts | 52 ----------------------------------- 8 files changed, 22 insertions(+), 239 deletions(-) delete mode 100644 src/stores/utils/AuthStore.ts diff --git a/dist/pocketbase.cjs.d.ts b/dist/pocketbase.cjs.d.ts index 8f834d1..1e1bae6 100644 --- a/dist/pocketbase.cjs.d.ts +++ b/dist/pocketbase.cjs.d.ts @@ -131,47 +131,6 @@ declare abstract class BaseAuthStore { onChange(callback: () => void): () => void; protected triggerChange(): void; } -/** - * The minimal AuthStore interface. - * - * @deprecated - * This interface predates the abstract BaseAuthStore class - * and it is kept mainly for backward compatibility. - * - * New AuthStore implementations should extend directly the - * BaseAuthStore abstract class. - */ -type AuthStore = { - /** - * Retrieves the stored token (if any). - */ - readonly token: string; - /** - * Retrieves the stored model data (if any). - */ - readonly model: User | Admin | null; - /** - * Checks if the store has valid (aka. existing and unexpired) token. - */ - readonly isValid: boolean; - /** - * Saves new token and model data in the auth store. - */ - save(token: string, model: User | Admin | null): void; - /** - * Removes the stored token and model data form the auth store. - */ - clear(): void; - /** - * Parses the provided cookie string and updates the store state - * with the cookie's token and model data. - */ - loadFromCookie(cookie: string, key?: string): void; - /** - * Exports the current store state as cookie string. - */ - exportToCookie(options?: SerializeOptions, key?: string): string; -}; /** * BaseService class that should be inherited from all API services. */ @@ -639,9 +598,9 @@ declare class Client { */ lang: string; /** - * A replaceable instance of the local `AuthStore` service. + * A replaceable instance of the local auth store service. */ - authStore: AuthStore | BaseAuthStore; + authStore: BaseAuthStore; /** * An instance of the service that handles the **Settings APIs**. */ @@ -671,11 +630,11 @@ declare class Client { */ readonly realtime: Realtime; private cancelControllers; - constructor(baseUrl?: string, lang?: string, authStore?: AuthStore | BaseAuthStore | null); + constructor(baseUrl?: string, lang?: string, authStore?: BaseAuthStore | null); /** * @deprecated Legacy alias for `this.authStore`. */ - get AuthStore(): AuthStore; + get AuthStore(): BaseAuthStore; /** * @deprecated Legacy alias for `this.settings`. */ diff --git a/dist/pocketbase.es.d.mts b/dist/pocketbase.es.d.mts index 56d71bb..c9d86ca 100644 --- a/dist/pocketbase.es.d.mts +++ b/dist/pocketbase.es.d.mts @@ -131,47 +131,6 @@ declare abstract class BaseAuthStore { onChange(callback: () => void): () => void; protected triggerChange(): void; } -/** - * The minimal AuthStore interface. - * - * @deprecated - * This interface predates the abstract BaseAuthStore class - * and it is kept mainly for backward compatibility. - * - * New AuthStore implementations should extend directly the - * BaseAuthStore abstract class. - */ -type AuthStore = { - /** - * Retrieves the stored token (if any). - */ - readonly token: string; - /** - * Retrieves the stored model data (if any). - */ - readonly model: User | Admin | null; - /** - * Checks if the store has valid (aka. existing and unexpired) token. - */ - readonly isValid: boolean; - /** - * Saves new token and model data in the auth store. - */ - save(token: string, model: User | Admin | null): void; - /** - * Removes the stored token and model data form the auth store. - */ - clear(): void; - /** - * Parses the provided cookie string and updates the store state - * with the cookie's token and model data. - */ - loadFromCookie(cookie: string, key?: string): void; - /** - * Exports the current store state as cookie string. - */ - exportToCookie(options?: SerializeOptions, key?: string): string; -}; /** * BaseService class that should be inherited from all API services. */ @@ -639,9 +598,9 @@ declare class Client { */ lang: string; /** - * A replaceable instance of the local `AuthStore` service. + * A replaceable instance of the local auth store service. */ - authStore: AuthStore | BaseAuthStore; + authStore: BaseAuthStore; /** * An instance of the service that handles the **Settings APIs**. */ @@ -671,11 +630,11 @@ declare class Client { */ readonly realtime: Realtime; private cancelControllers; - constructor(baseUrl?: string, lang?: string, authStore?: AuthStore | BaseAuthStore | null); + constructor(baseUrl?: string, lang?: string, authStore?: BaseAuthStore | null); /** * @deprecated Legacy alias for `this.authStore`. */ - get AuthStore(): AuthStore; + get AuthStore(): BaseAuthStore; /** * @deprecated Legacy alias for `this.settings`. */ diff --git a/dist/pocketbase.es.mjs.map b/dist/pocketbase.es.mjs.map index 229f8cb..4c00490 100644 --- a/dist/pocketbase.es.mjs.map +++ b/dist/pocketbase.es.mjs.map @@ -1 +1 @@ -{"version":3,"file":"pocketbase.es.mjs","sources":["../src/ClientResponseError.ts","../src/stores/utils/jwt.ts","../src/stores/utils/cookie.ts","../src/models/utils/BaseModel.ts","../src/models/Record.ts","../src/models/User.ts","../src/models/Admin.ts","../src/stores/BaseAuthStore.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\n/**\n * Returns JWT token's payload data.\n */\nexport function getTokenPayload(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 subtracted from the token `exp` property.\n */\nexport function isTokenExpired(token: string, expirationThreshold = 0): boolean {\n let payload = getTokenPayload(token);\n\n if (\n Object.keys(payload).length > 0 &&\n (!payload.exp || (payload.exp - expirationThreshold) > (Date.now() / 1000))\n ) {\n return false;\n }\n\n return true;\n}\n","/**\n * -------------------------------------------------------------------\n * Simple cookie parse and serialize utilities mostly based on the\n * node module https://github.com/jshttp/cookie.\n * -------------------------------------------------------------------\n */\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\nexport interface ParseOptions{\n decode?: (val: string) => string,\n}\n\n/**\n* Parses the given cookie header string into an object\n* The object has the various cookies as keys(names) => values\n*/\nexport function cookieParse(str: string, options?: ParseOptions): { [key: string]: any } {\n const result: { [key: string]: any } = {};\n\n if (typeof str !== 'string') {\n return result;\n }\n\n const opt = Object.assign({}, options || {});\n const decode = opt.decode || defaultDecode;\n\n let index = 0;\n while (index < str.length) {\n const eqIdx = str.indexOf('=', index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = str.indexOf(';', index);\n\n if (endIdx === -1) {\n endIdx = str.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1;\n continue;\n }\n\n const key = str.slice(index, eqIdx).trim();\n\n // only assign once\n if (undefined === result[key]) {\n let val = str.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n result[key] = decode(val);\n } catch (_) {\n result[key] = val; // no decoding\n }\n }\n\n index = endIdx + 1;\n }\n\n return result;\n};\n\nexport interface SerializeOptions{\n encode?: (val: string | number | boolean) => string,\n maxAge?: number,\n domain?: string,\n path?: string,\n expires?: Date,\n httpOnly?: boolean,\n secure?: boolean,\n priority?: string,\n sameSite?: boolean|string,\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * ```js\n * cookieSerialize('foo', 'bar', { httpOnly: true }) // \"foo=bar; httpOnly\"\n * ```\n */\nexport function cookieSerialize(name: string, val: string, options?: SerializeOptions): string {\n const opt = Object.assign({}, options || {});\n const encode = opt.encode || defaultEncode;\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n const value = encode(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n let result = name + '=' + value;\n\n if (opt.maxAge != null) {\n const maxAge = opt.maxAge - 0;\n\n if (isNaN(maxAge) || !isFinite(maxAge)) {\n throw new TypeError('option maxAge is invalid');\n }\n\n result += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n result += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n result += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (!isDate(opt.expires) || isNaN(opt.expires.valueOf())) {\n throw new TypeError('option expires is invalid');\n }\n\n result += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n result += '; HttpOnly';\n }\n\n if (opt.secure) {\n result += '; Secure';\n }\n\n if (opt.priority) {\n const priority = typeof opt.priority === 'string' ? opt.priority.toLowerCase() : opt.priority;\n\n switch (priority) {\n case 'low':\n result += '; Priority=Low';\n break;\n case 'medium':\n result += '; Priority=Medium';\n break;\n case 'high':\n result += '; Priority=High';\n break;\n default:\n throw new TypeError('option priority is invalid');\n }\n }\n\n if (opt.sameSite) {\n const sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n result += '; SameSite=Strict';\n break;\n case 'lax':\n result += '; SameSite=Lax';\n break;\n case 'strict':\n result += '; SameSite=Strict';\n break;\n case 'none':\n result += '; SameSite=None';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return result;\n};\n\n/**\n * Default URL-decode string value function.\n * Optimized to skip native call when no `%`.\n */\nfunction defaultDecode(val: string): string {\n return val.indexOf('%') !== -1\n ? decodeURIComponent(val)\n : val;\n}\n\n/**\n * Default URL-encode value function.\n */\nfunction defaultEncode(val: string | number | boolean): string {\n return encodeURIComponent(val);\n}\n\n/**\n * Determines if value is a Date.\n */\nfunction isDate(val: any): boolean {\n return (\n Object.prototype.toString.call(val) === '[object Date]' ||\n val instanceof Date\n );\n}\n","export default abstract class BaseModel {\n 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 { cookieParse, cookieSerialize, SerializeOptions } from '@/stores/utils/cookie';\nimport { isTokenExpired, getTokenPayload } from '@/stores/utils/jwt';\nimport User from '@/models/User';\nimport Admin from '@/models/Admin';\n\ntype onChangeFunc = (token: string, model: User|Admin|null) => void;\n\nconst defaultCookieKey = 'pb_auth';\n\n/**\n * Base AuthStore class that is intended to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore {\n protected baseToken: string = '';\n protected baseModel: User|Admin|null = null;\n\n private _onChangeCallbacks: Array = [];\n\n /**\n * Retrieves the stored token (if any).\n */\n get token(): string {\n return this.baseToken;\n }\n\n /**\n * Retrieves the stored model data (if any).\n */\n get model(): User|Admin|null {\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 !isTokenExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: User|Admin|null): void {\n this.baseToken = token || '';\n\n // normalize the model instance\n if (model !== null && typeof model === 'object') {\n this.baseModel = (model as any)?.verified !== 'undefined' ?\n new User(model) : new Admin(model);\n } else {\n this.baseModel = null;\n }\n\n this.triggerChange();\n }\n\n /**\n * Removes the stored token and model data form the auth store.\n */\n clear(): void {\n this.baseToken = '';\n this.baseModel = null;\n this.triggerChange();\n }\n\n /**\n * Parses the provided cookie string and updates the store state\n * with the cookie's token and model data.\n */\n loadFromCookie(cookie: string, key = defaultCookieKey): void {\n const rawData = cookieParse(cookie || '')[key] || '';\n\n let data: { [key: string]: any } = {};\n try {\n data = JSON.parse(rawData);\n // normalize\n if (typeof data === null || typeof data !== 'object' || Array.isArray(data)) {\n data = {};\n }\n } catch (_) {}\n\n this.save(data.token || '', data.model || {});\n }\n\n /**\n * Exports the current store state as cookie string.\n *\n * By default the following optional attributes are added:\n * - Secure\n * - HttpOnly\n * - SameSite=Strict\n * - Path=/\n * - Expires={the token expiration date}\n *\n * NB! If the generated cookie exceeds 4096 bytes, this method will\n * strip the model data to the bare minimum to try to fit within the\n * recommended size in https://www.rfc-editor.org/rfc/rfc6265#section-6.1.\n */\n exportToCookie(options?: SerializeOptions, key = defaultCookieKey): string {\n const defaultOptions: SerializeOptions = {\n secure: true,\n sameSite: true,\n httpOnly: true,\n path: \"/\",\n };\n\n // extract the token expiration date\n const payload = getTokenPayload(this.token);\n if (payload?.exp) {\n defaultOptions.expires = new Date(payload.exp * 1000);\n } else {\n defaultOptions.expires = new Date('1970-01-01');\n }\n\n // merge with the user defined options\n options = Object.assign({}, defaultOptions, options);\n\n const rawData = {\n token: this.token,\n model: this.model?.export() || null,\n };\n\n let result = cookieSerialize(key, JSON.stringify(rawData), options);\n\n // strip down the model data to the bare minimum\n if (rawData.model && new Blob([result]).size > 4096) {\n rawData.model = {id: rawData?.model?.id, email: rawData?.model?.email};\n if (this.model instanceof User) {\n rawData.model.verified = this.model.verified;\n }\n result = cookieSerialize(key, JSON.stringify(rawData), options)\n }\n\n return result;\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * 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","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 storageFallback: { [key: string]: any } = {};\n private storageKey: string\n\n constructor(storageKey = \"pocketbase_auth\") {\n super();\n\n this.storageKey = storageKey;\n }\n\n /**\n * @inheritdoc\n */\n get token(): string {\n const data = this._storageGet(this.storageKey) || {};\n\n return data.token || '';\n }\n\n /**\n * @inheritdoc\n */\n get model(): User|Admin|null {\n const data = this._storageGet(this.storageKey) || {};\n\n if (\n data === null ||\n typeof data !== 'object' ||\n data.model === null ||\n typeof data.model !== 'object'\n ) {\n return null;\n }\n\n // admins don't have `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|null) {\n this._storageSet(this.storageKey, {\n 'token': token,\n 'model': model,\n });\n\n super.save(token, model);\n }\n\n /**\n * @inheritdoc\n */\n clear() {\n this._storageRemove(this.storageKey);\n\n super.clear();\n }\n\n // ---------------------------------------------------------------\n // Internal helpers:\n // ---------------------------------------------------------------\n\n /**\n * Retrieves `key` from the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageGet(key: string): any {\n if (typeof window !== 'undefined' && window?.localStorage) {\n const rawValue = window?.localStorage?.getItem(key) || '';\n try {\n return JSON.parse(rawValue);\n } catch (e) { // not a json\n return rawValue;\n }\n }\n\n // fallback\n return this.storageFallback[key];\n }\n\n /**\n * Stores a new data in the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageSet(key: string, value: any) {\n if (typeof window !== 'undefined' && window?.localStorage) {\n // store in local storage\n let normalizedVal = value;\n if (typeof value !== 'string') {\n normalizedVal = JSON.stringify(value);\n }\n window?.localStorage?.setItem(key, normalizedVal);\n } else {\n // store in fallback\n this.storageFallback[key] = value;\n }\n }\n\n /**\n * Removes `key` from the browser's local storage and the runtime/memory.\n */\n private _storageRemove(key: string) {\n // delete from local storage\n if (typeof window !== 'undefined') {\n window?.localStorage?.removeItem(key);\n }\n\n // delete from fallback\n delete this.storageFallback[key];\n }\n}\n","import Client from '@/Client';\n\n/**\n * BaseService class that should be inherited from all API services.\n */\nexport default abstract class BaseService {\n readonly client: Client\n\n constructor(client: Client) {\n this.client = client;\n }\n}\n","import BaseService from '@/services/utils/BaseService';\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 BaseAuthStore from '@/stores/BaseAuthStore';\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 replaceable instance of the local `AuthStore` service.\n */\n authStore: AuthStore | BaseAuthStore;\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 | BaseAuthStore | 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","fieldContentRegExp","cookieSerialize","val","options","opt","assign","encode","defaultEncode","test","TypeError","value","result","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","toString","Date","isDate","valueOf","toUTCString","httpOnly","secure","priority","toLowerCase","sameSite","defaultDecode","indexOf","decodeURIComponent","encodeURIComponent","getTokenPayload","token","base64","split","map","c","charCodeAt","slice","join","JSON","parse","e","atob","a","Buffer","from","BaseModel","load","id","created","updated","defineProperty","get","clone","constructor","stringify","export","Record","_i","entries","length","_b","key","User","email","verified","lastResetSentAt","lastVerificationSentAt","profile","Admin","avatar","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","expirationThreshold","payload","keys","exp","now","isTokenExpired","save","model","triggerChange","clear","loadFromCookie","cookie","rawData","str","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","_","cookieParse","Array","isArray","exportToCookie","defaultOptions","Blob","size","_c","onChange","callback","push","i","splice","LocalAuthStore","storageKey","storageFallback","_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","request","__awaiter","_getList","list","castedList","concat","item","_getOne","_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","authViaOAuth2","provider","code","codeVerifier","redirectUrl","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","SchemaField","type","system","required","unique","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","reqConfig","config","_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,O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C9B,IAAK,IAAMuD,KAAOoE,EACd,GAAoB,OAAhBA,EAAOpE,GAAX,CAKA,IAAMxD,EAAQ4H,EAAOpE,GACfkP,EAAanR,mBAAmBiC,GAEtC,GAAIoC,MAAMC,QAAQ7F,GAEd,IAAgB,QAAA2S,EAAA3S,EAAAoD,EAAKuP,EAAArP,OAALF,IAAO,CAAlB,IAAMwP,EAACD,EAAAvP,GACRnD,EAAOoG,KAAKqM,EAAa,IAAMnR,mBAAmBqR,GACrD,MACM5S,aAAiBW,KACxBV,EAAOoG,KAAKqM,EAAa,IAAMnR,mBAAmBvB,EAAM6S,gBAChC,cAAV7S,GAAmC,iBAAVA,EACvCC,EAAOoG,KAAKqM,EAAa,IAAMnR,mBAAmBU,KAAKgB,UAAUjD,KAEjEC,EAAOoG,KAAKqM,EAAa,IAAMnR,mBAAmBvB,GAfrD,CAmBL,OAAOC,EAAO+B,KAAK,MAE1BkO,CAAD"} \ No newline at end of file +{"version":3,"file":"pocketbase.es.mjs","sources":["../src/ClientResponseError.ts","../src/stores/utils/jwt.ts","../src/stores/utils/cookie.ts","../src/models/utils/BaseModel.ts","../src/models/Record.ts","../src/models/User.ts","../src/models/Admin.ts","../src/stores/BaseAuthStore.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\n/**\n * Returns JWT token's payload data.\n */\nexport function getTokenPayload(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 subtracted from the token `exp` property.\n */\nexport function isTokenExpired(token: string, expirationThreshold = 0): boolean {\n let payload = getTokenPayload(token);\n\n if (\n Object.keys(payload).length > 0 &&\n (!payload.exp || (payload.exp - expirationThreshold) > (Date.now() / 1000))\n ) {\n return false;\n }\n\n return true;\n}\n","/**\n * -------------------------------------------------------------------\n * Simple cookie parse and serialize utilities mostly based on the\n * node module https://github.com/jshttp/cookie.\n * -------------------------------------------------------------------\n */\n\n/**\n * RegExp to match field-content in RFC 7230 sec 3.2\n *\n * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]\n * field-vchar = VCHAR / obs-text\n * obs-text = %x80-FF\n */\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\n\nexport interface ParseOptions{\n decode?: (val: string) => string,\n}\n\n/**\n* Parses the given cookie header string into an object\n* The object has the various cookies as keys(names) => values\n*/\nexport function cookieParse(str: string, options?: ParseOptions): { [key: string]: any } {\n const result: { [key: string]: any } = {};\n\n if (typeof str !== 'string') {\n return result;\n }\n\n const opt = Object.assign({}, options || {});\n const decode = opt.decode || defaultDecode;\n\n let index = 0;\n while (index < str.length) {\n const eqIdx = str.indexOf('=', index);\n\n // no more cookie pairs\n if (eqIdx === -1) {\n break;\n }\n\n let endIdx = str.indexOf(';', index);\n\n if (endIdx === -1) {\n endIdx = str.length;\n } else if (endIdx < eqIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(';', eqIdx - 1) + 1;\n continue;\n }\n\n const key = str.slice(index, eqIdx).trim();\n\n // only assign once\n if (undefined === result[key]) {\n let val = str.slice(eqIdx + 1, endIdx).trim();\n\n // quoted values\n if (val.charCodeAt(0) === 0x22) {\n val = val.slice(1, -1);\n }\n\n try {\n result[key] = decode(val);\n } catch (_) {\n result[key] = val; // no decoding\n }\n }\n\n index = endIdx + 1;\n }\n\n return result;\n};\n\nexport interface SerializeOptions{\n encode?: (val: string | number | boolean) => string,\n maxAge?: number,\n domain?: string,\n path?: string,\n expires?: Date,\n httpOnly?: boolean,\n secure?: boolean,\n priority?: string,\n sameSite?: boolean|string,\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize the a name value pair into a cookie string suitable for\n * http headers. An optional options object specified cookie parameters.\n *\n * ```js\n * cookieSerialize('foo', 'bar', { httpOnly: true }) // \"foo=bar; httpOnly\"\n * ```\n */\nexport function cookieSerialize(name: string, val: string, options?: SerializeOptions): string {\n const opt = Object.assign({}, options || {});\n const encode = opt.encode || defaultEncode;\n\n if (!fieldContentRegExp.test(name)) {\n throw new TypeError('argument name is invalid');\n }\n\n const value = encode(val);\n\n if (value && !fieldContentRegExp.test(value)) {\n throw new TypeError('argument val is invalid');\n }\n\n let result = name + '=' + value;\n\n if (opt.maxAge != null) {\n const maxAge = opt.maxAge - 0;\n\n if (isNaN(maxAge) || !isFinite(maxAge)) {\n throw new TypeError('option maxAge is invalid');\n }\n\n result += '; Max-Age=' + Math.floor(maxAge);\n }\n\n if (opt.domain) {\n if (!fieldContentRegExp.test(opt.domain)) {\n throw new TypeError('option domain is invalid');\n }\n\n result += '; Domain=' + opt.domain;\n }\n\n if (opt.path) {\n if (!fieldContentRegExp.test(opt.path)) {\n throw new TypeError('option path is invalid');\n }\n\n result += '; Path=' + opt.path;\n }\n\n if (opt.expires) {\n if (!isDate(opt.expires) || isNaN(opt.expires.valueOf())) {\n throw new TypeError('option expires is invalid');\n }\n\n result += '; Expires=' + opt.expires.toUTCString();\n }\n\n if (opt.httpOnly) {\n result += '; HttpOnly';\n }\n\n if (opt.secure) {\n result += '; Secure';\n }\n\n if (opt.priority) {\n const priority = typeof opt.priority === 'string' ? opt.priority.toLowerCase() : opt.priority;\n\n switch (priority) {\n case 'low':\n result += '; Priority=Low';\n break;\n case 'medium':\n result += '; Priority=Medium';\n break;\n case 'high':\n result += '; Priority=High';\n break;\n default:\n throw new TypeError('option priority is invalid');\n }\n }\n\n if (opt.sameSite) {\n const sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;\n\n switch (sameSite) {\n case true:\n result += '; SameSite=Strict';\n break;\n case 'lax':\n result += '; SameSite=Lax';\n break;\n case 'strict':\n result += '; SameSite=Strict';\n break;\n case 'none':\n result += '; SameSite=None';\n break;\n default:\n throw new TypeError('option sameSite is invalid');\n }\n }\n\n return result;\n};\n\n/**\n * Default URL-decode string value function.\n * Optimized to skip native call when no `%`.\n */\nfunction defaultDecode(val: string): string {\n return val.indexOf('%') !== -1\n ? decodeURIComponent(val)\n : val;\n}\n\n/**\n * Default URL-encode value function.\n */\nfunction defaultEncode(val: string | number | boolean): string {\n return encodeURIComponent(val);\n}\n\n/**\n * Determines if value is a Date.\n */\nfunction isDate(val: any): boolean {\n return (\n Object.prototype.toString.call(val) === '[object Date]' ||\n val instanceof Date\n );\n}\n","export default abstract class BaseModel {\n 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 { cookieParse, cookieSerialize, SerializeOptions } from '@/stores/utils/cookie';\nimport { isTokenExpired, getTokenPayload } from '@/stores/utils/jwt';\nimport User from '@/models/User';\nimport Admin from '@/models/Admin';\n\ntype onChangeFunc = (token: string, model: User|Admin|null) => void;\n\nconst defaultCookieKey = 'pb_auth';\n\n/**\n * Base AuthStore class that is intended to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore {\n protected baseToken: string = '';\n protected baseModel: User|Admin|null = null;\n\n private _onChangeCallbacks: Array = [];\n\n /**\n * Retrieves the stored token (if any).\n */\n get token(): string {\n return this.baseToken;\n }\n\n /**\n * Retrieves the stored model data (if any).\n */\n get model(): User|Admin|null {\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 !isTokenExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: User|Admin|null): void {\n this.baseToken = token || '';\n\n // normalize the model instance\n if (model !== null && typeof model === 'object') {\n this.baseModel = (model as any)?.verified !== 'undefined' ?\n new User(model) : new Admin(model);\n } else {\n this.baseModel = null;\n }\n\n this.triggerChange();\n }\n\n /**\n * Removes the stored token and model data form the auth store.\n */\n clear(): void {\n this.baseToken = '';\n this.baseModel = null;\n this.triggerChange();\n }\n\n /**\n * Parses the provided cookie string and updates the store state\n * with the cookie's token and model data.\n */\n loadFromCookie(cookie: string, key = defaultCookieKey): void {\n const rawData = cookieParse(cookie || '')[key] || '';\n\n let data: { [key: string]: any } = {};\n try {\n data = JSON.parse(rawData);\n // normalize\n if (typeof data === null || typeof data !== 'object' || Array.isArray(data)) {\n data = {};\n }\n } catch (_) {}\n\n this.save(data.token || '', data.model || {});\n }\n\n /**\n * Exports the current store state as cookie string.\n *\n * By default the following optional attributes are added:\n * - Secure\n * - HttpOnly\n * - SameSite=Strict\n * - Path=/\n * - Expires={the token expiration date}\n *\n * NB! If the generated cookie exceeds 4096 bytes, this method will\n * strip the model data to the bare minimum to try to fit within the\n * recommended size in https://www.rfc-editor.org/rfc/rfc6265#section-6.1.\n */\n exportToCookie(options?: SerializeOptions, key = defaultCookieKey): string {\n const defaultOptions: SerializeOptions = {\n secure: true,\n sameSite: true,\n httpOnly: true,\n path: \"/\",\n };\n\n // extract the token expiration date\n const payload = getTokenPayload(this.token);\n if (payload?.exp) {\n defaultOptions.expires = new Date(payload.exp * 1000);\n } else {\n defaultOptions.expires = new Date('1970-01-01');\n }\n\n // merge with the user defined options\n options = Object.assign({}, defaultOptions, options);\n\n const rawData = {\n token: this.token,\n model: this.model?.export() || null,\n };\n\n let result = cookieSerialize(key, JSON.stringify(rawData), options);\n\n // strip down the model data to the bare minimum\n if (rawData.model && new Blob([result]).size > 4096) {\n rawData.model = {id: rawData?.model?.id, email: rawData?.model?.email};\n if (this.model instanceof User) {\n rawData.model.verified = this.model.verified;\n }\n result = cookieSerialize(key, JSON.stringify(rawData), options)\n }\n\n return result;\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * 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","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 storageFallback: { [key: string]: any } = {};\n private storageKey: string\n\n constructor(storageKey = \"pocketbase_auth\") {\n super();\n\n this.storageKey = storageKey;\n }\n\n /**\n * @inheritdoc\n */\n get token(): string {\n const data = this._storageGet(this.storageKey) || {};\n\n return data.token || '';\n }\n\n /**\n * @inheritdoc\n */\n get model(): User|Admin|null {\n const data = this._storageGet(this.storageKey) || {};\n\n if (\n data === null ||\n typeof data !== 'object' ||\n data.model === null ||\n typeof data.model !== 'object'\n ) {\n return null;\n }\n\n // admins don't have `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|null) {\n this._storageSet(this.storageKey, {\n 'token': token,\n 'model': model,\n });\n\n super.save(token, model);\n }\n\n /**\n * @inheritdoc\n */\n clear() {\n this._storageRemove(this.storageKey);\n\n super.clear();\n }\n\n // ---------------------------------------------------------------\n // Internal helpers:\n // ---------------------------------------------------------------\n\n /**\n * Retrieves `key` from the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageGet(key: string): any {\n if (typeof window !== 'undefined' && window?.localStorage) {\n const rawValue = window?.localStorage?.getItem(key) || '';\n try {\n return JSON.parse(rawValue);\n } catch (e) { // not a json\n return rawValue;\n }\n }\n\n // fallback\n return this.storageFallback[key];\n }\n\n /**\n * Stores a new data in the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageSet(key: string, value: any) {\n if (typeof window !== 'undefined' && window?.localStorage) {\n // store in local storage\n let normalizedVal = value;\n if (typeof value !== 'string') {\n normalizedVal = JSON.stringify(value);\n }\n window?.localStorage?.setItem(key, normalizedVal);\n } else {\n // store in fallback\n this.storageFallback[key] = value;\n }\n }\n\n /**\n * Removes `key` from the browser's local storage and the runtime/memory.\n */\n private _storageRemove(key: string) {\n // delete from local storage\n if (typeof window !== 'undefined') {\n window?.localStorage?.removeItem(key);\n }\n\n // delete from fallback\n delete this.storageFallback[key];\n }\n}\n","import Client from '@/Client';\n\n/**\n * BaseService class that should be inherited from all API services.\n */\nexport default abstract class BaseService {\n readonly client: Client\n\n constructor(client: Client) {\n this.client = client;\n }\n}\n","import BaseService from '@/services/utils/BaseService';\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 BaseAuthStore from '@/stores/BaseAuthStore';\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 replaceable instance of the local auth store service.\n */\n authStore: BaseAuthStore;\n\n /**\n * An instance of the service that handles the **Settings APIs**.\n */\n readonly settings: 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?: BaseAuthStore | 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(): BaseAuthStore {\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","fieldContentRegExp","cookieSerialize","val","options","opt","assign","encode","defaultEncode","test","TypeError","value","result","maxAge","isNaN","isFinite","Math","floor","domain","path","expires","toString","Date","isDate","valueOf","toUTCString","httpOnly","secure","priority","toLowerCase","sameSite","defaultDecode","indexOf","decodeURIComponent","encodeURIComponent","getTokenPayload","token","base64","split","map","c","charCodeAt","slice","join","JSON","parse","e","atob","a","Buffer","from","BaseModel","load","id","created","updated","defineProperty","get","clone","constructor","stringify","export","Record","_i","entries","length","_b","key","User","email","verified","lastResetSentAt","lastVerificationSentAt","profile","Admin","avatar","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","expirationThreshold","payload","keys","exp","now","isTokenExpired","save","model","triggerChange","clear","loadFromCookie","cookie","rawData","str","decode","index","eqIdx","endIdx","lastIndexOf","trim","undefined","_","cookieParse","Array","isArray","exportToCookie","defaultOptions","Blob","size","_c","onChange","callback","push","i","splice","LocalAuthStore","storageKey","storageFallback","_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","request","__awaiter","_getList","list","castedList","concat","item","_getOne","_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","authViaOAuth2","provider","code","codeVerifier","redirectUrl","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","SchemaField","type","system","required","unique","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","reqConfig","config","_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,S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jC,UACR,EAKDpC,EAAQrR,UAAAmR,SAAR,SAASxP,GACL,IAAIlC,EAAMF,KAAKqP,SAAWrP,KAAKqP,QAAQ8E,SAAS,KAAO,GAAK,KAI5D,OAHI/R,IACAlC,GAAQkC,EAAKgS,WAAW,KAAOhS,EAAKiS,UAAU,GAAKjS,GAEhDlC,GAMH4R,EAAoBrR,UAAAkT,qBAA5B,SAA6BnK,GACzB,IAAM3H,EAAwB,GAC9B,IAAK,IAAMuD,KAAOoE,EACd,GAAoB,OAAhBA,EAAOpE,GAAX,CAKA,IAAMxD,EAAQ4H,EAAOpE,GACfkP,EAAanR,mBAAmBiC,GAEtC,GAAIoC,MAAMC,QAAQ7F,GAEd,IAAgB,QAAA2S,EAAA3S,EAAAoD,EAAKuP,EAAArP,OAALF,IAAO,CAAlB,IAAMwP,EAACD,EAAAvP,GACRnD,EAAOoG,KAAKqM,EAAa,IAAMnR,mBAAmBqR,GACrD,MACM5S,aAAiBW,KACxBV,EAAOoG,KAAKqM,EAAa,IAAMnR,mBAAmBvB,EAAM6S,gBAChC,cAAV7S,GAAmC,iBAAVA,EACvCC,EAAOoG,KAAKqM,EAAa,IAAMnR,mBAAmBU,KAAKgB,UAAUjD,KAEjEC,EAAOoG,KAAKqM,EAAa,IAAMnR,mBAAmBvB,GAfrD,CAmBL,OAAOC,EAAO+B,KAAK,MAE1BkO,CAAD"} \ No newline at end of file diff --git a/dist/pocketbase.iife.d.ts b/dist/pocketbase.iife.d.ts index 8f834d1..1e1bae6 100644 --- a/dist/pocketbase.iife.d.ts +++ b/dist/pocketbase.iife.d.ts @@ -131,47 +131,6 @@ declare abstract class BaseAuthStore { onChange(callback: () => void): () => void; protected triggerChange(): void; } -/** - * The minimal AuthStore interface. - * - * @deprecated - * This interface predates the abstract BaseAuthStore class - * and it is kept mainly for backward compatibility. - * - * New AuthStore implementations should extend directly the - * BaseAuthStore abstract class. - */ -type AuthStore = { - /** - * Retrieves the stored token (if any). - */ - readonly token: string; - /** - * Retrieves the stored model data (if any). - */ - readonly model: User | Admin | null; - /** - * Checks if the store has valid (aka. existing and unexpired) token. - */ - readonly isValid: boolean; - /** - * Saves new token and model data in the auth store. - */ - save(token: string, model: User | Admin | null): void; - /** - * Removes the stored token and model data form the auth store. - */ - clear(): void; - /** - * Parses the provided cookie string and updates the store state - * with the cookie's token and model data. - */ - loadFromCookie(cookie: string, key?: string): void; - /** - * Exports the current store state as cookie string. - */ - exportToCookie(options?: SerializeOptions, key?: string): string; -}; /** * BaseService class that should be inherited from all API services. */ @@ -639,9 +598,9 @@ declare class Client { */ lang: string; /** - * A replaceable instance of the local `AuthStore` service. + * A replaceable instance of the local auth store service. */ - authStore: AuthStore | BaseAuthStore; + authStore: BaseAuthStore; /** * An instance of the service that handles the **Settings APIs**. */ @@ -671,11 +630,11 @@ declare class Client { */ readonly realtime: Realtime; private cancelControllers; - constructor(baseUrl?: string, lang?: string, authStore?: AuthStore | BaseAuthStore | null); + constructor(baseUrl?: string, lang?: string, authStore?: BaseAuthStore | null); /** * @deprecated Legacy alias for `this.authStore`. */ - get AuthStore(): AuthStore; + get AuthStore(): BaseAuthStore; /** * @deprecated Legacy alias for `this.settings`. */ diff --git a/dist/pocketbase.umd.d.ts b/dist/pocketbase.umd.d.ts index 8f834d1..1e1bae6 100644 --- a/dist/pocketbase.umd.d.ts +++ b/dist/pocketbase.umd.d.ts @@ -131,47 +131,6 @@ declare abstract class BaseAuthStore { onChange(callback: () => void): () => void; protected triggerChange(): void; } -/** - * The minimal AuthStore interface. - * - * @deprecated - * This interface predates the abstract BaseAuthStore class - * and it is kept mainly for backward compatibility. - * - * New AuthStore implementations should extend directly the - * BaseAuthStore abstract class. - */ -type AuthStore = { - /** - * Retrieves the stored token (if any). - */ - readonly token: string; - /** - * Retrieves the stored model data (if any). - */ - readonly model: User | Admin | null; - /** - * Checks if the store has valid (aka. existing and unexpired) token. - */ - readonly isValid: boolean; - /** - * Saves new token and model data in the auth store. - */ - save(token: string, model: User | Admin | null): void; - /** - * Removes the stored token and model data form the auth store. - */ - clear(): void; - /** - * Parses the provided cookie string and updates the store state - * with the cookie's token and model data. - */ - loadFromCookie(cookie: string, key?: string): void; - /** - * Exports the current store state as cookie string. - */ - exportToCookie(options?: SerializeOptions, key?: string): string; -}; /** * BaseService class that should be inherited from all API services. */ @@ -639,9 +598,9 @@ declare class Client { */ lang: string; /** - * A replaceable instance of the local `AuthStore` service. + * A replaceable instance of the local auth store service. */ - authStore: AuthStore | BaseAuthStore; + authStore: BaseAuthStore; /** * An instance of the service that handles the **Settings APIs**. */ @@ -671,11 +630,11 @@ declare class Client { */ readonly realtime: Realtime; private cancelControllers; - constructor(baseUrl?: string, lang?: string, authStore?: AuthStore | BaseAuthStore | null); + constructor(baseUrl?: string, lang?: string, authStore?: BaseAuthStore | null); /** * @deprecated Legacy alias for `this.authStore`. */ - get AuthStore(): AuthStore; + get AuthStore(): BaseAuthStore; /** * @deprecated Legacy alias for `this.settings`. */ diff --git a/package.json b/package.json index 483bff6..f1d98f6 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.6.0", + "version": "0.6.1", "name": "pocketbase", "description": "PocketBase JavaScript SDK", "author": "Gani Georgiev", diff --git a/src/Client.ts b/src/Client.ts index 01415ec..6c336f0 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -1,6 +1,5 @@ import ClientResponseError from '@/ClientResponseError'; import BaseAuthStore from '@/stores/BaseAuthStore'; -import { AuthStore } from '@/stores/utils/AuthStore'; import LocalAuthStore from '@/stores/LocalAuthStore'; import Settings from '@/services/Settings'; import Admins from '@/services/Admins'; @@ -70,9 +69,9 @@ export default class Client { lang: string; /** - * A replaceable instance of the local `AuthStore` service. + * A replaceable instance of the local auth store service. */ - authStore: AuthStore | BaseAuthStore; + authStore: BaseAuthStore; /** * An instance of the service that handles the **Settings APIs**. @@ -114,7 +113,7 @@ export default class Client { constructor( baseUrl = '/', lang = 'en-US', - authStore?: AuthStore | BaseAuthStore | null, + authStore?: BaseAuthStore | null, ) { this.baseUrl = baseUrl; this.lang = lang; @@ -133,7 +132,7 @@ export default class Client { /** * @deprecated Legacy alias for `this.authStore`. */ - get AuthStore(): AuthStore { + get AuthStore(): BaseAuthStore { return this.authStore; }; diff --git a/src/stores/utils/AuthStore.ts b/src/stores/utils/AuthStore.ts deleted file mode 100644 index 0a09636..0000000 --- a/src/stores/utils/AuthStore.ts +++ /dev/null @@ -1,52 +0,0 @@ -import User from '@/models/User'; -import Admin from '@/models/Admin'; - -import { SerializeOptions } from '@/stores/utils/cookie'; - -/** - * The minimal AuthStore interface. - * - * @deprecated - * This interface predates the abstract BaseAuthStore class - * and it is kept mainly for backward compatibility. - * - * New AuthStore implementations should extend directly the - * BaseAuthStore abstract class. - */ -export type AuthStore = { - /** - * Retrieves the stored token (if any). - */ - readonly token: string - - /** - * Retrieves the stored model data (if any). - */ - readonly model: User|Admin|null - - /** - * Checks if the store has valid (aka. existing and unexpired) token. - */ - readonly isValid: boolean - - /** - * Saves new token and model data in the auth store. - */ - save(token: string, model: User|Admin|null): void - - /** - * Removes the stored token and model data form the auth store. - */ - clear(): void - - /** - * Parses the provided cookie string and updates the store state - * with the cookie's token and model data. - */ - loadFromCookie(cookie: string, key?: string): void - - /** - * Exports the current store state as cookie string. - */ - exportToCookie(options?: SerializeOptions, key?: string): string -}