@qp-mongosh/shell-api 0.0.0-dev.5 → 0.0.0-dev.9

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 (66) hide show
  1. package/.eslintignore +2 -2
  2. package/.eslintrc.js +1 -1
  3. package/AUTHORS +15 -15
  4. package/LICENSE +200 -200
  5. package/bin/report-missing-help.ts +24 -24
  6. package/bin/report-supported-api.ts +14 -14
  7. package/lib/abstract-cursor.d.ts +33 -33
  8. package/lib/abstract-cursor.js +191 -191
  9. package/lib/aggregation-cursor.d.ts +6 -6
  10. package/lib/aggregation-cursor.js +19 -19
  11. package/lib/bulk.d.ts +43 -43
  12. package/lib/bulk.js +223 -223
  13. package/lib/change-stream-cursor.d.ts +28 -28
  14. package/lib/change-stream-cursor.js +111 -111
  15. package/lib/collection.d.ts +95 -95
  16. package/lib/collection.js +964 -964
  17. package/lib/cursor.d.ts +32 -32
  18. package/lib/cursor.js +215 -215
  19. package/lib/database.d.ts +116 -116
  20. package/lib/database.js +1223 -1223
  21. package/lib/dbquery.d.ts +8 -8
  22. package/lib/dbquery.js +28 -28
  23. package/lib/decorators.d.ts +73 -73
  24. package/lib/decorators.js +395 -395
  25. package/lib/enums.d.ts +28 -28
  26. package/lib/enums.js +33 -33
  27. package/lib/error-codes.d.ts +12 -12
  28. package/lib/error-codes.js +19 -19
  29. package/lib/explainable-cursor.d.ts +11 -11
  30. package/lib/explainable-cursor.js +31 -31
  31. package/lib/explainable.d.ts +32 -32
  32. package/lib/explainable.js +166 -166
  33. package/lib/field-level-encryption.d.ts +50 -50
  34. package/lib/field-level-encryption.js +176 -176
  35. package/lib/help.d.ts +22 -22
  36. package/lib/help.js +26 -26
  37. package/lib/helpers.d.ts +71 -71
  38. package/lib/helpers.js +588 -588
  39. package/lib/index.d.ts +16 -16
  40. package/lib/index.js +45 -45
  41. package/lib/interruptor.d.ts +19 -19
  42. package/lib/interruptor.js +62 -62
  43. package/lib/mongo-errors.d.ts +5 -5
  44. package/lib/mongo-errors.js +37 -37
  45. package/lib/mongo.d.ts +75 -75
  46. package/lib/mongo.js +476 -476
  47. package/lib/no-db.d.ts +5 -5
  48. package/lib/no-db.js +28 -28
  49. package/lib/plan-cache.d.ts +16 -16
  50. package/lib/plan-cache.js +70 -70
  51. package/lib/replica-set.d.ts +45 -45
  52. package/lib/replica-set.js +314 -314
  53. package/lib/result.d.ts +61 -61
  54. package/lib/result.js +104 -104
  55. package/lib/session.d.ts +25 -25
  56. package/lib/session.js +88 -88
  57. package/lib/shard.d.ts +42 -42
  58. package/lib/shard.js +414 -414
  59. package/lib/shell-api.d.ts +52 -52
  60. package/lib/shell-api.js +298 -298
  61. package/lib/shell-bson.d.ts +40 -40
  62. package/lib/shell-bson.js +159 -159
  63. package/lib/shell-instance-state.d.ts +77 -77
  64. package/lib/shell-instance-state.js +392 -392
  65. package/package.json +47 -47
  66. package/tsconfig.lint.json +8 -8
