prisma-ltree 0.2.1 → 0.2.2
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/LICENSE +201 -0
- package/README.md +6 -0
- package/dist/control.mjs +1 -1
- package/dist/{descriptor-meta-B84muAZG.mjs → descriptor-meta-Ch66mRPL.mjs} +5 -1
- package/dist/{descriptor-meta-B84muAZG.mjs.map → descriptor-meta-Ch66mRPL.mjs.map} +1 -1
- package/dist/{operation-types-CP6jqHAZ.d.mts → operation-types-BFxNrlNL.d.mts} +10 -1
- package/dist/{operation-types-CP6jqHAZ.d.mts.map → operation-types-BFxNrlNL.d.mts.map} +1 -1
- package/dist/operation-types.d.mts +1 -1
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/runtime.mjs +1 -1
- package/package.json +1 -1
- package/src/core/descriptor-meta.ts +12 -0
- package/src/types/operation-types.ts +10 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Jason Procka
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -207,9 +207,15 @@ const plan = sql
|
|
|
207
207
|
| `paths.firstDescendantOf(rhs)` | `ltree[] ?<@ ltree` |
|
|
208
208
|
| `paths.firstMatchLquery(pattern)` | `ltree[] ?~ lquery` |
|
|
209
209
|
| `paths.firstMatchLtxtquery(query)` | `ltree[] ?@ ltxtquery` |
|
|
210
|
+
| `paths.lcaAll()` | `lca(ltree[])` |
|
|
210
211
|
|
|
211
212
|
Use `ltreeArray()` for `ltree[]` columns that expose these methods.
|
|
212
213
|
|
|
214
|
+
`lcaAll` is the array form of `lca`. It is not named `lca` because prisma-next
|
|
215
|
+
keys operations by name only and rejects duplicates; scalar columns already
|
|
216
|
+
expose `path.lca(other, ...)` (see ADR-005). Note it returns SQL NULL for an
|
|
217
|
+
empty `ltree[]`, matching the first-match ops' `nullable: false` convention.
|
|
218
|
+
|
|
213
219
|
## Types
|
|
214
220
|
|
|
215
221
|
```typescript
|
package/dist/control.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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-
|
|
2
|
+
import { n as ltreeQueryOperations, t as ltreePackMeta } from "./descriptor-meta-Ch66mRPL.mjs";
|
|
3
3
|
import { contractSpaceFromJson } from "@prisma-next/migration-tools/spaces";
|
|
4
4
|
//#region migrations/app/20260619T2142_install_ltree/migration.json
|
|
5
5
|
var migration_default = {
|
|
@@ -296,6 +296,10 @@ function ltreeQueryOperations() {
|
|
|
296
296
|
firstMatchLtxtquery: {
|
|
297
297
|
self: { codecId: LTREE_ARRAY_CODEC_ID },
|
|
298
298
|
impl: (self, query) => firstMatchOp("firstMatchLtxtquery", "?@", self, query, TEXT_CODEC_ID, "ltxtquery")
|
|
299
|
+
},
|
|
300
|
+
lcaAll: {
|
|
301
|
+
self: { codecId: LTREE_ARRAY_CODEC_ID },
|
|
302
|
+
impl: (self) => funcOp("lcaAll", "lca", LTREE_RETURN, [toExpr(self, codecOf(self))])
|
|
299
303
|
}
|
|
300
304
|
};
|
|
301
305
|
}
|
|
@@ -342,4 +346,4 @@ const ltreePackMeta = {
|
|
|
342
346
|
//#endregion
|
|
343
347
|
export { ltreeQueryOperations as n, ltreeCodecRegistry as r, ltreePackMeta as t };
|
|
344
348
|
|
|
345
|
-
//# sourceMappingURL=descriptor-meta-
|
|
349
|
+
//# sourceMappingURL=descriptor-meta-Ch66mRPL.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor-meta-B84muAZG.mjs","names":[],"sources":["../src/core/authoring.ts","../src/core/codecs.ts","../src/core/registry.ts","../src/core/descriptor-meta.ts"],"sourcesContent":["import type { AuthoringTypeNamespace } from \"@prisma-next/framework-components/authoring\";\nimport { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from \"./constants\";\nimport { LTREE_ARRAY_NATIVE_TYPE, LTREE_NATIVE_TYPE } from \"./contract-space-constants\";\n\nexport const ltreeAuthoringTypes = {\n ltree: {\n Ltree: {\n kind: \"typeConstructor\",\n output: {\n codecId: LTREE_CODEC_ID,\n nativeType: LTREE_NATIVE_TYPE,\n },\n },\n LtreeArray: {\n kind: \"typeConstructor\",\n output: {\n codecId: LTREE_ARRAY_CODEC_ID,\n nativeType: LTREE_ARRAY_NATIVE_TYPE,\n },\n },\n },\n} as const satisfies AuthoringTypeNamespace;\n","import type { JsonValue } from \"@prisma-next/contract/types\";\nimport {\n type AnyCodecDescriptor,\n type CodecCallContext,\n CodecDescriptorImpl,\n CodecImpl,\n type CodecInstanceContext,\n type ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n voidParamsSchema,\n} from \"@prisma-next/framework-components/codec\";\nimport type { ExtractCodecTypes } from \"@prisma-next/sql-relational-core/ast\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport {\n LTREE_ARRAY_CODEC_ID,\n LTREE_CODEC_ID,\n LTREE_MAX_LABEL_LENGTH,\n LTREE_MAX_LABELS,\n} from \"./constants\";\nimport { LTREE_ARRAY_NATIVE_TYPE, LTREE_NATIVE_TYPE } from \"./contract-space-constants\";\n\nconst LABEL_PATTERN = /^[A-Za-z0-9_-]+$/;\n\nexport function assertValidLtree(value: unknown): asserts value is string {\n if (typeof value !== \"string\") {\n throw new Error(\"ltree value must be a string\");\n }\n if (value.length === 0) {\n throw new Error(\"ltree value must not be empty\");\n }\n const labels = value.split(\".\");\n if (labels.length > LTREE_MAX_LABELS) {\n throw new Error(`ltree path exceeds max labels: got ${labels.length}, max ${LTREE_MAX_LABELS}`);\n }\n for (const label of labels) {\n if (label.length === 0) {\n throw new Error(`ltree label must not be empty in path \"${value}\"`);\n }\n if (label.length > LTREE_MAX_LABEL_LENGTH) {\n throw new Error(\n `ltree label exceeds max length: got ${label.length}, max ${LTREE_MAX_LABEL_LENGTH}`,\n );\n }\n if (!LABEL_PATTERN.test(label)) {\n throw new Error(\n `ltree label \"${label}\" contains invalid characters; allowed: alphanumeric, underscore, hyphen`,\n );\n }\n }\n}\n\nexport class LtreeCodec extends CodecImpl<\n typeof LTREE_CODEC_ID,\n readonly [\"equality\", \"order\"],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n assertValidLtree(value);\n return value;\n }\n\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n\n encodeJson(value: string): JsonValue {\n assertValidLtree(value);\n return value;\n }\n\n decodeJson(json: JsonValue): string {\n assertValidLtree(json);\n return json;\n }\n}\n\nconst LTREE_META = { db: { sql: { postgres: { nativeType: LTREE_NATIVE_TYPE } } } } as const;\n\nexport class LtreeDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = LTREE_CODEC_ID;\n override readonly traits = [\"equality\", \"order\"] as const;\n override readonly targetTypes = [LTREE_NATIVE_TYPE] as const;\n override readonly meta = LTREE_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override renderOutputType(): string {\n return \"string\";\n }\n override factory(): (ctx: CodecInstanceContext) => LtreeCodec {\n const shared = new LtreeCodec(this);\n return () => shared;\n }\n}\n\nexport const ltreeDescriptor = new LtreeDescriptor();\n\nexport const ltree = () =>\n column(ltreeDescriptor.factory(), ltreeDescriptor.codecId, undefined, LTREE_NATIVE_TYPE);\n\nltree satisfies ColumnHelperFor<LtreeDescriptor>;\nltree satisfies ColumnHelperForStrict<LtreeDescriptor>;\n\nconst LTREE_ARRAY_META = {\n db: { sql: { postgres: { nativeType: LTREE_ARRAY_NATIVE_TYPE } } },\n} as const;\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 CodecDescriptorImpl<void> {\n override readonly codecId = LTREE_ARRAY_CODEC_ID;\n override readonly traits = [\"equality\"] as const;\n override readonly targetTypes = [LTREE_ARRAY_NATIVE_TYPE] as const;\n override readonly meta = LTREE_ARRAY_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override renderOutputType(): string {\n return \"readonly string[]\";\n }\n override factory(): (ctx: CodecInstanceContext) => LtreeArrayCodec {\n const shared = new LtreeArrayCodec(this);\n return () => shared;\n }\n}\n\nexport const ltreeArrayDescriptor = new LtreeArrayDescriptor();\n\nexport const ltreeArray = () =>\n column(\n ltreeArrayDescriptor.factory(),\n ltreeArrayDescriptor.codecId,\n undefined,\n LTREE_ARRAY_NATIVE_TYPE,\n );\n\nltreeArray satisfies ColumnHelperFor<LtreeArrayDescriptor>;\nltreeArray satisfies ColumnHelperForStrict<LtreeArrayDescriptor>;\n\nconst codecDescriptorMap = {\n ltree: ltreeDescriptor,\n ltreeArray: ltreeArrayDescriptor,\n} as const;\n\nexport type CodecTypes = ExtractCodecTypes<typeof codecDescriptorMap>;\n\nexport const codecDescriptors: readonly AnyCodecDescriptor[] = Object.values(codecDescriptorMap);\n","import { buildCodecDescriptorRegistry } from \"@prisma-next/sql-relational-core/codec-descriptor-registry\";\nimport type { CodecDescriptorRegistry } from \"@prisma-next/sql-relational-core/query-lane-context\";\nimport { codecDescriptors } from \"./codecs\";\n\nexport const ltreeCodecRegistry: CodecDescriptorRegistry =\n buildCodecDescriptorRegistry(codecDescriptors);\n","import type { AnyExpression } from \"@prisma-next/sql-relational-core/ast\";\nimport {\n buildOperation,\n type CodecExpression,\n codecOf,\n type Expression,\n toExpr,\n} from \"@prisma-next/sql-relational-core/expression\";\nimport type { CodecTypes } from \"../types/codec-types\";\nimport type { QueryOperationTypes } from \"../types/operation-types\";\nimport { ltreeAuthoringTypes } from \"./authoring\";\nimport { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from \"./constants\";\nimport { LTREE_ARRAY_NATIVE_TYPE, LTREE_NATIVE_TYPE } from \"./contract-space-constants\";\nimport { ltreeCodecRegistry } from \"./registry\";\n\ntype CodecTypesBase = Record<string, { readonly input: unknown; readonly output: unknown }>;\n\ntype BoolReturn = Expression<{ readonly codecId: \"pg/bool@1\"; readonly nullable: false }>;\ntype LtreeReturn = Expression<{ readonly codecId: \"pg/ltree@1\"; readonly nullable: false }>;\ntype IntReturn = Expression<{ readonly codecId: \"pg/int4@1\"; readonly nullable: false }>;\ntype TextReturn = Expression<{ readonly codecId: \"pg/text@1\"; readonly nullable: false }>;\n\nconst BOOL_RETURN = { codecId: \"pg/bool@1\", nullable: false } as const;\nconst LTREE_RETURN = { codecId: \"pg/ltree@1\", nullable: false } as const;\nconst INT_RETURN = { codecId: \"pg/int4@1\", nullable: false } as const;\nconst TEXT_RETURN = { codecId: \"pg/text@1\", nullable: false } as const;\nconst TEXT_CODEC_ID = \"pg/text@1\" as const;\nconst TEXT_ARRAY_CODEC_ID = \"pg/text-array@1\" as const;\nconst INT_CODEC_ID = \"pg/int4@1\" as const;\n\n/**\n * Build a function-style operation whose SQL is `fnName(self, arg0, arg1, ...)`.\n * The template's placeholder count is derived from the actual argument list, so\n * one helper covers fixed-arity functions (`nlevel`, `subltree`), optional-arg\n * overloads (`subpath`, `index`), and the variadic `lca` (see ADR-001). `args`\n * already carries each value through `toExpr` with its codec; `args[0]` is the\n * `self` receiver.\n */\nfunction funcOp<C extends string>(\n method: string,\n fnName: string,\n returns: { readonly codecId: C; readonly nullable: false },\n args: readonly [AnyExpression, ...AnyExpression[]],\n): Expression<{ readonly codecId: C; readonly nullable: false }> {\n const placeholders = args.map((_, i) => (i === 0 ? \"{{self}}\" : `{{arg${i - 1}}}`)).join(\", \");\n return buildOperation({\n method,\n args,\n returns,\n lowering: {\n targetFamily: \"sql\",\n strategy: \"function\",\n template: `${fnName}(${placeholders})`,\n },\n });\n}\n\nexport function ltreeQueryOperations<CT extends CodecTypesBase>(): QueryOperationTypes<CT> {\n // Hierarchy operators compare two `ltree` values; the user argument shares the\n // column's `pg/ltree@1` codec. Pattern-match operators take a query/pattern\n // string (or `string[]`) that is NOT an ltree — it is bound as text and cast\n // in-template to `lquery` / `lquery[]` / `ltxtquery` (the validated-string-param\n // approach; verified executable under PGlite).\n const hierarchyOp = (\n method: string,\n operator: string,\n self: CodecExpression<typeof LTREE_CODEC_ID, boolean, CT>,\n other: CodecExpression<typeof LTREE_CODEC_ID, boolean, CT>,\n ): BoolReturn => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method,\n args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n returns: BOOL_RETURN,\n lowering: {\n targetFamily: \"sql\",\n strategy: \"function\",\n template: `{{self}} ${operator} {{arg0}}`,\n },\n });\n };\n\n const patternOp = (\n method: string,\n operator: string,\n castType: string,\n argCodecId: typeof TEXT_CODEC_ID | typeof TEXT_ARRAY_CODEC_ID,\n self: CodecExpression<typeof LTREE_CODEC_ID, boolean, CT>,\n arg: unknown,\n ): BoolReturn => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method,\n args: [toExpr(self, selfCodec), toExpr(arg, { codecId: argCodecId })],\n returns: BOOL_RETURN,\n lowering: {\n targetFamily: \"sql\",\n strategy: \"function\",\n template: `{{self}} ${operator} ({{arg0}})::${castType}`,\n },\n });\n };\n\n // Concatenation operators produce a new ltree. `concat` joins two ltree paths\n // (`{{self}} || {{arg0}}`); `concatText`/`prependText` splice a text label onto\n // the right/left. The text operand binds as `pg/text@1` and is cast in-template\n // (PG resolves the `||` overload from the cast). `prependText` places `{{self}}`\n // second because the ltree receiver is the RIGHT operand of `text || ltree`;\n // `args[0]` is still `self` (the renderer binds by placeholder name, not order).\n const concatOp = (\n method: string,\n template: string,\n args: readonly [AnyExpression, ...AnyExpression[]],\n ): LtreeReturn =>\n buildOperation({\n method,\n args,\n returns: LTREE_RETURN,\n lowering: { targetFamily: \"sql\", strategy: \"function\", template },\n });\n\n // Tier 3 — first-match operators on an `ltree[]` receiver (ADR-003).\n const firstMatchOp = (\n method: string,\n operator: string,\n self: CodecExpression<typeof LTREE_ARRAY_CODEC_ID, boolean, CT>,\n arg: unknown,\n argCodecId: typeof LTREE_CODEC_ID | typeof TEXT_CODEC_ID,\n castType?: string,\n ): LtreeReturn => {\n const selfCodec = codecOf(self);\n const template = castType\n ? `{{self}} ${operator} ({{arg0}})::${castType}`\n : `{{self}} ${operator} {{arg0}}`;\n return buildOperation({\n method,\n args: [toExpr(self, selfCodec), toExpr(arg, { codecId: argCodecId })],\n returns: LTREE_RETURN,\n lowering: { targetFamily: \"sql\", strategy: \"function\", template },\n });\n };\n\n return {\n isAncestorOf: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, other) => hierarchyOp(\"isAncestorOf\", \"@>\", self, other),\n },\n isDescendantOf: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, other) => hierarchyOp(\"isDescendantOf\", \"<@\", self, other),\n },\n matchesLquery: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, pattern) =>\n patternOp(\"matchesLquery\", \"~\", \"lquery\", TEXT_CODEC_ID, self, pattern),\n },\n matchesLqueryArray: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, patterns) =>\n patternOp(\"matchesLqueryArray\", \"?\", \"lquery[]\", TEXT_ARRAY_CODEC_ID, self, patterns),\n },\n matchesLtxtquery: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, query) =>\n patternOp(\"matchesLtxtquery\", \"@\", \"ltxtquery\", TEXT_CODEC_ID, self, query),\n },\n nlevel: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self): IntReturn =>\n funcOp(\"nlevel\", \"nlevel\", INT_RETURN, [toExpr(self, codecOf(self))]),\n },\n subltree: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, start, end): LtreeReturn =>\n funcOp(\"subltree\", \"subltree\", LTREE_RETURN, [\n toExpr(self, codecOf(self)),\n toExpr(start, { codecId: INT_CODEC_ID }),\n toExpr(end, { codecId: INT_CODEC_ID }),\n ]),\n },\n // `subpath(self, offset, len?)` — `len` omitted lowers to the 2-arg overload.\n subpath: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, offset, len): LtreeReturn => {\n const head: readonly [AnyExpression, AnyExpression] = [\n toExpr(self, codecOf(self)),\n toExpr(offset, { codecId: INT_CODEC_ID }),\n ];\n return funcOp(\n \"subpath\",\n \"subpath\",\n LTREE_RETURN,\n len === undefined ? head : [...head, toExpr(len, { codecId: INT_CODEC_ID })],\n );\n },\n },\n // `index(self, other, offset?)` — `offset` omitted lowers to the 2-arg overload.\n indexOf: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, other, offset): IntReturn => {\n const selfCodec = codecOf(self);\n const head: readonly [AnyExpression, AnyExpression] = [\n toExpr(self, selfCodec),\n toExpr(other, selfCodec),\n ];\n return funcOp(\n \"indexOf\",\n \"index\",\n INT_RETURN,\n offset === undefined ? head : [...head, toExpr(offset, { codecId: INT_CODEC_ID })],\n );\n },\n },\n // `lca(self, other, ...rest)` — variadic longest-common-ancestor (ADR-001).\n // PostgreSQL has no single-arg `lca`, so `other` is required (2–8 paths).\n lca: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, other, ...rest): LtreeReturn => {\n const selfCodec = codecOf(self);\n return funcOp(\"lca\", \"lca\", LTREE_RETURN, [\n toExpr(self, selfCodec),\n toExpr(other, selfCodec),\n ...rest.map((p) => toExpr(p, selfCodec)),\n ]);\n },\n },\n // Tier 2 — concatenation (`||`).\n concat: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, other): LtreeReturn => {\n const selfCodec = codecOf(self);\n return concatOp(\"concat\", \"{{self}} || {{arg0}}\", [\n toExpr(self, selfCodec),\n toExpr(other, selfCodec),\n ]);\n },\n },\n concatText: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, label): LtreeReturn =>\n concatOp(\"concatText\", \"{{self}} || ({{arg0}})::text\", [\n toExpr(self, codecOf(self)),\n toExpr(label, { codecId: TEXT_CODEC_ID }),\n ]),\n },\n // `text || ltree` — the ltree receiver is the right operand (ADR-002).\n prependText: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, prefix): LtreeReturn =>\n concatOp(\"prependText\", \"({{arg0}})::text || {{self}}\", [\n toExpr(self, codecOf(self)),\n toExpr(prefix, { codecId: TEXT_CODEC_ID }),\n ]),\n },\n // Tier 2 — conversion.\n toText: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self): TextReturn =>\n funcOp(\"toText\", \"ltree2text\", TEXT_RETURN, [toExpr(self, codecOf(self))]),\n },\n // `text2ltree(text)` — rooted on `pg/text@1` (the only reachable form of the\n // free-function `text2ltree`; see ADR-002). Surfaces as `.toLtree()` on text.\n toLtree: {\n self: { codecId: TEXT_CODEC_ID },\n impl: (self): LtreeReturn =>\n funcOp(\"toLtree\", \"text2ltree\", LTREE_RETURN, [toExpr(self, codecOf(self))]),\n },\n // Tier 3 — array first-match operators (ADR-003).\n firstAncestorOf: {\n self: { codecId: LTREE_ARRAY_CODEC_ID },\n impl: (self, other) => firstMatchOp(\"firstAncestorOf\", \"?@>\", self, other, LTREE_CODEC_ID),\n },\n firstDescendantOf: {\n self: { codecId: LTREE_ARRAY_CODEC_ID },\n impl: (self, other) => firstMatchOp(\"firstDescendantOf\", \"?<@\", self, other, LTREE_CODEC_ID),\n },\n firstMatchLquery: {\n self: { codecId: LTREE_ARRAY_CODEC_ID },\n impl: (self, pattern) =>\n firstMatchOp(\"firstMatchLquery\", \"?~\", self, pattern, TEXT_CODEC_ID, \"lquery\"),\n },\n firstMatchLtxtquery: {\n self: { codecId: LTREE_ARRAY_CODEC_ID },\n impl: (self, query) =>\n firstMatchOp(\"firstMatchLtxtquery\", \"?@\", self, query, TEXT_CODEC_ID, \"ltxtquery\"),\n },\n };\n}\n\nconst ltreePackMetaBase = {\n kind: \"extension\",\n id: \"ltree\",\n familyId: \"sql\",\n targetId: \"postgres\",\n version: \"0.1.0\",\n capabilities: {\n postgres: {\n \"ltree.path\": true,\n },\n },\n authoring: {\n type: ltreeAuthoringTypes,\n },\n types: {\n codecTypes: {\n codecDescriptors: Array.from(ltreeCodecRegistry.values()),\n import: {\n package: \"prisma-ltree/codec-types\",\n named: \"CodecTypes\",\n alias: \"LtreeTypes\",\n },\n typeImports: [\n {\n package: \"prisma-ltree/codec-types\",\n named: \"Ltree\",\n alias: \"Ltree\",\n },\n ],\n },\n queryOperationTypes: {\n import: {\n package: \"prisma-ltree/operation-types\",\n named: \"QueryOperationTypes\",\n alias: \"LtreeQueryOperationTypes\",\n },\n },\n storage: [\n {\n typeId: LTREE_CODEC_ID,\n familyId: \"sql\",\n targetId: \"postgres\",\n nativeType: LTREE_NATIVE_TYPE,\n },\n {\n typeId: LTREE_ARRAY_CODEC_ID,\n familyId: \"sql\",\n targetId: \"postgres\",\n nativeType: LTREE_ARRAY_NATIVE_TYPE,\n },\n ],\n },\n} as const;\n\nexport const ltreePackMeta: typeof ltreePackMetaBase & {\n readonly __codecTypes?: CodecTypes;\n} = ltreePackMetaBase;\n"],"mappings":";;;;;AAIA,MAAa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;GACE,QAAQ;GACR,UAAU;GACV,UAAU;GACV,YAAY;EACd,CACF;CACF;AAKE"}
|
|
1
|
+
{"version":3,"file":"descriptor-meta-Ch66mRPL.mjs","names":[],"sources":["../src/core/authoring.ts","../src/core/codecs.ts","../src/core/registry.ts","../src/core/descriptor-meta.ts"],"sourcesContent":["import type { AuthoringTypeNamespace } from \"@prisma-next/framework-components/authoring\";\nimport { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from \"./constants\";\nimport { LTREE_ARRAY_NATIVE_TYPE, LTREE_NATIVE_TYPE } from \"./contract-space-constants\";\n\nexport const ltreeAuthoringTypes = {\n ltree: {\n Ltree: {\n kind: \"typeConstructor\",\n output: {\n codecId: LTREE_CODEC_ID,\n nativeType: LTREE_NATIVE_TYPE,\n },\n },\n LtreeArray: {\n kind: \"typeConstructor\",\n output: {\n codecId: LTREE_ARRAY_CODEC_ID,\n nativeType: LTREE_ARRAY_NATIVE_TYPE,\n },\n },\n },\n} as const satisfies AuthoringTypeNamespace;\n","import type { JsonValue } from \"@prisma-next/contract/types\";\nimport {\n type AnyCodecDescriptor,\n type CodecCallContext,\n CodecDescriptorImpl,\n CodecImpl,\n type CodecInstanceContext,\n type ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n voidParamsSchema,\n} from \"@prisma-next/framework-components/codec\";\nimport type { ExtractCodecTypes } from \"@prisma-next/sql-relational-core/ast\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport {\n LTREE_ARRAY_CODEC_ID,\n LTREE_CODEC_ID,\n LTREE_MAX_LABEL_LENGTH,\n LTREE_MAX_LABELS,\n} from \"./constants\";\nimport { LTREE_ARRAY_NATIVE_TYPE, LTREE_NATIVE_TYPE } from \"./contract-space-constants\";\n\nconst LABEL_PATTERN = /^[A-Za-z0-9_-]+$/;\n\nexport function assertValidLtree(value: unknown): asserts value is string {\n if (typeof value !== \"string\") {\n throw new Error(\"ltree value must be a string\");\n }\n if (value.length === 0) {\n throw new Error(\"ltree value must not be empty\");\n }\n const labels = value.split(\".\");\n if (labels.length > LTREE_MAX_LABELS) {\n throw new Error(`ltree path exceeds max labels: got ${labels.length}, max ${LTREE_MAX_LABELS}`);\n }\n for (const label of labels) {\n if (label.length === 0) {\n throw new Error(`ltree label must not be empty in path \"${value}\"`);\n }\n if (label.length > LTREE_MAX_LABEL_LENGTH) {\n throw new Error(\n `ltree label exceeds max length: got ${label.length}, max ${LTREE_MAX_LABEL_LENGTH}`,\n );\n }\n if (!LABEL_PATTERN.test(label)) {\n throw new Error(\n `ltree label \"${label}\" contains invalid characters; allowed: alphanumeric, underscore, hyphen`,\n );\n }\n }\n}\n\nexport class LtreeCodec extends CodecImpl<\n typeof LTREE_CODEC_ID,\n readonly [\"equality\", \"order\"],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n assertValidLtree(value);\n return value;\n }\n\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n\n encodeJson(value: string): JsonValue {\n assertValidLtree(value);\n return value;\n }\n\n decodeJson(json: JsonValue): string {\n assertValidLtree(json);\n return json;\n }\n}\n\nconst LTREE_META = { db: { sql: { postgres: { nativeType: LTREE_NATIVE_TYPE } } } } as const;\n\nexport class LtreeDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = LTREE_CODEC_ID;\n override readonly traits = [\"equality\", \"order\"] as const;\n override readonly targetTypes = [LTREE_NATIVE_TYPE] as const;\n override readonly meta = LTREE_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override renderOutputType(): string {\n return \"string\";\n }\n override factory(): (ctx: CodecInstanceContext) => LtreeCodec {\n const shared = new LtreeCodec(this);\n return () => shared;\n }\n}\n\nexport const ltreeDescriptor = new LtreeDescriptor();\n\nexport const ltree = () =>\n column(ltreeDescriptor.factory(), ltreeDescriptor.codecId, undefined, LTREE_NATIVE_TYPE);\n\nltree satisfies ColumnHelperFor<LtreeDescriptor>;\nltree satisfies ColumnHelperForStrict<LtreeDescriptor>;\n\nconst LTREE_ARRAY_META = {\n db: { sql: { postgres: { nativeType: LTREE_ARRAY_NATIVE_TYPE } } },\n} as const;\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 CodecDescriptorImpl<void> {\n override readonly codecId = LTREE_ARRAY_CODEC_ID;\n override readonly traits = [\"equality\"] as const;\n override readonly targetTypes = [LTREE_ARRAY_NATIVE_TYPE] as const;\n override readonly meta = LTREE_ARRAY_META;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override renderOutputType(): string {\n return \"readonly string[]\";\n }\n override factory(): (ctx: CodecInstanceContext) => LtreeArrayCodec {\n const shared = new LtreeArrayCodec(this);\n return () => shared;\n }\n}\n\nexport const ltreeArrayDescriptor = new LtreeArrayDescriptor();\n\nexport const ltreeArray = () =>\n column(\n ltreeArrayDescriptor.factory(),\n ltreeArrayDescriptor.codecId,\n undefined,\n LTREE_ARRAY_NATIVE_TYPE,\n );\n\nltreeArray satisfies ColumnHelperFor<LtreeArrayDescriptor>;\nltreeArray satisfies ColumnHelperForStrict<LtreeArrayDescriptor>;\n\nconst codecDescriptorMap = {\n ltree: ltreeDescriptor,\n ltreeArray: ltreeArrayDescriptor,\n} as const;\n\nexport type CodecTypes = ExtractCodecTypes<typeof codecDescriptorMap>;\n\nexport const codecDescriptors: readonly AnyCodecDescriptor[] = Object.values(codecDescriptorMap);\n","import { buildCodecDescriptorRegistry } from \"@prisma-next/sql-relational-core/codec-descriptor-registry\";\nimport type { CodecDescriptorRegistry } from \"@prisma-next/sql-relational-core/query-lane-context\";\nimport { codecDescriptors } from \"./codecs\";\n\nexport const ltreeCodecRegistry: CodecDescriptorRegistry =\n buildCodecDescriptorRegistry(codecDescriptors);\n","import type { AnyExpression } from \"@prisma-next/sql-relational-core/ast\";\nimport {\n buildOperation,\n type CodecExpression,\n codecOf,\n type Expression,\n toExpr,\n} from \"@prisma-next/sql-relational-core/expression\";\nimport type { CodecTypes } from \"../types/codec-types\";\nimport type { QueryOperationTypes } from \"../types/operation-types\";\nimport { ltreeAuthoringTypes } from \"./authoring\";\nimport { LTREE_ARRAY_CODEC_ID, LTREE_CODEC_ID } from \"./constants\";\nimport { LTREE_ARRAY_NATIVE_TYPE, LTREE_NATIVE_TYPE } from \"./contract-space-constants\";\nimport { ltreeCodecRegistry } from \"./registry\";\n\ntype CodecTypesBase = Record<string, { readonly input: unknown; readonly output: unknown }>;\n\ntype BoolReturn = Expression<{ readonly codecId: \"pg/bool@1\"; readonly nullable: false }>;\ntype LtreeReturn = Expression<{ readonly codecId: \"pg/ltree@1\"; readonly nullable: false }>;\ntype IntReturn = Expression<{ readonly codecId: \"pg/int4@1\"; readonly nullable: false }>;\ntype TextReturn = Expression<{ readonly codecId: \"pg/text@1\"; readonly nullable: false }>;\n\nconst BOOL_RETURN = { codecId: \"pg/bool@1\", nullable: false } as const;\nconst LTREE_RETURN = { codecId: \"pg/ltree@1\", nullable: false } as const;\nconst INT_RETURN = { codecId: \"pg/int4@1\", nullable: false } as const;\nconst TEXT_RETURN = { codecId: \"pg/text@1\", nullable: false } as const;\nconst TEXT_CODEC_ID = \"pg/text@1\" as const;\nconst TEXT_ARRAY_CODEC_ID = \"pg/text-array@1\" as const;\nconst INT_CODEC_ID = \"pg/int4@1\" as const;\n\n/**\n * Build a function-style operation whose SQL is `fnName(self, arg0, arg1, ...)`.\n * The template's placeholder count is derived from the actual argument list, so\n * one helper covers fixed-arity functions (`nlevel`, `subltree`), optional-arg\n * overloads (`subpath`, `index`), and the variadic `lca` (see ADR-001). `args`\n * already carries each value through `toExpr` with its codec; `args[0]` is the\n * `self` receiver.\n */\nfunction funcOp<C extends string>(\n method: string,\n fnName: string,\n returns: { readonly codecId: C; readonly nullable: false },\n args: readonly [AnyExpression, ...AnyExpression[]],\n): Expression<{ readonly codecId: C; readonly nullable: false }> {\n const placeholders = args.map((_, i) => (i === 0 ? \"{{self}}\" : `{{arg${i - 1}}}`)).join(\", \");\n return buildOperation({\n method,\n args,\n returns,\n lowering: {\n targetFamily: \"sql\",\n strategy: \"function\",\n template: `${fnName}(${placeholders})`,\n },\n });\n}\n\nexport function ltreeQueryOperations<CT extends CodecTypesBase>(): QueryOperationTypes<CT> {\n // Hierarchy operators compare two `ltree` values; the user argument shares the\n // column's `pg/ltree@1` codec. Pattern-match operators take a query/pattern\n // string (or `string[]`) that is NOT an ltree — it is bound as text and cast\n // in-template to `lquery` / `lquery[]` / `ltxtquery` (the validated-string-param\n // approach; verified executable under PGlite).\n const hierarchyOp = (\n method: string,\n operator: string,\n self: CodecExpression<typeof LTREE_CODEC_ID, boolean, CT>,\n other: CodecExpression<typeof LTREE_CODEC_ID, boolean, CT>,\n ): BoolReturn => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method,\n args: [toExpr(self, selfCodec), toExpr(other, selfCodec)],\n returns: BOOL_RETURN,\n lowering: {\n targetFamily: \"sql\",\n strategy: \"function\",\n template: `{{self}} ${operator} {{arg0}}`,\n },\n });\n };\n\n const patternOp = (\n method: string,\n operator: string,\n castType: string,\n argCodecId: typeof TEXT_CODEC_ID | typeof TEXT_ARRAY_CODEC_ID,\n self: CodecExpression<typeof LTREE_CODEC_ID, boolean, CT>,\n arg: unknown,\n ): BoolReturn => {\n const selfCodec = codecOf(self);\n return buildOperation({\n method,\n args: [toExpr(self, selfCodec), toExpr(arg, { codecId: argCodecId })],\n returns: BOOL_RETURN,\n lowering: {\n targetFamily: \"sql\",\n strategy: \"function\",\n template: `{{self}} ${operator} ({{arg0}})::${castType}`,\n },\n });\n };\n\n // Concatenation operators produce a new ltree. `concat` joins two ltree paths\n // (`{{self}} || {{arg0}}`); `concatText`/`prependText` splice a text label onto\n // the right/left. The text operand binds as `pg/text@1` and is cast in-template\n // (PG resolves the `||` overload from the cast). `prependText` places `{{self}}`\n // second because the ltree receiver is the RIGHT operand of `text || ltree`;\n // `args[0]` is still `self` (the renderer binds by placeholder name, not order).\n const concatOp = (\n method: string,\n template: string,\n args: readonly [AnyExpression, ...AnyExpression[]],\n ): LtreeReturn =>\n buildOperation({\n method,\n args,\n returns: LTREE_RETURN,\n lowering: { targetFamily: \"sql\", strategy: \"function\", template },\n });\n\n // Tier 3 — first-match operators on an `ltree[]` receiver (ADR-003).\n const firstMatchOp = (\n method: string,\n operator: string,\n self: CodecExpression<typeof LTREE_ARRAY_CODEC_ID, boolean, CT>,\n arg: unknown,\n argCodecId: typeof LTREE_CODEC_ID | typeof TEXT_CODEC_ID,\n castType?: string,\n ): LtreeReturn => {\n const selfCodec = codecOf(self);\n const template = castType\n ? `{{self}} ${operator} ({{arg0}})::${castType}`\n : `{{self}} ${operator} {{arg0}}`;\n return buildOperation({\n method,\n args: [toExpr(self, selfCodec), toExpr(arg, { codecId: argCodecId })],\n returns: LTREE_RETURN,\n lowering: { targetFamily: \"sql\", strategy: \"function\", template },\n });\n };\n\n return {\n isAncestorOf: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, other) => hierarchyOp(\"isAncestorOf\", \"@>\", self, other),\n },\n isDescendantOf: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, other) => hierarchyOp(\"isDescendantOf\", \"<@\", self, other),\n },\n matchesLquery: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, pattern) =>\n patternOp(\"matchesLquery\", \"~\", \"lquery\", TEXT_CODEC_ID, self, pattern),\n },\n matchesLqueryArray: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, patterns) =>\n patternOp(\"matchesLqueryArray\", \"?\", \"lquery[]\", TEXT_ARRAY_CODEC_ID, self, patterns),\n },\n matchesLtxtquery: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, query) =>\n patternOp(\"matchesLtxtquery\", \"@\", \"ltxtquery\", TEXT_CODEC_ID, self, query),\n },\n nlevel: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self): IntReturn =>\n funcOp(\"nlevel\", \"nlevel\", INT_RETURN, [toExpr(self, codecOf(self))]),\n },\n subltree: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, start, end): LtreeReturn =>\n funcOp(\"subltree\", \"subltree\", LTREE_RETURN, [\n toExpr(self, codecOf(self)),\n toExpr(start, { codecId: INT_CODEC_ID }),\n toExpr(end, { codecId: INT_CODEC_ID }),\n ]),\n },\n // `subpath(self, offset, len?)` — `len` omitted lowers to the 2-arg overload.\n subpath: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, offset, len): LtreeReturn => {\n const head: readonly [AnyExpression, AnyExpression] = [\n toExpr(self, codecOf(self)),\n toExpr(offset, { codecId: INT_CODEC_ID }),\n ];\n return funcOp(\n \"subpath\",\n \"subpath\",\n LTREE_RETURN,\n len === undefined ? head : [...head, toExpr(len, { codecId: INT_CODEC_ID })],\n );\n },\n },\n // `index(self, other, offset?)` — `offset` omitted lowers to the 2-arg overload.\n indexOf: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, other, offset): IntReturn => {\n const selfCodec = codecOf(self);\n const head: readonly [AnyExpression, AnyExpression] = [\n toExpr(self, selfCodec),\n toExpr(other, selfCodec),\n ];\n return funcOp(\n \"indexOf\",\n \"index\",\n INT_RETURN,\n offset === undefined ? head : [...head, toExpr(offset, { codecId: INT_CODEC_ID })],\n );\n },\n },\n // `lca(self, other, ...rest)` — variadic longest-common-ancestor (ADR-001).\n // PostgreSQL has no single-arg `lca`, so `other` is required (2–8 paths).\n lca: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, other, ...rest): LtreeReturn => {\n const selfCodec = codecOf(self);\n return funcOp(\"lca\", \"lca\", LTREE_RETURN, [\n toExpr(self, selfCodec),\n toExpr(other, selfCodec),\n ...rest.map((p) => toExpr(p, selfCodec)),\n ]);\n },\n },\n // Tier 2 — concatenation (`||`).\n concat: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, other): LtreeReturn => {\n const selfCodec = codecOf(self);\n return concatOp(\"concat\", \"{{self}} || {{arg0}}\", [\n toExpr(self, selfCodec),\n toExpr(other, selfCodec),\n ]);\n },\n },\n concatText: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, label): LtreeReturn =>\n concatOp(\"concatText\", \"{{self}} || ({{arg0}})::text\", [\n toExpr(self, codecOf(self)),\n toExpr(label, { codecId: TEXT_CODEC_ID }),\n ]),\n },\n // `text || ltree` — the ltree receiver is the right operand (ADR-002).\n prependText: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self, prefix): LtreeReturn =>\n concatOp(\"prependText\", \"({{arg0}})::text || {{self}}\", [\n toExpr(self, codecOf(self)),\n toExpr(prefix, { codecId: TEXT_CODEC_ID }),\n ]),\n },\n // Tier 2 — conversion.\n toText: {\n self: { codecId: LTREE_CODEC_ID },\n impl: (self): TextReturn =>\n funcOp(\"toText\", \"ltree2text\", TEXT_RETURN, [toExpr(self, codecOf(self))]),\n },\n // `text2ltree(text)` — rooted on `pg/text@1` (the only reachable form of the\n // free-function `text2ltree`; see ADR-002). Surfaces as `.toLtree()` on text.\n toLtree: {\n self: { codecId: TEXT_CODEC_ID },\n impl: (self): LtreeReturn =>\n funcOp(\"toLtree\", \"text2ltree\", LTREE_RETURN, [toExpr(self, codecOf(self))]),\n },\n // Tier 3 — array first-match operators (ADR-003).\n firstAncestorOf: {\n self: { codecId: LTREE_ARRAY_CODEC_ID },\n impl: (self, other) => firstMatchOp(\"firstAncestorOf\", \"?@>\", self, other, LTREE_CODEC_ID),\n },\n firstDescendantOf: {\n self: { codecId: LTREE_ARRAY_CODEC_ID },\n impl: (self, other) => firstMatchOp(\"firstDescendantOf\", \"?<@\", self, other, LTREE_CODEC_ID),\n },\n firstMatchLquery: {\n self: { codecId: LTREE_ARRAY_CODEC_ID },\n impl: (self, pattern) =>\n firstMatchOp(\"firstMatchLquery\", \"?~\", self, pattern, TEXT_CODEC_ID, \"lquery\"),\n },\n firstMatchLtxtquery: {\n self: { codecId: LTREE_ARRAY_CODEC_ID },\n impl: (self, query) =>\n firstMatchOp(\"firstMatchLtxtquery\", \"?@\", self, query, TEXT_CODEC_ID, \"ltxtquery\"),\n },\n // `lca(ltree[])` — array-receiver form (ADR-001, ADR-005). Named `lcaAll`\n // because prisma-next keys operations by name only (`createOperationRegistry`\n // throws on a duplicate); `lca` is already the variadic scalar method on\n // `pg/ltree@1`. Declares `nullable: false` for parity with the Tier 3\n // first-match ops even though PG returns NULL for an empty/NULL `ltree[]`\n // (see the empty-array integration test) — a family-wide gap, not specific\n // to `lcaAll`.\n lcaAll: {\n self: { codecId: LTREE_ARRAY_CODEC_ID },\n impl: (self): LtreeReturn =>\n funcOp(\"lcaAll\", \"lca\", LTREE_RETURN, [toExpr(self, codecOf(self))]),\n },\n };\n}\n\nconst ltreePackMetaBase = {\n kind: \"extension\",\n id: \"ltree\",\n familyId: \"sql\",\n targetId: \"postgres\",\n version: \"0.1.0\",\n capabilities: {\n postgres: {\n \"ltree.path\": true,\n },\n },\n authoring: {\n type: ltreeAuthoringTypes,\n },\n types: {\n codecTypes: {\n codecDescriptors: Array.from(ltreeCodecRegistry.values()),\n import: {\n package: \"prisma-ltree/codec-types\",\n named: \"CodecTypes\",\n alias: \"LtreeTypes\",\n },\n typeImports: [\n {\n package: \"prisma-ltree/codec-types\",\n named: \"Ltree\",\n alias: \"Ltree\",\n },\n ],\n },\n queryOperationTypes: {\n import: {\n package: \"prisma-ltree/operation-types\",\n named: \"QueryOperationTypes\",\n alias: \"LtreeQueryOperationTypes\",\n },\n },\n storage: [\n {\n typeId: LTREE_CODEC_ID,\n familyId: \"sql\",\n targetId: \"postgres\",\n nativeType: LTREE_NATIVE_TYPE,\n },\n {\n typeId: LTREE_ARRAY_CODEC_ID,\n familyId: \"sql\",\n targetId: \"postgres\",\n nativeType: LTREE_ARRAY_NATIVE_TYPE,\n },\n ],\n },\n} as const;\n\nexport const ltreePackMeta: typeof ltreePackMetaBase & {\n readonly __codecTypes?: CodecTypes;\n} = ltreePackMetaBase;\n"],"mappings":";;;;;AAIA,MAAa,sBAAsB,EACjC,OAAO;CACL,OAAO;EACL,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;EACd;CACF;CACA,YAAY;EACV,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;EACd;CACF;AACF,EACF;;;ACCA,MAAM,gBAAgB;AAEtB,SAAgB,iBAAiB,OAAyC;CACxE,IAAI,OAAO,UAAU,UACnB,MAAM,IAAI,MAAM,8BAA8B;CAEhD,IAAI,MAAM,WAAW,GACnB,MAAM,IAAI,MAAM,+BAA+B;CAEjD,MAAM,SAAS,MAAM,MAAM,GAAG;CAC9B,IAAI,OAAO,SAAA,OACT,MAAM,IAAI,MAAM,sCAAsC,OAAO,OAAO,QAAQ,kBAAkB;CAEhG,KAAK,MAAM,SAAS,QAAQ;EAC1B,IAAI,MAAM,WAAW,GACnB,MAAM,IAAI,MAAM,0CAA0C,MAAM,EAAE;EAEpE,IAAI,MAAM,SAAA,KACR,MAAM,IAAI,MACR,uCAAuC,MAAM,OAAO,QAAQ,wBAC9D;EAEF,IAAI,CAAC,cAAc,KAAK,KAAK,GAC3B,MAAM,IAAI,MACR,gBAAgB,MAAM,yEACxB;CAEJ;AACF;AAEA,IAAa,aAAb,cAAgC,UAK9B;CACA,MAAM,OAAO,OAAe,MAAyC;EACnE,iBAAiB,KAAK;EACtB,OAAO;CACT;CAEA,MAAM,OAAO,MAAc,MAAyC;EAClE,OAAO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,CAAC,CAAC,CAAC;EACvE;CACF;AACF;AAwDA,MAAa,gBAET;CAvDF,MAAM;CACN,IAAI;CACJ,UAAU;CACV,UAAU;CACV,SAAS;CACT,cAAc,EACZ,UAAU,EACR,cAAc,KAChB,EACF;CACA,WAAW,EACT,MAAM,oBACR;CACA,OAAO;EACL,YAAY;GACV,kBAAkB,MAAM,KAAK,mBAAmB,OAAO,CAAC;GACxD,QAAQ;IACN,SAAS;IACT,OAAO;IACP,OAAO;GACT;GACA,aAAa,CACX;IACE,SAAS;IACT,OAAO;IACP,OAAO;GACT,CACF;EACF;EACA,qBAAqB,EACnB,QAAQ;GACN,SAAS;GACT,OAAO;GACP,OAAO;EACT,EACF;EACA,SAAS,CACP;GACE,QAAQ;GACR,UAAU;GACV,UAAU;GACV,YAAY;EACd,GACA;GACE,QAAQ;GACR,UAAU;GACV,UAAU;GACV,YAAY;EACd,CACF;CACF;AAKE"}
|
|
@@ -178,7 +178,16 @@ type QueryOperationTypes<CT extends CodecTypesBase> = SqlQueryOperationTypes<CT,
|
|
|
178
178
|
readonly nullable: false;
|
|
179
179
|
}>;
|
|
180
180
|
};
|
|
181
|
+
readonly lcaAll: {
|
|
182
|
+
readonly self: {
|
|
183
|
+
readonly codecId: "pg/ltree-array@1";
|
|
184
|
+
};
|
|
185
|
+
readonly impl: (self: CodecExpression<"pg/ltree-array@1", boolean, CT>) => Expression<{
|
|
186
|
+
readonly codecId: "pg/ltree@1";
|
|
187
|
+
readonly nullable: false;
|
|
188
|
+
}>;
|
|
189
|
+
};
|
|
181
190
|
}>;
|
|
182
191
|
//#endregion
|
|
183
192
|
export { QueryOperationTypes as t };
|
|
184
|
-
//# sourceMappingURL=operation-types-
|
|
193
|
+
//# sourceMappingURL=operation-types-BFxNrlNL.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-types-
|
|
1
|
+
{"version":3,"file":"operation-types-BFxNrlNL.d.mts","names":[],"sources":["../src/types/operation-types.ts"],"mapp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A;IAAA;EAAA;EAAA,SAEpD,iBAAA;IAAA,SACE,IAAA;MAAA,SAAiB,OAAA;IAAA;IAAA,SACjB,IAAA,GACP,IAAA,EAAM,eAAA,8BAA6C,EAAA,GACnD,KAAA,EAAO,eAAA,wBAAuC,EAAA,MAC3C,UAAA;MAAA,SAAsB,OAAA;MAAA,SAAgC,QAAA;IAAA;EAAA;EAAA,SAEpD,gBAAA;IAAA,SACE,IAAA;MAAA,SAAiB,OAAA;IAAA;IAAA,SACjB,IAAA,GACP,IAAA,EAAM,eAAA,8BAA6C,EAAA,GACnD,OAAA,EAAS,eAAA,uBAAsC,EAAA,MAC5C,UAAA;MAAA,SAAsB,OAAA;MAAA,SAAgC,QAAA;IAAA;EAAA;EAAA,SAEpD,mBAAA;IAAA,SACE,IAAA;MAAA,SAAiB,OAAA;IAAA;IAAA,SACjB,IAAA,GACP,IAAA,EAAM,eAAA,8BAA6C,EAAA,GACnD,KAAA,EAAO,eAAA,uBAAsC,EAAA,MAC1C,UAAA;MAAA,SAAsB,OAAA;MAAA,SAAgC,QAAA;IAAA;EAAA;EAAA,SAMpD,MAAA;IAAA,SACE,IAAA;MAAA,SAAiB,OAAA;IAAA;IAAA,SACjB,IAAA,GACP,IAAA,EAAM,eAAA,8BAA6C,EAAA,MAChD,UAAA;MAAA,SAAsB,OAAA;MAAA,SAAgC,QAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as QueryOperationTypes } from "./operation-types-
|
|
1
|
+
import { t as QueryOperationTypes } from "./operation-types-BFxNrlNL.mjs";
|
|
2
2
|
export type { QueryOperationTypes };
|
package/dist/pack.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.d.mts","names":[],"sources":["../src/core/descriptor-meta.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"pack.d.mts","names":[],"sources":["../src/core/descriptor-meta.ts"],"mappings":";;cA6SM,iBAAA;EAAA,SACJ,IAAA;EAAA,SACA,EAAA;EAAA,SACA,QAAA;EAAA,SACA,QAAA;EAAA,SACA,OAAA;EAAA,SACA,YAAA;IAAA,SACE,QAAA;MAAA,SACE,YAAA;IAAA;EAAA;EAAA,SAGJ,SAAA;IAAA,SACE,IAAA;MAAA;;;;;;;;;;;;;;;;;;WAEF,KAAA;IAAA,SACE,UAAA;MAAA,SACE,gBAAA,oDAAgB,eAAA;MAAA,SAChB,MAAA;QAAA,SACE,OAAA;QAAA,SACA,KAAA;QAAA,SACA,KAAA;MAAA;MAAA,SAEF,WAAA;QAAA,SAEI,OAAA;QAAA,SACA,KAAA;QAAA,SACA,KAAA;MAAA;IAAA;IAAA,SAIN,mBAAA;MAAA,SACE,MAAA;QAAA,SACE,OAAA;QAAA,SACA,KAAA;QAAA,SACA,KAAA;MAAA;IAAA;IAAA,SAGJ,OAAA;MAAA,SAEI,MAAA;MAAA,SACA,QAAA;MAAA,SACA,QAAA;MAAA,SACA,UAAA;IAAA;MAAA,SAGA,MAAA;MAAA,SACA,QAAA;MAAA,SACA,QAAA;MAAA,SACA,UAAA;IAAA;EAAA;AAAA;AAAA,cAMK,aAAA,SAAsB,iBAAA;EAAA,SACxB,YAAA,GAAe,UAAU;AAAA"}
|
package/dist/pack.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as ltreePackMeta } from "./descriptor-meta-
|
|
1
|
+
import { t as ltreePackMeta } from "./descriptor-meta-Ch66mRPL.mjs";
|
|
2
2
|
export { ltreePackMeta as default };
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ltreeQueryOperations, r as ltreeCodecRegistry, t as ltreePackMeta } from "./descriptor-meta-
|
|
1
|
+
import { n as ltreeQueryOperations, r as ltreeCodecRegistry, t as ltreePackMeta } from "./descriptor-meta-Ch66mRPL.mjs";
|
|
2
2
|
//#region src/exports/runtime.ts
|
|
3
3
|
const ltreeRuntimeDescriptor = {
|
|
4
4
|
kind: "extension",
|
package/package.json
CHANGED
|
@@ -284,6 +284,18 @@ export function ltreeQueryOperations<CT extends CodecTypesBase>(): QueryOperatio
|
|
|
284
284
|
impl: (self, query) =>
|
|
285
285
|
firstMatchOp("firstMatchLtxtquery", "?@", self, query, TEXT_CODEC_ID, "ltxtquery"),
|
|
286
286
|
},
|
|
287
|
+
// `lca(ltree[])` — array-receiver form (ADR-001, ADR-005). Named `lcaAll`
|
|
288
|
+
// because prisma-next keys operations by name only (`createOperationRegistry`
|
|
289
|
+
// throws on a duplicate); `lca` is already the variadic scalar method on
|
|
290
|
+
// `pg/ltree@1`. Declares `nullable: false` for parity with the Tier 3
|
|
291
|
+
// first-match ops even though PG returns NULL for an empty/NULL `ltree[]`
|
|
292
|
+
// (see the empty-array integration test) — a family-wide gap, not specific
|
|
293
|
+
// to `lcaAll`.
|
|
294
|
+
lcaAll: {
|
|
295
|
+
self: { codecId: LTREE_ARRAY_CODEC_ID },
|
|
296
|
+
impl: (self): LtreeReturn =>
|
|
297
|
+
funcOp("lcaAll", "lca", LTREE_RETURN, [toExpr(self, codecOf(self))]),
|
|
298
|
+
},
|
|
287
299
|
};
|
|
288
300
|
}
|
|
289
301
|
|
|
@@ -152,5 +152,15 @@ export type QueryOperationTypes<CT extends CodecTypesBase> = SqlQueryOperationTy
|
|
|
152
152
|
query: CodecExpression<"pg/text@1", boolean, CT>,
|
|
153
153
|
) => Expression<{ readonly codecId: "pg/ltree@1"; readonly nullable: false }>;
|
|
154
154
|
};
|
|
155
|
+
// `lca(ltree[])` — ships as `lcaAll()` (ADR-001, ADR-005); not `lca()`
|
|
156
|
+
// because prisma-next operation names are globally unique across the composed
|
|
157
|
+
// stack. `nullable: false` mirrors the first-match ops (PG can return NULL for
|
|
158
|
+
// an empty/NULL array — a shared Tier 3 gap, tracked separately).
|
|
159
|
+
readonly lcaAll: {
|
|
160
|
+
readonly self: { readonly codecId: "pg/ltree-array@1" };
|
|
161
|
+
readonly impl: (
|
|
162
|
+
self: CodecExpression<"pg/ltree-array@1", boolean, CT>,
|
|
163
|
+
) => Expression<{ readonly codecId: "pg/ltree@1"; readonly nullable: false }>;
|
|
164
|
+
};
|
|
155
165
|
}
|
|
156
166
|
>;
|