@lde/search 0.23.1 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/adapter.d.ts CHANGED
@@ -6,11 +6,11 @@
6
6
  * deployment author declaring a schema and running searches needs none of
7
7
  * this; the main entry point carries that (small) authoring surface.
8
8
  */
9
- export { assertTypeInSchema, physicalFields, irAlias, displayFieldName, displayFieldPattern, displayLangOf, searchableFields, facetableFields, filterableFields, sortableFields, outputFields, isInternalField, isInlineReference, nestedReferenceType, nestedFieldName, referenceFields, referenceTypeNamed, rootTypeNamed, inlineFramingDepth, fieldNamed, datasetField, ID_FIELD, AND_KEY, OR_KEY, labelFieldOf, labelFieldNameOf, labelSourceNameOf, documentKeyOf, DEFAULT_LABEL_FIELD, isRangeFacet, isAbsoluteIri, isoToUnixSeconds, unixSecondsToIso, } from './schema.js';
9
+ export { assertTypeInSchema, physicalFields, irAlias, displayFieldName, displayFieldPattern, displayLangOf, searchableFields, facetableFields, filterableFields, sortableFields, outputFields, isInternalField, isInlineReference, nestedReferenceType, nestedFieldName, localLookupTypeOf, identityFieldOf, identityFieldName, referenceFields, referenceTypeNamed, rootTypeNamed, inlineFramingDepth, fieldNamed, datasetField, ID_FIELD, AND_KEY, OR_KEY, labelFieldOf, labelFieldNameOf, labelSourceNameOf, labelTargetNameOf, documentKeyOf, DEFAULT_LABEL_FIELD, isRangeFacet, isAbsoluteIri, isoToUnixSeconds, unixSecondsToIso, } from './schema.js';
10
10
  export type { PhysicalFields } from './schema.js';
11
11
  export { physicalNameTokens } from './physical-name.js';
12
12
  export { joinGraph, MAX_JOIN_DEPTH } from './join-graph.js';
13
13
  export type { JoinGraph } from './join-graph.js';
14
- export { filterOperatorFor, filterOperator, filterOn, isUnsatisfiable, validateQuery, assertValidQuery, pageForOffset, } from './query.js';
15
- export type { FilterOperator, QueryIssue } from './query.js';
14
+ export { filterOperatorFor, filterOperator, filterOn, isWelded, isUnsatisfiable, validateQuery, assertValidQuery, resolvePath, pageForOffset, } from './query.js';
15
+ export type { FilterOperator, QueryIssue, ResolvedPath, PathFailure, } from './query.js';
16
16
  //# sourceMappingURL=adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,QAAQ,EACR,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,cAAc,EACd,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,MAAM,YAAY,CAAC"}
package/dist/adapter.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * deployment author declaring a schema and running searches needs none of
7
7
  * this; the main entry point carries that (small) authoring surface.
8
8
  */
9
- export { assertTypeInSchema, physicalFields, irAlias, displayFieldName, displayFieldPattern, displayLangOf, searchableFields, facetableFields, filterableFields, sortableFields, outputFields, isInternalField, isInlineReference, nestedReferenceType, nestedFieldName, referenceFields, referenceTypeNamed, rootTypeNamed, inlineFramingDepth, fieldNamed, datasetField, ID_FIELD, AND_KEY, OR_KEY, labelFieldOf, labelFieldNameOf, labelSourceNameOf, documentKeyOf, DEFAULT_LABEL_FIELD, isRangeFacet, isAbsoluteIri, isoToUnixSeconds, unixSecondsToIso, } from './schema.js';
9
+ export { assertTypeInSchema, physicalFields, irAlias, displayFieldName, displayFieldPattern, displayLangOf, searchableFields, facetableFields, filterableFields, sortableFields, outputFields, isInternalField, isInlineReference, nestedReferenceType, nestedFieldName, localLookupTypeOf, identityFieldOf, identityFieldName, referenceFields, referenceTypeNamed, rootTypeNamed, inlineFramingDepth, fieldNamed, datasetField, ID_FIELD, AND_KEY, OR_KEY, labelFieldOf, labelFieldNameOf, labelSourceNameOf, labelTargetNameOf, documentKeyOf, DEFAULT_LABEL_FIELD, isRangeFacet, isAbsoluteIri, isoToUnixSeconds, unixSecondsToIso, } from './schema.js';
10
10
  export { physicalNameTokens } from './physical-name.js';
