@pubid/pubid 0.1.48 → 0.1.50
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.
|
@@ -2,7 +2,9 @@ import { match, str } from "../../grammar/engine.js";
|
|
|
2
2
|
import { stageTokens } from "./model.js";
|
|
3
3
|
/**
|
|
4
4
|
* Port of lib/pubid/iec/ on the unified model — 12,334 corpus rows
|
|
5
|
-
* across
|
|
5
|
+
* across 19 identifier types (16 corpus-backed, plus the three
|
|
6
|
+
* standalone deliverable types of #195: Technology Report, Trend
|
|
7
|
+
* Report, White Paper). The distinctive traits, all pinned against
|
|
6
8
|
* the Ruby reference:
|
|
7
9
|
* - typed stages: an abbreviation table (abbr -> {code, stageCode,
|
|
8
10
|
* typeCode}); "stage" serializes only the non-published stage CODE;
|
|
@@ -156,7 +156,12 @@ class IecBuilder {
|
|
|
156
156
|
buildSingle(tree) {
|
|
157
157
|
const stageAbbr = s(tree["type_with_stage"]) ?? s(tree["type_with_stage_fr"]) ?? "";
|
|
158
158
|
const typedStage = locateStage(stageAbbr) ?? locateStage("IS");
|
|
159
|
-
|
|
159
|
+
// The kind IS the type code: every IecTypeCode slot carries its own
|
|
160
|
+
// class now, including "wp" — the White Paper deliverable
|
|
161
|
+
// (pubid-ts#195), not the working document (which the work-programme
|
|
162
|
+
// and working-document builders construct through
|
|
163
|
+
// WORKING_DOCUMENT_CLASS directly).
|
|
164
|
+
const kind = typedStage.typeCode;
|
|
160
165
|
const attrs = {};
|
|
161
166
|
this.commonAttrs(tree, attrs);
|
|
162
167
|
// TRF with an embedded CISPR document: the form itself has no number
|
|
@@ -459,7 +464,7 @@ class IecBuilder {
|
|
|
459
464
|
const edition = s(tree["edition"]);
|
|
460
465
|
if (edition !== undefined)
|
|
461
466
|
attrs["edition"] = edition;
|
|
462
|
-
const identifier = new IEC_CLASSES.
|
|
467
|
+
const identifier = new IEC_CLASSES.WORKING_DOCUMENT_CLASS(attrs);
|
|
463
468
|
const ts = locateStage(s(tree["wp_stage"]) === "PNW" ? "PNW" : "PWI");
|
|
464
469
|
identifier.typedStage = ts;
|
|
465
470
|
if (ts !== undefined && ts.stageCode !== "published") {
|
|
@@ -476,7 +481,7 @@ class IecBuilder {
|
|
|
476
481
|
wd_language: s(tree["wd_language"]),
|
|
477
482
|
wd_stage: s(tree["wd_stage"]),
|
|
478
483
|
};
|
|
479
|
-
return new IEC_CLASSES.
|
|
484
|
+
return new IEC_CLASSES.WORKING_DOCUMENT_CLASS(attrs);
|
|
480
485
|
}
|
|
481
486
|
}
|
|
482
487
|
/** --- URN: the positional-slot machine (lib/pubid/iec/urn_generator.rb) --- */
|
|
@@ -645,6 +650,7 @@ class IecUrnGenerator {
|
|
|
645
650
|
}
|
|
646
651
|
for (const klass of [
|
|
647
652
|
...Object.values(IEC_CLASSES.KIND_CLASSES),
|
|
653
|
+
IEC_CLASSES.WORKING_DOCUMENT_CLASS,
|
|
648
654
|
IEC_CLASSES.SHEET_CLASS,
|
|
649
655
|
IEC_CLASSES.VAP_CLASS,
|
|
650
656
|
IEC_CLASSES.CONSOLIDATED_CLASS,
|
|
@@ -53,6 +53,7 @@ export declare abstract class IecIdentifier extends BaseIdentifier {
|
|
|
53
53
|
}
|
|
54
54
|
export declare const IEC_CLASSES: {
|
|
55
55
|
readonly KIND_CLASSES: Partial<Record<IecTypeCode, IdentifierStatic>>;
|
|
56
|
+
readonly WORKING_DOCUMENT_CLASS: IdentifierStatic;
|
|
56
57
|
readonly SHEET_CLASS: IdentifierStatic;
|
|
57
58
|
readonly VAP_CLASS: IdentifierStatic;
|
|
58
59
|
readonly CONSOLIDATED_CLASS: IdentifierStatic;
|
|
@@ -3,7 +3,15 @@ import { extendAttributes, keyValue } from "../../model/attribute.js";
|
|
|
3
3
|
import { Language, PubidDate, Iteration } from "../../model/component.js";
|
|
4
4
|
const TS = (code, stageCode, typeCode, abbr, harmonized, tokens) => ({ code, stageCode, typeCode, abbr, harmonized, tokens });
|
|
5
5
|
export const TYPED_STAGES = [
|
|
6
|
-
|
|
6
|
+
// The published IS row lists the publication-lifecycle spellings
|
|
7
|
+
// (BPUB, PPUB, APUB, WPUB, DELPUB, RR, …): they parse onto the
|
|
8
|
+
// published stage whose canonical abbr is "" — the abbreviation drops
|
|
9
|
+
// out of the render ("IEC BPUB 60038" -> "IEC 60038"). The leading ""
|
|
10
|
+
// keeps the grammar's empty type_with_stage match byte-identical with
|
|
11
|
+
// the pre-fold alternation (the bare published face's parse tree).
|
|
12
|
+
TS("is", "published", "is", "", undefined, [
|
|
13
|
+
"", "BPUB", "PPUB", "APUB", "WPUB", "DELPUB", "RR",
|
|
14
|
+
]),
|
|
7
15
|
TS("tr", "published", "tr", "TR"),
|
|
8
16
|
TS("ts", "published", "ts", "TS"),
|
|
9
17
|
TS("pas", "published", "pas", "PAS"),
|
|
@@ -21,48 +29,100 @@ export const TYPED_STAGES = [
|
|
|
21
29
|
// ComponentSpecification/ConformityAssessment.
|
|
22
30
|
TS("cs", "published", "cs", "CS"),
|
|
23
31
|
TS("ca", "published", "ca", "CA"),
|
|
24
|
-
// The
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
+
// The three standalone deliverable types (gem TechnologyReport /
|
|
33
|
+
// SocietalTechnologyTrendReport / WhitePaper, pubid-ts#195): one
|
|
34
|
+
// published row each, the full phrase the ONLY spelling the gem's
|
|
35
|
+
// grammar accepts ("IEC TECHNOLOGY REPORT", "IEC STTR", "IEC WP AAL"
|
|
36
|
+
// and every draft token (DTEC, CD Technology Report) reject — probed
|
|
37
|
+
// at 2.0.32). The abbreviation renders whole ("IEC Technology Report
|
|
38
|
+
// 62674:2019"); `harmonized` is the gem rows' lead code (60.00, the
|
|
39
|
+
// publication ladder) — inert on emission (published rows suppress
|
|
40
|
+
// the stage slot) and carried for the official-URN parser's
|
|
41
|
+
// `tec-stage-60.00`-style slot resolution, which the gem answers by
|
|
42
|
+
// (type, lead code).
|
|
43
|
+
TS("tec", "published", "tec", "Technology Report", "60.00"),
|
|
44
|
+
TS("sttr", "published", "sttr", "Trend Report", "60.00"),
|
|
45
|
+
TS("wp", "published", "wp", "White Paper", "60.00"),
|
|
46
|
+
// The draft ladders below mirror the gem 2.0.32 per-deliverable
|
|
47
|
+
// TYPED_STAGES rows (lib/pubid/iec/identifiers/*.rb): one row per
|
|
48
|
+
// (deliverable, stage), `abbr` the canonical (ruby abbr.first) spelling
|
|
49
|
+
// the render face prints, `tokens` the spellings the row accepts at
|
|
50
|
+
// parse. The gem's render normalizes every spelling onto abbr.first
|
|
51
|
+
// (renderer.rb: `id.typed_stage.abbr.first`) and its wire carries
|
|
52
|
+
// typed_stage.code — so a folded spelling parses, renders and
|
|
53
|
+
// serializes AS its row's canonical twin ("IEC PRF 60038" renders
|
|
54
|
+
// "IEC FDIS 60038" and hashes stage "fdis"). The gem-vs-SSOT
|
|
55
|
+
// contradictions recorded in #189/#190 (CDPAS 30.00-vs-50.20, the
|
|
56
|
+
// ADTR-family folding) stay on record; the gem is followed.
|
|
57
|
+
//
|
|
58
|
+
// `tokens` carry the spellings the gem's COMPILED grammar accepts
|
|
59
|
+
// (data/parg/iec.json), which is narrower than the registry's abbr
|
|
60
|
+
// lists: registry-only spellings (DEL, PRVN, AWI, DIS, ADIS, PCC,
|
|
61
|
+
// SPLIT, MERGED, CAN, RPUB, TPUB, DECPUB, SPE, and every PROJECT_STAGES
|
|
62
|
+
// 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
|
+
//
|
|
68
|
+
// The `harmonized` column is the gem's harmonized_stages.first (issue
|
|
69
|
+
// #187): the official URN stage slot writes `stage-<lead code>` and the
|
|
70
|
+
// URN parser resolves the slot back by (type, lead code). Published
|
|
71
|
+
// rows carry no harmonized: the slot is suppressed for them.
|
|
72
|
+
TS("pwi", "pwi", "is", "PWI", "00.00", ["PWI", "NWIP", "BWG", "AWIN", "AMW"]),
|
|
32
73
|
// PNW owns harmonized 10.20 (gem: NP stages are 10.00/10.60/… — the
|
|
33
|
-
// URN "stage-10.20" slot resolves to PNW, not NP).
|
|
34
|
-
TS("np", "np", "is", "NP", "10.00"),
|
|
74
|
+
// URN "stage-10.20" slot resolves to PNW, not NP; #187).
|
|
75
|
+
TS("np", "np", "is", "NP", "10.00", ["NP"]),
|
|
35
76
|
TS("pnw", "pnw", "is", "PNW", "10.20"),
|
|
36
|
-
TS("
|
|
37
|
-
TS("anw", "anw", "is", "ANW", "10.99"),
|
|
77
|
+
TS("anw", "anw", "is", "ANW", "10.99", ["ANW"]),
|
|
38
78
|
TS("wd", "wd", "is", "WD", "20.20"),
|
|
39
|
-
TS("cd", "cd", "is", "CD", "30.00"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
TS("
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
TS("
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
TS
|
|
59
|
-
TS("
|
|
60
|
-
|
|
61
|
-
TS("
|
|
62
|
-
TS("
|
|
63
|
-
TS("
|
|
64
|
-
TS("
|
|
65
|
-
TS("
|
|
79
|
+
TS("cd", "cd", "is", "CD", "30.00", [
|
|
80
|
+
"CD", "2CD", "3CD", "4CD", "5CD", "6CD", "7CD", "8CD", "9CD",
|
|
81
|
+
"ACD", "A2CD", "A3CD", "A4CD", "A5CD", "A6CD", "A7CD", "A8CD", "A9CD",
|
|
82
|
+
"CDM",
|
|
83
|
+
]),
|
|
84
|
+
TS("cdv", "cdv", "is", "CDV", "40.00", ["CDV", "ACDV", "CCDV", "CDVM", "NCDV"]),
|
|
85
|
+
TS("fdis", "fdis", "is", "FDIS", "50.00", [
|
|
86
|
+
"FDIS", "PRF", "NFDIS", "NADIS", "RDISH", "RFDIS", "CFDIS",
|
|
87
|
+
]),
|
|
88
|
+
// The TR ladder — the two-token faces ("IEC CD TR 62048") are the
|
|
89
|
+
// per-deliverable rows' spellings, each decoding onto its own typed
|
|
90
|
+
// stage with the deliverable's type code.
|
|
91
|
+
TS("pwi_tr", "pwi", "tr", "PWI TR", "00.00"),
|
|
92
|
+
TS("np_tr", "np", "tr", "NP TR", "10.00"),
|
|
93
|
+
TS("anw_tr", "anw", "tr", "ANW TR", "10.99"),
|
|
94
|
+
TS("wd_tr", "wd", "tr", "WD TR", "20.20"),
|
|
95
|
+
TS("cd_tr", "cd", "tr", "CD TR", "30.00"),
|
|
96
|
+
// The whole draft-spelling family folds onto :dtr (ruby abbr.first
|
|
97
|
+
// "DTR"); DTSM rides the :dtr row in the gem's registry even though the
|
|
98
|
+
// spelling names the TS deliverable's rejected stage — mirrored.
|
|
99
|
+
TS("dtr", "draft", "tr", "DTR", "50.00", ["DTR", "ADTR", "CDTR", "DTRM", "NDTR", "DTSM"]),
|
|
100
|
+
// The TS ladder.
|
|
101
|
+
TS("pwi_ts", "pwi", "ts", "PWI TS", "00.00"),
|
|
102
|
+
TS("np_ts", "np", "ts", "NP TS", "10.00"),
|
|
103
|
+
TS("anw_ts", "anw", "ts", "ANW TS", "10.99"),
|
|
104
|
+
TS("wd_ts", "wd", "ts", "WD TS", "20.20"),
|
|
105
|
+
TS("cd_ts", "cd", "ts", "CD TS", "30.00"),
|
|
106
|
+
TS("dts", "draft", "ts", "DTS", "50.00", ["DTS", "ADTS", "CDTS", "NDTS"]),
|
|
107
|
+
// The PAS ladder.
|
|
108
|
+
TS("pwi_pas", "pwi", "pas", "PWI PAS", "00.00"),
|
|
109
|
+
TS("np_pas", "np", "pas", "NP PAS", "10.00"),
|
|
110
|
+
TS("anw_pas", "anw", "pas", "ANW PAS", "10.99"),
|
|
111
|
+
TS("wd_pas", "wd", "pas", "WD PAS", "20.20"),
|
|
112
|
+
// CDPAS is the committee-draft PAS row (lead 30.00) — the gem's
|
|
113
|
+
// :cdpas registry row wins over :dpas's spelling by order. The
|
|
114
|
+
// SSOT table (data/iec/stage-codes.md) names CDPAS 50.20: the
|
|
115
|
+
// recorded gem-vs-SSOT contradiction stands (owner's call).
|
|
116
|
+
TS("cdpas", "cd", "pas", "CDPAS", "30.00"),
|
|
117
|
+
TS("dpas", "draft", "pas", "DPAS", "50.00", ["DPAS", "CDPAS"]),
|
|
118
|
+
// The Guide ladder (the two-token faces and the DGuide/FDGuide drafts).
|
|
119
|
+
TS("pwi_guide", "pwi", "guide", "PWI Guide", "00.00"),
|
|
120
|
+
TS("np_guide", "np", "guide", "NP Guide", "10.00"),
|
|
121
|
+
TS("anw_guide", "anw", "guide", "ANW Guide", "10.99"),
|
|
122
|
+
TS("wd_guide", "wd", "guide", "WD Guide", "20.20"),
|
|
123
|
+
TS("cd_guide", "cd", "guide", "CD Guide", "30.00"),
|
|
124
|
+
TS("dguide", "draft", "guide", "DGuide", "40.00"),
|
|
125
|
+
TS("fdguide", "final_draft", "guide", "FDGuide", "50.00", ["FDGuide", "PRF Guide"]),
|
|
66
126
|
// The DAM family's ballot stages carry the CIRCULATION slots as the
|
|
67
127
|
// lead harmonized code (30.20/50.20), not ISO's 30.00/50.00 — CDAM/
|
|
68
128
|
// FDAM keep those (type, leading code) URN keys (gem Amendment
|
|
@@ -128,9 +188,11 @@ const TYPE_NAMES = {
|
|
|
128
188
|
trf: "test-report-form",
|
|
129
189
|
amd: "amendment",
|
|
130
190
|
cor: "corrigendum",
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
191
|
+
// The three standalone deliverable types (gem TechnologyReport /
|
|
192
|
+
// SocietalTechnologyTrendReport / WhitePaper, pubid-ts#195).
|
|
193
|
+
tec: "technology-report",
|
|
194
|
+
wp: "white-paper",
|
|
195
|
+
sttr: "societal-technology-trend-report",
|
|
134
196
|
};
|
|
135
197
|
// The shared single-document attribute table (SingleIdentifier seam).
|
|
136
198
|
const SINGLE_ATTRS = {
|
|
@@ -594,12 +656,28 @@ function iecFragmentClass() {
|
|
|
594
656
|
registerType(IecFragmentIdentifier);
|
|
595
657
|
return IecFragmentIdentifier;
|
|
596
658
|
}
|
|
597
|
-
|
|
659
|
+
// The three standalone deliverable types (pubid-ts#195) are plain
|
|
660
|
+
// single-document classes: the gem's TechnologyReport /
|
|
661
|
+
// SocietalTechnologyTrendReport / WhitePaper all sit on the
|
|
662
|
+
// SingleIdentifier chain and take the full designation (number, part,
|
|
663
|
+
// subpart, date, edition, languages, database) — probed at 2.0.32
|
|
664
|
+
// ("IEC Technology Report 62674-1-2:2019", "IEC White Paper AAL-1",
|
|
665
|
+
// "IEC Trend Report 63090 DB").
|
|
666
|
+
const SINGLE_KINDS = [
|
|
667
|
+
"is", "tr", "ts", "pas", "srd", "od", "guide", "cs", "ca",
|
|
668
|
+
"tec", "sttr", "wp",
|
|
669
|
+
];
|
|
670
|
+
// The working-document class (the PNW/PWI work-programme forms and the
|
|
671
|
+
// committee documents "1/2457/FDIS") is keyed by the working-document
|
|
672
|
+
// _type, NOT by the "wp" type code — "wp" is the WhitePaper deliverable's
|
|
673
|
+
// type code in the gem, and the type-code dispatch (IecBuilder#buildSingle)
|
|
674
|
+
// routes it to the white-paper class. The working-document builders
|
|
675
|
+
// construct through this handle directly.
|
|
676
|
+
const WORKING_DOCUMENT_CLASS = iecWorkingDocumentClass();
|
|
598
677
|
const KIND_CLASSES = {};
|
|
599
678
|
for (const kind of SINGLE_KINDS) {
|
|
600
679
|
KIND_CLASSES[kind] = iecSingleClass(kind);
|
|
601
680
|
}
|
|
602
|
-
KIND_CLASSES["wp"] = iecWorkingDocumentClass();
|
|
603
681
|
KIND_CLASSES["trf"] = iecTrfClass();
|
|
604
682
|
KIND_CLASSES["amd"] = iecSupplementClass("amendment");
|
|
605
683
|
KIND_CLASSES["cor"] = iecSupplementClass("corrigendum");
|
|
@@ -610,6 +688,7 @@ const CONSOLIDATED_CLASS = iecConsolidatedClass();
|
|
|
610
688
|
const FRAGMENT_CLASS = iecFragmentClass();
|
|
611
689
|
export const IEC_CLASSES = {
|
|
612
690
|
KIND_CLASSES,
|
|
691
|
+
WORKING_DOCUMENT_CLASS,
|
|
613
692
|
SHEET_CLASS,
|
|
614
693
|
VAP_CLASS,
|
|
615
694
|
CONSOLIDATED_CLASS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubid/pubid",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.50",
|
|
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",
|