@workos-inc/node 7.15.0 → 7.16.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 +67 -3
- package/lib/common/serializers/event.serializer.js +9 -0
- package/lib/user-management/interfaces/authentication-event.interface.d.ts +25 -0
- package/lib/user-management/interfaces/authentication-event.interface.js +2 -0
- package/lib/user-management/interfaces/index.d.ts +1 -0
- package/lib/user-management/interfaces/index.js +1 -0
- package/lib/user-management/serializers/authentication-event.serializer.d.ts +2 -0
- package/lib/user-management/serializers/authentication-event.serializer.js +13 -0
- package/lib/user-management/serializers/index.d.ts +1 -0
- package/lib/user-management/serializers/index.js +1 -0
- package/lib/workos.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DirectoryUser, DirectoryUserResponse, DirectoryGroup, DirectoryGroupResponse, EventDirectory, EventDirectoryResponse } from '../../directory-sync/interfaces';
|
|
2
2
|
import { Organization, OrganizationResponse } from '../../organizations/interfaces';
|
|
3
3
|
import { Connection, ConnectionResponse } from '../../sso/interfaces';
|
|
4
|
-
import { EmailVerificationEvent, EmailVerificationEventResponse, InvitationEvent, InvitationEventResponse, MagicAuthEvent, MagicAuthEventResponse, PasswordResetEvent, PasswordResetEventResponse, Session, SessionResponse, User, UserResponse } from '../../user-management/interfaces';
|
|
4
|
+
import { AuthenticationEvent, AuthenticationEventResponse, EmailVerificationEvent, EmailVerificationEventResponse, InvitationEvent, InvitationEventResponse, MagicAuthEvent, MagicAuthEventResponse, PasswordResetEvent, PasswordResetEventResponse, Session, SessionResponse, User, UserResponse } from '../../user-management/interfaces';
|
|
5
5
|
import { OrganizationMembership, OrganizationMembershipResponse } from '../../user-management/interfaces/organization-membership.interface';
|
|
6
6
|
import { RoleEvent, RoleEventResponse } from '../../roles/interfaces/role.interface';
|
|
7
7
|
export interface EventBase {
|
|
@@ -12,6 +12,70 @@ interface EventResponseBase {
|
|
|
12
12
|
id: string;
|
|
13
13
|
created_at: string;
|
|
14
14
|
}
|
|
15
|
+
export interface AuthenticationEmailVerificationSucceededEvent extends EventBase {
|
|
16
|
+
event: 'authentication.email_verification_succeeded';
|
|
17
|
+
data: AuthenticationEvent;
|
|
18
|
+
}
|
|
19
|
+
export interface AuthenticationEmailVerificationSucceededEventResponse extends EventResponseBase {
|
|
20
|
+
event: 'authentication.email_verification_succeeded';
|
|
21
|
+
data: AuthenticationEventResponse;
|
|
22
|
+
}
|
|
23
|
+
export interface AuthenticationMagicAuthFailedEvent extends EventBase {
|
|
24
|
+
event: 'authentication.magic_auth_failed';
|
|
25
|
+
data: AuthenticationEvent;
|
|
26
|
+
}
|
|
27
|
+
export interface AuthenticationMagicAuthFailedEventResponse extends EventResponseBase {
|
|
28
|
+
event: 'authentication.magic_auth_failed';
|
|
29
|
+
data: AuthenticationEventResponse;
|
|
30
|
+
}
|
|
31
|
+
export interface AuthenticationMagicAuthSucceededEvent extends EventBase {
|
|
32
|
+
event: 'authentication.magic_auth_succeeded';
|
|
33
|
+
data: AuthenticationEvent;
|
|
34
|
+
}
|
|
35
|
+
export interface AuthenticationMagicAuthSucceededEventResponse extends EventResponseBase {
|
|
36
|
+
event: 'authentication.magic_auth_succeeded';
|
|
37
|
+
data: AuthenticationEventResponse;
|
|
38
|
+
}
|
|
39
|
+
export interface AuthenticationMfaSucceededEvent extends EventBase {
|
|
40
|
+
event: 'authentication.mfa_succeeded';
|
|
41
|
+
data: AuthenticationEvent;
|
|
42
|
+
}
|
|
43
|
+
export interface AuthenticationMfaSucceededEventResponse extends EventResponseBase {
|
|
44
|
+
event: 'authentication.mfa_succeeded';
|
|
45
|
+
data: AuthenticationEventResponse;
|
|
46
|
+
}
|
|
47
|
+
export interface AuthenticationOAuthSucceededEvent extends EventBase {
|
|
48
|
+
event: 'authentication.oauth_succeeded';
|
|
49
|
+
data: AuthenticationEvent;
|
|
50
|
+
}
|
|
51
|
+
export interface AuthenticationOAuthSucceededEventResponse extends EventResponseBase {
|
|
52
|
+
event: 'authentication.oauth_succeeded';
|
|
53
|
+
data: AuthenticationEventResponse;
|
|
54
|
+
}
|
|
55
|
+
export interface AuthenticationPasswordFailedEvent extends EventBase {
|
|
56
|
+
event: 'authentication.password_failed';
|
|
57
|
+
data: AuthenticationEvent;
|
|
58
|
+
}
|
|
59
|
+
export interface AuthenticationPasswordFailedEventResponse extends EventResponseBase {
|
|
60
|
+
event: 'authentication.password_failed';
|
|
61
|
+
data: AuthenticationEventResponse;
|
|
62
|
+
}
|
|
63
|
+
export interface AuthenticationPasswordSucceededEvent extends EventBase {
|
|
64
|
+
event: 'authentication.password_succeeded';
|
|
65
|
+
data: AuthenticationEvent;
|
|
66
|
+
}
|
|
67
|
+
export interface AuthenticationPasswordSucceededEventResponse extends EventResponseBase {
|
|
68
|
+
event: 'authentication.password_succeeded';
|
|
69
|
+
data: AuthenticationEventResponse;
|
|
70
|
+
}
|
|
71
|
+
export interface AuthenticationSSOSucceededEvent extends EventBase {
|
|
72
|
+
event: 'authentication.sso_succeeded';
|
|
73
|
+
data: AuthenticationEvent;
|
|
74
|
+
}
|
|
75
|
+
export interface AuthenticationSSOSucceededEventResponse extends EventResponseBase {
|
|
76
|
+
event: 'authentication.sso_succeeded';
|
|
77
|
+
data: AuthenticationEventResponse;
|
|
78
|
+
}
|
|
15
79
|
export interface ConnectionActivatedEvent extends EventBase {
|
|
16
80
|
event: 'connection.activated';
|
|
17
81
|
data: Connection;
|
|
@@ -296,7 +360,7 @@ export interface SessionCreatedEventResponse extends EventResponseBase {
|
|
|
296
360
|
event: 'session.created';
|
|
297
361
|
data: SessionResponse;
|
|
298
362
|
}
|
|
299
|
-
export type Event = ConnectionActivatedEvent | ConnectionDeactivatedEvent | ConnectionDeletedEvent | DsyncActivatedEvent | DsyncDeactivatedEvent | DsyncDeletedEvent | DsyncGroupCreatedEvent | DsyncGroupUpdatedEvent | DsyncGroupDeletedEvent | DsyncGroupUserAddedEvent | DsyncGroupUserRemovedEvent | DsyncUserCreatedEvent | DsyncUserUpdatedEvent | DsyncUserDeletedEvent | EmailVerificationCreatedEvent | InvitationCreatedEvent | MagicAuthCreatedEvent | PasswordResetCreatedEvent | UserCreatedEvent | UserUpdatedEvent | UserDeletedEvent | OrganizationMembershipAdded | OrganizationMembershipCreated | OrganizationMembershipDeleted | OrganizationMembershipUpdated | OrganizationMembershipRemoved | RoleCreatedEvent | RoleDeletedEvent | SessionCreatedEvent | OrganizationCreatedEvent | OrganizationUpdatedEvent | OrganizationDeletedEvent;
|
|
300
|
-
export type EventResponse = ConnectionActivatedEventResponse | ConnectionDeactivatedEventResponse | ConnectionDeletedEventResponse | DsyncActivatedEventResponse | DsyncDeactivatedEventResponse | DsyncDeletedEventResponse | DsyncGroupCreatedEventResponse | DsyncGroupUpdatedEventResponse | DsyncGroupDeletedEventResponse | DsyncGroupUserAddedEventResponse | DsyncGroupUserRemovedEventResponse | DsyncUserCreatedEventResponse | DsyncUserUpdatedEventResponse | DsyncUserDeletedEventResponse | EmailVerificationCreatedEventResponse | InvitationCreatedEventResponse | MagicAuthCreatedEventResponse | PasswordResetCreatedEventResponse | UserCreatedEventResponse | UserUpdatedEventResponse | UserDeletedEventResponse | OrganizationMembershipAddedResponse | OrganizationMembershipCreatedResponse | OrganizationMembershipDeletedResponse | OrganizationMembershipUpdatedResponse | OrganizationMembershipRemovedResponse | RoleCreatedEventResponse | RoleDeletedEventResponse | SessionCreatedEventResponse | OrganizationCreatedResponse | OrganizationUpdatedResponse | OrganizationDeletedResponse;
|
|
363
|
+
export type Event = AuthenticationEmailVerificationSucceededEvent | AuthenticationMfaSucceededEvent | AuthenticationOAuthSucceededEvent | AuthenticationSSOSucceededEvent | AuthenticationPasswordFailedEvent | AuthenticationPasswordSucceededEvent | AuthenticationMagicAuthFailedEvent | AuthenticationMagicAuthSucceededEvent | ConnectionActivatedEvent | ConnectionDeactivatedEvent | ConnectionDeletedEvent | DsyncActivatedEvent | DsyncDeactivatedEvent | DsyncDeletedEvent | DsyncGroupCreatedEvent | DsyncGroupUpdatedEvent | DsyncGroupDeletedEvent | DsyncGroupUserAddedEvent | DsyncGroupUserRemovedEvent | DsyncUserCreatedEvent | DsyncUserUpdatedEvent | DsyncUserDeletedEvent | EmailVerificationCreatedEvent | InvitationCreatedEvent | MagicAuthCreatedEvent | PasswordResetCreatedEvent | UserCreatedEvent | UserUpdatedEvent | UserDeletedEvent | OrganizationMembershipAdded | OrganizationMembershipCreated | OrganizationMembershipDeleted | OrganizationMembershipUpdated | OrganizationMembershipRemoved | RoleCreatedEvent | RoleDeletedEvent | SessionCreatedEvent | OrganizationCreatedEvent | OrganizationUpdatedEvent | OrganizationDeletedEvent;
|
|
364
|
+
export type EventResponse = AuthenticationEmailVerificationSucceededEventResponse | AuthenticationMagicAuthFailedEventResponse | AuthenticationMagicAuthSucceededEventResponse | AuthenticationMfaSucceededEventResponse | AuthenticationOAuthSucceededEventResponse | AuthenticationPasswordFailedEventResponse | AuthenticationPasswordSucceededEventResponse | AuthenticationSSOSucceededEventResponse | ConnectionActivatedEventResponse | ConnectionDeactivatedEventResponse | ConnectionDeletedEventResponse | DsyncActivatedEventResponse | DsyncDeactivatedEventResponse | DsyncDeletedEventResponse | DsyncGroupCreatedEventResponse | DsyncGroupUpdatedEventResponse | DsyncGroupDeletedEventResponse | DsyncGroupUserAddedEventResponse | DsyncGroupUserRemovedEventResponse | DsyncUserCreatedEventResponse | DsyncUserUpdatedEventResponse | DsyncUserDeletedEventResponse | EmailVerificationCreatedEventResponse | InvitationCreatedEventResponse | MagicAuthCreatedEventResponse | PasswordResetCreatedEventResponse | UserCreatedEventResponse | UserUpdatedEventResponse | UserDeletedEventResponse | OrganizationMembershipAddedResponse | OrganizationMembershipCreatedResponse | OrganizationMembershipDeletedResponse | OrganizationMembershipUpdatedResponse | OrganizationMembershipRemovedResponse | RoleCreatedEventResponse | RoleDeletedEventResponse | SessionCreatedEventResponse | OrganizationCreatedResponse | OrganizationUpdatedResponse | OrganizationDeletedResponse;
|
|
301
365
|
export type EventName = Event['event'];
|
|
302
366
|
export {};
|
|
@@ -14,6 +14,15 @@ const deserializeEvent = (event) => {
|
|
|
14
14
|
createdAt: event.created_at,
|
|
15
15
|
};
|
|
16
16
|
switch (event.event) {
|
|
17
|
+
case 'authentication.email_verification_succeeded':
|
|
18
|
+
case 'authentication.magic_auth_failed':
|
|
19
|
+
case 'authentication.magic_auth_succeeded':
|
|
20
|
+
case 'authentication.mfa_succeeded':
|
|
21
|
+
case 'authentication.oauth_succeeded':
|
|
22
|
+
case 'authentication.password_failed':
|
|
23
|
+
case 'authentication.password_succeeded':
|
|
24
|
+
case 'authentication.sso_succeeded':
|
|
25
|
+
return Object.assign(Object.assign({}, eventBase), { event: event.event, data: (0, serializers_4.deserializeAuthenticationEvent)(event.data) });
|
|
17
26
|
case 'connection.activated':
|
|
18
27
|
case 'connection.deactivated':
|
|
19
28
|
case 'connection.deleted':
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface AuthenticationEventError {
|
|
2
|
+
code: string;
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
type AuthenticationEventType = 'sso' | 'password' | 'oauth' | 'mfa' | 'magic_auth' | 'email_verification';
|
|
6
|
+
type AuthenticationEventStatus = 'failed' | 'succeeded';
|
|
7
|
+
export type AuthenticationEvent = {
|
|
8
|
+
email: string | null;
|
|
9
|
+
error?: AuthenticationEventError;
|
|
10
|
+
ipAddress: string | null;
|
|
11
|
+
status: AuthenticationEventStatus;
|
|
12
|
+
type: AuthenticationEventType;
|
|
13
|
+
userAgent: string | null;
|
|
14
|
+
userId: string | null;
|
|
15
|
+
};
|
|
16
|
+
export interface AuthenticationEventResponse {
|
|
17
|
+
email: string | null;
|
|
18
|
+
error?: AuthenticationEventError;
|
|
19
|
+
ip_address: string | null;
|
|
20
|
+
status: AuthenticationEventStatus;
|
|
21
|
+
type: AuthenticationEventType;
|
|
22
|
+
user_agent: string | null;
|
|
23
|
+
user_id: string | null;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -14,6 +14,7 @@ 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("./authentication-event.interface"), exports);
|
|
17
18
|
__exportStar(require("./authenticate-with-magic-auth-options.interface"), exports);
|
|
18
19
|
__exportStar(require("./authenticate-with-password-options.interface"), exports);
|
|
19
20
|
__exportStar(require("./authenticate-with-code-options.interface"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeAuthenticationEvent = void 0;
|
|
4
|
+
const deserializeAuthenticationEvent = (authenticationEvent) => ({
|
|
5
|
+
email: authenticationEvent.email,
|
|
6
|
+
error: authenticationEvent.error,
|
|
7
|
+
ipAddress: authenticationEvent.ip_address,
|
|
8
|
+
status: authenticationEvent.status,
|
|
9
|
+
type: authenticationEvent.type,
|
|
10
|
+
userAgent: authenticationEvent.user_agent,
|
|
11
|
+
userId: authenticationEvent.user_id,
|
|
12
|
+
});
|
|
13
|
+
exports.deserializeAuthenticationEvent = deserializeAuthenticationEvent;
|
|
@@ -3,6 +3,7 @@ export * from './authenticate-with-magic-auth-options.serializer';
|
|
|
3
3
|
export * from './authenticate-with-password-options.serializer';
|
|
4
4
|
export * from './authenticate-with-refresh-token.options.serializer';
|
|
5
5
|
export * from './authenticate-with-totp-options.serializer';
|
|
6
|
+
export * from './authentication-event.serializer';
|
|
6
7
|
export * from './authentication-response.serializer';
|
|
7
8
|
export * from './create-magic-auth-options.serializer';
|
|
8
9
|
export * from './create-password-reset-options.serializer';
|
|
@@ -19,6 +19,7 @@ __exportStar(require("./authenticate-with-magic-auth-options.serializer"), expor
|
|
|
19
19
|
__exportStar(require("./authenticate-with-password-options.serializer"), exports);
|
|
20
20
|
__exportStar(require("./authenticate-with-refresh-token.options.serializer"), exports);
|
|
21
21
|
__exportStar(require("./authenticate-with-totp-options.serializer"), exports);
|
|
22
|
+
__exportStar(require("./authentication-event.serializer"), exports);
|
|
22
23
|
__exportStar(require("./authentication-response.serializer"), exports);
|
|
23
24
|
__exportStar(require("./create-magic-auth-options.serializer"), exports);
|
|
24
25
|
__exportStar(require("./create-password-reset-options.serializer"), exports);
|
package/lib/workos.js
CHANGED
|
@@ -26,7 +26,7 @@ const bad_request_exception_1 = require("./common/exceptions/bad-request.excepti
|
|
|
26
26
|
const http_client_1 = require("./common/net/http-client");
|
|
27
27
|
const subtle_crypto_provider_1 = require("./common/crypto/subtle-crypto-provider");
|
|
28
28
|
const fetch_client_1 = require("./common/net/fetch-client");
|
|
29
|
-
const VERSION = '7.
|
|
29
|
+
const VERSION = '7.16.0';
|
|
30
30
|
const DEFAULT_HOSTNAME = 'api.workos.com';
|
|
31
31
|
class WorkOS {
|
|
32
32
|
constructor(key, options = {}) {
|
package/package.json
CHANGED