prisma-ltree 0.5.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 +8 -8
- package/dist/{codec-types-BJE-5cwk.d.mts → codec-types-Ba5cQ3bc.d.mts} +15 -12
- package/dist/codec-types-Ba5cQ3bc.d.mts.map +1 -0
- package/dist/codec-types.d.mts +1 -1
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +236 -16
- package/dist/control.mjs.map +1 -1
- package/dist/{descriptor-meta-2In8FI1I.mjs → descriptor-meta-Cc6tmP54.mjs} +69 -35
- package/dist/descriptor-meta-Cc6tmP54.mjs.map +1 -0
- package/dist/pack.d.mts +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/runtime.mjs +1 -1
- package/package.json +11 -10
- package/src/contract.d.ts +87 -20
- package/src/contract.json +22 -1
- package/src/contract.ts +21 -3
- package/src/core/codecs-validation.ts +31 -0
- package/src/core/codecs.ts +32 -55
- package/src/core/contract-space-constants.ts +11 -0
- package/src/core/data-types.ts +36 -2
- package/src/exports/control.ts +36 -1
- package/dist/codec-types-BJE-5cwk.d.mts.map +0 -1
- package/dist/descriptor-meta-2In8FI1I.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -30,16 +30,16 @@ for what is supported, planned, or out of scope.
|
|
|
30
30
|
pnpm add prisma-ltree
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Requires Node `>=24`. This pack exact-pins `@prisma/orm-*` to **`8.0.0-rc.
|
|
33
|
+
Requires Node `>=24`. This pack exact-pins `@prisma/orm-*` to **`8.0.0-rc.23`**.
|
|
34
34
|
`prisma-ltree` itself stays on independent `0.x` semver: install it with a caret.
|
|
35
|
-
You do not need `prisma-ltree@8.0.0-rc.
|
|
35
|
+
You do not need `prisma-ltree@8.0.0-rc.23`. See
|
|
36
36
|
[versioning and compatibility](https://github.com/slovakian/prisma-ltree/blob/main/docs/prisma-next/versioning-and-compatibility.md).
|
|
37
37
|
|
|
38
38
|
Consumer apps also depend on the Postgres facade at the same SPI version, plus the
|
|
39
39
|
`prisma` CLI:
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
pnpm add @prisma/orm-postgres@8.0.0-rc.
|
|
42
|
+
pnpm add @prisma/orm-postgres@8.0.0-rc.23 prisma-ltree
|
|
43
43
|
pnpm add -D prisma
|
|
44
44
|
```
|
|
45
45
|
|
|
@@ -98,7 +98,7 @@ types {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
model Page {
|
|
101
|
-
id String @id @
|
|
101
|
+
id String @id @onCreate(uuid())
|
|
102
102
|
path Path
|
|
103
103
|
breadcrumbs Paths
|
|
104
104
|
|
|
@@ -110,7 +110,7 @@ model Page {
|
|
|
110
110
|
|
|
111
111
|
```prisma
|
|
112
112
|
model Page {
|
|
113
|
-
id String @id @
|
|
113
|
+
id String @id @onCreate(uuid())
|
|
114
114
|
path Path
|
|
115
115
|
|
|
116
116
|
@@index([path], type: "gist")
|
|
@@ -134,12 +134,12 @@ export const contract = defineContract(
|
|
|
134
134
|
{
|
|
135
135
|
extensions: { ltree: ltreePack },
|
|
136
136
|
},
|
|
137
|
-
({ field, model }) => ({
|
|
137
|
+
({ field, model, type }) => ({
|
|
138
138
|
models: {
|
|
139
139
|
Category: model("Category", {
|
|
140
140
|
fields: {
|
|
141
|
-
id: field.
|
|
142
|
-
name: field.
|
|
141
|
+
id: field.column(type.Int()).id(),
|
|
142
|
+
name: field.column(type.String()),
|
|
143
143
|
path: field.column(ltree()),
|
|
144
144
|
},
|
|
145
145
|
}).sql({ table: "category" }),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { CodecCallContext, CodecImpl, CodecInstanceContext } from "@prisma/orm-framework/components/codec";
|
|
2
|
-
import { PostgresCodecDescriptor } from "@prisma/orm-target-postgres/target/codec-descriptor";
|
|
3
|
-
import { JsonValue } from "@prisma/orm-framework/contract/types";
|
|
1
|
+
import { AnyCodecDescriptor, CodecCallContext, CodecImpl, CodecInstanceContext, DataTypeValue } from "@prisma/orm-framework/components/codec";
|
|
4
2
|
import { ExtractCodecTypes, ProjectionExpr } from "@prisma/orm-family-sql/relational-core/ast";
|
|
3
|
+
import { PostgresCodecDescriptor } from "@prisma/orm-target-postgres/target/codec-descriptor";
|
|
5
4
|
|
|
6
5
|
//#region src/core/constants.d.ts
|
|
7
6
|
declare const LTREE_CODEC_ID: "pg/ltree@1";
|
|
@@ -9,12 +8,14 @@ declare const LTREE_ARRAY_CODEC_ID: "pg/ltree-array@1";
|
|
|
9
8
|
//#endregion
|
|
10
9
|
//#region src/core/codecs.d.ts
|
|
11
10
|
declare class LtreeCodec extends CodecImpl<typeof LTREE_CODEC_ID, readonly ["equality", "order"], string, string> {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
constructor(descriptor: AnyCodecDescriptor);
|
|
12
|
+
toWire(value: string, _ctx: CodecCallContext): Promise<string>;
|
|
13
|
+
fromWire(wire: string, _ctx: CodecCallContext): Promise<string>;
|
|
14
|
+
toDataTypeValue(value: string): DataTypeValue;
|
|
15
|
+
fromDataTypeValue(value: DataTypeValue): string;
|
|
16
16
|
}
|
|
17
17
|
declare class LtreeDescriptor extends PostgresCodecDescriptor<void> {
|
|
18
|
+
readonly jsonType: "string";
|
|
18
19
|
protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
|
|
19
20
|
readonly dataType: import("@prisma/orm-framework/components/codec").DataTypeId;
|
|
20
21
|
readonly codecId: "pg/ltree@1";
|
|
@@ -24,12 +25,14 @@ declare class LtreeDescriptor extends PostgresCodecDescriptor<void> {
|
|
|
24
25
|
factory(): (ctx: CodecInstanceContext) => LtreeCodec;
|
|
25
26
|
}
|
|
26
27
|
declare class LtreeArrayCodec extends CodecImpl<typeof LTREE_ARRAY_CODEC_ID, readonly ["equality"], readonly string[], readonly string[]> {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
constructor(descriptor: AnyCodecDescriptor);
|
|
29
|
+
toWire(value: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]>;
|
|
30
|
+
fromWire(wire: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]>;
|
|
31
|
+
toDataTypeValue(value: readonly string[]): DataTypeValue;
|
|
32
|
+
fromDataTypeValue(value: DataTypeValue): readonly string[];
|
|
31
33
|
}
|
|
32
34
|
declare class LtreeArrayDescriptor extends PostgresCodecDescriptor<void> {
|
|
35
|
+
readonly jsonType: "array";
|
|
33
36
|
protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
|
|
34
37
|
readonly dataType: import("@prisma/orm-framework/components/codec").DataTypeId;
|
|
35
38
|
readonly codecId: "pg/ltree-array@1";
|
|
@@ -54,4 +57,4 @@ type LtreeArray = readonly string[] & {
|
|
|
54
57
|
type CodecTypes = CodecTypes$1;
|
|
55
58
|
//#endregion
|
|
56
59
|
export { Ltree as n, LtreeArray as r, CodecTypes as t };
|
|
57
|
-
//# sourceMappingURL=codec-types-
|
|
60
|
+
//# sourceMappingURL=codec-types-Ba5cQ3bc.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec-types-Ba5cQ3bc.d.mts","names":[],"sources":["../src/core/constants.ts","../src/core/codecs.ts","../src/types/codec-types.ts"],"mappings":";;;;;cAAa,cAAA;AAAA,cAEA,oBAAA;;;cCoBA,UAAA,SAAmB,SAAA,QACvB,cAAA;EAKP,WAAA,CAAY,UAAA,EAAY,kBAAA;EAIlB,MAAA,CAAO,KAAA,UAAe,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAK/C,QAAA,CAAS,IAAA,UAAc,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAItD,eAAA,CAAgB,KAAA,WAAgB,aAAA;EAKhC,iBAAA,CAAkB,KAAA,EAAO,aAAA;AAAA;AAAA,cAKd,eAAA,SAAwB,uBAAA;EAAA,SACjB,QAAA;EAAA,UACC,cAAA,CAAe,UAAA,EAAY,cAAA,GAAiB,cAAA;EAAA,SAI7C,QAAA,mDAAQ,UAAA;EAAA,SACR,OAAA;EAAA,SACA,MAAA;EAAA,SACA,YAAA;EACT,gBAAA;EAGA,OAAA,KAAY,GAAA,EAAK,oBAAA,KAAyB,UAAA;AAAA;AAAA,cAaxC,eAAA,SAAwB,SAAA,QAC5B,oBAAA;EAKP,WAAA,CAAY,UAAA,EAAY,kBAAA;EAIlB,MAAA,CAAO,KAAA,qBAA0B,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAO1D,QAAA,CAAS,IAAA,qBAAyB,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAIjE,eAAA,CAAgB,KAAA,sBAA2B,aAAA;EAO3C,iBAAA,CAAkB,KAAA,EAAO,aAAA;AAAA;AAAA,cASd,oBAAA,SAA6B,uBAAA;EAAA,SACtB,QAAA;EAAA,UACC,cAAA,CAAe,UAAA,EAAY,cAAA,GAAiB,cAAA;EAAA,SAI7C,QAAA,mDAAQ,UAAA;EAAA,SACR,OAAA;EAAA,SACA,MAAA;EAAA,SACA,YAAA;EACT,gBAAA;EAGA,OAAA,KAAY,GAAA,EAAK,oBAAA,KAAyB,eAAA;AAAA;AAAA,cAc/C,kBAAA;EAAA,SACJ,KAAA,EAAK,eAAA;EAAA,SACL,UAAA,EAAU,oBAAA;AAAA;AAAA,KAGA,YAAA,GAAa,iBAAiB,QAAQ,kBAAA;;;KChJtC,KAAA;EAAA,SAA4B,OAAO;AAAA;AAAA,KAEnC,UAAA;EAAA,SAA4C,YAAY;AAAA;AAAA,KAExD,UAAA,GAAa,YAAc"}
|
package/dist/codec-types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as Ltree, r as LtreeArray, t as CodecTypes } from "./codec-types-
|
|
1
|
+
import { n as Ltree, r as LtreeArray, t as CodecTypes } from "./codec-types-Ba5cQ3bc.mjs";
|
|
2
2
|
export type { CodecTypes, Ltree, LtreeArray };
|
package/dist/control.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"mappings":";;;cAkEM,wBAAA,EAA0B,6BAA6B"}
|
package/dist/control.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as LTREE_CODEC_ID, t as LTREE_ARRAY_CODEC_ID } from "./constants-Dfknw-h5.mjs";
|
|
2
|
-
import { n as ltreeQueryOperations, t as ltreePackMeta } from "./descriptor-meta-
|
|
2
|
+
import { n as ltreeQueryOperations, t as ltreePackMeta } from "./descriptor-meta-Cc6tmP54.mjs";
|
|
3
3
|
import { contractSpaceFromJson } from "@prisma/orm-toolchain/migration-tools/spaces";
|
|
4
4
|
//#region migrations/20260619T2142_install_ltree/migration.json
|
|
5
|
-
var migration_default = {
|
|
5
|
+
var migration_default$4 = {
|
|
6
6
|
from: null,
|
|
7
7
|
to: "5842622c2779cd02acd640ab4a5c8979fc94a2af8ed034222391fbd4f7cb3706",
|
|
8
8
|
providedInvariants: ["ltree:install-ltree-v1"],
|
|
@@ -11,7 +11,7 @@ var migration_default = {
|
|
|
11
11
|
};
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region migrations/20260619T2142_install_ltree/ops.json
|
|
14
|
-
var ops_default = [{
|
|
14
|
+
var ops_default$4 = [{
|
|
15
15
|
"id": "ltree.install-ltree-extension",
|
|
16
16
|
"label": "Enable extension \"ltree\"",
|
|
17
17
|
"operationClass": "additive",
|
|
@@ -40,10 +40,183 @@ var ops_default = [{
|
|
|
40
40
|
}]
|
|
41
41
|
}];
|
|
42
42
|
//#endregion
|
|
43
|
+
//#region migrations/20261111T1904_create_ltree_extension/migration.json
|
|
44
|
+
var migration_default$3 = {
|
|
45
|
+
from: null,
|
|
46
|
+
to: "150f76958e7b1802cb3fb17b2792759d19e6aedf01f5fffa5f77565a2afe4582",
|
|
47
|
+
providedInvariants: [],
|
|
48
|
+
createdAt: "2026-11-11T19:04:24.423Z",
|
|
49
|
+
migrationHash: "1be2450ab00d5969e0a9f0fdb50daabcbf62f6768ea3a6ee92ef3a4dd6982d1c"
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region migrations/20261111T1904_create_ltree_extension/ops.json
|
|
53
|
+
var ops_default$3 = [{
|
|
54
|
+
"id": "schema.public",
|
|
55
|
+
"label": "Create schema \"public\"",
|
|
56
|
+
"operationClass": "additive",
|
|
57
|
+
"target": { "id": "postgres" },
|
|
58
|
+
"precheck": [],
|
|
59
|
+
"execute": [{
|
|
60
|
+
"description": "Create schema \"public\"",
|
|
61
|
+
"sql": "CREATE SCHEMA IF NOT EXISTS \"public\"",
|
|
62
|
+
"params": []
|
|
63
|
+
}],
|
|
64
|
+
"postcheck": []
|
|
65
|
+
}, {
|
|
66
|
+
"id": "extension.ltree",
|
|
67
|
+
"label": "Create extension \"ltree\"",
|
|
68
|
+
"operationClass": "additive",
|
|
69
|
+
"target": {
|
|
70
|
+
"id": "postgres",
|
|
71
|
+
"details": {
|
|
72
|
+
"schema": "public",
|
|
73
|
+
"objectType": "dependency",
|
|
74
|
+
"name": "ltree"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"precheck": [{
|
|
78
|
+
"description": "verify extension \"ltree\" is not installed",
|
|
79
|
+
"sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
|
|
80
|
+
"params": ["ltree"],
|
|
81
|
+
"expectation": {
|
|
82
|
+
"expects": "absent",
|
|
83
|
+
"object": "extension \"ltree\""
|
|
84
|
+
}
|
|
85
|
+
}],
|
|
86
|
+
"execute": [{
|
|
87
|
+
"description": "create extension \"ltree\"",
|
|
88
|
+
"sql": "CREATE EXTENSION IF NOT EXISTS \"ltree\" WITH SCHEMA \"public\""
|
|
89
|
+
}],
|
|
90
|
+
"postcheck": [{
|
|
91
|
+
"description": "confirm extension \"ltree\" is installed",
|
|
92
|
+
"sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
|
|
93
|
+
"params": ["ltree"],
|
|
94
|
+
"expectation": {
|
|
95
|
+
"expects": "present",
|
|
96
|
+
"object": "extension \"ltree\""
|
|
97
|
+
}
|
|
98
|
+
}]
|
|
99
|
+
}];
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region migrations/20261111T1905_declare_ltree_extension/migration.json
|
|
102
|
+
var migration_default$2 = {
|
|
103
|
+
from: "5842622c2779cd02acd640ab4a5c8979fc94a2af8ed034222391fbd4f7cb3706",
|
|
104
|
+
to: "150f76958e7b1802cb3fb17b2792759d19e6aedf01f5fffa5f77565a2afe4582",
|
|
105
|
+
providedInvariants: [],
|
|
106
|
+
createdAt: "2026-11-11T19:05:51.283Z",
|
|
107
|
+
migrationHash: "28790448876216e19e6aa7b6648ec0f101686dfdc604c377f3584f1f1588c874"
|
|
108
|
+
};
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region migrations/20261111T1905_declare_ltree_extension/ops.json
|
|
111
|
+
var ops_default$2 = [{
|
|
112
|
+
"id": "extension.ltree",
|
|
113
|
+
"label": "Create extension \"ltree\"",
|
|
114
|
+
"operationClass": "additive",
|
|
115
|
+
"target": {
|
|
116
|
+
"id": "postgres",
|
|
117
|
+
"details": {
|
|
118
|
+
"schema": "public",
|
|
119
|
+
"objectType": "dependency",
|
|
120
|
+
"name": "ltree"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"precheck": [{
|
|
124
|
+
"description": "verify extension \"ltree\" is not installed",
|
|
125
|
+
"sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
|
|
126
|
+
"params": ["ltree"],
|
|
127
|
+
"expectation": {
|
|
128
|
+
"expects": "absent",
|
|
129
|
+
"object": "extension \"ltree\""
|
|
130
|
+
}
|
|
131
|
+
}],
|
|
132
|
+
"execute": [{
|
|
133
|
+
"description": "create extension \"ltree\"",
|
|
134
|
+
"sql": "CREATE EXTENSION IF NOT EXISTS \"ltree\" WITH SCHEMA \"public\""
|
|
135
|
+
}],
|
|
136
|
+
"postcheck": [{
|
|
137
|
+
"description": "confirm extension \"ltree\" is installed",
|
|
138
|
+
"sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
|
|
139
|
+
"params": ["ltree"],
|
|
140
|
+
"expectation": {
|
|
141
|
+
"expects": "present",
|
|
142
|
+
"object": "extension \"ltree\""
|
|
143
|
+
}
|
|
144
|
+
}]
|
|
145
|
+
}];
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region migrations/20261111T1908_find_ltree_on_search_path/migration.json
|
|
148
|
+
var migration_default$1 = {
|
|
149
|
+
from: "150f76958e7b1802cb3fb17b2792759d19e6aedf01f5fffa5f77565a2afe4582",
|
|
150
|
+
to: "6db18d99f118ef4e7fd359cf8bc472b9335bf3edeeefa8a15ee11eaf7742f9fb",
|
|
151
|
+
providedInvariants: [],
|
|
152
|
+
createdAt: "2026-11-11T19:08:52.615Z",
|
|
153
|
+
migrationHash: "3ee496921e534f39e639e5d3745d87f003a238809eda1453afc798f404f71d8d"
|
|
154
|
+
};
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region migrations/20261111T1908_find_ltree_on_search_path/ops.json
|
|
157
|
+
var ops_default$1 = [];
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region migrations/20261111T1908_install_ltree_on_search_path/migration.json
|
|
160
|
+
var migration_default = {
|
|
161
|
+
from: null,
|
|
162
|
+
to: "6db18d99f118ef4e7fd359cf8bc472b9335bf3edeeefa8a15ee11eaf7742f9fb",
|
|
163
|
+
providedInvariants: [],
|
|
164
|
+
createdAt: "2026-11-11T19:08:53.983Z",
|
|
165
|
+
migrationHash: "29296a0599924fcb56de5a181f441206320676249c7d2cb4db1b3a1e6c160555"
|
|
166
|
+
};
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region migrations/20261111T1908_install_ltree_on_search_path/ops.json
|
|
169
|
+
var ops_default = [{
|
|
170
|
+
"id": "schema.public",
|
|
171
|
+
"label": "Create schema \"public\"",
|
|
172
|
+
"operationClass": "additive",
|
|
173
|
+
"target": { "id": "postgres" },
|
|
174
|
+
"precheck": [],
|
|
175
|
+
"execute": [{
|
|
176
|
+
"description": "Create schema \"public\"",
|
|
177
|
+
"sql": "CREATE SCHEMA IF NOT EXISTS \"public\"",
|
|
178
|
+
"params": []
|
|
179
|
+
}],
|
|
180
|
+
"postcheck": []
|
|
181
|
+
}, {
|
|
182
|
+
"id": "extension.ltree",
|
|
183
|
+
"label": "Create extension \"ltree\"",
|
|
184
|
+
"operationClass": "additive",
|
|
185
|
+
"target": {
|
|
186
|
+
"id": "postgres",
|
|
187
|
+
"details": {
|
|
188
|
+
"objectType": "dependency",
|
|
189
|
+
"name": "ltree"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"precheck": [{
|
|
193
|
+
"description": "verify extension \"ltree\" is not installed",
|
|
194
|
+
"sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
|
|
195
|
+
"params": ["ltree"],
|
|
196
|
+
"expectation": {
|
|
197
|
+
"expects": "absent",
|
|
198
|
+
"object": "extension \"ltree\""
|
|
199
|
+
}
|
|
200
|
+
}],
|
|
201
|
+
"execute": [{
|
|
202
|
+
"description": "create extension \"ltree\"",
|
|
203
|
+
"sql": "CREATE EXTENSION IF NOT EXISTS \"ltree\""
|
|
204
|
+
}],
|
|
205
|
+
"postcheck": [{
|
|
206
|
+
"description": "confirm extension \"ltree\" is installed",
|
|
207
|
+
"sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
|
|
208
|
+
"params": ["ltree"],
|
|
209
|
+
"expectation": {
|
|
210
|
+
"expects": "present",
|
|
211
|
+
"object": "extension \"ltree\""
|
|
212
|
+
}
|
|
213
|
+
}]
|
|
214
|
+
}];
|
|
215
|
+
//#endregion
|
|
43
216
|
//#region migrations/refs/head.json
|
|
44
217
|
var head_default = {
|
|
45
|
-
hash: "
|
|
46
|
-
invariants: [
|
|
218
|
+
hash: "6db18d99f118ef4e7fd359cf8bc472b9335bf3edeeefa8a15ee11eaf7742f9fb",
|
|
219
|
+
invariants: []
|
|
47
220
|
};
|
|
48
221
|
//#endregion
|
|
49
222
|
//#region src/contract.json
|
|
@@ -55,12 +228,25 @@ var contract_default = {
|
|
|
55
228
|
roots: {},
|
|
56
229
|
domain: { "namespaces": { "public": { "models": {} } } },
|
|
57
230
|
storage: {
|
|
58
|
-
"namespaces": {
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
231
|
+
"namespaces": {
|
|
232
|
+
"__unbound__": {
|
|
233
|
+
"entries": {
|
|
234
|
+
"extension": { "ltree": {
|
|
235
|
+
"kind": "extension",
|
|
236
|
+
"name": "ltree"
|
|
237
|
+
} },
|
|
238
|
+
"table": {}
|
|
239
|
+
},
|
|
240
|
+
"id": "__unbound__",
|
|
241
|
+
"kind": "postgres-unbound-schema"
|
|
242
|
+
},
|
|
243
|
+
"public": {
|
|
244
|
+
"entries": { "table": {} },
|
|
245
|
+
"id": "public",
|
|
246
|
+
"kind": "postgres-schema"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"storageHash": "6db18d99f118ef4e7fd359cf8bc472b9335bf3edeeefa8a15ee11eaf7742f9fb",
|
|
64
250
|
"types": {
|
|
65
251
|
"ltree": {
|
|
66
252
|
"codecId": "pg/ltree@1",
|
|
@@ -77,6 +263,8 @@ var contract_default = {
|
|
|
77
263
|
capabilities: {
|
|
78
264
|
"postgres": {
|
|
79
265
|
"distinctOn": true,
|
|
266
|
+
"forKeyShare": true,
|
|
267
|
+
"forNoKeyUpdate": true,
|
|
80
268
|
"jsonAgg": true,
|
|
81
269
|
"lateral": true,
|
|
82
270
|
"limit": true,
|
|
@@ -87,9 +275,15 @@ var contract_default = {
|
|
|
87
275
|
"checkConstraint": true,
|
|
88
276
|
"defaultInInsert": true,
|
|
89
277
|
"enums": true,
|
|
278
|
+
"forShare": true,
|
|
279
|
+
"forUpdate": true,
|
|
90
280
|
"insertOnConflictSkip": true,
|
|
281
|
+
"insertOnConflictTarget": true,
|
|
91
282
|
"insertOnConflictWithoutTarget": true,
|
|
92
283
|
"lateral": true,
|
|
284
|
+
"lockNowait": true,
|
|
285
|
+
"lockOf": true,
|
|
286
|
+
"lockSkipLocked": true,
|
|
93
287
|
"returning": true,
|
|
94
288
|
"scalarList": true
|
|
95
289
|
}
|
|
@@ -106,16 +300,42 @@ var contract_default = {
|
|
|
106
300
|
//#region src/core/contract-space-constants.ts
|
|
107
301
|
const LTREE_SPACE_ID = "ltree";
|
|
108
302
|
const LTREE_BASELINE_MIGRATION_NAME = "20260619T2142_install_ltree";
|
|
303
|
+
const LTREE_DECLARE_EXTENSION_MIGRATION_NAME = "20261111T1905_declare_ltree_extension";
|
|
304
|
+
const LTREE_CREATE_EXTENSION_MIGRATION_NAME = "20261111T1904_create_ltree_extension";
|
|
305
|
+
const LTREE_SEARCH_PATH_MIGRATION_NAME = "20261111T1908_find_ltree_on_search_path";
|
|
306
|
+
const LTREE_SEARCH_PATH_INSTALL_MIGRATION_NAME = "20261111T1908_install_ltree_on_search_path";
|
|
109
307
|
//#endregion
|
|
110
308
|
//#region src/exports/control.ts
|
|
111
309
|
const ltreeControlPlaneHooks = { resolveIdentityValue: () => null };
|
|
112
310
|
const ltreeContractSpace = contractSpaceFromJson({
|
|
113
311
|
contractJson: contract_default,
|
|
114
|
-
migrations: [
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
312
|
+
migrations: [
|
|
313
|
+
{
|
|
314
|
+
dirName: LTREE_BASELINE_MIGRATION_NAME,
|
|
315
|
+
metadata: migration_default$4,
|
|
316
|
+
ops: ops_default$4
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
dirName: LTREE_DECLARE_EXTENSION_MIGRATION_NAME,
|
|
320
|
+
metadata: migration_default$2,
|
|
321
|
+
ops: ops_default$2
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
dirName: LTREE_CREATE_EXTENSION_MIGRATION_NAME,
|
|
325
|
+
metadata: migration_default$3,
|
|
326
|
+
ops: ops_default$3
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
dirName: LTREE_SEARCH_PATH_MIGRATION_NAME,
|
|
330
|
+
metadata: migration_default$1,
|
|
331
|
+
ops: ops_default$1
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
dirName: LTREE_SEARCH_PATH_INSTALL_MIGRATION_NAME,
|
|
335
|
+
metadata: migration_default,
|
|
336
|
+
ops: ops_default
|
|
337
|
+
}
|
|
338
|
+
],
|
|
119
339
|
headRef: head_default
|
|
120
340
|
});
|
|
121
341
|
const ltreeExtensionDescriptor = {
|
package/dist/control.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.mjs","names":["baselineMetadata","baselineOps"],"sources":["../migrations/20260619T2142_install_ltree/migration.json","../migrations/20260619T2142_install_ltree/ops.json","../migrations/refs/head.json","../src/contract.json","../src/core/contract-space-constants.ts","../src/exports/control.ts"],"sourcesContent":["","","","","export const LTREE_SPACE_ID = \"ltree\" as const;\n\nexport const LTREE_NATIVE_TYPE = \"ltree\" as const;\n\n/** Contract storage.types key — must be a valid identifier for contract emit. */\nexport const LTREE_ARRAY_STORAGE_TYPE = \"ltreeArray\" as const;\n\nexport const LTREE_BASELINE_MIGRATION_NAME = \"20260619T2142_install_ltree\" as const;\n\nexport const LTREE_INVARIANTS = {\n installLtree: \"ltree:install-ltree-v1\",\n} as const;\n","import type { Contract } from \"@prisma/orm-framework/contract/types\";\nimport type {\n CodecControlHooks,\n SqlControlExtensionDescriptor,\n} from \"@prisma/orm-family-sql/family/control\";\nimport { contractSpaceFromJson } from \"@prisma/orm-toolchain/migration-tools/spaces\";\nimport type { SqlStorage } from \"@prisma/orm-family-sql/contract/types\";\nimport baselineMetadata from \"../../migrations/20260619T2142_install_ltree/migration.json\" with { type: \"json\" };\nimport baselineOps from \"../../migrations/20260619T2142_install_ltree/ops.json\" with { type: \"json\" };\nimport headRef from \"../../migrations/refs/head.json\" with { type: \"json\" };\nimport contractJson from \"../contract.json\" with { type: \"json\" };\nimport { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from \"../core/constants\";\nimport {
|
|
1
|
+
{"version":3,"file":"control.mjs","names":["baselineMetadata","baselineOps","declareMetadata","declareOps","createMetadata","createOps","searchPathMetadata","searchPathOps","searchPathInstallMetadata","searchPathInstallOps"],"sources":["../migrations/20260619T2142_install_ltree/migration.json","../migrations/20260619T2142_install_ltree/ops.json","../migrations/20261111T1904_create_ltree_extension/migration.json","../migrations/20261111T1904_create_ltree_extension/ops.json","../migrations/20261111T1905_declare_ltree_extension/migration.json","../migrations/20261111T1905_declare_ltree_extension/ops.json","../migrations/20261111T1908_find_ltree_on_search_path/migration.json","../migrations/20261111T1908_find_ltree_on_search_path/ops.json","../migrations/20261111T1908_install_ltree_on_search_path/migration.json","../migrations/20261111T1908_install_ltree_on_search_path/ops.json","../migrations/refs/head.json","../src/contract.json","../src/core/contract-space-constants.ts","../src/exports/control.ts"],"sourcesContent":["","","","","","","","","","","","","export const LTREE_SPACE_ID = \"ltree\" as const;\n\nexport const LTREE_NATIVE_TYPE = \"ltree\" as const;\n\n/** Contract storage.types key — must be a valid identifier for contract emit. */\nexport const LTREE_ARRAY_STORAGE_TYPE = \"ltreeArray\" as const;\n\nexport const LTREE_BASELINE_MIGRATION_NAME = \"20260619T2142_install_ltree\" as const;\n\nexport const LTREE_DECLARE_EXTENSION_MIGRATION_NAME =\n \"20261111T1905_declare_ltree_extension\" as const;\n\nexport const LTREE_CREATE_EXTENSION_MIGRATION_NAME =\n \"20261111T1904_create_ltree_extension\" as const;\n\nexport const LTREE_SEARCH_PATH_MIGRATION_NAME = \"20261111T1908_find_ltree_on_search_path\" as const;\n\nexport const LTREE_SEARCH_PATH_INSTALL_MIGRATION_NAME =\n \"20261111T1908_install_ltree_on_search_path\" as const;\n\nexport const LTREE_INVARIANTS = {\n installLtree: \"ltree:install-ltree-v1\",\n} as const;\n","import type { Contract } from \"@prisma/orm-framework/contract/types\";\nimport type {\n CodecControlHooks,\n SqlControlExtensionDescriptor,\n} from \"@prisma/orm-family-sql/family/control\";\nimport { contractSpaceFromJson } from \"@prisma/orm-toolchain/migration-tools/spaces\";\nimport type { SqlStorage } from \"@prisma/orm-family-sql/contract/types\";\nimport baselineMetadata from \"../../migrations/20260619T2142_install_ltree/migration.json\" with { type: \"json\" };\nimport baselineOps from \"../../migrations/20260619T2142_install_ltree/ops.json\" with { type: \"json\" };\nimport createMetadata from \"../../migrations/20261111T1904_create_ltree_extension/migration.json\" with { type: \"json\" };\nimport createOps from \"../../migrations/20261111T1904_create_ltree_extension/ops.json\" with { type: \"json\" };\nimport declareMetadata from \"../../migrations/20261111T1905_declare_ltree_extension/migration.json\" with { type: \"json\" };\nimport declareOps from \"../../migrations/20261111T1905_declare_ltree_extension/ops.json\" with { type: \"json\" };\nimport searchPathMetadata from \"../../migrations/20261111T1908_find_ltree_on_search_path/migration.json\" with { type: \"json\" };\nimport searchPathOps from \"../../migrations/20261111T1908_find_ltree_on_search_path/ops.json\" with { type: \"json\" };\nimport searchPathInstallMetadata from \"../../migrations/20261111T1908_install_ltree_on_search_path/migration.json\" with { type: \"json\" };\nimport searchPathInstallOps from \"../../migrations/20261111T1908_install_ltree_on_search_path/ops.json\" with { type: \"json\" };\nimport headRef from \"../../migrations/refs/head.json\" with { type: \"json\" };\nimport contractJson from \"../contract.json\" with { type: \"json\" };\nimport { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from \"../core/constants\";\nimport {\n LTREE_BASELINE_MIGRATION_NAME,\n LTREE_CREATE_EXTENSION_MIGRATION_NAME,\n LTREE_DECLARE_EXTENSION_MIGRATION_NAME,\n LTREE_SEARCH_PATH_INSTALL_MIGRATION_NAME,\n LTREE_SEARCH_PATH_MIGRATION_NAME,\n LTREE_SPACE_ID,\n} from \"../core/contract-space-constants\";\nimport { ltreePackMeta, ltreeQueryOperations } from \"../core/descriptor-meta\";\n\nconst ltreeControlPlaneHooks: CodecControlHooks = {\n resolveIdentityValue: () => null,\n};\n\nconst ltreeContractSpace = contractSpaceFromJson<Contract<SqlStorage>>({\n contractJson,\n migrations: [\n {\n dirName: LTREE_BASELINE_MIGRATION_NAME,\n metadata: baselineMetadata,\n ops: baselineOps,\n },\n {\n dirName: LTREE_DECLARE_EXTENSION_MIGRATION_NAME,\n metadata: declareMetadata,\n ops: declareOps,\n },\n {\n dirName: LTREE_CREATE_EXTENSION_MIGRATION_NAME,\n metadata: createMetadata,\n ops: createOps,\n },\n {\n dirName: LTREE_SEARCH_PATH_MIGRATION_NAME,\n metadata: searchPathMetadata,\n ops: searchPathOps,\n },\n {\n dirName: LTREE_SEARCH_PATH_INSTALL_MIGRATION_NAME,\n metadata: searchPathInstallMetadata,\n ops: searchPathInstallOps,\n },\n ],\n headRef,\n});\n\nconst ltreeExtensionDescriptor: SqlControlExtensionDescriptor<\"postgres\"> = {\n ...ltreePackMeta,\n id: LTREE_SPACE_ID,\n contractSpace: ltreeContractSpace,\n types: {\n ...ltreePackMeta.types,\n codecTypes: {\n ...ltreePackMeta.types.codecTypes,\n controlPlaneHooks: {\n [LTREE_CODEC_ID]: ltreeControlPlaneHooks,\n [LTREE_ARRAY_CODEC_ID]: ltreeControlPlaneHooks,\n },\n },\n },\n queryOperations: () => ltreeQueryOperations(),\n create: () => ({\n familyId: \"sql\" as const,\n targetId: \"postgres\" as const,\n }),\n};\n\nexport { ltreeExtensionDescriptor };\nexport default ltreeExtensionDescriptor;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AYAA,MAAa,iBAAiB;AAO9B,MAAa,gCAAgC;AAE7C,MAAa,yCACX;AAEF,MAAa,wCACX;AAEF,MAAa,mCAAmC;AAEhD,MAAa,2CACX;;;ACYF,MAAM,yBAA4C,EAChD,4BAA4B,KAC9B;AAEA,MAAM,qBAAqB,sBAA4C;CACrE,cAAA;CACA,YAAY;EACV;GACE,SAAS;GACT,UAAUA;GACV,KAAKC;EACP;EACA;GACE,SAAS;GACT,UAAUC;GACV,KAAKC;EACP;EACA;GACE,SAAS;GACT,UAAUC;GACV,KAAKC;EACP;EACA;GACE,SAAS;GACT,UAAUC;GACV,KAAKC;EACP;EACA;GACE,SAAS;GACT,UAAUC;GACV,KAAKC;EACP;CACF;CACA,SAAA;AACF,CAAC;AAED,MAAM,2BAAsE;CAC1E,GAAG;CACH,IAAI;CACJ,eAAe;CACf,OAAO;EACL,GAAG,cAAc;EACjB,YAAY;GACV,GAAG,cAAc,MAAM;GACvB,mBAAmB;KAChB,iBAAiB;KACjB,uBAAuB;GAC1B;EACF;CACF;CACA,uBAAuB,qBAAqB;CAC5C,eAAe;EACb,UAAU;EACV,UAAU;CACZ;AACF"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
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";
|
|
3
4
|
import { sqlDataType } from "@prisma/orm-family-sql/contract/data-type";
|
|
4
5
|
import { pgText } from "@prisma/orm-target-postgres/target/data-types";
|
|
5
6
|
import { buildCodecDescriptorRegistry } from "@prisma/orm-family-sql/relational-core/codec-descriptor-registry";
|
|
6
|
-
import {
|
|
7
|
+
import { CastExpr } from "@prisma/orm-family-sql/relational-core/ast";
|
|
7
8
|
import { PostgresCodecDescriptor, definePostgresCodecs } from "@prisma/orm-target-postgres/target/codec-descriptor";
|
|
8
9
|
//#region src/core/authoring.ts
|
|
9
10
|
const ltreeAuthoringTypes = { ltree: {
|
|
@@ -19,8 +20,32 @@ const ltreeAuthoringTypes = { ltree: {
|
|
|
19
20
|
}
|
|
20
21
|
} };
|
|
21
22
|
//#endregion
|
|
23
|
+
//#region src/core/codecs-validation.ts
|
|
24
|
+
const LABEL_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
25
|
+
function assertValidLtree(value) {
|
|
26
|
+
if (typeof value !== "string") throw new Error("ltree value must be a string");
|
|
27
|
+
if (value.length === 0) throw new Error("ltree value must not be empty");
|
|
28
|
+
const labels = value.split(".");
|
|
29
|
+
if (labels.length > 65535) throw new Error(`ltree path exceeds max labels: got ${labels.length}, max ${LTREE_MAX_LABELS}`);
|
|
30
|
+
for (const label of labels) {
|
|
31
|
+
if (label.length === 0) throw new Error(`ltree label must not be empty in path "${value}"`);
|
|
32
|
+
if (label.length > 1e3) throw new Error(`ltree label exceeds max length: got ${label.length}, max ${LTREE_MAX_LABEL_LENGTH}`);
|
|
33
|
+
if (!LABEL_PATTERN.test(label)) throw new Error(`ltree label "${label}" contains invalid characters; allowed: alphanumeric, underscore, hyphen`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
22
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
|
+
};
|
|
23
47
|
const ltreeDataType = sqlDataType("ltree/ltree", {
|
|
48
|
+
read: readLtree,
|
|
24
49
|
texts: [{
|
|
25
50
|
text: "ltree",
|
|
26
51
|
written: true,
|
|
@@ -28,15 +53,31 @@ const ltreeDataType = sqlDataType("ltree/ltree", {
|
|
|
28
53
|
}],
|
|
29
54
|
casts: { [pgText.id]: (value) => value }
|
|
30
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
|
+
};
|
|
31
69
|
/**
|
|
32
70
|
* `sqlDataType` accepts parentheses in a type name and refuses square brackets.
|
|
33
71
|
* PostgreSQL writes this type as `ltree[]`, and `format_type` reports `ltree[]`.
|
|
34
72
|
* Declare the type first, then set that text so a migration and a catalog check use it.
|
|
35
73
|
*/
|
|
36
|
-
const ltreeArrayDeclared = sqlDataType("ltree/ltree-array", {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
74
|
+
const ltreeArrayDeclared = sqlDataType("ltree/ltree-array", {
|
|
75
|
+
read: readLtreeArray,
|
|
76
|
+
listCast: {
|
|
77
|
+
of: [pgText.id],
|
|
78
|
+
cast: (elements) => [...elements]
|
|
79
|
+
}
|
|
80
|
+
});
|
|
40
81
|
const ltreeArrayDataType = {
|
|
41
82
|
...ltreeArrayDeclared,
|
|
42
83
|
sql: {
|
|
@@ -51,38 +92,29 @@ const ltreeArrayDataType = {
|
|
|
51
92
|
const ltreeDataTypes = [ltreeDataType, ltreeArrayDataType];
|
|
52
93
|
//#endregion
|
|
53
94
|
//#region src/core/codecs.ts
|
|
54
|
-
const LABEL_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
55
|
-
function assertValidLtree(value) {
|
|
56
|
-
if (typeof value !== "string") throw new Error("ltree value must be a string");
|
|
57
|
-
if (value.length === 0) throw new Error("ltree value must not be empty");
|
|
58
|
-
const labels = value.split(".");
|
|
59
|
-
if (labels.length > 65535) throw new Error(`ltree path exceeds max labels: got ${labels.length}, max ${LTREE_MAX_LABELS}`);
|
|
60
|
-
for (const label of labels) {
|
|
61
|
-
if (label.length === 0) throw new Error(`ltree label must not be empty in path "${value}"`);
|
|
62
|
-
if (label.length > 1e3) throw new Error(`ltree label exceeds max length: got ${label.length}, max ${LTREE_MAX_LABEL_LENGTH}`);
|
|
63
|
-
if (!LABEL_PATTERN.test(label)) throw new Error(`ltree label "${label}" contains invalid characters; allowed: alphanumeric, underscore, hyphen`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
95
|
var LtreeCodec = class extends CodecImpl {
|
|
67
|
-
|
|
96
|
+
constructor(descriptor) {
|
|
97
|
+
super(descriptor, ltreeDataType);
|
|
98
|
+
}
|
|
99
|
+
async toWire(value, _ctx) {
|
|
68
100
|
assertValidLtree(value);
|
|
69
101
|
return value;
|
|
70
102
|
}
|
|
71
|
-
async
|
|
103
|
+
async fromWire(wire, _ctx) {
|
|
72
104
|
return wire;
|
|
73
105
|
}
|
|
74
|
-
|
|
106
|
+
toDataTypeValue(value) {
|
|
75
107
|
assertValidLtree(value);
|
|
76
|
-
return value;
|
|
108
|
+
return this.dataTypeValueOf(value);
|
|
77
109
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return json;
|
|
110
|
+
fromDataTypeValue(value) {
|
|
111
|
+
return value.value;
|
|
81
112
|
}
|
|
82
113
|
};
|
|
83
114
|
var LtreeDescriptor = class extends PostgresCodecDescriptor {
|
|
115
|
+
jsonType = "string";
|
|
84
116
|
jsonProjection(expression) {
|
|
85
|
-
return expression;
|
|
117
|
+
return CastExpr.as(expression, "text");
|
|
86
118
|
}
|
|
87
119
|
dataType = ltreeDataType.id;
|
|
88
120
|
codecId = LTREE_CODEC_ID;
|
|
@@ -98,26 +130,28 @@ var LtreeDescriptor = class extends PostgresCodecDescriptor {
|
|
|
98
130
|
};
|
|
99
131
|
const ltreeDescriptor = new LtreeDescriptor();
|
|
100
132
|
var LtreeArrayCodec = class extends CodecImpl {
|
|
101
|
-
|
|
133
|
+
constructor(descriptor) {
|
|
134
|
+
super(descriptor, ltreeArrayDataType);
|
|
135
|
+
}
|
|
136
|
+
async toWire(value, _ctx) {
|
|
102
137
|
for (const entry of value) assertValidLtree(entry);
|
|
103
138
|
return value;
|
|
104
139
|
}
|
|
105
|
-
async
|
|
140
|
+
async fromWire(wire, _ctx) {
|
|
106
141
|
return wire;
|
|
107
142
|
}
|
|
108
|
-
|
|
143
|
+
toDataTypeValue(value) {
|
|
109
144
|
for (const entry of value) assertValidLtree(entry);
|
|
110
|
-
return [...value];
|
|
145
|
+
return this.dataTypeValueOf([...value]);
|
|
111
146
|
}
|
|
112
|
-
|
|
147
|
+
fromDataTypeValue(value) {
|
|
148
|
+
const json = value.value;
|
|
113
149
|
if (!Array.isArray(json)) return [];
|
|
114
|
-
return json.map((entry) =>
|
|
115
|
-
assertValidLtree(entry);
|
|
116
|
-
return String(entry);
|
|
117
|
-
});
|
|
150
|
+
return json.map((entry) => String(entry));
|
|
118
151
|
}
|
|
119
152
|
};
|
|
120
153
|
var LtreeArrayDescriptor = class extends PostgresCodecDescriptor {
|
|
154
|
+
jsonType = "array";
|
|
121
155
|
jsonProjection(expression) {
|
|
122
156
|
return expression;
|
|
123
157
|
}
|
|
@@ -365,4 +399,4 @@ const ltreePackMeta = {
|
|
|
365
399
|
//#endregion
|
|
366
400
|
export { ltreeQueryOperations as n, ltreeCodecRegistry as r, ltreePackMeta as t };
|
|
367
401
|
|
|
368
|
-
//# sourceMappingURL=descriptor-meta-
|
|
402
|
+
//# sourceMappingURL=descriptor-meta-Cc6tmP54.mjs.map
|