@vonage/audit 1.8.2 → 1.10.0

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/audit.d.ts CHANGED
@@ -1,9 +1,74 @@
1
1
  import { AuthenticationType, Client } from '@vonage/server-client';
2
- import { AuditParams } from './types/auditParams';
3
- import { AuditEvent } from './types/auditEvent';
2
+ import { AuditEvent, AuditParams } from './types';
3
+ /**
4
+ * Represents an SDK client for interacting with audit-related functionality.
5
+ *
6
+ * @remarks
7
+ * This client is only available as a standalone client. It cannot be
8
+ * instantiated from a Vonage client.
9
+ *
10
+ * @example
11
+ * Create a standalone Audit client
12
+ *
13
+ * ```ts
14
+ * import { Audit } from '@vonage/audit';
15
+ *
16
+ * const auditClient = new Audit({
17
+ * apiKey: VONAGE_API_KEY,
18
+ * apiSecret: VONAGE_API_SECRET
19
+ * });
20
+ * ```
21
+ */
4
22
  export declare class Audit extends Client {
5
23
  protected BASE_PATH: string;
6
- protected authType: AuthenticationType;
24
+ authType: AuthenticationType;
25
+ /**
26
+ * Retrieves a list of audit events based on specified parameters.
27
+ *
28
+ * @param {AuditParams} params - The query parameters for filtering audit events.
29
+ * @return { AsyncGenerator<AuditEvent>} An async generator that yields audit events.
30
+ *
31
+ * @example
32
+ * Retrieve a list of audit events
33
+ *
34
+ * ```ts
35
+ * const auditEvents = auditClient.getEvents({
36
+ * page: 1,
37
+ * size: 10,
38
+ * dateFrom: '2021-01-01T00:00:00Z',
39
+ * dateTo: '2021-01-31T23:59:59Z',
40
+ * eventType: 'message',
41
+ * search: 'search term'
42
+ * });
43
+ *
44
+ * for await (const event of auditEvents) {
45
+ * console.log(event.id);
46
+ * console.log(event.type);
47
+ * console.log(event.created);
48
+ * console.log(event.accountId);
49
+ * console.log(event.requestId);
50
+ * console.log(event.request);
51
+ * console.log(event.response);
52
+ * console.log(event.ipAddress);
53
+ * console.log(event.country);
54
+ * console.log(event.msisdn);
55
+ * }
56
+ * ```
57
+ */
7
58
  getEvents(params: AuditParams): AsyncGenerator<AuditEvent, void, undefined>;
59
+ /**
60
+ * Retrieves a specific audit event by its ID.
61
+ *
62
+ * @param {string} eventId - The ID of the audit event to retrieve.
63
+ * @return {Promise<AuditEvent>} A promise that resolves to the retrieved audit event.
64
+ *
65
+ * @example
66
+ * Retrieve a specific audit event
67
+ *
68
+ * ```ts
69
+ * const auditEvent = await auditClient.getEvent('event-id');
70
+ * console.log(auditEvent.id);
71
+ * ```
72
+ */
8
73
  getEvent(eventId: string): Promise<AuditEvent>;
9
74
  }
package/dist/audit.js CHANGED
@@ -2,25 +2,95 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Audit = void 0;
4
4
  const server_client_1 = require("@vonage/server-client");
