@pubid/pubid 0.1.44 → 0.1.45

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
@@ -35,6 +35,11 @@ export declare abstract class CenIdentifier extends BaseIdentifier {
35
35
  root(): CenIdentifier;
36
36
  toUrn(): string;
37
37
  }
38
+ /** MR string of a nested iso/iec document read from its wire hash.
39
+ * Exported for the cen_pfs port: the compiled flavor's fused-URN segment
40
+ * is the adopted document's MR string, the same computation the coded
41
+ * flavor performs. */
42
+ export declare function mrFromHash(hash: Record<string, unknown>): string;
38
43
  export declare const CEN_DOCUMENT_CLASSES: Map<string, IdentifierStatic>;
39
44
  export declare const CenelecHarmonizationDocumentClass: IdentifierStatic;
40
45
  export declare const AmendmentClass: IdentifierStatic;
@@ -197,8 +197,11 @@ const ISO_TYPE_SEGMENT = {
197
197
  "technical-report": "tr",
198
198
  guide: "guide",
199
199
  };
200
- /** MR string of a nested iso/iec document read from its wire hash. */
201
- function mrFromHash(hash) {
200
+ /** MR string of a nested iso/iec document read from its wire hash.
201
+ * Exported for the cen_pfs port: the compiled flavor's fused-URN segment
202
+ * is the adopted document's MR string, the same computation the coded
203
+ * flavor performs. */
204
+ export function mrFromHash(hash) {
202
205
  const type = String(hash["_type"] ?? "");
203
206
  const segments = [];
204
207
  if (type.startsWith("pubid:iso")) {
@@ -0,0 +1,151 @@
1
+ import type { FlavorImplementation } from "../../conformance/implementation.js";
2
+ import { BaseIdentifier } from "../../model/identifier.js";
3
+ import type { IdentifierStatic } from "../../model/identifier.js";
4
+ import { type FieldMapping } from "../../model/attribute.js";
5
+ import { PubidDate } from "../../model/component.js";
6
+ import { BaseUrnGenerator } from "../../model/urn-generator.js";
7
+ /**
8
+ * The PFS-compiled cen flavor (pubid/pubid#706; the cen_pfs full
9
+ * absorption is pubid-grammar#121 + pubid#721's regeneration) — one
10
+ * definition file, both engines: the grammar runtime is the SAME baked
11
+ * artifact the Ruby flavor runs (pubid-grammar artifacts/cen_pfs.json,
12
+ * compiled from definitions/cen.pfs by the compiler with the six
13
+ * declared-emission features), loaded through the artifact runtime, so
14
+ * grammar changes land once and this side cannot drift. Nothing is
15
+ * hand-rolled serialization: the model is declared attributes on the
16
+ * unified model (serialization derives from BaseIdentifier), the nine
17
+ * deliverable families are declared document classes (the token in type
18
+ * or publisher position selects the class, the designation token
19
+ * defaulting the publisher column), the prEN/FprEN draft stages fold
20
+ * onto the typed stage whose compact wire code is the definition's
21
+ * stage map, and the render body is the definition's canonical template
22
+ * with presence-guarded optionals. The wrapper classes are the compiled
23
+ * classes the definition's supplements declaration synthesizes (the
24
+ * slash run folds into the standalone wrapper chain, the plus run into
25
+ * the consolidated bundle, the FRAG face wraps the amendment), and the
26
+ * adopted-base dispatch is the §4 coded escape hatch: the hook parses
27
+ * the adopted string with the owning flavor's implementation, switches
28
+ * the ENV adoption to the prestandard, and owns the implicit IEC-range
29
+ * adoption — the same two explicit call points the generated Ruby
30
+ * builder performs. The parity gate (test/cen-pfs-parity.test.ts) pins
31
+ * byte-identity with the coded
32
+ * {@linkcode import("../cen_cenelec/model.js").CenIdentifier} over the
33
+ * shared conformance set (the full 189-row corpus inventory).
34
+ */
35
+ /** The declared draft stages (the definition's `stages:` map): the
36
+ * serialized code is the key, the official-URN stage code the declared
37
+ * `urn:` value — the same trio the coded flavor's stage registry rows
38
+ * carry, restricted to the declared subset. */
39
+ export interface CenPfsStage {
40
+ code: string;
41
+ stage_code: string;
42
+ type_code: string;
43
+ abbr: string;
44
+ }
45
+ export declare const STAGES: Record<string, CenPfsStage>;
46
+ export declare function locateStageByCode(code: string): CenPfsStage | undefined;
47
+ /**
48
+ * The compiled flavor's identifier base: the shared render machinery
49
+ * (the definition's canonical template) and the FLAVOR-LOCAL type
50
+ * dispatch. The concrete classes carry the scheme's canonical wire tags
51
+ * (pubid:cencenelec:…), which deliberately stay OUT of the global type
52
+ * map — one scheme, one `_type`, one global resolution (the coded
53
+ * class); {@linkcode fromHash} routes the tags back here flavor-locally
54
+ * first (mirroring Ruby's flavor-base polymorphic_type_map), then falls
55
+ * through to the global registry for the cross-flavor nested identifiers
56
+ * (the adopted ISO/IEC document), exactly the TypeResolver order.
57
+ */
58
+ export declare abstract class CenPfsIdentifier extends BaseIdentifier {
59
+ /** The wire tags the compiled classes answer, resolved flavor-locally. */
60
+ static localTypeMap: Map<string, new (attrs?: Record<string, unknown>) => CenPfsIdentifier>;
61
+ readonly number: string | undefined;
62
+ readonly part: string | undefined;
63
+ readonly version: string | undefined;
64
+ readonly date: PubidDate | undefined;
65
+ readonly publisher: string | undefined;
66
+ readonly copublishers: string[] | undefined;
67
+ readonly type: string | undefined;
68
+ readonly typedStage: CenPfsStage | undefined;
69
+ /** The alias's own from_hash: the scheme tags route HERE, the
70
+ * cross-flavor tags (a nested adopted ISO/IEC document) fall through
71
+ * to the global registry, while the cen tags never reach the coded
72
+ * classes (coexistence, not cutover). */
73
+ static fromHash(hash: Record<string, unknown>): BaseIdentifier;
74
+ /** The definition's canonical face — the head alternation picks the
75
+ * first alternative whose direct fields captured: the draft face, the
76
+ * Guide word face, the adopted face, else the publisher face with the
77
+ * optional slash type; the run and the FRAG face follow. */
78
+ render(): string;
79
+ }
80
+ /**
81
+ * The official URN: the definition's urn.official fused segments —
82
+ * urn:cen[:<publisher group>][:<adopted fused MR>][:<composed
83
+ * code>][:<year>][:<stage code>]; a wrapper reads through to its
84
+ * subject and appends its declared chain (:amd:/:cor:), the
85
+ * consolidated bundle marks each member with the plus marker, and the
86
+ * fragment's :frag: segments come last.
87
+ */
88
+ declare class CenPfsUrnGenerator extends BaseUrnGenerator<CenPfsIdentifier> {
89
+ generate(): string;
90
+ }
91
+ /** The nine deliverable families plus the adoption wrapper (the
92
+ * definition's `types:` map): the token-free EuropeanNorm is the
93
+ * default class. */
94
+ export declare const CenPfsEuropeanNorm: (new (attrs?: Record<string, unknown>) => CenPfsIdentifier) & IdentifierStatic;
95
+ export declare const CenPfsAdoptedEuropeanNorm: (new (attrs?: Record<string, unknown>) => CenPfsIdentifier) & IdentifierStatic;
96
+ export declare const CenPfsTechnicalReport: (new (attrs?: Record<string, unknown>) => CenPfsIdentifier) & IdentifierStatic;
97
+ export declare const CenPfsTechnicalSpecification: (new (attrs?: Record<string, unknown>) => CenPfsIdentifier) & IdentifierStatic;
98
+ export declare const CenPfsGuide: (new (attrs?: Record<string, unknown>) => CenPfsIdentifier) & IdentifierStatic;
99
+ export declare const CenPfsCenReport: (new (attrs?: Record<string, unknown>) => CenPfsIdentifier) & IdentifierStatic;
100
+ export declare const CenPfsCenWorkshopAgreement: (new (attrs?: Record<string, unknown>) => CenPfsIdentifier) & IdentifierStatic;
101
+ export declare const CenPfsEuropeanSpecification: (new (attrs?: Record<string, unknown>) => CenPfsIdentifier) & IdentifierStatic;
102
+ export declare const CenPfsEuropeanPrestandard: (new (attrs?: Record<string, unknown>) => CenPfsIdentifier) & IdentifierStatic;
103
+ export declare const CenPfsHarmonizationDocument: (new (attrs?: Record<string, unknown>) => CenPfsIdentifier) & IdentifierStatic;
104
+ /** The supplement wrapper base: the wrapper owns its ordinal and the
105
+ * base identifier; every rendered face reads through. */
106
+ declare abstract class CenPfsSupplement extends CenPfsIdentifier {
107
+ static get attributes(): import("../../model/attribute.js").AttributeTable;
108
+ static get mappings(): FieldMapping[];
109
+ static urnGenerator: typeof CenPfsUrnGenerator;
110
+ readonly base: CenPfsIdentifier | undefined;
111
+ readonly year: string | undefined;
112
+ readonly month: string | undefined;
113
+ /** The wrapper's date: "2016-11", "2003", or undefined. */
114
+ supplementDate(): string | undefined;
115
+ /** The printed notation: the kind face, the ordinal (absent for an
116
+ * unnumbered corrigendum) and the declared date tail. */
117
+ supplementNotation(): string;
118
+ }
119
+ export declare class CenPfsAmendment extends CenPfsSupplement {
120
+ /** The kind face "A" is the run's dispatch token and the notation
121
+ * face. */
122
+ static get polymorphicName(): string;
123
+ static FACE: string;
124
+ }
125
+ export declare class CenPfsCorrigendum extends CenPfsSupplement {
126
+ /** The kind face "AC" is the run's dispatch token and the notation
127
+ * face. */
128
+ static get polymorphicName(): string;
129
+ static FACE: string;
130
+ }
131
+ /** The consolidated (plus-run) bundle: the base document is the first
132
+ * member; the supplements carry no base. */
133
+ export declare class CenPfsConsolidatedIdentifier extends CenPfsIdentifier {
134
+ static get polymorphicName(): string;
135
+ static get attributes(): import("../../model/attribute.js").AttributeTable;
136
+ static get mappings(): FieldMapping[];
137
+ static urnGenerator: typeof CenPfsUrnGenerator;
138
+ readonly identifiers: CenPfsIdentifier[];
139
+ }
140
+ /** The fragment wrapper: a fragment of the amendment it wraps; the
141
+ * fragment ordinal is its own `number`. */
142
+ export declare class CenPfsFragment extends CenPfsIdentifier {
143
+ static get polymorphicName(): string;
144
+ static get attributes(): import("../../model/attribute.js").AttributeTable;
145
+ static get mappings(): FieldMapping[];
146
+ static urnGenerator: typeof CenPfsUrnGenerator;
147
+ readonly base: CenPfsIdentifier | undefined;
148
+ }
149
+ export declare function buildCenPfsIdentifier(flat: Record<string, unknown>): CenPfsIdentifier;
150
+ export declare function cenPfsGrammarImplementation(): FlavorImplementation;
151
+ export {};