@_linked/core 2.12.0 → 2.13.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 (246) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/esm/queries/IRPipeline.d.ts +7 -1
  3. package/lib/esm/queries/IRPipeline.js +20 -6
  4. package/lib/esm/queries/IRPipeline.js.map +1 -1
  5. package/lib/esm/queries/queryDispatch.js +12 -2
  6. package/lib/esm/queries/queryDispatch.js.map +1 -1
  7. package/package.json +10 -13
  8. package/lib/cjs/collections/CoreSet.d.ts +0 -47
  9. package/lib/cjs/collections/CoreSet.js +0 -136
  10. package/lib/cjs/collections/CoreSet.js.map +0 -1
  11. package/lib/cjs/collections/ShapeSet.d.ts +0 -6
  12. package/lib/cjs/collections/ShapeSet.js +0 -20
  13. package/lib/cjs/collections/ShapeSet.js.map +0 -1
  14. package/lib/cjs/expressions/Expr.d.ts +0 -29
  15. package/lib/cjs/expressions/Expr.js +0 -80
  16. package/lib/cjs/expressions/Expr.js.map +0 -1
  17. package/lib/cjs/expressions/ExpressionMethods.d.ts +0 -85
  18. package/lib/cjs/expressions/ExpressionMethods.js +0 -3
  19. package/lib/cjs/expressions/ExpressionMethods.js.map +0 -1
  20. package/lib/cjs/expressions/ExpressionNode.d.ts +0 -144
  21. package/lib/cjs/expressions/ExpressionNode.js +0 -432
  22. package/lib/cjs/expressions/ExpressionNode.js.map +0 -1
  23. package/lib/cjs/index.d.ts +0 -29
  24. package/lib/cjs/index.js +0 -65
  25. package/lib/cjs/index.js.map +0 -1
  26. package/lib/cjs/interfaces/ICoreIterable.d.ts +0 -14
  27. package/lib/cjs/interfaces/ICoreIterable.js +0 -3
  28. package/lib/cjs/interfaces/ICoreIterable.js.map +0 -1
  29. package/lib/cjs/interfaces/IDataset.d.ts +0 -26
  30. package/lib/cjs/interfaces/IDataset.js +0 -3
  31. package/lib/cjs/interfaces/IDataset.js.map +0 -1
  32. package/lib/cjs/interfaces/IFileStore.d.ts +0 -16
  33. package/lib/cjs/interfaces/IFileStore.js +0 -3
  34. package/lib/cjs/interfaces/IFileStore.js.map +0 -1
  35. package/lib/cjs/ontologies/linked-core.d.ts +0 -15
  36. package/lib/cjs/ontologies/linked-core.js +0 -38
  37. package/lib/cjs/ontologies/linked-core.js.map +0 -1
  38. package/lib/cjs/ontologies/npm.d.ts +0 -6
  39. package/lib/cjs/ontologies/npm.js +0 -15
  40. package/lib/cjs/ontologies/npm.js.map +0 -1
  41. package/lib/cjs/ontologies/owl.d.ts +0 -14
  42. package/lib/cjs/ontologies/owl.js +0 -21
  43. package/lib/cjs/ontologies/owl.js.map +0 -1
  44. package/lib/cjs/ontologies/rdf.d.ts +0 -13
  45. package/lib/cjs/ontologies/rdf.js +0 -27
  46. package/lib/cjs/ontologies/rdf.js.map +0 -1
  47. package/lib/cjs/ontologies/rdfs.d.ts +0 -16
  48. package/lib/cjs/ontologies/rdfs.js +0 -33
  49. package/lib/cjs/ontologies/rdfs.js.map +0 -1
  50. package/lib/cjs/ontologies/shacl.d.ts +0 -103
  51. package/lib/cjs/ontologies/shacl.js +0 -152
  52. package/lib/cjs/ontologies/shacl.js.map +0 -1
  53. package/lib/cjs/ontologies/xsd.d.ts +0 -19
  54. package/lib/cjs/ontologies/xsd.js +0 -41
  55. package/lib/cjs/ontologies/xsd.js.map +0 -1
  56. package/lib/cjs/package.d.ts +0 -4
  57. package/lib/cjs/package.js +0 -6
  58. package/lib/cjs/package.js.map +0 -1
  59. package/lib/cjs/package.json +0 -9
  60. package/lib/cjs/paths/PropertyPathExpr.d.ts +0 -38
  61. package/lib/cjs/paths/PropertyPathExpr.js +0 -221
  62. package/lib/cjs/paths/PropertyPathExpr.js.map +0 -1
  63. package/lib/cjs/paths/normalizePropertyPath.d.ts +0 -23
  64. package/lib/cjs/paths/normalizePropertyPath.js +0 -75
  65. package/lib/cjs/paths/normalizePropertyPath.js.map +0 -1
  66. package/lib/cjs/paths/pathExprToSparql.d.ts +0 -14
  67. package/lib/cjs/paths/pathExprToSparql.js +0 -136
  68. package/lib/cjs/paths/pathExprToSparql.js.map +0 -1
  69. package/lib/cjs/queries/ContextRef.d.ts +0 -32
  70. package/lib/cjs/queries/ContextRef.js +0 -69
  71. package/lib/cjs/queries/ContextRef.js.map +0 -1
  72. package/lib/cjs/queries/CreateBuilder.d.ts +0 -59
  73. package/lib/cjs/queries/CreateBuilder.js +0 -138
  74. package/lib/cjs/queries/CreateBuilder.js.map +0 -1
  75. package/lib/cjs/queries/CreateQuery.d.ts +0 -20
  76. package/lib/cjs/queries/CreateQuery.js +0 -3
  77. package/lib/cjs/queries/CreateQuery.js.map +0 -1
  78. package/lib/cjs/queries/DeleteBuilder.d.ts +0 -56
  79. package/lib/cjs/queries/DeleteBuilder.js +0 -172
  80. package/lib/cjs/queries/DeleteBuilder.js.map +0 -1
  81. package/lib/cjs/queries/DeleteQuery.d.ts +0 -37
  82. package/lib/cjs/queries/DeleteQuery.js +0 -3
  83. package/lib/cjs/queries/DeleteQuery.js.map +0 -1
  84. package/lib/cjs/queries/DslJsonExpression.d.ts +0 -68
  85. package/lib/cjs/queries/DslJsonExpression.js +0 -427
  86. package/lib/cjs/queries/DslJsonExpression.js.map +0 -1
  87. package/lib/cjs/queries/FieldSet.d.ts +0 -310
  88. package/lib/cjs/queries/FieldSet.js +0 -802
  89. package/lib/cjs/queries/FieldSet.js.map +0 -1
  90. package/lib/cjs/queries/IRAliasScope.d.ts +0 -20
  91. package/lib/cjs/queries/IRAliasScope.js +0 -52
  92. package/lib/cjs/queries/IRAliasScope.js.map +0 -1
  93. package/lib/cjs/queries/IRCanonicalize.d.ts +0 -19
  94. package/lib/cjs/queries/IRCanonicalize.js +0 -19
  95. package/lib/cjs/queries/IRCanonicalize.js.map +0 -1
  96. package/lib/cjs/queries/IRDesugar.d.ts +0 -123
  97. package/lib/cjs/queries/IRDesugar.js +0 -261
  98. package/lib/cjs/queries/IRDesugar.js.map +0 -1
  99. package/lib/cjs/queries/IRLower.d.ts +0 -25
  100. package/lib/cjs/queries/IRLower.js +0 -398
  101. package/lib/cjs/queries/IRLower.js.map +0 -1
  102. package/lib/cjs/queries/IRMutation.d.ts +0 -53
  103. package/lib/cjs/queries/IRMutation.js +0 -130
  104. package/lib/cjs/queries/IRMutation.js.map +0 -1
  105. package/lib/cjs/queries/IRPipeline.d.ts +0 -8
  106. package/lib/cjs/queries/IRPipeline.js +0 -25
  107. package/lib/cjs/queries/IRPipeline.js.map +0 -1
  108. package/lib/cjs/queries/IRProjection.d.ts +0 -39
  109. package/lib/cjs/queries/IRProjection.js +0 -105
  110. package/lib/cjs/queries/IRProjection.js.map +0 -1
  111. package/lib/cjs/queries/IntermediateRepresentation.d.ts +0 -282
  112. package/lib/cjs/queries/IntermediateRepresentation.js +0 -3
  113. package/lib/cjs/queries/IntermediateRepresentation.js.map +0 -1
  114. package/lib/cjs/queries/MutationQuery.d.ts +0 -50
  115. package/lib/cjs/queries/MutationQuery.js +0 -334
  116. package/lib/cjs/queries/MutationQuery.js.map +0 -1
  117. package/lib/cjs/queries/MutationSerialization.d.ts +0 -102
  118. package/lib/cjs/queries/MutationSerialization.js +0 -207
  119. package/lib/cjs/queries/MutationSerialization.js.map +0 -1
  120. package/lib/cjs/queries/MutationThenable.d.ts +0 -18
  121. package/lib/cjs/queries/MutationThenable.js +0 -32
  122. package/lib/cjs/queries/MutationThenable.js.map +0 -1
  123. package/lib/cjs/queries/PropertyPath.d.ts +0 -38
  124. package/lib/cjs/queries/PropertyPath.js +0 -82
  125. package/lib/cjs/queries/PropertyPath.js.map +0 -1
  126. package/lib/cjs/queries/ProxiedPathBuilder.d.ts +0 -14
  127. package/lib/cjs/queries/ProxiedPathBuilder.js +0 -29
  128. package/lib/cjs/queries/ProxiedPathBuilder.js.map +0 -1
  129. package/lib/cjs/queries/QueryBuilder.d.ts +0 -193
  130. package/lib/cjs/queries/QueryBuilder.js +0 -519
  131. package/lib/cjs/queries/QueryBuilder.js.map +0 -1
  132. package/lib/cjs/queries/QueryBuilderSerialization.d.ts +0 -31
  133. package/lib/cjs/queries/QueryBuilderSerialization.js +0 -68
  134. package/lib/cjs/queries/QueryBuilderSerialization.js.map +0 -1
  135. package/lib/cjs/queries/QueryContext.d.ts +0 -50
  136. package/lib/cjs/queries/QueryContext.js +0 -147
  137. package/lib/cjs/queries/QueryContext.js.map +0 -1
  138. package/lib/cjs/queries/QueryFactory.d.ts +0 -80
  139. package/lib/cjs/queries/QueryFactory.js +0 -21
  140. package/lib/cjs/queries/QueryFactory.js.map +0 -1
  141. package/lib/cjs/queries/SelectQuery.d.ts +0 -302
  142. package/lib/cjs/queries/SelectQuery.js +0 -761
  143. package/lib/cjs/queries/SelectQuery.js.map +0 -1
  144. package/lib/cjs/queries/UpdateBuilder.d.ts +0 -69
  145. package/lib/cjs/queries/UpdateBuilder.js +0 -199
  146. package/lib/cjs/queries/UpdateBuilder.js.map +0 -1
  147. package/lib/cjs/queries/UpdateQuery.d.ts +0 -18
  148. package/lib/cjs/queries/UpdateQuery.js +0 -3
  149. package/lib/cjs/queries/UpdateQuery.js.map +0 -1
  150. package/lib/cjs/queries/fromJSON.d.ts +0 -16
  151. package/lib/cjs/queries/fromJSON.js +0 -41
  152. package/lib/cjs/queries/fromJSON.js.map +0 -1
  153. package/lib/cjs/queries/lower.d.ts +0 -28
  154. package/lib/cjs/queries/lower.js +0 -114
  155. package/lib/cjs/queries/lower.js.map +0 -1
  156. package/lib/cjs/queries/lowerMutationJSON.d.ts +0 -25
  157. package/lib/cjs/queries/lowerMutationJSON.js +0 -173
  158. package/lib/cjs/queries/lowerMutationJSON.js.map +0 -1
  159. package/lib/cjs/queries/mutationLowerSpec.d.ts +0 -32
  160. package/lib/cjs/queries/mutationLowerSpec.js +0 -8
  161. package/lib/cjs/queries/mutationLowerSpec.js.map +0 -1
  162. package/lib/cjs/queries/queryDispatch.d.ts +0 -33
  163. package/lib/cjs/queries/queryDispatch.js +0 -33
  164. package/lib/cjs/queries/queryDispatch.js.map +0 -1
  165. package/lib/cjs/queries/resolveShape.d.ts +0 -10
  166. package/lib/cjs/queries/resolveShape.js +0 -23
  167. package/lib/cjs/queries/resolveShape.js.map +0 -1
  168. package/lib/cjs/queries/wireVersion.d.ts +0 -7
  169. package/lib/cjs/queries/wireVersion.js +0 -25
  170. package/lib/cjs/queries/wireVersion.js.map +0 -1
  171. package/lib/cjs/shapes/List.d.ts +0 -35
  172. package/lib/cjs/shapes/List.js +0 -72
  173. package/lib/cjs/shapes/List.js.map +0 -1
  174. package/lib/cjs/shapes/PathNode.d.ts +0 -20
  175. package/lib/cjs/shapes/PathNode.js +0 -68
  176. package/lib/cjs/shapes/PathNode.js.map +0 -1
  177. package/lib/cjs/shapes/SHACL.d.ts +0 -300
  178. package/lib/cjs/shapes/SHACL.js +0 -612
  179. package/lib/cjs/shapes/SHACL.js.map +0 -1
  180. package/lib/cjs/shapes/Shape.d.ts +0 -74
  181. package/lib/cjs/shapes/Shape.js +0 -124
  182. package/lib/cjs/shapes/Shape.js.map +0 -1
  183. package/lib/cjs/shapes/serializePathToNodeData.d.ts +0 -24
  184. package/lib/cjs/shapes/serializePathToNodeData.js +0 -67
  185. package/lib/cjs/shapes/serializePathToNodeData.js.map +0 -1
  186. package/lib/cjs/shapes/syncShapes.d.ts +0 -38
  187. package/lib/cjs/shapes/syncShapes.js +0 -214
  188. package/lib/cjs/shapes/syncShapes.js.map +0 -1
  189. package/lib/cjs/sparql/SparqlAlgebra.d.ts +0 -190
  190. package/lib/cjs/sparql/SparqlAlgebra.js +0 -4
  191. package/lib/cjs/sparql/SparqlAlgebra.js.map +0 -1
  192. package/lib/cjs/sparql/SparqlDataset.d.ts +0 -60
  193. package/lib/cjs/sparql/SparqlDataset.js +0 -117
  194. package/lib/cjs/sparql/SparqlDataset.js.map +0 -1
  195. package/lib/cjs/sparql/algebraToString.d.ts +0 -13
  196. package/lib/cjs/sparql/algebraToString.js +0 -385
  197. package/lib/cjs/sparql/algebraToString.js.map +0 -1
  198. package/lib/cjs/sparql/index.d.ts +0 -9
  199. package/lib/cjs/sparql/index.js +0 -41
  200. package/lib/cjs/sparql/index.js.map +0 -1
  201. package/lib/cjs/sparql/irToAlgebra.d.ts +0 -79
  202. package/lib/cjs/sparql/irToAlgebra.js +0 -2042
  203. package/lib/cjs/sparql/irToAlgebra.js.map +0 -1
  204. package/lib/cjs/sparql/resultMapping.d.ts +0 -36
  205. package/lib/cjs/sparql/resultMapping.js +0 -563
  206. package/lib/cjs/sparql/resultMapping.js.map +0 -1
  207. package/lib/cjs/sparql/sparqlUtils.d.ts +0 -53
  208. package/lib/cjs/sparql/sparqlUtils.js +0 -154
  209. package/lib/cjs/sparql/sparqlUtils.js.map +0 -1
  210. package/lib/cjs/utils/LinkedErrorLogging.d.ts +0 -13
  211. package/lib/cjs/utils/LinkedErrorLogging.js +0 -22
  212. package/lib/cjs/utils/LinkedErrorLogging.js.map +0 -1
  213. package/lib/cjs/utils/LinkedFileStorage.d.ts +0 -23
  214. package/lib/cjs/utils/LinkedFileStorage.js +0 -62
  215. package/lib/cjs/utils/LinkedFileStorage.js.map +0 -1
  216. package/lib/cjs/utils/LinkedStorage.d.ts +0 -40
  217. package/lib/cjs/utils/LinkedStorage.js +0 -148
  218. package/lib/cjs/utils/LinkedStorage.js.map +0 -1
  219. package/lib/cjs/utils/NameSpace.d.ts +0 -2
  220. package/lib/cjs/utils/NameSpace.js +0 -8
  221. package/lib/cjs/utils/NameSpace.js.map +0 -1
  222. package/lib/cjs/utils/NodeReference.d.ts +0 -30
  223. package/lib/cjs/utils/NodeReference.js +0 -54
  224. package/lib/cjs/utils/NodeReference.js.map +0 -1
  225. package/lib/cjs/utils/Package.d.ts +0 -153
  226. package/lib/cjs/utils/Package.js +0 -419
  227. package/lib/cjs/utils/Package.js.map +0 -1
  228. package/lib/cjs/utils/Prefix.d.ts +0 -22
  229. package/lib/cjs/utils/Prefix.js +0 -104
  230. package/lib/cjs/utils/Prefix.js.map +0 -1
  231. package/lib/cjs/utils/ShapeClass.d.ts +0 -30
  232. package/lib/cjs/utils/ShapeClass.js +0 -180
  233. package/lib/cjs/utils/ShapeClass.js.map +0 -1
  234. package/lib/cjs/utils/URI.d.ts +0 -18
  235. package/lib/cjs/utils/URI.js +0 -42
  236. package/lib/cjs/utils/URI.js.map +0 -1
  237. package/lib/cjs/utils/cached.d.ts +0 -14
  238. package/lib/cjs/utils/cached.js +0 -71
  239. package/lib/cjs/utils/cached.js.map +0 -1
  240. package/lib/cjs/utils/loadStores.d.ts +0 -34
  241. package/lib/cjs/utils/loadStores.js +0 -105
  242. package/lib/cjs/utils/loadStores.js.map +0 -1
  243. package/lib/cjs/utils/parseDatasetsConfig.d.ts +0 -49
  244. package/lib/cjs/utils/parseDatasetsConfig.js +0 -110
  245. package/lib/cjs/utils/parseDatasetsConfig.js.map +0 -1
  246. package/lib/esm/package.json +0 -9
