@ndes/iiif-images 0.1.0 → 0.1.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.
@@ -11,8 +11,9 @@ export interface IiifImagesOptions {
11
11
  * Manifests, and separately `info.json` documents, this object may fetch across
12
12
  * all datasets, so construct one per run. Defaults to the resolver’s 500.
13
13
  *
14
- * What the budget defers is not reported, and those works are indexed without an
15
- * image. A cold store then warms only as datasets are reprocessed, so where
14
+ * What the budget defers is counted, as `manifests deferred` or
15
+ * `image services deferred`, but not reported, and those works are indexed
16
+ * without an image. A cold store then warms only as datasets are reprocessed, so where
16
17
  * unchanged datasets are skipped, set this high enough to cover them in one run.
17
18
  */
18
19
  readonly fetchesPerRun?: number;
@@ -24,6 +25,12 @@ export interface IiifImagesContext {
24
25
  readonly dataset: {
25
26
  readonly iri: URL;
26
27
  };
28
+ /**
29
+ * Told what became of each manifest and image service, such as
30
+ * `manifests fetched` or `image services from store`, so the stage can add
31
+ * up the run. An `@lde/pipeline` reader passes its own.
32
+ */
33
+ readonly count?: (name: string) => void;
27
34
  }
28
35
  /** A transform attachable to a reader as an `@lde/pipeline` `QuadTransform`. */
29
36
  export type IiifImagesTransform = (quads: AsyncIterable<Quad>, context: IiifImagesContext) => AsyncIterable<Quad>;
@@ -1 +1 @@
1
- {"version":3,"file":"iiif-images.d.ts","sourceRoot":"","sources":["../../src/lib/iiif-images.ts"],"names":[],"mappings":"AAWA,OAAO,EAKL,KAAK,iBAAiB,EAEvB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,QAAQ,EAER,YAAY,EAEb,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,IAAI,EAA6B,MAAM,cAAc,CAAC;AASpE,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IA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IAChC,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAA;KAAE,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,gFAAgF;AAChF,MAAM,MAAM,mBAAmB,GAAG,CAChC,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,EAC1B,OAAO,EAAE,iBAAiB,KACvB,aAAa,CAAC,IAAI,CAAC,CAAC;AAEzB,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,mBAAmB,GAAG,SAAS,CAAC;IAClE,4EAA4E;IAC5E,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,iBAAiB,GACzB,UAAU,CAsHZ"}
@@ -85,7 +85,7 @@ export function iiifImages(schema, options) {
85
85
  }
86
86
  const manifestOfWork = manifestsIn(batch, aliases);
87
87
  const dataset = context.dataset.iri.toString();
88
- const selected = await manifests.resolveAll([...manifestOfWork.values()].map((url) => ({ url, dataset })));
88
+ const selected = await manifests.resolveAll([...manifestOfWork.values()].map((url) => ({ url, dataset })), countedAs('manifests', context));
89
89
  const imageOfWork = new Map();
90
90
  for (const [work, manifest] of manifestOfWork) {
91
91
  const resolution = selected.get(manifest);
@@ -93,7 +93,7 @@ export function iiifImages(schema, options) {
93
93
  imageOfWork.set(work, resolution.fact);
94
94
  }
95
95
  }
96
- const resolved = await services.resolveAll([...imageOfWork.values()].flatMap(({ service }) => service === undefined ? [] : [service]));
96
+ const resolved = await services.resolveAll([...imageOfWork.values()].flatMap(({ service }) => service === undefined ? [] : [service]), countedAs('image services', context));
97
97
  for (const [work, image] of imageOfWork) {
98
98
  const representative = representativeOf(image, resolved);
99
99
  if (representative !== undefined) {
@@ -109,6 +109,10 @@ export function iiifImages(schema, options) {
109
109
  };
110
110
  }
111
111
  const factory = new DataFactory();
112
+ /** Pass the resolver’s counts on to the context, prefixed with what is resolved. */
113
+ function countedAs(prefix, { count }) {
114
+ return { count: (name) => count?.(`${prefix} ${name}`) };
115
+ }
112
116
  const INTEGER = factory.namedNode('http://www.w3.org/2001/XMLSchema#integer');
113
117
  /** What the profile’s `encodingFormat` for a manifest entry contains. */
114
118
  const IIIF_PRESENTATION_CONTEXT = 'iiif.io/api/presentation';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndes/iiif-images",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Enriches SCHEMA-AP-NDE works with the dimensions and sizes of their representative IIIF image, as a quad transform for the search indexer.",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/netwerk-digitaal-erfgoed/stack.git",
@@ -33,17 +33,17 @@
33
33
  "dependencies": {
34
34
  "@lde/iiif-image": "^0.2.0",
35
35
  "@lde/public-fetch": "^0.1.0",
36
- "@lde/resolver": "^0.2.1",
36
+ "@lde/resolver": "^0.4.0",
37
37
  "@rdfjs/types": "^2.0.1",
38
38
  "rdf-data-factory": "^2.1.0",
39
39
  "tslib": "^2.3.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@lde/pipeline": "^0.36.7",
43
- "@lde/search": "^0.34.0"
42
+ "@lde/pipeline": "^0.45.0",
43
+ "@lde/search": "^0.36.3"
44
44
  },
45
45
  "peerDependencies": {
46
- "@lde/search": "^0.34.0"
46
+ "@lde/search": ">=0.36.0"
47
47
  },
48
48
  "engines": {
49
49
  "node": ">=24"