@gibme/mikrotik 1.0.0 → 1.0.2

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/dist/index.d.ts CHANGED
@@ -1,7 +1,14 @@
1
1
  import SSH from '@gibme/ssh';
2
2
  import { BandwidthTest, Response } from './types';
3
3
  import Cache from '@gibme/cache/memory';
4
- export { BandwidthTest };
4
+ export type BandwidthTestUpdate = BandwidthTest.Update;
5
+ export type BandwidthTestOptions = BandwidthTest.Options;
6
+ export type Address = Response.Address;
7
+ export type Interface = Response.Interface;
8
+ export type Route = Response.Route;
9
+ export type RouteCount = Response.RouteCount;
10
+ export type Ping = Response.Ping;
11
+ export type Traceroute = Response.Traceroute;
5
12
  export default class Mikrotik extends SSH {
6
13
  protected static cache: Cache;
7
14
  /**
@@ -10,15 +17,15 @@ export default class Mikrotik extends SSH {
10
17
  * @param min_distance
11
18
  * @param vrf
12
19
  */
13
- get_ip_routes(min_distance?: number, vrf?: string): Promise<Response.Route[]>;
20
+ get_ip_routes(min_distance?: number, vrf?: string): Promise<Route[]>;
14
21
  /**
15
22
  * Retrieves the IP addresses active on the system
16
23
  */
17
- get_ip_addresses(): Promise<Response.Address[]>;
24
+ get_ip_addresses(): Promise<Address[]>;
18
25
  /**
19
26
  * Retrieves the interfaces active on the system
20
27
  */
21
- get_interfaces(): Promise<Response.Interface[]>;
28
+ get_interfaces(): Promise<Interface[]>;
22
29
  /**
23
30
  * For all device IP addresses, counts the routes that exit (either directly or tunneled)
24
31
  * the device using each IP address
@@ -26,7 +33,7 @@ export default class Mikrotik extends SSH {
26
33
  * @param min_distance
27
34
  * @param vrf
28
35
  */
29
- get_route_counts(min_distance?: number, vrf?: string): Promise<Record<string, Response.RouteCount>>;
36
+ get_route_counts(min_distance?: number, vrf?: string): Promise<Record<string, RouteCount>>;
30
37
  /**
31
38
  * Executes a bandwidth test
32
39
  *
@@ -39,21 +46,21 @@ export default class Mikrotik extends SSH {
39
46
  * @param password
40
47
  * @param options
41
48
  */
42
- bandwidth_test(target: string, username: string, password: string, options?: Partial<BandwidthTest.Options>): Promise<BandwidthTest.Update>;
49
+ bandwidth_test(target: string, username: string, password: string, options?: Partial<BandwidthTestOptions>): Promise<BandwidthTestUpdate>;
43
50
  /**
44
51
  * Pings the target IP address from the source IP address (if supplied)
45
52
  *
46
53
  * @param target
47
54
  * @param source
48
55
  */
49
- ping(target: string, source?: string): Promise<any>;
56
+ ping(target: string, source?: string): Promise<Ping>;
50
57
  /**
51
58
  * Performs a traceroute to the target IP address from the source IP address (if supplied)
52
59
  *
53
60
  * @param target
54
61
  * @param source
55
62
  */
56
- traceroute(target: string, source?: string): Promise<Response.Traceroute[]>;
63
+ traceroute(target: string, source?: string): Promise<Traceroute[]>;
57
64
  /**
58
65
  * Executes a command with expected terse response and parses it accordingly
59
66
  *
package/dist/index.js CHANGED
@@ -31,10 +31,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
31
31
  return (mod && mod.__esModule) ? mod : { "default": mod };
32
32
  };
33
33
  Object.defineProperty(exports, "__esModule", { value: true });
34
- exports.BandwidthTest = void 0;
35
34
  const ssh_1 = __importDefault(require("@gibme/ssh"));
36
35
  const types_1 = require("./types");
37
- Object.defineProperty(exports, "BandwidthTest", { enumerable: true, get: function () { return types_1.BandwidthTest; } });
38
36
  const ip_1 = __importDefault(require("ip"));
39
37
  const memory_1 = __importDefault(require("@gibme/cache/memory"));
40
38
  const dns_1 = require("dns");
@@ -228,8 +226,7 @@ class Mikrotik extends ssh_1.default {
228
226
  direction: 'both',
229
227
  protocol: 'udp',
230
228
  random_data: false,
231
- callback: () => {
232
- }
229
+ callback: () => { }
233
230
  }) {
234
231
  // eslint-disable-next-line @typescript-eslint/no-this-alias
235
232
  const $ = this;
@@ -241,8 +238,7 @@ class Mikrotik extends ssh_1.default {
241
238
  (_b = options.direction) !== null && _b !== void 0 ? _b : (options.direction = 'both');
242
239
  (_c = options.protocol) !== null && _c !== void 0 ? _c : (options.protocol = 'udp');
243
240
  (_d = options.random_data) !== null && _d !== void 0 ? _d : (options.random_data = false);
244
- (_e = options.callback) !== null && _e !== void 0 ? _e : (options.callback = () => {
245
- });
241
+ (_e = options.callback) !== null && _e !== void 0 ? _e : (options.callback = () => { });
246
242
  /**
247
243
  * This serves as a lazy "mutex" that prevents us from running
248
244
  * a bandwidth test for against a target host that is already
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gibme/mikrotik",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "A simple mikrotik helper/wrapper",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",