@mongosh/types 1.0.5 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORS +1 -0
- package/lib/index.d.ts +43 -6
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +62 -14
package/AUTHORS
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -4,15 +4,24 @@ export interface ApiEventArguments {
|
|
|
4
4
|
options?: object;
|
|
5
5
|
filter?: object;
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
8
|
-
method
|
|
7
|
+
export interface ApiEventWithArguments {
|
|
8
|
+
method: string;
|
|
9
9
|
class?: string;
|
|
10
10
|
db?: string;
|
|
11
11
|
coll?: string;
|
|
12
12
|
uri?: string;
|
|
13
13
|
arguments?: ApiEventArguments;
|
|
14
14
|
}
|
|
15
|
-
export interface
|
|
15
|
+
export interface ApiEvent {
|
|
16
|
+
method: string;
|
|
17
|
+
class: string;
|
|
18
|
+
deprecated: boolean;
|
|
19
|
+
isAsync: boolean;
|
|
20
|
+
callDepth: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ApiWarning {
|
|
23
|
+
method: string;
|
|
24
|
+
class: string;
|
|
16
25
|
message: string;
|
|
17
26
|
}
|
|
18
27
|
export interface UseEvent {
|
|
@@ -58,6 +67,7 @@ export interface MongocryptdErrorEvent {
|
|
|
58
67
|
cause: string;
|
|
59
68
|
error?: Error;
|
|
60
69
|
stderr?: string;
|
|
70
|
+
pid?: number;
|
|
61
71
|
}
|
|
62
72
|
export interface MongocryptdLogEvent {
|
|
63
73
|
pid: number;
|
|
@@ -108,6 +118,15 @@ export interface SnippetsTransformErrorEvent {
|
|
|
108
118
|
addition: string;
|
|
109
119
|
name: string;
|
|
110
120
|
}
|
|
121
|
+
export interface SpConnectAttemptInitializedEvent {
|
|
122
|
+
uri: string;
|
|
123
|
+
driver: {
|
|
124
|
+
name: string;
|
|
125
|
+
version: string;
|
|
126
|
+
};
|
|
127
|
+
serviceProviderVersion: string;
|
|
128
|
+
host: string;
|
|
129
|
+
}
|
|
111
130
|
export interface SpConnectHeartbeatFailureEvent {
|
|
112
131
|
connectionId: string;
|
|
113
132
|
failure: Error;
|
|
@@ -130,20 +149,33 @@ export interface SpMissingOptionalDependencyEvent {
|
|
|
130
149
|
name: string;
|
|
131
150
|
error: Error;
|
|
132
151
|
}
|
|
152
|
+
export interface EditorRunEditCommandEvent {
|
|
153
|
+
tmpDoc: string;
|
|
154
|
+
editor: string;
|
|
155
|
+
code: string;
|
|
156
|
+
}
|
|
157
|
+
export interface EditorReadVscodeExtensionsDoneEvent {
|
|
158
|
+
vscodeDir: string;
|
|
159
|
+
hasMongodbExtension: boolean;
|
|
160
|
+
}
|
|
161
|
+
export interface EditorReadVscodeExtensionsFailedEvent {
|
|
162
|
+
vscodeDir: string;
|
|
163
|
+
error: Error;
|
|
164
|
+
}
|
|
133
165
|
export interface MongoshBusEventsMap {
|
|
134
166
|
'mongosh:connect': (ev: ConnectEvent) => void;
|
|
135
|
-
'mongosh:driver-initialized': (driverMetadata: any) => void;
|
|
136
167
|
'mongosh:new-user': (id: string, enableTelemetry: boolean) => void;
|
|
137
168
|
'mongosh:update-user': (id: string, enableTelemetry: boolean) => void;
|
|
138
169
|
'mongosh:error': (error: Error, component: string) => void;
|
|
139
170
|
'mongosh:evaluate-input': (ev: EvaluateInputEvent) => void;
|
|
171
|
+
'mongosh:evaluate-started': () => void;
|
|
140
172
|
'mongosh:evaluate-finished': () => void;
|
|
141
173
|
'mongosh:use': (ev: UseEvent) => void;
|
|
142
174
|
'mongosh:getDB': (ev: UseEvent) => void;
|
|
143
175
|
'mongosh:show': (ev: ShowEvent) => void;
|
|
144
|
-
'mongosh:setCtx': (ev:
|
|
176
|
+
'mongosh:setCtx': (ev: ApiEventWithArguments) => void;
|
|
177
|
+
'mongosh:api-call-with-arguments': (ev: ApiEventWithArguments) => void;
|
|
145
178
|
'mongosh:api-call': (ev: ApiEvent) => void;
|
|
146
|
-
'mongosh:deprecated-api-call': (ev: ApiEvent) => void;
|
|
147
179
|
'mongosh:warn': (ev: ApiWarning) => void;
|
|
148
180
|
'mongosh:api-load-file': (ev: ScriptLoadFileEvent) => void;
|
|
149
181
|
'mongosh:start-loading-cli-scripts': (event: StartLoadingCliScriptsEvent) => void;
|
|
@@ -173,6 +205,7 @@ export interface MongoshBusEventsMap {
|
|
|
173
205
|
'mongosh-snippets:load-snippet': (ev: SnippetsLoadSnippetEvent) => void;
|
|
174
206
|
'mongosh-snippets:snippet-command': (ev: SnippetsCommandEvent) => void;
|
|
175
207
|
'mongosh-snippets:transform-error': (ev: SnippetsTransformErrorEvent) => void;
|
|
208
|
+
'mongosh-sp:connect-attempt-initialized': (ev: SpConnectAttemptInitializedEvent) => void;
|
|
176
209
|
'mongosh-sp:connect-heartbeat-failure': (ev: SpConnectHeartbeatFailureEvent) => void;
|
|
177
210
|
'mongosh-sp:connect-heartbeat-succeeded': (ev: SpConnectHeartbeatSucceededEvent) => void;
|
|
178
211
|
'mongosh-sp:connect-fail-early': () => void;
|
|
@@ -181,6 +214,9 @@ export interface MongoshBusEventsMap {
|
|
|
181
214
|
'mongosh-sp:resolve-srv-succeeded': (ev: SpResolveSrvSucceededEvent) => void;
|
|
182
215
|
'mongosh-sp:reset-connection-options': () => void;
|
|
183
216
|
'mongosh-sp:missing-optional-dependency': (ev: SpMissingOptionalDependencyEvent) => void;
|
|
217
|
+
'mongosh-editor:run-edit-command': (ev: EditorRunEditCommandEvent) => void;
|
|
218
|
+
'mongosh-editor:read-vscode-extensions-done': (ev: EditorReadVscodeExtensionsDoneEvent) => void;
|
|
219
|
+
'mongosh-editor:read-vscode-extensions-failed': (ev: EditorReadVscodeExtensionsFailedEvent) => void;
|
|
184
220
|
}
|
|
185
221
|
export interface MongoshBus {
|
|
186
222
|
on<K extends keyof MongoshBusEventsMap>(event: K, listener: MongoshBusEventsMap[K]): this;
|
|
@@ -191,6 +227,7 @@ export declare class ShellUserConfig {
|
|
|
191
227
|
displayBatchSize: number;
|
|
192
228
|
maxTimeMS: number | null;
|
|
193
229
|
enableTelemetry: boolean;
|
|
230
|
+
editor: string | null;
|
|
194
231
|
}
|
|
195
232
|
export declare class ShellUserConfigValidator {
|
|
196
233
|
static validate<K extends keyof ShellUserConfig>(key: K, value: ShellUserConfig[K]): Promise<string | null>;
|
package/lib/index.js
CHANGED
|
@@ -6,6 +6,7 @@ class ShellUserConfig {
|
|
|
6
6
|
this.displayBatchSize = 20;
|
|
7
7
|
this.maxTimeMS = null;
|
|
8
8
|
this.enableTelemetry = false;
|
|
9
|
+
this.editor = null;
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
exports.ShellUserConfig = ShellUserConfig;
|
|
@@ -27,6 +28,11 @@ class ShellUserConfigValidator {
|
|
|
27
28
|
return `${key} must be a boolean`;
|
|
28
29
|
}
|
|
29
30
|
return null;
|
|
31
|
+
case 'editor':
|
|
32
|
+
if (typeof value !== 'string' && value !== null) {
|
|
33
|
+
return `${key} must be a string or null`;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
30
36
|
default:
|
|
31
37
|
return `${key} is not a known config option`;
|
|
32
38
|
}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAiYA,MAAa,eAAe;IAA5B;QACE,qBAAgB,GAAG,EAAE,CAAC;QACtB,cAAS,GAAkB,IAAI,CAAC;QAChC,oBAAe,GAAG,KAAK,CAAC;QACxB,WAAM,GAAkB,IAAI,CAAC;IAC/B,CAAC;CAAA;AALD,0CAKC;AAED,MAAa,wBAAwB;IAEnC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAkC,GAAM,EAAE,KAAyB;QACtF,QAAQ,GAAG,E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O,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,CAAC,EAAE;oBAC1C,OAAO,GAAG,GAAG,6BAA6B,CAAC;iBAC5C;gBACD,OAAO,IAAI,CAAC;YACd,KAAK,iBAAiB;gBACpB,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;oBAC9B,OAAO,GAAG,GAAG,oBAAoB,CAAC;iBACnC;gBACD,OAAO,IAAI,CAAC;YACd,KAAK,eAAe;gBAClB,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,eAAe,EAAE;oBACvE,OAAO,GAAG,GAAG,sDAAsD,CAAC;iBACrE;gBACD,OAAO,IAAI,CAAC;YACd;gBACE,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAmC,EAAE,KAAY,CAAC,CAAC;SAC5E;IACH,CAAC;CACF;AAhCD,wDAgCC;AASD,SAAS,UAAU,CAAC,GAAW;IAM7B,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;QAC7B,IAAI;YAEF,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YACb,OAAO,IAAI,CAAC;SACb;QAAC,WAAM;YACN,OAAO,KAAK,CAAC;SACd;KACF;IAGD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongosh/types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Types for mongosh internals",
|
|
5
5
|
"author": "Anna Henningsen <anna.henningsen@mongodb.com>",
|
|
6
6
|
"homepage": "https://github.com/mongodb-js/mongosh/tree/main/packages/types#readme",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"mongosh": {
|
|
32
32
|
"unitTestsOnly": true
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "ecf5653fa1520731a3e9172550278f68f0784923"
|
|
35
35
|
}
|
package/src/index.ts
CHANGED
|
@@ -6,8 +6,8 @@ export interface ApiEventArguments {
|
|
|
6
6
|
filter?: object;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export interface
|
|
10
|
-
method
|
|
9
|
+
export interface ApiEventWithArguments {
|
|
10
|
+
method: string;
|
|
11
11
|
class?: string;
|
|
12
12
|
db?: string;
|
|
13
13
|
coll?: string;
|
|
@@ -15,7 +15,17 @@ export interface ApiEvent {
|
|
|
15
15
|
arguments?: ApiEventArguments;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export interface
|
|
18
|
+
export interface ApiEvent {
|
|
19
|
+
method: string;
|
|
20
|
+
class: string;
|
|
21
|
+
deprecated: boolean;
|
|
22
|
+
isAsync: boolean;
|
|
23
|
+
callDepth: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ApiWarning {
|
|
27
|
+
method: string;
|
|
28
|
+
class: string;
|
|
19
29
|
message: string;
|
|
20
30
|
}
|
|
21
31
|
|
|
@@ -69,6 +79,7 @@ export interface MongocryptdErrorEvent {
|
|
|
69
79
|
cause: string;
|
|
70
80
|
error?: Error;
|
|
71
81
|
stderr?: string;
|
|
82
|
+
pid?: number;
|
|
72
83
|
}
|
|
73
84
|
|
|
74
85
|
export interface MongocryptdLogEvent {
|
|
@@ -133,6 +144,13 @@ export interface SnippetsTransformErrorEvent {
|
|
|
133
144
|
name: string;
|
|
134
145
|
}
|
|
135
146
|
|
|
147
|
+
export interface SpConnectAttemptInitializedEvent {
|
|
148
|
+
uri: string;
|
|
149
|
+
driver: { name: string, version: string };
|
|
150
|
+
serviceProviderVersion: string;
|
|
151
|
+
host: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
136
154
|
export interface SpConnectHeartbeatFailureEvent {
|
|
137
155
|
connectionId: string;
|
|
138
156
|
failure: Error;
|
|
@@ -160,17 +178,28 @@ export interface SpMissingOptionalDependencyEvent {
|
|
|
160
178
|
error: Error;
|
|
161
179
|
}
|
|
162
180
|
|
|
181
|
+
export interface EditorRunEditCommandEvent {
|
|
182
|
+
tmpDoc: string;
|
|
183
|
+
editor: string;
|
|
184
|
+
code: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface EditorReadVscodeExtensionsDoneEvent {
|
|
188
|
+
vscodeDir: string;
|
|
189
|
+
hasMongodbExtension: boolean;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface EditorReadVscodeExtensionsFailedEvent {
|
|
193
|
+
vscodeDir: string;
|
|
194
|
+
error: Error;
|
|
195
|
+
}
|
|
196
|
+
|
|
163
197
|
export interface MongoshBusEventsMap {
|
|
164
198
|
/**
|
|
165
199
|
* Signals a connection to a MongoDB instance has been established
|
|
166
200
|
* or the used database changed.
|
|
167
201
|
*/
|
|
168
202
|
'mongosh:connect': (ev: ConnectEvent) => void;
|
|
169
|
-
/**
|
|
170
|
-
* Signals the creation of a new Mongo client with metadata provided
|
|
171
|
-
* by the underlying driver implementation.
|
|
172
|
-
*/
|
|
173
|
-
'mongosh:driver-initialized': (driverMetadata: any) => void;
|
|
174
203
|
/**
|
|
175
204
|
* Signals that the shell is started by a new user.
|
|
176
205
|
*/
|
|
@@ -187,6 +216,10 @@ export interface MongoshBusEventsMap {
|
|
|
187
216
|
* Signals the start of the evaluation of user code inside Shellevaluator.
|
|
188
217
|
*/
|
|
189
218
|
'mongosh:evaluate-input': (ev: EvaluateInputEvent) => void;
|
|
219
|
+
/**
|
|
220
|
+
* Signals the initiation of the evaluation of user code in AsyncRepl (final step of the evaluation).
|
|
221
|
+
*/
|
|
222
|
+
'mongosh:evaluate-started': () => void;
|
|
190
223
|
/**
|
|
191
224
|
* Signals the completion of the evaluation of user code in AsyncRepl (final step of the evaluation)
|
|
192
225
|
* regardless of success, error, or being interrupted.
|
|
@@ -207,15 +240,15 @@ export interface MongoshBusEventsMap {
|
|
|
207
240
|
/**
|
|
208
241
|
* Signals the global context for the shell evaluation has been initialized.
|
|
209
242
|
*/
|
|
210
|
-
'mongosh:setCtx': (ev:
|
|
243
|
+
'mongosh:setCtx': (ev: ApiEventWithArguments) => void;
|
|
211
244
|
/**
|
|
212
|
-
* Signals usage of a shell API method.
|
|
245
|
+
* Signals usage of a shell API method. This includes arguments and is not suitable for telemetry.
|
|
213
246
|
*/
|
|
214
|
-
'mongosh:api-call': (ev:
|
|
247
|
+
'mongosh:api-call-with-arguments': (ev: ApiEventWithArguments) => void;
|
|
215
248
|
/**
|
|
216
|
-
* Signals usage of a
|
|
249
|
+
* Signals usage of a shell API method as an API entry point, suitable for telemetry.
|
|
217
250
|
*/
|
|
218
|
-
'mongosh:
|
|
251
|
+
'mongosh:api-call': (ev: ApiEvent) => void;
|
|
219
252
|
/**
|
|
220
253
|
* Signals an error for an operation that we can silently ignore but still warn about.
|
|
221
254
|
*/
|
|
@@ -316,6 +349,8 @@ export interface MongoshBusEventsMap {
|
|
|
316
349
|
/** Signals that a snippet has modified an error message. */
|
|
317
350
|
'mongosh-snippets:transform-error': (ev: SnippetsTransformErrorEvent) => void;
|
|
318
351
|
|
|
352
|
+
/** Signals that a connection attempt is about to be performed. */
|
|
353
|
+
'mongosh-sp:connect-attempt-initialized': (ev: SpConnectAttemptInitializedEvent) => void;
|
|
319
354
|
/** Signals that communicating to a specific server during connection did not succeed. */
|
|
320
355
|
'mongosh-sp:connect-heartbeat-failure': (ev: SpConnectHeartbeatFailureEvent) => void;
|
|
321
356
|
/** Signals that communicating to a specific server during connection succeeded. */
|
|
@@ -332,6 +367,13 @@ export interface MongoshBusEventsMap {
|
|
|
332
367
|
'mongosh-sp:reset-connection-options': () => void;
|
|
333
368
|
/** Signals that an optional dependency of the mongodb package is missing. */
|
|
334
369
|
'mongosh-sp:missing-optional-dependency': (ev: SpMissingOptionalDependencyEvent) => void;
|
|
370
|
+
|
|
371
|
+
/** Signals that open external editor command was called. */
|
|
372
|
+
'mongosh-editor:run-edit-command': (ev: EditorRunEditCommandEvent) => void;
|
|
373
|
+
/** Signals that reading vscode extensions from disc succeeded. */
|
|
374
|
+
'mongosh-editor:read-vscode-extensions-done': (ev: EditorReadVscodeExtensionsDoneEvent) => void;
|
|
375
|
+
/** Signals that reading vscode extensions from disc failed. */
|
|
376
|
+
'mongosh-editor:read-vscode-extensions-failed': (ev: EditorReadVscodeExtensionsFailedEvent) => void;
|
|
335
377
|
}
|
|
336
378
|
|
|
337
379
|
export interface MongoshBus {
|
|
@@ -345,10 +387,11 @@ export class ShellUserConfig {
|
|
|
345
387
|
displayBatchSize = 20;
|
|
346
388
|
maxTimeMS: number | null = null;
|
|
347
389
|
enableTelemetry = false;
|
|
390
|
+
editor: string | null = null;
|
|
348
391
|
}
|
|
349
392
|
|
|
350
393
|
export class ShellUserConfigValidator {
|
|
351
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
394
|
+
// eslint-disable-next-line complexity, @typescript-eslint/require-await
|
|
352
395
|
static async validate<K extends keyof ShellUserConfig>(key: K, value: ShellUserConfig[K]): Promise<string | null> {
|
|
353
396
|
switch (key) {
|
|
354
397
|
case 'displayBatchSize':
|
|
@@ -366,6 +409,11 @@ export class ShellUserConfigValidator {
|
|
|
366
409
|
return `${key} must be a boolean`;
|
|
367
410
|
}
|
|
368
411
|
return null;
|
|
412
|
+
case 'editor':
|
|
413
|
+
if (typeof value !== 'string' && value !== null) {
|
|
414
|
+
return `${key} must be a string or null`;
|
|
415
|
+
}
|
|
416
|
+
return null;
|
|
369
417
|
default:
|
|
370
418
|
return `${key} is not a known config option`;
|
|
371
419
|
}
|