prisma-effect-kysely 1.9.0 → 1.9.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/CHANGELOG.md +120 -0
- package/dist/effect/generator.d.ts +4 -2
- package/dist/effect/generator.d.ts.map +1 -1
- package/dist/effect/generator.js +8 -41
- package/dist/effect/generator.js.map +1 -1
- package/dist/kysely/helpers.d.ts +13 -13
- package/dist/kysely/helpers.d.ts.map +1 -1
- package/dist/kysely/helpers.js +9 -9
- package/dist/kysely/helpers.js.map +1 -1
- package/package.json +2 -4
- package/dist/utils/unsupported-config.d.ts +0 -26
- package/dist/utils/unsupported-config.d.ts.map +0 -1
- package/dist/utils/unsupported-config.js +0 -36
- package/dist/utils/unsupported-config.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,126 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.9.2] - 2025-10-17
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
#### Dependency Configuration
|
|
13
|
+
- **Fixed Effect as peer dependency** to prevent version conflicts and follow best practices
|
|
14
|
+
- **Problem**: `effect` was listed as a regular dependency, causing potential version conflicts in user projects
|
|
15
|
+
- **Solution**: Moved `effect` to `peerDependencies` (required, not optional)
|
|
16
|
+
- **Rationale**:
|
|
17
|
+
- Generated code imports from `effect` package
|
|
18
|
+
- Runtime helpers (`src/kysely/helpers.ts`) export Effect schemas
|
|
19
|
+
- Users need Effect in their projects anyway
|
|
20
|
+
- Follows same pattern as `zod-prisma-types` (Zod as peer dependency)
|
|
21
|
+
- **Impact**: Users must explicitly install `effect` in their projects (most already have it)
|
|
22
|
+
|
|
23
|
+
### Removed
|
|
24
|
+
|
|
25
|
+
#### Unused Dependencies
|
|
26
|
+
- **Removed `@prisma/client` and `@prisma/dmmf`** from dependencies
|
|
27
|
+
- **Analysis**: Code analysis revealed these packages are never imported in the codebase
|
|
28
|
+
- **Impact**: Smaller package size, cleaner dependency tree
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
#### Package Structure
|
|
33
|
+
**Before:**
|
|
34
|
+
```json
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@prisma/client": "6.16.3",
|
|
37
|
+
"@prisma/dmmf": "^6.17.0",
|
|
38
|
+
"@prisma/generator-helper": "^6.17.0",
|
|
39
|
+
"effect": "^3.18.4",
|
|
40
|
+
"prettier": "^3.6.2"
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**After:**
|
|
45
|
+
```json
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@prisma/generator-helper": "^6.17.0",
|
|
48
|
+
"prettier": "^3.6.2"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"effect": "^3.18.4",
|
|
52
|
+
"kysely": "^0.28.0"
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Migration Guide
|
|
57
|
+
|
|
58
|
+
**For New Users:**
|
|
59
|
+
- Install Effect explicitly: `npm install effect` or `pnpm install effect`
|
|
60
|
+
|
|
61
|
+
**For Existing Users:**
|
|
62
|
+
- If you already have `effect` installed: No action needed
|
|
63
|
+
- If you don't have `effect`: Run `npm install effect` or `pnpm install effect`
|
|
64
|
+
- npm 7+ will automatically install peer dependencies
|
|
65
|
+
|
|
66
|
+
**Benefits:**
|
|
67
|
+
- ✅ Prevents Effect version conflicts between your project and the generator
|
|
68
|
+
- ✅ You control which Effect version to use
|
|
69
|
+
- ✅ Smaller package size (removed unused dependencies)
|
|
70
|
+
- ✅ Follows industry best practices for library dependencies
|
|
71
|
+
|
|
72
|
+
## [1.9.1] - 2025-10-17
|
|
73
|
+
|
|
74
|
+
### Fixed
|
|
75
|
+
|
|
76
|
+
#### TypeScript Schema [TypeId] Preservation Bug
|
|
77
|
+
- **Fixed `generated()` and `columnType()` helpers losing Schema [TypeId] symbol**
|
|
78
|
+
- **Problem**: Helpers returned result of `.annotations()` directly, causing TypeScript compilation errors in generated code: `Property '[TypeId]' is missing in type 'typeof Date$'`
|
|
79
|
+
- **Root Cause**: `.annotations()` doesn't automatically preserve Schema type for TypeScript's type system without explicit wrapping
|
|
80
|
+
- **Solution**:
|
|
81
|
+
- Added explicit return type annotations: `: Schema.Schema<T, E, R>`
|
|
82
|
+
- Wrapped results with `Schema.asSchema()` to preserve [TypeId] symbol
|
|
83
|
+
- **Impact**: All generated code using `generated(Schema.Date)` or `columnType(Schema.UUID, ...)` now compiles correctly in downstream projects
|
|
84
|
+
- **Files Modified**:
|
|
85
|
+
- `src/kysely/helpers.ts:23-35` (columnType fix)
|
|
86
|
+
- `src/kysely/helpers.ts:45-48` (generated fix)
|
|
87
|
+
|
|
88
|
+
### Added
|
|
89
|
+
|
|
90
|
+
#### Enhanced Test Coverage for Type Safety
|
|
91
|
+
- **Added TypeScript compile-time validation tests** to prevent future regressions
|
|
92
|
+
- Type assertions that fail at compile-time if Schema types lose [TypeId]
|
|
93
|
+
- Runtime validation using `Schema.isSchema()` checks
|
|
94
|
+
- Generation validation to ensure correct helper usage in generated code
|
|
95
|
+
- **Test Files Enhanced**:
|
|
96
|
+
- `src/__tests__/effect-schema.test.ts`: Added "TypeScript Type Safety" test suite (3 tests)
|
|
97
|
+
- `src/__tests__/code-generation.test.ts`: Added "Generated Code TypeScript Compilation" test (1 test)
|
|
98
|
+
- **Test Suite Consolidation**: Reduced from 14 files to 7 files while maintaining 139 passing tests
|
|
99
|
+
- Eliminated duplicate test coverage
|
|
100
|
+
- Grouped tests by functional domain
|
|
101
|
+
- Improved maintainability and clarity
|
|
102
|
+
|
|
103
|
+
### Technical Details
|
|
104
|
+
|
|
105
|
+
**Why the Bug Occurred**:
|
|
106
|
+
- Effect Schema's `.annotations()` method creates a new schema with modified annotations
|
|
107
|
+
- TypeScript's type inference doesn't automatically preserve the `Schema<T>` type with its `[TypeId]` symbol
|
|
108
|
+
- Without `Schema.asSchema()` wrapper, TypeScript sees the result as a plain object losing Schema type information
|
|
109
|
+
|
|
110
|
+
**Prevention Strategy**:
|
|
111
|
+
- Always use explicit return types for functions returning schemas
|
|
112
|
+
- Always wrap `.annotations()` results with `Schema.asSchema()`
|
|
113
|
+
- Include both compile-time type assertions AND runtime validation in tests
|
|
114
|
+
|
|
115
|
+
**Example Fix**:
|
|
116
|
+
```typescript
|
|
117
|
+
// Before (incorrect):
|
|
118
|
+
export const generated = <T>(schema: Schema.Schema<T>) => {
|
|
119
|
+
return schema.annotations({ [GeneratedId]: true });
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// After (correct):
|
|
123
|
+
export const generated = <T>(schema: Schema.Schema<T>): Schema.Schema<T> => {
|
|
124
|
+
return Schema.asSchema(schema.annotations({ [GeneratedId]: true }));
|
|
125
|
+
};
|
|
126
|
+
```
|
|
127
|
+
|
|
8
128
|
## [1.9.0] - 2025-10-13
|
|
9
129
|
|
|
10
130
|
### Fixed
|
|
@@ -19,9 +19,11 @@ export declare class EffectGenerator {
|
|
|
19
19
|
*/
|
|
20
20
|
generateOperationalSchemas(model: DMMF.Model): string;
|
|
21
21
|
/**
|
|
22
|
-
* Generate TypeScript type exports
|
|
22
|
+
* Generate TypeScript type exports
|
|
23
|
+
*
|
|
24
|
+
* Trusts runtime schema transformation - insertable() helper filters generated fields
|
|
23
25
|
*/
|
|
24
|
-
generateTypeExports(model: DMMF.Model,
|
|
26
|
+
generateTypeExports(model: DMMF.Model, _fields: readonly DMMF.Field[]): string;
|
|
25
27
|
/**
|
|
26
28
|
* Generate complete model schema (base + operational + types)
|
|
27
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/effect/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAMrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/effect/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAMrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;GAEG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,IAAI,CAAC,QAAQ;IAEhD;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,SAAS,IAAI,CAAC,aAAa,EAAE;IAIlD;;OAEG;IACH,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,IAAI,CAAC,KAAK,EAAE;IAgBnE;;OAEG;IACH,0BAA0B,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK;IAO5C;;;;OAIG;IACH,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,IAAI,CAAC,KAAK,EAAE;IAgBrE;;OAEG;IACH,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE;IAQ3D;;;;OAIG;IACH,mBAAmB,CAAC,QAAQ,EAAE,OAAO;IAyBrC;;OAEG;IACH,wBAAwB,CAAC,UAAU,EAAE,aAAa,EAAE;CAGrD"}
|
package/dist/effect/generator.js
CHANGED
|
@@ -6,32 +6,6 @@ const type_1 = require("./type");
|
|
|
6
6
|
const naming_1 = require("../utils/naming");
|
|
7
7
|
const codegen_1 = require("../utils/codegen");
|
|
8
8
|
const join_table_1 = require("./join-table");
|
|
9
|
-
const type_2 = require("../prisma/type");
|
|
10
|
-
/**
|
|
11
|
-
* Identify fields that should be omitted from Insert types
|
|
12
|
-
*
|
|
13
|
-
* Includes:
|
|
14
|
-
* - Fields with @default (both ID and non-ID fields) - wrapped with generated() or columnType with Never
|
|
15
|
-
* - Fields with @updatedAt directive - auto-managed by database
|
|
16
|
-
*
|
|
17
|
-
* Note: These fields are already filtered at runtime by v1.8.4 implementation.
|
|
18
|
-
* We explicitly omit them in TypeScript types for compile-time safety.
|
|
19
|
-
*/
|
|
20
|
-
function getOmittedInsertFields(fields) {
|
|
21
|
-
return fields
|
|
22
|
-
.filter((field) => {
|
|
23
|
-
// Fields with @default (includes IDs and regular generated fields)
|
|
24
|
-
if ((0, type_2.hasDefaultValue)(field)) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
// Fields with @updatedAt directive (DMMF provides isUpdatedAt property)
|
|
28
|
-
if (field.isUpdatedAt === true) {
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
return false;
|
|
32
|
-
})
|
|
33
|
-
.map((field) => field.name);
|
|
34
|
-
}
|
|
35
9
|
/**
|
|
36
10
|
* Effect domain generator - orchestrates Effect Schema generation
|
|
37
11
|
*/
|
|
@@ -70,28 +44,21 @@ ${fieldDefinitions}
|
|
|
70
44
|
return `export const ${operationalSchemaName} = getSchemas(${baseSchemaName});`;
|
|
71
45
|
}
|
|
72
46
|
/**
|
|
73
|
-
* Generate TypeScript type exports
|
|
47
|
+
* Generate TypeScript type exports
|
|
48
|
+
*
|
|
49
|
+
* Trusts runtime schema transformation - insertable() helper filters generated fields
|
|
74
50
|
*/
|
|
75
|
-
generateTypeExports(model,
|
|
51
|
+
generateTypeExports(model, _fields) {
|
|
76
52
|
const name = (0, naming_1.toPascalCase)(model.name);
|
|
77
|
-
const omittedFields = getOmittedInsertFields(fields);
|
|
78
|
-
// Generate Insert type with explicit Omit for generated/auto-managed fields
|
|
79
|
-
const insertType = omittedFields.length > 0
|
|
80
|
-
? `Omit<Schema.Schema.Type<typeof ${name}.Insertable>, ${omittedFields.map((f) => `'${f}'`).join(' | ')}>`
|
|
81
|
-
: `Schema.Schema.Type<typeof ${name}.Insertable>`;
|
|
82
|
-
const insertEncodedType = omittedFields.length > 0
|
|
83
|
-
? `Omit<Schema.Schema.Encoded<typeof ${name}.Insertable>, ${omittedFields.map((f) => `'${f}'`).join(' | ')}>`
|
|
84
|
-
: `Schema.Schema.Encoded<typeof ${name}.Insertable>`;
|
|
85
53
|
// Application-side types (decoded - for repository layer)
|
|
86
54
|
const applicationTypes = `export type ${name}Select = Schema.Schema.Type<typeof ${name}.Selectable>;
|
|
87
|
-
export type ${name}Insert = ${
|
|
55
|
+
export type ${name}Insert = Schema.Schema.Type<typeof ${name}.Insertable>;
|
|
88
56
|
export type ${name}Update = Schema.Schema.Type<typeof ${name}.Updateable>;`;
|
|
89
57
|
// Database-side encoded types (for queries layer)
|
|
90
|
-
const encodedTypes = `
|
|
91
|
-
export type ${name}
|
|
92
|
-
export type ${name}InsertEncoded = ${insertEncodedType};
|
|
58
|
+
const encodedTypes = `export type ${name}SelectEncoded = Schema.Schema.Encoded<typeof ${name}.Selectable>;
|
|
59
|
+
export type ${name}InsertEncoded = Schema.Schema.Encoded<typeof ${name}.Insertable>;
|
|
93
60
|
export type ${name}UpdateEncoded = Schema.Schema.Encoded<typeof ${name}.Updateable>;`;
|
|
94
|
-
return applicationTypes + encodedTypes;
|
|
61
|
+
return applicationTypes + '\n' + encodedTypes;
|
|
95
62
|
}
|
|
96
63
|
/**
|
|
97
64
|
* Generate complete model schema (base + operational + types)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/effect/generator.ts"],"names":[],"mappings":";;;AACA,iCAA2C;AAC3C,iCAAwC;AACxC,4CAA+C;AAC/C,8CAAsD;AACtD,6CAAuD;
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/effect/generator.ts"],"names":[],"mappings":";;;AACA,iCAA2C;AAC3C,iCAAwC;AACxC,4CAA+C;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B,CAAC,UAA2B;QAClD,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAA,oCAAuB,EAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrF,CAAC;CACF;AA3GD,0CA2GC"}
|
package/dist/kysely/helpers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
2
|
import type { Insertable, Selectable, Updateable } from 'kysely';
|
|
3
3
|
/**
|
|
4
4
|
* Runtime helpers for Kysely schema integration
|
|
@@ -10,7 +10,7 @@ export declare const GeneratedId: unique symbol;
|
|
|
10
10
|
* Mark a field as having different types for select/insert/update
|
|
11
11
|
* Used for ID fields with @default (read-only)
|
|
12
12
|
*/
|
|
13
|
-
export declare const columnType: <SType, SEncoded, SR, IType, IEncoded, IR, UType, UEncoded, UR>(selectSchema:
|
|
13
|
+
export declare const columnType: <SType, SEncoded, SR, IType, IEncoded, IR, UType, UEncoded, UR>(selectSchema: Schema.Schema<SType, SEncoded, SR>, insertSchema: Schema.Schema<IType, IEncoded, IR>, updateSchema: Schema.Schema<UType, UEncoded, UR>) => Schema.Schema<SType, SEncoded, SR>;
|
|
14
14
|
/**
|
|
15
15
|
* Mark a field as database-generated (omitted from insert)
|
|
16
16
|
* Used for fields with @default
|
|
@@ -19,33 +19,33 @@ export declare const columnType: <SType, SEncoded, SR, IType, IEncoded, IR, UTyp
|
|
|
19
19
|
* - Present in select and update schemas
|
|
20
20
|
* - OMITTED from insert schema (not optional, completely absent)
|
|
21
21
|
*/
|
|
22
|
-
export declare const generated: <SType, SEncoded, R>(schema:
|
|
22
|
+
export declare const generated: <SType, SEncoded, R>(schema: Schema.Schema<SType, SEncoded, R>) => Schema.Schema<SType, SEncoded, R>;
|
|
23
23
|
/**
|
|
24
24
|
* Create selectable schema from base schema
|
|
25
25
|
*/
|
|
26
|
-
export declare const selectable: <Type, Encoded>(schema:
|
|
26
|
+
export declare const selectable: <Type, Encoded>(schema: Schema.Schema<Type, Encoded>) => Schema.Schema<Selectable<Type>, Selectable<Encoded>, never>;
|
|
27
27
|
/**
|
|
28
28
|
* Create insertable schema from base schema
|
|
29
29
|
* Filters out generated fields (@effect/sql Model.Generated pattern)
|
|
30
30
|
*/
|
|
31
|
-
export declare const insertable: <Type, Encoded>(schema:
|
|
31
|
+
export declare const insertable: <Type, Encoded>(schema: Schema.Schema<Type, Encoded>) => Schema.Schema<Insertable<Type>, Insertable<Encoded>, never>;
|
|
32
32
|
/**
|
|
33
33
|
* Create updateable schema from base schema
|
|
34
34
|
*/
|
|
35
|
-
export declare const updateable: <Type, Encoded>(schema:
|
|
35
|
+
export declare const updateable: <Type, Encoded>(schema: Schema.Schema<Type, Encoded>) => Schema.Schema<Updateable<Type>, Updateable<Encoded>, never>;
|
|
36
36
|
export interface Schemas<Type, Encoded> {
|
|
37
|
-
Selectable:
|
|
38
|
-
Insertable:
|
|
39
|
-
Updateable:
|
|
37
|
+
Selectable: Schema.Schema<Selectable<Type>, Selectable<Encoded>>;
|
|
38
|
+
Insertable: Schema.Schema<Insertable<Type>, Insertable<Encoded>>;
|
|
39
|
+
Updateable: Schema.Schema<Updateable<Type>, Updateable<Encoded>>;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Generate all operational schemas (Selectable/Insertable/Updateable) from base schema
|
|
43
43
|
* Used in generated code
|
|
44
44
|
*/
|
|
45
|
-
export declare const getSchemas: <Type, Encoded>(baseSchema:
|
|
45
|
+
export declare const getSchemas: <Type, Encoded>(baseSchema: Schema.Schema<Type, Encoded>) => Schemas<Type, Encoded>;
|
|
46
46
|
export interface GetTypes<T extends Schemas<unknown, unknown>> {
|
|
47
|
-
Selectable:
|
|
48
|
-
Insertable:
|
|
49
|
-
Updateable:
|
|
47
|
+
Selectable: Schema.Schema.Type<T['Selectable']>;
|
|
48
|
+
Insertable: Schema.Schema.Type<T['Insertable']>;
|
|
49
|
+
Updateable: Schema.Schema.Type<T['Updateable']>;
|
|
50
50
|
}
|
|
51
51
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/kysely/helpers.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/kysely/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEjE;;;GAGG;AAEH,eAAO,MAAM,YAAY,eAA8B,CAAC;AACxD,eAAO,MAAM,WAAW,eAA6B,CAAC;AAQtD;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EACtF,cAAc,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,EAChD,cAAc,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,EAChD,cAAc,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,KAC/C,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAQnC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,EAAE,QAAQ,EAAE,CAAC,EAC1C,QAAQ,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,KACxC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,CAElC,CAAC;AAEF;;GAEG;AACH,eAAO,M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WAAW,QAAQ,CAAC,CAAC,SAAS,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;IAC3D,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;IAChD,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;IAChD,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;CACjD"}
|
package/dist/kysely/helpers.js
CHANGED
|
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.getSchemas = exports.updateable = exports.insertable = exports.selectable = exports.generated = exports.columnType = exports.GeneratedId = exports.ColumnTypeId = void 0;
|
|
37
37
|
const AST = __importStar(require("effect/SchemaAST"));
|
|
38
|
-
const
|
|
38
|
+
const effect_1 = require("effect");
|
|
39
39
|
/**
|
|
40
40
|
* Runtime helpers for Kysely schema integration
|
|
41
41
|
* These are imported by generated code
|
|
@@ -52,7 +52,7 @@ const columnType = (selectSchema, insertSchema, updateSchema) => {
|
|
|
52
52
|
insertSchema,
|
|
53
53
|
updateSchema,
|
|
54
54
|
};
|
|
55
|
-
return selectSchema.annotations({ [exports.ColumnTypeId]: schemas });
|
|
55
|
+
return effect_1.Schema.asSchema(selectSchema.annotations({ [exports.ColumnTypeId]: schemas }));
|
|
56
56
|
};
|
|
57
57
|
exports.columnType = columnType;
|
|
58
58
|
/**
|
|
@@ -64,7 +64,7 @@ exports.columnType = columnType;
|
|
|
64
64
|
* - OMITTED from insert schema (not optional, completely absent)
|
|
65
65
|
*/
|
|
66
66
|
const generated = (schema) => {
|
|
67
|
-
return schema.annotations({ [exports.GeneratedId]: true });
|
|
67
|
+
return effect_1.Schema.asSchema(schema.annotations({ [exports.GeneratedId]: true }));
|
|
68
68
|
};
|
|
69
69
|
exports.generated = generated;
|
|
70
70
|
/**
|
|
@@ -73,9 +73,9 @@ exports.generated = generated;
|
|
|
73
73
|
const selectable = (schema) => {
|
|
74
74
|
const { ast } = schema;
|
|
75
75
|
if (!AST.isTypeLiteral(ast)) {
|
|
76
|
-
return
|
|
76
|
+
return effect_1.Schema.asSchema(effect_1.Schema.make(ast));
|
|
77
77
|
}
|
|
78
|
-
return
|
|
78
|
+
return effect_1.Schema.asSchema(effect_1.Schema.make(new AST.TypeLiteral(extractParametersFromTypeLiteral(ast, 'selectSchema'), ast.indexSignatures, ast.annotations)));
|
|
79
79
|
};
|
|
80
80
|
exports.selectable = selectable;
|
|
81
81
|
/**
|
|
@@ -85,7 +85,7 @@ exports.selectable = selectable;
|
|
|
85
85
|
const insertable = (schema) => {
|
|
86
86
|
const { ast } = schema;
|
|
87
87
|
if (!AST.isTypeLiteral(ast)) {
|
|
88
|
-
return
|
|
88
|
+
return effect_1.Schema.asSchema(effect_1.Schema.make(ast));
|
|
89
89
|
}
|
|
90
90
|
// Extract and filter out generated fields entirely
|
|
91
91
|
const extracted = ast.propertySignatures
|
|
@@ -110,7 +110,7 @@ const insertable = (schema) => {
|
|
|
110
110
|
return new AST.PropertySignature(prop.name, prop.type, isOptional, prop.isReadonly, prop.annotations);
|
|
111
111
|
});
|
|
112
112
|
const res = new AST.TypeLiteral(extracted, ast.indexSignatures, ast.annotations);
|
|
113
|
-
return
|
|
113
|
+
return effect_1.Schema.asSchema(effect_1.Schema.make(res));
|
|
114
114
|
};
|
|
115
115
|
exports.insertable = insertable;
|
|
116
116
|
/**
|
|
@@ -119,11 +119,11 @@ exports.insertable = insertable;
|
|
|
119
119
|
const updateable = (schema) => {
|
|
120
120
|
const { ast } = schema;
|
|
121
121
|
if (!AST.isTypeLiteral(ast)) {
|
|
122
|
-
return
|
|
122
|
+
return effect_1.Schema.asSchema(effect_1.Schema.make(ast));
|
|
123
123
|
}
|
|
124
124
|
const extracted = extractParametersFromTypeLiteral(ast, 'updateSchema');
|
|
125
125
|
const res = new AST.TypeLiteral(extracted.map((prop) => new AST.PropertySignature(prop.name, AST.Union.make([prop.type, new AST.UndefinedKeyword()]), true, prop.isReadonly, prop.annotations)), ast.indexSignatures, ast.annotations);
|
|
126
|
-
return
|
|
126
|
+
return effect_1.Schema.asSchema(effect_1.Schema.make(res));
|
|
127
127
|
};
|
|
128
128
|
exports.updateable = updateable;
|
|
129
129
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/kysely/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/kysely/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AACxC,mCAAgC;AAGhC;;;GAGG;AAEU,QAAA,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC3C,QAAA,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAQtD;;;GAGG;AACI,MAAM,UAAU,GAAG,CACxB,YAAgD,EAChD,YAAgD,EAChD,YAAgD,EACZ,EAAE;IACtC,MAAM,OAAO,GACX;QACE,YAAY;QACZ,YAAY;QACZ,YAAY;KACb,CAAC;IACJ,OAAO,eAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC,oBAAY,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC;AAZW,QAAA,UAAU,cAYrB;AAEF;;;;;;;GAOG;AACI,MAAM,SAAS,GAAG,CACvB,MAAyC,EACN,EAAE;IACrC,OAAO,eAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,mBAAW,CAAC,EAAE,IA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 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prisma-effect-kysely",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "Prisma generator that creates Effect Schema types from Prisma schema compatible with Kysely",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Samuel Ho",
|
|
@@ -68,13 +68,11 @@
|
|
|
68
68
|
]
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@prisma/client": "6.16.3",
|
|
72
|
-
"@prisma/dmmf": "^6.17.0",
|
|
73
71
|
"@prisma/generator-helper": "^6.17.0",
|
|
74
|
-
"effect": "^3.18.4",
|
|
75
72
|
"prettier": "^3.6.2"
|
|
76
73
|
},
|
|
77
74
|
"peerDependencies": {
|
|
75
|
+
"effect": "^3.18.4",
|
|
78
76
|
"kysely": "^0.28.0"
|
|
79
77
|
},
|
|
80
78
|
"peerDependenciesMeta": {
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration for a single Unsupported field
|
|
3
|
-
*/
|
|
4
|
-
export interface UnsupportedFieldConfig {
|
|
5
|
-
effectType: string;
|
|
6
|
-
dbType: string;
|
|
7
|
-
dbName: string;
|
|
8
|
-
required: boolean;
|
|
9
|
-
comment?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Full configuration structure
|
|
13
|
-
*/
|
|
14
|
-
export interface UnsupportedConfig {
|
|
15
|
-
models: Record<string, Record<string, UnsupportedFieldConfig>>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Load unsupported fields configuration from JSON file
|
|
19
|
-
* Looks for prisma/unsupported-fields.json relative to schema location
|
|
20
|
-
*/
|
|
21
|
-
export declare function loadUnsupportedConfig(schemaPath: string): UnsupportedConfig | null;
|
|
22
|
-
/**
|
|
23
|
-
* Get unsupported fields for a specific model
|
|
24
|
-
*/
|
|
25
|
-
export declare function getUnsupportedFields(config: UnsupportedConfig | null, modelName: string): Record<string, UnsupportedFieldConfig>;
|
|
26
|
-
//# sourceMappingURL=unsupported-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unsupported-config.d.ts","sourceRoot":"","sources":["../../src/utils/unsupported-config.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC,CAAC;CAChE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAiBlF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,iBAAiB,GAAG,IAAI,EAChC,SAAS,EAAE,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAGxC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadUnsupportedConfig = loadUnsupportedConfig;
|
|
4
|
-
exports.getUnsupportedFields = getUnsupportedFields;
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
/**
|
|
8
|
-
* Load unsupported fields configuration from JSON file
|
|
9
|
-
* Looks for prisma/unsupported-fields.json relative to schema location
|
|
10
|
-
*/
|
|
11
|
-
function loadUnsupportedConfig(schemaPath) {
|
|
12
|
-
try {
|
|
13
|
-
// Assume schema is in prisma/schema/ directory
|
|
14
|
-
// Config should be in prisma/unsupported-fields.json
|
|
15
|
-
const schemaDir = (0, path_1.dirname)((0, path_1.dirname)(schemaPath)); // Go up to prisma/
|
|
16
|
-
const configPath = (0, path_1.join)(schemaDir, 'unsupported-fields.json');
|
|
17
|
-
if (!(0, fs_1.existsSync)(configPath)) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
const content = (0, fs_1.readFileSync)(configPath, 'utf-8');
|
|
21
|
-
return JSON.parse(content);
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
console.warn(`⚠️ Failed to load unsupported-fields.json: ${error}`);
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Get unsupported fields for a specific model
|
|
30
|
-
*/
|
|
31
|
-
function getUnsupportedFields(config, modelName) {
|
|
32
|
-
if (!config)
|
|
33
|
-
return {};
|
|
34
|
-
return config.models[modelName] || {};
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=unsupported-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unsupported-config.js","sourceRoot":"","sources":["../../src/utils/unsupported-config.ts"],"names":[],"mappings":";;AAyBA,sDAiBC;AAKD,oDAMC;AArDD,2BAA8C;AAC9C,+BAAqC;AAoBrC;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,UAAkB;IACtD,IAAI,CAAC;QACH,+CAA+C;QAC/C,qDAAqD;QACrD,MAAM,SAAS,GAAG,IAAA,cAAO,EAAC,IAAA,cAAO,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,mBAAmB;QACnE,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC;QAE9D,IAAI,CAAC,IAAA,eAAU,EAAC,UAAU,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,OAAO,GAAG,IAAA,iBAAY,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAsB,CAAC;IAClD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,+CAA+C,KAAK,EAAE,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAClC,MAAgC,EAChC,SAAiB;IAEjB,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;AACxC,CAAC"}
|