@edgeiq/edgeiq-api-js 1.8.9 → 1.9.1

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.
@@ -89,6 +89,7 @@ export declare const BaseEndpoints: {
89
89
  setting: string;
90
90
  settingsApplicationRecord: string;
91
91
  softwareUpdate: string;
92
+ softwareVersion: string;
92
93
  stats: string;
93
94
  systemCommand: string;
94
95
  systemCommandJob: string;
@@ -142,6 +143,7 @@ export declare const Endpoints: {
142
143
  setting: string;
143
144
  settingsApplicationRecord: string;
144
145
  softwareUpdate: string;
146
+ softwareVersion: string;
145
147
  statsDevicesByHeartbeat: string;
146
148
  statsDiscoveredDevicesByHeartbeat: string;
147
149
  statsDevicesByType: string;
package/dist/constants.js CHANGED
@@ -91,6 +91,7 @@ export const BaseEndpoints = {
91
91
  setting: 'settings',
92
92
  settingsApplicationRecord: 'settings_application_record',
93
93
  softwareUpdate: 'software_updates',
94
+ softwareVersion: 'software_versions',
94
95
  stats: 'stats',
95
96
  systemCommand: 'system_commands',
96
97
  systemCommandJob: 'system_command_jobs',
@@ -144,6 +145,7 @@ export const Endpoints = {
144
145
  setting: `${BaseEndpoints.setting}`,
145
146
  settingsApplicationRecord: `${BaseEndpoints.settingsApplicationRecord}`,
146
147
  softwareUpdate: `${BaseEndpoints.softwareUpdate}`,
148
+ softwareVersion: `${BaseEndpoints.softwareVersion}`,
147
149
  statsDevicesByHeartbeat: `${BaseEndpoints.stats}/devices/count_by_heartbeat_status`,
148
150
  statsDiscoveredDevicesByHeartbeat: `${BaseEndpoints.stats}/discovered_devices/count_by_heartbeat_status`,
149
151
  statsDevicesByType: `${BaseEndpoints.stats}/devices/count_by_type`,
@@ -1,6 +1,6 @@
1
- import { Configuration, Command, Ingestor, PollableAttribute, Rule, Setting } from '..';
1
+ import { Configuration, Command, Ingestor, PollableAttribute, Rule, SettingFilters, PaginatedSettings } from '..';
2
2
  import { BaseModelInterface } from '../core/ModelClass';
3
- import { BulkActionResponse } from '../models';
3
+ import { BulkActionResponse, PaginationFilter } from '../models';
4
4
  import { DeviceType, DeviceTypeInput, DeviceTypesFilters, PaginatedDeviceTypes } from './models';
5
5
  interface DeviceTypesInterface extends BaseModelInterface<DeviceType, DeviceTypeInput, DeviceTypesFilters, PaginatedDeviceTypes> {
6
6
  update(deviceType: DeviceType): Promise<DeviceType>;
@@ -18,7 +18,7 @@ interface DeviceTypesInterface extends BaseModelInterface<DeviceType, DeviceType
18
18
  getConfigurations(id: string): Promise<Configuration[]>;
19
19
  attachConfiguration(id: string, configId: string): Promise<string>;
20
20
  detachConfiguration(id: string, configId: string): Promise<string>;
21
- getSettings(id: string, configId?: string): Promise<Setting[]>;
21
+ getSettings(id: string, filters?: SettingFilters, pagination?: PaginationFilter): Promise<PaginatedSettings>;
22
22
  attachSettings(id: string, settingsId: string): Promise<string>;
23
23
  detachSettings(id: string, settingsId: string): Promise<string>;
24
24
  }
@@ -331,13 +331,23 @@ export const DeviceTypes = class extends BaseModelClass {
331
331
  }
332
332
  });
333
333
  }
334
- static getSettings(id, configId) {
334
+ static getSettings(id, filters, pagination) {
335
+ var _a, _b, _c, _d;
335
336
  return __awaiter(this, void 0, void 0, function* () {
336
337
  try {
337
338
  this.logAction(`Getting settings attached to device type with id ${id}`);
338
339
  const axios = EdgeIQAPI.getAxios();
339
- const result = yield axios.get(`${Endpoints.deviceType}/${id}/${Endpoints.setting}${configId ? `?configuration_id=${configId}` : ''}`);
340
- return result === null || result === void 0 ? void 0 : result.data;
340
+ const result = yield axios.get(`${Endpoints.deviceType}/${id}/${Endpoints.setting}`, {
341
+ params: parseFilters(filters, pagination),
342
+ });
343
+ return {
344
+ settings: (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.resources,
345
+ pagination: {
346
+ page: (_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.page,
347
+ itemsPerPage: (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.per_page,
348
+ total: (_d = result === null || result === void 0 ? void 0 : result.data) === null || _d === void 0 ? void 0 : _d.total,
349
+ },
350
+ };
341
351
  }
342
352
  catch (error) {
343
353
  if (isApiError(error)) {
@@ -55,6 +55,7 @@ export interface Actions {
55
55
  sms: boolean;
56
56
  sms_at_command_status_request: boolean;
57
57
  software_update: boolean;
58
+ software_version: boolean;
58
59
  status: boolean;
59
60
  tcp: boolean;
60
61
  tcp_modbus: boolean;
@@ -1,4 +1,4 @@
1
- import { Command, EIQFile, Ingestor, Log, Rule, Setting } from '..';
1
+ import { Command, EIQFile, Ingestor, Log, PaginatedSettings, Rule, SettingFilters } from '..';
2
2
  import { BaseModelInterface } from '../core/ModelClass';
3
3
  import { GatewayCommand, GatewayCommandRequest } from '../gatewayCommands/models';
4
4
  import { BulkActionResponse, PaginationFilter } from '../models';
@@ -32,10 +32,10 @@ interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, Devic
32
32
  [key: string]: string | number;
33
33
  }, generateChildCommandExecutions?: boolean): Promise<BulkActionResponse>;
34
34
  getFiles(id: string): Promise<EIQFile[]>;
35
- getCommandExecutions(id: string, filters: CommandExecutionsFilters, pagination: PaginationFilter): Promise<PaginatedCommandExecutions>;
35
+ getCommandExecutions(id: string, filters?: CommandExecutionsFilters, pagination?: PaginationFilter): Promise<PaginatedCommandExecutions>;
36
36
  startRemoteTerminal(id: string, executable?: string): Promise<string>;
37
37
  stopRemoteTerminal(id: string): Promise<string>;
38
- getSettings(id: string, configId?: string): Promise<Setting[]>;
38
+ getSettings(id: string, filters?: SettingFilters, pagination?: PaginationFilter): Promise<PaginatedSettings>;
39
39
  attachSettings(id: string, settingsId: string): Promise<string>;
40
40
  detachSettings(id: string, settingsId: string): Promise<string>;
41
41
  dryRunCommand(id: string, commandId: string, data?: {
@@ -555,13 +555,23 @@ export const Devices = class extends BaseModelClass {
555
555
  }
556
556
  });
557
557
  }
558
- static getSettings(id, configId) {
558
+ static getSettings(id, filters, pagination) {
559
+ var _a, _b, _c, _d;
559
560
  return __awaiter(this, void 0, void 0, function* () {
560
561
  try {
561
562
  this.logAction(`Getting settings attached to device with id ${id}`);
562
563
  const axios = EdgeIQAPI.getAxios();
563
- const result = yield axios.get(`${Endpoints.device}/${id}/${Endpoints.setting}${configId ? `?configuration_id=${configId}` : ''}`);
564
- return result === null || result === void 0 ? void 0 : result.data;
564
+ const result = yield axios.get(`${Endpoints.device}/${id}/${Endpoints.setting}`, {
565
+ params: parseFilters(filters, pagination),
566
+ });
567
+ return {
568
+ settings: (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.resources,
569
+ pagination: {
570
+ page: (_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.page,
571
+ itemsPerPage: (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.per_page,
572
+ total: (_d = result === null || result === void 0 ? void 0 : result.data) === null || _d === void 0 ? void 0 : _d.total,
573
+ },
574
+ };
565
575
  }
566
576
  catch (error) {
567
577
  if (isApiError(error)) {
@@ -1,6 +1,6 @@
1
1
  import { Base, Filter, Filters, Pagination } from '../models';
2
2
  import { RetryOptions } from '../retryOptions/models';
3
- 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' | 'file_from_device' | 'file_to_device' | 'heartbeat' | 'log_level' | 'log_upload' | 'lwm2m_request' | 'lwm2m_file' | 'restore_backup' | 'reboot' | 'reset' | 'send_config' | 'setting' | 'setting_fetch' | 'software_update' | 'status';
3
+ 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' | 'file_from_device' | 'file_to_device' | 'heartbeat' | 'log_level' | 'log_upload' | 'lwm2m_request' | 'lwm2m_file' | 'restore_backup' | 'reboot' | 'reset' | 'send_config' | 'setting' | 'setting_fetch' | 'software_update' | 'software_version' | 'status';
4
4
  export declare type CommandType = 'download' | 'fileupload' | 'filedownload' | 'execute' | 'observe' | 'observe_stop' | 'read' | 'upload' | 'write';
5
5
  export interface CommandSchedule {
6
6
  start_datetime: string;
package/dist/index.d.ts CHANGED
@@ -29,6 +29,7 @@ export { Secrets } from './secrets';
29
29
  export { Settings } from './settings';
30
30
  export { SettingApplicationRecords } from './settingsApplicationRecord';
31
31
  export { SoftwareUpdates } from './softwareUpdates';
32
+ export { SoftwareVersions } from './softwareVersions';
32
33
  export { Stats } from './stats';
33
34
  export { SystemCommands } from './systemCommands';
34
35
  export { SystemCommandJobs } from './systemCommandJobs';
@@ -73,6 +74,7 @@ export * from './settings/models';
73
74
  export * from './settingsApplicationRecord/models';
74
75
  export * from './stats/models';
75
76
  export * from './softwareUpdates/models';
77
+ export * from './softwareVersions/models';
76
78
  export * from './systemCommands/models';
77
79
  export * from './systemCommandJobs/models';
78
80
  export * from './translators/models';
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@ export { Secrets } from './secrets';
29
29
  export { Settings } from './settings';
30
30
  export { SettingApplicationRecords } from './settingsApplicationRecord';
31
31
  export { SoftwareUpdates } from './softwareUpdates';
32
+ export { SoftwareVersions } from './softwareVersions';
32
33
  export { Stats } from './stats';
33
34
  export { SystemCommands } from './systemCommands';
34
35
  export { SystemCommandJobs } from './systemCommandJobs';
@@ -73,6 +74,7 @@ export * from './settings/models';
73
74
  export * from './settingsApplicationRecord/models';
74
75
  export * from './stats/models';
75
76
  export * from './softwareUpdates/models';
77
+ export * from './softwareVersions/models';
76
78
  export * from './systemCommands/models';
77
79
  export * from './systemCommandJobs/models';
78
80
  export * from './translators/models';
@@ -0,0 +1,6 @@
1
+ import { PaginationFilter } from '..';
2
+ import { PaginatedSoftwareVersions, SoftwareVersionsFilters } from './models';
3
+ declare const SoftwareVersions: {
4
+ list: (filters?: SoftwareVersionsFilters | undefined, pagination?: PaginationFilter | undefined) => Promise<PaginatedSoftwareVersions>;
5
+ };
6
+ export { SoftwareVersions };
@@ -0,0 +1,40 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { EdgeIQAPI } from '..';
11
+ import { Endpoints } from '../constants';
12
+ import { isApiError } from '../helpers';
13
+ import { parseFilters } from '../filtersParser';
14
+ const SoftwareVersions = {
15
+ list: (filters, pagination) => __awaiter(void 0, void 0, void 0, function* () {
16
+ var _a, _b, _c, _d;
17
+ try {
18
+ EdgeIQAPI.logAction(`Getting software versions`);
19
+ const axios = EdgeIQAPI.getAxios();
20
+ const result = yield axios.get(Endpoints.softwareVersion, {
21
+ params: parseFilters(filters, pagination),
22
+ });
23
+ return {
24
+ softwareVersions: (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.resources,
25
+ pagination: {
26
+ page: (_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.page,
27
+ itemsPerPage: (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.per_page,
28
+ total: (_d = result === null || result === void 0 ? void 0 : result.data) === null || _d === void 0 ? void 0 : _d.total,
29
+ },
30
+ };
31
+ }
32
+ catch (error) {
33
+ if (isApiError(error)) {
34
+ throw error;
35
+ }
36
+ throw error;
37
+ }
38
+ }),
39
+ };
40
+ export { SoftwareVersions };
@@ -0,0 +1,26 @@
1
+ import { Base, Filter, Filters, Pagination } from '../models';
2
+ export declare type VersionSourceType = 'apt' | 'snap';
3
+ export interface SoftwareVersion extends Base {
4
+ device_id: string;
5
+ name: string;
6
+ notes?: string;
7
+ source: VersionSourceType;
8
+ publisher?: string;
9
+ version_raw?: string;
10
+ version_major?: number;
11
+ version_minor?: number;
12
+ version_patch?: number;
13
+ version_prerelease?: string;
14
+ version_metadata?: string;
15
+ revision?: number;
16
+ track?: string;
17
+ }
18
+ export interface SoftwareVersionsFilters extends Filters {
19
+ device_id?: Filter;
20
+ name?: Filter;
21
+ source?: Filter;
22
+ }
23
+ export interface PaginatedSoftwareVersions {
24
+ softwareVersions: SoftwareVersion[];
25
+ pagination: Pagination;
26
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgeiq/edgeiq-api-js",
3
- "version": "1.8.9",
3
+ "version": "1.9.1",
4
4
  "author": "EdgeIQ",
5
5
  "license": "ISC",
6
6
  "description": "This project presents EdgeIQ API SDK.",