proto.io 0.0.212 → 0.0.214

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/adapters/file/aliyun-oss.d.ts +3 -3
  2. package/dist/adapters/file/database.d.ts +2 -2
  3. package/dist/adapters/file/database.js +2 -2
  4. package/dist/adapters/file/database.js.map +1 -1
  5. package/dist/adapters/file/database.mjs +1 -1
  6. package/dist/adapters/file/filesystem.d.ts +3 -3
  7. package/dist/adapters/file/google-cloud-storage.d.ts +3 -3
  8. package/dist/adapters/storage/progres.d.ts +1 -1
  9. package/dist/adapters/storage/progres.js +117 -84
  10. package/dist/adapters/storage/progres.js.map +1 -1
  11. package/dist/adapters/storage/progres.mjs +79 -46
  12. package/dist/adapters/storage/progres.mjs.map +1 -1
  13. package/dist/client.d.ts +3 -3
  14. package/dist/index.d.ts +3 -3
  15. package/dist/index.js +42 -42
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.mjs +2 -2
  18. package/dist/internals/{base-CZGalGrd.d.ts → base-E1b8J-Fs.d.ts} +2 -2
  19. package/dist/internals/base-E1b8J-Fs.d.ts.map +1 -0
  20. package/dist/internals/{chunk-BsT9SYny.d.ts → chunk-D1bD7otk.d.ts} +3 -3
  21. package/dist/internals/chunk-D1bD7otk.d.ts.map +1 -0
  22. package/dist/internals/{index-Boxwkqe0.d.ts → index-CbjY-gJ7.d.ts} +6 -8
  23. package/dist/internals/index-CbjY-gJ7.d.ts.map +1 -0
  24. package/dist/internals/{index-NF-U_3zG.d.ts → index-SSEdPyhp.d.ts} +2 -2
  25. package/dist/internals/index-SSEdPyhp.d.ts.map +1 -0
  26. package/dist/internals/random-CYjWDvex.mjs +37 -0
  27. package/dist/internals/random-CYjWDvex.mjs.map +1 -0
  28. package/dist/internals/random-nkOQ9U6S.js +39 -0
  29. package/dist/internals/random-nkOQ9U6S.js.map +1 -0
  30. package/dist/internals/{index-D8O7SinR.js → validator-DoRPoIs2.js} +586 -2
  31. package/dist/internals/validator-DoRPoIs2.js.map +1 -0
  32. package/dist/internals/{index-DG9HHO_U.mjs → validator-Dxmbwa3P.mjs} +583 -3
  33. package/dist/internals/validator-Dxmbwa3P.mjs.map +1 -0
  34. package/package.json +1 -1
  35. package/dist/internals/base-CZGalGrd.d.ts.map +0 -1
  36. package/dist/internals/chunk-BsT9SYny.d.ts.map +0 -1
  37. package/dist/internals/index-Boxwkqe0.d.ts.map +0 -1
  38. package/dist/internals/index-D8O7SinR.js.map +0 -1
  39. package/dist/internals/index-DG9HHO_U.mjs.map +0 -1
  40. package/dist/internals/index-NF-U_3zG.d.ts.map +0 -1
  41. package/dist/internals/random-CufRbivU.mjs +0 -526
  42. package/dist/internals/random-CufRbivU.mjs.map +0 -1
  43. package/dist/internals/random-DzvxbWAc.js +0 -532
  44. package/dist/internals/random-DzvxbWAc.js.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import _ from 'lodash';
2
2
  import { Server } from '@o2ter/server-js';
3
- import { Q as QueryValidator, r as resolveColumn, a as resolveDataType, g as generateId } from './internals/random-CufRbivU.mjs';
3
+ import { Q as QueryValidator, r as resolveColumn, a as resolveDataType, b as QuerySelector } from './internals/validator-Dxmbwa3P.mjs';
4
4
  import { P as PVK } from './internals/private-CNw40LZ7.mjs';