package/lib/enums.d.ts CHANGED
@@ -1,28 +1,28 @@
1
- export declare enum ServerVersions {
2
- latest = "999.999.999",
3
- earliest = "0.0.0"
4
- }
5
- export declare enum Topologies {
6
- ReplSet = "ReplSet",
7
- Standalone = "Standalone",
8
- Sharded = "Sharded",
9
- LoadBalanced = "LoadBalanced"
10
- }
11
- import { ReplPlatform } from '@qp-mongosh/service-provider-core';
12
- export declare const ALL_SERVER_VERSIONS: ServerVersions[];
13
- export declare const ALL_TOPOLOGIES: Topologies[];
14
- export declare const ALL_PLATFORMS: ReplPlatform[];
15
- export declare const ALL_API_VERSIONS: number[];
16
- export declare const CURSOR_FLAGS: {
17
- 2: string;
18
- 4: string;
19
- 8: string;
20
- 16: string;
21
- 32: string;
22
- 64: string;
23
- 128: string;
24
- };
25
- export declare const shellApiType: unique symbol;
26
- export declare const asPrintable: unique symbol;
27
- export declare const namespaceInfo: unique symbol;
28
- export declare const ADMIN_DB = "admin";
1
+ export declare enum ServerVersions {
2
+ latest = "999.999.999",
3
+ earliest = "0.0.0"
4
+ }
5
+ export declare enum Topologies {
6
+ ReplSet = "ReplSet",
7
+ Standalone = "Standalone",
8
+ Sharded = "Sharded",
9
+ LoadBalanced = "LoadBalanced"
10
+ }
11
+ import { ReplPlatform } from '@qp-mongosh/service-provider-core';
12
+ export declare const ALL_SERVER_VERSIONS: ServerVersions[];
13
+ export declare const ALL_TOPOLOGIES: Topologies[];
14
+ export declare const ALL_PLATFORMS: ReplPlatform[];
15
+ export declare const ALL_API_VERSIONS: number[];
16
+ export declare const CURSOR_FLAGS: {
17
+ 2: string;
18
+ 4: string;
19
+ 8: string;
20
+ 16: string;
21
+ 32: string;
22
+ 64: string;
23
+ 128: string;
24
+ };
25
+ export declare const shellApiType: unique symbol;
26
+ export declare const asPrintable: unique symbol;
27
+ export declare const namespaceInfo: unique symbol;
28
+ export declare const ADMIN_DB = "admin";
package/lib/enums.js CHANGED
@@ -1,34 +1,34 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ADMIN_DB = exports.namespaceInfo = exports.asPrintable = exports.shellApiType = exports.CURSOR_FLAGS = exports.ALL_API_VERSIONS = exports.ALL_PLATFORMS = exports.ALL_TOPOLOGIES = exports.ALL_SERVER_VERSIONS = exports.Topologies = exports.ServerVersions = void 0;
4
- var ServerVersions;
5
- (function (ServerVersions) {
6
- ServerVersions["latest"] = "999.999.999";
7
- ServerVersions["earliest"] = "0.0.0";
8
- })(ServerVersions = exports.ServerVersions || (exports.ServerVersions = {}));
9
- var Topologies;
10
- (function (Topologies) {
11
- Topologies["ReplSet"] = "ReplSet";
12
- Topologies["Standalone"] = "Standalone";
13
- Topologies["Sharded"] = "Sharded";
14
- Topologies["LoadBalanced"] = "LoadBalanced";
15
- })(Topologies = exports.Topologies || (exports.Topologies = {}));
16
- const service_provider_core_1 = require("@qp-mongosh/service-provider-core");
17
- exports.ALL_SERVER_VERSIONS = [ServerVersions.earliest, ServerVersions.latest];
18
- exports.ALL_TOPOLOGIES = [Topologies.ReplSet, Topologies.Sharded, Topologies.LoadBalanced, Topologies.Standalone];
19
- exports.ALL_PLATFORMS = [service_provider_core_1.ReplPlatform.Compass, service_provider_core_1.ReplPlatform.Browser, service_provider_core_1.ReplPlatform.CLI];
20
- exports.ALL_API_VERSIONS = [0, Infinity];
21
- exports.CURSOR_FLAGS = {
22
- 2: 'tailable',
23
- 4: 'SlaveOk',
24
- 8: 'oplogReplay',
25
- 16: 'noTimeout',
26
- 32: 'awaitData',
27
- 64: 'exhaust',
28
- 128: 'partial'
29
- };
30
- exports.shellApiType = Symbol.for('@@mongosh.shellApiType');
31
- exports.asPrintable = Symbol.for('@@mongosh.asPrintable');
32
- exports.namespaceInfo = Symbol.for('@@mongosh.namespaceInfo');
33
- exports.ADMIN_DB = 'admin';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ADMIN_DB = exports.namespaceInfo = exports.asPrintable = exports.shellApiType = exports.CURSOR_FLAGS = exports.ALL_API_VERSIONS = exports.ALL_PLATFORMS = exports.ALL_TOPOLOGIES = exports.ALL_SERVER_VERSIONS = exports.Topologies = exports.ServerVersions = void 0;
4
+ var ServerVersions;
5
+ (function (ServerVersions) {
6
+ ServerVersions["latest"] = "999.999.999";
7
+ ServerVersions["earliest"] = "0.0.0";
8
+ })(ServerVersions = exports.ServerVersions || (exports.ServerVersions = {}));
9
+ var Topologies;
10
+ (function (Topologies) {
11
+ Topologies["ReplSet"] = "ReplSet";
12
+ Topologies["Standalone"] = "Standalone";
13
+ Topologies["Sharded"] = "Sharded";
14
+ Topologies["LoadBalanced"] = "LoadBalanced";
15
+ })(Topologies = exports.Topologies || (exports.Topologies = {}));
16
+ const service_provider_core_1 = require("@qp-mongosh/service-provider-core");
17
+ exports.ALL_SERVER_VERSIONS = [ServerVersions.earliest, ServerVersions.latest];
18
+ exports.ALL_TOPOLOGIES = [Topologies.ReplSet, Topologies.Sharded, Topologies.LoadBalanced, Topologies.Standalone];
19
+ exports.ALL_PLATFORMS = [service_provider_core_1.ReplPlatform.Compass, service_provider_core_1.ReplPlatform.Browser, service_provider_core_1.ReplPlatform.CLI];
20
+ exports.ALL_API_VERSIONS = [0, Infinity];
21
+ exports.CURSOR_FLAGS = {
22
+ 2: 'tailable',
23
+ 4: 'SlaveOk',
24
+ 8: 'oplogReplay',
25
+ 16: 'noTimeout',
26
+ 32: 'awaitData',
27
+ 64: 'exhaust',
28
+ 128: 'partial'
29
+ };
30
+ exports.shellApiType = Symbol.for('@@mongosh.shellApiType');
31
+ exports.asPrintable = Symbol.for('@@mongosh.asPrintable');
32
+ exports.namespaceInfo = Symbol.for('@@mongosh.namespaceInfo');
33
+ exports.ADMIN_DB = 'admin';
34
34
  //# sourceMappingURL=enums.js.map
