@effectify/prisma 0.1.2 → 1.0.0

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 (81) hide show
  1. package/dist/src/cli.d.ts +1 -1
  2. package/dist/src/cli.js +9 -9
  3. package/dist/src/commands/init.d.ts +1 -1
  4. package/dist/src/commands/init.js +0 -2
  5. package/dist/src/commands/prisma.d.ts +5 -0
  6. package/dist/src/commands/prisma.js +35 -0
  7. package/dist/src/generators/sql-schema-generator.d.ts +9 -0
  8. package/dist/src/generators/sql-schema-generator.js +50 -58
  9. package/dist/src/services/generator-context.d.ts +6 -0
  10. package/dist/src/services/generator-context.js +3 -0
  11. package/dist/src/services/generator-service.d.ts +14 -0
  12. package/dist/src/services/generator-service.js +121 -0
  13. package/dist/src/services/render-service.d.ts +10 -0
  14. package/dist/src/services/render-service.js +23 -0
  15. package/dist/src/templates/model.eta +8 -0
  16. package/package.json +15 -11
  17. package/dist/src/commands/generate-effect.d.ts +0 -2
  18. package/dist/src/commands/generate-effect.js +0 -73
  19. package/dist/src/commands/generate-sql-schema.d.ts +0 -2
  20. package/dist/src/commands/generate-sql-schema.js +0 -72
  21. package/dist/src/effect-prisma.d.ts +0 -2
  22. package/dist/src/effect-prisma.js +0 -1771
  23. package/dist/src/generators/prisma-effect-generator.d.ts +0 -1
  24. package/dist/src/generators/prisma-effect-generator.js +0 -446
  25. package/prisma/dev.db +0 -0
  26. package/prisma/generated/client.d.ts +0 -1
  27. package/prisma/generated/client.js +0 -5
  28. package/prisma/generated/default.d.ts +0 -1
  29. package/prisma/generated/default.js +0 -5
  30. package/prisma/generated/edge.d.ts +0 -1
  31. package/prisma/generated/edge.js +0 -141
  32. package/prisma/generated/effect/index.ts +0 -392
  33. package/prisma/generated/effect/models/Todo.ts +0 -6
  34. package/prisma/generated/effect/prisma-repository.ts +0 -954
  35. package/prisma/generated/effect/prisma-schema.ts +0 -94
  36. package/prisma/generated/effect/schemas/enums.ts +0 -6
  37. package/prisma/generated/effect/schemas/index.ts +0 -2
  38. package/prisma/generated/effect/schemas/types.ts +0 -40
  39. package/prisma/generated/index-browser.js +0 -172
  40. package/prisma/generated/index.d.ts +0 -2376
  41. package/prisma/generated/index.js +0 -141
  42. package/prisma/generated/package.json +0 -144
  43. package/prisma/generated/query_compiler_bg.js +0 -2
  44. package/prisma/generated/query_compiler_bg.wasm +0 -0
  45. package/prisma/generated/query_compiler_bg.wasm-base64.js +0 -2
  46. package/prisma/generated/runtime/client.d.ts +0 -3180
  47. package/prisma/generated/runtime/client.js +0 -86
  48. package/prisma/generated/runtime/index-browser.d.ts +0 -87
  49. package/prisma/generated/runtime/index-browser.js +0 -6
  50. package/prisma/generated/runtime/wasm-compiler-edge.js +0 -76
  51. package/prisma/generated/schema.prisma +0 -31
  52. package/prisma/generated/wasm-edge-light-loader.mjs +0 -5
  53. package/prisma/generated/wasm-worker-loader.mjs +0 -5
  54. package/prisma/migrations/20250721164420_init/migration.sql +0 -9
  55. package/prisma/migrations/20250721191716_dumb/migration.sql +0 -49
  56. package/prisma/migrations/migration_lock.toml +0 -3
  57. package/prisma/schema.prisma +0 -31
  58. package/prisma.config.ts +0 -8
  59. package/project.json +0 -48
  60. package/scripts/cleanup-tests.ts +0 -26
  61. package/scripts/generate-test-files.ts +0 -93
  62. package/setup-tests.ts +0 -10
  63. package/src/cli.ts +0 -22
  64. package/src/commands/init.ts +0 -153
  65. package/src/commands/prisma.ts +0 -50
  66. package/src/generators/sql-schema-generator.ts +0 -66
  67. package/src/services/generator-context.ts +0 -4
  68. package/src/services/generator-service.ts +0 -178
  69. package/src/services/render-service.ts +0 -32
  70. package/src/templates/model.eta +0 -6
  71. package/test/prisma-model.test.ts +0 -340
  72. package/test/utils.ts +0 -10
  73. package/tsconfig.json +0 -20
  74. package/tsconfig.lib.json +0 -24
  75. package/tsconfig.spec.json +0 -15
  76. package/vitest.config.ts +0 -24
  77. /package/{src → dist/src}/templates/index-custom-error.eta +0 -0
  78. /package/{src → dist/src}/templates/index-default.eta +0 -0
  79. /package/{src → dist/src}/templates/prisma-raw-sql.eta +0 -0
  80. /package/{src → dist/src}/templates/prisma-repository.eta +0 -0
  81. /package/{src → dist/src}/templates/prisma-schema.eta +0 -0
