@prisma/cli 2.20.0 → 3.0.0-alpha.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.
Files changed (183) hide show
  1. package/LICENSE +158 -0
  2. package/README.md +29 -28
  3. package/dist/adapters/config.js +74 -0
  4. package/dist/adapters/local-state.js +98 -0
  5. package/dist/adapters/mock-api.js +57 -0
  6. package/dist/adapters/token-storage.js +43 -0
  7. package/dist/cli.js +9 -0
  8. package/dist/cli2.js +59 -0
  9. package/dist/commands/app/index.js +223 -0
  10. package/dist/commands/auth/index.js +42 -0
  11. package/dist/commands/branch/index.js +51 -0
  12. package/dist/commands/project/index.js +45 -0
  13. package/dist/controllers/app.js +813 -0
  14. package/dist/controllers/auth.js +107 -0
  15. package/dist/controllers/branch.js +73 -0
  16. package/dist/controllers/project.js +214 -0
  17. package/dist/controllers/select-prompt-port.js +12 -0
  18. package/dist/lib/app/bun-project.js +39 -0
  19. package/dist/lib/app/env-vars.js +24 -0
  20. package/dist/lib/app/local-dev.js +149 -0
  21. package/dist/lib/app/preview-build.js +283 -0
  22. package/dist/lib/app/preview-interaction.js +38 -0
  23. package/dist/lib/app/preview-progress.js +139 -0
  24. package/dist/lib/app/preview-provider.js +232 -0
  25. package/dist/lib/auth/auth-ops.js +57 -0
  26. package/dist/lib/auth/client.js +22 -0
  27. package/dist/lib/auth/guard.js +34 -0
  28. package/dist/lib/auth/login.js +117 -0
  29. package/dist/output/patterns.js +93 -0
  30. package/dist/presenters/app.js +405 -0
  31. package/dist/presenters/auth.js +73 -0
  32. package/dist/presenters/branch.js +111 -0
  33. package/dist/presenters/project.js +84 -0
  34. package/dist/shell/command-meta.js +320 -0
  35. package/dist/shell/command-runner.js +33 -0
  36. package/dist/shell/errors.js +66 -0
  37. package/dist/shell/global-flags.js +25 -0
  38. package/dist/shell/help.js +78 -0
  39. package/dist/shell/output.js +54 -0
  40. package/dist/shell/prompt.js +31 -0
  41. package/dist/shell/runtime.js +51 -0
  42. package/dist/shell/ui.js +59 -0
  43. package/dist/use-cases/auth.js +70 -0
  44. package/dist/use-cases/branch.js +95 -0
  45. package/dist/use-cases/create-cli-gateways.js +93 -0
  46. package/dist/use-cases/project.js +75 -0
  47. package/package.json +49 -137
  48. package/build/child.js +0 -4110
  49. package/build/index.js +0 -104447
  50. package/build/public/demo.html +0 -17
  51. package/build/public/demoChunk.js +0 -2
  52. package/build/public/electron-darwin.html +0 -19
  53. package/build/public/electron-linux.html +0 -18
  54. package/build/public/electron-mac.html +0 -18
  55. package/build/public/electron-win.html +0 -17
  56. package/build/public/electron-win32.html +0 -18
  57. package/build/public/electron.html +0 -17
  58. package/build/public/electronBus.js +0 -2
  59. package/build/public/electronChunk.js +0 -2
  60. package/build/public/favicon/apple-touch-icon.png +0 -0
  61. package/build/public/favicon/favicon-16x16.png +0 -0
  62. package/build/public/favicon/favicon-32x32.png +0 -0
  63. package/build/public/favicon/prisma.png +0 -0
  64. package/build/public/fonts/Inter.ttf +0 -0
  65. package/build/public/fonts/RobotoMono.ttf +0 -0
  66. package/build/public/icons/.DS_Store +0 -0
  67. package/build/public/icons/alert.svg +0 -5
  68. package/build/public/icons/array.svg +0 -4
  69. package/build/public/icons/bin.svg +0 -37
  70. package/build/public/icons/boolean.svg +0 -4
  71. package/build/public/icons/check.svg +0 -3
  72. package/build/public/icons/chevron-down.svg +0 -3
  73. package/build/public/icons/code.svg +0 -4
  74. package/build/public/icons/cross.svg +0 -11
  75. package/build/public/icons/data-tool.svg +0 -5
  76. package/build/public/icons/database.svg +0 -4
  77. package/build/public/icons/datetime.svg +0 -4
  78. package/build/public/icons/double-arrow-right.svg +0 -4
  79. package/build/public/icons/download.svg +0 -4
  80. package/build/public/icons/ellipsis.svg +0 -10
  81. package/build/public/icons/enum.svg +0 -6
  82. package/build/public/icons/expand.svg +0 -4
  83. package/build/public/icons/eye.svg +0 -20
  84. package/build/public/icons/filters.svg +0 -5
  85. package/build/public/icons/folder.svg +0 -6
  86. package/build/public/icons/hamburger.svg +0 -4
  87. package/build/public/icons/icon.svg +0 -199
  88. package/build/public/icons/logo.svg +0 -199
  89. package/build/public/icons/logotype.svg +0 -4
  90. package/build/public/icons/number.svg +0 -7
  91. package/build/public/icons/object.svg +0 -5
  92. package/build/public/icons/play.svg +0 -6
  93. package/build/public/icons/plus.svg +0 -4
  94. package/build/public/icons/refresh.svg +0 -4
  95. package/build/public/icons/search.svg +0 -7
  96. package/build/public/icons/settings.svg +0 -8
  97. package/build/public/icons/string.svg +0 -4
  98. package/build/public/icons/tick-indeterminate.svg +0 -3
  99. package/build/public/icons/tick.svg +0 -4
  100. package/build/public/illustrations/.DS_Store +0 -0
  101. package/build/public/illustrations/empty.svg +0 -1
  102. package/build/public/illustrations/read.svg +0 -1
  103. package/build/public/illustrations/searching.svg +0 -1
  104. package/build/public/images/.DS_Store +0 -0
  105. package/build/public/images/icon-1024.png +0 -0
  106. package/build/public/index.html +0 -49
  107. package/build/public/main.31f688a6254e294d9128.css +0 -118
  108. package/build/public/main.31f688a6254e294d9128.css.map +0 -1
  109. package/build/public/main.364c712f32662ff0e43d.css +0 -116
  110. package/build/public/main.364c712f32662ff0e43d.css.map +0 -1
  111. package/build/public/main.42ef3fe7e97347765c91.css +0 -118
  112. package/build/public/main.42ef3fe7e97347765c91.css.map +0 -1
  113. package/build/public/main.503446defafe7aeca2f3.css +0 -116
  114. package/build/public/main.503446defafe7aeca2f3.css.map +0 -1
  115. package/build/public/main.c50a3b5980fe26f78b65.css +0 -118
  116. package/build/public/main.c50a3b5980fe26f78b65.css.map +0 -1
  117. package/build/public/main.cda25e5813776c2af295.css +0 -116
  118. package/build/public/main.cda25e5813776c2af295.css.map +0 -1
  119. package/build/public/main.dbac3b290f78404ff579.css +0 -116
  120. package/build/public/main.dbac3b290f78404ff579.css.map +0 -1
  121. package/build/public/main.f8ce44e122e5e2b8f778.css +0 -118
  122. package/build/public/main.f8ce44e122e5e2b8f778.css.map +0 -1
  123. package/build/public/main.fc9ea7521a4aecce1a77.css +0 -118
  124. package/build/public/main.fc9ea7521a4aecce1a77.css.map +0 -1
  125. package/build/public/main.js +0 -403
  126. package/build/public/main.js.map +0 -1
  127. package/build/public/mainChunk.0a84f3ba4d2ab481e877.css +0 -116
  128. package/build/public/mainChunk.1b327d58afbddc917bce.css +0 -118
  129. package/build/public/mainChunk.2cdf583b2bd51aa67587.css +0 -118
  130. package/build/public/mainChunk.544af00f7e9ffcbe782c.css +0 -118
  131. package/build/public/mainChunk.56f96a13868b2b4a53be.css +0 -118
  132. package/build/public/mainChunk.5cee429bfbf06e7ecb39.css +0 -118
  133. package/build/public/mainChunk.a862474ed4cdb421ffa2.css +0 -118
  134. package/build/public/mainChunk.ada34153c4911b5ac22b.css +0 -118
  135. package/build/public/mainChunk.c16a8d01b2c49b2f2751.css +0 -118
  136. package/build/public/mainChunk.ca4a878d5478b9320be8.css +0 -116
  137. package/build/public/mainChunk.e3adc8758b4395546cef.css +0 -116
  138. package/build/public/mainChunk.f2c59fcbfc455d8b9de5.css +0 -118
  139. package/build/public/mainChunk.js +0 -396
  140. package/build/public/preview.html +0 -16
  141. package/build/public/previewBus.js +0 -2
  142. package/build/public/previewChunk.js +0 -2
  143. package/build/public/projects.html +0 -86
  144. package/build/public/server.html +0 -16
  145. package/build/public/serverBus.js +0 -2
  146. package/build/public/serverChunk.js +0 -2
  147. package/build/public/splash.html +0 -17
  148. package/build/public/studioBundle.828f34b1781061528841.css +0 -118
  149. package/build/public/studioBundle.bfe9138b2e0293fcb7da.css +0 -118
  150. package/build/public/studioBundle.c5b256eede880e502aac.css +0 -118
  151. package/build/public/studioBundle.e43df511c8e2e368900a.css +0 -118
  152. package/build/public/studioBundle.e69382554c2a2942ae32.css +0 -118
  153. package/build/public/studioBundle.ee21aa56a3999a2b380b.css +0 -118
  154. package/build/public/studioBundle.js +0 -396
  155. package/build/public/vercel.html +0 -16
  156. package/build/public/vercelChunk.js +0 -2
  157. package/build/xdg-open +0 -1066
  158. package/install/index.js +0 -5
  159. package/preinstall/index.js +0 -71
  160. package/prisma-client/README.md +0 -27
  161. package/prisma-client/generator-build/.DS_Store +0 -0
  162. package/prisma-client/generator-build/index.js +0 -79697
  163. package/prisma-client/index-browser.js +0 -3
  164. package/prisma-client/index.d.ts +0 -1
  165. package/prisma-client/index.js +0 -11
  166. package/prisma-client/package.json +0 -138
  167. package/prisma-client/runtime/index-browser.d.ts +0 -267
  168. package/prisma-client/runtime/index-browser.js +0 -2273
  169. package/prisma-client/runtime/index.d.ts +0 -1018
  170. package/prisma-client/runtime/index.js +0 -35028
  171. package/prisma-client/scripts/backup-index-browser.js +0 -3
  172. package/prisma-client/scripts/backup-index.d.ts +0 -1
  173. package/prisma-client/scripts/backup-index.js +0 -11
  174. package/prisma-client/scripts/colors.js +0 -180
  175. package/prisma-client/scripts/default-index-browser.js +0 -12
  176. package/prisma-client/scripts/default-index.d.ts +0 -47
  177. package/prisma-client/scripts/default-index.js +0 -12
  178. package/prisma-client/scripts/get-packed-client.js +0 -12
  179. package/prisma-client/scripts/mock-fs.js +0 -14
  180. package/prisma-client/scripts/postinstall.d.ts +0 -5
  181. package/prisma-client/scripts/postinstall.js +0 -398
  182. package/scripts/install-entry.js +0 -8
  183. package/scripts/preinstall-entry.js +0 -9
