@zaes/sidc 0.0.0-stage → 0.2.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/CHANGELOG.md +58 -0
- package/LICENSE +21 -0
- package/README.md +24 -3
- package/THIRD-PARTY-NOTICES +217 -0
- package/dist/cjs/2525c/data2525c.js +1965 -0
- package/dist/cjs/2525c/index.js +178 -0
- package/dist/cjs/catalog/data2525e.js +2704 -0
- package/dist/cjs/catalog/dataApp6e.js +85 -0
- package/dist/cjs/catalog/index.js +137 -0
- package/dist/cjs/catalog/types.js +2 -0
- package/dist/cjs/genc.js +298 -0
- package/dist/cjs/index.js +49 -0
- package/dist/cjs/letter.js +116 -0
- package/dist/cjs/numeric.js +127 -0
- package/dist/cjs/tables.js +151 -0
- package/dist/esm/2525c/data2525c.js +1962 -0
- package/dist/esm/2525c/index.js +174 -0
- package/dist/esm/catalog/data2525e.js +2701 -0
- package/dist/esm/catalog/dataApp6e.js +82 -0
- package/dist/esm/catalog/index.js +130 -0
- package/dist/esm/catalog/types.js +1 -0
- package/dist/esm/genc.js +294 -0
- package/dist/esm/index.js +20 -0
- package/dist/esm/letter.js +112 -0
- package/dist/esm/numeric.js +123 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/tables.js +147 -0
- package/dist/types/2525c/data2525c.d.ts +10 -0
- package/dist/types/2525c/index.d.ts +22 -0
- package/dist/types/catalog/data2525e.d.ts +12 -0
- package/dist/types/catalog/dataApp6e.d.ts +15 -0
- package/dist/types/catalog/index.d.ts +31 -0
- package/dist/types/catalog/types.d.ts +46 -0
- package/dist/types/genc.d.ts +12 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/letter.d.ts +51 -0
- package/dist/types/numeric.d.ts +66 -0
- package/dist/types/tables.d.ts +56 -0
- package/package.json +66 -6
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/** 2525C Table A-I, position 1, with the appendix each scheme is defined in. */
|
|
2
|
+
export const CODING_SCHEMES = [
|
|
3
|
+
{ value: 'S', name: 'Warfighting', appendix: 'A' },
|
|
4
|
+
{ value: 'G', name: 'Tactical Graphics', appendix: 'B' },
|
|
5
|
+
{ value: 'W', name: 'Meteorological and Oceanographic', appendix: 'C' },
|
|
6
|
+
{ value: 'I', name: 'Signals Intelligence', appendix: 'D' },
|
|
7
|
+
{ value: 'O', name: 'Stability Operations', appendix: 'E' },
|
|
8
|
+
{ value: 'E', name: 'Emergency Management', appendix: 'G' },
|
|
9
|
+
];
|
|
10
|
+
/** 2525C Table A-I, position 2, with whether it is the exercise form and its frame family. */
|
|
11
|
+
export const LETTER_IDENTITIES = [
|
|
12
|
+
{ value: 'P', name: 'Pending', exercise: false, group: 'Unknown' },
|
|
13
|
+
{ value: 'U', name: 'Unknown', exercise: false, group: 'Unknown' },
|
|
14
|
+
{ value: 'A', name: 'Assumed Friend', exercise: false, group: 'Friend' },
|
|
15
|
+
{ value: 'F', name: 'Friend', exercise: false, group: 'Friend' },
|
|
16
|
+
{ value: 'N', name: 'Neutral', exercise: false, group: 'Neutral' },
|
|
17
|
+
{ value: 'S', name: 'Suspect', exercise: false, group: 'Hostile' },
|
|
18
|
+
{ value: 'H', name: 'Hostile', exercise: false, group: 'Hostile' },
|
|
19
|
+
{ value: 'G', name: 'Exercise Pending', exercise: true, group: 'Unknown' },
|
|
20
|
+
{ value: 'W', name: 'Exercise Unknown', exercise: true, group: 'Unknown' },
|
|
21
|
+
{ value: 'M', name: 'Exercise Assumed Friend', exercise: true, group: 'Friend' },
|
|
22
|
+
{ value: 'D', name: 'Exercise Friend', exercise: true, group: 'Friend' },
|
|
23
|
+
{ value: 'L', name: 'Exercise Neutral', exercise: true, group: 'Neutral' },
|
|
24
|
+
{ value: 'J', name: 'Joker', exercise: true, group: 'Hostile' },
|
|
25
|
+
{ value: 'K', name: 'Faker', exercise: true, group: 'Hostile' },
|
|
26
|
+
];
|
|
27
|
+
/** 2525C Table A-I, position 3, for the warfighting scheme. */
|
|
28
|
+
export const BATTLE_DIMENSIONS = [
|
|
29
|
+
{ value: 'P', name: 'Space' },
|
|
30
|
+
{ value: 'A', name: 'Air' },
|
|
31
|
+
{ value: 'G', name: 'Ground' },
|
|
32
|
+
{ value: 'S', name: 'Sea Surface' },
|
|
33
|
+
{ value: 'U', name: 'Sea Subsurface' },
|
|
34
|
+
{ value: 'F', name: 'SOF' },
|
|
35
|
+
{ value: 'X', name: 'Other (no frame)' },
|
|
36
|
+
{ value: 'Z', name: 'Unknown' },
|
|
37
|
+
];
|
|
38
|
+
/** 2525C Table A-I, position 4. */
|
|
39
|
+
export const LETTER_STATUSES = [
|
|
40
|
+
{ value: 'A', name: 'Anticipated/Planned' },
|
|
41
|
+
{ value: 'P', name: 'Present' },
|
|
42
|
+
{ value: 'C', name: 'Present/Fully capable' },
|
|
43
|
+
{ value: 'D', name: 'Present/Damaged' },
|
|
44
|
+
{ value: 'X', name: 'Present/Destroyed' },
|
|
45
|
+
{ value: 'F', name: 'Present/Full to capacity' },
|
|
46
|
+
];
|
|
47
|
+
/** 2525C Table A-I, position 15. */
|
|
48
|
+
export const ORDERS_OF_BATTLE = [
|
|
49
|
+
{ value: 'A', name: 'Air OB' },
|
|
50
|
+
{ value: 'E', name: 'Electronic OB' },
|
|
51
|
+
{ value: 'C', name: 'Civilian OB' },
|
|
52
|
+
{ value: 'G', name: 'Ground OB' },
|
|
53
|
+
{ value: 'N', name: 'Maritime OB' },
|
|
54
|
+
{ value: 'S', name: 'Strategic Force Related' },
|
|
55
|
+
];
|
|
56
|
+
/** 2525C Table B-I, position 15 of a tactical graphic (coding scheme G). */
|
|
57
|
+
export const GRAPHIC_ORDERS_OF_BATTLE = [{ value: 'X', name: 'Control Markings' }];
|
|
58
|
+
const LETTERS = /^[A-Z0-9*-]{15}$/;
|
|
59
|
+
const unused = (c) => c === '-' || c === '*';
|
|
60
|
+
/**
|
|
61
|
+
* Reads a 2525C letter SIDC. Values the tables don't define are listed in `problems`. A code given
|
|
62
|
+
* without its trailing unused positions (`SFGPUCI` for `SFGPUCI--------`, as some systems store
|
|
63
|
+
* them) is read with dashes filling them, and `problems` says so; at least scheme, identity, dimension
|
|
64
|
+
* and status (4 characters) are needed.
|
|
65
|
+
*/
|
|
66
|
+
export function parseLetterSidc(input) {
|
|
67
|
+
var _a;
|
|
68
|
+
let code = input.trim().toUpperCase();
|
|
69
|
+
const problems = [];
|
|
70
|
+
if (code.length >= 4 && code.length < 15 && /^[A-Z0-9*-]+$/.test(code)) {
|
|
71
|
+
problems.push({ position: code.length + 1, message: `${code.length} characters: positions ${code.length + 1}-15 read as unused (-)` });
|
|
72
|
+
code = code.padEnd(15, '-');
|
|
73
|
+
}
|
|
74
|
+
if (!LETTERS.test(code)) {
|
|
75
|
+
const why = code.length === 15 ? 'has 15 characters of A-Z, 0-9, - and *' : `has 15 characters, not ${code.length}`;
|
|
76
|
+
return { ok: false, problems: [{ position: 1, message: `a 2525C SIDC ${why}` }] };
|
|
77
|
+
}
|
|
78
|
+
const check = (position, value, table, what) => {
|
|
79
|
+
if (!unused(value) && !table.some((e) => e.value === value))
|
|
80
|
+
problems.push({ position, message: `${what} ${value} is not defined` });
|
|
81
|
+
};
|
|
82
|
+
const scheme = code[0];
|
|
83
|
+
check(1, scheme, CODING_SCHEMES, 'coding scheme');
|
|
84
|
+
const metoc = scheme === 'W';
|
|
85
|
+
const identity = metoc ? undefined : LETTER_IDENTITIES.find((e) => e.value === code[1]);
|
|
86
|
+
if (!metoc) {
|
|
87
|
+
check(2, code[1], LETTER_IDENTITIES, 'standard identity');
|
|
88
|
+
if (scheme === 'S')
|
|
89
|
+
check(3, code[2], BATTLE_DIMENSIONS, 'battle dimension');
|
|
90
|
+
check(4, code[3], LETTER_STATUSES, 'status');
|
|
91
|
+
check(15, code[14], scheme === 'G' ? GRAPHIC_ORDERS_OF_BATTLE : ORDERS_OF_BATTLE, 'order of battle');
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
ok: true,
|
|
95
|
+
problems,
|
|
96
|
+
sidc: {
|
|
97
|
+
kind: 'letter',
|
|
98
|
+
standard: '2525C',
|
|
99
|
+
code,
|
|
100
|
+
scheme,
|
|
101
|
+
standardIdentity: code[1],
|
|
102
|
+
standardIdentityGroup: identity === null || identity === void 0 ? void 0 : identity.group,
|
|
103
|
+
exercise: (_a = identity === null || identity === void 0 ? void 0 : identity.exercise) !== null && _a !== void 0 ? _a : false,
|
|
104
|
+
dimension: code[2],
|
|
105
|
+
status: code[3],
|
|
106
|
+
functionId: code.slice(4, 10),
|
|
107
|
+
modifier: code.slice(10, 12),
|
|
108
|
+
country: code.slice(12, 14),
|
|
109
|
+
orderOfBattle: code[14],
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The numeric SIDC of MIL-STD-2525D and 2525E (Appendix A, A.5): 20 positions in 2525D, 30 in
|
|
3
|
+
* 2525E. A 20-position code read as 2525E has an all-zero Set C.
|
|
4
|
+
*
|
|
5
|
+
* Set A 1–2 version · 3 context · 4 standard identity · 5–6 symbol set · 7 status ·
|
|
6
|
+
* 8 headquarters/task force/dummy · 9–10 amplifying descriptor
|
|
7
|
+
* Set B 11–16 entity, entity type, entity subtype · 17–18 sector 1 modifier · 19–20 sector 2 modifier
|
|
8
|
+
* Set C 21 sector 1 modifier identifier · 22 sector 2 modifier identifier · 23 frame shape ·
|
|
9
|
+
* 24–27 reserved · 28–30 country (GENC numeric)
|
|
10
|
+
*/
|
|
11
|
+
import { AMPLIFYING_DESCRIPTORS, CONTEXTS, FRAME_SHAPES, HQ_TF_DUMMY, STANDARD_IDENTITIES, STATUSES, SYMBOL_SETS, SYMBOL_SETS_2525D_ONLY, SYMBOL_SETS_APP6E_ONLY, VERSIONS, lookup, } from './tables.js';
|
|
12
|
+
const NUMERIC = /^[0-9A-F]+$/;
|
|
13
|
+
/**
|
|
14
|
+
* Reads a numeric SIDC. A code of the wrong length or with characters outside [0-9A-F] fails; a
|
|
15
|
+
* well-formed code with values the tables don't define parses, with each one listed in `problems`,
|
|
16
|
+
* so a caller can decide whether to draw it.
|
|
17
|
+
*/
|
|
18
|
+
export function parseNumericSidc(input) {
|
|
19
|
+
const code = input.trim().toUpperCase();
|
|
20
|
+
if (code.length !== 20 && code.length !== 30) {
|
|
21
|
+
return { ok: false, problems: [{ position: 1, message: `a numeric SIDC has 20 or 30 positions, not ${code.length}` }] };
|
|
22
|
+
}
|
|
23
|
+
if (!NUMERIC.test(code))
|
|
24
|
+
return { ok: false, problems: [{ position: firstBad(code) + 1, message: 'a numeric SIDC holds only 0-9 and A-F' }] };
|
|
25
|
+
const at = (from, to = from) => code.slice(from - 1, to);
|
|
26
|
+
const problems = [];
|
|
27
|
+
const check = (position, value, known, what) => {
|
|
28
|
+
if (!known)
|
|
29
|
+
problems.push({ position, message: `${what} ${value} is not defined` });
|
|
30
|
+
};
|
|
31
|
+
const version = at(1, 2);
|
|
32
|
+
const versionEntry = lookup(VERSIONS, version);
|
|
33
|
+
check(1, version, !!versionEntry, 'version');
|
|
34
|
+
const standard = versionEntry === null || versionEntry === void 0 ? void 0 : versionEntry.standard;
|
|
35
|
+
const context = at(3);
|
|
36
|
+
check(3, context, !!lookup(CONTEXTS, context), 'context');
|
|
37
|
+
const standardIdentity = at(4);
|
|
38
|
+
const identity = lookup(STANDARD_IDENTITIES, standardIdentity);
|
|
39
|
+
check(4, standardIdentity, !!identity, 'standard identity');
|
|
40
|
+
const symbolSet = at(5, 6);
|
|
41
|
+
// 2525D and APP-6 split signals intelligence by dimension (50-54); APP-6(E) adds 64 (Table A-4).
|
|
42
|
+
const legacySigint = [...SYMBOL_SETS.filter((s) => s.value !== '50'), ...SYMBOL_SETS_2525D_ONLY];
|
|
43
|
+
const sets = standard === '2525D' || standard === 'APP-6D' ? legacySigint : standard === 'APP-6E' ? [...legacySigint, ...SYMBOL_SETS_APP6E_ONLY] : SYMBOL_SETS;
|
|
44
|
+
check(5, symbolSet, !!lookup(sets, symbolSet), 'symbol set');
|
|
45
|
+
const status = at(7);
|
|
46
|
+
check(7, status, !!lookup(STATUSES, status), 'status');
|
|
47
|
+
const hqTfDummy = at(8);
|
|
48
|
+
check(8, hqTfDummy, !!lookup(HQ_TF_DUMMY, hqTfDummy), 'headquarters/task force/dummy');
|
|
49
|
+
const flags = Number.parseInt(hqTfDummy, 16);
|
|
50
|
+
const amplifyingDescriptor = at(9, 10);
|
|
51
|
+
check(9, amplifyingDescriptor, !!lookup(AMPLIFYING_DESCRIPTORS, amplifyingDescriptor), 'amplifying descriptor');
|
|
52
|
+
const long = code.length === 30;
|
|
53
|
+
if (!long && (standard === '2525E' || standard === 'APP-6E')) {
|
|
54
|
+
problems.push({ position: 21, message: 'a 2525E code has 30 positions; read with an all-zero Set C' });
|
|
55
|
+
}
|
|
56
|
+
const frameShape = long ? at(23) : '0';
|
|
57
|
+
check(23, frameShape, !!lookup(FRAME_SHAPES, frameShape), 'frame shape');
|
|
58
|
+
if (long && at(24, 27) !== '0000')
|
|
59
|
+
problems.push({ position: 24, message: 'positions 24–27 are reserved and should be 0' });
|
|
60
|
+
return {
|
|
61
|
+
ok: true,
|
|
62
|
+
problems,
|
|
63
|
+
sidc: {
|
|
64
|
+
kind: 'numeric',
|
|
65
|
+
code,
|
|
66
|
+
standard,
|
|
67
|
+
version,
|
|
68
|
+
context,
|
|
69
|
+
standardIdentity,
|
|
70
|
+
standardIdentityGroup: identity === null || identity === void 0 ? void 0 : identity.group,
|
|
71
|
+
symbolSet,
|
|
72
|
+
status,
|
|
73
|
+
hqTfDummy,
|
|
74
|
+
feintDummy: (flags & 1) !== 0,
|
|
75
|
+
headquarters: (flags & 2) !== 0,
|
|
76
|
+
taskForce: (flags & 4) !== 0,
|
|
77
|
+
amplifyingDescriptor,
|
|
78
|
+
entityCode: at(11, 16),
|
|
79
|
+
sector1: at(17, 18),
|
|
80
|
+
sector2: at(19, 20),
|
|
81
|
+
sector1Identifier: long ? at(21) : '0',
|
|
82
|
+
sector2Identifier: long ? at(22) : '0',
|
|
83
|
+
frameShape,
|
|
84
|
+
country: long ? at(28, 30) : '000',
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Writes a 30-position 2525E SIDC (version 15 unless given). Each field is padded to its width; a field
|
|
90
|
+
* longer than its width throws a RangeError naming it (cutting it would write another symbol's code).
|
|
91
|
+
*/
|
|
92
|
+
export function formatNumericSidc(fields) {
|
|
93
|
+
var _a;
|
|
94
|
+
const f = (value, width, name = '') => {
|
|
95
|
+
const v = value !== null && value !== void 0 ? value : '';
|
|
96
|
+
if (v.length > width)
|
|
97
|
+
throw new RangeError(`formatNumericSidc: ${name || 'a field'} "${v}" is longer than its ${width} positions`);
|
|
98
|
+
return v.padStart(width, '0');
|
|
99
|
+
};
|
|
100
|
+
return [
|
|
101
|
+
f((_a = fields.version) !== null && _a !== void 0 ? _a : '15', 2, 'version'),
|
|
102
|
+
f(fields.context, 1, 'context'),
|
|
103
|
+
f(fields.standardIdentity, 1, 'standardIdentity'),
|
|
104
|
+
f(fields.symbolSet, 2, 'symbolSet'),
|
|
105
|
+
f(fields.status, 1, 'status'),
|
|
106
|
+
f(fields.hqTfDummy, 1, 'hqTfDummy'),
|
|
107
|
+
f(fields.amplifyingDescriptor, 2, 'amplifyingDescriptor'),
|
|
108
|
+
f(fields.entityCode, 6, 'entityCode'),
|
|
109
|
+
f(fields.sector1, 2, 'sector1'),
|
|
110
|
+
f(fields.sector2, 2, 'sector2'),
|
|
111
|
+
f(fields.sector1Identifier, 1, 'sector1Identifier'),
|
|
112
|
+
f(fields.sector2Identifier, 1, 'sector2Identifier'),
|
|
113
|
+
f(fields.frameShape, 1, 'frameShape'),
|
|
114
|
+
'0000',
|
|
115
|
+
f(fields.country, 3, 'country'),
|
|
116
|
+
].join('');
|
|
117
|
+
}
|
|
118
|
+
function firstBad(code) {
|
|
119
|
+
for (let i = 0; i < code.length; i++)
|
|
120
|
+
if (!NUMERIC.test(code[i]))
|
|
121
|
+
return i;
|
|
122
|
+
return 0;
|
|
123
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fixed code tables of the numeric SIDC, transcribed from MIL-STD-2525E Change 1, Appendix A.
|
|
3
|
+
* Each table names its source so a reviewer can check it against the standard line by line.
|
|
4
|
+
* The entity and modifier tables (A-XI onward) are generated, not typed here.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Table A-I, Version. Value 10 is shared by 2525D and APP-6(D)(1), which the standard says carry
|
|
8
|
+
* the same versioning; `standard` gives the US one. 12, APP-6(D)(2), was withdrawn but codes
|
|
9
|
+
* carrying it may still exist. 17–3F are reserved.
|
|
10
|
+
*/
|
|
11
|
+
export const VERSIONS = [
|
|
12
|
+
{ value: '10', name: 'MIL-STD-2525D / APP-06(D)(1)', standard: '2525D', released: 'June 2014' },
|
|
13
|
+
{ value: '11', name: 'MIL-STD-2525D(1)', standard: '2525D', released: '2018-08-02' },
|
|
14
|
+
{ value: '12', name: 'APP-06(D)(2)', standard: 'APP-6D', released: 'Withdrawn' },
|
|
15
|
+
{ value: '13', name: 'MIL-STD-2525E', standard: '2525E', released: '2022-12-31' },
|
|
16
|
+
{ value: '14', name: 'APP-06(E)(1)', standard: 'APP-6E', released: 'October 2023' },
|
|
17
|
+
{ value: '15', name: 'MIL-STD-2525E(1)', standard: '2525E', released: '2025-03-02' },
|
|
18
|
+
{ value: '16', name: 'APP-06(E)(2)', standard: 'APP-6E', released: '2025-10-14' },
|
|
19
|
+
];
|
|
20
|
+
/** Table A-II, first position: the context. */
|
|
21
|
+
export const CONTEXTS = [
|
|
22
|
+
{ value: '0', name: 'Reality' },
|
|
23
|
+
{ value: '1', name: 'Exercise' },
|
|
24
|
+
{ value: '2', name: 'Simulation' },
|
|
25
|
+
{ value: '3', name: 'Restricted Target – Reality' },
|
|
26
|
+
{ value: '4', name: 'No-Strike Entity – Reality' },
|
|
27
|
+
{ value: '5', name: 'Restricted Target – Exercise' },
|
|
28
|
+
{ value: '6', name: 'No-Strike Entity – Exercise' },
|
|
29
|
+
{ value: '7', name: 'Restricted Target – Simulation' },
|
|
30
|
+
{ value: '8', name: 'No-Strike Entity – Simulation' },
|
|
31
|
+
];
|
|
32
|
+
/** Table A-II, second position: the standard identity, with its Table A-III group. */
|
|
33
|
+
export const STANDARD_IDENTITIES = [
|
|
34
|
+
{ value: '0', name: 'Pending', group: 'Unknown' },
|
|
35
|
+
{ value: '1', name: 'Unknown', group: 'Unknown' },
|
|
36
|
+
{ value: '2', name: 'Assumed Friend', group: 'Friend' },
|
|
37
|
+
{ value: '3', name: 'Friend', group: 'Friend' },
|
|
38
|
+
{ value: '4', name: 'Neutral', group: 'Neutral' },
|
|
39
|
+
{ value: '5', name: 'Suspect/Joker', group: 'Hostile' },
|
|
40
|
+
{ value: '6', name: 'Hostile/Faker', group: 'Hostile' },
|
|
41
|
+
];
|
|
42
|
+
/** Table A-IV, Symbol sets (2525E). 2525D's 51–54 are not here: E folded them into 50. */
|
|
43
|
+
export const SYMBOL_SETS = [
|
|
44
|
+
{ value: '00', name: 'Unknown' },
|
|
45
|
+
{ value: '01', name: 'Air' },
|
|
46
|
+
{ value: '02', name: 'Air Missile' },
|
|
47
|
+
{ value: '05', name: 'Space' },
|
|
48
|
+
{ value: '06', name: 'Space Missile' },
|
|
49
|
+
{ value: '10', name: 'Land Unit' },
|
|
50
|
+
{ value: '11', name: 'Land Civilian Unit/Organization' },
|
|
51
|
+
{ value: '15', name: 'Land Equipment' },
|
|
52
|
+
{ value: '20', name: 'Land Installation' },
|
|
53
|
+
{ value: '25', name: 'Control Measures and Planning Symbols' },
|
|
54
|
+
{ value: '27', name: 'Dismounted Individuals' },
|
|
55
|
+
{ value: '30', name: 'Sea Surface' },
|
|
56
|
+
{ value: '35', name: 'Sea Subsurface' },
|
|
57
|
+
{ value: '36', name: 'Mine Warfare' },
|
|
58
|
+
{ value: '40', name: 'Activities' },
|
|
59
|
+
{ value: '45', name: 'Atmospheric' },
|
|
60
|
+
{ value: '46', name: 'Oceanographic' },
|
|
61
|
+
{ value: '47', name: 'Meteorological Space' },
|
|
62
|
+
{ value: '50', name: 'Signals Intelligence' },
|
|
63
|
+
{ value: '60', name: 'Cyberspace - Virtual' },
|
|
64
|
+
];
|
|
65
|
+
/** 2525D's signals-intelligence sets (2525D Table A-III), accepted as 2525D input only. */
|
|
66
|
+
export const SYMBOL_SETS_2525D_ONLY = [
|
|
67
|
+
{ value: '50', name: 'Signals Intelligence – Space' },
|
|
68
|
+
{ value: '51', name: 'Signals Intelligence – Air' },
|
|
69
|
+
{ value: '52', name: 'Signals Intelligence – Land' },
|
|
70
|
+
{ value: '53', name: 'Signals Intelligence – Surface' },
|
|
71
|
+
{ value: '54', name: 'Signals Intelligence – Subsurface' },
|
|
72
|
+
];
|
|
73
|
+
/**
|
|
74
|
+
* APP-6(E)'s own set (APP-6(E) Edition E Version 2, Table A-4), accepted as APP-6(E) input only. APP-6(E)
|
|
75
|
+
* also keeps the five signals-intelligence sets 50-54 of 2525D (above), where 2525E has the single set 50.
|
|
76
|
+
*/
|
|
77
|
+
export const SYMBOL_SETS_APP6E_ONLY = [{ value: '64', name: 'Cyberspace – Non Unit' }];
|
|
78
|
+
/** Table A-VI, Status. The same position may carry an operational condition instead (A.5.3.4.1). */
|
|
79
|
+
export const STATUSES = [
|
|
80
|
+
{ value: '0', name: 'Present' },
|
|
81
|
+
{ value: '1', name: 'Planned/Anticipated/Suspect' },
|
|
82
|
+
{ value: '2', name: 'Present/Fully capable' },
|
|
83
|
+
{ value: '3', name: 'Present/Damaged' },
|
|
84
|
+
{ value: '4', name: 'Present/Destroyed' },
|
|
85
|
+
{ value: '5', name: 'Present/Full to capacity' },
|
|
86
|
+
];
|
|
87
|
+
/** Table A-VII, Headquarters/task force/dummy: three flags, one digit. */
|
|
88
|
+
export const HQ_TF_DUMMY = [
|
|
89
|
+
{ value: '0', name: 'Unknown' },
|
|
90
|
+
{ value: '1', name: 'Feint/Decoy/Dummy' },
|
|
91
|
+
{ value: '2', name: 'Headquarters' },
|
|
92
|
+
{ value: '3', name: 'Feint/Dummy Headquarters' },
|
|
93
|
+
{ value: '4', name: 'Task Force' },
|
|
94
|
+
{ value: '5', name: 'Feint/Dummy Task Force' },
|
|
95
|
+
{ value: '6', name: 'Task Force Headquarters' },
|
|
96
|
+
{ value: '7', name: 'Feint/Dummy Task Force Headquarters' },
|
|
97
|
+
];
|
|
98
|
+
/** Table A-VIII, Amplifying descriptor (positions 9–10): echelon, mobility, towed array or leadership. */
|
|
99
|
+
export const AMPLIFYING_DESCRIPTORS = [
|
|
100
|
+
{ value: '00', name: 'Unknown', kind: 'none' },
|
|
101
|
+
{ value: '11', name: 'Team/Crew', kind: 'echelon' },
|
|
102
|
+
{ value: '12', name: 'Squad', kind: 'echelon' },
|
|
103
|
+
{ value: '13', name: 'Section', kind: 'echelon' },
|
|
104
|
+
{ value: '14', name: 'Platoon/Detachment', kind: 'echelon' },
|
|
105
|
+
{ value: '15', name: 'Company/Battery/Troop', kind: 'echelon' },
|
|
106
|
+
{ value: '16', name: 'Battalion/Squadron', kind: 'echelon' },
|
|
107
|
+
{ value: '17', name: 'Regiment/Group', kind: 'echelon' },
|
|
108
|
+
{ value: '18', name: 'Brigade', kind: 'echelon' },
|
|
109
|
+
{ value: '21', name: 'Division', kind: 'echelon' },
|
|
110
|
+
{ value: '22', name: 'Corps/MEF', kind: 'echelon' },
|
|
111
|
+
{ value: '23', name: 'Army', kind: 'echelon' },
|
|
112
|
+
{ value: '24', name: 'Army Group/Front', kind: 'echelon' },
|
|
113
|
+
{ value: '25', name: 'Region/Theater', kind: 'echelon' },
|
|
114
|
+
{ value: '26', name: 'Command', kind: 'echelon' },
|
|
115
|
+
{ value: '31', name: 'Wheeled limited cross country', kind: 'mobility' },
|
|
116
|
+
{ value: '32', name: 'Wheeled cross country', kind: 'mobility' },
|
|
117
|
+
{ value: '33', name: 'Tracked', kind: 'mobility' },
|
|
118
|
+
{ value: '34', name: 'Wheeled and tracked combination', kind: 'mobility' },
|
|
119
|
+
{ value: '35', name: 'Towed', kind: 'mobility' },
|
|
120
|
+
{ value: '36', name: 'Rail', kind: 'mobility' },
|
|
121
|
+
{ value: '37', name: 'Pack animals', kind: 'mobility' },
|
|
122
|
+
{ value: '41', name: 'Over-snow (prime mover)', kind: 'mobility' },
|
|
123
|
+
{ value: '42', name: 'Sled', kind: 'mobility' },
|
|
124
|
+
{ value: '51', name: 'Barge', kind: 'mobility' },
|
|
125
|
+
{ value: '52', name: 'Amphibious', kind: 'mobility' },
|
|
126
|
+
{ value: '61', name: 'Short towed array', kind: 'towedArray' },
|
|
127
|
+
{ value: '62', name: 'Long towed array', kind: 'towedArray' },
|
|
128
|
+
{ value: '71', name: 'Leader Individual', kind: 'leadership' },
|
|
129
|
+
];
|
|
130
|
+
/** Table A-LX, Frame shape (position 23): overrides the frame the symbol set would draw. */
|
|
131
|
+
export const FRAME_SHAPES = [
|
|
132
|
+
{ value: '0', name: 'Unknown' },
|
|
133
|
+
{ value: '1', name: 'Space' },
|
|
134
|
+
{ value: '2', name: 'Air' },
|
|
135
|
+
{ value: '3', name: 'Land Unit' },
|
|
136
|
+
{ value: '4', name: 'Land Equipment' },
|
|
137
|
+
{ value: '5', name: 'Land Installation' },
|
|
138
|
+
{ value: '6', name: 'Dismounted Individuals' },
|
|
139
|
+
{ value: '7', name: 'Sea Subsurface' },
|
|
140
|
+
{ value: '8', name: 'Activity/Event' },
|
|
141
|
+
{ value: '9', name: 'Cyberspace' },
|
|
142
|
+
{ value: 'A', name: 'Sea Surface' },
|
|
143
|
+
];
|
|
144
|
+
/** Looks a value up in one of the tables above. */
|
|
145
|
+
export function lookup(table, value) {
|
|
146
|
+
return table.find((e) => e.value === value);
|
|
147
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 2525C letter codes to later symbols: [version, symbol set, entity, sector 1, sector 2, note]. The
|
|
3
|
+
* version is 2525D's (10, 11) but for a few rows that need 2525E's common modifiers (15). A code with
|
|
4
|
+
* per-use positions is keyed by coding scheme, battle dimension or category, and function ID
|
|
5
|
+
* (positions 1, 3 and 5-10); a weather code, which has none, by '=' and all 15 positions. The note
|
|
6
|
+
* says where the two versions draw a symbol differently. Generated from the crosswalk named in
|
|
7
|
+
* THIRD-PARTY-NOTICES. Do not edit.
|
|
8
|
+
*/
|
|
9
|
+
/** 1951 symbols. */
|
|
10
|
+
export declare const C_TO_D: Readonly<Record<string, readonly [string, string, string, string, string, string]>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Problem } from '../numeric.js';
|
|
2
|
+
import { C_TO_D } from './data2525c.js';
|
|
3
|
+
export { C_TO_D };
|
|
4
|
+
export type Convert2525CResult = {
|
|
5
|
+
readonly ok: true;
|
|
6
|
+
/** The 30-position code: 2525D (version 10 or 11), or 2525E (15) where the symbol needs its common modifiers. */
|
|
7
|
+
readonly sidc: string;
|
|
8
|
+
readonly problems: readonly Problem[];
|
|
9
|
+
/** Where the crosswalk says 2525C and 2525D draw or name the symbol differently. */
|
|
10
|
+
readonly note?: string;
|
|
11
|
+
/** The function ID the crosswalk matched, when the code's own was not listed and a parent's was. */
|
|
12
|
+
readonly matched?: string;
|
|
13
|
+
} | {
|
|
14
|
+
readonly ok: false;
|
|
15
|
+
readonly problems: readonly Problem[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Converts a 2525C letter code to a 30-position 2525D (or 2525E) code. A function ID the crosswalk does not list
|
|
19
|
+
* is converted as its nearest listed parent, with a problem; values the tables don't define are
|
|
20
|
+
* problems too, and only a code with no listed parent at all fails.
|
|
21
|
+
*/
|
|
22
|
+
export declare function convert2525C(input: string): Convert2525CResult;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIL-STD-2525E Change 1: every entity (Appendix A, Tables A-XI to A-LVII) with its kind, Appendix A
|
|
3
|
+
* geometry, draw rule (Appendix L, or M for sets 45 and 46) and icon type (Appendices C-K), and
|
|
4
|
+
* every sector modifier (Tables A-IX to A-LIX).
|
|
5
|
+
*
|
|
6
|
+
* Generated from the standard's text. Do not edit: correct the reading instead.
|
|
7
|
+
*/
|
|
8
|
+
import type { EntityRow, ModifierRow } from './types.js';
|
|
9
|
+
/** 2057 entities: 14 frame, 171 hierarchy, 977 icon, 436 multipoint, 459 point. */
|
|
10
|
+
export declare const ENTITIES_2525E: readonly EntityRow[];
|
|
11
|
+
/** 638 sector modifiers; `common` rows are Tables A-IX and A-X, their code led by the identifier. */
|
|
12
|
+
export declare const MODIFIERS_2525E: readonly ModifierRow[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* APP-6(E) Version 2: the entities it defines that MIL-STD-2525E Change 1 does not (an APP-6(E) code reads
|
|
3
|
+
* every other entity from 2525E's tables), with their kind and icon type, read from its icon tables.
|
|
4
|
+
*
|
|
5
|
+
* Generated from the standard's text. Do not edit: correct the reading instead.
|
|
6
|
+
*/
|
|
7
|
+
import type { EntityRow } from './types.js';
|
|
8
|
+
/** 59 entities: 4 hierarchy, 53 icon, 2 multipoint. */
|
|
9
|
+
export declare const ENTITIES_APP6E: readonly EntityRow[];
|
|
10
|
+
/**
|
|
11
|
+
* Those of them MIL-STD-2525D (2014) also defines (its appendices give each an entry), by set and code, with
|
|
12
|
+
* 2525D's own path (its entry's Entity line, then its name, last): a 2525D or APP-6(D) code names them so. Read
|
|
13
|
+
* from the 2525D PDF the same way.
|
|
14
|
+
*/
|
|
15
|
+
export declare const APP6E_IN_2525D: Readonly<Record<string, readonly string[]>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { NumericSidc } from '../numeric.js';
|
|
2
|
+
import type { Entity, EntityKind, SectorModifier } from './types.js';
|
|
3
|
+
export type { Entity, EntityKind, SectorModifier } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* The entity a symbol set and positions 11–16 name, or undefined if 2525E Change 1 has none. For an APP-6(E)
|
|
6
|
+
* code (`standard` 'APP-6E', as `parseSidc` reads versions 14 and 16), also the entities APP-6(E) adds; for a
|
|
7
|
+
* 2525D or APP-6(D) code ('2525D', 'APP-6D'), those of them 2525D defines as well, with 2525D's own name and path.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getEntity(symbolSet: string, code: string, standard?: string): Entity | undefined;
|
|
10
|
+
/** Every entity, in the standard's order, optionally of one symbol set or kind. */
|
|
11
|
+
export declare function listEntities(filter?: {
|
|
12
|
+
symbolSet?: string;
|
|
13
|
+
kind?: EntityKind;
|
|
14
|
+
}): Entity[];
|
|
15
|
+
/**
|
|
16
|
+
* The sector modifier a code names. `identifier` is SIDC position 21 (sector 1) or 22 (sector 2):
|
|
17
|
+
* '0' looks in the symbol set's own table, anything else in the common table (A-IX, A-X), whose
|
|
18
|
+
* codes are the identifier followed by the two modifier positions.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getSectorModifier(symbolSet: string, sector: 1 | 2, code: string, identifier?: string): SectorModifier | undefined;
|
|
21
|
+
/** The sector modifiers of one symbol set (or `common`), in the standard's order. */
|
|
22
|
+
export declare function listSectorModifiers(symbolSet: string, sector: 1 | 2): SectorModifier[];
|
|
23
|
+
export interface SidcDescription {
|
|
24
|
+
readonly entity?: Entity;
|
|
25
|
+
readonly sector1?: SectorModifier;
|
|
26
|
+
readonly sector2?: SectorModifier;
|
|
27
|
+
/** Codes in positions 11–20 that 2525E Change 1 does not define. */
|
|
28
|
+
readonly problems: readonly string[];
|
|
29
|
+
}
|
|
30
|
+
/** What positions 11–20 of a 2525D/E code mean, by the 2525E Change 1 tables. */
|
|
31
|
+
export declare function describeSidc(sidc: NumericSidc | string): SidcDescription;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What kind of drawing an entity is:
|
|
3
|
+
*
|
|
4
|
+
* - `icon`: an icon inside a frame (every framed symbol set);
|
|
5
|
+
* - `frame`: the `000000` Unspecified entity, a frame with no icon;
|
|
6
|
+
* - `point`: a control measure or METOC symbol placed at one anchor point at a fixed screen size;
|
|
7
|
+
* - `multipoint`: a line, an area, or a one-anchor shape sized in map units (a range fan, a circular
|
|
8
|
+
* target);
|
|
9
|
+
* - `hierarchy`: a heading in the table with nothing of its own to draw.
|
|
10
|
+
*/
|
|
11
|
+
export type EntityKind = 'icon' | 'frame' | 'point' | 'multipoint' | 'hierarchy';
|
|
12
|
+
/** One generated entity row: [symbolSet, code, name, kind, Appendix A geometry, draw rule, icon type]. */
|
|
13
|
+
export type EntityRow = readonly [string, string, string, EntityKind, string, string, string];
|
|
14
|
+
/** One generated sector-modifier row: [symbolSet or 'common', sector, code, name, category]. */
|
|
15
|
+
export type ModifierRow = readonly [string, 1 | 2 | number, string, string, string];
|
|
16
|
+
export interface Entity {
|
|
17
|
+
readonly symbolSet: string;
|
|
18
|
+
/** Positions 11–16. */
|
|
19
|
+
readonly code: string;
|
|
20
|
+
/** The name as Appendix A gives it, at its own level (an entity subtype names only itself). */
|
|
21
|
+
readonly name: string;
|
|
22
|
+
/** Names from the entity down to this one, for display: `['Weapon/Weapon System', 'Machine Gun', 'Light']`. */
|
|
23
|
+
readonly path: readonly string[];
|
|
24
|
+
readonly kind: EntityKind;
|
|
25
|
+
/** Appendix A's geometry column (sets 25, 45, 46), where it has one. The draw rule is authoritative. */
|
|
26
|
+
readonly tableGeometry?: 'Point' | 'Line' | 'Area';
|
|
27
|
+
/** The draw rule: Appendix L's for set 25, Appendix M's (its own numbering) for sets 45 and 46. */
|
|
28
|
+
readonly drawRule?: string;
|
|
29
|
+
readonly drawRuleAppendix?: 'L' | 'M';
|
|
30
|
+
/** How the icon fills the frame (Appendices C–K): `Main`, `Main+1`, `Full Octagon` or `Full Frame`. */
|
|
31
|
+
readonly iconType?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Set for an entity APP-6(E) defines and 2525E Change 1 does not: found for an APP-6(E) code, and for a
|
|
34
|
+
* 2525D or APP-6(D) code where 2525D defines it too.
|
|
35
|
+
*/
|
|
36
|
+
readonly standard?: 'APP-6E';
|
|
37
|
+
}
|
|
38
|
+
export interface SectorModifier {
|
|
39
|
+
/** The symbol set, or `common` for Appendix A Tables A-IX and A-X. */
|
|
40
|
+
readonly symbolSet: string;
|
|
41
|
+
readonly sector: 1 | 2;
|
|
42
|
+
/** As the table prints it: two characters, or three for a common modifier (identifier first). */
|
|
43
|
+
readonly code: string;
|
|
44
|
+
readonly name: string;
|
|
45
|
+
readonly category: string;
|
|
46
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENC (Geopolitical Entities, Names, and Codes) countries and entities by numeric code: SIDC
|
|
3
|
+
* positions 28–30 (MIL-STD-2525E A.5.5.4). Generated; do not edit.
|
|
4
|
+
*/
|
|
5
|
+
/** [numeric, trigraph, digraph ('' where none is assigned), name]. 280 entries. */
|
|
6
|
+
export declare const GENC_COUNTRIES: readonly (readonly [string, string, string, string])[];
|
|
7
|
+
/** The country a three-digit GENC numeric code names, or undefined for '000' and unknown codes. */
|
|
8
|
+
export declare function gencCountry(numeric: string): {
|
|
9
|
+
trigraph: string;
|
|
10
|
+
digraph: string;
|
|
11
|
+
name: string;
|
|
12
|
+
} | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zaes/sidc — symbol identification codes of MIL-STD-2525C, 2525D and 2525E (and APP-6 D/E):
|
|
3
|
+
* read, validate and write them. No dependencies, no DOM, no drawing.
|
|
4
|
+
*
|
|
5
|
+
* @module @zaes/sidc
|
|
6
|
+
*/
|
|
7
|
+
import { type LetterSidc } from './letter.js';
|
|
8
|
+
import { type NumericSidc, type ParseResult } from './numeric.js';
|
|
9
|
+
export * from './tables.js';
|
|
10
|
+
export { parseNumericSidc, formatNumericSidc, type NumericSidc, type NumericSidcFields, type ParseResult, type Problem } from './numeric.js';
|
|
11
|
+
export { parseLetterSidc, CODING_SCHEMES, LETTER_IDENTITIES, BATTLE_DIMENSIONS, LETTER_STATUSES, ORDERS_OF_BATTLE, GRAPHIC_ORDERS_OF_BATTLE, type LetterSidc } from './letter.js';
|
|
12
|
+
export type Sidc = NumericSidc | LetterSidc;
|
|
13
|
+
/** Reads any SIDC: starting with a letter is 2525C (15 characters); 20 or 30 digits is numeric. */
|
|
14
|
+
export declare function parseSidc(input: string): ParseResult<Sidc>;
|
|
15
|
+
export { GENC_COUNTRIES, gencCountry } from './genc.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The 15-character letter SIDC of MIL-STD-2525C (Appendix A, A.5.2 and Table A-I):
|
|
3
|
+
*
|
|
4
|
+
* 1 coding scheme · 2 standard identity · 3 battle dimension (or category) · 4 status ·
|
|
5
|
+
* 5–10 function ID · 11–12 symbol modifier · 13–14 country (ISO 3166-1) · 15 order of battle
|
|
6
|
+
*
|
|
7
|
+
* A dash fills an unused position and an asterisk a user-defined one. METOC (`W`) codes use their
|
|
8
|
+
* own layout (2525C Appendix C) and are read only for scheme and length here.
|
|
9
|
+
*/
|
|
10
|
+
import type { CodeEntry, StandardIdentityGroup } from './tables.js';
|
|
11
|
+
import type { ParseResult } from './numeric.js';
|
|
12
|
+
/** 2525C Table A-I, position 1, with the appendix each scheme is defined in. */
|
|
13
|
+
export declare const CODING_SCHEMES: readonly (CodeEntry & {
|
|
14
|
+
appendix: string;
|
|
15
|
+
})[];
|
|
16
|
+
/** 2525C Table A-I, position 2, with whether it is the exercise form and its frame family. */
|
|
17
|
+
export declare const LETTER_IDENTITIES: readonly (CodeEntry & {
|
|
18
|
+
exercise: boolean;
|
|
19
|
+
group: StandardIdentityGroup;
|
|
20
|
+
})[];
|
|
21
|
+
/** 2525C Table A-I, position 3, for the warfighting scheme. */
|
|
22
|
+
export declare const BATTLE_DIMENSIONS: readonly CodeEntry[];
|
|
23
|
+
/** 2525C Table A-I, position 4. */
|
|
24
|
+
export declare const LETTER_STATUSES: readonly CodeEntry[];
|
|
25
|
+
/** 2525C Table A-I, position 15. */
|
|
26
|
+
export declare const ORDERS_OF_BATTLE: readonly CodeEntry[];
|
|
27
|
+
/** 2525C Table B-I, position 15 of a tactical graphic (coding scheme G). */
|
|
28
|
+
export declare const GRAPHIC_ORDERS_OF_BATTLE: readonly CodeEntry[];
|
|
29
|
+
export interface LetterSidc {
|
|
30
|
+
readonly kind: 'letter';
|
|
31
|
+
readonly standard: '2525C';
|
|
32
|
+
readonly code: string;
|
|
33
|
+
readonly scheme: string;
|
|
34
|
+
readonly standardIdentity: string;
|
|
35
|
+
readonly standardIdentityGroup: StandardIdentityGroup | undefined;
|
|
36
|
+
readonly exercise: boolean;
|
|
37
|
+
/** Battle dimension for the warfighting scheme; the category for the others. */
|
|
38
|
+
readonly dimension: string;
|
|
39
|
+
readonly status: string;
|
|
40
|
+
readonly functionId: string;
|
|
41
|
+
readonly modifier: string;
|
|
42
|
+
readonly country: string;
|
|
43
|
+
readonly orderOfBattle: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Reads a 2525C letter SIDC. Values the tables don't define are listed in `problems`. A code given
|
|
47
|
+
* without its trailing unused positions (`SFGPUCI` for `SFGPUCI--------`, as some systems store
|
|
48
|
+
* them) is read with dashes filling them, and `problems` says so; at least scheme, identity, dimension
|
|
49
|
+
* and status (4 characters) are needed.
|
|
50
|
+
*/
|
|
51
|
+
export declare function parseLetterSidc(input: string): ParseResult<LetterSidc>;
|