@pegasusheavy/nestjs-prisma-graphql 1.0.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.
@@ -0,0 +1,142 @@
1
+ import { DMMF, GeneratorOptions } from '@prisma/generator-helper';
2
+ import { Project, SourceFile } from 'ts-morph';
3
+ import { WritableDeep } from 'type-fest';
4
+
5
+ declare enum ReExport {
6
+ None = "None",
7
+ Directories = "Directories",
8
+ Single = "Single",
9
+ All = "All"
10
+ }
11
+
12
+ type DecorateElement = {
13
+ isMatchField: (s: string) => boolean;
14
+ isMatchType: (s: string) => boolean;
15
+ from: string;
16
+ name: string;
17
+ arguments?: string[];
18
+ namedImport: boolean;
19
+ defaultImport?: string | true;
20
+ namespaceImport?: string;
21
+ };
22
+ type CustomImport = {
23
+ from: string;
24
+ name: string;
25
+ namedImport: boolean;
26
+ defaultImport?: string | true;
27
+ namespaceImport?: string;
28
+ };
29
+ declare function createConfig(data: Record<string, unknown>): {
30
+ outputFilePattern: string;
31
+ tsConfigFilePath: string | undefined;
32
+ prismaClientImport: string;
33
+ combineScalarFilters: boolean;
34
+ noAtomicOperations: boolean;
35
+ reExport: ReExport;
36
+ emitSingle: boolean;
37
+ emitCompiled: boolean;
38
+ emitBlocks: Record<"models" | "inputs" | "args" | "outputs" | "prismaEnums" | "schemaEnums", boolean>;
39
+ omitModelsCount: boolean;
40
+ $warnings: string[];
41
+ fields: Record<string, Partial<Omit<ObjectSetting, "name">> | undefined>;
42
+ purgeOutput: boolean;
43
+ useInputType: ConfigInputItem[];
44
+ noTypeId: boolean;
45
+ requireSingleFieldsInWhereUniqueInput: boolean;
46
+ unsafeCompatibleWhereUniqueInput: boolean;
47
+ graphqlScalars: Record<string, ImportNameSpec | undefined>;
48
+ decorate: DecorateElement[];
49
+ customImport: CustomImport[];
50
+ esmCompatible: boolean;
51
+ };
52
+ type ConfigInputItem = {
53
+ typeName: string;
54
+ ALL?: string;
55
+ [index: string]: string | undefined;
56
+ };
57
+
58
+ type ObjectSetting = {
59
+ /**
60
+ * Act as named import or namespaceImport or defaultImport
61
+ */
62
+ name: string;
63
+ kind: 'Decorator' | 'Field' | 'FieldType' | 'PropertyType' | 'ObjectType';
64
+ arguments?: string[] | Record<string, unknown>;
65
+ input: boolean;
66
+ output: boolean;
67
+ model: boolean;
68
+ match?: (test: string) => boolean;
69
+ from: string;
70
+ namespace?: string;
71
+ defaultImport?: string | true;
72
+ namespaceImport?: string;
73
+ namedImport?: boolean;
74
+ };
75
+ interface ObjectSettingsFilterArgs {
76
+ name: string;
77
+ input?: boolean;
78
+ output?: boolean;
79
+ }
80
+ declare class ObjectSettings extends Array<ObjectSetting> {
81
+ shouldHideField({ name, input, output, }: ObjectSettingsFilterArgs): boolean;
82
+ getFieldType({ name, input, output, }: ObjectSettingsFilterArgs): ObjectSetting | undefined;
83
+ getPropertyType({ name, input, output, }: ObjectSettingsFilterArgs): ObjectSetting | undefined;
84
+ getObjectTypeArguments(options: Record<string, unknown>): string[];
85
+ fieldArguments(): Record<string, unknown> | undefined;
86
+ }
87
+
88
+ /**
89
+ * Event emitter interface for type safety across ESM modules
90
+ */
91
+ interface EventEmitter {
92
+ on(type: string | symbol, fn: Function): this;
93
+ once(type: string | symbol, fn: Function): this;
94
+ off(type: string | symbol, nullOrFn?: Function): boolean;
95
+ emit(type: string | symbol, ...args: unknown[]): Promise<boolean>;
96
+ emitSync(type: string | symbol, ...args: unknown[]): boolean;
97
+ removeAllListeners(): void;
98
+ listeners(type: string | symbol): Function[];
99
+ }
100
+ type Model = WritableDeep<DMMF.Model>;
101
+ type Schema = WritableDeep<DMMF.Schema>;
102
+ type GeneratorConfiguration = ReturnType<typeof createConfig>;
103
+ type EventArguments = {
104
+ schema: Schema;
105
+ models: Map<string, Model>;
106
+ modelNames: string[];
107
+ modelFields: Map<string, Map<string, Field>>;
108
+ fieldSettings: Map<string, Map<string, ObjectSettings>>;
109
+ config: GeneratorConfiguration;
110
+ project: Project;
111
+ output: string;
112
+ getSourceFile(args: {
113
+ type: string;
114
+ name: string;
115
+ }): SourceFile;
116
+ eventEmitter: EventEmitter;
117
+ typeNames: Set<string>;
118
+ removeTypes: Set<string>;
119
+ enums: Record<string, DMMF.DatamodelEnum | undefined>;
120
+ getModelName(name: string): string | undefined;
121
+ /**
122
+ * Input types for this models should be decorated @Type(() => Self)
123
+ */
124
+ classTransformerTypeModels: Set<string>;
125
+ /**
126
+ * Set of model pairs that have circular dependencies (for ESM compatibility)
127
+ * Format: "ModelA:ModelB" where ModelA < ModelB alphabetically
128
+ */
129
+ circularDependencies: Set<string>;
130
+ };
131
+ type ImportNameSpec = {
132
+ name: string;
133
+ specifier?: string;
134
+ };
135
+ type Field = DMMF.Field;
136
+
137
+ declare function generate(args: GeneratorOptions & {
138
+ skipAddOutputSourceFiles?: boolean;
139
+ connectCallback?: (emitter: EventEmitter, eventArguments: EventArguments) => void | Promise<void>;
140
+ }): Promise<void>;
141
+
142
+ export { generate };