@powerlines/plugin-prisma 0.4.81 → 0.4.83

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/_virtual/_rolldown/runtime.cjs +29 -0
  2. package/dist/helpers/client-generator.cjs +143 -2
  3. package/dist/helpers/client-generator.d.cts +17 -0
  4. package/dist/helpers/client-generator.d.cts.map +1 -0
  5. package/dist/helpers/client-generator.d.mts +17 -0
  6. package/dist/helpers/client-generator.d.mts.map +1 -0
  7. package/dist/helpers/client-generator.mjs +143 -2
  8. package/dist/helpers/client-generator.mjs.map +1 -0
  9. package/dist/helpers/get-schema.cjs +100 -2
  10. package/dist/helpers/get-schema.d.cts +13 -0
  11. package/dist/helpers/get-schema.d.cts.map +1 -0
  12. package/dist/helpers/get-schema.d.mts +13 -0
  13. package/dist/helpers/get-schema.d.mts.map +1 -0
  14. package/dist/helpers/get-schema.mjs +2 -1
  15. package/dist/helpers/get-schema.mjs.map +1 -0
  16. package/dist/helpers/index.cjs +4 -4
  17. package/dist/helpers/index.d.cts +5 -0
  18. package/dist/helpers/index.d.mts +5 -0
  19. package/dist/helpers/index.mjs +1 -1
  20. package/dist/helpers/schema-creator.cjs +1 -1
  21. package/dist/helpers/schema-creator.d.cts +20 -0
  22. package/dist/helpers/schema-creator.d.cts.map +1 -0
  23. package/dist/helpers/schema-creator.d.mts +20 -0
  24. package/dist/helpers/schema-creator.d.mts.map +1 -0
  25. package/dist/helpers/schema-creator.mjs +2 -1
  26. package/dist/helpers/schema-creator.mjs.map +1 -0
  27. package/dist/helpers/typed-sql.cjs +1 -1
  28. package/dist/helpers/typed-sql.d.cts +7 -0
  29. package/dist/helpers/typed-sql.d.cts.map +1 -0
  30. package/dist/helpers/typed-sql.d.mts +7 -0
  31. package/dist/helpers/typed-sql.d.mts.map +1 -0
  32. package/dist/helpers/typed-sql.mjs +2 -1
  33. package/dist/helpers/typed-sql.mjs.map +1 -0
  34. package/dist/index.cjs +10 -9
  35. package/dist/index.d.cts +20 -0
  36. package/dist/index.d.cts.map +1 -0
  37. package/dist/index.d.mts +20 -0
  38. package/dist/index.d.mts.map +1 -0
  39. package/dist/index.mjs +4 -3
  40. package/dist/index.mjs.map +1 -0
  41. package/dist/package.cjs +11 -0
  42. package/dist/package.mjs +6 -0
  43. package/dist/package.mjs.map +1 -0
  44. package/dist/types/index.cjs +0 -2
  45. package/dist/types/index.d.cts +3 -0
  46. package/dist/types/index.d.mts +3 -0
  47. package/dist/types/index.mjs +0 -3
  48. package/dist/types/plugin.d.cts +111 -0
  49. package/dist/types/plugin.d.cts.map +1 -0
  50. package/dist/types/plugin.d.mts +111 -0
  51. package/dist/types/plugin.d.mts.map +1 -0
  52. package/dist/types/prisma.d.cts +94 -0
  53. package/dist/types/prisma.d.cts.map +1 -0
  54. package/dist/types/prisma.d.mts +94 -0
  55. package/dist/types/prisma.d.mts.map +1 -0
  56. package/package.json +6 -6
  57. package/dist/client-generator-BoWegnfS.mjs +0 -146
  58. package/dist/client-generator-CMCbRxho.cjs +0 -152
  59. package/dist/client-generator-CQiim7Qj.cjs +0 -152
  60. package/dist/client-generator-CxKIlqpl.mjs +0 -146
  61. package/dist/get-schema-OhMkdmwI.cjs +0 -138
