@edgeiq/edgeiq-api-js 1.3.33 → 1.3.36

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.
@@ -0,0 +1,7 @@
1
+ import { BaseModelInterface } from '../core/ModelClass';
2
+ import { Configuration, ConfigurationInput, ConfigurationsFilters, PaginatedConfigurations } from './models';
3
+ interface ConfigurationsInterface extends BaseModelInterface<Configuration, ConfigurationInput, ConfigurationsFilters, PaginatedConfigurations> {
4
+ update(configuration: Configuration): Promise<Configuration>;
5
+ }
6
+ export declare const Configurations: ConfigurationsInterface;
7
+ export {};
@@ -0,0 +1,197 @@
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.Configurations = void 0;
55
+ var constants_1 = require("../constants");
56
+ var ModelClass_1 = require("../core/ModelClass");
57
+ var filtersParser_1 = require("../filtersParser");
58
+ var helpers_1 = require("../helpers");
59
+ var core_1 = require("../core");
60
+ exports.Configurations = (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 (configurationsRequest) {
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 configuration with data: " + configurationsRequest);
73
+ axios = core_1.EdgeIQAPI.getAxios();
74
+ data = JSON.stringify(configurationsRequest);
75
+ return [4, axios.post(constants_1.Endpoints.configuration, 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 (configuration) {
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 configuration with ID: " + configuration._id);
98
+ axios = core_1.EdgeIQAPI.getAxios();
99
+ data = JSON.stringify(configuration);
100
+ return [4, axios.put(constants_1.Endpoints.configuration + "/" + configuration._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
+ axios = core_1.EdgeIQAPI.getAxios();
124
+ return [4, axios.get("" + constants_1.Endpoints.configuration, {
125
+ params: (0, filtersParser_1.parseFilters)(filters, pagination),
126
+ })];
127
+ case 1:
128
+ result = _e.sent();
129
+ return [2, {
130
+ configurations: (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.resources,
131
+ pagination: {
132
+ page: (_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.page,
133
+ itemsPerPage: (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.per_page,
134
+ total: (_d = result === null || result === void 0 ? void 0 : result.data) === null || _d === void 0 ? void 0 : _d.total,
135
+ },
136
+ }];
137
+ case 2:
138
+ error_3 = _e.sent();
139
+ if ((0, helpers_1.isApiError)(error_3)) {
140
+ throw error_3;
141
+ }
142
+ throw error_3;
143
+ case 3: return [2];
144
+ }
145
+ });
146
+ });
147
+ };
148
+ class_1.getOneById = function (id) {
149
+ return __awaiter(this, void 0, void 0, function () {
150
+ var axios, result, error_4;
151
+ return __generator(this, function (_a) {
152
+ switch (_a.label) {
153
+ case 0:
154
+ _a.trys.push([0, 2, , 3]);
155
+ this.logAction("Getting configuration request with id: " + id);
156
+ axios = core_1.EdgeIQAPI.getAxios();
157
+ return [4, axios.get(constants_1.Endpoints.configuration + "/" + id)];
158
+ case 1:
159
+ result = _a.sent();
160
+ return [2, result === null || result === void 0 ? void 0 : result.data];
161
+ case 2:
162
+ error_4 = _a.sent();
163
+ if ((0, helpers_1.isApiError)(error_4)) {
164
+ throw error_4;
165
+ }
166
+ throw error_4;
167
+ case 3: return [2];
168
+ }
169
+ });
170
+ });
171
+ };
172
+ class_1.delete = function (id) {
173
+ return __awaiter(this, void 0, void 0, function () {
174
+ var axios, error_5;
175
+ return __generator(this, function (_a) {
176
+ switch (_a.label) {
177
+ case 0:
178
+ _a.trys.push([0, 2, , 3]);
179
+ this.logAction("Deleting configuration request with id " + id);
180
+ axios = core_1.EdgeIQAPI.getAxios();
181
+ return [4, axios.delete(constants_1.Endpoints.configuration + "/" + id)];
182
+ case 1:
183
+ _a.sent();
184
+ return [2, (0, helpers_1.getReturnDeleteMessage)('configuration request')];
185
+ case 2:
186
+ error_5 = _a.sent();
187
+ if ((0, helpers_1.isApiError)(error_5)) {
188
+ throw error_5;
189
+ }
190
+ throw error_5;
191
+ case 3: return [2];
192
+ }
193
+ });
194
+ });
195
+ };
196
+ return class_1;
197
+ }(ModelClass_1.BaseModelClass));
@@ -0,0 +1,28 @@
1
+ import { Base, Filter, Filters, Pagination } from '../models';
2
+ export declare type ConfigurationSettingTypeEnum = 'boolean' | 'string' | 'integer' | 'predefined_list';
3
+ export interface ConfigurableSettings extends Base {
4
+ description?: string;
5
+ configuration_id: string;
6
+ key: string;
7
+ type: ConfigurationSettingTypeEnum;
8
+ default?: string;
9
+ require: boolean;
10
+ values: {
11
+ [key: string]: unknown;
12
+ };
13
+ }
14
+ export interface ConfigurationInput {
15
+ name: string;
16
+ device_type_id: string;
17
+ configurable_settings: ConfigurableSettings[];
18
+ }
19
+ export interface Configuration extends ConfigurationInput, Base {
20
+ }
21
+ export interface ConfigurationsFilters extends Filters {
22
+ configuration_id?: Filter;
23
+ device_type_id?: Filter;
24
+ }
25
+ export interface PaginatedConfigurations {
26
+ configurations: Configuration[];
27
+ pagination: Pagination;
28
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -57,6 +57,7 @@ export declare const BaseEndpoints: {
57
57
  command: string;
58
58
  commandExecution: string;
59
59
  company: string;
60
+ configuration: string;
60
61
  deviceConfig: string;
61
62
  deviceError: string;
62
63
  deviceTransferRequest: string;
@@ -80,6 +81,8 @@ export declare const BaseEndpoints: {
80
81
  report: string;
81
82
  rule: string;
82
83
  secret: string;
84
+ setting: string;
85
+ settingsApplicationRecord: string;
83
86
  softwareUpdate: string;
84
87
  stats: string;
85
88
  systemCommand: string;
@@ -101,6 +104,7 @@ export declare const Endpoints: {
101
104
  command: string;
102
105
  commandExecution: string;
103
106
  company: string;
107
+ configuration: string;
104
108
  deviceConfig: string;
105
109
  deviceError: string;
106
110
  deviceTransferRequest: string;
@@ -123,6 +127,8 @@ export declare const Endpoints: {
123
127
  report: string;
124
128
  rule: string;
125
129
  secret: string;
130
+ setting: string;
131
+ settingsApplicationRecord: string;
126
132
  softwareUpdate: string;
127
133
  statsDevicesByHeartbeat: string;
128
134
  statsDiscoveredDevicesByHeartbeat: string;
package/dist/constants.js CHANGED
@@ -73,6 +73,7 @@ exports.BaseEndpoints = {
73
73
  command: 'commands',
74
74
  commandExecution: 'command_executions',
75
75
  company: 'companies',
76
+ configuration: 'configurations',
76
77
  deviceConfig: 'device_configs',
77
78
  deviceError: 'device_errors',
78
79
  deviceTransferRequest: 'device_transfer_requests',
@@ -96,6 +97,8 @@ exports.BaseEndpoints = {
96
97
  report: 'reports',
97
98
  rule: 'rules',
98
99
  secret: 'secrets',
100
+ setting: 'settings',
101
+ settingsApplicationRecord: 'settings_application_record',
99
102
  softwareUpdate: 'software_updates',
100
103
  stats: 'stats',
101
104
  systemCommand: 'system_commands',
@@ -117,6 +120,7 @@ exports.Endpoints = {
117
120
  command: "" + exports.BaseEndpoints.command,
118
121
  commandExecution: "" + exports.BaseEndpoints.commandExecution,
119
122
  company: "" + exports.BaseEndpoints.company,
123
+ configuration: "" + exports.BaseEndpoints.configuration,
120
124
  deviceConfig: "" + exports.BaseEndpoints.deviceConfig,
121
125
  deviceError: "" + exports.BaseEndpoints.deviceError,
122
126
  deviceTransferRequest: "" + exports.BaseEndpoints.deviceTransferRequest,
@@ -139,6 +143,8 @@ exports.Endpoints = {
139
143
  report: "" + exports.BaseEndpoints.report,
140
144
  rule: "" + exports.BaseEndpoints.rule,
141
145
  secret: "" + exports.BaseEndpoints.secret,
146
+ setting: "" + exports.BaseEndpoints.setting,
147
+ settingsApplicationRecord: "" + exports.BaseEndpoints.settingsApplicationRecord,
142
148
  softwareUpdate: "" + exports.BaseEndpoints.softwareUpdate,
143
149
  statsDevicesByHeartbeat: exports.BaseEndpoints.stats + "/devices/count_by_heartbeat_status",
144
150
  statsDiscoveredDevicesByHeartbeat: exports.BaseEndpoints.stats + "/discovered_devices/count_by_heartbeat_status",
@@ -12,6 +12,9 @@ export interface EscrowDeviceInput {
12
12
  lwm2m_bootstrap_psk_identity?: string;
13
13
  lwm2m_server_psk?: string;
14
14
  lwm2m_server_psk_identity?: string;
15
+ metadata?: {
16
+ [key: string]: unknown;
17
+ };
15
18
  }
16
19
  export interface EscrowDevice extends EscrowDeviceInput, Base {
17
20
  lwm2m_bootstrap_psk_secret_id?: string;
@@ -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' | 'software_update' | 'status';
2
+ export declare type GatewayCommandType = 'activate_cloud_native_device' | 'backup' | 'setting' | '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
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;
@@ -60,6 +60,8 @@ export interface GatewayCommandInput {
60
60
  device_unique_id?: string;
61
61
  device_type_id?: string;
62
62
  software_update_id?: string;
63
+ command_id?: string;
64
+ setting_id?: string;
63
65
  attached_device_ids: string[];
64
66
  attached_device_unique_ids: string[];
65
67
  }
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { BulkResponses } from './bulkResponses';
4
4
  export { Commands } from './commands';
5
5
  export { Companies } from './companies';
6
6
  export { CommandExecutions } from './commandExecutions';
7
+ export { Configurations } from './configurations';
7
8
  export { DeviceConfigs } from './deviceConfigs';
8
9
  export { DeviceLocationObservations } from './deviceLocationObservations';
9
10
  export { Devices } from './devices';
@@ -25,6 +26,8 @@ export { Regions } from './regions';
25
26
  export { Reports } from './reports';
26
27
  export { Rules } from './rules';
27
28
  export { Secrets } from './secrets';
29
+ export { Settings } from './settings';
30
+ export { SettingApplicationRecords } from './settingsApplicationRecord';
28
31
  export { SoftwareUpdates } from './softwareUpdates';
29
32
  export { Stats } from './stats';
30
33
  export { SystemCommands } from './systemCommands';
@@ -37,6 +40,7 @@ export * from './bulkResponses/models';
37
40
  export * from './commands/models';
38
41
  export * from './companies/models';
39
42
  export * from './commandExecutions/models';
43
+ export * from './configurations/models';
40
44
  export * from './deviceConfigs/models';
41
45
  export * from './deviceLocationObservations/models';
42
46
  export * from './devices/models';
@@ -59,6 +63,8 @@ export * from './reports/models';
59
63
  export * from './regions/models';
60
64
  export * from './rules/models';
61
65
  export * from './secrets/models';
66
+ export * from './settings/models';
67
+ export * from './settingsApplicationRecord/models';
62
68
  export * from './stats/models';
63
69
  export * from './softwareUpdates/models';
64
70
  export * from './systemCommands/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.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.EIQFiles = exports.DiscoveredDevices = exports.DeviceTypes = exports.DeviceTransferRequests = exports.DeviceTemplates = exports.DeviceErrors = exports.Devices = exports.DeviceLocationObservations = exports.DeviceConfigs = exports.CommandExecutions = 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.SettingApplicationRecords = exports.Settings = 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.EIQFiles = exports.DiscoveredDevices = exports.DeviceTypes = exports.DeviceTransferRequests = exports.DeviceTemplates = exports.DeviceErrors = exports.Devices = exports.DeviceLocationObservations = exports.DeviceConfigs = exports.Configurations = exports.CommandExecutions = 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");
@@ -23,6 +23,8 @@ var companies_1 = require("./companies");
23
23
  Object.defineProperty(exports, "Companies", { enumerable: true, get: function () { return companies_1.Companies; } });
24
24
  var commandExecutions_1 = require("./commandExecutions");
25
25
  Object.defineProperty(exports, "CommandExecutions", { enumerable: true, get: function () { return commandExecutions_1.CommandExecutions; } });
26
+ var configurations_1 = require("./configurations");
27
+ Object.defineProperty(exports, "Configurations", { enumerable: true, get: function () { return configurations_1.Configurations; } });
26
28
  var deviceConfigs_1 = require("./deviceConfigs");
27
29
  Object.defineProperty(exports, "DeviceConfigs", { enumerable: true, get: function () { return deviceConfigs_1.DeviceConfigs; } });
28
30
  var deviceLocationObservations_1 = require("./deviceLocationObservations");
@@ -65,6 +67,10 @@ var rules_1 = require("./rules");
65
67
  Object.defineProperty(exports, "Rules", { enumerable: true, get: function () { return rules_1.Rules; } });
66
68
  var secrets_1 = require("./secrets");
67
69
  Object.defineProperty(exports, "Secrets", { enumerable: true, get: function () { return secrets_1.Secrets; } });
70
+ var settings_1 = require("./settings");
71
+ Object.defineProperty(exports, "Settings", { enumerable: true, get: function () { return settings_1.Settings; } });
72
+ var settingsApplicationRecord_1 = require("./settingsApplicationRecord");
73
+ Object.defineProperty(exports, "SettingApplicationRecords", { enumerable: true, get: function () { return settingsApplicationRecord_1.SettingApplicationRecords; } });
68
74
  var softwareUpdates_1 = require("./softwareUpdates");
69
75
  Object.defineProperty(exports, "SoftwareUpdates", { enumerable: true, get: function () { return softwareUpdates_1.SoftwareUpdates; } });
70
76
  var stats_1 = require("./stats");
@@ -84,6 +90,7 @@ __exportStar(require("./bulkResponses/models"), exports);
84
90
  __exportStar(require("./commands/models"), exports);
85
91
  __exportStar(require("./companies/models"), exports);
86
92
  __exportStar(require("./commandExecutions/models"), exports);
93
+ __exportStar(require("./configurations/models"), exports);
87
94
  __exportStar(require("./deviceConfigs/models"), exports);
88
95
  __exportStar(require("./deviceLocationObservations/models"), exports);
89
96
  __exportStar(require("./devices/models"), exports);
@@ -106,6 +113,8 @@ __exportStar(require("./reports/models"), exports);
106
113
  __exportStar(require("./regions/models"), exports);
107
114
  __exportStar(require("./rules/models"), exports);
108
115
  __exportStar(require("./secrets/models"), exports);
116
+ __exportStar(require("./settings/models"), exports);
117
+ __exportStar(require("./settingsApplicationRecord/models"), exports);
109
118
  __exportStar(require("./stats/models"), exports);
110
119
  __exportStar(require("./softwareUpdates/models"), exports);
111
120
  __exportStar(require("./systemCommands/models"), exports);
@@ -13,14 +13,13 @@ export interface Lwm2mObjectLinks extends Base {
13
13
  links?: Lwm2mObjectLink[];
14
14
  }
15
15
  export interface Lwm2mObjectLink {
16
+ uriReference?: string;
16
17
  url?: string;
17
18
  description?: string;
18
19
  attributes?: Lwm2mAttributesCore;
19
20
  }
20
21
  export interface Lwm2mAttributesCore {
21
- path?: ObjectPath;
22
22
  rootPath?: string;
23
- uriReference?: string;
24
23
  attributes?: Lwm2mAttributes;
25
24
  }
26
25
  export interface ObjectPath {
@@ -0,0 +1,7 @@
1
+ import { BaseModelInterface } from '../core/ModelClass';
2
+ import { SettingFilters, Setting, SettingInput, PaginatedSettings } from './models';
3
+ interface SettingsInterface extends BaseModelInterface<Setting, SettingInput, SettingFilters, PaginatedSettings> {
4
+ update(setting: Setting): Promise<Setting>;
5
+ }
6
+ export declare const Settings: SettingsInterface;
7
+ export {};
@@ -0,0 +1,198 @@
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.Settings = 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.Settings = (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 (setting) {
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 setting with data: " + setting);
73
+ axios = __1.EdgeIQAPI.getAxios();
74
+ data = JSON.stringify(setting);
75
+ return [4, axios.post(constants_1.Endpoints.setting, 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 (setting) {
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 setting with ID: " + setting._id);
98
+ axios = __1.EdgeIQAPI.getAxios();
99
+ data = JSON.stringify(setting);
100
+ return [4, axios.put(constants_1.Endpoints.setting + "/" + setting._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 settings 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.setting, {
126
+ params: (0, filtersParser_1.parseFilters)(filters, pagination),
127
+ })];
128
+ case 1:
129
+ result = _e.sent();
130
+ return [2, {
131
+ settings: (_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 setting with id: " + id);
157
+ axios = __1.EdgeIQAPI.getAxios();
158
+ return [4, axios.get(constants_1.Endpoints.setting + "/" + 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 setting with id " + id);
181
+ axios = __1.EdgeIQAPI.getAxios();
182
+ return [4, axios.delete(constants_1.Endpoints.setting + "/" + id)];
183
+ case 1:
184
+ _a.sent();
185
+ return [2, (0, helpers_1.getReturnDeleteMessage)('setting')];
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
+ return class_1;
198
+ }(ModelClass_1.BaseModelClass));
@@ -0,0 +1,21 @@
1
+ import { Base, Filter, Filters, Pagination } from '../models';
2
+ export interface SettingsValue {
3
+ status: string;
4
+ status_message?: string;
5
+ }
6
+ export interface SettingInput {
7
+ configuration_id: string;
8
+ settings_value: string;
9
+ }
10
+ export interface Setting extends SettingInput, Base {
11
+ id: string;
12
+ size: number;
13
+ }
14
+ export interface SettingFilters extends Filters {
15
+ unique_id?: Filter;
16
+ website?: Filter;
17
+ }
18
+ export interface PaginatedSettings {
19
+ settings: Setting[];
20
+ pagination: Pagination;
21
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { PaginationFilter } from '../models';
2
+ import { SettingsApplicationRecordFilters, PaginatedSettingsApplicationRecord } from './models';
3
+ declare const SettingApplicationRecords: {
4
+ list(filters?: SettingsApplicationRecordFilters | undefined, pagination?: PaginationFilter | undefined): Promise<PaginatedSettingsApplicationRecord>;
5
+ };
6
+ export { SettingApplicationRecords };
@@ -0,0 +1,79 @@
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.SettingApplicationRecords = void 0;
40
+ var __1 = require("..");
41
+ var constants_1 = require("../constants");
42
+ var filtersParser_1 = require("../filtersParser");
43
+ var helpers_1 = require("../helpers");
44
+ var SettingApplicationRecords = {
45
+ list: function (filters, pagination) {
46
+ var _a, _b, _c, _d;
47
+ return __awaiter(this, void 0, void 0, function () {
48
+ var axios, result, error_1;
49
+ return __generator(this, function (_e) {
50
+ switch (_e.label) {
51
+ case 0:
52
+ _e.trys.push([0, 2, , 3]);
53
+ axios = __1.EdgeIQAPI.getAxios();
54
+ return [4, axios.get(constants_1.Endpoints.settingsApplicationRecord, {
55
+ params: (0, filtersParser_1.parseFilters)(filters, pagination),
56
+ })];
57
+ case 1:
58
+ result = _e.sent();
59
+ return [2, {
60
+ settingsApplicationRecord: (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.resources,
61
+ pagination: {
62
+ page: (_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.page,
63
+ itemsPerPage: (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.per_page,
64
+ total: (_d = result === null || result === void 0 ? void 0 : result.data) === null || _d === void 0 ? void 0 : _d.total,
65
+ },
66
+ }];
67
+ case 2:
68
+ error_1 = _e.sent();
69
+ if ((0, helpers_1.isApiError)(error_1)) {
70
+ throw error_1;
71
+ }
72
+ throw error_1;
73
+ case 3: return [2];
74
+ }
75
+ });
76
+ });
77
+ },
78
+ };
79
+ exports.SettingApplicationRecords = SettingApplicationRecords;
@@ -0,0 +1,17 @@
1
+ import { Base, Filter, Filters, Pagination } from '../models';
2
+ export interface SettingsApplicationRecordInput {
3
+ settings_id: string;
4
+ gateway_command_id: string;
5
+ }
6
+ export interface SettingsApplicationRecord extends SettingsApplicationRecordInput, Base {
7
+ id: string;
8
+ size: number;
9
+ }
10
+ export interface SettingsApplicationRecordFilters extends Filters {
11
+ settings_id?: Filter;
12
+ gateway_command_id?: Filter;
13
+ }
14
+ export interface PaginatedSettingsApplicationRecord {
15
+ settingsApplicationRecord: SettingsApplicationRecord[];
16
+ pagination: Pagination;
17
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgeiq/edgeiq-api-js",
3
- "version": "1.3.33",
3
+ "version": "1.3.36",
4
4
  "author": "EdgeIQ",
5
5
  "license": "ISC",
6
6
  "description": "This project presents EdgeIQ API SDK.",