11
11
  export { joinGraph, MAX_JOIN_DEPTH } from './join-graph.js';
12
- export { filterOperatorFor, filterOperator, filterOn, isUnsatisfiable, validateQuery, assertValidQuery, pageForOffset, } from './query.js';
12
+ export { filterOperatorFor, filterOperator, filterOn, isWelded, isUnsatisfiable, validateQuery, assertValidQuery, resolvePath, pageForOffset, } from './query.js';
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export { projectRoots } from './project.js';
2
2
  export type { ProjectedNode, ProjectionContext, SearchDocument, } from './project.js';
3
3
  export { defineSearchType, searchSchema, validateSearchType, assertValidSearchType, ID_FIELD, AND_KEY, OR_KEY, isoToUnixSeconds, unixSecondsToIso, } from './schema.js';
4
- export type { FieldKind, SearchField, SearchFieldBase, TextField, KeywordField, ReferenceField, ReferenceStrategy, NumericField, BooleanField, SearchType, SearchTypeBase, RootType, ReferenceType, RootTypeOf, SearchTypeIssue, KeyField, SearchSchema, FacetRange, ProjectionValue, } from './schema.js';
4
+ export type { FieldKind, SearchField, SearchFieldBase, TextField, KeywordField, ReferenceField, ReferenceStrategy, NumericField, BooleanField, SearchType, SearchTypeBase, RootType, ReferenceType, RootTypeOf, SearchTypeIssue, KeyField, FacetKeys, SearchSchema, FacetRange, ProjectionValue, } from './schema.js';
5
5
  export { joinGraph, MAX_JOIN_DEPTH } from './join-graph.js';
6
6
  export type { JoinGraph } from './join-graph.js';
7
7
  export { filterOn } from './query.js';
8
- export type { SearchQuery, ReferenceProjection, Filter, Criterion, CriterionBase, Sort, } from './query.js';
8
+ export type { SearchQuery, ReferenceProjection, Filter, Criterion, CriterionBase, WeldedCriterion, Sort, } from './query.js';
9
9
  export type { SearchEngine, SearchResult, SearchHit, ResultDocument, SearchValue, LocalizedValue, Reference, NestedDocument, FacetBucket, FacetMap, FacetsOutcome, FacetFieldsOf, OutputFieldsOf, } from './engine.js';
10
10
  export type { FramedNode } from './frame-by-type.js';
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,cAAc,GACf,MAAM,cAAc,CAAC;AAKtB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,EACrB,QAAQ,EACR,OAAO,EACP,MAAM,EAMN,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,SAAS,EACT,WAAW,EACX,eAAe,EACf,SAAS,EACT,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,cAAc,EACd,QAAQ,EACR,aAAa,EACb,UAAU,EACV,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,eAAe,GAChB,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAOjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,MAAM,EACN,SAAS,EACT,aAAa,EACb,IAAI,GACL,MAAM,YAAY,CAAC;AAIpB,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,cAAc,EACd,WAAW,EACX,cAAc,EACd,SAAS,EACT,cAAc,EACd,WAAW,EACX,QAAQ,EACR,aAAa,EACb,aAAa,EACb,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,cAAc,GACf,MAAM,cAAc,CAAC;AAKtB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,EACrB,QAAQ,EACR,OAAO,EACP,MAAM,EAMN,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,SAAS,EACT,WAAW,EACX,eAAe,EACf,SAAS,EACT,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,cAAc,EACd,QAAQ,EACR,aAAa,EACb,UAAU,EACV,eAAe,EACf,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,UAAU,EACV,eAAe,GAChB,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAOjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,MAAM,EACN,SAAS,EACT,aAAa,EACb,eAAe,EACf,IAAI,GACL,MAAM,YAAY,CAAC;AAIpB,YAAY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
1
  import { fold } from '@lde/text-normalization';
2
2
  import { buildSubjectIndex, frameSubjects, } from './frame-by-type.js';
3
- import { assertTypeInSchema, displayFieldName, documentKeyOf, fieldNamed, inlineFramingDepth, irAlias, isAbsoluteIri, isInternalField, isInlineReference, isoToUnixSeconds, labelSourceNameOf, physicalFields, referenceTypeNamed, rootTypeNamed, } from './schema.js';
3
+ import { assertTypeInSchema, displayFieldName, documentKeyOf, fieldNamed, inheritedFacetKeys, inlineFramingDepth, irAlias, isAbsoluteIri, isInternalField, isInlineReference, isoToUnixSeconds, labelSourceNameOf, localLookupTypeOf, physicalFields, referenceTypeNamed, rootTypeNamed, } from './schema.js';
4
4
  /** The context a projection runs with when its caller supplied none. */
