prisma-ltree 0.4.0 → 0.5.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 +6 -6
- package/dist/{codec-types-ECy3aUGO.d.mts → codec-types-BJE-5cwk.d.mts} +5 -8
- package/dist/codec-types-BJE-5cwk.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 +17 -14
- package/dist/control.mjs.map +1 -1
- package/dist/{descriptor-meta-D2gu1NKP.mjs → descriptor-meta-2In8FI1I.mjs} +54 -44
- package/dist/descriptor-meta-2In8FI1I.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 +9 -9
- package/src/contract.d.ts +23 -5
- package/src/contract.json +7 -5
- package/src/contract.ts +1 -7
- package/src/core/authoring.ts +2 -3
- package/src/core/codecs.ts +7 -21
- package/src/core/contract-space-constants.ts +0 -2
- package/src/core/data-types.ts +41 -0
- package/src/core/descriptor-meta.ts +12 -28
- package/src/exports/column-types.ts +0 -3
- package/src/exports/control.ts +0 -1
- 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
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.16`**.
|
|
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.16`. 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.16 prisma-ltree
|
|
43
43
|
pnpm add -D prisma
|
|
44
44
|
```
|
|
45
45
|
|
|
@@ -90,11 +90,11 @@ Author ltree columns in either lane: `contract.prisma` (PSL) or `contract.ts`
|
|
|
90
90
|
`ltree` into `extensions` in `prisma.config.ts`:
|
|
91
91
|
|
|
92
92
|
```prisma
|
|
93
|
-
// contract.prisma: use prisma
|
|
93
|
+
// contract.prisma: use prisma-8
|
|
94
94
|
|
|
95
95
|
types {
|
|
96
|
-
Path = ltree.Ltree() // → pg/ltree@1 / ltree
|
|
97
|
-
Paths = ltree.LtreeArray() // → pg/ltree-array@1 / ltree
|
|
96
|
+
Path = ltree.Ltree() // → pg/ltree@1 / ltree/ltree
|
|
97
|
+
Paths = ltree.LtreeArray() // → pg/ltree-array@1 / ltree/ltree-array
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
model Page {
|
|
@@ -2,7 +2,6 @@ import { CodecCallContext, CodecImpl, CodecInstanceContext } from "@prisma/orm-f
|
|
|
2
2
|
import { PostgresCodecDescriptor } from "@prisma/orm-target-postgres/target/codec-descriptor";
|
|
3
3
|
import { JsonValue } from "@prisma/orm-framework/contract/types";
|
|
4
4
|
import { ExtractCodecTypes, ProjectionExpr } from "@prisma/orm-family-sql/relational-core/ast";
|
|
5
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
5
|
|
|
7
6
|
//#region src/core/constants.d.ts
|
|
8
7
|
declare const LTREE_CODEC_ID: "pg/ltree@1";
|
|
@@ -16,12 +15,11 @@ declare class LtreeCodec extends CodecImpl<typeof LTREE_CODEC_ID, readonly ["equ
|
|
|
16
15
|
decodeJson(json: JsonValue): string;
|
|
17
16
|
}
|
|
18
17
|
declare class LtreeDescriptor extends PostgresCodecDescriptor<void> {
|
|
19
|
-
protected nativeType(): string;
|
|
20
18
|
protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
|
|
19
|
+
readonly dataType: import("@prisma/orm-framework/components/codec").DataTypeId;
|
|
21
20
|
readonly codecId: "pg/ltree@1";
|
|
22
21
|
readonly traits: readonly ["equality", "order"];
|
|
23
|
-
readonly
|
|
24
|
-
readonly paramsSchema: StandardSchemaV1<void>;
|
|
22
|
+
readonly paramsSchema: undefined;
|
|
25
23
|
renderOutputType(): string;
|
|
26
24
|
factory(): (ctx: CodecInstanceContext) => LtreeCodec;
|
|
27
25
|
}
|
|
@@ -32,12 +30,11 @@ declare class LtreeArrayCodec extends CodecImpl<typeof LTREE_ARRAY_CODEC_ID, rea
|
|
|
32
30
|
decodeJson(json: JsonValue): readonly string[];
|
|
33
31
|
}
|
|
34
32
|
declare class LtreeArrayDescriptor extends PostgresCodecDescriptor<void> {
|
|
35
|
-
protected nativeType(): string;
|
|
36
33
|
protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
|
|
34
|
+
readonly dataType: import("@prisma/orm-framework/components/codec").DataTypeId;
|
|
37
35
|
readonly codecId: "pg/ltree-array@1";
|
|
38
36
|
readonly traits: readonly ["equality"];
|
|
39
|
-
readonly
|
|
40
|
-
readonly paramsSchema: StandardSchemaV1<void>;
|
|
37
|
+
readonly paramsSchema: undefined;
|
|
41
38
|
renderOutputType(): string;
|
|
42
39
|
factory(): (ctx: CodecInstanceContext) => LtreeArrayCodec;
|
|
43
40
|
}
|
|
@@ -57,4 +54,4 @@ type LtreeArray = readonly string[] & {
|
|
|
57
54
|
type CodecTypes = CodecTypes$1;
|
|
58
55
|
//#endregion
|
|
59
56
|
export { Ltree as n, LtreeArray as r, CodecTypes as t };
|
|
60
|
-
//# sourceMappingURL=codec-types-
|
|
57
|
+
//# sourceMappingURL=codec-types-BJE-5cwk.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec-types-BJE-5cwk.d.mts","names":[],"sources":["../src/core/constants.ts","../src/core/codecs.ts","../src/types/codec-types.ts"],"mappings":";;;;;;cAAa,cAAA;AAAA,cAEA,oBAAA;;;cCkDA,UAAA,SAAmB,SAAA,QACvB,cAAA;EAKD,MAAA,CAAO,KAAA,UAAe,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAK/C,MAAA,CAAO,IAAA,UAAc,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAIpD,UAAA,CAAW,KAAA,WAAgB,SAAA;EAK3B,UAAA,CAAW,IAAA,EAAM,SAAA;AAAA;AAAA,cAMN,eAAA,SAAwB,uBAAA;EAAA,UAChB,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;EAKD,MAAA,CAAO,KAAA,qBAA0B,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAO1D,MAAA,CAAO,IAAA,qBAAyB,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAI/D,UAAA,CAAW,KAAA,sBAA2B,SAAA;EAOtC,UAAA,CAAW,IAAA,EAAM,SAAA;AAAA;AAAA,cAWN,oBAAA,SAA6B,uBAAA;EAAA,UACrB,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;;;KCvKtC,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-BJE-5cwk.mjs";
|
|
2
2
|
export type { CodecTypes, Ltree, LtreeArray };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column-types.d.mts","names":[],"sources":["../src/exports/column-types.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"column-types.d.mts","names":[],"sources":["../src/exports/column-types.ts"],"mappings":";;;iBAGgB,KAAA,IAAS,oBAAoB;AAAA,iBAM7B,UAAA,IAAc,oBAAoB"}
|
package/dist/column-types.mjs
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as LTREE_CODEC_ID, t as LTREE_ARRAY_CODEC_ID } from "./constants-Dfknw-h5.mjs";
|
|
2
2
|
//#region src/exports/column-types.ts
|
|
3
3
|
function ltree() {
|
|
4
|
-
return {
|
|
5
|
-
codecId: LTREE_CODEC_ID,
|
|
6
|
-
nativeType: LTREE_NATIVE_TYPE
|
|
7
|
-
};
|
|
4
|
+
return { codecId: LTREE_CODEC_ID };
|
|
8
5
|
}
|
|
9
6
|
function ltreeArray() {
|
|
10
|
-
return {
|
|
11
|
-
codecId: LTREE_ARRAY_CODEC_ID,
|
|
12
|
-
nativeType: LTREE_ARRAY_NATIVE_TYPE
|
|
13
|
-
};
|
|
7
|
+
return { codecId: LTREE_ARRAY_CODEC_ID };
|
|
14
8
|
}
|
|
15
9
|
//#endregion
|
|
16
10
|
export { ltree, ltreeArray };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column-types.mjs","names":[],"sources":["../src/exports/column-types.ts"],"sourcesContent":["import type { ColumnTypeDescriptor } from \"@prisma/orm-framework/components/codec\";\nimport { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from \"../core/constants\";\
|
|
1
|
+
{"version":3,"file":"column-types.mjs","names":[],"sources":["../src/exports/column-types.ts"],"sourcesContent":["import type { ColumnTypeDescriptor } from \"@prisma/orm-framework/components/codec\";\nimport { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from \"../core/constants\";\n\nexport function ltree(): ColumnTypeDescriptor {\n return {\n codecId: LTREE_CODEC_ID,\n } as const;\n}\n\nexport function ltreeArray(): ColumnTypeDescriptor {\n return {\n codecId: LTREE_ARRAY_CODEC_ID,\n } as const;\n}\n"],"mappings":";;AAGA,SAAgB,QAA8B;CAC5C,OAAO,EACL,SAAS,eACX;AACF;AAEA,SAAgB,aAAmC;CACjD,OAAO,EACL,SAAS,qBACX;AACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/core/constants.ts
|
|
2
|
+
const LTREE_CODEC_ID = "pg/ltree@1";
|
|
3
|
+
const LTREE_ARRAY_CODEC_ID = "pg/ltree-array@1";
|
|
4
|
+
const LTREE_MAX_LABEL_LENGTH = 1e3;
|
|
5
|
+
const LTREE_MAX_LABELS = 65535;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { LTREE_MAX_LABEL_LENGTH as i, LTREE_CODEC_ID as n, LTREE_MAX_LABELS as r, LTREE_ARRAY_CODEC_ID as t };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=constants-Dfknw-h5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-Dfknw-h5.mjs","names":[],"sources":["../src/core/constants.ts"],"sourcesContent":["export const LTREE_CODEC_ID = \"pg/ltree@1\" as const;\n\nexport const LTREE_ARRAY_CODEC_ID = \"pg/ltree-array@1\" as const;\n\nexport const LTREE_MAX_LABEL_LENGTH = 1000;\n\nexport const LTREE_MAX_LABELS = 65535;\n"],"mappings":";AAAA,MAAa,iBAAiB;AAE9B,MAAa,uBAAuB;AAEpC,MAAa,yBAAyB;AAEtC,MAAa,mBAAmB"}
|
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":";;;cA+BM,wBAAA,EAA0B,6BAA6B"}
|
package/dist/control.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as ltreeQueryOperations, t as ltreePackMeta } from "./descriptor-meta-
|
|
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-2In8FI1I.mjs";
|
|
3
3
|
import { contractSpaceFromJson } from "@prisma/orm-toolchain/migration-tools/spaces";
|
|
4
4
|
//#region migrations/20260619T2142_install_ltree/migration.json
|
|
5
5
|
var migration_default = {
|
|
6
6
|
from: null,
|
|
7
|
-
to: "
|
|
7
|
+
to: "5842622c2779cd02acd640ab4a5c8979fc94a2af8ed034222391fbd4f7cb3706",
|
|
8
8
|
providedInvariants: ["ltree:install-ltree-v1"],
|
|
9
9
|
createdAt: "2026-06-19T21:42:51.612Z",
|
|
10
|
-
migrationHash: "
|
|
10
|
+
migrationHash: "b6a76ceffc9e133502c15ed26100f9056aa259a6e330547a2490f765509b38d3"
|
|
11
11
|
};
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region migrations/20260619T2142_install_ltree/ops.json
|
|
@@ -42,7 +42,7 @@ var ops_default = [{
|
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region migrations/refs/head.json
|
|
44
44
|
var head_default = {
|
|
45
|
-
hash: "
|
|
45
|
+
hash: "5842622c2779cd02acd640ab4a5c8979fc94a2af8ed034222391fbd4f7cb3706",
|
|
46
46
|
invariants: ["ltree:install-ltree-v1"]
|
|
47
47
|
};
|
|
48
48
|
//#endregion
|
|
@@ -60,17 +60,17 @@ var contract_default = {
|
|
|
60
60
|
"id": "public",
|
|
61
61
|
"kind": "postgres-schema"
|
|
62
62
|
} },
|
|
63
|
-
"storageHash": "
|
|
63
|
+
"storageHash": "5842622c2779cd02acd640ab4a5c8979fc94a2af8ed034222391fbd4f7cb3706",
|
|
64
64
|
"types": {
|
|
65
65
|
"ltree": {
|
|
66
66
|
"codecId": "pg/ltree@1",
|
|
67
|
-
"
|
|
68
|
-
"
|
|
67
|
+
"dataType": "ltree/ltree",
|
|
68
|
+
"kind": "codec-instance"
|
|
69
69
|
},
|
|
70
70
|
"ltreeArray": {
|
|
71
71
|
"codecId": "pg/ltree-array@1",
|
|
72
|
-
"
|
|
73
|
-
"
|
|
72
|
+
"dataType": "ltree/ltree-array",
|
|
73
|
+
"kind": "codec-instance"
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
},
|
|
@@ -87,6 +87,8 @@ var contract_default = {
|
|
|
87
87
|
"checkConstraint": true,
|
|
88
88
|
"defaultInInsert": true,
|
|
89
89
|
"enums": true,
|
|
90
|
+
"insertOnConflictSkip": true,
|
|
91
|
+
"insertOnConflictWithoutTarget": true,
|
|
90
92
|
"lateral": true,
|
|
91
93
|
"returning": true,
|
|
92
94
|
"scalarList": true
|
|
@@ -101,11 +103,12 @@ var contract_default = {
|
|
|
101
103
|
}
|
|
102
104
|
};
|
|
103
105
|
//#endregion
|
|
106
|
+
//#region src/core/contract-space-constants.ts
|
|
107
|
+
const LTREE_SPACE_ID = "ltree";
|
|
108
|
+
const LTREE_BASELINE_MIGRATION_NAME = "20260619T2142_install_ltree";
|
|
109
|
+
//#endregion
|
|
104
110
|
//#region src/exports/control.ts
|
|
105
|
-
const ltreeControlPlaneHooks = {
|
|
106
|
-
expandNativeType: ({ nativeType }) => nativeType,
|
|
107
|
-
resolveIdentityValue: () => null
|
|
108
|
-
};
|
|
111
|
+
const ltreeControlPlaneHooks = { resolveIdentityValue: () => null };
|
|
109
112
|
const ltreeContractSpace = contractSpaceFromJson({
|
|
110
113
|
contractJson: contract_default,
|
|
111
114
|
migrations: [{
|
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/exports/control.ts"],"sourcesContent":["","","","","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 { LTREE_SPACE_ID, LTREE_BASELINE_MIGRATION_NAME } from \"../core/contract-space-constants\";\nimport { ltreePackMeta, ltreeQueryOperations } from \"../core/descriptor-meta\";\n\nconst ltreeControlPlaneHooks: CodecControlHooks = {\n
|
|
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 { LTREE_SPACE_ID, LTREE_BASELINE_MIGRATION_NAME } 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 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIAA,MAAa,iBAAiB;AAO9B,MAAa,gCAAgC;;;ACQ7C,MAAM,yBAA4C,EAChD,4BAA4B,KAC9B;AAEA,MAAM,qBAAqB,sBAA4C;CACrE,cAAA;CACA,YAAY,CACV;EACE,SAAS;EACT,UAAUA;EACV,KAAKC;CACP,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,26 +1,55 @@
|
|
|
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 { sqlDataType } from "@prisma/orm-family-sql/contract/data-type";
|
|
4
|
+
import { pgText } from "@prisma/orm-target-postgres/target/data-types";
|
|
3
5
|
import { buildCodecDescriptorRegistry } from "@prisma/orm-family-sql/relational-core/codec-descriptor-registry";
|
|
4
|
-
import { CodecImpl
|
|
6
|
+
import { CodecImpl } from "@prisma/orm-framework/components/codec";
|
|
5
7
|
import { PostgresCodecDescriptor, definePostgresCodecs } from "@prisma/orm-target-postgres/target/codec-descriptor";
|
|
6
8
|
//#region src/core/authoring.ts
|
|
7
9
|
const ltreeAuthoringTypes = { ltree: {
|
|
8
10
|
Ltree: {
|
|
9
11
|
kind: "typeConstructor",
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
nativeType: LTREE_NATIVE_TYPE
|
|
13
|
-
}
|
|
12
|
+
inferred: true,
|
|
13
|
+
output: { codecId: LTREE_CODEC_ID }
|
|
14
14
|
},
|
|
15
15
|
LtreeArray: {
|
|
16
16
|
kind: "typeConstructor",
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
nativeType: LTREE_ARRAY_NATIVE_TYPE
|
|
20
|
-
}
|
|
17
|
+
inferred: true,
|
|
18
|
+
output: { codecId: LTREE_ARRAY_CODEC_ID }
|
|
21
19
|
}
|
|
22
20
|
} };
|
|
23
21
|
//#endregion
|
|
22
|
+
//#region src/core/data-types.ts
|
|
23
|
+
const ltreeDataType = sqlDataType("ltree/ltree", {
|
|
24
|
+
texts: [{
|
|
25
|
+
text: "ltree",
|
|
26
|
+
written: true,
|
|
27
|
+
catalog: true
|
|
28
|
+
}],
|
|
29
|
+
casts: { [pgText.id]: (value) => value }
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* `sqlDataType` accepts parentheses in a type name and refuses square brackets.
|
|
33
|
+
* PostgreSQL writes this type as `ltree[]`, and `format_type` reports `ltree[]`.
|
|
34
|
+
* Declare the type first, then set that text so a migration and a catalog check use it.
|
|
35
|
+
*/
|
|
36
|
+
const ltreeArrayDeclared = sqlDataType("ltree/ltree-array", { listCast: {
|
|
37
|
+
of: [pgText.id],
|
|
38
|
+
cast: (elements) => [...elements]
|
|
39
|
+
} });
|
|
40
|
+
const ltreeArrayDataType = {
|
|
41
|
+
...ltreeArrayDeclared,
|
|
42
|
+
sql: {
|
|
43
|
+
...ltreeArrayDeclared.sql,
|
|
44
|
+
texts: [{
|
|
45
|
+
text: "ltree[]",
|
|
46
|
+
written: true,
|
|
47
|
+
catalog: true
|
|
48
|
+
}]
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const ltreeDataTypes = [ltreeDataType, ltreeArrayDataType];
|
|
52
|
+
//#endregion
|
|
24
53
|
//#region src/core/codecs.ts
|
|
25
54
|
const LABEL_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
26
55
|
function assertValidLtree(value) {
|
|
@@ -52,16 +81,13 @@ var LtreeCodec = class extends CodecImpl {
|
|
|
52
81
|
}
|
|
53
82
|
};
|
|
54
83
|
var LtreeDescriptor = class extends PostgresCodecDescriptor {
|
|
55
|
-
nativeType() {
|
|
56
|
-
return LTREE_NATIVE_TYPE;
|
|
57
|
-
}
|
|
58
84
|
jsonProjection(expression) {
|
|
59
85
|
return expression;
|
|
60
86
|
}
|
|
87
|
+
dataType = ltreeDataType.id;
|
|
61
88
|
codecId = LTREE_CODEC_ID;
|
|
62
89
|
traits = ["equality", "order"];
|
|
63
|
-
|
|
64
|
-
paramsSchema = voidParamsSchema;
|
|
90
|
+
paramsSchema = void 0;
|
|
65
91
|
renderOutputType() {
|
|
66
92
|
return "string";
|
|
67
93
|
}
|
|
@@ -92,16 +118,13 @@ var LtreeArrayCodec = class extends CodecImpl {
|
|
|
92
118
|
}
|
|
93
119
|
};
|
|
94
120
|
var LtreeArrayDescriptor = class extends PostgresCodecDescriptor {
|
|
95
|
-
nativeType() {
|
|
96
|
-
return LTREE_ARRAY_NATIVE_TYPE;
|
|
97
|
-
}
|
|
98
121
|
jsonProjection(expression) {
|
|
99
122
|
return expression;
|
|
100
123
|
}
|
|
124
|
+
dataType = ltreeArrayDataType.id;
|
|
101
125
|
codecId = LTREE_ARRAY_CODEC_ID;
|
|
102
126
|
traits = ["equality"];
|
|
103
|
-
|
|
104
|
-
paramsSchema = voidParamsSchema;
|
|
127
|
+
paramsSchema = void 0;
|
|
105
128
|
renderOutputType() {
|
|
106
129
|
return "readonly string[]";
|
|
107
130
|
}
|
|
@@ -136,7 +159,6 @@ const TEXT_RETURN = {
|
|
|
136
159
|
nullable: false
|
|
137
160
|
};
|
|
138
161
|
const TEXT_CODEC_ID = "pg/text@1";
|
|
139
|
-
const TEXT_ARRAY_CODEC_ID = "pg/text-array@1";
|
|
140
162
|
const INT_CODEC_ID = "pg/int4@1";
|
|
141
163
|
/**
|
|
142
164
|
* Build a function-style operation whose SQL is `fnName(self, arg0, arg1, ...)`.
|
|
@@ -153,7 +175,6 @@ function funcOp(method, fnName, returns, args) {
|
|
|
153
175
|
returns,
|
|
154
176
|
lowering: {
|
|
155
177
|
targetFamily: "sql",
|
|
156
|
-
strategy: "function",
|
|
157
178
|
template: `${fnName}(${args.map((_, i) => i === 0 ? "{{self}}" : `{{arg${i - 1}}}`).join(", ")})`
|
|
158
179
|
}
|
|
159
180
|
});
|
|
@@ -167,19 +188,20 @@ function ltreeQueryOperations() {
|
|
|
167
188
|
returns: BOOL_RETURN,
|
|
168
189
|
lowering: {
|
|
169
190
|
targetFamily: "sql",
|
|
170
|
-
strategy: "function",
|
|
171
191
|
template: `{{self}} ${operator} {{arg0}}`
|
|
172
192
|
}
|
|
173
193
|
});
|
|
174
194
|
};
|
|
175
|
-
const patternOp = (method, operator, castType,
|
|
195
|
+
const patternOp = (method, operator, castType, self, arg, many = false) => {
|
|
176
196
|
return buildOperation({
|
|
177
197
|
method,
|
|
178
|
-
args: [toExpr(self, codecOf(self)), toExpr(arg,
|
|
198
|
+
args: [toExpr(self, codecOf(self)), toExpr(arg, many ? {
|
|
199
|
+
codecId: TEXT_CODEC_ID,
|
|
200
|
+
many: true
|
|
201
|
+
} : { codecId: TEXT_CODEC_ID })],
|
|
179
202
|
returns: BOOL_RETURN,
|
|
180
203
|
lowering: {
|
|
181
204
|
targetFamily: "sql",
|
|
182
|
-
strategy: "function",
|
|
183
205
|
template: `{{self}} ${operator} ({{arg0}})::${castType}`
|
|
184
206
|
}
|
|
185
207
|
});
|
|
@@ -190,7 +212,6 @@ function ltreeQueryOperations() {
|
|
|
190
212
|
returns: LTREE_RETURN,
|
|
191
213
|
lowering: {
|
|
192
214
|
targetFamily: "sql",
|
|
193
|
-
strategy: "function",
|
|
194
215
|
template
|
|
195
216
|
}
|
|
196
217
|
});
|
|
@@ -203,7 +224,6 @@ function ltreeQueryOperations() {
|
|
|
203
224
|
returns: LTREE_RETURN,
|
|
204
225
|
lowering: {
|
|
205
226
|
targetFamily: "sql",
|
|
206
|
-
strategy: "function",
|
|
207
227
|
template
|
|
208
228
|
}
|
|
209
229
|
});
|
|
@@ -219,15 +239,15 @@ function ltreeQueryOperations() {
|
|
|
219
239
|
},
|
|
220
240
|
matchesLquery: {
|
|
221
241
|
self: { codecId: LTREE_CODEC_ID },
|
|
222
|
-
impl: (self, pattern) => patternOp("matchesLquery", "~", "lquery",
|
|
242
|
+
impl: (self, pattern) => patternOp("matchesLquery", "~", "lquery", self, pattern)
|
|
223
243
|
},
|
|
224
244
|
matchesLqueryArray: {
|
|
225
245
|
self: { codecId: LTREE_CODEC_ID },
|
|
226
|
-
impl: (self, patterns) => patternOp("matchesLqueryArray", "?", "lquery[]",
|
|
246
|
+
impl: (self, patterns) => patternOp("matchesLqueryArray", "?", "lquery[]", self, patterns, true)
|
|
227
247
|
},
|
|
228
248
|
matchesLtxtquery: {
|
|
229
249
|
self: { codecId: LTREE_CODEC_ID },
|
|
230
|
-
impl: (self, query) => patternOp("matchesLtxtquery", "@", "ltxtquery",
|
|
250
|
+
impl: (self, query) => patternOp("matchesLtxtquery", "@", "ltxtquery", self, query)
|
|
231
251
|
},
|
|
232
252
|
nlevel: {
|
|
233
253
|
self: { codecId: LTREE_CODEC_ID },
|
|
@@ -320,6 +340,7 @@ const ltreePackMeta = {
|
|
|
320
340
|
version: "0.1.0",
|
|
321
341
|
capabilities: { postgres: { "ltree.path": true } },
|
|
322
342
|
authoring: { type: ltreeAuthoringTypes },
|
|
343
|
+
dataTypes: ltreeDataTypes,
|
|
323
344
|
types: {
|
|
324
345
|
codecTypes: {
|
|
325
346
|
codecDescriptors: Array.from(ltreeCodecRegistry.values()),
|
|
@@ -338,21 +359,10 @@ const ltreePackMeta = {
|
|
|
338
359
|
package: "prisma-ltree/operation-types",
|
|
339
360
|
named: "QueryOperationTypes",
|
|
340
361
|
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
|
-
}]
|
|
362
|
+
} }
|
|
353
363
|
}
|
|
354
364
|
};
|
|
355
365
|
//#endregion
|
|
356
366
|
export { ltreeQueryOperations as n, ltreeCodecRegistry as r, ltreePackMeta as t };
|
|
357
367
|
|
|
358
|
-
//# sourceMappingURL=descriptor-meta-
|
|
368
|
+
//# sourceMappingURL=descriptor-meta-2In8FI1I.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor-meta-2In8FI1I.mjs","names":[],"sources":["../src/core/authoring.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","/**\n * Data types this extension owns.\n *\n * `ltree` and `ltree[]` are PostgreSQL types the target does not register.\n * A path's canonical form is its label text. An array's canonical 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 } 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\";\n\nexport const ltreeDataType = sqlDataType(\"ltree/ltree\", {\n texts: [{ text: \"ltree\", written: true, catalog: true }],\n casts: {\n [pgText.id]: (value) => value,\n },\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 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 type { JsonValue } from \"@prisma/orm-framework/contract/types\";\nimport {\n type CodecCallContext,\n CodecImpl,\n type CodecInstanceContext,\n type ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n} from \"@prisma/orm-framework/components/codec\";\nimport type { ExtractCodecTypes, ProjectionExpr } from \"@prisma/orm-family-sql/relational-core/ast\";\nimport {\n definePostgresCodecs,\n PostgresCodecDescriptor,\n} from \"@prisma/orm-target-postgres/target/codec-descriptor\";\nimport {\n LTREE_ARRAY_CODEC_ID,\n LTREE_CODEC_ID,\n LTREE_MAX_LABEL_LENGTH,\n LTREE_MAX_LABELS,\n} from \"./constants\";\nimport { ltreeArrayDataType, ltreeDataType } from \"./data-types\";\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\nexport class LtreeCodec extends CodecImpl<\n typeof LTREE_CODEC_ID,\n readonly [\"equality\", \"order\"],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n assertValidLtree(value);\n return value;\n }\n\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n\n encodeJson(value: string): JsonValue {\n assertValidLtree(value);\n return value;\n }\n\n decodeJson(json: JsonValue): string {\n assertValidLtree(json);\n return json;\n }\n}\n\nexport class LtreeDescriptor extends PostgresCodecDescriptor<void> {\n protected override jsonProjection(expression: ProjectionExpr): ProjectionExpr {\n // ltree's text form is already its canonical JSON string.\n return expression;\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 async encode(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 decode(wire: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]> {\n return wire;\n }\n\n encodeJson(value: readonly string[]): JsonValue {\n for (const entry of value) {\n assertValidLtree(entry);\n }\n return [...value];\n }\n\n decodeJson(json: JsonValue): readonly string[] {\n if (!Array.isArray(json)) {\n return [];\n }\n return json.map((entry) => {\n assertValidLtree(entry);\n return String(entry);\n });\n }\n}\n\nexport class LtreeArrayDescriptor extends PostgresCodecDescriptor<void> {\n protected override jsonProjection(expression: ProjectionExpr): ProjectionExpr {\n // ltree[] text form projects as a JSON string array already.\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;;;ACPA,MAAa,gBAAgB,YAAY,eAAe;CACtD,OAAO,CAAC;EAAE,MAAM;EAAS,SAAS;EAAM,SAAS;CAAK,CAAC;CACvD,OAAO,GACJ,OAAO,MAAM,UAAU,MAC1B;AACF,CAAC;;;;;;AAOD,MAAM,qBAAqB,YAAY,qBAAqB,EAC1D,UAAU;CACR,IAAI,CAAC,OAAO,EAAE;CACd,OAAO,aAAa,CAAC,GAAG,QAAQ;AAClC,EACF,CAAC;AAED,MAAa,qBAAqB;CAChC,GAAG;CACH,KAAK;EACH,GAAG,mBAAmB;EACtB,OAAO,CAAC;GAAE,MAAM;GAAW,SAAS;GAAe,SAAS;EAAc,CAAC;CAC7E;AACF;AAEA,MAAa,iBAAsC,CAAC,eAAe,kBAAkB;;;AClBrF,MAAM,gBAAgB;AAEtB,SAAgB,iBAAiB,OAAyC;CACxE,IAAI,OAAO,UAAU,UACnB,MAAM,IAAI,MAAM,8BAA8B;CAEhD,IAAI,MAAM,WAAW,GACnB,MAAM,IAAI,MAAM,+BAA+B;CAEjD,MAAM,SAAS,MAAM,MAAM,GAAG;CAC9B,IAAI,OAAO,SAAA,OACT,MAAM,IAAI,MAAM,sCAAs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,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-BJE-5cwk.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-2In8FI1I.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-2In8FI1I.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.5.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,26 @@
|
|
|
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.16",
|
|
32
|
+
"@prisma/orm-framework": "8.0.0-rc.16",
|
|
33
|
+
"@prisma/orm-toolchain": "8.0.0-rc.16",
|
|
34
34
|
"@standard-schema/spec": "^1.1.0",
|
|
35
35
|
"arktype": "^2.2.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@electric-sql/pglite": "^0.5.3",
|
|
39
|
-
"@prisma/cli-engine": "0.3
|
|
40
|
-
"@prisma/orm-postgres": "8.0.0-rc.
|
|
41
|
-
"@prisma/orm-target-postgres": "8.0.0-rc.
|
|
39
|
+
"@prisma/cli-engine": "0.6.3",
|
|
40
|
+
"@prisma/orm-postgres": "8.0.0-rc.16",
|
|
41
|
+
"@prisma/orm-target-postgres": "8.0.0-rc.16",
|
|
42
42
|
"@types/node": "^24",
|
|
43
43
|
"@typescript/native-preview": "7.0.0-dev.20260509.2",
|
|
44
44
|
"@vitest/coverage-v8": "4.1.8",
|
|
45
|
-
"prisma": "8.0.0-rc.
|
|
45
|
+
"prisma": "8.0.0-rc.21",
|
|
46
46
|
"typescript": "^5",
|
|
47
47
|
"vite-plus": "0.1.24"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@prisma/orm-target-postgres": "8.0.0-rc.
|
|
50
|
+
"@prisma/orm-target-postgres": "8.0.0-rc.16",
|
|
51
51
|
"typescript": ">=5.9"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
package/src/contract.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// ⚠️ GENERATED FILE - DO NOT EDIT
|
|
2
2
|
// This file is automatically generated by 'prisma contract emit'.
|
|
3
3
|
// To regenerate, run: prisma contract emit
|
|
4
|
-
import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types';
|
|
5
4
|
import type {
|
|
6
5
|
Bit,
|
|
7
6
|
Char,
|
|
@@ -19,9 +18,11 @@ import type {
|
|
|
19
18
|
VarBit,
|
|
20
19
|
Varchar,
|
|
21
20
|
} from '@prisma/orm-postgres/target/codec-types';
|
|
21
|
+
import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types';
|
|
22
22
|
|
|
23
23
|
import type {
|
|
24
24
|
ContractWithTypeMaps,
|
|
25
|
+
RelationKeys,
|
|
25
26
|
TypeMaps as TypeMapsType,
|
|
26
27
|
} from '@prisma/orm-postgres/family-contract/types';
|
|
27
28
|
import type {
|
|
@@ -33,14 +34,14 @@ import type {
|
|
|
33
34
|
} from '@prisma/orm-postgres/contract/types';
|
|
34
35
|
|
|
35
36
|
export type StorageHash =
|
|
36
|
-
StorageHashBase<'
|
|
37
|
+
StorageHashBase<'5842622c2779cd02acd640ab4a5c8979fc94a2af8ed034222391fbd4f7cb3706'>;
|
|
37
38
|
export type ExecutionHash = ExecutionHashBase<string>;
|
|
38
39
|
export type ProfileHash =
|
|
39
40
|
ProfileHashBase<'3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2'>;
|
|
40
41
|
|
|
41
42
|
export type CodecTypes = PgTypes;
|
|
42
43
|
export type LaneCodecTypes = CodecTypes;
|
|
43
|
-
export type QueryOperationTypes =
|
|
44
|
+
export type QueryOperationTypes = PgTargetQueryOps<CodecTypes>;
|
|
44
45
|
export type AggregateTypes = {
|
|
45
46
|
readonly avg: {
|
|
46
47
|
readonly byCodec: {
|
|
@@ -118,6 +119,10 @@ export type AggregateTypes = {
|
|
|
118
119
|
readonly output: 'pg/timestamp-temporal@1';
|
|
119
120
|
readonly nullable: true;
|
|
120
121
|
};
|
|
122
|
+
readonly 'pg/timestamptz-date@1': {
|
|
123
|
+
readonly output: 'pg/timestamptz-date@1';
|
|
124
|
+
readonly nullable: true;
|
|
125
|
+
};
|
|
121
126
|
readonly 'pg/timestamptz-string@1': {
|
|
122
127
|
readonly output: 'pg/timestamptz-string@1';
|
|
123
128
|
readonly nullable: true;
|
|
@@ -174,6 +179,10 @@ export type AggregateTypes = {
|
|
|
174
179
|
readonly output: 'pg/timestamp-temporal@1';
|
|
175
180
|
readonly nullable: true;
|
|
176
181
|
};
|
|
182
|
+
readonly 'pg/timestamptz-date@1': {
|
|
183
|
+
readonly output: 'pg/timestamptz-date@1';
|
|
184
|
+
readonly nullable: true;
|
|
185
|
+
};
|
|
177
186
|
readonly 'pg/timestamptz-string@1': {
|
|
178
187
|
readonly output: 'pg/timestamptz-string@1';
|
|
179
188
|
readonly nullable: true;
|
|
@@ -242,6 +251,13 @@ export type FieldOutputTypes = { readonly public: Record<string, never> };
|
|
|
242
251
|
export type FieldInputTypes = { readonly public: Record<string, never> };
|
|
243
252
|
export type StorageColumnTypes = { readonly public: {} };
|
|
244
253
|
export type StorageColumnInputTypes = { readonly public: {} };
|
|
254
|
+
|
|
255
|
+
export namespace Models {}
|
|
256
|
+
|
|
257
|
+
export declare const models: {
|
|
258
|
+
public: {};
|
|
259
|
+
};
|
|
260
|
+
|
|
245
261
|
export type TypeMaps = TypeMapsType<
|
|
246
262
|
CodecTypes,
|
|
247
263
|
QueryOperationTypes,
|
|
@@ -265,13 +281,13 @@ type ContractBase = Omit<
|
|
|
265
281
|
readonly ltree: {
|
|
266
282
|
readonly kind: 'codec-instance';
|
|
267
283
|
readonly codecId: 'pg/ltree@1';
|
|
268
|
-
readonly
|
|
284
|
+
readonly dataType: 'ltree/ltree';
|
|
269
285
|
readonly typeParams: Record<string, never>;
|
|
270
286
|
};
|
|
271
287
|
readonly ltreeArray: {
|
|
272
288
|
readonly kind: 'codec-instance';
|
|
273
289
|
readonly codecId: 'pg/ltree-array@1';
|
|
274
|
-
readonly
|
|
290
|
+
readonly dataType: 'ltree/ltree-array';
|
|
275
291
|
readonly typeParams: Record<string, never>;
|
|
276
292
|
};
|
|
277
293
|
};
|
|
@@ -302,6 +318,8 @@ type ContractBase = Omit<
|
|
|
302
318
|
readonly checkConstraint: true;
|
|
303
319
|
readonly defaultInInsert: true;
|
|
304
320
|
readonly enums: true;
|
|
321
|
+
readonly insertOnConflictSkip: true;
|
|
322
|
+
readonly insertOnConflictWithoutTarget: true;
|
|
305
323
|
readonly lateral: true;
|
|
306
324
|
readonly returning: true;
|
|
307
325
|
readonly scalarList: true;
|
package/src/contract.json
CHANGED
|
@@ -21,17 +21,17 @@
|
|
|
21
21
|
"kind": "postgres-schema"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"storageHash": "
|
|
24
|
+
"storageHash": "5842622c2779cd02acd640ab4a5c8979fc94a2af8ed034222391fbd4f7cb3706",
|
|
25
25
|
"types": {
|
|
26
26
|
"ltree": {
|
|
27
27
|
"codecId": "pg/ltree@1",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
28
|
+
"dataType": "ltree/ltree",
|
|
29
|
+
"kind": "codec-instance"
|
|
30
30
|
},
|
|
31
31
|
"ltreeArray": {
|
|
32
32
|
"codecId": "pg/ltree-array@1",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
33
|
+
"dataType": "ltree/ltree-array",
|
|
34
|
+
"kind": "codec-instance"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
},
|
|
@@ -48,6 +48,8 @@
|
|
|
48
48
|
"checkConstraint": true,
|
|
49
49
|
"defaultInInsert": true,
|
|
50
50
|
"enums": true,
|
|
51
|
+
"insertOnConflictSkip": true,
|
|
52
|
+
"insertOnConflictWithoutTarget": true,
|
|
51
53
|
"lateral": true,
|
|
52
54
|
"returning": true,
|
|
53
55
|
"scalarList": true
|
package/src/contract.ts
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
import { defineContract } from "@prisma/orm-postgres/contract-builder";
|
|
2
2
|
import { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from "./core/constants";
|
|
3
|
-
import {
|
|
4
|
-
LTREE_ARRAY_STORAGE_TYPE,
|
|
5
|
-
LTREE_ARRAY_NATIVE_TYPE,
|
|
6
|
-
LTREE_NATIVE_TYPE,
|
|
7
|
-
} from "./core/contract-space-constants";
|
|
3
|
+
import { LTREE_ARRAY_STORAGE_TYPE, LTREE_NATIVE_TYPE } from "./core/contract-space-constants";
|
|
8
4
|
|
|
9
5
|
export const contract = defineContract({}, () => ({
|
|
10
6
|
types: {
|
|
11
7
|
[LTREE_NATIVE_TYPE]: {
|
|
12
8
|
kind: "codec-instance",
|
|
13
9
|
codecId: LTREE_CODEC_ID,
|
|
14
|
-
nativeType: LTREE_NATIVE_TYPE,
|
|
15
10
|
typeParams: {},
|
|
16
11
|
},
|
|
17
12
|
[LTREE_ARRAY_STORAGE_TYPE]: {
|
|
18
13
|
kind: "codec-instance",
|
|
19
14
|
codecId: LTREE_ARRAY_CODEC_ID,
|
|
20
|
-
nativeType: LTREE_ARRAY_NATIVE_TYPE,
|
|
21
15
|
typeParams: {},
|
|
22
16
|
},
|
|
23
17
|
},
|
package/src/core/authoring.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import type { AuthoringTypeNamespace } from "@prisma/orm-framework/components/authoring";
|
|
2
2
|
import { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from "./constants";
|
|
3
|
-
import { LTREE_ARRAY_NATIVE_TYPE, LTREE_NATIVE_TYPE } from "./contract-space-constants";
|
|
4
3
|
|
|
5
4
|
export const ltreeAuthoringTypes = {
|
|
6
5
|
ltree: {
|
|
7
6
|
Ltree: {
|
|
8
7
|
kind: "typeConstructor",
|
|
8
|
+
inferred: true,
|
|
9
9
|
output: {
|
|
10
10
|
codecId: LTREE_CODEC_ID,
|
|
11
|
-
nativeType: LTREE_NATIVE_TYPE,
|
|
12
11
|
},
|
|
13
12
|
},
|
|
14
13
|
LtreeArray: {
|
|
15
14
|
kind: "typeConstructor",
|
|
15
|
+
inferred: true,
|
|
16
16
|
output: {
|
|
17
17
|
codecId: LTREE_ARRAY_CODEC_ID,
|
|
18
|
-
nativeType: LTREE_ARRAY_NATIVE_TYPE,
|
|
19
18
|
},
|
|
20
19
|
},
|
|
21
20
|
},
|
package/src/core/codecs.ts
CHANGED
|
@@ -6,21 +6,19 @@ import {
|
|
|
6
6
|
type ColumnHelperFor,
|
|
7
7
|
type ColumnHelperForStrict,
|
|
8
8
|
column,
|
|
9
|
-
voidParamsSchema,
|
|
10
9
|
} from "@prisma/orm-framework/components/codec";
|
|
11
10
|
import type { ExtractCodecTypes, ProjectionExpr } from "@prisma/orm-family-sql/relational-core/ast";
|
|
12
11
|
import {
|
|
13
12
|
definePostgresCodecs,
|
|
14
13
|
PostgresCodecDescriptor,
|
|
15
14
|
} from "@prisma/orm-target-postgres/target/codec-descriptor";
|
|
16
|
-
import type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
17
15
|
import {
|
|
18
16
|
LTREE_ARRAY_CODEC_ID,
|
|
19
17
|
LTREE_CODEC_ID,
|
|
20
18
|
LTREE_MAX_LABEL_LENGTH,
|
|
21
19
|
LTREE_MAX_LABELS,
|
|
22
20
|
} from "./constants";
|
|
23
|
-
import {
|
|
21
|
+
import { ltreeArrayDataType, ltreeDataType } from "./data-types";
|
|
24
22
|
|
|
25
23
|
const LABEL_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
26
24
|
|
|
@@ -79,17 +77,14 @@ export class LtreeCodec extends CodecImpl<
|
|
|
79
77
|
}
|
|
80
78
|
|
|
81
79
|
export class LtreeDescriptor extends PostgresCodecDescriptor<void> {
|
|
82
|
-
protected override nativeType(): string {
|
|
83
|
-
return LTREE_NATIVE_TYPE;
|
|
84
|
-
}
|
|
85
80
|
protected override jsonProjection(expression: ProjectionExpr): ProjectionExpr {
|
|
86
81
|
// ltree's text form is already its canonical JSON string.
|
|
87
82
|
return expression;
|
|
88
83
|
}
|
|
84
|
+
override readonly dataType = ltreeDataType.id;
|
|
89
85
|
override readonly codecId = LTREE_CODEC_ID;
|
|
90
86
|
override readonly traits = ["equality", "order"] as const;
|
|
91
|
-
override readonly
|
|
92
|
-
override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;
|
|
87
|
+
override readonly paramsSchema = undefined;
|
|
93
88
|
override renderOutputType(): string {
|
|
94
89
|
return "string";
|
|
95
90
|
}
|
|
@@ -101,8 +96,7 @@ export class LtreeDescriptor extends PostgresCodecDescriptor<void> {
|
|
|
101
96
|
|
|
102
97
|
export const ltreeDescriptor = new LtreeDescriptor();
|
|
103
98
|
|
|
104
|
-
export const ltree = () =>
|
|
105
|
-
column(ltreeDescriptor.factory(), ltreeDescriptor.codecId, undefined, LTREE_NATIVE_TYPE);
|
|
99
|
+
export const ltree = () => column(ltreeDescriptor.factory(), ltreeDescriptor.codecId, undefined);
|
|
106
100
|
|
|
107
101
|
ltree satisfies ColumnHelperFor<LtreeDescriptor>;
|
|
108
102
|
ltree satisfies ColumnHelperForStrict<LtreeDescriptor>;
|
|
@@ -143,17 +137,14 @@ export class LtreeArrayCodec extends CodecImpl<
|
|
|
143
137
|
}
|
|
144
138
|
|
|
145
139
|
export class LtreeArrayDescriptor extends PostgresCodecDescriptor<void> {
|
|
146
|
-
protected override nativeType(): string {
|
|
147
|
-
return LTREE_ARRAY_NATIVE_TYPE;
|
|
148
|
-
}
|
|
149
140
|
protected override jsonProjection(expression: ProjectionExpr): ProjectionExpr {
|
|
150
141
|
// ltree[] text form projects as a JSON string array already.
|
|
151
142
|
return expression;
|
|
152
143
|
}
|
|
144
|
+
override readonly dataType = ltreeArrayDataType.id;
|
|
153
145
|
override readonly codecId = LTREE_ARRAY_CODEC_ID;
|
|
154
146
|
override readonly traits = ["equality"] as const;
|
|
155
|
-
override readonly
|
|
156
|
-
override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;
|
|
147
|
+
override readonly paramsSchema = undefined;
|
|
157
148
|
override renderOutputType(): string {
|
|
158
149
|
return "readonly string[]";
|
|
159
150
|
}
|
|
@@ -166,12 +157,7 @@ export class LtreeArrayDescriptor extends PostgresCodecDescriptor<void> {
|
|
|
166
157
|
export const ltreeArrayDescriptor = new LtreeArrayDescriptor();
|
|
167
158
|
|
|
168
159
|
export const ltreeArray = () =>
|
|
169
|
-
column(
|
|
170
|
-
ltreeArrayDescriptor.factory(),
|
|
171
|
-
ltreeArrayDescriptor.codecId,
|
|
172
|
-
undefined,
|
|
173
|
-
LTREE_ARRAY_NATIVE_TYPE,
|
|
174
|
-
);
|
|
160
|
+
column(ltreeArrayDescriptor.factory(), ltreeArrayDescriptor.codecId, undefined);
|
|
175
161
|
|
|
176
162
|
ltreeArray satisfies ColumnHelperFor<LtreeArrayDescriptor>;
|
|
177
163
|
ltreeArray satisfies ColumnHelperForStrict<LtreeArrayDescriptor>;
|
|
@@ -2,8 +2,6 @@ export const LTREE_SPACE_ID = "ltree" as const;
|
|
|
2
2
|
|
|
3
3
|
export const LTREE_NATIVE_TYPE = "ltree" as const;
|
|
4
4
|
|
|
5
|
-
export const LTREE_ARRAY_NATIVE_TYPE = "ltree[]" as const;
|
|
6
|
-
|
|
7
5
|
/** Contract storage.types key — must be a valid identifier for contract emit. */
|
|
8
6
|
export const LTREE_ARRAY_STORAGE_TYPE = "ltreeArray" as const;
|
|
9
7
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data types this extension owns.
|
|
3
|
+
*
|
|
4
|
+
* `ltree` and `ltree[]` are PostgreSQL types the target does not register.
|
|
5
|
+
* A path's canonical form is its label text. An array's canonical form is a
|
|
6
|
+
* JSON array of those texts. Both accept text the contract can already write.
|
|
7
|
+
* The texts are what a migration writes and what the catalog reports.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { DataType } from "@prisma/orm-framework/components/codec";
|
|
11
|
+
import { sqlDataType } from "@prisma/orm-family-sql/contract/data-type";
|
|
12
|
+
import { pgText } from "@prisma/orm-target-postgres/target/data-types";
|
|
13
|
+
|
|
14
|
+
export const ltreeDataType = sqlDataType("ltree/ltree", {
|
|
15
|
+
texts: [{ text: "ltree", written: true, catalog: true }],
|
|
16
|
+
casts: {
|
|
17
|
+
[pgText.id]: (value) => value,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* `sqlDataType` accepts parentheses in a type name and refuses square brackets.
|
|
23
|
+
* PostgreSQL writes this type as `ltree[]`, and `format_type` reports `ltree[]`.
|
|
24
|
+
* Declare the type first, then set that text so a migration and a catalog check use it.
|
|
25
|
+
*/
|
|
26
|
+
const ltreeArrayDeclared = sqlDataType("ltree/ltree-array", {
|
|
27
|
+
listCast: {
|
|
28
|
+
of: [pgText.id],
|
|
29
|
+
cast: (elements) => [...elements],
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const ltreeArrayDataType = {
|
|
34
|
+
...ltreeArrayDeclared,
|
|
35
|
+
sql: {
|
|
36
|
+
...ltreeArrayDeclared.sql,
|
|
37
|
+
texts: [{ text: "ltree[]", written: true as const, catalog: true as const }],
|
|
38
|
+
},
|
|
39
|
+
} as typeof ltreeArrayDeclared;
|
|
40
|
+
|
|
41
|
+
export const ltreeDataTypes: readonly DataType[] = [ltreeDataType, ltreeArrayDataType];
|
|
@@ -10,7 +10,7 @@ import type { CodecTypes } from "../types/codec-types";
|
|
|
10
10
|
import type { QueryOperationTypes } from "../types/operation-types";
|
|
11
11
|
import { ltreeAuthoringTypes } from "./authoring";
|
|
12
12
|
import { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from "./constants";
|
|
13
|
-
import {
|
|
13
|
+
import { ltreeDataTypes } from "./data-types";
|
|
14
14
|
import { ltreeCodecRegistry } from "./registry";
|
|
15
15
|
|
|
16
16
|
type CodecTypesBase = Record<string, { readonly input: unknown; readonly output: unknown }>;
|
|
@@ -25,7 +25,6 @@ const LTREE_RETURN = { codecId: "pg/ltree@1", nullable: false } as const;
|
|
|
25
25
|
const INT_RETURN = { codecId: "pg/int4@1", nullable: false } as const;
|
|
26
26
|
const TEXT_RETURN = { codecId: "pg/text@1", nullable: false } as const;
|
|
27
27
|
const TEXT_CODEC_ID = "pg/text@1" as const;
|
|
28
|
-
const TEXT_ARRAY_CODEC_ID = "pg/text-array@1" as const;
|
|
29
28
|
const INT_CODEC_ID = "pg/int4@1" as const;
|
|
30
29
|
|
|
31
30
|
/**
|
|
@@ -49,7 +48,6 @@ function funcOp<C extends string>(
|
|
|
49
48
|
returns,
|
|
50
49
|
lowering: {
|
|
51
50
|
targetFamily: "sql",
|
|
52
|
-
strategy: "function",
|
|
53
51
|
template: `${fnName}(${placeholders})`,
|
|
54
52
|
},
|
|
55
53
|
});
|
|
@@ -74,7 +72,6 @@ export function ltreeQueryOperations<CT extends CodecTypesBase>(): QueryOperatio
|
|
|
74
72
|
returns: BOOL_RETURN,
|
|
75
73
|
lowering: {
|
|
76
74
|
targetFamily: "sql",
|
|
77
|
-
strategy: "function",
|
|
78
75
|
template: `{{self}} ${operator} {{arg0}}`,
|
|
79
76
|
},
|
|
80
77
|
});
|
|
@@ -84,18 +81,20 @@ export function ltreeQueryOperations<CT extends CodecTypesBase>(): QueryOperatio
|
|
|
84
81
|
method: string,
|
|
85
82
|
operator: string,
|
|
86
83
|
castType: string,
|
|
87
|
-
argCodecId: typeof TEXT_CODEC_ID | typeof TEXT_ARRAY_CODEC_ID,
|
|
88
84
|
self: CodecExpression<typeof LTREE_CODEC_ID, boolean, CT>,
|
|
89
85
|
arg: unknown,
|
|
86
|
+
many = false,
|
|
90
87
|
): BoolReturn => {
|
|
91
88
|
const selfCodec = codecOf(self);
|
|
92
89
|
return buildOperation({
|
|
93
90
|
method,
|
|
94
|
-
args: [
|
|
91
|
+
args: [
|
|
92
|
+
toExpr(self, selfCodec),
|
|
93
|
+
toExpr(arg, many ? { codecId: TEXT_CODEC_ID, many: true } : { codecId: TEXT_CODEC_ID }),
|
|
94
|
+
],
|
|
95
95
|
returns: BOOL_RETURN,
|
|
96
96
|
lowering: {
|
|
97
97
|
targetFamily: "sql",
|
|
98
|
-
strategy: "function",
|
|
99
98
|
template: `{{self}} ${operator} ({{arg0}})::${castType}`,
|
|
100
99
|
},
|
|
101
100
|
});
|
|
@@ -116,7 +115,7 @@ export function ltreeQueryOperations<CT extends CodecTypesBase>(): QueryOperatio
|
|
|
116
115
|
method,
|
|
117
116
|
args,
|
|
118
117
|
returns: LTREE_RETURN,
|
|
119
|
-
lowering: { targetFamily: "sql",
|
|
118
|
+
lowering: { targetFamily: "sql", template },
|
|
120
119
|
});
|
|
121
120
|
|
|
122
121
|
// Tier 3 — first-match operators on an `ltree[]` receiver (ADR-003).
|
|
@@ -136,7 +135,7 @@ export function ltreeQueryOperations<CT extends CodecTypesBase>(): QueryOperatio
|
|
|
136
135
|
method,
|
|
137
136
|
args: [toExpr(self, selfCodec), toExpr(arg, { codecId: argCodecId })],
|
|
138
137
|
returns: LTREE_RETURN,
|
|
139
|
-
lowering: { targetFamily: "sql",
|
|
138
|
+
lowering: { targetFamily: "sql", template },
|
|
140
139
|
});
|
|
141
140
|
};
|
|
142
141
|
|
|
@@ -151,18 +150,16 @@ export function ltreeQueryOperations<CT extends CodecTypesBase>(): QueryOperatio
|
|
|
151
150
|
},
|
|
152
151
|
matchesLquery: {
|
|
153
152
|
self: { codecId: LTREE_CODEC_ID },
|
|
154
|
-
impl: (self, pattern) =>
|
|
155
|
-
patternOp("matchesLquery", "~", "lquery", TEXT_CODEC_ID, self, pattern),
|
|
153
|
+
impl: (self, pattern) => patternOp("matchesLquery", "~", "lquery", self, pattern),
|
|
156
154
|
},
|
|
157
155
|
matchesLqueryArray: {
|
|
158
156
|
self: { codecId: LTREE_CODEC_ID },
|
|
159
157
|
impl: (self, patterns) =>
|
|
160
|
-
patternOp("matchesLqueryArray", "?", "lquery[]",
|
|
158
|
+
patternOp("matchesLqueryArray", "?", "lquery[]", self, patterns, true),
|
|
161
159
|
},
|
|
162
160
|
matchesLtxtquery: {
|
|
163
161
|
self: { codecId: LTREE_CODEC_ID },
|
|
164
|
-
impl: (self, query) =>
|
|
165
|
-
patternOp("matchesLtxtquery", "@", "ltxtquery", TEXT_CODEC_ID, self, query),
|
|
162
|
+
impl: (self, query) => patternOp("matchesLtxtquery", "@", "ltxtquery", self, query),
|
|
166
163
|
},
|
|
167
164
|
nlevel: {
|
|
168
165
|
self: { codecId: LTREE_CODEC_ID },
|
|
@@ -313,6 +310,7 @@ const ltreePackMetaBase = {
|
|
|
313
310
|
authoring: {
|
|
314
311
|
type: ltreeAuthoringTypes,
|
|
315
312
|
},
|
|
313
|
+
dataTypes: ltreeDataTypes,
|
|
316
314
|
types: {
|
|
317
315
|
codecTypes: {
|
|
318
316
|
codecDescriptors: Array.from(ltreeCodecRegistry.values()),
|
|
@@ -336,20 +334,6 @@ const ltreePackMetaBase = {
|
|
|
336
334
|
alias: "LtreeQueryOperationTypes",
|
|
337
335
|
},
|
|
338
336
|
},
|
|
339
|
-
storage: [
|
|
340
|
-
{
|
|
341
|
-
typeId: LTREE_CODEC_ID,
|
|
342
|
-
familyId: "sql",
|
|
343
|
-
targetId: "postgres",
|
|
344
|
-
nativeType: LTREE_NATIVE_TYPE,
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
typeId: LTREE_ARRAY_CODEC_ID,
|
|
348
|
-
familyId: "sql",
|
|
349
|
-
targetId: "postgres",
|
|
350
|
-
nativeType: LTREE_ARRAY_NATIVE_TYPE,
|
|
351
|
-
},
|
|
352
|
-
],
|
|
353
337
|
},
|
|
354
338
|
} as const;
|
|
355
339
|
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import type { ColumnTypeDescriptor } from "@prisma/orm-framework/components/codec";
|
|
2
2
|
import { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from "../core/constants";
|
|
3
|
-
import { LTREE_ARRAY_NATIVE_TYPE, LTREE_NATIVE_TYPE } from "../core/contract-space-constants";
|
|
4
3
|
|
|
5
4
|
export function ltree(): ColumnTypeDescriptor {
|
|
6
5
|
return {
|
|
7
6
|
codecId: LTREE_CODEC_ID,
|
|
8
|
-
nativeType: LTREE_NATIVE_TYPE,
|
|
9
7
|
} as const;
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
export function ltreeArray(): ColumnTypeDescriptor {
|
|
13
11
|
return {
|
|
14
12
|
codecId: LTREE_ARRAY_CODEC_ID,
|
|
15
|
-
nativeType: LTREE_ARRAY_NATIVE_TYPE,
|
|
16
13
|
} as const;
|
|
17
14
|
}
|
package/src/exports/control.ts
CHANGED
|
@@ -14,7 +14,6 @@ import { LTREE_SPACE_ID, LTREE_BASELINE_MIGRATION_NAME } from "../core/contract-
|
|
|
14
14
|
import { ltreePackMeta, ltreeQueryOperations } from "../core/descriptor-meta";
|
|
15
15
|
|
|
16
16
|
const ltreeControlPlaneHooks: CodecControlHooks = {
|
|
17
|
-
expandNativeType: ({ nativeType }) => nativeType,
|
|
18
17
|
resolveIdentityValue: () => null,
|
|
19
18
|
};
|
|
20
19
|
|
package/src/exports/runtime.ts
CHANGED
|
@@ -6,6 +6,7 @@ const ltreeRuntimeDescriptor: SqlRuntimeExtensionDescriptor<"postgres"> = {
|
|
|
6
6
|
kind: "extension" as const,
|
|
7
7
|
id: ltreePackMeta.id,
|
|
8
8
|
version: ltreePackMeta.version,
|
|
9
|
+
dataTypes: ltreePackMeta.dataTypes,
|
|
9
10
|
familyId: "sql" as const,
|
|
10
11
|
targetId: "postgres" as const,
|
|
11
12
|
types: {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codec-types-ECy3aUGO.d.mts","names":[],"sources":["../src/core/constants.ts","../src/core/codecs.ts","../src/types/codec-types.ts"],"mappings":";;;;;;;cAAa,cAAA;AAAA,cAEA,oBAAA;;;cCoDA,UAAA,SAAmB,SAAA,QACvB,cAAA;EAKD,MAAA,CAAO,KAAA,UAAe,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAK/C,MAAA,CAAO,IAAA,UAAc,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAIpD,UAAA,CAAW,KAAA,WAAgB,SAAA;EAK3B,UAAA,CAAW,IAAA,EAAM,SAAA;AAAA;AAAA,cAMN,eAAA,SAAwB,uBAAA;EAAA,UAChB,UAAA;EAAA,UAGA,cAAA,CAAe,UAAA,EAAY,cAAA,GAAiB,cAAA;EAAA,SAI7C,OAAA;EAAA,SACA,MAAA;EAAA,SACA,WAAA;EAAA,SACA,YAAA,EAAc,gBAAA;EACvB,gBAAA;EAGA,OAAA,KAAY,GAAA,EAAK,oBAAA,KAAyB,UAAA;AAAA;AAAA,cAcxC,eAAA,SAAwB,SAAA,QAC5B,oBAAA;EAKD,MAAA,CAAO,KAAA,qBAA0B,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAO1D,MAAA,CAAO,IAAA,qBAAyB,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAI/D,UAAA,CAAW,KAAA,sBAA2B,SAAA;EAOtC,UAAA,CAAW,IAAA,EAAM,SAAA;AAAA;AAAA,cAWN,oBAAA,SAA6B,uBAAA;EAAA,UACrB,UAAA;EAAA,UAGA,cAAA,CAAe,UAAA,EAAY,cAAA,GAAiB,cAAA;EAAA,SAI7C,OAAA;EAAA,SACA,MAAA;EAAA,SACA,WAAA;EAAA,SACA,YAAA,EAAc,gBAAA;EACvB,gBAAA;EAGA,OAAA,KAAY,GAAA,EAAK,oBAAA,KAAyB,eAAA;AAAA;AAAA,cAmB/C,kBAAA;EAAA,SACJ,KAAA,EAAK,eAAA;EAAA,SACL,UAAA,EAAU,oBAAA;AAAA;AAAA,KAGA,YAAA,GAAa,iBAAiB,QAAQ,kBAAA;;;KCrLtC,KAAA;EAAA,SAA4B,OAAO;AAAA;AAAA,KAEnC,UAAA;EAAA,SAA4C,YAAY;AAAA;AAAA,KAExD,UAAA,GAAa,YAAc"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//#region src/core/constants.ts
|
|
2
|
-
const LTREE_CODEC_ID = "pg/ltree@1";
|
|
3
|
-
const LTREE_ARRAY_CODEC_ID = "pg/ltree-array@1";
|
|
4
|
-
const LTREE_MAX_LABEL_LENGTH = 1e3;
|
|
5
|
-
const LTREE_MAX_LABELS = 65535;
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/core/contract-space-constants.ts
|
|
8
|
-
const LTREE_SPACE_ID = "ltree";
|
|
9
|
-
const LTREE_NATIVE_TYPE = "ltree";
|
|
10
|
-
const LTREE_ARRAY_NATIVE_TYPE = "ltree[]";
|
|
11
|
-
const LTREE_BASELINE_MIGRATION_NAME = "20260619T2142_install_ltree";
|
|
12
|
-
//#endregion
|
|
13
|
-
export { LTREE_ARRAY_CODEC_ID as a, LTREE_MAX_LABEL_LENGTH as c, LTREE_SPACE_ID as i, LTREE_BASELINE_MIGRATION_NAME as n, LTREE_CODEC_ID as o, LTREE_NATIVE_TYPE as r, LTREE_MAX_LABELS as s, LTREE_ARRAY_NATIVE_TYPE as t };
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=contract-space-constants-Da9EC668.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract-space-constants-Da9EC668.mjs","names":[],"sources":["../src/core/constants.ts","../src/core/contract-space-constants.ts"],"sourcesContent":["export const LTREE_CODEC_ID = \"pg/ltree@1\" as const;\n\nexport const LTREE_ARRAY_CODEC_ID = \"pg/ltree-array@1\" as const;\n\nexport const LTREE_MAX_LABEL_LENGTH = 1000;\n\nexport const LTREE_MAX_LABELS = 65535;\n","export const LTREE_SPACE_ID = \"ltree\" as const;\n\nexport const LTREE_NATIVE_TYPE = \"ltree\" as const;\n\nexport const LTREE_ARRAY_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"],"mappings":";AAAA,MAAa,iBAAiB;AAE9B,MAAa,uBAAuB;AAEpC,MAAa,yBAAyB;AAEtC,MAAa,mBAAmB;;;ACNhC,MAAa,iBAAiB;AAE9B,MAAa,oBAAoB;AAEjC,MAAa,0BAA0B;AAKvC,MAAa,gCAAgC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor-meta-D2gu1NKP.mjs","names":[],"sources":["../src/core/authoring.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\";\nimport { LTREE_ARRAY_NATIVE_TYPE, LTREE_NATIVE_TYPE } from \"./contract-space-constants\";\n\nexport const ltreeAuthoringTypes = {\n ltree: {\n Ltree: {\n kind: \"typeConstructor\",\n output: {\n codecId: LTREE_CODEC_ID,\n nativeType: LTREE_NATIVE_TYPE,\n },\n },\n LtreeArray: {\n kind: \"typeConstructor\",\n output: {\n codecId: LTREE_ARRAY_CODEC_ID,\n nativeType: LTREE_ARRAY_NATIVE_TYPE,\n },\n },\n },\n} as const satisfies AuthoringTypeNamespace;\n","import type { JsonValue } from \"@prisma/orm-framework/contract/types\";\nimport {\n type CodecCallContext,\n CodecImpl,\n type CodecInstanceContext,\n type ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n voidParamsSchema,\n} from \"@prisma/orm-framework/components/codec\";\nimport type { ExtractCodecTypes, ProjectionExpr } from \"@prisma/orm-family-sql/relational-core/ast\";\nimport {\n definePostgresCodecs,\n PostgresCodecDescriptor,\n} from \"@prisma/orm-target-postgres/target/codec-descriptor\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport {\n LTREE_ARRAY_CODEC_ID,\n LTREE_CODEC_ID,\n LTREE_MAX_LABEL_LENGTH,\n LTREE_MAX_LABELS,\n} from \"./constants\";\nimport { LTREE_ARRAY_NATIVE_TYPE, LTREE_NATIVE_TYPE } from \"./contract-space-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\nexport class LtreeCodec extends CodecImpl<\n typeof LTREE_CODEC_ID,\n readonly [\"equality\", \"order\"],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n assertValidLtree(value);\n return value;\n }\n\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n\n encodeJson(value: string): JsonValue {\n assertValidLtree(value);\n return value;\n }\n\n decodeJson(json: JsonValue): string {\n assertValidLtree(json);\n return json;\n }\n}\n\nexport class LtreeDescriptor extends PostgresCodecDescriptor<void> {\n protected override nativeType(): string {\n return LTREE_NATIVE_TYPE;\n }\n protected override jsonProjection(expression: ProjectionExpr): ProjectionExpr {\n // ltree's text form is already its canonical JSON string.\n return expression;\n }\n override readonly codecId = LTREE_CODEC_ID;\n override readonly traits = [\"equality\", \"order\"] as const;\n override readonly targetTypes = [LTREE_NATIVE_TYPE] as const;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\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 = () =>\n column(ltreeDescriptor.factory(), ltreeDescriptor.codecId, undefined, LTREE_NATIVE_TYPE);\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 async encode(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 decode(wire: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]> {\n return wire;\n }\n\n encodeJson(value: readonly string[]): JsonValue {\n for (const entry of value) {\n assertValidLtree(entry);\n }\n return [...value];\n }\n\n decodeJson(json: JsonValue): readonly string[] {\n if (!Array.isArray(json)) {\n return [];\n }\n return json.map((entry) => {\n assertValidLtree(entry);\n return String(entry);\n });\n }\n}\n\nexport class LtreeArrayDescriptor extends PostgresCodecDescriptor<void> {\n protected override nativeType(): string {\n return LTREE_ARRAY_NATIVE_TYPE;\n }\n protected override jsonProjection(expression: ProjectionExpr): ProjectionExpr {\n // ltree[] text form projects as a JSON string array already.\n return expression;\n }\n override readonly codecId = LTREE_ARRAY_CODEC_ID;\n override readonly traits = [\"equality\"] as const;\n override readonly targetTypes = [LTREE_ARRAY_NATIVE_TYPE] as const;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\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(\n ltreeArrayDescriptor.factory(),\n ltreeArrayDescriptor.codecId,\n undefined,\n LTREE_ARRAY_NATIVE_TYPE,\n );\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 { LTREE_ARRAY_NATIVE_TYPE, LTREE_NATIVE_TYPE } from \"./contract-space-constants\";\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 TEXT_ARRAY_CODEC_ID = \"pg/text-array@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 strategy: \"function\",\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 strategy: \"function\",\n template: `{{self}} ${operator} {{arg0}}`,\n },\n });\n };\n\n const patternOp = (\n method: string,\n operator: string,\n castType: string,\n argCodecId: typeof TEXT_CODEC_ID | typeof TEXT_ARRAY_CODEC_ID,\n self: CodecExpression<typeof LTREE_CODEC_ID, boolean, CT>,\n arg: unknown,\n ): BoolReturn => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method,\n args: [toExpr(self, selfCodec), toExpr(arg, { codecId: argCodecId })],\n returns: BOOL_RETURN,\n lowering: {\n targetFamily: \"sql\",\n strategy: \"function\",\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\", strategy: \"function\", 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\", strategy: \"function\", 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) =>\n patternOp(\"matchesLquery\", \"~\", \"lquery\", TEXT_CODEC_ID, self, pattern),\n },\n matchesLqueryArray: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, patterns) =>\n patternOp(\"matchesLqueryArray\", \"?\", \"lquery[]\", TEXT_ARRAY_CODEC_ID, self, patterns),\n },\n matchesLtxtquery: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, query) =>\n patternOp(\"matchesLtxtquery\", \"@\", \"ltxtquery\", TEXT_CODEC_ID, 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 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 storage: [\n {\n typeId: LTREE_CODEC_ID,\n familyId: \"sql\",\n targetId: \"postgres\",\n nativeType: LTREE_NATIVE_TYPE,\n },\n {\n typeId: LTREE_ARRAY_CODEC_ID,\n familyId: \"sql\",\n targetId: \"postgres\",\n nativeType: LTREE_ARRAY_NATIVE_TYPE,\n },\n ],\n },\n} as const;\n\nexport const ltreePackMeta: typeof ltreePackMetaBase & {\n readonly __codecTypes?: CodecTypes;\n} = ltreePackMetaBase;\n"],"mappings":";;;;;;AAIA,MAAa,sBAAsB,EACjC,OAAO;CACL,OAAO;EACL,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;EACd;CACF;CACA,YAAY;EACV,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;EACd;CACF;AACF,EACF;;;ACGA,MAAM,gBAAgB;AAEtB,SAAgB,iBAAiB,OAAyC;CACxE,IAAI,OAAO,UAAU,UACnB,MAAM,IAAI,MAAM,8BAA8B;CAEhD,IAAI,MAAM,WAAW,GACnB,MAAM,IAAI,MAAM,+BAA+B;CAEjD,MAAM,SAAS,MAAM,MAAM,GAAG;CAC9B,IAAI,OAAO,SAAA,OACT,MAAM,IAAI,MAAM,sCAAsC,OAAO,OAAO,QAAQ,kBAAkB;CAEhG,KAAK,MAAM,SAAS,QAAQ;EAC1B,IAAI,MAAM,WAAW,GACnB,MAAM,IAAI,MAAM,0CAA0C,MAAM,EAAE;EAEpE,IAAI,MAAM,SAAA,KACR,MAAM,IAAI,MACR,uCAAuC,MAAM,OAAO,QAAQ,wBAC9D;EAEF,IAAI,CAAC,cAAc,KAAK,KAAK,GAC3B,MAAM,IAAI,MACR,gBAAgB,MAAM,yEACxB;CAEJ;AACF;AAEA,IAAa,aAAb,cAAgC,UAK9B;CACA,MAAM,OAAO,OAAe,MAAyC;EACnE,iBAAiB,KAAK;EACtB,OAAO;CACT;CAEA,MAAM,OAAO,MAAc,MAAyC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