5
+ /**
6
+ * Represents an SDK client for interacting with audit-related functionality.
7
+ *
8
+ * @remarks
9
+ * This client is only available as a standalone client. It cannot be
10
+ * instantiated from a Vonage client.
11
+ *
12
+ * @example
13
+ * Create a standalone Audit client
14
+ *
15
+ * ```ts
16
+ * import { Audit } from '@vonage/audit';
17
+ *
18
+ * const auditClient = new Audit({
19
+ * apiKey: VONAGE_API_KEY,
20
+ * apiSecret: VONAGE_API_SECRET
21
+ * });
22
+ * ```
23
+ */
5
24
  class Audit extends server_client_1.Client {
6
- BASE_PATH = 'beta';
7
- authType = server_client_1.AuthenticationType.BASIC;
25
+ constructor() {
26
+ super(...arguments);
27
+ // The base path for audit-related API endpoints
28
+ this.BASE_PATH = 'beta';
29
+ // Authentication type for the client
30
+ this.authType = server_client_1.AuthenticationType.BASIC;
31
+ }
32
+ /**
33
+ * Retrieves a list of audit events based on specified parameters.
34
+ *
35
+ * @param {AuditParams} params - The query parameters for filtering audit events.
36
+ * @return { AsyncGenerator<AuditEvent>} An async generator that yields audit events.
37
+ *
38
+ * @example
39
+ * Retrieve a list of audit events
40
+ *
41
+ * ```ts
42
+ * const auditEvents = auditClient.getEvents({
43
+ * page: 1,
44
+ * size: 10,
45
+ * dateFrom: '2021-01-01T00:00:00Z',
46
+ * dateTo: '2021-01-31T23:59:59Z',
47
+ * eventType: 'message',
48
+ * search: 'search term'
49
+ * });
50
+ *
51
+ * for await (const event of auditEvents) {
52
+ * console.log(event.id);
53
+ * console.log(event.type);
54
+ * console.log(event.created);
55
+ * console.log(event.accountId);
56
+ * console.log(event.requestId);
57
+ * console.log(event.request);
58
+ * console.log(event.response);
59
+ * console.log(event.ipAddress);
60
+ * console.log(event.country);
61
+ * console.log(event.msisdn);
62
+ * }
63
+ * ```
64
+ */
8
65
  async *getEvents(params) {
9
66
  let totalPages = 0;
10
67
  let page = params?.page || 1;
11
68
  do {
12
69
  params.page = page;
13
70
  const resp = await this.sendGetRequest(`${this.config.apiHost}/${this.BASE_PATH}/audit/events`, server_client_1.Client.transformers.snakeCaseObjectKeys(params));
14
- const events = (resp.data?._embedded.events || []).map((event) => server_client_1.Client.transformers.camelCaseObjectKeys(event, true));
71
+ const events = (resp.data?._embedded?.events || []).map((event) => server_client_1.Client.transformers.camelCaseObjectKeys(event, true));
15
72
  totalPages = resp.data?.page?.totalPages || 0;
16
73
  yield* events;
17
74
  page++;
18
75
  } while (page <= totalPages);
19
76
  }
77
+ /**
78
+ * Retrieves a specific audit event by its ID.
79
+ *
80
+ * @param {string} eventId - The ID of the audit event to retrieve.
81
+ * @return {Promise<AuditEvent>} A promise that resolves to the retrieved audit event.
82
+ *
83
+ * @example
84
+ * Retrieve a specific audit event
85
+ *
86
+ * ```ts
87
+ * const auditEvent = await auditClient.getEvent('event-id');
88
+ * console.log(auditEvent.id);
89
+ * ```
90
+ */
20
91
  async getEvent(eventId) {
21
92
  const resp = await this.sendGetRequest(`${this.config.apiHost}/${this.BASE_PATH}/audit/events/${eventId}`);
22
93
  return server_client_1.Client.transformers.camelCaseObjectKeys(resp.data, true);
23
94
  }
24
95
  }
25
96
  exports.Audit = Audit;
