proto.io 0.0.147 → 0.0.149

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 (50) 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 +3 -1
  7. package/dist/adapters/storage/progres.js +6 -3
  8. package/dist/adapters/storage/progres.js.map +1 -1
  9. package/dist/adapters/storage/progres.mjs +6 -3
  10. package/dist/adapters/storage/progres.mjs.map +1 -1
  11. package/dist/client.d.ts +3 -5
  12. package/dist/client.js +2 -2
  13. package/dist/client.mjs +3 -3
  14. package/dist/index.d.ts +3 -5
  15. package/dist/index.js +73 -64
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.mjs +74 -65
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/internals/{index-EOtjV6U_.mjs → index-BmRuvHVZ.mjs} +11 -1
  20. package/dist/internals/index-BmRuvHVZ.mjs.map +1 -0
  21. package/dist/internals/index-BqFdBhFc.js.map +1 -1
  22. package/dist/internals/{index-BDB4idmt.d.ts → index-BuXVzVd8.d.ts} +3 -2
  23. package/dist/internals/index-BuXVzVd8.d.ts.map +1 -0
  24. package/dist/internals/index-CKgKjs8z.d.ts +60 -0
  25. package/dist/internals/index-CKgKjs8z.d.ts.map +1 -0
  26. package/dist/internals/{index-DZS2c96L.js → index-CSNRyhjB.js} +2 -2
  27. package/dist/internals/{index-DZS2c96L.js.map → index-CSNRyhjB.js.map} +1 -1
  28. package/dist/internals/{index-C6zdNpc_.js → index-CVutVPmd.js} +11 -1
  29. package/dist/internals/{index-C6zdNpc_.js.map → index-CVutVPmd.js.map} +1 -1
  30. package/dist/internals/{index-CT01T3qs.js → index-D1YGwuNK.js} +26 -4
  31. package/dist/internals/index-D1YGwuNK.js.map +1 -0
  32. package/dist/internals/{index-BWztjrw_.d.ts → index-DnREUbmG.d.ts} +9 -90
  33. package/dist/internals/index-DnREUbmG.d.ts.map +1 -0
  34. package/dist/internals/index-be1VYBY2.mjs.map +1 -1
  35. package/dist/internals/{index-Do-zNOpD.mjs → index-c-CaNuVY.mjs} +26 -4
  36. package/dist/internals/index-c-CaNuVY.mjs.map +1 -0
  37. package/dist/internals/{index-DTZ5uRgF.mjs → index-tU-lsQqj.mjs} +2 -2
  38. package/dist/internals/{index-DTZ5uRgF.mjs.map → index-tU-lsQqj.mjs.map} +1 -1
  39. package/dist/internals/{random-XGNkddOu.js → random-DBDmz54D.js} +3 -3
  40. package/dist/internals/{random-XGNkddOu.js.map → random-DBDmz54D.js.map} +1 -1
  41. package/dist/internals/{random-BjV_01xP.mjs → random-KZTFMK9-.mjs} +3 -3
  42. package/dist/internals/{random-BjV_01xP.mjs.map → random-KZTFMK9-.mjs.map} +1 -1
  43. package/package.json +4 -4
  44. package/dist/internals/index-BDB4idmt.d.ts.map +0 -1
  45. package/dist/internals/index-BWztjrw_.d.ts.map +0 -1
  46. package/dist/internals/index-CT01T3qs.js.map +0 -1
  47. package/dist/internals/index-Do-zNOpD.mjs.map +0 -1
  48. package/dist/internals/index-EOtjV6U_.mjs.map +0 -1
  49. package/dist/internals/index-bbPCIbir.d.ts +0 -116
  50. package/dist/internals/index-bbPCIbir.d.ts.map +0 -1
