@gatwech/auth 1.0.0-beta.18 → 1.0.0-beta.19

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 (224) hide show
  1. package/README.md +8 -14
  2. package/dist/{access-C6O_osEz.mjs → access-CrwEFPHE.mjs} +1 -1
  3. package/dist/{access-DT1f6l5k.mjs → access-bhklJd7m.mjs} +1 -1
  4. package/dist/{adapter-factory-BZ2Qiqpn.mjs → adapter-factory-xbLUJt85.mjs} +2 -2
  5. package/dist/adapters/drizzle-adapter/index.mjs +6 -5
  6. package/dist/adapters/index.d.mts +5 -5
  7. package/dist/adapters/index.mjs +6 -5
  8. package/dist/adapters/kysely-adapter/index.d.mts +1 -1
  9. package/dist/adapters/kysely-adapter/index.mjs +8 -7
  10. package/dist/adapters/memory-adapter/index.d.mts +1 -1
  11. package/dist/adapters/memory-adapter/index.mjs +6 -5
  12. package/dist/adapters/mongodb-adapter/index.mjs +6 -5
  13. package/dist/adapters/prisma-adapter/index.mjs +6 -5
  14. package/dist/adapters/test.mjs +4 -3
  15. package/dist/{admin-Bcq53Nwj.mjs → admin-BzUJL6tr.mjs} +6 -6
  16. package/dist/{anonymous-CRt1imBW.mjs → anonymous-BjlTk4gl.mjs} +5 -5
  17. package/dist/api/index.d.mts +5 -5
  18. package/dist/api/index.mjs +12 -11
  19. package/dist/{api-0pR_I-Nx.mjs → api-Dk8Yj_J5.mjs} +15 -5
  20. package/dist/audit-log-DKsUWR8O.mjs +772 -0
  21. package/dist/{auth-CBUoBX6o.mjs → auth-vfCyIIeV.mjs} +8 -8
  22. package/dist/{bearer-Djf_awfo.mjs → bearer-DvQLM00l.mjs} +2 -2
  23. package/dist/client/index.d.mts +21 -21
  24. package/dist/client/index.mjs +4 -4
  25. package/dist/client/plugins/index.d.mts +53 -45
  26. package/dist/client/plugins/index.mjs +16 -12
  27. package/dist/client/react/index.d.mts +19 -19
  28. package/dist/client/react/index.mjs +2 -2
  29. package/dist/client-4QEb0rUr.mjs +95 -0
  30. package/dist/client-CSOs1YN7.d.mts +14 -0
  31. package/dist/client-DZHNfxuR.d.mts +75 -0
  32. package/dist/client-DzOqXJUm.mjs +15 -0
  33. package/dist/{client-aExCkfwm.mjs → client-xga7yFIX.mjs} +2 -2
  34. package/dist/cookies/index.d.mts +6 -6
  35. package/dist/cookies/index.mjs +2 -2
  36. package/dist/{cookies-cJObLwn1.mjs → cookies-BuvlgcA-.mjs} +1 -1
  37. package/dist/crypto/index.mjs +2 -1
  38. package/dist/{crypto-Bb42eMrH.mjs → crypto-CCyta8xj.mjs} +1 -6
  39. package/dist/{custom-session-L3t7ecsd.mjs → custom-session-DN_-pfi_.mjs} +2 -2
  40. package/dist/db/index.d.mts +5 -5
  41. package/dist/db/index.mjs +9 -8
  42. package/dist/{db-BrstmDhc.mjs → db-7vHnL1XA.mjs} +15 -9
  43. package/dist/{device-authorization-V4s3h4Mj.mjs → device-authorization-BKnNhlsz.mjs} +4 -4
  44. package/dist/{dialect-CeddeGHf.mjs → dialect-HsWUfpYY.mjs} +2 -2
  45. package/dist/{email-otp-BtDHSw14.mjs → email-otp-Dw0DypjQ.mjs} +7 -6
  46. package/dist/{generic-oauth-CL5X27ZI.mjs → generic-oauth-DFj27JY8.mjs} +4 -4
  47. package/dist/{has-permission-BpAr7uCn.mjs → has-permission-Bvg8de8g.mjs} +1 -1
  48. package/dist/{haveibeenpwned-cMpJvmzI.mjs → haveibeenpwned-CzNda7Tn.mjs} +28 -15
  49. package/dist/{client-CNY0tn9g.d.mts → index-BAVzFqII.d.mts} +21 -21
  50. package/dist/{index-DaBcikv9.d.mts → index-BNDRYfTF.d.mts} +2 -2
  51. package/dist/{index-Cxi7TbLE.d.mts → index-BNhJglHC.d.mts} +122 -122
  52. package/dist/{index-BYMI9r_d.d.mts → index-Blmhq6eA.d.mts} +4 -4
  53. package/dist/{index-BHoQlf7a.d.mts → index-CKnPAS5n.d.mts} +178 -178
  54. package/dist/{index-34ONrP8l.d.mts → index-COGe8UJx.d.mts} +11 -11
  55. package/dist/{index-Buhn3hkR.d.mts → index-CP3FNbOZ.d.mts} +8 -8
  56. package/dist/{index-D_k662QG.d.mts → index-CUknVRZp.d.mts} +14 -14
  57. package/dist/{index-DKNNV1kb.d.mts → index-CaqpCfE5.d.mts} +8 -8
  58. package/dist/{index-BBm8nQ9Q.d.mts → index-CgeC2eGC.d.mts} +2 -2
  59. package/dist/{index-DR0xXno9.d.mts → index-CsxtcAO0.d.mts} +1 -1
  60. package/dist/{index-CuFzhoS6.d.mts → index-Cv9iMevV.d.mts} +10 -10
  61. package/dist/{index-C7fQuk-V.d.mts → index-CxlWnL9c.d.mts} +1 -1
  62. package/dist/{index-zjjNBRY2.d.mts → index-DG-X1PK5.d.mts} +6 -6
  63. package/dist/index-DRM35ir1.d.mts +3769 -0
  64. package/dist/{index-BqhKCbPH.d.mts → index-DS-R7st3.d.mts} +6 -6
  65. package/dist/{index-C-u1h_WX.d.mts → index-DXVU0HGr.d.mts} +5 -5
  66. package/dist/{index-DoXZYQpq.d.mts → index-Db8jqUq2.d.mts} +10 -10
  67. package/dist/{index-65G5U5DB-DSdjzreF.d.mts → index-Df0KhQRf-BEa5tdwJ.d.mts} +3 -2
  68. package/dist/{index-B-XKqFvY.d.mts → index-Df4SvZaE.d.mts} +11 -4
  69. package/dist/{index-G6V0Z_Mn.d.mts → index-DyH_CgmX.d.mts} +10 -10
  70. package/dist/{admin-DtfO1PLg.d.mts → index-EABwA_BH.d.mts} +36 -36
  71. package/dist/{index-z0KSvE5i.d.mts → index-QmocqGM-.d.mts} +1 -1
  72. package/dist/{index-DlaMq1nb.d.mts → index-mxEUX2Gs.d.mts} +14 -14
  73. package/dist/{client-BOX93C3d.d.mts → index-xoYsoOiR.d.mts} +52 -52
  74. package/dist/{index-B3n8e37d.d.mts → index-zBdYQGaS.d.mts} +7 -7
  75. package/dist/index.d.mts +5 -5
  76. package/dist/index.mjs +16 -15
  77. package/dist/integrations/next-js.mjs +2 -2
  78. package/dist/integrations/node.d.mts +5 -5
  79. package/dist/integrations/react-start.d.mts +4 -4
  80. package/dist/integrations/react-start.mjs +2 -2
  81. package/dist/{jwt-lHV4QHpD.mjs → jwt-DBN2mu0r.mjs} +4 -4
  82. package/dist/{kysely-adapter-DpzYO8Yf.mjs → kysely-adapter-Bkm1liPW.mjs} +1 -1
  83. package/dist/{magic-link-Bk-ueorR.mjs → magic-link-D9Em1aOR.mjs} +3 -3
  84. package/dist/{multi-session-DRrLKrg9.mjs → multi-session-Dno_8DxC.mjs} +5 -5
  85. package/dist/{oauth-proxy-D1sWh9B_.mjs → oauth-proxy-DW-zt8wv.mjs} +2 -2
  86. package/dist/oauth2/index.d.mts +5 -5
  87. package/dist/oauth2/index.mjs +12 -11
  88. package/dist/{one-tap-DMswkTEc.mjs → one-tap-CodeyQb8.mjs} +2 -2
  89. package/dist/{organization-BArHO_5v.mjs → organization-CkTKs7bx.mjs} +9 -9
  90. package/dist/{passkey-CcD4CnhM.mjs → passkey-JNQTz5a0.mjs} +5 -5
  91. package/dist/{phone-number-rHDIlh-2.mjs → phone-number-Dqz8aeyF.mjs} +4 -4
  92. package/dist/plugins/access/index.d.mts +2 -2
  93. package/dist/plugins/access/index.mjs +1 -1
  94. package/dist/plugins/admin/access/index.d.mts +2 -2
  95. package/dist/plugins/admin/access/index.mjs +2 -2
  96. package/dist/plugins/admin/index.d.mts +7 -8
  97. package/dist/plugins/admin/index.mjs +17 -16
  98. package/dist/plugins/anonymous/index.d.mts +6 -6
  99. package/dist/plugins/anonymous/index.mjs +13 -12
  100. package/dist/plugins/audit-log/client.d.mts +30 -0
  101. package/dist/plugins/audit-log/client.mjs +3 -0
  102. package/dist/plugins/audit-log/index.d.mts +29 -0
  103. package/dist/plugins/audit-log/index.mjs +20 -0
  104. package/dist/plugins/bearer/index.d.mts +1 -1
  105. package/dist/plugins/bearer/index.mjs +3 -3
  106. package/dist/plugins/captcha/index.d.mts +1 -1
  107. package/dist/plugins/captcha/index.mjs +1 -1
  108. package/dist/plugins/custom-session/index.d.mts +6 -6
  109. package/dist/plugins/custom-session/index.mjs +14 -13
  110. package/dist/plugins/device-authorization/index.d.mts +3 -3
  111. package/dist/plugins/device-authorization/index.mjs +13 -12
  112. package/dist/plugins/email-otp/index.d.mts +2 -2
  113. package/dist/plugins/email-otp/index.mjs +14 -13
  114. package/dist/plugins/generic-oauth/index.d.mts +6 -6
  115. package/dist/plugins/generic-oauth/index.mjs +13 -12
  116. package/dist/plugins/haveibeenpwned/index.d.mts +2 -2
  117. package/dist/plugins/haveibeenpwned/index.mjs +14 -13
  118. package/dist/plugins/index.d.mts +29 -139
  119. package/dist/plugins/index.mjs +47 -42
  120. package/dist/plugins/jwt/index.d.mts +6 -6
  121. package/dist/plugins/jwt/index.mjs +13 -12
  122. package/dist/plugins/magic-link/index.d.mts +1 -1
  123. package/dist/plugins/magic-link/index.mjs +13 -12
  124. package/dist/plugins/multi-session/index.d.mts +2 -2
  125. package/dist/plugins/multi-session/index.mjs +13 -12
  126. package/dist/plugins/oauth-proxy/index.d.mts +1 -1
  127. package/dist/plugins/oauth-proxy/index.mjs +13 -12
  128. package/dist/plugins/one-tap/index.d.mts +1 -1
  129. package/dist/plugins/one-tap/index.mjs +13 -12
  130. package/dist/plugins/one-time-token/index.d.mts +6 -6
  131. package/dist/plugins/one-time-token/index.mjs +46 -41
  132. package/dist/plugins/organization/access/index.d.mts +3 -3
  133. package/dist/plugins/organization/access/index.mjs +2 -2
  134. package/dist/plugins/organization/index.d.mts +8 -8
  135. package/dist/plugins/organization/index.mjs +17 -16
  136. package/dist/plugins/passkey/index.d.mts +6 -6
  137. package/dist/plugins/passkey/index.mjs +13 -12
  138. package/dist/plugins/phone-number/index.d.mts +6 -6
  139. package/dist/plugins/phone-number/index.mjs +13 -12
  140. package/dist/plugins/sentinel/client.d.mts +30 -0
  141. package/dist/plugins/sentinel/client.mjs +5 -0
  142. package/dist/plugins/sentinel/index.d.mts +29 -0
  143. package/dist/plugins/sentinel/index.mjs +22 -0
  144. package/dist/plugins/two-factor/index.d.mts +6 -6
  145. package/dist/plugins/two-factor/index.mjs +15 -14
  146. package/dist/plugins/username/index.d.mts +3 -3
  147. package/dist/plugins/username/index.mjs +13 -12
  148. package/dist/{plugins-hFZT3hmK.d.mts → plugins-Dy_FrD4Y.d.mts} +1 -1
  149. package/dist/{plugins-3jfNste3.mjs → plugins-yF8CFUDR.mjs} +11 -8
  150. package/dist/pow-OK01yPG3.mjs +61 -0
  151. package/dist/{proxy-CL9PZXJA.mjs → proxy-C_KXfOhk.mjs} +1 -1
  152. package/dist/random-32E3cU5o.mjs +7 -0
  153. package/dist/registry-CqG_3Qnx.mjs +194 -0
  154. package/dist/sentinel-C-D1IHJo.mjs +1395 -0
  155. package/dist/{session-Dgp133Yt.mjs → session-BB3oqApE.mjs} +2 -2
  156. package/dist/src/adapters/memory-adapter/memory-adapter.d.ts +1 -1
  157. package/dist/src/adapters/prisma-adapter/test/auth.d.ts +1 -1
  158. package/dist/src/adapters/tests/auth-flow.d.ts +3 -3
  159. package/dist/src/adapters/tests/normal.d.ts +1 -1
  160. package/dist/src/adapters/tests/number-id.d.ts +3 -3
  161. package/dist/src/adapters/tests/performance.d.ts +3 -3
  162. package/dist/src/adapters/tests/transactions.d.ts +3 -3
  163. package/dist/src/api/index.d.ts +8 -8
  164. package/dist/src/client/plugins/index.d.ts +2 -0
  165. package/dist/src/plugins/admin/admin.d.ts +2 -2
  166. package/dist/src/plugins/api-key/index.d.ts +2 -2
  167. package/dist/src/plugins/audit-log/client.d.ts +10 -0
  168. package/dist/src/plugins/audit-log/events.d.ts +90 -0
  169. package/dist/src/plugins/audit-log/index.d.ts +614 -0
  170. package/dist/src/plugins/audit-log/registry.d.ts +13 -0
  171. package/dist/src/plugins/audit-log/remote.d.ts +34 -0
  172. package/dist/src/plugins/audit-log/schema.d.ts +50 -0
  173. package/dist/src/plugins/audit-log/types.d.ts +117 -0
  174. package/dist/src/plugins/email-otp/index.d.ts +1 -1
  175. package/dist/src/plugins/haveibeenpwned/index.d.ts +6 -0
  176. package/dist/src/plugins/index.d.ts +2 -0
  177. package/dist/src/plugins/multi-session/index.d.ts +8 -8
  178. package/dist/src/plugins/organization/organization.d.ts +5 -5
  179. package/dist/src/plugins/organization/routes/crud-access-control.d.ts +8 -8
  180. package/dist/src/plugins/organization/routes/crud-invites.d.ts +46 -46
  181. package/dist/src/plugins/organization/routes/crud-members.d.ts +40 -40
  182. package/dist/src/plugins/organization/routes/crud-org.d.ts +36 -36
  183. package/dist/src/plugins/organization/routes/crud-team.d.ts +50 -50
  184. package/dist/src/plugins/sentinel/actions.d.ts +64 -0
  185. package/dist/src/plugins/sentinel/client.d.ts +67 -0
  186. package/dist/src/plugins/sentinel/email.d.ts +22 -0
  187. package/dist/src/plugins/sentinel/geo.d.ts +22 -0
  188. package/dist/src/plugins/sentinel/index.d.ts +326 -0
  189. package/dist/src/plugins/sentinel/intel.d.ts +45 -0
  190. package/dist/src/plugins/sentinel/pow.d.ts +21 -0
  191. package/dist/src/plugins/sentinel/schema.d.ts +110 -0
  192. package/dist/src/plugins/sentinel/store.d.ts +37 -0
  193. package/dist/src/plugins/sentinel/types.d.ts +412 -0
  194. package/dist/src/test-utils/memory-secondary-storage.d.ts +16 -0
  195. package/dist/src/test-utils/password.d.ts +12 -0
  196. package/dist/src/test-utils/test-instance.d.ts +25 -25
  197. package/dist/test-utils/index.d.mts +1048 -1048
  198. package/dist/test-utils/index.mjs +53 -48
  199. package/dist/{two-factor-ClUXxom2.mjs → two-factor-CDVjxx4f.mjs} +6 -5
  200. package/dist/types/index.d.mts +5 -5
  201. package/dist/types/index.mjs +1 -1
  202. package/dist/{username-DiGklOGl.mjs → username-BHNvcvsY.mjs} +3 -3
  203. package/dist/{utils-SOMB4Px5.mjs → utils-B03WRaGi.mjs} +2 -1
  204. package/package.json +36 -3
  205. package/dist/index-CM-CFWwr.d.mts +0 -1919
  206. package/dist/index-DB7t8whN.d.mts +0 -1
  207. /package/dist/{access-BO2g7QVe.mjs → access-BM6jSA5j.mjs} +0 -0
  208. /package/dist/{bun-sqlite-dialect-CeNvMaZz.mjs → bun-sqlite-dialect-CDGusFqF.mjs} +0 -0
  209. /package/dist/{captcha-BqaMxlKC.mjs → captcha-DGP9lCRe.mjs} +0 -0
  210. /package/dist/{client-CygJhqeB.mjs → client-BuveH3MN.mjs} +0 -0
  211. /package/dist/{client-WiN43tAS.mjs → client-cBiytuOL.mjs} +0 -0
  212. /package/dist/{date-Cx2yCiC4.mjs → date-CMr04reD.mjs} +0 -0
  213. /package/dist/{esm-C-QicDNz.mjs → esm-BbvI87Z2.mjs} +0 -0
  214. /package/dist/{get-tables-BQP7YW9c.mjs → get-tables-CKvSyDST.mjs} +0 -0
  215. /package/dist/{helper-tmxW3BHj.d.mts → helper-BgOIGHsu.d.mts} +0 -0
  216. /package/dist/{misc-beA1w3XV.mjs → misc-fKH4d5XQ.mjs} +0 -0
  217. /package/dist/{node-sqlite-dialect-BcKxBQnm.mjs → node-sqlite-dialect-CIOjcg31.mjs} +0 -0
  218. /package/dist/{parser-DcrIEuXE.mjs → parser-D7EkhAjZ.mjs} +0 -0
  219. /package/dist/{password-sVC4nePO.mjs → password-5CdcAVaH.mjs} +0 -0
  220. /package/dist/{permission-DLYUF3cW.mjs → permission-CDDWgA_O.mjs} +0 -0
  221. /package/dist/{plugin-helper-4L-lzsjZ.mjs → plugin-helper-RJJBTOba.mjs} +0 -0
  222. /package/dist/{promise-8rrEHRXd.mjs → promise-D7Oo6_cY.mjs} +0 -0
  223. /package/dist/{types-Bjn15Uy6.mjs → types-DCPpFKUB.mjs} +0 -0
  224. /package/dist/{types-B1OL7hyf.d.mts → types-DNQ9XQrB.d.mts} +0 -0
