prisma-ltree 0.5.0 → 0.7.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.
Files changed (35) hide show
  1. package/README.md +41 -8
  2. package/dist/{codec-types-BJE-5cwk.d.mts → codec-types-B0DtEnU6.d.mts} +16 -13
  3. package/dist/codec-types-B0DtEnU6.d.mts.map +1 -0
  4. package/dist/codec-types.d.mts +1 -1
  5. package/dist/control.d.mts.map +1 -1
  6. package/dist/control.mjs +236 -16
  7. package/dist/control.mjs.map +1 -1
  8. package/dist/{descriptor-meta-2In8FI1I.mjs → descriptor-meta-DwbFei9y.mjs} +341 -34
  9. package/dist/descriptor-meta-DwbFei9y.mjs.map +1 -0
  10. package/dist/{operation-types-8su4lbK-.d.mts → operation-types-DD-KyBms.d.mts} +46 -1
  11. package/dist/{operation-types-8su4lbK-.d.mts.map → operation-types-DD-KyBms.d.mts.map} +1 -1
  12. package/dist/operation-types.d.mts +1 -1
  13. package/dist/pack.d.mts +1 -1
  14. package/dist/pack.d.mts.map +1 -1
  15. package/dist/pack.mjs +1 -1
  16. package/dist/runtime.d.mts +35 -1
  17. package/dist/runtime.d.mts.map +1 -1
  18. package/dist/runtime.mjs +34 -1
  19. package/dist/runtime.mjs.map +1 -1
  20. package/package.json +11 -10
  21. package/src/contract.d.ts +87 -20
  22. package/src/contract.json +22 -1
  23. package/src/contract.ts +21 -3
  24. package/src/core/codecs-validation.ts +31 -0
  25. package/src/core/codecs.ts +32 -55
  26. package/src/core/contract-space-constants.ts +11 -0
  27. package/src/core/data-types.ts +36 -2
  28. package/src/core/descriptor-meta.ts +64 -4
  29. package/src/core/hierarchy-collection-methods.ts +111 -0
  30. package/src/core/pattern-validation.ts +313 -0
  31. package/src/exports/control.ts +36 -1
  32. package/src/exports/runtime.ts +3 -0
  33. package/src/types/operation-types.ts +37 -0
  34. package/dist/codec-types-BJE-5cwk.d.mts.map +0 -1
  35. package/dist/descriptor-meta-2In8FI1I.mjs.map +0 -1
package/README.md CHANGED
@@ -12,10 +12,12 @@ raw SQL.
12
12
 
13
13
  - **`ltree` and `ltree[]` columns**: `ltree()` / `ltreeArray()` column helpers
14
14
  - **Hierarchy operators**: ancestor and descendant checks
15
+ - **ORM collection helpers**: `using.{field}_descendants` / `using.{field}_ancestors` (pgvector-style)
15
16
  - **Pattern matching**: `lquery`, `lquery[]`, and `ltxtquery`
16
17
  - **Scalar functions**: depth, subpaths, label index, lowest common ancestor
17
18
  - **Concatenation & conversion**: path building and `ltree` ↔ `text` conversion
18
19
  - **Array first-match**: find the first matching path in an `ltree[]` column
20
+ - **Array boolean checks**: existence predicates on `ltree[]` (`containsAncestorOf`, `matchesAnyLquery`, …)
19
21
  - **Baseline migration**: installs the Postgres extension via
20
22
  `CREATE EXTENSION IF NOT EXISTS ltree` when the pack is composed
