@prisma/orm-target-postgres 8.0.0-rc.13-dev.10 → 8.0.0-rc.13-dev.12

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.
Files changed (104) hide show
  1. package/dist/{adapter-C5hgqLKn-BtBmUU0b.mjs → adapter-Bz6wSV__-Dp93eiiH.mjs} +5 -5
  2. package/dist/{adapter-C5hgqLKn-BtBmUU0b.mjs.map → adapter-Bz6wSV__-Dp93eiiH.mjs.map} +1 -1
  3. package/dist/adapter.mjs +4 -4
  4. package/dist/adapter__adapter.mjs +1 -1
  5. package/dist/adapter__control.mjs +5 -5
  6. package/dist/adapter__control.mjs.map +1 -1
  7. package/dist/adapter__runtime.mjs +5 -5
  8. package/dist/adapter__runtime.mjs.map +1 -1
  9. package/dist/adapter__sql-renderer.mjs +1 -1
  10. package/dist/{authoring-DR-vV7Oe-Dia02ZUn.mjs → authoring-BmQxOggr-CK871YR4.mjs} +5 -5
  11. package/dist/{authoring-DR-vV7Oe-Dia02ZUn.mjs.map → authoring-BmQxOggr-CK871YR4.mjs.map} +1 -1
  12. package/dist/{codecs-Bbq1Qd0E.mjs → codecs-C4DVdgQG.mjs} +2 -2
  13. package/dist/{codecs-Bbq1Qd0E.mjs.map → codecs-C4DVdgQG.mjs.map} +1 -1
  14. package/dist/{codecs-Cjg0_n_k-DYOs5mGX.mjs → codecs-DQGmsnk3-H6nVRPCC.mjs} +18 -322
  15. package/dist/codecs-DQGmsnk3-H6nVRPCC.mjs.map +1 -0
  16. package/dist/{contract-free-ChOK2nXj.mjs → contract-free-B2-ZWT2L.mjs} +3 -3
  17. package/dist/{contract-free-ChOK2nXj.mjs.map → contract-free-B2-ZWT2L.mjs.map} +1 -1
  18. package/dist/{control-eWYKnooD.mjs → control-CRBnDCvo.mjs} +13 -12
  19. package/dist/control-CRBnDCvo.mjs.map +1 -0
  20. package/dist/{control-adapter-R1knQpcm-BWchDHdA.mjs → control-adapter-Buuq3v1c-DtBZerak.mjs} +10 -7
  21. package/dist/control-adapter-Buuq3v1c-DtBZerak.mjs.map +1 -0
  22. package/dist/{control-policy-DTvHBZHr-DFVImL4U.mjs → control-policy-DhL42DkN-DQos5sxF.mjs} +32 -13
  23. package/dist/control-policy-DhL42DkN-DQos5sxF.mjs.map +1 -0
  24. package/dist/{data-type-entries-Fxm2HDZk-D4AAd63w.mjs → data-type-entries-C8mv_52T-C20A-LBv.mjs} +3 -3
  25. package/dist/{data-type-entries-Fxm2HDZk-D4AAd63w.mjs.map → data-type-entries-C8mv_52T-C20A-LBv.mjs.map} +1 -1
  26. package/dist/data-types-Cl18KnNY-5I34Vd6Z.mjs +527 -0
  27. package/dist/data-types-Cl18KnNY-5I34Vd6Z.mjs.map +1 -0
  28. package/dist/{data-types-DgHu2vHj.d.mts → data-types-DJQDcSAC.d.mts} +12 -3
  29. package/dist/data-types-DJQDcSAC.d.mts.map +1 -0
  30. package/dist/{ddl-CdYNv79D-BkbF3B6U.mjs → ddl-BEslwyjE-CzNPjhh1.mjs} +3 -3
  31. package/dist/{ddl-CdYNv79D-BkbF3B6U.mjs.map → ddl-BEslwyjE-CzNPjhh1.mjs.map} +1 -1
  32. package/dist/{descriptor-meta-D36nLZuR-QY3F6uZM.mjs → descriptor-meta-BOx9pvBv-C4TEXck8.mjs} +5 -5
  33. package/dist/{descriptor-meta-D36nLZuR-QY3F6uZM.mjs.map → descriptor-meta-BOx9pvBv-C4TEXck8.mjs.map} +1 -1
  34. package/dist/{descriptor-meta-F1wsOtt2-CYf99ii0.mjs → descriptor-meta-F1wsOtt2-D014LIGM.mjs} +4 -4
  35. package/dist/{descriptor-meta-F1wsOtt2-CYf99ii0.mjs.map → descriptor-meta-F1wsOtt2-D014LIGM.mjs.map} +1 -1
  36. package/dist/{diff-database-schema-DRnjx_iX-Dgq9Fy7W.mjs → diff-database-schema-CqSZ2bgz-z_s_wavu.mjs} +10 -8
  37. package/dist/diff-database-schema-CqSZ2bgz-z_s_wavu.mjs.map +1 -0
  38. package/dist/{full-text-index-expression-CNNmwcrv-DRxxHYER.mjs → full-text-index-expression-PZszha7L-CW7i1TUY.mjs} +3 -3
  39. package/dist/{full-text-index-expression-CNNmwcrv-DRxxHYER.mjs.map → full-text-index-expression-PZszha7L-CW7i1TUY.mjs.map} +1 -1
  40. package/dist/{infer-psl-contract-DdelifiM-DJrxQnO8.mjs → infer-psl-contract-BDvQidvc-B1573q4j.mjs} +12 -8
  41. package/dist/infer-psl-contract-BDvQidvc-B1573q4j.mjs.map +1 -0
  42. package/dist/migration-PTHAY9Cv.mjs.map +1 -1
  43. package/dist/{op-factory-call-Dk0FETtB-LFFyR0Ms.mjs → op-factory-call-BBkvFvKK-7MkUHWJq.mjs} +5 -5
  44. package/dist/{op-factory-call-Dk0FETtB-LFFyR0Ms.mjs.map → op-factory-call-BBkvFvKK-7MkUHWJq.mjs.map} +1 -1
  45. package/dist/{planner-QwQ_jaFa-D-Br4xMh.mjs → planner-CvwnV6pj-DJhKg-qi.mjs} +8 -8
  46. package/dist/{planner-QwQ_jaFa-D-Br4xMh.mjs.map → planner-CvwnV6pj-DJhKg-qi.mjs.map} +1 -1
  47. package/dist/planner-ddl-builders-BQ_1YXut.d.mts +38 -0
  48. package/dist/planner-ddl-builders-BQ_1YXut.d.mts.map +1 -0
  49. package/dist/{planner-ddl-builders-Clym-Rcr-CyoEX9P0.mjs → planner-ddl-builders-GTcVPpwb-ClvrXb26.mjs} +52 -15
  50. package/dist/planner-ddl-builders-GTcVPpwb-ClvrXb26.mjs.map +1 -0
  51. package/dist/{planner-produced-postgres-migration-CWKVp9z4-mAn9meQ4.mjs → planner-produced-postgres-migration-DEJQPRjI-C9GuvVOY.mjs} +3 -3
  52. package/dist/{planner-produced-postgres-migration-CWKVp9z4-mAn9meQ4.mjs.map → planner-produced-postgres-migration-DEJQPRjI-C9GuvVOY.mjs.map} +1 -1
  53. package/dist/{planner-sql-checks-D53iVGBI-B8TBz3ne.mjs → planner-sql-checks-Bd8nN9P8-Cd98iEee.mjs} +3 -3
  54. package/dist/{planner-sql-checks-D53iVGBI-B8TBz3ne.mjs.map → planner-sql-checks-Bd8nN9P8-Cd98iEee.mjs.map} +1 -1
  55. package/dist/{postgres-contract-view-IMfyoKFv-BV0ZQO14.mjs → postgres-contract-view-DxcRT-qe-LQBHHgaS.mjs} +4 -4
  56. package/dist/{postgres-contract-view-IMfyoKFv-BV0ZQO14.mjs.map → postgres-contract-view-DxcRT-qe-LQBHHgaS.mjs.map} +1 -1
  57. package/dist/{postgres-migration-KjQ2KhZN-BEOLMLaS.mjs → postgres-migration-qwigEUIO-BWxjALsx.mjs} +5 -5
  58. package/dist/{postgres-migration-KjQ2KhZN-BEOLMLaS.mjs.map → postgres-migration-qwigEUIO-BWxjALsx.mjs.map} +1 -1
  59. package/dist/{postgres-schema-MIh_qSUu-gKCH4OhS.mjs → postgres-schema-yugFGBdS-5cY1PCmb.mjs} +3 -3
  60. package/dist/{postgres-schema-MIh_qSUu-gKCH4OhS.mjs.map → postgres-schema-yugFGBdS-5cY1PCmb.mjs.map} +1 -1
  61. package/dist/{prisma7-binding-Dborg-gx.mjs → prisma7-binding-BXzUH7xo.mjs} +5 -5
  62. package/dist/{prisma7-binding-Dborg-gx.mjs.map → prisma7-binding-BXzUH7xo.mjs.map} +1 -1
  63. package/dist/{registry-DWBKnvQq-CzxksOLO.mjs → registry-ld2ZUt1j-CH85fY3r.mjs} +3 -3
  64. package/dist/{registry-DWBKnvQq-CzxksOLO.mjs.map → registry-ld2ZUt1j-CH85fY3r.mjs.map} +1 -1
  65. package/dist/{resolve-ddl-schema-DDbcqhDH-QrDca-Np.mjs → resolve-ddl-schema-euaYYSHi-DM7kyWEw.mjs} +3 -3
  66. package/dist/{resolve-ddl-schema-DDbcqhDH-QrDca-Np.mjs.map → resolve-ddl-schema-euaYYSHi-DM7kyWEw.mjs.map} +1 -1
  67. package/dist/{sql-renderer-CgUgFbU4-NHcmNWwR.mjs → sql-renderer-CgUgFbU4-CRUChEAY.mjs} +2 -2
  68. package/dist/{sql-renderer-CgUgFbU4-NHcmNWwR.mjs.map → sql-renderer-CgUgFbU4-CRUChEAY.mjs.map} +1 -1
  69. package/dist/target.d.mts +3 -3
  70. package/dist/target.mjs +23 -23
  71. package/dist/target__codecs.mjs +3 -3
  72. package/dist/target__contract-free.mjs +3 -3
  73. package/dist/target__control.mjs +2 -2
  74. package/dist/target__data-types.d.mts +2 -2
  75. package/dist/target__data-types.mjs +3 -3
  76. package/dist/target__diff-database-schema.mjs +1 -1
  77. package/dist/target__issue-planner.mjs +1 -1
  78. package/dist/target__migration.mjs +2 -2
  79. package/dist/target__op-factory-call.mjs +1 -1
  80. package/dist/target__pack.mjs +1 -1
  81. package/dist/target__planner-ddl-builders.d.mts +2 -2
  82. package/dist/target__planner-ddl-builders.mjs +2 -2
  83. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  84. package/dist/target__planner-sql-checks.mjs +1 -1
  85. package/dist/target__planner.mjs +2 -2
  86. package/dist/target__prisma7-binding.mjs +1 -1
  87. package/dist/target__runtime.mjs +2 -2
  88. package/dist/target__runtime.mjs.map +1 -1
  89. package/dist/target__schema-ir-annotations.mjs +1 -1
  90. package/dist/target__sql-utils.mjs +1 -1
  91. package/dist/target__types.mjs +1 -1
  92. package/package.json +9 -9
  93. package/dist/codecs-Cjg0_n_k-DYOs5mGX.mjs.map +0 -1
  94. package/dist/control-adapter-R1knQpcm-BWchDHdA.mjs.map +0 -1
  95. package/dist/control-eWYKnooD.mjs.map +0 -1
  96. package/dist/control-policy-DTvHBZHr-DFVImL4U.mjs.map +0 -1
  97. package/dist/data-types-BOMKl3ue-BZ8EARvV.mjs +0 -113
  98. package/dist/data-types-BOMKl3ue-BZ8EARvV.mjs.map +0 -1
  99. package/dist/data-types-DgHu2vHj.d.mts.map +0 -1
  100. package/dist/diff-database-schema-DRnjx_iX-Dgq9Fy7W.mjs.map +0 -1
  101. package/dist/infer-psl-contract-DdelifiM-DJrxQnO8.mjs.map +0 -1
  102. package/dist/planner-ddl-builders-Clym-Rcr-CyoEX9P0.mjs.map +0 -1
  103. package/dist/planner-ddl-builders-bBCUsq_0.d.mts +0 -19
  104. package/dist/planner-ddl-builders-bBCUsq_0.d.mts.map +0 -1
