milsymbol-sidc 0.1.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # milsymbol-sidc
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/milsymbol-sidc.svg)](https://www.npmjs.com/package/milsymbol-sidc)
4
+ [![npm downloads](https://img.shields.io/npm/dm/milsymbol-sidc.svg)](https://www.npmjs.com/package/milsymbol-sidc)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-%E2%89%A55.7-blue?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
7
+
3
8
  A fluent TypeScript builder for **20-character numeric SIDC strings** — the
4
9
  symbol identification code format used by [MIL-STD-2525E](https://en.wikipedia.org/wiki/MIL-STD-2525)
5
10
  and [APP-6](https://en.wikipedia.org/wiki/NATO_Joint_Military_Symbology) — made
@@ -7,6 +12,7 @@ for constructing symbols with the
7
12
  [milsymbol](https://github.com/spatialillusions/milsymbol) library.
8
13
 
9
14
  ```ts
15
+ import ms from "milsymbol";
10
16
  import { Sidc, StandardIdentity, SymbolSet } from "milsymbol-sidc";
11
17
 
12
18
  const sidc = new Sidc()
@@ -23,15 +29,18 @@ new ms.Symbol(sidc).asSVG(); // friendly land unit icon
23
29
  - **Validated output** — invalid values throw; inconsistent combinations warn
24
30
  (or throw in `strict` mode), using the same rules milsymbol applies when it
25
31
  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.
32
+ - **milsymbol-ready** — every generated 20-character string is accepted by
33
+ milsymbol's numeric parser. Full rendering depends on the entity and
34
+ modifier codes you supply, exactly as it does for any raw SIDC.
28
35
 
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.
36
+ > **Coverage:** complete structural encoding for positions 1–20 of the numeric
37
+ > SIDC. Positions 8–10 have named universal codes; positions 11–20 accept
38
+ > validated raw entity and modifier codes. Symbol-set-specific entity and
39
+ > modifier catalogs remain future work.
32
40
 
33
41
  ## Installation
34
42
 
43
+ Published on npm as [`milsymbol-sidc`](https://www.npmjs.com/package/milsymbol-sidc).
35
44
  Requires Node.js >= 18.
36
45
 
37
46
  ```bash
@@ -42,6 +51,15 @@ yarn add milsymbol-sidc
42
51
  pnpm add milsymbol-sidc
43
52
  ```
44
53
 
54
+ The rendering examples use [`milsymbol`](https://github.com/spatialillusions/milsymbol)
55
+ to draw the generated SIDC. It is **not** a dependency of this package —
56
+ `milsymbol-sidc` has zero runtime dependencies — so install it alongside when
57
+ you want to render symbols:
58
+
59
+ ```bash
60
+ npm install milsymbol
61
+ ```
62
+
45
63
  The package ships ESM with bundled TypeScript declarations (`dist/`).
46
64
 
47
65
  ## Quick start
@@ -50,6 +68,7 @@ The package ships ESM with bundled TypeScript declarations (`dist/`).
50
68
  import {
51
69
  Sidc,
52
70
  Context,
71
+ Standard,
53
72
  StandardIdentity,
54
73
  SymbolSet,
55
74
  Status,
@@ -72,44 +91,57 @@ The builder is **immutable**: each setter returns a new instance, so a base
72
91
  configuration can be safely reused:
73
92
 
74
93
  ```ts
75
- const base = new Sidc().version(Version.App6E);
94
+ import { Sidc, Standard, StandardIdentity } from "milsymbol-sidc";
95
+
96
+ const base = new Sidc({ standard: Standard.App6 });
76
97
 
77
98
  const friendly = base.identity(StandardIdentity.Friend).toString();
78
99
  const hostile = base.identity(StandardIdentity.SuspectJoker).toString();
79
- // base itself is unchanged
100
+ // base itself is unchanged; both derived SIDCs use APP-6 E (version "14")
80
101
  ```
81
102
 
82
103
  ## Anatomy of the generated SIDC
83
104
 
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)
105
+ ```text
106
+ 13 0 3 10 0 2 16 123456 78 90
107
+ │ │ │ │ │ │ │ │
108
+ │ │ │ │ │ │ └ modifier 2 (19–20)
109
+ │ │ │ │ │ │ └ │ modifier 1 (17–18)
110
+ │ │ │ │ │ │ entity code (11–16)
111
+ │ │ │ └ │ │ │ amplifier (9–10)
112
+ │ │ │ │ │ │ │ │ HQ/task force/feint-dummy (8)
113
+ │ │ └ │ │ │ │ │ status (7)
114
+ │ │ │ └ │ │ │ │ │ │ symbol set (5–6)
115
+ │ │ └ │ │ │ │ │ │ │ standard identity (4)
116
+ │ └ │ │ │ │ │ │ │ │ context (3)
117
+ └ │ │ │ │ │ │ │ │ │ version / edition (1–2)
93
118
  ```
94
119
 
95
- | Position | Field | Enum |
120
+ | Position | Field | API |
96
121
  | -------- | ------------------ | ----------------- |
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` |
122
+ | 1–2 | Version / edition | `Version`, `version()` |
123
+ | 3 | Context | `Context`, `context()` |
124
+ | 4 | Standard identity | `StandardIdentity`, `identity()` |
125
+ | 5–6 | Symbol set | `SymbolSet`, `symbolSet()` |
126
+ | 7 | Status / condition | `Status`, `status()` |
127
+ | 8 | HQ/task force/feint-dummy | `HqTaskForceDummy`, `hqTaskForceDummy()` |
128
+ | 9–10 | Amplifier | `Amplifier`, `amplifier()` |
129
+ | 11–16 | Entity code | `entity()` — six raw digits |
130
+ | 17–18 | Modifier 1 | `modifier1()` — two raw digits |
131
+ | 19–20 | Modifier 2 | `modifier2()` — two raw digits |
102
132
 
103
133
  ## API
104
134
 
105
135
  ### `new Sidc(options?)`
106
136
 
107
137
  Creates a builder preconfigured to 2525E / Reality / Unknown / Unknown set /
108
- Present.
138
+ Present. This remains the default for backward compatibility; configure
139
+ `Standard.App6` to default to APP-6 E instead.
109
140
 
110
141
  | Option | Type | Default | Description |
111
142
  | ------ | ---- | ------- | ----------- |
112
143
  | `strict` | `boolean` | `false` | Throw on invalid field combinations during `toString()` instead of warning. Invalid values always throw immediately regardless of this flag. |
144
+ | `standard` | `Standard` | Not configured (2525E behavior) | Select a standard family. `App6` defaults the version to APP-6 E (`"14"`); `MilStd2525` defaults it to MIL-STD-2525E (`"13"`). Explicit configuration also checks that later version choices belong to the selected family. |
113
145
 
114
146
  ### Methods
115
147
 
@@ -117,15 +149,88 @@ All setters validate their argument and return a new immutable `Sidc`.
117
149
 
118
150
  | Method | Field | Accepts |
119
151
  | ------ | ----- | ------- |
152
+ | `standard(s)` | Version default + validation rules | A `Standard` constant. It retains a compatible current version; otherwise it selects that family's latest edition. |
120
153
  | `version(v)` | Positions 1–2 | A `Version` constant or any two-digit string (escape hatch for future editions) |
121
154
  | `context(c)` | Position 3 | A `Context` constant |
122
155
  | `identity(i)` | Position 4 | A `StandardIdentity` constant |
123
156
  | `symbolSet(s)` | Positions 5–6 | A `SymbolSet` constant or any two-digit string |
124
157
  | `status(s)` | Position 7 | A `Status` constant |
158
+ | `hqTaskForceDummy(v)` | Position 8 | An `HqTaskForceDummy` constant |
159
+ | `amplifier(v)` | Positions 9–10 | An `Amplifier` constant |
160
+ | `entity(v)` | Positions 11–16 | Any six-digit string; symbol-set-specific catalogs are not included |
161
+ | `modifier1(v)` | Positions 17–18 | Any two-digit string; symbol-set-specific catalogs are not included |
162
+ | `modifier2(v)` | Positions 19–20 | Any two-digit string; symbol-set-specific catalogs are not included |
125
163
  | `toString()` | — | Validates combinations and renders the 20-character SIDC |
126
164
 
127
165
  ### Enum reference
128
166
 
167
+ #### `Standard`
168
+
169
+ Values match milsymbol's `standard` option and `ms.setStandard()` API, so the
170
+ same constant can configure both libraries.
171
+
172
+ | Constant | Value | Standard family |
173
+ | -------- | ----- | --------------- |
174
+ | `MilStd2525` | `"2525"` | US MIL-STD-2525 (**default behavior when omitted**) |
175
+ | `App6` | `"APP6"` | NATO APP-6 |
176
+
177
+ #### `HqTaskForceDummy`
178
+
179
+ Position 8 values identify headquarters, task force, and feint/dummy variants.
180
+
181
+ | Constant | Code | Meaning |
182
+ | -------- | ---- | ------- |
183
+ | `None` | `"0"` | None / not applicable |
184
+ | `FeintDummy` | `"1"` | Feint/dummy |
185
+ | `Headquarters` | `"2"` | Headquarters |
186
+ | `FeintDummyHeadquarters` | `"3"` | Feint/dummy headquarters |
187
+ | `TaskForce` | `"4"` | Task force |
188
+ | `FeintDummyTaskForce` | `"5"` | Feint/dummy task force |
189
+ | `TaskForceHeadquarters` | `"6"` | Task-force headquarters |
190
+ | `FeintDummyTaskForceHeadquarters` | `"7"` | Feint/dummy task-force headquarters |
191
+
192
+ #### `Amplifier`
193
+
194
+ Position 9–10 values identify echelon, mobility, leadership, or auxiliary
195
+ amplifiers. `None` writes the zero/no-amplifier code `"00"`.
196
+
197
+ | Constant | Code | Meaning |
198
+ | -------- | ---- | ------- |
199
+ | `None` | `"00"` | None / not specified |
200
+ | `TeamCrew` | `"11"` | Team/crew |
201
+ | `Squad` | `"12"` | Squad |
202
+ | `Section` | `"13"` | Section |
203
+ | `PlatoonDetachment` | `"14"` | Platoon/detachment |
204
+ | `CompanyBatteryTroop` | `"15"` | Company/battery/troop |
205
+ | `BattalionSquadron` | `"16"` | Battalion/squadron |
206
+ | `RegimentGroup` | `"17"` | Regiment/group |
207
+ | `Brigade` | `"18"` | Brigade |
208
+ | `Division` | `"21"` | Division |
209
+ | `CorpsMef` | `"22"` | Corps/MEF |
210
+ | `Army` | `"23"` | Army |
211
+ | `ArmyGroupFront` | `"24"` | Army group/front |
212
+ | `RegionTheater` | `"25"` | Region/theater |
213
+ | `Command` | `"26"` | Command |
214
+ | `WheeledLimitedCrossCountry` | `"31"` | Wheeled, limited cross-country |
215
+ | `WheeledCrossCountry` | `"32"` | Wheeled, cross-country |
216
+ | `Tracked` | `"33"` | Tracked |
217
+ | `WheeledTrackedCombination` | `"34"` | Wheeled and tracked combination |
218
+ | `Towed` | `"35"` | Towed |
219
+ | `Rail` | `"36"` | Rail |
220
+ | `PackAnimals` | `"37"` | Pack animals |
221
+ | `OverSnowPrimeMover` | `"41"` | Over snow, prime mover |
222
+ | `Sled` | `"42"` | Sled |
223
+ | `Barge` | `"51"` | Barge |
224
+ | `Amphibious` | `"52"` | Amphibious |
225
+ | `ShortTowedArray` | `"61"` | Short towed array |
226
+ | `LongTowedArray` | `"62"` | Long towed array |
227
+ | `LeaderIndividual` | `"71"` | Leader individual |
228
+ | `DeputyIndividual` | `"72"` | Deputy individual |
229
+
230
+ Entity and modifier setters intentionally accept raw digit strings so callers
231
+ can use codes specific to their symbol set and edition. They validate width and
232
+ ASCII digits but do not validate catalog membership.
233
+
129
234
  #### `Version`
130
235
 
131
236
  | Constant | Code | Standard |
@@ -202,8 +307,10 @@ string escape hatch.
202
307
  Two layers of validation run at different times:
203
308
 
204
309
  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.
310
+ input (wrong number of digits) or unknown enum codes. Values must be
311
+ strings: passing a number or other non-string value throws rather than
312
+ being coerced. This catches bugs at the call site rather than deep inside
313
+ rendering code.
207
314
  2. **`toString()`-time combination checks** — cross-field rules mirroring
208
315
  milsymbol's parser. By default problems are emitted with `console.warn`;
209
316
  with `{ strict: true }` they throw `SidcCombinationError`.
@@ -216,10 +323,23 @@ Active combination rules:
216
323
  identity is pending/unknown.
217
324
  - Symbol set 27 is unsupported in MIL-STD-2525D; symbol set 60 is unsupported
218
325
  in APP-6 D.
326
+ - When a `Standard` is explicitly configured, official version codes from the
327
+ other standard family are reported.
219
328
  - Raw version/symbol-set codes outside milsymbol's known tables are reported.
220
329
 
221
330
  ```ts
222
- import { Sidc, SidcValidationError, SidcCombinationError, Context, StandardIdentity, SymbolSet, Status } from "milsymbol-sidc";
331
+ import {
332
+ Amplifier,
333
+ Context,
334
+ HqTaskForceDummy,
335
+ Sidc,
336
+ SidcCombinationError,
337
+ SidcValidationError,
338
+ Standard,
339
+ StandardIdentity,
340
+ Status,
341
+ SymbolSet,
342
+ } from "milsymbol-sidc";
223
343
 
224
344
  // Throws immediately: "9" is not a valid identity code.
225
345
  new Sidc().identity("9" as never); // SidcValidationError
@@ -236,6 +356,17 @@ new Sidc({ strict: true })
236
356
  .symbolSet(SymbolSet.LandUnit)
237
357
  .toString(); // "13161000000000000000", no warnings
238
358
 
359
+ // A complete structural 20-position SIDC using raw entity/modifier codes.
360
+ new Sidc({ standard: Standard.App6, strict: true })
361
+ .identity(StandardIdentity.Friend)
362
+ .symbolSet(SymbolSet.LandUnit)
363
+ .hqTaskForceDummy(HqTaskForceDummy.Headquarters)
364
+ .amplifier(Amplifier.BattalionSquadron)
365
+ .entity("123456")
366
+ .modifier1("01")
367
+ .modifier2("09")
368
+ .toString(); // "14031002161234560109"
369
+
239
370
  // A real combination problem: condition status on a control measure.
240
371
  new Sidc({ strict: true })
241
372
  .symbolSet(SymbolSet.ControlMeasure)
@@ -268,12 +399,13 @@ parser, so codes from this package work without any configuration. The
268
399
  ### Node.js (ESM)
269
400
 
270
401
  ```js
271
- import ms from "milsymbol"; // bundles all standards incl. 2525E icons
272
- import { Sidc, StandardIdentity, SymbolSet } from "milsymbol-sidc";
402
+ import ms from "milsymbol"; // bundles all numeric standards
403
+ import { Sidc, Standard, StandardIdentity, SymbolSet } from "milsymbol-sidc";
273
404
 
274
- ms.setStandard("2525"); // or "APP6"
405
+ const standard = Standard.App6;
406
+ ms.setStandard(standard); // "APP6": use NATO styling
275
407
 
276
- const sidc = new Sidc()
408
+ const sidc = new Sidc({ standard }) // defaults to APP-6 E (version "14")
277
409
  .identity(StandardIdentity.Friend)
278
410
  .symbolSet(SymbolSet.LandUnit)
279
411
  .toString();
@@ -287,30 +419,62 @@ const svg = symbol.asSVG();
287
419
 
288
420
  ### Node.js (CommonJS)
289
421
 
422
+ `milsymbol-sidc` is ESM-only. From CommonJS, load it with dynamic `import()`.
423
+ `milsymbol` itself can be `require`d directly:
424
+
290
425
  ```js
291
426
  const ms = require("milsymbol");
292
- // same API as above
427
+
428
+ async function render() {
429
+ const { Sidc, Standard, StandardIdentity, SymbolSet } = await import(
430
+ "milsymbol-sidc"
431
+ );
432
+
433
+ const sidc = new Sidc({ standard: Standard.App6 })
434
+ .identity(StandardIdentity.Friend)
435
+ .symbolSet(SymbolSet.LandUnit)
436
+ .toString();
437
+
438
+ return new ms.Symbol(sidc, { size: 32 }).asSVG();
439
+ }
293
440
  ```
294
441
 
442
+ Node.js 20.19+ and 22.12+ can also `require("milsymbol-sidc")` directly via
443
+ `require(esm)`; earlier Node 18/20 releases must use `import()`.
444
+
295
445
  ### Browser
296
446
 
297
447
  ```html
298
448
  <script src="https://unpkg.com/milsymbol@3/dist/milsymbol.js"></script>
299
449
  <script type="module">
300
- import { Sidc, StandardIdentity, SymbolSet } from "https://unpkg.com/milsymbol-sidc/dist/src/index.js";
450
+ import { Sidc, Standard, StandardIdentity, SymbolSet } from "https://unpkg.com/milsymbol-sidc/dist/src/index.js";
301
451
 
302
- const sidc = new Sidc()
452
+ const sidc = new Sidc({ standard: Standard.App6 })
303
453
  .identity(StandardIdentity.Neutral)
304
454
  .symbolSet(SymbolSet.SeaSurface)
305
455
  .toString();
306
456
 
307
- document.body.innerHTML = new ms.Symbol(sidc).asSVG();
457
+ document.body.innerHTML = new ms.Symbol(sidc, {
458
+ standard: Standard.App6,
459
+ }).asSVG();
308
460
  </script>
309
461
  ```
310
462
 
311
463
  ### Recipes
312
464
 
313
465
  ```ts
466
+ import {
467
+ Amplifier,
468
+ Context,
469
+ HqTaskForceDummy,
470
+ Sidc,
471
+ Standard,
472
+ StandardIdentity,
473
+ Status,
474
+ SymbolSet,
475
+ Version,
476
+ } from "milsymbol-sidc";
477
+
314
478
  // Hostile planned armored unit
315
479
  new Sidc()
316
480
  .identity(StandardIdentity.SuspectJoker)
@@ -333,12 +497,27 @@ new Sidc()
333
497
  .toString(); // "13033640000000000000"
334
498
 
335
499
  // Exercise joker submarine under APP-6E
336
- new Sidc({ strict: true })
337
- .version("14")
500
+ new Sidc({ standard: Standard.App6, strict: true })
338
501
  .context(Context.Exercise)
339
502
  .identity(StandardIdentity.SuspectJoker)
340
503
  .symbolSet(SymbolSet.SeaSubsurface)
341
504
  .toString(); // "14153500000000000000"
505
+
506
+ // APP-6 unit with structural entity and modifier fields
507
+ new Sidc({ standard: Standard.App6, strict: true })
508
+ .identity(StandardIdentity.Friend)
509
+ .symbolSet(SymbolSet.LandUnit)
510
+ .entity("123456")
511
+ .modifier1("01")
512
+ .modifier2("09")
513
+ .toString(); // "14031000001234560109"
514
+
515
+ // APP-6 D configuration retains an explicitly selected compatible edition
516
+ new Sidc({ standard: Standard.App6, strict: true })
517
+ .version(Version.App6D)
518
+ .identity(StandardIdentity.Friend)
519
+ .symbolSet(SymbolSet.LandDismountedIndividual)
520
+ .toString(); // "11032700000000000000"
342
521
  ```
343
522
 
344
523
  ## Development
@@ -350,14 +529,15 @@ npm run build
350
529
  ```
351
530
 
352
531
  Test coverage includes per-field offset encoding for every enum member,
353
- defaults, immutability, setter validation errors, all combination rules in
354
- both warn and strict modes, raw-code escape hatches, and error class
355
- hierarchy.
532
+ defaults, immutability, setter validation errors, extended-field offsets,
533
+ all combination rules in both warn and strict modes, raw-code escape hatches,
534
+ and error class hierarchy.
356
535
 
357
536
  ## Roadmap
358
537
 
359
- - Positions 8–20: HQ/task force/dummy, echelon/mobility, entity catalog with
360
- named icon codes, sector modifiers.
538
+ - Symbol-set-specific named entity and modifier catalogs with semantic
539
+ validation.
540
+ - Official positions 21–30 / Set C extension data.
361
541
  - Parsing/decoding SIDC strings back into structured fields.
362
542
 
363
543
  ## License
@@ -1,9 +1,67 @@
1
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).
2
+ * Configuration values and field codes for positions 1-20 of the 20-character
3
+ * numeric SIDC (MIL-STD-2525D/E and APP-6 D/E coding structure).
4
4
  *
5
- * Values are the literal digit codes that appear in the SIDC string.
5
+ * SIDC field values are the literal digit codes that appear in the string.
6
6
  */
7
+ /**
8
+ * Symbol standard family.
9
+ *
10
+ * Values match milsymbol's `standard` option and `ms.setStandard()` API.
11
+ */
12
+ export declare const Standard: {
13
+ /** US MIL-STD-2525 (the default standard family). */
14
+ readonly MilStd2525: "2525";
15
+ /** NATO APP-6. */
16
+ readonly App6: "APP6";
17
+ };
18
+ export type Standard = (typeof Standard)[keyof typeof Standard];
19
+ /** Position 8: headquarters, task force, and feint/dummy indicator. */
20
+ export declare const HqTaskForceDummy: {
21
+ readonly None: "0";
22
+ readonly FeintDummy: "1";
23
+ readonly Headquarters: "2";
24
+ readonly FeintDummyHeadquarters: "3";
25
+ readonly TaskForce: "4";
26
+ readonly FeintDummyTaskForce: "5";
27
+ readonly TaskForceHeadquarters: "6";
28
+ readonly FeintDummyTaskForceHeadquarters: "7";
29
+ };
30
+ export type HqTaskForceDummy = (typeof HqTaskForceDummy)[keyof typeof HqTaskForceDummy];
31
+ /** Positions 9-10: echelon, mobility, leadership, or auxiliary amplifier. */
32
+ export declare const Amplifier: {
33
+ readonly None: "00";
34
+ readonly TeamCrew: "11";
35
+ readonly Squad: "12";
36
+ readonly Section: "13";
37
+ readonly PlatoonDetachment: "14";
38
+ readonly CompanyBatteryTroop: "15";
39
+ readonly BattalionSquadron: "16";
40
+ readonly RegimentGroup: "17";
41
+ readonly Brigade: "18";
42
+ readonly Division: "21";
43
+ readonly CorpsMef: "22";
44
+ readonly Army: "23";
45
+ readonly ArmyGroupFront: "24";
46
+ readonly RegionTheater: "25";
47
+ readonly Command: "26";
48
+ readonly WheeledLimitedCrossCountry: "31";
49
+ readonly WheeledCrossCountry: "32";
50
+ readonly Tracked: "33";
51
+ readonly WheeledTrackedCombination: "34";
52
+ readonly Towed: "35";
53
+ readonly Rail: "36";
54
+ readonly PackAnimals: "37";
55
+ readonly OverSnowPrimeMover: "41";
56
+ readonly Sled: "42";
57
+ readonly Barge: "51";
58
+ readonly Amphibious: "52";
59
+ readonly ShortTowedArray: "61";
60
+ readonly LongTowedArray: "62";
61
+ readonly LeaderIndividual: "71";
62
+ readonly DeputyIndividual: "72";
63
+ };
64
+ export type Amplifier = (typeof Amplifier)[keyof typeof Amplifier];
7
65
  /** Positions 1-2: Version / standard edition. */
8
66
  export declare const Version: {
9
67
  /** MIL-STD-2525D (edition D) */
@@ -1 +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,sDAAsD;;IAEtD,sDAAsD;;CAE9C,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;;;;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O,gBAAgB,CAAC,CAAC;AAE3D,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"}
package/dist/src/enums.js CHANGED
@@ -1,9 +1,64 @@
1
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).
2
+ * Configuration values and field codes for positions 1-20 of the 20-character
3
+ * numeric SIDC (MIL-STD-2525D/E and APP-6 D/E coding structure).
4
4
  *
5
- * Values are the literal digit codes that appear in the SIDC string.
5
+ * SIDC field values are the literal digit codes that appear in the string.
6
6
  */
7
+ /**
8
+ * Symbol standard family.
9
+ *
10
+ * Values match milsymbol's `standard` option and `ms.setStandard()` API.
11
+ */
12
+ export const Standard = {
13
+ /** US MIL-STD-2525 (the default standard family). */
14
+ MilStd2525: "2525",
15
+ /** NATO APP-6. */
16
+ App6: "APP6",
17
+ };
18
+ /** Position 8: headquarters, task force, and feint/dummy indicator. */
19
+ export const HqTaskForceDummy = {
20
+ None: "0",
21
+ FeintDummy: "1",
22
+ Headquarters: "2",
23
+ FeintDummyHeadquarters: "3",
24
+ TaskForce: "4",
25
+ FeintDummyTaskForce: "5",
26
+ TaskForceHeadquarters: "6",
27
+ FeintDummyTaskForceHeadquarters: "7",
28
+ };
29
+ /** Positions 9-10: echelon, mobility, leadership, or auxiliary amplifier. */
30
+ export const Amplifier = {
31
+ None: "00",
32
+ TeamCrew: "11",
33
+ Squad: "12",
34
+ Section: "13",
35
+ PlatoonDetachment: "14",
36
+ CompanyBatteryTroop: "15",
37
+ BattalionSquadron: "16",
38
+ RegimentGroup: "17",
39
+ Brigade: "18",
40
+ Division: "21",
41
+ CorpsMef: "22",
42
+ Army: "23",
43
+ ArmyGroupFront: "24",
44
+ RegionTheater: "25",
45
+ Command: "26",
46
+ WheeledLimitedCrossCountry: "31",
47
+ WheeledCrossCountry: "32",
48
+ Tracked: "33",
49
+ WheeledTrackedCombination: "34",
50
+ Towed: "35",
51
+ Rail: "36",
52
+ PackAnimals: "37",
53
+ OverSnowPrimeMover: "41",
54
+ Sled: "42",
55
+ Barge: "51",
56
+ Amphibious: "52",
57
+ ShortTowedArray: "61",
58
+ LongTowedArray: "62",
59
+ LeaderIndividual: "71",
60
+ DeputyIndividual: "72",
61
+ };
7
62
  /** Positions 1-2: Version / standard edition. */
8
63
  export const Version = {
9
64
  /** MIL-STD-2525D (edition D) */
@@ -1 +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,IAAI;IACX,8CAA8C;IAC9C,WAAW,EAAE,IAAI;IACjB,sBAAsB;IACtB,KAAK,EAAE,IAAI;CACH,CAAC;AAGX,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,OAAO,EAAE,GAAG;IACZ,QAAQ,EAAE,GAAG;IACb,UAAU,EAAE,GAAG;CACP,CAAC;AAGX,mDAAmD;AACnD,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,GAAG;IACZ,aAAa,EAAE,GAAG;IAClB,MAAM,EAAE,GAAG;IACX,OAAO,EAAE,GAAG;IACZ,sDAAsD;IACtD,YAAY,EAAE,GAAG;IACjB,sDAAsD;IACtD,YAAY,EAAE,GAAG;CACT,CAAC;AAGX,8EAA8E;A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;IAC9B,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,GAAG;IACZ,aAAa,EAAE,GAAG;IAClB,MAAM,EAAE,GAAG;IACX,OAAO,EAAE,GAAG;IACZ,sDAAsD;IACtD,YAAY,EAAE,GAAG;IACjB,sDAAsD;IACtD,YAAY,EAAE,GAAG;CACT,CAAC;AAIX,8EAA8E;AAC9E,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO,EAAE,IAAI;IACb,GAAG,EAAE,IAAI;IACT,UAAU,EAAE,IAAI;IAChB,KAAK,EAAE,IAAI;IACX,YAAY,EAAE,IAAI;IAClB,QAAQ,EAAE,IAAI;IACd,gBAAgB,EAAE,IAAI;IACtB,aAAa,EAAE,IAAI;IACnB,YAAY,EAAE,IAAI;IAClB,cAAc,EAAE,IAAI;IACpB,wBAAwB,EAAE,IAAI;IAC9B,UAAU,EAAE,IAAI;IAChB,aAAa,EAAE,IAAI;IACnB,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,IAAI;IACd,wBAAwB,EAAE,IAAI;IAC9B,sBAAsB,EAAE,IAAI;IAC5B,uBAAuB,EAAE,IAAI;IAC7B,6BAA6B,EAAE,IAAI;IACnC,6BAA6B,EAAE,IAAI;IACnC,UAAU,EAAE,IAAI;CACR,CAAC;AAGX,sCAAsC;AACtC,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,GAAG;IACZ,YAAY,EAAE,GAAG;IACjB,OAAO,EAAE,GAAG;IACZ,SAAS,EAAE,GAAG;IACd,cAAc,EAAE,GAAG;CACX,CAAC"}
@@ -1,4 +1,4 @@
1
- export { Context, StandardIdentity, Status, SymbolSet, Version, } from "./enums.js";
1
+ export { Amplifier, Context, HqTaskForceDummy, Standard, StandardIdentity, Status, SymbolSet, Version, } from "./enums.js";
2
2
  export { Sidc, type SidcOptions } from "./sidc.js";
3
3
  export { SidcCombinationError, SidcError, SidcValidationError, } from "./validate.js";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,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"}
package/dist/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { Context, StandardIdentity, Status, SymbolSet, Version, } from "./enums.js";
1
+ export { Amplifier, Context, HqTaskForceDummy, Standard, StandardIdentity, Status, SymbolSet, Version, } from "./enums.js";
2
2
  export { Sidc } from "./sidc.js";
3
3
  export { SidcCombinationError, SidcError, SidcValidationError, } from "./validate.js";
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,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"}
@@ -1,4 +1,4 @@
1
- import { Context, StandardIdentity, Status, SymbolSet, Version } from "./enums.js";
1
+ import { Amplifier, Context, HqTaskForceDummy, Standard, StandardIdentity, Status, SymbolSet, Version } from "./enums.js";
2
2
  import { type SidcFields } from "./validate.js";
3
3
  export interface SidcOptions {
4
4
  /**
@@ -7,13 +7,19 @@ export interface SidcOptions {
7
7
  * Invalid individual values always throw immediately.
8
8
  */
9
9
  strict?: boolean;
10
+ /**
11
+ * Configure a standard family. This selects its latest edition by default
12
+ * (APP-6 E or MIL-STD-2525E) and enables standard/version consistency checks.
13
+ * Omit this option to preserve the original MIL-STD-2525E behavior.
14
+ */
15
+ standard?: Standard;
10
16
  }
11
17
  /**
12
18
  * Fluent builder for 20-character numeric SIDC strings
13
19
  * (MIL-STD-2525E / APP-6 coding structure).
14
20
  *
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)`.
21
+ * Covers all positions 1-20 of the numeric SIDC so the result can be passed
22
+ * straight to milsymbol's `new ms.Symbol(sidc)`.
17
23
  *
18
24
  * All setters are immutable: they return a new `Sidc` and leave the original
19
25
  * untouched.
@@ -33,8 +39,32 @@ export declare class Sidc {
33
39
  /**
34
40
  * @param options Builder behaviour flags.
35
41
  * @param fields Initial field values. Internal; used for immutable clones.
42
+ * Legacy records may omit the newly supported tail fields; omitted and
43
+ * explicitly-undefined values are normalized to their zero defaults. Every
44
+ * supplied value is validated, so this path cannot produce a malformed SIDC.
45
+ */
46
+ constructor(options?: SidcOptions, fields?: Partial<SidcFields> | null);
47
+ /**
48
+ * Configures the standard family and its validation rules.
49
+ *
50
+ * A version already belonging to the selected family is retained. Otherwise
51
+ * it is reset to that family's latest edition (APP-6 E or MIL-STD-2525E).
52
+ */
53
+ standard(standard: Standard): Sidc;
54
+ /**
55
+ * Position 8: headquarters, task force, and feint/dummy indicator.
56
+ */
57
+ hqTaskForceDummy(value: HqTaskForceDummy): Sidc;
58
+ /**
59
+ * Positions 9-10: echelon, mobility, leadership, or auxiliary amplifier.
36
60
  */
37
- constructor(options?: SidcOptions, fields?: SidcFields);
61
+ amplifier(value: Amplifier): Sidc;
62
+ /** Positions 11-16: six-digit entity code. */
63
+ entity(value: string): Sidc;
64
+ /** Positions 17-18: two-digit modifier 1 code. */
65
+ modifier1(value: string): Sidc;
66
+ /** Positions 19-20: two-digit modifier 2 code. */
67
+ modifier2(value: string): Sidc;
38
68
  /** Positions 1-2: standard edition. Accepts known codes or a raw two-digit code. */
39
69
  version(version: Version | (string & {})): Sidc;
40
70
  /** Position 3: context. */