@gatwech/auth 1.0.0-beta.24 → 1.0.0-beta.25

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.
Files changed (90) hide show
  1. package/dist/adapters/index.d.mts +1 -1
  2. package/dist/api/index.d.mts +1 -1
  3. package/dist/{audit-log-DhRRCMrv.mjs → audit-log-CQnf8nrN.mjs} +442 -46
  4. package/dist/client/index.d.mts +1 -1
  5. package/dist/client/plugins/index.d.mts +46 -46
  6. package/dist/client/plugins/index.mjs +2 -2
  7. package/dist/client/react/index.d.mts +15 -15
  8. package/dist/{client-CMsC6-rl.mjs → client-BkpNva-h.mjs} +3 -2
  9. package/dist/{client-CGV_kj99.d.mts → client-g0OAVuPQ.d.mts} +1 -1
  10. package/dist/{client-CT-acJeN.d.mts → client-zkWmSxqy.d.mts} +7 -4
  11. package/dist/cookies/index.d.mts +2 -2
  12. package/dist/db/index.d.mts +1 -1
  13. package/dist/{index-Czr_eQFE.d.mts → index-B4HTudhm.d.mts} +6 -6
  14. package/dist/{index-DYqQWdEv.d.mts → index-BHiF_ZfZ.d.mts} +13 -13
  15. package/dist/{index-Dmjw6re9.d.mts → index-BX55rZO5.d.mts} +2 -2
  16. package/dist/{index-Clwezlxm.d.mts → index-BfwCJQfM.d.mts} +8 -8
  17. package/dist/{index-DGRGLg16.d.mts → index-BhbilPfs.d.mts} +2 -2
  18. package/dist/{index-JzSy-vFn.d.mts → index-Bi-vEjDm.d.mts} +166 -166
  19. package/dist/{index-Cl9ITXy1.d.mts → index-BifhxQ8O.d.mts} +10 -10
  20. package/dist/{index-DWGj7du8.d.mts → index-BiomZttP.d.mts} +19 -19
  21. package/dist/{index-Hoybqpnt.d.mts → index-BoHrBgTB.d.mts} +9 -9
  22. package/dist/{index-UDzaYKxq.d.mts → index-C5W_sTlp.d.mts} +9 -9
  23. package/dist/{index-CLhlur69.d.mts → index-CNyQFga7.d.mts} +6 -6
  24. package/dist/{index-CZtQ0rUe.d.mts → index-CTjXncwM.d.mts} +113 -113
  25. package/dist/{index-CGGitykk.d.mts → index-CUUaJp3R.d.mts} +7 -7
  26. package/dist/{index-D85KXOKz.d.mts → index-CcJjgkwe.d.mts} +3 -3
  27. package/dist/{index-B-i2ob-C.d.mts → index-Cdfh66xb.d.mts} +9 -9
  28. package/dist/{index-CHMYUshk.d.mts → index-DBtm_waB.d.mts} +13 -13
  29. package/dist/{index-DWSbFJWU.d.mts → index-DD_pxX-h.d.mts} +662 -354
  30. package/dist/{index-BYxt8qOP.d.mts → index-DRoa3BGG.d.mts} +33 -33
  31. package/dist/{index-D5cyFBEb.d.mts → index-M0IQ_DTL.d.mts} +4 -4
  32. package/dist/{index-rcUKPBBy.d.mts → index-gRLqvVoc.d.mts} +6 -6
  33. package/dist/{index-Dt6JhAV4.d.mts → index-i1L-uguJ.d.mts} +6 -6
  34. package/dist/{index-B6to9CaK.d.mts → index-kBEBsEUr.d.mts} +1 -1
  35. package/dist/{index-BRUQHEUF.d.mts → index-mDmrBYrk.d.mts} +5 -5
  36. package/dist/index.d.mts +1 -1
  37. package/dist/integrations/next-js.d.mts +4 -4
  38. package/dist/integrations/node.d.mts +1 -1
  39. package/dist/integrations/react-start.d.mts +2 -2
  40. package/dist/oauth2/index.d.mts +1 -1
  41. package/dist/plugins/admin/index.d.mts +2 -2
  42. package/dist/plugins/anonymous/index.d.mts +2 -2
  43. package/dist/plugins/audit-log/client.d.mts +23 -23
  44. package/dist/plugins/audit-log/index.d.mts +23 -23
  45. package/dist/plugins/audit-log/index.mjs +3 -3
  46. package/dist/plugins/bearer/index.d.mts +1 -1
  47. package/dist/plugins/captcha/index.d.mts +1 -1
  48. package/dist/plugins/custom-session/index.d.mts +2 -2
  49. package/dist/plugins/device-authorization/index.d.mts +1 -1
  50. package/dist/plugins/email-otp/index.d.mts +1 -1
  51. package/dist/plugins/generic-oauth/index.d.mts +2 -2
  52. package/dist/plugins/haveibeenpwned/index.d.mts +1 -1
  53. package/dist/plugins/index.d.mts +23 -23
  54. package/dist/plugins/index.mjs +5 -5
  55. package/dist/plugins/jwt/index.d.mts +2 -2
  56. package/dist/plugins/magic-link/index.d.mts +1 -1
  57. package/dist/plugins/multi-session/index.d.mts +1 -1
  58. package/dist/plugins/oauth-proxy/index.d.mts +1 -1
  59. package/dist/plugins/one-tap/index.d.mts +1 -1
  60. package/dist/plugins/one-time-token/index.d.mts +2 -2
  61. package/dist/plugins/one-time-token/index.mjs +4 -4
  62. package/dist/plugins/organization/index.d.mts +2 -2
  63. package/dist/plugins/passkey/index.d.mts +2 -2
  64. package/dist/plugins/phone-number/index.d.mts +2 -2
  65. package/dist/plugins/sentinel/client.d.mts +23 -23
  66. package/dist/plugins/sentinel/client.mjs +2 -2
  67. package/dist/plugins/sentinel/index.d.mts +22 -22
  68. package/dist/plugins/sentinel/index.mjs +3 -3
  69. package/dist/plugins/two-factor/index.d.mts +2 -2
  70. package/dist/plugins/username/index.d.mts +1 -1
  71. package/dist/{registry-GztLf62p.mjs → registry-BjYhRF79.mjs} +69 -2
  72. package/dist/{sentinel-b8XEetew.mjs → sentinel-BttZLWPD.mjs} +70 -14
  73. package/dist/src/plugins/audit-log/error-codes.d.ts +7 -0
  74. package/dist/src/plugins/audit-log/events.d.ts +13 -0
  75. package/dist/src/plugins/audit-log/index.d.ts +114 -8
  76. package/dist/src/plugins/audit-log/integrity.d.ts +20 -0
  77. package/dist/src/plugins/audit-log/redact.d.ts +18 -0
  78. package/dist/src/plugins/audit-log/remote.d.ts +1 -0
  79. package/dist/src/plugins/audit-log/schema.d.ts +25 -0
  80. package/dist/src/plugins/audit-log/types.d.ts +73 -13
  81. package/dist/src/plugins/sentinel/actions.d.ts +0 -6
  82. package/dist/src/plugins/sentinel/client.d.ts +3 -0
  83. package/dist/src/plugins/sentinel/error-codes.d.ts +6 -0
  84. package/dist/src/plugins/sentinel/index.d.ts +80 -3
  85. package/dist/src/plugins/sentinel/types.d.ts +1 -1
  86. package/dist/test-utils/index.d.mts +2 -2
  87. package/dist/test-utils/index.mjs +4 -4
  88. package/dist/types/index.d.mts +1 -1
  89. package/package.json +3 -3
  90. /package/dist/{pow-DvkUopsK.mjs → pow-Vna_j4hx.mjs} +0 -0
@@ -1,10 +1,10 @@
1
- import { g as User$1 } from "./index-CZtQ0rUe.mjs";
1
+ import { g as User$1 } from "./index-CTjXncwM.mjs";
2
2
  import { n as DBPrimitive } from "./index-BL_t8cRp-C4QYBsac.mjs";
3
3
  import { t as InferOptionSchema } from "./plugins-Dy_FrD4Y.mjs";
4
4
  import { o as Statements } from "./index-CxlWnL9c.mjs";
5
- import * as _gatwech_core55 from "@gatwech/core";
5
+ import * as _gatwech_core57 from "@gatwech/core";
6
6
  import { AuthContext, GenericEndpointContext, HookEndpointContext } from "@gatwech/core";
7
- import * as better_call239 from "better-call";
7
+ import * as better_call278 from "better-call";
8
8
  import { AuthEndpoint, AuthMiddleware, createAuthEndpoint as createAuthEndpoint$1, createAuthMiddleware as createAuthMiddleware$1, optionsMiddleware } from "@gatwech/core/api";
9
9
  import * as zod381 from "zod";
10
10
  import * as _gatwech_core_db14 from "@gatwech/core/db";
@@ -547,8 +547,8 @@ declare const apiKey: (options?: ApiKeyOptions | undefined) => {
547
547
  };
