@edgeiq/edgeiq-api-js 1.3.18 → 1.3.21

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.
@@ -104,7 +104,7 @@ export declare const Endpoints: {
104
104
  deviceTemplate: string;
105
105
  deviceType: string;
106
106
  device: string;
107
- diviceLwm2mObjetLinks: string;
107
+ deviceLwm2mObjetLinks: string;
108
108
  deviceLocationObservation: string;
109
109
  downstreamSystem: string;
110
110
  discoveredDevice: string;
package/dist/constants.js CHANGED
@@ -120,7 +120,7 @@ exports.Endpoints = {
120
120
  deviceTemplate: "" + exports.BaseEndpoints.deviceTemplate,
121
121
  deviceType: "" + exports.BaseEndpoints.deviceType,
122
122
  device: "" + exports.BaseEndpoints.device,
123
- diviceLwm2mObjetLinks: "" + exports.BaseEndpoints.lwm2mObjectLinks,
123
+ deviceLwm2mObjetLinks: "" + exports.BaseEndpoints.lwm2mObjectLinks,
124
124
  deviceLocationObservation: "" + exports.BaseEndpoints.deviceLocationObservation,
125
125
  downstreamSystem: "" + exports.BaseEndpoints.downstreamSystem,
126
126
  discoveredDevice: "" + exports.BaseEndpoints.discoveredDevice,
@@ -1,7 +1,7 @@
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
7
  import { DevicesFilters, Device, DeviceInput, PaginatedDevices } from './models';
@@ -22,7 +22,9 @@ interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, Devic
22
22
  csvBulkDownload(filters?: DevicesFilters): Promise<File>;
23
23
  getLogs(id: string): Promise<Log[]>;
24
24
  requestLogs(id: string): Promise<GatewayCommand>;
25
- diviceLwm2mObjetLinks(id: string): Promise<Lwm2mObjectLinks[]>;
25
+ deviceLwm2mObjetLinks(id: string): Promise<Lwm2mObjectLinks[]>;
26
+ processGatewayCommand(deviceId: string, gatewayCommandRequest: GatewayCommandRequest): Promise<GatewayCommand>;
27
+ bulkExecuteGatewayCommand(ids: string[], gatewayCommandRequest: GatewayCommandRequest): Promise<BulkActionResponse>;
26
28
  }
27
29
  export declare const Devices: DevicesInterface;
28
30
  export {};
@@ -584,7 +584,7 @@ exports.Devices = (function (_super) {
584
584
  });
585
585
  });
586
586
  };
587
- class_1.diviceLwm2mObjetLinks = function (id) {
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.diviceLwm2mObjetLinks)];
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,57 @@ 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
+ };
611
663
  return class_1;
612
664
  }(ModelClass_1.BaseModelClass));
@@ -2,7 +2,6 @@ import { BaseModelInterface } from '../core/ModelClass';
2
2
  import { BulkActionResponse } from '../models';
3
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
7
  }
