@powerlines/plugin-prisma 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client/client.gen.mjs.map +1 -1
- package/dist/api/client/utils.gen.mjs.map +1 -1
- package/dist/api/client.gen.cjs +0 -8
- package/dist/api/client.gen.mjs +0 -8
- package/dist/api/client.gen.mjs.map +1 -1
- package/dist/api/core/auth.gen.mjs.map +1 -1
- package/dist/api/core/bodySerializer.gen.mjs.map +1 -1
- package/dist/api/core/params.gen.mjs.map +1 -1
- package/dist/api/core/pathSerializer.gen.d.cts +2 -2
- package/dist/api/core/pathSerializer.gen.d.cts.map +1 -1
- package/dist/api/core/pathSerializer.gen.d.mts +2 -2
- package/dist/api/core/pathSerializer.gen.d.mts.map +1 -1
- package/dist/api/core/pathSerializer.gen.mjs.map +1 -1
- package/dist/api/core/queryKeySerializer.gen.cjs +0 -3
- package/dist/api/core/queryKeySerializer.gen.d.cts.map +1 -1
- package/dist/api/core/queryKeySerializer.gen.d.mts.map +1 -1
- package/dist/api/core/queryKeySerializer.gen.mjs +0 -3
- package/dist/api/core/queryKeySerializer.gen.mjs.map +1 -1
- package/dist/api/core/serverSentEvents.gen.mjs.map +1 -1
- package/dist/api/core/utils.gen.mjs.map +1 -1
- package/dist/api/sdk.gen.cjs +1 -0
- package/dist/api/sdk.gen.mjs +1 -0
- package/dist/api/sdk.gen.mjs.map +1 -1
- package/dist/helpers/get-schema.mjs.map +1 -1
- package/dist/helpers/index.cjs +1 -1
- package/dist/helpers/index.mjs +1 -1
- package/dist/helpers/prisma-postgres.d.cts +1 -51
- package/dist/helpers/prisma-postgres.d.mts +1 -51
- package/dist/helpers/prisma-postgres.mjs.map +1 -1
- package/dist/helpers/schema-creator.mjs.map +1 -1
- package/dist/index.cjs +24 -13
- package/dist/index.d.cts +3 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +23 -11
- package/dist/index.mjs.map +1 -1
- package/dist/node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/constant-case.cjs +31 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/constant-case.mjs +32 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/constant-case.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/snake-case.cjs +17 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/snake-case.mjs +17 -0
- package/dist/node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/snake-case.mjs.map +1 -0
- package/dist/types/plugin.d.cts +8 -6
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +8 -6
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/prisma.d.cts.map +1 -1
- package/package.json +6 -36
- package/dist/components/index.cjs +0 -3
- package/dist/components/index.d.cts +0 -2
- package/dist/components/index.d.mts +0 -2
- package/dist/components/index.mjs +0 -3
- package/dist/components/infrastructure-file.cjs +0 -76
- package/dist/components/infrastructure-file.d.cts +0 -13
- package/dist/components/infrastructure-file.d.cts.map +0 -1
- package/dist/components/infrastructure-file.d.mts +0 -13
- package/dist/components/infrastructure-file.d.mts.map +0 -1
- package/dist/components/infrastructure-file.mjs +0 -75
- package/dist/components/infrastructure-file.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { constantCase } from "./node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/constant-case.mjs";
|
|
2
|
+
import { kebabCase } from "./node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/kebab-case.mjs";
|
|
2
3
|
import { getSchema } from "./helpers/get-schema.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { PrismaClient } from "./api/sdk.gen.mjs";
|
|
6
|
-
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
7
|
-
import defu from "defu";
|
|
8
|
-
import { render } from "@powerlines/plugin-alloy/render";
|
|
4
|
+
import { PrismaSchemaCreator } from "./helpers/schema-creator.mjs";
|
|
5
|
+
import * as prismaPostgres from "@pulumi/prisma-postgres";
|
|
9
6
|
import { execute, executePackage } from "@stryke/cli/execute";
|
|
10
7
|
import { existsSync } from "@stryke/fs/exists";
|
|
11
8
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
9
|
+
import defu from "defu";
|
|
12
10
|
import { getConfigPath, replacePathTokens } from "powerlines/plugin-utils";
|
|
13
11
|
|
|
14
|
-
//#region src/index.
|
|
12
|
+
//#region src/index.ts
|
|
15
13
|
/**
|
|
16
14
|
* A Powerlines plugin to integrate Prisma for code generation.
|
|
17
15
|
*
|
|
@@ -84,9 +82,8 @@ const plugin = (options = {}) => {
|
|
|
84
82
|
const result = await execute(args.join(" "), this.config.root);
|
|
85
83
|
if (result.failed) throw new Error(`Prisma process exited with code ${result.exitCode}.`);
|
|
86
84
|
}
|
|
87
|
-
if (this.config.prisma.prismaPostgres) await render(this, createComponent(PrismaPostgresInfrastructureFile, {}));
|
|
88
85
|
},
|
|
89
|
-
async
|
|
86
|
+
async deployPulumi() {
|
|
90
87
|
if (this.config.prisma.prismaPostgres) {
|
|
91
88
|
let serviceToken = process.env.PRISMA_SERVICE_TOKEN;
|
|
92
89
|
if (!serviceToken) {
|
|
@@ -94,6 +91,21 @@ const plugin = (options = {}) => {
|
|
|
94
91
|
if (serviceToken) this.warn("If possible, please use the `PRISMA_SERVICE_TOKEN` environment variable instead of using the `serviceToken` option directly. The `serviceToken` option will work; however, this is a less secure method of configuration.");
|
|
95
92
|
else throw new Error("Unable to determine the Prisma service token. Please set the `PRISMA_SERVICE_TOKEN` environment variable.");
|
|
96
93
|
}
|
|
94
|
+
await this.pulumi.workspace.installPlugin("registry.terraform.io/prisma/prisma-postgres", "v0.2.0");
|
|
95
|
+
const project = new prismaPostgres.Project("project", { name: `${this.config.prisma.prismaPostgres?.projectId || this.config.name}` });
|
|
96
|
+
const database = new prismaPostgres.Database("database", {
|
|
97
|
+
projectId: project.id,
|
|
98
|
+
name: `${this.config.prisma.prismaPostgres?.databaseName || `${kebabCase(this.config.name)}.${this.config.mode}.${this.config.prisma.prismaPostgres?.region}`}`,
|
|
99
|
+
region: `${this.config.prisma.prismaPostgres?.region}`
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
project,
|
|
103
|
+
database,
|
|
104
|
+
connection: new prismaPostgres.Connection("connection", {
|
|
105
|
+
databaseId: database.id,
|
|
106
|
+
name: `${constantCase(this.config.name)}_API_KEY`
|
|
107
|
+
})
|
|
108
|
+
};
|
|
97
109
|
}
|
|
98
110
|
}
|
|
99
111
|
};
|
|
@@ -101,5 +113,5 @@ const plugin = (options = {}) => {
|
|
|
101
113
|
var src_default = plugin;
|
|
102
114
|
|
|
103
115
|
//#endregion
|
|
104
|
-
export {
|
|
116
|
+
export { src_default as default, plugin };
|
|
105
117
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["render","execute","executePackage","existsSync","joinPaths","defu","getConfigPath","replacePathTokens","PrismaPostgresInfrastructureFile","getSchema","PrismaSchemaCreator","plugin","options","name","config","prisma","schema","root","configFile","outputPath","prismaPostgres","projectId","region","undefined","configResolved","dependencies","Error","generators","datasources","warnings","datamodel","generator","find","gen","provider","value","push","fromEnvVar","output","binaryTargets","previewFeatures","sourceFilePath","builder","prepare","write","args","prismaPath","unshift","result","workspaceConfig","workspaceRoot","failed","exitCode","join","_$createComponent","deploy","serviceToken","process","env","PRISMA_SERVICE_TOKEN","warn"],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { execute, executePackage } from \"@stryke/cli/execute\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { getConfigPath, replacePathTokens } from \"powerlines/plugin-utils\";\nimport { PrismaPostgresInfrastructureFile } from \"./components/infrastructure-file\";\nimport { getSchema } from \"./helpers/get-schema\";\nimport { PrismaSchemaCreator } from \"./helpers/schema-creator\";\nimport {\n PrismaPluginContext,\n PrismaPluginOptions,\n PrismaPluginUserConfig\n} from \"./types/plugin\";\n\nexport * from \"./api/client.gen\";\nexport * from \"./api/sdk.gen\";\nexport * from \"./api/types.gen\";\nexport * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface BaseConfig {\n prisma?: PrismaPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to integrate Prisma for code generation.\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends PrismaPluginContext = PrismaPluginContext\n>(\n options: PrismaPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"prisma\",\n config() {\n return {\n prisma: defu(options, {\n schema: joinPaths(this.config.root, \"prisma\", \"schema.prisma\"),\n configFile:\n options.configFile || getConfigPath(this, \"prisma.config\"),\n outputPath: joinPaths(\"{builtinPath}\", \"prisma\"),\n prismaPostgres: options?.prismaPostgres\n ? {\n projectId: this.config.name,\n region: \"us-east-1\"\n }\n : undefined\n })\n } as Partial<PrismaPluginUserConfig>;\n },\n async configResolved() {\n this.dependencies[\"@prisma/ppg\"] = \"latest\";\n\n this.config.prisma.configFile = replacePathTokens(\n this,\n this.config.prisma.configFile\n );\n\n if (!this.config.prisma.schema) {\n throw new Error(\n `Prisma schema path is not defined. Please specify a valid path in the plugin configuration.`\n );\n }\n\n this.config.prisma.schema = replacePathTokens(\n this,\n this.config.prisma.schema\n );\n\n if (!this.config.prisma.outputPath) {\n throw new Error(\n `Prisma generated path is not defined. Please specify a valid path in the plugin configuration.`\n );\n }\n\n this.config.prisma.outputPath = replacePathTokens(\n this,\n this.config.prisma.outputPath\n );\n\n this.prisma ??= {} as TContext[\"prisma\"];\n if (!existsSync(this.config.prisma.schema)) {\n this.prisma.schema ??= {\n generators: [],\n datasources: [],\n warnings: []\n };\n } else {\n this.prisma.schema = await getSchema({\n datamodel: this.config.prisma.schema\n });\n }\n\n const generator = this.prisma.schema.generators.find(\n gen => gen.provider.value === \"prisma-client\"\n );\n if (!generator) {\n this.prisma.schema.generators.push({\n name: \"prisma-client\",\n provider: {\n value: \"prisma-client\",\n fromEnvVar: null\n },\n output: {\n value: this.config.prisma.outputPath,\n fromEnvVar: null\n },\n config: {},\n binaryTargets: [],\n previewFeatures: [],\n sourceFilePath: this.config.prisma.schema\n });\n } else {\n generator.output ??= {\n value: this.config.prisma.outputPath,\n fromEnvVar: null\n };\n }\n\n this.prisma.builder = new PrismaSchemaCreator(this);\n },\n async prepare() {\n // Write the schema file before invoking Prisma - Generate\n await this.prisma.builder.write();\n\n const args = [\"generate\", \"--schema\", this.config.prisma.schema];\n if (!this.config.prisma.prismaPath) {\n args.unshift(this.config.root);\n\n const result = await executePackage(\n \"prisma\",\n args,\n joinPaths(this.workspaceConfig.workspaceRoot, this.config.root)\n );\n if (result.failed) {\n throw new Error(\n `Prisma process exited with code ${result.exitCode}.`\n );\n }\n } else {\n args.unshift(this.config.prisma.prismaPath);\n\n const result = await execute(args.join(\" \"), this.config.root);\n if (result.failed) {\n throw new Error(\n `Prisma process exited with code ${result.exitCode}.`\n );\n }\n }\n\n if (this.config.prisma.prismaPostgres) {\n await render(this, <PrismaPostgresInfrastructureFile />);\n }\n },\n async deploy() {\n if (this.config.prisma.prismaPostgres) {\n let serviceToken = process.env.PRISMA_SERVICE_TOKEN;\n if (!serviceToken) {\n serviceToken = options.serviceToken;\n if (serviceToken) {\n this.warn(\n \"If possible, please use the `PRISMA_SERVICE_TOKEN` environment variable instead of using the `serviceToken` option directly. The `serviceToken` option will work; however, this is a less secure method of configuration.\"\n );\n } else {\n throw new Error(\n \"Unable to determine the Prisma service token. Please set the `PRISMA_SERVICE_TOKEN` environment variable.\"\n );\n }\n }\n\n // const client = createClient(\n // createConfig<ClientOptions>({\n // baseUrl: \"https://api.prisma.io\",\n // throwOnError: true,\n // headers: {\n // Authorization: `Bearer ${serviceToken}`,\n // \"User-Agent\": \"powerlines/1.0\"\n // }\n // })\n // );\n\n // this.prisma.api = new PrismaClient({\n // client\n // });\n\n // await this.prisma.api\n // .createDatabase({\n // body: {\n // isDefault: false,\n // name:\n // this.config.prisma.prismaPostgres.databaseName ||\n // `${this.config.prisma.prismaPostgres.region}.${this.config.mode}.${this.config.name}`,\n // projectId: this.config.prisma.prismaPostgres.projectId,\n // region: this.config.prisma.prismaPostgres.region\n // }\n // } as Options<CreateDatabaseData>)\n // .then(response => response.data?.data);\n }\n }\n };\n};\n\nexport default plugin;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport * as prismaPostgres from \"@pulumi/prisma-postgres\";\nimport { execute, executePackage } from \"@stryke/cli/execute\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { getConfigPath, replacePathTokens } from \"powerlines/plugin-utils\";\nimport { getSchema } from \"./helpers/get-schema\";\nimport { PrismaSchemaCreator } from \"./helpers/schema-creator\";\nimport {\n PrismaPluginContext,\n PrismaPluginOptions,\n PrismaPluginUserConfig\n} from \"./types/plugin\";\n\nexport type * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n prisma?: PrismaPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to integrate Prisma for code generation.\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends PrismaPluginContext = PrismaPluginContext\n>(\n options: PrismaPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"prisma\",\n config() {\n return {\n prisma: defu(options, {\n schema: joinPaths(this.config.root, \"prisma\", \"schema.prisma\"),\n configFile:\n options.configFile || getConfigPath(this, \"prisma.config\"),\n outputPath: joinPaths(\"{builtinPath}\", \"prisma\"),\n prismaPostgres: options?.prismaPostgres\n ? {\n projectId: this.config.name,\n region: \"us-east-1\"\n }\n : undefined\n })\n } as Partial<PrismaPluginUserConfig>;\n },\n async configResolved() {\n this.dependencies[\"@prisma/ppg\"] = \"latest\";\n\n this.config.prisma.configFile = replacePathTokens(\n this,\n this.config.prisma.configFile\n );\n\n if (!this.config.prisma.schema) {\n throw new Error(\n `Prisma schema path is not defined. Please specify a valid path in the plugin configuration.`\n );\n }\n\n this.config.prisma.schema = replacePathTokens(\n this,\n this.config.prisma.schema\n );\n\n if (!this.config.prisma.outputPath) {\n throw new Error(\n `Prisma generated path is not defined. Please specify a valid path in the plugin configuration.`\n );\n }\n\n this.config.prisma.outputPath = replacePathTokens(\n this,\n this.config.prisma.outputPath\n );\n\n this.prisma ??= {} as TContext[\"prisma\"];\n if (!existsSync(this.config.prisma.schema)) {\n this.prisma.schema ??= {\n generators: [],\n datasources: [],\n warnings: []\n };\n } else {\n this.prisma.schema = await getSchema({\n datamodel: this.config.prisma.schema\n });\n }\n\n const generator = this.prisma.schema.generators.find(\n gen => gen.provider.value === \"prisma-client\"\n );\n if (!generator) {\n this.prisma.schema.generators.push({\n name: \"prisma-client\",\n provider: {\n value: \"prisma-client\",\n fromEnvVar: null\n },\n output: {\n value: this.config.prisma.outputPath,\n fromEnvVar: null\n },\n config: {},\n binaryTargets: [],\n previewFeatures: [],\n sourceFilePath: this.config.prisma.schema\n });\n } else {\n generator.output ??= {\n value: this.config.prisma.outputPath,\n fromEnvVar: null\n };\n }\n\n this.prisma.builder = new PrismaSchemaCreator(this);\n },\n async prepare() {\n // Write the schema file before invoking Prisma - Generate\n await this.prisma.builder.write();\n\n const args = [\"generate\", \"--schema\", this.config.prisma.schema];\n if (!this.config.prisma.prismaPath) {\n args.unshift(this.config.root);\n\n const result = await executePackage(\n \"prisma\",\n args,\n joinPaths(this.workspaceConfig.workspaceRoot, this.config.root)\n );\n if (result.failed) {\n throw new Error(\n `Prisma process exited with code ${result.exitCode}.`\n );\n }\n } else {\n args.unshift(this.config.prisma.prismaPath);\n\n const result = await execute(args.join(\" \"), this.config.root);\n if (result.failed) {\n throw new Error(\n `Prisma process exited with code ${result.exitCode}.`\n );\n }\n }\n },\n async deployPulumi() {\n if (this.config.prisma.prismaPostgres) {\n let serviceToken = process.env.PRISMA_SERVICE_TOKEN;\n if (!serviceToken) {\n serviceToken = options.serviceToken;\n if (serviceToken) {\n this.warn(\n \"If possible, please use the `PRISMA_SERVICE_TOKEN` environment variable instead of using the `serviceToken` option directly. The `serviceToken` option will work; however, this is a less secure method of configuration.\"\n );\n } else {\n throw new Error(\n \"Unable to determine the Prisma service token. Please set the `PRISMA_SERVICE_TOKEN` environment variable.\"\n );\n }\n }\n\n await this.pulumi.workspace.installPlugin(\n \"registry.terraform.io/prisma/prisma-postgres\",\n \"v0.2.0\"\n );\n\n const project = new prismaPostgres.Project(\"project\", {\n name: `${\n this.config.prisma.prismaPostgres?.projectId || this.config.name\n }`\n });\n const database = new prismaPostgres.Database(\"database\", {\n projectId: project.id,\n name: `${\n this.config.prisma.prismaPostgres?.databaseName ||\n `${kebabCase(this.config.name)}.${\n this.config.mode\n }.${this.config.prisma.prismaPostgres?.region}`\n }`,\n region: `${this.config.prisma.prismaPostgres?.region}`\n });\n\n return {\n project,\n database,\n connection: new prismaPostgres.Connection(\"connection\", {\n databaseId: database.id,\n name: `${constantCase(this.config.name)}_API_KEY`\n })\n };\n }\n }\n };\n};\n\nexport default plugin;\n"],"mappings":"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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const require_get_words = require('./get-words.cjs');
|
|
2
|
+
const require_snake_case = require('./snake-case.cjs');
|
|
3
|
+
|
|
4
|
+
//#region ../../node_modules/.pnpm/@stryke+string-format@0.16.0/node_modules/@stryke/string-format/dist/constant-case.mjs
|
|
5
|
+
/**
|
|
6
|
+
* Check if the input string is in constant case.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Constant case is defined as all uppercase letters with underscores separating words - "THIS_IS_AN_EXAMPLE".
|
|
10
|
+
*
|
|
11
|
+
* @param input - The input string to check.
|
|
12
|
+
* @returns True if the input is in constant case, false otherwise.
|
|
13
|
+
*/
|
|
14
|
+
function isConstantCase(input) {
|
|
15
|
+
return input ? /^[A-Z0-9_]+$/.test(input) : false;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Convert the input string to constant case.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Constant case is defined as all uppercase letters with underscores separating words - "THIS_IS_AN_EXAMPLE".
|
|
22
|
+
*
|
|
23
|
+
* @param input - The input string.
|
|
24
|
+
* @returns The constant-cased string.
|
|
25
|
+
*/
|
|
26
|
+
function constantCase(input) {
|
|
27
|
+
return isConstantCase(input) || input === void 0 ? input : require_snake_case.isSnakeCase(input) ? input.toUpperCase() : require_get_words.getWords(input).join("_").toUpperCase();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.constantCase = constantCase;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getWords } from "./get-words.mjs";
|
|
2
|
+
import { isSnakeCase } from "./snake-case.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../../node_modules/.pnpm/@stryke+string-format@0.16.0/node_modules/@stryke/string-format/dist/constant-case.mjs
|
|
5
|
+
/**
|
|
6
|
+
* Check if the input string is in constant case.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Constant case is defined as all uppercase letters with underscores separating words - "THIS_IS_AN_EXAMPLE".
|
|
10
|
+
*
|
|
11
|
+
* @param input - The input string to check.
|
|
12
|
+
* @returns True if the input is in constant case, false otherwise.
|
|
13
|
+
*/
|
|
14
|
+
function isConstantCase(input) {
|
|
15
|
+
return input ? /^[A-Z0-9_]+$/.test(input) : false;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Convert the input string to constant case.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Constant case is defined as all uppercase letters with underscores separating words - "THIS_IS_AN_EXAMPLE".
|
|
22
|
+
*
|
|
23
|
+
* @param input - The input string.
|
|
24
|
+
* @returns The constant-cased string.
|
|
25
|
+
*/
|
|
26
|
+
function constantCase(input) {
|
|
27
|
+
return isConstantCase(input) || input === void 0 ? input : isSnakeCase(input) ? input.toUpperCase() : getWords(input).join("_").toUpperCase();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { constantCase };
|
|
32
|
+
//# sourceMappingURL=constant-case.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant-case.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+string-format@0.16.0/node_modules/@stryke/string-format/dist/constant-case.mjs"],"sourcesContent":["import { getWords } from \"./get-words.mjs\";\nimport { isSnakeCase } from \"./snake-case.mjs\";\n\n//#region src/constant-case.ts\n/**\n* Check if the input string is in constant case.\n*\n* @remarks\n* Constant case is defined as all uppercase letters with underscores separating words - \"THIS_IS_AN_EXAMPLE\".\n*\n* @param input - The input string to check.\n* @returns True if the input is in constant case, false otherwise.\n*/\nfunction isConstantCase(input) {\n\treturn input ? /^[A-Z0-9_]+$/.test(input) : false;\n}\n/**\n* Convert the input string to constant case.\n*\n* @remarks\n* Constant case is defined as all uppercase letters with underscores separating words - \"THIS_IS_AN_EXAMPLE\".\n*\n* @param input - The input string.\n* @returns The constant-cased string.\n*/\nfunction constantCase(input) {\n\treturn isConstantCase(input) || input === void 0 ? input : isSnakeCase(input) ? input.toUpperCase() : getWords(input).join(\"_\").toUpperCase();\n}\n\n//#endregion\nexport { constantCase, isConstantCase };\n//# sourceMappingURL=constant-case.mjs.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;AAaA,SAAS,eAAe,OAAO;AAC9B,QAAO,QAAQ,eAAe,KAAK,MAAM,GAAG;;;;;;;;;;;AAW7C,SAAS,aAAa,OAAO;AAC5B,QAAO,eAAe,MAAM,IAAI,UAAU,KAAK,IAAI,QAAQ,YAAY,MAAM,GAAG,MAAM,aAAa,GAAG,SAAS,MAAM,CAAC,KAAK,IAAI,CAAC,aAAa"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
//#region ../../node_modules/.pnpm/@stryke+string-format@0.16.0/node_modules/@stryke/string-format/dist/snake-case.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Check if the input string is in snake case.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Snake case is defined as all lowercase letters with underscores separating words - "this_is_an_example"
|
|
8
|
+
*
|
|
9
|
+
* @param input - The input string to check.
|
|
10
|
+
* @returns True if the input is in snake case, false otherwise.
|
|
11
|
+
*/
|
|
12
|
+
function isSnakeCase(input) {
|
|
13
|
+
return input ? /^[a-z]+(?:_[a-z0-9]+)*$/.test(input) : false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.isSnakeCase = isSnakeCase;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@stryke+string-format@0.16.0/node_modules/@stryke/string-format/dist/snake-case.mjs
|
|
2
|
+
/**
|
|
3
|
+
* Check if the input string is in snake case.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Snake case is defined as all lowercase letters with underscores separating words - "this_is_an_example"
|
|
7
|
+
*
|
|
8
|
+
* @param input - The input string to check.
|
|
9
|
+
* @returns True if the input is in snake case, false otherwise.
|
|
10
|
+
*/
|
|
11
|
+
function isSnakeCase(input) {
|
|
12
|
+
return input ? /^[a-z]+(?:_[a-z0-9]+)*$/.test(input) : false;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { isSnakeCase };
|
|
17
|
+
//# sourceMappingURL=snake-case.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snake-case.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/@stryke+string-format@0.16.0/node_modules/@stryke/string-format/dist/snake-case.mjs"],"sourcesContent":["import { EMPTY_STRING } from \"./types/src/base.mjs\";\nimport { upperCaseFirst } from \"./upper-case-first.mjs\";\nimport { isConstantCase } from \"./constant-case.mjs\";\n\n//#region src/snake-case.ts\n/**\n* Check if the input string is in snake case.\n*\n* @remarks\n* Snake case is defined as all lowercase letters with underscores separating words - \"this_is_an_example\"\n*\n* @param input - The input string to check.\n* @returns True if the input is in snake case, false otherwise.\n*/\nfunction isSnakeCase(input) {\n\treturn input ? /^[a-z]+(?:_[a-z0-9]+)*$/.test(input) : false;\n}\n/**\n* Convert the input string to snake case.\n*\n* @remarks\n* Snake case is defined as all lowercase letters with underscores separating words - \"this_is_an_example\"\n*\n* @param input - The input string.\n* @param options - Options to control the behavior of the function.\n* @returns The snake-cased string.\n*/\nfunction snakeCase(input, options) {\n\tif (isSnakeCase(input) || input === void 0) return input;\n\tif (isConstantCase(input)) return input.toLowerCase();\n\tconst parts = input?.replace(/[A-Z]+/g, (input$1) => upperCaseFirst(input$1) ?? EMPTY_STRING).split(/(?=[A-Z])|[\\s._-]/).map((x) => x.toLowerCase()) ?? [];\n\tif (parts.length === 0) return \"\";\n\tif (parts.length === 1) return parts[0];\n\tconst result = parts.reduce((ret, part) => {\n\t\treturn `${ret}_${part.toLowerCase()}`;\n\t});\n\treturn options?.splitOnNumber === false ? result : result.replace(/[A-Z]\\d/i, (val) => `${val[0]}_${val[1]}`);\n}\n\n//#endregion\nexport { isSnakeCase, snakeCase };\n//# sourceMappingURL=snake-case.mjs.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;AAcA,SAAS,YAAY,OAAO;AAC3B,QAAO,QAAQ,0BAA0B,KAAK,MAAM,GAAG"}
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PrismaClient } from "../api/sdk.gen.cjs";
|
|
2
1
|
import { PrismaSchema } from "./prisma.cjs";
|
|
3
2
|
import { PrismaSchemaCreator } from "../helpers/schema-creator.cjs";
|
|
3
|
+
import { PulumiPluginContext, PulumiPluginResolvedConfig, PulumiPluginUserConfig } from "@powerlines/plugin-pulumi";
|
|
4
4
|
import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
|
|
5
5
|
|
|
6
6
|
//#region src/types/plugin.d.ts
|
|
@@ -54,7 +54,10 @@ interface PrismaPluginOptions {
|
|
|
54
54
|
*/
|
|
55
55
|
params?: string;
|
|
56
56
|
/**
|
|
57
|
-
* The path to the Prisma
|
|
57
|
+
* The path to the generated Prisma client. This is used by the plugin to import the client for type generation and other operations.
|
|
58
|
+
*
|
|
59
|
+
* @remarks
|
|
60
|
+
* If not specified, the plugin will attempt to resolve the Prisma client path based on the output path and the schema file name. This field allows you to explicitly specify the path to the generated Prisma client if it cannot be automatically resolved.
|
|
58
61
|
*/
|
|
59
62
|
prismaPath?: string;
|
|
60
63
|
/**
|
|
@@ -66,19 +69,18 @@ interface PrismaPluginOptions {
|
|
|
66
69
|
*/
|
|
67
70
|
prismaPostgres?: PrismaPostgresPrismaPluginOptions | true;
|
|
68
71
|
}
|
|
69
|
-
type PrismaPluginUserConfig = UserConfig & {
|
|
72
|
+
type PrismaPluginUserConfig = UserConfig & PulumiPluginUserConfig & {
|
|
70
73
|
prisma?: Omit<PrismaPluginOptions, "schema" | "outputPath" | "configFile"> & Required<Pick<PrismaPluginOptions, "schema" | "outputPath" | "configFile">>;
|
|
71
74
|
};
|
|
72
|
-
type PrismaPluginResolvedConfig = ResolvedConfig & {
|
|
75
|
+
type PrismaPluginResolvedConfig = ResolvedConfig & PulumiPluginResolvedConfig & {
|
|
73
76
|
prisma: Omit<PrismaPluginOptions, "schema" | "outputPath" | "configFile" | "prismaPostgres"> & Required<Pick<PrismaPluginOptions, "schema" | "outputPath" | "configFile">> & {
|
|
74
77
|
prismaPostgres?: Required<PrismaPostgresPrismaPluginOptions>;
|
|
75
78
|
};
|
|
76
79
|
};
|
|
77
|
-
type PrismaPluginContext<TResolvedConfig extends PrismaPluginResolvedConfig = PrismaPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
|
|
80
|
+
type PrismaPluginContext<TResolvedConfig extends PrismaPluginResolvedConfig = PrismaPluginResolvedConfig> = PluginContext<TResolvedConfig> & PulumiPluginContext & {
|
|
78
81
|
prisma: {
|
|
79
82
|
schema: PrismaSchema;
|
|
80
83
|
builder: PrismaSchemaCreator;
|
|
81
|
-
api: PrismaClient;
|
|
82
84
|
};
|
|
83
85
|
};
|
|
84
86
|
declare type __ΩPrismaPostgresPrismaPluginOptions = any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;UA2BiB,iCAAA;;AAAjB;AAoDA;AAoDA;;EACE,SAAA,CAAA,EAAA,MAAA;EACgB;;;;;EACJ,MAAA,CAAA,EAAA,WAAA,GAAA,WAAA,GAAA,WAAA,GAAA,WAAA,GAAA,YAAA,GAAA,WAAA,GAAA,YAAA,GAAA,YAAA,GAAA,gBAAA,GAAA,gBAAA,GAAA,gBAAA,GAAA,gBAAA,GAAA,gBAAA,GAAA,gBAAA,GAAA,gBAAA,GAAA,cAAA,GAAA,WAAA,GAAA,cAAA,GAAA,cAAA,GAAA,WAAA,GAAA,WAAA,GAAA,WAAA,GAAA,YAAA,GAAA,YAAA,GAAA,YAAA,GAAA,cAAA,GAAA,YAAA,GAAA,cAAA,GAAA,WAAA;EAKF;;;;;EAOC,YAAA,CAAA,EAAA,MAAA;;AADP,UAlEW,mBAAA,CAkEX;EAG4B;;;AAIlC;;EAEI,MAAA,CAAA,EAAA,MAAA;EACc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA3BC;;KAGP,sBAAA,GAAyB,aACnC;WACW,KAAK,+DACZ,SACE,KAAK;;KAID,0BAAA,GAA6B,iBACvC;UACU,KACN,kFAGA,SACE,KAAK;qBAEY,SAAS;;;KAItB,4CACc,6BACtB,8BACA,cAAc,mBAChB;;YAEY;aACC"}
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PrismaClient } from "../api/sdk.gen.mjs";
|
|
2
1
|
import { PrismaSchema } from "./prisma.mjs";
|
|
3
2
|
import { PrismaSchemaCreator } from "../helpers/schema-creator.mjs";
|
|
3
|
+
import { PulumiPluginContext, PulumiPluginResolvedConfig, PulumiPluginUserConfig } from "@powerlines/plugin-pulumi";
|
|
4
4
|
import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
|
|
5
5
|
|
|
6
6
|
//#region src/types/plugin.d.ts
|
|
@@ -54,7 +54,10 @@ interface PrismaPluginOptions {
|
|
|
54
54
|
*/
|
|
55
55
|
params?: string;
|
|
56
56
|
/**
|
|
57
|
-
* The path to the Prisma
|
|
57
|
+
* The path to the generated Prisma client. This is used by the plugin to import the client for type generation and other operations.
|
|
58
|
+
*
|
|
59
|
+
* @remarks
|
|
60
|
+
* If not specified, the plugin will attempt to resolve the Prisma client path based on the output path and the schema file name. This field allows you to explicitly specify the path to the generated Prisma client if it cannot be automatically resolved.
|
|
58
61
|
*/
|
|
59
62
|
prismaPath?: string;
|
|
60
63
|
/**
|
|
@@ -66,19 +69,18 @@ interface PrismaPluginOptions {
|
|
|
66
69
|
*/
|
|
67
70
|
prismaPostgres?: PrismaPostgresPrismaPluginOptions | true;
|
|
68
71
|
}
|
|
69
|
-
type PrismaPluginUserConfig = UserConfig & {
|
|
72
|
+
type PrismaPluginUserConfig = UserConfig & PulumiPluginUserConfig & {
|
|
70
73
|
prisma?: Omit<PrismaPluginOptions, "schema" | "outputPath" | "configFile"> & Required<Pick<PrismaPluginOptions, "schema" | "outputPath" | "configFile">>;
|
|
71
74
|
};
|
|
72
|
-
type PrismaPluginResolvedConfig = ResolvedConfig & {
|
|
75
|
+
type PrismaPluginResolvedConfig = ResolvedConfig & PulumiPluginResolvedConfig & {
|
|
73
76
|
prisma: Omit<PrismaPluginOptions, "schema" | "outputPath" | "configFile" | "prismaPostgres"> & Required<Pick<PrismaPluginOptions, "schema" | "outputPath" | "configFile">> & {
|
|
74
77
|
prismaPostgres?: Required<PrismaPostgresPrismaPluginOptions>;
|
|
75
78
|
};
|
|
76
79
|
};
|
|
77
|
-
type PrismaPluginContext<TResolvedConfig extends PrismaPluginResolvedConfig = PrismaPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
|
|
80
|
+
type PrismaPluginContext<TResolvedConfig extends PrismaPluginResolvedConfig = PrismaPluginResolvedConfig> = PluginContext<TResolvedConfig> & PulumiPluginContext & {
|
|
78
81
|
prisma: {
|
|
79
82
|
schema: PrismaSchema;
|
|
80
83
|
builder: PrismaSchemaCreator;
|
|
81
|
-
api: PrismaClient;
|
|
82
84
|
};
|
|
83
85
|
};
|
|
84
86
|
declare type __ΩPrismaPostgresPrismaPluginOptions = any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;UA2BiB,iCAAA;;AAAjB;AAoDA;AAoDA;;EACE,SAAA,CAAA,EAAA,MAAA;EACgB;;;;;EACJ,MAAA,CAAA,EAAA,WAAA,GAAA,WAAA,GAAA,WAAA,GAAA,WAAA,GAAA,YAAA,GAAA,WAAA,GAAA,YAAA,GAAA,YAAA,GAAA,gBAAA,GAAA,gBAAA,GAAA,gBAAA,GAAA,gBAAA,GAAA,gBAAA,GAAA,gBAAA,GAAA,gBAAA,GAAA,cAAA,GAAA,WAAA,GAAA,cAAA,GAAA,cAAA,GAAA,WAAA,GAAA,WAAA,GAAA,WAAA,GAAA,YAAA,GAAA,YAAA,GAAA,YAAA,GAAA,cAAA,GAAA,YAAA,GAAA,cAAA,GAAA,WAAA;EAKF;;;;;EAOC,YAAA,CAAA,EAAA,MAAA;;AADP,UAlEW,mBAAA,CAkEX;EAG4B;;;AAIlC;;EAEI,MAAA,CAAA,EAAA,MAAA;EACc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA3BC;;KAGP,sBAAA,GAAyB,aACnC;WACW,KAAK,+DACZ,SACE,KAAK;;KAID,0BAAA,GAA6B,iBACvC;UACU,KACN,kFAGA,SACE,KAAK;qBAEY,SAAS;;;KAItB,4CACc,6BACtB,8BACA,cAAc,mBAChB;;YAEY;aACC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prisma.d.cts","names":[],"sources":["../../src/types/prisma.ts"],"sourcesContent":[],"mappings":";KAkBY,eAAA,GAAkB;AAAlB,KACA,eAAA,GADe,MAAG,
|
|
1
|
+
{"version":3,"file":"prisma.d.cts","names":[],"sources":["../../src/types/prisma.ts"],"sourcesContent":[],"mappings":";KAkBY,eAAA,GAAkB;AAAlB,KACA,eAAA,GADe,MAAG,GAAK,CAAA,QAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AACvB,KAEA,aAAA,GAFe,OAAA,GAAA,SAAA,GAAA,QAAA,GAAA,YAAA,GAAA,UAAA,GAAA,iBAAA,GAAA,WAAA,GAAA,aAAA;AAEf,KAUA,mBAAA,GAAsB,OAVT,CAWvB,aAXuB,EAAA,UAAA,GAAA,iBAAA,CAAA;AAUb,UAKK,QAAA,CALc;EAKd,UAAA,EAAQ,IAAA,GAAA,MAAA;EAKR,KAAA,EAAA,IAAA,GAAU,MAAA;;AAIT,UAJD,UAAA,CAIC;EACX,IAAA,EAAA,MAAA;EACO,QAAA,EAJF,aAIE;EAAQ,cAAA,EAFJ,mBAEI;EAKL,GAAA,EANV,QAMU;EAKA,SAAA,CAAA,EAVH,QAUW;EAKR,OAAA,EAAA,MAAQ,EAAA,GAAA,EAAA;EAKR,cAAA,EAAA,MAAA;AAMjB;AAEU,UAvBO,iBAAA,CAuBP;EAEE,MAAA,EAxBF,YAwBE;EAaK,MAAA,EApCP,wBAoCO,EAAA;;AAEI,UAnCJ,QAAA,CAmCI;EAIJ,UAAA,EAAA,IAAY,GAAA,MAAA;EAMnB,KAAA,EAAA,IAAA,GAAA,MAAA;AAKV;UA7CiB,QAAA;;;;UAKA,qBAAA;;;;;UAMA,eAAA;;UAEP;;YAEE;;;;;;;;;;;;;iBAaK;;aAEJ;;;UAII,YAAA;eACF;cACD;;;UAIJ,wBAAA;;;;UAKO,gBAAA;aACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-prisma",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Powerlines plugin to generate project code and a Prisma client from a Prisma schema (PSL).",
|
|
6
6
|
"keywords": ["prisma", "powerlines", "storm-software", "powerlines-plugin"],
|
|
@@ -265,34 +265,6 @@
|
|
|
265
265
|
"default": "./dist/api/types.gen.mjs"
|
|
266
266
|
}
|
|
267
267
|
},
|
|
268
|
-
"./components": {
|
|
269
|
-
"require": {
|
|
270
|
-
"types": "./dist/components/index.d.cts",
|
|
271
|
-
"default": "./dist/components/index.cjs"
|
|
272
|
-
},
|
|
273
|
-
"import": {
|
|
274
|
-
"types": "./dist/components/index.d.mts",
|
|
275
|
-
"default": "./dist/components/index.mjs"
|
|
276
|
-
},
|
|
277
|
-
"default": {
|
|
278
|
-
"types": "./dist/components/index.d.mts",
|
|
279
|
-
"default": "./dist/components/index.mjs"
|
|
280
|
-
}
|
|
281
|
-
},
|
|
282
|
-
"./components/infrastructure-file": {
|
|
283
|
-
"require": {
|
|
284
|
-
"types": "./dist/components/infrastructure-file.d.cts",
|
|
285
|
-
"default": "./dist/components/infrastructure-file.cjs"
|
|
286
|
-
},
|
|
287
|
-
"import": {
|
|
288
|
-
"types": "./dist/components/infrastructure-file.d.mts",
|
|
289
|
-
"default": "./dist/components/infrastructure-file.mjs"
|
|
290
|
-
},
|
|
291
|
-
"default": {
|
|
292
|
-
"types": "./dist/components/infrastructure-file.d.mts",
|
|
293
|
-
"default": "./dist/components/infrastructure-file.mjs"
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
268
|
"./helpers": {
|
|
297
269
|
"require": {
|
|
298
270
|
"types": "./dist/helpers/index.d.cts",
|
|
@@ -398,9 +370,7 @@
|
|
|
398
370
|
"typings": "dist/index.d.mts",
|
|
399
371
|
"files": ["dist/**/*"],
|
|
400
372
|
"dependencies": {
|
|
401
|
-
"@
|
|
402
|
-
"@alloy-js/typescript": "0.23.0-dev.4",
|
|
403
|
-
"@powerlines/plugin-pulumi": "^0.3.1",
|
|
373
|
+
"@powerlines/plugin-pulumi": "^0.5.0",
|
|
404
374
|
"@prisma/get-platform": "^6.19.2",
|
|
405
375
|
"@prisma/prisma-schema-wasm": "6.19.0-26.2ba551f319ab1df4bc874a89965d8b3641056773",
|
|
406
376
|
"@stryke/cli": "^0.13.25",
|
|
@@ -411,15 +381,15 @@
|
|
|
411
381
|
"defu": "^6.1.4",
|
|
412
382
|
"fp-ts": "^2.16.11",
|
|
413
383
|
"jiti": "^2.6.1",
|
|
414
|
-
"powerlines": "^0.40.
|
|
384
|
+
"powerlines": "^0.40.6",
|
|
415
385
|
"prisma-util": "^2.1.1",
|
|
416
386
|
"ts-pattern": "^5.9.0"
|
|
417
387
|
},
|
|
418
388
|
"devDependencies": {
|
|
419
|
-
"@
|
|
420
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
389
|
+
"@pulumi/pulumi": "^3.225.1",
|
|
390
|
+
"@powerlines/plugin-plugin": "^0.12.270",
|
|
421
391
|
"@types/node": "^25.3.5"
|
|
422
392
|
},
|
|
423
393
|
"publishConfig": { "access": "public" },
|
|
424
|
-
"gitHead": "
|
|
394
|
+
"gitHead": "8952a4d271f29b7b174297aaa4c0d3ebb002140f"
|
|
425
395
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { PrismaPostgresInfrastructureFile, PrismaPostgresInfrastructureFileProps, __ΩPrismaPostgresInfrastructureFileProps } from "./infrastructure-file.cjs";
|
|
2
|
-
export { PrismaPostgresInfrastructureFile, PrismaPostgresInfrastructureFileProps, __ΩPrismaPostgresInfrastructureFileProps };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { PrismaPostgresInfrastructureFile, PrismaPostgresInfrastructureFileProps, __ΩPrismaPostgresInfrastructureFileProps } from "./infrastructure-file.mjs";
|
|
2
|
-
export { PrismaPostgresInfrastructureFile, PrismaPostgresInfrastructureFileProps, __ΩPrismaPostgresInfrastructureFileProps };
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_kebab_case = require('../node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/kebab-case.cjs');
|
|
3
|
-
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
|
-
let __alloy_js_core = require("@alloy-js/core");
|
|
5
|
-
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
|
-
let __powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
7
|
-
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
8
|
-
let __powerlines_plugin_alloy_typescript_components_infrastructure_file = require("@powerlines/plugin-alloy/typescript/components/infrastructure-file");
|
|
9
|
-
let defu = require("defu");
|
|
10
|
-
defu = require_rolldown_runtime.__toESM(defu);
|
|
11
|
-
|
|
12
|
-
//#region src/components/infrastructure-file.tsx
|
|
13
|
-
/**
|
|
14
|
-
* Generates the Prisma Postgres infrastructure configuration module for the Powerlines project.
|
|
15
|
-
*/
|
|
16
|
-
function PrismaPostgresInfrastructureFile(props) {
|
|
17
|
-
const [{ children, imports }, rest] = (0, __alloy_js_core.splitProps)(props, ["children", "imports"]);
|
|
18
|
-
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
19
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_infrastructure_file.InfrastructureFile, (0, __alloy_js_core_jsx_runtime.mergeProps)({ id: "prisma-postgres" }, rest, {
|
|
20
|
-
get imports() {
|
|
21
|
-
return (0, defu.default)({
|
|
22
|
-
"@pulumi/pulumi": "pulumi",
|
|
23
|
-
"@pulumi/prisma-postgres": "prismaPostgres"
|
|
24
|
-
}, imports ?? {});
|
|
25
|
-
},
|
|
26
|
-
get children() {
|
|
27
|
-
return [
|
|
28
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
29
|
-
"export": true,
|
|
30
|
-
"const": true,
|
|
31
|
-
name: "project",
|
|
32
|
-
get initializer() {
|
|
33
|
-
return __alloy_js_core.code`new prismaPostgres.Project("project", {
|
|
34
|
-
name: "${context.config.prisma.prismaPostgres?.projectId}",
|
|
35
|
-
}); `;
|
|
36
|
-
}
|
|
37
|
-
}),
|
|
38
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
39
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
40
|
-
"export": true,
|
|
41
|
-
"const": true,
|
|
42
|
-
name: "database",
|
|
43
|
-
get initializer() {
|
|
44
|
-
return __alloy_js_core.code`prismaPostgres.Database("database", {
|
|
45
|
-
projectId: project.id,
|
|
46
|
-
name: "${context.config.prisma.prismaPostgres?.databaseName || `${require_kebab_case.kebabCase(context.config.name)}.${context.config.mode}.${context.config.prisma.prismaPostgres?.region}`}",
|
|
47
|
-
region: "${context.config.prisma.prismaPostgres?.region}",
|
|
48
|
-
}); `;
|
|
49
|
-
}
|
|
50
|
-
}),
|
|
51
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
52
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
53
|
-
"export": true,
|
|
54
|
-
"const": true,
|
|
55
|
-
name: "connection",
|
|
56
|
-
get initializer() {
|
|
57
|
-
return __alloy_js_core.code`new prismaPostgres.Connection("connection", {
|
|
58
|
-
databaseId: database.id,
|
|
59
|
-
name: "${require_kebab_case.kebabCase(context.config.name)}-api-key",
|
|
60
|
-
}); `;
|
|
61
|
-
}
|
|
62
|
-
}),
|
|
63
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
64
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
65
|
-
get when() {
|
|
66
|
-
return Boolean(children);
|
|
67
|
-
},
|
|
68
|
-
children
|
|
69
|
-
})
|
|
70
|
-
];
|
|
71
|
-
}
|
|
72
|
-
}));
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
//#endregion
|
|
76
|
-
exports.PrismaPostgresInfrastructureFile = PrismaPostgresInfrastructureFile;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
-
import { InfrastructureFileProps } from "@powerlines/plugin-alloy/typescript/components/infrastructure-file";
|
|
3
|
-
|
|
4
|
-
//#region src/components/infrastructure-file.d.ts
|
|
5
|
-
type PrismaPostgresInfrastructureFileProps = Omit<InfrastructureFileProps, "id">;
|
|
6
|
-
/**
|
|
7
|
-
* Generates the Prisma Postgres infrastructure configuration module for the Powerlines project.
|
|
8
|
-
*/
|
|
9
|
-
declare function PrismaPostgresInfrastructureFile(props: PrismaPostgresInfrastructureFileProps): _alloy_js_core0.Children;
|
|
10
|
-
declare type __ΩPrismaPostgresInfrastructureFileProps = any[];
|
|
11
|
-
//#endregion
|
|
12
|
-
export { PrismaPostgresInfrastructureFile, PrismaPostgresInfrastructureFileProps, __ΩPrismaPostgresInfrastructureFileProps };
|
|
13
|
-
//# sourceMappingURL=infrastructure-file.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"infrastructure-file.d.cts","names":[],"sources":["../../src/components/infrastructure-file.tsx"],"sourcesContent":[],"mappings":";;;;KA8BY,qCAAA,GAAwC,KAClD;;;AADF;AAQgB,iBAAA,gCAAA,CACP,KAAA,EAAA,qCAAqC,CAAA,EAAA,eAAA,CAAA,QAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
-
import { InfrastructureFileProps } from "@powerlines/plugin-alloy/typescript/components/infrastructure-file";
|
|
3
|
-
|
|
4
|
-
//#region src/components/infrastructure-file.d.ts
|
|
5
|
-
type PrismaPostgresInfrastructureFileProps = Omit<InfrastructureFileProps, "id">;
|
|
6
|
-
/**
|
|
7
|
-
* Generates the Prisma Postgres infrastructure configuration module for the Powerlines project.
|
|
8
|
-
*/
|
|
9
|
-
declare function PrismaPostgresInfrastructureFile(props: PrismaPostgresInfrastructureFileProps): _alloy_js_core0.Children;
|
|
10
|
-
declare type __ΩPrismaPostgresInfrastructureFileProps = any[];
|
|
11
|
-
//#endregion
|
|
12
|
-
export { PrismaPostgresInfrastructureFile, PrismaPostgresInfrastructureFileProps, __ΩPrismaPostgresInfrastructureFileProps };
|
|
13
|
-
//# sourceMappingURL=infrastructure-file.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"infrastructure-file.d.mts","names":[],"sources":["../../src/components/infrastructure-file.tsx"],"sourcesContent":[],"mappings":";;;;KA8BY,qCAAA,GAAwC,KAClD;;;AADF;AAQgB,iBAAA,gCAAA,CACP,KAAA,EAAA,qCAAqC,CAAA,EAAA,eAAA,CAAA,QAAA"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { kebabCase } from "../node_modules/.pnpm/@stryke_string-format@0.16.0/node_modules/@stryke/string-format/dist/kebab-case.mjs";
|
|
2
|
-
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import { Show, code, splitProps } from "@alloy-js/core";
|
|
4
|
-
import { VarDeclaration } from "@alloy-js/typescript";
|
|
5
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
6
|
-
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
7
|
-
import { InfrastructureFile } from "@powerlines/plugin-alloy/typescript/components/infrastructure-file";
|
|
8
|
-
import defu from "defu";
|
|
9
|
-
|
|
10
|
-
//#region src/components/infrastructure-file.tsx
|
|
11
|
-
/**
|
|
12
|
-
* Generates the Prisma Postgres infrastructure configuration module for the Powerlines project.
|
|
13
|
-
*/
|
|
14
|
-
function PrismaPostgresInfrastructureFile(props) {
|
|
15
|
-
const [{ children, imports }, rest] = splitProps(props, ["children", "imports"]);
|
|
16
|
-
const context = usePowerlines();
|
|
17
|
-
return createComponent(InfrastructureFile, mergeProps({ id: "prisma-postgres" }, rest, {
|
|
18
|
-
get imports() {
|
|
19
|
-
return defu({
|
|
20
|
-
"@pulumi/pulumi": "pulumi",
|
|
21
|
-
"@pulumi/prisma-postgres": "prismaPostgres"
|
|
22
|
-
}, imports ?? {});
|
|
23
|
-
},
|
|
24
|
-
get children() {
|
|
25
|
-
return [
|
|
26
|
-
createComponent(VarDeclaration, {
|
|
27
|
-
"export": true,
|
|
28
|
-
"const": true,
|
|
29
|
-
name: "project",
|
|
30
|
-
get initializer() {
|
|
31
|
-
return code`new prismaPostgres.Project("project", {
|
|
32
|
-
name: "${context.config.prisma.prismaPostgres?.projectId}",
|
|
33
|
-
}); `;
|
|
34
|
-
}
|
|
35
|
-
}),
|
|
36
|
-
createComponent(Spacing, {}),
|
|
37
|
-
createComponent(VarDeclaration, {
|
|
38
|
-
"export": true,
|
|
39
|
-
"const": true,
|
|
40
|
-
name: "database",
|
|
41
|
-
get initializer() {
|
|
42
|
-
return code`prismaPostgres.Database("database", {
|
|
43
|
-
projectId: project.id,
|
|
44
|
-
name: "${context.config.prisma.prismaPostgres?.databaseName || `${kebabCase(context.config.name)}.${context.config.mode}.${context.config.prisma.prismaPostgres?.region}`}",
|
|
45
|
-
region: "${context.config.prisma.prismaPostgres?.region}",
|
|
46
|
-
}); `;
|
|
47
|
-
}
|
|
48
|
-
}),
|
|
49
|
-
createComponent(Spacing, {}),
|
|
50
|
-
createComponent(VarDeclaration, {
|
|
51
|
-
"export": true,
|
|
52
|
-
"const": true,
|
|
53
|
-
name: "connection",
|
|
54
|
-
get initializer() {
|
|
55
|
-
return code`new prismaPostgres.Connection("connection", {
|
|
56
|
-
databaseId: database.id,
|
|
57
|
-
name: "${kebabCase(context.config.name)}-api-key",
|
|
58
|
-
}); `;
|
|
59
|
-
}
|
|
60
|
-
}),
|
|
61
|
-
createComponent(Spacing, {}),
|
|
62
|
-
createComponent(Show, {
|
|
63
|
-
get when() {
|
|
64
|
-
return Boolean(children);
|
|
65
|
-
},
|
|
66
|
-
children
|
|
67
|
-
})
|
|
68
|
-
];
|
|
69
|
-
}
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
//#endregion
|
|
74
|
-
export { PrismaPostgresInfrastructureFile };
|
|
75
|
-
//# sourceMappingURL=infrastructure-file.mjs.map
|