26
- //# sourceMappingURL=audit.js.map
package/dist/enums.d.ts CHANGED
@@ -1,29 +1,123 @@
1
+ /**
2
+ * Audit Events are generated automatically by Vonage as the user interacts with
3
+ * either a Vonage API or the Vonage Dashboard. Each Audit Event object has a
4
+ * type and associated metadata.
5
+ *
6
+ * @remarks
7
+ *
8
+ * The list of supported event types does change from time to time. For
9
+ * this reason the OPTIONS method is provided to return event types. You can
10
+ * see how to return the definitive list of event types from the {@link https://developer.vonage.com/en/audit/code-snippets/get-event-types}
11
+ *
12
+ * @see Documentation {@link https://developer.vonage.com/en/audit/concepts/audit-events}
13
+ */
1
14
  export declare enum AuditEventTypes {
2
- 'USER_STATUS' = "USER_STATUS",
3
- 'USER_UPDATE' = "USER_UPDATE",
4
- 'USER_BILLING_UPDATE' = "USER_BILLING_UPDATE",
5
- 'USER_CREATE' = "USER_CREATE",
6
- 'USER_LOGIN' = "USER_LOGIN",
7
- 'USER_LOGOUT' = "USER_LOGOUT",
8
- 'USER_PRODUCT_SEARCH' = "USER_PRODUCT_SEARCH",
9
- 'USER_API_KEYS_UPDATE' = "USER_API_KEYS_UPDATE",
10
- 'ACCOUNT_SECRET_DELETE' = "ACCOUNT_SECRET_DELETE",
11
- 'ACCOUNT_SECRET_CREATE' = "ACCOUNT_SECRET_CREATE",
12
- 'ACCOUNT_UPDATE_SPAMMER' = "ACCOUNT_UPDATE_SPAMMER",
13
- 'ACCOUNT_UPDATE_SETTINGS_API' = "ACCOUNT_UPDATE_SETTINGS_API",
14
- 'NUMBER_ASSIGN' = "NUMBER_ASSIGN",
15
- 'NUMBER_UPDATED' = "NUMBER_UPDATED",
16
- 'NUMBER_RELEASE' = "NUMBER_RELEASE",
17
- 'NUMBER_LINKED' = "NUMBER_LINKED",
18
- 'NUMBER_UNLINKED' = "NUMBER_UNLINKED",
19
- 'APP_CREATE' = "APP_CREATE",
20
- 'APP_UPDATE' = "APP_UPDATE",
21
- 'APP_DELETE' = "APP_DELETE",
22
- 'APP_DISABLE' = "APP_DISABLE",
23
- 'APP_ENABLE' = "APP_ENABLE",
24
- 'IP_WHITELIST_CREATE' = "IP_WHITELIST_CREATE",
25
- 'IP_WHITELIST_DELETE' = "IP_WHITELIST_DELETE",
26
- 'AUTORELOAD_ENABLE' = "AUTORELOAD_ENABLE",
27
- 'AUTORELOAD_UPDATE' = "AUTORELOAD_UPDATE",
28
- 'AUTORELOAD_DISABLE' = "AUTORELOAD_DISABLE"
15
+ /**
16
+ * User status updated.
17
+ */
18
+ USER_STATUS = "USER_STATUS",
19
+ /**
20
+ * User updated.
21
+ */
22
+ USER_UPDATE = "USER_UPDATE",
23
+ /**
24
+ * User billing updated.
25
+ */
26
+ USER_BILLING_UPDATE = "USER_BILLING_UPDATE",
27
+ /**
28
+ * User created.
29
+ */
30
+ USER_CREATE = "USER_CREATE",
31
+ /**
32
+ * User login (Premium Support only).
33
+ */
34
+ USER_LOGIN = "USER_LOGIN",
35
+ /**
36
+ * User logout (Premium Support only).
37
+ */
38
+ USER_LOGOUT = "USER_LOGOUT",
39
+ /**
40
+ * Relates to searching for CDRs or logs in Dashboard.
41
+ */
42
+ USER_PRODUCT_SEARCH = "USER_PRODUCT_SEARCH",
43
+ /**
44
+ * Sub-accounts for user updated.
45
+ */
46
+ USER_API_KEYS_UPDATE = "USER_API_KEYS_UPDATE",
47
+ /**
48
+ * Secret Rotation operation.
49
+ */
50
+ ACCOUNT_SECRET_DELETE = "ACCOUNT_SECRET_DELETE",
51
+ /**
52
+ * Secret Rotation operation.
53
+ */
54
+ ACCOUNT_SECRET_CREATE = "ACCOUNT_SECRET_CREATE",
55
+ /**
56
+ * Account Settings updated via API.
57
+ */
58
+ ACCOUNT_UPDATE_SPAMMER = "ACCOUNT_UPDATE_SPAMMER",
59
+ /**
60
+ * Account Settings updated via API.
61
+ */
62
+ ACCOUNT_UPDATE_SETTINGS_API = "ACCOUNT_UPDATE_SETTINGS_API",
63
+ /**
64
+ * Number assigned.
65
+ */
66
+ NUMBER_ASSIGN = "NUMBER_ASSIGN",
67
+ /**
68
+ * Number updated.
69
+ */
70
+ NUMBER_UPDATED = "NUMBER_UPDATED",
71
+ /**
72
+ * Number released.
73
+ */
74
+ NUMBER_RELEASE = "NUMBER_RELEASE",
75
+ /**
76
+ * Number linked to Vonage application.
77
+ */
78
+ NUMBER_LINKED = "NUMBER_LINKED",
79
+ /**
80
+ * Number unlinked from Vonage application.
81
+ */
82
+ NUMBER_UNLINKED = "NUMBER_UNLINKED",
83
+ /**
84
+ * App created.
85
+ */
86
+ APP_CREATE = "APP_CREATE",
87
+ /**
88
+ * App updated.
89
+ */
90
+ APP_UPDATE = "APP_UPDATE",
91
+ /**
92
+ * App deleted.
93
+ */
94
+ APP_DELETE = "APP_DELETE",
95
+ /**
96
+ * App disabled.
97
+ */
98
+ APP_DISABLE = "APP_DISABLE",
99
+ /**
100
+ * App enabled.
101
+ */
102
+ APP_ENABLE = "APP_ENABLE",
103
+ /**
104
+ * Whitelist IP added.
105
+ */
106
+ IP_WHITELIST_CREATE = "IP_WHITELIST_CREATE",
107
+ /**
108
+ * Whitelist IP deleted.
109
+ */
110
+ IP_WHITELIST_DELETE = "IP_WHITELIST_DELETE",
111
+ /**
112
+ * Automatic reload enabled.
113
+ */
114
+ AUTORELOAD_ENABLE = "AUTORELOAD_ENABLE",
115
+ /**
116
+ * Automatic reload settings updated.
117
+ */
118
+ AUTORELOAD_UPDATE = "AUTORELOAD_UPDATE",
119
+ /**
120
+ * Automatic reload disabled.
121
+ */
122
+ AUTORELOAD_DISABLE = "AUTORELOAD_DISABLE"
29
123
  }
