@mongosh/shell-evaluator 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 +13 -0
- package/.eslintrc.js +10 -1
- package/.prettierignore +6 -0
- package/.prettierrc.json +1 -0
- package/AUTHORS +1 -0
- package/lib/index.js.map +1 -1
- package/lib/shell-evaluator.d.ts +4 -3
- package/lib/shell-evaluator.js +5 -2
- package/lib/shell-evaluator.js.map +1 -1
- package/package.json +20 -10
- package/tsconfig-lint.json +5 -0
- package/tsconfig.lint.json +0 -8
package/.depcheckrc
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
- ts-sinon
|
|
10
|
+
- eslint-plugin-mocha
|
|
11
|
+
- eslint-config-mongodb-js
|
|
12
|
+
ignore-patterns:
|
|
13
|
+
- .eslintrc.js
|
package/.eslintrc.js
CHANGED
|
@@ -1 +1,10 @@
|
|
|
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
|
+
};
|
package/.prettierignore
ADDED
package/.prettierrc.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"@mongodb-js/prettier-config-devtools"
|
package/AUTHORS
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAI2B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAI2B;AAEL,+FAJpB,gCAAc,OAIoB;AACpC,kBAAe,gCAAc,CAAC"}
|
package/lib/shell-evaluator.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ShellInstanceState
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { ShellInstanceState } from '@mongosh/shell-api';
|
|
2
|
+
import { ShellResult, EvaluationListener } from '@mongosh/shell-api';
|
|
3
|
+
type EvaluationFunction = (input: string, context: object, filename: string) => Promise<any>;
|
|
4
|
+
type ResultHandler<EvaluationResultType> = (value: any) => EvaluationResultType | Promise<EvaluationResultType>;
|
|
4
5
|
declare class ShellEvaluator<EvaluationResultType = ShellResult> {
|
|
5
6
|
private instanceState;
|
|
6
7
|
private resultHandler;
|
package/lib/shell-evaluator.js
CHANGED
|
@@ -27,13 +27,16 @@ class ShellEvaluator {
|
|
|
27
27
|
const rawArg = trimmedInput.replace(/^\S+\s*/, '');
|
|
28
28
|
return shellApi[cmd](rawArg);
|
|
29
29
|
}
|
|
30
|
-
if (((_d = shellApi[cmd]) === null || _d === void 0 ? void 0 : _d.isDirectShellCommand) &&
|
|
30
|
+
if (((_d = shellApi[cmd]) === null || _d === void 0 ? void 0 : _d.isDirectShellCommand) &&
|
|
31
|
+
!((_e = argv[0]) !== null && _e !== void 0 ? _e : '').startsWith('(')) {
|
|
31
32
|
return shellApi[cmd](...argv);
|
|
32
33
|
}
|
|
33
34
|
let rewrittenInput = this.asyncWriter.process(input);
|
|
34
35
|
const hiddenCommands = RegExp(history_1.HIDDEN_COMMANDS, 'g');
|
|
35
36
|
if (!hiddenCommands.test(input) && !hiddenCommands.test(rewrittenInput)) {
|
|
36
|
-
this.instanceState.messageBus.emit('mongosh:evaluate-input', {
|
|
37
|
+
this.instanceState.messageBus.emit('mongosh:evaluate-input', {
|
|
38
|
+
input: (0, history_1.redactSensitiveData)(trimmedInput),
|
|
39
|
+
});
|
|
37
40
|
}
|
|
38
41
|
if (!this.hasAppliedAsyncWriterRuntimeSupport) {
|
|
39
42
|
this.hasAppliedAsyncWriterRuntimeSupport = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-evaluator.js","sourceRoot":"","sources":["../src/shell-evaluator.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"shell-evaluator.js","sourceRoot":"","sources":["../src/shell-evaluator.ts"],"names":[],"mappings":";;;;;;AACA,kDAI4B;AAC5B,+EAAmD;AAQnD,8CAAwE;AAKxE,MAAM,cAAc;IAMlB,YACE,aAAiC,EACjC,gBAAqD,yBAAoB;QALnE,wCAAmC,GAAG,IAAI,CAAC;QAOjD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,WAAW,GAAG,IAAI,yBAAW,EAAE,CAAC;QACrC,IAAI,CAAC,mCAAmC,GAAG,KAAK,CAAC;IACnD,CAAC;IAUO,KAAK,CAAC,SAAS,CACrB,YAAgC,EAChC,KAAa,EACb,OAAe,EACf,QAAgB;;QAEhB,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC;QACxC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAA2B,CAAC;QAElD,IACE,CAAA,MAAA,QAAQ,CAAC,GAAG,CAAC,0CAAE,oBAAoB;aACnC,MAAA,QAAQ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,OAAO,EAAE,QAAQ,CAAC,CAAC;SAC9D;QAAC,OAAO,GAAQ,EAAE;YACjB,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;SAC9C;IACH,CAAC;IAUM,KAAK,CAAC,UAAU,CACrB,YAAgC,EAChC,KAAa,EACb,OAAe,EACf,QAAgB;QAEhB,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,SAAS,CAC3C,YAAY,EACZ,KAAK,EACL,OAAO,EACP,QAAQ,CACT,CAAC;QAEF,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACpD,CAAC;CACF;AAEqB,wCAAc"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongosh/shell-evaluator",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.3",
|
|
4
4
|
"description": "MongoDB Top Level API Package",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "mocha -r \"../../scripts/import-expansions.js\" --timeout 60000 -r ts-node/register \"./{src,lib}/**/*.spec.ts\"",
|
|
8
8
|
"test-ci": "node ../../scripts/run-if-package-requested.js npm test",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
9
|
+
"eslint": "eslint",
|
|
10
|
+
"lint": "npm run eslint . && npm run prettier -- --check .",
|
|
11
|
+
"check": "npm run lint && npm run depcheck",
|
|
12
|
+
"depcheck": "depcheck",
|
|
13
|
+
"compile": "tsc -p tsconfig.json",
|
|
14
|
+
"prepublish": "npm run compile",
|
|
15
|
+
"prettier": "prettier",
|
|
16
|
+
"reformat": "npm run prettier -- --write . && npm run eslint --fix"
|
|
13
17
|
},
|
|
14
18
|
"config": {
|
|
15
19
|
"unsafe-perm": true
|
|
@@ -29,12 +33,18 @@
|
|
|
29
33
|
"unitTestsOnly": true
|
|
30
34
|
},
|
|
31
35
|
"devDependencies": {
|
|
32
|
-
"@
|
|
36
|
+
"@mongodb-js/eslint-config-mongosh": "1.10.3",
|
|
37
|
+
"@mongodb-js/prettier-config-devtools": "^1.0.1",
|
|
38
|
+
"@mongodb-js/tsconfig-mongosh": "1.10.3",
|
|
39
|
+
"@types/sinon-chai": "^3.2.4",
|
|
40
|
+
"depcheck": "^1.4.3",
|
|
41
|
+
"eslint": "^7.25.0",
|
|
42
|
+
"prettier": "^2.8.8"
|
|
33
43
|
},
|
|
34
44
|
"dependencies": {
|
|
35
|
-
"@mongosh/async-rewriter2": "1.10.
|
|
36
|
-
"@mongosh/history": "1.10.
|
|
37
|
-
"@mongosh/shell-api": "1.10.
|
|
45
|
+
"@mongosh/async-rewriter2": "1.10.3",
|
|
46
|
+
"@mongosh/history": "1.10.3",
|
|
47
|
+
"@mongosh/shell-api": "1.10.3"
|
|
38
48
|
},
|
|
39
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "5df718faed3916fc5ce637f953eef2f913b14303"
|
|
40
50
|
}
|