@prisma/orm-target-postgres 8.0.0-rc.21-dev.17 → 8.0.0-rc.21-dev.18
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/dist/{adapter-DJoHcCZV-CWdrs4yI.mjs → adapter-DJoHcCZV-B6ixkVJl.mjs} +3 -3
- package/dist/{adapter-DJoHcCZV-CWdrs4yI.mjs.map → adapter-DJoHcCZV-B6ixkVJl.mjs.map} +1 -1
- package/dist/adapter.mjs +3 -3
- package/dist/adapter__adapter.mjs +2 -2
- package/dist/adapter__control.mjs +3 -3
- package/dist/adapter__runtime.mjs +4 -3
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/{codec-registry-D-bD-lFp-BCSmwfrE.mjs → codec-registry-CdaRA3IV-xihQy4jg.mjs} +4 -12
- package/dist/codec-registry-CdaRA3IV-xihQy4jg.mjs.map +1 -0
- package/dist/{contract-contributions-DS1YZqxl-CipEzWQj.mjs → contract-contributions-DS1YZqxl-B1ZaAkPj.mjs} +2 -2
- package/dist/{contract-contributions-DS1YZqxl-CipEzWQj.mjs.map → contract-contributions-DS1YZqxl-B1ZaAkPj.mjs.map} +1 -1
- package/dist/{descriptor-meta-5gncreHF-BD1kpxJu.mjs → descriptor-meta-5gncreHF-Ddhsf2ah.mjs} +3 -3
- package/dist/{descriptor-meta-5gncreHF-BD1kpxJu.mjs.map → descriptor-meta-5gncreHF-Ddhsf2ah.mjs.map} +1 -1
- package/dist/{descriptor-meta-CszCf4Hs-DVGeuxNv.mjs → descriptor-meta-PgoH1VQ4-B1jIQ7fO.mjs} +90 -5
- package/dist/descriptor-meta-PgoH1VQ4-B1jIQ7fO.mjs.map +1 -0
- package/dist/{infer-psl-contract-BP2DgxTx-BqV8gUu4.mjs → infer-psl-contract-BMId3JOv-C60JxHhw.mjs} +4 -4
- package/dist/{infer-psl-contract-BP2DgxTx-BqV8gUu4.mjs.map → infer-psl-contract-BMId3JOv-C60JxHhw.mjs.map} +1 -1
- package/dist/migration-Be_iuIpn.mjs.map +1 -1
- package/dist/{pack-DhZHVCZj.d.mts → pack-ClOo5FU_.d.mts} +2 -1
- package/dist/{pack-DhZHVCZj.d.mts.map → pack-ClOo5FU_.d.mts.map} +1 -1
- package/dist/{planner-D1mzh6Cb-B1Z2YTiQ.mjs → planner-CDm2HgFf-B_21J0On.mjs} +4 -4
- package/dist/{planner-D1mzh6Cb-B1Z2YTiQ.mjs.map → planner-CDm2HgFf-B_21J0On.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-Cw8gbwED-tyj9TLlB.mjs → planner-produced-postgres-migration-CY_oA2Cg-BPAYFkog.mjs} +3 -3
- package/dist/{planner-produced-postgres-migration-Cw8gbwED-tyj9TLlB.mjs.map → planner-produced-postgres-migration-CY_oA2Cg-BPAYFkog.mjs.map} +1 -1
- package/dist/{postgres-contract-view-iwNgaXQw-QzVSakJT.mjs → postgres-contract-view-CjaULiD8-u4IOYsAL.mjs} +3 -3
- package/dist/{postgres-contract-view-iwNgaXQw-QzVSakJT.mjs.map → postgres-contract-view-CjaULiD8-u4IOYsAL.mjs.map} +1 -1
- package/dist/{postgres-migration-BhijSOgq-CP_oflub.mjs → postgres-migration-Dpq0EQUr-Ck9zs-fY.mjs} +3 -3
- package/dist/{postgres-migration-BhijSOgq-CP_oflub.mjs.map → postgres-migration-Dpq0EQUr-Ck9zs-fY.mjs.map} +1 -1
- package/dist/{prisma7-binding-DWW3L3C4.mjs → prisma7-binding--jMCU4Gy.mjs} +4 -87
- package/dist/prisma7-binding--jMCU4Gy.mjs.map +1 -0
- package/dist/{prisma7-binding-C99OHIsY.d.mts → prisma7-binding-_yXlIwi0.d.mts} +2 -1
- package/dist/{prisma7-binding-C99OHIsY.d.mts.map → prisma7-binding-_yXlIwi0.d.mts.map} +1 -1
- package/dist/registry-DHzMw0It-CWaFrPqq.mjs +15 -0
- package/dist/registry-DHzMw0It-CWaFrPqq.mjs.map +1 -0
- package/dist/target.d.mts +2 -2
- package/dist/target.mjs +7 -6
- package/dist/target__codecs.mjs +2 -1
- package/dist/target__control.mjs +6 -6
- package/dist/target__control.mjs.map +1 -1
- package/dist/target__migration.mjs +1 -1
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-produced-postgres-migration.mjs +1 -1
- package/dist/target__planner.mjs +1 -1
- package/dist/target__prisma7-binding.d.mts +1 -1
- package/dist/target__prisma7-binding.mjs +1 -1
- package/dist/target__runtime.mjs +1 -1
- package/dist/target__runtime.mjs.map +1 -1
- package/package.json +9 -9
- package/dist/codec-registry-D-bD-lFp-BCSmwfrE.mjs.map +0 -1
- package/dist/descriptor-meta-CszCf4Hs-DVGeuxNv.mjs.map +0 -1
- package/dist/prisma7-binding-DWW3L3C4.mjs.map +0 -1
package/dist/{descriptor-meta-CszCf4Hs-DVGeuxNv.mjs → descriptor-meta-PgoH1VQ4-B1jIQ7fO.mjs}
RENAMED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { A as PG_TIMESTAMP_INSTANT_CODEC_ID, B as PG_VARCHAR_CODEC_ID, D as PG_TIMESTAMPTZ_STRING_CODEC_ID, E as PG_TIMESTAMPTZ_DATE_CODEC_ID, F as PG_TIME_TEMPORAL_CODEC_ID, M as PG_TIMESTAMP_TEMPORAL_CODEC_ID, N as PG_TIMETZ_CODEC_ID, O as PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID, P as PG_TIME_STRING_CODEC_ID, R as PG_UUID_CODEC_ID, T as PG_TEXT_CODEC_ID, a as PG_DATE_STRING_CODEC_ID, i as PG_CHAR_CODEC_ID, j as PG_TIMESTAMP_STRING_CODEC_ID, k as PG_TIMESTAMP_DATE_CODEC_ID, o as PG_DATE_TEMPORAL_CODEC_ID } from "./codec-ids-2htdtS66-CJPMZv1t.mjs";
|
|
2
|
-
import { D as pgInt4, rt as postgresTextDataTypes } from "./data-types-DHpMs3mz-BllVpLs5.mjs";
|
|
2
|
+
import { $ as pgVarchar, B as pgText, C as pgFloat4, D as pgInt4, E as pgInt2, H as pgTime, I as pgNumeric, J as pgTimetz, K as pgTimestamptz, M as pgJsonb, O as pgInt8, P as pgMoney, Q as pgVarbit, R as pgOid, T as pgInet, W as pgTimestamp, Z as pgUuid, _ as pgChar, d as pgBit, et as pgXml, j as pgJson, m as pgBytea, p as pgBool, rt as postgresTextDataTypes, tt as postgresDataTypes, w as pgFloat8, y as pgDate } from "./data-types-DHpMs3mz-BllVpLs5.mjs";
|
|
3
3
|
import { t as DEFAULT_NAMESPACE_ID } from "./namespace-ids-xtp_ZY86-Cxc0dBbO.mjs";
|
|
4
4
|
import { U as postgresQualifyColumnType } from "./codecs-BtalD4yQ-BVQxal3w.mjs";
|
|
5
|
+
import { t as postgresCodecDescriptorRegistry } from "./registry-DHzMw0It-CWaFrPqq.mjs";
|
|
5
6
|
import { v as postgresCreateNamespace } from "./postgres-schema-BBWgs4fX-DWdYxNi8.mjs";
|
|
6
7
|
import { a as postgresAuthoringTypes, c as postgresScalarAndNativeTypeConstructors, i as postgresAuthoringPslBlockDescriptors, n as postgresAuthoringEntityTypes, o as postgresLowerEntityHandles, r as postgresAuthoringModelAttributes } from "./authoring-BFb5LVsK-CkHmM-aP.mjs";
|
|
7
8
|
import { t as postgresRenderCheckExpressions } from "./check-expressions-DL9WtMO5-CUcbN2JG.mjs";
|
|
8
9
|
import { a as PLAIN_TIME_NOW_GENERATOR_ID, c as TIMETZ_NOW_GENERATOR_ID, f as postgresTargetDescriptorMetaRuntime, i as PLAIN_DATE_TIME_NOW_GENERATOR_ID, l as TIME_STRING_NOW_GENERATOR_ID, n as INSTANT_NOW_GENERATOR_ID, o as TIMESTAMPTZ_STRING_NOW_GENERATOR_ID, r as PLAIN_DATE_NOW_GENERATOR_ID, s as TIMESTAMP_STRING_NOW_GENERATOR_ID, t as DATE_STRING_NOW_GENERATOR_ID, u as postgresNowGeneratorControlDescriptors } from "./date-time-now-generators-CEqbD2GP-B95xid7h.mjs";
|
|
9
10
|
import { t as postgresDataTypeEntries } from "./data-type-entries-Df5SOplt-DHEaXqF0.mjs";
|
|
10
11
|
import { n as postgresIndexTypes } from "./index-types-B5sQ5Vw0-DfXKO9-v.mjs";
|
|
12
|
+
import { createDataTypeLookup } from "@prisma/orm-framework/components/codec";
|
|
13
|
+
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
11
14
|
import { idGeneratorFunctionBindings, sqlIntegerArgumentGeneratorFunctions } from "@prisma/orm-family-sql/family/pack";
|
|
12
|
-
import { TIMESTAMP_NOW_GENERATOR_ID } from "@prisma/orm-framework/components/authoring";
|
|
15
|
+
import { TIMESTAMP_NOW_GENERATOR_ID, authoringTypeConstructorArguments } from "@prisma/orm-framework/components/authoring";
|
|
13
16
|
import { singleGeneratorBinding } from "@prisma/orm-framework/components/components";
|
|
14
|
-
|
|
17
|
+
import { inferredTypeConstructors } from "@prisma/orm-family-sql/family/psl-build";
|
|
18
|
+
//#region ../../../3-targets/postgres/1-target/dist/descriptor-meta-PgoH1VQ4.mjs
|
|
15
19
|
/** The "now" generator for each codec that has one. The `now` generator function binds it. */
|
|
16
20
|
const postgresNowGeneratorIds = {
|
|
17
21
|
[PG_DATE_TEMPORAL_CODEC_ID]: PLAIN_DATE_NOW_GENERATOR_ID,
|
|
@@ -67,6 +71,86 @@ const postgresGeneratorFunctions = [
|
|
|
67
71
|
];
|
|
68
72
|
/** The `now` generators Postgres binds. The SQL family registers the identifier generators. */
|
|
69
73
|
const postgresGeneratorDescriptors = [{ id: TIMESTAMP_NOW_GENERATOR_ID }, ...postgresNowGeneratorControlDescriptors()];
|
|
74
|
+
const of = (type, params = {}) => ({
|
|
75
|
+
dataType: type.id,
|
|
76
|
+
params
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* What Prisma 7.10.0 creates in Postgres for each Prisma 7 scalar and `@db.*` native type, as a data type and its parameters. Derived from the SQL recorded in `test/integration/test/fixtures/prisma7-source/reference/migration.sql`. A `@db.*` attribute's own arguments replace the parameters; without any, the column gets these, so `@db.Char` is the `character(1)` Postgres stores for Prisma 7's `CHAR`, and `@db.Bit` the `bit(1)` it stores for `BIT`.
|
|
80
|
+
*/
|
|
81
|
+
const prisma7PostgresTypes = {
|
|
82
|
+
scalars: {
|
|
83
|
+
String: of(pgText),
|
|
84
|
+
Boolean: of(pgBool),
|
|
85
|
+
Int: of(pgInt4),
|
|
86
|
+
BigInt: of(pgInt8),
|
|
87
|
+
Float: of(pgFloat8),
|
|
88
|
+
Decimal: of(pgNumeric, {
|
|
89
|
+
precision: 65,
|
|
90
|
+
scale: 30
|
|
91
|
+
}),
|
|
92
|
+
DateTime: of(pgTimestamp, { precision: 3 }),
|
|
93
|
+
Json: of(pgJsonb),
|
|
94
|
+
Bytes: of(pgBytea)
|
|
95
|
+
},
|
|
96
|
+
nativeTypes: {
|
|
97
|
+
Text: of(pgText),
|
|
98
|
+
VarChar: of(pgVarchar),
|
|
99
|
+
Char: of(pgChar, { length: 1 }),
|
|
100
|
+
Uuid: of(pgUuid),
|
|
101
|
+
Inet: of(pgInet),
|
|
102
|
+
Boolean: of(pgBool),
|
|
103
|
+
Integer: of(pgInt4),
|
|
104
|
+
SmallInt: of(pgInt2),
|
|
105
|
+
BigInt: of(pgInt8),
|
|
106
|
+
Real: of(pgFloat4),
|
|
107
|
+
DoublePrecision: of(pgFloat8),
|
|
108
|
+
Decimal: of(pgNumeric),
|
|
109
|
+
Timestamp: of(pgTimestamp),
|
|
110
|
+
Timestamptz: of(pgTimestamptz),
|
|
111
|
+
Date: of(pgDate),
|
|
112
|
+
Time: of(pgTime),
|
|
113
|
+
Timetz: of(pgTimetz),
|
|
114
|
+
Json: of(pgJson),
|
|
115
|
+
JsonB: of(pgJsonb),
|
|
116
|
+
ByteA: of(pgBytea),
|
|
117
|
+
Bit: of(pgBit, { length: 1 }),
|
|
118
|
+
VarBit: of(pgVarbit),
|
|
119
|
+
Xml: of(pgXml),
|
|
120
|
+
Oid: of(pgOid),
|
|
121
|
+
Money: of(pgMoney)
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const marked = inferredTypeConstructors({
|
|
125
|
+
authoringTypes: postgresScalarAndNativeTypeConstructors,
|
|
126
|
+
codecLookup: postgresCodecDescriptorRegistry,
|
|
127
|
+
dataTypeLookup: createDataTypeLookup(postgresDataTypes)
|
|
128
|
+
});
|
|
129
|
+
/**
|
|
130
|
+
* The constructor marked `inferred` for the column's data type, with every parameter Prisma 7 gives the column as an argument. The reader builds a contract, so it keeps each parameter rather than the fewest arguments printed PSL writes.
|
|
131
|
+
*/
|
|
132
|
+
function mappingOf({ dataType, params }) {
|
|
133
|
+
const markedConstructor = marked.get(dataType);
|
|
134
|
+
const args = markedConstructor === void 0 ? void 0 : authoringTypeConstructorArguments(markedConstructor.descriptor, {
|
|
135
|
+
codecId: markedConstructor.descriptor.output.codecId,
|
|
136
|
+
typeParams: params
|
|
137
|
+
});
|
|
138
|
+
if (markedConstructor === void 0 || args === void 0) throw new InternalError(`No constructor marked inferred writes ${dataType} with these parameters.`);
|
|
139
|
+
return {
|
|
140
|
+
constructorName: markedConstructor.path.join("."),
|
|
141
|
+
args
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function mappingsOf(types) {
|
|
145
|
+
return Object.fromEntries(Object.entries(types).map(([name, type]) => [name, mappingOf(type)]));
|
|
146
|
+
}
|
|
147
|
+
/** {@link prisma7PostgresTypes} as the Prisma 7 reader takes it: each type's constructor call. */
|
|
148
|
+
const prisma7PostgresTypeMap = {
|
|
149
|
+
scalars: mappingsOf(prisma7PostgresTypes.scalars),
|
|
150
|
+
nativeTypes: mappingsOf(prisma7PostgresTypes.nativeTypes)
|
|
151
|
+
};
|
|
152
|
+
/** The Prisma 7 `@db.*` names whose Prisma 8 constructor has another name, such as `Text` to `String`. */
|
|
153
|
+
const prisma7PostgresRenamedNativeTypes = Object.fromEntries(Object.entries(prisma7PostgresTypeMap.nativeTypes).flatMap(([name, { constructorName }]) => constructorName === name ? [] : [[name, constructorName]]));
|
|
70
154
|
const postgresTargetDescriptorMeta = {
|
|
71
155
|
...postgresTargetDescriptorMetaRuntime,
|
|
72
156
|
defaultNamespaceId: DEFAULT_NAMESPACE_ID,
|
|
@@ -80,6 +164,7 @@ const postgresTargetDescriptorMeta = {
|
|
|
80
164
|
},
|
|
81
165
|
dataTypes: postgresDataTypeEntries(),
|
|
82
166
|
textDataTypes: postgresTextDataTypes,
|
|
167
|
+
renamedTypeConstructors: prisma7PostgresRenamedNativeTypes,
|
|
83
168
|
entityTypes: postgresAuthoringEntityTypes,
|
|
84
169
|
pslBlockDescriptors: postgresAuthoringPslBlockDescriptors,
|
|
85
170
|
modelAttributes: postgresAuthoringModelAttributes,
|
|
@@ -100,6 +185,6 @@ const postgresTargetDescriptorMeta = {
|
|
|
100
185
|
} } }
|
|
101
186
|
};
|
|
102
187
|
//#endregion
|
|
103
|
-
export { postgresTargetDescriptorMeta as t };
|
|
188
|
+
export { prisma7PostgresTypeMap as n, postgresTargetDescriptorMeta as t };
|
|
104
189
|
|
|
105
|
-
//# sourceMappingURL=descriptor-meta-
|
|
190
|
+
//# sourceMappingURL=descriptor-meta-PgoH1VQ4-B1jIQ7fO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor-meta-PgoH1VQ4-B1jIQ7fO.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/descriptor-meta-PgoH1VQ4.mjs"],"sourcesContent":["import { A as PG_TIMESTAMP_INSTANT_CODEC_ID, B as PG_VARCHAR_CODEC_ID, D as PG_TIMESTAMPTZ_STRING_CODEC_ID, E as PG_TIMESTAMPTZ_DATE_CODEC_ID, F as PG_TIME_TEMPORAL_CODEC_ID, M as PG_TIMESTAMP_TEMPORAL_CODEC_ID, N as PG_TIMETZ_CODEC_ID, O as PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID, P as PG_TIME_STRING_CODEC_ID, R as PG_UUID_CODEC_ID, T as PG_TEXT_CODEC_ID, a as PG_DATE_STRING_CODEC_ID, i as PG_CHAR_CODEC_ID, j as PG_TIMESTAMP_STRING_CODEC_ID, k as PG_TIMESTAMP_DATE_CODEC_ID, o as PG_DATE_TEMPORAL_CODEC_ID } from \"./codec-ids-2htdtS66.mjs\";\nimport { A as pgText, E as pgNumeric, G as postgresDataTypes, H as pgVarbit, I as pgTimestamptz, K as postgresTextDataTypes, M as pgTime, O as pgOid, P as pgTimestamp, R as pgTimetz, S as pgJsonb, U as pgVarchar, V as pgUuid, W as pgXml, _ as pgInt2, c as pgChar, g as pgInet, h as pgFloat8, i as pgBit, m as pgFloat4, o as pgBool, s as pgBytea, u as pgDate, v as pgInt4, w as pgMoney, x as pgJson, y as pgInt8 } from \"./data-types-DHpMs3mz.mjs\";\nimport { t as postgresDataTypeEntries } from \"./data-type-entries-Df5SOplt.mjs\";\nimport { k as postgresQualifyColumnType } from \"./codecs-BtalD4yQ.mjs\";\nimport { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { t as postgresCodecDescriptorRegistry } from \"./registry-DHzMw0It.mjs\";\nimport { i as postgresCreateNamespace } from \"./postgres-schema-BBWgs4fX.mjs\";\nimport { a as postgresAuthoringTypes, c as postgresScalarAndNativeTypeConstructors, i as postgresAuthoringPslBlockDescriptors, n as postgresAuthoringEntityTypes, o as postgresLowerEntityHandles, r as postgresAuthoringModelAttributes } from \"./authoring-BFb5LVsK.mjs\";\nimport { t as postgresRenderCheckExpressions } from \"./check-expressions-DL9WtMO5.mjs\";\nimport { a as PLAIN_TIME_NOW_GENERATOR_ID, c as TIMETZ_NOW_GENERATOR_ID, f as postgresTargetDescriptorMetaRuntime, i as PLAIN_DATE_TIME_NOW_GENERATOR_ID, l as TIME_STRING_NOW_GENERATOR_ID, n as INSTANT_NOW_GENERATOR_ID, o as TIMESTAMPTZ_STRING_NOW_GENERATOR_ID, r as PLAIN_DATE_NOW_GENERATOR_ID, s as TIMESTAMP_STRING_NOW_GENERATOR_ID, t as DATE_STRING_NOW_GENERATOR_ID, u as postgresNowGeneratorControlDescriptors } from \"./date-time-now-generators-CEqbD2GP.mjs\";\nimport { n as postgresIndexTypes } from \"./index-types-B5sQ5Vw0.mjs\";\nimport { createDataTypeLookup } from \"@internal/framework-components/codec\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { idGeneratorFunctionBindings, sqlIntegerArgumentGeneratorFunctions } from \"@internal/family-sql/pack\";\nimport { TIMESTAMP_NOW_GENERATOR_ID, authoringTypeConstructorArguments } from \"@internal/framework-components/authoring\";\nimport { singleGeneratorBinding } from \"@internal/framework-components/components\";\nimport { inferredTypeConstructors } from \"@internal/family-sql/psl-build\";\n//#region src/core/now-generators.ts\n/** The \"now\" generator for each codec that has one. The `now` generator function binds it. */\nconst postgresNowGeneratorIds = {\n\t[PG_DATE_TEMPORAL_CODEC_ID]: PLAIN_DATE_NOW_GENERATOR_ID,\n\t[PG_DATE_STRING_CODEC_ID]: DATE_STRING_NOW_GENERATOR_ID,\n\t[PG_TIME_TEMPORAL_CODEC_ID]: PLAIN_TIME_NOW_GENERATOR_ID,\n\t[PG_TIME_STRING_CODEC_ID]: TIME_STRING_NOW_GENERATOR_ID,\n\t[PG_TIMETZ_CODEC_ID]: TIMETZ_NOW_GENERATOR_ID,\n\t[PG_TIMESTAMP_TEMPORAL_CODEC_ID]: PLAIN_DATE_TIME_NOW_GENERATOR_ID,\n\t[PG_TIMESTAMP_STRING_CODEC_ID]: TIMESTAMP_STRING_NOW_GENERATOR_ID,\n\t[PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID]: INSTANT_NOW_GENERATOR_ID,\n\t[PG_TIMESTAMPTZ_STRING_CODEC_ID]: TIMESTAMPTZ_STRING_NOW_GENERATOR_ID,\n\t[PG_TIMESTAMPTZ_DATE_CODEC_ID]: TIMESTAMP_NOW_GENERATOR_ID,\n\t[PG_TIMESTAMP_DATE_CODEC_ID]: TIMESTAMP_NOW_GENERATOR_ID,\n\t[PG_TIMESTAMP_INSTANT_CODEC_ID]: INSTANT_NOW_GENERATOR_ID\n};\nnew Map(Object.entries(postgresNowGeneratorIds));\n/** The codecs whose \"now\" generator takes the column's precision and rounds down to it, so PostgreSQL stores the value the client holds rather than rounding it up, which for a time can reach `24:00:00`. */\nconst postgresNowGeneratorTakesPrecision = {\n\t[PG_TIME_TEMPORAL_CODEC_ID]: true,\n\t[PG_TIME_STRING_CODEC_ID]: true,\n\t[PG_TIMETZ_CODEC_ID]: true,\n\t[PG_TIMESTAMP_STRING_CODEC_ID]: true,\n\t[PG_TIMESTAMPTZ_STRING_CODEC_ID]: true,\n\t[PG_TIMESTAMPTZ_DATE_CODEC_ID]: true,\n\t[PG_TIMESTAMP_DATE_CODEC_ID]: true,\n\t[PG_TIMESTAMP_TEMPORAL_CODEC_ID]: true,\n\t[PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID]: true,\n\t[PG_TIMESTAMP_INSTANT_CODEC_ID]: true\n};\n/** The `now` generator function bound to each Postgres date and time codec, with the column's precision on the codecs that take it. */\nconst postgresNowGeneratorFunction = {\n\tname: \"now\",\n\tbindings: Object.entries(postgresNowGeneratorIds).map(([codecId, generatorId]) => singleGeneratorBinding({\n\t\tcodecIds: [codecId],\n\t\tgeneratorId,\n\t\tparamsFromField: (column) => {\n\t\t\tconst precision = column.typeParams?.[\"precision\"];\n\t\t\treturn Object.hasOwn(postgresNowGeneratorTakesPrecision, codecId) && typeof precision === \"number\" ? { precision } : void 0;\n\t\t}\n\t}))\n};\n//#endregion\n//#region src/core/generator-functions.ts\nconst postgresGeneratorFunctions = [\n\t...sqlIntegerArgumentGeneratorFunctions({ integer: pgInt4.id }),\n\tpostgresNowGeneratorFunction,\n\t...idGeneratorFunctionBindings({\n\t\ttext: [\n\t\t\tPG_CHAR_CODEC_ID,\n\t\t\tPG_VARCHAR_CODEC_ID,\n\t\t\tPG_TEXT_CODEC_ID\n\t\t],\n\t\tuuid: [PG_UUID_CODEC_ID]\n\t})\n];\n/** The `now` generators Postgres binds. The SQL family registers the identifier generators. */\nconst postgresGeneratorDescriptors = [{ id: TIMESTAMP_NOW_GENERATOR_ID }, ...postgresNowGeneratorControlDescriptors()];\n//#endregion\n//#region src/core/prisma7-type-map.ts\nconst of = (type, params = {}) => ({\n\tdataType: type.id,\n\tparams\n});\n/**\n* What Prisma 7.10.0 creates in Postgres for each Prisma 7 scalar and `@db.*` native type, as a data type and its parameters. Derived from the SQL recorded in `test/integration/test/fixtures/prisma7-source/reference/migration.sql`. A `@db.*` attribute's own arguments replace the parameters; without any, the column gets these, so `@db.Char` is the `character(1)` Postgres stores for Prisma 7's `CHAR`, and `@db.Bit` the `bit(1)` it stores for `BIT`.\n*/\nconst prisma7PostgresTypes = {\n\tscalars: {\n\t\tString: of(pgText),\n\t\tBoolean: of(pgBool),\n\t\tInt: of(pgInt4),\n\t\tBigInt: of(pgInt8),\n\t\tFloat: of(pgFloat8),\n\t\tDecimal: of(pgNumeric, {\n\t\t\tprecision: 65,\n\t\t\tscale: 30\n\t\t}),\n\t\tDateTime: of(pgTimestamp, { precision: 3 }),\n\t\tJson: of(pgJsonb),\n\t\tBytes: of(pgBytea)\n\t},\n\tnativeTypes: {\n\t\tText: of(pgText),\n\t\tVarChar: of(pgVarchar),\n\t\tChar: of(pgChar, { length: 1 }),\n\t\tUuid: of(pgUuid),\n\t\tInet: of(pgInet),\n\t\tBoolean: of(pgBool),\n\t\tInteger: of(pgInt4),\n\t\tSmallInt: of(pgInt2),\n\t\tBigInt: of(pgInt8),\n\t\tReal: of(pgFloat4),\n\t\tDoublePrecision: of(pgFloat8),\n\t\tDecimal: of(pgNumeric),\n\t\tTimestamp: of(pgTimestamp),\n\t\tTimestamptz: of(pgTimestamptz),\n\t\tDate: of(pgDate),\n\t\tTime: of(pgTime),\n\t\tTimetz: of(pgTimetz),\n\t\tJson: of(pgJson),\n\t\tJsonB: of(pgJsonb),\n\t\tByteA: of(pgBytea),\n\t\tBit: of(pgBit, { length: 1 }),\n\t\tVarBit: of(pgVarbit),\n\t\tXml: of(pgXml),\n\t\tOid: of(pgOid),\n\t\tMoney: of(pgMoney)\n\t}\n};\nconst marked = inferredTypeConstructors({\n\tauthoringTypes: postgresScalarAndNativeTypeConstructors,\n\tcodecLookup: postgresCodecDescriptorRegistry,\n\tdataTypeLookup: createDataTypeLookup(postgresDataTypes)\n});\n/**\n* The constructor marked `inferred` for the column's data type, with every parameter Prisma 7 gives the column as an argument. The reader builds a contract, so it keeps each parameter rather than the fewest arguments printed PSL writes.\n*/\nfunction mappingOf({ dataType, params }) {\n\tconst markedConstructor = marked.get(dataType);\n\tconst args = markedConstructor === void 0 ? void 0 : authoringTypeConstructorArguments(markedConstructor.descriptor, {\n\t\tcodecId: markedConstructor.descriptor.output.codecId,\n\t\ttypeParams: params\n\t});\n\tif (markedConstructor === void 0 || args === void 0) throw new InternalError(`No constructor marked inferred writes ${dataType} with these parameters.`);\n\treturn {\n\t\tconstructorName: markedConstructor.path.join(\".\"),\n\t\targs\n\t};\n}\nfunction mappingsOf(types) {\n\treturn Object.fromEntries(Object.entries(types).map(([name, type]) => [name, mappingOf(type)]));\n}\n/** {@link prisma7PostgresTypes} as the Prisma 7 reader takes it: each type's constructor call. */\nconst prisma7PostgresTypeMap = {\n\tscalars: mappingsOf(prisma7PostgresTypes.scalars),\n\tnativeTypes: mappingsOf(prisma7PostgresTypes.nativeTypes)\n};\n/** The Prisma 7 `@db.*` names whose Prisma 8 constructor has another name, such as `Text` to `String`. */\nconst prisma7PostgresRenamedNativeTypes = Object.fromEntries(Object.entries(prisma7PostgresTypeMap.nativeTypes).flatMap(([name, { constructorName }]) => constructorName === name ? [] : [[name, constructorName]]));\nconst postgresTargetDescriptorMeta = {\n\t...postgresTargetDescriptorMetaRuntime,\n\tdefaultNamespaceId: DEFAULT_NAMESPACE_ID,\n\tsupportsNamespaces: true,\n\tdisplayName: \"Postgres\",\n\tindexTypes: postgresIndexTypes,\n\tauthoring: {\n\t\ttype: {\n\t\t\t...postgresScalarAndNativeTypeConstructors,\n\t\t\t...postgresAuthoringTypes\n\t\t},\n\t\tdataTypes: postgresDataTypeEntries(),\n\t\ttextDataTypes: postgresTextDataTypes,\n\t\trenamedTypeConstructors: prisma7PostgresRenamedNativeTypes,\n\t\tentityTypes: postgresAuthoringEntityTypes,\n\t\tpslBlockDescriptors: postgresAuthoringPslBlockDescriptors,\n\t\tmodelAttributes: postgresAuthoringModelAttributes,\n\t\tcreateNamespace: postgresCreateNamespace,\n\t\tqualifyColumnType: postgresQualifyColumnType,\n\t\trenderCheckExpressions: postgresRenderCheckExpressions,\n\t\tlowerEntityHandles: postgresLowerEntityHandles\n\t},\n\tgeneratorFunctions: postgresGeneratorFunctions,\n\tcontrolMutationDefaults: {\n\t\tdefaultFunctionRegistry: /* @__PURE__ */ new Map(),\n\t\tgeneratorDescriptors: postgresGeneratorDescriptors\n\t},\n\ttypes: { queryOperationTypes: { import: {\n\t\tpackage: \"@internal/target-postgres/operation-types\",\n\t\tnamed: \"QueryOperationTypes\",\n\t\talias: \"PgTargetQueryOps\"\n\t} } }\n};\n//#endregion\nexport { prisma7PostgresTypeMap as n, postgresTargetDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-PgoH1VQ4.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAM,0BAA0B;EAC9B,4BAA4B;EAC5B,0BAA0B;EAC1B,4BAA4B;EAC5B,0BAA0B;EAC1B,qBAAqB;EACrB,iCAAiC;EACjC,+BAA+B;EAC/B,mCAAmC;EACnC,iCAAiC;EACjC,+BAA+B;EAC/B,6BAA6B;EAC7B,gCAAgC;AAClC;AACA,IAAI,IAAI,OAAO,QAAQ,uBAAuB,CAAC;;AAE/C,MAAM,qCAAqC;EACzC,4BAA4B;EAC5B,0BAA0B;EAC1B,qBAAqB;EACrB,+BAA+B;EAC/B,iCAAiC;EACjC,+BAA+B;EAC/B,6BAA6B;EAC7B,iCAAiC;EACjC,mCAAmC;EACnC,gCAAgC;AAClC;;AAEA,MAA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AAC,MAAM,eAAe,CAAC,CAAC,CAAC;AACnN,MAAM,+BAA+B;CACpC,GAAG;CACH,oBAAoB;CACpB,oBAAoB;CACpB,aAAa;CACb,YAAY;CACZ,WAAW;EACV,MAAM;GACL,GAAG;GACH,GAAG;EACJ;EACA,WAAW,wBAAwB;EACnC,eAAe;EACf,yBAAyB;EACzB,aAAa;EACb,qBAAqB;EACrB,iBAAiB;EACjB,iBAAiB;EACjB,mBAAmB;EACnB,wBAAwB;EACxB,oBAAoB;CACrB;CACA,oBAAoB;CACpB,yBAAyB;EACxB,yCAAyC,IAAI,IAAI;EACjD,sBAAsB;CACvB;CACA,OAAO,EAAE,qBAAqB,EAAE,QAAQ;EACvC,SAAS;EACT,OAAO;EACP,OAAO;CACR,EAAE,EAAE;AACL"}
|
package/dist/{infer-psl-contract-BP2DgxTx-BqV8gUu4.mjs → infer-psl-contract-BMId3JOv-C60JxHhw.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { T as PG_TEXT_CODEC_ID } from "./codec-ids-2htdtS66-CJPMZv1t.mjs";
|
|
2
2
|
import { u as postgresError } from "./errors-DpdPXR_L-DailcY-X.mjs";
|
|
3
3
|
import { M as pgJsonb, i as createPostgresBuiltinDataTypeLookup, j as pgJson } from "./data-types-DHpMs3mz-BllVpLs5.mjs";
|
|
4
|
-
import { r as createPostgresBuiltinCodecLookup } from "./codec-registry-
|
|
4
|
+
import { r as createPostgresBuiltinCodecLookup } from "./codec-registry-CdaRA3IV-xihQy4jg.mjs";
|
|
5
5
|
import { t as POLICY_BLOCK_KEYWORDS } from "./authoring-BFb5LVsK-CkHmM-aP.mjs";
|
|
6
6
|
import { t as postgresRenderCheckExpressions } from "./check-expressions-DL9WtMO5-CUcbN2JG.mjs";
|
|
7
7
|
import { t as postgresDataTypeEntries } from "./data-type-entries-Df5SOplt-DHEaXqF0.mjs";
|
|
@@ -16,14 +16,14 @@ import { composeCheckWirePrefix, computeCheckContentHash, computeIndexContentHas
|
|
|
16
16
|
import { getAuthoringTypeConstructor, instantiateAuthoringTypeConstructor, validateAuthoringHelperArguments } from "@prisma/orm-framework/components/authoring";
|
|
17
17
|
import { NAME_THE_PSL_SOURCE_LOSES, isPslIdentifier } from "@prisma/orm-framework/psl-parser";
|
|
18
18
|
import { printSqlExpressionLiteral, sqlTextsReadBack, storedSqlText } from "@prisma/orm-family-sql/contract/sql-expression";
|
|
19
|
+
import { inferColumnTypes, inferredTypeConstructors, mapDefault, toEnumMemberName } from "@prisma/orm-family-sql/family/psl-build";
|
|
19
20
|
import { SqlSchemaIR, SqlTableIR } from "@prisma/orm-family-sql/schema-ir/types";
|
|
20
21
|
import { readReportedDefault } from "@prisma/orm-family-sql/family/control";
|
|
21
22
|
import { isColumnDefault } from "@prisma/orm-framework/contract/types";
|
|
22
|
-
import { inferColumnTypes, inferredTypeConstructors, mapDefault, toEnumMemberName } from "@prisma/orm-family-sql/family/psl-build";
|
|
23
23
|
import { buildChildRelationField, deriveRelationFieldName, inferRelations, toEnumName, toFieldName, toModelName } from "@prisma/orm-family-sql/family/psl-infer";
|
|
24
24
|
import { UNSPECIFIED_PSL_NAMESPACE_ID, makePslNamespace, makePslNamespaceEntries } from "@prisma/orm-framework/components/psl-ast";
|
|
25
25
|
import { escapePslString } from "@prisma/orm-family-sql/contract/data-type-support";
|
|
26
|
-
//#region ../../../3-targets/postgres/1-target/dist/infer-psl-contract-
|
|
26
|
+
//#region ../../../3-targets/postgres/1-target/dist/infer-psl-contract-BMId3JOv.mjs
|
|
27
27
|
const SYNTHETIC_SPAN = {
|
|
28
28
|
start: {
|
|
29
29
|
offset: 0,
|
|
@@ -1234,4 +1234,4 @@ function buildPslDocumentAst(schemaIR, options, foreignKeyExtras, namespaceName,
|
|
|
1234
1234
|
//#endregion
|
|
1235
1235
|
export { positionalArg as _, buildFullTextIndexAttribute as a, buildModelConstraintAttribute as c, createPostgresDefaultMapping as d, inferPostgresPslContract as f, parseDefaultAttributeString as g, noInferredDefaults as h, buildExtensionBlock as i, buildNativeEnumBlock as l, noColumnDefaults as m, buildAttribute as n, buildIndexAttribute as o, namedArg as p, buildCheckAttribute as r, buildMapAttribute as s, SYNTHETIC_SPAN as t, buildPslDocumentAst as u, typeArgument as v };
|
|
1236
1236
|
|
|
1237
|
-
//# sourceMappingURL=infer-psl-contract-
|
|
1237
|
+
//# sourceMappingURL=infer-psl-contract-BMId3JOv-C60JxHhw.mjs.map
|