@powerlines/plugin-prisma 0.4.97 → 0.4.98

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 (61) hide show
  1. package/dist/client-generator-BPOZ7qom.mjs +146 -0
  2. package/dist/client-generator-BbD4cN4U.mjs +146 -0
  3. package/dist/client-generator-Cg0sxjJx.cjs +152 -0
  4. package/dist/client-generator-ClKJ4yN9.cjs +152 -0
  5. package/dist/get-schema-OhMkdmwI.cjs +138 -0
  6. package/dist/helpers/client-generator.cjs +2 -143
  7. package/dist/helpers/client-generator.mjs +2 -143
  8. package/dist/helpers/get-schema.cjs +2 -100
  9. package/dist/helpers/get-schema.mjs +1 -2
  10. package/dist/helpers/index.cjs +4 -4
  11. package/dist/helpers/index.mjs +1 -1
  12. package/dist/helpers/schema-creator.cjs +1 -1
  13. package/dist/helpers/schema-creator.mjs +1 -2
  14. package/dist/helpers/typed-sql.cjs +1 -1
  15. package/dist/helpers/typed-sql.mjs +1 -2
  16. package/dist/index.cjs +8 -9
  17. package/dist/index.mjs +2 -3
  18. package/dist/types/index.cjs +2 -0
  19. package/dist/types/index.mjs +3 -0
  20. package/package.json +5 -5
  21. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  22. package/dist/helpers/client-generator.d.cts +0 -17
  23. package/dist/helpers/client-generator.d.cts.map +0 -1
  24. package/dist/helpers/client-generator.d.mts +0 -17
  25. package/dist/helpers/client-generator.d.mts.map +0 -1
  26. package/dist/helpers/client-generator.mjs.map +0 -1
  27. package/dist/helpers/get-schema.d.cts +0 -13
  28. package/dist/helpers/get-schema.d.cts.map +0 -1
  29. package/dist/helpers/get-schema.d.mts +0 -13
  30. package/dist/helpers/get-schema.d.mts.map +0 -1
  31. package/dist/helpers/get-schema.mjs.map +0 -1
  32. package/dist/helpers/index.d.cts +0 -5
  33. package/dist/helpers/index.d.mts +0 -5
  34. package/dist/helpers/schema-creator.d.cts +0 -20
  35. package/dist/helpers/schema-creator.d.cts.map +0 -1
  36. package/dist/helpers/schema-creator.d.mts +0 -20
  37. package/dist/helpers/schema-creator.d.mts.map +0 -1
  38. package/dist/helpers/schema-creator.mjs.map +0 -1
  39. package/dist/helpers/typed-sql.d.cts +0 -7
  40. package/dist/helpers/typed-sql.d.cts.map +0 -1
  41. package/dist/helpers/typed-sql.d.mts +0 -7
  42. package/dist/helpers/typed-sql.d.mts.map +0 -1
  43. package/dist/helpers/typed-sql.mjs.map +0 -1
  44. package/dist/index.d.cts +0 -20
  45. package/dist/index.d.cts.map +0 -1
  46. package/dist/index.d.mts +0 -20
  47. package/dist/index.d.mts.map +0 -1
  48. package/dist/index.mjs.map +0 -1
  49. package/dist/package.cjs +0 -11
  50. package/dist/package.mjs +0 -6
  51. package/dist/package.mjs.map +0 -1
  52. package/dist/types/index.d.cts +0 -3
  53. package/dist/types/index.d.mts +0 -3
  54. package/dist/types/plugin.d.cts +0 -111
  55. package/dist/types/plugin.d.cts.map +0 -1
  56. package/dist/types/plugin.d.mts +0 -111
  57. package/dist/types/plugin.d.mts.map +0 -1
  58. package/dist/types/prisma.d.cts +0 -94
  59. package/dist/types/prisma.d.cts.map +0 -1
  60. package/dist/types/prisma.d.mts +0 -94
  61. package/dist/types/prisma.d.mts.map +0 -1
