milsymbol-sidc 0.2.0 → 0.3.0
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/README.md +184 -29
- package/dist/src/enums.d.ts +47 -1
- package/dist/src/enums.d.ts.map +1 -1
- package/dist/src/enums.js +45 -1
- package/dist/src/enums.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/sidc.d.ts +21 -4
- package/dist/src/sidc.d.ts.map +1 -1
- package/dist/src/sidc.js +73 -35
- package/dist/src/sidc.js.map +1 -1
- package/dist/src/validate.d.ts +26 -0
- package/dist/src/validate.d.ts.map +1 -1
- package/dist/src/validate.js +94 -8
- package/dist/src/validate.js.map +1 -1
- package/package.json +28 -6
- package/dist/test/sidc.test.d.ts +0 -2
- package/dist/test/sidc.test.d.ts.map +0 -1
- package/dist/test/sidc.test.js +0 -384
- package/dist/test/sidc.test.js.map +0 -1
package/dist/src/sidc.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { Context,
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Amplifier, Context, HqTaskForceDummy, StandardIdentity, Status, SymbolSet, Version, } from "./enums.js";
|
|
2
|
+
import { checkAmplifier, checkContext, checkFields, checkHqTaskForceDummy, checkIdentity, checkSixDigitField, checkStandard, checkStatus, checkTwoDigitField, defaultVersionForStandard, findCombinationProblems, knownSymbolSets, knownVersions, SidcCombinationError, SidcValidationError, standardForVersion, unrecognizedCodeWarning, } from "./validate.js";
|
|
3
|
+
/** Drops explicitly-undefined entries so omitted and undefined values both default. */
|
|
4
|
+
function dropUndefined(fields) {
|
|
5
|
+
if (fields == null) {
|
|
6
|
+
return {};
|
|
7
|
+
}
|
|
8
|
+
return Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined));
|
|
9
|
+
}
|
|
8
10
|
/**
|
|
9
11
|
* Fluent builder for 20-character numeric SIDC strings
|
|
10
12
|
* (MIL-STD-2525E / APP-6 coding structure).
|
|
11
13
|
*
|
|
12
|
-
* Covers positions 1-
|
|
13
|
-
*
|
|
14
|
+
* Covers all positions 1-20 of the numeric SIDC so the result can be passed
|
|
15
|
+
* straight to milsymbol's `new ms.Symbol(sidc)`.
|
|
14
16
|
*
|
|
15
17
|
* All setters are immutable: they return a new `Sidc` and leave the original
|
|
16
18
|
* untouched.
|
|
@@ -30,23 +32,33 @@ export class Sidc {
|
|
|
30
32
|
/**
|
|
31
33
|
* @param options Builder behaviour flags.
|
|
32
34
|
* @param fields Initial field values. Internal; used for immutable clones.
|
|
35
|
+
* Legacy records may omit the newly supported tail fields; omitted and
|
|
36
|
+
* explicitly-undefined values are normalized to their zero defaults. Every
|
|
37
|
+
* supplied value is validated, so this path cannot produce a malformed SIDC.
|
|
33
38
|
*/
|
|
34
39
|
constructor(options = {}, fields) {
|
|
35
|
-
if (
|
|
36
|
-
options.standard
|
|
37
|
-
!STANDARDS.has(options.standard)) {
|
|
38
|
-
throw new SidcValidationError(`Unknown standard "${options.standard}".`);
|
|
40
|
+
if (options.standard !== undefined) {
|
|
41
|
+
checkStandard(options.standard);
|
|
39
42
|
}
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
const provided = dropUndefined(fields);
|
|
44
|
+
const standard = provided.standard ?? options.standard;
|
|
45
|
+
this.fields = Object.freeze({
|
|
46
|
+
version: standard === undefined
|
|
42
47
|
? Version.MilStd2525E
|
|
43
|
-
: defaultVersionForStandard(
|
|
48
|
+
: defaultVersionForStandard(standard),
|
|
44
49
|
context: Context.Reality,
|
|
45
50
|
identity: StandardIdentity.Unknown,
|
|
46
51
|
symbolSet: SymbolSet.Unknown,
|
|
47
52
|
status: Status.Present,
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
hqTaskForceDummy: HqTaskForceDummy.None,
|
|
54
|
+
amplifier: Amplifier.None,
|
|
55
|
+
entity: "000000",
|
|
56
|
+
modifier1: "00",
|
|
57
|
+
modifier2: "00",
|
|
58
|
+
standard,
|
|
59
|
+
...provided,
|
|
60
|
+
});
|
|
61
|
+
checkFields(this.fields);
|
|
50
62
|
this.strict = options.strict ?? false;
|
|
51
63
|
}
|
|
52
64
|
/**
|
|
@@ -56,14 +68,41 @@ export class Sidc {
|
|
|
56
68
|
* it is reset to that family's latest edition (APP-6 E or MIL-STD-2525E).
|
|
57
69
|
*/
|
|
58
70
|
standard(standard) {
|
|
59
|
-
|
|
60
|
-
throw new SidcValidationError(`Unknown standard "${standard}".`);
|
|
61
|
-
}
|
|
71
|
+
checkStandard(standard);
|
|
62
72
|
const version = standardForVersion(this.fields.version) === standard
|
|
63
73
|
? this.fields.version
|
|
64
74
|
: defaultVersionForStandard(standard);
|
|
65
75
|
return this.with({ standard, version });
|
|
66
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Position 8: headquarters, task force, and feint/dummy indicator.
|
|
79
|
+
*/
|
|
80
|
+
hqTaskForceDummy(value) {
|
|
81
|
+
checkHqTaskForceDummy(value);
|
|
82
|
+
return this.with({ hqTaskForceDummy: value });
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Positions 9-10: echelon, mobility, leadership, or auxiliary amplifier.
|
|
86
|
+
*/
|
|
87
|
+
amplifier(value) {
|
|
88
|
+
checkAmplifier(value);
|
|
89
|
+
return this.with({ amplifier: value });
|
|
90
|
+
}
|
|
91
|
+
/** Positions 11-16: six-digit entity code. */
|
|
92
|
+
entity(value) {
|
|
93
|
+
checkSixDigitField("Entity", value);
|
|
94
|
+
return this.with({ entity: value });
|
|
95
|
+
}
|
|
96
|
+
/** Positions 17-18: two-digit modifier 1 code. */
|
|
97
|
+
modifier1(value) {
|
|
98
|
+
checkTwoDigitField("Modifier 1", value);
|
|
99
|
+
return this.with({ modifier1: value });
|
|
100
|
+
}
|
|
101
|
+
/** Positions 19-20: two-digit modifier 2 code. */
|
|
102
|
+
modifier2(value) {
|
|
103
|
+
checkTwoDigitField("Modifier 2", value);
|
|
104
|
+
return this.with({ modifier2: value });
|
|
105
|
+
}
|
|
67
106
|
/** Positions 1-2: standard edition. Accepts known codes or a raw two-digit code. */
|
|
68
107
|
version(version) {
|
|
69
108
|
checkTwoDigitField("Version", version);
|
|
@@ -71,18 +110,12 @@ export class Sidc {
|
|
|
71
110
|
}
|
|
72
111
|
/** Position 3: context. */
|
|
73
112
|
context(context) {
|
|
74
|
-
|
|
75
|
-
if (!CONTEXTS.has(context)) {
|
|
76
|
-
throw new SidcValidationError(`Unknown context code "${context}".`);
|
|
77
|
-
}
|
|
113
|
+
checkContext(context);
|
|
78
114
|
return this.with({ context });
|
|
79
115
|
}
|
|
80
116
|
/** Position 4: standard identity (affiliation). */
|
|
81
117
|
identity(identity) {
|
|
82
|
-
|
|
83
|
-
if (!IDENTITIES.has(identity)) {
|
|
84
|
-
throw new SidcValidationError(`Unknown standard identity code "${identity}".`);
|
|
85
|
-
}
|
|
118
|
+
checkIdentity(identity);
|
|
86
119
|
return this.with({ identity });
|
|
87
120
|
}
|
|
88
121
|
/** Positions 5-6: symbol set. Accepts known codes or a raw two-digit code. */
|
|
@@ -92,10 +125,7 @@ export class Sidc {
|
|
|
92
125
|
}
|
|
93
126
|
/** Position 7: status / condition. */
|
|
94
127
|
status(status) {
|
|
95
|
-
|
|
96
|
-
if (!STATUSES.has(status)) {
|
|
97
|
-
throw new SidcValidationError(`Unknown status code "${status}".`);
|
|
98
|
-
}
|
|
128
|
+
checkStatus(status);
|
|
99
129
|
return this.with({ status });
|
|
100
130
|
}
|
|
101
131
|
/**
|
|
@@ -124,8 +154,16 @@ export class Sidc {
|
|
|
124
154
|
this.fields.context +
|
|
125
155
|
this.fields.identity +
|
|
126
156
|
this.fields.symbolSet +
|
|
127
|
-
this.fields.status
|
|
128
|
-
|
|
157
|
+
this.fields.status +
|
|
158
|
+
this.fields.hqTaskForceDummy +
|
|
159
|
+
this.fields.amplifier +
|
|
160
|
+
this.fields.entity +
|
|
161
|
+
this.fields.modifier1 +
|
|
162
|
+
this.fields.modifier2;
|
|
163
|
+
if (head.length !== 20) {
|
|
164
|
+
throw new SidcValidationError(`Internal error: rendered SIDC has ${head.length} characters instead of 20.`);
|
|
165
|
+
}
|
|
166
|
+
return head;
|
|
129
167
|
}
|
|
130
168
|
with(fields) {
|
|
131
169
|
return new Sidc({ strict: this.strict }, { ...this.fields, ...fields });
|
package/dist/src/sidc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidc.js","sourceRoot":"","sources":["../../src/sidc.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"sidc.js","sourceRoot":"","sources":["../../src/sidc.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,gBAAgB,EAEhB,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,OAAO,GACR,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,yBAAyB,EACzB,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,GAExB,MAAM,eAAe,CAAC;AAkBvB,uFAAuF;AACvF,SAAS,aAAa,CACpB,MAA8C;IAE9C,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAC3C,CAAC;AAC3B,CAAC;AAED;;;;;;;;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,OAAO,CAAC,IAAI,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;QAED,MAAM,IAAI,GACR,IAAI,CAAC,MAAM,CAAC,OAAO;YACnB,IAAI,CAAC,MAAM,CAAC,OAAO;YACnB,IAAI,CAAC,MAAM,CAAC,QAAQ;YACpB,IAAI,CAAC,MAAM,CAAC,SAAS;YACrB,IAAI,CAAC,MAAM,CAAC,MAAM;YAClB,IAAI,CAAC,MAAM,CAAC,gBAAgB;YAC5B,IAAI,CAAC,MAAM,CAAC,SAAS;YACrB,IAAI,CAAC,MAAM,CAAC,MAAM;YAClB,IAAI,CAAC,MAAM,CAAC,SAAS;YACrB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;QAExB,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YACvB,MAAM,IAAI,mBAAmB,CAC3B,qCAAqC,IAAI,CAAC,MAAM,4BAA4B,CAC7E,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,IAAI,CAAC,MAA2B;QACtC,OAAO,IAAI,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IAC1E,CAAC;CACF"}
|
package/dist/src/validate.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ export interface SidcFields {
|
|
|
6
6
|
identity: string;
|
|
7
7
|
symbolSet: string;
|
|
8
8
|
status: string;
|
|
9
|
+
hqTaskForceDummy: string;
|
|
10
|
+
amplifier: string;
|
|
11
|
+
entity: string;
|
|
12
|
+
modifier1: string;
|
|
13
|
+
modifier2: string;
|
|
9
14
|
/** Optional standard-family configuration used for defaults and validation. */
|
|
10
15
|
standard?: Standard;
|
|
11
16
|
}
|
|
@@ -28,6 +33,27 @@ export declare function standardForVersion(version: string): Standard | undefine
|
|
|
28
33
|
export declare function checkTwoDigitField(name: string, value: string): void;
|
|
29
34
|
/** @internal Validates a single-digit field (context, identity, status). */
|
|
30
35
|
export declare function checkOneDigitField(name: string, value: string): void;
|
|
36
|
+
/** @internal Validates a six-digit entity field. */
|
|
37
|
+
export declare function checkSixDigitField(name: string, value: string): void;
|
|
38
|
+
/** @internal Validates a named position-8 value. */
|
|
39
|
+
export declare function checkHqTaskForceDummy(value: string): void;
|
|
40
|
+
/** @internal Validates a named amplifier value. */
|
|
41
|
+
export declare function checkAmplifier(value: string): void;
|
|
42
|
+
/** @internal Validates a standard-family value. */
|
|
43
|
+
export declare function checkStandard(standard: string): void;
|
|
44
|
+
/** @internal Validates a context value. */
|
|
45
|
+
export declare function checkContext(value: string): void;
|
|
46
|
+
/** @internal Validates a standard-identity value. */
|
|
47
|
+
export declare function checkIdentity(value: string): void;
|
|
48
|
+
/** @internal Validates a status/condition value. */
|
|
49
|
+
export declare function checkStatus(value: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* @internal Validates a complete field record.
|
|
52
|
+
*
|
|
53
|
+
* The constructor uses this so every construction path enforces the same
|
|
54
|
+
* digit-width and enum-membership invariants as the fluent setters.
|
|
55
|
+
*/
|
|
56
|
+
export declare function checkFields(fields: SidcFields): void;
|
|
31
57
|
/**
|
|
32
58
|
* Cross-field consistency checks mirroring milsymbol's number-based SIDC
|
|
33
59
|
* parsing. Returns human-readable problem descriptions; an empty array means
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,QAAQ,EAIR,OAAO,EACR,MAAM,YAAY,CAAC;AAEpB,6DAA6D;AAC7D,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,E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IpD;AAED,2CAA2C;AAC3C,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAKhD;AAED,qDAAqD;AACrD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAKjD;AAED,oDAAoD;AACpD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAK/C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAcpD;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,EAAE,CAkDpE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,MAAM,GAAG,SAAS,CAKpB;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAAkC,CAAC;AAC9E,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EACX,CAAC"}
|
package/dist/src/validate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, Standard, StandardIdentity, Status, SymbolSet, Version, } from "./enums.js";
|
|
1
|
+
import { Amplifier, Context, HqTaskForceDummy, Standard, StandardIdentity, Status, SymbolSet, Version, } from "./enums.js";
|
|
2
2
|
export class SidcError extends Error {
|
|
3
3
|
constructor(message) {
|
|
4
4
|
super(message);
|
|
@@ -19,6 +19,7 @@ export class SidcCombinationError extends SidcError {
|
|
|
19
19
|
this.name = "SidcCombinationError";
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
const SIX_DIGITS = /^\d{6}$/;
|
|
22
23
|
const TWO_DIGITS = /^\d{2}$/;
|
|
23
24
|
const ONE_DIGIT = /^\d$/;
|
|
24
25
|
// Codes milsymbol's number-based parser recognizes, including ones without
|
|
@@ -29,6 +30,12 @@ const KNOWN_SYMBOL_SETS = [
|
|
|
29
30
|
"12",
|
|
30
31
|
"39",
|
|
31
32
|
];
|
|
33
|
+
const KNOWN_HQ_TASK_FORCE_DUMMY = Object.values(HqTaskForceDummy);
|
|
34
|
+
const KNOWN_AMPLIFIERS = Object.values(Amplifier);
|
|
35
|
+
const KNOWN_STANDARDS = Object.values(Standard);
|
|
36
|
+
const KNOWN_CONTEXTS = Object.values(Context);
|
|
37
|
+
const KNOWN_IDENTITIES = Object.values(StandardIdentity);
|
|
38
|
+
const KNOWN_STATUSES = Object.values(Status);
|
|
32
39
|
const STANDARD_DEFAULT_VERSIONS = {
|
|
33
40
|
[Standard.MilStd2525]: Version.MilStd2525E,
|
|
34
41
|
[Standard.App6]: Version.App6E,
|
|
@@ -66,9 +73,18 @@ export function defaultVersionForStandard(standard) {
|
|
|
66
73
|
export function standardForVersion(version) {
|
|
67
74
|
return VERSION_STANDARDS[version];
|
|
68
75
|
}
|
|
76
|
+
/** Renders any runtime value for an error message without ever throwing. */
|
|
77
|
+
function describeValue(value) {
|
|
78
|
+
try {
|
|
79
|
+
return `"${String(value)}"`;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return Object.prototype.toString.call(value);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
69
85
|
function assertDigits(name, value, pattern, length) {
|
|
70
|
-
if (!pattern.test(value)) {
|
|
71
|
-
throw new SidcValidationError(`${name} must be ${length} digit(s), got
|
|
86
|
+
if (typeof value !== "string" || !pattern.test(value)) {
|
|
87
|
+
throw new SidcValidationError(`${name} must be ${length} digit(s), got ${describeValue(value)}.`);
|
|
72
88
|
}
|
|
73
89
|
}
|
|
74
90
|
/** @internal Validates and stores a two-digit field (version or symbol set). */
|
|
@@ -79,6 +95,72 @@ export function checkTwoDigitField(name, value) {
|
|
|
79
95
|
export function checkOneDigitField(name, value) {
|
|
80
96
|
assertDigits(name, value, ONE_DIGIT, 1);
|
|
81
97
|
}
|
|
98
|
+
/** @internal Validates a six-digit entity field. */
|
|
99
|
+
export function checkSixDigitField(name, value) {
|
|
100
|
+
assertDigits(name, value, SIX_DIGITS, 6);
|
|
101
|
+
}
|
|
102
|
+
/** @internal Validates a named position-8 value. */
|
|
103
|
+
export function checkHqTaskForceDummy(value) {
|
|
104
|
+
checkOneDigitField("HQ/task force/feint-dummy", value);
|
|
105
|
+
if (!KNOWN_HQ_TASK_FORCE_DUMMY.includes(value)) {
|
|
106
|
+
throw new SidcValidationError(`Unknown HQ/task force/feint-dummy code "${value}".`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/** @internal Validates a named amplifier value. */
|
|
110
|
+
export function checkAmplifier(value) {
|
|
111
|
+
checkTwoDigitField("Amplifier", value);
|
|
112
|
+
if (!KNOWN_AMPLIFIERS.includes(value)) {
|
|
113
|
+
throw new SidcValidationError(`Unknown amplifier code "${value}".`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** @internal Validates a standard-family value. */
|
|
117
|
+
export function checkStandard(standard) {
|
|
118
|
+
if (!KNOWN_STANDARDS.includes(standard)) {
|
|
119
|
+
throw new SidcValidationError(`Unknown standard "${standard}".`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/** @internal Validates a context value. */
|
|
123
|
+
export function checkContext(value) {
|
|
124
|
+
checkOneDigitField("Context", value);
|
|
125
|
+
if (!KNOWN_CONTEXTS.includes(value)) {
|
|
126
|
+
throw new SidcValidationError(`Unknown context code "${value}".`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** @internal Validates a standard-identity value. */
|
|
130
|
+
export function checkIdentity(value) {
|
|
131
|
+
checkOneDigitField("Standard identity", value);
|
|
132
|
+
if (!KNOWN_IDENTITIES.includes(value)) {
|
|
133
|
+
throw new SidcValidationError(`Unknown standard identity code "${value}".`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/** @internal Validates a status/condition value. */
|
|
137
|
+
export function checkStatus(value) {
|
|
138
|
+
checkOneDigitField("Status", value);
|
|
139
|
+
if (!KNOWN_STATUSES.includes(value)) {
|
|
140
|
+
throw new SidcValidationError(`Unknown status code "${value}".`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @internal Validates a complete field record.
|
|
145
|
+
*
|
|
146
|
+
* The constructor uses this so every construction path enforces the same
|
|
147
|
+
* digit-width and enum-membership invariants as the fluent setters.
|
|
148
|
+
*/
|
|
149
|
+
export function checkFields(fields) {
|
|
150
|
+
if (fields.standard !== undefined) {
|
|
151
|
+
checkStandard(fields.standard);
|
|
152
|
+
}
|
|
153
|
+
checkTwoDigitField("Version", fields.version);
|
|
154
|
+
checkContext(fields.context);
|
|
155
|
+
checkIdentity(fields.identity);
|
|
156
|
+
checkTwoDigitField("Symbol set", fields.symbolSet);
|
|
157
|
+
checkStatus(fields.status);
|
|
158
|
+
checkHqTaskForceDummy(fields.hqTaskForceDummy);
|
|
159
|
+
checkAmplifier(fields.amplifier);
|
|
160
|
+
checkSixDigitField("Entity", fields.entity);
|
|
161
|
+
checkTwoDigitField("Modifier 1", fields.modifier1);
|
|
162
|
+
checkTwoDigitField("Modifier 2", fields.modifier2);
|
|
163
|
+
}
|
|
82
164
|
/**
|
|
83
165
|
* Cross-field consistency checks mirroring milsymbol's number-based SIDC
|
|
84
166
|
* parsing. Returns human-readable problem descriptions; an empty array means
|
|
@@ -91,7 +173,9 @@ export function findCombinationProblems(fields) {
|
|
|
91
173
|
if (standard !== undefined &&
|
|
92
174
|
versionStandard !== undefined &&
|
|
93
175
|
versionStandard !== standard) {
|
|
94
|
-
problems.push(`Version "${version}" (${EDITION_NAMES[version]}) belongs to
|
|
176
|
+
problems.push(`Version "${version}" (${EDITION_NAMES[version]}) belongs to ` +
|
|
177
|
+
`${STANDARD_NAMES[versionStandard]}, not the configured ` +
|
|
178
|
+
`${STANDARD_NAMES[standard]} standard.`);
|
|
95
179
|
}
|
|
96
180
|
// Condition statuses do not apply to control measures (tactical graphics).
|
|
97
181
|
if (Object.values(Status).includes(status) &&
|
|
@@ -104,11 +188,13 @@ export function findCombinationProblems(fields) {
|
|
|
104
188
|
context === Context.Exercise &&
|
|
105
189
|
identity !== StandardIdentity.Pending &&
|
|
106
190
|
identity !== StandardIdentity.Unknown) {
|
|
107
|
-
problems.push("Exercise symbols on the unknown symbol set render without affiliation
|
|
191
|
+
problems.push("Exercise symbols on the unknown symbol set render without affiliation " +
|
|
192
|
+
"unless identity is pending/unknown.");
|
|
108
193
|
}
|
|
109
194
|
// Symbol sets missing from specific standards' handler lists.
|
|
110
195
|
if (UNSUPPORTED_SYMBOL_SETS[version]?.includes(symbolSet)) {
|
|
111
|
-
problems.push(`Symbol set ${symbolSet} (${SYMBOL_SET_NAMES[symbolSet]}) is not
|
|
196
|
+
problems.push(`Symbol set ${symbolSet} (${SYMBOL_SET_NAMES[symbolSet]}) is not ` +
|
|
197
|
+
`supported by ${EDITION_NAMES[version]}.`);
|
|
112
198
|
}
|
|
113
199
|
return problems;
|
|
114
200
|
}
|
|
@@ -122,6 +208,6 @@ export function unrecognizedCodeWarning(name, value, known) {
|
|
|
122
208
|
}
|
|
123
209
|
return undefined;
|
|
124
210
|
}
|
|
125
|
-
export const knownVersions = KNOWN_VERSIONS;
|
|
126
|
-
export const knownSymbolSets = KNOWN_SYMBOL_SETS;
|
|
211
|
+
export const knownVersions = Object.freeze(KNOWN_VERSIONS);
|
|
212
|
+
export const knownSymbolSets = Object.freeze(KNOWN_SYMBOL_SETS);
|
|
127
213
|
//# sourceMappingURL=validate.js.map
|
package/dist/src/validate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,OAAO,GACR,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAAA,O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;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,IAAY,EACZ,KAAa,EACb,KAAwB;IAExB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,gBAAgB,IAAI,UAAU,KAAK,IAAI,CAAC;IACjD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAsB,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,eAAe,GAC1B,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "milsymbol-sidc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Fluent TypeScript builder for MIL-STD-2525E / APP-6 numeric (20-character) SIDC strings, for use with milsymbol.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/src/index.js",
|
|
@@ -9,14 +9,18 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/src/index.d.ts",
|
|
11
11
|
"default": "./dist/src/index.js"
|
|
12
|
-
}
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
15
|
-
"dist"
|
|
16
|
+
"dist/src"
|
|
16
17
|
],
|
|
17
18
|
"scripts": {
|
|
18
19
|
"build": "tsc",
|
|
19
|
-
"test": "npm run build && node --test
|
|
20
|
+
"test": "npm run build && node --test dist/test/*.test.js",
|
|
21
|
+
"lint": "eslint .",
|
|
22
|
+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" package.json tsconfig.json \".github/**/*.yml\"",
|
|
23
|
+
"format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\" package.json tsconfig.json \".github/**/*.yml\"",
|
|
20
24
|
"prepack": "npm run build"
|
|
21
25
|
},
|
|
22
26
|
"engines": {
|
|
@@ -25,14 +29,27 @@
|
|
|
25
29
|
"keywords": [
|
|
26
30
|
"milsymbol",
|
|
27
31
|
"sidc",
|
|
32
|
+
"symbol-identification-code",
|
|
28
33
|
"mil-std-2525",
|
|
34
|
+
"mil-std-2525e",
|
|
35
|
+
"milstd2525",
|
|
29
36
|
"milstd2525e",
|
|
30
37
|
"app6",
|
|
38
|
+
"app-6",
|
|
39
|
+
"app6e",
|
|
40
|
+
"nato",
|
|
41
|
+
"joint-military-symbology",
|
|
31
42
|
"military",
|
|
43
|
+
"military-symbology",
|
|
32
44
|
"symbology",
|
|
33
|
-
"
|
|
45
|
+
"tactical-graphics",
|
|
46
|
+
"c2",
|
|
47
|
+
"typescript",
|
|
48
|
+
"builder",
|
|
49
|
+
"fluent-api"
|
|
34
50
|
],
|
|
35
51
|
"license": "MIT",
|
|
52
|
+
"author": "Stuart Harding",
|
|
36
53
|
"repository": {
|
|
37
54
|
"type": "git",
|
|
38
55
|
"url": "git+https://github.com/psylsph/milsymbol-sidc.git"
|
|
@@ -42,7 +59,12 @@
|
|
|
42
59
|
},
|
|
43
60
|
"homepage": "https://github.com/psylsph/milsymbol-sidc#readme",
|
|
44
61
|
"devDependencies": {
|
|
62
|
+
"@eslint/js": "^9.39.5",
|
|
45
63
|
"@types/node": "^22.10.2",
|
|
46
|
-
"
|
|
64
|
+
"eslint": "^9.39.5",
|
|
65
|
+
"eslint-config-prettier": "^10.1.8",
|
|
66
|
+
"prettier": "^3.9.6",
|
|
67
|
+
"typescript": "^5.7.2",
|
|
68
|
+
"typescript-eslint": "^8.70.0"
|
|
47
69
|
}
|
|
48
70
|
}
|
package/dist/test/sidc.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sidc.test.d.ts","sourceRoot":"","sources":["../../test/sidc.test.ts"],"names":[],"mappings":""}
|