proto.io 0.0.177 → 0.0.179

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 (71) hide show
  1. package/LICENSE +1 -1
  2. package/dist/adapters/file/database.d.ts +2 -2
  3. package/dist/adapters/file/database.js +5 -5
  4. package/dist/adapters/file/database.js.map +1 -1
  5. package/dist/adapters/file/database.mjs +5 -5
  6. package/dist/adapters/file/database.mjs.map +1 -1
  7. package/dist/adapters/file/filesystem.d.ts +2 -2
  8. package/dist/adapters/file/filesystem.js +3 -3
  9. package/dist/adapters/file/filesystem.js.map +1 -1
  10. package/dist/adapters/file/filesystem.mjs +3 -3
  11. package/dist/adapters/file/filesystem.mjs.map +1 -1
  12. package/dist/adapters/file/google-cloud-storage.d.ts +2 -2
  13. package/dist/adapters/file/google-cloud-storage.js +3 -3
  14. package/dist/adapters/file/google-cloud-storage.js.map +1 -1
  15. package/dist/adapters/file/google-cloud-storage.mjs +3 -3
  16. package/dist/adapters/file/google-cloud-storage.mjs.map +1 -1
  17. package/dist/adapters/storage/progres.d.ts +5 -6
  18. package/dist/adapters/storage/progres.js +108 -80
  19. package/dist/adapters/storage/progres.js.map +1 -1
  20. package/dist/adapters/storage/progres.mjs +108 -80
  21. package/dist/adapters/storage/progres.mjs.map +1 -1
  22. package/dist/client.d.ts +3 -3
  23. package/dist/client.js +4 -4
  24. package/dist/client.js.map +1 -1
  25. package/dist/client.mjs +5 -5
  26. package/dist/client.mjs.map +1 -1
  27. package/dist/index.d.ts +12 -3
  28. package/dist/index.js +42 -31
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.mjs +43 -32
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/internals/{index-CZShhrIu.d.ts → index-B7qz_VeO.d.ts} +2 -2
  33. package/dist/internals/index-B7qz_VeO.d.ts.map +1 -0
  34. package/dist/internals/{index-be1VYBY2.mjs → index-BAFVUYCo.mjs} +3 -3
  35. package/dist/internals/{index-be1VYBY2.mjs.map → index-BAFVUYCo.mjs.map} +1 -1
  36. package/dist/internals/{index-Dz0pmKCD.d.ts → index-BgZqiNxF.d.ts} +13 -11
  37. package/dist/internals/index-BgZqiNxF.d.ts.map +1 -0
  38. package/dist/internals/{index-A2Ulsntq.mjs → index-CPodB1P0.mjs} +21 -20
  39. package/dist/internals/index-CPodB1P0.mjs.map +1 -0
  40. package/dist/internals/{index-BL2gpGny.d.ts → index-CyXddWjz.d.ts} +2 -2
  41. package/dist/internals/index-CyXddWjz.d.ts.map +1 -0
  42. package/dist/internals/{index-DHQhYGsJ.mjs → index-D9AowvHp.mjs} +6 -6
  43. package/dist/internals/{index-DHQhYGsJ.mjs.map → index-D9AowvHp.mjs.map} +1 -1
  44. package/dist/internals/{index-DXuW8UiB.js → index-DRq6T_5w.js} +12 -6
  45. package/dist/internals/index-DRq6T_5w.js.map +1 -0
  46. package/dist/internals/{index-BqFdBhFc.js → index-DfPY7Xbb.js} +3 -3
  47. package/dist/internals/{index-BqFdBhFc.js.map → index-DfPY7Xbb.js.map} +1 -1
  48. package/dist/internals/{index-Dc3V_Bzw.js → index-DjrC854w.js} +6 -6
  49. package/dist/internals/{index-Dc3V_Bzw.js.map → index-DjrC854w.js.map} +1 -1
  50. package/dist/internals/{index-DvjHa8S2.js → index-DwCNTJb5.js} +21 -19
  51. package/dist/internals/index-DwCNTJb5.js.map +1 -0
  52. package/dist/internals/{index-CTsc042s.mjs → index-DyjcBbS1.mjs} +12 -7
  53. package/dist/internals/index-DyjcBbS1.mjs.map +1 -0
  54. package/dist/internals/{private-BUpLAMZi.mjs → private-CNw40LZ7.mjs} +2 -2
  55. package/dist/internals/{private-BUpLAMZi.mjs.map → private-CNw40LZ7.mjs.map} +1 -1
  56. package/dist/internals/{private-CSB1Ep4g.js → private-Ciddhure.js} +2 -2
  57. package/dist/internals/{private-CSB1Ep4g.js.map → private-Ciddhure.js.map} +1 -1
  58. package/dist/internals/{random-DGiu1IIq.mjs → random-BSyWEK8G.mjs} +7 -7
  59. package/dist/internals/random-BSyWEK8G.mjs.map +1 -0
  60. package/dist/internals/{random-CvVZek_8.js → random-CDtFUuES.js} +7 -7
  61. package/dist/internals/random-CDtFUuES.js.map +1 -0
  62. package/package.json +1 -1
  63. package/dist/internals/index-A2Ulsntq.mjs.map +0 -1
  64. package/dist/internals/index-BL2gpGny.d.ts.map +0 -1
  65. package/dist/internals/index-CTsc042s.mjs.map +0 -1
  66. package/dist/internals/index-CZShhrIu.d.ts.map +0 -1
  67. package/dist/internals/index-DXuW8UiB.js.map +0 -1
  68. package/dist/internals/index-DvjHa8S2.js.map +0 -1
  69. package/dist/internals/index-Dz0pmKCD.d.ts.map +0 -1
  70. package/dist/internals/random-CvVZek_8.js.map +0 -1
  71. package/dist/internals/random-DGiu1IIq.mjs.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,18 +1,18 @@
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-DGiu1IIq.mjs';
4
- import { P as PVK } from './internals/private-BUpLAMZi.mjs';
3
+ import { Q as QueryValidator, r as resolveColumn, a as resolveDataType, g as generateId } from './internals/random-BSyWEK8G.mjs';
4
+ import { P as PVK } from './internals/private-CNw40LZ7.mjs';
5
5
  import { asyncStream, prototypes, isBinaryData, base64ToBuffer } from '@o2ter/utils-js';
