@ac-kit/net-address 0.2.3 → 0.3.1

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 CHANGED
@@ -1,5 +1,56 @@
1
1
  # @ac-kit/net-address
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [c18e8f3]
8
+ - @ac-kit/algo@0.3.0
9
+
10
+ ## 0.3.0
11
+
12
+ ### Minor Changes
13
+
14
+ - 7f9f15d: Argument shapes follow one rule: required arguments are positional, `options`
15
+ is optional with every field optional, and five or more parameters become one
16
+ `input` object.
17
+
18
+ - `core`: `truncateCore(input: TruncateCoreInput)` takes `atoms`, `measure`
19
+ and `maxMeasure`; `input.options` (`TruncateCoreOptions`) takes the
20
+ `TruncateOptions` fields with their defaults, plus `ellipsisMeasure`
21
+ (default `measure(ellipsisString)`).
22
+ - `node`: `new ProcessExitWithOutputError(input)` takes
23
+ `{ code, signal, killed, stdout, stderr, options? }`.
24
+ - `async`: `staggeredRace(candidates, attempt, options?)`; `delayMs` defaults
25
+ to 250, RFC 8305's Connection Attempt Delay.
26
+ - `crypto-mac`: `hmac({ hash, blockSizeBytes, key, message, options? })` with
27
+ `options.tagLengthBytes`, and
28
+ `hmacVerify({ hash, blockSizeBytes, key, message, tag })`.
29
+ - `math-grid`: `dfsPackGrid2(items, columnCount, classify, options?)`, with the
30
+ new `GridPackClassifier` type; `findFrontierTilings(input)` takes
31
+ `{ grid, items, getSize, getDedupeKey, getMoveScore, options? }`.
32
+ - `net-address`: `printEui(address, options?)` and
33
+ `printEuiOui(address, options?)` default to the IEEE Std 802 canonical
34
+ spelling: `notation` `"hyphen"`, `letterCase` `"upper"`.
35
+ - `format-monospace`: `renderTableRow(input)` takes
36
+ `{ row, rowIndex, columns, layout, options? }`.
37
+ - `format-asn1`: `module(name, types, options?)`; `ModuleOptions` no longer
38
+ holds `name`.
39
+ - `app-config`: `resolveExtendableConfig(input)` takes
40
+ `{ configData, configPath, configParser, configId, options? }`.
41
+ - `@ac-bench/core`: `new Sampler(policy, bounds, options?)`;
42
+ `runForkUnit(input)` takes `{ unit, signal, sink, file, parentScopeId,
43
+ options? }`; `runCaseOnce(input)` takes
44
+ `{ unit, caseTitle, signal, file, options? }`, with `options.measureOptions`
45
+ defaulting to `{}`.
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies [7f9f15d]
50
+ - @ac-kit/core@0.7.0
51
+ - @ac-kit/algo@0.2.4
52
+ - @ac-kit/math-numbers@0.2.4
53
+
3
54
  ## 0.2.3
4
55
 
5
56
  ### Patch Changes
package/README.md CHANGED
@@ -56,9 +56,10 @@ returns, never the string.
56
56
  suppressed, the longest run of zero groups compressed to `::` — leftmost on a
57
57
  tie, never for a single group — and IPv4-mapped addresses in dotted form.
58
58
 
59
- `printEui` has no default notation or case, because there is no neutral choice:
60
- IEEE Std 802 writes `00-1A-2B-3C-4D-5E` and RFC 7042 writes
61
- `00:1a:2b:3c:4d:5e`. `EUI_PRINT_IEEE` and `EUI_PRINT_IETF` name the two.
59
+ `printEui` defaults to the IEEE Std 802 canonical spelling,
60
+ `00-1A-2B-3C-4D-5E`. RFC 7042 writes `00:1a:2b:3c:4d:5e` instead, so pass
61
+ `EUI_PRINT_IETF` when comparing against IETF-style strings; `EUI_PRINT_IEEE`
62
+ names the default.
62
63
 
63
64
  See the
