@lde/search 0.18.3 → 0.19.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 +1 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +1 -1
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +28 -15
- package/dist/schema.d.ts +63 -19
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +24 -0
- package/package.json +1 -1
package/dist/adapter.d.ts
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, inlineFramingDepth, fieldNamed, datasetField, ID_FIELD, AND_KEY, OR_KEY, labelFieldOf, labelFieldNameOf, DEFAULT_LABEL_FIELD, isRangeFacet, isoToUnixSeconds, unixSecondsToIso, } from './schema.js';
|
|
9
|
+
export { assertTypeInSchema, physicalFields, irAlias, displayFieldName, displayFieldPattern, displayLangOf, searchableFields, facetableFields, filterableFields, sortableFields, outputFields, isInternalField, isInlineReference, nestedReferenceType, nestedFieldName, referenceFields, referenceTypeNamed, inlineFramingDepth, fieldNamed, datasetField, ID_FIELD, AND_KEY, OR_KEY, labelFieldOf, labelFieldNameOf, 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 { filterOperatorFor, filterOperator, filterOn, isUnsatisfiable, validateQuery, assertValidQuery, pageForOffset, } from './query.js';
|
package/dist/adapter.d.ts.map
CHANGED
|
@@ -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,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,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,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,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,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,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"}
|
package/dist/adapter.js
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
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, inlineFramingDepth, fieldNamed, datasetField, ID_FIELD, AND_KEY, OR_KEY, labelFieldOf, labelFieldNameOf, DEFAULT_LABEL_FIELD, isRangeFacet, isoToUnixSeconds, unixSecondsToIso, } from './schema.js';
|
|
9
|
+
export { assertTypeInSchema, physicalFields, irAlias, displayFieldName, displayFieldPattern, displayLangOf, searchableFields, facetableFields, filterableFields, sortableFields, outputFields, isInternalField, isInlineReference, nestedReferenceType, nestedFieldName, referenceFields, referenceTypeNamed, inlineFramingDepth, fieldNamed, datasetField, ID_FIELD, AND_KEY, OR_KEY, labelFieldOf, labelFieldNameOf, DEFAULT_LABEL_FIELD, isRangeFacet, isAbsoluteIri, isoToUnixSeconds, unixSecondsToIso, } from './schema.js';
|
|
10
10
|
export { physicalNameTokens } from './physical-name.js';
|
|
11
11
|
export { filterOperatorFor, filterOperator, filterOn, isUnsatisfiable, validateQuery, assertValidQuery, pageForOffset, } from './query.js';
|
package/dist/project.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAYL,KAAK,eAAe,EAEpB,KAAK,QAAQ,EAEb,KAAK,YAAY,EACjB,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD,+DAA+D;AAC/D,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAkB,SAAQ,OAAO,CAChD,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAC1C;IACC,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAKD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,UAAU,EACtB,MAAM,CAAC,EAAE,YAAY,EACrB,OAAO,GAAE,iBAAyC,GACjD,cAAc,CAgBhB;AA2ED;;;;;;;;;;;;GAYG;AACH,wBAAuB,YAAY,CACjC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,EACrB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,QAAQ,EACpB,OAAO,GAAE,iBAAyC,GACjD,aAAa,CAAC,cAAc,CAAC,CAW/B"}
|
package/dist/project.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fold } from '@lde/text-normalization';
|
|
2
2
|
import { buildSubjectIndex, frameSubjects, } from './frame-by-type.js';
|
|
3
|
-
import { assertTypeInSchema, displayFieldName, inlineFramingDepth, irAlias, isInternalField, isInlineReference, isoToUnixSeconds, physicalFields, referenceTypeNamed, } from './schema.js';
|
|
3
|
+
import { assertTypeInSchema, displayFieldName, inlineFramingDepth, irAlias, isAbsoluteIri, isInternalField, isInlineReference, isoToUnixSeconds, physicalFields, referenceTypeNamed, } from './schema.js';
|
|
4
4
|
/** The context a projection runs with when its caller supplied none. */
|
|
5
5
|
const NO_PROJECTION_CONTEXT = {};
|
|
6
6
|
/**
|
|
@@ -19,7 +19,7 @@ const NO_PROJECTION_CONTEXT = {};
|
|
|
19
19
|
*/
|
|
20
20
|
export function projectDocument(node, searchType, schema, context = NO_PROJECTION_CONTEXT) {
|
|
21
21
|
if (documentKey(node) === undefined) {
|
|
22
|
-
throw new Error(`Cannot project a “${searchType.name}” node
|
|
22
|
+
throw new Error(`Cannot project a “${searchType.name}” node whose @id is not an absolute IRI (got ${JSON.stringify(node['@id']) ?? 'none'}; a blank node label or a relative reference is not one): every search document needs a stable key, and an empty one would collide with other keyless nodes.`);
|
|
23
23
|
}
|
|
24
24
|
// The guard above is what makes this a SearchDocument: projectFields sets `id`
|
|
25
25
|
// for exactly the nodes documentKey resolves.
|
|
@@ -76,15 +76,17 @@ function projectFields(node, searchType, schema, context) {
|
|
|
76
76
|
return document;
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
|
-
* The document key a framed node carries, if any
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
79
|
+
* The document key a framed node carries, if any – an {@link isAbsoluteIri
|
|
80
|
+
* absolute IRI}, the same rule {@link iriString} applies to a referent, so a
|
|
81
|
+
* root and a reference cannot disagree about what counts as identity. A blank
|
|
82
|
+
* node label (`_:b0`) is not one: framing mints it per call, so it recurs across
|
|
83
|
+
* documents and can change when unrelated triples do. A node bearing one is
|
|
84
|
+
* therefore projected as if framing had pruned its `@id` – which it does
|
|
85
|
+
* whenever the label occurs only once in the framing results.
|
|
84
86
|
*/
|
|
85
87
|
function documentKey(node) {
|
|
86
88
|
const id = node['@id'];
|
|
87
|
-
return typeof id === 'string' &&
|
|
89
|
+
return typeof id === 'string' && isAbsoluteIri(id) ? id : undefined;
|
|
88
90
|
}
|
|
89
91
|
/**
|
|
90
92
|
* Project a single type over a known set of `roots` – the per-type, roots-given
|
|
@@ -362,14 +364,25 @@ function literalString(value) {
|
|
|
362
364
|
}
|
|
363
365
|
return undefined;
|
|
364
366
|
}
|
|
367
|
+
/**
|
|
368
|
+
* The IRI a reference value carries, or `undefined` when it carries none. A
|
|
369
|
+
* value may arrive as a bare string – `schema:sameAs`, `contentUrl`,
|
|
370
|
+
* `thumbnailUrl` and `landingPage` all range on `schema:URL`, which a source may
|
|
371
|
+
* emit as a literal rather than a node – or as a node object.
|
|
372
|
+
*
|
|
373
|
+
* **A referent with no IRI yields nothing**, the same rule {@link documentKey}
|
|
374
|
+
* applies to a root and for the same reason: what a `labelOnly`/`idOnly`
|
|
375
|
+
* reference stores is a selection key, and a blank node label is not one.
|
|
376
|
+
* Framing mints it per call, so it recurs across documents and changes when
|
|
377
|
+
* unrelated triples do – indexing it would key a facet bucket on a value that
|
|
378
|
+
* neither groups what is equal nor separates what is not. An **inline**
|
|
379
|
+
* reference is untouched by this: it carries the referent’s fields rather than
|
|
380
|
+
* its identity ({@link applyInlineReference}), so a blank-node referent nests
|
|
381
|
+
* exactly as before.
|
|
382
|
+
*/
|
|
365
383
|
function iriString(value) {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
}
|
|
369
|
-
if (isObject(value) && typeof value['@id'] === 'string') {
|
|
370
|
-
return value['@id'];
|
|
371
|
-
}
|
|
372
|
-
return undefined;
|
|
384
|
+
const iri = isObject(value) ? value['@id'] : value;
|
|
385
|
+
return typeof iri === 'string' && isAbsoluteIri(iri) ? iri : undefined;
|
|
373
386
|
}
|
|
374
387
|
function toInteger(literal) {
|
|
375
388
|
return literal === undefined ? undefined : Math.trunc(Number(literal));
|
package/dist/schema.d.ts
CHANGED
|
@@ -189,28 +189,54 @@ export interface ReferenceField extends SearchFieldBase, Searchable {
|
|
|
189
189
|
* resolution.
|
|
190
190
|
*/
|
|
191
191
|
readonly labelSource?: string;
|
|
192
|
-
/**
|
|
193
|
-
*
|
|
194
|
-
*
|
|
192
|
+
/**
|
|
193
|
+
* The referenced entity’s shape and how much of it to carry. Required when
|
|
194
|
+
* the field is `output` – the strategy is what decides the output shape, so
|
|
195
|
+
* a surfaced reference must state it; optional for a facet- or filter-only
|
|
196
|
+
* reference.
|
|
197
|
+
*
|
|
198
|
+
* A **discriminated union by `strategy`**, because `typeName` is load-bearing
|
|
199
|
+
* for two of the three and meaningless for the third: a `labelOnly` reference
|
|
200
|
+
* needs a name to emit its id-plus-label type under, an `inline` one needs a
|
|
201
|
+
* name that resolves to a declared {@link ReferenceType}, and an `idOnly` one
|
|
202
|
+
* carries a bare IRI that may belong to no declared type at all (`sameAs`
|
|
203
|
+
* points at a vocabulary nobody indexes). Declaring `typeName` on an `idOnly`
|
|
204
|
+
* reference is still useful where a target *is* nameable – an API surface can
|
|
205
|
+
* then tell IRIs of that target apart from IRIs at large.
|
|
206
|
+
*/
|
|
195
207
|
readonly ref?: {
|
|
196
208
|
/** Logical API type name of the referenced entity (PascalCase, e.g.
|
|
197
|
-
* `Organization`) – names the reference’s type in the API surfaces,
|
|
198
|
-
* way {@link SearchType.name} names a root type; fields sharing it
|
|
199
|
-
* one emitted type. For a `labelOnly
|
|
200
|
-
* not a key: it need not correspond to any indexed root type, and it
|
|
201
|
-
* name one (`creator` → `Person`, with the labels resolved from
|
|
202
|
-
* root’s collection via `labelSource`) – an API surface then
|
|
203
|
-
* reference under a derived name (GraphQL:
|
|
204
|
-
* type names unique. An `inline`
|
|
205
|
-
*
|
|
209
|
+
* `Organization`) – names the reference’s type in the API surfaces,
|
|
210
|
+
* the way {@link SearchType.name} names a root type; fields sharing it
|
|
211
|
+
* share one emitted type. For a `labelOnly` reference it is a name,
|
|
212
|
+
* not a key: it need not correspond to any indexed root type, and it
|
|
213
|
+
* may name one (`creator` → `Person`, with the labels resolved from
|
|
214
|
+
* that root’s collection via `labelSource`) – an API surface then
|
|
215
|
+
* serves the reference under a derived name (GraphQL:
|
|
216
|
+
* `‹Name›Reference`) to keep type names unique. An `inline`
|
|
217
|
+
* reference’s typeName instead resolves to a declared
|
|
218
|
+
* {@link ReferenceType}, so it can never name a root type. */
|
|
206
219
|
readonly typeName: string;
|
|
207
|
-
/**
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* {@link
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
220
|
+
/** `labelOnly` carries the id plus a display label resolved from a
|
|
221
|
+
* label source; `inline` carries the referent’s own projected fields
|
|
222
|
+
* through a declared {@link ReferenceType} (see
|
|
223
|
+
* {@link isInlineReference}). */
|
|
224
|
+
readonly strategy: 'labelOnly' | 'inline';
|
|
225
|
+
} | {
|
|
226
|
+
/** Optional here, unlike the other strategies: an `idOnly` reference
|
|
227
|
+
* emits no type of its own, so a name is not needed to emit one under.
|
|
228
|
+
* Declare it when the referent’s IRIs form a nameable set an API
|
|
229
|
+
* surface should distinguish; omit it for IRIs that belong to no such
|
|
230
|
+
* set. */
|
|
231
|
+
readonly typeName?: string;
|
|
232
|
+
/** The IRI, and nothing else – no label resolution, no nested fields.
|
|
233
|
+
* Surfaces as a bare IRI rather than an object, which is what makes it
|
|
234
|
+
* the right strategy for a reference whose referent is not an entity
|
|
235
|
+
* this deployment describes: a canonical vocabulary URI, a licence, a
|
|
236
|
+
* content URL. A {@link ReferenceField.labelSource} is still honoured
|
|
237
|
+
* for facet bucket labels – the strategy governs the output shape, not
|
|
238
|
+
* whether a bucket can be labelled. */
|
|
239
|
+
readonly strategy: 'idOnly';
|
|
214
240
|
};
|
|
215
241
|
}
|
|
216
242
|
/**
|
|
@@ -638,6 +664,24 @@ export declare function irAlias(searchType: SearchType, field: SearchField): str
|
|
|
638
664
|
export declare function isRangeFacet(field: SearchField): field is NumericField & {
|
|
639
665
|
readonly facetRanges: readonly FacetRange[];
|
|
640
666
|
};
|
|
667
|
+
/**
|
|
668
|
+
* Whether a value is an **absolute IRI**: a scheme, then anything with no
|
|
669
|
+
* whitespace. The single definition the projection (which
|
|
670
|
+
* drops a reference value failing it) and an API surface (which types such a
|
|
671
|
+
* value as an IRI, and rejects one that is not) both read, so the two cannot
|
|
672
|
+
* disagree about what a reference holds – the argument {@link physicalFields}
|
|
673
|
+
* makes for the physical fanout.
|
|
674
|
+
*
|
|
675
|
+
* Deliberately a **scheme check, not an `http(s)` one**. `urn:`, `doi:`, `ark:`,
|
|
676
|
+
* `tag:`, `mailto:` and a deployment’s own minted scheme (`urn:lde:…`) are
|
|
677
|
+
* ordinary Linked Data, and rejecting them would make this package refuse
|
|
678
|
+
* conformant data. What the check does exclude is what a reference must never
|
|
679
|
+
* hold: a blank node label (`_:b0` – a scheme must start with a letter), a bare
|
|
680
|
+
* token (`boerenbont`), and a relative reference. Full RFC 3987 parsing would
|
|
681
|
+
* buy nothing over that while starting to reject real data with a character
|
|
682
|
+
* someone forgot to percent-encode.
|
|
683
|
+
*/
|
|
684
|
+
export declare function isAbsoluteIri(value: string): boolean;
|
|
641
685
|
/**
|
|
642
686
|
* The engine storage codec for `date` fields: stored as Unix seconds (a
|
|
643
687
|
* sortable, range-filterable int64), ISO 8601 at the API edges. One pair for
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA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jB,KAAK,IAAI,YAAY,GAAG;IAAE,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAA;CAAE,CAEzE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD;AAOD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGhE;AAED,+EAA+E;AAC/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
|
@@ -692,6 +692,30 @@ export function irAlias(searchType, field) {
|
|
|
692
692
|
export function isRangeFacet(field) {
|
|
693
693
|
return field.facetRanges !== undefined && field.facetRanges.length > 0;
|
|
694
694
|
}
|
|
695
|
+
/**
|
|
696
|
+
* Whether a value is an **absolute IRI**: a scheme, then anything with no
|
|
697
|
+
* whitespace. The single definition the projection (which
|
|
698
|
+
* drops a reference value failing it) and an API surface (which types such a
|
|
699
|
+
* value as an IRI, and rejects one that is not) both read, so the two cannot
|
|
700
|
+
* disagree about what a reference holds – the argument {@link physicalFields}
|
|
701
|
+
* makes for the physical fanout.
|
|
702
|
+
*
|
|
703
|
+
* Deliberately a **scheme check, not an `http(s)` one**. `urn:`, `doi:`, `ark:`,
|
|
704
|
+
* `tag:`, `mailto:` and a deployment’s own minted scheme (`urn:lde:…`) are
|
|
705
|
+
* ordinary Linked Data, and rejecting them would make this package refuse
|
|
706
|
+
* conformant data. What the check does exclude is what a reference must never
|
|
707
|
+
* hold: a blank node label (`_:b0` – a scheme must start with a letter), a bare
|
|
708
|
+
* token (`boerenbont`), and a relative reference. Full RFC 3987 parsing would
|
|
709
|
+
* buy nothing over that while starting to reject real data with a character
|
|
710
|
+
* someone forgot to percent-encode.
|
|
711
|
+
*/
|
|
712
|
+
export function isAbsoluteIri(value) {
|
|
713
|
+
return ABSOLUTE_IRI.test(value);
|
|
714
|
+
}
|
|
715
|
+
/** Scheme (RFC 3986 `ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )`), then any
|
|
716
|
+
* run of non-whitespace. Non-ASCII is deliberately allowed: an IRI is not
|
|
717
|
+
* restricted to ASCII. */
|
|
718
|
+
const ABSOLUTE_IRI = /^[A-Za-z][A-Za-z0-9+.-]*:\S*$/;
|
|
695
719
|
/**
|
|
696
720
|
* The engine storage codec for `date` fields: stored as Unix seconds (a
|
|
697
721
|
* sortable, range-filterable int64), ISO 8601 at the API edges. One pair for
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lde/search",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
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",
|