@drmhse/sso-sdk 0.3.8 → 0.3.10

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/dist/index.d.mts CHANGED
@@ -162,306 +162,35 @@ interface JwtClaims {
162
162
  iat: number;
163
163
  }
164
164
 
165
- /**
166
- * Risk assessment and engine types
167
- */
168
- /**
169
- * Risk score levels
170
- */
171
- type RiskScore = number;
172
- /**
173
- * Risk assessment results from the risk engine
174
- */
175
- interface RiskAssessment {
176
- /** Overall risk score (0-100, higher is more risky) */
177
- score: RiskScore;
178
- /** Action to take based on risk assessment */
179
- action: RiskAction;
180
- /** Specific risk factors that contributed to the score */
181
- factors: RiskFactor[];
182
- /** Geolocation data if available */
183
- location?: GeolocationData;
184
- /** When the assessment was performed */
185
- assessedAt: string;
186
- /** Additional metadata about the assessment */
187
- metadata?: Record<string, unknown>;
188
- }
189
- /**
190
- * Risk actions the engine can recommend
191
- */
192
- declare enum RiskAction {
193
- /** Allow the authentication to proceed */
194
- ALLOW = "allow",
195
- /** Log only - allow but monitor */
196
- LOG_ONLY = "log_only",
197
- /** Require additional verification (MFA) */
198
- CHALLENGE_MFA = "challenge_mfa",
199
- /** Block the authentication attempt */
200
- BLOCK = "block"
201
- }
202
- /**
203
- * Individual risk factors that contribute to overall risk score
204
- */
205
- interface RiskFactor {
206
- /** Type of risk factor */
207
- type: RiskFactorType;
208
- /** How much this factor contributes to the score */
209
- weight: number;
210
- /** Human-readable description */
211
- description: string;
212
- /** Additional data about this factor */
213
- data?: Record<string, unknown>;
214
- }
215
- /**
216
- * Types of risk factors the engine can detect
217
- */
218
- declare enum RiskFactorType {
219
- /** Unknown IP address or never seen before */
220
- NEW_IP = "new_ip",
221
- /** IP from high-risk country or region */
222
- HIGH_RISK_LOCATION = "high_risk_location",
223
- /** Impossible travel - login from geographically impossible locations */
224
- IMPOSSIBLE_TRAVEL = "impossible_travel",
225
- /** New device or browser fingerprint */
226
- NEW_DEVICE = "new_device",
227
- /** Multiple failed login attempts */
228
- FAILED_ATTEMPTS = "failed_attempts",
229
- /** Login from unusual time of day */
230
- UNUSUAL_TIME = "unusual_time",
231
- /** Suspicious user agent or bot patterns */
232
- SUSPICIOUS_USER_AGENT = "suspicious_user_agent",
233
- /** Tor exit node or VPN detected */
234
- ANONYMOUS_NETWORK = "anonymous_network",
235
- /** Account is new (recently created) */
236
- NEW_ACCOUNT = "new_account",
237
- /** Account has suspicious activity history */
238
- SUSPICIOUS_HISTORY = "suspicious_history",
239
- /** Velocity-based detection (too many actions) */
240
- HIGH_VELOCITY = "high_velocity",
241
- /** Custom rule triggered */
242
- CUSTOM_RULE = "custom_rule"
243
- }
244
- /**
245
- * Geolocation data for risk assessment
246
- */
247
- interface GeolocationData {
248
- /** Two-letter ISO country code */
165
+ interface GeoLocation {
249
166
  country: string;
250
- /** City name if available */
251
167
  city?: string;
252
- /** Region/state if available */
253
- region?: string;
254
- /** Latitude coordinate */
255
- latitude?: number;
256
- /** Longitude coordinate */
257
- longitude?: number;
258
- /** ISP or organization name */
259
- isp?: string;
260
- /** Whether this is a known VPN/proxy */
261
- isVpn?: boolean;
262
- /** Whether this is a Tor exit node */
263
- isTor?: boolean;
264
- }
265
- /**
266
- * Context provided to risk engine for assessment
267
- */
268
- interface RiskContext {
269
- /** User ID being authenticated */
270
- userId: string;
271
- /** Organization ID if applicable */
272
- orgId?: string;
273
- /** IP address of the request */
274
- ipAddress: string;
275
- /** User agent string */
276
- userAgent: string;
277
- /** Device fingerprint or cookie if available */
278
- deviceCookie?: string;
279
- /** Authentication method being used */
280
- authMethod: AuthMethod;
281
- /** Additional context data */
282
- metadata?: Record<string, unknown>;
283
- }
284
- /**
285
- * Authentication methods for risk assessment
286
- */
287
- declare enum AuthMethod {
288
- /** Email and password */
289
- PASSWORD = "password",
290
- /** OAuth provider (Google, GitHub, etc.) */
291
- OAUTH = "oauth",
292
- /** WebAuthn passkeys */
293
- PASSKEY = "passkey",
294
- /** Magic link email */
295
- MAGIC_LINK = "magic_link",
296
- /** Multi-factor authentication */
297
- MFA = "mfa",
298
- /** SAML SSO */
299
- SAML = "saml"
300
- }
301
- /**
302
- * Risk engine configuration for organizations
303
- */
304
- interface RiskEngineConfig {
305
- /** Enable/disable risk engine */
306
- enabled: boolean;
307
- /** Risk score threshold for blocking */
308
- blockThreshold: RiskScore;
309
- /** Risk score threshold for requiring MFA */
310
- mfaThreshold: RiskScore;
311
- /** Which risk factors to consider */
312
- enabledFactors: RiskFactorType[];
313
- /** Custom rules and weights */
314
- customRules?: RiskRule[];
315
- /** How long to remember trusted devices */
316
- deviceTrustDuration: number;
317
- /** Whether to enable location-based risk assessment */
318
- enableLocationTracking: boolean;
319
- /** Max failed attempts before increased risk */
320
- maxFailedAttempts: number;
321
- /** Time window for velocity checks */
322
- velocityWindow: number;
323
- }
324
- /**
325
- * Custom risk rule definition
326
- */
327
- interface RiskRule {
328
- /** Unique rule identifier */
329
- id: string;
330
- /** Rule name for display */
331
- name: string;
332
- /** Rule description */
333
- description: string;
334
- /** Condition to trigger the rule */
335
- condition: RiskRuleCondition;
336
- /** Action to take when rule triggers */
337
- action: RiskAction;
338
- /** How much weight this rule carries */
339
- weight: number;
340
- /** Whether the rule is enabled */
341
- enabled: boolean;
168
+ latitude: number;
169
+ longitude: number;
342
170
  }
343
- /**
344
- * Risk rule condition
345
- */
346
- interface RiskRuleCondition {
347
- /** Field to check */
348
- field: string;
349
- /** Operator for comparison */
350
- operator: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'contains' | 'regex';
351
- /** Value to compare against */
352
- value: unknown;
353
- /** Additional conditions (AND logic) */
354
- and?: RiskRuleCondition[];
355
- /** Alternative conditions (OR logic) */
356
- or?: RiskRuleCondition[];
357
- }
358
- /**
359
- * Device trust information
360
- */
361
- interface DeviceTrust {
362
- /** Device ID */
363
- deviceId: string;
364
- /** User ID this device belongs to */
365
- userId: string;
366
- /** Device name or description */
367
- deviceName: string;
368
- /** When the device was first seen */
369
- firstSeenAt: string;
370
- /** When the device was last used */
371
- lastSeenAt: string;
372
- /** When the device trust expires */
373
- expiresAt: string;
374
- /** IP address when device was registered */
375
- registrationIp?: string;
376
- /** Risk score for this device */
377
- riskScore: RiskScore;
378
- /** Whether this device is currently trusted */
379
- isTrusted: boolean;
171
+ type RiskAction = 'allow' | 'challenge_mfa' | 'block' | 'log_only';
172
+ interface RiskAssessment {
173
+ score: number;
174
+ factors: string[];
175
+ action: RiskAction;
176
+ location?: GeoLocation;
380
177
  }
381
- /**
382
- * Risk event for logging and monitoring
383
- */
384
- interface RiskEvent {
385
- /** Unique event ID */
178
+ interface RiskEventResponse {
386
179
  id: string;
387
- /** User ID involved */
388
- userId: string;
389
- /** Organization ID if applicable */
390
- orgId?: string;
391
- /** Risk assessment that triggered this event */
392
- assessment: RiskAssessment;
393
- /** Authentication context */
394
- context: RiskContext;
395
- /** When the event occurred */
396
- timestamp: string;
397
- /** Event outcome */
398
- outcome: RiskEventOutcome;
399
- /** Additional event metadata */
400
- metadata?: Record<string, unknown>;
401
- }
402
- /**
403
- * Risk event outcomes
404
- */
405
- declare enum RiskEventOutcome {
406
- /** Authentication was allowed */
407
- ALLOWED = "allowed",
408
- /** Authentication was blocked */
409
- BLOCKED = "blocked",
410
- /** Additional verification was required */
411
- CHALLENGED = "challenged",
412
- /** Event was logged but no action taken */
413
- LOGGED = "logged"
414
- }
415
- /**
416
- * Risk engine analytics and reporting
417
- */
418
- interface RiskAnalytics {
419
- /** Total risk assessments in time period */
420
- totalAssessments: number;
421
- /** Risk score distribution */
422
- scoreDistribution: {
423
- low: number;
424
- medium: number;
425
- high: number;
426
- critical: number;
427
- };
428
- /** Most common risk factors */
429
- topRiskFactors: Array<{
430
- factor: RiskFactorType;
431
- count: number;
432
- percentage: number;
433
- }>;
434
- /** Blocked authentication attempts */
435
- blockedAttempts: number;
436
- /** MFA challenges issued */
437
- mfaChallenges: number;
438
- /** Geographic risk data */
439
- locationRisk: Array<{
440
- country: string;
441
- riskCount: number;
442
- riskScore: number;
443
- }>;
444
- /** Time-based risk patterns */
445
- temporalPatterns: {
446
- hourly: number[];
447
- daily: number[];
448
- };
180
+ user_id: string;
181
+ user_email?: string;
182
+ created_at: string;
183
+ risk_score: number;
184
+ risk_factors: string[];
185
+ geo_country?: string;
186
+ geo_city?: string;
187
+ ip_address?: string;
188
+ provider: string;
449
189
  }
450
- /**
451
- * Risk enforcement modes
452
- */
453
- type RiskEnforcementMode = 'log_only' | 'monitor' | 'block' | 'challenge_mfa';
454
- /**
455
- * Organization risk settings
456
- */
457
- interface RiskSettings {
458
- enforcement_mode: RiskEnforcementMode;
459
- low_threshold: number;
460
- medium_threshold: number;
461
- new_device_score: number;
462
- impossible_travel_score: number;
463
- velocity_threshold: number;
464
- velocity_score: number;
190
+ interface RiskEventsQuery {
191
+ page?: number;
192
+ limit?: number;
193
+ min_score?: number;
465
194
  }
466
195
 
467
196
  /**
@@ -2070,6 +1799,28 @@ interface TestConnectionResponse {
2070
1799
  message: string;
2071
1800
  }
2072
1801
 
1802
+ interface RoleResponse {
1803
+ id: string;
1804
+ org_id: string;
1805
+ slug: string;
1806
+ name: string;
1807
+ description?: string;
1808
+ permissions: string[];
1809
+ created_at: string;
1810
+ updated_at: string;
1811
+ }
1812
+ interface CreateRoleRequest {
1813
+ slug: string;
1814
+ name: string;
1815
+ description?: string;
1816
+ permissions: string[];
1817
+ }
1818
+ interface UpdateRoleRequest {
1819
+ name?: string;
1820
+ description?: string;
1821
+ permissions?: string[];
1822
+ }
1823
+
2073
1824
  interface SessionConfig {
2074
1825
  storageKeyPrefix?: string;
2075
1826
  autoRefresh?: boolean;
@@ -3127,6 +2878,25 @@ declare class WebhooksModule {
3127
2878
  * ```
3128
2879
  */
3129
2880
  getEventTypes(orgSlug: string): Promise<EventTypeInfo[]>;
2881
+ /**
2882
+ * Trigger a test event for a specific webhook (owner/admin only).
2883
+ * Generates a "webhook.test.ping" event to verify connectivity.
2884
+ *
2885
+ * @param orgSlug Organization slug
2886
+ * @param webhookId Webhook ID
2887
+ * @returns Result including delivery ID
2888
+ *
2889
+ * @example
2890
+ * ```typescript
2891
+ * const result = await sso.organizations.webhooks.test('acme-corp', 'webhook-123');
2892
+ * console.log('Test event sent, delivery ID:', result.delivery_id);
2893
+ * ```
2894
+ */
2895
+ test(orgSlug: string, webhookId: string): Promise<{
2896
+ success: boolean;
2897
+ job_id: string;
2898
+ delivery_id: string;
2899
+ }>;
3130
2900
  }
3131
2901
 
3132
2902
  /**
@@ -3834,6 +3604,44 @@ declare class OrganizationsModule {
3834
3604
  url: string;
3835
3605
  }>;
3836
3606
  };
3607
+ /**
3608
+ * Security & Risk insights
3609
+ */
3610
+ security: {
3611
+ /**
3612
+ * Get risk events for an organization.
3613
+ * Requires 'owner' or 'admin' role.
3614
+ *
3615
+ * @param orgSlug Organization slug
3616
+ * @param params Query parameters
3617
+ */
3618
+ getRiskEvents: (orgSlug: string, params?: RiskEventsQuery) => Promise<RiskEventResponse[]>;
3619
+ };
3620
+ /**
3621
+ * Role management methods
3622
+ */
3623
+ roles: {
3624
+ /**
3625
+ * List all custom roles for an organization.
3626
+ */
3627
+ list: (orgSlug: string) => Promise<RoleResponse[]>;
3628
+ /**
3629
+ * Get details of a specific role.
3630
+ */
3631
+ get: (orgSlug: string, roleId: string) => Promise<RoleResponse>;
3632
+ /**
3633
+ * Create a new custom role.
3634
+ */
3635
+ create: (orgSlug: string, payload: CreateRoleRequest) => Promise<RoleResponse>;
3636
+ /**
3637
+ * Update an existing role.
3638
+ */
3639
+ update: (orgSlug: string, roleId: string, payload: UpdateRoleRequest) => Promise<RoleResponse>;
3640
+ /**
3641
+ * Delete a role.
3642
+ */
3643
+ delete: (orgSlug: string, roleId: string) => Promise<void>;
3644
+ };
3837
3645
  /**
3838
3646
  * BYOP (Bring Your Own Payment) credential management.
3839
3647
  * Allows organizations to configure their own billing provider credentials
@@ -5799,4 +5607,4 @@ declare class SsoApiError extends Error {
5799
5607
  isNotFound(): boolean;
5800
5608
  }
5801
5609
 
5802
- export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, AuthErrorCodes, AuthMethod, AuthModule, type AuthSnapshot, type AuthenticationResponseJSON, type BackupCodesResponse, type BrandingConfiguration, BrowserStorage, type ChangePasswordRequest, type ChangePasswordResponse, type ConfigureSamlPayload, type ConfigureSamlResponse, CookieStorage, type CreateApiKeyPayload, type CreateCheckoutPayload, type CreateCheckoutResponse, type CreateInvitationPayload, type CreateOrganizationPayload, type CreateOrganizationResponse, type CreatePlanPayload, type CreateScimTokenRequest, type CreateServicePayload, type CreateServiceResponse, type CreateSiemConfigRequest, type CreateWebhookRequest, type DeclineInvitationPayload, type DeviceCodeRequest, type DeviceCodeResponse, type DeviceTrust, type DeviceVerifyResponse, type DomainConfiguration, type DomainVerificationMethod, type DomainVerificationResponse, type DomainVerificationResult, type EndUser, type EndUserDetailResponse, type EndUserIdentity, type EndUserListResponse, type EndUserSubscription, type EventTypeInfo, type ExportUserDataResponse, type ForgetUserResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GeolocationData, type GetAuditLogParams, type GetRiskSettingsResponse, type GrowthTrendPoint, type Identity, type ImpersonateRequest, type ImpersonateResponse, type ImpersonationUserInfo, type Invitation, type InvitationStatus, type InvitationWithOrg, InvitationsModule, type JwtClaims, type ListApiKeysResponse, type ListDevicesResponse, type ListEndUsersParams, type ListOrganizationsParams, type ListPlatformOrganizationsParams, type ListScimTokensResponse, type ListSiemConfigsResponse, type LoginActivityPoint, type LoginEventExport, type LoginRequest, type LoginTrendPoint, type LoginUrlParams, type LoginsByProvider, type LoginsByService, type LookupEmailRequest, type LookupEmailResponse, MagicLinks, type MemberListResponse, type MemberRole, type Membership, type MembershipExport, MemoryStorage, type MfaEventExport, type MfaSetupResponse, type MfaStatusResponse, type MfaVerificationRequest, type MfaVerificationResponse, type MfaVerifyRequest, type MfaVerifyResponse, type OAuthCredentials, type OAuthIdentityExport, type OAuthProvider, type Organization, type OrganizationMember, type OrganizationResponse, type OrganizationStatus, type OrganizationStatusBreakdown, type OrganizationTier, OrganizationsModule, type PaginatedResponse, type PaginationInfo, type PaginationParams, type Passkey, type PasskeyAuthFinishRequest, type PasskeyAuthFinishResponse, type PasskeyAuthStartRequest, type PasskeyAuthStartResponse, type PasskeyExport, type PasskeyRegisterFinishRequest, type PasskeyRegisterFinishResponse, type PasskeyRegisterStartRequest, type PasskeyRegisterStartResponse, PasskeysModule, PermissionsModule, type Plan, type PlanResponse, type PlatformAnalyticsDateRangeParams, PlatformModule, type PlatformOrganizationResponse, type PlatformOrganizationsListResponse, type PlatformOverviewMetrics, type PromotePlatformOwnerPayload, type ProviderToken, type ProviderTokenGrant, type RecentLogin, type RecentOrganization, type RefreshTokenRequest, type RefreshTokenResponse, type RegisterRequest, type RegisterResponse, type RegistrationResponseJSON, type RejectOrganizationPayload, type ResendVerificationRequest, type ResendVerificationResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDeviceRequest, type RevokeDeviceResponse, type RevokeSessionsResponse, RiskAction, type RiskAnalytics, type RiskAssessment, type RiskContext, type RiskEnforcementMode, type RiskEngineConfig, type RiskEvent, RiskEventOutcome, type RiskFactor, RiskFactorType, type RiskRule, type RiskRuleCondition, type RiskScore, type RiskSettings, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type SelectOrganizationResponse, type Service, ServiceApiModule, type ServiceListResponse, type ServiceResponse, type ServiceType, type ServiceWithDetails, ServicesModule, type SetCustomDomainRequest, type SetOAuthCredentialsPayload, type SetPasswordRequest, type SetPasswordResponse, type SetSmtpRequest, type SiemConfigResponse, type SiemProviderType, type SmtpConfigResponse, SsoApiError, SsoClient, type SsoClientOptions, type StartLinkResponse, type Subscription, type TestConnectionResponse, type TokenRequest, type TokenResponse, type TokenStorage, type TopOrganization, type TransferOwnershipPayload, type UpdateBrandingRequest, type UpdateMemberRolePayload, type UpdateOrganizationPayload, type UpdateOrganizationTierPayload, type UpdatePlanPayload, type UpdateRiskSettingsRequest, type UpdateRiskSettingsResponse, type UpdateServicePayload, type UpdateSiemConfigRequest, type UpdateUserProfilePayload, type UpdateWebhookRequest, type User, type UserDevice, UserModule, type UserProfile, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQueryParams, type WebhookListResponse, type WebhookResponse };
5610
+ export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, AuthErrorCodes, AuthModule, type AuthSnapshot, type AuthenticationResponseJSON, type BackupCodesResponse, type BrandingConfiguration, BrowserStorage, type ChangePasswordRequest, type ChangePasswordResponse, type ConfigureSamlPayload, type ConfigureSamlResponse, CookieStorage, type CreateApiKeyPayload, type CreateCheckoutPayload, type CreateCheckoutResponse, type CreateInvitationPayload, type CreateOrganizationPayload, type CreateOrganizationResponse, type CreatePlanPayload, type CreateRoleRequest, type CreateScimTokenRequest, type CreateServicePayload, type CreateServiceResponse, type CreateSiemConfigRequest, type CreateWebhookRequest, type DeclineInvitationPayload, type DeviceCodeRequest, type DeviceCodeResponse, type DeviceVerifyResponse, type DomainConfiguration, type DomainVerificationMethod, type DomainVerificationResponse, type DomainVerificationResult, type EndUser, type EndUserDetailResponse, type EndUserIdentity, type EndUserListResponse, type EndUserSubscription, type EventTypeInfo, type ExportUserDataResponse, type ForgetUserResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GeoLocation, type GetAuditLogParams, type GetRiskSettingsResponse, type GrowthTrendPoint, type Identity, type ImpersonateRequest, type ImpersonateResponse, type ImpersonationUserInfo, type Invitation, type InvitationStatus, type InvitationWithOrg, InvitationsModule, type JwtClaims, type ListApiKeysResponse, type ListDevicesResponse, type ListEndUsersParams, type ListOrganizationsParams, type ListPlatformOrganizationsParams, type ListScimTokensResponse, type ListSiemConfigsResponse, type LoginActivityPoint, type LoginEventExport, type LoginRequest, type LoginTrendPoint, type LoginUrlParams, type LoginsByProvider, type LoginsByService, type LookupEmailRequest, type LookupEmailResponse, MagicLinks, type MemberListResponse, type MemberRole, type Membership, type MembershipExport, MemoryStorage, type MfaEventExport, type MfaSetupResponse, type MfaStatusResponse, type MfaVerificationRequest, type MfaVerificationResponse, type MfaVerifyRequest, type MfaVerifyResponse, type OAuthCredentials, type OAuthIdentityExport, type OAuthProvider, type Organization, type OrganizationMember, type OrganizationResponse, type OrganizationStatus, type OrganizationStatusBreakdown, type OrganizationTier, OrganizationsModule, type PaginatedResponse, type PaginationInfo, type PaginationParams, type Passkey, type PasskeyAuthFinishRequest, type PasskeyAuthFinishResponse, type PasskeyAuthStartRequest, type PasskeyAuthStartResponse, type PasskeyExport, type PasskeyRegisterFinishRequest, type PasskeyRegisterFinishResponse, type PasskeyRegisterStartRequest, type PasskeyRegisterStartResponse, PasskeysModule, PermissionsModule, type Plan, type PlanResponse, type PlatformAnalyticsDateRangeParams, PlatformModule, type PlatformOrganizationResponse, type PlatformOrganizationsListResponse, type PlatformOverviewMetrics, type PromotePlatformOwnerPayload, type ProviderToken, type ProviderTokenGrant, type RecentLogin, type RecentOrganization, type RefreshTokenRequest, type RefreshTokenResponse, type RegisterRequest, type RegisterResponse, type RegistrationResponseJSON, type RejectOrganizationPayload, type ResendVerificationRequest, type ResendVerificationResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDeviceRequest, type RevokeDeviceResponse, type RevokeSessionsResponse, type RiskAction, type RiskAssessment, type RiskEventResponse, type RiskEventsQuery, type RoleResponse, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type SelectOrganizationResponse, type Service, ServiceApiModule, type ServiceListResponse, type ServiceResponse, type ServiceType, type ServiceWithDetails, ServicesModule, type SetCustomDomainRequest, type SetOAuthCredentialsPayload, type SetPasswordRequest, type SetPasswordResponse, type SetSmtpRequest, type SiemConfigResponse, type SiemProviderType, type SmtpConfigResponse, SsoApiError, SsoClient, type SsoClientOptions, type StartLinkResponse, type Subscription, type TestConnectionResponse, type TokenRequest, type TokenResponse, type TokenStorage, type TopOrganization, type TransferOwnershipPayload, type UpdateBrandingRequest, type UpdateMemberRolePayload, type UpdateOrganizationPayload, type UpdateOrganizationTierPayload, type UpdatePlanPayload, type UpdateRiskSettingsRequest, type UpdateRiskSettingsResponse, type UpdateRoleRequest, type UpdateServicePayload, type UpdateSiemConfigRequest, type UpdateUserProfilePayload, type UpdateWebhookRequest, type User, type UserDevice, UserModule, type UserProfile, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQueryParams, type WebhookListResponse, type WebhookResponse };
package/dist/index.d.ts CHANGED
@@ -162,306 +162,35 @@ interface JwtClaims {
162
162
  iat: number;
163
163
  }
164
164
 
165
- /**
166
- * Risk assessment and engine types
167
- */
168
- /**
169
- * Risk score levels
170
- */
171
- type RiskScore = number;
172
- /**
173
- * Risk assessment results from the risk engine
174
- */
175
- interface RiskAssessment {
176
- /** Overall risk score (0-100, higher is more risky) */
177
- score: RiskScore;
178
- /** Action to take based on risk assessment */
179
- action: RiskAction;
180
- /** Specific risk factors that contributed to the score */
181
- factors: RiskFactor[];
182
- /** Geolocation data if available */
183
- location?: GeolocationData;
184
- /** When the assessment was performed */
185
- assessedAt: string;
186
- /** Additional metadata about the assessment */
187
- metadata?: Record<string, unknown>;
188
- }
189
- /**
190
- * Risk actions the engine can recommend
191
- */
192
- declare enum RiskAction {
193
- /** Allow the authentication to proceed */
194
- ALLOW = "allow",
195
- /** Log only - allow but monitor */
196
- LOG_ONLY = "log_only",
197
- /** Require additional verification (MFA) */
198
- CHALLENGE_MFA = "challenge_mfa",
199
- /** Block the authentication attempt */
200
- BLOCK = "block"
201
- }
202
- /**
203
- * Individual risk factors that contribute to overall risk score
204
- */
205
- interface RiskFactor {
206
- /** Type of risk factor */
207
- type: RiskFactorType;
208
- /** How much this factor contributes to the score */
209
- weight: number;
210
- /** Human-readable description */
211
- description: string;
212
- /** Additional data about this factor */
213
- data?: Record<string, unknown>;
214
- }
215
- /**
216
- * Types of risk factors the engine can detect
217
- */
218
- declare enum RiskFactorType {
219
- /** Unknown IP address or never seen before */
220
- NEW_IP = "new_ip",
221
- /** IP from high-risk country or region */
222
- HIGH_RISK_LOCATION = "high_risk_location",
223
- /** Impossible travel - login from geographically impossible locations */
224
- IMPOSSIBLE_TRAVEL = "impossible_travel",
225
- /** New device or browser fingerprint */
226
- NEW_DEVICE = "new_device",
227
- /** Multiple failed login attempts */
228
- FAILED_ATTEMPTS = "failed_attempts",
229
- /** Login from unusual time of day */
230
- UNUSUAL_TIME = "unusual_time",
231
- /** Suspicious user agent or bot patterns */
232
- SUSPICIOUS_USER_AGENT = "suspicious_user_agent",
233
- /** Tor exit node or VPN detected */
234
- ANONYMOUS_NETWORK = "anonymous_network",
235
- /** Account is new (recently created) */
236
- NEW_ACCOUNT = "new_account",
237
- /** Account has suspicious activity history */
238
- SUSPICIOUS_HISTORY = "suspicious_history",
239
- /** Velocity-based detection (too many actions) */
240
- HIGH_VELOCITY = "high_velocity",
241
- /** Custom rule triggered */
242
- CUSTOM_RULE = "custom_rule"
243
- }
244
- /**
245
- * Geolocation data for risk assessment
246
- */
247
- interface GeolocationData {
248
- /** Two-letter ISO country code */
165
+ interface GeoLocation {
249
166
  country: string;
250
- /** City name if available */
251
167
  city?: string;
252
- /** Region/state if available */
253
- region?: string;
254
- /** Latitude coordinate */
255
- latitude?: number;
256
- /** Longitude coordinate */
257
- longitude?: number;
258
- /** ISP or organization name */
259
- isp?: string;
260
- /** Whether this is a known VPN/proxy */
261
- isVpn?: boolean;
262
- /** Whether this is a Tor exit node */
263
- isTor?: boolean;
264
- }
265
- /**
266
- * Context provided to risk engine for assessment
267
- */
268
- interface RiskContext {
269
- /** User ID being authenticated */
270
- userId: string;
271
- /** Organization ID if applicable */
272
- orgId?: string;
273
- /** IP address of the request */
274
- ipAddress: string;
275
- /** User agent string */
276
- userAgent: string;
277
- /** Device fingerprint or cookie if available */
278
- deviceCookie?: string;
279
- /** Authentication method being used */
280
- authMethod: AuthMethod;
281
- /** Additional context data */
282
- metadata?: Record<string, unknown>;
283
- }
284
- /**
285
- * Authentication methods for risk assessment
286
- */
287
- declare enum AuthMethod {
288
- /** Email and password */
289
- PASSWORD = "password",
290
- /** OAuth provider (Google, GitHub, etc.) */
291
- OAUTH = "oauth",
292
- /** WebAuthn passkeys */
293
- PASSKEY = "passkey",
294
- /** Magic link email */
295
- MAGIC_LINK = "magic_link",
296
- /** Multi-factor authentication */
297
- MFA = "mfa",
298
- /** SAML SSO */
299
- SAML = "saml"
300
- }
301
- /**
302
- * Risk engine configuration for organizations
303
- */
304
- interface RiskEngineConfig {
305
- /** Enable/disable risk engine */
306
- enabled: boolean;
307
- /** Risk score threshold for blocking */
308
- blockThreshold: RiskScore;
309
- /** Risk score threshold for requiring MFA */
310
- mfaThreshold: RiskScore;
311
- /** Which risk factors to consider */
312
- enabledFactors: RiskFactorType[];
313
- /** Custom rules and weights */
314
- customRules?: RiskRule[];
315
- /** How long to remember trusted devices */
316
- deviceTrustDuration: number;
317
- /** Whether to enable location-based risk assessment */
318
- enableLocationTracking: boolean;
319
- /** Max failed attempts before increased risk */
320
- maxFailedAttempts: number;
321
- /** Time window for velocity checks */
322
- velocityWindow: number;
323
- }
324
- /**
325
- * Custom risk rule definition
326
- */
327
- interface RiskRule {
328
- /** Unique rule identifier */
329
- id: string;
330
- /** Rule name for display */
331
- name: string;
332
- /** Rule description */
333
- description: string;
334
- /** Condition to trigger the rule */
335
- condition: RiskRuleCondition;
336
- /** Action to take when rule triggers */
337
- action: RiskAction;
338
- /** How much weight this rule carries */
339
- weight: number;
340
- /** Whether the rule is enabled */
341
- enabled: boolean;
168
+ latitude: number;
169
+ longitude: number;
342
170
  }
343
- /**
344
- * Risk rule condition
345
- */
346
- interface RiskRuleCondition {
347
- /** Field to check */
348
- field: string;
349
- /** Operator for comparison */
350
- operator: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'contains' | 'regex';
351
- /** Value to compare against */
352
- value: unknown;
353
- /** Additional conditions (AND logic) */
354
- and?: RiskRuleCondition[];
355
- /** Alternative conditions (OR logic) */
356
- or?: RiskRuleCondition[];
357
- }
358
- /**
359
- * Device trust information
360
- */
361
- interface DeviceTrust {
362
- /** Device ID */
363
- deviceId: string;
364
- /** User ID this device belongs to */
365
- userId: string;
366
- /** Device name or description */
367
- deviceName: string;
368
- /** When the device was first seen */
369
- firstSeenAt: string;
370
- /** When the device was last used */
371
- lastSeenAt: string;
372
- /** When the device trust expires */
373
- expiresAt: string;
374
- /** IP address when device was registered */
375
- registrationIp?: string;
376
- /** Risk score for this device */
377
- riskScore: RiskScore;
378
- /** Whether this device is currently trusted */
379
- isTrusted: boolean;
171
+ type RiskAction = 'allow' | 'challenge_mfa' | 'block' | 'log_only';
172
+ interface RiskAssessment {
173
+ score: number;
174
+ factors: string[];
175
+ action: RiskAction;
176
+ location?: GeoLocation;
380
177
  }
381
- /**
382
- * Risk event for logging and monitoring
383
- */
384
- interface RiskEvent {
385
- /** Unique event ID */
178
+ interface RiskEventResponse {
386
179
  id: string;
387
- /** User ID involved */
388
- userId: string;
389
- /** Organization ID if applicable */
390
- orgId?: string;
391
- /** Risk assessment that triggered this event */
392
- assessment: RiskAssessment;
393
- /** Authentication context */
394
- context: RiskContext;
395
- /** When the event occurred */
396
- timestamp: string;
397
- /** Event outcome */
398
- outcome: RiskEventOutcome;
399
- /** Additional event metadata */
400
- metadata?: Record<string, unknown>;
401
- }
402
- /**
403
- * Risk event outcomes
404
- */
405
- declare enum RiskEventOutcome {
406
- /** Authentication was allowed */
407
- ALLOWED = "allowed",
408
- /** Authentication was blocked */
409
- BLOCKED = "blocked",
410
- /** Additional verification was required */
411
- CHALLENGED = "challenged",
412
- /** Event was logged but no action taken */
413
- LOGGED = "logged"
414
- }
415
- /**
416
- * Risk engine analytics and reporting
417
- */
418
- interface RiskAnalytics {
419
- /** Total risk assessments in time period */
420
- totalAssessments: number;
421
- /** Risk score distribution */
422
- scoreDistribution: {
423
- low: number;
424
- medium: number;
425
- high: number;
426
- critical: number;
427
- };
428
- /** Most common risk factors */
429
- topRiskFactors: Array<{
430
- factor: RiskFactorType;
431
- count: number;
432
- percentage: number;
433
- }>;
434
- /** Blocked authentication attempts */
435
- blockedAttempts: number;
436
- /** MFA challenges issued */
437
- mfaChallenges: number;
438
- /** Geographic risk data */
439
- locationRisk: Array<{
440
- country: string;
441
- riskCount: number;
442
- riskScore: number;
443
- }>;
444
- /** Time-based risk patterns */
445
- temporalPatterns: {
446
- hourly: number[];
447
- daily: number[];
448
- };
180
+ user_id: string;
181
+ user_email?: string;
182
+ created_at: string;
183
+ risk_score: number;
184
+ risk_factors: string[];
185
+ geo_country?: string;
186
+ geo_city?: string;
187
+ ip_address?: string;
188
+ provider: string;
449
189
  }
450
- /**
451
- * Risk enforcement modes
452
- */
453
- type RiskEnforcementMode = 'log_only' | 'monitor' | 'block' | 'challenge_mfa';
454
- /**
455
- * Organization risk settings
456
- */
457
- interface RiskSettings {
458
- enforcement_mode: RiskEnforcementMode;
459
- low_threshold: number;
460
- medium_threshold: number;
461
- new_device_score: number;
462
- impossible_travel_score: number;
463
- velocity_threshold: number;
464
- velocity_score: number;
190
+ interface RiskEventsQuery {
191
+ page?: number;
192
+ limit?: number;
193
+ min_score?: number;
465
194
  }
466
195
 
467
196
  /**
@@ -2070,6 +1799,28 @@ interface TestConnectionResponse {
2070
1799
  message: string;
2071
1800
  }
2072
1801
 
1802
+ interface RoleResponse {
1803
+ id: string;
1804
+ org_id: string;
1805
+ slug: string;
1806
+ name: string;
1807
+ description?: string;
1808
+ permissions: string[];
1809
+ created_at: string;
1810
+ updated_at: string;
1811
+ }
1812
+ interface CreateRoleRequest {
1813
+ slug: string;
1814
+ name: string;
1815
+ description?: string;
1816
+ permissions: string[];
1817
+ }
1818
+ interface UpdateRoleRequest {
1819
+ name?: string;
1820
+ description?: string;
1821
+ permissions?: string[];
1822
+ }
1823
+
2073
1824
  interface SessionConfig {
2074
1825
  storageKeyPrefix?: string;
2075
1826
  autoRefresh?: boolean;
@@ -3127,6 +2878,25 @@ declare class WebhooksModule {
3127
2878
  * ```
3128
2879
  */
3129
2880
  getEventTypes(orgSlug: string): Promise<EventTypeInfo[]>;
2881
+ /**
2882
+ * Trigger a test event for a specific webhook (owner/admin only).
2883
+ * Generates a "webhook.test.ping" event to verify connectivity.
2884
+ *
2885
+ * @param orgSlug Organization slug
2886
+ * @param webhookId Webhook ID
2887
+ * @returns Result including delivery ID
2888
+ *
2889
+ * @example
2890
+ * ```typescript
2891
+ * const result = await sso.organizations.webhooks.test('acme-corp', 'webhook-123');
2892
+ * console.log('Test event sent, delivery ID:', result.delivery_id);
2893
+ * ```
2894
+ */
2895
+ test(orgSlug: string, webhookId: string): Promise<{
2896
+ success: boolean;
2897
+ job_id: string;
2898
+ delivery_id: string;
2899
+ }>;
3130
2900
  }
3131
2901
 
3132
2902
  /**
@@ -3834,6 +3604,44 @@ declare class OrganizationsModule {
3834
3604
  url: string;
3835
3605
  }>;
3836
3606
  };
3607
+ /**
3608
+ * Security & Risk insights
3609
+ */
3610
+ security: {
3611
+ /**
3612
+ * Get risk events for an organization.
3613
+ * Requires 'owner' or 'admin' role.
3614
+ *
3615
+ * @param orgSlug Organization slug
3616
+ * @param params Query parameters
3617
+ */
3618
+ getRiskEvents: (orgSlug: string, params?: RiskEventsQuery) => Promise<RiskEventResponse[]>;
3619
+ };
3620
+ /**
3621
+ * Role management methods
3622
+ */
3623
+ roles: {
3624
+ /**
3625
+ * List all custom roles for an organization.
3626
+ */
3627
+ list: (orgSlug: string) => Promise<RoleResponse[]>;
3628
+ /**
3629
+ * Get details of a specific role.
3630
+ */
3631
+ get: (orgSlug: string, roleId: string) => Promise<RoleResponse>;
3632
+ /**
3633
+ * Create a new custom role.
3634
+ */
3635
+ create: (orgSlug: string, payload: CreateRoleRequest) => Promise<RoleResponse>;
3636
+ /**
3637
+ * Update an existing role.
3638
+ */
3639
+ update: (orgSlug: string, roleId: string, payload: UpdateRoleRequest) => Promise<RoleResponse>;
3640
+ /**
3641
+ * Delete a role.
3642
+ */
3643
+ delete: (orgSlug: string, roleId: string) => Promise<void>;
3644
+ };
3837
3645
  /**
3838
3646
  * BYOP (Bring Your Own Payment) credential management.
3839
3647
  * Allows organizations to configure their own billing provider credentials
@@ -5799,4 +5607,4 @@ declare class SsoApiError extends Error {
5799
5607
  isNotFound(): boolean;
5800
5608
  }
5801
5609
 
5802
- export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, AuthErrorCodes, AuthMethod, AuthModule, type AuthSnapshot, type AuthenticationResponseJSON, type BackupCodesResponse, type BrandingConfiguration, BrowserStorage, type ChangePasswordRequest, type ChangePasswordResponse, type ConfigureSamlPayload, type ConfigureSamlResponse, CookieStorage, type CreateApiKeyPayload, type CreateCheckoutPayload, type CreateCheckoutResponse, type CreateInvitationPayload, type CreateOrganizationPayload, type CreateOrganizationResponse, type CreatePlanPayload, type CreateScimTokenRequest, type CreateServicePayload, type CreateServiceResponse, type CreateSiemConfigRequest, type CreateWebhookRequest, type DeclineInvitationPayload, type DeviceCodeRequest, type DeviceCodeResponse, type DeviceTrust, type DeviceVerifyResponse, type DomainConfiguration, type DomainVerificationMethod, type DomainVerificationResponse, type DomainVerificationResult, type EndUser, type EndUserDetailResponse, type EndUserIdentity, type EndUserListResponse, type EndUserSubscription, type EventTypeInfo, type ExportUserDataResponse, type ForgetUserResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GeolocationData, type GetAuditLogParams, type GetRiskSettingsResponse, type GrowthTrendPoint, type Identity, type ImpersonateRequest, type ImpersonateResponse, type ImpersonationUserInfo, type Invitation, type InvitationStatus, type InvitationWithOrg, InvitationsModule, type JwtClaims, type ListApiKeysResponse, type ListDevicesResponse, type ListEndUsersParams, type ListOrganizationsParams, type ListPlatformOrganizationsParams, type ListScimTokensResponse, type ListSiemConfigsResponse, type LoginActivityPoint, type LoginEventExport, type LoginRequest, type LoginTrendPoint, type LoginUrlParams, type LoginsByProvider, type LoginsByService, type LookupEmailRequest, type LookupEmailResponse, MagicLinks, type MemberListResponse, type MemberRole, type Membership, type MembershipExport, MemoryStorage, type MfaEventExport, type MfaSetupResponse, type MfaStatusResponse, type MfaVerificationRequest, type MfaVerificationResponse, type MfaVerifyRequest, type MfaVerifyResponse, type OAuthCredentials, type OAuthIdentityExport, type OAuthProvider, type Organization, type OrganizationMember, type OrganizationResponse, type OrganizationStatus, type OrganizationStatusBreakdown, type OrganizationTier, OrganizationsModule, type PaginatedResponse, type PaginationInfo, type PaginationParams, type Passkey, type PasskeyAuthFinishRequest, type PasskeyAuthFinishResponse, type PasskeyAuthStartRequest, type PasskeyAuthStartResponse, type PasskeyExport, type PasskeyRegisterFinishRequest, type PasskeyRegisterFinishResponse, type PasskeyRegisterStartRequest, type PasskeyRegisterStartResponse, PasskeysModule, PermissionsModule, type Plan, type PlanResponse, type PlatformAnalyticsDateRangeParams, PlatformModule, type PlatformOrganizationResponse, type PlatformOrganizationsListResponse, type PlatformOverviewMetrics, type PromotePlatformOwnerPayload, type ProviderToken, type ProviderTokenGrant, type RecentLogin, type RecentOrganization, type RefreshTokenRequest, type RefreshTokenResponse, type RegisterRequest, type RegisterResponse, type RegistrationResponseJSON, type RejectOrganizationPayload, type ResendVerificationRequest, type ResendVerificationResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDeviceRequest, type RevokeDeviceResponse, type RevokeSessionsResponse, RiskAction, type RiskAnalytics, type RiskAssessment, type RiskContext, type RiskEnforcementMode, type RiskEngineConfig, type RiskEvent, RiskEventOutcome, type RiskFactor, RiskFactorType, type RiskRule, type RiskRuleCondition, type RiskScore, type RiskSettings, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type SelectOrganizationResponse, type Service, ServiceApiModule, type ServiceListResponse, type ServiceResponse, type ServiceType, type ServiceWithDetails, ServicesModule, type SetCustomDomainRequest, type SetOAuthCredentialsPayload, type SetPasswordRequest, type SetPasswordResponse, type SetSmtpRequest, type SiemConfigResponse, type SiemProviderType, type SmtpConfigResponse, SsoApiError, SsoClient, type SsoClientOptions, type StartLinkResponse, type Subscription, type TestConnectionResponse, type TokenRequest, type TokenResponse, type TokenStorage, type TopOrganization, type TransferOwnershipPayload, type UpdateBrandingRequest, type UpdateMemberRolePayload, type UpdateOrganizationPayload, type UpdateOrganizationTierPayload, type UpdatePlanPayload, type UpdateRiskSettingsRequest, type UpdateRiskSettingsResponse, type UpdateServicePayload, type UpdateSiemConfigRequest, type UpdateUserProfilePayload, type UpdateWebhookRequest, type User, type UserDevice, UserModule, type UserProfile, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQueryParams, type WebhookListResponse, type WebhookResponse };
5610
+ export { type AcceptInvitationPayload, type AdminLoginUrlParams, type AnalyticsQuery, type ApiKey, type ApiKeyCreateResponse, type ApproveOrganizationPayload, type AuditLog, type AuditLogEntry, type AuditLogQueryParams, type AuditLogResponse, AuthErrorCodes, AuthModule, type AuthSnapshot, type AuthenticationResponseJSON, type BackupCodesResponse, type BrandingConfiguration, BrowserStorage, type ChangePasswordRequest, type ChangePasswordResponse, type ConfigureSamlPayload, type ConfigureSamlResponse, CookieStorage, type CreateApiKeyPayload, type CreateCheckoutPayload, type CreateCheckoutResponse, type CreateInvitationPayload, type CreateOrganizationPayload, type CreateOrganizationResponse, type CreatePlanPayload, type CreateRoleRequest, type CreateScimTokenRequest, type CreateServicePayload, type CreateServiceResponse, type CreateSiemConfigRequest, type CreateWebhookRequest, type DeclineInvitationPayload, type DeviceCodeRequest, type DeviceCodeResponse, type DeviceVerifyResponse, type DomainConfiguration, type DomainVerificationMethod, type DomainVerificationResponse, type DomainVerificationResult, type EndUser, type EndUserDetailResponse, type EndUserIdentity, type EndUserListResponse, type EndUserSubscription, type EventTypeInfo, type ExportUserDataResponse, type ForgetUserResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GeoLocation, type GetAuditLogParams, type GetRiskSettingsResponse, type GrowthTrendPoint, type Identity, type ImpersonateRequest, type ImpersonateResponse, type ImpersonationUserInfo, type Invitation, type InvitationStatus, type InvitationWithOrg, InvitationsModule, type JwtClaims, type ListApiKeysResponse, type ListDevicesResponse, type ListEndUsersParams, type ListOrganizationsParams, type ListPlatformOrganizationsParams, type ListScimTokensResponse, type ListSiemConfigsResponse, type LoginActivityPoint, type LoginEventExport, type LoginRequest, type LoginTrendPoint, type LoginUrlParams, type LoginsByProvider, type LoginsByService, type LookupEmailRequest, type LookupEmailResponse, MagicLinks, type MemberListResponse, type MemberRole, type Membership, type MembershipExport, MemoryStorage, type MfaEventExport, type MfaSetupResponse, type MfaStatusResponse, type MfaVerificationRequest, type MfaVerificationResponse, type MfaVerifyRequest, type MfaVerifyResponse, type OAuthCredentials, type OAuthIdentityExport, type OAuthProvider, type Organization, type OrganizationMember, type OrganizationResponse, type OrganizationStatus, type OrganizationStatusBreakdown, type OrganizationTier, OrganizationsModule, type PaginatedResponse, type PaginationInfo, type PaginationParams, type Passkey, type PasskeyAuthFinishRequest, type PasskeyAuthFinishResponse, type PasskeyAuthStartRequest, type PasskeyAuthStartResponse, type PasskeyExport, type PasskeyRegisterFinishRequest, type PasskeyRegisterFinishResponse, type PasskeyRegisterStartRequest, type PasskeyRegisterStartResponse, PasskeysModule, PermissionsModule, type Plan, type PlanResponse, type PlatformAnalyticsDateRangeParams, PlatformModule, type PlatformOrganizationResponse, type PlatformOrganizationsListResponse, type PlatformOverviewMetrics, type PromotePlatformOwnerPayload, type ProviderToken, type ProviderTokenGrant, type RecentLogin, type RecentOrganization, type RefreshTokenRequest, type RefreshTokenResponse, type RegisterRequest, type RegisterResponse, type RegistrationResponseJSON, type RejectOrganizationPayload, type ResendVerificationRequest, type ResendVerificationResponse, type ResetPasswordRequest, type ResetPasswordResponse, type RevokeDeviceRequest, type RevokeDeviceResponse, type RevokeSessionsResponse, type RiskAction, type RiskAssessment, type RiskEventResponse, type RiskEventsQuery, type RoleResponse, type SamlCertificate, type SamlConfig, type ScimTokenResponse, type SelectOrganizationResponse, type Service, ServiceApiModule, type ServiceListResponse, type ServiceResponse, type ServiceType, type ServiceWithDetails, ServicesModule, type SetCustomDomainRequest, type SetOAuthCredentialsPayload, type SetPasswordRequest, type SetPasswordResponse, type SetSmtpRequest, type SiemConfigResponse, type SiemProviderType, type SmtpConfigResponse, SsoApiError, SsoClient, type SsoClientOptions, type StartLinkResponse, type Subscription, type TestConnectionResponse, type TokenRequest, type TokenResponse, type TokenStorage, type TopOrganization, type TransferOwnershipPayload, type UpdateBrandingRequest, type UpdateMemberRolePayload, type UpdateOrganizationPayload, type UpdateOrganizationTierPayload, type UpdatePlanPayload, type UpdateRiskSettingsRequest, type UpdateRiskSettingsResponse, type UpdateRoleRequest, type UpdateServicePayload, type UpdateSiemConfigRequest, type UpdateUserProfilePayload, type UpdateWebhookRequest, type User, type UserDevice, UserModule, type UserProfile, type Webhook, type WebhookDelivery, type WebhookDeliveryListResponse, type WebhookDeliveryQueryParams, type WebhookListResponse, type WebhookResponse };
package/dist/index.js CHANGED
@@ -21,7 +21,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  AuthErrorCodes: () => AuthErrorCodes,
24
- AuthMethod: () => AuthMethod,
25
24
  AuthModule: () => AuthModule,
26
25
  BrowserStorage: () => BrowserStorage,
27
26
  CookieStorage: () => CookieStorage,
@@ -32,9 +31,6 @@ __export(index_exports, {
32
31
  PasskeysModule: () => PasskeysModule,
33
32
  PermissionsModule: () => PermissionsModule,
34
33
  PlatformModule: () => PlatformModule,
35
- RiskAction: () => RiskAction,
36
- RiskEventOutcome: () => RiskEventOutcome,
37
- RiskFactorType: () => RiskFactorType,
38
34
  ServiceApiModule: () => ServiceApiModule,
39
35
  ServicesModule: () => ServicesModule,
40
36
  SsoApiError: () => SsoApiError,
@@ -1611,6 +1607,26 @@ var WebhooksModule = class {
1611
1607
  );
1612
1608
  return response.data;
1613
1609
  }
1610
+ /**
1611
+ * Trigger a test event for a specific webhook (owner/admin only).
1612
+ * Generates a "webhook.test.ping" event to verify connectivity.
1613
+ *
1614
+ * @param orgSlug Organization slug
1615
+ * @param webhookId Webhook ID
1616
+ * @returns Result including delivery ID
1617
+ *
1618
+ * @example
1619
+ * ```typescript
1620
+ * const result = await sso.organizations.webhooks.test('acme-corp', 'webhook-123');
1621
+ * console.log('Test event sent, delivery ID:', result.delivery_id);
1622
+ * ```
1623
+ */
1624
+ async test(orgSlug, webhookId) {
1625
+ const response = await this.http.post(
1626
+ `/api/organizations/${orgSlug}/webhooks/${webhookId}/test`
1627
+ );
1628
+ return response.data;
1629
+ }
1614
1630
  };
1615
1631
 
1616
1632
  // src/modules/organizations.ts
@@ -2152,6 +2168,74 @@ var OrganizationsModule = class {
2152
2168
  return response.data;
2153
2169
  }
2154
2170
  };
2171
+ /**
2172
+ * Security & Risk insights
2173
+ */
2174
+ this.security = {
2175
+ /**
2176
+ * Get risk events for an organization.
2177
+ * Requires 'owner' or 'admin' role.
2178
+ *
2179
+ * @param orgSlug Organization slug
2180
+ * @param params Query parameters
2181
+ */
2182
+ getRiskEvents: async (orgSlug, params) => {
2183
+ const response = await this.http.get(
2184
+ `/api/organizations/${orgSlug}/risk-events`,
2185
+ { params }
2186
+ );
2187
+ return response.data;
2188
+ }
2189
+ };
2190
+ /**
2191
+ * Role management methods
2192
+ */
2193
+ this.roles = {
2194
+ /**
2195
+ * List all custom roles for an organization.
2196
+ */
2197
+ list: async (orgSlug) => {
2198
+ const response = await this.http.get(
2199
+ `/api/organizations/${orgSlug}/roles`
2200
+ );
2201
+ return response.data;
2202
+ },
2203
+ /**
2204
+ * Get details of a specific role.
2205
+ */
2206
+ get: async (orgSlug, roleId) => {
2207
+ const response = await this.http.get(
2208
+ `/api/organizations/${orgSlug}/roles/${roleId}`
2209
+ );
2210
+ return response.data;
2211
+ },
2212
+ /**
2213
+ * Create a new custom role.
2214
+ */
2215
+ create: async (orgSlug, payload) => {
2216
+ const response = await this.http.post(
2217
+ `/api/organizations/${orgSlug}/roles`,
2218
+ payload
2219
+ );
2220
+ return response.data;
2221
+ },
2222
+ /**
2223
+ * Update an existing role.
2224
+ */
2225
+ update: async (orgSlug, roleId, payload) => {
2226
+ const response = await this.http.put(
2227
+ `/api/organizations/${orgSlug}/roles/${roleId}`,
2228
+ payload
2229
+ );
2230
+ return response.data;
2231
+ },
2232
+ /**
2233
+ * Delete a role.
2234
+ */
2235
+ delete: async (orgSlug, roleId) => {
2236
+ await this.http.delete(`/api/organizations/${orgSlug}/roles/${roleId}`);
2237
+ }
2238
+ };
2155
2239
  // ============================================================================
2156
2240
  // BYOP - BRING YOUR OWN PAYMENT
2157
2241
  // ============================================================================
@@ -4670,50 +4754,9 @@ var SsoClient = class {
4670
4754
  return this.session.getToken();
4671
4755
  }
4672
4756
  };
4673
-
4674
- // src/types/risk.ts
4675
- var RiskAction = /* @__PURE__ */ ((RiskAction2) => {
4676
- RiskAction2["ALLOW"] = "allow";
4677
- RiskAction2["LOG_ONLY"] = "log_only";
4678
- RiskAction2["CHALLENGE_MFA"] = "challenge_mfa";
4679
- RiskAction2["BLOCK"] = "block";
4680
- return RiskAction2;
4681
- })(RiskAction || {});
4682
- var RiskFactorType = /* @__PURE__ */ ((RiskFactorType2) => {
4683
- RiskFactorType2["NEW_IP"] = "new_ip";
4684
- RiskFactorType2["HIGH_RISK_LOCATION"] = "high_risk_location";
4685
- RiskFactorType2["IMPOSSIBLE_TRAVEL"] = "impossible_travel";
4686
- RiskFactorType2["NEW_DEVICE"] = "new_device";
4687
- RiskFactorType2["FAILED_ATTEMPTS"] = "failed_attempts";
4688
- RiskFactorType2["UNUSUAL_TIME"] = "unusual_time";
4689
- RiskFactorType2["SUSPICIOUS_USER_AGENT"] = "suspicious_user_agent";
4690
- RiskFactorType2["ANONYMOUS_NETWORK"] = "anonymous_network";
4691
- RiskFactorType2["NEW_ACCOUNT"] = "new_account";
4692
- RiskFactorType2["SUSPICIOUS_HISTORY"] = "suspicious_history";
4693
- RiskFactorType2["HIGH_VELOCITY"] = "high_velocity";
4694
- RiskFactorType2["CUSTOM_RULE"] = "custom_rule";
4695
- return RiskFactorType2;
4696
- })(RiskFactorType || {});
4697
- var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
4698
- AuthMethod2["PASSWORD"] = "password";
4699
- AuthMethod2["OAUTH"] = "oauth";
4700
- AuthMethod2["PASSKEY"] = "passkey";
4701
- AuthMethod2["MAGIC_LINK"] = "magic_link";
4702
- AuthMethod2["MFA"] = "mfa";
4703
- AuthMethod2["SAML"] = "saml";
4704
- return AuthMethod2;
4705
- })(AuthMethod || {});
4706
- var RiskEventOutcome = /* @__PURE__ */ ((RiskEventOutcome2) => {
4707
- RiskEventOutcome2["ALLOWED"] = "allowed";
4708
- RiskEventOutcome2["BLOCKED"] = "blocked";
4709
- RiskEventOutcome2["CHALLENGED"] = "challenged";
4710
- RiskEventOutcome2["LOGGED"] = "logged";
4711
- return RiskEventOutcome2;
4712
- })(RiskEventOutcome || {});
4713
4757
  // Annotate the CommonJS export names for ESM import in node:
4714
4758
  0 && (module.exports = {
4715
4759
  AuthErrorCodes,
4716
- AuthMethod,
4717
4760
  AuthModule,
4718
4761
  BrowserStorage,
4719
4762
  CookieStorage,
@@ -4724,9 +4767,6 @@ var RiskEventOutcome = /* @__PURE__ */ ((RiskEventOutcome2) => {
4724
4767
  PasskeysModule,
4725
4768
  PermissionsModule,
4726
4769
  PlatformModule,
4727
- RiskAction,
4728
- RiskEventOutcome,
4729
- RiskFactorType,
4730
4770
  ServiceApiModule,
4731
4771
  ServicesModule,
4732
4772
  SsoApiError,
package/dist/index.mjs CHANGED
@@ -1566,6 +1566,26 @@ var WebhooksModule = class {
1566
1566
  );
1567
1567
  return response.data;
1568
1568
  }
1569
+ /**
1570
+ * Trigger a test event for a specific webhook (owner/admin only).
1571
+ * Generates a "webhook.test.ping" event to verify connectivity.
1572
+ *
1573
+ * @param orgSlug Organization slug
1574
+ * @param webhookId Webhook ID
1575
+ * @returns Result including delivery ID
1576
+ *
1577
+ * @example
1578
+ * ```typescript
1579
+ * const result = await sso.organizations.webhooks.test('acme-corp', 'webhook-123');
1580
+ * console.log('Test event sent, delivery ID:', result.delivery_id);
1581
+ * ```
1582
+ */
1583
+ async test(orgSlug, webhookId) {
1584
+ const response = await this.http.post(
1585
+ `/api/organizations/${orgSlug}/webhooks/${webhookId}/test`
1586
+ );
1587
+ return response.data;
1588
+ }
1569
1589
  };
1570
1590
 
1571
1591
  // src/modules/organizations.ts
@@ -2107,6 +2127,74 @@ var OrganizationsModule = class {
2107
2127
  return response.data;
2108
2128
  }
2109
2129
  };
2130
+ /**
2131
+ * Security & Risk insights
2132
+ */
2133
+ this.security = {
2134
+ /**
2135
+ * Get risk events for an organization.
2136
+ * Requires 'owner' or 'admin' role.
2137
+ *
2138
+ * @param orgSlug Organization slug
2139
+ * @param params Query parameters
2140
+ */
2141
+ getRiskEvents: async (orgSlug, params) => {
2142
+ const response = await this.http.get(
2143
+ `/api/organizations/${orgSlug}/risk-events`,
2144
+ { params }
2145
+ );
2146
+ return response.data;
2147
+ }
2148
+ };
2149
+ /**
2150
+ * Role management methods
2151
+ */
2152
+ this.roles = {
2153
+ /**
2154
+ * List all custom roles for an organization.
2155
+ */
2156
+ list: async (orgSlug) => {
2157
+ const response = await this.http.get(
2158
+ `/api/organizations/${orgSlug}/roles`
2159
+ );
2160
+ return response.data;
2161
+ },
2162
+ /**
2163
+ * Get details of a specific role.
2164
+ */
2165
+ get: async (orgSlug, roleId) => {
2166
+ const response = await this.http.get(
2167
+ `/api/organizations/${orgSlug}/roles/${roleId}`
2168
+ );
2169
+ return response.data;
2170
+ },
2171
+ /**
2172
+ * Create a new custom role.
2173
+ */
2174
+ create: async (orgSlug, payload) => {
2175
+ const response = await this.http.post(
2176
+ `/api/organizations/${orgSlug}/roles`,
2177
+ payload
2178
+ );
2179
+ return response.data;
2180
+ },
2181
+ /**
2182
+ * Update an existing role.
2183
+ */
2184
+ update: async (orgSlug, roleId, payload) => {
2185
+ const response = await this.http.put(
2186
+ `/api/organizations/${orgSlug}/roles/${roleId}`,
2187
+ payload
2188
+ );
2189
+ return response.data;
2190
+ },
2191
+ /**
2192
+ * Delete a role.
2193
+ */
2194
+ delete: async (orgSlug, roleId) => {
2195
+ await this.http.delete(`/api/organizations/${orgSlug}/roles/${roleId}`);
2196
+ }
2197
+ };
2110
2198
  // ============================================================================
2111
2199
  // BYOP - BRING YOUR OWN PAYMENT
2112
2200
  // ============================================================================
@@ -4625,49 +4713,8 @@ var SsoClient = class {
4625
4713
  return this.session.getToken();
4626
4714
  }
4627
4715
  };
4628
-
4629
- // src/types/risk.ts
4630
- var RiskAction = /* @__PURE__ */ ((RiskAction2) => {
4631
- RiskAction2["ALLOW"] = "allow";
4632
- RiskAction2["LOG_ONLY"] = "log_only";
4633
- RiskAction2["CHALLENGE_MFA"] = "challenge_mfa";
4634
- RiskAction2["BLOCK"] = "block";
4635
- return RiskAction2;
4636
- })(RiskAction || {});
4637
- var RiskFactorType = /* @__PURE__ */ ((RiskFactorType2) => {
4638
- RiskFactorType2["NEW_IP"] = "new_ip";
4639
- RiskFactorType2["HIGH_RISK_LOCATION"] = "high_risk_location";
4640
- RiskFactorType2["IMPOSSIBLE_TRAVEL"] = "impossible_travel";
4641
- RiskFactorType2["NEW_DEVICE"] = "new_device";
4642
- RiskFactorType2["FAILED_ATTEMPTS"] = "failed_attempts";
4643
- RiskFactorType2["UNUSUAL_TIME"] = "unusual_time";
4644
- RiskFactorType2["SUSPICIOUS_USER_AGENT"] = "suspicious_user_agent";
4645
- RiskFactorType2["ANONYMOUS_NETWORK"] = "anonymous_network";
4646
- RiskFactorType2["NEW_ACCOUNT"] = "new_account";
4647
- RiskFactorType2["SUSPICIOUS_HISTORY"] = "suspicious_history";
4648
- RiskFactorType2["HIGH_VELOCITY"] = "high_velocity";
4649
- RiskFactorType2["CUSTOM_RULE"] = "custom_rule";
4650
- return RiskFactorType2;
4651
- })(RiskFactorType || {});
4652
- var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
4653
- AuthMethod2["PASSWORD"] = "password";
4654
- AuthMethod2["OAUTH"] = "oauth";
4655
- AuthMethod2["PASSKEY"] = "passkey";
4656
- AuthMethod2["MAGIC_LINK"] = "magic_link";
4657
- AuthMethod2["MFA"] = "mfa";
4658
- AuthMethod2["SAML"] = "saml";
4659
- return AuthMethod2;
4660
- })(AuthMethod || {});
4661
- var RiskEventOutcome = /* @__PURE__ */ ((RiskEventOutcome2) => {
4662
- RiskEventOutcome2["ALLOWED"] = "allowed";
4663
- RiskEventOutcome2["BLOCKED"] = "blocked";
4664
- RiskEventOutcome2["CHALLENGED"] = "challenged";
4665
- RiskEventOutcome2["LOGGED"] = "logged";
4666
- return RiskEventOutcome2;
4667
- })(RiskEventOutcome || {});
4668
4716
  export {
4669
4717
  AuthErrorCodes,
4670
- AuthMethod,
4671
4718
  AuthModule,
4672
4719
  BrowserStorage,
4673
4720
  CookieStorage,
@@ -4678,9 +4725,6 @@ export {
4678
4725
  PasskeysModule,
4679
4726
  PermissionsModule,
4680
4727
  PlatformModule,
4681
- RiskAction,
4682
- RiskEventOutcome,
4683
- RiskFactorType,
4684
4728
  ServiceApiModule,
4685
4729
  ServicesModule,
4686
4730
  SsoApiError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drmhse/sso-sdk",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "description": "Zero-dependency TypeScript SDK for AuthOS, the multi-tenant authentication platform",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",