proto.io 0.0.173 → 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 (48) hide show
  1. package/dist/adapters/file/database.d.ts +2 -2
  2. package/dist/adapters/file/database.js +2 -2
  3. package/dist/adapters/file/database.mjs +2 -2
  4. package/dist/adapters/file/filesystem.d.ts +2 -2
  5. package/dist/adapters/file/google-cloud-storage.d.ts +2 -2
  6. package/dist/adapters/storage/progres.d.ts +2 -2
  7. package/dist/adapters/storage/progres.js +3 -3
  8. package/dist/adapters/storage/progres.js.map +1 -1
  9. package/dist/adapters/storage/progres.mjs +3 -3
  10. package/dist/adapters/storage/progres.mjs.map +1 -1
  11. package/dist/client.d.ts +3 -3
  12. package/dist/client.js +2 -2
  13. package/dist/client.mjs +3 -3
  14. package/dist/index.d.ts +75 -3
  15. package/dist/index.js +121 -261
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.mjs +123 -263
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/internals/{index-Cpv1DoEI.d.ts → index-B9CWU0y7.d.ts} +32 -2
  20. package/dist/internals/index-B9CWU0y7.d.ts.map +1 -0
  21. package/dist/internals/{index-BZNPlw1L.mjs → index-BPbXumUi.mjs} +286 -44
  22. package/dist/internals/index-BPbXumUi.mjs.map +1 -0
  23. package/dist/internals/{index-BJnQhKf3.d.ts → index-BQqYdjaH.d.ts} +2 -2
  24. package/dist/internals/index-BQqYdjaH.d.ts.map +1 -0
  25. package/dist/internals/{index-lX-M76Tn.d.ts → index-BYZpj31o.d.ts} +1062 -33
  26. package/dist/internals/index-BYZpj31o.d.ts.map +1 -0
  27. package/dist/internals/{index-BYbMU-Ao.mjs → index-CTsc042s.mjs} +140 -2
  28. package/dist/internals/index-CTsc042s.mjs.map +1 -0
  29. package/dist/internals/{index-CIecB6mS.js → index-CvA0tbwx.js} +286 -44
  30. package/dist/internals/index-CvA0tbwx.js.map +1 -0
  31. package/dist/internals/{index-B1wqSio6.mjs → index-DHQhYGsJ.mjs} +2 -2
  32. package/dist/internals/{index-B1wqSio6.mjs.map → index-DHQhYGsJ.mjs.map} +1 -1
  33. package/dist/internals/{index-CVutVPmd.js → index-DXuW8UiB.js} +139 -1
  34. package/dist/internals/index-DXuW8UiB.js.map +1 -0
  35. package/dist/internals/{index-CzfsyXvb.js → index-Dc3V_Bzw.js} +2 -2
  36. package/dist/internals/{index-CzfsyXvb.js.map → index-Dc3V_Bzw.js.map} +1 -1
  37. package/dist/internals/{random-BCpwYpyw.mjs → random-BMQpRlGH.mjs} +3 -3
  38. package/dist/internals/{random-BCpwYpyw.mjs.map → random-BMQpRlGH.mjs.map} +1 -1
  39. package/dist/internals/{random-Dytum6Nh.js → random-DVOUDDGg.js} +3 -3
  40. package/dist/internals/{random-Dytum6Nh.js.map → random-DVOUDDGg.js.map} +1 -1
  41. package/package.json +1 -1
  42. package/dist/internals/index-BJnQhKf3.d.ts.map +0 -1
  43. package/dist/internals/index-BYbMU-Ao.mjs.map +0 -1
  44. package/dist/internals/index-BZNPlw1L.mjs.map +0 -1
  45. package/dist/internals/index-CIecB6mS.js.map +0 -1
  46. package/dist/internals/index-CVutVPmd.js.map +0 -1
  47. package/dist/internals/index-Cpv1DoEI.d.ts.map +0 -1
  48. package/dist/internals/index-lX-M76Tn.d.ts.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-CVutVPmd.js');
3
+ var index = require('./index-DXuW8UiB.js');
4
4
  var _ = require('lodash');
5
5
  var Decimal = require('decimal.js');
6
6
  var utilsJs = require('@o2ter/utils-js');
@@ -47,9 +47,17 @@ const mergeOpts = (lhs, rhs) => {
47
47
  },
48
48
  };
49
49
  };
