proto.io 0.0.215 → 0.0.217

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/adapters/file/aliyun-oss.d.ts +3 -3
  2. package/dist/adapters/file/database.d.ts +2 -2
  3. package/dist/adapters/file/database.js +1 -1
  4. package/dist/adapters/file/database.mjs +2 -2
  5. package/dist/adapters/file/filesystem.d.ts +3 -3
  6. package/dist/adapters/file/google-cloud-storage.d.ts +3 -3
  7. package/dist/adapters/storage/progres.d.ts +8 -10
  8. package/dist/adapters/storage/progres.js +833 -451
  9. package/dist/adapters/storage/progres.js.map +1 -1
  10. package/dist/adapters/storage/progres.mjs +834 -452
  11. package/dist/adapters/storage/progres.mjs.map +1 -1
  12. package/dist/client.d.ts +3 -3
  13. package/dist/client.js +1 -7
  14. package/dist/client.js.map +1 -1
  15. package/dist/client.mjs +3 -3
  16. package/dist/client.mjs.map +1 -1
  17. package/dist/index.d.ts +3 -3
  18. package/dist/index.js +9 -16
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +11 -12
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/internals/{base-Cp5le5dC.d.ts → base-CWnOBKD5.d.ts} +2 -2
  23. package/dist/internals/base-CWnOBKD5.d.ts.map +1 -0
  24. package/dist/internals/{chunk--Vo2-p-z.d.ts → chunk-CNNSQpRF.d.ts} +3 -3
  25. package/dist/internals/chunk-CNNSQpRF.d.ts.map +1 -0
  26. package/dist/internals/{index-CZUGnb-y.d.ts → index-BRIlS3mY.d.ts} +3 -9
  27. package/dist/internals/index-BRIlS3mY.d.ts.map +1 -0
  28. package/dist/internals/{index-YLrO0f2D.d.ts → index-Bs8n7Q8f.d.ts} +60 -20
  29. package/dist/internals/index-Bs8n7Q8f.d.ts.map +1 -0
  30. package/dist/internals/{index-al1N-qi7.mjs → index-BzDsTt4R.mjs} +2 -2
  31. package/dist/internals/{index-al1N-qi7.mjs.map → index-BzDsTt4R.mjs.map} +1 -1
  32. package/dist/internals/{index-ZPbBr9Db.mjs → index-DfqABzjr.mjs} +135 -142
  33. package/dist/internals/index-DfqABzjr.mjs.map +1 -0
  34. package/dist/internals/{index-DfnPpl1I.js → index-DylUjD_1.js} +133 -146
  35. package/dist/internals/index-DylUjD_1.js.map +1 -0
  36. package/dist/internals/{validator-ChrCrz_C.mjs → validator-CEcBF4Cn.mjs} +730 -27
  37. package/dist/internals/validator-CEcBF4Cn.mjs.map +1 -0
  38. package/dist/internals/{validator-m6wY35c6.js → validator-mcBCJP4P.js} +737 -27
  39. package/dist/internals/validator-mcBCJP4P.js.map +1 -0
  40. package/package.json +1 -1
  41. package/dist/internals/base-Cp5le5dC.d.ts.map +0 -1
  42. package/dist/internals/chunk--Vo2-p-z.d.ts.map +0 -1
  43. package/dist/internals/index-CZUGnb-y.d.ts.map +0 -1
  44. package/dist/internals/index-DfnPpl1I.js.map +0 -1
  45. package/dist/internals/index-YLrO0f2D.d.ts.map +0 -1
  46. package/dist/internals/index-ZPbBr9Db.mjs.map +0 -1
  47. package/dist/internals/validator-ChrCrz_C.mjs.map +0 -1
  48. package/dist/internals/validator-m6wY35c6.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DylUjD_1.js","sources":["../../../src/internals/query/base.ts","../../../src/internals/query/index.ts","../../../src/internals/liveQuery/index.ts","../../../src/internals/object/user.ts","../../../src/internals/object/role.ts","../../../src/internals/object/file.ts","../../../src/internals/object/job.ts","../../../src/internals/object/types.ts","../../../src/internals/utils.ts","../../../src/internals/codec.ts","../../../src/internals/object/methods.ts","../../../src/internals/proto/index.ts","../../../src/client/query.ts","../../../src/client/request.ts","../../../src/client/proto/internal.ts","../../../src/client/proto/index.ts"],"sourcesContent":["//\n// base.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { PathName, PathNameMap, PathNames } from './types';\nimport { TQuerySelector } from './types/selectors';\nimport { TValueWithUndefined } from '../types';\nimport { PVK } from '../private';\nimport { TExpression } from './types/expressions';\nimport { TQueryAccumulator } from './types/accumulators';\n\n/**\n * Options for a query filter.\n */\ninterface TQueryFilterBaseOptions {\n /**\n * The filter(s) to apply to the query.\n */\n filter?: TQuerySelector | TQuerySelector[];\n};\n\n/**\n * Sort option for a query.\n */\nexport type TSortOption = {\n /**\n * The expression to sort by.\n */\n expr: TExpression;\n /**\n * The order of sorting, 1 for ascending and -1 for descending.\n */\n order: 1 | -1;\n};\n\n/**\n * Base options for a query.\n */\nexport interface TQueryBaseOptions extends TQueryFilterBaseOptions {\n /**\n * The sorting options for the query.\n */\n sort?: Record<string, 1 | -1> | TSortOption[];\n /**\n * The number of results to skip.\n */\n skip?: number;\n /**\n * The limit on the number of results.\n */\n limit?: number;\n /**\n * Nested query options for matching specific fields.\n */\n matches?: Record<string, TQueryBaseOptions>;\n /**\n * Groups the query results by the specified key and applies the provided accumulators.\n */\n groupMatches?: Record<string, Record<string, TQueryAccumulator>>;\n};\n\nconst mergeOpts = (lhs: TQueryBaseOptions, rhs: TQueryBaseOptions): TQueryBaseOptions => {\n return {\n ...lhs,\n ...rhs,\n filter: [\n ..._.castArray<TQuerySelector>(lhs.filter),\n ..._.castArray<TQuerySelector>(rhs.filter)\n ],\n matches: {\n ...lhs.matches,\n ..._.mapValues(rhs.matches, (opts, key) => lhs.matches?.[key] ? mergeOpts(lhs.matches[key], opts) : opts),\n },\n groupMatches: {\n ...lhs.groupMatches ?? {},\n ...rhs.groupMatches ?? {},\n },\n };\n}\n\n/**\n * Base class for query filters.\n */\nclass TQueryFilterBase {\n\n /** @internal */\n [PVK]: { options: TQueryFilterBaseOptions; } = { options: {} };\n\n /**\n * Applies a filter to the query.\n * @param filter - The filter to apply.\n * @returns The current instance for chaining.\n */\n filter(filter: TQuerySelector) {\n if (_.isNil(this[PVK].options.filter)) {\n this[PVK].options.filter = filter;\n } else if (_.isArray(this[PVK].options.filter)) {\n this[PVK].options.filter = [...this[PVK].options.filter, filter];\n } else {\n this[PVK].options.filter = [this[PVK].options.filter, filter];\n }\n return this;\n }\n\n /**\n * Applies an equality filter to the query.\n * @param key - The key to filter.\n * @param value - The value to filter.\n * @returns The current instance for chaining.\n */\n equalTo<T extends string>(key: PathName<T>, value: TValueWithUndefined) {\n return this.filter({ [key]: { $eq: value ?? null } });\n }\n\n /**\n * Applies a not equal filter to the query.\n * @param key - The key to filter.\n * @param value - The value to filter.\n * @returns The current instance for chaining.\n */\n notEqualTo<T extends string>(key: PathName<T>, value: TValueWithUndefined) {\n return this.filter({ [key]: { $ne: value ?? null } });\n }\n\n /**\n * Applies a less than filter to the query.\n * @param key - The key to filter.\n * @param value - The value to filter.\n * @returns The current instance for chaining.\n */\n lessThan<T extends string>(key: PathName<T>, value: TValueWithUndefined) {\n return this.filter({ [key]: { $lt: value ?? null } });\n }\n\n /**\n * Applies a greater than filter to the query.\n * @param key - The key to filter.\n * @param value - The value to filter.\n * @returns The current instance for chaining.\n */\n greaterThan<T extends string>(key: PathName<T>, value: TValueWithUndefined) {\n return this.filter({ [key]: { $gt: value ?? null } });\n }\n\n /**\n * Applies a less than or equal to filter to the query.\n * @param key - The key to filter.\n * @param value - The value to filter.\n * @returns The current instance for chaining.\n */\n lessThanOrEqualTo<T extends string>(key: PathName<T>, value: TValueWithUndefined) {\n return this.filter({ [key]: { $lte: value ?? null } });\n }\n\n /**\n * Applies a greater than or equal to filter to the query.\n * @param key - The key to filter.\n * @param value - The value to filter.\n * @returns The current instance for chaining.\n */\n greaterThanOrEqualTo<T extends string>(key: PathName<T>, value: TValueWithUndefined) {\n return this.filter({ [key]: { $gte: value ?? null } });\n }\n\n /**\n * Applies a pattern filter to the query.\n * @param key - The key to filter.\n * @param value - The pattern to filter.\n * @returns The current instance for chaining.\n */\n pattern<T extends string>(key: PathName<T>, value: RegExp | string) {\n return this.filter({ [key]: { $pattern: value ?? null } });\n }\n\n /**\n * Applies a starts with filter to the query.\n * @param key - The key to filter.\n * @param value - The value to filter.\n * @returns The current instance for chaining.\n */\n startsWith<T extends string>(key: PathName<T>, value: string) {\n return this.filter({ [key]: { $starts: value ?? null } });\n }\n\n /**\n * Applies an ends with filter to the query.\n * @param key - The key to filter.\n * @param value - The value to filter.\n * @returns The current instance for chaining.\n */\n endsWith<T extends string>(key: PathName<T>, value: string) {\n return this.filter({ [key]: { $ends: value ?? null } });\n }\n\n /**\n * Applies a size filter to the query.\n * @param key - The key to filter.\n * @param value - The value to filter.\n * @returns The current instance for chaining.\n */\n size<T extends string>(key: PathName<T>, value: number) {\n return this.filter({ [key]: { $size: value } });\n }\n\n /**\n * Applies an empty filter to the query.\n * @param key - The key to filter.\n * @returns The current instance for chaining.\n */\n empty<T extends string>(key: PathName<T>) {\n return this.filter({ [key]: { $empty: true } });\n }\n\n /**\n * Applies a not empty filter to the query.\n * @param key - The key to filter.\n * @returns The current instance for chaining.\n */\n notEmpty<T extends string>(key: PathName<T>) {\n return this.filter({ [key]: { $empty: false } });\n }\n\n /**\n * Filters the query to include only documents where the specified key contains any of the specified values.\n * @param key - The key to check for values.\n * @param value - The array of values to check for.\n * @returns The current instance for chaining.\n */\n containedIn<T extends string>(key: PathName<T>, value: TValueWithUndefined[]) {\n return this.filter({ [key]: { $in: value } });\n }\n\n /**\n * Filters the query to exclude documents where the specified key contains any of the specified values.\n * @param key - The key to check for values.\n * @param value - The array of values to exclude.\n * @returns The current instance for chaining.\n */\n notContainedIn<T extends string>(key: PathName<T>, value: TValueWithUndefined[]) {\n return this.filter({ [key]: { $nin: value } });\n }\n\n /**\n * Filters the query to include only documents where the specified key contains all of the specified values.\n * @param key - The key to check for containing values.\n * @param value - The array of values to check against.\n * @returns The current instance for chaining.\n */\n containedBy<T extends string>(key: PathName<T>, value: TValueWithUndefined[]) {\n return this.filter({ [key]: { $superset: value } });\n }\n\n /**\n * Filters the query to exclude documents where the specified key contains all of the specified values.\n * @param key - The key to check for superset.\n * @param value - The array of values to check against.\n * @returns The current instance for chaining.\n */\n notContainedBy<T extends string>(key: PathName<T>, value: TValueWithUndefined[]) {\n return this.filter({ [key]: { $not: { $superset: value } } });\n }\n\n /**\n * Filters the query to include only documents where the specified key is a subset of the specified values.\n * @param key - The key to check for subset.\n * @param value - The array of values to check against.\n * @returns The current instance for chaining.\n */\n isSubset<T extends string>(key: PathName<T>, value: TValueWithUndefined[]) {\n return this.filter({ [key]: { $subset: value } });\n }\n\n /**\n * Filters the query to include only documents where the specified key is a superset of the specified values.\n * @param key - The key to check for superset.\n * @param value - The array of values to check against.\n * @returns The current instance for chaining.\n */\n isSuperset<T extends string>(key: PathName<T>, value: TValueWithUndefined[]) {\n return this.filter({ [key]: { $superset: value } });\n }\n\n /**\n * Filters the query to include only documents where the specified key is disjoint from the specified values.\n * @param key - The key to check for disjoint.\n * @param value - The array of values to check against.\n * @returns The current instance for chaining.\n */\n isDisjoint<T extends string>(key: PathName<T>, value: TValueWithUndefined[]) {\n return this.filter({ [key]: { $not: { $intersect: value } } });\n }\n\n /**\n * Filters the query to include only documents where the specified key intersects with the specified values.\n * @param key - The key to check for intersection.\n * @param value - The array of values to check against.\n * @returns The current instance for chaining.\n */\n isIntersect<T extends string>(key: PathName<T>, value: TValueWithUndefined[]) {\n return this.filter({ [key]: { $intersect: value } });\n }\n\n /**\n * Filters the query to include only documents where every element of the specified key matches the provided callback query.\n * @param key - The key to check for every element.\n * @param callback - The callback query to apply to each element.\n * @returns The current instance for chaining.\n */\n every<T extends string>(key: PathName<T>, callback: (query: TQueryFilterBase) => void) {\n const query = new TQueryFilterBase();\n callback(query);\n return this.filter({ [key]: { $every: { $and: _.castArray<TQuerySelector>(query[PVK].options.filter) } } });\n }\n\n /**\n * Filters the query to include only documents where some elements of the specified key match the provided callback query.\n * @param key - The key to check for some elements.\n * @param callback - The callback query to apply to each element.\n * @returns The current instance for chaining.\n */\n some<T extends string>(key: PathName<T>, callback: (query: TQueryFilterBase) => void) {\n const query = new TQueryFilterBase();\n callback(query);\n return this.filter({ [key]: { $some: { $and: _.castArray<TQuerySelector>(query[PVK].options.filter) } } });\n }\n\n /**\n * Filters the query to include only documents that match all of the provided callback queries.\n * @param callbacks - The callback queries to apply.\n * @returns The current instance for chaining.\n */\n and(...callbacks: _.Many<(query: TQueryFilterBase) => void>[]) {\n return this.filter({\n $and: _.flatMap(_.flatten(callbacks), callback => {\n const query = new TQueryFilterBase();\n callback(query);\n return _.castArray<TQuerySelector>(query[PVK].options.filter);\n }),\n });\n }\n\n /**\n * Filters the query to include only documents that match any of the provided callback queries.\n * @param callbacks - The callback queries to apply.\n * @returns The current instance for chaining.\n */\n or(...callbacks: _.Many<(query: TQueryFilterBase) => void>[]) {\n return this.filter({\n $or: _.map(_.flatten(callbacks), callback => {\n const query = new TQueryFilterBase();\n callback(query);\n return {\n $and: _.castArray<TQuerySelector>(query[PVK].options.filter),\n };\n }),\n });\n }\n\n /**\n * Filters the query to include only documents that do not match any of the provided callback queries.\n * @param callbacks - The callback queries to apply.\n * @returns The current instance for chaining.\n */\n nor(...callbacks: _.Many<(query: TQueryFilterBase) => void>[]) {\n return this.filter({\n $nor: _.map(_.flatten(callbacks), callback => {\n const query = new TQueryFilterBase();\n callback(query);\n return {\n $and: _.castArray<TQuerySelector>(query[PVK].options.filter),\n };\n }),\n });\n }\n}\n\nexport class TQueryBase extends TQueryFilterBase {\n\n /** @internal */\n [PVK]: { options: TQueryBaseOptions; } = { options: {} };\n\n /**\n * Sorts the query results.\n * @param sort - The sorting criteria.\n * @returns The current instance for chaining.\n */\n sort<T extends Record<string, 1 | -1>>(sort: PathNameMap<T> | TSortOption[]) {\n this[PVK].options.sort = sort;\n return this;\n }\n\n /**\n * Skips the specified number of results.\n * @param skip - The number of results to skip.\n * @returns The current instance for chaining.\n */\n skip(skip: number) {\n if (!_.isSafeInteger(skip) || skip < 0) throw Error('Invalid skip number');\n this[PVK].options.skip = skip;\n return this;\n }\n\n /**\n * Limits the number of results.\n * @param limit - The maximum number of results to return.\n * @returns The current instance for chaining.\n */\n limit(limit: number) {\n if (!_.isSafeInteger(limit) || limit < 0) throw Error('Invalid limit number');\n this[PVK].options.limit = limit;\n return this;\n }\n\n /**\n * Performs a nested query on a specific key.\n * @param key - The key to match.\n * @param callback - The callback function to execute.\n * @returns The current instance for chaining.\n */\n match<T extends string>(key: PathName<T>, callback: (query: TQueryBase) => void) {\n const query = new TQueryBase();\n callback(query);\n if (_.isNil(this[PVK].options.matches)) {\n this[PVK].options.matches = { [key]: query[PVK].options };\n } else if (_.isNil(this[PVK].options.matches[key])) {\n this[PVK].options.matches = { ...this[PVK].options.matches };\n this[PVK].options.matches[key] = query[PVK].options;\n } else {\n this[PVK].options.matches = { ...this[PVK].options.matches };\n this[PVK].options.matches[key] = mergeOpts(this[PVK].options.matches[key], query[PVK].options);\n }\n return this;\n }\n\n /**\n * Groups the query results by the specified key and applies the provided accumulators.\n * @param key - The key to group by.\n * @param accumulators - The accumulators to apply.\n * @returns The current instance for chaining.\n */\n groupMatches<T extends string>(key: PathName<T>, accumulators: Record<string, TQueryAccumulator>) {\n if (_.isNil(this[PVK].options.groupMatches)) {\n this[PVK].options.groupMatches = { [key]: accumulators };\n } else {\n this[PVK].options.groupMatches = { ...this[PVK].options.groupMatches };\n this[PVK].options.groupMatches[key] = accumulators;\n }\n return this;\n }\n}\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { IncludePaths } from './types';\nimport { TValueWithUndefined } from '../types';\nimport { PVK } from '../private';\nimport { TObjectType } from '../object/types';\nimport { TQueryBase, TQueryBaseOptions } from './base';\nimport { TUpdateOp } from '../object/types';\nimport { ExtraOptions } from '../options';\nimport { asyncStream, Awaitable, EventIterator } from '@o2ter/utils-js';\nimport { LiveQuerySubscription } from '../liveQuery';\nimport { TExpression } from './types/expressions';\n\n/**\n * Options for a query.\n */\nexport interface TQueryOptions extends TQueryBaseOptions {\n /**\n * Fields to include in the query.\n */\n includes?: string[];\n};\n\n/**\n * Options for a random query.\n */\nexport interface TQueryRandomOptions {\n /**\n * Field to use for weighting the random selection.\n */\n weight?: TExpression;\n};\n\n/**\n * Abstract base class for queries.\n */\nexport abstract class TQuery<T extends string, Ext, M extends boolean> extends TQueryBase {\n\n /** @internal */\n [PVK]: { options: TQueryOptions; } = { options: {} };\n\n /**\n * Clones the query with optional new options.\n * @param options - The new options for the query.\n * @returns A new query instance.\n */\n abstract clone(options?: TQueryOptions): TQuery<T, Ext, M>;\n\n /**\n * Explains the query execution plan.\n * @param options - Extra options for the query.\n * @returns A promise that resolves to the explanation.\n */\n abstract explain(options?: ExtraOptions<M>): PromiseLike<any>;\n\n /**\n * Counts the number of results for the query.\n * @param options - Extra options for the query.\n * @returns A promise that resolves to the count.\n */\n abstract count(options?: ExtraOptions<M>): PromiseLike<number>;\n\n /**\n * Finds the results for the query.\n * @param options - Extra options for the query.\n * @returns A stream of the results.\n */\n abstract find(options?: ExtraOptions<M>): ReturnType<typeof asyncStream<TObjectType<T, Ext>>>;\n\n /**\n * Selects a random result for the query.\n * @param opts - Options for the random selection.\n * @param options - Extra options for the query.\n * @returns A stream of the random result.\n */\n abstract random(\n opts?: TQueryRandomOptions,\n options?: ExtraOptions<M>\n ): ReturnType<typeof asyncStream<TObjectType<T, Ext>>>;\n\n /**\n * Finds non-reference results for the query.\n * @param options - Extra options for the query.\n * @returns A stream of the non-reference results.\n */\n abstract nonrefs(options?: ExtraOptions<M>): ReturnType<typeof asyncStream<TObjectType<T, Ext>>>;\n\n /**\n * Inserts a new record.\n * @param attrs - The attributes of the new record.\n * @param options - Extra options for the query.\n * @returns A promise that resolves to the inserted record.\n */\n async insert(\n attrs: Record<string, TValueWithUndefined>,\n options?: ExtraOptions<M>\n ) {\n const result = _.first(await this.clone().insertMany([attrs], options));\n if (!result) throw Error('Unable to insert document');\n return result;\n }\n\n /**\n * Inserts multiple new records.\n * @param values - The attributes of the new records.\n * @param options - Extra options for the query.\n * @returns A promise that resolves to the inserted records.\n */\n abstract insertMany(\n values: Record<string, TValueWithUndefined>[],\n options?: ExtraOptions<M>\n ): PromiseLike<TObjectType<T, Ext>[]>;\n\n /**\n * Updates a single record.\n * @param update - The update operations.\n * @param options - Extra options for the query.\n * @returns A promise that resolves to the updated record or undefined.\n */\n async updateOne(\n update: Record<string, TUpdateOp>,\n options?: ExtraOptions<M>\n ) {\n return _.first(await this.clone().limit(1).updateMany(update, options));\n }\n\n /**\n * Updates multiple records.\n * @param update - The update operations.\n * @param options - Extra options for the query.\n * @returns A promise that resolves to the updated records.\n */\n abstract updateMany(\n update: Record<string, TUpdateOp>,\n options?: ExtraOptions<M>\n ): PromiseLike<TObjectType<T, Ext>[]>;\n\n /**\n * Upserts a single record.\n * @param update - The update operations.\n * @param setOnInsert - The attributes to set on insert.\n * @param options - Extra options for the query.\n * @returns A promise that resolves to the upserted record.\n */\n async upsertOne(\n update: Record<string, TUpdateOp>,\n setOnInsert: Record<string, TValueWithUndefined>,\n options?: ExtraOptions<M>\n ) {\n const result = _.first(await this.clone().limit(1).upsertMany(update, setOnInsert, options));\n if (!result) throw Error('Unable to upsert document');\n return result;\n }\n\n\n /**\n * Upserts multiple records.\n * @param update - The update operations.\n * @param setOnInsert - The attributes to set on insert.\n * @param options - Extra options for the query.\n * @returns A promise that resolves to the upserted records.\n */\n abstract upsertMany(\n update: Record<string, TUpdateOp>,\n setOnInsert: Record<string, TValueWithUndefined>,\n options?: ExtraOptions<M>\n ): PromiseLike<TObjectType<T, Ext>[]>;\n\n /**\n * Deletes a single record.\n * @param options - Extra options for the query.\n * @returns A promise that resolves to the deleted record or undefined.\n */\n async deleteOne(options?: ExtraOptions<M>) {\n return _.first(await this.clone().limit(1).deleteMany(options));\n }\n\n /**\n * Deletes multiple records.\n * @param options - Extra options for the query.\n * @returns A promise that resolves to the deleted records.\n */\n abstract deleteMany(options?: ExtraOptions<M>): PromiseLike<TObjectType<T, Ext>[]>;\n\n abstract subscribe(): LiveQuerySubscription<T, Ext>;\n\n /**\n * Adds fields to include in the query.\n * @param includes - The fields to include.\n * @returns The query instance.\n */\n includes<T extends _.RecursiveArray<string>>(...includes: IncludePaths<T>) {\n const keys = this[PVK].options.includes ? [...this[PVK].options.includes, ..._.flattenDeep(includes)] : _.flattenDeep(includes);\n this[PVK].options.includes = _.uniq(keys);\n return this;\n }\n\n /**\n * Gets a record by its ID.\n * @param id - The ID of the record.\n * @param options - Extra options for the query.\n * @returns A promise that resolves to the record or undefined.\n */\n async get(id: string, options?: ExtraOptions<M>) {\n return _.first(await this.clone().equalTo('_id', id).limit(1).find(options));\n }\n\n /**\n * Gets the first record.\n * @param options - Extra options for the query.\n * @returns A promise that resolves to the first record or undefined.\n */\n async first(options?: ExtraOptions<M>) {\n return _.first(await this.clone().limit(1).find(options));\n }\n\n /**\n * Gets a random record.\n * @param opts - Options for the random selection.\n * @param options - Extra options for the query.\n * @returns A promise that resolves to the random record or undefined.\n */\n async randomOne(opts?: TQueryRandomOptions, options?: ExtraOptions<M>) {\n return _.first(await this.clone().limit(1).random(opts, options));\n }\n\n /**\n * Checks if any records exist.\n * @param options - Extra options for the query.\n * @returns A promise that resolves to a boolean indicating if any records exist.\n */\n async exists(options?: ExtraOptions<M>) {\n const query = this.clone();\n this[PVK].options.includes = [];\n return !_.isNil(await query.limit(1).find(options));\n }\n\n /**\n * Iterates over each batch of records.\n * @param callback - The callback to execute for each batch.\n * @param options - Extra options for the query.\n */\n async eachBatch(\n callback: (batch: TObjectType<T, Ext>[]) => Awaitable<void>,\n options?: ExtraOptions<M> & { batchSize?: number; },\n ) {\n const sorting = this[PVK].options.sort as Record<string, 1 | -1> ?? {};\n const batchSize = options?.batchSize ?? 100;\n if (!_.isPlainObject(sorting)) throw Error('Unsupported sort method');\n const is_asc = _.every(sorting, v => v === 1);\n const is_desc = _.every(sorting, v => v === -1);\n if (!is_asc && !is_desc) throw Error('Unsupported sort method');\n if (_.isNil(sorting._id)) sorting._id = is_asc ? 1 : -1;\n const query = this.clone().sort(sorting).limit(batchSize);\n const keys = _.keys(sorting);\n let batch: TObjectType<T, Ext>[] = [];\n while (true) {\n options?.abortSignal?.throwIfAborted();\n const q = _.isEmpty(batch) ? query : query.clone()\n .filter(keys.length > 1 ? {\n $expr: {\n [is_asc ? '$gt' : '$lt']: [\n { $array: _.map(keys, k => ({ $key: k })) },\n { $array: _.map(keys, k => ({ $value: _.last(batch)!.get(k) })) },\n ],\n },\n } : {\n [keys[0]]: { [is_asc ? '$gt' : '$lt']: _.last(batch)!.get(keys[0]) },\n });\n batch = await q.find(options);\n if (_.isEmpty(batch)) return;\n await callback(batch);\n }\n }\n\n /**\n * Iterates over each record.\n * @param callback - The callback to execute for each record.\n * @param options - Extra options for the query.\n */\n async each(\n callback: (object: TObjectType<T, Ext>) => Awaitable<void>,\n options?: ExtraOptions<M> & { batchSize?: number; },\n ) {\n await this.eachBatch(async (batch) => {\n for (const object of batch) {\n await callback(object);\n }\n }, options);\n }\n\n /**\n * Finds all records matching the query.\n * @param options - Extra options for the query.\n * @returns An iterator for the records.\n */\n findAll(options?: ExtraOptions<M> & { batchSize?: number; }) {\n return EventIterator<TObjectType<T, Ext>>(async (push, stop) => {\n await this.each(item => push(item), options);\n stop();\n });\n }\n};\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { TQuerySelector } from '../query/types/selectors';\nimport { ProtoType } from '../proto';\nimport { TObjectType } from '../object/types';\nimport { PVK } from '../private';\n\nexport class LiveQuerySubscription<T extends string, E> {\n\n private _className: T;\n private _proto: ProtoType<E>;\n private _filter: TQuerySelector[];\n\n constructor(className: T, proto: ProtoType<E>, filter: TQuerySelector | TQuerySelector[]) {\n this._className = className;\n this._proto = proto;\n this._filter = _.isArray(filter) ? filter : [filter];\n }\n\n get className(): T {\n return this._className;\n }\n\n on(\n event: 'create' | 'update' | 'delete',\n callback: (object: TObjectType<T, E>) => void,\n ) {\n return this._proto[PVK].liveQuery(\n this._proto,\n event,\n this.className,\n this._filter,\n (object) => callback(object as TObjectType<T, E>),\n );\n }\n}","//\n// user.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { TObject } from './index';\nimport { TValue } from '../types';\n\nexport class TUser extends TObject {\n\n constructor(\n attributes?: Record<string, TValue> | ((self: TObject) => Record<string, TValue>),\n ) {\n super('User', attributes);\n }\n}","//\n// role.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { TObject } from './index';\nimport { TValue } from '../types';\nimport { TUser } from './user';\n\n/**\n * Class representing a Role.\n * @extends TObject\n */\nexport class TRole extends TObject {\n\n constructor(\n attributes?: Record<string, TValue> | ((self: TObject) => Record<string, TValue>),\n ) {\n super('Role', attributes);\n }\n\n /**\n * Get the name of the role.\n * @return {string | undefined} The name of the role.\n */\n get name(): string | undefined {\n return this.get('name');\n }\n\n /**\n * Get the users associated with the role.\n * @return {TUser[]} The users associated with the role.\n */\n get users(): TUser[] {\n return this.get('users') ?? [];\n }\n\n /**\n * Set the users associated with the role.\n * @param {TUser[]} value - The users to associate with the role.\n */\n set users(value: TUser[]) {\n this.set('users', value);\n }\n\n /**\n * Get the roles associated with the role.\n * @return {TRole[]} The roles associated with the role.\n */\n get roles(): TRole[] {\n return this.get('roles') ?? [];\n }\n\n /**\n * Set the roles associated with the role.\n * @param {TRole[]} value - The roles to associate with the role.\n */\n set roles(value: TRole[]) {\n this.set('roles', value);\n }\n}","//\n// file.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { TObject } from './index';\nimport { ExtraOptions } from '../options';\nimport { FileStream } from '../buffer';\nimport { TValue } from '../types';\n\n/**\n * Interface representing a file.\n */\nexport interface TFile {\n /**\n * URL of the file.\n */\n url: string | undefined;\n\n /**\n * Retrieves the file data.\n * @param options - Optional extra options.\n * @returns A FileStream containing the file data.\n */\n fileData(options?: ExtraOptions<boolean>): FileStream;\n\n /**\n * Saves the file.\n * @param options - Optional extra options including cascadeSave and uploadToken.\n * @returns A promise that resolves to the current instance.\n */\n save(options?: ExtraOptions<boolean> & {\n cascadeSave?: boolean;\n uploadToken?: string;\n }): PromiseLike<this>;\n}\n\n/**\n * Class representing a file.\n */\nexport class TFile extends TObject {\n\n constructor(\n attributes?: Record<string, TValue> | ((self: TObject) => Record<string, TValue>),\n ) {\n super('File', attributes);\n }\n\n /**\n * Gets the filename of the file.\n * @returns The filename.\n */\n get filename(): string | undefined {\n return this.get('filename');\n }\n\n /**\n * Gets the size of the file.\n * @returns The size of the file.\n */\n get size(): number | undefined {\n return this.get('size');\n }\n\n /**\n * Gets the type of the file.\n * @returns The type of the file.\n */\n get type(): string | undefined {\n return this.get('type');\n }\n\n /**\n * Gets the token of the file.\n * @returns The token of the file.\n */\n get token(): string | undefined {\n return this.get('token');\n }\n\n}\n","//\n// job.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { TObject } from './index';\nimport { TValue } from '../types';\nimport { TUser } from './user';\n\n/**\n * Class representing a Job.\n * @extends TObject\n */\nexport class TJob extends TObject {\n\n constructor(\n attributes?: Record<string, TValue> | ((self: TObject) => Record<string, TValue>),\n ) {\n super('_Job', attributes);\n }\n\n /**\n * Get the name of the job.\n * @return {string} The name of the job.\n */\n get name(): string {\n return this.get('name');\n }\n\n /**\n * Get the data of the job.\n * @return {TValue | undefined} The data of the job.\n */\n get data(): TValue | undefined {\n return this.get('data');\n }\n\n /**\n * Get the user associated with the job.\n * @return {TUser | undefined} The user associated with the job.\n */\n get user(): TUser | undefined {\n return this.get('user');\n }\n\n /**\n * Get the error of the job.\n * @return {TValue | undefined} The error of the job.\n */\n get error(): TValue | undefined {\n return this.get('error');\n }\n\n /**\n * Get the start time of the job.\n * @return {Date | undefined} The start time of the job.\n */\n get startedAt(): Date | undefined {\n return this.get('startedAt');\n }\n\n /**\n * Get the completion time of the job.\n * @return {Date | undefined} The completion time of the job.\n */\n get completedAt(): Date | undefined {\n return this.get('completedAt');\n }\n}","//\n// types.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { TObject } from './index';\nimport { TUser } from './user';\nimport { TRole } from './role';\nimport { TFile } from './file';\nimport { TValueWithUndefined } from '../types';\nimport { ExactOneProp } from '../types';\nimport { TJob } from './job';\n\nexport const TObjectTypes = {\n 'User': TUser,\n 'Role': TRole,\n 'File': TFile,\n '_Job': TJob,\n};\n\ntype _TObjectType<K> = K extends keyof typeof TObjectTypes ? InstanceType<(typeof TObjectTypes)[K]> : TObject;\n\ntype PickBy<T, C> = {\n [P in keyof T as T[P] extends C ? P : never]: T[P];\n}\n\ntype PropertyDescriptor<T> = {\n enumerable?: boolean;\n get: () => T;\n set?: (value: T) => void;\n};\ntype ReadOnlyProperty<T> = Pick<PropertyDescriptor<T>, 'get'>;\ntype ReadWriteProperty<T> = Required<Pick<PropertyDescriptor<T>, 'get' | 'set'>>;\n\ntype PropertyMapToMethods<T> = PickBy<T, Function>\n & { [P in keyof PickBy<T, ReadWriteProperty<any>>]: T[P] extends PropertyDescriptor<infer V> ? V : never; }\n & { readonly [P in keyof PickBy<T, ReadOnlyProperty<any>>]: T[P] extends PropertyDescriptor<infer V> ? V : never; }\ntype Property<T> = T extends Function ? T | PropertyDescriptor<T> : PropertyDescriptor<T>;\ntype PropertyMap<T, O, A> = {\n [K in keyof T]: T[K] extends Property<any> ? T[K] : never;\n} & ThisType<O & PropertyMapToMethods<T> & PropertyMapToMethods<A>>;\n\nexport type TExtensions<E> = {\n [K in keyof E]: PropertyMap<E[K], _TObjectType<K>, '*' extends keyof E ? Omit<E['*'], keyof E[K]> : {}>;\n};\n\ntype _TMethods<K, E> = K extends keyof E\n ? '*' extends keyof E ? PropertyMapToMethods<Omit<E['*'], keyof E[K]> & E[K]> : PropertyMapToMethods<E[K]>\n : {};\n\ntype IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N;\ntype TMethods<K, E> = IfAny<E, {}, _TMethods<K, E>>;\n\nexport type TObjectType<K, E> = _TObjectType<K> & TMethods<K, E>;\n\nexport const TUpdateOpKeys = [\n '$set',\n '$inc',\n '$dec',\n '$mul',\n '$div',\n '$max',\n '$min',\n '$addToSet',\n '$push',\n '$removeAll',\n '$popFirst',\n '$popLast',\n] as const;\n\nexport type TUpdateOp = ExactOneProp<Record<(typeof TUpdateOpKeys)[number], TValueWithUndefined>>;\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { TObject } from './object';\nimport { TFile } from './object/file';\nimport { TJob } from './object/job';\nimport { TRole } from './object/role';\nimport { TExtensions } from './object/types';\nimport { TUser } from './object/user';\nimport { TQuery } from './query';\n\nexport const isObjKey = <T extends object>(key: PropertyKey, obj: T): key is keyof T => key in obj;\n\nexport const classExtends = <E = {}>(x: TExtensions<E>) => x;\n\nexport const isQuery = (x: any): x is TQuery<any, any, any> => {\n return x instanceof TQuery;\n}\n\nexport const isObject = (x: any): x is TObject => {\n return x instanceof TObject;\n}\n\nexport const isUser = (x: any): x is TUser => {\n return x instanceof TUser;\n}\n\nexport const isRole = (x: any): x is TRole => {\n return x instanceof TRole;\n}\n\nexport const isFile = (x: any): x is TFile => {\n return x instanceof TFile;\n}\n\nexport const isJob = (x: any): x is TJob => {\n return x instanceof TJob;\n}\n","//\n// codec.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Decimal } from 'decimal.js';\nimport { TObject } from './object';\nimport { TObjectTypes } from './object/types';\nimport { isObjKey } from './utils';\nimport { _TContainer, TValue } from './types';\nimport { prototypes } from '@o2ter/utils-js';\n\nexport { Decimal };\nexport type TNumber = number | Decimal | BigInt;\ntype TPrimitive = RegExp | Date | string | TNumber | boolean | null | undefined;\nexport type TSerializable = _TContainer<TPrimitive | TObject>;\n\nexport type SerializeOptions = {\n space?: string | number;\n objAttrs?: string[];\n};\n\nexport type DeserializeOptions = {\n objAttrs?: string[];\n};\n\nconst encodeEJSON = (\n x: TSerializable,\n stack: any[],\n options: SerializeOptions,\n): any => {\n if (_.isNil(x) || _.isNumber(x) || _.isBoolean(x) || _.isString(x)) return x ?? null;\n if (_.isDate(x)) return { $date: x.valueOf() };\n if (_.isRegExp(x)) return { $regex: x.source, $options: x.flags };\n if (x instanceof BigInt) return { $integer: x.toString() };\n if (x instanceof Decimal) return { $decimal: x.toString() };\n\n const found = _.indexOf(stack, x);\n if (found !== -1) return { $ref: found };\n\n if (_.isArray(x)) return x.map(v => encodeEJSON(v, [...stack, x], options));\n if (x instanceof TObject) {\n const attributes = options.objAttrs ? _.pick(x.attributes, ...options.objAttrs) : x.attributes;\n return {\n $object: {\n className: x.className,\n attributes: _.mapValues(attributes, v => encodeEJSON(v, [...stack, x], options)),\n }\n };\n }\n\n const props = _.uniq(_.flatMap([x, ...prototypes(x)], x => Object.getOwnPropertyNames(x)));\n return _.transform(\n _.pick(x, props),\n (r, v, k) => {\n if (_.isFunction(v)) return;\n r[k.startsWith('$') ? `$${k}` : k] = encodeEJSON(v, [...stack, x], options);\n },\n {} as { [x: string]: TSerializable },\n );\n}\n\nconst decodeEJSON = (\n x: any,\n stack: any[],\n options: DeserializeOptions,\n): TSerializable => {\n if (_.isNil(x) || _.isNumber(x) || _.isBoolean(x) || _.isString(x)) return x ?? null;\n if (_.isArray(x)) {\n return _.transform(x, (r, v) => {\n r.push(decodeEJSON(v, [...stack, r], options));\n }, [] as TSerializable[]);\n }\n if (!_.isNil(x.$date)) return new Date(x.$date);\n if (!_.isNil(x.$regex)) return new RegExp(x.$regex, x.$options || '');\n if (!_.isNil(x.$integer)) return BigInt(x.$integer);\n if (!_.isNil(x.$decimal)) return new Decimal(x.$decimal);\n if (!_.isNil(x.$ref)) return stack[x.$ref];\n if (!_.isNil(x.$object)) {\n const { className, attributes } = x.$object;\n const _attributes = (self: TObject) => _.mapValues(\n options.objAttrs ? _.pick(attributes, ...options.objAttrs) : attributes,\n v => decodeEJSON(v, [...stack, self], options),\n ) as Record<string, TValue>;\n return isObjKey(className, TObjectTypes) ? new TObjectTypes[className](_attributes) : new TObject(className, _attributes);\n }\n return _.transform(x, (r, v, k) => {\n if (_.isString(k)) r[k.startsWith('$') ? k.substring(1) : k] = decodeEJSON(v, [...stack, r], options);\n }, {} as { [x: string]: TSerializable });\n}\n\nexport const serialize = (\n x: TSerializable,\n options?: SerializeOptions,\n) => JSON.stringify(encodeEJSON(x, [], options ?? {}), undefined, options?.space);\n\nexport const deserialize = (\n buffer: string,\n options?: DeserializeOptions,\n) => decodeEJSON(JSON.parse(buffer), [], options ?? {});\n","//\n// methods.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { TObject, decodeUpdateOp } from './index';\nimport { PVK } from '../private';\nimport { ExtraOptions } from '../options';\nimport { TExtensions, TObjectType, TObjectTypes } from './types';\nimport { ProtoType } from '../proto';\nimport { TSerializable } from '../codec';\nimport { PathName } from './../query/types';\nimport { TFile } from './file';\nimport { isObjKey } from '../utils';\n\nexport type TExtended<U, T extends string, E> = U extends TObject ?\n TObjectType<T, E> : U extends (infer U)[] ?\n TExtended<U, T, E>[] : U;\n\nexport const applyObjectMethods = <T extends TSerializable, E>(\n object: T,\n proto: ProtoType<E>,\n): T => {\n\n if (!(object instanceof TObject)) {\n if (_.isArray(object)) return _.map(object, x => applyObjectMethods(x, proto)) as T;\n if (_.isPlainObject(object)) return _.mapValues(object as any, x => applyObjectMethods(x, proto));\n return object;\n }\n\n object[PVK].attributes = _.mapValues(object[PVK].attributes, x => applyObjectMethods(x, proto));\n\n const className = object.className;\n const _class = isObjKey(className, TObjectTypes) ? TObjectTypes[className] : undefined;\n if (_class && Object.getPrototypeOf(object) !== _class.prototype) {\n Object.setPrototypeOf(object, _class.prototype);\n }\n\n const classExtends = proto[PVK].options.classExtends ?? {} as TExtensions<E>;\n const extensions = {\n ...classExtends['*' as keyof E] ?? {},\n ...classExtends[className as keyof E] ?? {},\n };\n const query = () => proto.Query(className);\n\n const typedMethods: Record<string, PropertyDescriptorMap & ThisType<TObject>> = {\n 'File': {\n save: {\n value(options?: ExtraOptions<boolean>) {\n return proto[PVK].saveFile(proto, this as TFile, options);\n },\n },\n destroy: {\n value(options?: ExtraOptions<boolean>) {\n return proto[PVK].deleteFile(proto, this as TFile, options);\n },\n },\n url: {\n get() {\n const filename = (this as TFile).filename;\n if (_.isNil(this.objectId) || _.isNil(filename)) return;\n const endpoint = proto[PVK].options.endpoint;\n const path = `files/${this.objectId}/${encodeURIComponent(filename)}`;\n return endpoint.endsWith('/') ? `${endpoint}${path}` : `${endpoint}/${path}`;\n }\n },\n fileData: {\n value(options?: ExtraOptions<boolean>) {\n return proto[PVK].fileData(proto, this as TFile, options);\n },\n },\n },\n };\n\n const props: PropertyDescriptorMap & ThisType<TObject> = {\n clone: {\n value() {\n const clone = proto.Object(this.className);\n clone[PVK].attributes = { ...this[PVK].attributes };\n clone[PVK].mutated = { ...this[PVK].mutated };\n clone[PVK].extra = { ...this[PVK].extra };\n return clone;\n }\n },\n relation: {\n value<T extends string>(key: PathName<T>) {\n return proto.Relation(this, key);\n }\n },\n fetchWithInclude: {\n async value(keys: _.RecursiveArray<string>, options?: ExtraOptions<boolean>) {\n const fetched = await query().equalTo('_id', this.objectId).includes(keys).first(options);\n if (!fetched) throw Error('Unable to fetch document');\n this[PVK].attributes = fetched.attributes;\n return this;\n },\n },\n save: {\n async value(options?: ExtraOptions<boolean> & { cascadeSave?: boolean }) {\n const mutated = _.values(this[PVK].mutated);\n if (options?.cascadeSave !== false) {\n for (const update of _.values(mutated)) {\n const [, value] = decodeUpdateOp(update);\n if (value instanceof TObject && (_.isNil(value.objectId) || value.isDirty)) await value.save(options);\n }\n }\n if (this.objectId) {\n const updated = await query()\n .equalTo('_id', this.objectId)\n .includes(...this.keys())\n .updateOne(this[PVK].mutated, options);\n if (!updated) throw Error('Unable to save document');\n this[PVK].attributes = updated.attributes;\n this[PVK].mutated = {};\n } else {\n const created = await query()\n .includes(...this.keys())\n .insert(_.fromPairs([...this._set_entries()]), options);\n this[PVK].attributes = created.attributes;\n this[PVK].mutated = {};\n }\n return this;\n },\n },\n destroy: {\n async value(options?: ExtraOptions<boolean>) {\n const deleted = await query()\n .equalTo('_id', this.objectId)\n .includes(...this.keys())\n .deleteOne(options);\n if (!deleted) throw Error('Unable to destroy document');\n this[PVK].attributes = deleted.attributes;\n this[PVK].mutated = {};\n return this;\n },\n },\n ...typedMethods[className] ?? {},\n ..._.mapValues(extensions, value => _.isFunction(value) ? { value } : value),\n };\n\n const _props = _.pickBy(props, (_v, k) => !Object.hasOwn(object, k)) as typeof props;\n return Object.defineProperties(object, _props);\n};\n","//\n// proto.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport axios from 'axios';\nimport { PVK } from '../private';\nimport type jwt from 'jsonwebtoken';\nimport type { CookieOptions, Request } from '@o2ter/server-js';\nimport type { SignOptions } from 'jsonwebtoken';\nimport { ExtraOptions } from '../options';\nimport { TQuery } from '../query';\nimport { TExtensions, TObjectType, TObjectTypes } from '../object/types';\nimport { TFile } from '../object/file';\nimport { FileData, FileStream } from '../buffer';\nimport { isObjKey } from '../utils';\nimport { applyObjectMethods } from '../object/methods';\nimport { TValue, TValueWithoutObject } from '../types';\nimport { TObject } from '../object';\nimport { TSerializable } from '../codec';\nimport { TUser } from '../object/user';\nimport { ProtoFunction, ProtoFunctionOptions, ProtoJobFunction, ProtoJobFunctionOptions, ProtoTriggerFunction } from './types';\nimport { Socket } from 'socket.io-client';\nimport { Session } from '../../server/proto/session';\nimport { asyncStream } from '@o2ter/utils-js';\nimport { PathName } from '../query/types';\nimport { TRole } from '../object/role';\nimport { TJob } from '../object/job';\nimport { isFile, isJob, isObject, isQuery, isRole, isUser } from '../utils';\nimport { TQuerySelector } from '../query/types/selectors';\n\nexport const _logLevels = ['error', 'warn', 'info', 'debug', 'trace'] as const;\ntype _Logger = {\n [x in typeof _logLevels[number]]: (...args: any[]) => void;\n};\nexport type Logger = _Logger & {\n loggerLevel: keyof _Logger | 'all' | 'none';\n};\n\n/**\n * The mode of the transaction.\n */\nexport type TransactionMode = 'default' | 'committed' | 'repeatable' | 'serializable';\n\n/**\n * Options for configuring a transaction.\n */\nexport type TransactionOptions = {\n /**\n * The mode of the transaction.\n */\n mode?: TransactionMode;\n\n /**\n * The number of retries or a boolean indicating whether to retry.\n */\n retry?: number | boolean;\n};\n\n/**\n * Represents event data with additional metadata.\n */\nexport type EventData = Record<string, TValueWithoutObject> & {\n /**\n * The unique identifier for the event.\n */\n _id: string;\n\n /**\n * The creation date of the event.\n */\n _created_at: Date;\n\n /**\n * The read permissions for the event.\n */\n _rperm: string[];\n};\n\nexport interface ProtoInternalType<Ext, P extends ProtoType<any>> {\n\n options: {\n endpoint: string;\n classExtends?: TExtensions<Ext>;\n };\n\n saveFile(proto: P, object: TFile, options?: ExtraOptions<boolean>): Promise<TFile>;\n deleteFile(proto: P, object: TFile, options?: ExtraOptions<boolean>): Promise<TFile>;\n fileData(proto: P, object: TFile, options?: ExtraOptions<boolean>): FileStream;\n\n liveQuery(\n proto: P,\n event: string,\n className: string,\n filter: TQuerySelector[],\n callback: (object: TObject) => void,\n ): {\n remove: VoidFunction;\n socket?: Socket;\n };\n}\n\nexport abstract class ProtoType<Ext> {\n\n isQuery = isQuery;\n isObject = isObject;\n isUser = isUser;\n isRole = isRole;\n isFile = isFile;\n isJob = isJob;\n\n /** @internal */\n abstract [PVK]: ProtoInternalType<Ext, this>;\n\n /**\n * Gets the endpoint URL.\n * @returns The endpoint URL as a string.\n */\n get endpoint() {\n return this[PVK].options.endpoint;\n }\n\n /**\n * Retrieves the configuration.\n * @param options - Optional settings for retrieving the configuration.\n * @returns A promise that resolves to the configuration.\n */\n abstract config(options?: { master?: boolean; }): Promise<Record<string, TValueWithoutObject>>;\n\n /**\n * Retrieves the ACL of configuration.\n * @param options - Settings for retrieving the ACL of configuration.\n * @returns A promise that resolves to the ACL of configuration.\n */\n abstract configAcl(options: { master: true; }): PromiseLike<Record<string, string[]>>;\n\n /**\n * Sets the configuration.\n * @param values - The configuration values to set.\n * @param options - Settings for setting the configuration.\n * @returns A promise that resolves when the configuration is set.\n */\n abstract setConfig(values: Record<string, TValueWithoutObject>, options: { master: true; acl?: string[]; }): Promise<void>;\n\n /**\n * Runs a function.\n * @param name - The name of the function to run.\n * @param data - The data to pass to the function.\n * @param options - Additional options for running the function.\n * @returns A promise that resolves to the result of the function.\n */\n abstract run(name: string, data?: TSerializable, options?: ExtraOptions<boolean>): Promise<void | TSerializable>;\n\n /**\n * Schedules a job.\n * @param name - The name of the job to schedule.\n * @param params - The parameters to pass to the job.\n * @param options - Additional options for scheduling the job.\n * @returns A promise that resolves when the job is scheduled.\n */\n abstract scheduleJob(name: string, params?: TValueWithoutObject, options?: ExtraOptions<boolean>): Promise<TJob>;\n\n /**\n * Creates a query.\n * @param className - The name of the class to query.\n * @returns A query instance.\n */\n abstract Query<T extends string>(className: T): TQuery<T, Ext, boolean>;\n\n /**\n * Creates a relation query.\n * @param object - The object to create the relation for.\n * @param key - The key of the relation.\n * @returns A relation query instance.\n */\n abstract Relation<T extends string>(object: TObject, key: PathName<T>): TQuery<string, Ext, boolean>;\n\n /**\n * Get all references to an object.\n * @param object - The object to get references for.\n * @param options - Additional options for getting references.\n * @returns A stream of references.\n */\n abstract refs(object: TObject, options?: ExtraOptions<boolean>): ReturnType<typeof asyncStream<TObjectType<string, Ext>>>;\n\n /**\n * Checks if the server is online.\n * @returns A promise that resolves to a boolean indicating if the server is online.\n */\n async online() {\n try {\n const res = await axios({\n method: 'get',\n baseURL: this[PVK].options.endpoint,\n url: 'health',\n });\n return res.status === 200;\n } catch {\n return false;\n }\n }\n\n /**\n * Rebinds an object to the proto instance.\n * @param object - The object to rebind.\n * @returns The rebinded object.\n */\n rebind<T extends TSerializable | undefined>(object: T): T {\n return applyObjectMethods(object, this);\n }\n\n /**\n * Creates a new object.\n * @param className - The name of the class to create.\n * @param objectId - The ID of the object to create.\n * @returns The created object.\n */\n Object<T extends string>(className: T, objectId?: string): TObjectType<T, Ext> {\n const attrs: Record<string, TValue> = objectId ? { _id: objectId } : {};\n const obj = isObjKey(className, TObjectTypes) ? new TObjectTypes[className](attrs) : new TObject(className, attrs);\n return this.rebind(obj as TObjectType<T, Ext>);\n }\n\n /**\n * Creates a new file object.\n * @param filename - The name of the file.\n * @param data - The file data.\n * @param type - The type of the file.\n * @returns The created file object.\n */\n File(filename: string, data: FileData, type?: string) {\n const file = this.Object('File');\n file.set('filename', filename);\n file.set('type', type);\n file[PVK].extra.data = data;\n return file;\n }\n\n /**\n * Notifies an event.\n * @param data - The data to notify.\n * @param options - Additional options for notifying the event.\n */\n abstract notify(\n data: Record<string, TValueWithoutObject> & { _rperm?: string[]; },\n options?: ExtraOptions<boolean>\n ): Promise<void>\n\n /**\n * Listens for events.\n * @param callback - The callback to call when an event occurs.\n * @returns An object with a remove function to stop listening.\n */\n abstract listen(\n callback: (data: EventData) => void,\n selector?: TQuerySelector\n ): {\n remove: VoidFunction;\n socket?: Socket;\n }\n};\n\nexport interface ProtoType<Ext> {\n\n get logger(): Logger;\n\n /**\n * Connects a request with optional attributes.\n * @param req - The request to connect.\n * @param attrs - Optional attributes or a function returning attributes.\n * @returns The instance with the request and attributes.\n */\n connect<R extends Request, T extends object>(\n req: R,\n attrs?: T | ((x: this & { req: R; }) => T)\n ): this & { req: R; } & T;\n\n /**\n * Connects using a session token with optional attributes.\n * @param token - The session token.\n * @param attrs - Optional attributes or a function returning attributes.\n * @returns A promise resolving to the instance with the session and attributes.\n */\n connectWithSessionToken<T extends object>(\n token: string,\n attrs?: T | ((x: this & { session?: Session; }) => T)\n ): Promise<this & { session?: Session; } & T>\n\n /**\n * Sets the session token.\n * @param token - The session token.\n */\n setSessionToken(token?: string): void\n\n /**\n * Retrieves the roles of a user.\n * @param user - The user whose roles are to be retrieved.\n * @returns A promise resolving to an array of roles.\n */\n userRoles(user: TUser): Promise<TRole[]>;\n\n /**\n * Becomes a specified user.\n * @param req - The request.\n * @param user - The user to become.\n * @param options - Optional cookie and JWT sign options.\n * @returns A promise resolving to void.\n */\n becomeUser(\n req: Request,\n user: TUser,\n options?: {\n cookieOptions?: CookieOptions | undefined;\n jwtSignOptions?: SignOptions | undefined;\n }\n ): Promise<void>;\n\n /**\n * Logs out a user.\n * @param req - The request.\n * @param options - Optional cookie and JWT sign options.\n * @returns A promise resolving to void.\n */\n logoutUser(\n req: Request,\n options?: {\n cookieOptions?: CookieOptions | undefined;\n jwtSignOptions?: SignOptions | undefined;\n }\n ): Promise<void>;\n\n /**\n * Verifies a user's password.\n * @param user - The user whose password is to be verified.\n * @param password - The password to verify.\n * @param options - Extra options.\n * @returns A promise resolving to a boolean indicating if the password is correct.\n */\n varifyPassword(user: TUser, password: string, options: ExtraOptions<true>): Promise<boolean>;\n\n /**\n * Sets a user's password.\n * @param user - The user whose password is to be set.\n * @param password - The new password.\n * @param options - Extra options.\n * @returns A promise resolving to void.\n */\n setPassword(user: TUser, password: string, options: ExtraOptions<true>): Promise<void>;\n\n /**\n * Unsets a user's password.\n * @param user - The user whose password is to be unset.\n * @param options - Extra options.\n * @returns A promise resolving to void.\n */\n unsetPassword(user: TUser, options: ExtraOptions<true>): Promise<void>;\n\n /**\n * Defines a new function.\n * @param name - The name of the function.\n * @param callback - The function callback.\n * @param options - Optional function options excluding the callback.\n */\n define(\n name: string,\n callback: ProtoFunction<Ext>,\n options?: Omit<ProtoFunctionOptions<Ext>, 'callback'>,\n ): void;\n\n /**\n * Registers a callback to be executed after an object is created.\n * @param className - The name of the class.\n * @param callback - The callback function.\n */\n afterCreate<T extends string>(\n className: string,\n callback: ProtoTriggerFunction<T, Ext>,\n ): void;\n\n /**\n * Registers a callback to be executed after an object is updated.\n * @param className - The name of the class.\n * @param callback - The callback function.\n */\n afterUpdate<T extends string>(\n className: string,\n callback: ProtoTriggerFunction<T, Ext>,\n ): void;\n\n /**\n * Registers a callback to be executed after an object is deleted.\n * @param className - The name of the class.\n * @param callback - The callback function.\n */\n afterDelete<T extends string>(\n className: string,\n callback: ProtoTriggerFunction<T, Ext>,\n ): void;\n\n /**\n * Defines a new job function.\n * @param name - The name of the job function.\n * @param callback - The job function callback.\n * @param options - Optional job function options excluding the callback.\n */\n defineJob(\n name: string,\n callback: ProtoJobFunction<Ext>,\n options?: Omit<ProtoJobFunctionOptions<Ext>, 'callback'>,\n ): void;\n\n /**\n * Locks a table for updates.\n * @param className - The name of the class or an array of class names.\n * @param update - Whether to lock for update.\n */\n lockTable(className: string | string[], update: boolean): void;\n\n /**\n * Executes a callback within a transaction.\n * @param callback - The callback to execute.\n * @param options - Optional transaction options.\n */\n withTransaction<T>(\n callback: (connection: ProtoType<Ext>) => PromiseLike<T>,\n options?: TransactionOptions,\n ): void;\n\n /**\n * Generates an upload token.\n * @param options - Optional settings for the upload token.\n * @returns The generated upload token.\n */\n generateUploadToken(\n options?: { maxUploadSize?: number; }\n ): string;\n\n /**\n * Signs a JWT.\n * @param payload - The payload to sign.\n * @param options - Options for signing the JWT.\n * @returns The signed JWT.\n */\n jwtSign(payload: any, options: jwt.SignOptions): string;\n\n /**\n * Verifies a JWT.\n * @param token - The token to verify.\n * @param options - Options for verifying the JWT.\n * @returns The decoded JWT payload or undefined if verification fails.\n */\n jwtVarify(token: string, options?: jwt.VerifyOptions): jwt.JwtPayload | undefined;\n};\n","//\n// query.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { ProtoClient } from './proto';\nimport { RequestOptions } from './options';\nimport { asyncStream } from '@o2ter/utils-js';\nimport { PVK } from '../internals/private';\nimport { TQuery, TQueryOptions, TQueryRandomOptions } from '../internals/query';\nimport { TObject } from '../internals/object';\nimport { TObjectType, TUpdateOp } from '../internals/object/types';\nimport { TValue, TValueWithUndefined } from '../internals/types';\nimport { LiveQuerySubscription } from '../internals/liveQuery';\n\ntype _QueryOptions = {\n relatedBy?: {\n className: string;\n objectId: string;\n key: string;\n };\n};\n\nabstract class _ProtoClientQuery<T extends string, E> extends TQuery<T, E, boolean> {\n\n protected _proto: ProtoClient<E>;\n protected _opts: _QueryOptions;\n\n constructor(proto: ProtoClient<E>, opts: _QueryOptions) {\n super();\n this._proto = proto;\n this._opts = opts;\n }\n\n abstract get url(): string;\n abstract get className(): T | undefined;\n\n private _queryOptions({\n silent,\n }: RequestOptions<boolean> = {}) {\n return {\n className: this.className,\n relatedBy: this._opts.relatedBy,\n silent,\n ...this[PVK].options,\n } as any;\n }\n\n private _requestOpt({\n silent,\n ...opts\n }: RequestOptions<boolean> = {}) {\n return {\n method: 'post',\n url: this.url,\n serializeOpts: {\n objAttrs: TObject.defaultReadonlyKeys,\n },\n ...opts,\n };\n }\n\n explain(options?: RequestOptions<boolean>) {\n return this._proto[PVK].request(this._proto, {\n operation: 'explain',\n ...this._queryOptions(options),\n }, this._requestOpt(options));\n }\n\n count(options?: RequestOptions<boolean>) {\n return this._proto[PVK].request(this._proto, {\n operation: 'count',\n ...this._queryOptions(options),\n }, this._requestOpt(options)) as any;\n }\n\n find(options?: RequestOptions<boolean>) {\n const request = () => this._proto[PVK].request(this._proto, {\n operation: 'find',\n ...this._queryOptions(options),\n }, this._requestOpt(options)) as Promise<TObjectType<T, E>[]>;\n return asyncStream(request);\n }\n\n random(\n opts?: TQueryRandomOptions,\n options?: RequestOptions<boolean>\n ) {\n const request = () => this._proto[PVK].request(this._proto, {\n operation: 'random',\n random: opts,\n ...this._queryOptions(options),\n }, this._requestOpt(options)) as Promise<TObjectType<T, E>[]>;\n return asyncStream(request);\n }\n\n nonrefs(options?: RequestOptions<boolean>) {\n const request = () => this._proto[PVK].request(this._proto, {\n operation: 'nonrefs',\n ...this._queryOptions(options),\n }, this._requestOpt(options)) as Promise<TObjectType<T, E>[]>;\n return asyncStream(request);\n }\n\n insert(\n attrs: Record<string, TValueWithUndefined>,\n options?: RequestOptions<boolean>\n ) {\n return this._proto[PVK].request(this._proto, {\n operation: 'insert',\n attributes: attrs,\n ...this._queryOptions(options),\n }, this._requestOpt(options)) as any;\n }\n\n insertMany(\n values: Record<string, TValueWithUndefined>[],\n options?: RequestOptions<boolean>\n ) {\n return this._proto[PVK].request(this._proto, {\n operation: 'insertMany',\n attributes: values,\n ...this._queryOptions(options),\n }, this._requestOpt(options)) as any;\n }\n\n updateOne(\n update: Record<string, TUpdateOp>,\n options?: RequestOptions<boolean>\n ) {\n return this._proto[PVK].request(this._proto, {\n operation: 'updateOne',\n update,\n ...this._queryOptions(options),\n }, this._requestOpt(options)) as any;\n }\n\n updateMany(\n update: Record<string, TUpdateOp>,\n options?: RequestOptions<boolean>\n ) {\n return this._proto[PVK].request(this._proto, {\n operation: 'updateMany',\n update,\n ...this._queryOptions(options),\n }, this._requestOpt(options)) as any;\n }\n\n upsertOne(\n update: Record<string, TUpdateOp>,\n setOnInsert: Record<string, TValueWithUndefined>,\n options?: RequestOptions<boolean>\n ) {\n return this._proto[PVK].request(this._proto, {\n operation: 'upsertOne',\n update,\n setOnInsert,\n ...this._queryOptions(options),\n }, this._requestOpt(options)) as any;\n }\n\n upsertMany(\n update: Record<string, TUpdateOp>,\n setOnInsert: Record<string, TValueWithUndefined>,\n options?: RequestOptions<boolean>\n ) {\n return this._proto[PVK].request(this._proto, {\n operation: 'upsertMany',\n update,\n setOnInsert,\n ...this._queryOptions(options),\n }, this._requestOpt(options)) as any;\n }\n\n deleteOne(options?: RequestOptions<boolean>) {\n return this._proto[PVK].request(this._proto, {\n operation: 'deleteOne',\n ...this._queryOptions(options),\n }, this._requestOpt(options)) as any;\n }\n\n deleteMany(options?: RequestOptions<boolean>) {\n return this._proto[PVK].request(this._proto, {\n operation: 'deleteMany',\n ...this._queryOptions(options),\n }, this._requestOpt(options)) as any;\n }\n\n}\n\nexport class ProtoClientQuery<T extends string, E> extends _ProtoClientQuery<T, E> {\n\n private _className: T;\n\n constructor(className: T, proto: ProtoClient<E>, opts: _QueryOptions) {\n super(proto, opts);\n this._className = className;\n }\n\n get url(): string {\n return `classes/${encodeURIComponent(this.className)}`;\n }\n get className(): T {\n return this._className;\n }\n\n clone(options?: TQueryOptions) {\n const clone = new ProtoClientQuery(this.className, this._proto, this._opts);\n clone[PVK].options = options ?? { ...this[PVK].options };\n return clone;\n }\n\n subscribe() {\n return new LiveQuerySubscription<T, E>(\n this.className,\n this._proto,\n this[PVK].options.filter ?? [],\n );\n }\n}\nexport class ProtoClientRelationQuery<E> extends _ProtoClientQuery<string, E> {\n\n constructor(proto: ProtoClient<E>, opts: _QueryOptions) {\n super(proto, opts);\n }\n\n get url(): string {\n return `relation`;\n }\n get className(): undefined {\n return undefined;\n }\n\n clone(options?: TQueryOptions) {\n const clone = new ProtoClientRelationQuery(this._proto, this._opts);\n clone[PVK].options = options ?? { ...this[PVK].options };\n return clone;\n }\n\n subscribe(): LiveQuerySubscription<string, E> {\n throw Error('Unable to subscribe to relationship query');\n }\n}","//\n// request.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';\nimport {\n AUTH_COOKIE_KEY,\n MASTER_PASS_HEADER_NAME,\n MASTER_USER_HEADER_NAME,\n} from '../internals/const';\nimport { RequestOptions } from './options';\nimport { ProtoClientInternal } from './proto/internal';\nimport { ProtoType } from '../internals/proto';\nimport { AxiosOptions } from './proto/types';\nimport { XSRF_COOKIE_NAME, XSRF_HEADER_NAME } from '@o2ter/server-js/dist/const';\nimport { io, Socket } from 'socket.io-client';\nimport { TQuerySelector } from '../internals/query/types/selectors';\nimport { randomUUID } from '@o2ter/crypto-js';\nimport { deserialize } from '../internals/codec';\nimport { TObject } from '../internals/object';\n\nexport default class Service<Ext, P extends ProtoType<any>> {\n\n proto: ProtoClientInternal<Ext, P>;\n service: AxiosInstance;\n\n private token?: string;\n private sockets: Socket[] = [];\n\n private retryLimit?: number;\n\n constructor(proto: ProtoClientInternal<Ext, P>, { retryLimit, ...options }: AxiosOptions = {}) {\n this.proto = proto;\n this.service = axios.create({\n xsrfCookieName: XSRF_COOKIE_NAME,\n xsrfHeaderName: XSRF_HEADER_NAME,\n withCredentials: true,\n validateStatus: status => status >= 200 && status < 500,\n ...options,\n });\n this.retryLimit = retryLimit;\n }\n\n setSessionToken(token?: string) {\n this.token = token;\n if (typeof window === 'undefined') {\n this.service.defaults.headers.Cookie = token ? `${AUTH_COOKIE_KEY}=${token}` : null;\n }\n for (const socket of this.sockets) {\n socket.emit('auth', token);\n }\n }\n\n async _request<T extends unknown = any, D extends unknown = any>(config: RequestOptions<boolean> & AxiosRequestConfig<D>, retry = 0): Promise<AxiosResponse<T, D>> {\n\n const { master, abortSignal, serializeOpts, headers, ...opts } = config ?? {};\n\n const res = await this.service.request({\n signal: abortSignal,\n headers: {\n 'Content-Type': 'application/json; charset=utf-8',\n ...master ? {\n [MASTER_USER_HEADER_NAME]: this.proto.options.masterUser?.user,\n [MASTER_PASS_HEADER_NAME]: this.proto.options.masterUser?.pass,\n } : {},\n ...headers,\n },\n ...opts,\n });\n\n if (res.headers['set-cookie']) {\n const cookies = res.headers['set-cookie'];\n const pattern = `${AUTH_COOKIE_KEY}=`;\n const token = _.findLast(_.flatMap(cookies, x => x.split(';')), x => _.startsWith(x.trim(), pattern));\n this.setSessionToken(token?.trim().slice(pattern.length));\n }\n\n if (\n (this.retryLimit ? retry < this.retryLimit : true) &&\n _.includes([412, 429], res.status)\n ) {\n return this._request(config, retry + 1);\n }\n\n if (res.status !== 200) {\n let error: Error\n try {\n const _error = JSON.parse(res.data);\n error = new Error(_error.message, { cause: _error });\n } catch {\n error = new Error(res.data);\n }\n throw error;\n }\n\n return res;\n }\n\n async request<T extends unknown = any, D extends unknown = any>(config: RequestOptions<boolean> & AxiosRequestConfig<D>) {\n return this._request<T, D>(config);\n }\n\n socket() {\n const endpoint = this.proto.options.socketEndpoint;\n const options = { auth: { token: this.token } };\n const socket = endpoint ? io(endpoint, options) : io(options);\n\n this.sockets.push(socket);\n\n type QueryOpts = {\n event: string;\n className: string;\n filter: TQuerySelector[];\n };\n\n let events: Record<string, {\n callback: (payload: any) => void;\n selector?: TQuerySelector;\n }> = {};\n let queries: Record<string, {\n callback: (payload: any) => void;\n options: QueryOpts;\n }> = {};\n let destroyCallbacks: VoidFunction[] = [];\n\n const register_event = () => {\n socket.emit('EV_NOTIFY', _.mapValues(events, x => x.selector ?? true));\n };\n\n const register_query = () => {\n socket.emit('EV_LIVEQUERY', _.mapValues(queries, x => x.options));\n };\n\n const register = () => {\n register_event();\n register_query();\n };\n\n socket.on('ON_EV_NOTIFY', ({ ids, data }: any) => {\n const payload = deserialize(JSON.stringify(data));\n for (const [id, { callback }] of _.entries(events)) {\n if (_.includes(ids, id)) callback(payload);\n }\n });\n\n socket.on('ON_EV_LIVEQUERY', ({ ids, data }: any) => {\n const objects = deserialize(JSON.stringify(data)) as TObject[];\n for (const [id, { callback }] of _.entries(queries)) {\n const keys = _.keys(_.pickBy(ids, v => _.includes(v, id)));\n callback(_.filter(objects, x => _.includes(keys, x.objectId)));\n }\n });\n\n socket.on('connect', register);\n socket.on('reconnect', register);\n\n const destroy = () => {\n this.sockets = this.sockets.filter(x => x !== socket);\n socket.disconnect();\n for (const callback of destroyCallbacks) {\n callback();\n }\n };\n const destroyIfNeed = () => {\n if (!_.isEmpty(events)) return;\n if (!_.isEmpty(queries)) return;\n destroy();\n };\n\n return {\n socket,\n listen: (callback: (payload: any) => void, selector?: TQuerySelector) => {\n const id = randomUUID();\n events[id] = { callback, selector };\n register_event();\n return () => {\n events = _.omit(events, id);\n register_event();\n destroyIfNeed();\n };\n },\n liveQuery: (callback: (payload: any) => void, options: QueryOpts) => {\n const id = randomUUID();\n queries[id] = { callback, options };\n register_query();\n return () => {\n queries = _.omit(queries, id);\n register_query();\n destroyIfNeed();\n };\n },\n onDestroy: (callback: VoidFunction) => {\n destroyCallbacks.push(callback);\n },\n };\n }\n};\n","//\n// internal.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport Service from '../request';\nimport { RequestOptions } from '../options';\nimport { ProtoOptions } from './types';\nimport { TSchema } from '../../internals/schema';\nimport { asyncStream, base64ToBuffer, isBinaryData, isBlob, isReadableStream, iterableToStream } from '@o2ter/utils-js';\nimport { TSerializable, deserialize, serialize } from '../../internals/codec';\nimport { EventData, ProtoInternalType, ProtoType } from '../../internals/proto';\nimport { TObjectType } from '../../internals/object/types';\nimport { TUser } from '../../internals/object/user';\nimport { TValueWithoutObject } from '../../internals/types';\nimport { TFile } from '../../internals/object/file';\nimport { PVK } from '../../internals/private';\nimport { FileData } from '../../internals/buffer';\nimport { ExtraOptions } from '../../internals/options';\nimport { UPLOAD_TOKEN_HEADER_NAME } from '../../internals/const';\nimport { TObject } from '../../internals/object';\nimport { TQuerySelector } from '../../internals/query/types/selectors';\n\nexport class ProtoClientInternal<Ext, P extends ProtoType<any>> implements ProtoInternalType<Ext, P> {\n\n options: ProtoOptions<Ext>;\n service: Service<Ext, P>;\n\n socket?: ReturnType<Service<Ext, P>['socket']>;\n\n constructor(options: ProtoOptions<Ext>) {\n this.options = options;\n this.service = new Service(this, options.axiosOptions);\n }\n\n async request(\n proto: P,\n data?: TSerializable,\n options?: Parameters<Service<Ext, P>['request']>[0]\n ) {\n\n const { serializeOpts, ...opts } = options ?? {};\n\n const res = await this.service.request({\n baseURL: this.options.endpoint,\n data: serialize(data, serializeOpts),\n responseType: 'text',\n ...opts,\n });\n\n return proto.rebind(deserialize(res.data));\n }\n\n setSessionToken(proto: P, token?: string) {\n this.service.setSessionToken(token);\n }\n\n async sessionInfo(\n proto: P,\n options?: RequestOptions<boolean>\n ) {\n\n const { serializeOpts, ...opts } = options ?? {};\n\n const res = await this.service.request({\n method: 'get',\n baseURL: this.options.endpoint,\n url: 'sessionInfo',\n responseType: 'text',\n ...opts,\n });\n\n return proto.rebind(deserialize(res.data));\n }\n\n async currentUser(\n proto: P,\n options?: RequestOptions<boolean>\n ): Promise<TObjectType<'User', Ext> | undefined> {\n\n const { serializeOpts, ...opts } = options ?? {};\n\n const res = await this.service.request({\n method: 'get',\n baseURL: this.options.endpoint,\n url: 'user/me',\n responseType: 'text',\n ...opts,\n });\n\n const user = proto.rebind(deserialize(res.data)) as TObjectType<'User', Ext>;\n if (!_.isNil(user) && !(user instanceof TUser)) throw Error('Unknown error');\n\n return user ?? undefined;\n }\n\n async config(options?: RequestOptions<boolean>) {\n\n const { serializeOpts, ...opts } = options ?? {};\n\n const res = await this.service.request({\n method: 'get',\n baseURL: this.options.endpoint,\n url: 'config',\n responseType: 'text',\n ...opts,\n });\n\n return deserialize(res.data) as Record<string, TValueWithoutObject>;\n }\n async configAcl(options: RequestOptions<boolean>) {\n\n const { serializeOpts, ...opts } = options ?? {};\n\n const res = await this.service.request({\n method: 'get',\n baseURL: this.options.endpoint,\n url: 'configAcl',\n responseType: 'text',\n ...opts,\n });\n\n return deserialize(res.data) as Record<string, string[]>;\n }\n async setConfig(values: Record<string, TValueWithoutObject>, options: RequestOptions<boolean> & { acl?: string[]; }) {\n\n const { serializeOpts, acl, ...opts } = options ?? {};\n\n await this.service.request({\n method: 'post',\n baseURL: this.options.endpoint,\n url: 'config',\n data: serialize({ values, acl }, serializeOpts),\n responseType: 'text',\n ...opts,\n });\n }\n\n async logout(options?: RequestOptions<boolean>) {\n\n const { serializeOpts, ...opts } = options ?? {};\n\n await this.service.request({\n method: 'post',\n baseURL: this.options.endpoint,\n url: 'user/logout',\n responseType: 'text',\n ...opts,\n });\n }\n\n async setPassword(user: TUser, password: string, options: RequestOptions<true>) {\n\n if (!user.objectId) throw Error('Invalid user');\n if (_.isEmpty(password)) throw Error('Invalid password');\n\n const { serializeOpts, ...opts } = options ?? {};\n\n await this.service.request({\n method: 'post',\n baseURL: this.options.endpoint,\n url: `user/${user.objectId}/password`,\n data: serialize({ password }, serializeOpts),\n responseType: 'text',\n ...opts,\n });\n }\n\n async unsetPassword(user: TUser, options: RequestOptions<true>) {\n\n if (!user.objectId) throw Error('Invalid user');\n\n const { serializeOpts, ...opts } = options ?? {};\n\n await this.service.request({\n method: 'post',\n baseURL: this.options.endpoint,\n url: `user/${user.objectId}/password`,\n responseType: 'text',\n ...opts,\n });\n }\n\n async schema(options: RequestOptions<true>): Promise<Record<string, TSchema>> {\n\n const { serializeOpts, ...opts } = options ?? {};\n\n const res = await this.service.request({\n method: 'get',\n baseURL: this.options.endpoint,\n url: 'schema',\n responseType: 'text',\n ...opts,\n });\n\n return deserialize(res.data) as any;\n }\n\n async updateFile(proto: P, object: TFile, options?: RequestOptions<boolean>) {\n\n const updated = await proto.Query(object.className)\n .equalTo('_id', object.objectId)\n .includes(...object.keys())\n .updateOne(object[PVK].mutated, options);\n\n if (updated) {\n object[PVK].attributes = updated.attributes;\n object[PVK].mutated = {};\n object[PVK].extra = {};\n }\n\n return object;\n }\n\n async createFile(proto: P, object: TFile, options?: RequestOptions<boolean> & { uploadToken?: string; }) {\n\n const { serializeOpts, uploadToken, ...opts } = options ?? {};\n const { data } = object[PVK].extra;\n if (_.isNil(data)) throw Error('Invalid file object');\n\n let buffer: FileData;\n\n if (_.isString(data) || isBinaryData(data) || isReadableStream(data) || isBlob(data)) {\n buffer = data;\n } else if ('base64' in data) {\n buffer = base64ToBuffer(data.base64);\n } else {\n throw Error('Invalid file object');\n }\n\n const res = await this.service.request({\n method: 'post',\n baseURL: this.options.endpoint,\n url: 'files',\n responseType: 'text',\n data: {\n attributes: serialize(_.fromPairs([...object._set_entries()]), serializeOpts),\n file: buffer,\n },\n headers: {\n 'Content-Type': 'multipart/form-data',\n [UPLOAD_TOKEN_HEADER_NAME]: uploadToken,\n },\n ...opts,\n });\n\n const created = deserialize(res.data);\n if (!_.isNil(created) && !(created instanceof TFile)) throw Error('Unknown error');\n\n if (created) {\n object[PVK].attributes = created.attributes;\n object[PVK].mutated = {};\n object[PVK].extra = {};\n }\n\n return object;\n }\n\n async saveFile(proto: P, object: TFile, options?: RequestOptions<boolean>) {\n return object.objectId ? this.updateFile(proto, object, options) : this.createFile(proto, object, options);\n }\n\n async deleteFile(proto: P, object: TFile, options?: ExtraOptions<boolean>) {\n\n const deleted = await proto.Query(object.className)\n .equalTo('_id', object.objectId)\n .deleteOne(options);\n\n if (deleted) {\n object[PVK].attributes = deleted.attributes;\n object[PVK].mutated = {};\n object[PVK].extra = {};\n }\n\n return object;\n }\n\n fileData(proto: P, object: TFile, options?: RequestOptions<boolean>) {\n\n const { serializeOpts, ...opts } = options ?? {};\n\n const filename = object.filename;\n if (_.isNil(filename)) throw Error('Invalid filename');\n\n return iterableToStream(async () => {\n const res = await this.service.request({\n method: 'get',\n baseURL: this.options.endpoint,\n url: `files/${object.objectId}/${encodeURIComponent(filename)}`,\n responseType: 'stream',\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n ...opts,\n });\n\n if (Symbol.asyncIterator in res.data) {\n return res.data;\n } else {\n throw Error('Unknown stream type');\n }\n });\n }\n\n async notify(\n proto: P,\n data: Record<string, TValueWithoutObject> & { _rperm?: string[]; },\n options?: RequestOptions<boolean>\n ) {\n\n const { serializeOpts, ...opts } = options ?? {};\n\n await this.service.request({\n method: 'post',\n baseURL: this.options.endpoint,\n url: 'notify',\n data: serialize(data, serializeOpts),\n responseType: 'text',\n ...opts,\n });\n }\n\n listen(proto: P, callback: (data: EventData) => void, selector?: TQuerySelector) {\n const _socket = this.socket ?? this.service.socket();\n const { socket, listen, onDestroy } = _socket;\n if (_.isNil(this.socket)) {\n this.socket = _socket;\n onDestroy(() => { this.socket = undefined; });\n }\n return {\n socket,\n remove: listen((payload) => {\n callback(payload);\n }, selector),\n };\n }\n\n liveQuery(\n proto: P,\n event: string,\n className: string,\n filter: TQuerySelector[],\n callback: (object: TObject) => void,\n ) {\n const _socket = this.socket ?? this.service.socket();\n const { socket, liveQuery, onDestroy } = _socket;\n if (_.isNil(this.socket)) {\n this.socket = _socket;\n onDestroy(() => { this.socket = undefined; });\n }\n return {\n socket,\n remove: liveQuery((objects) => {\n for (const object of proto.rebind(objects)) {\n (async () => {\n try {\n await callback(object);\n } catch (e) {\n proto.logger.error(e);\n }\n })();\n }\n }, { event, className, filter }),\n };\n }\n\n refs(proto: P, object: TObject, options?: RequestOptions<boolean>) {\n if (!object.objectId) throw Error('Invalid object');\n const request = async () => {\n const { serializeOpts, ...opts } = options ?? {};\n const res = await this.service.request({\n method: 'get',\n baseURL: this.options.endpoint,\n url: `classes/${encodeURIComponent(object.className)}/${object.objectId}/refs`,\n serializeOpts: {\n objAttrs: TObject.defaultReadonlyKeys,\n },\n responseType: 'text',\n ...opts,\n });\n return proto.rebind(deserialize(res.data)) as TObjectType<string, Ext>[];\n }\n return asyncStream(request);\n }\n}\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { ProtoClientQuery, ProtoClientRelationQuery } from '../query';\nimport { RequestOptions } from '../options';\nimport { ProtoClientInternal } from './internal';\nimport { ProtoOptions } from './types';\nimport { TSerializable } from '../../internals/codec';\nimport { EventData, ProtoType } from '../../internals/proto';\nimport { TQuery } from '../../internals/query';\nimport { PVK } from '../../internals/private';\nimport { TValueWithoutObject } from '../../internals/types';\nimport { TUser } from '../../internals/object/user';\nimport { TObject } from '../../internals/object';\nimport { PathName } from '../../internals/query/types';\nimport { TQuerySelector } from '../../internals/query/types/selectors';\n\nexport class ProtoClient<Ext = any> extends ProtoType<Ext> {\n\n /** @internal */\n [PVK]: ProtoClientInternal<Ext, this>;\n\n constructor(options: ProtoOptions<Ext>) {\n super();\n this[PVK] = new ProtoClientInternal({ ...options });\n }\n\n Query<T extends string>(className: T): TQuery<T, Ext, boolean> {\n return new ProtoClientQuery<T, Ext>(className, this, {});\n }\n\n Relation<T extends string>(object: TObject, key: PathName<T>): TQuery<string, Ext, boolean> {\n const objectId = object.objectId;\n if (!objectId) throw Error('Invalid object');\n return new ProtoClientRelationQuery<Ext>(this, {\n relatedBy: {\n className: object.className,\n objectId,\n key,\n },\n });\n }\n\n config(options?: RequestOptions<boolean>): Promise<Record<string, TValueWithoutObject>> {\n return this[PVK].config(options);\n }\n configAcl(options: RequestOptions<true>) {\n if (options.master !== true) throw Error('No permission');\n return this[PVK].configAcl(options);\n }\n async setConfig(values: Record<string, TValueWithoutObject>, options: RequestOptions<true> & { acl?: string[]; }) {\n if (options.master !== true) throw Error('No permission');\n await this[PVK].setConfig(values, options);\n }\n\n run(\n name: string,\n data?: TSerializable,\n options?: RequestOptions<boolean>\n ): Promise<void | TSerializable> {\n return this[PVK].request(this, data, {\n method: 'post',\n url: `functions/${encodeURIComponent(name)}`,\n ...(options ?? {})\n });\n }\n\n scheduleJob(\n name: string,\n data?: TValueWithoutObject,\n options?: RequestOptions<boolean>\n ) {\n return this[PVK].request(this, data, {\n method: 'post',\n url: `jobs/${encodeURIComponent(name)}`,\n ...(options ?? {})\n }) as any;\n }\n\n setSessionToken(token?: string) {\n this[PVK].setSessionToken(this, token);\n }\n\n sessionInfo(options?: RequestOptions<boolean>) {\n return this[PVK].sessionInfo(this, options);\n }\n\n currentUser(options?: RequestOptions<boolean>) {\n return this[PVK].currentUser(this, options);\n }\n\n logout(options?: RequestOptions<boolean>) {\n return this[PVK].logout(options);\n }\n\n setPassword(user: TUser, password: string, options: RequestOptions<true>) {\n return this[PVK].setPassword(user, password, options);\n }\n\n unsetPassword(user: TUser, options: RequestOptions<true>) {\n return this[PVK].unsetPassword(user, options);\n }\n\n schema(options: RequestOptions<true>) {\n return this[PVK].schema(options);\n }\n\n notify(data: Record<string, TValueWithoutObject> & { _rperm?: string[]; }, options?: RequestOptions<boolean>) {\n return this[PVK].notify(this, data, options);\n }\n\n listen(\n callback: (data: EventData) => void,\n selector?: TQuerySelector\n ) {\n return this[PVK].listen(this, callback, selector);\n }\n\n refs(object: TObject, options?: RequestOptions<boolean>) {\n return this[PVK].refs(this, object, options);\n }\n}\n"],"names":["PVK","EventIterator","TObject","Decimal","prototypes","decodeUpdateOp","asyncStream","XSRF_COOKIE_NAME","XSRF_HEADER_NAME","AUTH_COOKIE_KEY","MASTER_USER_HEADER_NAME","MASTER_PASS_HEADER_NAME","io","randomUUID","isBinaryData","isReadableStream","isBlob","base64ToBuffer","UPLOAD_TOKEN_HEADER_NAME","iterableToStream"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA4DA,MAAM,SAAS,GAAG,CAAC,GAAsB,EAAE,GAAsB,KAAuB;IACtF,OAAO;AACL,QAAA,GAAG,GAAG;AACN,QAAA,GAAG,GAAG;AACN,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,CAAC,CAAC,SAAS,CAAiB,GAAG,CAAC,MAAM,CAAC;AAC1C,YAAA,GAAG,CAAC,CAAC,SAAS,CAAiB,GAAG,CAAC,MAAM;AAC1C,SAAA;AACD,QAAA,OAAO,EAAE;YACP,GAAG,GAAG,CAAC,OAAO;AACd,YAAA,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,G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