@workos-inc/node 3.1.0 → 3.1.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.
@@ -1,4 +1,3 @@
1
- export * from './at-least-one-property-of.interface';
2
1
  export * from './event.interface';
3
2
  export * from './get-options.interface';
4
3
  export * from './list.interface';
@@ -14,7 +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
- __exportStar(require("./at-least-one-property-of.interface"), exports);
18
17
  __exportStar(require("./event.interface"), exports);
19
18
  __exportStar(require("./get-options.interface"), exports);
20
19
  __exportStar(require("./list.interface"), exports);
@@ -19,7 +19,7 @@ class DirectorySync {
19
19
  }
20
20
  listDirectories(options) {
21
21
  return __awaiter(this, void 0, void 0, function* () {
22
- return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/directories', serializers_1.deserializeDirectory, options), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/directories', serializers_1.deserializeDirectory, params), options);
22
+ return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/directories', serializers_1.deserializeDirectory, options ? (0, serializers_1.serializeListDirectoriesOptions)(options) : undefined), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/directories', serializers_1.deserializeDirectory, params), options);
23
23
  });
24
24
  }
25
25
  getDirectory(id) {
@@ -130,10 +130,12 @@ describe('DirectorySync', () => {
130
130
  mock
131
131
  .onGet('/directories', {
132
132
  domain: 'google.com',
133
+ organization_id: 'org_1234',
133
134
  })
134
135
  .replyOnce(200, directoryListResponse);
135
136
  const subject = yield workos.directorySync.listDirectories({
136
137
  domain: 'google.com',
138
+ organizationId: 'org_1234',
137
139
  });
138
140
  expect(subject).toMatchObject({
139
141
  object: 'list',
@@ -4,3 +4,8 @@ export interface ListDirectoriesOptions extends PaginationOptions {
4
4
  organizationId?: string;
5
5
  search?: string;
6
6
  }
7
+ export interface SerializedListDirectoriesOptions extends PaginationOptions {
8
+ domain?: string;
9
+ organization_id?: string;
10
+ search?: string;
11
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './directory-group.serializer';
2
2
  export * from './directory-user.serializer';
3
3
  export * from './directory.serializer';
4
+ export * from './list-directories-options.serializer';
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./directory-group.serializer"), exports);
18
18
  __exportStar(require("./directory-user.serializer"), exports);
19
19
  __exportStar(require("./directory.serializer"), exports);
20
+ __exportStar(require("./list-directories-options.serializer"), exports);
@@ -0,0 +1,2 @@
1
+ import { ListDirectoriesOptions, SerializedListDirectoriesOptions } from '../interfaces';
2
+ export declare const serializeListDirectoriesOptions: (options: ListDirectoriesOptions) => SerializedListDirectoriesOptions;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serializeListDirectoriesOptions = void 0;
4
+ const serializeListDirectoriesOptions = (options) => ({
5
+ domain: options.domain,
6
+ organization_id: options.organizationId,
7
+ search: options.search,
8
+ limit: options.limit,
9
+ before: options.before,
10
+ after: options.after,
11
+ order: options.order,
12
+ });
13
+ exports.serializeListDirectoriesOptions = serializeListDirectoriesOptions;
@@ -1,3 +1,4 @@
1
1
  export * from './connection.serializer';
2
+ export * from './list-connections-options.serializer';
2
3
  export * from './profile-and-token.serializer';
3
4
  export * from './profile.serializer';
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./connection.serializer"), exports);
18
+ __exportStar(require("./list-connections-options.serializer"), exports);
18
19
  __exportStar(require("./profile-and-token.serializer"), exports);
19
20
  __exportStar(require("./profile.serializer"), exports);
@@ -0,0 +1,2 @@
1
+ import { ListConnectionsOptions, SerializedListConnectionsOptions } from '../interfaces';
2
+ export declare const serializeListConnectionsOptions: (options: ListConnectionsOptions) => SerializedListConnectionsOptions;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serializeListConnectionsOptions = void 0;
4
+ const serializeListConnectionsOptions = (options) => ({
5
+ connection_type: options.connectionType,
6
+ domain: options.domain,
7
+ organization_id: options.organizationId,
8
+ limit: options.limit,
9
+ before: options.before,
10
+ after: options.after,
11
+ order: options.order,
12
+ });
13
+ exports.serializeListConnectionsOptions = serializeListConnectionsOptions;
package/lib/sso/sso.js CHANGED
@@ -30,7 +30,7 @@ class SSO {
30
30
  }
31
31
  listConnections(options) {
32
32
  return __awaiter(this, void 0, void 0, function* () {
33
- return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/connections', serializers_1.deserializeConnection, options), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/connections', serializers_1.deserializeConnection, params), options);
33
+ return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/connections', serializers_1.deserializeConnection, options ? (0, serializers_1.serializeListConnectionsOptions)(options) : undefined), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/connections', serializers_1.deserializeConnection, params), options);
34
34
  });
35
35
  }
36
36
  deleteConnection(id) {
@@ -309,7 +309,9 @@ describe('SSO', () => {
309
309
  list_metadata: {},
310
310
  });
311
311
  const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
312
- const subject = yield workos.sso.listConnections();
312
+ const subject = yield workos.sso.listConnections({
313
+ organizationId: 'org_1234',
314
+ });
313
315
  expect(mock.history.get[0].url).toEqual('/connections');
314
316
  expect(subject.data).toHaveLength(1);
315
317
  }));
@@ -1,14 +1,9 @@
1
- import { AtLeastOnePropertyOf } from '../../common/interfaces';
2
- interface BaseUpdateUserOptions {
1
+ export interface UpdateUserOptions {
3
2
  userId: string;
3
+ firstName?: string;
4
+ lastName?: string;
4
5
  }
5
- interface UpdateUserOptionsProperties {
6
- firstName: string;
7
- lastName: string;
8
- }
9
- export type UpdateUserOptions = BaseUpdateUserOptions & AtLeastOnePropertyOf<UpdateUserOptionsProperties>;
10
6
  export interface SerializedUpdateUserOptions {
11
7
  first_name?: string;
12
8
  last_name?: string;
13
9
  }
14
- export {};
package/lib/workos.js CHANGED
@@ -27,7 +27,7 @@ const mfa_1 = require("./mfa/mfa");
27
27
  const audit_logs_1 = require("./audit-logs/audit-logs");
28
28
  const users_1 = require("./users/users");
29
29
  const bad_request_exception_1 = require("./common/exceptions/bad-request.exception");
30
- const VERSION = '3.1.0';
30
+ const VERSION = '3.1.1';
31
31
  const DEFAULT_HOSTNAME = 'api.workos.com';
32
32
  class WorkOS {
33
33
  constructor(key, options = {}) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.1.0",
2
+ "version": "3.1.1",
3
3
  "name": "@workos-inc/node",
4
4
  "author": "WorkOS",
5
5
  "description": "A Node wrapper for the WorkOS API",
@@ -49,4 +49,4 @@
49
49
  "tslint": "6.1.3",
50
50
  "typescript": "5.1.6"
51
51
  }
52
- }
52
+ }
@@ -1,7 +0,0 @@
1
- export type AtLeastOnePropertyOf<T> = {
2
- [K in keyof T]: {
3
- [L in K]: T[L];
4
- } & {
5
- [L in Exclude<keyof T, K>]?: T[L];
6
- };
7
- }[keyof T];
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });