@documentdb-js/shell-runtime 0.8.0
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/LICENSE.md +21 -0
- package/README.md +94 -0
- package/dist/CommandInterceptor.d.ts +55 -0
- package/dist/CommandInterceptor.d.ts.map +1 -0
- package/dist/CommandInterceptor.js +87 -0
- package/dist/CommandInterceptor.js.map +1 -0
- package/dist/CommandInterceptor.test.d.ts +2 -0
- package/dist/CommandInterceptor.test.d.ts.map +1 -0
- package/dist/CommandInterceptor.test.js +195 -0
- package/dist/CommandInterceptor.test.js.map +1 -0
- package/dist/DocumentDBServiceProvider.d.ts +48 -0
- package/dist/DocumentDBServiceProvider.d.ts.map +1 -0
- package/dist/DocumentDBServiceProvider.js +59 -0
- package/dist/DocumentDBServiceProvider.js.map +1 -0
- package/dist/DocumentDBShellRuntime.d.ts +144 -0
- package/dist/DocumentDBShellRuntime.d.ts.map +1 -0
- package/dist/DocumentDBShellRuntime.js +521 -0
- package/dist/DocumentDBShellRuntime.js.map +1 -0
- package/dist/DocumentDBShellRuntime.test.d.ts +2 -0
- package/dist/DocumentDBShellRuntime.test.d.ts.map +1 -0
- package/dist/DocumentDBShellRuntime.test.js +200 -0
- package/dist/DocumentDBShellRuntime.test.js.map +1 -0
- package/dist/HelpProvider.d.ts +45 -0
- package/dist/HelpProvider.d.ts.map +1 -0
- package/dist/HelpProvider.js +179 -0
- package/dist/HelpProvider.js.map +1 -0
- package/dist/HelpProvider.test.d.ts +2 -0
- package/dist/HelpProvider.test.d.ts.map +1 -0
- package/dist/HelpProvider.test.js +133 -0
- package/dist/HelpProvider.test.js.map +1 -0
- package/dist/ResultTransformer.d.ts +58 -0
- package/dist/ResultTransformer.d.ts.map +1 -0
- package/dist/ResultTransformer.js +96 -0
- package/dist/ResultTransformer.js.map +1 -0
- package/dist/ResultTransformer.test.d.ts +2 -0
- package/dist/ResultTransformer.test.d.ts.map +1 -0
- package/dist/ResultTransformer.test.js +166 -0
- package/dist/ResultTransformer.test.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +30 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type ShellEvaluationResult } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Transforms raw @mongosh `ShellResult` objects into clean `ShellEvaluationResult` values.
|
|
4
|
+
*
|
|
5
|
+
* Handles:
|
|
6
|
+
* - Cursor result unwrapping (`{ cursorHasMore, documents }` → plain array)
|
|
7
|
+
* - Array subclass normalization (CursorIterationResult → plain Array)
|
|
8
|
+
* - Source namespace extraction
|
|
9
|
+
*/
|
|
10
|
+
export declare class ResultTransformer {
|
|
11
|
+
/**
|
|
12
|
+
* Transform a raw @mongosh ShellResult into a ShellEvaluationResult.
|
|
13
|
+
*
|
|
14
|
+
* @param shellResult - Raw result from `ShellEvaluator.customEval()`.
|
|
15
|
+
* Expected shape: `{ type: string | null, printable: unknown, source?: { namespace?: {...} } }`
|
|
16
|
+
* @param durationMs - Execution duration in milliseconds.
|
|
17
|
+
*/
|
|
18
|
+
transform(shellResult: ShellResultLike, durationMs: number): ShellEvaluationResult;
|
|
19
|
+
/**
|
|
20
|
+
* Normalize the printable value from @mongosh.
|
|
21
|
+
*
|
|
22
|
+
* @mongosh wraps cursor results differently depending on execution context:
|
|
23
|
+
* - Worker context: `{ cursorHasMore: boolean, documents: unknown[] }`
|
|
24
|
+
* - In-process: `CursorIterationResult` (Array subclass)
|
|
25
|
+
*
|
|
26
|
+
* This normalizes both to a plain array.
|
|
27
|
+
*/
|
|
28
|
+
private normalizePrintable;
|
|
29
|
+
/**
|
|
30
|
+
* Extract the cursorHasMore flag from the raw @mongosh result.
|
|
31
|
+
*
|
|
32
|
+
* @mongosh may deliver cursor results in two forms:
|
|
33
|
+
* - Object: `{ cursorHasMore: boolean, documents: unknown[] }` (from CursorIterationResult.asPrintable)
|
|
34
|
+
* - Array with property: `CursorIterationResult` (Array subclass with `cursorHasMore` as own property)
|
|
35
|
+
*
|
|
36
|
+
* Both are checked. Non-Cursor types always return undefined.
|
|
37
|
+
*/
|
|
38
|
+
private extractCursorHasMore;
|
|
39
|
+
/**
|
|
40
|
+
* Extract source namespace from the @mongosh ShellResult.
|
|
41
|
+
*/
|
|
42
|
+
private extractSource;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Shape of the raw @mongosh ShellResult.
|
|
46
|
+
* Declared as an interface to avoid depending on @mongosh/shell-api types.
|
|
47
|
+
*/
|
|
48
|
+
export interface ShellResultLike {
|
|
49
|
+
readonly type: string | null;
|
|
50
|
+
readonly printable: unknown;
|
|
51
|
+
readonly source?: {
|
|
52
|
+
readonly namespace?: {
|
|
53
|
+
readonly db: string;
|
|
54
|
+
readonly collection: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=ResultTransformer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResultTransformer.d.ts","sourceRoot":"","sources":["../src/ResultTransformer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD;;;;;;;GAOG;AACH,qBAAa,iBAAiB;IAC1B;;;;;;OAMG;IACH,SAAS,CAAC,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,GAAG,qBAAqB;IAclF;;;;;;;;OAQG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;;;;;;;OAQG;IACH,OAAO,CAAC,oBAAoB;IAgB5B;;OAEG;IACH,OAAO,CAAC,aAAa;CAWxB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE;QACd,QAAQ,CAAC,SAAS,CAAC,EAAE;YACjB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;YACpB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;SAC/B,CAAC;KACL,CAAC;CACL"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ResultTransformer = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Transforms raw @mongosh `ShellResult` objects into clean `ShellEvaluationResult` values.
|
|
10
|
+
*
|
|
11
|
+
* Handles:
|
|
12
|
+
* - Cursor result unwrapping (`{ cursorHasMore, documents }` → plain array)
|
|
13
|
+
* - Array subclass normalization (CursorIterationResult → plain Array)
|
|
14
|
+
* - Source namespace extraction
|
|
15
|
+
*/
|
|
16
|
+
class ResultTransformer {
|
|
17
|
+
/**
|
|
18
|
+
* Transform a raw @mongosh ShellResult into a ShellEvaluationResult.
|
|
19
|
+
*
|
|
20
|
+
* @param shellResult - Raw result from `ShellEvaluator.customEval()`.
|
|
21
|
+
* Expected shape: `{ type: string | null, printable: unknown, source?: { namespace?: {...} } }`
|
|
22
|
+
* @param durationMs - Execution duration in milliseconds.
|
|
23
|
+
*/
|
|
24
|
+
transform(shellResult, durationMs) {
|
|
25
|
+
const printable = this.normalizePrintable(shellResult.type, shellResult.printable);
|
|
26
|
+
const cursorHasMore = this.extractCursorHasMore(shellResult.type, shellResult.printable);
|
|
27
|
+
const source = this.extractSource(shellResult.source);
|
|
28
|
+
return {
|
|
29
|
+
type: shellResult.type,
|
|
30
|
+
printable,
|
|
31
|
+
durationMs,
|
|
32
|
+
cursorHasMore,
|
|
33
|
+
source,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Normalize the printable value from @mongosh.
|
|
38
|
+
*
|
|
39
|
+
* @mongosh wraps cursor results differently depending on execution context:
|
|
40
|
+
* - Worker context: `{ cursorHasMore: boolean, documents: unknown[] }`
|
|
41
|
+
* - In-process: `CursorIterationResult` (Array subclass)
|
|
42
|
+
*
|
|
43
|
+
* This normalizes both to a plain array.
|
|
44
|
+
*/
|
|
45
|
+
normalizePrintable(type, printable) {
|
|
46
|
+
// Cursor result wrapped as { cursorHasMore, documents }
|
|
47
|
+
if (type === 'Cursor' &&
|
|
48
|
+
typeof printable === 'object' &&
|
|
49
|
+
printable !== null &&
|
|
50
|
+
'documents' in printable &&
|
|
51
|
+
Array.isArray(printable.documents)) {
|
|
52
|
+
return printable.documents;
|
|
53
|
+
}
|
|
54
|
+
// Array subclass (CursorIterationResult) — normalize to plain Array
|
|
55
|
+
if (Array.isArray(printable)) {
|
|
56
|
+
return Array.from(printable);
|
|
57
|
+
}
|
|
58
|
+
return printable;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Extract the cursorHasMore flag from the raw @mongosh result.
|
|
62
|
+
*
|
|
63
|
+
* @mongosh may deliver cursor results in two forms:
|
|
64
|
+
* - Object: `{ cursorHasMore: boolean, documents: unknown[] }` (from CursorIterationResult.asPrintable)
|
|
65
|
+
* - Array with property: `CursorIterationResult` (Array subclass with `cursorHasMore` as own property)
|
|
66
|
+
*
|
|
67
|
+
* Both are checked. Non-Cursor types always return undefined.
|
|
68
|
+
*/
|
|
69
|
+
extractCursorHasMore(type, printable) {
|
|
70
|
+
if (type !== 'Cursor' || typeof printable !== 'object' || printable === null) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
// Object shape: { cursorHasMore, documents }
|
|
74
|
+
if ('cursorHasMore' in printable &&
|
|
75
|
+
typeof printable.cursorHasMore === 'boolean') {
|
|
76
|
+
return printable.cursorHasMore;
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Extract source namespace from the @mongosh ShellResult.
|
|
82
|
+
*/
|
|
83
|
+
extractSource(source) {
|
|
84
|
+
if (!source?.namespace) {
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
namespace: {
|
|
89
|
+
db: source.namespace.db,
|
|
90
|
+
collection: source.namespace.collection,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.ResultTransformer = ResultTransformer;
|
|
96
|
+
//# sourceMappingURL=ResultTransformer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResultTransformer.js","sourceRoot":"","sources":["../src/ResultTransformer.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAIhG;;;;;;;GAOG;AACH,MAAa,iBAAiB;IAC1B;;;;;;OAMG;IACH,SAAS,CAAC,WAA4B,EAAE,UAAkB;QACtD,MAAM,SAAS,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;QACnF,MAAM,aAAa,GAAG,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;QACzF,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAEtD,OAAO;YACH,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,SAAS;YACT,UAAU;YACV,aAAa;YACb,MAAM;SACT,CAAC;IACN,CAAC;IAED;;;;;;;;OAQG;IACK,kBAAkB,CAAC,IAAmB,EAAE,SAAkB;QAC9D,wDAAwD;QACxD,IACI,IAAI,KAAK,QAAQ;YACjB,OAAO,SAAS,KAAK,QAAQ;YAC7B,SAAS,KAAK,IAAI;YAClB,WAAW,IAAI,SAAS;YACxB,KAAK,CAAC,OAAO,CAAE,SAAqC,CAAC,SAAS,CAAC,EACjE,CAAC;YACC,OAAQ,SAAsC,CAAC,SAAS,CAAC;QAC7D,CAAC;QAED,oEAAoE;QACpE,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3B,OAAO,KAAK,CAAC,IAAI,CAAC,SAAsB,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;IAED;;;;;;;;OAQG;IACK,oBAAoB,CAAC,IAAmB,EAAE,SAAkB;QAChE,IAAI,IAAI,KAAK,QAAQ,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;YAC3E,OAAO,SAAS,CAAC;QACrB,CAAC;QAED,6CAA6C;QAC7C,IACI,eAAe,IAAI,SAAS;YAC5B,OAAQ,SAAwC,CAAC,aAAa,KAAK,SAAS,EAC9E,CAAC;YACC,OAAQ,SAAwC,CAAC,aAAa,CAAC;QACnE,CAAC;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;IAED;;OAEG;IACK,aAAa,CAAC,MAAiC;QACnD,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC;YACrB,OAAO,SAAS,CAAC;QACrB,CAAC;QACD,OAAO;YACH,SAAS,EAAE;gBACP,EAAE,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE;gBACvB,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,UAAU;aAC1C;SACJ,CAAC;IACN,CAAC;CACJ;AA1FD,8CA0FC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResultTransformer.test.d.ts","sourceRoot":"","sources":["../src/ResultTransformer.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const ResultTransformer_1 = require("./ResultTransformer");
|
|
8
|
+
describe('ResultTransformer', () => {
|
|
9
|
+
let transformer;
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
transformer = new ResultTransformer_1.ResultTransformer();
|
|
12
|
+
});
|
|
13
|
+
describe('transform', () => {
|
|
14
|
+
it('passes through simple string results', () => {
|
|
15
|
+
const shellResult = {
|
|
16
|
+
type: 'string',
|
|
17
|
+
printable: 'hello world',
|
|
18
|
+
};
|
|
19
|
+
const result = transformer.transform(shellResult, 42);
|
|
20
|
+
expect(result.type).toBe('string');
|
|
21
|
+
expect(result.printable).toBe('hello world');
|
|
22
|
+
expect(result.durationMs).toBe(42);
|
|
23
|
+
expect(result.source).toBeUndefined();
|
|
24
|
+
});
|
|
25
|
+
it('passes through numeric results', () => {
|
|
26
|
+
const shellResult = {
|
|
27
|
+
type: 'number',
|
|
28
|
+
printable: 123,
|
|
29
|
+
};
|
|
30
|
+
const result = transformer.transform(shellResult, 10);
|
|
31
|
+
expect(result.printable).toBe(123);
|
|
32
|
+
});
|
|
33
|
+
it('passes through object results', () => {
|
|
34
|
+
const doc = { _id: 'abc', name: 'test' };
|
|
35
|
+
const shellResult = {
|
|
36
|
+
type: 'Document',
|
|
37
|
+
printable: doc,
|
|
38
|
+
};
|
|
39
|
+
const result = transformer.transform(shellResult, 10);
|
|
40
|
+
expect(result.printable).toEqual(doc);
|
|
41
|
+
});
|
|
42
|
+
it('passes through null printable', () => {
|
|
43
|
+
const shellResult = {
|
|
44
|
+
type: null,
|
|
45
|
+
printable: null,
|
|
46
|
+
};
|
|
47
|
+
const result = transformer.transform(shellResult, 0);
|
|
48
|
+
expect(result.type).toBeNull();
|
|
49
|
+
expect(result.printable).toBeNull();
|
|
50
|
+
});
|
|
51
|
+
it('extracts source namespace when present', () => {
|
|
52
|
+
const shellResult = {
|
|
53
|
+
type: 'Cursor',
|
|
54
|
+
printable: [],
|
|
55
|
+
source: {
|
|
56
|
+
namespace: {
|
|
57
|
+
db: 'testdb',
|
|
58
|
+
collection: 'users',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
const result = transformer.transform(shellResult, 10);
|
|
63
|
+
expect(result.source).toEqual({
|
|
64
|
+
namespace: { db: 'testdb', collection: 'users' },
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
it('returns undefined source when namespace is absent', () => {
|
|
68
|
+
const shellResult = {
|
|
69
|
+
type: 'string',
|
|
70
|
+
printable: 'hello',
|
|
71
|
+
source: {},
|
|
72
|
+
};
|
|
73
|
+
const result = transformer.transform(shellResult, 10);
|
|
74
|
+
expect(result.source).toBeUndefined();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
describe('cursor result normalization', () => {
|
|
78
|
+
it('unwraps { cursorHasMore, documents } cursor results', () => {
|
|
79
|
+
const docs = [{ _id: 1 }, { _id: 2 }, { _id: 3 }];
|
|
80
|
+
const shellResult = {
|
|
81
|
+
type: 'Cursor',
|
|
82
|
+
printable: { cursorHasMore: false, documents: docs },
|
|
83
|
+
};
|
|
84
|
+
const result = transformer.transform(shellResult, 10);
|
|
85
|
+
expect(result.printable).toEqual(docs);
|
|
86
|
+
expect(Array.isArray(result.printable)).toBe(true);
|
|
87
|
+
});
|
|
88
|
+
it('unwraps cursor result with cursorHasMore: true', () => {
|
|
89
|
+
const docs = [{ _id: 1 }];
|
|
90
|
+
const shellResult = {
|
|
91
|
+
type: 'Cursor',
|
|
92
|
+
printable: { cursorHasMore: true, documents: docs },
|
|
93
|
+
};
|
|
94
|
+
const result = transformer.transform(shellResult, 10);
|
|
95
|
+
expect(result.printable).toEqual(docs);
|
|
96
|
+
});
|
|
97
|
+
it('normalizes Array subclass to plain Array', () => {
|
|
98
|
+
// Simulate CursorIterationResult (Array subclass)
|
|
99
|
+
class CursorIterationResult extends Array {
|
|
100
|
+
}
|
|
101
|
+
const arr = new CursorIterationResult();
|
|
102
|
+
arr.push({ _id: 1 }, { _id: 2 });
|
|
103
|
+
const shellResult = {
|
|
104
|
+
type: 'Cursor',
|
|
105
|
+
printable: arr,
|
|
106
|
+
};
|
|
107
|
+
const result = transformer.transform(shellResult, 10);
|
|
108
|
+
expect(result.printable).toEqual([{ _id: 1 }, { _id: 2 }]);
|
|
109
|
+
expect(Array.isArray(result.printable)).toBe(true);
|
|
110
|
+
// Should be a plain Array, not a CursorIterationResult
|
|
111
|
+
expect(result.printable.constructor).toBe(Array);
|
|
112
|
+
});
|
|
113
|
+
it('normalizes regular arrays to plain Array', () => {
|
|
114
|
+
const shellResult = {
|
|
115
|
+
type: 'Cursor',
|
|
116
|
+
printable: [{ _id: 1 }],
|
|
117
|
+
};
|
|
118
|
+
const result = transformer.transform(shellResult, 10);
|
|
119
|
+
expect(result.printable).toEqual([{ _id: 1 }]);
|
|
120
|
+
});
|
|
121
|
+
it('does not unwrap non-Cursor type even with documents field', () => {
|
|
122
|
+
const shellResult = {
|
|
123
|
+
type: 'Document',
|
|
124
|
+
printable: { documents: [{ _id: 1 }] },
|
|
125
|
+
};
|
|
126
|
+
const result = transformer.transform(shellResult, 10);
|
|
127
|
+
// Should not unwrap because type is not 'Cursor'
|
|
128
|
+
expect(result.printable).toEqual({ documents: [{ _id: 1 }] });
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
describe('cursorHasMore extraction', () => {
|
|
132
|
+
it('extracts cursorHasMore: true from cursor result', () => {
|
|
133
|
+
const shellResult = {
|
|
134
|
+
type: 'Cursor',
|
|
135
|
+
printable: { cursorHasMore: true, documents: [{ _id: 1 }] },
|
|
136
|
+
};
|
|
137
|
+
const result = transformer.transform(shellResult, 10);
|
|
138
|
+
expect(result.cursorHasMore).toBe(true);
|
|
139
|
+
});
|
|
140
|
+
it('extracts cursorHasMore: false from cursor result', () => {
|
|
141
|
+
const shellResult = {
|
|
142
|
+
type: 'Cursor',
|
|
143
|
+
printable: { cursorHasMore: false, documents: [{ _id: 1 }] },
|
|
144
|
+
};
|
|
145
|
+
const result = transformer.transform(shellResult, 10);
|
|
146
|
+
expect(result.cursorHasMore).toBe(false);
|
|
147
|
+
});
|
|
148
|
+
it('returns undefined cursorHasMore for non-Cursor types', () => {
|
|
149
|
+
const shellResult = {
|
|
150
|
+
type: 'Document',
|
|
151
|
+
printable: { name: 'test' },
|
|
152
|
+
};
|
|
153
|
+
const result = transformer.transform(shellResult, 10);
|
|
154
|
+
expect(result.cursorHasMore).toBeUndefined();
|
|
155
|
+
});
|
|
156
|
+
it('returns undefined cursorHasMore for plain array cursor results', () => {
|
|
157
|
+
const shellResult = {
|
|
158
|
+
type: 'Cursor',
|
|
159
|
+
printable: [{ _id: 1 }],
|
|
160
|
+
};
|
|
161
|
+
const result = transformer.transform(shellResult, 10);
|
|
162
|
+
expect(result.cursorHasMore).toBeUndefined();
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
//# sourceMappingURL=ResultTransformer.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResultTransformer.test.js","sourceRoot":"","sources":["../src/ResultTransformer.test.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAEhG,2DAA8E;AAE9E,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAC/B,IAAI,WAA8B,CAAC;IAEnC,UAAU,CAAC,GAAG,EAAE;QACZ,WAAW,GAAG,IAAI,qCAAiB,EAAE,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACvB,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC5C,MAAM,WAAW,GAAoB;gBACjC,IAAI,EAAE,QAAQ;gBACd,SAAS,EAAE,aAAa;aA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AE,EAAE,CAAC,CAAC;YACtD,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,aAAa,EAAE,CAAC;QACjD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;YACtE,MAAM,WAAW,GAAoB;gBACjC,IAAI,EAAE,QAAQ;gBACd,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;aAC1B,CAAC;YACF,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YACtD,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,aAAa,EAAE,CAAC;QACjD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { DocumentDBShellRuntime } from './DocumentDBShellRuntime';
|
|
2
|
+
export { CommandInterceptor } from './CommandInterceptor';
|
|
3
|
+
export { DocumentDBServiceProvider, type ServiceProviderWithBus } from './DocumentDBServiceProvider';
|
|
4
|
+
export { HelpProvider, type HelpSurface } from './HelpProvider';
|
|
5
|
+
export { ResultTransformer, type ShellResultLike } from './ResultTransformer';
|
|
6
|
+
export { type ShellEvalOptions, type ShellEvaluationResult, type ShellRuntimeCallbacks, type ShellRuntimeOptions, } from './types';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,KAAK,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrG,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG9E,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,GAC3B,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ResultTransformer = exports.HelpProvider = exports.DocumentDBServiceProvider = exports.CommandInterceptor = exports.DocumentDBShellRuntime = void 0;
|
|
8
|
+
// Main runtime
|
|
9
|
+
var DocumentDBShellRuntime_1 = require("./DocumentDBShellRuntime");
|
|
10
|
+
Object.defineProperty(exports, "DocumentDBShellRuntime", { enumerable: true, get: function () { return DocumentDBShellRuntime_1.DocumentDBShellRuntime; } });
|
|
11
|
+
// Components (exposed for advanced usage and testing)
|
|
12
|
+
var CommandInterceptor_1 = require("./CommandInterceptor");
|
|
13
|
+
Object.defineProperty(exports, "CommandInterceptor", { enumerable: true, get: function () { return CommandInterceptor_1.CommandInterceptor; } });
|
|
14
|
+
var DocumentDBServiceProvider_1 = require("./DocumentDBServiceProvider");
|
|
15
|
+
Object.defineProperty(exports, "DocumentDBServiceProvider", { enumerable: true, get: function () { return DocumentDBServiceProvider_1.DocumentDBServiceProvider; } });
|
|
16
|
+
var HelpProvider_1 = require("./HelpProvider");
|
|
17
|
+
Object.defineProperty(exports, "HelpProvider", { enumerable: true, get: function () { return HelpProvider_1.HelpProvider; } });
|
|
18
|
+
var ResultTransformer_1 = require("./ResultTransformer");
|
|
19
|
+
Object.defineProperty(exports, "ResultTransformer", { enumerable: true, get: function () { return ResultTransformer_1.ResultTransformer; } });
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,eAAe;AACf,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAE/B,sDAAsD;AACtD,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,yEAAqG;AAA5F,sIAAA,yBAAyB,OAAA;AAClC,+CAAgE;AAAvD,4GAAA,YAAY,OAAA;AACrB,yDAA8E;AAArE,sHAAA,iBAAiB,OAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result of evaluating shell code through the DocumentDB shell runtime.
|
|
3
|
+
*
|
|
4
|
+
* This is the runtime's public result type — protocol-agnostic (no IPC
|
|
5
|
+
* serialization). Consumers that need to send results over IPC
|
|
6
|
+
* (e.g. worker → main thread) are responsible for serialization.
|
|
7
|
+
*/
|
|
8
|
+
export interface ShellEvaluationResult {
|
|
9
|
+
/** The @mongosh result type string (e.g. 'Cursor', 'Document', 'string', 'Help'). */
|
|
10
|
+
readonly type: string | null;
|
|
11
|
+
/** The printable result value — cursors already iterated, arrays normalized. */
|
|
12
|
+
readonly printable: unknown;
|
|
13
|
+
/** Execution duration in milliseconds. */
|
|
14
|
+
readonly durationMs: number;
|
|
15
|
+
/** Whether the cursor has more documents beyond the returned batch (only set for Cursor results). */
|
|
16
|
+
readonly cursorHasMore?: boolean;
|
|
17
|
+
/** Source namespace from the @mongosh ShellResult, if available. */
|
|
18
|
+
readonly source?: {
|
|
19
|
+
readonly namespace?: {
|
|
20
|
+
readonly db: string;
|
|
21
|
+
readonly collection: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Callbacks for runtime events. The runtime is environment-agnostic —
|
|
27
|
+
* it uses callbacks instead of directly calling VS Code APIs or postMessage.
|
|
28
|
+
*/
|
|
29
|
+
export interface ShellRuntimeCallbacks {
|
|
30
|
+
/** Called when user code produces console output (console.log, print, printjson). */
|
|
31
|
+
onConsoleOutput?: (output: string) => void;
|
|
32
|
+
/** Called for internal log messages from the runtime. */
|
|
33
|
+
onLog?: (level: 'trace' | 'debug' | 'info' | 'warn' | 'error', message: string) => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Configuration options for the shell runtime.
|
|
37
|
+
*/
|
|
38
|
+
export interface ShellRuntimeOptions {
|
|
39
|
+
/** Product name passed to @mongosh service provider. */
|
|
40
|
+
productName?: string;
|
|
41
|
+
/** Product documentation link passed to @mongosh service provider. */
|
|
42
|
+
productDocsLink?: string;
|
|
43
|
+
/** Default number of documents to display per cursor iteration (default: 50). */
|
|
44
|
+
displayBatchSize?: number;
|
|
45
|
+
/**
|
|
46
|
+
* When `true`, the runtime keeps the @mongosh `ShellInstanceState`,
|
|
47
|
+
* `ShellEvaluator`, and `vm.Context` alive across `evaluate()` calls.
|
|
48
|
+
* Variables, cursor state, and the `db` reference persist between evaluations.
|
|
49
|
+
*
|
|
50
|
+
* When `false` (default), a fresh context is created per `evaluate()` call —
|
|
51
|
+
* no variable leakage between runs.
|
|
52
|
+
*
|
|
53
|
+
* The interactive shell uses `persistent: true`; the query playground uses `false`.
|
|
54
|
+
*/
|
|
55
|
+
persistent?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Per-evaluation options that can override runtime defaults.
|
|
59
|
+
* Used to pass current user settings at eval time (F2: read per-eval).
|
|
60
|
+
*/
|
|
61
|
+
export interface ShellEvalOptions {
|
|
62
|
+
/** Override the display batch size for this evaluation. */
|
|
63
|
+
displayBatchSize?: number;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;gGAGgG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@documentdb-js/shell-runtime",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Sandboxed JavaScript evaluation engine for DocumentDB — shell command handling, result transformation, and help generation",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc -p .",
|
|
12
|
+
"clean": "rimraf dist tsconfig.tsbuildinfo",
|
|
13
|
+
"test": "jest --config jest.config.js",
|
|
14
|
+
"prettier-fix": "prettier -w \"src/**/*.@(js|ts|jsx|tsx|json|md)\" \"./*.@(js|ts|jsx|tsx|json|md)\""
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/microsoft/vscode-documentdb",
|
|
19
|
+
"directory": "packages/documentdb-js-shell-runtime"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"mongodb": ">=6.0.0"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@mongosh/service-provider-node-driver": "^5.0.6",
|
|
27
|
+
"@mongosh/shell-api": "^5.1.4",
|
|
28
|
+
"@mongosh/shell-evaluator": "^5.1.4"
|
|
29
|
+
}
|
|
30
|
+
}
|