@@ -57,4 +57,5 @@ ${schema}`;
57
57
  };
58
58
 
59
59
  //#endregion
60
- export { PrismaSchemaCreator };
60
+ export { PrismaSchemaCreator };
61
+ //# sourceMappingURL=schema-creator.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-creator.mjs","names":["#context"],"sources":["../../src/helpers/schema-creator.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 { SchemaCreator } from \"prisma-util/schema-creator\";\nimport { PrismaPluginContext } from \"../types/plugin\";\nimport { GeneratorConfig } from \"../types/prisma\";\n\n/**\n * Prisma schema creator that allows building a schema via code.\n */\nexport class PrismaSchemaCreator extends SchemaCreator {\n /** Prisma plugin context */\n #context: PrismaPluginContext;\n\n private get generators(): GeneratorConfig[] {\n return this.#context.prisma.schema.generators;\n }\n\n private set generators(value: GeneratorConfig[]) {\n this.#context.prisma.schema.generators = value;\n }\n\n public constructor(context: PrismaPluginContext) {\n super();\n\n this.#context = context;\n this.#context.prisma ??= {} as PrismaPluginContext[\"prisma\"];\n this.#context.prisma.schema ??= {\n generators: [],\n datasources: [],\n warnings: []\n };\n\n this.#context.prisma.schema.generators.forEach(generator => {\n this.pushGenerator(generator);\n });\n }\n\n public pushGenerator(generator: GeneratorConfig): this {\n if (this.generators.some(gen => gen.name === generator.name)) {\n this.generators = [\n ...this.generators.filter(gen => gen.name !== generator.name),\n generator\n ];\n } else {\n this.generators.push(generator);\n }\n\n return this;\n }\n\n public override build(): string {\n let schema = super.build();\n\n for (const generator of this.generators) {\n schema = `\ngenerator ${generator.name} {\n provider = \"${generator.provider.value}\"\n output = \"${generator.output?.value}\"${\n generator.previewFeatures && generator.previewFeatures.length > 0\n ? `\n previewFeatures = [${generator.previewFeatures\n .map(feature => `\"${feature}\"`)\n .join(\", \")}]`\n : \"\"\n }${\n generator.config && Object.keys(generator.config).length > 0\n ? Object.entries(generator.config)\n .map(([key, value]) => {\n if (Array.isArray(value)) {\n return `${key} = [${value.map(v => `\"${v}\"`).join(\", \")}]`;\n } else {\n return `${key} = \"${value}\"`;\n }\n })\n .join(\"\\n \")\n : \"\"\n }${\n generator.binaryTargets && generator.binaryTargets.length > 0\n ? `\n binaryTargets = [${generator.binaryTargets\n .map(bt => `\"${bt.value}\"`)\n .join(\", \")}]`\n : \"\"\n }${\n generator.envPaths?.rootEnvPath || generator.envPaths?.schemaEnvPath\n ? `\n env = {${\n generator.envPaths?.rootEnvPath\n ? `\n root = \"${generator.envPaths.rootEnvPath}\"`\n : \"\"\n }${\n generator.envPaths?.schemaEnvPath\n ? `\n schema = \"${generator.envPaths.schemaEnvPath}\"`\n : \"\"\n }\n }`\n : \"\"\n }\n}\n\n${schema}`;\n }\n\n return schema;\n }\n\n public async write(): Promise<void> {\n await this.#context.fs.write(\n this.#context.config.prisma.schema,\n this.build()\n );\n }\n}\n"],"mappings":";;;;;;AAyBA,IAAa,sBAAb,cAAyC,cAAc;;CAErD;CAEA,IAAY,aAAgC;AAC1C,SAAO,MAAKA,QAAS,OAAO,OAAO;;CAGrC,IAAY,WAAW,OAA0B;AAC/C,QAAKA,QAAS,OAAO,OAAO,aAAa;;CAG3C,AAAO,YAAY,SAA8B;AAC/C,SAAO;AAEP,QAAKA,UAAW;AAChB,QAAKA,QAAS,WAAW,EAAE;AAC3B,QAAKA,QAAS,OAAO,WAAW;GAC9B,YAAY,EAAE;GACd,aAAa,EAAE;GACf,UAAU,EAAE;GACb;AAED,QAAKA,QAAS,OAAO,OAAO,WAAW,SAAQ,cAAa;AAC1D,QAAK,cAAc,UAAU;IAC7B;;CAGJ,AAAO,cAAc,WAAkC;AACrD,MAAI,KAAK,WAAW,MAAK,QAAO,IAAI,SAAS,UAAU,KAAK,CAC1D,MAAK,aAAa,CAChB,GAAG,KAAK,WAAW,QAAO,QAAO,IAAI,SAAS,UAAU,KAAK,EAC7D,UACD;MAED,MAAK,WAAW,KAAK,UAAU;AAGjC,SAAO;;CAGT,AAAgB,QAAgB;EAC9B,IAAI,SAAS,MAAM,OAAO;AAE1B,OAAK,MAAM,aAAa,KAAK,WAC3B,UAAS;YACH,UAAU,KAAK;gBACX,UAAU,SAAS,MAAM;cAC3B,UAAU,QAAQ,MAAM,GAClC,UAAU,mBAAmB,UAAU,gBAAgB,SAAS,IAC5D;uBACe,UAAU,gBAC5B,KAAI,YAAW,IAAI,QAAQ,GAAG,CAC9B,KAAK,KAAK,CAAC,KACR,KAEJ,UAAU,UAAU,OAAO,KAAK,UAAU,OAAO,CAAC,SAAS,IACvD,OAAO,QAAQ,UAAU,OAAO,CAC7B,KAAK,CAAC,KAAK,WAAW;AACrB,OAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,GAAG,IAAI,MAAM,MAAM,KAAI,MAAK,IAAI,EAAE,GAAG,CAAC,KAAK,KAAK,CAAC;OAExD,QAAO,GAAG,IAAI,MAAM,MAAM;IAE5B,CACD,KAAK,OAAO,GACf,KAEJ,UAAU,iBAAiB,UAAU,cAAc,SAAS,IACxD;qBACa,UAAU,cAC1B,KAAI,OAAM,IAAI,GAAG,MAAM,GAAG,CAC1B,KAAK,KAAK,CAAC,KACR,KAEJ,UAAU,UAAU,eAAe,UAAU,UAAU,gBACnD;WAEJ,UAAU,UAAU,cAChB;cACM,UAAU,SAAS,YAAY,KACrC,KAEJ,UAAU,UAAU,gBAChB;gBACQ,UAAU,SAAS,cAAc,KACzC,GACL;OAEK,GACL;;;EAGD;AAGE,SAAO;;CAGT,MAAa,QAAuB;AAClC,QAAM,MAAKA,QAAS,GAAG,MACrB,MAAKA,QAAS,OAAO,OAAO,QAC5B,KAAK,OAAO,CACb"}
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_get_schema = require('../get-schema-OhMkdmwI.cjs');
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.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");
@@ -0,0 +1,7 @@
1
+ import { PrismaPluginContext } from "../types/plugin.cjs";
2
+
3
+ //#region src/helpers/typed-sql.d.ts
4
+ declare function introspectSql(context: PrismaPluginContext): Promise<any>;
5
+ //#endregion
6
+ export { introspectSql };
7
+ //# sourceMappingURL=typed-sql.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-sql.d.cts","names":[],"sources":["../../src/helpers/typed-sql.ts"],"mappings":";;;iBAqEsB,aAAA,CAAc,OAAA,EAAS,mBAAA,GAAmB,OAAA"}
@@ -0,0 +1,7 @@
1
+ import { PrismaPluginContext } from "../types/plugin.mjs";
2
+
3
+ //#region src/helpers/typed-sql.d.ts
4
+ declare function introspectSql(context: PrismaPluginContext): Promise<any>;
5
+ //#endregion
6
+ export { introspectSql };
7
+ //# sourceMappingURL=typed-sql.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-sql.d.mts","names":[],"sources":["../../src/helpers/typed-sql.ts"],"mappings":";;;iBAqEsB,aAAA,CAAc,OAAA,EAAS,mBAAA,GAAmB,OAAA"}
@@ -33,4 +33,5 @@ async function introspectSql(context) {
33
33
  }
34
34
 
35
35
  //#endregion
36
- export { introspectSql };
36
+ export { introspectSql };
37
+ //# sourceMappingURL=typed-sql.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-sql.mjs","names":["migrateIntrospectSql"],"sources":["../../src/helpers/typed-sql.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 {\n inferDirectoryConfig,\n isValidJsIdentifier,\n PrismaConfigWithDatasource\n} from \"@prisma/internals\";\nimport {\n IntrospectSqlInput,\n introspectSql as migrateIntrospectSql\n} from \"@prisma/migrate\";\nimport {\n findFileExtension,\n findFileName,\n relativePath\n} from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { PrismaPluginContext } from \"../types/plugin\";\n\nasync function readTypedSqlFiles(\n context: PrismaPluginContext,\n typedSqlDirPath: string\n): Promise<IntrospectSqlInput[]> {\n const files = await context.fs.list(typedSqlDirPath);\n const results: IntrospectSqlInput[] = [];\n for (const fileName of files) {\n if (findFileExtension(fileName) !== \".sql\") {\n continue;\n }\n\n if (\n !isValidJsIdentifier(findFileName(fileName, { withExtension: false }))\n ) {\n throw new Error(\n `${joinPaths(typedSqlDirPath, fileName)} can not be used as a typed sql query: name must be a valid JS identifier`\n );\n }\n if (findFileName(fileName).startsWith(\"$\")) {\n throw new Error(\n `${joinPaths(typedSqlDirPath, fileName)} can not be used as a typed sql query: name must not start with $`\n );\n }\n\n results.push({\n name: findFileName(fileName, { withExtension: false }),\n source: (await context.fs.read(joinPaths(typedSqlDirPath, fileName)))!,\n fileName: joinPaths(typedSqlDirPath, fileName)\n });\n }\n\n return results;\n}\n\nexport async function introspectSql(context: PrismaPluginContext) {\n const directoryConfig = inferDirectoryConfig(\n context.prisma.schema,\n context.prisma.config\n );\n const sqlFiles = await readTypedSqlFiles(\n context,\n directoryConfig.typedSqlDirPath\n );\n\n const introspectionResult = await migrateIntrospectSql(\n context.prisma.schema,\n context.prisma.config as PrismaConfigWithDatasource,\n context.config.root,\n sqlFiles\n );\n if (introspectionResult.ok) {\n return introspectionResult.queries;\n }\n\n const lines: string[] = [`Errors while reading sql files:\\n`];\n for (const { fileName, message } of introspectionResult.errors) {\n lines.push(`In ${relativePath(process.cwd(), fileName)}:`);\n lines.push(message);\n lines.push(\"\");\n }\n\n throw new Error(lines.join(\"\\n\"));\n}\n"],"mappings":";;;;;;AAmCA,eAAe,kBACb,SACA,iBAC+B;CAC/B,MAAM,QAAQ,MAAM,QAAQ,GAAG,KAAK,gBAAgB;CACpD,MAAM,UAAgC,EAAE;AACxC,MAAK,MAAM,YAAY,OAAO;AAC5B,MAAI,kBAAkB,SAAS,KAAK,OAClC;AAGF,MACE,CAAC,oBAAoB,aAAa,UAAU,EAAE,eAAe,OAAO,CAAC,CAAC,CAEtE,OAAM,IAAI,MACR,GAAG,UAAU,iBAAiB,SAAS,CAAC,2EACzC;AAEH,MAAI,aAAa,SAAS,CAAC,WAAW,IAAI,CACxC,OAAM,IAAI,MACR,GAAG,UAAU,iBAAiB,SAAS,CAAC,mEACzC;AAGH,UAAQ,KAAK;GACX,MAAM,aAAa,UAAU,EAAE,eAAe,OAAO,CAAC;GACtD,QAAS,MAAM,QAAQ,GAAG,KAAK,UAAU,iBAAiB,SAAS,CAAC;GACpE,UAAU,UAAU,iBAAiB,SAAS;GAC/C,CAAC;;AAGJ,QAAO;;AAGT,eAAsB,cAAc,SAA8B;CAKhE,MAAM,WAAW,MAAM,kBACrB,SALsB,qBACtB,QAAQ,OAAO,QACf,QAAQ,OAAO,OAChB,CAGiB,gBACjB;CAED,MAAM,sBAAsB,MAAMA,gBAChC,QAAQ,OAAO,QACf,QAAQ,OAAO,QACf,QAAQ,OAAO,MACf,SACD;AACD,KAAI,oBAAoB,GACtB,QAAO,oBAAoB;CAG7B,MAAM,QAAkB,CAAC,oCAAoC;AAC7D,MAAK,MAAM,EAAE,UAAU,aAAa,oBAAoB,QAAQ;AAC9D,QAAM,KAAK,MAAM,aAAa,QAAQ,KAAK,EAAE,SAAS,CAAC,GAAG;AAC1D,QAAM,KAAK,QAAQ;AACnB,QAAM,KAAK,GAAG;;AAGhB,OAAM,IAAI,MAAM,MAAM,KAAK,KAAK,CAAC"}
package/dist/index.cjs CHANGED
@@ -1,15 +1,16 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_get_schema = require('./get-schema-OhMkdmwI.cjs');
3
- const require_client_generator = require('./client-generator-CMCbRxho.cjs');
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');
4
5
  const require_helpers_schema_creator = require('./helpers/schema-creator.cjs');