5
5
  const NO_PROJECTION_CONTEXT = {};
6
6
  /**
@@ -32,10 +32,16 @@ export function projectDocument(node, searchType, schema, context = NO_PROJECTIO
32
32
  * only after all projection – so every derive that might read an internal
33
33
  * field, at any depth, has already run – which makes this single post-order
34
34
  * pass safe. A no-role inline reference is itself internal, so it is deleted
35
- * whole here; a surfaced (`output`) inline reference survives, but its own
36
- * internal helper fields are pruned from the nested document. That keeps the
37
- * *a field without a role reaches neither the engine nor the API* invariant
38
- * true at every depth of the reference graph, not just at the root.
35
+ * whole here; one that carries a Role survives, but its own internal helper
36
+ * fields are pruned from the nested document. That keeps the *a field without a
37
+ * role reaches neither the engine nor the API* invariant true at every depth of
38
+ * the reference graph, not just at the root.
39
+ *
40
+ * Both kinds of nesting are walked, because both store projected nodes: an
41
+ * inline reference’s Reference Type, and the Root Type a
42
+ * {@link ReferenceStrategy.local local} lookup projects its endpoint through.
43
+ * The second matters more than it looks – a Root Type’s reading-device fields
44
+ * exist for its OWN derives, and nothing in a referring document wants them.
39
45
  */
