@pubid/pubid 0.1.49 → 0.1.51

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.
Binary file
@@ -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 16 identifier types. The distinctive traits, all pinned against
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
- const kind = typedStage.typeCode === "wp" ? "is" : typedStage.typeCode;
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.KIND_CLASSES["wp"](attrs);
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.KIND_CLASSES["wp"](attrs);
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;
@@ -29,6 +29,20 @@ export const TYPED_STAGES = [
29
29
  // ComponentSpecification/ConformityAssessment.
30
30
  TS("cs", "published", "cs", "CS"),
31
31
  TS("ca", "published", "ca", "CA"),
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"),
32
46
  // The draft ladders below mirror the gem 2.0.32 per-deliverable
33
47
  // TYPED_STAGES rows (lib/pubid/iec/identifiers/*.rb): one row per
34
48
  // (deliverable, stage), `abbr` the canonical (ruby abbr.first) spelling
@@ -174,9 +188,11 @@ const TYPE_NAMES = {
174
188
  trf: "test-report-form",
175
189
  amd: "amendment",
176
190
  cor: "corrigendum",
177
- tec: undefined,
178
- wp: undefined,
179
- sttr: undefined,
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",
180
196
  };
181
197
  // The shared single-document attribute table (SingleIdentifier seam).
182
198
  const SINGLE_ATTRS = {
@@ -640,12 +656,28 @@ function iecFragmentClass() {
640
656
  registerType(IecFragmentIdentifier);
641
657
  return IecFragmentIdentifier;
642
658
  }
643
- const SINGLE_KINDS = ["is", "tr", "ts", "pas", "srd", "od", "guide", "cs", "ca"];
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();
644
677
  const KIND_CLASSES = {};
645
678
  for (const kind of SINGLE_KINDS) {
646
679
  KIND_CLASSES[kind] = iecSingleClass(kind);
647
680
  }
648
- KIND_CLASSES["wp"] = iecWorkingDocumentClass();
649
681
  KIND_CLASSES["trf"] = iecTrfClass();
650
682
  KIND_CLASSES["amd"] = iecSupplementClass("amendment");
651
683
  KIND_CLASSES["cor"] = iecSupplementClass("corrigendum");
@@ -656,6 +688,7 @@ const CONSOLIDATED_CLASS = iecConsolidatedClass();
656
688
  const FRAGMENT_CLASS = iecFragmentClass();
657
689
  export const IEC_CLASSES = {
658
690
  KIND_CLASSES,
691
+ WORKING_DOCUMENT_CLASS,
659
692
  SHEET_CLASS,
660
693
  VAP_CLASS,
661
694
  CONSOLIDATED_CLASS,
@@ -4,7 +4,7 @@ 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
- * Port of lib/pubid/jis/ on the unified model — 10,555 corpus rows.
7
+ * Port of lib/pubid/jis/ on the unified model — 10,575 corpus rows.
8
8
  * "JIS[ TR|TS] <series> <number>[-parts][:year[R]][(E|J)][(規格群)]
9
9
  * [/AMD|EXPL|CORRIGENDUM …] [SYMBOL <value>]". Full-width Japanese
10
10
  * separators parse and normalize; year is an INTEGER in the hash; the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pubid/pubid",
3
- "version": "0.1.49",
3
+ "version": "0.1.51",
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",