package/dist/enums.js CHANGED
@@ -1,34 +1,127 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AuditEventTypes = void 0;
4
+ /**
5
+ * Audit Events are generated automatically by Vonage as the user interacts with
6
+ * either a Vonage API or the Vonage Dashboard. Each Audit Event object has a
7
+ * type and associated metadata.
8
+ *
9
+ * @remarks
10
+ *
11
+ * The list of supported event types does change from time to time. For
12
+ * this reason the OPTIONS method is provided to return event types. You can
13
+ * see how to return the definitive list of event types from the {@link https://developer.vonage.com/en/audit/code-snippets/get-event-types}
14
+ *
15
+ * @see Documentation {@link https://developer.vonage.com/en/audit/concepts/audit-events}
16
+ */
4
17
  var AuditEventTypes;
5
18
  (function (AuditEventTypes) {
19
+ /**
20
+ * User status updated.
21
+ */
6
22
  AuditEventTypes["USER_STATUS"] = "USER_STATUS";
23
+ /**
24
+ * User updated.
25
+ */
7
26
  AuditEventTypes["USER_UPDATE"] = "USER_UPDATE";
27
+ /**
28
+ * User billing updated.
29
+ */
8
30
  AuditEventTypes["USER_BILLING_UPDATE"] = "USER_BILLING_UPDATE";
31
+ /**
32
+ * User created.
33
+ */
9
34
  AuditEventTypes["USER_CREATE"] = "USER_CREATE";
35
+ /**
36
+ * User login (Premium Support only).
37
+ */
10
38
  AuditEventTypes["USER_LOGIN"] = "USER_LOGIN";
39
+ /**
40
+ * User logout (Premium Support only).
41
+ */
11
42
  AuditEventTypes["USER_LOGOUT"] = "USER_LOGOUT";
43
+ /**
44
+ * Relates to searching for CDRs or logs in Dashboard.
45
+ */
12
46
  AuditEventTypes["USER_PRODUCT_SEARCH"] = "USER_PRODUCT_SEARCH";
47
+ /**
48
+ * Sub-accounts for user updated.
49
+ */
13
50
  AuditEventTypes["USER_API_KEYS_UPDATE"] = "USER_API_KEYS_UPDATE";
51
+ /**
52
+ * Secret Rotation operation.
53
+ */
14
54
  AuditEventTypes["ACCOUNT_SECRET_DELETE"] = "ACCOUNT_SECRET_DELETE";
55
+ /**
56
+ * Secret Rotation operation.
57
+ */
15
58
  AuditEventTypes["ACCOUNT_SECRET_CREATE"] = "ACCOUNT_SECRET_CREATE";
59
+ /**
60
+ * Account Settings updated via API.
61
+ */
16
62
  AuditEventTypes["ACCOUNT_UPDATE_SPAMMER"] = "ACCOUNT_UPDATE_SPAMMER";
63
+ /**
64
+ * Account Settings updated via API.
65
+ */
17
66
  AuditEventTypes["ACCOUNT_UPDATE_SETTINGS_API"] = "ACCOUNT_UPDATE_SETTINGS_API";
67
+ /**
68
+ * Number assigned.
69
+ */
18
70
  AuditEventTypes["NUMBER_ASSIGN"] = "NUMBER_ASSIGN";
71
+ /**
72
+ * Number updated.
73
+ */
19
74
  AuditEventTypes["NUMBER_UPDATED"] = "NUMBER_UPDATED";
75
+ /**
76
+ * Number released.
77
+ */
20
78
  AuditEventTypes["NUMBER_RELEASE"] = "NUMBER_RELEASE";
79
+ /**
80
+ * Number linked to Vonage application.
81
+ */
21
82
  AuditEventTypes["NUMBER_LINKED"] = "NUMBER_LINKED";
83
+ /**
84
+ * Number unlinked from Vonage application.
85
+ */
22
86
  AuditEventTypes["NUMBER_UNLINKED"] = "NUMBER_UNLINKED";
87
+ /**
88
+ * App created.
89
+ */
23
90
  AuditEventTypes["APP_CREATE"] = "APP_CREATE";
91
+ /**
92
+ * App updated.
93
+ */
24
94
  AuditEventTypes["APP_UPDATE"] = "APP_UPDATE";
95
+ /**
96
+ * App deleted.
97
+ */
25
98
  AuditEventTypes["APP_DELETE"] = "APP_DELETE";
99
+ /**
100
+ * App disabled.
101
+ */
26
102
  AuditEventTypes["APP_DISABLE"] = "APP_DISABLE";
103
+ /**
104
+ * App enabled.
105
+ */
27
106
  AuditEventTypes["APP_ENABLE"] = "APP_ENABLE";
107
+ /**
108
+ * Whitelist IP added.
109
+ */
28
110
  AuditEventTypes["IP_WHITELIST_CREATE"] = "IP_WHITELIST_CREATE";
111
+ /**
112
+ * Whitelist IP deleted.
113
+ */
29
114
  AuditEventTypes["IP_WHITELIST_DELETE"] = "IP_WHITELIST_DELETE";
115
+ /**
116
+ * Automatic reload enabled.
117
+ */
30
118
  AuditEventTypes["AUTORELOAD_ENABLE"] = "AUTORELOAD_ENABLE";
119
+ /**
120
+ * Automatic reload settings updated.
121
+ */
31
122
  AuditEventTypes["AUTORELOAD_UPDATE"] = "AUTORELOAD_UPDATE";
123
+ /**
124
+ * Automatic reload disabled.
125
+ */
32
126
  AuditEventTypes["AUTORELOAD_DISABLE"] = "AUTORELOAD_DISABLE";
33
127
  })(AuditEventTypes || (exports.AuditEventTypes = AuditEventTypes = {}));
