@edgeiq/edgeiq-api-js 1.1.0 → 1.1.4
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/devices/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, Devic
|
|
|
11
11
|
detachIngestor(id: string, ingestorId: string): Promise<string>;
|
|
12
12
|
getIngestors(id: string): Promise<Ingestor[]>;
|
|
13
13
|
attachRule(id: string, ruleId: string): Promise<string>;
|
|
14
|
+
bulkAttachRules(id: string, rulesIds: string[]): Promise<BulkActionResponse>;
|
|
14
15
|
detachRule(id: string, ruleId: string): Promise<string>;
|
|
15
16
|
getRules(id: string): Promise<Rule[]>;
|
|
16
17
|
}
|
package/dist/devices/index.js
CHANGED
|
@@ -379,9 +379,35 @@ exports.Devices = (function (_super) {
|
|
|
379
379
|
});
|
|
380
380
|
});
|
|
381
381
|
};
|
|
382
|
+
class_1.bulkAttachRules = function (id, rulesIds) {
|
|
383
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
384
|
+
var axios, result, error_13;
|
|
385
|
+
return __generator(this, function (_a) {
|
|
386
|
+
switch (_a.label) {
|
|
387
|
+
case 0:
|
|
388
|
+
_a.trys.push([0, 2, , 3]);
|
|
389
|
+
this.logAction("Attaching " + rulesIds.length + " rules with to device with id " + id);
|
|
390
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
391
|
+
return [4, axios.post(constants_1.Endpoints.device + "/" + id + "/rules/bulk", {
|
|
392
|
+
data: { ids: rulesIds },
|
|
393
|
+
})];
|
|
394
|
+
case 1:
|
|
395
|
+
result = _a.sent();
|
|
396
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
397
|
+
case 2:
|
|
398
|
+
error_13 = _a.sent();
|
|
399
|
+
if ((0, helpers_1.isApiError)(error_13)) {
|
|
400
|
+
throw error_13;
|
|
401
|
+
}
|
|
402
|
+
throw error_13;
|
|
403
|
+
case 3: return [2];
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
};
|
|
382
408
|
class_1.detachRule = function (id, ruleId) {
|
|
383
409
|
return __awaiter(this, void 0, void 0, function () {
|
|
384
|
-
var axios,
|
|
410
|
+
var axios, error_14;
|
|
385
411
|
return __generator(this, function (_a) {
|
|
386
412
|
switch (_a.label) {
|
|
387
413
|
case 0:
|
|
@@ -393,11 +419,11 @@ exports.Devices = (function (_super) {
|
|
|
393
419
|
_a.sent();
|
|
394
420
|
return [2, (0, constants_1.getAttachMessage)('Rule', 'detach', 'device')];
|
|
395
421
|
case 2:
|
|
396
|
-
|
|
397
|
-
if ((0, helpers_1.isApiError)(
|
|
398
|
-
throw
|
|
422
|
+
error_14 = _a.sent();
|
|
423
|
+
if ((0, helpers_1.isApiError)(error_14)) {
|
|
424
|
+
throw error_14;
|
|
399
425
|
}
|
|
400
|
-
throw
|
|
426
|
+
throw error_14;
|
|
401
427
|
case 3: return [2];
|
|
402
428
|
}
|
|
403
429
|
});
|
|
@@ -405,7 +431,7 @@ exports.Devices = (function (_super) {
|
|
|
405
431
|
};
|
|
406
432
|
class_1.getRules = function (id) {
|
|
407
433
|
return __awaiter(this, void 0, void 0, function () {
|
|
408
|
-
var axios, result,
|
|
434
|
+
var axios, result, error_15;
|
|
409
435
|
return __generator(this, function (_a) {
|
|
410
436
|
switch (_a.label) {
|
|
411
437
|
case 0:
|
|
@@ -417,11 +443,11 @@ exports.Devices = (function (_super) {
|
|
|
417
443
|
result = _a.sent();
|
|
418
444
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
419
445
|
case 2:
|
|
420
|
-
|
|
421
|
-
if ((0, helpers_1.isApiError)(
|
|
422
|
-
throw
|
|
446
|
+
error_15 = _a.sent();
|
|
447
|
+
if ((0, helpers_1.isApiError)(error_15)) {
|
|
448
|
+
throw error_15;
|
|
423
449
|
}
|
|
424
|
-
throw
|
|
450
|
+
throw error_15;
|
|
425
451
|
case 3: return [2];
|
|
426
452
|
}
|
|
427
453
|
});
|
package/dist/devices/models.d.ts
CHANGED
package/dist/models.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface Pagination {
|
|
|
9
9
|
export interface PaginationFilter {
|
|
10
10
|
page: number;
|
|
11
11
|
itemsPerPage: number;
|
|
12
|
-
order_by
|
|
12
|
+
order_by?: string;
|
|
13
13
|
}
|
|
14
14
|
export interface Filter {
|
|
15
15
|
operator: 'eq' | 'ne' | 'like' | 'gt' | 'gte' | 'lt' | 'lte' | 'between' | 'in' | 'nin' | 'incany' | 'incall';
|