@dudousxd/nestjs-codegen 0.9.0 → 0.10.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
@@ -4628,7 +4628,7 @@ function createChainModuleRenderer(opts) {
4628
4628
  }
4629
4629
 
4630
4630
  // src/index.ts
4631
- var VERSION = "0.9.0";
4631
+ var VERSION = "0.10.0";
4632
4632
  // Annotate the CommonJS export names for ESM import in node:
4633
4633
  0 && (module.exports = {
4634
4634
  CodegenError,