50
+ /**
51
+ * Base class for query filters.
52
+ */
50
53
  class TQueryFilterBase {
51
54
  /** @internal */
52
55
  [_private.PVK] = { options: {} };
56
+ /**
57
+ * Applies a filter to the query.
58
+ * @param filter - The filter to apply.
59
+ * @returns The current instance for chaining.
60
+ */
53
61
  filter(filter) {
54
62
  if (_.isNil(this[_private.PVK].options.filter)) {
55
63
  this[_private.PVK].options.filter = filter;
@@ -62,70 +70,193 @@ class TQueryFilterBase {
62
70
  }
63
71
  return this;
64
72
  }
73
+ /**
74
+ * Applies an equality filter to the query.
75
+ * @param key - The key to filter.
76
+ * @param value - The value to filter.
77
+ * @returns The current instance for chaining.
78
+ */
65
79
  equalTo(key, value) {
66
80
  return this.filter({ [key]: { $eq: value ?? null } });
67
81
  }
82
+ /**
83
+ * Applies a not equal filter to the query.
84
+ * @param key - The key to filter.
85
+ * @param value - The value to filter.
86
+ * @returns The current instance for chaining.
87
+ */
68
88
  notEqualTo(key, value) {
69
89
  return this.filter({ [key]: { $ne: value ?? null } });
70
90
  }
91
+ /**
92
+ * Applies a less than filter to the query.
93
+ * @param key - The key to filter.
94
+ * @param value - The value to filter.
95
+ * @returns The current instance for chaining.
96
+ */
71
97
  lessThan(key, value) {
72
98
  return this.filter({ [key]: { $lt: value ?? null } });
73
99
  }
100
+ /**
101
+ * Applies a greater than filter to the query.
102
+ * @param key - The key to filter.
103
+ * @param value - The value to filter.
104
+ * @returns The current instance for chaining.
105
+ */
74
106
  greaterThan(key, value) {
75
107
  return this.filter({ [key]: { $gt: value ?? null } });
76
108
  }
109
+ /**
110
+ * Applies a less than or equal to filter to the query.
111
+ * @param key - The key to filter.
112
+ * @param value - The value to filter.
113
+ * @returns The current instance for chaining.
114
+ */
77
115
  lessThanOrEqualTo(key, value) {
78
116
  return this.filter({ [key]: { $lte: value ?? null } });
79
117
  }
118
+ /**
119
+ * Applies a greater than or equal to filter to the query.
120
+ * @param key - The key to filter.
121
+ * @param value - The value to filter.
122
+ * @returns The current instance for chaining.
123
+ */
80
124
  greaterThanOrEqualTo(key, value) {
81
125
  return this.filter({ [key]: { $gte: value ?? null } });
82
126
  }
127
+ /**
128
+ * Applies a pattern filter to the query.
129
+ * @param key - The key to filter.
130
+ * @param value - The pattern to filter.
131
+ * @returns The current instance for chaining.
132
+ */
83
133
  pattern(key, value) {
84
134
  return this.filter({ [key]: { $pattern: value ?? null } });
85
135
  }
136
+ /**
137
+ * Applies a starts with filter to the query.
138
+ * @param key - The key to filter.
139
+ * @param value - The value to filter.
140
+ * @returns The current instance for chaining.
141
+ */
86
142
  startsWith(key, value) {
87
143
  return this.filter({ [key]: { $starts: value ?? null } });
88
144
  }
145
+ /**
146
+ * Applies an ends with filter to the query.
147
+ * @param key - The key to filter.
148
+ * @param value - The value to filter.
149
+ * @returns The current instance for chaining.
150
+ */
89
151
  endsWith(key, value) {
90
152
  return this.filter({ [key]: { $ends: value ?? null } });
91
153
  }
154
+ /**
155
+ * Applies a size filter to the query.
156
+ * @param key - The key to filter.
157
+ * @param value - The value to filter.
158
+ * @returns The current instance for chaining.
159
+ */
92
160
  size(key, value) {
93
161
  return this.filter({ [key]: { $size: value } });
94
162
  }
163
+ /**
164
+ * Applies an empty filter to the query.
165
+ * @param key - The key to filter.
166
+ * @returns The current instance for chaining.
167
+ */
95
168
  empty(key) {
96
169
  return this.filter({ [key]: { $empty: true } });
97
170
  }
171
+ /**
172
+ * Applies a not empty filter to the query.
173
+ * @param key - The key to filter.
174
+ * @returns The current instance for chaining.
175
+ */
98
176
  notEmpty(key) {
99
177
  return this.filter({ [key]: { $empty: false } });
100
178
  }
179
+ /**
180
+ * Filters the query to include only documents where the specified key contains any of the specified values.
181
+ * @param key - The key to check for values.
182
+ * @param value - The array of values to check for.
183
+ * @returns The current instance for chaining.
184
+ */
101
185
  containsIn(key, value) {
102
186
  return this.filter({ [key]: { $in: value } });
103
187
  }
188
+ /**
189
+ * Filters the query to exclude documents where the specified key contains any of the specified values.
190
+ * @param key - The key to check for values.
191
+ * @param value - The array of values to exclude.
192
+ * @returns The current instance for chaining.
193
+ */
104
194
  notContainsIn(key, value) {
105
195
  return this.filter({ [key]: { $nin: value } });
106
196
  }
197
+ /**
198
+ * Filters the query to include only documents where the specified key is a subset of the specified values.
199
+ * @param key - The key to check for subset.
200
+ * @param value - The array of values to check against.
201
+ * @returns The current instance for chaining.
202
+ */
107
203
  isSubset(key, value) {
108
204
  return this.filter({ [key]: { $subset: value } });
109
205
  }
206
+ /**
207
+ * Filters the query to include only documents where the specified key is a superset of the specified values.
208
+ * @param key - The key to check for superset.
209
+ * @param value - The array of values to check against.
210
+ * @returns The current instance for chaining.
211
+ */
110
212
  isSuperset(key, value) {
111
213
  return this.filter({ [key]: { $superset: value } });
112
214
  }
215
+ /**
216
+ * Filters the query to include only documents where the specified key is disjoint from the specified values.
217
+ * @param key - The key to check for disjoint.
218
+ * @param value - The array of values to check against.
219
+ * @returns The current instance for chaining.
220
+ */
113
221
  isDisjoint(key, value) {
114
222
  return this.filter({ [key]: { $not: { $intersect: value } } });
115
223
  }
224
+ /**
225
+ * Filters the query to include only documents where the specified key intersects with the specified values.
226
+ * @param key - The key to check for intersection.
227
+ * @param value - The array of values to check against.
228
+ * @returns The current instance for chaining.
229
+ */
116
230
  isIntersect(key, value) {
117
231
  return this.filter({ [key]: { $intersect: value } });
118
232
  }
233
+ /**
234
+ * Filters the query to include only documents where every element of the specified key matches the provided callback query.
235
+ * @param key - The key to check for every element.
236
+ * @param callback - The callback query to apply to each element.
237
+ * @returns The current instance for chaining.
238
+ */
119
239
  every(key, callback) {
120
240
  const query = new TQueryFilterBase();
121
241
  callback(query);
122
242
  return this.filter({ [key]: { $every: { $and: _.castArray(query[_private.PVK].options.filter) } } });
123
243
  }
244
+ /**
245
+ * Filters the query to include only documents where some elements of the specified key match the provided callback query.
246
+ * @param key - The key to check for some elements.
247
+ * @param callback - The callback query to apply to each element.
248
+ * @returns The current instance for chaining.
249
+ */
124
250
  some(key, callback) {
125
251
  const query = new TQueryFilterBase();
126
252
  callback(query);
127
253
  return this.filter({ [key]: { $some: { $and: _.castArray(query[_private.PVK].options.filter) } } });
128
254
  }
255
+ /**
256
+ * Filters the query to include only documents that match all of the provided callback queries.
257
+ * @param callbacks - The callback queries to apply.
258
+ * @returns The current instance for chaining.
259
+ */
129
260
  and(...callbacks) {
130
261
  return this.filter({
131
262
  $and: _.flatMap(_.flatten(callbacks), callback => {
@@ -135,6 +266,11 @@ class TQueryFilterBase {
135
266
  }),
136
267
  });
137
268
  }
269
+ /**
270
+ * Filters the query to include only documents that match any of the provided callback queries.
271
+ * @param callbacks - The callback queries to apply.
272
+ * @returns The current instance for chaining.
273
+ */
138
274
  or(...callbacks) {
139
275
  return this.filter({
140
276
  $or: _.map(_.flatten(callbacks), callback => {
@@ -146,6 +282,11 @@ class TQueryFilterBase {
146
282
  }),
147
283
  });
148
284
  }
285
+ /**
286
+ * Filters the query to include only documents that do not match any of the provided callback queries.
287
+ * @param callbacks - The callback queries to apply.
288
+ * @returns The current instance for chaining.
289
+ */
149
290
  nor(...callbacks) {
150
291
  return this.filter({
151
292
  $nor: _.map(_.flatten(callbacks), callback => {
@@ -161,22 +302,43 @@ class TQueryFilterBase {
161
302
  class TQueryBase extends TQueryFilterBase {
162
303
  /** @internal */
163
304
  [_private.PVK] = { options: {} };
305
+ /**
306
+ * Sorts the query results.
307
+ * @param sort - The sorting criteria.
308
+ * @returns The current instance for chaining.
309
+ */
164
310
  sort(sort) {
165
311
  this[_private.PVK].options.sort = sort;
166
312
  return this;
167
313
  }
314
+ /**
315
+ * Skips the specified number of results.
316
+ * @param skip - The number of results to skip.
317
+ * @returns The current instance for chaining.
318
+ */
168
319
  skip(skip) {
169
320
  if (!_.isSafeInteger(skip) || skip < 0)
170
321
  throw Error('Invalid skip number');
171
322
  this[_private.PVK].options.skip = skip;
172
323
  return this;
173
324
  }
325
+ /**
326
+ * Limits the number of results.
327
+ * @param limit - The maximum number of results to return.
328
+ * @returns The current instance for chaining.
329
+ */
174
330
  limit(limit) {
175
331
  if (!_.isSafeInteger(limit) || limit < 0)
176
332
  throw Error('Invalid limit number');
177
333
  this[_private.PVK].options.limit = limit;
178
334
  return this;
179
335
  }
336
+ /**
337
+ * Performs a nested query on a specific key.
338
+ * @param key - The key to match.
339
+ * @param callback - The callback function to execute.
340
+ * @returns The current instance for chaining.
341
+ */
180
342
  match(key, callback) {
181
343
  const query = new TQueryBase();
182
344
  callback(query);
@@ -219,27 +381,62 @@ class TQueryBase extends TQueryFilterBase {
219
381
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
220
382
  // THE SOFTWARE.
221
383
  //
384
+ /**
385
+ * Abstract base class for queries.
386
+ */
222
387
  class TQuery extends TQueryBase {
223
388
  /** @internal */
224
389
  [_private.PVK] = { options: {} };
390
+ /**
391
+ * Adds fields to include in the query.
392
+ * @param includes - The fields to include.
393
+ * @returns The query instance.
394
+ */
225
395
  includes(...includes) {
226
396
  this[_private.PVK].options.includes = this[_private.PVK].options.includes ? [...this[_private.PVK].options.includes, ...includes] : includes;
227
397
  return this;
228
398
  }
399
+ /**
400
+ * Gets a record by its ID.
401
+ * @param id - The ID of the record.
402
+ * @param options - Extra options for the query.
403
+ * @returns A promise that resolves to the record or undefined.
404
+ */
229
405
  async get(id, options) {
230
406
  return _.first(await this.clone().equalTo('_id', id).limit(1).find(options));
231
407
  }
408
+ /**
409
+ * Gets the first record.
410
+ * @param options - Extra options for the query.
411
+ * @returns A promise that resolves to the first record or undefined.
412
+ */
232
413
  async first(options) {
233
414
  return _.first(await this.clone().limit(1).find(options));
234
415
  }
416
+ /**
417
+ * Gets a random record.
418
+ * @param opts - Options for the random selection.
419
+ * @param options - Extra options for the query.
420
+ * @returns A promise that resolves to the random record or undefined.
421
+ */
235
422
  async randomOne(opts, options) {
236
423
  return _.first(await this.clone().limit(1).random(opts, options));
237
424
  }
425
+ /**
426
+ * Checks if any records exist.
427
+ * @param options - Extra options for the query.
428
+ * @returns A promise that resolves to a boolean indicating if any records exist.
429
+ */
238
430
  async exists(options) {
239
431
  const query = this.clone();
240
432
  this[_private.PVK].options.includes = [];
241
433
  return !_.isNil(await query.limit(1).find(options));
242
434
  }
435
+ /**
436
+ * Iterates over each batch of records.
437
+ * @param callback - The callback to execute for each batch.
438
+ * @param options - Extra options for the query.
439
+ */
243
440
  async eachBatch(callback, options) {
244
441
  const sorting = this[_private.PVK].options.sort ?? {};
245
442
  const batchSize = options?.batchSize ?? 100;
@@ -255,6 +452,7 @@ class TQuery extends TQueryBase {
255
452
  const keys = _.keys(sorting);
256
453
  let batch = [];
257
454
  while (true) {
455
+ options?.abortSignal?.throwIfAborted();
258
456
  const q = _.isEmpty(batch) ? query : query.clone()
259
457
  .filter(keys.length > 1 ? {
260
458
  $expr: {
@@ -272,6 +470,11 @@ class TQuery extends TQueryBase {
272
470
  await callback(batch);
273
471
  }
274
472
  }
473
+ /**
474
+ * Iterates over each record.
475
+ * @param callback - The callback to execute for each record.
476
+ * @param options - Extra options for the query.
477
+ */
275
478
  async each(callback, options) {
276
479
  await this.eachBatch(async (batch) => {
277
480
  for (const object of batch) {
@@ -364,22 +567,46 @@ class TUser extends index.TObject {
364
567
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
365
568
  // THE SOFTWARE.
366
569
  //
570
+ /**
571
+ * Class representing a Role.
572
+ * @extends TObject
573
+ */
367
574
  class TRole extends index.TObject {
368
575
  constructor(attributes) {
369
576
  super('Role', attributes);
370
577
  }
578
+ /**
579
+ * Get the name of the role.
580
+ * @return {string | undefined} The name of the role.
581
+ */
371
582
  get name() {
372
583
  return this.get('name');
373
584
  }
585
+ /**
586
+ * Get the users associated with the role.
587
+ * @return {TUser[]} The users associated with the role.
588
+ */
374
589
  get users() {
375
590
  return this.get('users') ?? [];
376
591
  }
592
+ /**
593
+ * Set the users associated with the role.
594
+ * @param {TUser[]} value - The users to associate with the role.
595
+ */
377
596
  set users(value) {
378
597
  this.set('users', value);
379
598
  }
599
+ /**
600
+ * Get the roles associated with the role.
601
+ * @return {TRole[]} The roles associated with the role.
602
+ */
380
603
  get roles() {
381
604
  return this.get('roles') ?? [];
382
605
  }
606
+ /**
607
+ * Set the roles associated with the role.
608
+ * @param {TRole[]} value - The roles to associate with the role.
609
+ */
383
610
  set roles(value) {
384
611
  this.set('roles', value);
385
612
  }
@@ -409,19 +636,38 @@ class TRole extends index.TObject {
409
636
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
410
637
  // THE SOFTWARE.
411
638
  //
639
+ /**
640
+ * Class representing a file.
641
+ */
412
642
  class TFile extends index.TObject {
413
643
  constructor(attributes) {
414
644
  super('File', attributes);
415
645
  }
646
+ /**
647
+ * Gets the filename of the file.
648
+ * @returns The filename.
649
+ */
416
650
  get filename() {
417
651
  return this.get('filename');
418
652
  }
653
+ /**
654
+ * Gets the size of the file.
655
+ * @returns The size of the file.
656
+ */
419
657
  get size() {
420
658
  return this.get('size');
421
659
  }
660
+ /**
661
+ * Gets the type of the file.
662
+ * @returns The type of the file.
663
+ */
422
664
  get type() {
423
665
  return this.get('type');
424
666
  }
667
+ /**
668
+ * Gets the token of the file.
669
+ * @returns The token of the file.
670
+ */
425
671
  get token() {
426
672
  return this.get('token');
427
673
  }
@@ -655,6 +901,10 @@ const applyObjectMethods = (object, proto) => {
655
901
  // THE SOFTWARE.
656
902
  //
657
903
  class ProtoType {
904
+ /**
905
+ * Checks if the server is online.
906
+ * @returns A promise that resolves to a boolean indicating if the server is online.
907
+ */
658
908
  async online() {
659
909
  try {
660
910
  const res = await axios({
@@ -668,14 +918,32 @@ class ProtoType {
668
918
  return false;
669
919
  }
670
920
  }
921
+ /**
922
+ * Rebinds an object to the proto instance.
923
+ * @param object - The object to rebind.
924
+ * @returns The rebinded object.
925
+ */
671
926
  rebind(object) {
672
927
  return applyObjectMethods(object, this);
673
928
  }
929
+ /**
930
+ * Creates a new object.
931
+ * @param className - The name of the class to create.
932
+ * @param objectId - The ID of the object to create.
933
+ * @returns The created object.
934
+ */
674
935
  Object(className, objectId) {
675
936
  const attrs = objectId ? { _id: objectId } : {};
676
937
  const obj = isObjKey(className, TObjectTypes) ? new TObjectTypes[className](attrs) : new index.TObject(className, attrs);
677
938
  return this.rebind(obj);
678
939
  }
940
+ /**
941
+ * Creates a new file object.
942
+ * @param filename - The name of the file.
943
+ * @param data - The file data.
944
+ * @param type - The type of the file.
945
+ * @returns The created file object.
946
+ */
679
947
  File(filename, data, type) {
680
948
  const file = this.Object('File');
681
949
  file.set('filename', filename);
@@ -849,7 +1117,7 @@ class _ProtoClientQuery extends TQuery {
849
1117
  };
850
1118
  }
851
1119
  _requestOpt(options) {
852
- const { context, ...opts } = options ?? {};
1120
+ const { ...opts } = options ?? {};
853
1121
  return {
854
1122
  method: 'post',
855
1123
  url: this.url,
@@ -862,24 +1130,18 @@ class _ProtoClientQuery extends TQuery {
862
1130
  explain(options) {
863
1131
  return this._proto[_private.PVK].request(this._proto, {
864
1132
  operation: 'explain',
865
- context: options?.context ?? {},
866
- silent: options?.silent,
867
1133
  ...this._queryOptions,
868
1134
  }, this._requestOpt(options));
869
1135
  }
870
1136
  count(options) {
871
1137
  return this._proto[_private.PVK].request(this._proto, {
872
1138
  operation: 'count',
873
- context: options?.context ?? {},
874
- silent: options?.silent,
875
1139
  ...this._queryOptions,
876
1140
  }, this._requestOpt(options));
877
1141
  }
878
1142
  find(options) {
879
1143
  const request = () => this._proto[_private.PVK].request(this._proto, {
880
1144
  operation: 'find',
881
- context: options?.context ?? {},
882
- silent: options?.silent,
883
1145
  ...this._queryOptions,
884
1146
  }, this._requestOpt(options));
885
1147
  return utilsJs.asyncStream(request);
@@ -887,8 +1149,6 @@ class _ProtoClientQuery extends TQuery {
887
1149
  random(opts, options) {
888
1150
  const request = () => this._proto[_private.PVK].request(this._proto, {
889
1151
  operation: 'random',
890
- context: options?.context ?? {},
891
- silent: options?.silent,
892
1152
  random: opts,
893
1153
  ...this._queryOptions,
894
1154
  }, this._requestOpt(options));
@@ -897,8 +1157,6 @@ class _ProtoClientQuery extends TQuery {
897
1157
  nonrefs(options) {
898
1158
  const request = () => this._proto[_private.PVK].request(this._proto, {
899
1159
  operation: 'nonrefs',
900
- context: options?.context ?? {},
901
- silent: options?.silent,
902
1160
  ...this._queryOptions,
903
1161
  }, this._requestOpt(options));
904
1162
  return utilsJs.asyncStream(request);
@@ -906,8 +1164,6 @@ class _ProtoClientQuery extends TQuery {
906
1164
  insert(attrs, options) {
907
1165
  return this._proto[_private.PVK].request(this._proto, {
908
1166
  operation: 'insert',
909
- context: options?.context ?? {},
910
- silent: options?.silent,
911
1167
  attributes: attrs,
912
1168
  ...this._queryOptions,
913
1169
  }, this._requestOpt(options));
@@ -915,8 +1171,6 @@ class _ProtoClientQuery extends TQuery {
915
1171
  insertMany(values, options) {
916
1172
  return this._proto[_private.PVK].request(this._proto, {
917
1173
  operation: 'insertMany',
918
- context: options?.context ?? {},
919
- silent: options?.silent,
920
1174
  attributes: values,
921
1175
  ...this._queryOptions,
922
1176
  }, this._requestOpt(options));
@@ -924,8 +1178,6 @@ class _ProtoClientQuery extends TQuery {
924
1178
  updateOne(update, options) {
925
1179
  return this._proto[_private.PVK].request(this._proto, {
926
1180
  operation: 'updateOne',
927
- context: options?.context ?? {},
928
- silent: options?.silent,
929
1181
  update,
930
1182
  ...this._queryOptions,
931
1183
  }, this._requestOpt(options));
@@ -933,8 +1185,6 @@ class _ProtoClientQuery extends TQuery {
933
1185
  updateMany(update, options) {
934
1186
  return this._proto[_private.PVK].request(this._proto, {
935
1187
  operation: 'updateMany',
936
- context: options?.context ?? {},
937
- silent: options?.silent,
938
1188
  update,
939
1189
  ...this._queryOptions,
940
1190
  }, this._requestOpt(options));
@@ -942,8 +1192,6 @@ class _ProtoClientQuery extends TQuery {
942
1192
  upsertOne(update, setOnInsert, options) {
943
1193
  return this._proto[_private.PVK].request(this._proto, {
944
1194
  operation: 'upsertOne',
945
- context: options?.context ?? {},
946
- silent: options?.silent,
947
1195
  update,
948
1196
  setOnInsert,
949
1197
  ...this._queryOptions,
@@ -952,8 +1200,6 @@ class _ProtoClientQuery extends TQuery {
952
1200
  upsertMany(update, setOnInsert, options) {
953
1201
  return this._proto[_private.PVK].request(this._proto, {
954
1202
  operation: 'upsertMany',
955
- context: options?.context ?? {},
956
- silent: options?.silent,
957
1203
  update,
958
1204
  setOnInsert,
959
1205
  ...this._queryOptions,
@@ -962,16 +1208,12 @@ class _ProtoClientQuery extends TQuery {
962
1208
  deleteOne(options) {
963
1209
  return this._proto[_private.PVK].request(this._proto, {
964
1210
  operation: 'deleteOne',
965
- context: options?.context ?? {},
966
- silent: options?.silent,
967
1211
  ...this._queryOptions,
968
1212
  }, this._requestOpt(options));
969
1213
  }
970
1214
  deleteMany(options) {
971
1215
  return this._proto[_private.PVK].request(this._proto, {
972
1216
  operation: 'deleteMany',
973
- context: options?.context ?? {},
974
- silent: options?.silent,
975
1217
  ...this._queryOptions,
976
1218
  }, this._requestOpt(options));
977
1219
  }
@@ -1062,7 +1304,7 @@ class Service {
1062
1304
  }
1063
1305
  }
1064
1306
  async _request(config, retry = 0) {
1065
- const { master, abortSignal, serializeOpts, context, headers, ...opts } = config ?? {};
1307
+ const { master, abortSignal, serializeOpts, headers, ...opts } = config ?? {};
1066
1308
  const res = await this.service.request({
1067
1309
  signal: abortSignal,
1068
1310
  headers: {
@@ -1180,7 +1422,7 @@ class ProtoClientInternal {
1180
1422
  this.service = new Service(this, options.axiosOptions);
1181
1423
  }
1182
1424
  async request(proto, data, options) {
1183
- const { serializeOpts, context, ...opts } = options ?? {};
1425
+ const { serializeOpts, ...opts } = options ?? {};
1184
1426
  const res = await this.service.request({
1185
1427
  baseURL: this.options.endpoint,
1186
1428
  data: serialize(data, serializeOpts),
@@ -1193,7 +1435,7 @@ class ProtoClientInternal {
1193
1435
  this.service.setSessionToken(token);
1194
1436
  }
1195
1437
  async sessionInfo(proto, options) {
1196
- const { serializeOpts, context, ...opts } = options ?? {};
1438
+ const { serializeOpts, ...opts } = options ?? {};
1197
1439
  const res = await this.service.request({
1198
1440
  method: 'get',
1199
1441
  baseURL: this.options.endpoint,
@@ -1204,7 +1446,7 @@ class ProtoClientInternal {
1204
1446
  return proto.rebind(deserialize(res.data));
1205
1447
  }
1206
1448
  async currentUser(proto, options) {
1207
- const { serializeOpts, context, ...opts } = options ?? {};
1449
+ const { serializeOpts, ...opts } = options ?? {};
1208
1450
  const res = await this.service.request({
1209
1451
  method: 'get',
1210
1452
  baseURL: this.options.endpoint,
@@ -1218,7 +1460,7 @@ class ProtoClientInternal {
1218
1460
  return user ?? undefined;
1219
1461
  }
1220
1462
  async config(options) {
1221
- const { serializeOpts, context, ...opts } = options ?? {};
1463
+ const { serializeOpts, ...opts } = options ?? {};
1222
1464
  const res = await this.service.request({
1223
1465
  method: 'get',
1224
1466
  baseURL: this.options.endpoint,
@@ -1229,7 +1471,7 @@ class ProtoClientInternal {
1229
1471
  return deserialize(res.data);
1230
1472
  }
1231
1473
  async configAcl(options) {
1232
- const { serializeOpts, context, ...opts } = options ?? {};
1474
+ const { serializeOpts, ...opts } = options ?? {};
1233
1475
  const res = await this.service.request({
1234
1476
  method: 'get',
1235
1477
  baseURL: this.options.endpoint,
@@ -1240,7 +1482,7 @@ class ProtoClientInternal {
1240
1482
  return deserialize(res.data);
1241
1483
  }
1242
1484
  async setConfig(values, options) {
1243
- const { serializeOpts, context, acl, ...opts } = options ?? {};
1485
+ const { serializeOpts, acl, ...opts } = options ?? {};
1244
1486
  await this.service.request({
1245
1487
  method: 'post',
1246
1488
  baseURL: this.options.endpoint,
@@ -1251,7 +1493,7 @@ class ProtoClientInternal {
1251
1493
  });
1252
1494
  }
1253
1495
  async logout(options) {
1254
- const { serializeOpts, context, ...opts } = options ?? {};
1496
+ const { serializeOpts, ...opts } = options ?? {};
1255
1497
  await this.service.request({
1256
1498
  method: 'post',
1257
1499
  baseURL: this.options.endpoint,
@@ -1265,7 +1507,7 @@ class ProtoClientInternal {
1265
1507
  throw Error('Invalid user');
1266
1508
  if (_.isEmpty(password))
1267
1509
  throw Error('Invalid password');
1268
- const { serializeOpts, context, ...opts } = options ?? {};
1510
+ const { serializeOpts, ...opts } = options ?? {};
1269
1511
  await this.service.request({
1270
1512
  method: 'post',
1271
1513
  baseURL: this.options.endpoint,
@@ -1278,7 +1520,7 @@ class ProtoClientInternal {
1278
1520
  async unsetPassword(user, options) {
1279
1521
  if (!user.objectId)
1280
1522
  throw Error('Invalid user');
1281
- const { serializeOpts, context, ...opts } = options ?? {};
1523
+ const { serializeOpts, ...opts } = options ?? {};
1282
1524
  await this.service.request({
1283
1525
  method: 'post',
1284
1526
  baseURL: this.options.endpoint,
@@ -1288,7 +1530,7 @@ class ProtoClientInternal {
1288
1530
  });
1289
1531
  }
1290
1532
  async schema(options) {
1291
- const { serializeOpts, context, ...opts } = options ?? {};
1533
+ const { serializeOpts, ...opts } = options ?? {};
1292
1534
  const res = await this.service.request({
1293
1535
  method: 'get',
1294
1536
  baseURL: this.options.endpoint,
@@ -1311,7 +1553,7 @@ class ProtoClientInternal {
1311
1553
  return object;
1312
1554
  }
1313
1555
  async createFile(proto, object, options) {
1314
- const { serializeOpts, context, uploadToken, ...opts } = options ?? {};
1556
+ const { serializeOpts, uploadToken, ...opts } = options ?? {};
1315
1557
  const { data } = object[_private.PVK].extra;
1316
1558
  if (_.isNil(data))
1317
1559
  throw Error('Invalid file object');
@@ -1365,7 +1607,7 @@ class ProtoClientInternal {
1365
1607
  return object;
1366
1608
  }
1367
1609
  fileData(proto, object, options) {
1368
- const { serializeOpts, context, ...opts } = options ?? {};
1610
+ const { serializeOpts, ...opts } = options ?? {};
1369
1611
  const filename = object.filename;
1370
1612
  if (_.isNil(filename))
1371
1613
  throw Error('Invalid filename');
@@ -1389,7 +1631,7 @@ class ProtoClientInternal {
1389
1631
  });
1390
1632
  }
1391
1633
  async notify(proto, data, options) {
1392
- const { serializeOpts, context, ...opts } = options ?? {};
1634
+ const { serializeOpts, ...opts } = options ?? {};
1393
1635
  await this.service.request({
1394
1636
  method: 'post',
1395
1637
  baseURL: this.options.endpoint,
@@ -1416,7 +1658,7 @@ class ProtoClientInternal {
1416
1658
  if (!object.objectId)
1417
1659
  throw Error('Invalid object');
1418
1660
  const request = async () => {
1419
- const { serializeOpts, context, ...opts } = options ?? {};
1661
+ const { serializeOpts, ...opts } = options ?? {};
1420
1662
  const res = await this.service.request({
1421
1663
  method: 'get',
1422
1664
  baseURL: this.options.endpoint,
@@ -1547,4 +1789,4 @@ exports.isQuery = isQuery;
1547
1789
  exports.isRole = isRole;
1548
1790
  exports.isUser = isUser;
1549
1791
  exports.serialize = serialize;
1550
- //# sourceMappingURL=index-CIecB6mS.js.map
1792
+ //# sourceMappingURL=index-CvA0tbwx.js.map