@pubid/pubid 0.1.25 → 0.1.27

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.
@@ -426,6 +426,11 @@ function parseIsoUrn(urn) {
426
426
  if (parts[0] !== undefined && URN_TYPE_TOKENS.has(parts[0].toLowerCase())) {
427
427
  typeCode = parts.shift().toLowerCase();
428
428
  }
429
+ // RFC 5141 requires docnumber -- "urn:iso:std:iso" is not a valid
430
+ // NSS, and building it silently produced the identity-free "ISO "
431
+ // (mirrors lib/pubid/iso/urn_parser.rb)
432
+ if (parts.length === 0)
433
+ throw new Error(`missing docnumber: ${urn}`);
429
434
  let [number, part, subpart] = parseUrnNumberPart(parts.shift());
430
435
  let year;
431
436
  if (/^\d{4}$/.test(parts[0] ?? ""))
@@ -602,7 +607,11 @@ function parseIsoUrn(urn) {
602
607
  : supp.type?.toUpperCase() ?? supp.stage.toUpperCase();
603
608
  }
604
609
  if (supp.type !== undefined && suppTree["type_with_stage"] === undefined) {
605
- suppTree["type_with_stage"] = supp.type.toUpperCase();
610
+ // "sup" is the generic Supplement (type key "suppl") -- the raw
611
+ // "SUP" resolves the Directives Supplement row, whose render needs
612
+ // the supplement_publisher a guide chain never has
613
+ const typeToken = supp.type === "sup" ? "SUPPL" : supp.type.toUpperCase();
614
+ suppTree["type_with_stage"] = typeToken;
606
615
  }
607
616
  if (supp.number !== undefined)
608
617
  suppTree["number"] = supp.number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pubid/pubid",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
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",