34
- //# sourceMappingURL=enums.js.map
package/dist/index.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- export { Audit } from './audit';
1
+ export * from './audit';
2
2
  export * from './enums';
3
- export * from './interfaces/auditResponse';
4
- export { AuditParams } from './types/auditParams';
5
- export { AuditEvent } from './types/auditEvent';
6
- export { AuditEventPage } from './interfaces/auditEventPage';
7
- export { AuditEventListResponse } from './interfaces/auditEventListResponse';
3
+ export * from './types';
package/dist/index.js CHANGED
@@ -14,9 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Audit = void 0;
18
- var audit_1 = require("./audit");
19
- Object.defineProperty(exports, "Audit", { enumerable: true, get: function () { return audit_1.Audit; } });
17
+ __exportStar(require("./audit"), exports);
20
18
  __exportStar(require("./enums"), exports);
21
- __exportStar(require("./interfaces/auditResponse"), exports);
22
- //# sourceMappingURL=index.js.map
19
+ __exportStar(require("./types"), exports);
@@ -1,13 +1,47 @@
1
1
  import { AuditEventTypes } from '../enums';
2
+ /**
3
+ * Represents an Audit Event.
4
+ */
2
5
  export type AuditEvent = {
6
+ /**
7
+ * UUID of the audit event.
8
+ */
3
9
  id: string;
4
- eventType: AuditEventTypes;
10
+ /**
11
+ * The type of the audit event.
12
+ *
13
+ */
14
+ eventType: AuditEventTypes | string;
15
+ /**
16
+ * The date when the audit event was created.
17
+ */
5
18
  createdAt: string;
19
+ /**
20
+ * Email of the user whose account the audit event is associated with.
21
+ */
6
22
  userEmail?: string;
23
+ /**
24
+ * The ID of the user that the audit event is associated with.
25
+ */
7
26
  userId?: string;
27
+ /**
28
+ * The API_KEY of the Vonage API account that the audit event is associated with.
29
+ */
8
30
  accountId: string;
9
- source: string;
10
- sourceDescription: string;
31
+ /**
32
+ * The source of the event.
33
+ */
34
+ source: 'CD' | 'DEVAPI';
35
+ /**
36
+ * Description of the audit event source.
37
+ */
38
+ sourceDescription: 'Customer Dashboard' | 'Developer API';
39
+ /**
40
+ * ISO 3166-1 Alpha-2 country code recorded for the event.
41
+ */
11
42
  sourceCountry: string;
12
- context?: object;
43
+ /**
44
+ * Additional context information for the audit event.
45
+ */
46
+ context?: unknown;
13
47
  };
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=auditEvent.js.map
@@ -0,0 +1,26 @@
1
+ import { APILinks } from '@vonage/server-client';
2
+ import { AuditEvent } from './auditEvent';
3
+ import { AuditEventPage } from './auditEventPage';
4
+ /**
5
+ * Represents the response containing a list of audit events.
6
+ *
7
+ * @remarks
8
+ * Vonage API's will return information using `snake_case`. This represents the
9
+ * pure response before the client will transform the keys into `camelCase`
10
+ */
11
+ export type AuditEventListResponse = {
12
+ /**
13
+ * An object containing an array of audit events.
14
+ */
15
+ _embedded?: {
16
+ events: AuditEvent[];
17
+ };
18
+ /**
19
+ * Links associated with the API response.
20
+ */
21
+ _links: APILinks;
22
+ /**
23
+ * Information about the pagination and page details.
24
+ */
25
+ page: AuditEventPage;
26
+ };
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=auditEventListResponse.js.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Represents information about the pagination of audit events.
3
+ */
4
+ export type AuditEventPage = {
5
+ /**
6
+ * The number of items per page.
7
+ */
8
+ size: number;
9
+ /**
10
+ * The total number of elements across all pages.
11
+ */
12
+ totalElements: number;
13
+ /**
14
+ * The total number of pages available.
15
+ */
16
+ totalPages: number;
17
+ /**
18
+ * The current page number.
19
+ */
20
+ number: number;
21
+ };
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=auditEventPage.js.map
@@ -0,0 +1,40 @@
1
+ import { AuditEventTypes } from '../enums';
2
+ import { AuditEvent } from './auditEvent';
3
+ /**
4
+ * Represents an Audit Event.
5
+ *
6
+ * @remarks
7
+ * Vonage API's will return information using `snake_case`. This represents the
8
+ * pure response before the client will transform the keys into `camelCase`
9
+ */
10
+ export type AuditEventResponse = {
11
+ /**
12
+ * The type of the audit event.
13
+ *
14
+ */
15
+ event_type: AuditEventTypes | string;
16
+ /**
17
+ * The date when the audit event was created.
18
+ */
19
+ created_at: string;
20
+ /**
21
+ * Email of the user whose account the audit event is associated with.
22
+ */
23
+ user_email?: string;
24
+ /**
25
+ * The ID of the user that the audit event is associated with.
26
+ */
27
+ user_id?: string;
28
+ /**
29
+ * The API_KEY of the Vonage API account that the audit event is associated with.
30
+ */
31
+ account_id: string;
32
+ /**
33
+ * Description of the audit event source.
34
+ */
35
+ source_description: Pick<AuditEvent, 'sourceDescription'>;
36
+ /**
37
+ * ISO 3166-1 Alpha-2 country code recorded for the event.
38
+ */
39
+ source_country: string;
40
+ } & Pick<AuditEvent, 'id' | 'source' | 'context'>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +1,30 @@
1
1
  import { AuditEventTypes } from '../enums';
