@tommasomeli/prisma-generator-nestjs-dto 0.1.3

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.
@@ -0,0 +1,562 @@
1
+ import { GeneratorOptions as GeneratorOptions$1 } from '@prisma/generator-helper';
2
+
3
+ type NamingStrategy = 'camel' | 'snake' | 'kebab';
4
+ type OutputType = 'class' | 'interface';
5
+ type OutputStructure = 'nestjs' | 'flat';
6
+ type File = {
7
+ path: string;
8
+ content: string;
9
+ };
10
+ type Annotation = {
11
+ name: string;
12
+ params: any;
13
+ };
14
+ /**
15
+ * Pipeline-internal field representation. Mirrors the relevant subset of
16
+ * `DMMF.Field` plus parsed annotations. We deliberately do not extend the
17
+ * Prisma DMMF type because newer versions are deeply readonly and that
18
+ * conflicts with the mutation patterns of sub-generators.
19
+ */
20
+ type Field = {
21
+ name: string;
22
+ type: string;
23
+ kind?: 'scalar' | 'object' | 'enum' | 'unsupported';
24
+ isList: boolean;
25
+ isRequired: boolean;
26
+ isUnique: boolean;
27
+ isId: boolean;
28
+ isReadOnly: boolean;
29
+ isGenerated?: boolean;
30
+ isUpdatedAt?: boolean;
31
+ hasDefaultValue: boolean;
32
+ default?: any;
33
+ relationName?: string;
34
+ relationFromFields?: readonly string[] | string[];
35
+ relationToFields?: readonly string[] | string[];
36
+ relationOnDelete?: string;
37
+ documentation?: string | null;
38
+ annotations: Annotation[];
39
+ isNullable?: boolean;
40
+ };
41
+ /** Pipeline-internal model representation. See `Field` for rationale. */
42
+ type Model = {
43
+ name: string;
44
+ dbName?: string | null;
45
+ fields: Field[];
46
+ documentation?: string | null;
47
+ primaryKey?: any;
48
+ uniqueFields?: readonly (readonly string[])[] | string[][];
49
+ uniqueIndexes?: any;
50
+ isGenerated?: boolean;
51
+ annotations: Annotation[];
52
+ outputType?: OutputType;
53
+ };
54
+ /**
55
+ * Override descriptor for a single Prisma scalar (`String`, `Int`, `Decimal`, ...).
56
+ * Applied by the built-in DTO generators when rendering field types, Swagger
57
+ * `@ApiProperty({ type })`, and Swagger `format`. `from` is automatically emitted
58
+ * as a top-level import in every file that references the overridden type.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * extraScalars: {
63
+ * Decimal: { ts: 'Decimal', from: 'decimal.js' },
64
+ * Json: { ts: 'MyJson', from: 'src/json', apiType: 'Object' }
65
+ * }
66
+ * ```
67
+ */
68
+ type ScalarOverride = {
69
+ /** TypeScript type used in field declarations (`field: ts;`). */
70
+ ts: string;
71
+ /** Module specifier the `ts` symbol is imported from. Omit for ambient/global types. */
72
+ from?: string;
73
+ /** TypeScript expression used in `@ApiProperty({ type: ... })`. Defaults to `ts`. */
74
+ apiType?: string;
75
+ /** Value passed to `@ApiProperty({ format })`. Omit to inherit / drop the default. */
76
+ format?: string;
77
+ };
78
+ /** Enriched config exposed to sub-generators after parsing the raw Prisma config. */
79
+ type GeneratorConfig = {
80
+ provider: string;
81
+ output: string;
82
+ outputType: OutputType;
83
+ outputStructure: OutputStructure;
84
+ reExport: boolean;
85
+ fileNamingStrategy: NamingStrategy;
86
+ classValidator: boolean;
87
+ swaggerDocs: boolean;
88
+ prettier: boolean;
89
+ schemaDir?: string;
90
+ emitManifest: boolean;
91
+ extraDecorators: ImportType[];
92
+ extraValidators: ImportType[];
93
+ extraImports: ImportType[];
94
+ extraGenerators?: string | string[];
95
+ /** Prisma scalar overrides (TS type + optional import + optional Swagger metadata). */
96
+ extraScalars: Record<string, ScalarOverride>;
97
+ /**
98
+ * Names of user-defined annotations that custom sub-generators want to react to.
99
+ * The base parser still emits any `@Name` it finds in `///` comments, so registering
100
+ * an annotation here is documentation-and-discovery (e.g. for plugins to iterate over).
101
+ */
102
+ extraAnnotations: string[];
103
+ };
104
+ /**
105
+ * Type passed to `BaseGenerator` and to the `generate()` entry point. We keep
106
+ * it identical to Prisma's `GeneratorOptions` so consumers can pass DMMF results
107
+ * directly without casts.
108
+ */
109
+ type GeneratorOptions = GeneratorOptions$1;
110
+ interface ImportType {
111
+ from: string;
112
+ alias?: string;
113
+ destruct?: string[];
114
+ }
115
+ /** Raw map representation of `options.generator.config` as produced by Prisma. */
116
+ type RawGeneratorConfig = Record<string, string | string[] | undefined>;
117
+ /**
118
+ * Type-safe descriptor for an external module import. Equivalent to writing the import
119
+ * statement as a string but enforced by TypeScript: misspelled names and missing paths
120
+ * become compile-time errors when used together with the {@link fromModule} helper.
121
+ */
122
+ type ImportDescriptor = {
123
+ from: string;
124
+ names?: readonly (string | {
125
+ name: string;
126
+ as: string;
127
+ })[];
128
+ default?: string;
129
+ namespace?: string;
130
+ };
131
+ /**
132
+ * Accepted forms for any `extra*` field in {@link GeneratorConfigFile}. Lets users pick
133
+ * between the compact inline syntax (`"Name:path|Other:path2"`), the structured
134
+ * {@link ImportDescriptor} shape, and the type-safe `from()` / `fromNamespace()` /
135
+ * `fromDefault()` helpers (which return descriptors).
136
+ */
137
+ type ExtraImportConfig = string | string[] | ImportDescriptor | ImportDescriptor[];
138
+ /**
139
+ * Shape of the object returned by an external configuration file referenced from
140
+ * `schema.prisma` via the `configFile` option. Every field is optional and overrides
141
+ * the value declared in the schema.
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * import { from, fromNamespace, type GeneratorConfigFile } from '@tommasomeli/prisma-generator-nestjs-dto';
146
+ *
147
+ * export default {
148
+ * extraValidators: from(() => import('src/common/validators'), ['IsUnique', 'IsStrongPassword']),
149
+ * extraImports: [
150
+ * fromNamespace('src/common/constants', 'CONSTANTS'),
151
+ * from('src/users/user.fixtures', 'USER_EXAMPLE')
152
+ * ]
153
+ * } satisfies GeneratorConfigFile;
154
+ * ```
155
+ */
156
+ type GeneratorConfigFile = {
157
+ outputType?: OutputType;
158
+ outputStructure?: OutputStructure;
159
+ reExport?: boolean;
160
+ fileNamingStrategy?: NamingStrategy;
161
+ classValidator?: boolean;
162
+ swaggerDocs?: boolean;
163
+ prettier?: boolean;
164
+ schemaDir?: string;
165
+ emitManifest?: boolean;
166
+ extraDecorators?: ExtraImportConfig;
167
+ extraValidators?: ExtraImportConfig;
168
+ extraImports?: ExtraImportConfig;
169
+ extraGenerators?: ExtraImportConfig;
170
+ /**
171
+ * Per-scalar overrides. The key is the Prisma scalar name (`'Decimal'`, `'Json'`, ...);
172
+ * the value is a {@link ScalarOverride} describing the TS type, optional import, and
173
+ * optional Swagger metadata. Only available from the external `configFile` since the
174
+ * `schema.prisma` generator block cannot express nested objects.
175
+ */
176
+ extraScalars?: Record<string, ScalarOverride>;
177
+ /**
178
+ * Custom annotation names that downstream sub-generators recognise. Plain strings
179
+ * (one or many) — no imports needed, since annotations live in Prisma `///` comments.
180
+ * Consumed by plugins via `BaseGenerator.getAnnotation(field, name)` /
181
+ * `BaseGenerator.hasAnnotation(field, name)`, or via the exposed `config.extraAnnotations`.
182
+ */
183
+ extraAnnotations?: string | string[];
184
+ };
185
+
186
+ declare const DTO_IGNORE_MODEL = "DtoIgnoreModel";
187
+ declare const DTO_API_EXTRA_MODELS = "DtoApiExtraModels";
188
+ declare const DTO_READ_ONLY = "DtoReadOnly";
189
+ declare const DTO_CREATE_HIDDEN = "DtoCreateHidden";
190
+ declare const DTO_UPDATE_HIDDEN = "DtoUpdateHidden";
191
+ declare const DTO_ENTITY_HIDDEN = "DtoEntityHidden";
192
+ declare const DTO_API_HIDDEN = "DtoApiHidden";
193
+ declare const DTO_HIDDEN = "DtoHidden";
194
+ declare const DTO_CREATED_AT = "createdAt";
195
+ declare const DTO_CREATE_OPTIONAL = "DtoCreateOptional";
196
+ declare const DTO_CREATE_REQUIRED = "DtoCreateRequired";
197
+ declare const DTO_UPDATE_OPTIONAL = "DtoUpdateOptional";
198
+ declare const DTO_UPDATE_REQUIRED = "DtoUpdateRequired";
199
+ declare const DTO_OVERRIDE_TYPE = "DtoOverrideType";
200
+ declare const DTO_OVERRIDE_API_PROPERTY_TYPE = "DtoOverrideApiPropertyType";
201
+ declare const DTO_CREATE_VALIDATE_IF = "DtoCreateValidateIf";
202
+ declare const DTO_UPDATE_VALIDATE_IF = "DtoUpdateValidateIf";
203
+ /** Annotations that hide a field from the Entity DTO surface (and therefore from API responses). */
204
+ declare const ENTITY_HIDDEN_ANNOTATIONS: string[];
205
+ /** Accepts both parsed annotations and raw `documentation` strings (used pre-pipeline). */
206
+ declare function isEntityHidden(field: {
207
+ annotations?: Annotation[];
208
+ documentation?: string | null;
209
+ }): boolean;
210
+
211
+ /**
212
+ * Base class for every sub-generator. Concrete generators describe how their files
213
+ * are named (prefix/suffix) and contribute a `generate()` that yields `File[]`.
214
+ * Subclasses normally only override `generate()` and rely on `getTemplate()` to
215
+ * render the class body (imports, decorators, validators, field declarations).
216
+ */
217
+ declare abstract class BaseGenerator {
218
+ protected options: GeneratorOptions;
219
+ protected config: GeneratorConfig;
220
+ models: Model[];
221
+ constructor(options: GeneratorOptions);
222
+ abstract filePrefix: string;
223
+ abstract fileSuffix: string;
224
+ abstract classPrefix: string;
225
+ abstract classSuffix: string;
226
+ /** Produces the list of files this generator wants to emit. */
227
+ abstract generate(): Promise<File[]>;
228
+ /**
229
+ * Optional pre-pass invoked once before any built-in or plugin `generate()` runs.
230
+ * Receives the **shared** `Model[]` array (already filtered for `@DtoIgnoreModel`);
231
+ * mutating it (e.g. injecting synthetic fields, rewriting annotations) is supported
232
+ * and visible to every generator that runs afterwards. Defaults to no-op.
233
+ */
234
+ beforeAll(_models: Model[]): Promise<void>;
235
+ /**
236
+ * Optional post-pass invoked once after every generator's `generate()` completes,
237
+ * receiving the **complete** list of files produced in the run (built-ins + plugins).
238
+ * Return a non-empty `File[]` to append extra files (e.g. an aggregated barrel,
239
+ * audit report, schema export); return `void` to leave the run untouched. Defaults to no-op.
240
+ */
241
+ afterAll(_files: File[]): Promise<File[] | void>;
242
+ /**
243
+ * Reads `@ignore` fields from `.prisma` files inside `schemaDir`. Prisma
244
+ * strips ignored fields from the DMMF but we still want them visible to
245
+ * annotations like `@DtoApiHidden`, so we re-parse the raw schema.
246
+ */
247
+ private getIgnoredFields;
248
+ /** Parses `/// @Foo(arg, {object})` documentation strings into structured annotations. */
249
+ private extractAnnotations;
250
+ /**
251
+ * Returns the first annotation matching `name` on a field or model, or `undefined`.
252
+ * Use from custom sub-generators to react to user-defined annotations declared via
253
+ * `extraAnnotations` (or any built-in `@Dto*` name).
254
+ */
255
+ getAnnotation(target: {
256
+ annotations: Annotation[];
257
+ }, name: string): Annotation | undefined;
258
+ /** Convenience boolean form of {@link getAnnotation}. */
259
+ hasAnnotation(target: {
260
+ annotations: Annotation[];
261
+ }, name: string): boolean;
262
+ /**
263
+ * Adds (and merges) an import descriptor into an `ImportType[]` array, honouring
264
+ * the same dedup/merge rules used by the built-in pipeline. Repeated calls with
265
+ * the same `from` collapse named imports together; `alias` entries are stored
266
+ * separately from `destruct` entries on the same path.
267
+ */
268
+ protected addImport(imports: ImportType[], next: ImportType): void;
269
+ /**
270
+ * Renders an `ImportType[]` array as a multi-line `import ... from '...'` block.
271
+ * Absolute paths (e.g. produced by `getPath(relatedModel, outputPath)`) are rewritten
272
+ * as POSIX-style relative paths anchored at `outputPath`; TypeScript file extensions
273
+ * (`.ts` / `.mts` / `.cts` / `.tsx`) on the `from` path are stripped automatically
274
+ * since they are never desired in import statements.
275
+ */
276
+ protected formatImports(imports: ImportType[], outputPath?: string): string;
277
+ /**
278
+ * Returns the output path of a `model` formatted for use as an `import` specifier:
279
+ * same as {@link getPath} but with the TypeScript file extension stripped and a
280
+ * `./` prefix added when the result would otherwise look like a bare module specifier
281
+ * (`flat` outputStructure case). Use this when a custom sub-generator needs to
282
+ * reference a peer-generated file (e.g. for relations between models) and you would
283
+ * otherwise hand-strip `.ts` from `getPath`.
284
+ */
285
+ protected getImportPath(model: Model, fromOutputPath?: string): string;
286
+ /** Strips `.ts` / `.mts` / `.cts` / `.tsx` suffixes from an `import` specifier. */
287
+ private stripTsExtension;
288
+ /** File / class name transformer. Defaults to camelCase. */
289
+ protected getModelName(name: string): string;
290
+ /**
291
+ * Applies `@DtoOverrideType(<type>)` non-destructively. The original `model`
292
+ * is left untouched; callers receive a model with cloned fields whose `kind`
293
+ * and `type` reflect the override.
294
+ */
295
+ private applyOverrides;
296
+ /**
297
+ * Merges a new `ImportType` into the existing array. Distinct concerns are kept
298
+ * as separate entries (i.e. an `alias` import and a `destruct` import from the
299
+ * same path will not collide).
300
+ */
301
+ private mergeImport;
302
+ /** Collects every import the rendered class will need. */
303
+ private getImports;
304
+ /**
305
+ * Resolves an import `from` value for the file being emitted. Absolute paths
306
+ * (typically produced when a relative `from` was declared in the external config file)
307
+ * are rewritten as POSIX-style relative paths anchored at the output file's directory.
308
+ */
309
+ private rewriteImportPath;
310
+ /** Renders the `import ... from ...` block. */
311
+ private getImportsTemplate;
312
+ /**
313
+ * Renders the full class body (imports + class declaration with decorators and fields).
314
+ * Sub-generators usually feed it a `model` they already pre-filtered.
315
+ */
316
+ getTemplate(args: {
317
+ model: Model;
318
+ classValidator?: boolean;
319
+ swaggerDocs?: boolean;
320
+ outputPath?: string;
321
+ }): string;
322
+ /** Returns the absolute (or relative-to-`relativeFrom`) output path for `model`. */
323
+ getPath(model: Model, relativeFrom?: string): string;
324
+ }
325
+
326
+ /**
327
+ * Result of {@link loadConfigFile}: the parsed configuration object and the absolute
328
+ * directory of the file it came from. The directory is used downstream to resolve
329
+ * relative `from` paths declared inside the config file.
330
+ */
331
+ type LoadedConfigFile = {
332
+ config: GeneratorConfigFile;
333
+ dir: string;
334
+ file: string;
335
+ };
336
+ /**
337
+ * Loads the configuration object referenced by `configFile`. Returns `null` when the
338
+ * option is unset or the file fails to load; all error paths are logged and non-fatal
339
+ * so misconfigurations never crash `prisma generate`.
340
+ */
341
+ declare function loadConfigFile(options: GeneratorOptions): Promise<LoadedConfigFile | null>;
342
+ /**
343
+ * Serializes an {@link ImportDescriptor} into the inline `Name:path` syntax that
344
+ * {@link Utility.parseImports} consumes downstream. Default + named combinations become
345
+ * two `|`-joined groups (`default as Foo:path|Bar,Baz:path`); rename aliases collapse to
346
+ * the local name since the generator only uses local names for annotation matching and
347
+ * destruct emission. When `configFileDir` is provided, relative paths are resolved
348
+ * against it so the resulting absolute path can later be rewritten per output file.
349
+ */
350
+ declare function descriptorToImportStatement(descriptor: ImportDescriptor, configFileDir?: string): string;
351
+ /**
352
+ * Merges a {@link GeneratorConfigFile} on top of the raw schema config. Values from the
353
+ * config file override schema values for the keys it declares; everything else passes
354
+ * through untouched. {@link ImportDescriptor} values are serialized into the inline
355
+ * `Name:path` syntax; arrays and booleans are coerced into the string-shaped values
356
+ * that the downstream pipeline expects.
357
+ *
358
+ * When `configFileDir` is provided, relative paths in descriptors and inline strings
359
+ * are anchored to that directory and emitted as absolute paths. The generator later
360
+ * rewrites them as relative to each output file at emit time.
361
+ */
362
+ declare function applyConfigFile(rawConfig: RawGeneratorConfig, configFile: GeneratorConfigFile | null, configFileDir?: string): RawGeneratorConfig;
363
+ /**
364
+ * Builds an {@link ImportDescriptor} for named exports of a module. The `symbols` argument
365
+ * is expected to use ES shorthand property syntax (`{ IsBool, IsUnique }`); only the keys
366
+ * are read, but the IDE will still flag misspellings and propagate refactor renames.
367
+ *
368
+ * @example
369
+ * ```ts
370
+ * import { IsBool, IsUnique } from 'src/common/validators';
371
+ * import { fromModule } from '@tommasomeli/prisma-generator-nestjs-dto';
372
+ *
373
+ * fromModule('src/common/validators', { IsBool, IsUnique });
374
+ * // → { from: 'src/common/validators', names: ['IsBool', 'IsUnique'] }
375
+ * ```
376
+ */
377
+ declare function fromModule(from: string, symbols: Record<string, unknown>): ImportDescriptor;
378
+ /** Module shape inferred from a `() => import('...')` closure type. */
379
+ type ModuleOf<F> = F extends () => Promise<infer M> ? M : never;
380
+ /**
381
+ * Descriptor builder for named imports. Accepts two forms:
382
+ *
383
+ * 1. **Type-safe** — pass a `() => import('path')` callback. TypeScript infers the module
384
+ * type from the dynamic import, validates `names` against its keys, and the callback
385
+ * is never invoked at runtime (no side effects). The module path is recovered from
386
+ * the closure source.
387
+ * 2. **Concise** — pass the module specifier as a plain string. `names` are not validated
388
+ * by TypeScript, but the result is identical at runtime.
389
+ *
390
+ * @example
391
+ * ```ts
392
+ * from(() => import('src/common/validators'), ['IsBool', 'IsUnique']); // type-safe
393
+ * from(() => import('src/common/validators'), 'IsBool'); // type-safe single
394
+ * from('class-validator', ['IsEmail', 'IsString']); // string form
395
+ * ```
396
+ */
397
+ declare function from(modulePath: string, names: string | readonly string[]): ImportDescriptor;
398
+ declare function from<F extends () => Promise<unknown>>(importer: F, names: (keyof ModuleOf<F> & string) | readonly (keyof ModuleOf<F> & string)[]): ImportDescriptor;
399
+ /**
400
+ * Descriptor builder for `import * as alias from 'path'`. Accepts the same dual form as
401
+ * {@link from}: a `() => import('path')` callback (path validated by TS) or a plain string.
402
+ *
403
+ * @example
404
+ * ```ts
405
+ * fromNamespace(() => import('src/common/constants'), 'CONSTANTS');
406
+ * fromNamespace('lodash', 'Lodash');
407
+ * ```
408
+ */
409
+ declare function fromNamespace(modulePath: string, alias: string): ImportDescriptor;
410
+ declare function fromNamespace<F extends () => Promise<unknown>>(importer: F, alias: string): ImportDescriptor;
411
+ /**
412
+ * Descriptor builder for `import Default[, { named }] from 'path'`. Accepts the dual
413
+ * form (closure or string) and an optional `names` payload validated against the module
414
+ * type when the closure form is used.
415
+ *
416
+ * @example
417
+ * ```ts
418
+ * fromDefault(() => import('lodash'), 'Lodash');
419
+ * fromDefault(() => import('src/lib'), 'Lib', ['helperA', 'helperB']);
420
+ * fromDefault('lodash', 'Lodash');
421
+ * ```
422
+ */
423
+ declare function fromDefault(modulePath: string, defaultName: string, names?: string | readonly string[]): ImportDescriptor;
424
+ declare function fromDefault<F extends () => Promise<{
425
+ default: unknown;
426
+ }>>(importer: F, defaultName: string, names?: (keyof ModuleOf<F> & string) | readonly (keyof ModuleOf<F> & string)[]): ImportDescriptor;
427
+ /** Convenience for `import * as Alias from 'path'`. */
428
+ declare function namespaceFrom(from: string, namespaceAlias: string): ImportDescriptor;
429
+ /** Convenience for `import Default from 'path'`, optionally with named imports. */
430
+ declare function defaultFrom(from: string, defaultName: string, namedSymbols?: Record<string, unknown>): ImportDescriptor;
431
+
432
+ declare const ANNOTATION_NAME_REGEX: RegExp;
433
+ declare const ANNOTATION_PARAMS_REGEX: RegExp;
434
+ declare const ANNOTATION_PARAMS_SPLIT_REGEX: RegExp;
435
+ declare const PRISMA_SCALAR: Record<string, string>;
436
+ declare const PRISMA_SCALAR_TYPE: Record<string, string>;
437
+ declare const PRISMA_SCALAR_FORMAT: Record<string, {
438
+ type: string;
439
+ format?: string;
440
+ }>;
441
+ declare const SWAGGER_DECORATORS: string[];
442
+ declare const SWAGGER_API_PROPERTY_DECORATORS: string[];
443
+ declare const CLASS_TRANSFORMER_DECORATORS: string[];
444
+ declare const CLASS_VALIDATOR_DECORATORS: string[];
445
+
446
+ /**
447
+ * Entry point used by `@prisma/generator-helper`. Executes every registered
448
+ * generator (built-in + user-provided), writes the resulting files to disk
449
+ * and, when enabled, emits `index.ts` barrels for re-exports.
450
+ */
451
+ declare function generate(options: GeneratorOptions): Promise<void>;
452
+
453
+ declare class EntityDtoGenerator extends BaseGenerator {
454
+ filePrefix: string;
455
+ fileSuffix: string;
456
+ classPrefix: string;
457
+ classSuffix: string;
458
+ generate(): Promise<File[]>;
459
+ }
460
+
461
+ declare class CreateDtoGenerator extends BaseGenerator {
462
+ filePrefix: string;
463
+ fileSuffix: string;
464
+ classPrefix: string;
465
+ classSuffix: string;
466
+ generate(): Promise<File[]>;
467
+ }
468
+
469
+ declare class UpdateDtoGenerator extends BaseGenerator {
470
+ filePrefix: string;
471
+ fileSuffix: string;
472
+ classPrefix: string;
473
+ classSuffix: string;
474
+ generate(): Promise<File[]>;
475
+ }
476
+
477
+ /**
478
+ * Emits runtime-side artifacts that the Prisma DMMF does not surface directly:
479
+ *
480
+ * - `manifest.ts`: per-model `primaryKey`, `entityFields` (mirrors `isEntityHidden`)
481
+ * and `relations.{type,isList}`. Useful for select builders, audit logs, etc.
482
+ * - `model-entity-map.ts`: a type-only map `Prisma.ModelName -> generated Entity class`,
483
+ * handy for typing dynamic `select` paths.
484
+ *
485
+ * Opt-in via the `emitManifest` config option (defaults to `false`).
486
+ */
487
+ declare class ManifestGenerator extends BaseGenerator {
488
+ filePrefix: string;
489
+ fileSuffix: string;
490
+ classPrefix: string;
491
+ classSuffix: string;
492
+ generate(): Promise<File[]>;
493
+ }
494
+
495
+ /**
496
+ * Stateless helpers used by the generator pipeline: leveled logger with a
497
+ * configurable prefix, boolean parsing, and the import-statement parser used by
498
+ * every `extra*` config option.
499
+ */
500
+ declare class Utility {
501
+ private static prefix;
502
+ /** Override the global log prefix (defaults to the package name). */
503
+ static setLogPrefix(prefix: string): void;
504
+ static log(message: any, ...data: any[]): void;
505
+ static warn(message: any, ...data: any[]): void;
506
+ static error(message: any, ...data: any[]): void;
507
+ /**
508
+ * Parses a string into a boolean. Accepts native booleans and the Prisma-style
509
+ * stringified values that come from `schema.prisma` config options.
510
+ */
511
+ static parseBoolean(value: string | boolean | undefined): boolean;
512
+ /**
513
+ * Parses one or more import declarations from the value of an `extra*` config option.
514
+ * The only supported syntax is the compact inline form:
515
+ *
516
+ * ```prisma
517
+ * extraValidators = "IsUnique,IsBool:src/common/validators|IsAdult:src/common/validators/is-adult"
518
+ * ```
519
+ *
520
+ * - `Foo,Bar:path` — named imports.
521
+ * - `* as Foo:path` — namespace import.
522
+ * - `default as Foo:path` — default import.
523
+ * - `|` — separator for multiple groups (different paths).
524
+ *
525
+ * For anything more elaborate (rename, default + named, type-safe paths, ...) use a
526
+ * `configFile` with `ImportDescriptor` or the `from()` / `fromNamespace()` / `fromDefault()`
527
+ * helpers.
528
+ *
529
+ * Also accepts an array of strings, with each entry already containing one or more
530
+ * `|`-separated groups.
531
+ */
532
+ static parseImports(value: string | string[] | undefined): ImportType[];
533
+ /**
534
+ * Parses `extraAnnotations` into a deduplicated list of annotation names.
535
+ * Accepts a single comma/whitespace-separated string, a string array, or a mix:
536
+ * `"@DtoFoo, DtoBar"`, `["DtoFoo", "DtoBar"]`, `"DtoFoo DtoBar"`. Leading `@`
537
+ * characters are stripped so plugin authors can refer to them either way.
538
+ */
539
+ static parseAnnotationNames(value: string | string[] | undefined): string[];
540
+ /**
541
+ * Parses the `extraScalars` config value. Accepts a JSON string (the form emitted by
542
+ * {@link applyConfigFile}) or an already-parsed `Record<string, ScalarOverride>` object.
543
+ * Invalid entries are skipped with a warning rather than throwing.
544
+ */
545
+ static parseExtraScalars(value: unknown): Record<string, {
546
+ ts: string;
547
+ from?: string;
548
+ apiType?: string;
549
+ format?: string;
550
+ }>;
551
+ /**
552
+ * @deprecated Use {@link parseImports} instead. Kept for sub-generators that
553
+ * relied on the public name in earlier releases.
554
+ */
555
+ static stringToImports(value: string | string[] | undefined): ImportType[];
556
+ /** Parses the inline `Name1,Name2:path|Other:path2` syntax. */
557
+ private static parseInlineImport;
558
+ /** Merges a new entry into an existing array, deduplicating named imports on the same path. */
559
+ private static mergeInto;
560
+ }
561
+
562
+ export { ANNOTATION_NAME_REGEX, ANNOTATION_PARAMS_REGEX, ANNOTATION_PARAMS_SPLIT_REGEX, type Annotation, BaseGenerator, CLASS_TRANSFORMER_DECORATORS, CLASS_VALIDATOR_DECORATORS, CreateDtoGenerator, DTO_API_EXTRA_MODELS, DTO_API_HIDDEN, DTO_CREATED_AT, DTO_CREATE_HIDDEN, DTO_CREATE_OPTIONAL, DTO_CREATE_REQUIRED, DTO_CREATE_VALIDATE_IF, DTO_ENTITY_HIDDEN, DTO_HIDDEN, DTO_IGNORE_MODEL, DTO_OVERRIDE_API_PROPERTY_TYPE, DTO_OVERRIDE_TYPE, DTO_READ_ONLY, DTO_UPDATE_HIDDEN, DTO_UPDATE_OPTIONAL, DTO_UPDATE_REQUIRED, DTO_UPDATE_VALIDATE_IF, ENTITY_HIDDEN_ANNOTATIONS, EntityDtoGenerator as EntityGenerator, type ExtraImportConfig, type Field, type File, type GeneratorConfig, type GeneratorConfigFile, type GeneratorOptions, type ImportDescriptor, type ImportType, type LoadedConfigFile, ManifestGenerator, type Model, type ModuleOf, type NamingStrategy, type OutputStructure, type OutputType, PRISMA_SCALAR, PRISMA_SCALAR_FORMAT, PRISMA_SCALAR_TYPE, type RawGeneratorConfig, SWAGGER_API_PROPERTY_DECORATORS, SWAGGER_DECORATORS, type ScalarOverride, UpdateDtoGenerator, Utility, applyConfigFile, defaultFrom, descriptorToImportStatement, from, fromDefault, fromModule, fromNamespace, generate, isEntityHidden, loadConfigFile, namespaceFrom };