@lde/search 0.20.0 → 0.21.1
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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/project.js +40 -3
- package/dist/schema.d.ts +10 -2
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +14 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { projectRoots } from './project.js';
|
|
2
2
|
export type { ProjectedNode, ProjectionContext, SearchDocument, } from './project.js';
|
|
3
|
-
export { defineSearchType, searchSchema, validateSearchType, assertValidSearchType, ID_FIELD, AND_KEY, OR_KEY, } from './schema.js';
|
|
3
|
+
export { defineSearchType, searchSchema, validateSearchType, assertValidSearchType, ID_FIELD, AND_KEY, OR_KEY, isoToUnixSeconds, unixSecondsToIso, } from './schema.js';
|
|
4
4
|
export type { FieldKind, SearchField, SearchFieldBase, TextField, KeywordField, ReferenceField, NumericField, BooleanField, SearchType, SearchTypeBase, RootType, ReferenceType, RootTypeOf, SearchTypeIssue, 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';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,cAAc,EACd,QAAQ,EACR,aAAa,EACb,UAAU,EACV,eAAe,EACf,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,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"}
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,13 @@ export { projectRoots } from './project.js';
|
|
|
10
10
|
// Unified field model: one declaration drives projection, engine collection
|
|
11
11
|
// schema, query semantics and the GraphQL surface – a discriminated union by
|
|
12
12
|
// `kind`, validated again at runtime when the schema is built.
|
|
13
|
-
export { defineSearchType, searchSchema, validateSearchType, assertValidSearchType, ID_FIELD, AND_KEY, OR_KEY,
|
|
13
|
+
export { defineSearchType, searchSchema, validateSearchType, assertValidSearchType, ID_FIELD, AND_KEY, OR_KEY,
|
|
14
|
+
// The `date` storage codec. A schema author needs it whenever a value
|
|
15
|
+
// bypasses the projection’s own conversion – a `date` populated outside the
|
|
16
|
+
// projection, or a derive that computes seconds from something other than an
|
|
17
|
+
// ISO string – so it belongs on the authoring surface, not only the adapter
|
|
18
|
+
// one.
|
|
19
|
+
isoToUnixSeconds, unixSecondsToIso, } from './schema.js';
|
|
14
20
|
// The declared join edges between root types: which types a query can filter
|
|
15
21
|
// across, and which collections must be rebuilt together. Built eagerly by
|
|
16
22
|
// `searchSchema`, so declaring a schema is what validates the joins.
|
package/dist/project.js
CHANGED
|
@@ -121,8 +121,27 @@ function applyField(document, node, field, searchType, schema, context) {
|
|
|
121
121
|
return applyProjectionValue(document, field, field.from, context);
|
|
122
122
|
}
|
|
123
123
|
if (field.derive !== undefined) {
|
|
124
|
-
const
|
|
125
|
-
|
|
124
|
+
const derived = field.derive(document, context);
|
|
125
|
+
// A derived `reference` is held to the same rule as a read one: what it
|
|
126
|
+
// stores is a selection key, and the surface types it `IRI`. ADR 19 sends
|
|
127
|
+
// an IRI-valued `keyword` derive here by converting it to `reference`, so
|
|
128
|
+
// this is the busiest way a non-IRI could otherwise reach the index. A
|
|
129
|
+
// value that survives nothing leaves the field absent, exactly as a derive
|
|
130
|
+
// returning `undefined` does.
|
|
131
|
+
const value = field.kind === 'reference' && derived !== undefined
|
|
132
|
+
? derivedIris(derived)
|
|
133
|
+
: // A derived `date` goes through the same storage codec as a read one:
|
|
134
|
+
// the field is stored as Unix seconds, so an ISO string returned here
|
|
135
|
+
// would otherwise land as a string in an int64 field. A derive that
|
|
136
|
+
// already computed seconds returns a number and passes through.
|
|
137
|
+
field.kind === 'date' && typeof derived === 'string'
|
|
138
|
+
? isoToUnixSeconds(derived)
|
|
139
|
+
: derived;
|
|
140
|
+
// NaN is not a value any kind stores, and a derive is the only route that
|
|
141
|
+
// can produce one (`setNumber` guards the read route). It serializes as
|
|
142
|
+
// `null`, which an engine rejects for a numeric field – so drop it, leaving
|
|
143
|
+
// the field absent as an unparseable string already does.
|
|
144
|
+
if (value !== undefined && !Number.isNaN(value)) {
|
|
126
145
|
document[field.name] = value;
|
|
127
146
|
}
|
|
128
147
|
return;
|
|
@@ -236,7 +255,14 @@ function foldedSearchValue(values) {
|
|
|
236
255
|
* document – a value the API cannot serialize.
|
|
237
256
|
*/
|
|
238
257
|
function applyFacet(document, raw, field) {
|
|
239
|
-
|
|
258
|
+
// A `reference` stores identity, so what it stores must be an IRI whatever
|
|
259
|
+
// route the value arrived by. {@link iriString} guards the graph path, but a
|
|
260
|
+
// `transform` runs after it and a `from` projection value never passes it at
|
|
261
|
+
// all – so both are checked here, at the one point they share. Without this
|
|
262
|
+
// the surface would promise `IRI` over a value the projection let through.
|
|
263
|
+
const referenced = field.kind === 'reference';
|
|
264
|
+
const transformed = field.transform ? raw.map(field.transform) : raw;
|
|
265
|
+
const values = dedupe(referenced ? transformed.filter(isAbsoluteIri) : transformed);
|
|
240
266
|
const folded = dedupe(values.map((value) => fold(value)));
|
|
241
267
|
const searchField = physicalFields(field).search[0];
|
|
242
268
|
if (field.array === true) {
|
|
@@ -384,6 +410,17 @@ function iriString(value) {
|
|
|
384
410
|
const iri = isObject(value) ? value['@id'] : value;
|
|
385
411
|
return typeof iri === 'string' && isAbsoluteIri(iri) ? iri : undefined;
|
|
386
412
|
}
|
|
413
|
+
/** What a `derive` on a `reference` field is allowed to have produced: the
|
|
414
|
+
* absolute IRIs among its return value, keeping the shape the declaration
|
|
415
|
+
* promises (a list stays a list, a single value stays single) so `array` still
|
|
416
|
+
* decides the stored shape. A lone non-IRI becomes `undefined`, i.e. absent –
|
|
417
|
+
* the same outcome the graph path gives it. */
|
|
418
|
+
function derivedIris(value) {
|
|
419
|
+
if (Array.isArray(value)) {
|
|
420
|
+
return value.filter((entry) => typeof entry === 'string' && isAbsoluteIri(entry));
|
|
421
|
+
}
|
|
422
|
+
return typeof value === 'string' && isAbsoluteIri(value) ? value : undefined;
|
|
423
|
+
}
|
|
387
424
|
function toInteger(literal) {
|
|
388
425
|
return literal === undefined ? undefined : Math.trunc(Number(literal));
|
|
389
426
|
}
|
package/dist/schema.d.ts
CHANGED
|
@@ -111,6 +111,12 @@ export interface SearchFieldBase {
|
|
|
111
111
|
* dataset being indexed). It is what lets a derive relate a projected value
|
|
112
112
|
* to its provenance: dropping a polymorphic `isPartOf` value that merely
|
|
113
113
|
* points back at the containing dataset, say.
|
|
114
|
+
*
|
|
115
|
+
* The returned value goes through the same storage conversion a read one
|
|
116
|
+
* does, so a derive states its value in the field’s own terms: a `date`
|
|
117
|
+
* derive may return an ISO 8601 string ({@link isoToUnixSeconds} is applied
|
|
118
|
+
* for it) or the stored Unix seconds directly, and a `reference` derive is
|
|
119
|
+
* held to absolute IRIs.
|
|
114
120
|
*/
|
|
115
121
|
readonly derive?: (document: ProjectedNode, context: ProjectionContext) => unknown;
|
|
116
122
|
}
|
|
@@ -484,7 +490,7 @@ export declare function labelFieldOf(searchType: SearchType): TextField | undefi
|
|
|
484
490
|
*/
|
|
485
491
|
export interface SearchTypeIssue {
|
|
486
492
|
readonly field: string;
|
|
487
|
-
readonly reason: 'duplicate-field-name' | 'invalid-field-name' | 'unknown-kind' | 'invalid-locale' | 'missing-ref' | 'ref-not-allowed' | 'text-requires-locales' | 'locales-not-allowed' | 'facet-ranges-not-allowed' | 'searchable-not-allowed' | 'transform-not-allowed' | 'derive-with-path' | 'from-not-allowed' | 'from-with-path' | 'from-with-derive' | 'from-with-inline-ref' | 'unknown-projection-value' | 'duplicate-projection-value' | 'text-not-filterable' | 'text-not-facetable' | 'joinable-not-allowed' | 'joinable-without-label-source' | 'joinable-with-inline-ref' | 'reserved-field-name';
|
|
493
|
+
readonly reason: 'duplicate-field-name' | 'invalid-field-name' | 'unknown-kind' | 'invalid-locale' | 'missing-ref' | 'missing-ref-type-name' | 'ref-not-allowed' | 'text-requires-locales' | 'locales-not-allowed' | 'facet-ranges-not-allowed' | 'searchable-not-allowed' | 'transform-not-allowed' | 'derive-with-path' | 'from-not-allowed' | 'from-with-path' | 'from-with-derive' | 'from-with-inline-ref' | 'unknown-projection-value' | 'duplicate-projection-value' | 'text-not-filterable' | 'text-not-facetable' | 'joinable-not-allowed' | 'joinable-without-label-source' | 'joinable-with-inline-ref' | 'reserved-field-name';
|
|
488
494
|
}
|
|
489
495
|
/**
|
|
490
496
|
* The reserved logical name of a document’s IRI – the one field every indexed
|
|
@@ -526,7 +532,9 @@ export declare const OR_KEY = "or";
|
|
|
526
532
|
* - a `text` field’s declared locales are BCP-47-shaped (no `_`, which is the
|
|
527
533
|
* reserved name↔locale separator);
|
|
528
534
|
* - a `reference` field that is `output` declares `ref` (the API surfaces
|
|
529
|
-
* need the reference type name)
|
|
535
|
+
* need the reference type name), and – unless its strategy is `idOnly`, which
|
|
536
|
+
* emits no type of its own – that `ref` declares a `typeName`; `ref` on any
|
|
537
|
+
* other kind is meaningless;
|
|
530
538
|
* - `joinable` only on a `reference` field, and only alongside a `labelSource`
|
|
531
539
|
* – the join addresses the referent’s collection, which is the one the label
|
|
532
540
|
* source names, so without it the flag states an edge to nowhere – and never
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGrE;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GACnB,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,CAAC;AAE/E;oEACoE;AACpE,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,CAAC;AAcnD;;;;;GAKG;AACH,wBAAgB,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E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,cAAc,CAgBjE"}
|
package/dist/schema.js
CHANGED
|
@@ -392,7 +392,9 @@ const LOCALE_PATTERN = /^[A-Za-z0-9]+(-[A-Za-z0-9]+)*$/;
|
|
|
392
392
|
* - a `text` field’s declared locales are BCP-47-shaped (no `_`, which is the
|
|
393
393
|
* reserved name↔locale separator);
|
|
394
394
|
* - a `reference` field that is `output` declares `ref` (the API surfaces
|
|
395
|
-
* need the reference type name)
|
|
395
|
+
* need the reference type name), and – unless its strategy is `idOnly`, which
|
|
396
|
+
* emits no type of its own – that `ref` declares a `typeName`; `ref` on any
|
|
397
|
+
* other kind is meaningless;
|
|
396
398
|
* - `joinable` only on a `reference` field, and only alongside a `labelSource`
|
|
397
399
|
* – the join addresses the referent’s collection, which is the one the label
|
|
398
400
|
* source names, so without it the flag states an edge to nowhere – and never
|
|
@@ -459,6 +461,17 @@ export function validateSearchType(searchType) {
|
|
|
459
461
|
if (field.output === true && field.ref === undefined) {
|
|
460
462
|
issue('missing-ref');
|
|
461
463
|
}
|
|
464
|
+
// `typeName` is optional only for `idOnly`, which emits no type and so
|
|
465
|
+
// needs no name to emit one under. Every other surfaced strategy is
|
|
466
|
+
// served AS a named type, and without a name an API surface has nothing
|
|
467
|
+
// to emit – the GraphQL one silently prints `undefined` as the field’s
|
|
468
|
+
// type, publishing a contract that is not a schema.
|
|
469
|
+
if (field.output === true &&
|
|
470
|
+
field.ref !== undefined &&
|
|
471
|
+
field.ref.strategy !== 'idOnly' &&
|
|
472
|
+
field.ref.typeName === undefined) {
|
|
473
|
+
issue('missing-ref-type-name');
|
|
474
|
+
}
|
|
462
475
|
// A join addresses the referent’s collection, which is the collection the
|
|
463
476
|
// label source names: without one the flag states an edge to nowhere.
|
|
464
477
|
if (field.joinable === true && field.labelSource === undefined) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lde/search",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"description": "Engine- and domain-agnostic core for RDF-backed search: a unified declarative field model (SearchField/SearchType/SearchSchema), a neutral query IR, the SearchEngine port with logical result types, and a streaming CONSTRUCT-to-document projection. Bakes in no engine, protocol, or domain.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "git+https://github.com/ldelements/lde.git",
|