@@ -1,310 +0,0 @@
1
- import type { NodeShape, PropertyShape } from '../shapes/SHACL.js';
2
- import type { Shape, ShapeConstructor } from '../shapes/Shape.js';
3
- import { PropertyPath } from './PropertyPath.js';
4
- import type { WherePath } from './SelectQuery.js';
5
- import { ExpressionNode } from '../expressions/ExpressionNode.js';
6
- import { type DslJsonValue } from './DslJsonExpression.js';
7
- import { type WherePathJSON } from './QueryBuilderSerialization.js';
8
- type QueryBuilderObjectLike = {
9
- property?: PropertyShape;
10
- subject?: QueryBuilderObjectLike;
11
- wherePath?: unknown;
12
- };
13
- /**
14
- * A single entry in a FieldSet: a property path with optional alias, scoped filter,
15
- * sub-selection, aggregation, and custom key.
16
- */
17
- export type FieldSetEntry = {
18
- path: PropertyPath;
19
- alias?: string;
20
- scopedFilter?: WherePath;
21
- /** Index into path.segments indicating which segment the scopedFilter applies to.
22
- * Defaults to the last segment if not specified. */
23
- scopedFilterIndex?: number;
24
- /** Nested object selection — the user explicitly selected sub-fields (e.g. `p.friends.select(...)`) */
25
- subSelect?: FieldSet;
26
- aggregation?: 'count';
27
- customKey?: string;
28
- /** Component preload composition — the FieldSet comes from a linked component's own query,
29
- * merged in via `preloadFor()`. Distinct from subSelect which is a user-authored nested query. */
30
- preloadSubSelect?: FieldSet;
31
- /** Computed expression from proxy tracing (e.g. `p.age.times(12)`) */
32
- expressionNode?: ExpressionNode;
33
- /** Inner LIMIT for a nested select (e.g. `p.friends.select(...).limit(2)`).
34
- * Only supported when the outer query targets a single subject. */
35
- innerLimit?: number;
36
- /** Inner OFFSET for a nested select. */
37
- innerOffset?: number;
38
- /** Inner ORDER BY for a nested select — paths relative to the sub-select shape. */
39
- innerOrderBy?: FieldSetInnerOrderBy[];
40
- };
41
- /** A single inner ORDER BY clause for a nested select. */
42
- export type FieldSetInnerOrderBy = {
43
- propertyShapeId: string;
44
- direction: 'ASC' | 'DESC';
45
- };
46
- /**
47
- * Input types accepted by FieldSet construction methods.
48
- *
49
- * - `string` — resolved via walkPropertyPath (dot-separated)
50
- * - `PropertyPath` — used directly
51
- * - `FieldSet` — merged in
52
- * - `Record<string, string[] | FieldSet>` — nested fields
53
- */
54
- export type FieldSetInput = string | PropertyPath | FieldSet | Record<string, string[] | FieldSet>;
55
- /** A computed projection field: `{ as?, value }` — a DSL-JSON expression, no path. */
56
- export type FieldSetComputedJSON = {
57
- as?: string;
58
- value: DslJsonValue;
59
- customKey?: string;
60
- };
61
- /** Options for a relation projection (the object value under a relation key). */
62
- export type FieldSetRelationOptionsJSON = {
63
- as?: string;
64
- /** A scoped filter on the relation (`p.friends.where(...)`). */
65
- where?: WherePathJSON;
66
- /** Which path segment the scoped `where` applies to (defaults to the last). */
67
- whereIndex?: number;
68
- aggregation?: string;
69
- customKey?: string;
70
- /** Nested-select pagination (`p.friends.select(...).limit(5).offset(2).orderBy(...)`). */
71
- limit?: number;
72
- offset?: number;
73
- orderBy?: Array<{
74
- [path: string]: 'ASC' | 'DESC';
75
- }>;
76
- /** Sub-projection of the related shape. */
77
- fields?: FieldSetFieldJSON[];
78
- };
79
- /**
80
- * A relation-keyed field: a single-key object whose key is the relation path
81
- * (labels dotted, with inline `as(Shape)` casts) and whose value is either the
82
- * sub-fields array (`{ "friends": ["name"] }`) or an options object
83
- * (`{ "friends": { as, where, fields } }`). Also covers a leaf with options
84
- * (`{ "name": { "as": "personName" } }`). The related shape is inferred.
85
- */
86
- export type FieldSetRelationJSON = {
87
- [path: string]: FieldSetFieldJSON[] | FieldSetRelationOptionsJSON;
88
- };
89
- /**
90
- * JSON representation of a FieldSet field entry — exactly three shapes:
91
- * - a **string** leaf path (`"name"`, `"friends.friends.name"`, `"pets.as(Dog).level"`)
92
- * - a **relation-keyed** object (`{ "friends": [...] | {options} }`)
93
- * - a **computed** object (`{ as?, value }`)
94
- */
95
- export type FieldSetFieldJSON = string | FieldSetComputedJSON | FieldSetRelationJSON;
96
- /** JSON representation of a FieldSet (a shape + its top-level fields). */
97
- export type FieldSetJSON = {
98
- shape: string;
99
- fields: FieldSetFieldJSON[];
100
- };
101
- /**
102
- * An immutable, composable collection of property paths for a shape.
103
- *
104
- * FieldSet describes which properties to select, independent of
105
- * how the query is built. It integrates with QueryBuilder via
106
- * `.select(fieldSet)`.
107
- *
108
- * Every mutation method returns a new FieldSet — the original is never modified.
109
- */
110
- export declare class FieldSet<R = any, Source = any> {
111
- readonly shape: NodeShape;
112
- readonly entries: readonly FieldSetEntry[];
113
- /** Phantom field — carries the callback response type for conditional type inference. */
114
- readonly __response: R;
115
- /** Phantom field — carries the source context (QueryShapeSet/QueryShape) for conditional type inference. */
116
- readonly __source: Source;
117
- /**
118
- * For sub-select FieldSets: the raw callback return value (proxy trace objects).
119
- * Stored so conditional types can extract the response type.
120
- */
121
- readonly traceResponse?: R;
122
- /**
123
- * For sub-select FieldSets: the parent property segments leading to this sub-select.
124
- */
125
- readonly parentSegments?: PropertyShape[];
126
- /**
127
- * For sub-select FieldSets: the shape class (ShapeType) of the sub-select's target.
128
- */
129
- readonly shapeType?: any;
130
- /**
131
- * For sub-select FieldSets: inline `.where()` filter found on the parent
132
- * traversal chain (e.g. `p.friends.where(...).select(...)`), plus the index
133
- * into `parentSegments` of the segment it scopes.
134
- */
135
- readonly parentWherePath?: WherePath;
136
- readonly parentWherePathIndex?: number;
137
- /**
138
- * For sub-select FieldSets: inner LIMIT/OFFSET/ORDER BY carried from
139
- * `.limit()`/`.offset()`/`.orderBy()` chained on the nested select.
140
- * These bound the related collection per parent (single-subject only).
141
- */
142
- readonly innerLimit?: number;
143
- readonly innerOffset?: number;
144
- readonly innerOrderBy?: FieldSetInnerOrderBy[];
145
- private constructor();
146
- /**
147
- * Create a FieldSet for the given shape with the specified fields.
148
- *
149
- * Accepts a ShapeClass (e.g. Person), NodeShape, or shape IRI string.
150
- * Fields can be string paths, PropertyPath instances, nested objects,
151
- * or a callback receiving a proxy for dot-access.
152
- */
153
- static for<S extends Shape>(shape: ShapeConstructor<S>, fields: FieldSetInput[]): FieldSet<any>;
154
- static for<S extends Shape, R>(shape: ShapeConstructor<S>, fn: (p: any) => R): FieldSet<R>;
155
- static for(shape: NodeShape | string, fields: FieldSetInput[]): FieldSet<any>;
156
- static for(shape: NodeShape | string, fn: (p: any) => any): FieldSet<any>;
157
- /**
158
- * Create a typed FieldSet for a sub-select. Traces the callback through the proxy,
159
- * stores parentSegments and traceResponse for runtime compatibility, and preserves
160
- * R and Source generics for conditional type inference.
161
- */
162
- static forSubSelect<R, Source>(shapeClass: any, fn: (p: any) => R, parentSegments: PropertyShape[], source?: QueryBuilderObjectLike): FieldSet<R, Source>;
163
- /**
164
- * Create a FieldSet containing all decorated properties of the shape.
165
- *
166
- * @param opts.depth Controls how deep to include nested shape properties:
167
- * - `depth=1` (default): this level only — properties of the root shape.
168
- * - `depth=0`: throws — use a node reference instead.
169
- * - `depth>1`: recursively includes nested shape properties up to the given depth.
170
- */
171
- static all<S extends Shape>(shape: ShapeConstructor<S>, opts?: {
172
- depth?: number;
173
- }): FieldSet;
174
- static all(shape: NodeShape | string, opts?: {
175
- depth?: number;
176
- }): FieldSet;
177
- /**
178
- * Recursive helper for all(). Tracks visited shape IDs to prevent infinite loops
179
- * from circular shape references.
180
- */
181
- private static allForShape;
182
- /**
183
- * Merge multiple FieldSets into one, deduplicating by path equality.
184
- * All FieldSets must share the same root shape.
185
- */
186
- static merge(sets: FieldSet[]): FieldSet;
187
- /** Returns a new FieldSet with only the given fields. */
188
- select(fields: FieldSetInput[]): FieldSet;
189
- /**
190
- * Clone this FieldSet, preserving the sub-select carrier fields
191
- * (traceResponse / parentSegments / shapeType / inner pagination) and
192
- * applying the supplied overrides. Used by `.limit()`/`.offset()`/`.orderBy()`.
193
- */
194
- private cloneWith;
195
- /**
196
- * Bound a nested select's related collection to at most `lim` items per parent.
197
- * Only honoured when the outer query targets a single subject; otherwise the
198
- * pipeline throws (per-group pagination across multiple parents is unsupported).
199
- */
200
- limit(lim: number): this;
201
- /** Skip the first `off` items of a nested select's related collection (single-subject only). */
202
- offset(off: number): this;
203
- /**
204
- * Order a nested select's related collection, producing a deterministic window
205
- * for inner LIMIT/OFFSET. Defaults to ascending.
206
- *
207
- * Accepts either a proxy callback — `.orderBy(f => f.name)` — consistent with
208
- * the rest of the DSL, or a property-name string (`.orderBy('name')`).
209
- */
210
- orderBy(paths: string | string[] | ((p: any) => unknown), direction?: 'ASC' | 'DESC'): this;
211
- /** Resolve a proxy `orderBy` callback (e.g. `f => f.name` or `f => [f.a, f.b]`)
212
- * to inner order-by clauses by tracing the sub-select shape's property proxy. */
213
- private orderByFromProxy;
214
- /** Returns a new FieldSet with additional entries. */
215
- add(fields: FieldSetInput[]): FieldSet;
216
- /** Returns a new FieldSet without entries matching the given labels. */
217
- remove(labels: string[]): FieldSet;
218
- /** Synonym for replacing all entries — returns a new FieldSet with only the given fields. */
219
- set(fields: FieldSetInput[]): FieldSet;
220
- /** Returns a new FieldSet keeping only entries matching the given labels. */
221
- pick(labels: string[]): FieldSet;
222
- /** Returns all PropertyPaths in this FieldSet. */
223
- paths(): PropertyPath[];
224
- /** Returns terminal property labels of all entries. */
225
- labels(): string[];
226
- /**
227
- * Serialize this FieldSet to a plain JSON object.
228
- * Shape is identified by its IRI, paths by dot-separated labels.
229
- */
230
- toJSON(): FieldSetJSON;
231
- /** Serialize just the field entries (used for nested relation sub-fields). */
232
- private toFieldsJSON;
233
- private serializeEntry;
234
- /** The shape a scoped filter at segment `idx` is evaluated against (the segment's value shape). */
235
- private scopedShapeAt;
236
- /**
237
- * Reconstruct a FieldSet from a JSON object.
238
- * Resolves shape IRI via getShapeClass() and paths via walkPropertyPath().
239
- */
240
- static fromJSON(json: FieldSetJSON): FieldSet;
241
- /** Build a FieldSet from a shape + relation-keyed field list (recursion entry). */
242
- private static fromFields;
243
- /** Parse one field entry (string leaf / computed / relation-keyed) against `shape`. */
244
- private static parseField;
245
- /** The shape reached at the end of a relation path (its terminal segment's value shape). */
246
- private static nestedShapeOf;
247
- /**
248
- * Resolves any of the accepted shape input types to a NodeShape and optional ShapeClass.
249
- * Accepts: ShapeConstructor (class with .shape), NodeShape, or IRI string.
250
- */
251
- private static resolveShapeInput;
252
- /** @deprecated Use resolveShapeInput instead. Kept for fromJSON which only passes NodeShape|string. */
253
- private static resolveShape;
254
- private static resolveInputs;
255
- /**
256
- * Trace fields using the full ProxiedPathBuilder proxy (createProxiedPathBuilder).
257
- * Handles nested paths, where conditions, aggregations, and sub-selects.
258
- */
259
- private static traceFieldsWithProxy;
260
- /**
261
- * Convert a single proxy trace result (QueryBuilderObject, SetSize, or FieldSet sub-select)
262
- * into a FieldSetEntry.
263
- */
264
- private static convertTraceResult;
265
- /**
266
- * Walk a QueryBuilderObject-like chain (via .subject) collecting PropertyShape segments
267
- * from leaf to root, then reverse to get root-to-leaf order.
268
- */
269
- static collectPropertySegments(obj: QueryBuilderObjectLike): PropertyShape[];
270
- private static shapeById;
271
- private static shapeByLabel;
272
- private static labelOfId;
273
- /**
274
- * Render a segment chain as a dotted label path, inserting `as(<ShapeLabel>)`
275
- * wherever a segment is not resolvable by label from the natural (walked) shape
276
- * — i.e. a `.as(Shape)` narrowing happened before it.
277
- */
278
- static pathToStringWithCasts(rootShape: NodeShape, segments: readonly PropertyShape[]): string;
279
- /** Inverse of {@link pathToStringWithCasts}: resolve a dotted path with `as(X)` casts. */
280
- static walkPathWithCasts(rootShape: NodeShape, path: string): PropertyPath;
281
- /**
282
- * Extract a FieldSet from a component-like object for preload composition.
283
- *
284
- * Supports multiple component interfaces:
285
- * - `.fields` as a FieldSet directly
286
- * - `.query` as a FieldSet, QueryBuilder (duck-typed via .fields()), or
287
- * Record<string, QueryBuilder> (e.g. `{person: PersonQuery}`)
288
- */
289
- static extractComponentFieldSet(component: any): FieldSet | undefined;
290
- /**
291
- * Internal factory that bypasses the private constructor for use by static methods.
292
- */
293
- private static createInternal;
294
- /**
295
- * Create a FieldSet from raw entries. Used by QueryBuilder to merge preload entries.
296
- */
297
- static createFromEntries(shape: NodeShape, entries: FieldSetEntry[]): FieldSet;
298
- /**
299
- * Extract FieldSetEntry[] from a sub-query's traceResponse.
300
- * Public alias for use by lightweight sub-select wrappers.
301
- */
302
- static extractSubSelectEntriesPublic(rootShape: NodeShape, traceResponse: any): FieldSetEntry[];
303
- /**
304
- * Extract FieldSetEntry[] from a sub-select's traceResponse.
305
- * The traceResponse is the result of calling the sub-query callback with a proxy,
306
- * containing QueryBuilderObjects, arrays, custom objects, etc.
307
- */
308
- private static extractSubSelectEntries;
309
- }
310
- export {};