iproutejs 2.3.1 → 2.3.3

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
@@ -181,6 +181,57 @@ Both of these calls are valid:
181
181
 
182
182
  A **PR** is more than welcome.
183
183
 
184
+ ## Error Handling
185
+
186
+ All write operations (`add`, `del`, `set`, …) throw a `CommandError` when the underlying `ip` command writes to stderr.
187
+ The error has two useful properties:
188
+
189
+ | Property | Type | Description |
190
+ |----------|------|-------------|
191
+ | `message` | `string` | Raw stderr text from the `ip` command |
192
+ | `code` | `string` | Typed reason code — see `CommandErrorCodes` |
193
+ | `cmd` | `string` | Full command line that was executed |
194
+
195
+ Import the constants to avoid magic strings in your catch blocks:
196
+
197
+ ```typescript
198
+ import { address, CommandError, CommandErrorCodes } from 'iproutejs';
199
+
200
+ try {
201
+ await address.add({ local: '192.168.1.1/24', dev: 'eth0', sudo: true });
202
+ } catch (err) {
203
+ if (err instanceof CommandError) {
204
+ switch (err.code) {
205
+ case CommandErrorCodes.ALREADY_EXISTS:
206
+ // iproute2: "RTNETLINK answers: File exists"
207
+ // or newer: "Error: ipv4: Address already assigned."
208
+ console.log('Address already configured — skipping');
209
+ break;
210
+ case CommandErrorCodes.NO_DEVICE:
211
+ // iproute2: "Cannot find device\"eth0\""
212
+ throw new Error(`Network device not found: ${err.message}`);
213
+ case CommandErrorCodes.NOT_FOUND:
214
+ // iproute2: "RTNETLINK answers: No such process"
215
+ console.log('Object does not exist — nothing to remove');
216
+ break;
217
+ default:
218
+ throw err; // ERR_COMMAND_ERRORED — unexpected error
219
+ }
220
+ } else {
221
+ throw err;
222
+ }
223
+ }
224
+ ```
225
+
226
+ ### Available `CommandErrorCodes`
227
+
228
+ | Code | Triggers on |
229
+ |------|-------------|
230
+ | `ERR_ALREADY_EXISTS` | `File exists` \| `Address already assigned` |
231
+ | `ERR_NO_DEVICE` | `No such device` \| `Cannot find device` |
232
+ | `ERR_NOT_FOUND` | `No such process` |
233
+ | `ERR_COMMAND_ERRORED` | any other stderr output (fallback) |
234
+
184
235
  ## Issues
185
236
 
