@dudousxd/nestjs-codegen 0.9.0 → 0.11.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.
@@ -1,2 +1,2 @@
1
- export { m as ApiClientLayer, n as ApiHeaderContribution, o as ApiModuleDeps, C as CodegenExtension, p as EmittedFile, E as ExtensionContext, L as LeafModel, q as RequestModel, s as RequestShape, t as defineExtension, u as requestShape } from '../index-SJc0gya_.cjs';
1
+ export { m as ApiClientLayer, n as ApiHeaderContribution, o as ApiModuleDeps, C as CodegenExtension, p as EmittedFile, E as ExtensionContext, L as LeafModel, q as RequestModel, s as RequestShape, t as defineExtension, u as requestShape } from '../index-CxkGbILp.cjs';
2
2
  import 'ts-morph';
@@ -1,2 +1,2 @@
1
- export { m as ApiClientLayer, n as ApiHeaderContribution, o as ApiModuleDeps, C as CodegenExtension, p as EmittedFile, E as ExtensionContext, L as LeafModel, q as RequestModel, s as RequestShape, t as defineExtension, u as requestShape } from '../index-SJc0gya_.js';
1
+ export { m as ApiClientLayer, n as ApiHeaderContribution, o as ApiModuleDeps, C as CodegenExtension, p as EmittedFile, E as ExtensionContext, L as LeafModel, q as RequestModel, s as RequestShape, t as defineExtension, u as requestShape } from '../index-CxkGbILp.js';
2
2
  import 'ts-morph';
@@ -189,19 +189,29 @@ interface ValidationAdapter {
189
189
  inferType(schemaConst: string): string;
190
190
  }
191
191
 
192
- /** A built-in adapter name or a custom adapter instance. */
193
- type ValidationOption = 'zod' | 'valibot' | 'arktype' | ValidationAdapter;
192
+ /**
193
+ * A validation adapter instance. No adapter is bundled in core — import one from
194
+ * its own package (`zodAdapter`/`valibotAdapter`/`arktypeAdapter`) or pass a custom
195
+ * object. String shortcuts (`'zod'` etc.) are intentionally not part of this type:
196
+ * they always threw at runtime, so the type guides you to an imported instance.
197
+ */
198
+ type ValidationOption = ValidationAdapter;
194
199
  /**
195
200
  * Resolve a `validation` config value to a {@link ValidationAdapter}. No adapter is
196
201
  * bundled in core — the zod/valibot/arktype adapters ship as their own packages.
197
202
  * Import the adapter instance and pass it directly (it passes through here). A
198
203
  * custom adapter object also passes through.
199
204
  *
205
+ * The parameter also accepts a `string` so the runtime guard still fires for JS
206
+ * callers / untyped configs that pass a removed string shortcut (e.g. `'zod'`):
207
+ * those throw a helpful error pointing at the adapter package. TypeScript users
208
+ * are steered away from strings by the narrowed {@link ValidationOption} type.
209
+ *
200
210
  * @example
201
211
  * import { zodAdapter } from '@dudousxd/nestjs-codegen-zod';
202
212
  * defineConfig({ validation: zodAdapter });
203
213
  */
204
- declare function resolveAdapter(option: ValidationOption): ValidationAdapter;
214
+ declare function resolveAdapter(option: ValidationOption | string): ValidationAdapter;
205
215
 
206
216
  interface UserConfig {
207
217
  /**
@@ -189,19 +189,29 @@ interface ValidationAdapter {
189
189
  inferType(schemaConst: string): string;
190
190
  }
191
191
 
192
- /** A built-in adapter name or a custom adapter instance. */
193
- type ValidationOption = 'zod' | 'valibot' | 'arktype' | ValidationAdapter;
192
+ /**
193
+ * A validation adapter instance. No adapter is bundled in core — import one from
194
+ * its own package (`zodAdapter`/`valibotAdapter`/`arktypeAdapter`) or pass a custom
195
+ * object. String shortcuts (`'zod'` etc.) are intentionally not part of this type:
196
+ * they always threw at runtime, so the type guides you to an imported instance.
197
+ */
198
+ type ValidationOption = ValidationAdapter;
194
199
  /**
195
200
  * Resolve a `validation` config value to a {@link ValidationAdapter}. No adapter is
196
201
  * bundled in core — the zod/valibot/arktype adapters ship as their own packages.
197
202
  * Import the adapter instance and pass it directly (it passes through here). A
198
203
  * custom adapter object also passes through.
199
204
  *
205
+ * The parameter also accepts a `string` so the runtime guard still fires for JS
206
+ * callers / untyped configs that pass a removed string shortcut (e.g. `'zod'`):
207
+ * those throw a helpful error pointing at the adapter package. TypeScript users
208
+ * are steered away from strings by the narrowed {@link ValidationOption} type.
209
+ *
200
210
  * @example
201
211
  * import { zodAdapter } from '@dudousxd/nestjs-codegen-zod';
202
212
  * defineConfig({ validation: zodAdapter });
203
213
  */
204
- declare function resolveAdapter(option: ValidationOption): ValidationAdapter;
214
+ declare function resolveAdapter(option: ValidationOption | string): ValidationAdapter;
205
215
 
206
216
  interface UserConfig {
207
217
  /**
package/dist/index.cjs CHANGED
@@ -863,7 +863,11 @@ function buildRequestModel(c) {
863
863
  urlExpr,
864
864
  optsExpr,
865
865
  responseType: `${TA}['response']`,
866
- queryKeyExpr: `[${flat}, input] as const`
866
+ // When no input is supplied the key omits the trailing element entirely
867
+ // (`[name]` rather than `[name, undefined]`) so the bare `.queryKey()` is a
868
+ // clean prefix that partial-matches every parametrized variant — making it
869
+ // directly usable for `invalidateQueries`.
870
+ queryKeyExpr: `(input === undefined ? [${flat}] as const : [${flat}, input] as const)`
867
871
  };
868
872
  }
869
873
  function renderFetcherRequest(req) {
@@ -4628,7 +4632,7 @@ function createChainModuleRenderer(opts) {
4628
4632
  }
4629
4633
 
4630
4634
  // src/index.ts
4631
- var VERSION = "0.9.0";
4635
+ var VERSION = "0.11.0";
4632
4636
  // Annotate the CommonJS export names for ESM import in node:
4633
4637
  0 && (module.exports = {
4634
4638
  CodegenError,