@workos-inc/node 7.57.0 → 7.59.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 +26 -2
- package/lib/common/serializers/event.serializer.js +3 -0
- package/lib/organization-domains/interfaces/organization-domain.interface.d.ts +4 -0
- package/lib/organization-domains/serializers/organization-domain.serializer.js +2 -0
- package/lib/user-management/interfaces/authorization-url-options.interface.d.ts +1 -0
- package/lib/user-management/user-management.d.ts +1 -1
- package/lib/user-management/user-management.js +2 -1
- package/lib/user-management/user-management.spec.js +23 -0
- package/lib/workos.js +1 -1
- package/package.json +1 -1
|
@@ -426,7 +426,31 @@ export interface OrganizationDomainVerificationFailedEventResponse extends Event
|
|
|
426
426
|
event: 'organization_domain.verification_failed';
|
|
427
427
|
data: OrganizationDomainResponse;
|
|
428
428
|
}
|
|
429
|
-
export
|
|
430
|
-
|
|
429
|
+
export interface OrganizationDomainCreatedEvent extends EventBase {
|
|
430
|
+
event: 'organization_domain.created';
|
|
431
|
+
data: OrganizationDomain;
|
|
432
|
+
}
|
|
433
|
+
export interface OrganizationDomainCreatedEventResponse extends EventResponseBase {
|
|
434
|
+
event: 'organization_domain.created';
|
|
435
|
+
data: OrganizationDomainResponse;
|
|
436
|
+
}
|
|
437
|
+
export interface OrganizationDomainUpdatedEvent extends EventBase {
|
|
438
|
+
event: 'organization_domain.updated';
|
|
439
|
+
data: OrganizationDomain;
|
|
440
|
+
}
|
|
441
|
+
export interface OrganizationDomainUpdatedEventResponse extends EventResponseBase {
|
|
442
|
+
event: 'organization_domain.updated';
|
|
443
|
+
data: OrganizationDomainResponse;
|
|
444
|
+
}
|
|
445
|
+
export interface OrganizationDomainDeletedEvent extends EventBase {
|
|
446
|
+
event: 'organization_domain.deleted';
|
|
447
|
+
data: OrganizationDomain;
|
|
448
|
+
}
|
|
449
|
+
export interface OrganizationDomainDeletedEventResponse extends EventResponseBase {
|
|
450
|
+
event: 'organization_domain.deleted';
|
|
451
|
+
data: OrganizationDomainResponse;
|
|
452
|
+
}
|
|
453
|
+
export type Event = AuthenticationEmailVerificationSucceededEvent | AuthenticationMfaSucceededEvent | AuthenticationOAuthFailedEvent | AuthenticationOAuthSucceededEvent | AuthenticationSSOFailedEvent | AuthenticationSSOSucceededEvent | AuthenticationPasswordFailedEvent | AuthenticationPasswordSucceededEvent | AuthenticationMagicAuthFailedEvent | AuthenticationMagicAuthSucceededEvent | AuthenticationRadarRiskDetectedEvent | ConnectionActivatedEvent | ConnectionDeactivatedEvent | ConnectionDeletedEvent | DsyncActivatedEvent | DsyncDeactivatedEvent | DsyncDeletedEvent | DsyncGroupCreatedEvent | DsyncGroupUpdatedEvent | DsyncGroupDeletedEvent | DsyncGroupUserAddedEvent | DsyncGroupUserRemovedEvent | DsyncUserCreatedEvent | DsyncUserUpdatedEvent | DsyncUserDeletedEvent | EmailVerificationCreatedEvent | InvitationCreatedEvent | MagicAuthCreatedEvent | PasswordResetCreatedEvent | PasswordResetSucceededEvent | UserCreatedEvent | UserUpdatedEvent | UserDeletedEvent | OrganizationMembershipAdded | OrganizationMembershipCreated | OrganizationMembershipDeleted | OrganizationMembershipUpdated | OrganizationMembershipRemoved | RoleCreatedEvent | RoleDeletedEvent | RoleUpdatedEvent | SessionCreatedEvent | SessionRevokedEvent | OrganizationCreatedEvent | OrganizationUpdatedEvent | OrganizationDeletedEvent | OrganizationDomainVerifiedEvent | OrganizationDomainVerificationFailedEvent | OrganizationDomainCreatedEvent | OrganizationDomainUpdatedEvent | OrganizationDomainDeletedEvent;
|
|
454
|
+
export type EventResponse = AuthenticationEmailVerificationSucceededEventResponse | AuthenticationMagicAuthFailedEventResponse | AuthenticationMagicAuthSucceededEventResponse | AuthenticationMfaSucceededEventResponse | AuthenticationOAuthFailedEventResponse | AuthenticationOAuthSucceededEventResponse | AuthenticationPasswordFailedEventResponse | AuthenticationPasswordSucceededEventResponse | AuthenticationSSOFailedEventResponse | AuthenticationSSOSucceededEventResponse | AuthenticationRadarRiskDetectedEventResponse | ConnectionActivatedEventResponse | ConnectionDeactivatedEventResponse | ConnectionDeletedEventResponse | DsyncActivatedEventResponse | DsyncDeactivatedEventResponse | DsyncDeletedEventResponse | DsyncGroupCreatedEventResponse | DsyncGroupUpdatedEventResponse | DsyncGroupDeletedEventResponse | DsyncGroupUserAddedEventResponse | DsyncGroupUserRemovedEventResponse | DsyncUserCreatedEventResponse | DsyncUserUpdatedEventResponse | DsyncUserDeletedEventResponse | EmailVerificationCreatedEventResponse | InvitationCreatedEventResponse | MagicAuthCreatedEventResponse | PasswordResetCreatedEventResponse | PasswordResetSucceededEventResponse | UserCreatedEventResponse | UserUpdatedEventResponse | UserDeletedEventResponse | OrganizationMembershipAddedResponse | OrganizationMembershipCreatedResponse | OrganizationMembershipDeletedResponse | OrganizationMembershipUpdatedResponse | OrganizationMembershipRemovedResponse | RoleCreatedEventResponse | RoleDeletedEventResponse | RoleUpdatedEventResponse | SessionCreatedEventResponse | SessionRevokedEventResponse | OrganizationCreatedResponse | OrganizationUpdatedResponse | OrganizationDeletedResponse | OrganizationDomainVerifiedEventResponse | OrganizationDomainVerificationFailedEventResponse | OrganizationDomainCreatedEventResponse | OrganizationDomainUpdatedEventResponse | OrganizationDomainDeletedEventResponse;
|
|
431
455
|
export type EventName = Event['event'];
|
|
432
456
|
export {};
|
|
@@ -87,6 +87,9 @@ const deserializeEvent = (event) => {
|
|
|
87
87
|
return Object.assign(Object.assign({}, eventBase), { event: event.event, data: (0, serializers_2.deserializeOrganization)(event.data) });
|
|
88
88
|
case 'organization_domain.verified':
|
|
89
89
|
case 'organization_domain.verification_failed':
|
|
90
|
+
case 'organization_domain.created':
|
|
91
|
+
case 'organization_domain.updated':
|
|
92
|
+
case 'organization_domain.deleted':
|
|
90
93
|
return Object.assign(Object.assign({}, eventBase), { event: event.event, data: (0, organization_domain_serializer_1.deserializeOrganizationDomain)(event.data) });
|
|
91
94
|
}
|
|
92
95
|
};
|
|
@@ -19,6 +19,8 @@ export interface OrganizationDomain {
|
|
|
19
19
|
state: OrganizationDomainState;
|
|
20
20
|
verificationToken?: string;
|
|
21
21
|
verificationStrategy: OrganizationDomainVerificationStrategy;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
updatedAt: string;
|
|
22
24
|
}
|
|
23
25
|
export interface OrganizationDomainResponse {
|
|
24
26
|
object: 'organization_domain';
|
|
@@ -28,4 +30,6 @@ export interface OrganizationDomainResponse {
|
|
|
28
30
|
state: OrganizationDomainState;
|
|
29
31
|
verification_token?: string;
|
|
30
32
|
verification_strategy: OrganizationDomainVerificationStrategy;
|
|
33
|
+
created_at: string;
|
|
34
|
+
updated_at: string;
|
|
31
35
|
}
|
|
@@ -9,5 +9,7 @@ const deserializeOrganizationDomain = (organizationDomain) => ({
|
|
|
9
9
|
state: organizationDomain.state,
|
|
10
10
|
verificationToken: organizationDomain.verification_token,
|
|
11
11
|
verificationStrategy: organizationDomain.verification_strategy,
|
|
12
|
+
createdAt: organizationDomain.created_at,
|
|
13
|
+
updatedAt: organizationDomain.updated_at,
|
|
12
14
|
});
|
|
13
15
|
exports.deserializeOrganizationDomain = deserializeOrganizationDomain;
|
|
@@ -107,7 +107,7 @@ export declare class UserManagement {
|
|
|
107
107
|
acceptInvitation(invitationId: string): Promise<Invitation>;
|
|
108
108
|
revokeInvitation(invitationId: string): Promise<Invitation>;
|
|
109
109
|
revokeSession(payload: RevokeSessionOptions): Promise<void>;
|
|
110
|
-
getAuthorizationUrl({ connectionId, codeChallenge, codeChallengeMethod, context, clientId, domainHint, loginHint, organizationId, provider, providerScopes, redirectUri, state, screenHint, }: UserManagementAuthorizationURLOptions): string;
|
|
110
|
+
getAuthorizationUrl({ connectionId, codeChallenge, codeChallengeMethod, context, clientId, domainHint, loginHint, organizationId, provider, providerScopes, prompt, redirectUri, state, screenHint, }: UserManagementAuthorizationURLOptions): string;
|
|
111
111
|
getLogoutUrl({ sessionId, returnTo, }: {
|
|
112
112
|
sessionId: string;
|
|
113
113
|
returnTo?: string;
|
|
@@ -535,7 +535,7 @@ class UserManagement {
|
|
|
535
535
|
yield this.workos.post('/user_management/sessions/revoke', (0, revoke_session_options_interface_1.serializeRevokeSessionOptions)(payload));
|
|
536
536
|
});
|
|
537
537
|
}
|
|
538
|
-
getAuthorizationUrl({ connectionId, codeChallenge, codeChallengeMethod, context, clientId, domainHint, loginHint, organizationId, provider, providerScopes, redirectUri, state, screenHint, }) {
|
|
538
|
+
getAuthorizationUrl({ connectionId, codeChallenge, codeChallengeMethod, context, clientId, domainHint, loginHint, organizationId, provider, providerScopes, prompt, redirectUri, state, screenHint, }) {
|
|
539
539
|
if (!provider && !connectionId && !organizationId) {
|
|
540
540
|
throw new TypeError(`Incomplete arguments. Need to specify either a 'connectionId', 'organizationId', or 'provider'.`);
|
|
541
541
|
}
|
|
@@ -556,6 +556,7 @@ class UserManagement {
|
|
|
556
556
|
login_hint: loginHint,
|
|
557
557
|
provider,
|
|
558
558
|
provider_scopes: providerScopes,
|
|
559
|
+
prompt,
|
|
559
560
|
client_id: clientId,
|
|
560
561
|
redirect_uri: redirectUri,
|
|
561
562
|
response_type: 'code',
|
|
@@ -1758,6 +1758,29 @@ describe('UserManagement', () => {
|
|
|
1758
1758
|
expect(url).toMatchInlineSnapshot(`"https://api.workos.com/user_management/authorize?client_id=proj_123&connection_id=connection_123&login_hint=foo%40workos.com&redirect_uri=example.com%2Fauth%2Fworkos%2Fcallback&response_type=code&state=custom+state"`);
|
|
1759
1759
|
});
|
|
1760
1760
|
});
|
|
1761
|
+
describe('with prompt', () => {
|
|
1762
|
+
it('generates an authorize url with the provided prompt', () => {
|
|
1763
|
+
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
1764
|
+
const url = workos.userManagement.getAuthorizationUrl({
|
|
1765
|
+
prompt: 'login',
|
|
1766
|
+
connectionId: 'connection_123',
|
|
1767
|
+
clientId: 'proj_123',
|
|
1768
|
+
redirectUri: 'example.com/auth/workos/callback',
|
|
1769
|
+
state: 'custom state',
|
|
1770
|
+
});
|
|
1771
|
+
expect(url).toMatchInlineSnapshot(`"https://api.workos.com/user_management/authorize?client_id=proj_123&connection_id=connection_123&prompt=login&redirect_uri=example.com%2Fauth%2Fworkos%2Fcallback&response_type=code&state=custom+state"`);
|
|
1772
|
+
});
|
|
1773
|
+
it('generates an authorize url with consent prompt', () => {
|
|
1774
|
+
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU');
|
|
1775
|
+
const url = workos.userManagement.getAuthorizationUrl({
|
|
1776
|
+
prompt: 'consent',
|
|
1777
|
+
provider: 'GoogleOAuth',
|
|
1778
|
+
clientId: 'proj_123',
|
|
1779
|
+
redirectUri: 'example.com/auth/workos/callback',
|
|
1780
|
+
});
|
|
1781
|
+
expect(url).toMatchInlineSnapshot(`"https://api.workos.com/user_management/authorize?client_id=proj_123&prompt=consent&provider=GoogleOAuth&redirect_uri=example.com%2Fauth%2Fworkos%2Fcallback&response_type=code"`);
|
|
1782
|
+
});
|
|
1783
|
+
});
|
|
1761
1784
|
});
|
|
1762
1785
|
describe('getLogoutUrl', () => {
|
|
1763
1786
|
it('returns a logout url', () => {
|
package/lib/workos.js
CHANGED
|
@@ -31,7 +31,7 @@ const widgets_1 = require("./widgets/widgets");
|
|
|
31
31
|
const actions_1 = require("./actions/actions");
|
|
32
32
|
const vault_1 = require("./vault/vault");
|
|
33
33
|
const conflict_exception_1 = require("./common/exceptions/conflict.exception");
|
|
34
|
-
const VERSION = '7.
|
|
34
|
+
const VERSION = '7.59.0';
|
|
35
35
|
const DEFAULT_HOSTNAME = 'api.workos.com';
|
|
36
36
|
const HEADER_AUTHORIZATION = 'Authorization';
|
|
37
37
|
const HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';
|
package/package.json
CHANGED