@lde/distribution-probe 0.1.0 → 0.1.3
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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/probe.d.ts +1 -5
- package/dist/probe.d.ts.map +1 -1
- package/dist/probe.js +2 -18
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { probe, NetworkError, SparqlProbeResult, DataDumpProbeResult, type ProbeResultType, } from './probe.js';
|
|
1
|
+
export { probe, NetworkError, SparqlProbeResult, DataDumpProbeResult, type ProbeOptions, type ProbeResultType, } from './probe.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC"}
|
package/dist/probe.d.ts
CHANGED
|
@@ -66,11 +66,7 @@ export type ProbeResultType = SparqlProbeResult | DataDumpProbeResult | NetworkE
|
|
|
66
66
|
* for small or unknown-size bodies).
|
|
67
67
|
*
|
|
68
68
|
* Returns a pure result object; never throws.
|
|
69
|
-
*
|
|
70
|
-
* @param distribution The distribution to probe.
|
|
71
|
-
* @param options Probe options. For back-compat, passing a `number` is
|
|
72
|
-
* equivalent to `{ timeoutMs: number }` and is deprecated.
|
|
73
69
|
*/
|
|
74
|
-
export declare function probe(distribution: Distribution, options?:
|
|
70
|
+
export declare function probe(distribution: Distribution, options?: ProbeOptions): Promise<ProbeResultType>;
|
|
75
71
|
export {};
|
|
76
72
|
//# sourceMappingURL=probe.d.ts.map
|
package/dist/probe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probe.d.ts","sourceRoot":"","sources":["../src/probe.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"probe.d.ts","sourceRoot":"","sources":["../src/probe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,YAAY,EAAE,MAAM,cAAc,CAAC;AAGnE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAKD;;GAEG;AACH,qBAAa,YAAY;aAEL,GAAG,EAAE,MAAM;aACX,OAAO,EAAE,MAAM;aACf,cAAc,EAAE,MAAM;gBAFtB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM;CAEzC;AAED;;GAEG;AACH,uBAAe,WAAW;aAUN,GAAG,EAAE,MAAM;IAT7B,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,YAAY,EAAE,IAAI,GAAG,IAAI,CAAQ;IACjD,SAAgB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,SAAgB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,SAAgB,QAAQ,EAAE,MAAM,EAAE,CAAM;IACxC,SAAgB,cAAc,EAAE,MAAM,CAAC;gBAGrB,GAAG,EAAE,MAAM,EAC3B,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,MAAM,EACtB,aAAa,GAAE,MAAM,GAAG,IAAW;IAa9B,SAAS,IAAI,OAAO;CAO5B;AAKD;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,SAAgB,mBAAmB,EAAE,MAAM,CAAC;gBAG1C,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,MAAM,EACtB,mBAAmB,EAAE,MAAM,EAC3B,aAAa,GAAE,MAAM,GAAG,IAAW;IAM5B,SAAS,IAAI,OAAO;CAM9B;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;IAClD,SAAgB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;gBAGhD,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,MAAM,EACtB,aAAa,GAAE,MAAM,GAAG,IAAW;CAQtC;AAED,MAAM,MAAM,eAAe,GACvB,iBAAiB,GACjB,mBAAmB,GACnB,YAAY,CAAC;AAIjB;;;;;;;;GAQG;AACH,wBAAsB,KAAK,CACzB,YAAY,EAAE,YAAY,EAC1B,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,eAAe,CAAC,CAkC1B"}
|
package/dist/probe.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { compressionMediaTypes } from '@lde/dataset';
|
|
1
2
|
import { Parser } from 'n3';
|
|
2
3
|
const DEFAULT_SPARQL_QUERY = 'SELECT * { ?s ?p ?o } LIMIT 1';
|
|
3
4
|
const DEFAULT_TIMEOUT_MS = 5000;
|
|
@@ -81,10 +82,6 @@ export class DataDumpProbeResult extends ProbeResult {
|
|
|
81
82
|
* for small or unknown-size bodies).
|
|
82
83
|
*
|
|
83
84
|
* Returns a pure result object; never throws.
|
|
84
|
-
*
|
|
85
|
-
* @param distribution The distribution to probe.
|
|
86
|
-
* @param options Probe options. For back-compat, passing a `number` is
|
|
87
|
-
* equivalent to `{ timeoutMs: number }` and is deprecated.
|
|
88
85
|
*/
|
|
89
86
|
export async function probe(distribution, options) {
|
|
90
87
|
const resolved = resolveOptions(options);
|
|
@@ -105,13 +102,6 @@ export async function probe(distribution, options) {
|
|
|
105
102
|
}
|
|
106
103
|
}
|
|
107
104
|
function resolveOptions(options) {
|
|
108
|
-
if (typeof options === 'number') {
|
|
109
|
-
return {
|
|
110
|
-
timeoutMs: options,
|
|
111
|
-
headers: new Headers(),
|
|
112
|
-
sparqlQuery: DEFAULT_SPARQL_QUERY,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
105
|
return {
|
|
116
106
|
timeoutMs: options?.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
117
107
|
headers: options?.headers ?? new Headers(),
|
|
@@ -274,12 +264,6 @@ function validateBody(body, contentType) {
|
|
|
274
264
|
}
|
|
275
265
|
return null;
|
|
276
266
|
}
|
|
277
|
-
/** Content types that indicate compression, not the RDF serialization format. */
|
|
278
|
-
const compressionTypes = new Set([
|
|
279
|
-
'application/gzip',
|
|
280
|
-
'application/x-gzip',
|
|
281
|
-
'application/octet-stream',
|
|
282
|
-
]);
|
|
283
267
|
/**
|
|
284
268
|
* Compare the declared MIME type from the dataset registry against the
|
|
285
269
|
* server's Content-Type header. Adds a warning when they disagree.
|
|
@@ -288,7 +272,7 @@ function checkContentTypeMismatch(result, declaredMimeType) {
|
|
|
288
272
|
if (!result.isSuccess() || !declaredMimeType || !result.contentType)
|
|
289
273
|
return;
|
|
290
274
|
const actual = result.contentType.split(';')[0].trim();
|
|
291
|
-
if (
|
|
275
|
+
if (compressionMediaTypes.has(actual))
|
|
292
276
|
return;
|
|
293
277
|
if (actual !== declaredMimeType) {
|
|
294
278
|
result.warnings.push(`Server Content-Type ${actual} does not match declared media type ${declaredMimeType}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lde/distribution-probe",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/ldelements/lde.git",
|
|
6
6
|
"directory": "packages/distribution-probe"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"!**/*.tsbuildinfo"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@lde/dataset": "0.7.
|
|
27
|
+
"@lde/dataset": "0.7.4",
|
|
28
28
|
"n3": "^2.0.1",
|
|
29
29
|
"tslib": "^2.3.0"
|
|
30
30
|
}
|