@@ -0,0 +1,138 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+ let _prisma_get_platform = require("@prisma/get-platform");
29
+ let _prisma_prisma_schema_wasm = require("@prisma/prisma-schema-wasm");
30
+ _prisma_prisma_schema_wasm = __toESM(_prisma_prisma_schema_wasm, 1);
31
+ let fp_ts_Either = require("fp-ts/Either");
32
+ fp_ts_Either = __toESM(fp_ts_Either, 1);
33
+ let fp_ts_lib_function = require("fp-ts/lib/function");
34
+ let ts_pattern = require("ts-pattern");
35
+
36
+ //#region src/helpers/get-schema.ts
37
+ async function resolveBinaryTargets(generator) {
38
+ for (const binaryTarget of generator.binaryTargets) {
39
+ if (binaryTarget.fromEnvVar && process.env[binaryTarget.fromEnvVar]) {
40
+ const value = JSON.parse(process.env[binaryTarget.fromEnvVar]);
41
+ if (Array.isArray(value)) {
42
+ generator.binaryTargets = value.map((v) => ({
43
+ fromEnvVar: null,
44
+ value: v
45
+ }));
46
+ await resolveBinaryTargets(generator);
47
+ } else binaryTarget.value = value;
48
+ }
49
+ if (binaryTarget.value === "native") {
50
+ binaryTarget.value = await (0, _prisma_get_platform.getBinaryTargetForCurrentPlatform)();
51
+ binaryTarget.native = true;
52
+ }
53
+ }
54
+ if (generator.binaryTargets.length === 0) generator.binaryTargets = [{
55
+ fromEnvVar: null,
56
+ value: await (0, _prisma_get_platform.getBinaryTargetForCurrentPlatform)(),
57
+ native: true
58
+ }];
59
+ }
60
+ /**
61
+ * Retrieves the Prisma schema using the provided options.
62
+ *
63
+ * @param schemaPath - The path to the Prisma schema file.
64
+ * @returns The Prisma schema.
65
+ */
66
+ async function resolveDataModel(schemaPath) {
67
+ const configEither = (0, fp_ts_lib_function.pipe)(fp_ts_Either.tryCatch(() => {
68
+ if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_CONFIG) _prisma_prisma_schema_wasm.default.debug_panic();
69
+ const params = JSON.stringify({
70
+ prismaSchema: schemaPath,
71
+ datasourceOverrides: {},
72
+ ignoreEnvVarErrors: true,
73
+ env: process.env
74
+ });
75
+ return _prisma_prisma_schema_wasm.default.get_config(params);
76
+ }, (e) => ({
77
+ type: "wasm-error",
78
+ reason: "(get-config wasm)",
79
+ error: e
80
+ })), fp_ts_Either.map((result) => ({ result })), fp_ts_Either.chainW(({ result }) => fp_ts_Either.tryCatch(() => JSON.parse(result), (e) => ({
81
+ type: "parse-json",
82
+ reason: "Unable to parse JSON",
83
+ error: e
84
+ }))), fp_ts_Either.chainW((response) => {
85
+ if (response.errors.length > 0) return fp_ts_Either.left({
86
+ type: "validation-error",
87
+ reason: "(get-config wasm)",
88
+ error: response.errors
89
+ });
90
+ return fp_ts_Either.right(response.config);
91
+ }));
92
+ if (fp_ts_Either.isRight(configEither)) {
93
+ const { right: data } = configEither;
94
+ for (const generator of data.generators) await resolveBinaryTargets(generator);
95
+ return Promise.resolve(data);
96
+ }
97
+ throw (0, ts_pattern.match)(configEither.left).with({ type: "wasm-error" }, (e) => {
98
+ return /* @__PURE__ */ new Error(`Prisma get-config Wasm runtime error: ${e.error.message}`);
99
+ }).with({ type: "validation-error" }, (e) => {
100
+ return /* @__PURE__ */ new Error(`Prisma get-config validation error: ${e.error.map((err) => err.message).join(", ")}`);
101
+ }).otherwise((e) => {
102
+ return /* @__PURE__ */ new Error(`Prisma get-config unknown error: ${e.reason} - ${e.error.message}`);
103
+ });
104
+ }
105
+ /**
106
+ * Retrieves the Prisma schema using the provided path.
107
+ *
108
+ * @param path - The path to the Prisma schema file.
109
+ * @returns The Prisma schema.
110
+ */
111
+ async function getSchema(path) {
112
+ const schema = {
113
+ path,
114
+ content: "",
115
+ generators: [],
116
+ datasources: [],
117
+ warnings: []
118
+ };
119
+ const dataModel = await resolveDataModel(path);
120
+ return {
121
+ ...schema,
122
+ ...dataModel
123
+ };
124
+ }
125
+
126
+ //#endregion
127
+ Object.defineProperty(exports, '__toESM', {
128
+ enumerable: true,
129
+ get: function () {
130
+ return __toESM;
131
+ }
132
+ });
133
+ Object.defineProperty(exports, 'getSchema', {
134
+ enumerable: true,
135
+ get: function () {
136
+ return getSchema;
137
+ }
138
+ });
@@ -1,145 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_package = require('../package.cjs');
4
- let _stryke_path_find = require("@stryke/path/find");
5
- let _prisma_client_generator_ts = require("@prisma/client-generator-ts");
6
- let _prisma_engines_version = require("@prisma/engines-version");
7
- let _stryke_convert_buffer_to_string = require("@stryke/convert/buffer-to-string");
8
- let _stryke_path_replace = require("@stryke/path/replace");
9
- let _stryke_type_checks_is_buffer = require("@stryke/type-checks/is-buffer");
10
- let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
2
+ const require_client_generator = require('../client-generator-Cg0sxjJx.cjs');
11
3
 
