prisma-ltree 0.3.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 CHANGED
@@ -1,23 +1,25 @@
1
1
  # prisma-ltree
2
2
 
3
- A [Prisma Next](https://github.com/prisma/prisma) extension pack for PostgreSQL's
3
+ A [Prisma 8](https://www.prisma.io/docs/orm) extension pack for PostgreSQL’s
4
4
  [`ltree`](https://www.postgresql.org/docs/current/ltree.html) hierarchical-tree data type.
5
5
 
6
6
  Model category trees, org charts, taxonomies, and filesystem-like paths in Postgres and query
7
- them with type-safe, prisma-native operators — ancestor/descendant checks, `lquery`/`ltxtquery`
8
- pattern matching, path manipulation, and lowest-common-ancestor computation — without dropping to
7
+ them with type-safe operators: ancestor/descendant checks, `lquery`/`ltxtquery`
8
+ pattern matching, path manipulation, and lowest-common-ancestor computation, without dropping to
9
9
  raw SQL.
10
10
 
11
11
  ## Features
12
12
 
13
- - **`ltree` and `ltree[]` columns** — `ltree()` / `ltreeArray()` column helpers
14
- - **Hierarchy operators** — ancestor and descendant checks
15
- - **Pattern matching** — `lquery`, `lquery[]`, and `ltxtquery`
16
- - **Scalar functions** — depth, subpaths, label index, lowest common ancestor
17
- - **Concatenation & conversion** — path building and `ltree` ↔ `text` conversion
18
- - **Array first-match** — find the first matching path in an `ltree[]` column
19
- - **Baseline migration** — installs the Postgres extension via
13
+ - **`ltree` and `ltree[]` columns**: `ltree()` / `ltreeArray()` column helpers
14
+ - **Hierarchy operators**: ancestor and descendant checks
15
+ - **Pattern matching**: `lquery`, `lquery[]`, and `ltxtquery`
16
+ - **Scalar functions**: depth, subpaths, label index, lowest common ancestor
17
+ - **Concatenation & conversion**: path building and `ltree` ↔ `text` conversion
18
+ - **Array first-match**: find the first matching path in an `ltree[]` column
19
+ - **Baseline migration**: installs the Postgres extension via
20
20
  `CREATE EXTENSION IF NOT EXISTS ltree` when the pack is composed
21
+ - **GiST indexes**: author `@@index([path], type: "gist")` (Prisma 8
22
+ postgres target; default `gist_ltree_ops`)
21
23
 
22
24
  See the [feature support matrix](https://github.com/slovakian/prisma-ltree/blob/main/docs/feature-support.md)
23
25
  for what is supported, planned, or out of scope.
@@ -28,13 +30,17 @@ for what is supported, planned, or out of scope.
28
30
  pnpm add prisma-ltree
29
31
  ```
30
32
 
31
- Requires Node `>=24` and Prisma Next **`8.0.0-rc.1`** (exact `@prisma/orm-*` pins — see
32
- [versioning & compatibility](https://github.com/slovakian/prisma-ltree/blob/main/docs/prisma-next/versioning-and-compatibility.md)).
33
+ Requires Node `>=24`. This pack exact-pins `@prisma/orm-*` to **`8.0.0-rc.16`**.
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.16`. See
36
+ [versioning and compatibility](https://github.com/slovakian/prisma-ltree/blob/main/docs/prisma-next/versioning-and-compatibility.md).
33
37
 
34
- Consumer apps typically depend on the Postgres facade at the same version:
38
+ Consumer apps also depend on the Postgres facade at the same SPI version, plus the
39
+ `prisma` CLI:
35
40
 
36
41
  ```bash
37
- pnpm add @prisma/orm-postgres@8.0.0-rc.1 prisma-ltree
42
+ pnpm add @prisma/orm-postgres@8.0.0-rc.16 prisma-ltree
43
+ pnpm add -D prisma
38
44
  ```
39
45
 
40
46
  ### Agent skills (optional)
@@ -49,7 +55,7 @@ pnpm dlx skills add slovakian/prisma-ltree --all
49
55
  ## Database setup
50
56
 
51
57
  The extension ships an on-disk baseline migration that installs `ltree` when the pack is composed
52
- into an application. `prisma-next db init` / `db update` apply it automatically. The equivalent
58
+ into an application. `prisma db init` / `db update` apply it automatically. The equivalent
53
59
  manual DDL is:
54
60
 
55
61
  ```sql
@@ -58,15 +64,18 @@ CREATE EXTENSION IF NOT EXISTS ltree;
58
64
 
59
65
  ## Configuration
60
66
 
61
- Add the pack to your `prisma-next.config.ts`:
67
+ Add the pack to your `prisma.config.ts`:
62
68
 
63
69
  ```typescript
64
- import { defineConfig } from "@prisma/orm-postgres/config";
70
+ import { definePrismaConfig } from "prisma/config";
71
+ import { defineConfig as ormConfig } from "@prisma/orm-postgres/config";
65
72
  import ltree from "prisma-ltree/control";
66
73
 
67
- export default defineConfig({
68
- contract: "./src/prisma/contract.ts",
69
- extensions: [ltree],
74
+ export default definePrismaConfig({
75
+ orm: ormConfig({
76
+ contract: "./src/prisma/contract.ts",
77
+ extensions: [ltree],
78
+ }),
70
79
  });
71
80
  ```
72
81
 
@@ -74,18 +83,18 @@ export default defineConfig({
74
83
 
75
84
  ### Contract definition
76
85
 
77
- Author ltree columns in either lane — `contract.prisma` (PSL) or `contract.ts`
86
+ Author ltree columns in either lane: `contract.prisma` (PSL) or `contract.ts`
78
87
  (TypeScript). Both emit a byte-identical compiled contract.
79
88
 
80
- **PSL lane** — reference the `ltree` namespace constructors (parens required) and compose
81
- `ltree` into `extensions` in `prisma-next.config.ts`:
89
+ **PSL lane.** Reference the `ltree` namespace constructors (parens required) and compose
90
+ `ltree` into `extensions` in `prisma.config.ts`:
82
91
 
83
92
  ```prisma
84
- // contract.prisma — use prisma-next
93
+ // contract.prisma: use prisma-8
85
94
 
86
95
  types {
87
- Path = ltree.Ltree() // → pg/ltree@1 / ltree
88
- 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
89
98
  }
90
99
 
91
100
  model Page {
@@ -97,6 +106,23 @@ model Page {
97
106
  }
98
107
  ```
99
108
 
109
+ **GiST index** (recommended for ancestor / descendant / `lquery` queries):
110
+
111
+ ```prisma
112
+ model Page {
113
+ id String @id @default(uuid())
114
+ path Path
115
+
116
+ @@index([path], type: "gist")
117
+ @@map("page")
118
+ }
119
+ ```
120
+
121
+ Prisma 8 registers `gist` on the postgres target. `prisma-ltree`
122
+ does not add a second index type. See the
123
+ [indexes guide](https://prisma-ltree.procka.org/docs/indexes) for TypeScript
124
+ authoring, `ltree[]`, and operator-class limits (`siglen` is not expressible).
125
+
100
126
  **TypeScript lane**:
101
127
 
102
128
  ```typescript
@@ -204,10 +230,10 @@ const rows = await db.orm.Category.where((c) => c.path.isDescendantOf("Top.Scien
204
230
 
205
231
  Use `ltreeArray()` for `ltree[]` columns that expose these methods.
206
232
 
207
- `lcaAll` is the array form of `lca`. It is not named `lca` because prisma-next
233
+ `lcaAll` is the array form of `lca`. It is not named `lca` because Prisma 8
208
234
  keys operations by name only and rejects duplicates; scalar columns already
209
235
  expose `path.lca(other, ...)` (see ADR-005). Note it returns SQL NULL for an
210
- empty `ltree[]`, matching the first-match ops' `nullable: false` convention.
236
+ empty `ltree[]`, matching the first-match ops’ `nullable: false` convention.
211
237
 
212
238
  ## Types
213
239
 
@@ -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 targetTypes: readonly ["ltree"];
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 targetTypes: readonly ["ltree[]"];
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-ECy3aUGO.d.mts.map
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"}
@@ -1,2 +1,2 @@
1
- import { n as Ltree, r as LtreeArray, t as CodecTypes } from "./codec-types-ECy3aUGO.mjs";
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":";;;iBAIgB,KAAA,IAAS,oBAAoB;AAAA,iBAO7B,UAAA,IAAc,oBAAoB"}
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"}
@@ -1,16 +1,10 @@
1
- import { a as LTREE_ARRAY_CODEC_ID, o as LTREE_CODEC_ID, r as LTREE_NATIVE_TYPE, t as LTREE_ARRAY_NATIVE_TYPE } from "./contract-space-constants-Da9EC668.mjs";
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\";\nimport { LTREE_ARRAY_NATIVE_TYPE, LTREE_NATIVE_TYPE } from \"../core/contract-space-constants\";\n\nexport function ltree(): ColumnTypeDescriptor {\n return {\n codecId: LTREE_CODEC_ID,\n nativeType: LTREE_NATIVE_TYPE,\n } as const;\n}\n\nexport function ltreeArray(): ColumnTypeDescriptor {\n return {\n codecId: LTREE_ARRAY_CODEC_ID,\n nativeType: LTREE_ARRAY_NATIVE_TYPE,\n } as const;\n}\n"],"mappings":";;AAIA,SAAgB,QAA8B;CAC5C,OAAO;EACL,SAAS;EACT,YAAY;CACd;AACF;AAEA,SAAgB,aAAmC;CACjD,OAAO;EACL,SAAS;EACT,YAAY;CACd;AACF"}
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"}
@@ -1 +1 @@
1
- {"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"mappings":";;;cAgCM,wBAAA,EAA0B,6BAA6B"}
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 { a as LTREE_ARRAY_CODEC_ID, i as LTREE_SPACE_ID, n as LTREE_BASELINE_MIGRATION_NAME, o as LTREE_CODEC_ID } from "./contract-space-constants-Da9EC668.mjs";
2
- import { n as ltreeQueryOperations, t as ltreePackMeta } from "./descriptor-meta-D2gu1NKP.mjs";
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: "ca70941530ea2af306b38e95be66ab1deac79357bcfafb48302d07c8f2c9aa92",
7
+ to: "5842622c2779cd02acd640ab4a5c8979fc94a2af8ed034222391fbd4f7cb3706",
8
8
  providedInvariants: ["ltree:install-ltree-v1"],
9
9
  createdAt: "2026-06-19T21:42:51.612Z",
10
- migrationHash: "0a6e80c4164bc12d4e386a96b50e930db6332d220327dd771a63f2aa2e57c76b"
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: "ca70941530ea2af306b38e95be66ab1deac79357bcfafb48302d07c8f2c9aa92",
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": "ca70941530ea2af306b38e95be66ab1deac79357bcfafb48302d07c8f2c9aa92",
63
+ "storageHash": "5842622c2779cd02acd640ab4a5c8979fc94a2af8ed034222391fbd4f7cb3706",
64
64
  "types": {
65
65
  "ltree": {
66
66
  "codecId": "pg/ltree@1",
67
- "kind": "codec-instance",
68
- "nativeType": "ltree"
67
+ "dataType": "ltree/ltree",
68
+ "kind": "codec-instance"
69
69
  },
70
70
  "ltreeArray": {
71
71
  "codecId": "pg/ltree-array@1",
72
- "kind": "codec-instance",
73
- "nativeType": "ltree[]"
72
+ "dataType": "ltree/ltree-array",
73
+ "kind": "codec-instance"
74
74
  }
75
75
  }
76
76
  },
@@ -84,8 +84,11 @@ var contract_default = {
84
84
  "returning": true
85
85
  },
86
86
  "sql": {
87
+ "checkConstraint": true,
87
88
  "defaultInInsert": true,
88
89
  "enums": true,
90
+ "insertOnConflictSkip": true,
91
+ "insertOnConflictWithoutTarget": true,
89
92
  "lateral": true,
90
93
  "returning": true,
91
94
  "scalarList": true
@@ -95,16 +98,17 @@ var contract_default = {
95
98
  meta: {},
96
99
  _generated: {
97
100
  "warning": "⚠️ GENERATED FILE - DO NOT EDIT",
98
- "message": "This file is automatically generated by \"prisma-next contract emit\".",
99
- "regenerate": "To regenerate, run: prisma-next contract emit"
101
+ "message": "This file is automatically generated by \"prisma contract emit\".",
102
+ "regenerate": "To regenerate, run: prisma contract emit"
100
103
  }
101
104
  };
102
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
103
110
  //#region src/exports/control.ts
104
- const ltreeControlPlaneHooks = {
105
- expandNativeType: ({ nativeType }) => nativeType,
106
- resolveIdentityValue: () => null
107
- };
111
+ const ltreeControlPlaneHooks = { resolveIdentityValue: () => null };
108
112
  const ltreeContractSpace = contractSpaceFromJson({
109
113
  contractJson: contract_default,
110
114
  migrations: [{
@@ -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 expandNativeType: ({ nativeType }) => nativeType,\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIeA,MAAM,yBAA4C;CAChD,mBAAmB,EAAE,iBAAiB;CACtC,4BAA4B;AAC9B;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
+ {"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 { a as LTREE_ARRAY_CODEC_ID, c as LTREE_MAX_LABEL_LENGTH, o as LTREE_CODEC_ID, r as LTREE_NATIVE_TYPE, s as LTREE_MAX_LABELS, t as LTREE_ARRAY_NATIVE_TYPE } from "./contract-space-constants-Da9EC668.mjs";
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, voidParamsSchema } from "@prisma/orm-framework/components/codec";
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
- output: {
11
- codecId: LTREE_CODEC_ID,
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
- output: {
18
- codecId: LTREE_ARRAY_CODEC_ID,
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
- targetTypes = [LTREE_NATIVE_TYPE];
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
- targetTypes = [LTREE_ARRAY_NATIVE_TYPE];
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, argCodecId, self, arg) => {
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, { codecId: argCodecId })],
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", TEXT_CODEC_ID, self, pattern)
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[]", TEXT_ARRAY_CODEC_ID, self, patterns)
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", TEXT_CODEC_ID, self, query)
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-D2gu1NKP.mjs.map
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,EACj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