@gatwech/auth 1.0.0-beta.20 → 1.0.0-beta.22

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 (148) hide show
  1. package/dist/adapters/drizzle-adapter/index.mjs +11 -2
  2. package/dist/adapters/index.d.mts +2 -2
  3. package/dist/adapters/kysely-adapter/index.mjs +1 -1
  4. package/dist/adapters/memory-adapter/index.d.mts +1 -1
  5. package/dist/adapters/memory-adapter/index.mjs +2 -2
  6. package/dist/adapters/prisma-adapter/index.mjs +1 -1
  7. package/dist/{admin-BzUJL6tr.mjs → admin-rd-xHhnP.mjs} +1 -1
  8. package/dist/{anonymous-BjlTk4gl.mjs → anonymous-qSasVeIe.mjs} +1 -1
  9. package/dist/api/index.d.mts +2 -2
  10. package/dist/api/index.mjs +2 -2
  11. package/dist/{api-Dk8Yj_J5.mjs → api-BV65Y-Rk.mjs} +5 -0
  12. package/dist/{audit-log-DKsUWR8O.mjs → audit-log-DgqHJ-uv.mjs} +132 -63
  13. package/dist/{auth-vfCyIIeV.mjs → auth-DtOjarwu.mjs} +15 -2
  14. package/dist/client/index.d.mts +2 -2
  15. package/dist/client/plugins/index.d.mts +28 -28
  16. package/dist/client/plugins/index.mjs +2 -2
  17. package/dist/client/react/index.d.mts +2 -2
  18. package/dist/{client-4QEb0rUr.mjs → client-CMsC6-rl.mjs} +1 -1
  19. package/dist/{client-C_qmyez2.d.mts → client-DO9MgP_0.d.mts} +1 -1
  20. package/dist/{client-F67q-Lbi.d.mts → client-ukvqpcbI.d.mts} +1 -1
  21. package/dist/cookies/index.d.mts +3 -3
  22. package/dist/db/index.d.mts +2 -2
  23. package/dist/db/index.mjs +1 -1
  24. package/dist/{db-7vHnL1XA.mjs → db-CV59HpEF.mjs} +2 -2
  25. package/dist/{email-otp-Dw0DypjQ.mjs → email-otp-BmgAht1S.mjs} +1 -1
  26. package/dist/{generic-oauth-DFj27JY8.mjs → generic-oauth-C5_AXj2z.mjs} +1 -1
  27. package/dist/{haveibeenpwned-CzNda7Tn.mjs → haveibeenpwned-_3a5amT-.mjs} +1 -1
  28. package/dist/{index-D57DuhZR.d.mts → index-AiKdOFSd.d.mts} +116 -64
  29. package/dist/{index-Bml-PCqP.d.mts → index-B4hJVVRn.d.mts} +19 -19
  30. package/dist/{index-DwPAddfE.d.mts → index-BC0aAKsT.d.mts} +3 -3
  31. package/dist/{index-Df0KhQRf-BEa5tdwJ.d.mts → index-BL_t8cRp-C4QYBsac.d.mts} +56 -17
  32. package/dist/{index-DyXi7S2M.d.mts → index-BfLofiXO.d.mts} +10 -10
  33. package/dist/{index-CP8x1TFq.d.mts → index-BzzhaGLe.d.mts} +6 -6
  34. package/dist/{index-DFSRYWFI.d.mts → index-CBGNX7W1.d.mts} +6 -6
  35. package/dist/{index-CofuaNMl.d.mts → index-CRNh-5Tc.d.mts} +7 -7
  36. package/dist/{index-CNd5jqLl.d.mts → index-CRiKKdkb.d.mts} +6 -6
  37. package/dist/{index-CsxtcAO0.d.mts → index-CTSeVJJB.d.mts} +1 -1
  38. package/dist/{index-sb-UFLuo.d.mts → index-CxhQu1HM.d.mts} +2 -2
  39. package/dist/{index-Dnd8S4S4.d.mts → index-D-rjuF7p.d.mts} +9 -9
  40. package/dist/{index-XfE0WjTN.d.mts → index-D3uQsW8T.d.mts} +34 -34
  41. package/dist/{index-4I1YhYhk.d.mts → index-DKirx_GW.d.mts} +4 -4
  42. package/dist/{index-KhbNmMmG.d.mts → index-DSoiUc1C.d.mts} +167 -167
  43. package/dist/{index-DTkcY7xH.d.mts → index-Dkm27DLN.d.mts} +10 -10
  44. package/dist/{index-BsSKcKgO.d.mts → index-Dl0bD1_6.d.mts} +6 -6
  45. package/dist/{index-DGeoJ4gu.d.mts → index-DlS-HqZR.d.mts} +2 -2
  46. package/dist/{index-BNhJglHC.d.mts → index-DngQlUSI.d.mts} +114 -114
  47. package/dist/{index-CC920PPp.d.mts → index-Do8AV4PF.d.mts} +14 -14
  48. package/dist/{index-CBiGsvDd.d.mts → index-SYRh5FW7.d.mts} +8 -8
  49. package/dist/{index-BX7rl07Z.d.mts → index-eOfQxlQV.d.mts} +13 -13
  50. package/dist/{index-D6ku0rUC.d.mts → index-hP8gvyp-.d.mts} +5 -5
  51. package/dist/{index-CzpdkTdv.d.mts → index-pdl9MzQu.d.mts} +9 -9
  52. package/dist/index.d.mts +2 -2
  53. package/dist/index.mjs +4 -4
  54. package/dist/integrations/next-js.d.mts +4 -4
  55. package/dist/integrations/node.d.mts +2 -2
  56. package/dist/integrations/react-start.d.mts +4 -4
  57. package/dist/{jwt-DBN2mu0r.mjs → jwt-Czv-v097.mjs} +1 -1
  58. package/dist/{kysely-adapter-Bkm1liPW.mjs → kysely-adapter-BidlNTiV.mjs} +4 -2
  59. package/dist/{magic-link-D9Em1aOR.mjs → magic-link-CJgE0Ngn.mjs} +1 -1
  60. package/dist/{multi-session-Dno_8DxC.mjs → multi-session-bveCXtQW.mjs} +1 -1
  61. package/dist/{oauth-proxy-DW-zt8wv.mjs → oauth-proxy-69n1xA8L.mjs} +1 -1
  62. package/dist/oauth2/index.d.mts +2 -2
  63. package/dist/oauth2/index.mjs +2 -2
  64. package/dist/{one-tap-CodeyQb8.mjs → one-tap-Cm1eHuqi.mjs} +1 -1
  65. package/dist/{organization-CkTKs7bx.mjs → organization-BK3ks97y.mjs} +2 -2
  66. package/dist/plugins/admin/index.d.mts +3 -3
  67. package/dist/plugins/admin/index.mjs +3 -3
  68. package/dist/plugins/anonymous/index.d.mts +3 -3
  69. package/dist/plugins/anonymous/index.mjs +3 -3
  70. package/dist/plugins/audit-log/client.d.mts +24 -24
  71. package/dist/plugins/audit-log/index.d.mts +23 -23
  72. package/dist/plugins/audit-log/index.mjs +3 -3
  73. package/dist/plugins/bearer/index.d.mts +1 -1
  74. package/dist/plugins/captcha/index.d.mts +1 -1
  75. package/dist/plugins/custom-session/index.d.mts +3 -3
  76. package/dist/plugins/custom-session/index.mjs +2 -2
  77. package/dist/plugins/device-authorization/index.d.mts +1 -1
  78. package/dist/plugins/device-authorization/index.mjs +1 -1
  79. package/dist/plugins/email-otp/index.d.mts +2 -2
  80. package/dist/plugins/email-otp/index.mjs +3 -3
  81. package/dist/plugins/generic-oauth/index.d.mts +3 -3
  82. package/dist/plugins/generic-oauth/index.mjs +3 -3
  83. package/dist/plugins/haveibeenpwned/index.d.mts +1 -1
  84. package/dist/plugins/haveibeenpwned/index.mjs +3 -3
  85. package/dist/plugins/index.d.mts +23 -23
  86. package/dist/plugins/index.mjs +18 -18
  87. package/dist/plugins/jwt/index.d.mts +3 -3
  88. package/dist/plugins/jwt/index.mjs +3 -3
  89. package/dist/plugins/magic-link/index.d.mts +1 -1
  90. package/dist/plugins/magic-link/index.mjs +3 -3
  91. package/dist/plugins/multi-session/index.d.mts +2 -2
  92. package/dist/plugins/multi-session/index.mjs +3 -3
  93. package/dist/plugins/oauth-proxy/index.d.mts +1 -1
  94. package/dist/plugins/oauth-proxy/index.mjs +3 -3
  95. package/dist/plugins/one-tap/index.d.mts +1 -1
  96. package/dist/plugins/one-tap/index.mjs +3 -3
  97. package/dist/plugins/one-time-token/index.d.mts +3 -3
  98. package/dist/plugins/one-time-token/index.mjs +18 -18
  99. package/dist/plugins/organization/index.d.mts +3 -3
  100. package/dist/plugins/organization/index.mjs +3 -3
  101. package/dist/plugins/passkey/index.d.mts +3 -3
  102. package/dist/plugins/passkey/index.mjs +2 -2
  103. package/dist/plugins/phone-number/index.d.mts +3 -3
  104. package/dist/plugins/phone-number/index.mjs +2 -2
  105. package/dist/plugins/sentinel/client.d.mts +24 -24
  106. package/dist/plugins/sentinel/client.mjs +2 -2
  107. package/dist/plugins/sentinel/index.d.mts +23 -23
  108. package/dist/plugins/sentinel/index.mjs +5 -5
  109. package/dist/plugins/two-factor/index.d.mts +3 -3
  110. package/dist/plugins/two-factor/index.mjs +2 -2
  111. package/dist/plugins/username/index.d.mts +1 -1
  112. package/dist/plugins/username/index.mjs +3 -3
  113. package/dist/{plugins-yF8CFUDR.mjs → plugins-RSPSU3ro.mjs} +1 -1
  114. package/dist/{pow-OK01yPG3.mjs → pow-DvkUopsK.mjs} +17 -1
  115. package/dist/{sentinel-DiPqydKG.mjs → sentinel-B-2jmmZh.mjs} +325 -98
  116. package/dist/src/adapters/memory-adapter/memory-adapter.d.ts +1 -1
  117. package/dist/src/adapters/prisma-adapter/test/auth.d.ts +1 -1
  118. package/dist/src/adapters/tests/auth-flow.d.ts +3 -3
  119. package/dist/src/adapters/tests/normal.d.ts +10 -2
  120. package/dist/src/adapters/tests/number-id.d.ts +4 -4
  121. package/dist/src/adapters/tests/performance.d.ts +3 -3
  122. package/dist/src/adapters/tests/transactions.d.ts +3 -3
  123. package/dist/src/api/index.d.ts +8 -8
  124. package/dist/src/plugins/admin/admin.d.ts +2 -2
  125. package/dist/src/plugins/api-key/index.d.ts +2 -2
  126. package/dist/src/plugins/audit-log/index.d.ts +5 -14
  127. package/dist/src/plugins/audit-log/remote.d.ts +4 -4
  128. package/dist/src/plugins/audit-log/types.d.ts +22 -0
  129. package/dist/src/plugins/email-otp/index.d.ts +1 -1
  130. package/dist/src/plugins/multi-session/index.d.ts +8 -8
  131. package/dist/src/plugins/organization/routes/crud-access-control.d.ts +8 -8
  132. package/dist/src/plugins/organization/routes/crud-invites.d.ts +46 -46
  133. package/dist/src/plugins/organization/routes/crud-members.d.ts +40 -40
  134. package/dist/src/plugins/organization/routes/crud-org.d.ts +36 -36
  135. package/dist/src/plugins/organization/routes/crud-team.d.ts +50 -50
  136. package/dist/src/plugins/sentinel/geo.d.ts +11 -0
  137. package/dist/src/plugins/sentinel/index.d.ts +7 -0
  138. package/dist/src/plugins/sentinel/intel.d.ts +8 -1
  139. package/dist/src/plugins/sentinel/memory-cache.d.ts +12 -0
  140. package/dist/src/plugins/sentinel/schema.d.ts +4 -0
  141. package/dist/src/plugins/sentinel/store.d.ts +7 -0
  142. package/dist/src/plugins/sentinel/types.d.ts +29 -1
  143. package/dist/src/test-utils/test-instance.d.ts +25 -25
  144. package/dist/test-utils/index.d.mts +277 -277
  145. package/dist/test-utils/index.mjs +20 -20
  146. package/dist/types/index.d.mts +2 -2
  147. package/dist/{username-BHNvcvsY.mjs → username-DCp6yugu.mjs} +1 -1
  148. package/package.json +3 -3
