@edgeiq/edgeiq-api-js 1.10.0 → 1.11.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.
@@ -1,4 +1,5 @@
1
1
  import { Base, Filter, Filters, Pagination } from '../models';
2
+ export declare type ConnectionType = 'cellular' | 'ethernet_lan' | 'ethernet_wan' | 'ethernet_wan_lan' | 'wifi';
2
3
  export declare type ModemPreferredNetworkType = '2G' | '3G' | '5G' | 'LTE' | 'AUTO';
3
4
  export declare type ApnAuthType = 'none' | 'PAP' | 'CHAP' | 'PAP_CHAP';
4
5
  export declare type ApnType = 'default' | 'MMS' | 'SUPL' | 'HIPRI' | 'FOTA' | 'CBS' | 'XCAP';
@@ -58,9 +59,9 @@ export interface ConnectionConfig {
58
59
  wifi_hidden?: number;
59
60
  }
60
61
  export interface Connection {
61
- type: string;
62
62
  name: string;
63
- config: ConnectionConfig;
63
+ type: ConnectionType;
64
+ config?: ConnectionConfig;
64
65
  }
65
66
  export interface IPTableAction {
66
67
  action?: string;
@@ -75,18 +76,43 @@ export interface IPTableAction {
75
76
  destination?: string;
76
77
  jump?: string;
77
78
  }
79
+ export interface DataCollection {
80
+ enabled: boolean;
81
+ frequency_seconds: number;
82
+ interfaces: string[];
83
+ }
84
+ export interface LatencyTest extends DataCollection {
85
+ hosts: string[];
86
+ type: string;
87
+ options: {
88
+ count: number;
89
+ packet_size: number;
90
+ timeout_seconds: number;
91
+ };
92
+ }
93
+ export interface PerformanceTest extends DataCollection {
94
+ type: string;
95
+ options: {
96
+ servers: string[];
97
+ download: boolean;
98
+ upload: boolean;
99
+ timeout_seconds: number;
100
+ };
101
+ }
78
102
  export interface DeviceConfigInput {
103
+ company_id: string;
79
104
  name: string;
80
- device_type_id: string;
81
105
  connections?: Connection[];
82
106
  iptables?: (IPTableAction | undefined)[];
83
107
  last_notification_id?: string;
108
+ interface_data_collection?: DataCollection;
109
+ latency_test?: LatencyTest;
110
+ performance_test?: PerformanceTest;
84
111
  }
85
112
  export interface DeviceConfig extends DeviceConfigInput, Base {
86
113
  }
87
114
  export interface DeviceConfigsFilters extends Filters {
88
115
  name?: Filter;
89
- device_type_id?: Filter;
90
116
  }
91
117
  export interface PaginatedDeviceConfigs {
92
118
  deviceConfigs: DeviceConfig[];
@@ -2,11 +2,6 @@ import { AwsThingGroup } from '../models';
2
2
  import { Base, Filter, Filters, Pagination } from '../models';
3
3
  export declare type TypeDeviceType = 'gateway' | 'sensor' | 'cloud_native' | 'modem' | 'lwm2m';
4
4
  export declare type DeviceTypeRole = 'gateway' | 'endpoint';
5
- export interface NetworkConnection {
6
- type: string;
7
- interface?: string;
8
- name: string;
9
- }
10
5
  export interface Peripheral {
11
6
  type: string;
12
7
  device: string;
@@ -70,7 +65,6 @@ export interface SMSATCommands {
70
65
  export interface Capabilities {
71
66
  actions: Actions;
72
67
  iptables: boolean;
73
- network_connections: NetworkConnection[];
74
68
  firmware: Firmware;
75
69
  peripherals: Peripheral[];
76
70
  sms_at_commands?: SMSATCommands;
@@ -102,6 +96,7 @@ export interface DeviceTypeInput {
102
96
  important_metadata?: ImportantMetadata[];
103
97
  device_integration_id?: string;
104
98
  cloud_native_integration_id?: string;
99
+ device_network_config_id?: string;
105
100
  }
106
101
  export interface DeviceType extends DeviceTypeInput, Base {
107
102
  }
package/dist/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export { GatewayCommands } from './gatewayCommands';
21
21
  export { Ingestors } from './ingestors';
22
22
  export { Integrations } from './integrations';
23
23
  export { LWM2M } from './lwm2m';
24
+ export { NetworkInterfaceReports } from './networkInterfaceReports';
24
25
  export { Notifications } from './notifications';
25
26
  export { PollableAttributes } from './pollableAttributes';
26
27
  export { Regions } from './regions';
@@ -66,6 +67,7 @@ export * from './ingestors/models';
66
67
  export * from './integrations/models';
67
68
  export * from './lwm2m/models';
68
69
  export * from './log/models';
70
+ export * from './networkInterfaceReports/models';
69
71
  export * from './notifications/models';
70
72
  export * from './pollableAttributes/models';
71
73
  export * from './reports/models';
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ export { GatewayCommands } from './gatewayCommands';
21
21
  export { Ingestors } from './ingestors';
22
22
  export { Integrations } from './integrations';
23
23
  export { LWM2M } from './lwm2m';
24
+ export { NetworkInterfaceReports } from './networkInterfaceReports';
24
25
  export { Notifications } from './notifications';
25
26
  export { PollableAttributes } from './pollableAttributes';
26
27
  export { Regions } from './regions';
@@ -66,6 +67,7 @@ export * from './ingestors/models';
66
67
  export * from './integrations/models';
67
68
  export * from './lwm2m/models';
68
69
  export * from './log/models';
70
+ export * from './networkInterfaceReports/models';
69
71
  export * from './notifications/models';
70
72
  export * from './pollableAttributes/models';
71
73
  export * from './reports/models';
@@ -0,0 +1,9 @@
1
+ import { NetworkInterfaceAllReports, NetworkInterfaceInfo, NetworkInterfaceReport } from './models';
2
+ declare const NetworkInterfaceReports: {
3
+ getDeviceNetworkInterfaceReport: (id: string) => Promise<NetworkInterfaceReport>;
4
+ getDeviceNetworkInterfaceInfo: (device_id: string, interface_name: string) => Promise<NetworkInterfaceInfo>;
5
+ getDeviceNetworkInterfaceLatency: (device_id: string, interface_name: string) => Promise<NetworkInterfaceInfo>;
6
+ getDeviceNetworkInterfacePerformance: (device_id: string, interface_name: string) => Promise<NetworkInterfaceInfo>;
7
+ getDeviceNetworkInterfaceAllReports: (device_id: string, interface_name: string) => Promise<NetworkInterfaceAllReports>;
8
+ };
9
+ export { NetworkInterfaceReports };
@@ -0,0 +1,100 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { EdgeIQAPI } from '..';
11
+ import { isApiError } from '../helpers';
12
+ const NetworkInterfaceReports = {
13
+ getDeviceNetworkInterfaceReport: (id) => __awaiter(void 0, void 0, void 0, function* () {
14
+ var _a;
15
+ try {
16
+ const axios = EdgeIQAPI.getAxios();
17
+ const result = yield axios.get(`network_interface_reports/${id}`);
18
+ return (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.resources;
19
+ }
20
+ catch (error) {
21
+ if (isApiError(error)) {
22
+ throw error;
23
+ }
24
+ throw error;
25
+ }
26
+ }),
27
+ getDeviceNetworkInterfaceInfo: (device_id, interface_name) => __awaiter(void 0, void 0, void 0, function* () {
28
+ var _b;
29
+ try {
30
+ const axios = EdgeIQAPI.getAxios();
31
+ const result = yield axios.get(`network_interface_infos?device_id=${device_id}&interface_name=${interface_name}`);
32
+ return (_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.resources;
33
+ }
34
+ catch (error) {
35
+ if (isApiError(error)) {
36
+ throw error;
37
+ }
38
+ throw error;
39
+ }
40
+ }),
41
+ getDeviceNetworkInterfaceLatency: (device_id, interface_name) => __awaiter(void 0, void 0, void 0, function* () {
42
+ var _c;
43
+ try {
44
+ const axios = EdgeIQAPI.getAxios();
45
+ const result = yield axios.get(`network_interface_latency_reports?device_id=${device_id}&interface_name=${interface_name}`);
46
+ return (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.resources;
47
+ }
48
+ catch (error) {
49
+ if (isApiError(error)) {
50
+ throw error;
51
+ }
52
+ throw error;
53
+ }
54
+ }),
55
+ getDeviceNetworkInterfacePerformance: (device_id, interface_name) => __awaiter(void 0, void 0, void 0, function* () {
56
+ var _d;
57
+ try {
58
+ const axios = EdgeIQAPI.getAxios();
59
+ const result = yield axios.get(`network_interface_performance_reports?device_id=${device_id}&interface_name=${interface_name}`);
60
+ return (_d = result === null || result === void 0 ? void 0 : result.data) === null || _d === void 0 ? void 0 : _d.resources;
61
+ }
62
+ catch (error) {
63
+ if (isApiError(error)) {
64
+ throw error;
65
+ }
66
+ throw error;
67
+ }
68
+ }),
69
+ getDeviceNetworkInterfaceAllReports: (device_id, interface_name) => __awaiter(void 0, void 0, void 0, function* () {
70
+ var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
71
+ try {
72
+ const axios = EdgeIQAPI.getAxios();
73
+ const info = yield axios.get(`network_interface_infos?device_id=${device_id}&interface_name=${interface_name}`);
74
+ const latency = yield axios.get(`network_interface_latency_reports?device_id=${device_id}&interface_name=${interface_name}`);
75
+ const performance = yield axios.get(`network_interface_performance_reports?device_id=${device_id}&interface_name=${interface_name}`);
76
+ if (((_e = info === null || info === void 0 ? void 0 : info.data) === null || _e === void 0 ? void 0 : _e.resources) && ((_f = info === null || info === void 0 ? void 0 : info.data) === null || _f === void 0 ? void 0 : _f.resources[0])) {
77
+ const infoData = (_g = info === null || info === void 0 ? void 0 : info.data) === null || _g === void 0 ? void 0 : _g.resources[0];
78
+ const report = yield axios.get(`network_interface_reports/${infoData.network_interfaces_report_id}`);
79
+ return {
80
+ info: (_j = (_h = info === null || info === void 0 ? void 0 : info.data) === null || _h === void 0 ? void 0 : _h.resources) === null || _j === void 0 ? void 0 : _j[0],
81
+ latency: (_l = (_k = latency === null || latency === void 0 ? void 0 : latency.data) === null || _k === void 0 ? void 0 : _k.resources) === null || _l === void 0 ? void 0 : _l[0],
82
+ performance: (_o = (_m = performance === null || performance === void 0 ? void 0 : performance.data) === null || _m === void 0 ? void 0 : _m.resources) === null || _o === void 0 ? void 0 : _o[0],
83
+ report: report === null || report === void 0 ? void 0 : report.data,
84
+ };
85
+ }
86
+ return {
87
+ info: (_q = (_p = info === null || info === void 0 ? void 0 : info.data) === null || _p === void 0 ? void 0 : _p.resources) === null || _q === void 0 ? void 0 : _q[0],
88
+ latency: (_s = (_r = latency === null || latency === void 0 ? void 0 : latency.data) === null || _r === void 0 ? void 0 : _r.resources) === null || _s === void 0 ? void 0 : _s[0],
89
+ performance: (_u = (_t = performance === null || performance === void 0 ? void 0 : performance.data) === null || _t === void 0 ? void 0 : _t.resources) === null || _u === void 0 ? void 0 : _u[0],
90
+ };
91
+ }
92
+ catch (error) {
93
+ if (isApiError(error)) {
94
+ throw error;
95
+ }
96
+ throw error;
97
+ }
98
+ }),
99
+ };
100
+ export { NetworkInterfaceReports };
@@ -0,0 +1,94 @@
1
+ import { Base, Filter, Filters } from '../models';
2
+ export interface NetworkInterfaceReport extends Base {
3
+ device_id: string;
4
+ device_unique_id: string;
5
+ device_class: string;
6
+ device_type_id: string;
7
+ gateway_command_id: string;
8
+ traceparent: string;
9
+ arrived_at: string;
10
+ internet_reachable: boolean;
11
+ default_dns: string;
12
+ default_route_interface_name: string;
13
+ default_route_ip_address: string;
14
+ routing_table: {
15
+ [key: string]: unknown;
16
+ };
17
+ }
18
+ export interface NetworkInterfaceInfo extends Base {
19
+ network_interfaces_report_id: string;
20
+ device_id: string;
21
+ device_type_id: string;
22
+ gateway_command_id: string;
23
+ arrived_at: string;
24
+ traceparent: string;
25
+ default: boolean;
26
+ link_status: string;
27
+ interface_name: string;
28
+ interface_type: string;
29
+ interface_mac_address: string;
30
+ cellular_strength: string;
31
+ cellular_mode: string;
32
+ ipv4_enabled: boolean;
33
+ ipv4_address: string;
34
+ ipv4_netmask: string;
35
+ ipv4_gateway: string;
36
+ ipv4_dns: string;
37
+ ipv6_enabled: boolean;
38
+ ipv6_address: string;
39
+ ipv6_netmask: string;
40
+ ipv6_gateway: string;
41
+ ipv6_dns: string;
42
+ bytes_sent: number;
43
+ bytes_received: number;
44
+ packets_sent: number;
45
+ packets_received: number;
46
+ packets_sent_errors: number;
47
+ packets_received_errors: number;
48
+ }
49
+ export interface NetworkInterfaceLatencyReport extends Base {
50
+ device_id: string;
51
+ device_unique_id: string;
52
+ device_class: string;
53
+ device_type_id: string;
54
+ gateway_command_id: string;
55
+ interface_name: string;
56
+ arrived_at: string;
57
+ traceparent: string;
58
+ type: string;
59
+ host: string;
60
+ packets_sent: number;
61
+ packets_received: number;
62
+ packet_loss_percent: number;
63
+ min_latency_ms: number;
64
+ max_latency_ms: number;
65
+ avg_latency_ms: number;
66
+ }
67
+ export interface NetworkInterfacePerformanceReport extends Base {
68
+ device_id: string;
69
+ device_unique_id: string;
70
+ device_class: string;
71
+ device_type_id: string;
72
+ gateway_command_id: string;
73
+ interface_name: string;
74
+ arrived_at: string;
75
+ traceparent: string;
76
+ type: string;
77
+ server_id: string;
78
+ latency_ms: number;
79
+ jitter_ms: number;
80
+ packet_loss_percent: number;
81
+ download_speed_mbps: number;
82
+ upload_speed_mbps: number;
83
+ test_duration_seconds: number;
84
+ }
85
+ export interface NetworkInterfaceAllReports {
86
+ info: NetworkInterfaceInfo;
87
+ latency: NetworkInterfaceLatencyReport;
88
+ performance: NetworkInterfacePerformanceReport;
89
+ report?: NetworkInterfaceReport;
90
+ }
91
+ export interface NetworkInterfaceFilters extends Filters {
92
+ device_id?: Filter;
93
+ interface_name?: Filter;
94
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -160,7 +160,6 @@ const deviceTypeCapabilities = {
160
160
  upgrade: false,
161
161
  },
162
162
  iptables: false,
163
- network_connections: [],
164
163
  peripherals: [],
165
164
  };
166
165
  export const EmptyDeviceType = Object.assign(Object.assign({}, baseModel), { capabilities: deviceTypeCapabilities, manufacturer: '', model: '', name: '', type: 'cloud_native', role: 'endpoint' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgeiq/edgeiq-api-js",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "author": "EdgeIQ",
5
5
  "license": "ISC",
6
6
  "description": "This project presents EdgeIQ API SDK.",