@dudousxd/nestjs-codegen 0.5.2 → 0.6.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/CHANGELOG.md +8 -0
- package/dist/cli/main.cjs +17 -2
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.js +17 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/index.cjs +17 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/dist/nest/index.cjs +16 -1
- package/dist/nest/index.cjs.map +1 -1
- package/dist/nest/index.js +16 -1
- package/dist/nest/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @dudousxd/nestjs-codegen
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ece130c: Fix: resolve `@Filterable({ entity })` entities imported from external npm packages so the route is still classified as a filter route. Previously, when a filter's entity (e.g. a MikroORM entity from `@dudousxd/nestjs-durable-store-mikro-orm`) was imported from `node_modules` rather than an in-repo `*.entity.ts`, the discovery type resolver returned no candidates for the bare module specifier and bailed — degrading the route to a plain bodyless route (`body: never; filterFields: never`, no `queryOptions`) and breaking the generated client (`x.queryOptions is not a function`).
|
|
8
|
+
|
|
9
|
+
The type resolver now falls back to the TypeScript compiler's own module resolution (`getModuleSpecifierSourceFile()`) for bare node_modules specifiers, locating the package's `.d.ts` declaration file and enumerating the entity's columns from it. External-package filter entities now get the same full `filterFields` union + `body: FilterQueryResult` + TanStack `queryOptions` helper as in-repo entities.
|
|
10
|
+
|
|
3
11
|
## 0.5.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/cli/main.cjs
CHANGED
|
@@ -2270,7 +2270,6 @@ function resolveImportedType(name, sourceFile, project) {
|
|
|
2270
2270
|
if (!namedImport) continue;
|
|
2271
2271
|
const moduleSpecifier = importDecl.getModuleSpecifierValue();
|
|
2272
2272
|
const candidates = resolveModuleSpecifier(moduleSpecifier, sourceFile, project);
|
|
2273
|
-
if (candidates.length === 0) continue;
|
|
2274
2273
|
for (const candidate of candidates) {
|
|
2275
2274
|
let importedFile = project.getSourceFile(candidate);
|
|
2276
2275
|
if (!importedFile) {
|
|
@@ -2285,9 +2284,25 @@ function resolveImportedType(name, sourceFile, project) {
|
|
|
2285
2284
|
const viaReExport = resolveReExportedType(name, importedFile, project, /* @__PURE__ */ new Set());
|
|
2286
2285
|
if (viaReExport) return viaReExport;
|
|
2287
2286
|
}
|
|
2287
|
+
if (candidates.length === 0) {
|
|
2288
|
+
const viaCompiler = resolveBareSpecifierType(name, importDecl, project);
|
|
2289
|
+
if (viaCompiler) return viaCompiler;
|
|
2290
|
+
}
|
|
2288
2291
|
}
|
|
2289
2292
|
return resolveReExportedType(name, sourceFile, project, /* @__PURE__ */ new Set());
|
|
2290
2293
|
}
|
|
2294
|
+
function resolveBareSpecifierType(name, importDecl, project) {
|
|
2295
|
+
let target;
|
|
2296
|
+
try {
|
|
2297
|
+
target = importDecl.getModuleSpecifierSourceFile();
|
|
2298
|
+
} catch {
|
|
2299
|
+
return null;
|
|
2300
|
+
}
|
|
2301
|
+
if (!target) return null;
|
|
2302
|
+
const direct = findTypeInFile(name, target);
|
|
2303
|
+
if (direct) return direct;
|
|
2304
|
+
return resolveReExportedType(name, target, project, /* @__PURE__ */ new Set());
|
|
2305
|
+
}
|
|
2291
2306
|
function resolveReExportedType(name, file, project, seen) {
|
|
2292
2307
|
const filePath = file.getFilePath();
|
|
2293
2308
|
if (seen.has(filePath)) return null;
|
|
@@ -4448,7 +4463,7 @@ async function watch(config, onChange) {
|
|
|
4448
4463
|
}
|
|
4449
4464
|
|
|
4450
4465
|
// src/index.ts
|
|
4451
|
-
var VERSION = "0.
|
|
4466
|
+
var VERSION = "0.6.0";
|
|
4452
4467
|
|
|
4453
4468
|
// src/cli/codegen.ts
|
|
4454
4469
|
async function runCodegen(opts = {}) {
|