proto.io 0.0.148 → 0.0.149
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.
- package/dist/adapters/file/database.d.ts +2 -2
- package/dist/adapters/file/database.js +2 -2
- package/dist/adapters/file/database.mjs +2 -2
- package/dist/adapters/file/filesystem.d.ts +2 -2
- package/dist/adapters/file/google-cloud-storage.d.ts +2 -2
- package/dist/adapters/storage/progres.d.ts +3 -1
- package/dist/adapters/storage/progres.js +6 -3
- package/dist/adapters/storage/progres.js.map +1 -1
- package/dist/adapters/storage/progres.mjs +6 -3
- package/dist/adapters/storage/progres.mjs.map +1 -1
- package/dist/client.d.ts +3 -5
- package/dist/client.js +2 -2
- package/dist/client.mjs +3 -3
- package/dist/index.d.ts +3 -5
- package/dist/index.js +53 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -21
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{index-EOtjV6U_.mjs → index-BmRuvHVZ.mjs} +11 -1
- package/dist/internals/index-BmRuvHVZ.mjs.map +1 -0
- package/dist/internals/index-BqFdBhFc.js.map +1 -1
- package/dist/internals/{index-D4VXQ1FB.d.ts → index-BuXVzVd8.d.ts} +3 -2
- package/dist/internals/index-BuXVzVd8.d.ts.map +1 -0
- package/dist/internals/index-CKgKjs8z.d.ts +60 -0
- package/dist/internals/index-CKgKjs8z.d.ts.map +1 -0
- package/dist/internals/{index-DZS2c96L.js → index-CSNRyhjB.js} +2 -2
- package/dist/internals/{index-DZS2c96L.js.map → index-CSNRyhjB.js.map} +1 -1
- package/dist/internals/{index-C6zdNpc_.js → index-CVutVPmd.js} +11 -1
- package/dist/internals/{index-C6zdNpc_.js.map → index-CVutVPmd.js.map} +1 -1
- package/dist/internals/{index-tNCIyuCp.js → index-D1YGwuNK.js} +8 -4
- package/dist/internals/index-D1YGwuNK.js.map +1 -0
- package/dist/internals/{index-CvfRsxEZ.d.ts → index-DnREUbmG.d.ts} +4 -78
- package/dist/internals/index-DnREUbmG.d.ts.map +1 -0
- package/dist/internals/index-be1VYBY2.mjs.map +1 -1
- package/dist/internals/{index-DGau0Wqf.mjs → index-c-CaNuVY.mjs} +8 -4
- package/dist/internals/index-c-CaNuVY.mjs.map +1 -0
- package/dist/internals/{index-DTZ5uRgF.mjs → index-tU-lsQqj.mjs} +2 -2
- package/dist/internals/{index-DTZ5uRgF.mjs.map → index-tU-lsQqj.mjs.map} +1 -1
- package/dist/internals/{random-XGNkddOu.js → random-DBDmz54D.js} +3 -3
- package/dist/internals/{random-XGNkddOu.js.map → random-DBDmz54D.js.map} +1 -1
- package/dist/internals/{random-BjV_01xP.mjs → random-KZTFMK9-.mjs} +3 -3
- package/dist/internals/{random-BjV_01xP.mjs.map → random-KZTFMK9-.mjs.map} +1 -1
- package/package.json +2 -2
- package/dist/internals/index-BAB_APmb.d.ts +0 -116
- package/dist/internals/index-BAB_APmb.d.ts.map +0 -1
- package/dist/internals/index-CvfRsxEZ.d.ts.map +0 -1
- package/dist/internals/index-D4VXQ1FB.d.ts.map +0 -1
- package/dist/internals/index-DGau0Wqf.mjs.map +0 -1
- package/dist/internals/index-EOtjV6U_.mjs.map +0 -1
- package/dist/internals/index-tNCIyuCp.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-CVutVPmd.js');
|
|
4
4
|
var _ = require('lodash');
|
|
5
5
|
var Decimal = require('decimal.js');
|
|
6
6
|
var utilsJs = require('@o2ter/utils-js');
|
|
@@ -48,6 +48,7 @@ const mergeOpts = (lhs, rhs) => {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
class TQueryFilterBase {
|
|
51
|
+
/** @internal */
|
|
51
52
|
[_private.PVK] = { options: {} };
|
|
52
53
|
filter(filter) {
|
|
53
54
|
if (_.isNil(this[_private.PVK].options.filter)) {
|
|
@@ -158,6 +159,7 @@ class TQueryFilterBase {
|
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
161
|
class TQueryBase extends TQueryFilterBase {
|
|
162
|
+
/** @internal */
|
|
161
163
|
[_private.PVK] = { options: {} };
|
|
162
164
|
sort(sort) {
|
|
163
165
|
this[_private.PVK].options.sort = sort;
|
|
@@ -218,6 +220,7 @@ class TQueryBase extends TQueryFilterBase {
|
|
|
218
220
|
// THE SOFTWARE.
|
|
219
221
|
//
|
|
220
222
|
class TQuery extends TQueryBase {
|
|
223
|
+
/** @internal */
|
|
221
224
|
[_private.PVK];
|
|
222
225
|
constructor(className, options = {}) {
|
|
223
226
|
super();
|
|
@@ -605,7 +608,7 @@ const applyObjectMethods = (object, proto) => {
|
|
|
605
608
|
else {
|
|
606
609
|
const created = await query()
|
|
607
610
|
.includes(...this.keys())
|
|
608
|
-
.insert(_.fromPairs([...this.
|
|
611
|
+
.insert(_.fromPairs([...this._set_entries()]), options);
|
|
609
612
|
this[_private.PVK].attributes = created.attributes;
|
|
610
613
|
this[_private.PVK].mutated = {};
|
|
611
614
|
}
|
|
@@ -1295,7 +1298,7 @@ class ProtoClientInternal {
|
|
|
1295
1298
|
url: 'files',
|
|
1296
1299
|
responseType: 'text',
|
|
1297
1300
|
data: {
|
|
1298
|
-
attributes: serialize(_.fromPairs([...object.
|
|
1301
|
+
attributes: serialize(_.fromPairs([...object._set_entries()]), serializeOpts),
|
|
1299
1302
|
file: buffer,
|
|
1300
1303
|
},
|
|
1301
1304
|
headers: {
|
|
@@ -1422,6 +1425,7 @@ class ProtoClientInternal {
|
|
|
1422
1425
|
// THE SOFTWARE.
|
|
1423
1426
|
//
|
|
1424
1427
|
class ProtoClient extends ProtoType {
|
|
1428
|
+
/** @internal */
|
|
1425
1429
|
[_private.PVK];
|
|
1426
1430
|
constructor(options) {
|
|
1427
1431
|
super();
|
|
@@ -1498,4 +1502,4 @@ exports.isQuery = isQuery;
|
|
|
1498
1502
|
exports.isRole = isRole;
|
|
1499
1503
|
exports.isUser = isUser;
|
|
1500
1504
|
exports.serialize = serialize;
|
|
1501
|
-
//# sourceMappingURL=index-
|
|
1505
|
+
//# sourceMappingURL=index-D1YGwuNK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-D1YGwuNK.js","sources":["../../../src/internals/query/base.ts","../../../src/internals/query/index.ts","../../../src/internals/const.ts","../../../src/internals/object/user.ts","../../../src/internals/object/role.ts","../../../src/internals/object/file.ts","../../../src/internals/object/types.ts","../../../src/internals/utils.ts","../../../src/internals/object/methods.ts","../../../src/internals/proto/index.ts","../../../src/common/codec.ts","../../../src/common/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 - 2024 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 } from './types';\nimport { TQuerySelector } from './types/selectors';\nimport { TValue } from '../types';\nimport { PVK } from '../private';\nimport { TExpression } from './types/expressions';\n\ninterface TQueryFilterBaseOptions {\n filter?: TQuerySelector | TQuerySelector[];\n};\n\nexport type TSortOption = {\n expr: TExpression;\n order: 1 | -1;\n};\n\nexport interface TQueryBaseOptions extends TQueryFilterBaseOptions {\n sort?: Record<string, 1 | -1> | TSortOption[];\n skip?: number;\n limit?: number;\n matches?: Record<string, TQueryBaseOptions>;\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 };\n}\n\nclass TQueryFilterBase {\n\n /** @internal */\n [PVK]: { options: TQueryFilterBaseOptions; } = { options: {} };\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 equalTo<T extends string>(key: PathName<T>, value: TValue | undefined) {\n return this.filter({ [key]: { $eq: value ?? null } });\n }\n\n notEqualTo<T extends string>(key: PathName<T>, value: TValue | undefined) {\n return this.filter({ [key]: { $ne: value ?? null } });\n }\n\n lessThan<T extends string>(key: PathName<T>, value: TValue | undefined) {\n return this.filter({ [key]: { $lt: value ?? null } });\n }\n\n greaterThan<T extends string>(key: PathName<T>, value: TValue | undefined) {\n return this.filter({ [key]: { $gt: value ?? null } });\n }\n\n lessThanOrEqualTo<T extends string>(key: PathName<T>, value: TValue | undefined) {\n return this.filter({ [key]: { $lte: value ?? null } });\n }\n\n greaterThanOrEqualTo<T extends string>(key: PathName<T>, value: TValue | undefined) {\n return this.filter({ [key]: { $gte: value ?? null } });\n }\n\n pattern<T extends string>(key: PathName<T>, value: RegExp | string) {\n return this.filter({ [key]: { $pattern: value ?? null } });\n }\n\n startsWith<T extends string>(key: PathName<T>, value: string) {\n return this.filter({ [key]: { $starts: value ?? null } });\n }\n\n endsWith<T extends string>(key: PathName<T>, value: string) {\n return this.filter({ [key]: { $ends: value ?? null } });\n }\n\n size<T extends string>(key: PathName<T>, value: number) {\n return this.filter({ [key]: { $size: value } });\n }\n\n empty<T extends string>(key: PathName<T>) {\n return this.filter({ [key]: { $empty: true } });\n }\n\n notEmpty<T extends string>(key: PathName<T>) {\n return this.filter({ [key]: { $empty: false } });\n }\n\n containsIn<T extends string>(key: PathName<T>, value: TValue[]) {\n return this.filter({ [key]: { $in: value } });\n }\n\n notContainsIn<T extends string>(key: PathName<T>, value: TValue[]) {\n return this.filter({ [key]: { $nin: value } });\n }\n\n isSubset<T extends string>(key: PathName<T>, value: TValue[]) {\n return this.filter({ [key]: { $subset: value } });\n }\n\n isSuperset<T extends string>(key: PathName<T>, value: TValue[]) {\n return this.filter({ [key]: { $superset: value } });\n }\n\n isDisjoint<T extends string>(key: PathName<T>, value: TValue[]) {\n return this.filter({ [key]: { $disjoint: value } });\n }\n\n isIntersect<T extends string>(key: PathName<T>, value: TValue[]) {\n return this.filter({ [key]: { $intersect: value } });\n }\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 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 and(...callbacks: ((query: TQueryFilterBase) => void)[]) {\n return this.filter({\n $and: _.flatMap(callbacks, callback => {\n const query = new TQueryFilterBase();\n callback(query);\n return _.castArray<TQuerySelector>(query[PVK].options.filter);\n }),\n });\n }\n\n or(...callbacks: ((query: TQueryFilterBase) => void)[]) {\n return this.filter({\n $or: _.map(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 nor(...callbacks: ((query: TQueryFilterBase) => void)[]) {\n return this.filter({\n $nor: _.map(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 sort<T extends Record<string, 1 | -1>>(sort: PathNameMap<T> | TSortOption[]) {\n this[PVK].options.sort = sort;\n return this;\n }\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 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 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// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 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 { TValue } from '../types';\nimport { PVK } from '../private';\nimport { TObjectType } from '../object/types';\nimport { TQueryBase, TQueryBaseOptions } from './base';\nimport { TUpdateOp } from '../object/types';\nimport { ProtoType } from '../proto';\nimport { ExtraOptions } from '../options';\nimport { asyncStream, Awaitable } from '@o2ter/utils-js';\n\nexport interface TQueryOptions extends TQueryBaseOptions {\n includes?: string[];\n};\n\nexport interface TQueryRandomOptions {\n weight?: string;\n};\n\nexport abstract class TQuery<\n T extends string, Ext,\n M extends boolean,\n P extends ProtoType<any>\n> extends TQueryBase {\n\n /** @internal */\n [PVK]: {\n className: T;\n options: TQueryOptions;\n }\n\n constructor(className: T, options: TQueryOptions = {}) {\n super();\n this[PVK] = {\n className,\n options,\n };\n }\n\n get className(): T {\n return this[PVK].className;\n }\n\n abstract clone(options?: TQueryOptions): TQuery<T, Ext, M, P>;\n abstract explain(options?: ExtraOptions<M, P>): PromiseLike<any>;\n abstract count(options?: ExtraOptions<M, P>): PromiseLike<number>;\n abstract find(options?: ExtraOptions<M, P>): ReturnType<typeof asyncStream<TObjectType<T, Ext>>>;\n abstract random(\n opts?: TQueryRandomOptions,\n options?: ExtraOptions<M, P>\n ): ReturnType<typeof asyncStream<TObjectType<T, Ext>>>;\n abstract nonrefs(options?: ExtraOptions<M, P>): ReturnType<typeof asyncStream<TObjectType<T, Ext>>>;\n abstract insert(\n attrs: Record<string, TValue>,\n options?: ExtraOptions<M, P>\n ): PromiseLike<TObjectType<T, Ext>>;\n abstract insertMany(\n values: Record<string, TValue>[],\n options?: ExtraOptions<M, P>\n ): PromiseLike<number>;\n abstract updateOne(\n update: Record<string, TUpdateOp>,\n options?: ExtraOptions<M, P>\n ): PromiseLike<TObjectType<T, Ext> | undefined>;\n abstract upsertOne(\n update: Record<string, TUpdateOp>,\n setOnInsert: Record<string, TValue>,\n options?: ExtraOptions<M, P>\n ): PromiseLike<TObjectType<T, Ext>>;\n abstract deleteOne(options?: ExtraOptions<M, P>): PromiseLike<TObjectType<T, Ext> | undefined>;\n abstract deleteMany(options?: ExtraOptions<M, P>): PromiseLike<number>;\n\n includes<T extends string[]>(...includes: IncludePaths<T>) {\n this[PVK].options.includes = this[PVK].options.includes ? [...this[PVK].options.includes, ...includes] : includes;\n return this;\n }\n\n async get(id: string, options?: ExtraOptions<M, P>) {\n return _.first(await this.clone().equalTo('_id', id).limit(1).find(options));\n }\n\n async first(options?: ExtraOptions<M, P>) {\n return _.first(await this.clone().limit(1).find(options));\n }\n\n async randomOne(opts?: TQueryRandomOptions, options?: ExtraOptions<M, P>) {\n return _.first(await this.clone().limit(1).random(opts, options));\n }\n\n async exists(options?: ExtraOptions<M, P>) {\n const query = this.clone();\n this[PVK].options.includes = [];\n return !_.isNil(await query.limit(1).find(options));\n }\n\n async eachBatch(\n callback: (batch: TObjectType<T, Ext>[]) => Awaitable<void>,\n options?: ExtraOptions<M, P> & { 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 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 async each(\n callback: (object: TObjectType<T, Ext>) => Awaitable<void>,\n options?: ExtraOptions<M, P> & { 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// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 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\nexport const MASTER_USER_HEADER_NAME = 'X-PROTO-MASTER-USER';\nexport const MASTER_PASS_HEADER_NAME = 'X-PROTO-MASTER-PASS';\n\nexport const UPLOAD_TOKEN_HEADER_NAME = 'X-PROTO-UPLOAD-TOKEN';\n\nexport const AUTH_COOKIE_KEY = 'x-proto-auth';\n","//\n// user.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 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 - 2024 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\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 get name(): string | undefined {\n return this.get('name');\n }\n\n get users(): TUser[] {\n return this.get('users') ?? [];\n }\n\n set users(value: TUser[]) {\n this.set('users', value);\n }\n\n get roles(): TRole[] {\n return this.get('roles') ?? [];\n }\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 - 2024 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';\nimport { ProtoType } from '../proto';\n\nexport interface TFile {\n url: string | undefined;\n fileData(options?: ExtraOptions<boolean, ProtoType<any>>): FileStream;\n save(options?: ExtraOptions<boolean, ProtoType<any>> & {\n cascadeSave?: boolean;\n uploadToken?: string;\n }): PromiseLike<this>;\n}\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 get filename(): string | undefined {\n return this.get('filename');\n }\n\n get size(): number | undefined {\n return this.get('size');\n }\n\n get type(): string | undefined {\n return this.get('type');\n }\n\n get token(): string | undefined {\n return this.get('token');\n }\n\n}\n","//\n// types.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 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 { TValue } from '../types';\nimport { ExactOneProp } from '../types';\n\nexport const TObjectTypes = {\n 'User': TUser,\n 'Role': TRole,\n 'File': TFile,\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 : {};\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], TValue>>;\n","//\n// utils.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 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';\n\nexport const isObjKey = <T extends object>(key: PropertyKey, obj: T): key is keyof T => key in obj;\n","//\n// methods.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 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 '../../common/codec';\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, ProtoType<E>>) {\n return proto[PVK].saveFile(proto, this as TFile, options);\n },\n },\n destroy: {\n value(options?: ExtraOptions<boolean, ProtoType<E>>) {\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, ProtoType<E>>) {\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 fetchWithInclude: {\n async value(keys: string[], options?: ExtraOptions<boolean, ProtoType<E>>) {\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, ProtoType<E>> & { 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, ProtoType<E>>) {\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 - 2024 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, _TValue } from '../types';\nimport { TObject } from '../object';\nimport { TSerializable } from '../../common/codec';\nimport { TUser } from '../object/user';\nimport { ProtoFunction, ProtoFunctionOptions, ProtoTrigger } from './types';\nimport { Socket } from 'socket.io-client';\nimport { Session } from '../../server/proto/session';\nimport { asyncStream } from '@o2ter/utils-js';\n\nexport type TransactionMode = 'default' | 'committed' | 'repeatable' | 'serializable';\n\nexport type TransactionOptions = {\n mode?: TransactionMode;\n retry?: number | boolean;\n};\n\nexport type EventData = Record<string, _TValue> & {\n _id: string,\n _created_at: Date,\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, P>): Promise<TFile>;\n deleteFile(proto: P, object: TFile, options?: ExtraOptions<boolean, P>): Promise<TFile>;\n\n fileData(proto: P, object: TFile, options?: ExtraOptions<boolean, P>): FileStream;\n}\n\nexport abstract class ProtoType<Ext> {\n\n /** @internal */\n abstract [PVK]: ProtoInternalType<Ext, this>;\n\n abstract config(options?: { master?: boolean; }): Promise<Record<string, _TValue>>;\n abstract configAcl(options: { master: true; }): PromiseLike<Record<string, string[]>>;\n abstract setConfig(values: Record<string, _TValue>, options: { master: true; acl?: string[]; }): Promise<void>;\n\n abstract run(name: string, data?: TSerializable, options?: ExtraOptions<boolean, this>): Promise<void | TSerializable>\n abstract Query<T extends string>(className: T): TQuery<T, Ext, boolean, this>;\n\n abstract refs(object: TObject, options?: ExtraOptions<boolean, this>): ReturnType<typeof asyncStream<TObjectType<string, Ext>>>;\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 rebind<T extends TSerializable | undefined>(object: T): T {\n return applyObjectMethods(object, this);\n }\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 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 async userRoles(user: TUser) {\n let queue = await this.Query('Role')\n .isIntersect('users', [user])\n .includes('users', 'name')\n .find({ master: true });\n let roles = queue;\n while (!_.isEmpty(queue)) {\n queue = await this.Query('Role')\n .isIntersect('roles', queue)\n .notContainsIn('_id', _.compact(_.map(roles, x => x.objectId)))\n .includes('roles', 'name')\n .find({ master: true });\n roles = _.uniqBy([...roles, ...queue], x => x.objectId);\n }\n return roles;\n }\n\n abstract notify(\n data: Record<string, _TValue> & { _rperm?: string[]; },\n options?: ExtraOptions<boolean, this>\n ): Promise<void>\n\n abstract listen(callback: (data: EventData) => void): {\n remove: VoidFunction;\n socket?: Socket;\n }\n};\n\nexport interface ProtoType<Ext> {\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 connectWithSessionToken<T extends object>(\n token: string,\n attrs?: T | ((x: this & { session?: Session; }) => T)\n ): Promise<this & { session?: Session; } & T>\n\n setSessionToken(token?: string): 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 logoutUser(\n req: Request,\n options?: {\n cookieOptions?: CookieOptions | undefined;\n jwtSignOptions?: SignOptions | undefined;\n }\n ): Promise<void>;\n\n varifyPassword(user: TUser, password: string, options: ExtraOptions<true, this>): Promise<boolean>;\n setPassword(user: TUser, password: string, options: ExtraOptions<true, this>): Promise<void>;\n unsetPassword(user: TUser, options: ExtraOptions<true, this>): Promise<void>;\n\n define(\n name: string,\n callback: ProtoFunction<Ext>,\n options?: Omit<ProtoFunctionOptions<Ext>, 'callback'>,\n ): void;\n\n beforeSave<T extends string>(name: T, callback: ProtoTrigger<T, Ext>): void;\n afterSave<T extends string>(name: T, callback: ProtoTrigger<T, Ext>): void;\n beforeDelete<T extends string>(name: T, callback: ProtoTrigger<T, Ext>): void;\n afterDelete<T extends string>(name: T, callback: ProtoTrigger<T, Ext>): void;\n\n lockTable(className: string | string[], update: boolean): void;\n\n withTransaction<T>(\n callback: (connection: ProtoType<Ext>) => PromiseLike<T>,\n options?: TransactionOptions,\n ): void;\n\n generateUploadToken(\n options?: { maxUploadSize?: number; }\n ): string;\n\n jwtSign(payload: any, options: jwt.SignOptions): string;\n jwtVarify(token: string, options?: jwt.VerifyOptions): jwt.JwtPayload | undefined;\n};\n","//\n// codec.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 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 '../internals/object';\nimport { TObjectTypes } from '../internals/object/types';\nimport { isObjKey } from '../internals/utils';\nimport { TValue } from '../internals/types';\n\nexport { Decimal };\ntype TNumber = number | Decimal | BigInt;\ntype TPrimitive = Date | string | TNumber | boolean | null | undefined;\ntype TDictionary = { [x: string]: TSerializable };\nexport type TSerializable = TDictionary | TSerializable[] | 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 (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 return _.transform(x, (r, v, k) => {\n r[k.startsWith('$') ? `$${k}` : k] = encodeEJSON(v, [...stack, x], options);\n }, {} as TDictionary);\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.$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 TDictionary);\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// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 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 '../internals/object';\nimport { TFile } from '../internals/object/file';\nimport { TRole } from '../internals/object/role';\nimport { TExtensions } from '../internals/object/types';\nimport { TUser } from '../internals/object/user';\nimport { TQuery } from '../internals/query';\n\nexport * from './codec';\nexport const classExtends = <E = {}>(x: TExtensions<E>) => x;\n\nexport const isQuery = (x: any): x is TQuery<any, 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","//\n// query.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 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 } from '../internals/types';\n\nexport class ProtoClientQuery<T extends string, E> extends TQuery<T, E, boolean, ProtoClient<E>> {\n\n private _proto: ProtoClient<E>;\n\n constructor(className: T, proto: ProtoClient<E>) {\n super(className);\n this._proto = proto;\n }\n\n private get _queryOptions() {\n return {\n className: this[PVK].className,\n ...this[PVK].options,\n } as any;\n }\n\n private _requestOpt(options?: RequestOptions<boolean, ProtoClient<E>>) {\n const { context, ...opts } = options ?? {};\n return {\n method: 'post',\n url: `classes/${encodeURIComponent(this.className)}`,\n serializeOpts: {\n objAttrs: TObject.defaultReadonlyKeys,\n },\n ...opts,\n };\n }\n\n clone(options?: TQueryOptions) {\n const clone = new ProtoClientQuery(this.className, this._proto);\n clone[PVK].options = options ?? { ...this[PVK].options };\n return clone;\n }\n\n explain(options?: RequestOptions<boolean, ProtoClient<E>>) {\n return this._proto[PVK].request(this._proto, {\n operation: 'explain',\n context: options?.context ?? {},\n silent: options?.silent,\n ...this._queryOptions,\n }, this._requestOpt(options));\n }\n\n count(options?: RequestOptions<boolean, ProtoClient<E>>) {\n return this._proto[PVK].request(this._proto, {\n operation: 'count',\n context: options?.context ?? {},\n silent: options?.silent,\n ...this._queryOptions,\n }, this._requestOpt(options)) as any;\n }\n\n find(options?: RequestOptions<boolean, ProtoClient<E>>) {\n const request = () => this._proto[PVK].request(this._proto, {\n operation: 'find',\n context: options?.context ?? {},\n silent: options?.silent,\n ...this._queryOptions,\n }, this._requestOpt(options)) as Promise<TObjectType<T, E>[]>;\n return asyncStream(request);\n }\n\n random(\n opts?: TQueryRandomOptions,\n options?: RequestOptions<boolean, ProtoClient<E>>\n ) {\n const request = () => this._proto[PVK].request(this._proto, {\n operation: 'random',\n context: options?.context ?? {},\n silent: options?.silent,\n random: opts,\n ...this._queryOptions,\n }, this._requestOpt(options)) as Promise<TObjectType<T, E>[]>;\n return asyncStream(request);\n }\n\n nonrefs(options?: RequestOptions<boolean, ProtoClient<E>>) {\n const request = () => this._proto[PVK].request(this._proto, {\n operation: 'nonrefs',\n context: options?.context ?? {},\n silent: options?.silent,\n ...this._queryOptions,\n }, this._requestOpt(options)) as Promise<TObjectType<T, E>[]>;\n return asyncStream(request);\n }\n\n insert(\n attrs: Record<string, TValue>,\n options?: RequestOptions<boolean, ProtoClient<E>>\n ) {\n return this._proto[PVK].request(this._proto, {\n operation: 'insert',\n context: options?.context ?? {},\n silent: options?.silent,\n attributes: attrs,\n ...this._queryOptions,\n }, this._requestOpt(options)) as any;\n }\n\n insertMany(\n values: Record<string, TValue>[],\n options?: RequestOptions<boolean, ProtoClient<E>>\n ) {\n return this._proto[PVK].request(this._proto, {\n operation: 'insertMany',\n context: options?.context ?? {},\n silent: options?.silent,\n attributes: values,\n ...this._queryOptions,\n }, this._requestOpt(options)) as any;\n }\n\n updateOne(\n update: Record<string, TUpdateOp>,\n options?: RequestOptions<boolean, ProtoClient<E>>\n ) {\n return this._proto[PVK].request(this._proto, {\n operation: 'updateOne',\n context: options?.context ?? {},\n silent: options?.silent,\n update,\n ...this._queryOptions,\n }, this._requestOpt(options)) as any;\n }\n\n upsertOne(\n update: Record<string, TUpdateOp>,\n setOnInsert: Record<string, TValue>,\n options?: RequestOptions<boolean, ProtoClient<E>>\n ) {\n return this._proto[PVK].request(this._proto, {\n operation: 'upsertOne',\n context: options?.context ?? {},\n silent: options?.silent,\n update,\n setOnInsert,\n ...this._queryOptions,\n }, this._requestOpt(options)) as any;\n }\n\n deleteOne(options?: RequestOptions<boolean, ProtoClient<E>>) {\n return this._proto[PVK].request(this._proto, {\n operation: 'deleteOne',\n context: options?.context ?? {},\n silent: options?.silent,\n ...this._queryOptions,\n }, this._requestOpt(options)) as any;\n }\n\n deleteMany(options?: RequestOptions<boolean, ProtoClient<E>>) {\n return this._proto[PVK].request(this._proto, {\n operation: 'deleteMany',\n context: options?.context ?? {},\n silent: options?.silent,\n ...this._queryOptions,\n }, this._requestOpt(options)) as any;\n }\n\n}","//\n// request.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 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';\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 = any, D = any>(config: RequestOptions<boolean, P> & AxiosRequestConfig<D>, retry = 0): Promise<AxiosResponse<T, D>> {\n\n const { master, abortSignal, serializeOpts, context, 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 = any, D = any>(config: RequestOptions<boolean, P> & 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 let disconnect = false;\n let listeners: ((payload: any) => void)[] = [];\n let destroyCallbacks: VoidFunction[] = [];\n\n socket.on('connect_error', () => {\n if (!disconnect && !socket.active) socket.connect();\n });\n socket.on('disconnect', () => {\n if (!disconnect && !socket.active) socket.connect();\n });\n\n socket.on('data', (payload) => {\n for (const callback of listeners) {\n callback(payload);\n }\n });\n\n const destroy = () => {\n disconnect = true;\n this.sockets = this.sockets.filter(x => x !== socket);\n socket.disconnect();\n for (const callback of destroyCallbacks) {\n callback();\n }\n };\n\n return {\n socket,\n listen: (callback: (payload: any) => void) => {\n listeners.push(callback);\n return () => {\n listeners = listeners.filter(x => x !== callback);\n if (_.isEmpty(listeners)) destroy();\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 - 2024 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 '../../common';\nimport { EventData, ProtoInternalType, ProtoType } from '../../internals/proto';\nimport { TObjectType } from '../../internals/object/types';\nimport { TUser } from '../../internals/object/user';\nimport { _TValue } 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 { _decodeValue, TObject } from '../../internals/object';\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, context, ...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, P>\n ) {\n\n const { serializeOpts, context, ...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, P>\n ): Promise<TObjectType<'User', Ext> | undefined> {\n\n const { serializeOpts, context, ...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, P>) {\n\n const { serializeOpts, context, ...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, _TValue>;\n }\n async configAcl(options: RequestOptions<boolean, P>) {\n\n const { serializeOpts, context, ...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, _TValue>, options: RequestOptions<boolean, P> & { acl?: string[]; }) {\n\n const { serializeOpts, context, 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, P>) {\n\n const { serializeOpts, context, ...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, P>) {\n\n if (!user.objectId) throw Error('Invalid user');\n if (_.isEmpty(password)) throw Error('Invalid password');\n\n const { serializeOpts, context, ...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, P>) {\n\n if (!user.objectId) throw Error('Invalid user');\n\n const { serializeOpts, context, ...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, P>): Promise<Record<string, TSchema>> {\n\n const { serializeOpts, context, ...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, P>) {\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, P> & { uploadToken?: string; }) {\n\n const { serializeOpts, context, 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, P>) {\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, any>) {\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, P>) {\n\n const { serializeOpts, context, ...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, _TValue> & { _rperm?: string[]; },\n options?: RequestOptions<boolean, P>\n ) {\n\n const { serializeOpts, context, ...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) {\n const { socket, listen, onDestroy } = this.socket ?? this.service.socket();\n if (_.isNil(this.socket)) {\n this.socket = { socket, listen, onDestroy };\n onDestroy(() => { this.socket = undefined; });\n }\n return {\n socket,\n remove: listen((payload) => {\n callback(payload);\n }),\n };\n }\n\n refs(proto: P, object: TObject, options?: RequestOptions<boolean, P>) {\n if (!object.objectId) throw Error('Invalid object');\n const request = async () => {\n const { serializeOpts, context, ...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 - 2024 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 } from '../query';\nimport { RequestOptions } from '../options';\nimport { ProtoClientInternal } from './internal';\nimport { ProtoOptions } from './types';\nimport { TSerializable } from '../../common';\nimport { EventData, ProtoType } from '../../internals/proto';\nimport { TQuery } from '../../internals/query';\nimport { PVK } from '../../internals/private';\nimport { _TValue } from '../../internals/types';\nimport { TUser } from '../../internals/object/user';\nimport { TObject } from '../../internals/object';\n\nexport class ProtoClient<Ext> 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, this> {\n return new ProtoClientQuery<T, Ext>(className, this);\n }\n\n config(options?: RequestOptions<boolean, this>): Promise<Record<string, _TValue>> {\n return this[PVK].config(options);\n }\n configAcl(options: RequestOptions<true, this>) {\n if (options.master !== true) throw Error('No permission');\n return this[PVK].configAcl(options);\n }\n async setConfig(values: Record<string, _TValue>, options: RequestOptions<true, this> & { 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, this>\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 setSessionToken(token?: string) {\n this[PVK].setSessionToken(this, token);\n }\n\n sessionInfo(options?: RequestOptions<boolean, this>) {\n return this[PVK].sessionInfo(this, options);\n }\n\n currentUser(options?: RequestOptions<boolean, this>) {\n return this[PVK].currentUser(this, options);\n }\n\n logout(options?: RequestOptions<boolean, this>) {\n return this[PVK].logout(options);\n }\n\n setPassword(user: TUser, password: string, options: RequestOptions<true, this>) {\n return this[PVK].setPassword(user, password, options);\n }\n\n unsetPassword(user: TUser, options: RequestOptions<true, this>) {\n return this[PVK].unsetPassword(user, options);\n }\n\n schema(options: RequestOptions<true, this>) {\n return this[PVK].schema(options);\n }\n\n notify(data: Record<string, _TValue> & { _rperm?: string[]; }, options?: RequestOptions<boolean, this>) {\n return this[PVK].notify(this, data, options);\n }\n\n listen(callback: (data: EventData) => void) {\n return this[PVK].listen(this, callback);\n }\n\n refs(object: TObject, options?: RequestOptions<boolean, this>) {\n return this[PVK].refs(this, object, options);\n }\n}\n"],"names":["PVK","TObject","decodeUpdateOp","Decimal","asyncStream","XSRF_COOKIE_NAME","XSRF_HEADER_NAME","io","isBinaryData","isReadableStream","isBlob","base64ToBuffer","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;AAyBA,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,CAAC;AAC3C,SAAA;AACD,QAAA,OAAO,EAAE;YACP,GAAG,GAAG,CAAC,OAAO;AACd,YAAA,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC;AAC1G,SAAA;KACF,CAAC;AACJ,CAAC,CAAA;AAED,MAAM,gBAAgB,CAAA;;IAGpB,CAACA,YAAG,IAA2C,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAE/D,IAAA,MAAM,CAAC,MAAsB,EAAA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E,QAAA,OAAO,IAAI,CAACA,YAAG,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;KACvD;IAED,aAAa,CAAC,IAAW,EAAE,OAAmC,EAAA;QAC5D,OAAO,IAAI,CAACA,YAAG,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KAC/C;AAED,IAAA,MAAM,CAAC,OAAmC,EAAA;QACxC,OAAO,IAAI,CAACA,YAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;KAClC;IAED,MAAM,CAAC,IAAsD,EAAE,OAAuC,EAAA;AACpG,QAAA,OAAO,IAAI,CAACA,YAAG,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;KAC9C;AAED,IAAA,MAAM,CAAC,QAAmC,EAAA;QACxC,OAAO,IAAI,CAACA,YAAG,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;KACzC;IAED,IAAI,CAAC,MAAe,EAAE,OAAuC,EAAA;AAC3D,QAAA,OAAO,IAAI,CAACA,YAAG,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;KAC9C;AACF;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _o2ter_utils_js from '@o2ter/utils-js';
|
|
2
|
-
import { asyncStream, Awaitable } from '@o2ter/utils-js';
|
|
2
|
+
import { BinaryData, asyncStream, Awaitable } from '@o2ter/utils-js';
|
|
3
3
|
import jwt, { SignOptions, VerifyOptions } from 'jsonwebtoken';
|
|
4
4
|
import { Request, CookieOptions } from '@o2ter/server-js';
|
|
5
5
|
import Decimal$1, { Decimal } from 'decimal.js';
|
|
@@ -7,8 +7,6 @@ import _ from 'lodash';
|
|
|
7
7
|
import { Readable } from 'node:stream';
|
|
8
8
|
import { Socket } from 'socket.io-client';
|
|
9
9
|
|
|
10
|
-
declare const PVK: unique symbol;
|
|
11
|
-
|
|
12
10
|
type TNumber = number | Decimal | BigInt;
|
|
13
11
|
type TPrimitive = Date | string | TNumber | boolean | null | undefined;
|
|
14
12
|
type TDictionary = {
|
|
@@ -184,9 +182,6 @@ interface TQueryBaseOptions extends TQueryFilterBaseOptions {
|
|
|
184
182
|
matches?: Record<string, TQueryBaseOptions>;
|
|
185
183
|
}
|
|
186
184
|
declare class TQueryFilterBase {
|
|
187
|
-
[PVK]: {
|
|
188
|
-
options: TQueryFilterBaseOptions;
|
|
189
|
-
};
|
|
190
185
|
filter(filter: TQuerySelector): this;
|
|
191
186
|
equalTo<T extends string>(key: PathName<T>, value: TValue | undefined): this;
|
|
192
187
|
notEqualTo<T extends string>(key: PathName<T>, value: TValue | undefined): this;
|
|
@@ -213,9 +208,6 @@ declare class TQueryFilterBase {
|
|
|
213
208
|
nor(...callbacks: ((query: TQueryFilterBase) => void)[]): this;
|
|
214
209
|
}
|
|
215
210
|
declare class TQueryBase extends TQueryFilterBase {
|
|
216
|
-
[PVK]: {
|
|
217
|
-
options: TQueryBaseOptions;
|
|
218
|
-
};
|
|
219
211
|
sort<T extends Record<string, 1 | -1>>(sort: PathNameMap<T> | TSortOption[]): this;
|
|
220
212
|
skip(skip: number): this;
|
|
221
213
|
limit(limit: number): this;
|
|
@@ -229,10 +221,6 @@ interface TQueryRandomOptions {
|
|
|
229
221
|
weight?: string;
|
|
230
222
|
}
|
|
231
223
|
declare abstract class TQuery<T extends string, Ext, M extends boolean, P extends ProtoType<any>> extends TQueryBase {
|
|
232
|
-
[PVK]: {
|
|
233
|
-
className: T;
|
|
234
|
-
options: TQueryOptions;
|
|
235
|
-
};
|
|
236
224
|
constructor(className: T, options?: TQueryOptions);
|
|
237
225
|
get className(): T;
|
|
238
226
|
abstract clone(options?: TQueryOptions): TQuery<T, Ext, M, P>;
|
|
@@ -293,17 +281,7 @@ type EventData = Record<string, _TValue> & {
|
|
|
293
281
|
_created_at: Date;
|
|
294
282
|
_rperm: string[];
|
|
295
283
|
};
|
|
296
|
-
interface ProtoInternalType<Ext, P extends ProtoType<any>> {
|
|
297
|
-
options: {
|
|
298
|
-
endpoint: string;
|
|
299
|
-
classExtends?: TExtensions<Ext>;
|
|
300
|
-
};
|
|
301
|
-
saveFile(proto: P, object: TFile, options?: ExtraOptions<boolean, P>): Promise<TFile>;
|
|
302
|
-
deleteFile(proto: P, object: TFile, options?: ExtraOptions<boolean, P>): Promise<TFile>;
|
|
303
|
-
fileData(proto: P, object: TFile, options?: ExtraOptions<boolean, P>): FileStream;
|
|
304
|
-
}
|
|
305
284
|
declare abstract class ProtoType<Ext> {
|
|
306
|
-
abstract [PVK]: ProtoInternalType<Ext, this>;
|
|
307
285
|
abstract config(options?: {
|
|
308
286
|
master?: boolean;
|
|
309
287
|
}): Promise<Record<string, _TValue>>;
|
|
@@ -387,12 +365,6 @@ interface TObject {
|
|
|
387
365
|
declare class TObject {
|
|
388
366
|
static defaultReadonlyKeys: string[];
|
|
389
367
|
static defaultKeys: string[];
|
|
390
|
-
[PVK]: {
|
|
391
|
-
className: string;
|
|
392
|
-
attributes: Record<string, TValue>;
|
|
393
|
-
mutated: Record<string, TUpdateOp>;
|
|
394
|
-
extra: Record<string, any>;
|
|
395
|
-
};
|
|
396
368
|
constructor(className: string, attributes?: Record<string, TValue> | ((self: TObject) => Record<string, TValue>));
|
|
397
369
|
get className(): string;
|
|
398
370
|
get attributes(): Record<string, TValue>;
|
|
@@ -591,6 +563,7 @@ interface TStorage {
|
|
|
591
563
|
deleteMany(query: DecodedQuery<FindOptions>): PromiseLike<number>;
|
|
592
564
|
lockTable(className: string | string[], update: boolean): Promise<void>;
|
|
593
565
|
withConnection<T>(callback: (connection: TStorage) => PromiseLike<T>): PromiseLike<T>;
|
|
566
|
+
isDuplicateIdError(error: any): boolean;
|
|
594
567
|
atomic<T>(callback: (connection: TStorage) => PromiseLike<T>, options?: {
|
|
595
568
|
lockTable?: string;
|
|
596
569
|
}): PromiseLike<T>;
|
|
@@ -642,54 +615,7 @@ type ProtoServiceKeyOptions = {
|
|
|
642
615
|
}[];
|
|
643
616
|
};
|
|
644
617
|
|
|
645
|
-
declare class ProtoInternal<Ext, P extends ProtoService<Ext>> implements ProtoInternalType<Ext, P> {
|
|
646
|
-
options: Required<ProtoServiceOptions<Ext>> & ProtoServiceKeyOptions;
|
|
647
|
-
functions: Record<string, ProtoFunction<Ext> | ProtoFunctionOptions<Ext>>;
|
|
648
|
-
triggers: {
|
|
649
|
-
beforeSave?: Record<string, ProtoTrigger<string, Ext>>;
|
|
650
|
-
afterSave?: Record<string, ProtoTrigger<string, Ext>>;
|
|
651
|
-
beforeDelete?: Record<string, ProtoTrigger<string, Ext>>;
|
|
652
|
-
afterDelete?: Record<string, ProtoTrigger<string, Ext>>;
|
|
653
|
-
};
|
|
654
|
-
constructor(options: Required<ProtoServiceOptions<Ext>> & ProtoServiceKeyOptions);
|
|
655
|
-
prepare(): Promise<void>;
|
|
656
|
-
generateId(): string;
|
|
657
|
-
private _perms;
|
|
658
|
-
config(proto: P, options?: {
|
|
659
|
-
master?: boolean;
|
|
660
|
-
}): Promise<Record<string, _TValue>>;
|
|
661
|
-
configAcl(): PromiseLike<Record<string, string[]>>;
|
|
662
|
-
setConfig(values: Record<string, _TValue>, acl?: string[]): Promise<void>;
|
|
663
|
-
run(proto: P, name: string, payload: any, options?: ExtraOptions<boolean, P>): Promise<void | TSerializable>;
|
|
664
|
-
varifyPassword(proto: P, user: TUser, password: string, options: ExtraOptions<true, P>): Promise<boolean>;
|
|
665
|
-
setPassword(proto: P, user: TUser, password: string, options: ExtraOptions<true, P>): Promise<void>;
|
|
666
|
-
unsetPassword(proto: P, user: TUser, options: ExtraOptions<true, P>): Promise<void>;
|
|
667
|
-
updateFile(proto: P, object: TFile, options?: ExtraOptions<boolean, P>): Promise<TFile>;
|
|
668
|
-
varifyUploadToken(proto: P, token?: string, isMaster?: boolean): {
|
|
669
|
-
nonce: string | undefined;
|
|
670
|
-
maxUploadSize: number;
|
|
671
|
-
};
|
|
672
|
-
createFile(proto: P, object: TFile, options?: ExtraOptions<boolean, P> & {
|
|
673
|
-
uploadToken?: string;
|
|
674
|
-
}): Promise<TFile>;
|
|
675
|
-
saveFile(proto: P, object: TFile, options?: ExtraOptions<boolean, P>): Promise<TFile>;
|
|
676
|
-
deleteFile(proto: P, object: TFile, options?: ExtraOptions<boolean, P>): Promise<TFile>;
|
|
677
|
-
fileData(proto: P, object: TFile, options?: ExtraOptions<boolean, P>): Readable;
|
|
678
|
-
destroyFileData(proto: P, id: string): void;
|
|
679
|
-
jwtSign(payload: any, options: 'login' | 'upload' | jwt.SignOptions): string;
|
|
680
|
-
jwtVarify(token: string, options?: 'login' | 'upload' | jwt.VerifyOptions): jwt.JwtPayload | undefined;
|
|
681
|
-
notify(proto: P, data: Record<string, _TValue> & {
|
|
682
|
-
_rperm?: string[];
|
|
683
|
-
}): Promise<void>;
|
|
684
|
-
listen(proto: P, callback: (data: EventData) => void): {
|
|
685
|
-
remove: VoidFunction;
|
|
686
|
-
};
|
|
687
|
-
validateCLPs(className: string, acls: string[], keys: (keyof TSchema.CLPs)[]): boolean;
|
|
688
|
-
refs(proto: P, object: TObject, options?: ExtraOptions<boolean, P>): Promise<AsyncIterable<TObject>>;
|
|
689
|
-
}
|
|
690
|
-
|
|
691
618
|
declare class ProtoService<Ext> extends ProtoType<Ext> {
|
|
692
|
-
[PVK]: ProtoInternal<Ext, this>;
|
|
693
619
|
private _storage?;
|
|
694
620
|
private _schedule;
|
|
695
621
|
req?: Request;
|
|
@@ -773,5 +699,5 @@ declare class ProtoService<Ext> extends ProtoType<Ext> {
|
|
|
773
699
|
refs(object: TObject, options?: ExtraOptions<boolean, this>): _o2ter_utils_js.AsyncStream<TObjectType<string, Ext>>;
|
|
774
700
|
}
|
|
775
701
|
|
|
776
|
-
export { type
|
|
777
|
-
//# sourceMappingURL=index-
|
|
702
|
+
export { type TFileInfo as A, type DeserializeOptions as D, type ExtraOptions as E, type FindOptions as F, type InsertOptions as I, ProtoService as P, QuerySelector as Q, type SerializeOptions as S, TSchema as T, type _TValue as _, type ProtoServiceOptions as a, type ProtoServiceKeyOptions as b, type TFileStorage as c, type TSerializable as d, deserialize as e, type TExtensions as f, TQuery as g, TObject as h, TUser as i, TRole as j, TFile as k, ProtoType as l, type TObjectType as m, type EventData as n, type DecodedQuery as o, type DecodedSortOption as p, type TValue as q, type FindOneOptions as r, serialize as s, type TUpdateOp as t, FieldSelectorExpression as u, QueryExpression as v, type TStorage as w, type TransactionOptions as x, type TQueryRandomOptions as y, type TPubSub as z };
|
|
703
|
+
//# sourceMappingURL=index-DnREUbmG.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DnREUbmG.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-be1VYBY2.mjs","sources":["../../../src/adapters/file/base/index.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 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 { promisify } from 'util';\nimport { deflate as _deflate, unzip as _unzip } from 'zlib';\nimport { TFileInfo, TFileStorage } from '../../../server/file';\nimport { ProtoService } from '../../../server/proto';\nimport { TSchema } from '../../../internals/schema';\nimport { binaryStreamChunk, parallelEach, parallelMap } from '@o2ter/utils-js';\nimport { PVK } from '../../../internals/private';\n\nconst deflate = promisify(_deflate);\nconst unzip = promisify(_unzip);\n\nexport type FileStorageOptions = {\n chunkSize?: number;\n parallel?: number;\n};\n\nexport abstract class FileStorageBase implements TFileStorage {\n\n options: Required<FileStorageOptions>;\n\n constructor(options: FileStorageOptions) {\n this.options = {\n chunkSize: 16 * 1024,\n parallel: 8,\n ..._.pickBy(options, v => !_.isNil(v)),\n };\n }\n\n get schema(): Record<string, TSchema> {\n return {}\n }\n\n abstract createChunk<E>(proto: ProtoService<E>, token: string, start: number, end: number, compressed: Buffer): PromiseLike<void>;\n abstract readChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{\n start: number;\n data: Buffer | Uint8Array | PromiseLike<Buffer | Uint8Array>;\n }, void>;\n abstract destroy<E>(proto: ProtoService<E>, id: string): PromiseLike<void>;\n\n async create<E>(\n proto: ProtoService<E>,\n stream: BinaryData | AsyncIterable<BinaryData>,\n info: TFileInfo,\n maxUploadSize: number,\n ) {\n\n const token = proto[PVK].generateId();\n\n let size = 0;\n const _stream = async function* (stream: AsyncIterable<Buffer>) {\n for await (const data of stream) {\n yield { data, offset: size };\n size += data.byteLength;\n }\n };\n\n await parallelEach(\n _stream(binaryStreamChunk(stream, this.options.chunkSize)),\n this.options.parallel,\n async ({ data, offset }) => {\n const chunkSize = data.byteLength;\n await this.createChunk(proto, token, offset, offset + chunkSize, await deflate(data));\n if (offset + chunkSize > maxUploadSize) throw Error('Payload too large');\n }\n );\n\n return { _id: token, size };\n }\n\n async* fileData<E>(proto: ProtoService<E>, id: string, start?: number, end?: number) {\n\n const _stream = parallelMap(\n this.readChunks(proto, id, start, end),\n this.options.parallel,\n async chunk => ({\n start: chunk.start,\n data: await unzip(await chunk.data),\n })\n );\n\n for await (const { start: startBytes, data } of _stream) {\n\n if (!_.isNumber(start) && !_.isNumber(end)) {\n\n yield data;\n\n } else {\n\n const endBytes = startBytes + data.length;\n const _start = _.isNumber(start) && start > startBytes ? start - startBytes : 0;\n const _end = _.isNumber(end) && end < endBytes ? end - startBytes : undefined;\n\n yield data.subarray(_start, _end);\n }\n }\n }\n};\n\nexport default FileStorageBase;"],"names":["_deflate","_unzip"],"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;AAWA,MAAM,OAAO,GAAG,SAAS,CAACA,SAAQ,CAAC,CAAC;AACpC,MAAM,KAAK,GAAG,SAAS,CAACC,OAAM,CAAC,CAAC;MAOV,eAAe,CAAA;AAEnC,IAAA,OAAO,CAA+B;AAEtC,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,IAAI,CAAC,OAAO,GAAG;YACb,SAAS,EAAE,EAAE,GAAG,IAAI;AACpB,YAAA,QAAQ,EAAE,CAAC;AACX,YAAA,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACvC,CAAC;KACH;AAED,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,EAAE,CAAA;KACV;IASD,MAAM,MAAM,CACV,KAAsB,EACtB,MAA8C,EAC9C,IAAe,EACf,aAAqB,EAAA;QAGrB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;QAEtC,IAAI,IAAI,GAAG,CAAC,CAAC;AACb,Q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,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,OAAO,EAAE;AAEvD,YAAA,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAE1C,gBAAA,MAAM,IAAI,CAAC;aAEZ;iBAAM;AAEL,gBAAA,MAAM,QAAQ,GAAG,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;gBAC1C,MAAM,MAAM,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,UAAU,GAAG,KAAK,GAAG,UAAU,GAAG,CAAC,CAAC;gBAChF,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,QAAQ,GAAG,GAAG,GAAG,UAAU,GAAG,SAAS,CAAC;gBAE9E,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;aACnC;SACF;KACF;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"index-be1VYBY2.mjs","sources":["../../../src/adapters/file/base/index.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2024 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 { promisify } from 'util';\nimport { deflate as _deflate, unzip as _unzip } from 'zlib';\nimport { TFileInfo, TFileStorage } from '../../../server/file';\nimport { ProtoService } from '../../../server/proto';\nimport { TSchema } from '../../../internals/schema';\nimport { BinaryData, binaryStreamChunk, parallelEach, parallelMap } from '@o2ter/utils-js';\nimport { PVK } from '../../../internals/private';\n\nconst deflate = promisify(_deflate);\nconst unzip = promisify(_unzip);\n\nexport type FileStorageOptions = {\n chunkSize?: number;\n parallel?: number;\n};\n\nexport abstract class FileStorageBase implements TFileStorage {\n\n options: Required<FileStorageOptions>;\n\n constructor(options: FileStorageOptions) {\n this.options = {\n chunkSize: 16 * 1024,\n parallel: 8,\n ..._.pickBy(options, v => !_.isNil(v)),\n };\n }\n\n get schema(): Record<string, TSchema> {\n return {}\n }\n\n abstract createChunk<E>(proto: ProtoService<E>, token: string, start: number, end: number, compressed: Buffer): PromiseLike<void>;\n abstract readChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{\n start: number;\n data: Buffer | Uint8Array | PromiseLike<Buffer | Uint8Array>;\n }, void>;\n abstract destroy<E>(proto: ProtoService<E>, id: string): PromiseLike<void>;\n\n async create<E>(\n proto: ProtoService<E>,\n stream: BinaryData | AsyncIterable<BinaryData>,\n info: TFileInfo,\n maxUploadSize: number,\n ) {\n\n const token = proto[PVK].generateId();\n\n let size = 0;\n const _stream = async function* (stream: AsyncIterable<Buffer>) {\n for await (const data of stream) {\n yield { data, offset: size };\n size += data.byteLength;\n }\n };\n\n await parallelEach(\n _stream(binaryStreamChunk(stream, this.options.chunkSize)),\n this.options.parallel,\n async ({ data, offset }) => {\n const chunkSize = data.byteLength;\n await this.createChunk(proto, token, offset, offset + chunkSize, await deflate(data));\n if (offset + chunkSize > maxUploadSize) throw Error('Payload too large');\n }\n );\n\n return { _id: token, size };\n }\n\n async* fileData<E>(proto: ProtoService<E>, id: string, start?: number, end?: number) {\n\n const _stream = parallelMap(\n this.readChunks(proto, id, start, end),\n this.options.parallel,\n async chunk => ({\n start: chunk.start,\n data: await unzip(await chunk.data),\n })\n );\n\n for await (const { start: startBytes, data } of _stream) {\n\n if (!_.isNumber(start) && !_.isNumber(end)) {\n\n yield data;\n\n } else {\n\n const endBytes = startBytes + data.length;\n const _start = _.isNumber(start) && start > startBytes ? start - startBytes : 0;\n const _end = _.isNumber(end) && end < endBytes ? end - startBytes : undefined;\n\n yield data.subarray(_start, _end);\n }\n }\n }\n};\n\nexport default FileStorageBase;"],"names":["_deflate","_unzip"],"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;AAWA,MAAM,OAAO,GAAG,SAAS,CAACA,SAAQ,CAAC,CAAC;AACpC,MAAM,KAAK,GAAG,SAAS,CAACC,OAAM,CAAC,CAAC;MAOV,eAAe,CAAA;AAEnC,IAAA,OAAO,CAA+B;AAEtC,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,IAAI,CAAC,OAAO,GAAG;YACb,SAAS,EAAE,EAAE,GAAG,IAAI;AACpB,YAAA,QAAQ,EAAE,CAAC;AACX,YAAA,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACvC,CAAC;KACH;AAED,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,EAAE,CAAA;KACV;IASD,MAAM,MAAM,CACV,KAAsB,EACtB,MAA8C,EAC9C,IAAe,EACf,aAAqB,EAAA;QAGrB,MAAM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AAM,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC;AACpC,SAAA,CAAC,CACH,CAAC;AAEF,QAAA,WAAW,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,OAAO,EAAE;AAEvD,YAAA,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAE1C,gBAAA,MAAM,IAAI,CAAC;aAEZ;iBAAM;AAEL,gBAAA,MAAM,QAAQ,GAAG,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;gBAC1C,MAAM,MAAM,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,UAAU,GAAG,KAAK,GAAG,UAAU,GAAG,CAAC,CAAC;gBAChF,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,QAAQ,GAAG,GAAG,GAAG,UAAU,GAAG,SAAS,CAAC;gBAE9E,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;aACnC;SACF;KACF;AACF;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TObject, d as decodeUpdateOp } from './index-
|
|
1
|
+
import { T as TObject, d as decodeUpdateOp } from './index-BmRuvHVZ.mjs';
|
|
2
2
|
import _ from 'lodash';
|
|
3
3
|
import { Decimal } from 'decimal.js';
|
|
4
4
|
import { asyncStream, isBinaryData, isReadableStream, isBlob, base64ToBuffer, iterableToStream } from '@o2ter/utils-js';
|
|
@@ -46,6 +46,7 @@ const mergeOpts = (lhs, rhs) => {
|
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
48
|
class TQueryFilterBase {
|
|
49
|
+
/** @internal */
|
|
49
50
|
[PVK] = { options: {} };
|
|
50
51
|
filter(filter) {
|
|
51
52
|
if (_.isNil(this[PVK].options.filter)) {
|
|
@@ -156,6 +157,7 @@ class TQueryFilterBase {
|
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
class TQueryBase extends TQueryFilterBase {
|
|
160
|
+
/** @internal */
|
|
159
161
|
[PVK] = { options: {} };
|
|
160
162
|
sort(sort) {
|
|
161
163
|
this[PVK].options.sort = sort;
|
|
@@ -216,6 +218,7 @@ class TQueryBase extends TQueryFilterBase {
|
|
|
216
218
|
// THE SOFTWARE.
|
|
217
219
|
//
|
|
218
220
|
class TQuery extends TQueryBase {
|
|
221
|
+
/** @internal */
|
|
219
222
|
[PVK];
|
|
220
223
|
constructor(className, options = {}) {
|
|
221
224
|
super();
|
|
@@ -603,7 +606,7 @@ const applyObjectMethods = (object, proto) => {
|
|
|
603
606
|
else {
|
|
604
607
|
const created = await query()
|
|
605
608
|
.includes(...this.keys())
|
|
606
|
-
.insert(_.fromPairs([...this.
|
|
609
|
+
.insert(_.fromPairs([...this._set_entries()]), options);
|
|
607
610
|
this[PVK].attributes = created.attributes;
|
|
608
611
|
this[PVK].mutated = {};
|
|
609
612
|
}
|
|
@@ -1293,7 +1296,7 @@ class ProtoClientInternal {
|
|
|
1293
1296
|
url: 'files',
|
|
1294
1297
|
responseType: 'text',
|
|
1295
1298
|
data: {
|
|
1296
|
-
attributes: serialize(_.fromPairs([...object.
|
|
1299
|
+
attributes: serialize(_.fromPairs([...object._set_entries()]), serializeOpts),
|
|
1297
1300
|
file: buffer,
|
|
1298
1301
|
},
|
|
1299
1302
|
headers: {
|
|
@@ -1420,6 +1423,7 @@ class ProtoClientInternal {
|
|
|
1420
1423
|
// THE SOFTWARE.
|
|
1421
1424
|
//
|
|
1422
1425
|
class ProtoClient extends ProtoType {
|
|
1426
|
+
/** @internal */
|
|
1423
1427
|
[PVK];
|
|
1424
1428
|
constructor(options) {
|
|
1425
1429
|
super();
|
|
@@ -1481,4 +1485,4 @@ class ProtoClient extends ProtoType {
|
|
|
1481
1485
|
}
|
|
1482
1486
|
|
|
1483
1487
|
export { AUTH_COOKIE_KEY as A, MASTER_USER_HEADER_NAME as M, ProtoType as P, TQuery as T, UPLOAD_TOKEN_HEADER_NAME as U, MASTER_PASS_HEADER_NAME as a, TUser as b, ProtoClient as c, deserialize as d, classExtends as e, isObject as f, isUser as g, isRole as h, isQuery as i, isFile as j, serialize as s };
|
|
1484
|
-
//# sourceMappingURL=index-
|
|
1488
|
+
//# sourceMappingURL=index-c-CaNuVY.mjs.map
|