40
46
  function pruneInternalFields(document, searchType, schema) {
41
47
  for (const field of searchType.fields) {
@@ -43,22 +49,18 @@ function pruneInternalFields(document, searchType, schema) {
43
49
  delete document[field.name];
44
50
  continue;
45
51
  }
46
- // A surfaced inline reference nests its referent(s) as projected node(s);
47
- // prune those too, by their reference type.
48
52
  if (schema === undefined || field.kind !== 'reference') {
49
53
  continue;
50
54
  }
51
- const ref = field.ref;
52
- if (ref?.strategy !== 'inline') {
53
- continue;
54
- }
55
- const referenceType = referenceTypeNamed(schema, ref.typeName);
55
+ const nestedType = field.ref?.strategy === 'inline'
56
+ ? referenceTypeNamed(schema, field.ref.typeName)
57
+ : localLookupTypeOf(field, schema);
56
58
  const nested = document[field.name];
57
- if (referenceType === undefined || nested === undefined) {
59
+ if (nestedType === undefined || nested === undefined) {
58
60
  continue;
59
61
  }
60
62
  for (const referent of Array.isArray(nested) ? nested : [nested]) {
61
- pruneInternalFields(referent, referenceType, schema);
63
+ pruneInternalFields(referent, nestedType, schema);
62
64
  }
63
65
  }
64
66
  }
@@ -148,7 +150,7 @@ function applyField(document, node, field, searchType, schema, context) {
148
150
  // (`validateSearchType`): a projection value, a computed value, a graph path.
149
151
  if ((field.kind === 'keyword' || field.kind === 'reference') &&
150
152
  field.from !== undefined) {
151
- return applyProjectionValue(document, field, field.from, context);
153
+ return applyProjectionValue(document, field, field.from, context, schema);
152
154
  }
153
155
  if (field.derive !== undefined) {
154
156
  const derived = field.derive(document, context);
@@ -203,13 +205,29 @@ function applyField(document, node, field, searchType, schema, context) {
203
205
  }
204
206
  return;
205
207
  }
208
+ // A `local` lookup stores nested documents too, shaped by the TARGET’s own
209
+ // declaration rather than by a reference type – so an unidentified referent
210
+ // is an entry like any other, minus its `id`. Same reason as above for
211
+ // needing a schema: without one there is no target to project through.
212
+ if (field.kind === 'reference' && schema !== undefined) {
213
+ const localType = localLookupTypeOf(field, schema);
214
+ if (localType !== undefined) {
215
+ const endpoints = applyNestedReferents(document, valuesOf(node, alias), field, localType, schema, context);
216
+ // A `local` lookup stores an object, so its own id is a level deeper than
217
+ // a filter can reach – an engine welds conditions on an entry's LEAF
218
+ // fields only. `filterable` therefore fans out the id beside the object,
219
+ // exactly as an inline reference's identity companion does.
220
+ applyLocalIdentity(document, endpoints, field, schema);
221
+ return;
222
+ }
223
+ }
206
224
  switch (field.kind) {
207
225
  case 'text':
208
226
  return applyText(document, langValuesOf(node, alias), field);
209
227
  case 'keyword':
210
- return applyFacet(document, literalsOf(node, alias), field);
228
+ return applyFacet(document, literalsOf(node, alias), field, schema);
211
229
  case 'reference':
212
- return applyFacet(document, referenceValues(node, alias, field, schema), field);
230
+ return applyFacet(document, referenceValues(node, alias, field, schema), field, schema);
213
231
  case 'integer':
214
232
  return setNumber(document, field.name, toInteger(firstLiteralOf(node, alias)));
215
233
  case 'number':
@@ -327,6 +345,16 @@ function foldedSearchValue(values) {
327
345
  * `keyword` reads literals; `reference` reads IRIs (the caller passes the
328
346
  * already-read raw values).
329
347
  *
348
+ * A reference inheriting a {@link FacetKeys facet policy} from the type it
349
+ * names ({@link inheritedFacetKeys}) also writes the `${name}_facet` companion
350
+ * the engine facets instead of the field: the subset of **what the field
351
+ * stores** that the policy admits. So it is written after the field’s own
352
+ * `transform` and the IRI filter, from the same `values` – for a keyed target
353
+ * those are already keys ({@link referenceValues}), which is what makes a
354
+ * predicate over document keys the right shape. The field itself keeps every
355
+ * value; only the facet narrows. An empty subset writes nothing, exactly as a
356
+ * path that matched nothing does.
357
+ *
330
358
  * **`array` decides the shape**, as it does for every other kind: a declared
331
359
  * `array` field stores a list, and a single-valued one stores the first value –
332
360
  * the graph may still carry several, exactly as it may carry several literals
@@ -337,7 +365,7 @@ function foldedSearchValue(values) {
337
365
  * engine rejects, or – where it does not type-check, as inside a nested
338
366
  * document – a value the API cannot serialize.
339
367
  */
340
- function applyFacet(document, raw, field) {
368
+ function applyFacet(document, raw, field, schema) {
341
369
  // A `reference` stores identity, so what it stores must be an IRI whatever
342
370
  // route the value arrived by. {@link iriString} guards the graph path, but a
343
371
  // `transform` runs after it and a `from` projection value never passes it at
@@ -347,18 +375,34 @@ function applyFacet(document, raw, field) {
347
375
  const transformed = field.transform ? raw.map(field.transform) : raw;
348
376
  const values = dedupe(referenced ? transformed.filter(isAbsoluteIri) : transformed);
349
377
  const folded = dedupe(values.map((value) => fold(value)));
350
- const searchField = physicalFields(field).search[0];
378
+ const names = physicalFields(field, schema);
379
+ const searchField = names.search[0];
380
+ const policy = inheritedFacetKeys(field, schema);
381
+ // `names.facet` is the companion exactly when a policy is inherited –
382
+ // physicalFields reads the same `inheritedFacetKeys`.
383
+ const facetField = names.facet;
384
+ // The companion is a subset of what the field STORES – for a single-valued
385
+ // field its first value, not the first admitted of all of them, or the facet
386
+ // would count a value no filter on the field can reproduce.
387
+ const stored = field.array === true ? values : values.slice(0, 1);
388
+ const admitted = policy === undefined ? [] : stored.filter(policy.only);
351
389
  if (field.array === true) {
352
- setArray(document, field.name, values);
390
+ setArray(document, field.name, stored);
353
391
  if (field.searchable) {
354
392
  setArray(document, searchField, folded);
355
393
  }
394
+ if (policy !== undefined) {
395
+ setArray(document, facetField, admitted);
396
+ }
356
397
  return;
357
398
  }
358
- setString(document, field.name, values[0]);
399
+ setString(document, field.name, stored[0]);
359
400
  if (field.searchable) {
360
401
  setString(document, searchField, folded[0]);
361
402
  }
403
+ if (policy !== undefined) {
404
+ setString(document, facetField, admitted[0]);
405
+ }
362
406
  }
363
407
  /**
364
408
  * Project a field declared over a {@link ProjectionContext} value: read the
@@ -371,13 +415,13 @@ function applyFacet(document, raw, field) {
371
415
  * pipeline (a test, a one-off) leaves the field absent rather than inventing a
372
416
  * placeholder, the same as a `path` that matched nothing.
373
417
  */
374
- function applyProjectionValue(document, field, from, context) {
418
+ function applyProjectionValue(document, field, from, context, schema) {
375
419
  // `ProjectionContext` is keyed by `ProjectionValue`, so the declaration reads
376
420
  // the context directly: a projection value that has no context key, or a
377
421
  // context key no declaration can name, is a compile error rather than a
378
422
  // silently unpopulated field.
379
423
  const value = context[from];
380
- applyFacet(document, value === undefined ? [] : [value], field);
424
+ applyFacet(document, value === undefined ? [] : [value], field, schema);
381
425
  }
382
426
  /**
383
427
  * Project an inline reference: the referent node(s) embedded under the field’s
@@ -404,9 +448,103 @@ function applyInlineReference(document, node, alias, field, schema, context) {
404
448
  if (referenceType === undefined) {
405
449
  return;
406
450
  }
407
- const referents = valuesOf(node, alias)
451
+ const referents = applyNestedReferents(document, valuesOf(node, alias), field, referenceType, schema, context);
452
+ applyIdentityCompanion(document, referents, field, schema);
453
+ }
454
+ /**
455
+ * Write the {@link ReferenceStrategy.identity identity companion} of an inline
456
+ * reference: the ids its entries reference, flattened out of the nested
457
+ * documents just projected, under the flat physical name an engine filters and
458
+ * facets ({@link physicalFields}).
459
+ *
460
+ * Harvested from the entries rather than read from a second path, so what the
461
+ * companion holds is exactly what the entries hold – including the re-keying
462
+ * the nested reference already applied, which a separately-read path would have
463
+ * to repeat and could get wrong.
464
+ *
465
+ * The identity field stores either bare ids or, when it is a
466
+ * {@link ReferenceStrategy.local local} lookup, nested documents carrying an
467
+ * `id`. Both are read here, because which one a deployment declares is about
468
+ * how much of the referent it wants to display – not about what identifies it.
469
+ */
470
+ function applyIdentityCompanion(document, referents, field, schema) {
471
+ const names = physicalFields(field, schema);
472
+ if (names.identity === undefined) {
473
+ return;
474
+ }
475
+ const identity = field.ref.identity;
476
+ // Only the entries the document actually STORES: a single-valued reference
477
+ // keeps the first referent and drops the rest, and a companion holding an id
478
+ // from a dropped one would match a filter whose hit shows no such entry.
479
+ const stored = field.array === true ? referents : referents.slice(0, 1);
480
+ const ids = dedupe(stored.flatMap((referent) => (Array.isArray(referent[identity])
481
+ ? referent[identity]
482
+ : [referent[identity]])
483
+ .map(identityValue)
484
+ .filter((id) => id !== undefined)));
485
+ if (ids.length === 0) {
486
+ return;
487
+ }
488
+ setArray(document, names.identity, ids);
489
+ // Same rule as every other facetable reference: where the target declares a
490
+ // facet policy, the facet reads a narrowed companion of its own, so an
491
+ // excluded id is never seen by the engine rather than merely unlabelled.
492
+ const policy = inheritedFacetKeys(field, schema);
493
+ if (policy !== undefined) {
494
+ setArray(document, names.facet, ids.filter(policy.only));
495
+ }
496
+ }
497
+ /**
498
+ * Write the identity companion of a {@link ReferenceStrategy.local local}
499
+ * lookup: the ids of the endpoints just stored, under the flat physical name an
500
+ * engine filters on ({@link physicalFields}).
501
+ *
502
+ * Nothing to do where the field is not `filterable`: without that Role there is
503
+ * no companion, and the endpoint is display weight like every other nesting.
504
+ */
505
+ function applyLocalIdentity(document, endpoints, field, schema) {
506
+ const names = physicalFields(field, schema);
507
+ if (names.identity === undefined) {
508
+ return;
509
+ }
510
+ // Only the endpoints the field actually STORES: a single-valued reference
511
+ // keeps the first and drops the rest, and a companion holding an id from a
512
+ // dropped one would match a filter whose hit shows a different endpoint.
513
+ const stored = field.array === true ? endpoints : endpoints.slice(0, 1);
514
+ const ids = dedupe(stored
515
+ .map((endpoint) => endpoint.id)
516
+ .filter((id) => typeof id === 'string'));
517
+ if (ids.length > 0) {
518
+ setArray(document, names.identity, ids);
519
+ }
520
+ }
521
+ /** The id a value under an identity field carries: the value itself when the
522
+ * field stores bare ids, its `id` when it stores nested documents. */
523
+ function identityValue(value) {
524
+ if (typeof value === 'string') {
525
+ return value;
526
+ }
527
+ const id = isObject(value) ? value.id : undefined;
528
+ return typeof id === 'string' ? id : undefined;
529
+ }
530
+ /**
531
+ * Project raw framed values as nested document(s) of `nestedType` and attach
532
+ * them under the field’s name – the shared body of an inline reference and a
533
+ * {@link ReferenceStrategy.local local} lookup, which differ only in which type
534
+ * shapes the referent: a declared Reference Type for the one, the lookup’s own
535
+ * target Root Type for the other. Sharing it is what makes the two reconstruct
536
+ * through one path, so a consumer cannot tell a nested referent from a resolved
537
+ * one.
538
+ *
539
+ * Projecting through a Root Type also gives a `local` referent its `id` for
540
+ * free, re-keyed through that type’s {@link RootType.key} exactly as a
541
+ * top-level document of that type would be – so the stored id is the one the
542
+ * target’s collection files it under, and the lookup can find it.
543
+ */
544
+ function applyNestedReferents(document, values, field, nestedType, schema, context) {
545
+ const referents = values
408
546
  .filter(isObject)
409
- .map((referent) => projectFields(referent, referenceType, schema, context))
547
+ .map((referent) => projectFields(referent, nestedType, schema, context))
410
548
  // Fields, not identity, are what makes something a referent: a literal
411
549
  // value object under the alias (dirty source data), or a node this
412
550
  // reference type reads nothing from, projects nothing and is no referent.
@@ -414,9 +552,10 @@ function applyInlineReference(document, node, alias, field, schema, context) {
414
552
  // single-valued reference, let it win the slot over a real referent.
415
553
  .filter((referent) => Object.keys(referent).length > 0);
416
554
  if (referents.length === 0) {
417
- return;
555
+ return referents;
418
556
  }
419
557
  document[field.name] = field.array === true ? referents : referents[0];
558
+ return referents;
420
559
  }
421
560
  function langValuesOf(node, key) {
422
561
  return valuesOf(node, key)
package/dist/query.d.ts CHANGED
@@ -95,7 +95,33 @@ export type Criterion = (CriterionBase & {
95
95
  };
96
96
  }) | (CriterionBase & {
97
97
  readonly is: boolean;
98
+ }) | (CriterionBase & {
99
+ readonly entry: readonly Criterion[];
98
100
  });
101
+ /**
102
+ * The conditions a criterion welds to **one entry** of the nested reference its
103
+ * {@link CriterionBase.field} names – *this endpoint in this role*, rather than
104
+ * this endpoint somewhere and that role somewhere.
105
+ *
106
+ * Welding is the whole reason an edge is worth indexing. Stated as two ordinary
107
+ * criteria, `role = etser` and `creator = rembrandt` are satisfied by
108
+ * *different* entries of the same document, which silently answers a wider
109
+ * question – the parallel-array defect nesting exists to remove.
110
+ *
111
+ * It stays an **atom**, so `where` remains the flat conjunction of disjunctions
112
+ * of [ADR 18](../../docs/decisions/0018-filter-across-several-fields-with-one-clause.md):
113
+ * the conjunction lives *inside* one criterion rather than nesting clause
114
+ * structure, and skip-own-filter still scans one level and finds one field.
115
+ *
116
+ * Each welded condition names a field of the reference type and carries no
117
+ * `on` of its own: they are all conditions on the same entry, which is what
118
+ * welding means.
119
+ */
120
+ export type WeldedCriterion = CriterionBase & {
121
+ readonly entry: readonly Criterion[];
122
+ };
123
+ /** Whether a criterion welds conditions to one entry ({@link WeldedCriterion}). */
124
+ export declare function isWelded(criterion: Criterion): criterion is WeldedCriterion;
99
125
  /**
100
126
  * One `where` clause: a disjunction, matching a document that satisfies **any**
101
127
  * of its criteria. An ordinary single-field filter is the one-criterion case,
@@ -169,13 +195,32 @@ export interface QueryIssue {
169
195
  * the bound of an `unparseable-bound`. Absent on every other reason. */
170
196
  readonly value?: string;
171
197
  readonly reason: 'unknown-field' | 'not-filterable' | 'operator-mismatch' | 'not-facetable'
172
- /** The criterion’s `on` path is longer than {@link MAX_JOIN_DEPTH}. */
198
+ /** The criterion’s `on` path crosses more than {@link MAX_JOIN_DEPTH}
199
+ * *joins*. Nested hops cost no round trip and do not count. */
173
200
  | 'join-too-deep'
174
- /** The `on` path does not resolve: a name that is not a field, a reference
201
+ /** A join hop does not resolve: a name that is not a field, a reference
175
202
  * that is not `joinable`, or no join graph to resolve it against. */
176
203
  | 'unknown-join'
204
+ /**
205
+ * A hop *inside* an inline reference’s entries does not walk into a nested
206
+ * reference – an unknown name, or a field that is not one. Reported apart
207
+ * from `unknown-join` so “this field is not joinable” and “this field is
208
+ * not nested” are not one message.
209
+ *
210
+ * Joining out of a nesting lands here too, deliberately: a join addresses
211
+ * another collection and there is none to address from inside an array
212
+ * element, so from in here a joinable name is as unwalkable as an unknown
213
+ * one. A join may contain a nesting; never the reverse.
214
+ */
215
+ | 'unknown-nesting'
177
216
  /** A projected reference is not a `lookup`, so nothing resolves it. */
178
217
  | 'not-resolvable'
218
+ /**
219
+ * A criterion welds conditions to one entry of a field that has no entries
220
+ * – it is not an inline reference. Welding means *one entry satisfies all
221
+ * of these*, so there has to be something to weld them to.
222
+ */
223
+ | 'not-weldable'
179
224
  /**
180
225
  * A `date` range bound the storage codec ({@link isoToUnixSeconds}) cannot
181
226
  * read, so there is no stored value to compare against – reported per
@@ -188,6 +233,43 @@ export interface QueryIssue {
188
233
  */
189
234
  | 'unparseable-bound';
190
235
  }
236
+ /**
237
+ * A resolved {@link CriterionBase.on} path: which type the leaf field belongs
238
+ * to, and how the criterion reaches it.
239
+ *
240
+ * The two hop kinds are genuinely different operations, so they are separated
241
+ * here once rather than re-derived by every adapter. A **join** hop crosses
242
+ * into another collection and costs a round trip; a **nested** hop stays inside
243
+ * the same document and costs nothing, walking into an inline reference’s
244
+ * entries.
245
+ */
246
+ export interface ResolvedPath {
247
+ /** The type the criterion’s leaf field is declared by. */
248
+ readonly leafType: SearchType;
249
+ /** The joinable references to cross, in order. Counts against
250
+ * {@link MAX_JOIN_DEPTH}; a nested hop deliberately does not. */
251
+ readonly joinPath: readonly string[];
252
+ /** The inline references to walk into, in order, after the joins. */
253
+ readonly nestedPath: readonly string[];
254
+ }
255
+ /** Why an {@link CriterionBase.on} path did not resolve. */
256
+ export type PathFailure = 'join-too-deep' | 'unknown-join' | 'unknown-nesting';
257
+ /**
258
+ * Resolve an {@link CriterionBase.on} path against the schema, classifying each
259
+ * hop by what the declaration says it is: a {@link ReferenceField.joinable}
260
+ * reference is a join, an inline reference is a nesting.
261
+ *
262
+ * **Nested hops must come last.** A join is a clause about another collection
263
+ * and a nesting is a clause about a field of this document, so a join can
264
+ * contain a nesting (`$people(…)` around `edge.role`) but a nesting cannot
265
+ * contain a join – there is no collection to address from inside an array
266
+ * element. Once inside a nesting, therefore, a joinable name is as unwalkable
267
+ * as an unknown one and both report `unknown-nesting`.
268
+ *
269
+ * Only join hops count against {@link MAX_JOIN_DEPTH}: the cap exists to bound
270
+ * round trips, and a nesting hop costs none.
271
+ */
272
+ export declare function resolvePath(searchType: SearchType, path: readonly string[], schema: SearchSchema, joins?: JoinGraph): ResolvedPath | PathFailure;
191
273
  /**
192
274
  * Structurally validate a query against its search type: **every criterion of
193
275
  * every `where` clause** names a declared, `filterable` field whose kind accepts
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,UAAU,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1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