@edgeiq/edgeiq-api-js 1.4.12 → 1.4.14
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/README.md +13 -2
- package/dist/__tests__/integrations.test.js +40 -4
- package/dist/deviceTypes/models.d.ts +5 -2
- package/dist/devices/index.d.ts +2 -0
- package/dist/devices/index.js +87 -63
- package/dist/devices/models.d.ts +2 -0
- package/dist/gatewayCommands/models.d.ts +3 -14
- package/dist/integrations/index.d.ts +2 -1
- package/dist/integrations/index.js +24 -0
- package/dist/integrations/models.d.ts +2 -1
- package/dist/models/index.d.ts +0 -18
- package/dist/models.d.ts +4 -0
- package/dist/testConstants.d.ts +1 -0
- package/dist/testConstants.js +12 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,16 @@ $ npm run format
|
|
|
39
39
|
```
|
|
40
40
|
$ npm test
|
|
41
41
|
```
|
|
42
|
-
|
|
42
|
+
- Testing single test file
|
|
43
|
+
```
|
|
44
|
+
$ npm test src/__tests__/<file_name>
|
|
45
|
+
```
|
|
46
|
+
- To test the version locally before publishing:
|
|
47
|
+
. In the `edgeiq-api-js` local copy run `yarn link`
|
|
48
|
+
. In the project local copy, where it is needed to install this version (`eiq30` fro example), run `yarn link @edgeiq/edgeiq-api-js`
|
|
49
|
+
. This will “connect” the two repositories (via a symlink), so `node_modules/@edgeiq/edgeiq-api-js` actually points to your local copy.
|
|
50
|
+
. You can then run `yarn build` in `edgeiq-api-js` and `eiq30` will pick up the changes you did locally, so no need to publish a new SDK to test something
|
|
51
|
+
. These commadns will change the `yarn.lock` and `package.json` of the project where the sdk is being used `eiq30`, to revert that run `yarn unlink @edgeiq/edgeiq-api-js`
|
|
43
52
|
## Publishing:
|
|
44
53
|
|
|
45
54
|
Run:
|
|
@@ -49,7 +58,9 @@ $ npm publish
|
|
|
49
58
|
|
|
50
59
|
## How to use it
|
|
51
60
|
|
|
52
|
-
Install the dependency via the command line.
|
|
61
|
+
- Install the dependency via the command line.
|
|
53
62
|
`npm install --save @edgeiq/edgeiq-api-js`
|
|
54
63
|
# OR
|
|
55
64
|
`yarn add @edgeiq/edgeiq-api-js`
|
|
65
|
+
|
|
66
|
+
This will install the latest version in npm
|
|
@@ -68,6 +68,7 @@ describe('Integrations', function () {
|
|
|
68
68
|
}); });
|
|
69
69
|
var integration = testConstants_1.EmptyIntegration;
|
|
70
70
|
var integration2 = testConstants_1.EmptyIntegration;
|
|
71
|
+
var integration3 = testConstants_1.EmptyIntegration;
|
|
71
72
|
it('Creates an integration', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
72
73
|
var result;
|
|
73
74
|
return __generator(this, function (_a) {
|
|
@@ -96,6 +97,20 @@ describe('Integrations', function () {
|
|
|
96
97
|
}
|
|
97
98
|
});
|
|
98
99
|
}); });
|
|
100
|
+
it('Creates a third integration', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
101
|
+
var result;
|
|
102
|
+
return __generator(this, function (_a) {
|
|
103
|
+
switch (_a.label) {
|
|
104
|
+
case 0: return [4, __1.Integrations.create(testConstants_1.TestIntegration3)];
|
|
105
|
+
case 1:
|
|
106
|
+
result = _a.sent();
|
|
107
|
+
expect(result._id).not.toBeNull();
|
|
108
|
+
expect(result.name).toBe(testConstants_1.TestIntegration3.name);
|
|
109
|
+
integration3 = result;
|
|
110
|
+
return [2];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}); });
|
|
99
114
|
it('Gets integration events', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
100
115
|
var ievFilter, result;
|
|
101
116
|
return __generator(this, function (_a) {
|
|
@@ -115,6 +130,20 @@ describe('Integrations', function () {
|
|
|
115
130
|
}
|
|
116
131
|
});
|
|
117
132
|
}); });
|
|
133
|
+
it('Gets aws thing groups', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
134
|
+
var result;
|
|
135
|
+
return __generator(this, function (_a) {
|
|
136
|
+
switch (_a.label) {
|
|
137
|
+
case 0: return [4, __1.Integrations.getAwsThingGroups(integration3._id)];
|
|
138
|
+
case 1:
|
|
139
|
+
result = _a.sent();
|
|
140
|
+
expect(result).not.toBeNull();
|
|
141
|
+
expect(result).not.toBeUndefined();
|
|
142
|
+
console.log(result);
|
|
143
|
+
return [2];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}); });
|
|
118
147
|
it('Gets the first integration created by _id', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
119
148
|
var result;
|
|
120
149
|
return __generator(this, function (_a) {
|
|
@@ -178,16 +207,16 @@ describe('Integrations', function () {
|
|
|
178
207
|
result = _a.sent();
|
|
179
208
|
expect(result.integrations).toBeDefined();
|
|
180
209
|
expect(result.integrations).toBeInstanceOf(Array);
|
|
181
|
-
expect(result.integrations).toHaveLength(
|
|
210
|
+
expect(result.integrations).toHaveLength(3);
|
|
182
211
|
expect(result.pagination.page).toBe(constants_1.DefaultPagination.page);
|
|
183
|
-
expect(result.pagination.total).toBe(
|
|
212
|
+
expect(result.pagination.total).toBe(3);
|
|
184
213
|
expect(result.pagination.itemsPerPage).toBe(constants_1.DefaultPagination.itemsPerPage);
|
|
185
214
|
return [2];
|
|
186
215
|
}
|
|
187
216
|
});
|
|
188
217
|
}); });
|
|
189
218
|
it('Deletes the integrations created', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
190
|
-
var result, result;
|
|
219
|
+
var result, result, result;
|
|
191
220
|
return __generator(this, function (_a) {
|
|
192
221
|
switch (_a.label) {
|
|
193
222
|
case 0:
|
|
@@ -204,7 +233,14 @@ describe('Integrations', function () {
|
|
|
204
233
|
result = _a.sent();
|
|
205
234
|
expect(result).toBe((0, helpers_1.getReturnDeleteMessage)('integration'));
|
|
206
235
|
_a.label = 4;
|
|
207
|
-
case 4:
|
|
236
|
+
case 4:
|
|
237
|
+
if (!integration3._id) return [3, 6];
|
|
238
|
+
return [4, __1.Integrations.delete(integration3._id)];
|
|
239
|
+
case 5:
|
|
240
|
+
result = _a.sent();
|
|
241
|
+
expect(result).toBe((0, helpers_1.getReturnDeleteMessage)('integration'));
|
|
242
|
+
_a.label = 6;
|
|
243
|
+
case 6: return [2];
|
|
208
244
|
}
|
|
209
245
|
});
|
|
210
246
|
}); });
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AwsThingGroup } from '../models';
|
|
1
2
|
import { Base, Filter, Filters, Pagination } from '../models';
|
|
2
3
|
export declare type TypeDeviceType = 'gateway' | 'sensor' | 'cloud_native' | 'modem' | 'lwm2m';
|
|
3
4
|
export declare type DeviceTypeRole = 'gateway' | 'endpoint';
|
|
@@ -40,8 +41,6 @@ export interface Actions {
|
|
|
40
41
|
greengrass_initialize: boolean;
|
|
41
42
|
greengrass_restart: boolean;
|
|
42
43
|
greengrass_redeploy: boolean;
|
|
43
|
-
amag_add_modify_card_holder: boolean;
|
|
44
|
-
amag_delete_card_holder: boolean;
|
|
45
44
|
activate_cloud_native_device: boolean;
|
|
46
45
|
deactivate_cloud_native_device: boolean;
|
|
47
46
|
lwm2m_request: boolean;
|
|
@@ -93,6 +92,10 @@ export interface DeviceTypeInput {
|
|
|
93
92
|
metadata?: {
|
|
94
93
|
[key: string]: string;
|
|
95
94
|
};
|
|
95
|
+
default_thing_groups?: AwsThingGroup[];
|
|
96
|
+
important_metadata?: string[];
|
|
97
|
+
device_integration_id?: string;
|
|
98
|
+
cloud_native_integration_id?: string;
|
|
96
99
|
}
|
|
97
100
|
export interface DeviceType extends DeviceTypeInput, Base {
|
|
98
101
|
}
|
package/dist/devices/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { BulkActionResponse, PaginationFilter } from '../models';
|
|
|
5
5
|
import { Lwm2mObjectLinks } from '../lwm2m/models';
|
|
6
6
|
import { DevicesFilters, Device, DeviceInput, PaginatedDevices } from './models';
|
|
7
7
|
import { CommandExecutionsFilters, PaginatedCommandExecutions } from '../commandExecutions/models';
|
|
8
|
+
import { AwsThingGroup } from '../models';
|
|
8
9
|
interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, DevicesFilters, PaginatedDevices> {
|
|
9
10
|
bulkCreate(uniqueIds: string[], deviceTypeId: string, namePrefix: string): Promise<BulkActionResponse>;
|
|
10
11
|
update(device: Device): Promise<Device>;
|
|
@@ -17,6 +18,7 @@ interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, Devic
|
|
|
17
18
|
bulkAttachRules(id: string, rulesIds: string[]): Promise<BulkActionResponse>;
|
|
18
19
|
detachRule(id: string, ruleId: string): Promise<string>;
|
|
19
20
|
getRules(id: string): Promise<Rule[]>;
|
|
21
|
+
getAwsThingGroups(id: string): Promise<AwsThingGroup[]>;
|
|
20
22
|
getCommands(id: string): Promise<Command[]>;
|
|
21
23
|
csvBulkUpload(file: File): Promise<BulkActionResponse>;
|
|
22
24
|
csvBulkDownload(filters?: DevicesFilters): Promise<File>;
|
package/dist/devices/index.js
CHANGED
|
@@ -464,16 +464,16 @@ exports.Devices = (function (_super) {
|
|
|
464
464
|
});
|
|
465
465
|
});
|
|
466
466
|
};
|
|
467
|
-
class_1.
|
|
467
|
+
class_1.getAwsThingGroups = function (id) {
|
|
468
468
|
return __awaiter(this, void 0, void 0, function () {
|
|
469
469
|
var axios, result, error_16;
|
|
470
470
|
return __generator(this, function (_a) {
|
|
471
471
|
switch (_a.label) {
|
|
472
472
|
case 0:
|
|
473
473
|
_a.trys.push([0, 2, , 3]);
|
|
474
|
-
this.logAction("Getting
|
|
474
|
+
this.logAction("Getting AWS thing groups for device with id: " + id);
|
|
475
475
|
axios = __1.EdgeIQAPI.getAxios();
|
|
476
|
-
return [4, axios.get(constants_1.Endpoints.device + "/" + id + "/"
|
|
476
|
+
return [4, axios.get(constants_1.Endpoints.device + "/" + id + "/aws_thing_groups")];
|
|
477
477
|
case 1:
|
|
478
478
|
result = _a.sent();
|
|
479
479
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
@@ -488,9 +488,33 @@ exports.Devices = (function (_super) {
|
|
|
488
488
|
});
|
|
489
489
|
});
|
|
490
490
|
};
|
|
491
|
+
class_1.getCommands = function (id) {
|
|
492
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
493
|
+
var axios, result, error_17;
|
|
494
|
+
return __generator(this, function (_a) {
|
|
495
|
+
switch (_a.label) {
|
|
496
|
+
case 0:
|
|
497
|
+
_a.trys.push([0, 2, , 3]);
|
|
498
|
+
this.logAction("Getting commands attached to device with id " + id);
|
|
499
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
500
|
+
return [4, axios.get(constants_1.Endpoints.device + "/" + id + "/" + constants_1.Endpoints.command)];
|
|
501
|
+
case 1:
|
|
502
|
+
result = _a.sent();
|
|
503
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
504
|
+
case 2:
|
|
505
|
+
error_17 = _a.sent();
|
|
506
|
+
if ((0, helpers_1.isApiError)(error_17)) {
|
|
507
|
+
throw error_17;
|
|
508
|
+
}
|
|
509
|
+
throw error_17;
|
|
510
|
+
case 3: return [2];
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
});
|
|
514
|
+
};
|
|
491
515
|
class_1.csvBulkUpload = function (file) {
|
|
492
516
|
return __awaiter(this, void 0, void 0, function () {
|
|
493
|
-
var axios, form, result,
|
|
517
|
+
var axios, form, result, error_18;
|
|
494
518
|
return __generator(this, function (_a) {
|
|
495
519
|
switch (_a.label) {
|
|
496
520
|
case 0:
|
|
@@ -508,11 +532,11 @@ exports.Devices = (function (_super) {
|
|
|
508
532
|
result = _a.sent();
|
|
509
533
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
510
534
|
case 2:
|
|
511
|
-
|
|
512
|
-
if ((0, helpers_1.isApiError)(
|
|
513
|
-
throw
|
|
535
|
+
error_18 = _a.sent();
|
|
536
|
+
if ((0, helpers_1.isApiError)(error_18)) {
|
|
537
|
+
throw error_18;
|
|
514
538
|
}
|
|
515
|
-
throw
|
|
539
|
+
throw error_18;
|
|
516
540
|
case 3: return [2];
|
|
517
541
|
}
|
|
518
542
|
});
|
|
@@ -520,7 +544,7 @@ exports.Devices = (function (_super) {
|
|
|
520
544
|
};
|
|
521
545
|
class_1.csvBulkDownload = function (filters) {
|
|
522
546
|
return __awaiter(this, void 0, void 0, function () {
|
|
523
|
-
var axios, result,
|
|
547
|
+
var axios, result, error_19;
|
|
524
548
|
return __generator(this, function (_a) {
|
|
525
549
|
switch (_a.label) {
|
|
526
550
|
case 0:
|
|
@@ -534,11 +558,11 @@ exports.Devices = (function (_super) {
|
|
|
534
558
|
result = _a.sent();
|
|
535
559
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
536
560
|
case 2:
|
|
537
|
-
|
|
538
|
-
if ((0, helpers_1.isApiError)(
|
|
539
|
-
throw
|
|
561
|
+
error_19 = _a.sent();
|
|
562
|
+
if ((0, helpers_1.isApiError)(error_19)) {
|
|
563
|
+
throw error_19;
|
|
540
564
|
}
|
|
541
|
-
throw
|
|
565
|
+
throw error_19;
|
|
542
566
|
case 3: return [2];
|
|
543
567
|
}
|
|
544
568
|
});
|
|
@@ -546,7 +570,7 @@ exports.Devices = (function (_super) {
|
|
|
546
570
|
};
|
|
547
571
|
class_1.getLogs = function (id) {
|
|
548
572
|
return __awaiter(this, void 0, void 0, function () {
|
|
549
|
-
var axios, result,
|
|
573
|
+
var axios, result, error_20;
|
|
550
574
|
return __generator(this, function (_a) {
|
|
551
575
|
switch (_a.label) {
|
|
552
576
|
case 0:
|
|
@@ -558,11 +582,11 @@ exports.Devices = (function (_super) {
|
|
|
558
582
|
result = _a.sent();
|
|
559
583
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
560
584
|
case 2:
|
|
561
|
-
|
|
562
|
-
if ((0, helpers_1.isApiError)(
|
|
563
|
-
throw
|
|
585
|
+
error_20 = _a.sent();
|
|
586
|
+
if ((0, helpers_1.isApiError)(error_20)) {
|
|
587
|
+
throw error_20;
|
|
564
588
|
}
|
|
565
|
-
throw
|
|
589
|
+
throw error_20;
|
|
566
590
|
case 3: return [2];
|
|
567
591
|
}
|
|
568
592
|
});
|
|
@@ -570,7 +594,7 @@ exports.Devices = (function (_super) {
|
|
|
570
594
|
};
|
|
571
595
|
class_1.requestLogs = function (id) {
|
|
572
596
|
return __awaiter(this, void 0, void 0, function () {
|
|
573
|
-
var axios, result,
|
|
597
|
+
var axios, result, error_21;
|
|
574
598
|
return __generator(this, function (_a) {
|
|
575
599
|
switch (_a.label) {
|
|
576
600
|
case 0:
|
|
@@ -585,11 +609,11 @@ exports.Devices = (function (_super) {
|
|
|
585
609
|
result = _a.sent();
|
|
586
610
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
587
611
|
case 2:
|
|
588
|
-
|
|
589
|
-
if ((0, helpers_1.isApiError)(
|
|
590
|
-
throw
|
|
612
|
+
error_21 = _a.sent();
|
|
613
|
+
if ((0, helpers_1.isApiError)(error_21)) {
|
|
614
|
+
throw error_21;
|
|
591
615
|
}
|
|
592
|
-
throw
|
|
616
|
+
throw error_21;
|
|
593
617
|
case 3: return [2];
|
|
594
618
|
}
|
|
595
619
|
});
|
|
@@ -597,7 +621,7 @@ exports.Devices = (function (_super) {
|
|
|
597
621
|
};
|
|
598
622
|
class_1.deviceLwm2mObjetLinks = function (id) {
|
|
599
623
|
return __awaiter(this, void 0, void 0, function () {
|
|
600
|
-
var axios, result,
|
|
624
|
+
var axios, result, error_22;
|
|
601
625
|
return __generator(this, function (_a) {
|
|
602
626
|
switch (_a.label) {
|
|
603
627
|
case 0:
|
|
@@ -609,11 +633,11 @@ exports.Devices = (function (_super) {
|
|
|
609
633
|
result = _a.sent();
|
|
610
634
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
611
635
|
case 2:
|
|
612
|
-
|
|
613
|
-
if ((0, helpers_1.isApiError)(
|
|
614
|
-
throw
|
|
636
|
+
error_22 = _a.sent();
|
|
637
|
+
if ((0, helpers_1.isApiError)(error_22)) {
|
|
638
|
+
throw error_22;
|
|
615
639
|
}
|
|
616
|
-
throw
|
|
640
|
+
throw error_22;
|
|
617
641
|
case 3: return [2];
|
|
618
642
|
}
|
|
619
643
|
});
|
|
@@ -621,7 +645,7 @@ exports.Devices = (function (_super) {
|
|
|
621
645
|
};
|
|
622
646
|
class_1.processGatewayCommand = function (deviceId, gatewayCommandRequest) {
|
|
623
647
|
return __awaiter(this, void 0, void 0, function () {
|
|
624
|
-
var axios, data, result,
|
|
648
|
+
var axios, data, result, error_23;
|
|
625
649
|
return __generator(this, function (_a) {
|
|
626
650
|
switch (_a.label) {
|
|
627
651
|
case 0:
|
|
@@ -634,11 +658,11 @@ exports.Devices = (function (_super) {
|
|
|
634
658
|
result = _a.sent();
|
|
635
659
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
636
660
|
case 2:
|
|
637
|
-
|
|
638
|
-
if ((0, helpers_1.isApiError)(
|
|
639
|
-
throw
|
|
661
|
+
error_23 = _a.sent();
|
|
662
|
+
if ((0, helpers_1.isApiError)(error_23)) {
|
|
663
|
+
throw error_23;
|
|
640
664
|
}
|
|
641
|
-
throw
|
|
665
|
+
throw error_23;
|
|
642
666
|
case 3: return [2];
|
|
643
667
|
}
|
|
644
668
|
});
|
|
@@ -646,7 +670,7 @@ exports.Devices = (function (_super) {
|
|
|
646
670
|
};
|
|
647
671
|
class_1.bulkExecuteGatewayCommand = function (ids, gatewayCommandRequest, generateChildCommandExecutions) {
|
|
648
672
|
return __awaiter(this, void 0, void 0, function () {
|
|
649
|
-
var axios, result,
|
|
673
|
+
var axios, result, error_24;
|
|
650
674
|
return __generator(this, function (_a) {
|
|
651
675
|
switch (_a.label) {
|
|
652
676
|
case 0:
|
|
@@ -658,11 +682,11 @@ exports.Devices = (function (_super) {
|
|
|
658
682
|
result = _a.sent();
|
|
659
683
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
660
684
|
case 2:
|
|
661
|
-
|
|
662
|
-
if ((0, helpers_1.isApiError)(
|
|
663
|
-
throw
|
|
685
|
+
error_24 = _a.sent();
|
|
686
|
+
if ((0, helpers_1.isApiError)(error_24)) {
|
|
687
|
+
throw error_24;
|
|
664
688
|
}
|
|
665
|
-
throw
|
|
689
|
+
throw error_24;
|
|
666
690
|
case 3: return [2];
|
|
667
691
|
}
|
|
668
692
|
});
|
|
@@ -670,7 +694,7 @@ exports.Devices = (function (_super) {
|
|
|
670
694
|
};
|
|
671
695
|
class_1.bulkExecuteCommand = function (commandId, ids, options, generateChildCommandExecutions) {
|
|
672
696
|
return __awaiter(this, void 0, void 0, function () {
|
|
673
|
-
var axios, data, result,
|
|
697
|
+
var axios, data, result, error_25;
|
|
674
698
|
return __generator(this, function (_a) {
|
|
675
699
|
switch (_a.label) {
|
|
676
700
|
case 0:
|
|
@@ -687,11 +711,11 @@ exports.Devices = (function (_super) {
|
|
|
687
711
|
result = _a.sent();
|
|
688
712
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
689
713
|
case 2:
|
|
690
|
-
|
|
691
|
-
if ((0, helpers_1.isApiError)(
|
|
692
|
-
throw
|
|
714
|
+
error_25 = _a.sent();
|
|
715
|
+
if ((0, helpers_1.isApiError)(error_25)) {
|
|
716
|
+
throw error_25;
|
|
693
717
|
}
|
|
694
|
-
throw
|
|
718
|
+
throw error_25;
|
|
695
719
|
case 3: return [2];
|
|
696
720
|
}
|
|
697
721
|
});
|
|
@@ -699,7 +723,7 @@ exports.Devices = (function (_super) {
|
|
|
699
723
|
};
|
|
700
724
|
class_1.getFiles = function (id) {
|
|
701
725
|
return __awaiter(this, void 0, void 0, function () {
|
|
702
|
-
var axios, result,
|
|
726
|
+
var axios, result, error_26;
|
|
703
727
|
return __generator(this, function (_a) {
|
|
704
728
|
switch (_a.label) {
|
|
705
729
|
case 0:
|
|
@@ -711,11 +735,11 @@ exports.Devices = (function (_super) {
|
|
|
711
735
|
result = _a.sent();
|
|
712
736
|
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
713
737
|
case 2:
|
|
714
|
-
|
|
715
|
-
if ((0, helpers_1.isApiError)(
|
|
716
|
-
throw
|
|
738
|
+
error_26 = _a.sent();
|
|
739
|
+
if ((0, helpers_1.isApiError)(error_26)) {
|
|
740
|
+
throw error_26;
|
|
717
741
|
}
|
|
718
|
-
throw
|
|
742
|
+
throw error_26;
|
|
719
743
|
case 3: return [2];
|
|
720
744
|
}
|
|
721
745
|
});
|
|
@@ -724,7 +748,7 @@ exports.Devices = (function (_super) {
|
|
|
724
748
|
class_1.getCommandExecutions = function (id, filters, pagination) {
|
|
725
749
|
var _a, _b, _c, _d;
|
|
726
750
|
return __awaiter(this, void 0, void 0, function () {
|
|
727
|
-
var axios, result,
|
|
751
|
+
var axios, result, error_27;
|
|
728
752
|
return __generator(this, function (_e) {
|
|
729
753
|
switch (_e.label) {
|
|
730
754
|
case 0:
|
|
@@ -745,11 +769,11 @@ exports.Devices = (function (_super) {
|
|
|
745
769
|
},
|
|
746
770
|
}];
|
|
747
771
|
case 2:
|
|
748
|
-
|
|
749
|
-
if ((0, helpers_1.isApiError)(
|
|
750
|
-
throw
|
|
772
|
+
error_27 = _e.sent();
|
|
773
|
+
if ((0, helpers_1.isApiError)(error_27)) {
|
|
774
|
+
throw error_27;
|
|
751
775
|
}
|
|
752
|
-
throw
|
|
776
|
+
throw error_27;
|
|
753
777
|
case 3: return [2];
|
|
754
778
|
}
|
|
755
779
|
});
|
|
@@ -757,7 +781,7 @@ exports.Devices = (function (_super) {
|
|
|
757
781
|
};
|
|
758
782
|
class_1.startRemoteTerminal = function (id, executable) {
|
|
759
783
|
return __awaiter(this, void 0, void 0, function () {
|
|
760
|
-
var axios,
|
|
784
|
+
var axios, error_28;
|
|
761
785
|
return __generator(this, function (_a) {
|
|
762
786
|
switch (_a.label) {
|
|
763
787
|
case 0:
|
|
@@ -771,11 +795,11 @@ exports.Devices = (function (_super) {
|
|
|
771
795
|
_a.sent();
|
|
772
796
|
return [2, "Remote terminal started for device: " + id];
|
|
773
797
|
case 2:
|
|
774
|
-
|
|
775
|
-
if ((0, helpers_1.isApiError)(
|
|
776
|
-
throw
|
|
798
|
+
error_28 = _a.sent();
|
|
799
|
+
if ((0, helpers_1.isApiError)(error_28)) {
|
|
800
|
+
throw error_28;
|
|
777
801
|
}
|
|
778
|
-
throw
|
|
802
|
+
throw error_28;
|
|
779
803
|
case 3: return [2];
|
|
780
804
|
}
|
|
781
805
|
});
|
|
@@ -783,7 +807,7 @@ exports.Devices = (function (_super) {
|
|
|
783
807
|
};
|
|
784
808
|
class_1.stopRemoteTerminal = function (id) {
|
|
785
809
|
return __awaiter(this, void 0, void 0, function () {
|
|
786
|
-
var axios,
|
|
810
|
+
var axios, error_29;
|
|
787
811
|
return __generator(this, function (_a) {
|
|
788
812
|
switch (_a.label) {
|
|
789
813
|
case 0:
|
|
@@ -795,11 +819,11 @@ exports.Devices = (function (_super) {
|
|
|
795
819
|
_a.sent();
|
|
796
820
|
return [2, "Remote terminal stoped for device: " + id];
|
|
797
821
|
case 2:
|
|
798
|
-
|
|
799
|
-
if ((0, helpers_1.isApiError)(
|
|
800
|
-
throw
|
|
822
|
+
error_29 = _a.sent();
|
|
823
|
+
if ((0, helpers_1.isApiError)(error_29)) {
|
|
824
|
+
throw error_29;
|
|
801
825
|
}
|
|
802
|
-
throw
|
|
826
|
+
throw error_29;
|
|
803
827
|
case 3: return [2];
|
|
804
828
|
}
|
|
805
829
|
});
|
package/dist/devices/models.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ export interface Device extends DeviceInput, Base {
|
|
|
84
84
|
lwm2m_server_psk_secret_id?: string;
|
|
85
85
|
lwm2m_bootstrap_psk_hash?: string;
|
|
86
86
|
lwm2m_server_psk_hash?: string;
|
|
87
|
+
password_change_in_progress?: boolean;
|
|
87
88
|
}
|
|
88
89
|
export interface DevicesFilters extends Filters {
|
|
89
90
|
device_online?: Filter;
|
|
@@ -123,6 +124,7 @@ export interface DevicesFilters extends Filters {
|
|
|
123
124
|
[key: string]: Filter;
|
|
124
125
|
};
|
|
125
126
|
parent_device_id?: Filter;
|
|
127
|
+
ancestor_company_id?: string;
|
|
126
128
|
}
|
|
127
129
|
export interface PaginatedDevices {
|
|
128
130
|
devices: Device[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Base, Filter, Filters, Pagination } from '../models';
|
|
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' | 'setting' | 'software_update' | 'status';
|
|
2
|
+
export declare type GatewayCommandType = 'activate_cloud_native_device' | 'backup' | 'data_restriction' | 'deactivate_cloud_native_device' | 'disable_data_restriction' | 'enable_data_restriction' | 'greengrass_initialize' | 'awsiot_attach_thing_groups' | 'awsiot_detach_thing_groups' | 'cancel_password_change' | 'heartbeat' | 'log_level' | 'log_upload' | 'lwm2m_request' | 'lwm2m_file' | 'restore_backup' | 'reboot' | 'reset' | 'send_config' | 'setting' | 'software_update' | 'status';
|
|
3
3
|
export declare type CommandType = 'download' | 'fileupload' | 'filedownload' | 'execute' | 'observe' | 'observe_stop' | 'read' | 'upload' | 'write';
|
|
4
4
|
export interface CommandSchedule {
|
|
5
5
|
start_datetime: string;
|
|
@@ -22,7 +22,6 @@ export interface GatewayCommandRequest {
|
|
|
22
22
|
when?: string;
|
|
23
23
|
level?: string;
|
|
24
24
|
enable?: boolean;
|
|
25
|
-
card_holder?: AmagCardHolder;
|
|
26
25
|
attached_device_ids?: string[];
|
|
27
26
|
data?: unknown;
|
|
28
27
|
type?: CommandType;
|
|
@@ -34,18 +33,8 @@ export interface Lwm2mRequest extends GatewayCommandRequest {
|
|
|
34
33
|
filepath?: string;
|
|
35
34
|
file_id?: string;
|
|
36
35
|
}
|
|
37
|
-
export interface
|
|
38
|
-
|
|
39
|
-
last_name?: string;
|
|
40
|
-
card_number?: number;
|
|
41
|
-
pin?: string;
|
|
42
|
-
employee_reference?: string;
|
|
43
|
-
company_id?: number;
|
|
44
|
-
customer_code?: number;
|
|
45
|
-
access_code_id?: number;
|
|
46
|
-
active_date?: string;
|
|
47
|
-
expiry_date?: string;
|
|
48
|
-
personal_data: string[];
|
|
36
|
+
export interface AwsIotThingGroupRequest extends GatewayCommandRequest {
|
|
37
|
+
thing_group_arns: string[];
|
|
49
38
|
}
|
|
50
39
|
export interface GatewayCommandInput {
|
|
51
40
|
command_type: GatewayCommandType;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { BaseModelInterface } from '../core/ModelClass';
|
|
2
|
-
import { BulkActionResponse, PaginationFilter } from '../models';
|
|
2
|
+
import { AwsThingGroup, BulkActionResponse, PaginationFilter } from '../models';
|
|
3
3
|
import { Integration, IntegrationInput, IntegrationsFilters, IntegrationEventsFilters, PaginatedIntegrations, PaginatedIntegrationEvents } from './models';
|
|
4
4
|
interface IntegrationsInterface extends BaseModelInterface<Integration, IntegrationInput, IntegrationsFilters, PaginatedIntegrations> {
|
|
5
5
|
deleteMultiple(ids: string[]): Promise<BulkActionResponse>;
|
|
6
6
|
update(integration: Integration): Promise<Integration>;
|
|
7
7
|
listIntegrationEvents(filters?: IntegrationEventsFilters, pagination?: PaginationFilter): Promise<PaginatedIntegrationEvents>;
|
|
8
|
+
getAwsThingGroups(id: string): Promise<AwsThingGroup[]>;
|
|
8
9
|
}
|
|
9
10
|
export declare const Integrations: IntegrationsInterface;
|
|
10
11
|
export {};
|
|
@@ -271,6 +271,30 @@ exports.Integrations = (function (_super) {
|
|
|
271
271
|
});
|
|
272
272
|
});
|
|
273
273
|
};
|
|
274
|
+
class_1.getAwsThingGroups = function (id) {
|
|
275
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
276
|
+
var axios, result, error_8;
|
|
277
|
+
return __generator(this, function (_a) {
|
|
278
|
+
switch (_a.label) {
|
|
279
|
+
case 0:
|
|
280
|
+
_a.trys.push([0, 2, , 3]);
|
|
281
|
+
this.logAction("Getting AWS thing groups for integration with id: " + id);
|
|
282
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
283
|
+
return [4, axios.get(constants_1.Endpoints.integration + "/" + id + "/aws_thing_groups")];
|
|
284
|
+
case 1:
|
|
285
|
+
result = _a.sent();
|
|
286
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
287
|
+
case 2:
|
|
288
|
+
error_8 = _a.sent();
|
|
289
|
+
if ((0, helpers_1.isApiError)(error_8)) {
|
|
290
|
+
throw error_8;
|
|
291
|
+
}
|
|
292
|
+
throw error_8;
|
|
293
|
+
case 3: return [2];
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
};
|
|
274
298
|
return class_1;
|
|
275
299
|
}(ModelClass_1.BaseModelClass));
|
|
276
300
|
var checkRequiredValuesByType = function (integraion) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Base, Filter, Filters, Pagination } from '../models';
|
|
2
2
|
export declare type IntegrationType = 'aws_device_integrations' | 'azure_device_integrations' | 'gcp_cloud_native_device_integrations' | 'gs_cloud_native_device_integrations' | 'inmarsat_cloud_native_device_integrations' | 'orbcomm_cloud_native_device_integrations' | 'postmark_rule_action_integrations' | 'smtp_rule_action_integrations' | 'twilio_rule_action_integrations';
|
|
3
|
+
export declare type GreengrassVersion = '' | 'v1' | 'v2';
|
|
3
4
|
export interface IntegrationInput {
|
|
4
5
|
name: string;
|
|
5
6
|
company_id: string;
|
|
@@ -29,7 +30,7 @@ export interface IntegrationInput {
|
|
|
29
30
|
role_arn?: string;
|
|
30
31
|
device_gateway_url?: string;
|
|
31
32
|
greengrass_core_install_url?: string;
|
|
32
|
-
greengrass_version?:
|
|
33
|
+
greengrass_version?: GreengrassVersion;
|
|
33
34
|
iot_hub_hostname?: string;
|
|
34
35
|
shared_access_key?: string;
|
|
35
36
|
access_policy_name?: string;
|
package/dist/models/index.d.ts
CHANGED
|
@@ -138,8 +138,6 @@ export interface Action {
|
|
|
138
138
|
greengrass_initialize: AbilityType;
|
|
139
139
|
greengrass_restart: AbilityType;
|
|
140
140
|
greengrass_redeploy: AbilityType;
|
|
141
|
-
amag_add_modify_card_holder: AbilityType;
|
|
142
|
-
amag_delete_card_holder: AbilityType;
|
|
143
141
|
activate_cloud_native_device: AbilityType;
|
|
144
142
|
deactivate_cloud_native_device: AbilityType;
|
|
145
143
|
lwm2m_request: AbilityType;
|
|
@@ -189,8 +187,6 @@ export interface Actions {
|
|
|
189
187
|
greengrass_initialize: boolean;
|
|
190
188
|
greengrass_restart: boolean;
|
|
191
189
|
greengrass_redeploy: boolean;
|
|
192
|
-
amag_add_modify_card_holder: boolean;
|
|
193
|
-
amag_delete_card_holder: boolean;
|
|
194
190
|
activate_cloud_native_device: boolean;
|
|
195
191
|
deactivate_cloud_native_device: boolean;
|
|
196
192
|
lwm2m_request: boolean;
|
|
@@ -223,19 +219,6 @@ export interface ActionTypeDescription {
|
|
|
223
219
|
edge: boolean;
|
|
224
220
|
cloud: boolean;
|
|
225
221
|
}
|
|
226
|
-
export interface AmagCardHolder {
|
|
227
|
-
first_name?: string;
|
|
228
|
-
last_name?: string;
|
|
229
|
-
card_number?: number;
|
|
230
|
-
pin?: string;
|
|
231
|
-
employee_reference?: string;
|
|
232
|
-
company_id?: number;
|
|
233
|
-
customer_code?: number;
|
|
234
|
-
access_code_id?: number;
|
|
235
|
-
active_date?: string;
|
|
236
|
-
expiry_date?: string;
|
|
237
|
-
personal_data: string[];
|
|
238
|
-
}
|
|
239
222
|
export interface Application {
|
|
240
223
|
name: string;
|
|
241
224
|
description: string;
|
|
@@ -976,7 +959,6 @@ export interface GatewayCommandRequest {
|
|
|
976
959
|
when?: string;
|
|
977
960
|
level?: string;
|
|
978
961
|
enable?: boolean;
|
|
979
|
-
card_holder?: AmagCardHolder;
|
|
980
962
|
attached_device_ids?: string[];
|
|
981
963
|
_: string[];
|
|
982
964
|
}
|
package/dist/models.d.ts
CHANGED
package/dist/testConstants.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare const NewTestDeviceTypeName = "API Test Device Type updated";
|
|
|
27
27
|
export declare const EmptyIntegration: Integration;
|
|
28
28
|
export declare const TestIntegration: IntegrationInput;
|
|
29
29
|
export declare const TestIntegration2: IntegrationInput;
|
|
30
|
+
export declare const TestIntegration3: IntegrationInput;
|
|
30
31
|
export declare const NewIntegrationName = "EIQSDK Integration Test Twilio";
|
|
31
32
|
export declare const EmptyIngestor: Ingestor;
|
|
32
33
|
export declare const TestIngestor: IngestorInput;
|
package/dist/testConstants.js
CHANGED
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.TestFile = exports.EmptyNotificationType = exports.TestCommand = exports.TestDiscoveredDevice = exports.NewTestRuleDescription = exports.TestRule2 = exports.TestRule = exports.EmptyRule = exports.NewTestTranslatorName = exports.TestTranslator2 = exports.TestTranslator = exports.EmptyTranslator = exports.NewTestPollableAttributeName = exports.TestPollableAttribute2 = exports.TestPollableAttribute = exports.EmptyPollableAttribute = exports.NewTestIngestorName = exports.TestIngestor2 = exports.TestIngestor = exports.EmptyIngestor = exports.NewIntegrationName = exports.TestIntegration2 = exports.TestIntegration = exports.EmptyIntegration = exports.NewTestDeviceTypeName = exports.TestDeviceType2 = exports.TestDeviceType = exports.EmptyDeviceType = exports.NewTestCompanyName = exports.TestCompany2 = exports.TestCompany = exports.EmptyCompany = exports.NewTestUserName = exports.EmptyUser = exports.TestUser2 = exports.TestUser = exports.NewTestDeviceName = exports.EmptyDevice = exports.TestDevice2 = exports.TestDevice = exports.TestAuth = exports.stageURL = void 0;
|
|
14
|
+
exports.TestFile = exports.EmptyNotificationType = exports.TestCommand = exports.TestDiscoveredDevice = exports.NewTestRuleDescription = exports.TestRule2 = exports.TestRule = exports.EmptyRule = exports.NewTestTranslatorName = exports.TestTranslator2 = exports.TestTranslator = exports.EmptyTranslator = exports.NewTestPollableAttributeName = exports.TestPollableAttribute2 = exports.TestPollableAttribute = exports.EmptyPollableAttribute = exports.NewTestIngestorName = exports.TestIngestor2 = exports.TestIngestor = exports.EmptyIngestor = exports.NewIntegrationName = exports.TestIntegration3 = exports.TestIntegration2 = exports.TestIntegration = exports.EmptyIntegration = exports.NewTestDeviceTypeName = exports.TestDeviceType2 = exports.TestDeviceType = exports.EmptyDeviceType = exports.NewTestCompanyName = exports.TestCompany2 = exports.TestCompany = exports.EmptyCompany = exports.NewTestUserName = exports.EmptyUser = exports.TestUser2 = exports.TestUser = exports.NewTestDeviceName = exports.EmptyDevice = exports.TestDevice2 = exports.TestDevice = exports.TestAuth = exports.stageURL = void 0;
|
|
15
15
|
var _1 = require(".");
|
|
16
16
|
exports.stageURL = {
|
|
17
17
|
url: 'https://api.stage.edgeiq.io/api/v1/platform/',
|
|
@@ -157,6 +157,17 @@ exports.TestIntegration2 = {
|
|
|
157
157
|
token: 'test_token',
|
|
158
158
|
from: 'test_from',
|
|
159
159
|
};
|
|
160
|
+
exports.TestIntegration3 = {
|
|
161
|
+
archetype: 'device',
|
|
162
|
+
company_id: parentCompanyId,
|
|
163
|
+
name: 'EIQSDK Integration Test',
|
|
164
|
+
type: 'aws_device_integrations',
|
|
165
|
+
region: 'us-east-1',
|
|
166
|
+
greengrass_core_install_url: 'https://d2s8p88vqu9w66.cloudfront.net/releases/greengrass-nucleus-latest.zip',
|
|
167
|
+
greengrass_version: 'v2',
|
|
168
|
+
role_arn: 'arn:aws:iam::814871568377:role/EdgeGreengrassV2-iotRole-YKSZSX7XWTJX',
|
|
169
|
+
external_id: 'machine2022',
|
|
170
|
+
};
|
|
160
171
|
exports.NewIntegrationName = 'EIQSDK Integration Test Twilio';
|
|
161
172
|
exports.EmptyIngestor = __assign(__assign({}, baseModel), { company_id: '', name: '', type: 'edge', listener_type: 'shell_polling', handler_type: 'fixed', translator_id: '', listener: {
|
|
162
173
|
version: '1',
|