2
+ /**
3
+ * Represents parameters for querying audit events.
4
+ */
2
5
  export type AuditParams = {
3
- eventType?: AuditEventTypes;
6
+ /**
7
+ * The type of the audit event to filter by.
8
+ */
9
+ eventType?: AuditEventTypes | string;
10
+ /**
11
+ * The start date for the audit event query.
12
+ */
4
13
  dateFrom?: string;
14
+ /**
15
+ * The end date for the audit event query.
16
+ */
5
17
  dateTo?: string;
18
+ /**
19
+ * Text to search within audit event descriptions.
20
+ */
6
21
  searchText?: string;
22
+ /**
23
+ * The page number for paginated results.
24
+ */
7
25
  page?: number;
26
+ /**
27
+ * The number of items per page.
28
+ */
8
29
  size?: number;
9
30
  };
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=auditParams.js.map
@@ -1,2 +1,5 @@
1
1
  import { VetchResponse } from '@vonage/vetch';
2
+ /**
3
+ * @deprecated this is not used
4
+ */
2
5
  export type AuditResponse<T> = VetchResponse<T>;
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=auditResponse.js.map
@@ -0,0 +1,6 @@
1
+ export * from './auditEvent';
2
+ export * from './auditEventListResponse';
3
+ export * from './auditEventPage';
4
+ export * from './auditParams';
5
+ export * from './auditResponse';
6
+ export * from './auditEventResponse';
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./auditEvent"), exports);
18
+ __exportStar(require("./auditEventListResponse"), exports);
19
+ __exportStar(require("./auditEventPage"), exports);
20
+ __exportStar(require("./auditParams"), exports);
21
+ __exportStar(require("./auditResponse"), exports);
22
+ __exportStar(require("./auditEventResponse"), exports);
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
+ "$schema": "https://json.schemastore.org/package.json",
2
3
  "name": "@vonage/audit",
