@pubid/pubid 0.1.32 → 0.1.34
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/artifact/corpus.json.gz +0 -0
- package/dist/conformance/implementation.d.ts +4 -0
- package/dist/flavors/bsi/model.js +13 -9
- package/dist/implementations/corpus-mode.d.ts +3 -0
- package/dist/implementations/corpus-mode.js +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/model/identifier.d.ts +6 -0
- package/dist/model/identifier.js +11 -0
- package/dist/pubid-urn/decoder.d.ts +27 -0
- package/dist/pubid-urn/decoder.js +165 -0
- package/dist/pubid-urn/encoder.d.ts +30 -0
- package/dist/pubid-urn/encoder.js +197 -0
- package/dist/pubid-urn/errors.d.ts +15 -0
- package/dist/pubid-urn/errors.js +21 -0
- package/dist/pubid-urn/escape.d.ts +19 -0
- package/dist/pubid-urn/escape.js +65 -0
- package/dist/pubid-urn/index.d.ts +65 -0
- package/dist/pubid-urn/index.js +216 -0
- package/dist/pubid-urn/paths.d.ts +26 -0
- package/dist/pubid-urn/paths.js +129 -0
- package/dist/pubid-urn/schema.d.ts +88 -0
- package/dist/pubid-urn/schema.js +186 -0
- package/dist/pubid-urn/schemas/adobe.d.ts +8 -0
- package/dist/pubid-urn/schemas/adobe.js +15 -0
- package/dist/pubid-urn/schemas/amca.d.ts +8 -0
- package/dist/pubid-urn/schemas/amca.js +19 -0
- package/dist/pubid-urn/schemas/ansi.d.ts +8 -0
- package/dist/pubid-urn/schemas/ansi.js +30 -0
- package/dist/pubid-urn/schemas/api.d.ts +8 -0
- package/dist/pubid-urn/schemas/api.js +25 -0
- package/dist/pubid-urn/schemas/ashrae.d.ts +8 -0
- package/dist/pubid-urn/schemas/ashrae.js +28 -0
- package/dist/pubid-urn/schemas/asme.d.ts +8 -0
- package/dist/pubid-urn/schemas/asme.js +26 -0
- package/dist/pubid-urn/schemas/astm.d.ts +8 -0
- package/dist/pubid-urn/schemas/astm.js +38 -0
- package/dist/pubid-urn/schemas/bipm.d.ts +8 -0
- package/dist/pubid-urn/schemas/bipm.js +34 -0
- package/dist/pubid-urn/schemas/bsi.d.ts +8 -0
- package/dist/pubid-urn/schemas/bsi.js +98 -0
- package/dist/pubid-urn/schemas/calconnect.d.ts +8 -0
- package/dist/pubid-urn/schemas/calconnect.js +16 -0
- package/dist/pubid-urn/schemas/ccsds.d.ts +8 -0
- package/dist/pubid-urn/schemas/ccsds.js +18 -0
- package/dist/pubid-urn/schemas/cencenelec.d.ts +8 -0
- package/dist/pubid-urn/schemas/cencenelec.js +39 -0
- package/dist/pubid-urn/schemas/cie.d.ts +8 -0
- package/dist/pubid-urn/schemas/cie.js +41 -0
- package/dist/pubid-urn/schemas/csa.d.ts +8 -0
- package/dist/pubid-urn/schemas/csa.js +45 -0
- package/dist/pubid-urn/schemas/doi.d.ts +8 -0
- package/dist/pubid-urn/schemas/doi.js +14 -0
- package/dist/pubid-urn/schemas/easc.d.ts +8 -0
- package/dist/pubid-urn/schemas/easc.js +16 -0
- package/dist/pubid-urn/schemas/ecma.d.ts +8 -0
- package/dist/pubid-urn/schemas/ecma.js +17 -0
- package/dist/pubid-urn/schemas/etsi.d.ts +8 -0
- package/dist/pubid-urn/schemas/etsi.js +23 -0
- package/dist/pubid-urn/schemas/evs.d.ts +8 -0
- package/dist/pubid-urn/schemas/evs.js +30 -0
- package/dist/pubid-urn/schemas/gb.d.ts +8 -0
- package/dist/pubid-urn/schemas/gb.js +18 -0
- package/dist/pubid-urn/schemas/gost.d.ts +8 -0
- package/dist/pubid-urn/schemas/gost.js +23 -0
- package/dist/pubid-urn/schemas/iala.d.ts +8 -0
- package/dist/pubid-urn/schemas/iala.js +26 -0
- package/dist/pubid-urn/schemas/iana.d.ts +8 -0
- package/dist/pubid-urn/schemas/iana.js +13 -0
- package/dist/pubid-urn/schemas/idf.d.ts +8 -0
- package/dist/pubid-urn/schemas/idf.js +34 -0
- package/dist/pubid-urn/schemas/iec.d.ts +8 -0
- package/dist/pubid-urn/schemas/iec.js +55 -0
- package/dist/pubid-urn/schemas/ieee.d.ts +8 -0
- package/dist/pubid-urn/schemas/ieee.js +116 -0
- package/dist/pubid-urn/schemas/ietf.d.ts +8 -0
- package/dist/pubid-urn/schemas/ietf.js +17 -0
- package/dist/pubid-urn/schemas/iho.d.ts +8 -0
- package/dist/pubid-urn/schemas/iho.js +35 -0
- package/dist/pubid-urn/schemas/index.d.ts +9 -0
- package/dist/pubid-urn/schemas/index.js +97 -0
- package/dist/pubid-urn/schemas/isbn.d.ts +8 -0
- package/dist/pubid-urn/schemas/isbn.js +14 -0
- package/dist/pubid-urn/schemas/iso.d.ts +8 -0
- package/dist/pubid-urn/schemas/iso.js +46 -0
- package/dist/pubid-urn/schemas/itu.d.ts +8 -0
- package/dist/pubid-urn/schemas/itu.js +61 -0
- package/dist/pubid-urn/schemas/jcgm.d.ts +8 -0
- package/dist/pubid-urn/schemas/jcgm.js +21 -0
- package/dist/pubid-urn/schemas/jis.d.ts +8 -0
- package/dist/pubid-urn/schemas/jis.js +24 -0
- package/dist/pubid-urn/schemas/nist.d.ts +8 -0
- package/dist/pubid-urn/schemas/nist.js +90 -0
- package/dist/pubid-urn/schemas/oasis.d.ts +8 -0
- package/dist/pubid-urn/schemas/oasis.js +17 -0
- package/dist/pubid-urn/schemas/ogc.d.ts +8 -0
- package/dist/pubid-urn/schemas/ogc.js +14 -0
- package/dist/pubid-urn/schemas/oiml.d.ts +8 -0
- package/dist/pubid-urn/schemas/oiml.js +39 -0
- package/dist/pubid-urn/schemas/omg.d.ts +8 -0
- package/dist/pubid-urn/schemas/omg.js +15 -0
- package/dist/pubid-urn/schemas/plateau.d.ts +8 -0
- package/dist/pubid-urn/schemas/plateau.js +20 -0
- package/dist/pubid-urn/schemas/sae.d.ts +8 -0
- package/dist/pubid-urn/schemas/sae.js +18 -0
- package/dist/pubid-urn/schemas/tgpp.d.ts +8 -0
- package/dist/pubid-urn/schemas/tgpp.js +17 -0
- package/dist/pubid-urn/schemas/un.d.ts +8 -0
- package/dist/pubid-urn/schemas/un.js +13 -0
- package/dist/pubid-urn/schemas/w3c.d.ts +8 -0
- package/dist/pubid-urn/schemas/w3c.js +23 -0
- package/dist/pubid-urn/schemas/xsf.d.ts +8 -0
- package/dist/pubid-urn/schemas/xsf.js +12 -0
- package/dist/pubid-urn/slug.d.ts +20 -0
- package/dist/pubid-urn/slug.js +47 -0
- package/package.json +2 -1
- package/vendor/parg/nist.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of OGC — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ogcSchema: import("../schema.js").FlavorSchema;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of OGC — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
import { define } from "../index.js";
|
|
9
|
+
export const ogcSchema = define("ogc", (s) => {
|
|
10
|
+
s.atom("year", "year");
|
|
11
|
+
s.atom("revision", "rev");
|
|
12
|
+
s.type("pubid:ogc:document", "document");
|
|
13
|
+
s.type("pubid:ogc:identifier", "id");
|
|
14
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of OIML — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
export declare const oimlSchema: import("../schema.js").FlavorSchema;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of OIML — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
import { define } from "../index.js";
|
|
9
|
+
export const oimlSchema = define("oiml", (s) => {
|
|
10
|
+
s.atom("publisher", "pub");
|
|
11
|
+
s.atom("part", "part");
|
|
12
|
+
s.atom("year", "year");
|
|
13
|
+
s.atom("edition", "ed");
|
|
14
|
+
s.atom("stage", "stage");
|
|
15
|
+
s.atom("language", "lang");
|
|
16
|
+
s.atom("amendment", "amendment");
|
|
17
|
+
s.atom("family", "family");
|
|
18
|
+
s.atom("iteration", "iteration");
|
|
19
|
+
s.atom("letter", "letter");
|
|
20
|
+
s.atom("trailing", "trailing", "bool");
|
|
21
|
+
s.atom("first", "first", "id");
|
|
22
|
+
s.atom("second", "second", "id");
|
|
23
|
+
s.facet("parsed_format", "format");
|
|
24
|
+
s.facet("space_separator", "sp", "bool");
|
|
25
|
+
s.type("pubid:oiml:amendment", "amd");
|
|
26
|
+
s.type("pubid:oiml:annex", "annex");
|
|
27
|
+
s.type("pubid:oiml:basic-publication", "bp");
|
|
28
|
+
s.type("pubid:oiml:bulletin", "bulletin");
|
|
29
|
+
s.type("pubid:oiml:certification-system", "cs");
|
|
30
|
+
s.type("pubid:oiml:document", "document");
|
|
31
|
+
s.type("pubid:oiml:dual-published", "dp", { core: [] });
|
|
32
|
+
s.type("pubid:oiml:errata", "err");
|
|
33
|
+
s.type("pubid:oiml:expert-report", "er");
|
|
34
|
+
s.type("pubid:oiml:guide", "guide");
|
|
35
|
+
s.type("pubid:oiml:identifier", "id", { core: [] });
|
|
36
|
+
s.type("pubid:oiml:recommendation", "rec");
|
|
37
|
+
s.type("pubid:oiml:seminar-report", "sr");
|
|
38
|
+
s.type("pubid:oiml:vocabulary", "v");
|
|
39
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of OMG — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
export declare const omgSchema: import("../schema.js").FlavorSchema;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of OMG — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
import { define } from "../index.js";
|
|
9
|
+
export const omgSchema = define("omg", (s) => {
|
|
10
|
+
s.atom("part", "part");
|
|
11
|
+
s.atom("version", "v");
|
|
12
|
+
s.atom("acronym", "acronym");
|
|
13
|
+
s.type("pubid:omg:identifier", "id", { core: [] });
|
|
14
|
+
s.type("pubid:omg:specification", "spec", { core: [] });
|
|
15
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of PLATEAU — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
export declare const plateauSchema: import("../schema.js").FlavorSchema;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of PLATEAU — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
import { define } from "../index.js";
|
|
9
|
+
export const plateauSchema = define("plateau", (s) => {
|
|
10
|
+
s.atom("publisher", "pub");
|
|
11
|
+
s.atom("edition", "ed");
|
|
12
|
+
s.atom("annex", "annex", "int");
|
|
13
|
+
s.type("pubid:plateau:annex", "annex", {
|
|
14
|
+
core: [],
|
|
15
|
+
atoms: [["letter", "letter"]],
|
|
16
|
+
});
|
|
17
|
+
s.type("pubid:plateau:handbook", "hb", { core: [["number", "int"]] });
|
|
18
|
+
s.type("pubid:plateau:identifier", "id", { core: [["number", "int"]] });
|
|
19
|
+
s.type("pubid:plateau:technical-report", "tr", { core: [["number", "int"]] });
|
|
20
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of SAE — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
export declare const saeSchema: import("../schema.js").FlavorSchema;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of SAE — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
import { define } from "../index.js";
|
|
9
|
+
export const saeSchema = define("sae", (s) => {
|
|
10
|
+
s.atom("type.abbr", "typeabbr");
|
|
11
|
+
s.atom("revision", "rev");
|
|
12
|
+
s.atom("amendment", "amd");
|
|
13
|
+
s.atom("part", "part");
|
|
14
|
+
s.atom("date.year", "year", "int");
|
|
15
|
+
s.atom("date.month", "month", "int");
|
|
16
|
+
s.atom("year", "yearflat");
|
|
17
|
+
s.type("pubid:sae:identifier", "id");
|
|
18
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of 3GPP — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
export declare const tgppSchema: import("../schema.js").FlavorSchema;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of 3GPP — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
import { define } from "../index.js";
|
|
9
|
+
export const tgppSchema = define("3gpp", (s) => {
|
|
10
|
+
s.atom("parts", "part", "list");
|
|
11
|
+
s.atom("version", "v");
|
|
12
|
+
s.atom("release", "release");
|
|
13
|
+
s.atom("suffix", "suffix");
|
|
14
|
+
s.type("pubid:3gpp:identifier", "id");
|
|
15
|
+
s.type("pubid:3gpp:technical-report", "tr");
|
|
16
|
+
s.type("pubid:3gpp:technical-specification", "ts");
|
|
17
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of UN — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
export declare const unSchema: import("../schema.js").FlavorSchema;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of UN — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
import { define } from "../index.js";
|
|
9
|
+
export const unSchema = define("un", (s) => {
|
|
10
|
+
s.atom("path", "path", "list");
|
|
11
|
+
s.type("pubid:un:document", "document");
|
|
12
|
+
s.type("pubid:un:identifier", "id");
|
|
13
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of W3C — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
export declare const w3cSchema: import("../schema.js").FlavorSchema;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of W3C — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
import { define } from "../index.js";
|
|
9
|
+
export const w3cSchema = define("w3c", (s) => {
|
|
10
|
+
s.atom("date", "date");
|
|
11
|
+
s.type("pubid:w3c:candidate-recommendation", "cr");
|
|
12
|
+
s.type("pubid:w3c:candidate-recommendation-draft", "crd");
|
|
13
|
+
s.type("pubid:w3c:draft-note", "dn");
|
|
14
|
+
s.type("pubid:w3c:identifier", "id");
|
|
15
|
+
s.type("pubid:w3c:note", "note");
|
|
16
|
+
s.type("pubid:w3c:obsolete-recommendation", "or");
|
|
17
|
+
s.type("pubid:w3c:proposed-edited-recommendation", "per");
|
|
18
|
+
s.type("pubid:w3c:proposed-recommendation", "pr");
|
|
19
|
+
s.type("pubid:w3c:recommendation", "rec");
|
|
20
|
+
s.type("pubid:w3c:standard", "std");
|
|
21
|
+
s.type("pubid:w3c:superseded-recommendation", "sr");
|
|
22
|
+
s.type("pubid:w3c:working-draft", "wd");
|
|
23
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of XSF — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
export declare const xsfSchema: import("../schema.js").FlavorSchema;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of XSF — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
import { define } from "../index.js";
|
|
9
|
+
export const xsfSchema = define("xsf", (s) => {
|
|
10
|
+
s.type("pubid:xsf:identifier", "id");
|
|
11
|
+
s.type("pubid:xsf:xep", "xep");
|
|
12
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The slug form (relaton#441): the URN wearing HTTP-path clothes — the
|
|
3
|
+
* TS mirror of Pubid::PubidUrn.to_slug/from_slug.
|
|
4
|
+
*
|
|
5
|
+
* Each ":" segment becomes a "/" segment, after the "urn:pubid:" prefix
|
|
6
|
+
* is cut — "urn:pubid:iso:is:9001:year-2015" is "iso/is/9001/year-2015".
|
|
7
|
+
* The contract's path-safety gate guarantees no segment carries a "/",
|
|
8
|
+
* so the transform is bijective: {@linkcode fromSlug} rebuilds the exact
|
|
9
|
+
* URN. The flat form is the flat `/`-joined string, fit for filenames.
|
|
10
|
+
*/
|
|
11
|
+
import type { BaseIdentifier } from "../model/identifier.js";
|
|
12
|
+
/** The slug of an identifier or of its pubid-scheme URN, with no leading
|
|
13
|
+
* or trailing "/". A String input must be a canonical pubid-scheme URN.
|
|
14
|
+
* @raise UrnParseError when a String is not a canonical pubid-scheme URN. */
|
|
15
|
+
export declare function toSlug(source: BaseIdentifier | string): string;
|
|
16
|
+
/** The slug parse side: "/"-joined segments rebuild the URN and parse
|
|
17
|
+
* through the canonical gate, so a slug of a landed flavor round-trips
|
|
18
|
+
* by toHash exactly like its URN.
|
|
19
|
+
* @raise UrnParseError for a malformed, unknown or non-canonical slug. */
|
|
20
|
+
export declare function fromSlug(slug: string): BaseIdentifier;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The slug form (relaton#441): the URN wearing HTTP-path clothes — the
|
|
3
|
+
* TS mirror of Pubid::PubidUrn.to_slug/from_slug.
|
|
4
|
+
*
|
|
5
|
+
* Each ":" segment becomes a "/" segment, after the "urn:pubid:" prefix
|
|
6
|
+
* is cut — "urn:pubid:iso:is:9001:year-2015" is "iso/is/9001/year-2015".
|
|
7
|
+
* The contract's path-safety gate guarantees no segment carries a "/",
|
|
8
|
+
* so the transform is bijective: {@linkcode fromSlug} rebuilds the exact
|
|
9
|
+
* URN. The flat form is the flat `/`-joined string, fit for filenames.
|
|
10
|
+
*/
|
|
11
|
+
import { PREFIX, generate, parse } from "./index.js";
|
|
12
|
+
import { InvalidInputError, UrnParseError } from "./errors.js";
|
|
13
|
+
import { MAX_LENGTH } from "./index.js";
|
|
14
|
+
/** The slug of an identifier or of its pubid-scheme URN, with no leading
|
|
15
|
+
* or trailing "/". A String input must be a canonical pubid-scheme URN.
|
|
16
|
+
* @raise UrnParseError when a String is not a canonical pubid-scheme URN. */
|
|
17
|
+
export function toSlug(source) {
|
|
18
|
+
let urn;
|
|
19
|
+
if (typeof source === "string") {
|
|
20
|
+
parse(source);
|
|
21
|
+
urn = source;
|
|
22
|
+
}
|
|
23
|
+
else if (source !== null && typeof source === "object" && typeof source.toHash === "function") {
|
|
24
|
+
urn = generate(source.toHash());
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
throw new InvalidInputError("to_slug takes an identifier or a pubid-scheme URN string");
|
|
28
|
+
}
|
|
29
|
+
return urn.slice(PREFIX.length).replaceAll(":", "/");
|
|
30
|
+
}
|
|
31
|
+
/** The slug parse side: "/"-joined segments rebuild the URN and parse
|
|
32
|
+
* through the canonical gate, so a slug of a landed flavor round-trips
|
|
33
|
+
* by toHash exactly like its URN.
|
|
34
|
+
* @raise UrnParseError for a malformed, unknown or non-canonical slug. */
|
|
35
|
+
export function fromSlug(slug) {
|
|
36
|
+
if (typeof slug !== "string") {
|
|
37
|
+
throw new InvalidInputError("input is not a String");
|
|
38
|
+
}
|
|
39
|
+
if (slug.length > MAX_LENGTH) {
|
|
40
|
+
throw new InvalidInputError(`slug exceeds ${MAX_LENGTH} characters`);
|
|
41
|
+
}
|
|
42
|
+
// ruby split("/", -1): trailing separators make empty segments too.
|
|
43
|
+
if (slug.split("/").some((segment) => segment === "")) {
|
|
44
|
+
throw new UrnParseError("slug has empty segments");
|
|
45
|
+
}
|
|
46
|
+
return parse(PREFIX + slug.replaceAll("/", ":"));
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubid/pubid",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
4
|
"description": "TypeScript PubID identifiers: resolution, normalization and canonical hashes for every identifier in the pubid-testsuite corpus (41 standards bodies), with a conformance runner mirroring the Ruby reference",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"build": "tsc -p tsconfig.json",
|
|
14
14
|
"test": "tsc -p tsconfig.test.json && node --test dist-test/test/*.test.js",
|
|
15
15
|
"conformance": "tsc -p tsconfig.json && node dist/conformance/cli.js",
|
|
16
|
+
"probe:urn": "node scripts/probe-pubid-urn.mjs",
|
|
16
17
|
"prepublishOnly": "tsc -p tsconfig.json",
|
|
17
18
|
"artifact": "tsc -p tsconfig.json && node scripts/build-artifact.mjs",
|
|
18
19
|
"doc:api": "node scripts/api-reference.mjs"
|