@qp-mongosh/shell-api 0.0.0-dev.5 → 0.0.0-dev.7
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/.eslintignore +2 -2
- package/.eslintrc.js +1 -1
- package/AUTHORS +15 -15
- package/LICENSE +200 -200
- package/bin/report-missing-help.ts +24 -24
- package/bin/report-supported-api.ts +14 -14
- package/lib/abstract-cursor.d.ts +33 -33
- package/lib/abstract-cursor.js +191 -191
- package/lib/aggregation-cursor.d.ts +6 -6
- package/lib/aggregation-cursor.js +19 -19
- package/lib/bulk.d.ts +43 -43
- package/lib/bulk.js +223 -223
- package/lib/change-stream-cursor.d.ts +28 -28
- package/lib/change-stream-cursor.js +111 -111
- package/lib/collection.d.ts +95 -95
- package/lib/collection.js +964 -964
- package/lib/cursor.d.ts +32 -32
- package/lib/cursor.js +215 -215
- package/lib/database.d.ts +116 -116
- package/lib/database.js +1223 -1223
- package/lib/dbquery.d.ts +8 -8
- package/lib/dbquery.js +28 -28
- package/lib/decorators.d.ts +73 -73
- package/lib/decorators.js +395 -395
- package/lib/deprecation-warning.d.ts +2 -0
- package/lib/deprecation-warning.js +19 -0
- package/lib/deprecation-warning.js.map +1 -0
- package/lib/enums.d.ts +28 -28
- package/lib/enums.js +33 -33
- package/lib/error-codes.d.ts +12 -12
- package/lib/error-codes.js +19 -19
- package/lib/explainable-cursor.d.ts +11 -11
- package/lib/explainable-cursor.js +31 -31
- package/lib/explainable.d.ts +32 -32
- package/lib/explainable.js +166 -166
- package/lib/field-level-encryption.d.ts +50 -50
- package/lib/field-level-encryption.js +176 -176
- package/lib/help.d.ts +22 -22
- package/lib/help.js +26 -26
- package/lib/helpers.d.ts +71 -71
- package/lib/helpers.js +588 -588
- package/lib/index.d.ts +16 -16
- package/lib/index.js +45 -45
- package/lib/interruptor.d.ts +19 -19
- package/lib/interruptor.js +62 -62
- package/lib/mongo-errors.d.ts +5 -5
- package/lib/mongo-errors.js +37 -37
- package/lib/mongo.d.ts +75 -75
- package/lib/mongo.js +476 -476
- package/lib/no-db.d.ts +5 -5
- package/lib/no-db.js +28 -28
- package/lib/plan-cache.d.ts +16 -16
- package/lib/plan-cache.js +70 -70
- package/lib/replica-set.d.ts +45 -45
- package/lib/replica-set.js +314 -314
- package/lib/result.d.ts +61 -61
- package/lib/result.js +104 -104
- package/lib/session.d.ts +25 -25
- package/lib/session.js +88 -88
- package/lib/shard.d.ts +42 -42
- package/lib/shard.js +414 -414
- package/lib/shell-api.d.ts +52 -52
- package/lib/shell-api.js +298 -298
- package/lib/shell-bson.d.ts +40 -40
- package/lib/shell-bson.js +159 -159
- package/lib/shell-instance-state.d.ts +77 -77
- package/lib/shell-instance-state.js +392 -392
- package/lib/shell-internal-state.d.ts +74 -0
- package/lib/shell-internal-state.js +364 -0
- package/lib/shell-internal-state.js.map +1 -0
- package/package.json +47 -47
- package/tsconfig.lint.json +8 -8
package/lib/no-db.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Mongo from './mongo';
|
|
2
|
-
export default class NoDatabase {
|
|
3
|
-
_mongo: Mongo;
|
|
4
|
-
constructor();
|
|
5
|
-
}
|
|
1
|
+
import Mongo from './mongo';
|
|
2
|
+
export default class NoDatabase {
|
|
3
|
+
_mongo: Mongo;
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
package/lib/no-db.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const errors_1 = require("@qp-mongosh/errors");
|
|
4
|
-
const error_codes_1 = require("./error-codes");
|
|
5
|
-
class NoDatabase {
|
|
6
|
-
constructor() {
|
|
7
|
-
this._mongo = new NoMongo();
|
|
8
|
-
const proxy = new Proxy(this, {
|
|
9
|
-
get: (_target, prop) => {
|
|
10
|
-
if (prop === '_mongo')
|
|
11
|
-
return this._mongo;
|
|
12
|
-
throw new errors_1.MongoshInvalidInputError('No connected database', error_codes_1.ShellApiErrors.NotConnected);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
return proxy;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.default = NoDatabase;
|
|
19
|
-
class NoMongo {
|
|
20
|
-
constructor() {
|
|
21
|
-
const proxy = new Proxy(this, {
|
|
22
|
-
get: () => {
|
|
23
|
-
throw new errors_1.MongoshInvalidInputError('No connected database', error_codes_1.ShellApiErrors.NotConnected);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
return proxy;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const errors_1 = require("@qp-mongosh/errors");
|
|
4
|
+
const error_codes_1 = require("./error-codes");
|
|
5
|
+
class NoDatabase {
|
|
6
|
+
constructor() {
|
|
7
|
+
this._mongo = new NoMongo();
|
|
8
|
+
const proxy = new Proxy(this, {
|
|
9
|
+
get: (_target, prop) => {
|
|
10
|
+
if (prop === '_mongo')
|
|
11
|
+
return this._mongo;
|
|
12
|
+
throw new errors_1.MongoshInvalidInputError('No connected database', error_codes_1.ShellApiErrors.NotConnected);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return proxy;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = NoDatabase;
|
|
19
|
+
class NoMongo {
|
|
20
|
+
constructor() {
|
|
21
|
+
const proxy = new Proxy(this, {
|
|
22
|
+
get: () => {
|
|
23
|
+
throw new errors_1.MongoshInvalidInputError('No connected database', error_codes_1.ShellApiErrors.NotConnected);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return proxy;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
29
|
//# sourceMappingURL=no-db.js.map
|
package/lib/plan-cache.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ShellApiWithMongoClass } from './decorators';
|
|
2
|
-
import { Document } from '@qp-mongosh/service-provider-core';
|
|
3
|
-
import Collection from './collection';
|
|
4
|
-
import { asPrintable } from './enums';
|
|
5
|
-
import Mongo from './mongo';
|
|
6
|
-
export default class PlanCache extends ShellApiWithMongoClass {
|
|
7
|
-
_collection: Collection;
|
|
8
|
-
constructor(collection: Collection);
|
|
9
|
-
get _mongo(): Mongo;
|
|
10
|
-
[asPrintable](): string;
|
|
11
|
-
clear(): Promise<Document>;
|
|
12
|
-
clearPlansByQuery(query: Document, projection?: Document, sort?: Document): Promise<Document>;
|
|
13
|
-
list(pipeline?: Document[]): Promise<Document[]>;
|
|
14
|
-
listQueryShapes(): never;
|
|
15
|
-
getPlansByQuery(): never;
|
|
16
|
-
}
|
|
1
|
+
import { ShellApiWithMongoClass } from './decorators';
|
|
2
|
+
import { Document } from '@qp-mongosh/service-provider-core';
|
|
3
|
+
import Collection from './collection';
|
|
4
|
+
import { asPrintable } from './enums';
|
|
5
|
+
import Mongo from './mongo';
|
|
6
|
+
export default class PlanCache extends ShellApiWithMongoClass {
|
|
7
|
+
_collection: Collection;
|
|
8
|
+
constructor(collection: Collection);
|
|
9
|
+
get _mongo(): Mongo;
|
|
10
|
+
[asPrintable](): string;
|
|
11
|
+
clear(): Promise<Document>;
|
|
12
|
+
clearPlansByQuery(query: Document, projection?: Document, sort?: Document): Promise<Document>;
|
|
13
|
+
list(pipeline?: Document[]): Promise<Document[]>;
|
|
14
|
+
listQueryShapes(): never;
|
|
15
|
+
getPlansByQuery(): never;
|
|
16
|
+
}
|
package/lib/plan-cache.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const decorators_1 = require("./decorators");
|
|
10
|
-
const enums_1 = require("./enums");
|
|
11
|
-
const errors_1 = require("@qp-mongosh/errors");
|
|
12
|
-
let PlanCache = class PlanCache extends decorators_1.ShellApiWithMongoClass {
|
|
13
|
-
constructor(collection) {
|
|
14
|
-
super();
|
|
15
|
-
this._collection = collection;
|
|
16
|
-
}
|
|
17
|
-
get _mongo() {
|
|
18
|
-
return this._collection._mongo;
|
|
19
|
-
}
|
|
20
|
-
[enums_1.asPrintable]() {
|
|
21
|
-
return `PlanCache for collection ${this._collection._name}.`;
|
|
22
|
-
}
|
|
23
|
-
async clear() {
|
|
24
|
-
return await this._collection.runCommand('planCacheClear');
|
|
25
|
-
}
|
|
26
|
-
async clearPlansByQuery(query, projection, sort) {
|
|
27
|
-
const cmd = { query };
|
|
28
|
-
if (projection) {
|
|
29
|
-
cmd.projection = projection;
|
|
30
|
-
}
|
|
31
|
-
if (sort) {
|
|
32
|
-
cmd.sort = sort;
|
|
33
|
-
}
|
|
34
|
-
return await this._collection.runCommand('planCacheClear', cmd);
|
|
35
|
-
}
|
|
36
|
-
async list(pipeline) {
|
|
37
|
-
const p = pipeline || [];
|
|
38
|
-
const agg = await this._collection.aggregate([{ $planCacheStats: {} }, ...p]);
|
|
39
|
-
return await agg.toArray();
|
|
40
|
-
}
|
|
41
|
-
listQueryShapes() {
|
|
42
|
-
throw new errors_1.MongoshDeprecatedError('PlanCache.listQueryShapes was deprecated, please use PlanCache.list instead');
|
|
43
|
-
}
|
|
44
|
-
getPlansByQuery() {
|
|
45
|
-
throw new errors_1.MongoshDeprecatedError('PlanCache.getPlansByQuery was deprecated, please use PlanCache.list instead');
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
__decorate([
|
|
49
|
-
decorators_1.returnsPromise,
|
|
50
|
-
(0, decorators_1.apiVersions)([])
|
|
51
|
-
], PlanCache.prototype, "clear", null);
|
|
52
|
-
__decorate([
|
|
53
|
-
decorators_1.returnsPromise,
|
|
54
|
-
(0, decorators_1.apiVersions)([])
|
|
55
|
-
], PlanCache.prototype, "clearPlansByQuery", null);
|
|
56
|
-
__decorate([
|
|
57
|
-
(0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest]),
|
|
58
|
-
decorators_1.returnsPromise,
|
|
59
|
-
(0, decorators_1.apiVersions)([])
|
|
60
|
-
], PlanCache.prototype, "list", null);
|
|
61
|
-
__decorate([
|
|
62
|
-
decorators_1.deprecated
|
|
63
|
-
], PlanCache.prototype, "listQueryShapes", null);
|
|
64
|
-
__decorate([
|
|
65
|
-
decorators_1.deprecated
|
|
66
|
-
], PlanCache.prototype, "getPlansByQuery", null);
|
|
67
|
-
PlanCache = __decorate([
|
|
68
|
-
decorators_1.shellApiClassDefault
|
|
69
|
-
], PlanCache);
|
|
70
|
-
exports.default = PlanCache;
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const decorators_1 = require("./decorators");
|
|
10
|
+
const enums_1 = require("./enums");
|
|
11
|
+
const errors_1 = require("@qp-mongosh/errors");
|
|
12
|
+
let PlanCache = class PlanCache extends decorators_1.ShellApiWithMongoClass {
|
|
13
|
+
constructor(collection) {
|
|
14
|
+
super();
|
|
15
|
+
this._collection = collection;
|
|
16
|
+
}
|
|
17
|
+
get _mongo() {
|
|
18
|
+
return this._collection._mongo;
|
|
19
|
+
}
|
|
20
|
+
[enums_1.asPrintable]() {
|
|
21
|
+
return `PlanCache for collection ${this._collection._name}.`;
|
|
22
|
+
}
|
|
23
|
+
async clear() {
|
|
24
|
+
return await this._collection.runCommand('planCacheClear');
|
|
25
|
+
}
|
|
26
|
+
async clearPlansByQuery(query, projection, sort) {
|
|
27
|
+
const cmd = { query };
|
|
28
|
+
if (projection) {
|
|
29
|
+
cmd.projection = projection;
|
|
30
|
+
}
|
|
31
|
+
if (sort) {
|
|
32
|
+
cmd.sort = sort;
|
|
33
|
+
}
|
|
34
|
+
return await this._collection.runCommand('planCacheClear', cmd);
|
|
35
|
+
}
|
|
36
|
+
async list(pipeline) {
|
|
37
|
+
const p = pipeline || [];
|
|
38
|
+
const agg = await this._collection.aggregate([{ $planCacheStats: {} }, ...p]);
|
|
39
|
+
return await agg.toArray();
|
|
40
|
+
}
|
|
41
|
+
listQueryShapes() {
|
|
42
|
+
throw new errors_1.MongoshDeprecatedError('PlanCache.listQueryShapes was deprecated, please use PlanCache.list instead');
|
|
43
|
+
}
|
|
44
|
+
getPlansByQuery() {
|
|
45
|
+
throw new errors_1.MongoshDeprecatedError('PlanCache.getPlansByQuery was deprecated, please use PlanCache.list instead');
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
__decorate([
|
|
49
|
+
decorators_1.returnsPromise,
|
|
50
|
+
(0, decorators_1.apiVersions)([])
|
|
51
|
+
], PlanCache.prototype, "clear", null);
|
|
52
|
+
__decorate([
|
|
53
|
+
decorators_1.returnsPromise,
|
|
54
|
+
(0, decorators_1.apiVersions)([])
|
|
55
|
+
], PlanCache.prototype, "clearPlansByQuery", null);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest]),
|
|
58
|
+
decorators_1.returnsPromise,
|
|
59
|
+
(0, decorators_1.apiVersions)([])
|
|
60
|
+
], PlanCache.prototype, "list", null);
|
|
61
|
+
__decorate([
|
|
62
|
+
decorators_1.deprecated
|
|
63
|
+
], PlanCache.prototype, "listQueryShapes", null);
|
|
64
|
+
__decorate([
|
|
65
|
+
decorators_1.deprecated
|
|
66
|
+
], PlanCache.prototype, "getPlansByQuery", null);
|
|
67
|
+
PlanCache = __decorate([
|
|
68
|
+
decorators_1.shellApiClassDefault
|
|
69
|
+
], PlanCache);
|
|
70
|
+
exports.default = PlanCache;
|
|
71
71
|
//# sourceMappingURL=plan-cache.js.map
|
package/lib/replica-set.d.ts
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { Document } from '@qp-mongosh/service-provider-core';
|
|
2
|
-
import Mongo from './mongo';
|
|
3
|
-
import Database from './database';
|
|
4
|
-
import { ShellApiWithMongoClass } from './decorators';
|
|
5
|
-
import { asPrintable } from './enums';
|
|
6
|
-
import { CommandResult } from './result';
|
|
7
|
-
export declare type ReplSetMemberConfig = {
|
|
8
|
-
_id: number;
|
|
9
|
-
host: string;
|
|
10
|
-
priority?: number;
|
|
11
|
-
votes?: number;
|
|
12
|
-
arbiterOnly?: boolean;
|
|
13
|
-
};
|
|
14
|
-
export declare type ReplSetConfig = {
|
|
15
|
-
version: number;
|
|
16
|
-
_id: string;
|
|
17
|
-
members: ReplSetMemberConfig[];
|
|
18
|
-
protocolVersion: number;
|
|
19
|
-
};
|
|
20
|
-
export default class ReplicaSet extends ShellApiWithMongoClass {
|
|
21
|
-
_database: Database;
|
|
22
|
-
constructor(database: Database);
|
|
23
|
-
get _mongo(): Mongo;
|
|
24
|
-
initiate(config?: Partial<ReplSetConfig>): Promise<Document>;
|
|
25
|
-
_getConfig(): Promise<ReplSetConfig>;
|
|
26
|
-
config(): Promise<ReplSetConfig>;
|
|
27
|
-
conf(): Promise<ReplSetConfig>;
|
|
28
|
-
reconfig(config: Partial<ReplSetConfig>, options?: {}): Promise<Document>;
|
|
29
|
-
reconfigForPSASet(newMemberIndex: number, config: Partial<ReplSetConfig>, options?: {}): Promise<Document>;
|
|
30
|
-
status(): Promise<Document>;
|
|
31
|
-
isMaster(): Promise<Document>;
|
|
32
|
-
hello(): Promise<Document>;
|
|
33
|
-
printSecondaryReplicationInfo(): Promise<CommandResult>;
|
|
34
|
-
printSlaveReplicationInfo(): never;
|
|
35
|
-
printReplicationInfo(): Promise<CommandResult>;
|
|
36
|
-
add(hostport: string | Partial<ReplSetMemberConfig>, arb?: boolean): Promise<Document>;
|
|
37
|
-
addArb(hostname: string): Promise<Document>;
|
|
38
|
-
remove(hostname: string): Promise<Document>;
|
|
39
|
-
freeze(secs: number): Promise<Document>;
|
|
40
|
-
stepDown(stepdownSecs?: number, catchUpSecs?: number): Promise<Document>;
|
|
41
|
-
syncFrom(host: string): Promise<Document>;
|
|
42
|
-
secondaryOk(): Promise<void>;
|
|
43
|
-
[asPrintable](): string;
|
|
44
|
-
private _emitReplicaSetApiCall;
|
|
45
|
-
}
|
|
1
|
+
import { Document } from '@qp-mongosh/service-provider-core';
|
|
2
|
+
import Mongo from './mongo';
|
|
3
|
+
import Database from './database';
|
|
4
|
+
import { ShellApiWithMongoClass } from './decorators';
|
|
5
|
+
import { asPrintable } from './enums';
|
|
6
|
+
import { CommandResult } from './result';
|
|
7
|
+
export declare type ReplSetMemberConfig = {
|
|
8
|
+
_id: number;
|
|
9
|
+
host: string;
|
|
10
|
+
priority?: number;
|
|
11
|
+
votes?: number;
|
|
12
|
+
arbiterOnly?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare type ReplSetConfig = {
|
|
15
|
+
version: number;
|
|
16
|
+
_id: string;
|
|
17
|
+
members: ReplSetMemberConfig[];
|
|
18
|
+
protocolVersion: number;
|
|
19
|
+
};
|
|
20
|
+
export default class ReplicaSet extends ShellApiWithMongoClass {
|
|
21
|
+
_database: Database;
|
|
22
|
+
constructor(database: Database);
|
|
23
|
+
get _mongo(): Mongo;
|
|
24
|
+
initiate(config?: Partial<ReplSetConfig>): Promise<Document>;
|
|
25
|
+
_getConfig(): Promise<ReplSetConfig>;
|
|
26
|
+
config(): Promise<ReplSetConfig>;
|
|
27
|
+
conf(): Promise<ReplSetConfig>;
|
|
28
|
+
reconfig(config: Partial<ReplSetConfig>, options?: {}): Promise<Document>;
|
|
29
|
+
reconfigForPSASet(newMemberIndex: number, config: Partial<ReplSetConfig>, options?: {}): Promise<Document>;
|
|
30
|
+
status(): Promise<Document>;
|
|
31
|
+
isMaster(): Promise<Document>;
|
|
32
|
+
hello(): Promise<Document>;
|
|
33
|
+
printSecondaryReplicationInfo(): Promise<CommandResult>;
|
|
34
|
+
printSlaveReplicationInfo(): never;
|
|
35
|
+
printReplicationInfo(): Promise<CommandResult>;
|
|
36
|
+
add(hostport: string | Partial<ReplSetMemberConfig>, arb?: boolean): Promise<Document>;
|
|
37
|
+
addArb(hostname: string): Promise<Document>;
|
|
38
|
+
remove(hostname: string): Promise<Document>;
|
|
39
|
+
freeze(secs: number): Promise<Document>;
|
|
40
|
+
stepDown(stepdownSecs?: number, catchUpSecs?: number): Promise<Document>;
|
|
41
|
+
syncFrom(host: string): Promise<Document>;
|
|
42
|
+
secondaryOk(): Promise<void>;
|
|
43
|
+
[asPrintable](): string;
|
|
44
|
+
private _emitReplicaSetApiCall;
|
|
45
|
+
}
|