@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/result.d.ts
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { ShellApiValueClass } from './decorators';
|
|
2
|
-
import { asPrintable } from './enums';
|
|
3
|
-
import { Document, ObjectIdType } from '@qp-mongosh/service-provider-core';
|
|
4
|
-
export declare class CommandResult<T = unknown> extends ShellApiValueClass {
|
|
5
|
-
value: T;
|
|
6
|
-
type: string;
|
|
7
|
-
constructor(type: string, value: T);
|
|
8
|
-
[asPrintable](): T;
|
|
9
|
-
toJSON(): T;
|
|
10
|
-
}
|
|
11
|
-
export declare class BulkWriteResult extends ShellApiValueClass {
|
|
12
|
-
acknowledged: boolean;
|
|
13
|
-
insertedCount: number;
|
|
14
|
-
insertedIds: {
|
|
15
|
-
[index: number]: ObjectIdType;
|
|
16
|
-
};
|
|
17
|
-
matchedCount: number;
|
|
18
|
-
modifiedCount: number;
|
|
19
|
-
deletedCount: number;
|
|
20
|
-
upsertedCount: number;
|
|
21
|
-
upsertedIds: {
|
|
22
|
-
[index: number]: ObjectIdType;
|
|
23
|
-
};
|
|
24
|
-
constructor(acknowledged: boolean, insertedCount: number, insertedIds: {
|
|
25
|
-
[index: number]: ObjectIdType;
|
|
26
|
-
}, matchedCount: number, modifiedCount: number, deletedCount: number, upsertedCount: number, upsertedIds: {
|
|
27
|
-
[index: number]: ObjectIdType;
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
export declare class InsertManyResult extends ShellApiValueClass {
|
|
31
|
-
acknowledged: boolean;
|
|
32
|
-
insertedIds: {
|
|
33
|
-
[key: number]: ObjectIdType;
|
|
34
|
-
};
|
|
35
|
-
constructor(acknowledged: boolean, insertedIds: {
|
|
36
|
-
[key: number]: ObjectIdType;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
export declare class InsertOneResult extends ShellApiValueClass {
|
|
40
|
-
acknowledged: boolean;
|
|
41
|
-
insertedId: ObjectIdType | undefined;
|
|
42
|
-
constructor(acknowledged: boolean, insertedId?: ObjectIdType);
|
|
43
|
-
}
|
|
44
|
-
export declare class UpdateResult extends ShellApiValueClass {
|
|
45
|
-
acknowledged: boolean;
|
|
46
|
-
insertedId: ObjectIdType;
|
|
47
|
-
matchedCount: number;
|
|
48
|
-
modifiedCount: number;
|
|
49
|
-
upsertedCount: number;
|
|
50
|
-
constructor(acknowledged: boolean, matchedCount: number, modifiedCount: number, upsertedCount: number, insertedId: ObjectIdType);
|
|
51
|
-
}
|
|
52
|
-
export declare class DeleteResult extends ShellApiValueClass {
|
|
53
|
-
acknowledged: boolean;
|
|
54
|
-
deletedCount: number | undefined;
|
|
55
|
-
constructor(acknowledged: boolean, deletedCount: number | undefined);
|
|
56
|
-
}
|
|
57
|
-
export declare class CursorIterationResult extends ShellApiValueClass {
|
|
58
|
-
cursorHasMore: boolean;
|
|
59
|
-
documents: Document[];
|
|
60
|
-
constructor();
|
|
61
|
-
}
|
|
1
|
+
import { ShellApiValueClass } from './decorators';
|
|
2
|
+
import { asPrintable } from './enums';
|
|
3
|
+
import { Document, ObjectIdType } from '@qp-mongosh/service-provider-core';
|
|
4
|
+
export declare class CommandResult<T = unknown> extends ShellApiValueClass {
|
|
5
|
+
value: T;
|
|
6
|
+
type: string;
|
|
7
|
+
constructor(type: string, value: T);
|
|
8
|
+
[asPrintable](): T;
|
|
9
|
+
toJSON(): T;
|
|
10
|
+
}
|
|
11
|
+
export declare class BulkWriteResult extends ShellApiValueClass {
|
|
12
|
+
acknowledged: boolean;
|
|
13
|
+
insertedCount: number;
|
|
14
|
+
insertedIds: {
|
|
15
|
+
[index: number]: ObjectIdType;
|
|
16
|
+
};
|
|
17
|
+
matchedCount: number;
|
|
18
|
+
modifiedCount: number;
|
|
19
|
+
deletedCount: number;
|
|
20
|
+
upsertedCount: number;
|
|
21
|
+
upsertedIds: {
|
|
22
|
+
[index: number]: ObjectIdType;
|
|
23
|
+
};
|
|
24
|
+
constructor(acknowledged: boolean, insertedCount: number, insertedIds: {
|
|
25
|
+
[index: number]: ObjectIdType;
|
|
26
|
+
}, matchedCount: number, modifiedCount: number, deletedCount: number, upsertedCount: number, upsertedIds: {
|
|
27
|
+
[index: number]: ObjectIdType;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export declare class InsertManyResult extends ShellApiValueClass {
|
|
31
|
+
acknowledged: boolean;
|
|
32
|
+
insertedIds: {
|
|
33
|
+
[key: number]: ObjectIdType;
|
|
34
|
+
};
|
|
35
|
+
constructor(acknowledged: boolean, insertedIds: {
|
|
36
|
+
[key: number]: ObjectIdType;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export declare class InsertOneResult extends ShellApiValueClass {
|
|
40
|
+
acknowledged: boolean;
|
|
41
|
+
insertedId: ObjectIdType | undefined;
|
|
42
|
+
constructor(acknowledged: boolean, insertedId?: ObjectIdType);
|
|
43
|
+
}
|
|
44
|
+
export declare class UpdateResult extends ShellApiValueClass {
|
|
45
|
+
acknowledged: boolean;
|
|
46
|
+
insertedId: ObjectIdType;
|
|
47
|
+
matchedCount: number;
|
|
48
|
+
modifiedCount: number;
|
|
49
|
+
upsertedCount: number;
|
|
50
|
+
constructor(acknowledged: boolean, matchedCount: number, modifiedCount: number, upsertedCount: number, insertedId: ObjectIdType);
|
|
51
|
+
}
|
|
52
|
+
export declare class DeleteResult extends ShellApiValueClass {
|
|
53
|
+
acknowledged: boolean;
|
|
54
|
+
deletedCount: number | undefined;
|
|
55
|
+
constructor(acknowledged: boolean, deletedCount: number | undefined);
|
|
56
|
+
}
|
|
57
|
+
export declare class CursorIterationResult extends ShellApiValueClass {
|
|
58
|
+
cursorHasMore: boolean;
|
|
59
|
+
documents: Document[];
|
|
60
|
+
constructor();
|
|
61
|
+
}
|
package/lib/result.js
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
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
|
-
exports.CursorIterationResult = exports.DeleteResult = exports.UpdateResult = exports.InsertOneResult = exports.InsertManyResult = exports.BulkWriteResult = exports.CommandResult = void 0;
|
|
10
|
-
const decorators_1 = require("./decorators");
|
|
11
|
-
const enums_1 = require("./enums");
|
|
12
|
-
let CommandResult = class CommandResult extends decorators_1.ShellApiValueClass {
|
|
13
|
-
constructor(type, value) {
|
|
14
|
-
super();
|
|
15
|
-
this.type = type;
|
|
16
|
-
this.value = value;
|
|
17
|
-
this[enums_1.shellApiType] = type;
|
|
18
|
-
}
|
|
19
|
-
[enums_1.asPrintable]() {
|
|
20
|
-
return this.value;
|
|
21
|
-
}
|
|
22
|
-
toJSON() {
|
|
23
|
-
return this.value;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
CommandResult = __decorate([
|
|
27
|
-
decorators_1.shellApiClassDefault
|
|
28
|
-
], CommandResult);
|
|
29
|
-
exports.CommandResult = CommandResult;
|
|
30
|
-
let BulkWriteResult = class BulkWriteResult extends decorators_1.ShellApiValueClass {
|
|
31
|
-
constructor(acknowledged, insertedCount, insertedIds, matchedCount, modifiedCount, deletedCount, upsertedCount, upsertedIds) {
|
|
32
|
-
super();
|
|
33
|
-
this.acknowledged = acknowledged;
|
|
34
|
-
this.insertedCount = insertedCount;
|
|
35
|
-
this.insertedIds = insertedIds;
|
|
36
|
-
this.matchedCount = matchedCount;
|
|
37
|
-
this.modifiedCount = modifiedCount;
|
|
38
|
-
this.deletedCount = deletedCount;
|
|
39
|
-
this.upsertedCount = upsertedCount;
|
|
40
|
-
this.upsertedIds = upsertedIds;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
BulkWriteResult = __decorate([
|
|
44
|
-
decorators_1.shellApiClassDefault
|
|
45
|
-
], BulkWriteResult);
|
|
46
|
-
exports.BulkWriteResult = BulkWriteResult;
|
|
47
|
-
let InsertManyResult = class InsertManyResult extends decorators_1.ShellApiValueClass {
|
|
48
|
-
constructor(acknowledged, insertedIds) {
|
|
49
|
-
super();
|
|
50
|
-
this.acknowledged = acknowledged;
|
|
51
|
-
this.insertedIds = insertedIds;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
InsertManyResult = __decorate([
|
|
55
|
-
decorators_1.shellApiClassDefault
|
|
56
|
-
], InsertManyResult);
|
|
57
|
-
exports.InsertManyResult = InsertManyResult;
|
|
58
|
-
let InsertOneResult = class InsertOneResult extends decorators_1.ShellApiValueClass {
|
|
59
|
-
constructor(acknowledged, insertedId) {
|
|
60
|
-
super();
|
|
61
|
-
this.acknowledged = acknowledged;
|
|
62
|
-
this.insertedId = insertedId;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
InsertOneResult = __decorate([
|
|
66
|
-
decorators_1.shellApiClassDefault
|
|
67
|
-
], InsertOneResult);
|
|
68
|
-
exports.InsertOneResult = InsertOneResult;
|
|
69
|
-
let UpdateResult = class UpdateResult extends decorators_1.ShellApiValueClass {
|
|
70
|
-
constructor(acknowledged, matchedCount, modifiedCount, upsertedCount, insertedId) {
|
|
71
|
-
super();
|
|
72
|
-
this.acknowledged = acknowledged;
|
|
73
|
-
this.insertedId = insertedId;
|
|
74
|
-
this.matchedCount = matchedCount;
|
|
75
|
-
this.modifiedCount = modifiedCount;
|
|
76
|
-
this.upsertedCount = upsertedCount;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
UpdateResult = __decorate([
|
|
80
|
-
decorators_1.shellApiClassDefault
|
|
81
|
-
], UpdateResult);
|
|
82
|
-
exports.UpdateResult = UpdateResult;
|
|
83
|
-
let DeleteResult = class DeleteResult extends decorators_1.ShellApiValueClass {
|
|
84
|
-
constructor(acknowledged, deletedCount) {
|
|
85
|
-
super();
|
|
86
|
-
this.acknowledged = acknowledged;
|
|
87
|
-
this.deletedCount = deletedCount;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
DeleteResult = __decorate([
|
|
91
|
-
decorators_1.shellApiClassDefault
|
|
92
|
-
], DeleteResult);
|
|
93
|
-
exports.DeleteResult = DeleteResult;
|
|
94
|
-
let CursorIterationResult = class CursorIterationResult extends decorators_1.ShellApiValueClass {
|
|
95
|
-
constructor() {
|
|
96
|
-
super();
|
|
97
|
-
this.cursorHasMore = true;
|
|
98
|
-
this.documents = [];
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
CursorIterationResult = __decorate([
|
|
102
|
-
decorators_1.shellApiClassDefault
|
|
103
|
-
], CursorIterationResult);
|
|
104
|
-
exports.CursorIterationResult = CursorIterationResult;
|
|
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
|
+
exports.CursorIterationResult = exports.DeleteResult = exports.UpdateResult = exports.InsertOneResult = exports.InsertManyResult = exports.BulkWriteResult = exports.CommandResult = void 0;
|
|
10
|
+
const decorators_1 = require("./decorators");
|
|
11
|
+
const enums_1 = require("./enums");
|
|
12
|
+
let CommandResult = class CommandResult extends decorators_1.ShellApiValueClass {
|
|
13
|
+
constructor(type, value) {
|
|
14
|
+
super();
|
|
15
|
+
this.type = type;
|
|
16
|
+
this.value = value;
|
|
17
|
+
this[enums_1.shellApiType] = type;
|
|
18
|
+
}
|
|
19
|
+
[enums_1.asPrintable]() {
|
|
20
|
+
return this.value;
|
|
21
|
+
}
|
|
22
|
+
toJSON() {
|
|
23
|
+
return this.value;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
CommandResult = __decorate([
|
|
27
|
+
decorators_1.shellApiClassDefault
|
|
28
|
+
], CommandResult);
|
|
29
|
+
exports.CommandResult = CommandResult;
|
|
30
|
+
let BulkWriteResult = class BulkWriteResult extends decorators_1.ShellApiValueClass {
|
|
31
|
+
constructor(acknowledged, insertedCount, insertedIds, matchedCount, modifiedCount, deletedCount, upsertedCount, upsertedIds) {
|
|
32
|
+
super();
|
|
33
|
+
this.acknowledged = acknowledged;
|
|
34
|
+
this.insertedCount = insertedCount;
|
|
35
|
+
this.insertedIds = insertedIds;
|
|
36
|
+
this.matchedCount = matchedCount;
|
|
37
|
+
this.modifiedCount = modifiedCount;
|
|
38
|
+
this.deletedCount = deletedCount;
|
|
39
|
+
this.upsertedCount = upsertedCount;
|
|
40
|
+
this.upsertedIds = upsertedIds;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
BulkWriteResult = __decorate([
|
|
44
|
+
decorators_1.shellApiClassDefault
|
|
45
|
+
], BulkWriteResult);
|
|
46
|
+
exports.BulkWriteResult = BulkWriteResult;
|
|
47
|
+
let InsertManyResult = class InsertManyResult extends decorators_1.ShellApiValueClass {
|
|
48
|
+
constructor(acknowledged, insertedIds) {
|
|
49
|
+
super();
|
|
50
|
+
this.acknowledged = acknowledged;
|
|
51
|
+
this.insertedIds = insertedIds;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
InsertManyResult = __decorate([
|
|
55
|
+
decorators_1.shellApiClassDefault
|
|
56
|
+
], InsertManyResult);
|
|
57
|
+
exports.InsertManyResult = InsertManyResult;
|
|
58
|
+
let InsertOneResult = class InsertOneResult extends decorators_1.ShellApiValueClass {
|
|
59
|
+
constructor(acknowledged, insertedId) {
|
|
60
|
+
super();
|
|
61
|
+
this.acknowledged = acknowledged;
|
|
62
|
+
this.insertedId = insertedId;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
InsertOneResult = __decorate([
|
|
66
|
+
decorators_1.shellApiClassDefault
|
|
67
|
+
], InsertOneResult);
|
|
68
|
+
exports.InsertOneResult = InsertOneResult;
|
|
69
|
+
let UpdateResult = class UpdateResult extends decorators_1.ShellApiValueClass {
|
|
70
|
+
constructor(acknowledged, matchedCount, modifiedCount, upsertedCount, insertedId) {
|
|
71
|
+
super();
|
|
72
|
+
this.acknowledged = acknowledged;
|
|
73
|
+
this.insertedId = insertedId;
|
|
74
|
+
this.matchedCount = matchedCount;
|
|
75
|
+
this.modifiedCount = modifiedCount;
|
|
76
|
+
this.upsertedCount = upsertedCount;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
UpdateResult = __decorate([
|
|
80
|
+
decorators_1.shellApiClassDefault
|
|
81
|
+
], UpdateResult);
|
|
82
|
+
exports.UpdateResult = UpdateResult;
|
|
83
|
+
let DeleteResult = class DeleteResult extends decorators_1.ShellApiValueClass {
|
|
84
|
+
constructor(acknowledged, deletedCount) {
|
|
85
|
+
super();
|
|
86
|
+
this.acknowledged = acknowledged;
|
|
87
|
+
this.deletedCount = deletedCount;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
DeleteResult = __decorate([
|
|
91
|
+
decorators_1.shellApiClassDefault
|
|
92
|
+
], DeleteResult);
|
|
93
|
+
exports.DeleteResult = DeleteResult;
|
|
94
|
+
let CursorIterationResult = class CursorIterationResult extends decorators_1.ShellApiValueClass {
|
|
95
|
+
constructor() {
|
|
96
|
+
super();
|
|
97
|
+
this.cursorHasMore = true;
|
|
98
|
+
this.documents = [];
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
CursorIterationResult = __decorate([
|
|
102
|
+
decorators_1.shellApiClassDefault
|
|
103
|
+
], CursorIterationResult);
|
|
104
|
+
exports.CursorIterationResult = CursorIterationResult;
|
|
105
105
|
//# sourceMappingURL=result.js.map
|
package/lib/session.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { ShellApiWithMongoClass } from './decorators';
|
|
2
|
-
import { Document, ClientSessionOptions, ClientSession, TransactionOptions, ClusterTime, TimestampType, ServerSessionId } from '@qp-mongosh/service-provider-core';
|
|
3
|
-
import { asPrintable } from './enums';
|
|
4
|
-
import Mongo from './mongo';
|
|
5
|
-
import Database from './database';
|
|
6
|
-
export default class Session extends ShellApiWithMongoClass {
|
|
7
|
-
id: ServerSessionId | undefined;
|
|
8
|
-
_session: ClientSession;
|
|
9
|
-
_options: ClientSessionOptions;
|
|
10
|
-
_mongo: Mongo;
|
|
11
|
-
private _databases;
|
|
12
|
-
constructor(mongo: Mongo, options: ClientSessionOptions, session: ClientSession);
|
|
13
|
-
[asPrintable](): ServerSessionId | undefined;
|
|
14
|
-
getDatabase(name: string): Database;
|
|
15
|
-
advanceOperationTime(ts: TimestampType): void;
|
|
16
|
-
endSession(): Promise<void>;
|
|
17
|
-
hasEnded(): boolean | undefined;
|
|
18
|
-
getClusterTime(): ClusterTime | undefined;
|
|
19
|
-
getOperationTime(): TimestampType | undefined;
|
|
20
|
-
getOptions(): ClientSessionOptions;
|
|
21
|
-
startTransaction(options?: TransactionOptions): void;
|
|
22
|
-
commitTransaction(): Promise<Document>;
|
|
23
|
-
abortTransaction(): Promise<Document>;
|
|
24
|
-
withTransaction<T extends (...args: any) => any>(fn: T, options?: TransactionOptions): Promise<ReturnType<T>>;
|
|
25
|
-
}
|
|
1
|
+
import { ShellApiWithMongoClass } from './decorators';
|
|
2
|
+
import { Document, ClientSessionOptions, ClientSession, TransactionOptions, ClusterTime, TimestampType, ServerSessionId } from '@qp-mongosh/service-provider-core';
|
|
3
|
+
import { asPrintable } from './enums';
|
|
4
|
+
import Mongo from './mongo';
|
|
5
|
+
import Database from './database';
|
|
6
|
+
export default class Session extends ShellApiWithMongoClass {
|
|
7
|
+
id: ServerSessionId | undefined;
|
|
8
|
+
_session: ClientSession;
|
|
9
|
+
_options: ClientSessionOptions;
|
|
10
|
+
_mongo: Mongo;
|
|
11
|
+
private _databases;
|
|
12
|
+
constructor(mongo: Mongo, options: ClientSessionOptions, session: ClientSession);
|
|
13
|
+
[asPrintable](): ServerSessionId | undefined;
|
|
14
|
+
getDatabase(name: string): Database;
|
|
15
|
+
advanceOperationTime(ts: TimestampType): void;
|
|
16
|
+
endSession(): Promise<void>;
|
|
17
|
+
hasEnded(): boolean | undefined;
|
|
18
|
+
getClusterTime(): ClusterTime | undefined;
|
|
19
|
+
getOperationTime(): TimestampType | undefined;
|
|
20
|
+
getOptions(): ClientSessionOptions;
|
|
21
|
+
startTransaction(options?: TransactionOptions): void;
|
|
22
|
+
commitTransaction(): Promise<Document>;
|
|
23
|
+
abortTransaction(): Promise<Document>;
|
|
24
|
+
withTransaction<T extends (...args: any) => any>(fn: T, options?: TransactionOptions): Promise<ReturnType<T>>;
|
|
25
|
+
}
|
package/lib/session.js
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
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 service_provider_core_1 = require("@qp-mongosh/service-provider-core");
|
|
14
|
-
const enums_1 = require("./enums");
|
|
15
|
-
const database_1 = __importDefault(require("./database"));
|
|
16
|
-
const errors_1 = require("@qp-mongosh/errors");
|
|
17
|
-
const helpers_1 = require("./helpers");
|
|
18
|
-
let Session = class Session extends decorators_1.ShellApiWithMongoClass {
|
|
19
|
-
constructor(mongo, options, session) {
|
|
20
|
-
super();
|
|
21
|
-
this._session = session;
|
|
22
|
-
this._options = options;
|
|
23
|
-
this._mongo = mongo;
|
|
24
|
-
this._databases = {};
|
|
25
|
-
this.id = session.id;
|
|
26
|
-
}
|
|
27
|
-
[enums_1.asPrintable]() {
|
|
28
|
-
return this._session.id;
|
|
29
|
-
}
|
|
30
|
-
getDatabase(name) {
|
|
31
|
-
(0, helpers_1.assertArgsDefinedType)([name], ['string'], 'Session.getDatabase');
|
|
32
|
-
if (!(0, helpers_1.isValidDatabaseName)(name)) {
|
|
33
|
-
throw new errors_1.MongoshInvalidInputError(`Invalid database name: ${name}`, errors_1.CommonErrors.InvalidArgument);
|
|
34
|
-
}
|
|
35
|
-
if (!(name in this._databases)) {
|
|
36
|
-
this._databases[name] = new database_1.default(this._mongo, name, this);
|
|
37
|
-
}
|
|
38
|
-
return this._databases[name];
|
|
39
|
-
}
|
|
40
|
-
advanceOperationTime(ts) {
|
|
41
|
-
this._session.advanceOperationTime(ts);
|
|
42
|
-
}
|
|
43
|
-
async endSession() {
|
|
44
|
-
return await this._session.endSession();
|
|
45
|
-
}
|
|
46
|
-
hasEnded() {
|
|
47
|
-
return this._session.hasEnded;
|
|
48
|
-
}
|
|
49
|
-
getClusterTime() {
|
|
50
|
-
return this._session.clusterTime;
|
|
51
|
-
}
|
|
52
|
-
getOperationTime() {
|
|
53
|
-
return this._session.operationTime;
|
|
54
|
-
}
|
|
55
|
-
getOptions() {
|
|
56
|
-
return this._options;
|
|
57
|
-
}
|
|
58
|
-
startTransaction(options = {}) {
|
|
59
|
-
return this._session.startTransaction(options);
|
|
60
|
-
}
|
|
61
|
-
async commitTransaction() {
|
|
62
|
-
return await this._session.commitTransaction();
|
|
63
|
-
}
|
|
64
|
-
async abortTransaction() {
|
|
65
|
-
return await this._session.abortTransaction();
|
|
66
|
-
}
|
|
67
|
-
async withTransaction(fn, options = {}) {
|
|
68
|
-
(0, helpers_1.assertArgsDefinedType)([fn, options], ['function', [undefined, 'object']]);
|
|
69
|
-
return await this._session.withTransaction(async () => await fn(), options);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
__decorate([
|
|
73
|
-
decorators_1.returnsPromise
|
|
74
|
-
], Session.prototype, "endSession", null);
|
|
75
|
-
__decorate([
|
|
76
|
-
decorators_1.returnsPromise
|
|
77
|
-
], Session.prototype, "commitTransaction", null);
|
|
78
|
-
__decorate([
|
|
79
|
-
decorators_1.returnsPromise
|
|
80
|
-
], Session.prototype, "abortTransaction", null);
|
|
81
|
-
__decorate([
|
|
82
|
-
decorators_1.returnsPromise
|
|
83
|
-
], Session.prototype, "withTransaction", null);
|
|
84
|
-
Session = __decorate([
|
|
85
|
-
decorators_1.shellApiClassDefault,
|
|
86
|
-
(0, decorators_1.classPlatforms)([service_provider_core_1.ReplPlatform.CLI])
|
|
87
|
-
], Session);
|
|
88
|
-
exports.default = Session;
|
|
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 service_provider_core_1 = require("@qp-mongosh/service-provider-core");
|
|
14
|
+
const enums_1 = require("./enums");
|
|
15
|
+
const database_1 = __importDefault(require("./database"));
|
|
16
|
+
const errors_1 = require("@qp-mongosh/errors");
|
|
17
|
+
const helpers_1 = require("./helpers");
|
|
18
|
+
let Session = class Session extends decorators_1.ShellApiWithMongoClass {
|
|
19
|
+
constructor(mongo, options, session) {
|
|
20
|
+
super();
|
|
21
|
+
this._session = session;
|
|
22
|
+
this._options = options;
|
|
23
|
+
this._mongo = mongo;
|
|
24
|
+
this._databases = {};
|
|
25
|
+
this.id = session.id;
|
|
26
|
+
}
|
|
27
|
+
[enums_1.asPrintable]() {
|
|
28
|
+
return this._session.id;
|
|
29
|
+
}
|
|
30
|
+
getDatabase(name) {
|
|
31
|
+
(0, helpers_1.assertArgsDefinedType)([name], ['string'], 'Session.getDatabase');
|
|
32
|
+
if (!(0, helpers_1.isValidDatabaseName)(name)) {
|
|
33
|
+
throw new errors_1.MongoshInvalidInputError(`Invalid database name: ${name}`, errors_1.CommonErrors.InvalidArgument);
|
|
34
|
+
}
|
|
35
|
+
if (!(name in this._databases)) {
|
|
36
|
+
this._databases[name] = new database_1.default(this._mongo, name, this);
|
|
37
|
+
}
|
|
38
|
+
return this._databases[name];
|
|
39
|
+
}
|
|
40
|
+
advanceOperationTime(ts) {
|
|
41
|
+
this._session.advanceOperationTime(ts);
|
|
42
|
+
}
|
|
43
|
+
async endSession() {
|
|
44
|
+
return await this._session.endSession();
|
|
45
|
+
}
|
|
46
|
+
hasEnded() {
|
|
47
|
+
return this._session.hasEnded;
|
|
48
|
+
}
|
|
49
|
+
getClusterTime() {
|
|
50
|
+
return this._session.clusterTime;
|
|
51
|
+
}
|
|
52
|
+
getOperationTime() {
|
|
53
|
+
return this._session.operationTime;
|
|
54
|
+
}
|
|
55
|
+
getOptions() {
|
|
56
|
+
return this._options;
|
|
57
|
+
}
|
|
58
|
+
startTransaction(options = {}) {
|
|
59
|
+
return this._session.startTransaction(options);
|
|
60
|
+
}
|
|
61
|
+
async commitTransaction() {
|
|
62
|
+
return await this._session.commitTransaction();
|
|
63
|
+
}
|
|
64
|
+
async abortTransaction() {
|
|
65
|
+
return await this._session.abortTransaction();
|
|
66
|
+
}
|
|
67
|
+
async withTransaction(fn, options = {}) {
|
|
68
|
+
(0, helpers_1.assertArgsDefinedType)([fn, options], ['function', [undefined, 'object']]);
|
|
69
|
+
return await this._session.withTransaction(async () => await fn(), options);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
__decorate([
|
|
73
|
+
decorators_1.returnsPromise
|
|
74
|
+
], Session.prototype, "endSession", null);
|
|
75
|
+
__decorate([
|
|
76
|
+
decorators_1.returnsPromise
|
|
77
|
+
], Session.prototype, "commitTransaction", null);
|
|
78
|
+
__decorate([
|
|
79
|
+
decorators_1.returnsPromise
|
|
80
|
+
], Session.prototype, "abortTransaction", null);
|
|
81
|
+
__decorate([
|
|
82
|
+
decorators_1.returnsPromise
|
|
83
|
+
], Session.prototype, "withTransaction", null);
|
|
84
|
+
Session = __decorate([
|
|
85
|
+
decorators_1.shellApiClassDefault,
|
|
86
|
+
(0, decorators_1.classPlatforms)([service_provider_core_1.ReplPlatform.CLI])
|
|
87
|
+
], Session);
|
|
88
|
+
exports.default = Session;
|
|
89
89
|
//# sourceMappingURL=session.js.map
|
package/lib/shard.d.ts
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import Database from './database';
|
|
2
|
-
import { ShellApiWithMongoClass } from './decorators';
|
|
3
|
-
import type { Document } from '@qp-mongosh/service-provider-core';
|
|
4
|
-
import { asPrintable } from './enums';
|
|
5
|
-
import { CommandResult, UpdateResult } from './result';
|
|
6
|
-
import Mongo from './mongo';
|
|
7
|
-
export default class Shard extends ShellApiWithMongoClass {
|
|
8
|
-
_database: Database;
|
|
9
|
-
constructor(database: Database);
|
|
10
|
-
get _mongo(): Mongo;
|
|
11
|
-
[asPrintable](): string;
|
|
12
|
-
private _emitShardApiCall;
|
|
13
|
-
enableSharding(database: string, primaryShard?: string): Promise<Document>;
|
|
14
|
-
commitReshardCollection(namespace: string): Promise<Document>;
|
|
15
|
-
abortReshardCollection(namespace: string): Promise<Document>;
|
|
16
|
-
shardCollection(namespace: string, key: Document, unique?: boolean | Document, options?: Document): Promise<Document>;
|
|
17
|
-
reshardCollection(namespace: string, key: Document, unique?: boolean | Document, options?: Document): Promise<Document>;
|
|
18
|
-
_runShardCollection(command: 'shardCollection' | 'reshardCollection', namespace: string, key: Document, unique?: boolean | Document, options?: Document): Promise<Document>;
|
|
19
|
-
status(verbose?: boolean, configDB?: Database): Promise<CommandResult<Document>>;
|
|
20
|
-
addShard(url: string): Promise<Document>;
|
|
21
|
-
addShardToZone(shard: string, zone: string): Promise<Document>;
|
|
22
|
-
addShardTag(shard: string, tag: string): Promise<Document>;
|
|
23
|
-
updateZoneKeyRange(namespace: string, min: Document, max: Document, zone: string | null): Promise<Document>;
|
|
24
|
-
addTagRange(namespace: string, min: Document, max: Document, zone: string): Promise<Document>;
|
|
25
|
-
removeRangeFromZone(ns: string, min: Document, max: Document): Promise<Document>;
|
|
26
|
-
removeTagRange(ns: string, min: Document, max: Document): Promise<Document>;
|
|
27
|
-
removeShardFromZone(shard: string, zone: string): Promise<Document>;
|
|
28
|
-
removeShardTag(shard: string, tag: string): Promise<Document>;
|
|
29
|
-
enableAutoSplit(): Promise<UpdateResult>;
|
|
30
|
-
disableAutoSplit(): Promise<UpdateResult>;
|
|
31
|
-
splitAt(ns: string, query: Document): Promise<Document>;
|
|
32
|
-
splitFind(ns: string, query: Document): Promise<Document>;
|
|
33
|
-
moveChunk(ns: string, query: Document, destination: string | undefined): Promise<Document>;
|
|
34
|
-
balancerCollectionStatus(ns: string): Promise<Document>;
|
|
35
|
-
enableBalancing(ns: string): Promise<UpdateResult>;
|
|
36
|
-
disableBalancing(ns: string): Promise<UpdateResult>;
|
|
37
|
-
getBalancerState(): Promise<boolean>;
|
|
38
|
-
isBalancerRunning(): Promise<Document>;
|
|
39
|
-
startBalancer(timeout?: number): Promise<Document>;
|
|
40
|
-
stopBalancer(timeout?: number): Promise<Document>;
|
|
41
|
-
setBalancerState(state: boolean): Promise<Document>;
|
|
42
|
-
}
|
|
1
|
+
import Database from './database';
|
|
2
|
+
import { ShellApiWithMongoClass } from './decorators';
|
|
3
|
+
import type { Document } from '@qp-mongosh/service-provider-core';
|
|
4
|
+
import { asPrintable } from './enums';
|
|
5
|
+
import { CommandResult, UpdateResult } from './result';
|
|
6
|
+
import Mongo from './mongo';
|
|
7
|
+
export default class Shard extends ShellApiWithMongoClass {
|
|
8
|
+
_database: Database;
|
|
9
|
+
constructor(database: Database);
|
|
10
|
+
get _mongo(): Mongo;
|
|
11
|
+
[asPrintable](): string;
|
|
12
|
+
private _emitShardApiCall;
|
|
13
|
+
enableSharding(database: string, primaryShard?: string): Promise<Document>;
|
|
14
|
+
commitReshardCollection(namespace: string): Promise<Document>;
|
|
15
|
+
abortReshardCollection(namespace: string): Promise<Document>;
|
|
16
|
+
shardCollection(namespace: string, key: Document, unique?: boolean | Document, options?: Document): Promise<Document>;
|
|
17
|
+
reshardCollection(namespace: string, key: Document, unique?: boolean | Document, options?: Document): Promise<Document>;
|
|
18
|
+
_runShardCollection(command: 'shardCollection' | 'reshardCollection', namespace: string, key: Document, unique?: boolean | Document, options?: Document): Promise<Document>;
|
|
19
|
+
status(verbose?: boolean, configDB?: Database): Promise<CommandResult<Document>>;
|
|
20
|
+
addShard(url: string): Promise<Document>;
|
|
21
|
+
addShardToZone(shard: string, zone: string): Promise<Document>;
|
|
22
|
+
addShardTag(shard: string, tag: string): Promise<Document>;
|
|
23
|
+
updateZoneKeyRange(namespace: string, min: Document, max: Document, zone: string | null): Promise<Document>;
|
|
24
|
+
addTagRange(namespace: string, min: Document, max: Document, zone: string): Promise<Document>;
|
|
25
|
+
removeRangeFromZone(ns: string, min: Document, max: Document): Promise<Document>;
|
|
26
|
+
removeTagRange(ns: string, min: Document, max: Document): Promise<Document>;
|
|
27
|
+
removeShardFromZone(shard: string, zone: string): Promise<Document>;
|
|
28
|
+
removeShardTag(shard: string, tag: string): Promise<Document>;
|
|
29
|
+
enableAutoSplit(): Promise<UpdateResult>;
|
|
30
|
+
disableAutoSplit(): Promise<UpdateResult>;
|
|
31
|
+
splitAt(ns: string, query: Document): Promise<Document>;
|
|
32
|
+
splitFind(ns: string, query: Document): Promise<Document>;
|
|
33
|
+
moveChunk(ns: string, query: Document, destination: string | undefined): Promise<Document>;
|
|
34
|
+
balancerCollectionStatus(ns: string): Promise<Document>;
|
|
35
|
+
enableBalancing(ns: string): Promise<UpdateResult>;
|
|
36
|
+
disableBalancing(ns: string): Promise<UpdateResult>;
|
|
37
|
+
getBalancerState(): Promise<boolean>;
|
|
38
|
+
isBalancerRunning(): Promise<Document>;
|
|
39
|
+
startBalancer(timeout?: number): Promise<Document>;
|
|
40
|
+
stopBalancer(timeout?: number): Promise<Document>;
|
|
41
|
+
setBalancerState(state: boolean): Promise<Document>;
|
|
42
|
+
}
|