@mongosh/shell-api 1.3.0 → 1.3.1

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.
package/lib/database.js CHANGED
@@ -35,7 +35,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
35
35
  }
36
36
  if (typeof prop !== 'string' ||
37
37
  prop.startsWith('_') ||
38
- !helpers_1.isValidCollectionName(prop)) {
38
+ !(0, helpers_1.isValidCollectionName)(prop)) {
39
39
  return;
40
40
  }
41
41
  if (!collections[prop]) {
@@ -73,7 +73,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
73
73
  });
74
74
  }
75
75
  async _runCommand(cmd, options = {}) {
76
- return this._mongo._serviceProvider.runCommandWithCheck(this._name, helpers_1.adjustRunCommand(cmd, this._instanceState.shellBson), { ...this._mongo._getExplicitlyRequestedReadPref(), ...await this._baseOptions(), ...options });
76
+ return this._mongo._serviceProvider.runCommandWithCheck(this._name, (0, helpers_1.adjustRunCommand)(cmd, this._instanceState.shellBson), { ...this._mongo._getExplicitlyRequestedReadPref(), ...await this._baseOptions(), ...options });
77
77
  }
78
78
  async _runAdminCommand(cmd, options = {}) {
79
79
  return this.getSiblingDB('admin')._runCommand(cmd, { ...await this._baseOptions(), ...options });
@@ -146,7 +146,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
146
146
  return await this._listCollections(filter, options);
147
147
  }
148
148
  async runCommand(cmd) {
149
- helpers_1.assertArgsDefinedType([cmd], [['string', 'object']], 'Database.runCommand');
149
+ (0, helpers_1.assertArgsDefinedType)([cmd], [['string', 'object']], 'Database.runCommand');
150
150
  if (typeof cmd === 'string') {
151
151
  cmd = { [cmd]: 1 };
152
152
  }
@@ -157,7 +157,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
157
157
  return this._runCommand(cmd);
158
158
  }
159
159
  async adminCommand(cmd) {
160
- helpers_1.assertArgsDefinedType([cmd], [['string', 'object']], 'Database.adminCommand');
160
+ (0, helpers_1.assertArgsDefinedType)([cmd], [['string', 'object']], 'Database.adminCommand');
161
161
  if (typeof cmd === 'string') {
162
162
  cmd = { [cmd]: 1 };
163
163
  }
@@ -168,22 +168,22 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
168
168
  return await this._runAdminCommand(cmd, {});
169
169
  }