5
6
  const require_helpers_typed_sql = require('./helpers/typed-sql.cjs');
6
7
  let _powerlines_plugin_pulumi = require("@powerlines/plugin-pulumi");
7
- _powerlines_plugin_pulumi = require_get_schema.__toESM(_powerlines_plugin_pulumi, 1);
8
+ _powerlines_plugin_pulumi = require_runtime.__toESM(_powerlines_plugin_pulumi, 1);
8
9
  let _prisma_client_generator_registry = require("@prisma/client-generator-registry");
9
10
  let _prisma_engines = require("@prisma/engines");
10
11
  let _prisma_internals = require("@prisma/internals");
11
12
  let _pulumi_prisma_postgres = require("@pulumi/prisma-postgres");
12
- _pulumi_prisma_postgres = require_get_schema.__toESM(_pulumi_prisma_postgres, 1);
13
+ _pulumi_prisma_postgres = require_runtime.__toESM(_pulumi_prisma_postgres, 1);
13
14
  let _stryke_convert_to_array = require("@stryke/convert/to-array");
14
15
  let _stryke_path_append = require("@stryke/path/append");
15
16
  let _stryke_path_common = require("@stryke/path/common");
@@ -18,7 +19,7 @@ let _stryke_path_join_paths = require("@stryke/path/join-paths");
18
19
  let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
19
20
  let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
20
21
  let defu = require("defu");
21
- defu = require_get_schema.__toESM(defu, 1);
22
+ defu = require_runtime.__toESM(defu, 1);
22
23
  let powerlines_plugin_utils = require("powerlines/plugin-utils");
23
24
 
24
25
  //#region src/index.ts
@@ -55,7 +56,7 @@ const plugin = (options = {}) => {
55
56
  config: this.config.prisma,
56
57
  cmd: "generate --sql"
57
58
  });