3
- "version": "1.8.2",
4
+ "version": "1.10.0",
4
5
  "description": "Vonage Audit SDK Package",
5
6
  "homepage": "https://github.com/vonage/vonage-node-sdk/tree/master/packages/audit#readme",
6
7
  "bugs": {
@@ -11,7 +12,12 @@
11
12
  "url": "git+https://github.com/Vonage/vonage-node-sdk.git"
12
13
  },
13
14
  "license": "Apache-2.0",
14
- "author": "Chuck \"MANCHUCK\" Reeves",
15
+ "contributors": [
16
+ {
17
+ "name": "Chuck \"MANCHUCK\" Reeves",
18
+ "url": "https://github.com/manchuck"
19
+ }
20
+ ],
15
21
  "main": "dist/index.js",
16
22
  "types": "dist/index.d.ts",
17
23
  "directories": {
@@ -24,15 +30,16 @@
24
30
  "scripts": {
25
31
  "build": "npm run clean && npm run compile",
26
32
  "clean": "npx shx rm -rf dist tsconfig.tsbuildinfo",
27
- "compile": "npx tsc --build --verbose"
33
+ "compile": "npx tsc --build --verbose",
34
+ "prepublishOnly": "npm run build"
28
35
  },
29
36
  "dependencies": {
30
- "@vonage/auth": "^1.6.0",
31
- "@vonage/server-client": "^1.8.2",
32
- "@vonage/vetch": "^1.5.1"
37
+ "@vonage/auth": "^1.8.0",
38
+ "@vonage/server-client": "^1.10.0",
39
+ "@vonage/vetch": "^1.7.0"
33
40
  },
34
41
  "devDependencies": {
35
- "nock": "^13.3.1"
42
+ "nock": "^13.3.4"
36
43
  },
37
44
  "publishConfig": {
38
45
  "directory": "dist"
package/dist/audit.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"audit.js","sourceRoot":"","sources":["../lib/audit.ts"],"names":[],"mappings":";;;AAAA,yDAAmE;AAKnE,MAAa,KAAM,SAAQ,sBAAM;IACrB,SAAS,GAAG,MAAM,CAAC;IACnB,QAAQ,GAAG,kCAAkB,CAAC,KAAK,CAAC;IAE9C,KAAK,CAAC,CAAC,SAAS,CACd,MAAmB;QAEnB,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,IAAI,GAAG,MAAM,EAAE,IAAI,IAAI,CAAC,CAAC;QAC7B,GAAG;YACD,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;YACnB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,cAAc,CACpC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,SAAS,eAAe,EACvD,sBAAM,CAAC,YAAY,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAChD,CAAC;YAEF,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAC/D,sBAAM,CAAC,YAAY,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,CACrD,CAAC;YAEF,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,IAAI,CAAC,CAAC;YAE9C,KAAK,CAAC,CAAC,MAAM,CAAC;YACd,IAAI,EAAE,CAAC;SACR,QAAQ,IAAI,IAAI,UAAU,EAAE;IAC/B,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,OAAe;QACnC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,cAAc,CACpC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,SAAS,iBAAiB,OAAO,EAAE,CACnE,CAAC;QACF,OAAO,sBAAM,CAAC,YAAY,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;CACF;AAjCD,sBAiCC"}
package/dist/enums.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"enums.js","sourceRoot":"","sources":["../lib/enums.ts"],"names":[],"mappings":";;;AAAA,IAAY,eA4BX;AA5BD,WAAY,eAAe;IACvB,8CAA6B,CAAA;IAC7B,8CAA6B,CAAA;IAC7B,8DAA6C,CAAA;IAC7C,8CAA6B,CAAA;IAC7B,4CAA2B,CAAA;IAC3B,8CAA6B,CAAA;IAC7B,8DAA6C,CAAA;IAC7C,gEAA+C,CAAA;IAC/C,kEAAiD,CAAA;IACjD,kEAAiD,CAAA;IACjD,oEAAmD,CAAA;IACnD,8EAA6D,CAAA;IAC7D,kDAAiC,CAAA;IACjC,oDAAmC,CAAA;IACnC,oDAAmC,CAAA;IACnC,kDAAiC,CAAA;IACjC,sDAAqC,CAAA;IACrC,4CAA2B,CAAA;IAC3B,4CAA2B,CAAA;IAC3B,4CAA2B,CAAA;IAC3B,8CAA6B,CAAA;IAC7B,4CAA2B,CAAA;IAC3B,8DAA6C,CAAA;IAC7C,8DAA6C,CAAA;IAC7C,0DAAyC,CAAA;IACzC,0DAAyC,CAAA;IACzC,4DAA2C,CAAA;AAC/C,CAAC,EA5BW,eAAe,+BAAf,eAAe,QA4B1B"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AAEd,0CAAwB;AAExB,6DAA2C"}
@@ -1,10 +0,0 @@
1
- import { APILinks } from '@vonage/server-client';
2
- import { AuditEvent } from '../types/auditEvent';
3
- import { AuditEventPage } from './auditEventPage';
4
- export interface AuditEventListResponse {
5
- _embedded?: {
6
- events: AuditEvent[];
7
- };
8
- _links: APILinks;
9
- page: AuditEventPage;
10
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"auditEventListResponse.js","sourceRoot":"","sources":["../../lib/interfaces/auditEventListResponse.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- export interface AuditEventPage {
2
- size: number;
3
- totalElements: number;
4
- totalPages: number;
5
- number: number;
6
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"auditEventPage.js","sourceRoot":"","sources":["../../lib/interfaces/auditEventPage.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"auditResponse.js","sourceRoot":"","sources":["../../lib/interfaces/auditResponse.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"auditEvent.js","sourceRoot":"","sources":["../../lib/types/auditEvent.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"auditParams.js","sourceRoot":"","sources":["../../lib/types/auditParams.ts"],"names":[],"mappings":""}