Skip to content

Commit 54c9a9e

Browse files
committed
bypass pulling the schema field from C['schema']
1 parent ee6fd50 commit 54c9a9e

File tree

8 files changed

+357
-250
lines changed

8 files changed

+357
-250
lines changed

package-lock.json

Lines changed: 34 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/mongodb-ts-autocomplete/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@
6363
"@mongodb-js/mocha-config-devtools": "^1.0.5",
6464
"@mongodb-js/prettier-config-devtools": "^1.0.2",
6565
"@mongodb-js/tsconfig-devtools": "^1.0.3",
66-
"@mongosh/shell-api": "^3.13.0",
66+
"@mongodb-js/mql-typescript": "^0.2.3",
67+
"@mongosh/shell-api": "^3.16.1",
6768
"@types/chai": "^4.2.21",
6869
"@types/mocha": "^9.1.1",
6970
"@types/node": "^22.15.30",
7071
"@types/sinon-chai": "^3.2.5",
7172
"bson": "^6.10.3",
73+
"mongodb": "^6.9.0",
7274
"chai": "^4.5.0",
7375
"depcheck": "^1.4.7",
7476
"eslint": "^7.25.0",

packages/mongodb-ts-autocomplete/scripts/extract-types.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,28 @@ async function loadSources(sources: Record<string, string>) {
1515

1616
async function run() {
1717
const input: Record<string, string> = {
18+
// mql imports bson but right now so does shell-api. We could bake the types
19+
// those use into the files we generate using api-extractor, but maybe
20+
// including it just once is not so bad.
1821
'/bson.ts': path.join(require.resolve('bson'), '..', '..', 'bson.d.ts'),
19-
'/mql.ts': path.join(__dirname, '..', 'src', 'fixtures', 'mql.ts'),
22+
// mql imports the mongodb driver. We could also use api-extrctor there to
23+
// bake the few mongodb types we use into the schema.
24+
'/mongodb.ts': path.join(
25+
require.resolve('mongodb'),
26+
'..',
27+
'..',
28+
'mongodb.d.ts',
29+
),
30+
// We wouldn't have to include mql if we used it straight from shell-api,
31+
// but since we're using it straight here for now to bypass the complicated
32+
// generics on the shell-api side it is included here for now.
33+
'/mql.ts': path.join(
34+
require.resolve('@mongodb-js/mql-typescript'),
35+
'..',
36+
'..',
37+
'out',
38+
'schema.d.ts',
39+
),
2040
};
2141
const files = await loadSources(input);
2242
const code = `

0 commit comments

Comments
 (0)