12
- //#region src/helpers/client-generator.ts
13
- var PowerlinesClientGenerator = class {
14
- #options;
15
- name = "powerlines-client";
16
- constructor(context) {
17
- this.context = context;
18
- this.#options = {
19
- name: this.name,
20
- output: null,
21
- config: {},
22
- provider: {
23
- fromEnvVar: "POWERLINES_CLIENT_PROVIDER",
24
- value: this.name
25
- },
26
- binaryTargets: [],
27
- previewFeatures: this.context.prisma.previewFeatures,
28
- sourceFilePath: this.context.prisma.schema.schemaRootDir
29
- };
30
- }
31
- async getManifest(_config) {
32
- return Promise.resolve({
33
- defaultOutput: "./generated",
34
- prettyName: "Powerlines Client",
35
- version: require_package.version,
36
- requiresEngines: [],
37
- requiresEngineVersion: _prisma_engines_version.enginesVersion
38
- });
39
- }
40
- async generate() {
41
- const { prismaClientDmmf, fileMap } = (0, _prisma_client_generator_ts.buildClient)({
42
- datamodel: this.context.prisma.schema.schemas.map((s) => s.content).join("\n"),
43
- schemaPath: this.context.prisma.schema.schemaPath,
44
- binaryPaths: {},
45
- datasources: this.context.prisma.schema.datasources,
46
- outputDir: this.context.config.prisma.outputPath,
47
- runtimeBase: "@prisma/client/runtime",
48
- dmmf: this.context.prisma.dmmf,
49
- generator: this.#options,
50
- engineVersion: _prisma_engines_version.enginesVersion,
51
- clientVersion: require_package.version,
52
- activeProvider: this.context.prisma.schema.primaryDatasource?.activeProvider,
53
- typedSql: this.context.prisma.typedSql,
54
- target: this.context.config.prisma.runtime,
55
- generatedFileExtension: "ts",
56
- importFileExtension: "ts",
57
- moduleFormat: "esm",
58
- tsNoCheckPreamble: true,
59
- compilerBuild: "fast"
60
- });
61
- const errorArray = [];
62
- const denylists = {
63
- models: [
64
- "PrismaClient",
65
- "Prisma",
66
- "async",
67
- "await",
68
- "break",
69
- "case",
70
- "catch",
71
- "class",
72
- "const",
73
- "continue",
74
- "debugger",
75
- "default",
76
- "delete",
77
- "do",
78
- "else",
79
- "enum",
80
- "export",
81
- "extends",
82
- "false",
83
- "finally",
84
- "for",
85
- "function",
86
- "if",
87
- "implements",
88
- "import",
89
- "in",
90
- "instanceof",
91
- "interface",
92
- "let",
93
- "new",
94
- "null",
95
- "package",
96
- "private",
97
- "protected",
98
- "public",
99
- "return",
100
- "super",
101
- "switch",
102
- "this",
103
- "throw",
104
- "true",
105
- "try",
106
- "using",
107
- "typeof",
108
- "var",
109
- "void",
110
- "while",
111
- "with",
112
- "yield"
113
- ],
114
- fields: [
115
- "AND",
116
- "OR",
117
- "NOT"
118
- ],
119
- dynamic: []
120
- };
121
- if (prismaClientDmmf.datamodel.enums) {
122
- for (const it of prismaClientDmmf.datamodel.enums) if (denylists.models.includes(it.name) || denylists.fields.includes(it.name)) errorArray.push(/* @__PURE__ */ new Error(`"enum ${it.name}"`));
123
- }
124
- if (prismaClientDmmf.datamodel.models) {
125
- for (const it of prismaClientDmmf.datamodel.models) if (denylists.models.includes(it.name) || denylists.fields.includes(it.name)) errorArray.push(/* @__PURE__ */ new Error(`"model ${it.name}"`));
126
- }
127
- if (errorArray.length > 0) {
128
- let message = `Error: The schema at "${this.context.prisma.schema.schemaPath}" contains reserved keywords.\n Rename the following items:`;
129
- for (const error of errorArray) message += `\n - ${error.message}`;
130
- throw new Error(`${message}\nTo learn more about how to rename models, check out https://pris.ly/d/naming-models`);
131
- }
132
- await this.writeFileMap(fileMap);
133
- }
134
- stop() {}
135
- async writeFileMap(fileMap) {
136
- return Promise.all(Object.entries(fileMap).map(async ([fileName, content]) => {
137
- if ((0, _stryke_type_checks_is_string.isString)(content)) this.context.emitBuiltinSync(content, `prisma/${(0, _stryke_path_replace.replaceExtension)(fileName)}`, { extension: (0, _stryke_path_find.findFileExtension)(fileName) || "ts" });
138
- else if ((0, _stryke_type_checks_is_buffer.isBuffer)(content)) this.context.emitBuiltinSync((0, _stryke_convert_buffer_to_string.bufferToString)(content), `prisma/${(0, _stryke_path_replace.replaceExtension)(fileName)}`, { extension: (0, _stryke_path_find.findFileExtension)(fileName) || "ts" });
139
- else await this.writeFileMap(content);
140
- }));
141
- }
142
- };
143
-
144
- //#endregion
145
- exports.PowerlinesClientGenerator = PowerlinesClientGenerator;
4
+ exports.PowerlinesClientGenerator = require_client_generator.PowerlinesClientGenerator;
@@ -1,144 +1,3 @@
1
- import { version } from "../package.mjs";
2
- import { findFileExtension } from "@stryke/path/find";
3
- import { buildClient } from "@prisma/client-generator-ts";
4
- import { enginesVersion } from "@prisma/engines-version";
5
- import { bufferToString } from "@stryke/convert/buffer-to-string";
6
- import { replaceExtension } from "@stryke/path/replace";
7
- import { isBuffer } from "@stryke/type-checks/is-buffer";
8
- import { isString } from "@stryke/type-checks/is-string";
1
+ import { t as PowerlinesClientGenerator } from "../client-generator-BPOZ7qom.mjs";
9
2
 