21
23
  - **GiST indexes**: author `@@index([path], type: "gist")` (Prisma 8
@@ -30,16 +32,16 @@ for what is supported, planned, or out of scope.
30
32
  pnpm add prisma-ltree
31
33
  ```
32
34
 
33
- Requires Node `>=24`. This pack exact-pins `@prisma/orm-*` to **`8.0.0-rc.16`**.
35
+ Requires Node `>=24`. This pack exact-pins `@prisma/orm-*` to **`8.0.0-rc.23`**.
34
36
  `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
37
+ You do not need `prisma-ltree@8.0.0-rc.23`. See
36
38
  [versioning and compatibility](https://github.com/slovakian/prisma-ltree/blob/main/docs/prisma-next/versioning-and-compatibility.md).
37
39
 
38
40
  Consumer apps also depend on the Postgres facade at the same SPI version, plus the
39
41
  `prisma` CLI:
40
42
 
41
43
  ```bash
42
- pnpm add @prisma/orm-postgres@8.0.0-rc.16 prisma-ltree
44
+ pnpm add @prisma/orm-postgres@8.0.0-rc.23 prisma-ltree
43
45
  pnpm add -D prisma
44
46
  ```
45
47
 
@@ -98,7 +100,7 @@ types {
98
100
  }
99
101
 
100
102
  model Page {
101
- id String @id @default(uuid())
103
+ id String @id @onCreate(uuid())
102
104
  path Path
103
105
  breadcrumbs Paths
104
106
 
@@ -110,7 +112,7 @@ model Page {
110
112
 
111
113
  ```prisma
112
114
  model Page {
113
- id String @id @default(uuid())
115
+ id String @id @onCreate(uuid())
114
116
  path Path
115
117
 
116
118
  @@index([path], type: "gist")
@@ -134,12 +136,12 @@ export const contract = defineContract(
134
136
  {
135
137
  extensions: { ltree: ltreePack },
136
138
  },
137
- ({ field, model }) => ({
139
+ ({ field, model, type }) => ({
138
140
  models: {
139
141
  Category: model("Category", {
140
142
  fields: {
141
- id: field.id.int(),
142
- name: field.string(),
143
+ id: field.column(type.Int()).id(),
144
+ name: field.column(type.String()),
143
145
  path: field.column(ltree()),
144
146
  },
145
147
  }).sql({ table: "category" }),
@@ -174,6 +176,12 @@ const rows = await db.orm.Category.where((c) => c.path.isDescendantOf("Top.Scien
174
176
  depth: (c) => c.path.nlevel(),
175
177
  })
176
178
  .all();
179
+
180
+ // Same filter via the ORM collection helper (pgvector-style `using`)
181
+ const underScience = await db.orm.Category.using
182
+ .path_descendants("Top.Science")
183
+ .select("id", "path")
184
+ .all();
177
185
  ```
178
186
 
179
187
  ## Operations
@@ -185,6 +193,16 @@ const rows = await db.orm.Category.where((c) => c.path.isDescendantOf("Top.Scien
185
193
  | `path.isAncestorOf(rhs)` | `ltree @> ltree` |
186
194
  | `path.isDescendantOf(rhs)` | `ltree <@ ltree` |
187
195
 
196
+ ### ORM collection helpers (`using`)
197
+
198
+ | Method | Same as |
199
+ | ------------------------------ | -------------------------------------------- |
200
+ | `using.path_descendants(root)` | `.where((r) => r.path.isDescendantOf(root))` |
201
+ | `using.path_ancestors(leaf)` | `.where((r) => r.path.isAncestorOf(leaf))` |
202
+
203
+ One pair per scalar `ltree` field. Not emitted for `ltree[]`. No `_subtree`
204
+ alias (that is `_descendants`).
205
+
188
206
  ### Pattern matching (→ boolean)
189
207
 
190
208
  | Method | SQL | Arg |
@@ -228,6 +246,21 @@ const rows = await db.orm.Category.where((c) => c.path.isDescendantOf("Top.Scien
228
246
  | `paths.firstMatchLtxtquery(query)` | `ltree[] ?@ ltxtquery` |
229
247
  | `paths.lcaAll()` | `lca(ltree[])` |
230
248
 
249
+ ### Array boolean checks (→ boolean, receiver `ltree[]`)
250
+
251
+ | Method | SQL |
252
+ | --------------------------------------- | --------------------- |
253
+ | `paths.containsAncestorOf(rhs)` | `ltree[] @> ltree` |
254
+ | `paths.containsDescendantOf(rhs)` | `ltree[] <@ ltree` |
255
+ | `paths.matchesAnyLquery(pattern)` | `ltree[] ~ lquery` |
256
+ | `paths.matchesAnyLqueryArray(patterns)` | `ltree[] ? lquery[]` |
257
+ | `paths.matchesAnyLtxtquery(query)` | `ltree[] @ ltxtquery` |
258
+
259
+ Names differ from the scalar methods (`isAncestorOf`, `matchesLquery`, …) because
260
+ Prisma 8 keys operations by name only. A GiST index on an `ltree[]` column serves
261
+ `containsDescendantOf` and the three `matchesAny*` methods; it does not serve
262
+ `containsAncestorOf` (see ADR-007).
263
+
231
264
  Use `ltreeArray()` for `ltree[]` columns that expose these methods.
232
265
 
233
266
  `lcaAll` is the array form of `lca`. It is not named `lca` because Prisma 8
@@ -1,7 +1,6 @@
1
- import { CodecCallContext, CodecImpl, CodecInstanceContext } from "@prisma/orm-framework/components/codec";
2
- import { PostgresCodecDescriptor } from "@prisma/orm-target-postgres/target/codec-descriptor";
3
- import { JsonValue } from "@prisma/orm-framework/contract/types";
1
+ import { AnyCodecDescriptor, CodecCallContext, CodecImpl, CodecInstanceContext, DataTypeValue } from "@prisma/orm-framework/components/codec";
4
2
  import { ExtractCodecTypes, ProjectionExpr } from "@prisma/orm-family-sql/relational-core/ast";
3
+ import { PostgresCodecDescriptor } from "@prisma/orm-target-postgres/target/codec-descriptor";
5
4
 
6
5
  //#region src/core/constants.d.ts
7
6
  declare const LTREE_CODEC_ID: "pg/ltree@1";
@@ -9,12 +8,14 @@ declare const LTREE_ARRAY_CODEC_ID: "pg/ltree-array@1";
9
8
  //#endregion
10
9
  //#region src/core/codecs.d.ts
11
10
  declare class LtreeCodec extends CodecImpl<typeof LTREE_CODEC_ID, readonly ["equality", "order"], string, string> {
12
- encode(value: string, _ctx: CodecCallContext): Promise<string>;
13
- decode(wire: string, _ctx: CodecCallContext): Promise<string>;
14
- encodeJson(value: string): JsonValue;
15
- decodeJson(json: JsonValue): string;
11
+ constructor(descriptor: AnyCodecDescriptor);
12
+ toWire(value: string, _ctx: CodecCallContext): Promise<string>;
13
+ fromWire(wire: string, _ctx: CodecCallContext): Promise<string>;
14
+ toDataTypeValue(value: string): DataTypeValue;
15
+ fromDataTypeValue(value: DataTypeValue): string;
16
16
  }
17
17
  declare class LtreeDescriptor extends PostgresCodecDescriptor<void> {
18
+ readonly jsonType: "string";
18
19
  protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
19
20
  readonly dataType: import("@prisma/orm-framework/components/codec").DataTypeId;
20
21
  readonly codecId: "pg/ltree@1";
@@ -24,12 +25,14 @@ declare class LtreeDescriptor extends PostgresCodecDescriptor<void> {
24
25
  factory(): (ctx: CodecInstanceContext) => LtreeCodec;
25
26
  }
26
27
  declare class LtreeArrayCodec extends CodecImpl<typeof LTREE_ARRAY_CODEC_ID, readonly ["equality"], readonly string[], readonly string[]> {
27
- encode(value: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]>;
28
- decode(wire: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]>;
29
- encodeJson(value: readonly string[]): JsonValue;
30
- decodeJson(json: JsonValue): readonly string[];
28
+ constructor(descriptor: AnyCodecDescriptor);
29
+ toWire(value: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]>;
30
+ fromWire(wire: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]>;
31
+ toDataTypeValue(value: readonly string[]): DataTypeValue;
32
+ fromDataTypeValue(value: DataTypeValue): readonly string[];
31
33
  }
32
34
  declare class LtreeArrayDescriptor extends PostgresCodecDescriptor<void> {
35
+ readonly jsonType: "array";
33
36
  protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
34
37
  readonly dataType: import("@prisma/orm-framework/components/codec").DataTypeId;
35
38
  readonly codecId: "pg/ltree-array@1";
@@ -53,5 +56,5 @@ type LtreeArray = readonly string[] & {
53
56
  };
54
57
  type CodecTypes = CodecTypes$1;
55
58
  //#endregion
56
- export { Ltree as n, LtreeArray as r, CodecTypes as t };
57
- //# sourceMappingURL=codec-types-BJE-5cwk.d.mts.map
59
+ export { LTREE_CODEC_ID as i, Ltree as n, LtreeArray as r, CodecTypes as t };
60
+ //# sourceMappingURL=codec-types-B0DtEnU6.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-types-B0DtEnU6.d.mts","names":[],"sources":["../src/core/constants.ts","../src/core/codecs.ts","../src/types/codec-types.ts"],"mappings":";;;;;cAAa,cAAA;AAAA,cAEA,oBAAA;;;cCoBA,UAAA,SAAmB,SAAA,QACvB,cAAA;EAKP,WAAA,CAAY,UAAA,EAAY,kBAAA;EAIlB,MAAA,CAAO,KAAA,UAAe,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAK/C,QAAA,CAAS,IAAA,UAAc,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAItD,eAAA,CAAgB,KAAA,WAAgB,aAAA;EAKhC,iBAAA,CAAkB,KAAA,EAAO,aAAA;AAAA;AAAA,cAKd,eAAA,SAAwB,uBAAA;EAAA,SACjB,QAAA;EAAA,UACC,cAAA,CAAe,UAAA,EAAY,cAAA,GAAiB,cAAA;EAAA,SAI7C,QAAA,mDAAQ,UAAA;EAAA,SACR,OAAA;EAAA,SACA,MAAA;EAAA,SACA,YAAA;EACT,gBAAA;EAGA,OAAA,KAAY,GAAA,EAAK,oBAAA,KAAyB,UAAA;AAAA;AAAA,cAaxC,eAAA,SAAwB,SAAA,QAC5B,oBAAA;EAKP,WAAA,CAAY,UAAA,EAAY,kBAAA;EAIlB,MAAA,CAAO,KAAA,qBAA0B,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAO1D,QAAA,CAAS,IAAA,qBAAyB,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAIjE,eAAA,CAAgB,KAAA,sBAA2B,aAAA;EAO3C,iBAAA,CAAkB,KAAA,EAAO,aAAA;AAAA;AAAA,cASd,oBAAA,SAA6B,uBAAA;EAAA,SACtB,QAAA;EAAA,UACC,cAAA,CAAe,UAAA,EAAY,cAAA,GAAiB,cAAA;EAAA,SAI7C,QAAA,mDAAQ,UAAA;EAAA,SACR,OAAA;EAAA,SACA,MAAA;EAAA,SACA,YAAA;EACT,gBAAA;EAGA,OAAA,KAAY,GAAA,EAAK,oBAAA,KAAyB,eAAA;AAAA;AAAA,cAc/C,kBAAA;EAAA,SACJ,KAAA,EAAK,eAAA;EAAA,SACL,UAAA,EAAU,oBAAA;AAAA;AAAA,KAGA,YAAA,GAAa,iBAAiB,QAAQ,kBAAA;;;KChJtC,KAAA;EAAA,SAA4B,OAAO;AAAA;AAAA,KAEnC,UAAA;EAAA,SAA4C,YAAY;AAAA;AAAA,KAExD,UAAA,GAAa,YAAc"}
@@ -1,2 +1,2 @@
1
- import { n as Ltree, r as LtreeArray, t as CodecTypes } from "./codec-types-BJE-5cwk.mjs";
1
+ import { n as Ltree, r as LtreeArray, t as CodecTypes } from "./codec-types-B0DtEnU6.mjs";
2
2
  export type { CodecTypes, Ltree, LtreeArray };
@@ -1 +1 @@
1
- {"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"mappings":";;;cA+BM,wBAAA,EAA0B,6BAA6B"}
1
+ {"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"mappings":";;;cAkEM,wBAAA,EAA0B,6BAA6B"}
package/dist/control.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { n as LTREE_CODEC_ID, t as LTREE_ARRAY_CODEC_ID } from "./constants-Dfknw-h5.mjs";
2
- import { n as ltreeQueryOperations, t as ltreePackMeta } from "./descriptor-meta-2In8FI1I.mjs";
2
+ import { n as ltreeQueryOperations, t as ltreePackMeta } from "./descriptor-meta-DwbFei9y.mjs";
3
3
  import { contractSpaceFromJson } from "@prisma/orm-toolchain/migration-tools/spaces";
4
4
  //#region migrations/20260619T2142_install_ltree/migration.json
5
- var migration_default = {
5
+ var migration_default$4 = {
6
6
  from: null,
7
7
  to: "5842622c2779cd02acd640ab4a5c8979fc94a2af8ed034222391fbd4f7cb3706",
8
8
  providedInvariants: ["ltree:install-ltree-v1"],
@@ -11,7 +11,7 @@ var migration_default = {
11
11
  };
12
12
  //#endregion
13
13
  //#region migrations/20260619T2142_install_ltree/ops.json
14
- var ops_default = [{
14
+ var ops_default$4 = [{
15
15
  "id": "ltree.install-ltree-extension",
16
16
  "label": "Enable extension \"ltree\"",
17
17
  "operationClass": "additive",
@@ -40,10 +40,183 @@ var ops_default = [{
40
40
  }]
41
41
  }];
42
42
  //#endregion
43
+ //#region migrations/20261111T1904_create_ltree_extension/migration.json
44
+ var migration_default$3 = {
45
+ from: null,
46
+ to: "150f76958e7b1802cb3fb17b2792759d19e6aedf01f5fffa5f77565a2afe4582",
47
+ providedInvariants: [],
48
+ createdAt: "2026-11-11T19:04:24.423Z",
49
+ migrationHash: "1be2450ab00d5969e0a9f0fdb50daabcbf62f6768ea3a6ee92ef3a4dd6982d1c"
50
+ };
51
+ //#endregion
52
+ //#region migrations/20261111T1904_create_ltree_extension/ops.json
53
+ var ops_default$3 = [{
54
+ "id": "schema.public",
55
+ "label": "Create schema \"public\"",
56
+ "operationClass": "additive",
57
+ "target": { "id": "postgres" },
58
+ "precheck": [],
59
+ "execute": [{
60
+ "description": "Create schema \"public\"",
61
+ "sql": "CREATE SCHEMA IF NOT EXISTS \"public\"",
62
+ "params": []
63
+ }],
64
+ "postcheck": []
65
+ }, {
66
+ "id": "extension.ltree",
67
+ "label": "Create extension \"ltree\"",
68
+ "operationClass": "additive",
69
+ "target": {
70
+ "id": "postgres",
71
+ "details": {
72
+ "schema": "public",
73
+ "objectType": "dependency",
74
+ "name": "ltree"
75
+ }
76
+ },
77
+ "precheck": [{
78
+ "description": "verify extension \"ltree\" is not installed",
79
+ "sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
80
+ "params": ["ltree"],
81
+ "expectation": {
82
+ "expects": "absent",
83
+ "object": "extension \"ltree\""
84
+ }
85
+ }],
86
+ "execute": [{
87
+ "description": "create extension \"ltree\"",
88
+ "sql": "CREATE EXTENSION IF NOT EXISTS \"ltree\" WITH SCHEMA \"public\""
89
+ }],
90
+ "postcheck": [{
91
+ "description": "confirm extension \"ltree\" is installed",
92
+ "sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
93
+ "params": ["ltree"],
94
+ "expectation": {
95
+ "expects": "present",
96
+ "object": "extension \"ltree\""
97
+ }
98
+ }]
99
+ }];
100
+ //#endregion
101
+ //#region migrations/20261111T1905_declare_ltree_extension/migration.json
102
+ var migration_default$2 = {
103
+ from: "5842622c2779cd02acd640ab4a5c8979fc94a2af8ed034222391fbd4f7cb3706",
104
+ to: "150f76958e7b1802cb3fb17b2792759d19e6aedf01f5fffa5f77565a2afe4582",
105
+ providedInvariants: [],
106
+ createdAt: "2026-11-11T19:05:51.283Z",
107
+ migrationHash: "28790448876216e19e6aa7b6648ec0f101686dfdc604c377f3584f1f1588c874"
108
+ };
109
+ //#endregion
110
+ //#region migrations/20261111T1905_declare_ltree_extension/ops.json
111
+ var ops_default$2 = [{
112
+ "id": "extension.ltree",
113
+ "label": "Create extension \"ltree\"",
114
+ "operationClass": "additive",
115
+ "target": {
116
+ "id": "postgres",
117
+ "details": {
118
+ "schema": "public",
119
+ "objectType": "dependency",
120
+ "name": "ltree"
121
+ }
122
+ },
123
+ "precheck": [{
124
+ "description": "verify extension \"ltree\" is not installed",
125
+ "sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
126
+ "params": ["ltree"],
127
+ "expectation": {
128
+ "expects": "absent",
129
+ "object": "extension \"ltree\""
130
+ }
131
+ }],
132
+ "execute": [{
133
+ "description": "create extension \"ltree\"",
134
+ "sql": "CREATE EXTENSION IF NOT EXISTS \"ltree\" WITH SCHEMA \"public\""
135
+ }],
136
+ "postcheck": [{
137
+ "description": "confirm extension \"ltree\" is installed",
138
+ "sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
139
+ "params": ["ltree"],
140
+ "expectation": {
141
+ "expects": "present",
142
+ "object": "extension \"ltree\""
143
+ }
144
+ }]
145
+ }];
146
+ //#endregion
147
+ //#region migrations/20261111T1908_find_ltree_on_search_path/migration.json
148
+ var migration_default$1 = {
149
+ from: "150f76958e7b1802cb3fb17b2792759d19e6aedf01f5fffa5f77565a2afe4582",
150
+ to: "6db18d99f118ef4e7fd359cf8bc472b9335bf3edeeefa8a15ee11eaf7742f9fb",
151
+ providedInvariants: [],
152
+ createdAt: "2026-11-11T19:08:52.615Z",
153
+ migrationHash: "3ee496921e534f39e639e5d3745d87f003a238809eda1453afc798f404f71d8d"
154
+ };
155
+ //#endregion
156
+ //#region migrations/20261111T1908_find_ltree_on_search_path/ops.json
157
+ var ops_default$1 = [];
158
+ //#endregion
159
+ //#region migrations/20261111T1908_install_ltree_on_search_path/migration.json
160
+ var migration_default = {
161
+ from: null,
162
+ to: "6db18d99f118ef4e7fd359cf8bc472b9335bf3edeeefa8a15ee11eaf7742f9fb",
163
+ providedInvariants: [],
164
+ createdAt: "2026-11-11T19:08:53.983Z",
165
+ migrationHash: "29296a0599924fcb56de5a181f441206320676249c7d2cb4db1b3a1e6c160555"
166
+ };
167
+ //#endregion
168
+ //#region migrations/20261111T1908_install_ltree_on_search_path/ops.json
169
+ var ops_default = [{
170
+ "id": "schema.public",
171
+ "label": "Create schema \"public\"",
172
+ "operationClass": "additive",
173
+ "target": { "id": "postgres" },
174
+ "precheck": [],
175
+ "execute": [{
176
+ "description": "Create schema \"public\"",
177
+ "sql": "CREATE SCHEMA IF NOT EXISTS \"public\"",
178
+ "params": []
179
+ }],
180
+ "postcheck": []
181
+ }, {
182
+ "id": "extension.ltree",
183
+ "label": "Create extension \"ltree\"",
184
+ "operationClass": "additive",
185
+ "target": {
186
+ "id": "postgres",
187
+ "details": {
188
+ "objectType": "dependency",
189
+ "name": "ltree"
190
+ }
191
+ },
192
+ "precheck": [{
193
+ "description": "verify extension \"ltree\" is not installed",
194
+ "sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
195
+ "params": ["ltree"],
196
+ "expectation": {
197
+ "expects": "absent",
198
+ "object": "extension \"ltree\""
199
+ }
200
+ }],
201
+ "execute": [{
202
+ "description": "create extension \"ltree\"",
203
+ "sql": "CREATE EXTENSION IF NOT EXISTS \"ltree\""
204
+ }],
205
+ "postcheck": [{
206
+ "description": "confirm extension \"ltree\" is installed",
207
+ "sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
208
+ "params": ["ltree"],
209
+ "expectation": {
210
+ "expects": "present",
211
+ "object": "extension \"ltree\""
212
+ }
213
+ }]
214
+ }];
215
+ //#endregion
43
216
  //#region migrations/refs/head.json
44
217
  var head_default = {
45
- hash: "5842622c2779cd02acd640ab4a5c8979fc94a2af8ed034222391fbd4f7cb3706",
46
- invariants: ["ltree:install-ltree-v1"]
218
+ hash: "6db18d99f118ef4e7fd359cf8bc472b9335bf3edeeefa8a15ee11eaf7742f9fb",
219
+ invariants: []
47
220
  };
48
221
  //#endregion
49
222
  //#region src/contract.json
@@ -55,12 +228,25 @@ var contract_default = {
55
228
  roots: {},
56
229
  domain: { "namespaces": { "public": { "models": {} } } },
57
230
  storage: {
58
- "namespaces": { "public": {
59
- "entries": { "table": {} },
60
- "id": "public",
61
- "kind": "postgres-schema"
62
- } },
63
- "storageHash": "5842622c2779cd02acd640ab4a5c8979fc94a2af8ed034222391fbd4f7cb3706",
231
+ "namespaces": {
232
+ "__unbound__": {
233
+ "entries": {
234
+ "extension": { "ltree": {
235
+ "kind": "extension",
236
+ "name": "ltree"
237
+ } },
238
+ "table": {}
239
+ },
240
+ "id": "__unbound__",
241
+ "kind": "postgres-unbound-schema"
242
+ },
243
+ "public": {
244
+ "entries": { "table": {} },
245
+ "id": "public",
246
+ "kind": "postgres-schema"
247
+ }
248
+ },
249
+ "storageHash": "6db18d99f118ef4e7fd359cf8bc472b9335bf3edeeefa8a15ee11eaf7742f9fb",
64
250
  "types": {
65
251
  "ltree": {
66
252
  "codecId": "pg/ltree@1",
@@ -77,6 +263,8 @@ var contract_default = {
77
263
  capabilities: {
78
264
  "postgres": {
79
265
  "distinctOn": true,
266
+ "forKeyShare": true,
267
+ "forNoKeyUpdate": true,
80
268
  "jsonAgg": true,
81
269
  "lateral": true,
82
270
  "limit": true,
@@ -87,9 +275,15 @@ var contract_default = {
87
275
  "checkConstraint": true,
88
276
  "defaultInInsert": true,
89
277
  "enums": true,
278
+ "forShare": true,
279
+ "forUpdate": true,
90
280
  "insertOnConflictSkip": true,
281
+ "insertOnConflictTarget": true,
91
282
  "insertOnConflictWithoutTarget": true,
92
283
  "lateral": true,
284
+ "lockNowait": true,
285
+ "lockOf": true,
286
+ "lockSkipLocked": true,
93
287
  "returning": true,
94
288
  "scalarList": true
95
289
  }
@@ -106,16 +300,42 @@ var contract_default = {
106
300
  //#region src/core/contract-space-constants.ts
107
301
  const LTREE_SPACE_ID = "ltree";
108
302
  const LTREE_BASELINE_MIGRATION_NAME = "20260619T2142_install_ltree";
303
+ const LTREE_DECLARE_EXTENSION_MIGRATION_NAME = "20261111T1905_declare_ltree_extension";
304
+ const LTREE_CREATE_EXTENSION_MIGRATION_NAME = "20261111T1904_create_ltree_extension";
305
+ const LTREE_SEARCH_PATH_MIGRATION_NAME = "20261111T1908_find_ltree_on_search_path";
306
+ const LTREE_SEARCH_PATH_INSTALL_MIGRATION_NAME = "20261111T1908_install_ltree_on_search_path";
109
307
  //#endregion
110
308
  //#region src/exports/control.ts
111
309
  const ltreeControlPlaneHooks = { resolveIdentityValue: () => null };
112
310
  const ltreeContractSpace = contractSpaceFromJson({
113
311
  contractJson: contract_default,
114
- migrations: [{
115
- dirName: LTREE_BASELINE_MIGRATION_NAME,
116
- metadata: migration_default,
117
- ops: ops_default
118
- }],
312
+ migrations: [
313
+ {
314
+ dirName: LTREE_BASELINE_MIGRATION_NAME,
315
+ metadata: migration_default$4,
316
+ ops: ops_default$4
317
+ },
318
+ {
319
+ dirName: LTREE_DECLARE_EXTENSION_MIGRATION_NAME,
320
+ metadata: migration_default$2,
321
+ ops: ops_default$2
322
+ },
323
+ {
324
+ dirName: LTREE_CREATE_EXTENSION_MIGRATION_NAME,
325
+ metadata: migration_default$3,
326
+ ops: ops_default$3
327
+ },
328
+ {
329
+ dirName: LTREE_SEARCH_PATH_MIGRATION_NAME,
330
+ metadata: migration_default$1,
331
+ ops: ops_default$1
332
+ },
333
+ {
334
+ dirName: LTREE_SEARCH_PATH_INSTALL_MIGRATION_NAME,
335
+ metadata: migration_default,
336
+ ops: ops_default
337
+ }
338
+ ],
119
339
  headRef: head_default
120
340
  });
121
341
  const ltreeExtensionDescriptor = {
@@ -1 +1 @@
1
- {"version":3,"file":"control.mjs","names":["baselineMetadata","baselineOps"],"sources":["../migrations/20260619T2142_install_ltree/migration.json","../migrations/20260619T2142_install_ltree/ops.json","../migrations/refs/head.json","../src/contract.json","../src/core/contract-space-constants.ts","../src/exports/control.ts"],"sourcesContent":["","","","","export const LTREE_SPACE_ID = \"ltree\" as const;\n\nexport const LTREE_NATIVE_TYPE = \"ltree\" as const;\n\n/** Contract storage.types key — must be a valid identifier for contract emit. */\nexport const LTREE_ARRAY_STORAGE_TYPE = \"ltreeArray\" as const;\n\nexport const LTREE_BASELINE_MIGRATION_NAME = \"20260619T2142_install_ltree\" as const;\n\nexport const LTREE_INVARIANTS = {\n installLtree: \"ltree:install-ltree-v1\",\n} as const;\n","import type { Contract } from \"@prisma/orm-framework/contract/types\";\nimport type {\n CodecControlHooks,\n SqlControlExtensionDescriptor,\n} from \"@prisma/orm-family-sql/family/control\";\nimport { contractSpaceFromJson } from \"@prisma/orm-toolchain/migration-tools/spaces\";\nimport type { SqlStorage } from \"@prisma/orm-family-sql/contract/types\";\nimport baselineMetadata from \"../../migrations/20260619T2142_install_ltree/migration.json\" with { type: \"json\" };\nimport baselineOps from \"../../migrations/20260619T2142_install_ltree/ops.json\" with { type: \"json\" };\nimport headRef from \"../../migrations/refs/head.json\" with { type: \"json\" };\nimport contractJson from \"../contract.json\" with { type: \"json\" };\nimport { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from \"../core/constants\";\nimport { 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
+ {"version":3,"file":"control.mjs","names":["baselineMetadata","baselineOps","declareMetadata","declareOps","createMetadata","createOps","searchPathMetadata","searchPathOps","searchPathInstallMetadata","searchPathInstallOps"],"sources":["../migrations/20260619T2142_install_ltree/migration.json","../migrations/20260619T2142_install_ltree/ops.json","../migrations/20261111T1904_create_ltree_extension/migration.json","../migrations/20261111T1904_create_ltree_extension/ops.json","../migrations/20261111T1905_declare_ltree_extension/migration.json","../migrations/20261111T1905_declare_ltree_extension/ops.json","../migrations/20261111T1908_find_ltree_on_search_path/migration.json","../migrations/20261111T1908_find_ltree_on_search_path/ops.json","../migrations/20261111T1908_install_ltree_on_search_path/migration.json","../migrations/20261111T1908_install_ltree_on_search_path/ops.json","../migrations/refs/head.json","../src/contract.json","../src/core/contract-space-constants.ts","../src/exports/control.ts"],"sourcesContent":["","","","","","","","","","","","","export const LTREE_SPACE_ID = \"ltree\" as const;\n\nexport const LTREE_NATIVE_TYPE = \"ltree\" as const;\n\n/** Contract storage.types key — must be a valid identifier for contract emit. */\nexport const LTREE_ARRAY_STORAGE_TYPE = \"ltreeArray\" as const;\n\nexport const LTREE_BASELINE_MIGRATION_NAME = \"20260619T2142_install_ltree\" as const;\n\nexport const LTREE_DECLARE_EXTENSION_MIGRATION_NAME =\n \"20261111T1905_declare_ltree_extension\" as const;\n\nexport const LTREE_CREATE_EXTENSION_MIGRATION_NAME =\n \"20261111T1904_create_ltree_extension\" as const;\n\nexport const LTREE_SEARCH_PATH_MIGRATION_NAME = \"20261111T1908_find_ltree_on_search_path\" as const;\n\nexport const LTREE_SEARCH_PATH_INSTALL_MIGRATION_NAME =\n \"20261111T1908_install_ltree_on_search_path\" as const;\n\nexport const LTREE_INVARIANTS = {\n installLtree: \"ltree:install-ltree-v1\",\n} as const;\n","import type { Contract } from \"@prisma/orm-framework/contract/types\";\nimport type {\n CodecControlHooks,\n SqlControlExtensionDescriptor,\n} from \"@prisma/orm-family-sql/family/control\";\nimport { contractSpaceFromJson } from \"@prisma/orm-toolchain/migration-tools/spaces\";\nimport type { SqlStorage } from \"@prisma/orm-family-sql/contract/types\";\nimport baselineMetadata from \"../../migrations/20260619T2142_install_ltree/migration.json\" with { type: \"json\" };\nimport baselineOps from \"../../migrations/20260619T2142_install_ltree/ops.json\" with { type: \"json\" };\nimport createMetadata from \"../../migrations/20261111T1904_create_ltree_extension/migration.json\" with { type: \"json\" };\nimport createOps from \"../../migrations/20261111T1904_create_ltree_extension/ops.json\" with { type: \"json\" };\nimport declareMetadata from \"../../migrations/20261111T1905_declare_ltree_extension/migration.json\" with { type: \"json\" };\nimport declareOps from \"../../migrations/20261111T1905_declare_ltree_extension/ops.json\" with { type: \"json\" };\nimport searchPathMetadata from \"../../migrations/20261111T1908_find_ltree_on_search_path/migration.json\" with { type: \"json\" };\nimport searchPathOps from \"../../migrations/20261111T1908_find_ltree_on_search_path/ops.json\" with { type: \"json\" };\nimport searchPathInstallMetadata from \"../../migrations/20261111T1908_install_ltree_on_search_path/migration.json\" with { type: \"json\" };\nimport searchPathInstallOps from \"../../migrations/20261111T1908_install_ltree_on_search_path/ops.json\" with { type: \"json\" };\nimport headRef from \"../../migrations/refs/head.json\" with { type: \"json\" };\nimport contractJson from \"../contract.json\" with { type: \"json\" };\nimport { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from \"../core/constants\";\nimport {\n LTREE_BASELINE_MIGRATION_NAME,\n LTREE_CREATE_EXTENSION_MIGRATION_NAME,\n LTREE_DECLARE_EXTENSION_MIGRATION_NAME,\n LTREE_SEARCH_PATH_INSTALL_MIGRATION_NAME,\n LTREE_SEARCH_PATH_MIGRATION_NAME,\n LTREE_SPACE_ID,\n} from \"../core/contract-space-constants\";\nimport { ltreePackMeta, ltreeQueryOperations } from \"../core/descriptor-meta\";\n\nconst ltreeControlPlaneHooks: CodecControlHooks = {\n resolveIdentityValue: () => null,\n};\n\nconst ltreeContractSpace = contractSpaceFromJson<Contract<SqlStorage>>({\n contractJson,\n migrations: [\n {\n dirName: LTREE_BASELINE_MIGRATION_NAME,\n metadata: baselineMetadata,\n ops: baselineOps,\n },\n {\n dirName: LTREE_DECLARE_EXTENSION_MIGRATION_NAME,\n metadata: declareMetadata,\n ops: declareOps,\n },\n {\n dirName: LTREE_CREATE_EXTENSION_MIGRATION_NAME,\n metadata: createMetadata,\n ops: createOps,\n },\n {\n dirName: LTREE_SEARCH_PATH_MIGRATION_NAME,\n metadata: searchPathMetadata,\n ops: searchPathOps,\n },\n {\n dirName: LTREE_SEARCH_PATH_INSTALL_MIGRATION_NAME,\n metadata: searchPathInstallMetadata,\n ops: searchPathInstallOps,\n },\n ],\n headRef,\n});\n\nconst ltreeExtensionDescriptor: SqlControlExtensionDescriptor<\"postgres\"> = {\n ...ltreePackMeta,\n id: LTREE_SPACE_ID,\n contractSpace: ltreeContractSpace,\n types: {\n ...ltreePackMeta.types,\n codecTypes: {\n ...ltreePackMeta.types.codecTypes,\n controlPlaneHooks: {\n [LTREE_CODEC_ID]: ltreeControlPlaneHooks,\n [LTREE_ARRAY_CODEC_ID]: ltreeControlPlaneHooks,\n },\n },\n },\n queryOperations: () => ltreeQueryOperations(),\n create: () => ({\n familyId: \"sql\" as const,\n targetId: \"postgres\" as const,\n }),\n};\n\nexport { ltreeExtensionDescriptor };\nexport default ltreeExtensionDescriptor;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AYAA,MAAa,iBAAiB;AAO9B,MAAa,gCAAgC;AAE7C,MAAa,yCACX;AAEF,MAAa,wCACX;AAEF,MAAa,mCAAmC;AAEhD,MAAa,2CACX;;;ACYF,MAAM,yBAA4C,EAChD,4BAA4B,KAC9B;AAEA,MAAM,qBAAqB,sBAA4C;CACrE,cAAA;CACA,YAAY;EACV;GACE,SAAS;GACT,UAAUA;GACV,KAAKC;EACP;EACA;GACE,SAAS;GACT,UAAUC;GACV,KAAKC;EACP;EACA;GACE,SAAS;GACT,UAAUC;GACV,KAAKC;EACP;EACA;GACE,SAAS;GACT,UAAUC;GACV,KAAKC;EACP;EACA;GACE,SAAS;GACT,UAAUC;GACV,KAAKC;EACP;CACF;CACA,SAAA;AACF,CAAC;AAED,MAAM,2BAAsE;CAC1E,GAAG;CACH,IAAI;CACJ,eAAe;CACf,OAAO;EACL,GAAG,cAAc;EACjB,YAAY;GACV,GAAG,cAAc,MAAM;GACvB,mBAAmB;KAChB,iBAAiB;KACjB,uBAAuB;GAC1B;EACF;CACF;CACA,uBAAuB,qBAAqB;CAC5C,eAAe;EACb,UAAU;EACV,UAAU;CACZ;AACF"}