@lde/search 0.12.0 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -62,6 +62,11 @@ Exports are stratified by audience:
62
62
  - **`@lde/search/adapter`** – plumbing for engine adapters and API surfaces:
63
63
  `physicalFields`, the field selectors, `assertValidQuery`, the filter
64
64
  operators and storage codecs.
65
+ - **`@lde/search/module`** – `loadSchemaModule`, the Node-only loader for a
66
+ mounted schema-declaration module (an `.mjs` default-exporting declarations
67
+ as plain data). The one loader both the indexer image and the served-API
68
+ image boot from, so the write and the read side cannot disagree about the
69
+ schema.
65
70
  - **`@lde/search/testing`** – `describeSearchEngineContract`, the executable
66
71
  port contract every engine adapter runs against a live instance of itself
67
72
  (vitest; optional peer).
@@ -264,6 +269,12 @@ statement of what the projection reads. `assertTypeInSchema` guards that
264
269
  the passed `SearchType` is a member of the schema – the port’s own membership
265
270
  check – so no schema is ever forged to scope a projection to one type.
266
271
 
272
+ **Blank-node roots are not indexable**: a blank node has no stable document
273
+ key, so framing skips a blank-node root (and any root absent from the index)
274
+ rather than crash. Blank-node subjects still embed fine when _referenced_ from
275
+ a root; they just cannot _be_ one – select roots accordingly
276
+ (`selectByClass` in `@lde/search-pipeline` already excludes them).
277
+
267
278
  `projectRoots` yields a **bare** `SearchDocument`. Pairing each document with the
268
279
  `SearchType` it belongs to, so the write side can fan a mixed stream out to
269
280
  per-type collections, is a routing concern owned by the pipeline glue – see
@@ -41,7 +41,12 @@ export declare function buildSubjectIndex(quads: Iterable<Quad>): SubjectIndex;
41
41
  *
42
42
  * The roots are supplied explicitly rather than discovered from `rdf:type`: the
43
43
  * caller ({@link projectRoots}, from the pipeline selector) already holds them
44
- * and passes them directly. A root absent from the index simply frames nothing.
44
+ * and passes them directly. A root absent from the index simply frames nothing –
45
+ * without ever reaching `jsonld.frame`, whose `@id` validation would otherwise
46
+ * throw on a root that is not an IRI (a blank-node label). A **blank-node root
47
+ * is skipped** even when its label is in the index: a blank node has no stable
48
+ * document key, so it can never become a search document – blank-node subjects
49
+ * are embeddable through a reference, never indexable as roots.
45
50
  */
46
51
  export declare function frameSubjects(index: SubjectIndex, roots: readonly string[], depth?: number): AsyncIterable<FramedNode>;
47
52
  //# sourceMappingURL=frame-by-type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"frame-by-type.d.ts","sourceRoot":"","sources":["../src/frame-by-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGzC,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAIjD;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;CAC1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,YAAY,CAkBrE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAuB,aAAa,CAClC,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,KAAK,SAAI,GACR,aAAa,CAAC,UAAU,CAAC,CAqB3B"}
