@prisma-next/target-postgres 0.5.0-dev.9 → 0.5.1
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-CojIXVf9.mjs → codec-ids-C5qzBqus.mjs} +4 -4
- package/dist/{codec-ids-CojIXVf9.mjs.map → codec-ids-C5qzBqus.mjs.map} +1 -1
- package/dist/codec-ids-CplrEfmx.d.mts +29 -0
- package/dist/codec-ids-CplrEfmx.d.mts.map +1 -0
- package/dist/codec-ids.d.mts +2 -28
- package/dist/codec-ids.mjs +2 -3
- package/dist/codec-types-lrsb3N07.d.mts +79 -0
- package/dist/codec-types-lrsb3N07.d.mts.map +1 -0
- package/dist/codec-types.d.mts +2 -42
- package/dist/codec-types.mjs +1 -3
- package/dist/codecs-Cue97Xqf.d.mts +558 -0
- package/dist/codecs-Cue97Xqf.d.mts.map +1 -0
- package/dist/codecs.d.mts +13 -2
- package/dist/codecs.d.mts.map +1 -0
- package/dist/codecs.mjs +738 -2
- package/dist/codecs.mjs.map +1 -0
- package/dist/control.d.mts +1 -1
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +132 -96
- package/dist/control.mjs.map +1 -1
- package/dist/{data-transform-VfEGzXWt.mjs → data-transform-DKWXdHuZ.mjs} +25 -7
- package/dist/data-transform-DKWXdHuZ.mjs.map +1 -0
- package/dist/data-transform-bIeAcZIJ.d.mts +38 -0
- package/dist/data-transform-bIeAcZIJ.d.mts.map +1 -0
- package/dist/data-transform.d.mts +1 -1
- package/dist/data-transform.mjs +2 -3
- package/dist/{default-normalizer-DNOpRoOF.mjs → default-normalizer-C8XyZj85.mjs} +2 -2
- package/dist/{default-normalizer-DNOpRoOF.mjs.map → default-normalizer-C8XyZj85.mjs.map} +1 -1
- package/dist/default-normalizer.d.mts +0 -1
- package/dist/default-normalizer.d.mts.map +1 -1
- package/dist/default-normalizer.mjs +2 -3
- package/dist/descriptor-meta-Dde_BS3K.mjs +99 -0
- package/dist/descriptor-meta-Dde_BS3K.mjs.map +1 -0
- package/dist/{errors-AFvEPZ1R.mjs → errors-Chm2bKcS.mjs} +2 -3
- package/dist/{errors-AFvEPZ1R.mjs.map → errors-Chm2bKcS.mjs.map} +1 -1
- package/dist/errors.d.mts +0 -1
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +2 -3
- package/dist/{issue-planner-CFjB0_oO.mjs → issue-planner-DQ6WJkad.mjs} +24 -91
- package/dist/issue-planner-DQ6WJkad.mjs.map +1 -0
- package/dist/issue-planner.d.mts +4 -7
- package/dist/issue-planner.d.mts.map +1 -1
- package/dist/issue-planner.mjs +2 -3
- package/dist/migration.d.mts +29 -5
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +5 -6
- package/dist/migration.mjs.map +1 -1
- package/dist/{native-type-normalizer-CInai_oY.mjs → native-type-normalizer-Cry4QoLf.mjs} +2 -2
- package/dist/native-type-normalizer-Cry4QoLf.mjs.map +1 -0
- package/dist/native-type-normalizer.d.mts.map +1 -1
- package/dist/native-type-normalizer.mjs +2 -3
- package/dist/{op-factory-call-BKlruaiC.mjs → op-factory-call-DeaFxa8_.mjs} +27 -10
- package/dist/op-factory-call-DeaFxa8_.mjs.map +1 -0
- package/dist/{op-factory-call-C3bWXKSP.d.mts → op-factory-call-UFpUPJL6.d.mts} +11 -8
- package/dist/op-factory-call-UFpUPJL6.d.mts.map +1 -0
- package/dist/op-factory-call.d.mts +1 -2
- package/dist/op-factory-call.mjs +2 -3
- package/dist/pack.d.mts +28 -9
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +2 -3
- package/dist/{planner-CLUvVhUN.mjs → planner-CYtKhLYa.mjs} +22 -16
- package/dist/planner-CYtKhLYa.mjs.map +1 -0
- package/dist/{planner-ddl-builders-Dxvw1LHw.mjs → planner-ddl-builders-CLB7Umhh.mjs} +4 -5
- package/dist/planner-ddl-builders-CLB7Umhh.mjs.map +1 -0
- package/dist/planner-ddl-builders.d.mts +1 -1
- package/dist/planner-ddl-builders.d.mts.map +1 -1
- package/dist/planner-ddl-builders.mjs +2 -3
- package/dist/{planner-identity-values-Dju-o5GF.mjs → planner-identity-values-DTx0gePL.mjs} +2 -3
- package/dist/{planner-identity-values-Dju-o5GF.mjs.map → planner-identity-values-DTx0gePL.mjs.map} +1 -1
- package/dist/planner-identity-values.d.mts +0 -1
- package/dist/planner-identity-values.d.mts.map +1 -1
- package/dist/planner-identity-values.mjs +2 -3
- package/dist/{planner-produced-postgres-migration-CRRTno6Z.d.mts → planner-produced-postgres-migration-CjxWIVgh.d.mts} +11 -7
- package/dist/planner-produced-postgres-migration-CjxWIVgh.d.mts.map +1 -0
- package/dist/{planner-produced-postgres-migration-DSSPq8QS.mjs → planner-produced-postgres-migration-DphktB2N.mjs} +16 -8
- package/dist/planner-produced-postgres-migration-DphktB2N.mjs.map +1 -0
- package/dist/planner-produced-postgres-migration.d.mts +1 -4
- package/dist/planner-produced-postgres-migration.mjs +2 -3
- package/dist/{planner-schema-lookup-B7lkypwn.mjs → planner-schema-lookup-B1ags8ys.mjs} +2 -2
- package/dist/{planner-schema-lookup-B7lkypwn.mjs.map → planner-schema-lookup-B1ags8ys.mjs.map} +1 -1
- package/dist/planner-schema-lookup.d.mts +0 -1
- package/dist/planner-schema-lookup.d.mts.map +1 -1
- package/dist/planner-schema-lookup.mjs +2 -3
- package/dist/{planner-sql-checks-7jkgm9TX.mjs → planner-sql-checks-DwZvGlV4.mjs} +3 -5
- package/dist/planner-sql-checks-DwZvGlV4.mjs.map +1 -0
- package/dist/planner-sql-checks.d.mts.map +1 -1
- package/dist/planner-sql-checks.mjs +2 -3
- package/dist/{planner-target-details-DH-azLu-.d.mts → planner-target-details-bVVcanWh.d.mts} +1 -1
- package/dist/planner-target-details-bVVcanWh.d.mts.map +1 -0
- package/dist/planner-target-details.d.mts +1 -1
- package/dist/planner-target-details.mjs +1 -1
- package/dist/planner.d.mts +21 -12
- package/dist/planner.d.mts.map +1 -1
- package/dist/planner.mjs +2 -4
- package/dist/{postgres-migration-qtmtbONe.mjs → postgres-migration-Bkv140RW.mjs} +4 -5
- package/dist/postgres-migration-Bkv140RW.mjs.map +1 -0
- package/dist/{postgres-migration-BjA3Zmts.d.mts → postgres-migration-UkcHfZAA.d.mts} +6 -6
- package/dist/postgres-migration-UkcHfZAA.d.mts.map +1 -0
- package/dist/render-ops--1nnfNus.mjs +23 -0
- package/dist/render-ops--1nnfNus.mjs.map +1 -0
- package/dist/render-ops.d.mts +3 -4
- package/dist/render-ops.d.mts.map +1 -1
- package/dist/render-ops.mjs +2 -3
- package/dist/{render-typescript-1rF_SB4g.mjs → render-typescript-D3doH-vX.mjs} +2 -14
- package/dist/render-typescript-D3doH-vX.mjs.map +1 -0
- package/dist/render-typescript.d.mts +3 -6
- package/dist/render-typescript.d.mts.map +1 -1
- package/dist/render-typescript.mjs +2 -3
- package/dist/runtime.d.mts +5 -9
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +7 -14
- package/dist/runtime.mjs.map +1 -1
- package/dist/{shared-Bxkt8pNO.d.mts → shared-MpwjwAjM.d.mts} +2 -2
- package/dist/shared-MpwjwAjM.d.mts.map +1 -0
- package/dist/{sql-utils-r-Lw535w.mjs → sql-utils-CggjWNij.mjs} +4 -2
- package/dist/sql-utils-CggjWNij.mjs.map +1 -0
- package/dist/sql-utils.d.mts.map +1 -1
- package/dist/sql-utils.mjs +2 -3
- package/dist/{statement-builders-BPnmt6wx.mjs → statement-builders-BT889jV0.mjs} +28 -13
- package/dist/statement-builders-BT889jV0.mjs.map +1 -0
- package/dist/statement-builders.d.mts +31 -3
- package/dist/statement-builders.d.mts.map +1 -1
- package/dist/statement-builders.mjs +2 -3
- package/dist/{tables-BmdW_FWO.mjs → tables-DgYIXjUt.mjs} +53 -14
- package/dist/tables-DgYIXjUt.mjs.map +1 -0
- package/dist/{types-ClK03Ojd.d.mts → types-CTqpysRY.d.mts} +1 -1
- package/dist/types-CTqpysRY.d.mts.map +1 -0
- package/dist/types.d.mts +1 -1
- package/dist/types.mjs +1 -1
- package/package.json +21 -19
- package/src/core/authoring.ts +5 -11
- package/src/core/codec-helpers.ts +135 -0
- package/src/core/codec-ids.ts +1 -0
- package/src/core/codec-type-map.ts +81 -0
- package/src/core/codecs.ts +941 -547
- package/src/core/descriptor-meta.ts +1 -1
- package/src/core/migrations/issue-planner.ts +23 -35
- package/src/core/migrations/op-factory-call.ts +26 -5
- package/src/core/migrations/operations/data-transform.ts +86 -21
- package/src/core/migrations/operations/dependencies.ts +52 -0
- package/src/core/migrations/operations/indexes.ts +27 -2
- package/src/core/migrations/planner-produced-postgres-migration.ts +17 -5
- package/src/core/migrations/planner-strategies.ts +4 -86
- package/src/core/migrations/planner.ts +62 -20
- package/src/core/migrations/postgres-migration.ts +3 -6
- package/src/core/migrations/render-ops.ts +26 -3
- package/src/core/migrations/render-typescript.ts +5 -9
- package/src/core/migrations/runner.ts +172 -151
- package/src/core/migrations/statement-builders.ts +49 -10
- 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/control.ts +0 -1
- package/src/exports/migration.ts +5 -1
- package/src/exports/runtime.ts +6 -11
- package/src/exports/statement-builders.ts +2 -1
- package/dist/codec-ids.d.mts.map +0 -1
- package/dist/codec-types.d.mts.map +0 -1
- package/dist/codecs-BQEm9_oo.d.mts +0 -319
- package/dist/codecs-BQEm9_oo.d.mts.map +0 -1
- package/dist/codecs-BoahtY_Q.mjs +0 -385
- package/dist/codecs-BoahtY_Q.mjs.map +0 -1
- package/dist/data-transform-CxFRBIUp.d.mts +0 -32
- package/dist/data-transform-CxFRBIUp.d.mts.map +0 -1
- package/dist/data-transform-VfEGzXWt.mjs.map +0 -1
- package/dist/descriptor-meta-BVoVtyp-.mjs +0 -120
- package/dist/descriptor-meta-BVoVtyp-.mjs.map +0 -1
- package/dist/issue-planner-CFjB0_oO.mjs.map +0 -1
- package/dist/native-type-normalizer-CInai_oY.mjs.map +0 -1
- package/dist/op-factory-call-BKlruaiC.mjs.map +0 -1
- package/dist/op-factory-call-C3bWXKSP.d.mts.map +0 -1
- package/dist/planner-CLUvVhUN.mjs.map +0 -1
- package/dist/planner-ddl-builders-Dxvw1LHw.mjs.map +0 -1
- package/dist/planner-produced-postgres-migration-CRRTno6Z.d.mts.map +0 -1
- package/dist/planner-produced-postgres-migration-DSSPq8QS.mjs.map +0 -1
- package/dist/planner-sql-checks-7jkgm9TX.mjs.map +0 -1
- package/dist/planner-target-details-DH-azLu-.d.mts.map +0 -1
- package/dist/postgres-migration-BjA3Zmts.d.mts.map +0 -1
- package/dist/postgres-migration-qtmtbONe.mjs.map +0 -1
- package/dist/render-ops-D6_DHdOK.mjs +0 -8
- package/dist/render-ops-D6_DHdOK.mjs.map +0 -1
- package/dist/render-typescript-1rF_SB4g.mjs.map +0 -1
- package/dist/shared-Bxkt8pNO.d.mts.map +0 -1
- package/dist/sql-utils-r-Lw535w.mjs.map +0 -1
- package/dist/statement-builders-BPnmt6wx.mjs.map +0 -1
- package/dist/tables-BmdW_FWO.mjs.map +0 -1
- package/dist/types-ClK03Ojd.d.mts.map +0 -1
- package/src/core/json-schema-type-expression.ts +0 -131
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared encode/decode/render constants for the Postgres target codecs.
|
|
3
|
+
*
|
|
4
|
+
* The codec implementations live in `codecs.ts` (TML-2357). This file retains the conversion helpers + emit-path type renderers that the codec methods compose with — keeping a single source of truth for non-trivial conversions while the codec methods provide the framework-required `Promise<…>` boundary.
|
|
5
|
+
*
|
|
6
|
+
* Trivial identity passthroughs are inlined directly in the codec methods; only conversions with shape (custom JSON round-trip, decode normalisation, parameterised renderers) live here.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { JsonValue } from '@prisma-next/contract/types';
|
|
10
|
+
|
|
11
|
+
export function renderLength(
|
|
12
|
+
typeName: string,
|
|
13
|
+
typeParams: Record<string, unknown>,
|
|
14
|
+
): string | undefined {
|
|
15
|
+
const length = typeParams['length'];
|
|
16
|
+
if (length === undefined) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
if (typeof length !== 'number' || !Number.isFinite(length) || !Number.isInteger(length)) {
|
|
20
|
+
throw new Error(
|
|
21
|
+
`renderOutputType: expected integer "length" in typeParams for ${typeName}, got ${String(length)}`,
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
return `${typeName}<${length}>`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function renderPrecision(typeName: string, typeParams: Record<string, unknown>): string {
|
|
28
|
+
const precision = typeParams['precision'];
|
|
29
|
+
if (precision === undefined) {
|
|
30
|
+
return typeName;
|
|
31
|
+
}
|
|
32
|
+
if (
|
|
33
|
+
typeof precision !== 'number' ||
|
|
34
|
+
!Number.isFinite(precision) ||
|
|
35
|
+
!Number.isInteger(precision)
|
|
36
|
+
) {
|
|
37
|
+
throw new Error(
|
|
38
|
+
`renderOutputType: expected integer "precision" in typeParams for ${typeName}, got ${String(precision)}`,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return `${typeName}<${precision}>`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const pgNumericDecode = (wire: string | number): string => {
|
|
45
|
+
if (typeof wire === 'number') return String(wire);
|
|
46
|
+
return wire;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const pgNumericRenderOutputType = (typeParams: {
|
|
50
|
+
readonly precision: number;
|
|
51
|
+
readonly scale?: number;
|
|
52
|
+
}): string | undefined => {
|
|
53
|
+
const precision = typeParams.precision;
|
|
54
|
+
if (precision === undefined) return undefined;
|
|
55
|
+
if (
|
|
56
|
+
typeof precision !== 'number' ||
|
|
57
|
+
!Number.isFinite(precision) ||
|
|
58
|
+
!Number.isInteger(precision)
|
|
59
|
+
) {
|
|
60
|
+
throw new Error(
|
|
61
|
+
`renderOutputType: expected integer "precision" in typeParams for Numeric, got ${String(precision)}`,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
const scale = typeParams.scale;
|
|
65
|
+
if (scale === undefined) return `Numeric<${precision}>`;
|
|
66
|
+
if (typeof scale !== 'number' || !Number.isFinite(scale) || !Number.isInteger(scale)) {
|
|
67
|
+
throw new Error(
|
|
68
|
+
`renderOutputType: expected integer "scale" in typeParams for Numeric, got ${String(scale)}`,
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
return `Numeric<${precision}, ${scale}>`;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// ISO 8601 UTC: `YYYY-MM-DDTHH:MM:SS[.mmm…]Z`. Trailing `Z` is required; fractional seconds are optional. Other `Date`-parseable formats (`January 15, 2024`, `01/15/2024`, etc.) are intentionally rejected because those formats are implementation-defined and not the documented contract for `pg/timestamp@1` / `pg/timestamptz@1`.
|
|
75
|
+
const ISO_8601_UTC = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?Z$/;
|
|
76
|
+
|
|
77
|
+
export const pgTimestampEncodeJson = (value: Date): JsonValue => value.toISOString();
|
|
78
|
+
export const pgTimestampDecodeJson = (json: JsonValue): Date => {
|
|
79
|
+
if (typeof json !== 'string') {
|
|
80
|
+
throw new Error(`Expected ISO date string for pg/timestamp@1, got ${typeof json}`);
|
|
81
|
+
}
|
|
82
|
+
if (!ISO_8601_UTC.test(json)) {
|
|
83
|
+
throw new Error(`Invalid ISO date string for pg/timestamp@1: ${json}`);
|
|
84
|
+
}
|
|
85
|
+
const date = new Date(json);
|
|
86
|
+
if (Number.isNaN(date.getTime())) {
|
|
87
|
+
throw new Error(`Invalid ISO date string for pg/timestamp@1: ${json}`);
|
|
88
|
+
}
|
|
89
|
+
return date;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const pgTimestamptzEncodeJson = (value: Date): JsonValue => value.toISOString();
|
|
93
|
+
export const pgTimestamptzDecodeJson = (json: JsonValue): Date => {
|
|
94
|
+
if (typeof json !== 'string') {
|
|
95
|
+
throw new Error(`Expected ISO date string for pg/timestamptz@1, got ${typeof json}`);
|
|
96
|
+
}
|
|
97
|
+
if (!ISO_8601_UTC.test(json)) {
|
|
98
|
+
throw new Error(`Invalid ISO date string for pg/timestamptz@1: ${json}`);
|
|
99
|
+
}
|
|
100
|
+
const date = new Date(json);
|
|
101
|
+
if (Number.isNaN(date.getTime())) {
|
|
102
|
+
throw new Error(`Invalid ISO date string for pg/timestamptz@1: ${json}`);
|
|
103
|
+
}
|
|
104
|
+
return date;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const pgIntervalDecode = (wire: string | Record<string, unknown>): string => {
|
|
108
|
+
if (typeof wire === 'string') return wire;
|
|
109
|
+
return JSON.stringify(wire);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const pgEnumRenderOutputType = (typeParams: {
|
|
113
|
+
readonly values?: readonly unknown[];
|
|
114
|
+
}): string => {
|
|
115
|
+
const values = typeParams.values;
|
|
116
|
+
if (!Array.isArray(values)) {
|
|
117
|
+
throw new Error(
|
|
118
|
+
`renderOutputType: expected array "values" in typeParams for enum, got ${typeof values}`,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
if (!values.every((v): v is string => typeof v === 'string')) {
|
|
122
|
+
throw new Error(`renderOutputType: expected string[] "values" in typeParams for enum`);
|
|
123
|
+
}
|
|
124
|
+
return values
|
|
125
|
+
.map((value) => `'${value.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`)
|
|
126
|
+
.join(' | ');
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const pgJsonEncode = (value: string | JsonValue): string => JSON.stringify(value);
|
|
130
|
+
export const pgJsonDecode = (wire: string | JsonValue): JsonValue =>
|
|
131
|
+
typeof wire === 'string' ? JSON.parse(wire) : wire;
|
|
132
|
+
|
|
133
|
+
export const pgJsonbEncode = (value: string | JsonValue): string => JSON.stringify(value);
|
|
134
|
+
export const pgJsonbDecode = (wire: string | JsonValue): JsonValue =>
|
|
135
|
+
typeof wire === 'string' ? JSON.parse(wire) : wire;
|
package/src/core/codec-ids.ts
CHANGED
|
@@ -28,3 +28,4 @@ export const PG_TIMETZ_CODEC_ID = 'pg/timetz@1' as const;
|
|
|
28
28
|
export const PG_INTERVAL_CODEC_ID = 'pg/interval@1' as const;
|
|
29
29
|
export const PG_JSON_CODEC_ID = 'pg/json@1' as const;
|
|
30
30
|
export const PG_JSONB_CODEC_ID = 'pg/jsonb@1' as const;
|
|
31
|
+
export const PG_BYTEA_CODEC_ID = 'pg/bytea@1' as const;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal codec descriptor map and `CodecTypes` materialisation for the Postgres target.
|
|
3
|
+
*
|
|
4
|
+
* Why this lives in `core/` even though the public origin of `CodecTypes` is `exports/codec-types.ts`:
|
|
5
|
+
*
|
|
6
|
+
* - The descriptor map (`codecDescriptorMap`) and the `Resolve<T>` helper are implementation detail; they shouldn't appear on the public package surface.
|
|
7
|
+
* - The `CodecTypes` *materialisation* (the `Resolve<...>` application) must still happen at the public boundary so tsdown's DTS bundler resolves consumer-side `pack.d.mts` references via the public entry point rather than a hash-named internal chunk (the `TS2742` family). `exports/codec-types.ts` re-exports `CodecTypes` from here as a type alias, which preserves the materialisation site at the public surface.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { ExtractCodecTypes } from '@prisma-next/sql-relational-core/ast';
|
|
11
|
+
import {
|
|
12
|
+
sqlCharDescriptor,
|
|
13
|
+
sqlFloatDescriptor,
|
|
14
|
+
sqlIntDescriptor,
|
|
15
|
+
sqlTextDescriptor,
|
|
16
|
+
sqlTimestampDescriptor,
|
|
17
|
+
sqlVarcharDescriptor,
|
|
18
|
+
} from '@prisma-next/sql-relational-core/ast';
|
|
19
|
+
import {
|
|
20
|
+
pgBitDescriptor,
|
|
21
|
+
pgBoolDescriptor,
|
|
22
|
+
pgByteaDescriptor,
|
|
23
|
+
pgCharDescriptor,
|
|
24
|
+
pgEnumDescriptor,
|
|
25
|
+
pgFloat4Descriptor,
|
|
26
|
+
pgFloat8Descriptor,
|
|
27
|
+
pgFloatDescriptor,
|
|
28
|
+
pgInt2Descriptor,
|
|
29
|
+
pgInt4Descriptor,
|
|
30
|
+
pgInt8Descriptor,
|
|
31
|
+
pgIntDescriptor,
|
|
32
|
+
pgIntervalDescriptor,
|
|
33
|
+
pgJsonbDescriptor,
|
|
34
|
+
pgJsonDescriptor,
|
|
35
|
+
pgNumericDescriptor,
|
|
36
|
+
pgTextDescriptor,
|
|
37
|
+
pgTimeDescriptor,
|
|
38
|
+
pgTimestampDescriptor,
|
|
39
|
+
pgTimestamptzDescriptor,
|
|
40
|
+
pgTimetzDescriptor,
|
|
41
|
+
pgVarbitDescriptor,
|
|
42
|
+
pgVarcharDescriptor,
|
|
43
|
+
} from './codecs';
|
|
44
|
+
|
|
45
|
+
export const codecDescriptorMap = {
|
|
46
|
+
char: sqlCharDescriptor,
|
|
47
|
+
varchar: sqlVarcharDescriptor,
|
|
48
|
+
int: sqlIntDescriptor,
|
|
49
|
+
float: sqlFloatDescriptor,
|
|
50
|
+
'sql-text': sqlTextDescriptor,
|
|
51
|
+
'sql-timestamp': sqlTimestampDescriptor,
|
|
52
|
+
text: pgTextDescriptor,
|
|
53
|
+
character: pgCharDescriptor,
|
|
54
|
+
'character varying': pgVarcharDescriptor,
|
|
55
|
+
integer: pgIntDescriptor,
|
|
56
|
+
'double precision': pgFloatDescriptor,
|
|
57
|
+
int4: pgInt4Descriptor,
|
|
58
|
+
int2: pgInt2Descriptor,
|
|
59
|
+
int8: pgInt8Descriptor,
|
|
60
|
+
float4: pgFloat4Descriptor,
|
|
61
|
+
float8: pgFloat8Descriptor,
|
|
62
|
+
numeric: pgNumericDescriptor,
|
|
63
|
+
timestamp: pgTimestampDescriptor,
|
|
64
|
+
timestamptz: pgTimestamptzDescriptor,
|
|
65
|
+
time: pgTimeDescriptor,
|
|
66
|
+
timetz: pgTimetzDescriptor,
|
|
67
|
+
bool: pgBoolDescriptor,
|
|
68
|
+
bit: pgBitDescriptor,
|
|
69
|
+
'bit varying': pgVarbitDescriptor,
|
|
70
|
+
bytea: pgByteaDescriptor,
|
|
71
|
+
interval: pgIntervalDescriptor,
|
|
72
|
+
enum: pgEnumDescriptor,
|
|
73
|
+
json: pgJsonDescriptor,
|
|
74
|
+
jsonb: pgJsonbDescriptor,
|
|
75
|
+
} as const;
|
|
76
|
+
|
|
77
|
+
export type Resolve<T> = { readonly [K in keyof T]: { readonly [P in keyof T[K]]: T[K][P] } };
|
|
78
|
+
|
|
79
|
+
export type CodecDescriptorMap = typeof codecDescriptorMap;
|
|
80
|
+
|
|
81
|
+
export type ExtractedCodecTypes = ExtractCodecTypes<CodecDescriptorMap>;
|