prisma-nestjs-graphql 21.2.0 → 22.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.
package/generate.d.ts DELETED
@@ -1,530 +0,0 @@
1
- import { GeneratorOptions } from '@prisma/generator-helper';
2
- import AwaitEventEmitter from 'await-event-emitter';
3
- import { Project, SourceFile } from 'ts-morph';
4
-
5
- declare type Datamodel = ReadonlyDeep_2<{
6
- models: Model$1[];
7
- enums: DatamodelEnum[];
8
- types: Model$1[];
9
- indexes: Index[];
10
- }>;
11
-
12
- declare type DatamodelEnum = ReadonlyDeep_2<{
13
- name: string;
14
- values: EnumValue[];
15
- dbName?: string | null;
16
- documentation?: string;
17
- }>;
18
-
19
- declare function datamodelEnumToSchemaEnum(datamodelEnum: DatamodelEnum): SchemaEnum;
20
-
21
- declare type Deprecation = ReadonlyDeep_2<{
22
- sinceVersion: string;
23
- reason: string;
24
- plannedRemovalVersion?: string;
25
- }>;
26
-
27
- declare namespace DMMF {
28
- export { datamodelEnumToSchemaEnum, type Document_2 as Document, type Mappings, type OtherOperationMappings, type DatamodelEnum, type SchemaEnum, type EnumValue, type Datamodel, type uniqueIndex, type PrimaryKey, type Model$1 as Model, type FieldKind, type FieldNamespace, type FieldLocation, type Field$1 as Field, type FieldDefault, type FieldDefaultScalar, type Index, type IndexType, type IndexField, type SortOrder, type Schema$1 as Schema, type Query, type QueryOutput, type TypeRef, type InputTypeRef, type SchemaArg, type OutputType, type SchemaField, type OutputTypeRef, type Deprecation, type InputType, type FieldRefType, type FieldRefAllowType, type ModelMapping, ModelAction }
29
- }
30
-
31
- declare type Document_2 = ReadonlyDeep_2<{
32
- datamodel: Datamodel;
33
- schema: Schema$1;
34
- mappings: Mappings;
35
- }>;
36
-
37
- declare type EnumValue = ReadonlyDeep_2<{
38
- name: string;
39
- dbName: string | null;
40
- }>;
41
-
42
- declare type Field$1 = ReadonlyDeep_2<{
43
- kind: FieldKind;
44
- name: string;
45
- isRequired: boolean;
46
- isList: boolean;
47
- isUnique: boolean;
48
- isId: boolean;
49
- isReadOnly: boolean;
50
- isGenerated?: boolean;
51
- isUpdatedAt?: boolean;
52
- /**
53
- * Describes the data type in the same the way it is defined in the Prisma schema:
54
- * BigInt, Boolean, Bytes, DateTime, Decimal, Float, Int, JSON, String, $ModelName
55
- */
56
- type: string;
57
- /**
58
- * Native database type, if specified.
59
- * For example, `@db.VarChar(191)` is encoded as `['VarChar', ['191']]`,
60
- * `@db.Text` is encoded as `['Text', []]`.
61
- */
62
- nativeType?: [string, string[]] | null;
63
- dbName?: string | null;
64
- hasDefaultValue: boolean;
65
- default?: FieldDefault | FieldDefaultScalar | FieldDefaultScalar[];
66
- relationFromFields?: string[];
67
- relationToFields?: string[];
68
- relationOnDelete?: string;
69
- relationOnUpdate?: string;
70
- relationName?: string;
71
- documentation?: string;
72
- }>;
73
-
74
- declare type FieldDefault = ReadonlyDeep_2<{
75
- name: string;
76
- args: Array<string | number>;
77
- }>;
78
-
79
- declare type FieldDefaultScalar = string | boolean | number;
80
-
81
- declare type FieldKind = 'scalar' | 'object' | 'enum' | 'unsupported';
82
-
83
- declare type FieldLocation = 'scalar' | 'inputObjectTypes' | 'outputObjectTypes' | 'enumTypes' | 'fieldRefTypes';
84
-
85
- declare type FieldNamespace = 'model' | 'prisma';
86
-
87
- declare type FieldRefAllowType = TypeRef<'scalar' | 'enumTypes'>;
88
-
89
- declare type FieldRefType = ReadonlyDeep_2<{
90
- name: string;
91
- allowTypes: FieldRefAllowType[];
92
- fields: SchemaArg[];
93
- }>;
94
-
95
- declare type Index = ReadonlyDeep_2<{
96
- model: string;
97
- type: IndexType;
98
- isDefinedOnField: boolean;
99
- name?: string;
100
- dbName?: string;
101
- algorithm?: string;
102
- clustered?: boolean;
103
- fields: IndexField[];
104
- }>;
105
-
106
- declare type IndexField = ReadonlyDeep_2<{
107
- name: string;
108
- sortOrder?: SortOrder;
109
- length?: number;
110
- operatorClass?: string;
111
- }>;
112
-
113
- declare type IndexType = 'id' | 'normal' | 'unique' | 'fulltext';
114
-
115
- declare type InputType = ReadonlyDeep_2<{
116
- name: string;
117
- constraints: {
118
- maxNumFields: number | null;
119
- minNumFields: number | null;
120
- fields?: string[];
121
- };
122
- meta?: {
123
- source?: string;
124
- grouping?: string;
125
- };
126
- fields: SchemaArg[];
127
- }>;
128
-
129
- declare type InputTypeRef = TypeRef<'scalar' | 'inputObjectTypes' | 'enumTypes' | 'fieldRefTypes'>;
130
-
131
- declare type Mappings = ReadonlyDeep_2<{
132
- modelOperations: ModelMapping[];
133
- otherOperations: {
134
- read: string[];
135
- write: string[];
136
- };
137
- }>;
138
-
139
- declare type Model$1 = ReadonlyDeep_2<{
140
- name: string;
141
- dbName: string | null;
142
- schema: string | null;
143
- fields: Field$1[];
144
- uniqueFields: string[][];
145
- uniqueIndexes: uniqueIndex[];
146
- documentation?: string;
147
- primaryKey: PrimaryKey | null;
148
- isGenerated?: boolean;
149
- }>;
150
-
151
- declare enum ModelAction {
152
- findUnique = "findUnique",
153
- findUniqueOrThrow = "findUniqueOrThrow",
154
- findFirst = "findFirst",
155
- findFirstOrThrow = "findFirstOrThrow",
156
- findMany = "findMany",
157
- create = "create",
158
- createMany = "createMany",
159
- createManyAndReturn = "createManyAndReturn",
160
- update = "update",
161
- updateMany = "updateMany",
162
- updateManyAndReturn = "updateManyAndReturn",
163
- upsert = "upsert",
164
- delete = "delete",
165
- deleteMany = "deleteMany",
166
- groupBy = "groupBy",
167
- count = "count",// TODO: count does not actually exist in DMMF
168
- aggregate = "aggregate",
169
- findRaw = "findRaw",
170
- aggregateRaw = "aggregateRaw"
171
- }
172
-
173
- declare type ModelMapping = ReadonlyDeep_2<{
174
- model: string;
175
- plural: string;
176
- findUnique?: string | null;
177
- findUniqueOrThrow?: string | null;
178
- findFirst?: string | null;
179
- findFirstOrThrow?: string | null;
180
- findMany?: string | null;
181
- create?: string | null;
182
- createMany?: string | null;
183
- createManyAndReturn?: string | null;
184
- update?: string | null;
185
- updateMany?: string | null;
186
- updateManyAndReturn?: string | null;
187
- upsert?: string | null;
188
- delete?: string | null;
189
- deleteMany?: string | null;
190
- aggregate?: string | null;
191
- groupBy?: string | null;
192
- count?: string | null;
193
- findRaw?: string | null;
194
- aggregateRaw?: string | null;
195
- }>;
196
-
197
- declare type OtherOperationMappings = ReadonlyDeep_2<{
198
- read: string[];
199
- write: string[];
200
- }>;
201
-
202
- declare type OutputType = ReadonlyDeep_2<{
203
- name: string;
204
- fields: SchemaField[];
205
- }>;
206
-
207
- declare type OutputTypeRef = TypeRef<'scalar' | 'outputObjectTypes' | 'enumTypes'>;
208
-
209
- declare type PrimaryKey = ReadonlyDeep_2<{
210
- name: string | null;
211
- fields: string[];
212
- }>;
213
-
214
- declare type Query = ReadonlyDeep_2<{
215
- name: string;
216
- args: SchemaArg[];
217
- output: QueryOutput;
218
- }>;
219
-
220
- declare type QueryOutput = ReadonlyDeep_2<{
221
- name: string;
222
- isRequired: boolean;
223
- isList: boolean;
224
- }>;
225
-
226
- declare type ReadonlyDeep_2<O> = {
227
- +readonly [K in keyof O]: ReadonlyDeep_2<O[K]>;
228
- };
229
-
230
- declare type Schema$1 = ReadonlyDeep_2<{
231
- rootQueryType?: string;
232
- rootMutationType?: string;
233
- inputObjectTypes: {
234
- model?: InputType[];
235
- prisma: InputType[];
236
- };
237
- outputObjectTypes: {
238
- model: OutputType[];
239
- prisma: OutputType[];
240
- };
241
- enumTypes: {
242
- model?: SchemaEnum[];
243
- prisma: SchemaEnum[];
244
- };
245
- fieldRefTypes: {
246
- prisma?: FieldRefType[];
247
- };
248
- }>;
249
-
250
- declare type SchemaArg = ReadonlyDeep_2<{
251
- name: string;
252
- comment?: string;
253
- isNullable: boolean;
254
- isRequired: boolean;
255
- inputTypes: InputTypeRef[];
256
- deprecation?: Deprecation;
257
- }>;
258
-
259
- declare type SchemaEnum = ReadonlyDeep_2<{
260
- name: string;
261
- values: string[];
262
- }>;
263
-
264
- declare type SchemaField = ReadonlyDeep_2<{
265
- name: string;
266
- isNullable?: boolean;
267
- outputType: OutputTypeRef;
268
- args: SchemaArg[];
269
- deprecation?: Deprecation;
270
- documentation?: string;
271
- }>;
272
-
273
- declare type SortOrder = 'asc' | 'desc';
274
-
275
- declare type TypeRef<AllowedLocations extends FieldLocation> = {
276
- isList: boolean;
277
- type: string;
278
- location: AllowedLocations;
279
- namespace?: FieldNamespace;
280
- };
281
-
282
- declare type uniqueIndex = ReadonlyDeep_2<{
283
- name: string;
284
- fields: string[];
285
- }>;
286
-
287
- /**
288
- Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
289
-
290
- @category Type
291
- */
292
- type Primitive =
293
- | null
294
- | undefined
295
- | string
296
- | number
297
- | boolean
298
- | symbol
299
- | bigint;
300
-
301
- declare global {
302
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
303
- interface SymbolConstructor {
304
- readonly observable: symbol;
305
- }
306
- }
307
-
308
- /**
309
- Matches any primitive, `void`, `Date`, or `RegExp` value.
310
- */
311
- type BuiltIns = Primitive | void | Date | RegExp;
312
-
313
- /**
314
- Test if the given function has multiple call signatures.
315
-
316
- Needed to handle the case of a single call signature with properties.
317
-
318
- Multiple call signatures cannot currently be supported due to a TypeScript limitation.
319
- @see https://github.com/microsoft/TypeScript/issues/29732
320
- */
321
- type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> =
322
- T extends {(...arguments_: infer A): unknown; (...arguments_: infer B): unknown}
323
- ? B extends A
324
- ? A extends B
325
- ? false
326
- : true
327
- : true
328
- : false;
329
-
330
- /**
331
- Create a deeply mutable version of an `object`/`ReadonlyMap`/`ReadonlySet`/`ReadonlyArray` type. The inverse of `ReadonlyDeep<T>`. Use `Writable<T>` if you only need one level deep.
332
-
333
- This can be used to [store and mutate options within a class](https://github.com/sindresorhus/pageres/blob/4a5d05fca19a5fbd2f53842cbf3eb7b1b63bddd2/source/index.ts#L72), [edit `readonly` objects within tests](https://stackoverflow.com/questions/50703834), [construct a `readonly` object within a function](https://github.com/Microsoft/TypeScript/issues/24509), or to define a single model where the only thing that changes is whether or not some of the keys are writable.
334
-
335
- @example
336
- ```
337
- import type {WritableDeep} from 'type-fest';
338
-
339
- type Foo = {
340
- readonly a: number;
341
- readonly b: readonly string[]; // To show that mutability is deeply affected.
342
- readonly c: boolean;
343
- };
344
-
345
- const writableDeepFoo: WritableDeep<Foo> = {a: 1, b: ['2'], c: true};
346
- writableDeepFoo.a = 3;
347
- writableDeepFoo.b[0] = 'new value';
348
- writableDeepFoo.b = ['something'];
349
- ```
350
-
351
- Note that types containing overloaded functions are not made deeply writable due to a [TypeScript limitation](https://github.com/microsoft/TypeScript/issues/29732).
352
-
353
- @see Writable
354
- @category Object
355
- @category Array
356
- @category Set
357
- @category Map
358
- */
359
- type WritableDeep<T> = T extends BuiltIns
360
- ? T
361
- : T extends (...arguments_: any[]) => unknown
362
- ? {} extends WritableObjectDeep<T>
363
- ? T
364
- : HasMultipleCallSignatures<T> extends true
365
- ? T
366
- : ((...arguments_: Parameters<T>) => ReturnType<T>) & WritableObjectDeep<T>
367
- : T extends ReadonlyMap<unknown, unknown>
368
- ? WritableMapDeep<T>
369
- : T extends ReadonlySet<unknown>
370
- ? WritableSetDeep<T>
371
- : T extends readonly unknown[]
372
- ? WritableArrayDeep<T>
373
- : T extends object
374
- ? WritableObjectDeep<T>
375
- : unknown;
376
-
377
- /**
378
- Same as `WritableDeep`, but accepts only `Map`s as inputs. Internal helper for `WritableDeep`.
379
- */
380
- type WritableMapDeep<MapType extends ReadonlyMap<unknown, unknown>> =
381
- MapType extends ReadonlyMap<infer KeyType, infer ValueType>
382
- ? Map<WritableDeep<KeyType>, WritableDeep<ValueType>>
383
- : MapType; // Should not heppen
384
-
385
- /**
386
- Same as `WritableDeep`, but accepts only `Set`s as inputs. Internal helper for `WritableDeep`.
387
- */
388
- type WritableSetDeep<SetType extends ReadonlySet<unknown>> =
389
- SetType extends ReadonlySet<infer ItemType>
390
- ? Set<WritableDeep<ItemType>>
391
- : SetType; // Should not heppen
392
-
393
- /**
394
- Same as `WritableDeep`, but accepts only `object`s as inputs. Internal helper for `WritableDeep`.
395
- */
396
- type WritableObjectDeep<ObjectType extends object> = {
397
- -readonly [KeyType in keyof ObjectType]: WritableDeep<ObjectType[KeyType]>
398
- };
399
-
400
- /**
401
- Same as `WritableDeep`, but accepts only `Array`s as inputs. Internal helper for `WritableDeep`.
402
- */
403
- type WritableArrayDeep<ArrayType extends readonly unknown[]> =
404
- ArrayType extends readonly [] ? []
405
- : ArrayType extends readonly [...infer U, infer V] ? [...WritableArrayDeep<U>, WritableDeep<V>]
406
- : ArrayType extends readonly [infer U, ...infer V] ? [WritableDeep<U>, ...WritableArrayDeep<V>]
407
- : ArrayType extends ReadonlyArray<infer U> ? Array<WritableDeep<U>>
408
- : ArrayType extends Array<infer U> ? Array<WritableDeep<U>>
409
- : ArrayType;
410
-
411
- declare enum ReExport {
412
- None = "None",
413
- Directories = "Directories",
414
- Single = "Single",
415
- All = "All"
416
- }
417
-
418
- type DecorateElement = {
419
- isMatchField: (s: string) => boolean;
420
- isMatchType: (s: string) => boolean;
421
- from: string;
422
- name: string;
423
- arguments?: string[];
424
- namedImport: boolean;
425
- defaultImport?: string | true;
426
- namespaceImport?: string;
427
- };
428
- type CustomImport = {
429
- from: string;
430
- name: string;
431
- namedImport: boolean;
432
- defaultImport?: string | true;
433
- namespaceImport?: string;
434
- };
435
- declare function createConfig(data: Record<string, unknown>): {
436
- outputFilePattern: string;
437
- tsConfigFilePath: string | undefined;
438
- prismaClientImport: string;
439
- combineScalarFilters: boolean;
440
- noAtomicOperations: boolean;
441
- reExport: ReExport;
442
- emitSingle: boolean;
443
- emitCompiled: boolean;
444
- emitBlocks: Record<"models" | "inputs" | "args" | "outputs" | "prismaEnums" | "schemaEnums", boolean>;
445
- omitModelsCount: boolean;
446
- $warnings: string[];
447
- fields: Record<string, Partial<Omit<ObjectSetting, "name">> | undefined>;
448
- purgeOutput: boolean;
449
- useInputType: ConfigInputItem[];
450
- noTypeId: boolean;
451
- requireSingleFieldsInWhereUniqueInput: boolean;
452
- unsafeCompatibleWhereUniqueInput: boolean;
453
- graphqlScalars: Record<string, ImportNameSpec | undefined>;
454
- decorate: DecorateElement[];
455
- customImport: CustomImport[];
456
- };
457
- type ConfigInputItem = {
458
- typeName: string;
459
- ALL?: string;
460
- [index: string]: string | undefined;
461
- };
462
-
463
- type ObjectSetting = {
464
- /**
465
- * Act as named import or namespaceImport or defaultImport
466
- */
467
- name: string;
468
- kind: 'Decorator' | 'Field' | 'FieldType' | 'PropertyType' | 'ObjectType';
469
- arguments?: string[] | Record<string, unknown>;
470
- input: boolean;
471
- output: boolean;
472
- model: boolean;
473
- match?: (test: string) => boolean;
474
- from: string;
475
- namespace?: string;
476
- defaultImport?: string | true;
477
- namespaceImport?: string;
478
- namedImport?: boolean;
479
- };
480
- interface ObjectSettingsFilterArgs {
481
- name: string;
482
- input?: boolean;
483
- output?: boolean;
484
- }
485
- declare class ObjectSettings extends Array<ObjectSetting> {
486
- shouldHideField({ name, input, output, }: ObjectSettingsFilterArgs): boolean;
487
- getFieldType({ name, input, output, }: ObjectSettingsFilterArgs): ObjectSetting | undefined;
488
- getPropertyType({ name, input, output, }: ObjectSettingsFilterArgs): ObjectSetting | undefined;
489
- getObjectTypeArguments(options: Record<string, any>): string[];
490
- fieldArguments(): Record<string, unknown> | undefined;
491
- }
492
-
493
- type Model = WritableDeep<DMMF.Model>;
494
- type Schema = WritableDeep<DMMF.Schema>;
495
- type GeneratorConfiguration = ReturnType<typeof createConfig>;
496
- type EventArguments = {
497
- schema: Schema;
498
- models: Map<string, Model>;
499
- modelNames: string[];
500
- modelFields: Map<string, Map<string, Field>>;
501
- fieldSettings: Map<string, Map<string, ObjectSettings>>;
502
- config: GeneratorConfiguration;
503
- project: Project;
504
- output: string;
505
- getSourceFile(args: {
506
- type: string;
507
- name: string;
508
- }): SourceFile;
509
- eventEmitter: AwaitEventEmitter;
510
- typeNames: Set<string>;
511
- removeTypes: Set<string>;
512
- enums: Record<string, DMMF.DatamodelEnum | undefined>;
513
- getModelName(name: string): string | undefined;
514
- /**
515
- * Input types for this models should be decorated @Type(() => Self)
516
- */
517
- classTransformerTypeModels: Set<string>;
518
- };
519
- type ImportNameSpec = {
520
- name: string;
521
- specifier?: string;
522
- };
523
- type Field = DMMF.Field;
524
-
525
- declare function generate(args: GeneratorOptions & {
526
- skipAddOutputSourceFiles?: boolean;
527
- connectCallback?: (emitter: AwaitEventEmitter, eventArguments: EventArguments) => void | Promise<void>;
528
- }): Promise<void>;
529
-
530
- export { generate };
package/index.cjs DELETED
@@ -1,28 +0,0 @@
1
- 'use strict';
2
-
3
- var generatorHelper = require('@prisma/generator-helper');
4
- var generate = require('./generate.cjs');
5
- require('await-event-emitter');
6
- require('assert');
7
- require('lodash');
8
- require('ts-morph');
9
- require('json5');
10
- require('pupa');
11
- require('get-relative-path');
12
- require('outmatch');
13
- require('graceful-fs');
14
- require('filenamify');
15
- require('flat');
16
- require('pluralize');
17
-
18
- generatorHelper.generatorHandler({
19
- async onGenerate(options) {
20
- await generate.generate(options);
21
- },
22
- onManifest() {
23
- return {
24
- defaultOutput: ".",
25
- prettyName: "Prisma NestJS/GraphQL"
26
- };
27
- }
28
- });
package/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }