@edgeiq/edgeiq-api-js 1.3.19 → 1.3.22
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/companies/index.js +24 -0
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +2 -1
- package/dist/deviceFiles/index.d.ts +9 -0
- package/dist/deviceFiles/index.js +278 -0
- package/dist/deviceFiles/models.d.ts +17 -0
- package/dist/deviceFiles/models.js +2 -0
- package/dist/devices/index.d.ts +6 -2
- package/dist/devices/index.js +78 -2
- package/dist/gatewayCommands/index.d.ts +1 -3
- package/dist/gatewayCommands/index.js +25 -87
- package/dist/gatewayCommands/models.d.ts +27 -21
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/lwm2m/index.d.ts +5 -0
- package/dist/lwm2m/index.js +71 -0
- package/dist/lwm2m/models.d.ts +10 -1
- package/package.json +1 -1
package/dist/companies/index.js
CHANGED
|
@@ -194,5 +194,29 @@ exports.Companies = (function (_super) {
|
|
|
194
194
|
});
|
|
195
195
|
});
|
|
196
196
|
};
|
|
197
|
+
class_1.getFiles = function (id) {
|
|
198
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
199
|
+
var axios, result, 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("Getting device files of company with id " + id);
|
|
205
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
206
|
+
return [4, axios.get(constants_1.Endpoints.company + "/" + id + "/files")];
|
|
207
|
+
case 1:
|
|
208
|
+
result = _a.sent();
|
|
209
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
210
|
+
case 2:
|
|
211
|
+
error_6 = _a.sent();
|
|
212
|
+
if ((0, helpers_1.isApiError)(error_6)) {
|
|
213
|
+
throw error_6;
|
|
214
|
+
}
|
|
215
|
+
throw error_6;
|
|
216
|
+
case 3: return [2];
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
};
|
|
197
221
|
return class_1;
|
|
198
222
|
}(ModelClass_1.BaseModelClass));
|
package/dist/constants.d.ts
CHANGED
|
@@ -96,6 +96,7 @@ export declare const Endpoints: {
|
|
|
96
96
|
passwordReset: string;
|
|
97
97
|
bulkResponse: string;
|
|
98
98
|
notification: string;
|
|
99
|
+
file: string;
|
|
99
100
|
command: string;
|
|
100
101
|
company: string;
|
|
101
102
|
deviceConfig: string;
|
|
@@ -104,7 +105,7 @@ export declare const Endpoints: {
|
|
|
104
105
|
deviceTemplate: string;
|
|
105
106
|
deviceType: string;
|
|
106
107
|
device: string;
|
|
107
|
-
|
|
108
|
+
deviceLwm2mObjetLinks: string;
|
|
108
109
|
deviceLocationObservation: string;
|
|
109
110
|
downstreamSystem: string;
|
|
110
111
|
discoveredDevice: string;
|
package/dist/constants.js
CHANGED
|
@@ -112,6 +112,7 @@ exports.Endpoints = {
|
|
|
112
112
|
passwordReset: exports.BaseEndpoints.auth + "/password_reset",
|
|
113
113
|
bulkResponse: "" + exports.BaseEndpoints.bulkResponse,
|
|
114
114
|
notification: "" + exports.BaseEndpoints.notification,
|
|
115
|
+
file: "" + exports.BaseEndpoints.file,
|
|
115
116
|
command: "" + exports.BaseEndpoints.command,
|
|
116
117
|
company: "" + exports.BaseEndpoints.company,
|
|
117
118
|
deviceConfig: "" + exports.BaseEndpoints.deviceConfig,
|
|
@@ -120,7 +121,7 @@ exports.Endpoints = {
|
|
|
120
121
|
deviceTemplate: "" + exports.BaseEndpoints.deviceTemplate,
|
|
121
122
|
deviceType: "" + exports.BaseEndpoints.deviceType,
|
|
122
123
|
device: "" + exports.BaseEndpoints.device,
|
|
123
|
-
|
|
124
|
+
deviceLwm2mObjetLinks: "" + exports.BaseEndpoints.lwm2mObjectLinks,
|
|
124
125
|
deviceLocationObservation: "" + exports.BaseEndpoints.deviceLocationObservation,
|
|
125
126
|
downstreamSystem: "" + exports.BaseEndpoints.downstreamSystem,
|
|
126
127
|
discoveredDevice: "" + exports.BaseEndpoints.discoveredDevice,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseModelInterface } from '../core/ModelClass';
|
|
2
|
+
import { BulkActionResponse } from '../models';
|
|
3
|
+
import { DeviceFilesFilters, DeviceFile, DeviceFileInput, PaginatedDeviceFiles } from './models';
|
|
4
|
+
interface DeviceFilesInterface extends BaseModelInterface<DeviceFile, DeviceFileInput, DeviceFilesFilters, PaginatedDeviceFiles> {
|
|
5
|
+
update(file: DeviceFile): Promise<DeviceFile>;
|
|
6
|
+
deleteMultiple(ids: string[]): Promise<BulkActionResponse>;
|
|
7
|
+
}
|
|
8
|
+
export declare const DeviceFiles: DeviceFilesInterface;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.DeviceFiles = void 0;
|
|
55
|
+
var __1 = require("..");
|
|
56
|
+
var constants_1 = require("../constants");
|
|
57
|
+
var ModelClass_1 = require("../core/ModelClass");
|
|
58
|
+
var filtersParser_1 = require("../filtersParser");
|
|
59
|
+
var helpers_1 = require("../helpers");
|
|
60
|
+
exports.DeviceFiles = (function (_super) {
|
|
61
|
+
__extends(class_1, _super);
|
|
62
|
+
function class_1() {
|
|
63
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
64
|
+
}
|
|
65
|
+
class_1.create = function (file) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
+
var axios, data, result, error_1;
|
|
68
|
+
return __generator(this, function (_a) {
|
|
69
|
+
switch (_a.label) {
|
|
70
|
+
case 0:
|
|
71
|
+
_a.trys.push([0, 2, , 3]);
|
|
72
|
+
this.logAction("Creating file with unique ID: " + file);
|
|
73
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
74
|
+
data = JSON.stringify(file);
|
|
75
|
+
return [4, axios.post(constants_1.Endpoints.file, data)];
|
|
76
|
+
case 1:
|
|
77
|
+
result = _a.sent();
|
|
78
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
79
|
+
case 2:
|
|
80
|
+
error_1 = _a.sent();
|
|
81
|
+
if ((0, helpers_1.isApiError)(error_1)) {
|
|
82
|
+
throw error_1;
|
|
83
|
+
}
|
|
84
|
+
throw error_1;
|
|
85
|
+
case 3: return [2];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
class_1.update = function (file) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
+
var axios, data, result, error_2;
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
switch (_a.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
_a.trys.push([0, 2, , 3]);
|
|
97
|
+
this.logAction("Updating file with ID: " + file._id);
|
|
98
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
99
|
+
data = JSON.stringify(file);
|
|
100
|
+
return [4, axios.put(constants_1.Endpoints.file + "/" + file._id, data)];
|
|
101
|
+
case 1:
|
|
102
|
+
result = _a.sent();
|
|
103
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
104
|
+
case 2:
|
|
105
|
+
error_2 = _a.sent();
|
|
106
|
+
if ((0, helpers_1.isApiError)(error_2)) {
|
|
107
|
+
throw error_2;
|
|
108
|
+
}
|
|
109
|
+
throw error_2;
|
|
110
|
+
case 3: return [2];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
class_1.list = function (filters, pagination) {
|
|
116
|
+
var _a, _b, _c, _d;
|
|
117
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
+
var axios, result, error_3;
|
|
119
|
+
return __generator(this, function (_e) {
|
|
120
|
+
switch (_e.label) {
|
|
121
|
+
case 0:
|
|
122
|
+
_e.trys.push([0, 2, , 3]);
|
|
123
|
+
this.logAction("Listing files with following filters: " + (filters !== null && filters !== void 0 ? filters : '{}') + ".\n And pagination " + (pagination !== null && pagination !== void 0 ? pagination : '{}'));
|
|
124
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
125
|
+
return [4, axios.get(constants_1.Endpoints.file, {
|
|
126
|
+
params: (0, filtersParser_1.parseFilters)(filters, pagination),
|
|
127
|
+
})];
|
|
128
|
+
case 1:
|
|
129
|
+
result = _e.sent();
|
|
130
|
+
return [2, {
|
|
131
|
+
files: (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.resources,
|
|
132
|
+
pagination: {
|
|
133
|
+
page: (_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.page,
|
|
134
|
+
itemsPerPage: (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.per_page,
|
|
135
|
+
total: (_d = result === null || result === void 0 ? void 0 : result.data) === null || _d === void 0 ? void 0 : _d.total,
|
|
136
|
+
},
|
|
137
|
+
}];
|
|
138
|
+
case 2:
|
|
139
|
+
error_3 = _e.sent();
|
|
140
|
+
if ((0, helpers_1.isApiError)(error_3)) {
|
|
141
|
+
throw error_3;
|
|
142
|
+
}
|
|
143
|
+
throw error_3;
|
|
144
|
+
case 3: return [2];
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
class_1.getOneById = function (id) {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
151
|
+
var axios, result, error_4;
|
|
152
|
+
return __generator(this, function (_a) {
|
|
153
|
+
switch (_a.label) {
|
|
154
|
+
case 0:
|
|
155
|
+
_a.trys.push([0, 2, , 3]);
|
|
156
|
+
this.logAction("Getting file with id: " + id);
|
|
157
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
158
|
+
return [4, axios.get(constants_1.Endpoints.file + "/" + id)];
|
|
159
|
+
case 1:
|
|
160
|
+
result = _a.sent();
|
|
161
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
162
|
+
case 2:
|
|
163
|
+
error_4 = _a.sent();
|
|
164
|
+
if ((0, helpers_1.isApiError)(error_4)) {
|
|
165
|
+
throw error_4;
|
|
166
|
+
}
|
|
167
|
+
throw error_4;
|
|
168
|
+
case 3: return [2];
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
class_1.delete = function (id) {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
175
|
+
var axios, error_5;
|
|
176
|
+
return __generator(this, function (_a) {
|
|
177
|
+
switch (_a.label) {
|
|
178
|
+
case 0:
|
|
179
|
+
_a.trys.push([0, 2, , 3]);
|
|
180
|
+
this.logAction("Deleting file with id " + id);
|
|
181
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
182
|
+
return [4, axios.delete(constants_1.Endpoints.file + "/" + id)];
|
|
183
|
+
case 1:
|
|
184
|
+
_a.sent();
|
|
185
|
+
return [2, (0, helpers_1.getReturnDeleteMessage)('file')];
|
|
186
|
+
case 2:
|
|
187
|
+
error_5 = _a.sent();
|
|
188
|
+
if ((0, helpers_1.isApiError)(error_5)) {
|
|
189
|
+
throw error_5;
|
|
190
|
+
}
|
|
191
|
+
throw error_5;
|
|
192
|
+
case 3: return [2];
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
class_1.uploadFile = function (id, file) {
|
|
198
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
199
|
+
var axios, form, result, 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("Uploading file to device");
|
|
205
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
206
|
+
form = new FormData();
|
|
207
|
+
form.append('file', file);
|
|
208
|
+
return [4, axios.post(constants_1.Endpoints.file + "/" + id, form, {
|
|
209
|
+
headers: {
|
|
210
|
+
'Content-Type': 'multipart/form-data',
|
|
211
|
+
},
|
|
212
|
+
})];
|
|
213
|
+
case 1:
|
|
214
|
+
result = _a.sent();
|
|
215
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
216
|
+
case 2:
|
|
217
|
+
error_6 = _a.sent();
|
|
218
|
+
if ((0, helpers_1.isApiError)(error_6)) {
|
|
219
|
+
throw error_6;
|
|
220
|
+
}
|
|
221
|
+
throw error_6;
|
|
222
|
+
case 3: return [2];
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
class_1.downloadFile = function (id) {
|
|
228
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
229
|
+
var axios, result, error_7;
|
|
230
|
+
return __generator(this, function (_a) {
|
|
231
|
+
switch (_a.label) {
|
|
232
|
+
case 0:
|
|
233
|
+
_a.trys.push([0, 2, , 3]);
|
|
234
|
+
this.logAction("Downloading file with id: " + id);
|
|
235
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
236
|
+
return [4, axios.get(constants_1.Endpoints.file + "/" + id + "/download")];
|
|
237
|
+
case 1:
|
|
238
|
+
result = _a.sent();
|
|
239
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
240
|
+
case 2:
|
|
241
|
+
error_7 = _a.sent();
|
|
242
|
+
if ((0, helpers_1.isApiError)(error_7)) {
|
|
243
|
+
throw error_7;
|
|
244
|
+
}
|
|
245
|
+
throw error_7;
|
|
246
|
+
case 3: return [2];
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
class_1.deleteMultiple = function (ids) {
|
|
252
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
253
|
+
var axios, result, error_8;
|
|
254
|
+
return __generator(this, function (_a) {
|
|
255
|
+
switch (_a.label) {
|
|
256
|
+
case 0:
|
|
257
|
+
_a.trys.push([0, 2, , 3]);
|
|
258
|
+
this.logAction("Deleting files with id " + ids.join(', '));
|
|
259
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
260
|
+
return [4, axios.delete(constants_1.Endpoints.file + "/bulk", {
|
|
261
|
+
data: { ids: ids },
|
|
262
|
+
})];
|
|
263
|
+
case 1:
|
|
264
|
+
result = _a.sent();
|
|
265
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
266
|
+
case 2:
|
|
267
|
+
error_8 = _a.sent();
|
|
268
|
+
if ((0, helpers_1.isApiError)(error_8)) {
|
|
269
|
+
throw error_8;
|
|
270
|
+
}
|
|
271
|
+
throw error_8;
|
|
272
|
+
case 3: return [2];
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
return class_1;
|
|
278
|
+
}(ModelClass_1.BaseModelClass));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Base, Filter, Filters, Pagination } from '../models';
|
|
2
|
+
export interface DeviceFileInput {
|
|
3
|
+
name: string;
|
|
4
|
+
device_id: string;
|
|
5
|
+
mime_type: string;
|
|
6
|
+
metadata?: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface DeviceFile extends DeviceFileInput, Base {
|
|
9
|
+
}
|
|
10
|
+
export interface DeviceFilesFilters extends Filters {
|
|
11
|
+
unique_id?: Filter;
|
|
12
|
+
website?: Filter;
|
|
13
|
+
}
|
|
14
|
+
export interface PaginatedDeviceFiles {
|
|
15
|
+
files: DeviceFile[];
|
|
16
|
+
pagination: Pagination;
|
|
17
|
+
}
|
package/dist/devices/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Ingestor, Rule, Command } from '..';
|
|
2
2
|
import { BaseModelInterface } from '../core/ModelClass';
|
|
3
3
|
import { Log } from '../log/models';
|
|
4
|
-
import { GatewayCommand } from '../gatewayCommands/models';
|
|
4
|
+
import { GatewayCommand, GatewayCommandRequest } from '../gatewayCommands/models';
|
|
5
5
|
import { BulkActionResponse } from '../models';
|
|
6
6
|
import { Lwm2mObjectLinks } from '../lwm2m/models';
|
|
7
|
+
import { DeviceFile } from '../deviceFiles/models';
|
|
7
8
|
import { DevicesFilters, Device, DeviceInput, PaginatedDevices } from './models';
|
|
8
9
|
interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, DevicesFilters, PaginatedDevices> {
|
|
9
10
|
bulkCreate(uniqueIds: string[], deviceTypeId: string, namePrefix: string): Promise<BulkActionResponse>;
|
|
@@ -22,7 +23,10 @@ interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, Devic
|
|
|
22
23
|
csvBulkDownload(filters?: DevicesFilters): Promise<File>;
|
|
23
24
|
getLogs(id: string): Promise<Log[]>;
|
|
24
25
|
requestLogs(id: string): Promise<GatewayCommand>;
|
|
25
|
-
|
|
26
|
+
deviceLwm2mObjetLinks(id: string): Promise<Lwm2mObjectLinks[]>;
|
|
27
|
+
processGatewayCommand(deviceId: string, gatewayCommandRequest: GatewayCommandRequest): Promise<GatewayCommand>;
|
|
28
|
+
bulkExecuteGatewayCommand(ids: string[], gatewayCommandRequest: GatewayCommandRequest): Promise<BulkActionResponse>;
|
|
29
|
+
getFiles(id: string): Promise<DeviceFile[]>;
|
|
26
30
|
}
|
|
27
31
|
export declare const Devices: DevicesInterface;
|
|
28
32
|
export {};
|
package/dist/devices/index.js
CHANGED
|
@@ -584,7 +584,7 @@ exports.Devices = (function (_super) {
|
|
|
584
584
|
});
|
|
585
585
|
});
|
|
586
586
|
};
|
|
587
|
-
class_1.
|
|
587
|
+
class_1.deviceLwm2mObjetLinks = function (id) {
|
|
588
588
|
return __awaiter(this, void 0, void 0, function () {
|
|
589
589
|
var axios, result, error_21;
|
|
590
590
|
return __generator(this, function (_a) {
|
|
@@ -593,7 +593,7 @@ exports.Devices = (function (_super) {
|
|
|
593
593
|
_a.trys.push([0, 2, , 3]);
|
|
594
594
|
this.logAction("Getting lwm2m object links attached to device with id " + id);
|
|
595
595
|
axios = __1.EdgeIQAPI.getAxios();
|
|
596
|
-
return [4, axios.get(constants_1.Endpoints.device + "/" + id + "/" + constants_1.Endpoints.
|
|
596
|
+
return [4, axios.get(constants_1.Endpoints.device + "/" + id + "/" + constants_1.Endpoints.deviceLwm2mObjetLinks)];
|
|
597
597
|
case 1:
|
|
598
598
|
result = _a.sent();
|
|
599
599
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
@@ -608,5 +608,81 @@ exports.Devices = (function (_super) {
|
|
|
608
608
|
});
|
|
609
609
|
});
|
|
610
610
|
};
|
|
611
|
+
class_1.processGatewayCommand = function (deviceId, gatewayCommandRequest) {
|
|
612
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
613
|
+
var axios, data, result, error_22;
|
|
614
|
+
return __generator(this, function (_a) {
|
|
615
|
+
switch (_a.label) {
|
|
616
|
+
case 0:
|
|
617
|
+
_a.trys.push([0, 2, , 3]);
|
|
618
|
+
this.logAction("Process gateway command: " + gatewayCommandRequest.command_type + ", on device id: " + deviceId);
|
|
619
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
620
|
+
data = JSON.stringify(gatewayCommandRequest);
|
|
621
|
+
return [4, axios.post(constants_1.Endpoints.device + "/" + deviceId + "/" + gatewayCommandRequest.command_type, data)];
|
|
622
|
+
case 1:
|
|
623
|
+
result = _a.sent();
|
|
624
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
625
|
+
case 2:
|
|
626
|
+
error_22 = _a.sent();
|
|
627
|
+
if ((0, helpers_1.isApiError)(error_22)) {
|
|
628
|
+
throw error_22;
|
|
629
|
+
}
|
|
630
|
+
throw error_22;
|
|
631
|
+
case 3: return [2];
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
});
|
|
635
|
+
};
|
|
636
|
+
class_1.bulkExecuteGatewayCommand = function (ids, gatewayCommandRequest) {
|
|
637
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
638
|
+
var axios, result, error_23;
|
|
639
|
+
return __generator(this, function (_a) {
|
|
640
|
+
switch (_a.label) {
|
|
641
|
+
case 0:
|
|
642
|
+
_a.trys.push([0, 2, , 3]);
|
|
643
|
+
this.logAction("Execute " + gatewayCommandRequest.command_type + " command on devices with IDs: " + ids);
|
|
644
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
645
|
+
return [4, axios.post(constants_1.Endpoints.device + "/bulk/gateway_command", {
|
|
646
|
+
command_type: gatewayCommandRequest.command_type,
|
|
647
|
+
ids: ids,
|
|
648
|
+
})];
|
|
649
|
+
case 1:
|
|
650
|
+
result = _a.sent();
|
|
651
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
652
|
+
case 2:
|
|
653
|
+
error_23 = _a.sent();
|
|
654
|
+
if ((0, helpers_1.isApiError)(error_23)) {
|
|
655
|
+
throw error_23;
|
|
656
|
+
}
|
|
657
|
+
throw error_23;
|
|
658
|
+
case 3: return [2];
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
});
|
|
662
|
+
};
|
|
663
|
+
class_1.getFiles = function (id) {
|
|
664
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
665
|
+
var axios, result, error_24;
|
|
666
|
+
return __generator(this, function (_a) {
|
|
667
|
+
switch (_a.label) {
|
|
668
|
+
case 0:
|
|
669
|
+
_a.trys.push([0, 2, , 3]);
|
|
670
|
+
this.logAction("Getting files attached to device with id " + id);
|
|
671
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
672
|
+
return [4, axios.get(constants_1.Endpoints.device + "/" + id + "/files")];
|
|
673
|
+
case 1:
|
|
674
|
+
result = _a.sent();
|
|
675
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
676
|
+
case 2:
|
|
677
|
+
error_24 = _a.sent();
|
|
678
|
+
if ((0, helpers_1.isApiError)(error_24)) {
|
|
679
|
+
throw error_24;
|
|
680
|
+
}
|
|
681
|
+
throw error_24;
|
|
682
|
+
case 3: return [2];
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
});
|
|
686
|
+
};
|
|
611
687
|
return class_1;
|
|
612
688
|
}(ModelClass_1.BaseModelClass));
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { BaseModelInterface } from '../core/ModelClass';
|
|
2
2
|
import { BulkActionResponse } from '../models';
|
|
3
|
-
import { GatewayCommand, GatewayCommandInput, GatewayCommandsFilters,
|
|
3
|
+
import { GatewayCommand, GatewayCommandInput, GatewayCommandsFilters, PaginatedGatewayCommands } from './models';
|
|
4
4
|
interface GatewayCommandsInterface extends BaseModelInterface<GatewayCommand, GatewayCommandInput, GatewayCommandsFilters, PaginatedGatewayCommands> {
|
|
5
|
-
bulkCreate(ids: string[], gatewayCommand: GatewayCommand): Promise<BulkActionResponse>;
|
|
6
5
|
update(gatewayCommand: GatewayCommand): Promise<GatewayCommand>;
|
|
7
6
|
deleteMultiple(ids: string[]): Promise<BulkActionResponse>;
|
|
8
|
-
ProcessGatewayCommand(deviceId: string, gatewayCommandRequest: GatewayCommandRequest): Promise<GatewayCommand>;
|
|
9
7
|
}
|
|
10
8
|
export declare const GatewayCommands: GatewayCommandsInterface;
|
|
11
9
|
export {};
|
|
@@ -14,17 +14,6 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
-
var __assign = (this && this.__assign) || function () {
|
|
18
|
-
__assign = Object.assign || function(t) {
|
|
19
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
-
s = arguments[i];
|
|
21
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
-
t[p] = s[p];
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
};
|
|
26
|
-
return __assign.apply(this, arguments);
|
|
27
|
-
};
|
|
28
17
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
18
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
19
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -98,35 +87,9 @@ exports.GatewayCommands = (function (_super) {
|
|
|
98
87
|
});
|
|
99
88
|
});
|
|
100
89
|
};
|
|
101
|
-
class_1.bulkCreate = function (ids, gatewayCommand) {
|
|
102
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
103
|
-
var axios, result, error_2;
|
|
104
|
-
return __generator(this, function (_a) {
|
|
105
|
-
switch (_a.label) {
|
|
106
|
-
case 0:
|
|
107
|
-
_a.trys.push([0, 2, , 3]);
|
|
108
|
-
this.logAction("Creating " + ids.length + " gateway commands with type " + gatewayCommand.command_type);
|
|
109
|
-
axios = __1.EdgeIQAPI.getAxios();
|
|
110
|
-
return [4, axios.post(constants_1.Endpoints.device + "/bulk", {
|
|
111
|
-
data: __assign({ ids: ids }, gatewayCommand),
|
|
112
|
-
})];
|
|
113
|
-
case 1:
|
|
114
|
-
result = _a.sent();
|
|
115
|
-
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
116
|
-
case 2:
|
|
117
|
-
error_2 = _a.sent();
|
|
118
|
-
if ((0, helpers_1.isApiError)(error_2)) {
|
|
119
|
-
throw error_2;
|
|
120
|
-
}
|
|
121
|
-
throw error_2;
|
|
122
|
-
case 3: return [2];
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
90
|
class_1.update = function (gatewayCommand) {
|
|
128
91
|
return __awaiter(this, void 0, void 0, function () {
|
|
129
|
-
var axios, data, result,
|
|
92
|
+
var axios, data, result, error_2;
|
|
130
93
|
return __generator(this, function (_a) {
|
|
131
94
|
switch (_a.label) {
|
|
132
95
|
case 0:
|
|
@@ -139,11 +102,11 @@ exports.GatewayCommands = (function (_super) {
|
|
|
139
102
|
result = _a.sent();
|
|
140
103
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
141
104
|
case 2:
|
|
142
|
-
|
|
143
|
-
if ((0, helpers_1.isApiError)(
|
|
144
|
-
throw
|
|
105
|
+
error_2 = _a.sent();
|
|
106
|
+
if ((0, helpers_1.isApiError)(error_2)) {
|
|
107
|
+
throw error_2;
|
|
145
108
|
}
|
|
146
|
-
throw
|
|
109
|
+
throw error_2;
|
|
147
110
|
case 3: return [2];
|
|
148
111
|
}
|
|
149
112
|
});
|
|
@@ -152,7 +115,7 @@ exports.GatewayCommands = (function (_super) {
|
|
|
152
115
|
class_1.list = function (filters, pagination) {
|
|
153
116
|
var _a, _b, _c, _d;
|
|
154
117
|
return __awaiter(this, void 0, void 0, function () {
|
|
155
|
-
var axios, result,
|
|
118
|
+
var axios, result, error_3;
|
|
156
119
|
return __generator(this, function (_e) {
|
|
157
120
|
switch (_e.label) {
|
|
158
121
|
case 0:
|
|
@@ -173,11 +136,11 @@ exports.GatewayCommands = (function (_super) {
|
|
|
173
136
|
},
|
|
174
137
|
}];
|
|
175
138
|
case 2:
|
|
176
|
-
|
|
177
|
-
if ((0, helpers_1.isApiError)(
|
|
178
|
-
throw
|
|
139
|
+
error_3 = _e.sent();
|
|
140
|
+
if ((0, helpers_1.isApiError)(error_3)) {
|
|
141
|
+
throw error_3;
|
|
179
142
|
}
|
|
180
|
-
throw
|
|
143
|
+
throw error_3;
|
|
181
144
|
case 3: return [2];
|
|
182
145
|
}
|
|
183
146
|
});
|
|
@@ -185,7 +148,7 @@ exports.GatewayCommands = (function (_super) {
|
|
|
185
148
|
};
|
|
186
149
|
class_1.getOneById = function (id) {
|
|
187
150
|
return __awaiter(this, void 0, void 0, function () {
|
|
188
|
-
var axios, result,
|
|
151
|
+
var axios, result, error_4;
|
|
189
152
|
return __generator(this, function (_a) {
|
|
190
153
|
switch (_a.label) {
|
|
191
154
|
case 0:
|
|
@@ -197,11 +160,11 @@ exports.GatewayCommands = (function (_super) {
|
|
|
197
160
|
result = _a.sent();
|
|
198
161
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
199
162
|
case 2:
|
|
200
|
-
|
|
201
|
-
if ((0, helpers_1.isApiError)(
|
|
202
|
-
throw
|
|
163
|
+
error_4 = _a.sent();
|
|
164
|
+
if ((0, helpers_1.isApiError)(error_4)) {
|
|
165
|
+
throw error_4;
|
|
203
166
|
}
|
|
204
|
-
throw
|
|
167
|
+
throw error_4;
|
|
205
168
|
case 3: return [2];
|
|
206
169
|
}
|
|
207
170
|
});
|
|
@@ -209,7 +172,7 @@ exports.GatewayCommands = (function (_super) {
|
|
|
209
172
|
};
|
|
210
173
|
class_1.delete = function (id) {
|
|
211
174
|
return __awaiter(this, void 0, void 0, function () {
|
|
212
|
-
var axios,
|
|
175
|
+
var axios, error_5;
|
|
213
176
|
return __generator(this, function (_a) {
|
|
214
177
|
switch (_a.label) {
|
|
215
178
|
case 0:
|
|
@@ -221,11 +184,11 @@ exports.GatewayCommands = (function (_super) {
|
|
|
221
184
|
_a.sent();
|
|
222
185
|
return [2, (0, helpers_1.getReturnDeleteMessage)('gatewayCommand')];
|
|
223
186
|
case 2:
|
|
224
|
-
|
|
225
|
-
if ((0, helpers_1.isApiError)(
|
|
226
|
-
throw
|
|
187
|
+
error_5 = _a.sent();
|
|
188
|
+
if ((0, helpers_1.isApiError)(error_5)) {
|
|
189
|
+
throw error_5;
|
|
227
190
|
}
|
|
228
|
-
throw
|
|
191
|
+
throw error_5;
|
|
229
192
|
case 3: return [2];
|
|
230
193
|
}
|
|
231
194
|
});
|
|
@@ -233,7 +196,7 @@ exports.GatewayCommands = (function (_super) {
|
|
|
233
196
|
};
|
|
234
197
|
class_1.deleteMultiple = function (ids) {
|
|
235
198
|
return __awaiter(this, void 0, void 0, function () {
|
|
236
|
-
var axios, result,
|
|
199
|
+
var axios, result, error_6;
|
|
237
200
|
return __generator(this, function (_a) {
|
|
238
201
|
switch (_a.label) {
|
|
239
202
|
case 0:
|
|
@@ -247,36 +210,11 @@ exports.GatewayCommands = (function (_super) {
|
|
|
247
210
|
result = _a.sent();
|
|
248
211
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
249
212
|
case 2:
|
|
250
|
-
|
|
251
|
-
if ((0, helpers_1.isApiError)(
|
|
252
|
-
throw
|
|
253
|
-
}
|
|
254
|
-
throw error_7;
|
|
255
|
-
case 3: return [2];
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
});
|
|
259
|
-
};
|
|
260
|
-
class_1.ProcessGatewayCommand = function (deviceId, gatewayCommandRequest) {
|
|
261
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
262
|
-
var axios, data, result, error_8;
|
|
263
|
-
return __generator(this, function (_a) {
|
|
264
|
-
switch (_a.label) {
|
|
265
|
-
case 0:
|
|
266
|
-
_a.trys.push([0, 2, , 3]);
|
|
267
|
-
this.logAction("Process gateway command: " + gatewayCommandRequest.command_type + ", on device id: " + deviceId);
|
|
268
|
-
axios = __1.EdgeIQAPI.getAxios();
|
|
269
|
-
data = JSON.stringify(gatewayCommandRequest);
|
|
270
|
-
return [4, axios.post(constants_1.Endpoints.device + "/" + deviceId + "/" + gatewayCommandRequest.command_type, data)];
|
|
271
|
-
case 1:
|
|
272
|
-
result = _a.sent();
|
|
273
|
-
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
274
|
-
case 2:
|
|
275
|
-
error_8 = _a.sent();
|
|
276
|
-
if ((0, helpers_1.isApiError)(error_8)) {
|
|
277
|
-
throw error_8;
|
|
213
|
+
error_6 = _a.sent();
|
|
214
|
+
if ((0, helpers_1.isApiError)(error_6)) {
|
|
215
|
+
throw error_6;
|
|
278
216
|
}
|
|
279
|
-
throw
|
|
217
|
+
throw error_6;
|
|
280
218
|
case 3: return [2];
|
|
281
219
|
}
|
|
282
220
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Base, Filter, Filters, Pagination } from '../models';
|
|
2
|
-
export declare type GatewayCommandType = '
|
|
2
|
+
export declare type GatewayCommandType = 'activate_cloud_native_device' | 'backup' | 'data_restriction' | 'deactivate_cloud_native_device' | 'disable_data_restriction' | 'enable_data_restriction' | 'greengrass_initialize' | 'heartbeat' | 'log_level' | 'log_upload' | 'lwm2m_request' | 'lwm2m_file' | 'restore_backup' | 'reboot' | 'reset' | 'send_config' | 'software_update' | 'status';
|
|
3
|
+
export declare type CommandType = 'download' | 'fileupload' | 'filedownload' | 'execute' | 'observe' | 'observe_stop' | 'read' | 'upload' | 'write';
|
|
3
4
|
export interface CommandSchedule {
|
|
4
5
|
start_datetime: string;
|
|
5
6
|
end_datetime: string;
|
|
@@ -9,28 +10,10 @@ export interface GatewayCommandStatus {
|
|
|
9
10
|
status: string;
|
|
10
11
|
status_message?: string;
|
|
11
12
|
}
|
|
12
|
-
export interface GatewayCommandInput {
|
|
13
|
-
command_type: GatewayCommandType;
|
|
14
|
-
payload: {
|
|
15
|
-
[key: string]: unknown;
|
|
16
|
-
};
|
|
17
|
-
schedule?: CommandSchedule;
|
|
18
|
-
timeout?: number;
|
|
19
|
-
statuses: {
|
|
20
|
-
[key: string]: GatewayCommandStatus;
|
|
21
|
-
};
|
|
22
|
-
device_config_id?: string;
|
|
23
|
-
device_id?: string;
|
|
24
|
-
device_unique_id?: string;
|
|
25
|
-
device_type_id?: string;
|
|
26
|
-
software_update_id?: string;
|
|
27
|
-
attached_device_ids: string[];
|
|
28
|
-
attached_device_unique_ids: string[];
|
|
29
|
-
}
|
|
30
13
|
export interface GatewayCommandRequest {
|
|
31
14
|
command_type: GatewayCommandType;
|
|
32
15
|
schedule?: CommandSchedule;
|
|
33
|
-
timeout
|
|
16
|
+
timeout?: number;
|
|
34
17
|
url?: string;
|
|
35
18
|
version?: string;
|
|
36
19
|
software_update_id?: string;
|
|
@@ -39,7 +22,12 @@ export interface GatewayCommandRequest {
|
|
|
39
22
|
enable?: boolean;
|
|
40
23
|
card_holder?: AmagCardHolder;
|
|
41
24
|
attached_device_ids?: string[];
|
|
42
|
-
|
|
25
|
+
data?: unknown;
|
|
26
|
+
type?: CommandType;
|
|
27
|
+
}
|
|
28
|
+
export interface Lwm2mRequest extends GatewayCommandRequest {
|
|
29
|
+
type: CommandType;
|
|
30
|
+
endpoint: string;
|
|
43
31
|
}
|
|
44
32
|
export interface AmagCardHolder {
|
|
45
33
|
first_name?: string;
|
|
@@ -54,6 +42,24 @@ export interface AmagCardHolder {
|
|
|
54
42
|
expiry_date?: string;
|
|
55
43
|
personal_data: string[];
|
|
56
44
|
}
|
|
45
|
+
export interface GatewayCommandInput {
|
|
46
|
+
command_type: GatewayCommandType;
|
|
47
|
+
payload: {
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
};
|
|
50
|
+
schedule?: CommandSchedule;
|
|
51
|
+
timeout?: number;
|
|
52
|
+
statuses: {
|
|
53
|
+
[key: string]: GatewayCommandStatus;
|
|
54
|
+
};
|
|
55
|
+
device_config_id?: string;
|
|
56
|
+
device_id?: string;
|
|
57
|
+
device_unique_id?: string;
|
|
58
|
+
device_type_id?: string;
|
|
59
|
+
software_update_id?: string;
|
|
60
|
+
attached_device_ids: string[];
|
|
61
|
+
attached_device_unique_ids: string[];
|
|
62
|
+
}
|
|
57
63
|
export interface GatewayCommand extends GatewayCommandInput, Base {
|
|
58
64
|
}
|
|
59
65
|
export interface GatewayCommandsFilters extends Filters {
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { Companies } from './companies';
|
|
|
6
6
|
export { DeviceConfigs } from './deviceConfigs';
|
|
7
7
|
export { DeviceLocationObservations } from './deviceLocationObservations';
|
|
8
8
|
export { Devices } from './devices';
|
|
9
|
+
export { DeviceErrors } from './deviceErrors';
|
|
9
10
|
export { DeviceTemplates } from './deviceTemplates';
|
|
10
11
|
export { DeviceTransferRequests } from './deviceTransferRequests';
|
|
11
12
|
export { DeviceTypes } from './deviceTypes';
|
|
@@ -15,8 +16,8 @@ export { EscrowDevices } from './escrowDevices';
|
|
|
15
16
|
export { GatewayCommands } from './gatewayCommands';
|
|
16
17
|
export { Ingestors } from './ingestors';
|
|
17
18
|
export { Integrations } from './integrations';
|
|
19
|
+
export { LWM2M } from './lwm2m';
|
|
18
20
|
export { Notifications } from './notifications';
|
|
19
|
-
export { Lwm2mStates } from './lwm2mState';
|
|
20
21
|
export { PollableAttributes } from './pollableAttributes';
|
|
21
22
|
export { Regions } from './regions';
|
|
22
23
|
export { Reports } from './reports';
|
|
@@ -29,7 +30,6 @@ export { SystemCommandJobs } from './systemCommandJobs';
|
|
|
29
30
|
export { Translators } from './translators';
|
|
30
31
|
export { Users } from './users';
|
|
31
32
|
export { UserTypes } from './userTypes';
|
|
32
|
-
export { DeviceErrors } from './deviceErrors';
|
|
33
33
|
export * from './models';
|
|
34
34
|
export * from './bulkResponses/models';
|
|
35
35
|
export * from './commands/models';
|
|
@@ -38,6 +38,7 @@ export * from './deviceConfigs/models';
|
|
|
38
38
|
export * from './deviceLocationObservations/models';
|
|
39
39
|
export * from './devices/models';
|
|
40
40
|
export * from './discoveredDevices/models';
|
|
41
|
+
export * from './deviceErrors/models';
|
|
41
42
|
export * from './deviceTemplates/models';
|
|
42
43
|
export * from './deviceTransferRequests/models';
|
|
43
44
|
export * from './deviceTypes/models';
|
|
@@ -46,8 +47,8 @@ export * from './escrowDevices/models';
|
|
|
46
47
|
export * from './gatewayCommands/models';
|
|
47
48
|
export * from './ingestors/models';
|
|
48
49
|
export * from './integrations/models';
|
|
50
|
+
export * from './lwm2m/models';
|
|
49
51
|
export * from './notifications/models';
|
|
50
|
-
export * from './lwm2mState/models';
|
|
51
52
|
export * from './pollableAttributes/models';
|
|
52
53
|
export * from './reports/models';
|
|
53
54
|
export * from './regions/models';
|
|
@@ -60,4 +61,3 @@ export * from './systemCommandJobs/models';
|
|
|
60
61
|
export * from './translators/models';
|
|
61
62
|
export * from './users/models';
|
|
62
63
|
export * from './userTypes/models';
|
|
63
|
-
export * from './deviceErrors/models';
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.
|
|
13
|
+
exports.UserTypes = exports.Users = exports.Translators = exports.SystemCommandJobs = exports.SystemCommands = exports.Stats = exports.SoftwareUpdates = exports.Secrets = exports.Rules = exports.Reports = exports.Regions = exports.PollableAttributes = exports.Notifications = exports.LWM2M = exports.Integrations = exports.Ingestors = exports.GatewayCommands = exports.EscrowDevices = exports.DownstreamSystems = exports.DiscoveredDevices = exports.DeviceTypes = exports.DeviceTransferRequests = exports.DeviceTemplates = exports.DeviceErrors = exports.Devices = exports.DeviceLocationObservations = exports.DeviceConfigs = exports.Companies = exports.Commands = exports.BulkResponses = exports.Authentication = exports.EdgeIQAPI = void 0;
|
|
14
14
|
var core_1 = require("./core");
|
|
15
15
|
Object.defineProperty(exports, "EdgeIQAPI", { enumerable: true, get: function () { return core_1.EdgeIQAPI; } });
|
|
16
16
|
var auth_1 = require("./auth");
|
|
@@ -27,6 +27,8 @@ var deviceLocationObservations_1 = require("./deviceLocationObservations");
|
|
|
27
27
|
Object.defineProperty(exports, "DeviceLocationObservations", { enumerable: true, get: function () { return deviceLocationObservations_1.DeviceLocationObservations; } });
|
|
28
28
|
var devices_1 = require("./devices");
|
|
29
29
|
Object.defineProperty(exports, "Devices", { enumerable: true, get: function () { return devices_1.Devices; } });
|
|
30
|
+
var deviceErrors_1 = require("./deviceErrors");
|
|
31
|
+
Object.defineProperty(exports, "DeviceErrors", { enumerable: true, get: function () { return deviceErrors_1.DeviceErrors; } });
|
|
30
32
|
var deviceTemplates_1 = require("./deviceTemplates");
|
|
31
33
|
Object.defineProperty(exports, "DeviceTemplates", { enumerable: true, get: function () { return deviceTemplates_1.DeviceTemplates; } });
|
|
32
34
|
var deviceTransferRequests_1 = require("./deviceTransferRequests");
|
|
@@ -45,10 +47,10 @@ var ingestors_1 = require("./ingestors");
|
|
|
45
47
|
Object.defineProperty(exports, "Ingestors", { enumerable: true, get: function () { return ingestors_1.Ingestors; } });
|
|
46
48
|
var integrations_1 = require("./integrations");
|
|
47
49
|
Object.defineProperty(exports, "Integrations", { enumerable: true, get: function () { return integrations_1.Integrations; } });
|
|
50
|
+
var lwm2m_1 = require("./lwm2m");
|
|
51
|
+
Object.defineProperty(exports, "LWM2M", { enumerable: true, get: function () { return lwm2m_1.LWM2M; } });
|
|
48
52
|
var notifications_1 = require("./notifications");
|
|
49
53
|
Object.defineProperty(exports, "Notifications", { enumerable: true, get: function () { return notifications_1.Notifications; } });
|
|
50
|
-
var lwm2mState_1 = require("./lwm2mState");
|
|
51
|
-
Object.defineProperty(exports, "Lwm2mStates", { enumerable: true, get: function () { return lwm2mState_1.Lwm2mStates; } });
|
|
52
54
|
var pollableAttributes_1 = require("./pollableAttributes");
|
|
53
55
|
Object.defineProperty(exports, "PollableAttributes", { enumerable: true, get: function () { return pollableAttributes_1.PollableAttributes; } });
|
|
54
56
|
var regions_1 = require("./regions");
|
|
@@ -73,8 +75,6 @@ var users_1 = require("./users");
|
|
|
73
75
|
Object.defineProperty(exports, "Users", { enumerable: true, get: function () { return users_1.Users; } });
|
|
74
76
|
var userTypes_1 = require("./userTypes");
|
|
75
77
|
Object.defineProperty(exports, "UserTypes", { enumerable: true, get: function () { return userTypes_1.UserTypes; } });
|
|
76
|
-
var deviceErrors_1 = require("./deviceErrors");
|
|
77
|
-
Object.defineProperty(exports, "DeviceErrors", { enumerable: true, get: function () { return deviceErrors_1.DeviceErrors; } });
|
|
78
78
|
__exportStar(require("./models"), exports);
|
|
79
79
|
__exportStar(require("./bulkResponses/models"), exports);
|
|
80
80
|
__exportStar(require("./commands/models"), exports);
|
|
@@ -83,6 +83,7 @@ __exportStar(require("./deviceConfigs/models"), exports);
|
|
|
83
83
|
__exportStar(require("./deviceLocationObservations/models"), exports);
|
|
84
84
|
__exportStar(require("./devices/models"), exports);
|
|
85
85
|
__exportStar(require("./discoveredDevices/models"), exports);
|
|
86
|
+
__exportStar(require("./deviceErrors/models"), exports);
|
|
86
87
|
__exportStar(require("./deviceTemplates/models"), exports);
|
|
87
88
|
__exportStar(require("./deviceTransferRequests/models"), exports);
|
|
88
89
|
__exportStar(require("./deviceTypes/models"), exports);
|
|
@@ -91,8 +92,8 @@ __exportStar(require("./escrowDevices/models"), exports);
|
|
|
91
92
|
__exportStar(require("./gatewayCommands/models"), exports);
|
|
92
93
|
__exportStar(require("./ingestors/models"), exports);
|
|
93
94
|
__exportStar(require("./integrations/models"), exports);
|
|
95
|
+
__exportStar(require("./lwm2m/models"), exports);
|
|
94
96
|
__exportStar(require("./notifications/models"), exports);
|
|
95
|
-
__exportStar(require("./lwm2mState/models"), exports);
|
|
96
97
|
__exportStar(require("./pollableAttributes/models"), exports);
|
|
97
98
|
__exportStar(require("./reports/models"), exports);
|
|
98
99
|
__exportStar(require("./regions/models"), exports);
|
|
@@ -105,4 +106,3 @@ __exportStar(require("./systemCommandJobs/models"), exports);
|
|
|
105
106
|
__exportStar(require("./translators/models"), exports);
|
|
106
107
|
__exportStar(require("./users/models"), exports);
|
|
107
108
|
__exportStar(require("./userTypes/models"), exports);
|
|
108
|
-
__exportStar(require("./deviceErrors/models"), exports);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.LWM2M = void 0;
|
|
40
|
+
var constants_1 = require("../constants");
|
|
41
|
+
var helpers_1 = require("../helpers");
|
|
42
|
+
var filtersParser_1 = require("../filtersParser");
|
|
43
|
+
var __1 = require("..");
|
|
44
|
+
var LWM2M = {
|
|
45
|
+
listStates: function (filters) { return __awaiter(void 0, void 0, void 0, function () {
|
|
46
|
+
var axios, result, error_1;
|
|
47
|
+
var _a;
|
|
48
|
+
return __generator(this, function (_b) {
|
|
49
|
+
switch (_b.label) {
|
|
50
|
+
case 0:
|
|
51
|
+
_b.trys.push([0, 2, , 3]);
|
|
52
|
+
__1.EdgeIQAPI.logAction("Listing bulk responses with following filters: " + (filters !== null && filters !== void 0 ? filters : '{}'));
|
|
53
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
54
|
+
return [4, axios.get(constants_1.Endpoints.lwm2mStates, {
|
|
55
|
+
params: (0, filtersParser_1.parseFilters)(filters),
|
|
56
|
+
})];
|
|
57
|
+
case 1:
|
|
58
|
+
result = _b.sent();
|
|
59
|
+
return [2, (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.resources];
|
|
60
|
+
case 2:
|
|
61
|
+
error_1 = _b.sent();
|
|
62
|
+
if ((0, helpers_1.isApiError)(error_1)) {
|
|
63
|
+
throw error_1;
|
|
64
|
+
}
|
|
65
|
+
throw error_1;
|
|
66
|
+
case 3: return [2];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}); },
|
|
70
|
+
};
|
|
71
|
+
exports.LWM2M = LWM2M;
|
package/dist/lwm2m/models.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import { Base } from '../models';
|
|
1
|
+
import { Base, Filter, Filters } from '../models';
|
|
2
|
+
export interface Lwm2mState extends Base {
|
|
3
|
+
device_id?: string;
|
|
4
|
+
state?: {
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export interface Lwm2mStatesFilters extends Filters {
|
|
9
|
+
device_id?: Filter;
|
|
10
|
+
}
|
|
2
11
|
export interface Lwm2mObjectLinks extends Base {
|
|
3
12
|
device_id?: string;
|
|
4
13
|
links?: Lwm2mObjectLink[];
|