prisma-ltree 0.0.1 → 0.1.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 (47) hide show
  1. package/README.md +208 -3
  2. package/dist/codec-types-mZn-cIh9.d.mts +73 -0
  3. package/dist/codec-types-mZn-cIh9.d.mts.map +1 -0
  4. package/dist/codec-types.d.mts +2 -0
  5. package/dist/codec-types.mjs +1 -0
  6. package/dist/column-types.d.mts +8 -0
  7. package/dist/column-types.d.mts.map +1 -0
  8. package/dist/column-types.mjs +18 -0
  9. package/dist/column-types.mjs.map +1 -0
  10. package/dist/contract-space-constants-Da9EC668.mjs +15 -0
  11. package/dist/contract-space-constants-Da9EC668.mjs.map +1 -0
  12. package/dist/control.d.mts +7 -0
  13. package/dist/control.d.mts.map +1 -0
  14. package/dist/control.mjs +139 -0
  15. package/dist/control.mjs.map +1 -0
  16. package/dist/descriptor-meta-B84muAZG.mjs +345 -0
  17. package/dist/descriptor-meta-B84muAZG.mjs.map +1 -0
  18. package/dist/operation-types-CP6jqHAZ.d.mts +184 -0
  19. package/dist/operation-types-CP6jqHAZ.d.mts.map +1 -0
  20. package/dist/operation-types.d.mts +2 -0
  21. package/dist/operation-types.mjs +1 -0
  22. package/dist/pack.d.mts +73 -0
  23. package/dist/pack.d.mts.map +1 -0
  24. package/dist/pack.mjs +2 -0
  25. package/dist/runtime.d.mts +11 -0
  26. package/dist/runtime.d.mts.map +1 -0
  27. package/dist/runtime.mjs +22 -0
  28. package/dist/runtime.mjs.map +1 -0
  29. package/package.json +80 -10
  30. package/src/contract.d.ts +115 -0
  31. package/src/contract.json +61 -0
  32. package/src/contract.ts +27 -0
  33. package/src/core/authoring.ts +22 -0
  34. package/src/core/codecs.ts +178 -0
  35. package/src/core/constants.ts +7 -0
  36. package/src/core/contract-space-constants.ts +14 -0
  37. package/src/core/descriptor-meta.ts +346 -0
  38. package/src/core/registry.ts +6 -0
  39. package/src/exports/codec-types.ts +1 -0
  40. package/src/exports/column-types.ts +17 -0
  41. package/src/exports/control.ts +55 -0
  42. package/src/exports/operation-types.ts +1 -0
  43. package/src/exports/pack.ts +1 -0
  44. package/src/exports/runtime.ts +27 -0
  45. package/src/types/codec-types.ts +7 -0
  46. package/src/types/operation-types.ts +156 -0
  47. package/index.js +0 -3
package/README.md CHANGED
@@ -1,9 +1,214 @@
1
1
  # prisma-ltree
2
2
 