170
170
  async aggregate(pipeline, options) {
171
- helpers_1.assertArgsDefinedType([pipeline], [true], 'Database.aggregate');
171
+ (0, helpers_1.assertArgsDefinedType)([pipeline], [true], 'Database.aggregate');
172
172
  this._emitDatabaseApiCall('aggregate', { options, pipeline });
173
- const { aggOptions, dbOptions, explain } = helpers_1.adaptAggregateOptions(options);
173
+ const { aggOptions, dbOptions, explain } = (0, helpers_1.adaptAggregateOptions)(options);
174
174
  const providerCursor = this._mongo._serviceProvider.aggregateDb(this._name, pipeline, { ...await this._baseOptions(), ...aggOptions }, dbOptions);
175
175
  const cursor = new index_1.AggregationCursor(this._mongo, providerCursor);
176
176
  if (explain) {
177
177
  return await cursor.explain(explain);
178
178
  }
179
- else if (helpers_1.shouldRunAggregationImmediately(pipeline)) {
179
+ else if ((0, helpers_1.shouldRunAggregationImmediately)(pipeline)) {
180
180
  await cursor.hasNext();
181
181
  }
182
182
  this._mongo._instanceState.currentCursor = cursor;
183
183
  return cursor;
184
184
  }
185
185
  getSiblingDB(db) {
186
- helpers_1.assertArgsDefinedType([db], ['string'], 'Database.getSiblingDB');
186
+ (0, helpers_1.assertArgsDefinedType)([db], ['string'], 'Database.getSiblingDB');
187
187
  this._emitDatabaseApiCall('getSiblingDB', { db });
188
188
  if (this._session) {
189
189
  return this._session.getDatabase(db);
@@ -191,9 +191,9 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
191
191
  return this._mongo._getDb(db);
192
192
  }
193
193
  getCollection(coll) {
194
- helpers_1.assertArgsDefinedType([coll], ['string'], 'Database.getColl');
194
+ (0, helpers_1.assertArgsDefinedType)([coll], ['string'], 'Database.getColl');
195
195
  this._emitDatabaseApiCall('getCollection', { coll });
196
- if (!helpers_1.isValidCollectionName(coll)) {
196
+ if (!(0, helpers_1.isValidCollectionName)(coll)) {
197
197
  throw new errors_1.MongoshInvalidInputError(`Invalid collection name: ${coll}`, errors_1.CommonErrors.InvalidArgument);
198
198
  }
199
199
  const collections = this._collections;
@@ -206,48 +206,48 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
206
206
  return await this._mongo._serviceProvider.dropDatabase(this._name, { ...await this._baseOptions(), writeConcern });
207
207
  }
208
208
  async createUser(user, writeConcern) {
209
- helpers_1.assertArgsDefinedType([user], ['object'], 'Database.createUser');
210
- helpers_1.assertKeysDefined(user, ['user', 'roles']);
209
+ (0, helpers_1.assertArgsDefinedType)([user], ['object'], 'Database.createUser');
210
+ (0, helpers_1.assertKeysDefined)(user, ['user', 'roles']);
211
211
  if (this._name === '$external') {
212
212
  if ('pwd' in user) {
213
213
  throw new errors_1.MongoshInvalidInputError('Cannot set password for users on the $external database', errors_1.CommonErrors.InvalidArgument);
214
214
  }
215
215
  }
216
216
  else {
217
- helpers_1.assertKeysDefined(user, ['pwd']);
217
+ (0, helpers_1.assertKeysDefined)(user, ['pwd']);
218
218
  }
219
219
  this._emitDatabaseApiCall('createUser', {});
220
220
  if (user.createUser) {
221
221
  throw new errors_1.MongoshInvalidInputError('Cannot set createUser field in helper method', errors_1.CommonErrors.InvalidArgument);
222
222
  }
223
- const command = helpers_1.adaptOptions({ user: 'createUser', passwordDigestor: null }, {}, user);
223
+ const command = (0, helpers_1.adaptOptions)({ user: 'createUser', passwordDigestor: null }, {}, user);
224
224
  if (writeConcern) {
225
225
  command.writeConcern = writeConcern;
226
226
  }
227
- const digestPwd = helpers_1.processDigestPassword(user.user, user.passwordDigestor, command);
227
+ const digestPwd = (0, helpers_1.processDigestPassword)(user.user, user.passwordDigestor, command);
228
228
  const orderedCmd = { createUser: command.createUser, ...command, ...digestPwd };
229
229
  return await this._runCommand(orderedCmd);
230
230
  }
231
231
  async updateUser(username, userDoc, writeConcern) {
232
- helpers_1.assertArgsDefinedType([username, userDoc], ['string', 'object'], 'Database.updateUser');
232
+ (0, helpers_1.assertArgsDefinedType)([username, userDoc], ['string', 'object'], 'Database.updateUser');
233
233
  this._emitDatabaseApiCall('updateUser', {});
234
234
  if (userDoc.passwordDigestor && userDoc.passwordDigestor !== 'server' && userDoc.passwordDigestor !== 'client') {
235
235
  throw new errors_1.MongoshInvalidInputError(`Invalid field: passwordDigestor must be 'client' or 'server', got ${userDoc.passwordDigestor}`, errors_1.CommonErrors.InvalidArgument);
236
236
  }
237
- const command = helpers_1.adaptOptions({ passwordDigestor: null }, {
237
+ const command = (0, helpers_1.adaptOptions)({ passwordDigestor: null }, {
238
238
  updateUser: username
239
239
  }, userDoc);
240
240
  if (writeConcern) {
241
241
  command.writeConcern = writeConcern;
242
242
  }
243
- const digestPwd = helpers_1.processDigestPassword(username, userDoc.passwordDigestor, command);
243
+ const digestPwd = (0, helpers_1.processDigestPassword)(username, userDoc.passwordDigestor, command);
244
244
  const orderedCmd = { updateUser: command.updateUser, ...command, ...digestPwd };
245
245
  return await this._runCommand(orderedCmd);
246
246
  }
247
247
  async changeUserPassword(username, password, writeConcern) {
248
- helpers_1.assertArgsDefinedType([username, password], ['string', 'string'], 'Database.changeUserPassword');
248
+ (0, helpers_1.assertArgsDefinedType)([username, password], ['string', 'string'], 'Database.changeUserPassword');
249
249
  this._emitDatabaseApiCall('changeUserPassword', {});
250
- const command = helpers_1.adaptOptions({}, {
250
+ const command = (0, helpers_1.adaptOptions)({}, {
251
251
  updateUser: username,
252
252
  pwd: password
253
253
  }, {});
@@ -263,7 +263,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
263
263
  return await this._runCommand({ logout: 1 });
264
264
  }
265
265
  async dropUser(username, writeConcern) {
266
- helpers_1.assertArgsDefinedType([username], ['string'], 'Database.dropUser');
266
+ (0, helpers_1.assertArgsDefinedType)([username], ['string'], 'Database.dropUser');
267
267
  this._emitDatabaseApiCall('dropUser', {});
268
268
  const cmd = { dropUser: username };
269
269
  if (writeConcern) {
@@ -314,7 +314,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
314
314
  return await this._mongo._serviceProvider.authenticate(authDoc);
315
315
  }
316
316
  async grantRolesToUser(username, roles, writeConcern) {
317
- helpers_1.assertArgsDefinedType([username, roles], ['string', true], 'Database.grantRolesToUser');
317
+ (0, helpers_1.assertArgsDefinedType)([username, roles], ['string', true], 'Database.grantRolesToUser');
318
318
  this._emitDatabaseApiCall('grantRolesToUser', {});
319
319
  const cmd = { grantRolesToUser: username, roles: roles };
320
320
  if (writeConcern) {
@@ -323,7 +323,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
323
323
  return await this._runCommand(cmd);
324
324
  }
325
325
  async revokeRolesFromUser(username, roles, writeConcern) {
326
- helpers_1.assertArgsDefinedType([username, roles], ['string', true], 'Database.revokeRolesFromUser');
326
+ (0, helpers_1.assertArgsDefinedType)([username, roles], ['string', true], 'Database.revokeRolesFromUser');
327
327
  this._emitDatabaseApiCall('revokeRolesFromUser', {});
328
328
  const cmd = { revokeRolesFromUser: username, roles: roles };
329
329
  if (writeConcern) {
@@ -332,9 +332,9 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
332
332
  return await this._runCommand(cmd);
333
333
  }
334
334
  async getUser(username, options = {}) {
335
- helpers_1.assertArgsDefinedType([username], ['string'], 'Database.getUser');
335
+ (0, helpers_1.assertArgsDefinedType)([username], ['string'], 'Database.getUser');
336
336
  this._emitDatabaseApiCall('getUser', { username: username });
337
- const command = helpers_1.adaptOptions({}, { usersInfo: { user: username, db: this._name } }, options);
337
+ const command = (0, helpers_1.adaptOptions)({}, { usersInfo: { user: username, db: this._name } }, options);
338
338
  const result = await this._runCommand(command);
339
339
  if (result.users === undefined) {
340
340
  throw new errors_1.MongoshInternalError('No users were returned from the userInfo command');
@@ -348,16 +348,16 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
348
348
  }
349
349
  async getUsers(options = {}) {
350
350
  this._emitDatabaseApiCall('getUsers', { options: options });
351
- const command = helpers_1.adaptOptions({}, { usersInfo: 1 }, options);
351
+ const command = (0, helpers_1.adaptOptions)({}, { usersInfo: 1 }, options);
352
352
  return await this._runCommand(command);
353
353
  }
354
354
  async createCollection(name, options = {}) {
355
- helpers_1.assertArgsDefinedType([name], ['string'], 'Database.createCollection');
355
+ (0, helpers_1.assertArgsDefinedType)([name], ['string'], 'Database.createCollection');
356
356
  this._emitDatabaseApiCall('createCollection', { name: name, options: options });
357
357
  return await this._mongo._serviceProvider.createCollection(this._name, name, { ...await this._baseOptions(), ...options });
358
358
  }
359
359
  async createView(name, source, pipeline, options = {}) {
360
- helpers_1.assertArgsDefinedType([name, source, pipeline], ['string', 'string', true], 'Database.createView');
360
+ (0, helpers_1.assertArgsDefinedType)([name, source, pipeline], ['string', 'string', true], 'Database.createView');
361
361
  this._emitDatabaseApiCall('createView', { name, source, pipeline, options });
362
362
  const ccOpts = {
363
363
  ...await this._baseOptions(),
@@ -370,13 +370,13 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
370
370
  return await this._mongo._serviceProvider.createCollection(this._name, name, ccOpts);
371
371
  }
372
372
  async createRole(role, writeConcern) {
373
- helpers_1.assertArgsDefinedType([role], ['object'], 'Database.createRole');
374
- helpers_1.assertKeysDefined(role, ['role', 'privileges', 'roles']);
373
+ (0, helpers_1.assertArgsDefinedType)([role], ['object'], 'Database.createRole');
374
+ (0, helpers_1.assertKeysDefined)(role, ['role', 'privileges', 'roles']);
375
375
  this._emitDatabaseApiCall('createRole', {});
376
376
  if (role.createRole) {
377
377
  throw new errors_1.MongoshInvalidInputError('Cannot set createRole field in helper method', errors_1.CommonErrors.InvalidArgument);
378
378
  }
379
- const command = helpers_1.adaptOptions({ role: 'createRole' }, {}, role);
379
+ const command = (0, helpers_1.adaptOptions)({ role: 'createRole' }, {}, role);
380
380
  if (writeConcern) {
381
381
  command.writeConcern = writeConcern;
382
382
  }
@@ -384,9 +384,9 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
384
384
  return await this._runCommand(orderedCmd);
385
385
  }
386
386
  async updateRole(rolename, roleDoc, writeConcern) {
387
- helpers_1.assertArgsDefinedType([rolename, roleDoc], ['string', 'object'], 'Database.updateRole');
387
+ (0, helpers_1.assertArgsDefinedType)([rolename, roleDoc], ['string', 'object'], 'Database.updateRole');
388
388
  this._emitDatabaseApiCall('updateRole', {});
389
- const command = helpers_1.adaptOptions({}, {
389
+ const command = (0, helpers_1.adaptOptions)({}, {
390
390
  updateRole: rolename
391
391
  }, roleDoc);
392
392
  if (writeConcern) {
@@ -396,7 +396,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
396
396
  return await this._runCommand(orderedCmd);
397
397
  }
398
398
  async dropRole(rolename, writeConcern) {
399
- helpers_1.assertArgsDefinedType([rolename], ['string'], 'Database.dropRole');
399
+ (0, helpers_1.assertArgsDefinedType)([rolename], ['string'], 'Database.dropRole');
400
400
  this._emitDatabaseApiCall('dropRole', {});
401
401
  const cmd = { dropRole: rolename };
402
402
  if (writeConcern) {
@@ -413,7 +413,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
413
413
  return await this._runCommand(cmd);
414
414
  }
415
415
  async grantRolesToRole(rolename, roles, writeConcern) {
416
- helpers_1.assertArgsDefinedType([rolename, roles], ['string', true], 'Database.grantRolesToRole');
416
+ (0, helpers_1.assertArgsDefinedType)([rolename, roles], ['string', true], 'Database.grantRolesToRole');
417
417
  this._emitDatabaseApiCall('grantRolesToRole', {});
418
418
  const cmd = { grantRolesToRole: rolename, roles: roles };
419
419
  if (writeConcern) {
@@ -422,7 +422,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
422
422
  return await this._runCommand(cmd);
423
423
  }
424
424
  async revokeRolesFromRole(rolename, roles, writeConcern) {
425
- helpers_1.assertArgsDefinedType([rolename, roles], ['string', true], 'Database.revokeRolesFromRole');
425
+ (0, helpers_1.assertArgsDefinedType)([rolename, roles], ['string', true], 'Database.revokeRolesFromRole');
426
426
  this._emitDatabaseApiCall('revokeRolesFromRole', {});
427
427
  const cmd = { revokeRolesFromRole: rolename, roles: roles };
428
428
  if (writeConcern) {
@@ -431,7 +431,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
431
431
  return await this._runCommand(cmd);
432
432
  }
433
433
  async grantPrivilegesToRole(rolename, privileges, writeConcern) {
434
- helpers_1.assertArgsDefinedType([rolename, privileges], ['string', true], 'Database.grantPrivilegesToRole');
434
+ (0, helpers_1.assertArgsDefinedType)([rolename, privileges], ['string', true], 'Database.grantPrivilegesToRole');
435
435
  this._emitDatabaseApiCall('grantPrivilegesToRole', {});
436
436
  const cmd = { grantPrivilegesToRole: rolename, privileges: privileges };
437
437
  if (writeConcern) {
@@ -440,7 +440,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
440
440
  return await this._runCommand(cmd);
441
441
  }
442
442
  async revokePrivilegesFromRole(rolename, privileges, writeConcern) {
443
- helpers_1.assertArgsDefinedType([rolename, privileges], ['string', true], 'Database.revokePrivilegesFromRole');
443
+ (0, helpers_1.assertArgsDefinedType)([rolename, privileges], ['string', true], 'Database.revokePrivilegesFromRole');
444
444
  this._emitDatabaseApiCall('revokePrivilegesFromRole', {});
445
445
  const cmd = { revokePrivilegesFromRole: rolename, privileges: privileges };
446
446
  if (writeConcern) {
@@ -449,9 +449,9 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
449
449
  return await this._runCommand(cmd);
450
450
  }
451
451
  async getRole(rolename, options = {}) {
452
- helpers_1.assertArgsDefinedType([rolename], ['string'], 'Database.getRole');
452
+ (0, helpers_1.assertArgsDefinedType)([rolename], ['string'], 'Database.getRole');
453
453
  this._emitDatabaseApiCall('getRole', { rolename: rolename });
454
- const command = helpers_1.adaptOptions({}, { rolesInfo: { role: rolename, db: this._name } }, options);
454
+ const command = (0, helpers_1.adaptOptions)({}, { rolesInfo: { role: rolename, db: this._name } }, options);
455
455
  const result = await this._runCommand(command);
456
456
  if (result.roles === undefined) {
457
457
  throw new errors_1.MongoshInternalError('No roles returned from rolesInfo command');
@@ -465,7 +465,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
465
465
  }
466
466
  async getRoles(options = {}) {
467
467
  this._emitDatabaseApiCall('getRoles', { options: options });
468
- const command = helpers_1.adaptOptions({}, { rolesInfo: 1 }, options);
468
+ const command = (0, helpers_1.adaptOptions)({}, { rolesInfo: 1 }, options);
469
469
  return await this._runCommand(command);
470
470
  }
471
471
  async currentOp(opts = {}) {
@@ -479,7 +479,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
479
479
  });
480
480
  }
481
481
  async killOp(opId) {
482
- helpers_1.assertArgsDefinedType([opId], ['number'], 'Database.killOp');
482
+ (0, helpers_1.assertArgsDefinedType)([opId], ['number'], 'Database.killOp');
483
483
  this._emitDatabaseApiCall('killOp', { opId });
484
484
  return await this._runAdminCommand({
485
485
  killOp: 1,
@@ -543,7 +543,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
543
543
  return this._cachedHello;
544
544
  }
545
545
  catch (err) {
546
- if (err.codeName === 'CommandNotFound') {
546
+ if ((err === null || err === void 0 ? void 0 : err.codeName) === 'CommandNotFound') {
547
547
  const result = await this.isMaster();
548
548
  delete result.ismaster;
549
549
  this._cachedHello = result;
@@ -565,7 +565,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
565
565
  });
566
566
  }
567
567
  async stats(scaleOrOptions = 1) {
568
- helpers_1.assertArgsDefinedType([scaleOrOptions], [['number', 'object']], 'Database.stats');
568
+ (0, helpers_1.assertArgsDefinedType)([scaleOrOptions], [['number', 'object']], 'Database.stats');
569
569
  if (typeof scaleOrOptions === 'number') {
570
570
  scaleOrOptions = { scale: scaleOrOptions };
571
571
  }
@@ -606,7 +606,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
606
606
  result[c] = await this.getCollection(c).stats({ scale });
607
607
  }
608
608
  catch (error) {
609
- result[c] = { ok: 0, errmsg: error.message };
609
+ result[c] = { ok: 0, errmsg: error === null || error === void 0 ? void 0 : error.message };
610
610
  }
611
611
  }
612
612
  return new index_1.CommandResult('StatsResult', result);
@@ -664,7 +664,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
664
664
  });
665
665
  }
666
666
  async setProfilingLevel(level, opts = {}) {
667
- helpers_1.assertArgsDefinedType([level], ['number'], 'Database.setProfilingLevel');
667
+ (0, helpers_1.assertArgsDefinedType)([level], ['number'], 'Database.setProfilingLevel');
668
668
  if (level < 0 || level > 2) {
669
669
  throw new errors_1.MongoshInvalidInputError(`Input level ${level} is out of range [0..2]`, errors_1.CommonErrors.InvalidArgument);
670
670
  }
@@ -678,7 +678,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
678
678
  });
679
679
  }
680
680
  async setLogLevel(logLevel, component) {
681
- helpers_1.assertArgsDefinedType([logLevel], ['number'], 'Database.setLogLevel');
681
+ (0, helpers_1.assertArgsDefinedType)([logLevel], ['number'], 'Database.setLogLevel');
682
682
  this._emitDatabaseApiCall('setLogLevel', { logLevel: logLevel, component: component });
683
683
  let componentNames = [];
684
684
  if (typeof component === 'string') {
@@ -714,7 +714,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
714
714
  throw new errors_1.MongoshDeprecatedError('`copyDatabase()` was removed because it was deprecated in MongoDB 4.0');
715
715
  }
716
716
  async commandHelp(name) {
717
- helpers_1.assertArgsDefinedType([name], ['string'], 'Database.commandHelp');
717
+ (0, helpers_1.assertArgsDefinedType)([name], ['string'], 'Database.commandHelp');
718
718
  this._emitDatabaseApiCall('commandHelp', { name: name });
719
719
  const command = {};
720
720
  command[name] = 1;
@@ -758,7 +758,7 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
758
758
  }
759
759
  async printShardingStatus(verbose = false) {
760
760
  this._emitDatabaseApiCall('printShardingStatus', { verbose });
761
- const result = await helpers_1.getPrintableShardStatus(await helpers_1.getConfigDB(this), verbose);
761
+ const result = await (0, helpers_1.getPrintableShardStatus)(await (0, helpers_1.getConfigDB)(this), verbose);
762
762
  return new index_1.CommandResult('StatsResult', result);
763
763
  }
764
764
  async printSecondaryReplicationInfo() {
@@ -847,8 +847,8 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
847
847
  let tfirst = first.ts;
848
848
  let tlast = last.ts;
849
849
  if (tfirst && tlast) {
850
- tfirst = helpers_1.tsToSeconds(tfirst);
851
- tlast = helpers_1.tsToSeconds(tlast);
850
+ tfirst = (0, helpers_1.tsToSeconds)(tfirst);
851
+ tlast = (0, helpers_1.tsToSeconds)(tlast);
852
852
  result.timeDiff = tlast - tfirst;
853
853
  result.timeDiffHours = Math.round(result.timeDiff / 36) / 100;
854
854
  result.tFirst = (new Date(tfirst * 1000)).toString();
@@ -935,222 +935,222 @@ let Database = class Database extends decorators_1.ShellApiWithMongoClass {
935
935
  }
936
936
  };
937
937
  __decorate([
938
- decorators_1.returnType('Mongo')
938
+ (0, decorators_1.returnType)('Mongo')
939
939
  ], Database.prototype, "getMongo", null);
940
940
  __decorate([
941
941
  decorators_1.returnsPromise,
942
- decorators_1.apiVersions([1])
942
+ (0, decorators_1.apiVersions)([1])
943
943
  ], Database.prototype, "getCollectionNames", null);
944
944
  __decorate([
945
945
  decorators_1.returnsPromise,
946
- decorators_1.serverVersions(['3.0.0', enums_1.ServerVersions.latest]),
947
- decorators_1.apiVersions([1])
946
+ (0, decorators_1.serverVersions)(['3.0.0', enums_1.ServerVersions.latest]),
947
+ (0, decorators_1.apiVersions)([1])
948
948
  ], Database.prototype, "getCollectionInfos", null);
949
949
  __decorate([
950
950
  decorators_1.returnsPromise,
951
- decorators_1.apiVersions([1])
951
+ (0, decorators_1.apiVersions)([1])
952
952
  ], Database.prototype, "runCommand", null);
953
953
  __decorate([
954
954
  decorators_1.returnsPromise,
955
- decorators_1.serverVersions(['3.4.0', enums_1.ServerVersions.latest]),
956
- decorators_1.apiVersions([1])
955
+ (0, decorators_1.serverVersions)(['3.4.0', enums_1.ServerVersions.latest]),
956
+ (0, decorators_1.apiVersions)([1])
957
957
  ], Database.prototype, "adminCommand", null);
958
958
  __decorate([
959
959
  decorators_1.returnsPromise,
960
- decorators_1.returnType('AggregationCursor'),
961
- decorators_1.apiVersions([1])
960
+ (0, decorators_1.returnType)('AggregationCursor'),
961
+ (0, decorators_1.apiVersions)([1])
962
962
  ], Database.prototype, "aggregate", null);
963
963
  __decorate([
964
- decorators_1.returnType('Database')
964
+ (0, decorators_1.returnType)('Database')
965
965
  ], Database.prototype, "getSiblingDB", null);
966
966
  __decorate([
967
- decorators_1.returnType('Collection')
967
+ (0, decorators_1.returnType)('Collection')
968
968
  ], Database.prototype, "getCollection", null);
969
969
  __decorate([
970
970
  decorators_1.returnsPromise,
971
- decorators_1.apiVersions([1])
971
+ (0, decorators_1.apiVersions)([1])
972
972
  ], Database.prototype, "dropDatabase", null);
973
973
  __decorate([
974
974
  decorators_1.returnsPromise,
975
- decorators_1.apiVersions([])
975
+ (0, decorators_1.apiVersions)([])
976
976
  ], Database.prototype, "createUser", null);
977
977
  __decorate([
978
978
  decorators_1.returnsPromise
979
979
  ], Database.prototype, "updateUser", null);
980
980
  __decorate([
981
981
  decorators_1.returnsPromise,
982
- decorators_1.apiVersions([])
982
+ (0, decorators_1.apiVersions)([])
983
983
  ], Database.prototype, "changeUserPassword", null);
984
984
  __decorate([
985
985
  decorators_1.returnsPromise,
986
- decorators_1.apiVersions([])
986
+ (0, decorators_1.apiVersions)([])
987
987
  ], Database.prototype, "logout", null);
988
988
  __decorate([
989
989
  decorators_1.returnsPromise,
990
- decorators_1.apiVersions([])
990
+ (0, decorators_1.apiVersions)([])
991
991
  ], Database.prototype, "dropUser", null);
992
992
  __decorate([
993
993
  decorators_1.returnsPromise,
994
- decorators_1.apiVersions([])
994
+ (0, decorators_1.apiVersions)([])
995
995
  ], Database.prototype, "dropAllUsers", null);
996
996
  __decorate([
997
997
  decorators_1.returnsPromise
998
998
  ], Database.prototype, "auth", null);
999
999
  __decorate([
1000
1000
  decorators_1.returnsPromise,
1001
- decorators_1.apiVersions([])
1001
+ (0, decorators_1.apiVersions)([])
1002
1002
  ], Database.prototype, "grantRolesToUser", null);
1003
1003
  __decorate([
1004
1004
  decorators_1.returnsPromise,
1005
- decorators_1.apiVersions([])
1005
+ (0, decorators_1.apiVersions)([])
1006
1006
  ], Database.prototype, "revokeRolesFromUser", null);
1007
1007
  __decorate([
1008
1008
  decorators_1.returnsPromise,
1009
- decorators_1.apiVersions([])
1009
+ (0, decorators_1.apiVersions)([])
1010
1010
  ], Database.prototype, "getUser", null);
1011
1011
  __decorate([
1012
1012
  decorators_1.returnsPromise,
1013
- decorators_1.apiVersions([])
1013
+ (0, decorators_1.apiVersions)([])
1014
1014
  ], Database.prototype, "getUsers", null);
1015
1015
  __decorate([
1016
1016
  decorators_1.returnsPromise,
1017
- decorators_1.apiVersions([1])
1017
+ (0, decorators_1.apiVersions)([1])
1018
1018
  ], Database.prototype, "createCollection", null);
1019
1019
  __decorate([
1020
1020
  decorators_1.returnsPromise,
1021
- decorators_1.apiVersions([1])
1021
+ (0, decorators_1.apiVersions)([1])
1022
1022
  ], Database.prototype, "createView", null);
1023
1023
  __decorate([
1024
1024
  decorators_1.returnsPromise,
1025
- decorators_1.apiVersions([])
1025
+ (0, decorators_1.apiVersions)([])
1026
1026
  ], Database.prototype, "createRole", null);
1027
1027
  __decorate([
1028
1028
  decorators_1.returnsPromise,
1029
- decorators_1.apiVersions([])
1029
+ (0, decorators_1.apiVersions)([])
1030
1030
  ], Database.prototype, "updateRole", null);
1031
1031
  __decorate([
1032
1032
  decorators_1.returnsPromise,
1033
- decorators_1.apiVersions([])
1033
+ (0, decorators_1.apiVersions)([])
1034
1034
  ], Database.prototype, "dropRole", null);
1035
1035
  __decorate([
1036
1036
  decorators_1.returnsPromise
1037
1037
  ], Database.prototype, "dropAllRoles", null);
1038
1038
  __decorate([
1039
1039
  decorators_1.returnsPromise,
1040
- decorators_1.apiVersions([])
1040
+ (0, decorators_1.apiVersions)([])
1041
1041
  ], Database.prototype, "grantRolesToRole", null);
1042
1042
  __decorate([
1043
1043
  decorators_1.returnsPromise,
1044
- decorators_1.apiVersions([])
1044
+ (0, decorators_1.apiVersions)([])
1045
1045
  ], Database.prototype, "revokeRolesFromRole", null);
1046
1046
  __decorate([
1047
1047
  decorators_1.returnsPromise
1048
1048
  ], Database.prototype, "grantPrivilegesToRole", null);
1049
1049
  __decorate([
1050
1050
  decorators_1.returnsPromise,
1051
- decorators_1.apiVersions([])
1051
+ (0, decorators_1.apiVersions)([])
1052
1052
  ], Database.prototype, "revokePrivilegesFromRole", null);
1053
1053
  __decorate([
1054
1054
  decorators_1.returnsPromise,
1055
- decorators_1.apiVersions([])
1055
+ (0, decorators_1.apiVersions)([])
1056
1056
  ], Database.prototype, "getRole", null);
1057
1057
  __decorate([
1058
1058
  decorators_1.returnsPromise,
1059
- decorators_1.apiVersions([])
1059
+ (0, decorators_1.apiVersions)([])
1060
1060
  ], Database.prototype, "getRoles", null);
1061
1061
  __decorate([
1062
1062
  decorators_1.returnsPromise,
1063
- decorators_1.apiVersions([])
1063
+ (0, decorators_1.apiVersions)([])
1064
1064
  ], Database.prototype, "currentOp", null);
1065
1065
  __decorate([
1066
1066
  decorators_1.returnsPromise,
1067
- decorators_1.apiVersions([])
1067
+ (0, decorators_1.apiVersions)([])
1068
1068
  ], Database.prototype, "killOp", null);
1069
1069
  __decorate([
1070
1070
  decorators_1.returnsPromise,
1071
- decorators_1.apiVersions([])
1071
+ (0, decorators_1.apiVersions)([])
1072
1072
  ], Database.prototype, "shutdownServer", null);
1073
1073
  __decorate([
1074
1074
  decorators_1.returnsPromise,
1075
- decorators_1.apiVersions([])
1075
+ (0, decorators_1.apiVersions)([])
1076
1076
  ], Database.prototype, "fsyncLock", null);
1077
1077
  __decorate([
1078
1078
  decorators_1.returnsPromise,
1079
- decorators_1.apiVersions([])
1079
+ (0, decorators_1.apiVersions)([])
1080
1080
  ], Database.prototype, "fsyncUnlock", null);
1081
1081
  __decorate([
1082
1082
  decorators_1.returnsPromise,
1083
- decorators_1.apiVersions([])
1083
+ (0, decorators_1.apiVersions)([])
1084
1084
  ], Database.prototype, "version", null);
1085
1085
  __decorate([
1086
1086
  decorators_1.returnsPromise,
1087
- decorators_1.apiVersions([])
1087
+ (0, decorators_1.apiVersions)([])
1088
1088
  ], Database.prototype, "serverBits", null);
1089
1089
  __decorate([
1090
1090
  decorators_1.returnsPromise,
1091
- decorators_1.apiVersions([])
1091
+ (0, decorators_1.apiVersions)([])
1092
1092
  ], Database.prototype, "isMaster", null);
1093
1093
  __decorate([
1094
1094
  decorators_1.returnsPromise,
1095
- decorators_1.apiVersions([1]),
1096
- decorators_1.serverVersions(['5.0.0', enums_1.ServerVersions.latest])
1095
+ (0, decorators_1.apiVersions)([1]),
1096
+ (0, decorators_1.serverVersions)(['5.0.0', enums_1.ServerVersions.latest])
1097
1097
  ], Database.prototype, "hello", null);
1098
1098
  __decorate([
1099
1099
  decorators_1.returnsPromise,
1100
- decorators_1.apiVersions([])
1100
+ (0, decorators_1.apiVersions)([])
1101
1101
  ], Database.prototype, "serverBuildInfo", null);
1102
1102
  __decorate([
1103
1103
  decorators_1.returnsPromise,
1104
- decorators_1.apiVersions([])
1104
+ (0, decorators_1.apiVersions)([])
1105
1105
  ], Database.prototype, "serverStatus", null);
1106
1106
  __decorate([
1107
1107
  decorators_1.returnsPromise,
1108
- decorators_1.apiVersions([])
1108
+ (0, decorators_1.apiVersions)([])
1109
1109
  ], Database.prototype, "stats", null);
1110
1110
  __decorate([
1111
1111
  decorators_1.returnsPromise,
1112
- decorators_1.apiVersions([])
1112
+ (0, decorators_1.apiVersions)([])
1113
1113
  ], Database.prototype, "hostInfo", null);
1114
1114
  __decorate([
1115
1115
  decorators_1.returnsPromise,
1116
- decorators_1.apiVersions([])
1116
+ (0, decorators_1.apiVersions)([])
1117
1117
  ], Database.prototype, "serverCmdLineOpts", null);
1118
1118
  __decorate([
1119
1119
  decorators_1.returnsPromise,
1120
- decorators_1.serverVersions(['5.0.0', enums_1.ServerVersions.latest]),
1121
- decorators_1.apiVersions([])
1120
+ (0, decorators_1.serverVersions)(['5.0.0', enums_1.ServerVersions.latest]),
1121
+ (0, decorators_1.apiVersions)([])
1122
1122
  ], Database.prototype, "rotateCertificates", null);
1123
1123
  __decorate([
1124
1124
  decorators_1.returnsPromise,
1125
- decorators_1.apiVersions([])
1125
+ (0, decorators_1.apiVersions)([])
1126
1126
  ], Database.prototype, "printCollectionStats", null);
1127
1127
  __decorate([
1128
1128
  decorators_1.returnsPromise,
1129
- decorators_1.apiVersions([])
1129
+ (0, decorators_1.apiVersions)([])
1130
1130
  ], Database.prototype, "getFreeMonitoringStatus", null);
1131
1131
  __decorate([
1132
1132
  decorators_1.returnsPromise,
1133
- decorators_1.apiVersions([])
1133
+ (0, decorators_1.apiVersions)([])
1134
1134
  ], Database.prototype, "disableFreeMonitoring", null);
1135
1135
  __decorate([
1136
1136
  decorators_1.returnsPromise,
1137
- decorators_1.apiVersions([])
1137
+ (0, decorators_1.apiVersions)([])
1138
1138
  ], Database.prototype, "enableFreeMonitoring", null);
1139
1139
  __decorate([
1140
1140
  decorators_1.returnsPromise,
1141
- decorators_1.apiVersions([])
1141
+ (0, decorators_1.apiVersions)([])
1142
1142
  ], Database.prototype, "getProfilingStatus", null);
1143
1143
  __decorate([
1144
1144
  decorators_1.returnsPromise,
1145
- decorators_1.apiVersions([])
1145
+ (0, decorators_1.apiVersions)([])
1146
1146
  ], Database.prototype, "setProfilingLevel", null);
1147
1147
  __decorate([
1148
1148
  decorators_1.returnsPromise,
1149
- decorators_1.apiVersions([])
1149
+ (0, decorators_1.apiVersions)([])
1150
1150
  ], Database.prototype, "setLogLevel", null);
1151
1151
  __decorate([
1152
1152
  decorators_1.returnsPromise,
1153
- decorators_1.apiVersions([])
1153
+ (0, decorators_1.apiVersions)([])
1154
1154
  ], Database.prototype, "getLogComponents", null);
1155
1155
  __decorate([
1156
1156
  decorators_1.deprecated
@@ -1163,41 +1163,41 @@ __decorate([
1163
1163
  ], Database.prototype, "copyDatabase", null);
1164
1164
  __decorate([
1165
1165
  decorators_1.returnsPromise,
1166
- decorators_1.apiVersions([1])
1166
+ (0, decorators_1.apiVersions)([1])
1167
1167
  ], Database.prototype, "commandHelp", null);
1168
1168
  __decorate([
1169
1169
  decorators_1.returnsPromise,
1170
- decorators_1.apiVersions([])
1170
+ (0, decorators_1.apiVersions)([])
1171
1171
  ], Database.prototype, "listCommands", null);
1172
1172
  __decorate([
1173
1173
  decorators_1.deprecated,
1174
1174
  decorators_1.returnsPromise,
1175
- decorators_1.apiVersions([])
1175
+ (0, decorators_1.apiVersions)([])
1176
1176
  ], Database.prototype, "getLastErrorObj", null);
1177
1177
  __decorate([
1178
1178
  decorators_1.deprecated,
1179
1179
  decorators_1.returnsPromise,
1180
- decorators_1.apiVersions([])
1180
+ (0, decorators_1.apiVersions)([])
1181
1181
  ], Database.prototype, "getLastError", null);
1182
1182
  __decorate([
1183
1183
  decorators_1.returnsPromise,
1184
- decorators_1.topologies([enums_1.Topologies.Sharded]),
1185
- decorators_1.apiVersions([1])
1184
+ (0, decorators_1.topologies)([enums_1.Topologies.Sharded]),
1185
+ (0, decorators_1.apiVersions)([1])
1186
1186
  ], Database.prototype, "printShardingStatus", null);
1187
1187
  __decorate([
1188
1188
  decorators_1.returnsPromise,
1189
- decorators_1.topologies([enums_1.Topologies.ReplSet]),
1190
- decorators_1.apiVersions([])
1189
+ (0, decorators_1.topologies)([enums_1.Topologies.ReplSet]),
1190
+ (0, decorators_1.apiVersions)([])
1191
1191
  ], Database.prototype, "printSecondaryReplicationInfo", null);
1192
1192
  __decorate([
1193
1193
  decorators_1.returnsPromise,
1194
- decorators_1.topologies([enums_1.Topologies.ReplSet]),
1195
- decorators_1.apiVersions([])
1194
+ (0, decorators_1.topologies)([enums_1.Topologies.ReplSet]),
1195
+ (0, decorators_1.apiVersions)([])
1196
1196
  ], Database.prototype, "getReplicationInfo", null);
1197
1197
  __decorate([
1198
1198
  decorators_1.returnsPromise,
1199
- decorators_1.apiVersions([]),
1200
- decorators_1.topologies([enums_1.Topologies.ReplSet])
1199
+ (0, decorators_1.apiVersions)([]),
1200
+ (0, decorators_1.topologies)([enums_1.Topologies.ReplSet])
1201
1201
  ], Database.prototype, "printReplicationInfo", null);
1202
1202
  __decorate([
1203
1203
  decorators_1.deprecated
@@ -1207,15 +1207,15 @@ __decorate([
1207
1207
  decorators_1.returnsPromise
1208
1208
  ], Database.prototype, "setSecondaryOk", null);
1209
1209
  __decorate([
1210
- decorators_1.serverVersions(['3.1.0', enums_1.ServerVersions.latest]),
1211
- decorators_1.topologies([enums_1.Topologies.ReplSet, enums_1.Topologies.Sharded]),
1212
- decorators_1.apiVersions([1]),
1210
+ (0, decorators_1.serverVersions)(['3.1.0', enums_1.ServerVersions.latest]),
1211
+ (0, decorators_1.topologies)([enums_1.Topologies.ReplSet, enums_1.Topologies.Sharded]),
1212
+ (0, decorators_1.apiVersions)([1]),
1213
1213
  decorators_1.returnsPromise
1214
1214
  ], Database.prototype, "watch", null);
1215
1215
  __decorate([
1216
- decorators_1.serverVersions(['4.4.0', enums_1.ServerVersions.latest]),
1216
+ (0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest]),
1217
1217
  decorators_1.returnsPromise,
1218
- decorators_1.returnType('AggregationCursor')
1218
+ (0, decorators_1.returnType)('AggregationCursor')
1219
1219
  ], Database.prototype, "sql", null);
1220
1220
  Database = __decorate([
1221
1221
  decorators_1.shellApiClassDefault