@workos-inc/node 2.10.0 → 2.11.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.
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
11
22
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
24
  };
@@ -108,11 +119,10 @@ describe('AuditLogs', () => {
108
119
  });
109
120
  });
110
121
  describe('createExport', () => {
111
- const serializeExportOptions = (options) => ({
112
- organization_id: options.organization_id,
113
- range_start: options.range_start.toISOString(),
114
- range_end: options.range_end.toISOString(),
115
- });
122
+ const serializeExportOptions = (_a) => {
123
+ var { range_end, range_start } = _a, options = __rest(_a, ["range_end", "range_start"]);
124
+ return (Object.assign({ range_start: range_start.toISOString(), range_end: range_end.toISOString() }, options));
125
+ };
116
126
  describe('when the api responds with a 201', () => {
117
127
  it('returns `audit_log_export`', () => __awaiter(void 0, void 0, void 0, function* () {
118
128
  const options = {
@@ -135,6 +145,31 @@ describe('AuditLogs', () => {
135
145
  yield expect(workos.auditLogs.createExport(options)).resolves.toEqual(auditLogExport);
136
146
  }));
137
147
  });
148
+ describe('when additional filters are defined', () => {
149
+ it('returns `audit_log_export`', () => __awaiter(void 0, void 0, void 0, function* () {
150
+ const options = {
151
+ actions: ['foo', 'bar'],
152
+ actors: ['Jon', 'Smith'],
153
+ organization_id: 'org_123',
154
+ range_end: new Date(),
155
+ range_start: new Date(),
156
+ targets: ['user', 'team'],
157
+ };
158
+ const auditLogExport = {
159
+ object: 'audit_log_export',
160
+ id: 'audit_log_export_1234',
161
+ state: 'pending',
162
+ url: undefined,
163
+ created_at: new Date().toISOString(),
164
+ updated_at: new Date().toISOString(),
165
+ };
166
+ mock
167
+ .onPost('/audit_logs/exports', serializeExportOptions(options))
168
+ .replyOnce(201, auditLogExport);
169
+ const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
170
+ yield expect(workos.auditLogs.createExport(options)).resolves.toEqual(auditLogExport);
171
+ }));
172
+ });
138
173
  describe('when the api responds with a 401', () => {
139
174
  it('throws an UnauthorizedException', () => __awaiter(void 0, void 0, void 0, function* () {
140
175
  const options = {
@@ -1,5 +1,8 @@
1
1
  export interface AuditLogExportOptions {
2
+ actions?: string[];
3
+ actors?: string[];
2
4
  organization_id: string;
3
5
  range_end: Date;
4
6
  range_start: Date;
7
+ targets?: string[];
5
8
  }
@@ -1,3 +1,3 @@
1
1
  export * from './audit-log-export-options.interface';
2
2
  export * from './audit-log-export.interface';
3
- export { CreateAuditLogEventOptions, CreateAuditLogEventRequestOptions, } from './create-audit-log-event-options.interface';
3
+ export * from './create-audit-log-event-options.interface';
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./audit-log-export-options.interface"), exports);
18
18
  __exportStar(require("./audit-log-export.interface"), exports);
19
+ __exportStar(require("./create-audit-log-event-options.interface"), exports);
package/lib/workos.js CHANGED
@@ -25,7 +25,7 @@ const webhooks_1 = require("./webhooks/webhooks");
25
25
  const mfa_1 = require("./mfa/mfa");
26
26
  const audit_logs_1 = require("./audit-logs/audit-logs");
27
27
  const bad_request_exception_1 = require("./common/exceptions/bad-request.exception");
28
- const VERSION = '2.10.0';
28
+ const VERSION = '2.11.0';
29
29
  const DEFAULT_HOSTNAME = 'api.workos.com';
30
30
  class WorkOS {
31
31
  constructor(key, options = {}) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.10.0",
2
+ "version": "2.11.0",
3
3
  "name": "@workos-inc/node",
4
4
  "author": "WorkOS",
5
5
  "description": "A Node wrapper for the WorkOS API",