@lde/pipeline 0.28.14 → 0.29.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/README.md +20 -17
- package/dist/progressReporter.d.ts +5 -3
- package/dist/progressReporter.d.ts.map +1 -1
- package/dist/sparql/selector.d.ts +18 -0
- package/dist/sparql/selector.d.ts.map +1 -1
- package/dist/sparql/selector.js +24 -1
- package/dist/validator.d.ts +0 -22
- package/dist/validator.d.ts.map +1 -1
- package/dist/validator.js +1 -30
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -89,6 +89,25 @@ new SparqlItemSelector({
|
|
|
89
89
|
});
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
+
#### Capping total results with `maxResults`
|
|
93
|
+
|
|
94
|
+
By default, `SparqlItemSelector` paginates through **all** matching rows: any `LIMIT` clause in the query is interpreted as the page size, then it walks pages with `OFFSET` until the source is exhausted. To cap the total bindings yielded across all pages — for sampling, testing, prototyping, or just safety — set `maxResults`:
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
new SparqlItemSelector({
|
|
98
|
+
query: 'SELECT DISTINCT ?s WHERE { ?s a <http://example.com/Class> }',
|
|
99
|
+
maxResults: 50,
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
When `maxResults` is set:
|
|
104
|
+
|
|
105
|
+
- Pagination stops as soon as `maxResults` bindings have been yielded — no wasted page request after the cap is hit.
|
|
106
|
+
- The last (partial) page's `LIMIT` is shrunk to the remaining cap so the endpoint doesn't over-fetch on the remainder (e.g. with `maxResults: 85` and `pageSize: 10`, the 9th page request is `LIMIT 5`, not `LIMIT 10`).
|
|
107
|
+
- The first page uses the configured page size as-is; `maxResults` and page size stay orthogonal. If `maxResults < pageSize`, the first page may return a few rows that aren't yielded.
|
|
108
|
+
- `maxResults: 0` is a valid no-op; the selector yields nothing without issuing any SPARQL request.
|
|
109
|
+
- `maxResults` is independent of any `LIMIT` clause in the query, which still controls page size when the cap is larger than one page.
|
|
110
|
+
|
|
92
111
|
For dynamic queries that depend on the distribution, implement `ItemSelector` directly:
|
|
93
112
|
|
|
94
113
|
```typescript
|
|
@@ -223,23 +242,7 @@ new Stage({
|
|
|
223
242
|
|
|
224
243
|
#### Per-dataset reporting
|
|
225
244
|
|
|
226
|
-
After all stages for a dataset have run, the pipeline calls `validator.report(dataset)` once for each distinct validator attached to any stage and emits a `datasetValidated(dataset, report)` event on the reporter. The call happens **regardless of whether any stage actually invoked `validate()`** —
|
|
227
|
-
|
|
228
|
-
#### `requireNonEmptyData`
|
|
229
|
-
|
|
230
|
-
A small generic decorator over any `Validator`. Wraps the inner validator so its dataset report flips to non-conforming when `quadsValidated === 0` for that dataset — i.e. no stage ever produced data for the validator to inspect.
|
|
231
|
-
|
|
232
|
-
```typescript
|
|
233
|
-
import { requireNonEmptyData } from '@lde/pipeline';
|
|
234
|
-
import { ShaclValidator } from '@lde/pipeline-shacl-validator';
|
|
235
|
-
|
|
236
|
-
const validator = requireNonEmptyData(
|
|
237
|
-
new ShaclValidator({ shapesFile: './shapes.ttl', reportDir: './validation' }),
|
|
238
|
-
{ message: 'No target class matched in this dataset.' },
|
|
239
|
-
);
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
The decorator is stateless; per-dataset accumulation stays in the inner validator.
|
|
245
|
+
After all stages for a dataset have run, the pipeline calls `validator.report(dataset)` once for each distinct validator attached to any stage and emits a `datasetValidated(dataset, report)` event on the reporter. The call happens **regardless of whether any stage actually invoked `validate()`** — for SHACL that means a dataset whose stages produced no input typically reports `quadsValidated: 0` and `conforms: true` (the SHACL vacuous-truth default). Consumers that want to distinguish ‘not tested’ from ‘tested and passed’ can read `quadsValidated`.
|
|
243
246
|
|
|
244
247
|
### Writer
|
|
245
248
|
|
|
@@ -36,9 +36,11 @@ export interface ProgressReporter {
|
|
|
36
36
|
/**
|
|
37
37
|
* Called once per (dataset, validator) pair after all stages for a dataset
|
|
38
38
|
* have run. Fires regardless of whether any stage actually invoked
|
|
39
|
-
* `validate()` — the report reflects the validator’s accumulated state
|
|
40
|
-
*
|
|
41
|
-
*
|
|
39
|
+
* `validate()` — the report reflects the validator’s accumulated state.
|
|
40
|
+
* When no stage produced data, the report typically carries
|
|
41
|
+
* `quadsValidated: 0` and `conforms: true` (the SHACL vacuous-truth
|
|
42
|
+
* default); consumers that want to distinguish ‘not tested’ from ‘tested
|
|
43
|
+
* and passed’ can read `quadsValidated`.
|
|
42
44
|
*/
|
|
43
45
|
datasetValidated?(dataset: Dataset, report: ValidationReport): void;
|
|
44
46
|
datasetComplete?(dataset: Dataset, result: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progressReporter.d.ts","sourceRoot":"","sources":["../src/progressReporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,WAAW,0BAA0B;IACzC,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,QAAQ,GAAG,WAAW,GAAG,eAAe,CAAC;IAC/C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,gBAAgB,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACzD,YAAY,CAAC,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,8DAA8D;IAC9D,kBAAkB,CAAC,CAAC,MAAM,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAC9D,6CAA6C;IAC7C,aAAa,CAAC,I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AAE,KAAK,GAAG,IAAI,CAAC;IAChD,YAAY,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACnD;;;;;;;;OAQG;IACH,gBAAgB,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACpE,eAAe,CAAC,CACd,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE;QAAE,gBAAgB,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,GAC1D,IAAI,CAAC;IACR,cAAc,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACxD,gBAAgB,CAAC,CAAC,MAAM,EAAE;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,gBAAgB,EAAE,MAAM,CAAC;QACzB,aAAa,EAAE,MAAM,CAAC;KACvB,GAAG,IAAI,CAAC;CACV"}
|
|
@@ -8,8 +8,19 @@ export interface SparqlItemSelectorOptions {
|
|
|
8
8
|
*
|
|
9
9
|
* A `LIMIT` clause in the query overrides the stage's `batchSize` as the
|
|
10
10
|
* page size — use this when the SPARQL endpoint enforces a result limit.
|
|
11
|
+
* It does **not** cap the total number of bindings the selector yields;
|
|
12
|
+
* pagination continues with `OFFSET` until the source is exhausted. Use
|
|
13
|
+
* {@link maxResults} to cap the total.
|
|
11
14
|
*/
|
|
12
15
|
query: string;
|
|
16
|
+
/**
|
|
17
|
+
* Maximum number of bindings the selector yields across all pages.
|
|
18
|
+
* Use this for sampling — “give me at most N items, don’t walk the full
|
|
19
|
+
* source”. Independent of {@link query}’s `LIMIT`, which controls page
|
|
20
|
+
* size. Pagination stops as soon as `maxResults` bindings have been
|
|
21
|
+
* yielded.
|
|
22
|
+
*/
|
|
23
|
+
maxResults?: number;
|
|
13
24
|
/** Custom fetcher instance. */
|
|
14
25
|
fetcher?: SparqlEndpointFetcher;
|
|
15
26
|
}
|
|
@@ -24,10 +35,17 @@ export interface SparqlItemSelectorOptions {
|
|
|
24
35
|
* 1. A `LIMIT` clause in the selector query (for endpoints with hard result limits)
|
|
25
36
|
* 2. The stage's {@link StageOptions.batchSize} (passed via {@link select})
|
|
26
37
|
* 3. A default of 10
|
|
38
|
+
*
|
|
39
|
+
* {@link SparqlItemSelectorOptions.maxResults} is independent of page size:
|
|
40
|
+
* it caps the *total* bindings yielded across pages without changing how
|
|
41
|
+
* the first page is requested. The last (partial) page’s `LIMIT` is
|
|
42
|
+
* shrunk to whatever’s left of the cap so the endpoint doesn’t over-fetch
|
|
43
|
+
* on the remainder.
|
|
27
44
|
*/
|
|
28
45
|
export declare class SparqlItemSelector implements ItemSelector {
|
|
29
46
|
private readonly parsed;
|
|
30
47
|
private readonly queryLimit?;
|
|
48
|
+
private readonly maxResults?;
|
|
31
49
|
private readonly fetcher;
|
|
32
50
|
constructor(options: SparqlItemSelectorOptions);
|
|
33
51
|
select(distribution: Distribution, batchSize?: number): AsyncIterableIterator<VariableBindings>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selector.d.ts","sourceRoot":"","sources":["../../src/sparql/selector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAQ9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAMtD,MAAM,WAAW,yBAAyB;IACxC
|
|
1
|
+
{"version":3,"file":"selector.d.ts","sourceRoot":"","sources":["../../src/sparql/selector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAQ9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAMtD,MAAM,WAAW,yBAAyB;IACxC;;;;;;;;OAQG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,qBAAqB,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IACrD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;gBAEpC,OAAO,EAAE,yBAAyB;IAmBvC,MAAM,CACX,YAAY,EAAE,YAAY,EAC1B,SAAS,CAAC,EAAE,MAAM,GACjB,qBAAqB,CAAC,gBAAgB,CAAC;CAyD3C"}
|
package/dist/sparql/selector.js
CHANGED
|
@@ -16,10 +16,17 @@ const F = new AstFactory();
|
|
|
16
16
|
* 1. A `LIMIT` clause in the selector query (for endpoints with hard result limits)
|
|
17
17
|
* 2. The stage's {@link StageOptions.batchSize} (passed via {@link select})
|
|
18
18
|
* 3. A default of 10
|
|
19
|
+
*
|
|
20
|
+
* {@link SparqlItemSelectorOptions.maxResults} is independent of page size:
|
|
21
|
+
* it caps the *total* bindings yielded across pages without changing how
|
|
22
|
+
* the first page is requested. The last (partial) page’s `LIMIT` is
|
|
23
|
+
* shrunk to whatever’s left of the cap so the endpoint doesn’t over-fetch
|
|
24
|
+
* on the remainder.
|
|
19
25
|
*/
|
|
20
26
|
export class SparqlItemSelector {
|
|
21
27
|
parsed;
|
|
22
28
|
queryLimit;
|
|
29
|
+
maxResults;
|
|
23
30
|
fetcher;
|
|
24
31
|
constructor(options) {
|
|
25
32
|
const parsed = parser.parse(options.query);
|
|
@@ -32,13 +39,24 @@ export class SparqlItemSelector {
|
|
|
32
39
|
}
|
|
33
40
|
this.parsed = parsed;
|
|
34
41
|
this.queryLimit = this.parsed.solutionModifiers.limitOffset?.limit;
|
|
42
|
+
this.maxResults = options.maxResults;
|
|
35
43
|
this.fetcher = options.fetcher ?? new SparqlEndpointFetcher();
|
|
36
44
|
}
|
|
37
45
|
async *select(distribution, batchSize) {
|
|
38
|
-
|
|
46
|
+
if (this.maxResults === 0)
|
|
47
|
+
return;
|
|
48
|
+
const basePageSize = this.queryLimit ?? batchSize ?? 10;
|
|
39
49
|
const endpoint = distribution.accessUrl;
|
|
40
50
|
let offset = 0;
|
|
51
|
+
let totalYielded = 0;
|
|
41
52
|
while (true) {
|
|
53
|
+
const remaining = this.maxResults !== undefined
|
|
54
|
+
? this.maxResults - totalYielded
|
|
55
|
+
: Infinity;
|
|
56
|
+
// The first page uses the configured page size as-is — keeps page-size
|
|
57
|
+
// and total-cap orthogonal. Subsequent pages clamp to `remaining` so
|
|
58
|
+
// the last (partial) page doesn’t over-fetch.
|
|
59
|
+
const effectivePageSize = offset === 0 ? basePageSize : Math.min(basePageSize, remaining);
|
|
42
60
|
this.parsed.solutionModifiers.limitOffset = F.solutionModifierLimitOffset(effectivePageSize, offset, F.gen());
|
|
43
61
|
const paginatedQuery = generator.generate(this.parsed);
|
|
44
62
|
const stream = (await this.fetcher.fetchBindings(endpoint.toString(), paginatedQuery));
|
|
@@ -48,6 +66,11 @@ export class SparqlItemSelector {
|
|
|
48
66
|
if (Object.keys(row).length > 0) {
|
|
49
67
|
yield row;
|
|
50
68
|
count++;
|
|
69
|
+
totalYielded++;
|
|
70
|
+
if (this.maxResults !== undefined &&
|
|
71
|
+
totalYielded >= this.maxResults) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
51
74
|
}
|
|
52
75
|
}
|
|
53
76
|
if (count === 0 || count < effectivePageSize) {
|
package/dist/validator.d.ts
CHANGED
|
@@ -18,26 +18,4 @@ export interface ValidationResult {
|
|
|
18
18
|
export interface ValidationReport extends ValidationResult {
|
|
19
19
|
quadsValidated: number;
|
|
20
20
|
}
|
|
21
|
-
/** Options for {@link requireNonEmptyData}. */
|
|
22
|
-
export interface RequireNonEmptyDataOptions {
|
|
23
|
-
/**
|
|
24
|
-
* Message attached to the synthesised non-conformance.
|
|
25
|
-
* @default 'Validator received no quads for this dataset.'
|
|
26
|
-
*/
|
|
27
|
-
message?: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Decorate a {@link Validator} so its dataset report flips to non-conforming
|
|
31
|
-
* when no quads were ever validated for that dataset.
|
|
32
|
-
*
|
|
33
|
-
* Useful when the upstream stages are expected to produce *some* data — for
|
|
34
|
-
* instance per-class samplers whose `ItemSelector` returns zero subjects for
|
|
35
|
-
* every target class. The decorator keeps the underlying validator’s
|
|
36
|
-
* semantics intact: it only synthesises an extra violation when
|
|
37
|
-
* {@link ValidationReport.quadsValidated} is `0`.
|
|
38
|
-
*
|
|
39
|
-
* The decorator is stateless; per-dataset accumulation stays in the
|
|
40
|
-
* underlying validator.
|
|
41
|
-
*/
|
|
42
|
-
export declare function requireNonEmptyData(inner: Validator, options?: RequireNonEmptyDataOptions): Validator;
|
|
43
21
|
//# sourceMappingURL=validator.d.ts.map
|
package/dist/validator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,wDAAwD;AACxD,MAAM,WAAW,SAAS;IACxB,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAErE,2DAA2D;IAC3D,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACrD;AAED,2CAA2C;AAC3C,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,+FAA+F;IAC/F,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,oDAAoD;AACpD,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,cAAc,EAAE,MAAM,CAAC;CACxB
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,wDAAwD;AACxD,MAAM,WAAW,SAAS;IACxB,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAErE,2DAA2D;IAC3D,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACrD;AAED,2CAA2C;AAC3C,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,+FAA+F;IAC/F,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,oDAAoD;AACpD,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,cAAc,EAAE,MAAM,CAAC;CACxB"}
|
package/dist/validator.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Decorate a {@link Validator} so its dataset report flips to non-conforming
|
|
3
|
-
* when no quads were ever validated for that dataset.
|
|
4
|
-
*
|
|
5
|
-
* Useful when the upstream stages are expected to produce *some* data — for
|
|
6
|
-
* instance per-class samplers whose `ItemSelector` returns zero subjects for
|
|
7
|
-
* every target class. The decorator keeps the underlying validator’s
|
|
8
|
-
* semantics intact: it only synthesises an extra violation when
|
|
9
|
-
* {@link ValidationReport.quadsValidated} is `0`.
|
|
10
|
-
*
|
|
11
|
-
* The decorator is stateless; per-dataset accumulation stays in the
|
|
12
|
-
* underlying validator.
|
|
13
|
-
*/
|
|
14
|
-
export function requireNonEmptyData(inner, options) {
|
|
15
|
-
const message = options?.message ?? 'Validator received no quads for this dataset.';
|
|
16
|
-
return {
|
|
17
|
-
validate: (quads, dataset) => inner.validate(quads, dataset),
|
|
18
|
-
async report(dataset) {
|
|
19
|
-
const innerReport = await inner.report(dataset);
|
|
20
|
-
if (innerReport.quadsValidated > 0)
|
|
21
|
-
return innerReport;
|
|
22
|
-
return {
|
|
23
|
-
conforms: false,
|
|
24
|
-
violations: innerReport.violations + 1,
|
|
25
|
-
quadsValidated: 0,
|
|
26
|
-
message,
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
}
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lde/pipeline",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/ldelements/lde.git",
|
|
6
6
|
"directory": "packages/pipeline"
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"@lde/sparql-server": "0.4.11",
|
|
32
32
|
"@rdfjs/types": "^2.0.1",
|
|
33
33
|
"@traqula/generator-sparql-1-1": "^1.1.1",
|
|
34
|
-
"@traqula/parser-sparql-1-1": "^1.
|
|
34
|
+
"@traqula/parser-sparql-1-1": "^1.1.1",
|
|
35
35
|
"@traqula/rules-sparql-1-1": "^1.1.0",
|
|
36
36
|
"fetch-sparql-endpoint": "^7.1.0",
|
|
37
37
|
"filenamify-url": "^4.0.0",
|
|
38
|
-
"is-network-error": "^1.3.
|
|
38
|
+
"is-network-error": "^1.3.2",
|
|
39
39
|
"n3": "^2.0.1",
|
|
40
40
|
"p-retry": "^8.0.0",
|
|
41
41
|
"rdf-string": "^2.0.1",
|