@powerlines/plugin-prisma 0.4.45 → 0.4.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,152 @@
1
+ const require_get_schema = require('./get-schema-Dq1-Jwvo.cjs');
2
+ let _stryke_path_find = require("@stryke/path/find");
3
+ let _prisma_client_generator_ts = require("@prisma/client-generator-ts");
4
+ let _prisma_engines_version = require("@prisma/engines-version");
5
+ let _stryke_convert_buffer_to_string = require("@stryke/convert/buffer-to-string");
6
+ let _stryke_path_replace = require("@stryke/path/replace");
7
+ let _stryke_type_checks_is_buffer = require("@stryke/type-checks/is-buffer");
8
+ let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
9
+
10
+ //#region package.json
11
+ var version = "0.4.48";
12
+
13
+ //#endregion
14
+ //#region src/helpers/client-generator.ts
15
+ var PowerlinesClientGenerator = class {
16
+ #options;
17
+ name = "powerlines-client";
18
+ constructor(context) {
19
+ this.context = context;
20
+ this.#options = {
21
+ name: this.name,
22
+ output: null,
23
+ config: {},
24
+ provider: {
25
+ fromEnvVar: "POWERLINES_CLIENT_PROVIDER",
26
+ value: this.name
27
+ },
28
+ binaryTargets: [],
29
+ previewFeatures: this.context.prisma.previewFeatures,
30
+ sourceFilePath: this.context.prisma.schema.schemaRootDir
31
+ };
32
+ }
33
+ async getManifest(_config) {
34
+ return Promise.resolve({
35
+ defaultOutput: "./generated",
36
+ prettyName: "Powerlines Client",
37
+ version,
38
+ requiresEngines: [],
39
+ requiresEngineVersion: _prisma_engines_version.enginesVersion
40
+ });
41
+ }
42
+ async generate() {
43
+ const { prismaClientDmmf, fileMap } = (0, _prisma_client_generator_ts.buildClient)({
44
+ datamodel: this.context.prisma.schema.schemas.map((s) => s.content).join("\n"),
45
+ schemaPath: this.context.prisma.schema.schemaPath,
46
+ binaryPaths: {},
47
+ datasources: this.context.prisma.schema.datasources,
48
+ outputDir: this.context.config.prisma.outputPath,
49
+ runtimeBase: "@prisma/client/runtime",
50
+ dmmf: this.context.prisma.dmmf,
51
+ generator: this.#options,
52
+ engineVersion: _prisma_engines_version.enginesVersion,
53
+ clientVersion: version,
54
+ activeProvider: this.context.prisma.schema.primaryDatasource?.activeProvider,
55
+ typedSql: this.context.prisma.typedSql,
56
+ target: this.context.config.prisma.runtime,
57
+ generatedFileExtension: "ts",
58
+ importFileExtension: "ts",
59
+ moduleFormat: "esm",
60
+ tsNoCheckPreamble: true,
61
+ compilerBuild: "fast"
62
+ });
63
+ const errorArray = [];
64
+ const denylists = {
65
+ models: [
66
+ "PrismaClient",
67
+ "Prisma",
68
+ "async",
69
+ "await",
70
+ "break",
71
+ "case",
72
+ "catch",
73
+ "class",
74
+ "const",
75
+ "continue",
76
+ "debugger",
77
+ "default",
78
+ "delete",
79
+ "do",
80
+ "else",
81
+ "enum",
82
+ "export",
83
+ "extends",
84
+ "false",
85
+ "finally",
86
+ "for",
87
+ "function",
88
+ "if",
89
+ "implements",
90
+ "import",
91
+ "in",
92
+ "instanceof",
93
+ "interface",
94
+ "let",
95
+ "new",
96
+ "null",
97
+ "package",
98
+ "private",
99
+ "protected",
100
+ "public",
101
+ "return",
102
+ "super",
103
+ "switch",
104
+ "this",
105
+ "throw",
106
+ "true",
107
+ "try",
108
+ "using",
109
+ "typeof",
110
+ "var",
111
+ "void",
112
+ "while",
113
+ "with",
114
+ "yield"
115
+ ],
116
+ fields: [
117
+ "AND",
118
+ "OR",
119
+ "NOT"
120
+ ],
121
+ dynamic: []
122
+ };
123
+ if (prismaClientDmmf.datamodel.enums) {
124
+ 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}"`));
125
+ }
126
+ if (prismaClientDmmf.datamodel.models) {
127
+ 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}"`));
128
+ }
129
+ if (errorArray.length > 0) {
130
+ let message = `Error: The schema at "${this.context.prisma.schema.schemaPath}" contains reserved keywords.\n Rename the following items:`;
131
+ for (const error of errorArray) message += `\n - ${error.message}`;
132
+ throw new Error(`${message}\nTo learn more about how to rename models, check out https://pris.ly/d/naming-models`);
133
+ }
134
+ await this.writeFileMap(fileMap);
135
+ }
136
+ stop() {}
137
+ async writeFileMap(fileMap) {
138
+ return Promise.all(Object.entries(fileMap).map(async ([fileName, content]) => {
139
+ 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" });
140
+ 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" });
141
+ else await this.writeFileMap(content);
142
+ }));
143
+ }
144
+ };
145
+
146
+ //#endregion
147
+ Object.defineProperty(exports, 'PowerlinesClientGenerator', {
148
+ enumerable: true,
149
+ get: function () {
150
+ return PowerlinesClientGenerator;
151
+ }
152
+ });
@@ -0,0 +1,146 @@
1
+ import { findFileExtension } from "@stryke/path/find";
2
+ import { buildClient } from "@prisma/client-generator-ts";
3
+ import { enginesVersion } from "@prisma/engines-version";
4
+ import { bufferToString } from "@stryke/convert/buffer-to-string";
5
+ import { replaceExtension } from "@stryke/path/replace";
6
+ import { isBuffer } from "@stryke/type-checks/is-buffer";
7
+ import { isString } from "@stryke/type-checks/is-string";
8
+
9
+ //#region package.json
10
+ var version = "0.4.47";
11
+
12
+ //#endregion
13
+ //#region src/helpers/client-generator.ts
14
+ var PowerlinesClientGenerator = class {
15
+ #options;
16
+ name = "powerlines-client";
17
+ constructor(context) {
18
+ this.context = context;
19
+ this.#options = {
20
+ name: this.name,
21
+ output: null,
22
+ config: {},
23
+ provider: {
24
+ fromEnvVar: "POWERLINES_CLIENT_PROVIDER",
25
+ value: this.name
26
+ },
27
+ binaryTargets: [],
28
+ previewFeatures: this.context.prisma.previewFeatures,
29
+ sourceFilePath: this.context.prisma.schema.schemaRootDir
30
+ };
31
+ }
32
+ async getManifest(_config) {
33
+ return Promise.resolve({
34
+ defaultOutput: "./generated",
35
+ prettyName: "Powerlines Client",
36
+ version,
37
+ requiresEngines: [],
38
+ requiresEngineVersion: enginesVersion
39
+ });
40
+ }
41
+ async generate() {
42
+ const { prismaClientDmmf, fileMap } = buildClient({
43
+ datamodel: this.context.prisma.schema.schemas.map((s) => s.content).join("\n"),
44
+ schemaPath: this.context.prisma.schema.schemaPath,
45
+ binaryPaths: {},
46
+ datasources: this.context.prisma.schema.datasources,
47
+ outputDir: this.context.config.prisma.outputPath,
48
+ runtimeBase: "@prisma/client/runtime",
49
+ dmmf: this.context.prisma.dmmf,
50
+ generator: this.#options,
51
+ engineVersion: enginesVersion,
52
+ clientVersion: version,
53
+ activeProvider: this.context.prisma.schema.primaryDatasource?.activeProvider,
54
+ typedSql: this.context.prisma.typedSql,
55
+ target: this.context.config.prisma.runtime,
56
+ generatedFileExtension: "ts",
57
+ importFileExtension: "ts",
58
+ moduleFormat: "esm",
59
+ tsNoCheckPreamble: true,
60
+ compilerBuild: "fast"
61
+ });
62
+ const errorArray = [];
63
+ const denylists = {
64
+ models: [
65
+ "PrismaClient",
66
+ "Prisma",
67
+ "async",
68
+ "await",
69
+ "break",
70
+ "case",
71
+ "catch",
72
+ "class",
73
+ "const",
74
+ "continue",
75
+ "debugger",
76
+ "default",
77
+ "delete",
78
+ "do",
79
+ "else",
80
+ "enum",
81
+ "export",
82
+ "extends",
83
+ "false",
84
+ "finally",
85
+ "for",
86
+ "function",
87
+ "if",
88
+ "implements",
89
+ "import",
90
+ "in",
91
+ "instanceof",
92
+ "interface",
93
+ "let",
94
+ "new",
95
+ "null",
96
+ "package",
97
+ "private",
98
+ "protected",
99
+ "public",
100
+ "return",
101
+ "super",
102
+ "switch",
103
+ "this",
104
+ "throw",
105
+ "true",
106
+ "try",
107
+ "using",
108
+ "typeof",
109
+ "var",
110
+ "void",
111
+ "while",
112
+ "with",
113
+ "yield"
114
+ ],
115
+ fields: [
116
+ "AND",
117
+ "OR",
118
+ "NOT"
119
+ ],
120
+ dynamic: []
121
+ };
122
+ if (prismaClientDmmf.datamodel.enums) {
123
+ 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}"`));
124
+ }
125
+ if (prismaClientDmmf.datamodel.models) {
126
+ 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}"`));
127
+ }
128
+ if (errorArray.length > 0) {
129
+ let message = `Error: The schema at "${this.context.prisma.schema.schemaPath}" contains reserved keywords.\n Rename the following items:`;
130
+ for (const error of errorArray) message += `\n - ${error.message}`;
131
+ throw new Error(`${message}\nTo learn more about how to rename models, check out https://pris.ly/d/naming-models`);
132
+ }
133
+ await this.writeFileMap(fileMap);
134
+ }
135
+ stop() {}
136
+ async writeFileMap(fileMap) {
137
+ return Promise.all(Object.entries(fileMap).map(async ([fileName, content]) => {
138
+ if (isString(content)) this.context.emitBuiltinSync(content, `prisma/${replaceExtension(fileName)}`, { extension: findFileExtension(fileName) || "ts" });
139
+ else if (isBuffer(content)) this.context.emitBuiltinSync(bufferToString(content), `prisma/${replaceExtension(fileName)}`, { extension: findFileExtension(fileName) || "ts" });
140
+ else await this.writeFileMap(content);
141
+ }));
142
+ }
143
+ };
144
+
145
+ //#endregion
146
+ export { PowerlinesClientGenerator as t };
@@ -0,0 +1,146 @@
1
+ import { findFileExtension } from "@stryke/path/find";
2
+ import { buildClient } from "@prisma/client-generator-ts";
3
+ import { enginesVersion } from "@prisma/engines-version";
4
+ import { bufferToString } from "@stryke/convert/buffer-to-string";
5
+ import { replaceExtension } from "@stryke/path/replace";
6
+ import { isBuffer } from "@stryke/type-checks/is-buffer";
7
+ import { isString } from "@stryke/type-checks/is-string";
8
+
9
+ //#region package.json
10
+ var version = "0.4.48";
11
+
12
+ //#endregion
13
+ //#region src/helpers/client-generator.ts
14
+ var PowerlinesClientGenerator = class {
15
+ #options;
16
+ name = "powerlines-client";
17
+ constructor(context) {
18
+ this.context = context;
19
+ this.#options = {
20
+ name: this.name,
21
+ output: null,
22
+ config: {},
23
+ provider: {
24
+ fromEnvVar: "POWERLINES_CLIENT_PROVIDER",
25
+ value: this.name
26
+ },
27
+ binaryTargets: [],
28
+ previewFeatures: this.context.prisma.previewFeatures,
29
+ sourceFilePath: this.context.prisma.schema.schemaRootDir
30
+ };
31
+ }
32
+ async getManifest(_config) {
33
+ return Promise.resolve({
34
+ defaultOutput: "./generated",
35
+ prettyName: "Powerlines Client",
36
+ version,
37
+ requiresEngines: [],
38
+ requiresEngineVersion: enginesVersion
39
+ });
40
+ }
41
+ async generate() {
42
+ const { prismaClientDmmf, fileMap } = buildClient({
43
+ datamodel: this.context.prisma.schema.schemas.map((s) => s.content).join("\n"),
44
+ schemaPath: this.context.prisma.schema.schemaPath,
45
+ binaryPaths: {},
46
+ datasources: this.context.prisma.schema.datasources,
47
+ outputDir: this.context.config.prisma.outputPath,
48
+ runtimeBase: "@prisma/client/runtime",
49
+ dmmf: this.context.prisma.dmmf,
50
+ generator: this.#options,
51
+ engineVersion: enginesVersion,
52
+ clientVersion: version,
53
+ activeProvider: this.context.prisma.schema.primaryDatasource?.activeProvider,
54
+ typedSql: this.context.prisma.typedSql,
55
+ target: this.context.config.prisma.runtime,
56
+ generatedFileExtension: "ts",
57
+ importFileExtension: "ts",
58
+ moduleFormat: "esm",
59
+ tsNoCheckPreamble: true,
60
+ compilerBuild: "fast"
61
+ });
62
+ const errorArray = [];
63
+ const denylists = {
64
+ models: [
65
+ "PrismaClient",
66
+ "Prisma",
67
+ "async",
68
+ "await",
69
+ "break",
70
+ "case",
71
+ "catch",
72
+ "class",
73
+ "const",
74
+ "continue",
75
+ "debugger",
76
+ "default",
77
+ "delete",
78
+ "do",
79
+ "else",
80
+ "enum",
81
+ "export",
82
+ "extends",
83
+ "false",
84
+ "finally",
85
+ "for",
86
+ "function",
87
+ "if",
88
+ "implements",
89
+ "import",
90
+ "in",
91
+ "instanceof",
92
+ "interface",
93
+ "let",
94
+ "new",
95
+ "null",
96
+ "package",
97
+ "private",
98
+ "protected",
99
+ "public",
100
+ "return",
101
+ "super",
102
+ "switch",
103
+ "this",
104
+ "throw",
105
+ "true",
106
+ "try",
107
+ "using",
108
+ "typeof",
109
+ "var",
110
+ "void",
111
+ "while",
112
+ "with",
113
+ "yield"
114
+ ],
115
+ fields: [
116
+ "AND",
117
+ "OR",
118
+ "NOT"
119
+ ],
120
+ dynamic: []
121
+ };
122
+ if (prismaClientDmmf.datamodel.enums) {
123
+ 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}"`));
124
+ }
125
+ if (prismaClientDmmf.datamodel.models) {
126
+ 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}"`));
127
+ }
128
+ if (errorArray.length > 0) {
129
+ let message = `Error: The schema at "${this.context.prisma.schema.schemaPath}" contains reserved keywords.\n Rename the following items:`;
130
+ for (const error of errorArray) message += `\n - ${error.message}`;
131
+ throw new Error(`${message}\nTo learn more about how to rename models, check out https://pris.ly/d/naming-models`);
132
+ }
133
+ await this.writeFileMap(fileMap);
134
+ }
135
+ stop() {}
136
+ async writeFileMap(fileMap) {
137
+ return Promise.all(Object.entries(fileMap).map(async ([fileName, content]) => {
138
+ if (isString(content)) this.context.emitBuiltinSync(content, `prisma/${replaceExtension(fileName)}`, { extension: findFileExtension(fileName) || "ts" });
139
+ else if (isBuffer(content)) this.context.emitBuiltinSync(bufferToString(content), `prisma/${replaceExtension(fileName)}`, { extension: findFileExtension(fileName) || "ts" });
140
+ else await this.writeFileMap(content);
141
+ }));
142
+ }
143
+ };
144
+
145
+ //#endregion
146
+ export { PowerlinesClientGenerator as t };
@@ -0,0 +1,152 @@
1
+ const require_get_schema = require('./get-schema-Dq1-Jwvo.cjs');
2
+ let _stryke_path_find = require("@stryke/path/find");
3
+ let _prisma_client_generator_ts = require("@prisma/client-generator-ts");
4
+ let _prisma_engines_version = require("@prisma/engines-version");
5
+ let _stryke_convert_buffer_to_string = require("@stryke/convert/buffer-to-string");
6
+ let _stryke_path_replace = require("@stryke/path/replace");
7
+ let _stryke_type_checks_is_buffer = require("@stryke/type-checks/is-buffer");
8
+ let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
9
+
10
+ //#region package.json
11
+ var version = "0.4.47";
12
+
13
+ //#endregion
14
+ //#region src/helpers/client-generator.ts
15
+ var PowerlinesClientGenerator = class {
16
+ #options;
17
+ name = "powerlines-client";
18
+ constructor(context) {
19
+ this.context = context;
20
+ this.#options = {
21
+ name: this.name,
22
+ output: null,
23
+ config: {},
24
+ provider: {
25
+ fromEnvVar: "POWERLINES_CLIENT_PROVIDER",
26
+ value: this.name
27
+ },
28
+ binaryTargets: [],
29
+ previewFeatures: this.context.prisma.previewFeatures,
30
+ sourceFilePath: this.context.prisma.schema.schemaRootDir
31
+ };
32
+ }
33
+ async getManifest(_config) {
34
+ return Promise.resolve({
35
+ defaultOutput: "./generated",
36
+ prettyName: "Powerlines Client",
37
+ version,
38
+ requiresEngines: [],
39
+ requiresEngineVersion: _prisma_engines_version.enginesVersion
40
+ });
41
+ }
42
+ async generate() {
43
+ const { prismaClientDmmf, fileMap } = (0, _prisma_client_generator_ts.buildClient)({
44
+ datamodel: this.context.prisma.schema.schemas.map((s) => s.content).join("\n"),
45
+ schemaPath: this.context.prisma.schema.schemaPath,
46
+ binaryPaths: {},
47
+ datasources: this.context.prisma.schema.datasources,
48
+ outputDir: this.context.config.prisma.outputPath,
49
+ runtimeBase: "@prisma/client/runtime",
50
+ dmmf: this.context.prisma.dmmf,
51
+ generator: this.#options,
52
+ engineVersion: _prisma_engines_version.enginesVersion,
53
+ clientVersion: version,
54
+ activeProvider: this.context.prisma.schema.primaryDatasource?.activeProvider,
55
+ typedSql: this.context.prisma.typedSql,
56
+ target: this.context.config.prisma.runtime,
57
+ generatedFileExtension: "ts",
58
+ importFileExtension: "ts",
59
+ moduleFormat: "esm",
60
+ tsNoCheckPreamble: true,
61
+ compilerBuild: "fast"
62
+ });
63
+ const errorArray = [];
64
+ const denylists = {
65
+ models: [
66
+ "PrismaClient",
67
+ "Prisma",
68
+ "async",
69
+ "await",
70
+ "break",
71
+ "case",
72
+ "catch",
73
+ "class",
74
+ "const",
75
+ "continue",
76
+ "debugger",
77
+ "default",
78
+ "delete",
79
+ "do",
80
+ "else",
81
+ "enum",
82
+ "export",
83
+ "extends",
84
+ "false",
85
+ "finally",
86
+ "for",
87
+ "function",
88
+ "if",
89
+ "implements",
90
+ "import",
91
+ "in",
92
+ "instanceof",
93
+ "interface",
94
+ "let",
95
+ "new",
96
+ "null",
97
+ "package",
98
+ "private",
99
+ "protected",
100
+ "public",
101
+ "return",
102
+ "super",
103
+ "switch",
104
+ "this",
105
+ "throw",
106
+ "true",
107
+ "try",
108
+ "using",
109
+ "typeof",
110
+ "var",
111
+ "void",
112
+ "while",
113
+ "with",
114
+ "yield"
115
+ ],
116
+ fields: [
117
+ "AND",
118
+ "OR",
119
+ "NOT"
120
+ ],
121
+ dynamic: []
122
+ };
123
+ if (prismaClientDmmf.datamodel.enums) {
124
+ 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}"`));
125
+ }
126
+ if (prismaClientDmmf.datamodel.models) {
127
+ 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}"`));
128
+ }
129
+ if (errorArray.length > 0) {
130
+ let message = `Error: The schema at "${this.context.prisma.schema.schemaPath}" contains reserved keywords.\n Rename the following items:`;
131
+ for (const error of errorArray) message += `\n - ${error.message}`;
132
+ throw new Error(`${message}\nTo learn more about how to rename models, check out https://pris.ly/d/naming-models`);
133
+ }
134
+ await this.writeFileMap(fileMap);
135
+ }
136
+ stop() {}
137
+ async writeFileMap(fileMap) {
138
+ return Promise.all(Object.entries(fileMap).map(async ([fileName, content]) => {
139
+ 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" });
140
+ 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" });
141
+ else await this.writeFileMap(content);
142
+ }));
143
+ }
144
+ };
145
+
146
+ //#endregion
147
+ Object.defineProperty(exports, 'PowerlinesClientGenerator', {
148
+ enumerable: true,
149
+ get: function () {
150
+ return PowerlinesClientGenerator;
151
+ }
152
+ });