5
5
  import { prototypes, asyncStream, isBinaryData, base64ToBuffer } from '@o2ter/utils-js';
6
6
  import { L as LiveQuerySubscription, T as TQuery, d as deserialize, s as serialize, a as TUser, P as ProtoType, _ as _logLevels } from './internals/index-ZPbBr9Db.mjs';
@@ -9,11 +9,11 @@ import { i as isPointer, a as isRelation, T as TObject, b as isShape, d as defau
9
9
  import jwt from 'jsonwebtoken';
10
10
  import { Blob } from 'node:buffer';
11
11
  import { Readable } from 'node:stream';
12
+ import { g as generateId } from './internals/random-CYjWDvex.mjs';
12
13
  import { scrypt } from 'node:crypto';
13
14
  import { promisify } from 'util';
14
15
  import { randomBytes, randomUUID } from '@o2ter/crypto-js';
15
16
  import { P as PROTO_NOTY_MSG, a as PROTO_LIVEQUERY_MSG, M as MASTER_USER_HEADER_NAME, b as MASTER_PASS_HEADER_NAME, A as AUTH_COOKIE_KEY, U as UPLOAD_TOKEN_HEADER_NAME } from './internals/const-Dkp7Nsv5.mjs';
16
- import { Q as QuerySelector } from './internals/index-DG9HHO_U.mjs';
17
17
  export { Decimal } from 'decimal.js';
18
18
  import queryType from 'query-types';
19
19
  import busboy from 'busboy';
@@ -1,4 +1,4 @@
1
- import { d as TFileStorage, T as TSchema, P as ProtoService, K as TFileInfo } from './index-Boxwkqe0.js';
1
+ import { d as TFileStorage, T as TSchema, P as ProtoService, K as TFileInfo } from './index-CbjY-gJ7.js';
2
2
  import { BinaryData } from '@o2ter/utils-js';
3
3
 
4
4
  type FileStorageOptions = {
@@ -23,4 +23,4 @@ declare abstract class FileStorageBase implements TFileStorage {
23
23
  }
24
24
 
25
25
  export { FileStorageBase as F, type FileStorageOptions as a };
26
- //# sourceMappingURL=base-CZGalGrd.d.ts.map
26
+ //# sourceMappingURL=base-E1b8J-Fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-E1b8J-Fs.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
- import { F as FileStorageBase } from './base-CZGalGrd.js';
2
- import { P as ProtoService } from './index-Boxwkqe0.js';
1
+ import { F as FileStorageBase } from './base-E1b8J-Fs.js';
2
+ import { P as ProtoService } from './index-CbjY-gJ7.js';
3
3
 
4
4
  declare abstract class FileChunkStorageBase<File> extends FileStorageBase {
5
5
  abstract listChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{
@@ -14,4 +14,4 @@ declare abstract class FileChunkStorageBase<File> extends FileStorageBase {
14
14
  }
15
15
 
16
16
  export { FileChunkStorageBase as F };
17
- //# sourceMappingURL=chunk-BsT9SYny.d.ts.map
17
+ //# sourceMappingURL=chunk-D1bD7otk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-D1bD7otk.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -261,10 +261,10 @@ type TQuerySelector = (TCoditionalQuerySelector & {
261
261
  [x: string]: TFieldQuerySelector;
262
262
  };
263
263
 
264
- declare const accumulatorExprKeys: readonly ["$sum", "$avg"];
265
- declare const accumulatorNoExprKeys: readonly ["$count"];
264
+ declare const accumulatorExprKeys: readonly ["$max", "$min", "$sum", "$avg", "$stdDevPop", "$stdDevSamp", "$varPop", "$varSamp"];
265
+ declare const accumulatorNoParamKeys: readonly ["$count"];
266
266
  type TQueryAccumulator = {
267
- [x in (typeof accumulatorNoExprKeys)[number]]?: true | {};
267
+ [x in (typeof accumulatorNoParamKeys)[number]]?: true | {};
268
268
  } & {
269
269
  [x in (typeof accumulatorExprKeys)[number]]?: TExpression;
270
270
  };
@@ -1628,6 +1628,7 @@ declare class QueryExpression {
1628
1628
  keyPaths(): string[];
1629
1629
  mapKey(callback: (key: string) => string): QueryExpression;
1630
1630
  eval(value: any): any;
1631
+ evalType(schema: Record<string, TSchema>, className: string): TSchema.DataType[];
1631
1632
  }
1632
1633
 
1633
1634
  declare class QuerySelector {
@@ -1646,15 +1647,12 @@ declare class FieldSelectorExpression {
1646
1647
  eval(value: any): any;
1647
1648
  }
1648
1649
 
1649
- type AccumulatorKeys = typeof accumulatorExprKeys[number] | typeof accumulatorNoExprKeys[number];
1650
1650
  declare class QueryAccumulator {
1651
- type: AccumulatorKeys;
1652
- expr?: QueryExpression;
1653
1651
  static decode(query: TQueryAccumulator): QueryAccumulator;
1654
- constructor(type: AccumulatorKeys, expr?: QueryExpression);
1655
1652
  simplify(): QueryAccumulator;
1656
1653
  keyPaths(): string[];
1657
1654
  mapKey(callback: (key: string) => string): QueryAccumulator;
1655
+ evalType(schema: Record<string, TSchema>, className: string): TSchema.DataType | undefined;
1658
1656
  }
1659
1657
 
1660
1658
  type FindOptions = {
@@ -1957,4 +1955,4 @@ declare class ProtoService<Ext = any> extends ProtoType<Ext> {
1957
1955
  }
1958
1956
 
1959
1957
  export { type DecodedQuery as A, type FindOptions as B, type TStorage as C, type DeserializeOptions as D, type ExtraOptions as E, FieldSelectorExpression as F, type TransactionOptions as G, type TQueryRandomOptions as H, type InsertOptions as I, type TPubSub as J, type TFileInfo as K, ProtoService as P, QueryExpression as Q, type RelationOptions as R, type SerializeOptions as S, TSchema as T, type TValueWithoutObject as a, type ProtoServiceOptions as b, type ProtoServiceKeyOptions as c, type TFileStorage as d, type TNumber as e, type TSerializable as f, deserialize as g, type TExtensions as h, TQuery as i, TObject as j, TUser as k, TRole as l, TFile as m, TJob as n, ProtoType as o, type PathName as p, type TObjectType as q, type EventData as r, serialize as s, type TQuerySelector as t, type TValueWithUndefined as u, type TValue as v, type TUpdateOp as w, QueryAccumulator as x, QuerySelector as y, type DecodedSortOption as z };
1960
- //# sourceMappingURL=index-Boxwkqe0.d.ts.map
1958
+ //# sourceMappingURL=index-CbjY-gJ7.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CbjY-gJ7.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { h as TExtensions, i as TQuery, j as TObject, k as TUser, l as TRole, m as TFile, n as TJob, E as ExtraOptions, S as SerializeOptions, o as ProtoType, p as PathName, a as TValueWithoutObject, f as TSerializable, q as TObjectType, T as TSchema, r as EventData, t as TQuerySelector } from './index-Boxwkqe0.js';
1
+ import { h as TExtensions, i as TQuery, j as TObject, k as TUser, l as TRole, m as TFile, n as TJob, E as ExtraOptions, S as SerializeOptions, o as ProtoType, p as PathName, a as TValueWithoutObject, f as TSerializable, q as TObjectType, T as TSchema, r as EventData, t as TQuerySelector } from './index-CbjY-gJ7.js';
2
2
  import * as _o2ter_utils_js from '@o2ter/utils-js';
3
3
  import * as socket_io_client from 'socket.io-client';
4
4
  import * as _socket_io_component_emitter from '@socket.io/component-emitter';
@@ -90,4 +90,4 @@ declare class ProtoClient<Ext = any> extends ProtoType<Ext> {
90
90
  }
91
91
 
92
92
  export { ProtoClient as P, isObject as a, isUser as b, classExtends as c, isRole as d, isFile as e, isJob as f, isQuery as i };
93
- //# sourceMappingURL=index-NF-U_3zG.d.ts.map
93
+ //# sourceMappingURL=index-SSEdPyhp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-SSEdPyhp.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ import { randomBytes } from '@o2ter/crypto-js';
2
+
3
+ //
4
+ // random.ts
5
+ //
6
+ // The MIT License
7
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
8
+ //
9
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ // of this software and associated documentation files (the "Software"), to deal
11
+ // in the Software without restriction, including without limitation the rights
12
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ // copies of the Software, and to permit persons to whom the Software is
14
+ // furnished to do so, subject to the following conditions:
15
+ //
16
+ // The above copyright notice and this permission notice shall be included in
17
+ // all copies or substantial portions of the Software.
18
+ //
19
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ // THE SOFTWARE.
26
+ //
27
+ const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
28
+ const generateId = (size) => {
29
+ let id = '';
30
+ for (const x of randomBytes(size)) {
31
+ id += chars[x % chars.length];
32
+ }
33
+ return id;
34
+ };
35
+
36
+ export { generateId as g };
37
+ //# sourceMappingURL=random-CYjWDvex.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"random-CYjWDvex.mjs","sources":["../../../src/server/crypto/random.ts"],"sourcesContent":["//\n// random.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 { randomBytes } from '@o2ter/crypto-js';\n\nconst chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';\n\nexport const generateId = (size: number): string => {\n let id = '';\n for (const x of randomBytes(size)) {\n id += chars[x % chars.length];\n }\n return id;\n}\n"],"names":[],"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;AAIA,MAAM,KAAK,GAAG,gEAAgE;AAEjE,MAAA,UAAU,GAAG,CAAC,IAAY,KAAY;IACjD,IAAI,EAAE,GAAG,EAAE;IACX,KAAK,MAAM,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;QACjC,EAAE,IAAI,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;;AAE/B,IAAA,OAAO,EAAE;AACX;;;;"}
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+
3
+ var cryptoJs = require('@o2ter/crypto-js');
4
+
5
+ //
6
+ // random.ts
7
+ //
8
+ // The MIT License
9
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
10
+ //
11
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ // of this software and associated documentation files (the "Software"), to deal
13
+ // in the Software without restriction, including without limitation the rights
14
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ // copies of the Software, and to permit persons to whom the Software is
16
+ // furnished to do so, subject to the following conditions:
17
+ //
18
+ // The above copyright notice and this permission notice shall be included in
19
+ // all copies or substantial portions of the Software.
20
+ //
21
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
+ // THE SOFTWARE.
28
+ //
29
+ const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
30
+ const generateId = (size) => {
31
+ let id = '';
32
+ for (const x of cryptoJs.randomBytes(size)) {
33
+ id += chars[x % chars.length];
34
+ }
35
+ return id;
36
+ };
37
+
38
+ exports.generateId = generateId;
39
+ //# sourceMappingURL=random-nkOQ9U6S.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"random-nkOQ9U6S.js","sources":["../../../src/server/crypto/random.ts"],"sourcesContent":["//\n// random.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 { randomBytes } from '@o2ter/crypto-js';\n\nconst chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';\n\nexport const generateId = (size: number): string => {\n let id = '';\n for (const x of randomBytes(size)) {\n id += chars[x % chars.length];\n }\n return id;\n}\n"],"names":["randomBytes"],"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;AAIA,MAAM,KAAK,GAAG,gEAAgE;AAEjE,MAAA,UAAU,GAAG,CAAC,IAAY,KAAY;IACjD,IAAI,EAAE,GAAG,EAAE;IACX,KAAK,MAAM,CAAC,IAAIA,oBAAW,CAAC,IAAI,CAAC,EAAE;QACjC,EAAE,IAAI,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;;AAE/B,IAAA,OAAO,EAAE;AACX;;;;"}