@lde/search-indexer 0.25.2 → 0.25.4

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.
@@ -1,5 +1,6 @@
1
1
  import { type DatasetSelector, type DistributionResolver, type Writer } from '@lde/pipeline';
2
2
  import type { RootType, SearchDocument, SearchSchema } from '@lde/search';
3
+ import { type QleverOptions } from '@lde/sparql-qlever';
3
4
  import type { Client } from 'typesense';
4
5
  import type { IndexerConfig } from './config.js';
5
6
  /** The registry-backed dataset selection the configuration describes. */
@@ -23,7 +24,9 @@ export declare function writerFactoryFrom(client: Client, config: IndexerConfig)
23
24
  * pipeline-controlled QLever – a sibling container over the mounted Docker
24
25
  * socket, or a sidecar in the indexer’s pod; without one, `undefined`,
25
26
  * leaving the pipeline its endpoint-only default (a bare
26
- * {@link SparqlDistributionResolver}).
27
+ * {@link SparqlDistributionResolver}). `replaceJsonLdContext` answers remote
28
+ * JSON-LD contexts when the import converts a JSON-LD distribution, as
29
+ * `SearchIndexerExtensions.replaceJsonLdContext` describes.
27
30
  */
28
- export declare function distributionResolverFrom(config: IndexerConfig): DistributionResolver | undefined;
31
+ export declare function distributionResolverFrom(config: IndexerConfig, replaceJsonLdContext?: QleverOptions['replaceJsonLdContext']): DistributionResolver | undefined;
29
32
  //# sourceMappingURL=composition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,MAAM,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EAEb,MAAM,aAAa,CAAC;AAOrB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,eAAe,CAK1E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,GACpB,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,KAAK,MAAM,CAAC,cAAc,CAAC,CAmBxE;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,aAAa,GACpB,oBAAoB,GAAG,SAAS,CA6BlC"}
1
+ {"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,MAAM,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EAEb,MAAM,aAAa,CAAC;AAMrB,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,eAAe,CAK1E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,GACpB,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,KAAK,MAAM,CAAC,cAAc,CAAC,CAmBxE;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,aAAa,EACrB,oBAAoB,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,GAC3D,oBAAoB,GAAG,SAAS,CAmClC"}
@@ -49,14 +49,20 @@ export function writerFactoryFrom(client, config) {
49
49
  * pipeline-controlled QLever – a sibling container over the mounted Docker
50
50
  * socket, or a sidecar in the indexer’s pod; without one, `undefined`,
51
51
  * leaving the pipeline its endpoint-only default (a bare
52
- * {@link SparqlDistributionResolver}).
52
+ * {@link SparqlDistributionResolver}). `replaceJsonLdContext` answers remote
53
+ * JSON-LD contexts when the import converts a JSON-LD distribution, as
54
+ * `SearchIndexerExtensions.replaceJsonLdContext` describes.
53
55
  */
54
- export function distributionResolverFrom(config) {
56
+ export function distributionResolverFrom(config, replaceJsonLdContext) {
55
57
  if (!config.qlever) {
56
58
  return undefined;
57
59
  }
58
60
  const { importer, server } = config.qlever.mode === 'remote'
59
- ? createQlever({ mode: 'remote', dataDir: config.qlever.dataDir })
61
+ ? createQlever({
62
+ mode: 'remote',
63
+ dataDir: config.qlever.dataDir,
64
+ replaceJsonLdContext,
65
+ })
60
66
  : config.qlever.network
61
67
  ? createQlever({
62
68
  mode: 'docker',
@@ -68,11 +74,13 @@ export function distributionResolverFrom(config) {
68
74
  // indexers sharing one network would still collide, so run at most
69
75
  // one indexer per network.
70
76
  containerName: `qlever-${config.qlever.network}`,
77
+ replaceJsonLdContext,
71
78
  })
72
79
  : createQlever({
73
80
  mode: 'docker',
74
81
  image: config.qlever.image,
75
82
  dataDir: config.qlever.dataDir,
83
+ replaceJsonLdContext,
76
84
  });
77
85
  return new ImportResolver(new SparqlDistributionResolver(), {
78
86
  importer,
package/dist/indexer.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type Pipeline, type QuadTransform, type ReaderContext } from '@lde/pipeline';
2
2
  import { type TypedSearchDocument } from '@lde/search-pipeline';
3
+ import type { QleverOptions } from '@lde/sparql-qlever';
3
4
  import type { IndexerConfig } from './config.js';
4
5
  /** What a deployment adds to the standard indexer – the domain behaviour no
5
6
  * configuration can express. */
@@ -18,6 +19,14 @@ export interface SearchIndexerExtensions {
18
19
  * field with neither a `path` nor a `derive`.
19
20
  */
20
21
  readonly transforms?: Readonly<Record<string, QuadTransform<ReaderContext> | QuadTransform<ReaderContext>[]>>;
22
+ /**
23
+ * Replace remote JSON-LD contexts when the QLever import path converts a
24
+ * JSON-LD distribution. Called with the URL of each remote `@context`;
25
+ * return the document to use instead (`{ '@context': { … } }`), or
26
+ * `undefined` to fetch it as usual. Has no effect without a configured
27
+ * QLever.
28
+ */
29
+ readonly replaceJsonLdContext?: QleverOptions['replaceJsonLdContext'];
21
30
  }
22
31
  /**
23
32
  * Compose the ready-to-run search indexer from an {@link IndexerConfig}: load
@@ -1 +1 @@
1
- {"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../src/indexer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,sBAAsB,CAAC;AAO9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;iCACiC;AACjC,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAC5B,MAAM,CACJ,MAAM,EACN,aAAa,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC,aAAa,CAAC,EAAE,CAC9D,CACF,CAAC;CACH;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,EACrB,UAAU,GAAE,uBAA4B,GACvC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CA+BxC"}
1
+ {"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../src/indexer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAOxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;iCACiC;AACjC,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAC5B,MAAM,CACJ,MAAM,EACN,aAAa,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC,aAAa,CAAC,EAAE,CAC9D,CACF,CAAC;IACF;;;;;;OAMG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CACvE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,aAAa,EACrB,UAAU,GAAE,uBAA4B,GACvC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAkCxC"}
package/dist/indexer.js CHANGED
@@ -32,7 +32,7 @@ export async function createSearchIndexer(config, extensions = {}) {
32
32
  return searchIndexerPipeline({
33
33
  schema,
34
34
  datasets: datasetSelectorFrom(config),
35
- distributionResolver: distributionResolverFrom(config),
35
+ distributionResolver: distributionResolverFrom(config, extensions.replaceJsonLdContext),
36
36
  writerFor: writerFactoryFrom(client, config),
37
37
  registryTypes: config.registryRootTypes.length > 0
38
38
  ? {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/search-indexer",
3
- "version": "0.25.2",
3
+ "version": "0.25.4",
4
4
  "description": "The @lde/search-pipeline indexer as a bootable process and prebuilt Docker image: loads a mounted schema-declaration module, dataset selection, Typesense connection and rebuild mode from the environment, then runs the object-grain searchIndexerPipeline once to completion. The composition layer that binds the engine-agnostic @lde/search-pipeline stages to @lde/search-typesense – the write-path counterpart of @lde/search-api-server.",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/ldelements/lde.git",
@@ -29,12 +29,12 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@lde/dataset-registry-client": "^0.10.0",
32
- "@lde/pipeline": "^0.39.1",
33
- "@lde/pipeline-console-reporter": "^0.30.1",
32
+ "@lde/pipeline": "^0.39.2",
33
+ "@lde/pipeline-console-reporter": "^0.30.2",
34
34
  "@lde/search": "^0.32.1",
35
- "@lde/search-pipeline": "^0.35.2",
36
- "@lde/search-typesense": "^0.38.2",
37
- "@lde/sparql-qlever": "^0.18.1",
35
+ "@lde/search-pipeline": "^0.35.3",
36
+ "@lde/search-typesense": "^0.38.3",
37
+ "@lde/sparql-qlever": "^0.18.2",
38
38
  "commander": "^15.0.0",
39
39
  "tslib": "^2.3.0",
40
40
  "typesense": "^3.1.1"