@shivaedev/effect-prisma 0.4.2 → 0.4.3
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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-normalization.d.ts","sourceRoot":"","sources":["../../src/internal/contract-normalization.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contract-normalization.d.ts","sourceRoot":"","sources":["../../src/internal/contract-normalization.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,gCAAgC,GAAI,QAAQ,MAAM,KAAG,MAYjE,CAAC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
const timestampReference = /\b(?:Timestamp|Timestamptz)<(?:\d+|undefined)>/g;
|
|
2
|
+
const timestampCodecReference = /\bCodecTypes\['pg\/(?:timestamp|timestamptz)@1'\]\['(?:input|output)'\]/g;
|
|
2
3
|
const unsupportedTimestampReference = /\b(?:Timestamp|Timestamptz)\s*</;
|
|
3
4
|
/**
|
|
4
5
|
* Align Prisma Next's generated PostgreSQL timestamp declarations with the
|
|
5
6
|
* JavaScript Dates accepted and returned by its runtime codecs.
|
|
6
7
|
*/
|
|
7
8
|
export const normalizePrismaNextContractTypes = (source) => {
|
|
8
|
-
const normalized = source
|
|
9
|
+
const normalized = source
|
|
10
|
+
.replaceAll(timestampReference, "Date")
|
|
11
|
+
.replaceAll(timestampCodecReference, "Date");
|
|
9
12
|
if (unsupportedTimestampReference.test(normalized)) {
|
|
10
13
|
throw new Error("Unsupported Prisma Next timestamp declaration; update effect-prisma before using this generated contract");
|
|
11
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-normalization.js","sourceRoot":"","sources":["../../src/internal/contract-normalization.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,iDAAiD,CAAC;AAC7E,MAAM,6BAA6B,GAAG,iCAAiC,CAAC;AAExE;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,MAAc,EAAU,EAAE;IAC1E,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"contract-normalization.js","sourceRoot":"","sources":["../../src/internal/contract-normalization.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,iDAAiD,CAAC;AAC7E,MAAM,uBAAuB,GAC5B,0EAA0E,CAAC;AAC5E,MAAM,6BAA6B,GAAG,iCAAiC,CAAC;AAExE;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,MAAc,EAAU,EAAE;IAC1E,MAAM,UAAU,GAAG,MAAM;SACvB,UAAU,CAAC,kBAAkB,EAAE,MAAM,CAAC;SACtC,UAAU,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;IAE9C,IAAI,6BAA6B,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CACd,0GAA0G,CAC1G,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const timestampReference = /\b(?:Timestamp|Timestamptz)<(?:\d+|undefined)>/g;
|
|
2
|
+
const timestampCodecReference =
|
|
3
|
+
/\bCodecTypes\['pg\/(?:timestamp|timestamptz)@1'\]\['(?:input|output)'\]/g;
|
|
2
4
|
const unsupportedTimestampReference = /\b(?:Timestamp|Timestamptz)\s*</;
|
|
3
5
|
|
|
4
6
|
/**
|
|
@@ -6,7 +8,9 @@ const unsupportedTimestampReference = /\b(?:Timestamp|Timestamptz)\s*</;
|
|
|
6
8
|
* JavaScript Dates accepted and returned by its runtime codecs.
|
|
7
9
|
*/
|
|
8
10
|
export const normalizePrismaNextContractTypes = (source: string): string => {
|
|
9
|
-
const normalized = source
|
|
11
|
+
const normalized = source
|
|
12
|
+
.replaceAll(timestampReference, "Date")
|
|
13
|
+
.replaceAll(timestampCodecReference, "Date");
|
|
10
14
|
|
|
11
15
|
if (unsupportedTimestampReference.test(normalized)) {
|
|
12
16
|
throw new Error(
|