proto.io 0.0.174 → 0.0.175

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 (36) hide show
  1. package/dist/adapters/file/database.d.ts +2 -2
  2. package/dist/adapters/file/database.mjs +2 -2
  3. package/dist/adapters/file/filesystem.d.ts +2 -2
  4. package/dist/adapters/file/google-cloud-storage.d.ts +2 -2
  5. package/dist/adapters/storage/progres.d.ts +1 -1
  6. package/dist/adapters/storage/progres.mjs +3 -3
  7. package/dist/client.d.ts +3 -3
  8. package/dist/client.js +1 -1
  9. package/dist/client.mjs +3 -3
  10. package/dist/index.d.ts +3 -3
  11. package/dist/index.js +46 -311
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +51 -316
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/internals/{index-uwXdnxqN.d.ts → index-B9CWU0y7.d.ts} +32 -2
  16. package/dist/internals/index-B9CWU0y7.d.ts.map +1 -0
  17. package/dist/internals/{index-R0gbIGc-.mjs → index-BPbXumUi.mjs} +18 -44
  18. package/dist/internals/index-BPbXumUi.mjs.map +1 -0
  19. package/dist/internals/{index-CGX3qcjQ.d.ts → index-BQqYdjaH.d.ts} +2 -2
  20. package/dist/internals/index-BQqYdjaH.d.ts.map +1 -0
  21. package/dist/internals/{index-CE5tdYK8.d.ts → index-BYZpj31o.d.ts} +17 -68
  22. package/dist/internals/index-BYZpj31o.d.ts.map +1 -0
  23. package/dist/internals/{index--ifyu-GL.mjs → index-CTsc042s.mjs} +2 -2
  24. package/dist/internals/{index--ifyu-GL.mjs.map → index-CTsc042s.mjs.map} +1 -1
  25. package/dist/internals/{index-S_gTMQBh.js → index-CvA0tbwx.js} +17 -43
  26. package/dist/internals/index-CvA0tbwx.js.map +1 -0
  27. package/dist/internals/{index-C3fbOqmn.mjs → index-DHQhYGsJ.mjs} +2 -2
  28. package/dist/internals/{index-C3fbOqmn.mjs.map → index-DHQhYGsJ.mjs.map} +1 -1
  29. package/dist/internals/{random-DPRG8oW6.mjs → random-BMQpRlGH.mjs} +3 -3
  30. package/dist/internals/{random-DPRG8oW6.mjs.map → random-BMQpRlGH.mjs.map} +1 -1
  31. package/package.json +1 -1
  32. package/dist/internals/index-CE5tdYK8.d.ts.map +0 -1
  33. package/dist/internals/index-CGX3qcjQ.d.ts.map +0 -1
  34. package/dist/internals/index-R0gbIGc-.mjs.map +0 -1
  35. package/dist/internals/index-S_gTMQBh.js.map +0 -1
  36. package/dist/internals/index-uwXdnxqN.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { f as TExtensions, g as TQuery, h as TObject, i as TUser, j as TRole, k as TFile, E as ExtraOptions, S as SerializeOptions, l as ProtoType, m as PathName, _ as _TValue, d as TSerializable, n as TObjectType, T as TSchema, o as EventData } from './index-CE5tdYK8.js';
1
+ import { f as TExtensions, g as TQuery, h as TObject, i as TUser, j as TRole, k as TFile, E as ExtraOptions, S as SerializeOptions, l as ProtoType, m as PathName, _ as _TValue, d as TSerializable, n as TObjectType, T as TSchema, o as EventData } from './index-BYZpj31o.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';
@@ -14,19 +14,49 @@ type RequestOptions<M extends boolean> = ExtraOptions<M> & {
14
14
  serializeOpts?: SerializeOptions;
15
15
  };
16
16
 
17
+ /**
18
+ * Options for configuring Axios requests.
19
+ */
17
20
  type AxiosOptions = {
21
+ /**
22
+ * The name of the XSRF cookie.
23
+ */
18
24
  xsrfCookieName?: string;
25
+ /**
26
+ * The name of the XSRF header.
27
+ */
19
28
  xsrfHeaderName?: string;
29
+ /**
30
+ * The limit for retry attempts.
31
+ */
20
32
  retryLimit?: number;
21
33
  };
34
+ /**
35
+ * Options for configuring the Proto client.
36
+ */
22
37
  type ProtoOptions<Ext> = {
38
+ /**
39
+ * The endpoint URL for the Proto client.
40
+ */
23
41
  endpoint: string;
42
+ /**
43
+ * The socket endpoint URL for the Proto client.
44
+ */
24
45
  socketEndpoint?: string;
46
+ /**
47
+ * The master user credentials.
48
+ */
25
49
  masterUser?: {
26
50
  user: string;
27
51
  pass: string;
28
52
  };
53
+ /**
54
+ * The class extensions.
55
+ */
29
56
  classExtends?: TExtensions<Ext>;
57
+ /**
58
+ * The Axios configuration options.
59
+ */
30
60
  axiosOptions?: AxiosOptions;
31
61
  };
