@prisma/orm-target-postgres 8.0.0-rc.14-dev.27 → 8.0.0-rc.14-dev.28
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-feboP3zp-Bahi4qVo.mjs → adapter-BNrSLsxC-CXrTrSvP.mjs} +5 -5
- package/dist/{adapter-feboP3zp-Bahi4qVo.mjs.map → adapter-BNrSLsxC-CXrTrSvP.mjs.map} +1 -1
- package/dist/adapter.mjs +5 -5
- package/dist/adapter__adapter.mjs +1 -1
- package/dist/adapter__control.mjs +7 -7
- package/dist/adapter__control.mjs.map +1 -1
- package/dist/adapter__runtime.mjs +4 -4
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/{authoring-BX7WXyUK-BVUoTS2O.mjs → authoring-C5Ch8RNG-Qgq9GiOY.mjs} +4 -4
- package/dist/{authoring-BX7WXyUK-BVUoTS2O.mjs.map → authoring-C5Ch8RNG-Qgq9GiOY.mjs.map} +1 -1
- package/dist/{codec-helpers-PLBCguwU-BD8nGqjd.mjs → codec-helpers-BmUrP6U9-DuO9gpqZ.mjs} +13 -13
- package/dist/{codec-helpers-PLBCguwU-BD8nGqjd.mjs.map → codec-helpers-BmUrP6U9-DuO9gpqZ.mjs.map} +1 -1
- package/dist/{codecs-4MwR9yYB.mjs → codecs-CWXNVl1P.mjs} +2 -2
- package/dist/{codecs-4MwR9yYB.mjs.map → codecs-CWXNVl1P.mjs.map} +1 -1
- package/dist/{codecs-0cuTthSz-DK4dxeEE.mjs → codecs-CnbVrlil--FxLKWM5.mjs} +4 -4
- package/dist/{codecs-0cuTthSz-DK4dxeEE.mjs.map → codecs-CnbVrlil--FxLKWM5.mjs.map} +1 -1
- package/dist/{control-Dd31Nva0.mjs → control-CyiVFspE.mjs} +9 -9
- package/dist/{control-Dd31Nva0.mjs.map → control-CyiVFspE.mjs.map} +1 -1
- package/dist/{control-D6H04xaA.mjs → control-DJo3P3yL.mjs} +2 -2
- package/dist/control-DJo3P3yL.mjs.map +1 -0
- package/dist/{control-adapter-DzRjCCuc-CNJcK8FQ.mjs → control-adapter-Du0EcG5G-CT4qBFrG.mjs} +11 -6
- package/dist/control-adapter-Du0EcG5G-CT4qBFrG.mjs.map +1 -0
- package/dist/{control-policy-DHnC_3uu-8eaY0QaE.mjs → control-policy-BW5Cgq3Z-Dn2ZVBCP.mjs} +4 -4
- package/dist/{control-policy-DHnC_3uu-8eaY0QaE.mjs.map → control-policy-BW5Cgq3Z-Dn2ZVBCP.mjs.map} +1 -1
- package/dist/{data-type-entries-ofT74QIj-3aJ3Llba.mjs → data-type-entries-cjspFU7A-BBOIqLij.mjs} +3 -3
- package/dist/{data-type-entries-ofT74QIj-3aJ3Llba.mjs.map → data-type-entries-cjspFU7A-BBOIqLij.mjs.map} +1 -1
- package/dist/{data-types-B-8yirZ0-Ba7BPHAy.mjs → data-types-BGsYeBpf-B_5bvuEe.mjs} +3 -3
- package/dist/{data-types-B-8yirZ0-Ba7BPHAy.mjs.map → data-types-BGsYeBpf-B_5bvuEe.mjs.map} +1 -1
- package/dist/{default-normalizer-8E6ew8Nq-CMgRnBkj.mjs → default-normalizer-ByDD_gRm-CKeWEb0x.mjs} +3 -3
- package/dist/{default-normalizer-8E6ew8Nq-CMgRnBkj.mjs.map → default-normalizer-ByDD_gRm-CKeWEb0x.mjs.map} +1 -1
- package/dist/{descriptor-meta-BEigA5Gj-DCtx_hNw.mjs → descriptor-meta-BEigA5Gj-eY7nV4N_.mjs} +5 -5
- package/dist/{descriptor-meta-BEigA5Gj-DCtx_hNw.mjs.map → descriptor-meta-BEigA5Gj-eY7nV4N_.mjs.map} +1 -1
- package/dist/{descriptor-meta-CNocPizV-CM3vRsBg.mjs → descriptor-meta-Bvq6_NJ8-Cn_M79Lf.mjs} +4 -4
- package/dist/{descriptor-meta-CNocPizV-CM3vRsBg.mjs.map → descriptor-meta-Bvq6_NJ8-Cn_M79Lf.mjs.map} +1 -1
- package/dist/{diff-database-schema-Cybx3XZj-X5XgQc3e.mjs → diff-database-schema-_bbfF4oI-D_VmL4Ma.mjs} +4 -4
- package/dist/{diff-database-schema-Cybx3XZj-X5XgQc3e.mjs.map → diff-database-schema-_bbfF4oI-D_VmL4Ma.mjs.map} +1 -1
- package/dist/driver.mjs +2 -2
- package/dist/driver__control.mjs +1 -1
- package/dist/driver__runtime.mjs +1 -1
- package/dist/{full-text-index-expression-BZRAwQ6G-Bus1rjpq.mjs → full-text-index-expression-525ZZWf0-HIGVQbjL.mjs} +3 -3
- package/dist/{full-text-index-expression-BZRAwQ6G-Bus1rjpq.mjs.map → full-text-index-expression-525ZZWf0-HIGVQbjL.mjs.map} +1 -1
- package/dist/{infer-psl-contract-of3HBkov-DJeZHv6R.mjs → infer-psl-contract-Burb6YAz-DbKU4cXm.mjs} +6 -6
- package/dist/{infer-psl-contract-of3HBkov-DJeZHv6R.mjs.map → infer-psl-contract-Burb6YAz-DbKU4cXm.mjs.map} +1 -1
- package/dist/migration-PTHAY9Cv.mjs.map +1 -1
- package/dist/{op-factory-call-DMsjg_Mk-CNSo4lcs.mjs → op-factory-call-DkzlLBzN-Bc6l0sYN.mjs} +3 -3
- package/dist/{op-factory-call-DMsjg_Mk-CNSo4lcs.mjs.map → op-factory-call-DkzlLBzN-Bc6l0sYN.mjs.map} +1 -1
- package/dist/{planner-DKY41UXw-CcoVgq5N.mjs → planner-D7lEhXHR-8Wz1p_6j.mjs} +7 -7
- package/dist/{planner-DKY41UXw-CcoVgq5N.mjs.map → planner-D7lEhXHR-8Wz1p_6j.mjs.map} +1 -1
- package/dist/{planner-ddl-builders-BOvOAj1q-C4IJoysh.mjs → planner-ddl-builders-BZLzBmuq-BrpA53eH.mjs} +4 -4
- package/dist/{planner-ddl-builders-BOvOAj1q-C4IJoysh.mjs.map → planner-ddl-builders-BZLzBmuq-BrpA53eH.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-CajcTGOW-DV0ivYWc.mjs → planner-produced-postgres-migration-GZTusMRD-DPb6XqDu.mjs} +3 -3
- package/dist/{planner-produced-postgres-migration-CajcTGOW-DV0ivYWc.mjs.map → planner-produced-postgres-migration-GZTusMRD-DPb6XqDu.mjs.map} +1 -1
- package/dist/{postgres-contract-view-BqMwLieI-1pQRelL5.mjs → postgres-contract-view-Da0ymIZE-CBV3OE-k.mjs} +3 -3
- package/dist/{postgres-contract-view-BqMwLieI-1pQRelL5.mjs.map → postgres-contract-view-Da0ymIZE-CBV3OE-k.mjs.map} +1 -1
- package/dist/{postgres-migration-CMcrvJni-D7c38x5U.mjs → postgres-migration-Dq60Mixq-DYNJokZW.mjs} +8 -8
- package/dist/{postgres-migration-CMcrvJni-D7c38x5U.mjs.map → postgres-migration-Dq60Mixq-DYNJokZW.mjs.map} +1 -1
- package/dist/{prisma7-binding-JTOc8zQB.mjs → prisma7-binding-Dm24YoM6.mjs} +5 -5
- package/dist/{prisma7-binding-JTOc8zQB.mjs.map → prisma7-binding-Dm24YoM6.mjs.map} +1 -1
- package/dist/{runtime-D7XsforS.mjs → runtime-DugW4mig.mjs} +4 -4
- package/dist/runtime-DugW4mig.mjs.map +1 -0
- package/dist/{temporal-text-parsers-M28a91UF-D938VcZK.mjs → server-text-types-DeNPQpv5-DPxA9uXV.mjs} +8 -22
- package/dist/server-text-types-DeNPQpv5-DPxA9uXV.mjs.map +1 -0
- package/dist/{sql-renderer-CgUgFbU4-cg7P_Tlg.mjs → sql-renderer-CgUgFbU4-BY3PCrmG.mjs} +2 -2
- package/dist/{sql-renderer-CgUgFbU4-cg7P_Tlg.mjs.map → sql-renderer-CgUgFbU4-BY3PCrmG.mjs.map} +1 -1
- package/dist/target.mjs +17 -17
- package/dist/target__codecs.mjs +2 -2
- package/dist/target__control.mjs +3 -3
- package/dist/target__data-types.mjs +2 -2
- package/dist/target__default-normalizer.mjs +1 -1
- package/dist/target__diff-database-schema.mjs +1 -1
- package/dist/target__issue-planner.mjs +1 -1
- package/dist/target__migration.mjs +2 -2
- package/dist/target__op-factory-call.mjs +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-ddl-builders.mjs +1 -1
- package/dist/target__planner-produced-postgres-migration.mjs +1 -1
- package/dist/target__planner.mjs +2 -2
- package/dist/target__prisma7-binding.mjs +1 -1
- package/dist/target__runtime.mjs +2 -2
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/target__sql-utils.mjs +1 -1
- package/package.json +9 -9
- package/dist/control-D6H04xaA.mjs.map +0 -1
- package/dist/control-adapter-DzRjCCuc-CNJcK8FQ.mjs.map +0 -1
- package/dist/runtime-D7XsforS.mjs.map +0 -1
- package/dist/temporal-text-parsers-M28a91UF-D938VcZK.mjs.map +0 -1
package/dist/{codec-helpers-PLBCguwU-BD8nGqjd.mjs.map → codec-helpers-BmUrP6U9-DuO9gpqZ.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec-helpers-PLBCguwU-BD8nGqjd.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/codec-helpers-PLBCguwU.mjs"],"sourcesContent":["import { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { numeralText } from \"@internal/sql-relational-core/ast\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { SAFE_INTEGER_BIGINT_RANGE, decodeJsonIntegerText, decodeJsonMatching } from \"@internal/framework-components/codec\";\nimport { withoutTrailing } from \"@internal/utils/text\";\nimport { type } from \"arktype\";\n//#region src/core/codec-helpers.ts\n/**\n* Whether text fits `length` characters, counted as PostgreSQL counts them: code points. A `character` value is padded with spaces, and spaces past its length are dropped, so they do not count.\n*/\nfunction fitsCharacterLength(text, length, blankPadded) {\n\tconst significant = blankPadded ? withoutTrailing(text, \" \") : text;\n\treturn significant.length <= length || [...significant].length <= length;\n}\n/** The uuid input PostgreSQL reads: 32 hex digits in either case, a hyphen allowed after any group of four but the last, and the whole optionally in braces. */\nconst UUID_INPUT = /^(?:\\{[0-9a-f]{4}(?:-?[0-9a-f]{4}){7}\\}|[0-9a-f]{4}(?:-?[0-9a-f]{4}){7})$/i;\n/** A UUID as PostgreSQL writes it: lower case, hyphenated 8-4-4-4-12. */\nconst CANONICAL_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;\n/**\n* Text in any form PostgreSQL reads as a UUID (either case, a hyphen after any group of four digits, optionally in braces), written the way PostgreSQL writes it; `undefined` for text it does not read as one.\n*/\nfunction canonicalUuid(text) {\n\tif (!UUID_INPUT.test(text)) return void 0;\n\tconst hex = text.replace(/[{}-]/g, \"\").toLowerCase();\n\treturn `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n/** The largest finite float4. */\nconst FLOAT4_MAX = 34028234663852886e22;\n/** Whether float4 holds a finite number: it neither overflows to an infinity nor rounds to 0, both of which PostgreSQL refuses. */\nfunction fitsFloat4(value) {\n\tconst single = Math.fround(value);\n\treturn Number.isFinite(single) && (value === 0 || single !== 0);\n}\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* A SQL number literal has no form for `NaN` or the infinities; PostgreSQL reads and writes them as\n* the text `NaN`, `Infinity`, `-Infinity`, so the float codecs carry them as that text on the wire,\n* as `encodeJsonFloat` does in JSON.\n*/\nconst pgFloatEncode = (value) => Number.isFinite(value) ? value : String(value);\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 < SAFE_INTEGER_BIGINT_RANGE.min || value > SAFE_INTEGER_BIGINT_RANGE.max) 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) => Number(decodeJsonIntegerText(\"pg/int8number@1\", json, SAFE_INTEGER_BIGINT_RANGE));\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) => intervalFieldsOf(decodeJsonMatching(\"pg/interval@1\", json, ISO_DURATION, \"an ISO-8601 duration\"));\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 = (json) => new Uint8Array(Buffer.from(decodeJsonMatching(\"pg/bytea@1\", json, BASE64_TEXT, \"a base64 string\"), \"base64\"));\nconst BYTEA_TEXT = /^\\\\x(?:[0-9A-Fa-f]{2})*$/;\nconst BYTEA_FORMS = String.raw`Write base64, as in \"aGVsbG8=\", or PostgreSQL hex, written \"\\\\x68656c6c6f\" in a PSL string.`;\nfunction byteaRefused(message) {\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", message, {\n\t\twhy: \"pg/bytea stores its bytes as base64 (ADR 254), and reads base64 and the hex text PostgreSQL prints.\",\n\t\tfix: BYTEA_FORMS\n\t});\n}\n/**\n* The canonical form of `pg/bytea` (ADR 254), the base64 its codec writes, from base64 or the hex\n* text PostgreSQL prints under `bytea_output = 'hex'`.\n*/\nfunction pgByteaCanonical(text) {\n\tif (text.startsWith(\"\\\\x\")) {\n\t\tif (!BYTEA_TEXT.test(text)) byteaRefused(`${JSON.stringify(text)} is not PostgreSQL hex, which has two hexadecimal digits for each byte. ${BYTEA_FORMS}`);\n\t\treturn Buffer.from(text.slice(2), \"hex\").toString(\"base64\");\n\t}\n\tif (!BASE64_TEXT.test(text)) byteaRefused(`pg/bytea cannot read ${JSON.stringify(text)}. Write base64 with its padding, as in \"aGVsbG8=\", or PostgreSQL hex, written \"\\\\\\\\x68656c6c6f\" in a PSL string.`);\n\treturn Buffer.from(text, \"base64\").toString(\"base64\");\n}\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\nexport { pgNumericRenderOutputType as A, pgIntervalEncodeJson as C, pgJsonbDecode as D, pgJsonEncode as E, precisionParamsSchema as M, renderLength as N, pgJsonbEncode as O, renderPrecision as P, pgIntervalDecodeJson as S, pgJsonDecode as T, pgInt8NumberDecodeJson as _, decimalTextNumberLiteral as a, pgIntervalCanonical as b, pgBigintEncode as c, pgByteaDecodeJson as d, pgByteaDecodeWire as f, pgInt8NumberDecode as g, pgInt8Decode as h, decimalTextBigintLiteral as i, pgUnboundedIntDecode as j, pgNumericDecode as k, pgBigintEncodeJson as l, pgFloatEncode as m, FLOAT4_MAX as n, fitsCharacterLength as o, pgByteaEncodeJson as p, canonicalUuid as r, fitsFloat4 as s, CANONICAL_UUID as t, pgByteaCanonical as u, pgInt8NumberEncode as v, pgIntervalToIso as w, pgIntervalDecode as x, pgInt8NumberEncodeJson as y };\n\n//# sourceMappingURL=codec-helpers-PLBCguwU.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAAS,oBAAoB,MAAM,QAAQ,aAAa;CACvD,MAAM,cAAc,cAAc,gBAAgB,MAAM,GAAG,IAAI;CAC/D,OAAO,YAAY,UAAU,UAAU,CAAC,GAAG,WAAW,CAAC,CAAC,UAAU;AACnE;;AAEA,MAAM,aAAa;;AAEnB,MAAM,iBAAiB;;;;AAIvB,SAAS,cAAc,MAAM;CAC5B,IAAI,CAAC,WAAW,KAAK,IAAI,GAAG,OAAO,KAAK;CACxC,MAAM,MAAM,KAAK,QAAQ,UAAU,EAAE,CAAC,CAAC,YAAY;CACnD,OAAO,GAAG,IAAI,MAAM,GAAG,CAAC,EAAE,GAAG,IAAI,MAAM,GAAG,EAAE,EAAE,GAAG,IAAI,MAAM,IAAI,EAAE,EAAE,GAAG,IAAI,MAAM,IAAI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,gBAAgB,aAAa,OAAO,IAAI,WAAW,KAAK,QAAQ,KAAK,YAAY,KAAK,UAAU;CAC5I,IAAI,CAAC,WAAW,KAAK,IAAI,GAAG,MAAM,cAAc,yBAAyB,kEAAkE,EAAE,MAAM;EAClJ,SAAS;EACT,UAAU;CACX,EAAE,CAAC;CACH,OAAO,IAAI,WAAW,OAAO,KAAK,KAAK,MAAM,CAAC,GAAG,KAAK,CAAC;AACxD;AACA,MAAM,gBAAgB,KAAK;AAC3B,MAAM,gBAAgB,UAAU,KAAK,UAAU,KAAK;AACpD,MAAM,gBAAgB,SAAS,OAAO,SAAS,WAAW,cAAc,IAAI,IAAI;AAChF,MAAM,iBAAiB,UAAU,KAAK,UAAU,KAAK;AACrD,MAAM,iBAAiB,SAAS,OAAO,SAAS,WAAW,cAAc,IAAI,IAAI"}
|
|
1
|
+
{"version":3,"file":"codec-helpers-BmUrP6U9-DuO9gpqZ.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/codec-helpers-BmUrP6U9.mjs"],"sourcesContent":["import { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { numeralText } from \"@internal/sql-relational-core/ast\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { SAFE_INTEGER_BIGINT_RANGE, decodeJsonIntegerText, decodeJsonMatching } from \"@internal/framework-components/codec\";\nimport { withoutTrailing } from \"@internal/utils/text\";\nimport { type } from \"arktype\";\n//#region src/core/codec-helpers.ts\n/**\n* Whether text fits `length` characters, counted as PostgreSQL counts them: code points. A `character` value is padded with spaces, and spaces past its length are dropped, so they do not count.\n*/\nfunction fitsCharacterLength(text, length, blankPadded) {\n\tconst significant = blankPadded ? withoutTrailing(text, \" \") : text;\n\treturn significant.length <= length || [...significant].length <= length;\n}\n/** The uuid input PostgreSQL reads: 32 hex digits in either case, a hyphen allowed after any group of four but the last, and the whole optionally in braces. */\nconst UUID_INPUT = /^(?:\\{[0-9a-f]{4}(?:-?[0-9a-f]{4}){7}\\}|[0-9a-f]{4}(?:-?[0-9a-f]{4}){7})$/i;\n/** A UUID as PostgreSQL writes it: lower case, hyphenated 8-4-4-4-12. */\nconst CANONICAL_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;\n/**\n* Text in any form PostgreSQL reads as a UUID (either case, a hyphen after any group of four digits, optionally in braces), written the way PostgreSQL writes it; `undefined` for text it does not read as one.\n*/\nfunction canonicalUuid(text) {\n\tif (!UUID_INPUT.test(text)) return void 0;\n\tconst hex = text.replace(/[{}-]/g, \"\").toLowerCase();\n\treturn `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n/** The largest finite float4. */\nconst FLOAT4_MAX = 34028234663852886e22;\n/** Whether float4 holds a finite number: it neither overflows to an infinity nor rounds to 0, both of which PostgreSQL refuses. */\nfunction fitsFloat4(value) {\n\tconst single = Math.fround(value);\n\treturn Number.isFinite(single) && (value === 0 || single !== 0);\n}\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* A SQL number literal has no form for `NaN` or the infinities; PostgreSQL reads and writes them as\n* the text `NaN`, `Infinity`, `-Infinity`, so the float codecs carry them as that text on the wire,\n* as `encodeJsonFloat` does in JSON.\n*/\nconst pgFloatEncode = (value) => Number.isFinite(value) ? value : String(value);\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 < SAFE_INTEGER_BIGINT_RANGE.min || value > SAFE_INTEGER_BIGINT_RANGE.max) 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) => Number(decodeJsonIntegerText(\"pg/int8number@1\", json, SAFE_INTEGER_BIGINT_RANGE));\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 + microsFromFraction(fraction, sign === \"-\");\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) => intervalFieldsOf(decodeJsonMatching(\"pg/interval@1\", json, ISO_DURATION, \"an ISO-8601 duration\"));\nconst intervalTextFields = (text) => {\n\tif (ISO_DURATION.test(text)) return intervalFieldsOf(text);\n\tconst fields = postgresIntervalFields(text);\n\tif (fields === void 0) throw postgresError(\"RUNTIME.DECODE_FAILED\", `pg/interval@1 value must be an ISO-8601 duration or PostgreSQL interval text, got ${text}`, { meta: {\n\t\tcodecId: \"pg/interval@1\",\n\t\treceived: text\n\t} });\n\treturn fields;\n};\nconst pgIntervalDecode = (wire) => {\n\tif (typeof wire === \"string\") return intervalTextFields(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 = (json) => new Uint8Array(Buffer.from(decodeJsonMatching(\"pg/bytea@1\", json, BASE64_TEXT, \"a base64 string\"), \"base64\"));\nconst BYTEA_TEXT = /^\\\\x(?:[0-9A-Fa-f]{2})*$/;\nconst BYTEA_FORMS = String.raw`Write base64, as in \"aGVsbG8=\", or PostgreSQL hex, written \"\\\\x68656c6c6f\" in a PSL string.`;\nfunction byteaRefused(message) {\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", message, {\n\t\twhy: \"pg/bytea stores its bytes as base64 (ADR 254), and reads base64 and the hex text PostgreSQL prints.\",\n\t\tfix: BYTEA_FORMS\n\t});\n}\n/**\n* The canonical form of `pg/bytea` (ADR 254), the base64 its codec writes, from base64 or the hex\n* text PostgreSQL prints under `bytea_output = 'hex'`.\n*/\nfunction pgByteaCanonical(text) {\n\tif (text.startsWith(\"\\\\x\")) {\n\t\tif (!BYTEA_TEXT.test(text)) byteaRefused(`${JSON.stringify(text)} is not PostgreSQL hex, which has two hexadecimal digits for each byte. ${BYTEA_FORMS}`);\n\t\treturn Buffer.from(text.slice(2), \"hex\").toString(\"base64\");\n\t}\n\tif (!BASE64_TEXT.test(text)) byteaRefused(`pg/bytea cannot read ${JSON.stringify(text)}. Write base64 with its padding, as in \"aGVsbG8=\", or PostgreSQL hex, written \"\\\\\\\\x68656c6c6f\" in a PSL string.`);\n\treturn Buffer.from(text, \"base64\").toString(\"base64\");\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\nexport { pgNumericRenderOutputType as A, pgIntervalEncodeJson as C, pgJsonbDecode as D, pgJsonEncode as E, precisionParamsSchema as M, renderLength as N, pgJsonbEncode as O, renderPrecision as P, pgIntervalDecodeJson as S, pgJsonDecode as T, pgInt8NumberDecodeJson as _, decimalTextNumberLiteral as a, pgIntervalCanonical as b, pgBigintEncode as c, pgByteaDecodeJson as d, pgByteaDecodeWire as f, pgInt8NumberDecode as g, pgInt8Decode as h, decimalTextBigintLiteral as i, pgUnboundedIntDecode as j, pgNumericDecode as k, pgBigintEncodeJson as l, pgFloatEncode as m, FLOAT4_MAX as n, fitsCharacterLength as o, pgByteaEncodeJson as p, canonicalUuid as r, fitsFloat4 as s, CANONICAL_UUID as t, pgByteaCanonical as u, pgInt8NumberEncode as v, pgIntervalToIso as w, pgIntervalDecode as x, pgInt8NumberEncodeJson as y };\n\n//# sourceMappingURL=codec-helpers-BmUrP6U9.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAAS,oBAAoB,MAAM,QAAQ,aAAa;CACvD,MAAM,cAAc,cAAc,gBAAgB,MAAM,GAAG,IAAI;CAC/D,OAAO,YAAY,UAAU,UAAU,CAAC,GAAG,WAAW,CAAC,CAAC,UAAU;AACnE;;AAEA,MAAM,aAAa;;AAEnB,MAAM,iBAAiB;;;;AAIvB,SAAS,cAAc,MAAM;CAC5B,IAAI,CAAC,WAAW,KAAK,IAAI,GAAG,OAAO,KAAK;CACxC,MAAM,MAAM,KAAK,QAAQ,UAAU,EAAE,CAAC,CAAC,YAAY;CACnD,OAAO,GAAG,IAAI,MAAM,GAAG,CAAC,EAAE,GAAG,IAAI,MAAM,GAAG,EAAE,EAAE,GAAG,IAAI,MAAM,IAAI,EAAE,EAAE,G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C,SAAS,QAAQ;CAC3D;CACA,IAAI,CAAC,YAAY,KAAK,IAAI,GAAG,aAAa,wBAAwB,KAAK,UAAU,IAAI,EAAE,iHAAiH;CACxM,OAAO,OAAO,KAAK,MAAM,QAAQ,CAAC,CAAC,SAAS,QAAQ;AACrD;AACA,MAAM,qBAAqB,SAAS;CACnC,IAAI,gBAAgB,YAAY,OAAO,KAAK,gBAAgB,aAAa,OAAO,IAAI,WAAW,KAAK,QAAQ,KAAK,YAAY,KAAK,UAAU;CAC5I,IAAI,CAAC,WAAW,KAAK,IAAI,GAAG,MAAM,cAAc,yBAAyB,kEAAkE,EAAE,MAAM;EAClJ,SAAS;EACT,UAAU;CACX,EAAE,CAAC;CACH,OAAO,IAAI,WAAW,OAAO,KAAK,KAAK,MAAM,CAAC,GAAG,KAAK,CAAC;AACxD;AACA,MAAM,gBAAgB,KAAK;AAC3B,MAAM,gBAAgB,UAAU,KAAK,UAAU,KAAK;AACpD,MAAM,gBAAgB,SAAS,OAAO,SAAS,WAAW,cAAc,IAAI,IAAI;AAChF,MAAM,iBAAiB,UAAU,KAAK,UAAU,KAAK;AACrD,MAAM,iBAAiB,SAAS,OAAO,SAAS,WAAW,cAAc,IAAI,IAAI"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as buildPostgresCodecDescriptorRegistry } from "./codec-descriptor-B61d-k4C-BdWVU6Fu.mjs";
|
|
2
|
-
import { a as codecDescriptors } from "./codecs-
|
|
2
|
+
import { a as codecDescriptors } from "./codecs-CnbVrlil--FxLKWM5.mjs";
|
|
3
3
|
import { extractCodecLookup } from "@prisma/orm-framework/components/control";
|
|
4
4
|
import { buildCodecDescriptorRegistry } from "@prisma/orm-family-sql/relational-core/codec-descriptor-registry";
|
|
5
5
|
//#region ../../../3-targets/3-targets/postgres/dist/codecs.mjs
|
|
@@ -42,4 +42,4 @@ function createPostgresBuiltinCodecLookup() {
|
|
|
42
42
|
//#endregion
|
|
43
43
|
export { postgresCodecDescriptorRegistry as a, createPostgresCodecRegistryWithBuiltins as i, assemblePostgresCodecRegistryWithBuiltins as n, postgresCodecRegistry as o, createPostgresBuiltinCodecLookup as r, assemblePostgresCodecRegistry as t };
|
|
44
44
|
|
|
45
|
-
//# sourceMappingURL=codecs-
|
|
45
|
+
//# sourceMappingURL=codecs-CWXNVl1P.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codecs-
|
|
1
|
+
{"version":3,"file":"codecs-CWXNVl1P.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/codecs.mjs"],"sourcesContent":["import { n as buildPostgresCodecDescriptorRegistry } from \"./codec-descriptor-B61d-k4C.mjs\";\nimport { A as PgTimestamptzDateDescriptor, C as pgUuidColumn, D as NUMERIC_PRECISION_RANGE, M as pgTimestamptzDateDescriptor, O as NUMERIC_SCALE_RANGE, S as pgUnboundedIntColumn, T as pgVarcharColumn, _ as pgJsonColumn, a as pgCharColumn, b as pgTextColumn, c as pgFloat8Column, d as pgInt2Column, f as pgInt4Column, g as pgIntervalColumn, h as pgIntColumn, i as pgBoolColumn, j as pgTimestamptzDateColumn, k as PgTimestamptzDateCodec, l as pgFloatColumn, m as pgInt8NumberColumn, n as isPgEnumParams, o as pgEnumDescriptor, p as pgInt8Column, r as pgBitColumn, s as pgFloat4Column, t as codecDescriptors, u as pgInetColumn, v as pgJsonbColumn, w as pgVarbitColumn, x as pgTimetzColumn, y as pgNumericColumn } from \"./codecs-CnbVrlil.mjs\";\nimport { n as parsePostgresListText } from \"./list-decoder-DXee1orj.mjs\";\nimport { extractCodecLookup } from \"@internal/framework-components/control\";\nimport { buildCodecDescriptorRegistry } from \"@internal/sql-relational-core/codec-descriptor-registry\";\n//#region src/core/registry.ts\n/**\n* Registry of every codec descriptor shipped by `@internal/target-postgres`.\n*\n* Public consumer surface for the postgres codec set: the postgres adapter and any other consumer that needs to enumerate or look up a postgres codec by id consumes this rather than the raw descriptor array. See ADR 208.\n*/\nconst postgresCodecRegistry = buildCodecDescriptorRegistry(codecDescriptors);\nconst postgresCodecDescriptorRegistry = buildPostgresCodecDescriptorRegistry(codecDescriptors);\n//#endregion\n//#region src/core/codec-registry.ts\nfunction buildPostgresCodecRegistry(descriptors) {\n\tconst descriptorRegistry = buildPostgresCodecDescriptorRegistry(descriptors);\n\tconst registry = {\n\t\t...extractCodecLookup([{\n\t\t\tid: \"postgres-codecs\",\n\t\t\ttypes: { codecTypes: { codecDescriptors: Array.from(descriptorRegistry.values()) } }\n\t\t}]),\n\t\tdescriptorFor: (codecId) => descriptorRegistry.descriptorFor(codecId),\n\t\tvalues: () => descriptorRegistry.values()\n\t};\n\treturn Object.freeze(registry);\n}\nfunction assemblePostgresCodecRegistry(components) {\n\treturn buildPostgresCodecRegistry(components.flatMap((component) => component.types?.codecTypes?.codecDescriptors ?? []));\n}\nfunction assemblePostgresCodecRegistryWithBuiltins(extensions) {\n\treturn buildPostgresCodecRegistry([...postgresCodecDescriptorRegistry.values(), ...extensions.flatMap((extension) => extension.types?.codecTypes?.codecDescriptors ?? [])]);\n}\nfunction createPostgresCodecRegistryWithBuiltins(codecDescriptors = []) {\n\treturn buildPostgresCodecRegistry([...postgresCodecDescriptorRegistry.values(), ...codecDescriptors]);\n}\n/**\n* Build a coherent PostgreSQL codec registry populated with built-in descriptors only.\n*\n* The returned registry supports both ordinary codec materialization and PostgreSQL target behavior. Stack-composed paths build the same combined registry from their complete ordered descriptor contributions.\n*/\nfunction createPostgresBuiltinCodecLookup() {\n\treturn createPostgresCodecRegistryWithBuiltins();\n}\n//#endregion\nexport { NUMERIC_PRECISION_RANGE, NUMERIC_SCALE_RANGE, PgTimestamptzDateCodec, PgTimestamptzDateDescriptor, assemblePostgresCodecRegistry, assemblePostgresCodecRegistryWithBuiltins, createPostgresBuiltinCodecLookup, createPostgresCodecRegistryWithBuiltins, isPgEnumParams, parsePostgresListText, pgBitColumn, pgBoolColumn, pgCharColumn, pgEnumDescriptor, pgFloat4Column, pgFloat8Column, pgFloatColumn, pgInetColumn, pgInt2Column, pgInt4Column, pgInt8Column, pgInt8NumberColumn, pgIntColumn, pgIntervalColumn, pgJsonColumn, pgJsonbColumn, pgNumericColumn, pgTextColumn, pgTimestamptzDateColumn, pgTimestamptzDateDescriptor, pgTimetzColumn, pgUnboundedIntColumn, pgUuidColumn, pgVarbitColumn, pgVarcharColumn, postgresCodecDescriptorRegistry, postgresCodecRegistry };\n\n//# sourceMappingURL=codecs.mjs.map"],"mappings":";;;;;;;;;;AAWA,MAAM,wBAAwB,6BAA6B,gBAAgB;AAC3E,MAAM,kCAAkC,qCAAqC,gBAAgB;AAG7F,SAAS,2BAA2B,aAAa;CAChD,MAAM,qBAAqB,qCAAqC,WAAW;CAC3E,MAAM,WAAW;EAChB,GAAG,mBAAmB,CAAC;GACtB,IAAI;GACJ,OAAO,EAAE,YAAY,EAAE,kBAAkB,MAAM,KAAK,mBAAmB,OAAO,CAAC,EAAE,EAAE;EACpF,CAAC,CAAC;EACF,gBAAgB,YAAY,mBAAmB,cAAc,OAAO;EACpE,cAAc,mBAAmB,OAAO;CACzC;CACA,OAAO,OAAO,OAAO,QAAQ;AAC9B;AACA,SAAS,8BAA8B,YAAY;CAClD,OAAO,2BAA2B,WAAW,SAAS,cAAc,UAAU,OAAO,YAAY,oBAAoB,CAAC,CAAC,CAAC;AACzH;AACA,SAAS,0CAA0C,YAAY;CAC9D,OAAO,2BAA2B,CAAC,GAAG,gCAAgC,OAAO,GAAG,GAAG,WAAW,SAAS,cAAc,UAAU,OAAO,YAAY,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAC3K;AACA,SAAS,wCAAwC,mBAAmB,CAAC,GAAG;CACvE,OAAO,2BAA2B,CAAC,GAAG,gCAAgC,OAAO,GAAG,GAAG,gBAAgB,CAAC;AACrG;;;;;;AAMA,SAAS,mCAAmC;CAC3C,OAAO,wCAAwC;AAChD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { A as PG_TIME_TEMPORAL_CODEC_ID, C as PG_TIMESTAMPTZ_DATE_CODEC_ID, D as PG_TIMESTAMP_TEMPORAL_CODEC_ID, E as PG_TIMESTAMP_STRING_CODEC_ID, F as PG_VARCHAR_CODEC_ID, M as PG_UNBOUNDED_INT_CODEC_ID, N as PG_UUID_CODEC_ID, O as PG_TIMETZ_CODEC_ID, P as PG_VARBIT_CODEC_ID, S as PG_TEXT_CODEC_ID, T as PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID, _ as PG_INT_CODEC_ID, a as PG_DATE_STRING_CODEC_ID, b as PG_NUMERIC_CODEC_ID, c as PG_FLOAT4_CODEC_ID, d as PG_INET_CODEC_ID, f as PG_INT2_CODEC_ID, g as PG_INTERVAL_CODEC_ID, h as PG_INT8_NUMBER_CODEC_ID, i as PG_CHAR_CODEC_ID, j as PG_TSQUERY_CODEC_ID, k as PG_TIME_STRING_CODEC_ID, l as PG_FLOAT8_CODEC_ID, m as PG_INT8_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_DATE_TEMPORAL_CODEC_ID, p as PG_INT4_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_ENUM_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_FLOAT_CODEC_ID, v as PG_JSONB_CODEC_ID, w as PG_TIMESTAMPTZ_STRING_CODEC_ID, x as PG_TEXT_ARRAY_CODEC_ID, y as PG_JSON_CODEC_ID } from "./codec-ids-Cb0yO-IS--e0P2rfI.mjs";
|
|
2
2
|
import { a as postgresCodec, r as definePostgresCodecs, t as PostgresCodecDescriptor } from "./codec-descriptor-B61d-k4C-BdWVU6Fu.mjs";
|
|
3
3
|
import { a as errorTemporalUnrepresentable, i as errorTemporalUnavailableForDefault, n as errorTemporalNonIsoCalendar, o as errorTemporalWrongType, r as errorTemporalUnavailable, s as postgresError } from "./errors-DYyzTYzE-39CV_aMo.mjs";
|
|
4
|
-
import { A as pgNumericRenderOutputType, C as pgIntervalEncodeJson, D as pgJsonbDecode, E as pgJsonEncode, M as precisionParamsSchema, N as renderLength, O as pgJsonbEncode, P as renderPrecision, S as pgIntervalDecodeJson, T as pgJsonDecode, _ as pgInt8NumberDecodeJson, a as decimalTextNumberLiteral, c as pgBigintEncode, d as pgByteaDecodeJson, f as pgByteaDecodeWire, g as pgInt8NumberDecode, h as pgInt8Decode, i as decimalTextBigintLiteral, j as pgUnboundedIntDecode, k as pgNumericDecode, l as pgBigintEncodeJson, m as pgFloatEncode, n as FLOAT4_MAX, o as fitsCharacterLength, p as pgByteaEncodeJson, r as canonicalUuid, s as fitsFloat4, t as CANONICAL_UUID, v as pgInt8NumberEncode, w as pgIntervalToIso, x as pgIntervalDecode, y as pgInt8NumberEncodeJson } from "./codec-helpers-
|
|
5
|
-
import { A as pgVarbit, C as pgTimestampCanonical, D as pgTimetzCanonical, E as pgTimetz, O as pgTsquery, S as pgTimestamp, T as pgTimestamptzCanonical, _ as pgNumeric, a as pgDate, b as pgTime, c as pgFloat4, d as pgInt2, f as pgInt4, g as pgJsonb, h as pgJson, i as pgChar, j as pgVarchar, k as pgUuid, l as pgFloat8, m as pgInterval, n as pgBool, o as pgDateCanonical, p as pgInt8, r as pgBytea, s as pgEnum, t as pgBit, u as pgInet, v as pgText, w as pgTimestamptz, x as pgTimeCanonical, y as pgTextArray } from "./data-types-
|
|
4
|
+
import { A as pgNumericRenderOutputType, C as pgIntervalEncodeJson, D as pgJsonbDecode, E as pgJsonEncode, M as precisionParamsSchema, N as renderLength, O as pgJsonbEncode, P as renderPrecision, S as pgIntervalDecodeJson, T as pgJsonDecode, _ as pgInt8NumberDecodeJson, a as decimalTextNumberLiteral, c as pgBigintEncode, d as pgByteaDecodeJson, f as pgByteaDecodeWire, g as pgInt8NumberDecode, h as pgInt8Decode, i as decimalTextBigintLiteral, j as pgUnboundedIntDecode, k as pgNumericDecode, l as pgBigintEncodeJson, m as pgFloatEncode, n as FLOAT4_MAX, o as fitsCharacterLength, p as pgByteaEncodeJson, r as canonicalUuid, s as fitsFloat4, t as CANONICAL_UUID, v as pgInt8NumberEncode, w as pgIntervalToIso, x as pgIntervalDecode, y as pgInt8NumberEncodeJson } from "./codec-helpers-BmUrP6U9-DuO9gpqZ.mjs";
|
|
5
|
+
import { A as pgVarbit, C as pgTimestampCanonical, D as pgTimetzCanonical, E as pgTimetz, O as pgTsquery, S as pgTimestamp, T as pgTimestamptzCanonical, _ as pgNumeric, a as pgDate, b as pgTime, c as pgFloat4, d as pgInt2, f as pgInt4, g as pgJsonb, h as pgJson, i as pgChar, j as pgVarchar, k as pgUuid, l as pgFloat8, m as pgInterval, n as pgBool, o as pgDateCanonical, p as pgInt8, r as pgBytea, s as pgEnum, t as pgBit, u as pgInet, v as pgText, w as pgTimestamptz, x as pgTimeCanonical, y as pgTextArray } from "./data-types-BGsYeBpf-B_5bvuEe.mjs";
|
|
6
6
|
import { t as PostgresNativeEnum } from "./postgres-native-enum-CdP3b_-R-Cgz9KEKx.mjs";
|
|
7
7
|
import { BinaryExpr, CaseExpr, CastExpr, FunctionCallExpr, LiteralExpr, NullCheckExpr, OrExpr, SqlCharCodec, SqlFloatCodec, SqlIntCodec, SqlVarcharCodec, canonicalDateTime, sqlCharDescriptor, sqlFloatDescriptor, sqlIntDescriptor, sqlTextDescriptor, sqlVarcharDescriptor } from "@prisma/orm-family-sql/relational-core/ast";
|
|
8
8
|
import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
@@ -11,7 +11,7 @@ import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
|
11
11
|
import { counted, withoutTrailing } from "@prisma/orm-framework/utils/text";
|
|
12
12
|
import { type } from "arktype";
|
|
13
13
|
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
14
|
-
//#region ../../../3-targets/3-targets/postgres/dist/codecs-
|
|
14
|
+
//#region ../../../3-targets/3-targets/postgres/dist/codecs-CnbVrlil.mjs
|
|
15
15
|
let fallback;
|
|
16
16
|
/**
|
|
17
17
|
* Sets the implementation `requireTemporal` returns when the runtime has no global `Temporal`.
|
|
@@ -1888,4 +1888,4 @@ const codecDescriptors = definePostgresCodecs([
|
|
|
1888
1888
|
//#endregion
|
|
1889
1889
|
export { pgVarbitColumn as A, pgNumericColumn as C, pgTimetzColumn as D, pgTimestamptzDateDescriptor as E, postgresQualifyColumnType as M, requireTemporal as N, pgUnboundedIntColumn as O, setFallbackTemporal as P, pgJsonbColumn as S, pgTimestamptzDateColumn as T, pgInt8Column as _, codecDescriptors as a, pgIntervalColumn as b, pgBoolColumn as c, pgFloat4Column as d, pgFloat8Column as f, pgInt4Column as g, pgInt2Column as h, PgTimestamptzDateDescriptor as i, pgVarcharColumn as j, pgUuidColumn as k, pgCharColumn as l, pgInetColumn as m, NUMERIC_SCALE_RANGE as n, isPgEnumParams as o, pgFloatColumn as p, PgTimestamptzDateCodec as r, pgBitColumn as s, NUMERIC_PRECISION_RANGE as t, pgEnumDescriptor as u, pgInt8NumberColumn as v, pgTextColumn as w, pgJsonColumn as x, pgIntColumn as y };
|
|
1890
1890
|
|
|
1891
|
-
//# sourceMappingURL=codecs-
|
|
1891
|
+
//# sourceMappingURL=codecs-CnbVrlil--FxLKWM5.mjs.map
|