@edgeiq/edgeiq-api-js 1.2.4 → 1.2.7
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 +1 -0
- package/dist/devices/index.js +26 -0
- package/dist/devices/models.d.ts +5 -6
- package/dist/discoveredDevices/index.js +26 -0
- package/dist/filtersParser.d.ts +1 -1
- package/dist/filtersParser.js +9 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/models.d.ts +1 -1
- package/package.json +1 -1
package/dist/devices/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, Devic
|
|
|
16
16
|
getRules(id: string): Promise<Rule[]>;
|
|
17
17
|
getCommands(id: string): Promise<Command[]>;
|
|
18
18
|
csvBulkUpload(file: File): Promise<BulkActionResponse>;
|
|
19
|
+
csvBulkDownload(filters?: DevicesFilters): Promise<File>;
|
|
19
20
|
}
|
|
20
21
|
export declare const Devices: DevicesInterface;
|
|
21
22
|
export {};
|
package/dist/devices/index.js
CHANGED
|
@@ -507,5 +507,31 @@ exports.Devices = (function (_super) {
|
|
|
507
507
|
});
|
|
508
508
|
});
|
|
509
509
|
};
|
|
510
|
+
class_1.csvBulkDownload = function (filters) {
|
|
511
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
512
|
+
var axios, result, error_18;
|
|
513
|
+
return __generator(this, function (_a) {
|
|
514
|
+
switch (_a.label) {
|
|
515
|
+
case 0:
|
|
516
|
+
_a.trys.push([0, 2, , 3]);
|
|
517
|
+
this.logAction("Listing devices with following filters: " + (filters !== null && filters !== void 0 ? filters : '{}'));
|
|
518
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
519
|
+
return [4, axios.get(constants_1.Endpoints.device + "/csv_bulk_download", {
|
|
520
|
+
params: (0, filtersParser_1.parseFilters)(filters, undefined, true),
|
|
521
|
+
})];
|
|
522
|
+
case 1:
|
|
523
|
+
result = _a.sent();
|
|
524
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
525
|
+
case 2:
|
|
526
|
+
error_18 = _a.sent();
|
|
527
|
+
if ((0, helpers_1.isApiError)(error_18)) {
|
|
528
|
+
throw error_18;
|
|
529
|
+
}
|
|
530
|
+
throw error_18;
|
|
531
|
+
case 3: return [2];
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
});
|
|
535
|
+
};
|
|
510
536
|
return class_1;
|
|
511
537
|
}(ModelClass_1.BaseModelClass));
|
package/dist/devices/models.d.ts
CHANGED
|
@@ -42,6 +42,11 @@ export interface DeviceInput {
|
|
|
42
42
|
attached_device_ids?: string[];
|
|
43
43
|
log_config?: LogConfig;
|
|
44
44
|
location?: string;
|
|
45
|
+
device_config_id?: string;
|
|
46
|
+
device_integration_id?: string;
|
|
47
|
+
cloud_native_integration_id?: string;
|
|
48
|
+
device_ha_group_id?: string;
|
|
49
|
+
deployment_id?: string;
|
|
45
50
|
last_known_geographic_location?: GeoJson;
|
|
46
51
|
metadata?: {
|
|
47
52
|
[key: string]: unknown;
|
|
@@ -55,7 +60,6 @@ export interface Device extends DeviceInput, Base {
|
|
|
55
60
|
aws_keys_and_certificate_secret_id?: string;
|
|
56
61
|
edge_version?: string;
|
|
57
62
|
firmware_version?: string;
|
|
58
|
-
serial?: string;
|
|
59
63
|
status_at?: string;
|
|
60
64
|
provision_status?: string;
|
|
61
65
|
health_status?: string;
|
|
@@ -64,11 +68,6 @@ export interface Device extends DeviceInput, Base {
|
|
|
64
68
|
last_heartbeat_status?: string;
|
|
65
69
|
last_sms_sent_at?: string;
|
|
66
70
|
cell_signal?: number;
|
|
67
|
-
device_type_id: string;
|
|
68
|
-
device_config_id?: string;
|
|
69
|
-
device_integration_id?: string;
|
|
70
|
-
device_ha_group_id?: string;
|
|
71
|
-
deployment_id?: string;
|
|
72
71
|
}
|
|
73
72
|
export interface DevicesFilters extends Filters {
|
|
74
73
|
device_online?: Filter;
|
|
@@ -331,5 +331,31 @@ exports.DiscoveredDevices = (function (_super) {
|
|
|
331
331
|
});
|
|
332
332
|
});
|
|
333
333
|
};
|
|
334
|
+
class_1.csvBulkDownload = function (filters) {
|
|
335
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
336
|
+
var axios, result, error_11;
|
|
337
|
+
return __generator(this, function (_a) {
|
|
338
|
+
switch (_a.label) {
|
|
339
|
+
case 0:
|
|
340
|
+
_a.trys.push([0, 2, , 3]);
|
|
341
|
+
this.logAction("Listing discovered devices with following filters: " + (filters !== null && filters !== void 0 ? filters : '{}'));
|
|
342
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
343
|
+
return [4, axios.get(constants_1.Endpoints.discoveredDevice + "/csv_bulk_download", {
|
|
344
|
+
params: (0, filtersParser_1.parseFilters)(filters, undefined, true),
|
|
345
|
+
})];
|
|
346
|
+
case 1:
|
|
347
|
+
result = _a.sent();
|
|
348
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
349
|
+
case 2:
|
|
350
|
+
error_11 = _a.sent();
|
|
351
|
+
if ((0, helpers_1.isApiError)(error_11)) {
|
|
352
|
+
throw error_11;
|
|
353
|
+
}
|
|
354
|
+
throw error_11;
|
|
355
|
+
case 3: return [2];
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
};
|
|
334
360
|
return class_1;
|
|
335
361
|
}(ModelClass_1.BaseModelClass));
|
package/dist/filtersParser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BulkResponsesFilters, CompaniesFilters, DeviceConfigsFilters, DevicesFilters, DeviceTemplatesFilters, DeviceTransferRequestsFilters, DeviceTypesFilters, IngestorsFilters, IntegrationsFilters, PollableAttributesFilters, RulesFilters, UsersFilters } from '.';
|
|
2
2
|
import { PaginationFilter } from './models';
|
|
3
3
|
declare type FiltersType = BulkResponsesFilters | CompaniesFilters | DeviceConfigsFilters | DevicesFilters | DeviceTemplatesFilters | DeviceTransferRequestsFilters | DeviceTypesFilters | IngestorsFilters | IntegrationsFilters | PollableAttributesFilters | RulesFilters | UsersFilters;
|
|
4
|
-
export declare const parseFilters: (filters?: FiltersType | undefined, pagination?: PaginationFilter | undefined) => Record<string, unknown>;
|
|
4
|
+
export declare const parseFilters: (filters?: FiltersType | undefined, pagination?: PaginationFilter | undefined, noPagination?: boolean) => Record<string, unknown>;
|
|
5
5
|
export {};
|
package/dist/filtersParser.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseFilters = void 0;
|
|
4
4
|
var constants_1 = require("./constants");
|
|
5
|
-
var parseFilters = function (filters, pagination) {
|
|
5
|
+
var parseFilters = function (filters, pagination, noPagination) {
|
|
6
|
+
if (noPagination === void 0) { noPagination = false; }
|
|
6
7
|
var result = {
|
|
7
8
|
page_meta: true,
|
|
8
9
|
};
|
|
@@ -41,11 +42,13 @@ var parseFilters = function (filters, pagination) {
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
if (noPagination) {
|
|
46
|
+
result['page'] = (pagination === null || pagination === void 0 ? void 0 : pagination.page) || constants_1.DefaultPagination.page;
|
|
47
|
+
result['per_page'] =
|
|
48
|
+
(pagination === null || pagination === void 0 ? void 0 : pagination.itemsPerPage) || constants_1.DefaultPagination.itemsPerPage;
|
|
49
|
+
if (pagination === null || pagination === void 0 ? void 0 : pagination.order_by) {
|
|
50
|
+
result['order_by'] = pagination === null || pagination === void 0 ? void 0 : pagination.order_by;
|
|
51
|
+
}
|
|
49
52
|
}
|
|
50
53
|
return result;
|
|
51
54
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export * from './reports/models';
|
|
|
51
51
|
export * from './regions/models';
|
|
52
52
|
export * from './rules/models';
|
|
53
53
|
export * from './secrets/models';
|
|
54
|
+
export * from './stats/models';
|
|
54
55
|
export * from './softwareUpdates/models';
|
|
55
56
|
export * from './systemCommands/models';
|
|
56
57
|
export * from './systemCommandJobs/models';
|
package/dist/index.js
CHANGED
|
@@ -95,6 +95,7 @@ __exportStar(require("./reports/models"), exports);
|
|
|
95
95
|
__exportStar(require("./regions/models"), exports);
|
|
96
96
|
__exportStar(require("./rules/models"), exports);
|
|
97
97
|
__exportStar(require("./secrets/models"), exports);
|
|
98
|
+
__exportStar(require("./stats/models"), exports);
|
|
98
99
|
__exportStar(require("./softwareUpdates/models"), exports);
|
|
99
100
|
__exportStar(require("./systemCommands/models"), exports);
|
|
100
101
|
__exportStar(require("./systemCommandJobs/models"), exports);
|
package/dist/models.d.ts
CHANGED