@@ -0,0 +1,527 @@
1
+ import { s as postgresError } from "./errors-DYyzTYzE-39CV_aMo.mjs";
2
+ import { canonicalDateTime, isNonFiniteText, numeralText } from "@prisma/orm-family-sql/relational-core/ast";
3
+ import { structuredError } from "@prisma/orm-framework/utils/structured-error";
4
+ import { dataType } from "@prisma/orm-framework/components/codec";
5
+ import { type } from "arktype";
6
+ //#region ../../../3-targets/3-targets/postgres/dist/data-types-Cl18KnNY.mjs
7
+ const precisionParamsSchema = type({ "precision?": "number.integer >= 0 & number.integer <= 6" });
8
+ function renderLength(typeName, typeParams) {
9
+ const length = typeParams.length;
10
+ if (length === void 0) return;
11
+ if (typeof length !== "number" || !Number.isFinite(length) || !Number.isInteger(length)) throw postgresError("RUNTIME.TYPE_PARAMS_INVALID", `renderOutputType: expected integer "length" in typeParams for ${typeName}, got ${String(length)}`, { meta: {
12
+ nativeType: typeName,
13
+ param: "length",
14
+ received: String(length)
15
+ } });
16
+ return `${typeName}<${length}>`;
17
+ }
18
+ function renderPrecision(typeName, typeParams) {
19
+ const precision = typeParams.precision;
20
+ if (precision === void 0) return typeName;
21
+ if (typeof precision !== "number" || !Number.isFinite(precision) || !Number.isInteger(precision)) throw postgresError("RUNTIME.TYPE_PARAMS_INVALID", `renderOutputType: expected integer "precision" in typeParams for ${typeName}, got ${String(precision)}`, { meta: {
22
+ nativeType: typeName,
23
+ param: "precision",
24
+ received: String(precision)
25
+ } });
26
+ return `${typeName}<${precision}>`;
27
+ }
28
+ /**
29
+ * A `numeric` value as its canonical decimal text. A number is written out without an exponent,
30
+ * because `numeric` text has no exponent syntax and `encodeJson` refuses one.
31
+ */
32
+ const pgNumericDecode = (wire) => {
33
+ if (typeof wire === "number") return numeralText(wire);
34
+ return wire;
35
+ };
36
+ const DECIMAL_INTEGER = /^-?\d+$/;
37
+ /**
38
+ * Requires an application value to be of the JS type the codec reads.
39
+ *
40
+ * A range check reads a value of the wrong type as a value out of range, and
41
+ * reports a number plainly inside the range as outside it — so the type is
42
+ * established first and answered for on its own terms, naming what a caller
43
+ * has to change.
44
+ */
45
+ const requireJsType = (codecId, expected, value) => {
46
+ if (typeof value === expected) return;
47
+ throw postgresError("RUNTIME.ENCODE_FAILED", `${codecId} value must be a ${expected}, got ${typeof value} ${String(value)}`, { meta: {
48
+ codecId,
49
+ received: typeof value
50
+ } });
51
+ };
52
+ /** Writes a `bigint` application value as the decimal text the wire form of the exact integer codecs carries. */
53
+ const pgBigintEncode = (codecId, value) => {
54
+ requireJsType(codecId, "bigint", value);
55
+ return value.toString();
56
+ };
57
+ /**
58
+ * Writes an application value as the decimal text these codecs carry as their
59
+ * canonical JSON.
60
+ *
61
+ * A schema-written literal default (`BigInt @default(0)`) arrives here as a
62
+ * `number`, since a number literal is the only integer a schema language
63
+ * writes, and one that is a safe integer names its value exactly. Past that
64
+ * range the literal was rounded before any of this ran, so the value written is
65
+ * not the value meant — which this refuses rather than minting an exact-looking
66
+ * total from it. A non-integral number is refused on the same terms.
67
+ */
68
+ const pgBigintEncodeJson = (codecId, value) => {
69
+ if (typeof value !== "number") return pgBigintEncode(codecId, value);
70
+ if (!Number.isSafeInteger(value)) throw postgresError("RUNTIME.ENCODE_FAILED", `${codecId} number literal must be an integer within the safe integer range, got ${String(value)}`, { meta: {
71
+ codecId,
72
+ received: String(value)
73
+ } });
74
+ return BigInt(value).toString();
75
+ };
76
+ /**
77
+ * Reads a wire or JSON value as a `bigint`, rejecting anything `BigInt()` would
78
+ * misread. A number-typed wire value must also be a safe integer: past
79
+ * ±(2^53 − 1) the driver's `number` has already rounded, so stringifying it
80
+ * would mint a spuriously-exact `bigint` that need not equal the stored value.
81
+ */
82
+ const decimalIntegerDecode = (codecId, wire) => {
83
+ if (typeof wire === "bigint") return wire;
84
+ const text = String(wire);
85
+ if (!DECIMAL_INTEGER.test(text)) throw postgresError("RUNTIME.DECODE_FAILED", `${codecId} value must be a decimal integer`, { meta: {
86
+ codecId,
87
+ received: text
88
+ } });
89
+ if (typeof wire === "number" && !Number.isSafeInteger(wire)) throw postgresError("RUNTIME.DECODE_FAILED", `${codecId} wire number must be an integer within the safe integer range, got ${text}`, { meta: {
90
+ codecId,
91
+ received: text
92
+ } });
93
+ return BigInt(text);
94
+ };
95
+ /** Reads an `int8` wire or JSON value as a `bigint`, rejecting anything `BigInt()` would misread. */
96
+ const pgInt8Decode = (wire) => decimalIntegerDecode("pg/int8@1", wire);
97
+ /**
98
+ * Reads an unconstrained-`numeric` wire or JSON value as a `bigint`, rejecting
99
+ * non-integral values — including `NaN` and the infinities, which are `numeric`
100
+ * values but not integers.
101
+ */
102
+ const pgUnboundedIntDecode = (wire) => decimalIntegerDecode("pg/unboundedint@1", wire);
103
+ /**
104
+ * Neither JSON nor a SQL number literal has a form for `NaN` or the infinities; PostgreSQL reads
105
+ * and writes them as the text `NaN`, `Infinity`, `-Infinity`, so the float codecs carry them as
106
+ * that text on the wire and in JSON.
107
+ */
108
+ const pgFloatEncode = (value) => Number.isFinite(value) ? value : String(value);
109
+ const pgFloatEncodeJson = (value) => pgFloatEncode(value);
110
+ const pgFloatDecodeJson = (codecId, json) => {
111
+ if (typeof json === "number") return json;
112
+ if (typeof json === "string" && isNonFiniteText(json)) return Number(json);
113
+ throw postgresError("RUNTIME.DECODE_FAILED", `${codecId} database JSON value must be a number or the text NaN, Infinity or -Infinity`, { meta: {
114
+ codecId,
115
+ received: typeof json
116
+ } });
117
+ };
118
+ const MIN_SAFE_INTEGER_BIGINT = BigInt(Number.MIN_SAFE_INTEGER);
119
+ const MAX_SAFE_INTEGER_BIGINT = BigInt(Number.MAX_SAFE_INTEGER);
120
+ /**
121
+ * Requires an integer within ±(2^53 − 1), the range a JS `number` holds
122
+ * exactly. The guard throws rather than rounding: past the boundary a `number`
123
+ * silently loses digits, which is the failure mode this codec exists to refuse.
124
+ */
125
+ const pgInt8NumberGuard = (code, value) => {
126
+ if (!Number.isSafeInteger(value)) throw postgresError(code, `pg/int8number@1 value must be an integer within the safe integer range, got ${String(value)}`, { meta: {
127
+ codecId: "pg/int8number@1",
128
+ received: String(value)
129
+ } });
130
+ return value;
131
+ };
132
+ const pgInt8NumberEncode = (value) => {
133
+ requireJsType("pg/int8number@1", "number", value);
134
+ return String(pgInt8NumberGuard("RUNTIME.ENCODE_FAILED", value));
135
+ };
136
+ const pgInt8NumberEncodeJson = (value) => pgInt8NumberEncode(value);
137
+ /**
138
+ * Reads an `int8` wire value as a `number`, throwing outside ±(2^53 − 1) and on
139
+ * non-integral input. Decimal text goes through `BigInt` before the range check
140
+ * so an out-of-range value is compared exactly rather than after rounding.
141
+ */
142
+ const pgInt8NumberDecode = (wire) => {
143
+ if (typeof wire === "number") return pgInt8NumberGuard("RUNTIME.DECODE_FAILED", wire);
144
+ const value = decimalIntegerDecode("pg/int8number@1", wire);
145
+ if (value < MIN_SAFE_INTEGER_BIGINT || value > MAX_SAFE_INTEGER_BIGINT) throw postgresError("RUNTIME.DECODE_FAILED", `pg/int8number@1 value must be an integer within the safe integer range, got ${value}`, { meta: {
146
+ codecId: "pg/int8number@1",
147
+ received: value.toString()
148
+ } });
149
+ return Number(value);
150
+ };
151
+ const pgInt8NumberDecodeJson = (json) => {
152
+ if (typeof json !== "string") throw postgresError("RUNTIME.DECODE_FAILED", "pg/int8number@1 database JSON value must be decimal text", { meta: {
153
+ codecId: "pg/int8number@1",
154
+ received: typeof json
155
+ } });
156
+ return pgInt8NumberDecode(json);
157
+ };
158
+ /**
159
+ * Renders a decimal-text default as a `bigint` literal, for the codecs whose
160
+ * canonical JSON is decimal text while the application type is `bigint`
161
+ * (`pg/int8@1`, `pg/unboundedint@1`) — a plain string literal would not
162
+ * typecheck against the emitted column type.
163
+ */
164
+ const decimalTextBigintLiteral = (value) => typeof value === "string" && DECIMAL_INTEGER.test(value) ? `${value}n` : void 0;
165
+ /** Renders the decimal text of `pg/int8number@1`, whose application type is `number`, as a number literal. */
166
+ const decimalTextNumberLiteral = (value) => typeof value === "string" && DECIMAL_INTEGER.test(value) ? value : void 0;
167
+ const pgNumericRenderOutputType = (typeParams) => {
168
+ const precision = typeParams.precision;
169
+ if (precision === void 0) return void 0;
170
+ if (typeof precision !== "number" || !Number.isFinite(precision) || !Number.isInteger(precision)) throw postgresError("RUNTIME.TYPE_PARAMS_INVALID", `renderOutputType: expected integer "precision" in typeParams for Numeric, got ${String(precision)}`, { meta: {
171
+ nativeType: "Numeric",
172
+ param: "precision",
173
+ received: String(precision)
174
+ } });
175
+ const scale = typeParams.scale;
176
+ if (scale === void 0) return `Numeric<${precision}>`;
177
+ if (typeof scale !== "number" || !Number.isFinite(scale) || !Number.isInteger(scale)) throw postgresError("RUNTIME.TYPE_PARAMS_INVALID", `renderOutputType: expected integer "scale" in typeParams for Numeric, got ${String(scale)}`, { meta: {
178
+ nativeType: "Numeric",
179
+ param: "scale",
180
+ received: String(scale)
181
+ } });
182
+ return `Numeric<${precision}, ${scale}>`;
183
+ };
184
+ const ISO_DURATION = /^P(?!$)(-?\d+Y)?(-?\d+M)?(-?\d+D)?(?:T(?!$)(-?\d+H)?(-?\d+M)?(-?\d+(?:\.\d+)?S)?)?$/;
185
+ const MICROS_PER_SECOND = 1000000n;
186
+ /**
187
+ * Converts a fractional-seconds digit string to microseconds, rounding rather
188
+ * than truncating past the sixth digit.
189
+ *
190
+ * PostgreSQL rounds: `INTERVAL '1.1234567 seconds'` is `1.123457`, and
191
+ * `'1.9999999 seconds'` carries into `2`. Truncating here made the parsed value
192
+ * disagree with the database for any input past microsecond resolution.
193
+ *
194
+ * Ties round toward positive infinity, matching `Math.round` on the sibling path
195
+ * that reads the driver's component object — so the two agree. PostgreSQL's own
196
+ * tie behaviour is unobservable, because it parses the literal into a double
197
+ * first and an exact half never survives that.
198
+ */
199
+ const microsFromFraction = (fraction, negative) => {
200
+ if (fraction === "") return 0n;
201
+ const kept = BigInt(fraction.slice(0, 6).padEnd(6, "0"));
202
+ const rest = fraction.slice(6).replace(/0+$/, "");
203
+ if (rest === "") return kept;
204
+ const half = rest[0] === "5" && rest.length === 1;
205
+ return rest > "5" || half && !negative ? kept + 1n : kept;
206
+ };
207
+ const intervalFieldsOf = (text) => {
208
+ const match = ISO_DURATION.exec(text);
209
+ if (match === null) throw postgresError("RUNTIME.DECODE_FAILED", `pg/interval@1 value must be an ISO-8601 duration, got ${text}`, { meta: {
210
+ codecId: "pg/interval@1",
211
+ received: text
212
+ } });
213
+ const [, years, months, days, hours, minutes, seconds] = match;
214
+ const wholeNumber = (part) => part === void 0 ? 0 : Number(part.slice(0, -1));
215
+ const secondsLiteral = seconds === void 0 ? "0" : seconds.slice(0, -1);
216
+ const negative = secondsLiteral.startsWith("-");
217
+ const [whole = "0", fraction = ""] = secondsLiteral.replace("-", "").split(".");
218
+ const magnitude = BigInt(whole) * MICROS_PER_SECOND + microsFromFraction(fraction, negative);
219
+ return {
220
+ months: wholeNumber(years) * 12 + wholeNumber(months),
221
+ days: wholeNumber(days),
222
+ micros: BigInt(wholeNumber(hours)) * 3600n * MICROS_PER_SECOND + BigInt(wholeNumber(minutes)) * 60n * MICROS_PER_SECOND + (negative ? -magnitude : magnitude)
223
+ };
224
+ };
225
+ const secondsText = (micros) => {
226
+ const sign = micros < 0n ? "-" : "";
227
+ const magnitude = micros < 0n ? -micros : micros;
228
+ const whole = magnitude / MICROS_PER_SECOND % 60n;
229
+ const fraction = magnitude % MICROS_PER_SECOND;
230
+ return `${sign}${whole}${fraction === 0n ? "" : `.${fraction.toString().padStart(6, "0").replace(/0+$/, "")}`}`;
231
+ };
232
+ /**
233
+ * Renders {@link PgInterval} the way PostgreSQL spells an interval under
234
+ * `IntervalStyle = 'iso_8601'`: zero components omitted, `T` present only when a
235
+ * time component is, each component carrying its own sign, and an all-zero
236
+ * interval written `PT0S`.
237
+ */
238
+ const formatIsoDuration = ({ months, days, micros }) => {
239
+ const years = Math.trunc(months / 12);
240
+ const restMonths = months % 12;
241
+ const sign = micros < 0n ? "-" : "";
242
+ const magnitude = micros < 0n ? -micros : micros;
243
+ const hours = magnitude / (3600n * MICROS_PER_SECOND);
244
+ const minutes = magnitude / (60n * MICROS_PER_SECOND) % 60n;
245
+ const hasSeconds = magnitude % (60n * MICROS_PER_SECOND) !== 0n;
246
+ const parts = [
247
+ years === 0 ? "" : `${years}Y`,
248
+ restMonths === 0 ? "" : `${restMonths}M`,
249
+ days === 0 ? "" : `${days}D`
250
+ ];
251
+ const time = [
252
+ hours === 0n ? "" : `${sign}${hours}H`,
253
+ minutes === 0n ? "" : `${sign}${minutes}M`,
254
+ hasSeconds ? `${secondsText(micros)}S` : ""
255
+ ].join("");
256
+ const rendered = `P${parts.join("")}${time === "" ? "" : `T${time}`}`;
257
+ return rendered === "P" ? "PT0S" : rendered;
258
+ };
259
+ /**
260
+ * An interval as PostgreSQL prints it under `IntervalStyle = 'postgres'`: `1 year 2 mons 3 days
261
+ * 04:05:06.5`, `-1 years -2 mons +3 days -04:00:00`, `00:00:00`.
262
+ */
263
+ const POSTGRES_INTERVAL = /^(?:([+-]?\d+) years? ?)?(?:([+-]?\d+) mons? ?)?(?:([+-]?\d+) days? ?)?(?:([+-])?(\d+):(\d{2}):(\d{2})(?:\.(\d+))?)?$/;
264
+ function postgresIntervalFields(text) {
265
+ const match = POSTGRES_INTERVAL.exec(text);
266
+ if (match === null || text === "" || text.endsWith(" ")) return void 0;
267
+ const [, years = "0", months = "0", days = "0", sign, hours = "0", minutes = "0", seconds = "0"] = match;
268
+ const fraction = match[8] ?? "";
269
+ const magnitude = (BigInt(hours) * 3600n + BigInt(minutes) * 60n + BigInt(seconds)) * MICROS_PER_SECOND + BigInt(fraction.padEnd(6, "0") || "0");
270
+ return {
271
+ months: Number(years) * 12 + Number(months),
272
+ days: Number(days),
273
+ micros: sign === "-" ? -magnitude : magnitude
274
+ };
275
+ }
276
+ function intervalRefused(message) {
277
+ throw structuredError("CONTRACT.CAST_REFUSED", message, {
278
+ why: "pg/interval stores one canonical form for each interval (ADR 254), and reads ISO 8601 durations and the text PostgreSQL prints.",
279
+ fix: "Write an ISO 8601 duration, as the message shows."
280
+ });
281
+ }
282
+ /**
283
+ * The canonical form of `pg/interval` (ADR 254), from an ISO 8601 duration or the text PostgreSQL
284
+ * prints under `IntervalStyle = 'postgres'`.
285
+ */
286
+ function pgIntervalCanonical(text) {
287
+ const fractionDigits = /\.(\d+)/.exec(text)?.[1]?.length ?? 0;
288
+ if (fractionDigits > 6) intervalRefused(`"${text}" has ${fractionDigits} digits after the decimal point, but pg/interval holds microseconds, so at most 6. Round it, as in "PT1.123456S".`);
289
+ if (ISO_DURATION.test(text)) return formatIsoDuration(intervalFieldsOf(text));
290
+ const fields = postgresIntervalFields(text);
291
+ if (fields === void 0) intervalRefused(`pg/interval cannot read "${text}". Write an ISO 8601 duration, as in "P1Y2M3DT4H5M6S".`);
292
+ return formatIsoDuration(fields);
293
+ }
294
+ /** Renders the application value as its canonical ISO-8601 duration. */
295
+ const pgIntervalToIso = (value) => formatIsoDuration(value);
296
+ const pgIntervalEncodeJson = (value) => formatIsoDuration(value);
297
+ const pgIntervalDecodeJson = (json) => {
298
+ if (typeof json !== "string") throw postgresError("RUNTIME.DECODE_FAILED", "pg/interval@1 database JSON value must be an ISO-8601 duration string", { meta: {
299
+ codecId: "pg/interval@1",
300
+ received: typeof json
301
+ } });
302
+ return intervalFieldsOf(json);
303
+ };
304
+ /**
305
+ * Reads the driver's wire value into the application value. `pg` parses an
306
+ * interval into a component object, which is the same three fields under other
307
+ * names; a text wire value is an ISO-8601 duration, because that is what the
308
+ * codec writes.
309
+ */
310
+ const pgIntervalDecode = (wire) => {
311
+ if (typeof wire === "string") return intervalFieldsOf(wire);
312
+ const part = (name) => {
313
+ const raw = wire[name];
314
+ return typeof raw === "number" ? raw : 0;
315
+ };
316
+ const seconds = part("seconds") + part("milliseconds") / 1e3;
317
+ return {
318
+ months: part("years") * 12 + part("months"),
319
+ days: part("days"),
320
+ micros: BigInt(part("hours")) * 3600n * MICROS_PER_SECOND + BigInt(part("minutes")) * 60n * MICROS_PER_SECOND + BigInt(Math.round(seconds * 1e6))
321
+ };
322
+ };
323
+ const BASE64_TEXT = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
324
+ const pgByteaEncodeJson = (value) => Buffer.from(value).toString("base64");
325
+ const pgByteaDecodeJson = (value) => {
326
+ if (typeof value !== "string" || !BASE64_TEXT.test(value)) throw postgresError("RUNTIME.DECODE_FAILED", "pg/bytea@1 database JSON value must be a base64 string", { meta: { codecId: "pg/bytea@1" } });
327
+ return new Uint8Array(Buffer.from(value, "base64"));
328
+ };
329
+ const BYTEA_TEXT = /^\\x(?:[0-9A-Fa-f]{2})*$/;
330
+ /**
331
+ * Scalar pg bytea values arrive as Uint8Array/Buffer; target-parsed bytea list elements arrive as PostgreSQL hex text.
332
+ */
333
+ const pgByteaDecodeWire = (wire) => {
334
+ if (wire instanceof Uint8Array) return wire.constructor === Uint8Array ? wire : new Uint8Array(wire.buffer, wire.byteOffset, wire.byteLength);
335
+ if (!BYTEA_TEXT.test(wire)) throw postgresError("RUNTIME.DECODE_FAILED", "pg/bytea@1 wire value must be a bytea hex string or Uint8Array", { meta: {
336
+ codecId: "pg/bytea@1",
337
+ received: wire
338
+ } });
339
+ return new Uint8Array(Buffer.from(wire.slice(2), "hex"));
340
+ };
341
+ const parseJsonWire = JSON.parse;
342
+ const pgJsonEncode = (value) => JSON.stringify(value);
343
+ const pgJsonDecode = (wire) => typeof wire === "string" ? parseJsonWire(wire) : wire;
344
+ const pgJsonbEncode = (value) => JSON.stringify(value);
345
+ const pgJsonbDecode = (wire) => typeof wire === "string" ? parseJsonWire(wire) : wire;
346
+ /** A cast between two types that store the same shape: the value is already the form this type stores. */
347
+ const unchanged = (value) => value;
348
+ function wrongShape(value, expected) {
349
+ throw structuredError("CONTRACT.CAST_REFUSED", `Expected ${expected}, got ${JSON.stringify(value)}.`, {
350
+ why: "A cast reads the canonical form of the type it takes values of.",
351
+ fix: "Hand the cast a value in the shape its source type stores."
352
+ });
353
+ }
354
+ /** A whole number as the digit text `int8` and `numeric` store. */
355
+ const asNumeralText = (value) => typeof value === "number" ? numeralText(value) : wrongShape(value, "a number");
356
+ /**
357
+ * A number as the floating-point types store it: a JSON number, or one of the three words, which
358
+ * those types keep as text. A magnitude past what a double holds is refused rather than rounded to
359
+ * a word: the database refuses it too, and storing `Infinity` would make a written number
360
+ * indistinguishable from a written `Infinity`.
361
+ */
362
+ const asFloat = (value) => {
363
+ if (typeof value === "number") return value;
364
+ if (typeof value !== "string") return wrongShape(value, "a number or numeral text");
365
+ if (isNonFiniteText(value)) return value;
366
+ const converted = Number(value);
367
+ if (Number.isFinite(converted)) return converted;
368
+ throw structuredError("CONTRACT.CAST_REFUSED", `${value} is out of range: no double holds a number that large.`, {
369
+ why: "The floating-point types store a double, which holds magnitudes up to about 1.8e308.",
370
+ fix: "Use a number a double holds, or a numeric column."
371
+ });
372
+ };
373
+ const pgText = dataType("pg/text", {});
374
+ const pgTextArray = dataType("pg/text-array", {});
375
+ const pgEnum = dataType("pg/enum", {});
376
+ const pgInt2 = dataType("pg/int2", {});
377
+ const pgBool = dataType("pg/bool", {});
378
+ const pgJson = dataType("pg/json", {});
379
+ const pgTsquery = dataType("pg/tsquery", {});
380
+ const pgInt4 = dataType("pg/int4", { casts: { [pgInt2.id]: unchanged } });
381
+ const pgInt8 = dataType("pg/int8", { casts: {
382
+ [pgInt2.id]: asNumeralText,
383
+ [pgInt4.id]: asNumeralText
384
+ } });
385
+ const pgNumeric = dataType("pg/numeric", { casts: {
386
+ [pgInt2.id]: asNumeralText,
387
+ [pgInt4.id]: asNumeralText,
388
+ [pgInt8.id]: unchanged
389
+ } });
390
+ /** `float4` stores a single-precision float, so a magnitude past about 3.4e38 does not fit. */
391
+ const asFloat4 = (value) => {
392
+ const converted = asFloat(value);
393
+ if (typeof converted !== "number" || Number.isFinite(Math.fround(converted))) return converted;
394
+ throw structuredError("CONTRACT.CAST_REFUSED", `${converted} is out of range: no float4 holds a number that large.`, {
395
+ why: "float4 stores a single-precision float, which holds magnitudes up to about 3.4e38.",
396
+ fix: "Use a number float4 holds, or a float8 or numeric column."
397
+ });
398
+ };
399
+ const floatCastsOf = (cast) => ({
400
+ [pgInt2.id]: cast,
401
+ [pgInt4.id]: cast,
402
+ [pgInt8.id]: cast,
403
+ [pgNumeric.id]: cast
404
+ });
405
+ const pgFloat4 = dataType("pg/float4", { casts: floatCastsOf(asFloat4) });
406
+ const pgFloat8 = dataType("pg/float8", { casts: floatCastsOf(asFloat) });
407
+ const pgJsonb = dataType("pg/jsonb", { casts: { [pgJson.id]: unchanged } });
408
+ const fromText = { [pgText.id]: unchanged };
409
+ const pgChar = dataType("pg/char", { casts: fromText });
410
+ const pgVarchar = dataType("pg/varchar", { casts: fromText });
411
+ const pgUuid = dataType("pg/uuid", { casts: fromText });
412
+ const pgInet = dataType("pg/inet", { casts: fromText });
413
+ const pgBit = dataType("pg/bit", { casts: fromText });
414
+ const pgVarbit = dataType("pg/varbit", { casts: fromText });
415
+ const pgBytea = dataType("pg/bytea", { casts: fromText });
416
+ const POSTGRES_YEAR = /^(\d{4,6})(-.*?)( BC)?$/;
417
+ /**
418
+ * Text PostgreSQL prints, in ISO 8601. A year with a ` BC` suffix becomes the ISO year, one higher
419
+ * than its negative, so 1 BC is 0000 and 44 BC is -000043. A year of five or six digits becomes a
420
+ * signed six-digit year. 0 BC does not exist, so it stays as written and the reader refuses it.
421
+ */
422
+ function isoFromPostgresText(text) {
423
+ const match = POSTGRES_YEAR.exec(text);
424
+ if (match === null) return text;
425
+ const [, digits = "", rest = "", bc] = match;
426
+ const year = Number(digits);
427
+ if (bc !== void 0) {
428
+ if (year === 0) return text;
429
+ const astronomical = 1 - year;
430
+ return astronomical === 0 ? `0000${rest}` : `-${String(-astronomical).padStart(6, "0")}${rest}`;
431
+ }
432
+ return digits.length > 4 ? `+${String(year).padStart(6, "0")}${rest}` : text;
433
+ }
434
+ const INFINITIES = /* @__PURE__ */ new Set(["infinity", "-infinity"]);
435
+ /**
436
+ * The canonical form of a date or time type (ADR 254), from ISO 8601 or the text PostgreSQL prints.
437
+ * `infinity` and `-infinity` are values of the types that hold them.
438
+ */
439
+ function postgresDateTime(options, holdsInfinity) {
440
+ return (text) => holdsInfinity && INFINITIES.has(text) ? text : canonicalDateTime(isoFromPostgresText(text), options, text);
441
+ }
442
+ /**
443
+ * Each range is what PostgreSQL and every codec of the type hold: PostgreSQL starts at 4714-11-24
444
+ * BC, and the `Temporal` and `Date` codecs end at +275760-09-13.
445
+ */
446
+ const pgDateCanonical = postgresDateTime({
447
+ shape: "date",
448
+ dataTypeId: "pg/date",
449
+ range: {
450
+ earliest: "-004713-11-24",
451
+ latest: "+275760-09-13"
452
+ }
453
+ }, true);
454
+ const pgTimeCanonical = postgresDateTime({
455
+ shape: "time",
456
+ dataTypeId: "pg/time"
457
+ }, false);
458
+ const pgTimetzCanonical = postgresDateTime({
459
+ shape: "timeWithOffset",
460
+ dataTypeId: "pg/timetz",
461
+ maxOffsetHours: 15
462
+ }, false);
463
+ const pgTimestampCanonical = postgresDateTime({
464
+ shape: "dateTime",
465
+ dataTypeId: "pg/timestamp",
466
+ range: {
467
+ earliest: "-004713-11-24T00:00:00",
468
+ latest: "+275760-09-13T23:59:59.999999"
469
+ }
470
+ }, true);
471
+ const pgTimestamptzCanonical = postgresDateTime({
472
+ shape: "instant",
473
+ dataTypeId: "pg/timestamptz",
474
+ range: {
475
+ earliest: "-004713-11-24T00:00:00Z",
476
+ latest: "+275760-09-13T00:00:00Z"
477
+ }
478
+ }, true);
479
+ /** The canonical-form function of a type whose values are written as text. */
480
+ const canonicalFromText = (canonical) => (value) => typeof value === "string" ? canonical(value) : wrongShape(value, "text");
481
+ /** A date or time type: its canonical form, and a cast from text that gives it. */
482
+ function dateTimeType(id, canonical) {
483
+ const toCanonicalForm = canonicalFromText(canonical);
484
+ return dataType(id, {
485
+ toCanonicalForm,
486
+ casts: { [pgText.id]: toCanonicalForm }
487
+ });
488
+ }
489
+ const pgTimetz = dateTimeType("pg/timetz", pgTimetzCanonical);
490
+ const pgInterval = dateTimeType("pg/interval", pgIntervalCanonical);
491
+ const pgDate = dateTimeType("pg/date", pgDateCanonical);
492
+ const pgTime = dateTimeType("pg/time", pgTimeCanonical);
493
+ const pgTimestamp = dateTimeType("pg/timestamp", pgTimestampCanonical);
494
+ const pgTimestamptz = dateTimeType("pg/timestamptz", pgTimestamptzCanonical);
495
+ /** Every data type this target registers. */
496
+ const postgresDataTypes = [
497
+ pgText,
498
+ pgTextArray,
499
+ pgEnum,
500
+ pgInt2,
501
+ pgBool,
502
+ pgJson,
503
+ pgTsquery,
504
+ pgInt4,
505
+ pgInt8,
506
+ pgNumeric,
507
+ pgFloat4,
508
+ pgFloat8,
509
+ pgJsonb,
510
+ pgChar,
511
+ pgVarchar,
512
+ pgUuid,
513
+ pgInet,
514
+ pgBit,
515
+ pgVarbit,
516
+ pgTimetz,
517
+ pgInterval,
518
+ pgBytea,
519
+ pgDate,
520
+ pgTime,
521
+ pgTimestamp,
522
+ pgTimestamptz
523
+ ];
524
+ //#endregion
525
+ export { pgTsquery as $, pgIntervalDecode as A, pgNumeric as B, pgInt8 as C, pgInt8NumberEncode as D, pgInt8NumberDecodeJson as E, pgJsonDecode as F, pgTime as G, pgNumericRenderOutputType as H, pgJsonEncode as I, pgTimestampCanonical as J, pgTimeCanonical as K, pgJsonb as L, pgIntervalEncodeJson as M, pgIntervalToIso as N, pgInt8NumberEncodeJson as O, pgJson as P, pgTimetzCanonical as Q, pgJsonbDecode as R, pgInt4 as S, pgInt8NumberDecode as T, pgText as U, pgNumericDecode as V, pgTextArray as W, pgTimestamptzCanonical as X, pgTimestamptz as Y, pgTimetz as Z, pgFloatDecodeJson as _, pgBit as a, precisionParamsSchema as at, pgInet as b, pgByteaDecodeJson as c, pgChar as d, pgUnboundedIntDecode as et, pgDate as f, pgFloat8 as g, pgFloat4 as h, pgBigintEncodeJson as i, postgresDataTypes as it, pgIntervalDecodeJson as j, pgInterval as k, pgByteaDecodeWire as l, pgEnum as m, decimalTextNumberLiteral as n, pgVarbit as nt, pgBool as o, renderLength as ot, pgDateCanonical as p, pgTimestamp as q, pgBigintEncode as r, pgVarchar as rt, pgBytea as s, renderPrecision as st, decimalTextBigintLiteral as t, pgUuid as tt, pgByteaEncodeJson as u, pgFloatEncode as v, pgInt8Decode as w, pgInt2 as x, pgFloatEncodeJson as y, pgJsonbEncode as z };
526
+
527
+ //# sourceMappingURL=data-types-Cl18KnNY-5I34Vd6Z.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-types-Cl18KnNY-5I34Vd6Z.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/data-types-Cl18KnNY.mjs"],"sourcesContent":["import { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { canonicalDateTime, isNonFiniteText, numeralText } from \"@internal/sql-relational-core/ast\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { dataType } from \"@internal/framework-components/codec\";\nimport { type } from \"arktype\";\n//#region src/core/codec-helpers.ts\nconst precisionParamsSchema = type({ \"precision?\": \"number.integer >= 0 & number.integer <= 6\" });\nfunction renderLength(typeName, typeParams) {\n\tconst length = typeParams.length;\n\tif (length === void 0) return;\n\tif (typeof length !== \"number\" || !Number.isFinite(length) || !Number.isInteger(length)) throw postgresError(\"RUNTIME.TYPE_PARAMS_INVALID\", `renderOutputType: expected integer \"length\" in typeParams for ${typeName}, got ${String(length)}`, { meta: {\n\t\tnativeType: typeName,\n\t\tparam: \"length\",\n\t\treceived: String(length)\n\t} });\n\treturn `${typeName}<${length}>`;\n}\nfunction renderPrecision(typeName, typeParams) {\n\tconst precision = typeParams.precision;\n\tif (precision === void 0) return typeName;\n\tif (typeof precision !== \"number\" || !Number.isFinite(precision) || !Number.isInteger(precision)) throw postgresError(\"RUNTIME.TYPE_PARAMS_INVALID\", `renderOutputType: expected integer \"precision\" in typeParams for ${typeName}, got ${String(precision)}`, { meta: {\n\t\tnativeType: typeName,\n\t\tparam: \"precision\",\n\t\treceived: String(precision)\n\t} });\n\treturn `${typeName}<${precision}>`;\n}\n/**\n* A `numeric` value as its canonical decimal text. A number is written out without an exponent,\n* because `numeric` text has no exponent syntax and `encodeJson` refuses one.\n*/\nconst pgNumericDecode = (wire) => {\n\tif (typeof wire === \"number\") return numeralText(wire);\n\treturn wire;\n};\nconst DECIMAL_INTEGER = /^-?\\d+$/;\n/**\n* Requires an application value to be of the JS type the codec reads.\n*\n* A range check reads a value of the wrong type as a value out of range, and\n* reports a number plainly inside the range as outside it — so the type is\n* established first and answered for on its own terms, naming what a caller\n* has to change.\n*/\nconst requireJsType = (codecId, expected, value) => {\n\tif (typeof value === expected) return;\n\tthrow postgresError(\"RUNTIME.ENCODE_FAILED\", `${codecId} value must be a ${expected}, got ${typeof value} ${String(value)}`, { meta: {\n\t\tcodecId,\n\t\treceived: typeof value\n\t} });\n};\n/** Writes a `bigint` application value as the decimal text the wire form of the exact integer codecs carries. */\nconst pgBigintEncode = (codecId, value) => {\n\trequireJsType(codecId, \"bigint\", value);\n\treturn value.toString();\n};\n/**\n* Writes an application value as the decimal text these codecs carry as their\n* canonical JSON.\n*\n* A schema-written literal default (`BigInt @default(0)`) arrives here as a\n* `number`, since a number literal is the only integer a schema language\n* writes, and one that is a safe integer names its value exactly. Past that\n* range the literal was rounded before any of this ran, so the value written is\n* not the value meant — which this refuses rather than minting an exact-looking\n* total from it. A non-integral number is refused on the same terms.\n*/\nconst pgBigintEncodeJson = (codecId, value) => {\n\tif (typeof value !== \"number\") return pgBigintEncode(codecId, value);\n\tif (!Number.isSafeInteger(value)) throw postgresError(\"RUNTIME.ENCODE_FAILED\", `${codecId} number literal must be an integer within the safe integer range, got ${String(value)}`, { meta: {\n\t\tcodecId,\n\t\treceived: String(value)\n\t} });\n\treturn BigInt(value).toString();\n};\n/**\n* Reads a wire or JSON value as a `bigint`, rejecting anything `BigInt()` would\n* misread. A number-typed wire value must also be a safe integer: past\n* ±(2^53 − 1) the driver's `number` has already rounded, so stringifying it\n* would mint a spuriously-exact `bigint` that need not equal the stored value.\n*/\nconst decimalIntegerDecode = (codecId, wire) => {\n\tif (typeof wire === \"bigint\") return wire;\n\tconst text = String(wire);\n\tif (!DECIMAL_INTEGER.test(text)) throw postgresError(\"RUNTIME.DECODE_FAILED\", `${codecId} value must be a decimal integer`, { meta: {\n\t\tcodecId,\n\t\treceived: text\n\t} });\n\tif (typeof wire === \"number\" && !Number.isSafeInteger(wire)) throw postgresError(\"RUNTIME.DECODE_FAILED\", `${codecId} wire number must be an integer within the safe integer range, got ${text}`, { meta: {\n\t\tcodecId,\n\t\treceived: text\n\t} });\n\treturn BigInt(text);\n};\n/** Reads an `int8` wire or JSON value as a `bigint`, rejecting anything `BigInt()` would misread. */\nconst pgInt8Decode = (wire) => decimalIntegerDecode(\"pg/int8@1\", wire);\n/**\n* Reads an unconstrained-`numeric` wire or JSON value as a `bigint`, rejecting\n* non-integral values — including `NaN` and the infinities, which are `numeric`\n* values but not integers.\n*/\nconst pgUnboundedIntDecode = (wire) => decimalIntegerDecode(\"pg/unboundedint@1\", wire);\n/**\n* Neither JSON nor a SQL number literal has a form for `NaN` or the infinities; PostgreSQL reads\n* and writes them as the text `NaN`, `Infinity`, `-Infinity`, so the float codecs carry them as\n* that text on the wire and in JSON.\n*/\nconst pgFloatEncode = (value) => Number.isFinite(value) ? value : String(value);\nconst pgFloatEncodeJson = (value) => pgFloatEncode(value);\nconst pgFloatDecodeJson = (codecId, json) => {\n\tif (typeof json === \"number\") return json;\n\tif (typeof json === \"string\" && isNonFiniteText(json)) return Number(json);\n\tthrow postgresError(\"RUNTIME.DECODE_FAILED\", `${codecId} database JSON value must be a number or the text NaN, Infinity or -Infinity`, { meta: {\n\t\tcodecId,\n\t\treceived: typeof json\n\t} });\n};\nconst MIN_SAFE_INTEGER_BIGINT = BigInt(Number.MIN_SAFE_INTEGER);\nconst MAX_SAFE_INTEGER_BIGINT = BigInt(Number.MAX_SAFE_INTEGER);\n/**\n* Requires an integer within ±(2^53 − 1), the range a JS `number` holds\n* exactly. The guard throws rather than rounding: past the boundary a `number`\n* silently loses digits, which is the failure mode this codec exists to refuse.\n*/\nconst pgInt8NumberGuard = (code, value) => {\n\tif (!Number.isSafeInteger(value)) throw postgresError(code, `pg/int8number@1 value must be an integer within the safe integer range, got ${String(value)}`, { meta: {\n\t\tcodecId: \"pg/int8number@1\",\n\t\treceived: String(value)\n\t} });\n\treturn value;\n};\nconst pgInt8NumberEncode = (value) => {\n\trequireJsType(\"pg/int8number@1\", \"number\", value);\n\treturn String(pgInt8NumberGuard(\"RUNTIME.ENCODE_FAILED\", value));\n};\nconst pgInt8NumberEncodeJson = (value) => pgInt8NumberEncode(value);\n/**\n* Reads an `int8` wire value as a `number`, throwing outside ±(2^53 − 1) and on\n* non-integral input. Decimal text goes through `BigInt` before the range check\n* so an out-of-range value is compared exactly rather than after rounding.\n*/\nconst pgInt8NumberDecode = (wire) => {\n\tif (typeof wire === \"number\") return pgInt8NumberGuard(\"RUNTIME.DECODE_FAILED\", wire);\n\tconst value = decimalIntegerDecode(\"pg/int8number@1\", wire);\n\tif (value < MIN_SAFE_INTEGER_BIGINT || value > MAX_SAFE_INTEGER_BIGINT) throw postgresError(\"RUNTIME.DECODE_FAILED\", `pg/int8number@1 value must be an integer within the safe integer range, got ${value}`, { meta: {\n\t\tcodecId: \"pg/int8number@1\",\n\t\treceived: value.toString()\n\t} });\n\treturn Number(value);\n};\nconst pgInt8NumberDecodeJson = (json) => {\n\tif (typeof json !== \"string\") throw postgresError(\"RUNTIME.DECODE_FAILED\", \"pg/int8number@1 database JSON value must be decimal text\", { meta: {\n\t\tcodecId: \"pg/int8number@1\",\n\t\treceived: typeof json\n\t} });\n\treturn pgInt8NumberDecode(json);\n};\n/**\n* Renders a decimal-text default as a `bigint` literal, for the codecs whose\n* canonical JSON is decimal text while the application type is `bigint`\n* (`pg/int8@1`, `pg/unboundedint@1`) — a plain string literal would not\n* typecheck against the emitted column type.\n*/\nconst decimalTextBigintLiteral = (value) => typeof value === \"string\" && DECIMAL_INTEGER.test(value) ? `${value}n` : void 0;\n/** Renders the decimal text of `pg/int8number@1`, whose application type is `number`, as a number literal. */\nconst decimalTextNumberLiteral = (value) => typeof value === \"string\" && DECIMAL_INTEGER.test(value) ? value : void 0;\nconst pgNumericRenderOutputType = (typeParams) => {\n\tconst precision = typeParams.precision;\n\tif (precision === void 0) return void 0;\n\tif (typeof precision !== \"number\" || !Number.isFinite(precision) || !Number.isInteger(precision)) throw postgresError(\"RUNTIME.TYPE_PARAMS_INVALID\", `renderOutputType: expected integer \"precision\" in typeParams for Numeric, got ${String(precision)}`, { meta: {\n\t\tnativeType: \"Numeric\",\n\t\tparam: \"precision\",\n\t\treceived: String(precision)\n\t} });\n\tconst scale = typeParams.scale;\n\tif (scale === void 0) return `Numeric<${precision}>`;\n\tif (typeof scale !== \"number\" || !Number.isFinite(scale) || !Number.isInteger(scale)) throw postgresError(\"RUNTIME.TYPE_PARAMS_INVALID\", `renderOutputType: expected integer \"scale\" in typeParams for Numeric, got ${String(scale)}`, { meta: {\n\t\tnativeType: \"Numeric\",\n\t\tparam: \"scale\",\n\t\treceived: String(scale)\n\t} });\n\treturn `Numeric<${precision}, ${scale}>`;\n};\nconst ISO_DURATION = /^P(?!$)(-?\\d+Y)?(-?\\d+M)?(-?\\d+D)?(?:T(?!$)(-?\\d+H)?(-?\\d+M)?(-?\\d+(?:\\.\\d+)?S)?)?$/;\nconst MICROS_PER_SECOND = 1000000n;\n/**\n* Converts a fractional-seconds digit string to microseconds, rounding rather\n* than truncating past the sixth digit.\n*\n* PostgreSQL rounds: `INTERVAL '1.1234567 seconds'` is `1.123457`, and\n* `'1.9999999 seconds'` carries into `2`. Truncating here made the parsed value\n* disagree with the database for any input past microsecond resolution.\n*\n* Ties round toward positive infinity, matching `Math.round` on the sibling path\n* that reads the driver's component object — so the two agree. PostgreSQL's own\n* tie behaviour is unobservable, because it parses the literal into a double\n* first and an exact half never survives that.\n*/\nconst microsFromFraction = (fraction, negative) => {\n\tif (fraction === \"\") return 0n;\n\tconst kept = BigInt(fraction.slice(0, 6).padEnd(6, \"0\"));\n\tconst rest = fraction.slice(6).replace(/0+$/, \"\");\n\tif (rest === \"\") return kept;\n\tconst half = rest[0] === \"5\" && rest.length === 1;\n\treturn rest > \"5\" || half && !negative ? kept + 1n : kept;\n};\nconst intervalFieldsOf = (text) => {\n\tconst match = ISO_DURATION.exec(text);\n\tif (match === null) throw postgresError(\"RUNTIME.DECODE_FAILED\", `pg/interval@1 value must be an ISO-8601 duration, got ${text}`, { meta: {\n\t\tcodecId: \"pg/interval@1\",\n\t\treceived: text\n\t} });\n\tconst [, years, months, days, hours, minutes, seconds] = match;\n\tconst wholeNumber = (part) => part === void 0 ? 0 : Number(part.slice(0, -1));\n\tconst secondsLiteral = seconds === void 0 ? \"0\" : seconds.slice(0, -1);\n\tconst negative = secondsLiteral.startsWith(\"-\");\n\tconst [whole = \"0\", fraction = \"\"] = secondsLiteral.replace(\"-\", \"\").split(\".\");\n\tconst magnitude = BigInt(whole) * MICROS_PER_SECOND + microsFromFraction(fraction, negative);\n\treturn {\n\t\tmonths: wholeNumber(years) * 12 + wholeNumber(months),\n\t\tdays: wholeNumber(days),\n\t\tmicros: BigInt(wholeNumber(hours)) * 3600n * MICROS_PER_SECOND + BigInt(wholeNumber(minutes)) * 60n * MICROS_PER_SECOND + (negative ? -magnitude : magnitude)\n\t};\n};\nconst secondsText = (micros) => {\n\tconst sign = micros < 0n ? \"-\" : \"\";\n\tconst magnitude = micros < 0n ? -micros : micros;\n\tconst whole = magnitude / MICROS_PER_SECOND % 60n;\n\tconst fraction = magnitude % MICROS_PER_SECOND;\n\treturn `${sign}${whole}${fraction === 0n ? \"\" : `.${fraction.toString().padStart(6, \"0\").replace(/0+$/, \"\")}`}`;\n};\n/**\n* Renders {@link PgInterval} the way PostgreSQL spells an interval under\n* `IntervalStyle = 'iso_8601'`: zero components omitted, `T` present only when a\n* time component is, each component carrying its own sign, and an all-zero\n* interval written `PT0S`.\n*/\nconst formatIsoDuration = ({ months, days, micros }) => {\n\tconst years = Math.trunc(months / 12);\n\tconst restMonths = months % 12;\n\tconst sign = micros < 0n ? \"-\" : \"\";\n\tconst magnitude = micros < 0n ? -micros : micros;\n\tconst hours = magnitude / (3600n * MICROS_PER_SECOND);\n\tconst minutes = magnitude / (60n * MICROS_PER_SECOND) % 60n;\n\tconst hasSeconds = magnitude % (60n * MICROS_PER_SECOND) !== 0n;\n\tconst parts = [\n\t\tyears === 0 ? \"\" : `${years}Y`,\n\t\trestMonths === 0 ? \"\" : `${restMonths}M`,\n\t\tdays === 0 ? \"\" : `${days}D`\n\t];\n\tconst time = [\n\t\thours === 0n ? \"\" : `${sign}${hours}H`,\n\t\tminutes === 0n ? \"\" : `${sign}${minutes}M`,\n\t\thasSeconds ? `${secondsText(micros)}S` : \"\"\n\t].join(\"\");\n\tconst rendered = `P${parts.join(\"\")}${time === \"\" ? \"\" : `T${time}`}`;\n\treturn rendered === \"P\" ? \"PT0S\" : rendered;\n};\n/**\n* An interval as PostgreSQL prints it under `IntervalStyle = 'postgres'`: `1 year 2 mons 3 days\n* 04:05:06.5`, `-1 years -2 mons +3 days -04:00:00`, `00:00:00`.\n*/\nconst POSTGRES_INTERVAL = /^(?:([+-]?\\d+) years? ?)?(?:([+-]?\\d+) mons? ?)?(?:([+-]?\\d+) days? ?)?(?:([+-])?(\\d+):(\\d{2}):(\\d{2})(?:\\.(\\d+))?)?$/;\nfunction postgresIntervalFields(text) {\n\tconst match = POSTGRES_INTERVAL.exec(text);\n\tif (match === null || text === \"\" || text.endsWith(\" \")) return void 0;\n\tconst [, years = \"0\", months = \"0\", days = \"0\", sign, hours = \"0\", minutes = \"0\", seconds = \"0\"] = match;\n\tconst fraction = match[8] ?? \"\";\n\tconst magnitude = (BigInt(hours) * 3600n + BigInt(minutes) * 60n + BigInt(seconds)) * MICROS_PER_SECOND + BigInt(fraction.padEnd(6, \"0\") || \"0\");\n\treturn {\n\t\tmonths: Number(years) * 12 + Number(months),\n\t\tdays: Number(days),\n\t\tmicros: sign === \"-\" ? -magnitude : magnitude\n\t};\n}\nfunction intervalRefused(message) {\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", message, {\n\t\twhy: \"pg/interval stores one canonical form for each interval (ADR 254), and reads ISO 8601 durations and the text PostgreSQL prints.\",\n\t\tfix: \"Write an ISO 8601 duration, as the message shows.\"\n\t});\n}\n/**\n* The canonical form of `pg/interval` (ADR 254), from an ISO 8601 duration or the text PostgreSQL\n* prints under `IntervalStyle = 'postgres'`.\n*/\nfunction pgIntervalCanonical(text) {\n\tconst fractionDigits = /\\.(\\d+)/.exec(text)?.[1]?.length ?? 0;\n\tif (fractionDigits > 6) intervalRefused(`\"${text}\" has ${fractionDigits} digits after the decimal point, but pg/interval holds microseconds, so at most 6. Round it, as in \"PT1.123456S\".`);\n\tif (ISO_DURATION.test(text)) return formatIsoDuration(intervalFieldsOf(text));\n\tconst fields = postgresIntervalFields(text);\n\tif (fields === void 0) intervalRefused(`pg/interval cannot read \"${text}\". Write an ISO 8601 duration, as in \"P1Y2M3DT4H5M6S\".`);\n\treturn formatIsoDuration(fields);\n}\n/** Renders the application value as its canonical ISO-8601 duration. */\nconst pgIntervalToIso = (value) => formatIsoDuration(value);\nconst pgIntervalEncodeJson = (value) => formatIsoDuration(value);\nconst pgIntervalDecodeJson = (json) => {\n\tif (typeof json !== \"string\") throw postgresError(\"RUNTIME.DECODE_FAILED\", \"pg/interval@1 database JSON value must be an ISO-8601 duration string\", { meta: {\n\t\tcodecId: \"pg/interval@1\",\n\t\treceived: typeof json\n\t} });\n\treturn intervalFieldsOf(json);\n};\n/**\n* Reads the driver's wire value into the application value. `pg` parses an\n* interval into a component object, which is the same three fields under other\n* names; a text wire value is an ISO-8601 duration, because that is what the\n* codec writes.\n*/\nconst pgIntervalDecode = (wire) => {\n\tif (typeof wire === \"string\") return intervalFieldsOf(wire);\n\tconst part = (name) => {\n\t\tconst raw = wire[name];\n\t\treturn typeof raw === \"number\" ? raw : 0;\n\t};\n\tconst seconds = part(\"seconds\") + part(\"milliseconds\") / 1e3;\n\treturn {\n\t\tmonths: part(\"years\") * 12 + part(\"months\"),\n\t\tdays: part(\"days\"),\n\t\tmicros: BigInt(part(\"hours\")) * 3600n * MICROS_PER_SECOND + BigInt(part(\"minutes\")) * 60n * MICROS_PER_SECOND + BigInt(Math.round(seconds * 1e6))\n\t};\n};\nconst BASE64_TEXT = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;\nconst pgByteaEncodeJson = (value) => Buffer.from(value).toString(\"base64\");\nconst pgByteaDecodeJson = (value) => {\n\tif (typeof value !== \"string\" || !BASE64_TEXT.test(value)) throw postgresError(\"RUNTIME.DECODE_FAILED\", \"pg/bytea@1 database JSON value must be a base64 string\", { meta: { codecId: \"pg/bytea@1\" } });\n\treturn new Uint8Array(Buffer.from(value, \"base64\"));\n};\nconst BYTEA_TEXT = /^\\\\x(?:[0-9A-Fa-f]{2})*$/;\n/**\n* Scalar pg bytea values arrive as Uint8Array/Buffer; target-parsed bytea list elements arrive as PostgreSQL hex text.\n*/\nconst pgByteaDecodeWire = (wire) => {\n\tif (wire instanceof Uint8Array) return wire.constructor === Uint8Array ? wire : new Uint8Array(wire.buffer, wire.byteOffset, wire.byteLength);\n\tif (!BYTEA_TEXT.test(wire)) throw postgresError(\"RUNTIME.DECODE_FAILED\", \"pg/bytea@1 wire value must be a bytea hex string or Uint8Array\", { meta: {\n\t\tcodecId: \"pg/bytea@1\",\n\t\treceived: wire\n\t} });\n\treturn new Uint8Array(Buffer.from(wire.slice(2), \"hex\"));\n};\nconst parseJsonWire = JSON.parse;\nconst pgJsonEncode = (value) => JSON.stringify(value);\nconst pgJsonDecode = (wire) => typeof wire === \"string\" ? parseJsonWire(wire) : wire;\nconst pgJsonbEncode = (value) => JSON.stringify(value);\nconst pgJsonbDecode = (wire) => typeof wire === \"string\" ? parseJsonWire(wire) : wire;\n//#endregion\n//#region src/core/data-types.ts\n/** A cast between two types that store the same shape: the value is already the form this type stores. */\nconst unchanged = (value) => value;\nfunction wrongShape(value, expected) {\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `Expected ${expected}, got ${JSON.stringify(value)}.`, {\n\t\twhy: \"A cast reads the canonical form of the type it takes values of.\",\n\t\tfix: \"Hand the cast a value in the shape its source type stores.\"\n\t});\n}\n/** A whole number as the digit text `int8` and `numeric` store. */\nconst asNumeralText = (value) => typeof value === \"number\" ? numeralText(value) : wrongShape(value, \"a number\");\n/**\n* A number as the floating-point types store it: a JSON number, or one of the three words, which\n* those types keep as text. A magnitude past what a double holds is refused rather than rounded to\n* a word: the database refuses it too, and storing `Infinity` would make a written number\n* indistinguishable from a written `Infinity`.\n*/\nconst asFloat = (value) => {\n\tif (typeof value === \"number\") return value;\n\tif (typeof value !== \"string\") return wrongShape(value, \"a number or numeral text\");\n\tif (isNonFiniteText(value)) return value;\n\tconst converted = Number(value);\n\tif (Number.isFinite(converted)) return converted;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${value} is out of range: no double holds a number that large.`, {\n\t\twhy: \"The floating-point types store a double, which holds magnitudes up to about 1.8e308.\",\n\t\tfix: \"Use a number a double holds, or a numeric column.\"\n\t});\n};\nconst pgText = dataType(\"pg/text\", {});\nconst pgTextArray = dataType(\"pg/text-array\", {});\nconst pgEnum = dataType(\"pg/enum\", {});\nconst pgInt2 = dataType(\"pg/int2\", {});\nconst pgBool = dataType(\"pg/bool\", {});\nconst pgJson = dataType(\"pg/json\", {});\nconst pgTsquery = dataType(\"pg/tsquery\", {});\nconst pgInt4 = dataType(\"pg/int4\", { casts: { [pgInt2.id]: unchanged } });\nconst pgInt8 = dataType(\"pg/int8\", { casts: {\n\t[pgInt2.id]: asNumeralText,\n\t[pgInt4.id]: asNumeralText\n} });\nconst pgNumeric = dataType(\"pg/numeric\", { casts: {\n\t[pgInt2.id]: asNumeralText,\n\t[pgInt4.id]: asNumeralText,\n\t[pgInt8.id]: unchanged\n} });\n/** `float4` stores a single-precision float, so a magnitude past about 3.4e38 does not fit. */\nconst asFloat4 = (value) => {\n\tconst converted = asFloat(value);\n\tif (typeof converted !== \"number\" || Number.isFinite(Math.fround(converted))) return converted;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${converted} is out of range: no float4 holds a number that large.`, {\n\t\twhy: \"float4 stores a single-precision float, which holds magnitudes up to about 3.4e38.\",\n\t\tfix: \"Use a number float4 holds, or a float8 or numeric column.\"\n\t});\n};\nconst floatCastsOf = (cast) => ({\n\t[pgInt2.id]: cast,\n\t[pgInt4.id]: cast,\n\t[pgInt8.id]: cast,\n\t[pgNumeric.id]: cast\n});\nconst pgFloat4 = dataType(\"pg/float4\", { casts: floatCastsOf(asFloat4) });\nconst pgFloat8 = dataType(\"pg/float8\", { casts: floatCastsOf(asFloat) });\nconst pgJsonb = dataType(\"pg/jsonb\", { casts: { [pgJson.id]: unchanged } });\nconst fromText = { [pgText.id]: unchanged };\nconst pgChar = dataType(\"pg/char\", { casts: fromText });\nconst pgVarchar = dataType(\"pg/varchar\", { casts: fromText });\nconst pgUuid = dataType(\"pg/uuid\", { casts: fromText });\nconst pgInet = dataType(\"pg/inet\", { casts: fromText });\nconst pgBit = dataType(\"pg/bit\", { casts: fromText });\nconst pgVarbit = dataType(\"pg/varbit\", { casts: fromText });\nconst pgBytea = dataType(\"pg/bytea\", { casts: fromText });\nconst POSTGRES_YEAR = /^(\\d{4,6})(-.*?)( BC)?$/;\n/**\n* Text PostgreSQL prints, in ISO 8601. A year with a ` BC` suffix becomes the ISO year, one higher\n* than its negative, so 1 BC is 0000 and 44 BC is -000043. A year of five or six digits becomes a\n* signed six-digit year. 0 BC does not exist, so it stays as written and the reader refuses it.\n*/\nfunction isoFromPostgresText(text) {\n\tconst match = POSTGRES_YEAR.exec(text);\n\tif (match === null) return text;\n\tconst [, digits = \"\", rest = \"\", bc] = match;\n\tconst year = Number(digits);\n\tif (bc !== void 0) {\n\t\tif (year === 0) return text;\n\t\tconst astronomical = 1 - year;\n\t\treturn astronomical === 0 ? `0000${rest}` : `-${String(-astronomical).padStart(6, \"0\")}${rest}`;\n\t}\n\treturn digits.length > 4 ? `+${String(year).padStart(6, \"0\")}${rest}` : text;\n}\nconst INFINITIES = /* @__PURE__ */ new Set([\"infinity\", \"-infinity\"]);\n/**\n* The canonical form of a date or time type (ADR 254), from ISO 8601 or the text PostgreSQL prints.\n* `infinity` and `-infinity` are values of the types that hold them.\n*/\nfunction postgresDateTime(options, holdsInfinity) {\n\treturn (text) => holdsInfinity && INFINITIES.has(text) ? text : canonicalDateTime(isoFromPostgresText(text), options, text);\n}\n/**\n* Each range is what PostgreSQL and every codec of the type hold: PostgreSQL starts at 4714-11-24\n* BC, and the `Temporal` and `Date` codecs end at +275760-09-13.\n*/\nconst pgDateCanonical = postgresDateTime({\n\tshape: \"date\",\n\tdataTypeId: \"pg/date\",\n\trange: {\n\t\tearliest: \"-004713-11-24\",\n\t\tlatest: \"+275760-09-13\"\n\t}\n}, true);\nconst pgTimeCanonical = postgresDateTime({\n\tshape: \"time\",\n\tdataTypeId: \"pg/time\"\n}, false);\nconst pgTimetzCanonical = postgresDateTime({\n\tshape: \"timeWithOffset\",\n\tdataTypeId: \"pg/timetz\",\n\tmaxOffsetHours: 15\n}, false);\nconst pgTimestampCanonical = postgresDateTime({\n\tshape: \"dateTime\",\n\tdataTypeId: \"pg/timestamp\",\n\trange: {\n\t\tearliest: \"-004713-11-24T00:00:00\",\n\t\tlatest: \"+275760-09-13T23:59:59.999999\"\n\t}\n}, true);\nconst pgTimestamptzCanonical = postgresDateTime({\n\tshape: \"instant\",\n\tdataTypeId: \"pg/timestamptz\",\n\trange: {\n\t\tearliest: \"-004713-11-24T00:00:00Z\",\n\t\tlatest: \"+275760-09-13T00:00:00Z\"\n\t}\n}, true);\n/** The canonical-form function of a type whose values are written as text. */\nconst canonicalFromText = (canonical) => (value) => typeof value === \"string\" ? canonical(value) : wrongShape(value, \"text\");\n/** A date or time type: its canonical form, and a cast from text that gives it. */\nfunction dateTimeType(id, canonical) {\n\tconst toCanonicalForm = canonicalFromText(canonical);\n\treturn dataType(id, {\n\t\ttoCanonicalForm,\n\t\tcasts: { [pgText.id]: toCanonicalForm }\n\t});\n}\nconst pgTimetz = dateTimeType(\"pg/timetz\", pgTimetzCanonical);\nconst pgInterval = dateTimeType(\"pg/interval\", pgIntervalCanonical);\nconst pgDate = dateTimeType(\"pg/date\", pgDateCanonical);\nconst pgTime = dateTimeType(\"pg/time\", pgTimeCanonical);\nconst pgTimestamp = dateTimeType(\"pg/timestamp\", pgTimestampCanonical);\nconst pgTimestamptz = dateTimeType(\"pg/timestamptz\", pgTimestamptzCanonical);\n/** Every data type this target registers. */\nconst postgresDataTypes = [\n\tpgText,\n\tpgTextArray,\n\tpgEnum,\n\tpgInt2,\n\tpgBool,\n\tpgJson,\n\tpgTsquery,\n\tpgInt4,\n\tpgInt8,\n\tpgNumeric,\n\tpgFloat4,\n\tpgFloat8,\n\tpgJsonb,\n\tpgChar,\n\tpgVarchar,\n\tpgUuid,\n\tpgInet,\n\tpgBit,\n\tpgVarbit,\n\tpgTimetz,\n\tpgInterval,\n\tpgBytea,\n\tpgDate,\n\tpgTime,\n\tpgTimestamp,\n\tpgTimestamptz\n];\n//#endregion\nexport { pgJsonEncode as $, pgVarbit as A, pgFloatDecodeJson as B, pgTimestampCanonical as C, pgTimetzCanonical as D, pgTimetz as E, pgBigintEncode as F, pgInt8NumberDecodeJson as G, pgFloatEncodeJson as H, pgBigintEncodeJson as I, pgIntervalDecode as J, pgInt8NumberEncode as K, pgByteaDecodeJson as L, postgresDataTypes as M, decimalTextBigintLiteral as N, pgTsquery as O, decimalTextNumberLiteral as P, pgJsonDecode as Q, pgByteaDecodeWire as R, pgTimestamp as S, pgTimestamptzCanonical as T, pgInt8Decode as U, pgFloatEncode as V, pgInt8NumberDecode as W, pgIntervalEncodeJson as X, pgIntervalDecodeJson as Y, pgIntervalToIso as Z, pgNumeric as _, pgDate as a, precisionParamsSchema as at, pgTime as b, pgFloat4 as c, pgInt2 as d, pgJsonbDecode as et, pgInt4 as f, pgJsonb as g, pgJson as h, pgChar as i, pgUnboundedIntDecode as it, pgVarchar as j, pgUuid as k, pgFloat8 as l, pgInterval as m, pgBool as n, pgNumericDecode as nt, pgDateCanonical as o, renderLength as ot, pgInt8 as p, pgInt8NumberEncodeJson as q, pgBytea as r, pgNumericRenderOutputType as rt, pgEnum as s, renderPrecision as st, pgBit as t, pgJsonbEncode as tt, pgInet as u, pgText as v, pgTimestamptz as w, pgTimeCanonical as x, pgTextArray as y, pgByteaEncodeJson as z };\n\n//# sourceMappingURL=data-types-Cl18KnNY.mjs.map"],"mappings":";;;;;;AAMA,MAAM,wBAAwB,KAAK,EAAE,cAAc,4CAA4C,CAAC;AAChG,SAAS,aAAa,UAAU,YAAY;CAC3C,MAAM,SAAS,WAAW;CAC1B,IAAI,WAAW,KAAK,GAAG;CACvB,IAAI,OAAO,WAAW,YAAY,CAAC,OAAO,SAAS,MAAM,KAAK,CAAC,OAAO,UAAU,MAAM,GAAG,MAAM,cAAc,+BAA+B,iEAAiE,SAAS,QAAQ,OAAO,MAAM,KAAK,EAAE,MAAM;EACvP,YAAY;EACZ,OAAO;EACP,UAAU,OAAO,MAAM;CACxB,EAAE,CAAC;CACH,OAAO,GAAG,SAAS,GAAG,OAAO;AAC9B;AACA,SAAS,gBAAgB,UAAU,YAAY;CAC9C,MAAM,YAAY,WAAW;CAC7B,IAAI,cAAc,KAAK,GAAG,OAAO;CACjC,IAAI,OAAO,cAAc,YAAY,CAAC,OAAO,SAAS,SAAS,KAAK,CAAC,OAAO,UAAU,SAAS,GAAG,MAAM,cAAc,+BAA+B,oEAAoE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ACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD"}
@@ -24,9 +24,18 @@ declare const pgUuid: DataType;
24
24
  declare const pgInet: DataType;
