prisma-effect-kysely 1.2.0 → 1.3.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.
package/CHANGELOG.md
CHANGED
|
@@ -5,14 +5,57 @@ 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.3.0] - 2025-01-09
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Encoded type exports** - Generator now exports database-encoded types alongside application types
|
|
13
|
+
- `{Model}SelectEncoded` - Database-encoded type for `Schema.Schema.Encoded<typeof Model.Selectable>`
|
|
14
|
+
- `{Model}InsertEncoded` - Database-encoded type for `Schema.Schema.Encoded<typeof Model.Insertable>`
|
|
15
|
+
- `{Model}UpdateEncoded` - Database-encoded type for `Schema.Schema.Encoded<typeof Model.Updateable>`
|
|
16
|
+
- Comprehensive test coverage for Encoded type exports
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- `generateTypeExports()` method now generates both Application and Encoded type exports
|
|
21
|
+
- Queries layer can now use proper Encoded types instead of `any` workarounds
|
|
22
|
+
|
|
23
|
+
### Why This Matters
|
|
24
|
+
|
|
25
|
+
Effect Schema has bidirectional transformations:
|
|
26
|
+
- **Application types** (`Schema.Schema.Type`) - Decoded types with `Date` objects (for repository layer)
|
|
27
|
+
- **Database types** (`Schema.Schema.Encoded`) - Encoded types with ISO strings (for queries layer)
|
|
28
|
+
|
|
29
|
+
Previously, only Application types were exported, forcing queries to use `any` types. Now both sides of the transformation are properly typed.
|
|
30
|
+
|
|
31
|
+
**Example Usage:**
|
|
32
|
+
```typescript
|
|
33
|
+
import { agentInsertEncoded } from '@libs/types';
|
|
34
|
+
|
|
35
|
+
// Queries layer - uses Encoded types (ISO strings)
|
|
36
|
+
insert: (rowData: agentInsertEncoded) => db.insertInto('agent').values(rowData)
|
|
37
|
+
|
|
38
|
+
// Repository layer - uses Application types (Date objects)
|
|
39
|
+
const input: CreateAgentInput = { /* ... Date objects ... */ };
|
|
40
|
+
const encoded = Schema.encode(AgentSchemas.Insertable)(input); // Encoded to ISO strings
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
[1.3.0]: https://github.com/samuelho-dev/prisma-effect-kysely/compare/v1.2.1...v1.3.0
|
|
44
|
+
|
|
45
|
+
## [1.2.1] - 2025-10-08
|
|
46
|
+
|
|
47
|
+
- Bump prisma 6.17
|
|
48
|
+
|
|
8
49
|
## [1.2.0] - 2025-10-08
|
|
9
50
|
|
|
10
51
|
### Changed
|
|
52
|
+
|
|
11
53
|
- Updated peer dependency to support Kysely ^0.28.0 (0.28.x versions)
|
|
12
54
|
- Updated dev dependency to Kysely 0.28.7 for testing
|
|
13
55
|
- No breaking changes to generated code or exported API
|
|
14
56
|
|
|
15
57
|
### Technical Details
|
|
58
|
+
|
|
16
59
|
- All Kysely imports are type-only (`ColumnType`, `Generated`, `Selectable`, `Insertable`, `Updateable`)
|
|
17
60
|
- No runtime Kysely code usage ensures compatibility across versions
|
|
18
61
|
- Comprehensive test suite validates compatibility with Kysely 0.28.x
|
|
@@ -22,10 +65,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
22
65
|
## [1.0.2] - 2025-10-03
|
|
23
66
|
|
|
24
67
|
### Note
|
|
68
|
+
|
|
25
69
|
**Temporary release due to npm 24-hour republish restriction.**
|
|
26
70
|
This version will be unpublished and superseded by v1.0.0 within 24 hours.
|
|
27
71
|
|
|
28
72
|
### Fixed
|
|
73
|
+
|
|
29
74
|
- Export configuration to allow importing runtime helpers from main package entry point
|
|
30
75
|
- Clean dependency tree with minimal deprecation warnings
|
|
31
76
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/effect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
|
package/dist/effect/generator.js
CHANGED
|
@@ -45,9 +45,16 @@ ${fieldDefinitions}
|
|
|
45
45
|
*/
|
|
46
46
|
generateTypeExports(model) {
|
|
47
47
|
const name = model.name;
|
|
48
|
-
|
|
48
|
+
// Application-side types (decoded - for repository layer)
|
|
49
|
+
const applicationTypes = `export type ${name}Select = Schema.Schema.Type<typeof ${name}.Selectable>;
|
|
49
50
|
export type ${name}Insert = Schema.Schema.Type<typeof ${name}.Insertable>;
|
|
50
51
|
export type ${name}Update = Schema.Schema.Type<typeof ${name}.Updateable>;`;
|
|
52
|
+
// Database-side encoded types (for queries layer)
|
|
53
|
+
const encodedTypes = `
|
|
54
|
+
export type ${name}SelectEncoded = Schema.Schema.Encoded<typeof ${name}.Selectable>;
|
|
55
|
+
export type ${name}InsertEncoded = Schema.Schema.Encoded<typeof ${name}.Insertable>;
|
|
56
|
+
export type ${name}UpdateEncoded = Schema.Schema.Encoded<typeof ${name}.Updateable>;`;
|
|
57
|
+
return applicationTypes + encodedTypes;
|
|
51
58
|
}
|
|
52
59
|
/**
|
|
53
60
|
* 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;AAGxC;;GAEG;AACH,MAAa,eAAe;IAC1B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD;;OAEG;IACH,aAAa,CAAC,KAAoC;QAChD,OAAO,IAAA,wBAAiB,EAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,kBAAkB,CAAC,KAAiB,EAAE,MAA6B;QACjE,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;aACxC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACb,MAAM,SAAS,GAAG,IAAA,qBAAc,EAAC,KAAK,EAAE,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AAW,EAAE;;IAEpC,CAAC;QAED,MAAM,OAAO,GAAG;YACd,kCAAkC;YAClC,2EAA2E;SAC5E,CAAC;QAEF,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,CAAC,YAAY,SAAS,oBAAoB,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,GAAG,MAAM,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9C,CAAC;CACF;AA3FD,0CA2FC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prisma-effect-kysely",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
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",
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@prisma/client": "6.16.3",
|
|
59
|
-
"@prisma/generator-helper": "^6.
|
|
60
|
-
"effect": "^3.
|
|
61
|
-
"prettier": "^3.
|
|
59
|
+
"@prisma/generator-helper": "^6.17.0",
|
|
60
|
+
"effect": "^3.18.4",
|
|
61
|
+
"prettier": "^3.6.2"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"kysely": "^0.28.0"
|
|
@@ -69,14 +69,14 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@prisma/internals": "^6.
|
|
72
|
+
"@prisma/internals": "^6.17.0",
|
|
73
73
|
"@types/jest": "^29.5.14",
|
|
74
|
-
"@types/node": "^22.
|
|
74
|
+
"@types/node": "^22.18.8",
|
|
75
75
|
"jest": "^29.7.0",
|
|
76
76
|
"kysely": "^0.28.7",
|
|
77
|
-
"prisma": "^6.
|
|
78
|
-
"ts-jest": "^29.
|
|
77
|
+
"prisma": "^6.17.0",
|
|
78
|
+
"ts-jest": "^29.4.4",
|
|
79
79
|
"ts-node": "^10.9.2",
|
|
80
|
-
"typescript": "^5.
|
|
80
|
+
"typescript": "^5.9.3"
|
|
81
81
|
}
|
|
82
82
|
}
|