@workos-inc/node 2.0.0 → 2.1.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.
@@ -10,6 +10,7 @@ export declare class DirectorySync {
10
10
  private readonly workos;
11
11
  constructor(workos: WorkOS);
12
12
  listDirectories(options?: ListDirectoriesOptions): Promise<List<Directory>>;
13
+ getDirectory(id: string): Promise<Directory>;
13
14
  deleteDirectory(id: string): Promise<void>;
14
15
  listGroups(options: ListGroupsOptions): Promise<List<Group>>;
15
16
  listUsers<TCustomAttributes extends object = DefaultCustomAttributes>(options: ListUsersOptions): Promise<List<UserWithGroups<TCustomAttributes>>>;
@@ -22,6 +22,12 @@ class DirectorySync {
22
22
  return data;
23
23
  });
24
24
  }
25
+ getDirectory(id) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const { data } = yield this.workos.get(`/directories/${id}`);
28
+ return data;
29
+ });
30
+ }
25
31
  deleteDirectory(id) {
26
32
  return __awaiter(this, void 0, void 0, function* () {
27
33
  yield this.workos.delete(`/directories/${id}`);
@@ -33,6 +33,14 @@ describe('DirectorySync', () => {
33
33
  }));
34
34
  });
35
35
  });
36
+ describe('getDirectory', () => {
37
+ it(`requests a Directory`, () => __awaiter(void 0, void 0, void 0, function* () {
38
+ mock.onGet().reply(200, {});
39
+ const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
40
+ yield workos.directorySync.getDirectory('directory_123');
41
+ expect(mock.history.get[0].url).toEqual('/directories/directory_123');
42
+ }));
43
+ });
36
44
  describe('deleteDirectory', () => {
37
45
  it('sends a request to delete the directory', () => __awaiter(void 0, void 0, void 0, function* () {
38
46
  mock.onDelete().reply(202, {});
@@ -13,7 +13,7 @@ export interface User<TCustomAttributes extends object = DefaultCustomAttributes
13
13
  }[];
14
14
  username: string;
15
15
  last_name: string;
16
- state: 'active' | 'suspended';
16
+ state: 'active' | 'inactive' | 'suspended';
17
17
  }
18
18
  export interface UserWithGroups<TCustomAttributes extends object = DefaultCustomAttributes> extends User<TCustomAttributes> {
19
19
  groups: Group[];
package/lib/workos.js CHANGED
@@ -22,7 +22,7 @@ const passwordless_1 = require("./passwordless/passwordless");
22
22
  const portal_1 = require("./portal/portal");
23
23
  const sso_1 = require("./sso/sso");
24
24
  const webhooks_1 = require("./webhooks/webhooks");
25
- const VERSION = '2.0.0';
25
+ const VERSION = '2.1.0';
26
26
  const DEFAULT_HOSTNAME = 'api.workos.com';
27
27
  class WorkOS {
28
28
  constructor(key, options = {}) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.0",
2
+ "version": "2.1.0",
3
3
  "name": "@workos-inc/node",
4
4
  "author": "WorkOS",
5
5
  "description": "A Node wrapper for the WorkOS API",