@pubid/pubid 0.1.47 → 0.1.48

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;
@@ -21,29 +21,48 @@ export const TYPED_STAGES = [
21
21
  // ComponentSpecification/ConformityAssessment.
22
22
  TS("cs", "published", "cs", "CS"),
23
23
  TS("ca", "published", "ca", "CA"),
24
+ // The `harmonized` column is the gem's harmonized_stages.first (pubid
25
+ // 2.0.32, verified in-process — issue #187): the official URN stage slot
26
+ // writes `stage-<lead code>` and the URN parser resolves the slot back
27
+ // by (type, lead code). The draft supplement rows (dcor/fdcor/cdish/
28
+ // dish) stay code-less: their stages ride the supplement layer, and the
29
+ // official URN reads the ROOT's stage — a published base or a
30
+ // stage-less synthetic one — so the gem never writes these codes into
31
+ // the slot.
24
32
  // PNW owns harmonized 10.20 (gem: NP stages are 10.00/10.60/… — the
25
33
  // URN "stage-10.20" slot resolves to PNW, not NP).
26
- TS("np", "np", "is", "NP"),
34
+ TS("np", "np", "is", "NP", "10.00"),
27
35
  TS("pnw", "pnw", "is", "PNW", "10.20"),
28
36
  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"),
37
+ TS("anw", "anw", "is", "ANW", "10.99"),
38
+ TS("wd", "wd", "is", "WD", "20.20"),
39
+ TS("cd", "cd", "is", "CD", "30.00"),
40
+ TS("cdv", "cdv", "is", "CDV", "40.00"),
33
41
  TS("fdis", "fdis", "is", "FDIS", "50.00"),
34
- TS("prf", "prf", "is", "PRF"),
42
+ // The gem registers PRF as an abbreviation of :fdis (lead 50.00) — it
43
+ // has no typed stage of its own; the row stays for the render face and
44
+ // takes fdis's lead code (the gem's parse even renders FDIS).
45
+ TS("prf", "prf", "is", "PRF", "50.00"),
46
+ // BPUB/PPUB are publication-lifecycle abbreviations of the published
47
+ // IS in the gem (stage_code published, slot suppressed) — the rows
48
+ // stay for the render face and carry no harmonized, so the slot
49
+ // falls through empty.
35
50
  TS("bpub", "bpub", "is", "BPUB"),
36
51
  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"),
52
+ // The gem folds the whole draft-spelling family of each typed
53
+ // deliverable onto ONE typed stage (ADTR/CDTR/NDTR are :dtr
54
+ // abbreviations, lead 50.00) — every row takes that lead code; the
55
+ // spellings stay for the render face.
56
+ TS("dtr", "dtr", "tr", "DTR", "50.00"),
57
+ TS("adtr", "adtr", "tr", "ADTR", "50.00"),
58
+ TS("cdtr", "cdtr", "tr", "CDTR", "50.00"),
59
+ TS("ndtr", "ndtr", "tr", "NDTR", "50.00"),
60
+ TS("dts", "dts", "ts", "DTS", "50.00"),
61
+ TS("adts", "adts", "ts", "ADTS", "50.00"),
62
+ TS("cdts", "cdts", "ts", "CDTS", "50.00"),
63
+ TS("ndts", "ndts", "ts", "NDTS", "50.00"),
64
+ TS("dpas", "dpas", "pas", "DPAS", "50.00"),
65
+ TS("cdpas", "cdpas", "pas", "CDPAS", "30.00"),
47
66
  // The DAM family's ballot stages carry the CIRCULATION slots as the
48
67
  // lead harmonized code (30.20/50.20), not ISO's 30.00/50.00 — CDAM/
49
68
  // 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.48",
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",