@edgeiq/edgeiq-api-js 1.2.15 → 1.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/dist/deviceTransferRequests/index.d.ts +3 -0
- package/dist/deviceTransferRequests/index.js +49 -0
- package/dist/devices/index.js +1 -1
- package/dist/ingestors/models.d.ts +66 -6
- package/dist/rules/models.d.ts +46 -1
- package/dist/softwareUpdates/index.d.ts +2 -1
- package/dist/softwareUpdates/index.js +24 -0
- package/dist/softwareUpdates/models.d.ts +8 -0
- package/dist/testConstants.js +87 -5
- package/package.json +1 -1
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { BaseModelInterface } from '../core/ModelClass';
|
|
2
|
+
import { BulkActionResponse } from '../models';
|
|
2
3
|
import { DeviceTransferRequest, DeviceTransferRequestInput, DeviceTransferRequestsFilters, PaginatedDeviceTransferRequests } from './models';
|
|
3
4
|
interface DeviceTransferRequestsInterface extends BaseModelInterface<DeviceTransferRequest, DeviceTransferRequestInput, DeviceTransferRequestsFilters, PaginatedDeviceTransferRequests> {
|
|
4
5
|
update(deviceTransferRequest: DeviceTransferRequest): Promise<DeviceTransferRequest>;
|
|
6
|
+
accept(id: string, deviceTypeId: string): Promise<string>;
|
|
7
|
+
bulkAccept(ids: string[], deviceTypeId: string): Promise<BulkActionResponse>;
|
|
5
8
|
}
|
|
6
9
|
export declare const DeviceTransferRequests: DeviceTransferRequestsInterface;
|
|
7
10
|
export {};
|
|
@@ -194,5 +194,54 @@ exports.DeviceTransferRequests = (function (_super) {
|
|
|
194
194
|
});
|
|
195
195
|
});
|
|
196
196
|
};
|
|
197
|
+
class_1.accept = function (id, deviceTypeId) {
|
|
198
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
199
|
+
var axios, data, error_6;
|
|
200
|
+
return __generator(this, function (_a) {
|
|
201
|
+
switch (_a.label) {
|
|
202
|
+
case 0:
|
|
203
|
+
_a.trys.push([0, 2, , 3]);
|
|
204
|
+
this.logAction("Accepting device transfer request with id " + id);
|
|
205
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
206
|
+
data = JSON.stringify({ device_type_id: deviceTypeId });
|
|
207
|
+
return [4, axios.post(constants_1.Endpoints.deviceTransferRequest + "/" + id + "/transfer", data)];
|
|
208
|
+
case 1:
|
|
209
|
+
_a.sent();
|
|
210
|
+
return [2, 'Device transfer request accepted'];
|
|
211
|
+
case 2:
|
|
212
|
+
error_6 = _a.sent();
|
|
213
|
+
if ((0, helpers_1.isApiError)(error_6)) {
|
|
214
|
+
throw error_6;
|
|
215
|
+
}
|
|
216
|
+
throw error_6;
|
|
217
|
+
case 3: return [2];
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
class_1.bulkAccept = function (ids, deviceTypeId) {
|
|
223
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
224
|
+
var axios, result, error_7;
|
|
225
|
+
return __generator(this, function (_a) {
|
|
226
|
+
switch (_a.label) {
|
|
227
|
+
case 0:
|
|
228
|
+
_a.trys.push([0, 2, , 3]);
|
|
229
|
+
this.logAction("Accepting " + ids.length + " device transfer requests with device type with ID: " + deviceTypeId);
|
|
230
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
231
|
+
return [4, axios.post(constants_1.Endpoints.deviceTransferRequest + "/bulk/transfer", { ids: ids, device_type_id: deviceTypeId })];
|
|
232
|
+
case 1:
|
|
233
|
+
result = _a.sent();
|
|
234
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
235
|
+
case 2:
|
|
236
|
+
error_7 = _a.sent();
|
|
237
|
+
if ((0, helpers_1.isApiError)(error_7)) {
|
|
238
|
+
throw error_7;
|
|
239
|
+
}
|
|
240
|
+
throw error_7;
|
|
241
|
+
case 3: return [2];
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
};
|
|
197
246
|
return class_1;
|
|
198
247
|
}(ModelClass_1.BaseModelClass));
|
package/dist/devices/index.js
CHANGED
|
@@ -389,7 +389,7 @@ exports.Devices = (function (_super) {
|
|
|
389
389
|
this.logAction("Attaching " + rulesIds.length + " rules with to device with id " + id);
|
|
390
390
|
axios = __1.EdgeIQAPI.getAxios();
|
|
391
391
|
return [4, axios.post(constants_1.Endpoints.device + "/" + id + "/rules/bulk", {
|
|
392
|
-
|
|
392
|
+
ids: rulesIds,
|
|
393
393
|
})];
|
|
394
394
|
case 1:
|
|
395
395
|
result = _a.sent();
|
|
@@ -2,6 +2,70 @@ import { Base, Filter, Filters, Pagination } from '../models';
|
|
|
2
2
|
export declare type ListenerType = 'shell_polling' | 'icmp_polling' | 'snmp_polling' | 'tcp_server' | 'tcp_client' | 'udp_server' | 'udp_client' | 'http_server' | 'http_client' | 'dev' | 'tcp_modbus' | 'opcua' | 'bacnet' | 'dbus_signal' | 'cloud' | 'cloud_polling_inmarsat' | 'cloud_polling_orbcomm' | 'cloud_gcp_pubsub_jci' | 'cloud_polling_assetlink';
|
|
3
3
|
export declare type IngestorType = 'edge' | 'cloud';
|
|
4
4
|
export declare type HandlerType = 'fixed' | 'delimited' | 'router' | 'dbus' | 'passthrough';
|
|
5
|
+
export interface ListenerParam {
|
|
6
|
+
address?: string;
|
|
7
|
+
request_type?: string;
|
|
8
|
+
quantity?: number;
|
|
9
|
+
value?: number | string;
|
|
10
|
+
and_mask?: number;
|
|
11
|
+
or_mask?: number;
|
|
12
|
+
node_id?: string;
|
|
13
|
+
object_instance?: number;
|
|
14
|
+
object_type?: string;
|
|
15
|
+
property_id?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ListenerFilter {
|
|
18
|
+
interface?: string;
|
|
19
|
+
member?: string;
|
|
20
|
+
path?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface DeviceTypeMapping {
|
|
23
|
+
device_type_id?: string;
|
|
24
|
+
key?: string;
|
|
25
|
+
value?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface IngestorRoute {
|
|
28
|
+
method?: string;
|
|
29
|
+
path?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface IngestorListener {
|
|
32
|
+
access_id?: string;
|
|
33
|
+
password?: string;
|
|
34
|
+
address?: string;
|
|
35
|
+
port?: number;
|
|
36
|
+
timeout?: number;
|
|
37
|
+
poll_interval?: number;
|
|
38
|
+
host?: string;
|
|
39
|
+
slave_id?: number;
|
|
40
|
+
retries?: number;
|
|
41
|
+
community?: string;
|
|
42
|
+
version?: string;
|
|
43
|
+
oids?: string[];
|
|
44
|
+
url?: string;
|
|
45
|
+
method?: string;
|
|
46
|
+
dev?: string;
|
|
47
|
+
baud?: string;
|
|
48
|
+
command?: string;
|
|
49
|
+
min_timeout_seconds?: number;
|
|
50
|
+
subscription_id?: string;
|
|
51
|
+
integration_id?: string;
|
|
52
|
+
create_discovered_device?: boolean;
|
|
53
|
+
auto_promote_discovered_device?: boolean;
|
|
54
|
+
heartbeat_period?: string;
|
|
55
|
+
params: ListenerParam;
|
|
56
|
+
filters: ListenerFilter[];
|
|
57
|
+
device_type_mapping: DeviceTypeMapping[];
|
|
58
|
+
}
|
|
59
|
+
export interface IngestorHandler {
|
|
60
|
+
strip_delimited?: boolean;
|
|
61
|
+
delimited?: string;
|
|
62
|
+
dbus_map_key?: string;
|
|
63
|
+
index?: number;
|
|
64
|
+
length?: number;
|
|
65
|
+
map_keys?: string[];
|
|
66
|
+
type?: string;
|
|
67
|
+
routes: IngestorRoute[];
|
|
68
|
+
}
|
|
5
69
|
export interface IngestorInput {
|
|
6
70
|
name: string;
|
|
7
71
|
company_id: string;
|
|
@@ -11,13 +75,9 @@ export interface IngestorInput {
|
|
|
11
75
|
};
|
|
12
76
|
target_template?: string;
|
|
13
77
|
listener_type: ListenerType;
|
|
14
|
-
listener
|
|
15
|
-
[key: string]: unknown;
|
|
16
|
-
};
|
|
78
|
+
listener: IngestorListener;
|
|
17
79
|
handler_type: HandlerType;
|
|
18
|
-
handler
|
|
19
|
-
[key: string]: unknown;
|
|
20
|
-
};
|
|
80
|
+
handler: IngestorHandler;
|
|
21
81
|
translator?: {
|
|
22
82
|
[key: string]: unknown;
|
|
23
83
|
};
|
package/dist/rules/models.d.ts
CHANGED
|
@@ -6,6 +6,35 @@ export declare type RuleActionBodyType = 'html' | 'text';
|
|
|
6
6
|
export declare type LocationVia = 'gps' | 'cell_tower' | 'bluetooth' | 'wifi' | 'other';
|
|
7
7
|
export declare type GeneratedAtFormat = 'rfc3339' | 'unix_timestamp';
|
|
8
8
|
export declare type LocationTransitionDirectionType = 'arriving' | 'leaving';
|
|
9
|
+
export declare type DerivedValuesTypes = [
|
|
10
|
+
'count',
|
|
11
|
+
'min',
|
|
12
|
+
'max',
|
|
13
|
+
'avg',
|
|
14
|
+
'sum',
|
|
15
|
+
'convert_indexed_keys'
|
|
16
|
+
];
|
|
17
|
+
export declare type WhereConditionTypes = ['where', 'or_where'];
|
|
18
|
+
export declare type WhereConditionOperators = [
|
|
19
|
+
'equal',
|
|
20
|
+
'not_equal',
|
|
21
|
+
'greater_than',
|
|
22
|
+
'greater_than_equal',
|
|
23
|
+
'less_than',
|
|
24
|
+
'less_than_equal',
|
|
25
|
+
'in',
|
|
26
|
+
'not_in',
|
|
27
|
+
'starts_with',
|
|
28
|
+
'ends_with',
|
|
29
|
+
'contains',
|
|
30
|
+
'strict_contains',
|
|
31
|
+
'length_equals',
|
|
32
|
+
'length_not_equals',
|
|
33
|
+
'length_greater_than',
|
|
34
|
+
'length_greater_than_equal',
|
|
35
|
+
'length_less_than',
|
|
36
|
+
'length_less_than_equal'
|
|
37
|
+
];
|
|
9
38
|
export interface CredentialData {
|
|
10
39
|
type?: string;
|
|
11
40
|
value: string;
|
|
@@ -62,14 +91,30 @@ export interface RuleAction {
|
|
|
62
91
|
channels?: PRTGChannel[];
|
|
63
92
|
definition_id?: string;
|
|
64
93
|
}
|
|
94
|
+
export interface WhereCondition {
|
|
95
|
+
type?: WhereConditionTypes;
|
|
96
|
+
operator?: WhereConditionOperators;
|
|
97
|
+
property?: string;
|
|
98
|
+
value?: string | string[];
|
|
99
|
+
}
|
|
100
|
+
export interface DerivedValue {
|
|
101
|
+
name?: string;
|
|
102
|
+
type?: DerivedValuesTypes;
|
|
103
|
+
property?: string;
|
|
104
|
+
properties?: string[];
|
|
105
|
+
data_set?: string;
|
|
106
|
+
where_conditions?: WhereCondition[];
|
|
107
|
+
}
|
|
65
108
|
export interface RuleCondition {
|
|
66
109
|
type: RuleConditionType;
|
|
67
110
|
property?: string;
|
|
68
|
-
value?:
|
|
111
|
+
value?: string[];
|
|
69
112
|
value_type?: string;
|
|
70
113
|
rule_conditions?: (RuleCondition | undefined)[];
|
|
71
114
|
error_type?: DeviceErrorType;
|
|
72
115
|
location_transition_evaluator?: LocationTransitionEvaluator;
|
|
116
|
+
cold_start_trigger?: boolean;
|
|
117
|
+
derived_values?: DerivedValue[];
|
|
73
118
|
}
|
|
74
119
|
export interface LocationTransitionEvaluator {
|
|
75
120
|
region_id: string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BaseModelInterface } from '../core/ModelClass';
|
|
2
2
|
import { BulkActionResponse } from '../models';
|
|
3
|
-
import { SoftwareUpdate, SoftwareUpdateInput, SoftwareUpdatesFilters, PaginatedSoftwareUpdates } from './models';
|
|
3
|
+
import { SoftwareUpdate, SoftwareUpdateInput, SoftwareUpdatesFilters, PaginatedSoftwareUpdates, IssueSoftwareUpdateInput } from './models';
|
|
4
4
|
interface SoftwareUpdatesInterface extends BaseModelInterface<SoftwareUpdate, SoftwareUpdateInput, SoftwareUpdatesFilters, PaginatedSoftwareUpdates> {
|
|
5
5
|
update(softwareUpdate: SoftwareUpdate): Promise<SoftwareUpdate>;
|
|
6
6
|
deleteMultiple(ids: string[]): Promise<BulkActionResponse>;
|
|
7
|
+
bulkSoftwareUpdate(payload: IssueSoftwareUpdateInput): Promise<BulkActionResponse>;
|
|
7
8
|
}
|
|
8
9
|
export declare const SoftwareUpdates: SoftwareUpdatesInterface;
|
|
9
10
|
export {};
|
|
@@ -220,5 +220,29 @@ exports.SoftwareUpdates = (function (_super) {
|
|
|
220
220
|
});
|
|
221
221
|
});
|
|
222
222
|
};
|
|
223
|
+
class_1.bulkSoftwareUpdate = function (payload) {
|
|
224
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
225
|
+
var axios, result, error_7;
|
|
226
|
+
return __generator(this, function (_a) {
|
|
227
|
+
switch (_a.label) {
|
|
228
|
+
case 0:
|
|
229
|
+
_a.trys.push([0, 2, , 3]);
|
|
230
|
+
this.logAction("Issuing software updates with payload " + payload);
|
|
231
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
232
|
+
return [4, axios.post(constants_1.Endpoints.device + "/bulk/software_update", payload)];
|
|
233
|
+
case 1:
|
|
234
|
+
result = _a.sent();
|
|
235
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
236
|
+
case 2:
|
|
237
|
+
error_7 = _a.sent();
|
|
238
|
+
if ((0, helpers_1.isApiError)(error_7)) {
|
|
239
|
+
throw error_7;
|
|
240
|
+
}
|
|
241
|
+
throw error_7;
|
|
242
|
+
case 3: return [2];
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
};
|
|
223
247
|
return class_1;
|
|
224
248
|
}(ModelClass_1.BaseModelClass));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CommandSchedule } from '../gatewayCommands/models';
|
|
1
2
|
import { Base, Filter, Filters, Pagination } from '../models';
|
|
2
3
|
export interface FileLocation {
|
|
3
4
|
name: string;
|
|
@@ -20,3 +21,10 @@ export interface PaginatedSoftwareUpdates {
|
|
|
20
21
|
softwareUpdates: SoftwareUpdate[];
|
|
21
22
|
pagination: Pagination;
|
|
22
23
|
}
|
|
24
|
+
export declare type IssueSoftwareUpdateCommandType = 'software_update';
|
|
25
|
+
export interface IssueSoftwareUpdateInput {
|
|
26
|
+
ids: Array<string>;
|
|
27
|
+
software_update_id: string;
|
|
28
|
+
command_type: IssueSoftwareUpdateCommandType;
|
|
29
|
+
schedule?: CommandSchedule;
|
|
30
|
+
}
|
package/dist/testConstants.js
CHANGED
|
@@ -143,22 +143,104 @@ exports.TestIntegration2 = {
|
|
|
143
143
|
from: 'test_from',
|
|
144
144
|
};
|
|
145
145
|
exports.NewIntegrationName = 'EIQSDK Integration Test Twilio';
|
|
146
|
-
exports.EmptyIngestor = __assign(__assign({}, baseModel), { name: '', type: '
|
|
146
|
+
exports.EmptyIngestor = __assign(__assign({}, baseModel), { company_id: '', name: '', type: 'edge', listener_type: 'shell_polling', handler_type: 'fixed', translator_id: '', listener: {
|
|
147
|
+
version: '1',
|
|
148
|
+
params: {
|
|
149
|
+
address: '',
|
|
150
|
+
},
|
|
151
|
+
filters: [
|
|
152
|
+
{
|
|
153
|
+
interface: '',
|
|
154
|
+
member: '',
|
|
155
|
+
path: '',
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
device_type_mapping: [
|
|
159
|
+
{
|
|
160
|
+
device_type_id: '',
|
|
161
|
+
key: '',
|
|
162
|
+
value: '',
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
}, handler: {
|
|
166
|
+
routes: [
|
|
167
|
+
{
|
|
168
|
+
method: 'get',
|
|
169
|
+
path: '',
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
} });
|
|
147
173
|
exports.TestIngestor = {
|
|
148
174
|
company_id: parentCompanyId,
|
|
149
175
|
name: 'EIQSDK Ingestor Test',
|
|
150
|
-
|
|
176
|
+
type: 'cloud',
|
|
151
177
|
listener_type: 'cloud',
|
|
178
|
+
handler_type: 'passthrough',
|
|
152
179
|
translator_id: '6091323844952b0001bf9b33',
|
|
153
|
-
|
|
180
|
+
listener: {
|
|
181
|
+
version: '1',
|
|
182
|
+
params: {
|
|
183
|
+
address: '',
|
|
184
|
+
},
|
|
185
|
+
filters: [
|
|
186
|
+
{
|
|
187
|
+
interface: '',
|
|
188
|
+
member: '',
|
|
189
|
+
path: '',
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
device_type_mapping: [
|
|
193
|
+
{
|
|
194
|
+
device_type_id: '',
|
|
195
|
+
key: '',
|
|
196
|
+
value: '',
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
},
|
|
200
|
+
handler: {
|
|
201
|
+
routes: [
|
|
202
|
+
{
|
|
203
|
+
method: 'get',
|
|
204
|
+
path: '',
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
},
|
|
154
208
|
};
|
|
155
209
|
exports.TestIngestor2 = {
|
|
156
210
|
company_id: parentCompanyId,
|
|
157
211
|
name: 'EIQSDK Ingestor Test 2',
|
|
158
|
-
|
|
212
|
+
type: 'edge',
|
|
159
213
|
listener_type: 'shell_polling',
|
|
214
|
+
handler_type: 'fixed',
|
|
160
215
|
translator_id: '618bcb593b04d60001358801',
|
|
161
|
-
|
|
216
|
+
listener: {
|
|
217
|
+
version: '1',
|
|
218
|
+
params: {
|
|
219
|
+
address: '',
|
|
220
|
+
},
|
|
221
|
+
filters: [
|
|
222
|
+
{
|
|
223
|
+
interface: '',
|
|
224
|
+
member: '',
|
|
225
|
+
path: '',
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
device_type_mapping: [
|
|
229
|
+
{
|
|
230
|
+
device_type_id: '',
|
|
231
|
+
key: '',
|
|
232
|
+
value: '',
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
},
|
|
236
|
+
handler: {
|
|
237
|
+
routes: [
|
|
238
|
+
{
|
|
239
|
+
method: 'get',
|
|
240
|
+
path: '',
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
},
|
|
162
244
|
};
|
|
163
245
|
exports.NewTestIngestorName = 'EIQSDK Ingestor Test updated';
|
|
164
246
|
exports.EmptyPollableAttribute = __assign(__assign({}, baseModel), { name: '', type: 'snmp_mib', attributes: [], defaults: {}, interval: 16 });
|