@powerlines/plugin-prisma 0.4.97 → 0.4.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/client-generator-BPOZ7qom.mjs +146 -0
  2. package/dist/client-generator-BbD4cN4U.mjs +146 -0
  3. package/dist/client-generator-Cg0sxjJx.cjs +152 -0
  4. package/dist/client-generator-ClKJ4yN9.cjs +152 -0
  5. package/dist/get-schema-OhMkdmwI.cjs +138 -0
  6. package/dist/helpers/client-generator.cjs +2 -143
  7. package/dist/helpers/client-generator.mjs +2 -143
  8. package/dist/helpers/get-schema.cjs +2 -100
  9. package/dist/helpers/get-schema.mjs +1 -2
  10. package/dist/helpers/index.cjs +4 -4
  11. package/dist/helpers/index.mjs +1 -1
  12. package/dist/helpers/schema-creator.cjs +1 -1
  13. package/dist/helpers/schema-creator.mjs +1 -2
  14. package/dist/helpers/typed-sql.cjs +1 -1
  15. package/dist/helpers/typed-sql.mjs +1 -2
  16. package/dist/index.cjs +8 -9
  17. package/dist/index.mjs +2 -3
  18. package/dist/types/index.cjs +2 -0
  19. package/dist/types/index.mjs +3 -0
  20. package/package.json +5 -5
  21. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  22. package/dist/helpers/client-generator.d.cts +0 -17
  23. package/dist/helpers/client-generator.d.cts.map +0 -1
  24. package/dist/helpers/client-generator.d.mts +0 -17
  25. package/dist/helpers/client-generator.d.mts.map +0 -1
  26. package/dist/helpers/client-generator.mjs.map +0 -1
  27. package/dist/helpers/get-schema.d.cts +0 -13
  28. package/dist/helpers/get-schema.d.cts.map +0 -1
  29. package/dist/helpers/get-schema.d.mts +0 -13
  30. package/dist/helpers/get-schema.d.mts.map +0 -1
  31. package/dist/helpers/get-schema.mjs.map +0 -1
  32. package/dist/helpers/index.d.cts +0 -5
  33. package/dist/helpers/index.d.mts +0 -5
  34. package/dist/helpers/schema-creator.d.cts +0 -20
  35. package/dist/helpers/schema-creator.d.cts.map +0 -1
  36. package/dist/helpers/schema-creator.d.mts +0 -20
  37. package/dist/helpers/schema-creator.d.mts.map +0 -1
  38. package/dist/helpers/schema-creator.mjs.map +0 -1
  39. package/dist/helpers/typed-sql.d.cts +0 -7
  40. package/dist/helpers/typed-sql.d.cts.map +0 -1
  41. package/dist/helpers/typed-sql.d.mts +0 -7
  42. package/dist/helpers/typed-sql.d.mts.map +0 -1
  43. package/dist/helpers/typed-sql.mjs.map +0 -1
  44. package/dist/index.d.cts +0 -20
  45. package/dist/index.d.cts.map +0 -1
  46. package/dist/index.d.mts +0 -20
  47. package/dist/index.d.mts.map +0 -1
  48. package/dist/index.mjs.map +0 -1
  49. package/dist/package.cjs +0 -11
  50. package/dist/package.mjs +0 -6
  51. package/dist/package.mjs.map +0 -1
  52. package/dist/types/index.d.cts +0 -3
  53. package/dist/types/index.d.mts +0 -3
  54. package/dist/types/plugin.d.cts +0 -111
  55. package/dist/types/plugin.d.cts.map +0 -1
  56. package/dist/types/plugin.d.mts +0 -111
  57. package/dist/types/plugin.d.mts.map +0 -1
  58. package/dist/types/prisma.d.cts +0 -94
  59. package/dist/types/prisma.d.cts.map +0 -1
  60. package/dist/types/prisma.d.mts +0 -94
  61. package/dist/types/prisma.d.mts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-prisma",
