@pubid/pubid 0.1.47 → 0.1.49

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.
@@ -603,8 +603,12 @@ export function iecToUrn(identifier) {
603
603
  const dateSlot = date !== undefined ? (date.render() ?? "") : "";
604
604
  const ts = docWithNumber.typedStage;
605
605
  const typeToken = ts !== undefined && TYPE_SLOT_CODES.has(ts.typeCode) ? ts.typeCode : "";
606
- const stageToken = ts !== undefined && ts.stageCode !== "published"
607
- ? `stage-${ts.harmonized ?? ts.stageCode}`
606
+ // The gem's stage_token (urn_generator.rb): nil when the stage is
607
+ // published OR when the typed stage carries no harmonized code — there
608
+ // is NO stage-code fallback, so a harmonized-less draft row (BPUB,
609
+ // the draft-supplement rows) leaves the slot empty (#187).
610
+ const stageToken = ts !== undefined && ts.stageCode !== "published" && ts.harmonized !== undefined
611
+ ? `stage-${ts.harmonized}`
608
612
  : "";
609
613
  const stageOrType = [typeToken, stageToken].filter((t) => t !== "").join("-");
610
614
  const vap = findDown(identifier, "vap");
@@ -12,7 +12,13 @@ export interface TypedStage {
12
12
  stageCode: string;
13
13
  typeCode: IecTypeCode;
14
14
  abbr: string;
15
- /** Harmonized stage code for the URN "stage-…" slot (drafts only). */
15
+ /**
16
+ * The typed stage's lead harmonized code — the gem's
17
+ * `harmonized_stages.first`, which the official URN's stage slot writes
18
+ * ("stage-30.00") and the URN parser resolves back by (type, code).
19
+ * Absent = the gem's empty `harmonized_stages`: the slot stays EMPTY,
20
+ * never a stage-code fallback (#187).
21
+ */
16
22
  harmonized?: string | undefined;
17
23
  /** Grammar tokens that resolve to this stage (defaults to [abbr]). */
18
24
  tokens?: string[] | undefined;
@@ -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
- TS("is", "published", "is", ""),
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,29 +29,86 @@ export const TYPED_STAGES = [
21
29
  // ComponentSpecification/ConformityAssessment.
22
30
  TS("cs", "published", "cs", "CS"),
23
31
  TS("ca", "published", "ca", "CA"),
32
+ // The draft ladders below mirror the gem 2.0.32 per-deliverable
33
+ // TYPED_STAGES rows (lib/pubid/iec/identifiers/*.rb): one row per
34
+ // (deliverable, stage), `abbr` the canonical (ruby abbr.first) spelling
35
+ // the render face prints, `tokens` the spellings the row accepts at
36
+ // parse. The gem's render normalizes every spelling onto abbr.first
37
+ // (renderer.rb: `id.typed_stage.abbr.first`) and its wire carries
38
+ // typed_stage.code — so a folded spelling parses, renders and
39
+ // serializes AS its row's canonical twin ("IEC PRF 60038" renders
40
+ // "IEC FDIS 60038" and hashes stage "fdis"). The gem-vs-SSOT
41
+ // contradictions recorded in #189/#190 (CDPAS 30.00-vs-50.20, the
42
+ // ADTR-family folding) stay on record; the gem is followed.
43
+ //
44
+ // `tokens` carry the spellings the gem's COMPILED grammar accepts
45
+ // (data/parg/iec.json), which is narrower than the registry's abbr
46
+ // lists: registry-only spellings (DEL, PRVN, AWI, DIS, ADIS, PCC,
47
+ // SPLIT, MERGED, CAN, RPUB, TPUB, DECPUB, SPE, and every PROJECT_STAGES
48
+ // name) are parse-rejected by the gem and stay out of the tokens.
49
+ // Resolution of a token is registry ORDER (ruby locate_stage scans
50
+ // TYPED_STAGES in order), so CDPAS resolves to :cdpas (30.00), never
51
+ // the :dpas row that also lists it, and DTSM — listed on the :dtr row —
52
+ // decodes onto the TR ladder, not :dts.
53
+ //
54
+ // The `harmonized` column is the gem's harmonized_stages.first (issue
55
+ // #187): the official URN stage slot writes `stage-<lead code>` and the
56
+ // URN parser resolves the slot back by (type, lead code). Published
57
+ // rows carry no harmonized: the slot is suppressed for them.
58
+ TS("pwi", "pwi", "is", "PWI", "00.00", ["PWI", "NWIP", "BWG", "AWIN", "AMW"]),
24
59
  // PNW owns harmonized 10.20 (gem: NP stages are 10.00/10.60/… — the
25
- // URN "stage-10.20" slot resolves to PNW, not NP).
26
- TS("np", "np", "is", "NP"),
60
+ // URN "stage-10.20" slot resolves to PNW, not NP; #187).
61
+ TS("np", "np", "is", "NP", "10.00", ["NP"]),
27
62
  TS("pnw", "pnw", "is", "PNW", "10.20"),
28
- TS("pwi", "pwi", "is", "PWI", "00.00"),
29
- TS("anw", "anw", "is", "ANW"),
30
- TS("wd", "wd", "is", "WD"),
31
- TS("cd", "cd", "is", "CD", "30.20"),
32
- TS("cdv", "cdv", "is", "CDV", "40.20"),
33
- TS("fdis", "fdis", "is", "FDIS", "50.00"),
34
- TS("prf", "prf", "is", "PRF"),
35
- TS("bpub", "bpub", "is", "BPUB"),
36
- TS("ppub", "ppub", "is", "PPUB"),
37
- TS("dtr", "dtr", "tr", "DTR"),
38
- TS("adtr", "adtr", "tr", "ADTR"),
39
- TS("cdtr", "cdtr", "tr", "CDTR"),
40
- TS("ndtr", "ndtr", "tr", "NDTR"),
41
- TS("dts", "dts", "ts", "DTS"),
42
- TS("adts", "adts", "ts", "ADTS"),
43
- TS("cdts", "cdts", "ts", "CDTS"),
44
- TS("ndts", "ndts", "ts", "NDTS"),
45
- TS("dpas", "dpas", "pas", "DPAS"),
46
- TS("cdpas", "cdpas", "pas", "CDPAS"),
63
+ TS("anw", "anw", "is", "ANW", "10.99", ["ANW"]),
64
+ TS("wd", "wd", "is", "WD", "20.20"),
65
+ TS("cd", "cd", "is", "CD", "30.00", [
66
+ "CD", "2CD", "3CD", "4CD", "5CD", "6CD", "7CD", "8CD", "9CD",
67
+ "ACD", "A2CD", "A3CD", "A4CD", "A5CD", "A6CD", "A7CD", "A8CD", "A9CD",
68
+ "CDM",
69
+ ]),
70
+ TS("cdv", "cdv", "is", "CDV", "40.00", ["CDV", "ACDV", "CCDV", "CDVM", "NCDV"]),
71
+ TS("fdis", "fdis", "is", "FDIS", "50.00", [
72
+ "FDIS", "PRF", "NFDIS", "NADIS", "RDISH", "RFDIS", "CFDIS",
73
+ ]),
74
+ // The TR ladder — the two-token faces ("IEC CD TR 62048") are the
75
+ // per-deliverable rows' spellings, each decoding onto its own typed
76
+ // stage with the deliverable's type code.
77
+ TS("pwi_tr", "pwi", "tr", "PWI TR", "00.00"),
78
+ TS("np_tr", "np", "tr", "NP TR", "10.00"),
79
+ TS("anw_tr", "anw", "tr", "ANW TR", "10.99"),
80
+ TS("wd_tr", "wd", "tr", "WD TR", "20.20"),
81
+ TS("cd_tr", "cd", "tr", "CD TR", "30.00"),
82
+ // The whole draft-spelling family folds onto :dtr (ruby abbr.first
83
+ // "DTR"); DTSM rides the :dtr row in the gem's registry even though the
84
+ // spelling names the TS deliverable's rejected stage — mirrored.
85
+ TS("dtr", "draft", "tr", "DTR", "50.00", ["DTR", "ADTR", "CDTR", "DTRM", "NDTR", "DTSM"]),
86
+ // The TS ladder.
87
+ TS("pwi_ts", "pwi", "ts", "PWI TS", "00.00"),
88
+ TS("np_ts", "np", "ts", "NP TS", "10.00"),
89
+ TS("anw_ts", "anw", "ts", "ANW TS", "10.99"),
90
+ TS("wd_ts", "wd", "ts", "WD TS", "20.20"),
91
+ TS("cd_ts", "cd", "ts", "CD TS", "30.00"),
92
+ TS("dts", "draft", "ts", "DTS", "50.00", ["DTS", "ADTS", "CDTS", "NDTS"]),
93
+ // The PAS ladder.
94
+ TS("pwi_pas", "pwi", "pas", "PWI PAS", "00.00"),
95
+ TS("np_pas", "np", "pas", "NP PAS", "10.00"),
96
+ TS("anw_pas", "anw", "pas", "ANW PAS", "10.99"),
97
+ TS("wd_pas", "wd", "pas", "WD PAS", "20.20"),
98
+ // CDPAS is the committee-draft PAS row (lead 30.00) — the gem's
99
+ // :cdpas registry row wins over :dpas's spelling by order. The
100
+ // SSOT table (data/iec/stage-codes.md) names CDPAS 50.20: the
101
+ // recorded gem-vs-SSOT contradiction stands (owner's call).
102
+ TS("cdpas", "cd", "pas", "CDPAS", "30.00"),
103
+ TS("dpas", "draft", "pas", "DPAS", "50.00", ["DPAS", "CDPAS"]),
104
+ // The Guide ladder (the two-token faces and the DGuide/FDGuide drafts).
105
+ TS("pwi_guide", "pwi", "guide", "PWI Guide", "00.00"),
106
+ TS("np_guide", "np", "guide", "NP Guide", "10.00"),
107
+ TS("anw_guide", "anw", "guide", "ANW Guide", "10.99"),
108
+ TS("wd_guide", "wd", "guide", "WD Guide", "20.20"),
109
+ TS("cd_guide", "cd", "guide", "CD Guide", "30.00"),
110
+ TS("dguide", "draft", "guide", "DGuide", "40.00"),
111
+ TS("fdguide", "final_draft", "guide", "FDGuide", "50.00", ["FDGuide", "PRF Guide"]),
47
112
  // The DAM family's ballot stages carry the CIRCULATION slots as the
48
113
  // lead harmonized code (30.20/50.20), not ISO's 30.00/50.00 — CDAM/
49
114
  // FDAM keep those (type, leading code) URN keys (gem Amendment
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pubid/pubid",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
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",