prisma-effect-kysely 5.7.0 → 5.8.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 +52 -0
- package/dist/effect/generator.d.ts.map +1 -1
- package/dist/effect/generator.js +5 -4
- package/dist/effect/generator.js.map +1 -1
- package/dist/utils/type-mappings.d.ts +12 -9
- package/dist/utils/type-mappings.d.ts.map +1 -1
- package/dist/utils/type-mappings.js +11 -8
- package/dist/utils/type-mappings.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ac42853: fix: DateTime maps back to `Schema.DateFromSelf` (Date ↔ Date) — Prisma+Kysely canonical
|
|
8
|
+
|
|
9
|
+
Reverts the 5.6.0 change that mapped `DateTime` to `DateFromInput` (a
|
|
10
|
+
`Schema.Union(DateFromSelf, Date)` with `Encoded = Date | string`).
|
|
11
|
+
|
|
12
|
+
**Why revert**: the dual-input Union pushed the boundary problem onto
|
|
13
|
+
DA-layer consumers. Kysely's pg driver returns native `Date` instances,
|
|
14
|
+
but `Selectable<X>.created_at` typed as `Date | string` forced every DA
|
|
15
|
+
mapper that copies `result.created_at` into a contract type to either
|
|
16
|
+
narrow manually (no cast-free path) or wrap the read in
|
|
17
|
+
`Schema.decode(Selectable(X))` (heavy refactor across hundreds of sites).
|
|
18
|
+
|
|
19
|
+
**Why DateFromSelf is correct**:
|
|
20
|
+
- **Prisma docs**: _"Prisma Client returns all DateTime values as native
|
|
21
|
+
JavaScript Date objects. ... DateTime values must be passed as Date
|
|
22
|
+
objects, not strings, to avoid runtime errors."_
|
|
23
|
+
- **Kysely docs**: idiomatic DateTime column is
|
|
24
|
+
`created_at: ColumnType<Date, string | undefined, never>` — SELECT
|
|
25
|
+
yields `Date`. _"TypeScript is a compile-time concept and cannot
|
|
26
|
+
alter runtime JavaScript types. If your TypeScript definition for a
|
|
27
|
+
column differs from the database's actual return type, the runtime
|
|
28
|
+
type will not change automatically."_
|
|
29
|
+
- **Effect Schema docs (Doc 10944)**: _"schemas should be defined such
|
|
30
|
+
that encode + decode return the original value"_ — one Type, one
|
|
31
|
+
Encoded per schema. The dual-boundary problem (DA Date ↔ Date vs
|
|
32
|
+
RPC string ↔ Date) is solved by **two schemas** (one per boundary),
|
|
33
|
+
not one Union. Doc 4312 (`@effect/sql/Model.Class`) shows this
|
|
34
|
+
canonical variant pattern (`select`/`insert`/`update` vs
|
|
35
|
+
`json`/`jsonCreate`/`jsonUpdate`).
|
|
36
|
+
|
|
37
|
+
**For RPC/HTTP wire boundaries**: define a contract-layer schema that
|
|
38
|
+
overrides date columns with `Schema.Date` (Encoded = string) before the
|
|
39
|
+
RPC framework calls `Schema.decode`. This is the same pattern as
|
|
40
|
+
`@effect/sql`'s `json` variants — one schema per boundary.
|
|
41
|
+
|
|
42
|
+
**`DateFromInput` is still exported** from the package for consumers that
|
|
43
|
+
specifically want the dual-input behavior at a single call site. The
|
|
44
|
+
codegen just no longer auto-emits it for every DateTime column.
|
|
45
|
+
|
|
46
|
+
**The Schema.Schema.Encoded fix in 5.7.0 stays** — that's still correct
|
|
47
|
+
for join-table column exposure (`_product_tags.A`/`B`).
|
|
48
|
+
|
|
49
|
+
**Migration**: most consumers benefit immediately (DA mappers stop
|
|
50
|
+
seeing `Date | string`). For RPC contracts that previously didn't have
|
|
51
|
+
a Date override (because they relied on `DateFromInput`), re-add a
|
|
52
|
+
`Schema.extend` with `Schema.Date` overrides for date columns to keep
|
|
53
|
+
wire decode working.
|
|
54
|
+
|
|
3
55
|
## 5.7.0
|
|
4
56
|
|
|
5
57
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/effect/generator.ts"],"names":[],"mappings":"AAAA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IAAI,CAAC,KAAK,EAAE;IAqBpE;;OAEG;IACH,mBAAmB,CAAC,QAAQ,EAAE,OAAO;IAsBrC;;OAEG;IACH,wBAAwB,CAAC,UAAU,EAAE,aAAa,EAAE;CAGrD"}
|
package/dist/effect/generator.js
CHANGED
|
@@ -76,12 +76,13 @@ export type ${name} = typeof ${name};`;
|
|
|
76
76
|
*/
|
|
77
77
|
generateTypesHeader(hasEnums) {
|
|
78
78
|
const header = generateFileHeader();
|
|
79
|
-
// Import runtime helpers from prisma-effect-kysely
|
|
80
|
-
//
|
|
81
|
-
//
|
|
79
|
+
// Import runtime helpers from prisma-effect-kysely.
|
|
80
|
+
// DateTime fields use Schema.DateFromSelf (Date ↔ Date), matching
|
|
81
|
+
// Prisma's contract that DateTime values are native Date instances.
|
|
82
|
+
// Decode through a Schema.Date contract schema at JSON wire boundaries.
|
|
82
83
|
const imports = [
|
|
83
84
|
`import { Schema } from "effect";`,
|
|
84
|
-
`import { columnType, generated, JsonValue
|
|
85
|
+
`import { columnType, generated, JsonValue } from "prisma-effect-kysely";`,
|
|
85
86
|
];
|
|
86
87
|
if (hasEnums) {
|
|
87
88
|
// Import PascalCase enum schemas
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/effect/generator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAsB,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,WA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|
-
* DateTime uses `
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* DateTime uses `Schema.DateFromSelf` (Type === Encoded === Date) — matches
|
|
15
|
+
* Prisma's contract that Client returns DateTime as native `Date` instances
|
|
16
|
+
* (https://www.prisma.io/docs — "Prisma Client returns all DateTime values
|
|
17
|
+
* as native JavaScript Date objects"). Also matches Kysely's idiomatic
|
|
18
|
+
* `ColumnType<Date, ...>` pattern: SELECT yields Date.
|
|
18
19
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* For RPC/JSON wire boundaries (where dates serialize to ISO strings),
|
|
21
|
+
* decode through a `Schema.Date`-typed contract schema at the boundary.
|
|
22
|
+
* Effect's Schema is single-pair (Type, Encoded) by design — see Doc 10944
|
|
23
|
+
* "The Rule of Schemas" — and the dual-boundary problem is solved by
|
|
24
|
+
* having two schemas (DA-side vs wire-side), not one Union.
|
|
22
25
|
*/
|
|
23
26
|
export declare const PRISMA_TO_EFFECT_SCHEMA: {
|
|
24
27
|
readonly String: "Schema.String";
|
|
@@ -27,7 +30,7 @@ export declare const PRISMA_TO_EFFECT_SCHEMA: {
|
|
|
27
30
|
readonly BigInt: "Schema.BigInt";
|
|
28
31
|
readonly Decimal: "Schema.String";
|
|
29
32
|
readonly Boolean: "Schema.Boolean";
|
|
30
|
-
readonly DateTime: "
|
|
33
|
+
readonly DateTime: "Schema.DateFromSelf";
|
|
31
34
|
readonly Json: "JsonValue";
|
|
32
35
|
readonly Bytes: "Schema.Uint8Array";
|
|
33
36
|
};
|
|
@@ -57,7 +60,7 @@ export declare function isPrismaScalarType(type: string): type is PrismaScalarTy
|
|
|
57
60
|
* Get Effect Schema type for a Prisma scalar type
|
|
58
61
|
* Returns undefined for non-scalar types (enums, relations)
|
|
59
62
|
*/
|
|
60
|
-
export declare function getEffectSchemaType(type: string): "Schema.String" | "Schema.Number" | "Schema.BigInt" | "Schema.Boolean" | "
|
|
63
|
+
export declare function getEffectSchemaType(type: string): "Schema.String" | "Schema.Number" | "Schema.BigInt" | "Schema.Boolean" | "Schema.DateFromSelf" | "JsonValue" | "Schema.Uint8Array" | undefined;
|
|
61
64
|
/**
|
|
62
65
|
* Get TypeScript type for a Prisma scalar type
|
|
63
66
|
* Returns the input type unchanged for non-scalar types (enums, models)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-mappings.d.ts","sourceRoot":"","sources":["../../src/utils/type-mappings.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH
|
|
1
|
+
{"version":3,"file":"type-mappings.d.ts","sourceRoot":"","sources":["../../src/utils/type-mappings.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;CAU1B,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;CAUvB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,uBAAuB,CAAC;AAEpE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,gBAAgB,CAEzE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,kJAK/C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,UAK7C"}
|
|
@@ -11,14 +11,17 @@
|
|
|
11
11
|
* Prisma scalar type mapping to Effect Schema types
|
|
12
12
|
* Uses const assertion for type safety
|
|
13
13
|
*
|
|
14
|
-
* DateTime uses `
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* DateTime uses `Schema.DateFromSelf` (Type === Encoded === Date) — matches
|
|
15
|
+
* Prisma's contract that Client returns DateTime as native `Date` instances
|
|
16
|
+
* (https://www.prisma.io/docs — "Prisma Client returns all DateTime values
|
|
17
|
+
* as native JavaScript Date objects"). Also matches Kysely's idiomatic
|
|
18
|
+
* `ColumnType<Date, ...>` pattern: SELECT yields Date.
|
|
18
19
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* For RPC/JSON wire boundaries (where dates serialize to ISO strings),
|
|
21
|
+
* decode through a `Schema.Date`-typed contract schema at the boundary.
|
|
22
|
+
* Effect's Schema is single-pair (Type, Encoded) by design — see Doc 10944
|
|
23
|
+
* "The Rule of Schemas" — and the dual-boundary problem is solved by
|
|
24
|
+
* having two schemas (DA-side vs wire-side), not one Union.
|
|
22
25
|
*/
|
|
23
26
|
export const PRISMA_TO_EFFECT_SCHEMA = {
|
|
24
27
|
String: 'Schema.String',
|
|
@@ -27,7 +30,7 @@ export const PRISMA_TO_EFFECT_SCHEMA = {
|
|
|
27
30
|
BigInt: 'Schema.BigInt',
|
|
28
31
|
Decimal: 'Schema.String', // For precision
|
|
29
32
|
Boolean: 'Schema.Boolean',
|
|
30
|
-
DateTime: '
|
|
33
|
+
DateTime: 'Schema.DateFromSelf', // Date ↔ Date — Prisma+Kysely canonical
|
|
31
34
|
Json: 'JsonValue', // Recursive JSON type — prevents null absorption in NullOr
|
|
32
35
|
Bytes: 'Schema.Uint8Array',
|
|
33
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-mappings.js","sourceRoot":"","sources":["../../src/utils/type-mappings.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH
|
|
1
|
+
{"version":3,"file":"type-mappings.js","sourceRoot":"","sources":["../../src/utils/type-mappings.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,MAAM,EAAE,eAAe;IACvB,GAAG,EAAE,eAAe;IACpB,KAAK,EAAE,eAAe;IACtB,MAAM,EAAE,eAAe;IACvB,OAAO,EAAE,eAAe,EAAE,gBAAgB;IAC1C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