@prisma/orm-target-postgres 8.0.0-rc.16-dev.5 → 8.0.0-rc.16-dev.6
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-BB0VVFW2.d.mts → adapter-BXHPMNAg.d.mts} +3 -3
- package/dist/{adapter-BB0VVFW2.d.mts.map → adapter-BXHPMNAg.d.mts.map} +1 -1
- package/dist/{adapter-RtS8vD8U-m4U_WTpQ.mjs → adapter-RtS8vD8U-BnPjAiLV.mjs} +5 -5
- package/dist/{adapter-RtS8vD8U-m4U_WTpQ.mjs.map → adapter-RtS8vD8U-BnPjAiLV.mjs.map} +1 -1
- package/dist/adapter.d.mts +7 -7
- package/dist/adapter.mjs +5 -5
- package/dist/adapter__adapter.d.mts +1 -1
- package/dist/adapter__adapter.mjs +2 -2
- package/dist/adapter__control.d.mts +2 -2
- package/dist/adapter__control.mjs +6 -6
- package/dist/adapter__runtime.d.mts +1 -1
- package/dist/adapter__runtime.mjs +4 -4
- package/dist/adapter__sql-renderer.d.mts +1 -1
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/adapter__types.d.mts +3 -3
- package/dist/{authoring-vHbPLrW4-BsHR7gUE.mjs → authoring-B2hHIzvd-D5NgHs0e.mjs} +4 -4
- package/dist/{authoring-vHbPLrW4-BsHR7gUE.mjs.map → authoring-B2hHIzvd-D5NgHs0e.mjs.map} +1 -1
- package/dist/{check-expressions-Dlt334zg-CV5Vkh3G.mjs → check-expressions-BaFrBceq-ChgvazEN.mjs} +14 -12
- package/dist/check-expressions-BaFrBceq-ChgvazEN.mjs.map +1 -0
- package/dist/{check-expressions-CBIgoKhV-D7oTR8lp.d.mts → check-expressions-CtTzM58x-CsWFEeul.d.mts} +6 -5
- package/dist/check-expressions-CtTzM58x-CsWFEeul.d.mts.map +1 -0
- package/dist/{codec-descriptor-CZAGhM_O-DK9auM7J.mjs → codec-descriptor-C5Ec_6Mw-CpacG1CL.mjs} +3 -2
- package/dist/codec-descriptor-C5Ec_6Mw-CpacG1CL.mjs.map +1 -0
- package/dist/{codec-helpers-D015Pvwa-DR7WMloQ.mjs → codec-helpers-D0ah5Wb8-wdJJZ_8s.mjs} +244 -3
- package/dist/codec-helpers-D0ah5Wb8-wdJJZ_8s.mjs.map +1 -0
- package/dist/{codec-registry-nSGjxm-H-BeUu5zV2.mjs → codec-registry-CKBDkxX7-Kw84Or3s.mjs} +5 -5
- package/dist/{codec-registry-nSGjxm-H-BeUu5zV2.mjs.map → codec-registry-CKBDkxX7-Kw84Or3s.mjs.map} +1 -1
- package/dist/{codec-type-map-DftCqvHU-BYkGKRZI.d.mts → codec-type-map-DueQFJ3a-DKLtMn3R.d.mts} +3 -3
- package/dist/{codec-type-map-DftCqvHU-BYkGKRZI.d.mts.map → codec-type-map-DueQFJ3a-DKLtMn3R.d.mts.map} +1 -1
- package/dist/codec-types-CY3pawL3.d.mts +2 -0
- package/dist/{codec-types-CHtW4cn_-ryYZXjOb.d.mts → codec-types-CYsrudBM-DcYPKpS1.d.mts} +4 -4
- package/dist/{codec-types-CHtW4cn_-ryYZXjOb.d.mts.map → codec-types-CYsrudBM-DcYPKpS1.d.mts.map} +1 -1
- package/dist/{codecs-DelwJv6h-CFbyTJIJ.mjs → codecs-BK3J4C0n-B8EnUXZf.mjs} +49 -37
- package/dist/codecs-BK3J4C0n-B8EnUXZf.mjs.map +1 -0
- package/dist/{codecs-Djhvng3f.d.mts → codecs-ChjCJY5k.d.mts} +2 -2
- package/dist/{codecs-Djhvng3f.d.mts.map → codecs-ChjCJY5k.d.mts.map} +1 -1
- package/dist/{codecs-CvG9lv7r-9RlHwf9Y.d.mts → codecs-y1gOMMt--DKWhYGN5.d.mts} +8 -2
- package/dist/codecs-y1gOMMt--DKWhYGN5.d.mts.map +1 -0
- package/dist/{control-YKrabf1Q.mjs → control-Bpd77Aeq.mjs} +10 -10
- package/dist/{control-YKrabf1Q.mjs.map → control-Bpd77Aeq.mjs.map} +1 -1
- package/dist/{control-CHqdVXHC.d.mts → control-D2JNE1Tz.d.mts} +3 -3
- package/dist/{control-CHqdVXHC.d.mts.map → control-D2JNE1Tz.d.mts.map} +1 -1
- package/dist/{control-adapter-Co30P4lH-B5euUoQ4.mjs → control-adapter-Co30P4lH-e6oCFCC2.mjs} +5 -5
- package/dist/{control-adapter-Co30P4lH-B5euUoQ4.mjs.map → control-adapter-Co30P4lH-e6oCFCC2.mjs.map} +1 -1
- package/dist/{control-policy-bwcdB78Y-DgRaWAzu.mjs → control-policy-B7t5CB1S-CotIwNO4.mjs} +6 -6
- package/dist/{control-policy-bwcdB78Y-DgRaWAzu.mjs.map → control-policy-B7t5CB1S-CotIwNO4.mjs.map} +1 -1
- package/dist/{data-type-entries-DgKLUrqt-TKDikzti.mjs → data-type-entries-DoR61yeO-BB2cY7rI.mjs} +3 -3
- package/dist/{data-type-entries-DgKLUrqt-TKDikzti.mjs.map → data-type-entries-DoR61yeO-BB2cY7rI.mjs.map} +1 -1
- package/dist/{data-types-E1wms1_i.d.mts → data-types-BDkZIUMI.d.mts} +4 -2
- package/dist/{data-types-E1wms1_i.d.mts.map → data-types-BDkZIUMI.d.mts.map} +1 -1
- package/dist/{data-types-k3Ebk3kj-DWk3nh_k.mjs → data-types-DRkmmE9S-C5Q9oH4Q.mjs} +13 -4
- package/dist/data-types-DRkmmE9S-C5Q9oH4Q.mjs.map +1 -0
- package/dist/{default-normalizer-CrMBHF0W-BaUR4Ec8.mjs → default-normalizer-Bf_Fhv4v-CugGfLAe.mjs} +12 -7
- package/dist/default-normalizer-Bf_Fhv4v-CugGfLAe.mjs.map +1 -0
- package/dist/{descriptor-meta-ARufwwWW-DMQsPNAl.mjs → descriptor-meta-ARufwwWW-C5hsT7UQ.mjs} +3 -3
- package/dist/{descriptor-meta-ARufwwWW-DMQsPNAl.mjs.map → descriptor-meta-ARufwwWW-C5hsT7UQ.mjs.map} +1 -1
- package/dist/{descriptor-meta-BgOMP4hF-CfUJsgjc.mjs → descriptor-meta-C8lkQFHe-Cluy19Tk.mjs} +7 -7
- package/dist/{descriptor-meta-BgOMP4hF-CfUJsgjc.mjs.map → descriptor-meta-C8lkQFHe-Cluy19Tk.mjs.map} +1 -1
- package/dist/{descriptor-meta-runtime-CG2S236D-CUkzqeCr.mjs → descriptor-meta-runtime-iArZEoCE-GhLNDdg-.mjs} +3 -3
- package/dist/{descriptor-meta-runtime-CG2S236D-CUkzqeCr.mjs.map → descriptor-meta-runtime-iArZEoCE-GhLNDdg-.mjs.map} +1 -1
- package/dist/{diff-database-schema-zc7d2uxC-BVe8D7vG.mjs → diff-database-schema-KGNaKzKp-Bt2yYSIt.mjs} +4 -4
- package/dist/{diff-database-schema-zc7d2uxC-BVe8D7vG.mjs.map → diff-database-schema-KGNaKzKp-Bt2yYSIt.mjs.map} +1 -1
- package/dist/{full-text-D5pW25-Y.d.mts → full-text-CCqTEQ9y.d.mts} +2 -2
- package/dist/{full-text-D5pW25-Y.d.mts.map → full-text-CCqTEQ9y.d.mts.map} +1 -1
- package/dist/{full-text-index-expression-BpUM2Td6-2Q7y7DnO.mjs → full-text-index-expression-Bfp_xWhy-DtbLdkzv.mjs} +3 -3
- package/dist/{full-text-index-expression-BpUM2Td6-2Q7y7DnO.mjs.map → full-text-index-expression-Bfp_xWhy-DtbLdkzv.mjs.map} +1 -1
- package/dist/{full-text-parsers-BhjgmAe5-CyF7dp_b.d.mts → full-text-parsers-DrS_1B-x-BcAnBoQP.d.mts} +3 -3
- package/dist/{full-text-parsers-BhjgmAe5-CyF7dp_b.d.mts.map → full-text-parsers-DrS_1B-x-BcAnBoQP.d.mts.map} +1 -1
- package/dist/{infer-psl-contract-B5yExD61-Cmye68li.mjs → infer-psl-contract-DoIdoifj-Co9thnGu.mjs} +7 -7
- package/dist/{infer-psl-contract-B5yExD61-Cmye68li.mjs.map → infer-psl-contract-DoIdoifj-Co9thnGu.mjs.map} +1 -1
- package/dist/migration-PTHAY9Cv.mjs.map +1 -1
- package/dist/{op-factory-call-DdXVWQlV-DzfLhTkh.mjs → op-factory-call-BAgAln5R-BTkhp29z.mjs} +3 -3
- package/dist/{op-factory-call-DdXVWQlV-DzfLhTkh.mjs.map → op-factory-call-BAgAln5R-BTkhp29z.mjs.map} +1 -1
- package/dist/{operation-types-Be5rdu14.d.mts → operation-types-CjJY7prP.d.mts} +2 -2
- package/dist/{operation-types-Be5rdu14.d.mts.map → operation-types-CjJY7prP.d.mts.map} +1 -1
- package/dist/{pack-DHV9zslZ.d.mts → pack-Bq9yq-OS.d.mts} +4 -4
- package/dist/{pack-DHV9zslZ.d.mts.map → pack-Bq9yq-OS.d.mts.map} +1 -1
- package/dist/{planner-ZmK0aNuY-Cak-8zwa.mjs → planner-DSTSuAc8-BAfUo5KV.mjs} +7 -7
- package/dist/{planner-ZmK0aNuY-Cak-8zwa.mjs.map → planner-DSTSuAc8-BAfUo5KV.mjs.map} +1 -1
- package/dist/{planner-ddl-builders-DRProi99-D0K5ZiD0.mjs → planner-ddl-builders-Y0_96xpe-BzugdEDO.mjs} +3 -3
- package/dist/{planner-ddl-builders-DRProi99-D0K5ZiD0.mjs.map → planner-ddl-builders-Y0_96xpe-BzugdEDO.mjs.map} +1 -1
- package/dist/{planner-identity-values-C1eV916m-D0p3EfYc.mjs → planner-identity-values-CRS2cQ6v-DakZeIQj.mjs} +3 -3
- package/dist/{planner-identity-values-C1eV916m-D0p3EfYc.mjs.map → planner-identity-values-CRS2cQ6v-DakZeIQj.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-BAWQ6iqr-C06XurYw.mjs → planner-produced-postgres-migration-D7-3OBb_-BGHFKj3i.mjs} +3 -3
- package/dist/{planner-produced-postgres-migration-BAWQ6iqr-C06XurYw.mjs.map → planner-produced-postgres-migration-D7-3OBb_-BGHFKj3i.mjs.map} +1 -1
- package/dist/{postgres-contract-view-B0KloSYp-Cbbl_pIv.mjs → postgres-contract-view-C1bi3x4v-BAfk6euQ.mjs} +5 -5
- package/dist/{postgres-contract-view-B0KloSYp-Cbbl_pIv.mjs.map → postgres-contract-view-C1bi3x4v-BAfk6euQ.mjs.map} +1 -1
- package/dist/{postgres-migration-UVh2xeV0-DW8V_8aj.mjs → postgres-migration-CeX6vfEU-DsmCRCnD.mjs} +8 -8
- package/dist/{postgres-migration-UVh2xeV0-DW8V_8aj.mjs.map → postgres-migration-CeX6vfEU-DsmCRCnD.mjs.map} +1 -1
- package/dist/{prisma7-binding-GebhdAGS.mjs → prisma7-binding-B4BfqE0o.mjs} +6 -6
- package/dist/{prisma7-binding-GebhdAGS.mjs.map → prisma7-binding-B4BfqE0o.mjs.map} +1 -1
- package/dist/{prisma7-binding-FvF1AZxQ.d.mts → prisma7-binding-Dm34z6Fq.d.mts} +4 -4
- package/dist/{prisma7-binding-FvF1AZxQ.d.mts.map → prisma7-binding-Dm34z6Fq.d.mts.map} +1 -1
- package/dist/{runtime-aejvKbMy.d.mts → runtime-CNTEAZIz.d.mts} +2 -2
- package/dist/{runtime-aejvKbMy.d.mts.map → runtime-CNTEAZIz.d.mts.map} +1 -1
- package/dist/{sql-renderer-DT4IEOVi-CE0YIu9V.mjs → sql-renderer-DT4IEOVi-CBE8uTub.mjs} +2 -2
- package/dist/{sql-renderer-DT4IEOVi-CE0YIu9V.mjs.map → sql-renderer-DT4IEOVi-CBE8uTub.mjs.map} +1 -1
- package/dist/{sql-renderer-B1ZLRgUw.d.mts → sql-renderer-hQ3HTY-B.d.mts} +2 -2
- package/dist/{sql-renderer-B1ZLRgUw.d.mts.map → sql-renderer-hQ3HTY-B.d.mts.map} +1 -1
- package/dist/target.d.mts +12 -12
- package/dist/target.mjs +20 -20
- package/dist/target__codec-descriptor.mjs +1 -1
- package/dist/target__codec-types.d.mts +3 -3
- package/dist/target__codecs.d.mts +2 -2
- package/dist/target__codecs.mjs +2 -2
- package/dist/target__control.mjs +3 -3
- package/dist/target__data-types.d.mts +1 -1
- 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__full-text.d.mts +2 -2
- 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__operation-types.d.mts +1 -1
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-ddl-builders.mjs +1 -1
- package/dist/target__planner-identity-values.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.d.mts +1 -1
- package/dist/target__prisma7-binding.mjs +1 -1
- package/dist/target__runtime.mjs +3 -3
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/target__sql-utils.mjs +1 -1
- package/dist/target__types.d.mts +2 -2
- package/dist/target__types.mjs +1 -1
- package/dist/{types-D799eppJ.d.mts → types-BP1e5MBV.d.mts} +2 -2
- package/dist/{types-D799eppJ.d.mts.map → types-BP1e5MBV.d.mts.map} +1 -1
- package/dist/{types-D6lgKhE5-Cu48rrw9.d.mts → types-D6lgKhE5-DYkeCAjr.d.mts} +2 -2
- package/dist/{types-D6lgKhE5-Cu48rrw9.d.mts.map → types-D6lgKhE5-DYkeCAjr.d.mts.map} +1 -1
- package/dist/types-Dnrjripb.d.mts +2 -0
- package/package.json +9 -9
- package/dist/check-expressions-CBIgoKhV-D7oTR8lp.d.mts.map +0 -1
- package/dist/check-expressions-Dlt334zg-CV5Vkh3G.mjs.map +0 -1
- package/dist/codec-descriptor-CZAGhM_O-DK9auM7J.mjs.map +0 -1
- package/dist/codec-helpers-D015Pvwa-DR7WMloQ.mjs.map +0 -1
- package/dist/codec-types-DQUtpepT.d.mts +0 -2
- package/dist/codecs-CvG9lv7r-9RlHwf9Y.d.mts.map +0 -1
- package/dist/codecs-DelwJv6h-CFbyTJIJ.mjs.map +0 -1
- package/dist/data-types-k3Ebk3kj-DWk3nh_k.mjs.map +0 -1
- package/dist/default-normalizer-CrMBHF0W-BaUR4Ec8.mjs.map +0 -1
- package/dist/types-CdJszzhP.d.mts +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-types-k3Ebk3kj-DWk3nh_k.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/data-types-k3Ebk3kj.mjs"],"sourcesContent":["import { b as pgIntervalCanonical, r as canonicalUuid, s as fitsFloat4, u as pgByteaCanonical } from \"./codec-helpers-D015Pvwa.mjs\";\nimport { r as quoteIdentifier } from \"./sql-utils-CVsvXiX4.mjs\";\nimport { numeralText, sqlDataType } from \"@internal/sql-contract/data-type\";\nimport { canonicalDateTime, integerTextCanonicalForm } from \"@internal/sql-contract/data-type-support\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { assembleDataTypes, isNonFiniteText } from \"@internal/framework-components/codec\";\nimport { type } from \"arktype\";\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 written = (text) => ({\n\ttext,\n\twritten: true\n});\nconst catalog = (text) => ({\n\ttext,\n\tcatalog: true\n});\nconst writtenAndCatalog = (text) => ({\n\ttext,\n\twritten: true,\n\tcatalog: true\n});\nconst claimsOnly = (text) => ({ text });\n/** The precision and scale of `numeric`. PostgreSQL 15 and later take a negative scale and one above the precision. */\nconst pgNumericParams = type({\n\t\"precision?\": \"number.integer >= 1 & number.integer <= 1000\",\n\t\"scale?\": \"number.integer >= -1000 & number.integer <= 1000\"\n}).narrow((params, ctx) => params.scale === void 0 || params.precision !== void 0 || ctx.reject({\n\tpath: [\"scale\"],\n\tmessage: \"scale requires a precision\"\n}));\n/** The length of `char` and `varchar`. */\nconst pgCharacterLengthParams = type({ \"length?\": \"number.integer >= 1 & number.integer <= 10485760\" });\n/** The length of `bit` and `bit varying`. */\nconst pgBitLengthParams = type({ \"length?\": \"number.integer >= 1 & number.integer <= 83886080\" });\n/** The fractional-second precision of the time, timestamp and interval types. */\nconst pgPrecisionParams = type({ \"precision?\": \"number.integer >= 0 & number.integer <= 6\" });\nconst pgEnumParams = type({ typeName: \"string > 0\" });\n/** A type with no parameters that is written and reported by its own name. */\nconst namedOnly = (id, name, casts = {}) => sqlDataType(id, {\n\ttexts: [writtenAndCatalog(name)],\n\tcasts\n});\nconst withDefaultLength = (params) => params.length === void 0 ? {\n\t...params,\n\tlength: 1\n} : params;\nconst pgText = namedOnly(\"pg/text\", \"text\");\nconst pgTextArray = sqlDataType(\"pg/text-array\", {});\n/** The enum's `typeName`: its name in `public` or with no schema, its schema-qualified name elsewhere. */\nfunction qualifiedEnumName(reported) {\n\tconst name = reported.name ?? \"\";\n\treturn reported.schema === void 0 || reported.schema === \"public\" ? name : `${reported.schema}.${name}`;\n}\nconst pgEnum = sqlDataType(\"pg/enum\", {\n\tparams: pgEnumParams,\n\tclaimsKind: \"enum\",\n\trender: ({ typeName }) => {\n\t\tconst dot = typeName.indexOf(\".\");\n\t\treturn dot === -1 ? quoteIdentifier(typeName) : `${quoteIdentifier(typeName.slice(0, dot))}.${quoteIdentifier(typeName.slice(dot + 1))}`;\n\t},\n\tfromReported: (reported) => ({ typeName: qualifiedEnumName(reported) })\n});\nconst pgInt2 = sqlDataType(\"pg/int2\", { texts: [written(\"int2\"), catalog(\"smallint\")] });\nconst pgBool = sqlDataType(\"pg/bool\", { texts: [written(\"bool\"), catalog(\"boolean\")] });\nconst pgJson = namedOnly(\"pg/json\", \"json\");\nconst pgTsquery = namedOnly(\"pg/tsquery\", \"tsquery\");\nconst pgInt4 = sqlDataType(\"pg/int4\", {\n\ttexts: [\n\t\twritten(\"int4\"),\n\t\tcatalog(\"integer\"),\n\t\tclaimsOnly(\"int\")\n\t],\n\tcasts: { [pgInt2.id]: unchanged }\n});\nconst pgInt8 = sqlDataType(\"pg/int8\", {\n\ttexts: [written(\"int8\"), catalog(\"bigint\")],\n\ttoCanonicalForm: integerTextCanonicalForm,\n\tcasts: {\n\t\t[pgInt2.id]: asNumeralText,\n\t\t[pgInt4.id]: asNumeralText\n\t}\n});\nconst pgNumeric = sqlDataType(\"pg/numeric\", {\n\tparams: pgNumericParams,\n\ttexts: [\n\t\twrittenAndCatalog(\"numeric\"),\n\t\twritten(\"numeric({precision})\"),\n\t\twrittenAndCatalog(\"numeric({precision},{scale})\"),\n\t\tclaimsOnly(\"decimal\"),\n\t\tclaimsOnly(\"decimal({precision})\"),\n\t\tclaimsOnly(\"decimal({precision},{scale})\")\n\t],\n\tnormalize: (params) => params.precision !== void 0 && params.scale === void 0 ? {\n\t\t...params,\n\t\tscale: 0\n\t} : params,\n\tcasts: {\n\t\t[pgInt2.id]: asNumeralText,\n\t\t[pgInt4.id]: asNumeralText,\n\t\t[pgInt8.id]: unchanged\n\t}\n});\n/** `float4` stores a single-precision float, so a magnitude past about 3.4e38, or one it would round to 0, does not fit. */\nconst asFloat4 = (value) => {\n\tconst converted = asFloat(value);\n\tif (typeof converted !== \"number\" || fitsFloat4(converted)) return converted;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${converted} is out of range: float4 holds a nonzero magnitude from about 1.4e-45 to 3.4e38.`, {\n\t\twhy: \"float4 stores a single-precision float, which overflows past about 3.4e38 and rounds a magnitude below about 1.4e-45 to 0.\",\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 = sqlDataType(\"pg/float4\", {\n\ttexts: [written(\"float4\"), catalog(\"real\")],\n\tcasts: floatCastsOf(asFloat4)\n});\nconst pgFloat8 = sqlDataType(\"pg/float8\", {\n\ttexts: [\n\t\twritten(\"float8\"),\n\t\tcatalog(\"double precision\"),\n\t\tclaimsOnly(\"float\")\n\t],\n\tcasts: floatCastsOf(asFloat)\n});\nconst pgJsonb = namedOnly(\"pg/jsonb\", \"jsonb\", { [pgJson.id]: unchanged });\nconst fromText = { [pgText.id]: unchanged };\nconst pgChar = sqlDataType(\"pg/char\", {\n\tparams: pgCharacterLengthParams,\n\ttexts: [\n\t\twritten(\"character\"),\n\t\twrittenAndCatalog(\"character({length})\"),\n\t\tclaimsOnly(\"char\"),\n\t\tclaimsOnly(\"char({length})\")\n\t],\n\tnormalize: withDefaultLength,\n\tcasts: fromText\n});\nconst pgVarchar = sqlDataType(\"pg/varchar\", {\n\tparams: pgCharacterLengthParams,\n\ttexts: [\n\t\twrittenAndCatalog(\"character varying\"),\n\t\twrittenAndCatalog(\"character varying({length})\"),\n\t\tclaimsOnly(\"varchar\"),\n\t\tclaimsOnly(\"varchar({length})\")\n\t],\n\tcasts: fromText\n});\n/** Text in any form PostgreSQL reads as a UUID, written the way PostgreSQL writes it, so the contract holds the value the database reports. */\nconst asUuid = (value) => {\n\tif (typeof value !== \"string\") return wrongShape(value, \"text\");\n\tconst uuid = canonicalUuid(value);\n\tif (uuid !== void 0) return uuid;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${JSON.stringify(value)} is not a UUID: PostgreSQL reads 32 hexadecimal digits, with a hyphen after any group of four and optionally in braces.`, {\n\t\twhy: \"A uuid column takes only text PostgreSQL reads as a UUID.\",\n\t\tfix: \"Write a UUID such as a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11.\"\n\t});\n};\nconst pgUuid = sqlDataType(\"pg/uuid\", {\n\ttexts: [writtenAndCatalog(\"uuid\")],\n\tcasts: { [pgText.id]: asUuid }\n});\nconst pgInet = namedOnly(\"pg/inet\", \"inet\", fromText);\nconst pgBit = sqlDataType(\"pg/bit\", {\n\tparams: pgBitLengthParams,\n\ttexts: [written(\"bit\"), writtenAndCatalog(\"bit({length})\")],\n\tnormalize: withDefaultLength,\n\tcasts: fromText\n});\nconst pgVarbit = sqlDataType(\"pg/varbit\", {\n\tparams: pgBitLengthParams,\n\ttexts: [\n\t\twrittenAndCatalog(\"bit varying\"),\n\t\twrittenAndCatalog(\"bit varying({length})\"),\n\t\tclaimsOnly(\"varbit\"),\n\t\tclaimsOnly(\"varbit({length})\")\n\t],\n\tcasts: fromText\n});\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\townerId: \"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\townerId: \"pg/time\"\n}, false);\nconst pgTimetzCanonical = postgresDateTime({\n\tshape: \"timeWithOffset\",\n\townerId: \"pg/timetz\",\n\tmaxOffsetHours: 15\n}, false);\nconst pgTimestampCanonical = postgresDateTime({\n\tshape: \"dateTime\",\n\townerId: \"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\townerId: \"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 type whose canonical form reads text: that canonical form, and the same function as its cast from text. */\nfunction typeCanonicalFromText(id, canonical, spec) {\n\tconst toCanonicalForm = canonicalFromText(canonical);\n\treturn sqlDataType(id, {\n\t\t...spec,\n\t\ttoCanonicalForm,\n\t\tcasts: { [pgText.id]: toCanonicalForm }\n\t});\n}\nconst pgTimetz = typeCanonicalFromText(\"pg/timetz\", pgTimetzCanonical, {\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"timetz\"),\n\t\twritten(\"timetz({precision})\"),\n\t\tcatalog(\"time with time zone\"),\n\t\tcatalog(\"time({precision}) with time zone\")\n\t]\n});\nconst pgInterval = typeCanonicalFromText(\"pg/interval\", pgIntervalCanonical, {\n\tparams: pgPrecisionParams,\n\ttexts: [writtenAndCatalog(\"interval\"), writtenAndCatalog(\"interval({precision})\")]\n});\nconst pgBytea = typeCanonicalFromText(\"pg/bytea\", pgByteaCanonical, { texts: [writtenAndCatalog(\"bytea\")] });\nconst pgDate = typeCanonicalFromText(\"pg/date\", pgDateCanonical, { texts: [writtenAndCatalog(\"date\")] });\nconst pgTime = typeCanonicalFromText(\"pg/time\", pgTimeCanonical, {\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"time\"),\n\t\twritten(\"time({precision})\"),\n\t\tcatalog(\"time without time zone\"),\n\t\tcatalog(\"time({precision}) without time zone\")\n\t]\n});\nconst pgTimestamp = typeCanonicalFromText(\"pg/timestamp\", pgTimestampCanonical, {\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"timestamp\"),\n\t\twritten(\"timestamp({precision})\"),\n\t\tcatalog(\"timestamp without time zone\"),\n\t\tcatalog(\"timestamp({precision}) without time zone\")\n\t]\n});\nconst pgTimestamptz = typeCanonicalFromText(\"pg/timestamptz\", pgTimestamptzCanonical, {\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"timestamptz\"),\n\t\twritten(\"timestamptz({precision})\"),\n\t\tcatalog(\"timestamp with time zone\"),\n\t\tcatalog(\"timestamp({precision}) with time zone\")\n\t]\n});\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/** A lookup of the data types this target registers. */\nfunction createPostgresBuiltinDataTypeLookup() {\n\treturn assembleDataTypes([{\n\t\tid: \"postgres\",\n\t\tdataTypes: postgresDataTypes\n\t}]).lookup;\n}\n//#endregion\nexport { pgTimestamptz as A, pgPrecisionParams as C, pgTimeCanonical as D, pgTime as E, pgUuid as F, pgVarbit as I, pgVarchar as L, pgTimetz as M, pgTimetzCanonical as N, pgTimestamp as O, pgTsquery as P, postgresDataTypes as R, pgNumericParams as S, pgTextArray as T, pgInt8 as _, pgBytea as a, pgJsonb as b, pgDate as c, pgEnumParams as d, pgFloat4 as f, pgInt4 as g, pgInt2 as h, pgBool as i, pgTimestamptzCanonical as j, pgTimestampCanonical as k, pgDateCanonical as l, pgInet as m, pgBit as n, pgChar as o, pgFloat8 as p, pgBitLengthParams as r, pgCharacterLengthParams as s, createPostgresBuiltinDataTypeLookup as t, pgEnum as u, pgInterval as v, pgText as w, pgNumeric as x, pgJson as y };\n\n//# sourceMappingURL=data-types-k3Ebk3kj.mjs.map"],"mappings":";;;;;;;;;AASA,MAAM,aAAa,UAAU;AAC7B,SAAS,WAAW,OAAO,UAAU;CACpC,MAAM,gBAAgB,yBAAyB,YAAY,SAAS,QAAQ,KAAK,UAAU,KAAK,EAAE,IAAI;EACrG,KAAK;EACL,KAAK;CACN,CAAC;AACF;;AAEA,MAAM,iBAAiB,UAAU,OAAO,UAAU,WAAW,YAAY,KAAK,IAAI,WAAW,OAAO,UAAU;;;;;;;AAO9G,MAAM,WAAW,UAAU;CAC1B,IAAI,OA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S,sBAAsB,WAAW,iBAAiB,EAAE,OAAO,CAAC,kBAAkB,MAAM,CAAC,EAAE,CAAC;AACvG,MAAM,SAAS,sBAAsB,WAAW,iBAAiB;CAChE,QAAQ;CACR,OAAO;EACN,QAAQ,MAAM;EACd,QAAQ,mBAAmB;EAC3B,QAAQ,wBAAwB;EAChC,QAAQ,qCAAqC;CAC9C;AACD,CAAC;AACD,MAAM,cAAc,sBAAsB,gBAAgB,sBAAsB;CAC/E,QAAQ;CACR,OAAO;EACN,QAAQ,WAAW;EACnB,QAAQ,wBAAwB;EAChC,QAAQ,6BAA6B;EACrC,QAAQ,0CAA0C;CACnD;AACD,CAAC;AACD,MAAM,gBAAgB,sBAAsB,kBAAkB,wBAAwB;CACrF,QAAQ;CACR,OAAO;EACN,QAAQ,aAAa;EACrB,QAAQ,0BAA0B;EAClC,QAAQ,0BAA0B;EAClC,QAAQ,uCAAuC;CAChD;AACD,CAAC;;AAED,MAAM,oBAAoB;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;AAEA,SAAS,sCAAsC;CAC9C,OAAO,kBAAkB,CAAC;EACzB,IAAI;EACJ,WAAW;CACZ,CAAC,CAAC,CAAC,CAAC;AACL"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-normalizer-CrMBHF0W-BaUR4Ec8.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/default-normalizer-CrMBHF0W.mjs"],"sourcesContent":["import { r as canonicalUuid } from \"./codec-helpers-D015Pvwa.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/core/default-normalizer.ts\n/**\n* Pre-compiled regex patterns for performance.\n* These are compiled once at module load time rather than on each function call.\n*/\nconst NEXTVAL_PATTERN = /^nextval\\s*\\(/i;\nconst NOW_FUNCTION_PATTERN = /^(now\\s*\\(\\s*\\)|CURRENT_TIMESTAMP)$/i;\nconst CLOCK_TIMESTAMP_PATTERN = /^clock_timestamp\\s*\\(\\s*\\)$/i;\nconst TIMESTAMP_CAST_SUFFIX = /::timestamp(?:tz|\\s+(?:with|without)\\s+time\\s+zone)?$/i;\nconst TEXT_CAST_SUFFIX = /::text$/i;\nconst NOW_LITERAL_PATTERN = /^'now'$/i;\nconst UUID_PATTERN = /^gen_random_uuid\\s*\\(\\s*\\)$/i;\nconst UUID_OSSP_PATTERN = /^uuid_generate_v4\\s*\\(\\s*\\)$/i;\nconst NULL_PATTERN = /^NULL(?:::.+)?$/i;\nconst TRUE_PATTERN = /^true$/i;\nconst FALSE_PATTERN = /^false$/i;\n/**\n* A decimal numeral with an optional sign and an optional exponent. Postgres prints a `real` or\n* `double precision` default in exponent notation once its magnitude is large or small enough:\n* `'1e+20'::real`, `'1e-320'::double precision`.\n*/\nconst NUMERAL = String.raw`[+-]?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?`;\nconst NUMERIC_PATTERN = new RegExp(`^${NUMERAL}$`);\n/**\n* A type modifier: `(3)`, `(65,30)`, or a numeric type's negative scale, `(5,-2)`, which PostgreSQL\n* 15 and later accept.\n*/\nconst TYPE_MODIFIER = String.raw`\\(\\d+(?:,\\s*-?\\d+)?\\)`;\n/**\n* A cast target type: a builtin of one or more words, where any word may carry a modifier\n* (`timestamp(3) without time zone`, `numeric(65,30)`), or a quoted identifier (`\"AuditAction\"`);\n* either may be qualified by a possibly quoted schema (`audit.\"AuditAction\"`, `\"my schema\".t`).\n*/\nconst TYPE_NAME = String.raw`(?:(?:\"(?:[^\"]|\"\")+\"|\\w+)\\.)?(?:\"(?:[^\"]|\"\")+\"|\\w+(?:${TYPE_MODIFIER})?(?:\\s+\\w+(?:${TYPE_MODIFIER})?)*)`;\nconst QUOTED_LITERAL_PATTERN = new RegExp(`^'((?:[^']|'')*)'(?:::(${TYPE_NAME}))?$`);\nconst NUMBER_LITERAL_PATTERN = new RegExp(`^(${NUMERAL})(?:::(${TYPE_NAME}))?$`);\nconst PARENTHESISED_CAST_PATTERN = new RegExp(String.raw`^\\((.+)\\)::(${TYPE_NAME})$`, \"s\");\nconst INTEGER_PATTERN = /^-?\\d+$/;\nconst INTEGER_TYPE_PATTERN = /^(?:smallint|integer|bigint|int2|int4|int8)$/i;\nconst NUMBER_TYPE_PATTERN = new RegExp(`^(?:smallint|integer|bigint|int2|int4|int8|real|double precision|float4|float8|numeric|decimal)(?:${TYPE_MODIFIER})?$`, \"i\");\nconst DECIMAL_TEXT_TYPE_PATTERN = new RegExp(`^(?:bigint|int8|numeric|decimal)(?:${TYPE_MODIFIER})?$`, \"i\");\n/**\n* Matches a Postgres array literal default of the form `'{...}'::elemtype[]`.\n* The literal body is captured in group 1; the cast (including `[]`) is optional.\n* Examples: `'{}'::text[]`, `'{1,2}'::integer[]`, `'{}'`\n*/\nconst ARRAY_LITERAL_PATTERN = /^'(\\{.*\\})'(?:::.+\\[\\])?$/;\n/** `box` is the one core type whose array elements are delimited by `;`, not `,`. */\nconst SEMICOLON_DELIMITED_ELEMENT_TYPE_PATTERN = /^box$/i;\n/**\n* Matches the constructor spelling Postgres reports for a default written as\n* `ARRAY[...]`: `ARRAY['a'::text, 'b'::text]`, `ARRAY[1, 2]`, `ARRAY[]::text[]`.\n* The element list is captured in group 1; the outer cast is optional.\n*/\nconst ARRAY_CONSTRUCTOR_PATTERN = new RegExp(String.raw`^ARRAY\\[(.*?)\\](?:::${TYPE_NAME}\\[\\])?$`, \"is\");\nconst OUTER_ARRAY_CAST_PATTERN = new RegExp(String.raw`^\\((.+)\\)::${TYPE_NAME}\\[\\]$`, \"s\");\n/**\n* Returns the canonical expression for a timestamp default function, or undefined\n* if the expression is not a recognized timestamp default.\n*\n* Keeps now()/CURRENT_TIMESTAMP and clock_timestamp() distinct:\n* - now(), CURRENT_TIMESTAMP, ('now'::text)::timestamp... → 'now()'\n* - clock_timestamp(), clock_timestamp()::timestamptz → 'clock_timestamp()'\n*\n* These are semantically different in Postgres: now() returns the transaction\n* start time (constant within a transaction), while clock_timestamp() returns\n* the actual wall-clock time (can differ across rows in a single INSERT).\n*/\nfunction canonicalizeTimestampDefault(expr) {\n\tif (NOW_FUNCTION_PATTERN.test(expr)) return \"now()\";\n\tif (CLOCK_TIMESTAMP_PATTERN.test(expr)) return \"clock_timestamp()\";\n\tif (!TIMESTAMP_CAST_SUFFIX.test(expr)) return void 0;\n\tlet inner = expr.replace(TIMESTAMP_CAST_SUFFIX, \"\").trim();\n\tif (inner.startsWith(\"(\") && inner.endsWith(\")\")) inner = inner.slice(1, -1).trim();\n\tif (NOW_FUNCTION_PATTERN.test(inner)) return \"now()\";\n\tif (CLOCK_TIMESTAMP_PATTERN.test(inner)) return \"clock_timestamp()\";\n\tinner = inner.replace(TEXT_CAST_SUFFIX, \"\").trim();\n\tif (NOW_LITERAL_PATTERN.test(inner)) return \"now()\";\n}\n/**\n* A numeral cast to a number type. A cast to an integer type rounds a fraction, so that numeral is\n* not the value.\n*/\nfunction castNumber(numeral, castType) {\n\tif (castType === void 0) return {\n\t\tkind: \"number\",\n\t\tnumeral\n\t};\n\tif (!NUMBER_TYPE_PATTERN.test(castType)) return void 0;\n\tif (INTEGER_TYPE_PATTERN.test(castType) && !INTEGER_PATTERN.test(numeral)) return void 0;\n\treturn {\n\t\tkind: \"number\",\n\t\tnumeral\n\t};\n}\n/**\n* Reads a literal by its cast type: `'-1'::integer` and `(1)::bigint` are numbers, `'a'::text` is a\n* string. A parenthesised cast is read only from number to number: `('now'::text)::date` is\n* evaluated on insert. Anything else, such as an operator or a function call, is not a literal.\n*/\nfunction readLiteralToken(expression) {\n\tconst quoted = QUOTED_LITERAL_PATTERN.exec(expression);\n\tif (quoted?.[1] !== void 0) {\n\t\tconst text = quoted[1].replace(/''/g, \"'\");\n\t\tconst castType = quoted[2];\n\t\treturn castType !== void 0 && NUMBER_TYPE_PATTERN.test(castType) && NUMERIC_PATTERN.test(text) ? castNumber(text, castType) : {\n\t\t\tkind: \"string\",\n\t\t\ttext\n\t\t};\n\t}\n\tconst number = NUMBER_LITERAL_PATTERN.exec(expression);\n\tif (number?.[1] !== void 0) return castNumber(number[1], number[2]);\n\tconst parenthesised = PARENTHESISED_CAST_PATTERN.exec(expression);\n\tif (parenthesised?.[1] === void 0 || parenthesised[2] === void 0) return void 0;\n\tconst inner = readLiteralToken(parenthesised[1].trim());\n\treturn inner?.kind === \"number\" ? castNumber(inner.numeral, parenthesised[2]) : void 0;\n}\n/**\n* `int8` and `numeric` defaults are decimal text, the JSON form of their codecs, so no digit is\n* lost to a JavaScript number. A column that is not a number type stores the numeral as text.\n*/\nfunction numberValue(numeral, nativeType) {\n\tif (nativeType !== void 0 && DECIMAL_TEXT_TYPE_PATTERN.test(nativeType)) return numeral;\n\tif (nativeType !== void 0 && !NUMBER_TYPE_PATTERN.test(nativeType)) return numeral;\n\tconst parsed = Number(numeral);\n\treturn Number.isFinite(parsed) ? parsed : void 0;\n}\n/**\n* Splits a Postgres array literal body (without the enclosing braces) into its\n* element tokens, honouring quoting. A comma only separates elements when it is\n* outside double quotes; inside a quoted element a doubled quote (`\"\"`) or a\n* backslash-escaped quote (`\\\"`) is a literal quote, and a backslash escapes the\n* next character. Returns undefined if the body is malformed (e.g. an unbalanced\n* quote), nests an array, which puts a brace outside quotes, or escapes a character outside\n* quotes with a backslash, which Postgres never prints.\n*/\nfunction splitArrayElements(inner) {\n\tconst tokens = [];\n\tlet current = \"\";\n\tlet inQuotes = false;\n\tlet quoted = false;\n\tfor (let i = 0; i < inner.length; i++) {\n\t\tconst char = inner[i];\n\t\tif (inQuotes) {\n\t\t\tif (char === \"\\\\\") {\n\t\t\t\tconst next = inner[i + 1];\n\t\t\t\tif (next === void 0) return void 0;\n\t\t\t\tcurrent += next;\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (char === \"\\\"\") {\n\t\t\t\tif (inner[i + 1] === \"\\\"\") {\n\t\t\t\t\tcurrent += \"\\\"\";\n\t\t\t\t\ti++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tinQuotes = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcurrent += char;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === \"\\\"\") {\n\t\t\tinQuotes = true;\n\t\t\tquoted = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === \"{\" || char === \"}\" || char === \"\\\\\") return void 0;\n\t\tif (char === \",\") {\n\t\t\ttokens.push({\n\t\t\t\tvalue: current,\n\t\t\t\tquoted\n\t\t\t});\n\t\t\tcurrent = \"\";\n\t\t\tquoted = false;\n\t\t\tcontinue;\n\t\t}\n\t\tcurrent += char;\n\t}\n\tif (inQuotes) return void 0;\n\ttokens.push({\n\t\tvalue: current,\n\t\tquoted\n\t});\n\treturn tokens;\n}\nconst BOOLEAN_TYPE_PATTERN = /^(?:bool|boolean)$/i;\nconst BOOLEAN_TRUE_TOKEN_PATTERN = /^(?:t|true)$/i;\nconst BOOLEAN_FALSE_TOKEN_PATTERN = /^(?:f|false)$/i;\nconst BYTEA_HEX_INPUT = /^\\\\x((?:[ \\t\\n\\r]*[0-9A-Fa-f]{2})*)[ \\t\\n\\r]*$/;\nconst BYTEA_ESCAPE_TOKEN = /\\\\\\\\|\\\\[0-3][0-7]{2}|[^\\\\]+|\\\\/g;\nfunction byteaEscapeTokenBytes(token) {\n\tif (token === \"\\\\\\\\\") return Buffer.from(\"\\\\\");\n\tif (token === \"\\\\\") return void 0;\n\tif (token.startsWith(\"\\\\\")) return Buffer.from([Number.parseInt(token.slice(1), 8)]);\n\treturn Buffer.from(token, \"utf8\");\n}\n/**\n* The bytes of `bytea` input text, as the base64 the codec stores, or `undefined` for text\n* PostgreSQL refuses. Text starting `\\x` is hex, two digits for each byte. Any other text is the\n* escape format: `\\\\` is a backslash, `\\` and three octal digits is that byte, and any other\n* character is its UTF-8 bytes.\n*/\nfunction byteaInputBase64(text) {\n\tconst hex = BYTEA_HEX_INPUT.exec(text)?.[1];\n\tif (hex !== void 0) return Buffer.from(hex.replace(/\\s/g, \"\"), \"hex\").toString(\"base64\");\n\tif (text.startsWith(\"\\\\x\")) return void 0;\n\tconst chunks = [];\n\tfor (const [token] of text.matchAll(BYTEA_ESCAPE_TOKEN)) {\n\t\tconst bytes = byteaEscapeTokenBytes(token);\n\t\tif (bytes === void 0) return void 0;\n\t\tchunks.push(bytes);\n\t}\n\treturn Buffer.concat(chunks).toString(\"base64\");\n}\n/**\n* A text default as the column stores it: a uuid in the form PostgreSQL writes, which its codec\n* reads, and a bytea as the base64 of its bytes. `undefined` for bytea text PostgreSQL refuses.\n*/\nfunction storedText(text, nativeType) {\n\tif (nativeType === \"bytea\") return byteaInputBase64(text);\n\treturn nativeType === \"uuid\" ? canonicalUuid(text) ?? text : text;\n}\n/**\n* Reads an unquoted, non-NULL array element by the column's element type. Only text Postgres itself\n* would print is read; anything else keeps the raw expression.\n*/\nfunction unquotedElementValue(token, elementType) {\n\tif (token === \"\") return void 0;\n\tif (BOOLEAN_TYPE_PATTERN.test(elementType)) {\n\t\tif (BOOLEAN_TRUE_TOKEN_PATTERN.test(token)) return true;\n\t\tif (BOOLEAN_FALSE_TOKEN_PATTERN.test(token)) return false;\n\t\treturn;\n\t}\n\tif (NUMBER_TYPE_PATTERN.test(elementType)) return NUMERIC_PATTERN.test(token) ? numberValue(token, elementType) : void 0;\n\tif (isJsonElementType(elementType)) {\n\t\tconst document = readJsonDocument(token);\n\t\treturn document.kind === \"json\" ? document.value : void 0;\n\t}\n\treturn storedText(token, elementType);\n}\n/**\n* Parses a Postgres array literal body (`{...}`) into a JS array of primitives.\n* Returns undefined if the body cannot be reliably parsed.\n*\n* Handles:\n* - `{}` → `[]`\n* - `{elem1,elem2,...}` → `[elem1, elem2, ...]`, each unquoted element read by the element type\n* - quoted elements that contain commas, doubled/escaped quotes, and the literal\n* strings `NULL`/`true`/`false` (a quoted token is always a string)\n*/\nfunction parseArrayLiteralBody(body, elementType) {\n\tconst inner = body.slice(1, -1).trim();\n\tif (inner === \"\") return [];\n\tconst tokens = splitArrayElements(inner);\n\tif (tokens === void 0) return void 0;\n\tconst result = [];\n\tfor (const token of tokens) {\n\t\tif (token.quoted) {\n\t\t\tconst value = textElementValue(token.value, elementType);\n\t\t\tif (value === void 0) return void 0;\n\t\t\tresult.push(value);\n\t\t\tcontinue;\n\t\t}\n\t\tconst el = token.value.trim();\n\t\tif (el.toUpperCase() === \"NULL\") {\n\t\t\tif (isJsonElementType(elementType)) return void 0;\n\t\t\tresult.push(null);\n\t\t\tcontinue;\n\t\t}\n\t\tconst value = unquotedElementValue(el, elementType);\n\t\tif (value === void 0) return void 0;\n\t\tresult.push(value);\n\t}\n\treturn result;\n}\n/**\n* Splits an `ARRAY[...]` element list on the commas outside quotes and parentheses, so\n* `numeric(65,30)` and `'a,b'` stay inside one element. A doubled quote inside an element is a\n* literal quote, so it never closes one.\n*/\nfunction splitConstructorElements(body) {\n\tconst elements = [];\n\tlet current = \"\";\n\tlet quote;\n\tlet depth = 0;\n\tfor (const char of body) {\n\t\tif (quote !== void 0) {\n\t\t\tif (char === quote) quote = void 0;\n\t\t} else if (char === \"'\" || char === \"\\\"\") quote = char;\n\t\telse if (char === \"(\") depth++;\n\t\telse if (char === \")\") depth--;\n\t\telse if (char === \",\" && depth === 0) {\n\t\t\telements.push(current);\n\t\t\tcurrent = \"\";\n\t\t\tcontinue;\n\t\t}\n\t\tcurrent += char;\n\t}\n\telements.push(current);\n\treturn elements.map((element) => element.trim());\n}\n/**\n* Reads one `ARRAY[...]` element: NULL, a boolean, or a literal read by its cast type. Anything\n* else, such as a function call, means the constructor is not a literal and the caller keeps the\n* raw expression.\n*/\nfunction parseConstructorElement(element, elementType) {\n\tif (NULL_PATTERN.test(element)) return isJsonElementType(elementType) ? void 0 : null;\n\tif (TRUE_PATTERN.test(element)) return true;\n\tif (FALSE_PATTERN.test(element)) return false;\n\tconst token = readLiteralToken(element);\n\tif (token === void 0) return void 0;\n\treturn token.kind === \"number\" ? numberValue(token.numeral, elementType) : textElementValue(token.text, elementType);\n}\nfunction isJsonElementType(elementType) {\n\treturn elementType === \"json\" || elementType === \"jsonb\";\n}\n/**\n* A `json`/`jsonb` element's text is a JSON document, as it is on a scalar column of the same type.\n* Undefined keeps the raw expression: the document holds a number a JavaScript number would change.\n*/\nfunction textElementValue(text, elementType) {\n\tif (!isJsonElementType(elementType)) return storedText(text, elementType);\n\tconst document = readJsonDocument(text);\n\tif (document.kind === \"inexact\") return void 0;\n\treturn document.kind === \"json\" ? document.value : text;\n}\n/**\n* Parses JSON text. Postgres keeps every digit of a json number, so a document holding a number that\n* would not print back as the same value once read into a JavaScript number, such as\n* `12345678901234567890` or `1e400`, is `inexact`. `1.0` prints back as `1`, the same value.\n*/\nfunction readJsonDocument(text) {\n\tlet exact = true;\n\tconst reviver = (_key, value, context) => {\n\t\tif (typeof value === \"number\" && !keepsJsonNumber(value, context?.source)) exact = false;\n\t\treturn value;\n\t};\n\tlet value;\n\ttry {\n\t\tvalue = blindCast(JSON.parse(text, reviver));\n\t} catch {\n\t\treturn { kind: \"invalid\" };\n\t}\n\treturn exact ? {\n\t\tkind: \"json\",\n\t\tvalue\n\t} : { kind: \"inexact\" };\n}\nfunction keepsJsonNumber(value, source) {\n\tif (!Number.isFinite(value) || source === void 0) return false;\n\tconst written = decimalValue(source);\n\treturn written !== void 0 && written === decimalValue(String(value));\n}\nconst DECIMAL_PARTS_PATTERN = /^(-?)(\\d+)(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/;\n/** A numeral's value as `<sign><digits>e<exponent>`, with no leading or trailing zero digits. */\nfunction decimalValue(numeral) {\n\tconst parts = DECIMAL_PARTS_PATTERN.exec(numeral);\n\tif (parts === null) return void 0;\n\tconst [, sign = \"\", whole = \"\", fraction = \"\", exponent = \"0\"] = parts;\n\tconst digits = `${whole}${fraction}`.replace(/^0+/, \"\");\n\tif (digits === \"\") return \"0\";\n\tconst significant = digits.replace(/0+$/, \"\");\n\treturn `${sign}${significant}e${Number(exponent) - fraction.length + digits.length - significant.length}`;\n}\nfunction parseArrayConstructor(body, elementType) {\n\tif (body.trim() === \"\") return [];\n\tconst values = [];\n\tfor (const element of splitConstructorElements(body)) {\n\t\tconst value = parseConstructorElement(element, elementType);\n\t\tif (value === void 0) return void 0;\n\t\tvalues.push(value);\n\t}\n\treturn values;\n}\nfunction unwrapOuterArrayCasts(expression) {\n\tconst match = OUTER_ARRAY_CAST_PATTERN.exec(expression);\n\treturn match?.[1] === void 0 ? expression : unwrapOuterArrayCasts(match[1].trim());\n}\n/**\n* Parses a raw Postgres column default expression into a normalized ColumnDefault.\n* This enables semantic comparison between contract defaults and introspected schema defaults.\n*\n* Used by the migration diff layer to normalize raw database defaults during comparison,\n* keeping the introspection layer focused on faithful data capture.\n*\n* @param rawDefault - Raw default expression from information_schema.columns.column_default\n* @param nativeType - Native column type, used for type-aware parsing (array, int8, numeric, JSON)\n* @returns Normalized ColumnDefault or undefined if the expression cannot be parsed\n*/\nfunction parsePostgresDefault(rawDefault, nativeType) {\n\tconst trimmed = rawDefault.trim();\n\tconst normalizedType = nativeType?.toLowerCase();\n\tif (NEXTVAL_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"autoincrement()\"\n\t};\n\tif (normalizedType?.endsWith(\"[]\")) {\n\t\tconst elementType = normalizedType.slice(0, -2);\n\t\tconst arrayMatch = trimmed.match(ARRAY_LITERAL_PATTERN);\n\t\tif (arrayMatch?.[1] !== void 0 && !SEMICOLON_DELIMITED_ELEMENT_TYPE_PATTERN.test(elementType)) {\n\t\t\tconst parsed = parseArrayLiteralBody(arrayMatch[1].replace(/''/g, \"'\"), elementType);\n\t\t\tif (parsed !== void 0) return {\n\t\t\t\tkind: \"literal\",\n\t\t\t\tvalue: parsed\n\t\t\t};\n\t\t}\n\t\tconst constructorMatch = unwrapOuterArrayCasts(trimmed).match(ARRAY_CONSTRUCTOR_PATTERN);\n\t\tif (constructorMatch?.[1] !== void 0) {\n\t\t\tconst parsed = parseArrayConstructor(constructorMatch[1], elementType);\n\t\t\tif (parsed !== void 0) return {\n\t\t\t\tkind: \"literal\",\n\t\t\t\tvalue: parsed\n\t\t\t};\n\t\t}\n\t\tif (NULL_PATTERN.test(trimmed)) return {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: null\n\t\t};\n\t\treturn {\n\t\t\tkind: \"function\",\n\t\t\texpression: trimmed\n\t\t};\n\t}\n\tconst canonicalTimestamp = canonicalizeTimestampDefault(trimmed);\n\tif (canonicalTimestamp) return {\n\t\tkind: \"function\",\n\t\texpression: canonicalTimestamp\n\t};\n\tif (UUID_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"gen_random_uuid()\"\n\t};\n\tif (UUID_OSSP_PATTERN.test(trimmed)) return {\n\t\tkind: \"function\",\n\t\texpression: \"gen_random_uuid()\"\n\t};\n\tif (NULL_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: null\n\t};\n\tif (TRUE_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: true\n\t};\n\tif (FALSE_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tvalue: false\n\t};\n\tconst token = readLiteralToken(trimmed);\n\tif (token === void 0) return {\n\t\tkind: \"function\",\n\t\texpression: trimmed\n\t};\n\tif (token.kind === \"number\") {\n\t\tconst value = numberValue(token.numeral, normalizedType);\n\t\treturn value === void 0 ? void 0 : {\n\t\t\tkind: \"literal\",\n\t\t\tvalue\n\t\t};\n\t}\n\tif (normalizedType !== void 0 && isJsonElementType(normalizedType)) {\n\t\tconst document = readJsonDocument(token.text);\n\t\tif (document.kind === \"inexact\") return {\n\t\t\tkind: \"function\",\n\t\t\texpression: trimmed\n\t\t};\n\t\tif (document.kind === \"json\") return {\n\t\t\tkind: \"literal\",\n\t\t\tvalue: document.value\n\t\t};\n\t}\n\tconst text = storedText(token.text, normalizedType);\n\treturn text === void 0 ? {\n\t\tkind: \"function\",\n\t\texpression: trimmed\n\t} : {\n\t\tkind: \"literal\",\n\t\tvalue: text\n\t};\n}\n/**\n* Normalizes a contract-declared default through {@link parsePostgresDefault}\n* — the same parser introspection uses — so a function-shaped default the\n* parser recognizes as a literal (e.g. sql`'{}'::jsonb`)\n* resolves to the same `resolvedDefault` shape a live introspected column\n* would produce. Compensates once, at `SchemaIR` construction of the\n* expected (contract-derived) side (`contractToSchemaIR`'s `resolveDefault`\n* hook), instead of at every site that later compares the two sides. A\n* literal default, or a function form the parser doesn't recognize, passes\n* through unchanged; `nextval(...)` normalizes to `autoincrement()` on both\n* sides, matching a `serial`/identity column's introspected counterpart.\n*/\nfunction postgresResolveDefault(def, resolvedNativeType) {\n\tif (def.kind !== \"function\") return def;\n\treturn parsePostgresDefault(def.expression, resolvedNativeType) ?? def;\n}\n//#endregion\nexport { postgresResolveDefault as n, parsePostgresDefault as t };\n\n//# sourceMappingURL=default-normalizer-CrMBHF0W.mjs.map"],"mappings":";;;;;;;AAOA,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;AAC7B,MAAM,0BAA0B;AAChC,MAAM,wBAAwB;AAC9B,MAAM,mBAAmB;AACzB,MAAM,sBAAsB;AAC5B,MAAM,eAAe;AACrB,MAAM,oBAAoB;AAC1B,MAAM,eAAe;AACrB,MAAM,eAAe;AACrB,MAAM,gBAAgB;;;;;;AAMtB,MAAM,UAAU,OAAO,GAAG;AAC1B,MAAM,kBAAkB,IAAI,OAAO,IAAI,QAAQ,EAAE;;;;;AAKjD,MAAM,gBAAgB,OAAO,GAAG;;;;;;AAMhC,MAAM,YAAY,OAAO,GAAG,wDAAwD,cAAc,gBAAgB,cAAc;AAChI,MAAM,yBAAyB,IAAI,OAAO,0BAA0B,UAAU,KAAK;AACnF,MAAM,yBAAyB,IAAI,OAAO,KAAK,QAAQ,SAAS,UAAU,KAAK;AAC/E,MAAM,6BAA6B,IAAI,OAAO,OAAO,GAAG,eAAe,UAAU,KAAK,G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