greybel-mock-environment 1.2.0 → 1.2.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.
@@ -1,6 +1,7 @@
1
1
  import { FSDeviceType } from '../fs';
2
2
  import { Computer } from './computer';
3
3
  import { Device, DeviceOptions } from './device';
4
+ import { Port } from './port';
4
5
  export interface RouterOptions extends DeviceOptions {
5
6
  bssid: string;
6
7
  essid: string;
@@ -20,4 +21,5 @@ export declare class Router extends Device {
20
21
  getRouter(): Device;
21
22
  findByLanIp(ip: string): Device;
22
23
  getComputers(): Computer[];
24
+ findDeviceByPort(port: Port): Device;
23
25
  }
@@ -89,6 +89,26 @@ var Router = /** @class */ (function (_super) {
89
89
  return item instanceof computer_1.Computer;
90
90
  });
91
91
  };
92
+ Router.prototype.findDeviceByPort = function (port) {
93
+ var e_2, _a;
94
+ try {
95
+ for (var _b = __values(this.devices.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
96
+ var device = _c.value;
97
+ var p = device.findPort(port.port);
98
+ if (p !== null) {
99
+ return device;
100
+ }
101
+ }
102
+ }
103
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
104
+ finally {
105
+ try {
106
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
107
+ }
108
+ finally { if (e_2) throw e_2.error; }
109
+ }
110
+ return null;
111
+ };
92
112
  return Router;
93
113
  }(device_1.Device));
94
114
  exports.Router = Router;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greybel-mock-environment",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Mock environment",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index",