prisma-effect-kysely 5.9.0 → 5.10.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 +31 -0
- package/README.md +10 -3
- package/dist/prisma/type.d.ts +14 -2
- package/dist/prisma/type.d.ts.map +1 -1
- package/dist/prisma/type.js +17 -15
- package/dist/prisma/type.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- be1a22e: fix: only treat `@db.Uuid` columns as UUIDs — drop field-name inference
|
|
8
|
+
|
|
9
|
+
`isUuidField` previously had a third detection tier that inferred UUID from the
|
|
10
|
+
field _name_ (`/^id$/`, `/_id$/`, `/^.*_uuid$/`, `/^uuid$/`) for any `String`
|
|
11
|
+
column. UUID is a column _type_, not a naming convention, so this was a
|
|
12
|
+
false-positive generator: every external-system identifier stored as text — most
|
|
13
|
+
notably Stripe IDs (`acct_…`, `cus_…`, `sub_…`, `price_…`, `txn_…`, `ch_…`,
|
|
14
|
+
`evt_…`), plus slugs and provider/session references — ends in `_id` without
|
|
15
|
+
being a UUID. The generator emitted `Schema.String.check(Schema.isUUID())` for
|
|
16
|
+
those columns, and decoding real data threw `Die`/`ParseError`
|
|
17
|
+
("Expected a UUID, got \"acct\_…\"") at runtime.
|
|
18
|
+
|
|
19
|
+
Prisma always records a genuine `uuid` column via the `@db.Uuid` native type (a
|
|
20
|
+
bare `String` maps to `text`), so the native-type and `@db.Uuid`-documentation
|
|
21
|
+
checks already capture 100% of real UUID columns. The name-pattern tier only
|
|
22
|
+
ever contradicted that authoritative information, so it has been removed.
|
|
23
|
+
|
|
24
|
+
`isUuidField` now returns true only when:
|
|
25
|
+
1. `field.nativeType[0] === 'Uuid'` (a `@db.Uuid` column), or
|
|
26
|
+
2. the field documentation includes `@db.Uuid`.
|
|
27
|
+
|
|
28
|
+
**Migration:** columns that are genuinely UUID-typed are unaffected (they carry
|
|
29
|
+
`@db.Uuid`). Columns that were relying on name inference to get UUID validation
|
|
30
|
+
lose it — which is the fix, since they were text. To keep an explicit UUID check
|
|
31
|
+
on a non-`@db.Uuid` column, add `/// @db.Uuid` to the field, or override its
|
|
32
|
+
schema with `/// @customType(...)`.
|
|
33
|
+
|
|
3
34
|
## 5.9.0
|
|
4
35
|
|
|
5
36
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -90,11 +90,18 @@ Arrays → `Schema.Array(t)`. Nullable → `Schema.NullOr(t)`. `DateFromInput` a
|
|
|
90
90
|
|
|
91
91
|
## UUID Detection
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
A column is treated as a UUID only when Prisma's type information says so:
|
|
94
94
|
|
|
95
95
|
1. Native type: `@db.Uuid`
|
|
96
|
-
2. Documentation: `@db.Uuid` in field comment
|
|
97
|
-
|
|
96
|
+
2. Documentation: `@db.Uuid` in the field comment (`/// @db.Uuid`)
|
|
97
|
+
|
|
98
|
+
UUID is a column type, not a naming convention — a bare `String` maps to `text`,
|
|
99
|
+
so `@db.Uuid` always captures genuine UUID columns. Field-name inference
|
|
100
|
+
(`*_id`, `*_uuid`, …) is intentionally NOT used: external identifiers such as
|
|
101
|
+
Stripe IDs (`acct_…`, `cus_…`) are text but end in `_id`, and inferring UUID
|
|
102
|
+
from the name produced false `Schema.isUUID()` checks that crashed at decode
|
|
103
|
+
time. Mark a non-`@db.Uuid` column as a UUID explicitly via `/// @db.Uuid`, or
|
|
104
|
+
override its schema entirely with `@customType(...)`.
|
|
98
105
|
|
|
99
106
|
## Custom Type Overrides
|
|
100
107
|
|
package/dist/prisma/type.d.ts
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import type { DMMF } from '@prisma/generator-helper';
|
|
2
2
|
/**
|
|
3
|
-
* Check if a field is a UUID
|
|
4
|
-
*
|
|
3
|
+
* Check if a field is a UUID, based solely on the authoritative DMMF type info.
|
|
4
|
+
*
|
|
5
|
+
* UUID is a *column type*, not a naming convention. Prisma always records a
|
|
6
|
+
* `uuid` column as the `@db.Uuid` native type (a bare `String` maps to `text`),
|
|
7
|
+
* so the native-type/`@db.Uuid` checks capture every genuine UUID column.
|
|
8
|
+
*
|
|
9
|
+
* A previous third tier inferred UUID from field-name patterns (`id`, `*_id`,
|
|
10
|
+
* `*_uuid`, `uuid`). That was a false-positive generator: any external-system
|
|
11
|
+
* identifier stored as text — Stripe IDs (`acct_…`, `cus_…`, `txn_…`), slugs,
|
|
12
|
+
* provider/session references — ends in `_id` without being a UUID, yet got
|
|
13
|
+
* `Schema.isUUID()` applied and then died at decode time on real data. The DMMF
|
|
14
|
+
* already knows the real type, so the name guess only ever contradicted ground
|
|
15
|
+
* truth. It has been removed; use `/// @db.Uuid` (or a real `@db.Uuid` column)
|
|
16
|
+
* to mark UUID columns explicitly.
|
|
5
17
|
*/
|
|
6
18
|
export declare function isUuidField(field: DMMF.Field): boolean;
|
|
7
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/prisma/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/prisma/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAErD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,WAY5C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,UAE/C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,WAEhD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,WAE1C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,WAEhD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,WAE5C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,IAAI,CAAC,KAAK,EAAE;;;;;;;;;;KAEjE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,IAAI,CAAC,KAAK,EAAE;;;;;;;;;;;;;;;;;;;;;KAE/D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,UAE/C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,IAAI,CAAC,KAAK,EAAE;;;;;;;;;;KAEvD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,IAAI,CAAC,KAAK,EAAE;;;;;;;;;;;;;;;;;;;;;KAEvD"}
|
package/dist/prisma/type.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Check if a field is a UUID
|
|
3
|
-
*
|
|
2
|
+
* Check if a field is a UUID, based solely on the authoritative DMMF type info.
|
|
3
|
+
*
|
|
4
|
+
* UUID is a *column type*, not a naming convention. Prisma always records a
|
|
5
|
+
* `uuid` column as the `@db.Uuid` native type (a bare `String` maps to `text`),
|
|
6
|
+
* so the native-type/`@db.Uuid` checks capture every genuine UUID column.
|
|
7
|
+
*
|
|
8
|
+
* A previous third tier inferred UUID from field-name patterns (`id`, `*_id`,
|
|
9
|
+
* `*_uuid`, `uuid`). That was a false-positive generator: any external-system
|
|
10
|
+
* identifier stored as text — Stripe IDs (`acct_…`, `cus_…`, `txn_…`), slugs,
|
|
11
|
+
* provider/session references — ends in `_id` without being a UUID, yet got
|
|
12
|
+
* `Schema.isUUID()` applied and then died at decode time on real data. The DMMF
|
|
13
|
+
* already knows the real type, so the name guess only ever contradicted ground
|
|
14
|
+
* truth. It has been removed; use `/// @db.Uuid` (or a real `@db.Uuid` column)
|
|
15
|
+
* to mark UUID columns explicitly.
|
|
4
16
|
*/
|
|
5
17
|
export function isUuidField(field) {
|
|
6
|
-
//
|
|
18
|
+
// Native type — the authoritative signal for a `uuid` column.
|
|
7
19
|
if (field.nativeType?.[0] === 'Uuid') {
|
|
8
20
|
return true;
|
|
9
21
|
}
|
|
10
|
-
//
|
|
22
|
+
// `@db.Uuid` recorded in the field's documentation/attributes.
|
|
11
23
|
if (field.documentation?.includes('@db.Uuid')) {
|
|
12
24
|
return true;
|
|
13
25
|
}
|
|
14
|
-
|
|
15
|
-
if (field.type !== 'String') {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
const uuidFieldPatterns = [
|
|
19
|
-
/^id$/, // Primary ID fields
|
|
20
|
-
/_id$/, // Foreign key ID fields
|
|
21
|
-
/^.*_uuid$/, // uuid suffix
|
|
22
|
-
/^uuid$/, // Direct uuid fields
|
|
23
|
-
];
|
|
24
|
-
return uuidFieldPatterns.some((pattern) => pattern.test(field.name));
|
|
26
|
+
return false;
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
29
|
* Get the database column name for a field (respects @map directive)
|
package/dist/prisma/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/prisma/type.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/prisma/type.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,WAAW,CAAC,KAAiB;IAC3C,8DAA8D;IAC9D,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;QACrC,OAAO,IAAI,CA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