Skip to content

Commit b2282cd

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

File tree

8 files changed

+365
-250
lines changed

8 files changed

+365
-250
lines changed

package-lock.json

Lines changed: 36 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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,22 @@
5656
"@mongodb-js/ts-autocomplete": "^0.3.3",
5757
"mongodb-schema": "^12.6.2",
5858
"node-cache": "^5.1.2",
59-
"typescript": "^5.0.4"
59+
"typescript": "^5.0.4",
60+
"debug": "^4.4.0"
6061
},
6162
"devDependencies": {
6263
"@mongodb-js/eslint-config-devtools": "0.9.11",
6364
"@mongodb-js/mocha-config-devtools": "^1.0.5",
6465
"@mongodb-js/prettier-config-devtools": "^1.0.2",
6566
"@mongodb-js/tsconfig-devtools": "^1.0.3",
66-
"@mongosh/shell-api": "^3.13.0",
67+
"@mongodb-js/mql-typescript": "^0.2.3",
68+
"@mongosh/shell-api": "^3.16.2",
6769
"@types/chai": "^4.2.21",
6870
"@types/mocha": "^9.1.1",
6971
"@types/node": "^22.15.30",
7072
"@types/sinon-chai": "^3.2.5",
7173
"bson": "^6.10.3",
74+
"mongodb": "^6.9.0",
7275
"chai": "^4.5.0",
7376
"depcheck": "^1.4.7",
7477
"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)