@pegasusheavy/nestjs-prisma-graphql 1.4.3 → 1.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/README.md +18 -7
- package/dist/benchmark/analysis.d.ts +7 -0
- package/dist/benchmark/analysis.d.ts.map +1 -0
- package/dist/benchmark/analysis.js +265 -0
- package/dist/benchmark/analysis.js.map +1 -0
- package/dist/benchmark/index.d.ts +7 -0
- package/dist/benchmark/index.d.ts.map +1 -0
- package/dist/benchmark/index.js +272 -0
- package/dist/benchmark/index.js.map +1 -0
- package/dist/event-names.d.ts +2 -0
- package/dist/event-names.d.ts.map +1 -0
- package/dist/event-names.js +2 -0
- package/dist/event-names.js.map +1 -0
- package/dist/generate.d.ts +4 -140
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +199 -2826
- package/dist/generate.js.map +1 -1
- package/dist/handlers/args-type.d.ts +7 -0
- package/dist/handlers/args-type.d.ts.map +1 -0
- package/dist/handlers/args-type.js +68 -0
- package/dist/handlers/args-type.js.map +1 -0
- package/dist/handlers/combine-scalar-filters.d.ts +6 -0
- package/dist/handlers/combine-scalar-filters.d.ts.map +1 -0
- package/dist/handlers/combine-scalar-filters.js +110 -0
- package/dist/handlers/combine-scalar-filters.js.map +1 -0
- package/dist/handlers/create-aggregate-input.d.ts +10 -0
- package/dist/handlers/create-aggregate-input.d.ts.map +1 -0
- package/dist/handlers/create-aggregate-input.js +33 -0
- package/dist/handlers/create-aggregate-input.js.map +1 -0
- package/dist/handlers/decimal-helpers.d.ts +10 -0
- package/dist/handlers/decimal-helpers.d.ts.map +1 -0
- package/dist/handlers/decimal-helpers.js +73 -0
- package/dist/handlers/decimal-helpers.js.map +1 -0
- package/dist/handlers/emit-single.d.ts +3 -0
- package/dist/handlers/emit-single.d.ts.map +1 -0
- package/dist/handlers/emit-single.js +14 -0
- package/dist/handlers/emit-single.js.map +1 -0
- package/dist/handlers/generate-barrel-exports.d.ts +13 -0
- package/dist/handlers/generate-barrel-exports.d.ts.map +1 -0
- package/dist/handlers/generate-barrel-exports.js +69 -0
- package/dist/handlers/generate-barrel-exports.js.map +1 -0
- package/dist/handlers/generate-files.d.ts +3 -0
- package/dist/handlers/generate-files.d.ts.map +1 -0
- package/dist/handlers/generate-files.js +133 -0
- package/dist/handlers/generate-files.js.map +1 -0
- package/dist/handlers/input-type.d.ts +7 -0
- package/dist/handlers/input-type.d.ts.map +1 -0
- package/dist/handlers/input-type.js +297 -0
- package/dist/handlers/input-type.js.map +1 -0
- package/dist/handlers/model-data.d.ts +3 -0
- package/dist/handlers/model-data.d.ts.map +1 -0
- package/dist/handlers/model-data.js +27 -0
- package/dist/handlers/model-data.js.map +1 -0
- package/dist/handlers/model-output-type.d.ts +3 -0
- package/dist/handlers/model-output-type.d.ts.map +1 -0
- package/dist/handlers/model-output-type.js +283 -0
- package/dist/handlers/model-output-type.js.map +1 -0
- package/dist/handlers/no-atomic-operations.d.ts +3 -0
- package/dist/handlers/no-atomic-operations.d.ts.map +1 -0
- package/dist/handlers/no-atomic-operations.js +41 -0
- package/dist/handlers/no-atomic-operations.js.map +1 -0
- package/dist/handlers/output-type.d.ts +3 -0
- package/dist/handlers/output-type.d.ts.map +1 -0
- package/dist/handlers/output-type.js +179 -0
- package/dist/handlers/output-type.js.map +1 -0
- package/dist/handlers/patch-type-registry.d.ts +16 -0
- package/dist/handlers/patch-type-registry.d.ts.map +1 -0
- package/dist/handlers/patch-type-registry.js +47 -0
- package/dist/handlers/patch-type-registry.js.map +1 -0
- package/dist/handlers/post-process-imports.d.ts +11 -0
- package/dist/handlers/post-process-imports.d.ts.map +1 -0
- package/dist/handlers/post-process-imports.js +44 -0
- package/dist/handlers/post-process-imports.js.map +1 -0
- package/dist/handlers/prisma-enum-doc.d.ts +11 -0
- package/dist/handlers/prisma-enum-doc.d.ts.map +1 -0
- package/dist/handlers/prisma-enum-doc.js +16 -0
- package/dist/handlers/prisma-enum-doc.js.map +1 -0
- package/dist/handlers/purge-output.d.ts +3 -0
- package/dist/handlers/purge-output.d.ts.map +1 -0
- package/dist/handlers/purge-output.js +34 -0
- package/dist/handlers/purge-output.js.map +1 -0
- package/dist/handlers/re-export.d.ts +9 -0
- package/dist/handlers/re-export.d.ts.map +1 -0
- package/dist/handlers/re-export.js +101 -0
- package/dist/handlers/re-export.js.map +1 -0
- package/dist/handlers/register-all-types.d.ts +13 -0
- package/dist/handlers/register-all-types.d.ts.map +1 -0
- package/dist/handlers/register-all-types.js +99 -0
- package/dist/handlers/register-all-types.js.map +1 -0
- package/dist/handlers/register-enum.d.ts +3 -0
- package/dist/handlers/register-enum.d.ts.map +1 -0
- package/dist/handlers/register-enum.js +65 -0
- package/dist/handlers/register-enum.js.map +1 -0
- package/dist/handlers/require-single-fields-in-whereunique-input.d.ts +3 -0
- package/dist/handlers/require-single-fields-in-whereunique-input.d.ts.map +1 -0
- package/dist/handlers/require-single-fields-in-whereunique-input.js +15 -0
- package/dist/handlers/require-single-fields-in-whereunique-input.js.map +1 -0
- package/dist/handlers/type-registry.d.ts +14 -0
- package/dist/handlers/type-registry.d.ts.map +1 -0
- package/dist/handlers/type-registry.js +151 -0
- package/dist/handlers/type-registry.js.map +1 -0
- package/dist/handlers/warning.d.ts +2 -0
- package/dist/handlers/warning.d.ts.map +1 -0
- package/dist/handlers/warning.js +14 -0
- package/dist/handlers/warning.js.map +1 -0
- package/dist/helpers/create-comment.d.ts +3 -0
- package/dist/helpers/create-comment.d.ts.map +1 -0
- package/dist/helpers/create-comment.js +23 -0
- package/dist/helpers/create-comment.js.map +1 -0
- package/dist/helpers/create-config.d.ts +51 -0
- package/dist/helpers/create-config.d.ts.map +1 -0
- package/dist/helpers/create-config.js +165 -0
- package/dist/helpers/create-config.js.map +1 -0
- package/dist/helpers/create-emit-blocks.d.ts +5 -0
- package/dist/helpers/create-emit-blocks.d.ts.map +1 -0
- package/dist/helpers/create-emit-blocks.js +37 -0
- package/dist/helpers/create-emit-blocks.js.map +1 -0
- package/dist/helpers/detect-circular-deps.d.ts +28 -0
- package/dist/helpers/detect-circular-deps.d.ts.map +1 -0
- package/dist/helpers/detect-circular-deps.js +92 -0
- package/dist/helpers/detect-circular-deps.js.map +1 -0
- package/dist/helpers/factory-get-source-file.d.ts +13 -0
- package/dist/helpers/factory-get-source-file.d.ts.map +1 -0
- package/dist/helpers/factory-get-source-file.js +17 -0
- package/dist/helpers/factory-get-source-file.js.map +1 -0
- package/dist/helpers/file-type-by-location.d.ts +3 -0
- package/dist/helpers/file-type-by-location.d.ts.map +1 -0
- package/dist/helpers/file-type-by-location.js +19 -0
- package/dist/helpers/file-type-by-location.js.map +1 -0
- package/dist/helpers/generate-file-name.d.ts +7 -0
- package/dist/helpers/generate-file-name.d.ts.map +1 -0
- package/dist/helpers/generate-file-name.js +35 -0
- package/dist/helpers/generate-file-name.js.map +1 -0
- package/dist/helpers/get-enum-name.d.ts +2 -0
- package/dist/helpers/get-enum-name.d.ts.map +1 -0
- package/dist/helpers/get-enum-name.js +5 -0
- package/dist/helpers/get-enum-name.js.map +1 -0
- package/dist/helpers/get-graphql-import.d.ts +19 -0
- package/dist/helpers/get-graphql-import.d.ts.map +1 -0
- package/dist/helpers/get-graphql-import.js +52 -0
- package/dist/helpers/get-graphql-import.js.map +1 -0
- package/dist/helpers/get-graphql-input-type.d.ts +6 -0
- package/dist/helpers/get-graphql-input-type.d.ts.map +1 -0
- package/dist/helpers/get-graphql-input-type.js +64 -0
- package/dist/helpers/get-graphql-input-type.js.map +1 -0
- package/dist/helpers/get-model-name.d.ts +2 -0
- package/dist/helpers/get-model-name.d.ts.map +1 -0
- package/dist/helpers/get-model-name.js +130 -0
- package/dist/helpers/get-model-name.js.map +1 -0
- package/dist/helpers/get-output-type-name.d.ts +2 -0
- package/dist/helpers/get-output-type-name.d.ts.map +1 -0
- package/dist/helpers/get-output-type-name.js +4 -0
- package/dist/helpers/get-output-type-name.js.map +1 -0
- package/dist/helpers/get-property-type.d.ts +9 -0
- package/dist/helpers/get-property-type.d.ts.map +1 -0
- package/dist/helpers/get-property-type.js +48 -0
- package/dist/helpers/get-property-type.js.map +1 -0
- package/dist/helpers/get-where-unique-at-least-keys.d.ts +3 -0
- package/dist/helpers/get-where-unique-at-least-keys.d.ts.map +1 -0
- package/dist/helpers/get-where-unique-at-least-keys.js +17 -0
- package/dist/helpers/get-where-unique-at-least-keys.js.map +1 -0
- package/dist/helpers/import-declaration-map.d.ts +19 -0
- package/dist/helpers/import-declaration-map.d.ts.map +1 -0
- package/dist/helpers/import-declaration-map.js +69 -0
- package/dist/helpers/import-declaration-map.js.map +1 -0
- package/dist/helpers/is-many-and-return.d.ts +2 -0
- package/dist/helpers/is-many-and-return.d.ts.map +1 -0
- package/dist/helpers/is-many-and-return.js +9 -0
- package/dist/helpers/is-many-and-return.js.map +1 -0
- package/dist/helpers/is-where-unique-input-type.d.ts +2 -0
- package/dist/helpers/is-where-unique-input-type.d.ts.map +1 -0
- package/dist/helpers/is-where-unique-input-type.js +4 -0
- package/dist/helpers/is-where-unique-input-type.js.map +1 -0
- package/dist/helpers/object-settings.d.ts +39 -0
- package/dist/helpers/object-settings.d.ts.map +1 -0
- package/dist/helpers/object-settings.js +297 -0
- package/dist/helpers/object-settings.js.map +1 -0
- package/dist/helpers/pascal-case.d.ts +2 -0
- package/dist/helpers/pascal-case.d.ts.map +1 -0
- package/dist/helpers/pascal-case.js +5 -0
- package/dist/helpers/pascal-case.js.map +1 -0
- package/dist/helpers/property-structure.d.ts +13 -0
- package/dist/helpers/property-structure.d.ts.map +1 -0
- package/dist/helpers/property-structure.js +20 -0
- package/dist/helpers/property-structure.js.map +1 -0
- package/dist/helpers/relative-path.d.ts +2 -0
- package/dist/helpers/relative-path.d.ts.map +1 -0
- package/dist/helpers/relative-path.js +20 -0
- package/dist/helpers/relative-path.js.map +1 -0
- package/dist/helpers/type-safe-assert.d.ts +7 -0
- package/dist/helpers/type-safe-assert.d.ts.map +1 -0
- package/dist/helpers/type-safe-assert.js +10 -0
- package/dist/helpers/type-safe-assert.js.map +1 -0
- package/dist/helpers/update-object-property.d.ts +7 -0
- package/dist/helpers/update-object-property.d.ts.map +1 -0
- package/dist/helpers/update-object-property.js +21 -0
- package/dist/helpers/update-object-property.js.map +1 -0
- package/dist/index.d.ts +4 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +135 -2956
- package/dist/index.js.map +1 -1
- package/dist/test/test-utils.d.ts +4 -0
- package/dist/test/test-utils.d.ts.map +1 -0
- package/dist/test/test-utils.js +14 -0
- package/dist/test/test-utils.js.map +1 -0
- package/dist/types.d.ts +73 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EventArguments } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generate the register-all-types.ts file that imports all generated types
|
|
4
|
+
* to ensure their registerType() calls are executed.
|
|
5
|
+
*
|
|
6
|
+
* This file must be imported early in the application, before any code
|
|
7
|
+
* tries to use getType() for lazy type resolution.
|
|
8
|
+
*
|
|
9
|
+
* This solves the ESM bundling issue where CJS would return valid bundles
|
|
10
|
+
* but ESM complains about broken dependency cycles.
|
|
11
|
+
*/
|
|
12
|
+
export declare function generateRegisterAllTypes(args: EventArguments): void;
|
|
13
|
+
//# sourceMappingURL=register-all-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-all-types.d.ts","sourceRoot":"","sources":["../../src/handlers/register-all-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAuGnE"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { relativePath } from '../helpers/relative-path.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generate the register-all-types.ts file that imports all generated types
|
|
4
|
+
* to ensure their registerType() calls are executed.
|
|
5
|
+
*
|
|
6
|
+
* This file must be imported early in the application, before any code
|
|
7
|
+
* tries to use getType() for lazy type resolution.
|
|
8
|
+
*
|
|
9
|
+
* This solves the ESM bundling issue where CJS would return valid bundles
|
|
10
|
+
* but ESM complains about broken dependency cycles.
|
|
11
|
+
*/
|
|
12
|
+
export function generateRegisterAllTypes(args) {
|
|
13
|
+
const { config, output, project } = args;
|
|
14
|
+
if (!config.esmCompatible) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const rootDirectory = project.getDirectory(output) ?? project.createDirectory(output);
|
|
18
|
+
// Use .js extension if outputFilePattern uses .js, otherwise .ts
|
|
19
|
+
const extension = config.outputFilePattern?.includes('.js') ? '.js' : '.ts';
|
|
20
|
+
const sourceFile = rootDirectory.createSourceFile(`register-all-types${extension}`, undefined, {
|
|
21
|
+
overwrite: true,
|
|
22
|
+
});
|
|
23
|
+
// Collect all generated source files that have registerType() calls
|
|
24
|
+
const importPaths = [];
|
|
25
|
+
const typeNames = [];
|
|
26
|
+
// Get all source files in the output directory
|
|
27
|
+
// Support both .ts (default) and .js (when outputFilePattern uses .js)
|
|
28
|
+
const allSourceFiles = project.getSourceFiles(`${output}/**/*.{ts,js}`);
|
|
29
|
+
for (const file of allSourceFiles) {
|
|
30
|
+
const filePath = file.getFilePath();
|
|
31
|
+
// Skip utility files and the register file itself
|
|
32
|
+
if (filePath.endsWith('type-registry.ts') ||
|
|
33
|
+
filePath.endsWith('register-all-types.ts') ||
|
|
34
|
+
filePath.endsWith('index.ts')) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
// Check if this file has a registerType() call
|
|
38
|
+
const fileText = file.getText();
|
|
39
|
+
const registerMatch = /registerType\(['"]([^'"]+)['"]/.exec(fileText);
|
|
40
|
+
if (registerMatch) {
|
|
41
|
+
// Get relative path from register-all-types.ts to this file
|
|
42
|
+
let relPath = relativePath(sourceFile.getFilePath(), filePath);
|
|
43
|
+
// Add .js extension for ESM module resolution
|
|
44
|
+
if (!relPath.endsWith('.js')) {
|
|
45
|
+
relPath += '.js';
|
|
46
|
+
}
|
|
47
|
+
importPaths.push(relPath);
|
|
48
|
+
typeNames.push(registerMatch[1]);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Sort for consistent output
|
|
52
|
+
importPaths.sort();
|
|
53
|
+
typeNames.sort();
|
|
54
|
+
// Generate the file content with proper ESM handling
|
|
55
|
+
const fileContent = `/**
|
|
56
|
+
* ESM Type Registration Module
|
|
57
|
+
*
|
|
58
|
+
* This file registers all generated types with the type registry to solve
|
|
59
|
+
* ESM circular dependency issues. In ESM, unlike CommonJS, circular imports
|
|
60
|
+
* can result in undefined values because modules are evaluated in a different order.
|
|
61
|
+
*
|
|
62
|
+
* IMPORTANT: Import this file at the very top of your application entry point,
|
|
63
|
+
* BEFORE any other code that uses the generated types.
|
|
64
|
+
*
|
|
65
|
+
* Example usage in main.ts:
|
|
66
|
+
*
|
|
67
|
+
* // This MUST be the first import
|
|
68
|
+
* import './@generated/register-all-types.js';
|
|
69
|
+
*
|
|
70
|
+
* // Now you can safely import and use generated types
|
|
71
|
+
* import { NestFactory } from '@nestjs/core';
|
|
72
|
+
* import { AppModule } from './app.module.js';
|
|
73
|
+
*
|
|
74
|
+
* Why this is needed:
|
|
75
|
+
* - ESM uses "live bindings" where imports reference the actual export
|
|
76
|
+
* - With circular deps (User -> Post -> User), one module isn't ready when imported
|
|
77
|
+
* - CJS would give a partial object that fills in later; ESM gives undefined
|
|
78
|
+
* - This registry pattern defers type resolution until runtime when all modules are loaded
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
import { markRegistrationComplete } from './type-registry.js';
|
|
82
|
+
|
|
83
|
+
// Import all generated type files to trigger their registerType() calls
|
|
84
|
+
// These are side-effect imports that populate the type registry
|
|
85
|
+
${importPaths.map(p => `import '${p}';`).join('\n')}
|
|
86
|
+
|
|
87
|
+
// Mark registration as complete to enable warning messages
|
|
88
|
+
markRegistrationComplete();
|
|
89
|
+
|
|
90
|
+
// Export type names for validation (optional)
|
|
91
|
+
export const registeredTypes = [
|
|
92
|
+
${typeNames.map(n => ` '${n}',`).join('\n')}
|
|
93
|
+
] as const;
|
|
94
|
+
|
|
95
|
+
export type RegisteredTypeName = typeof registeredTypes[number];
|
|
96
|
+
`;
|
|
97
|
+
sourceFile.addStatements(fileContent);
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=register-all-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-all-types.js","sourceRoot":"","sources":["../../src/handlers/register-all-types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAAoB;IAC3D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEzC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAEtF,iEAAiE;IACjE,MAAM,SAAS,GAAG,MAAM,CAAC,iBAAiB,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAC5E,MAAM,UAAU,GAAG,aAAa,CAAC,gBAAgB,CAC/C,qBAAqB,SAAS,EAAE,EAChC,SAAS,EACT;QACE,SAAS,EAAE,IAAI;KAChB,CACF,CAAC;IAEF,oEAAoE;IACpE,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,SAAS,GAAa,EAAE,CAAC;IAE/B,+CAA+C;IAC/C,uEAAuE;IACvE,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,MA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,IAAI,CAAC;;;;CAI3C,CAAC;IAEA,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-enum.d.ts","sourceRoot":"","sources":["../../src/handlers/register-enum.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAO9D,wBAAgB,YAAY,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CA0E7E"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { StructureKind } from 'ts-morph';
|
|
2
|
+
import { ImportDeclarationMap } from '../helpers/import-declaration-map.js';
|
|
3
|
+
import { extractEnumValueDocs } from './prisma-enum-doc.js';
|
|
4
|
+
export function registerEnum(enumType, args) {
|
|
5
|
+
const { config, enums, getSourceFile } = args;
|
|
6
|
+
// Type-safe extraction of enum name from SchemaEnum
|
|
7
|
+
// Access the name property through unknown to avoid unsafe member access
|
|
8
|
+
const enumTypeAsRecord = enumType;
|
|
9
|
+
const rawName = enumTypeAsRecord.name;
|
|
10
|
+
const enumName = typeof rawName === 'string' ? rawName : String(rawName);
|
|
11
|
+
const enumValue = enums[enumName];
|
|
12
|
+
if (!config.emitBlocks.prismaEnums && enumValue === undefined) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const dataModelEnum = enumValue;
|
|
16
|
+
const enumTypesData = (dataModelEnum?.values ?? []).map(v => ({
|
|
17
|
+
name: v.name,
|
|
18
|
+
documentation: undefined,
|
|
19
|
+
}));
|
|
20
|
+
const sourceFile = getSourceFile({
|
|
21
|
+
name: enumName,
|
|
22
|
+
type: 'enum',
|
|
23
|
+
});
|
|
24
|
+
const importDeclarations = new ImportDeclarationMap();
|
|
25
|
+
importDeclarations.set('registerEnumType', {
|
|
26
|
+
moduleSpecifier: '@nestjs/graphql',
|
|
27
|
+
namedImports: [{ name: 'registerEnumType' }],
|
|
28
|
+
});
|
|
29
|
+
// Extract valuesMap from enum documentation
|
|
30
|
+
const valuesMap = extractEnumValueDocs(enumTypesData);
|
|
31
|
+
// Remove entries with no description or deprecationReason
|
|
32
|
+
const filteredValuesMap = Object.fromEntries(Object.entries(valuesMap).filter(([, v]) => Object.keys(v).length > 0));
|
|
33
|
+
// Format only if needed
|
|
34
|
+
const hasValuesMap = Object.keys(filteredValuesMap).length > 0;
|
|
35
|
+
const formattedValuesMap = hasValuesMap
|
|
36
|
+
? JSON.stringify(filteredValuesMap, null, 2).replace(/"([^"]+)":/g, '$1:')
|
|
37
|
+
: '';
|
|
38
|
+
const valuesMapEntry = hasValuesMap ? `, valuesMap: ${formattedValuesMap}` : '';
|
|
39
|
+
// Type-safe extraction of enum values
|
|
40
|
+
// Access the values property through unknown to avoid unsafe member access
|
|
41
|
+
const enumTypeRecord = enumType;
|
|
42
|
+
const rawValues = enumTypeRecord.values;
|
|
43
|
+
const enumValues = Array.isArray(rawValues)
|
|
44
|
+
? rawValues.map((v) => String(v))
|
|
45
|
+
: [];
|
|
46
|
+
const enumStructure = {
|
|
47
|
+
isExported: true,
|
|
48
|
+
kind: StructureKind.Enum,
|
|
49
|
+
members: enumValues.map((v) => ({
|
|
50
|
+
initializer: JSON.stringify(v),
|
|
51
|
+
name: v,
|
|
52
|
+
})),
|
|
53
|
+
name: enumName,
|
|
54
|
+
};
|
|
55
|
+
const enumTypeName = enumName;
|
|
56
|
+
sourceFile.set({
|
|
57
|
+
statements: [
|
|
58
|
+
...importDeclarations.toStatements(),
|
|
59
|
+
enumStructure,
|
|
60
|
+
'\n',
|
|
61
|
+
`registerEnumType(${enumTypeName}, { name: '${enumTypeName}', description: ${JSON.stringify(dataModelEnum?.documentation)}${valuesMapEntry} })`,
|
|
62
|
+
],
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=register-enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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AC,CAAS,EAAE,EAAE,CAAC,CAAC;YACtC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;YAC9B,IAAI,EAAE,CAAC;SACR,CAAC,CAAC;QACH,IAAI,EAAE,QAAQ;KACf,CAAC;IAEF,MAAM,YAAY,GAAG,QAAQ,CAAC;IAC9B,UAAU,CAAC,GAAG,CAAC;QACb,UAAU,EAAE;YACV,GAAG,kBAAkB,CAAC,YAAY,EAAE;YACpC,aAAa;YACb,IAAI;YACJ,oBAAoB,YAAY,cAAc,YAAY,mBAAmB,IAAI,CAAC,SAAS,CACzF,aAAa,EAAE,aAAa,CAC7B,GAAG,cAAc,KAAK;SACxB;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-single-fields-in-whereunique-input.d.ts","sourceRoot":"","sources":["../../src/handlers/require-single-fields-in-whereunique-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,YAAY,EAAa,MAAM,aAAa,CAAC;AAI3E,wBAAgB,qCAAqC,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAEtF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isWhereUniqueInputType } from '../helpers/is-where-unique-input-type.js';
|
|
2
|
+
export function requireSingleFieldsInWhereUniqueInput(eventEmitter) {
|
|
3
|
+
eventEmitter.on('BeforeInputType', beforeInputType);
|
|
4
|
+
}
|
|
5
|
+
function beforeInputType(args) {
|
|
6
|
+
const { inputType } = args;
|
|
7
|
+
if (!isWhereUniqueInputType(inputType.name) || inputType.fields.length !== 1) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
for (const field of inputType.fields) {
|
|
11
|
+
field.isRequired = true;
|
|
12
|
+
field.isNullable = false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=require-single-fields-in-whereunique-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-single-fields-in-whereunique-input.js","sourceRoot":"","sources":["../../src/handlers/require-single-fields-in-whereunique-input.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAElF,MAAM,UAAU,qCAAqC,CAAC,YAA0B;IAC9E,YAAY,CAAC,EAAE,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,eAAe,CAAC,IAA+C;IACtE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAE3B,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7E,OAAO;IACT,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;QACrC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC;QACxB,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC;IAC3B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EventArguments } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generate the type-registry.ts file that provides lazy type resolution
|
|
4
|
+
* for circular dependencies in ESM environments.
|
|
5
|
+
*
|
|
6
|
+
* This solves the ESM bundling issue where CJS would return valid bundles
|
|
7
|
+
* but ESM complains about broken dependency cycles. In ESM, circular imports
|
|
8
|
+
* can result in undefined values because module evaluation order differs from CJS.
|
|
9
|
+
*
|
|
10
|
+
* The registry pattern defers type resolution until runtime when all modules
|
|
11
|
+
* have been fully initialized.
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateTypeRegistry(args: EventArguments): void;
|
|
14
|
+
//# sourceMappingURL=type-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-registry.d.ts","sourceRoot":"","sources":["../../src/handlers/type-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CA+I/D"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate the type-registry.ts file that provides lazy type resolution
|
|
3
|
+
* for circular dependencies in ESM environments.
|
|
4
|
+
*
|
|
5
|
+
* This solves the ESM bundling issue where CJS would return valid bundles
|
|
6
|
+
* but ESM complains about broken dependency cycles. In ESM, circular imports
|
|
7
|
+
* can result in undefined values because module evaluation order differs from CJS.
|
|
8
|
+
*
|
|
9
|
+
* The registry pattern defers type resolution until runtime when all modules
|
|
10
|
+
* have been fully initialized.
|
|
11
|
+
*/
|
|
12
|
+
export function generateTypeRegistry(args) {
|
|
13
|
+
const { config, output, project } = args;
|
|
14
|
+
if (!config.esmCompatible) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const rootDirectory = project.getDirectory(output) ?? project.createDirectory(output);
|
|
18
|
+
const sourceFile = rootDirectory.createSourceFile('type-registry.ts', undefined, {
|
|
19
|
+
overwrite: true,
|
|
20
|
+
});
|
|
21
|
+
// Generate a comprehensive type registry with error handling and forwardRef support
|
|
22
|
+
const registryCode = `/**
|
|
23
|
+
* Type Registry for ESM Circular Dependency Resolution
|
|
24
|
+
*
|
|
25
|
+
* In ESM, circular dependencies behave differently than CommonJS:
|
|
26
|
+
* - CJS: Modules get a partial/incomplete export object that gets filled in
|
|
27
|
+
* - ESM: Imports are "live bindings" but can be undefined if not yet initialized
|
|
28
|
+
*
|
|
29
|
+
* This registry solves this by:
|
|
30
|
+
* 1. Deferring type resolution until runtime (after all modules are loaded)
|
|
31
|
+
* 2. Providing a forwardRef pattern for GraphQL field type declarations
|
|
32
|
+
* 3. Validating all types are registered before they're needed
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
const registry = new Map<string, unknown>();
|
|
36
|
+
const pendingResolutions = new Map<string, Array<(type: unknown) => void>>();
|
|
37
|
+
let registrationComplete = false;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Register a type with the registry.
|
|
41
|
+
* This should be called at module load time after the class is defined.
|
|
42
|
+
*/
|
|
43
|
+
export function registerType(name: string, type: unknown): void {
|
|
44
|
+
if (type === undefined) {
|
|
45
|
+
console.warn(\`[nestjs-prisma-graphql] Warning: Registering undefined type for "\${name}". This may indicate a circular dependency issue.\`);
|
|
46
|
+
}
|
|
47
|
+
registry.set(name, type);
|
|
48
|
+
|
|
49
|
+
// Resolve any pending forwardRef callbacks
|
|
50
|
+
const pending = pendingResolutions.get(name);
|
|
51
|
+
if (pending) {
|
|
52
|
+
for (const callback of pending) {
|
|
53
|
+
callback(type);
|
|
54
|
+
}
|
|
55
|
+
pendingResolutions.delete(name);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Get a type from the registry.
|
|
61
|
+
* Returns the type if registered, undefined otherwise.
|
|
62
|
+
*
|
|
63
|
+
* For use in \\@Field(() => getType('TypeName')) decorators.
|
|
64
|
+
*/
|
|
65
|
+
export function getType<T = unknown>(name: string): T {
|
|
66
|
+
const type = registry.get(name);
|
|
67
|
+
if (type === undefined && registrationComplete) {
|
|
68
|
+
console.warn(\`[nestjs-prisma-graphql] Warning: Type "\${name}" not found in registry. Ensure register-all-types is imported before using generated types.\`);
|
|
69
|
+
}
|
|
70
|
+
return type as T;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Create a forward reference to a type that may not be registered yet.
|
|
75
|
+
* This is useful for handling circular dependencies where type A references type B
|
|
76
|
+
* and type B references type A.
|
|
77
|
+
*
|
|
78
|
+
* Usage: \\@Field(() => forwardRef('Post'))
|
|
79
|
+
*/
|
|
80
|
+
export function forwardRef<T = unknown>(name: string): () => T {
|
|
81
|
+
return () => {
|
|
82
|
+
const type = registry.get(name);
|
|
83
|
+
if (type === undefined) {
|
|
84
|
+
throw new Error(
|
|
85
|
+
\`[nestjs-prisma-graphql] Type "\${name}" not registered. \\n\` +
|
|
86
|
+
\`This usually means:\\n\` +
|
|
87
|
+
\` 1. The register-all-types.ts file was not imported early enough\\n\` +
|
|
88
|
+
\` 2. There's a circular dependency that couldn't be resolved\\n\` +
|
|
89
|
+
\` 3. The type file failed to load\\n\\n\` +
|
|
90
|
+
\`Make sure to import 'register-all-types' at the top of your main.ts or app.module.ts\`
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
return type as T;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Lazily resolve a type, returning a thunk that can be called later.
|
|
99
|
+
* This is the safest pattern for circular references in ESM.
|
|
100
|
+
*
|
|
101
|
+
* Usage: \\@Field(lazyType('Post'))
|
|
102
|
+
*/
|
|
103
|
+
export function lazyType<T = unknown>(name: string): () => T {
|
|
104
|
+
return () => getType<T>(name);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Mark registration as complete. Called after all types are imported.
|
|
109
|
+
* This enables warning messages for missing types.
|
|
110
|
+
*/
|
|
111
|
+
export function markRegistrationComplete(): void {
|
|
112
|
+
registrationComplete = true;
|
|
113
|
+
|
|
114
|
+
// Warn about any unresolved forward refs
|
|
115
|
+
if (pendingResolutions.size > 0) {
|
|
116
|
+
const missing = Array.from(pendingResolutions.keys()).join(', ');
|
|
117
|
+
console.warn(\`[nestjs-prisma-graphql] Warning: Unresolved forward references: \${missing}\`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Get all registered type names (useful for debugging)
|
|
123
|
+
*/
|
|
124
|
+
export function getRegisteredTypes(): string[] {
|
|
125
|
+
return Array.from(registry.keys());
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Check if a type is registered
|
|
130
|
+
*/
|
|
131
|
+
export function isTypeRegistered(name: string): boolean {
|
|
132
|
+
return registry.has(name);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Validate that all expected types are registered.
|
|
137
|
+
* Throws an error if any types are missing.
|
|
138
|
+
*/
|
|
139
|
+
export function validateRegistry(expectedTypes: string[]): void {
|
|
140
|
+
const missing = expectedTypes.filter(name => !registry.has(name));
|
|
141
|
+
if (missing.length > 0) {
|
|
142
|
+
throw new Error(
|
|
143
|
+
\`[nestjs-prisma-graphql] Missing type registrations: \${missing.join(', ')}\\n\` +
|
|
144
|
+
\`Ensure register-all-types.ts is imported before using these types.\`
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
`;
|
|
149
|
+
sourceFile.addStatements(registryCode);
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=type-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-registry.js","sourceRoot":"","sources":["../../src/handlers/type-registry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAoB;IACvD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEzC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAEtF,MAAM,UAAU,GAAG,aAAa,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,SAAS,EAAE;QAC/E,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IAEH,oFAAoF;IACpF,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8HtB,CAAC;IAEA,UAAU,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warning.d.ts","sourceRoot":"","sources":["../../src/handlers/warning.ts"],"names":[],"mappings":"AAQA,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAOxD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const globalConsole = globalThis.console;
|
|
2
|
+
const log = (msg) => {
|
|
3
|
+
globalConsole.log(msg);
|
|
4
|
+
};
|
|
5
|
+
export function warning(message) {
|
|
6
|
+
if (Array.isArray(message)) {
|
|
7
|
+
log('nestjs-prisma-graphql:');
|
|
8
|
+
log(message.join('\n'));
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
log(`nestjs-prisma-graphql: ${message}`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=warning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warning.js","sourceRoot":"","sources":["../../src/handlers/warning.ts"],"names":[],"mappings":"AAGA,MAAM,aAAa,GAAgC,UAAU,CAAC,OAAO,CAAC;AACtE,MAAM,GAAG,GAAgB,CAAC,GAAW,EAAQ,EAAE;IAC7C,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,UAAU,OAAO,CAAC,OAA0B;IAChD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,GAAG,CAAC,wBAAwB,CAAC,CAAC;QAC9B,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1B,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,0BAA0B,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-comment.d.ts","sourceRoot":"","sources":["../../src/helpers/create-comment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CA2BtF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function createComment(documentation, settings) {
|
|
2
|
+
const documentationLines = documentation.split('\n');
|
|
3
|
+
const commentLines = ['/**'];
|
|
4
|
+
for (const line of documentationLines) {
|
|
5
|
+
commentLines.push(` * ${line}`);
|
|
6
|
+
}
|
|
7
|
+
const fieldArgs = settings?.fieldArguments();
|
|
8
|
+
let deprecationReason;
|
|
9
|
+
if (fieldArgs === undefined) {
|
|
10
|
+
deprecationReason = undefined;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
deprecationReason = fieldArgs.deprecationReason;
|
|
14
|
+
}
|
|
15
|
+
if (deprecationReason !== undefined &&
|
|
16
|
+
deprecationReason !== null &&
|
|
17
|
+
deprecationReason.length > 0) {
|
|
18
|
+
commentLines.push(` * @deprecated ${deprecationReason}`);
|
|
19
|
+
}
|
|
20
|
+
commentLines.push(' */\n');
|
|
21
|
+
return commentLines.join('\n');
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=create-comment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-comment.js","sourceRoot":"","sources":["../../src/helpers/create-comment.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,aAAa,CAAC,aAAqB,EAAE,QAAyB;IAC5E,MAAM,kBAAkB,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,YAAY,GAAG,CAAC,KAAK,CAAC,CAAC;IAE7B,KAAK,MAAM,IAAI,IAAI,kBAAkB,EAAE,CAAC;QACtC,YAAY,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,SAAS,GAAG,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC7C,IAAI,iBAAqC,CAAC;IAC1C,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,iBAAiB,GAAG,SAAS,CAAC;IAChC,CAAC;SAAM,CAAC;QACN,iBAAiB,GAAG,SAAS,CAAC,iBAAuC,CAAC;IACxE,CAAC;IAED,IACE,iBAAiB,KAAK,SAAS;QAC/B,iBAAiB,KAAK,IAAI;QAC1B,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAC5B,CAAC;QACD,YAAY,CAAC,IAAI,CAAC,kBAAkB,iBAAiB,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE3B,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ImportNameSpec, ObjectSetting } from '../types.js';
|
|
2
|
+
import { ReExport } from '../handlers/re-export.js';
|
|
3
|
+
type ConfigFieldSetting = Partial<Omit<ObjectSetting, 'name'>>;
|
|
4
|
+
interface DecorateElement {
|
|
5
|
+
isMatchField: (s: string) => boolean;
|
|
6
|
+
isMatchType: (s: string) => boolean;
|
|
7
|
+
from: string;
|
|
8
|
+
name: string;
|
|
9
|
+
arguments?: string[];
|
|
10
|
+
namedImport: boolean;
|
|
11
|
+
defaultImport?: string | true;
|
|
12
|
+
namespaceImport?: string;
|
|
13
|
+
}
|
|
14
|
+
interface CustomImport {
|
|
15
|
+
from: string;
|
|
16
|
+
name: string;
|
|
17
|
+
namedImport: boolean;
|
|
18
|
+
defaultImport?: string | true;
|
|
19
|
+
namespaceImport?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function createConfig(data: Record<string, unknown>): {
|
|
22
|
+
$warnings: string[];
|
|
23
|
+
combineScalarFilters: boolean;
|
|
24
|
+
customImport: CustomImport[];
|
|
25
|
+
decorate: DecorateElement[];
|
|
26
|
+
emitBlocks: Record<string, boolean>;
|
|
27
|
+
emitCompiled: boolean;
|
|
28
|
+
emitSingle: boolean;
|
|
29
|
+
esmCompatible: boolean;
|
|
30
|
+
esmSuppressTypeErrors: boolean;
|
|
31
|
+
fields: Record<string, ConfigFieldSetting | undefined>;
|
|
32
|
+
graphqlScalars: Record<string, ImportNameSpec | undefined>;
|
|
33
|
+
noAtomicOperations: boolean;
|
|
34
|
+
noTypeId: boolean;
|
|
35
|
+
omitModelsCount: boolean;
|
|
36
|
+
outputFilePattern: string;
|
|
37
|
+
prismaClientImport: string;
|
|
38
|
+
purgeOutput: boolean;
|
|
39
|
+
reExport: ReExport;
|
|
40
|
+
requireSingleFieldsInWhereUniqueInput: boolean;
|
|
41
|
+
tsConfigFilePath: string | undefined;
|
|
42
|
+
unsafeCompatibleWhereUniqueInput: boolean;
|
|
43
|
+
useInputType: ConfigInputItem[];
|
|
44
|
+
};
|
|
45
|
+
interface ConfigInputItem {
|
|
46
|
+
typeName: string;
|
|
47
|
+
ALL?: string;
|
|
48
|
+
[index: string]: string | undefined;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=create-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-config.d.ts","sourceRoot":"","sources":["../../src/helpers/create-config.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,KAAK,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/D,UAAU,eAAe;IACvB,YAAY,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IACr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