186
237
  The source code can be accessed on [GitHub](https://github.com/jakguel/iproutejs).
@@ -1,9 +1,23 @@
1
+ /**
2
+ * Known reason codes for {@link CommandError}.
3
+ * @category Errors
4
+ */
5
+ export declare const CommandErrorCodes: {
6
+ /** Address or route already exists (iproute2: "File exists" or "Address already assigned"). */
7
+ readonly ALREADY_EXISTS: "ERR_ALREADY_EXISTS";
8
+ /** Network device not found (iproute2: "No such device" or "Cannot find device"). */
9
+ readonly NO_DEVICE: "ERR_NO_DEVICE";
10
+ /** Object not found (iproute2: "No such process"). */
11
+ readonly NOT_FOUND: "ERR_NOT_FOUND";
12
+ /** Generic fallback — stderr did not match any known pattern. */
13
+ readonly COMMAND_ERRORED: "ERR_COMMAND_ERRORED";
14
+ };
1
15
  /**
2
16
  * Error class to be used when the command throws an error.
3
17
  * @category Errors
4
18
  */
5
19
  export declare class CommandError extends Error {
6
- /** Code to identify the error in `catch` clauses. */
20
+ /** Code to identify the error in `catch` clauses. See {@link CommandErrorCodes}. */
7
21
  code: string;
8
22
  /** Command line that triggered the command error. */
9
23
  cmd: string;
@@ -1,6 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandError = void 0;
3
+ exports.CommandError = exports.CommandErrorCodes = void 0;
4
+ /**
5
+ * Known reason codes for {@link CommandError}.
6
+ * @category Errors
7
+ */
8
+ exports.CommandErrorCodes = {
9
+ /** Address or route already exists (iproute2: "File exists" or "Address already assigned"). */
10
+ ALREADY_EXISTS: 'ERR_ALREADY_EXISTS',
11
+ /** Network device not found (iproute2: "No such device" or "Cannot find device"). */
12
+ NO_DEVICE: 'ERR_NO_DEVICE',
13
+ /** Object not found (iproute2: "No such process"). */
14
+ NOT_FOUND: 'ERR_NOT_FOUND',
15
+ /** Generic fallback — stderr did not match any known pattern. */
16
+ COMMAND_ERRORED: 'ERR_COMMAND_ERRORED',
17
+ };
18
+ function deriveCode(message) {
19
+ if (message.includes('File exists') || message.includes('Address already assigned')) {
20
+ return exports.CommandErrorCodes.ALREADY_EXISTS;
21
+ }
22
+ if (message.includes('No such device') || message.includes('Cannot find device')) {
23
+ return exports.CommandErrorCodes.NO_DEVICE;
24
+ }
25
+ if (message.includes('No such process')) {
26
+ return exports.CommandErrorCodes.NOT_FOUND;
27
+ }
28
+ return exports.CommandErrorCodes.COMMAND_ERRORED;
29
+ }
4
30
  /**
5
31
  * Error class to be used when the command throws an error.
6
32
  * @category Errors
@@ -9,11 +35,10 @@ class CommandError extends Error {
9
35
  constructor(message, cmd) {
10
36
  // 'Error' breaks prototype chain here.
11
37
  super(message);
12
- /** Code to identify the error in `catch` clauses. */
13
- this.code = 'ERR_COMMAND_ERRORED';
14
38
  // Fixing the break.
15
39
  Object.setPrototypeOf(this, CommandError.prototype);
16
40
  this.cmd = cmd;
41
+ this.code = deriveCode(message);
17
42
  }
18
43
  }
19
44
  exports.CommandError = CommandError;
@@ -1 +1 @@
1
- {"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/common/errors/command.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAa,YAAa,SAAQ,KAAK;IAOrC,YAAY,OAAe,EAAE,GAAW;QACtC,uCAAuC;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QARjB,qDAAqD;QACrD,SAAI,GAAG,qBAAqB,CAAC;QAQ3B,oBAAoB;QACpB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;QAEpD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;CACF;AAfD,oCAeC"}
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/common/errors/command.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,iBAAiB,GAAG;IAC/B,+FAA+F;IAC/F,cAAc,EAAG,oBAAoB;IACrC,qFAAqF;IACrF,SAAS,EAAQ,eAAe;IAChC,sDAAsD;IACtD,SAAS,EAAQ,eAAe;IAChC,iEAAiE;IACjE,eAAe,EAAE,qBAAqB;CAC9B,CAAC;AAEX,SAAS,UAAU,CAAC,OAAe;IACjC,IAAI,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAC,EAAE;QACnF,OAAO,yBAAiB,CAAC,cAAc,CAAC;KACzC;IACD,IAAI,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE;QAChF,OAAO,yBAAiB,CAAC,SAAS,CAAC;KACpC;IACD,IAAI,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE;QACvC,OAAO,yBAAiB,CAAC,SAAS,CAAC;KACpC;IACD,OAAO,yBAAiB,CAAC,eAAe,CAAC;AAC3C,CAAC;AAED;;;GAGG;AACH,MAAa,YAAa,SAAQ,KAAK;IAOrC,YAAY,OAAe,EAAE,GAAW;QACtC,uCAAuC;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,oBAAoB;QACpB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;QAEpD,IAAI,CAAC,GAAG,GAAI,GAAG,CAAC;QAChB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;CACF;AAhBD,oCAgBC"}
@@ -2,13 +2,17 @@
2
2
  * Robust parser for `ip -json` command output.
3
3
  *
4
4
  * Some iproute2 versions do not produce a valid JSON array but instead output
5
- * objects separated by newlines (NDJSON), or a JSON array where elements are
6
- * separated by newlines without commas. This function tries three strategies:
5
+ * objects separated by newlines (NDJSON), a JSON array where elements are
6
+ * separated by newlines without commas, or JSON interleaved with plain-text
7
+ * statistics (e.g. RX/TX tables from `-statistics`).
7
8
  *
8
- * 1. Standard JSON – `[{...},{...}]`
9
- * 2. NDJSON – `{...}\n{...}` or `[...]\n[...]`
10
- * 3. Array w/o commas – `[{...}\n{...}]`
9
+ * This function tries four strategies in order:
11
10
  *
12
- * Throws `SyntaxError` only if all three strategies fail.
11
+ * 1. Standard JSON – `[{...},{...}]`
12
+ * 2. Strip non-JSON lines – remove plain-text (RX/TX stats), retry JSON
13
+ * 3. NDJSON – `{...}\n{...}` or `[...]\n[...]`
14
+ * 4. Array w/o commas – `[{...}\n{...}]`
15
+ *
16
+ * Throws `SyntaxError` only if all four strategies fail.
13
17
  */
14
18
  export declare function parseCommandOutput<T>(stdout: string): T;
@@ -5,14 +5,18 @@ exports.parseCommandOutput = void 0;
5
5
  * Robust parser for `ip -json` command output.
6
6
  *
7
7
  * Some iproute2 versions do not produce a valid JSON array but instead output
8
- * objects separated by newlines (NDJSON), or a JSON array where elements are
9
- * separated by newlines without commas. This function tries three strategies:
8
+ * objects separated by newlines (NDJSON), a JSON array where elements are
9
+ * separated by newlines without commas, or JSON interleaved with plain-text
10
+ * statistics (e.g. RX/TX tables from `-statistics`).
10
11
  *
11
- * 1. Standard JSON – `[{...},{...}]`
12
- * 2. NDJSON – `{...}\n{...}` or `[...]\n[...]`
13
- * 3. Array w/o commas – `[{...}\n{...}]`
12
+ * This function tries four strategies in order:
14
13
  *
15
- * Throws `SyntaxError` only if all three strategies fail.
14
+ * 1. Standard JSON – `[{...},{...}]`
15
+ * 2. Strip non-JSON lines – remove plain-text (RX/TX stats), retry JSON
16
+ * 3. NDJSON – `{...}\n{...}` or `[...]\n[...]`
17
+ * 4. Array w/o commas – `[{...}\n{...}]`
18
+ *
19
+ * Throws `SyntaxError` only if all four strategies fail.
16
20
  */
