@mongosh/cli-repl 1.10.1 → 1.10.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/.depcheckrc +15 -1
- package/.eslintrc.js +18 -1
- package/.prettierignore +6 -0
- package/.prettierrc.json +1 -0
- package/README.md +57 -22
- package/lib/arg-parser.d.ts +2 -2
- package/lib/arg-parser.js +10 -16
- package/lib/arg-parser.js.map +1 -1
- package/lib/async-repl.d.ts +7 -6
- package/lib/async-repl.js +20 -6
- package/lib/async-repl.js.map +1 -1
- package/lib/build-info.d.ts +7 -9
- package/lib/build-info.js +5 -17
- package/lib/build-info.js.map +1 -1
- package/lib/build-info.json +1 -1
- package/lib/cli-repl.d.ts +13 -9
- package/lib/cli-repl.js +85 -41
- package/lib/cli-repl.js.map +1 -1
- package/lib/clr.d.ts +2 -2
- package/lib/clr.js +2 -2
- package/lib/clr.js.map +1 -1
- package/lib/config-directory.d.ts +1 -1
- package/lib/config-directory.js +9 -3
- package/lib/config-directory.js.map +1 -1
- package/lib/constants.js +3 -1
- package/lib/constants.js.map +1 -1
- package/lib/crypt-library-paths.js +17 -11
- package/lib/crypt-library-paths.js.map +1 -1
- package/lib/error-codes.js +1 -2
- package/lib/error-codes.js.map +1 -1
- package/lib/format-json.js +2 -2
- package/lib/format-json.js.map +1 -1
- package/lib/format-output.d.ts +2 -2
- package/lib/format-output.js +41 -20
- package/lib/format-output.js.map +1 -1
- package/lib/get-os-info.js +3 -3
- package/lib/line-by-line-input.d.ts +2 -0
- package/lib/line-by-line-input.js +22 -13
- package/lib/line-by-line-input.js.map +1 -1
- package/lib/mongosh-repl.d.ts +16 -11
- package/lib/mongosh-repl.js +68 -56
- package/lib/mongosh-repl.js.map +1 -1
- package/lib/run.js +12 -10
- package/lib/run.js.map +1 -1
- package/lib/smoke-tests-fle.js.map +1 -1
- package/lib/smoke-tests.js +60 -36
- package/lib/smoke-tests.js.map +1 -1
- package/lib/tls-certificate-selector.js +6 -3
- package/lib/tls-certificate-selector.js.map +1 -1
- package/package.json +47 -32
- package/tsconfig-lint.json +5 -0
- package/webpack.config.js +9 -5
- package/tsconfig.lint.json +0 -8
package/.depcheckrc
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
ignores:
|
|
1
|
+
ignores:
|
|
2
|
+
- '@mongodb-js/eslint-config-mongosh'
|
|
3
|
+
- '@mongodb-js/tsconfig-mongosh'
|
|
4
|
+
- '@mongodb-js/prettier-config-devtools'
|
|
5
|
+
- '@typescript-eslint/parser'
|
|
6
|
+
- '@typescript-eslint/eslint-plugin'
|
|
7
|
+
- chai
|
|
8
|
+
- sinon-chai
|
|
9
|
+
- sinon
|
|
10
|
+
- ts-sinon
|
|
11
|
+
- mocha
|
|
12
|
+
- eslint-plugin-mocha
|
|
13
|
+
- eslint-config-mongodb-js
|
|
14
|
+
ignore-patterns:
|
|
15
|
+
- .eslintrc.js
|
package/.eslintrc.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
root: true,
|
|
5
|
+
extends: ['@mongodb-js/eslint-config-mongosh'],
|
|
6
|
+
parserOptions: {
|
|
7
|
+
tsconfigRootDir: fixCygwinPath(__dirname),
|
|
8
|
+
project: ['./tsconfig-lint.json'],
|
|
9
|
+
},
|
|
10
|
+
overrides: [
|
|
11
|
+
{
|
|
12
|
+
files: ['**/*.js', '**/*.ts'],
|
|
13
|
+
rules: {
|
|
14
|
+
'no-console': 0,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
package/.prettierignore
ADDED
package/.prettierrc.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"@mongodb-js/prettier-config-devtools"
|
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
CLI interface for [MongoDB Shell][mongosh], an extension to Node.js REPL with MongoDB API.
|
|
6
6
|
|
|
7
7
|
## Usage
|
|
8
|
+
|
|
8
9
|
```shell
|
|
9
10
|
$ mongosh [options] [db address] [file names (ending in .js or .mongodb)]
|
|
10
11
|
|
|
@@ -79,59 +80,80 @@ CLI interface for [MongoDB Shell][mongosh], an extension to Node.js REPL with Mo
|
|
|
79
80
|
```
|
|
80
81
|
|
|
81
82
|
### Log Format
|
|
82
|
-
|
|
83
|
+
|
|
84
|
+
CLI REPL listens to a few events via a message bus that are then logged to
|
|
83
85
|
user's local log file in `~/.mongodb/mongosh/` in ndjson format using
|
|
84
86
|
[pino][pino-js].
|
|
85
87
|
|
|
86
88
|
### bus.on('mongosh:connect', connectEvent)
|
|
89
|
+
|
|
87
90
|
Where `connectionInfo` is an object with the following interface:
|
|
91
|
+
|
|
88
92
|
```ts
|
|
89
93
|
interface ConnectEvent {
|
|
90
94
|
driverUri: string;
|
|
91
95
|
}
|
|
92
96
|
```
|
|
97
|
+
|
|
93
98
|
Used to log and send telemetry about connection information. Sensitive
|
|
94
99
|
information is stripped beforehand.
|
|
95
100
|
|
|
96
101
|
Example:
|
|
102
|
+
|
|
97
103
|
```js
|
|
98
104
|
bus.emit('mongosh:connect', {
|
|
99
|
-
driverUri: 'mongodb://192.168.0.5:9999/ships'
|
|
100
|
-
})
|
|
105
|
+
driverUri: 'mongodb://192.168.0.5:9999/ships',
|
|
106
|
+
});
|
|
101
107
|
```
|
|
102
108
|
|
|
103
109
|
### bus.on('mongosh:new-user', telemetryUserIdentity, enableTelemetry)
|
|
110
|
+
|
|
104
111
|
Where `telemetryUserIdentity` is `userId` and `anonymousId` which are both a [BSON ObjectID][object-id].
|
|
105
112
|
And `enableTelemetry` is a boolean flag.
|
|
106
113
|
This is used internally to update telemetry preferences.
|
|
107
114
|
|
|
108
115
|
Example:
|
|
116
|
+
|
|
109
117
|
```js
|
|
110
|
-
bus.emit(
|
|
118
|
+
bus.emit(
|
|
119
|
+
'mongosh:new-user',
|
|
120
|
+
{ userId: '12394dfjvnaw3uw3erdf', anonymousId: '12394dfjvnaw3uw3erdf' },
|
|
121
|
+
true
|
|
122
|
+
);
|
|
111
123
|
```
|
|
112
124
|
|
|
113
125
|
### bus.on('mongosh:update-user', telemetryUserIdentity, enableTelemetry)
|
|
126
|
+
|
|
114
127
|
Where `telemetryUserIdentity` is `userId` and `anonymousId` which are both a [BSON ObjectID][object-id].
|
|
115
128
|
And `enableTelemetry` is a boolean flag.
|
|
116
129
|
This is used internally to update telemetry preferences.
|
|
117
130
|
|
|
118
131
|
Example:
|
|
132
|
+
|
|
119
133
|
```js
|
|
120
|
-
bus.emit(
|
|
134
|
+
bus.emit(
|
|
135
|
+
'mongosh:update-user',
|
|
136
|
+
{ userId: '12394dfjvnaw3uw3erdf', anonymousId: null },
|
|
137
|
+
false
|
|
138
|
+
);
|
|
121
139
|
```
|
|
122
140
|
|
|
123
141
|
### bus.on('mongosh:error', error)
|
|
142
|
+
|
|
124
143
|
Where `error` is an [Error Object][error-object]. Used to log and send telemetry
|
|
125
144
|
about errors that are _thrown_.
|
|
126
145
|
|
|
127
146
|
Example:
|
|
147
|
+
|
|
128
148
|
```js
|
|
129
|
-
bus.emit('mongosh:error', new Error('Unable to show collections'))
|
|
149
|
+
bus.emit('mongosh:error', new Error('Unable to show collections'));
|
|
130
150
|
```
|
|
131
151
|
|
|
132
152
|
### bus.on('mongosh:rewritten-async-input', inputInfo)
|
|
153
|
+
|
|
133
154
|
Used for internal debugging of async-rewriter. `inputInfo` is an object with the
|
|
134
155
|
following interface:
|
|
156
|
+
|
|
135
157
|
```ts
|
|
136
158
|
interface AsyncRewriterEvent {
|
|
137
159
|
original: string;
|
|
@@ -140,15 +162,16 @@ interface AsyncRewriterEvent {
|
|
|
140
162
|
```
|
|
141
163
|
|
|
142
164
|
Example:
|
|
165
|
+
|
|
143
166
|
```js
|
|
144
167
|
bus.emit('mongosh:rewritten-async-input', {
|
|
145
168
|
original: 'db.coll.find().forEach()',
|
|
146
|
-
rewritten: 'await db.coll.find().forEach();'
|
|
147
|
-
})
|
|
148
|
-
|
|
169
|
+
rewritten: 'await db.coll.find().forEach();',
|
|
170
|
+
});
|
|
149
171
|
```
|
|
150
172
|
|
|
151
173
|
### bus.on('mongosh:use', args)
|
|
174
|
+
|
|
152
175
|
Used for recording information about `use`. `args` has the following interface:
|
|
153
176
|
|
|
154
177
|
```ts
|
|
@@ -158,12 +181,13 @@ interface UseEvent {
|
|
|
158
181
|
```
|
|
159
182
|
|
|
160
183
|
Example:
|
|
161
|
-
```js
|
|
162
|
-
bus.emit('mongosh:use', { db: 'cats' })
|
|
163
184
|
|
|
185
|
+
```js
|
|
186
|
+
bus.emit('mongosh:use', { db: 'cats' });
|
|
164
187
|
```
|
|
165
188
|
|
|
166
189
|
### bus.on('mongosh:show', args)
|
|
190
|
+
|
|
167
191
|
Used for recording information about `show` command. `args` has the following
|
|
168
192
|
interface:
|
|
169
193
|
|
|
@@ -174,22 +198,26 @@ interface ShowEvent {
|
|
|
174
198
|
```
|
|
175
199
|
|
|
176
200
|
Example:
|
|
177
|
-
```js
|
|
178
|
-
bus.emit('mongosh:show', { method: 'dbs' })
|
|
179
201
|
|
|
202
|
+
```js
|
|
203
|
+
bus.emit('mongosh:show', { method: 'dbs' });
|
|
180
204
|
```
|
|
181
205
|
|
|
182
206
|
### bus.on('mongosh:it')
|
|
207
|
+
|
|
183
208
|
Used for recording when `it` command was called.
|
|
184
209
|
|
|
185
210
|
Example:
|
|
186
|
-
```js
|
|
187
|
-
bus.emit('mongosh:it')
|
|
188
211
|
|
|
212
|
+
```js
|
|
213
|
+
bus.emit('mongosh:it');
|
|
189
214
|
```
|
|
215
|
+
|
|
190
216
|
### bus.on('mongosh:api-call', args)
|
|
217
|
+
|
|
191
218
|
Used for recording information when API calls are made. `args` has the following
|
|
192
219
|
interface:
|
|
220
|
+
|
|
193
221
|
```ts
|
|
194
222
|
interface ApiEvent {
|
|
195
223
|
method?: string;
|
|
@@ -214,37 +242,44 @@ information containing documents coming from API calls such as
|
|
|
214
242
|
`db.coll.insert()` or `db.coll.bulkWrite()` to keep cleaner logs.
|
|
215
243
|
|
|
216
244
|
`aggregate` Event Example:
|
|
245
|
+
|
|
217
246
|
```js
|
|
218
247
|
this.messageBus.emit('mongosh:api-call', {
|
|
219
248
|
method: 'aggregate',
|
|
220
249
|
class: 'Collection',
|
|
221
|
-
db,
|
|
250
|
+
db,
|
|
251
|
+
coll,
|
|
252
|
+
arguments: { options, pipeline },
|
|
222
253
|
});
|
|
223
|
-
|
|
224
254
|
```
|
|
225
255
|
|
|
226
256
|
`runCommand` Event Example:
|
|
257
|
+
|
|
227
258
|
```js
|
|
228
259
|
this.messageBus.emit('mongosh:api-call', {
|
|
229
|
-
method: 'runCommand',
|
|
260
|
+
method: 'runCommand',
|
|
261
|
+
class: 'Database',
|
|
262
|
+
db,
|
|
263
|
+
arguments: { cmd },
|
|
230
264
|
});
|
|
231
|
-
|
|
232
265
|
```
|
|
233
266
|
|
|
234
267
|
`createIndex` Event Example:
|
|
268
|
+
|
|
235
269
|
```js
|
|
236
270
|
this.messageBus.emit('mongosh:api-call', {
|
|
237
271
|
method: 'createIndex',
|
|
238
272
|
class: 'Collection',
|
|
239
|
-
db,
|
|
273
|
+
db,
|
|
274
|
+
coll,
|
|
275
|
+
arguments: { keys, options },
|
|
240
276
|
});
|
|
241
277
|
```
|
|
242
278
|
|
|
243
|
-
|
|
244
279
|
## Local Development
|
|
245
280
|
|
|
246
|
-
|
|
247
281
|
## Installation
|
|
282
|
+
|
|
248
283
|
```shell
|
|
249
284
|
npm install --save @mongosh/cli-repl
|
|
250
285
|
```
|
package/lib/arg-parser.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CliOptions } from '@mongosh/arg-parser';
|
|
2
2
|
export declare function getLocale(args: string[], env: any): string;
|
|
3
|
-
export declare function parseCliArgs(args: string[]):
|
|
3
|
+
export declare function parseCliArgs(args: string[]): CliOptions & {
|
|
4
4
|
smokeTests: boolean;
|
|
5
5
|
buildInfo: boolean;
|
|
6
6
|
_argParseWarnings: string[];
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
export declare function verifyCliArguments(args: any): string[];
|
package/lib/arg-parser.js
CHANGED
|
@@ -48,7 +48,7 @@ const OPTIONS = {
|
|
|
48
48
|
'tlsCertificateSelector',
|
|
49
49
|
'tlsCRLFile',
|
|
50
50
|
'tlsDisabledProtocols',
|
|
51
|
-
'username'
|
|
51
|
+
'username',
|
|
52
52
|
],
|
|
53
53
|
boolean: [
|
|
54
54
|
'apiDeprecationErrors',
|
|
@@ -73,12 +73,9 @@ const OPTIONS = {
|
|
|
73
73
|
'tlsFIPSMode',
|
|
74
74
|
'tlsUseSystemCA',
|
|
75
75
|
'verbose',
|
|
76
|
-
'version'
|
|
77
|
-
],
|
|
78
|
-
array: [
|
|
79
|
-
'eval',
|
|
80
|
-
'file'
|
|
76
|
+
'version',
|
|
81
77
|
],
|
|
78
|
+
array: ['eval', 'file'],
|
|
82
79
|
alias: {
|
|
83
80
|
h: 'help',
|
|
84
81
|
p: 'password',
|
|
@@ -87,7 +84,7 @@ const OPTIONS = {
|
|
|
87
84
|
'build-info': 'buildInfo',
|
|
88
85
|
json: 'json',
|
|
89
86
|
browser: 'browser',
|
|
90
|
-
oidcRedirectUrl: 'oidcRedirectUri'
|
|
87
|
+
oidcRedirectUrl: 'oidcRedirectUri',
|
|
91
88
|
},
|
|
92
89
|
configuration: {
|
|
93
90
|
'camel-case-expansion': false,
|
|
@@ -95,8 +92,8 @@ const OPTIONS = {
|
|
|
95
92
|
'parse-positional-numbers': false,
|
|
96
93
|
'parse-numbers': false,
|
|
97
94
|
'greedy-arrays': false,
|
|
98
|
-
'short-option-groups': false
|
|
99
|
-
}
|
|
95
|
+
'short-option-groups': false,
|
|
96
|
+
},
|
|
100
97
|
};
|
|
101
98
|
const DEPRECATED_ARGS_WITH_REPLACEMENT = {
|
|
102
99
|
ssl: 'tls',
|
|
@@ -108,12 +105,9 @@ const DEPRECATED_ARGS_WITH_REPLACEMENT = {
|
|
|
108
105
|
sslCAFile: 'tlsCAFile',
|
|
109
106
|
sslCertificateSelector: 'tlsCertificateSelector',
|
|
110
107
|
sslCRLFile: 'tlsCRLFile',
|
|
111
|
-
sslDisabledProtocols: 'tlsDisabledProtocols'
|
|
108
|
+
sslDisabledProtocols: 'tlsDisabledProtocols',
|
|
112
109
|
};
|
|
113
|
-
const UNSUPPORTED_ARGS = [
|
|
114
|
-
'sslFIPSMode',
|
|
115
|
-
'gssapiHostName'
|
|
116
|
-
];
|
|
110
|
+
const UNSUPPORTED_ARGS = ['sslFIPSMode', 'gssapiHostName'];
|
|
117
111
|
function getLocale(args, env) {
|
|
118
112
|
const localeIndex = args.indexOf('--locale');
|
|
119
113
|
if (localeIndex > -1) {
|
|
@@ -124,10 +118,10 @@ function getLocale(args, env) {
|
|
|
124
118
|
}
|
|
125
119
|
exports.getLocale = getLocale;
|
|
126
120
|
function isConnectionSpecifier(arg) {
|
|
127
|
-
return typeof arg === 'string' &&
|
|
121
|
+
return (typeof arg === 'string' &&
|
|
128
122
|
(arg.startsWith('mongodb://') ||
|
|
129
123
|
arg.startsWith('mongodb+srv://') ||
|
|
130
|
-
!(arg.endsWith('.js') || arg.endsWith('.mongodb')));
|
|
124
|
+
!(arg.endsWith('.js') || arg.endsWith('.mongodb'))));
|
|
131
125
|
}
|
|
132
126
|
function parseCliArgs(args) {
|
|
133
127
|
var _a, _b;
|
package/lib/arg-parser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arg-parser.js","sourceRoot":"","sources":["../src/arg-parser.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA0E;AAC1E,yDAAiC;AAEjC,gEAAkC;AAClC,+BAAiD;AACjD,2CAAoC;AAKpC,MAAM,OAAO,GAAG,oCAAoC,CAAC;AAKrD,MAAM,OAAO,GAAG;IACd,MAAM,EAAE;QACN,YAAY;QACZ,wBAAwB;QACxB,yBAAyB;QACzB,gBAAgB;QAChB,oBAAoB;QACpB,oBAAoB;QACpB,iBAAiB;QACjB,oBAAoB;QACpB,SAAS;QACT,kBAAkB;QAClB,oBAAoB;QACpB,IAAI;QACJ,gBAAgB;QAChB,mBAAmB;QACnB,8BAA8B;QAC9B,mBAAmB;QACnB,MAAM;QACN,mBAAmB;QACnB,QAAQ;QACR,QAAQ;QACR,WAAW;QACX,iBAAiB;QACjB,UAAU;QACV,MAAM;QACN,eAAe;QACf,mBAAmB;QACnB,WAAW;QACX,wBAAwB;QACxB,YAAY;QACZ,sBAAsB;QACtB,WAAW;QACX,uBAAuB;QACvB,+BAA+B;QAC/B,wBAAwB;QACxB,YAAY;QACZ,sBAAsB;QACtB,UAAU;KACX;IACD,OAAO,EAAE;QACP,sBAAsB;QACtB,WAAW;QACX,WAAW;QACX,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,qBAAqB;QACrB,OAAO;QACP,aAAa;QACb,OAAO;QACP,YAAY;QACZ,KAAK;QACL,6BAA6B;QAC7B,0BAA0B;QAC1B,aAAa;QACb,KAAK;QACL,6BAA6B;QAC7B,0BAA0B;QAC1B,aAAa;QACb,gBAAgB;QAChB,SAAS;QACT,SAAS;KACV;IACD,KAAK,EAAE
|
|
1
|
+
{"version":3,"file":"arg-parser.js","sourceRoot":"","sources":["../src/arg-parser.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA0E;AAC1E,yDAAiC;AAEjC,gEAAkC;AAClC,+BAAiD;AACjD,2CAAoC;AAKpC,MAAM,OAAO,GAAG,oCAAoC,CAAC;AAKrD,MAAM,OAAO,GAAG;IACd,MAAM,EAAE;QACN,YAAY;QACZ,wBAAwB;QACxB,yBAAyB;QACzB,gBAAgB;QAChB,oBAAoB;QACpB,oBAAoB;QACpB,iBAAiB;QACjB,oBAAoB;QACpB,SAAS;QACT,kBAAkB;QAClB,oBAAoB;QACpB,IAAI;QACJ,gBAAgB;QAChB,mBAAmB;QACnB,8BAA8B;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CAAC,eAAe,CAC7B,CAAC;KACH;IAED,MAAM,QAAQ,GAAG,EAAE,CAAC;IACpB,KAAK,MAAM,UAAU,IAAI,gCAAgC,EAAE;QACzD,IAAI,UAAU,IAAI,IAAI,EAAE;YACtB,MAAM,WAAW,GAAG,gCAAgC,CAAC,UAAU,CAAC,CAAC;YACjE,QAAQ,CAAC,IAAI,CACX,uBAAuB,UAAU,6CAA6C,WAAW,WAAW,CACrG,CAAC;YAEF,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;YACrC,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC;SACzB;KACF;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AA9BD,gDA8BC"}
|
package/lib/async-repl.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import type { ReadLineOptions } from 'readline';
|
|
3
4
|
import type { ReplOptions, REPLServer } from 'repl';
|
|
4
5
|
import { start as originalStart } from 'repl';
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
6
|
+
export type OriginalEvalFunction = (input: string, context: any, filename: string) => Promise<any>;
|
|
7
|
+
export type AsyncEvalFunction = (originalEval: OriginalEvalFunction, input: string, context: any, filename: string) => Promise<any>;
|
|
8
|
+
export type AsyncREPLOptions = ReadLineOptions & Omit<ReplOptions, 'eval' | 'breakEvalOnSigint'> & {
|
|
8
9
|
start?: typeof originalStart;
|
|
9
10
|
wrapCallbackError?: (err: Error) => Error;
|
|
10
11
|
asyncEval: AsyncEvalFunction;
|
|
11
12
|
onAsyncSigint?: () => Promise<boolean> | boolean;
|
|
12
13
|
};
|
|
13
|
-
export
|
|
14
|
+
export type EvalStartEvent = {
|
|
14
15
|
input: string;
|
|
15
16
|
};
|
|
16
|
-
export
|
|
17
|
+
export type EvalFinishEvent = EvalStartEvent & ({
|
|
17
18
|
success: true;
|
|
18
19
|
} | {
|
|
19
20
|
success: false;
|
package/lib/async-repl.js
CHANGED
|
@@ -19,7 +19,7 @@ function disableEvent(emitter, event) {
|
|
|
19
19
|
for (const listener of rawListeners) {
|
|
20
20
|
emitter.on(event, listener);
|
|
21
21
|
}
|
|
22
|
-
}
|
|
22
|
+
},
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
function getPrompt(repl) {
|
|
@@ -28,7 +28,7 @@ function getPrompt(repl) {
|
|
|
28
28
|
}
|
|
29
29
|
function start(opts) {
|
|
30
30
|
var _a;
|
|
31
|
-
const { asyncEval, wrapCallbackError = err => err, onAsyncSigint } = opts;
|
|
31
|
+
const { asyncEval, wrapCallbackError = (err) => err, onAsyncSigint } = opts;
|
|
32
32
|
if (onAsyncSigint) {
|
|
33
33
|
opts.breakEvalOnSigint = true;
|
|
34
34
|
}
|
|
@@ -54,7 +54,9 @@ function start(opts) {
|
|
|
54
54
|
readline_1.Interface.prototype.setPrompt.call(repl, '');
|
|
55
55
|
try {
|
|
56
56
|
let exitEventPending = false;
|
|
57
|
-
const exitListener = () => {
|
|
57
|
+
const exitListener = () => {
|
|
58
|
+
exitEventPending = true;
|
|
59
|
+
};
|
|
58
60
|
let previousExitListeners = [];
|
|
59
61
|
let sigintListener = undefined;
|
|
60
62
|
let replSigint = undefined;
|
|
@@ -70,7 +72,9 @@ function start(opts) {
|
|
|
70
72
|
catch (e) {
|
|
71
73
|
}
|
|
72
74
|
finally {
|
|
73
|
-
reject(interruptHandled
|
|
75
|
+
reject(interruptHandled
|
|
76
|
+
? undefined
|
|
77
|
+
: new Error('Asynchronous execution was interrupted by `SIGINT`'));
|
|
74
78
|
}
|
|
75
79
|
};
|
|
76
80
|
replSigint = disableEvent(repl, 'SIGINT');
|
|
@@ -112,10 +116,20 @@ function start(opts) {
|
|
|
112
116
|
catch (err) {
|
|
113
117
|
try {
|
|
114
118
|
if ((0, is_recoverable_error_1.default)(input)) {
|
|
115
|
-
repl.emit(exports.evalFinish, {
|
|
119
|
+
repl.emit(exports.evalFinish, {
|
|
120
|
+
input,
|
|
121
|
+
success: false,
|
|
122
|
+
err,
|
|
123
|
+
recoverable: true,
|
|
124
|
+
});
|
|
116
125
|
return callback(new repl_1.Recoverable(err));
|
|
117
126
|
}
|
|
118
|
-
repl.emit(exports.evalFinish, {
|
|
127
|
+
repl.emit(exports.evalFinish, {
|
|
128
|
+
input,
|
|
129
|
+
success: false,
|
|
130
|
+
err,
|
|
131
|
+
recoverable: false,
|
|
132
|
+
});
|
|
119
133
|
return callback(err);
|
|
120
134
|
}
|
|
121
135
|
catch (callbackErr) {
|
package/lib/async-repl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-repl.js","sourceRoot":"","sources":["../src/async-repl.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"async-repl.js","sourceRoot":"","sources":["../src/async-repl.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAgC;AAGhC,gFAAsD;AAEtD,uCAAqC;AAErC,+BAA2D;AAC3D,+BAAiC;AA0CpB,QAAA,SAAS,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAC3C,QAAA,UAAU,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAI1D,SAAS,YAAY,CAAC,OAAqB,EAAE,KAAa;IACxD,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACjD,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAClC,OAAO;QACL,OAAO;YACL,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE;gBACnC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAe,CAAC,CAAC;aACpC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,IAAS;;IAE1B,OAAO,MAAA,MAAA,IAAI,CAAC,SAAS,oDAAI,mCAAI,IAAI,CAAC,OAAO,CAAC;AAC5C,CA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AAG,IAAI,CAAC,CAAC;SACpB;gBAAS;YAGR,eAAM,CAAC,SAAS,CAAC,IAAI,GAAG,QAAQ,CAAC;SAClC;IACH,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CACrB,KAAU,EACV,EAA0B;IAE1B,OAAO,CAAC,GAAG,IAAU,EAAO,EAAE;QAmD5B,MAAM,uCAAuC,GAC3C,OAAO,CAAC,QAAQ,KAAK,OAAO;YAC5B,KAAK,CAAC,KAAK;YACX,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,OAAO,CAAC,OAAO;YACrB,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,KAAK,UAAU;YAC5C,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,KAAK,UAAU,CAAC;QAChD,IAAI,uCAAuC,EAAE;YAC3C,KAAK,CAAC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;YAC9B,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;SAC1B;QAED,IAAI;YACF,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;SACpB;gBAAS;YACR,IAAI,uCAAuC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE;gBACrE,KAAK,CAAC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;gBAC7B,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;aAC3B;SACF;IACH,CAAC,CAAC;AACJ,CAAC"}
|
package/lib/build-info.d.ts
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { CliServiceProvider } from '@mongosh/service-provider-server';
|
|
3
4
|
export interface BuildInfo {
|
|
4
5
|
version: string;
|
|
5
6
|
nodeVersion: string;
|
|
6
7
|
distributionKind: 'unpackaged' | 'packaged' | 'compiled';
|
|
7
|
-
runtimeArch: typeof process['arch'];
|
|
8
|
-
runtimePlatform: typeof process['platform'];
|
|
9
|
-
buildArch: typeof process['arch'];
|
|
10
|
-
buildPlatform: typeof process['platform'];
|
|
8
|
+
runtimeArch: (typeof process)['arch'];
|
|
9
|
+
runtimePlatform: (typeof process)['platform'];
|
|
10
|
+
buildArch: (typeof process)['arch'];
|
|
11
|
+
buildPlatform: (typeof process)['platform'];
|
|
11
12
|
buildTarget: string;
|
|
12
13
|
buildTime: string | null;
|
|
13
14
|
gitVersion: string | null;
|
|
14
15
|
opensslVersion: string;
|
|
15
16
|
sharedOpenssl: boolean;
|
|
16
17
|
segmentApiKey?: string;
|
|
17
|
-
deps: ReturnType<typeof CliServiceProvider.getVersionInformation
|
|
18
|
-
cryptSharedLibraryVersion?: string;
|
|
19
|
-
};
|
|
18
|
+
deps: ReturnType<typeof CliServiceProvider.getVersionInformation>;
|
|
20
19
|
}
|
|
21
|
-
export declare function buildInfo({ withSegmentApiKey,
|
|
20
|
+
export declare function buildInfo({ withSegmentApiKey, }?: {
|
|
22
21
|
withSegmentApiKey?: boolean;
|
|
23
|
-
withCryptSharedVersionInfo?: boolean;
|
|
24
22
|
}): Promise<BuildInfo>;
|
package/lib/build-info.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.buildInfo = void 0;
|
|
7
7
|
const os_1 = __importDefault(require("os"));
|
|
8
8
|
const service_provider_server_1 = require("@mongosh/service-provider-server");
|
|
9
|
-
const crypt_library_paths_1 = require("./crypt-library-paths");
|
|
10
9
|
function getSystemArch() {
|
|
11
10
|
return process.platform === 'darwin'
|
|
12
11
|
? os_1.default.cpus().some((cpu) => {
|
|
@@ -16,28 +15,17 @@ function getSystemArch() {
|
|
|
16
15
|
: 'x64'
|
|
17
16
|
: process.arch;
|
|
18
17
|
}
|
|
19
|
-
async function buildInfo({ withSegmentApiKey,
|
|
20
|
-
var _a;
|
|
18
|
+
async function buildInfo({ withSegmentApiKey, } = {}) {
|
|
21
19
|
const dependencyVersionInfo = {
|
|
22
|
-
...service_provider_server_1.CliServiceProvider.getVersionInformation()
|
|
20
|
+
...service_provider_server_1.CliServiceProvider.getVersionInformation(),
|
|
23
21
|
};
|
|
24
|
-
try {
|
|
25
|
-
if (withCryptSharedVersionInfo) {
|
|
26
|
-
const version = (_a = (await (0, crypt_library_paths_1.getCryptLibraryPaths)()).expectedVersion) === null || _a === void 0 ? void 0 : _a.versionStr;
|
|
27
|
-
if (version) {
|
|
28
|
-
dependencyVersionInfo.cryptSharedLibraryVersion = version;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
catch (_b) {
|
|
33
|
-
}
|
|
34
22
|
const runtimeData = {
|
|
35
23
|
nodeVersion: process.version,
|
|
36
24
|
opensslVersion: process.versions.openssl,
|
|
37
25
|
sharedOpenssl: !!process.config.variables.node_shared_openssl,
|
|
38
26
|
runtimeArch: getSystemArch(),
|
|
39
27
|
runtimePlatform: process.platform,
|
|
40
|
-
deps: { ...dependencyVersionInfo }
|
|
28
|
+
deps: { ...dependencyVersionInfo },
|
|
41
29
|
};
|
|
42
30
|
try {
|
|
43
31
|
const buildInfo = { ...require('./build-info.json'), ...runtimeData };
|
|
@@ -46,7 +34,7 @@ async function buildInfo({ withSegmentApiKey, withCryptSharedVersionInfo, } = {}
|
|
|
46
34
|
}
|
|
47
35
|
return buildInfo;
|
|
48
36
|
}
|
|
49
|
-
catch (
|
|
37
|
+
catch (_a) {
|
|
50
38
|
const { version } = require('../package.json');
|
|
51
39
|
return {
|
|
52
40
|
version,
|
|
@@ -56,7 +44,7 @@ async function buildInfo({ withSegmentApiKey, withCryptSharedVersionInfo, } = {}
|
|
|
56
44
|
buildTarget: 'unknown',
|
|
57
45
|
buildTime: null,
|
|
58
46
|
gitVersion: null,
|
|
59
|
-
...runtimeData
|
|
47
|
+
...runtimeData,
|
|
60
48
|
};
|
|
61
49
|
}
|
|
62
50
|
}
|
package/lib/build-info.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-info.js","sourceRoot":"","sources":["../src/build-info.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,8EAAsE;
|
|
1
|
+
{"version":3,"file":"build-info.js","sourceRoot":"","sources":["../src/build-info.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,8EAAsE;AAmBtE,SAAS,aAAa;IACpB,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ;QAClC,CAAC,CAAC,YAAE,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YAMrB,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC,CAAC;YACF,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,KAAK;QACT,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;AACnB,CAAC;AAOM,KAAK,UAAU,SAAS,CAAC,EAC9B,iBAAiB,MAGf,EAAE;IACJ,MAAM,qBAAqB,GAAsB;QAC/C,GAAG,4CAAkB,CAAC,qBAAqB,EAAE;KAC9C,CAAC;IAEF,MAAM,WAAW,GAAG;QAClB,WAAW,EAAE,OAAO,CAAC,OAAO;QAC5B,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,OAAO;QACxC,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,mBAAmB;QAG7D,WAAW,EAAE,aAAa,EAAE;QAG5B,eAAe,EAAE,OAAO,CAAC,QAAQ;QACjC,IAAI,EAAE,EAAE,GAAG,qBAAqB,EAAE;KACnC,CAAC;IAEF,IAAI;QACF,MAAM,SAAS,GAAG,EAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC,EAAE,GAAG,WAAW,EAAE,CAAC;QACtE,IAAI,CAAC,iBAAiB,EAAE;YACtB,OAAO,SAAS,CAAC,aAAa,CAAC;SAChC;QACD,OAAO,SAAS,CAAC;KAClB;IAAC,WAAM;QACN,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAC/C,OAAO;YACL,OAAO;YACP,gBAAgB,EAAE,YAAY;YAC9B,SAAS,EAAE,OAAO,CAAC,IAAI;YACvB,aAAa,EAAE,OAAO,CAAC,QAAQ;YAC/B,WAAW,EAAE,SAAS;YACtB,SAAS,EAAE,IAAI;YACf,UAAU,EAAE,IAAI;YAChB,GAAG,WAAW;SACf,CAAC;KACH;AACH,CAAC;AAzCD,8BAyCC"}
|
package/lib/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"segmentApiKey":"
|
|
1
|
+
{"segmentApiKey":"LLBrrHblu6jY9aujeyXJuePD5dAAFGjn","version":"1.10.3","distributionKind":"packaged","buildArch":"x64","buildPlatform":"linux","buildTarget":"unknown","buildTime":"2023-07-31T11:51:57.972Z","gitVersion":"5df718faed3916fc5ce637f953eef2f913b14303"}
|
package/lib/cli-repl.d.ts
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { AutoEncryptionOptions } from '@mongosh/service-provider-core';
|
|
2
|
+
import type { AutoEncryptionOptions } from '@mongosh/service-provider-core';
|
|
3
3
|
import { CliServiceProvider } from '@mongosh/service-provider-server';
|
|
4
4
|
import type { CliOptions, DevtoolsConnectOptions } from '@mongosh/arg-parser';
|
|
5
5
|
import Analytics from 'analytics-node';
|
|
6
6
|
import ConnectionString from 'mongodb-connection-string-url';
|
|
7
|
-
import { Readable, Writable } from 'stream';
|
|
7
|
+
import type { Readable, Writable } from 'stream';
|
|
8
8
|
import type { StyleDefinition } from './clr';
|
|
9
|
-
import {
|
|
9
|
+
import type { ShellHomePaths } from './config-directory';
|
|
10
|
+
import { ConfigManager, ShellHomeDirectory } from './config-directory';
|
|
10
11
|
import type { CryptLibraryPathResult } from './crypt-library-paths';
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
12
|
+
import type { MongoLogWriter } from 'mongodb-log-writer';
|
|
13
|
+
import { MongoLogManager } from 'mongodb-log-writer';
|
|
14
|
+
import type { MongoshNodeReplOptions, MongoshIOProvider } from './mongosh-repl';
|
|
15
|
+
import MongoshNodeRepl from './mongosh-repl';
|
|
13
16
|
import { ToggleableAnalytics } from '@mongosh/logging';
|
|
14
|
-
import { MongoshBus
|
|
15
|
-
|
|
17
|
+
import type { MongoshBus } from '@mongosh/types';
|
|
18
|
+
import { CliUserConfig } from '@mongosh/types';
|
|
19
|
+
type AnalyticsOptions = {
|
|
16
20
|
host?: string;
|
|
17
21
|
apiKey?: string;
|
|
18
22
|
alwaysEnable?: boolean;
|
|
19
23
|
};
|
|
20
|
-
export
|
|
24
|
+
export type CliReplOptions = {
|
|
21
25
|
shellCliOptions: CliOptions;
|
|
22
26
|
getCryptLibraryPaths?: (bus: MongoshBus) => Promise<CryptLibraryPathResult>;
|
|
23
27
|
input: Readable;
|
|
@@ -27,7 +31,7 @@ export declare type CliReplOptions = {
|
|
|
27
31
|
onExit: (code?: number) => never;
|
|
28
32
|
analyticsOptions?: AnalyticsOptions;
|
|
29
33
|
} & Pick<MongoshNodeReplOptions, 'nodeReplOptions'>;
|
|
30
|
-
|
|
34
|
+
type CliUserConfigOnDisk = Partial<CliUserConfig> & Pick<CliUserConfig, 'enableTelemetry' | 'userId' | 'telemetryAnonymousId'>;
|
|
31
35
|
export declare class CliRepl implements MongoshIOProvider {
|
|
32
36
|
mongoshRepl: MongoshNodeRepl;
|
|
33
37
|
bus: MongoshBus;
|