10
- //#region src/helpers/client-generator.ts
11
- var PowerlinesClientGenerator = class {
12
- #options;
13
- name = "powerlines-client";
14
- constructor(context) {
15
- this.context = context;
16
- this.#options = {
17
- name: this.name,
18
- output: null,
19
- config: {},
20
- provider: {
21
- fromEnvVar: "POWERLINES_CLIENT_PROVIDER",
22
- value: this.name
23
- },
24
- binaryTargets: [],
25
- previewFeatures: this.context.prisma.previewFeatures,
26
- sourceFilePath: this.context.prisma.schema.schemaRootDir
27
- };
28
- }
29
- async getManifest(_config) {
30
- return Promise.resolve({
31
- defaultOutput: "./generated",
32
- prettyName: "Powerlines Client",
33
- version,
34
- requiresEngines: [],
35
- requiresEngineVersion: enginesVersion
36
- });
37
- }
38
- async generate() {
39
- const { prismaClientDmmf, fileMap } = buildClient({
40
- datamodel: this.context.prisma.schema.schemas.map((s) => s.content).join("\n"),
41
- schemaPath: this.context.prisma.schema.schemaPath,
42
- binaryPaths: {},
43
- datasources: this.context.prisma.schema.datasources,
44
- outputDir: this.context.config.prisma.outputPath,
45
- runtimeBase: "@prisma/client/runtime",
46
- dmmf: this.context.prisma.dmmf,
47
- generator: this.#options,
48
- engineVersion: enginesVersion,
49
- clientVersion: version,
50
- activeProvider: this.context.prisma.schema.primaryDatasource?.activeProvider,
51
- typedSql: this.context.prisma.typedSql,
52
- target: this.context.config.prisma.runtime,
53
- generatedFileExtension: "ts",
54
- importFileExtension: "ts",
55
- moduleFormat: "esm",
56
- tsNoCheckPreamble: true,
57
- compilerBuild: "fast"
58
- });
59
- const errorArray = [];
60
- const denylists = {
61
- models: [
62
- "PrismaClient",
63
- "Prisma",
64
- "async",
65
- "await",
66
- "break",
67
- "case",
68
- "catch",
69
- "class",
70
- "const",
71
- "continue",
72
- "debugger",
73
- "default",
74
- "delete",
75
- "do",
76
- "else",
77
- "enum",
78
- "export",
79
- "extends",
80
- "false",
81
- "finally",
82
- "for",
83
- "function",
84
- "if",
85
- "implements",
86
- "import",
87
- "in",
88
- "instanceof",
89
- "interface",
90
- "let",
91
- "new",
92
- "null",
93
- "package",
94
- "private",
95
- "protected",
96
- "public",
97
- "return",
98
- "super",
99
- "switch",
100
- "this",
101
- "throw",
102
- "true",
103
- "try",
104
- "using",
105
- "typeof",
106
- "var",
107
- "void",
108
- "while",
109
- "with",
110
- "yield"
111
- ],
112
- fields: [
113
- "AND",
114
- "OR",
115
- "NOT"
116
- ],
117
- dynamic: []
118
- };
119
- if (prismaClientDmmf.datamodel.enums) {
120
- for (const it of prismaClientDmmf.datamodel.enums) if (denylists.models.includes(it.name) || denylists.fields.includes(it.name)) errorArray.push(/* @__PURE__ */ new Error(`"enum ${it.name}"`));
121
- }
122
- if (prismaClientDmmf.datamodel.models) {
123
- for (const it of prismaClientDmmf.datamodel.models) if (denylists.models.includes(it.name) || denylists.fields.includes(it.name)) errorArray.push(/* @__PURE__ */ new Error(`"model ${it.name}"`));
124
- }
125
- if (errorArray.length > 0) {
126
- let message = `Error: The schema at "${this.context.prisma.schema.schemaPath}" contains reserved keywords.\n Rename the following items:`;
127
- for (const error of errorArray) message += `\n - ${error.message}`;
128
- throw new Error(`${message}\nTo learn more about how to rename models, check out https://pris.ly/d/naming-models`);
129
- }
130
- await this.writeFileMap(fileMap);
131
- }
132
- stop() {}
133
- async writeFileMap(fileMap) {
134
- return Promise.all(Object.entries(fileMap).map(async ([fileName, content]) => {
135
- if (isString(content)) this.context.emitBuiltinSync(content, `prisma/${replaceExtension(fileName)}`, { extension: findFileExtension(fileName) || "ts" });
136
- else if (isBuffer(content)) this.context.emitBuiltinSync(bufferToString(content), `prisma/${replaceExtension(fileName)}`, { extension: findFileExtension(fileName) || "ts" });
137
- else await this.writeFileMap(content);
138
- }));
139
- }
140
- };
141
-
142
- //#endregion
143
- export { PowerlinesClientGenerator };
144
- //# sourceMappingURL=client-generator.mjs.map
3
+ export { PowerlinesClientGenerator };
@@ -1,102 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let _prisma_get_platform = require("@prisma/get-platform");
4
- let _prisma_prisma_schema_wasm = require("@prisma/prisma-schema-wasm");
5
- _prisma_prisma_schema_wasm = require_runtime.__toESM(_prisma_prisma_schema_wasm, 1);
6
- let fp_ts_Either = require("fp-ts/Either");
7
- fp_ts_Either = require_runtime.__toESM(fp_ts_Either, 1);
8
- let fp_ts_lib_function = require("fp-ts/lib/function");
9
- let ts_pattern = require("ts-pattern");
2
+ const require_get_schema = require('../get-schema-OhMkdmwI.cjs');
10
3
 
