@prisma-next/adapter-postgres 0.14.0 → 0.15.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-CwkcdpM_.mjs → adapter-Bh8GA6sC.mjs} +4 -3
- package/dist/adapter-Bh8GA6sC.mjs.map +1 -0
- package/dist/adapter.d.mts +1 -1
- package/dist/adapter.d.mts.map +1 -1
- package/dist/adapter.mjs +1 -1
- package/dist/{control-adapter-Dspz5uKp.mjs → control-adapter-aFfSI2bK.mjs} +427 -120
- package/dist/control-adapter-aFfSI2bK.mjs.map +1 -0
- package/dist/control.d.mts +23 -12
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +46 -107
- package/dist/control.mjs.map +1 -1
- package/dist/{descriptor-meta-DOgMfoqm.mjs → descriptor-meta-jMtx881n.mjs} +12 -4
- package/dist/descriptor-meta-jMtx881n.mjs.map +1 -0
- package/dist/runtime.d.mts +1 -1
- package/dist/runtime.mjs +2 -2
- package/dist/runtime.mjs.map +1 -1
- package/dist/{types-KXRwRZU8.d.mts → types-DkGeLfUp.d.mts} +3 -6
- package/dist/types-DkGeLfUp.d.mts.map +1 -0
- package/dist/types.d.mts +1 -1
- package/package.json +26 -25
- package/src/core/adapter.ts +1 -0
- package/src/core/codec-lookup.ts +2 -1
- package/src/core/control-adapter.ts +611 -152
- package/src/core/control-mutation-defaults.ts +61 -190
- package/src/core/descriptor-meta.ts +4 -0
- package/src/core/marker-ledger.ts +15 -0
- package/src/core/sql-renderer.ts +32 -6
- package/src/core/types.ts +2 -3
- package/src/exports/runtime.ts +2 -5
- package/dist/adapter-CwkcdpM_.mjs.map +0 -1
- package/dist/control-adapter-Dspz5uKp.mjs.map +0 -1
- package/dist/descriptor-meta-DOgMfoqm.mjs.map +0 -1
- package/dist/types-KXRwRZU8.d.mts.map +0 -1
package/dist/control.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from "./control-adapter-
|
|
2
|
-
import { t as postgresAdapterDescriptorMeta } from "./descriptor-meta-
|
|
1
|
+
import { r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from "./control-adapter-aFfSI2bK.mjs";
|
|
2
|
+
import { t as postgresAdapterDescriptorMeta } from "./descriptor-meta-jMtx881n.mjs";
|
|
3
3
|
import { parsePostgresDefault } from "@prisma-next/target-postgres/default-normalizer";
|
|
4
4
|
import { normalizeSchemaNativeType } from "@prisma-next/target-postgres/native-type-normalizer";
|
|
5
5
|
import { SqlEscapeError, escapeLiteral, qualifyName, quoteIdentifier } from "@prisma-next/target-postgres/sql-utils";
|
|
6
6
|
import { timestampNowControlDescriptor } from "@prisma-next/family-sql/control";
|
|
7
7
|
import { builtinGeneratorRegistryMetadata, resolveBuiltinGeneratedColumnDescriptor } from "@prisma-next/ids";
|
|
8
|
+
import { int, num, oneOf, optional, str } from "@prisma-next/psl-parser";
|
|
8
9
|
//#region src/core/control-mutation-defaults.ts
|
|
9
10
|
function invalidArgumentDiagnostic(input) {
|
|
10
11
|
return {
|
|
@@ -30,33 +31,7 @@ function executionGenerator(id, params) {
|
|
|
30
31
|
}
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
-
if (input.call.args.length === 0) return;
|
|
35
|
-
return invalidArgumentDiagnostic({
|
|
36
|
-
context: input.context,
|
|
37
|
-
span: input.call.span,
|
|
38
|
-
message: `Default function "${input.call.name}" does not accept arguments. Use ${input.usage}.`
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
function parseIntegerArgument(raw) {
|
|
42
|
-
const trimmed = raw.trim();
|
|
43
|
-
if (!/^-?\d+$/.test(trimmed)) return;
|
|
44
|
-
const value = Number(trimmed);
|
|
45
|
-
if (!Number.isInteger(value)) return;
|
|
46
|
-
return value;
|
|
47
|
-
}
|
|
48
|
-
function parseStringLiteral(raw) {
|
|
49
|
-
const match = raw.trim().match(/^(['"])(.*)\1$/s);
|
|
50
|
-
if (!match) return;
|
|
51
|
-
return match[2] ?? "";
|
|
52
|
-
}
|
|
53
|
-
function lowerAutoincrement(input) {
|
|
54
|
-
const maybeNoArgs = expectNoArgs({
|
|
55
|
-
call: input.call,
|
|
56
|
-
context: input.context,
|
|
57
|
-
usage: "`autoincrement()`"
|
|
58
|
-
});
|
|
59
|
-
if (maybeNoArgs) return maybeNoArgs;
|
|
34
|
+
function lowerAutoincrement() {
|
|
60
35
|
return {
|
|
61
36
|
ok: true,
|
|
62
37
|
value: {
|
|
@@ -68,13 +43,7 @@ function lowerAutoincrement(input) {
|
|
|
68
43
|
}
|
|
69
44
|
};
|
|
70
45
|
}
|
|
71
|
-
function lowerNow(
|
|
72
|
-
const maybeNoArgs = expectNoArgs({
|
|
73
|
-
call: input.call,
|
|
74
|
-
context: input.context,
|
|
75
|
-
usage: "`now()`"
|
|
76
|
-
});
|
|
77
|
-
if (maybeNoArgs) return maybeNoArgs;
|
|
46
|
+
function lowerNow() {
|
|
78
47
|
return {
|
|
79
48
|
ok: true,
|
|
80
49
|
value: {
|
|
@@ -86,83 +55,24 @@ function lowerNow(input) {
|
|
|
86
55
|
}
|
|
87
56
|
};
|
|
88
57
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
if (input.call.args.length !== 1) return invalidArgumentDiagnostic({
|
|
92
|
-
context: input.context,
|
|
93
|
-
span: input.call.span,
|
|
94
|
-
message: "Default function \"uuid\" accepts at most one version argument: `uuid()`, `uuid(4)`, or `uuid(7)`."
|
|
95
|
-
});
|
|
96
|
-
const version = parseIntegerArgument(input.call.args[0]?.raw ?? "");
|
|
97
|
-
if (version === 4) return executionGenerator("uuidv4");
|
|
98
|
-
if (version === 7) return executionGenerator("uuidv7");
|
|
99
|
-
return invalidArgumentDiagnostic({
|
|
100
|
-
context: input.context,
|
|
101
|
-
span: input.call.args[0]?.span ?? input.call.span,
|
|
102
|
-
message: "Default function \"uuid\" supports only `uuid()`, `uuid(4)`, or `uuid(7)` in SQL PSL provider v1."
|
|
103
|
-
});
|
|
58
|
+
function lowerUlid() {
|
|
59
|
+
return executionGenerator("ulid");
|
|
104
60
|
}
|
|
105
|
-
function
|
|
106
|
-
|
|
107
|
-
ok: false,
|
|
108
|
-
diagnostic: {
|
|
109
|
-
code: "PSL_UNKNOWN_DEFAULT_FUNCTION",
|
|
110
|
-
message: "Default function \"cuid()\" is not supported in SQL PSL provider v1. Use `cuid(2)` instead.",
|
|
111
|
-
sourceId: input.context.sourceId,
|
|
112
|
-
span: input.call.span
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
if (input.call.args.length !== 1) return invalidArgumentDiagnostic({
|
|
116
|
-
context: input.context,
|
|
117
|
-
span: input.call.span,
|
|
118
|
-
message: "Default function \"cuid\" accepts exactly one version argument: `cuid(2)`."
|
|
119
|
-
});
|
|
120
|
-
if (parseIntegerArgument(input.call.args[0]?.raw ?? "") === 2) return executionGenerator("cuid2");
|
|
121
|
-
return invalidArgumentDiagnostic({
|
|
122
|
-
context: input.context,
|
|
123
|
-
span: input.call.args[0]?.span ?? input.call.span,
|
|
124
|
-
message: "Default function \"cuid\" supports only `cuid(2)` in SQL PSL provider v1."
|
|
125
|
-
});
|
|
61
|
+
function lowerUuid(input) {
|
|
62
|
+
return input.call.args["version"] === 7 ? executionGenerator("uuidv7") : executionGenerator("uuidv4");
|
|
126
63
|
}
|
|
127
|
-
function
|
|
128
|
-
|
|
129
|
-
call: input.call,
|
|
130
|
-
context: input.context,
|
|
131
|
-
usage: "`ulid()`"
|
|
132
|
-
});
|
|
133
|
-
if (maybeNoArgs) return maybeNoArgs;
|
|
134
|
-
return executionGenerator("ulid");
|
|
64
|
+
function lowerCuid() {
|
|
65
|
+
return executionGenerator("cuid2");
|
|
135
66
|
}
|
|
136
67
|
function lowerNanoid(input) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
context: input.context,
|
|
140
|
-
span: input.call.span,
|
|
141
|
-
message: "Default function \"nanoid\" accepts at most one size argument: `nanoid()` or `nanoid(<2-255>)`."
|
|
142
|
-
});
|
|
143
|
-
const size = parseIntegerArgument(input.call.args[0]?.raw ?? "");
|
|
144
|
-
if (size !== void 0 && size >= 2 && size <= 255) return executionGenerator("nanoid", { size });
|
|
145
|
-
return invalidArgumentDiagnostic({
|
|
146
|
-
context: input.context,
|
|
147
|
-
span: input.call.args[0]?.span ?? input.call.span,
|
|
148
|
-
message: "Default function \"nanoid\" size argument must be an integer between 2 and 255."
|
|
149
|
-
});
|
|
68
|
+
const size = input.call.args["size"];
|
|
69
|
+
return typeof size === "number" ? executionGenerator("nanoid", { size }) : executionGenerator("nanoid");
|
|
150
70
|
}
|
|
151
71
|
function lowerDbgenerated(input) {
|
|
152
|
-
|
|
72
|
+
const expression = input.call.args["expression"];
|
|
73
|
+
if (typeof expression !== "string" || expression.trim().length === 0) return invalidArgumentDiagnostic({
|
|
153
74
|
context: input.context,
|
|
154
75
|
span: input.call.span,
|
|
155
|
-
message: "Default function \"dbgenerated\" requires exactly one string argument: `dbgenerated(\"...\")`."
|
|
156
|
-
});
|
|
157
|
-
const rawExpression = parseStringLiteral(input.call.args[0]?.raw ?? "");
|
|
158
|
-
if (rawExpression === void 0) return invalidArgumentDiagnostic({
|
|
159
|
-
context: input.context,
|
|
160
|
-
span: input.call.args[0]?.span ?? input.call.span,
|
|
161
|
-
message: "Default function \"dbgenerated\" argument must be a string literal."
|
|
162
|
-
});
|
|
163
|
-
if (rawExpression.trim().length === 0) return invalidArgumentDiagnostic({
|
|
164
|
-
context: input.context,
|
|
165
|
-
span: input.call.args[0]?.span ?? input.call.span,
|
|
166
76
|
message: "Default function \"dbgenerated\" argument cannot be empty."
|
|
167
77
|
});
|
|
168
78
|
return {
|
|
@@ -171,21 +81,46 @@ function lowerDbgenerated(input) {
|
|
|
171
81
|
kind: "storage",
|
|
172
82
|
defaultValue: {
|
|
173
83
|
kind: "function",
|
|
174
|
-
expression
|
|
84
|
+
expression
|
|
175
85
|
}
|
|
176
86
|
}
|
|
177
87
|
};
|
|
178
88
|
}
|
|
89
|
+
const nowSig = {};
|
|
90
|
+
const autoincrementSig = {};
|
|
91
|
+
const ulidSig = {};
|
|
92
|
+
const uuidSig = { positional: [{
|
|
93
|
+
key: "version",
|
|
94
|
+
type: optional(oneOf(num(4), num(7)))
|
|
95
|
+
}] };
|
|
96
|
+
const cuidSig = { positional: [{
|
|
97
|
+
key: "version",
|
|
98
|
+
type: num(2)
|
|
99
|
+
}] };
|
|
100
|
+
const nanoidSig = { positional: [{
|
|
101
|
+
key: "size",
|
|
102
|
+
type: optional(int({
|
|
103
|
+
min: 2,
|
|
104
|
+
max: 255
|
|
105
|
+
}))
|
|
106
|
+
}] };
|
|
107
|
+
const dbgeneratedSig = { positional: [{
|
|
108
|
+
key: "expression",
|
|
109
|
+
type: str()
|
|
110
|
+
}] };
|
|
179
111
|
const postgresDefaultFunctionRegistryEntries = [
|
|
180
112
|
["autoincrement", {
|
|
113
|
+
signature: autoincrementSig,
|
|
181
114
|
lower: lowerAutoincrement,
|
|
182
115
|
usageSignatures: ["autoincrement()"]
|
|
183
116
|
}],
|
|
184
117
|
["now", {
|
|
118
|
+
signature: nowSig,
|
|
185
119
|
lower: lowerNow,
|
|
186
120
|
usageSignatures: ["now()"]
|
|
187
121
|
}],
|
|
188
122
|
["uuid", {
|
|
123
|
+
signature: uuidSig,
|
|
189
124
|
lower: lowerUuid,
|
|
190
125
|
usageSignatures: [
|
|
191
126
|
"uuid()",
|
|
@@ -194,23 +129,27 @@ const postgresDefaultFunctionRegistryEntries = [
|
|
|
194
129
|
]
|
|
195
130
|
}],
|
|
196
131
|
["cuid", {
|
|
132
|
+
signature: cuidSig,
|
|
197
133
|
lower: lowerCuid,
|
|
198
134
|
usageSignatures: ["cuid(2)"]
|
|
199
135
|
}],
|
|
200
136
|
["ulid", {
|
|
137
|
+
signature: ulidSig,
|
|
201
138
|
lower: lowerUlid,
|
|
202
139
|
usageSignatures: ["ulid()"]
|
|
203
140
|
}],
|
|
204
141
|
["nanoid", {
|
|
142
|
+
signature: nanoidSig,
|
|
205
143
|
lower: lowerNanoid,
|
|
206
144
|
usageSignatures: ["nanoid()", "nanoid(<2-255>)"]
|
|
207
145
|
}],
|
|
208
146
|
["dbgenerated", {
|
|
147
|
+
signature: dbgeneratedSig,
|
|
209
148
|
lower: lowerDbgenerated,
|
|
210
149
|
usageSignatures: ["dbgenerated(\"...\")"]
|
|
211
150
|
}]
|
|
212
151
|
];
|
|
213
|
-
const postgresScalarTypeDescriptors = new Map([
|
|
152
|
+
const postgresScalarTypeDescriptors = /* @__PURE__ */ new Map([
|
|
214
153
|
["String", "pg/text@1"],
|
|
215
154
|
["Boolean", "pg/bool@1"],
|
|
216
155
|
["Int", "pg/int4@1"],
|
package/dist/control.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.mjs","names":[],"sources":["../src/core/control-mutation-defaults.ts","../src/exports/control.ts"],"sourcesContent":["import type { ExecutionMutationDefaultValue } from '@prisma-next/contract/types';\nimport { timestampNowControlDescriptor } from '@prisma-next/family-sql/control';\nimport type {\n ControlMutationDefaultEntry,\n DefaultFunctionLoweringContext,\n LoweredDefaultResult,\n MutationDefaultGeneratorDescriptor,\n ParsedDefaultFunctionCall,\n} from '@prisma-next/framework-components/control';\nimport {\n builtinGeneratorRegistryMetadata,\n resolveBuiltinGeneratedColumnDescriptor,\n} from '@prisma-next/ids';\n\nfunction invalidArgumentDiagnostic(input: {\n readonly context: DefaultFunctionLoweringContext;\n readonly span: ParsedDefaultFunctionCall['span'];\n readonly message: string;\n}): LoweredDefaultResult {\n return {\n ok: false,\n diagnostic: {\n code: 'PSL_INVALID_DEFAULT_FUNCTION_ARGUMENT',\n message: input.message,\n sourceId: input.context.sourceId,\n span: input.span,\n },\n };\n}\n\nfunction executionGenerator(\n id: ExecutionMutationDefaultValue['id'],\n params?: Record<string, unknown>,\n): LoweredDefaultResult {\n return {\n ok: true,\n value: {\n kind: 'execution',\n generated: {\n kind: 'generator',\n id,\n ...(params ? { params } : {}),\n },\n },\n };\n}\n\nfunction expectNoArgs(input: {\n readonly call: ParsedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n readonly usage: string;\n}): LoweredDefaultResult | undefined {\n if (input.call.args.length === 0) {\n return undefined;\n }\n return invalidArgumentDiagnostic({\n context: input.context,\n span: input.call.span,\n message: `Default function \"${input.call.name}\" does not accept arguments. Use ${input.usage}.`,\n });\n}\n\nfunction parseIntegerArgument(raw: string): number | undefined {\n const trimmed = raw.trim();\n if (!/^-?\\d+$/.test(trimmed)) {\n return undefined;\n }\n const value = Number(trimmed);\n if (!Number.isInteger(value)) {\n return undefined;\n }\n return value;\n}\n\nfunction parseStringLiteral(raw: string): string | undefined {\n const match = raw.trim().match(/^(['\"])(.*)\\1$/s);\n if (!match) {\n return undefined;\n }\n return match[2] ?? '';\n}\n\nfunction lowerAutoincrement(input: {\n readonly call: ParsedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n const maybeNoArgs = expectNoArgs({\n call: input.call,\n context: input.context,\n usage: '`autoincrement()`',\n });\n if (maybeNoArgs) {\n return maybeNoArgs;\n }\n return {\n ok: true,\n value: {\n kind: 'storage',\n defaultValue: {\n kind: 'function',\n expression: 'autoincrement()',\n },\n },\n };\n}\n\nfunction lowerNow(input: {\n readonly call: ParsedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n const maybeNoArgs = expectNoArgs({\n call: input.call,\n context: input.context,\n usage: '`now()`',\n });\n if (maybeNoArgs) {\n return maybeNoArgs;\n }\n return {\n ok: true,\n value: {\n kind: 'storage',\n defaultValue: {\n kind: 'function',\n expression: 'now()',\n },\n },\n };\n}\n\nfunction lowerUuid(input: {\n readonly call: ParsedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n if (input.call.args.length === 0) {\n return executionGenerator('uuidv4');\n }\n if (input.call.args.length !== 1) {\n return invalidArgumentDiagnostic({\n context: input.context,\n span: input.call.span,\n message:\n 'Default function \"uuid\" accepts at most one version argument: `uuid()`, `uuid(4)`, or `uuid(7)`.',\n });\n }\n const version = parseIntegerArgument(input.call.args[0]?.raw ?? '');\n if (version === 4) {\n return executionGenerator('uuidv4');\n }\n if (version === 7) {\n return executionGenerator('uuidv7');\n }\n return invalidArgumentDiagnostic({\n context: input.context,\n span: input.call.args[0]?.span ?? input.call.span,\n message:\n 'Default function \"uuid\" supports only `uuid()`, `uuid(4)`, or `uuid(7)` in SQL PSL provider v1.',\n });\n}\n\nfunction lowerCuid(input: {\n readonly call: ParsedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n if (input.call.args.length === 0) {\n return {\n ok: false,\n diagnostic: {\n code: 'PSL_UNKNOWN_DEFAULT_FUNCTION',\n message:\n 'Default function \"cuid()\" is not supported in SQL PSL provider v1. Use `cuid(2)` instead.',\n sourceId: input.context.sourceId,\n span: input.call.span,\n },\n };\n }\n if (input.call.args.length !== 1) {\n return invalidArgumentDiagnostic({\n context: input.context,\n span: input.call.span,\n message: 'Default function \"cuid\" accepts exactly one version argument: `cuid(2)`.',\n });\n }\n const version = parseIntegerArgument(input.call.args[0]?.raw ?? '');\n if (version === 2) {\n return executionGenerator('cuid2');\n }\n return invalidArgumentDiagnostic({\n context: input.context,\n span: input.call.args[0]?.span ?? input.call.span,\n message: 'Default function \"cuid\" supports only `cuid(2)` in SQL PSL provider v1.',\n });\n}\n\nfunction lowerUlid(input: {\n readonly call: ParsedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n const maybeNoArgs = expectNoArgs({\n call: input.call,\n context: input.context,\n usage: '`ulid()`',\n });\n if (maybeNoArgs) {\n return maybeNoArgs;\n }\n return executionGenerator('ulid');\n}\n\nfunction lowerNanoid(input: {\n readonly call: ParsedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n if (input.call.args.length === 0) {\n return executionGenerator('nanoid');\n }\n if (input.call.args.length !== 1) {\n return invalidArgumentDiagnostic({\n context: input.context,\n span: input.call.span,\n message:\n 'Default function \"nanoid\" accepts at most one size argument: `nanoid()` or `nanoid(<2-255>)`.',\n });\n }\n const size = parseIntegerArgument(input.call.args[0]?.raw ?? '');\n if (size !== undefined && size >= 2 && size <= 255) {\n return executionGenerator('nanoid', { size });\n }\n return invalidArgumentDiagnostic({\n context: input.context,\n span: input.call.args[0]?.span ?? input.call.span,\n message: 'Default function \"nanoid\" size argument must be an integer between 2 and 255.',\n });\n}\n\nfunction lowerDbgenerated(input: {\n readonly call: ParsedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n if (input.call.args.length !== 1) {\n return invalidArgumentDiagnostic({\n context: input.context,\n span: input.call.span,\n message:\n 'Default function \"dbgenerated\" requires exactly one string argument: `dbgenerated(\"...\")`.',\n });\n }\n const rawExpression = parseStringLiteral(input.call.args[0]?.raw ?? '');\n if (rawExpression === undefined) {\n return invalidArgumentDiagnostic({\n context: input.context,\n span: input.call.args[0]?.span ?? input.call.span,\n message: 'Default function \"dbgenerated\" argument must be a string literal.',\n });\n }\n if (rawExpression.trim().length === 0) {\n return invalidArgumentDiagnostic({\n context: input.context,\n span: input.call.args[0]?.span ?? input.call.span,\n message: 'Default function \"dbgenerated\" argument cannot be empty.',\n });\n }\n return {\n ok: true,\n value: {\n kind: 'storage',\n defaultValue: {\n kind: 'function',\n expression: rawExpression,\n },\n },\n };\n}\n\nconst postgresDefaultFunctionRegistryEntries = [\n ['autoincrement', { lower: lowerAutoincrement, usageSignatures: ['autoincrement()'] }],\n ['now', { lower: lowerNow, usageSignatures: ['now()'] }],\n ['uuid', { lower: lowerUuid, usageSignatures: ['uuid()', 'uuid(4)', 'uuid(7)'] }],\n ['cuid', { lower: lowerCuid, usageSignatures: ['cuid(2)'] }],\n ['ulid', { lower: lowerUlid, usageSignatures: ['ulid()'] }],\n ['nanoid', { lower: lowerNanoid, usageSignatures: ['nanoid()', 'nanoid(<2-255>)'] }],\n ['dbgenerated', { lower: lowerDbgenerated, usageSignatures: ['dbgenerated(\"...\")'] }],\n] satisfies ReadonlyArray<readonly [string, ControlMutationDefaultEntry]>;\n\nconst postgresScalarTypeDescriptors = new Map<string, string>([\n ['String', 'pg/text@1'],\n ['Boolean', 'pg/bool@1'],\n ['Int', 'pg/int4@1'],\n ['BigInt', 'pg/int8@1'],\n ['Float', 'pg/float8@1'],\n ['Decimal', 'pg/numeric@1'],\n ['DateTime', 'pg/timestamptz@1'],\n ['Json', 'pg/jsonb@1'],\n ['Bytes', 'pg/bytea@1'],\n]);\n\nexport function createPostgresDefaultFunctionRegistry(): ReadonlyMap<\n string,\n ControlMutationDefaultEntry\n> {\n return new Map(postgresDefaultFunctionRegistryEntries);\n}\n\nexport function createPostgresMutationDefaultGeneratorDescriptors(): readonly MutationDefaultGeneratorDescriptor[] {\n return [\n ...builtinGeneratorRegistryMetadata.map(\n ({ id, applicableCodecIds }): MutationDefaultGeneratorDescriptor => ({\n id,\n applicableCodecIds,\n resolveGeneratedColumnDescriptor: ({ generated }) => {\n if (generated.kind !== 'generator' || generated.id !== id) {\n return undefined;\n }\n const descriptor = resolveBuiltinGeneratedColumnDescriptor({\n id,\n ...(generated.params ? { params: generated.params } : {}),\n });\n return {\n codecId: descriptor.type.codecId,\n nativeType: descriptor.type.nativeType,\n ...(descriptor.type.typeRef ? { typeRef: descriptor.type.typeRef } : {}),\n ...(descriptor.typeParams ? { typeParams: descriptor.typeParams } : {}),\n };\n },\n }),\n ),\n timestampNowControlDescriptor(),\n ];\n}\n\nexport function createPostgresScalarTypeDescriptors(): ReadonlyMap<string, string> {\n return new Map(postgresScalarTypeDescriptors);\n}\n","import type { SqlControlAdapterDescriptor } from '@prisma-next/family-sql/control';\nimport type { SqlControlAdapter } from '@prisma-next/family-sql/control-adapter';\nimport {\n escapeLiteral,\n qualifyName,\n quoteIdentifier,\n SqlEscapeError,\n} from '@prisma-next/target-postgres/sql-utils';\nimport { PostgresControlAdapter } from '../core/control-adapter';\nimport {\n createPostgresDefaultFunctionRegistry,\n createPostgresMutationDefaultGeneratorDescriptors,\n createPostgresScalarTypeDescriptors,\n} from '../core/control-mutation-defaults';\nimport { postgresAdapterDescriptorMeta } from '../core/descriptor-meta';\n\nconst postgresAdapterDescriptor: SqlControlAdapterDescriptor<'postgres'> = {\n ...postgresAdapterDescriptorMeta,\n scalarTypeDescriptors: createPostgresScalarTypeDescriptors(),\n controlMutationDefaults: {\n defaultFunctionRegistry: createPostgresDefaultFunctionRegistry(),\n generatorDescriptors: createPostgresMutationDefaultGeneratorDescriptors(),\n },\n create(stack): SqlControlAdapter<'postgres'> {\n return new PostgresControlAdapter(stack.codecLookup);\n },\n};\n\nexport default postgresAdapterDescriptor;\n\nexport { parsePostgresDefault } from '@prisma-next/target-postgres/default-normalizer';\nexport { normalizeSchemaNativeType } from '@prisma-next/target-postgres/native-type-normalizer';\nexport { createPostgresBuiltinCodecLookup } from '../core/codec-lookup';\nexport { PostgresControlAdapter } from '../core/control-adapter';\nexport { escapeLiteral, qualifyName, quoteIdentifier, SqlEscapeError };\n"],"mappings":";;;;;;;;AAcA,SAAS,0BAA0B,OAIV;CACvB,OAAO;EACL,IAAI;EACJ,YAAY;GACV,MAAM;GACN,SAAS,MAAM;GACf,UAAU,MAAM,QAAQ;GACxB,MAAM,MAAM;EACd;CACF;AACF;AAEA,SAAS,mBACP,IACA,QACsB;CACtB,OAAO;EACL,IAAI;EACJ,OAAO;GACL,MAAM;GACN,WAAW;IACT,MAAM;IACN;IACA,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;GAC7B;EACF;CACF;AACF;AAEA,SAAS,aAAa,OAIe;CACnC,IAAI,MAAM,KAAK,KAAK,WAAW,GAC7B;CAEF,OAAO,0BAA0B;EAC/B,SAAS,MAAM;EACf,MAAM,MAAM,KAAK;EACj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AiB,CAAC,sBAAoB;CAAE,CAAC;AACtF;AAEA,MAAM,gCAAgC,IAAI,IAAoB;CAC5D,CAAC,UAAU,WAAW;CACtB,CAAC,WAAW,WAAW;CACvB,CAAC,OAAO,WAAW;CACnB,CAAC,UAAU,WAAW;CACtB,CAAC,SAAS,aAAa;CACvB,CAAC,WAAW,cAAc;CAC1B,CAAC,YAAY,kBAAkB;CAC/B,CAAC,QAAQ,YAAY;CACrB,CAAC,SAAS,YAAY;AACxB,CAAC;AAED,SAAgB,wCAGd;CACA,OAAO,IAAI,IAAI,sCAAsC;AACvD;AAEA,SAAgB,oDAAmG;CACjH,OAAO,CACL,GAAG,iCAAiC,KACjC,EAAE,IAAI,0BAA8D;EACnE;EACA;EACA,mCAAmC,EAAE,gBAAgB;GACnD,IAAI,UAAU,SAAS,eAAe,UAAU,OAAO,IACrD;GAEF,MAAM,aAAa,wCAAwC;IACzD;IACA,GAAI,UAAU,SAAS,EAAE,QAAQ,UAAU,OAAO,IAAI,CAAC;GACzD,CAAC;GACD,OAAO;IACL,SAAS,WAAW,KAAK;IACzB,YAAY,WAAW,KAAK;IAC5B,GAAI,WAAW,KAAK,UAAU,EAAE,SAAS,WAAW,KAAK,QAAQ,IAAI,CAAC;IACtE,GAAI,WAAW,aAAa,EAAE,YAAY,WAAW,WAAW,IAAI,CAAC;GACvE;EACF;CACF,EACF,GACA,8BAA8B,CAChC;AACF;AAEA,SAAgB,sCAAmE;CACjF,OAAO,IAAI,IAAI,6BAA6B;AAC9C;;;AC5TA,MAAM,4BAAqE;CACzE,GAAG;CACH,uBAAuB,oCAAoC;CAC3D,yBAAyB;EACvB,yBAAyB,sCAAsC;EAC/D,sBAAsB,kDAAkD;CAC1E;CACA,OAAO,OAAsC;EAC3C,OAAO,IAAI,uBAAuB,MAAM,WAAW;CACrD;AACF"}
|
|
1
|
+
{"version":3,"file":"control.mjs","names":[],"sources":["../src/core/control-mutation-defaults.ts","../src/exports/control.ts"],"sourcesContent":["import type { ExecutionMutationDefaultValue } from '@prisma-next/contract/types';\nimport { timestampNowControlDescriptor } from '@prisma-next/family-sql/control';\nimport type {\n ControlMutationDefaultEntry,\n DefaultFunctionLoweringContext,\n LoweredDefaultResult,\n MutationDefaultGeneratorDescriptor,\n TypedDefaultFunctionCall,\n} from '@prisma-next/framework-components/control';\nimport {\n builtinGeneratorRegistryMetadata,\n resolveBuiltinGeneratedColumnDescriptor,\n} from '@prisma-next/ids';\nimport type { FuncCallSig } from '@prisma-next/psl-parser';\nimport { int, num, oneOf, optional, str } from '@prisma-next/psl-parser';\n\nfunction invalidArgumentDiagnostic(input: {\n readonly context: DefaultFunctionLoweringContext;\n readonly span: TypedDefaultFunctionCall['span'];\n readonly message: string;\n}): LoweredDefaultResult {\n return {\n ok: false,\n diagnostic: {\n code: 'PSL_INVALID_DEFAULT_FUNCTION_ARGUMENT',\n message: input.message,\n sourceId: input.context.sourceId,\n span: input.span,\n },\n };\n}\n\nfunction executionGenerator(\n id: ExecutionMutationDefaultValue['id'],\n params?: Record<string, unknown>,\n): LoweredDefaultResult {\n return {\n ok: true,\n value: {\n kind: 'execution',\n generated: {\n kind: 'generator',\n id,\n ...(params ? { params } : {}),\n },\n },\n };\n}\n\nfunction lowerAutoincrement(): LoweredDefaultResult {\n return {\n ok: true,\n value: {\n kind: 'storage',\n defaultValue: { kind: 'function', expression: 'autoincrement()' },\n },\n };\n}\n\nfunction lowerNow(): LoweredDefaultResult {\n return {\n ok: true,\n value: {\n kind: 'storage',\n defaultValue: { kind: 'function', expression: 'now()' },\n },\n };\n}\n\nfunction lowerUlid(): LoweredDefaultResult {\n return executionGenerator('ulid');\n}\n\nfunction lowerUuid(input: {\n readonly call: TypedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n return input.call.args['version'] === 7\n ? executionGenerator('uuidv7')\n : executionGenerator('uuidv4');\n}\n\nfunction lowerCuid(): LoweredDefaultResult {\n return executionGenerator('cuid2');\n}\n\nfunction lowerNanoid(input: {\n readonly call: TypedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n const size = input.call.args['size'];\n return typeof size === 'number'\n ? executionGenerator('nanoid', { size })\n : executionGenerator('nanoid');\n}\n\nfunction lowerDbgenerated(input: {\n readonly call: TypedDefaultFunctionCall;\n readonly context: DefaultFunctionLoweringContext;\n}): LoweredDefaultResult {\n const expression = input.call.args['expression'];\n if (typeof expression !== 'string' || expression.trim().length === 0) {\n return invalidArgumentDiagnostic({\n context: input.context,\n span: input.call.span,\n message: 'Default function \"dbgenerated\" argument cannot be empty.',\n });\n }\n return {\n ok: true,\n value: {\n kind: 'storage',\n defaultValue: { kind: 'function', expression },\n },\n };\n}\n\nconst nowSig: FuncCallSig = {};\nconst autoincrementSig: FuncCallSig = {};\nconst ulidSig: FuncCallSig = {};\nconst uuidSig: FuncCallSig = {\n positional: [{ key: 'version', type: optional(oneOf(num(4), num(7))) }],\n};\nconst cuidSig: FuncCallSig = { positional: [{ key: 'version', type: num(2) }] };\nconst nanoidSig: FuncCallSig = {\n positional: [{ key: 'size', type: optional(int({ min: 2, max: 255 })) }],\n};\nconst dbgeneratedSig: FuncCallSig = { positional: [{ key: 'expression', type: str() }] };\n\nconst postgresDefaultFunctionRegistryEntries = [\n [\n 'autoincrement',\n {\n signature: autoincrementSig,\n lower: lowerAutoincrement,\n usageSignatures: ['autoincrement()'],\n },\n ],\n ['now', { signature: nowSig, lower: lowerNow, usageSignatures: ['now()'] }],\n [\n 'uuid',\n { signature: uuidSig, lower: lowerUuid, usageSignatures: ['uuid()', 'uuid(4)', 'uuid(7)'] },\n ],\n ['cuid', { signature: cuidSig, lower: lowerCuid, usageSignatures: ['cuid(2)'] }],\n ['ulid', { signature: ulidSig, lower: lowerUlid, usageSignatures: ['ulid()'] }],\n [\n 'nanoid',\n { signature: nanoidSig, lower: lowerNanoid, usageSignatures: ['nanoid()', 'nanoid(<2-255>)'] },\n ],\n [\n 'dbgenerated',\n { signature: dbgeneratedSig, lower: lowerDbgenerated, usageSignatures: ['dbgenerated(\"...\")'] },\n ],\n] satisfies ReadonlyArray<readonly [string, ControlMutationDefaultEntry]>;\n\nconst postgresScalarTypeDescriptors = new Map<string, string>([\n ['String', 'pg/text@1'],\n ['Boolean', 'pg/bool@1'],\n ['Int', 'pg/int4@1'],\n ['BigInt', 'pg/int8@1'],\n ['Float', 'pg/float8@1'],\n ['Decimal', 'pg/numeric@1'],\n ['DateTime', 'pg/timestamptz@1'],\n ['Json', 'pg/jsonb@1'],\n ['Bytes', 'pg/bytea@1'],\n]);\n\nexport function createPostgresDefaultFunctionRegistry(): ReadonlyMap<\n string,\n ControlMutationDefaultEntry\n> {\n return new Map(postgresDefaultFunctionRegistryEntries);\n}\n\nexport function createPostgresMutationDefaultGeneratorDescriptors(): readonly MutationDefaultGeneratorDescriptor[] {\n return [\n ...builtinGeneratorRegistryMetadata.map(\n ({ id, applicableCodecIds }): MutationDefaultGeneratorDescriptor => ({\n id,\n applicableCodecIds,\n resolveGeneratedColumnDescriptor: ({ generated }) => {\n if (generated.kind !== 'generator' || generated.id !== id) {\n return undefined;\n }\n const descriptor = resolveBuiltinGeneratedColumnDescriptor({\n id,\n ...(generated.params ? { params: generated.params } : {}),\n });\n return {\n codecId: descriptor.type.codecId,\n nativeType: descriptor.type.nativeType,\n ...(descriptor.type.typeRef ? { typeRef: descriptor.type.typeRef } : {}),\n ...(descriptor.typeParams ? { typeParams: descriptor.typeParams } : {}),\n };\n },\n }),\n ),\n timestampNowControlDescriptor(),\n ];\n}\n\nexport function createPostgresScalarTypeDescriptors(): ReadonlyMap<string, string> {\n return new Map(postgresScalarTypeDescriptors);\n}\n","import type { SqlControlAdapterDescriptor } from '@prisma-next/family-sql/control';\nimport type { SqlControlAdapter } from '@prisma-next/family-sql/control-adapter';\nimport {\n escapeLiteral,\n qualifyName,\n quoteIdentifier,\n SqlEscapeError,\n} from '@prisma-next/target-postgres/sql-utils';\nimport { PostgresControlAdapter } from '../core/control-adapter';\nimport {\n createPostgresDefaultFunctionRegistry,\n createPostgresMutationDefaultGeneratorDescriptors,\n createPostgresScalarTypeDescriptors,\n} from '../core/control-mutation-defaults';\nimport { postgresAdapterDescriptorMeta } from '../core/descriptor-meta';\n\nconst postgresAdapterDescriptor: SqlControlAdapterDescriptor<'postgres'> = {\n ...postgresAdapterDescriptorMeta,\n scalarTypeDescriptors: createPostgresScalarTypeDescriptors(),\n controlMutationDefaults: {\n defaultFunctionRegistry: createPostgresDefaultFunctionRegistry(),\n generatorDescriptors: createPostgresMutationDefaultGeneratorDescriptors(),\n },\n create(stack): SqlControlAdapter<'postgres'> {\n return new PostgresControlAdapter(stack.codecLookup);\n },\n};\n\nexport default postgresAdapterDescriptor;\n\nexport { parsePostgresDefault } from '@prisma-next/target-postgres/default-normalizer';\nexport { normalizeSchemaNativeType } from '@prisma-next/target-postgres/native-type-normalizer';\nexport { createPostgresBuiltinCodecLookup } from '../core/codec-lookup';\nexport { PostgresControlAdapter } from '../core/control-adapter';\nexport { escapeLiteral, qualifyName, quoteIdentifier, SqlEscapeError };\n"],"mappings":";;;;;;;;;AAgBA,SAAS,0BAA0B,OAIV;CACvB,OAAO;EACL,IAAI;EACJ,YAAY;GACV,MAAM;GACN,SAAS,MAAM;GACf,UAAU,MAAM,QAAQ;GACxB,MAAM,MAAM;EACd;CACF;AACF;AAEA,SAAS,mBACP,IACA,QACsB;CACtB,OAAO;EACL,IAAI;EACJ,OAAO;GACL,MAAM;GACN,WAAW;IACT,MAAM;IACN;IACA,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;GAC7B;EACF;CACF;AACF;AAEA,SAAS,qBAA2C;CAClD,OAAO;EACL,IAAI;EACJ,OAAO;GACL,MAAM;GACN,cAAc;IAAE,MAAM;IAAY,YAAY;GAAkB;EAClE;CACF;AACF;AAEA,SAAS,WAAiC;CACxC,OAAO;EACL,IAAI;EACJ,OAAO;GACL,MAAM;GACN,cAAc;IAAE,MAAM;IAAY,YAAY;GAAQ;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YAAY,WAAW,KAAK;IAC5B,GAAI,WAAW,KAAK,UAAU,EAAE,SAAS,WAAW,KAAK,QAAQ,IAAI,CAAC;IACtE,GAAI,WAAW,aAAa,EAAE,YAAY,WAAW,WAAW,IAAI,CAAC;GACvE;EACF;CACF,EACF,GACA,8BAA8B,CAChC;AACF;AAEA,SAAgB,sCAAmE;CACjF,OAAO,IAAI,IAAI,6BAA6B;AAC9C;;;AC3LA,MAAM,4BAAqE;CACzE,GAAG;CACH,uBAAuB,oCAAoC;CAC3D,yBAAyB;EACvB,yBAAyB,sCAAsC;EAC/D,sBAAsB,kDAAkD;CAC1E;CACA,OAAO,OAAsC;EAC3C,OAAO,IAAI,uBAAuB,MAAM,WAAW;CACrD;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { postgresCodecRegistry } from "@prisma-next/target-postgres/codecs";
|
|
2
|
-
import { PG_BIT_CODEC_ID, PG_BOOL_CODEC_ID, PG_BYTEA_CODEC_ID, PG_CHAR_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_FLOAT8_CODEC_ID, PG_FLOAT_CODEC_ID, PG_INT2_CODEC_ID, PG_INT4_CODEC_ID, PG_INT8_CODEC_ID, PG_INTERVAL_CODEC_ID, PG_INT_CODEC_ID, PG_JSONB_CODEC_ID, PG_JSON_CODEC_ID, PG_NUMERIC_CODEC_ID, PG_TEXT_CODEC_ID, PG_TIMESTAMPTZ_CODEC_ID, PG_TIMESTAMP_CODEC_ID, PG_TIMETZ_CODEC_ID, PG_TIME_CODEC_ID, PG_UUID_CODEC_ID, PG_VARBIT_CODEC_ID, PG_VARCHAR_CODEC_ID, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID } from "@prisma-next/target-postgres/codec-ids";
|
|
2
|
+
import { PG_BIT_CODEC_ID, PG_BOOL_CODEC_ID, PG_BYTEA_CODEC_ID, PG_CHAR_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_FLOAT8_CODEC_ID, PG_FLOAT_CODEC_ID, PG_INET_CODEC_ID, PG_INT2_CODEC_ID, PG_INT4_CODEC_ID, PG_INT8_CODEC_ID, PG_INTERVAL_CODEC_ID, PG_INT_CODEC_ID, PG_JSONB_CODEC_ID, PG_JSON_CODEC_ID, PG_NUMERIC_CODEC_ID, PG_TEXT_CODEC_ID, PG_TIMESTAMPTZ_CODEC_ID, PG_TIMESTAMP_CODEC_ID, PG_TIMETZ_CODEC_ID, PG_TIME_CODEC_ID, PG_UUID_CODEC_ID, PG_VARBIT_CODEC_ID, PG_VARCHAR_CODEC_ID, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID } from "@prisma-next/target-postgres/codec-ids";
|
|
3
3
|
import { buildOperation, toExpr } from "@prisma-next/sql-relational-core/expression";
|
|
4
4
|
//#region src/core/descriptor-meta.ts
|
|
5
5
|
/** Creates a type import spec for codec types */
|
|
@@ -86,7 +86,8 @@ const postgresAdapterDescriptorMeta = {
|
|
|
86
86
|
enums: true,
|
|
87
87
|
returning: true,
|
|
88
88
|
defaultInInsert: true,
|
|
89
|
-
lateral: true
|
|
89
|
+
lateral: true,
|
|
90
|
+
scalarList: true
|
|
90
91
|
}
|
|
91
92
|
},
|
|
92
93
|
types: {
|
|
@@ -131,7 +132,8 @@ const postgresAdapterDescriptorMeta = {
|
|
|
131
132
|
[PG_JSON_CODEC_ID]: identityHooks,
|
|
132
133
|
[PG_JSONB_CODEC_ID]: identityHooks,
|
|
133
134
|
[PG_BYTEA_CODEC_ID]: identityHooks,
|
|
134
|
-
[PG_UUID_CODEC_ID]: identityHooks
|
|
135
|
+
[PG_UUID_CODEC_ID]: identityHooks,
|
|
136
|
+
[PG_INET_CODEC_ID]: identityHooks
|
|
135
137
|
}
|
|
136
138
|
},
|
|
137
139
|
storage: [
|
|
@@ -308,6 +310,12 @@ const postgresAdapterDescriptorMeta = {
|
|
|
308
310
|
familyId: "sql",
|
|
309
311
|
targetId: "postgres",
|
|
310
312
|
nativeType: "uuid"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
typeId: PG_INET_CODEC_ID,
|
|
316
|
+
familyId: "sql",
|
|
317
|
+
targetId: "postgres",
|
|
318
|
+
nativeType: "inet"
|
|
311
319
|
}
|
|
312
320
|
],
|
|
313
321
|
queryOperationTypes: { import: {
|
|
@@ -320,4 +328,4 @@ const postgresAdapterDescriptorMeta = {
|
|
|
320
328
|
//#endregion
|
|
321
329
|
export { postgresQueryOperations as n, postgresAdapterDescriptorMeta as t };
|
|
322
330
|
|
|
323
|
-
//# sourceMappingURL=descriptor-meta-
|
|
331
|
+
//# sourceMappingURL=descriptor-meta-jMtx881n.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor-meta-jMtx881n.mjs","names":[],"sources":["../src/core/descriptor-meta.ts"],"sourcesContent":["import type { CodecControlHooks, ExpandNativeTypeInput } from '@prisma-next/family-sql/control';\nimport {\n buildOperation,\n type CodecExpression,\n type Expression,\n type TraitExpression,\n toExpr,\n} from '@prisma-next/sql-relational-core/expression';\nimport {\n PG_BIT_CODEC_ID,\n PG_BOOL_CODEC_ID,\n PG_BYTEA_CODEC_ID,\n PG_CHAR_CODEC_ID,\n PG_FLOAT_CODEC_ID,\n PG_FLOAT4_CODEC_ID,\n PG_FLOAT8_CODEC_ID,\n PG_INET_CODEC_ID,\n PG_INT_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_UUID_CODEC_ID,\n PG_VARBIT_CODEC_ID,\n PG_VARCHAR_CODEC_ID,\n SQL_CHAR_CODEC_ID,\n SQL_FLOAT_CODEC_ID,\n SQL_INT_CODEC_ID,\n SQL_TEXT_CODEC_ID,\n SQL_TIMESTAMP_CODEC_ID,\n SQL_VARCHAR_CODEC_ID,\n} from '@prisma-next/target-postgres/codec-ids';\nimport { postgresCodecRegistry } from '@prisma-next/target-postgres/codecs';\nimport type { QueryOperationTypes } from '../types/operation-types';\n\n// ============================================================================ Helper functions for reducing boilerplate ============================================================================\n\n/** Creates a type import spec for codec types */\nconst codecTypeImport = (named: string) =>\n ({\n package: '@prisma-next/target-postgres/codec-types',\n named,\n alias: named,\n }) as const;\n\nfunction isPositiveInteger(value: unknown): value is number {\n return (\n typeof value === 'number' && Number.isFinite(value) && Number.isInteger(value) && value > 0\n );\n}\n\nfunction isNonNegativeInteger(value: unknown): value is number {\n return (\n typeof value === 'number' && Number.isFinite(value) && Number.isInteger(value) && value >= 0\n );\n}\n\nfunction expandLength({ nativeType, typeParams }: ExpandNativeTypeInput): string {\n if (!typeParams || !('length' in typeParams)) {\n return nativeType;\n }\n const length = typeParams['length'];\n if (!isPositiveInteger(length)) {\n throw new Error(\n `Invalid \"length\" type parameter for \"${nativeType}\": expected a positive integer, got ${JSON.stringify(length)}`,\n );\n }\n return `${nativeType}(${length})`;\n}\n\nfunction expandPrecision({ nativeType, typeParams }: ExpandNativeTypeInput): string {\n if (!typeParams || !('precision' in typeParams)) {\n return nativeType;\n }\n const precision = typeParams['precision'];\n if (!isPositiveInteger(precision)) {\n throw new Error(\n `Invalid \"precision\" type parameter for \"${nativeType}\": expected a positive integer, got ${JSON.stringify(precision)}`,\n );\n }\n return `${nativeType}(${precision})`;\n}\n\nfunction expandNumeric({ nativeType, typeParams }: ExpandNativeTypeInput): string {\n const hasPrecision = typeParams && 'precision' in typeParams;\n const hasScale = typeParams && 'scale' in typeParams;\n\n if (!hasPrecision && !hasScale) {\n return nativeType;\n }\n\n if (!hasPrecision && hasScale) {\n throw new Error(\n `Invalid type parameters for \"${nativeType}\": \"scale\" requires \"precision\" to be specified`,\n );\n }\n\n if (hasPrecision) {\n const precision = typeParams['precision'];\n if (!isPositiveInteger(precision)) {\n throw new Error(\n `Invalid \"precision\" type parameter for \"${nativeType}\": expected a positive integer, got ${JSON.stringify(precision)}`,\n );\n }\n if (hasScale) {\n const scale = typeParams['scale'];\n if (!isNonNegativeInteger(scale)) {\n throw new Error(\n `Invalid \"scale\" type parameter for \"${nativeType}\": expected a non-negative integer, got ${JSON.stringify(scale)}`,\n );\n }\n return `${nativeType}(${precision},${scale})`;\n }\n return `${nativeType}(${precision})`;\n }\n\n return nativeType;\n}\n\nconst lengthHooks: CodecControlHooks = { expandNativeType: expandLength };\nconst precisionHooks: CodecControlHooks = { expandNativeType: expandPrecision };\nconst numericHooks: CodecControlHooks = { expandNativeType: expandNumeric };\nconst identityHooks: CodecControlHooks = { expandNativeType: ({ nativeType }) => nativeType };\n\n// ============================================================================ Descriptor metadata ============================================================================\n\ntype CodecTypesBase = Record<string, { readonly input: unknown; readonly output: unknown }>;\n\nexport function postgresQueryOperations<CT extends CodecTypesBase>(): QueryOperationTypes<CT> {\n return {\n ilike: {\n self: { traits: ['textual'] },\n impl: (\n self: TraitExpression<readonly ['textual'], false, CT>,\n pattern: CodecExpression<'pg/text@1', false, CT>,\n ): Expression<{ codecId: 'pg/bool@1'; nullable: false }> => {\n return buildOperation({\n method: 'ilike',\n args: [toExpr(self), toExpr(pattern, { codecId: PG_TEXT_CODEC_ID })],\n returns: { codecId: PG_BOOL_CODEC_ID, nullable: false },\n lowering: { targetFamily: 'sql', strategy: 'infix', template: '{{self}} ILIKE {{arg0}}' },\n });\n },\n },\n };\n}\n\nexport const postgresAdapterDescriptorMeta = {\n kind: 'adapter',\n familyId: 'sql',\n targetId: 'postgres',\n id: 'postgres',\n version: '0.0.1',\n capabilities: {\n postgres: {\n orderBy: true,\n limit: true,\n lateral: true,\n jsonAgg: true,\n returning: true,\n distinctOn: true,\n },\n sql: {\n enums: true,\n returning: true,\n defaultInInsert: true,\n lateral: true,\n scalarList: true,\n },\n },\n types: {\n codecTypes: {\n codecDescriptors: Array.from(postgresCodecRegistry.values()),\n import: {\n package: '@prisma-next/target-postgres/codec-types',\n named: 'CodecTypes',\n alias: 'PgTypes',\n },\n typeImports: [\n {\n package: '@prisma-next/target-postgres/codec-types',\n named: 'JsonValue',\n alias: 'JsonValue',\n },\n codecTypeImport('Char'),\n codecTypeImport('Varchar'),\n codecTypeImport('Numeric'),\n codecTypeImport('Bit'),\n codecTypeImport('VarBit'),\n codecTypeImport('Timestamp'),\n codecTypeImport('Timestamptz'),\n codecTypeImport('Time'),\n codecTypeImport('Timetz'),\n codecTypeImport('Interval'),\n ],\n controlPlaneHooks: {\n [SQL_CHAR_CODEC_ID]: lengthHooks,\n [SQL_VARCHAR_CODEC_ID]: lengthHooks,\n [SQL_TIMESTAMP_CODEC_ID]: precisionHooks,\n [PG_CHAR_CODEC_ID]: lengthHooks,\n [PG_VARCHAR_CODEC_ID]: lengthHooks,\n [PG_NUMERIC_CODEC_ID]: numericHooks,\n [PG_BIT_CODEC_ID]: lengthHooks,\n [PG_VARBIT_CODEC_ID]: lengthHooks,\n [PG_TIMESTAMP_CODEC_ID]: precisionHooks,\n [PG_TIMESTAMPTZ_CODEC_ID]: precisionHooks,\n [PG_TIME_CODEC_ID]: precisionHooks,\n [PG_TIMETZ_CODEC_ID]: precisionHooks,\n [PG_INTERVAL_CODEC_ID]: precisionHooks,\n [PG_JSON_CODEC_ID]: identityHooks,\n [PG_JSONB_CODEC_ID]: identityHooks,\n [PG_BYTEA_CODEC_ID]: identityHooks,\n [PG_UUID_CODEC_ID]: identityHooks,\n [PG_INET_CODEC_ID]: identityHooks,\n },\n },\n storage: [\n { typeId: PG_TEXT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'text' },\n { typeId: SQL_TEXT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'text' },\n { typeId: SQL_CHAR_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'character' },\n {\n typeId: SQL_VARCHAR_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'character varying',\n },\n { typeId: SQL_INT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'int4' },\n { typeId: SQL_FLOAT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'float8' },\n {\n typeId: SQL_TIMESTAMP_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'timestamp',\n },\n { typeId: PG_CHAR_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'character' },\n {\n typeId: PG_VARCHAR_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'character varying',\n },\n { typeId: PG_INT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'int4' },\n { typeId: PG_FLOAT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'float8' },\n { typeId: PG_INT4_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'int4' },\n { typeId: PG_INT2_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'int2' },\n { typeId: PG_INT8_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'int8' },\n { typeId: PG_FLOAT4_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'float4' },\n { typeId: PG_FLOAT8_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'float8' },\n { typeId: PG_NUMERIC_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'numeric' },\n {\n typeId: PG_TIMESTAMP_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'timestamp',\n },\n {\n typeId: PG_TIMESTAMPTZ_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'timestamptz',\n },\n { typeId: PG_TIME_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'time' },\n { typeId: PG_TIMETZ_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'timetz' },\n { typeId: PG_BOOL_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'bool' },\n { typeId: PG_BIT_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'bit' },\n {\n typeId: PG_VARBIT_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'bit varying',\n },\n {\n typeId: PG_INTERVAL_CODEC_ID,\n familyId: 'sql',\n targetId: 'postgres',\n nativeType: 'interval',\n },\n { typeId: PG_JSON_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'json' },\n { typeId: PG_JSONB_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'jsonb' },\n { typeId: PG_BYTEA_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'bytea' },\n { typeId: PG_UUID_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'uuid' },\n { typeId: PG_INET_CODEC_ID, familyId: 'sql', targetId: 'postgres', nativeType: 'inet' },\n ],\n queryOperationTypes: {\n import: {\n package: '@prisma-next/adapter-postgres/operation-types',\n named: 'QueryOperationTypes',\n alias: 'PgAdapterQueryOps',\n },\n },\n },\n} as const;\n"],"mappings":";;;;;AA8CA,MAAM,mBAAmB,WACtB;CACC,SAAS;CACT;CACA,OAAO;AACT;AAEF,SAAS,kBAAkB,OAAiC;CAC1D,OACE,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,OAAO,UAAU,KAAK,KAAK,QAAQ;AAE9F;AAEA,SAAS,qBAAqB,OAAiC;CAC7D,OACE,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,OAAO,UAAU,KAAK,KAAK,SAAS;AAE/F;AAEA,SAAS,aAAa,EAAE,YAAY,cAA6C;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IACV,UAAU;IACV,YAAY;GACd;GACA;IAAE,QAAQ;IAAkB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAO;GACtF;IAAE,QAAQ;IAAoB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAS;GAC1F;IAAE,QAAQ;IAAkB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAO;GACtF;IAAE,QAAQ;IAAiB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAM;GACpF;IACE,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACd;GACA;IACE,QAAQ;IACR,UAAU;IACV,UAAU;IACV,YAAY;GACd;GACA;IAAE,QAAQ;IAAkB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAO;GACtF;IAAE,QAAQ;IAAmB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAQ;GACxF;IAAE,QAAQ;IAAmB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAQ;GACxF;IAAE,QAAQ;IAAkB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAO;GACtF;IAAE,QAAQ;IAAkB,UAAU;IAAO,UAAU;IAAY,YAAY;GAAO;EACxF;EACA,qBAAqB,EACnB,QAAQ;GACN,SAAS;GACT,OAAO;GACP,OAAO;EACT,EACF;CACF;AACF"}
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as PostgresContract, l as PostgresLoweredStatement } from "./types-
|
|
1
|
+
import { c as PostgresContract, l as PostgresLoweredStatement } from "./types-DkGeLfUp.mjs";
|
|
2
2
|
import { Adapter, AnyQueryAst } from "@prisma-next/sql-relational-core/ast";
|
|
3
3
|
import { SqlRuntimeAdapterDescriptor } from "@prisma-next/sql-runtime";
|
|
4
4
|
import { RuntimeAdapterInstance } from "@prisma-next/framework-components/execution";
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as postgresRawCodecInferer, t as createPostgresAdapter } from "./adapter-
|
|
2
|
-
import { n as postgresQueryOperations, t as postgresAdapterDescriptorMeta } from "./descriptor-meta-
|
|
1
|
+
import { n as postgresRawCodecInferer, t as createPostgresAdapter } from "./adapter-Bh8GA6sC.mjs";
|
|
2
|
+
import { n as postgresQueryOperations, t as postgresAdapterDescriptorMeta } from "./descriptor-meta-jMtx881n.mjs";
|
|
3
3
|
import { extractCodecLookup } from "@prisma-next/framework-components/control";
|
|
4
4
|
import { postgresCodecRegistry } from "@prisma-next/target-postgres/codecs";
|
|
5
5
|
import { builtinGeneratorIds } from "@prisma-next/ids";
|
package/dist/runtime.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.mjs","names":[],"sources":["../src/exports/runtime.ts"],"sourcesContent":["import type { GeneratedValueSpec } from '@prisma-next/contract/types';\nimport { timestampNowRuntimeGenerator } from '@prisma-next/family-sql/runtime';\nimport { extractCodecLookup } from '@prisma-next/framework-components/control';\nimport type { RuntimeAdapterInstance } from '@prisma-next/framework-components/execution';\nimport { builtinGeneratorIds } from '@prisma-next/ids';\nimport { generateId } from '@prisma-next/ids/runtime';\nimport type { Adapter, AnyQueryAst } from '@prisma-next/sql-relational-core/ast';\nimport type { SqlRuntimeAdapterDescriptor } from '@prisma-next/sql-runtime';\nimport { postgresCodecRegistry } from '@prisma-next/target-postgres/codecs';\nimport { createPostgresAdapter, postgresRawCodecInferer } from '../core/adapter';\nimport { postgresAdapterDescriptorMeta, postgresQueryOperations } from '../core/descriptor-meta';\nimport type { PostgresContract, PostgresLoweredStatement } from '../core/types';\n\nexport interface SqlRuntimeAdapter\n extends RuntimeAdapterInstance<'sql', 'postgres'>,\n Adapter<AnyQueryAst, PostgresContract, PostgresLoweredStatement> {}\n\nfunction createPostgresMutationDefaultGenerators() {\n return [\n ...builtinGeneratorIds.map((id) => ({\n id,\n generate: (params?: Record<string, unknown>) => {\n const spec: GeneratedValueSpec = params ? { id, params } : { id };\n return generateId(spec);\n },\n stability: 'field' as const,\n })),\n timestampNowRuntimeGenerator(),\n ];\n}\n\nconst postgresRuntimeAdapterDescriptor: SqlRuntimeAdapterDescriptor<'postgres', SqlRuntimeAdapter> =\n {\n ...postgresAdapterDescriptorMeta,\n codecs: () => Array.from(postgresCodecRegistry.values()),\n queryOperations: () => postgresQueryOperations(),\n mutationDefaultGenerators: createPostgresMutationDefaultGenerators,\n rawCodecInferer: postgresRawCodecInferer,\n create(stack): SqlRuntimeAdapter {\n // The runtime `ExecutionStack` does not (yet) carry a pre-assembled `codecLookup` field the way the control `ControlStack` does, so we derive an equivalent lookup here from the stack's component metadata (target + adapter + extension packs) using the same assembly helper that `createControlStack` uses. This keeps the renderer fed with the same codec set on both planes — including extension-contributed codecs like\n // `pg/vector@1` from `@prisma-next/extension-pgvector`.\n const
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":[],"sources":["../src/exports/runtime.ts"],"sourcesContent":["import type { GeneratedValueSpec } from '@prisma-next/contract/types';\nimport { timestampNowRuntimeGenerator } from '@prisma-next/family-sql/runtime';\nimport { extractCodecLookup } from '@prisma-next/framework-components/control';\nimport type { RuntimeAdapterInstance } from '@prisma-next/framework-components/execution';\nimport { builtinGeneratorIds } from '@prisma-next/ids';\nimport { generateId } from '@prisma-next/ids/runtime';\nimport type { Adapter, AnyQueryAst } from '@prisma-next/sql-relational-core/ast';\nimport type { SqlRuntimeAdapterDescriptor } from '@prisma-next/sql-runtime';\nimport { postgresCodecRegistry } from '@prisma-next/target-postgres/codecs';\nimport { createPostgresAdapter, postgresRawCodecInferer } from '../core/adapter';\nimport { postgresAdapterDescriptorMeta, postgresQueryOperations } from '../core/descriptor-meta';\nimport type { PostgresContract, PostgresLoweredStatement } from '../core/types';\n\nexport interface SqlRuntimeAdapter\n extends RuntimeAdapterInstance<'sql', 'postgres'>,\n Adapter<AnyQueryAst, PostgresContract, PostgresLoweredStatement> {}\n\nfunction createPostgresMutationDefaultGenerators() {\n return [\n ...builtinGeneratorIds.map((id) => ({\n id,\n generate: (params?: Record<string, unknown>) => {\n const spec: GeneratedValueSpec = params ? { id, params } : { id };\n return generateId(spec);\n },\n stability: 'field' as const,\n })),\n timestampNowRuntimeGenerator(),\n ];\n}\n\nconst postgresRuntimeAdapterDescriptor: SqlRuntimeAdapterDescriptor<'postgres', SqlRuntimeAdapter> =\n {\n ...postgresAdapterDescriptorMeta,\n codecs: () => Array.from(postgresCodecRegistry.values()),\n queryOperations: () => postgresQueryOperations(),\n mutationDefaultGenerators: createPostgresMutationDefaultGenerators,\n rawCodecInferer: postgresRawCodecInferer,\n create(stack): SqlRuntimeAdapter {\n // The runtime `ExecutionStack` does not (yet) carry a pre-assembled `codecLookup` field the way the control `ControlStack` does, so we derive an equivalent lookup here from the stack's component metadata (target + adapter + extension packs) using the same assembly helper that `createControlStack` uses. This keeps the renderer fed with the same codec set on both planes — including extension-contributed codecs like\n // `pg/vector@1` from `@prisma-next/extension-pgvector`.\n const components = [stack.target, stack.adapter, ...stack.extensionPacks];\n const codecLookup = extractCodecLookup(components);\n return createPostgresAdapter({ codecLookup });\n },\n };\n\nexport default postgresRuntimeAdapterDescriptor;\n"],"mappings":";;;;;;;;AAiBA,SAAS,0CAA0C;CACjD,OAAO,CACL,GAAG,oBAAoB,KAAK,QAAQ;EAClC;EACA,WAAW,WAAqC;GAE9C,OAAO,WAD0B,SAAS;IAAE;IAAI;GAAO,IAAI,EAAE,GAAG,CAC1C;EACxB;EACA,WAAW;CACb,EAAE,GACF,6BAA6B,CAC/B;AACF;AAEA,MAAM,mCACJ;CACE,GAAG;CACH,cAAc,MAAM,KAAK,sBAAsB,OAAO,CAAC;CACvD,uBAAuB,wBAAwB;CAC/C,2BAA2B;CAC3B,iBAAiB;CACjB,OAAO,OAA0B;EAK/B,OAAO,sBAAsB,EAAE,aADX,mBAAmB;GADnB,MAAM;GAAQ,MAAM;GAAS,GAAG,MAAM;EACV,CACP,EAAE,CAAC;CAC9C;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BinaryExpr, ColumnRef, DefaultValueExpr, Direction, LoweredStatement, ParamRef, SelectAst } from "@prisma-next/sql-relational-core/ast";
|
|
2
|
-
import {
|
|
2
|
+
import { PostgresContract } from "@prisma-next/target-postgres/types";
|
|
3
3
|
import { CodecRegistry } from "@prisma-next/framework-components/codec";
|
|
4
|
-
import {
|
|
4
|
+
import { StorageColumn, StorageTable } from "@prisma-next/sql-contract/types";
|
|
5
5
|
|
|
6
6
|
//#region src/core/types.d.ts
|
|
7
7
|
interface PostgresAdapterOptions {
|
|
@@ -17,9 +17,6 @@ interface PostgresAdapterOptions {
|
|
|
17
17
|
*/
|
|
18
18
|
readonly codecLookup?: CodecRegistry;
|
|
19
19
|
}
|
|
20
|
-
type PostgresContract = Contract<SqlStorage> & {
|
|
21
|
-
readonly target: 'postgres';
|
|
22
|
-
};
|
|
23
20
|
type Expr = ColumnRef | ParamRef | DefaultValueExpr;
|
|
24
21
|
interface OrderClause {
|
|
25
22
|
readonly expr: ColumnRef;
|
|
@@ -28,4 +25,4 @@ interface OrderClause {
|
|
|
28
25
|
type PostgresLoweredStatement = LoweredStatement;
|
|
29
26
|
//#endregion
|
|
30
27
|
export { OrderClause as a, PostgresContract as c, StorageColumn as d, StorageTable as f, Expr as i, PostgresLoweredStatement as l, ColumnRef as n, ParamRef as o, Direction as r, PostgresAdapterOptions as s, BinaryExpr as t, SelectAst as u };
|
|
31
|
-
//# sourceMappingURL=types-
|
|
28
|
+
//# sourceMappingURL=types-DkGeLfUp.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-DkGeLfUp.d.mts","names":[],"sources":["../src/core/types.ts"],"mappings":";;;;;;UAmBiB,sBAAA;EAAA,SACN,SAAA;;AADX;;;;;;;;WAWW,WAAA,GAAc,aAAa;AAAA;AAAA,KAK1B,IAAA,GAAO,SAAA,GAAY,QAAA,GAAW,gBAAA;AAAA,UAEzB,WAAA;EAAA,SACN,IAAA,EAAM,SAAA;EAAA,SACN,GAAA,EAAK,SAAS;AAAA;AAAA,KAGb,wBAAA,GAA2B,gBAAgB"}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as OrderClause, c as PostgresContract, d as StorageColumn, f as StorageTable, i as Expr, l as PostgresLoweredStatement, n as ColumnRef, o as ParamRef, r as Direction, s as PostgresAdapterOptions, t as BinaryExpr, u as SelectAst } from "./types-
|
|
1
|
+
import { a as OrderClause, c as PostgresContract, d as StorageColumn, f as StorageTable, i as Expr, l as PostgresLoweredStatement, n as ColumnRef, o as ParamRef, r as Direction, s as PostgresAdapterOptions, t as BinaryExpr, u as SelectAst } from "./types-DkGeLfUp.mjs";
|
|
2
2
|
export type { BinaryExpr, ColumnRef, Direction, Expr, OrderClause, ParamRef, PostgresAdapterOptions, PostgresContract, PostgresLoweredStatement, SelectAst, StorageColumn, StorageTable };
|
package/package.json
CHANGED
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/adapter-postgres",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0-dev.10",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@prisma-next/contract": "0.
|
|
9
|
-
"@prisma-next/contract-authoring": "0.
|
|
10
|
-
"@prisma-next/errors": "0.
|
|
11
|
-
"@prisma-next/family-sql": "0.
|
|
12
|
-
"@prisma-next/framework-components": "0.
|
|
13
|
-
"@prisma-next/ids": "0.
|
|
14
|
-
"@prisma-next/
|
|
15
|
-
"@prisma-next/sql-contract
|
|
16
|
-
"@prisma-next/sql-contract-
|
|
17
|
-
"@prisma-next/sql-
|
|
18
|
-
"@prisma-next/sql-
|
|
19
|
-
"@prisma-next/sql-
|
|
20
|
-
"@prisma-next/sql-
|
|
21
|
-
"@prisma-next/
|
|
22
|
-
"@prisma-next/
|
|
23
|
-
"
|
|
8
|
+
"@prisma-next/contract": "0.15.0-dev.10",
|
|
9
|
+
"@prisma-next/contract-authoring": "0.15.0-dev.10",
|
|
10
|
+
"@prisma-next/errors": "0.15.0-dev.10",
|
|
11
|
+
"@prisma-next/family-sql": "0.15.0-dev.10",
|
|
12
|
+
"@prisma-next/framework-components": "0.15.0-dev.10",
|
|
13
|
+
"@prisma-next/ids": "0.15.0-dev.10",
|
|
14
|
+
"@prisma-next/psl-parser": "0.15.0-dev.10",
|
|
15
|
+
"@prisma-next/sql-contract": "0.15.0-dev.10",
|
|
16
|
+
"@prisma-next/sql-contract-psl": "0.15.0-dev.10",
|
|
17
|
+
"@prisma-next/sql-contract-ts": "0.15.0-dev.10",
|
|
18
|
+
"@prisma-next/sql-operations": "0.15.0-dev.10",
|
|
19
|
+
"@prisma-next/sql-relational-core": "0.15.0-dev.10",
|
|
20
|
+
"@prisma-next/sql-runtime": "0.15.0-dev.10",
|
|
21
|
+
"@prisma-next/sql-schema-ir": "0.15.0-dev.10",
|
|
22
|
+
"@prisma-next/target-postgres": "0.15.0-dev.10",
|
|
23
|
+
"@prisma-next/utils": "0.15.0-dev.10",
|
|
24
|
+
"arktype": "^2.2.2"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
|
-
"@prisma-next/cli": "0.
|
|
27
|
-
"@prisma-next/driver-postgres": "0.
|
|
28
|
-
"@prisma-next/migration-tools": "0.
|
|
29
|
-
"@prisma-next/test-utils": "0.
|
|
30
|
-
"@prisma-next/tsconfig": "0.
|
|
31
|
-
"@prisma-next/tsdown": "0.
|
|
27
|
+
"@prisma-next/cli": "0.15.0-dev.10",
|
|
28
|
+
"@prisma-next/driver-postgres": "0.15.0-dev.10",
|
|
29
|
+
"@prisma-next/migration-tools": "0.15.0-dev.10",
|
|
30
|
+
"@prisma-next/test-utils": "0.15.0-dev.10",
|
|
31
|
+
"@prisma-next/tsconfig": "0.15.0-dev.10",
|
|
32
|
+
"@prisma-next/tsdown": "0.15.0-dev.10",
|
|
32
33
|
"pathe": "^2.0.3",
|
|
33
|
-
"tsdown": "0.22.
|
|
34
|
+
"tsdown": "0.22.3",
|
|
34
35
|
"typescript": "5.9.3",
|
|
35
|
-
"vitest": "4.1.
|
|
36
|
+
"vitest": "4.1.10"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
38
39
|
"typescript": ">=5.9"
|
package/src/core/adapter.ts
CHANGED
package/src/core/codec-lookup.ts
CHANGED
|
@@ -10,10 +10,11 @@ import { postgresCodecRegistry } from '@prisma-next/target-postgres/codecs';
|
|
|
10
10
|
* Extension codecs (e.g. `pg/vector@1` from `@prisma-next/extension-pgvector`) are intentionally NOT included here: a bare adapter cannot see extensions. Stack-composed paths (`SqlControlAdapterDescriptor.create(stack)` / `SqlRuntimeAdapterDescriptor.create(stack)`) supply the broader, extension-inclusive registry at construction time.
|
|
11
11
|
*/
|
|
12
12
|
export function createPostgresBuiltinCodecLookup(): CodecRegistry {
|
|
13
|
+
const descriptors = Array.from(postgresCodecRegistry.values());
|
|
13
14
|
return extractCodecLookup([
|
|
14
15
|
{
|
|
15
16
|
id: 'postgres-builtin-codecs',
|
|
16
|
-
types: { codecTypes: { codecDescriptors:
|
|
17
|
+
types: { codecTypes: { codecDescriptors: descriptors } },
|
|
17
18
|
},
|
|
18
19
|
]);
|
|
19
20
|
}
|