proto.io 0.0.207 → 0.0.208
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/aliyun-oss.d.ts +3 -3
- package/dist/adapters/file/aliyun-oss.js +2 -2
- package/dist/adapters/file/aliyun-oss.js.map +1 -1
- package/dist/adapters/file/aliyun-oss.mjs +2 -2
- package/dist/adapters/file/aliyun-oss.mjs.map +1 -1
- package/dist/adapters/file/database.d.ts +2 -2
- package/dist/adapters/file/filesystem.d.ts +3 -3
- package/dist/adapters/file/google-cloud-storage.d.ts +3 -3
- package/dist/adapters/storage/progres.d.ts +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.js +1 -1
- package/dist/client.mjs +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +105 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +107 -45
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{base-DHkvlTFy.d.ts → base-wSknxBv7.d.ts} +2 -2
- package/dist/internals/base-wSknxBv7.d.ts.map +1 -0
- package/dist/internals/{chunk-C7kDLOLD.d.ts → chunk-C_BXf1Er.d.ts} +3 -3
- package/dist/internals/chunk-C_BXf1Er.d.ts.map +1 -0
- package/dist/internals/{index-PLz89AWF.d.ts → index-A-hoMfDO.d.ts} +35 -2
- package/dist/internals/index-A-hoMfDO.d.ts.map +1 -0
- package/dist/internals/{index-DAkcqabS.mjs → index-BvwYz4Yp.mjs} +17 -17
- package/dist/internals/index-BvwYz4Yp.mjs.map +1 -0
- package/dist/internals/{index-BRzKDwPs.js → index-DVUiXLfI.js} +17 -17
- package/dist/internals/index-DVUiXLfI.js.map +1 -0
- package/dist/internals/{index-CKcESGqE.d.ts → index-iqOd-Wdg.d.ts} +2 -2
- package/dist/internals/index-iqOd-Wdg.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/internals/base-DHkvlTFy.d.ts.map +0 -1
- package/dist/internals/chunk-C7kDLOLD.d.ts.map +0 -1
- package/dist/internals/index-BRzKDwPs.js.map +0 -1
- package/dist/internals/index-CKcESGqE.d.ts.map +0 -1
- package/dist/internals/index-DAkcqabS.mjs.map +0 -1
- package/dist/internals/index-PLz89AWF.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as ProtoService } from '../../internals/index-
|
|
1
|
+
import { P as ProtoService } from '../../internals/index-A-hoMfDO.js';
|
|
2
2
|
import OSS from 'ali-oss';
|
|
3
|
-
import { a as FileStorageOptions } from '../../internals/base-
|
|
4
|
-
import { F as FileChunkStorageBase } from '../../internals/chunk-
|
|
3
|
+
import { a as FileStorageOptions } from '../../internals/base-wSknxBv7.js';
|
|
4
|
+
import { F as FileChunkStorageBase } from '../../internals/chunk-C_BXf1Er.js';
|
|
5
5
|
import '@o2ter/utils-js';
|
|
6
6
|
import 'jsonwebtoken';
|
|
7
7
|
import '@o2ter/server-js';
|
|
@@ -46,7 +46,7 @@ class AliyunObjectStorage extends chunk.FileChunkStorageBase {
|
|
|
46
46
|
async listChunks(proto, token) {
|
|
47
47
|
const response = [];
|
|
48
48
|
let next;
|
|
49
|
-
|
|
49
|
+
do {
|
|
50
50
|
const { objects, nextContinuationToken } = await this._storage.listV2({
|
|
51
51
|
prefix: `${token}/`,
|
|
52
52
|
delimiter: '/',
|
|
@@ -56,7 +56,7 @@ class AliyunObjectStorage extends chunk.FileChunkStorageBase {
|
|
|
56
56
|
break;
|
|
57
57
|
response.push(...objects);
|
|
58
58
|
next = nextContinuationToken;
|
|
59
|
-
}
|
|
59
|
+
} while (next);
|
|
60
60
|
const files = _.map(response, x => ({
|
|
61
61
|
file: x,
|
|
62
62
|
name: _.last(_.split(x.name, '/')),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aliyun-oss.js","sources":["../../../../src/adapters/file/aliyun-oss/index.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { ProtoService } from '../../../server/proto';\nimport OSS from 'ali-oss';\nimport { FileChunkStorageBase, FileStorageOptions } from '../base';\n\nexport class AliyunObjectStorage extends FileChunkStorageBase<OSS.ObjectMeta> {\n\n private _storage: OSS;\n\n constructor(storage: OSS, options: FileStorageOptions = {}) {\n super(options);\n this._storage = storage;\n }\n\n async createChunk<E>(proto: ProtoService<E>, token: string, start: number, end: number, compressed: Buffer) {\n await this._storage.put(`${token}/${start}.chunk`, compressed);\n }\n\n async listChunks<E>(proto: ProtoService<E>, token: string) {\n const response: OSS.ObjectMeta[] = [];\n let next: string | undefined;\n
|
|
1
|
+
{"version":3,"file":"aliyun-oss.js","sources":["../../../../src/adapters/file/aliyun-oss/index.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { ProtoService } from '../../../server/proto';\nimport OSS from 'ali-oss';\nimport { FileChunkStorageBase, FileStorageOptions } from '../base';\n\nexport class AliyunObjectStorage extends FileChunkStorageBase<OSS.ObjectMeta> {\n\n private _storage: OSS;\n\n constructor(storage: OSS, options: FileStorageOptions = {}) {\n super(options);\n this._storage = storage;\n }\n\n async createChunk<E>(proto: ProtoService<E>, token: string, start: number, end: number, compressed: Buffer) {\n await this._storage.put(`${token}/${start}.chunk`, compressed);\n }\n\n async listChunks<E>(proto: ProtoService<E>, token: string) {\n const response: OSS.ObjectMeta[] = [];\n let next: string | undefined;\n do {\n const { objects, nextContinuationToken } = await (this._storage as any).listV2({\n prefix: `${token}/`,\n delimiter: '/',\n continuationToken: next,\n }, {});\n if (_.isEmpty(objects)) break;\n response.push(...objects);\n next = nextContinuationToken;\n } while (next);\n const files = _.map(response, x => ({\n file: x,\n name: _.last(_.split(x.name, '/'))!,\n }));\n return _.map(_.filter(files, x => !!x.name?.match(/^\\d+\\.chunk$/)), x => ({\n file: x.file,\n start: parseInt(x.name.slice(0, -6)),\n }));\n }\n\n async readChunk<E>(proto: ProtoService<E>, file: OSS.ObjectMeta) {\n const { content } = await this._storage.get(file.name);\n return content;\n }\n\n async destroy<E>(proto: ProtoService<E>, token: string) {\n while (true) {\n const { objects } = await this._storage.listV2({\n prefix: `${token}/`,\n delimiter: '/',\n }, {});\n if (_.isEmpty(objects)) return;\n await this._storage.deleteMulti(_.map(objects, x => x.name));\n }\n }\n};\n\nexport default AliyunObjectStorage;"],"names":["FileChunkStorageBase"],"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;AAOM,MAAO,mBAAoB,SAAQA,0BAAoC,CAAA;AAEnE,IAAA,QAAQ;IAEhB,WAAY,CAAA,OAAY,EAAE,OAAA,GAA8B,EAAE,EAAA;QACxD,KAAK,CAAC,OAAO,CAAC;AACd,QAAA,IAAI,CAAC,QAAQ,GAAG,OAAO;;IAGzB,MAAM,WAAW,CAAI,KAAsB,EAAE,KAAa,EAAE,KAAa,EAAE,GAAW,EAAE,UAAkB,EAAA;AACxG,QAAA,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA,EAAG,KAAK,CAAA,CAAA,EAAI,KAAK,CAAA,MAAA,CAAQ,EAAE,UAAU,CAAC;;AAGhE,IAAA,MAAM,UAAU,CAAI,KAAsB,EAAE,KAAa,EAAA;QACvD,MAAM,QAAQ,GAAqB,EAAE;AACrC,QAAA,IAAI,IAAwB;AAC5B,QAAA,GAAG;AACD,YAAA,MAAM,EAAE,OAAO,EAAE,qBAAqB,EAAE,GAAG,MAAO,IAAI,CAAC,QAAgB,CAAC,MAAM,CAAC;gBAC7E,MAAM,EAAE,CAAG,EAAA,KAAK,CAAG,CAAA,CAAA;AACnB,gBAAA,SAAS,EAAE,GAAG;AACd,gBAAA,iBAAiB,EAAE,I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AAE,CAAC;AACN,YAAA,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;gBAAE;YACxB,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;;;AAGjE;;;;;"}
|
|
@@ -42,7 +42,7 @@ class AliyunObjectStorage extends FileChunkStorageBase {
|
|
|
42
42
|
async listChunks(proto, token) {
|
|
43
43
|
const response = [];
|
|
44
44
|
let next;
|
|
45
|
-
|
|
45
|
+
do {
|
|
46
46
|
const { objects, nextContinuationToken } = await this._storage.listV2({
|
|
47
47
|
prefix: `${token}/`,
|
|
48
48
|
delimiter: '/',
|
|
@@ -52,7 +52,7 @@ class AliyunObjectStorage extends FileChunkStorageBase {
|
|
|
52
52
|
break;
|
|
53
53
|
response.push(...objects);
|
|
54
54
|
next = nextContinuationToken;
|
|
55
|
-
}
|
|
55
|
+
} while (next);
|
|
56
56
|
const files = _.map(response, x => ({
|
|
57
57
|
file: x,
|
|
58
58
|
name: _.last(_.split(x.name, '/')),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aliyun-oss.mjs","sources":["../../../../src/adapters/file/aliyun-oss/index.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { ProtoService } from '../../../server/proto';\nimport OSS from 'ali-oss';\nimport { FileChunkStorageBase, FileStorageOptions } from '../base';\n\nexport class AliyunObjectStorage extends FileChunkStorageBase<OSS.ObjectMeta> {\n\n private _storage: OSS;\n\n constructor(storage: OSS, options: FileStorageOptions = {}) {\n super(options);\n this._storage = storage;\n }\n\n async createChunk<E>(proto: ProtoService<E>, token: string, start: number, end: number, compressed: Buffer) {\n await this._storage.put(`${token}/${start}.chunk`, compressed);\n }\n\n async listChunks<E>(proto: ProtoService<E>, token: string) {\n const response: OSS.ObjectMeta[] = [];\n let next: string | undefined;\n
|
|
1
|
+
{"version":3,"file":"aliyun-oss.mjs","sources":["../../../../src/adapters/file/aliyun-oss/index.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { ProtoService } from '../../../server/proto';\nimport OSS from 'ali-oss';\nimport { FileChunkStorageBase, FileStorageOptions } from '../base';\n\nexport class AliyunObjectStorage extends FileChunkStorageBase<OSS.ObjectMeta> {\n\n private _storage: OSS;\n\n constructor(storage: OSS, options: FileStorageOptions = {}) {\n super(options);\n this._storage = storage;\n }\n\n async createChunk<E>(proto: ProtoService<E>, token: string, start: number, end: number, compressed: Buffer) {\n await this._storage.put(`${token}/${start}.chunk`, compressed);\n }\n\n async listChunks<E>(proto: ProtoService<E>, token: string) {\n const response: OSS.ObjectMeta[] = [];\n let next: string | undefined;\n do {\n const { objects, nextContinuationToken } = await (this._storage as any).listV2({\n prefix: `${token}/`,\n delimiter: '/',\n continuationToken: next,\n }, {});\n if (_.isEmpty(objects)) break;\n response.push(...objects);\n next = nextContinuationToken;\n } while (next);\n const files = _.map(response, x => ({\n file: x,\n name: _.last(_.split(x.name, '/'))!,\n }));\n return _.map(_.filter(files, x => !!x.name?.match(/^\\d+\\.chunk$/)), x => ({\n file: x.file,\n start: parseInt(x.name.slice(0, -6)),\n }));\n }\n\n async readChunk<E>(proto: ProtoService<E>, file: OSS.ObjectMeta) {\n const { content } = await this._storage.get(file.name);\n return content;\n }\n\n async destroy<E>(proto: ProtoService<E>, token: string) {\n while (true) {\n const { objects } = await this._storage.listV2({\n prefix: `${token}/`,\n delimiter: '/',\n }, {});\n if (_.isEmpty(objects)) return;\n await this._storage.deleteMulti(_.map(objects, x => x.name));\n }\n }\n};\n\nexport default AliyunObjectStorage;"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AAC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C,CAAC,IAAI,EAAE,GAAG,CAAC,CAAE;AACpC,SAAA,CAAC,CAAC;AACH,QAAA,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,KAAK;YACxE,IAAI,EAAE,CAAC,CAAC,IAAI;AACZ,YAAA,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACrC,SAAA,CAAC,CAAC;;AAGL,IAAA,MAAM,SAAS,CAAI,KAAsB,EAAE,IAAoB,EAAA;AAC7D,QAAA,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;AACtD,QAAA,OAAO,OAAO;;AAGhB,IAAA,MAAM,OAAO,CAAI,KAAsB,EAAE,KAAa,EAAA;QACpD,OAAO,IAAI,EAAE;YACX,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAC7C,MAAM,EAAE,CAAG,EAAA,KAAK,CAAG,CAAA,CAAA;AACnB,gBAAA,SAAS,EAAE,GAAG;aACf,EAAE,EAAE,CAAC;AACN,YAAA,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;gBAAE;YACxB,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;;;AAGjE;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TSchema, P as ProtoService } from '../../internals/index-
|
|
2
|
-
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/base-
|
|
1
|
+
import { T as TSchema, P as ProtoService } from '../../internals/index-A-hoMfDO.js';
|
|
2
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/base-wSknxBv7.js';
|
|
3
3
|
import '@o2ter/utils-js';
|
|
4
4
|
import 'jsonwebtoken';
|
|
5
5
|
import '@o2ter/server-js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ProtoService } from '../../internals/index-
|
|
2
|
-
import { a as FileStorageOptions } from '../../internals/base-
|
|
3
|
-
import { F as FileChunkStorageBase } from '../../internals/chunk-
|
|
1
|
+
import { P as ProtoService } from '../../internals/index-A-hoMfDO.js';
|
|
2
|
+
import { a as FileStorageOptions } from '../../internals/base-wSknxBv7.js';
|
|
3
|
+
import { F as FileChunkStorageBase } from '../../internals/chunk-C_BXf1Er.js';
|
|
4
4
|
import '@o2ter/utils-js';
|
|
5
5
|
import 'jsonwebtoken';
|
|
6
6
|
import '@o2ter/server-js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _google_cloud_storage from '@google-cloud/storage';
|
|
2
2
|
import { File, Storage } from '@google-cloud/storage';
|
|
3
|
-
import { P as ProtoService } from '../../internals/index-
|
|
4
|
-
import { a as FileStorageOptions } from '../../internals/base-
|
|
5
|
-
import { F as FileChunkStorageBase } from '../../internals/chunk-
|
|
3
|
+
import { P as ProtoService } from '../../internals/index-A-hoMfDO.js';
|
|
4
|
+
import { a as FileStorageOptions } from '../../internals/base-wSknxBv7.js';
|
|
5
|
+
import { F as FileChunkStorageBase } from '../../internals/chunk-C_BXf1Er.js';
|
|
6
6
|
import '@o2ter/utils-js';
|
|
7
7
|
import 'jsonwebtoken';
|
|
8
8
|
import '@o2ter/server-js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Pool, PoolClient, PoolConfig } from 'pg';
|
|
2
|
-
import { a as TValueWithoutObject, T as TSchema, u as TValueWithUndefined, v as TValue, w as TUpdateOp, F as FieldSelectorExpression, Q as QueryExpression, R as RelationOptions, x as QuerySelector, y as DecodedSortOption, z as DecodedQuery, A as FindOptions, I as InsertOptions, B as TStorage, C as TransactionOptions, j as TObject, G as TQueryRandomOptions, H as TPubSub } from '../../internals/index-
|
|
2
|
+
import { a as TValueWithoutObject, T as TSchema, u as TValueWithUndefined, v as TValue, w as TUpdateOp, F as FieldSelectorExpression, Q as QueryExpression, R as RelationOptions, x as QuerySelector, y as DecodedSortOption, z as DecodedQuery, A as FindOptions, I as InsertOptions, B as TStorage, C as TransactionOptions, j as TObject, G as TQueryRandomOptions, H as TPubSub } from '../../internals/index-A-hoMfDO.js';
|
|
3
3
|
import * as _o2ter_utils_js from '@o2ter/utils-js';
|
|
4
4
|
import { asyncStream } from '@o2ter/utils-js';
|
|
5
5
|
import 'jsonwebtoken';
|
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as ProtoClient } from './internals/index-
|
|
2
|
-
export { c as classExtends, e as isFile, f as isJob, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-
|
|
1
|
+
import { P as ProtoClient } from './internals/index-iqOd-Wdg.js';
|
|
2
|
+
export { c as classExtends, e as isFile, f as isJob, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-iqOd-Wdg.js';
|
|
3
3
|
export { Decimal } from 'decimal.js';
|
|
4
|
-
export { D as DeserializeOptions, S as SerializeOptions, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-
|
|
4
|
+
export { D as DeserializeOptions, S as SerializeOptions, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-A-hoMfDO.js';
|
|
5
5
|
import '@o2ter/utils-js';
|
|
6
6
|
import 'socket.io-client';
|
|
7
7
|
import '@socket.io/component-emitter';
|
package/dist/client.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./internals/index-
|
|
5
|
+
var index = require('./internals/index-DVUiXLfI.js');
|
|
6
6
|
var Decimal = require('decimal.js');
|
|
7
7
|
require('@o2ter/utils-js');
|
|
8
8
|
require('./internals/private-Ciddhure.js');
|
package/dist/client.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as ProtoClient } from './internals/index-
|
|
2
|
-
export { f as classExtends, d as deserialize, k as isFile, l as isJob, g as isObject, i as isQuery, j as isRole, h as isUser, s as serialize } from './internals/index-
|
|
1
|
+
import { e as ProtoClient } from './internals/index-BvwYz4Yp.mjs';
|
|
2
|
+
export { f as classExtends, d as deserialize, k as isFile, l as isJob, g as isObject, i as isQuery, j as isRole, h as isUser, s as serialize } from './internals/index-BvwYz4Yp.mjs';
|
|
3
3
|
export { Decimal } from 'decimal.js';
|
|
4
4
|
import '@o2ter/utils-js';
|
|
5
5
|
import './internals/private-CNw40LZ7.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as socket_io from 'socket.io';
|
|
2
2
|
import { Router } from 'express';
|
|
3
3
|
import { Server } from '@o2ter/server-js';
|
|
4
|
-
import { T as TSchema, a as TValueWithoutObject, P as ProtoService, b as ProtoServiceOptions, c as ProtoServiceKeyOptions } from './internals/index-
|
|
5
|
-
export { D as DeserializeOptions, S as SerializeOptions, d as TFileStorage, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-
|
|
4
|
+
import { T as TSchema, a as TValueWithoutObject, P as ProtoService, b as ProtoServiceOptions, c as ProtoServiceKeyOptions } from './internals/index-A-hoMfDO.js';
|
|
5
|
+
export { D as DeserializeOptions, S as SerializeOptions, d as TFileStorage, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-A-hoMfDO.js';
|
|
6
6
|
import Decimal from 'decimal.js';
|
|
7
7
|
export { Decimal } from 'decimal.js';
|
|
8
|
-
export { P as ProtoClient, c as classExtends, e as isFile, f as isJob, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-
|
|
8
|
+
export { P as ProtoClient, c as classExtends, e as isFile, f as isJob, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-iqOd-Wdg.js';
|
|
9
9
|
import '@o2ter/utils-js';
|
|
10
10
|
import 'jsonwebtoken';
|
|
11
11
|
import 'lodash';
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var serverJs = require('@o2ter/server-js');
|
|
|
7
7
|
var random = require('./internals/random-B0V0EnjP.js');
|
|
8
8
|
var _private = require('./internals/private-Ciddhure.js');
|
|
9
9
|
var utilsJs = require('@o2ter/utils-js');
|
|
10
|
-
var index = require('./internals/index-
|
|
10
|
+
var index = require('./internals/index-DVUiXLfI.js');
|
|
11
11
|
var index$1 = require('./internals/index-B8TESzd9.js');
|
|
12
12
|
var jwt = require('jsonwebtoken');
|
|
13
13
|
var node_buffer = require('node:buffer');
|
|
@@ -201,6 +201,42 @@ const dispatcher = (proto, options) => {
|
|
|
201
201
|
};
|
|
202
202
|
};
|
|
203
203
|
|
|
204
|
+
//
|
|
205
|
+
// proxy.ts
|
|
206
|
+
//
|
|
207
|
+
// The MIT License
|
|
208
|
+
// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
|
|
209
|
+
//
|
|
210
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
211
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
212
|
+
// in the Software without restriction, including without limitation the rights
|
|
213
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
214
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
215
|
+
// furnished to do so, subject to the following conditions:
|
|
216
|
+
//
|
|
217
|
+
// The above copyright notice and this permission notice shall be included in
|
|
218
|
+
// all copies or substantial portions of the Software.
|
|
219
|
+
//
|
|
220
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
221
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
222
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
223
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
224
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
225
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
226
|
+
// THE SOFTWARE.
|
|
227
|
+
//
|
|
228
|
+
const proxy = (x) => {
|
|
229
|
+
const self = x;
|
|
230
|
+
const proxy = _.create(self);
|
|
231
|
+
for (const name of _.uniq(_.flatMap(utilsJs.prototypes(proxy), x => Object.getOwnPropertyNames(x)))) {
|
|
232
|
+
if (name === 'constructor')
|
|
233
|
+
continue;
|
|
234
|
+
const value = _.isFunction(self[name]) ? self[name].bind(self) : self[name];
|
|
235
|
+
Object.defineProperty(proxy, name, { get: () => value });
|
|
236
|
+
}
|
|
237
|
+
return proxy;
|
|
238
|
+
};
|
|
239
|
+
|
|
204
240
|
//
|
|
205
241
|
// methods.ts
|
|
206
242
|
//
|
|
@@ -287,22 +323,65 @@ class _ProtoQuery extends index.TQuery {
|
|
|
287
323
|
yield self._objectMethods(object);
|
|
288
324
|
});
|
|
289
325
|
}
|
|
326
|
+
_on_upsert(objects) {
|
|
327
|
+
const createTraggers = this._proto[_private.PVK].triggers[this.className]?.create ?? [];
|
|
328
|
+
const updateTraggers = this._proto[_private.PVK].triggers[this.className]?.update ?? [];
|
|
329
|
+
for (const obj of objects) {
|
|
330
|
+
for (const tragger of obj.__v === 0 ? createTraggers : updateTraggers) {
|
|
331
|
+
(async () => {
|
|
332
|
+
try {
|
|
333
|
+
await tragger(proxy(Object.setPrototypeOf({ object: obj }, this._proto)));
|
|
334
|
+
}
|
|
335
|
+
catch (e) {
|
|
336
|
+
console.error(e);
|
|
337
|
+
}
|
|
338
|
+
})();
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
_on_delete(objects) {
|
|
343
|
+
const traggers = this._proto[_private.PVK].triggers[this.className]?.delete ?? [];
|
|
344
|
+
for (const obj of objects) {
|
|
345
|
+
for (const tragger of traggers) {
|
|
346
|
+
(async () => {
|
|
347
|
+
try {
|
|
348
|
+
await tragger(proxy(Object.setPrototypeOf({ object: obj }, this._proto)));
|
|
349
|
+
}
|
|
350
|
+
catch (e) {
|
|
351
|
+
console.error(e);
|
|
352
|
+
}
|
|
353
|
+
})();
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
290
357
|
async insertMany(values, options) {
|
|
291
|
-
|
|
358
|
+
const objs = this._objectMethods(await this._dispatcher(options).insert({
|
|
292
359
|
className: this.className,
|
|
293
360
|
includes: this[_private.PVK].options.includes,
|
|
294
361
|
matches: this[_private.PVK].options.matches,
|
|
295
362
|
countMatches: this[_private.PVK].options.countMatches,
|
|
296
363
|
}, values));
|
|
364
|
+
if (!options?.silent)
|
|
365
|
+
this._on_upsert(objs);
|
|
366
|
+
return objs;
|
|
297
367
|
}
|
|
298
368
|
async updateMany(update, options) {
|
|
299
|
-
|
|
369
|
+
const objs = this._objectMethods(await this._dispatcher(options).update(this._queryOptions, update));
|
|
370
|
+
if (!options?.silent)
|
|
371
|
+
this._on_upsert(objs);
|
|
372
|
+
return objs;
|
|
300
373
|
}
|
|
301
374
|
async upsertMany(update, setOnInsert, options) {
|
|
302
|
-
|
|
375
|
+
const objs = this._objectMethods(await this._dispatcher(options).upsert(this._queryOptions, update, setOnInsert));
|
|
376
|
+
if (!options?.silent)
|
|
377
|
+
this._on_upsert(objs);
|
|
378
|
+
return objs;
|
|
303
379
|
}
|
|
304
380
|
async deleteMany(options) {
|
|
305
|
-
|
|
381
|
+
const objs = this._objectMethods(await this._dispatcher(options).delete(this._queryOptions));
|
|
382
|
+
if (!options?.silent)
|
|
383
|
+
this._on_delete(objs);
|
|
384
|
+
return objs;
|
|
306
385
|
}
|
|
307
386
|
}
|
|
308
387
|
class ProtoQuery extends _ProtoQuery {
|
|
@@ -557,42 +636,6 @@ const varifyPassword = async (alg, password, options) => {
|
|
|
557
636
|
}
|
|
558
637
|
};
|
|
559
638
|
|
|
560
|
-
//
|
|
561
|
-
// proxy.ts
|
|
562
|
-
//
|
|
563
|
-
// The MIT License
|
|
564
|
-
// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
|
|
565
|
-
//
|
|
566
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
567
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
568
|
-
// in the Software without restriction, including without limitation the rights
|
|
569
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
570
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
571
|
-
// furnished to do so, subject to the following conditions:
|
|
572
|
-
//
|
|
573
|
-
// The above copyright notice and this permission notice shall be included in
|
|
574
|
-
// all copies or substantial portions of the Software.
|
|
575
|
-
//
|
|
576
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
577
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
578
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
579
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
580
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
581
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
582
|
-
// THE SOFTWARE.
|
|
583
|
-
//
|
|
584
|
-
const proxy = (x) => {
|
|
585
|
-
const self = x;
|
|
586
|
-
const proxy = _.create(self);
|
|
587
|
-
for (const name of _.uniq(_.flatMap(utilsJs.prototypes(proxy), x => Object.getOwnPropertyNames(x)))) {
|
|
588
|
-
if (name === 'constructor')
|
|
589
|
-
continue;
|
|
590
|
-
const value = _.isFunction(self[name]) ? self[name].bind(self) : self[name];
|
|
591
|
-
Object.defineProperty(proxy, name, { get: () => value });
|
|
592
|
-
}
|
|
593
|
-
return proxy;
|
|
594
|
-
};
|
|
595
|
-
|
|
596
639
|
//
|
|
597
640
|
// internal.ts
|
|
598
641
|
//
|
|
@@ -717,6 +760,7 @@ const mergeSchema = (...schemas) => _.reduce(schemas, (acc, schema) => ({
|
|
|
717
760
|
class ProtoInternal {
|
|
718
761
|
options;
|
|
719
762
|
functions = {};
|
|
763
|
+
triggers = {};
|
|
720
764
|
jobs = {};
|
|
721
765
|
jobRunner = new JobRunner();
|
|
722
766
|
constructor(options) {
|
|
@@ -1532,6 +1576,24 @@ class ProtoService extends index.ProtoType {
|
|
|
1532
1576
|
define(name, callback, options) {
|
|
1533
1577
|
this[_private.PVK].functions[name] = options ? { callback, ...options } : callback;
|
|
1534
1578
|
}
|
|
1579
|
+
afterCreate(className, callback) {
|
|
1580
|
+
if (_.isNil(this[_private.PVK].triggers[className])) {
|
|
1581
|
+
this[_private.PVK].triggers[className] = { create: [], update: [], delete: [] };
|
|
1582
|
+
}
|
|
1583
|
+
this[_private.PVK].triggers[className].create.push(callback);
|
|
1584
|
+
}
|
|
1585
|
+
afterUpdate(className, callback) {
|
|
1586
|
+
if (_.isNil(this[_private.PVK].triggers[className])) {
|
|
1587
|
+
this[_private.PVK].triggers[className] = { create: [], update: [], delete: [] };
|
|
1588
|
+
}
|
|
1589
|
+
this[_private.PVK].triggers[className].update.push(callback);
|
|
1590
|
+
}
|
|
1591
|
+
afterDelete(className, callback) {
|
|
1592
|
+
if (_.isNil(this[_private.PVK].triggers[className])) {
|
|
1593
|
+
this[_private.PVK].triggers[className] = { create: [], update: [], delete: [] };
|
|
1594
|
+
}
|
|
1595
|
+
this[_private.PVK].triggers[className].delete.push(callback);
|
|
1596
|
+
}
|
|
1535
1597
|
scheduleJob(name, params, options) {
|
|
1536
1598
|
return this[_private.PVK].scheduleJob(this, name, params, options);
|
|
1537
1599
|
}
|
|
@@ -1741,12 +1803,12 @@ const verifyRelatedBy = (relatedBy) => {
|
|
|
1741
1803
|
var classesRoute = (router, proto) => {
|
|
1742
1804
|
const defaultHandler = async (req) => {
|
|
1743
1805
|
const { name } = req.params;
|
|
1744
|
-
const { operation, random, attributes, update, setOnInsert, relatedBy, ...options } = index.deserialize(req.body);
|
|
1806
|
+
const { operation, random, attributes, update, setOnInsert, relatedBy, silent, ...options } = index.deserialize(req.body);
|
|
1745
1807
|
verifyRelatedBy(relatedBy);
|
|
1746
1808
|
const payload = proto.connect(req);
|
|
1747
1809
|
const query = relatedBy ? payload.Relation(payload.Object(relatedBy.className, relatedBy.objectId), relatedBy.key) : payload.Query(name);
|
|
1748
1810
|
query[_private.PVK].options = options;
|
|
1749
|
-
const opts = { master: payload.isMaster };
|
|
1811
|
+
const opts = { master: payload.isMaster, silent };
|
|
1750
1812
|
if (_.includes(['File', '_Job', '_JobScope'], name) &&
|
|
1751
1813
|
_.includes(['insert', 'insertMany', 'upsertOne', 'upsertMany'], operation))
|
|
1752
1814
|
throw Error('Invaild operation');
|