58
- const schemaRootDir = (0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, _stryke_path_common.findBasePath)(this.config.prisma.schema), this.config.root), this.workspaceConfig.workspaceRoot);
59
+ const schemaRootDir = (0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, _stryke_path_common.findBasePath)(this.config.prisma.schema), this.config.root), this.config.cwd);
59
60
  this.prisma.schema ??= {
60
61
  schemaRootDir,
61
62
  loadedFromPathForLogMessages: (0, _stryke_path_find.relativePath)(this.config.root, schemaRootDir),
@@ -67,7 +68,7 @@ const plugin = (options = {}) => {
67
68
  warnings: [],
68
69
  primaryDatasource: void 0
69
70
  };
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)));
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)));
71
72
  this.prisma.schema = this.prisma.schema.schemas.reduce((ret, schema) => {
72
73
  ret.datasources.push(...schema.datasources);
73
74
  ret.generators.push(...schema.generators);
@@ -101,12 +102,12 @@ const plugin = (options = {}) => {
101
102
  "prisma-client-ts"
102
103
  ].includes(gen.name || gen.getProvider()))) {
103
104
  generators ??= [];
104
- generators.push(new require_client_generator.PowerlinesClientGenerator(this));
105
+ generators.push(new require_helpers_client_generator.PowerlinesClientGenerator(this));
105
106
  } else generators = generators.map((generator) => [
106
107
  "prisma-client",
107
108
  "prisma-client-js",
108
109
  "prisma-client-ts"
109
- ].includes(generator.name || generator.getProvider()) ? new require_client_generator.PowerlinesClientGenerator(this) : generator);
110
+ ].includes(generator.name || generator.getProvider()) ? new require_helpers_client_generator.PowerlinesClientGenerator(this) : generator);
110
111
  for (const generator of generators) try {
111
112
  await generator.generate();
112
113
  generator.stop();
@@ -0,0 +1,20 @@
1
+ import { ActiveConnectorType, BinaryTargetsEnvValue, ConnectorType, DataSource, EnvPaths, EnvValue, GeneratorConfig, GetSchemaOptions, GetSchemaResponse, LoadedFile, MultipleSchemas, PrismaConfig, PrismaSchema, SchemaFileInput, __ΩActiveConnectorType, __ΩBinaryTargetsEnvValue, __ΩConnectorType, __ΩDataSource, __ΩEnvPaths, __ΩEnvValue, __ΩGeneratorConfig, __ΩGetSchemaOptions, __ΩGetSchemaResponse, __ΩLoadedFile, __ΩMultipleSchemas, __ΩPrismaConfig, __ΩPrismaSchema, __ΩSchemaFileInput } from "./types/prisma.cjs";
2
+ import { PrismaPluginContext, PrismaPluginOptions, PrismaPluginResolvedConfig, PrismaPluginUserConfig, PrismaPostgresPrismaPluginOptions, PrismaSchemaContext, __ΩPrismaPluginContext, __ΩPrismaPluginOptions, __ΩPrismaPluginResolvedConfig, __ΩPrismaPluginUserConfig, __ΩPrismaPostgresPrismaPluginOptions, __ΩPrismaSchemaContext } from "./types/plugin.cjs";
3
+ import { Plugin } from "powerlines";
4
+
5
+ //#region src/index.d.ts
6
+ declare module "powerlines" {
7
+ interface Config {
8
+ prisma?: PrismaPluginOptions;
9
+ }
10
+ }
11
+ /**
12
+ * A Powerlines plugin to integrate Prisma for code generation.
13
+ *
14
+ * @param options - The plugin options.
15
+ * @returns A Powerlines plugin instance.
16
+ */
17
+ declare const plugin: <TContext extends PrismaPluginContext = PrismaPluginContext>(options?: PrismaPluginOptions) => Plugin<TContext>[];
18
+ //#endregion
19
+ export { ActiveConnectorType, BinaryTargetsEnvValue, ConnectorType, DataSource, EnvPaths, EnvValue, GeneratorConfig, GetSchemaOptions, GetSchemaResponse, LoadedFile, MultipleSchemas, PrismaConfig, PrismaPluginContext, PrismaPluginOptions, PrismaPluginResolvedConfig, PrismaPluginUserConfig, PrismaPostgresPrismaPluginOptions, PrismaSchema, PrismaSchemaContext, SchemaFileInput, __ΩActiveConnectorType, __ΩBinaryTargetsEnvValue, __ΩConnectorType, __ΩDataSource, __ΩEnvPaths, __ΩEnvValue, __ΩGeneratorConfig, __ΩGetSchemaOptions, __ΩGetSchemaResponse, __ΩLoadedFile, __ΩMultipleSchemas, __ΩPrismaConfig, __ΩPrismaPluginContext, __ΩPrismaPluginOptions, __ΩPrismaPluginResolvedConfig, __ΩPrismaPluginUserConfig, __ΩPrismaPostgresPrismaPluginOptions, __ΩPrismaSchema, __ΩPrismaSchemaContext, __ΩSchemaFileInput, plugin as default, plugin };
20
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;YAgDY,MAAA;IACR,MAAA,GAAS,mBAAA;EAAA;AAAA;;;;;;;cAUA,MAAA,oBACM,mBAAA,GAAsB,mBAAA,EAEvC,OAAA,GAAS,mBAAA,KACR,MAAA,CAAO,QAAA"}
@@ -0,0 +1,20 @@
1
+ import { ActiveConnectorType, BinaryTargetsEnvValue, ConnectorType, DataSource, EnvPaths, EnvValue, GeneratorConfig, GetSchemaOptions, GetSchemaResponse, LoadedFile, MultipleSchemas, PrismaConfig, PrismaSchema, SchemaFileInput, __ΩActiveConnectorType, __ΩBinaryTargetsEnvValue, __ΩConnectorType, __ΩDataSource, __ΩEnvPaths, __ΩEnvValue, __ΩGeneratorConfig, __ΩGetSchemaOptions, __ΩGetSchemaResponse, __ΩLoadedFile, __ΩMultipleSchemas, __ΩPrismaConfig, __ΩPrismaSchema, __ΩSchemaFileInput } from "./types/prisma.mjs";
2
+ import { PrismaPluginContext, PrismaPluginOptions, PrismaPluginResolvedConfig, PrismaPluginUserConfig, PrismaPostgresPrismaPluginOptions, PrismaSchemaContext, __ΩPrismaPluginContext, __ΩPrismaPluginOptions, __ΩPrismaPluginResolvedConfig, __ΩPrismaPluginUserConfig, __ΩPrismaPostgresPrismaPluginOptions, __ΩPrismaSchemaContext } from "./types/plugin.mjs";
3
+ import { Plugin } from "powerlines";
4
+
5
+ //#region src/index.d.ts
6
+ declare module "powerlines" {
7
+ interface Config {
8
+ prisma?: PrismaPluginOptions;
9
+ }
10
+ }
11
+ /**
12
+ * A Powerlines plugin to integrate Prisma for code generation.
13
+ *
14
+ * @param options - The plugin options.
15
+ * @returns A Powerlines plugin instance.
16
+ */
17
+ declare const plugin: <TContext extends PrismaPluginContext = PrismaPluginContext>(options?: PrismaPluginOptions) => Plugin<TContext>[];
18
+ //#endregion
19
+ export { ActiveConnectorType, BinaryTargetsEnvValue, ConnectorType, DataSource, EnvPaths, EnvValue, GeneratorConfig, GetSchemaOptions, GetSchemaResponse, LoadedFile, MultipleSchemas, PrismaConfig, PrismaPluginContext, PrismaPluginOptions, PrismaPluginResolvedConfig, PrismaPluginUserConfig, PrismaPostgresPrismaPluginOptions, PrismaSchema, PrismaSchemaContext, SchemaFileInput, __ΩActiveConnectorType, __ΩBinaryTargetsEnvValue, __ΩConnectorType, __ΩDataSource, __ΩEnvPaths, __ΩEnvValue, __ΩGeneratorConfig, __ΩGetSchemaOptions, __ΩGetSchemaResponse, __ΩLoadedFile, __ΩMultipleSchemas, __ΩPrismaConfig, __ΩPrismaPluginContext, __ΩPrismaPluginOptions, __ΩPrismaPluginResolvedConfig, __ΩPrismaPluginUserConfig, __ΩPrismaPostgresPrismaPluginOptions, __ΩPrismaSchema, __ΩPrismaSchemaContext, __ΩSchemaFileInput, plugin as default, plugin };
20
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;YAgDY,MAAA;IACR,MAAA,GAAS,mBAAA;EAAA;AAAA;;;;;;;cAUA,MAAA,oBACM,mBAAA,GAAsB,mBAAA,EAEvC,OAAA,GAAS,mBAAA,KACR,MAAA,CAAO,QAAA"}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PowerlinesClientGenerator } from "./client-generator-CxKIlqpl.mjs";
1
+ import { PowerlinesClientGenerator } from "./helpers/client-generator.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";
@@ -51,7 +51,7 @@ const plugin = (options = {}) => {
51
51
  config: this.config.prisma,
52
52
  cmd: "generate --sql"
53
53
  });