@@ -1,1018 +0,0 @@
1
- /// <reference types="node" />
2
- import { inspect } from 'util';
3
-
4
- declare namespace DMMF {
5
- interface Document {
6
- datamodel: Datamodel;
7
- schema: Schema;
8
- mappings: Mappings;
9
- }
10
- interface Mappings {
11
- modelOperations: ModelMapping[];
12
- otherOperations: {
13
- read: string[];
14
- write: string[];
15
- };
16
- }
17
- interface OtherOperationMappings {
18
- read: string[];
19
- write: string[];
20
- }
21
- interface DatamodelEnum {
22
- name: string;
23
- values: EnumValue[];
24
- dbName?: string | null;
25
- documentation?: string;
26
- }
27
- interface SchemaEnum {
28
- name: string;
29
- values: string[];
30
- }
31
- interface EnumValue {
32
- name: string;
33
- dbName: string | null;
34
- }
35
- interface Datamodel {
36
- models: Model[];
37
- enums: DatamodelEnum[];
38
- }
39
- interface uniqueIndex {
40
- name: string;
41
- fields: string[];
42
- }
43
- interface Model {
44
- name: string;
45
- isEmbedded: boolean;
46
- dbName: string | null;
47
- fields: Field[];
48
- fieldMap?: Record<string, Field>;
49
- uniqueFields: string[][];
50
- uniqueIndexes: uniqueIndex[];
51
- documentation?: string;
52
- idFields: string[];
53
- [key: string]: any;
54
- }
55
- type FieldKind = 'scalar' | 'object' | 'enum' | 'unsupported';
56
- type FieldNamespace = 'model' | 'prisma';
57
- type FieldLocation = 'scalar' | 'inputObjectTypes' | 'outputObjectTypes' | 'enumTypes';
58
- interface Field {
59
- kind: FieldKind;
60
- name: string;
61
- isRequired: boolean;
62
- isList: boolean;
63
- isUnique: boolean;
64
- isId: boolean;
65
- type: string;
66
- dbNames?: string[] | null;
67
- isGenerated: boolean;
68
- hasDefaultValue: boolean;
69
- default?: FieldDefault | string | boolean | number;
70
- relationToFields?: any[];
71
- relationOnDelete?: string;
72
- relationName?: string;
73
- documentation?: string;
74
- [key: string]: any;
75
- }
76
- interface FieldDefault {
77
- name: string;
78
- args: any[];
79
- }
80
- interface Schema {
81
- rootQueryType?: string;
82
- rootMutationType?: string;
83
- inputObjectTypes: {
84
- model?: InputType[];
85
- prisma: InputType[];
86
- };
87
- outputObjectTypes: {
88
- model: OutputType[];
89
- prisma: OutputType[];
90
- };
91
- enumTypes: {
92
- model?: SchemaEnum[];
93
- prisma: SchemaEnum[];
94
- };
95
- }
96
- interface Query {
97
- name: string;
98
- args: SchemaArg[];
99
- output: QueryOutput;
100
- }
101
- interface QueryOutput {
102
- name: string;
103
- isRequired: boolean;
104
- isList: boolean;
105
- }
106
- type ArgType = string | InputType | SchemaEnum;
107
- interface SchemaArgInputType {
108
- isList: boolean;
109
- type: ArgType;
110
- location: FieldLocation;
111
- namespace?: FieldNamespace;
112
- }
113
- interface SchemaArg {
114
- name: string;
115
- comment?: string;
116
- isNullable: boolean;
117
- isRequired: boolean;
118
- inputTypes: SchemaArgInputType[];
119
- }
120
- interface OutputType {
121
- name: string;
122
- fields: SchemaField[];
123
- fieldMap?: Record<string, SchemaField>;
124
- isEmbedded?: boolean;
125
- }
126
- interface SchemaField {
127
- name: string;
128
- isNullable?: boolean;
129
- outputType: {
130
- type: string | OutputType | SchemaEnum;
131
- isList: boolean;
132
- location: FieldLocation;
133
- namespace?: FieldNamespace;
134
- };
135
- args: SchemaArg[];
136
- deprecation?: SchemaFieldDeprecation;
137
- }
138
- interface SchemaFieldDeprecation {
139
- sinceVersion: string;
140
- reason: string;
141
- plannedRemovalVersion: string;
142
- }
143
- interface InputType {
144
- name: string;
145
- constraints: {
146
- maxNumFields: number | null;
147
- minNumFields: number | null;
148
- };
149
- fields: SchemaArg[];
150
- fieldMap?: Record<string, SchemaArg>;
151
- }
152
- interface ModelMapping {
153
- model: string;
154
- plural: string;
155
- findUnique?: string | null;
156
- findFirst?: string | null;
157
- findMany?: string | null;
158
- create?: string | null;
159
- createMany?: string | null;
160
- update?: string | null;
161
- updateMany?: string | null;
162
- upsert?: string | null;
163
- delete?: string | null;
164
- deleteMany?: string | null;
165
- aggregate?: string | null;
166
- groupBy?: string | null;
167
- count?: string | null;
168
- }
169
- enum ModelAction {
170
- findUnique = "findUnique",
171
- findFirst = "findFirst",
172
- findMany = "findMany",
173
- create = "create",
174
- createMany = "createMany",
175
- update = "update",
176
- updateMany = "updateMany",
177
- upsert = "upsert",
178
- delete = "delete",
179
- deleteMany = "deleteMany",
180
- groupBy = "groupBy",
181
- count = "count",
182
- aggregate = "aggregate"
183
- }
184
- }
185
-
186
- declare type Dictionary$1<T> = {
187
- [key: string]: T;
188
- };
189
- interface GeneratorConfig {
190
- name: string;
191
- output: EnvValue | null;
192
- isCustomOutput?: boolean;
193
- provider: EnvValue;
194
- config: Dictionary$1<string>;
195
- binaryTargets: string[];
196
- previewFeatures: string[];
197
- }
198
- interface EnvValue {
199
- fromEnvVar: null | string;
200
- value: string;
201
- }
202
- declare type ConnectorType = 'mysql' | 'mongo' | 'sqlite' | 'postgresql' | 'sqlserver';
203
- interface DataSource {
204
- name: string;
205
- activeProvider: ConnectorType;
206
- provider: ConnectorType[];
207
- url: EnvValue;
208
- config: {
209
- [key: string]: string;
210
- };
211
- }
212
-
213
- interface Dictionary<T> {
214
- [key: string]: T;
215
- }
216
-
217
- declare class DMMFClass implements DMMF.Document {
218
- datamodel: DMMF.Datamodel;
219
- schema: DMMF.Schema;
220
- mappings: DMMF.Mappings;
221
- queryType: DMMF.OutputType;
222
- mutationType: DMMF.OutputType;
223
- outputTypes: {
224
- model: DMMF.OutputType[];
225
- prisma: DMMF.OutputType[];
226
- };
227
- outputTypeMap: Dictionary<DMMF.OutputType>;
228
- inputObjectTypes: {
229
- model?: DMMF.InputType[];
230
- prisma: DMMF.InputType[];
231
- };
232
- inputTypeMap: Dictionary<DMMF.InputType>;
233
- enumMap: Dictionary<DMMF.SchemaEnum>;
234
- datamodelEnumMap: Dictionary<DMMF.DatamodelEnum>;
235
- modelMap: Dictionary<DMMF.Model>;
236
- mappingsMap: Dictionary<DMMF.ModelMapping>;
237
- rootFieldMap: Dictionary<DMMF.SchemaField>;
238
- constructor({ datamodel, schema, mappings }: DMMF.Document);
239
- get [Symbol.toStringTag](): string;
240
- protected outputTypeToMergedOutputType: (outputType: DMMF.OutputType) => DMMF.OutputType;
241
- protected resolveOutputTypes(): void;
242
- protected resolveInputTypes(): void;
243
- protected resolveFieldArgumentTypes(): void;
244
- protected getQueryType(): DMMF.OutputType;
245
- protected getMutationType(): DMMF.OutputType;
246
- protected getOutputTypes(): {
247
- model: DMMF.OutputType[];
248
- prisma: DMMF.OutputType[];
249
- };
250
- protected getDatamodelEnumMap(): Dictionary<DMMF.DatamodelEnum>;
251
- protected getEnumMap(): Dictionary<DMMF.SchemaEnum>;
252
- protected getModelMap(): Dictionary<DMMF.Model>;
253
- protected getMergedOutputTypeMap(): Dictionary<DMMF.OutputType>;
254
- protected getInputTypeMap(): Dictionary<DMMF.InputType>;
255
- protected getMappingsMap(): Dictionary<DMMF.ModelMapping>;
256
- protected getRootFieldMap(): Dictionary<DMMF.SchemaField>;
257
- }
258
-
259
- interface ArgError {
260
- path: string[];
261
- id?: string;
262
- error: InvalidArgError;
263
- }
264
- interface FieldError {
265
- path: string[];
266
- error: InvalidFieldError;
267
- }
268
- declare type InvalidFieldError = InvalidFieldNameError | InvalidFieldTypeError | EmptySelectError | NoTrueSelectError | IncludeAndSelectError | EmptyIncludeError;
269
- interface InvalidFieldTypeError {
270
- type: 'invalidFieldType';
271
- modelName: string;
272
- fieldName: string;
273
- providedValue: any;
274
- }
275
- interface InvalidFieldNameError {
276
- type: 'invalidFieldName';
277
- modelName: string;
278
- didYouMean?: string | null;
279
- providedName: string;
280
- isInclude?: boolean;
281
- isIncludeScalar?: boolean;
282
- outputType: DMMF.OutputType;
283
- }
284
- interface EmptySelectError {
285
- type: 'emptySelect';
286
- field: DMMF.SchemaField;
287
- }
288
- interface EmptyIncludeError {
289
- type: 'emptyInclude';
290
- field: DMMF.SchemaField;
291
- }
292
- interface NoTrueSelectError {
293
- type: 'noTrueSelect';
294
- field: DMMF.SchemaField;
295
- }
296
- interface IncludeAndSelectError {
297
- type: 'includeAndSelect';
298
- field: DMMF.SchemaField;
299
- }
300
- declare type InvalidArgError = InvalidArgNameError | MissingArgError | InvalidArgTypeError | AtLeastOneError | AtMostOneError | InvalidNullArgError;
301
- /**
302
- * This error occurs if the user provides an arg name that doens't exist
303
- */
304
- interface InvalidArgNameError {
305
- type: 'invalidName';
306
- providedName: string;
307
- providedValue: any;
308
- didYouMeanArg?: string;
309
- didYouMeanField?: string;
310
- originalType: DMMF.ArgType;
311
- possibilities?: DMMF.SchemaArgInputType[];
312
- outputType?: DMMF.OutputType;
313
- }
314
- /**
315
- * Opposite of InvalidArgNameError - if the user *doesn't* provide an arg that should be provided
316
- * This error both happens with an implicit and explicit `undefined`
317
- */
318
- interface MissingArgError {
319
- type: 'missingArg';
320
- missingName: string;
321
- missingArg: DMMF.SchemaArg;
322
- atLeastOne: boolean;
323
- atMostOne: boolean;
324
- }
325
- /**
326
- * If a user incorrectly provided null where she shouldn't have
327
- */
328
- interface InvalidNullArgError {
329
- type: 'invalidNullArg';
330
- name: string;
331
- invalidType: DMMF.SchemaArgInputType[];
332
- atLeastOne: boolean;
333
- atMostOne: boolean;
334
- }
335
- interface AtMostOneError {
336
- type: 'atMostOne';
337
- key: string;
338
- inputType: DMMF.InputType;
339
- providedKeys: string[];
340
- }
341
- interface AtLeastOneError {
342
- type: 'atLeastOne';
343
- key: string;
344
- inputType: DMMF.InputType;
345
- }
346
- /**
347
- * If the scalar type of an arg is not matching what is required
348
- */
349
- interface InvalidArgTypeError {
350
- type: 'invalidType';
351
- argName: string;
352
- requiredType: {
353
- bestFittingType: DMMF.SchemaArgInputType;
354
- inputType: DMMF.SchemaArgInputType[];
355
- };
356
- providedValue: any;
357
- }
358
-
359
- interface MissingItem {
360
- path: string;
361
- isRequired: boolean;
362
- type: string | object;
363
- }
364
-
365
- declare class Document {
366
- readonly type: 'query' | 'mutation';
367
- readonly children: Field[];
368
- constructor(type: 'query' | 'mutation', children: Field[]);
369
- get [Symbol.toStringTag](): string;
370
- toString(): string;
371
- validate(select?: any, isTopLevelQuery?: boolean, originalMethod?: string, errorFormat?: 'pretty' | 'minimal' | 'colorless', validationCallsite?: any): void;
372
- protected printFieldError: ({ error }: FieldError, missingItems: MissingItem[], minimal: boolean) => string | undefined;
373
- protected printArgError: ({ error, path, id }: ArgError, hasMissingItems: boolean, minimal: boolean) => string | undefined;
374
- /**
375
- * As we're allowing both single objects and array of objects for list inputs, we need to remove incorrect
376
- * zero indexes from the path
377
- * @param inputPath e.g. ['where', 'AND', 0, 'id']
378
- * @param select select object
379
- */
380
- private normalizePath;
381
- }
382
- declare class PrismaClientValidationError extends Error {
383
- get [Symbol.toStringTag](): string;
384
- }
385
- interface FieldArgs {
386
- name: string;
387
- schemaField?: DMMF.SchemaField;
388
- args?: Args;
389
- children?: Field[];
390
- error?: InvalidFieldError;
391
- }
392
- declare class Field {
393
- readonly name: string;
394
- readonly args?: Args;
395
- readonly children?: Field[];
396
- readonly error?: InvalidFieldError;
397
- readonly hasInvalidChild: boolean;
398
- readonly hasInvalidArg: boolean;
399
- readonly schemaField?: DMMF.SchemaField;
400
- constructor({ name, args, children, error, schemaField }: FieldArgs);
401
- get [Symbol.toStringTag](): string;
402
- toString(): string;
403
- collectErrors(prefix?: string): {
404
- fieldErrors: FieldError[];
405
- argErrors: ArgError[];
406
- };
407
- }
408
- declare class Args {
409
- args: Arg[];
410
- readonly hasInvalidArg: boolean;
411
- constructor(args?: Arg[]);
412
- get [Symbol.toStringTag](): string;
413
- toString(): string;
414
- collectErrors(): ArgError[];
415
- }
416
- interface ArgOptions {
417
- key: string;
418
- value: ArgValue;
419
- isEnum?: boolean;
420
- error?: InvalidArgError;
421
- schemaArg?: DMMF.SchemaArg;
422
- inputType?: DMMF.SchemaArgInputType;
423
- }
424
- declare class Arg {
425
- key: string;
426
- value: ArgValue;
427
- error?: InvalidArgError;
428
- hasError: boolean;
429
- isEnum: boolean;
430
- schemaArg?: DMMF.SchemaArg;
431
- isNullable: boolean;
432
- inputType?: DMMF.SchemaArgInputType;
433
- constructor({ key, value, isEnum, error, schemaArg, inputType, }: ArgOptions);
434
- get [Symbol.toStringTag](): string;
435
- _toString(value: ArgValue, key: string): string | undefined;
436
- toString(): string | undefined;
437
- collectErrors(): ArgError[];
438
- }
439
- declare type ArgValue = string | boolean | number | undefined | Args | string[] | boolean[] | number[] | Args[] | null;
440
- interface DocumentInput {
441
- dmmf: DMMFClass;
442
- rootTypeName: 'query' | 'mutation';
443
- rootField: string;
444
- select?: any;
445
- }
446
- declare function makeDocument({ dmmf, rootTypeName, rootField, select, }: DocumentInput): Document;
447
- declare function transformDocument(document: Document): Document;
448
- interface UnpackOptions {
449
- document: Document;
450
- path: string[];
451
- data: any;
452
- }
453
- /**
454
- * Unpacks the result of a data object and maps DateTime fields to instances of `Date` inplace
455
- * @param options: UnpackOptions
456
- */
457
- declare function unpack({ document, path, data }: UnpackOptions): any;
458
-
459
- declare class PrismaClientKnownRequestError extends Error {
460
- code: string;
461
- meta?: object;
462
- clientVersion: string;
463
- constructor(message: string, code: string, clientVersion: string, meta?: any);
464
- get [Symbol.toStringTag](): string;
465
- }
466
- declare class PrismaClientUnknownRequestError extends Error {
467
- clientVersion: string;
468
- constructor(message: string, clientVersion: string);
469
- get [Symbol.toStringTag](): string;
470
- }
471
- declare class PrismaClientRustPanicError extends Error {
472
- clientVersion: string;
473
- constructor(message: string, clientVersion: string);
474
- get [Symbol.toStringTag](): string;
475
- }
476
- declare class PrismaClientInitializationError extends Error {
477
- clientVersion: string;
478
- errorCode?: string;
479
- constructor(message: string, clientVersion: string, errorCode?: string);
480
- get [Symbol.toStringTag](): string;
481
- }
482
-
483
- interface Engine {
484
- on(event: EngineEventType, listener: (args?: any) => any): void;
485
- start(): Promise<void>;
486
- stop(): Promise<void>;
487
- kill(signal: string): void;
488
- getConfig(): Promise<GetConfigResult>;
489
- version(forceRun?: boolean): Promise<string>;
490
- request<T>(query: string, headers: Record<string, string>, numTry: number): Promise<{
491
- data: T;
492
- elapsed: number;
493
- }>;
494
- requestBatch<T>(queries: string[], transaction?: boolean, numTry?: number): Promise<{
495
- data: T;
496
- elapsed: number;
497
- }>;
498
- }
499
- declare type EngineEventType = 'query' | 'info' | 'warn' | 'error' | 'beforeExit';
500
- interface DatasourceOverwrite {
501
- name: string;
502
- url?: string;
503
- env?: string;
504
- }
505
- interface EngineConfig {
506
- cwd?: string;
507
- dirname?: string;
508
- datamodelPath: string;
509
- enableDebugLogs?: boolean;
510
- enableEngineDebugMode?: boolean;
511
- prismaPath?: string;
512
- fetcher?: (query: string) => Promise<{
513
- data?: any;
514
- error?: any;
515
- }>;
516
- generator?: GeneratorConfig;
517
- datasources?: DatasourceOverwrite[];
518
- showColors?: boolean;
519
- logQueries?: boolean;
520
- logLevel?: 'info' | 'warn';
521
- env?: Record<string, string>;
522
- flags?: string[];
523
- useUds?: boolean;
524
- clientVersion?: string;
525
- enableExperimental?: string[];
526
- engineEndpoint?: string;
527
- activeProvider?: string;
528
- }
529
- declare type GetConfigResult = {
530
- datasources: DataSource[];
531
- generators: GeneratorConfig[];
532
- };
533
-
534
- declare class NodeEngine implements Engine {
535
- private logEmitter;
536
- private showColors;
537
- private logQueries;
538
- private logLevel?;
539
- private env?;
540
- private flags;
541
- private port?;
542
- private enableDebugLogs;
543
- private enableEngineDebugMode;
544
- private child?;
545
- private clientVersion?;
546
- private lastPanic?;
547
- private globalKillSignalReceived?;
548
- private startCount;
549
- private enableExperimental;
550
- private engineEndpoint?;
551
- private lastErrorLog?;
552
- private lastRustError?;
553
- private useUds;
554
- private socketPath?;
555
- private getConfigPromise?;
556
- private stopPromise?;
557
- private beforeExitListener?;
558
- private dirname?;
559
- private cwd;
560
- private datamodelPath;
561
- private prismaPath?;
562
- private stderrLogs;
563
- private currentRequestPromise?;
564
- private platformPromise?;
565
- private platform?;
566
- private generator?;
567
- private incorrectlyPinnedBinaryTarget?;
568
- private datasources?;
569
- private startPromise?;
570
- private versionPromise?;
571
- private engineStartDeferred?;
572
- private engineStopDeferred?;
573
- private undici?;
574
- private lastQuery?;
575
- private lastVersion?;
576
- private lastActiveProvider?;
577
- private activeProvider?;
578
- /**
579
- * exiting is used to tell the .on('exit') hook, if the exit came from our script.
580
- * As soon as the Prisma binary returns a correct return code (like 1 or 0), we don't need this anymore
581
- */
582
- constructor({ cwd, datamodelPath, prismaPath, generator, datasources, showColors, logLevel, logQueries, env, flags, clientVersion, enableExperimental, engineEndpoint, enableDebugLogs, enableEngineDebugMode, dirname, useUds, activeProvider, }: EngineConfig);
583
- private setError;
584
- private checkForTooManyEngines;
585
- private resolveCwd;
586
- on(event: EngineEventType, listener: (args?: any) => any): void;
587
- emitExit(): Promise<void>;
588
- private getPlatform;
589
- private getQueryEnginePath;
590
- private handlePanic;
591
- private resolvePrismaPath;
592
- private getPrismaPath;
593
- private getFixedGenerator;
594
- private printDatasources;
595
- /**
596
- * Starts the engine, returns the url that it runs on
597
- */
598
- start(): Promise<void>;
599
- private getEngineEnvVars;
600
- private internalStart;
601
- stop(): Promise<void>;
602
- /**
603
- * If Prisma runs, stop it
604
- */
605
- _stop(): Promise<void>;
606
- kill(signal: string): void;
607
- /**
608
- * Use the port 0 trick to get a new port
609
- */
610
- private getFreePort;
611
- getConfig(): Promise<GetConfigResult>;
612
- private _getConfig;
613
- version(forceRun?: boolean): Promise<string>;
614
- internalVersion(): Promise<string>;
615
- request<T>(query: string, headers: Record<string, string>, numTry?: number): Promise<T>;
616
- requestBatch<T>(queries: string[], transaction?: boolean, numTry?: number): Promise<T>;
617
- private get hasMaxRestarts();
618
- /**
619
- * If we have request errors like "ECONNRESET", we need to get the error from a
620
- * different place, not the request itself. This different place can either be
621
- * this.lastRustError or this.lastErrorLog
622
- */
623
- private throwAsyncErrorIfExists;
624
- private getErrorMessageWithLink;
625
- private handleRequestError;
626
- private graphQLToJSError;
627
- }
628
-
629
- declare type RejectOnNotFound = boolean | ((error: Error) => Error) | undefined;
630
- declare type InstanceRejectOnNotFound = RejectOnNotFound | Record<string, RejectOnNotFound> | Record<string, Record<string, RejectOnNotFound>>;
631
-
632
- declare type ErrorFormat = 'pretty' | 'colorless' | 'minimal';
633
- declare type Datasource = {
634
- url?: string;
635
- };
636
- declare type Datasources = Record<string, Datasource>;
637
- interface PrismaClientOptions {
638
- /**
639
- * Will throw an Error if findUnique returns null
640
- */
641
- rejectOnNotFound?: InstanceRejectOnNotFound;
642
- /**
643
- * Overwrites the datasource url from your prisma.schema file
644
- */
645
- datasources?: Datasources;
646
- /**
647
- * @default "colorless"
648
- */
649
- errorFormat?: ErrorFormat;
650
- /**
651
- * @example
652
- * \`\`\`
653
- * // Defaults to stdout
654
- * log: ['query', 'info', 'warn']
655
- *
656
- * // Emit as events
657
- * log: [
658
- * { emit: 'stdout', level: 'query' },
659
- * { emit: 'stdout', level: 'info' },
660
- * { emit: 'stdout', level: 'warn' }
661
- * ]
662
- * \`\`\`
663
- * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/logging#the-log-option).
664
- */
665
- log?: Array<LogLevel | LogDefinition>;
666
- /**
667
- * @internal
668
- * You probably don't want to use this. \`__internal\` is used by internal tooling.
669
- */
670
- __internal?: {
671
- debug?: boolean;
672
- hooks?: Hooks;
673
- useUds?: boolean;
674
- engine?: {
675
- cwd?: string;
676
- binaryPath?: string;
677
- endpoint?: string;
678
- enableEngineDebugMode?: boolean;
679
- };
680
- };
681
- }
682
- declare type HookParams = {
683
- query: string;
684
- path: string[];
685
- rootField?: string;
686
- typeName?: string;
687
- document: any;
688
- clientMethod: string;
689
- args: any;
690
- };
691
- declare type Hooks = {
692
- beforeRequest?: (options: HookParams) => any;
693
- };
694
- declare type LogLevel = 'info' | 'query' | 'warn' | 'error';
695
- declare type LogDefinition = {
696
- level: LogLevel;
697
- emit: 'stdout' | 'event';
698
- };
699
- interface GetPrismaClientOptions {
700
- document: DMMF.Document;
701
- generator?: GeneratorConfig;
702
- sqliteDatasourceOverrides?: DatasourceOverwrite[];
703
- relativeEnvPaths: {
704
- rootEnvPath?: string | null;
705
- schemaEnvPath?: string | null;
706
- };
707
- relativePath: string;
708
- dirname: string;
709
- clientVersion?: string;
710
- engineVersion?: string;
711
- datasourceNames: string[];
712
- activeProvider: string;
713
- }
714
- declare function getPrismaClient(config: GetPrismaClientOptions): any;
715
-
716
- declare type Value = string | number | boolean | object | null | undefined;
717
- declare type RawValue = Value | Sql;
718
- /**
719
- * A SQL instance can be nested within each other to build SQL strings.
720
- */
721
- declare class Sql {
722
- values: Value[];
723
- strings: string[];
724
- constructor(rawStrings: ReadonlyArray<string>, rawValues: ReadonlyArray<RawValue>);
725
- get text(): string;
726
- get sql(): string;
727
- [inspect.custom](): {
728
- text: string;
729
- sql: string;
730
- values: Value[];
731
- };
732
- }
733
- /**
734
- * Create a SQL query for a list of values.
735
- */
736
- declare function join(values: RawValue[], separator?: string): Sql;
737
- /**
738
- * Create raw SQL statement.
739
- */
740
- declare function raw(value: string): Sql;
741
- /**
742
- * Placeholder value for "no text".
743
- */
744
- declare const empty: Sql;
745
- /**
746
- * Create a SQL object from a template string.
747
- */
748
- declare function sqltag(strings: ReadonlyArray<string>, ...values: RawValue[]): Sql;
749
-
750
- declare function warnEnvConflicts(envPaths: any): void;
751
-
752
- // Type definitions for decimal.js >=7.0.0
753
-
754
-
755
- declare namespace Decimal {
756
- export type Constructor = typeof Decimal;
757
- export type Instance = Decimal;
758
- export type Rounding = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
759
- export type Modulo = Rounding | 9;
760
- export type Value = string | number | Decimal;
761
-
762
- // http://mikemcl.github.io/decimal.js/#constructor-properties
763
- export interface Config {
764
- precision?: number;
765
- rounding?: Rounding;
766
- toExpNeg?: number;
767
- toExpPos?: number;
768
- minE?: number;
769
- maxE?: number;
770
- crypto?: boolean;
771
- modulo?: Modulo;
772
- defaults?: boolean;
773
- }
774
- }
775
-
776
- declare class Decimal {
777
- readonly d: number[];
778
- readonly e: number;
779
- readonly s: number;
780
- private readonly name: string;
781
-
782
- constructor(n: Decimal.Value);
783
-
784
- absoluteValue(): Decimal;
785
- abs(): Decimal;
786
-
787
- ceil(): Decimal;
788
-
789
- comparedTo(n: Decimal.Value): number;
790
- cmp(n: Decimal.Value): number;
791
-
792
- cosine(): Decimal;
793
- cos(): Decimal;
794
-
795
- cubeRoot(): Decimal;
796
- cbrt(): Decimal;
797
-
798
- decimalPlaces(): number;
799
- dp(): number;
800
-
801
- dividedBy(n: Decimal.Value): Decimal;
802
- div(n: Decimal.Value): Decimal;
803
-
804
- dividedToIntegerBy(n: Decimal.Value): Decimal;
805
- divToInt(n: Decimal.Value): Decimal;
806
-
807
- equals(n: Decimal.Value): boolean;
808
- eq(n: Decimal.Value): boolean;
809
-
810
- floor(): Decimal;
811
-
812
- greaterThan(n: Decimal.Value): boolean;
813
- gt(n: Decimal.Value): boolean;
814
-
815
- greaterThanOrEqualTo(n: Decimal.Value): boolean;
816
- gte(n: Decimal.Value): boolean;
817
-
818
- hyperbolicCosine(): Decimal;
819
- cosh(): Decimal;
820
-
821
- hyperbolicSine(): Decimal;
822
- sinh(): Decimal;
823
-
824
- hyperbolicTangent(): Decimal;
825
- tanh(): Decimal;
826
-
827
- inverseCosine(): Decimal;
828
- acos(): Decimal;
829
-
830
- inverseHyperbolicCosine(): Decimal;
831
- acosh(): Decimal;
832
-
833
- inverseHyperbolicSine(): Decimal;
834
- asinh(): Decimal;
835
-
836
- inverseHyperbolicTangent(): Decimal;
837
- atanh(): Decimal;
838
-
839
- inverseSine(): Decimal;
840
- asin(): Decimal;
841
-
842
- inverseTangent(): Decimal;
843
- atan(): Decimal;
844
-
845
- isFinite(): boolean;
846
-
847
- isInteger(): boolean;
848
- isInt(): boolean;
849
-
850
- isNaN(): boolean;
851
-
852
- isNegative(): boolean;
853
- isNeg(): boolean;
854
-
855
- isPositive(): boolean;
856
- isPos(): boolean;
857
-
858
- isZero(): boolean;
859
-
860
- lessThan(n: Decimal.Value): boolean;
861
- lt(n: Decimal.Value): boolean;
862
-
863
- lessThanOrEqualTo(n: Decimal.Value): boolean;
864
- lte(n: Decimal.Value): boolean;
865
-
866
- logarithm(n?: Decimal.Value): Decimal;
867
- log(n?: Decimal.Value): Decimal;
868
-
869
- minus(n: Decimal.Value): Decimal;
870
- sub(n: Decimal.Value): Decimal;
871
-
872
- modulo(n: Decimal.Value): Decimal;
873
- mod(n: Decimal.Value): Decimal;
874
-
875
- naturalExponential(): Decimal;
876
- exp(): Decimal;
877
-
878
- naturalLogarithm(): Decimal;
879
- ln(): Decimal;
880
-
881
- negated(): Decimal;
882
- neg(): Decimal;
883
-
884
- plus(n: Decimal.Value): Decimal;
885
- add(n: Decimal.Value): Decimal;
886
-
887
- precision(includeZeros?: boolean): number;
888
- sd(includeZeros?: boolean): number;
889
-
890
- round(): Decimal;
891
-
892
- sine() : Decimal;
893
- sin() : Decimal;
894
-
895
- squareRoot(): Decimal;
896
- sqrt(): Decimal;
897
-
898
- tangent() : Decimal;
899
- tan() : Decimal;
900
-
901
- times(n: Decimal.Value): Decimal;
902
- mul(n: Decimal.Value) : Decimal;
903
-
904
- toBinary(significantDigits?: number): string;
905
- toBinary(significantDigits: number, rounding: Decimal.Rounding): string;
906
-
907
- toDecimalPlaces(decimalPlaces?: number): Decimal;
908
- toDecimalPlaces(decimalPlaces: number, rounding: Decimal.Rounding): Decimal;
909
- toDP(decimalPlaces?: number): Decimal;
910
- toDP(decimalPlaces: number, rounding: Decimal.Rounding): Decimal;
911
-
912
- toExponential(decimalPlaces?: number): string;
913
- toExponential(decimalPlaces: number, rounding: Decimal.Rounding): string;
914
-
915
- toFixed(decimalPlaces?: number): string;
916
- toFixed(decimalPlaces: number, rounding: Decimal.Rounding): string;
917
-
918
- toFraction(max_denominator?: Decimal.Value): Decimal[];
919
-
920
- toHexadecimal(significantDigits?: number): string;
921
- toHexadecimal(significantDigits: number, rounding: Decimal.Rounding): string;
922
- toHex(significantDigits?: number): string;
923
- toHex(significantDigits: number, rounding?: Decimal.Rounding): string;
924
-
925
- toJSON(): string;
926
-
927
- toNearest(n: Decimal.Value, rounding?: Decimal.Rounding): Decimal;
928
-
929
- toNumber(): number;
930
-
931
- toOctal(significantDigits?: number): string;
932
- toOctal(significantDigits: number, rounding: Decimal.Rounding): string;
933
-
934
- toPower(n: Decimal.Value): Decimal;
935
- pow(n: Decimal.Value): Decimal;
936
-
937
- toPrecision(significantDigits?: number): string;
938
- toPrecision(significantDigits: number, rounding: Decimal.Rounding): string;
939
-
940
- toSignificantDigits(significantDigits?: number): Decimal;
941
- toSignificantDigits(significantDigits: number, rounding: Decimal.Rounding): Decimal;
942
- toSD(significantDigits?: number): Decimal;
943
- toSD(significantDigits: number, rounding: Decimal.Rounding): Decimal;
944
-
945
- toString(): string;
946
-
947
- truncated(): Decimal;
948
- trunc(): Decimal;
949
-
950
- valueOf(): string;
951
-
952
- static abs(n: Decimal.Value): Decimal;
953
- static acos(n: Decimal.Value): Decimal;
954
- static acosh(n: Decimal.Value): Decimal;
955
- static add(x: Decimal.Value, y: Decimal.Value): Decimal;
956
- static asin(n: Decimal.Value): Decimal;
957
- static asinh(n: Decimal.Value): Decimal;
958
- static atan(n: Decimal.Value): Decimal;
959
- static atanh(n: Decimal.Value): Decimal;
960
- static atan2(y: Decimal.Value, x: Decimal.Value): Decimal;
961
- static cbrt(n: Decimal.Value): Decimal;
962
- static ceil(n: Decimal.Value): Decimal;
963
- static clone(object?: Decimal.Config): Decimal.Constructor;
964
- static config(object: Decimal.Config): Decimal.Constructor;
965
- static cos(n: Decimal.Value): Decimal;
966
- static cosh(n: Decimal.Value): Decimal;
967
- static div(x: Decimal.Value, y: Decimal.Value): Decimal;
968
- static exp(n: Decimal.Value): Decimal;
969
- static floor(n: Decimal.Value): Decimal;
970
- static hypot(...n: Decimal.Value[]): Decimal;
971
- static isDecimal(object: any): boolean
972
- static ln(n: Decimal.Value): Decimal;
973
- static log(n: Decimal.Value, base?: Decimal.Value): Decimal;
974
- static log2(n: Decimal.Value): Decimal;
975
- static log10(n: Decimal.Value): Decimal;
976
- static max(...n: Decimal.Value[]): Decimal;
977
- static min(...n: Decimal.Value[]): Decimal;
978
- static mod(x: Decimal.Value, y: Decimal.Value): Decimal;
979
- static mul(x: Decimal.Value, y: Decimal.Value): Decimal;
980
- static noConflict(): Decimal.Constructor; // Browser only
981
- static pow(base: Decimal.Value, exponent: Decimal.Value): Decimal;
982
- static random(significantDigits?: number): Decimal;
983
- static round(n: Decimal.Value): Decimal;
984
- static set(object: Decimal.Config): Decimal.Constructor;
985
- static sign(n: Decimal.Value): Decimal;
986
- static sin(n: Decimal.Value): Decimal;
987
- static sinh(n: Decimal.Value): Decimal;
988
- static sqrt(n: Decimal.Value): Decimal;
989
- static sub(x: Decimal.Value, y: Decimal.Value): Decimal;
990
- static tan(n: Decimal.Value): Decimal;
991
- static tanh(n: Decimal.Value): Decimal;
992
- static trunc(n: Decimal.Value): Decimal;
993
-
994
- static readonly default?: Decimal.Constructor;
995
- static readonly Decimal?: Decimal.Constructor;
996
-
997
- static readonly precision: number;
998
- static readonly rounding: Decimal.Rounding;
999
- static readonly toExpNeg: number;
1000
- static readonly toExpPos: number;
1001
- static readonly minE: number;
1002
- static readonly maxE: number;
1003
- static readonly crypto: boolean;
1004
- static readonly modulo: Decimal.Modulo;
1005
-
1006
- static readonly ROUND_UP: 0;
1007
- static readonly ROUND_DOWN: 1;
1008
- static readonly ROUND_CEIL: 2;
1009
- static readonly ROUND_FLOOR: 3;
1010
- static readonly ROUND_HALF_UP: 4;
1011
- static readonly ROUND_HALF_DOWN: 5;
1012
- static readonly ROUND_HALF_EVEN: 6;
1013
- static readonly ROUND_HALF_CEIL: 7;
1014
- static readonly ROUND_HALF_FLOOR: 8;
1015
- static readonly EUCLID: 9;
1016
- }
1017
-
1018
- export { DMMF, DMMFClass, Decimal, NodeEngine as Engine, PrismaClientInitializationError, PrismaClientKnownRequestError, PrismaClientOptions, PrismaClientRustPanicError, PrismaClientUnknownRequestError, PrismaClientValidationError, RawValue, Sql, Value, empty, getPrismaClient, join, makeDocument, raw, sqltag, transformDocument, unpack, warnEnvConflicts };