@@ -1,12 +1,12 @@
1
- declare function blockedByDriverMetadata(apiDetails: string): {
2
- driverCaused: boolean;
3
- api: string;
4
- };
5
- declare enum ShellApiErrors {
6
- NotConnectedToShardedCluster = "SHAPI-10001",
7
- NotConnectedToReplicaSet = "SHAPI-10002",
8
- NotConnectedToMongos = "SHAPI-10003",
9
- NotConnected = "SHAPI-10004",
10
- NotUsingFLE = "SHAPI-10005"
11
- }
12
- export { blockedByDriverMetadata, ShellApiErrors };
1
+ declare function blockedByDriverMetadata(apiDetails: string): {
2
+ driverCaused: boolean;
3
+ api: string;
4
+ };
5
+ declare enum ShellApiErrors {
6
+ NotConnectedToShardedCluster = "SHAPI-10001",
7
+ NotConnectedToReplicaSet = "SHAPI-10002",
8
+ NotConnectedToMongos = "SHAPI-10003",
9
+ NotConnected = "SHAPI-10004",
10
+ NotUsingFLE = "SHAPI-10005"
11
+ }
12
+ export { blockedByDriverMetadata, ShellApiErrors };
@@ -1,20 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ShellApiErrors = exports.blockedByDriverMetadata = void 0;
4
- function blockedByDriverMetadata(apiDetails) {
5
- return {
6
- driverCaused: true,
7
- api: apiDetails
8
- };
9
- }
10
- exports.blockedByDriverMetadata = blockedByDriverMetadata;
11
- var ShellApiErrors;
12
- (function (ShellApiErrors) {
13
- ShellApiErrors["NotConnectedToShardedCluster"] = "SHAPI-10001";
14
- ShellApiErrors["NotConnectedToReplicaSet"] = "SHAPI-10002";
15
- ShellApiErrors["NotConnectedToMongos"] = "SHAPI-10003";
16
- ShellApiErrors["NotConnected"] = "SHAPI-10004";
17
- ShellApiErrors["NotUsingFLE"] = "SHAPI-10005";
18
- })(ShellApiErrors || (ShellApiErrors = {}));
19
- exports.ShellApiErrors = ShellApiErrors;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ShellApiErrors = exports.blockedByDriverMetadata = void 0;
4
+ function blockedByDriverMetadata(apiDetails) {
5
+ return {
6
+ driverCaused: true,
7
+ api: apiDetails
8
+ };
9
+ }
10
+ exports.blockedByDriverMetadata = blockedByDriverMetadata;
11
+ var ShellApiErrors;
12
+ (function (ShellApiErrors) {
13
+ ShellApiErrors["NotConnectedToShardedCluster"] = "SHAPI-10001";
14
+ ShellApiErrors["NotConnectedToReplicaSet"] = "SHAPI-10002";
15
+ ShellApiErrors["NotConnectedToMongos"] = "SHAPI-10003";
16
+ ShellApiErrors["NotConnected"] = "SHAPI-10004";
17
+ ShellApiErrors["NotUsingFLE"] = "SHAPI-10005";
18
+ })(ShellApiErrors || (ShellApiErrors = {}));
19
+ exports.ShellApiErrors = ShellApiErrors;
20
20
  //# sourceMappingURL=error-codes.js.map
@@ -1,11 +1,11 @@
1
- import Cursor from './cursor';
2
- import type Mongo from './mongo';
3
- import { asPrintable } from './enums';
4
- import type { ExplainVerbosityLike } from '@qp-mongosh/service-provider-core';
5
- export default class ExplainableCursor extends Cursor {
6
- _baseCursor: Cursor;
7
- _verbosity: ExplainVerbosityLike;
8
- _explained: any;
9
- constructor(mongo: Mongo, cursor: Cursor, verbosity: ExplainVerbosityLike);
10
- [asPrintable](): Promise<any>;
11
- }
1
+ import Cursor from './cursor';
2
+ import type Mongo from './mongo';
3
+ import { asPrintable } from './enums';
4
+ import type { ExplainVerbosityLike } from '@qp-mongosh/service-provider-core';
5
+ export default class ExplainableCursor extends Cursor {
6
+ _baseCursor: Cursor;
7
+ _verbosity: ExplainVerbosityLike;
8
+ _explained: any;
9
+ constructor(mongo: Mongo, cursor: Cursor, verbosity: ExplainVerbosityLike);
10
+ [asPrintable](): Promise<any>;
11
+ }
@@ -1,32 +1,32 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const decorators_1 = require("./decorators");
13
- const cursor_1 = __importDefault(require("./cursor"));
14
- const enums_1 = require("./enums");
15
- let ExplainableCursor = class ExplainableCursor extends cursor_1.default {
16
- constructor(mongo, cursor, verbosity) {
17
- super(mongo, cursor._cursor);
18
- this._baseCursor = cursor;
19
- this._verbosity = verbosity;
20
- this._explained = null;
21
- }
22
- async [enums_1.asPrintable]() {
23
- var _a;
24
- (_a = this._explained) !== null && _a !== void 0 ? _a : (this._explained = await this._baseCursor.explain(this._verbosity));
25
- return this._explained;
26
- }
27
- };
28
- ExplainableCursor = __decorate([
29
- decorators_1.shellApiClassDefault
30
- ], ExplainableCursor);
31
- exports.default = ExplainableCursor;
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const decorators_1 = require("./decorators");
13
+ const cursor_1 = __importDefault(require("./cursor"));
14
+ const enums_1 = require("./enums");
15
+ let ExplainableCursor = class ExplainableCursor extends cursor_1.default {
16
+ constructor(mongo, cursor, verbosity) {
17
+ super(mongo, cursor._cursor);
18
+ this._baseCursor = cursor;
19
+ this._verbosity = verbosity;
20
+ this._explained = null;
21
+ }
22
+ async [enums_1.asPrintable]() {
23
+ var _a;
24
+ (_a = this._explained) !== null && _a !== void 0 ? _a : (this._explained = await this._baseCursor.explain(this._verbosity));
25
+ return this._explained;
26
+ }
27
+ };
28
+ ExplainableCursor = __decorate([
29
+ decorators_1.shellApiClassDefault
30
+ ], ExplainableCursor);
31
+ exports.default = ExplainableCursor;
32
32
  //# sourceMappingURL=explainable-cursor.js.map