3
- Prisma extension for PostgreSQL `ltree` — hierarchical tree data type support.
3
+ A [Prisma Next](https://github.com/prisma/prisma) extension pack for PostgreSQL's
4
+ [`ltree`](https://www.postgresql.org/docs/current/ltree.html) hierarchical-tree data type.
4
5
 
5
- > **Status:** Placeholder. Full implementation in development.
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
9
+ raw SQL.
10
+
11
+ ## Overview
12
+
13
+ This extension pack provides:
14
+
15
+ - **`pg/ltree@1` codec** — `string ↔ string` with label-syntax + length validation (traits
16
+ `['equality', 'order']`).
17
+ - **`pg/ltree-array@1` codec** — `string[] ↔ string[]` with per-element validation, for the
18
+ `ltree[]` first-match operators (see [ADR-003](../../docs/decisions/ADR-003-array-receiver.md)).
19
+ - **`ltree()` / `ltreeArray()` column helpers** — non-parameterized columns with `nativeType`
20
+ `'ltree'` / `'ltree[]'`.
21
+ - **Query operators** — hierarchy, pattern-match, scalar functions, concatenation, conversion, and
22
+ array first-match operators (full list under [Operations](#operations)).
23
+ - **Baseline migration** — installs the Postgres extension via
24
+ `CREATE EXTENSION IF NOT EXISTS ltree` (invariantId `ltree:install-ltree-v1`).
25
+ - **Multi-plane entrypoints** — `/control`, `/runtime`, `/column-types`, `/codec-types`,
26
+ `/operation-types`, `/pack`.
27
+
28
+ The single source of truth for what is supported, planned, or out-of-scope is
29
+ [`docs/feature-support.md`](../../docs/feature-support.md).
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ pnpm add prisma-ltree
35
+ ```
36
+
37
+ Requires Node `>=24` and `@prisma-next/*@0.14.0`.
38
+
39
+ ## Database Setup
40
+
41
+ The extension ships an on-disk baseline migration that installs `ltree` when the pack is composed
42
+ into an application. `prisma-next db init` / `db update` apply it automatically. The equivalent
43
+ manual DDL is:
44
+
45
+ ```sql
46
+ CREATE EXTENSION IF NOT EXISTS ltree;
47
+ ```
48
+
49
+ ## Configuration
50
+
51
+ Add the pack to your `prisma-next.config.ts`:
52
+
53
+ ```typescript
54
+ import { defineConfig } from "@prisma-next/cli/config-types";
55
+ import postgresAdapter from "@prisma-next/adapter-postgres/control";
56
+ import sql from "@prisma-next/family-sql/control";
57
+ import postgres from "@prisma-next/target-postgres/control";
58
+ import ltree from "prisma-ltree/control";
59
+
60
+ export default defineConfig({
61
+ family: sql,
62
+ target: postgres,
63
+ adapter: postgresAdapter,
64
+ extensionPacks: [ltree],
65
+ });
66
+ ```
67
+
68
+ ## Usage
69
+
70
+ ### Contract Definition
71
+
72
+ ```typescript
73
+ import { int4Column, textColumn } from "@prisma-next/adapter-postgres/column-types";
74
+ import sqlFamily from "@prisma-next/family-sql/pack";
75
+ import { defineContract, field, model } from "@prisma-next/sql-contract-ts/contract-builder";
76
+ import { ltree } from "prisma-ltree/column-types";
77
+ import ltreePack from "prisma-ltree/pack";
78
+ import postgres from "@prisma-next/target-postgres/pack";
79
+
80
+ export const contract = defineContract({
81
+ family: sqlFamily,
82
+ target: postgres,
83
+ extensionPacks: { ltree: ltreePack },
84
+ models: {
85
+ Category: model("Category", {
86
+ fields: {
87
+ id: field.column(int4Column).id(),
88
+ name: field.column(textColumn),
89
+ path: field.column(ltree()),
90
+ },
91
+ }).sql({ table: "category" }),
92
+ },
93
+ });
94
+ ```
95
+
96
+ ### Runtime Setup
97
+
98
+ ```typescript
99
+ import { instantiateExecutionStack } from "@prisma-next/framework-components/execution";
100
+ import { createExecutionContext, createSqlExecutionStack } from "@prisma-next/sql-runtime";
101
+ import postgresAdapter from "@prisma-next/adapter-postgres/runtime";
102
+ import postgresTarget from "@prisma-next/target-postgres/runtime";
103
+ import ltree from "prisma-ltree/runtime";
104
+
105
+ const stack = createSqlExecutionStack({
106
+ target: postgresTarget,
107
+ adapter: postgresAdapter,
108
+ extensionPacks: [ltree],
109
+ });
110
+ const context = createExecutionContext({ contract, stack });
111
+ const stackInstance = instantiateExecutionStack(stack);
112
+ ```
113
+
114
+ ### Query Usage
115
+
116
+ ```typescript
117
+ import { sql, tables } from "../prisma/query";
118
+ import { param } from "@prisma-next/sql-query/param";
119
+
120
+ // Find every descendant of "Top.Science"
121
+ const plan = sql
122
+ .from(tables.category)
123
+ .select({
124
+ id: tables.category.columns.id,
125
+ depth: tables.category.columns.path.nlevel(),
126
+ })
127
+ .where(tables.category.columns.path.isDescendantOf(param("prefix")))
128
+ .build({ params: { prefix: "Top.Science" } });
129
+ ```
130
+
131
+ ## Operations
132
+
133
+ All boolean operators return `pg/bool@1`. See
134
+ [`docs/feature-support.md`](../../docs/feature-support.md) for the authoritative matrix.
135
+
136
+ ### Hierarchy (→ boolean)
137
+
138
+ | Method | SQL |
139
+ | -------------------------- | ---------------- |
140
+ | `path.isAncestorOf(rhs)` | `ltree @> ltree` |
141
+ | `path.isDescendantOf(rhs)` | `ltree <@ ltree` |
142
+
143
+ ### Pattern matching (→ boolean)
144
+
145
+ | Method | SQL | Arg |
146
+ | ----------------------------------- | ------------------- | ---------- |
147
+ | `path.matchesLquery(pattern)` | `ltree ~ lquery` | `string` |
148
+ | `path.matchesLqueryArray(patterns)` | `ltree ? lquery[]` | `string[]` |
149
+ | `path.matchesLtxtquery(query)` | `ltree @ ltxtquery` | `string` |
150
+
151
+ ### Scalar functions
152
+
153
+ | Method | SQL | Returns |
154
+ | ---------------------------- | ----------------------------- | ------------ |
155
+ | `path.nlevel()` | `nlevel(ltree)` | `pg/int4@1` |
156
+ | `path.subltree(start, end)` | `subltree(ltree, start, end)` | `pg/ltree@1` |
157
+ | `path.subpath(offset, len?)` | `subpath(ltree, offset, len)` | `pg/ltree@1` |
158
+ | `path.indexOf(other, off?)` | `index(ltree, ltree, off)` | `pg/int4@1` |
159
+ | `path.lca(other, ...rest)` | `lca(ltree, ltree, ...)` | `pg/ltree@1` |
160
+
161
+ `lca` is a variadic method requiring **≥2 paths** and returns the proper (strictly shorter) lowest
162
+ common ancestor (see [ADR-001](../../docs/decisions/ADR-001-lca-api-shape.md)).
163
+
164
+ ### Concatenation (→ ltree) & conversion
165
+
166
+ | Method | SQL | Returns |
167
+ | ------------------------- | ------------------- | ------------ |
168
+ | `path.concat(rhs)` | `ltree \|\| ltree` | `pg/ltree@1` |
169
+ | `path.concatText(label)` | `ltree \|\| text` | `pg/ltree@1` |
170
+ | `path.prependText(label)` | `text \|\| ltree` | `pg/ltree@1` |
171
+ | `path.toText()` | `ltree2text(ltree)` | `pg/text@1` |
172
+ | `text.toLtree()` | `text2ltree(text)` | `pg/ltree@1` |
173
+
174
+ `prependText` keeps the ltree column as the receiver even though it is the right operand, and
175
+ `toLtree` is rooted on a text column (see
176
+ [ADR-002](../../docs/decisions/ADR-002-free-function-lowering.md)).
177
+
178
+ ### Array first-match (→ ltree, receiver `ltree[]`)
179
+
180
+ | Method | SQL |
181
+ | ---------------------------------- | ---------------------- |
182
+ | `paths.firstAncestorOf(rhs)` | `ltree[] ?@> ltree` |
183
+ | `paths.firstDescendantOf(rhs)` | `ltree[] ?<@ ltree` |
184
+ | `paths.firstMatchLquery(pattern)` | `ltree[] ?~ lquery` |
185
+ | `paths.firstMatchLtxtquery(query)` | `ltree[] ?@ ltxtquery` |
186
+
187
+ ## Types
188
+
189
+ ```typescript
190
+ import type { CodecTypes, Ltree, LtreeArray } from "prisma-ltree/codec-types";
191
+ import type { QueryOperationTypes } from "prisma-ltree/operation-types";
192
+
193
+ // CodecTypes['pg/ltree@1']['output'] = string
194
+ // CodecTypes['pg/ltree-array@1']['output'] = readonly string[]
195
+ ```
196
+
197
+ ## Development
198
+
199
+ This package is built with [Vite+](https://viteplus.dev/):
200
+
201
+ ```bash
202
+ vp install # install dependencies
203
+ vp check # format, lint, typecheck
204
+ vp test # run unit + integration + type-level tests
205
+ vp test --coverage # enforce the 95% coverage threshold
206
+ vp run build # build dist/
207
+ ```
208
+
209
+ Integration tests run against [PGlite](https://pglite.dev/) with the `ltree` contrib extension —
210
+ every operator is lowered through a composed Postgres runtime adapter and executed for real.
6
211
 
7
212
  ## License
8
213
 
9
- MIT
214
+ Apache-2.0
@@ -0,0 +1,73 @@
1
+ import { CodecCallContext, CodecDescriptorImpl, CodecImpl, CodecInstanceContext } from "@prisma-next/framework-components/codec";
2
+ import { JsonValue } from "@prisma-next/contract/types";
3
+ import { ExtractCodecTypes } from "@prisma-next/sql-relational-core/ast";
4
+ import { StandardSchemaV1 } from "@standard-schema/spec";
5
+
6
+ //#region src/core/constants.d.ts
7
+ declare const LTREE_CODEC_ID: "pg/ltree@1";
8
+ declare const LTREE_ARRAY_CODEC_ID: "pg/ltree-array@1";
9
+ //#endregion
10
+ //#region src/core/codecs.d.ts
11
+ 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;
16
+ }
17
+ declare class LtreeDescriptor extends CodecDescriptorImpl<void> {
18
+ readonly codecId: "pg/ltree@1";
19
+ readonly traits: readonly ["equality", "order"];
20
+ readonly targetTypes: readonly ["ltree"];
21
+ readonly meta: {
22
+ readonly db: {
23
+ readonly sql: {
24
+ readonly postgres: {
25
+ readonly nativeType: "ltree";
26
+ };
27
+ };
28
+ };
29
+ };
30
+ readonly paramsSchema: StandardSchemaV1<void>;
31
+ renderOutputType(): string;
32
+ factory(): (ctx: CodecInstanceContext) => LtreeCodec;
33
+ }
34
+ declare class LtreeArrayCodec extends CodecImpl<typeof LTREE_ARRAY_CODEC_ID, readonly ["equality"], readonly string[], readonly string[]> {
35
+ encode(value: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]>;
36
+ decode(wire: readonly string[], _ctx: CodecCallContext): Promise<readonly string[]>;
37
+ encodeJson(value: readonly string[]): JsonValue;
38
+ decodeJson(json: JsonValue): readonly string[];
39
+ }
40
+ declare class LtreeArrayDescriptor extends CodecDescriptorImpl<void> {
41
+ readonly codecId: "pg/ltree-array@1";
42
+ readonly traits: readonly ["equality"];
43
+ readonly targetTypes: readonly ["ltree[]"];
44
+ readonly meta: {
45
+ readonly db: {
46
+ readonly sql: {
47
+ readonly postgres: {
48
+ readonly nativeType: "ltree[]";
49
+ };
50
+ };
51
+ };
52
+ };
53
+ readonly paramsSchema: StandardSchemaV1<void>;
54
+ renderOutputType(): string;
55
+ factory(): (ctx: CodecInstanceContext) => LtreeArrayCodec;
56
+ }
57
+ declare const codecDescriptorMap: {
58
+ readonly ltree: LtreeDescriptor;
59
+ readonly ltreeArray: LtreeArrayDescriptor;
60
+ };
61
+ type CodecTypes$1 = ExtractCodecTypes<typeof codecDescriptorMap>;
62
+ //#endregion
63
+ //#region src/types/codec-types.d.ts
64
+ type Ltree = string & {
65
+ readonly __ltree?: undefined;
66
+ };
67
+ type LtreeArray = readonly string[] & {
68
+ readonly __ltreeArray?: undefined;
69
+ };
70
+ type CodecTypes = CodecTypes$1;
71
+ //#endregion
72
+ export { Ltree as n, LtreeArray as r, CodecTypes as t };
73
+ //# sourceMappingURL=codec-types-mZn-cIh9.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-types-mZn-cIh9.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,cAQN,eAAA,SAAwB,mBAAA;EAAA,SACjB,OAAA;EAAA,SACA,MAAA;EAAA,SACA,WAAA;EAAA,SACA,IAAA;IAAA;eANO,GAAA;QAAA,SAAO,QAAA;UAAA,SAAY,UAAA;QAAA;MAAA;IAAA;EAAA;EAAA,SAO1B,YAAA,EAAc,gBAAA;EACvB,gBAAA;EAGA,OAAA,KAAY,GAAA,EAAK,oBAAA,KAAyB,UAAA;AAAA;AAAA,cAkBxC,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,mBAAA;EAAA,SACtB,OAAA;EAAA,SACA,MAAA;EAAA,SACA,WAAA;EAAA,SACA,IAAA;IAAA;eA1CZ,GAAA;QAAA,SAAO,QAAA;UAAA,SAAY,UAAA;QAAA;MAAA;IAAA;EAAA;EAAA,SA2CP,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;;;KC7KtC,KAAA;EAAA,SAA4B,OAAO;AAAA;AAAA,KAEnC,UAAA;EAAA,SAA4C,YAAY;AAAA;AAAA,KAExD,UAAA,GAAa,YAAc"}
@@ -0,0 +1,2 @@
1
+ import { n as Ltree, r as LtreeArray, t as CodecTypes } from "./codec-types-mZn-cIh9.mjs";
2
+ export type { CodecTypes, Ltree, LtreeArray };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ColumnTypeDescriptor } from "@prisma-next/framework-components/codec";
2
+
3
+ //#region src/exports/column-types.d.ts
4
+ declare function ltree(): ColumnTypeDescriptor;
5
+ declare function ltreeArray(): ColumnTypeDescriptor;
6
+ //#endregion
7
+ export { ltree, ltreeArray };
8
+ //# sourceMappingURL=column-types.d.mts.map
@@ -0,0 +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"}
@@ -0,0 +1,18 @@
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";
2
+ //#region src/exports/column-types.ts
3
+ function ltree() {
4
+ return {
5
+ codecId: LTREE_CODEC_ID,
6
+ nativeType: LTREE_NATIVE_TYPE
7
+ };
8
+ }
9
+ function ltreeArray() {
10
+ return {
11
+ codecId: LTREE_ARRAY_CODEC_ID,
12
+ nativeType: LTREE_ARRAY_NATIVE_TYPE
13
+ };
14
+ }
15
+ //#endregion
16
+ export { ltree, ltreeArray };
17
+
18
+ //# sourceMappingURL=column-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-types.mjs","names":[],"sources":["../src/exports/column-types.ts"],"sourcesContent":["import type { ColumnTypeDescriptor } from \"@prisma-next/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"}
@@ -0,0 +1,15 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,7 @@
1
+ import { SqlControlExtensionDescriptor } from "@prisma-next/family-sql/control";
2
+
3
+ //#region src/exports/control.d.ts
4
+ declare const ltreeExtensionDescriptor: SqlControlExtensionDescriptor<"postgres">;
5
+ //#endregion
6
+ export { ltreeExtensionDescriptor as default, ltreeExtensionDescriptor };
7
+ //# sourceMappingURL=control.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"mappings":";;;cAgCM,wBAAA,EAA0B,6BAA6B"}
@@ -0,0 +1,139 @@
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-B84muAZG.mjs";
3
+ import { contractSpaceFromJson } from "@prisma-next/migration-tools/spaces";
4
+ //#region migrations/app/20260619T2142_install_ltree/migration.json
5
+ var migration_default = {
6
+ from: null,
7
+ to: "sha256:81cc0a29674d926c9089886b1941ba66d6ce26ec5644fc8a0b7c92a5e9e9876e",
8
+ providedInvariants: ["ltree:install-ltree-v1"],
9
+ createdAt: "2026-06-19T21:42:51.612Z",
10
+ migrationHash: "sha256:12135607df23ecea31aaf9e402703096cfcb236abf9e48a6797de2e74208700a"
11
+ };
12
+ //#endregion
13
+ //#region migrations/app/20260619T2142_install_ltree/ops.json
14
+ var ops_default = [{
15
+ "id": "ltree.install-ltree-extension",
16
+ "label": "Enable extension \"ltree\"",
17
+ "operationClass": "additive",
18
+ "invariantId": "ltree:install-ltree-v1",
19
+ "target": {
20
+ "id": "postgres",
21
+ "details": {
22
+ "schema": "public",
23
+ "objectType": "dependency",
24
+ "name": "ltree"
25
+ }
26
+ },
27
+ "precheck": [{
28
+ "description": "verify extension \"ltree\" is not already enabled",
29
+ "sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
30
+ "params": ["ltree"]
31
+ }],
32
+ "execute": [{
33
+ "description": "create extension \"ltree\"",
34
+ "sql": "CREATE EXTENSION IF NOT EXISTS ltree"
35
+ }],
36
+ "postcheck": [{
37
+ "description": "confirm extension \"ltree\" is enabled",
38
+ "sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_extension\" WHERE \"extname\" = $1) AS \"result\"",
39
+ "params": ["ltree"]
40
+ }]
41
+ }];
42
+ //#endregion
43
+ //#region migrations/app/refs/head.json
44
+ var head_default = {
45
+ hash: "sha256:81cc0a29674d926c9089886b1941ba66d6ce26ec5644fc8a0b7c92a5e9e9876e",
46
+ invariants: ["ltree:install-ltree-v1"]
47
+ };
48
+ //#endregion
49
+ //#region src/contract.json
50
+ var contract_default = {
51
+ schemaVersion: "1",
52
+ targetFamily: "sql",
53
+ target: "postgres",
54
+ profileHash: "sha256:9c8aa3114e84ed3b7ea2bd57526d9c2e1bf7c5292be694e9d3801f566fda7ccb",
55
+ roots: {},
56
+ domain: { "namespaces": { "public": { "models": {} } } },
57
+ storage: {
58
+ "namespaces": { "public": {
59
+ "entries": { "table": {} },
60
+ "id": "public",
61
+ "kind": "postgres-schema"
62
+ } },
63
+ "storageHash": "sha256:81cc0a29674d926c9089886b1941ba66d6ce26ec5644fc8a0b7c92a5e9e9876e",
64
+ "types": {
65
+ "ltree": {
66
+ "codecId": "pg/ltree@1",
67
+ "kind": "codec-instance",
68
+ "nativeType": "ltree"
69
+ },
70
+ "ltreeArray": {
71
+ "codecId": "pg/ltree-array@1",
72
+ "kind": "codec-instance",
73
+ "nativeType": "ltree[]"
74
+ }
75
+ }
76
+ },
77
+ capabilities: {
78
+ "postgres": {
79
+ "distinctOn": true,
80
+ "jsonAgg": true,
81
+ "lateral": true,
82
+ "limit": true,
83
+ "orderBy": true,
84
+ "returning": true
85
+ },
86
+ "sql": {
87
+ "defaultInInsert": true,
88
+ "enums": true,
89
+ "lateral": true,
90
+ "returning": true
91
+ }
92
+ },
93
+ extensionPacks: {},
94
+ meta: {},
95
+ _generated: {
96
+ "warning": "⚠️ GENERATED FILE - DO NOT EDIT",
97
+ "message": "This file is automatically generated by \"prisma-next contract emit\".",
98
+ "regenerate": "To regenerate, run: prisma-next contract emit"
99
+ }
100
+ };
101
+ //#endregion
102
+ //#region src/exports/control.ts
103
+ const ltreeControlPlaneHooks = {
104
+ expandNativeType: ({ nativeType }) => nativeType,
105
+ resolveIdentityValue: () => null
106
+ };
107
+ const ltreeContractSpace = contractSpaceFromJson({
108
+ contractJson: contract_default,
109
+ migrations: [{
110
+ dirName: LTREE_BASELINE_MIGRATION_NAME,
111
+ metadata: migration_default,
112
+ ops: ops_default
113
+ }],
114
+ headRef: head_default
115
+ });
116
+ const ltreeExtensionDescriptor = {
117
+ ...ltreePackMeta,
118
+ id: LTREE_SPACE_ID,
119
+ contractSpace: ltreeContractSpace,
120
+ types: {
121
+ ...ltreePackMeta.types,
122
+ codecTypes: {
123
+ ...ltreePackMeta.types.codecTypes,
124
+ controlPlaneHooks: {
125
+ [LTREE_CODEC_ID]: ltreeControlPlaneHooks,
126
+ [LTREE_ARRAY_CODEC_ID]: ltreeControlPlaneHooks
127
+ }
128
+ }
129
+ },
130
+ queryOperations: () => ltreeQueryOperations(),
131
+ create: () => ({
132
+ familyId: "sql",
133
+ targetId: "postgres"
134
+ })
135
+ };
136
+ //#endregion
137
+ export { ltreeExtensionDescriptor as default, ltreeExtensionDescriptor };
138
+
139
+ //# sourceMappingURL=control.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control.mjs","names":["baselineMetadata","baselineOps"],"sources":["../migrations/app/20260619T2142_install_ltree/migration.json","../migrations/app/20260619T2142_install_ltree/ops.json","../migrations/app/refs/head.json","../src/contract.json","../src/exports/control.ts"],"sourcesContent":["","","","","import type { Contract } from \"@prisma-next/contract/types\";\nimport type {\n CodecControlHooks,\n SqlControlExtensionDescriptor,\n} from \"@prisma-next/family-sql/control\";\nimport { contractSpaceFromJson } from \"@prisma-next/migration-tools/spaces\";\nimport type { SqlStorage } from \"@prisma-next/sql-contract/types\";\nimport baselineMetadata from \"../../migrations/app/20260619T2142_install_ltree/migration.json\" with { type: \"json\" };\nimport baselineOps from \"../../migrations/app/20260619T2142_install_ltree/ops.json\" with { type: \"json\" };\nimport headRef from \"../../migrations/app/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"}