548
548
  hooks: {
549
549
  before: {
550
- matcher: (ctx: _gatwech_core55.HookEndpointContext) => boolean;
551
- handler: (inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<{
550
+ matcher: (ctx: _gatwech_core57.HookEndpointContext) => boolean;
551
+ handler: (inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<{
552
552
  user: {
553
553
  id: string;
554
554
  createdAt: Date;
@@ -569,7 +569,7 @@ declare const apiKey: (options?: ApiKeyOptions | undefined) => {
569
569
  expiresAt: Date;
570
570
  };
571
571
  } | {
572
- context: better_call239.MiddlewareContext<better_call239.MiddlewareOptions, _gatwech_core55.AuthContext<_gatwech_core55.PayvoAuthOptions> & {
572
+ context: better_call278.MiddlewareContext<better_call278.MiddlewareOptions, _gatwech_core57.AuthContext<_gatwech_core57.PayvoAuthOptions> & {
573
573
  returned?: unknown | undefined;
574
574
  responseHeaders?: Headers | undefined;
575
575
  }>;
@@ -621,7 +621,7 @@ declare const apiKey: (options?: ApiKeyOptions | undefined) => {
621
621
  } & {
622
622
  asResponse?: boolean;
623
623
  returnHeaders?: boolean;
624
- use?: better_call239.Middleware[];
624
+ use?: better_call278.Middleware[];
625
625
  path?: string;
626
626
  } & {
627
627
  asResponse?: AsResponse | undefined;
@@ -855,7 +855,7 @@ declare const apiKey: (options?: ApiKeyOptions | undefined) => {
855
855
  } & {
856
856
  asResponse?: boolean;
857
857
  returnHeaders?: boolean;
858
- use?: better_call239.Middleware[];
858
+ use?: better_call278.Middleware[];
859
859
  path?: string;
860
860
  } & {
861
861
  asResponse?: AsResponse | undefined;
@@ -933,7 +933,7 @@ declare const apiKey: (options?: ApiKeyOptions | undefined) => {
933
933
  } & {
934
934
  asResponse?: boolean;
935
935
  returnHeaders?: boolean;
936
- use?: better_call239.Middleware[];
936
+ use?: better_call278.Middleware[];
937
937
  path?: string;
938
938
  } & {
939
939
  asResponse?: AsResponse | undefined;
@@ -993,7 +993,7 @@ declare const apiKey: (options?: ApiKeyOptions | undefined) => {
993
993
  query: zod381.ZodObject<{
994
994
  id: zod381.ZodString;
995
995
  }, zod_v4_core51.$strip>;
996
- use: ((inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<{
996
+ use: ((inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<{
997
997
  session: {
998
998
  session: Record<string, any> & {
999
999
  id: string;
@@ -1186,7 +1186,7 @@ declare const apiKey: (options?: ApiKeyOptions | undefined) => {
1186
1186
  } & {
1187
1187
  asResponse?: boolean;
1188
1188
  returnHeaders?: boolean;
1189
- use?: better_call239.Middleware[];
1189
+ use?: better_call278.Middleware[];
1190
1190
  path?: string;
1191
1191
  } & {
1192
1192
  asResponse?: AsResponse | undefined;
@@ -1416,7 +1416,7 @@ declare const apiKey: (options?: ApiKeyOptions | undefined) => {
1416
1416
  } & {
1417
1417
  asResponse?: boolean;
1418
1418
  returnHeaders?: boolean;
1419
- use?: better_call239.Middleware[];
1419
+ use?: better_call278.Middleware[];
1420
1420
  path?: string;
1421
1421
  } & {
1422
1422
  asResponse?: AsResponse | undefined;
@@ -1434,7 +1434,7 @@ declare const apiKey: (options?: ApiKeyOptions | undefined) => {
1434
1434
  body: zod381.ZodObject<{
1435
1435
  keyId: zod381.ZodString;
1436
1436
  }, zod_v4_core51.$strip>;
1437
- use: ((inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<{
1437
+ use: ((inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<{
1438
1438
  session: {
1439
1439
  session: Record<string, any> & {
1440
1440
  id: string;
@@ -1533,7 +1533,7 @@ declare const apiKey: (options?: ApiKeyOptions | undefined) => {
1533
1533
  } & {
1534
1534
  asResponse?: boolean;
1535
1535
  returnHeaders?: boolean;
1536
- use?: better_call239.Middleware[];
1536
+ use?: better_call278.Middleware[];
1537
1537
  path?: string;
1538
1538
  } & {
1539
1539
  asResponse?: AsResponse | undefined;
@@ -1590,7 +1590,7 @@ declare const apiKey: (options?: ApiKeyOptions | undefined) => {
1590
1590
  }[]>;
1591
1591
  options: {
1592
1592
  method: "GET";
1593
- use: ((inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<{
1593
+ use: ((inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<{
1594
1594
  session: {
1595
1595
  session: Record<string, any> & {
1596
1596
  id: string;
@@ -1769,7 +1769,7 @@ declare const apiKey: (options?: ApiKeyOptions | undefined) => {
1769
1769
  } & {
1770
1770
  asResponse?: boolean;
1771
1771
  returnHeaders?: boolean;
1772
- use?: better_call239.Middleware[];
1772
+ use?: better_call278.Middleware[];
1773
1773
  path?: string;
1774
1774
  } & {
1775
1775
  asResponse?: AsResponse | undefined;
@@ -1959,7 +1959,7 @@ interface LastLoginMethodOptions {
1959
1959
  */
1960
1960
  declare const lastLoginMethod: <O extends LastLoginMethodOptions>(userConfig?: O | undefined) => {
1961
1961
  id: "last-login-method";
1962
- init(ctx: _gatwech_core55.AuthContext<_gatwech_core55.PayvoAuthOptions>): {
1962
+ init(ctx: _gatwech_core57.AuthContext<_gatwech_core57.PayvoAuthOptions>): {
1963
1963
  options: {
1964
1964
  databaseHooks: {
1965
1965
  user: {
@@ -1972,7 +1972,7 @@ declare const lastLoginMethod: <O extends LastLoginMethodOptions>(userConfig?: O
1972
1972
  emailVerified: boolean;
1973
1973
  name: string;
1974
1974
  image?: string | null | undefined;
1975
- } & Record<string, unknown>, context: GenericEndpointContext<_gatwech_core55.PayvoAuthOptions> | undefined): Promise<{
1975
+ } & Record<string, unknown>, context: GenericEndpointContext<_gatwech_core57.PayvoAuthOptions> | undefined): Promise<{
1976
1976
  data: {
1977
1977
  lastLoginMethod: any;
1978
1978
  id: string;
@@ -1997,7 +1997,7 @@ declare const lastLoginMethod: <O extends LastLoginMethodOptions>(userConfig?: O
1997
1997
  token: string;
1998
1998
  ipAddress?: string | null | undefined;
1999
1999
  userAgent?: string | null | undefined;
2000
- } & Record<string, unknown>, context: GenericEndpointContext<_gatwech_core55.PayvoAuthOptions> | undefined): Promise<void>;
2000
+ } & Record<string, unknown>, context: GenericEndpointContext<_gatwech_core57.PayvoAuthOptions> | undefined): Promise<void>;
2001
2001
  };
2002
2002
  };
2003
2003
  };
@@ -2006,7 +2006,7 @@ declare const lastLoginMethod: <O extends LastLoginMethodOptions>(userConfig?: O
2006
2006
  hooks: {
2007
2007
  after: {
2008
2008
  matcher(): true;
2009
- handler: (inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<void>;
2009
+ handler: (inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<void>;
2010
2010
  }[];
2011
2011
  };
2012
2012
  schema: O["storeInDatabase"] extends true ? {
@@ -2022,289 +2022,6 @@ declare const lastLoginMethod: <O extends LastLoginMethodOptions>(userConfig?: O
2022
2022
  } : undefined;
2023
2023
  };
2024
2024
  //#endregion
2025
- //#region src/plugins/audit-log/events.d.ts
2026
- /**
2027
- * Audit event types recorded by the audit log plugin
2028
- */
2029
- declare const AUDIT_EVENT_TYPES: {
2030
- readonly USER_SIGNED_UP: "user_signed_up";
2031
- readonly USER_PROFILE_UPDATED: "user_profile_updated";
2032
- readonly USER_PROFILE_IMAGE_UPDATED: "user_profile_image_updated";
2033
- readonly USER_EMAIL_VERIFIED: "user_email_verified";
2034
- readonly USER_BANNED: "user_banned";
2035
- readonly USER_UNBANNED: "user_unbanned";
2036
- readonly USER_DELETED: "user_deleted";
2037
- readonly USER_ROLE_UPDATED: "user_role_updated";
2038
- readonly USER_EMAIL_CHANGED: "user_email_changed";
2039
- readonly USER_PHONE_NUMBER_CHANGED: "user_phone_number_changed";
2040
- readonly USER_SIGNED_IN: "user_signed_in";
2041
- readonly USER_SIGNED_OUT: "user_signed_out";
2042
- readonly SESSION_CREATED: "session_created";
2043
- readonly SESSION_REVOKED: "session_revoked";
2044
- readonly SESSIONS_REVOKED_ALL: "sessions_revoked_all";
2045
- readonly USER_IMPERSONATED: "user_impersonated";
2046
- readonly USER_IMPERSONATION_STOPPED: "user_impersonation_stopped";
2047
- readonly DEVICE_AUTHORIZATION_APPROVED: "device_authorization_approved";
2048
- readonly DEVICE_AUTHORIZATION_DENIED: "device_authorization_denied";
2049
- readonly ACCOUNT_LINKED: "account_linked";
2050
- readonly ACCOUNT_UNLINKED: "account_unlinked";
2051
- readonly PASSWORD_CHANGED: "password_changed";
2052
- readonly TWO_FACTOR_ENABLED: "two_factor_enabled";
2053
- readonly TWO_FACTOR_DISABLED: "two_factor_disabled";
2054
- readonly BACKUP_CODES_GENERATED: "two_factor_backup_codes_generated";
2055
- readonly PASSKEY_ADDED: "passkey_added";
2056
- readonly PASSKEY_REMOVED: "passkey_removed";
2057
- readonly API_KEY_CREATED: "api_key_created";
2058
- readonly API_KEY_UPDATED: "api_key_updated";
2059
- readonly API_KEY_DELETED: "api_key_deleted";
2060
- readonly PASSWORD_RESET_REQUESTED: "password_reset_requested";
2061
- readonly PASSWORD_RESET_COMPLETED: "password_reset_completed";
2062
- readonly EMAIL_VERIFICATION_SENT: "email_verification_sent";
2063
- readonly ORGANIZATION_CREATED: "organization_created";
2064
- readonly ORGANIZATION_UPDATED: "organization_updated";
2065
- readonly ORGANIZATION_DELETED: "organization_deleted";
2066
- readonly ORGANIZATION_ROLE_CREATED: "organization_role_created";
2067
- readonly ORGANIZATION_ROLE_UPDATED: "organization_role_updated";
2068
- readonly ORGANIZATION_ROLE_DELETED: "organization_role_deleted";
2069
- readonly MEMBER_ADDED: "member_added";
2070
- readonly MEMBER_REMOVED: "member_removed";
2071
- readonly MEMBER_ROLE_UPDATED: "member_role_updated";
2072
- readonly MEMBER_INVITED: "member_invited";
2073
- readonly INVITE_ACCEPTED: "invite_accepted";
2074
- readonly INVITE_REJECTED: "invite_rejected";
2075
- readonly INVITE_CANCELLED: "invite_cancelled";
2076
- readonly TEAM_CREATED: "team_created";
2077
- readonly TEAM_UPDATED: "team_updated";
2078
- readonly TEAM_DELETED: "team_deleted";
2079
- readonly TEAM_MEMBER_ADDED: "team_member_added";
2080
- readonly TEAM_MEMBER_REMOVED: "team_member_removed";
2081
- readonly USER_SIGN_IN_FAILED: "user_sign_in_failed";
2082
- readonly VERIFICATION_FAILED: "verification_failed";
2083
- };
2084
- /**
2085
- * Security event types recorded by the sentinel plugin
2086
- *
2087
- * Declared here so both plugins share the same event types
2088
- */
2089
- declare const SECURITY_EVENT_TYPES: {
2090
- readonly BLOCKED: "security_blocked";
2091
- readonly ALLOWED_AFTER_CHALLENGE: "security_allowed";
2092
- readonly CREDENTIAL_STUFFING: "security_credential_stuffing";
2093
- readonly IMPOSSIBLE_TRAVEL: "security_impossible_travel";
2094
- readonly GEO_BLOCKED: "security_geo_blocked";
2095
- readonly BOT_BLOCKED: "security_bot_blocked";
2096
- readonly SUSPICIOUS_IP: "security_suspicious_ip";
2097
- readonly VELOCITY_EXCEEDED: "security_velocity_exceeded";
2098
- readonly FREE_TRIAL_ABUSE: "security_free_trial_abuse";
2099
- readonly COMPROMISED_PASSWORD: "security_compromised_password";
2100
- readonly STALE_ACCOUNT: "security_stale_account";
2101
- readonly INVALID_EMAIL: "security_invalid_email";
2102
- readonly UNBLOCKED: "security_unblocked";
2103
- };
2104
- type AuditEventType = (typeof AUDIT_EVENT_TYPES)[keyof typeof AUDIT_EVENT_TYPES] | (typeof SECURITY_EVENT_TYPES)[keyof typeof SECURITY_EVENT_TYPES];
2105
- declare const ALL_EVENT_TYPES: AuditEventType[];
2106
- /** Endpoints that complete a sign-in by creating a session */
2107
- declare const SIGN_IN_PATHS: string[];
2108
- /** Sign-in endpoints that check credentials, so a failure is a failed attempt */
2109
- declare const CREDENTIAL_SIGN_IN_PATHS: string[];
2110
- /**
2111
- * Endpoints that check a one-time code or token outside a sign-in, so a
2112
- * failure is a failed attempt
2113
- */
2114
- declare const VERIFICATION_PATHS: string[];
2115
- /** Endpoints whose successful response maps to a single event */
2116
- declare const PATH_EVENTS: Record<string, AuditEventType>;
2117
- //#endregion
2118
- //#region src/plugins/audit-log/schema.d.ts
2119
- declare const schema: {
2120
- auditLog: {
2121
- fields: {
2122
- eventType: {
2123
- type: "string";
2124
- required: true;
2125
- };
2126
- userId: {
2127
- type: "string";
2128
- required: false;
2129
- };
2130
- identifier: {
2131
- type: "string";
2132
- required: false;
2133
- };
2134
- organizationId: {
2135
- type: "string";
2136
- required: false;
2137
- };
2138
- status: {
2139
- type: "string";
2140
- required: true;
2141
- };
2142
- path: {
2143
- type: "string";
2144
- required: false;
2145
- };
2146
- ipAddress: {
2147
- type: "string";
2148
- required: false;
2149
- };
2150
- userAgent: {
2151
- type: "string";
2152
- required: false;
2153
- };
2154
- visitorId: {
2155
- type: "string";
2156
- required: false;
2157
- };
2158
- eventData: {
2159
- type: "json";
2160
- required: false;
2161
- };
2162
- createdAt: {
2163
- type: "date";
2164
- required: true;
2165
- };
2166
- };
2167
- };
2168
- };
2169
- //#endregion
2170
- //#region src/plugins/audit-log/types.d.ts
2171
- interface AuditEvent {
2172
- id: string;
2173
- eventType: AuditEventType;
2174
- status: "success" | "failure" | "blocked" | "challenged";
2175
- /**
2176
- * The user who performed the action
2177
- *
2178
- * Null when the actor is unknown, e.g. a failed sign-in
2179
- */
2180
- userId: string | null;
2181
- /**
2182
- * The actor's identity, such as an email, username or phone number
2183
- */
2184
- identifier: string | null;
2185
- organizationId: string | null;
2186
- /**
2187
- * The endpoint that triggered the event
2188
- */
2189
- path: string | null;
2190
- ipAddress: string | null;
2191
- userAgent: string | null;
2192
- visitorId: string | null;
2193
- /**
2194
- * Additional details about the event
2195
- *
2196
- * Never contains passwords, tokens or OTPs
2197
- */
2198
- eventData: Record<string, unknown> | null;
2199
- createdAt: Date;
2200
- }
2201
- interface AuditLogOptions {
2202
- /**
2203
- * Send events to the hosted backend
2204
- *
2205
- * Enabled when an API key and URL are configured, either here or through
2206
- * `PAYVO_INFRA_API_KEY` and `PAYVO_INFRA_API_URL`. Set to `false` to
2207
- * disable it.
2208
- */
2209
- remote?: {
2210
- /**
2211
- * The hosted backend API URL
2212
- *
2213
- * @default process.env.PAYVO_INFRA_API_URL
2214
- */
2215
- apiUrl?: string | undefined;
2216
- /**
2217
- * The hosted backend API key
2218
- *
2219
- * @default process.env.PAYVO_INFRA_API_KEY
2220
- */
2221
- apiKey?: string | undefined;
2222
- /**
2223
- * Request timeout in milliseconds
2224
- *
2225
- * @default 3000
2226
- */
2227
- timeout?: number | undefined;
2228
- /**
2229
- * Additional headers sent with every request
2230
- */
2231
- headers?: Record<string, string> | undefined;
2232
- /**
2233
- * Configure how events are batched before they are sent
2234
- *
2235
- * @deprecated Ignored: each event is sent as it's recorded, in the
2236
- * background. Use `advanced.backgroundTasks` to keep serverless
2237
- * functions alive until it's sent.
2238
- */
2239
- batch?: {
2240
- /**
2241
- * Send buffered events once this many are queued
2242
- *
2243
- * @default 25
2244
- */
2245
- maxSize?: number | undefined;
2246
- /**
2247
- * Send buffered events after this many milliseconds
2248
- *
2249
- * @default 2000
2250
- */
2251
- flushIntervalMs?: number | undefined;
2252
- } | undefined;
2253
- } | false | undefined;
2254
- /**
2255
- * Write events to the `auditLog` table
2256
- *
2257
- * @default true
2258
- */
2259
- database?: boolean | undefined;
2260
- /**
2261
- * Called for every recorded event, e.g. to publish it to a message broker
2262
- *
2263
- * Errors are logged and ignored
2264
- */
2265
- onEvent?: ((event: AuditEvent) => void | Promise<void>) | undefined;
2266
- /**
2267
- * Event types that should not be recorded
2268
- */
2269
- exclude?: AuditEventType[] | undefined;
2270
- /**
2271
- * Record `user_sign_in_failed` events for failed sign-in attempts, and
2272
- * `verification_failed` events for wrong one-time codes and tokens
2273
- *
2274
- * @default true
2275
- */
2276
- trackFailedSignIns?: boolean | undefined;
2277
- /**
2278
- * Roles allowed to read every audit event through
2279
- * `/audit-log/get-all-audit-logs`
2280
- *
2281
- * @default ["admin"]
2282
- */
2283
- adminRoles?: string[] | undefined;
2284
- /**
2285
- * Organization member roles allowed to read the events of their
2286
- * organization through `/audit-log/get-all-audit-logs`
2287
- *
2288
- * @default ["owner", "admin"]
2289
- */
2290
- organizationAdminRoles?: string[] | undefined;
2291
- /**
2292
- * Include failed sign-ins and security decisions made on a user's account
2293
- * before they were signed in in their own events. They are matched by the
2294
- * email that was typed, in lower case or as the user's email is stored, so
2295
- * anyone's attempt shows up; the IP address, user agent, visitor id and
2296
- * details are left out. Only the latest 50 events since the account was
2297
- * created are included.
2298
- *
2299
- * @default true
2300
- */
2301
- showAttemptsOnOwnAccount?: boolean | undefined;
2302
- /**
2303
- * Custom schema for the audit log plugin
2304
- */
2305
- schema?: InferOptionSchema<typeof schema> | undefined;
2306
- }
2307
- //#endregion
2308
2025
  //#region src/plugins/sentinel/schema.d.ts
2309
2026
  declare const schema$1: {
2310
2027
  sentinelCounter: {
@@ -2554,7 +2271,7 @@ interface SentinelOptions {
2554
2271
  resolveGeo?: ((ip: string) => GeoLocation | null | Promise<GeoLocation | null>) | undefined;
2555
2272
  } | undefined;
2556
2273
  /**
2557
- * Roles allowed to list and lift blocks through `/sentinel/blocks` and
2274
+ * Roles allowed to list and lift blocks through `/sentinel/list-blocks` and
2558
2275
  * `/sentinel/unblock`
2559
2276
  *
2560
2277
  * @default ["admin"]
@@ -2891,14 +2608,6 @@ interface SentinelOptions {
2891
2608
  schema?: InferOptionSchema<typeof schema$1> | undefined;
2892
2609
  }
2893
2610
  //#endregion
2894
- //#region src/plugins/sentinel/actions.d.ts
2895
- declare const SENTINEL_ERROR_CODES: {
2896
- readonly POW_CHALLENGE_REQUIRED: "Challenge required";
2897
- readonly SECURITY_BLOCKED: "Request blocked for security reasons";
2898
- readonly SECURITY_ADMIN_REQUIRED: "Only an administrator can manage security blocks";
2899
- readonly BLOCK_NOT_FOUND: "That block doesn't exist or has ended";
2900
- };
2901
- //#endregion
2902
2611
  //#region src/plugins/sentinel/email.d.ts
2903
2612
  /**
2904
2613
  * Normalizes an email address so aliases of the same mailbox match:
@@ -2940,10 +2649,18 @@ declare function parsePowHeader(value: string | null | undefined): {
2940
2649
  value: string;
2941
2650
  } | null;
2942
2651
  //#endregion
2652
+ //#region src/plugins/sentinel/error-codes.d.ts
2653
+ declare const SENTINEL_ERROR_CODES: {
2654
+ readonly POW_CHALLENGE_REQUIRED: "Challenge required";
2655
+ readonly SECURITY_BLOCKED: "Request blocked for security reasons";
2656
+ readonly SECURITY_ADMIN_REQUIRED: "Only an administrator can manage security blocks";
2657
+ readonly BLOCK_NOT_FOUND: "That block doesn't exist or has ended";
2658
+ };
2659
+ //#endregion
2943
2660
  //#region src/plugins/sentinel/index.d.ts
2944
2661
  declare const sentinel: (options?: SentinelOptions | undefined) => {
2945
2662
  id: "sentinel";
2946
- init(ctx: AuthContext<_gatwech_core55.PayvoAuthOptions>): {
2663
+ init(ctx: AuthContext<_gatwech_core57.PayvoAuthOptions>): {
2947
2664
  options: {
2948
2665
  databaseHooks: {
2949
2666
  user: {
@@ -2956,7 +2673,7 @@ declare const sentinel: (options?: SentinelOptions | undefined) => {
2956
2673
  emailVerified: boolean;
2957
2674
  name: string;
2958
2675
  image?: string | null | undefined;
2959
- } & Record<string, unknown>, context: GenericEndpointContext<_gatwech_core55.PayvoAuthOptions> | undefined): Promise<{
2676
+ } & Record<string, unknown>, context: GenericEndpointContext<_gatwech_core57.PayvoAuthOptions> | undefined): Promise<{
2960
2677
  data: {
2961
2678
  normalizedEmail: string;
2962
2679
  id: string;
@@ -2976,7 +2693,7 @@ declare const sentinel: (options?: SentinelOptions | undefined) => {
2976
2693
  emailVerified: boolean;
2977
2694
  name: string;
2978
2695
  image?: string | null | undefined;
2979
- } & Record<string, unknown>, context: GenericEndpointContext<_gatwech_core55.PayvoAuthOptions> | undefined): Promise<void>;
2696
+ } & Record<string, unknown>, context: GenericEndpointContext<_gatwech_core57.PayvoAuthOptions> | undefined): Promise<void>;
2980
2697
  };
2981
2698
  update: {
2982
2699
  before(data: Partial<{
@@ -3004,28 +2721,28 @@ declare const sentinel: (options?: SentinelOptions | undefined) => {
3004
2721
  };
3005
2722
  };
3006
2723
  } | undefined;
3007
- onRequest(request: Request, ctx: AuthContext<_gatwech_core55.PayvoAuthOptions>): Promise<{
2724
+ onRequest(request: Request, ctx: AuthContext<_gatwech_core57.PayvoAuthOptions>): Promise<{
3008
2725
  response: Response;
3009
2726
  } | undefined>;
3010
2727
  hooks: {
3011
2728
  before: ({
3012
- matcher(context: _gatwech_core55.HookEndpointContext): boolean;
3013
- handler: (inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<{
2729
+ matcher(context: _gatwech_core57.HookEndpointContext): boolean;
2730
+ handler: (inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<{
3014
2731
  context: {
3015
2732
  body: any;
3016
2733
  };
3017
2734
  } | undefined>;
3018
2735
  } | {
3019
- matcher(context: _gatwech_core55.HookEndpointContext): boolean;
3020
- handler: (inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<void>;
2736
+ matcher(context: _gatwech_core57.HookEndpointContext): boolean;
2737
+ handler: (inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<void>;
3021
2738
  })[];
3022
2739
  after: ({
3023
- matcher(context: _gatwech_core55.HookEndpointContext): boolean;
3024
- handler: (inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<void>;
2740
+ matcher(context: _gatwech_core57.HookEndpointContext): boolean;
2741
+ handler: (inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<void>;
3025
2742
  } | {
3026
- matcher(context: _gatwech_core55.HookEndpointContext): boolean;
3027
- handler: (inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<({
3028
- status: ("OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | better_call239.Status;
2743
+ matcher(context: _gatwech_core57.HookEndpointContext): boolean;
2744
+ handler: (inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<({
2745
+ status: ("OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | better_call278.Status;
3029
2746
  body: ({
3030
2747
  message?: string;
3031
2748
  code?: string;
@@ -3196,7 +2913,7 @@ declare const sentinel: (options?: SentinelOptions | undefined) => {
3196
2913
  } & {
3197
2914
  asResponse?: boolean;
3198
2915
  returnHeaders?: boolean;
3199
- use?: better_call239.Middleware[];
2916
+ use?: better_call278.Middleware[];
3200
2917
  path?: string;
3201
2918
  } & {
3202
2919
  asResponse?: AsResponse | undefined;
@@ -3235,7 +2952,7 @@ declare const sentinel: (options?: SentinelOptions | undefined) => {
3235
2952
  }>;
3236
2953
  options: {
3237
2954
  method: "GET";
3238
- use: ((inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<{
2955
+ use: ((inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<{
3239
2956
  session: {
3240
2957
  session: Record<string, any> & {
3241
2958
  id: string;
@@ -3267,12 +2984,72 @@ declare const sentinel: (options?: SentinelOptions | undefined) => {
3267
2984
  operationId: string;
3268
2985
  summary: string;
3269
2986
  description: string;
2987
+ responses: {
2988
+ 200: {
2989
+ description: string;
2990
+ content: {
2991
+ "application/json": {
2992
+ schema: {
2993
+ type: "object";
2994
+ properties: {
2995
+ blocks: {
2996
+ type: string;
2997
+ items: {
2998
+ type: string;
2999
+ properties: {
3000
+ id: {
3001
+ type: string;
3002
+ };
3003
+ key: {
3004
+ type: string;
3005
+ };
3006
+ feature: {
3007
+ type: string;
3008
+ };
3009
+ kind: {
3010
+ type: string;
3011
+ enum: string[];
3012
+ };
3013
+ identifier: {
3014
+ type: string;
3015
+ };
3016
+ account: {
3017
+ type: string;
3018
+ nullable: boolean;
3019
+ };
3020
+ blockedUntil: {
3021
+ type: string;
3022
+ format: string;
3023
+ };
3024
+ createdAt: {
3025
+ type: string;
3026
+ format: string;
3027
+ };
3028
+ };
3029
+ };
3030
+ };
3031
+ total: {
3032
+ type: string;
3033
+ };
3034
+ limit: {
3035
+ type: string;
3036
+ };
3037
+ offset: {
3038
+ type: string;
3039
+ };
3040
+ };
3041
+ required: string[];
3042
+ };
3043
+ };
3044
+ };
3045
+ };
3046
+ };
3270
3047
  };
3271
3048
  };
3272
3049
  } & {
3273
3050
  use: any[];
3274
3051
  };
3275
- path: "/sentinel/blocks";
3052
+ path: "/sentinel/list-blocks";
3276
3053
  };
3277
3054
  unblock: {
3278
3055
  <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
@@ -3292,7 +3069,7 @@ declare const sentinel: (options?: SentinelOptions | undefined) => {
3292
3069
  } & {
3293
3070
  asResponse?: boolean;
3294
3071
  returnHeaders?: boolean;
3295
- use?: better_call239.Middleware[];
3072
+ use?: better_call278.Middleware[];
3296
3073
  path?: string;
3297
3074
  } & {
3298
3075
  asResponse?: AsResponse | undefined;
@@ -3307,7 +3084,7 @@ declare const sentinel: (options?: SentinelOptions | undefined) => {
3307
3084
  }>;
3308
3085
  options: {
3309
3086
  method: "POST";
3310
- use: ((inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<{
3087
+ use: ((inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<{
3311
3088
  session: {
3312
3089
  session: Record<string, any> & {
3313
3090
  id: string;
@@ -3338,6 +3115,24 @@ declare const sentinel: (options?: SentinelOptions | undefined) => {
3338
3115
  operationId: string;
3339
3116
  summary: string;
3340
3117
  description: string;
3118
+ responses: {
3119
+ 200: {
3120
+ description: string;
3121
+ content: {
3122
+ "application/json": {
3123
+ schema: {
3124
+ type: "object";
3125
+ properties: {
3126
+ success: {
3127
+ type: string;
3128
+ };
3129
+ };
3130
+ required: string[];
3131
+ };
3132
+ };
3133
+ };
3134
+ };
3135
+ };
3341
3136
  };
3342
3137
  };
3343
3138
  } & {
@@ -3361,7 +3156,7 @@ declare const sentinel: (options?: SentinelOptions | undefined) => {
3361
3156
  } & {
3362
3157
  asResponse?: boolean;
3363
3158
  returnHeaders?: boolean;
3364
- use?: better_call239.Middleware[];
3159
+ use?: better_call278.Middleware[];
3365
3160
  path?: string;
3366
3161
  } & {
3367
3162
  asResponse?: AsResponse | undefined;
@@ -3511,14 +3306,419 @@ declare const sentinel: (options?: SentinelOptions | undefined) => {
3511
3306
  };
3512
3307
  };
3513
3308
  //#endregion
3514
- //#region src/plugins/audit-log/index.d.ts
3309
+ //#region src/plugins/audit-log/events.d.ts
3310
+ /**
3311
+ * Audit event types recorded by the audit log plugin
3312
+ */
3313
+ declare const AUDIT_EVENT_TYPES: {
3314
+ readonly USER_SIGNED_UP: "user_signed_up";
3315
+ readonly USER_PROFILE_UPDATED: "user_profile_updated";
3316
+ readonly USER_PROFILE_IMAGE_UPDATED: "user_profile_image_updated";
3317
+ readonly USER_EMAIL_VERIFIED: "user_email_verified";
3318
+ readonly USER_BANNED: "user_banned";
3319
+ readonly USER_UNBANNED: "user_unbanned";
3320
+ readonly USER_DELETED: "user_deleted";
3321
+ readonly USER_ROLE_UPDATED: "user_role_updated";
3322
+ readonly USER_EMAIL_CHANGED: "user_email_changed";
3323
+ readonly USER_PHONE_NUMBER_CHANGED: "user_phone_number_changed";
3324
+ readonly USER_SIGNED_IN: "user_signed_in";
3325
+ readonly USER_SIGNED_OUT: "user_signed_out";
3326
+ readonly SESSION_CREATED: "session_created";
3327
+ readonly SESSION_REVOKED: "session_revoked";
3328
+ readonly SESSIONS_REVOKED_ALL: "sessions_revoked_all";
3329
+ readonly USER_IMPERSONATED: "user_impersonated";
3330
+ readonly USER_IMPERSONATION_STOPPED: "user_impersonation_stopped";
3331
+ readonly DEVICE_AUTHORIZATION_APPROVED: "device_authorization_approved";
3332
+ readonly DEVICE_AUTHORIZATION_DENIED: "device_authorization_denied";
3333
+ readonly ACCOUNT_LINKED: "account_linked";
3334
+ readonly ACCOUNT_UNLINKED: "account_unlinked";
3335
+ readonly PASSWORD_CHANGED: "password_changed";
3336
+ readonly TWO_FACTOR_ENABLED: "two_factor_enabled";
3337
+ readonly TWO_FACTOR_DISABLED: "two_factor_disabled";
3338
+ readonly BACKUP_CODES_GENERATED: "two_factor_backup_codes_generated";
3339
+ readonly PASSKEY_ADDED: "passkey_added";
3340
+ readonly PASSKEY_REMOVED: "passkey_removed";
3341
+ readonly API_KEY_CREATED: "api_key_created";
3342
+ readonly API_KEY_UPDATED: "api_key_updated";
3343
+ readonly API_KEY_DELETED: "api_key_deleted";
3344
+ readonly PASSWORD_RESET_REQUESTED: "password_reset_requested";
3345
+ readonly PASSWORD_RESET_COMPLETED: "password_reset_completed";
3346
+ readonly EMAIL_VERIFICATION_SENT: "email_verification_sent";
3347
+ readonly ORGANIZATION_CREATED: "organization_created";
3348
+ readonly ORGANIZATION_UPDATED: "organization_updated";
3349
+ readonly ORGANIZATION_DELETED: "organization_deleted";
3350
+ readonly ORGANIZATION_ROLE_CREATED: "organization_role_created";
3351
+ readonly ORGANIZATION_ROLE_UPDATED: "organization_role_updated";
3352
+ readonly ORGANIZATION_ROLE_DELETED: "organization_role_deleted";
3353
+ readonly MEMBER_ADDED: "member_added";
3354
+ readonly MEMBER_REMOVED: "member_removed";
3355
+ readonly MEMBER_ROLE_UPDATED: "member_role_updated";
3356
+ readonly MEMBER_INVITED: "member_invited";
3357
+ readonly INVITE_ACCEPTED: "invite_accepted";
3358
+ readonly INVITE_REJECTED: "invite_rejected";
3359
+ readonly INVITE_CANCELLED: "invite_cancelled";
3360
+ readonly TEAM_CREATED: "team_created";
3361
+ readonly TEAM_UPDATED: "team_updated";
3362
+ readonly TEAM_DELETED: "team_deleted";
3363
+ readonly TEAM_MEMBER_ADDED: "team_member_added";
3364
+ readonly TEAM_MEMBER_REMOVED: "team_member_removed";
3365
+ readonly USER_SIGN_IN_FAILED: "user_sign_in_failed";
3366
+ readonly VERIFICATION_FAILED: "verification_failed";
3367
+ readonly AUDIT_READ: "audit_read";
3368
+ readonly AUDIT_EVENTS_DELETED: "audit_events_deleted";
3369
+ };
3370
+ /**
3371
+ * Security event types recorded by the sentinel plugin
3372
+ *
3373
+ * Declared here so both plugins share the same event types
3374
+ */
3375
+ declare const SECURITY_EVENT_TYPES: {
3376
+ readonly BLOCKED: "security_blocked";
3377
+ readonly ALLOWED_AFTER_CHALLENGE: "security_allowed";
3378
+ readonly CREDENTIAL_STUFFING: "security_credential_stuffing";
3379
+ readonly IMPOSSIBLE_TRAVEL: "security_impossible_travel";
3380
+ readonly GEO_BLOCKED: "security_geo_blocked";
3381
+ readonly BOT_BLOCKED: "security_bot_blocked";
3382
+ readonly SUSPICIOUS_IP: "security_suspicious_ip";
3383
+ readonly VELOCITY_EXCEEDED: "security_velocity_exceeded";
3384
+ readonly FREE_TRIAL_ABUSE: "security_free_trial_abuse";
3385
+ readonly COMPROMISED_PASSWORD: "security_compromised_password";
3386
+ readonly STALE_ACCOUNT: "security_stale_account";
3387
+ readonly INVALID_EMAIL: "security_invalid_email";
3388
+ readonly UNBLOCKED: "security_unblocked";
3389
+ };
3390
+ type AuditEventType = (typeof AUDIT_EVENT_TYPES)[keyof typeof AUDIT_EVENT_TYPES] | (typeof SECURITY_EVENT_TYPES)[keyof typeof SECURITY_EVENT_TYPES];
3391
+ declare const ALL_EVENT_TYPES: AuditEventType[];
3392
+ /**
3393
+ * The events that can't be excluded: who signed in or out and who failed to,
3394
+ * changes to credentials, roles, bans and sessions, impersonation, reads and
3395
+ * deletions of the audit log itself, and every security decision.
3396
+ */
3397
+ declare const CORE_EVENT_TYPES: ("user_signed_up" | "user_banned" | "user_unbanned" | "user_deleted" | "user_role_updated" | "user_email_changed" | "user_signed_in" | "user_signed_out" | "session_revoked" | "sessions_revoked_all" | "user_impersonated" | "user_impersonation_stopped" | "password_changed" | "two_factor_enabled" | "two_factor_disabled" | "password_reset_completed" | "user_sign_in_failed" | "verification_failed" | "audit_read" | "audit_events_deleted" | "security_blocked" | "security_allowed" | "security_credential_stuffing" | "security_impossible_travel" | "security_geo_blocked" | "security_bot_blocked" | "security_suspicious_ip" | "security_velocity_exceeded" | "security_free_trial_abuse" | "security_compromised_password" | "security_stale_account" | "security_invalid_email" | "security_unblocked")[];
3398
+ /** Endpoints that complete a sign-in by creating a session */
3399
+ declare const SIGN_IN_PATHS: string[];
3400
+ /** Sign-in endpoints that check credentials, so a failure is a failed attempt */
3401
+ declare const CREDENTIAL_SIGN_IN_PATHS: string[];
3402
+ /**
3403
+ * Endpoints that check a one-time code or token outside a sign-in, so a
3404
+ * failure is a failed attempt
3405
+ */
3406
+ declare const VERIFICATION_PATHS: string[];
3407
+ /** Endpoints whose successful response maps to a single event */
3408
+ declare const PATH_EVENTS: Record<string, AuditEventType>;
3409
+ /**
3410
+ * The severity of each event type that isn't `info`. A failed, blocked or
3411
+ * challenged event is at least `warning`.
3412
+ */
3413
+ declare const EVENT_SEVERITIES: Partial<Record<AuditEventType, "warning" | "critical">>;
3414
+ //#endregion
3415
+ //#region src/plugins/audit-log/schema.d.ts
3416
+ declare const schema: {
3417
+ auditLog: {
3418
+ fields: {
3419
+ eventType: {
3420
+ type: "string";
3421
+ required: true;
3422
+ };
3423
+ userId: {
3424
+ type: "string";
3425
+ required: false;
3426
+ };
3427
+ identifier: {
3428
+ type: "string";
3429
+ required: false;
3430
+ };
3431
+ organizationId: {
3432
+ type: "string";
3433
+ required: false;
3434
+ };
3435
+ status: {
3436
+ type: "string";
3437
+ required: true;
3438
+ };
3439
+ path: {
3440
+ type: "string";
3441
+ required: false;
3442
+ };
3443
+ ipAddress: {
3444
+ type: "string";
3445
+ required: false;
3446
+ };
3447
+ userAgent: {
3448
+ type: "string";
3449
+ required: false;
3450
+ };
3451
+ visitorId: {
3452
+ type: "string";
3453
+ required: false;
3454
+ };
3455
+ eventData: {
3456
+ type: "json";
3457
+ required: false;
3458
+ };
3459
+ /** The request chain the event belongs to, shared with other services */
3460
+ traceId: {
3461
+ type: "string";
3462
+ required: false;
3463
+ };
3464
+ /** The single request within the chain */
3465
+ requestId: {
3466
+ type: "string";
3467
+ required: false;
3468
+ };
3469
+ /** `user`, `admin` or `system` */
3470
+ actorType: {
3471
+ type: "string";
3472
+ required: false;
3473
+ };
3474
+ /** `info`, `warning` or `critical` */
3475
+ severity: {
3476
+ type: "string";
3477
+ required: false;
3478
+ };
3479
+ /** `v1:<HMAC-SHA256>` of the event's fields, when signing is configured */
3480
+ signature: {
3481
+ type: "string";
3482
+ required: false;
3483
+ };
3484
+ createdAt: {
3485
+ type: "date";
3486
+ required: true;
3487
+ };
3488
+ };
3489
+ };
3490
+ };
3491
+ //#endregion
3492
+ //#region src/plugins/audit-log/types.d.ts
3493
+ interface AuditEvent {
3494
+ id: string;
3495
+ eventType: AuditEventType;
3496
+ status: "success" | "failure" | "blocked" | "challenged";
3497
+ /**
3498
+ * The user who performed the action
3499
+ *
3500
+ * Null when the actor is unknown, e.g. a failed sign-in
3501
+ */
3502
+ userId: string | null;
3503
+ /**
3504
+ * The actor's identity, such as an email, username or phone number
3505
+ */
3506
+ identifier: string | null;
3507
+ organizationId: string | null;
3508
+ /**
3509
+ * The endpoint that triggered the event
3510
+ */
3511
+ path: string | null;
3512
+ ipAddress: string | null;
3513
+ userAgent: string | null;
3514
+ visitorId: string | null;
3515
+ /**
3516
+ * Additional details about the event
3517
+ *
3518
+ * Never contains passwords, tokens or OTPs
3519
+ */
3520
+ eventData: Record<string, unknown> | null;
3521
+ /**
3522
+ * The request chain the event belongs to, from the `Trace-Id` or
3523
+ * `traceparent` header, or minted for the request. Other services
3524
+ * record the same id, so their events can be joined with these.
3525
+ *
3526
+ * Null for events recorded outside a request.
3527
+ */
3528
+ traceId: string | null;
3529
+ /**
3530
+ * The single request within the chain, from the `Request-Id` header, or
3531
+ * minted for the request
3532
+ */
3533
+ requestId: string | null;
3534
+ /**
3535
+ * Who acted: `user` for the signed-in or signing-in user, `admin` for an
3536
+ * admin acting on someone else or impersonating them, `system` without a
3537
+ * request
3538
+ */
3539
+ actorType: "user" | "admin" | "system";
3540
+ /**
3541
+ * How much the event matters, from the event type and its status
3542
+ */
3543
+ severity: "info" | "warning" | "critical";
3544
+ /**
3545
+ * `v1:<HMAC-SHA256>` over the event's other fields, which shows whether
3546
+ * the row was changed after it was recorded (see `verifyAuditEvent`)
3547
+ *
3548
+ * Null when no signing secret was configured.
3549
+ */
3550
+ signature: string | null;
3551
+ createdAt: Date;
3552
+ }
3553
+ interface AuditLogOptions {
3554
+ /**
3555
+ * Send events to the hosted backend, in addition to the `auditLog` table
3556
+ *
3557
+ * Enabled when an API key and URL are configured, either here or through
3558
+ * `PAYVO_INFRA_API_KEY` and `PAYVO_INFRA_API_URL`. Set to `false` to
3559
+ * disable it.
3560
+ */
3561
+ remote?: {
3562
+ /**
3563
+ * The hosted backend API URL
3564
+ *
3565
+ * @default process.env.PAYVO_INFRA_API_URL
3566
+ */
3567
+ apiUrl?: string | undefined;
3568
+ /**
3569
+ * The hosted backend API key
3570
+ *
3571
+ * @default process.env.PAYVO_INFRA_API_KEY
3572
+ */
3573
+ apiKey?: string | undefined;
3574
+ /**
3575
+ * Request timeout in milliseconds
3576
+ *
3577
+ * @default 3000
3578
+ */
3579
+ timeout?: number | undefined;
3580
+ /**
3581
+ * Additional headers sent with every request
3582
+ */
3583
+ headers?: Record<string, string> | undefined;
3584
+ /**
3585
+ * Configure how events are batched before they are sent
3586
+ *
3587
+ * @deprecated Ignored: each event is sent as it's recorded, in the
3588
+ * background. Use `advanced.backgroundTasks` to keep serverless
3589
+ * functions alive until it's sent.
3590
+ */
3591
+ batch?: {
3592
+ /**
3593
+ * Send buffered events once this many are queued
3594
+ *
3595
+ * @default 25
3596
+ */
3597
+ maxSize?: number | undefined;
3598
+ /**
3599
+ * Send buffered events after this many milliseconds
3600
+ *
3601
+ * @default 2000
3602
+ */
3603
+ flushIntervalMs?: number | undefined;
3604
+ } | undefined;
3605
+ } | false | undefined;
3606
+ /**
3607
+ * Called for every recorded event, e.g. to publish it to a message broker
3608
+ *
3609
+ * Errors are logged and ignored
3610
+ */
3611
+ onEvent?: ((event: AuditEvent) => void | Promise<void>) | undefined;
3612
+ /**
3613
+ * How long events are kept at least. Deleting events with
3614
+ * `deleteOldEvents` refuses a period shorter than `minimumDays`, and
3615
+ * every deletion is recorded as an `audit_events_deleted` event.
3616
+ *
3617
+ * `minimumDays` is a whole number of at least 1. The right value is a
3618
+ * compliance decision, so set it to what your regulator requires.
3619
+ *
3620
+ * @default { minimumDays: 365 }
3621
+ */
3622
+ retention?: {
3623
+ minimumDays?: number | undefined;
3624
+ } | undefined;
3625
+ /**
3626
+ * Signs every event with HMAC-SHA256, so a row that is changed after it
3627
+ * is recorded no longer verifies
3628
+ *
3629
+ * `secret` signs and verifies; `secrets` maps an older key version to its
3630
+ * secret, so keys can be rotated without signing old rows again. Without
3631
+ * a secret events aren't signed, and the plugin refuses to start when
3632
+ * `NODE_ENV` is `production`.
3633
+ *
3634
+ * @default { secret: process.env.PAYVO_AUDIT_SIGNING_SECRET }
3635
+ */
3636
+ integrity?: {
3637
+ secret?: string | undefined;
3638
+ secrets?: Record<string, string> | undefined;
3639
+ } | undefined;
3640
+ /**
3641
+ * Keys whose values are replaced with `"[REDACTED]"` in an event's
3642
+ * `eventData`, at any depth, before it is stored or sent anywhere
3643
+ *
3644
+ * Passwords, tokens, one-time codes, secrets, authorization and cookie
3645
+ * headers and card data are always redacted. Keys are compared in lower
3646
+ * case, without `-` or `_`.
3647
+ *
3648
+ * @default []
3649
+ */
3650
+ sensitiveKeys?: string[] | undefined;
3651
+ /**
3652
+ * Event types that should not be recorded
3653
+ *
3654
+ * The events in `CORE_EVENT_TYPES` can't be excluded, and `auditLog`
3655
+ * refuses to start when one is listed here. Events are always written to
3656
+ * the `auditLog` table, whatever else `remote` and `onEvent` do with them.
3657
+ */
3658
+ exclude?: AuditEventType[] | undefined;
3659
+ /**
3660
+ * Roles allowed to read every audit event through
3661
+ * `/audit-log/get-all-audit-logs`
3662
+ *
3663
+ * @default ["admin"]
3664
+ */
3665
+ adminRoles?: string[] | undefined;
3666
+ /**
3667
+ * Organization member roles allowed to read the events of their
3668
+ * organization through `/audit-log/get-all-audit-logs`
3669
+ *
3670
+ * @default ["owner", "admin"]
3671
+ */
3672
+ organizationAdminRoles?: string[] | undefined;
3673
+ /**
3674
+ * Include failed sign-ins and security decisions made on a user's account
3675
+ * before they were signed in in their own events. They are matched by the
3676
+ * email that was typed, in lower case or as the user's email is stored, so
3677
+ * anyone's attempt shows up; the IP address, user agent, visitor id and
3678
+ * details are left out. Only the latest 50 events since the account was
3679
+ * created are included.
3680
+ *
3681
+ * @default true
3682
+ */
3683
+ showAttemptsOnOwnAccount?: boolean | undefined;
3684
+ /**
3685
+ * Custom schema for the audit log plugin
3686
+ */
3687
+ schema?: InferOptionSchema<typeof schema> | undefined;
3688
+ }
3689
+ //#endregion
3690
+ //#region src/plugins/audit-log/error-codes.d.ts
3515
3691
  declare const AUDIT_LOG_ERROR_CODES: {
3516
3692
  readonly AUDIT_LOG_ACCESS_DENIED: "You don't have access to these audit logs";
3693
+ readonly AUDIT_CANNOT_BE_DISABLED: "Core audit events and the local audit store can't be turned off";
3517
3694
  readonly AUDIT_LOG_UNAVAILABLE: "Audit logs are temporarily unavailable";
3695
+ readonly AUDIT_RETENTION_TOO_SHORT: "Audit events can't be deleted before the retention minimum has passed";
3696
+ readonly AUDIT_SIGNING_SECRET_MISSING: "Audit events must be signed in production: set integrity.secret or PAYVO_AUDIT_SIGNING_SECRET";
3518
3697
  };
3698
+ //#endregion
3699
+ //#region src/plugins/audit-log/integrity.d.ts
3700
+ /**
3701
+ * Whether an event's signature matches its fields, so a row that was changed
3702
+ * after it was recorded doesn't verify.
3703
+ *
3704
+ * `integrity.secret` verifies signatures made with the current key, and
3705
+ * `integrity.secrets` maps an older version to its key, so keys can be
3706
+ * rotated without signing old rows again. An event without a signature, or
3707
+ * with a version that has no key, doesn't verify.
3708
+ *
3709
+ * @example
3710
+ * ```ts
3711
+ * const events = await auth.api.getAllAuditLogs({ headers });
3712
+ * events.events.every((event) => event.verified);
3713
+ * await verifyAuditEvent(event, { secret: process.env.PAYVO_AUDIT_SIGNING_SECRET });
3714
+ * ```
3715
+ */
3716
+ declare function verifyAuditEvent(event: AuditEvent, integrity: NonNullable<AuditLogOptions["integrity"]>): Promise<boolean>;
3717
+ //#endregion
3718
+ //#region src/plugins/audit-log/index.d.ts
3519
3719
  declare const auditLog: (options?: AuditLogOptions | undefined) => {
3520
3720
  id: "audit-log";
3521
- init(ctx: AuthContext<_gatwech_core55.PayvoAuthOptions>): {
3721
+ init(ctx: AuthContext<_gatwech_core57.PayvoAuthOptions>): {
3522
3722
  options: {
3523
3723
  databaseHooks: {
3524
3724
  user: {
@@ -3531,7 +3731,7 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3531
3731
  emailVerified: boolean;
3532
3732
  name: string;
3533
3733
  image?: string | null | undefined;
3534
- } & Record<string, unknown>, context: _gatwech_core55.GenericEndpointContext<_gatwech_core55.PayvoAuthOptions> | undefined): Promise<void>;
3734
+ } & Record<string, unknown>, context: _gatwech_core57.GenericEndpointContext<_gatwech_core57.PayvoAuthOptions> | undefined): Promise<void>;
3535
3735
  };
3536
3736
  update: {
3537
3737
  after(user: {
@@ -3542,7 +3742,7 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3542
3742
  emailVerified: boolean;
3543
3743
  name: string;
3544
3744
  image?: string | null | undefined;
3545
- } & Record<string, unknown>, context: _gatwech_core55.GenericEndpointContext<_gatwech_core55.PayvoAuthOptions> | undefined, data: (Partial<{
3745
+ } & Record<string, unknown>, context: _gatwech_core57.GenericEndpointContext<_gatwech_core57.PayvoAuthOptions> | undefined, data: (Partial<{
3546
3746
  id: string;
3547
3747
  createdAt: Date;
3548
3748
  updatedAt: Date;
@@ -3561,7 +3761,7 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3561
3761
  emailVerified: boolean;
3562
3762
  name: string;
3563
3763
  image?: string | null | undefined;
3564
- } & Record<string, unknown>, context: _gatwech_core55.GenericEndpointContext<_gatwech_core55.PayvoAuthOptions> | undefined): Promise<void>;
3764
+ } & Record<string, unknown>, context: _gatwech_core57.GenericEndpointContext<_gatwech_core57.PayvoAuthOptions> | undefined): Promise<void>;
3565
3765
  };
3566
3766
  };
3567
3767
  session: {
@@ -3575,7 +3775,7 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3575
3775
  token: string;
3576
3776
  ipAddress?: string | null | undefined;
3577
3777
  userAgent?: string | null | undefined;
3578
- } & Record<string, unknown>, context: _gatwech_core55.GenericEndpointContext<_gatwech_core55.PayvoAuthOptions> | undefined): Promise<void>;
3778
+ } & Record<string, unknown>, context: _gatwech_core57.GenericEndpointContext<_gatwech_core57.PayvoAuthOptions> | undefined): Promise<void>;
3579
3779
  };
3580
3780
  };
3581
3781
  account: {
@@ -3594,7 +3794,7 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3594
3794
  refreshTokenExpiresAt?: Date | null | undefined;
3595
3795
  scope?: string | null | undefined;
3596
3796
  password?: string | null | undefined;
3597
- }, context: _gatwech_core55.GenericEndpointContext<_gatwech_core55.PayvoAuthOptions> | undefined): Promise<void>;
3797
+ }, context: _gatwech_core57.GenericEndpointContext<_gatwech_core57.PayvoAuthOptions> | undefined): Promise<void>;
3598
3798
  };
3599
3799
  };
3600
3800
  };
@@ -3602,12 +3802,12 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3602
3802
  };
3603
3803
  hooks: {
3604
3804
  before: {
3605
- matcher(context: _gatwech_core55.HookEndpointContext): boolean;
3606
- handler: (inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<void>;
3805
+ matcher(context: _gatwech_core57.HookEndpointContext): boolean;
3806
+ handler: (inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<void>;
3607
3807
  }[];
3608
3808
  after: {
3609
- matcher(context: _gatwech_core55.HookEndpointContext): boolean;
3610
- handler: (inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<void>;
3809
+ matcher(context: _gatwech_core57.HookEndpointContext): boolean;
3810
+ handler: (inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<void>;
3611
3811
  }[];
3612
3812
  };
3613
3813
  endpoints: {
@@ -3622,6 +3822,7 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3622
3822
  offset?: string | number | undefined;
3623
3823
  eventType?: string | undefined;
3624
3824
  identifier?: string | undefined;
3825
+ traceId?: string | undefined;
3625
3826
  organizationId?: string | undefined;
3626
3827
  userId?: string | undefined;
3627
3828
  startDate?: string | undefined;
@@ -3636,7 +3837,7 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3636
3837
  } & {
3637
3838
  asResponse?: boolean;
3638
3839
  returnHeaders?: boolean;
3639
- use?: better_call239.Middleware[];
3840
+ use?: better_call278.Middleware[];
3640
3841
  path?: string;
3641
3842
  } & {
3642
3843
  asResponse?: AsResponse | undefined;
@@ -3657,7 +3858,7 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3657
3858
  }>;
3658
3859
  options: {
3659
3860
  method: "GET";
3660
- use: ((inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<{
3861
+ use: ((inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<{
3661
3862
  session: {
3662
3863
  session: Record<string, any> & {
3663
3864
  id: string;
@@ -3685,6 +3886,7 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3685
3886
  offset: zod381.ZodOptional<zod381.ZodUnion<[zod381.ZodString, zod381.ZodNumber]>>;
3686
3887
  eventType: zod381.ZodOptional<zod381.ZodString>;
3687
3888
  identifier: zod381.ZodOptional<zod381.ZodString>;
3889
+ traceId: zod381.ZodOptional<zod381.ZodString>;
3688
3890
  organizationId: zod381.ZodOptional<zod381.ZodString>;
3689
3891
  userId: zod381.ZodOptional<zod381.ZodString>;
3690
3892
  startDate: zod381.ZodOptional<zod381.ZodString>;
@@ -3749,6 +3951,30 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3749
3951
  type: string;
3750
3952
  nullable: boolean;
3751
3953
  };
3954
+ traceId: {
3955
+ type: string;
3956
+ nullable: boolean;
3957
+ };
3958
+ requestId: {
3959
+ type: string;
3960
+ nullable: boolean;
3961
+ };
3962
+ actorType: {
3963
+ type: string;
3964
+ enum: string[];
3965
+ };
3966
+ severity: {
3967
+ type: string;
3968
+ enum: string[];
3969
+ };
3970
+ signature: {
3971
+ type: string;
3972
+ nullable: boolean;
3973
+ };
3974
+ verified: {
3975
+ type: string;
3976
+ description: string;
3977
+ };
3752
3978
  createdAt: {
3753
3979
  type: string;
3754
3980
  format: string;
@@ -3790,6 +4016,7 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3790
4016
  offset?: string | number | undefined;
3791
4017
  eventType?: string | undefined;
3792
4018
  identifier?: string | undefined;
4019
+ traceId?: string | undefined;
3793
4020
  organizationId?: string | undefined;
3794
4021
  userId?: string | undefined;
3795
4022
  startDate?: string | undefined;
@@ -3804,7 +4031,7 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3804
4031
  } & {
3805
4032
  asResponse?: boolean;
3806
4033
  returnHeaders?: boolean;
3807
- use?: better_call239.Middleware[];
4034
+ use?: better_call278.Middleware[];
3808
4035
  path?: string;
3809
4036
  } & {
3810
4037
  asResponse?: AsResponse | undefined;
@@ -3812,20 +4039,24 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3812
4039
  }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
3813
4040
  headers: Headers;
3814
4041
  response: {
3815
- events: AuditEvent[];
4042
+ events: (AuditEvent & {
4043
+ verified?: boolean | undefined;
4044
+ })[];
3816
4045
  total: number;
3817
4046
  limit: number;
3818
4047
  offset: number;
3819
4048
  };
3820
4049
  } : {
3821
- events: AuditEvent[];
4050
+ events: (AuditEvent & {
4051
+ verified?: boolean | undefined;
4052
+ })[];
3822
4053
  total: number;
3823
4054
  limit: number;
3824
4055
  offset: number;
3825
4056
  }>;
3826
4057
  options: {
3827
4058
  method: "GET";
3828
- use: ((inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<{
4059
+ use: ((inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<{
3829
4060
  session: {
3830
4061
  session: Record<string, any> & {
3831
4062
  id: string;
@@ -3853,6 +4084,7 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3853
4084
  offset: zod381.ZodOptional<zod381.ZodUnion<[zod381.ZodString, zod381.ZodNumber]>>;
3854
4085
  eventType: zod381.ZodOptional<zod381.ZodString>;
3855
4086
  identifier: zod381.ZodOptional<zod381.ZodString>;
4087
+ traceId: zod381.ZodOptional<zod381.ZodString>;
3856
4088
  organizationId: zod381.ZodOptional<zod381.ZodString>;
3857
4089
  userId: zod381.ZodOptional<zod381.ZodString>;
3858
4090
  startDate: zod381.ZodOptional<zod381.ZodString>;
@@ -3917,6 +4149,30 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3917
4149
  type: string;
3918
4150
  nullable: boolean;
3919
4151
  };
4152
+ traceId: {
4153
+ type: string;
4154
+ nullable: boolean;
4155
+ };
4156
+ requestId: {
4157
+ type: string;
4158
+ nullable: boolean;
4159
+ };
4160
+ actorType: {
4161
+ type: string;
4162
+ enum: string[];
4163
+ };
4164
+ severity: {
4165
+ type: string;
4166
+ enum: string[];
4167
+ };
4168
+ signature: {
4169
+ type: string;
4170
+ nullable: boolean;
4171
+ };
4172
+ verified: {
4173
+ type: string;
4174
+ description: string;
4175
+ };
3920
4176
  createdAt: {
3921
4177
  type: string;
3922
4178
  format: string;
@@ -3963,7 +4219,7 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3963
4219
  } & {
3964
4220
  asResponse?: boolean;
3965
4221
  returnHeaders?: boolean;
3966
- use?: better_call239.Middleware[];
4222
+ use?: better_call278.Middleware[];
3967
4223
  path?: string;
3968
4224
  } & {
3969
4225
  asResponse?: AsResponse | undefined;
@@ -3978,7 +4234,7 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
3978
4234
  }>;
3979
4235
  options: {
3980
4236
  method: "GET";
3981
- use: ((inputContext: better_call239.MiddlewareInputContext<better_call239.MiddlewareOptions>) => Promise<{
4237
+ use: ((inputContext: better_call278.MiddlewareInputContext<better_call278.MiddlewareOptions>) => Promise<{
3982
4238
  session: {
3983
4239
  session: Record<string, any> & {
3984
4240
  id: string;
@@ -4052,7 +4308,7 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
4052
4308
  } & {
4053
4309
  asResponse?: boolean;
4054
4310
  returnHeaders?: boolean;
4055
- use?: better_call239.Middleware[];
4311
+ use?: better_call278.Middleware[];
4056
4312
  path?: string;
4057
4313
  } & {
4058
4314
  asResponse?: AsResponse | undefined;
@@ -4073,6 +4329,29 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
4073
4329
  metadata: {
4074
4330
  SERVER_ONLY: true;
4075
4331
  client: boolean;
4332
+ openapi: {
4333
+ operationId: string;
4334
+ summary: string;
4335
+ description: string;
4336
+ responses: {
4337
+ 200: {
4338
+ description: string;
4339
+ content: {
4340
+ "application/json": {
4341
+ schema: {
4342
+ type: "object";
4343
+ properties: {
4344
+ deleted: {
4345
+ type: string;
4346
+ };
4347
+ };
4348
+ required: string[];
4349
+ };
4350
+ };
4351
+ };
4352
+ };
4353
+ };
4354
+ };
4076
4355
  };
4077
4356
  } & {
4078
4357
  use: any[];
@@ -4123,6 +4402,26 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
4123
4402
  type: "json";
4124
4403
  required: false;
4125
4404
  };
4405
+ traceId: {
4406
+ type: "string";
4407
+ required: false;
4408
+ };
4409
+ requestId: {
4410
+ type: "string";
4411
+ required: false;
4412
+ };
4413
+ actorType: {
4414
+ type: "string";
4415
+ required: false;
4416
+ };
4417
+ severity: {
4418
+ type: "string";
4419
+ required: false;
4420
+ };
4421
+ signature: {
4422
+ type: "string";
4423
+ required: false;
4424
+ };
4126
4425
  createdAt: {
4127
4426
  type: "date";
4128
4427
  required: true;
@@ -4132,11 +4431,12 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
4132
4431
  };
4133
4432
  $ERROR_CODES: {
4134
4433
  readonly AUDIT_LOG_ACCESS_DENIED: "You don't have access to these audit logs";
4434
+ readonly AUDIT_CANNOT_BE_DISABLED: "Core audit events and the local audit store can't be turned off";
4135
4435
  readonly AUDIT_LOG_UNAVAILABLE: "Audit logs are temporarily unavailable";
4436
+ readonly AUDIT_RETENTION_TOO_SHORT: "Audit events can't be deleted before the retention minimum has passed";
4437
+ readonly AUDIT_SIGNING_SECRET_MISSING: "Audit events must be signed in production: set integrity.secret or PAYVO_AUDIT_SIGNING_SECRET";
4136
4438
  };
4137
4439
  options: {
4138
- database: boolean;
4139
- trackFailedSignIns: boolean;
4140
4440
  adminRoles: string[];
4141
4441
  organizationAdminRoles: string[];
4142
4442
  showAttemptsOnOwnAccount: boolean;
@@ -4151,9 +4451,17 @@ declare const auditLog: (options?: AuditLogOptions | undefined) => {
4151
4451
  } | undefined;
4152
4452
  } | false | undefined;
4153
4453
  onEvent?: ((event: AuditEvent) => void | Promise<void>) | undefined;
4454
+ retention?: {
4455
+ minimumDays?: number | undefined;
4456
+ } | undefined;
4457
+ integrity?: {
4458
+ secret?: string | undefined;
4459
+ secrets?: Record<string, string> | undefined;
4460
+ } | undefined;
4461
+ sensitiveKeys?: string[] | undefined;
4154
4462
  exclude?: AuditEventType[] | undefined;
4155
4463
  schema?: InferOptionSchema<typeof schema> | undefined;
4156
4464
  };
4157
4465
  };
4158
4466
  //#endregion
4159
- export { SECURITY_EVENT_TYPES as A, AuditEvent as C, AuditEventType as D, AUDIT_EVENT_TYPES as E, API_KEY_TABLE_NAME as F, ERROR_CODES as I, apiKey as L, VERIFICATION_PATHS as M, LastLoginMethodOptions as N, CREDENTIAL_SIGN_IN_PATHS as O, lastLoginMethod as P, defaultKeyHasher as R, SentinelOptions as S, ALL_EVENT_TYPES as T, haversineDistanceKm as _, createAuthEndpoint$1 as a, GeoLocation as b, sentinel as c, POW_SOLUTION_HEADER as d, createNonce as f, verifySolution as g, solveChallenge as h, AuthMiddleware as i, SIGN_IN_PATHS as j, PATH_EVENTS as k, POW_CHALLENGE_HEADER as l, parsePowHeader as m, auditLog as n, createAuthMiddleware$1 as o, hasLeadingZeroBits as p, AuthEndpoint as r, optionsMiddleware as s, AUDIT_LOG_ERROR_CODES as t, POW_REASON_HEADER as u, normalizeEmail as v, AuditLogOptions as w, SecurityAction as x, SENTINEL_ERROR_CODES as y };
4467
+ export { verifySolution as A, apiKey as B, POW_CHALLENGE_HEADER as C, hasLeadingZeroBits as D, createNonce as E, SentinelOptions as F, LastLoginMethodOptions as I, lastLoginMethod as L, normalizeEmail as M, GeoLocation as N, parsePowHeader as O, SecurityAction as P, API_KEY_TABLE_NAME as R, SENTINEL_ERROR_CODES as S, POW_SOLUTION_HEADER as T, defaultKeyHasher as V, AuthMiddleware as _, AuditLogOptions as a, optionsMiddleware as b, AuditEventType as c, EVENT_SEVERITIES as d, PATH_EVENTS as f, AuthEndpoint as g, VERIFICATION_PATHS as h, AuditEvent as i, haversineDistanceKm as j, solveChallenge as k, CORE_EVENT_TYPES as l, SIGN_IN_PATHS as m, verifyAuditEvent as n, ALL_EVENT_TYPES as o, SECURITY_EVENT_TYPES as p, AUDIT_LOG_ERROR_CODES as r, AUDIT_EVENT_TYPES as s, auditLog as t, CREDENTIAL_SIGN_IN_PATHS as u, createAuthEndpoint$1 as v, POW_REASON_HEADER as w, sentinel as x, createAuthMiddleware$1 as y, ERROR_CODES as z };