@@ -1,9 +1,9 @@
1
1
  import { o as LiteralString } from "./helper-BgOIGHsu.mjs";
2
- import { g as User } from "./index-BNhJglHC.mjs";
2
+ import { g as User } from "./index-DngQlUSI.mjs";
3
3
  import { t as InferOptionSchema } from "./plugins-Dy_FrD4Y.mjs";
4
- import * as _gatwech_core1 from "@gatwech/core";
4
+ import * as _gatwech_core42 from "@gatwech/core";
5
5
  import { PayvoAuthPlugin } from "@gatwech/core";
6
- import * as better_call5 from "better-call";
6
+ import * as better_call186 from "better-call";
7
7
  import * as z$1 from "zod";
8
8
  import * as _better_fetch_fetch19 from "@better-fetch/fetch";
9
9
 
@@ -274,7 +274,7 @@ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
274
274
  } & {
275
275
  asResponse?: boolean;
276
276
  returnHeaders?: boolean;
277
- use?: better_call5.Middleware[];
277
+ use?: better_call186.Middleware[];
278
278
  path?: string;
279
279
  } & {
280
280
  asResponse?: AsResponse | undefined;
@@ -295,7 +295,7 @@ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
295
295
  password: z$1.ZodString;
296
296
  issuer: z$1.ZodOptional<z$1.ZodString>;
297
297
  }, z$1.core.$strip>;