1
+ {"version":3,"file":"frame-by-type.d.ts","sourceRoot":"","sources":["../src/frame-by-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGzC,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAIjD;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;CAC1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,YAAY,CAkBrE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAuB,aAAa,CAClC,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,KAAK,SAAI,GACR,aAAa,CAAC,UAAU,CAAC,CAyB3B"}
@@ -48,11 +48,20 @@ export function buildSubjectIndex(quads) {
48
48
  *
49
49
  * The roots are supplied explicitly rather than discovered from `rdf:type`: the
50
50
  * caller ({@link projectRoots}, from the pipeline selector) already holds them
51
- * and passes them directly. A root absent from the index simply frames nothing.
51
+ * and passes them directly. A root absent from the index simply frames nothing –
52
+ * without ever reaching `jsonld.frame`, whose `@id` validation would otherwise
53
+ * throw on a root that is not an IRI (a blank-node label). A **blank-node root
54
+ * is skipped** even when its label is in the index: a blank node has no stable
55
+ * document key, so it can never become a search document – blank-node subjects
56
+ * are embeddable through a reference, never indexable as roots.
52
57
  */
53
58
  export async function* frameSubjects(index, roots, depth = 1) {
54
59
  const { bySubject } = index;
55
60
  for (const rootIri of roots) {
61
+ const owned = bySubject.get(rootIri);
62
+ if (owned === undefined || owned[0].subject.termType === 'BlankNode') {
63
+ continue;
64
+ }
56
65
  const subgraph = collectSubgraph(bySubject, rootIri, depth);
57
66
  const expanded = await jsonld.fromRDF(subgraph);
58
67
  // Frame for THIS specific root subject by its `@id`. The subgraph embeds the
@@ -0,0 +1,24 @@
1
+ import { type SearchSchema } from './schema.js';
2
+ /** What {@link loadSchemaModule} returns: the validated schema plus the raw
3
+ * module exports, so each consumer validates its own optional exports (the
4
+ * served API reads `schemaOptions`/`engineOptions`; the indexer reads none). */
5
+ export interface LoadedSchemaModule {
6
+ /** The validated schema built from the module’s default export. */
7
+ readonly schema: SearchSchema;
8
+ /** Every export of the module, for consumer-specific optional exports. */
9
+ readonly moduleExports: Record<string, unknown>;
10
+ }
11
+ /**
12
+ * Load and validate a mounted schema-declaration module: an ES module whose
13
+ * default export is a non-empty array of {@link SearchType} declarations –
14
+ * **plain data with optional functions** (`derive`, `transform`), because a
15
+ * mounted file cannot resolve bare imports like `@lde/search`. The one schema
16
+ * source both the indexer image and the served-API image mount, so the write
17
+ * and the read side cannot disagree about the schema.
18
+ *
19
+ * Throws with the module path in the message for every failure mode – an
20
+ * unreadable file, a wrong export shape, an invalid declaration – so a bad
21
+ * mount fails the boot with a diagnosis, never the first query.
22
+ */
23
+ export declare function loadSchemaModule(modulePath: string): Promise<LoadedSchemaModule>;
24
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,YAAY,EAAmB,MAAM,aAAa,CAAC;AAE/E;;iFAEiF;AACjF,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjD;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,kBAAkB,CAAC,CA8B7B"}
package/dist/module.js ADDED
@@ -0,0 +1,42 @@
1
+ // The `@lde/search/module` entry point: load a mounted schema-declaration
2
+ // module. Node-only (it touches the filesystem), so it lives outside the main
3
+ // entry point, which stays runtime-agnostic.
4
+ import { pathToFileURL } from 'node:url';
5
+ import { searchSchema } from './schema.js';
6
+ /**
7
+ * Load and validate a mounted schema-declaration module: an ES module whose
8
+ * default export is a non-empty array of {@link SearchType} declarations –
9
+ * **plain data with optional functions** (`derive`, `transform`), because a
10
+ * mounted file cannot resolve bare imports like `@lde/search`. The one schema
11
+ * source both the indexer image and the served-API image mount, so the write
12
+ * and the read side cannot disagree about the schema.
13
+ *
14
+ * Throws with the module path in the message for every failure mode – an
15
+ * unreadable file, a wrong export shape, an invalid declaration – so a bad
16
+ * mount fails the boot with a diagnosis, never the first query.
17
+ */
18
+ export async function loadSchemaModule(modulePath) {
19
+ let moduleExports;
20
+ try {
21
+ moduleExports = (await import(pathToFileURL(modulePath).href));
22
+ }
23
+ catch (cause) {
24
+ throw new Error(`Cannot load schema module “${modulePath}”: ${messageOf(cause)}`, { cause });
25
+ }
26
+ const declarations = moduleExports['default'];
27
+ if (!Array.isArray(declarations) || declarations.length === 0) {
28
+ throw new Error(`Schema module “${modulePath}” must default-export a non-empty array of search type declarations.`);
29
+ }
30
+ try {
31
+ return {
32
+ schema: searchSchema(...declarations),
33
+ moduleExports,
34
+ };
35
+ }
36
+ catch (cause) {
37
+ throw new Error(`Schema module “${modulePath}” declares an invalid schema: ${messageOf(cause)}`, { cause });
38
+ }
39
+ }
40
+ function messageOf(cause) {
41
+ return cause instanceof Error ? cause.message : String(cause);
42
+ }
package/dist/schema.d.ts CHANGED
@@ -148,11 +148,12 @@ export interface ReferenceField extends SearchFieldBase, Searchable {
148
148
  * indexed root type (and until cross-collection references exist, it must
149
149
  * not collide with one). */
150
150
  readonly typeName: string;
151
- /** How much of the referenced entity the reference carries. Only
152
- * `labelOnly` (id + display label) is implemented; `idOnly` and `inline`
153
- * are forward declarations, so that declarations (and the SHACL
154
- * `search:nestedStrategy` mapping) keep their shape when those land, and
155
- * `inline` can then add fields to the reference type additively. */
151
+ /** How much of the referenced entity the reference carries. `labelOnly`
152
+ * (id + display label, resolved from a label source) and `inline` (the
153
+ * referent’s own projected fields, carried inline through a declared
154
+ * {@link ReferenceType} – see {@link isInlineReference}) are implemented;
155
+ * `idOnly` is a forward declaration, so that declarations (and the SHACL
156
+ * `search:nestedStrategy` mapping) keep their shape when it lands. */
156
157
  readonly strategy: 'labelOnly' | 'idOnly' | 'inline';
157
158
  };
158
159
  }
@@ -336,7 +337,7 @@ export declare function labelFieldOf(searchType: SearchType): TextField | undefi
336
337
  */
337
338
  export interface SearchTypeIssue {
338
339
  readonly field: string;
339
- readonly reason: 'duplicate-field-name' | 'invalid-field-name' | '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' | 'text-not-filterable' | 'text-not-facetable';
340
+ 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' | 'text-not-filterable' | 'text-not-facetable';
340
341
  }
341
342
  /**
342
343
  * Structurally validate one {@link SearchType} declaration – the
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,SAAS,GACT,SAAS,GACT,QAAQ,GACR,SAAS,GACT,MAAM,GACN,WAAW,CAAC;AAEhB;oEACoE;AACpE,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,CAAC;AAcnD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,cAAc,GAAG,SAAS,CAE7E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,YAAY,CAAC;AAEjB,qEAAqE;AACrE,MAAM,WAAW,eAAe;IAC9B;wCACoC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;+EAC2E;IAC3E,QAAQ,CAAC,IAAI,CAAC,E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U,GAAG,SAAS,WAAW,EAAE,CAE3E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAQ3D;AAED,qFAAqF;AACrF,wBAAgB,eAAe,CAC7B,UAAU,EAAE,UAAU,GACrB,SAAS,cAAc,EAAE,CAE3B;AAED,2CAA2C;AAC3C,wBAAgB,UAAU,CACxB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,GACX,WAAW,GAAG,SAAS,CAEzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAE1E;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,WAAW,GACjB,KAAK,IAAI,YAAY,GAAG;IAAE,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAA;CAAE,CAEzE;AAED;;;;;;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
@@ -277,6 +277,12 @@ export function validateSearchType(searchType) {
277
277
  if (!FIELD_NAME_PATTERN.test(field.name)) {
278
278
  issue('invalid-field-name');
279
279
  }
280
+ // Every kind-dependent rule below would silently pass for a kind outside
281
+ // the union, so a typo’d kind in a plain-JS declaration must fail here.
282
+ if (!Object.hasOwn(OPERATOR_BY_KIND, field.kind)) {
283
+ issue('unknown-kind');
284
+ continue;
285
+ }
280
286
  if (field.kind === 'reference') {
281
287
  if (field.output === true && field.ref === undefined) {
282
288
  issue('missing-ref');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/search",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
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",
@@ -16,6 +16,12 @@
16
16
  "development": "./src/index.ts",
17
17
  "default": "./dist/index.js"
18
18
  },
19
+ "./module": {
20
+ "types": "./dist/module.d.ts",
21
+ "import": "./dist/module.js",
22
+ "development": "./src/module.ts",
23
+ "default": "./dist/module.js"
24
+ },
19
25
  "./adapter": {
20
26
  "types": "./dist/adapter.d.ts",
21
27
  "import": "./dist/adapter.js",
@@ -37,7 +43,7 @@
37
43
  "!**/*.tsbuildinfo"
38
44
  ],
39
45
  "dependencies": {
40
- "@lde/text-normalization": "^0.1.1",
46
+ "@lde/text-normalization": "^0.1.2",
41
47
  "@rdfjs/types": "^2.0.1",
42
48
  "inflection": "^3.0.2",
43
49
  "jsonld": "^9.0.0",