54
- const schemaRootDir = appendPath(appendPath(findBasePath(this.config.prisma.schema), this.config.root), this.workspaceConfig.workspaceRoot);
54
+ const schemaRootDir = appendPath(appendPath(findBasePath(this.config.prisma.schema), this.config.root), this.config.cwd);
55
55
  this.prisma.schema ??= {
56
56
  schemaRootDir,
57
57
  loadedFromPathForLogMessages: relativePath(this.config.root, schemaRootDir),
@@ -141,4 +141,5 @@ const plugin = (options = {}) => {
141
141
  };
142
142
 
143
143
  //#endregion
144
- export { plugin as default, plugin };
144
+ export { plugin as default, plugin };
145
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
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 pulumi from \"@powerlines/plugin-pulumi\";\nimport { defaultRegistry } from \"@prisma/client-generator-registry\";\nimport { enginesVersion } from \"@prisma/engines\";\nimport type { Generator } from \"@prisma/internals\";\nimport {\n extractPreviewFeatures,\n getDMMF,\n getGenerators,\n validatePrismaConfigWithDatasource\n} from \"@prisma/internals\";\nimport * as prismaPostgres from \"@pulumi/prisma-postgres\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { findBasePath } from \"@stryke/path/common\";\nimport { relativePath } from \"@stryke/path/find\";\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 { PowerlinesClientGenerator } from \"./helpers/client-generator\";\nimport { getSchema } from \"./helpers/get-schema\";\nimport { PrismaSchemaCreator } from \"./helpers/schema-creator\";\nimport { introspectSql } from \"./helpers/typed-sql\";\nimport { PrismaPluginContext, PrismaPluginOptions } 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 ...pulumi<TContext>(options.pulumi),\n {\n name: \"prisma\",\n config() {\n return {\n prisma: defu(options, {\n schema: joinPaths(this.config.root, \"prisma\", \"*.prisma\"),\n configFile:\n options.configFile || getConfigPath(this, \"prisma.config\"),\n runtime: options.runtime || \"nodejs\",\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 };\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 = toArray(this.config.prisma.schema).map(\n schemaPath => replacePathTokens(this, schemaPath)\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\n this.prisma.config = validatePrismaConfigWithDatasource({\n config: this.config.prisma,\n cmd: \"generate --sql\"\n });\n\n const schemaRootDir = appendPath(\n appendPath(findBasePath(this.config.prisma.schema), this.config.root),\n this.config.cwd\n );\n this.prisma.schema ??= {\n schemaRootDir,\n loadedFromPathForLogMessages: relativePath(\n this.config.root,\n schemaRootDir\n ),\n schemaPath: schemaRootDir,\n schemas: [],\n schemaFiles: [],\n generators: [],\n datasources: [],\n warnings: [],\n primaryDatasource: undefined\n };\n\n this.prisma.schema.schemas = await Promise.all(\n (\n await this.fs.glob(\n this.config.prisma.schema.map(schema =>\n schema.includes(\"*\") || this.fs.isFileSync(schema)\n ? schema\n : joinPaths(schema, \"**/*.prisma\")\n )\n )\n ).map(async schema => getSchema(schema))\n );\n\n this.prisma.schema = this.prisma.schema.schemas.reduce(\n (ret, schema) => {\n ret.datasources.push(...schema.datasources);\n ret.generators.push(...schema.generators);\n ret.warnings.push(...schema.warnings);\n ret.schemaFiles.push([schema.path, schema.content]);\n\n return ret;\n },\n this.prisma.schema\n );\n\n this.prisma.schema.primaryDatasource =\n this.prisma.schema.datasources.at(0);\n this.prisma.schema.schemaPath = this.prisma.schema.schemas.at(0)!.path!;\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 this.prisma.previewFeatures = extractPreviewFeatures(\n this.prisma.schema.generators\n );\n\n this.prisma.dmmf = await getDMMF({\n datamodel: this.prisma.schema.schemaFiles,\n previewFeatures: this.prisma.previewFeatures\n });\n\n const typedSql = await introspectSql(this);\n\n let generators = (await getGenerators({\n schemaContext: this.prisma.schema,\n printDownloadProgress: true,\n version: enginesVersion,\n typedSql,\n allowNoModels: true,\n registry: defaultRegistry.toInternal()\n })) as (Generator | PowerlinesClientGenerator)[];\n if (\n !generators ||\n !generators.some(gen =>\n [\"prisma-client\", \"prisma-client-js\", \"prisma-client-ts\"].includes(\n (gen as PowerlinesClientGenerator).name ||\n (gen as Generator).getProvider()\n )\n )\n ) {\n generators ??= [];\n generators.push(new PowerlinesClientGenerator(this));\n } else {\n // Replace prisma-client generator with PowerlinesClientGenerator\n generators = generators.map(generator =>\n [\"prisma-client\", \"prisma-client-js\", \"prisma-client-ts\"].includes(\n (generator as PowerlinesClientGenerator).name ||\n (generator as Generator).getProvider()\n )\n ? new PowerlinesClientGenerator(this)\n : generator\n );\n }\n\n for (const generator of generators) {\n try {\n await generator.generate();\n generator.stop();\n } catch (err) {\n generator.stop();\n this.error(\n `Error while generating with ${\n (generator as PowerlinesClientGenerator).name ||\n (generator as Generator).getProvider()\n }: ${err instanceof Error ? err.message : String(err)}`\n );\n }\n }\n\n // if (this.config.prisma.prismaPath) {\n // const result = await execute(\n // `${this.config.prisma.prismaPath} generate --schema ${this.config.prisma.schema}`,\n // 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 // const result = await executePackage(\n // \"prisma\",\n // [\"generate\", \"--schema\", this.config.prisma.schema],\n // joinPaths(this.config.cwd, this.config.root)\n // );\n // if (result.failed) {\n // throw new Error(\n // `Prisma process exited with code ${result.exitCode}.`\n // );\n // }\n // }\n },\n pulumi: {\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 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 return null;\n }\n }\n }\n ];\n};\n\nexport default plugin;\n"],"mappings":"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"}
@@ -0,0 +1,11 @@
1
+
2
+ //#region package.json
3
+ var version = "0.4.83";
4
+
5
+ //#endregion
6
+ Object.defineProperty(exports, 'version', {
7
+ enumerable: true,
8
+ get: function () {
9
+ return version;
10
+ }
11
+ });
@@ -0,0 +1,6 @@
1
+ //#region package.json
2
+ var version = "0.4.83";
3
+
4
+ //#endregion
5
+ export { version };
6
+ //# sourceMappingURL=package.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.mjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1,2 +0,0 @@
1
- require('./prisma.cjs');
2
- require('./plugin.cjs');
@@ -0,0 +1,3 @@
1
+ import { ActiveConnectorType, BinaryTargetsEnvValue, ConnectorType, DataSource, EnvPaths, EnvValue, GeneratorConfig, GetSchemaOptions, GetSchemaResponse, LoadedFile, MultipleSchemas, PrismaConfig, PrismaSchema, SchemaFileInput, __ΩActiveConnectorType, __ΩBinaryTargetsEnvValue, __ΩConnectorType, __ΩDataSource, __ΩEnvPaths, __ΩEnvValue, __ΩGeneratorConfig, __ΩGetSchemaOptions, __ΩGetSchemaResponse, __ΩLoadedFile, __ΩMultipleSchemas, __ΩPrismaConfig, __ΩPrismaSchema, __ΩSchemaFileInput } from "./prisma.cjs";
2
+ import { PrismaPluginContext, PrismaPluginOptions, PrismaPluginResolvedConfig, PrismaPluginUserConfig, PrismaPostgresPrismaPluginOptions, PrismaSchemaContext, __ΩPrismaPluginContext, __ΩPrismaPluginOptions, __ΩPrismaPluginResolvedConfig, __ΩPrismaPluginUserConfig, __ΩPrismaPostgresPrismaPluginOptions, __ΩPrismaSchemaContext } from "./plugin.cjs";
3
+ export { ActiveConnectorType, BinaryTargetsEnvValue, ConnectorType, DataSource, EnvPaths, EnvValue, GeneratorConfig, GetSchemaOptions, GetSchemaResponse, LoadedFile, MultipleSchemas, PrismaConfig, PrismaPluginContext, PrismaPluginOptions, PrismaPluginResolvedConfig, PrismaPluginUserConfig, PrismaPostgresPrismaPluginOptions, PrismaSchema, PrismaSchemaContext, SchemaFileInput, __ΩActiveConnectorType, __ΩBinaryTargetsEnvValue, __ΩConnectorType, __ΩDataSource, __ΩEnvPaths, __ΩEnvValue, __ΩGeneratorConfig, __ΩGetSchemaOptions, __ΩGetSchemaResponse, __ΩLoadedFile, __ΩMultipleSchemas, __ΩPrismaConfig, __ΩPrismaPluginContext, __ΩPrismaPluginOptions, __ΩPrismaPluginResolvedConfig, __ΩPrismaPluginUserConfig, __ΩPrismaPostgresPrismaPluginOptions, __ΩPrismaSchema, __ΩPrismaSchemaContext, __ΩSchemaFileInput };
@@ -0,0 +1,3 @@
1
+ import { ActiveConnectorType, BinaryTargetsEnvValue, ConnectorType, DataSource, EnvPaths, EnvValue, GeneratorConfig, GetSchemaOptions, GetSchemaResponse, LoadedFile, MultipleSchemas, PrismaConfig, PrismaSchema, SchemaFileInput, __ΩActiveConnectorType, __ΩBinaryTargetsEnvValue, __ΩConnectorType, __ΩDataSource, __ΩEnvPaths, __ΩEnvValue, __ΩGeneratorConfig, __ΩGetSchemaOptions, __ΩGetSchemaResponse, __ΩLoadedFile, __ΩMultipleSchemas, __ΩPrismaConfig, __ΩPrismaSchema, __ΩSchemaFileInput } from "./prisma.mjs";
2
+ import { PrismaPluginContext, PrismaPluginOptions, PrismaPluginResolvedConfig, PrismaPluginUserConfig, PrismaPostgresPrismaPluginOptions, PrismaSchemaContext, __ΩPrismaPluginContext, __ΩPrismaPluginOptions, __ΩPrismaPluginResolvedConfig, __ΩPrismaPluginUserConfig, __ΩPrismaPostgresPrismaPluginOptions, __ΩPrismaSchemaContext } from "./plugin.mjs";
3
+ export { ActiveConnectorType, BinaryTargetsEnvValue, ConnectorType, DataSource, EnvPaths, EnvValue, GeneratorConfig, GetSchemaOptions, GetSchemaResponse, LoadedFile, MultipleSchemas, PrismaConfig, PrismaPluginContext, PrismaPluginOptions, PrismaPluginResolvedConfig, PrismaPluginUserConfig, PrismaPostgresPrismaPluginOptions, PrismaSchema, PrismaSchemaContext, SchemaFileInput, __ΩActiveConnectorType, __ΩBinaryTargetsEnvValue, __ΩConnectorType, __ΩDataSource, __ΩEnvPaths, __ΩEnvValue, __ΩGeneratorConfig, __ΩGetSchemaOptions, __ΩGetSchemaResponse, __ΩLoadedFile, __ΩMultipleSchemas, __ΩPrismaConfig, __ΩPrismaPluginContext, __ΩPrismaPluginOptions, __ΩPrismaPluginResolvedConfig, __ΩPrismaPluginUserConfig, __ΩPrismaPostgresPrismaPluginOptions, __ΩPrismaSchema, __ΩPrismaSchemaContext, __ΩSchemaFileInput };
@@ -1,4 +1 @@
1
- import "./prisma.mjs";
2
- import "./plugin.mjs";
3
-
4
1
  export { };
