alepha 0.15.3 → 0.15.5

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 (318) hide show
  1. package/README.md +26 -11
  2. package/dist/api/audits/index.d.ts +335 -335
  3. package/dist/api/audits/index.d.ts.map +1 -1
  4. package/dist/api/audits/index.js +11 -3
  5. package/dist/api/audits/index.js.map +1 -1
  6. package/dist/api/files/index.d.ts +3 -3
  7. package/dist/api/files/index.js +4 -3
  8. package/dist/api/files/index.js.map +1 -1
  9. package/dist/api/jobs/index.d.ts +198 -155
  10. package/dist/api/jobs/index.d.ts.map +1 -1
  11. package/dist/api/jobs/index.js +103 -5
  12. package/dist/api/jobs/index.js.map +1 -1
  13. package/dist/api/keys/index.d.ts +198 -198
  14. package/dist/api/keys/index.d.ts.map +1 -1
  15. package/dist/api/keys/index.js +3 -3
  16. package/dist/api/keys/index.js.map +1 -1
  17. package/dist/api/notifications/index.browser.js +1 -0
  18. package/dist/api/notifications/index.browser.js.map +1 -1
  19. package/dist/api/notifications/index.d.ts +3 -3
  20. package/dist/api/notifications/index.js +4 -3
  21. package/dist/api/notifications/index.js.map +1 -1
  22. package/dist/api/parameters/index.d.ts +263 -263
  23. package/dist/api/parameters/index.d.ts.map +1 -1
  24. package/dist/api/parameters/index.js +41 -30
  25. package/dist/api/parameters/index.js.map +1 -1
  26. package/dist/api/users/index.d.ts +383 -77
  27. package/dist/api/users/index.d.ts.map +1 -1
  28. package/dist/api/users/index.js +284 -72
  29. package/dist/api/users/index.js.map +1 -1
  30. package/dist/api/verifications/index.d.ts +131 -131
  31. package/dist/api/verifications/index.d.ts.map +1 -1
  32. package/dist/api/verifications/index.js +3 -3
  33. package/dist/api/verifications/index.js.map +1 -1
  34. package/dist/batch/index.d.ts +3 -3
  35. package/dist/batch/index.js +3 -3
  36. package/dist/batch/index.js.map +1 -1
  37. package/dist/bucket/index.d.ts +3 -3
  38. package/dist/bucket/index.js +6 -6
  39. package/dist/bucket/index.js.map +1 -1
  40. package/dist/cache/core/index.d.ts +3 -3
  41. package/dist/cache/core/index.js +3 -3
  42. package/dist/cache/core/index.js.map +1 -1
  43. package/dist/cli/index.d.ts +5612 -20
  44. package/dist/cli/index.d.ts.map +1 -1
  45. package/dist/cli/index.js +122 -91
  46. package/dist/cli/index.js.map +1 -1
  47. package/dist/command/index.d.ts +11 -4
  48. package/dist/command/index.d.ts.map +1 -1
  49. package/dist/command/index.js +8 -6
  50. package/dist/command/index.js.map +1 -1
  51. package/dist/core/index.browser.js.map +1 -1
  52. package/dist/core/index.d.ts +4 -8
  53. package/dist/core/index.d.ts.map +1 -1
  54. package/dist/core/index.js +3 -3
  55. package/dist/core/index.js.map +1 -1
  56. package/dist/core/index.native.js.map +1 -1
  57. package/dist/datetime/index.d.ts +3 -3
  58. package/dist/datetime/index.js +3 -3
  59. package/dist/datetime/index.js.map +1 -1
  60. package/dist/email/index.d.ts +16 -16
  61. package/dist/email/index.d.ts.map +1 -1
  62. package/dist/email/index.js +10562 -10
  63. package/dist/email/index.js.map +1 -1
  64. package/dist/fake/index.d.ts +3 -3
  65. package/dist/fake/index.js +3 -3
  66. package/dist/fake/index.js.map +1 -1
  67. package/dist/lock/core/index.d.ts +9 -4
  68. package/dist/lock/core/index.d.ts.map +1 -1
  69. package/dist/lock/core/index.js +12 -4
  70. package/dist/lock/core/index.js.map +1 -1
  71. package/dist/logger/index.d.ts +3 -3
  72. package/dist/logger/index.js +6 -3
  73. package/dist/logger/index.js.map +1 -1
  74. package/dist/mcp/index.d.ts +3 -3
  75. package/dist/mcp/index.js +3 -3
  76. package/dist/mcp/index.js.map +1 -1
  77. package/dist/orm/index.d.ts +12 -12
  78. package/dist/orm/index.js +4 -4
  79. package/dist/orm/index.js.map +1 -1
  80. package/dist/queue/core/index.d.ts +3 -3
  81. package/dist/queue/core/index.js +3 -3
  82. package/dist/queue/core/index.js.map +1 -1
  83. package/dist/react/auth/index.browser.js +2 -1
  84. package/dist/react/auth/index.browser.js.map +1 -1
  85. package/dist/react/auth/index.d.ts +3 -3
  86. package/dist/react/auth/index.js +5 -4
  87. package/dist/react/auth/index.js.map +1 -1
  88. package/dist/react/core/index.d.ts +6 -6
  89. package/dist/react/core/index.js +3 -3
  90. package/dist/react/core/index.js.map +1 -1
  91. package/dist/react/form/index.d.ts +3 -3
  92. package/dist/react/form/index.js +3 -3
  93. package/dist/react/form/index.js.map +1 -1
  94. package/dist/react/head/index.d.ts +3 -3
  95. package/dist/react/head/index.js +3 -3
  96. package/dist/react/head/index.js.map +1 -1
  97. package/dist/react/i18n/index.d.ts +3 -3
  98. package/dist/react/i18n/index.js +3 -3
  99. package/dist/react/i18n/index.js.map +1 -1
  100. package/dist/react/intro/index.css +337 -0
  101. package/dist/react/intro/index.css.map +1 -0
  102. package/dist/react/intro/index.d.ts +10 -0
  103. package/dist/react/intro/index.d.ts.map +1 -0
  104. package/dist/react/intro/index.js +222 -0
  105. package/dist/react/intro/index.js.map +1 -0
  106. package/dist/react/router/index.browser.js +2 -2
  107. package/dist/react/router/index.browser.js.map +1 -1
  108. package/dist/react/router/index.d.ts +11 -1
  109. package/dist/react/router/index.d.ts.map +1 -1
  110. package/dist/react/router/index.js +21 -11
  111. package/dist/react/router/index.js.map +1 -1
  112. package/dist/redis/index.d.ts +22 -22
  113. package/dist/redis/index.js +3 -3
  114. package/dist/redis/index.js.map +1 -1
  115. package/dist/retry/index.d.ts +3 -3
  116. package/dist/retry/index.js +3 -3
  117. package/dist/retry/index.js.map +1 -1
  118. package/dist/scheduler/index.d.ts +16 -4
  119. package/dist/scheduler/index.d.ts.map +1 -1
  120. package/dist/scheduler/index.js +45 -7
  121. package/dist/scheduler/index.js.map +1 -1
  122. package/dist/security/index.d.ts +3 -3
  123. package/dist/security/index.js +5 -5
  124. package/dist/security/index.js.map +1 -1
  125. package/dist/server/auth/index.d.ts +3 -3
  126. package/dist/server/auth/index.js +3 -3
  127. package/dist/server/auth/index.js.map +1 -1
  128. package/dist/server/cache/index.d.ts +3 -3
  129. package/dist/server/cache/index.js +3 -3
  130. package/dist/server/cache/index.js.map +1 -1
  131. package/dist/server/compress/index.d.ts +3 -3
  132. package/dist/server/compress/index.d.ts.map +1 -1
  133. package/dist/server/compress/index.js +4 -3
  134. package/dist/server/compress/index.js.map +1 -1
  135. package/dist/server/cookies/index.d.ts +3 -3
  136. package/dist/server/cookies/index.js +3 -3
  137. package/dist/server/cookies/index.js.map +1 -1
  138. package/dist/server/core/index.d.ts +14 -25
  139. package/dist/server/core/index.d.ts.map +1 -1
  140. package/dist/server/core/index.js +13 -29
  141. package/dist/server/core/index.js.map +1 -1
  142. package/dist/server/cors/index.d.ts +3 -3
  143. package/dist/server/cors/index.js +3 -3
  144. package/dist/server/cors/index.js.map +1 -1
  145. package/dist/server/health/index.d.ts +20 -20
  146. package/dist/server/health/index.js +3 -3
  147. package/dist/server/health/index.js.map +1 -1
  148. package/dist/server/helmet/index.d.ts +3 -3
  149. package/dist/server/helmet/index.js +3 -3
  150. package/dist/server/helmet/index.js.map +1 -1
  151. package/dist/server/links/index.d.ts +42 -42
  152. package/dist/server/links/index.d.ts.map +1 -1
  153. package/dist/server/links/index.js +4 -4
  154. package/dist/server/links/index.js.map +1 -1
  155. package/dist/server/metrics/index.d.ts +3 -3
  156. package/dist/server/metrics/index.js +3 -3
  157. package/dist/server/metrics/index.js.map +1 -1
  158. package/dist/server/multipart/index.d.ts +3 -3
  159. package/dist/server/multipart/index.js +3 -3
  160. package/dist/server/multipart/index.js.map +1 -1
  161. package/dist/server/proxy/index.d.ts +3 -3
  162. package/dist/server/proxy/index.js +3 -3
  163. package/dist/server/proxy/index.js.map +1 -1
  164. package/dist/server/rate-limit/index.d.ts +3 -3
  165. package/dist/server/rate-limit/index.js +3 -3
  166. package/dist/server/rate-limit/index.js.map +1 -1
  167. package/dist/server/static/index.d.ts +3 -3
  168. package/dist/server/static/index.js +6 -6
  169. package/dist/server/static/index.js.map +1 -1
  170. package/dist/server/swagger/index.d.ts +3 -3
  171. package/dist/server/swagger/index.js +6 -6
  172. package/dist/server/swagger/index.js.map +1 -1
  173. package/dist/sms/index.d.ts +3 -3
  174. package/dist/sms/index.js +6 -6
  175. package/dist/sms/index.js.map +1 -1
  176. package/dist/system/index.d.ts +3 -3
  177. package/dist/system/index.js +3 -3
  178. package/dist/system/index.js.map +1 -1
  179. package/dist/thread/index.d.ts +3 -3
  180. package/dist/thread/index.js +3 -3
  181. package/dist/thread/index.js.map +1 -1
  182. package/dist/topic/core/index.d.ts +3 -3
  183. package/dist/topic/core/index.js +3 -3
  184. package/dist/topic/core/index.js.map +1 -1
  185. package/dist/vite/index.d.ts +6286 -4
  186. package/dist/vite/index.d.ts.map +1 -1
  187. package/dist/vite/index.js +28 -2
  188. package/dist/vite/index.js.map +1 -1
  189. package/dist/websocket/index.d.ts +37 -37
  190. package/dist/websocket/index.d.ts.map +1 -1
  191. package/dist/websocket/index.js +3 -3
  192. package/dist/websocket/index.js.map +1 -1
  193. package/package.json +12 -4
  194. package/src/api/audits/controllers/AdminAuditController.ts +8 -0
  195. package/src/api/audits/index.ts +3 -3
  196. package/src/api/files/controllers/AdminFileStatsController.ts +1 -0
  197. package/src/api/files/index.ts +3 -3
  198. package/src/api/jobs/controllers/AdminJobController.ts +18 -2
  199. package/src/api/jobs/index.ts +4 -3
  200. package/src/api/jobs/services/JobAudits.spec.ts +89 -0
  201. package/src/api/jobs/services/JobAudits.ts +101 -0
  202. package/src/api/keys/index.ts +3 -3
  203. package/src/api/notifications/controllers/AdminNotificationController.ts +1 -0
  204. package/src/api/notifications/index.ts +3 -3
  205. package/src/api/parameters/controllers/AdminConfigController.ts +10 -0
  206. package/src/api/parameters/index.ts +5 -3
  207. package/src/api/users/__tests__/ApiKeys-integration.spec.ts +1 -1
  208. package/src/api/users/__tests__/ApiKeys.spec.ts +1 -1
  209. package/src/api/users/__tests__/EmailVerification.spec.ts +16 -1
  210. package/src/api/users/__tests__/PasswordReset.spec.ts +11 -0
  211. package/src/api/users/atoms/realmAuthSettingsAtom.ts +10 -0
  212. package/src/api/users/controllers/AdminIdentityController.ts +3 -0
  213. package/src/api/users/controllers/AdminSessionController.ts +3 -0
  214. package/src/api/users/controllers/AdminUserController.ts +5 -0
  215. package/src/api/users/index.ts +8 -9
  216. package/src/api/users/primitives/$realm.ts +117 -19
  217. package/src/api/users/providers/RealmProvider.ts +15 -7
  218. package/src/api/users/services/CredentialService.spec.ts +11 -0
  219. package/src/api/users/services/CredentialService.ts +47 -24
  220. package/src/api/users/services/IdentityService.ts +12 -4
  221. package/src/api/users/services/RegistrationService.spec.ts +11 -0
  222. package/src/api/users/services/RegistrationService.ts +33 -12
  223. package/src/api/users/services/SessionService.ts +83 -12
  224. package/src/api/users/services/UserAudits.ts +47 -0
  225. package/src/api/users/services/UserFiles.ts +19 -0
  226. package/src/api/users/services/UserJobs.spec.ts +107 -0
  227. package/src/api/users/services/UserJobs.ts +62 -0
  228. package/src/api/users/services/UserParameters.ts +23 -0
  229. package/src/api/users/services/UserService.ts +34 -17
  230. package/src/api/verifications/index.ts +3 -3
  231. package/src/batch/index.ts +3 -3
  232. package/src/bucket/index.ts +3 -3
  233. package/src/cache/core/index.ts +3 -3
  234. package/src/cli/commands/build.ts +1 -0
  235. package/src/cli/commands/db.ts +9 -0
  236. package/src/cli/commands/init.spec.ts +2 -17
  237. package/src/cli/commands/init.ts +37 -1
  238. package/src/cli/providers/ViteDevServerProvider.ts +36 -2
  239. package/src/cli/services/AlephaCliUtils.ts +17 -0
  240. package/src/cli/services/PackageManagerUtils.ts +15 -1
  241. package/src/cli/services/ProjectScaffolder.ts +8 -13
  242. package/src/cli/templates/agentMd.ts +2 -25
  243. package/src/cli/templates/apiAppSecurityTs.ts +37 -2
  244. package/src/cli/templates/mainCss.ts +2 -32
  245. package/src/cli/templates/webAppRouterTs.ts +5 -5
  246. package/src/cli/templates/webHomeComponentTsx.ts +10 -0
  247. package/src/command/helpers/Runner.ts +14 -1
  248. package/src/command/index.ts +3 -3
  249. package/src/core/helpers/primitive.ts +0 -5
  250. package/src/core/index.ts +3 -3
  251. package/src/datetime/index.ts +3 -3
  252. package/src/email/index.ts +3 -3
  253. package/src/email/index.workerd.ts +36 -0
  254. package/src/email/providers/LocalEmailProvider.ts +2 -2
  255. package/src/email/providers/WorkermailerEmailProvider.ts +221 -0
  256. package/src/fake/index.ts +3 -3
  257. package/src/lock/core/index.ts +3 -3
  258. package/src/lock/core/primitives/$lock.ts +13 -1
  259. package/src/logger/index.ts +3 -3
  260. package/src/logger/providers/PrettyFormatterProvider.ts +7 -0
  261. package/src/mcp/index.ts +3 -3
  262. package/src/orm/index.ts +3 -3
  263. package/src/orm/providers/drivers/NodeSqliteProvider.ts +1 -1
  264. package/src/queue/core/index.ts +3 -3
  265. package/src/react/auth/index.ts +3 -3
  266. package/src/react/auth/services/ReactAuth.ts +3 -1
  267. package/src/react/core/index.ts +3 -3
  268. package/src/react/form/index.ts +3 -3
  269. package/src/react/head/index.ts +3 -3
  270. package/src/react/i18n/index.ts +3 -3
  271. package/src/react/intro/components/GettingStarted.css +334 -0
  272. package/src/react/intro/components/GettingStarted.tsx +276 -0
  273. package/src/react/intro/index.ts +1 -0
  274. package/src/react/router/atoms/ssrManifestAtom.ts +7 -0
  275. package/src/react/router/index.browser.ts +2 -0
  276. package/src/react/router/index.ts +2 -0
  277. package/src/react/router/providers/ReactServerProvider.ts +14 -4
  278. package/src/react/router/providers/SSRManifestProvider.ts +7 -0
  279. package/src/redis/index.ts +3 -3
  280. package/src/retry/index.ts +3 -3
  281. package/src/router/index.ts +3 -3
  282. package/src/scheduler/index.ts +3 -3
  283. package/src/scheduler/index.workerd.ts +43 -0
  284. package/src/scheduler/providers/CronProvider.ts +53 -6
  285. package/src/scheduler/providers/WorkerdCronProvider.ts +102 -0
  286. package/src/security/index.ts +3 -3
  287. package/src/security/providers/JwtProvider.ts +2 -2
  288. package/src/server/auth/index.ts +3 -3
  289. package/src/server/cache/index.ts +3 -3
  290. package/src/server/compress/index.ts +3 -3
  291. package/src/server/compress/providers/ServerCompressProvider.ts +6 -0
  292. package/src/server/cookies/index.ts +3 -3
  293. package/src/server/core/index.ts +3 -3
  294. package/src/server/core/primitives/$action.spec.ts +3 -2
  295. package/src/server/core/primitives/$action.ts +6 -2
  296. package/src/server/core/providers/NodeHttpServerProvider.ts +2 -15
  297. package/src/server/core/providers/ServerProvider.ts +4 -2
  298. package/src/server/core/providers/ServerRouterProvider.ts +5 -27
  299. package/src/server/cors/index.ts +3 -3
  300. package/src/server/health/index.ts +3 -3
  301. package/src/server/helmet/index.ts +3 -3
  302. package/src/server/links/index.ts +3 -3
  303. package/src/server/links/providers/ServerLinksProvider.spec.ts +332 -0
  304. package/src/server/links/providers/ServerLinksProvider.ts +1 -1
  305. package/src/server/metrics/index.ts +3 -3
  306. package/src/server/multipart/index.ts +3 -3
  307. package/src/server/proxy/index.ts +3 -3
  308. package/src/server/rate-limit/index.ts +3 -3
  309. package/src/server/static/index.ts +3 -3
  310. package/src/server/swagger/index.ts +3 -3
  311. package/src/sms/index.ts +3 -3
  312. package/src/system/index.ts +3 -3
  313. package/src/thread/index.ts +3 -3
  314. package/src/topic/core/index.ts +3 -3
  315. package/src/vite/tasks/generateCloudflare.ts +38 -2
  316. package/src/websocket/index.ts +3 -3
  317. package/src/cli/templates/webHelloComponentTsx.ts +0 -30
  318. /package/src/api/users/{notifications → services}/UserNotifications.ts +0 -0