@@ -1,1919 +0,0 @@
1
- import { n as DBPrimitive } from "./index-65G5U5DB-DSdjzreF.mjs";
2
- import { t as InferOptionSchema } from "./plugins-hFZT3hmK.mjs";
3
- import { o as Statements } from "./index-C7fQuk-V.mjs";
4
- import * as _gatwech_core36 from "@gatwech/core";
5
- import { GenericEndpointContext, HookEndpointContext } from "@gatwech/core";
6
- import * as better_call252 from "better-call";
7
- import * as zod381 from "zod";
8
- import * as _gatwech_core_db14 from "@gatwech/core/db";
9
- import * as zod_v4_core51 from "zod/v4/core";
10
-
11
- //#region src/plugins/api-key/schema.d.ts
12
- declare const apiKeySchema: ({
13
- timeWindow,
14
- rateLimitMax
15
- }: {
16
- timeWindow: number;
17
- rateLimitMax: number;
18
- }) => {
19
- apikey: {
20
- fields: {
21
- /**
22
- * The name of the key.
23
- */
24
- name: {
25
- type: "string";
26
- required: false;
27
- input: false;
28
- };
29
- /**
30
- * Shows the first few characters of the API key
31
- * This allows you to show those few characters in the UI to make it easier for users to identify the API key.
32
- */
33
- start: {
34
- type: "string";
35
- required: false;
36
- input: false;
37
- };
38
- /**
39
- * The prefix of the key.
40
- */
41
- prefix: {
42
- type: "string";
43
- required: false;
44
- input: false;
45
- };
46
- /**
47
- * The hashed key value.
48
- */
49
- key: {
50
- type: "string";
51
- required: true;
52
- input: false;
53
- };
54
- /**
55
- * The user id of the user who created the key.
56
- */
57
- userId: {
58
- type: "string";
59
- references: {
60
- model: string;
61
- field: string;
62
- onDelete: "cascade";
63
- };
64
- required: true;
65
- input: false;
66
- };
67
- /**
68
- * The interval to refill the key in milliseconds.
69
- */
70
- refillInterval: {
71
- type: "number";
72
- required: false;
73
- input: false;
74
- };
75
- /**
76
- * The amount to refill the remaining count of the key.
77
- */
78
- refillAmount: {
79
- type: "number";
80
- required: false;
81
- input: false;
82
- };
83
- /**
84
- * The date and time when the key was last refilled.
85
- */
86
- lastRefillAt: {
87
- type: "date";
88
- required: false;
89
- input: false;
90
- };
91
- /**
92
- * Whether the key is enabled.
93
- */
94
- enabled: {
95
- type: "boolean";
96
- required: false;
97
- input: false;
98
- defaultValue: true;
99
- };
100
- /**
101
- * Whether the key has rate limiting enabled.
102
- */
103
- rateLimitEnabled: {
104
- type: "boolean";
105
- required: false;
106
- input: false;
107
- defaultValue: true;
108
- };
109
- /**
110
- * The time window in milliseconds for the rate limit.
111
- */
112
- rateLimitTimeWindow: {
113
- type: "number";
114
- required: false;
115
- input: false;
116
- defaultValue: number;
117
- };
118
- /**
119
- * The maximum number of requests allowed within the `rateLimitTimeWindow`.
120
- */
121
- rateLimitMax: {
122
- type: "number";
123
- required: false;
124
- input: false;
125
- defaultValue: number;
126
- };
127
- /**
128
- * The number of requests made within the rate limit time window
129
- */
130
- requestCount: {
131
- type: "number";
132
- required: false;
133
- input: false;
134
- defaultValue: number;
135
- };
136
- /**
137
- * The remaining number of requests before the key is revoked.
138
- *
139
- * If this is null, then the key is not revoked.
140
- *
141
- * If `refillInterval` & `refillAmount` are provided, than this will refill accordingly.
142
- */
143
- remaining: {
144
- type: "number";
145
- required: false;
146
- input: false;
147
- };
148
- /**
149
- * The date and time of the last request made to the key.
150
- */
151
- lastRequest: {
152
- type: "date";
153
- required: false;
154
- input: false;
155
- };
156
- /**
157
- * The date and time when the key will expire.
158
- */
159
- expiresAt: {
160
- type: "date";
161
- required: false;
162
- input: false;
163
- };
164
- /**
165
- * The date and time when the key was created.
166
- */
167
- createdAt: {
168
- type: "date";
169
- required: true;
170
- input: false;
171
- };
172
- /**
173
- * The date and time when the key was last updated.
174
- */
175
- updatedAt: {
176
- type: "date";
177
- required: true;
178
- input: false;
179
- };
180
- /**
181
- * The permissions of the key.
182
- */
183
- permissions: {
184
- type: "string";
185
- required: false;
186
- input: false;
187
- };
188
- /**
189
- * Any additional metadata you want to store with the key.
190
- */
191
- metadata: {
192
- type: "string";
193
- required: false;
194
- input: true;
195
- transform: {
196
- input(value: _gatwech_core_db14.DBPrimitive): string;
197
- output(value: _gatwech_core_db14.DBPrimitive): any;
198
- };
199
- };
200
- };
201
- };
202
- };
203
- //#endregion
204
- //#region src/plugins/api-key/types.d.ts
205
- interface ApiKeyOptions {
206
- /**
207
- * The header name to check for API key
208
- * @default "x-api-key"
209
- */
210
- apiKeyHeaders?: (string | string[]) | undefined;
211
- /**
212
- * Disable hashing of the API key.
213
- *
214
- * ⚠️ Security Warning: It's strongly recommended to not disable hashing.
215
- * Storing API keys in plaintext makes them vulnerable to database breaches, potentially exposing all your users' API keys.
216
- *
217
- * @default false
218
- */
219
- disableKeyHashing?: boolean | undefined;
220
- /**
221
- * The function to get the API key from the context
222
- */
223
- customAPIKeyGetter?: ((ctx: HookEndpointContext) => string | null) | undefined;
224
- /**
225
- * A custom function to validate the API key
226
- */
227
- customAPIKeyValidator?: ((options: {
228
- ctx: GenericEndpointContext;
229
- key: string;
230
- }) => boolean | Promise<boolean>) | undefined;
231
- /**
232
- * custom key generation function
233
- */
234
- customKeyGenerator?: (options: {
235
- /**
236
- * The length of the API key to generate
237
- */
238
- length: number;
239
- /**
240
- * The prefix of the API key to generate
241
- */
242
- prefix: string | undefined;
243
- }) => string | Promise<string>;
244
- /**
245
- * The configuration for storing the starting characters of the API key in the database.
246
- *
247
- * Useful if you want to display the starting characters of an API key in the UI.
248
- */
249
- startingCharactersConfig?: {
250
- /**
251
- * Whether to store the starting characters in the database. If false, we will set `start` to `null`.
252
- *
253
- * @default true
254
- */
255
- shouldStore?: boolean;
256
- /**
257
- * The length of the starting characters to store in the database.
258
- *
259
- * This includes the prefix length.
260
- *
261
- * @default 6
262
- */
263
- charactersLength?: number;
264
- } | undefined;
265
- /**
266
- * The length of the API key. Longer is better. Default is 64. (Doesn't include the prefix length)
267
- * @default 64
268
- */
269
- defaultKeyLength?: number | undefined;
270
- /**
271
- * The prefix of the API key.
272
- *
273
- * Note: We recommend you append an underscore to the prefix to make the prefix more identifiable. (eg `hello_`)
274
- */
275
- defaultPrefix?: string | undefined;
276
- /**
277
- * The maximum length of the prefix.
278
- *
279
- * @default 32
280
- */
281
- maximumPrefixLength?: number | undefined;
282
- /**
283
- * Whether to require a name for the API key.
284
- *
285
- * @default false
286
- */
287
- requireName?: boolean | undefined;
288
- /**
289
- * The minimum length of the prefix.
290
- *
291
- * @default 1
292
- */
293
- minimumPrefixLength?: number | undefined;
294
- /**
295
- * The maximum length of the name.
296
- *
297
- * @default 32
298
- */
299
- maximumNameLength?: number | undefined;
300
- /**
301
- * The minimum length of the name.
302
- *
303
- * @default 1
304
- */
305
- minimumNameLength?: number | undefined;
306
- /**
307
- * Whether to enable metadata for an API key.
308
- *
309
- * @default false
310
- */
311
- enableMetadata?: boolean | undefined;
312
- /**
313
- * Customize the key expiration.
314
- */
315
- keyExpiration?: {
316
- /**
317
- * The default expires time in milliseconds.
318
- *
319
- * If `null`, then there will be no expiration time.
320
- *
321
- * @default null
322
- */
323
- defaultExpiresIn?: number | null;
324
- /**
325
- * Whether to disable the expires time passed from the client.
326
- *
327
- * If `true`, the expires time will be based on the default values.
328
- *
329
- * @default false
330
- */
331
- disableCustomExpiresTime?: boolean;
332
- /**
333
- * The minimum expiresIn value allowed to be set from the client. in days.
334
- *
335
- * @default 1
336
- */
337
- minExpiresIn?: number;
338
- /**
339
- * The maximum expiresIn value allowed to be set from the client. in days.
340
- *
341
- * @default 365
342
- */
343
- maxExpiresIn?: number;
344
- } | undefined;
345
- /**
346
- * Default rate limiting options.
347
- */
348
- rateLimit?: {
349
- /**
350
- * Whether to enable rate limiting.
351
- *
352
- * @default true
353
- */
354
- enabled?: boolean;
355
- /**
356
- * The duration in milliseconds where each request is counted.
357
- *
358
- * Once the `maxRequests` is reached, the request will be rejected until the `timeWindow` has passed, at which point the `timeWindow` will be reset.
359
- *
360
- * @default 1000 * 60 * 60 * 24 // 1 day
361
- */
362
- timeWindow?: number;
363
- /**
364
- * Maximum amount of requests allowed within a window
365
- *
366
- * Once the `maxRequests` is reached, the request will be rejected until the `timeWindow` has passed, at which point the `timeWindow` will be reset.
367
- *
368
- * @default 10 // 10 requests per day
369
- */
370
- maxRequests?: number;
371
- } | undefined;
372
- /**
373
- * custom schema for the API key plugin
374
- */
375
- schema?: InferOptionSchema<ReturnType<typeof apiKeySchema>> | undefined;
376
- /**
377
- * An API Key can represent a valid session, so we automatically mock a session for the user if we find a valid API key in the request headers.
378
- *
379
- * ⚠︎ This is not recommended for production use, as it can lead to security issues.
380
- * @default false
381
- */
382
- enableSessionForAPIKeys?: boolean | undefined;
383
- /**
384
- * Permissions for the API key.
385
- */
386
- permissions?: {
387
- /**
388
- * The default permissions for the API key.
389
- */
390
- defaultPermissions?: Statements | ((userId: string, ctx: GenericEndpointContext) => Statements | Promise<Statements>);
391
- } | undefined;
392
- }
393
- type ApiKey = {
394
- /**
395
- * ID
396
- */
397
- id: string;
398
- /**
399
- * The name of the key
400
- */
401
- name: string | null;
402
- /**
403
- * Shows the first few characters of the API key, including the prefix.
404
- * This allows you to show those few characters in the UI to make it easier for users to identify the API key.
405
- */
406
- start: string | null;
407
- /**
408
- * The API Key prefix. Stored as plain text.
409
- */
410
- prefix: string | null;
411
- /**
412
- * The hashed API key value
413
- */
414
- key: string;
415
- /**
416
- * The owner of the user id
417
- */
418
- userId: string;
419
- /**
420
- * The interval in milliseconds between refills of the `remaining` count
421
- *
422
- * @example 3600000 // refill every hour (3600000ms = 1h)
423
- */
424
- refillInterval: number | null;
425
- /**
426
- * The amount to refill
427
- */
428
- refillAmount: number | null;
429
- /**
430
- * The last refill date
431
- */
432
- lastRefillAt: Date | null;
433
- /**
434
- * Sets if key is enabled or disabled
435
- *
436
- * @default true
437
- */
438
- enabled: boolean;
439
- /**
440
- * Whether the key has rate limiting enabled.
441
- */
442
- rateLimitEnabled: boolean;
443
- /**
444
- * The duration in milliseconds
445
- */
446
- rateLimitTimeWindow: number | null;
447
- /**
448
- * Maximum amount of requests allowed within a window
449
- */
450
- rateLimitMax: number | null;
451
- /**
452
- * The number of requests made within the rate limit time window
453
- */
454
- requestCount: number;
455
- /**
456
- * Remaining requests (every time API key is used this should updated and should be updated on refill as well)
457
- */
458
- remaining: number | null;
459
- /**
460
- * When last request occurred
461
- */
462
- lastRequest: Date | null;
463
- /**
464
- * Expiry date of a key
465
- */
466
- expiresAt: Date | null;
467
- /**
468
- * created at
469
- */
470
- createdAt: Date;
471
- /**
472
- * updated at
473
- */
474
- updatedAt: Date;
475
- /**
476
- * Extra metadata about the apiKey
477
- */
478
- metadata: Record<string, any> | null;
479
- /**
480
- * Permissions for the API key
481
- */
482
- permissions?: ({
483
- [key: string]: string[];
484
- } | null) | undefined;
485
- };
486
- //#endregion
487
- //#region src/plugins/api-key/index.d.ts
488
- declare const defaultKeyHasher: (key: string) => Promise<string>;
489
- declare const ERROR_CODES: {
490
- readonly INVALID_METADATA_TYPE: "metadata must be an object or undefined";
491
- readonly REFILL_AMOUNT_AND_INTERVAL_REQUIRED: "refillAmount is required when refillInterval is provided";
492
- readonly REFILL_INTERVAL_AND_AMOUNT_REQUIRED: "refillInterval is required when refillAmount is provided";
493
- readonly USER_BANNED: "User is banned";
494
- readonly UNAUTHORIZED_SESSION: "Unauthorized or invalid session";
495
- readonly KEY_NOT_FOUND: "API Key not found";
496
- readonly KEY_DISABLED: "API Key is disabled";
497
- readonly KEY_EXPIRED: "API Key has expired";
498
- readonly USAGE_EXCEEDED: "API Key has reached its usage limit";
499
- readonly KEY_NOT_RECOVERABLE: "API Key is not recoverable";
500
- readonly EXPIRES_IN_IS_TOO_SMALL: "The expiresIn is smaller than the predefined minimum value.";
501
- readonly EXPIRES_IN_IS_TOO_LARGE: "The expiresIn is larger than the predefined maximum value.";
502
- readonly INVALID_REMAINING: "The remaining count is either too large or too small.";
503
- readonly INVALID_PREFIX_LENGTH: "The prefix length is either too large or too small.";
504
- readonly INVALID_NAME_LENGTH: "The name length is either too large or too small.";
505
- readonly METADATA_DISABLED: "Metadata is disabled.";
506
- readonly RATE_LIMIT_EXCEEDED: "Rate limit exceeded.";
507
- readonly NO_VALUES_TO_UPDATE: "No values to update.";
508
- readonly KEY_DISABLED_EXPIRATION: "Custom key expiration values are disabled.";
509
- readonly INVALID_API_KEY: "Invalid API key.";
510
- readonly INVALID_USER_ID_FROM_API_KEY: "The user id from the API key is invalid.";
511
- readonly INVALID_API_KEY_GETTER_RETURN_TYPE: "API Key getter returned an invalid key type. Expected string.";
512
- readonly SERVER_ONLY_PROPERTY: "The property you're trying to set can only be set from the server auth instance only.";
513
- readonly FAILED_TO_UPDATE_API_KEY: "Failed to update API key";
514
- readonly NAME_REQUIRED: "API Key name is required.";
515
- };
516
- declare const API_KEY_TABLE_NAME = "apikey";
517
- declare const apiKey: (options?: ApiKeyOptions | undefined) => {
518
- id: "api-key";
519
- $ERROR_CODES: {
520
- readonly INVALID_METADATA_TYPE: "metadata must be an object or undefined";
521
- readonly REFILL_AMOUNT_AND_INTERVAL_REQUIRED: "refillAmount is required when refillInterval is provided";
522
- readonly REFILL_INTERVAL_AND_AMOUNT_REQUIRED: "refillInterval is required when refillAmount is provided";
523
- readonly USER_BANNED: "User is banned";
524
- readonly UNAUTHORIZED_SESSION: "Unauthorized or invalid session";
525
- readonly KEY_NOT_FOUND: "API Key not found";
526
- readonly KEY_DISABLED: "API Key is disabled";
527
- readonly KEY_EXPIRED: "API Key has expired";
528
- readonly USAGE_EXCEEDED: "API Key has reached its usage limit";
529
- readonly KEY_NOT_RECOVERABLE: "API Key is not recoverable";
530
- readonly EXPIRES_IN_IS_TOO_SMALL: "The expiresIn is smaller than the predefined minimum value.";
531
- readonly EXPIRES_IN_IS_TOO_LARGE: "The expiresIn is larger than the predefined maximum value.";
532
- readonly INVALID_REMAINING: "The remaining count is either too large or too small.";
533
- readonly INVALID_PREFIX_LENGTH: "The prefix length is either too large or too small.";
534
- readonly INVALID_NAME_LENGTH: "The name length is either too large or too small.";
535
- readonly METADATA_DISABLED: "Metadata is disabled.";
536
- readonly RATE_LIMIT_EXCEEDED: "Rate limit exceeded.";
537
- readonly NO_VALUES_TO_UPDATE: "No values to update.";
538
- readonly KEY_DISABLED_EXPIRATION: "Custom key expiration values are disabled.";
539
- readonly INVALID_API_KEY: "Invalid API key.";
540
- readonly INVALID_USER_ID_FROM_API_KEY: "The user id from the API key is invalid.";
541
- readonly INVALID_API_KEY_GETTER_RETURN_TYPE: "API Key getter returned an invalid key type. Expected string.";
542
- readonly SERVER_ONLY_PROPERTY: "The property you're trying to set can only be set from the server auth instance only.";
543
- readonly FAILED_TO_UPDATE_API_KEY: "Failed to update API key";
544
- readonly NAME_REQUIRED: "API Key name is required.";
545
- };
546
- hooks: {
547
- before: {
548
- matcher: (ctx: _gatwech_core36.HookEndpointContext) => boolean;
549
- handler: (inputContext: better_call252.MiddlewareInputContext<better_call252.MiddlewareOptions>) => Promise<{
550
- user: {
551
- id: string;
552
- createdAt: Date;
553
- updatedAt: Date;
554
- email: string;
555
- emailVerified: boolean;
556
- name: string;
557
- image?: string | null | undefined;
558
- };
559
- session: {
560
- id: string;
561
- token: string;
562
- userId: string;
563
- userAgent: string | null;
564
- ipAddress: string | null;
565
- createdAt: Date;
566
- updatedAt: Date;
567
- expiresAt: Date;
568
- };
569
- } | {
570
- context: better_call252.MiddlewareContext<better_call252.MiddlewareOptions, _gatwech_core36.AuthContext<_gatwech_core36.PayvoAuthOptions> & {
571
- returned?: unknown | undefined;
572
- responseHeaders?: Headers | undefined;
573
- }>;
574
- }>;
575
- }[];
576
- };
577
- endpoints: {
578
- /**
579
- * ### Endpoint
580
- *
581
- * POST `/api-key/create`
582
- *
583
- * ### API Methods
584
- *
585
- * **server:**
586
- * `auth.api.createApiKey`
587
- *
588
- * **client:**
589
- * `authClient.apiKey.create`
590
- *
591
- * @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/api-key#api-method-api-key-create)
592
- */
593
- createApiKey: {
594
- <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
595
- body: {
596
- name?: string | undefined;
597
- expiresIn?: number | null | undefined;
598
- userId?: unknown;
599
- prefix?: string | undefined;
600
- remaining?: number | null | undefined;
601
- metadata?: any;
602
- refillAmount?: number | undefined;
603
- refillInterval?: number | undefined;
604
- rateLimitTimeWindow?: number | undefined;
605
- rateLimitMax?: number | undefined;
606
- rateLimitEnabled?: boolean | undefined;
607
- permissions?: Record<string, string[]> | undefined;
608
- };
609
- } & {
610
- method?: "POST" | undefined;
611
- } & {
612
- query?: Record<string, any> | undefined;
613
- } & {
614
- params?: Record<string, any>;
615
- } & {
616
- request?: Request;
617
- } & {
618
- headers?: HeadersInit;
619
- } & {
620
- asResponse?: boolean;
621
- returnHeaders?: boolean;
622
- use?: better_call252.Middleware[];
623
- path?: string;
624
- } & {
625
- asResponse?: AsResponse | undefined;
626
- returnHeaders?: ReturnHeaders | undefined;
627
- }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
628
- headers: Headers;
629
- response: {
630
- key: string;
631
- metadata: any;
632
- permissions: any;
633
- id: string;
634
- name: string | null;
635
- start: string | null;
636
- prefix: string | null;
637
- userId: string;
638
- refillInterval: number | null;
639
- refillAmount: number | null;
640
- lastRefillAt: Date | null;
641
- enabled: boolean;
642
- rateLimitEnabled: boolean;
643
- rateLimitTimeWindow: number | null;
644
- rateLimitMax: number | null;
645
- requestCount: number;
646
- remaining: number | null;
647
- lastRequest: Date | null;
648
- expiresAt: Date | null;
649
- createdAt: Date;
650
- updatedAt: Date;
651
- };
652
- } : {
653
- key: string;
654
- metadata: any;
655
- permissions: any;
656
- id: string;
657
- name: string | null;
658
- start: string | null;
659
- prefix: string | null;
660
- userId: string;
661
- refillInterval: number | null;
662
- refillAmount: number | null;
663
- lastRefillAt: Date | null;
664
- enabled: boolean;
665
- rateLimitEnabled: boolean;
666
- rateLimitTimeWindow: number | null;
667
- rateLimitMax: number | null;
668
- requestCount: number;
669
- remaining: number | null;
670
- lastRequest: Date | null;
671
- expiresAt: Date | null;
672
- createdAt: Date;
673
- updatedAt: Date;
674
- }>;
675
- options: {
676
- method: "POST";
677
- body: zod381.ZodObject<{
678
- name: zod381.ZodOptional<zod381.ZodString>;
679
- expiresIn: zod381.ZodDefault<zod381.ZodNullable<zod381.ZodOptional<zod381.ZodNumber>>>;
680
- userId: zod381.ZodOptional<zod381.ZodCoercedString<unknown>>;
681
- prefix: zod381.ZodOptional<zod381.ZodString>;
682
- remaining: zod381.ZodDefault<zod381.ZodNullable<zod381.ZodOptional<zod381.ZodNumber>>>;
683
- metadata: zod381.ZodOptional<zod381.ZodAny>;
684
- refillAmount: zod381.ZodOptional<zod381.ZodNumber>;
685
- refillInterval: zod381.ZodOptional<zod381.ZodNumber>;
686
- rateLimitTimeWindow: zod381.ZodOptional<zod381.ZodNumber>;
687
- rateLimitMax: zod381.ZodOptional<zod381.ZodNumber>;
688
- rateLimitEnabled: zod381.ZodOptional<zod381.ZodBoolean>;
689
- permissions: zod381.ZodOptional<zod381.ZodRecord<zod381.ZodString, zod381.ZodArray<zod381.ZodString>>>;
690
- }, zod_v4_core51.$strip>;
691
- metadata: {
692
- openapi: {
693
- description: string;
694
- responses: {
695
- "200": {
696
- description: string;
697
- content: {
698
- "application/json": {
699
- schema: {
700
- type: "object";
701
- properties: {
702
- id: {
703
- type: string;
704
- description: string;
705
- };
706
- createdAt: {
707
- type: string;
708
- format: string;
709
- description: string;
710
- };
711
- updatedAt: {
712
- type: string;
713
- format: string;
714
- description: string;
715
- };
716
- name: {
717
- type: string;
718
- nullable: boolean;
719
- description: string;
720
- };
721
- prefix: {
722
- type: string;
723
- nullable: boolean;
724
- description: string;
725
- };
726
- start: {
727
- type: string;
728
- nullable: boolean;
729
- description: string;
730
- };
731
- key: {
732
- type: string;
733
- description: string;
734
- };
735
- enabled: {
736
- type: string;
737
- description: string;
738
- };
739
- expiresAt: {
740
- type: string;
741
- format: string;
742
- nullable: boolean;
743
- description: string;
744
- };
745
- userId: {
746
- type: string;
747
- description: string;
748
- };
749
- lastRefillAt: {
750
- type: string;
751
- format: string;
752
- nullable: boolean;
753
- description: string;
754
- };
755
- lastRequest: {
756
- type: string;
757
- format: string;
758
- nullable: boolean;
759
- description: string;
760
- };
761
- metadata: {
762
- type: string;
763
- nullable: boolean;
764
- additionalProperties: boolean;
765
- description: string;
766
- };
767
- rateLimitMax: {
768
- type: string;
769
- nullable: boolean;
770
- description: string;
771
- };
772
- rateLimitTimeWindow: {
773
- type: string;
774
- nullable: boolean;
775
- description: string;
776
- };
777
- remaining: {
778
- type: string;
779
- nullable: boolean;
780
- description: string;
781
- };
782
- refillAmount: {
783
- type: string;
784
- nullable: boolean;
785
- description: string;
786
- };
787
- refillInterval: {
788
- type: string;
789
- nullable: boolean;
790
- description: string;
791
- };
792
- rateLimitEnabled: {
793
- type: string;
794
- description: string;
795
- };
796
- requestCount: {
797
- type: string;
798
- description: string;
799
- };
800
- permissions: {
801
- type: string;
802
- nullable: boolean;
803
- additionalProperties: {
804
- type: string;
805
- items: {
806
- type: string;
807
- };
808
- };
809
- description: string;
810
- };
811
- };
812
- required: string[];
813
- };
814
- };
815
- };
816
- };
817
- };
818
- };
819
- };
820
- } & {
821
- use: any[];
822
- };
823
- path: "/api-key/create";
824
- };
825
- /**
826
- * ### Endpoint
827
- *
828
- * POST `/api-key/verify`
829
- *
830
- * ### API Methods
831
- *
832
- * **server:**
833
- * `auth.api.verifyApiKey`
834
- *
835
- * @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/api-key#api-method-api-key-verify)
836
- */
837
- verifyApiKey: {
838
- <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
839
- body: {
840
- key: string;
841
- permissions?: Record<string, string[]> | undefined;
842
- };
843
- } & {
844
- method?: "POST" | undefined;
845
- } & {
846
- query?: Record<string, any> | undefined;
847
- } & {
848
- params?: Record<string, any>;
849
- } & {
850
- request?: Request;
851
- } & {
852
- headers?: HeadersInit;
853
- } & {
854
- asResponse?: boolean;
855
- returnHeaders?: boolean;
856
- use?: better_call252.Middleware[];
857
- path?: string;
858
- } & {
859
- asResponse?: AsResponse | undefined;
860
- returnHeaders?: ReturnHeaders | undefined;
861
- }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
862
- headers: Headers;
863
- response: {
864
- valid: boolean;
865
- error: {
866
- message: string | undefined;
867
- code: string;
868
- };
869
- key: null;
870
- } | {
871
- valid: boolean;
872
- error: null;
873
- key: Omit<ApiKey, "key"> | null;
874
- };
875
- } : {
876
- valid: boolean;
877
- error: {
878
- message: string | undefined;
879
- code: string;
880
- };
881
- key: null;
882
- } | {
883
- valid: boolean;
884
- error: null;
885
- key: Omit<ApiKey, "key"> | null;
886
- }>;
887
- options: {
888
- method: "POST";
889
- body: zod381.ZodObject<{
890
- key: zod381.ZodString;
891
- permissions: zod381.ZodOptional<zod381.ZodRecord<zod381.ZodString, zod381.ZodArray<zod381.ZodString>>>;
892
- }, zod_v4_core51.$strip>;
893
- metadata: {
894
- SERVER_ONLY: true;
895
- };
896
- } & {
897
- use: any[];
898
- };
899
- path: "/api-key/verify";
900
- };
901
- /**
902
- * ### Endpoint
903
- *
904
- * GET `/api-key/get`
905
- *
906
- * ### API Methods
907
- *
908
- * **server:**
909
- * `auth.api.getApiKey`
910
- *
911
- * **client:**
912
- * `authClient.apiKey.get`
913
- *
914
- * @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/api-key#api-method-api-key-get)
915
- */
916
- getApiKey: {
917
- <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
918
- body?: undefined;
919
- } & {
920
- method?: "GET" | undefined;
921
- } & {
922
- query: {
923
- id: string;
924
- };
925
- } & {
926
- params?: Record<string, any>;
927
- } & {
928
- request?: Request;
929
- } & {
930
- headers?: HeadersInit;
931
- } & {
932
- asResponse?: boolean;
933
- returnHeaders?: boolean;
934
- use?: better_call252.Middleware[];
935
- path?: string;
936
- } & {
937
- asResponse?: AsResponse | undefined;
938
- returnHeaders?: ReturnHeaders | undefined;
939
- }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
940
- headers: Headers;
941
- response: {
942
- permissions: {
943
- [key: string]: string[];
944
- } | null;
945
- id: string;
946
- name: string | null;
947
- start: string | null;
948
- prefix: string | null;
949
- userId: string;
950
- refillInterval: number | null;
951
- refillAmount: number | null;
952
- lastRefillAt: Date | null;
953
- enabled: boolean;
954
- rateLimitEnabled: boolean;
955
- rateLimitTimeWindow: number | null;
956
- rateLimitMax: number | null;
957
- requestCount: number;
958
- remaining: number | null;
959
- lastRequest: Date | null;
960
- expiresAt: Date | null;
961
- createdAt: Date;
962
- updatedAt: Date;
963
- metadata: Record<string, any> | null;
964
- };
965
- } : {
966
- permissions: {
967
- [key: string]: string[];
968
- } | null;
969
- id: string;
970
- name: string | null;
971
- start: string | null;
972
- prefix: string | null;
973
- userId: string;
974
- refillInterval: number | null;
975
- refillAmount: number | null;
976
- lastRefillAt: Date | null;
977
- enabled: boolean;
978
- rateLimitEnabled: boolean;
979
- rateLimitTimeWindow: number | null;
980
- rateLimitMax: number | null;
981
- requestCount: number;
982
- remaining: number | null;
983
- lastRequest: Date | null;
984
- expiresAt: Date | null;
985
- createdAt: Date;
986
- updatedAt: Date;
987
- metadata: Record<string, any> | null;
988
- }>;
989
- options: {
990
- method: "GET";
991
- query: zod381.ZodObject<{
992
- id: zod381.ZodString;
993
- }, zod_v4_core51.$strip>;
994
- use: ((inputContext: better_call252.MiddlewareInputContext<better_call252.MiddlewareOptions>) => Promise<{
995
- session: {
996
- session: Record<string, any> & {
997
- id: string;
998
- createdAt: Date;
999
- updatedAt: Date;
1000
- userId: string;
1001
- expiresAt: Date;
1002
- token: string;
1003
- ipAddress?: string | null | undefined;
1004
- userAgent?: string | null | undefined;
1005
- };
1006
- user: Record<string, any> & {
1007
- id: string;
1008
- createdAt: Date;
1009
- updatedAt: Date;
1010
- email: string;
1011
- emailVerified: boolean;
1012
- name: string;
1013
- image?: string | null | undefined;
1014
- };
1015
- };
1016
- }>)[];
1017
- metadata: {
1018
- openapi: {
1019
- description: string;
1020
- responses: {
1021
- "200": {
1022
- description: string;
1023
- content: {
1024
- "application/json": {
1025
- schema: {
1026
- type: "object";
1027
- properties: {
1028
- id: {
1029
- type: string;
1030
- description: string;
1031
- };
1032
- name: {
1033
- type: string;
1034
- nullable: boolean;
1035
- description: string;
1036
- };
1037
- start: {
1038
- type: string;
1039
- nullable: boolean;
1040
- description: string;
1041
- };
1042
- prefix: {
1043
- type: string;
1044
- nullable: boolean;
1045
- description: string;
1046
- };
1047
- userId: {
1048
- type: string;
1049
- description: string;
1050
- };
1051
- refillInterval: {
1052
- type: string;
1053
- nullable: boolean;
1054
- description: string;
1055
- };
1056
- refillAmount: {
1057
- type: string;
1058
- nullable: boolean;
1059
- description: string;
1060
- };
1061
- lastRefillAt: {
1062
- type: string;
1063
- format: string;
1064
- nullable: boolean;
1065
- description: string;
1066
- };
1067
- enabled: {
1068
- type: string;
1069
- description: string;
1070
- default: boolean;
1071
- };
1072
- rateLimitEnabled: {
1073
- type: string;
1074
- description: string;
1075
- };
1076
- rateLimitTimeWindow: {
1077
- type: string;
1078
- nullable: boolean;
1079
- description: string;
1080
- };
1081
- rateLimitMax: {
1082
- type: string;
1083
- nullable: boolean;
1084
- description: string;
1085
- };
1086
- requestCount: {
1087
- type: string;
1088
- description: string;
1089
- };
1090
- remaining: {
1091
- type: string;
1092
- nullable: boolean;
1093
- description: string;
1094
- };
1095
- lastRequest: {
1096
- type: string;
1097
- format: string;
1098
- nullable: boolean;
1099
- description: string;
1100
- };
1101
- expiresAt: {
1102
- type: string;
1103
- format: string;
1104
- nullable: boolean;
1105
- description: string;
1106
- };
1107
- createdAt: {
1108
- type: string;
1109
- format: string;
1110
- description: string;
1111
- };
1112
- updatedAt: {
1113
- type: string;
1114
- format: string;
1115
- description: string;
1116
- };
1117
- metadata: {
1118
- type: string;
1119
- nullable: boolean;
1120
- additionalProperties: boolean;
1121
- description: string;
1122
- };
1123
- permissions: {
1124
- type: string;
1125
- nullable: boolean;
1126
- description: string;
1127
- };
1128
- };
1129
- required: string[];
1130
- };
1131
- };
1132
- };
1133
- };
1134
- };
1135
- };
1136
- };
1137
- } & {
1138
- use: any[];
1139
- };
1140
- path: "/api-key/get";
1141
- };
1142
- /**
1143
- * ### Endpoint
1144
- *
1145
- * POST `/api-key/update`
1146
- *
1147
- * ### API Methods
1148
- *
1149
- * **server:**
1150
- * `auth.api.updateApiKey`
1151
- *
1152
- * **client:**
1153
- * `authClient.apiKey.update`
1154
- *
1155
- * @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/api-key#api-method-api-key-update)
1156
- */
1157
- updateApiKey: {
1158
- <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
1159
- body: {
1160
- keyId: string;
1161
- userId?: unknown;
1162
- name?: string | undefined;
1163
- enabled?: boolean | undefined;
1164
- remaining?: number | undefined;
1165
- refillAmount?: number | undefined;
1166
- refillInterval?: number | undefined;
1167
- metadata?: any;
1168
- expiresIn?: number | null | undefined;
1169
- rateLimitEnabled?: boolean | undefined;
1170
- rateLimitTimeWindow?: number | undefined;
1171
- rateLimitMax?: number | undefined;
1172
- permissions?: Record<string, string[]> | null | undefined;
1173
- };
1174
- } & {
1175
- method?: "POST" | undefined;
1176
- } & {
1177
- query?: Record<string, any> | undefined;
1178
- } & {
1179
- params?: Record<string, any>;
1180
- } & {
1181
- request?: Request;
1182
- } & {
1183
- headers?: HeadersInit;
1184
- } & {
1185
- asResponse?: boolean;
1186
- returnHeaders?: boolean;
1187
- use?: better_call252.Middleware[];
1188
- path?: string;
1189
- } & {
1190
- asResponse?: AsResponse | undefined;
1191
- returnHeaders?: ReturnHeaders | undefined;
1192
- }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
1193
- headers: Headers;
1194
- response: {
1195
- permissions: {
1196
- [key: string]: string[];
1197
- } | null;
1198
- id: string;
1199
- name: string | null;
1200
- start: string | null;
1201
- prefix: string | null;
1202
- userId: string;
1203
- refillInterval: number | null;
1204
- refillAmount: number | null;
1205
- lastRefillAt: Date | null;
1206
- enabled: boolean;
1207
- rateLimitEnabled: boolean;
1208
- rateLimitTimeWindow: number | null;
1209
- rateLimitMax: number | null;
1210
- requestCount: number;
1211
- remaining: number | null;
1212
- lastRequest: Date | null;
1213
- expiresAt: Date | null;
1214
- createdAt: Date;
1215
- updatedAt: Date;
1216
- metadata: Record<string, any> | null;
1217
- };
1218
- } : {
1219
- permissions: {
1220
- [key: string]: string[];
1221
- } | null;
1222
- id: string;
1223
- name: string | null;
1224
- start: string | null;
1225
- prefix: string | null;
1226
- userId: string;
1227
- refillInterval: number | null;
1228
- refillAmount: number | null;
1229
- lastRefillAt: Date | null;
1230
- enabled: boolean;
1231
- rateLimitEnabled: boolean;
1232
- rateLimitTimeWindow: number | null;
1233
- rateLimitMax: number | null;
1234
- requestCount: number;
1235
- remaining: number | null;
1236
- lastRequest: Date | null;
1237
- expiresAt: Date | null;
1238
- createdAt: Date;
1239
- updatedAt: Date;
1240
- metadata: Record<string, any> | null;
1241
- }>;
1242
- options: {
1243
- method: "POST";
1244
- body: zod381.ZodObject<{
1245
- keyId: zod381.ZodString;
1246
- userId: zod381.ZodOptional<zod381.ZodCoercedString<unknown>>;
1247
- name: zod381.ZodOptional<zod381.ZodString>;
1248
- enabled: zod381.ZodOptional<zod381.ZodBoolean>;
1249
- remaining: zod381.ZodOptional<zod381.ZodNumber>;
1250
- refillAmount: zod381.ZodOptional<zod381.ZodNumber>;
1251
- refillInterval: zod381.ZodOptional<zod381.ZodNumber>;
1252
- metadata: zod381.ZodOptional<zod381.ZodAny>;
1253
- expiresIn: zod381.ZodNullable<zod381.ZodOptional<zod381.ZodNumber>>;
1254
- rateLimitEnabled: zod381.ZodOptional<zod381.ZodBoolean>;
1255
- rateLimitTimeWindow: zod381.ZodOptional<zod381.ZodNumber>;
1256
- rateLimitMax: zod381.ZodOptional<zod381.ZodNumber>;
1257
- permissions: zod381.ZodNullable<zod381.ZodOptional<zod381.ZodRecord<zod381.ZodString, zod381.ZodArray<zod381.ZodString>>>>;
1258
- }, zod_v4_core51.$strip>;
1259
- metadata: {
1260
- openapi: {
1261
- description: string;
1262
- responses: {
1263
- "200": {
1264
- description: string;
1265
- content: {
1266
- "application/json": {
1267
- schema: {
1268
- type: "object";
1269
- properties: {
1270
- id: {
1271
- type: string;
1272
- description: string;
1273
- };
1274
- name: {
1275
- type: string;
1276
- nullable: boolean;
1277
- description: string;
1278
- };
1279
- start: {
1280
- type: string;
1281
- nullable: boolean;
1282
- description: string;
1283
- };
1284
- prefix: {
1285
- type: string;
1286
- nullable: boolean;
1287
- description: string;
1288
- };
1289
- userId: {
1290
- type: string;
1291
- description: string;
1292
- };
1293
- refillInterval: {
1294
- type: string;
1295
- nullable: boolean;
1296
- description: string;
1297
- };
1298
- refillAmount: {
1299
- type: string;
1300
- nullable: boolean;
1301
- description: string;
1302
- };
1303
- lastRefillAt: {
1304
- type: string;
1305
- format: string;
1306
- nullable: boolean;
1307
- description: string;
1308
- };
1309
- enabled: {
1310
- type: string;
1311
- description: string;
1312
- default: boolean;
1313
- };
1314
- rateLimitEnabled: {
1315
- type: string;
1316
- description: string;
1317
- };
1318
- rateLimitTimeWindow: {
1319
- type: string;
1320
- nullable: boolean;
1321
- description: string;
1322
- };
1323
- rateLimitMax: {
1324
- type: string;
1325
- nullable: boolean;
1326
- description: string;
1327
- };
1328
- requestCount: {
1329
- type: string;
1330
- description: string;
1331
- };
1332
- remaining: {
1333
- type: string;
1334
- nullable: boolean;
1335
- description: string;
1336
- };
1337
- lastRequest: {
1338
- type: string;
1339
- format: string;
1340
- nullable: boolean;
1341
- description: string;
1342
- };
1343
- expiresAt: {
1344
- type: string;
1345
- format: string;
1346
- nullable: boolean;
1347
- description: string;
1348
- };
1349
- createdAt: {
1350
- type: string;
1351
- format: string;
1352
- description: string;
1353
- };
1354
- updatedAt: {
1355
- type: string;
1356
- format: string;
1357
- description: string;
1358
- };
1359
- metadata: {
1360
- type: string;
1361
- nullable: boolean;
1362
- additionalProperties: boolean;
1363
- description: string;
1364
- };
1365
- permissions: {
1366
- type: string;
1367
- nullable: boolean;
1368
- description: string;
1369
- };
1370
- };
1371
- required: string[];
1372
- };
1373
- };
1374
- };
1375
- };
1376
- };
1377
- };
1378
- };
1379
- } & {
1380
- use: any[];
1381
- };
1382
- path: "/api-key/update";
1383
- };
1384
- /**
1385
- * ### Endpoint
1386
- *
1387
- * POST `/api-key/delete`
1388
- *
1389
- * ### API Methods
1390
- *
1391
- * **server:**
1392
- * `auth.api.deleteApiKey`
1393
- *
1394
- * **client:**
1395
- * `authClient.apiKey.delete`
1396
- *
1397
- * @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/api-key#api-method-api-key-delete)
1398
- */
1399
- deleteApiKey: {
1400
- <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
1401
- body: {
1402
- keyId: string;
1403
- };
1404
- } & {
1405
- method?: "POST" | undefined;
1406
- } & {
1407
- query?: Record<string, any> | undefined;
1408
- } & {
1409
- params?: Record<string, any>;
1410
- } & {
1411
- request?: Request;
1412
- } & {
1413
- headers?: HeadersInit;
1414
- } & {
1415
- asResponse?: boolean;
1416
- returnHeaders?: boolean;
1417
- use?: better_call252.Middleware[];
1418
- path?: string;
1419
- } & {
1420
- asResponse?: AsResponse | undefined;
1421
- returnHeaders?: ReturnHeaders | undefined;
1422
- }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
1423
- headers: Headers;
1424
- response: {
1425
- success: boolean;
1426
- };
1427
- } : {
1428
- success: boolean;
1429
- }>;
1430
- options: {
1431
- method: "POST";
1432
- body: zod381.ZodObject<{
1433
- keyId: zod381.ZodString;
1434
- }, zod_v4_core51.$strip>;
1435
- use: ((inputContext: better_call252.MiddlewareInputContext<better_call252.MiddlewareOptions>) => Promise<{
1436
- session: {
1437
- session: Record<string, any> & {
1438
- id: string;
1439
- createdAt: Date;
1440
- updatedAt: Date;
1441
- userId: string;
1442
- expiresAt: Date;
1443
- token: string;
1444
- ipAddress?: string | null | undefined;
1445
- userAgent?: string | null | undefined;
1446
- };
1447
- user: Record<string, any> & {
1448
- id: string;
1449
- createdAt: Date;
1450
- updatedAt: Date;
1451
- email: string;
1452
- emailVerified: boolean;
1453
- name: string;
1454
- image?: string | null | undefined;
1455
- };
1456
- };
1457
- }>)[];
1458
- metadata: {
1459
- openapi: {
1460
- description: string;
1461
- requestBody: {
1462
- content: {
1463
- "application/json": {
1464
- schema: {
1465
- type: "object";
1466
- properties: {
1467
- keyId: {
1468
- type: string;
1469
- description: string;
1470
- };
1471
- };
1472
- required: string[];
1473
- };
1474
- };
1475
- };
1476
- };
1477
- responses: {
1478
- "200": {
1479
- description: string;
1480
- content: {
1481
- "application/json": {
1482
- schema: {
1483
- type: "object";
1484
- properties: {
1485
- success: {
1486
- type: string;
1487
- description: string;
1488
- };
1489
- };
1490
- required: string[];
1491
- };
1492
- };
1493
- };
1494
- };
1495
- };
1496
- };
1497
- };
1498
- } & {
1499
- use: any[];
1500
- };
1501
- path: "/api-key/delete";
1502
- };
1503
- /**
1504
- * ### Endpoint
1505
- *
1506
- * GET `/api-key/list`
1507
- *
1508
- * ### API Methods
1509
- *
1510
- * **server:**
1511
- * `auth.api.listApiKeys`
1512
- *
1513
- * **client:**
1514
- * `authClient.apiKey.list`
1515
- *
1516
- * @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/api-key#api-method-api-key-list)
1517
- */
1518
- listApiKeys: {
1519
- <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
1520
- body?: undefined;
1521
- } & {
1522
- method?: "GET" | undefined;
1523
- } & {
1524
- query?: Record<string, any> | undefined;
1525
- } & {
1526
- params?: Record<string, any>;
1527
- } & {
1528
- request?: Request;
1529
- } & {
1530
- headers?: HeadersInit;
1531
- } & {
1532
- asResponse?: boolean;
1533
- returnHeaders?: boolean;
1534
- use?: better_call252.Middleware[];
1535
- path?: string;
1536
- } & {
1537
- asResponse?: AsResponse | undefined;
1538
- returnHeaders?: ReturnHeaders | undefined;
1539
- }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
1540
- headers: Headers;
1541
- response: {
1542
- permissions: {
1543
- [key: string]: string[];
1544
- } | null;
1545
- id: string;
1546
- name: string | null;
1547
- start: string | null;
1548
- prefix: string | null;
1549
- userId: string;
1550
- refillInterval: number | null;
1551
- refillAmount: number | null;
1552
- lastRefillAt: Date | null;
1553
- enabled: boolean;
1554
- rateLimitEnabled: boolean;
1555
- rateLimitTimeWindow: number | null;
1556
- rateLimitMax: number | null;
1557
- requestCount: number;
1558
- remaining: number | null;
1559
- lastRequest: Date | null;
1560
- expiresAt: Date | null;
1561
- createdAt: Date;
1562
- updatedAt: Date;
1563
- metadata: Record<string, any> | null;
1564
- }[];
1565
- } : {
1566
- permissions: {
1567
- [key: string]: string[];
1568
- } | null;
1569
- id: string;
1570
- name: string | null;
1571
- start: string | null;
1572
- prefix: string | null;
1573
- userId: string;
1574
- refillInterval: number | null;
1575
- refillAmount: number | null;
1576
- lastRefillAt: Date | null;
1577
- enabled: boolean;
1578
- rateLimitEnabled: boolean;
1579
- rateLimitTimeWindow: number | null;
1580
- rateLimitMax: number | null;
1581
- requestCount: number;
1582
- remaining: number | null;
1583
- lastRequest: Date | null;
1584
- expiresAt: Date | null;
1585
- createdAt: Date;
1586
- updatedAt: Date;
1587
- metadata: Record<string, any> | null;
1588
- }[]>;
1589
- options: {
1590
- method: "GET";
1591
- use: ((inputContext: better_call252.MiddlewareInputContext<better_call252.MiddlewareOptions>) => Promise<{
1592
- session: {
1593
- session: Record<string, any> & {
1594
- id: string;
1595
- createdAt: Date;
1596
- updatedAt: Date;
1597
- userId: string;
1598
- expiresAt: Date;
1599
- token: string;
1600
- ipAddress?: string | null | undefined;
1601
- userAgent?: string | null | undefined;
1602
- };
1603
- user: Record<string, any> & {
1604
- id: string;
1605
- createdAt: Date;
1606
- updatedAt: Date;
1607
- email: string;
1608
- emailVerified: boolean;
1609
- name: string;
1610
- image?: string | null | undefined;
1611
- };
1612
- };
1613
- }>)[];
1614
- metadata: {
1615
- openapi: {
1616
- description: string;
1617
- responses: {
1618
- "200": {
1619
- description: string;
1620
- content: {
1621
- "application/json": {
1622
- schema: {
1623
- type: "array";
1624
- items: {
1625
- type: string;
1626
- properties: {
1627
- id: {
1628
- type: string;
1629
- description: string;
1630
- };
1631
- name: {
1632
- type: string;
1633
- nullable: boolean;
1634
- description: string;
1635
- };
1636
- start: {
1637
- type: string;
1638
- nullable: boolean;
1639
- description: string;
1640
- };
1641
- prefix: {
1642
- type: string;
1643
- nullable: boolean;
1644
- description: string;
1645
- };
1646
- userId: {
1647
- type: string;
1648
- description: string;
1649
- };
1650
- refillInterval: {
1651
- type: string;
1652
- nullable: boolean;
1653
- description: string;
1654
- };
1655
- refillAmount: {
1656
- type: string;
1657
- nullable: boolean;
1658
- description: string;
1659
- };
1660
- lastRefillAt: {
1661
- type: string;
1662
- format: string;
1663
- nullable: boolean;
1664
- description: string;
1665
- };
1666
- enabled: {
1667
- type: string;
1668
- description: string;
1669
- default: boolean;
1670
- };
1671
- rateLimitEnabled: {
1672
- type: string;
1673
- description: string;
1674
- };
1675
- rateLimitTimeWindow: {
1676
- type: string;
1677
- nullable: boolean;
1678
- description: string;
1679
- };
1680
- rateLimitMax: {
1681
- type: string;
1682
- nullable: boolean;
1683
- description: string;
1684
- };
1685
- requestCount: {
1686
- type: string;
1687
- description: string;
1688
- };
1689
- remaining: {
1690
- type: string;
1691
- nullable: boolean;
1692
- description: string;
1693
- };
1694
- lastRequest: {
1695
- type: string;
1696
- format: string;
1697
- nullable: boolean;
1698
- description: string;
1699
- };
1700
- expiresAt: {
1701
- type: string;
1702
- format: string;
1703
- nullable: boolean;
1704
- description: string;
1705
- };
1706
- createdAt: {
1707
- type: string;
1708
- format: string;
1709
- description: string;
1710
- };
1711
- updatedAt: {
1712
- type: string;
1713
- format: string;
1714
- description: string;
1715
- };
1716
- metadata: {
1717
- type: string;
1718
- nullable: boolean;
1719
- additionalProperties: boolean;
1720
- description: string;
1721
- };
1722
- permissions: {
1723
- type: string;
1724
- nullable: boolean;
1725
- description: string;
1726
- };
1727
- };
1728
- required: string[];
1729
- };
1730
- };
1731
- };
1732
- };
1733
- };
1734
- };
1735
- };
1736
- };
1737
- } & {
1738
- use: any[];
1739
- };
1740
- path: "/api-key/list";
1741
- };
1742
- /**
1743
- * ### Endpoint
1744
- *
1745
- * POST `/api-key/delete-all-expired-api-keys`
1746
- *
1747
- * ### API Methods
1748
- *
1749
- * **server:**
1750
- * `auth.api.deleteAllExpiredApiKeys`
1751
- *
1752
- * @see [Read our docs to learn more.](https://payvopayvo.com/docs/plugins/api-key#api-method-api-key-delete-all-expired-api-keys)
1753
- */
1754
- deleteAllExpiredApiKeys: {
1755
- <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
1756
- body?: undefined;
1757
- } & {
1758
- method?: "POST" | undefined;
1759
- } & {
1760
- query?: Record<string, any> | undefined;
1761
- } & {
1762
- params?: Record<string, any>;
1763
- } & {
1764
- request?: Request;
1765
- } & {
1766
- headers?: HeadersInit;
1767
- } & {
1768
- asResponse?: boolean;
1769
- returnHeaders?: boolean;
1770
- use?: better_call252.Middleware[];
1771
- path?: string;
1772
- } & {
1773
- asResponse?: AsResponse | undefined;
1774
- returnHeaders?: ReturnHeaders | undefined;
1775
- }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
1776
- headers: Headers;
1777
- response: {
1778
- success: boolean;
1779
- error: unknown;
1780
- };
1781
- } : {
1782
- success: boolean;
1783
- error: unknown;
1784
- }>;
1785
- options: {
1786
- method: "POST";
1787
- metadata: {
1788
- SERVER_ONLY: true;
1789
- client: boolean;
1790
- };
1791
- } & {
1792
- use: any[];
1793
- };
1794
- path: "/api-key/delete-all-expired-api-keys";
1795
- };
1796
- };
1797
- schema: {
1798
- apikey: {
1799
- fields: {
1800
- name: {
1801
- type: "string";
1802
- required: false;
1803
- input: false;
1804
- };
1805
- start: {
1806
- type: "string";
1807
- required: false;
1808
- input: false;
1809
- };
1810
- prefix: {
1811
- type: "string";
1812
- required: false;
1813
- input: false;
1814
- };
1815
- key: {
1816
- type: "string";
1817
- required: true;
1818
- input: false;
1819
- };
1820
- userId: {
1821
- type: "string";
1822
- references: {
1823
- model: string;
1824
- field: string;
1825
- onDelete: "cascade";
1826
- };
1827
- required: true;
1828
- input: false;
1829
- };
1830
- refillInterval: {
1831
- type: "number";
1832
- required: false;
1833
- input: false;
1834
- };
1835
- refillAmount: {
1836
- type: "number";
1837
- required: false;
1838
- input: false;
1839
- };
1840
- lastRefillAt: {
1841
- type: "date";
1842
- required: false;
1843
- input: false;
1844
- };
1845
- enabled: {
1846
- type: "boolean";
1847
- required: false;
1848
- input: false;
1849
- defaultValue: true;
1850
- };
1851
- rateLimitEnabled: {
1852
- type: "boolean";
1853
- required: false;
1854
- input: false;
1855
- defaultValue: true;
1856
- };
1857
- rateLimitTimeWindow: {
1858
- type: "number";
1859
- required: false;
1860
- input: false;
1861
- defaultValue: number;
1862
- };
1863
- rateLimitMax: {
1864
- type: "number";
1865
- required: false;
1866
- input: false;
1867
- defaultValue: number;
1868
- };
1869
- requestCount: {
1870
- type: "number";
1871
- required: false;
1872
- input: false;
1873
- defaultValue: number;
1874
- };
1875
- remaining: {
1876
- type: "number";
1877
- required: false;
1878
- input: false;
1879
- };
1880
- lastRequest: {
1881
- type: "date";
1882
- required: false;
1883
- input: false;
1884
- };
1885
- expiresAt: {
1886
- type: "date";
1887
- required: false;
1888
- input: false;
1889
- };
1890
- createdAt: {
1891
- type: "date";
1892
- required: true;
1893
- input: false;
1894
- };
1895
- updatedAt: {
1896
- type: "date";
1897
- required: true;
1898
- input: false;
1899
- };
1900
- permissions: {
1901
- type: "string";
1902
- required: false;
1903
- input: false;
1904
- };
1905
- metadata: {
1906
- type: "string";
1907
- required: false;
1908
- input: true;
1909
- transform: {
1910
- input(value: DBPrimitive): string;
1911
- output(value: DBPrimitive): any;
1912
- };
1913
- };
1914
- };
1915
- };
1916
- };
1917
- };
1918
- //#endregion
1919
- export { defaultKeyHasher as i, ERROR_CODES as n, apiKey as r, API_KEY_TABLE_NAME as t };