@@ -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, error_3;
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
- error_3 = _a.sent();
143
- if ((0, helpers_1.isApiError)(error_3)) {
144
- throw error_3;
105
+ error_2 = _a.sent();
106
+ if ((0, helpers_1.isApiError)(error_2)) {
107
+ throw error_2;
145
108
  }
146
- throw error_3;
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, error_4;
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
- error_4 = _e.sent();
177
- if ((0, helpers_1.isApiError)(error_4)) {
178
- throw error_4;
139
+ error_3 = _e.sent();
140
+ if ((0, helpers_1.isApiError)(error_3)) {
141
+ throw error_3;
179
142
  }
180
- throw error_4;
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, error_5;
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
- error_5 = _a.sent();
201
- if ((0, helpers_1.isApiError)(error_5)) {
202
- throw error_5;
163
+ error_4 = _a.sent();
164
+ if ((0, helpers_1.isApiError)(error_4)) {
165
+ throw error_4;
203
166
  }
204
- throw error_5;
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, error_6;
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
- error_6 = _a.sent();
225
- if ((0, helpers_1.isApiError)(error_6)) {
226
- throw error_6;
187
+ error_5 = _a.sent();
188
+ if ((0, helpers_1.isApiError)(error_5)) {
189
+ throw error_5;
227
190
  }
228
- throw error_6;
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, error_7;
199
+ var axios, result, error_6;
237
200
  return __generator(this, function (_a) {
238
201
  switch (_a.label) {
239
202
  case 0:
@@ -247,11 +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
- error_7 = _a.sent();
251
- if ((0, helpers_1.isApiError)(error_7)) {
252
- throw error_7;
213
+ error_6 = _a.sent();
214
+ if ((0, helpers_1.isApiError)(error_6)) {
215
+ throw error_6;
253
216
  }
254
- throw error_7;
217
+ throw error_6;
255
218
  case 3: return [2];
256
219
  }
257
220
  });
@@ -1,5 +1,6 @@
1
1
  import { Base, Filter, Filters, Pagination } from '../models';
2
- export declare type GatewayCommandType = 'send_config' | 'data_restriction' | 'backup' | 'restore_backup' | 'log_level' | 'log_upload' | 'reboot' | 'heartbeat' | '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' | '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,6 +10,38 @@ export interface GatewayCommandStatus {
9
10
  status: string;
10
11
  status_message?: string;
11
12
  }
13
+ export interface GatewayCommandRequest {
14
+ command_type: GatewayCommandType;
15
+ schedule?: CommandSchedule;
16
+ timeout?: number;
17
+ url?: string;
18
+ version?: string;
19
+ software_update_id?: string;
20
+ when?: string;
21
+ level?: string;
22
+ enable?: boolean;
23
+ card_holder?: AmagCardHolder;
24
+ attached_device_ids?: string[];
25
+ data?: unknown;
26
+ type?: CommandType;
27
+ }
28
+ export interface Lwm2mRequest extends GatewayCommandRequest {
29
+ type: CommandType;
30
+ endpoint: string;
31
+ }
32
+ export interface AmagCardHolder {
33
+ first_name?: string;
34
+ last_name?: string;
35
+ card_number?: number;
36
+ pin?: string;
37
+ employee_reference?: string;
38
+ company_id?: number;
39
+ customer_code?: number;
40
+ access_code_id?: number;
41
+ active_date?: string;
42
+ expiry_date?: string;
43
+ personal_data: string[];
44
+ }
12
45
  export interface GatewayCommandInput {
13
46
  command_type: GatewayCommandType;
14
47
  payload: {
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.DeviceErrors = 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.Lwm2mStates = exports.Notifications = exports.Integrations = exports.Ingestors = exports.GatewayCommands = exports.EscrowDevices = exports.DownstreamSystems = exports.DiscoveredDevices = exports.DeviceTypes = exports.DeviceTransferRequests = exports.DeviceTemplates = exports.Devices = exports.DeviceLocationObservations = exports.DeviceConfigs = exports.Companies = exports.Commands = exports.BulkResponses = exports.Authentication = exports.EdgeIQAPI = void 0;
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,5 @@
1
+ import { Lwm2mState, Lwm2mStatesFilters } from './models';
2
+ declare const LWM2M: {
3
+ listStates: (filters?: Lwm2mStatesFilters | undefined) => Promise<Lwm2mState[]>;
4
+ };
5
+ export { LWM2M };
@@ -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;
@@ -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[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgeiq/edgeiq-api-js",
3
- "version": "1.3.18",
3
+ "version": "1.3.21",
4
4
  "author": "EdgeIQ",
5
5
  "license": "ISC",
6
6
  "description": "This project presents EdgeIQ API SDK.",
@@ -1,7 +0,0 @@
1
- import { EdgeIQDeviceInput } from '../devices/models';
2
- export declare const TestUser: {
3
- noUser: string;
4
- username: string;
5
- pass: string;
6
- };
7
- export declare const TestDevice: EdgeIQDeviceInput;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TestDevice = exports.TestUser = void 0;
4
- exports.TestUser = {
5
- noUser: 'NO_USER_VALUE',
6
- username: 'akhil.asaad+sys_admin@whiteprompt.com',
7
- pass: 'PiraeBeatsVenus',
8
- };
9
- exports.TestDevice = {
10
- device_type_id: '610aaa4abc72d700011b872d',
11
- name: 'EdgeIQAPI Test Device',
12
- unique_id: 'edge_api_js_test_device',
13
- company_id: 'whiteprompt_ssi_dev',
14
- };
@@ -1 +0,0 @@
1
- export declare const Greeter: (name: string) => string;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Greeter = void 0;
4
- var Greeter = function (name) { return "Hello " + name; };
5
- exports.Greeter = Greeter;