3
- "version": "0.4.97",
3
+ "version": "0.4.98",
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"],
@@ -174,7 +174,7 @@
174
174
  "typings": "dist/index.d.mts",
175
175
  "files": ["dist/**/*"],
176
176
  "dependencies": {
177
- "@powerlines/plugin-pulumi": "^0.6.56",
177
+ "@powerlines/plugin-pulumi": "^0.6.57",
178
178
  "@prisma/client-generator-registry": "7.6.0",
179
179
  "@prisma/config": "7.6.0",
180
180
  "@prisma/dmmf": "7.6.0",
@@ -192,16 +192,16 @@
192
192
  "defu": "^6.1.7",
193
193
  "fp-ts": "^2.16.11",
194
194
  "jiti": "^2.6.1",
195
- "powerlines": "^0.43.14",
195
+ "powerlines": "^0.43.15",
196
196
  "prisma-util": "^2.1.1",
197
197
  "ts-pattern": "^5.9.0"
198
198
  },
199
199
  "devDependencies": {
200
- "@powerlines/plugin-plugin": "^0.12.366",
200
+ "@powerlines/plugin-plugin": "^0.12.367",
201
201
  "@prisma/client-generator-ts": "7.6.0",
202
202
  "@pulumi/pulumi": "^3.232.0",
203
203
  "@types/node": "^25.6.0"
204
204
  },
205
205
  "publishConfig": { "access": "public" },
206
- "gitHead": "026a6f082ae5efe2fe607e3ba27eebdf01db89e0"
206
+ "gitHead": "3b60f6ae9f98a85ba4d1b3b0cad61c77d5ab590f"
207
207
  }