6
- import { T as TQuery, M as MASTER_USER_HEADER_NAME, a as MASTER_PASS_HEADER_NAME, A as AUTH_COOKIE_KEY, b as TUser, P as ProtoType, s as serialize, d as deserialize, U as UPLOAD_TOKEN_HEADER_NAME } from './internals/index-A2Ulsntq.mjs';
7
- export { c as ProtoClient, e as classExtends, j as isFile, f as isObject, i as isQuery, h as isRole, g as isUser } from './internals/index-A2Ulsntq.mjs';
8
- import { i as isPointer, a as isRelation, T as TObject, b as isShape, d as defaultObjectKeyTypes, c as isPrimitive } from './internals/index-CTsc042s.mjs';
6
+ import { T as TQuery, P as PROTO_NOTY_MSG, M as MASTER_USER_HEADER_NAME, a as MASTER_PASS_HEADER_NAME, A as AUTH_COOKIE_KEY, b as TUser, c as ProtoType, s as serialize, d as deserialize, U as UPLOAD_TOKEN_HEADER_NAME } from './internals/index-CPodB1P0.mjs';
7
+ export { e as ProtoClient, f as classExtends, k as isFile, g as isObject, i as isQuery, j as isRole, h as isUser } from './internals/index-CPodB1P0.mjs';
8
+ import { i as isPointer, a as isRelation, T as TObject, b as isShape, d as defaultObjectKeyTypes, c as isPrimitive } from './internals/index-DyjcBbS1.mjs';
9
9
  import jwt from 'jsonwebtoken';
10
10
  import { Blob } from 'node:buffer';
11
11
  import { Readable } from 'node:stream';
12
12
  import { scrypt } from 'node:crypto';
13
13
  import { promisify } from 'util';
14
14
  import { randomBytes, randomUUID } from '@o2ter/crypto-js';
15
- import { Q as QuerySelector } from './internals/index-DHQhYGsJ.mjs';
15
+ import { Q as QuerySelector } from './internals/index-D9AowvHp.mjs';
16
16
  import queryType from 'query-types';
17
17
  import busboy from 'busboy';
18
18
  export { Decimal } from 'decimal.js';
@@ -24,7 +24,7 @@ import 'socket.io-client';
24
24
  // utils.ts
25
25
  //
26
26
  // The MIT License
27
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
27
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
28
28
  //
29
29
  // Permission is hereby granted, free of charge, to any person obtaining a copy
30
30
  // of this software and associated documentation files (the "Software"), to deal