64
65
  [generated API docs](https://anthochamp.pages.grenadine.io/node-essentials/api/net-address/)
@@ -12,33 +12,35 @@ export type EuiNotation =
12
12
  /** Which case the hexadecimal digits are written in. */
13
13
  export type EuiLetterCase = "lower" | "upper";
14
14
  /**
15
- * How to spell an EUI.
16
- *
17
- * Neither field has a default: IEEE Std 802 prints `00-1A-2B-3C-4D-5E` and RFC
18
- * 7042 prints `00:1a:2b:3c:4d:5e`, and a library that quietly picks one makes
19
- * the other's consumers compare strings that never match.
15
+ * How to spell an EUI. Defaults to the IEEE Std 802 canonical form; RFC 7042
16
+ * prints `00:1a:2b:3c:4d:5e` instead, so pass {@link EUI_PRINT_IETF} when
17
+ * comparing against IETF-style strings.
20
18
  */
21
19
  export type EuiPrintOptions = {
22
- readonly notation: EuiNotation;
23
- readonly letterCase: EuiLetterCase;
20
+ /** Default: `"hyphen"`. */
21
+ readonly notation?: EuiNotation;
22
+ /** Default: `"upper"`. */
23
+ readonly letterCase?: EuiLetterCase;
24
24
  };
25
25
  /** The IEEE Std 802 canonical spelling: hyphen-separated, uppercase. */
26
- export declare const EUI_PRINT_IEEE: EuiPrintOptions;
26
+ export declare const EUI_PRINT_IEEE: Required<EuiPrintOptions>;
27
27
  /** The IETF spelling of RFC 7042: colon-separated, lowercase. */
28
- export declare const EUI_PRINT_IETF: EuiPrintOptions;
28
+ export declare const EUI_PRINT_IETF: Required<EuiPrintOptions>;
29
29
  /**
30
- * Prints an EUI-48 or EUI-64 in the requested notation and case. O(1).
30
+ * Prints an EUI-48 or EUI-64 in the requested notation and case — by default
31
+ * the IEEE canonical `00-1A-2B-3C-4D-5E`. O(1).
31
32
  *
32
33
  * @throws RangeError When the address is neither 48 nor 64 bits wide.
33
34
  */
34
- export declare function printEui(address: BitAddress, options: EuiPrintOptions): string;
35
+ export declare function printEui(address: BitAddress, options?: EuiPrintOptions): string;
35
36
  /**
36
37
  * Prints the leading 24 bits — the OUI, or the CID for a locally assigned
37
38
  * address.
38
39
  *
39
40
  * The Cisco dotted notation has no three-octet form, so it prints hyphenated.
41
+ * Defaults as {@link printEui}.
40
42
  *
41
43
  * @throws RangeError When the address is neither 48 nor 64 bits wide.
42
44
  */
43
- export declare function printEuiOui(address: BitAddress, options: EuiPrintOptions): string;
45
+ export declare function printEuiOui(address: BitAddress, options?: EuiPrintOptions): string;
44
46
  //# sourceMappingURL=print-eui.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"print-eui.d.ts","sourceRoot":"","sources":["../../src/eui/print-eui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAqB,M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E,aAAa,CAAC;CACpC,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,eAAe,CAGpD,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,eAAe,CAGpD,CAAC;AA8CF;;;;;GAKG;AACH,wBAAgB,QAAQ,CACvB,OAAO,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,eAAe,GACvB,MAAM,CAQR;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAC1B,OAAO,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,eAAe,GACvB,MAAM,CAUR"}
@@ -16,12 +16,12 @@ function assertEuiWidth(address) {
16
16
  throw new RangeError(`expected a 48- or 64-bit EUI, got ${address.bitWidth} bits`);
17
17
  }
18
18
  }