@@ -1,32 +1,32 @@
1
- import type Collection from './collection';
2
- import type Mongo from './mongo';
3
- import ExplainableCursor from './explainable-cursor';
4
- import { ShellApiWithMongoClass } from './decorators';
5
- import { asPrintable } from './enums';
6
- import { RemoveShellOptions, FindAndModifyShellOptions, FindAndModifyMethodShellOptions, MapReduceShellOptions } from './helpers';
7
- import type { Document, ExplainVerbosityLike, CountOptions, DistinctOptions, UpdateOptions, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions } from '@qp-mongosh/service-provider-core';
8
- export default class Explainable extends ShellApiWithMongoClass {
9
- _mongo: Mongo;
10
- _collection: Collection;
11
- _verbosity: ExplainVerbosityLike;
12
- constructor(mongo: Mongo, collection: Collection, verbosity: ExplainVerbosityLike);
13
- [asPrintable](): string;
14
- private _emitExplainableApiCall;
15
- getCollection(): Collection;
16
- getVerbosity(): ExplainVerbosityLike;
17
- setVerbosity(verbosity: ExplainVerbosityLike): void;
18
- find(query?: Document, projection?: Document): Promise<ExplainableCursor>;
19
- aggregate(pipeline: Document[], options: Document): Promise<Document>;
20
- aggregate(...stages: Document[]): Promise<Document>;
21
- count(query?: {}, options?: CountOptions): Promise<Document>;
22
- distinct(field: string): Promise<Document>;
23
- distinct(field: string, query: Document): Promise<Document>;
24
- distinct(field: string, query: Document, options: DistinctOptions): Promise<Document>;
25
- findAndModify(options: FindAndModifyMethodShellOptions): Promise<Document>;
26
- findOneAndDelete(filter: Document, options?: FindOneAndDeleteOptions): Promise<Document>;
27
- findOneAndReplace(filter: Document, replacement: Document, options?: FindAndModifyShellOptions<FindOneAndReplaceOptions>): Promise<Document>;
28
- findOneAndUpdate(filter: Document, update: Document, options?: FindAndModifyShellOptions<FindOneAndUpdateOptions>): Promise<Document>;
29
- remove(query: Document, options?: boolean | RemoveShellOptions): Promise<Document>;
30
- update(filter: Document, update: Document, options?: UpdateOptions): Promise<Document>;
31
- mapReduce(map: Function | string, reduce: Function | string, optionsOrOutString: MapReduceShellOptions): Promise<Document>;
32
- }
1
+ import type Collection from './collection';
2
+ import type Mongo from './mongo';
3
+ import ExplainableCursor from './explainable-cursor';
4
+ import { ShellApiWithMongoClass } from './decorators';
5
+ import { asPrintable } from './enums';
6
+ import { RemoveShellOptions, FindAndModifyShellOptions, FindAndModifyMethodShellOptions, MapReduceShellOptions } from './helpers';
7
+ import type { Document, ExplainVerbosityLike, CountOptions, DistinctOptions, UpdateOptions, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions } from '@qp-mongosh/service-provider-core';
8
+ export default class Explainable extends ShellApiWithMongoClass {
9
+ _mongo: Mongo;
10
+ _collection: Collection;
11
+ _verbosity: ExplainVerbosityLike;
12
+ constructor(mongo: Mongo, collection: Collection, verbosity: ExplainVerbosityLike);
13
+ [asPrintable](): string;
14
+ private _emitExplainableApiCall;
15
+ getCollection(): Collection;
16
+ getVerbosity(): ExplainVerbosityLike;
17
+ setVerbosity(verbosity: ExplainVerbosityLike): void;
18
+ find(query?: Document, projection?: Document): Promise<ExplainableCursor>;
19
+ aggregate(pipeline: Document[], options: Document): Promise<Document>;
20
+ aggregate(...stages: Document[]): Promise<Document>;
21
+ count(query?: {}, options?: CountOptions): Promise<Document>;
22
+ distinct(field: string): Promise<Document>;
23
+ distinct(field: string, query: Document): Promise<Document>;
24
+ distinct(field: string, query: Document, options: DistinctOptions): Promise<Document>;
25
+ findAndModify(options: FindAndModifyMethodShellOptions): Promise<Document>;
26
+ findOneAndDelete(filter: Document, options?: FindOneAndDeleteOptions): Promise<Document>;
27
+ findOneAndReplace(filter: Document, replacement: Document, options?: FindAndModifyShellOptions<FindOneAndReplaceOptions>): Promise<Document>;
28
+ findOneAndUpdate(filter: Document, update: Document, options?: FindAndModifyShellOptions<FindOneAndUpdateOptions>): Promise<Document>;
29
+ remove(query: Document, options?: boolean | RemoveShellOptions): Promise<Document>;
30
+ update(filter: Document, update: Document, options?: UpdateOptions): Promise<Document>;
31
+ mapReduce(map: Function | string, reduce: Function | string, optionsOrOutString: MapReduceShellOptions): Promise<Document>;
32
+ }