25
25
  declare const pgBit: DataType;
26
26
  declare const pgVarbit: DataType;
27
+ declare const pgBytea: DataType;
28
+ /**
29
+ * Each range is what PostgreSQL and every codec of the type hold: PostgreSQL starts at 4714-11-24
30
+ * BC, and the `Temporal` and `Date` codecs end at +275760-09-13.
31
+ */
32
+ declare const pgDateCanonical: (text: string) => string;
33
+ declare const pgTimeCanonical: (text: string) => string;
34
+ declare const pgTimetzCanonical: (text: string) => string;
35
+ declare const pgTimestampCanonical: (text: string) => string;
36
+ declare const pgTimestamptzCanonical: (text: string) => string;
27
37
  declare const pgTimetz: DataType;
28
38
  declare const pgInterval: DataType;
29
- declare const pgBytea: DataType;
30
39
  declare const pgDate: DataType;
31
40
  declare const pgTime: DataType;
32
41
  declare const pgTimestamp: DataType;
@@ -34,5 +43,5 @@ declare const pgTimestamptz: DataType;
34
43
  /** Every data type this target registers. */
35
44
  declare const postgresDataTypes: readonly DataType[];
36
45
  //#endregion
37
- export { pgTsquery as C, postgresDataTypeEntries as D, pgVarchar as E, postgresDataTypes as O, pgTimetz as S, pgVarbit as T, pgText as _, pgDate as a, pgTimestamp as b, pgFloat8 as c, pgInt4 as d, pgInt8 as f, pgNumeric as g, pgJsonb as h, pgChar as i, pgInet as l, pgJson as m, pgBool as n, pgEnum as o, pgInterval as p, pgBytea as r, pgFloat4 as s, pgBit as t, pgInt2 as u, pgTextArray as v, pgUuid as w, pgTimestamptz as x, pgTime as y };
38
- //# sourceMappingURL=data-types-DgHu2vHj.d.mts.map
46
+ export { pgVarbit as A, pgTimestampCanonical as C, pgTimetzCanonical as D, pgTimetz as E, postgresDataTypeEntries as M, postgresDataTypes as N, pgTsquery as O, pgTimestamp as S, pgTimestamptzCanonical as T, pgNumeric as _, pgDate as a, pgTime as b, pgFloat4 as c, pgInt2 as d, pgInt4 as f, pgJsonb as g, pgJson as h, pgChar as i, pgVarchar as j, pgUuid as k, pgFloat8 as l, pgInterval as m, pgBool as n, pgDateCanonical as o, pgInt8 as p, pgBytea as r, pgEnum as s, pgBit as t, pgInet as u, pgText as v, pgTimestamptz as w, pgTimeCanonical as x, pgTextArray as y };
47
+ //# sourceMappingURL=data-types-DJQDcSAC.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-types-DJQDcSAC.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/data-types.d.mts"],"mappings":";;;;iBAGiB,2BAA2B,SAAS,eAAe;;;cAGtD,QAAQ;cACR,aAAa;cACb,QAAQ;cACR,QAAQ;cACR,QAAQ;cACR,QAAQ;cACR,WAAW;cACX,QAAQ;cACR,QAAQ;cACR,WAAW;cACX,UAAU;cACV,UAAU;cACV,SAAS;cACT,QAAQ;cACR,WAAW;cACX,QAAQ;cACR,QAAQ;cACR,OAAO;cACP,UAAU;cACV,SAAS;;;;;cAKT,kBAAkB;cAClB,kBAAkB;cAClB,oBAAoB;cACpB,uBAAuB;cACvB,yBAAyB;cACzB,UAAU;cACV,YAAY;cACZ,QAAQ;cACR,QAAQ;cACR,aAAa;cACb,eAAe;;cAEf,4BAA4B"}