@prisma-next/adapter-postgres 0.3.0-dev.11 → 0.3.0-dev.113
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/LICENSE +201 -0
- package/README.md +64 -2
- package/dist/adapter-CWmWEFe1.mjs +361 -0
- package/dist/adapter-CWmWEFe1.mjs.map +1 -0
- package/dist/adapter.d.mts +23 -0
- package/dist/adapter.d.mts.map +1 -0
- package/dist/adapter.mjs +3 -0
- package/dist/codec-ids-Bsm9c7ns.mjs +29 -0
- package/dist/codec-ids-Bsm9c7ns.mjs.map +1 -0
- package/dist/codec-types.d.mts +141 -0
- package/dist/codec-types.d.mts.map +1 -0
- package/dist/codec-types.mjs +3 -0
- package/dist/codecs-DgJcyEBR.mjs +254 -0
- package/dist/codecs-DgJcyEBR.mjs.map +1 -0
- package/dist/column-types.d.mts +110 -0
- package/dist/column-types.d.mts.map +1 -0
- package/dist/column-types.mjs +180 -0
- package/dist/column-types.mjs.map +1 -0
- package/dist/control.d.mts +77 -0
- package/dist/control.d.mts.map +1 -0
- package/dist/control.mjs +773 -0
- package/dist/control.mjs.map +1 -0
- package/dist/descriptor-meta-l_dv8Nnn.mjs +884 -0
- package/dist/descriptor-meta-l_dv8Nnn.mjs.map +1 -0
- package/dist/runtime.d.mts +19 -0
- package/dist/runtime.d.mts.map +1 -0
- package/dist/runtime.mjs +99 -0
- package/dist/runtime.mjs.map +1 -0
- package/dist/sql-utils-CSfAGEwF.mjs +78 -0
- package/dist/sql-utils-CSfAGEwF.mjs.map +1 -0
- package/dist/types-aQLL6QVb.d.mts +19 -0
- package/dist/types-aQLL6QVb.d.mts.map +1 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -0
- package/package.json +39 -46
- package/src/core/adapter.ts +529 -256
- package/src/core/codec-ids.ts +28 -0
- package/src/core/codecs.ts +385 -36
- package/src/core/control-adapter.ts +404 -179
- package/src/core/control-mutation-defaults.ts +335 -0
- package/src/core/default-normalizer.ts +138 -0
- package/src/core/descriptor-meta.ts +296 -9
- package/src/core/enum-control-hooks.ts +733 -0
- package/src/core/json-schema-type-expression.ts +131 -0
- package/src/core/json-schema-validator.ts +53 -0
- package/src/core/sql-utils.ts +111 -0
- package/src/core/standard-schema.ts +71 -0
- package/src/core/types.ts +5 -3
- package/src/exports/codec-types.ts +73 -1
- package/src/exports/column-types.ts +233 -9
- package/src/exports/control.ts +20 -9
- package/src/exports/runtime.ts +76 -19
- package/dist/chunk-HD5YISNQ.js +0 -47
- package/dist/chunk-HD5YISNQ.js.map +0 -1
- package/dist/chunk-J3XSOAM2.js +0 -162
- package/dist/chunk-J3XSOAM2.js.map +0 -1
- package/dist/chunk-T6S3A6VT.js +0 -301
- package/dist/chunk-T6S3A6VT.js.map +0 -1
- package/dist/core/adapter.d.ts +0 -19
- package/dist/core/adapter.d.ts.map +0 -1
- package/dist/core/codecs.d.ts +0 -110
- package/dist/core/codecs.d.ts.map +0 -1
- package/dist/core/control-adapter.d.ts +0 -33
- package/dist/core/control-adapter.d.ts.map +0 -1
- package/dist/core/descriptor-meta.d.ts +0 -72
- package/dist/core/descriptor-meta.d.ts.map +0 -1
- package/dist/core/types.d.ts +0 -16
- package/dist/core/types.d.ts.map +0 -1
- package/dist/exports/adapter.d.ts +0 -2
- package/dist/exports/adapter.d.ts.map +0 -1
- package/dist/exports/adapter.js +0 -8
- package/dist/exports/adapter.js.map +0 -1
- package/dist/exports/codec-types.d.ts +0 -11
- package/dist/exports/codec-types.d.ts.map +0 -1
- package/dist/exports/codec-types.js +0 -7
- package/dist/exports/codec-types.js.map +0 -1
- package/dist/exports/column-types.d.ts +0 -17
- package/dist/exports/column-types.d.ts.map +0 -1
- package/dist/exports/column-types.js +0 -49
- package/dist/exports/column-types.js.map +0 -1
- package/dist/exports/control.d.ts +0 -8
- package/dist/exports/control.d.ts.map +0 -1
- package/dist/exports/control.js +0 -279
- package/dist/exports/control.js.map +0 -1
- package/dist/exports/runtime.d.ts +0 -15
- package/dist/exports/runtime.d.ts.map +0 -1
- package/dist/exports/runtime.js +0 -20
- package/dist/exports/runtime.js.map +0 -1
- package/dist/exports/types.d.ts +0 -2
- package/dist/exports/types.d.ts.map +0 -1
- package/dist/exports/types.js +0 -1
- package/dist/exports/types.js.map +0 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { StorageTypeInstance } from "@prisma-next/sql-contract/types";
|
|
2
|
+
import { ColumnTypeDescriptor } from "@prisma-next/contract-authoring";
|
|
3
|
+
|
|
4
|
+
//#region src/core/standard-schema.d.ts
|
|
5
|
+
type StandardSchemaJsonSchemaField = {
|
|
6
|
+
readonly output?: unknown;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Runtime view of the Standard Schema protocol.
|
|
10
|
+
* Reads `~standard.jsonSchema.output` for the serializable JSON Schema representation,
|
|
11
|
+
* and `.expression` for an optional TypeScript type expression string (Arktype-specific).
|
|
12
|
+
*
|
|
13
|
+
* This differs from the compile-time `StandardSchemaLike` in `codec-types.ts`, which reads
|
|
14
|
+
* `~standard.types.output` for TypeScript type narrowing in contract.d.ts.
|
|
15
|
+
*/
|
|
16
|
+
type StandardSchemaLike = {
|
|
17
|
+
readonly '~standard'?: {
|
|
18
|
+
readonly version?: number;
|
|
19
|
+
readonly jsonSchema?: StandardSchemaJsonSchemaField;
|
|
20
|
+
};
|
|
21
|
+
readonly expression?: unknown;
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/exports/column-types.d.ts
|
|
25
|
+
declare const textColumn: ColumnTypeDescriptor;
|
|
26
|
+
declare function charColumn(length: number): ColumnTypeDescriptor & {
|
|
27
|
+
readonly typeParams: {
|
|
28
|
+
readonly length: number;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
declare function varcharColumn(length: number): ColumnTypeDescriptor & {
|
|
32
|
+
readonly typeParams: {
|
|
33
|
+
readonly length: number;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
declare const int4Column: ColumnTypeDescriptor;
|
|
37
|
+
declare const int2Column: ColumnTypeDescriptor;
|
|
38
|
+
declare const int8Column: ColumnTypeDescriptor;
|
|
39
|
+
declare const float4Column: ColumnTypeDescriptor;
|
|
40
|
+
declare const float8Column: ColumnTypeDescriptor;
|
|
41
|
+
declare function numericColumn(precision: number, scale?: number): ColumnTypeDescriptor & {
|
|
42
|
+
readonly typeParams: {
|
|
43
|
+
readonly precision: number;
|
|
44
|
+
readonly scale?: number;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
declare const timestampColumn: ColumnTypeDescriptor;
|
|
48
|
+
declare const timestamptzColumn: ColumnTypeDescriptor;
|
|
49
|
+
declare function timeColumn(precision?: number): ColumnTypeDescriptor & {
|
|
50
|
+
readonly typeParams?: {
|
|
51
|
+
readonly precision: number;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
declare function timetzColumn(precision?: number): ColumnTypeDescriptor & {
|
|
55
|
+
readonly typeParams?: {
|
|
56
|
+
readonly precision: number;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
declare const boolColumn: ColumnTypeDescriptor;
|
|
60
|
+
declare function bitColumn(length: number): ColumnTypeDescriptor & {
|
|
61
|
+
readonly typeParams: {
|
|
62
|
+
readonly length: number;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
declare function varbitColumn(length: number): ColumnTypeDescriptor & {
|
|
66
|
+
readonly typeParams: {
|
|
67
|
+
readonly length: number;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
declare function intervalColumn(precision?: number): ColumnTypeDescriptor & {
|
|
71
|
+
readonly typeParams?: {
|
|
72
|
+
readonly precision: number;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
declare const jsonColumn: ColumnTypeDescriptor;
|
|
76
|
+
declare const jsonbColumn: ColumnTypeDescriptor;
|
|
77
|
+
type JsonSchemaTypeParams = {
|
|
78
|
+
readonly schemaJson: Record<string, unknown>;
|
|
79
|
+
readonly type?: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Typed column descriptor for JSON/JSONB columns with Standard Schema.
|
|
83
|
+
*
|
|
84
|
+
* `typeParams.schemaJson` carries the runtime JSON Schema payload (serializable record)
|
|
85
|
+
* used by the emitter to render TypeScript type expressions in contract.d.ts.
|
|
86
|
+
*
|
|
87
|
+
* `typeParams.schema` is a phantom-only key: at runtime it does not exist, but at the
|
|
88
|
+
* type level it preserves the original `TSchema` so that `ResolveStandardSchemaOutput<P>`
|
|
89
|
+
* in codec-types.ts can resolve the output type via `~standard.types.output` or `.infer`.
|
|
90
|
+
*/
|
|
91
|
+
type TypedColumnDescriptor<TSchema extends StandardSchemaLike> = ColumnTypeDescriptor & {
|
|
92
|
+
readonly typeParams: JsonSchemaTypeParams & {
|
|
93
|
+
readonly schema: TSchema;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
declare function json(): ColumnTypeDescriptor;
|
|
97
|
+
declare function json<TSchema extends StandardSchemaLike>(schema: TSchema): TypedColumnDescriptor<TSchema>;
|
|
98
|
+
declare function jsonb(): ColumnTypeDescriptor;
|
|
99
|
+
declare function jsonb<TSchema extends StandardSchemaLike>(schema: TSchema): TypedColumnDescriptor<TSchema>;
|
|
100
|
+
declare function enumType<const Values extends readonly string[]>(name: string, values: Values): StorageTypeInstance & {
|
|
101
|
+
readonly typeParams: {
|
|
102
|
+
readonly values: Values;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
declare function enumColumn<TypeName extends string>(typeName: TypeName, nativeType: string): ColumnTypeDescriptor & {
|
|
106
|
+
readonly typeRef: TypeName;
|
|
107
|
+
};
|
|
108
|
+
//#endregion
|
|
109
|
+
export { bitColumn, boolColumn, charColumn, enumColumn, enumType, float4Column, float8Column, int2Column, int4Column, int8Column, intervalColumn, json, jsonColumn, jsonb, jsonbColumn, numericColumn, textColumn, timeColumn, timestampColumn, timestamptzColumn, timetzColumn, varbitColumn, varcharColumn };
|
|
110
|
+
//# sourceMappingURL=column-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-types.d.mts","names":[],"sources":["../src/core/standard-schema.ts","../src/exports/column-types.ts"],"sourcesContent":[],"mappings":";;;;KAEK,6BAAA;;;AAFsB;AAc3B;;;;ACwBA;AAKA;AAUA;AAUa,KDjDD,kBAAA,GCiDa;EAKZ,SAAA,WAGH,CAAA,EAAA;IAEG,SAGH,OAAA,CAAA,EAAA,MAHe;IAKZ,SAAA,UAGH,CAAA,EDhEgB,6BCgEhB;EAEG,CAAA;EAKG,SAAA,UAAa,CAAA,EAAA,OAG1B;AAUH,CAAA;;;AA/Da,cAAA,UAAY,EAAA,oBAGf;AAEM,iBAAA,UAAA,CAA4B,MAAA,EAAA,MAAA,CAAoB,EAApB,oBAAoB,GAAA;EAUhD,SAAA,UAAa,EAAA;IAUhB,SAGH,MAAA,EAAA,MAHe;EAKZ,CAAA;AAKb,CAAA;AAKa,iBAzBG,aAAA,CAyBW,MAAA,EAAA,MAGjB,CAAA,EA5BqC,oBA4BrC,GAAA;EAEG,SAAA,UAGH,EAAA;IAEM,SAAA,MAAa,EAAA,MAAA;EAahB,CAAA;AAKb,CAAA;AAKgB,cAhDH,UAgDmC,EAhDvB,oBAgD2C;AAUpD,cArDH,UAqDqC,EArDzB,oBAqD6C;AAUzD,cA1DA,UA0DY,EA1DA,oBA6Df;AAEM,cA1DH,YA0D8B,EA1DhB,oBA0DoC;AAU/C,cA/DH,YA+DiC,EA/DnB,oBA+DuC;AAUlD,iBApEA,aAAA,CAoEoC,SAAA,EAAA,MAAoB,EAAA,KAAA,CAAA,EAAA,MAAA,CAAA,EAjErE,oBAiEqE,GAAA;EAU3D,SAAA,UAGH,EAAA;IAEG,SAAA,SAGH,EAAA,MAHgB;IAKrB,SAAA,KAAA,CAAA,EAAA,MAAoB;EA6BpB,CAAA;CAAsC;AAAsB,cAxGpD,eAwGoD,EAxGnC,oBAwGmC;AAC1C,cApGV,iBAoGU,EApGS,oBAoGT;AAA0C,iBA/FjD,UAAA,CA+FiD,SAAA,CAAA,EAAA,MAAA,CAAA,EA/FjB,oBA+FiB,GAAA;EAAO,SAAA,UAAA,CAAA,EAAA;IAkCxD,SAAI,SAAI,EAAA,MAAA;EACR,CAAA;CAAqB;AAC3B,iBAzHM,YAAA,CAyHN,SAAA,CAAA,EAAA,MAAA,CAAA,EAzHwC,oBAyHxC,GAAA;EACe,SAAA,UAAA,CAAA,EAAA;IAAtB,SAAA,SAAA,EAAA,MAAA;EAAqB,CAAA;AAKxB,CAAA;AACgB,cAtHH,UAsHQ,EAtHI,oBAsHJ;AAAiB,iBAjHtB,SAAA,CAiHsB,MAAA,EAAA,MAAA,CAAA,EAjHK,oBAiHL,GAAA;EAC5B,SAAA,UAAA,EAAA;IACe,SAAA,MAAA,EAAA,MAAA;EAAtB,CAAA;CAAqB;AAKR,iBA9GA,YAAA,CA8GQ,MAAA,EAAA,MAAA,CAAA,EA9GsB,oBA8GtB,GAAA;EAEd,SAAA,UAAA,EAAA;IACP,SAAA,MAAA,EAAA,MAAA;EAAgE,CAAA;CAAM;AAQzD,iBA/GA,cAAA,CA+GU,SAAA,CAAA,EAAA,MAAA,CAAA,EA/G0B,oBA+G1B,GAAA;EACd,SAAA,UAAA,CAAA,EAAA;IAET,SAAA,SAAA,EAAA,MAAA;EAA2C,CAAA;CAAQ;cAxGzC,YAAY;cAKZ,aAAa;KAKrB,oBAAA;uBACkB;;;;;;;;;;;;;KA4BlB,sCAAsC,sBAAsB;uBAC1C;qBAA0C;;;iBAkCjD,IAAA,CAAA,GAAQ;iBACR,qBAAqB,4BAC3B,UACP,sBAAsB;iBAKT,KAAA,CAAA,GAAS;iBACT,sBAAsB,4BAC5B,UACP,sBAAsB;iBAKT,uEAEN,SACP;;qBAAgE;;;iBAQnD,8CACJ,+BAET;oBAA2C"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { C as SQL_CHAR_CODEC_ID, E as SQL_VARCHAR_CODEC_ID, _ as PG_TIMESTAMPTZ_CODEC_ID, a as PG_FLOAT4_CODEC_ID, b as PG_TIME_CODEC_ID, c as PG_INT2_CODEC_ID, d as PG_INTERVAL_CODEC_ID, g as PG_TEXT_CODEC_ID, h as PG_NUMERIC_CODEC_ID, i as PG_ENUM_CODEC_ID, l as PG_INT4_CODEC_ID, m as PG_JSON_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_FLOAT8_CODEC_ID, p as PG_JSONB_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_INT8_CODEC_ID, v as PG_TIMESTAMP_CODEC_ID, x as PG_VARBIT_CODEC_ID, y as PG_TIMETZ_CODEC_ID } from "./codec-ids-Bsm9c7ns.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/core/standard-schema.ts
|
|
4
|
+
function isObjectLike(value) {
|
|
5
|
+
return (typeof value === "object" || typeof value === "function") && value !== null;
|
|
6
|
+
}
|
|
7
|
+
function resolveOutputJsonSchemaField(schema) {
|
|
8
|
+
const jsonSchema = schema["~standard"]?.jsonSchema;
|
|
9
|
+
if (!jsonSchema) return;
|
|
10
|
+
if (typeof jsonSchema.output === "function") return jsonSchema.output({ target: "draft-07" });
|
|
11
|
+
return jsonSchema.output;
|
|
12
|
+
}
|
|
13
|
+
function extractStandardSchemaOutputJsonSchema(schema) {
|
|
14
|
+
const outputSchema = resolveOutputJsonSchemaField(schema);
|
|
15
|
+
if (!isObjectLike(outputSchema)) return;
|
|
16
|
+
return outputSchema;
|
|
17
|
+
}
|
|
18
|
+
function extractStandardSchemaTypeExpression(schema) {
|
|
19
|
+
const expression = schema.expression;
|
|
20
|
+
if (typeof expression !== "string") return;
|
|
21
|
+
const trimmedExpression = expression.trim();
|
|
22
|
+
if (trimmedExpression.length === 0) return;
|
|
23
|
+
return trimmedExpression;
|
|
24
|
+
}
|
|
25
|
+
function isStandardSchemaLike(value) {
|
|
26
|
+
return isObjectLike(value) && isObjectLike(value["~standard"]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/exports/column-types.ts
|
|
31
|
+
const textColumn = {
|
|
32
|
+
codecId: PG_TEXT_CODEC_ID,
|
|
33
|
+
nativeType: "text"
|
|
34
|
+
};
|
|
35
|
+
function charColumn(length) {
|
|
36
|
+
return {
|
|
37
|
+
codecId: SQL_CHAR_CODEC_ID,
|
|
38
|
+
nativeType: "character",
|
|
39
|
+
typeParams: { length }
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function varcharColumn(length) {
|
|
43
|
+
return {
|
|
44
|
+
codecId: SQL_VARCHAR_CODEC_ID,
|
|
45
|
+
nativeType: "character varying",
|
|
46
|
+
typeParams: { length }
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const int4Column = {
|
|
50
|
+
codecId: PG_INT4_CODEC_ID,
|
|
51
|
+
nativeType: "int4"
|
|
52
|
+
};
|
|
53
|
+
const int2Column = {
|
|
54
|
+
codecId: PG_INT2_CODEC_ID,
|
|
55
|
+
nativeType: "int2"
|
|
56
|
+
};
|
|
57
|
+
const int8Column = {
|
|
58
|
+
codecId: PG_INT8_CODEC_ID,
|
|
59
|
+
nativeType: "int8"
|
|
60
|
+
};
|
|
61
|
+
const float4Column = {
|
|
62
|
+
codecId: PG_FLOAT4_CODEC_ID,
|
|
63
|
+
nativeType: "float4"
|
|
64
|
+
};
|
|
65
|
+
const float8Column = {
|
|
66
|
+
codecId: PG_FLOAT8_CODEC_ID,
|
|
67
|
+
nativeType: "float8"
|
|
68
|
+
};
|
|
69
|
+
function numericColumn(precision, scale) {
|
|
70
|
+
return {
|
|
71
|
+
codecId: PG_NUMERIC_CODEC_ID,
|
|
72
|
+
nativeType: "numeric",
|
|
73
|
+
typeParams: scale === void 0 ? { precision } : {
|
|
74
|
+
precision,
|
|
75
|
+
scale
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const timestampColumn = {
|
|
80
|
+
codecId: PG_TIMESTAMP_CODEC_ID,
|
|
81
|
+
nativeType: "timestamp"
|
|
82
|
+
};
|
|
83
|
+
const timestamptzColumn = {
|
|
84
|
+
codecId: PG_TIMESTAMPTZ_CODEC_ID,
|
|
85
|
+
nativeType: "timestamptz"
|
|
86
|
+
};
|
|
87
|
+
function timeColumn(precision) {
|
|
88
|
+
return {
|
|
89
|
+
codecId: PG_TIME_CODEC_ID,
|
|
90
|
+
nativeType: "time",
|
|
91
|
+
...precision === void 0 ? {} : { typeParams: { precision } }
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function timetzColumn(precision) {
|
|
95
|
+
return {
|
|
96
|
+
codecId: PG_TIMETZ_CODEC_ID,
|
|
97
|
+
nativeType: "timetz",
|
|
98
|
+
...precision === void 0 ? {} : { typeParams: { precision } }
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const boolColumn = {
|
|
102
|
+
codecId: PG_BOOL_CODEC_ID,
|
|
103
|
+
nativeType: "bool"
|
|
104
|
+
};
|
|
105
|
+
function bitColumn(length) {
|
|
106
|
+
return {
|
|
107
|
+
codecId: PG_BIT_CODEC_ID,
|
|
108
|
+
nativeType: "bit",
|
|
109
|
+
typeParams: { length }
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function varbitColumn(length) {
|
|
113
|
+
return {
|
|
114
|
+
codecId: PG_VARBIT_CODEC_ID,
|
|
115
|
+
nativeType: "bit varying",
|
|
116
|
+
typeParams: { length }
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function intervalColumn(precision) {
|
|
120
|
+
return {
|
|
121
|
+
codecId: PG_INTERVAL_CODEC_ID,
|
|
122
|
+
nativeType: "interval",
|
|
123
|
+
...precision === void 0 ? {} : { typeParams: { precision } }
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
const jsonColumn = {
|
|
127
|
+
codecId: PG_JSON_CODEC_ID,
|
|
128
|
+
nativeType: "json"
|
|
129
|
+
};
|
|
130
|
+
const jsonbColumn = {
|
|
131
|
+
codecId: PG_JSONB_CODEC_ID,
|
|
132
|
+
nativeType: "jsonb"
|
|
133
|
+
};
|
|
134
|
+
function createJsonTypeParams(schema) {
|
|
135
|
+
const outputSchema = extractStandardSchemaOutputJsonSchema(schema);
|
|
136
|
+
if (!outputSchema) throw new Error("JSON schema must expose ~standard.jsonSchema.output()");
|
|
137
|
+
const expression = extractStandardSchemaTypeExpression(schema);
|
|
138
|
+
if (expression) return {
|
|
139
|
+
schemaJson: outputSchema,
|
|
140
|
+
type: expression
|
|
141
|
+
};
|
|
142
|
+
return { schemaJson: outputSchema };
|
|
143
|
+
}
|
|
144
|
+
function createJsonColumnFactory(codecId, nativeType, staticDescriptor) {
|
|
145
|
+
return (schema) => {
|
|
146
|
+
if (!schema) return staticDescriptor;
|
|
147
|
+
if (!isStandardSchemaLike(schema)) throw new Error(`${nativeType}(schema) expects a Standard Schema value`);
|
|
148
|
+
return {
|
|
149
|
+
codecId,
|
|
150
|
+
nativeType,
|
|
151
|
+
typeParams: createJsonTypeParams(schema)
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
const _json = createJsonColumnFactory(PG_JSON_CODEC_ID, "json", jsonColumn);
|
|
156
|
+
const _jsonb = createJsonColumnFactory(PG_JSONB_CODEC_ID, "jsonb", jsonbColumn);
|
|
157
|
+
function json(schema) {
|
|
158
|
+
return _json(schema);
|
|
159
|
+
}
|
|
160
|
+
function jsonb(schema) {
|
|
161
|
+
return _jsonb(schema);
|
|
162
|
+
}
|
|
163
|
+
function enumType(name, values) {
|
|
164
|
+
return {
|
|
165
|
+
codecId: PG_ENUM_CODEC_ID,
|
|
166
|
+
nativeType: name,
|
|
167
|
+
typeParams: { values }
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function enumColumn(typeName, nativeType) {
|
|
171
|
+
return {
|
|
172
|
+
codecId: PG_ENUM_CODEC_ID,
|
|
173
|
+
nativeType,
|
|
174
|
+
typeRef: typeName
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
//#endregion
|
|
179
|
+
export { bitColumn, boolColumn, charColumn, enumColumn, enumType, float4Column, float8Column, int2Column, int4Column, int8Column, intervalColumn, json, jsonColumn, jsonb, jsonbColumn, numericColumn, textColumn, timeColumn, timestampColumn, timestamptzColumn, timetzColumn, varbitColumn, varcharColumn };
|
|
180
|
+
//# sourceMappingURL=column-types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-types.mjs","names":["textColumn: ColumnTypeDescriptor","int4Column: ColumnTypeDescriptor","int2Column: ColumnTypeDescriptor","int8Column: ColumnTypeDescriptor","float4Column: ColumnTypeDescriptor","float8Column: ColumnTypeDescriptor","timestampColumn: ColumnTypeDescriptor","timestamptzColumn: ColumnTypeDescriptor","boolColumn: ColumnTypeDescriptor","jsonColumn: ColumnTypeDescriptor","jsonbColumn: ColumnTypeDescriptor"],"sources":["../src/core/standard-schema.ts","../src/exports/column-types.ts"],"sourcesContent":["type UnknownRecord = Record<string, unknown>;\n\ntype StandardSchemaJsonSchemaField = {\n readonly output?: unknown;\n};\n\n/**\n * Runtime view of the Standard Schema protocol.\n * Reads `~standard.jsonSchema.output` for the serializable JSON Schema representation,\n * and `.expression` for an optional TypeScript type expression string (Arktype-specific).\n *\n * This differs from the compile-time `StandardSchemaLike` in `codec-types.ts`, which reads\n * `~standard.types.output` for TypeScript type narrowing in contract.d.ts.\n */\nexport type StandardSchemaLike = {\n readonly '~standard'?: {\n readonly version?: number;\n readonly jsonSchema?: StandardSchemaJsonSchemaField;\n };\n readonly expression?: unknown;\n};\n\nfunction isObjectLike(value: unknown): value is UnknownRecord {\n return (typeof value === 'object' || typeof value === 'function') && value !== null;\n}\n\nfunction resolveOutputJsonSchemaField(schema: StandardSchemaLike): unknown {\n const jsonSchema = schema['~standard']?.jsonSchema;\n if (!jsonSchema) {\n return undefined;\n }\n\n if (typeof jsonSchema.output === 'function') {\n return jsonSchema.output({\n target: 'draft-07',\n });\n }\n\n return jsonSchema.output;\n}\n\nexport function extractStandardSchemaOutputJsonSchema(\n schema: StandardSchemaLike,\n): UnknownRecord | undefined {\n const outputSchema = resolveOutputJsonSchemaField(schema);\n if (!isObjectLike(outputSchema)) {\n return undefined;\n }\n\n return outputSchema;\n}\n\nexport function extractStandardSchemaTypeExpression(\n schema: StandardSchemaLike,\n): string | undefined {\n const expression = schema.expression;\n if (typeof expression !== 'string') {\n return undefined;\n }\n\n const trimmedExpression = expression.trim();\n if (trimmedExpression.length === 0) {\n return undefined;\n }\n\n return trimmedExpression;\n}\n\nexport function isStandardSchemaLike(value: unknown): value is StandardSchemaLike {\n return isObjectLike(value) && isObjectLike((value as StandardSchemaLike)['~standard']);\n}\n","/**\n * Column type descriptors for Postgres adapter.\n *\n * These descriptors provide both codecId and nativeType for use in contract authoring.\n * They are derived from the same source of truth as codec definitions and manifests.\n */\n\nimport type { ColumnTypeDescriptor } from '@prisma-next/contract-authoring';\nimport type { StorageTypeInstance } from '@prisma-next/sql-contract/types';\nimport {\n PG_BIT_CODEC_ID,\n PG_BOOL_CODEC_ID,\n PG_ENUM_CODEC_ID,\n PG_FLOAT4_CODEC_ID,\n PG_FLOAT8_CODEC_ID,\n PG_INT2_CODEC_ID,\n PG_INT4_CODEC_ID,\n PG_INT8_CODEC_ID,\n PG_INTERVAL_CODEC_ID,\n PG_JSON_CODEC_ID,\n PG_JSONB_CODEC_ID,\n PG_NUMERIC_CODEC_ID,\n PG_TEXT_CODEC_ID,\n PG_TIME_CODEC_ID,\n PG_TIMESTAMP_CODEC_ID,\n PG_TIMESTAMPTZ_CODEC_ID,\n PG_TIMETZ_CODEC_ID,\n PG_VARBIT_CODEC_ID,\n SQL_CHAR_CODEC_ID,\n SQL_VARCHAR_CODEC_ID,\n} from '../core/codec-ids';\nimport {\n extractStandardSchemaOutputJsonSchema,\n extractStandardSchemaTypeExpression,\n isStandardSchemaLike,\n type StandardSchemaLike,\n} from '../core/standard-schema';\n\nexport const textColumn: ColumnTypeDescriptor = {\n codecId: PG_TEXT_CODEC_ID,\n nativeType: 'text',\n} as const;\n\nexport function charColumn(length: number): ColumnTypeDescriptor & {\n readonly typeParams: { readonly length: number };\n} {\n return {\n codecId: SQL_CHAR_CODEC_ID,\n nativeType: 'character',\n typeParams: { length },\n } as const;\n}\n\nexport function varcharColumn(length: number): ColumnTypeDescriptor & {\n readonly typeParams: { readonly length: number };\n} {\n return {\n codecId: SQL_VARCHAR_CODEC_ID,\n nativeType: 'character varying',\n typeParams: { length },\n } as const;\n}\n\nexport const int4Column: ColumnTypeDescriptor = {\n codecId: PG_INT4_CODEC_ID,\n nativeType: 'int4',\n} as const;\n\nexport const int2Column: ColumnTypeDescriptor = {\n codecId: PG_INT2_CODEC_ID,\n nativeType: 'int2',\n} as const;\n\nexport const int8Column: ColumnTypeDescriptor = {\n codecId: PG_INT8_CODEC_ID,\n nativeType: 'int8',\n} as const;\n\nexport const float4Column: ColumnTypeDescriptor = {\n codecId: PG_FLOAT4_CODEC_ID,\n nativeType: 'float4',\n} as const;\n\nexport const float8Column: ColumnTypeDescriptor = {\n codecId: PG_FLOAT8_CODEC_ID,\n nativeType: 'float8',\n} as const;\n\nexport function numericColumn(\n precision: number,\n scale?: number,\n): ColumnTypeDescriptor & {\n readonly typeParams: { readonly precision: number; readonly scale?: number };\n} {\n return {\n codecId: PG_NUMERIC_CODEC_ID,\n nativeType: 'numeric',\n typeParams: scale === undefined ? { precision } : { precision, scale },\n } as const;\n}\n\nexport const timestampColumn: ColumnTypeDescriptor = {\n codecId: PG_TIMESTAMP_CODEC_ID,\n nativeType: 'timestamp',\n} as const;\n\nexport const timestamptzColumn: ColumnTypeDescriptor = {\n codecId: PG_TIMESTAMPTZ_CODEC_ID,\n nativeType: 'timestamptz',\n} as const;\n\nexport function timeColumn(precision?: number): ColumnTypeDescriptor & {\n readonly typeParams?: { readonly precision: number };\n} {\n return {\n codecId: PG_TIME_CODEC_ID,\n nativeType: 'time',\n ...(precision === undefined ? {} : { typeParams: { precision } }),\n } as const;\n}\n\nexport function timetzColumn(precision?: number): ColumnTypeDescriptor & {\n readonly typeParams?: { readonly precision: number };\n} {\n return {\n codecId: PG_TIMETZ_CODEC_ID,\n nativeType: 'timetz',\n ...(precision === undefined ? {} : { typeParams: { precision } }),\n } as const;\n}\n\nexport const boolColumn: ColumnTypeDescriptor = {\n codecId: PG_BOOL_CODEC_ID,\n nativeType: 'bool',\n} as const;\n\nexport function bitColumn(length: number): ColumnTypeDescriptor & {\n readonly typeParams: { readonly length: number };\n} {\n return {\n codecId: PG_BIT_CODEC_ID,\n nativeType: 'bit',\n typeParams: { length },\n } as const;\n}\n\nexport function varbitColumn(length: number): ColumnTypeDescriptor & {\n readonly typeParams: { readonly length: number };\n} {\n return {\n codecId: PG_VARBIT_CODEC_ID,\n nativeType: 'bit varying',\n typeParams: { length },\n } as const;\n}\n\nexport function intervalColumn(precision?: number): ColumnTypeDescriptor & {\n readonly typeParams?: { readonly precision: number };\n} {\n return {\n codecId: PG_INTERVAL_CODEC_ID,\n nativeType: 'interval',\n ...(precision === undefined ? {} : { typeParams: { precision } }),\n } as const;\n}\n\nexport const jsonColumn: ColumnTypeDescriptor = {\n codecId: PG_JSON_CODEC_ID,\n nativeType: 'json',\n} as const;\n\nexport const jsonbColumn: ColumnTypeDescriptor = {\n codecId: PG_JSONB_CODEC_ID,\n nativeType: 'jsonb',\n} as const;\n\ntype JsonSchemaTypeParams = {\n readonly schemaJson: Record<string, unknown>;\n readonly type?: string;\n};\n\nfunction createJsonTypeParams(schema: StandardSchemaLike): JsonSchemaTypeParams {\n const outputSchema = extractStandardSchemaOutputJsonSchema(schema);\n if (!outputSchema) {\n throw new Error('JSON schema must expose ~standard.jsonSchema.output()');\n }\n\n const expression = extractStandardSchemaTypeExpression(schema);\n if (expression) {\n return { schemaJson: outputSchema, type: expression };\n }\n\n return { schemaJson: outputSchema };\n}\n\n/**\n * Typed column descriptor for JSON/JSONB columns with Standard Schema.\n *\n * `typeParams.schemaJson` carries the runtime JSON Schema payload (serializable record)\n * used by the emitter to render TypeScript type expressions in contract.d.ts.\n *\n * `typeParams.schema` is a phantom-only key: at runtime it does not exist, but at the\n * type level it preserves the original `TSchema` so that `ResolveStandardSchemaOutput<P>`\n * in codec-types.ts can resolve the output type via `~standard.types.output` or `.infer`.\n */\ntype TypedColumnDescriptor<TSchema extends StandardSchemaLike> = ColumnTypeDescriptor & {\n readonly typeParams: JsonSchemaTypeParams & { readonly schema: TSchema };\n};\n\nfunction createJsonColumnFactory(\n codecId: string,\n nativeType: string,\n staticDescriptor: ColumnTypeDescriptor,\n) {\n return <TSchema extends StandardSchemaLike>(schema?: TSchema): ColumnTypeDescriptor => {\n if (!schema) {\n return staticDescriptor;\n }\n\n if (!isStandardSchemaLike(schema)) {\n throw new Error(`${nativeType}(schema) expects a Standard Schema value`);\n }\n\n return {\n codecId,\n nativeType,\n // At runtime, typeParams only contains { schemaJson, type? }.\n // The `schema` key exists only at the type level (phantom) so that\n // `ResolveStandardSchemaOutput<P>` in codec-types.ts can resolve the\n // schema's output type via `~standard.types.output` or `.infer`.\n typeParams: createJsonTypeParams(schema) as JsonSchemaTypeParams & {\n readonly schema: TSchema;\n },\n };\n };\n}\n\nconst _json = createJsonColumnFactory(PG_JSON_CODEC_ID, 'json', jsonColumn);\nconst _jsonb = createJsonColumnFactory(PG_JSONB_CODEC_ID, 'jsonb', jsonbColumn);\n\nexport function json(): ColumnTypeDescriptor;\nexport function json<TSchema extends StandardSchemaLike>(\n schema: TSchema,\n): TypedColumnDescriptor<TSchema>;\nexport function json<TSchema extends StandardSchemaLike>(schema?: TSchema): ColumnTypeDescriptor {\n return _json(schema);\n}\n\nexport function jsonb(): ColumnTypeDescriptor;\nexport function jsonb<TSchema extends StandardSchemaLike>(\n schema: TSchema,\n): TypedColumnDescriptor<TSchema>;\nexport function jsonb<TSchema extends StandardSchemaLike>(schema?: TSchema): ColumnTypeDescriptor {\n return _jsonb(schema);\n}\n\nexport function enumType<const Values extends readonly string[]>(\n name: string,\n values: Values,\n): StorageTypeInstance & { readonly typeParams: { readonly values: Values } } {\n return {\n codecId: PG_ENUM_CODEC_ID,\n nativeType: name,\n typeParams: { values },\n } as const;\n}\n\nexport function enumColumn<TypeName extends string>(\n typeName: TypeName,\n nativeType: string,\n): ColumnTypeDescriptor & { readonly typeRef: TypeName } {\n return {\n codecId: PG_ENUM_CODEC_ID,\n nativeType,\n typeRef: typeName,\n };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { SqlControlAdapterDescriptor } from "@prisma-next/family-sql/control";
|
|
2
|
+
import { ColumnDefault } from "@prisma-next/contract/types";
|
|
3
|
+
|
|
4
|
+
//#region src/core/sql-utils.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Shared SQL utility functions for the Postgres adapter.
|
|
8
|
+
*
|
|
9
|
+
* These functions handle safe SQL identifier and literal escaping
|
|
10
|
+
* with security validations to prevent injection and encoding issues.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Error thrown when an invalid SQL identifier or literal is detected.
|
|
14
|
+
* Boundary layers map this to structured envelopes.
|
|
15
|
+
*/
|
|
16
|
+
declare class SqlEscapeError extends Error {
|
|
17
|
+
readonly value: string;
|
|
18
|
+
readonly kind: 'identifier' | 'literal';
|
|
19
|
+
constructor(message: string, value: string, kind: 'identifier' | 'literal');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Validates and quotes a PostgreSQL identifier (table, column, type, schema names).
|
|
23
|
+
*
|
|
24
|
+
* Security validations:
|
|
25
|
+
* - Rejects null bytes which could cause truncation or unexpected behavior
|
|
26
|
+
* - Rejects empty identifiers
|
|
27
|
+
* - Warns on identifiers exceeding PostgreSQL's 63-character limit
|
|
28
|
+
*
|
|
29
|
+
* @throws {SqlEscapeError} If the identifier contains null bytes or is empty
|
|
30
|
+
*/
|
|
31
|
+
declare function quoteIdentifier(identifier: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Escapes a string literal for safe use in SQL statements.
|
|
34
|
+
*
|
|
35
|
+
* Security validations:
|
|
36
|
+
* - Rejects null bytes which could cause truncation or unexpected behavior
|
|
37
|
+
*
|
|
38
|
+
* Note: This assumes PostgreSQL's `standard_conforming_strings` is ON (default since PG 9.1).
|
|
39
|
+
* Backslashes are treated as literal characters, not escape sequences.
|
|
40
|
+
*
|
|
41
|
+
* @throws {SqlEscapeError} If the value contains null bytes
|
|
42
|
+
*/
|
|
43
|
+
declare function escapeLiteral(value: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Builds a qualified name (schema.object) with proper quoting.
|
|
46
|
+
*/
|
|
47
|
+
declare function qualifyName(schemaName: string, objectName: string): string;
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/core/default-normalizer.d.ts
|
|
50
|
+
/**
|
|
51
|
+
* Parses a raw Postgres column default expression into a normalized ColumnDefault.
|
|
52
|
+
* This enables semantic comparison between contract defaults and introspected schema defaults.
|
|
53
|
+
*
|
|
54
|
+
* Used by the migration diff layer to normalize raw database defaults during comparison,
|
|
55
|
+
* keeping the introspection layer focused on faithful data capture.
|
|
56
|
+
*
|
|
57
|
+
* @param rawDefault - Raw default expression from information_schema.columns.column_default
|
|
58
|
+
* @param nativeType - Native column type, used for type-aware parsing (bigint tagging, JSON detection)
|
|
59
|
+
* @returns Normalized ColumnDefault or undefined if the expression cannot be parsed
|
|
60
|
+
*/
|
|
61
|
+
declare function parsePostgresDefault(rawDefault: string, nativeType?: string): ColumnDefault | undefined;
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/core/control-adapter.d.ts
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Normalizes a Postgres schema native type to its canonical form for comparison.
|
|
67
|
+
*
|
|
68
|
+
* Uses a pre-computed lookup map for simple prefix replacements (O(1))
|
|
69
|
+
* and handles complex temporal type normalization separately.
|
|
70
|
+
*/
|
|
71
|
+
declare function normalizeSchemaNativeType(nativeType: string): string;
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/exports/control.d.ts
|
|
74
|
+
declare const postgresAdapterDescriptor: SqlControlAdapterDescriptor<'postgres'>;
|
|
75
|
+
//#endregion
|
|
76
|
+
export { SqlEscapeError, postgresAdapterDescriptor as default, escapeLiteral, normalizeSchemaNativeType, parsePostgresDefault, qualifyName, quoteIdentifier };
|
|
77
|
+
//# sourceMappingURL=control.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/sql-utils.ts","../src/core/default-normalizer.ts","../src/core/control-adapter.ts","../src/exports/control.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAWA;AA0BA;AAiCA;AAcA;;;cAzEa,cAAA,SAAuB,KAAA;ECuDpB,SAAA,KAAA,EAAA,MAAA;;;;AC0ZhB;;;;ACndgG;;;;;;iBH4BhF,eAAA;;;;;;;;;;;;iBAiCA,aAAA;;;;iBAcA,WAAA;;;;;;AAzEhB;AA0BA;AAiCA;AAcA;;;;AClBA;iBAAgB,oBAAA,2CAGb;;;;;;;;;;iBCuZa,yBAAA;;;cCjdV,2BAA2B"}
|