package/dist/client.d.ts CHANGED
@@ -1,12 +1,10 @@
1
- import { P as ProtoClient } from './internals/index-bbPCIbir.js';
2
- export { c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-bbPCIbir.js';
1
+ import { P as ProtoClient } from './internals/index-CKgKjs8z.js';
2
+ export { c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-CKgKjs8z.js';
3
3
  export { Decimal } from 'decimal.js';
4
- export { D as DeserializeOptions, S as SerializeOptions, d as TSerializable, e as deserialize, s as serialize } from './internals/index-BWztjrw_.js';
4
+ export { D as DeserializeOptions, S as SerializeOptions, d as TSerializable, e as deserialize, s as serialize } from './internals/index-DnREUbmG.js';
5
5
  import '@o2ter/utils-js';
6
6
  import 'socket.io-client';
7
7
  import '@socket.io/component-emitter';
8
- import 'stream';
9
- import 'axios';
10
8
  import 'jsonwebtoken';
11
9
  import '@o2ter/server-js';
12
10
  import 'lodash';
package/dist/client.js CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./internals/index-CT01T3qs.js');
5
+ var index = require('./internals/index-D1YGwuNK.js');
6
6
  var Decimal = require('decimal.js');
7
- require('./internals/index-C6zdNpc_.js');
7
+ require('./internals/index-CVutVPmd.js');
8
8
  require('lodash');
9
9
  require('./internals/private-CSB1Ep4g.js');
10
10
  require('@o2ter/utils-js');
package/dist/client.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { c as ProtoClient } from './internals/index-Do-zNOpD.mjs';
2
- export { e as classExtends, d as deserialize, j as isFile, f as isObject, i as isQuery, h as isRole, g as isUser, s as serialize } from './internals/index-Do-zNOpD.mjs';
1
+ import { c as ProtoClient } from './internals/index-c-CaNuVY.mjs';
2
+ export { e as classExtends, d as deserialize, j as isFile, f as isObject, i as isQuery, h as isRole, g as isUser, s as serialize } from './internals/index-c-CaNuVY.mjs';
3
3
  export { Decimal } from 'decimal.js';
4
- import './internals/index-EOtjV6U_.mjs';
4
+ import './internals/index-BmRuvHVZ.mjs';
5
5
  import 'lodash';
6
6
  import './internals/private-BUpLAMZi.mjs';
7
7
  import '@o2ter/utils-js';
package/dist/index.d.ts CHANGED
@@ -2,19 +2,17 @@ import * as socket_io from 'socket.io';
2
2
  import * as socket_io_dist_typed_events from 'socket.io/dist/typed-events';
3
3
  import * as express_serve_static_core from 'express-serve-static-core';
4
4
  import { Server, RequestHandler } from '@o2ter/server-js';
5
- import { T as TSchema, _ as _TValue, P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions } from './internals/index-BWztjrw_.js';
6
- export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-BWztjrw_.js';
5
+ import { T as TSchema, _ as _TValue, P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions } from './internals/index-DnREUbmG.js';
6
+ export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-DnREUbmG.js';
7
7
  import Decimal from 'decimal.js';
8
8
  export { Decimal } from 'decimal.js';
9
- export { P as ProtoClient, c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-bbPCIbir.js';
9
+ export { P as ProtoClient, c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-CKgKjs8z.js';
10
10
  import '@o2ter/utils-js';
11
11
  import 'jsonwebtoken';
12
12
  import 'lodash';
13
13
  import 'node:stream';
14
14
  import 'socket.io-client';
15
15
  import '@socket.io/component-emitter';
16
- import 'stream';
17
- import 'axios';
18
16
 
19
17
  declare const schema: ((x: Record<string, TSchema>) => Record<string, TSchema>) & {
20
18
  boolean: (defaultValue?: boolean) => {
package/dist/index.js CHANGED
@@ -4,18 +4,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _ = require('lodash');
6
6
  var serverJs = require('@o2ter/server-js');
7
- var random = require('./internals/random-XGNkddOu.js');
7
+ var random = require('./internals/random-DBDmz54D.js');
8
8
  var _private = require('./internals/private-CSB1Ep4g.js');
9
9
  var utilsJs = require('@o2ter/utils-js');
10
- var index = require('./internals/index-CT01T3qs.js');
11
- var index$1 = require('./internals/index-C6zdNpc_.js');
10
+ var index = require('./internals/index-D1YGwuNK.js');
11
+ var index$1 = require('./internals/index-CVutVPmd.js');
12
12
  var jwt = require('jsonwebtoken');
13
13
  var node_buffer = require('node:buffer');
14
14
  var node_stream = require('node:stream');
15
15
  var node_crypto = require('node:crypto');
16
16
  var util = require('util');
17
17
  var cryptoJs = require('@o2ter/crypto-js');
18
- var index$2 = require('./internals/index-DZS2c96L.js');
18
+ var index$2 = require('./internals/index-CSNRyhjB.js');
19
19
  var queryType = require('query-types');
20
20
  var busboy = require('busboy');
21
21
  var Decimal = require('decimal.js');
@@ -138,12 +138,22 @@ const dispatcher = (proto, options, disableSecurity) => {
138
138
  const _matches = _validator.decodeMatches(options.className, options.matches ?? {}, _includes);
139
139
  if (!_validator.validateCLPs(options.className, 'create'))
140
140
  throw Error('No permission');
141
- return proto.storage.atomic((storage) => storage.insert({
142
- className: options.className,
143
- includes: _includes,
144
- matches: _matches,
145
- objectIdSize: proto[_private.PVK].options.objectIdSize
146
- }, normalize(_validator.validateFields(options.className, attrs, 'create', random.QueryValidator.patterns.name))), { lockTable: options.className });
141
+ const _attrs = normalize(_validator.validateFields(options.className, attrs, 'create', random.QueryValidator.patterns.path));
142
+ while (true) {
143
+ try {
144
+ return await proto.storage.atomic((storage) => storage.insert({
145
+ className: options.className,
146
+ includes: _includes,
147
+ matches: _matches,
148
+ objectIdSize: proto[_private.PVK].options.objectIdSize
149
+ }, _attrs), { lockTable: options.className });
150
+ }
151
+ catch (e) {
152
+ if (proto.storage.isDuplicateIdError(e))
153
+ continue;
154
+ throw e;
155
+ }
156
+ }
147
157
  },
148
158
  async insertMany(options, values) {
149
159
  random.QueryValidator.recursiveCheck(values);
@@ -152,12 +162,22 @@ const dispatcher = (proto, options, disableSecurity) => {
152
162
  const _matches = _validator.decodeMatches(options.className, options.matches ?? {}, _includes);
153
163
  if (!_validator.validateCLPs(options.className, 'create'))
154
164
  throw Error('No permission');
155
- return proto.storage.atomic((storage) => storage.insertMany({
156
- className: options.className,
157
- includes: _includes,
158
- matches: _matches,
159
- objectIdSize: proto[_private.PVK].options.objectIdSize
160
- }, normalize(_.map(values, attr => _validator.validateFields(options.className, attr, 'create', random.QueryValidator.patterns.name)))), { lockTable: options.className });
165
+ const _attrs = normalize(_.map(values, attr => _validator.validateFields(options.className, attr, 'create', random.QueryValidator.patterns.path)));
166
+ while (true) {
167
+ try {
168
+ return await proto.storage.atomic((storage) => storage.insertMany({
169
+ className: options.className,
170
+ includes: _includes,
171
+ matches: _matches,
172
+ objectIdSize: proto[_private.PVK].options.objectIdSize
173
+ }, _attrs), { lockTable: options.className });
174
+ }
175
+ catch (e) {
176
+ if (proto.storage.isDuplicateIdError(e))
177
+ continue;
178
+ throw e;
179
+ }
180
+ }
161
181
  },
162
182
  async updateOne(query, update) {
163
183
  random.QueryValidator.recursiveCheck(query, update);
@@ -171,7 +191,19 @@ const dispatcher = (proto, options, disableSecurity) => {
171
191
  const _validator = await validator();
172
192
  if (!_validator.validateCLPs(query.className, 'create', 'update'))
173
193
  throw Error('No permission');
174
- return proto.storage.atomic((storage) => storage.upsertOne(_validator.decodeQuery(normalize(query), 'update'), normalize(_validator.validateFields(query.className, update, 'update', random.QueryValidator.patterns.path)), normalize(_validator.validateFields(query.className, setOnInsert, 'create', random.QueryValidator.patterns.name))));
194
+ const _query = _validator.decodeQuery(normalize(query), 'update');
195
+ const _update = normalize(_validator.validateFields(query.className, update, 'update', random.QueryValidator.patterns.path));
196
+ const _setOnInsert = normalize(_validator.validateFields(query.className, setOnInsert, 'create', random.QueryValidator.patterns.name));
197
+ while (true) {
198
+ try {
199
+ return await proto.storage.atomic((storage) => storage.upsertOne(_query, _update, _setOnInsert));
200
+ }
201
+ catch (e) {
202
+ if (proto.storage.isDuplicateIdError(e))
203
+ continue;
204
+ throw e;
205
+ }
206
+ }
175
207
  },
176
208
  async deleteOne(query) {
177
209
  random.QueryValidator.recursiveCheck(query);
@@ -319,9 +351,10 @@ class ProtoQuery extends index.TQuery {
319
351
  });
320
352
  }
321
353
  async insert(attrs, options) {
322
- const beforeSave = this._proto[_private.PVK].triggers?.beforeSave?.[this.className];
323
- const afterSave = this._proto[_private.PVK].triggers?.afterSave?.[this.className];
324
354
  const context = options?.context ?? {};
355
+ const silent = _.castArray(options?.silent ?? []);
356
+ const beforeSave = _.includes(silent, 'beforeSave') ? null : this._proto[_private.PVK].triggers?.beforeSave?.[this.className];
357
+ const afterSave = _.includes(silent, 'afterSave') ? null : this._proto[_private.PVK].triggers?.afterSave?.[this.className];
325
358
  const object = this._proto.Object(this.className);
326
359
  for (const [key, value] of _.toPairs(attrs)) {
327
360
  object[_private.PVK].mutated[key] = { $set: value };
@@ -332,7 +365,7 @@ class ProtoQuery extends index.TQuery {
332
365
  className: this.className,
333
366
  includes: this[_private.PVK].options.includes,
334
367
  matches: this[_private.PVK].options.matches,
335
- }, _.fromPairs([...object.entries()])));
368
+ }, _.fromPairs([...object._set_entries()])));
336
369
  if (!result)
337
370
  throw Error('Unable to insert document');
338
371
  if (_.isFunction(afterSave)) {
@@ -341,9 +374,10 @@ class ProtoQuery extends index.TQuery {
341
374
  return result;
342
375
  }
343
376
  async insertMany(values, options) {
344
- const beforeSave = this._proto[_private.PVK].triggers?.beforeSave?.[this.className];
345
- const afterSave = this._proto[_private.PVK].triggers?.afterSave?.[this.className];
346
377
  const context = options?.context ?? {};
378
+ const silent = _.castArray(options?.silent ?? []);
379
+ const beforeSave = _.includes(silent, 'beforeSave') ? null : this._proto[_private.PVK].triggers?.beforeSave?.[this.className];
380
+ const afterSave = _.includes(silent, 'afterSave') ? null : this._proto[_private.PVK].triggers?.afterSave?.[this.className];
347
381
  if (_.isFunction(beforeSave) || _.isFunction(afterSave)) {
348
382
  const objects = _.map(values, attr => {
349
383
  const object = this._proto.Object(this.className);
@@ -361,7 +395,7 @@ class ProtoQuery extends index.TQuery {
361
395
  className: this.className,
362
396
  includes: this[_private.PVK].options.includes,
363
397
  matches: this[_private.PVK].options.matches,
364
- }, _.map(objects, x => _.fromPairs([...x.entries()])));
398
+ }, _.map(objects, x => _.fromPairs([...x._set_entries()])));
365
399
  if (_.isFunction(afterSave)) {
366
400
  await Promise.all(_.map(objects, object => afterSave(proxy(Object.setPrototypeOf({ object, context }, options?.session ?? this._proto)))));
367
401
  }
@@ -374,9 +408,10 @@ class ProtoQuery extends index.TQuery {
374
408
  }, values);
375
409
  }
376
410
  async updateOne(update, options) {
377
- const beforeSave = this._proto[_private.PVK].triggers?.beforeSave?.[this.className];
378
- const afterSave = this._proto[_private.PVK].triggers?.afterSave?.[this.className];
379
411
  const context = options?.context ?? {};
412
+ const silent = _.castArray(options?.silent ?? []);
413
+ const beforeSave = _.includes(silent, 'beforeSave') ? null : this._proto[_private.PVK].triggers?.beforeSave?.[this.className];
414
+ const afterSave = _.includes(silent, 'afterSave') ? null : this._proto[_private.PVK].triggers?.afterSave?.[this.className];
380
415
  if (_.isFunction(beforeSave)) {
381
416
  const object = this._objectMethods(_.first(await utilsJs.asyncIterableToArray(this._dispatcher(options).find({ ...this._queryOptions, limit: 1 }))));
382
417
  if (!object)
@@ -392,9 +427,10 @@ class ProtoQuery extends index.TQuery {
392
427
  return result;
393
428
  }
394
429
  async upsertOne(update, setOnInsert, options) {
395
- const beforeSave = this._proto[_private.PVK].triggers?.beforeSave?.[this.className];
396
- const afterSave = this._proto[_private.PVK].triggers?.afterSave?.[this.className];
397
430
  const context = options?.context ?? {};
431
+ const silent = _.castArray(options?.silent ?? []);
432
+ const beforeSave = _.includes(silent, 'beforeSave') ? null : this._proto[_private.PVK].triggers?.beforeSave?.[this.className];
433
+ const afterSave = _.includes(silent, 'afterSave') ? null : this._proto[_private.PVK].triggers?.afterSave?.[this.className];
398
434
  if (_.isFunction(beforeSave)) {
399
435
  let object = this._objectMethods(_.first(await utilsJs.asyncIterableToArray(this._dispatcher(options).find({ ...this._queryOptions, limit: 1 }))));
400
436
  if (object) {
@@ -429,9 +465,10 @@ class ProtoQuery extends index.TQuery {
429
465
  return result;
430
466
  }
431
467
  async deleteOne(options) {
432
- const beforeDelete = this._proto[_private.PVK].triggers?.beforeDelete?.[this.className];
433
- const afterDelete = this._proto[_private.PVK].triggers?.afterDelete?.[this.className];
434
468
  const context = options?.context ?? {};
469
+ const silent = _.castArray(options?.silent ?? []);
470
+ const beforeDelete = _.includes(silent, 'beforeDelete') ? null : this._proto[_private.PVK].triggers?.beforeDelete?.[this.className];
471
+ const afterDelete = _.includes(silent, 'afterDelete') ? null : this._proto[_private.PVK].triggers?.afterDelete?.[this.className];
435
472
  let result;
436
473
  if (_.isFunction(beforeDelete)) {
437
474
  const object = this._objectMethods(_.first(await utilsJs.asyncIterableToArray(this._dispatcher(options).find({ ...this._queryOptions, limit: 1 }))));
@@ -452,9 +489,10 @@ class ProtoQuery extends index.TQuery {
452
489
  return result;
453
490
  }
454
491
  async deleteMany(options) {
455
- const beforeDelete = this._proto[_private.PVK].triggers?.beforeDelete?.[this.className];
456
- const afterDelete = this._proto[_private.PVK].triggers?.afterDelete?.[this.className];
457
492
  const context = options?.context ?? {};
493
+ const silent = _.castArray(options?.silent ?? []);
494
+ const beforeDelete = _.includes(silent, 'beforeDelete') ? null : this._proto[_private.PVK].triggers?.beforeDelete?.[this.className];
495
+ const afterDelete = _.includes(silent, 'afterDelete') ? null : this._proto[_private.PVK].triggers?.afterDelete?.[this.className];
458
496
  if (_.isFunction(beforeDelete) || _.isFunction(afterDelete)) {
459
497
  const objects = this._objectMethods(await utilsJs.asyncIterableToArray(this._dispatcher(options).find(this._queryOptions)));
460
498
  if (_.isEmpty(objects))
@@ -914,7 +952,7 @@ class ProtoInternal {
914
952
  object.set('nonce', nonce);
915
953
  const created = await proto.Query('File')
916
954
  .includes(...object.keys())
917
- .insert(_.fromPairs([...object.entries()]), options);
955
+ .insert(_.fromPairs([...object._set_entries()]), options);
918
956
  if (created) {
919
957
  object[_private.PVK].attributes = created.attributes;
920
958
  object[_private.PVK].mutated = {};
@@ -928,31 +966,16 @@ class ProtoInternal {
928
966
  }
929
967
  }
930
968
  async saveFile(proto, object, options) {
931
- const beforeSave = this.triggers?.beforeSaveFile;
932
- const afterSave = this.triggers?.afterSaveFile;
933
- const context = options?.context ?? {};
934
- if (_.isFunction(beforeSave)) {
935
- await beforeSave(proxy(Object.setPrototypeOf({ object, context }, proto)));
936
- }
937
969
  if (object.objectId) {
938
970
  object = await this.updateFile(proto, object, options);
939
971
  }
940
972
  else {
941
973
  object = await this.createFile(proto, object, options);
942
974
  }
943
- if (_.isFunction(afterSave)) {
944
- await afterSave(proxy(Object.setPrototypeOf({ object, context }, proto)));
945
- }
946
975
  return object;
947
976
  }
948
977
  async deleteFile(proto, object, options) {
949
- const beforeDelete = this.triggers?.beforeDeleteFile;
950
- const afterDelete = this.triggers?.afterDeleteFile;
951
978
  object = await object.fetchIfNeeded(['token'], options);
952
- const context = options?.context ?? {};
953
- if (_.isFunction(beforeDelete)) {
954
- await beforeDelete(proxy(Object.setPrototypeOf({ object, context }, proto)));
955
- }
956
979
  const deleted = await proto.Query('File')
957
980
  .equalTo('_id', object.objectId)
958
981
  .deleteOne(options);
@@ -962,9 +985,6 @@ class ProtoInternal {
962
985
  object[_private.PVK].extra = {};
963
986
  }
964
987
  this.destroyFileData(proto, object.token);
965
- if (_.isFunction(afterDelete)) {
966
- await afterDelete(proxy(Object.setPrototypeOf({ object, context }, proto)));
967
- }
968
988
  return object;
969
989
  }
970
990
  fileData(proto, object, options) {
@@ -1267,6 +1287,7 @@ const schedule = (proto) => {
1267
1287
  // THE SOFTWARE.
1268
1288
  //
1269
1289
  class ProtoService extends index.ProtoType {
1290
+ /** @internal */
1270
1291
  [_private.PVK];
1271
1292
  _storage;
1272
1293
  _schedule = schedule(this);
@@ -1412,18 +1433,6 @@ class ProtoService extends index.ProtoType {
1412
1433
  this[_private.PVK].triggers.afterDelete = {};
1413
1434
  this[_private.PVK].triggers.afterDelete[name] = callback;
1414
1435
  }
1415
- beforeSaveFile(callback) {
1416
- this[_private.PVK].triggers.beforeSaveFile = callback;
1417
- }
1418
- afterSaveFile(callback) {
1419
- this[_private.PVK].triggers.afterSaveFile = callback;
1420
- }
1421
- beforeDeleteFile(callback) {
1422
- this[_private.PVK].triggers.beforeDeleteFile = callback;
1423
- }
1424
- afterDeleteFile(callback) {
1425
- this[_private.PVK].triggers.afterDeleteFile = callback;
1426
- }
1427
1436
  lockTable(className, update) {
1428
1437
  return this.storage.lockTable(className, update);
1429
1438
  }
@@ -1590,11 +1599,11 @@ var classesRoute = (router, proto) => {
1590
1599
  if (!_.includes(classes, name))
1591
1600
  return res.sendStatus(404);
1592
1601
  await response(res, async () => {
1593
- const { operation, context, random, attributes, update, setOnInsert, ...options } = index.deserialize(req.body);
1602
+ const { operation, context, silent, random, attributes, update, setOnInsert, ...options } = index.deserialize(req.body);
1594
1603
  const payload = proto.connect(req);
1595
1604
  const query = payload.Query(name);
1596
1605
  query[_private.PVK].options = options;
1597
- const opts = { master: payload.isMaster, context };
1606
+ const opts = { master: payload.isMaster, context, silent };
1598
1607
  switch (operation) {
1599
1608
  case 'explain':
1600
1609
  if (!payload.isMaster)