@prisma/generator-helper 6.6.0-dev.10 → 6.6.0-dev.101

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.
@@ -1,10 +1,6 @@
1
- import type { GeneratorConfig, GeneratorManifest, GeneratorOptions } from './types';
1
+ import type { GeneratorConfig, GeneratorManifest, GeneratorOptions } from '@prisma/generator';
2
2
  type GeneratorProcessOptions = {
3
3
  isNode?: boolean;
4
- /**
5
- * Time to wait before we consider generator successfully started, ms
6
- */
7
- initWaitTime?: number;
8
4
  };
9
5
  export declare class GeneratorError extends Error {
10
6
  code?: number | undefined;
@@ -18,10 +18,11 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var GeneratorProcess_exports = {};
20
20
  __export(GeneratorProcess_exports, {
21
- GeneratorError: () => import_chunk_J4U56IA4.GeneratorError,
22
- GeneratorProcess: () => import_chunk_J4U56IA4.GeneratorProcess
21
+ GeneratorError: () => import_chunk_MXZE5TCU.GeneratorError,
22
+ GeneratorProcess: () => import_chunk_MXZE5TCU.GeneratorProcess
23
23
  });
24
24
  module.exports = __toCommonJS(GeneratorProcess_exports);
25
- var import_chunk_J4U56IA4 = require("./chunk-J4U56IA4.js");
25
+ var import_chunk_MXZE5TCU = require("./chunk-MXZE5TCU.js");
26
26
  var import_chunk_EOPVK4AE = require("./chunk-EOPVK4AE.js");
27
- var import_chunk_FAIJPBT5 = require("./chunk-FAIJPBT5.js");
27
+ var import_chunk_KEYE2GFS = require("./chunk-KEYE2GFS.js");
28
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
package/dist/byline.js CHANGED
@@ -25,4 +25,4 @@ __export(byline_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(byline_exports);
27
27
  var import_chunk_EOPVK4AE = require("./chunk-EOPVK4AE.js");
28
- var import_chunk_FAIJPBT5 = require("./chunk-FAIJPBT5.js");
28
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
@@ -16,11 +16,11 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var dmmf_exports = {};
20
- __export(dmmf_exports, {
21
- DMMF: () => import_chunk_JU65QD3H.DMMF,
22
- datamodelEnumToSchemaEnum: () => import_chunk_JU65QD3H.datamodelEnumToSchemaEnum
19
+ var chunk_KEYE2GFS_exports = {};
20
+ __export(chunk_KEYE2GFS_exports, {
21
+ isErrorResponse: () => isErrorResponse
23
22
  });
24
- module.exports = __toCommonJS(dmmf_exports);
25
- var import_chunk_JU65QD3H = require("./chunk-JU65QD3H.js");
26
- var import_chunk_FAIJPBT5 = require("./chunk-FAIJPBT5.js");
23
+ module.exports = __toCommonJS(chunk_KEYE2GFS_exports);
24
+ function isErrorResponse(response) {
25
+ return response.error !== void 0;
26
+ }
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,31 +15,24 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_J4U56IA4_exports = {};
30
- __export(chunk_J4U56IA4_exports, {
19
+ var chunk_MXZE5TCU_exports = {};
20
+ __export(chunk_MXZE5TCU_exports, {
31
21
  GeneratorError: () => GeneratorError,
32
22
  GeneratorProcess: () => GeneratorProcess
33
23
  });
34
- module.exports = __toCommonJS(chunk_J4U56IA4_exports);
24
+ module.exports = __toCommonJS(chunk_MXZE5TCU_exports);
35
25
  var import_chunk_EOPVK4AE = require("./chunk-EOPVK4AE.js");
36
- var import_chunk_FAIJPBT5 = require("./chunk-FAIJPBT5.js");
37
- var import_debug = __toESM(require("@prisma/debug"));
38
- var import_child_process = require("child_process");
39
- var require_windows = (0, import_chunk_FAIJPBT5.__commonJS)({
26
+ var import_chunk_KEYE2GFS = require("./chunk-KEYE2GFS.js");
27
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
28
+ var import_node_child_process = require("node:child_process");
29
+ var import_debug = require("@prisma/debug");
30
+ var require_windows = (0, import_chunk_QGM4M3NI.__commonJS)({
40
31
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
41
32
  "use strict";
42
33
  module2.exports = isexe;
43
34
  isexe.sync = sync;
44
- var fs = (0, import_chunk_FAIJPBT5.__require)("fs");
35
+ var fs = (0, import_chunk_QGM4M3NI.__require)("fs");
45
36
  function checkPathExt(path, options) {
46
37
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
47
38
  if (!pathext) {
@@ -75,12 +66,12 @@ var require_windows = (0, import_chunk_FAIJPBT5.__commonJS)({
75
66
  }
76
67
  }
77
68
  });
78
- var require_mode = (0, import_chunk_FAIJPBT5.__commonJS)({
69
+ var require_mode = (0, import_chunk_QGM4M3NI.__commonJS)({
79
70
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
80
71
  "use strict";
81
72
  module2.exports = isexe;
82
73
  isexe.sync = sync;
83
- var fs = (0, import_chunk_FAIJPBT5.__require)("fs");
74
+ var fs = (0, import_chunk_QGM4M3NI.__require)("fs");
84
75
  function isexe(path, options, cb) {
85
76
  fs.stat(path, function(er, stat) {
86
77
  cb(er, er ? false : checkStat(stat, options));
@@ -107,10 +98,10 @@ var require_mode = (0, import_chunk_FAIJPBT5.__commonJS)({
107
98
  }
108
99
  }
109
100
  });
110
- var require_isexe = (0, import_chunk_FAIJPBT5.__commonJS)({
101
+ var require_isexe = (0, import_chunk_QGM4M3NI.__commonJS)({
111
102
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
112
103
  "use strict";
113
- var fs = (0, import_chunk_FAIJPBT5.__require)("fs");
104
+ var fs = (0, import_chunk_QGM4M3NI.__require)("fs");
114
105
  var core;
115
106
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
116
107
  core = require_windows();
@@ -161,11 +152,11 @@ var require_isexe = (0, import_chunk_FAIJPBT5.__commonJS)({
161
152
  }
162
153
  }
163
154
  });
164
- var require_which = (0, import_chunk_FAIJPBT5.__commonJS)({
155
+ var require_which = (0, import_chunk_QGM4M3NI.__commonJS)({
165
156
  "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module2) {
166
157
  "use strict";
167
158
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
168
- var path = (0, import_chunk_FAIJPBT5.__require)("path");
159
+ var path = (0, import_chunk_QGM4M3NI.__require)("path");
169
160
  var COLON = isWindows ? ";" : ":";
170
161
  var isexe = require_isexe();
171
162
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -256,7 +247,7 @@ var require_which = (0, import_chunk_FAIJPBT5.__commonJS)({
256
247
  which.sync = whichSync;
257
248
  }
258
249
  });
259
- var require_path_key = (0, import_chunk_FAIJPBT5.__commonJS)({
250
+ var require_path_key = (0, import_chunk_QGM4M3NI.__commonJS)({
260
251
  "../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports, module2) {
261
252
  "use strict";
262
253
  var pathKey = (options = {}) => {
@@ -271,10 +262,10 @@ var require_path_key = (0, import_chunk_FAIJPBT5.__commonJS)({
271
262
  module2.exports.default = pathKey;
272
263
  }
273
264
  });
274
- var require_resolveCommand = (0, import_chunk_FAIJPBT5.__commonJS)({
265
+ var require_resolveCommand = (0, import_chunk_QGM4M3NI.__commonJS)({
275
266
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
276
267
  "use strict";
277
- var path = (0, import_chunk_FAIJPBT5.__require)("path");
268
+ var path = (0, import_chunk_QGM4M3NI.__require)("path");
278
269
  var which = require_which();
279
270
  var getPathKey = require_path_key();
280
271
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -311,7 +302,7 @@ var require_resolveCommand = (0, import_chunk_FAIJPBT5.__commonJS)({
311
302
  module2.exports = resolveCommand;
312
303
  }
313
304
  });
314
- var require_escape = (0, import_chunk_FAIJPBT5.__commonJS)({
305
+ var require_escape = (0, import_chunk_QGM4M3NI.__commonJS)({
315
306
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports, module2) {
316
307
  "use strict";
317
308
  var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
@@ -334,13 +325,13 @@ var require_escape = (0, import_chunk_FAIJPBT5.__commonJS)({
334
325
  module2.exports.argument = escapeArgument;
335
326
  }
336
327
  });
337
- var require_shebang_regex = (0, import_chunk_FAIJPBT5.__commonJS)({
328
+ var require_shebang_regex = (0, import_chunk_QGM4M3NI.__commonJS)({
338
329
  "../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports, module2) {
339
330
  "use strict";
340
331
  module2.exports = /^#!(.*)/;
341
332
  }
342
333
  });
343
- var require_shebang_command = (0, import_chunk_FAIJPBT5.__commonJS)({
334
+ var require_shebang_command = (0, import_chunk_QGM4M3NI.__commonJS)({
344
335
  "../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports, module2) {
345
336
  "use strict";
346
337
  var shebangRegex = require_shebang_regex();
@@ -358,10 +349,10 @@ var require_shebang_command = (0, import_chunk_FAIJPBT5.__commonJS)({
358
349
  };
359
350
  }
360
351
  });
361
- var require_readShebang = (0, import_chunk_FAIJPBT5.__commonJS)({
352
+ var require_readShebang = (0, import_chunk_QGM4M3NI.__commonJS)({
362
353
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
363
354
  "use strict";
364
- var fs = (0, import_chunk_FAIJPBT5.__require)("fs");
355
+ var fs = (0, import_chunk_QGM4M3NI.__require)("fs");
365
356
  var shebangCommand = require_shebang_command();
366
357
  function readShebang(command) {
367
358
  const size = 150;
@@ -378,10 +369,10 @@ var require_readShebang = (0, import_chunk_FAIJPBT5.__commonJS)({
378
369
  module2.exports = readShebang;
379
370
  }
380
371
  });
381
- var require_parse = (0, import_chunk_FAIJPBT5.__commonJS)({
372
+ var require_parse = (0, import_chunk_QGM4M3NI.__commonJS)({
382
373
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module2) {
383
374
  "use strict";
384
- var path = (0, import_chunk_FAIJPBT5.__require)("path");
375
+ var path = (0, import_chunk_QGM4M3NI.__require)("path");
385
376
  var resolveCommand = require_resolveCommand();
386
377
  var escape = require_escape();
387
378
  var readShebang = require_readShebang();
@@ -438,7 +429,7 @@ var require_parse = (0, import_chunk_FAIJPBT5.__commonJS)({
438
429
  module2.exports = parse;
439
430
  }
440
431
  });
441
- var require_enoent = (0, import_chunk_FAIJPBT5.__commonJS)({
432
+ var require_enoent = (0, import_chunk_QGM4M3NI.__commonJS)({
442
433
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports, module2) {
443
434
  "use strict";
444
435
  var isWin = process.platform === "win32";
@@ -486,10 +477,10 @@ var require_enoent = (0, import_chunk_FAIJPBT5.__commonJS)({
486
477
  };
487
478
  }
488
479
  });
489
- var require_cross_spawn = (0, import_chunk_FAIJPBT5.__commonJS)({
480
+ var require_cross_spawn = (0, import_chunk_QGM4M3NI.__commonJS)({
490
481
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports, module2) {
491
482
  "use strict";
492
- var cp = (0, import_chunk_FAIJPBT5.__require)("child_process");
483
+ var cp = (0, import_chunk_QGM4M3NI.__require)("child_process");
493
484
  var parse = require_parse();
494
485
  var enoent = require_enoent();
495
486
  function spawn2(command, args, options) {
@@ -511,7 +502,7 @@ var require_cross_spawn = (0, import_chunk_FAIJPBT5.__commonJS)({
511
502
  module2.exports._enoent = enoent;
512
503
  }
513
504
  });
514
- var import_cross_spawn = (0, import_chunk_FAIJPBT5.__toESM)(require_cross_spawn());
505
+ var import_cross_spawn = (0, import_chunk_QGM4M3NI.__toESM)(require_cross_spawn());
515
506
  var FORCE_COLOR;
516
507
  var NODE_DISABLE_COLORS;
517
508
  var NO_COLOR;
@@ -558,36 +549,31 @@ var bgBlue = init(44, 49);
558
549
  var bgMagenta = init(45, 49);
559
550
  var bgCyan = init(46, 49);
560
551
  var bgWhite = init(47, 49);
561
- var debug = (0, import_debug.default)("prisma:GeneratorProcess");
552
+ var debug = (0, import_debug.Debug)("prisma:GeneratorProcess");
562
553
  var globalMessageId = 1;
563
554
  var GeneratorError = class extends Error {
564
555
  constructor(message, code, data) {
565
556
  super(message);
566
557
  this.code = code;
567
558
  this.data = data;
568
- (0, import_chunk_FAIJPBT5.__publicField)(this, "name", "GeneratorError");
569
559
  if (data?.stack) {
570
560
  this.stack = data.stack;
571
561
  }
572
562
  }
563
+ name = "GeneratorError";
573
564
  };
574
565
  var GeneratorProcess = class {
575
566
  constructor(pathOrCommand, { isNode = false } = {}) {
576
567
  this.pathOrCommand = pathOrCommand;
577
- (0, import_chunk_FAIJPBT5.__publicField)(this, "child");
578
- (0, import_chunk_FAIJPBT5.__publicField)(this, "handlers", {});
579
- (0, import_chunk_FAIJPBT5.__publicField)(this, "initPromise");
580
- (0, import_chunk_FAIJPBT5.__publicField)(this, "isNode");
581
- (0, import_chunk_FAIJPBT5.__publicField)(this, "errorLogs", "");
582
- (0, import_chunk_FAIJPBT5.__publicField)(this, "pendingError");
583
- (0, import_chunk_FAIJPBT5.__publicField)(this, "exited", false);
584
- (0, import_chunk_FAIJPBT5.__publicField)(this, "getManifest", this.rpcMethod(
585
- "getManifest",
586
- (result) => result.manifest ?? null
587
- ));
588
- (0, import_chunk_FAIJPBT5.__publicField)(this, "generate", this.rpcMethod("generate"));
589
568
  this.isNode = isNode;
590
569
  }
570
+ child;
571
+ handlers = {};
572
+ initPromise;
573
+ isNode;
574
+ errorLogs = "";
575
+ pendingError;
576
+ exited = false;
591
577
  async init() {
592
578
  if (!this.initPromise) {
593
579
  this.initPromise = this.initSingleton();
@@ -597,7 +583,7 @@ var GeneratorProcess = class {
597
583
  initSingleton() {
598
584
  return new Promise((resolve, reject) => {
599
585
  if (this.isNode) {
600
- this.child = (0, import_child_process.fork)(this.pathOrCommand, [], {
586
+ this.child = (0, import_node_child_process.fork)(this.pathOrCommand, [], {
601
587
  stdio: ["pipe", "inherit", "pipe", "ipc"],
602
588
  env: {
603
589
  ...process.env,
@@ -675,7 +661,7 @@ ${this.errorLogs}`
675
661
  throw new Error(`message.id has to be a number. Found value ${data.id}`);
676
662
  }
677
663
  if (this.handlers[data.id]) {
678
- if (isErrorResponse(data)) {
664
+ if ((0, import_chunk_KEYE2GFS.isErrorResponse)(data)) {
679
665
  const error = new GeneratorError(data.error.message, data.error.code, data.error.data);
680
666
  this.handlers[data.id].reject(error);
681
667
  } else {
@@ -759,7 +745,9 @@ ${this.errorLogs}`
759
745
  );
760
746
  });
761
747
  }
748
+ getManifest = this.rpcMethod(
749
+ "getManifest",
750
+ (result) => result.manifest ?? null
751
+ );
752
+ generate = this.rpcMethod("generate");
762
753
  };
763
- function isErrorResponse(response) {
764
- return response.error !== void 0;
765
- }
@@ -16,21 +16,19 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_FAIJPBT5_exports = {};
20
- __export(chunk_FAIJPBT5_exports, {
19
+ var chunk_QGM4M3NI_exports = {};
20
+ __export(chunk_QGM4M3NI_exports, {
21
21
  __commonJS: () => __commonJS,
22
- __publicField: () => __publicField,
23
22
  __require: () => __require,
24
23
  __toESM: () => __toESM
25
24
  });
26
- module.exports = __toCommonJS(chunk_FAIJPBT5_exports);
25
+ module.exports = __toCommonJS(chunk_QGM4M3NI_exports);
27
26
  var __create = Object.create;
28
27
  var __defProp2 = Object.defineProperty;
29
28
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
30
29
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
31
30
  var __getProtoOf = Object.getPrototypeOf;
32
31
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
33
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
34
32
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
35
33
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
36
34
  }) : x)(function(x) {
@@ -56,4 +54,3 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
56
54
  isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
57
55
  mod
58
56
  ));
59
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -16,11 +16,11 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_NAG6CCUN_exports = {};
20
- __export(chunk_NAG6CCUN_exports, {
19
+ var chunk_ZLSWUBWT_exports = {};
20
+ __export(chunk_ZLSWUBWT_exports, {
21
21
  generatorHandler: () => generatorHandler
22
22
  });
23
- module.exports = __toCommonJS(chunk_NAG6CCUN_exports);
23
+ module.exports = __toCommonJS(chunk_ZLSWUBWT_exports);
24
24
  var import_chunk_EOPVK4AE = require("./chunk-EOPVK4AE.js");
25
25
  function generatorHandler(handler) {
26
26
  (0, import_chunk_EOPVK4AE.byline)(process.stdin).on("data", async (line) => {
@@ -51,7 +51,7 @@ function generatorHandler(handler) {
51
51
  if (json.method === "getManifest") {
52
52
  if (handler.onManifest) {
53
53
  try {
54
- const manifest = handler.onManifest(json.params);
54
+ const manifest = await handler.onManifest(json.params);
55
55
  respond({
56
56
  jsonrpc: "2.0",
57
57
  result: {
@@ -1,6 +1,6 @@
1
- import type { GeneratorConfig, GeneratorManifest, GeneratorOptions } from './types';
1
+ import type { GeneratorConfig, GeneratorManifest, GeneratorOptions } from '@prisma/generator';
2
2
  export interface Handler {
3
3
  onGenerate(options: GeneratorOptions): Promise<any>;
4
- onManifest?(config: GeneratorConfig): GeneratorManifest;
4
+ onManifest?(config: GeneratorConfig): GeneratorManifest | Promise<GeneratorManifest>;
5
5
  }
6
6
  export declare function generatorHandler(handler: Handler): void;
@@ -18,9 +18,9 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var generatorHandler_exports = {};
20
20
  __export(generatorHandler_exports, {
21
- generatorHandler: () => import_chunk_NAG6CCUN.generatorHandler
21
+ generatorHandler: () => import_chunk_ZLSWUBWT.generatorHandler
22
22
  });
23
23
  module.exports = __toCommonJS(generatorHandler_exports);
24
- var import_chunk_NAG6CCUN = require("./chunk-NAG6CCUN.js");
24
+ var import_chunk_ZLSWUBWT = require("./chunk-ZLSWUBWT.js");
25
25
  var import_chunk_EOPVK4AE = require("./chunk-EOPVK4AE.js");
26
- var import_chunk_FAIJPBT5 = require("./chunk-FAIJPBT5.js");
26
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
package/dist/index.d.ts CHANGED
@@ -1,4 +1,20 @@
1
- export * from './dmmf';
2
1
  export { generatorHandler } from './generatorHandler';
3
2
  export { GeneratorError, GeneratorProcess } from './GeneratorProcess';
4
- export * from './types';
3
+ /**
4
+ * Exported for backwards compatibility only.
5
+ *
6
+ * @deprecated Generators using `@prisma/generator-helper` shouldn't need JSON-RPC internals.
7
+ */
8
+ export type * as JsonRPC from './json-rpc';
9
+ /**
10
+ * A re-export for backwards compatibility with community generators.
11
+ *
12
+ * @deprecated Use the `@prisma/dmmf` package instead.
13
+ */
14
+ export type * as DMMF from '@prisma/dmmf';
15
+ /**
16
+ * A re-export for backwards compatibility with community generators.
17
+ *
18
+ * @deprecated Use the `@prisma/generator` package instead.
19
+ */
20
+ export type * from '@prisma/generator';
package/dist/index.js CHANGED
@@ -18,16 +18,13 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var index_exports = {};
20
20
  __export(index_exports, {
21
- DMMF: () => import_chunk_JU65QD3H.DMMF,
22
- GeneratorError: () => import_chunk_J4U56IA4.GeneratorError,
23
- GeneratorProcess: () => import_chunk_J4U56IA4.GeneratorProcess,
24
- datamodelEnumToSchemaEnum: () => import_chunk_JU65QD3H.datamodelEnumToSchemaEnum,
25
- generatorHandler: () => import_chunk_NAG6CCUN.generatorHandler
21
+ GeneratorError: () => import_chunk_MXZE5TCU.GeneratorError,
22
+ GeneratorProcess: () => import_chunk_MXZE5TCU.GeneratorProcess,
23
+ generatorHandler: () => import_chunk_ZLSWUBWT.generatorHandler
26
24
  });
27
25
  module.exports = __toCommonJS(index_exports);
28
- var import_chunk_J4U56IA4 = require("./chunk-J4U56IA4.js");
29
- var import_chunk_JU65QD3H = require("./chunk-JU65QD3H.js");
30
- var import_chunk_NAG6CCUN = require("./chunk-NAG6CCUN.js");
26
+ var import_chunk_MXZE5TCU = require("./chunk-MXZE5TCU.js");
27
+ var import_chunk_ZLSWUBWT = require("./chunk-ZLSWUBWT.js");
31
28
  var import_chunk_EOPVK4AE = require("./chunk-EOPVK4AE.js");
32
- var import_chunk_FAIJPBT5 = require("./chunk-FAIJPBT5.js");
33
- var import_chunk_6F4PWJZI = require("./chunk-6F4PWJZI.js");
29
+ var import_chunk_KEYE2GFS = require("./chunk-KEYE2GFS.js");
30
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
@@ -0,0 +1,22 @@
1
+ export type Request = {
2
+ jsonrpc: '2.0';
3
+ method: string;
4
+ params?: any;
5
+ id: number;
6
+ };
7
+ export type Response = SuccessResponse | ErrorResponse;
8
+ export type SuccessResponse = {
9
+ jsonrpc: '2.0';
10
+ result: any;
11
+ id: number;
12
+ };
13
+ export type ErrorResponse = {
14
+ jsonrpc: '2.0';
15
+ error: {
16
+ code: number;
17
+ message: string;
18
+ data: any;
19
+ };
20
+ id: number;
21
+ };
22
+ export declare function isErrorResponse(response: Response): response is ErrorResponse;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var json_rpc_exports = {};
20
+ __export(json_rpc_exports, {
21
+ isErrorResponse: () => import_chunk_KEYE2GFS.isErrorResponse
22
+ });
23
+ module.exports = __toCommonJS(json_rpc_exports);
24
+ var import_chunk_KEYE2GFS = require("./chunk-KEYE2GFS.js");
25
+ var import_chunk_QGM4M3NI = require("./chunk-QGM4M3NI.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/generator-helper",
3
- "version": "6.6.0-dev.10",
3
+ "version": "6.6.0-dev.101",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,7 +15,9 @@
15
15
  "homepage": "https://www.prisma.io",
16
16
  "bugs": "https://github.com/prisma/prisma/issues",
17
17
  "dependencies": {
18
- "@prisma/debug": "6.6.0-dev.10"
18
+ "@prisma/dmmf": "6.6.0-dev.101",
19
+ "@prisma/debug": "6.6.0-dev.101",
20
+ "@prisma/generator": "6.6.0-dev.101"
19
21
  },
20
22
  "devDependencies": {
21
23
  "@swc-node/register": "1.10.9",
@@ -23,7 +25,7 @@
23
25
  "@swc/jest": "0.2.37",
24
26
  "@types/jest": "29.5.14",
25
27
  "@types/node": "18.19.76",
26
- "esbuild": "0.24.2",
28
+ "esbuild": "0.25.1",
27
29
  "jest": "29.7.0",
28
30
  "jest-junit": "16.0.0",
29
31
  "ts-node": "10.9.2",
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,55 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_JU65QD3H_exports = {};
20
- __export(chunk_JU65QD3H_exports, {
21
- DMMF: () => DMMF,
22
- datamodelEnumToSchemaEnum: () => datamodelEnumToSchemaEnum
23
- });
24
- module.exports = __toCommonJS(chunk_JU65QD3H_exports);
25
- function datamodelEnumToSchemaEnum(datamodelEnum) {
26
- return {
27
- name: datamodelEnum.name,
28
- values: datamodelEnum.values.map((v) => v.name)
29
- };
30
- }
31
- var DMMF;
32
- ((DMMF2) => {
33
- let ModelAction;
34
- ((ModelAction2) => {
35
- ModelAction2["findUnique"] = "findUnique";
36
- ModelAction2["findUniqueOrThrow"] = "findUniqueOrThrow";
37
- ModelAction2["findFirst"] = "findFirst";
38
- ModelAction2["findFirstOrThrow"] = "findFirstOrThrow";
39
- ModelAction2["findMany"] = "findMany";
40
- ModelAction2["create"] = "create";
41
- ModelAction2["createMany"] = "createMany";
42
- ModelAction2["createManyAndReturn"] = "createManyAndReturn";
43
- ModelAction2["update"] = "update";
44
- ModelAction2["updateMany"] = "updateMany";
45
- ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
46
- ModelAction2["upsert"] = "upsert";
47
- ModelAction2["delete"] = "delete";
48
- ModelAction2["deleteMany"] = "deleteMany";
49
- ModelAction2["groupBy"] = "groupBy";
50
- ModelAction2["count"] = "count";
51
- ModelAction2["aggregate"] = "aggregate";
52
- ModelAction2["findRaw"] = "findRaw";
53
- ModelAction2["aggregateRaw"] = "aggregateRaw";
54
- })(ModelAction = DMMF2.ModelAction || (DMMF2.ModelAction = {}));
55
- })(DMMF || (DMMF = {}));
package/dist/dmmf.d.ts DELETED
@@ -1,242 +0,0 @@
1
- export type ReadonlyDeep<O> = {
2
- +readonly [K in keyof O]: ReadonlyDeep<O[K]>;
3
- };
4
- export declare function datamodelEnumToSchemaEnum(datamodelEnum: DMMF.DatamodelEnum): DMMF.SchemaEnum;
5
- export declare namespace DMMF {
6
- type Document = ReadonlyDeep<{
7
- datamodel: Datamodel;
8
- schema: Schema;
9
- mappings: Mappings;
10
- }>;
11
- type Mappings = ReadonlyDeep<{
12
- modelOperations: ModelMapping[];
13
- otherOperations: {
14
- read: string[];
15
- write: string[];
16
- };
17
- }>;
18
- type OtherOperationMappings = ReadonlyDeep<{
19
- read: string[];
20
- write: string[];
21
- }>;
22
- type DatamodelEnum = ReadonlyDeep<{
23
- name: string;
24
- values: EnumValue[];
25
- dbName?: string | null;
26
- documentation?: string;
27
- }>;
28
- type SchemaEnum = ReadonlyDeep<{
29
- name: string;
30
- values: string[];
31
- }>;
32
- type EnumValue = ReadonlyDeep<{
33
- name: string;
34
- dbName: string | null;
35
- }>;
36
- type Datamodel = ReadonlyDeep<{
37
- models: Model[];
38
- enums: DatamodelEnum[];
39
- types: Model[];
40
- indexes: Index[];
41
- }>;
42
- type uniqueIndex = ReadonlyDeep<{
43
- name: string;
44
- fields: string[];
45
- }>;
46
- type PrimaryKey = ReadonlyDeep<{
47
- name: string | null;
48
- fields: string[];
49
- }>;
50
- type Model = ReadonlyDeep<{
51
- name: string;
52
- dbName: string | null;
53
- schema: string | null;
54
- fields: Field[];
55
- uniqueFields: string[][];
56
- uniqueIndexes: uniqueIndex[];
57
- documentation?: string;
58
- primaryKey: PrimaryKey | null;
59
- isGenerated?: boolean;
60
- }>;
61
- type FieldKind = 'scalar' | 'object' | 'enum' | 'unsupported';
62
- type FieldNamespace = 'model' | 'prisma';
63
- type FieldLocation = 'scalar' | 'inputObjectTypes' | 'outputObjectTypes' | 'enumTypes' | 'fieldRefTypes';
64
- type Field = ReadonlyDeep<{
65
- kind: FieldKind;
66
- name: string;
67
- isRequired: boolean;
68
- isList: boolean;
69
- isUnique: boolean;
70
- isId: boolean;
71
- isReadOnly: boolean;
72
- isGenerated?: boolean;
73
- isUpdatedAt?: boolean;
74
- /**
75
- * Describes the data type in the same the way it is defined in the Prisma schema:
76
- * BigInt, Boolean, Bytes, DateTime, Decimal, Float, Int, JSON, String, $ModelName
77
- */
78
- type: string;
79
- /**
80
- * Native database type, if specified.
81
- * For example, `@db.VarChar(191)` is encoded as `['VarChar', ['191']]`,
82
- * `@db.Text` is encoded as `['Text', []]`.
83
- */
84
- nativeType?: [string, string[]] | null;
85
- dbName?: string | null;
86
- hasDefaultValue: boolean;
87
- default?: FieldDefault | FieldDefaultScalar | FieldDefaultScalar[];
88
- relationFromFields?: string[];
89
- relationToFields?: string[];
90
- relationOnDelete?: string;
91
- relationOnUpdate?: string;
92
- relationName?: string;
93
- documentation?: string;
94
- }>;
95
- type FieldDefault = ReadonlyDeep<{
96
- name: string;
97
- args: Array<string | number>;
98
- }>;
99
- type FieldDefaultScalar = string | boolean | number;
100
- type Index = ReadonlyDeep<{
101
- model: string;
102
- type: IndexType;
103
- isDefinedOnField: boolean;
104
- name?: string;
105
- dbName?: string;
106
- algorithm?: string;
107
- clustered?: boolean;
108
- fields: IndexField[];
109
- }>;
110
- type IndexType = 'id' | 'normal' | 'unique' | 'fulltext';
111
- type IndexField = ReadonlyDeep<{
112
- name: string;
113
- sortOrder?: SortOrder;
114
- length?: number;
115
- operatorClass?: string;
116
- }>;
117
- type SortOrder = 'asc' | 'desc';
118
- type Schema = ReadonlyDeep<{
119
- rootQueryType?: string;
120
- rootMutationType?: string;
121
- inputObjectTypes: {
122
- model?: InputType[];
123
- prisma: InputType[];
124
- };
125
- outputObjectTypes: {
126
- model: OutputType[];
127
- prisma: OutputType[];
128
- };
129
- enumTypes: {
130
- model?: SchemaEnum[];
131
- prisma: SchemaEnum[];
132
- };
133
- fieldRefTypes: {
134
- prisma?: FieldRefType[];
135
- };
136
- }>;
137
- type Query = ReadonlyDeep<{
138
- name: string;
139
- args: SchemaArg[];
140
- output: QueryOutput;
141
- }>;
142
- type QueryOutput = ReadonlyDeep<{
143
- name: string;
144
- isRequired: boolean;
145
- isList: boolean;
146
- }>;
147
- type TypeRef<AllowedLocations extends FieldLocation> = {
148
- isList: boolean;
149
- type: string;
150
- location: AllowedLocations;
151
- namespace?: FieldNamespace;
152
- };
153
- type InputTypeRef = TypeRef<'scalar' | 'inputObjectTypes' | 'enumTypes' | 'fieldRefTypes'>;
154
- type SchemaArg = ReadonlyDeep<{
155
- name: string;
156
- comment?: string;
157
- isNullable: boolean;
158
- isRequired: boolean;
159
- inputTypes: InputTypeRef[];
160
- deprecation?: Deprecation;
161
- }>;
162
- type OutputType = ReadonlyDeep<{
163
- name: string;
164
- fields: SchemaField[];
165
- }>;
166
- type SchemaField = ReadonlyDeep<{
167
- name: string;
168
- isNullable?: boolean;
169
- outputType: OutputTypeRef;
170
- args: SchemaArg[];
171
- deprecation?: Deprecation;
172
- documentation?: string;
173
- }>;
174
- type OutputTypeRef = TypeRef<'scalar' | 'outputObjectTypes' | 'enumTypes'>;
175
- type Deprecation = ReadonlyDeep<{
176
- sinceVersion: string;
177
- reason: string;
178
- plannedRemovalVersion?: string;
179
- }>;
180
- type InputType = ReadonlyDeep<{
181
- name: string;
182
- constraints: {
183
- maxNumFields: number | null;
184
- minNumFields: number | null;
185
- fields?: string[];
186
- };
187
- meta?: {
188
- source?: string;
189
- };
190
- fields: SchemaArg[];
191
- }>;
192
- type FieldRefType = ReadonlyDeep<{
193
- name: string;
194
- allowTypes: FieldRefAllowType[];
195
- fields: SchemaArg[];
196
- }>;
197
- type FieldRefAllowType = TypeRef<'scalar' | 'enumTypes'>;
198
- type ModelMapping = ReadonlyDeep<{
199
- model: string;
200
- plural: string;
201
- findUnique?: string | null;
202
- findUniqueOrThrow?: string | null;
203
- findFirst?: string | null;
204
- findFirstOrThrow?: string | null;
205
- findMany?: string | null;
206
- create?: string | null;
207
- createMany?: string | null;
208
- createManyAndReturn?: string | null;
209
- update?: string | null;
210
- updateMany?: string | null;
211
- updateManyAndReturn?: string | null;
212
- upsert?: string | null;
213
- delete?: string | null;
214
- deleteMany?: string | null;
215
- aggregate?: string | null;
216
- groupBy?: string | null;
217
- count?: string | null;
218
- findRaw?: string | null;
219
- aggregateRaw?: string | null;
220
- }>;
221
- enum ModelAction {
222
- findUnique = "findUnique",
223
- findUniqueOrThrow = "findUniqueOrThrow",
224
- findFirst = "findFirst",
225
- findFirstOrThrow = "findFirstOrThrow",
226
- findMany = "findMany",
227
- create = "create",
228
- createMany = "createMany",
229
- createManyAndReturn = "createManyAndReturn",
230
- update = "update",
231
- updateMany = "updateMany",
232
- updateManyAndReturn = "updateManyAndReturn",
233
- upsert = "upsert",
234
- delete = "delete",
235
- deleteMany = "deleteMany",
236
- groupBy = "groupBy",
237
- count = "count",// TODO: count does not actually exist, why?
238
- aggregate = "aggregate",
239
- findRaw = "findRaw",
240
- aggregateRaw = "aggregateRaw"
241
- }
242
- }
package/dist/types.d.ts DELETED
@@ -1,132 +0,0 @@
1
- import type { DMMF } from './dmmf';
2
- export declare namespace JsonRPC {
3
- type Request = {
4
- jsonrpc: '2.0';
5
- method: string;
6
- params?: any;
7
- id: number;
8
- };
9
- type Response = SuccessResponse | ErrorResponse;
10
- type SuccessResponse = {
11
- jsonrpc: '2.0';
12
- result: any;
13
- id: number;
14
- };
15
- type ErrorResponse = {
16
- jsonrpc: '2.0';
17
- error: {
18
- code: number;
19
- message: string;
20
- data: any;
21
- };
22
- id: number;
23
- };
24
- }
25
- export interface GeneratorConfig {
26
- name: string;
27
- output: EnvValue | null;
28
- isCustomOutput?: boolean;
29
- provider: EnvValue;
30
- config: {
31
- /** `output` is a reserved name and will only be available directly at `generator.output` */
32
- output?: never;
33
- /** `provider` is a reserved name and will only be available directly at `generator.provider` */
34
- provider?: never;
35
- /** `binaryTargets` is a reserved name and will only be available directly at `generator.binaryTargets` */
36
- binaryTargets?: never;
37
- /** `previewFeatures` is a reserved name and will only be available directly at `generator.previewFeatures` */
38
- previewFeatures?: never;
39
- } & {
40
- [key: string]: string | string[] | undefined;
41
- };
42
- binaryTargets: BinaryTargetsEnvValue[];
43
- previewFeatures: string[];
44
- envPaths?: EnvPaths;
45
- sourceFilePath: string;
46
- }
47
- export interface EnvValue {
48
- fromEnvVar: null | string;
49
- value: null | string;
50
- }
51
- export interface BinaryTargetsEnvValue {
52
- fromEnvVar: string | null;
53
- value: string;
54
- native?: boolean;
55
- }
56
- export type ConnectorType = 'mysql' | 'mongodb' | 'sqlite' | 'postgresql' | 'postgres' | 'prisma+postgres' | 'sqlserver' | 'cockroachdb';
57
- export type ActiveConnectorType = Exclude<ConnectorType, 'postgres' | 'prisma+postgres'>;
58
- export interface DataSource {
59
- name: string;
60
- provider: ConnectorType;
61
- activeProvider: ActiveConnectorType;
62
- url: EnvValue;
63
- directUrl?: EnvValue;
64
- schemas: string[] | [];
65
- sourceFilePath: string;
66
- }
67
- export type BinaryPaths = {
68
- schemaEngine?: {
69
- [binaryTarget: string]: string;
70
- };
71
- queryEngine?: {
72
- [binaryTarget: string]: string;
73
- };
74
- libqueryEngine?: {
75
- [binaryTarget: string]: string;
76
- };
77
- };
78
- export type EnvPaths = {
79
- rootEnvPath: string | null;
80
- schemaEnvPath: string | undefined;
81
- };
82
- /** The options passed to the generator implementations */
83
- export type GeneratorOptions = {
84
- generator: GeneratorConfig;
85
- otherGenerators: GeneratorConfig[];
86
- schemaPath: string;
87
- dmmf: DMMF.Document;
88
- datasources: DataSource[];
89
- datamodel: string;
90
- version: string;
91
- binaryPaths?: BinaryPaths;
92
- postinstall?: boolean;
93
- noEngine?: boolean;
94
- noHints?: boolean;
95
- allowNoModels?: boolean;
96
- envPaths?: EnvPaths;
97
- typedSql?: SqlQueryOutput[];
98
- };
99
- export type EngineType = 'queryEngine' | 'libqueryEngine' | 'schemaEngine';
100
- export type GeneratorManifest = {
101
- prettyName?: string;
102
- defaultOutput?: string;
103
- denylists?: {
104
- models?: string[];
105
- fields?: string[];
106
- };
107
- requiresGenerators?: string[];
108
- requiresEngines?: EngineType[];
109
- version?: string;
110
- requiresEngineVersion?: string;
111
- };
112
- export type SqlQueryOutput = {
113
- name: string;
114
- source: string;
115
- documentation: string | null;
116
- parameters: SqlQueryParameterOutput[];
117
- resultColumns: SqlQueryColumnOutput[];
118
- };
119
- export type SqlQueryParameterOutput = {
120
- name: string;
121
- query: string;
122
- typ: QueryIntrospectionType;
123
- documentation: string | null;
124
- nullable: boolean;
125
- };
126
- export type SqlQueryColumnOutput = {
127
- name: string;
128
- typ: QueryIntrospectionType;
129
- nullable: boolean;
130
- };
131
- export type QueryIntrospectionType = QueryIntrospectionBuiltinType | (string & {});
132
- export type QueryIntrospectionBuiltinType = 'int' | 'bigint' | 'float' | 'double' | 'string' | 'enum' | 'bytes' | 'bool' | 'char' | 'decimal' | 'json' | 'xml' | 'uuid' | 'datetime' | 'date' | 'time' | 'int-array' | 'bigint-array' | 'float-array' | 'double-array' | 'string-array' | 'char-array' | 'bytes-array' | 'bool-array' | 'decimal-array' | 'json-array' | 'xml-array' | 'uuid-array' | 'datetime-array' | 'date-array' | 'time-array' | 'null' | 'unknown';
package/dist/types.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- var import_chunk_6F4PWJZI = require("./chunk-6F4PWJZI.js");