@@ -1,29 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
-
27
- //#endregion
28
-
29
- exports.__toESM = __toESM;
@@ -1,17 +0,0 @@
1
- import { PrismaPluginContext } from "../types/plugin.cjs";
2
- import { GeneratorConfig, GeneratorManifest } from "@prisma/generator";
3
-
4
- //#region src/helpers/client-generator.d.ts
5
- declare class PowerlinesClientGenerator {
6
- #private;
7
- protected readonly context: PrismaPluginContext;
8
- readonly name = "powerlines-client";
9
- constructor(context: PrismaPluginContext);
10
- getManifest(_config: GeneratorConfig): Promise<GeneratorManifest>;
11
- generate(): Promise<void>;
12
- stop(): void;
13
- private writeFileMap;
14
- }
15
- //#endregion
16
- export { PowerlinesClientGenerator };
17
- //# sourceMappingURL=client-generator.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-generator.d.cts","names":[],"sources":["../../src/helpers/client-generator.ts"],"mappings":";;;;cAsCa,yBAAA;EAAA;qBAKoB,OAAA,EAAS,mBAAA;EAAA,SAF/B,IAAA;cAEsB,OAAA,EAAS,mBAAA;EAY3B,WAAA,CACX,OAAA,EAAS,eAAA,GACR,OAAA,CAAQ,iBAAA;EAUE,QAAA,CAAA,GAAY,OAAA;EA8HlB,IAAA,CAAA;EAAA,QAEO,YAAA;AAAA"}
@@ -1,17 +0,0 @@
1
- import { PrismaPluginContext } from "../types/plugin.mjs";
2
- import { GeneratorConfig, GeneratorManifest } from "@prisma/generator";
3
-
4
- //#region src/helpers/client-generator.d.ts
5
- declare class PowerlinesClientGenerator {
6
- #private;
7
- protected readonly context: PrismaPluginContext;
8
- readonly name = "powerlines-client";
9
- constructor(context: PrismaPluginContext);
10
- getManifest(_config: GeneratorConfig): Promise<GeneratorManifest>;
11
- generate(): Promise<void>;
12
- stop(): void;
13
- private writeFileMap;
14
- }
15
- //#endregion
16
- export { PowerlinesClientGenerator };
17
- //# sourceMappingURL=client-generator.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-generator.d.mts","names":[],"sources":["../../src/helpers/client-generator.ts"],"mappings":";;;;cAsCa,yBAAA;EAAA;qBAKoB,OAAA,EAAS,mBAAA;EAAA,SAF/B,IAAA;cAEsB,OAAA,EAAS,mBAAA;EAY3B,WAAA,CACX,OAAA,EAAS,eAAA,GACR,OAAA,CAAQ,iBAAA;EAUE,QAAA,CAAA,GAAY,OAAA;EA8HlB,IAAA,CAAA;EAAA,QAEO,YAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-generator.mjs","names":["#options","clientVersion"],"sources":["../../src/helpers/client-generator.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 { buildClient } from \"@prisma/client-generator-ts\";\nimport { enginesVersion } from \"@prisma/engines-version\";\nimport {\n ActiveConnectorType,\n GeneratorConfig,\n GeneratorManifest\n} from \"@prisma/generator\";\nimport { bufferToString } from \"@stryke/convert/buffer-to-string\";\nimport { findFileExtension } from \"@stryke/path/find\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { isBuffer } from \"@stryke/type-checks/is-buffer\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { Buffer } from \"node:buffer\";\nimport { version as clientVersion } from \"../../package.json\";\nimport type { PrismaPluginContext } from \"../types/plugin\";\n\ninterface FileMap {\n [key: string]: string | Buffer | FileMap;\n}\n\nexport class PowerlinesClientGenerator {\n #options: GeneratorConfig;\n\n readonly name = \"powerlines-client\";\n\n constructor(protected readonly context: PrismaPluginContext) {\n this.#options = {\n name: this.name,\n output: null,\n config: {},\n provider: { fromEnvVar: \"POWERLINES_CLIENT_PROVIDER\", value: this.name },\n binaryTargets: [],\n previewFeatures: this.context.prisma.previewFeatures,\n sourceFilePath: this.context.prisma.schema.schemaRootDir\n };\n }\n\n public async getManifest(\n _config: GeneratorConfig\n ): Promise<GeneratorManifest> {\n return Promise.resolve({\n defaultOutput: \"./generated\",\n prettyName: \"Powerlines Client\",\n version: clientVersion,\n requiresEngines: [],\n requiresEngineVersion: enginesVersion\n });\n }\n\n public async generate(): Promise<void> {\n const { prismaClientDmmf, fileMap } = buildClient({\n datamodel: this.context.prisma.schema.schemas\n .map(s => s.content)\n .join(\"\\n\"),\n schemaPath: this.context.prisma.schema.schemaPath,\n binaryPaths: {},\n datasources: this.context.prisma.schema.datasources,\n outputDir: this.context.config.prisma.outputPath,\n runtimeBase: \"@prisma/client/runtime\",\n dmmf: this.context.prisma.dmmf,\n generator: this.#options,\n engineVersion: enginesVersion,\n clientVersion,\n activeProvider: this.context.prisma.schema.primaryDatasource\n ?.activeProvider as ActiveConnectorType,\n typedSql: this.context.prisma.typedSql,\n target: this.context.config.prisma.runtime,\n generatedFileExtension: \"ts\",\n importFileExtension: \"ts\",\n moduleFormat: \"esm\",\n tsNoCheckPreamble: true,\n compilerBuild: \"fast\"\n });\n\n const errorArray = [] as Error[];\n\n const denylists = {\n models: [\n // Reserved Prisma keywords\n \"PrismaClient\",\n \"Prisma\",\n // JavaScript keywords\n \"async\",\n \"await\",\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"delete\",\n \"do\",\n \"else\",\n \"enum\",\n \"export\",\n \"extends\",\n \"false\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"implements\",\n \"import\",\n \"in\",\n \"instanceof\",\n \"interface\",\n \"let\",\n \"new\",\n \"null\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"return\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"true\",\n \"try\",\n \"using\",\n \"typeof\",\n \"var\",\n \"void\",\n \"while\",\n \"with\",\n \"yield\"\n ],\n fields: [\"AND\", \"OR\", \"NOT\"],\n dynamic: []\n };\n\n if (prismaClientDmmf.datamodel.enums) {\n for (const it of prismaClientDmmf.datamodel.enums) {\n if (\n denylists.models.includes(it.name) ||\n denylists.fields.includes(it.name)\n ) {\n errorArray.push(new Error(`\"enum ${it.name}\"`));\n }\n }\n }\n\n if (prismaClientDmmf.datamodel.models) {\n for (const it of prismaClientDmmf.datamodel.models) {\n if (\n denylists.models.includes(it.name) ||\n denylists.fields.includes(it.name)\n ) {\n errorArray.push(new Error(`\"model ${it.name}\"`));\n }\n }\n }\n\n if (errorArray.length > 0) {\n let message = `Error: The schema at \"${\n this.context.prisma.schema.schemaPath\n }\" contains reserved keywords.\\n Rename the following items:`;\n\n for (const error of errorArray) {\n message += `\\n - ${error.message}`;\n }\n\n throw new Error(\n `${\n message\n }\\nTo learn more about how to rename models, check out https://pris.ly/d/naming-models`\n );\n }\n\n await this.writeFileMap(fileMap);\n }\n\n public stop() {}\n\n private async writeFileMap(fileMap: FileMap) {\n return Promise.all(\n Object.entries(fileMap).map(async ([fileName, content]) => {\n if (isString(content)) {\n this.context.emitBuiltinSync(\n content,\n `prisma/${replaceExtension(fileName)}`,\n {\n extension: findFileExtension(fileName) || \"ts\"\n }\n );\n } else if (isBuffer(content)) {\n this.context.emitBuiltinSync(\n bufferToString(content),\n `prisma/${replaceExtension(fileName)}`,\n {\n extension: findFileExtension(fileName) || \"ts\"\n }\n );\n } else {\n await this.writeFileMap(content);\n }\n })\n );\n }\n}\n"],"mappings":";;;;;;;;;;AAsCA,IAAa,4BAAb,MAAuC;CACrC;CAEA,AAAS,OAAO;CAEhB,YAAY,AAAmB,SAA8B;EAA9B;AAC7B,QAAKA,UAAW;GACd,MAAM,KAAK;GACX,QAAQ;GACR,QAAQ,EAAE;GACV,UAAU;IAAE,YAAY;IAA8B,OAAO,KAAK;IAAM;GACxE,eAAe,EAAE;GACjB,iBAAiB,KAAK,QAAQ,OAAO;GACrC,gBAAgB,KAAK,QAAQ,OAAO,OAAO;GAC5C;;CAGH,MAAa,YACX,SA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I,iBAAiB,UAAU,QAC7B;QAAK,MAAM,MAAM,iBAAiB,UAAU,OAC1C,KACE,UAAU,OAAO,SAAS,GAAG,KAAK,IAClC,UAAU,OAAO,SAAS,GAAG,KAAK,CAElC,YAAW,qBAAK,IAAI,MAAM,UAAU,GAAG,KAAK,GAAG,CAAC;;AAKtD,MAAI,WAAW,SAAS,GAAG;GACzB,IAAI,UAAU,yBACZ,KAAK,QAAQ,OAAO,OAAO,WAC5B;AAED,QAAK,MAAM,SAAS,WAClB,YAAW,gBAAgB,MAAM;AAGnC,SAAM,IAAI,MACR,GACE,QACD,uFACF;;AAGH,QAAM,KAAK,aAAa,QAAQ;;CAGlC,AAAO,OAAO;CAEd,MAAc,aAAa,SAAkB;AAC3C,SAAO,QAAQ,IACb,OAAO,QAAQ,QAAQ,CAAC,IAAI,OAAO,CAAC,UAAU,aAAa;AACzD,OAAI,SAAS,QAAQ,CACnB,MAAK,QAAQ,gBACX,SACA,UAAU,iBAAiB,SAAS,IACpC,EACE,WAAW,kBAAkB,SAAS,IAAI,MAC3C,CACF;YACQ,SAAS,QAAQ,CAC1B,MAAK,QAAQ,gBACX,eAAe,QAAQ,EACvB,UAAU,iBAAiB,SAAS,IACpC,EACE,WAAW,kBAAkB,SAAS,IAAI,MAC3C,CACF;OAED,OAAM,KAAK,aAAa,QAAQ;IAElC,CACH"}
@@ -1,13 +0,0 @@
1
- import { PrismaSchema } from "../types/prisma.cjs";
2
-
3
- //#region src/helpers/get-schema.d.ts
4
- /**
5
- * Retrieves the Prisma schema using the provided path.
6
- *
7
- * @param path - The path to the Prisma schema file.
8
- * @returns The Prisma schema.
9
- */
10
- declare function getSchema(path: string): Promise<PrismaSchema>;
11
- //#endregion
12
- export { getSchema };
13
- //# sourceMappingURL=get-schema.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-schema.d.cts","names":[],"sources":["../../src/helpers/get-schema.ts"],"mappings":";;;;;AA2JA;;;;iBAAsB,SAAA,CAAU,IAAA,WAAe,OAAA,CAAQ,YAAA"}
@@ -1,13 +0,0 @@
1
- import { PrismaSchema } from "../types/prisma.mjs";
2
-
3
- //#region src/helpers/get-schema.d.ts
4
- /**
5
- * Retrieves the Prisma schema using the provided path.
6
- *
7
- * @param path - The path to the Prisma schema file.
8
- * @returns The Prisma schema.
9
- */
10
- declare function getSchema(path: string): Promise<PrismaSchema>;
11
- //#endregion
12
- export { getSchema };
13
- //# sourceMappingURL=get-schema.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-schema.d.mts","names":[],"sources":["../../src/helpers/get-schema.ts"],"mappings":";;;;;AA2JA;;;;iBAAsB,SAAA,CAAU,IAAA,WAAe,OAAA,CAAQ,YAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-schema.mjs","names":[],"sources":["../../src/helpers/get-schema.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 { getBinaryTargetForCurrentPlatform } from \"@prisma/get-platform\";\nimport prismaSchemaWasm from \"@prisma/prisma-schema-wasm\";\nimport * as E from \"fp-ts/Either\";\nimport { pipe } from \"fp-ts/lib/function\";\nimport { match } from \"ts-pattern\";\nimport {\n GeneratorConfig,\n GetSchemaResponse,\n PrismaSchema\n} from \"../types/prisma\";\n\nasync function resolveBinaryTargets(generator: GeneratorConfig) {\n for (const binaryTarget of generator.binaryTargets) {\n // load the binaryTargets from the env var\n if (binaryTarget.fromEnvVar && process.env[binaryTarget.fromEnvVar]) {\n const value = JSON.parse(process.env[binaryTarget.fromEnvVar]!);\n\n if (Array.isArray(value)) {\n generator.binaryTargets = value.map(v => ({\n fromEnvVar: null,\n value: v\n }));\n await resolveBinaryTargets(generator); // resolve again if we have native\n } else {\n binaryTarget.value = value;\n }\n }\n\n // resolve native to the current platform\n if (binaryTarget.value === \"native\") {\n binaryTarget.value = await getBinaryTargetForCurrentPlatform();\n binaryTarget.native = true;\n }\n }\n\n if (generator.binaryTargets.length === 0) {\n generator.binaryTargets = [\n {\n fromEnvVar: null,\n value: await getBinaryTargetForCurrentPlatform(),\n native: true\n }\n ];\n }\n}\n\n/**\n * Retrieves the Prisma schema using the provided options.\n *\n * @param schemaPath - The path to the Prisma schema file.\n * @returns The Prisma schema.\n */\nasync function resolveDataModel(schemaPath: string) {\n const configEither = pipe(\n E.tryCatch(\n () => {\n if (process.env.FORCE_PANIC_QUERY_ENGINE_GET_CONFIG) {\n prismaSchemaWasm.debug_panic();\n }\n\n const params = JSON.stringify({\n prismaSchema: schemaPath,\n datasourceOverrides: {},\n ignoreEnvVarErrors: true,\n env: process.env\n });\n\n const data = prismaSchemaWasm.get_config(params);\n\n return data;\n },\n e => ({\n type: \"wasm-error\" as const,\n reason: \"(get-config wasm)\",\n error: e as Error\n })\n ),\n E.map(result => ({ result })),\n E.chainW(({ result }) =>\n // NOTE: this should never fail, as we expect returned values to be valid JSON-serializable strings\n E.tryCatch(\n () => JSON.parse(result) as GetSchemaResponse,\n e => ({\n type: \"parse-json\" as const,\n reason: \"Unable to parse JSON\",\n error: e as Error\n })\n )\n ),\n E.chainW(response => {\n if (response.errors.length > 0) {\n return E.left({\n type: \"validation-error\" as const,\n reason: \"(get-config wasm)\",\n error: response.errors\n });\n }\n return E.right(response.config);\n })\n );\n\n if (E.isRight(configEither)) {\n const { right: data } = configEither;\n\n for (const generator of data.generators) {\n await resolveBinaryTargets(generator);\n }\n\n return Promise.resolve(data);\n }\n\n throw match(configEither.left)\n .with({ type: \"wasm-error\" }, e => {\n return new Error(\n `Prisma get-config Wasm runtime error: ${e.error.message}`\n );\n })\n .with({ type: \"validation-error\" }, e => {\n return new Error(\n `Prisma get-config validation error: ${e.error\n .map(err => err.message)\n .join(\", \")}`\n );\n })\n .otherwise(e => {\n return new Error(\n `Prisma get-config unknown error: ${e.reason} - ${e.error.message}`\n );\n });\n}\n\n/**\n * Retrieves the Prisma schema using the provided path.\n *\n * @param path - The path to the Prisma schema file.\n * @returns The Prisma schema.\n */\nexport async function getSchema(path: string): Promise<PrismaSchema> {\n const schema = {\n path,\n content: \"\",\n generators: [],\n datasources: [],\n warnings: []\n } as PrismaSchema;\n\n const dataModel = await resolveDataModel(path);\n\n return { ...schema, ...dataModel };\n}\n"],"mappings":";;;;;;;AA6BA,eAAe,qBAAqB,WAA4B;AAC9D,MAAK,MAAM,gBAAgB,UAAU,eAAe;AAElD,MAAI,aAAa,cAAc,QAAQ,IAAI,aAAa,aAAa;GACnE,MAAM,QAAQ,KAAK,MAAM,QAAQ,IAAI,aAAa,YAAa;AAE/D,OAAI,MAAM,QAAQ,MAAM,EAAE;AACxB,cAAU,gBAAgB,MAAM,KAAI,OAAM;KACxC,YAAY;KACZ,OAAO;KACR,EAAE;AACH,UAAM,qBAAqB,UAAU;SAErC,cAAa,QAAQ;;AAKzB,MAAI,aAAa,UAAU,UAAU;AACnC,gBAAa,QAAQ,MAAM,mCAAmC;AAC9D,gBAAa,SAAS;;;AAI1B,KAAI,UAAU,cAAc,WAAW,EACrC,WAAU,gBAAgB,CACxB;EACE,YAAY;EACZ,OAAO,MAAM,mCAAmC;EAChD,QAAQ;EACT,CACF;;;;;;;;AAUL,eAAe,iBAAiB,YAAoB;CAClD,MAAM,eAAe,KACnB,EAAE,eACM;AACJ,MAAI,QAAQ,IAAI,oCACd,kBAAiB,aAAa;EAGhC,MAAM,SAAS,KAAK,UAAU;GAC5B,cAAc;GACd,qBAAqB,EAAE;GACvB,oBAAoB;GACpB,KAAK,QAAQ;GACd,CAAC;AAIF,SAFa,iBAAiB,WAAW,OAE9B;KAEb,OAAM;EACJ,MAAM;EACN,QAAQ;EACR,OAAO;EACR,EACF,EACD,EAAE,KAAI,YAAW,EAAE,QAAQ,EAAE,EAC7B,EAAE,QAAQ,EAAE,aAEV,EAAE,eACM,KAAK,MAAM,OAAO,GACxB,OAAM;EACJ,MAAM;EACN,QAAQ;EACR,OAAO;EACR,EACF,CACF,EACD,EAAE,QAAO,aAAY;AACnB,MAAI,SAAS,OAAO,SAAS,EAC3B,QAAO,EAAE,KAAK;GACZ,MAAM;GACN,QAAQ;GACR,OAAO,SAAS;GACjB,CAAC;AAEJ,SAAO,EAAE,MAAM,SAAS,OAAO;GAC/B,CACH;AAED,KAAI,EAAE,QAAQ,aAAa,EAAE;EAC3B,MAAM,EAAE,OAAO,SAAS;AAExB,OAAK,MAAM,aAAa,KAAK,WAC3B,OAAM,qBAAqB,UAAU;AAGvC,SAAO,QAAQ,QAAQ,KAAK;;AAG9B,OAAM,MAAM,aAAa,KAAK,CAC3B,KAAK,EAAE,MAAM,cAAc,GAAE,MAAK;AACjC,yBAAO,IAAI,MACT,yCAAyC,EAAE,MAAM,UAClD;GACD,CACD,KAAK,EAAE,MAAM,oBAAoB,GAAE,MAAK;AACvC,yBAAO,IAAI,MACT,uCAAuC,EAAE,MACtC,KAAI,QAAO,IAAI,QAAQ,CACvB,KAAK,KAAK,GACd;GACD,CACD,WAAU,MAAK;AACd,yBAAO,IAAI,MACT,oCAAoC,EAAE,OAAO,KAAK,EAAE,MAAM,UAC3D;GACD;;;;;;;;AASN,eAAsB,UAAU,MAAqC;CACnE,MAAM,SAAS;EACb;EACA,SAAS;EACT,YAAY,EAAE;EACd,aAAa,EAAE;EACf,UAAU,EAAE;EACb;CAED,MAAM,YAAY,MAAM,iBAAiB,KAAK;AAE9C,QAAO;EAAE,GAAG;EAAQ,GAAG;EAAW"}
@@ -1,5 +0,0 @@
1
- import { PrismaSchemaCreator } from "./schema-creator.cjs";
2
- import { PowerlinesClientGenerator } from "./client-generator.cjs";
3
- import { getSchema } from "./get-schema.cjs";
4
- import { introspectSql } from "./typed-sql.cjs";
5
- export { PowerlinesClientGenerator, PrismaSchemaCreator, getSchema, introspectSql };
@@ -1,5 +0,0 @@
1
- import { PrismaSchemaCreator } from "./schema-creator.mjs";
2
- import { PowerlinesClientGenerator } from "./client-generator.mjs";
3
- import { getSchema } from "./get-schema.mjs";
4
- import { introspectSql } from "./typed-sql.mjs";
5
- export { PowerlinesClientGenerator, PrismaSchemaCreator, getSchema, introspectSql };
@@ -1,20 +0,0 @@
1
- import { GeneratorConfig } from "../types/prisma.cjs";
2
- import { PrismaPluginContext } from "../types/plugin.cjs";
3
- import { SchemaCreator } from "prisma-util/schema-creator";
4
-
5
- //#region src/helpers/schema-creator.d.ts
6
- /**
7
- * Prisma schema creator that allows building a schema via code.
8
- */
9
- declare class PrismaSchemaCreator extends SchemaCreator {
10
- #private;
11
- private get generators();
12
- private set generators(value);
13
- constructor(context: PrismaPluginContext);
14
- pushGenerator(generator: GeneratorConfig): this;
15
- build(): string;
16
- write(): Promise<void>;
17
- }
18
- //#endregion
19
- export { PrismaSchemaCreator };
20
- //# sourceMappingURL=schema-creator.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-creator.d.cts","names":[],"sources":["../../src/helpers/schema-creator.ts"],"mappings":";;;;;;;AAyBA;cAAa,mBAAA,SAA4B,aAAA;EAAA;cAI3B,UAAA,CAAA;EAAA,YAIA,UAAA,CAAU,KAAA;cAIH,OAAA,EAAS,mBAAA;EAgBrB,aAAA,CAAc,SAAA,EAAW,eAAA;EAahB,KAAA,CAAA;EA0DH,KAAA,CAAA,GAAS,OAAA;AAAA"}
@@ -1,20 +0,0 @@
1
- import { GeneratorConfig } from "../types/prisma.mjs";
2
- import { PrismaPluginContext } from "../types/plugin.mjs";
3
- import { SchemaCreator } from "prisma-util/schema-creator";
4
-
5
- //#region src/helpers/schema-creator.d.ts
6
- /**
7
- * Prisma schema creator that allows building a schema via code.
8
- */
9
- declare class PrismaSchemaCreator extends SchemaCreator {
10
- #private;
11
- private get generators();
12
- private set generators(value);
13
- constructor(context: PrismaPluginContext);
14
- pushGenerator(generator: GeneratorConfig): this;
15
- build(): string;
16
- write(): Promise<void>;
17
- }
18
- //#endregion
19
- export { PrismaSchemaCreator };
20
- //# sourceMappingURL=schema-creator.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-creator.d.mts","names":[],"sources":["../../src/helpers/schema-creator.ts"],"mappings":";;;;;;;AAyBA;cAAa,mBAAA,SAA4B,aAAA;EAAA;cAI3B,UAAA,CAAA;EAAA,YAIA,UAAA,CAAU,KAAA;cAIH,OAAA,EAAS,mBAAA;EAgBrB,aAAA,CAAc,SAAA,EAAW,eAAA;EAahB,KAAA,CAAA;EA0DH,KAAA,CAAA,GAAS,OAAA;AAAA"}
@@ -1 +0,0 @@
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;AAC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BACa,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,7 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"typed-sql.d.cts","names":[],"sources":["../../src/helpers/typed-sql.ts"],"mappings":";;;iBAqEsB,aAAA,CAAc,OAAA,EAAS,mBAAA,GAAmB,OAAA"}
@@ -1,7 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"typed-sql.d.mts","names":[],"sources":["../../src/helpers/typed-sql.ts"],"mappings":";;;iBAqEsB,aAAA,CAAc,OAAA,EAAS,mBAAA,GAAmB,OAAA"}
@@ -1 +0,0 @@
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,OAIA,CAAC,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.d.cts DELETED
@@ -1,20 +0,0 @@
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
@@ -1 +0,0 @@
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"}
package/dist/index.d.mts DELETED
@@ -1,20 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,MAAa,UAGX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@
1
-
2
- //#region package.json
3
- var version = "0.4.97";
4
-
5
- //#endregion
6
- Object.defineProperty(exports, 'version', {
7
- enumerable: true,
8
- get: function () {
9
- return version;
10
- }
11
- });
package/dist/package.mjs DELETED
@@ -1,6 +0,0 @@
1
- //#region package.json
2
- var version = "0.4.97";
3
-
4
- //#endregion
5
- export { version };
6
- //# sourceMappingURL=package.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"package.mjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1,3 +0,0 @@
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 };
@@ -1,3 +0,0 @@
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,111 +0,0 @@
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
@@ -1 +0,0 @@
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"}