32
62
 
@@ -58,4 +88,4 @@ declare class ProtoClient<Ext = any> extends ProtoType<Ext> {
58
88
  }
59
89
 
60
90
  export { ProtoClient as P, isObject as a, isUser as b, classExtends as c, isRole as d, isFile as e, isQuery as i };
61
- //# sourceMappingURL=index-uwXdnxqN.d.ts.map
91
+ //# sourceMappingURL=index-B9CWU0y7.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-B9CWU0y7.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { T as TObject, d as decodeUpdateOp } from './index--ifyu-GL.mjs';
1
+ import { T as TObject, e as decodeUpdateOp } from './index-CTsc042s.mjs';
2
2
  import _ from 'lodash';
3
3
  import { Decimal } from 'decimal.js';
4
4
  import { prototypes, asyncStream, isBinaryData, isReadableStream, isBlob, base64ToBuffer, iterableToStream } from '@o2ter/utils-js';
@@ -1115,7 +1115,7 @@ class _ProtoClientQuery extends TQuery {
1115
1115
  };
1116
1116
  }
1117
1117
  _requestOpt(options) {
1118
- const { context, ...opts } = options ?? {};
1118
+ const { ...opts } = options ?? {};
1119
1119
  return {
1120
1120
  method: 'post',
1121
1121
  url: this.url,
@@ -1128,24 +1128,18 @@ class _ProtoClientQuery extends TQuery {
1128
1128
  explain(options) {
1129
1129
  return this._proto[PVK].request(this._proto, {
1130
1130
  operation: 'explain',
1131
- context: options?.context ?? {},
1132
- silent: options?.silent,
1133
1131
  ...this._queryOptions,
1134
1132
  }, this._requestOpt(options));
1135
1133
  }
1136
1134
  count(options) {
1137
1135
  return this._proto[PVK].request(this._proto, {
1138
1136
  operation: 'count',
1139
- context: options?.context ?? {},
1140
- silent: options?.silent,
1141
1137
  ...this._queryOptions,
1142
1138
  }, this._requestOpt(options));
1143
1139
  }
1144
1140
  find(options) {
1145
1141
  const request = () => this._proto[PVK].request(this._proto, {
1146
1142
  operation: 'find',
1147
- context: options?.context ?? {},
1148
- silent: options?.silent,
1149
1143
  ...this._queryOptions,
1150
1144
  }, this._requestOpt(options));
1151
1145
  return asyncStream(request);
@@ -1153,8 +1147,6 @@ class _ProtoClientQuery extends TQuery {
1153
1147
  random(opts, options) {
1154
1148
  const request = () => this._proto[PVK].request(this._proto, {
1155
1149
  operation: 'random',
1156
- context: options?.context ?? {},
1157
- silent: options?.silent,
1158
1150
  random: opts,
1159
1151
  ...this._queryOptions,
1160
1152
  }, this._requestOpt(options));
@@ -1163,8 +1155,6 @@ class _ProtoClientQuery extends TQuery {
1163
1155
  nonrefs(options) {
1164
1156
  const request = () => this._proto[PVK].request(this._proto, {
1165
1157
  operation: 'nonrefs',
1166
- context: options?.context ?? {},
1167
- silent: options?.silent,
1168
1158
  ...this._queryOptions,
1169
1159
  }, this._requestOpt(options));
1170
1160
  return asyncStream(request);
@@ -1172,8 +1162,6 @@ class _ProtoClientQuery extends TQuery {
1172
1162
  insert(attrs, options) {
1173
1163
  return this._proto[PVK].request(this._proto, {
1174
1164
  operation: 'insert',
1175
- context: options?.context ?? {},
1176
- silent: options?.silent,
1177
1165
  attributes: attrs,
1178
1166
  ...this._queryOptions,
1179
1167
  }, this._requestOpt(options));
@@ -1181,8 +1169,6 @@ class _ProtoClientQuery extends TQuery {
1181
1169
  insertMany(values, options) {
1182
1170
  return this._proto[PVK].request(this._proto, {
1183
1171
  operation: 'insertMany',
1184
- context: options?.context ?? {},
1185
- silent: options?.silent,
1186
1172
  attributes: values,
1187
1173
  ...this._queryOptions,
1188
1174
  }, this._requestOpt(options));
@@ -1190,8 +1176,6 @@ class _ProtoClientQuery extends TQuery {
1190
1176
  updateOne(update, options) {
1191
1177
  return this._proto[PVK].request(this._proto, {
1192
1178
  operation: 'updateOne',
1193
- context: options?.context ?? {},
1194
- silent: options?.silent,
1195
1179
  update,
1196
1180
  ...this._queryOptions,
1197
1181
  }, this._requestOpt(options));
@@ -1199,8 +1183,6 @@ class _ProtoClientQuery extends TQuery {
1199
1183
  updateMany(update, options) {
1200
1184
  return this._proto[PVK].request(this._proto, {
1201
1185
  operation: 'updateMany',
1202
- context: options?.context ?? {},
1203
- silent: options?.silent,
1204
1186
  update,
1205
1187
  ...this._queryOptions,
1206
1188
  }, this._requestOpt(options));
@@ -1208,8 +1190,6 @@ class _ProtoClientQuery extends TQuery {
1208
1190
  upsertOne(update, setOnInsert, options) {
1209
1191
  return this._proto[PVK].request(this._proto, {
1210
1192
  operation: 'upsertOne',
1211
- context: options?.context ?? {},
1212
- silent: options?.silent,
1213
1193
  update,
1214
1194
  setOnInsert,
1215
1195
  ...this._queryOptions,
@@ -1218,8 +1198,6 @@ class _ProtoClientQuery extends TQuery {
1218
1198
  upsertMany(update, setOnInsert, options) {
1219
1199
  return this._proto[PVK].request(this._proto, {
1220
1200
  operation: 'upsertMany',
1221
- context: options?.context ?? {},
1222
- silent: options?.silent,
1223
1201
  update,
1224
1202
  setOnInsert,
1225
1203
  ...this._queryOptions,
@@ -1228,16 +1206,12 @@ class _ProtoClientQuery extends TQuery {
1228
1206
  deleteOne(options) {
1229
1207
  return this._proto[PVK].request(this._proto, {
1230
1208
  operation: 'deleteOne',
1231
- context: options?.context ?? {},
1232
- silent: options?.silent,
1233
1209
  ...this._queryOptions,
1234
1210
  }, this._requestOpt(options));
1235
1211
  }
1236
1212
  deleteMany(options) {
1237
1213
  return this._proto[PVK].request(this._proto, {
1238
1214
  operation: 'deleteMany',
1239
- context: options?.context ?? {},
1240
- silent: options?.silent,
1241
1215
  ...this._queryOptions,
1242
1216
  }, this._requestOpt(options));
1243
1217
  }
@@ -1328,7 +1302,7 @@ class Service {
1328
1302
  }
1329
1303
  }
1330
1304
  async _request(config, retry = 0) {
1331
- const { master, abortSignal, serializeOpts, context, headers, ...opts } = config ?? {};
1305
+ const { master, abortSignal, serializeOpts, headers, ...opts } = config ?? {};
1332
1306
  const res = await this.service.request({
1333
1307
  signal: abortSignal,
1334
1308
  headers: {
@@ -1446,7 +1420,7 @@ class ProtoClientInternal {
1446
1420
  this.service = new Service(this, options.axiosOptions);
1447
1421
  }
1448
1422
  async request(proto, data, options) {
1449
- const { serializeOpts, context, ...opts } = options ?? {};
1423
+ const { serializeOpts, ...opts } = options ?? {};
1450
1424
  const res = await this.service.request({
1451
1425
  baseURL: this.options.endpoint,
1452
1426
  data: serialize(data, serializeOpts),
@@ -1459,7 +1433,7 @@ class ProtoClientInternal {
1459
1433
  this.service.setSessionToken(token);
1460
1434
  }
1461
1435
  async sessionInfo(proto, options) {
1462
- const { serializeOpts, context, ...opts } = options ?? {};
1436
+ const { serializeOpts, ...opts } = options ?? {};
1463
1437
  const res = await this.service.request({
1464
1438
  method: 'get',
1465
1439
  baseURL: this.options.endpoint,
@@ -1470,7 +1444,7 @@ class ProtoClientInternal {
1470
1444
  return proto.rebind(deserialize(res.data));
1471
1445
  }
1472
1446
  async currentUser(proto, options) {
1473
- const { serializeOpts, context, ...opts } = options ?? {};
1447
+ const { serializeOpts, ...opts } = options ?? {};
1474
1448
  const res = await this.service.request({
1475
1449
  method: 'get',
1476
1450
  baseURL: this.options.endpoint,
@@ -1484,7 +1458,7 @@ class ProtoClientInternal {
1484
1458
  return user ?? undefined;
1485
1459
  }
1486
1460
  async config(options) {
1487
- const { serializeOpts, context, ...opts } = options ?? {};
1461
+ const { serializeOpts, ...opts } = options ?? {};
1488
1462
  const res = await this.service.request({
1489
1463
  method: 'get',
1490
1464
  baseURL: this.options.endpoint,
@@ -1495,7 +1469,7 @@ class ProtoClientInternal {
1495
1469
  return deserialize(res.data);
1496
1470
  }
1497
1471
  async configAcl(options) {
1498
- const { serializeOpts, context, ...opts } = options ?? {};
1472
+ const { serializeOpts, ...opts } = options ?? {};
1499
1473
  const res = await this.service.request({
1500
1474
  method: 'get',
1501
1475
  baseURL: this.options.endpoint,
@@ -1506,7 +1480,7 @@ class ProtoClientInternal {
1506
1480
  return deserialize(res.data);
1507
1481
  }
1508
1482
  async setConfig(values, options) {
1509
- const { serializeOpts, context, acl, ...opts } = options ?? {};
1483
+ const { serializeOpts, acl, ...opts } = options ?? {};
1510
1484
  await this.service.request({
1511
1485
  method: 'post',
1512
1486
  baseURL: this.options.endpoint,
@@ -1517,7 +1491,7 @@ class ProtoClientInternal {
1517
1491
  });
1518
1492
  }
1519
1493
  async logout(options) {
1520
- const { serializeOpts, context, ...opts } = options ?? {};
1494
+ const { serializeOpts, ...opts } = options ?? {};
1521
1495
  await this.service.request({
1522
1496
  method: 'post',
1523
1497
  baseURL: this.options.endpoint,
@@ -1531,7 +1505,7 @@ class ProtoClientInternal {
1531
1505
  throw Error('Invalid user');
1532
1506
  if (_.isEmpty(password))
1533
1507
  throw Error('Invalid password');
1534
- const { serializeOpts, context, ...opts } = options ?? {};
1508
+ const { serializeOpts, ...opts } = options ?? {};
1535
1509
  await this.service.request({
1536
1510
  method: 'post',
1537
1511
  baseURL: this.options.endpoint,
@@ -1544,7 +1518,7 @@ class ProtoClientInternal {
1544
1518
  async unsetPassword(user, options) {
1545
1519
  if (!user.objectId)
1546
1520
  throw Error('Invalid user');
1547
- const { serializeOpts, context, ...opts } = options ?? {};
1521
+ const { serializeOpts, ...opts } = options ?? {};
1548
1522
  await this.service.request({
1549
1523
  method: 'post',
1550
1524
  baseURL: this.options.endpoint,
@@ -1554,7 +1528,7 @@ class ProtoClientInternal {
1554
1528
  });
1555
1529
  }
1556
1530
  async schema(options) {
1557
- const { serializeOpts, context, ...opts } = options ?? {};
1531
+ const { serializeOpts, ...opts } = options ?? {};
1558
1532
  const res = await this.service.request({
1559
1533
  method: 'get',
1560
1534
  baseURL: this.options.endpoint,
@@ -1577,7 +1551,7 @@ class ProtoClientInternal {
1577
1551
  return object;
1578
1552
  }
1579
1553
  async createFile(proto, object, options) {
1580
- const { serializeOpts, context, uploadToken, ...opts } = options ?? {};
1554
+ const { serializeOpts, uploadToken, ...opts } = options ?? {};
1581
1555
  const { data } = object[PVK].extra;
1582
1556
  if (_.isNil(data))
1583
1557
  throw Error('Invalid file object');
@@ -1631,7 +1605,7 @@ class ProtoClientInternal {
1631
1605
  return object;
1632
1606
  }
1633
1607
  fileData(proto, object, options) {
1634
- const { serializeOpts, context, ...opts } = options ?? {};
1608
+ const { serializeOpts, ...opts } = options ?? {};
1635
1609
  const filename = object.filename;
1636
1610
  if (_.isNil(filename))
1637
1611
  throw Error('Invalid filename');
@@ -1655,7 +1629,7 @@ class ProtoClientInternal {
1655
1629
  });
1656
1630
  }
1657
1631
  async notify(proto, data, options) {
1658
- const { serializeOpts, context, ...opts } = options ?? {};
1632
+ const { serializeOpts, ...opts } = options ?? {};
1659
1633
  await this.service.request({
1660
1634
  method: 'post',
1661
1635
  baseURL: this.options.endpoint,
@@ -1682,7 +1656,7 @@ class ProtoClientInternal {
1682
1656
  if (!object.objectId)
1683
1657
  throw Error('Invalid object');
1684
1658
  const request = async () => {
1685
- const { serializeOpts, context, ...opts } = options ?? {};
1659
+ const { serializeOpts, ...opts } = options ?? {};
1686
1660
  const res = await this.service.request({
1687
1661
  method: 'get',
1688
1662
  baseURL: this.options.endpoint,
@@ -1798,4 +1772,4 @@ class ProtoClient extends ProtoType {
1798
1772
  }
1799
1773
 
1800
1774
  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 };
1801
- //# sourceMappingURL=index-R0gbIGc-.mjs.map
1775
+ //# sourceMappingURL=index-BPbXumUi.mjs.map