11
- //#region src/helpers/get-schema.ts
12
- async function resolveBinaryTargets(generator) {
13
- for (const binaryTarget of generator.binaryTargets) {
14
- if (binaryTarget.fromEnvVar && process.env[binaryTarget.fromEnvVar]) {
15
- const value = JSON.parse(process.env[binaryTarget.fromEnvVar]);
16
- if (Array.isArray(value)) {
17
- generator.binaryTargets = value.map((v) => ({
18
- fromEnvVar: null,
19
- value: v
20
- }));
21
- await resolveBinaryTargets(generator);
22
- } else binaryTarget.value = value;
23
- }
24
- if (binaryTarget.value === "native") {
25
- binaryTarget.value = await (0, _prisma_get_platform.getBinaryTargetForCurrentPlatform)();
26
- binaryTarget.native = true;
27
- }
28
- }
29
- if (generator.binaryTargets.length === 0) generator.binaryTargets = [{
30
- fromEnvVar: null,
31
- value: await (0, _prisma_get_platform.getBinaryTargetForCurrentPlatform)(),
32
- native: true
33
- }];
34
- }
35
- /**
36
- * Retrieves the Prisma schema using the provided options.
37
- *
38
- * @param schemaPath - The path to the Prisma schema file.
39
- * @returns The Prisma schema.
40
- */
41
- async function resolveDataModel(schemaPath) {
42
- const configEither = (0, fp_ts_lib_function.pipe)(fp_ts_Either.tryCatch(() => {
43
- if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_CONFIG) _prisma_prisma_schema_wasm.default.debug_panic();
44
- const params = JSON.stringify({
45
- prismaSchema: schemaPath,
46
- datasourceOverrides: {},
47
- ignoreEnvVarErrors: true,
48
- env: process.env
49
- });
50
- return _prisma_prisma_schema_wasm.default.get_config(params);
51
- }, (e) => ({
52
- type: "wasm-error",
53
- reason: "(get-config wasm)",
54
- error: e
55
- })), fp_ts_Either.map((result) => ({ result })), fp_ts_Either.chainW(({ result }) => fp_ts_Either.tryCatch(() => JSON.parse(result), (e) => ({
56
- type: "parse-json",
57
- reason: "Unable to parse JSON",
58
- error: e
59
- }))), fp_ts_Either.chainW((response) => {
60
- if (response.errors.length > 0) return fp_ts_Either.left({
61
- type: "validation-error",
62
- reason: "(get-config wasm)",
63
- error: response.errors
64
- });
65
- return fp_ts_Either.right(response.config);
66
- }));
67
- if (fp_ts_Either.isRight(configEither)) {
68
- const { right: data } = configEither;
69
- for (const generator of data.generators) await resolveBinaryTargets(generator);
70
- return Promise.resolve(data);
71
- }
72
- throw (0, ts_pattern.match)(configEither.left).with({ type: "wasm-error" }, (e) => {
73
- return /* @__PURE__ */ new Error(`Prisma get-config Wasm runtime error: ${e.error.message}`);
74
- }).with({ type: "validation-error" }, (e) => {
75
- return /* @__PURE__ */ new Error(`Prisma get-config validation error: ${e.error.map((err) => err.message).join(", ")}`);
76
- }).otherwise((e) => {
77
- return /* @__PURE__ */ new Error(`Prisma get-config unknown error: ${e.reason} - ${e.error.message}`);
78
- });
79
- }
80
- /**
81
- * Retrieves the Prisma schema using the provided path.
82
- *
83
- * @param path - The path to the Prisma schema file.
84
- * @returns The Prisma schema.
85
- */
86
- async function getSchema(path) {
87
- const schema = {
88
- path,
89
- content: "",
90
- generators: [],
91
- datasources: [],
92
- warnings: []
93
- };
94
- const dataModel = await resolveDataModel(path);
95
- return {
96
- ...schema,
97
- ...dataModel
98
- };
99
- }
100
-
101
- //#endregion
102
- exports.getSchema = getSchema;
4
+ exports.getSchema = require_get_schema.getSchema;
@@ -95,5 +95,4 @@ async function getSchema(path) {
95
95
  }
