@pubid/pubid 0.1.51 → 0.1.53
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
CHANGED
|
Binary file
|
|
@@ -4,11 +4,13 @@ import { BaseIdentifier, registerType } from "../../model/identifier.js";
|
|
|
4
4
|
import { extendAttributes, keyValue } from "../../model/attribute.js";
|
|
5
5
|
import { BaseUrnGenerator } from "../../model/urn-generator.js";
|
|
6
6
|
/**
|
|
7
|
-
* 1:1 port of lib/pubid/iala/ —
|
|
8
|
-
* (S/R/G/M/C/
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* 1:1 port of lib/pubid/iala/ — 702 corpus rows. Typed prefixes
|
|
8
|
+
* (S/R/G/M/C/GA/L/X/P plus the legacy A session letter, which routes to
|
|
9
|
+
* GeneralAssembly — there is no Advice type, pubid#734), class-driven
|
|
10
|
+
* zero-padding (4 for S/R/G/M/C, 2+2 dotted for GA, verbatim for the
|
|
11
|
+
* rest), "Ed 2.0" and ":ed2.0" edition forms, (F) languages, and Annex
|
|
12
|
+
* wrappers. URN is the MRN form:
|
|
13
|
+
* urn:mrn:iala:pub:<lower-code>[:ed<n>][:<lang>].
|
|
12
14
|
*/
|
|
13
15
|
function buildRules() {
|
|
14
16
|
const rules = {};
|
|
@@ -104,23 +106,44 @@ const IALA_TYPES = [
|
|
|
104
106
|
{ kind: "guideline", letter: "G", numberWidth: 4 },
|
|
105
107
|
{ kind: "manual", letter: "M", numberWidth: 4 },
|
|
106
108
|
{ kind: "model-course", letter: "C", numberWidth: 4 },
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
// The A letter is GeneralAssembly's legacy session form, not a
|
|
110
|
+
// separate series: all 11 A-shaped primary docidentifiers in
|
|
111
|
+
// relaton-data-iala (A12-01, A13-01 through A13-04) are GA
|
|
112
|
+
// resolutions, the covers read "GA Resolution A12-01", and no
|
|
113
|
+
// Advice-series document exists in the catalogue (pubid#734).
|
|
114
|
+
{ kind: "general-assembly", letter: "GA", numberWidth: 2, dottedSegmentWidth: 2, typeLetterAliases: ["A"] },
|
|
109
115
|
{ kind: "letter", letter: "L" },
|
|
110
116
|
{ kind: "report", letter: "X" },
|
|
111
117
|
{ kind: "resolution", letter: "P" },
|
|
112
118
|
];
|
|
113
|
-
const TYPE_SPECS = new Map(IALA_TYPES.
|
|
119
|
+
const TYPE_SPECS = new Map(IALA_TYPES.flatMap((t) => [[t.letter, t]]
|
|
120
|
+
.concat((t.typeLetterAliases ?? []).map((a) => [a, t]))));
|
|
114
121
|
function ialaClass(spec) {
|
|
115
122
|
class IalaTypeIdentifier extends IalaIdentifier {
|
|
116
123
|
static polymorphicName = `pubid:iala:${spec.kind}`;
|
|
117
124
|
static urnGenerator = IalaUrnGenerator;
|
|
118
125
|
static typeLetter = spec.letter;
|
|
126
|
+
static typeLetterAliases = spec.typeLetterAliases ?? [];
|
|
127
|
+
}
|
|
128
|
+
if (spec.typeLetterAliases !== undefined) {
|
|
129
|
+
// The legacy A-session letter renders for dashed numbers (A12-01);
|
|
130
|
+
// dotted numbers carry the canonical GA letter. Derived from the
|
|
131
|
+
// number shape, no extra attribute is stored — mirrors the Ruby
|
|
132
|
+
// GeneralAssembly#type_letter override (pubid#734).
|
|
133
|
+
IalaTypeIdentifier.prototype.typeLetter = function () {
|
|
134
|
+
return (this.number ?? "").includes("-")
|
|
135
|
+
? spec.typeLetterAliases[0]
|
|
136
|
+
: this.constructor.typeLetter;
|
|
137
|
+
};
|
|
119
138
|
}
|
|
120
139
|
registerType(IalaTypeIdentifier);
|
|
121
140
|
return IalaTypeIdentifier;
|
|
122
141
|
}
|
|
123
|
-
const KIND_CLASSES = new Map(IALA_TYPES.
|
|
142
|
+
const KIND_CLASSES = new Map(IALA_TYPES.flatMap((spec) => {
|
|
143
|
+
const klass = ialaClass(spec);
|
|
144
|
+
return [[spec.letter, klass]]
|
|
145
|
+
.concat((spec.typeLetterAliases ?? []).map((a) => [a, klass]));
|
|
146
|
+
}));
|
|
124
147
|
export class IalaAnnex extends IalaIdentifier {
|
|
125
148
|
static polymorphicName = "pubid:iala:annex";
|
|
126
149
|
static attributes = extendAttributes(IalaIdentifier, {
|
|
@@ -43,32 +43,33 @@ export const TYPED_STAGES = [
|
|
|
43
43
|
TS("tec", "published", "tec", "Technology Report", "60.00"),
|
|
44
44
|
TS("sttr", "published", "sttr", "Trend Report", "60.00"),
|
|
45
45
|
TS("wp", "published", "wp", "White Paper", "60.00"),
|
|
46
|
-
// The draft ladders below mirror the gem
|
|
47
|
-
// TYPED_STAGES rows (lib/pubid/iec/identifiers/*.rb
|
|
48
|
-
// (deliverable, stage), `abbr` the canonical
|
|
49
|
-
// the render face prints, `tokens` the
|
|
50
|
-
//
|
|
51
|
-
// (renderer.rb: `id.typed_stage.abbr.first`
|
|
52
|
-
// typed_stage.code
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
// ADTR-family folding) stay on record; the gem is followed.
|
|
46
|
+
// The draft ladders below mirror the gem's per-deliverable
|
|
47
|
+
// TYPED_STAGES rows (lib/pubid/iec/identifiers/*.rb, at 2.0.35 —
|
|
48
|
+
// pubid#733): one row per (deliverable, stage), `abbr` the canonical
|
|
49
|
+
// (ruby abbr.first) spelling the render face prints, `tokens` the
|
|
50
|
+
// spellings the row accepts at parse. Each row renders its OWN
|
|
51
|
+
// spelling (renderer.rb: `id.typed_stage.abbr.first` — the #191/#193
|
|
52
|
+
// pattern) and the wire carries typed_stage.code, so "IEC ADTR 60038"
|
|
53
|
+
// renders "IEC ADTR 60038" and hashes stage "adtr"; only rows that
|
|
54
|
+
// genuinely fold several spellings onto one face normalize the render
|
|
55
|
+
// ("IEC PRF 60038" renders "IEC FDIS 60038" and hashes stage "fdis").
|
|
57
56
|
//
|
|
58
57
|
// `tokens` carry the spellings the gem's COMPILED grammar accepts
|
|
59
58
|
// (data/parg/iec.json), which is narrower than the registry's abbr
|
|
60
59
|
// lists: registry-only spellings (DEL, PRVN, AWI, DIS, ADIS, PCC,
|
|
61
60
|
// SPLIT, MERGED, CAN, RPUB, TPUB, DECPUB, SPE, and every PROJECT_STAGES
|
|
62
61
|
// name) are parse-rejected by the gem and stay out of the tokens.
|
|
63
|
-
// Resolution of a token is registry ORDER (ruby locate_stage scans
|
|
64
|
-
// TYPED_STAGES in order), so CDPAS resolves to :cdpas (30.00), never
|
|
65
|
-
// the :dpas row that also lists it, and DTSM — listed on the :dtr row —
|
|
66
|
-
// decodes onto the TR ladder, not :dts.
|
|
67
62
|
//
|
|
68
63
|
// The `harmonized` column is the gem's harmonized_stages.first (issue
|
|
69
64
|
// #187): the official URN stage slot writes `stage-<lead code>` and the
|
|
70
65
|
// URN parser resolves the slot back by (type, lead code). Published
|
|
71
|
-
// rows carry no harmonized: the slot is suppressed for them.
|
|
66
|
+
// rows carry no harmonized: the slot is suppressed for them. Row order
|
|
67
|
+
// follows the correspondence table, so the TR/TS shared 50.92 slots
|
|
68
|
+
// (NDTR/DTRM, NDTS/DTSM — IEC's table gives both spellings of each
|
|
69
|
+
// deliverable the same rejection code; the gem's pnw_stage_spec
|
|
70
|
+
// ALLOWED_COLLISIONS) reverse-resolve to the pair's FIRST row —
|
|
71
|
+
// tr-stage-50.92 decodes DTRM, ts-stage-50.92 decodes DTSM — while the
|
|
72
|
+
// pubid-scheme URN keeps the pair distinct (stage-ndtr vs stage-dtrm).
|
|
72
73
|
TS("pwi", "pwi", "is", "PWI", "00.00", ["PWI", "NWIP", "BWG", "AWIN", "AMW"]),
|
|
73
74
|
// PNW owns harmonized 10.20 (gem: NP stages are 10.00/10.60/… — the
|
|
74
75
|
// URN "stage-10.20" slot resolves to PNW, not NP; #187).
|
|
@@ -93,28 +94,42 @@ export const TYPED_STAGES = [
|
|
|
93
94
|
TS("anw_tr", "anw", "tr", "ANW TR", "10.99"),
|
|
94
95
|
TS("wd_tr", "wd", "tr", "WD TR", "20.20"),
|
|
95
96
|
TS("cd_tr", "cd", "tr", "CD TR", "30.00"),
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
|
|
97
|
+
// Plain DTR keeps the folded 50.00 ladder (the registration step); the
|
|
98
|
+
// point spellings below are rows of their own, each with the exact
|
|
99
|
+
// code IEC's stage-code correspondence table gives it (pubid#733, gem
|
|
100
|
+
// 2.0.35 — probed in-process: render/URN/pubid-URN/hash round-trip).
|
|
101
|
+
TS("dtr", "draft", "tr", "DTR", "50.00"),
|
|
102
|
+
TS("adtr", "draft", "tr", "ADTR", "40.99"),
|
|
103
|
+
TS("cdtr", "draft", "tr", "CDTR", "50.20"),
|
|
104
|
+
// NDTR and DTRM share the table's 50.92 rejection code: their
|
|
105
|
+
// official-URN slot is the same and the reverse lookup resolves the
|
|
106
|
+
// FIRST row (DTRM); the pubid-scheme URN keeps both codes.
|
|
107
|
+
TS("dtrm", "draft", "tr", "DTRM", "50.92"),
|
|
108
|
+
TS("ndtr", "draft", "tr", "NDTR", "50.92"),
|
|
100
109
|
// The TS ladder.
|
|
101
110
|
TS("pwi_ts", "pwi", "ts", "PWI TS", "00.00"),
|
|
102
111
|
TS("np_ts", "np", "ts", "NP TS", "10.00"),
|
|
103
112
|
TS("anw_ts", "anw", "ts", "ANW TS", "10.99"),
|
|
104
113
|
TS("wd_ts", "wd", "ts", "WD TS", "20.20"),
|
|
105
114
|
TS("cd_ts", "cd", "ts", "CD TS", "30.00"),
|
|
106
|
-
TS("dts", "draft", "ts", "DTS", "50.00"
|
|
115
|
+
TS("dts", "draft", "ts", "DTS", "50.00"),
|
|
116
|
+
TS("adts", "draft", "ts", "ADTS", "40.99"),
|
|
117
|
+
TS("cdts", "draft", "ts", "CDTS", "50.20"),
|
|
118
|
+
// The TS twin of the TR shared slot: NDTS and DTSM both carry 50.92,
|
|
119
|
+
// the reverse lookup resolves DTSM (the first row).
|
|
120
|
+
TS("dtsm", "draft", "ts", "DTSM", "50.92"),
|
|
121
|
+
TS("ndts", "draft", "ts", "NDTS", "50.92"),
|
|
107
122
|
// The PAS ladder.
|
|
108
123
|
TS("pwi_pas", "pwi", "pas", "PWI PAS", "00.00"),
|
|
109
124
|
TS("np_pas", "np", "pas", "NP PAS", "10.00"),
|
|
110
125
|
TS("anw_pas", "anw", "pas", "ANW PAS", "10.99"),
|
|
111
126
|
TS("wd_pas", "wd", "pas", "WD PAS", "20.20"),
|
|
112
|
-
// CDPAS is
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
TS("cdpas", "
|
|
117
|
-
TS("dpas", "draft", "pas", "DPAS", "50.00"
|
|
127
|
+
// CDPAS is PAS's 50.20 row of IEC's stage-code correspondence table
|
|
128
|
+
// ("Draft circulated as DPAS") — not a committee-draft state and
|
|
129
|
+
// claiming no 30.xx code: the fabricated 30.00 row and the CDPAS fold
|
|
130
|
+
// on the DPAS row's spellings are gone (pubid#733, gem 2.0.35).
|
|
131
|
+
TS("cdpas", "draft", "pas", "CDPAS", "50.20"),
|
|
132
|
+
TS("dpas", "draft", "pas", "DPAS", "50.00"),
|
|
118
133
|
// The Guide ladder (the two-token faces and the DGuide/FDGuide drafts).
|
|
119
134
|
TS("pwi_guide", "pwi", "guide", "PWI Guide", "00.00"),
|
|
120
135
|
TS("np_guide", "np", "guide", "NP Guide", "10.00"),
|
|
@@ -11,7 +11,6 @@ export const ialaSchema = define("iala", (s) => {
|
|
|
11
11
|
s.atom("language", "lang");
|
|
12
12
|
s.atom("annex_form", "annexform");
|
|
13
13
|
s.atom("letter", "letter");
|
|
14
|
-
s.type("pubid:iala:advice", "advice");
|
|
15
14
|
s.type("pubid:iala:annex", "annex");
|
|
16
15
|
s.type("pubid:iala:general-assembly", "ga");
|
|
17
16
|
s.type("pubid:iala:guideline", "g");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubid/pubid",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.53",
|
|
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",
|