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