96
96
 
97
97
  //#endregion
98
- export { getSchema };
99
- //# sourceMappingURL=get-schema.mjs.map
98
+ export { getSchema };
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_helpers_client_generator = require('./client-generator.cjs');
3
- const require_helpers_get_schema = require('./get-schema.cjs');
2
+ const require_get_schema = require('../get-schema-OhMkdmwI.cjs');
3
+ const require_client_generator = require('../client-generator-Cg0sxjJx.cjs');
4
4
  const require_helpers_schema_creator = require('./schema-creator.cjs');
5
5
  const require_helpers_typed_sql = require('./typed-sql.cjs');
6
6
 
7
- exports.PowerlinesClientGenerator = require_helpers_client_generator.PowerlinesClientGenerator;
7
+ exports.PowerlinesClientGenerator = require_client_generator.PowerlinesClientGenerator;
8
8
  exports.PrismaSchemaCreator = require_helpers_schema_creator.PrismaSchemaCreator;
9
- exports.getSchema = require_helpers_get_schema.getSchema;
9
+ exports.getSchema = require_get_schema.getSchema;
10
10
  exports.introspectSql = require_helpers_typed_sql.introspectSql;
@@ -1,4 +1,4 @@
1
- import { PowerlinesClientGenerator } from "./client-generator.mjs";
1
+ import { t as PowerlinesClientGenerator } from "../client-generator-BPOZ7qom.mjs";
2
2
  import { getSchema } from "./get-schema.mjs";
