@lde/pipeline 0.33.3 → 0.33.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.
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/namespaceAlias.d.ts +28 -0
- package/dist/namespaceAlias.d.ts.map +1 -0
- package/dist/namespaceAlias.js +28 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declares that two namespaces should be treated as equivalent, working
|
|
3
|
+
* around vocabularies that publish under both HTTP and HTTPS variants of the
|
|
4
|
+
* same IRI (notably schema.org).
|
|
5
|
+
*/
|
|
6
|
+
export interface NamespaceAlias {
|
|
7
|
+
/**
|
|
8
|
+
* The namespace IRIs should be normalized to (e.g. `https://schema.org/`).
|
|
9
|
+
*/
|
|
10
|
+
canonical: string;
|
|
11
|
+
/**
|
|
12
|
+
* The equivalent namespace that may appear in source data (e.g.
|
|
13
|
+
* `http://schema.org/`).
|
|
14
|
+
*/
|
|
15
|
+
alias: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Rewrite an IRI in an alias namespace to its canonical form. IRIs outside
|
|
19
|
+
* every alias namespace are returned unchanged.
|
|
20
|
+
*/
|
|
21
|
+
export declare function canonicalizeIri(iri: string, namespaceAliases: readonly NamespaceAlias[]): string;
|
|
22
|
+
/**
|
|
23
|
+
* All equivalent forms of an IRI under the given aliases: the IRI itself
|
|
24
|
+
* plus, when it falls in a canonical or alias namespace, the counterpart in
|
|
25
|
+
* the other namespace.
|
|
26
|
+
*/
|
|
27
|
+
export declare function aliasVariants(iri: string, namespaceAliases: readonly NamespaceAlias[]): string[];
|
|
28
|
+
//# sourceMappingURL=namespaceAlias.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespaceAlias.d.ts","sourceRoot":"","sources":["../src/namespaceAlias.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,gBAAgB,EAAE,SAAS,cAAc,EAAE,GAC1C,MAAM,CAOR;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,gBAAgB,EAAE,SAAS,cAAc,EAAE,GAC1C,MAAM,EAAE,CAUV"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rewrite an IRI in an alias namespace to its canonical form. IRIs outside
|
|
3
|
+
* every alias namespace are returned unchanged.
|
|
4
|
+
*/
|
|
5
|
+
export function canonicalizeIri(iri, namespaceAliases) {
|
|
6
|
+
for (const { canonical, alias } of namespaceAliases) {
|
|
7
|
+
if (iri.startsWith(alias)) {
|
|
8
|
+
return canonical + iri.slice(alias.length);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return iri;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* All equivalent forms of an IRI under the given aliases: the IRI itself
|
|
15
|
+
* plus, when it falls in a canonical or alias namespace, the counterpart in
|
|
16
|
+
* the other namespace.
|
|
17
|
+
*/
|
|
18
|
+
export function aliasVariants(iri, namespaceAliases) {
|
|
19
|
+
for (const { canonical, alias } of namespaceAliases) {
|
|
20
|
+
if (iri.startsWith(canonical)) {
|
|
21
|
+
return [iri, alias + iri.slice(canonical.length)];
|
|
22
|
+
}
|
|
23
|
+
if (iri.startsWith(alias)) {
|
|
24
|
+
return [iri, canonical + iri.slice(alias.length)];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return [iri];
|
|
28
|
+
}
|