Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .oagen-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"version": 2,
"language": "node",
"generatedAt": "2026-05-19T16:22:01.987Z",
"files": [
"src/webhooks/fixtures/create-webhook-endpoint.json",
"src/webhooks/fixtures/list-webhook-endpoint.json",
"src/webhooks/fixtures/update-webhook-endpoint.json",
"src/webhooks/fixtures/webhook-endpoint.json",
"src/webhooks/interfaces/create-webhook-endpoint-events.interface.ts",
"src/webhooks/interfaces/create-webhook-endpoint.interface.ts",
"src/webhooks/interfaces/index.ts",
"src/webhooks/interfaces/update-webhook-endpoint-events.interface.ts",
"src/webhooks/interfaces/update-webhook-endpoint-status.interface.ts",
"src/webhooks/interfaces/update-webhook-endpoint.interface.ts",
"src/webhooks/interfaces/webhook-endpoint-status.interface.ts",
"src/webhooks/interfaces/webhook-endpoint.interface.ts",
"src/webhooks/serializers.spec.ts",
"src/webhooks/serializers/create-webhook-endpoint.serializer.ts",
"src/webhooks/serializers/index.ts",
"src/webhooks/serializers/update-webhook-endpoint.serializer.ts",
"src/webhooks/serializers/webhook-endpoint.serializer.ts",
"src/webhooks/webhooks.spec.ts",
"src/webhooks/webhooks.ts"
],
"operations": {}
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class WorkOSNode extends WorkOS {

/** @override */
createWebhookClient(): Webhooks {
return new Webhooks(this.getCryptoProvider());
return new Webhooks(this);
}

override getCryptoProvider(): CryptoProvider {
Expand Down
4 changes: 1 addition & 3 deletions src/index.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ class WorkOSWorker extends WorkOS {

/** @override */
createWebhookClient(): Webhooks {
const cryptoProvider = new SubtleCryptoProvider();

return new Webhooks(cryptoProvider);
return new Webhooks(this);
}

override getCryptoProvider(): CryptoProvider {
Expand Down
4 changes: 4 additions & 0 deletions src/webhooks/fixtures/create-webhook-endpoint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"endpoint_url": "https://example.com/webhooks",
"events": ["user.created", "dsync.user.created"]
}
18 changes: 18 additions & 0 deletions src/webhooks/fixtures/list-webhook-endpoint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"data": [
{
"object": "webhook_endpoint",
"id": "we_0123456789",
"endpoint_url": "https://example.com/webhooks",
"secret": "whsec_0FWAiVGkEfGBqqsJH4aNAGBJ4",
"status": "enabled",
"events": ["user.created", "dsync.user.created"],
"created_at": "2026-01-15T12:00:00.000Z",
"updated_at": "2026-01-15T12:00:00.000Z"
}
],
"list_metadata": {
"before": null,
"after": null
}
}
5 changes: 5 additions & 0 deletions src/webhooks/fixtures/update-webhook-endpoint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"endpoint_url": "https://example.com/webhooks",
"status": "enabled",
"events": ["user.created", "dsync.user.created"]
}
10 changes: 10 additions & 0 deletions src/webhooks/fixtures/webhook-endpoint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"object": "webhook_endpoint",
"id": "we_0123456789",
"endpoint_url": "https://example.com/webhooks",
"secret": "whsec_0FWAiVGkEfGBqqsJH4aNAGBJ4",
"status": "enabled",
"events": ["user.created", "dsync.user.created"],
"created_at": "2026-01-15T12:00:00.000Z",
"updated_at": "2026-01-15T12:00:00.000Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// This file is auto-generated by oagen. Do not edit.

export const CreateWebhookEndpointEvents = {
AuthenticationEmailVerificationSucceeded:
'authentication.email_verification_succeeded',
Comment on lines +1 to +5
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Duplicate events enum across create and update interfaces

CreateWebhookEndpointEvents and UpdateWebhookEndpointEvents are byte-for-byte identical — 74 entries each. If the WorkOS API adds a new subscribable event type in the future, both files must be updated in sync by regenerating. Since this is oagen output that's fine as long as generation is re-run together, but it's worth confirming that the code-gen workflow guarantees both are always regenerated from the same API spec in the same pass.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's fine, it's regenerated

AuthenticationMagicAuthFailed: 'authentication.magic_auth_failed',
AuthenticationMagicAuthSucceeded: 'authentication.magic_auth_succeeded',
AuthenticationMfaSucceeded: 'authentication.mfa_succeeded',
AuthenticationOAuthFailed: 'authentication.oauth_failed',
AuthenticationOAuthSucceeded: 'authentication.oauth_succeeded',
AuthenticationPasswordFailed: 'authentication.password_failed',
AuthenticationPasswordSucceeded: 'authentication.password_succeeded',
AuthenticationPasskeyFailed: 'authentication.passkey_failed',
AuthenticationPasskeySucceeded: 'authentication.passkey_succeeded',
AuthenticationSSOFailed: 'authentication.sso_failed',
AuthenticationSSOStarted: 'authentication.sso_started',
AuthenticationSSOSucceeded: 'authentication.sso_succeeded',
AuthenticationSSOTimedOut: 'authentication.sso_timed_out',
AuthenticationRadarRiskDetected: 'authentication.radar_risk_detected',
ApiKeyCreated: 'api_key.created',
ApiKeyRevoked: 'api_key.revoked',
ConnectionActivated: 'connection.activated',
ConnectionDeactivated: 'connection.deactivated',
ConnectionSAMLCertificateRenewalRequired:
'connection.saml_certificate_renewal_required',
ConnectionSAMLCertificateRenewed: 'connection.saml_certificate_renewed',
ConnectionDeleted: 'connection.deleted',
DsyncActivated: 'dsync.activated',
DsyncDeleted: 'dsync.deleted',
DsyncGroupCreated: 'dsync.group.created',
DsyncGroupDeleted: 'dsync.group.deleted',
DsyncGroupUpdated: 'dsync.group.updated',
DsyncGroupUserAdded: 'dsync.group.user_added',
DsyncGroupUserRemoved: 'dsync.group.user_removed',
DsyncUserCreated: 'dsync.user.created',
DsyncUserDeleted: 'dsync.user.deleted',
DsyncUserUpdated: 'dsync.user.updated',
EmailVerificationCreated: 'email_verification.created',
GroupCreated: 'group.created',
GroupDeleted: 'group.deleted',
GroupMemberAdded: 'group.member_added',
GroupMemberRemoved: 'group.member_removed',
GroupUpdated: 'group.updated',
FlagCreated: 'flag.created',
FlagDeleted: 'flag.deleted',
FlagUpdated: 'flag.updated',
FlagRuleUpdated: 'flag.rule_updated',
InvitationAccepted: 'invitation.accepted',
InvitationCreated: 'invitation.created',
InvitationResent: 'invitation.resent',
InvitationRevoked: 'invitation.revoked',
MagicAuthCreated: 'magic_auth.created',
OrganizationCreated: 'organization.created',
OrganizationDeleted: 'organization.deleted',
OrganizationUpdated: 'organization.updated',
OrganizationDomainCreated: 'organization_domain.created',
OrganizationDomainDeleted: 'organization_domain.deleted',
OrganizationDomainUpdated: 'organization_domain.updated',
OrganizationDomainVerified: 'organization_domain.verified',
OrganizationDomainVerificationFailed:
'organization_domain.verification_failed',
PasswordResetCreated: 'password_reset.created',
PasswordResetSucceeded: 'password_reset.succeeded',
UserCreated: 'user.created',
UserUpdated: 'user.updated',
UserDeleted: 'user.deleted',
OrganizationMembershipCreated: 'organization_membership.created',
OrganizationMembershipDeleted: 'organization_membership.deleted',
OrganizationMembershipUpdated: 'organization_membership.updated',
RoleCreated: 'role.created',
RoleDeleted: 'role.deleted',
RoleUpdated: 'role.updated',
OrganizationRoleCreated: 'organization_role.created',
OrganizationRoleDeleted: 'organization_role.deleted',
OrganizationRoleUpdated: 'organization_role.updated',
PermissionCreated: 'permission.created',
PermissionDeleted: 'permission.deleted',
PermissionUpdated: 'permission.updated',
SessionCreated: 'session.created',
SessionRevoked: 'session.revoked',
WaitlistUserApproved: 'waitlist_user.approved',
WaitlistUserCreated: 'waitlist_user.created',
WaitlistUserDenied: 'waitlist_user.denied',
} as const;

export type CreateWebhookEndpointEvents =
(typeof CreateWebhookEndpointEvents)[keyof typeof CreateWebhookEndpointEvents];
15 changes: 15 additions & 0 deletions src/webhooks/interfaces/create-webhook-endpoint.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This file is auto-generated by oagen. Do not edit.

import type { CreateWebhookEndpointEvents } from './create-webhook-endpoint-events.interface';

export interface CreateWebhookEndpoint {
/** The HTTPS URL where webhooks will be sent. */
endpointUrl: string;
/** The events that the Webhook Endpoint is subscribed to. */
events: CreateWebhookEndpointEvents[];
}

export interface CreateWebhookEndpointResponse {
endpoint_url: string;
events: CreateWebhookEndpointEvents[];
}
9 changes: 9 additions & 0 deletions src/webhooks/interfaces/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This file is auto-generated by oagen. Do not edit.

export * from './create-webhook-endpoint-events.interface';
export * from './create-webhook-endpoint.interface';
export * from './update-webhook-endpoint-events.interface';
export * from './update-webhook-endpoint-status.interface';
export * from './update-webhook-endpoint.interface';
export * from './webhook-endpoint-status.interface';
export * from './webhook-endpoint.interface';
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// This file is auto-generated by oagen. Do not edit.

export const UpdateWebhookEndpointEvents = {
AuthenticationEmailVerificationSucceeded:
'authentication.email_verification_succeeded',
AuthenticationMagicAuthFailed: 'authentication.magic_auth_failed',
AuthenticationMagicAuthSucceeded: 'authentication.magic_auth_succeeded',
AuthenticationMfaSucceeded: 'authentication.mfa_succeeded',
AuthenticationOAuthFailed: 'authentication.oauth_failed',
AuthenticationOAuthSucceeded: 'authentication.oauth_succeeded',
AuthenticationPasswordFailed: 'authentication.password_failed',
AuthenticationPasswordSucceeded: 'authentication.password_succeeded',
AuthenticationPasskeyFailed: 'authentication.passkey_failed',
AuthenticationPasskeySucceeded: 'authentication.passkey_succeeded',
AuthenticationSSOFailed: 'authentication.sso_failed',
AuthenticationSSOStarted: 'authentication.sso_started',
AuthenticationSSOSucceeded: 'authentication.sso_succeeded',
AuthenticationSSOTimedOut: 'authentication.sso_timed_out',
AuthenticationRadarRiskDetected: 'authentication.radar_risk_detected',
ApiKeyCreated: 'api_key.created',
ApiKeyRevoked: 'api_key.revoked',
ConnectionActivated: 'connection.activated',
ConnectionDeactivated: 'connection.deactivated',
ConnectionSAMLCertificateRenewalRequired:
'connection.saml_certificate_renewal_required',
ConnectionSAMLCertificateRenewed: 'connection.saml_certificate_renewed',
ConnectionDeleted: 'connection.deleted',
DsyncActivated: 'dsync.activated',
DsyncDeleted: 'dsync.deleted',
DsyncGroupCreated: 'dsync.group.created',
DsyncGroupDeleted: 'dsync.group.deleted',
DsyncGroupUpdated: 'dsync.group.updated',
DsyncGroupUserAdded: 'dsync.group.user_added',
DsyncGroupUserRemoved: 'dsync.group.user_removed',
DsyncUserCreated: 'dsync.user.created',
DsyncUserDeleted: 'dsync.user.deleted',
DsyncUserUpdated: 'dsync.user.updated',
EmailVerificationCreated: 'email_verification.created',
GroupCreated: 'group.created',
GroupDeleted: 'group.deleted',
GroupMemberAdded: 'group.member_added',
GroupMemberRemoved: 'group.member_removed',
GroupUpdated: 'group.updated',
FlagCreated: 'flag.created',
FlagDeleted: 'flag.deleted',
FlagUpdated: 'flag.updated',
FlagRuleUpdated: 'flag.rule_updated',
InvitationAccepted: 'invitation.accepted',
InvitationCreated: 'invitation.created',
InvitationResent: 'invitation.resent',
InvitationRevoked: 'invitation.revoked',
MagicAuthCreated: 'magic_auth.created',
OrganizationCreated: 'organization.created',
OrganizationDeleted: 'organization.deleted',
OrganizationUpdated: 'organization.updated',
OrganizationDomainCreated: 'organization_domain.created',
OrganizationDomainDeleted: 'organization_domain.deleted',
OrganizationDomainUpdated: 'organization_domain.updated',
OrganizationDomainVerified: 'organization_domain.verified',
OrganizationDomainVerificationFailed:
'organization_domain.verification_failed',
PasswordResetCreated: 'password_reset.created',
PasswordResetSucceeded: 'password_reset.succeeded',
UserCreated: 'user.created',
UserUpdated: 'user.updated',
UserDeleted: 'user.deleted',
OrganizationMembershipCreated: 'organization_membership.created',
OrganizationMembershipDeleted: 'organization_membership.deleted',
OrganizationMembershipUpdated: 'organization_membership.updated',
RoleCreated: 'role.created',
RoleDeleted: 'role.deleted',
RoleUpdated: 'role.updated',
OrganizationRoleCreated: 'organization_role.created',
OrganizationRoleDeleted: 'organization_role.deleted',
OrganizationRoleUpdated: 'organization_role.updated',
PermissionCreated: 'permission.created',
PermissionDeleted: 'permission.deleted',
PermissionUpdated: 'permission.updated',
SessionCreated: 'session.created',
SessionRevoked: 'session.revoked',
WaitlistUserApproved: 'waitlist_user.approved',
WaitlistUserCreated: 'waitlist_user.created',
WaitlistUserDenied: 'waitlist_user.denied',
} as const;

export type UpdateWebhookEndpointEvents =
(typeof UpdateWebhookEndpointEvents)[keyof typeof UpdateWebhookEndpointEvents];
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This file is auto-generated by oagen. Do not edit.

export const UpdateWebhookEndpointStatus = {
Enabled: 'enabled',
Disabled: 'disabled',
} as const;

export type UpdateWebhookEndpointStatus =
(typeof UpdateWebhookEndpointStatus)[keyof typeof UpdateWebhookEndpointStatus];
19 changes: 19 additions & 0 deletions src/webhooks/interfaces/update-webhook-endpoint.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// This file is auto-generated by oagen. Do not edit.

import type { UpdateWebhookEndpointStatus } from './update-webhook-endpoint-status.interface';
import type { UpdateWebhookEndpointEvents } from './update-webhook-endpoint-events.interface';

export interface UpdateWebhookEndpoint {
/** The HTTPS URL where webhooks will be sent. */
endpointUrl?: string;
/** Whether the Webhook Endpoint is enabled or disabled. */
status?: UpdateWebhookEndpointStatus;
/** The events that the Webhook Endpoint is subscribed to. */
events?: UpdateWebhookEndpointEvents[];
}

export interface UpdateWebhookEndpointResponse {
endpoint_url?: string;
status?: UpdateWebhookEndpointStatus;
events?: UpdateWebhookEndpointEvents[];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This file is auto-generated by oagen. Do not edit.

export const WebhookEndpointStatus = {
Enabled: 'enabled',
Disabled: 'disabled',
} as const;

export type WebhookEndpointStatus =
(typeof WebhookEndpointStatus)[keyof typeof WebhookEndpointStatus];
33 changes: 33 additions & 0 deletions src/webhooks/interfaces/webhook-endpoint.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// This file is auto-generated by oagen. Do not edit.

import type { WebhookEndpointStatus } from './webhook-endpoint-status.interface';

export interface WebhookEndpoint {
/** Distinguishes the Webhook Endpoint object. */
object: 'webhook_endpoint';
/** Unique identifier of the Webhook Endpoint. */
id: string;
/** The URL to which webhooks are sent. */
endpointUrl: string;
/** The secret used to sign webhook payloads. */
secret: string;
/** Whether the Webhook Endpoint is enabled or disabled. */
status: WebhookEndpointStatus;
/** The events that the Webhook Endpoint is subscribed to. */
events: string[];
/** An ISO 8601 timestamp. */
createdAt: Date;
/** An ISO 8601 timestamp. */
updatedAt: Date;
}

export interface WebhookEndpointResponse {
object: 'webhook_endpoint';
id: string;
endpoint_url: string;
secret: string;
status: WebhookEndpointStatus;
events: string[];
created_at: string;
updated_at: string;
}
Loading