3
3
  import { PrismaSchemaCreator } from "./schema-creator.mjs";
4
4
  import { introspectSql } from "./typed-sql.mjs";
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ const require_get_schema = require('../get-schema-OhMkdmwI.cjs');
3
3
  let prisma_util_schema_creator = require("prisma-util/schema-creator");
4
4
 
5
5
  //#region src/helpers/schema-creator.ts
@@ -57,5 +57,4 @@ ${schema}`;
57
57
  };
58
58
 
59
59
  //#endregion
60
- export { PrismaSchemaCreator };
61
- //# sourceMappingURL=schema-creator.mjs.map
60
+ export { PrismaSchemaCreator };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ const require_get_schema = require('../get-schema-OhMkdmwI.cjs');
3
3
  let _prisma_internals = require("@prisma/internals");
4
4
  let _prisma_migrate = require("@prisma/migrate");
5
5
  let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
@@ -33,5 +33,4 @@ async function introspectSql(context) {
33
33
  }
34
34
 
35
35
  //#endregion
36
- export { introspectSql };
37
- //# sourceMappingURL=typed-sql.mjs.map
36
+ export { introspectSql };
package/dist/index.cjs CHANGED
@@ -1,16 +1,15 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
- const require_helpers_client_generator = require('./helpers/client-generator.cjs');
4
- const require_helpers_get_schema = require('./helpers/get-schema.cjs');
2
+ const require_get_schema = require('./get-schema-OhMkdmwI.cjs');
3
+ const require_client_generator = require('./client-generator-Cg0sxjJx.cjs');
5
4
  const require_helpers_schema_creator = require('./helpers/schema-creator.cjs');
6
5
  const require_helpers_typed_sql = require('./helpers/typed-sql.cjs');
7
6
  let _powerlines_plugin_pulumi = require("@powerlines/plugin-pulumi");
8
- _powerlines_plugin_pulumi = require_runtime.__toESM(_powerlines_plugin_pulumi, 1);
7
+ _powerlines_plugin_pulumi = require_get_schema.__toESM(_powerlines_plugin_pulumi, 1);
9
8
  let _prisma_client_generator_registry = require("@prisma/client-generator-registry");
10
9
  let _prisma_engines = require("@prisma/engines");
11
10
  let _prisma_internals = require("@prisma/internals");
12
11
  let _pulumi_prisma_postgres = require("@pulumi/prisma-postgres");
13
- _pulumi_prisma_postgres = require_runtime.__toESM(_pulumi_prisma_postgres, 1);
12
+ _pulumi_prisma_postgres = require_get_schema.__toESM(_pulumi_prisma_postgres, 1);
14
13
  let _stryke_convert_to_array = require("@stryke/convert/to-array");
15
14
  let _stryke_path_append = require("@stryke/path/append");
16
15
  let _stryke_path_common = require("@stryke/path/common");
@@ -19,7 +18,7 @@ let _stryke_path_join_paths = require("@stryke/path/join-paths");
19
18
  let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
20
19
  let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
21
20
  let defu = require("defu");
22
- defu = require_runtime.__toESM(defu, 1);
21
+ defu = require_get_schema.__toESM(defu, 1);
23
22
  let powerlines_plugin_utils = require("powerlines/plugin-utils");
24
23
 
25
24
  //#region src/index.ts
@@ -68,7 +67,7 @@ const plugin = (options = {}) => {
68
67
  warnings: [],
69
68
  primaryDatasource: void 0
70
69
  };
71
- this.prisma.schema.schemas = await Promise.all((await this.fs.glob(this.config.prisma.schema.map((schema) => schema.includes("*") || this.fs.isFileSync(schema) ? schema : (0, _stryke_path_join_paths.joinPaths)(schema, "**/*.prisma")))).map(async (schema) => require_helpers_get_schema.getSchema(schema)));
70
+ this.prisma.schema.schemas = await Promise.all((await this.fs.glob(this.config.prisma.schema.map((schema) => schema.includes("*") || this.fs.isFileSync(schema) ? schema : (0, _stryke_path_join_paths.joinPaths)(schema, "**/*.prisma")))).map(async (schema) => require_get_schema.getSchema(schema)));
72
71
  this.prisma.schema = this.prisma.schema.schemas.reduce((ret, schema) => {
73
72
  ret.datasources.push(...schema.datasources);
74
73
  ret.generators.push(...schema.generators);
@@ -102,12 +101,12 @@ const plugin = (options = {}) => {
102
101
  "prisma-client-ts"
103
102
  ].includes(gen.name || gen.getProvider()))) {
104
103
  generators ??= [];
105
- generators.push(new require_helpers_client_generator.PowerlinesClientGenerator(this));
104
+ generators.push(new require_client_generator.PowerlinesClientGenerator(this));
106
105
  } else generators = generators.map((generator) => [
107
106
  "prisma-client",
108
107
  "prisma-client-js",
109
108
  "prisma-client-ts"
110
- ].includes(generator.name || generator.getProvider()) ? new require_helpers_client_generator.PowerlinesClientGenerator(this) : generator);
109
+ ].includes(generator.name || generator.getProvider()) ? new require_client_generator.PowerlinesClientGenerator(this) : generator);
111
110
  for (const generator of generators) try {
112
111
  await generator.generate();
113
112
  generator.stop();
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { PowerlinesClientGenerator } from "./helpers/client-generator.mjs";
1
+ import { t as PowerlinesClientGenerator } from "./client-generator-BPOZ7qom.mjs";
2
2
  import { getSchema } from "./helpers/get-schema.mjs";
3
3
  import { PrismaSchemaCreator } from "./helpers/schema-creator.mjs";
4
4
  import { introspectSql } from "./helpers/typed-sql.mjs";
@@ -141,5 +141,4 @@ const plugin = (options = {}) => {
141
141
  };
142
142
 
143
143
  //#endregion
144
- export { plugin as default, plugin };
145
- //# sourceMappingURL=index.mjs.map
144
+ export { plugin as default, plugin };
@@ -0,0 +1,2 @@
1
+ require('./prisma.cjs');
2
+ require('./plugin.cjs');
@@ -1 +1,4 @@
1
+ import "./prisma.mjs";
2
+ import "./plugin.mjs";
3
+
1
4
  export { };