@@ -0,0 +1,111 @@
1
+ import { PrismaSchema } from "./prisma.cjs";
2
+ import { PrismaSchemaCreator } from "../helpers/schema-creator.cjs";
3
+ import { SqlQueryOutput } from "@prisma/generator";
4
+ import { PulumiPluginContext, PulumiPluginOptions, PulumiPluginResolvedConfig, PulumiPluginUserConfig } from "@powerlines/plugin-pulumi";
5
+ import { PrismaConfig } from "@prisma/config";
6
+ import * as DMMF from "@prisma/dmmf";
7
+ import { SchemaContext } from "@prisma/internals";
8
+ import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
9
+
10
+ //#region src/types/plugin.d.ts
11
+ interface PrismaPostgresPrismaPluginOptions {
12
+ /**
13
+ * The Prisma project name
14
+ *
15
+ * @defaultValue "\{name\}"
16
+ */
17
+ projectId?: string;
18
+ /**
19
+ * The region to deploy the database to
20
+ *
21
+ * @defaultValue "us-east-1"
22
+ */
23
+ region?: "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "af-south-1" | "ap-east-1" | "ap-south-1" | "ap-south-2" | "ap-southeast-1" | "ap-southeast-2" | "ap-southeast-3" | "ap-southeast-4" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ca-central-1" | "ca-west-1" | "eu-central-1" | "eu-central-2" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-north-1" | "eu-south-1" | "eu-south-2" | "il-central-1" | "me-south-1" | "me-central-1" | "sa-east-1";
24
+ /**
25
+ * The database name
26
+ *
27
+ * @defaultValue "\{region\}.\{mode\}.\{name\}"
28
+ */
29
+ databaseName?: string;
30
+ }
31
+ interface PrismaPluginOptions extends Omit<PrismaConfig, "schema"> {
32
+ /**
33
+ * The path(s) to the Prisma schema file(s) (PSL), or path(s) to a folder that shall be recursively searched for *.prisma files.
34
+ *
35
+ * @defaultValue "\{projectRoot\}/prisma/*.prisma"
36
+ */
37
+ schema?: string | string[];
38
+ /**
39
+ * The path to a custom Prisma configuration file.
40
+ *
41
+ * @remarks
42
+ * This field allows the use of the "\{projectRoot\}" token to refer to the project's root directory - the value will be replaced with the correct file path by the plugin.
43
+ *
44
+ * @defaultValue "\{projectRoot\}/prisma.config.ts"
45
+ */
46
+ configFile?: string;
47
+ /**
48
+ * The path to the output file generated by the plugin.
49
+ *
50
+ * @remarks
51
+ * If using the default value, the file can be imported from "powerlines:prisma/module-name". This field allows the use of the "\{builtinsPath\}" token to refer to the built-in Powerlines plugins directory - the value will be replaced with the correct file path by the plugin.
52
+ *
53
+ * @defaultValue "\{builtinsPath\}/prisma"
54
+ */
55
+ outputPath?: string;
56
+ /**
57
+ * The runtime environment to generate the Prisma Client for.
58
+ *
59
+ * @defaultValue "nodejs"
60
+ */
61
+ runtime?: "deno" | "nodejs" | "workerd" | "vercel-edge";
62
+ /**
63
+ * The service token to use for the Prisma API
64
+ */
65
+ serviceToken?: string;
66
+ /**
67
+ * Configuration parameters to manage a Prisma Postgres database
68
+ */
69
+ prismaPostgres?: PrismaPostgresPrismaPluginOptions | true;
70
+ /**
71
+ * The configuration options for Pulumi.
72
+ */
73
+ pulumi?: PulumiPluginOptions;
74
+ }
75
+ type PrismaPluginUserConfig = UserConfig & PulumiPluginUserConfig & {
76
+ prisma?: Omit<PrismaPluginOptions, "schema" | "outputPath" | "configFile"> & Required<Pick<PrismaPluginOptions, "schema" | "outputPath" | "configFile">>;
77
+ };
78
+ type PrismaPluginResolvedConfig = ResolvedConfig & PulumiPluginResolvedConfig & {
79
+ prisma: Omit<PrismaPluginOptions, "schema" | "outputPath" | "configFile" | "runtime" | "prismaPostgres"> & Required<Pick<PrismaPluginOptions, "outputPath" | "configFile" | "runtime">> & {
80
+ /**
81
+ * The path(s) to the Prisma schema file(s) (PSL), or path(s) to a folder that shall be recursively searched for *.prisma files.
82
+ */
83
+ schema: string[];
84
+ /**
85
+ * Configuration parameters to manage a Prisma Postgres database
86
+ */
87
+ prismaPostgres?: Required<PrismaPostgresPrismaPluginOptions>;
88
+ };
89
+ };
90
+ type PrismaSchemaContext = Omit<SchemaContext, "warnings" | "datasources" | "generators"> & Omit<PrismaSchema, "path" | "content"> & {
91
+ schemas: PrismaSchema[];
92
+ };
93
+ type PrismaPluginContext<TResolvedConfig extends PrismaPluginResolvedConfig = PrismaPluginResolvedConfig> = PluginContext<TResolvedConfig> & PulumiPluginContext & {
94
+ prisma: {
95
+ config: PrismaConfig;
96
+ schema: PrismaSchemaContext;
97
+ previewFeatures: string[];
98
+ dmmf: DMMF.Document;
99
+ builder: PrismaSchemaCreator;
100
+ typedSql: SqlQueryOutput[];
101
+ };
102
+ };
103
+ declare type __ΩPrismaPostgresPrismaPluginOptions = any[];
104
+ declare type __ΩPrismaPluginOptions = any[];
105
+ declare type __ΩPrismaPluginUserConfig = any[];
106
+ declare type __ΩPrismaPluginResolvedConfig = any[];
107
+ declare type __ΩPrismaSchemaContext = any[];
108
+ declare type __ΩPrismaPluginContext = any[];
109
+ //#endregion
110
+ export { PrismaPluginContext, PrismaPluginOptions, PrismaPluginResolvedConfig, PrismaPluginUserConfig, PrismaPostgresPrismaPluginOptions, PrismaSchemaContext, __ΩPrismaPluginContext, __ΩPrismaPluginOptions, __ΩPrismaPluginResolvedConfig, __ΩPrismaPluginUserConfig, __ΩPrismaPostgresPrismaPluginOptions, __ΩPrismaSchemaContext };
111
+ //# sourceMappingURL=plugin.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;;;UAgCiB,iCAAA;;AAAjB;;;;EAME,SAAA;EAOA;;;;AAuCF;EAvCE,MAAA;;;;;;EAoCA,YAAA;AAAA;AAAA,UAGe,mBAAA,SAA4B,IAAA,CAAK,YAAA;EAAA;;;;;EAMhD,MAAA;EAqCA;;;;;;AAQF;;EAnCE,UAAA;EAmCmC;;;;;;;;EAzBnC,UAAA;EAyBmC;;;;;EAlBnC,OAAA;EAsBM;;;EAjBN,YAAA;EAqBU;;;EAhBV,cAAA,GAAiB,iCAAA;EAiBjB;;;EAZA,MAAA,GAAS,mBAAA;AAAA;AAAA,KAGC,sBAAA,GAAyB,UAAA,GACnC,sBAAA;EACE,MAAA,GAAS,IAAA,CAAK,mBAAA,4CACZ,QAAA,CACE,IAAA,CAAK,mBAAA;AAAA;AAAA,KAID,0BAAA,GAA6B,cAAA,GACvC,0BAAA;EACE,MAAA,EAAQ,IAAA,CACN,mBAAA,2EAGA,QAAA,CACE,IAAA,CAAK,mBAAA;IAP4B;;;IAYjC,MAAA;IATF;;;IAcE,cAAA,GAAiB,QAAA,CAAS,iCAAA;EAAA;AAAA;AAAA,KAItB,mBAAA,GAAsB,IAAA,CAChC,aAAA,+CAGA,IAAA,CAAK,YAAA;EACH,OAAA,EAAS,YAAA;AAAA;AAAA,KAGD,mBAAA,yBACc,0BAAA,GACtB,0BAAA,IACA,aAAA,CAAc,eAAA,IAChB,mBAAA;EACE,MAAA;IACE,MAAA,EAAQ,YAAA;IACR,MAAA,EAAQ,mBAAA;IACR,eAAA;IACA,IAAA,EAAM,IAAA,CAAK,QAAA;IACX,OAAA,EAAS,mBAAA;IACT,QAAA,EAAU,cAAA;EAAA;AAAA;AAAA"}
@@ -0,0 +1,111 @@
1
+ import { PrismaSchema } from "./prisma.mjs";
2
+ import { PrismaSchemaCreator } from "../helpers/schema-creator.mjs";
3
+ import { PulumiPluginContext, PulumiPluginOptions, PulumiPluginResolvedConfig, PulumiPluginUserConfig } from "@powerlines/plugin-pulumi";
4
+ import { SchemaContext } from "@prisma/internals";
5
+ import { SqlQueryOutput } from "@prisma/generator";
6
+ import { PrismaConfig } from "@prisma/config";
7
+ import * as DMMF from "@prisma/dmmf";
8
+ import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
9
+
10
+ //#region src/types/plugin.d.ts
11
+ interface PrismaPostgresPrismaPluginOptions {
12
+ /**
13
+ * The Prisma project name
14
+ *
15
+ * @defaultValue "\{name\}"
16
+ */
17
+ projectId?: string;
18
+ /**
19
+ * The region to deploy the database to
20
+ *
21
+ * @defaultValue "us-east-1"
22
+ */
23
+ region?: "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "af-south-1" | "ap-east-1" | "ap-south-1" | "ap-south-2" | "ap-southeast-1" | "ap-southeast-2" | "ap-southeast-3" | "ap-southeast-4" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ca-central-1" | "ca-west-1" | "eu-central-1" | "eu-central-2" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-north-1" | "eu-south-1" | "eu-south-2" | "il-central-1" | "me-south-1" | "me-central-1" | "sa-east-1";
24
+ /**
25
+ * The database name
26
+ *
27
+ * @defaultValue "\{region\}.\{mode\}.\{name\}"
28
+ */
29
+ databaseName?: string;
30
+ }
31
+ interface PrismaPluginOptions extends Omit<PrismaConfig, "schema"> {
32
+ /**
33
+ * The path(s) to the Prisma schema file(s) (PSL), or path(s) to a folder that shall be recursively searched for *.prisma files.
34
+ *
35
+ * @defaultValue "\{projectRoot\}/prisma/*.prisma"
36
+ */
37
+ schema?: string | string[];
38
+ /**
39
+ * The path to a custom Prisma configuration file.
40
+ *
41
+ * @remarks
42
+ * This field allows the use of the "\{projectRoot\}" token to refer to the project's root directory - the value will be replaced with the correct file path by the plugin.
43
+ *
44
+ * @defaultValue "\{projectRoot\}/prisma.config.ts"
45
+ */
46
+ configFile?: string;
47
+ /**
48
+ * The path to the output file generated by the plugin.
49
+ *
50
+ * @remarks
51
+ * If using the default value, the file can be imported from "powerlines:prisma/module-name". This field allows the use of the "\{builtinsPath\}" token to refer to the built-in Powerlines plugins directory - the value will be replaced with the correct file path by the plugin.
52
+ *
53
+ * @defaultValue "\{builtinsPath\}/prisma"
54
+ */
55
+ outputPath?: string;
56
+ /**
57
+ * The runtime environment to generate the Prisma Client for.
58
+ *
59
+ * @defaultValue "nodejs"
60
+ */
61
+ runtime?: "deno" | "nodejs" | "workerd" | "vercel-edge";
62
+ /**
63
+ * The service token to use for the Prisma API
64
+ */
65
+ serviceToken?: string;
66
+ /**
67
+ * Configuration parameters to manage a Prisma Postgres database
68
+ */
69
+ prismaPostgres?: PrismaPostgresPrismaPluginOptions | true;
70
+ /**
71
+ * The configuration options for Pulumi.
72
+ */
73
+ pulumi?: PulumiPluginOptions;
74
+ }
75
+ type PrismaPluginUserConfig = UserConfig & PulumiPluginUserConfig & {
76
+ prisma?: Omit<PrismaPluginOptions, "schema" | "outputPath" | "configFile"> & Required<Pick<PrismaPluginOptions, "schema" | "outputPath" | "configFile">>;
77
+ };
78
+ type PrismaPluginResolvedConfig = ResolvedConfig & PulumiPluginResolvedConfig & {
79
+ prisma: Omit<PrismaPluginOptions, "schema" | "outputPath" | "configFile" | "runtime" | "prismaPostgres"> & Required<Pick<PrismaPluginOptions, "outputPath" | "configFile" | "runtime">> & {
80
+ /**
81
+ * The path(s) to the Prisma schema file(s) (PSL), or path(s) to a folder that shall be recursively searched for *.prisma files.
82
+ */
83
+ schema: string[];
84
+ /**
85
+ * Configuration parameters to manage a Prisma Postgres database
86
+ */
87
+ prismaPostgres?: Required<PrismaPostgresPrismaPluginOptions>;
88
+ };
89
+ };
90
+ type PrismaSchemaContext = Omit<SchemaContext, "warnings" | "datasources" | "generators"> & Omit<PrismaSchema, "path" | "content"> & {
91
+ schemas: PrismaSchema[];
92
+ };
93
+ type PrismaPluginContext<TResolvedConfig extends PrismaPluginResolvedConfig = PrismaPluginResolvedConfig> = PluginContext<TResolvedConfig> & PulumiPluginContext & {
94
+ prisma: {
95
+ config: PrismaConfig;
96
+ schema: PrismaSchemaContext;
97
+ previewFeatures: string[];
98
+ dmmf: DMMF.Document;
99
+ builder: PrismaSchemaCreator;
100
+ typedSql: SqlQueryOutput[];
101
+ };
102
+ };
103
+ declare type __ΩPrismaPostgresPrismaPluginOptions = any[];
104
+ declare type __ΩPrismaPluginOptions = any[];
105
+ declare type __ΩPrismaPluginUserConfig = any[];
106
+ declare type __ΩPrismaPluginResolvedConfig = any[];
107
+ declare type __ΩPrismaSchemaContext = any[];
108
+ declare type __ΩPrismaPluginContext = any[];
109
+ //#endregion
110
+ export { PrismaPluginContext, PrismaPluginOptions, PrismaPluginResolvedConfig, PrismaPluginUserConfig, PrismaPostgresPrismaPluginOptions, PrismaSchemaContext, __ΩPrismaPluginContext, __ΩPrismaPluginOptions, __ΩPrismaPluginResolvedConfig, __ΩPrismaPluginUserConfig, __ΩPrismaPostgresPrismaPluginOptions, __ΩPrismaSchemaContext };
111
+ //# sourceMappingURL=plugin.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;;;UAgCiB,iCAAA;;AAAjB;;;;EAME,SAAA;EAOA;;;;AAuCF;EAvCE,MAAA;;;;;;EAoCA,YAAA;AAAA;AAAA,UAGe,mBAAA,SAA4B,IAAA,CAAK,YAAA;EAAA;;;;;EAMhD,MAAA;EAqCA;;;;;;AAQF;;EAnCE,UAAA;EAmCmC;;;;;;;;EAzBnC,UAAA;EAyBmC;;;;;EAlBnC,OAAA;EAsBM;;;EAjBN,YAAA;EAqBU;;;EAhBV,cAAA,GAAiB,iCAAA;EAiBjB;;;EAZA,MAAA,GAAS,mBAAA;AAAA;AAAA,KAGC,sBAAA,GAAyB,UAAA,GACnC,sBAAA;EACE,MAAA,GAAS,IAAA,CAAK,mBAAA,4CACZ,QAAA,CACE,IAAA,CAAK,mBAAA;AAAA;AAAA,KAID,0BAAA,GAA6B,cAAA,GACvC,0BAAA;EACE,MAAA,EAAQ,IAAA,CACN,mBAAA,2EAGA,QAAA,CACE,IAAA,CAAK,mBAAA;IAP4B;;;IAYjC,MAAA;IATF;;;IAcE,cAAA,GAAiB,QAAA,CAAS,iCAAA;EAAA;AAAA;AAAA,KAItB,mBAAA,GAAsB,IAAA,CAChC,aAAA,+CAGA,IAAA,CAAK,YAAA;EACH,OAAA,EAAS,YAAA;AAAA;AAAA,KAGD,mBAAA,yBACc,0BAAA,GACtB,0BAAA,IACA,aAAA,CAAc,eAAA,IAChB,mBAAA;EACE,MAAA;IACE,MAAA,EAAQ,YAAA;IACR,MAAA,EAAQ,mBAAA;IACR,eAAA;IACA,IAAA,EAAM,IAAA,CAAK,QAAA;IACX,OAAA,EAAS,mBAAA;IACT,QAAA,EAAU,cAAA;EAAA;AAAA;AAAA"}
@@ -0,0 +1,94 @@
1
+ import { Datasource, PrismaConfig as PrismaConfig$1 } from "@prisma/config";
2
+
3
+ //#region src/types/prisma.d.ts
4
+ type MultipleSchemas = Array<[filename: string, content: string]>;
5
+ type SchemaFileInput = string | [filename: string, content: string];
6
+ type ConnectorType = "mysql" | "mongodb" | "sqlite" | "postgresql" | "postgres" | "prisma+postgres" | "sqlserver" | "cockroachdb";
7
+ type ActiveConnectorType = Exclude<ConnectorType, "postgres" | "prisma+postgres">;
8
+ interface EnvValue {
9
+ fromEnvVar: null | string;
10
+ value: null | string;
11
+ }
12
+ interface DataSource {
13
+ name: string;
14
+ provider: ConnectorType;
15
+ activeProvider: ActiveConnectorType;
16
+ url: EnvValue;
17
+ directUrl?: EnvValue;
18
+ schemas: string[] | [];
19
+ sourceFilePath: string;
20
+ }
21
+ interface GetSchemaResponse {
22
+ config: PrismaSchema;
23
+ errors: GetSchemaValidationError[];
24
+ }
25
+ interface EnvValue {
26
+ fromEnvVar: null | string;
27
+ value: null | string;
28
+ }
29
+ interface EnvPaths {
30
+ rootEnvPath: string | null;
31
+ schemaEnvPath: string | undefined;
32
+ }
33
+ interface BinaryTargetsEnvValue {
34
+ fromEnvVar: string | null;
35
+ value: string;
36
+ native?: boolean;
37
+ }
38
+ interface GeneratorConfig {
39
+ name: string;
40
+ output: EnvValue | null;
41
+ isCustomOutput?: boolean;
42
+ provider: EnvValue;
43
+ config: {
44
+ /** `output` is a reserved name and will only be available directly at `generator.output` */output?: never; /** `provider` is a reserved name and will only be available directly at `generator.provider` */
45
+ provider?: never; /** `binaryTargets` is a reserved name and will only be available directly at `generator.binaryTargets` */
46
+ binaryTargets?: never; /** `previewFeatures` is a reserved name and will only be available directly at `generator.previewFeatures` */
47
+ previewFeatures?: never;
48
+ } & {
49
+ [key: string]: string | string[] | undefined;
50
+ };
51
+ binaryTargets: BinaryTargetsEnvValue[];
52
+ previewFeatures: string[];
53
+ envPaths?: EnvPaths;
54
+ sourceFilePath: string;
55
+ }
56
+ type LoadedFile = [path: string, content: string];
57
+ interface PrismaSchema {
58
+ path: string;
59
+ content: string;
60
+ datasources: DataSource[];
61
+ generators: GeneratorConfig[];
62
+ warnings: string[];
63
+ }
64
+ interface GetSchemaValidationError {
65
+ fileName: string | null;
66
+ message: string;
67
+ }
68
+ interface GetSchemaOptions {
69
+ datamodel: SchemaFileInput;
70
+ ignoreEnvVarErrors?: boolean;
71
+ }
72
+ /**
73
+ * A Prisma Config that has been validated w.r.t. the command that is being executed.
74
+ */
75
+ type PrismaConfig = Required<Pick<PrismaConfig$1, "datasource">> & Omit<PrismaConfig$1, "datasource"> & {
76
+ datasource: Required<Pick<Datasource, "url">> & Omit<Datasource, "url">;
77
+ };
78
+ declare type __ΩMultipleSchemas = any[];
79
+ declare type __ΩSchemaFileInput = any[];
80
+ declare type __ΩConnectorType = any[];
81
+ declare type __ΩActiveConnectorType = any[];
82
+ declare type __ΩEnvValue = any[];
83
+ declare type __ΩDataSource = any[];
84
+ declare type __ΩGetSchemaResponse = any[];
85
+ declare type __ΩEnvPaths = any[];
86
+ declare type __ΩBinaryTargetsEnvValue = any[];
87
+ declare type __ΩGeneratorConfig = any[];
88
+ declare type __ΩLoadedFile = any[];
89
+ declare type __ΩPrismaSchema = any[];
90
+ declare type __ΩGetSchemaOptions = any[];
91
+ declare type __ΩPrismaConfig = any[];
92
+ //#endregion
93
+ export { ActiveConnectorType, BinaryTargetsEnvValue, ConnectorType, DataSource, EnvPaths, EnvValue, GeneratorConfig, GetSchemaOptions, GetSchemaResponse, LoadedFile, MultipleSchemas, PrismaConfig, PrismaSchema, SchemaFileInput, __ΩActiveConnectorType, __ΩBinaryTargetsEnvValue, __ΩConnectorType, __ΩDataSource, __ΩEnvPaths, __ΩEnvValue, __ΩGeneratorConfig, __ΩGetSchemaOptions, __ΩGetSchemaResponse, __ΩLoadedFile, __ΩMultipleSchemas, __ΩPrismaConfig, __ΩPrismaSchema, __ΩSchemaFileInput };
94
+ //# sourceMappingURL=prisma.d.cts.map