@mongosh/types 1.0.6 → 1.1.2

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 CHANGED
@@ -2,3 +2,4 @@ Anna Henningsen <anna@addaleax.net>
2
2
  Maurizio Casimirri <maurizio.cas@gmail.com>
3
3
  github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
4
4
  Michael Rose <michael_rose@gmx.de>
5
+ Alena Khineika <alena.khineika@gmail.com>
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 ApiEvent {
8
- method?: string;
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 ApiWarning extends ApiEvent {
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 {
@@ -109,6 +118,15 @@ export interface SnippetsTransformErrorEvent {
109
118
  addition: string;
110
119
  name: string;
111
120
  }
121
+ export interface SpConnectAttemptInitializedEvent {
122
+ uri: string;
123
+ driver: {
124
+ name: string;
125
+ version: string;
126
+ };
127
+ serviceProviderVersion: string;
128
+ host: string;
129
+ }
112
130
  export interface SpConnectHeartbeatFailureEvent {
113
131
  connectionId: string;
114
132
  failure: Error;
@@ -131,20 +149,33 @@ export interface SpMissingOptionalDependencyEvent {
131
149
  name: string;
132
150
  error: Error;
133
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
+ }
134
165
  export interface MongoshBusEventsMap {
135
166
  'mongosh:connect': (ev: ConnectEvent) => void;
136
- 'mongosh:driver-initialized': (driverMetadata: any) => void;
137
167
  'mongosh:new-user': (id: string, enableTelemetry: boolean) => void;
138
168
  'mongosh:update-user': (id: string, enableTelemetry: boolean) => void;
139
169
  'mongosh:error': (error: Error, component: string) => void;
140
170
  'mongosh:evaluate-input': (ev: EvaluateInputEvent) => void;
171
+ 'mongosh:evaluate-started': () => void;
141
172
  'mongosh:evaluate-finished': () => void;
142
173
  'mongosh:use': (ev: UseEvent) => void;
143
174
  'mongosh:getDB': (ev: UseEvent) => void;
144
175
  'mongosh:show': (ev: ShowEvent) => void;
145
- 'mongosh:setCtx': (ev: ApiEvent) => void;
176
+ 'mongosh:setCtx': (ev: ApiEventWithArguments) => void;
177
+ 'mongosh:api-call-with-arguments': (ev: ApiEventWithArguments) => void;
146
178
  'mongosh:api-call': (ev: ApiEvent) => void;
147
- 'mongosh:deprecated-api-call': (ev: ApiEvent) => void;
148
179
  'mongosh:warn': (ev: ApiWarning) => void;
149
180
  'mongosh:api-load-file': (ev: ScriptLoadFileEvent) => void;
150
181
  'mongosh:start-loading-cli-scripts': (event: StartLoadingCliScriptsEvent) => void;
@@ -174,6 +205,7 @@ export interface MongoshBusEventsMap {
174
205
  'mongosh-snippets:load-snippet': (ev: SnippetsLoadSnippetEvent) => void;
175
206
  'mongosh-snippets:snippet-command': (ev: SnippetsCommandEvent) => void;
176
207
  'mongosh-snippets:transform-error': (ev: SnippetsTransformErrorEvent) => void;
208
+ 'mongosh-sp:connect-attempt-initialized': (ev: SpConnectAttemptInitializedEvent) => void;
177
209
  'mongosh-sp:connect-heartbeat-failure': (ev: SpConnectHeartbeatFailureEvent) => void;
178
210
  'mongosh-sp:connect-heartbeat-succeeded': (ev: SpConnectHeartbeatSucceededEvent) => void;
179
211
  'mongosh-sp:connect-fail-early': () => void;
@@ -182,6 +214,9 @@ export interface MongoshBusEventsMap {
182
214
  'mongosh-sp:resolve-srv-succeeded': (ev: SpResolveSrvSucceededEvent) => void;
183
215
  'mongosh-sp:reset-connection-options': () => void;
184
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;
185
220
  }
186
221
  export interface MongoshBus {
187
222
  on<K extends keyof MongoshBusEventsMap>(event: K, listener: MongoshBusEventsMap[K]): this;
@@ -192,6 +227,7 @@ export declare class ShellUserConfig {
192
227
  displayBatchSize: number;
193
228
  maxTimeMS: number | null;
194
229
  enableTelemetry: boolean;
230
+ editor: string | null;
195
231
  }
196
232
  export declare class ShellUserConfigValidator {
197
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":";;;AAwVA,MAAa,eAAe;IAA5B;QACE,qBAAgB,GAAG,EAAE,C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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.0.6",
3
+ "version": "1.1.2",
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": "9eef48ae7aa36725d4776df7817b93713873fd1b"
34
+ "gitHead": "e4578cbedaac1dbc101e8ed61dce37f5b01d1a2c"
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 ApiEvent {
10
- method?: string;
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 ApiWarning extends ApiEvent {
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
 
@@ -134,6 +144,13 @@ export interface SnippetsTransformErrorEvent {
134
144
  name: string;
135
145
  }
136
146
 
147
+ export interface SpConnectAttemptInitializedEvent {
148
+ uri: string;
149
+ driver: { name: string, version: string };
150
+ serviceProviderVersion: string;
151
+ host: string;
152
+ }
153
+
137
154
  export interface SpConnectHeartbeatFailureEvent {
138
155
  connectionId: string;
139
156
  failure: Error;
@@ -161,17 +178,28 @@ export interface SpMissingOptionalDependencyEvent {
161
178
  error: Error;
162
179
  }
163
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
+
164
197
  export interface MongoshBusEventsMap {
165
198
  /**
166
199
  * Signals a connection to a MongoDB instance has been established
167
200
  * or the used database changed.
168
201
  */
169
202
  'mongosh:connect': (ev: ConnectEvent) => void;
170
- /**
171
- * Signals the creation of a new Mongo client with metadata provided
172
- * by the underlying driver implementation.
173
- */
174
- 'mongosh:driver-initialized': (driverMetadata: any) => void;
175
203
  /**
176
204
  * Signals that the shell is started by a new user.
177
205
  */
@@ -188,6 +216,10 @@ export interface MongoshBusEventsMap {
188
216
  * Signals the start of the evaluation of user code inside Shellevaluator.
189
217
  */
190
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;
191
223
  /**
192
224
  * Signals the completion of the evaluation of user code in AsyncRepl (final step of the evaluation)
193
225
  * regardless of success, error, or being interrupted.
@@ -208,15 +240,15 @@ export interface MongoshBusEventsMap {
208
240
  /**
209
241
  * Signals the global context for the shell evaluation has been initialized.
210
242
  */
211
- 'mongosh:setCtx': (ev: ApiEvent) => void;
243
+ 'mongosh:setCtx': (ev: ApiEventWithArguments) => void;
212
244
  /**
213
- * Signals usage of a shell API method.
245
+ * Signals usage of a shell API method. This includes arguments and is not suitable for telemetry.
214
246
  */
215
- 'mongosh:api-call': (ev: ApiEvent) => void;
247
+ 'mongosh:api-call-with-arguments': (ev: ApiEventWithArguments) => void;
216
248
  /**
217
- * Signals usage of a deprecated shell API method.
249
+ * Signals usage of a shell API method as an API entry point, suitable for telemetry.
218
250
  */
219
- 'mongosh:deprecated-api-call': (ev: ApiEvent) => void;
251
+ 'mongosh:api-call': (ev: ApiEvent) => void;
220
252
  /**
221
253
  * Signals an error for an operation that we can silently ignore but still warn about.
222
254
  */
@@ -317,6 +349,8 @@ export interface MongoshBusEventsMap {
317
349
  /** Signals that a snippet has modified an error message. */
318
350
  'mongosh-snippets:transform-error': (ev: SnippetsTransformErrorEvent) => void;
319
351
 
352
+ /** Signals that a connection attempt is about to be performed. */
353
+ 'mongosh-sp:connect-attempt-initialized': (ev: SpConnectAttemptInitializedEvent) => void;
320
354
  /** Signals that communicating to a specific server during connection did not succeed. */
321
355
  'mongosh-sp:connect-heartbeat-failure': (ev: SpConnectHeartbeatFailureEvent) => void;
322
356
  /** Signals that communicating to a specific server during connection succeeded. */
@@ -333,6 +367,13 @@ export interface MongoshBusEventsMap {
333
367
  'mongosh-sp:reset-connection-options': () => void;
334
368
  /** Signals that an optional dependency of the mongodb package is missing. */
335
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;
336
377
  }
337
378
 
338
379
  export interface MongoshBus {
@@ -346,10 +387,11 @@ export class ShellUserConfig {
346
387
  displayBatchSize = 20;
347
388
  maxTimeMS: number | null = null;
348
389
  enableTelemetry = false;
390
+ editor: string | null = null;
349
391
  }
350
392
 
351
393
  export class ShellUserConfigValidator {
352
- // eslint-disable-next-line @typescript-eslint/require-await
394
+ // eslint-disable-next-line complexity, @typescript-eslint/require-await
353
395
  static async validate<K extends keyof ShellUserConfig>(key: K, value: ShellUserConfig[K]): Promise<string | null> {
354
396
  switch (key) {
355
397
  case 'displayBatchSize':
@@ -367,6 +409,11 @@ export class ShellUserConfigValidator {
367
409
  return `${key} must be a boolean`;
368
410
  }
369
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;
370
417
  default:
371
418
  return `${key} is not a known config option`;
372
419
  }