@qp-mongosh/shell-api 0.0.0-dev.0 → 0.0.0-dev.3
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/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/package.json +47 -47
- package/tsconfig.lint.json +8 -8
package/lib/explainable.js
CHANGED
|
@@ -1,167 +1,167 @@
|
|
|
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 explainable_cursor_1 = __importDefault(require("./explainable-cursor"));
|
|
13
|
-
const decorators_1 = require("./decorators");
|
|
14
|
-
const enums_1 = require("./enums");
|
|
15
|
-
const helpers_1 = require("./helpers");
|
|
16
|
-
let Explainable = class Explainable extends decorators_1.ShellApiWithMongoClass {
|
|
17
|
-
constructor(mongo, collection, verbosity) {
|
|
18
|
-
super();
|
|
19
|
-
this._mongo = mongo;
|
|
20
|
-
this._collection = collection;
|
|
21
|
-
this._verbosity = verbosity;
|
|
22
|
-
}
|
|
23
|
-
[enums_1.asPrintable]() {
|
|
24
|
-
return `Explainable(${this._collection.getFullName()})`;
|
|
25
|
-
}
|
|
26
|
-
_emitExplainableApiCall(methodName, methodArguments = {}) {
|
|
27
|
-
this._mongo._instanceState.emitApiCallWithArgs({
|
|
28
|
-
method: methodName,
|
|
29
|
-
class: 'Explainable',
|
|
30
|
-
db: this._collection._database._name,
|
|
31
|
-
coll: this._collection._name,
|
|
32
|
-
arguments: methodArguments
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
getCollection() {
|
|
36
|
-
this._emitExplainableApiCall('getCollection');
|
|
37
|
-
return this._collection;
|
|
38
|
-
}
|
|
39
|
-
getVerbosity() {
|
|
40
|
-
this._emitExplainableApiCall('getVerbosity');
|
|
41
|
-
return this._verbosity;
|
|
42
|
-
}
|
|
43
|
-
setVerbosity(verbosity) {
|
|
44
|
-
verbosity = (0, helpers_1.validateExplainableVerbosity)(verbosity);
|
|
45
|
-
this._emitExplainableApiCall('setVerbosity', { verbosity });
|
|
46
|
-
this._verbosity = verbosity;
|
|
47
|
-
}
|
|
48
|
-
async find(query, projection) {
|
|
49
|
-
this._emitExplainableApiCall('find', { query, projection });
|
|
50
|
-
const cursor = await this._collection.find(query, projection);
|
|
51
|
-
return new explainable_cursor_1.default(this._mongo, cursor, this._verbosity);
|
|
52
|
-
}
|
|
53
|
-
async aggregate(...args) {
|
|
54
|
-
var _a;
|
|
55
|
-
this._emitExplainableApiCall('aggregate', { args });
|
|
56
|
-
let options;
|
|
57
|
-
let pipeline;
|
|
58
|
-
if (Array.isArray(args[0])) {
|
|
59
|
-
pipeline = args[0];
|
|
60
|
-
options = (_a = args[1]) !== null && _a !== void 0 ? _a : {};
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
pipeline = args;
|
|
64
|
-
options = {};
|
|
65
|
-
}
|
|
66
|
-
return await this._collection.aggregate(pipeline, {
|
|
67
|
-
...options,
|
|
68
|
-
explain: this._verbosity
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
async count(query = {}, options = {}) {
|
|
72
|
-
this._emitExplainableApiCall('count', { query, options });
|
|
73
|
-
return (0, helpers_1.markAsExplainOutput)(await this._collection._database._runCommand({
|
|
74
|
-
explain: {
|
|
75
|
-
count: `${this._collection._name}`,
|
|
76
|
-
query,
|
|
77
|
-
...options
|
|
78
|
-
},
|
|
79
|
-
verbosity: this._verbosity
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
async distinct(field, query, options = {}) {
|
|
83
|
-
this._emitExplainableApiCall('distinct', { field, query, options });
|
|
84
|
-
return this._collection.distinct(field, query !== null && query !== void 0 ? query : {}, { ...options, explain: this._verbosity });
|
|
85
|
-
}
|
|
86
|
-
async findAndModify(options) {
|
|
87
|
-
this._emitExplainableApiCall('findAndModify', { options });
|
|
88
|
-
return this._collection.findAndModify({ ...options, explain: this._verbosity });
|
|
89
|
-
}
|
|
90
|
-
async findOneAndDelete(filter, options = {}) {
|
|
91
|
-
this._emitExplainableApiCall('findOneAndDelete', { filter, options });
|
|
92
|
-
return this._collection.findOneAndDelete(filter, { ...options, explain: this._verbosity });
|
|
93
|
-
}
|
|
94
|
-
async findOneAndReplace(filter, replacement, options = {}) {
|
|
95
|
-
this._emitExplainableApiCall('findOneAndReplace', { filter, options });
|
|
96
|
-
return this._collection.findOneAndReplace(filter, replacement, { ...options, explain: this._verbosity });
|
|
97
|
-
}
|
|
98
|
-
async findOneAndUpdate(filter, update, options = {}) {
|
|
99
|
-
this._emitExplainableApiCall('findOneAndUpdate', { filter, options });
|
|
100
|
-
return this._collection.findOneAndUpdate(filter, update, { ...options, explain: this._verbosity });
|
|
101
|
-
}
|
|
102
|
-
async remove(query, options = {}) {
|
|
103
|
-
this._emitExplainableApiCall('remove', { query, options });
|
|
104
|
-
options = { ...(0, helpers_1.processRemoveOptions)(options), explain: this._verbosity };
|
|
105
|
-
return this._collection.remove(query, options);
|
|
106
|
-
}
|
|
107
|
-
async update(filter, update, options = {}) {
|
|
108
|
-
this._emitExplainableApiCall('update', { filter, update, options });
|
|
109
|
-
return this._collection.update(filter, update, { ...options, explain: this._verbosity });
|
|
110
|
-
}
|
|
111
|
-
async mapReduce(map, reduce, optionsOrOutString) {
|
|
112
|
-
this._emitExplainableApiCall('mapReduce', { map, reduce, optionsOrOutString });
|
|
113
|
-
const options = { ...(0, helpers_1.processMapReduceOptions)(optionsOrOutString), explain: this._verbosity };
|
|
114
|
-
return this._collection.mapReduce(map, reduce, options);
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
__decorate([
|
|
118
|
-
(0, decorators_1.returnType)('ExplainableCursor'),
|
|
119
|
-
(0, decorators_1.apiVersions)([1]),
|
|
120
|
-
decorators_1.returnsPromise
|
|
121
|
-
], Explainable.prototype, "find", null);
|
|
122
|
-
__decorate([
|
|
123
|
-
decorators_1.returnsPromise,
|
|
124
|
-
(0, decorators_1.apiVersions)([1])
|
|
125
|
-
], Explainable.prototype, "aggregate", null);
|
|
126
|
-
__decorate([
|
|
127
|
-
decorators_1.returnsPromise,
|
|
128
|
-
(0, decorators_1.apiVersions)([1])
|
|
129
|
-
], Explainable.prototype, "count", null);
|
|
130
|
-
__decorate([
|
|
131
|
-
decorators_1.returnsPromise,
|
|
132
|
-
(0, decorators_1.apiVersions)([1])
|
|
133
|
-
], Explainable.prototype, "distinct", null);
|
|
134
|
-
__decorate([
|
|
135
|
-
decorators_1.returnsPromise,
|
|
136
|
-
(0, decorators_1.apiVersions)([1])
|
|
137
|
-
], Explainable.prototype, "findAndModify", null);
|
|
138
|
-
__decorate([
|
|
139
|
-
decorators_1.returnsPromise,
|
|
140
|
-
(0, decorators_1.apiVersions)([1])
|
|
141
|
-
], Explainable.prototype, "findOneAndDelete", null);
|
|
142
|
-
__decorate([
|
|
143
|
-
decorators_1.returnsPromise,
|
|
144
|
-
(0, decorators_1.apiVersions)([1])
|
|
145
|
-
], Explainable.prototype, "findOneAndReplace", null);
|
|
146
|
-
__decorate([
|
|
147
|
-
decorators_1.returnsPromise,
|
|
148
|
-
(0, decorators_1.apiVersions)([1])
|
|
149
|
-
], Explainable.prototype, "findOneAndUpdate", null);
|
|
150
|
-
__decorate([
|
|
151
|
-
decorators_1.returnsPromise,
|
|
152
|
-
(0, decorators_1.apiVersions)([1])
|
|
153
|
-
], Explainable.prototype, "remove", null);
|
|
154
|
-
__decorate([
|
|
155
|
-
decorators_1.returnsPromise,
|
|
156
|
-
(0, decorators_1.apiVersions)([1])
|
|
157
|
-
], Explainable.prototype, "update", null);
|
|
158
|
-
__decorate([
|
|
159
|
-
decorators_1.returnsPromise,
|
|
160
|
-
(0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest]),
|
|
161
|
-
(0, decorators_1.apiVersions)([])
|
|
162
|
-
], Explainable.prototype, "mapReduce", null);
|
|
163
|
-
Explainable = __decorate([
|
|
164
|
-
decorators_1.shellApiClassDefault
|
|
165
|
-
], Explainable);
|
|
166
|
-
exports.default = Explainable;
|
|
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 explainable_cursor_1 = __importDefault(require("./explainable-cursor"));
|
|
13
|
+
const decorators_1 = require("./decorators");
|
|
14
|
+
const enums_1 = require("./enums");
|
|
15
|
+
const helpers_1 = require("./helpers");
|
|
16
|
+
let Explainable = class Explainable extends decorators_1.ShellApiWithMongoClass {
|
|
17
|
+
constructor(mongo, collection, verbosity) {
|
|
18
|
+
super();
|
|
19
|
+
this._mongo = mongo;
|
|
20
|
+
this._collection = collection;
|
|
21
|
+
this._verbosity = verbosity;
|
|
22
|
+
}
|
|
23
|
+
[enums_1.asPrintable]() {
|
|
24
|
+
return `Explainable(${this._collection.getFullName()})`;
|
|
25
|
+
}
|
|
26
|
+
_emitExplainableApiCall(methodName, methodArguments = {}) {
|
|
27
|
+
this._mongo._instanceState.emitApiCallWithArgs({
|
|
28
|
+
method: methodName,
|
|
29
|
+
class: 'Explainable',
|
|
30
|
+
db: this._collection._database._name,
|
|
31
|
+
coll: this._collection._name,
|
|
32
|
+
arguments: methodArguments
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
getCollection() {
|
|
36
|
+
this._emitExplainableApiCall('getCollection');
|
|
37
|
+
return this._collection;
|
|
38
|
+
}
|
|
39
|
+
getVerbosity() {
|
|
40
|
+
this._emitExplainableApiCall('getVerbosity');
|
|
41
|
+
return this._verbosity;
|
|
42
|
+
}
|
|
43
|
+
setVerbosity(verbosity) {
|
|
44
|
+
verbosity = (0, helpers_1.validateExplainableVerbosity)(verbosity);
|
|
45
|
+
this._emitExplainableApiCall('setVerbosity', { verbosity });
|
|
46
|
+
this._verbosity = verbosity;
|
|
47
|
+
}
|
|
48
|
+
async find(query, projection) {
|
|
49
|
+
this._emitExplainableApiCall('find', { query, projection });
|
|
50
|
+
const cursor = await this._collection.find(query, projection);
|
|
51
|
+
return new explainable_cursor_1.default(this._mongo, cursor, this._verbosity);
|
|
52
|
+
}
|
|
53
|
+
async aggregate(...args) {
|
|
54
|
+
var _a;
|
|
55
|
+
this._emitExplainableApiCall('aggregate', { args });
|
|
56
|
+
let options;
|
|
57
|
+
let pipeline;
|
|
58
|
+
if (Array.isArray(args[0])) {
|
|
59
|
+
pipeline = args[0];
|
|
60
|
+
options = (_a = args[1]) !== null && _a !== void 0 ? _a : {};
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
pipeline = args;
|
|
64
|
+
options = {};
|
|
65
|
+
}
|
|
66
|
+
return await this._collection.aggregate(pipeline, {
|
|
67
|
+
...options,
|
|
68
|
+
explain: this._verbosity
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async count(query = {}, options = {}) {
|
|
72
|
+
this._emitExplainableApiCall('count', { query, options });
|
|
73
|
+
return (0, helpers_1.markAsExplainOutput)(await this._collection._database._runCommand({
|
|
74
|
+
explain: {
|
|
75
|
+
count: `${this._collection._name}`,
|
|
76
|
+
query,
|
|
77
|
+
...options
|
|
78
|
+
},
|
|
79
|
+
verbosity: this._verbosity
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
async distinct(field, query, options = {}) {
|
|
83
|
+
this._emitExplainableApiCall('distinct', { field, query, options });
|
|
84
|
+
return this._collection.distinct(field, query !== null && query !== void 0 ? query : {}, { ...options, explain: this._verbosity });
|
|
85
|
+
}
|
|
86
|
+
async findAndModify(options) {
|
|
87
|
+
this._emitExplainableApiCall('findAndModify', { options });
|
|
88
|
+
return this._collection.findAndModify({ ...options, explain: this._verbosity });
|
|
89
|
+
}
|
|
90
|
+
async findOneAndDelete(filter, options = {}) {
|
|
91
|
+
this._emitExplainableApiCall('findOneAndDelete', { filter, options });
|
|
92
|
+
return this._collection.findOneAndDelete(filter, { ...options, explain: this._verbosity });
|
|
93
|
+
}
|
|
94
|
+
async findOneAndReplace(filter, replacement, options = {}) {
|
|
95
|
+
this._emitExplainableApiCall('findOneAndReplace', { filter, options });
|
|
96
|
+
return this._collection.findOneAndReplace(filter, replacement, { ...options, explain: this._verbosity });
|
|
97
|
+
}
|
|
98
|
+
async findOneAndUpdate(filter, update, options = {}) {
|
|
99
|
+
this._emitExplainableApiCall('findOneAndUpdate', { filter, options });
|
|
100
|
+
return this._collection.findOneAndUpdate(filter, update, { ...options, explain: this._verbosity });
|
|
101
|
+
}
|
|
102
|
+
async remove(query, options = {}) {
|
|
103
|
+
this._emitExplainableApiCall('remove', { query, options });
|
|
104
|
+
options = { ...(0, helpers_1.processRemoveOptions)(options), explain: this._verbosity };
|
|
105
|
+
return this._collection.remove(query, options);
|
|
106
|
+
}
|
|
107
|
+
async update(filter, update, options = {}) {
|
|
108
|
+
this._emitExplainableApiCall('update', { filter, update, options });
|
|
109
|
+
return this._collection.update(filter, update, { ...options, explain: this._verbosity });
|
|
110
|
+
}
|
|
111
|
+
async mapReduce(map, reduce, optionsOrOutString) {
|
|
112
|
+
this._emitExplainableApiCall('mapReduce', { map, reduce, optionsOrOutString });
|
|
113
|
+
const options = { ...(0, helpers_1.processMapReduceOptions)(optionsOrOutString), explain: this._verbosity };
|
|
114
|
+
return this._collection.mapReduce(map, reduce, options);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
__decorate([
|
|
118
|
+
(0, decorators_1.returnType)('ExplainableCursor'),
|
|
119
|
+
(0, decorators_1.apiVersions)([1]),
|
|
120
|
+
decorators_1.returnsPromise
|
|
121
|
+
], Explainable.prototype, "find", null);
|
|
122
|
+
__decorate([
|
|
123
|
+
decorators_1.returnsPromise,
|
|
124
|
+
(0, decorators_1.apiVersions)([1])
|
|
125
|
+
], Explainable.prototype, "aggregate", null);
|
|
126
|
+
__decorate([
|
|
127
|
+
decorators_1.returnsPromise,
|
|
128
|
+
(0, decorators_1.apiVersions)([1])
|
|
129
|
+
], Explainable.prototype, "count", null);
|
|
130
|
+
__decorate([
|
|
131
|
+
decorators_1.returnsPromise,
|
|
132
|
+
(0, decorators_1.apiVersions)([1])
|
|
133
|
+
], Explainable.prototype, "distinct", null);
|
|
134
|
+
__decorate([
|
|
135
|
+
decorators_1.returnsPromise,
|
|
136
|
+
(0, decorators_1.apiVersions)([1])
|
|
137
|
+
], Explainable.prototype, "findAndModify", null);
|
|
138
|
+
__decorate([
|
|
139
|
+
decorators_1.returnsPromise,
|
|
140
|
+
(0, decorators_1.apiVersions)([1])
|
|
141
|
+
], Explainable.prototype, "findOneAndDelete", null);
|
|
142
|
+
__decorate([
|
|
143
|
+
decorators_1.returnsPromise,
|
|
144
|
+
(0, decorators_1.apiVersions)([1])
|
|
145
|
+
], Explainable.prototype, "findOneAndReplace", null);
|
|
146
|
+
__decorate([
|
|
147
|
+
decorators_1.returnsPromise,
|
|
148
|
+
(0, decorators_1.apiVersions)([1])
|
|
149
|
+
], Explainable.prototype, "findOneAndUpdate", null);
|
|
150
|
+
__decorate([
|
|
151
|
+
decorators_1.returnsPromise,
|
|
152
|
+
(0, decorators_1.apiVersions)([1])
|
|
153
|
+
], Explainable.prototype, "remove", null);
|
|
154
|
+
__decorate([
|
|
155
|
+
decorators_1.returnsPromise,
|
|
156
|
+
(0, decorators_1.apiVersions)([1])
|
|
157
|
+
], Explainable.prototype, "update", null);
|
|
158
|
+
__decorate([
|
|
159
|
+
decorators_1.returnsPromise,
|
|
160
|
+
(0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest]),
|
|
161
|
+
(0, decorators_1.apiVersions)([])
|
|
162
|
+
], Explainable.prototype, "mapReduce", null);
|
|
163
|
+
Explainable = __decorate([
|
|
164
|
+
decorators_1.shellApiClassDefault
|
|
165
|
+
], Explainable);
|
|
166
|
+
exports.default = Explainable;
|
|
167
167
|
//# sourceMappingURL=explainable.js.map
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { ShellApiWithMongoClass } from './decorators';
|
|
3
|
-
import { ClientEncryption as MongoCryptClientEncryption, ClientEncryptionDataKeyProvider, ClientEncryptionEncryptOptions, ClientEncryptionTlsOptions, KMSProviders, AWSEncryptionKeyOptions, AzureEncryptionKeyOptions, GCPEncryptionKeyOptions } from '@qp-mongosh/service-provider-core';
|
|
4
|
-
import type { Document, BinaryType } from '@qp-mongosh/service-provider-core';
|
|
5
|
-
import Cursor from './cursor';
|
|
6
|
-
import { DeleteResult } from './result';
|
|
7
|
-
import { asPrintable } from './enums';
|
|
8
|
-
import type Mongo from './mongo';
|
|
9
|
-
import { Binary } from 'qp-mongodb';
|
|
10
|
-
export declare type ClientSideFieldLevelEncryptionKmsProvider = Omit<KMSProviders, 'local'> & {
|
|
11
|
-
local?: {
|
|
12
|
-
key: Buffer | string | BinaryType;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export interface ClientSideFieldLevelEncryptionOptions {
|
|
16
|
-
keyVaultClient?: Mongo;
|
|
17
|
-
keyVaultNamespace: string;
|
|
18
|
-
kmsProviders: ClientSideFieldLevelEncryptionKmsProvider;
|
|
19
|
-
schemaMap?: Document;
|
|
20
|
-
bypassAutoEncryption?: boolean;
|
|
21
|
-
explicitEncryptionOnly?: boolean;
|
|
22
|
-
tlsOptions?: {
|
|
23
|
-
[k in keyof ClientSideFieldLevelEncryptionKmsProvider]?: ClientEncryptionTlsOptions;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export declare class ClientEncryption extends ShellApiWithMongoClass {
|
|
27
|
-
_mongo: Mongo;
|
|
28
|
-
_libmongocrypt: MongoCryptClientEncryption;
|
|
29
|
-
constructor(mongo: Mongo);
|
|
30
|
-
[asPrintable](): string;
|
|
31
|
-
encrypt(encryptionId: Binary, value: any, encryptionAlgorithm: ClientEncryptionEncryptOptions['algorithm']): Promise<Binary>;
|
|
32
|
-
decrypt(encryptedValue: Binary): Promise<any>;
|
|
33
|
-
}
|
|
34
|
-
export declare class KeyVault extends ShellApiWithMongoClass {
|
|
35
|
-
_mongo: Mongo;
|
|
36
|
-
_clientEncryption: ClientEncryption;
|
|
37
|
-
private _keyColl;
|
|
38
|
-
constructor(clientEncryption: ClientEncryption);
|
|
39
|
-
[asPrintable](): string;
|
|
40
|
-
createKey(kms: 'local', keyAltNames?: string[]): Promise<Document>;
|
|
41
|
-
createKey(kms: ClientEncryptionDataKeyProvider, legacyMasterKey: string, keyAltNames?: string[]): Promise<Document>;
|
|
42
|
-
createKey(kms: ClientEncryptionDataKeyProvider, options: AWSEncryptionKeyOptions | AzureEncryptionKeyOptions | GCPEncryptionKeyOptions | undefined): Promise<Document>;
|
|
43
|
-
createKey(kms: ClientEncryptionDataKeyProvider, options: AWSEncryptionKeyOptions | AzureEncryptionKeyOptions | GCPEncryptionKeyOptions | undefined, keyAltNames: string[]): Promise<Document>;
|
|
44
|
-
getKey(keyId: BinaryType): Promise<Cursor>;
|
|
45
|
-
getKeyByAltName(keyAltName: string): Promise<Cursor>;
|
|
46
|
-
getKeys(): Promise<Cursor>;
|
|
47
|
-
deleteKey(keyId: BinaryType): Promise<DeleteResult | Document>;
|
|
48
|
-
addKeyAlternateName(keyId: BinaryType, keyAltName: string): Promise<Document>;
|
|
49
|
-
removeKeyAlternateName(keyId: BinaryType, keyAltName: string): Promise<Document>;
|
|
50
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ShellApiWithMongoClass } from './decorators';
|
|
3
|
+
import { ClientEncryption as MongoCryptClientEncryption, ClientEncryptionDataKeyProvider, ClientEncryptionEncryptOptions, ClientEncryptionTlsOptions, KMSProviders, AWSEncryptionKeyOptions, AzureEncryptionKeyOptions, GCPEncryptionKeyOptions } from '@qp-mongosh/service-provider-core';
|
|
4
|
+
import type { Document, BinaryType } from '@qp-mongosh/service-provider-core';
|
|
5
|
+
import Cursor from './cursor';
|
|
6
|
+
import { DeleteResult } from './result';
|
|
7
|
+
import { asPrintable } from './enums';
|
|
8
|
+
import type Mongo from './mongo';
|
|
9
|
+
import { Binary } from 'qp-mongodb';
|
|
10
|
+
export declare type ClientSideFieldLevelEncryptionKmsProvider = Omit<KMSProviders, 'local'> & {
|
|
11
|
+
local?: {
|
|
12
|
+
key: Buffer | string | BinaryType;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export interface ClientSideFieldLevelEncryptionOptions {
|
|
16
|
+
keyVaultClient?: Mongo;
|
|
17
|
+
keyVaultNamespace: string;
|
|
18
|
+
kmsProviders: ClientSideFieldLevelEncryptionKmsProvider;
|
|
19
|
+
schemaMap?: Document;
|
|
20
|
+
bypassAutoEncryption?: boolean;
|
|
21
|
+
explicitEncryptionOnly?: boolean;
|
|
22
|
+
tlsOptions?: {
|
|
23
|
+
[k in keyof ClientSideFieldLevelEncryptionKmsProvider]?: ClientEncryptionTlsOptions;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export declare class ClientEncryption extends ShellApiWithMongoClass {
|
|
27
|
+
_mongo: Mongo;
|
|
28
|
+
_libmongocrypt: MongoCryptClientEncryption;
|
|
29
|
+
constructor(mongo: Mongo);
|
|
30
|
+
[asPrintable](): string;
|
|
31
|
+
encrypt(encryptionId: Binary, value: any, encryptionAlgorithm: ClientEncryptionEncryptOptions['algorithm']): Promise<Binary>;
|
|
32
|
+
decrypt(encryptedValue: Binary): Promise<any>;
|
|
33
|
+
}
|
|
34
|
+
export declare class KeyVault extends ShellApiWithMongoClass {
|
|
35
|
+
_mongo: Mongo;
|
|
36
|
+
_clientEncryption: ClientEncryption;
|
|
37
|
+
private _keyColl;
|
|
38
|
+
constructor(clientEncryption: ClientEncryption);
|
|
39
|
+
[asPrintable](): string;
|
|
40
|
+
createKey(kms: 'local', keyAltNames?: string[]): Promise<Document>;
|
|
41
|
+
createKey(kms: ClientEncryptionDataKeyProvider, legacyMasterKey: string, keyAltNames?: string[]): Promise<Document>;
|
|
42
|
+
createKey(kms: ClientEncryptionDataKeyProvider, options: AWSEncryptionKeyOptions | AzureEncryptionKeyOptions | GCPEncryptionKeyOptions | undefined): Promise<Document>;
|
|
43
|
+
createKey(kms: ClientEncryptionDataKeyProvider, options: AWSEncryptionKeyOptions | AzureEncryptionKeyOptions | GCPEncryptionKeyOptions | undefined, keyAltNames: string[]): Promise<Document>;
|
|
44
|
+
getKey(keyId: BinaryType): Promise<Cursor>;
|
|
45
|
+
getKeyByAltName(keyAltName: string): Promise<Cursor>;
|
|
46
|
+
getKeys(): Promise<Cursor>;
|
|
47
|
+
deleteKey(keyId: BinaryType): Promise<DeleteResult | Document>;
|
|
48
|
+
addKeyAlternateName(keyId: BinaryType, keyAltName: string): Promise<Document>;
|
|
49
|
+
removeKeyAlternateName(keyId: BinaryType, keyAltName: string): Promise<Document>;
|
|
50
|
+
}
|