17
21
  function parseCommandOutput(stdout) {
18
22
  const trimmed = stdout.trim();
@@ -24,9 +28,26 @@ function parseCommandOutput(stdout) {
24
28
  return JSON.parse(trimmed);
25
29
  }
26
30
  catch ( /* fall through */_a) { /* fall through */ }
27
- // 2. NDJSON one JSON value per line
31
+ // 2. Strip non-JSON lines (e.g. RX/TX plain-text statistics from `ip -statistics`)
32
+ // and retry. JSON-relevant lines start with [ ] { } , or "
33
+ const stripped = trimmed
34
+ .split('\n')
35
+ .filter(line => {
36
+ const l = line.trim();
37
+ return !l || /^[\[{\]},"]/.test(l);
38
+ })
39
+ .join('\n')
40
+ .trim();
41
+ if (stripped && stripped !== trimmed) {
42
+ try {
43
+ return JSON.parse(stripped);
44
+ }
45
+ catch ( /* fall through */_b) { /* fall through */ }
46
+ }
47
+ // 3. NDJSON — one JSON value per line (use stripped version if available)
48
+ const source = stripped || trimmed;
28
49
  const fromLines = [];
29
- for (const line of trimmed.split('\n')) {
50
+ for (const line of source.split('\n')) {
30
51
  const l = line.trim();
31
52
  if (!l)
32
53
  continue;
@@ -34,17 +55,17 @@ function parseCommandOutput(stdout) {
34
55
  const parsed = JSON.parse(l);
35
56
  Array.isArray(parsed) ? fromLines.push(...parsed) : fromLines.push(parsed);
36
57
  }
37
- catch ( /* skip unparseable lines */_b) { /* skip unparseable lines */ }
58
+ catch ( /* skip unparseable lines */_c) { /* skip unparseable lines */ }
38
59
  }
39
60
  if (fromLines.length > 0) {
40
61
  return fromLines;
41
62
  }
42
- // 3. JSON array with missing commas between objects
63
+ // 4. JSON array with missing commas between objects
43
64
  try {
44
- const fixed = trimmed.replace(/\}\s*\n\s*\{/g, '},{');
65
+ const fixed = source.replace(/\}\s*\n\s*\{/g, '},{');
45
66
  return JSON.parse(fixed);
46
67
  }
47
- catch ( /* fall through */_c) { /* fall through */ }
68
+ catch ( /* fall through */_d) { /* fall through */ }
48
69
  throw new SyntaxError(`parseCommandOutput: failed to parse ip command output: ${trimmed.slice(0, 300)}`);
49
70
  }
50
71
  exports.parseCommandOutput = parseCommandOutput;
@@ -1 +1 @@
1
- {"version":3,"file":"parse-output.js","sourceRoot":"","sources":["../../src/common/parse-output.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,SAAgB,kBAAkB,CAAI,MAAc;IAClD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CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC5E;QAAC,QAAQ,4BAA4B,IAA9B,EAAE,4BAA4B,EAAE;KACzC;IACD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;QACxB,OAAO,SAAyB,CAAC;KAClC;IAED,oDAAoD;IACpD,IAAI;QACF,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KAC1B;IAAC,QAAQ,kBAAkB,IAApB,EAAE,kBAAkB,EAAE;IAE9B,MAAM,IAAI,WAAW,CACnB,0DAA0D,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAClF,CAAC;AACJ,CAAC;AArDD,gDAqDC"}
package/lib/index.d.ts CHANGED
@@ -19,7 +19,7 @@ export { SchemaIds } from './common/constants/schemas';
19
19
  export { mac, hex4Digits, ipv4, ipv6, ip, ipWithOptionalMask, ipWithRequiredMask, ipOrAny, ipWithOptionalMaskAndAllAndDefaultValues, ipWithRequiredMaskAndAllAndDefaultValues, ipWithOptionalFamilyPrefix, slashSeparatedStrings, slashSeparatedNumbers, commaSeparatedIpv6Addresses, timeWithUnit, colonSeparatedNumbers } from './common/constants/regexes';
20
20
  export { GlobalOptions, Empty, FilePathRequiredGlobalOption, StdinRequiredGlobalOption, GlobalOptionsWithRequiredFilePath, GlobalOptionsWithRequiredStdin } from './common/interfaces/common';
21
21
  export { MonitorEmittedData } from './common/interfaces/monitor';
22
- export { CommandError } from './common/errors/command';
22
+ export { CommandError, CommandErrorCodes } from './common/errors/command';
23
23
  export { ParametersError } from './common/errors/parameters';
24
24
  /**
25
25
  * Read commands from provided file or standard input and invoke them.
package/lib/index.js CHANGED
@@ -26,8 +26,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.RoutePreferences = exports.route = exports.AddressFamilies = exports.AddressScopes = exports.address = exports.XdpOptionTypes = exports.BridgeSlavePortStates = exports.AddrGenMode = exports.SecureAssociationEncodings = exports.MacsecValidationModeOptions = exports.MldVersions = exports.IgmpVersions = exports.MultiCastRouterOptions = exports.HsrProtocols = exports.HsrVersions = exports.MacvlanMacvtapModes = exports.TtlSpecialValues = exports.ErspanDirections = exports.IpoIbModes = exports.IpipSipDeviceModes = exports.SecondaryUdpEncapsulations = exports.DontFragmentFlagValues = exports.VlanProtocols = exports.ExtendedLinkTypes = exports.LinkTypes = exports.link = exports.batch = exports.ParametersError = exports.CommandError = exports.colonSeparatedNumbers = exports.timeWithUnit = exports.commaSeparatedIpv6Addresses = exports.slashSeparatedNumbers = exports.slashSeparatedStrings = exports.ipWithOptionalFamilyPrefix = exports.ipWithRequiredMaskAndAllAndDefaultValues = exports.ipWithOptionalMaskAndAllAndDefaultValues = exports.ipOrAny = exports.ipWithRequiredMask = exports.ipWithOptionalMask = exports.ip = exports.ipv6 = exports.ipv4 = exports.hex4Digits = exports.mac = exports.SchemaIds = exports.EnableDisableAutoToggle = exports.EnableDisableAsStringToggle = exports.EnableDisableToggle = exports.OnOffToggle = void 0;
30
- exports.MonitorCommand = exports.Command = exports.utils = exports.mroute = exports.maddress = exports.TunTapTunnelModes = exports.tuntap = exports.TunnelModes = exports.tunnel = exports.ntable = exports.NudStates = exports.neighbour = exports.addrlabel = exports.MonitorObjects = exports.monitor = exports.RuleTypes = exports.RoutingTables = exports.rule = exports.RouteTypes = exports.RoutingTableProtocols = exports.RouteRoutingTables = exports.EncapTypes = exports.EncapSeg6LocalActions = void 0;
29
+ exports.route = exports.AddressFamilies = exports.AddressScopes = exports.address = exports.XdpOptionTypes = exports.BridgeSlavePortStates = exports.AddrGenMode = exports.SecureAssociationEncodings = exports.MacsecValidationModeOptions = exports.MldVersions = exports.IgmpVersions = exports.MultiCastRouterOptions = exports.HsrProtocols = exports.HsrVersions = exports.MacvlanMacvtapModes = exports.TtlSpecialValues = exports.ErspanDirections = exports.IpoIbModes = exports.IpipSipDeviceModes = exports.SecondaryUdpEncapsulations = exports.DontFragmentFlagValues = exports.VlanProtocols = exports.ExtendedLinkTypes = exports.LinkTypes = exports.link = exports.batch = exports.ParametersError = exports.CommandErrorCodes = exports.CommandError = exports.colonSeparatedNumbers = exports.timeWithUnit = exports.commaSeparatedIpv6Addresses = exports.slashSeparatedNumbers = exports.slashSeparatedStrings = exports.ipWithOptionalFamilyPrefix = exports.ipWithRequiredMaskAndAllAndDefaultValues = exports.ipWithOptionalMaskAndAllAndDefaultValues = exports.ipOrAny = exports.ipWithRequiredMask = exports.ipWithOptionalMask = exports.ip = exports.ipv6 = exports.ipv4 = exports.hex4Digits = exports.mac = exports.SchemaIds = exports.EnableDisableAutoToggle = exports.EnableDisableAsStringToggle = exports.EnableDisableToggle = exports.OnOffToggle = void 0;
30
+ exports.MonitorCommand = exports.Command = exports.utils = exports.mroute = exports.maddress = exports.TunTapTunnelModes = exports.tuntap = exports.TunnelModes = exports.tunnel = exports.ntable = exports.NudStates = exports.neighbour = exports.addrlabel = exports.MonitorObjects = exports.monitor = exports.RuleTypes = exports.RoutingTables = exports.rule = exports.RouteTypes = exports.RoutingTableProtocols = exports.RouteRoutingTables = exports.EncapTypes = exports.EncapSeg6LocalActions = exports.RoutePreferences = void 0;
31
31
  // Special commands not pertaining to a specific command object.
32
32
  const batchModule = __importStar(require("./commands/batch"));
33
33
  exports.batch = batchModule;
@@ -121,6 +121,7 @@ Object.defineProperty(exports, "colonSeparatedNumbers", { enumerable: true, get:
121
121
  //
122
122
  var command_2 = require("./common/errors/command");
123
123
  Object.defineProperty(exports, "CommandError", { enumerable: true, get: function () { return command_2.CommandError; } });
124
+ Object.defineProperty(exports, "CommandErrorCodes", { enumerable: true, get: function () { return command_2.CommandErrorCodes; } });
124
125
  var parameters_1 = require("./common/errors/parameters");
125
126
  Object.defineProperty(exports, "ParametersError", { enumerable: true, get: function () { return parameters_1.ParametersError; } });
126
127
  var link_constants_1 = require("./commands/link.constants");
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAgE;AAChE,8DAAgD;AAyHxB,4BAAK;AAxH7B,6DAA6C;AAE7C,iCAAiC;AACjC,4DAA8C;AAkIvB,0BAAI;AAjI3B,2DAA2C;AAE3C,+BAA+B;AAC/B,kEAAoD;AA+M1B,gCAAO;AA9MjC,iEAAiD;AAEjD,4BAA4B;AAC5B,8DAAgD;AAoOxB,4BAAK;AAnO7B,6DAA6C;AAE7C,6CAA6C;AAC7C,4DAA8C;AAsQvB,0BAAI;AArQ3B,2DAA2C;AAE3C,oBAAoB;AACpB,kEAAoD;AAkR1B,gCAAO;AAjRjC,iEAAiD;AAEjD,qCAAqC;AACrC,sEAAwD;AAiS5B,oCAAS;AAhSrC,qEAAqD;AAErD,mCAAmC;AACnC,sEAAwD;AAoT5B,oCAAS;AAnTrC,qEAAqD;AAErD,iCAAiC;AACjC,gEAAkD;AAqUzB,8BAAM;AApU/B,+DAA+C;AAE/C,wBAAwB;AACxB,gEAAkD;AAoVzB,8BAAM;AAnV/B,+DAA+C;AAE/C,wBAAwB;AACxB,gEAAkD;AAiWzB,8BAAM;AAhW/B,+DAA+C;AAE/C,0BAA0B;AAC1B,oEAAsD;AA4W3B,kCAAQ;AA3WnC,mEAAmD;AAEnD,sCAAsC;AACtC,gEAAkD;AA6XzB,8BAAM;AA5X/B,+DAA+C;AAE/C,2FAA2F;AAC3F,qDAAuC;AAqYf,4BAAK;AApY7B,oDAAoC;AAEpC,UAAU;AACV,uEAA+C;AAqY3B,kBArYb,iBAAO,CAqYa;AApY3B,uFAA8D;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qBAAqB,OAAA;AAAE,4GAAA,UAAU,OAAA;AA8B9D,4DAAqE;AAA5D,+GAAA,aAAa,OAAA;AAAE,2GAAA,SAAS,OAAA;AAgBjC,kEAA8D;AAArD,mHAAA,cAAc,OAAA;AA0CvB,sEAA2D;AAAlD,gHAAA,SAAS,OAAA;AAwClB,gEAAsE;AAAjD,+GAAA,WAAW,OAAA;AAiBhC,gEAAgE;AAAvD,qHAAA,iBAAiB,OAAA;AAsD1B,eAAe;AACf,kBAAe;IACb,iDAAiD;IACjD,KAAK,EAAE,eAAa;IACpB,eAAe;IACf,IAAI,EAAO,cAAY;IACvB,OAAO,EAAI,iBAAe;IAC1B,IAAI,EAAO,cAAY;IACvB,KAAK,EAAM,eAAa;IACxB,OAAO,EAAI,iBAAe;IAC1B,SAAS,EAAE,mBAAiB;IAC5B,SAAS,EAAE,mBAAiB;IAC5B,MAAM,EAAK,gBAAc;IACzB,MAAM,EAAK,gBAAc;IACzB,MAAM,EAAK,gBAAc;IACzB,QAAQ,EAAG,kBAAgB;IAC3B,MAAM,EAAK,gBAAc;IACzB,UAAU;IACV,KAAK,EAAE,eAAa;CACrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iproutejs",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "Show and manipulate network devices, addresses, routing, policy routing, tunnels, IP forwarding, address labels and other `iproute` objects.",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -45,7 +45,7 @@
45
45
  "tuntap",
46
46
  "maddress",
47
47
  "mroute",
48
- "batch"
48
+ "batch"
49
49
  ],
50
50
  "dependencies": {
51
51
  "ajv": "^8.12.0",