@workos-inc/node 7.6.0 → 7.8.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/user-management/interfaces/enroll-auth-factor.interface.d.ts +2 -0
- package/lib/user-management/serializers/enroll-auth-factor-options.serializer.js +1 -0
- package/lib/user-management/user-management.d.ts +1 -0
- package/lib/user-management/user-management.js +6 -0
- package/lib/user-management/user-management.spec.js +17 -1
- package/lib/workos.js +1 -1
- package/package.json +1 -1
|
@@ -3,9 +3,11 @@ export interface EnrollAuthFactorOptions {
|
|
|
3
3
|
type: 'totp';
|
|
4
4
|
totpIssuer?: string;
|
|
5
5
|
totpUser?: string;
|
|
6
|
+
totpSecret?: string;
|
|
6
7
|
}
|
|
7
8
|
export interface SerializedEnrollUserInMfaFactorOptions {
|
|
8
9
|
type: 'totp';
|
|
9
10
|
totp_issuer?: string;
|
|
10
11
|
totp_user?: string;
|
|
12
|
+
totp_secret?: string;
|
|
11
13
|
}
|
|
@@ -64,6 +64,7 @@ export declare class UserManagement {
|
|
|
64
64
|
deactivateOrganizationMembership(organizationMembershipId: string): Promise<OrganizationMembership>;
|
|
65
65
|
reactivateOrganizationMembership(organizationMembershipId: string): Promise<OrganizationMembership>;
|
|
66
66
|
getInvitation(invitationId: string): Promise<Invitation>;
|
|
67
|
+
findInvitationByToken(invitationToken: string): Promise<Invitation>;
|
|
67
68
|
listInvitations(options: ListInvitationsOptions): Promise<AutoPaginatable<Invitation>>;
|
|
68
69
|
sendInvitation(payload: SendInvitationOptions): Promise<Invitation>;
|
|
69
70
|
revokeInvitation(invitationId: string): Promise<Invitation>;
|
|
@@ -241,6 +241,12 @@ class UserManagement {
|
|
|
241
241
|
return (0, invitation_serializer_1.deserializeInvitation)(data);
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
|
+
findInvitationByToken(invitationToken) {
|
|
245
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
246
|
+
const { data } = yield this.workos.get(`/user_management/invitations/by_token/${invitationToken}`);
|
|
247
|
+
return (0, invitation_serializer_1.deserializeInvitation)(data);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
244
250
|
listInvitations(options) {
|
|
245
251
|
return __awaiter(this, void 0, void 0, function* () {
|
|
246
252
|
return new pagination_1.AutoPaginatable(yield (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/user_management/invitations', invitation_serializer_1.deserializeInvitation, options ? (0, list_invitations_options_serializer_1.serializeListInvitationsOptions)(options) : undefined), (params) => (0, fetch_and_deserialize_1.fetchAndDeserialize)(this.workos, '/user_management/invitations', invitation_serializer_1.deserializeInvitation, params), options ? (0, list_invitations_options_serializer_1.serializeListInvitationsOptions)(options) : undefined);
|
|
@@ -31,6 +31,7 @@ const userId = 'user_01H5JQDV7R7ATEYZDEG0W5PRYS';
|
|
|
31
31
|
const organizationMembershipId = 'om_01H5JQDV7R7ATEYZDEG0W5PRYS';
|
|
32
32
|
const emailVerificationId = 'email_verification_01H5JQDV7R7ATEYZDEG0W5PRYS';
|
|
33
33
|
const invitationId = 'invitation_01H5JQDV7R7ATEYZDEG0W5PRYS';
|
|
34
|
+
const invitationToken = 'Z1uX3RbwcIl5fIGJJJCXXisdI';
|
|
34
35
|
const magicAuthId = 'magic_auth_01H5JQDV7R7ATEYZDEG0W5PRYS';
|
|
35
36
|
const passwordResetId = 'password_reset_01H5JQDV7R7ATEYZDEG0W5PRYS';
|
|
36
37
|
describe('UserManagement', () => {
|
|
@@ -528,6 +529,7 @@ describe('UserManagement', () => {
|
|
|
528
529
|
type: 'totp',
|
|
529
530
|
totpIssuer: 'WorkOS',
|
|
530
531
|
totpUser: 'some_user',
|
|
532
|
+
totpSecret: 'secret-test',
|
|
531
533
|
});
|
|
532
534
|
expect((0, test_utils_1.fetchURL)()).toContain(`/user_management/users/${userId}/auth_factors`);
|
|
533
535
|
expect(resp).toMatchObject({
|
|
@@ -741,7 +743,21 @@ describe('UserManagement', () => {
|
|
|
741
743
|
(0, test_utils_1.fetchOnce)(invitation_json_1.default);
|
|
742
744
|
const invitation = yield workos.userManagement.getInvitation(invitationId);
|
|
743
745
|
expect((0, test_utils_1.fetchURL)()).toContain(`/user_management/invitations/${invitationId}`);
|
|
744
|
-
expect(invitation).toMatchObject({
|
|
746
|
+
expect(invitation).toMatchObject({
|
|
747
|
+
object: 'invitation',
|
|
748
|
+
id: invitationId,
|
|
749
|
+
});
|
|
750
|
+
}));
|
|
751
|
+
});
|
|
752
|
+
describe('findInvitationByToken', () => {
|
|
753
|
+
it('sends a find invitation by token request', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
754
|
+
(0, test_utils_1.fetchOnce)(invitation_json_1.default);
|
|
755
|
+
const invitation = yield workos.userManagement.findInvitationByToken(invitationToken);
|
|
756
|
+
expect((0, test_utils_1.fetchURL)()).toContain(`/user_management/invitations/by_token/${invitationToken}`);
|
|
757
|
+
expect(invitation).toMatchObject({
|
|
758
|
+
object: 'invitation',
|
|
759
|
+
token: invitationToken,
|
|
760
|
+
});
|
|
745
761
|
}));
|
|
746
762
|
});
|
|
747
763
|
describe('listInvitations', () => {
|
package/lib/workos.js
CHANGED
|
@@ -24,7 +24,7 @@ const audit_logs_1 = require("./audit-logs/audit-logs");
|
|
|
24
24
|
const user_management_1 = require("./user-management/user-management");
|
|
25
25
|
const bad_request_exception_1 = require("./common/exceptions/bad-request.exception");
|
|
26
26
|
const fetch_client_1 = require("./common/utils/fetch-client");
|
|
27
|
-
const VERSION = '7.
|
|
27
|
+
const VERSION = '7.8.0';
|
|
28
28
|
const DEFAULT_HOSTNAME = 'api.workos.com';
|
|
29
29
|
class WorkOS {
|
|
30
30
|
constructor(key, options = {}) {
|
package/package.json
CHANGED