@@ -1,63 +1,63 @@
1
- import * as alepha52 from "alepha";
1
+ import * as alepha19 from "alepha";
2
2
  import { Static } from "alepha";
3
3
  import * as alepha_server0 from "alepha/server";
4
4
  import { DateTimeProvider } from "alepha/datetime";
5
5
  import * as alepha_logger0 from "alepha/logger";
6
- import * as alepha_orm56 from "alepha/orm";
6
+ import * as alepha_orm0 from "alepha/orm";
7
7
  import * as alepha_scheduler0 from "alepha/scheduler";
8
8
 
9
9
  //#region ../../src/api/verifications/entities/verifications.d.ts
10
- declare const verifications: alepha_orm56.EntityPrimitive<alepha52.TObject<{
11
- id: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_PRIMARY_KEY>, typeof alepha_orm56.PG_DEFAULT>;
12
- createdAt: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_CREATED_AT>, typeof alepha_orm56.PG_DEFAULT>;
13
- updatedAt: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_UPDATED_AT>, typeof alepha_orm56.PG_DEFAULT>;
14
- version: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TInteger, typeof alepha_orm56.PG_VERSION>, typeof alepha_orm56.PG_DEFAULT>;
15
- type: alepha52.TUnsafe<"link" | "code">;
16
- target: alepha52.TString;
17
- code: alepha52.TString;
18
- verifiedAt: alepha52.TOptional<alepha52.TString>;
19
- attempts: alepha_orm56.PgAttr<alepha52.TInteger, typeof alepha_orm56.PG_DEFAULT>;
10
+ declare const verifications: alepha_orm0.EntityPrimitive<alepha19.TObject<{
11
+ id: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_PRIMARY_KEY>, typeof alepha_orm0.PG_DEFAULT>;
12
+ createdAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_CREATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
13
+ updatedAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_UPDATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
14
+ version: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TInteger, typeof alepha_orm0.PG_VERSION>, typeof alepha_orm0.PG_DEFAULT>;
15
+ type: alepha19.TUnsafe<"code" | "link">;
16
+ target: alepha19.TString;
17
+ code: alepha19.TString;
18
+ verifiedAt: alepha19.TOptional<alepha19.TString>;
19
+ attempts: alepha_orm0.PgAttr<alepha19.TInteger, typeof alepha_orm0.PG_DEFAULT>;
20
20
  }>>;
21
- declare const verificationEntitySchema: alepha52.TObject<{
22
- id: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_PRIMARY_KEY>, typeof alepha_orm56.PG_DEFAULT>;
23
- createdAt: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_CREATED_AT>, typeof alepha_orm56.PG_DEFAULT>;
24
- updatedAt: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_UPDATED_AT>, typeof alepha_orm56.PG_DEFAULT>;
25
- version: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TInteger, typeof alepha_orm56.PG_VERSION>, typeof alepha_orm56.PG_DEFAULT>;
26
- type: alepha52.TUnsafe<"link" | "code">;
27
- target: alepha52.TString;
28
- code: alepha52.TString;
29
- verifiedAt: alepha52.TOptional<alepha52.TString>;
30
- attempts: alepha_orm56.PgAttr<alepha52.TInteger, typeof alepha_orm56.PG_DEFAULT>;
21
+ declare const verificationEntitySchema: alepha19.TObject<{
22
+ id: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_PRIMARY_KEY>, typeof alepha_orm0.PG_DEFAULT>;
23
+ createdAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_CREATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
24
+ updatedAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_UPDATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
25
+ version: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TInteger, typeof alepha_orm0.PG_VERSION>, typeof alepha_orm0.PG_DEFAULT>;
26
+ type: alepha19.TUnsafe<"code" | "link">;
27
+ target: alepha19.TString;
28
+ code: alepha19.TString;
29
+ verifiedAt: alepha19.TOptional<alepha19.TString>;
30
+ attempts: alepha_orm0.PgAttr<alepha19.TInteger, typeof alepha_orm0.PG_DEFAULT>;
31
31
  }>;
32
- declare const verificationEntityInsertSchema: alepha_orm56.TObjectInsert<alepha52.TObject<{
33
- id: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_PRIMARY_KEY>, typeof alepha_orm56.PG_DEFAULT>;
34
- createdAt: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_CREATED_AT>, typeof alepha_orm56.PG_DEFAULT>;
35
- updatedAt: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_UPDATED_AT>, typeof alepha_orm56.PG_DEFAULT>;
36
- version: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TInteger, typeof alepha_orm56.PG_VERSION>, typeof alepha_orm56.PG_DEFAULT>;
37
- type: alepha52.TUnsafe<"link" | "code">;
38
- target: alepha52.TString;
39
- code: alepha52.TString;
40
- verifiedAt: alepha52.TOptional<alepha52.TString>;
41
- attempts: alepha_orm56.PgAttr<alepha52.TInteger, typeof alepha_orm56.PG_DEFAULT>;
32
+ declare const verificationEntityInsertSchema: alepha_orm0.TObjectInsert<alepha19.TObject<{
33
+ id: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_PRIMARY_KEY>, typeof alepha_orm0.PG_DEFAULT>;
34
+ createdAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_CREATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
35
+ updatedAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_UPDATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
36
+ version: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TInteger, typeof alepha_orm0.PG_VERSION>, typeof alepha_orm0.PG_DEFAULT>;
37
+ type: alepha19.TUnsafe<"code" | "link">;
38
+ target: alepha19.TString;
39
+ code: alepha19.TString;
40
+ verifiedAt: alepha19.TOptional<alepha19.TString>;
41
+ attempts: alepha_orm0.PgAttr<alepha19.TInteger, typeof alepha_orm0.PG_DEFAULT>;
42
42
  }>>;
43
43
  type VerificationEntity = Static<typeof verifications.schema>;
44
44
  //#endregion
45
45
  //#region ../../src/api/verifications/schemas/verificationSettingsSchema.d.ts
46
- declare const verificationSettingsSchema: alepha52.TObject<{
47
- code: alepha52.TObject<{
48
- maxAttempts: alepha52.TInteger;
49
- codeLength: alepha52.TInteger;
50
- codeExpiration: alepha52.TInteger;
51
- verificationCooldown: alepha52.TInteger;
52
- limitPerDay: alepha52.TInteger;
46
+ declare const verificationSettingsSchema: alepha19.TObject<{
47
+ code: alepha19.TObject<{
48
+ maxAttempts: alepha19.TInteger;
49
+ codeLength: alepha19.TInteger;
50
+ codeExpiration: alepha19.TInteger;
51
+ verificationCooldown: alepha19.TInteger;
52
+ limitPerDay: alepha19.TInteger;
53
53
  }>;
54
- link: alepha52.TObject<{
55
- maxAttempts: alepha52.TInteger;
56
- codeExpiration: alepha52.TInteger;
57
- verificationCooldown: alepha52.TInteger;
58
- limitPerDay: alepha52.TInteger;
54
+ link: alepha19.TObject<{
55
+ maxAttempts: alepha19.TInteger;
56
+ codeExpiration: alepha19.TInteger;
57
+ verificationCooldown: alepha19.TInteger;
58
+ limitPerDay: alepha19.TInteger;
59
59
  }>;
60
- purgeDays: alepha52.TInteger;
60
+ purgeDays: alepha19.TInteger;
61
61
  }>;
62
62
  type VerificationSettings = Static<typeof verificationSettingsSchema>;
63
63
  //#endregion
@@ -65,21 +65,21 @@ type VerificationSettings = Static<typeof verificationSettingsSchema>;
65
65
  /**
66
66
  * Verification settings configuration atom
67
67
  */
68
- declare const verificationOptions: alepha52.Atom<alepha52.TObject<{
69
- code: alepha52.TObject<{
70
- maxAttempts: alepha52.TInteger;
71
- codeLength: alepha52.TInteger;
72
- codeExpiration: alepha52.TInteger;
73
- verificationCooldown: alepha52.TInteger;
74
- limitPerDay: alepha52.TInteger;
68
+ declare const verificationOptions: alepha19.Atom<alepha19.TObject<{
69
+ code: alepha19.TObject<{
70
+ maxAttempts: alepha19.TInteger;
71
+ codeLength: alepha19.TInteger;
72
+ codeExpiration: alepha19.TInteger;
73
+ verificationCooldown: alepha19.TInteger;
74
+ limitPerDay: alepha19.TInteger;
75
75
  }>;
76
- link: alepha52.TObject<{
77
- maxAttempts: alepha52.TInteger;
78
- codeExpiration: alepha52.TInteger;
79
- verificationCooldown: alepha52.TInteger;
80
- limitPerDay: alepha52.TInteger;
76
+ link: alepha19.TObject<{
77
+ maxAttempts: alepha19.TInteger;
78
+ codeExpiration: alepha19.TInteger;
79
+ verificationCooldown: alepha19.TInteger;
80
+ limitPerDay: alepha19.TInteger;
81
81
  }>;
82
- purgeDays: alepha52.TInteger;
82
+ purgeDays: alepha19.TInteger;
83
83
  }>, "alepha.api.verifications.options">;
84
84
  type VerificationOptions = Static<typeof verificationOptions.schema>;
85
85
  declare module "alepha" {
@@ -89,17 +89,17 @@ declare module "alepha" {
89
89
  }
90
90
  declare class VerificationParameters {
91
91
  protected readonly options: Readonly<{
92
- link: {
92
+ code: {
93
93
  codeExpiration: number;
94
94
  verificationCooldown: number;
95
95
  maxAttempts: number;
96
+ codeLength: number;
96
97
  limitPerDay: number;
97
98
  };
98
- code: {
99
+ link: {
99
100
  codeExpiration: number;
100
101
  verificationCooldown: number;
101
102
  maxAttempts: number;
102
- codeLength: number;
103
103
  limitPerDay: number;
104
104
  };
105
105
  purgeDays: number;
@@ -108,23 +108,23 @@ declare class VerificationParameters {
108
108
  }
109
109
  //#endregion
110
110
  //#region ../../src/api/verifications/schemas/requestVerificationCodeResponseSchema.d.ts
111
- declare const requestVerificationCodeResponseSchema: alepha52.TObject<{
112
- token: alepha52.TString;
113
- codeExpiration: alepha52.TInteger;
114
- verificationCooldown: alepha52.TInteger;
115
- maxVerificationAttempts: alepha52.TInteger;
111
+ declare const requestVerificationCodeResponseSchema: alepha19.TObject<{
112
+ token: alepha19.TString;
113
+ codeExpiration: alepha19.TInteger;
114
+ verificationCooldown: alepha19.TInteger;
115
+ maxVerificationAttempts: alepha19.TInteger;
116
116
  }>;
117
117
  type RequestVerificationResponse = Static<typeof requestVerificationCodeResponseSchema>;
118
118
  //#endregion
119
119
  //#region ../../src/api/verifications/schemas/validateVerificationCodeResponseSchema.d.ts
120
- declare const validateVerificationCodeResponseSchema: alepha52.TObject<{
121
- ok: alepha52.TBoolean;
122
- alreadyVerified: alepha52.TOptional<alepha52.TBoolean>;
120
+ declare const validateVerificationCodeResponseSchema: alepha19.TObject<{
121
+ ok: alepha19.TBoolean;
122
+ alreadyVerified: alepha19.TOptional<alepha19.TBoolean>;
123
123
  }>;
124
124
  type ValidateVerificationCodeResponse = Static<typeof validateVerificationCodeResponseSchema>;
125
125
  //#endregion
126
126
  //#region ../../src/api/verifications/schemas/verificationTypeEnumSchema.d.ts
127
- declare const verificationTypeEnumSchema: alepha52.TUnsafe<"link" | "code">;
127
+ declare const verificationTypeEnumSchema: alepha19.TUnsafe<"code" | "link">;
128
128
  type VerificationTypeEnum = Static<typeof verificationTypeEnumSchema>;
129
129
  //#endregion
130
130
  //#region ../../src/api/verifications/services/VerificationService.d.ts
@@ -132,38 +132,38 @@ declare class VerificationService {
132
132
  protected readonly log: alepha_logger0.Logger;
133
133
  protected readonly dateTimeProvider: DateTimeProvider;
134
134
  protected readonly verificationParameters: VerificationParameters;
135
- protected readonly verificationRepository: alepha_orm56.Repository<alepha52.TObject<{
136
- id: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_PRIMARY_KEY>, typeof alepha_orm56.PG_DEFAULT>;
137
- createdAt: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_CREATED_AT>, typeof alepha_orm56.PG_DEFAULT>;
138
- updatedAt: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_UPDATED_AT>, typeof alepha_orm56.PG_DEFAULT>;
139
- version: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TInteger, typeof alepha_orm56.PG_VERSION>, typeof alepha_orm56.PG_DEFAULT>;
140
- type: alepha52.TUnsafe<"link" | "code">;
141
- target: alepha52.TString;
142
- code: alepha52.TString;
143
- verifiedAt: alepha52.TOptional<alepha52.TString>;
144
- attempts: alepha_orm56.PgAttr<alepha52.TInteger, typeof alepha_orm56.PG_DEFAULT>;
135
+ protected readonly verificationRepository: alepha_orm0.Repository<alepha19.TObject<{
136
+ id: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_PRIMARY_KEY>, typeof alepha_orm0.PG_DEFAULT>;
137
+ createdAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_CREATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
138
+ updatedAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_UPDATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
139
+ version: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TInteger, typeof alepha_orm0.PG_VERSION>, typeof alepha_orm0.PG_DEFAULT>;
140
+ type: alepha19.TUnsafe<"code" | "link">;
141
+ target: alepha19.TString;
142
+ code: alepha19.TString;
143
+ verifiedAt: alepha19.TOptional<alepha19.TString>;
144
+ attempts: alepha_orm0.PgAttr<alepha19.TInteger, typeof alepha_orm0.PG_DEFAULT>;
145
145
  }>>;
146
146
  findByEntry(entry: VerificationEntry): Promise<VerificationEntity>;
147
- findRecentsByEntry(entry: VerificationEntry): Promise<alepha_orm56.PgStatic<alepha52.TObject<{
148
- id: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_PRIMARY_KEY>, typeof alepha_orm56.PG_DEFAULT>;
149
- createdAt: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_CREATED_AT>, typeof alepha_orm56.PG_DEFAULT>;
150
- updatedAt: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_UPDATED_AT>, typeof alepha_orm56.PG_DEFAULT>;
151
- version: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TInteger, typeof alepha_orm56.PG_VERSION>, typeof alepha_orm56.PG_DEFAULT>;
152
- type: alepha52.TUnsafe<"link" | "code">;
153
- target: alepha52.TString;
154
- code: alepha52.TString;
155
- verifiedAt: alepha52.TOptional<alepha52.TString>;
156
- attempts: alepha_orm56.PgAttr<alepha52.TInteger, typeof alepha_orm56.PG_DEFAULT>;
157
- }>, alepha_orm56.PgRelationMap<alepha52.TObject<{
158
- id: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_PRIMARY_KEY>, typeof alepha_orm56.PG_DEFAULT>;
159
- createdAt: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_CREATED_AT>, typeof alepha_orm56.PG_DEFAULT>;
160
- updatedAt: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_UPDATED_AT>, typeof alepha_orm56.PG_DEFAULT>;
161
- version: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TInteger, typeof alepha_orm56.PG_VERSION>, typeof alepha_orm56.PG_DEFAULT>;
162
- type: alepha52.TUnsafe<"link" | "code">;
163
- target: alepha52.TString;
164
- code: alepha52.TString;
165
- verifiedAt: alepha52.TOptional<alepha52.TString>;
166
- attempts: alepha_orm56.PgAttr<alepha52.TInteger, typeof alepha_orm56.PG_DEFAULT>;
147
+ findRecentsByEntry(entry: VerificationEntry): Promise<alepha_orm0.PgStatic<alepha19.TObject<{
148
+ id: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_PRIMARY_KEY>, typeof alepha_orm0.PG_DEFAULT>;
149
+ createdAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_CREATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
150
+ updatedAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_UPDATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
151
+ version: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TInteger, typeof alepha_orm0.PG_VERSION>, typeof alepha_orm0.PG_DEFAULT>;
152
+ type: alepha19.TUnsafe<"code" | "link">;
153
+ target: alepha19.TString;
154
+ code: alepha19.TString;
155
+ verifiedAt: alepha19.TOptional<alepha19.TString>;
156
+ attempts: alepha_orm0.PgAttr<alepha19.TInteger, typeof alepha_orm0.PG_DEFAULT>;
157
+ }>, alepha_orm0.PgRelationMap<alepha19.TObject<{
158
+ id: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_PRIMARY_KEY>, typeof alepha_orm0.PG_DEFAULT>;
159
+ createdAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_CREATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
160
+ updatedAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_UPDATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
161
+ version: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TInteger, typeof alepha_orm0.PG_VERSION>, typeof alepha_orm0.PG_DEFAULT>;
162
+ type: alepha19.TUnsafe<"code" | "link">;
163
+ target: alepha19.TString;
164
+ code: alepha19.TString;
165
+ verifiedAt: alepha19.TOptional<alepha19.TString>;
166
+ attempts: alepha_orm0.PgAttr<alepha19.TInteger, typeof alepha_orm0.PG_DEFAULT>;
167
167
  }>>>[]>;
168
168
  /**
169
169
  * Creates a verification entry and returns the token.
@@ -186,46 +186,46 @@ declare class VerificationController {
186
186
  readonly url = "/verifications";
187
187
  readonly group = "verifications";
188
188
  readonly requestVerificationCode: alepha_server0.ActionPrimitiveFn<{
189
- params: alepha52.TObject<{
190
- type: alepha52.TUnsafe<"link" | "code">;
189
+ params: alepha19.TObject<{
190
+ type: alepha19.TUnsafe<"code" | "link">;
191
191
  }>;
192
- body: alepha52.TObject<{
193
- target: alepha52.TString;
192
+ body: alepha19.TObject<{
193
+ target: alepha19.TString;
194
194
  }>;
195
- response: alepha52.TObject<{
196
- token: alepha52.TString;
197
- codeExpiration: alepha52.TInteger;
198
- verificationCooldown: alepha52.TInteger;
199
- maxVerificationAttempts: alepha52.TInteger;
195
+ response: alepha19.TObject<{
196
+ token: alepha19.TString;
197
+ codeExpiration: alepha19.TInteger;
198
+ verificationCooldown: alepha19.TInteger;
199
+ maxVerificationAttempts: alepha19.TInteger;
200
200
  }>;
201
201
  }>;
202
202
  readonly validateVerificationCode: alepha_server0.ActionPrimitiveFn<{
203
- params: alepha52.TObject<{
204
- type: alepha52.TUnsafe<"link" | "code">;
203
+ params: alepha19.TObject<{
204
+ type: alepha19.TUnsafe<"code" | "link">;
205
205
  }>;
206
- body: alepha52.TObject<{
207
- target: alepha52.TString;
208
- token: alepha52.TString;
206
+ body: alepha19.TObject<{
207
+ target: alepha19.TString;
208
+ token: alepha19.TString;
209
209
  }>;
210
- response: alepha52.TObject<{
211
- ok: alepha52.TBoolean;
212
- alreadyVerified: alepha52.TOptional<alepha52.TBoolean>;
210
+ response: alepha19.TObject<{
211
+ ok: alepha19.TBoolean;
212
+ alreadyVerified: alepha19.TOptional<alepha19.TBoolean>;
213
213
  }>;
214
214
  }>;
215
215
  }
216
216
  //#endregion
217
217
  //#region ../../src/api/verifications/jobs/VerificationJobs.d.ts
218
218
  declare class VerificationJobs {
219
- protected readonly verificationRepository: alepha_orm56.Repository<alepha52.TObject<{
220
- id: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_PRIMARY_KEY>, typeof alepha_orm56.PG_DEFAULT>;
221
- createdAt: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_CREATED_AT>, typeof alepha_orm56.PG_DEFAULT>;
222
- updatedAt: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TString, typeof alepha_orm56.PG_UPDATED_AT>, typeof alepha_orm56.PG_DEFAULT>;
223
- version: alepha_orm56.PgAttr<alepha_orm56.PgAttr<alepha52.TInteger, typeof alepha_orm56.PG_VERSION>, typeof alepha_orm56.PG_DEFAULT>;
224
- type: alepha52.TUnsafe<"link" | "code">;
225
- target: alepha52.TString;
226
- code: alepha52.TString;
227
- verifiedAt: alepha52.TOptional<alepha52.TString>;
228
- attempts: alepha_orm56.PgAttr<alepha52.TInteger, typeof alepha_orm56.PG_DEFAULT>;
219
+ protected readonly verificationRepository: alepha_orm0.Repository<alepha19.TObject<{
220
+ id: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_PRIMARY_KEY>, typeof alepha_orm0.PG_DEFAULT>;
221
+ createdAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_CREATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
222
+ updatedAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TString, typeof alepha_orm0.PG_UPDATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
223
+ version: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha19.TInteger, typeof alepha_orm0.PG_VERSION>, typeof alepha_orm0.PG_DEFAULT>;
224
+ type: alepha19.TUnsafe<"code" | "link">;
225
+ target: alepha19.TString;
226
+ code: alepha19.TString;
227
+ verifiedAt: alepha19.TOptional<alepha19.TString>;
228
+ attempts: alepha_orm0.PgAttr<alepha19.TInteger, typeof alepha_orm0.PG_DEFAULT>;
229
229
  }>>;
230
230
  protected readonly verificationParameters: VerificationParameters;
231
231
  protected readonly dateTimeProvider: DateTimeProvider;
@@ -234,9 +234,9 @@ declare class VerificationJobs {
234
234
  //#endregion
235
235
  //#region ../../src/api/verifications/index.d.ts
236
236
  /**
237
- * | type | quality | stability |
238
- * |------|---------|-----------|
239
- * | backend | standard | stable |
237
+ * | Stability | Since | Runtime |
238
+ * |-----------|-------|---------|
239
+ * | 3 - stable | 0.13.0 | node, bun, workerd|
240
240
  *
241
241
  * Email and phone verification workflows.
242
242
  *
@@ -248,7 +248,7 @@ declare class VerificationJobs {
248
248
  *
249
249
  * @module alepha.api.verifications
250
250
  */
251
- declare const AlephaApiVerification: alepha52.Service<alepha52.Module>;
251
+ declare const AlephaApiVerification: alepha19.Service<alepha19.Module>;
252
252
  //#endregion
253
253
  export { AlephaApiVerification, RequestVerificationResponse, ValidateVerificationCodeResponse, VerificationController, VerificationEntity, VerificationEntry, VerificationJobs, VerificationOptions, VerificationParameters, VerificationService, VerificationTypeEnum, requestVerificationCodeResponseSchema, validateVerificationCodeResponseSchema, verificationEntityInsertSchema, verificationEntitySchema, verificationOptions, verificationTypeEnumSchema, verifications };
254
254
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/api/verifications/entities/verifications.ts","../../../src/api/verifications/schemas/verificationSettingsSchema.ts","../../../src/api/verifications/parameters/VerificationParameters.ts","../../../src/api/verifications/schemas/requestVerificationCodeResponseSchema.ts","../../../src/api/verifications/schemas/validateVerificationCodeResponseSchema.ts","../../../src/api/verifications/schemas/verificationTypeEnumSchema.ts","../../../src/api/verifications/services/VerificationService.ts","../../../src/api/verifications/controllers/VerificationController.ts","../../../src/api/verifications/jobs/VerificationJobs.ts","../../../src/api/verifications/index.ts"],"mappings":";;;;;;;;;cAKa,aAAA,EAAa,YAAA,CAAA,eAAA,UAAA,OAAA;8CAwCxB,QAAA,CAAA,OAAA;;;;;;;;;;cAEW,wBAAA,WAA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AAO,iBAAA,GACN,OAAA,CAAQ,kBAAA;EAmCJ,kBAAA,CAAmB,KAAA,EAAO,iBAAA,GAAiB,OAAA,cAAA,QAAA,UAAA,OAAA;gDAAA,QAAA,CAAA,OAAA;;;;;;;;;;gDAAA,QAAA,CAAA,OAAA;;;;;;;;;;ENrD1B;;;;;EM+EX,kBAAA,CACX,KAAA,EAAO,iBAAA,GACN,OAAA,CAAQ,2BAAA;EAmEE,UAAA,CACX,KAAA,EAAO,iBAAA,EACP,IAAA,WACC,OAAA,CAAQ,gCAAA;EA+EJ,QAAA,CAAS,IAAA;EAIT,aAAA,CAAc,IAAA,EAAM,oBAAA;AAAA;AAAA,UAcZ,iBAAA;EACf,IAAA,EAAM,oBAAA;EACN,MAAA;AAAA;;;cCxPW,sBAAA;EAAA,mBACQ,mBAAA,EAAmB,mBAAA;EAAA,SAEtB,GAAA;EAAA,SACA,KAAA;EAAA,SAEA,uBAAA,iBAAuB,iBAAA;;YALD,QAAA,CAAA,OAAA;IAAA;;;;;;;;;;;WA2BtB,wBAAA,iBAAwB,iBAAA;;YAtBD,QAAA,CAAA,OAAA;IAAA;;;;;;;;;;;;;cCN5B,gBAAA;EAAA,mBACQ,sBAAA,EAAsB,YAAA,CAAA,UAAA,UAAA,OAAA;gDADd,QAAA,CAAA,OAAA;;;;;;;;;;qBAER,sBAAA,EAAsB,sBAAA;EAAA,mBACtB,gBAAA,EAAgB,gBAAA;EAAA,SAEnB,YAAA,EAFmB,iBAAA,CAEP,kBAAA;AAAA;;;;ARP9B;;;;;;;;;;;;;;cS6Ba,qBAAA,EAAqB,QAAA,CAAA,OAAA,CAQhC,QAAA,CARgC,MAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/api/verifications/entities/verifications.ts","../../../src/api/verifications/schemas/verificationSettingsSchema.ts","../../../src/api/verifications/parameters/VerificationParameters.ts","../../../src/api/verifications/schemas/requestVerificationCodeResponseSchema.ts","../../../src/api/verifications/schemas/validateVerificationCodeResponseSchema.ts","../../../src/api/verifications/schemas/verificationTypeEnumSchema.ts","../../../src/api/verifications/services/VerificationService.ts","../../../src/api/verifications/controllers/VerificationController.ts","../../../src/api/verifications/jobs/VerificationJobs.ts","../../../src/api/verifications/index.ts"],"mappings":";;;;;;;;;cAKa,aAAA,EAAa,WAAA,CAAA,eAAA,UAAA,OAAA;4CAwCxB,QAAA,CAAA,OAAA;;;;;;;;;;cAEW,wBAAA,WAAwB,OAAA;4CAAuB,QAAA,CAAA,OAAA;;;;;;;;;;cAC/C,8BAAA,EAA8B,WAAA,CAAA,aAAA,UAAA,OAAA;4CAA6B,QAAA,CAAA,OAAA;;;;;;;;;;KAC5D,kBAAA,GAAqB,MAAA,QAAc,aAAA,CAAc,MAAA;;;cC9ChD,0BAAA,WAA0B,OAAA;;iBAsErC,QAAA,CAAA,QAAA;;;;;;;;;;;;;;KAEU,oBAAA,GAAuB,MAAA,QAAc,0BAAA;;;;;;cChEpC,mBAAA,EAAmB,QAAA,CAAA,IAAA,UAAA,OAAA;;iBAmB9B,QAAA,CAAA,QAAA;;;;;;;;;;;;;;KAEU,mBAAA,GAAsB,MAAA,QAAc,mBAAA,CAAoB,MAAA;AAAA;EAAA,UAGxD,KAAA;IAAA,CACP,mBAAA,CAAoB,GAAA,GAAM,mBAAA;EAAA;AAAA;AAAA,cAMlB,sBAAA;EAAA,mBACQ,OAAA,EAAO,QAAA;;;;;;;;;;;;;;;;EAEnB,GAAA,iBAAoB,oBAAA,CAAA,CACzB,GAAA,EAAK,CAAA,GACJ,oBAAA,CAAqB,CAAA;AAAA;;;cC5Cb,qCAAA,WAAqC,OAAA;SAgBhD,QAAA,CAAA,OAAA;;;;;KAEU,2BAAA,GAA8B,MAAA,QACjC,qCAAA;;;cCnBI,sCAAA,WAAsC,OAAA;MASjD,QAAA,CAAA,QAAA;;;KAEU,gCAAA,GAAmC,MAAA,QACtC,sCAAA;;;cCZI,0BAAA,EAAqD,QAAA,CAA3B,OAAA;AAAA,KAC3B,oBAA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;;;cS6Ba,qBAAA,EAAqB,QAAA,CAAA,OAAA,CAQhC,QAAA,CARgC,MAAA"}
@@ -382,9 +382,9 @@ var VerificationJobs = class {
382
382
  //#endregion
383
383
  //#region ../../src/api/verifications/index.ts
384
384
  /**
385
- * | type | quality | stability |
386
- * |------|---------|-----------|
387
- * | backend | standard | stable |
385
+ * | Stability | Since | Runtime |
386
+ * |-----------|-------|---------|
387
+ * | 3 - stable | 0.13.0 | node, bun, workerd|
388
388
  *
389
389
  * Email and phone verification workflows.
390
390
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/api/verifications/schemas/requestVerificationCodeResponseSchema.ts","../../../src/api/verifications/schemas/validateVerificationCodeResponseSchema.ts","../../../src/api/verifications/schemas/verificationTypeEnumSchema.ts","../../../src/api/verifications/entities/verifications.ts","../../../src/api/verifications/schemas/verificationSettingsSchema.ts","../../../src/api/verifications/parameters/VerificationParameters.ts","../../../src/api/verifications/services/VerificationService.ts","../../../src/api/verifications/controllers/VerificationController.ts","../../../src/api/verifications/jobs/VerificationJobs.ts","../../../src/api/verifications/index.ts"],"sourcesContent":["import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\n\nexport const requestVerificationCodeResponseSchema = t.object({\n token: t.string({\n description:\n \"The verification token (6-digit code for phone, UUID for email). The caller should send this to the user via their preferred notification method.\",\n }),\n codeExpiration: t.integer({\n description: \"Time in seconds before your verification token expires.\",\n }),\n verificationCooldown: t.integer({\n description:\n \"Cooldown period in seconds before you can request another verification.\",\n }),\n maxVerificationAttempts: t.integer({\n description:\n \"Maximum number of verification attempts allowed before the token is locked.\",\n }),\n});\n\nexport type RequestVerificationResponse = Static<\n typeof requestVerificationCodeResponseSchema\n>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\n\nexport const validateVerificationCodeResponseSchema = t.object({\n ok: t.boolean({\n description: \"Indicates whether the verification was successful.\",\n }),\n alreadyVerified: t.optional(\n t.boolean({\n description: \"Indicates whether the target was already verified.\",\n }),\n ),\n});\n\nexport type ValidateVerificationCodeResponse = Static<\n typeof validateVerificationCodeResponseSchema\n>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\n\nexport const verificationTypeEnumSchema = t.enum([\"code\", \"link\"]);\nexport type VerificationTypeEnum = Static<typeof verificationTypeEnumSchema>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\nimport { $entity, db } from \"alepha/orm\";\nimport { verificationTypeEnumSchema } from \"../schemas/verificationTypeEnumSchema.ts\";\n\nexport const verifications = $entity({\n name: \"verification\",\n schema: t.object({\n id: db.primaryKey(t.bigint()),\n\n createdAt: db.createdAt(),\n\n updatedAt: db.updatedAt(),\n\n version: db.version(),\n\n type: verificationTypeEnumSchema,\n\n target: t.text({\n description: \"Can be a phone (E.164 format) or email address\",\n }),\n\n code: t.text({\n description: \"Hashed verification token (n-digit code or UUID)\",\n }),\n\n verifiedAt: t.optional(\n t.datetime({\n description: \"When it was successfully verified\",\n }),\n ),\n\n attempts: db.default(\n t.integer({\n description: \"Number of failed attempts (to prevent brute-force)\",\n }),\n 0,\n ),\n }),\n indexes: [\n \"createdAt\",\n {\n columns: [\"target\", \"code\"],\n },\n ],\n});\n\nexport const verificationEntitySchema = verifications.schema;\nexport const verificationEntityInsertSchema = verifications.insertSchema;\nexport type VerificationEntity = Static<typeof verifications.schema>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\n\nexport const verificationSettingsSchema = t.object({\n code: t.object(\n {\n maxAttempts: t.integer({\n description:\n \"Maximum number of attempts before locking the verification.\",\n minimum: 1,\n maximum: 10,\n }),\n codeLength: t.integer({\n description: \"Length of the verification code.\",\n minimum: 4,\n maximum: 12,\n }),\n codeExpiration: t.integer({\n description: \"Time in seconds before the verification code expires.\",\n minimum: 60, // 1 minute\n maximum: 3600, // 1 hour\n }),\n verificationCooldown: t.integer({\n description: \"Cooldown period in seconds after a request verification.\",\n minimum: 0,\n maximum: 3600, // 1 hour\n }),\n limitPerDay: t.integer({\n description:\n \"Maximum number of verification requests per day for one entry.\",\n minimum: 1,\n maximum: 100,\n }),\n },\n {\n description: \"Settings specific to code verifications.\",\n },\n ),\n link: t.object(\n {\n maxAttempts: t.integer({\n description:\n \"Maximum number of attempts before locking the verification.\",\n minimum: 1,\n maximum: 10,\n }),\n codeExpiration: t.integer({\n description: \"Time in seconds before the verification token expires.\",\n minimum: 60, // 1 minute\n maximum: 7200, // 2 hours\n }),\n verificationCooldown: t.integer({\n description: \"Cooldown period in seconds after a request verification.\",\n minimum: 0,\n maximum: 3600, // 1 hour\n }),\n limitPerDay: t.integer({\n description:\n \"Maximum number of verification requests per day for one entry.\",\n minimum: 1,\n maximum: 100,\n }),\n },\n {\n description: \"Settings specific to link verifications.\",\n },\n ),\n purgeDays: t.integer({\n description:\n \"Number of days after which expired verifications are automatically deleted. Set to 0 to disable auto-deletion.\",\n minimum: 0,\n maximum: 365,\n }),\n});\n\nexport type VerificationSettings = Static<typeof verificationSettingsSchema>;\n","import { $atom, $use, type Static } from \"alepha\";\nimport {\n type VerificationSettings,\n verificationSettingsSchema,\n} from \"../schemas/verificationSettingsSchema.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * Verification settings configuration atom\n */\nexport const verificationOptions = $atom({\n name: \"alepha.api.verifications.options\",\n schema: verificationSettingsSchema,\n default: {\n code: {\n maxAttempts: 5,\n codeLength: 6,\n codeExpiration: 300, // 5 minutes\n verificationCooldown: 90,\n limitPerDay: 10,\n },\n link: {\n maxAttempts: 3, // Lower since UUIDs are harder to guess\n codeExpiration: 1800, // 30 minutes\n verificationCooldown: 90,\n limitPerDay: 10,\n },\n purgeDays: 1,\n },\n});\n\nexport type VerificationOptions = Static<typeof verificationOptions.schema>;\n\ndeclare module \"alepha\" {\n interface State {\n [verificationOptions.key]: VerificationOptions;\n }\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport class VerificationParameters {\n protected readonly options = $use(verificationOptions);\n\n public get<K extends keyof VerificationSettings>(\n key: K,\n ): VerificationSettings[K] {\n return this.options[key];\n }\n}\n","import { createHash, randomInt, randomUUID } from \"node:crypto\";\nimport { $inject } from \"alepha\";\nimport { DateTimeProvider } from \"alepha/datetime\";\nimport { $logger } from \"alepha/logger\";\nimport { $repository } from \"alepha/orm\";\nimport { BadRequestError, NotFoundError } from \"alepha/server\";\nimport {\n type VerificationEntity,\n verifications,\n} from \"../entities/verifications.ts\";\nimport { VerificationParameters } from \"../parameters/VerificationParameters.ts\";\nimport type { RequestVerificationResponse } from \"../schemas/requestVerificationCodeResponseSchema.ts\";\nimport type { ValidateVerificationCodeResponse } from \"../schemas/validateVerificationCodeResponseSchema.ts\";\nimport type { VerificationTypeEnum } from \"../schemas/verificationTypeEnumSchema.ts\";\n\nexport class VerificationService {\n protected readonly log = $logger();\n protected readonly dateTimeProvider = $inject(DateTimeProvider);\n protected readonly verificationParameters = $inject(VerificationParameters);\n protected readonly verificationRepository = $repository(verifications);\n\n public async findByEntry(\n entry: VerificationEntry,\n ): Promise<VerificationEntity> {\n this.log.trace(\"Finding verification by entry\", {\n type: entry.type,\n target: entry.target,\n });\n\n const results = await this.verificationRepository.findMany({\n limit: 1, // only need the most recent entry\n orderBy: {\n column: \"createdAt\",\n direction: \"desc\",\n },\n where: {\n type: { eq: entry.type },\n target: { eq: entry.target },\n },\n });\n\n if (results.length === 0) {\n this.log.debug(\"Verification entry not found\", {\n type: entry.type,\n target: entry.target,\n });\n throw new NotFoundError(\"Verification entry not found\");\n }\n\n this.log.debug(\"Verification entry found\", {\n id: results[0].id,\n type: entry.type,\n target: entry.target,\n });\n\n return results[0];\n }\n\n public findRecentsByEntry(entry: VerificationEntry) {\n this.log.trace(\"Finding recent verifications by entry\", {\n type: entry.type,\n target: entry.target,\n });\n\n return this.verificationRepository.findMany({\n orderBy: {\n column: \"createdAt\",\n direction: \"desc\",\n },\n where: {\n type: { eq: entry.type },\n target: { eq: entry.target },\n createdAt: {\n gte: this.dateTimeProvider.now().startOf(\"day\").toISOString(),\n },\n },\n });\n }\n\n /**\n * Creates a verification entry and returns the token.\n * The caller is responsible for sending notifications with the token.\n * This allows for context-specific notifications (e.g., password reset vs email verification).\n */\n public async createVerification(\n entry: VerificationEntry,\n ): Promise<RequestVerificationResponse> {\n this.log.trace(\"Creating verification\", {\n type: entry.type,\n target: entry.target,\n });\n\n const settings = this.verificationParameters.get(entry.type);\n\n const recents = await this.findRecentsByEntry(entry);\n if (recents.length >= settings.limitPerDay) {\n this.log.warn(\"Daily verification limit reached\", {\n type: entry.type,\n target: entry.target,\n limit: settings.limitPerDay,\n count: recents.length,\n });\n throw new BadRequestError(\n `Maximum number of verification requests per day reached (${settings.limitPerDay})`,\n );\n }\n\n const existingVerification = recents[0];\n if (existingVerification) {\n const nowSec = this.dateTimeProvider.now().unix();\n const createdAtSec = this.dateTimeProvider\n .of(existingVerification.createdAt)\n .unix();\n\n const diffSec = nowSec - createdAtSec;\n if (diffSec < settings.verificationCooldown) {\n const remainingCooldown = Math.floor(\n settings.verificationCooldown - diffSec,\n );\n this.log.debug(\"Verification on cooldown\", {\n type: entry.type,\n target: entry.target,\n remainingSeconds: remainingCooldown,\n });\n throw new BadRequestError(\n `Verification is on cooldown for ${remainingCooldown} seconds`,\n );\n }\n }\n\n const token = this.generateToken(entry.type);\n\n const verification = await this.verificationRepository.create({\n type: entry.type,\n target: entry.target,\n code: this.hashCode(token),\n });\n\n this.log.info(\"Verification created\", {\n id: verification.id,\n type: entry.type,\n target: entry.target,\n expiresInSeconds: settings.codeExpiration,\n });\n\n return {\n token,\n codeExpiration: settings.codeExpiration,\n verificationCooldown: settings.verificationCooldown,\n maxVerificationAttempts: settings.maxAttempts,\n };\n }\n\n public async verifyCode(\n entry: VerificationEntry,\n code: string,\n ): Promise<ValidateVerificationCodeResponse> {\n this.log.trace(\"Verifying code\", {\n type: entry.type,\n target: entry.target,\n });\n\n const settings = this.verificationParameters.get(entry.type);\n\n const verification = await this.findByEntry(entry);\n if (verification.verifiedAt) {\n this.log.debug(\"Verification already verified\", {\n id: verification.id,\n type: entry.type,\n target: entry.target,\n verifiedAt: verification.verifiedAt,\n });\n return { ok: true, alreadyVerified: true };\n }\n\n // DO NOT DELETE THE VERIFICATION WHEN IT IS REJECTED,\n // or we won't be able to cooldown the verification\n\n const now = this.dateTimeProvider.now();\n const expirationDate = this.dateTimeProvider\n .of(verification.createdAt)\n .add(settings.codeExpiration, \"seconds\");\n\n if (now > expirationDate) {\n this.log.warn(\"Verification code expired\", {\n id: verification.id,\n type: entry.type,\n target: entry.target,\n createdAt: verification.createdAt,\n expiredAt: expirationDate.toISOString(),\n });\n throw new BadRequestError(\"Verification code has expired\");\n }\n\n if (verification.attempts >= settings.maxAttempts) {\n this.log.warn(\"Verification locked due to max attempts\", {\n id: verification.id,\n type: entry.type,\n target: entry.target,\n attempts: verification.attempts,\n maxAttempts: settings.maxAttempts,\n });\n throw new BadRequestError(\n \"Maximum number of attempts reached - verification is locked\",\n );\n }\n\n if (verification.code !== this.hashCode(code)) {\n const newAttempts = verification.attempts + 1;\n this.log.warn(\"Invalid verification code\", {\n id: verification.id,\n type: entry.type,\n target: entry.target,\n attempts: newAttempts,\n maxAttempts: settings.maxAttempts,\n });\n await this.verificationRepository.updateById(verification.id, {\n attempts: newAttempts,\n });\n throw new BadRequestError(\"Invalid verification code\");\n }\n\n await this.verificationRepository.updateById(verification.id, {\n verifiedAt: this.dateTimeProvider.nowISOString(),\n });\n\n this.log.info(\"Verification code verified\", {\n id: verification.id,\n type: entry.type,\n target: entry.target,\n });\n\n return { ok: true };\n }\n\n public hashCode(code: string): string {\n return createHash(\"sha256\").update(code).digest(\"hex\");\n }\n\n public generateToken(type: VerificationTypeEnum): string {\n if (type === \"code\") {\n const settings = this.verificationParameters.get(\"code\");\n return randomInt(0, 1_000_000)\n .toString()\n .padStart(settings.codeLength, \"0\");\n } else if (type === \"link\") {\n return randomUUID();\n }\n\n throw new BadRequestError(`Invalid verification type: ${type}`);\n }\n}\n\nexport interface VerificationEntry {\n type: VerificationTypeEnum;\n target: string;\n}\n","import { $inject, t } from \"alepha\";\nimport { $action } from \"alepha/server\";\nimport { requestVerificationCodeResponseSchema } from \"../schemas/requestVerificationCodeResponseSchema.ts\";\nimport { validateVerificationCodeResponseSchema } from \"../schemas/validateVerificationCodeResponseSchema.ts\";\nimport { verificationTypeEnumSchema } from \"../schemas/verificationTypeEnumSchema.ts\";\nimport { VerificationService } from \"../services/VerificationService.ts\";\n\nexport class VerificationController {\n protected readonly verificationService = $inject(VerificationService);\n\n public readonly url = \"/verifications\";\n public readonly group = \"verifications\";\n\n public readonly requestVerificationCode = $action({\n path: `${this.url}/:type`,\n group: this.group,\n method: \"POST\",\n secure: false,\n schema: {\n params: t.object({\n type: verificationTypeEnumSchema,\n }),\n body: t.object({\n target: t.text(),\n }),\n response: requestVerificationCodeResponseSchema,\n },\n handler: async ({ body, params }) => {\n return await this.verificationService.createVerification({\n type: params.type,\n target: body.target,\n });\n },\n });\n\n public readonly validateVerificationCode = $action({\n path: `${this.url}/:type/validate`,\n group: this.group,\n method: \"POST\",\n secure: false,\n schema: {\n params: t.object({\n type: verificationTypeEnumSchema,\n }),\n body: t.object({\n target: t.text(),\n token: t.text({\n description:\n \"The verification token (6-digit code for phone, UUID for email).\",\n }),\n }),\n response: validateVerificationCodeResponseSchema,\n },\n handler: async ({ body, params }) => {\n return this.verificationService.verifyCode(\n {\n type: params.type,\n target: body.target,\n },\n body.token,\n );\n },\n });\n}\n","import { $inject } from \"alepha\";\nimport { DateTimeProvider } from \"alepha/datetime\";\nimport { $repository } from \"alepha/orm\";\nimport { $scheduler } from \"alepha/scheduler\";\nimport { verifications } from \"../entities/verifications.ts\";\nimport { VerificationParameters } from \"../parameters/VerificationParameters.ts\";\n\nexport class VerificationJobs {\n protected readonly verificationRepository = $repository(verifications);\n protected readonly verificationParameters = $inject(VerificationParameters);\n protected readonly dateTimeProvider = $inject(DateTimeProvider);\n\n public readonly cleanExpired = $scheduler({\n cron: \"0 0 * * *\", // Every day at midnight\n description: \"Clean expired verifications\",\n handler: async () => {\n const purgeDays = this.verificationParameters.get(\"purgeDays\");\n if (purgeDays <= 0) {\n return; // Auto deletion is disabled\n }\n\n const dayMs = 24 * 60 * 60 * 1000;\n const purgeThreshold = Date.now() - purgeDays * dayMs;\n\n await this.verificationRepository.deleteMany({\n createdAt: {\n lt: this.dateTimeProvider.of(purgeThreshold).toISOString(),\n },\n });\n },\n });\n}\n","import { $module } from \"alepha\";\nimport { VerificationController } from \"./controllers/VerificationController.ts\";\nimport { VerificationJobs } from \"./jobs/VerificationJobs.ts\";\nimport { VerificationParameters } from \"./parameters/VerificationParameters.ts\";\nimport { VerificationService } from \"./services/VerificationService.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport * from \"./controllers/VerificationController.ts\";\nexport * from \"./entities/verifications.ts\";\nexport * from \"./jobs/VerificationJobs.ts\";\nexport * from \"./parameters/VerificationParameters.ts\";\nexport * from \"./schemas/requestVerificationCodeResponseSchema.ts\";\nexport * from \"./schemas/validateVerificationCodeResponseSchema.ts\";\nexport * from \"./schemas/verificationTypeEnumSchema.ts\";\nexport * from \"./services/VerificationService.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * | type | quality | stability |\n * |------|---------|-----------|\n * | backend | standard | stable |\n *\n * Email and phone verification workflows.\n *\n * **Features:**\n * - Verification token generation\n * - Verification code sending\n * - Verification completion tracking\n * - Resend functionality\n *\n * @module alepha.api.verifications\n */\nexport const AlephaApiVerification = $module({\n name: \"alepha.api.verifications\",\n services: [\n VerificationController,\n VerificationJobs,\n VerificationService,\n VerificationParameters,\n ],\n});\n"],"mappings":";;;;;;;;;AAGA,MAAa,wCAAwC,EAAE,OAAO;CAC5D,OAAO,EAAE,OAAO,EACd,aACE,qJACH,CAAC;CACF,gBAAgB,EAAE,QAAQ,EACxB,aAAa,2DACd,CAAC;CACF,sBAAsB,EAAE,QAAQ,EAC9B,aACE,2EACH,CAAC;CACF,yBAAyB,E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AW,EACT,IAAI,KAAK,iBAAiB,GAAG,eAAe,CAAC,aAAa,EAC3D,EACF,CAAC;;EAEL,CAAC;;;;;;;;;;;;;;;;;;;;ACIJ,MAAa,wBAAwB,QAAQ;CAC3C,MAAM;CACN,UAAU;EACR;EACA;EACA;EACA;EACD;CACF,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/api/verifications/schemas/requestVerificationCodeResponseSchema.ts","../../../src/api/verifications/schemas/validateVerificationCodeResponseSchema.ts","../../../src/api/verifications/schemas/verificationTypeEnumSchema.ts","../../../src/api/verifications/entities/verifications.ts","../../../src/api/verifications/schemas/verificationSettingsSchema.ts","../../../src/api/verifications/parameters/VerificationParameters.ts","../../../src/api/verifications/services/VerificationService.ts","../../../src/api/verifications/controllers/VerificationController.ts","../../../src/api/verifications/jobs/VerificationJobs.ts","../../../src/api/verifications/index.ts"],"sourcesContent":["import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\n\nexport const requestVerificationCodeResponseSchema = t.object({\n token: t.string({\n description:\n \"The verification token (6-digit code for phone, UUID for email). The caller should send this to the user via their preferred notification method.\",\n }),\n codeExpiration: t.integer({\n description: \"Time in seconds before your verification token expires.\",\n }),\n verificationCooldown: t.integer({\n description:\n \"Cooldown period in seconds before you can request another verification.\",\n }),\n maxVerificationAttempts: t.integer({\n description:\n \"Maximum number of verification attempts allowed before the token is locked.\",\n }),\n});\n\nexport type RequestVerificationResponse = Static<\n typeof requestVerificationCodeResponseSchema\n>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\n\nexport const validateVerificationCodeResponseSchema = t.object({\n ok: t.boolean({\n description: \"Indicates whether the verification was successful.\",\n }),\n alreadyVerified: t.optional(\n t.boolean({\n description: \"Indicates whether the target was already verified.\",\n }),\n ),\n});\n\nexport type ValidateVerificationCodeResponse = Static<\n typeof validateVerificationCodeResponseSchema\n>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\n\nexport const verificationTypeEnumSchema = t.enum([\"code\", \"link\"]);\nexport type VerificationTypeEnum = Static<typeof verificationTypeEnumSchema>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\nimport { $entity, db } from \"alepha/orm\";\nimport { verificationTypeEnumSchema } from \"../schemas/verificationTypeEnumSchema.ts\";\n\nexport const verifications = $entity({\n name: \"verification\",\n schema: t.object({\n id: db.primaryKey(t.bigint()),\n\n createdAt: db.createdAt(),\n\n updatedAt: db.updatedAt(),\n\n version: db.version(),\n\n type: verificationTypeEnumSchema,\n\n target: t.text({\n description: \"Can be a phone (E.164 format) or email address\",\n }),\n\n code: t.text({\n description: \"Hashed verification token (n-digit code or UUID)\",\n }),\n\n verifiedAt: t.optional(\n t.datetime({\n description: \"When it was successfully verified\",\n }),\n ),\n\n attempts: db.default(\n t.integer({\n description: \"Number of failed attempts (to prevent brute-force)\",\n }),\n 0,\n ),\n }),\n indexes: [\n \"createdAt\",\n {\n columns: [\"target\", \"code\"],\n },\n ],\n});\n\nexport const verificationEntitySchema = verifications.schema;\nexport const verificationEntityInsertSchema = verifications.insertSchema;\nexport type VerificationEntity = Static<typeof verifications.schema>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\n\nexport const verificationSettingsSchema = t.object({\n code: t.object(\n {\n maxAttempts: t.integer({\n description:\n \"Maximum number of attempts before locking the verification.\",\n minimum: 1,\n maximum: 10,\n }),\n codeLength: t.integer({\n description: \"Length of the verification code.\",\n minimum: 4,\n maximum: 12,\n }),\n codeExpiration: t.integer({\n description: \"Time in seconds before the verification code expires.\",\n minimum: 60, // 1 minute\n maximum: 3600, // 1 hour\n }),\n verificationCooldown: t.integer({\n description: \"Cooldown period in seconds after a request verification.\",\n minimum: 0,\n maximum: 3600, // 1 hour\n }),\n limitPerDay: t.integer({\n description:\n \"Maximum number of verification requests per day for one entry.\",\n minimum: 1,\n maximum: 100,\n }),\n },\n {\n description: \"Settings specific to code verifications.\",\n },\n ),\n link: t.object(\n {\n maxAttempts: t.integer({\n description:\n \"Maximum number of attempts before locking the verification.\",\n minimum: 1,\n maximum: 10,\n }),\n codeExpiration: t.integer({\n description: \"Time in seconds before the verification token expires.\",\n minimum: 60, // 1 minute\n maximum: 7200, // 2 hours\n }),\n verificationCooldown: t.integer({\n description: \"Cooldown period in seconds after a request verification.\",\n minimum: 0,\n maximum: 3600, // 1 hour\n }),\n limitPerDay: t.integer({\n description:\n \"Maximum number of verification requests per day for one entry.\",\n minimum: 1,\n maximum: 100,\n }),\n },\n {\n description: \"Settings specific to link verifications.\",\n },\n ),\n purgeDays: t.integer({\n description:\n \"Number of days after which expired verifications are automatically deleted. Set to 0 to disable auto-deletion.\",\n minimum: 0,\n maximum: 365,\n }),\n});\n\nexport type VerificationSettings = Static<typeof verificationSettingsSchema>;\n","import { $atom, $use, type Static } from \"alepha\";\nimport {\n type VerificationSettings,\n verificationSettingsSchema,\n} from \"../schemas/verificationSettingsSchema.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * Verification settings configuration atom\n */\nexport const verificationOptions = $atom({\n name: \"alepha.api.verifications.options\",\n schema: verificationSettingsSchema,\n default: {\n code: {\n maxAttempts: 5,\n codeLength: 6,\n codeExpiration: 300, // 5 minutes\n verificationCooldown: 90,\n limitPerDay: 10,\n },\n link: {\n maxAttempts: 3, // Lower since UUIDs are harder to guess\n codeExpiration: 1800, // 30 minutes\n verificationCooldown: 90,\n limitPerDay: 10,\n },\n purgeDays: 1,\n },\n});\n\nexport type VerificationOptions = Static<typeof verificationOptions.schema>;\n\ndeclare module \"alepha\" {\n interface State {\n [verificationOptions.key]: VerificationOptions;\n }\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport class VerificationParameters {\n protected readonly options = $use(verificationOptions);\n\n public get<K extends keyof VerificationSettings>(\n key: K,\n ): VerificationSettings[K] {\n return this.options[key];\n }\n}\n","import { createHash, randomInt, randomUUID } from \"node:crypto\";\nimport { $inject } from \"alepha\";\nimport { DateTimeProvider } from \"alepha/datetime\";\nimport { $logger } from \"alepha/logger\";\nimport { $repository } from \"alepha/orm\";\nimport { BadRequestError, NotFoundError } from \"alepha/server\";\nimport {\n type VerificationEntity,\n verifications,\n} from \"../entities/verifications.ts\";\nimport { VerificationParameters } from \"../parameters/VerificationParameters.ts\";\nimport type { RequestVerificationResponse } from \"../schemas/requestVerificationCodeResponseSchema.ts\";\nimport type { ValidateVerificationCodeResponse } from \"../schemas/validateVerificationCodeResponseSchema.ts\";\nimport type { VerificationTypeEnum } from \"../schemas/verificationTypeEnumSchema.ts\";\n\nexport class VerificationService {\n protected readonly log = $logger();\n protected readonly dateTimeProvider = $inject(DateTimeProvider);\n protected readonly verificationParameters = $inject(VerificationParameters);\n protected readonly verificationRepository = $repository(verifications);\n\n public async findByEntry(\n entry: VerificationEntry,\n ): Promise<VerificationEntity> {\n this.log.trace(\"Finding verification by entry\", {\n type: entry.type,\n target: entry.target,\n });\n\n const results = await this.verificationRepository.findMany({\n limit: 1, // only need the most recent entry\n orderBy: {\n column: \"createdAt\",\n direction: \"desc\",\n },\n where: {\n type: { eq: entry.type },\n target: { eq: entry.target },\n },\n });\n\n if (results.length === 0) {\n this.log.debug(\"Verification entry not found\", {\n type: entry.type,\n target: entry.target,\n });\n throw new NotFoundError(\"Verification entry not found\");\n }\n\n this.log.debug(\"Verification entry found\", {\n id: results[0].id,\n type: entry.type,\n target: entry.target,\n });\n\n return results[0];\n }\n\n public findRecentsByEntry(entry: VerificationEntry) {\n this.log.trace(\"Finding recent verifications by entry\", {\n type: entry.type,\n target: entry.target,\n });\n\n return this.verificationRepository.findMany({\n orderBy: {\n column: \"createdAt\",\n direction: \"desc\",\n },\n where: {\n type: { eq: entry.type },\n target: { eq: entry.target },\n createdAt: {\n gte: this.dateTimeProvider.now().startOf(\"day\").toISOString(),\n },\n },\n });\n }\n\n /**\n * Creates a verification entry and returns the token.\n * The caller is responsible for sending notifications with the token.\n * This allows for context-specific notifications (e.g., password reset vs email verification).\n */\n public async createVerification(\n entry: VerificationEntry,\n ): Promise<RequestVerificationResponse> {\n this.log.trace(\"Creating verification\", {\n type: entry.type,\n target: entry.target,\n });\n\n const settings = this.verificationParameters.get(entry.type);\n\n const recents = await this.findRecentsByEntry(entry);\n if (recents.length >= settings.limitPerDay) {\n this.log.warn(\"Daily verification limit reached\", {\n type: entry.type,\n target: entry.target,\n limit: settings.limitPerDay,\n count: recents.length,\n });\n throw new BadRequestError(\n `Maximum number of verification requests per day reached (${settings.limitPerDay})`,\n );\n }\n\n const existingVerification = recents[0];\n if (existingVerification) {\n const nowSec = this.dateTimeProvider.now().unix();\n const createdAtSec = this.dateTimeProvider\n .of(existingVerification.createdAt)\n .unix();\n\n const diffSec = nowSec - createdAtSec;\n if (diffSec < settings.verificationCooldown) {\n const remainingCooldown = Math.floor(\n settings.verificationCooldown - diffSec,\n );\n this.log.debug(\"Verification on cooldown\", {\n type: entry.type,\n target: entry.target,\n remainingSeconds: remainingCooldown,\n });\n throw new BadRequestError(\n `Verification is on cooldown for ${remainingCooldown} seconds`,\n );\n }\n }\n\n const token = this.generateToken(entry.type);\n\n const verification = await this.verificationRepository.create({\n type: entry.type,\n target: entry.target,\n code: this.hashCode(token),\n });\n\n this.log.info(\"Verification created\", {\n id: verification.id,\n type: entry.type,\n target: entry.target,\n expiresInSeconds: settings.codeExpiration,\n });\n\n return {\n token,\n codeExpiration: settings.codeExpiration,\n verificationCooldown: settings.verificationCooldown,\n maxVerificationAttempts: settings.maxAttempts,\n };\n }\n\n public async verifyCode(\n entry: VerificationEntry,\n code: string,\n ): Promise<ValidateVerificationCodeResponse> {\n this.log.trace(\"Verifying code\", {\n type: entry.type,\n target: entry.target,\n });\n\n const settings = this.verificationParameters.get(entry.type);\n\n const verification = await this.findByEntry(entry);\n if (verification.verifiedAt) {\n this.log.debug(\"Verification already verified\", {\n id: verification.id,\n type: entry.type,\n target: entry.target,\n verifiedAt: verification.verifiedAt,\n });\n return { ok: true, alreadyVerified: true };\n }\n\n // DO NOT DELETE THE VERIFICATION WHEN IT IS REJECTED,\n // or we won't be able to cooldown the verification\n\n const now = this.dateTimeProvider.now();\n const expirationDate = this.dateTimeProvider\n .of(verification.createdAt)\n .add(settings.codeExpiration, \"seconds\");\n\n if (now > expirationDate) {\n this.log.warn(\"Verification code expired\", {\n id: verification.id,\n type: entry.type,\n target: entry.target,\n createdAt: verification.createdAt,\n expiredAt: expirationDate.toISOString(),\n });\n throw new BadRequestError(\"Verification code has expired\");\n }\n\n if (verification.attempts >= settings.maxAttempts) {\n this.log.warn(\"Verification locked due to max attempts\", {\n id: verification.id,\n type: entry.type,\n target: entry.target,\n attempts: verification.attempts,\n maxAttempts: settings.maxAttempts,\n });\n throw new BadRequestError(\n \"Maximum number of attempts reached - verification is locked\",\n );\n }\n\n if (verification.code !== this.hashCode(code)) {\n const newAttempts = verification.attempts + 1;\n this.log.warn(\"Invalid verification code\", {\n id: verification.id,\n type: entry.type,\n target: entry.target,\n attempts: newAttempts,\n maxAttempts: settings.maxAttempts,\n });\n await this.verificationRepository.updateById(verification.id, {\n attempts: newAttempts,\n });\n throw new BadRequestError(\"Invalid verification code\");\n }\n\n await this.verificationRepository.updateById(verification.id, {\n verifiedAt: this.dateTimeProvider.nowISOString(),\n });\n\n this.log.info(\"Verification code verified\", {\n id: verification.id,\n type: entry.type,\n target: entry.target,\n });\n\n return { ok: true };\n }\n\n public hashCode(code: string): string {\n return createHash(\"sha256\").update(code).digest(\"hex\");\n }\n\n public generateToken(type: VerificationTypeEnum): string {\n if (type === \"code\") {\n const settings = this.verificationParameters.get(\"code\");\n return randomInt(0, 1_000_000)\n .toString()\n .padStart(settings.codeLength, \"0\");\n } else if (type === \"link\") {\n return randomUUID();\n }\n\n throw new BadRequestError(`Invalid verification type: ${type}`);\n }\n}\n\nexport interface VerificationEntry {\n type: VerificationTypeEnum;\n target: string;\n}\n","import { $inject, t } from \"alepha\";\nimport { $action } from \"alepha/server\";\nimport { requestVerificationCodeResponseSchema } from \"../schemas/requestVerificationCodeResponseSchema.ts\";\nimport { validateVerificationCodeResponseSchema } from \"../schemas/validateVerificationCodeResponseSchema.ts\";\nimport { verificationTypeEnumSchema } from \"../schemas/verificationTypeEnumSchema.ts\";\nimport { VerificationService } from \"../services/VerificationService.ts\";\n\nexport class VerificationController {\n protected readonly verificationService = $inject(VerificationService);\n\n public readonly url = \"/verifications\";\n public readonly group = \"verifications\";\n\n public readonly requestVerificationCode = $action({\n path: `${this.url}/:type`,\n group: this.group,\n method: \"POST\",\n secure: false,\n schema: {\n params: t.object({\n type: verificationTypeEnumSchema,\n }),\n body: t.object({\n target: t.text(),\n }),\n response: requestVerificationCodeResponseSchema,\n },\n handler: async ({ body, params }) => {\n return await this.verificationService.createVerification({\n type: params.type,\n target: body.target,\n });\n },\n });\n\n public readonly validateVerificationCode = $action({\n path: `${this.url}/:type/validate`,\n group: this.group,\n method: \"POST\",\n secure: false,\n schema: {\n params: t.object({\n type: verificationTypeEnumSchema,\n }),\n body: t.object({\n target: t.text(),\n token: t.text({\n description:\n \"The verification token (6-digit code for phone, UUID for email).\",\n }),\n }),\n response: validateVerificationCodeResponseSchema,\n },\n handler: async ({ body, params }) => {\n return this.verificationService.verifyCode(\n {\n type: params.type,\n target: body.target,\n },\n body.token,\n );\n },\n });\n}\n","import { $inject } from \"alepha\";\nimport { DateTimeProvider } from \"alepha/datetime\";\nimport { $repository } from \"alepha/orm\";\nimport { $scheduler } from \"alepha/scheduler\";\nimport { verifications } from \"../entities/verifications.ts\";\nimport { VerificationParameters } from \"../parameters/VerificationParameters.ts\";\n\nexport class VerificationJobs {\n protected readonly verificationRepository = $repository(verifications);\n protected readonly verificationParameters = $inject(VerificationParameters);\n protected readonly dateTimeProvider = $inject(DateTimeProvider);\n\n public readonly cleanExpired = $scheduler({\n cron: \"0 0 * * *\", // Every day at midnight\n description: \"Clean expired verifications\",\n handler: async () => {\n const purgeDays = this.verificationParameters.get(\"purgeDays\");\n if (purgeDays <= 0) {\n return; // Auto deletion is disabled\n }\n\n const dayMs = 24 * 60 * 60 * 1000;\n const purgeThreshold = Date.now() - purgeDays * dayMs;\n\n await this.verificationRepository.deleteMany({\n createdAt: {\n lt: this.dateTimeProvider.of(purgeThreshold).toISOString(),\n },\n });\n },\n });\n}\n","import { $module } from \"alepha\";\nimport { VerificationController } from \"./controllers/VerificationController.ts\";\nimport { VerificationJobs } from \"./jobs/VerificationJobs.ts\";\nimport { VerificationParameters } from \"./parameters/VerificationParameters.ts\";\nimport { VerificationService } from \"./services/VerificationService.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport * from \"./controllers/VerificationController.ts\";\nexport * from \"./entities/verifications.ts\";\nexport * from \"./jobs/VerificationJobs.ts\";\nexport * from \"./parameters/VerificationParameters.ts\";\nexport * from \"./schemas/requestVerificationCodeResponseSchema.ts\";\nexport * from \"./schemas/validateVerificationCodeResponseSchema.ts\";\nexport * from \"./schemas/verificationTypeEnumSchema.ts\";\nexport * from \"./services/VerificationService.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * | Stability | Since | Runtime |\n * |-----------|-------|---------|\n * | 3 - stable | 0.13.0 | node, bun, workerd|\n *\n * Email and phone verification workflows.\n *\n * **Features:**\n * - Verification token generation\n * - Verification code sending\n * - Verification completion tracking\n * - Resend functionality\n *\n * @module alepha.api.verifications\n */\nexport const AlephaApiVerification = $module({\n name: \"alepha.api.verifications\",\n services: [\n VerificationController,\n VerificationJobs,\n VerificationService,\n VerificationParameters,\n ],\n});\n"],"mappings":";;;;;;;;;AAGA,MAAa,wCAAwC,EAAE,OAAO;CAC5D,OAAO,EAAE,OAAO,EACd,aACE,qJACH,CAAC;CACF,gBAAgB,EAAE,QAAQ,EACxB,aAAa,2DACd,CAAC;CACF,sBAAsB,EAAE,QAAQ,EAC9B,aACE,2EACH,CAAC;CACF,yBAAyB,EAAE,QAAQ,EACjC,aACE,+EACH,CAAC;CACH,CAAC;;;;AChBF,MAAa,yCAAyC,EAAE,OAAO;CAC7D,IAAI,EAAE,QAAQ,EACZ,aAAa,s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BAAwB,QAAQ;CAC3C,MAAM;CACN,UAAU;EACR;EACA;EACA;EACA;EACD;CACF,CAAC"}
@@ -290,9 +290,9 @@ declare class BatchPrimitive<TItem extends TSchema, TResponse = any> extends Pri
290
290
  //#endregion
291
291
  //#region ../../src/batch/index.d.ts
292
292
  /**
293
- * | type | quality | stability |
294
- * |------|---------|-----------|
295
- * | backend | standard | stable |
293
+ * | Stability | Since | Runtime |
294
+ * |-----------|-------|---------|
295
+ * | 3 - stable | 0.8.0 | node, bun|
296
296
  *
297
297
  * Batch accumulation and processing.
298
298
  *
@@ -361,9 +361,9 @@ $batch[KIND] = BatchPrimitive;
361
361
  //#endregion
362
362
  //#region ../../src/batch/index.ts
363
363
  /**
364
- * | type | quality | stability |
365
- * |------|---------|-----------|
366
- * | backend | standard | stable |
364
+ * | Stability | Since | Runtime |
365
+ * |-----------|-------|---------|
366
+ * | 3 - stable | 0.8.0 | node, bun|
367
367
  *
368
368
  * Batch accumulation and processing.
369
369
  *