@lde/search 0.18.1 → 0.18.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/dist/module.d.ts CHANGED
@@ -21,4 +21,12 @@ export interface LoadedSchemaModule {
21
21
  * mount fails the boot with a diagnosis, never the first query.
22
22
  */
23
23
  export declare function loadSchemaModule(modulePath: string): Promise<LoadedSchemaModule>;
24
+ /**
25
+ * Read an optional object-shaped export of a loaded schema module, rejecting
26
+ * anything that is not a plain object with the module path and the export name
27
+ * in the message. Which optional exports a module may carry is the consumer’s
28
+ * business – {@link loadSchemaModule} hands back the raw exports for exactly
29
+ * that reason – but every consumer rejects a malformed one the same way.
30
+ */
31
+ export declare function optionalObjectExport<Options>(moduleExports: Record<string, unknown>, name: string, modulePath: string): Options | undefined;
24
32
  //# sourceMappingURL=module.d.ts.map
@@ -1 +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"}
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;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAC1C,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GACjB,OAAO,GAAG,SAAS,CAWrB"}
package/dist/module.js CHANGED
@@ -37,6 +37,23 @@ export async function loadSchemaModule(modulePath) {
37
37
  throw new Error(`Schema module “${modulePath}” declares an invalid schema: ${messageOf(cause)}`, { cause });
38
38
  }
39
39
  }
40
+ /**
41
+ * Read an optional object-shaped export of a loaded schema module, rejecting
42
+ * anything that is not a plain object with the module path and the export name
43
+ * in the message. Which optional exports a module may carry is the consumer’s
44
+ * business – {@link loadSchemaModule} hands back the raw exports for exactly
45
+ * that reason – but every consumer rejects a malformed one the same way.
46
+ */
47
+ export function optionalObjectExport(moduleExports, name, modulePath) {
48
+ const value = moduleExports[name];
49
+ if (value === undefined) {
50
+ return undefined;
51
+ }
52
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
53
+ throw new Error(`Schema module “${modulePath}” export “${name}” must be an object.`);
54
+ }
55
+ return value;
56
+ }
40
57
  function messageOf(cause) {
41
58
  return cause instanceof Error ? cause.message : String(cause);
42
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/search",
3
- "version": "0.18.1",
3
+ "version": "0.18.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",