@@ -58,7 +58,7 @@ const normalize = (x) => {
58
58
  // methods.ts
59
59
  //
60
60
  // The MIT License
61
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
61
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
62
62
  //
63
63
  // Permission is hereby granted, free of charge, to any person obtaining a copy
64
64
  // of this software and associated documentation files (the "Software"), to deal
@@ -253,7 +253,7 @@ const dispatcher = (proto, options, disableSecurity) => {
253
253
  // options.ts
254
254
  //
255
255
  // The MIT License
256
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
256
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
257
257
  //
258
258
  // Permission is hereby granted, free of charge, to any person obtaining a copy
259
259
  // of this software and associated documentation files (the "Software"), to deal
@@ -279,7 +279,7 @@ const _serviceOf = (options) => options?.session instanceof ProtoService ? optio
279
279
  // methods.ts
280
280
  //
281
281
  // The MIT License
282
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
282
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
283
283
  //
284
284
  // Permission is hereby granted, free of charge, to any person obtaining a copy
285
285
  // of this software and associated documentation files (the "Software"), to deal
@@ -432,7 +432,7 @@ class ProtoRelationQuery extends _ProtoQuery {
432
432
  // defaults.ts
433
433
  //
434
434
  // The MIT License
435
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
435
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
436
436
  //
437
437
  // Permission is hereby granted, free of charge, to any person obtaining a copy
438
438
  // of this software and associated documentation files (the "Software"), to deal
@@ -526,7 +526,7 @@ const defaultSchema = {
526
526
  // password.ts
527
527
  //
528
528
  // The MIT License
529
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
529
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
530
530
  //
531
531
  // Permission is hereby granted, free of charge, to any person obtaining a copy
532
532
  // of this software and associated documentation files (the "Software"), to deal
@@ -596,7 +596,7 @@ const varifyPassword = async (alg, password, options) => {
596
596
  // proxy.ts
597
597
  //
598
598
  // The MIT License
599
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
599
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
600
600
  //
601
601
  // Permission is hereby granted, free of charge, to any person obtaining a copy
602
602
  // of this software and associated documentation files (the "Software"), to deal
@@ -636,7 +636,7 @@ const proxy = (x) => {
636
636
  // internal.ts
637
637
  //
638
638
  // The MIT License
639
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
639
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
640
640
  //
641
641
  // Permission is hereby granted, free of charge, to any person obtaining a copy
642
642
  // of this software and associated documentation files (the "Software"), to deal
@@ -994,7 +994,7 @@ class ProtoInternal {
994
994
  if (data._rperm && (!_.isArray(data._rperm) || !_.every(data._rperm, _.isString))) {
995
995
  throw Error('Invalid data type');
996
996
  }
997
- return this.options.pubsub.publish({
997
+ return this.options.pubsub.publish(PROTO_NOTY_MSG, {
998
998
  ...data,
999
999
  _id: this.generateId(),
1000
1000
  _created_at: new Date(),
@@ -1005,11 +1005,16 @@ class ProtoInternal {
1005
1005
  const isMaster = proto.isMaster;
1006
1006
  const roles = isMaster ? [] : this._perms(proto);
1007
1007
  return {
1008
- remove: this.options.pubsub.subscribe(payload => {
1008
+ remove: this.options.pubsub.subscribe(PROTO_NOTY_MSG, payload => {
1009
1009
  const { _rperm } = payload;
1010
1010
  (async () => {
1011
- if (isMaster || _.some(await roles, x => _.includes(_rperm, x))) {
1012
- callback(payload);
1011
+ try {
1012
+ if (isMaster || _.some(await roles, x => _.includes(_rperm, x))) {
1013
+ callback(payload);
1014
+ }
1015
+ }
1016
+ catch (e) {
1017
+ console.error(e);
1013
1018
  }
1014
1019
  })();
1015
1020
  }),
@@ -1027,7 +1032,7 @@ class ProtoInternal {
1027
1032
  }
1028
1033
  async refs(proto, object, options) {
1029
1034
  const roles = options?.master ? [] : await this._perms(proto);
1030
- const classNames = options?.master ? _.keys(this.options.schema) : _.filter(_.keys(this.options.schema), x => proto[PVK].validateCLPs(x, roles, ['find']));
1035
+ const classNames = options?.master ? _.keys(this.options.schema) : _.filter(_.keys(this.options.schema), x => this.validateCLPs(x, roles, ['find']));
1031
1036
  const storage = _serviceOf(options)?.storage ?? this.options.storage;
1032
1037
  return storage.refs(object, classNames, options?.master ? undefined : roles);
1033
1038
  }
@@ -1037,7 +1042,7 @@ class ProtoInternal {
1037
1042
  // session.ts
1038
1043
  //
1039
1044
  // The MIT License
1040
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
1045
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
1041
1046
  //
1042
1047
  // Permission is hereby granted, free of charge, to any person obtaining a copy
1043
1048
  // of this software and associated documentation files (the "Software"), to deal
@@ -1178,7 +1183,7 @@ const signUser = async (proto, res, user, options) => {
1178
1183
  // schedule.ts
1179
1184
  //
1180
1185
  // The MIT License
1181
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
1186
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
1182
1187
  //
1183
1188
  // Permission is hereby granted, free of charge, to any person obtaining a copy
1184
1189
  // of this software and associated documentation files (the "Software"), to deal
@@ -1232,7 +1237,7 @@ const schedule = (proto) => {
1232
1237
  // index.ts
1233
1238
  //
1234
1239
  // The MIT License
1235
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
1240
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
1236
1241
  //
1237
1242
  // Permission is hereby granted, free of charge, to any person obtaining a copy
1238
1243
  // of this software and associated documentation files (the "Software"), to deal
@@ -1498,7 +1503,7 @@ class ProtoService extends ProtoType {
1498
1503
  // index.ts
1499
1504
  //
1500
1505
  // The MIT License
1501
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
1506
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
1502
1507
  //
1503
1508
  // Permission is hereby granted, free of charge, to any person obtaining a copy
1504
1509
  // of this software and associated documentation files (the "Software"), to deal
@@ -1534,7 +1539,7 @@ var authHandler = (proto) => async (req, res, next) => {
1534
1539
  // common.ts
1535
1540
  //
1536
1541
  // The MIT License
1537
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
1542
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
1538
1543
  //
1539
1544
  // Permission is hereby granted, free of charge, to any person obtaining a copy
1540
1545
  // of this software and associated documentation files (the "Software"), to deal
@@ -1594,7 +1599,7 @@ const decodeFormStream = (req, onFile) => {
1594
1599
  // classes.ts
1595
1600
  //
1596
1601
  // The MIT License
1597
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
1602
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
1598
1603
  //
1599
1604
  // Permission is hereby granted, free of charge, to any person obtaining a copy
1600
1605
  // of this software and associated documentation files (the "Software"), to deal
@@ -1830,7 +1835,7 @@ var classesRoute = (router, proto) => {
1830
1835
  // function.ts
1831
1836
  //
1832
1837
  // The MIT License
1833
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
1838
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
1834
1839
  //
1835
1840
  // Permission is hereby granted, free of charge, to any person obtaining a copy
1836
1841
  // of this software and associated documentation files (the "Software"), to deal
@@ -1882,7 +1887,7 @@ var functionRoute = (router, proto) => {
1882
1887
  // files.ts
1883
1888
  //
1884
1889
  // The MIT License
1885
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
1890
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
1886
1891
  //
1887
1892
  // Permission is hereby granted, free of charge, to any person obtaining a copy
1888
1893
  // of this software and associated documentation files (the "Software"), to deal
@@ -1962,7 +1967,7 @@ var filesRoute = (router, proto) => {
1962
1967
  // user.ts
1963
1968
  //
1964
1969
  // The MIT License
1965
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
1970
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
1966
1971
  //
1967
1972
  // Permission is hereby granted, free of charge, to any person obtaining a copy
1968
1973
  // of this software and associated documentation files (the "Software"), to deal
@@ -2019,7 +2024,7 @@ var userRoute = (router, proto) => {
2019
2024
  // user.ts
2020
2025
  //
2021
2026
  // The MIT License
2022
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
2027
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
2023
2028
  //
2024
2029
  // Permission is hereby granted, free of charge, to any person obtaining a copy
2025
2030
  // of this software and associated documentation files (the "Software"), to deal
@@ -2052,7 +2057,7 @@ var notifyRoute = (router, proto) => {
2052
2057
  // schema.ts
2053
2058
  //
2054
2059
  // The MIT License
2055
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
2060
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
2056
2061
  //
2057
2062
  // Permission is hereby granted, free of charge, to any person obtaining a copy
2058
2063
  // of this software and associated documentation files (the "Software"), to deal
@@ -2101,7 +2106,7 @@ var schemaRoute = (router, proto) => {
2101
2106
  // schema.ts
2102
2107
  //
2103
2108
  // The MIT License
2104
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
2109
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
2105
2110
  //
2106
2111
  // Permission is hereby granted, free of charge, to any person obtaining a copy
2107
2112
  // of this software and associated documentation files (the "Software"), to deal
@@ -2153,7 +2158,7 @@ var configRoute = (router, proto) => {
2153
2158
  // index.ts
2154
2159
  //
2155
2160
  // The MIT License
2156
- // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
2161
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
2157
2162
  //
2158
2163
  // Permission is hereby granted, free of charge, to any person obtaining a copy
2159
2164
  // of this software and associated documentation files (the "Software"), to deal
@@ -2201,6 +2206,12 @@ const schema = _.assign((x) => x, {
2201
2206
  * @returns The string schema.
2202
2207
  */
2203
2208
  string: (defaultValue) => ({ type: 'string', default: defaultValue }),
2209
+ /**
2210
+ * Defines a string array schema.
2211
+ * @param defaultValue - The default value for the string array.
2212
+ * @returns The string array schema.
2213
+ */
2214
+ stringArray: (defaultValue) => ({ type: 'string[]', default: defaultValue }),
2204
2215
  /**
2205
2216
  * Defines a date schema.
2206
2217
  * @param defaultValue - The default value for the date.