diff --git a/dist/pocketbase.cjs.d.ts b/dist/pocketbase.cjs.d.ts index 710fe8c..e98eb51 100644 --- a/dist/pocketbase.cjs.d.ts +++ b/dist/pocketbase.cjs.d.ts @@ -366,6 +366,10 @@ declare class Collections extends CrudService { baseCrudPath(): string; /** * Imports the provided collections. + * + * If `deleteMissing` is `true`, all local collections and schema fields, + * that are not present in the imported configuration, WILL BE DELETED + * (including their related records data)! */ import(collections: Array, deleteMissing?: boolean, queryParams?: {}): Promise; } diff --git a/dist/pocketbase.es.d.mts b/dist/pocketbase.es.d.mts index 25e0c4f..61d269c 100644 --- a/dist/pocketbase.es.d.mts +++ b/dist/pocketbase.es.d.mts @@ -366,6 +366,10 @@ declare class Collections extends CrudService { baseCrudPath(): string; /** * Imports the provided collections. + * + * If `deleteMissing` is `true`, all local collections and schema fields, + * that are not present in the imported configuration, WILL BE DELETED + * (including their related records data)! */ import(collections: Array, deleteMissing?: boolean, queryParams?: {}): Promise; } diff --git a/dist/pocketbase.es.mjs.map b/dist/pocketbase.es.mjs.map index 009932f..28a3d41 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/BaseAuthStore.ts","../src/models/utils/BaseModel.ts","../src/models/Record.ts","../src/models/User.ts","../src/models/Admin.ts","../src/stores/LocalAuthStore.ts","../src/services/utils/BaseService.ts","../src/services/Settings.ts","../src/models/utils/ListResult.ts","../src/services/utils/BaseCrudService.ts","../src/services/utils/CrudService.ts","../src/services/Admins.ts","../src/services/Users.ts","../src/models/utils/SchemaField.ts","../src/models/Collection.ts","../src/services/Collections.ts","../src/services/Records.ts","../src/services/utils/SubCrudService.ts","../src/models/LogRequest.ts","../src/services/Logs.ts","../src/services/Realtime.ts","../src/Client.ts"],"sourcesContent":["/**\n * ClientResponseError is a custom Error class that is intended to wrap\n * and normalize any error thrown by `Client.send()`.\n */\nexport default class ClientResponseError extends Error {\n url: string = '';\n status: number = 0;\n data: {[key: string]: any} = {};\n isAbort: boolean = false;\n originalError: any = null;\n\n constructor(errData?: any) {\n super(\"ClientResponseError\");\n\n // Set the prototype explicitly.\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, ClientResponseError.prototype);\n\n if (!(errData instanceof ClientResponseError)) {\n this.originalError = errData;\n }\n\n if (errData !== null && typeof errData === 'object') {\n this.url = typeof errData.url === 'string' ? errData.url : '';\n this.status = typeof errData.status === 'number' ? errData.status : 0;\n this.data = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\n }\n\n if (typeof DOMException !== 'undefined' && errData instanceof DOMException) {\n this.isAbort = true;\n }\n\n this.name = \"ClientResponseError \" + this.status;\n this.message = this.data?.message || 'Something went wrong while processing your request.'\n }\n\n // Make a POJO's copy of the current error class instance.\n // @see https://github.com/vuex-orm/vuex-orm/issues/255\n toJSON () {\n return { ...this };\n }\n}\n","let atobPolyfill: Function;\nif (typeof atob === 'function') {\n atobPolyfill = atob\n} else {\n atobPolyfill = (a: any) => Buffer.from(a, 'base64').toString('binary');\n}\n\nexport default class JWT {\n /**\n * Returns JWT token's payload data.\n */\n static getPayload(token: string): { [key: string]: any } {\n if (token) {\n try {\n\n let base64 = decodeURIComponent(atobPolyfill(token.split('.')[1]).split('').map(function (c: string) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n\n return JSON.parse(base64) || {};\n } catch (e) {\n }\n }\n\n return {};\n }\n\n /**\n * Checks whether a JWT token is expired or not.\n * Tokens without `exp` payload key are considered valid.\n * Tokens with empty payload (eg. invalid token strings) are considered expired.\n *\n * @param token The token to check.\n * @param [expirationThreshold] Time in seconds that will be substracted from the token `exp` property.\n */\n static isExpired(token: string, expirationThreshold = 0): boolean {\n let payload = JWT.getPayload(token);\n\n if (\n Object.keys(payload).length > 0 &&\n (!payload.exp || (payload.exp - expirationThreshold) > (Date.now() / 1000))\n ) {\n return false;\n }\n\n return true;\n }\n}\n","import { AuthStore } from '@/stores/utils/AuthStore';\nimport JWT from '@/stores/utils/JWT';\nimport User from '@/models/User';\nimport Admin from '@/models/Admin';\n\ntype onChangeFunc = (token: string, model: User | Admin | {}) => void;\n\n/**\n * Base AuthStore class that is intented to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore implements AuthStore {\n protected baseToken: string = '';\n protected baseModel: User | Admin | {} = {};\n\n private _onChangeCallbacks: Array = [];\n\n /**\n * Retrieves the stored token (if any).\n */\n get token(): string {\n return this.baseToken;\n }\n\n /**\n * Retrieves the stored model data (if any).\n */\n get model(): User | Admin | {} {\n return this.baseModel;\n }\n\n /**\n * Checks if the store has valid (aka. existing and unexpired) token.\n */\n get isValid(): boolean {\n return !JWT.isExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: User | Admin | {}): void {\n this.baseToken = token;\n this.baseModel = model;\n this.triggerChange();\n }\n\n /**\n * Removes the stored token and model data form the auth store.\n */\n clear(): void {\n this.baseToken = '';\n this.baseModel = {};\n this.triggerChange();\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * Returns a removal function that you could call to \"unsubscibe\" from the changes.\n */\n onChange(callback: () => void): () => void {\n this._onChangeCallbacks.push(callback);\n\n return () => {\n for (let i = this._onChangeCallbacks.length - 1; i >= 0; i--) {\n if (this._onChangeCallbacks[i] == callback) {\n delete this._onChangeCallbacks[i]; // removes the function reference\n this._onChangeCallbacks.splice(i, 1); // reindex the array\n return;\n }\n }\n }\n }\n\n protected triggerChange(): void {\n for (const callback of this._onChangeCallbacks) {\n callback && callback(this.token, this.model);\n }\n }\n}\n","export default abstract class BaseModel {\n id!: string;\n created!: string;\n updated!: string;\n\n constructor(data: { [key: string]: any } = {}) {\n this.load(data || {});\n }\n\n /**\n * Loads `data` into the current model.\n */\n load(data: { [key: string]: any }) {\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.created = typeof data.created !== 'undefined' ? data.created : '';\n this.updated = typeof data.updated !== 'undefined' ? data.updated : '';\n }\n\n /**\n * Returns whether the current loaded data represent a stored db record.\n */\n get isNew(): boolean {\n return (\n // id is not set\n !this.id ||\n // zero uuid value\n this.id === '00000000-0000-0000-0000-000000000000'\n );\n }\n\n /**\n * Robust deep clone of a model.\n */\n clone(): BaseModel {\n return new (this.constructor as any)(JSON.parse(JSON.stringify(this)));\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n export(): { [key: string]: any } {\n return Object.assign({}, this);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Record extends BaseModel {\n [key: string]: any,\n\n '@collectionId'!: string;\n '@collectionName'!: string;\n '@expand'!: {[key: string]: any};\n\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n for (const [key, value] of Object.entries(data)) {\n this[key] = value;\n }\n\n // normalize common fields\n this['@collectionId'] = typeof data['@collectionId'] !== 'undefined' ? data['@collectionId'] : '';\n this['@collectionName'] = typeof data['@collectionName'] !== 'undefined' ? data['@collectionName'] : '';\n this['@expand'] = typeof data['@expand'] !== 'undefined' ? data['@expand'] : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport Record from '@/models/Record';\n\nexport default class User extends BaseModel {\n email!: string;\n verified!: boolean;\n lastResetSentAt!: string;\n lastVerificationSentAt!: string;\n profile!: null|Record;\n\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n this.email = typeof data.email === 'string' ? data.email : '';\n this.verified = !!data.verified;\n this.lastResetSentAt = typeof data.lastResetSentAt === 'string' ? data.lastResetSentAt : '';\n this.lastVerificationSentAt = typeof data.lastVerificationSentAt === 'string' ? data.lastVerificationSentAt : '';\n this.profile = data.profile ? new Record(data.profile) : null;\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Admin extends BaseModel {\n avatar!: number;\n email!: string;\n lastResetSentAt!: string;\n\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n this.avatar = typeof data.avatar === 'number' ? data.avatar : 0;\n this.email = typeof data.email === 'string' ? data.email : '';\n this.lastResetSentAt = typeof data.lastResetSentAt === 'string' ? data.lastResetSentAt : '';\n }\n}\n","import BaseAuthStore from '@/stores/BaseAuthStore';\nimport User from '@/models/User';\nimport Admin from '@/models/Admin';\n\n/**\n * The default token store for browsers with auto fallback\n * to runtime/memory if local storage is undefined (eg. in node env).\n */\nexport default class LocalAuthStore extends BaseAuthStore {\n private fallback: { [key: string]: any } = {};\n private storageKey: string\n\n constructor(storageKey = \"pocketbase_auth\") {\n super();\n\n this.storageKey = storageKey;\n }\n\n /**\n * @inheritdoc\n */\n get token(): string {\n const data = this._storageGet(this.storageKey) || {};\n\n return data.token || '';\n }\n\n /**\n * @inheritdoc\n */\n get model(): User | Admin | {} {\n const data = this._storageGet(this.storageKey) || {};\n\n if (\n data === null ||\n typeof data !== 'object' ||\n data.model === null ||\n typeof data.model !== 'object'\n ) {\n return {};\n }\n\n // admins don't have `verified` prop\n if (typeof data.model?.verified !== 'undefined') {\n return new User(data.model);\n }\n\n return new Admin(data.model);\n }\n\n /**\n * @inheritdoc\n */\n save(token: string, model: User | Admin | {}) {\n this._storageSet(this.storageKey, {\n 'token': token,\n 'model': model,\n });\n\n super.save(token, model);\n }\n\n /**\n * @inheritdoc\n */\n clear() {\n this._storageRemove(this.storageKey);\n\n super.clear();\n }\n\n // ---------------------------------------------------------------\n // Internal helpers:\n // ---------------------------------------------------------------\n\n /**\n * Retrieves `key` from the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageGet(key: string): any {\n if (typeof window !== 'undefined' && window?.localStorage) {\n const rawValue = window?.localStorage?.getItem(key) || '';\n try {\n return JSON.parse(rawValue);\n } catch (e) { // not a json\n return rawValue;\n }\n }\n\n // fallback to runtime/memory\n return this.fallback[key];\n }\n\n /**\n * Stores a new data in the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageSet(key: string, value: any) {\n if (typeof window !== 'undefined' && window?.localStorage) {\n // store in local storage\n let normalizedVal = value;\n if (typeof value !== 'string') {\n normalizedVal = JSON.stringify(value);\n }\n window?.localStorage?.setItem(key, normalizedVal);\n } else {\n // store in runtime/memory\n this.fallback[key] = value;\n }\n }\n\n /**\n * Removes `key` from the browser's local storage and the runtime/memory.\n */\n private _storageRemove(key: string) {\n // delete from local storage\n if (typeof window !== 'undefined') {\n window?.localStorage?.removeItem(key);\n }\n\n // delete from runtime/memory\n delete this.fallback[key];\n }\n}\n","import Client from '@/Client';\n\n/**\n * BaseService class that should be inherited from all API services.\n */\nexport default abstract class BaseService {\n readonly client: Client\n\n constructor(client: Client) {\n this.client = client;\n }\n}\n","import BaseService from '@/services/utils/BaseService';\n\nexport default class Settings extends BaseService {\n /**\n * Fetch all available app settings.\n */\n getAll(queryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Bulk updates app settings.\n */\n update(bodyParams = {}, queryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData) => responseData || {});\n }\n}\n","import BaseModel from './BaseModel';\n\nexport default class ListResult {\n page!: number;\n perPage!: number;\n totalItems!: number;\n totalPages!: number;\n items!: Array;\n\n constructor(\n page: number,\n perPage: number,\n totalItems: number,\n totalPages: number,\n items: Array,\n ) {\n this.page = page > 0 ? page : 1;\n this.perPage = perPage >= 0 ? perPage : 0;\n this.totalItems = totalItems >= 0 ? totalItems : 0;\n this.totalPages = totalPages >= 0 ? totalPages : 0;\n this.items = items || [];\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\n\nexport default abstract class BaseCrudService extends BaseService {\n /**\n * Response data decoder.\n */\n abstract decode(data: { [key: string]: any }): M\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n protected _getFullList(basePath: string, batchSize = 100, queryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize, queryParams).then((list) => {\n const castedList = (list as ListResult);\n const items = castedList.items;\n const totalItems = castedList.totalItems;\n\n result = result.concat(items);\n\n if (items.length && totalItems > result.length) {\n return request(page + 1);\n }\n\n return result;\n });\n }\n\n return request(1);\n }\n\n /**\n * Returns paginated items list.\n */\n protected _getList(basePath: string, page = 1, perPage = 30, queryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send(basePath, {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData.items || [];\n for (const item of responseData.items) {\n items.push(this.decode(item));\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns single item by its id.\n */\n protected _getOne(basePath: string, id: string, queryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => this.decode(responseData));\n }\n\n /**\n * Creates a new item.\n */\n protected _create(basePath: string, bodyParams = {}, queryParams = {}): Promise {\n return this.client.send(basePath, {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData));\n }\n\n /**\n * Updates an existing item by its id.\n */\n protected _update(basePath: string, id: string, bodyParams = {}, queryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData));\n }\n\n /**\n * Deletes an existing item by its id.\n */\n protected _delete(basePath: string, id: string, queryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n}\n","import ListResult from '@/models/utils/ListResult';\nimport BaseModel from '@/models/utils/BaseModel';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\n\nexport default abstract class CrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/admins').\n */\n abstract baseCrudPath(): string\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n getFullList(batchSize = 100, queryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath(), batchSize, queryParams);\n }\n\n /**\n * Returns paginated items list.\n */\n getList(page = 1, perPage = 30, queryParams = {}): Promise> {\n return this._getList(this.baseCrudPath(), page, perPage, queryParams);\n }\n\n /**\n * Returns single item by its id.\n */\n getOne(id: string, queryParams = {}): Promise {\n return this._getOne(this.baseCrudPath(), id, queryParams);\n }\n\n /**\n * Creates a new item.\n */\n create(bodyParams = {}, queryParams = {}): Promise {\n return this._create(this.baseCrudPath(), bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n */\n update(id: string, bodyParams = {}, queryParams = {}): Promise {\n return this._update(this.baseCrudPath(), id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(id: string, queryParams = {}): Promise {\n return this._delete(this.baseCrudPath(), id, queryParams);\n }\n}\n","import CrudService from '@/services/utils/CrudService';\nimport Admin from '@/models/Admin';\n\nexport type AdminAuthResponse = {\n [key: string]: any,\n token: string,\n admin: Admin,\n}\n\nexport default class Admins extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Admin {\n return new Admin(data);\n }\n\n /**\n * @inheritdoc\n */\n baseCrudPath(): string {\n return '/api/admins';\n }\n\n /**\n * Prepare successful authorize response.\n */\n protected authResponse(responseData: any): AdminAuthResponse {\n const admin = this.decode(responseData?.admin || {});\n\n if (responseData?.token && responseData?.admin) {\n this.client.authStore.save(responseData.token, admin);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'admin': admin,\n });\n }\n\n /**\n * Authenticate an admin account by its email and password\n * and returns a new admin token and data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authViaEmail(\n email: string,\n password: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/auth-via-email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n 'headers': {\n 'Authorization': '',\n },\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Refreshes the current admin authenticated instance and\n * returns a new token and admin data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n refresh(bodyParams = {}, queryParams = {}): Promise {\n return this.client.send(this.baseCrudPath() + '/refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends admin password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms admin password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n}\n","import CrudService from '@/services/utils/CrudService';\nimport User from '@/models/User';\n\nexport type UserAuthResponse = {\n [key: string]: any,\n token: string,\n user: User,\n}\n\nexport type AuthProviderInfo = {\n name: string,\n state: string,\n codeVerifier: string,\n codeChallenge: string,\n codeChallengeMethod: string,\n authUrl: string,\n}\n\nexport type AuthMethodsList = {\n [key: string]: any,\n emailPassword: boolean,\n authProviders: Array,\n}\n\nexport default class Users extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): User {\n return new User(data);\n }\n\n /**\n * @inheritdoc\n */\n baseCrudPath(): string {\n return '/api/users';\n }\n\n /**\n * Prepare successful authorization response.\n */\n protected authResponse(responseData: any): UserAuthResponse {\n const user = this.decode(responseData?.user || {});\n\n if (responseData?.token && responseData?.user) {\n this.client.authStore.save(responseData.token, user);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'user': user,\n });\n }\n\n /**\n * Returns all available application auth methods.\n */\n listAuthMethods(queryParams = {}): Promise {\n return this.client.send(this.baseCrudPath() + '/auth-methods', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n return Object.assign({}, responseData, {\n // normalize common fields\n 'emailPassword': !!responseData?.emailPassword,\n 'authProviders': Array.isArray(responseData?.authProviders) ? responseData?.authProviders : [],\n });\n });\n }\n\n /**\n * Authenticate a user via its email and password.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - new user authentication token\n * - the authenticated user model record\n */\n authViaEmail(\n email: string,\n password: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/auth-via-email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n 'headers': {\n 'Authorization': '',\n },\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Authenticate a user via OAuth2 client provider.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - new user authentication token\n * - the authenticated user model record\n * - the OAuth2 user profile data (eg. name, email, avatar, etc.)\n */\n authViaOAuth2(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'provider': provider,\n 'code': code,\n 'codeVerifier': codeVerifier,\n 'redirectUrl': redirectUrl,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/auth-via-oauth2', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n 'headers': {\n 'Authorization': '',\n },\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Refreshes the current user authenticated instance and\n * returns a new token and user data.\n *\n * On success this method also automatically updates the client's AuthStore data.\n */\n refresh(bodyParams = {}, queryParams = {}): Promise {\n return this.client.send(this.baseCrudPath() + '/refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends user password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms user password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends user verification email request.\n */\n requestVerification(\n email: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/request-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms user email verification request.\n */\n confirmVerification(\n verificationToken: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': verificationToken,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/confirm-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends an email change request to the authenticated user.\n */\n requestEmailChange(\n newEmail: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'newEmail': newEmail,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/request-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms user new email address.\n */\n confirmEmailChange(\n emailChangeToken: string,\n password: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': emailChangeToken,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/confirm-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n}\n","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n unique!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.load(data || {});\n }\n\n /**\n * Loads `data` into the field.\n */\n load(data: { [key: string]: any }) {\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.name = typeof data.name !== 'undefined' ? data.name : '';\n this.type = typeof data.type !== 'undefined' ? data.type : 'text';\n this.system = !!data.system;\n this.required = !!data.required;\n this.unique = !!data.unique;\n this.options = typeof data.options === 'object' && data.options !== null ? data.options : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport SchemaField from '@/models/utils/SchemaField';\n\nexport default class Collection extends BaseModel {\n name!: string;\n schema!: Array;\n system!: boolean;\n listRule!: null|string;\n viewRule!: null|string;\n createRule!: null|string;\n updateRule!: null|string;\n deleteRule!: null|string;\n\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n this.name = typeof data.name === 'string' ? data.name : '';\n this.system = !!data.system;\n\n // rules\n this.listRule = typeof data.listRule === 'string' ? data.listRule : null;\n this.viewRule = typeof data.viewRule === 'string' ? data.viewRule : null;\n this.createRule = typeof data.createRule === 'string' ? data.createRule : null;\n this.updateRule = typeof data.updateRule === 'string' ? data.updateRule : null;\n this.deleteRule = typeof data.deleteRule === 'string' ? data.deleteRule : null;\n\n // schema\n data.schema = Array.isArray(data.schema) ? data.schema : [];\n this.schema = [];\n for (let field of data.schema) {\n this.schema.push(new SchemaField(field));\n }\n }\n}\n","import CrudService from '@/services/utils/CrudService';\nimport Collection from '@/models/Collection';\n\nexport default class Collections extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Collection {\n return new Collection(data);\n }\n\n /**\n * @inheritdoc\n */\n baseCrudPath(): string {\n return '/api/collections';\n }\n\n /**\n * Imports the provided collections.\n */\n async import(collections: Array, deleteMissing: boolean = false, queryParams = {}): Promise {\n return this.client.send(this.baseCrudPath() + '/import', {\n 'method': 'PUT',\n 'params': queryParams,\n 'body': {\n 'collections': collections,\n 'deleteMissing': deleteMissing,\n }\n }).then(() => true);\n }\n}\n","import SubCrudService from '@/services/utils/SubCrudService';\nimport Record from '@/models/Record';\n\nexport default class Records extends SubCrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Record {\n return new Record(data);\n }\n\n /**\n * @inheritdoc\n */\n baseCrudPath(collectionIdOrName: string): string {\n return '/api/collections/' + encodeURIComponent(collectionIdOrName) + '/records';\n }\n\n /**\n * Builds and returns an absolute record file url.\n */\n getFileUrl(record: Record, filename: string, queryParams = {}): string {\n const parts = [];\n parts.push(this.client.baseUrl.replace(/\\/+$/gm, \"\"))\n parts.push(\"api\")\n parts.push(\"files\")\n parts.push(record[\"@collectionId\"])\n parts.push(record.id)\n parts.push(filename)\n let result = parts.join('/');\n\n if (Object.keys(queryParams).length) {\n const params = new URLSearchParams(queryParams);\n result += (result.includes(\"?\") ? \"&\" : \"?\") + params;\n }\n\n return result\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\n\nexport default abstract class SubCrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/collections/{:sub}/records').\n */\n abstract baseCrudPath(sub: string): string\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n getFullList(sub: string, batchSize = 100, queryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath(sub), batchSize, queryParams);\n }\n\n /**\n * Returns paginated items list.\n */\n getList(sub: string, page = 1, perPage = 30, queryParams = {}): Promise> {\n return this._getList(this.baseCrudPath(sub), page, perPage, queryParams);\n }\n\n /**\n * Returns single item by its id.\n */\n getOne(sub: string, id: string, queryParams = {}): Promise {\n return this._getOne(this.baseCrudPath(sub), id, queryParams);\n }\n\n /**\n * Creates a new item.\n */\n create(sub: string, bodyParams = {}, queryParams = {}): Promise {\n return this._create(this.baseCrudPath(sub), bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n */\n update(sub: string, id: string, bodyParams = {}, queryParams = {}): Promise {\n return this._update(this.baseCrudPath(sub), id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(sub: string, id: string, queryParams = {}): Promise {\n return this._delete(this.baseCrudPath(sub), id, queryParams);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class LogRequest extends BaseModel {\n url!: string;\n method!: string;\n status!: number;\n auth!: string;\n ip!: string;\n referer!: string;\n userAgent!: string;\n meta!: null|{ [key: string]: any };\n\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n this.url = typeof data.url === 'string' ? data.url : '';\n this.method = typeof data.method === 'string' ? data.method : 'GET';\n this.status = typeof data.status === 'number' ? data.status : 200;\n this.auth = typeof data.auth === 'string' ? data.auth : 'guest';\n this.ip = typeof data.ip === 'string' ? data.ip : '';\n this.referer = typeof data.referer === 'string' ? data.referer : '';\n this.userAgent = typeof data.userAgent === 'string' ? data.userAgent : '';\n this.meta = typeof data.meta === 'object' && data.meta !== null ? data.meta : {};\n }\n}\n","import LogRequest from '@/models/LogRequest';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\n\nexport type HourlyStats = {\n total: number,\n date: string,\n}\n\nexport default class Logs extends BaseService {\n /**\n * Returns paginated logged requests list.\n */\n getRequestsList(page = 1, perPage = 30, queryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send('/api/logs/requests', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData?.items || [];\n for (const item of responseData.items) {\n items.push(new LogRequest(item));\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns a single logged request by its id.\n */\n getRequest(id: string, queryParams = {}): Promise {\n return this.client.send('/api/logs/requests/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => new LogRequest(responseData));\n }\n\n /**\n * Returns request logs statistics.\n */\n getRequestsStats(queryParams = {}): Promise> {\n return this.client.send('/api/logs/requests/stats', {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => responseData);\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport Record from '@/models/Record';\n\nexport interface MessageData {\n [key: string]: any;\n action: string;\n record: Record;\n}\n\nexport interface SubscriptionFunc{\n (data: MessageData):void;\n}\n\nexport default class Realtime extends BaseService {\n private clientId: string = \"\";\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: EventListener } = {};\n\n /**\n * Inits the sse connection (if not already) and register the subscription.\n */\n async subscribe(subscription: string, callback: SubscriptionFunc): Promise {\n if (!subscription) {\n throw new Error('subscription must be set.')\n }\n\n // unsubscribe existing\n if (this.subscriptions[subscription]) {\n this.eventSource?.removeEventListener(subscription, this.subscriptions[subscription]);\n }\n\n // register subscription\n this.subscriptions[subscription] = function (e: Event) {\n const msgEvent = (e as MessageEvent);\n\n let data;\n try {\n data = JSON.parse(msgEvent?.data);\n } catch {}\n\n callback(data || {});\n }\n\n if (!this.eventSource) {\n // start a new sse connection\n this.connect();\n } else if (this.clientId) {\n // otherwise - just persist the updated subscriptions\n await this.submitSubscriptions();\n }\n }\n\n /**\n * Unsubscribe from a subscription.\n *\n * If the `subscription` argument is not set,\n * then the client will unsubscibe from all registered subscriptions.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operations there are no active subscriptions left.\n */\n async unsubscribe(subscription?: string): Promise {\n if (!subscription) {\n // remove all subscriptions\n this.removeSubscriptionListeners();\n this.subscriptions = {};\n } else if (this.subscriptions[subscription]) {\n // remove a single subscription\n this.eventSource?.removeEventListener(subscription, this.subscriptions[subscription]);\n delete this.subscriptions[subscription];\n } else {\n // not subscribed to the specified subscription\n return\n }\n\n if (this.clientId) {\n await this.submitSubscriptions();\n }\n\n // no more subscriptions -> close the sse connection\n if (!Object.keys(this.subscriptions).length) {\n this.disconnect();\n }\n }\n\n private async submitSubscriptions(): Promise {\n // optimistic update\n this.addSubscriptionListeners();\n\n return this.client.send('/api/realtime', {\n 'method': 'POST',\n 'body': {\n 'clientId': this.clientId,\n 'subscriptions': Object.keys(this.subscriptions),\n },\n }).then(() => true);\n }\n\n private addSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n this.removeSubscriptionListeners();\n\n for (let sub in this.subscriptions) {\n this.eventSource.addEventListener(sub, this.subscriptions[sub]);\n }\n }\n\n private removeSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n for (let sub in this.subscriptions) {\n this.eventSource.removeEventListener(sub, this.subscriptions[sub]);\n }\n }\n\n private connectHandler(e: Event): void {\n const msgEvent = (e as MessageEvent);\n this.clientId = msgEvent?.lastEventId;\n this.submitSubscriptions();\n }\n\n private connect(): void {\n this.disconnect();\n this.eventSource = new EventSource(this.client.buildUrl('/api/realtime'))\n this.eventSource.addEventListener('PB_CONNECT', (e) => this.connectHandler(e));\n }\n\n private disconnect(): void {\n this.removeSubscriptionListeners();\n this.eventSource?.removeEventListener('PB_CONNECT', (e) => this.connectHandler(e));\n this.eventSource?.close();\n this.eventSource = null;\n this.clientId = \"\";\n }\n}\n","import ClientResponseError from '@/ClientResponseError';\nimport { AuthStore } from '@/stores/utils/AuthStore';\nimport LocalAuthStore from '@/stores/LocalAuthStore';\nimport Settings from '@/services/Settings';\nimport Admins from '@/services/Admins';\nimport Users from '@/services/Users';\nimport Collections from '@/services/Collections';\nimport Records from '@/services/Records';\nimport Logs from '@/services/Logs';\nimport Realtime from '@/services/Realtime';\n\n/**\n * PocketBase JS Client.\n */\nexport default class Client {\n /**\n * The base PocketBase backend url address (eg. 'http://127.0.0.1.8090').\n */\n baseUrl: string;\n\n /**\n * Hook that get triggered right before sending the fetch request,\n * allowing you to inspect/modify the request config.\n *\n * Returns the new modified config that will be used to send the request.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, reqConfig) {\n * reqConfig.headers = Object.assign(reqConfig.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return reqConfig;\n * };\n * ```\n */\n beforeSend?: (url: string, reqConfig: { [key: string]: any }) => { [key: string]: any };\n\n /**\n * Hook that get triggered after successfully sending the fetch request,\n * allowing you to inspect/modify the response object and its parsed data.\n *\n * Returns the new Promise resolved `data` that will be returned to the client.\n *\n * Example:\n * ```js\n * client.afterSend = function (response, data) {\n * if (response.status != 200) {\n * throw new ClientResponseError({\n * url: response.url,\n * status: response.status,\n * data: data,\n * });\n * }\n *\n * return data;\n * };\n * ```\n */\n afterSend?: (response: Response, data: any) => any;\n\n /**\n * Optional language code (default to `en-US`) that will be sent\n * with the requests to the server as `Accept-Language` header.\n */\n lang: string;\n\n /**\n * A replacable instance of the local `AuthStore` service.\n */\n authStore: AuthStore;\n\n /**\n * An instance of the service that handles the **Settings APIs**.\n */\n readonly settings: Settings;\n\n /**\n * An instance of the service that handles the **Admin APIs**.\n */\n readonly admins: Admins;\n\n /**\n * An instance of the service that handles the **User APIs**.\n */\n readonly users: Users;\n\n /**\n * An instance of the service that handles the **Collection APIs**.\n */\n readonly collections: Collections;\n\n /**\n * An instance of the service that handles the **Record APIs**.\n */\n readonly records: Records;\n\n /**\n * An instance of the service that handles the **Log APIs**.\n */\n readonly logs: Logs;\n\n /**\n * An instance of the service that handles the **Realtime APIs**.\n */\n readonly realtime: Realtime;\n\n private cancelControllers: { [key: string]: AbortController } = {}\n\n constructor(\n baseUrl = '/',\n lang = 'en-US',\n authStore?: AuthStore | null,\n ) {\n this.baseUrl = baseUrl;\n this.lang = lang;\n this.authStore = authStore || new LocalAuthStore();\n\n // services\n this.admins = new Admins(this);\n this.users = new Users(this);\n this.records = new Records(this);\n this.collections = new Collections(this);\n this.logs = new Logs(this);\n this.settings = new Settings(this);\n this.realtime = new Realtime(this);\n }\n\n /**\n * @deprecated Legacy alias for `this.authStore`.\n */\n get AuthStore(): AuthStore {\n return this.authStore;\n };\n\n /**\n * @deprecated Legacy alias for `this.settings`.\n */\n get Settings(): Settings {\n return this.settings;\n };\n\n /**\n * @deprecated Legacy alias for `this.admins`.\n */\n get Admins(): Admins {\n return this.admins;\n };\n\n /**\n * @deprecated Legacy alias for `this.users`.\n */\n get Users(): Users {\n return this.users;\n };\n\n /**\n * @deprecated Legacy alias for `this.collections`.\n */\n get Collections(): Collections {\n return this.collections;\n };\n\n /**\n * @deprecated Legacy alias for `this.records`.\n */\n get Records(): Records {\n return this.records;\n };\n\n /**\n * @deprecated Legacy alias for `this.logs`.\n */\n get Logs(): Logs {\n return this.logs;\n };\n\n /**\n * @deprecated Legacy alias for `this.realtime`.\n */\n get Realtime(): Realtime {\n return this.realtime;\n };\n\n /**\n * Cancels single request by its cancellation key.\n */\n cancelRequest(cancelKey: string): Client {\n if (this.cancelControllers[cancelKey]) {\n this.cancelControllers[cancelKey].abort();\n delete this.cancelControllers[cancelKey];\n }\n\n return this;\n }\n\n /**\n * Cancels all pending requests.\n */\n cancelAllRequests(): Client {\n for (let k in this.cancelControllers) {\n this.cancelControllers[k].abort();\n }\n\n this.cancelControllers = {};\n\n return this;\n }\n\n /**\n * Sends an api http request.\n */\n async send(path: string, reqConfig: { [key: string]: any }): Promise {\n let config = Object.assign({ method: 'GET' } as { [key: string]: any }, reqConfig);\n\n // serialize the body if needed and set the correct content type\n // note1: for FormData body the Content-Type header should be skipped\n // note2: we are checking the constructor name because FormData is not available natively in node\n if (config.body && config.body.constructor.name !== 'FormData') {\n if (typeof config.body !== 'string') {\n config.body = JSON.stringify(config.body);\n }\n\n // add the json header (if not already)\n if (typeof config?.headers?.['Content-Type'] === 'undefined') {\n config.headers = Object.assign({}, config.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof config?.headers?.['Accept-Language'] === 'undefined') {\n config.headers = Object.assign({}, config.headers, {\n 'Accept-Language': this.lang,\n });\n }\n\n // check if Authorization header can be added\n if (\n // has stored token\n this.authStore?.token &&\n // auth header is not explicitly set\n (typeof config?.headers?.Authorization === 'undefined')\n ) {\n let authType = 'Admin';\n if (typeof (this.authStore.model as any)?.verified !== 'undefined') {\n authType = 'User'; // admins don't have verified\n }\n\n config.headers = Object.assign({}, config.headers, {\n 'Authorization': (authType + ' ' + this.authStore.token),\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (config.params?.$autoCancel !== false) {\n const cancelKey = config.params?.$cancelKey || ((config.method || 'GET') + path);\n\n // cancel previous pending requests\n this.cancelRequest(cancelKey);\n\n const controller = new AbortController();\n this.cancelControllers[cancelKey] = controller;\n config.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete config.params?.$autoCancel;\n delete config.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof config.params !== 'undefined') {\n const query = this.serializeQueryParams(config.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete config.params;\n }\n\n if (this.beforeSend) {\n config = Object.assign({}, this.beforeSend(url, config));\n }\n\n // send the request\n return fetch(url, config)\n .then(async (response) => {\n let data : any = {};\n\n try {\n data = await response.json();\n } catch (_) {\n // all api responses are expected to return json\n // with the exception of the realtime event and 204\n }\n\n if (this.afterSend) {\n data = this.afterSend(response, data);\n }\n\n if (response.status >= 400) {\n throw new ClientResponseError({\n url: response.url,\n status: response.status,\n data: data,\n });\n }\n\n return data;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl + (this.baseUrl.endsWith('/') ? '' : '/');\n if (path) {\n url += (path.startsWith('/') ? path.substring(1) : path);\n }\n return url;\n }\n\n /**\n * Serializes the provided query parameters into a query string.\n */\n private serializeQueryParams(params: {[key: string]: any}): string {\n const result: Array = [];\n for (const key in params) {\n if (params[key] === null) {\n // skip null query params\n continue;\n }\n\n const value = params[key];\n const encodedKey = encodeURIComponent(key);\n\n if (Array.isArray(value)) {\n // \"repeat\" array params\n for (const v of value) {\n result.push(encodedKey + \"=\" + encodeURIComponent(v));\n }\n } else if (value instanceof Date) {\n result.push(encodedKey + \"=\" + encodeURIComponent(value.toISOString()));\n } else if (typeof value !== null && typeof value === 'object') {\n result.push(encodedKey + \"=\" + encodeURIComponent(JSON.stringify(value)));\n } else {\n result.push(encodedKey + \"=\" + encodeURIComponent(value));\n }\n }\n\n return result.join('&');\n }\n}\n"],"names":["atobPolyfill","ClientResponseError","_super","errData","_this","this","call","url","status","data","isAbort","originalError","Object","setPrototypeOf","prototype","DOMException","name","message","_a","__extends","toJSON","__assign","Error","atob","a","Buffer","from","toString","JWT","getPayload","token","base64","decodeURIComponent","split","map","c","charCodeAt","slice","join","JSON","parse","e","isExpired","expirationThreshold","payload","keys","length","exp","Date","now","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","defineProperty","get","save","model","triggerChange","clear","onChange","callback","push","i","splice","_i","BaseModel","load","id","created","updated","clone","constructor","stringify","export","assign","Record","entries","_b","key","value","User","email","verified","lastResetSentAt","lastVerificationSentAt","profile","Admin","avatar","LocalAuthStore","storageKey","fallback","_storageGet","_storageSet","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseService","client","Settings","getAll","queryParams","send","method","params","then","responseData","update","bodyParams","body","ListResult","page","perPage","totalItems","totalPages","items","BaseCrudService","_getFullList","basePath","batchSize","result","request","__awaiter","_getList","list","castedList","concat","item","decode","_getOne","encodeURIComponent","_create","_update","_delete","CrudService","getFullList","baseCrudPath","getList","getOne","create","delete","Admins","authResponse","admin","authStore","authViaEmail","password","headers","Authorization","bind","refresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","Users","user","listAuthMethods","emailPassword","authProviders","Array","isArray","authViaOAuth2","provider","code","codeVerifier","redirectUrl","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","SchemaField","type","system","required","unique","options","Collection","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","Collections","import","collections","deleteMissing","Records","collectionIdOrName","getFileUrl","record","filename","parts","baseUrl","replace","URLSearchParams","includes","SubCrudService","sub","LogRequest","auth","ip","referer","userAgent","meta","Logs","getRequestsList","getRequest","getRequestsStats","Realtime","apply","arguments","clientId","eventSource","subscriptions","subscribe","subscription","removeEventListener","msgEvent","connect","submitSubscriptions","sent","unsubscribe","removeSubscriptionListeners","disconnect","addSubscriptionListeners","addEventListener","connectHandler","lastEventId","EventSource","buildUrl","close","Client","lang","cancelControllers","admins","users","records","logs","settings","realtime","cancelRequest","cancelKey","abort","cancelAllRequests","k","path","reqConfig","config","_c","_d","authType","_e","_f","$autoCancel","_g","$cancelKey","controller","AbortController","signal","_h","_j","query","serializeQueryParams","beforeSend","fetch","response","json","afterSend","catch","err","endsWith","startsWith","substring","encodedKey","value_1","v","toISOString"],"mappings":"m+DAIA,ICJIA,EDIJC,EAAA,SAAAC,GAOI,SAAAD,EAAYE,GAAZ,MAuBCC,EAAAC,YAtBGD,EAAAF,EAAAI,KAAAD,KAAM,wBAAsBA,MAP7BE,IAA0B,GAC7BH,EAAMI,OAAuB,EAC7BJ,EAAIK,KAAyB,GAC7BL,EAAOM,SAAsB,EAC7BN,EAAaO,cAAgB,KAOzBC,OAAOC,eAAeT,EAAMH,EAAoBa,WAE1CX,aAAmBF,IACrBG,EAAKO,cAAgBR,GAGT,OAAZA,GAAuC,iBAAZA,IAC3BC,EAAKG,IAAgC,iBAAhBJ,EAAQI,IAAmBJ,EAAQI,IAAM,GAC9DH,EAAKI,OAAmC,iBAAnBL,EAAQK,OAAsBL,EAAQK,OAAS,EACpEJ,EAAKK,KAA0B,OAAjBN,EAAQM,MAAyC,iBAAjBN,EAAQM,KAAoBN,EAAQM,KAAO,CAAA,GAGjE,oBAAjBM,cAAgCZ,aAAmBY,eAC1DX,EAAKM,SAAU,GAGnBN,EAAKY,KAAO,uBAAyBZ,EAAKI,OAC1CJ,EAAKa,SAAqB,QAAXC,EAAAd,EAAKK,YAAM,IAAAS,OAAA,EAAAA,EAAAD,UAAW,uDACxC,CAOL,OArCiDE,EAAKlB,EAAAC,GAkClDD,EAAAa,UAAAM,OAAA,WACI,OAAAC,EAAA,GAAYhB,OAEnBJ,CAAD,CArCA,CAAiDqB,OCF7CtB,EADgB,mBAATuB,KACQA,KAEA,SAACC,GAAW,OAAAC,OAAOC,KAAKF,EAAG,UAAUG,SAAS,SAAS,EAG1E,IAAAC,EAAA,WAAA,SAAAA,IAwCC,CAAD,OAp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M,gBAChC,cAAV/M,GAAmC,iBAAVA,EACvC6C,EAAO/D,KAAK8N,EAAa,IAAMrJ,mBAAmBhG,KAAKkC,UAAUO,KAEjE6C,EAAO/D,KAAK8N,EAAa,IAAMrJ,mBAAmBvD,GAfrD,CAmBL,OAAO6C,EAAOvF,KAAK,MAE1B4M,CAAD"} \ No newline at end of file +{"version":3,"file":"pocketbase.es.mjs","sources":["../src/ClientResponseError.ts","../src/stores/utils/JWT.ts","../src/stores/BaseAuthStore.ts","../src/models/utils/BaseModel.ts","../src/models/Record.ts","../src/models/User.ts","../src/models/Admin.ts","../src/stores/LocalAuthStore.ts","../src/services/utils/BaseService.ts","../src/services/Settings.ts","../src/models/utils/ListResult.ts","../src/services/utils/BaseCrudService.ts","../src/services/utils/CrudService.ts","../src/services/Admins.ts","../src/services/Users.ts","../src/models/utils/SchemaField.ts","../src/models/Collection.ts","../src/services/Collections.ts","../src/services/Records.ts","../src/services/utils/SubCrudService.ts","../src/models/LogRequest.ts","../src/services/Logs.ts","../src/services/Realtime.ts","../src/Client.ts"],"sourcesContent":["/**\n * ClientResponseError is a custom Error class that is intended to wrap\n * and normalize any error thrown by `Client.send()`.\n */\nexport default class ClientResponseError extends Error {\n url: string = '';\n status: number = 0;\n data: {[key: string]: any} = {};\n isAbort: boolean = false;\n originalError: any = null;\n\n constructor(errData?: any) {\n super(\"ClientResponseError\");\n\n // Set the prototype explicitly.\n // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, ClientResponseError.prototype);\n\n if (!(errData instanceof ClientResponseError)) {\n this.originalError = errData;\n }\n\n if (errData !== null && typeof errData === 'object') {\n this.url = typeof errData.url === 'string' ? errData.url : '';\n this.status = typeof errData.status === 'number' ? errData.status : 0;\n this.data = errData.data !== null && typeof errData.data === 'object' ? errData.data : {};\n }\n\n if (typeof DOMException !== 'undefined' && errData instanceof DOMException) {\n this.isAbort = true;\n }\n\n this.name = \"ClientResponseError \" + this.status;\n this.message = this.data?.message || 'Something went wrong while processing your request.'\n }\n\n // Make a POJO's copy of the current error class instance.\n // @see https://github.com/vuex-orm/vuex-orm/issues/255\n toJSON () {\n return { ...this };\n }\n}\n","let atobPolyfill: Function;\nif (typeof atob === 'function') {\n atobPolyfill = atob\n} else {\n atobPolyfill = (a: any) => Buffer.from(a, 'base64').toString('binary');\n}\n\nexport default class JWT {\n /**\n * Returns JWT token's payload data.\n */\n static getPayload(token: string): { [key: string]: any } {\n if (token) {\n try {\n\n let base64 = decodeURIComponent(atobPolyfill(token.split('.')[1]).split('').map(function (c: string) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n\n return JSON.parse(base64) || {};\n } catch (e) {\n }\n }\n\n return {};\n }\n\n /**\n * Checks whether a JWT token is expired or not.\n * Tokens without `exp` payload key are considered valid.\n * Tokens with empty payload (eg. invalid token strings) are considered expired.\n *\n * @param token The token to check.\n * @param [expirationThreshold] Time in seconds that will be substracted from the token `exp` property.\n */\n static isExpired(token: string, expirationThreshold = 0): boolean {\n let payload = JWT.getPayload(token);\n\n if (\n Object.keys(payload).length > 0 &&\n (!payload.exp || (payload.exp - expirationThreshold) > (Date.now() / 1000))\n ) {\n return false;\n }\n\n return true;\n }\n}\n","import { AuthStore } from '@/stores/utils/AuthStore';\nimport JWT from '@/stores/utils/JWT';\nimport User from '@/models/User';\nimport Admin from '@/models/Admin';\n\ntype onChangeFunc = (token: string, model: User | Admin | {}) => void;\n\n/**\n * Base AuthStore class that is intented to be extended by all other\n * PocketBase AuthStore implementations.\n */\nexport default abstract class BaseAuthStore implements AuthStore {\n protected baseToken: string = '';\n protected baseModel: User | Admin | {} = {};\n\n private _onChangeCallbacks: Array = [];\n\n /**\n * Retrieves the stored token (if any).\n */\n get token(): string {\n return this.baseToken;\n }\n\n /**\n * Retrieves the stored model data (if any).\n */\n get model(): User | Admin | {} {\n return this.baseModel;\n }\n\n /**\n * Checks if the store has valid (aka. existing and unexpired) token.\n */\n get isValid(): boolean {\n return !JWT.isExpired(this.token);\n }\n\n /**\n * Saves the provided new token and model data in the auth store.\n */\n save(token: string, model: User | Admin | {}): void {\n this.baseToken = token;\n this.baseModel = model;\n this.triggerChange();\n }\n\n /**\n * Removes the stored token and model data form the auth store.\n */\n clear(): void {\n this.baseToken = '';\n this.baseModel = {};\n this.triggerChange();\n }\n\n /**\n * Register a callback function that will be called on store change.\n *\n * Returns a removal function that you could call to \"unsubscibe\" from the changes.\n */\n onChange(callback: () => void): () => void {\n this._onChangeCallbacks.push(callback);\n\n return () => {\n for (let i = this._onChangeCallbacks.length - 1; i >= 0; i--) {\n if (this._onChangeCallbacks[i] == callback) {\n delete this._onChangeCallbacks[i]; // removes the function reference\n this._onChangeCallbacks.splice(i, 1); // reindex the array\n return;\n }\n }\n }\n }\n\n protected triggerChange(): void {\n for (const callback of this._onChangeCallbacks) {\n callback && callback(this.token, this.model);\n }\n }\n}\n","export default abstract class BaseModel {\n id!: string;\n created!: string;\n updated!: string;\n\n constructor(data: { [key: string]: any } = {}) {\n this.load(data || {});\n }\n\n /**\n * Loads `data` into the current model.\n */\n load(data: { [key: string]: any }) {\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.created = typeof data.created !== 'undefined' ? data.created : '';\n this.updated = typeof data.updated !== 'undefined' ? data.updated : '';\n }\n\n /**\n * Returns whether the current loaded data represent a stored db record.\n */\n get isNew(): boolean {\n return (\n // id is not set\n !this.id ||\n // zero uuid value\n this.id === '00000000-0000-0000-0000-000000000000'\n );\n }\n\n /**\n * Robust deep clone of a model.\n */\n clone(): BaseModel {\n return new (this.constructor as any)(JSON.parse(JSON.stringify(this)));\n }\n\n /**\n * Exports all model properties as a new plain object.\n */\n export(): { [key: string]: any } {\n return Object.assign({}, this);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Record extends BaseModel {\n [key: string]: any,\n\n '@collectionId'!: string;\n '@collectionName'!: string;\n '@expand'!: {[key: string]: any};\n\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n for (const [key, value] of Object.entries(data)) {\n this[key] = value;\n }\n\n // normalize common fields\n this['@collectionId'] = typeof data['@collectionId'] !== 'undefined' ? data['@collectionId'] : '';\n this['@collectionName'] = typeof data['@collectionName'] !== 'undefined' ? data['@collectionName'] : '';\n this['@expand'] = typeof data['@expand'] !== 'undefined' ? data['@expand'] : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport Record from '@/models/Record';\n\nexport default class User extends BaseModel {\n email!: string;\n verified!: boolean;\n lastResetSentAt!: string;\n lastVerificationSentAt!: string;\n profile!: null|Record;\n\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n this.email = typeof data.email === 'string' ? data.email : '';\n this.verified = !!data.verified;\n this.lastResetSentAt = typeof data.lastResetSentAt === 'string' ? data.lastResetSentAt : '';\n this.lastVerificationSentAt = typeof data.lastVerificationSentAt === 'string' ? data.lastVerificationSentAt : '';\n this.profile = data.profile ? new Record(data.profile) : null;\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class Admin extends BaseModel {\n avatar!: number;\n email!: string;\n lastResetSentAt!: string;\n\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n this.avatar = typeof data.avatar === 'number' ? data.avatar : 0;\n this.email = typeof data.email === 'string' ? data.email : '';\n this.lastResetSentAt = typeof data.lastResetSentAt === 'string' ? data.lastResetSentAt : '';\n }\n}\n","import BaseAuthStore from '@/stores/BaseAuthStore';\nimport User from '@/models/User';\nimport Admin from '@/models/Admin';\n\n/**\n * The default token store for browsers with auto fallback\n * to runtime/memory if local storage is undefined (eg. in node env).\n */\nexport default class LocalAuthStore extends BaseAuthStore {\n private fallback: { [key: string]: any } = {};\n private storageKey: string\n\n constructor(storageKey = \"pocketbase_auth\") {\n super();\n\n this.storageKey = storageKey;\n }\n\n /**\n * @inheritdoc\n */\n get token(): string {\n const data = this._storageGet(this.storageKey) || {};\n\n return data.token || '';\n }\n\n /**\n * @inheritdoc\n */\n get model(): User | Admin | {} {\n const data = this._storageGet(this.storageKey) || {};\n\n if (\n data === null ||\n typeof data !== 'object' ||\n data.model === null ||\n typeof data.model !== 'object'\n ) {\n return {};\n }\n\n // admins don't have `verified` prop\n if (typeof data.model?.verified !== 'undefined') {\n return new User(data.model);\n }\n\n return new Admin(data.model);\n }\n\n /**\n * @inheritdoc\n */\n save(token: string, model: User | Admin | {}) {\n this._storageSet(this.storageKey, {\n 'token': token,\n 'model': model,\n });\n\n super.save(token, model);\n }\n\n /**\n * @inheritdoc\n */\n clear() {\n this._storageRemove(this.storageKey);\n\n super.clear();\n }\n\n // ---------------------------------------------------------------\n // Internal helpers:\n // ---------------------------------------------------------------\n\n /**\n * Retrieves `key` from the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageGet(key: string): any {\n if (typeof window !== 'undefined' && window?.localStorage) {\n const rawValue = window?.localStorage?.getItem(key) || '';\n try {\n return JSON.parse(rawValue);\n } catch (e) { // not a json\n return rawValue;\n }\n }\n\n // fallback to runtime/memory\n return this.fallback[key];\n }\n\n /**\n * Stores a new data in the browser's local storage\n * (or runtime/memory if local storage is undefined).\n */\n private _storageSet(key: string, value: any) {\n if (typeof window !== 'undefined' && window?.localStorage) {\n // store in local storage\n let normalizedVal = value;\n if (typeof value !== 'string') {\n normalizedVal = JSON.stringify(value);\n }\n window?.localStorage?.setItem(key, normalizedVal);\n } else {\n // store in runtime/memory\n this.fallback[key] = value;\n }\n }\n\n /**\n * Removes `key` from the browser's local storage and the runtime/memory.\n */\n private _storageRemove(key: string) {\n // delete from local storage\n if (typeof window !== 'undefined') {\n window?.localStorage?.removeItem(key);\n }\n\n // delete from runtime/memory\n delete this.fallback[key];\n }\n}\n","import Client from '@/Client';\n\n/**\n * BaseService class that should be inherited from all API services.\n */\nexport default abstract class BaseService {\n readonly client: Client\n\n constructor(client: Client) {\n this.client = client;\n }\n}\n","import BaseService from '@/services/utils/BaseService';\n\nexport default class Settings extends BaseService {\n /**\n * Fetch all available app settings.\n */\n getAll(queryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData) => responseData || {});\n }\n\n /**\n * Bulk updates app settings.\n */\n update(bodyParams = {}, queryParams = {}): Promise<{ [key: string]: any }> {\n return this.client.send('/api/settings', {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData) => responseData || {});\n }\n}\n","import BaseModel from './BaseModel';\n\nexport default class ListResult {\n page!: number;\n perPage!: number;\n totalItems!: number;\n totalPages!: number;\n items!: Array;\n\n constructor(\n page: number,\n perPage: number,\n totalItems: number,\n totalPages: number,\n items: Array,\n ) {\n this.page = page > 0 ? page : 1;\n this.perPage = perPage >= 0 ? perPage : 0;\n this.totalItems = totalItems >= 0 ? totalItems : 0;\n this.totalPages = totalPages >= 0 ? totalPages : 0;\n this.items = items || [];\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\n\nexport default abstract class BaseCrudService extends BaseService {\n /**\n * Response data decoder.\n */\n abstract decode(data: { [key: string]: any }): M\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n protected _getFullList(basePath: string, batchSize = 100, queryParams = {}): Promise> {\n var result: Array = [];\n\n let request = async (page: number): Promise> => {\n return this._getList(basePath, page, batchSize, queryParams).then((list) => {\n const castedList = (list as ListResult);\n const items = castedList.items;\n const totalItems = castedList.totalItems;\n\n result = result.concat(items);\n\n if (items.length && totalItems > result.length) {\n return request(page + 1);\n }\n\n return result;\n });\n }\n\n return request(1);\n }\n\n /**\n * Returns paginated items list.\n */\n protected _getList(basePath: string, page = 1, perPage = 30, queryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send(basePath, {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData.items || [];\n for (const item of responseData.items) {\n items.push(this.decode(item));\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns single item by its id.\n */\n protected _getOne(basePath: string, id: string, queryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => this.decode(responseData));\n }\n\n /**\n * Creates a new item.\n */\n protected _create(basePath: string, bodyParams = {}, queryParams = {}): Promise {\n return this.client.send(basePath, {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData));\n }\n\n /**\n * Updates an existing item by its id.\n */\n protected _update(basePath: string, id: string, bodyParams = {}, queryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'PATCH',\n 'params': queryParams,\n 'body': bodyParams,\n }).then((responseData: any) => this.decode(responseData));\n }\n\n /**\n * Deletes an existing item by its id.\n */\n protected _delete(basePath: string, id: string, queryParams = {}): Promise {\n return this.client.send(basePath + '/' + encodeURIComponent(id), {\n 'method': 'DELETE',\n 'params': queryParams,\n }).then(() => true);\n }\n}\n","import ListResult from '@/models/utils/ListResult';\nimport BaseModel from '@/models/utils/BaseModel';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\n\nexport default abstract class CrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/admins').\n */\n abstract baseCrudPath(): string\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n getFullList(batchSize = 100, queryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath(), batchSize, queryParams);\n }\n\n /**\n * Returns paginated items list.\n */\n getList(page = 1, perPage = 30, queryParams = {}): Promise> {\n return this._getList(this.baseCrudPath(), page, perPage, queryParams);\n }\n\n /**\n * Returns single item by its id.\n */\n getOne(id: string, queryParams = {}): Promise {\n return this._getOne(this.baseCrudPath(), id, queryParams);\n }\n\n /**\n * Creates a new item.\n */\n create(bodyParams = {}, queryParams = {}): Promise {\n return this._create(this.baseCrudPath(), bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n */\n update(id: string, bodyParams = {}, queryParams = {}): Promise {\n return this._update(this.baseCrudPath(), id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(id: string, queryParams = {}): Promise {\n return this._delete(this.baseCrudPath(), id, queryParams);\n }\n}\n","import CrudService from '@/services/utils/CrudService';\nimport Admin from '@/models/Admin';\n\nexport type AdminAuthResponse = {\n [key: string]: any,\n token: string,\n admin: Admin,\n}\n\nexport default class Admins extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Admin {\n return new Admin(data);\n }\n\n /**\n * @inheritdoc\n */\n baseCrudPath(): string {\n return '/api/admins';\n }\n\n /**\n * Prepare successful authorize response.\n */\n protected authResponse(responseData: any): AdminAuthResponse {\n const admin = this.decode(responseData?.admin || {});\n\n if (responseData?.token && responseData?.admin) {\n this.client.authStore.save(responseData.token, admin);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'admin': admin,\n });\n }\n\n /**\n * Authenticate an admin account by its email and password\n * and returns a new admin token and data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n authViaEmail(\n email: string,\n password: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/auth-via-email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n 'headers': {\n 'Authorization': '',\n },\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Refreshes the current admin authenticated instance and\n * returns a new token and admin data.\n *\n * On success this method automatically updates the client's AuthStore data.\n */\n refresh(bodyParams = {}, queryParams = {}): Promise {\n return this.client.send(this.baseCrudPath() + '/refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends admin password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms admin password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n}\n","import CrudService from '@/services/utils/CrudService';\nimport User from '@/models/User';\n\nexport type UserAuthResponse = {\n [key: string]: any,\n token: string,\n user: User,\n}\n\nexport type AuthProviderInfo = {\n name: string,\n state: string,\n codeVerifier: string,\n codeChallenge: string,\n codeChallengeMethod: string,\n authUrl: string,\n}\n\nexport type AuthMethodsList = {\n [key: string]: any,\n emailPassword: boolean,\n authProviders: Array,\n}\n\nexport default class Users extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): User {\n return new User(data);\n }\n\n /**\n * @inheritdoc\n */\n baseCrudPath(): string {\n return '/api/users';\n }\n\n /**\n * Prepare successful authorization response.\n */\n protected authResponse(responseData: any): UserAuthResponse {\n const user = this.decode(responseData?.user || {});\n\n if (responseData?.token && responseData?.user) {\n this.client.authStore.save(responseData.token, user);\n }\n\n return Object.assign({}, responseData, {\n // normalize common fields\n 'token': responseData?.token || '',\n 'user': user,\n });\n }\n\n /**\n * Returns all available application auth methods.\n */\n listAuthMethods(queryParams = {}): Promise {\n return this.client.send(this.baseCrudPath() + '/auth-methods', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n return Object.assign({}, responseData, {\n // normalize common fields\n 'emailPassword': !!responseData?.emailPassword,\n 'authProviders': Array.isArray(responseData?.authProviders) ? responseData?.authProviders : [],\n });\n });\n }\n\n /**\n * Authenticate a user via its email and password.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - new user authentication token\n * - the authenticated user model record\n */\n authViaEmail(\n email: string,\n password: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/auth-via-email', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n 'headers': {\n 'Authorization': '',\n },\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Authenticate a user via OAuth2 client provider.\n *\n * On success, this method also automatically updates\n * the client's AuthStore data and returns:\n * - new user authentication token\n * - the authenticated user model record\n * - the OAuth2 user profile data (eg. name, email, avatar, etc.)\n */\n authViaOAuth2(\n provider: string,\n code: string,\n codeVerifier: string,\n redirectUrl: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'provider': provider,\n 'code': code,\n 'codeVerifier': codeVerifier,\n 'redirectUrl': redirectUrl,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/auth-via-oauth2', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n 'headers': {\n 'Authorization': '',\n },\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Refreshes the current user authenticated instance and\n * returns a new token and user data.\n *\n * On success this method also automatically updates the client's AuthStore data.\n */\n refresh(bodyParams = {}, queryParams = {}): Promise {\n return this.client.send(this.baseCrudPath() + '/refresh', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends user password reset request.\n */\n requestPasswordReset(\n email: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/request-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms user password reset request.\n */\n confirmPasswordReset(\n passwordResetToken: string,\n password: string,\n passwordConfirm: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': passwordResetToken,\n 'password': password,\n 'passwordConfirm': passwordConfirm,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/confirm-password-reset', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends user verification email request.\n */\n requestVerification(\n email: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'email': email,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/request-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms user email verification request.\n */\n confirmVerification(\n verificationToken: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': verificationToken,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/confirm-verification', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n\n /**\n * Sends an email change request to the authenticated user.\n */\n requestEmailChange(\n newEmail: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'newEmail': newEmail,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/request-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(() => true);\n }\n\n /**\n * Confirms user new email address.\n */\n confirmEmailChange(\n emailChangeToken: string,\n password: string,\n bodyParams = {},\n queryParams = {},\n ): Promise {\n bodyParams = Object.assign({\n 'token': emailChangeToken,\n 'password': password,\n }, bodyParams);\n\n return this.client.send(this.baseCrudPath() + '/confirm-email-change', {\n 'method': 'POST',\n 'params': queryParams,\n 'body': bodyParams,\n }).then(this.authResponse.bind(this));\n }\n}\n","export default class SchemaField {\n id!: string;\n name!: string;\n type!: string;\n system!: boolean;\n required!: boolean;\n unique!: boolean;\n options!: { [key: string]: any };\n\n constructor(data: { [key: string]: any } = {}) {\n this.load(data || {});\n }\n\n /**\n * Loads `data` into the field.\n */\n load(data: { [key: string]: any }) {\n this.id = typeof data.id !== 'undefined' ? data.id : '';\n this.name = typeof data.name !== 'undefined' ? data.name : '';\n this.type = typeof data.type !== 'undefined' ? data.type : 'text';\n this.system = !!data.system;\n this.required = !!data.required;\n this.unique = !!data.unique;\n this.options = typeof data.options === 'object' && data.options !== null ? data.options : {};\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport SchemaField from '@/models/utils/SchemaField';\n\nexport default class Collection extends BaseModel {\n name!: string;\n schema!: Array;\n system!: boolean;\n listRule!: null|string;\n viewRule!: null|string;\n createRule!: null|string;\n updateRule!: null|string;\n deleteRule!: null|string;\n\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n this.name = typeof data.name === 'string' ? data.name : '';\n this.system = !!data.system;\n\n // rules\n this.listRule = typeof data.listRule === 'string' ? data.listRule : null;\n this.viewRule = typeof data.viewRule === 'string' ? data.viewRule : null;\n this.createRule = typeof data.createRule === 'string' ? data.createRule : null;\n this.updateRule = typeof data.updateRule === 'string' ? data.updateRule : null;\n this.deleteRule = typeof data.deleteRule === 'string' ? data.deleteRule : null;\n\n // schema\n data.schema = Array.isArray(data.schema) ? data.schema : [];\n this.schema = [];\n for (let field of data.schema) {\n this.schema.push(new SchemaField(field));\n }\n }\n}\n","import CrudService from '@/services/utils/CrudService';\nimport Collection from '@/models/Collection';\n\nexport default class Collections extends CrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Collection {\n return new Collection(data);\n }\n\n /**\n * @inheritdoc\n */\n baseCrudPath(): string {\n return '/api/collections';\n }\n\n /**\n * Imports the provided collections.\n *\n * If `deleteMissing` is `true`, all local collections and schema fields,\n * that are not present in the imported configuration, WILL BE DELETED\n * (including their related records data)!\n */\n async import(collections: Array, deleteMissing: boolean = false, queryParams = {}): Promise {\n return this.client.send(this.baseCrudPath() + '/import', {\n 'method': 'PUT',\n 'params': queryParams,\n 'body': {\n 'collections': collections,\n 'deleteMissing': deleteMissing,\n }\n }).then(() => true);\n }\n}\n","import SubCrudService from '@/services/utils/SubCrudService';\nimport Record from '@/models/Record';\n\nexport default class Records extends SubCrudService {\n /**\n * @inheritdoc\n */\n decode(data: { [key: string]: any }): Record {\n return new Record(data);\n }\n\n /**\n * @inheritdoc\n */\n baseCrudPath(collectionIdOrName: string): string {\n return '/api/collections/' + encodeURIComponent(collectionIdOrName) + '/records';\n }\n\n /**\n * Builds and returns an absolute record file url.\n */\n getFileUrl(record: Record, filename: string, queryParams = {}): string {\n const parts = [];\n parts.push(this.client.baseUrl.replace(/\\/+$/gm, \"\"))\n parts.push(\"api\")\n parts.push(\"files\")\n parts.push(record[\"@collectionId\"])\n parts.push(record.id)\n parts.push(filename)\n let result = parts.join('/');\n\n if (Object.keys(queryParams).length) {\n const params = new URLSearchParams(queryParams);\n result += (result.includes(\"?\") ? \"&\" : \"?\") + params;\n }\n\n return result\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseCrudService from '@/services/utils/BaseCrudService';\n\nexport default abstract class SubCrudService extends BaseCrudService {\n /**\n * Base path for the crud actions (without trailing slash, eg. '/collections/{:sub}/records').\n */\n abstract baseCrudPath(sub: string): string\n\n /**\n * Returns a promise with all list items batch fetched at once.\n */\n getFullList(sub: string, batchSize = 100, queryParams = {}): Promise> {\n return this._getFullList(this.baseCrudPath(sub), batchSize, queryParams);\n }\n\n /**\n * Returns paginated items list.\n */\n getList(sub: string, page = 1, perPage = 30, queryParams = {}): Promise> {\n return this._getList(this.baseCrudPath(sub), page, perPage, queryParams);\n }\n\n /**\n * Returns single item by its id.\n */\n getOne(sub: string, id: string, queryParams = {}): Promise {\n return this._getOne(this.baseCrudPath(sub), id, queryParams);\n }\n\n /**\n * Creates a new item.\n */\n create(sub: string, bodyParams = {}, queryParams = {}): Promise {\n return this._create(this.baseCrudPath(sub), bodyParams, queryParams);\n }\n\n /**\n * Updates an existing item by its id.\n */\n update(sub: string, id: string, bodyParams = {}, queryParams = {}): Promise {\n return this._update(this.baseCrudPath(sub), id, bodyParams, queryParams);\n }\n\n /**\n * Deletes an existing item by its id.\n */\n delete(sub: string, id: string, queryParams = {}): Promise {\n return this._delete(this.baseCrudPath(sub), id, queryParams);\n }\n}\n","import BaseModel from '@/models/utils/BaseModel';\n\nexport default class LogRequest extends BaseModel {\n url!: string;\n method!: string;\n status!: number;\n auth!: string;\n ip!: string;\n referer!: string;\n userAgent!: string;\n meta!: null|{ [key: string]: any };\n\n /**\n * @inheritdoc\n */\n load(data: { [key: string]: any }) {\n super.load(data);\n\n this.url = typeof data.url === 'string' ? data.url : '';\n this.method = typeof data.method === 'string' ? data.method : 'GET';\n this.status = typeof data.status === 'number' ? data.status : 200;\n this.auth = typeof data.auth === 'string' ? data.auth : 'guest';\n this.ip = typeof data.ip === 'string' ? data.ip : '';\n this.referer = typeof data.referer === 'string' ? data.referer : '';\n this.userAgent = typeof data.userAgent === 'string' ? data.userAgent : '';\n this.meta = typeof data.meta === 'object' && data.meta !== null ? data.meta : {};\n }\n}\n","import LogRequest from '@/models/LogRequest';\nimport ListResult from '@/models/utils/ListResult';\nimport BaseService from '@/services/utils/BaseService';\n\nexport type HourlyStats = {\n total: number,\n date: string,\n}\n\nexport default class Logs extends BaseService {\n /**\n * Returns paginated logged requests list.\n */\n getRequestsList(page = 1, perPage = 30, queryParams = {}): Promise> {\n queryParams = Object.assign({\n 'page': page,\n 'perPage': perPage,\n }, queryParams);\n\n return this.client.send('/api/logs/requests', {\n 'method': 'GET',\n 'params': queryParams,\n }).then((responseData: any) => {\n const items: Array = [];\n if (responseData?.items) {\n responseData.items = responseData?.items || [];\n for (const item of responseData.items) {\n items.push(new LogRequest(item));\n }\n }\n\n return new ListResult(\n responseData?.page || 1,\n responseData?.perPage || 0,\n responseData?.totalItems || 0,\n responseData?.totalPages || 0,\n items,\n );\n });\n }\n\n /**\n * Returns a single logged request by its id.\n */\n getRequest(id: string, queryParams = {}): Promise {\n return this.client.send('/api/logs/requests/' + encodeURIComponent(id), {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => new LogRequest(responseData));\n }\n\n /**\n * Returns request logs statistics.\n */\n getRequestsStats(queryParams = {}): Promise> {\n return this.client.send('/api/logs/requests/stats', {\n 'method': 'GET',\n 'params': queryParams\n }).then((responseData: any) => responseData);\n }\n}\n","import BaseService from '@/services/utils/BaseService';\nimport Record from '@/models/Record';\n\nexport interface MessageData {\n [key: string]: any;\n action: string;\n record: Record;\n}\n\nexport interface SubscriptionFunc{\n (data: MessageData):void;\n}\n\nexport default class Realtime extends BaseService {\n private clientId: string = \"\";\n private eventSource: EventSource | null = null;\n private subscriptions: { [key: string]: EventListener } = {};\n\n /**\n * Inits the sse connection (if not already) and register the subscription.\n */\n async subscribe(subscription: string, callback: SubscriptionFunc): Promise {\n if (!subscription) {\n throw new Error('subscription must be set.')\n }\n\n // unsubscribe existing\n if (this.subscriptions[subscription]) {\n this.eventSource?.removeEventListener(subscription, this.subscriptions[subscription]);\n }\n\n // register subscription\n this.subscriptions[subscription] = function (e: Event) {\n const msgEvent = (e as MessageEvent);\n\n let data;\n try {\n data = JSON.parse(msgEvent?.data);\n } catch {}\n\n callback(data || {});\n }\n\n if (!this.eventSource) {\n // start a new sse connection\n this.connect();\n } else if (this.clientId) {\n // otherwise - just persist the updated subscriptions\n await this.submitSubscriptions();\n }\n }\n\n /**\n * Unsubscribe from a subscription.\n *\n * If the `subscription` argument is not set,\n * then the client will unsubscibe from all registered subscriptions.\n *\n * The related sse connection will be autoclosed if after the\n * unsubscribe operations there are no active subscriptions left.\n */\n async unsubscribe(subscription?: string): Promise {\n if (!subscription) {\n // remove all subscriptions\n this.removeSubscriptionListeners();\n this.subscriptions = {};\n } else if (this.subscriptions[subscription]) {\n // remove a single subscription\n this.eventSource?.removeEventListener(subscription, this.subscriptions[subscription]);\n delete this.subscriptions[subscription];\n } else {\n // not subscribed to the specified subscription\n return\n }\n\n if (this.clientId) {\n await this.submitSubscriptions();\n }\n\n // no more subscriptions -> close the sse connection\n if (!Object.keys(this.subscriptions).length) {\n this.disconnect();\n }\n }\n\n private async submitSubscriptions(): Promise {\n // optimistic update\n this.addSubscriptionListeners();\n\n return this.client.send('/api/realtime', {\n 'method': 'POST',\n 'body': {\n 'clientId': this.clientId,\n 'subscriptions': Object.keys(this.subscriptions),\n },\n }).then(() => true);\n }\n\n private addSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n this.removeSubscriptionListeners();\n\n for (let sub in this.subscriptions) {\n this.eventSource.addEventListener(sub, this.subscriptions[sub]);\n }\n }\n\n private removeSubscriptionListeners(): void {\n if (!this.eventSource) {\n return;\n }\n\n for (let sub in this.subscriptions) {\n this.eventSource.removeEventListener(sub, this.subscriptions[sub]);\n }\n }\n\n private connectHandler(e: Event): void {\n const msgEvent = (e as MessageEvent);\n this.clientId = msgEvent?.lastEventId;\n this.submitSubscriptions();\n }\n\n private connect(): void {\n this.disconnect();\n this.eventSource = new EventSource(this.client.buildUrl('/api/realtime'))\n this.eventSource.addEventListener('PB_CONNECT', (e) => this.connectHandler(e));\n }\n\n private disconnect(): void {\n this.removeSubscriptionListeners();\n this.eventSource?.removeEventListener('PB_CONNECT', (e) => this.connectHandler(e));\n this.eventSource?.close();\n this.eventSource = null;\n this.clientId = \"\";\n }\n}\n","import ClientResponseError from '@/ClientResponseError';\nimport { AuthStore } from '@/stores/utils/AuthStore';\nimport LocalAuthStore from '@/stores/LocalAuthStore';\nimport Settings from '@/services/Settings';\nimport Admins from '@/services/Admins';\nimport Users from '@/services/Users';\nimport Collections from '@/services/Collections';\nimport Records from '@/services/Records';\nimport Logs from '@/services/Logs';\nimport Realtime from '@/services/Realtime';\n\n/**\n * PocketBase JS Client.\n */\nexport default class Client {\n /**\n * The base PocketBase backend url address (eg. 'http://127.0.0.1.8090').\n */\n baseUrl: string;\n\n /**\n * Hook that get triggered right before sending the fetch request,\n * allowing you to inspect/modify the request config.\n *\n * Returns the new modified config that will be used to send the request.\n *\n * For list of the possible options check https://developer.mozilla.org/en-US/docs/Web/API/fetch#options\n *\n * Example:\n * ```js\n * client.beforeSend = function (url, reqConfig) {\n * reqConfig.headers = Object.assign(reqConfig.headers, {\n * 'X-Custom-Header': 'example',\n * });\n *\n * return reqConfig;\n * };\n * ```\n */\n beforeSend?: (url: string, reqConfig: { [key: string]: any }) => { [key: string]: any };\n\n /**\n * Hook that get triggered after successfully sending the fetch request,\n * allowing you to inspect/modify the response object and its parsed data.\n *\n * Returns the new Promise resolved `data` that will be returned to the client.\n *\n * Example:\n * ```js\n * client.afterSend = function (response, data) {\n * if (response.status != 200) {\n * throw new ClientResponseError({\n * url: response.url,\n * status: response.status,\n * data: data,\n * });\n * }\n *\n * return data;\n * };\n * ```\n */\n afterSend?: (response: Response, data: any) => any;\n\n /**\n * Optional language code (default to `en-US`) that will be sent\n * with the requests to the server as `Accept-Language` header.\n */\n lang: string;\n\n /**\n * A replacable instance of the local `AuthStore` service.\n */\n authStore: AuthStore;\n\n /**\n * An instance of the service that handles the **Settings APIs**.\n */\n readonly settings: Settings;\n\n /**\n * An instance of the service that handles the **Admin APIs**.\n */\n readonly admins: Admins;\n\n /**\n * An instance of the service that handles the **User APIs**.\n */\n readonly users: Users;\n\n /**\n * An instance of the service that handles the **Collection APIs**.\n */\n readonly collections: Collections;\n\n /**\n * An instance of the service that handles the **Record APIs**.\n */\n readonly records: Records;\n\n /**\n * An instance of the service that handles the **Log APIs**.\n */\n readonly logs: Logs;\n\n /**\n * An instance of the service that handles the **Realtime APIs**.\n */\n readonly realtime: Realtime;\n\n private cancelControllers: { [key: string]: AbortController } = {}\n\n constructor(\n baseUrl = '/',\n lang = 'en-US',\n authStore?: AuthStore | null,\n ) {\n this.baseUrl = baseUrl;\n this.lang = lang;\n this.authStore = authStore || new LocalAuthStore();\n\n // services\n this.admins = new Admins(this);\n this.users = new Users(this);\n this.records = new Records(this);\n this.collections = new Collections(this);\n this.logs = new Logs(this);\n this.settings = new Settings(this);\n this.realtime = new Realtime(this);\n }\n\n /**\n * @deprecated Legacy alias for `this.authStore`.\n */\n get AuthStore(): AuthStore {\n return this.authStore;\n };\n\n /**\n * @deprecated Legacy alias for `this.settings`.\n */\n get Settings(): Settings {\n return this.settings;\n };\n\n /**\n * @deprecated Legacy alias for `this.admins`.\n */\n get Admins(): Admins {\n return this.admins;\n };\n\n /**\n * @deprecated Legacy alias for `this.users`.\n */\n get Users(): Users {\n return this.users;\n };\n\n /**\n * @deprecated Legacy alias for `this.collections`.\n */\n get Collections(): Collections {\n return this.collections;\n };\n\n /**\n * @deprecated Legacy alias for `this.records`.\n */\n get Records(): Records {\n return this.records;\n };\n\n /**\n * @deprecated Legacy alias for `this.logs`.\n */\n get Logs(): Logs {\n return this.logs;\n };\n\n /**\n * @deprecated Legacy alias for `this.realtime`.\n */\n get Realtime(): Realtime {\n return this.realtime;\n };\n\n /**\n * Cancels single request by its cancellation key.\n */\n cancelRequest(cancelKey: string): Client {\n if (this.cancelControllers[cancelKey]) {\n this.cancelControllers[cancelKey].abort();\n delete this.cancelControllers[cancelKey];\n }\n\n return this;\n }\n\n /**\n * Cancels all pending requests.\n */\n cancelAllRequests(): Client {\n for (let k in this.cancelControllers) {\n this.cancelControllers[k].abort();\n }\n\n this.cancelControllers = {};\n\n return this;\n }\n\n /**\n * Sends an api http request.\n */\n async send(path: string, reqConfig: { [key: string]: any }): Promise {\n let config = Object.assign({ method: 'GET' } as { [key: string]: any }, reqConfig);\n\n // serialize the body if needed and set the correct content type\n // note1: for FormData body the Content-Type header should be skipped\n // note2: we are checking the constructor name because FormData is not available natively in node\n if (config.body && config.body.constructor.name !== 'FormData') {\n if (typeof config.body !== 'string') {\n config.body = JSON.stringify(config.body);\n }\n\n // add the json header (if not already)\n if (typeof config?.headers?.['Content-Type'] === 'undefined') {\n config.headers = Object.assign({}, config.headers, {\n 'Content-Type': 'application/json',\n });\n }\n }\n\n // add Accept-Language header (if not already)\n if (typeof config?.headers?.['Accept-Language'] === 'undefined') {\n config.headers = Object.assign({}, config.headers, {\n 'Accept-Language': this.lang,\n });\n }\n\n // check if Authorization header can be added\n if (\n // has stored token\n this.authStore?.token &&\n // auth header is not explicitly set\n (typeof config?.headers?.Authorization === 'undefined')\n ) {\n let authType = 'Admin';\n if (typeof (this.authStore.model as any)?.verified !== 'undefined') {\n authType = 'User'; // admins don't have verified\n }\n\n config.headers = Object.assign({}, config.headers, {\n 'Authorization': (authType + ' ' + this.authStore.token),\n });\n }\n\n // handle auto cancelation for duplicated pending request\n if (config.params?.$autoCancel !== false) {\n const cancelKey = config.params?.$cancelKey || ((config.method || 'GET') + path);\n\n // cancel previous pending requests\n this.cancelRequest(cancelKey);\n\n const controller = new AbortController();\n this.cancelControllers[cancelKey] = controller;\n config.signal = controller.signal;\n }\n // remove the special cancellation params from the other valid query params\n delete config.params?.$autoCancel;\n delete config.params?.$cancelKey;\n\n // build url + path\n let url = this.buildUrl(path);\n\n // serialize the query parameters\n if (typeof config.params !== 'undefined') {\n const query = this.serializeQueryParams(config.params)\n if (query) {\n url += (url.includes('?') ? '&' : '?') + query;\n }\n delete config.params;\n }\n\n if (this.beforeSend) {\n config = Object.assign({}, this.beforeSend(url, config));\n }\n\n // send the request\n return fetch(url, config)\n .then(async (response) => {\n let data : any = {};\n\n try {\n data = await response.json();\n } catch (_) {\n // all api responses are expected to return json\n // with the exception of the realtime event and 204\n }\n\n if (this.afterSend) {\n data = this.afterSend(response, data);\n }\n\n if (response.status >= 400) {\n throw new ClientResponseError({\n url: response.url,\n status: response.status,\n data: data,\n });\n }\n\n return data;\n }).catch((err) => {\n // wrap to normalize all errors\n throw new ClientResponseError(err);\n });\n }\n\n /**\n * Builds a full client url by safely concatenating the provided path.\n */\n buildUrl(path: string): string {\n let url = this.baseUrl + (this.baseUrl.endsWith('/') ? '' : '/');\n if (path) {\n url += (path.startsWith('/') ? path.substring(1) : path);\n }\n return url;\n }\n\n /**\n * Serializes the provided query parameters into a query string.\n */\n private serializeQueryParams(params: {[key: string]: any}): string {\n const result: Array = [];\n for (const key in params) {\n if (params[key] === null) {\n // skip null query params\n continue;\n }\n\n const value = params[key];\n const encodedKey = encodeURIComponent(key);\n\n if (Array.isArray(value)) {\n // \"repeat\" array params\n for (const v of value) {\n result.push(encodedKey + \"=\" + encodeURIComponent(v));\n }\n } else if (value instanceof Date) {\n result.push(encodedKey + \"=\" + encodeURIComponent(value.toISOString()));\n } else if (typeof value !== null && typeof value === 'object') {\n result.push(encodedKey + \"=\" + encodeURIComponent(JSON.stringify(value)));\n } else {\n result.push(encodedKey + \"=\" + encodeURIComponent(value));\n }\n }\n\n return result.join('&');\n }\n}\n"],"names":["atobPolyfill","ClientResponseError","_super","errData","_this","this","call","url","status","data","isAbort","originalError","Object","setPrototypeOf","prototype","DOMException","name","message","_a","__extends","toJSON","__assign","Error","atob","a","Buffer","from","toString","JWT","getPayload","token","base64","decodeURIComponent","split","map","c","charCodeAt","slice","join","JSON","parse","e","isExpired","expirationThreshold","payload","keys","length","exp","Date","now","BaseAuthStore","baseToken","baseModel","_onChangeCallbacks","defineProperty","get","save","model","triggerChange","clear","onChange","callback","push","i","splice","_i","BaseModel","load","id","created","updated","clone","constructor","stringify","export","assign","Record","entries","_b","key","value","User","email","verified","lastResetSentAt","lastVerificationSentAt","profile","Admin","avatar","LocalAuthStore","storageKey","fallback","_storageGet","_storageSet","_storageRemove","window","localStorage","rawValue","getItem","normalizedVal","setItem","removeItem","BaseService","client","Settings","getAll","queryParams","send","method","params","then","responseData","update","bodyParams","body","ListResult","page","perPage","totalItems","totalPages","items","BaseCrudService","_getFullList","basePath","batchSize","result","request","__awaiter","_getList","list","castedList","concat","item","decode","_getOne","encodeURIComponent","_create","_update","_delete","CrudService","getFullList","baseCrudPath","getList","getOne","create","delete","Admins","authResponse","admin","authStore","authViaEmail","password","headers","Authorization","bind","refresh","requestPasswordReset","confirmPasswordReset","passwordResetToken","passwordConfirm","Users","user","listAuthMethods","emailPassword","authProviders","Array","isArray","authViaOAuth2","provider","code","codeVerifier","redirectUrl","requestVerification","confirmVerification","verificationToken","requestEmailChange","newEmail","confirmEmailChange","emailChangeToken","SchemaField","type","system","required","unique","options","Collection","listRule","viewRule","createRule","updateRule","deleteRule","schema","field","Collections","import","collections","deleteMissing","Records","collectionIdOrName","getFileUrl","record","filename","parts","baseUrl","replace","URLSearchParams","includes","SubCrudService","sub","LogRequest","auth","ip","referer","userAgent","meta","Logs","getRequestsList","getRequest","getRequestsStats","Realtime","apply","arguments","clientId","eventSource","subscriptions","subscribe","subscription","removeEventListener","msgEvent","connect","submitSubscriptions","sent","unsubscribe","removeSubscriptionListeners","disconnect","addSubscriptionListeners","addEventListener","connectHandler","lastEventId","EventSource","buildUrl","close","Client","lang","cancelControllers","admins","users","records","logs","settings","realtime","cancelRequest","cancelKey","abort","cancelAllRequests","k","path","reqConfig","config","_c","_d","authType","_e","_f","$autoCancel","_g","$cancelKey","controller","AbortController","signal","_h","_j","query","serializeQueryParams","beforeSend","fetch","response","json","afterSend","catch","err","endsWith","startsWith","substring","encodedKey","value_1","v","toISOString"],"mappings":"m+DAIA,ICJIA,EDIJC,EAAA,SAAAC,GAOI,SAAAD,EAAYE,GAAZ,MAuBCC,EAAAC,YAtBGD,EAAAF,EAAAI,KAAAD,KAAM,wBAAsBA,MAP7BE,IAA0B,GAC7BH,EAAMI,OAAuB,EAC7BJ,EAAIK,KAAyB,GAC7BL,EAAO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Q,EAAS7Q,IACnBC,OAAU4Q,EAAS5Q,OACnBC,KAAUA,IAIlB,MAAA,CAAA,EAAOA,MACV,GAAA,IAAE8Q,OAAM,SAACC,GAEN,MAAM,IAAIvR,EAAoBuR,EACjC,UACR,EAKDtC,EAAQpO,UAAAkO,SAAR,SAASgB,GACL,IAAIzP,EAAMF,KAAKsM,SAAWtM,KAAKsM,QAAQ8E,SAAS,KAAO,GAAK,KAI5D,OAHIzB,IACAzP,GAAQyP,EAAK0B,WAAW,KAAO1B,EAAK2B,UAAU,GAAK3B,GAEhDzP,GAMH2O,EAAoBpO,UAAAmQ,qBAA5B,SAA6BpK,GACzB,IAAMgB,EAAwB,GAC9B,IAAK,IAAM9C,KAAO8B,EACd,GAAoB,OAAhBA,EAAO9B,GAAX,CAKA,IAAMC,EAAQ6B,EAAO9B,GACf6M,EAAarJ,mBAAmBxD,GAEtC,GAAIsF,MAAMC,QAAQtF,GAEd,IAAgB,QAAA6M,EAAA7M,EAAAf,EAAK4N,EAAA/O,OAALmB,IAAO,CAAlB,IAAM6N,EAACD,EAAA5N,GACR4D,EAAO/D,KAAK8N,EAAa,IAAMrJ,mBAAmBuJ,GACrD,MACM9M,aAAiBhC,KACxB6E,EAAO/D,KAAK8N,EAAa,IAAMrJ,mBAAmBvD,EAAM+M,gBAChC,cAAV/M,GAAmC,iBAAVA,EACvC6C,EAAO/D,KAAK8N,EAAa,IAAMrJ,mBAAmBhG,KAAKkC,UAAUO,KAEjE6C,EAAO/D,KAAK8N,EAAa,IAAMrJ,mBAAmBvD,GAfrD,CAmBL,OAAO6C,EAAOvF,KAAK,MAE1B4M,CAAD"} \ No newline at end of file diff --git a/dist/pocketbase.iife.d.ts b/dist/pocketbase.iife.d.ts index 710fe8c..e98eb51 100644 --- a/dist/pocketbase.iife.d.ts +++ b/dist/pocketbase.iife.d.ts @@ -366,6 +366,10 @@ declare class Collections extends CrudService { baseCrudPath(): string; /** * Imports the provided collections. + * + * If `deleteMissing` is `true`, all local collections and schema fields, + * that are not present in the imported configuration, WILL BE DELETED + * (including their related records data)! */ import(collections: Array, deleteMissing?: boolean, queryParams?: {}): Promise; } diff --git a/dist/pocketbase.umd.d.ts b/dist/pocketbase.umd.d.ts index 710fe8c..e98eb51 100644 --- a/dist/pocketbase.umd.d.ts +++ b/dist/pocketbase.umd.d.ts @@ -366,6 +366,10 @@ declare class Collections extends CrudService { baseCrudPath(): string; /** * Imports the provided collections. + * + * If `deleteMissing` is `true`, all local collections and schema fields, + * that are not present in the imported configuration, WILL BE DELETED + * (including their related records data)! */ import(collections: Array, deleteMissing?: boolean, queryParams?: {}): Promise; } diff --git a/src/services/Collections.ts b/src/services/Collections.ts index cc44e27..65033af 100644 --- a/src/services/Collections.ts +++ b/src/services/Collections.ts @@ -18,6 +18,10 @@ export default class Collections extends CrudService { /** * Imports the provided collections. + * + * If `deleteMissing` is `true`, all local collections and schema fields, + * that are not present in the imported configuration, WILL BE DELETED + * (including their related records data)! */ async import(collections: Array, deleteMissing: boolean = false, queryParams = {}): Promise { return this.client.send(this.baseCrudPath() + '/import', {