298
- use: ((inputContext: better_call5.MiddlewareInputContext<better_call5.MiddlewareOptions>) => Promise<{
298
+ use: ((inputContext: better_call186.MiddlewareInputContext<better_call186.MiddlewareOptions>) => Promise<{
299
299
  session: {
300
300
  session: Record<string, any> & {
301
301
  id: string;
@@ -387,7 +387,7 @@ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
387
387
  } & {
388
388
  asResponse?: boolean;
389
389
  returnHeaders?: boolean;
390
- use?: better_call5.Middleware[];
390
+ use?: better_call186.Middleware[];
391
391
  path?: string;
392
392
  } & {
393
393
  asResponse?: AsResponse | undefined;
@@ -405,7 +405,7 @@ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
405
405
  body: z$1.ZodObject<{
406
406
  password: z$1.ZodString;
407
407
  }, z$1.core.$strip>;
408
- use: ((inputContext: better_call5.MiddlewareInputContext<better_call5.MiddlewareOptions>) => Promise<{
408
+ use: ((inputContext: better_call186.MiddlewareInputContext<better_call186.MiddlewareOptions>) => Promise<{
409
409
  session: {
410
410
  session: Record<string, any> & {
411
411
  id: string;
@@ -476,7 +476,7 @@ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
476
476
  } & {
477
477
  asResponse?: boolean;
478
478
  returnHeaders?: boolean;
479
- use?: better_call5.Middleware[];
479
+ use?: better_call186.Middleware[];
480
480
  path?: string;
481
481
  } & {
482
482
  asResponse?: AsResponse | undefined;
@@ -629,7 +629,7 @@ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
629
629
  } & {
630
630
  asResponse?: boolean;
631
631
  returnHeaders?: boolean;
632
- use?: better_call5.Middleware[];
632
+ use?: better_call186.Middleware[];
633
633
  path?: string;
634
634
  } & {
635
635
  asResponse?: AsResponse | undefined;
@@ -649,7 +649,7 @@ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
649
649
  body: z$1.ZodObject<{
650
650
  password: z$1.ZodString;
651
651
  }, z$1.core.$strip>;
652
- use: ((inputContext: better_call5.MiddlewareInputContext<better_call5.MiddlewareOptions>) => Promise<{
652
+ use: ((inputContext: better_call186.MiddlewareInputContext<better_call186.MiddlewareOptions>) => Promise<{
653
653
  session: {
654
654
  session: Record<string, any> & {
655
655
  id: string;
@@ -727,7 +727,7 @@ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
727
727
  } & {
728
728
  asResponse?: boolean;
729
729
  returnHeaders?: boolean;
730
- use?: better_call5.Middleware[];
730
+ use?: better_call186.Middleware[];
731
731
  path?: string;
732
732
  } & {
733
733
  asResponse?: AsResponse | undefined;
@@ -773,7 +773,7 @@ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
773
773
  } & {
774
774
  asResponse?: boolean;
775
775
  returnHeaders?: boolean;
776
- use?: better_call5.Middleware[];
776
+ use?: better_call186.Middleware[];
777
777
  path?: string;
778
778
  } & {
779
779
  asResponse?: AsResponse | undefined;
@@ -838,7 +838,7 @@ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
838
838
  } & {
839
839
  asResponse?: boolean;
840
840
  returnHeaders?: boolean;
841
- use?: better_call5.Middleware[];
841
+ use?: better_call186.Middleware[];
842
842
  path?: string;
843
843
  } & {
844
844
  asResponse?: AsResponse | undefined;
@@ -966,7 +966,7 @@ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
966
966
  } & {
967
967
  asResponse?: boolean;
968
968
  returnHeaders?: boolean;
969
- use?: better_call5.Middleware[];
969
+ use?: better_call186.Middleware[];
970
970
  path?: string;
971
971
  } & {
972
972
  asResponse?: AsResponse | undefined;
@@ -1031,7 +1031,7 @@ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
1031
1031
  } & {
1032
1032
  asResponse?: boolean;
1033
1033
  returnHeaders?: boolean;
1034
- use?: better_call5.Middleware[];
1034
+ use?: better_call186.Middleware[];
1035
1035
  path?: string;
1036
1036
  } & {
1037
1037
  asResponse?: AsResponse | undefined;
@@ -1046,7 +1046,7 @@ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
1046
1046
  }>;
1047
1047
  options: {
1048
1048
  method: "POST";
1049
- use: ((inputContext: better_call5.MiddlewareInputContext<better_call5.MiddlewareOptions>) => Promise<{
1049
+ use: ((inputContext: better_call186.MiddlewareInputContext<better_call186.MiddlewareOptions>) => Promise<{
1050
1050
  session: {
1051
1051
  session: Record<string, any> & {
1052
1052
  id: string;
@@ -1119,7 +1119,7 @@ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
1119
1119
  } & {
1120
1120
  asResponse?: boolean;
1121
1121
  returnHeaders?: boolean;
1122
- use?: better_call5.Middleware[];
1122
+ use?: better_call186.Middleware[];
1123
1123
  path?: string;
1124
1124
  } & {
1125
1125
  asResponse?: AsResponse | undefined;
@@ -1188,8 +1188,8 @@ declare const twoFactor: (options?: TwoFactorOptions | undefined) => {
1188
1188
  options: TwoFactorOptions | undefined;
1189
1189
  hooks: {
1190
1190
  after: {
1191
- matcher(context: _gatwech_core1.HookEndpointContext): boolean;
1192
- handler: (inputContext: better_call5.MiddlewareInputContext<better_call5.MiddlewareOptions>) => Promise<{
1191
+ matcher(context: _gatwech_core42.HookEndpointContext): boolean;
1192
+ handler: (inputContext: better_call186.MiddlewareInputContext<better_call186.MiddlewareOptions>) => Promise<{
1193
1193
  twoFactorRedirect: boolean;
1194
1194
  } | undefined>;
1195
1195
  }[];
@@ -1,4 +1,4 @@
1
- import * as _gatwech_core11 from "@gatwech/core";
1
+ import * as _gatwech_core3 from "@gatwech/core";
2
2
 
3
3
  //#region src/plugins/haveibeenpwned/index.d.ts
4
4
 
@@ -13,7 +13,7 @@ interface HaveIBeenPwnedOptions {
13
13
  }
14
14
  declare const haveIBeenPwned: (options?: HaveIBeenPwnedOptions | undefined) => {
15
15
  id: "haveIBeenPwned";
16
- init(ctx: _gatwech_core11.AuthContext<_gatwech_core11.PayvoAuthOptions>): {
16
+ init(ctx: _gatwech_core3.AuthContext<_gatwech_core3.PayvoAuthOptions>): {
17
17
  context: {
18
18
  password: {
19
19
  hash(password: string): Promise<string>;
@@ -25,7 +25,7 @@ declare const haveIBeenPwned: (options?: HaveIBeenPwnedOptions | undefined) => {
25
25
  minPasswordLength: number;
26
26
  maxPasswordLength: number;
27
27
  };
28
- checkPassword: (userId: string, ctx: _gatwech_core11.GenericEndpointContext<_gatwech_core11.PayvoAuthOptions>) => Promise<boolean>;
28
+ checkPassword: (userId: string, ctx: _gatwech_core3.GenericEndpointContext<_gatwech_core3.PayvoAuthOptions>) => Promise<boolean>;
29
29
  };
30
30
  };
31
31
  };
@@ -25,7 +25,7 @@ type InternalLogger = { [K in LogLevel]: (...params: LogHandlerParams) => void }
25
25
  };
26
26
  declare const createLogger: (options?: Logger | undefined) => InternalLogger;
27
27
  //#endregion
28
- //#region ../core/dist/index-Df0KhQRf.d.mts
28
+ //#region ../core/dist/index-BL_t8cRp.d.mts
29
29
  //#region src/db/type.d.ts
30
30
  type DBPreservedModels = "user" | "account" | "session" | "verification" | "rate-limit" | "organization" | "member" | "invitation" | "jwks" | "passkey" | "two-factor";
31
31
  type DBFieldType = "string" | "number" | "boolean" | "date" | "json" | `${"string" | "number"}[]` | Array<LiteralString>;
@@ -137,7 +137,7 @@ interface SecondaryStorage {
137
137
  * @param key - Key to get
138
138
  * @returns - Value of the key
139
139
  */
140
- get: (key: string) => Awaitable$1<unknown>;
140
+ get: (key: string) => Awaitable<unknown>;
141
141
  /**
142
142
  * Atomically get a value and delete it from storage.
143
143
  *
@@ -149,7 +149,7 @@ interface SecondaryStorage {
149
149
  * breaking release, or require database-backed verification storage for
150
150
  * security-sensitive consume paths.
151
151
  */
152
- getAndDelete?: (key: string) => Awaitable$1<unknown>;
152
+ getAndDelete?: (key: string) => Awaitable<unknown>;
153
153
  /**
154
154
  * Atomically increment the counter at `key` by one, returning the
155
155
  * post-increment value.
@@ -164,7 +164,7 @@ interface SecondaryStorage {
164
164
  * this required for secondary-storage-backed rate limiting in the next minor
165
165
  * on `next`.
166
166
  */
167
- increment?: (key: string, ttl: number) => Awaitable$1<number>;
167
+ increment?: (key: string, ttl: number) => Awaitable<number>;
168
168
  set: (
169
169
  /**
170
170
  * Key to store
@@ -177,12 +177,12 @@ interface SecondaryStorage {
177
177
  /**
178
178
  * Time to live in seconds
179
179
  */
180
- ttl?: number | undefined) => Awaitable$1<void | null | unknown>;
180
+ ttl?: number | undefined) => Awaitable<void | null | unknown>;
181
181
  /**
182
182
  *
183
183
  * @param key - Key to delete
184
184
  */
185
- delete: (key: string) => Awaitable$1<void | null | string>;
185
+ delete: (key: string) => Awaitable<void | null | string>;
186
186
  }
187
187
  //#endregion
188
188
  //#region src/db/plugin.d.ts
@@ -912,7 +912,7 @@ type PayvoAuthCookies = {
912
912
  //#endregion
913
913
  //#region src/types/helper.d.ts
914
914
  type Primitive = string | number | symbol | bigint | boolean | null | undefined;
915
- type Awaitable$1<T> = T | Promise<T>;
915
+ type Awaitable<T> = T | Promise<T>;
916
916
  type LiteralString = "" | (string & Record<never, never>);
917
917
  type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
918
918
  //#endregion
@@ -1118,7 +1118,7 @@ type SocialProviders = { [K in SocialProviderList[number]]?: Parameters<(typeof
1118
1118
  type SocialProviderList = typeof socialProviderList;
1119
1119
  //#endregion
1120
1120
  //#region src/types/plugin.d.ts
1121
- type Awaitable<T> = T | Promise<T>;
1121
+ type Awaitable$1<T> = T | Promise<T>;
1122
1122
  type DeepPartial<T> = T extends Function ? T : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
1123
1123
  type HookEndpointContext = Partial<EndpointContext<string, any> & Omit<InputContext<string, any>, "method">> & {
1124
1124
  path: string;
@@ -1134,7 +1134,7 @@ type PayvoAuthPlugin = {
1134
1134
  * The init function is called when the plugin is initialized.
1135
1135
  * You can return a new context or modify the existing context.
1136
1136
  */
1137
- init?: ((ctx: AuthContext) => Awaitable<{
1137
+ init?: ((ctx: AuthContext) => Awaitable$1<{
1138
1138
  context?: DeepPartial<Omit<AuthContext, "options">>;
1139
1139
  options?: Partial<PayvoAuthOptions>;
1140
1140
  }> | void | Promise<void>) | undefined;
@@ -1355,6 +1355,27 @@ type PayvoAuthAdvancedOptions = {
1355
1355
  * Payvo Auth. And could lead to security vulnerabilities.
1356
1356
  */
1357
1357
  disableOriginCheck?: boolean | undefined;
1358
+ /**
1359
+ * Run deferred work, such as sending events to a remote service, after the
1360
+ * response is sent. On serverless platforms, pass the platform's hook so
1361
+ * the function stays alive until the work finishes.
1362
+ *
1363
+ * @example
1364
+ * // Vercel
1365
+ * import { waitUntil } from "@vercel/functions";
1366
+ * advanced: { backgroundTasks: { handler: waitUntil } }
1367
+ *
1368
+ * @example
1369
+ * // Cloudflare Workers, with the execution context kept in AsyncLocalStorage
1370
+ * advanced: {
1371
+ * backgroundTasks: {
1372
+ * handler: (promise) => executionContext.getStore()?.waitUntil(promise),
1373
+ * },
1374
+ * }
1375
+ */
1376
+ backgroundTasks?: {
1377
+ handler: (promise: Promise<unknown>) => void;
1378
+ } | undefined;
1358
1379
  /**
1359
1380
  * Configure cookies to be cross subdomains
1360
1381
  */
@@ -2100,9 +2121,10 @@ type PayvoAuthOptions = {
2100
2121
  data: Optional<User & Record<string, any>>;
2101
2122
  }>;
2102
2123
  /**
2103
- * Hook that is called after a user is updated.
2124
+ * Hook that is called after a user is updated. `data` holds the
2125
+ * fields that were written, after every `before` hook ran.
2104
2126
  */
2105
- after?: (user: User & Record<string, unknown>, context?: GenericEndpointContext) => Promise<void>;
2127
+ after?: (user: User & Record<string, unknown>, context?: GenericEndpointContext, data?: Partial<User> & Record<string, unknown>) => Promise<void>;
2106
2128
  };
2107
2129
  delete?: {
2108
2130
  /**
@@ -2147,9 +2169,10 @@ type PayvoAuthOptions = {
2147
2169
  data: Optional<Session & Record<string, any>>;
2148
2170
  }>;
2149
2171
  /**
2150
- * Hook that is called after a session is updated.
2172
+ * Hook that is called after a session is updated. `data` holds the
2173
+ * fields that were written, after every `before` hook ran.
2151
2174
  */
2152
- after?: (session: Session & Record<string, unknown>, context?: GenericEndpointContext) => Promise<void>;
2175
+ after?: (session: Session & Record<string, unknown>, context?: GenericEndpointContext, data?: Partial<Session> & Record<string, unknown>) => Promise<void>;
2153
2176
  };
2154
2177
  delete?: {
2155
2178
  /**
@@ -2194,9 +2217,10 @@ type PayvoAuthOptions = {
2194
2217
  data: Optional<Account & Record<string, any>>;
2195
2218
  }>;
2196
2219
  /**
2197
- * Hook that is called after a account is updated.
2220
+ * Hook that is called after a account is updated. `data` holds the
2221
+ * fields that were written, after every `before` hook ran.
2198
2222
  */
2199
- after?: (account: Account & Record<string, unknown>, context?: GenericEndpointContext) => Promise<void>;
2223
+ after?: (account: Account & Record<string, unknown>, context?: GenericEndpointContext, data?: Partial<Account> & Record<string, unknown>) => Promise<void>;
2200
2224
  };
2201
2225
  delete?: {
2202
2226
  /**
@@ -2238,9 +2262,11 @@ type PayvoAuthOptions = {
2238
2262
  data: Optional<Verification & Record<string, any>>;
2239
2263
  }>;
2240
2264
  /**
2241
- * Hook that is called after a verification is updated.
2265
+ * Hook that is called after a verification is updated. `data`
2266
+ * holds the fields that were written, after every `before` hook
2267
+ * ran.
2242
2268
  */
2243
- after?: (verification: Verification & Record<string, unknown>, context?: GenericEndpointContext) => Promise<void>;
2269
+ after?: (verification: Verification & Record<string, unknown>, context?: GenericEndpointContext, data?: Partial<Verification> & Record<string, unknown>) => Promise<void>;
2244
2270
  };
2245
2271
  delete?: {
2246
2272
  /**
@@ -2524,6 +2550,19 @@ type AuthContext<Options extends PayvoAuthOptions = PayvoAuthOptions> = {
2524
2550
  * @default false
2525
2551
  */
2526
2552
  skipCSRFCheck: boolean;
2553
+ /**
2554
+ * Runs work after the response without blocking it, e.g. sending an
2555
+ * event to a remote service.
2556
+ *
2557
+ * This is inferred from the `options.advanced?.backgroundTasks?.handler`
2558
+ * option. Without one, the promise runs on its own.
2559
+ */
2560
+ runInBackground: (promise: Promise<unknown>) => void;
2561
+ /**
2562
+ * Runs work in the background when `advanced.backgroundTasks` is
2563
+ * configured, and awaits it otherwise, for work that must finish
2564
+ */
2565
+ runInBackgroundOrAwait: (promise: Promise<unknown> | void) => Awaitable<unknown>;
2527
2566
  };
2528
2567
  //#endregion
2529
2568
  //#region src/types/plugin-client.d.ts
@@ -1,6 +1,6 @@
1
- import { o as Session, s as User } from "./index-Df0KhQRf-BEa5tdwJ.mjs";
2
- import * as _gatwech_core30 from "@gatwech/core";
3
- import * as better_call83 from "better-call";
1
+ import { o as Session, s as User } from "./index-BL_t8cRp-C4QYBsac.mjs";
2
+ import * as _gatwech_core11 from "@gatwech/core";
3
+ import * as better_call123 from "better-call";
4
4
  import * as z$1 from "zod";
5
5
 
6
6
  //#region src/plugins/multi-session/index.d.ts
@@ -46,7 +46,7 @@ declare const multiSession: (options?: MultiSessionConfig | undefined) => {
46
46
  } & {
47
47
  asResponse?: boolean;
48
48
  returnHeaders?: boolean;
49
- use?: better_call83.Middleware[];
49
+ use?: better_call123.Middleware[];
50
50
  path?: string;
51
51
  } & {
52
52
  asResponse?: AsResponse | undefined;
@@ -102,7 +102,7 @@ declare const multiSession: (options?: MultiSessionConfig | undefined) => {
102
102
  } & {
103
103
  asResponse?: boolean;
104
104
  returnHeaders?: boolean;
105
- use?: better_call83.Middleware[];
105
+ use?: better_call123.Middleware[];
106
106
  path?: string;
107
107
  } & {
108
108
  asResponse?: AsResponse | undefined;
@@ -123,7 +123,7 @@ declare const multiSession: (options?: MultiSessionConfig | undefined) => {
123
123
  sessionToken: z$1.ZodString;
124
124
  }, z$1.core.$strip>;
125
125
  requireHeaders: true;
126
- use: ((inputContext: better_call83.MiddlewareInputContext<better_call83.MiddlewareOptions>) => Promise<{
126
+ use: ((inputContext: better_call123.MiddlewareInputContext<better_call123.MiddlewareOptions>) => Promise<{
127
127
  session: {
128
128
  session: Record<string, any> & {
129
129
  id: string;
@@ -206,7 +206,7 @@ declare const multiSession: (options?: MultiSessionConfig | undefined) => {
206
206
  } & {
207
207
  asResponse?: boolean;
208
208
  returnHeaders?: boolean;
209
- use?: better_call83.Middleware[];
209
+ use?: better_call123.Middleware[];
210
210
  path?: string;
211
211
  } & {
212
212
  asResponse?: AsResponse | undefined;
@@ -225,7 +225,7 @@ declare const multiSession: (options?: MultiSessionConfig | undefined) => {
225
225
  sessionToken: z$1.ZodString;
226
226
  }, z$1.core.$strip>;
227
227
  requireHeaders: true;
228
- use: ((inputContext: better_call83.MiddlewareInputContext<better_call83.MiddlewareOptions>) => Promise<{
228
+ use: ((inputContext: better_call123.MiddlewareInputContext<better_call123.MiddlewareOptions>) => Promise<{
229
229
  session: {
230
230
  session: Record<string, any> & {
231
231
  id: string;
@@ -278,8 +278,8 @@ declare const multiSession: (options?: MultiSessionConfig | undefined) => {
278
278
  };
279
279
  hooks: {
280
280
  after: {
281
- matcher: (context: _gatwech_core30.HookEndpointContext) => boolean;
282
- handler: (inputContext: better_call83.MiddlewareInputContext<better_call83.MiddlewareOptions>) => Promise<void>;
281
+ matcher: (context: _gatwech_core11.HookEndpointContext) => boolean;
282
+ handler: (inputContext: better_call123.MiddlewareInputContext<better_call123.MiddlewareOptions>) => Promise<void>;
283
283
  }[];
284
284
  };
285
285
  $ERROR_CODES: {
@@ -1,5 +1,5 @@
1
- import * as _gatwech_core46 from "@gatwech/core";
2
- import * as better_call105 from "better-call";
1
+ import * as _gatwech_core0 from "@gatwech/core";
2
+ import * as better_call92 from "better-call";
3
3
 
4
4
  //#region src/plugins/bearer/index.d.ts
5
5
  interface BearerOptions {
@@ -19,16 +19,16 @@ declare const bearer: (options?: BearerOptions | undefined) => {
19
19
  id: "bearer";
20
20
  hooks: {
21
21
  before: {
22
- matcher(context: _gatwech_core46.HookEndpointContext): boolean;
23
- handler: (inputContext: better_call105.MiddlewareInputContext<better_call105.MiddlewareOptions>) => Promise<{
22
+ matcher(context: _gatwech_core0.HookEndpointContext): boolean;
23
+ handler: (inputContext: better_call92.MiddlewareInputContext<better_call92.MiddlewareOptions>) => Promise<{
24
24
  context: {
25
25
  headers: Headers;
26
26
  };
27
27
  } | undefined>;
28
28
  }[];
29
29
  after: {
30
- matcher(context: _gatwech_core46.HookEndpointContext): true;
31
- handler: (inputContext: better_call105.MiddlewareInputContext<better_call105.MiddlewareOptions>) => Promise<void>;
30
+ matcher(context: _gatwech_core0.HookEndpointContext): true;
31
+ handler: (inputContext: better_call92.MiddlewareInputContext<better_call92.MiddlewareOptions>) => Promise<void>;
32
32
  }[];
33
33
  };
34
34
  };
@@ -1,5 +1,5 @@
1
1
  import { t as InferOptionSchema } from "./plugins-Dy_FrD4Y.mjs";
2
- import * as better_call29 from "better-call";
2
+ import * as better_call96 from "better-call";
3
3
  import * as z$1 from "zod";
4
4
  import { StringValue } from "ms";
5
5
 
@@ -180,7 +180,7 @@ declare const deviceAuthorization: (options?: Partial<DeviceAuthorizationOptions
180
180
  } & {
181
181
  asResponse?: boolean;
182
182
  returnHeaders?: boolean;
183
- use?: better_call29.Middleware[];
183
+ use?: better_call96.Middleware[];
184
184
  path?: string;
185
185
  } & {
186
186
  asResponse?: AsResponse | undefined;
@@ -303,7 +303,7 @@ declare const deviceAuthorization: (options?: Partial<DeviceAuthorizationOptions
303
303
  } & {
304
304
  asResponse?: boolean;
305
305
  returnHeaders?: boolean;
306
- use?: better_call29.Middleware[];
306
+ use?: better_call96.Middleware[];
307
307
  path?: string;
308
308
  } & {
309
309
  asResponse?: AsResponse | undefined;
@@ -407,7 +407,7 @@ declare const deviceAuthorization: (options?: Partial<DeviceAuthorizationOptions
407
407
  } & {
408
408
  asResponse?: boolean;
409
409
  returnHeaders?: boolean;
410
- use?: better_call29.Middleware[];
410
+ use?: better_call96.Middleware[];
411
411
  path?: string;
412
412
  } & {
413
413
  asResponse?: AsResponse | undefined;
@@ -484,7 +484,7 @@ declare const deviceAuthorization: (options?: Partial<DeviceAuthorizationOptions
484
484
  } & {
485
485
  asResponse?: boolean;
486
486
  returnHeaders?: boolean;
487
- use?: better_call29.Middleware[];
487
+ use?: better_call96.Middleware[];
488
488
  path?: string;
489
489
  } & {
490
490
  asResponse?: AsResponse | undefined;
@@ -556,7 +556,7 @@ declare const deviceAuthorization: (options?: Partial<DeviceAuthorizationOptions
556
556
  } & {
557
557
  asResponse?: boolean;
558
558
  returnHeaders?: boolean;
559
- use?: better_call29.Middleware[];
559
+ use?: better_call96.Middleware[];
560
560
  path?: string;
561
561
  } & {
562
562
  asResponse?: AsResponse | undefined;
@@ -1,6 +1,6 @@
1
- import { g as User } from "./index-BNhJglHC.mjs";
1
+ import { g as User } from "./index-DngQlUSI.mjs";
2
2
  import { t as InferOptionSchema } from "./plugins-Dy_FrD4Y.mjs";
3
- import * as better_call76 from "better-call";
3
+ import * as better_call177 from "better-call";
4
4
  import * as z$1 from "zod";
5
5
 
6
6
  //#region src/plugins/phone-number/index.d.ts
@@ -136,7 +136,7 @@ declare const phoneNumber: (options?: PhoneNumberOptions | undefined) => {
136
136
  } & {
137
137
  asResponse?: boolean;
138
138
  returnHeaders?: boolean;
139
- use?: better_call76.Middleware[];
139
+ use?: better_call177.Middleware[];
140
140
  path?: string;
141
141
  } & {
142
142
  asResponse?: AsResponse | undefined;
@@ -225,7 +225,7 @@ declare const phoneNumber: (options?: PhoneNumberOptions | undefined) => {
225
225
  } & {
226
226
  asResponse?: boolean;
227
227
  returnHeaders?: boolean;
228
- use?: better_call76.Middleware[];
228
+ use?: better_call177.Middleware[];
229
229
  path?: string;
230
230
  } & {
231
231
  asResponse?: AsResponse | undefined;
@@ -307,7 +307,7 @@ declare const phoneNumber: (options?: PhoneNumberOptions | undefined) => {
307
307
  } & {
308
308
  asResponse?: boolean;
309
309
  returnHeaders?: boolean;
310
- use?: better_call76.Middleware[];
310
+ use?: better_call177.Middleware[];
311
311
  path?: string;
312
312
  } & {
313
313
  asResponse?: AsResponse | undefined;
@@ -449,7 +449,7 @@ declare const phoneNumber: (options?: PhoneNumberOptions | undefined) => {
449
449
  } & {
450
450
  asResponse?: boolean;
451
451
  returnHeaders?: boolean;
452
- use?: better_call76.Middleware[];
452
+ use?: better_call177.Middleware[];
453
453
  path?: string;
454
454
  } & {
455
455
  asResponse?: AsResponse | undefined;
@@ -517,7 +517,7 @@ declare const phoneNumber: (options?: PhoneNumberOptions | undefined) => {
517
517
  } & {
518
518
  asResponse?: boolean;
519
519
  returnHeaders?: boolean;
520
- use?: better_call76.Middleware[];
520
+ use?: better_call177.Middleware[];
521
521
  path?: string;
522
522
  } & {
523
523
  asResponse?: AsResponse | undefined;
@@ -1,8 +1,8 @@
1
- import { g as User, h as Session } from "./index-BNhJglHC.mjs";
1
+ import { g as User, h as Session } from "./index-DngQlUSI.mjs";
2
2
  import { t as InferOptionSchema } from "./plugins-Dy_FrD4Y.mjs";
3
- import * as _gatwech_core0 from "@gatwech/core";
3
+ import * as _gatwech_core37 from "@gatwech/core";
4
4
  import { AuthContext, GenericEndpointContext } from "@gatwech/core";
5
- import * as better_call0 from "better-call";
5
+ import * as better_call163 from "better-call";
6
6
  import { EndpointContext } from "better-call";
7
7
 
8
8
  //#region src/plugins/anonymous/index.d.ts
@@ -77,7 +77,7 @@ declare const anonymous: (options?: AnonymousOptions | undefined) => {
77
77
  } & {
78
78
  asResponse?: boolean;
79
79
  returnHeaders?: boolean;
80
- use?: better_call0.Middleware[];
80
+ use?: better_call163.Middleware[];
81
81
  path?: string;
82
82
  } & {
83
83
  asResponse?: AsResponse | undefined;
@@ -141,8 +141,8 @@ declare const anonymous: (options?: AnonymousOptions | undefined) => {
141
141
  };
142
142
  hooks: {
143
143
  after: {
144
- matcher(ctx: _gatwech_core0.HookEndpointContext): boolean;
145
- handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>;
144
+ matcher(ctx: _gatwech_core37.HookEndpointContext): boolean;
145
+ handler: (inputContext: better_call163.MiddlewareInputContext<better_call163.MiddlewareOptions>) => Promise<void>;
146
146
  }[];
147
147
  };
148
148
  schema: {
@@ -1,4 +1,4 @@
1
- import { g as User, h as Session } from "./index-BNhJglHC.mjs";
1
+ import { g as User, h as Session } from "./index-DngQlUSI.mjs";
2
2
  import { GenericEndpointContext, PayvoAuthCookies, PayvoAuthOptions } from "@gatwech/core";
3
3
  import { CookieOptions } from "better-call";
4
4
  import "zod";
@@ -1,4 +1,4 @@
1
- import * as better_call113 from "better-call";
1
+ import * as better_call91 from "better-call";
2
2
  import * as z$1 from "zod";
3
3
 
4
4
  //#region src/plugins/one-tap/index.d.ts
@@ -38,7 +38,7 @@ declare const oneTap: (options?: OneTapOptions | undefined) => {
38
38
  } & {
39
39
  asResponse?: boolean;
40
40
  returnHeaders?: boolean;
41
- use?: better_call113.Middleware[];
41
+ use?: better_call91.Middleware[];
42
42
  path?: string;
43
43
  } & {
44
44
  asResponse?: AsResponse | undefined;
@@ -1,9 +1,9 @@
1
1
  import { t as Awaitable } from "./helper-BgOIGHsu.mjs";
2
- import { On as index_d_exports, g as User, h as Session } from "./index-BNhJglHC.mjs";
2
+ import { On as index_d_exports, g as User, h as Session } from "./index-DngQlUSI.mjs";
3
3
  import { t as InferOptionSchema } from "./plugins-Dy_FrD4Y.mjs";
4
- import * as _gatwech_core48 from "@gatwech/core";
4
+ import * as _gatwech_core10 from "@gatwech/core";
5
5
  import { GenericEndpointContext } from "@gatwech/core";
6
- import * as better_call114 from "better-call";
6
+ import * as better_call116 from "better-call";
7
7
  import * as z$1 from "zod";
8
8
  import * as jose0 from "jose";
9
9
  import { JSONWebKeySet, JWTPayload } from "jose";
@@ -250,7 +250,7 @@ declare const jwt: (options?: JwtOptions | undefined) => {
250
250
  } & {
251
251
  asResponse?: boolean;
252
252
  returnHeaders?: boolean;
253
- use?: better_call114.Middleware[];
253
+ use?: better_call116.Middleware[];
254
254
  path?: string;
255
255
  } & {
256
256
  asResponse?: AsResponse | undefined;
@@ -355,7 +355,7 @@ declare const jwt: (options?: JwtOptions | undefined) => {
355
355
  } & {
356
356
  asResponse?: boolean;
357
357
  returnHeaders?: boolean;
358
- use?: better_call114.Middleware[];
358
+ use?: better_call116.Middleware[];
359
359
  path?: string;
360
360
  } & {
361
361
  asResponse?: AsResponse | undefined;
@@ -371,7 +371,7 @@ declare const jwt: (options?: JwtOptions | undefined) => {
371
371
  options: {
372
372
  method: "GET";
373
373
  requireHeaders: true;
374
- use: ((inputContext: better_call114.MiddlewareInputContext<better_call114.MiddlewareOptions>) => Promise<{
374
+ use: ((inputContext: better_call116.MiddlewareInputContext<better_call116.MiddlewareOptions>) => Promise<{
375
375
  session: {
376
376
  session: Record<string, any> & {
377
377
  id: string;
@@ -440,7 +440,7 @@ declare const jwt: (options?: JwtOptions | undefined) => {
440
440
  } & {
441
441
  asResponse?: boolean;
442
442
  returnHeaders?: boolean;
443
- use?: better_call114.Middleware[];
443
+ use?: better_call116.Middleware[];
444
444
  path?: string;
445
445
  } & {
446
446
  asResponse?: AsResponse | undefined;
@@ -476,8 +476,8 @@ declare const jwt: (options?: JwtOptions | undefined) => {
476
476
  };
477
477
  hooks: {
478
478
  after: {
479
- matcher(context: _gatwech_core48.HookEndpointContext): boolean;
480
- handler: (inputContext: better_call114.MiddlewareInputContext<better_call114.MiddlewareOptions>) => Promise<void>;
479
+ matcher(context: _gatwech_core10.HookEndpointContext): boolean;
480
+ handler: (inputContext: better_call116.MiddlewareInputContext<better_call116.MiddlewareOptions>) => Promise<void>;
481
481
  }[];
482
482
  };
483
483
  schema: {