prisma-ltree 0.4.0 → 0.6.0
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/README.md +11 -11
- package/dist/{codec-types-ECy3aUGO.d.mts → codec-types-Ba5cQ3bc.d.mts} +19 -19
- package/dist/codec-types-Ba5cQ3bc.d.mts.map +1 -0
- package/dist/codec-types.d.mts +1 -1
- package/dist/column-types.d.mts.map +1 -1
- package/dist/column-types.mjs +3 -9
- package/dist/column-types.mjs.map +1 -1
- package/dist/constants-Dfknw-h5.mjs +9 -0
- package/dist/constants-Dfknw-h5.mjs.map +1 -0
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +250 -27
- package/dist/control.mjs.map +1 -1
- package/dist/{descriptor-meta-D2gu1NKP.mjs → descriptor-meta-Cc6tmP54.mjs} +106 -62
- package/dist/descriptor-meta-Cc6tmP54.mjs.map +1 -0
- package/dist/pack.d.mts +4 -14
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/runtime.mjs +2 -1
- package/dist/runtime.mjs.map +1 -1
- package/package.json +11 -10
- package/src/contract.d.ts +109 -24
- package/src/contract.json +28 -5
- package/src/contract.ts +22 -10
- package/src/core/authoring.ts +2 -3
- package/src/core/codecs-validation.ts +31 -0
- package/src/core/codecs.ts +39 -76
- package/src/core/contract-space-constants.ts +11 -2
- package/src/core/data-types.ts +75 -0
- package/src/core/descriptor-meta.ts +12 -28
- package/src/exports/column-types.ts +0 -3
- package/src/exports/control.ts +36 -2
- package/src/exports/runtime.ts +1 -0
- package/dist/codec-types-ECy3aUGO.d.mts.map +0 -1
- package/dist/contract-space-constants-Da9EC668.mjs +0 -15
- package/dist/contract-space-constants-Da9EC668.mjs.map +0 -1
- package/dist/descriptor-meta-D2gu1NKP.mjs.map +0 -1
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as LTREE_MAX_LABEL_LENGTH, n as LTREE_CODEC_ID, r as LTREE_MAX_LABELS, t as LTREE_ARRAY_CODEC_ID } from "./constants-Dfknw-h5.mjs";
|
|
2
2
|
import { buildOperation, codecOf, toExpr } from "@prisma/orm-family-sql/relational-core/expression";
|
|
3
|
+
import { CodecImpl, refuseJsonValue } from "@prisma/orm-framework/components/codec";
|
|
4
|
+
import { sqlDataType } from "@prisma/orm-family-sql/contract/data-type";
|
|
5
|
+
import { pgText } from "@prisma/orm-target-postgres/target/data-types";
|
|
3
6
|
import { buildCodecDescriptorRegistry } from "@prisma/orm-family-sql/relational-core/codec-descriptor-registry";
|
|
4
|
-
import {
|
|
7
|
+
import { CastExpr } from "@prisma/orm-family-sql/relational-core/ast";
|
|
5
8
|
import { PostgresCodecDescriptor, definePostgresCodecs } from "@prisma/orm-target-postgres/target/codec-descriptor";
|
|
6
9
|
//#region src/core/authoring.ts
|
|
7
10
|
const ltreeAuthoringTypes = { ltree: {
|
|
8
11
|
Ltree: {
|
|
9
12
|
kind: "typeConstructor",
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
nativeType: LTREE_NATIVE_TYPE
|
|
13
|
-
}
|
|
13
|
+
inferred: true,
|
|
14
|
+
output: { codecId: LTREE_CODEC_ID }
|
|
14
15
|
},
|
|
15
16
|
LtreeArray: {
|
|
16
17
|
kind: "typeConstructor",
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
nativeType: LTREE_ARRAY_NATIVE_TYPE
|
|
20
|
-
}
|
|
18
|
+
inferred: true,
|
|
19
|
+
output: { codecId: LTREE_ARRAY_CODEC_ID }
|
|
21
20
|
}
|
|
22
21
|
} };
|
|
23
22
|
//#endregion
|
|
24
|
-
//#region src/core/codecs.ts
|
|
23
|
+
//#region src/core/codecs-validation.ts
|
|
25
24
|
const LABEL_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
26
25
|
function assertValidLtree(value) {
|
|
27
26
|
if (typeof value !== "string") throw new Error("ltree value must be a string");
|
|
@@ -34,34 +33,93 @@ function assertValidLtree(value) {
|
|
|
34
33
|
if (!LABEL_PATTERN.test(label)) throw new Error(`ltree label "${label}" contains invalid characters; allowed: alphanumeric, underscore, hyphen`);
|
|
35
34
|
}
|
|
36
35
|
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/core/data-types.ts
|
|
38
|
+
const readLtree = (json) => {
|
|
39
|
+
if (typeof json !== "string") return refuseJsonValue("ltree/ltree", "an ltree path string", json);
|
|
40
|
+
try {
|
|
41
|
+
assertValidLtree(json);
|
|
42
|
+
} catch {
|
|
43
|
+
return refuseJsonValue("ltree/ltree", "a valid ltree path string", json);
|
|
44
|
+
}
|
|
45
|
+
return json;
|
|
46
|
+
};
|
|
47
|
+
const ltreeDataType = sqlDataType("ltree/ltree", {
|
|
48
|
+
read: readLtree,
|
|
49
|
+
texts: [{
|
|
50
|
+
text: "ltree",
|
|
51
|
+
written: true,
|
|
52
|
+
catalog: true
|
|
53
|
+
}],
|
|
54
|
+
casts: { [pgText.id]: (value) => value }
|
|
55
|
+
});
|
|
56
|
+
const readLtreeArray = (json) => {
|
|
57
|
+
const expected = "an array of ltree path strings";
|
|
58
|
+
if (!Array.isArray(json)) return refuseJsonValue("ltree/ltree-array", expected, json);
|
|
59
|
+
for (const entry of json) {
|
|
60
|
+
if (typeof entry !== "string") return refuseJsonValue("ltree/ltree-array", expected, entry);
|
|
61
|
+
try {
|
|
62
|
+
assertValidLtree(entry);
|
|
63
|
+
} catch {
|
|
64
|
+
return refuseJsonValue("ltree/ltree-array", expected, entry);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return json;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* `sqlDataType` accepts parentheses in a type name and refuses square brackets.
|
|
71
|
+
* PostgreSQL writes this type as `ltree[]`, and `format_type` reports `ltree[]`.
|
|
72
|
+
* Declare the type first, then set that text so a migration and a catalog check use it.
|
|
73
|
+
*/
|
|
74
|
+
const ltreeArrayDeclared = sqlDataType("ltree/ltree-array", {
|
|
75
|
+
read: readLtreeArray,
|
|
76
|
+
listCast: {
|
|
77
|
+
of: [pgText.id],
|
|
78
|
+
cast: (elements) => [...elements]
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const ltreeArrayDataType = {
|
|
82
|
+
...ltreeArrayDeclared,
|
|
83
|
+
sql: {
|
|
84
|
+
...ltreeArrayDeclared.sql,
|
|
85
|
+
texts: [{
|
|
86
|
+
text: "ltree[]",
|
|
87
|
+
written: true,
|
|
88
|
+
catalog: true
|
|
89
|
+
}]
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const ltreeDataTypes = [ltreeDataType, ltreeArrayDataType];
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/core/codecs.ts
|
|
37
95
|
var LtreeCodec = class extends CodecImpl {
|
|
38
|
-
|
|
96
|
+
constructor(descriptor) {
|
|
97
|
+
super(descriptor, ltreeDataType);
|
|
98
|
+
}
|
|
99
|
+
async toWire(value, _ctx) {
|
|
39
100
|
assertValidLtree(value);
|
|
40
101
|
return value;
|
|
41
102
|
}
|
|
42
|
-
async
|
|
103
|
+
async fromWire(wire, _ctx) {
|
|
43
104
|
return wire;
|
|
44
105
|
}
|
|
45
|
-
|
|
106
|
+
toDataTypeValue(value) {
|
|
46
107
|
assertValidLtree(value);
|
|
47
|
-
return value;
|
|
108
|
+
return this.dataTypeValueOf(value);
|
|
48
109
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return json;
|
|
110
|
+
fromDataTypeValue(value) {
|
|
111
|
+
return value.value;
|
|
52
112
|
}
|
|
53
113
|
};
|
|
54
114
|
var LtreeDescriptor = class extends PostgresCodecDescriptor {
|
|
55
|
-
|
|
56
|
-
return LTREE_NATIVE_TYPE;
|
|
57
|
-
}
|
|
115
|
+
jsonType = "string";
|
|
58
116
|
jsonProjection(expression) {
|
|
59
|
-
return expression;
|
|
117
|
+
return CastExpr.as(expression, "text");
|
|
60
118
|
}
|
|
119
|
+
dataType = ltreeDataType.id;
|
|
61
120
|
codecId = LTREE_CODEC_ID;
|
|
62
121
|
traits = ["equality", "order"];
|
|
63
|
-
|
|
64
|
-
paramsSchema = voidParamsSchema;
|
|
122
|
+
paramsSchema = void 0;
|
|
65
123
|
renderOutputType() {
|
|
66
124
|
return "string";
|
|
67
125
|
}
|
|
@@ -72,36 +130,35 @@ var LtreeDescriptor = class extends PostgresCodecDescriptor {
|
|
|
72
130
|
};
|
|
73
131
|
const ltreeDescriptor = new LtreeDescriptor();
|
|
74
132
|
var LtreeArrayCodec = class extends CodecImpl {
|
|
75
|
-
|
|
133
|
+
constructor(descriptor) {
|
|
134
|
+
super(descriptor, ltreeArrayDataType);
|
|
135
|
+
}
|
|
136
|
+
async toWire(value, _ctx) {
|
|
76
137
|
for (const entry of value) assertValidLtree(entry);
|
|
77
138
|
return value;
|
|
78
139
|
}
|
|
79
|
-
async
|
|
140
|
+
async fromWire(wire, _ctx) {
|
|
80
141
|
return wire;
|
|
81
142
|
}
|
|
82
|
-
|
|
143
|
+
toDataTypeValue(value) {
|
|
83
144
|
for (const entry of value) assertValidLtree(entry);
|
|
84
|
-
return [...value];
|
|
145
|
+
return this.dataTypeValueOf([...value]);
|
|
85
146
|
}
|
|
86
|
-
|
|
147
|
+
fromDataTypeValue(value) {
|
|
148
|
+
const json = value.value;
|
|
87
149
|
if (!Array.isArray(json)) return [];
|
|
88
|
-
return json.map((entry) =>
|
|
89
|
-
assertValidLtree(entry);
|
|
90
|
-
return String(entry);
|
|
91
|
-
});
|
|
150
|
+
return json.map((entry) => String(entry));
|
|
92
151
|
}
|
|
93
152
|
};
|
|
94
153
|
var LtreeArrayDescriptor = class extends PostgresCodecDescriptor {
|
|
95
|
-
|
|
96
|
-
return LTREE_ARRAY_NATIVE_TYPE;
|
|
97
|
-
}
|
|
154
|
+
jsonType = "array";
|
|
98
155
|
jsonProjection(expression) {
|
|
99
156
|
return expression;
|
|
100
157
|
}
|
|
158
|
+
dataType = ltreeArrayDataType.id;
|
|
101
159
|
codecId = LTREE_ARRAY_CODEC_ID;
|
|
102
160
|
traits = ["equality"];
|
|
103
|
-
|
|
104
|
-
paramsSchema = voidParamsSchema;
|
|
161
|
+
paramsSchema = void 0;
|
|
105
162
|
renderOutputType() {
|
|
106
163
|
return "readonly string[]";
|
|
107
164
|
}
|
|
@@ -136,7 +193,6 @@ const TEXT_RETURN = {
|
|
|
136
193
|
nullable: false
|
|
137
194
|
};
|
|
138
195
|
const TEXT_CODEC_ID = "pg/text@1";
|
|
139
|
-
const TEXT_ARRAY_CODEC_ID = "pg/text-array@1";
|
|
140
196
|
const INT_CODEC_ID = "pg/int4@1";
|
|
141
197
|
/**
|
|
142
198
|
* Build a function-style operation whose SQL is `fnName(self, arg0, arg1, ...)`.
|
|
@@ -153,7 +209,6 @@ function funcOp(method, fnName, returns, args) {
|
|
|
153
209
|
returns,
|
|
154
210
|
lowering: {
|
|
155
211
|
targetFamily: "sql",
|
|
156
|
-
strategy: "function",
|
|
157
212
|
template: `${fnName}(${args.map((_, i) => i === 0 ? "{{self}}" : `{{arg${i - 1}}}`).join(", ")})`
|
|
158
213
|
}
|
|
159
214
|
});
|
|
@@ -167,19 +222,20 @@ function ltreeQueryOperations() {
|
|
|
167
222
|
returns: BOOL_RETURN,
|
|
168
223
|
lowering: {
|
|
169
224
|
targetFamily: "sql",
|
|
170
|
-
strategy: "function",
|
|
171
225
|
template: `{{self}} ${operator} {{arg0}}`
|
|
172
226
|
}
|
|
173
227
|
});
|
|
174
228
|
};
|
|
175
|
-
const patternOp = (method, operator, castType,
|
|
229
|
+
const patternOp = (method, operator, castType, self, arg, many = false) => {
|
|
176
230
|
return buildOperation({
|
|
177
231
|
method,
|
|
178
|
-
args: [toExpr(self, codecOf(self)), toExpr(arg,
|
|
232
|
+
args: [toExpr(self, codecOf(self)), toExpr(arg, many ? {
|
|
233
|
+
codecId: TEXT_CODEC_ID,
|
|
234
|
+
many: true
|
|
235
|
+
} : { codecId: TEXT_CODEC_ID })],
|
|
179
236
|
returns: BOOL_RETURN,
|
|
180
237
|
lowering: {
|
|
181
238
|
targetFamily: "sql",
|
|
182
|
-
strategy: "function",
|
|
183
239
|
template: `{{self}} ${operator} ({{arg0}})::${castType}`
|
|
184
240
|
}
|
|
185
241
|
});
|
|
@@ -190,7 +246,6 @@ function ltreeQueryOperations() {
|
|
|
190
246
|
returns: LTREE_RETURN,
|
|
191
247
|
lowering: {
|
|
192
248
|
targetFamily: "sql",
|
|
193
|
-
strategy: "function",
|
|
194
249
|
template
|
|
195
250
|
}
|
|
196
251
|
});
|
|
@@ -203,7 +258,6 @@ function ltreeQueryOperations() {
|
|
|
203
258
|
returns: LTREE_RETURN,
|
|
204
259
|
lowering: {
|
|
205
260
|
targetFamily: "sql",
|
|
206
|
-
strategy: "function",
|
|
207
261
|
template
|
|
208
262
|
}
|
|
209
263
|
});
|
|
@@ -219,15 +273,15 @@ function ltreeQueryOperations() {
|
|
|
219
273
|
},
|
|
220
274
|
matchesLquery: {
|
|
221
275
|
self: { codecId: LTREE_CODEC_ID },
|
|
222
|
-
impl: (self, pattern) => patternOp("matchesLquery", "~", "lquery",
|
|
276
|
+
impl: (self, pattern) => patternOp("matchesLquery", "~", "lquery", self, pattern)
|
|
223
277
|
},
|
|
224
278
|
matchesLqueryArray: {
|
|
225
279
|
self: { codecId: LTREE_CODEC_ID },
|
|
226
|
-
impl: (self, patterns) => patternOp("matchesLqueryArray", "?", "lquery[]",
|
|
280
|
+
impl: (self, patterns) => patternOp("matchesLqueryArray", "?", "lquery[]", self, patterns, true)
|
|
227
281
|
},
|
|
228
282
|
matchesLtxtquery: {
|
|
229
283
|
self: { codecId: LTREE_CODEC_ID },
|
|
230
|
-
impl: (self, query) => patternOp("matchesLtxtquery", "@", "ltxtquery",
|
|
284
|
+
impl: (self, query) => patternOp("matchesLtxtquery", "@", "ltxtquery", self, query)
|
|
231
285
|
},
|
|
232
286
|
nlevel: {
|
|
233
287
|
self: { codecId: LTREE_CODEC_ID },
|
|
@@ -320,6 +374,7 @@ const ltreePackMeta = {
|
|
|
320
374
|
version: "0.1.0",
|
|
321
375
|
capabilities: { postgres: { "ltree.path": true } },
|
|
322
376
|
authoring: { type: ltreeAuthoringTypes },
|
|
377
|
+
dataTypes: ltreeDataTypes,
|
|
323
378
|
types: {
|
|
324
379
|
codecTypes: {
|
|
325
380
|
codecDescriptors: Array.from(ltreeCodecRegistry.values()),
|
|
@@ -338,21 +393,10 @@ const ltreePackMeta = {
|
|
|
338
393
|
package: "prisma-ltree/operation-types",
|
|
339
394
|
named: "QueryOperationTypes",
|
|
340
395
|
alias: "LtreeQueryOperationTypes"
|
|
341
|
-
} }
|
|
342
|
-
storage: [{
|
|
343
|
-
typeId: LTREE_CODEC_ID,
|
|
344
|
-
familyId: "sql",
|
|
345
|
-
targetId: "postgres",
|
|
346
|
-
nativeType: LTREE_NATIVE_TYPE
|
|
347
|
-
}, {
|
|
348
|
-
typeId: LTREE_ARRAY_CODEC_ID,
|
|
349
|
-
familyId: "sql",
|
|
350
|
-
targetId: "postgres",
|
|
351
|
-
nativeType: LTREE_ARRAY_NATIVE_TYPE
|
|
352
|
-
}]
|
|
396
|
+
} }
|
|
353
397
|
}
|
|
354
398
|
};
|
|
355
399
|
//#endregion
|
|
356
400
|
export { ltreeQueryOperations as n, ltreeCodecRegistry as r, ltreePackMeta as t };
|
|
357
401
|
|
|
358
|
-
//# sourceMappingURL=descriptor-meta-
|
|
402
|
+
//# sourceMappingURL=descriptor-meta-Cc6tmP54.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor-meta-Cc6tmP54.mjs","names":[],"sources":["../src/core/authoring.ts","../src/core/codecs-validation.ts","../src/core/data-types.ts","../src/core/codecs.ts","../src/core/registry.ts","../src/core/descriptor-meta.ts"],"sourcesContent":["import type { AuthoringTypeNamespace } from \"@prisma/orm-framework/components/authoring\";\nimport { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from \"./constants\";\n\nexport const ltreeAuthoringTypes = {\n ltree: {\n Ltree: {\n kind: \"typeConstructor\",\n inferred: true,\n output: {\n codecId: LTREE_CODEC_ID,\n },\n },\n LtreeArray: {\n kind: \"typeConstructor\",\n inferred: true,\n output: {\n codecId: LTREE_ARRAY_CODEC_ID,\n },\n },\n },\n} as const satisfies AuthoringTypeNamespace;\n","import { LTREE_MAX_LABEL_LENGTH, LTREE_MAX_LABELS } from \"./constants\";\n\nconst LABEL_PATTERN = /^[A-Za-z0-9_-]+$/;\n\nexport function assertValidLtree(value: unknown): asserts value is string {\n if (typeof value !== \"string\") {\n throw new Error(\"ltree value must be a string\");\n }\n if (value.length === 0) {\n throw new Error(\"ltree value must not be empty\");\n }\n const labels = value.split(\".\");\n if (labels.length > LTREE_MAX_LABELS) {\n throw new Error(`ltree path exceeds max labels: got ${labels.length}, max ${LTREE_MAX_LABELS}`);\n }\n for (const label of labels) {\n if (label.length === 0) {\n throw new Error(`ltree label must not be empty in path \"${value}\"`);\n }\n if (label.length > LTREE_MAX_LABEL_LENGTH) {\n throw new Error(\n `ltree label exceeds max length: got ${label.length}, max ${LTREE_MAX_LABEL_LENGTH}`,\n );\n }\n if (!LABEL_PATTERN.test(label)) {\n throw new Error(\n `ltree label \"${label}\" contains invalid characters; allowed: alphanumeric, underscore, hyphen`,\n );\n }\n }\n}\n","/**\n * Data types this extension owns.\n *\n * `ltree` and `ltree[]` are PostgreSQL types the target does not register.\n * A path's stored form is its label text. An array's stored form is a\n * JSON array of those texts. Both accept text the contract can already write.\n * The texts are what a migration writes and what the catalog reports.\n */\n\nimport type { DataType, DataTypeReader } from \"@prisma/orm-framework/components/codec\";\nimport { refuseJsonValue } from \"@prisma/orm-framework/components/codec\";\nimport { sqlDataType } from \"@prisma/orm-family-sql/contract/data-type\";\nimport { pgText } from \"@prisma/orm-target-postgres/target/data-types\";\nimport { assertValidLtree } from \"./codecs-validation\";\n\nconst readLtree: DataTypeReader = (json) => {\n if (typeof json !== \"string\") {\n return refuseJsonValue(\"ltree/ltree\", \"an ltree path string\", json);\n }\n try {\n assertValidLtree(json);\n } catch {\n return refuseJsonValue(\"ltree/ltree\", \"a valid ltree path string\", json);\n }\n return json;\n};\n\nexport const ltreeDataType = sqlDataType(\"ltree/ltree\", {\n read: readLtree,\n texts: [{ text: \"ltree\", written: true, catalog: true }],\n casts: {\n [pgText.id]: (value) => value,\n },\n});\n\nconst readLtreeArray: DataTypeReader = (json) => {\n const expected = \"an array of ltree path strings\";\n if (!Array.isArray(json)) {\n return refuseJsonValue(\"ltree/ltree-array\", expected, json);\n }\n for (const entry of json) {\n if (typeof entry !== \"string\") {\n return refuseJsonValue(\"ltree/ltree-array\", expected, entry);\n }\n try {\n assertValidLtree(entry);\n } catch {\n return refuseJsonValue(\"ltree/ltree-array\", expected, entry);\n }\n }\n return json;\n};\n\n/**\n * `sqlDataType` accepts parentheses in a type name and refuses square brackets.\n * PostgreSQL writes this type as `ltree[]`, and `format_type` reports `ltree[]`.\n * Declare the type first, then set that text so a migration and a catalog check use it.\n */\nconst ltreeArrayDeclared = sqlDataType(\"ltree/ltree-array\", {\n read: readLtreeArray,\n listCast: {\n of: [pgText.id],\n cast: (elements) => [...elements],\n },\n});\n\nexport const ltreeArrayDataType = {\n ...ltreeArrayDeclared,\n sql: {\n ...ltreeArrayDeclared.sql,\n texts: [{ text: \"ltree[]\", written: true as const, catalog: true as const }],\n },\n} as typeof ltreeArrayDeclared;\n\nexport const ltreeDataTypes: readonly DataType[] = [ltreeDataType, ltreeArrayDataType];\n","import {\n type AnyCodecDescriptor,\n type CodecCallContext,\n CodecImpl,\n type CodecInstanceContext,\n type ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n type DataTypeValue,\n} from \"@prisma/orm-framework/components/codec\";\nimport type { ExtractCodecTypes, ProjectionExpr } from \"@prisma/orm-family-sql/relational-core/ast\";\nimport { CastExpr } from \"@prisma/orm-family-sql/relational-core/ast\";\nimport {\n definePostgresCodecs,\n PostgresCodecDescriptor,\n} from \"@prisma/orm-target-postgres/target/codec-descriptor\";\nimport { assertValidLtree } from \"./codecs-validation\";\nimport { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from \"./constants\";\nimport { ltreeArrayDataType, ltreeDataType } from \"./data-types\";\n\nexport { assertValidLtree } from \"./codecs-validation\";\n\nexport class LtreeCodec extends CodecImpl<\n typeof LTREE_CODEC_ID,\n readonly [\"equality\", \"order\"],\n string,\n string\n> {\n constructor(descriptor: AnyCodecDescriptor) {\n super(descriptor, ltreeDataType);\n }\n\n async toWire(value: string, _ctx: CodecCallContext): Promise<string> {\n assertValidLtree(value);\n return value;\n }\n\n async fromWire(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n\n toDataTypeValue(value: string): DataTypeValue {\n assertValidLtree(value);\n return this.dataTypeValueOf(value);\n }\n\n fromDataTypeValue(value: DataTypeValue): string {\n return value.value as string;\n }\n}\n\nexport class LtreeDescriptor extends PostgresCodecDescriptor<void> {\n override readonly jsonType = \"string\" as const;\n protected override jsonProjection(expression: ProjectionExpr): ProjectionExpr {\n // JSON projections read through fromWire; cast so the wire value is text.\n return CastExpr.as(expression, \"text\");\n }\n override readonly dataType = ltreeDataType.id;\n override readonly codecId = LTREE_CODEC_ID;\n override readonly traits = [\"equality\", \"order\"] as const;\n override readonly paramsSchema = undefined;\n override renderOutputType(): string {\n return \"string\";\n }\n override factory(): (ctx: CodecInstanceContext) => LtreeCodec {\n const shared = new LtreeCodec(this);\n return () => shared;\n }\n}\n\nexport const ltreeDescriptor = new LtreeDescriptor();\n\nexport const ltree = () => column(ltreeDescriptor.factory(), ltreeDescriptor.codecId, undefined);\n\nltree satisfies ColumnHelperFor<LtreeDescriptor>;\nltree satisfies ColumnHelperForStrict<LtreeDescriptor>;\n\nexport class LtreeArrayCodec extends CodecImpl<\n typeof LTREE_ARRAY_CODEC_ID,\n readonly [\"equality\"],\n readonly string[],\n readonly string[]\n> {\n constructor(descriptor: AnyCodecDescriptor) {\n super(descriptor, ltreeArrayDataType);\n }\n\n async toWire(value: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]> {\n for (const entry of value) {\n assertValidLtree(entry);\n }\n return value;\n }\n\n async fromWire(wire: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]> {\n return wire;\n }\n\n toDataTypeValue(value: readonly string[]): DataTypeValue {\n for (const entry of value) {\n assertValidLtree(entry);\n }\n return this.dataTypeValueOf([...value]);\n }\n\n fromDataTypeValue(value: DataTypeValue): readonly string[] {\n const json = value.value;\n if (!Array.isArray(json)) {\n return [];\n }\n return json.map((entry) => String(entry));\n }\n}\n\nexport class LtreeArrayDescriptor extends PostgresCodecDescriptor<void> {\n override readonly jsonType = \"array\" as const;\n protected override jsonProjection(expression: ProjectionExpr): ProjectionExpr {\n // ltree[] already projects as a JSON string array for fromWire.\n return expression;\n }\n override readonly dataType = ltreeArrayDataType.id;\n override readonly codecId = LTREE_ARRAY_CODEC_ID;\n override readonly traits = [\"equality\"] as const;\n override readonly paramsSchema = undefined;\n override renderOutputType(): string {\n return \"readonly string[]\";\n }\n override factory(): (ctx: CodecInstanceContext) => LtreeArrayCodec {\n const shared = new LtreeArrayCodec(this);\n return () => shared;\n }\n}\n\nexport const ltreeArrayDescriptor = new LtreeArrayDescriptor();\n\nexport const ltreeArray = () =>\n column(ltreeArrayDescriptor.factory(), ltreeArrayDescriptor.codecId, undefined);\n\nltreeArray satisfies ColumnHelperFor<LtreeArrayDescriptor>;\nltreeArray satisfies ColumnHelperForStrict<LtreeArrayDescriptor>;\n\nconst codecDescriptorMap = {\n ltree: ltreeDescriptor,\n ltreeArray: ltreeArrayDescriptor,\n} as const;\n\nexport type CodecTypes = ExtractCodecTypes<typeof codecDescriptorMap>;\n\nexport const codecDescriptors = definePostgresCodecs(Object.values(codecDescriptorMap));\n","import { buildCodecDescriptorRegistry } from \"@prisma/orm-family-sql/relational-core/codec-descriptor-registry\";\nimport type { CodecDescriptorRegistry } from \"@prisma/orm-family-sql/relational-core/query-lane-context\";\nimport { codecDescriptors } from \"./codecs\";\n\nexport const ltreeCodecRegistry: CodecDescriptorRegistry =\n buildCodecDescriptorRegistry(codecDescriptors);\n","import type { AnyExpression } from \"@prisma/orm-family-sql/relational-core/ast\";\nimport {\n buildOperation,\n type CodecExpression,\n codecOf,\n type Expression,\n toExpr,\n} from \"@prisma/orm-family-sql/relational-core/expression\";\nimport type { CodecTypes } from \"../types/codec-types\";\nimport type { QueryOperationTypes } from \"../types/operation-types\";\nimport { ltreeAuthoringTypes } from \"./authoring\";\nimport { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from \"./constants\";\nimport { ltreeDataTypes } from \"./data-types\";\nimport { ltreeCodecRegistry } from \"./registry\";\n\ntype CodecTypesBase = Record<string, { readonly input: unknown; readonly output: unknown }>;\n\ntype BoolReturn = Expression<{ readonly codecId: \"pg/bool@1\"; readonly nullable: false }>;\ntype LtreeReturn = Expression<{ readonly codecId: \"pg/ltree@1\"; readonly nullable: false }>;\ntype IntReturn = Expression<{ readonly codecId: \"pg/int4@1\"; readonly nullable: false }>;\ntype TextReturn = Expression<{ readonly codecId: \"pg/text@1\"; readonly nullable: false }>;\n\nconst BOOL_RETURN = { codecId: \"pg/bool@1\", nullable: false } as const;\nconst LTREE_RETURN = { codecId: \"pg/ltree@1\", nullable: false } as const;\nconst INT_RETURN = { codecId: \"pg/int4@1\", nullable: false } as const;\nconst TEXT_RETURN = { codecId: \"pg/text@1\", nullable: false } as const;\nconst TEXT_CODEC_ID = \"pg/text@1\" as const;\nconst INT_CODEC_ID = \"pg/int4@1\" as const;\n\n/**\n * Build a function-style operation whose SQL is `fnName(self, arg0, arg1, ...)`.\n * The template's placeholder count is derived from the actual argument list, so\n * one helper covers fixed-arity functions (`nlevel`, `subltree`), optional-arg\n * overloads (`subpath`, `index`), and the variadic `lca` (see ADR-001). `args`\n * already carries each value through `toExpr` with its codec; `args[0]` is the\n * `self` receiver.\n */\nfunction funcOp<C extends string>(\n method: string,\n fnName: string,\n returns: { readonly codecId: C; readonly nullable: false },\n args: readonly [AnyExpression, ...AnyExpression[]],\n): Expression<{ readonly codecId: C; readonly nullable: false }> {\n const placeholders = args.map((_, i) => (i === 0 ? \"{{self}}\" : `{{arg${i - 1}}}`)).join(\", \");\n return buildOperation({\n method,\n args,\n returns,\n lowering: {\n targetFamily: \"sql\",\n template: `${fnName}(${placeholders})`,\n },\n });\n}\n\nexport function ltreeQueryOperations<CT extends CodecTypesBase>(): QueryOperationTypes<CT> {\n // Hierarchy operators compare two `ltree` values; the user argument shares the\n // column's `pg/ltree@1` codec. Pattern-match operators take a query/pattern\n // string (or `string[]`) that is NOT an ltree — it is bound as text and cast\n // in-template to `lquery` / `lquery[]` / `ltxtquery` (the validated-string-param\n // approach; verified executable under PGlite).\n const hierarchyOp = (\n method: string,\n operator: string,\n self: CodecExpression<typeof LTREE_CODEC_ID, boolean, CT>,\n other: CodecExpression<typeof LTREE_CODEC_ID, boolean, CT>,\n ): BoolReturn => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method,\n args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n returns: BOOL_RETURN,\n lowering: {\n targetFamily: \"sql\",\n template: `{{self}} ${operator} {{arg0}}`,\n },\n });\n };\n\n const patternOp = (\n method: string,\n operator: string,\n castType: string,\n self: CodecExpression<typeof LTREE_CODEC_ID, boolean, CT>,\n arg: unknown,\n many = false,\n ): BoolReturn => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method,\n args: [\n toExpr(self, selfCodec),\n toExpr(arg, many ? { codecId: TEXT_CODEC_ID, many: true } : { codecId: TEXT_CODEC_ID }),\n ],\n returns: BOOL_RETURN,\n lowering: {\n targetFamily: \"sql\",\n template: `{{self}} ${operator} ({{arg0}})::${castType}`,\n },\n });\n };\n\n // Concatenation operators produce a new ltree. `concat` joins two ltree paths\n // (`{{self}} || {{arg0}}`); `concatText`/`prependText` splice a text label onto\n // the right/left. The text operand binds as `pg/text@1` and is cast in-template\n // (PG resolves the `||` overload from the cast). `prependText` places `{{self}}`\n // second because the ltree receiver is the RIGHT operand of `text || ltree`;\n // `args[0]` is still `self` (the renderer binds by placeholder name, not order).\n const concatOp = (\n method: string,\n template: string,\n args: readonly [AnyExpression, ...AnyExpression[]],\n ): LtreeReturn =>\n buildOperation({\n method,\n args,\n returns: LTREE_RETURN,\n lowering: { targetFamily: \"sql\", template },\n });\n\n // Tier 3 — first-match operators on an `ltree[]` receiver (ADR-003).\n const firstMatchOp = (\n method: string,\n operator: string,\n self: CodecExpression<typeof LTREE_ARRAY_CODEC_ID, boolean, CT>,\n arg: unknown,\n argCodecId: typeof LTREE_CODEC_ID | typeof TEXT_CODEC_ID,\n castType?: string,\n ): LtreeReturn => {\n const selfCodec = codecOf(self);\n const template = castType\n ? `{{self}} ${operator} ({{arg0}})::${castType}`\n : `{{self}} ${operator} {{arg0}}`;\n return buildOperation({\n method,\n args: [toExpr(self, selfCodec), toExpr(arg, { codecId: argCodecId })],\n returns: LTREE_RETURN,\n lowering: { targetFamily: \"sql\", template },\n });\n };\n\n return {\n isAncestorOf: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, other) => hierarchyOp(\"isAncestorOf\", \"@>\", self, other),\n },\n isDescendantOf: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, other) => hierarchyOp(\"isDescendantOf\", \"<@\", self, other),\n },\n matchesLquery: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, pattern) => patternOp(\"matchesLquery\", \"~\", \"lquery\", self, pattern),\n },\n matchesLqueryArray: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, patterns) =>\n patternOp(\"matchesLqueryArray\", \"?\", \"lquery[]\", self, patterns, true),\n },\n matchesLtxtquery: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, query) => patternOp(\"matchesLtxtquery\", \"@\", \"ltxtquery\", self, query),\n },\n nlevel: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self): IntReturn =>\n funcOp(\"nlevel\", \"nlevel\", INT_RETURN, [toExpr(self, codecOf(self))]),\n },\n subltree: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, start, end): LtreeReturn =>\n funcOp(\"subltree\", \"subltree\", LTREE_RETURN, [\n toExpr(self, codecOf(self)),\n toExpr(start, { codecId: INT_CODEC_ID }),\n toExpr(end, { codecId: INT_CODEC_ID }),\n ]),\n },\n // `subpath(self, offset, len?)` — `len` omitted lowers to the 2-arg overload.\n subpath: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, offset, len): LtreeReturn => {\n const head: readonly [AnyExpression, AnyExpression] = [\n toExpr(self, codecOf(self)),\n toExpr(offset, { codecId: INT_CODEC_ID }),\n ];\n return funcOp(\n \"subpath\",\n \"subpath\",\n LTREE_RETURN,\n len === undefined ? head : [...head, toExpr(len, { codecId: INT_CODEC_ID })],\n );\n },\n },\n // `index(self, other, offset?)` — `offset` omitted lowers to the 2-arg overload.\n indexOf: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, other, offset): IntReturn => {\n const selfCodec = codecOf(self);\n const head: readonly [AnyExpression, AnyExpression] = [\n toExpr(self, selfCodec),\n toExpr(other, selfCodec),\n ];\n return funcOp(\n \"indexOf\",\n \"index\",\n INT_RETURN,\n offset === undefined ? head : [...head, toExpr(offset, { codecId: INT_CODEC_ID })],\n );\n },\n },\n // `lca(self, other, ...rest)` — variadic longest-common-ancestor (ADR-001).\n // PostgreSQL has no single-arg `lca`, so `other` is required (2–8 paths).\n lca: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, other, ...rest): LtreeReturn => {\n const selfCodec = codecOf(self);\n return funcOp(\"lca\", \"lca\", LTREE_RETURN, [\n toExpr(self, selfCodec),\n toExpr(other, selfCodec),\n ...rest.map((p) => toExpr(p, selfCodec)),\n ]);\n },\n },\n // Tier 2 — concatenation (`||`).\n concat: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, other): LtreeReturn => {\n const selfCodec = codecOf(self);\n return concatOp(\"concat\", \"{{self}} || {{arg0}}\", [\n toExpr(self, selfCodec),\n toExpr(other, selfCodec),\n ]);\n },\n },\n concatText: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, label): LtreeReturn =>\n concatOp(\"concatText\", \"{{self}} || ({{arg0}})::text\", [\n toExpr(self, codecOf(self)),\n toExpr(label, { codecId: TEXT_CODEC_ID }),\n ]),\n },\n // `text || ltree` — the ltree receiver is the right operand (ADR-002).\n prependText: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, prefix): LtreeReturn =>\n concatOp(\"prependText\", \"({{arg0}})::text || {{self}}\", [\n toExpr(self, codecOf(self)),\n toExpr(prefix, { codecId: TEXT_CODEC_ID }),\n ]),\n },\n // Tier 2 — conversion.\n toText: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self): TextReturn =>\n funcOp(\"toText\", \"ltree2text\", TEXT_RETURN, [toExpr(self, codecOf(self))]),\n },\n // `text2ltree(text)` — rooted on `pg/text@1` (the only reachable form of the\n // free-function `text2ltree`; see ADR-002). Surfaces as `.toLtree()` on text.\n toLtree: {\n self: { codecId: TEXT_CODEC_ID },\n impl: (self): LtreeReturn =>\n funcOp(\"toLtree\", \"text2ltree\", LTREE_RETURN, [toExpr(self, codecOf(self))]),\n },\n // Tier 3 — array first-match operators (ADR-003).\n firstAncestorOf: {\n self: { codecId: LTREE_ARRAY_CODEC_ID },\n impl: (self, other) => firstMatchOp(\"firstAncestorOf\", \"?@>\", self, other, LTREE_CODEC_ID),\n },\n firstDescendantOf: {\n self: { codecId: LTREE_ARRAY_CODEC_ID },\n impl: (self, other) => firstMatchOp(\"firstDescendantOf\", \"?<@\", self, other, LTREE_CODEC_ID),\n },\n firstMatchLquery: {\n self: { codecId: LTREE_ARRAY_CODEC_ID },\n impl: (self, pattern) =>\n firstMatchOp(\"firstMatchLquery\", \"?~\", self, pattern, TEXT_CODEC_ID, \"lquery\"),\n },\n firstMatchLtxtquery: {\n self: { codecId: LTREE_ARRAY_CODEC_ID },\n impl: (self, query) =>\n firstMatchOp(\"firstMatchLtxtquery\", \"?@\", self, query, TEXT_CODEC_ID, \"ltxtquery\"),\n },\n // `lca(ltree[])` — array-receiver form (ADR-001, ADR-005). Named `lcaAll`\n // because prisma-next keys operations by name only (`createOperationRegistry`\n // throws on a duplicate); `lca` is already the variadic scalar method on\n // `pg/ltree@1`. Declares `nullable: false` for parity with the Tier 3\n // first-match ops even though PG returns NULL for an empty/NULL `ltree[]`\n // (see the empty-array integration test) — a family-wide gap, not specific\n // to `lcaAll`.\n lcaAll: {\n self: { codecId: LTREE_ARRAY_CODEC_ID },\n impl: (self): LtreeReturn =>\n funcOp(\"lcaAll\", \"lca\", LTREE_RETURN, [toExpr(self, codecOf(self))]),\n },\n };\n}\n\nconst ltreePackMetaBase = {\n kind: \"extension\",\n id: \"ltree\",\n familyId: \"sql\",\n targetId: \"postgres\",\n version: \"0.1.0\",\n capabilities: {\n postgres: {\n \"ltree.path\": true,\n },\n },\n authoring: {\n type: ltreeAuthoringTypes,\n },\n dataTypes: ltreeDataTypes,\n types: {\n codecTypes: {\n codecDescriptors: Array.from(ltreeCodecRegistry.values()),\n import: {\n package: \"prisma-ltree/codec-types\",\n named: \"CodecTypes\",\n alias: \"LtreeTypes\",\n },\n typeImports: [\n {\n package: \"prisma-ltree/codec-types\",\n named: \"Ltree\",\n alias: \"Ltree\",\n },\n ],\n },\n queryOperationTypes: {\n import: {\n package: \"prisma-ltree/operation-types\",\n named: \"QueryOperationTypes\",\n alias: \"LtreeQueryOperationTypes\",\n },\n },\n },\n} as const;\n\nexport const ltreePackMeta: typeof ltreePackMetaBase & {\n readonly __codecTypes?: CodecTypes;\n} = ltreePackMetaBase;\n"],"mappings":";;;;;;;;;AAGA,MAAa,sBAAsB,EACjC,OAAO;CACL,OAAO;EACL,MAAM;EACN,UAAU;EACV,QAAQ,EACN,SAAS,eACX;CACF;CACA,YAAY;EACV,MAAM;EACN,UAAU;EACV,QAAQ,EACN,SAAS,qBACX;CACF;AACF,EACF;;;AClBA,MAAM,gBAAgB;AAEtB,SAAgB,iBAAiB,OAAyC;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A,mBAAmB;GACjB,MAAM,EAAE,SAAS,qBAAqB;GACtC,OAAO,MAAM,UAAU,aAAa,qBAAqB,OAAO,MAAM,OAAO,cAAc;EAC7F;EACA,kBAAkB;GAChB,MAAM,EAAE,SAAS,qBAAqB;GACtC,OAAO,MAAM,YACX,aAAa,oBAAoB,MAAM,MAAM,SAAS,eAAe,QAAQ;EACjF;EACA,qBAAqB;GACnB,MAAM,EAAE,SAAS,qBAAqB;GACtC,OAAO,MAAM,UACX,aAAa,uBAAuB,MAAM,MAAM,OAAO,eAAe,WAAW;EACrF;EAQA,QAAQ;GACN,MAAM,EAAE,SAAS,qBAAqB;GACtC,OAAO,SACL,OAAO,UAAU,OAAO,cAAc,CAAC,OAAO,MAAM,QAAQ,IAAI,CAAC,CAAC,CAAC;EACvE;CACF;AACF;AA2CA,MAAa,gBAET;CA1CF,MAAM;CACN,IAAI;CACJ,UAAU;CACV,UAAU;CACV,SAAS;CACT,cAAc,EACZ,UAAU,EACR,cAAc,KAChB,EACF;CACA,WAAW,EACT,MAAM,oBACR;CACA,WAAW;CACX,OAAO;EACL,YAAY;GACV,kBAAkB,MAAM,KAAK,mBAAmB,OAAO,CAAC;GACxD,QAAQ;IACN,SAAS;IACT,OAAO;IACP,OAAO;GACT;GACA,aAAa,CACX;IACE,SAAS;IACT,OAAO;IACP,OAAO;GACT,CACF;EACF;EACA,qBAAqB,EACnB,QAAQ;GACN,SAAS;GACT,OAAO;GACP,OAAO;EACT,EACF;CACF;AAKE"}
|
package/dist/pack.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as CodecTypes } from "./codec-types-
|
|
1
|
+
import { t as CodecTypes } from "./codec-types-Ba5cQ3bc.mjs";
|
|
2
2
|
//#region src/core/descriptor-meta.d.ts
|
|
3
3
|
declare const ltreePackMetaBase: {
|
|
4
4
|
readonly kind: "extension";
|
|
@@ -16,21 +16,22 @@ declare const ltreePackMetaBase: {
|
|
|
16
16
|
readonly ltree: {
|
|
17
17
|
readonly Ltree: {
|
|
18
18
|
readonly kind: "typeConstructor";
|
|
19
|
+
readonly inferred: true;
|
|
19
20
|
readonly output: {
|
|
20
21
|
readonly codecId: "pg/ltree@1";
|
|
21
|
-
readonly nativeType: "ltree";
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
readonly LtreeArray: {
|
|
25
25
|
readonly kind: "typeConstructor";
|
|
26
|
+
readonly inferred: true;
|
|
26
27
|
readonly output: {
|
|
27
28
|
readonly codecId: "pg/ltree-array@1";
|
|
28
|
-
readonly nativeType: "ltree[]";
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
+
readonly dataTypes: readonly import("@prisma/orm-framework/components/codec").DataType[];
|
|
34
35
|
readonly types: {
|
|
35
36
|
readonly codecTypes: {
|
|
36
37
|
readonly codecDescriptors: import("@prisma/orm-framework/components/codec").CodecDescriptor<unknown>[];
|
|
@@ -52,17 +53,6 @@ declare const ltreePackMetaBase: {
|
|
|
52
53
|
readonly alias: "LtreeQueryOperationTypes";
|
|
53
54
|
};
|
|
54
55
|
};
|
|
55
|
-
readonly storage: readonly [{
|
|
56
|
-
readonly typeId: "pg/ltree@1";
|
|
57
|
-
readonly familyId: "sql";
|
|
58
|
-
readonly targetId: "postgres";
|
|
59
|
-
readonly nativeType: "ltree";
|
|
60
|
-
}, {
|
|
61
|
-
readonly typeId: "pg/ltree-array@1";
|
|
62
|
-
readonly familyId: "sql";
|
|
63
|
-
readonly targetId: "postgres";
|
|
64
|
-
readonly nativeType: "ltree[]";
|
|
65
|
-
}];
|
|
66
56
|
};
|
|
67
57
|
};
|
|
68
58
|
declare const ltreePackMeta: typeof ltreePackMetaBase & {
|
package/dist/pack.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.d.mts","names":[],"sources":["../src/core/descriptor-meta.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"pack.d.mts","names":[],"sources":["../src/core/descriptor-meta.ts"],"mappings":";;cA0SM,iBAAA;EAAA,SACJ,IAAA;EAAA,SACA,EAAA;EAAA,SACA,QAAA;EAAA,SACA,QAAA;EAAA,SACA,OAAA;EAAA,SACA,YAAA;IAAA,SACE,QAAA;MAAA,SACE,YAAA;IAAA;EAAA;EAAA,SAGJ,SAAA;IAAA,SACE,IAAA;MAAA;;;;;;;;;;;;;;;;;;WAEF,SAAA,4DAAS,QAAA;EAAA,SACT,KAAA;IAAA,SACE,UAAA;MAAA,SACE,gBAAA,mDAAgB,eAAA;MAAA,SAChB,MAAA;QAAA,SACE,OAAA;QAAA,SACA,KAAA;QAAA,SACA,KAAA;MAAA;MAAA,SAEF,WAAA;QAAA,SAEI,OAAA;QAAA,SACA,KAAA;QAAA,SACA,KAAA;MAAA;IAAA;IAAA,SAIN,mBAAA;MAAA,SACE,MAAA;QAAA,SACE,OAAA;QAAA,SACA,KAAA;QAAA,SACA,KAAA;MAAA;IAAA;EAAA;AAAA;AAAA,cAMK,aAAA,SAAsB,iBAAA;EAAA,SACxB,YAAA,GAAe,UAAU;AAAA"}
|
package/dist/pack.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as ltreePackMeta } from "./descriptor-meta-
|
|
1
|
+
import { t as ltreePackMeta } from "./descriptor-meta-Cc6tmP54.mjs";
|
|
2
2
|
export { ltreePackMeta as default };
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { n as ltreeQueryOperations, r as ltreeCodecRegistry, t as ltreePackMeta } from "./descriptor-meta-
|
|
1
|
+
import { n as ltreeQueryOperations, r as ltreeCodecRegistry, t as ltreePackMeta } from "./descriptor-meta-Cc6tmP54.mjs";
|
|
2
2
|
//#region src/exports/runtime.ts
|
|
3
3
|
const ltreeRuntimeDescriptor = {
|
|
4
4
|
kind: "extension",
|
|
5
5
|
id: ltreePackMeta.id,
|
|
6
6
|
version: ltreePackMeta.version,
|
|
7
|
+
dataTypes: ltreePackMeta.dataTypes,
|
|
7
8
|
familyId: "sql",
|
|
8
9
|
targetId: "postgres",
|
|
9
10
|
types: { codecTypes: { codecDescriptors: Array.from(ltreeCodecRegistry.values()) } },
|
package/dist/runtime.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.mjs","names":[],"sources":["../src/exports/runtime.ts"],"sourcesContent":["import type { SqlRuntimeExtensionDescriptor } from \"@prisma/orm-family-sql/runtime\";\nimport { ltreePackMeta, ltreeQueryOperations } from \"../core/descriptor-meta\";\nimport { ltreeCodecRegistry } from \"../core/registry\";\n\nconst ltreeRuntimeDescriptor: SqlRuntimeExtensionDescriptor<\"postgres\"> = {\n kind: \"extension\" as const,\n id: ltreePackMeta.id,\n version: ltreePackMeta.version,\n familyId: \"sql\" as const,\n targetId: \"postgres\" as const,\n types: {\n codecTypes: {\n codecDescriptors: Array.from(ltreeCodecRegistry.values()),\n },\n },\n codecs: () => Array.from(ltreeCodecRegistry.values()),\n queryOperations: () => ltreeQueryOperations(),\n create() {\n return {\n familyId: \"sql\" as const,\n targetId: \"postgres\" as const,\n };\n },\n};\n\nexport { ltreeCodecRegistry };\nexport default ltreeRuntimeDescriptor;\n"],"mappings":";;AAIA,MAAM,yBAAoE;CACxE,MAAM;CACN,IAAI,cAAc;CAClB,SAAS,cAAc;CACvB,UAAU;CACV,UAAU;CACV,OAAO,EACL,YAAY,EACV,kBAAkB,MAAM,KAAK,mBAAmB,OAAO,CAAC,EAC1D,EACF;CACA,cAAc,MAAM,KAAK,mBAAmB,OAAO,CAAC;CACpD,uBAAuB,qBAAqB;CAC5C,SAAS;EACP,OAAO;GACL,UAAU;GACV,UAAU;EACZ;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":[],"sources":["../src/exports/runtime.ts"],"sourcesContent":["import type { SqlRuntimeExtensionDescriptor } from \"@prisma/orm-family-sql/runtime\";\nimport { ltreePackMeta, ltreeQueryOperations } from \"../core/descriptor-meta\";\nimport { ltreeCodecRegistry } from \"../core/registry\";\n\nconst ltreeRuntimeDescriptor: SqlRuntimeExtensionDescriptor<\"postgres\"> = {\n kind: \"extension\" as const,\n id: ltreePackMeta.id,\n version: ltreePackMeta.version,\n dataTypes: ltreePackMeta.dataTypes,\n familyId: \"sql\" as const,\n targetId: \"postgres\" as const,\n types: {\n codecTypes: {\n codecDescriptors: Array.from(ltreeCodecRegistry.values()),\n },\n },\n codecs: () => Array.from(ltreeCodecRegistry.values()),\n queryOperations: () => ltreeQueryOperations(),\n create() {\n return {\n familyId: \"sql\" as const,\n targetId: \"postgres\" as const,\n };\n },\n};\n\nexport { ltreeCodecRegistry };\nexport default ltreeRuntimeDescriptor;\n"],"mappings":";;AAIA,MAAM,yBAAoE;CACxE,MAAM;CACN,IAAI,cAAc;CAClB,SAAS,cAAc;CACvB,WAAW,cAAc;CACzB,UAAU;CACV,UAAU;CACV,OAAO,EACL,YAAY,EACV,kBAAkB,MAAM,KAAK,mBAAmB,OAAO,CAAC,EAC1D,EACF;CACA,cAAc,MAAM,KAAK,mBAAmB,OAAO,CAAC;CACpD,uBAAuB,qBAAqB;CAC5C,SAAS;EACP,OAAO;GACL,UAAU;GACV,UAAU;EACZ;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prisma-ltree",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Prisma 8 extension pack for PostgreSQL's ltree hierarchical tree data type.",
|
|
5
5
|
"homepage": "https://prisma-ltree.procka.org",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,26 +28,27 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@prisma/orm-family-sql": "8.0.0-rc.
|
|
32
|
-
"@prisma/orm-framework": "8.0.0-rc.
|
|
33
|
-
"@prisma/orm-toolchain": "8.0.0-rc.
|
|
31
|
+
"@prisma/orm-family-sql": "8.0.0-rc.23",
|
|
32
|
+
"@prisma/orm-framework": "8.0.0-rc.23",
|
|
33
|
+
"@prisma/orm-toolchain": "8.0.0-rc.23",
|
|
34
34
|
"@standard-schema/spec": "^1.1.0",
|
|
35
|
-
"arktype": "^2.2.0"
|
|
35
|
+
"arktype": "^2.2.0",
|
|
36
|
+
"temporal-spec": "1.0.1"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@electric-sql/pglite": "^0.5.3",
|
|
39
|
-
"@prisma/cli-engine": "0.
|
|
40
|
-
"@prisma/orm-postgres": "8.0.0-rc.
|
|
41
|
-
"@prisma/orm-target-postgres": "8.0.0-rc.
|
|
40
|
+
"@prisma/cli-engine": "0.9.0",
|
|
41
|
+
"@prisma/orm-postgres": "8.0.0-rc.23",
|
|
42
|
+
"@prisma/orm-target-postgres": "8.0.0-rc.23",
|
|
42
43
|
"@types/node": "^24",
|
|
43
44
|
"@typescript/native-preview": "7.0.0-dev.20260509.2",
|
|
44
45
|
"@vitest/coverage-v8": "4.1.8",
|
|
45
|
-
"prisma": "8.0.0-rc.
|
|
46
|
+
"prisma": "8.0.0-rc.33",
|
|
46
47
|
"typescript": "^5",
|
|
47
48
|
"vite-plus": "0.1.24"
|
|
48
49
|
},
|
|
49
50
|
"peerDependencies": {
|
|
50
|
-
"@prisma/orm-target-postgres": "8.0.0-rc.
|
|
51
|
+
"@prisma/orm-target-postgres": "8.0.0-rc.23",
|
|
51
52
|
"typescript": ">=5.9"
|
|
52
53
|
},
|
|
53
54
|
"peerDependenciesMeta": {
|