milsymbol-sidc 0.1.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/LICENSE +21 -0
- package/README.md +360 -0
- package/dist/src/enums.d.ts +74 -0
- package/dist/src/enums.d.ts.map +1 -0
- package/dist/src/enums.js +69 -0
- package/dist/src/enums.js.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/sidc.d.ts +58 -0
- package/dist/src/sidc.d.ts.map +1 -0
- package/dist/src/sidc.js +110 -0
- package/dist/src/sidc.js.map +1 -0
- package/dist/src/validate.d.ts +37 -0
- package/dist/src/validate.d.ts.map +1 -0
- package/dist/src/validate.js +93 -0
- package/dist/src/validate.js.map +1 -0
- package/dist/test/sidc.test.d.ts +2 -0
- package/dist/test/sidc.test.d.ts.map +1 -0
- package/dist/test/sidc.test.js +299 -0
- package/dist/test/sidc.test.js.map +1 -0
- package/package.json +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Stuart Harding
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
# milsymbol-sidc
|
|
2
|
+
|
|
3
|
+
A fluent TypeScript builder for **20-character numeric SIDC strings** — the
|
|
4
|
+
symbol identification code format used by [MIL-STD-2525E](https://en.wikipedia.org/wiki/MIL-STD-2525)
|
|
5
|
+
and [APP-6](https://en.wikipedia.org/wiki/NATO_Joint_Military_Symbology) — made
|
|
6
|
+
for constructing symbols with the
|
|
7
|
+
[milsymbol](https://github.com/spatialillusions/milsymbol) library.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { Sidc, StandardIdentity, SymbolSet } from "milsymbol-sidc";
|
|
11
|
+
|
|
12
|
+
const sidc = new Sidc()
|
|
13
|
+
.identity(StandardIdentity.Friend)
|
|
14
|
+
.symbolSet(SymbolSet.LandUnit)
|
|
15
|
+
.toString(); // "13031000000000000000"
|
|
16
|
+
|
|
17
|
+
new ms.Symbol(sidc).asSVG(); // friendly land unit icon
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- **Zero runtime dependencies** — TypeScript types and digit-string logic only.
|
|
21
|
+
- **Typed field codes** — every value is a named constant carrying its literal
|
|
22
|
+
SIDC digits, so typos are compile errors.
|
|
23
|
+
- **Validated output** — invalid values throw; inconsistent combinations warn
|
|
24
|
+
(or throw in `strict` mode), using the same rules milsymbol applies when it
|
|
25
|
+
parses a SIDC.
|
|
26
|
+
- **milsymbol-ready** — positions 8–20 are zero-filled so every generated
|
|
27
|
+
string is accepted by `new ms.Symbol(...)` out of the box.
|
|
28
|
+
|
|
29
|
+
> **Coverage:** positions 1–7 of the numeric SIDC (version, context, standard
|
|
30
|
+
> identity, symbol set, status). Positions 8–20 (HQ/task force/dummy, echelon,
|
|
31
|
+
> entity code, sector modifiers) are reserved for future releases.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
Requires Node.js >= 18.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install milsymbol-sidc
|
|
39
|
+
# or
|
|
40
|
+
yarn add milsymbol-sidc
|
|
41
|
+
# or
|
|
42
|
+
pnpm add milsymbol-sidc
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The package ships ESM with bundled TypeScript declarations (`dist/`).
|
|
46
|
+
|
|
47
|
+
## Quick start
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import {
|
|
51
|
+
Sidc,
|
|
52
|
+
Context,
|
|
53
|
+
StandardIdentity,
|
|
54
|
+
SymbolSet,
|
|
55
|
+
Status,
|
|
56
|
+
Version,
|
|
57
|
+
} from "milsymbol-sidc";
|
|
58
|
+
|
|
59
|
+
// A hostile planned air missile track under MIL-STD-2525E:
|
|
60
|
+
const sidc = new Sidc()
|
|
61
|
+
.version(Version.MilStd2525E) // pos 1-2 → "13"
|
|
62
|
+
.context(Context.Reality) // pos 3 → "0"
|
|
63
|
+
.identity(StandardIdentity.SuspectJoker) // pos 4 → "5"
|
|
64
|
+
.symbolSet(SymbolSet.AirMissile) // pos 5-6 → "02"
|
|
65
|
+
.status(Status.Planned) // pos 7 → "1"
|
|
66
|
+
.toString();
|
|
67
|
+
|
|
68
|
+
console.log(sidc); // "13050210000000000000"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The builder is **immutable**: each setter returns a new instance, so a base
|
|
72
|
+
configuration can be safely reused:
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
const base = new Sidc().version(Version.App6E);
|
|
76
|
+
|
|
77
|
+
const friendly = base.identity(StandardIdentity.Friend).toString();
|
|
78
|
+
const hostile = base.identity(StandardIdentity.SuspectJoker).toString();
|
|
79
|
+
// base itself is unchanged
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Anatomy of the generated SIDC
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
1 3 0 3 1 0 | 0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
86
|
+
└─┬─┘ │ │ └─┬─┘ └──────────┬───────────┘
|
|
87
|
+
│ │ │ │ zero-filled (future fields)
|
|
88
|
+
│ │ │ └ status (7)
|
|
89
|
+
│ │ └ symbol set (5-6)
|
|
90
|
+
│ └ standard identity (4)
|
|
91
|
+
└ context (3)
|
|
92
|
+
version (1-2)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
| Position | Field | Enum |
|
|
96
|
+
| -------- | ------------------ | ----------------- |
|
|
97
|
+
| 1–2 | Version / edition | `Version` |
|
|
98
|
+
| 3 | Context | `Context` |
|
|
99
|
+
| 4 | Standard identity | `StandardIdentity` |
|
|
100
|
+
| 5–6 | Symbol set | `SymbolSet` |
|
|
101
|
+
| 7 | Status / condition | `Status` |
|
|
102
|
+
|
|
103
|
+
## API
|
|
104
|
+
|
|
105
|
+
### `new Sidc(options?)`
|
|
106
|
+
|
|
107
|
+
Creates a builder preconfigured to 2525E / Reality / Unknown / Unknown set /
|
|
108
|
+
Present.
|
|
109
|
+
|
|
110
|
+
| Option | Type | Default | Description |
|
|
111
|
+
| ------ | ---- | ------- | ----------- |
|
|
112
|
+
| `strict` | `boolean` | `false` | Throw on invalid field combinations during `toString()` instead of warning. Invalid values always throw immediately regardless of this flag. |
|
|
113
|
+
|
|
114
|
+
### Methods
|
|
115
|
+
|
|
116
|
+
All setters validate their argument and return a new immutable `Sidc`.
|
|
117
|
+
|
|
118
|
+
| Method | Field | Accepts |
|
|
119
|
+
| ------ | ----- | ------- |
|
|
120
|
+
| `version(v)` | Positions 1–2 | A `Version` constant or any two-digit string (escape hatch for future editions) |
|
|
121
|
+
| `context(c)` | Position 3 | A `Context` constant |
|
|
122
|
+
| `identity(i)` | Position 4 | A `StandardIdentity` constant |
|
|
123
|
+
| `symbolSet(s)` | Positions 5–6 | A `SymbolSet` constant or any two-digit string |
|
|
124
|
+
| `status(s)` | Position 7 | A `Status` constant |
|
|
125
|
+
| `toString()` | — | Validates combinations and renders the 20-character SIDC |
|
|
126
|
+
|
|
127
|
+
### Enum reference
|
|
128
|
+
|
|
129
|
+
#### `Version`
|
|
130
|
+
|
|
131
|
+
| Constant | Code | Standard |
|
|
132
|
+
| -------- | ---- | -------- |
|
|
133
|
+
| `MilStd2525D` | `"10"` | MIL-STD-2525D |
|
|
134
|
+
| `App6D` | `"11"` | APP-6 D |
|
|
135
|
+
| `MilStd2525E` | `"13"` | MIL-STD-2525E (**default**) |
|
|
136
|
+
| `App6E` | `"14"` | APP-6 E |
|
|
137
|
+
|
|
138
|
+
#### `Context`
|
|
139
|
+
|
|
140
|
+
| Constant | Code | Meaning |
|
|
141
|
+
| -------- | ---- | ------- |
|
|
142
|
+
| `Reality` | `"0"` | Real-world operation (**default**) |
|
|
143
|
+
| `Exercise` | `"1"` | Training/exercise |
|
|
144
|
+
| `Simulation` | `"2"` | Simulation |
|
|
145
|
+
|
|
146
|
+
#### `StandardIdentity`
|
|
147
|
+
|
|
148
|
+
| Constant | Code | Frame drawn |
|
|
149
|
+
| -------- | ---- | ----------- |
|
|
150
|
+
| `Pending` | `"0"` | Unknown shape, dashed |
|
|
151
|
+
| `Unknown` | `"1"` | Yellow octagonal frame (**default**) |
|
|
152
|
+
| `AssumedFriend` | `"2"` | Blue frame, dashed |
|
|
153
|
+
| `Friend` | `"3"` | Blue frame |
|
|
154
|
+
| `Neutral` | `"4"` | Green frame |
|
|
155
|
+
| `SuspectJoker` | `"5"` | Red frame, dashed (Joker in exercises) |
|
|
156
|
+
| `Faker` | `"6"` | Red frame (exercises only) |
|
|
157
|
+
|
|
158
|
+
#### `SymbolSet`
|
|
159
|
+
|
|
160
|
+
Only sets that milsymbol can render are listed.
|
|
161
|
+
|
|
162
|
+
| Constant | Code | Domain |
|
|
163
|
+
| -------- | ---- | ------ |
|
|
164
|
+
| `Unknown` | `"00"` | Unknown |
|
|
165
|
+
| `Air` | `"01"` | Air tracks |
|
|
166
|
+
| `AirMissile` | `"02"` | Air missiles |
|
|
167
|
+
| `Space` | `"05"` | Space |
|
|
168
|
+
| `SpaceMissile` | `"06"` | Space missiles |
|
|
169
|
+
| `LandUnit` | `"10"` | Land units |
|
|
170
|
+
| `LandCivilianUnit` | `"11"` | Land civilian units |
|
|
171
|
+
| `LandEquipment` | `"15"` | Land equipment |
|
|
172
|
+
| `Installation` | `"20"` | Installations |
|
|
173
|
+
| `ControlMeasure` | `"25"` | Tactical graphics / control measures |
|
|
174
|
+
| `LandDismountedIndividual` | `"27"` | Dismounted individuals |
|
|
175
|
+
| `SeaSurface` | `"30"` | Sea surface tracks |
|
|
176
|
+
| `SeaSubsurface` | `"35"` | Subsurface tracks |
|
|
177
|
+
| `MineWarfare` | `"36"` | Sea mines |
|
|
178
|
+
| `Activity` | `"40"` | Activities/events |
|
|
179
|
+
| `SignalsIntelligenceSpace` | `"50"` | SIGINT space |
|
|
180
|
+
| `SignalsIntelligenceAir` | `"51"` | SIGINT air |
|
|
181
|
+
| `SignalsIntelligenceLand` | `"52"` | SIGINT land |
|
|
182
|
+
| `SignalsIntelligenceSeaSurface` | `"53"` | SIGINT sea surface |
|
|
183
|
+
| `SignalsIntelligenceSubsurface` | `"54"` | SIGINT subsurface |
|
|
184
|
+
| `Cyberspace` | `"60"` | Cyberspace |
|
|
185
|
+
|
|
186
|
+
Codes `"12"` and `"39"` have no named constant but are recognized via the raw
|
|
187
|
+
string escape hatch.
|
|
188
|
+
|
|
189
|
+
#### `Status`
|
|
190
|
+
|
|
191
|
+
| Constant | Code | Meaning |
|
|
192
|
+
| -------- | ---- | ------- |
|
|
193
|
+
| `Present` | `"0"` | Present / actual (**default**) |
|
|
194
|
+
| `Planned` | `"1"` | Planned / anticipated (dashed frame) |
|
|
195
|
+
| `FullyCapable` | `"2"` | Condition bar: fully capable |
|
|
196
|
+
| `Damaged` | `"3"` | Condition bar: damaged |
|
|
197
|
+
| `Destroyed` | `"4"` | Condition bar: destroyed |
|
|
198
|
+
| `FullToCapacity` | `"5"` | Condition bar: full to capacity |
|
|
199
|
+
|
|
200
|
+
## Validation and error handling
|
|
201
|
+
|
|
202
|
+
Two layers of validation run at different times:
|
|
203
|
+
|
|
204
|
+
1. **Setter-time (`SidcValidationError`)** — thrown immediately for malformed
|
|
205
|
+
input (wrong number of digits) or unknown enum codes. This catches bugs at
|
|
206
|
+
the call site rather than deep inside rendering code.
|
|
207
|
+
2. **`toString()`-time combination checks** — cross-field rules mirroring
|
|
208
|
+
milsymbol's parser. By default problems are emitted with `console.warn`;
|
|
209
|
+
with `{ strict: true }` they throw `SidcCombinationError`.
|
|
210
|
+
|
|
211
|
+
Active combination rules:
|
|
212
|
+
|
|
213
|
+
- Faker identities require exercise context (`SuspectJoker` is a valid
|
|
214
|
+
real-world identity — it renders the dashed suspect-hostile frame).
|
|
215
|
+
- Condition statuses (fully capable … full to capacity) do not apply to
|
|
216
|
+
control measures.
|
|
217
|
+
- Exercise symbols on the unknown symbol set lose their affiliation unless the
|
|
218
|
+
identity is pending/unknown.
|
|
219
|
+
- Symbol set 27 is unsupported in MIL-STD-2525D; symbol set 60 is unsupported
|
|
220
|
+
in APP-6 D.
|
|
221
|
+
- Raw version/symbol-set codes outside milsymbol's known tables are reported.
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
import { Sidc, SidcValidationError, SidcCombinationError, Context, StandardIdentity } from "milsymbol-sidc";
|
|
225
|
+
|
|
226
|
+
// Throws immediately: "9" is not a valid identity code.
|
|
227
|
+
new Sidc().identity("9" as never); // SidcValidationError
|
|
228
|
+
|
|
229
|
+
// Warns: faker only exists in exercise context.
|
|
230
|
+
new Sidc().identity(StandardIdentity.Faker).toString();
|
|
231
|
+
|
|
232
|
+
// Throws instead of warning:
|
|
233
|
+
const strict = new Sidc({ strict: true }).identity(StandardIdentity.Faker);
|
|
234
|
+
strict.toString(); // SidcCombinationError
|
|
235
|
+
|
|
236
|
+
// Correct usage: faker inside an exercise.
|
|
237
|
+
new Sidc({ strict: true })
|
|
238
|
+
.context(Context.Exercise)
|
|
239
|
+
.identity(StandardIdentity.Faker)
|
|
240
|
+
.symbolSet(SymbolSet.LandUnit)
|
|
241
|
+
.toString(); // "13161000000000000000", no warnings
|
|
242
|
+
|
|
243
|
+
// Capturing warnings programmatically (e.g. in tests):
|
|
244
|
+
const warnings: string[] = [];
|
|
245
|
+
const originalWarn = console.warn;
|
|
246
|
+
console.warn = (message: string) => warnings.push(message);
|
|
247
|
+
try {
|
|
248
|
+
new Sidc().identity(StandardIdentity.Faker).toString();
|
|
249
|
+
} finally {
|
|
250
|
+
console.warn = originalWarn;
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Error classes: `SidcError` (base) → `SidcValidationError`,
|
|
255
|
+
`SidcCombinationError`.
|
|
256
|
+
|
|
257
|
+
## Using with milsymbol
|
|
258
|
+
|
|
259
|
+
milsymbol routes any SIDC whose first two characters are digits to its numeric
|
|
260
|
+
parser, so codes from this package work without any configuration. The
|
|
261
|
+
`standard` style option only selects NATO vs US styling details:
|
|
262
|
+
|
|
263
|
+
### Node.js (ESM)
|
|
264
|
+
|
|
265
|
+
```js
|
|
266
|
+
import ms from "milsymbol"; // bundles all standards incl. 2525E icons
|
|
267
|
+
import { Sidc, StandardIdentity, SymbolSet } from "milsymbol-sidc";
|
|
268
|
+
|
|
269
|
+
ms.setStandard("2525"); // or "APP6"
|
|
270
|
+
|
|
271
|
+
const sidc = new Sidc()
|
|
272
|
+
.identity(StandardIdentity.Friend)
|
|
273
|
+
.symbolSet(SymbolSet.LandUnit)
|
|
274
|
+
.toString();
|
|
275
|
+
|
|
276
|
+
const symbol = new ms.Symbol(sidc, { size: 32 });
|
|
277
|
+
if (!symbol.isValid()) {
|
|
278
|
+
console.warn(`milsymbol could not fully render ${sidc}`);
|
|
279
|
+
}
|
|
280
|
+
const svg = symbol.asSVG();
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Node.js (CommonJS)
|
|
284
|
+
|
|
285
|
+
```js
|
|
286
|
+
const ms = require("milsymbol");
|
|
287
|
+
// same API as above
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Browser
|
|
291
|
+
|
|
292
|
+
```html
|
|
293
|
+
<script src="https://unpkg.com/milsymbol@3/dist/milsymbol.js"></script>
|
|
294
|
+
<script type="module">
|
|
295
|
+
import { Sidc, StandardIdentity, SymbolSet } from "https://unpkg.com/milsymbol-sidc/dist/src/index.js";
|
|
296
|
+
|
|
297
|
+
const sidc = new Sidc()
|
|
298
|
+
.identity(StandardIdentity.Neutral)
|
|
299
|
+
.symbolSet(SymbolSet.SeaSurface)
|
|
300
|
+
.toString();
|
|
301
|
+
|
|
302
|
+
document.body.innerHTML = new ms.Symbol(sidc).asSVG();
|
|
303
|
+
</script>
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Recipes
|
|
307
|
+
|
|
308
|
+
```ts
|
|
309
|
+
// Hostile planned armored unit
|
|
310
|
+
new Sidc()
|
|
311
|
+
.identity(StandardIdentity.SuspectJoker)
|
|
312
|
+
.symbolSet(SymbolSet.LandUnit)
|
|
313
|
+
.status(Status.Planned)
|
|
314
|
+
.toString(); // "13051010000000000000"
|
|
315
|
+
|
|
316
|
+
// Neutral damaged installation
|
|
317
|
+
new Sidc()
|
|
318
|
+
.identity(StandardIdentity.Neutral)
|
|
319
|
+
.symbolSet(SymbolSet.Installation)
|
|
320
|
+
.status(Status.Damaged)
|
|
321
|
+
.toString(); // "13042030000000000000"
|
|
322
|
+
|
|
323
|
+
// Friendly destroyed mine (mine warfare set)
|
|
324
|
+
new Sidc()
|
|
325
|
+
.identity(StandardIdentity.Friend)
|
|
326
|
+
.symbolSet(SymbolSet.MineWarfare)
|
|
327
|
+
.status(Status.Destroyed)
|
|
328
|
+
.toString(); // "13033640000000000000"
|
|
329
|
+
|
|
330
|
+
// Exercise joker submarine under APP-6E
|
|
331
|
+
new Sidc({ strict: true })
|
|
332
|
+
.version("14")
|
|
333
|
+
.context(Context.Exercise)
|
|
334
|
+
.identity(StandardIdentity.SuspectJoker)
|
|
335
|
+
.symbolSet(SymbolSet.SeaSubsurface)
|
|
336
|
+
.toString(); // "14153500000000000000"
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## Development
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
npm install
|
|
343
|
+
npm test # compiles with tsc, then runs node --test against dist/
|
|
344
|
+
npm run build
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
Test coverage includes per-field offset encoding for every enum member,
|
|
348
|
+
defaults, immutability, setter validation errors, all combination rules in
|
|
349
|
+
both warn and strict modes, raw-code escape hatches, and error class
|
|
350
|
+
hierarchy.
|
|
351
|
+
|
|
352
|
+
## Roadmap
|
|
353
|
+
|
|
354
|
+
- Positions 8–20: HQ/task force/dummy, echelon/mobility, entity catalog with
|
|
355
|
+
named icon codes, sector modifiers.
|
|
356
|
+
- Parsing/decoding SIDC strings back into structured fields.
|
|
357
|
+
|
|
358
|
+
## License
|
|
359
|
+
|
|
360
|
+
MIT
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field codes for positions 1-7 of the 20-character numeric SIDC
|
|
3
|
+
* (MIL-STD-2525D/E and APP-6 D/E coding structure).
|
|
4
|
+
*
|
|
5
|
+
* Values are the literal digit codes that appear in the SIDC string.
|
|
6
|
+
*/
|
|
7
|
+
/** Positions 1-2: Version / standard edition. */
|
|
8
|
+
export declare const Version: {
|
|
9
|
+
/** MIL-STD-2525D (edition D) */
|
|
10
|
+
readonly MilStd2525D: "10";
|
|
11
|
+
/** APP-6 edition D */
|
|
12
|
+
readonly App6D: "11";
|
|
13
|
+
/** MIL-STD-2525E (edition E) - the default */
|
|
14
|
+
readonly MilStd2525E: "13";
|
|
15
|
+
/** APP-6 edition E */
|
|
16
|
+
readonly App6E: "14";
|
|
17
|
+
};
|
|
18
|
+
export type Version = (typeof Version)[keyof typeof Version];
|
|
19
|
+
/** Position 3: Context. */
|
|
20
|
+
export declare const Context: {
|
|
21
|
+
readonly Reality: "0";
|
|
22
|
+
readonly Exercise: "1";
|
|
23
|
+
readonly Simulation: "2";
|
|
24
|
+
};
|
|
25
|
+
export type Context = (typeof Context)[keyof typeof Context];
|
|
26
|
+
/** Position 4: Standard identity (affiliation). */
|
|
27
|
+
export declare const StandardIdentity: {
|
|
28
|
+
readonly Pending: "0";
|
|
29
|
+
readonly Unknown: "1";
|
|
30
|
+
readonly AssumedFriend: "2";
|
|
31
|
+
readonly Friend: "3";
|
|
32
|
+
readonly Neutral: "4";
|
|
33
|
+
/** Hostile suspect; becomes Joker in exercise context. */
|
|
34
|
+
readonly SuspectJoker: "5";
|
|
35
|
+
/** Hostile faker (exercise context only). */
|
|
36
|
+
readonly Faker: "6";
|
|
37
|
+
};
|
|
38
|
+
export type StandardIdentity = (typeof StandardIdentity)[keyof typeof StandardIdentity];
|
|
39
|
+
/** Positions 5-6: Symbol set. Only sets supported by milsymbol are listed. */
|
|
40
|
+
export declare const SymbolSet: {
|
|
41
|
+
readonly Unknown: "00";
|
|
42
|
+
readonly Air: "01";
|
|
43
|
+
readonly AirMissile: "02";
|
|
44
|
+
readonly Space: "05";
|
|
45
|
+
readonly SpaceMissile: "06";
|
|
46
|
+
readonly LandUnit: "10";
|
|
47
|
+
readonly LandCivilianUnit: "11";
|
|
48
|
+
readonly LandEquipment: "15";
|
|
49
|
+
readonly Installation: "20";
|
|
50
|
+
readonly ControlMeasure: "25";
|
|
51
|
+
readonly LandDismountedIndividual: "27";
|
|
52
|
+
readonly SeaSurface: "30";
|
|
53
|
+
readonly SeaSubsurface: "35";
|
|
54
|
+
readonly MineWarfare: "36";
|
|
55
|
+
readonly Activity: "40";
|
|
56
|
+
readonly SignalsIntelligenceSpace: "50";
|
|
57
|
+
readonly SignalsIntelligenceAir: "51";
|
|
58
|
+
readonly SignalsIntelligenceLand: "52";
|
|
59
|
+
readonly SignalsIntelligenceSeaSurface: "53";
|
|
60
|
+
readonly SignalsIntelligenceSubsurface: "54";
|
|
61
|
+
readonly Cyberspace: "60";
|
|
62
|
+
};
|
|
63
|
+
export type SymbolSet = (typeof SymbolSet)[keyof typeof SymbolSet];
|
|
64
|
+
/** Position 7: Status / condition. */
|
|
65
|
+
export declare const Status: {
|
|
66
|
+
readonly Present: "0";
|
|
67
|
+
readonly Planned: "1";
|
|
68
|
+
readonly FullyCapable: "2";
|
|
69
|
+
readonly Damaged: "3";
|
|
70
|
+
readonly Destroyed: "4";
|
|
71
|
+
readonly FullToCapacity: "5";
|
|
72
|
+
};
|
|
73
|
+
export type Status = (typeof Status)[keyof typeof Status];
|
|
74
|
+
//# sourceMappingURL=enums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/enums.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,iDAAiD;AACjD,eAAO,MAAM,OAAO;IAClB,gCAAgC;;IAEhC,sBAAsB;;IAEtB,8CAA8C;;IAE9C,sBAAsB;;CAEd,CAAC;AACX,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AAE7D,2BAA2B;AAC3B,eAAO,MAAM,OAAO;;;;CAIV,CAAC;AACX,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AAE7D,mDAAmD;AACnD,eAAO,MAAM,gBAAgB;;;;;;IAM3B,0DAA0D;;IAE1D,6CAA6C;;CAErC,CAAC;AACX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAExF,8EAA8E;AAC9E,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;CAsBZ,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEnE,sCAAsC;AACtC,eAAO,MAAM,MAAM;;;;;;;CAOT,CAAC;AACX,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,OAAO,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field codes for positions 1-7 of the 20-character numeric SIDC
|
|
3
|
+
* (MIL-STD-2525D/E and APP-6 D/E coding structure).
|
|
4
|
+
*
|
|
5
|
+
* Values are the literal digit codes that appear in the SIDC string.
|
|
6
|
+
*/
|
|
7
|
+
/** Positions 1-2: Version / standard edition. */
|
|
8
|
+
export const Version = {
|
|
9
|
+
/** MIL-STD-2525D (edition D) */
|
|
10
|
+
MilStd2525D: "10",
|
|
11
|
+
/** APP-6 edition D */
|
|
12
|
+
App6D: "11",
|
|
13
|
+
/** MIL-STD-2525E (edition E) - the default */
|
|
14
|
+
MilStd2525E: "13",
|
|
15
|
+
/** APP-6 edition E */
|
|
16
|
+
App6E: "14",
|
|
17
|
+
};
|
|
18
|
+
/** Position 3: Context. */
|
|
19
|
+
export const Context = {
|
|
20
|
+
Reality: "0",
|
|
21
|
+
Exercise: "1",
|
|
22
|
+
Simulation: "2",
|
|
23
|
+
};
|
|
24
|
+
/** Position 4: Standard identity (affiliation). */
|
|
25
|
+
export const StandardIdentity = {
|
|
26
|
+
Pending: "0",
|
|
27
|
+
Unknown: "1",
|
|
28
|
+
AssumedFriend: "2",
|
|
29
|
+
Friend: "3",
|
|
30
|
+
Neutral: "4",
|
|
31
|
+
/** Hostile suspect; becomes Joker in exercise context. */
|
|
32
|
+
SuspectJoker: "5",
|
|
33
|
+
/** Hostile faker (exercise context only). */
|
|
34
|
+
Faker: "6",
|
|
35
|
+
};
|
|
36
|
+
/** Positions 5-6: Symbol set. Only sets supported by milsymbol are listed. */
|
|
37
|
+
export const SymbolSet = {
|
|
38
|
+
Unknown: "00",
|
|
39
|
+
Air: "01",
|
|
40
|
+
AirMissile: "02",
|
|
41
|
+
Space: "05",
|
|
42
|
+
SpaceMissile: "06",
|
|
43
|
+
LandUnit: "10",
|
|
44
|
+
LandCivilianUnit: "11",
|
|
45
|
+
LandEquipment: "15",
|
|
46
|
+
Installation: "20",
|
|
47
|
+
ControlMeasure: "25",
|
|
48
|
+
LandDismountedIndividual: "27",
|
|
49
|
+
SeaSurface: "30",
|
|
50
|
+
SeaSubsurface: "35",
|
|
51
|
+
MineWarfare: "36",
|
|
52
|
+
Activity: "40",
|
|
53
|
+
SignalsIntelligenceSpace: "50",
|
|
54
|
+
SignalsIntelligenceAir: "51",
|
|
55
|
+
SignalsIntelligenceLand: "52",
|
|
56
|
+
SignalsIntelligenceSeaSurface: "53",
|
|
57
|
+
SignalsIntelligenceSubsurface: "54",
|
|
58
|
+
Cyberspace: "60",
|
|
59
|
+
};
|
|
60
|
+
/** Position 7: Status / condition. */
|
|
61
|
+
export const Status = {
|
|
62
|
+
Present: "0",
|
|
63
|
+
Planned: "1",
|
|
64
|
+
FullyCapable: "2",
|
|
65
|
+
Damaged: "3",
|
|
66
|
+
Destroyed: "4",
|
|
67
|
+
FullToCapacity: "5",
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=enums.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../src/enums.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,iDAAiD;AACjD,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,gCAAgC;IAChC,WAAW,EAAE,IAAI;IACjB,sBAAsB;IACtB,KAAK,EAAE,IA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S,EAAE,GAAG;IACd,cAAc,EAAE,GAAG;CACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,OAAO,GACR,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EACL,oBAAoB,EACpB,SAAS,EACT,mBAAmB,GACpB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,OAAO,GACR,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,IAAI,EAAoB,MAAM,WAAW,CAAC;AAEnD,OAAO,EACL,oBAAoB,EACpB,SAAS,EACT,mBAAmB,GACpB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Context, StandardIdentity, Status, SymbolSet, Version } from "./enums.js";
|
|
2
|
+
import { type SidcFields } from "./validate.js";
|
|
3
|
+
export interface SidcOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Throw {@link SidcCombinationError} on invalid field combinations during
|
|
6
|
+
* {@link Sidc.toString} instead of emitting console warnings.
|
|
7
|
+
* Invalid individual values always throw immediately.
|
|
8
|
+
*/
|
|
9
|
+
strict?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Fluent builder for 20-character numeric SIDC strings
|
|
13
|
+
* (MIL-STD-2525E / APP-6 coding structure).
|
|
14
|
+
*
|
|
15
|
+
* Covers positions 1-7; positions 8-20 are zero-filled so the result can be
|
|
16
|
+
* passed straight to milsymbol's `new ms.Symbol(sidc)`.
|
|
17
|
+
*
|
|
18
|
+
* All setters are immutable: they return a new `Sidc` and leave the original
|
|
19
|
+
* untouched.
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* const sidc = new Sidc()
|
|
23
|
+
* .context(Context.Reality)
|
|
24
|
+
* .identity(StandardIdentity.Friend)
|
|
25
|
+
* .symbolSet(SymbolSet.LandUnit)
|
|
26
|
+
* .status(Status.Present)
|
|
27
|
+
* .toString(); // "13031000000000000000"
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare class Sidc {
|
|
31
|
+
private readonly fields;
|
|
32
|
+
private readonly strict;
|
|
33
|
+
/**
|
|
34
|
+
* @param options Builder behaviour flags.
|
|
35
|
+
* @param fields Initial field values. Internal; used for immutable clones.
|
|
36
|
+
*/
|
|
37
|
+
constructor(options?: SidcOptions, fields?: SidcFields);
|
|
38
|
+
/** Positions 1-2: standard edition. Accepts known codes or a raw two-digit code. */
|
|
39
|
+
version(version: Version | (string & {})): Sidc;
|
|
40
|
+
/** Position 3: context. */
|
|
41
|
+
context(context: Context): Sidc;
|
|
42
|
+
/** Position 4: standard identity (affiliation). */
|
|
43
|
+
identity(identity: StandardIdentity): Sidc;
|
|
44
|
+
/** Positions 5-6: symbol set. Accepts known codes or a raw two-digit code. */
|
|
45
|
+
symbolSet(symbolSet: SymbolSet | (string & {})): Sidc;
|
|
46
|
+
/** Position 7: status / condition. */
|
|
47
|
+
status(status: Status): Sidc;
|
|
48
|
+
/**
|
|
49
|
+
* Validates combinations and renders the 20-character SIDC string.
|
|
50
|
+
*
|
|
51
|
+
* - Invalid values already throw in the setters.
|
|
52
|
+
* - Unrecognized raw codes and invalid combinations emit console warnings,
|
|
53
|
+
* or throw when built with `{ strict: true }`.
|
|
54
|
+
*/
|
|
55
|
+
toString(): string;
|
|
56
|
+
private with;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=sidc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidc.d.ts","sourceRoot":"","sources":["../../src/sidc.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,OAAO,EACR,MAAM,YAAY,CAAC;AACpB,OAAO,EASL,KAAK,UAAU,EAChB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAQD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,IAAI;IACf,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IAEjC;;;OAGG;gBACS,OAAO,GAAE,WAAgB,EAAE,MAAM,CAAC,EAAE,UAAU;IAW1D,oFAAoF;IACpF,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,IAAI;IAK/C,2BAA2B;IAC3B,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAQ/B,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAU1C,8EAA8E;IAC9E,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,IAAI;IAKrD,sCAAsC;IACtC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAQ5B;;;;;;OAMG;IACH,QAAQ,IAAI,MAAM;IA8BlB,OAAO,CAAC,IAAI;CAGb"}
|
package/dist/src/sidc.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Context, StandardIdentity, Status, SymbolSet, Version, } from "./enums.js";
|
|
2
|
+
import { checkOneDigitField, checkTwoDigitField, findCombinationProblems, knownSymbolSets, knownVersions, SidcCombinationError, SidcValidationError, unrecognizedCodeWarning, } from "./validate.js";
|
|
3
|
+
const SIDC_LENGTH = 20;
|
|
4
|
+
const CONTEXTS = new Set(Object.values(Context));
|
|
5
|
+
const IDENTITIES = new Set(Object.values(StandardIdentity));
|
|
6
|
+
const STATUSES = new Set(Object.values(Status));
|
|
7
|
+
/**
|
|
8
|
+
* Fluent builder for 20-character numeric SIDC strings
|
|
9
|
+
* (MIL-STD-2525E / APP-6 coding structure).
|
|
10
|
+
*
|
|
11
|
+
* Covers positions 1-7; positions 8-20 are zero-filled so the result can be
|
|
12
|
+
* passed straight to milsymbol's `new ms.Symbol(sidc)`.
|
|
13
|
+
*
|
|
14
|
+
* All setters are immutable: they return a new `Sidc` and leave the original
|
|
15
|
+
* untouched.
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* const sidc = new Sidc()
|
|
19
|
+
* .context(Context.Reality)
|
|
20
|
+
* .identity(StandardIdentity.Friend)
|
|
21
|
+
* .symbolSet(SymbolSet.LandUnit)
|
|
22
|
+
* .status(Status.Present)
|
|
23
|
+
* .toString(); // "13031000000000000000"
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export class Sidc {
|
|
27
|
+
fields;
|
|
28
|
+
strict;
|
|
29
|
+
/**
|
|
30
|
+
* @param options Builder behaviour flags.
|
|
31
|
+
* @param fields Initial field values. Internal; used for immutable clones.
|
|
32
|
+
*/
|
|
33
|
+
constructor(options = {}, fields) {
|
|
34
|
+
this.fields = fields ?? {
|
|
35
|
+
version: Version.MilStd2525E,
|
|
36
|
+
context: Context.Reality,
|
|
37
|
+
identity: StandardIdentity.Unknown,
|
|
38
|
+
symbolSet: SymbolSet.Unknown,
|
|
39
|
+
status: Status.Present,
|
|
40
|
+
};
|
|
41
|
+
this.strict = options.strict ?? false;
|
|
42
|
+
}
|
|
43
|
+
/** Positions 1-2: standard edition. Accepts known codes or a raw two-digit code. */
|
|
44
|
+
version(version) {
|
|
45
|
+
checkTwoDigitField("Version", version);
|
|
46
|
+
return this.with({ version });
|
|
47
|
+
}
|
|
48
|
+
/** Position 3: context. */
|
|
49
|
+
context(context) {
|
|
50
|
+
checkOneDigitField("Context", context);
|
|
51
|
+
if (!CONTEXTS.has(context)) {
|
|
52
|
+
throw new SidcValidationError(`Unknown context code "${context}".`);
|
|
53
|
+
}
|
|
54
|
+
return this.with({ context });
|
|
55
|
+
}
|
|
56
|
+
/** Position 4: standard identity (affiliation). */
|
|
57
|
+
identity(identity) {
|
|
58
|
+
checkOneDigitField("Standard identity", identity);
|
|
59
|
+
if (!IDENTITIES.has(identity)) {
|
|
60
|
+
throw new SidcValidationError(`Unknown standard identity code "${identity}".`);
|
|
61
|
+
}
|
|
62
|
+
return this.with({ identity });
|
|
63
|
+
}
|
|
64
|
+
/** Positions 5-6: symbol set. Accepts known codes or a raw two-digit code. */
|
|
65
|
+
symbolSet(symbolSet) {
|
|
66
|
+
checkTwoDigitField("Symbol set", symbolSet);
|
|
67
|
+
return this.with({ symbolSet });
|
|
68
|
+
}
|
|
69
|
+
/** Position 7: status / condition. */
|
|
70
|
+
status(status) {
|
|
71
|
+
checkOneDigitField("Status", status);
|
|
72
|
+
if (!STATUSES.has(status)) {
|
|
73
|
+
throw new SidcValidationError(`Unknown status code "${status}".`);
|
|
74
|
+
}
|
|
75
|
+
return this.with({ status });
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Validates combinations and renders the 20-character SIDC string.
|
|
79
|
+
*
|
|
80
|
+
* - Invalid values already throw in the setters.
|
|
81
|
+
* - Unrecognized raw codes and invalid combinations emit console warnings,
|
|
82
|
+
* or throw when built with `{ strict: true }`.
|
|
83
|
+
*/
|
|
84
|
+
toString() {
|
|
85
|
+
const warnings = [
|
|
86
|
+
unrecognizedCodeWarning("version", this.fields.version, knownVersions),
|
|
87
|
+
unrecognizedCodeWarning("symbol set", this.fields.symbolSet, knownSymbolSets),
|
|
88
|
+
...findCombinationProblems(this.fields),
|
|
89
|
+
];
|
|
90
|
+
const problems = warnings.filter((w) => w !== undefined);
|
|
91
|
+
if (problems.length > 0) {
|
|
92
|
+
if (this.strict) {
|
|
93
|
+
throw new SidcCombinationError(problems.join(" "));
|
|
94
|
+
}
|
|
95
|
+
for (const problem of problems) {
|
|
96
|
+
console.warn(`[milsymbol-sidc] ${problem}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const head = this.fields.version +
|
|
100
|
+
this.fields.context +
|
|
101
|
+
this.fields.identity +
|
|
102
|
+
this.fields.symbolSet +
|
|
103
|
+
this.fields.status;
|
|
104
|
+
return head.padEnd(SIDC_LENGTH, "0");
|
|
105
|
+
}
|
|
106
|
+
with(fields) {
|
|
107
|
+
return new Sidc({ strict: this.strict }, { ...this.fields, ...fields });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=sidc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidc.js","sourceRoot":"","sources":["../../src/sidc.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,OAAO,GACR,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,GAExB,MAAM,eAAe,CAAC;AAWvB,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AACtE,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACjF,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AAErE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,IAAI;IACE,MAAM,CAAa;IACnB,MAAM,CAAU;IAEjC;;;OAGG;IACH,YAAY,UAA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;YACpB,IAAI,CAAC,MAAM,CAAC,SAAS;YACrB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IACvC,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"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Fields encoded by the builder, keyed by SIDC position. */
|
|
2
|
+
export interface SidcFields {
|
|
3
|
+
version: string;
|
|
4
|
+
context: string;
|
|
5
|
+
identity: string;
|
|
6
|
+
symbolSet: string;
|
|
7
|
+
status: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class SidcError extends Error {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
/** Thrown when a field value is not a valid code. */
|
|
13
|
+
export declare class SidcValidationError extends SidcError {
|
|
14
|
+
constructor(message: string);
|
|
15
|
+
}
|
|
16
|
+
/** Thrown in strict mode when field values conflict with each other. */
|
|
17
|
+
export declare class SidcCombinationError extends SidcError {
|
|
18
|
+
constructor(message: string);
|
|
19
|
+
}
|
|
20
|
+
/** @internal Validates and stores a two-digit field (version or symbol set). */
|
|
21
|
+
export declare function checkTwoDigitField(name: string, value: string): void;
|
|
22
|
+
/** @internal Validates a single-digit field (context, identity, status). */
|
|
23
|
+
export declare function checkOneDigitField(name: string, value: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Cross-field consistency checks mirroring milsymbol's number-based SIDC
|
|
26
|
+
* parsing. Returns human-readable problem descriptions; an empty array means
|
|
27
|
+
* the combination is valid.
|
|
28
|
+
*/
|
|
29
|
+
export declare function findCombinationProblems(fields: SidcFields): string[];
|
|
30
|
+
/**
|
|
31
|
+
* Checks that a raw version/symbol-set code is at least recognized by
|
|
32
|
+
* milsymbol's parser; returns a warning message when it is not.
|
|
33
|
+
*/
|
|
34
|
+
export declare function unrecognizedCodeWarning(name: string, value: string, known: readonly string[]): string | undefined;
|
|
35
|
+
export declare const knownVersions: readonly string[];
|
|
36
|
+
export declare const knownSymbolSets: readonly string[];
|
|
37
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAEA,6DAA6D;AAC7D,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAED,qDAAqD;AACrD,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,OAAO,EAAE,MAAM;CAI5B;AAED,wEAAwE;AACxE,qBAAa,oBAAqB,SAAQ,SAAS;gBACrC,OAAO,EAAE,MAAM;CAI5B;AAsBD,gFAAgF;AAChF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEpE;AAED,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,EAAE,CA+CpE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAKjH;AAED,eAAO,MAAM,aAAa,mBAAiB,CAAC;AAC5C,eAAO,MAAM,eAAe,mBAAoB,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Context, StandardIdentity, Status, SymbolSet, Version } from "./enums.js";
|
|
2
|
+
export class SidcError extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "SidcError";
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** Thrown when a field value is not a valid code. */
|
|
9
|
+
export class SidcValidationError extends SidcError {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "SidcValidationError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** Thrown in strict mode when field values conflict with each other. */
|
|
16
|
+
export class SidcCombinationError extends SidcError {
|
|
17
|
+
constructor(message) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.name = "SidcCombinationError";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const TWO_DIGITS = /^\d{2}$/;
|
|
23
|
+
const ONE_DIGIT = /^\d$/;
|
|
24
|
+
// Codes milsymbol's number-based parser recognizes, including ones without
|
|
25
|
+
// dedicated named constants (e.g. "12"/"39" appear in its dimension mapping).
|
|
26
|
+
const KNOWN_VERSIONS = ["10", "11", "12", "13", "14"];
|
|
27
|
+
const KNOWN_SYMBOL_SETS = [
|
|
28
|
+
...Object.values(SymbolSet),
|
|
29
|
+
"12",
|
|
30
|
+
"39",
|
|
31
|
+
];
|
|
32
|
+
function assertDigits(name, value, pattern, length) {
|
|
33
|
+
if (!pattern.test(value)) {
|
|
34
|
+
throw new SidcValidationError(`${name} must be ${length} digit(s), got "${value}".`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** @internal Validates and stores a two-digit field (version or symbol set). */
|
|
38
|
+
export function checkTwoDigitField(name, value) {
|
|
39
|
+
assertDigits(name, value, TWO_DIGITS, 2);
|
|
40
|
+
}
|
|
41
|
+
/** @internal Validates a single-digit field (context, identity, status). */
|
|
42
|
+
export function checkOneDigitField(name, value) {
|
|
43
|
+
assertDigits(name, value, ONE_DIGIT, 1);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Cross-field consistency checks mirroring milsymbol's number-based SIDC
|
|
47
|
+
* parsing. Returns human-readable problem descriptions; an empty array means
|
|
48
|
+
* the combination is valid.
|
|
49
|
+
*/
|
|
50
|
+
export function findCombinationProblems(fields) {
|
|
51
|
+
const problems = [];
|
|
52
|
+
const { version, context, identity, symbolSet, status } = fields;
|
|
53
|
+
// Faker ("6") only exists in exercises; Suspect/Joker ("5") is a valid
|
|
54
|
+
// real-world identity (dashed hostile frame).
|
|
55
|
+
if (identity === StandardIdentity.Faker &&
|
|
56
|
+
context !== Context.Exercise) {
|
|
57
|
+
problems.push(`Identity "${identity}" (faker) is only valid with exercise context.`);
|
|
58
|
+
}
|
|
59
|
+
// Condition statuses do not apply to control measures (tactical graphics).
|
|
60
|
+
if (Object.values(Status).includes(status) &&
|
|
61
|
+
parseInt(status, 10) >= 2 &&
|
|
62
|
+
symbolSet === SymbolSet.ControlMeasure) {
|
|
63
|
+
problems.push(`Condition status "${status}" does not apply to the control measure symbol set.`);
|
|
64
|
+
}
|
|
65
|
+
// milsymbol drops the affiliation for exercise symbols on unknown sets.
|
|
66
|
+
if (symbolSet === SymbolSet.Unknown &&
|
|
67
|
+
context === Context.Exercise &&
|
|
68
|
+
identity !== StandardIdentity.Pending &&
|
|
69
|
+
identity !== StandardIdentity.Unknown) {
|
|
70
|
+
problems.push("Exercise symbols on the unknown symbol set render without affiliation unless identity is pending/unknown.");
|
|
71
|
+
}
|
|
72
|
+
// Symbol sets missing from specific standards' handler lists.
|
|
73
|
+
if (version === Version.MilStd2525D && symbolSet === SymbolSet.LandDismountedIndividual) {
|
|
74
|
+
problems.push("Symbol set 27 (dismounted individual) is not supported by MIL-STD-2525D.");
|
|
75
|
+
}
|
|
76
|
+
if (version === Version.App6D && symbolSet === SymbolSet.Cyberspace) {
|
|
77
|
+
problems.push("Symbol set 60 (cyberspace) is not supported by APP-6 D.");
|
|
78
|
+
}
|
|
79
|
+
return problems;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Checks that a raw version/symbol-set code is at least recognized by
|
|
83
|
+
* milsymbol's parser; returns a warning message when it is not.
|
|
84
|
+
*/
|
|
85
|
+
export function unrecognizedCodeWarning(name, value, known) {
|
|
86
|
+
if (!known.includes(value)) {
|
|
87
|
+
return `Unrecognized ${name} code "${value}".`;
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
export const knownVersions = KNOWN_VERSIONS;
|
|
92
|
+
export const knownSymbolSets = KNOWN_SYMBOL_SETS;
|
|
93
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAWnF,MAAM,OAAO,SAAU,SAAQ,KAAK;IAClC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;CACF;AAED,qDAAqD;AACrD,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAChD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED,wEAAwE;AACxE,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IACjD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED,MAAM,UAAU,GAAG,SAAS,CAAC;AAC7B,MAAM,SAAS,GAAG,MA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":"sidc.test.d.ts","sourceRoot":"","sources":["../../test/sidc.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { describe, it } from "node:test";
|
|
3
|
+
import { Context, Sidc, SidcCombinationError, SidcValidationError, StandardIdentity, Status, SymbolSet, Version, } from "../src/index.js";
|
|
4
|
+
/** Runs fn with console.warn captured; returns the captured messages. */
|
|
5
|
+
function captureWarnings(fn) {
|
|
6
|
+
const original = console.warn;
|
|
7
|
+
const captured = [];
|
|
8
|
+
console.warn = (...args) => {
|
|
9
|
+
captured.push(args);
|
|
10
|
+
};
|
|
11
|
+
try {
|
|
12
|
+
fn();
|
|
13
|
+
}
|
|
14
|
+
finally {
|
|
15
|
+
console.warn = original;
|
|
16
|
+
}
|
|
17
|
+
return captured.map((args) => args.join(" "));
|
|
18
|
+
}
|
|
19
|
+
describe("Sidc defaults", () => {
|
|
20
|
+
it("renders a zero-filled 2525E SIDC with unknown identity", () => {
|
|
21
|
+
assert.equal(new Sidc().toString(), "13010000000000000000");
|
|
22
|
+
});
|
|
23
|
+
it("always renders exactly 20 characters", () => {
|
|
24
|
+
const sidc = new Sidc()
|
|
25
|
+
.version(Version.App6E)
|
|
26
|
+
.context(Context.Simulation)
|
|
27
|
+
.identity(StandardIdentity.Faker)
|
|
28
|
+
.symbolSet(SymbolSet.SeaSubsurface)
|
|
29
|
+
.status(Status.Destroyed)
|
|
30
|
+
.toString();
|
|
31
|
+
assert.equal(sidc.length, 20);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
describe("field encoding (positions 1-7)", () => {
|
|
35
|
+
it("encodes version at positions 1-2", () => {
|
|
36
|
+
assert.equal(new Sidc().version(Version.MilStd2525E).toString().slice(0, 2), "13");
|
|
37
|
+
assert.equal(new Sidc().version(Version.App6E).toString().slice(0, 2), "14");
|
|
38
|
+
assert.equal(new Sidc().version(Version.MilStd2525D).toString().slice(0, 2), "10");
|
|
39
|
+
assert.equal(new Sidc().version(Version.App6D).toString().slice(0, 2), "11");
|
|
40
|
+
});
|
|
41
|
+
it("encodes context at position 3", () => {
|
|
42
|
+
assert.equal(new Sidc().context(Context.Reality).toString().charAt(2), "0");
|
|
43
|
+
assert.equal(new Sidc().context(Context.Exercise).toString().charAt(2), "1");
|
|
44
|
+
assert.equal(new Sidc().context(Context.Simulation).toString().charAt(2), "2");
|
|
45
|
+
});
|
|
46
|
+
it("encodes standard identity at position 4", () => {
|
|
47
|
+
assert.equal(new Sidc().identity(StandardIdentity.Pending).toString().charAt(3), "0");
|
|
48
|
+
assert.equal(new Sidc().identity(StandardIdentity.Unknown).toString().charAt(3), "1");
|
|
49
|
+
assert.equal(new Sidc().identity(StandardIdentity.AssumedFriend).toString().charAt(3), "2");
|
|
50
|
+
assert.equal(new Sidc().identity(StandardIdentity.Friend).toString().charAt(3), "3");
|
|
51
|
+
assert.equal(new Sidc().identity(StandardIdentity.Neutral).toString().charAt(3), "4");
|
|
52
|
+
assert.equal(new Sidc().identity(StandardIdentity.SuspectJoker).toString().charAt(3), "5");
|
|
53
|
+
assert.equal(new Sidc().identity(StandardIdentity.Faker).toString().charAt(3), "6");
|
|
54
|
+
});
|
|
55
|
+
it("encodes symbol set at positions 5-6", () => {
|
|
56
|
+
for (const code of Object.values(SymbolSet)) {
|
|
57
|
+
const rendered = new Sidc().symbolSet(code).toString();
|
|
58
|
+
assert.equal(rendered.slice(4, 6), code);
|
|
59
|
+
assert.match(rendered, /^\d{20}$/);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
it("encodes status at position 7", () => {
|
|
63
|
+
assert.equal(new Sidc().status(Status.Present).toString().charAt(6), "0");
|
|
64
|
+
assert.equal(new Sidc().status(Status.Planned).toString().charAt(6), "1");
|
|
65
|
+
assert.equal(new Sidc().status(Status.FullyCapable).toString().charAt(6), "2");
|
|
66
|
+
assert.equal(new Sidc().status(Status.Damaged).toString().charAt(6), "3");
|
|
67
|
+
assert.equal(new Sidc().status(Status.Destroyed).toString().charAt(6), "4");
|
|
68
|
+
assert.equal(new Sidc().status(Status.FullToCapacity).toString().charAt(6), "5");
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
describe("worked examples", () => {
|
|
72
|
+
it("friendly present land unit in reality under 2525E", () => {
|
|
73
|
+
const sidc = new Sidc()
|
|
74
|
+
.version(Version.MilStd2525E)
|
|
75
|
+
.context(Context.Reality)
|
|
76
|
+
.identity(StandardIdentity.Friend)
|
|
77
|
+
.symbolSet(SymbolSet.LandUnit)
|
|
78
|
+
.status(Status.Present);
|
|
79
|
+
assert.equal(sidc.toString(), "13031000000000000000");
|
|
80
|
+
});
|
|
81
|
+
it("neutral planned air missile under APP-6E", () => {
|
|
82
|
+
const sidc = new Sidc({ strict: true })
|
|
83
|
+
.version(Version.App6E)
|
|
84
|
+
.identity(StandardIdentity.Neutral)
|
|
85
|
+
.symbolSet(SymbolSet.AirMissile)
|
|
86
|
+
.status(Status.Planned);
|
|
87
|
+
assert.equal(sidc.toString(), "14040210000000000000");
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
describe("immutability", () => {
|
|
91
|
+
it("leaves the base instance untouched after chaining", () => {
|
|
92
|
+
const base = new Sidc();
|
|
93
|
+
const derived = base.identity(StandardIdentity.Friend).status(Status.Damaged);
|
|
94
|
+
assert.notEqual(base, derived);
|
|
95
|
+
assert.equal(base.toString(), "13010000000000000000");
|
|
96
|
+
assert.equal(derived.toString(), "13030030000000000000");
|
|
97
|
+
});
|
|
98
|
+
it("carries strict mode through clones", () => {
|
|
99
|
+
const strict = new Sidc({ strict: true }).identity(StandardIdentity.Faker);
|
|
100
|
+
assert.throws(() => strict.toString(), SidcCombinationError);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
describe("value validation", () => {
|
|
104
|
+
it("throws on malformed or unknown codes", () => {
|
|
105
|
+
assert.throws(() => new Sidc().version("9X"), SidcValidationError);
|
|
106
|
+
assert.throws(() => new Sidc().version("1"), SidcValidationError);
|
|
107
|
+
assert.throws(() => new Sidc().context("9"), SidcValidationError);
|
|
108
|
+
assert.throws(() => new Sidc().identity("9"), SidcValidationError);
|
|
109
|
+
assert.throws(() => new Sidc().symbolSet("1"), SidcValidationError);
|
|
110
|
+
assert.throws(() => new Sidc().status("9"), SidcValidationError);
|
|
111
|
+
});
|
|
112
|
+
it("accepts raw two-digit version and symbol set codes", () => {
|
|
113
|
+
const warnings = captureWarnings(() => {
|
|
114
|
+
const sidc = new Sidc().version("12").symbolSet("12");
|
|
115
|
+
const rendered = sidc.toString();
|
|
116
|
+
assert.equal(rendered.slice(0, 2), "12");
|
|
117
|
+
assert.equal(rendered.slice(4, 6), "12");
|
|
118
|
+
});
|
|
119
|
+
// Raw but recognized codes encode silently.
|
|
120
|
+
assert.deepEqual(warnings, []);
|
|
121
|
+
});
|
|
122
|
+
it("warns on unrecognized raw codes", () => {
|
|
123
|
+
const warnings = captureWarnings(() => {
|
|
124
|
+
new Sidc().version("99").toString();
|
|
125
|
+
});
|
|
126
|
+
assert.equal(warnings.length, 1);
|
|
127
|
+
assert.match(warnings[0], /Unrecognized version code "99"/);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
describe("combination validation", () => {
|
|
131
|
+
it("suspect identity is valid in reality context", () => {
|
|
132
|
+
const warnings = captureWarnings(() => {
|
|
133
|
+
new Sidc({ strict: true })
|
|
134
|
+
.identity(StandardIdentity.SuspectJoker)
|
|
135
|
+
.symbolSet(SymbolSet.LandUnit)
|
|
136
|
+
.toString();
|
|
137
|
+
});
|
|
138
|
+
assert.deepEqual(warnings, []);
|
|
139
|
+
});
|
|
140
|
+
it("faker outside exercise context warns by default", () => {
|
|
141
|
+
const warnings = captureWarnings(() => {
|
|
142
|
+
new Sidc().identity(StandardIdentity.Faker).toString();
|
|
143
|
+
});
|
|
144
|
+
assert.equal(warnings.length, 1);
|
|
145
|
+
assert.match(warnings[0], /exercise context/);
|
|
146
|
+
});
|
|
147
|
+
it("suspect identity inside exercise context is clean", () => {
|
|
148
|
+
const sidc = new Sidc({ strict: true })
|
|
149
|
+
.context(Context.Exercise)
|
|
150
|
+
.identity(StandardIdentity.SuspectJoker)
|
|
151
|
+
.symbolSet(SymbolSet.LandUnit);
|
|
152
|
+
assert.doesNotThrow(() => sidc.toString());
|
|
153
|
+
});
|
|
154
|
+
it("strict mode throws instead of warning", () => {
|
|
155
|
+
const sidc = new Sidc({ strict: true }).identity(StandardIdentity.Faker);
|
|
156
|
+
assert.throws(() => sidc.toString(), SidcCombinationError);
|
|
157
|
+
});
|
|
158
|
+
it("condition status on control measures warns", () => {
|
|
159
|
+
const warnings = captureWarnings(() => {
|
|
160
|
+
new Sidc()
|
|
161
|
+
.symbolSet(SymbolSet.ControlMeasure)
|
|
162
|
+
.status(Status.Destroyed)
|
|
163
|
+
.toString();
|
|
164
|
+
});
|
|
165
|
+
assert.equal(warnings.length, 1);
|
|
166
|
+
assert.match(warnings[0], /control measure/);
|
|
167
|
+
});
|
|
168
|
+
it("exercise symbols on unknown sets need pending/unknown identity", () => {
|
|
169
|
+
const warnings = captureWarnings(() => {
|
|
170
|
+
new Sidc()
|
|
171
|
+
.context(Context.Exercise)
|
|
172
|
+
.identity(StandardIdentity.Neutral)
|
|
173
|
+
.toString();
|
|
174
|
+
});
|
|
175
|
+
assert.equal(warnings.length, 1);
|
|
176
|
+
assert.match(warnings[0], /unknown symbol set/);
|
|
177
|
+
});
|
|
178
|
+
it("flags symbol sets unsupported by legacy standards", () => {
|
|
179
|
+
const warnings = captureWarnings(() => {
|
|
180
|
+
new Sidc()
|
|
181
|
+
.version(Version.MilStd2525D)
|
|
182
|
+
.symbolSet(SymbolSet.LandDismountedIndividual)
|
|
183
|
+
.toString();
|
|
184
|
+
new Sidc().version(Version.App6D).symbolSet(SymbolSet.Cyberspace).toString();
|
|
185
|
+
});
|
|
186
|
+
assert.equal(warnings.length, 2);
|
|
187
|
+
assert.match(warnings[0], /2525D/);
|
|
188
|
+
assert.match(warnings[1], /APP-6 D/);
|
|
189
|
+
});
|
|
190
|
+
it("valid combinations produce no warnings", () => {
|
|
191
|
+
const warnings = captureWarnings(() => {
|
|
192
|
+
new Sidc({ strict: true })
|
|
193
|
+
.context(Context.Exercise)
|
|
194
|
+
.identity(StandardIdentity.Friend)
|
|
195
|
+
.symbolSet(SymbolSet.MineWarfare)
|
|
196
|
+
.status(Status.Planned)
|
|
197
|
+
.toString();
|
|
198
|
+
});
|
|
199
|
+
assert.deepEqual(warnings, []);
|
|
200
|
+
});
|
|
201
|
+
it("stacks multiple combination problems", () => {
|
|
202
|
+
const warnings = captureWarnings(() => {
|
|
203
|
+
new Sidc()
|
|
204
|
+
.identity(StandardIdentity.Faker)
|
|
205
|
+
.symbolSet(SymbolSet.ControlMeasure)
|
|
206
|
+
.status(Status.Damaged)
|
|
207
|
+
.toString();
|
|
208
|
+
});
|
|
209
|
+
assert.equal(warnings.length, 2);
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
describe("builder ergonomics", () => {
|
|
213
|
+
it("defaults to MIL-STD-2525E", () => {
|
|
214
|
+
assert.equal(new Sidc().toString().slice(0, 2), "13");
|
|
215
|
+
});
|
|
216
|
+
it("accepts an empty options object as non-strict", () => {
|
|
217
|
+
const warnings = captureWarnings(() => {
|
|
218
|
+
new Sidc({}).identity(StandardIdentity.Faker).toString();
|
|
219
|
+
});
|
|
220
|
+
assert.equal(warnings.length, 1);
|
|
221
|
+
});
|
|
222
|
+
it("is order independent", () => {
|
|
223
|
+
const a = new Sidc({ strict: true })
|
|
224
|
+
.identity(StandardIdentity.Friend)
|
|
225
|
+
.status(Status.Damaged)
|
|
226
|
+
.symbolSet(SymbolSet.Air);
|
|
227
|
+
const b = new Sidc({ strict: true })
|
|
228
|
+
.symbolSet(SymbolSet.Air)
|
|
229
|
+
.status(Status.Damaged)
|
|
230
|
+
.identity(StandardIdentity.Friend);
|
|
231
|
+
assert.equal(a.toString(), b.toString());
|
|
232
|
+
});
|
|
233
|
+
it("returns the same string on repeated calls", () => {
|
|
234
|
+
const sidc = new Sidc().identity(StandardIdentity.Neutral).symbolSet(SymbolSet.Space);
|
|
235
|
+
assert.equal(sidc.toString(), sidc.toString());
|
|
236
|
+
});
|
|
237
|
+
it("zero-fills positions 8-20", () => {
|
|
238
|
+
const rendered = new Sidc({ strict: true })
|
|
239
|
+
.version("14")
|
|
240
|
+
.context(Context.Simulation)
|
|
241
|
+
.identity(StandardIdentity.Neutral)
|
|
242
|
+
.symbolSet(SymbolSet.MineWarfare)
|
|
243
|
+
.status(Status.FullToCapacity)
|
|
244
|
+
.toString();
|
|
245
|
+
assert.equal(rendered.slice(7), "0".repeat(13));
|
|
246
|
+
});
|
|
247
|
+
it("accepts every enum member through its setter", () => {
|
|
248
|
+
for (const context of Object.values(Context)) {
|
|
249
|
+
assert.doesNotThrow(() => new Sidc({ strict: false }).context(context));
|
|
250
|
+
}
|
|
251
|
+
for (const identity of Object.values(StandardIdentity)) {
|
|
252
|
+
assert.doesNotThrow(() => new Sidc({ strict: false }).identity(identity));
|
|
253
|
+
}
|
|
254
|
+
for (const status of Object.values(Status)) {
|
|
255
|
+
assert.doesNotThrow(() => new Sidc({ strict: false }).status(status));
|
|
256
|
+
}
|
|
257
|
+
for (const symbolSet of Object.values(SymbolSet)) {
|
|
258
|
+
assert.doesNotThrow(() => new Sidc({ strict: false }).symbolSet(symbolSet));
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
describe("raw code escape hatch", () => {
|
|
263
|
+
it("recognizes codes milsymbol parses but that have no named constant", () => {
|
|
264
|
+
const warnings = captureWarnings(() => {
|
|
265
|
+
const rendered = new Sidc().symbolSet("39").toString();
|
|
266
|
+
assert.equal(rendered.slice(4, 6), "39");
|
|
267
|
+
assert.doesNotThrow(() => new Sidc().version("12").toString());
|
|
268
|
+
});
|
|
269
|
+
assert.deepEqual(warnings, []);
|
|
270
|
+
});
|
|
271
|
+
it("warns on unrecognized raw symbol sets", () => {
|
|
272
|
+
const warnings = captureWarnings(() => {
|
|
273
|
+
new Sidc().symbolSet("99").toString();
|
|
274
|
+
});
|
|
275
|
+
assert.equal(warnings.length, 1);
|
|
276
|
+
assert.match(warnings[0], /Unrecognized symbol set code "99"/);
|
|
277
|
+
});
|
|
278
|
+
it("throws in strict mode on unrecognized raw codes", () => {
|
|
279
|
+
assert.throws(() => new Sidc({ strict: true }).version("99").toString(), SidcCombinationError);
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
describe("error types", () => {
|
|
283
|
+
it("validation errors extend SidcError and TypeError semantics", () => {
|
|
284
|
+
assert.throws(() => new Sidc().identity("9"), (error) => error instanceof SidcValidationError && error instanceof Error);
|
|
285
|
+
});
|
|
286
|
+
it("combination errors extend SidcError", () => {
|
|
287
|
+
assert.throws(() => new Sidc({ strict: true }).identity(StandardIdentity.Faker).toString(), (error) => error instanceof SidcCombinationError && error instanceof Error);
|
|
288
|
+
});
|
|
289
|
+
it("names its errors", () => {
|
|
290
|
+
try {
|
|
291
|
+
new Sidc().identity("9");
|
|
292
|
+
assert.fail("expected throw");
|
|
293
|
+
}
|
|
294
|
+
catch (error) {
|
|
295
|
+
assert.equal(error.name, "SidcValidationError");
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
//# sourceMappingURL=sidc.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidc.test.js","sourceRoot":"","sources":["../../test/sidc.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EACL,OAAO,EACP,IAAI,EACJ,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,OAAO,GACR,MAAM,iBAAiB,CAAC;AAEzB,yEAAyE;AACzE,SAAS,eAAe,CAAC,EAAc;IACrC,MAAM,QAAQ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E,GAAG,EAAE;QAC7C,MAAM,CAAC,MAAM,CACX,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAC5E,CAAC,KAAc,EAAE,EAAE,CACjB,KAAK,YAAY,oBAAoB,IAAI,KAAK,YAAY,KAAK,CAClE,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAC1B,IAAI,CAAC;YACH,IAAI,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAY,CAAC,CAAC;YAClC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAE,KAAe,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "milsymbol-sidc",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Fluent TypeScript builder for MIL-STD-2525E / APP-6 numeric (20-character) SIDC strings, for use with milsymbol.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/src/index.js",
|
|
7
|
+
"types": "./dist/src/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/src/index.d.ts",
|
|
11
|
+
"default": "./dist/src/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"test": "npm run build && node --test \"dist/test/**/*.test.js\"",
|
|
20
|
+
"prepack": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=18"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"milsymbol",
|
|
27
|
+
"sidc",
|
|
28
|
+
"mil-std-2525",
|
|
29
|
+
"milstd2525e",
|
|
30
|
+
"app6",
|
|
31
|
+
"military",
|
|
32
|
+
"symbology",
|
|
33
|
+
"c2"
|
|
34
|
+
],
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^22.10.2",
|
|
38
|
+
"typescript": "^5.7.2"
|
|
39
|
+
}
|
|
40
|
+
}
|