prisma-effect-schema 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import { FileSystem } from "@effect/platform";
|
|
9
9
|
import { NodeFileSystem, NodePath } from "@effect/platform-node";
|
|
10
10
|
import { Path } from "@effect/platform/Path";
|
|
11
|
-
import
|
|
11
|
+
import generatorHelper from "@prisma/generator-helper";
|
|
12
12
|
import { Effect, Layer } from "effect";
|
|
13
13
|
var program = Effect.fnUntraced(function* (options) {
|
|
14
14
|
const fs = yield* FileSystem.FileSystem;
|
|
@@ -38,7 +38,7 @@ var program = Effect.fnUntraced(function* (options) {
|
|
|
38
38
|
);
|
|
39
39
|
});
|
|
40
40
|
var PlatformLive = Layer.mergeAll(NodeFileSystem.layer, NodePath.layer);
|
|
41
|
-
generatorHandler({
|
|
41
|
+
generatorHelper.generatorHandler({
|
|
42
42
|
onManifest() {
|
|
43
43
|
return {
|
|
44
44
|
defaultOutput: "./generated/effect-schemas.ts",
|
|
@@ -52,4 +52,4 @@ generatorHandler({
|
|
|
52
52
|
Effect.runPromise
|
|
53
53
|
)
|
|
54
54
|
});
|
|
55
|
-
//# sourceMappingURL=chunk-
|
|
55
|
+
//# sourceMappingURL=chunk-FMT4NBCL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/generator.ts"],"sourcesContent":["/**\n * Prisma Generator Handler\n *\n * This module registers the generator with Prisma and handles the generation lifecycle.\n */\nimport { FileSystem } from \"@effect/platform\";\nimport { NodeFileSystem, NodePath } from \"@effect/platform-node\";\nimport { Path } from \"@effect/platform/Path\";\nimport type { GeneratorOptions } from \"@prisma/generator-helper\";\nimport generatorHelper from \"@prisma/generator-helper\";\nimport { Effect, Layer, Option } from \"effect\";\nimport { parseConfig } from \"./config.js\";\nimport { NoOutputConfiguredError } from \"./errors.js\";\nimport { generate } from \"./generate.js\";\n\n\n\nconst program = Effect.fnUntraced(function* (options: GeneratorOptions) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path;\n\n const outputPath = yield* Effect.fromNullable(\n options.generator.output?.value\n ).pipe(\n Effect.mapError(\n ({ cause, message, ...rest }) =>\n new NoOutputConfiguredError({\n cause,\n details: message,\n ...rest,\n })\n )\n );\n\n const config = yield* parseConfig(options);\n\n const { content, stats } = generate({\n dmmf: options.dmmf,\n config,\n });\n\n // Ensure output directory exists\n yield* fs.makeDirectory(path.dirname(outputPath), { recursive: true });\n\n // Write the generated file\n yield* fs.writeFileString(outputPath, content);\n\n yield* Effect.logInfo(`✅ prisma-effect-schema: Generated Effect Schemas`);\n yield* Effect.logInfo(` Output: ${outputPath}`);\n yield* Effect.logInfo(\n ` Stats: ${stats.enumCount} enums, ${stats.modelCount} models, ${stats.brandedIdCount} branded IDs`\n );\n})\nconst PlatformLive = Layer.mergeAll(NodeFileSystem.layer, NodePath.layer);\n\n\n\n// Register as Prisma generator\ngeneratorHelper.generatorHandler({\n onManifest() {\n return {\n defaultOutput: \"./generated/effect-schemas.ts\",\n prettyName: \"Effect Schema Generator\",\n // No requiresGenerators - we only need the DMMF which is always available\n // ?? explain\n };\n },\n onGenerate: (options: GeneratorOptions) => program(options).pipe(\n Effect.provide(PlatformLive),\n Effect.runPromise\n ),\n});\n"],"mappings":";;;;;;;AAKA,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB,gBAAgB;AACzC,SAAS,YAAY;AAErB,OAAO,qBAAqB;AAC5B,SAAS,QAAQ,aAAqB;AAOtC,IAAM,UAAU,OAAO,WAAW,WAAW,SAA2B;AACtE,QAAM,KAAK,OAAO,WAAW;AAC7B,QAAM,OAAO,OAAO;AAEpB,QAAM,aAAa,OAAO,OAAO;AAAA,IAC/B,QAAQ,UAAU,QAAQ;AAAA,EAC5B,EAAE;AAAA,IACA,OAAO;AAAA,MACL,CAAC,EAAE,OAAO,SAAS,GAAG,KAAK,MACzB,IAAI,wBAAwB;AAAA,QAC1B;AAAA,QACA,SAAS;AAAA,QACT,GAAG;AAAA,MACL,CAAC;AAAA,IACL;AAAA,EACF;AAEA,QAAM,SAAS,OAAO,YAAY,OAAO;AAEzC,QAAM,EAAE,SAAS,MAAM,IAAI,SAAS;AAAA,IAClC,MAAM,QAAQ;AAAA,IACd;AAAA,EACF,CAAC;AAGD,SAAO,GAAG,cAAc,KAAK,QAAQ,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;AAGrE,SAAO,GAAG,gBAAgB,YAAY,OAAO;AAE7C,SAAO,OAAO,QAAQ,uDAAkD;AACxE,SAAO,OAAO,QAAQ,cAAc,UAAU,EAAE;AAChD,SAAO,OAAO;AAAA,IACZ,aAAa,MAAM,SAAS,WAAW,MAAM,UAAU,YAAY,MAAM,cAAc;AAAA,EACzF;AACF,CAAC;AACD,IAAM,eAAe,MAAM,SAAS,eAAe,OAAO,SAAS,KAAK;AAKxE,gBAAgB,iBAAiB;AAAA,EAC/B,aAAa;AACX,WAAO;AAAA,MACL,eAAe;AAAA,MACf,YAAY;AAAA;AAAA;AAAA,IAGd;AAAA,EACF;AAAA,EACA,YAAY,CAAC,YAA8B,QAAQ,OAAO,EAAE;AAAA,IAC1D,OAAO,QAAQ,YAAY;AAAA,IAC3B,OAAO;AAAA,EACT;AACF,CAAC;","names":[]}
|
package/dist/generator.js
CHANGED
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generator.ts"],"sourcesContent":["/**\n * Prisma Generator Handler\n *\n * This module registers the generator with Prisma and handles the generation lifecycle.\n */\nimport { FileSystem } from \"@effect/platform\";\nimport { NodeFileSystem, NodePath } from \"@effect/platform-node\";\nimport { Path } from \"@effect/platform/Path\";\nimport type { GeneratorOptions } from \"@prisma/generator-helper\";\nimport { generatorHandler } from \"@prisma/generator-helper\";\nimport { Effect, Layer, Option } from \"effect\";\nimport { parseConfig } from \"./config.js\";\nimport { NoOutputConfiguredError } from \"./errors.js\";\nimport { generate } from \"./generate.js\";\n\n\n\nconst program = Effect.fnUntraced(function* (options: GeneratorOptions) {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path;\n\n const outputPath = yield* Effect.fromNullable(\n options.generator.output?.value\n ).pipe(\n Effect.mapError(\n ({ cause, message, ...rest }) =>\n new NoOutputConfiguredError({\n cause,\n details: message,\n ...rest,\n })\n )\n );\n\n const config = yield* parseConfig(options);\n\n const { content, stats } = generate({\n dmmf: options.dmmf,\n config,\n });\n\n // Ensure output directory exists\n yield* fs.makeDirectory(path.dirname(outputPath), { recursive: true });\n\n // Write the generated file\n yield* fs.writeFileString(outputPath, content);\n\n yield* Effect.logInfo(`✅ prisma-effect-schema: Generated Effect Schemas`);\n yield* Effect.logInfo(` Output: ${outputPath}`);\n yield* Effect.logInfo(\n ` Stats: ${stats.enumCount} enums, ${stats.modelCount} models, ${stats.brandedIdCount} branded IDs`\n );\n})\nconst PlatformLive = Layer.mergeAll(NodeFileSystem.layer, NodePath.layer);\n\n\n\n// Register as Prisma generator\ngeneratorHandler({\n onManifest() {\n return {\n defaultOutput: \"./generated/effect-schemas.ts\",\n prettyName: \"Effect Schema Generator\",\n // No requiresGenerators - we only need the DMMF which is always available\n // ?? explain\n };\n },\n onGenerate: (options: GeneratorOptions) => program(options).pipe(\n Effect.provide(PlatformLive),\n Effect.runPromise\n ),\n});\n"],"mappings":";;;;;;;AAKA,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB,gBAAgB;AACzC,SAAS,YAAY;AAErB,SAAS,wBAAwB;AACjC,SAAS,QAAQ,aAAqB;AAOtC,IAAM,UAAU,OAAO,WAAW,WAAW,SAA2B;AACtE,QAAM,KAAK,OAAO,WAAW;AAC7B,QAAM,OAAO,OAAO;AAEpB,QAAM,aAAa,OAAO,OAAO;AAAA,IAC/B,QAAQ,UAAU,QAAQ;AAAA,EAC5B,EAAE;AAAA,IACA,OAAO;AAAA,MACL,CAAC,EAAE,OAAO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