@@ -1,94 +0,0 @@
1
- /**
2
- * @since 1.0.0
3
- */
4
- import * as Cause from 'effect/Cause'
5
- import * as Effect from 'effect/Effect'
6
- import type * as Option from 'effect/Option'
7
- import type { ParseError } from 'effect/ParseResult'
8
- import * as Schema from 'effect/Schema'
9
-
10
- /**
11
- * Run a sql query with a request schema and a result schema.
12
- *
13
- * @since 1.0.0
14
- * @category constructor
15
- */
16
- export const findAll = <IR, II, IA, AR, AI, A, R, E>(options: {
17
- readonly Request: Schema.Schema<IA, II, IR>
18
- readonly Result: Schema.Schema<A, AI, AR>
19
- readonly execute: (request: II) => Effect.Effect<ReadonlyArray<unknown>, E, R>
20
- }) => {
21
- const encodeRequest = Schema.encode(options.Request)
22
- const decode = Schema.decodeUnknown(Schema.Array(options.Result))
23
- return (request: IA): Effect.Effect<ReadonlyArray<A>, E | ParseError, R | IR | AR> =>
24
- Effect.flatMap(Effect.flatMap(encodeRequest(request), options.execute), decode)
25
- }
26
-
27
- const void_ = <IR, II, IA, R, E>(options: {
28
- readonly Request: Schema.Schema<IA, II, IR>
29
- readonly execute: (request: II) => Effect.Effect<unknown, E, R>
30
- }) => {
31
- const encode = Schema.encode(options.Request)
32
- return (request: IA): Effect.Effect<void, E | ParseError, R | IR> =>
33
- Effect.asVoid(Effect.flatMap(encode(request), options.execute))
34
- }
35
- export {
36
- /**
37
- * Run a sql query with a request schema and discard the result.
38
- *
39
- * @since 1.0.0
40
- * @category constructor
41
- */
42
- void_ as void,
43
- }
44
-
45
- /**
46
- * Run a sql query with a request schema and a result schema and return the first result.
47
- *
48
- * @since 1.0.0
49
- * @category constructor
50
- */
51
- export const findOne = <IR, II, IA, AR, AI, A, R, E>(options: {
52
- readonly Request: Schema.Schema<IA, II, IR>
53
- readonly Result: Schema.Schema<A, AI, AR>
54
- readonly execute: (request: II) => Effect.Effect<ReadonlyArray<unknown>, E, R>
55
- }) => {
56
- const encodeRequest = Schema.encode(options.Request)
57
- const decode = Schema.decodeUnknown(options.Result)
58
- return (request: IA): Effect.Effect<Option.Option<A>, E | ParseError, R | IR | AR> =>
59
- Effect.flatMap(Effect.flatMap(encodeRequest(request), options.execute), (arr) =>
60
- Array.isArray(arr) && arr.length > 0 ? Effect.asSome(decode(arr[0])) : Effect.succeedNone,
61
- )
62
- }
63
-
64
- /**
65
- * Run a sql query with a request schema and a result schema and return the first result.
66
- *
67
- * @since 1.0.0
68
- * @category constructor
69
- */
70
- export const single = <IR, II, IA, AR, AI, A, R, E>(options: {
71
- readonly Request: Schema.Schema<IA, II, IR>
72
- readonly Result: Schema.Schema<A, AI, AR>
73
- readonly execute: (request: II) => Effect.Effect<ReadonlyArray<unknown>, E, R>
74
- }) => {
75
- const encodeRequest = Schema.encode(options.Request)
76
- const decode = Schema.decodeUnknown(options.Result)
77
- return (request: IA): Effect.Effect<A, E | ParseError | Cause.NoSuchElementException, R | IR | AR> =>
78
- Effect.flatMap(
79
- Effect.flatMap(encodeRequest(request), options.execute),
80
- (arr): Effect.Effect<A, ParseError | Cause.NoSuchElementException, AR> =>
81
- Array.isArray(arr) && arr.length > 0 ? decode(arr[0]) : Effect.fail(new Cause.NoSuchElementException()),
82
- )
83
- }
84
-
85
- export const many = <IR, II, IA, AR, AI, A, R, E>(options: {
86
- readonly Request: Schema.Schema<IA, II, IR>
87
- readonly Result: Schema.Schema<A, AI, AR>
88
- readonly execute: (request: II) => Effect.Effect<Array<unknown>, E, R>
89
- }) => {
90
- const encodeRequest = Schema.encode(options.Request)
91
- const decode = Schema.decodeUnknown(Schema.Array(options.Result))
92
- return (request: IA): Effect.Effect<Array<A>, E | ParseError, R | IR | AR> =>
93
- Effect.map(Effect.flatMap(Effect.flatMap(encodeRequest(request), options.execute), decode), (arr) => [...arr])
94
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Generated: 2025-12-22T03:33:11.297Z
3
- * DO NOT EDIT MANUALLY
4
- */
5
-
6
- import { Schema } from 'effect';
@@ -1,2 +0,0 @@
1
- export * from './enums.js';
2
- export * from './types.js';
@@ -1,40 +0,0 @@
1
- /**
2
- * Generated: 2025-12-22T03:33:11.298Z
3
- * DO NOT EDIT MANUALLY
4
- */
5
-
6
- import { Schema } from 'effect';
7
- import type { ColumnType } from 'kysely';
8
- import { columnType, generated, getSchemas } from 'prisma-effect-kysely';
9
-
10
- // Kysely table interface for Todo
11
- export interface TodoTable {
12
- authorId: number;
13
- content: string | null;
14
- id: ColumnType<number, never, never>;
15
- published: ColumnType<boolean, boolean | undefined, boolean | undefined>;
16
- title: string;
17
- }
18
-
19
- // Todo Base Schema
20
- export const _Todo = Schema.Struct({
21
- authorId: Schema.Number,
22
- content: Schema.UndefinedOr(Schema.String),
23
- id: columnType(Schema.Number, Schema.Never, Schema.Never),
24
- published: generated(Schema.Boolean),
25
- title: Schema.String,
26
- });
27
-
28
- export const Todo = getSchemas(_Todo);
29
-
30
- export type TodoSelect = Schema.Schema.Type<typeof Todo.Selectable>;
31
- export type TodoInsert = Schema.Schema.Type<typeof Todo.Insertable>;
32
- export type TodoUpdate = Schema.Schema.Type<typeof Todo.Updateable>;
33
- export type TodoSelectEncoded = Schema.Schema.Encoded<typeof Todo.Selectable>;
34
- export type TodoInsertEncoded = Schema.Schema.Encoded<typeof Todo.Insertable>;
35
- export type TodoUpdateEncoded = Schema.Schema.Encoded<typeof Todo.Updateable>;
36
-
37
- // Kysely Database Interface
38
- export interface DB {
39
- Todo: TodoTable;
40
- }
@@ -1,172 +0,0 @@
1
-
2
- /* !!! This is code generated by Prisma. Do not edit directly. !!!
3
- /* eslint-disable */
4
- // biome-ignore-all lint: generated file
5
-
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
-
8
- const {
9
- Decimal,
10
- DbNull,
11
- JsonNull,
12
- AnyNull,
13
- NullTypes,
14
- makeStrictEnum,
15
- Public,
16
- getRuntime,
17
- skip
18
- } = require('./runtime/index-browser.js')
19
-
20
-
21
- const Prisma = {}
22
-
23
- exports.Prisma = Prisma
24
- exports.$Enums = {}
25
-
26
- /**
27
- * Prisma Client JS version: 7.2.0
28
- * Query Engine version: 0c8ef2ce45c83248ab3df073180d5eda9e8be7a3
29
- */
30
- Prisma.prismaVersion = {
31
- client: "7.2.0",
32
- engine: "0c8ef2ce45c83248ab3df073180d5eda9e8be7a3"
33
- }
34
-
35
- Prisma.PrismaClientKnownRequestError = () => {
36
- const runtimeName = getRuntime().prettyName;
37
- throw new Error(`PrismaClientKnownRequestError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
38
- In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
39
- )};
40
- Prisma.PrismaClientUnknownRequestError = () => {
41
- const runtimeName = getRuntime().prettyName;
42
- throw new Error(`PrismaClientUnknownRequestError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
43
- In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
44
- )}
45
- Prisma.PrismaClientRustPanicError = () => {
46
- const runtimeName = getRuntime().prettyName;
47
- throw new Error(`PrismaClientRustPanicError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
48
- In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
49
- )}
50
- Prisma.PrismaClientInitializationError = () => {
51
- const runtimeName = getRuntime().prettyName;
52
- throw new Error(`PrismaClientInitializationError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
53
- In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
54
- )}
55
- Prisma.PrismaClientValidationError = () => {
56
- const runtimeName = getRuntime().prettyName;
57
- throw new Error(`PrismaClientValidationError is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
58
- In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
59
- )}
60
- Prisma.Decimal = Decimal
61
-
62
- /**
63
- * Re-export of sql-template-tag
64
- */
65
- Prisma.sql = () => {
66
- const runtimeName = getRuntime().prettyName;
67
- throw new Error(`sqltag is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
68
- In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
69
- )}
70
- Prisma.empty = () => {
71
- const runtimeName = getRuntime().prettyName;
72
- throw new Error(`empty is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
73
- In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
74
- )}
75
- Prisma.join = () => {
76
- const runtimeName = getRuntime().prettyName;
77
- throw new Error(`join is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
78
- In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
79
- )}
80
- Prisma.raw = () => {
81
- const runtimeName = getRuntime().prettyName;
82
- throw new Error(`raw is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
83
- In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
84
- )}
85
- Prisma.validator = Public.validator
86
-
87
- /**
88
- * Extensions
89
- */
90
- Prisma.getExtensionContext = () => {
91
- const runtimeName = getRuntime().prettyName;
92
- throw new Error(`Extensions.getExtensionContext is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
93
- In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
94
- )}
95
- Prisma.defineExtension = () => {
96
- const runtimeName = getRuntime().prettyName;
97
- throw new Error(`Extensions.defineExtension is unable to run in this browser environment, or has been bundled for the browser (running in ${runtimeName}).
98
- In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report`,
99
- )}
100
-
101
- /**
102
- * Shorthand utilities for JSON filtering
103
- */
104
- Prisma.DbNull = DbNull
105
- Prisma.JsonNull = JsonNull
106
- Prisma.AnyNull = AnyNull
107
-
108
- Prisma.NullTypes = NullTypes
109
-
110
-
111
-
112
- /**
113
- * Enums
114
- */
115
-
116
- exports.Prisma.TransactionIsolationLevel = makeStrictEnum({
117
- Serializable: 'Serializable'
118
- });
119
-
120
- exports.Prisma.TodoScalarFieldEnum = {
121
- id: 'id',
122
- title: 'title',
123
- content: 'content',
124
- published: 'published',
125
- authorId: 'authorId'
126
- };
127
-
128
- exports.Prisma.SortOrder = {
129
- asc: 'asc',
130
- desc: 'desc'
131
- };
132
-
133
- exports.Prisma.NullsOrder = {
134
- first: 'first',
135
- last: 'last'
136
- };
137
-
138
-
139
- exports.Prisma.ModelName = {
140
- Todo: 'Todo'
141
- };
142
-
143
- /**
144
- * This is a stub Prisma Client that will error at runtime if called.
145
- */
146
- class PrismaClient {
147
- constructor() {
148
- return new Proxy(this, {
149
- get(target, prop) {
150
- let message
151
- const runtime = getRuntime()
152
- if (runtime.isEdge) {
153
- message = `PrismaClient is not configured to run in ${runtime.prettyName}. In order to run Prisma Client on edge runtime, either:
154
- - Use Prisma Accelerate: https://pris.ly/d/accelerate
155
- - Use Driver Adapters: https://pris.ly/d/driver-adapters
156
- `;
157
- } else {
158
- message = 'PrismaClient is unable to run in this browser environment, or has been bundled for the browser (running in `' + runtime.prettyName + '`).'
159
- }
160
-
161
- message += `
162
- If this is unexpected, please open an issue: https://pris.ly/prisma-prisma-bug-report`
163
-
164
- throw new Error(message)
165
- }
166
- })
167
- }
168
- }
169
-
170
- exports.PrismaClient = PrismaClient
171
-
172
- Object.assign(exports, Prisma)