@workos-inc/node 3.2.0 → 3.3.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/lib/common/interfaces/event.interface.d.ts +11 -11
- package/lib/common/serializers/event.serializer.js +2 -2
- package/lib/directory-sync/interfaces/directory-group.interface.d.ts +0 -20
- package/lib/directory-sync/serializers/directory-group.serializer.d.ts +2 -3
- package/lib/directory-sync/serializers/directory-group.serializer.js +1 -12
- package/lib/users/interfaces/update-user-options.interface.d.ts +2 -0
- package/lib/users/serializers/update-user-options.serializer.js +1 -0
- package/lib/users/users.spec.js +2 -0
- package/lib/workos.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DirectoryUser, DirectoryUserResponse,
|
|
1
|
+
import { DirectoryUser, DirectoryUserResponse, DirectoryGroup, DirectoryGroupResponse, EventDirectory, EventDirectoryResponse } from '../../directory-sync/interfaces';
|
|
2
2
|
import { Connection, ConnectionResponse } from '../../sso/interfaces';
|
|
3
3
|
export interface EventBase {
|
|
4
4
|
id: string;
|
|
@@ -58,34 +58,34 @@ export interface DsyncDeletedEventResponse extends EventResponseBase {
|
|
|
58
58
|
}
|
|
59
59
|
export interface DsyncGroupCreatedEvent extends EventBase {
|
|
60
60
|
event: 'dsync.group.created';
|
|
61
|
-
data:
|
|
61
|
+
data: DirectoryGroup;
|
|
62
62
|
}
|
|
63
63
|
export interface DsyncGroupCreatedEventResponse extends EventResponseBase {
|
|
64
64
|
event: 'dsync.group.created';
|
|
65
|
-
data:
|
|
65
|
+
data: DirectoryGroupResponse;
|
|
66
66
|
}
|
|
67
67
|
export interface DsyncGroupDeletedEvent extends EventBase {
|
|
68
68
|
event: 'dsync.group.deleted';
|
|
69
|
-
data:
|
|
69
|
+
data: DirectoryGroup;
|
|
70
70
|
}
|
|
71
71
|
export interface DsyncGroupDeletedEventResponse extends EventResponseBase {
|
|
72
72
|
event: 'dsync.group.deleted';
|
|
73
|
-
data:
|
|
73
|
+
data: DirectoryGroupResponse;
|
|
74
74
|
}
|
|
75
75
|
export interface DsyncGroupUpdatedEvent extends EventBase {
|
|
76
76
|
event: 'dsync.group.updated';
|
|
77
|
-
data:
|
|
77
|
+
data: DirectoryGroup & Record<'previousAttributes', any>;
|
|
78
78
|
}
|
|
79
79
|
export interface DsyncGroupUpdatedEventResponse extends EventResponseBase {
|
|
80
80
|
event: 'dsync.group.updated';
|
|
81
|
-
data:
|
|
81
|
+
data: DirectoryGroupResponse & Record<'previous_attributes', any>;
|
|
82
82
|
}
|
|
83
83
|
export interface DsyncGroupUserAddedEvent extends EventBase {
|
|
84
84
|
event: 'dsync.group.user_added';
|
|
85
85
|
data: {
|
|
86
86
|
directoryId: string;
|
|
87
87
|
user: DirectoryUser;
|
|
88
|
-
group:
|
|
88
|
+
group: DirectoryGroup;
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
export interface DsyncGroupUserAddedEventResponse extends EventResponseBase {
|
|
@@ -93,7 +93,7 @@ export interface DsyncGroupUserAddedEventResponse extends EventResponseBase {
|
|
|
93
93
|
data: {
|
|
94
94
|
directory_id: string;
|
|
95
95
|
user: DirectoryUserResponse;
|
|
96
|
-
group:
|
|
96
|
+
group: DirectoryGroupResponse;
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
export interface DsyncGroupUserRemovedEvent extends EventBase {
|
|
@@ -101,7 +101,7 @@ export interface DsyncGroupUserRemovedEvent extends EventBase {
|
|
|
101
101
|
data: {
|
|
102
102
|
directoryId: string;
|
|
103
103
|
user: DirectoryUser;
|
|
104
|
-
group:
|
|
104
|
+
group: DirectoryGroup;
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
export interface DsyncGroupUserRemovedEventResponse extends EventResponseBase {
|
|
@@ -109,7 +109,7 @@ export interface DsyncGroupUserRemovedEventResponse extends EventResponseBase {
|
|
|
109
109
|
data: {
|
|
110
110
|
directory_id: string;
|
|
111
111
|
user: DirectoryUserResponse;
|
|
112
|
-
group:
|
|
112
|
+
group: DirectoryGroupResponse;
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
export interface DsyncUserCreatedEvent extends EventBase {
|
|
@@ -20,7 +20,7 @@ const deserializeEvent = (event) => {
|
|
|
20
20
|
return Object.assign(Object.assign({}, eventBase), { event: event.event, data: (0, serializers_1.deserializeDeletedEventDirectory)(event.data) });
|
|
21
21
|
case 'dsync.group.created':
|
|
22
22
|
case 'dsync.group.deleted':
|
|
23
|
-
return Object.assign(Object.assign({}, eventBase), { event: event.event, data: (0, serializers_1.
|
|
23
|
+
return Object.assign(Object.assign({}, eventBase), { event: event.event, data: (0, serializers_1.deserializeDirectoryGroup)(event.data) });
|
|
24
24
|
case 'dsync.group.updated':
|
|
25
25
|
return Object.assign(Object.assign({}, eventBase), { event: event.event, data: (0, serializers_1.deserializeUpdatedEventDirectoryGroup)(event.data) });
|
|
26
26
|
case 'dsync.group.user_added':
|
|
@@ -28,7 +28,7 @@ const deserializeEvent = (event) => {
|
|
|
28
28
|
return Object.assign(Object.assign({}, eventBase), { event: event.event, data: {
|
|
29
29
|
directoryId: event.data.directory_id,
|
|
30
30
|
user: (0, serializers_1.deserializeDirectoryUser)(event.data.user),
|
|
31
|
-
group: event.data.group,
|
|
31
|
+
group: (0, serializers_1.deserializeDirectoryGroup)(event.data.group),
|
|
32
32
|
} });
|
|
33
33
|
case 'dsync.user.created':
|
|
34
34
|
case 'dsync.user.deleted':
|
|
@@ -18,23 +18,3 @@ export interface DirectoryGroupResponse {
|
|
|
18
18
|
updated_at: string;
|
|
19
19
|
raw_attributes: any;
|
|
20
20
|
}
|
|
21
|
-
export interface EventDirectoryGroup<TRawAttributes = any> {
|
|
22
|
-
id: string;
|
|
23
|
-
idpId: string;
|
|
24
|
-
directoryId: string;
|
|
25
|
-
organizationId: string | null;
|
|
26
|
-
name: string;
|
|
27
|
-
createdAt: string;
|
|
28
|
-
updatedAt: string;
|
|
29
|
-
rawAttributes: TRawAttributes;
|
|
30
|
-
}
|
|
31
|
-
export interface EventDirectoryGroupResponse<TRawAttributes = any> {
|
|
32
|
-
id: string;
|
|
33
|
-
idp_id: string;
|
|
34
|
-
directory_id: string;
|
|
35
|
-
organization_id: string | null;
|
|
36
|
-
name: string;
|
|
37
|
-
created_at: string;
|
|
38
|
-
updated_at: string;
|
|
39
|
-
raw_attributes: TRawAttributes;
|
|
40
|
-
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DirectoryGroup, DirectoryGroupResponse
|
|
1
|
+
import { DirectoryGroup, DirectoryGroupResponse } from '../interfaces';
|
|
2
2
|
export declare const deserializeDirectoryGroup: (directoryGroup: DirectoryGroupResponse) => DirectoryGroup;
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const deserializeUpdatedEventDirectoryGroup: (directoryGroup: EventDirectoryGroupResponse & Record<'previous_attributes', any>) => EventDirectoryGroup & Record<'previousAttributes', any>;
|
|
3
|
+
export declare const deserializeUpdatedEventDirectoryGroup: (directoryGroup: DirectoryGroupResponse & Record<'previous_attributes', any>) => DirectoryGroup & Record<'previousAttributes', any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deserializeUpdatedEventDirectoryGroup = exports.
|
|
3
|
+
exports.deserializeUpdatedEventDirectoryGroup = exports.deserializeDirectoryGroup = void 0;
|
|
4
4
|
const deserializeDirectoryGroup = (directoryGroup) => ({
|
|
5
5
|
id: directoryGroup.id,
|
|
6
6
|
idpId: directoryGroup.idp_id,
|
|
@@ -12,17 +12,6 @@ const deserializeDirectoryGroup = (directoryGroup) => ({
|
|
|
12
12
|
rawAttributes: directoryGroup.raw_attributes,
|
|
13
13
|
});
|
|
14
14
|
exports.deserializeDirectoryGroup = deserializeDirectoryGroup;
|
|
15
|
-
const deserializeEventDirectoryGroup = (directoryGroup) => ({
|
|
16
|
-
id: directoryGroup.id,
|
|
17
|
-
idpId: directoryGroup.idp_id,
|
|
18
|
-
directoryId: directoryGroup.directory_id,
|
|
19
|
-
organizationId: directoryGroup.organization_id,
|
|
20
|
-
name: directoryGroup.name,
|
|
21
|
-
createdAt: directoryGroup.created_at,
|
|
22
|
-
updatedAt: directoryGroup.updated_at,
|
|
23
|
-
rawAttributes: directoryGroup.raw_attributes,
|
|
24
|
-
});
|
|
25
|
-
exports.deserializeEventDirectoryGroup = deserializeEventDirectoryGroup;
|
|
26
15
|
const deserializeUpdatedEventDirectoryGroup = (directoryGroup) => ({
|
|
27
16
|
id: directoryGroup.id,
|
|
28
17
|
idpId: directoryGroup.idp_id,
|
|
@@ -4,5 +4,6 @@ exports.serializeUpdateUserOptions = void 0;
|
|
|
4
4
|
const serializeUpdateUserOptions = (options) => ({
|
|
5
5
|
first_name: options.firstName,
|
|
6
6
|
last_name: options.lastName,
|
|
7
|
+
email_verified_at: options.emailVerifiedAt,
|
|
7
8
|
});
|
|
8
9
|
exports.serializeUpdateUserOptions = serializeUpdateUserOptions;
|
package/lib/users/users.spec.js
CHANGED
|
@@ -335,11 +335,13 @@ describe('UserManagement', () => {
|
|
|
335
335
|
userId,
|
|
336
336
|
firstName: 'Dane',
|
|
337
337
|
lastName: 'Williams',
|
|
338
|
+
emailVerifiedAt: '2023-07-17T20:07:20.055Z',
|
|
338
339
|
});
|
|
339
340
|
expect(mock.history.put[0].url).toEqual(`/users/${userId}`);
|
|
340
341
|
expect(JSON.parse(mock.history.put[0].data)).toEqual({
|
|
341
342
|
first_name: 'Dane',
|
|
342
343
|
last_name: 'Williams',
|
|
344
|
+
email_verified_at: '2023-07-17T20:07:20.055Z',
|
|
343
345
|
});
|
|
344
346
|
expect(resp).toMatchObject({
|
|
345
347
|
email: 'test01@example.com',
|
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.
|
|
30
|
+
const VERSION = '3.3.0';
|
|
31
31
|
const DEFAULT_HOSTNAME = 'api.workos.com';
|
|
32
32
|
class WorkOS {
|
|
33
33
|
constructor(key, options = {}) {
|
package/package.json
CHANGED