@edgeiq/edgeiq-api-js 1.12.0 → 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.
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/userEvents/index.d.ts +6 -0
- package/dist/userEvents/index.js +40 -0
- package/dist/userEvents/models.d.ts +18 -0
- package/dist/userEvents/models.js +1 -0
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -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}`,
|
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';
|
|
@@ -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 {};
|