@pubid/pubid 0.1.60 → 0.1.62
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.
- package/artifact/corpus.json.gz +0 -0
- package/dist/conformance/implementation.d.ts +2 -0
- package/dist/flavors/iho/index.js +244 -11
- package/dist/flavors/wmo/index.js +33 -8
- package/dist/flavors/wmo/model.d.ts +58 -8
- package/dist/flavors/wmo/model.js +114 -41
- package/dist/pubid-urn/schemas/iala.js +1 -0
- package/dist/pubid-urn/schemas/iho.js +1 -0
- package/dist/pubid-urn/schemas/wmo.js +4 -0
- package/dist/urn/parsers.js +373 -81
- package/dist/urn/types.d.ts +4 -1
- package/package.json +1 -1
- package/vendor/parg/adobe.json +1 -1
- package/vendor/parg/iala.json +1 -1
- package/vendor/parg/iho.json +1 -1
- package/vendor/parg/wmo.json +1 -1
package/artifact/corpus.json.gz
CHANGED
|
Binary file
|
|
@@ -27,5 +27,7 @@ export interface Identifier {
|
|
|
27
27
|
/** Ruby ==: canonical equality skipping equalityIgnored attributes
|
|
28
28
|
* (the (E) position is spelling, the language itself is not). */
|
|
29
29
|
equals?(other: Identifier): boolean;
|
|
30
|
+
/** The pubid-scheme URN (urn:pubid:...) from the flavor schema table; BaseIdentifier provides it. */
|
|
31
|
+
toPubidUrn?(): string;
|
|
30
32
|
}
|
|
31
33
|
export type ImplementationRegistry = Map<string, FlavorImplementation>;
|
|
@@ -24,8 +24,12 @@ function buildRules() {
|
|
|
24
24
|
const seriesLetter = str("S").or(str("P"), str("M"), str("B"), str("C"));
|
|
25
25
|
const year4 = str("19").or(str("20")).then(match("[0-9]").repeat(2));
|
|
26
26
|
rule("series", () => seriesLetter.as("type"));
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
// The colon member captures SEPARATELY ("S-158:102" → number "158" +
|
|
28
|
+
// colon_suffix "102"): the builder re-keys the S-158 member into
|
|
29
|
+
// checks_for and re-glues every other series' member into the number
|
|
30
|
+
// (the C-16:2 opaque face, pubid#637).
|
|
31
|
+
rule("number_suffix", () => str(":").then(digits.as("colon_suffix")));
|
|
32
|
+
rule("number", () => digits.as("number").then(rules["number_suffix"].maybe()));
|
|
29
33
|
// The compact part face, hyphenated onto the code: S-5-B (lettered),
|
|
30
34
|
// S-100-1 (numbered) and S-158-S-102 (series reference).
|
|
31
35
|
rule("compact_part", () => dash.then(seriesLetter
|
|
@@ -119,12 +123,76 @@ function padEditionShorthand(value) {
|
|
|
119
123
|
segments.push("0");
|
|
120
124
|
return segments.join(".");
|
|
121
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* The S-158 alias unification on the deserialization path (the gem's
|
|
128
|
+
* Builder.normalize_checks_alias, pubid#774). A hash carrying the
|
|
129
|
+
* draft-era part model on the standard family — a series reference
|
|
130
|
+
* ("S-102") or the bare member number ("102") riding number 158 with
|
|
131
|
+
* no checks_for — rebinding onto checks_for; the edition/year that
|
|
132
|
+
* followed the part face are the BASE ones. Pure function: returns the
|
|
133
|
+
* hash untouched when it carries no draft-era part face, a normalized
|
|
134
|
+
* copy otherwise. The face is not restored (the canonical colon form).
|
|
135
|
+
*/
|
|
136
|
+
function normalizeChecksAlias(data) {
|
|
137
|
+
const part = data["part"];
|
|
138
|
+
const number = data["number"];
|
|
139
|
+
const typeKey = data["_type"];
|
|
140
|
+
if (typeof part !== "string" ||
|
|
141
|
+
number !== "158" ||
|
|
142
|
+
data["checks_for"] !== undefined ||
|
|
143
|
+
(typeKey !== undefined && !String(typeKey).endsWith("standard"))) {
|
|
144
|
+
return data;
|
|
145
|
+
}
|
|
146
|
+
const seriesRef = /^([SPMBC])-(\d+)$/.exec(part);
|
|
147
|
+
const digits = seriesRef !== null ? seriesRef[2] : /^\d+$/.test(part) ? part : undefined;
|
|
148
|
+
if (digits === undefined)
|
|
149
|
+
return data;
|
|
150
|
+
const out = { ...data };
|
|
151
|
+
const edition = out["part_edition"];
|
|
152
|
+
const year = out["part_year"];
|
|
153
|
+
if (out["edition"] !== undefined && edition !== undefined) {
|
|
154
|
+
throw new ParseFailed(`IHO: duplicate edition: the base edition and the member edition ${String(edition)} cannot both ride S-158:${digits}`, 0);
|
|
155
|
+
}
|
|
156
|
+
delete out["part"];
|
|
157
|
+
delete out["part_edition"];
|
|
158
|
+
delete out["part_year"];
|
|
159
|
+
out["checks_for"] = digits;
|
|
160
|
+
if (out["edition"] === undefined && edition !== undefined)
|
|
161
|
+
out["edition"] = edition;
|
|
162
|
+
if (out["year"] === undefined && year !== undefined)
|
|
163
|
+
out["year"] = year;
|
|
164
|
+
return out;
|
|
165
|
+
}
|
|
122
166
|
function ihoClass(kind) {
|
|
123
167
|
const letter = KIND_LETTERS[kind];
|
|
124
168
|
class IhoKindIdentifier extends BaseIdentifier {
|
|
125
169
|
static polymorphicName = `pubid:iho:${kind}`;
|
|
170
|
+
/** The deserialization path applies the same S-158 alias unification
|
|
171
|
+
* the parse path applies (the gem's Builder.normalize_checks_alias):
|
|
172
|
+
* a stored row or a legacy URN carrying the draft-era part model
|
|
173
|
+
* (part: "S-102", part_edition: "0.2.0") decodes to the checks_for
|
|
174
|
+
* identity, so no construction path yields the two-identity disease
|
|
175
|
+
* of issue #775. The spelling face is NOT restored — a deserialized
|
|
176
|
+
* identifier renders the canonical colon designator. */
|
|
177
|
+
static fromHash(hash) {
|
|
178
|
+
return super.fromHash(normalizeChecksAlias(hash));
|
|
179
|
+
}
|
|
126
180
|
static attributes = extendAttributes(BaseIdentifier, {
|
|
127
181
|
number: { type: "string" },
|
|
182
|
+
// The S-158 family facet (pubid#774): the S-100 product number
|
|
183
|
+
// whose validation checks this publication specifies. The colon
|
|
184
|
+
// designator form "S-158:102" is the primary face; the legacy
|
|
185
|
+
// draft-era part spellings bind the SAME identity.
|
|
186
|
+
checks_for: { type: "string" },
|
|
187
|
+
// The face the input spelled checks_for with: undefined = the
|
|
188
|
+
// primary colon face ("S-158:102"), otherwise the draft-era part
|
|
189
|
+
// value as written ("S-102" of "Part S-102"/"S-158-S-102", "102"
|
|
190
|
+
// of "Part 102") — it prints in the Part slot verbatim.
|
|
191
|
+
// Spelling-only: outside the mappings whitelist it never
|
|
192
|
+
// serializes, and equality skips it — render keeps the input
|
|
193
|
+
// spelling, equality/URN use the canonical shape. URN
|
|
194
|
+
// deserialization restores no face (the canonical colon form).
|
|
195
|
+
checks_face: { type: "string", equalityIgnored: true },
|
|
128
196
|
part: { type: "string" },
|
|
129
197
|
part_edition: { type: "string" },
|
|
130
198
|
part_year: { type: "string" },
|
|
@@ -152,9 +220,16 @@ function ihoClass(kind) {
|
|
|
152
220
|
spec_sub: { type: "string" },
|
|
153
221
|
spec_variant: { type: "string" },
|
|
154
222
|
});
|
|
155
|
-
static mappings = keyValue({ wire: "number", to: "number" }, { wire: "part", to: "part" }, { wire: "part_edition", to: "part_edition" }, { wire: "part_year", to: "part_year" }, { wire: "annex", to: "annex" }, { wire: "annex_edition", to: "annex_edition" }, { wire: "annex_year", to: "annex_year" }, { wire: "appendix", to: "appendix" }, { wire: "appendix_subnumber", to: "appendix_subnumber" }, { wire: "appendix_edition", to: "appendix_edition" }, { wire: "appendix_year", to: "appendix_year" }, { wire: "supplement", to: "supplement" }, { wire: "supplement_edition", to: "supplement_edition" }, { wire: "supplement_year", to: "supplement_year" }, { wire: "edition", to: "edition" }, { wire: "year", to: "year" }, { wire: "volume", to: "volume" }, { wire: "volume_edition", to: "volume_edition" }, { wire: "volume_year", to: "volume_year" }, { wire: "issue", to: "issue" }, { wire: "spec", to: "spec" }, { wire: "spec_sub", to: "spec_sub" }, { wire: "spec_variant", to: "spec_variant" });
|
|
223
|
+
static mappings = keyValue({ wire: "number", to: "number" }, { wire: "checks_for", to: "checks_for" }, { wire: "part", to: "part" }, { wire: "part_edition", to: "part_edition" }, { wire: "part_year", to: "part_year" }, { wire: "annex", to: "annex" }, { wire: "annex_edition", to: "annex_edition" }, { wire: "annex_year", to: "annex_year" }, { wire: "appendix", to: "appendix" }, { wire: "appendix_subnumber", to: "appendix_subnumber" }, { wire: "appendix_edition", to: "appendix_edition" }, { wire: "appendix_year", to: "appendix_year" }, { wire: "supplement", to: "supplement" }, { wire: "supplement_edition", to: "supplement_edition" }, { wire: "supplement_year", to: "supplement_year" }, { wire: "edition", to: "edition" }, { wire: "year", to: "year" }, { wire: "volume", to: "volume" }, { wire: "volume_edition", to: "volume_edition" }, { wire: "volume_year", to: "volume_year" }, { wire: "issue", to: "issue" }, { wire: "spec", to: "spec" }, { wire: "spec_sub", to: "spec_sub" }, { wire: "spec_variant", to: "spec_variant" });
|
|
156
224
|
render() {
|
|
157
225
|
let result = `IHO ${letter}-${this.number}`;
|
|
226
|
+
// The S-158 checks face: the primary colon form rides the code
|
|
227
|
+
// ("S-158:102"); the draft-era part face keeps its spelling and
|
|
228
|
+
// prints in the Part slot — after the edition ("S-158 0.2.0
|
|
229
|
+
// Part S-102"). The compact face renders expanded (the S-5A law).
|
|
230
|
+
if (this.checks_for !== undefined && this.checks_face === undefined) {
|
|
231
|
+
result += `:${this.checks_for}`;
|
|
232
|
+
}
|
|
158
233
|
if (this.edition !== undefined)
|
|
159
234
|
result += ` ${this.edition}`;
|
|
160
235
|
if (this.supplement !== undefined) {
|
|
@@ -174,6 +249,11 @@ function ihoClass(kind) {
|
|
|
174
249
|
if (this.spec_variant !== undefined)
|
|
175
250
|
result += `(${this.spec_variant})`;
|
|
176
251
|
}
|
|
252
|
+
else if (this.checks_face !== undefined) {
|
|
253
|
+
// The draft-era member face prints in the Part slot, the part
|
|
254
|
+
// value as written ("Part S-102", "Part 102").
|
|
255
|
+
result += ` Part ${this.checks_face}`;
|
|
256
|
+
}
|
|
177
257
|
else if (this.part !== undefined) {
|
|
178
258
|
result += ` Part ${this.part}`;
|
|
179
259
|
if (this.part_edition !== undefined)
|
|
@@ -214,12 +294,94 @@ function ihoClass(kind) {
|
|
|
214
294
|
}
|
|
215
295
|
}
|
|
216
296
|
class IhoUrnGenerator extends BaseUrnGenerator {
|
|
297
|
+
// The guidance publication type per series letter (the gem's
|
|
298
|
+
// MRN_TYPES): S = Standards and Specifications -> spec, P = the
|
|
299
|
+
// periodic publications -> per, M = Miscellaneous (Base Regulatory
|
|
300
|
+
// Publications) -> reg. B and C have no guidance type code — they
|
|
301
|
+
// keep the legacy positional emission until IHO assigns one.
|
|
302
|
+
static MRN_TYPES = { S: "spec", P: "per", M: "reg" };
|
|
217
303
|
generate() {
|
|
304
|
+
const mrnType = IhoUrnGenerator.MRN_TYPES[letter];
|
|
305
|
+
if (mrnType === undefined)
|
|
306
|
+
return this.generateLegacy();
|
|
307
|
+
const id = this.identifier;
|
|
308
|
+
// The IHO MRN guidance (S-100WG4, the gem's generate_mrn): the
|
|
309
|
+
// publications namespace urn:mrn:iho:pub:, the type token, the
|
|
310
|
+
// name segment, the bare dotted edition, then the trailing
|
|
311
|
+
// marker atoms in containment order.
|
|
312
|
+
const parts = ["urn:mrn:iho:pub", mrnType, this.mrnName(id)];
|
|
313
|
+
if (id.edition !== undefined)
|
|
314
|
+
parts.push(id.edition);
|
|
315
|
+
if (id.year !== undefined)
|
|
316
|
+
parts.push(`year-${id.year}`);
|
|
317
|
+
if (id.supplement !== undefined) {
|
|
318
|
+
parts.push(`sup-${id.supplement}`);
|
|
319
|
+
if (id.supplement_edition !== undefined)
|
|
320
|
+
parts.push(`ed-${id.supplement_edition}`);
|
|
321
|
+
if (id.supplement_year !== undefined)
|
|
322
|
+
parts.push(`year-${id.supplement_year}`);
|
|
323
|
+
}
|
|
324
|
+
if (id.part !== undefined) {
|
|
325
|
+
parts.push(`part-${id.part}`);
|
|
326
|
+
if (id.part_edition !== undefined)
|
|
327
|
+
parts.push(`ed-${id.part_edition}`);
|
|
328
|
+
if (id.part_year !== undefined)
|
|
329
|
+
parts.push(`year-${id.part_year}`);
|
|
330
|
+
}
|
|
331
|
+
// The S-4 spec citation: a child of its part (the citation letter
|
|
332
|
+
// rides the part- atom); the SECTION is NOT emitted — derivable
|
|
333
|
+
// from the spec's hundreds digit.
|
|
334
|
+
if (id.spec !== undefined) {
|
|
335
|
+
parts.push(`spec-${id.spec}`);
|
|
336
|
+
if (id.spec_sub !== undefined)
|
|
337
|
+
parts.push(`specsub-${id.spec_sub}`);
|
|
338
|
+
if (id.spec_variant !== undefined)
|
|
339
|
+
parts.push(`specvar-${id.spec_variant}`);
|
|
340
|
+
}
|
|
341
|
+
if (id.annex !== undefined) {
|
|
342
|
+
parts.push(`annex-${id.annex}`);
|
|
343
|
+
if (id.annex_edition !== undefined)
|
|
344
|
+
parts.push(`ed-${id.annex_edition}`);
|
|
345
|
+
if (id.annex_year !== undefined)
|
|
346
|
+
parts.push(`year-${id.annex_year}`);
|
|
347
|
+
}
|
|
348
|
+
if (id.appendix !== undefined) {
|
|
349
|
+
// The subnumber hyphen-joins its appendix (one compound
|
|
350
|
+
// segment, RFC 3986-safe).
|
|
351
|
+
let segment = `appendix-${id.appendix}`;
|
|
352
|
+
if (id.appendix_subnumber !== undefined)
|
|
353
|
+
segment += `-${id.appendix_subnumber}`;
|
|
354
|
+
parts.push(segment);
|
|
355
|
+
if (id.appendix_edition !== undefined)
|
|
356
|
+
parts.push(`ed-${id.appendix_edition}`);
|
|
357
|
+
if (id.appendix_year !== undefined)
|
|
358
|
+
parts.push(`year-${id.appendix_year}`);
|
|
359
|
+
}
|
|
360
|
+
if (id.volume !== undefined) {
|
|
361
|
+
parts.push(`vol-${id.volume}`);
|
|
362
|
+
if (id.issue !== undefined)
|
|
363
|
+
parts.push(`issue-${id.issue}`);
|
|
364
|
+
if (id.volume_edition !== undefined)
|
|
365
|
+
parts.push(`ed-${id.volume_edition}`);
|
|
366
|
+
if (id.volume_year !== undefined)
|
|
367
|
+
parts.push(`year-${id.volume_year}`);
|
|
368
|
+
}
|
|
369
|
+
return parts.join(":");
|
|
370
|
+
}
|
|
371
|
+
/** The lowercase name form: sNNN, the S-158 member joining
|
|
372
|
+
* hyphenated (s158-102) so the edition stays in its canonical 4th
|
|
373
|
+
* position. */
|
|
374
|
+
mrnName(id) {
|
|
375
|
+
let name = `${letter.toLowerCase()}${id.number}`;
|
|
376
|
+
if (id.checks_for !== undefined)
|
|
377
|
+
name += `-${id.checks_for}`;
|
|
378
|
+
return name;
|
|
379
|
+
}
|
|
380
|
+
/** The legacy positional form (the B/C emission today; the shape
|
|
381
|
+
* every legacy urn:iho: URN decodes from). */
|
|
382
|
+
generateLegacy() {
|
|
218
383
|
const id = this.identifier;
|
|
219
384
|
const parts = ["urn", "iho", letter.toLowerCase(), id.number];
|
|
220
|
-
// Each component is a marker-prefixed segment; its own edition
|
|
221
|
-
// (ed-) and year (year-) follow it directly. The base edition
|
|
222
|
-
// and year come first (they attach to the base node).
|
|
223
385
|
if (id.edition !== undefined)
|
|
224
386
|
parts.push(`ed-${id.edition}`);
|
|
225
387
|
if (id.year !== undefined)
|
|
@@ -238,10 +400,6 @@ function ihoClass(kind) {
|
|
|
238
400
|
if (id.part_year !== undefined)
|
|
239
401
|
parts.push(`year-${id.part_year}`);
|
|
240
402
|
}
|
|
241
|
-
// The S-4 spec citation: a child of its part (the citation letter
|
|
242
|
-
// rides the part- atom), the dotted sub and the parenthesized
|
|
243
|
-
// variant its own children. The spelled SECTION is NOT emitted —
|
|
244
|
-
// derivable from the spec's hundreds digit.
|
|
245
403
|
if (id.spec !== undefined) {
|
|
246
404
|
parts.push(`spec-${id.spec}`);
|
|
247
405
|
if (id.spec_sub !== undefined)
|
|
@@ -259,7 +417,7 @@ function ihoClass(kind) {
|
|
|
259
417
|
if (id.appendix !== undefined) {
|
|
260
418
|
parts.push(`appendix-${id.appendix}`);
|
|
261
419
|
// The subnumber is a bare child segment directly after the
|
|
262
|
-
// appendix (
|
|
420
|
+
// appendix (the legacy emission's only bare atom).
|
|
263
421
|
if (id.appendix_subnumber !== undefined)
|
|
264
422
|
parts.push(id.appendix_subnumber);
|
|
265
423
|
if (id.appendix_edition !== undefined)
|
|
@@ -296,6 +454,20 @@ class IhoBuilder extends BaseBuilder {
|
|
|
296
454
|
// resolves through (bare "B-401" carries it implicitly).
|
|
297
455
|
static S4_TYPE = "S";
|
|
298
456
|
static S4_NUMBER = "4";
|
|
457
|
+
// The S-158 framework publication: its series members (the colon
|
|
458
|
+
// designator and the series-reference part faces) re-key into
|
|
459
|
+
// checks_for (pubid#774).
|
|
460
|
+
static S158_NUMBER = "158";
|
|
461
|
+
// The two publication modes are mutually exclusive (the gem's
|
|
462
|
+
// assert_edition_mode!): a base edition and any component edition
|
|
463
|
+
// cannot ride together.
|
|
464
|
+
static COMPONENT_EDITIONS = [
|
|
465
|
+
"part_edition",
|
|
466
|
+
"supplement_edition",
|
|
467
|
+
"annex_edition",
|
|
468
|
+
"appendix_edition",
|
|
469
|
+
"volume_edition",
|
|
470
|
+
];
|
|
299
471
|
// A citation letter is one of S-4's lettered Parts; the section
|
|
300
472
|
// vocabulary (100-600, Part C 100-500) is theirs.
|
|
301
473
|
static SPEC_LETTERS = ["A", "B", "C"];
|
|
@@ -333,6 +505,67 @@ class IhoBuilder extends BaseBuilder {
|
|
|
333
505
|
delete flat[yearKey];
|
|
334
506
|
}
|
|
335
507
|
}
|
|
508
|
+
// The S-158 family re-key (pubid#774, the gem's Builder). The colon
|
|
509
|
+
// designator "S-158:<NNN>" is the PRIMARY face: number stays 158,
|
|
510
|
+
// the member binds checks_for. The member designator is the S-158
|
|
511
|
+
// series device — a colon form on any other anchor rejects
|
|
512
|
+
// ("S-44:5", "C-16:2"). A draft-era part face on the S-158 family —
|
|
513
|
+
// a series reference ("Part S-102"), the compact face
|
|
514
|
+
// ("S-158-S-102") or the bare member number ("Part 102") — rebinds
|
|
515
|
+
// onto checks_for while checks_for is UNBOUND (a bound member keeps
|
|
516
|
+
// a genuine part: "S-158:100 Part 2"); a lettered or compound part
|
|
517
|
+
// value ("Part A", "Part 4a") never rebinds. The edition/year that
|
|
518
|
+
// follow the draft-era part face are the BASE ones (the pubid#775
|
|
519
|
+
// mis-bind fix), and the spelling face records the part value as
|
|
520
|
+
// written so the render keeps the input's spelling (equality/URN
|
|
521
|
+
// canonical). The two publication modes are mutually exclusive: a
|
|
522
|
+
// base edition and any component edition cannot ride together.
|
|
523
|
+
const colonSuffix = flat["colon_suffix"];
|
|
524
|
+
delete flat["colon_suffix"];
|
|
525
|
+
if (colonSuffix !== undefined) {
|
|
526
|
+
const type = flat["type"];
|
|
527
|
+
if (flat["number"] === IhoBuilder.S158_NUMBER && (type === undefined || type === "S")) {
|
|
528
|
+
if (flat["checks_for"] !== undefined && flat["checks_for"] !== colonSuffix) {
|
|
529
|
+
throw new ParseFailed(`IHO: checks_for ${String(flat["checks_for"])} conflicts with the colon member ${String(colonSuffix)}`, 0);
|
|
530
|
+
}
|
|
531
|
+
flat["checks_for"] = colonSuffix;
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
throw new ParseFailed(`IHO: the checks_for member designator is the S-158 series device: ${String(type ?? "S")}-${String(flat["number"])}:${String(colonSuffix)} cannot carry it`, 0);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
if (flat["number"] === IhoBuilder.S158_NUMBER &&
|
|
538
|
+
flat["checks_for"] === undefined &&
|
|
539
|
+
typeof flat["part"] === "string") {
|
|
540
|
+
const partValue = flat["part"];
|
|
541
|
+
const seriesRef = /^([SPMBC])-(\d+)$/.exec(partValue);
|
|
542
|
+
const digits = seriesRef !== null ? seriesRef[2] : /^\d+$/.test(partValue) ? partValue : undefined;
|
|
543
|
+
if (digits !== undefined) {
|
|
544
|
+
flat["checks_for"] = digits;
|
|
545
|
+
flat["checks_face"] = partValue;
|
|
546
|
+
delete flat["part"];
|
|
547
|
+
const edition = flat["part_edition"];
|
|
548
|
+
const year = flat["part_year"];
|
|
549
|
+
delete flat["part_edition"];
|
|
550
|
+
delete flat["part_year"];
|
|
551
|
+
if (flat["edition"] !== undefined && edition !== undefined) {
|
|
552
|
+
throw new ParseFailed(`IHO: duplicate edition: the base edition ${String(flat["edition"])} and the member edition ${String(edition)} cannot both ride S-158:${digits}`, 0);
|
|
553
|
+
}
|
|
554
|
+
if (flat["year"] !== undefined && year !== undefined) {
|
|
555
|
+
throw new ParseFailed(`IHO: duplicate year: the base year ${String(flat["year"])} and the member year ${String(year)} cannot both ride S-158:${digits}`, 0);
|
|
556
|
+
}
|
|
557
|
+
if (flat["edition"] === undefined && edition !== undefined)
|
|
558
|
+
flat["edition"] = edition;
|
|
559
|
+
if (flat["year"] === undefined && year !== undefined)
|
|
560
|
+
flat["year"] = year;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
if (flat["edition"] !== undefined) {
|
|
564
|
+
const owned = IhoBuilder.COMPONENT_EDITIONS.filter((k) => flat[k] !== undefined);
|
|
565
|
+
if (owned.length > 0) {
|
|
566
|
+
throw new ParseFailed(`IHO: a base edition and a component edition are mutually exclusive: ${owned.join(", ")} cannot ride edition ${String(flat["edition"])}`, 0);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
336
569
|
// The S-4 spec citation resolution (ruby resolve_spec_citation!):
|
|
337
570
|
// the citation letter folds into `part` (a Part-rule capture must
|
|
338
571
|
// agree), and the long form's spelled section becomes the spec
|
|
@@ -8,14 +8,27 @@ export * from "./model.js";
|
|
|
8
8
|
* parsanol 1.5.1.0), loaded through the artifact runtime. The builder
|
|
9
9
|
* mirrors Pubid::Wmo::Builder: the grammar carries exactly one
|
|
10
10
|
* doc_number and edition_value per alternative path, so one flat bound
|
|
11
|
-
* map serves all
|
|
12
|
-
*
|
|
11
|
+
* map serves all types and the dispatch keys off `annex_marker` and
|
|
12
|
+
* `series_head`.
|
|
13
13
|
*/
|
|
14
|
+
/**
|
|
15
|
+
* The series head the grammar matched -> the model's series key (the
|
|
16
|
+
* widening prefix law: every head names its publisher, and the head
|
|
17
|
+
* face is the grammar's verbatim capture, so the key mapping lives on
|
|
18
|
+
* the one construction site).
|
|
19
|
+
*/
|
|
20
|
+
const SERIES_HEADS = {
|
|
21
|
+
"WMO-No.": undefined,
|
|
22
|
+
"WMO/TD-No.": "TD",
|
|
23
|
+
"JCOMM Technical Report No.": "JCOMM",
|
|
24
|
+
"GAW Report No.": "GAW",
|
|
25
|
+
};
|
|
26
|
+
const head = (data, key) => data[key] === undefined ? undefined : String(data[key]);
|
|
14
27
|
function buildWmo(data) {
|
|
15
|
-
const number = data
|
|
16
|
-
const edition = data
|
|
17
|
-
const annexMarker = data
|
|
18
|
-
const annexLetter = data
|
|
28
|
+
const number = head(data, "doc_number");
|
|
29
|
+
const edition = head(data, "edition_value");
|
|
30
|
+
const annexMarker = head(data, "annex_marker");
|
|
31
|
+
const annexLetter = head(data, "annex_letter");
|
|
19
32
|
if (annexMarker !== undefined) {
|
|
20
33
|
const attrs = {
|
|
21
34
|
base: new WmoStandard({ number }),
|
|
@@ -27,8 +40,20 @@ function buildWmo(data) {
|
|
|
27
40
|
attrs["edition"] = edition;
|
|
28
41
|
return new WmoAnnex(attrs);
|
|
29
42
|
}
|
|
30
|
-
if (data["
|
|
31
|
-
|
|
43
|
+
if (data["series_head"] !== undefined) {
|
|
44
|
+
// The widened publication series: the head key plus the volume,
|
|
45
|
+
// status and updated-in faces of the widening.
|
|
46
|
+
const attrs = {
|
|
47
|
+
series: SERIES_HEADS[data["series_head"]],
|
|
48
|
+
volume: head(data, "volume"),
|
|
49
|
+
edition_status: head(data, "edition_status"),
|
|
50
|
+
updated_in: head(data, "updated_in"),
|
|
51
|
+
};
|
|
52
|
+
if (number !== undefined)
|
|
53
|
+
attrs["number"] = number;
|
|
54
|
+
if (edition !== undefined)
|
|
55
|
+
attrs["edition"] = edition;
|
|
56
|
+
return new WmoPublication(attrs);
|
|
32
57
|
}
|
|
33
58
|
return new WmoStandard(edition !== undefined ? { number, edition } : { number });
|
|
34
59
|
}
|
|
@@ -6,11 +6,14 @@ import { BaseIdentifier } from "../../model/identifier.js";
|
|
|
6
6
|
* reaching the artifact runtime; the parse entry (./index.js) is the
|
|
7
7
|
* parg-backed half.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* The publication series share one type (pubid#763 widened):
|
|
10
10
|
*
|
|
11
11
|
* WMO-No. <number>[, <year> edition] the WMO-No. publication
|
|
12
12
|
* series; editions are calendar
|
|
13
13
|
* years
|
|
14
|
+
* WMO/TD-No. <number> the Technical Document series
|
|
15
|
+
* JCOMM Technical Report No. <number> the joint WMO/IOC series
|
|
16
|
+
* GAW Report No. <number> the GAW series
|
|
14
17
|
* S-<number>[ <x.y.z>] the WMO-published S-100 product
|
|
15
18
|
* specifications; editions are
|
|
16
19
|
* dotted x.y.z (the IHO lexical
|
|
@@ -20,17 +23,37 @@ import { BaseIdentifier } from "../../model/identifier.js";
|
|
|
20
23
|
* S-<number> [Annex|ANNEX] [<letter>] [<x.y.z>] annex wrapper
|
|
21
24
|
*
|
|
22
25
|
* The edition is ONE string attribute carrying a type-driven face:
|
|
23
|
-
* "2025" on a Publication, "1.2.1" on a Standard or Annex. The
|
|
24
|
-
*
|
|
26
|
+
* "2025" on a Publication, "1.2.1" on a Standard or Annex. The compound
|
|
27
|
+
* faces widen it: a year pair ("2021/2018" — the pair IS the identity
|
|
28
|
+
* face) rides the same string, while the status word ("Provisional")
|
|
29
|
+
* and the updated-in year carry their own attributes. The volume face
|
|
30
|
+
* ("I", "I.1", "D") is its own attribute, printed before the edition
|
|
31
|
+
* face. The renderer and the MRN URN generator key the face off the
|
|
32
|
+
* type.
|
|
25
33
|
*/
|
|
34
|
+
/** The series config of a series key: the citation face the grammar
|
|
35
|
+
* matched and the MRN slug prefix (lib/pubid/wmo/identifier.rb). */
|
|
36
|
+
interface WmoSeriesConfig {
|
|
37
|
+
face: string;
|
|
38
|
+
mrn: string;
|
|
39
|
+
}
|
|
26
40
|
/**
|
|
27
41
|
* The MRN URN generator (lib/pubid/wmo/urn_generator.rb) — the WMO
|
|
28
42
|
* assigning authority of the IANA-registered mrn namespace, following
|
|
29
43
|
* the IALA pattern (pubid#763 proposed form):
|
|
30
44
|
*
|
|
31
|
-
* urn:mrn:wmo:pub:wmo-<number>[:ed<year>]
|
|
45
|
+
* urn:mrn:wmo:pub:wmo-<number>[:vol-<v>][:status-<s>][:ed<year>]
|
|
46
|
+
* [:updated-<year>] the WMO-No. series
|
|
47
|
+
* urn:mrn:wmo:pub:wmo-td-<number> the TD series
|
|
48
|
+
* urn:mrn:wmo:pub:jcomm-tr-<number> the joint WMO/IOC series
|
|
49
|
+
* urn:mrn:wmo:pub:gaw-<number> the GAW series
|
|
32
50
|
* urn:mrn:wmo:pub:s-<number>[:ed<x.y.z>] the S-100 specs
|
|
33
51
|
* urn:mrn:wmo:pub:s-<number>:annex[-<letter>][:ed<x.y.z>]
|
|
52
|
+
*
|
|
53
|
+
* The segment order mirrors the human face order (volume, status,
|
|
54
|
+
* edition, updated-in); the volume and status values are caseless
|
|
55
|
+
* (downcased, re-cased by the parser). The year pair keeps its slash
|
|
56
|
+
* out of the NSS as a hyphen ("2021/2018" rides as "ed2021-2018").
|
|
34
57
|
*/
|
|
35
58
|
declare class WmoUrnGenerator {
|
|
36
59
|
private readonly identifier;
|
|
@@ -43,18 +66,45 @@ export declare class WmoIdentifier extends BaseIdentifier {
|
|
|
43
66
|
static attributes: import("../../model/attribute.js").AttributeTable;
|
|
44
67
|
static mappings: import("../../model/attribute.js").FieldMapping[];
|
|
45
68
|
static urnGenerator: typeof WmoUrnGenerator;
|
|
69
|
+
/** The series config (face + MRN slug prefix) of a series key,
|
|
70
|
+
* defaulting to the WMO-No. row. */
|
|
71
|
+
static seriesConfig(series: string | undefined): WmoSeriesConfig;
|
|
72
|
+
/** The series config of this identifier's own series. */
|
|
73
|
+
seriesConfig(): WmoSeriesConfig;
|
|
46
74
|
readonly number: string | undefined;
|
|
75
|
+
readonly series: string | undefined;
|
|
47
76
|
readonly edition: string | undefined;
|
|
77
|
+
readonly volume: string | undefined;
|
|
78
|
+
readonly edition_status: string | undefined;
|
|
79
|
+
readonly updated_in: string | undefined;
|
|
48
80
|
readonly publisher: string | undefined;
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
81
|
+
/**
|
|
82
|
+
* The MR-slug identity hooks of the gem (lib/pubid/wmo/
|
|
83
|
+
* identifier.rb) — mirrors with no TS consumer yet (to_mr_string has
|
|
84
|
+
* no TS counterpart), kept faithful to the ruby bodies. The compound
|
|
85
|
+
* faces ride the edition segment so distinct identifiers never
|
|
86
|
+
* collide on the slug: the year pair keeps its slash out of the MR
|
|
87
|
+
* charset as a hyphen ("2021/2018" rides as "ed2021-2018"), the
|
|
88
|
+
* status word and the updated-in year suffix it.
|
|
89
|
+
*/
|
|
52
90
|
mrEdition(): string | undefined;
|
|
91
|
+
/** The series is the type discriminator of the publication series:
|
|
92
|
+
* "WMO/TD-No. 196" and "WMO-No. 196" are two documents. Downcased
|
|
93
|
+
* per the MR charset; undefined (no segment) on the WMO-No. default. */
|
|
94
|
+
mrType(): string | undefined;
|
|
95
|
+
/** The volume is an identity discriminator (the ECMA law): Volume I
|
|
96
|
+
* and Volume II of WMO-No. 8 are two documents sharing one
|
|
97
|
+
* docidentifier. Downcased per the MR charset. */
|
|
98
|
+
mrVolume(): string | undefined;
|
|
53
99
|
/** "WMO-No." and the S-number are designations, not publisher tokens:
|
|
54
100
|
* the canonical faces carry no publisher prefix. */
|
|
55
101
|
render(): string;
|
|
56
102
|
}
|
|
57
|
-
/** Identifiers::Publication — the WMO-No. series
|
|
103
|
+
/** Identifiers::Publication — the WMO-No. publication series and its
|
|
104
|
+
* widened siblings (TD, JCOMM, GAW). Editions are calendar years —
|
|
105
|
+
* "2025 edition" — never version ordinals; the face order is the
|
|
106
|
+
* widening ruling's: volume first, then the edition face (the status
|
|
107
|
+
* word inside it), then the updated-in year. */
|
|
58
108
|
export declare class WmoPublication extends WmoIdentifier {
|
|
59
109
|
static polymorphicName: string;
|
|
60
110
|
render(): string;
|