19
- function joinOctets(octets, options) {
19
+ function joinOctets(octets, notation, letterCase) {
20
20
  const digits = Array.from(octets, (byte) => {
21
21
  const pair = byte.toString(16).padStart(2, "0");
22
- return options.letterCase === "upper" ? pair.toUpperCase() : pair;
22
+ return letterCase === "upper" ? pair.toUpperCase() : pair;
23
23
  });
24
- switch (options.notation) {
24
+ switch (notation) {
25
25
  case "colon": {
26
26
  return digits.join(":");
27
27
  }
@@ -41,24 +41,27 @@ function joinOctets(octets, options) {
41
41
  }
42
42
  }
43
43
  /**
44
- * Prints an EUI-48 or EUI-64 in the requested notation and case. O(1).
44
+ * Prints an EUI-48 or EUI-64 in the requested notation and case — by default
45
+ * the IEEE canonical `00-1A-2B-3C-4D-5E`. O(1).
45
46
  *
46
47
  * @throws RangeError When the address is neither 48 nor 64 bits wide.
47
48
  */
48
49
  export function printEui(address, options) {
49
50
  assertEuiWidth(address);
50
- return joinOctets(bitAddressToBytes(address), options);
51
+ return joinOctets(bitAddressToBytes(address), options?.notation ?? EUI_PRINT_IEEE.notation, options?.letterCase ?? EUI_PRINT_IEEE.letterCase);
51
52
  }
52
53
  /**
53
54
  * Prints the leading 24 bits — the OUI, or the CID for a locally assigned
54
55
  * address.
55
56
  *
56
57
  * The Cisco dotted notation has no three-octet form, so it prints hyphenated.
58
+ * Defaults as {@link printEui}.
57
59
  *
58
60
  * @throws RangeError When the address is neither 48 nor 64 bits wide.
59
61
  */
60
62
  export function printEuiOui(address, options) {
61
63
  assertEuiWidth(address);
62
- return joinOctets(bitAddressToBytes(address).subarray(0, 3), options.notation === "dot" ? { ...options, notation: "hyphen" } : options);
64
+ const notation = options?.notation ?? EUI_PRINT_IEEE.notation;
65
+ return joinOctets(bitAddressToBytes(address).subarray(0, 3), notation === "dot" ? "hyphen" : notation, options?.letterCase ?? EUI_PRINT_IEEE.letterCase);
63
66
  }
64
67
  //# sourceMappingURL=print-eui.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"print-eui.js","sourceRoot":"","sources":["../../src/eui/print-eui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AA4BlE,wEAAwE;AACxE,MAAM,CAAC,MAAM,cAAc,GAAoB;IAC9C,QAAQ,EAAE,QAAQ;IAClB,UAAU,EAAE,OAAO;CACnB,CAAC;AAEF,iEAAiE;AACjE,MAAM,CAAC,MAAM,cAAc,GAAoB;IAC9C,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE,OAAO;CACnB,CAAC;AAEF,SAAS,cAAc,CAAC,OAAmB;IAC1C,IACC,OAAO,CAAC,QAAQ,KAAK,eAAe;QACpC,OAAO,CAAC,QAAQ,KAAK,eAAe,EACnC,CAAC;QACF,MAAM,IAAI,UAAU,CACnB,qCAAqC,OAAO,CAAC,QAAQ,OAAO,CAC5D,CAAC;IACH,CAAC;AACF,CAAC;AAED,SAAS,UAAU,CAAC,MAAkB,EAAE,OAAwB;IAC/D,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,EAA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OAAO,EAAE,QAAQ,IAAI,cAAc,CAAC,QAAQ,CAAC;IAE9D,OAAO,UAAU,CAChB,iBAAiB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EACzC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EACxC,OAAO,EAAE,UAAU,IAAI,cAAc,CAAC,UAAU,CAChD,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ac-kit/net-address",
3
- "version": "0.2.3",
3
+ "version": "0.3.1",
4
4
  "description": "Network addresses: IPv4, IPv6, EUI-48/EUI-64 and ports, over one fixed-width prefix core.",
5
5
  "keywords": [
6
6
  "cidr",
@@ -46,10 +46,10 @@
46
46
  "prepack": "yarn build"
47
47
  },
48
48
  "dependencies": {
49
- "@ac-kit/algo": "^0.2.3",
50
- "@ac-kit/core": "^0.6.0",
51
- "@ac-kit/math-numbers": "^0.2.3",
52
- "@types/web": "^0.0.362"
49
+ "@ac-kit/algo": "^0.3.0",
50
+ "@ac-kit/core": "^0.7.0",
51
+ "@ac-kit/math-numbers": "^0.2.4",
52
+ "@types/web": "^0.0.365"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@ac-kit/tsconfig": "0.1.0",