@prisma-next/target-postgres 0.5.0-dev.60 → 0.5.0-dev.62
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/codec-ids-B-wNPs-9.d.mts +29 -0
- package/dist/codec-ids-B-wNPs-9.d.mts.map +1 -0
- package/dist/codec-ids.d.mts +2 -29
- package/dist/codec-types-Br-rrBBQ.d.mts +80 -0
- package/dist/codec-types-Br-rrBBQ.d.mts.map +1 -0
- package/dist/codec-types.d.mts +4 -42
- package/dist/codec-types.mjs +1 -4
- package/dist/codecs-DZUnQrrl.d.mts +559 -0
- package/dist/codecs-DZUnQrrl.d.mts.map +1 -0
- package/dist/codecs.d.mts +15 -2
- package/dist/codecs.d.mts.map +1 -0
- package/dist/codecs.mjs +742 -3
- package/dist/codecs.mjs.map +1 -0
- package/dist/control.d.mts +1 -1
- package/dist/control.mjs +8 -8
- package/dist/{data-transform-Be_i_DBc.mjs → data-transform-CR_9PvW9.mjs} +1 -1
- package/dist/{data-transform-Be_i_DBc.mjs.map → data-transform-CR_9PvW9.mjs.map} +1 -1
- package/dist/{data-transform-CrpmG4uJ.d.mts → data-transform-T71mQkVW.d.mts} +2 -2
- package/dist/{data-transform-CrpmG4uJ.d.mts.map → data-transform-T71mQkVW.d.mts.map} +1 -1
- package/dist/data-transform.d.mts +1 -1
- package/dist/data-transform.mjs +1 -1
- package/dist/{default-normalizer-DNOpRoOF.mjs → default-normalizer-D4RoM0i6.mjs} +1 -1
- package/dist/{default-normalizer-DNOpRoOF.mjs.map → default-normalizer-D4RoM0i6.mjs.map} +1 -1
- package/dist/default-normalizer.mjs +1 -1
- package/dist/{descriptor-meta-Ieg1XLOs.mjs → descriptor-meta-B9JFfKCb.mjs} +1 -1
- package/dist/{descriptor-meta-Ieg1XLOs.mjs.map → descriptor-meta-B9JFfKCb.mjs.map} +1 -1
- package/dist/{errors-AFvEPZ1R.mjs → errors-BT_Duyj-.mjs} +1 -1
- package/dist/{errors-AFvEPZ1R.mjs.map → errors-BT_Duyj-.mjs.map} +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/{issue-planner-CFjB0_oO.mjs → issue-planner-DooWabc2.mjs} +8 -8
- package/dist/{issue-planner-CFjB0_oO.mjs.map → issue-planner-DooWabc2.mjs.map} +1 -1
- package/dist/issue-planner.d.mts +2 -2
- package/dist/issue-planner.mjs +1 -1
- package/dist/migration.d.mts +3 -3
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +3 -3
- package/dist/{native-type-normalizer-CInai_oY.mjs → native-type-normalizer-i4IFPL5F.mjs} +1 -1
- package/dist/{native-type-normalizer-CInai_oY.mjs.map → native-type-normalizer-i4IFPL5F.mjs.map} +1 -1
- package/dist/native-type-normalizer.mjs +1 -1
- package/dist/{op-factory-call-BKlruaiC.mjs → op-factory-call-Bvw39XKU.mjs} +2 -2
- package/dist/{op-factory-call-BKlruaiC.mjs.map → op-factory-call-Bvw39XKU.mjs.map} +1 -1
- package/dist/{op-factory-call-C3bWXKSP.d.mts → op-factory-call-SFMIf-Cz.d.mts} +3 -3
- package/dist/op-factory-call-SFMIf-Cz.d.mts.map +1 -0
- package/dist/op-factory-call.d.mts +2 -2
- package/dist/op-factory-call.mjs +1 -1
- package/dist/pack.d.mts +3 -1
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/{planner-Cm-ZLutk.mjs → planner-BMtFbKfn.mjs} +5 -5
- package/dist/{planner-Cm-ZLutk.mjs.map → planner-BMtFbKfn.mjs.map} +1 -1
- package/dist/{planner-ddl-builders-Dxvw1LHw.mjs → planner-ddl-builders-B6VK92UF.mjs} +3 -3
- package/dist/{planner-ddl-builders-Dxvw1LHw.mjs.map → planner-ddl-builders-B6VK92UF.mjs.map} +1 -1
- package/dist/planner-ddl-builders.d.mts +1 -1
- package/dist/planner-ddl-builders.mjs +1 -1
- package/dist/{planner-identity-values-Dju-o5GF.mjs → planner-identity-values-CC5fa5D9.mjs} +1 -1
- package/dist/{planner-identity-values-Dju-o5GF.mjs.map → planner-identity-values-CC5fa5D9.mjs.map} +1 -1
- package/dist/planner-identity-values.mjs +1 -1
- package/dist/{planner-produced-postgres-migration-Bi-RWO4-.mjs → planner-produced-postgres-migration-C0vaAvA8.mjs} +4 -4
- package/dist/{planner-produced-postgres-migration-Bi-RWO4-.mjs.map → planner-produced-postgres-migration-C0vaAvA8.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-M3EfhWSS.d.mts → planner-produced-postgres-migration-CyzRgqsq.d.mts} +4 -4
- package/dist/planner-produced-postgres-migration-CyzRgqsq.d.mts.map +1 -0
- package/dist/planner-produced-postgres-migration.d.mts +5 -5
- package/dist/planner-produced-postgres-migration.mjs +1 -1
- package/dist/{planner-schema-lookup-B7lkypwn.mjs → planner-schema-lookup-B3talum5.mjs} +1 -1
- package/dist/{planner-schema-lookup-B7lkypwn.mjs.map → planner-schema-lookup-B3talum5.mjs.map} +1 -1
- package/dist/planner-schema-lookup.mjs +1 -1
- package/dist/{planner-sql-checks-7jkgm9TX.mjs → planner-sql-checks-uDnwA68k.mjs} +2 -2
- package/dist/{planner-sql-checks-7jkgm9TX.mjs.map → planner-sql-checks-uDnwA68k.mjs.map} +1 -1
- package/dist/planner-sql-checks.mjs +1 -1
- package/dist/{planner-target-details-DH-azLu-.d.mts → planner-target-details-COAiKZjW.d.mts} +1 -1
- package/dist/{planner-target-details-DH-azLu-.d.mts.map → planner-target-details-COAiKZjW.d.mts.map} +1 -1
- package/dist/planner-target-details.d.mts +1 -1
- package/dist/planner.d.mts +5 -5
- package/dist/planner.mjs +2 -2
- package/dist/{postgres-migration-BS9vQW97.mjs → postgres-migration-BAgHXrjO.mjs} +3 -3
- package/dist/{postgres-migration-BS9vQW97.mjs.map → postgres-migration-BAgHXrjO.mjs.map} +1 -1
- package/dist/{postgres-migration-BFjbb25b.d.mts → postgres-migration-Dzxr5BCy.d.mts} +3 -3
- package/dist/{postgres-migration-BFjbb25b.d.mts.map → postgres-migration-Dzxr5BCy.d.mts.map} +1 -1
- package/dist/{render-ops-D6_DHdOK.mjs → render-ops-DddkYOIB.mjs} +1 -1
- package/dist/{render-ops-D6_DHdOK.mjs.map → render-ops-DddkYOIB.mjs.map} +1 -1
- package/dist/render-ops.d.mts +3 -3
- package/dist/render-ops.mjs +1 -1
- package/dist/{render-typescript-Co3Emwgz.mjs → render-typescript-0EtwW-Ip.mjs} +1 -1
- package/dist/{render-typescript-Co3Emwgz.mjs.map → render-typescript-0EtwW-Ip.mjs.map} +1 -1
- package/dist/render-typescript.d.mts +2 -2
- package/dist/render-typescript.mjs +1 -1
- package/dist/runtime.d.mts +5 -9
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +5 -10
- package/dist/runtime.mjs.map +1 -1
- package/dist/{shared-Bxkt8pNO.d.mts → shared-DSVRy4AX.d.mts} +2 -2
- package/dist/{shared-Bxkt8pNO.d.mts.map → shared-DSVRy4AX.d.mts.map} +1 -1
- package/dist/{sql-utils-r-Lw535w.mjs → sql-utils-C9dyHV0x.mjs} +1 -1
- package/dist/{sql-utils-r-Lw535w.mjs.map → sql-utils-C9dyHV0x.mjs.map} +1 -1
- package/dist/sql-utils.mjs +1 -1
- package/dist/{statement-builders-CHqCtSfe.mjs → statement-builders-Ckkq4ryf.mjs} +1 -1
- package/dist/{statement-builders-CHqCtSfe.mjs.map → statement-builders-Ckkq4ryf.mjs.map} +1 -1
- package/dist/statement-builders.mjs +1 -1
- package/dist/{tables-BmdW_FWO.mjs → tables-CnvPb0Iz.mjs} +3 -3
- package/dist/{tables-BmdW_FWO.mjs.map → tables-CnvPb0Iz.mjs.map} +1 -1
- package/dist/{types-ClK03Ojd.d.mts → types-DWZq_XTl.d.mts} +1 -1
- package/dist/types-DWZq_XTl.d.mts.map +1 -0
- package/dist/types.d.mts +1 -1
- package/package.json +15 -14
- package/src/core/codec-helpers.ts +135 -0
- package/src/core/codec-type-map.ts +81 -0
- package/src/core/codecs.ts +941 -560
- package/src/core/descriptor-meta.ts +1 -1
- package/src/core/registry.ts +11 -0
- package/src/exports/codec-types.ts +4 -13
- package/src/exports/codecs.ts +49 -2
- package/src/exports/runtime.ts +6 -11
- package/dist/codec-ids.d.mts.map +0 -1
- package/dist/codec-types.d.mts.map +0 -1
- package/dist/codecs-B03dFv94.d.mts +0 -333
- package/dist/codecs-B03dFv94.d.mts.map +0 -1
- package/dist/codecs-D0oXyJIH.mjs +0 -305
- package/dist/codecs-D0oXyJIH.mjs.map +0 -1
- package/dist/op-factory-call-C3bWXKSP.d.mts.map +0 -1
- package/dist/planner-produced-postgres-migration-M3EfhWSS.d.mts.map +0 -1
- package/dist/types-ClK03Ojd.d.mts.map +0 -1
package/dist/codecs.mjs
CHANGED
|
@@ -1,4 +1,743 @@
|
|
|
1
|
-
import "./codec-ids-ckQX9Kcg.mjs";
|
|
2
|
-
import {
|
|
1
|
+
import { C as PG_VARCHAR_CODEC_ID, S as PG_VARBIT_CODEC_ID, _ as PG_TEXT_CODEC_ID, a as PG_ENUM_CODEC_ID, b as PG_TIMETZ_CODEC_ID, c as PG_FLOAT_CODEC_ID, d as PG_INT8_CODEC_ID, f as PG_INTERVAL_CODEC_ID, g as PG_NUMERIC_CODEC_ID, h as PG_JSON_CODEC_ID, i as PG_CHAR_CODEC_ID, l as PG_INT2_CODEC_ID, m as PG_JSONB_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_FLOAT4_CODEC_ID, p as PG_INT_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_FLOAT8_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INT4_CODEC_ID, v as PG_TIMESTAMPTZ_CODEC_ID, x as PG_TIME_CODEC_ID, y as PG_TIMESTAMP_CODEC_ID } from "./codec-ids-ckQX9Kcg.mjs";
|
|
2
|
+
import { SqlCharCodec, SqlFloatCodec, SqlIntCodec, SqlVarcharCodec, sqlCharDescriptor, sqlFloatDescriptor, sqlIntDescriptor, sqlTextDescriptor, sqlTimestampDescriptor, sqlVarcharDescriptor } from "@prisma-next/sql-relational-core/ast";
|
|
3
|
+
import { CodecDescriptorImpl, CodecImpl, column, voidParamsSchema } from "@prisma-next/framework-components/codec";
|
|
4
|
+
import { type } from "arktype";
|
|
5
|
+
import { buildCodecDescriptorRegistry } from "@prisma-next/sql-relational-core/codec-descriptor-registry";
|
|
3
6
|
|
|
4
|
-
|
|
7
|
+
//#region src/core/codec-helpers.ts
|
|
8
|
+
function renderLength(typeName, typeParams) {
|
|
9
|
+
const length = typeParams["length"];
|
|
10
|
+
if (length === void 0) return;
|
|
11
|
+
if (typeof length !== "number" || !Number.isFinite(length) || !Number.isInteger(length)) throw new Error(`renderOutputType: expected integer "length" in typeParams for ${typeName}, got ${String(length)}`);
|
|
12
|
+
return `${typeName}<${length}>`;
|
|
13
|
+
}
|
|
14
|
+
function renderPrecision(typeName, typeParams) {
|
|
15
|
+
const precision = typeParams["precision"];
|
|
16
|
+
if (precision === void 0) return typeName;
|
|
17
|
+
if (typeof precision !== "number" || !Number.isFinite(precision) || !Number.isInteger(precision)) throw new Error(`renderOutputType: expected integer "precision" in typeParams for ${typeName}, got ${String(precision)}`);
|
|
18
|
+
return `${typeName}<${precision}>`;
|
|
19
|
+
}
|
|
20
|
+
const pgNumericDecode = (wire) => {
|
|
21
|
+
if (typeof wire === "number") return String(wire);
|
|
22
|
+
return wire;
|
|
23
|
+
};
|
|
24
|
+
const pgNumericRenderOutputType = (typeParams) => {
|
|
25
|
+
const precision = typeParams.precision;
|
|
26
|
+
if (precision === void 0) return void 0;
|
|
27
|
+
if (typeof precision !== "number" || !Number.isFinite(precision) || !Number.isInteger(precision)) throw new Error(`renderOutputType: expected integer "precision" in typeParams for Numeric, got ${String(precision)}`);
|
|
28
|
+
const scale = typeParams.scale;
|
|
29
|
+
if (scale === void 0) return `Numeric<${precision}>`;
|
|
30
|
+
if (typeof scale !== "number" || !Number.isFinite(scale) || !Number.isInteger(scale)) throw new Error(`renderOutputType: expected integer "scale" in typeParams for Numeric, got ${String(scale)}`);
|
|
31
|
+
return `Numeric<${precision}, ${scale}>`;
|
|
32
|
+
};
|
|
33
|
+
const ISO_8601_UTC = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?Z$/;
|
|
34
|
+
const pgTimestampEncodeJson = (value) => value.toISOString();
|
|
35
|
+
const pgTimestampDecodeJson = (json) => {
|
|
36
|
+
if (typeof json !== "string") throw new Error(`Expected ISO date string for pg/timestamp@1, got ${typeof json}`);
|
|
37
|
+
if (!ISO_8601_UTC.test(json)) throw new Error(`Invalid ISO date string for pg/timestamp@1: ${json}`);
|
|
38
|
+
const date = new Date(json);
|
|
39
|
+
if (Number.isNaN(date.getTime())) throw new Error(`Invalid ISO date string for pg/timestamp@1: ${json}`);
|
|
40
|
+
return date;
|
|
41
|
+
};
|
|
42
|
+
const pgTimestamptzEncodeJson = (value) => value.toISOString();
|
|
43
|
+
const pgTimestamptzDecodeJson = (json) => {
|
|
44
|
+
if (typeof json !== "string") throw new Error(`Expected ISO date string for pg/timestamptz@1, got ${typeof json}`);
|
|
45
|
+
if (!ISO_8601_UTC.test(json)) throw new Error(`Invalid ISO date string for pg/timestamptz@1: ${json}`);
|
|
46
|
+
const date = new Date(json);
|
|
47
|
+
if (Number.isNaN(date.getTime())) throw new Error(`Invalid ISO date string for pg/timestamptz@1: ${json}`);
|
|
48
|
+
return date;
|
|
49
|
+
};
|
|
50
|
+
const pgIntervalDecode = (wire) => {
|
|
51
|
+
if (typeof wire === "string") return wire;
|
|
52
|
+
return JSON.stringify(wire);
|
|
53
|
+
};
|
|
54
|
+
const pgEnumRenderOutputType = (typeParams) => {
|
|
55
|
+
const values = typeParams.values;
|
|
56
|
+
if (!Array.isArray(values)) throw new Error(`renderOutputType: expected array "values" in typeParams for enum, got ${typeof values}`);
|
|
57
|
+
if (!values.every((v) => typeof v === "string")) throw new Error(`renderOutputType: expected string[] "values" in typeParams for enum`);
|
|
58
|
+
return values.map((value) => `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`).join(" | ");
|
|
59
|
+
};
|
|
60
|
+
const pgJsonEncode = (value) => JSON.stringify(value);
|
|
61
|
+
const pgJsonDecode = (wire) => typeof wire === "string" ? JSON.parse(wire) : wire;
|
|
62
|
+
const pgJsonbEncode = (value) => JSON.stringify(value);
|
|
63
|
+
const pgJsonbDecode = (wire) => typeof wire === "string" ? JSON.parse(wire) : wire;
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/core/codecs.ts
|
|
67
|
+
const lengthParamsSchema = type({ "length?": "number.integer > 0" });
|
|
68
|
+
const numericParamsSchema = type({
|
|
69
|
+
precision: "number.integer > 0 & number.integer <= 1000",
|
|
70
|
+
"scale?": "number.integer >= 0"
|
|
71
|
+
});
|
|
72
|
+
const precisionParamsSchema = type({ "precision?": "number.integer >= 0 & number.integer <= 6" });
|
|
73
|
+
const PG_TEXT_META = { db: { sql: { postgres: { nativeType: "text" } } } };
|
|
74
|
+
const PG_INT4_META = { db: { sql: { postgres: { nativeType: "integer" } } } };
|
|
75
|
+
const PG_INT2_META = { db: { sql: { postgres: { nativeType: "smallint" } } } };
|
|
76
|
+
const PG_INT8_META = { db: { sql: { postgres: { nativeType: "bigint" } } } };
|
|
77
|
+
const PG_FLOAT4_META = { db: { sql: { postgres: { nativeType: "real" } } } };
|
|
78
|
+
const PG_FLOAT8_META = { db: { sql: { postgres: { nativeType: "double precision" } } } };
|
|
79
|
+
const PG_NUMERIC_META = { db: { sql: { postgres: { nativeType: "numeric" } } } };
|
|
80
|
+
const PG_TIMESTAMP_META = { db: { sql: { postgres: { nativeType: "timestamp without time zone" } } } };
|
|
81
|
+
const PG_TIMESTAMPTZ_META = { db: { sql: { postgres: { nativeType: "timestamp with time zone" } } } };
|
|
82
|
+
const PG_TIME_META = { db: { sql: { postgres: { nativeType: "time" } } } };
|
|
83
|
+
const PG_TIMETZ_META = { db: { sql: { postgres: { nativeType: "timetz" } } } };
|
|
84
|
+
const PG_BOOL_META = { db: { sql: { postgres: { nativeType: "boolean" } } } };
|
|
85
|
+
const PG_BIT_META = { db: { sql: { postgres: { nativeType: "bit" } } } };
|
|
86
|
+
const PG_VARBIT_META = { db: { sql: { postgres: { nativeType: "bit varying" } } } };
|
|
87
|
+
const PG_BYTEA_META = { db: { sql: { postgres: { nativeType: "bytea" } } } };
|
|
88
|
+
const PG_INTERVAL_META = { db: { sql: { postgres: { nativeType: "interval" } } } };
|
|
89
|
+
const PG_JSON_META = { db: { sql: { postgres: { nativeType: "json" } } } };
|
|
90
|
+
const PG_JSONB_META = { db: { sql: { postgres: { nativeType: "jsonb" } } } };
|
|
91
|
+
var PgTextCodec = class extends CodecImpl {
|
|
92
|
+
async encode(value, _ctx) {
|
|
93
|
+
return value;
|
|
94
|
+
}
|
|
95
|
+
async decode(wire, _ctx) {
|
|
96
|
+
return wire;
|
|
97
|
+
}
|
|
98
|
+
encodeJson(value) {
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
decodeJson(json) {
|
|
102
|
+
return json;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
var PgTextDescriptor = class extends CodecDescriptorImpl {
|
|
106
|
+
codecId = PG_TEXT_CODEC_ID;
|
|
107
|
+
traits = [
|
|
108
|
+
"equality",
|
|
109
|
+
"order",
|
|
110
|
+
"textual"
|
|
111
|
+
];
|
|
112
|
+
targetTypes = ["text"];
|
|
113
|
+
meta = PG_TEXT_META;
|
|
114
|
+
paramsSchema = voidParamsSchema;
|
|
115
|
+
factory() {
|
|
116
|
+
return () => new PgTextCodec(this);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const pgTextDescriptor = new PgTextDescriptor();
|
|
120
|
+
const pgTextColumn = () => column(pgTextDescriptor.factory(), pgTextDescriptor.codecId, void 0, "text");
|
|
121
|
+
var PgInt4Codec = class extends CodecImpl {
|
|
122
|
+
async encode(value, _ctx) {
|
|
123
|
+
return value;
|
|
124
|
+
}
|
|
125
|
+
async decode(wire, _ctx) {
|
|
126
|
+
return wire;
|
|
127
|
+
}
|
|
128
|
+
encodeJson(value) {
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
decodeJson(json) {
|
|
132
|
+
return json;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
var PgInt4Descriptor = class extends CodecDescriptorImpl {
|
|
136
|
+
codecId = PG_INT4_CODEC_ID;
|
|
137
|
+
traits = [
|
|
138
|
+
"equality",
|
|
139
|
+
"order",
|
|
140
|
+
"numeric"
|
|
141
|
+
];
|
|
142
|
+
targetTypes = ["int4"];
|
|
143
|
+
meta = PG_INT4_META;
|
|
144
|
+
paramsSchema = voidParamsSchema;
|
|
145
|
+
factory() {
|
|
146
|
+
return () => new PgInt4Codec(this);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const pgInt4Descriptor = new PgInt4Descriptor();
|
|
150
|
+
const pgInt4Column = () => column(pgInt4Descriptor.factory(), pgInt4Descriptor.codecId, void 0, "int4");
|
|
151
|
+
var PgInt2Codec = class extends CodecImpl {
|
|
152
|
+
async encode(value, _ctx) {
|
|
153
|
+
return value;
|
|
154
|
+
}
|
|
155
|
+
async decode(wire, _ctx) {
|
|
156
|
+
return wire;
|
|
157
|
+
}
|
|
158
|
+
encodeJson(value) {
|
|
159
|
+
return value;
|
|
160
|
+
}
|
|
161
|
+
decodeJson(json) {
|
|
162
|
+
return json;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
var PgInt2Descriptor = class extends CodecDescriptorImpl {
|
|
166
|
+
codecId = PG_INT2_CODEC_ID;
|
|
167
|
+
traits = [
|
|
168
|
+
"equality",
|
|
169
|
+
"order",
|
|
170
|
+
"numeric"
|
|
171
|
+
];
|
|
172
|
+
targetTypes = ["int2"];
|
|
173
|
+
meta = PG_INT2_META;
|
|
174
|
+
paramsSchema = voidParamsSchema;
|
|
175
|
+
factory() {
|
|
176
|
+
return () => new PgInt2Codec(this);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
const pgInt2Descriptor = new PgInt2Descriptor();
|
|
180
|
+
const pgInt2Column = () => column(pgInt2Descriptor.factory(), pgInt2Descriptor.codecId, void 0, "int2");
|
|
181
|
+
var PgInt8Codec = class extends CodecImpl {
|
|
182
|
+
async encode(value, _ctx) {
|
|
183
|
+
return value;
|
|
184
|
+
}
|
|
185
|
+
async decode(wire, _ctx) {
|
|
186
|
+
return wire;
|
|
187
|
+
}
|
|
188
|
+
encodeJson(value) {
|
|
189
|
+
return value;
|
|
190
|
+
}
|
|
191
|
+
decodeJson(json) {
|
|
192
|
+
return json;
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
var PgInt8Descriptor = class extends CodecDescriptorImpl {
|
|
196
|
+
codecId = PG_INT8_CODEC_ID;
|
|
197
|
+
traits = [
|
|
198
|
+
"equality",
|
|
199
|
+
"order",
|
|
200
|
+
"numeric"
|
|
201
|
+
];
|
|
202
|
+
targetTypes = ["int8"];
|
|
203
|
+
meta = PG_INT8_META;
|
|
204
|
+
paramsSchema = voidParamsSchema;
|
|
205
|
+
factory() {
|
|
206
|
+
return () => new PgInt8Codec(this);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
const pgInt8Descriptor = new PgInt8Descriptor();
|
|
210
|
+
const pgInt8Column = () => column(pgInt8Descriptor.factory(), pgInt8Descriptor.codecId, void 0, "int8");
|
|
211
|
+
var PgFloat4Codec = class extends CodecImpl {
|
|
212
|
+
async encode(value, _ctx) {
|
|
213
|
+
return value;
|
|
214
|
+
}
|
|
215
|
+
async decode(wire, _ctx) {
|
|
216
|
+
return wire;
|
|
217
|
+
}
|
|
218
|
+
encodeJson(value) {
|
|
219
|
+
return value;
|
|
220
|
+
}
|
|
221
|
+
decodeJson(json) {
|
|
222
|
+
return json;
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
var PgFloat4Descriptor = class extends CodecDescriptorImpl {
|
|
226
|
+
codecId = PG_FLOAT4_CODEC_ID;
|
|
227
|
+
traits = [
|
|
228
|
+
"equality",
|
|
229
|
+
"order",
|
|
230
|
+
"numeric"
|
|
231
|
+
];
|
|
232
|
+
targetTypes = ["float4"];
|
|
233
|
+
meta = PG_FLOAT4_META;
|
|
234
|
+
paramsSchema = voidParamsSchema;
|
|
235
|
+
factory() {
|
|
236
|
+
return () => new PgFloat4Codec(this);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
const pgFloat4Descriptor = new PgFloat4Descriptor();
|
|
240
|
+
const pgFloat4Column = () => column(pgFloat4Descriptor.factory(), pgFloat4Descriptor.codecId, void 0, "float4");
|
|
241
|
+
var PgFloat8Codec = class extends CodecImpl {
|
|
242
|
+
async encode(value, _ctx) {
|
|
243
|
+
return value;
|
|
244
|
+
}
|
|
245
|
+
async decode(wire, _ctx) {
|
|
246
|
+
return wire;
|
|
247
|
+
}
|
|
248
|
+
encodeJson(value) {
|
|
249
|
+
return value;
|
|
250
|
+
}
|
|
251
|
+
decodeJson(json) {
|
|
252
|
+
return json;
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
var PgFloat8Descriptor = class extends CodecDescriptorImpl {
|
|
256
|
+
codecId = PG_FLOAT8_CODEC_ID;
|
|
257
|
+
traits = [
|
|
258
|
+
"equality",
|
|
259
|
+
"order",
|
|
260
|
+
"numeric"
|
|
261
|
+
];
|
|
262
|
+
targetTypes = ["float8"];
|
|
263
|
+
meta = PG_FLOAT8_META;
|
|
264
|
+
paramsSchema = voidParamsSchema;
|
|
265
|
+
factory() {
|
|
266
|
+
return () => new PgFloat8Codec(this);
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
const pgFloat8Descriptor = new PgFloat8Descriptor();
|
|
270
|
+
const pgFloat8Column = () => column(pgFloat8Descriptor.factory(), pgFloat8Descriptor.codecId, void 0, "float8");
|
|
271
|
+
var PgBoolCodec = class extends CodecImpl {
|
|
272
|
+
async encode(value, _ctx) {
|
|
273
|
+
return value;
|
|
274
|
+
}
|
|
275
|
+
async decode(wire, _ctx) {
|
|
276
|
+
return wire;
|
|
277
|
+
}
|
|
278
|
+
encodeJson(value) {
|
|
279
|
+
return value;
|
|
280
|
+
}
|
|
281
|
+
decodeJson(json) {
|
|
282
|
+
return json;
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
var PgBoolDescriptor = class extends CodecDescriptorImpl {
|
|
286
|
+
codecId = PG_BOOL_CODEC_ID;
|
|
287
|
+
traits = ["equality", "boolean"];
|
|
288
|
+
targetTypes = ["bool"];
|
|
289
|
+
meta = PG_BOOL_META;
|
|
290
|
+
paramsSchema = voidParamsSchema;
|
|
291
|
+
factory() {
|
|
292
|
+
return () => new PgBoolCodec(this);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
const pgBoolDescriptor = new PgBoolDescriptor();
|
|
296
|
+
const pgBoolColumn = () => column(pgBoolDescriptor.factory(), pgBoolDescriptor.codecId, void 0, "bool");
|
|
297
|
+
var PgNumericCodec = class extends CodecImpl {
|
|
298
|
+
async encode(value, _ctx) {
|
|
299
|
+
return value;
|
|
300
|
+
}
|
|
301
|
+
async decode(wire, _ctx) {
|
|
302
|
+
return pgNumericDecode(wire);
|
|
303
|
+
}
|
|
304
|
+
encodeJson(value) {
|
|
305
|
+
return value;
|
|
306
|
+
}
|
|
307
|
+
decodeJson(json) {
|
|
308
|
+
return json;
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
var PgNumericDescriptor = class extends CodecDescriptorImpl {
|
|
312
|
+
codecId = PG_NUMERIC_CODEC_ID;
|
|
313
|
+
traits = [
|
|
314
|
+
"equality",
|
|
315
|
+
"order",
|
|
316
|
+
"numeric"
|
|
317
|
+
];
|
|
318
|
+
targetTypes = ["numeric", "decimal"];
|
|
319
|
+
meta = PG_NUMERIC_META;
|
|
320
|
+
paramsSchema = numericParamsSchema;
|
|
321
|
+
renderOutputType(params) {
|
|
322
|
+
return pgNumericRenderOutputType(params);
|
|
323
|
+
}
|
|
324
|
+
factory(_params) {
|
|
325
|
+
return () => new PgNumericCodec(this);
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
const pgNumericDescriptor = new PgNumericDescriptor();
|
|
329
|
+
const pgNumericColumn = (params) => column(pgNumericDescriptor.factory(params), pgNumericDescriptor.codecId, params, "numeric");
|
|
330
|
+
var PgTimestampCodec = class extends CodecImpl {
|
|
331
|
+
async encode(value, _ctx) {
|
|
332
|
+
return value;
|
|
333
|
+
}
|
|
334
|
+
async decode(wire, _ctx) {
|
|
335
|
+
return wire;
|
|
336
|
+
}
|
|
337
|
+
encodeJson(value) {
|
|
338
|
+
return pgTimestampEncodeJson(value);
|
|
339
|
+
}
|
|
340
|
+
decodeJson(json) {
|
|
341
|
+
return pgTimestampDecodeJson(json);
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
var PgTimestampDescriptor = class extends CodecDescriptorImpl {
|
|
345
|
+
codecId = PG_TIMESTAMP_CODEC_ID;
|
|
346
|
+
traits = ["equality", "order"];
|
|
347
|
+
targetTypes = ["timestamp"];
|
|
348
|
+
meta = PG_TIMESTAMP_META;
|
|
349
|
+
paramsSchema = precisionParamsSchema;
|
|
350
|
+
renderOutputType(params) {
|
|
351
|
+
return renderPrecision("Timestamp", params);
|
|
352
|
+
}
|
|
353
|
+
factory(_params) {
|
|
354
|
+
return () => new PgTimestampCodec(this);
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
const pgTimestampDescriptor = new PgTimestampDescriptor();
|
|
358
|
+
const pgTimestampColumn = (params = {}) => column(pgTimestampDescriptor.factory(params), pgTimestampDescriptor.codecId, params, "timestamp");
|
|
359
|
+
var PgTimestamptzCodec = class extends CodecImpl {
|
|
360
|
+
async encode(value, _ctx) {
|
|
361
|
+
return value;
|
|
362
|
+
}
|
|
363
|
+
async decode(wire, _ctx) {
|
|
364
|
+
return wire;
|
|
365
|
+
}
|
|
366
|
+
encodeJson(value) {
|
|
367
|
+
return pgTimestamptzEncodeJson(value);
|
|
368
|
+
}
|
|
369
|
+
decodeJson(json) {
|
|
370
|
+
return pgTimestamptzDecodeJson(json);
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
var PgTimestamptzDescriptor = class extends CodecDescriptorImpl {
|
|
374
|
+
codecId = PG_TIMESTAMPTZ_CODEC_ID;
|
|
375
|
+
traits = ["equality", "order"];
|
|
376
|
+
targetTypes = ["timestamptz"];
|
|
377
|
+
meta = PG_TIMESTAMPTZ_META;
|
|
378
|
+
paramsSchema = precisionParamsSchema;
|
|
379
|
+
renderOutputType(params) {
|
|
380
|
+
return renderPrecision("Timestamptz", params);
|
|
381
|
+
}
|
|
382
|
+
factory(_params) {
|
|
383
|
+
return () => new PgTimestamptzCodec(this);
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
const pgTimestamptzDescriptor = new PgTimestamptzDescriptor();
|
|
387
|
+
const pgTimestamptzColumn = (params = {}) => column(pgTimestamptzDescriptor.factory(params), pgTimestamptzDescriptor.codecId, params, "timestamptz");
|
|
388
|
+
var PgTimeCodec = class extends CodecImpl {
|
|
389
|
+
async encode(value, _ctx) {
|
|
390
|
+
return value;
|
|
391
|
+
}
|
|
392
|
+
async decode(wire, _ctx) {
|
|
393
|
+
return wire;
|
|
394
|
+
}
|
|
395
|
+
encodeJson(value) {
|
|
396
|
+
return value;
|
|
397
|
+
}
|
|
398
|
+
decodeJson(json) {
|
|
399
|
+
return json;
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
var PgTimeDescriptor = class extends CodecDescriptorImpl {
|
|
403
|
+
codecId = PG_TIME_CODEC_ID;
|
|
404
|
+
traits = ["equality", "order"];
|
|
405
|
+
targetTypes = ["time"];
|
|
406
|
+
meta = PG_TIME_META;
|
|
407
|
+
paramsSchema = precisionParamsSchema;
|
|
408
|
+
renderOutputType(params) {
|
|
409
|
+
return renderPrecision("Time", params);
|
|
410
|
+
}
|
|
411
|
+
factory(_params) {
|
|
412
|
+
return () => new PgTimeCodec(this);
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
const pgTimeDescriptor = new PgTimeDescriptor();
|
|
416
|
+
const pgTimeColumn = (params = {}) => column(pgTimeDescriptor.factory(params), pgTimeDescriptor.codecId, params, "time");
|
|
417
|
+
var PgTimetzCodec = class extends CodecImpl {
|
|
418
|
+
async encode(value, _ctx) {
|
|
419
|
+
return value;
|
|
420
|
+
}
|
|
421
|
+
async decode(wire, _ctx) {
|
|
422
|
+
return wire;
|
|
423
|
+
}
|
|
424
|
+
encodeJson(value) {
|
|
425
|
+
return value;
|
|
426
|
+
}
|
|
427
|
+
decodeJson(json) {
|
|
428
|
+
return json;
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
var PgTimetzDescriptor = class extends CodecDescriptorImpl {
|
|
432
|
+
codecId = PG_TIMETZ_CODEC_ID;
|
|
433
|
+
traits = ["equality", "order"];
|
|
434
|
+
targetTypes = ["timetz"];
|
|
435
|
+
meta = PG_TIMETZ_META;
|
|
436
|
+
paramsSchema = precisionParamsSchema;
|
|
437
|
+
renderOutputType(params) {
|
|
438
|
+
return renderPrecision("Timetz", params);
|
|
439
|
+
}
|
|
440
|
+
factory(_params) {
|
|
441
|
+
return () => new PgTimetzCodec(this);
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
const pgTimetzDescriptor = new PgTimetzDescriptor();
|
|
445
|
+
const pgTimetzColumn = (params = {}) => column(pgTimetzDescriptor.factory(params), pgTimetzDescriptor.codecId, params, "timetz");
|
|
446
|
+
var PgBitCodec = class extends CodecImpl {
|
|
447
|
+
async encode(value, _ctx) {
|
|
448
|
+
return value;
|
|
449
|
+
}
|
|
450
|
+
async decode(wire, _ctx) {
|
|
451
|
+
return wire;
|
|
452
|
+
}
|
|
453
|
+
encodeJson(value) {
|
|
454
|
+
return value;
|
|
455
|
+
}
|
|
456
|
+
decodeJson(json) {
|
|
457
|
+
return json;
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
var PgBitDescriptor = class extends CodecDescriptorImpl {
|
|
461
|
+
codecId = PG_BIT_CODEC_ID;
|
|
462
|
+
traits = ["equality", "order"];
|
|
463
|
+
targetTypes = ["bit"];
|
|
464
|
+
meta = PG_BIT_META;
|
|
465
|
+
paramsSchema = lengthParamsSchema;
|
|
466
|
+
renderOutputType(params) {
|
|
467
|
+
return renderLength("Bit", params);
|
|
468
|
+
}
|
|
469
|
+
factory(_params) {
|
|
470
|
+
return () => new PgBitCodec(this);
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
const pgBitDescriptor = new PgBitDescriptor();
|
|
474
|
+
const pgBitColumn = (params = {}) => column(pgBitDescriptor.factory(params), pgBitDescriptor.codecId, params, "bit");
|
|
475
|
+
var PgVarbitCodec = class extends CodecImpl {
|
|
476
|
+
async encode(value, _ctx) {
|
|
477
|
+
return value;
|
|
478
|
+
}
|
|
479
|
+
async decode(wire, _ctx) {
|
|
480
|
+
return wire;
|
|
481
|
+
}
|
|
482
|
+
encodeJson(value) {
|
|
483
|
+
return value;
|
|
484
|
+
}
|
|
485
|
+
decodeJson(json) {
|
|
486
|
+
return json;
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
var PgVarbitDescriptor = class extends CodecDescriptorImpl {
|
|
490
|
+
codecId = PG_VARBIT_CODEC_ID;
|
|
491
|
+
traits = ["equality", "order"];
|
|
492
|
+
targetTypes = ["bit varying"];
|
|
493
|
+
meta = PG_VARBIT_META;
|
|
494
|
+
paramsSchema = lengthParamsSchema;
|
|
495
|
+
renderOutputType(params) {
|
|
496
|
+
return renderLength("VarBit", params);
|
|
497
|
+
}
|
|
498
|
+
factory(_params) {
|
|
499
|
+
return () => new PgVarbitCodec(this);
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
const pgVarbitDescriptor = new PgVarbitDescriptor();
|
|
503
|
+
const pgVarbitColumn = (params = {}) => column(pgVarbitDescriptor.factory(params), pgVarbitDescriptor.codecId, params, "bit varying");
|
|
504
|
+
var PgByteaCodec = class extends CodecImpl {
|
|
505
|
+
async encode(value, _ctx) {
|
|
506
|
+
return value;
|
|
507
|
+
}
|
|
508
|
+
async decode(wire, _ctx) {
|
|
509
|
+
return wire instanceof Uint8Array && wire.constructor === Uint8Array ? wire : new Uint8Array(wire.buffer, wire.byteOffset, wire.byteLength);
|
|
510
|
+
}
|
|
511
|
+
encodeJson(value) {
|
|
512
|
+
return Buffer.from(value).toString("base64");
|
|
513
|
+
}
|
|
514
|
+
decodeJson(json) {
|
|
515
|
+
if (typeof json !== "string") throw new Error(`Expected base64 string for pg/bytea@1, got ${typeof json}`);
|
|
516
|
+
const decoded = Buffer.from(json, "base64");
|
|
517
|
+
if (decoded.toString("base64") !== json) throw new Error(`Invalid base64 string for pg/bytea@1 (length: ${json.length})`);
|
|
518
|
+
return new Uint8Array(decoded);
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
var PgByteaDescriptor = class extends CodecDescriptorImpl {
|
|
522
|
+
codecId = PG_BYTEA_CODEC_ID;
|
|
523
|
+
traits = ["equality"];
|
|
524
|
+
targetTypes = ["bytea"];
|
|
525
|
+
meta = PG_BYTEA_META;
|
|
526
|
+
paramsSchema = voidParamsSchema;
|
|
527
|
+
factory() {
|
|
528
|
+
return () => new PgByteaCodec(this);
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
const pgByteaDescriptor = new PgByteaDescriptor();
|
|
532
|
+
var PgIntervalCodec = class extends CodecImpl {
|
|
533
|
+
async encode(value, _ctx) {
|
|
534
|
+
return value;
|
|
535
|
+
}
|
|
536
|
+
async decode(wire, _ctx) {
|
|
537
|
+
return pgIntervalDecode(wire);
|
|
538
|
+
}
|
|
539
|
+
encodeJson(value) {
|
|
540
|
+
return value;
|
|
541
|
+
}
|
|
542
|
+
decodeJson(json) {
|
|
543
|
+
return json;
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
var PgIntervalDescriptor = class extends CodecDescriptorImpl {
|
|
547
|
+
codecId = PG_INTERVAL_CODEC_ID;
|
|
548
|
+
traits = ["equality", "order"];
|
|
549
|
+
targetTypes = ["interval"];
|
|
550
|
+
meta = PG_INTERVAL_META;
|
|
551
|
+
paramsSchema = precisionParamsSchema;
|
|
552
|
+
renderOutputType(params) {
|
|
553
|
+
return renderPrecision("Interval", params);
|
|
554
|
+
}
|
|
555
|
+
factory(_params) {
|
|
556
|
+
return () => new PgIntervalCodec(this);
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
const pgIntervalDescriptor = new PgIntervalDescriptor();
|
|
560
|
+
const pgIntervalColumn = (params = {}) => column(pgIntervalDescriptor.factory(params), pgIntervalDescriptor.codecId, params, "interval");
|
|
561
|
+
const enumParamsSchema = type({ "values?": "string[]" });
|
|
562
|
+
var PgEnumCodec = class extends CodecImpl {
|
|
563
|
+
async encode(value, _ctx) {
|
|
564
|
+
return value;
|
|
565
|
+
}
|
|
566
|
+
async decode(wire, _ctx) {
|
|
567
|
+
return wire;
|
|
568
|
+
}
|
|
569
|
+
encodeJson(value) {
|
|
570
|
+
return value;
|
|
571
|
+
}
|
|
572
|
+
decodeJson(json) {
|
|
573
|
+
return json;
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
var PgEnumDescriptor = class extends CodecDescriptorImpl {
|
|
577
|
+
codecId = PG_ENUM_CODEC_ID;
|
|
578
|
+
traits = ["equality", "order"];
|
|
579
|
+
targetTypes = ["enum"];
|
|
580
|
+
paramsSchema = enumParamsSchema;
|
|
581
|
+
renderOutputType(params) {
|
|
582
|
+
return pgEnumRenderOutputType(params);
|
|
583
|
+
}
|
|
584
|
+
factory(_params) {
|
|
585
|
+
return () => new PgEnumCodec(this);
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
const pgEnumDescriptor = new PgEnumDescriptor();
|
|
589
|
+
const pgEnumColumn = (params = {}) => column(pgEnumDescriptor.factory(params), pgEnumDescriptor.codecId, params, "enum");
|
|
590
|
+
var PgJsonCodec = class extends CodecImpl {
|
|
591
|
+
async encode(value, _ctx) {
|
|
592
|
+
return pgJsonEncode(value);
|
|
593
|
+
}
|
|
594
|
+
async decode(wire, _ctx) {
|
|
595
|
+
return pgJsonDecode(wire);
|
|
596
|
+
}
|
|
597
|
+
encodeJson(value) {
|
|
598
|
+
return value;
|
|
599
|
+
}
|
|
600
|
+
decodeJson(json) {
|
|
601
|
+
return json;
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
var PgJsonDescriptor = class extends CodecDescriptorImpl {
|
|
605
|
+
codecId = PG_JSON_CODEC_ID;
|
|
606
|
+
traits = [];
|
|
607
|
+
targetTypes = ["json"];
|
|
608
|
+
meta = PG_JSON_META;
|
|
609
|
+
paramsSchema = voidParamsSchema;
|
|
610
|
+
factory() {
|
|
611
|
+
return () => new PgJsonCodec(this);
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
const pgJsonDescriptor = new PgJsonDescriptor();
|
|
615
|
+
const pgJsonColumn = () => column(pgJsonDescriptor.factory(), pgJsonDescriptor.codecId, void 0, "json");
|
|
616
|
+
var PgJsonbCodec = class extends CodecImpl {
|
|
617
|
+
async encode(value, _ctx) {
|
|
618
|
+
return pgJsonbEncode(value);
|
|
619
|
+
}
|
|
620
|
+
async decode(wire, _ctx) {
|
|
621
|
+
return pgJsonbDecode(wire);
|
|
622
|
+
}
|
|
623
|
+
encodeJson(value) {
|
|
624
|
+
return value;
|
|
625
|
+
}
|
|
626
|
+
decodeJson(json) {
|
|
627
|
+
return json;
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
var PgJsonbDescriptor = class extends CodecDescriptorImpl {
|
|
631
|
+
codecId = PG_JSONB_CODEC_ID;
|
|
632
|
+
traits = ["equality"];
|
|
633
|
+
targetTypes = ["jsonb"];
|
|
634
|
+
meta = PG_JSONB_META;
|
|
635
|
+
paramsSchema = voidParamsSchema;
|
|
636
|
+
factory() {
|
|
637
|
+
return () => new PgJsonbCodec(this);
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
const pgJsonbDescriptor = new PgJsonbDescriptor();
|
|
641
|
+
const pgJsonbColumn = () => column(pgJsonbDescriptor.factory(), pgJsonbDescriptor.codecId, void 0, "jsonb");
|
|
642
|
+
const PG_CHAR_META = { db: { sql: { postgres: { nativeType: "character" } } } };
|
|
643
|
+
const PG_VARCHAR_META = { db: { sql: { postgres: { nativeType: "character varying" } } } };
|
|
644
|
+
const PG_INT_META = { db: { sql: { postgres: { nativeType: "integer" } } } };
|
|
645
|
+
const PG_FLOAT_META = { db: { sql: { postgres: { nativeType: "double precision" } } } };
|
|
646
|
+
var PgCharDescriptor = class extends CodecDescriptorImpl {
|
|
647
|
+
codecId = PG_CHAR_CODEC_ID;
|
|
648
|
+
targetTypes = ["character"];
|
|
649
|
+
meta = PG_CHAR_META;
|
|
650
|
+
traits = sqlCharDescriptor.traits;
|
|
651
|
+
paramsSchema = sqlCharDescriptor.paramsSchema;
|
|
652
|
+
renderOutputType(params) {
|
|
653
|
+
return sqlCharDescriptor.renderOutputType(params);
|
|
654
|
+
}
|
|
655
|
+
factory(_params) {
|
|
656
|
+
return () => new SqlCharCodec(this);
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
const pgCharDescriptor = new PgCharDescriptor();
|
|
660
|
+
const pgCharColumn = (params = {}) => column(pgCharDescriptor.factory(params), pgCharDescriptor.codecId, params, "character");
|
|
661
|
+
var PgVarcharDescriptor = class extends CodecDescriptorImpl {
|
|
662
|
+
codecId = PG_VARCHAR_CODEC_ID;
|
|
663
|
+
targetTypes = ["character varying"];
|
|
664
|
+
meta = PG_VARCHAR_META;
|
|
665
|
+
traits = sqlVarcharDescriptor.traits;
|
|
666
|
+
paramsSchema = sqlVarcharDescriptor.paramsSchema;
|
|
667
|
+
renderOutputType(params) {
|
|
668
|
+
return sqlVarcharDescriptor.renderOutputType(params);
|
|
669
|
+
}
|
|
670
|
+
factory(_params) {
|
|
671
|
+
return () => new SqlVarcharCodec(this);
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
const pgVarcharDescriptor = new PgVarcharDescriptor();
|
|
675
|
+
const pgVarcharColumn = (params = {}) => column(pgVarcharDescriptor.factory(params), pgVarcharDescriptor.codecId, params, "character varying");
|
|
676
|
+
var PgIntDescriptor = class extends CodecDescriptorImpl {
|
|
677
|
+
codecId = PG_INT_CODEC_ID;
|
|
678
|
+
targetTypes = ["int4"];
|
|
679
|
+
meta = PG_INT_META;
|
|
680
|
+
traits = sqlIntDescriptor.traits;
|
|
681
|
+
paramsSchema = sqlIntDescriptor.paramsSchema;
|
|
682
|
+
factory() {
|
|
683
|
+
return () => new SqlIntCodec(this);
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
const pgIntDescriptor = new PgIntDescriptor();
|
|
687
|
+
const pgIntColumn = () => column(pgIntDescriptor.factory(), pgIntDescriptor.codecId, void 0, "int4");
|
|
688
|
+
var PgFloatDescriptor = class extends CodecDescriptorImpl {
|
|
689
|
+
codecId = PG_FLOAT_CODEC_ID;
|
|
690
|
+
targetTypes = ["float8"];
|
|
691
|
+
meta = PG_FLOAT_META;
|
|
692
|
+
traits = sqlFloatDescriptor.traits;
|
|
693
|
+
paramsSchema = sqlFloatDescriptor.paramsSchema;
|
|
694
|
+
factory() {
|
|
695
|
+
return () => new SqlFloatCodec(this);
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
const pgFloatDescriptor = new PgFloatDescriptor();
|
|
699
|
+
const pgFloatColumn = () => column(pgFloatDescriptor.factory(), pgFloatDescriptor.codecId, void 0, "float8");
|
|
700
|
+
const codecDescriptors = [
|
|
701
|
+
sqlCharDescriptor,
|
|
702
|
+
sqlVarcharDescriptor,
|
|
703
|
+
sqlIntDescriptor,
|
|
704
|
+
sqlFloatDescriptor,
|
|
705
|
+
sqlTextDescriptor,
|
|
706
|
+
sqlTimestampDescriptor,
|
|
707
|
+
pgTextDescriptor,
|
|
708
|
+
pgCharDescriptor,
|
|
709
|
+
pgVarcharDescriptor,
|
|
710
|
+
pgIntDescriptor,
|
|
711
|
+
pgFloatDescriptor,
|
|
712
|
+
pgInt4Descriptor,
|
|
713
|
+
pgInt2Descriptor,
|
|
714
|
+
pgInt8Descriptor,
|
|
715
|
+
pgFloat4Descriptor,
|
|
716
|
+
pgFloat8Descriptor,
|
|
717
|
+
pgNumericDescriptor,
|
|
718
|
+
pgTimestampDescriptor,
|
|
719
|
+
pgTimestamptzDescriptor,
|
|
720
|
+
pgTimeDescriptor,
|
|
721
|
+
pgTimetzDescriptor,
|
|
722
|
+
pgBoolDescriptor,
|
|
723
|
+
pgBitDescriptor,
|
|
724
|
+
pgVarbitDescriptor,
|
|
725
|
+
pgByteaDescriptor,
|
|
726
|
+
pgIntervalDescriptor,
|
|
727
|
+
pgEnumDescriptor,
|
|
728
|
+
pgJsonDescriptor,
|
|
729
|
+
pgJsonbDescriptor
|
|
730
|
+
];
|
|
731
|
+
|
|
732
|
+
//#endregion
|
|
733
|
+
//#region src/core/registry.ts
|
|
734
|
+
/**
|
|
735
|
+
* Registry of every codec descriptor shipped by `@prisma-next/target-postgres`.
|
|
736
|
+
*
|
|
737
|
+
* 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.
|
|
738
|
+
*/
|
|
739
|
+
const postgresCodecRegistry = buildCodecDescriptorRegistry(codecDescriptors);
|
|
740
|
+
|
|
741
|
+
//#endregion
|
|
742
|
+
export { pgBitColumn, pgBoolColumn, pgCharColumn, pgEnumColumn, pgFloat4Column, pgFloat8Column, pgFloatColumn, pgInt2Column, pgInt4Column, pgInt8Column, pgIntColumn, pgIntervalColumn, pgJsonColumn, pgJsonbColumn, pgNumericColumn, pgTextColumn, pgTimeColumn, pgTimestampColumn, pgTimestamptzColumn, pgTimetzColumn, pgVarbitColumn, pgVarcharColumn, postgresCodecRegistry };
|
|
743
|
+
//# sourceMappingURL=codecs.mjs.map
|