@edgeiq/edgeiq-api-js 1.11.12 → 1.12.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.
@@ -96,6 +96,7 @@ export declare const BaseEndpoints: {
96
96
  systemCommand: string;
97
97
  systemCommandJob: string;
98
98
  translator: string;
99
+ userEvent: string;
99
100
  userType: string;
100
101
  user: string;
101
102
  logs: string;
@@ -155,6 +156,7 @@ export declare const Endpoints: {
155
156
  systemCommand: string;
156
157
  systemCommandJob: string;
157
158
  translator: string;
159
+ userEvents: string;
158
160
  userType: string;
159
161
  user: string;
160
162
  workflows: string;
package/dist/constants.js CHANGED
@@ -98,6 +98,7 @@ export const BaseEndpoints = {
98
98
  systemCommand: 'system_commands',
99
99
  systemCommandJob: 'system_command_jobs',
100
100
  translator: 'translators',
101
+ userEvent: 'user_events',
101
102
  userType: 'user_types',
102
103
  user: 'users',
103
104
  logs: 'logs',
@@ -157,6 +158,7 @@ export const Endpoints = {
157
158
  systemCommand: `${BaseEndpoints.systemCommand}`,
158
159
  systemCommandJob: `${BaseEndpoints.systemCommandJob}`,
159
160
  translator: `${BaseEndpoints.translator}`,
161
+ userEvents: `${BaseEndpoints.userEvent}`,
160
162
  userType: `${BaseEndpoints.userType}`,
161
163
  user: `${BaseEndpoints.user}`,
162
164
  workflows: `${BaseEndpoints.workflows}`,
@@ -44,8 +44,8 @@ interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, Devic
44
44
  bulkExecuteWorkflow(workflowId: string, ids: string[]): Promise<BulkActionResponse>;
45
45
  revokeCertificate(id: string, certificateId: string, revoke: boolean): Promise<string>;
46
46
  getExportColumns(): Promise<DeviceExportColumnn[]>;
47
- getDeviceUptime(id: string, start: string, end: string): Promise<DeviceUptime>;
48
- getDeviceUptimeHistory(id: string, start: string, end: string): Promise<DeviceUptimeHistory>;
47
+ getDeviceUptime(id: string, start?: string, end?: string): Promise<DeviceUptime>;
48
+ getDeviceUptimeHistory(id: string, start?: string, end?: string): Promise<DeviceUptimeHistory>;
49
49
  }
50
50
  export declare const Devices: DevicesInterface;
51
51
  export {};
@@ -688,7 +688,7 @@ export const Devices = class extends BaseModelClass {
688
688
  try {
689
689
  this.logAction('Getting device uptime');
690
690
  const axios = EdgeIQAPI.getAxios();
691
- const result = yield axios.get(`${Endpoints.device}/${id}/uptime?created_at_gte=${start}&created_at_lte=${end}`);
691
+ const result = yield axios.get(`${Endpoints.device}/${id}/uptime${start || end ? '?' : ''}${start ? `created_at_gte=${start}` : ''}${start && end ? '&' : ''}${end ? `created_at_lte=${end}` : ''}`);
692
692
  return result === null || result === void 0 ? void 0 : result.data;
693
693
  }
694
694
  catch (error) {
@@ -704,7 +704,7 @@ export const Devices = class extends BaseModelClass {
704
704
  try {
705
705
  this.logAction('Getting device uptime');
706
706
  const axios = EdgeIQAPI.getAxios();
707
- const result = yield axios.get(`${Endpoints.device}/${id}/uptime_history?created_at_gte=${start}&created_at_lte=${end}`);
707
+ const result = yield axios.get(`${Endpoints.device}/${id}/uptime_history${start || end ? '?' : ''}${start ? `created_at_gte=${start}` : ''}${start && end ? '&' : ''}${end ? `created_at_lte=${end}` : ''}`);
708
708
  return result === null || result === void 0 ? void 0 : result.data;
709
709
  }
710
710
  catch (error) {
package/dist/index.d.ts CHANGED
@@ -37,6 +37,7 @@ export { SystemCommands } from './systemCommands';
37
37
  export { SystemCommandJobs } from './systemCommandJobs';
38
38
  export { Translators } from './translators';
39
39
  export { Users } from './users';
40
+ export { UserEvents } from './userEvents';
40
41
  export { UserTypes } from './userTypes';
41
42
  export { ScheduledJobs } from './scheduledJobs';
42
43
  export { Workflows } from './workflows';
@@ -83,6 +84,7 @@ export * from './systemCommands/models';
83
84
  export * from './systemCommandJobs/models';
84
85
  export * from './translators/models';
85
86
  export * from './users/models';
87
+ export * from './userEvents/models';
86
88
  export * from './userTypes/models';
87
89
  export * from './scheduledJobs/models';
88
90
  export * from './workflows/models';
package/dist/index.js CHANGED
@@ -37,6 +37,7 @@ export { SystemCommands } from './systemCommands';
37
37
  export { SystemCommandJobs } from './systemCommandJobs';
38
38
  export { Translators } from './translators';
39
39
  export { Users } from './users';
40
+ export { UserEvents } from './userEvents';
40
41
  export { UserTypes } from './userTypes';
41
42
  export { ScheduledJobs } from './scheduledJobs';
42
43
  export { Workflows } from './workflows';
@@ -83,6 +84,7 @@ export * from './systemCommands/models';
83
84
  export * from './systemCommandJobs/models';
84
85
  export * from './translators/models';
85
86
  export * from './users/models';
87
+ export * from './userEvents/models';
86
88
  export * from './userTypes/models';
87
89
  export * from './scheduledJobs/models';
88
90
  export * from './workflows/models';
@@ -235,6 +235,12 @@ const checkRequiredValuesByType = (integration) => {
235
235
  'password',
236
236
  ]);
237
237
  }
238
+ if (integration.type === 'anthropic_integrations') {
239
+ missingValues = getRequiredValues(integration, ['token']);
240
+ }
241
+ if (integration.type === 'openai_integrations') {
242
+ missingValues = getRequiredValues(integration, ['token', 'base_url']);
243
+ }
238
244
  if (integration.type === 'twilio_rule_action_integrations') {
239
245
  missingValues = getRequiredValues(integration, ['sid', 'token', 'from']);
240
246
  }
@@ -1,5 +1,5 @@
1
1
  import { Base, Filter, Filters, Pagination } from '../models';
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' | 'generic_username_password_integrations' | 'generic_token_integrations';
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' | 'generic_username_password_integrations' | 'generic_token_integrations' | 'anthropic_integrations' | 'openai_integrations';
3
3
  export declare type GreengrassVersion = '' | 'v1' | 'v2';
4
4
  export interface IntegrationInput {
5
5
  name: string;
@@ -48,6 +48,7 @@ export interface IntegrationInput {
48
48
  identification_token?: string;
49
49
  gcp_project_id?: string;
50
50
  gcp_service_account_key_secret_id?: string;
51
+ base_url?: string;
51
52
  }
52
53
  export interface Integration extends IntegrationInput, Base {
53
54
  readable_type?: string;
@@ -1148,6 +1148,7 @@ export interface Integration {
1148
1148
  username?: string;
1149
1149
  password?: string;
1150
1150
  identification_token?: string;
1151
+ base_url?: string;
1151
1152
  }
1152
1153
  export interface IntegrationTypeDescription {
1153
1154
  type: IntegrationType;
@@ -0,0 +1,6 @@
1
+ import { PaginationFilter } from '..';
2
+ import { PaginatedUserEvents, UserEventsFilters } from './models';
3
+ declare const UserEvents: {
4
+ list: (filters?: UserEventsFilters | undefined, pagination?: PaginationFilter | undefined) => Promise<PaginatedUserEvents>;
5
+ };
6
+ export { UserEvents };
@@ -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 UserEvents = {
15
+ list: (filters, pagination) => __awaiter(void 0, void 0, void 0, function* () {
16
+ var _a, _b, _c, _d;
17
+ try {
18
+ EdgeIQAPI.logAction(`Getting user events`);
19
+ const axios = EdgeIQAPI.getAxios();
20
+ const result = yield axios.get(Endpoints.userEvents, {
21
+ params: parseFilters(filters, pagination),
22
+ });
23
+ return {
24
+ userEvents: (_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 { UserEvents };
@@ -0,0 +1,18 @@
1
+ import { Base, Filter, Filters, Pagination } from '../models';
2
+ export declare type UserEventType = 'create' | 'delete' | 'login' | 'logout' | 'me';
3
+ export interface UserEvent extends Base {
4
+ ip_address: string;
5
+ metadata?: {
6
+ id: string;
7
+ };
8
+ event_type: UserEventType;
9
+ user_id: string;
10
+ }
11
+ export interface UserEventsFilters extends Filters {
12
+ user_id?: Filter;
13
+ user_event?: Filter;
14
+ }
15
+ export interface PaginatedUserEvents {
16
+ userEvents: UserEvent[];
17
+ pagination: Pagination;
18
+ }
@@ -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.11.12",
3
+ "version": "1.12.1",
4
4
  "author": "EdgeIQ",
5
5
  "license": "ISC",
6
6
  "description": "This project presents EdgeIQ API SDK.",