alepha 0.20.5 → 0.20.7

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 (367) hide show
  1. package/AGENTS.md +0 -1
  2. package/CLAUDE.md +0 -1
  3. package/assets/agents-template.md +0 -1
  4. package/dist/api/audits/index.browser.js +1 -0
  5. package/dist/api/audits/index.browser.js.map +1 -1
  6. package/dist/api/audits/index.d.ts +701 -654
  7. package/dist/api/audits/index.d.ts.map +1 -1
  8. package/dist/api/audits/index.js +24 -1
  9. package/dist/api/audits/index.js.map +1 -1
  10. package/dist/api/files/index.browser.js +1 -0
  11. package/dist/api/files/index.browser.js.map +1 -1
  12. package/dist/api/files/index.d.ts +193 -166
  13. package/dist/api/files/index.d.ts.map +1 -1
  14. package/dist/api/files/index.js +52 -0
  15. package/dist/api/files/index.js.map +1 -1
  16. package/dist/api/jobs/index.browser.js +40 -14
  17. package/dist/api/jobs/index.browser.js.map +1 -1
  18. package/dist/api/jobs/index.d.ts +639 -333
  19. package/dist/api/jobs/index.d.ts.map +1 -1
  20. package/dist/api/jobs/index.js +495 -162
  21. package/dist/api/jobs/index.js.map +1 -1
  22. package/dist/api/keys/index.d.ts +222 -188
  23. package/dist/api/keys/index.d.ts.map +1 -1
  24. package/dist/api/keys/index.js +54 -0
  25. package/dist/api/keys/index.js.map +1 -1
  26. package/dist/api/notifications/index.d.ts +265 -236
  27. package/dist/api/notifications/index.d.ts.map +1 -1
  28. package/dist/api/notifications/index.js +55 -13
  29. package/dist/api/notifications/index.js.map +1 -1
  30. package/dist/api/organizations/index.d.ts +100 -97
  31. package/dist/api/organizations/index.d.ts.map +1 -1
  32. package/dist/api/organizations/index.js.map +1 -1
  33. package/dist/api/parameters/index.d.ts +332 -314
  34. package/dist/api/parameters/index.d.ts.map +1 -1
  35. package/dist/api/parameters/index.js +37 -0
  36. package/dist/api/parameters/index.js.map +1 -1
  37. package/dist/api/payments/index.d.ts +431 -376
  38. package/dist/api/payments/index.d.ts.map +1 -1
  39. package/dist/api/payments/index.js +202 -87
  40. package/dist/api/payments/index.js.map +1 -1
  41. package/dist/api/subscriptions/index.d.ts +1695 -0
  42. package/dist/api/subscriptions/index.d.ts.map +1 -0
  43. package/dist/api/subscriptions/index.js +1919 -0
  44. package/dist/api/subscriptions/index.js.map +1 -0
  45. package/dist/api/users/index.d.ts +1001 -844
  46. package/dist/api/users/index.d.ts.map +1 -1
  47. package/dist/api/users/index.js +237 -28
  48. package/dist/api/users/index.js.map +1 -1
  49. package/dist/api/verifications/index.d.ts +123 -122
  50. package/dist/api/verifications/index.d.ts.map +1 -1
  51. package/dist/api/verifications/index.js.map +1 -1
  52. package/dist/batch/index.js.map +1 -1
  53. package/dist/bucket/index.d.ts +21 -2
  54. package/dist/bucket/index.d.ts.map +1 -1
  55. package/dist/bucket/index.js +47 -0
  56. package/dist/bucket/index.js.map +1 -1
  57. package/dist/bucket/index.workerd.js +24 -0
  58. package/dist/bucket/index.workerd.js.map +1 -1
  59. package/dist/cache/core/index.d.ts +134 -7
  60. package/dist/cache/core/index.d.ts.map +1 -1
  61. package/dist/cache/core/index.js +181 -15
  62. package/dist/cache/core/index.js.map +1 -1
  63. package/dist/cache/core/index.workerd.js +181 -15
  64. package/dist/cache/core/index.workerd.js.map +1 -1
  65. package/dist/cache/database/index.d.ts +156 -0
  66. package/dist/cache/database/index.d.ts.map +1 -0
  67. package/dist/cache/database/index.js +266 -0
  68. package/dist/cache/database/index.js.map +1 -0
  69. package/dist/cache/redis/index.d.ts +3 -2
  70. package/dist/cache/redis/index.d.ts.map +1 -1
  71. package/dist/cache/redis/index.js.map +1 -1
  72. package/dist/captcha/index.js.map +1 -1
  73. package/dist/cli/config/index.js.map +1 -1
  74. package/dist/cli/core/index.d.ts +142 -128
  75. package/dist/cli/core/index.d.ts.map +1 -1
  76. package/dist/cli/core/index.js +160 -13
  77. package/dist/cli/core/index.js.map +1 -1
  78. package/dist/cli/devtools/index.d.ts +3 -2
  79. package/dist/cli/devtools/index.d.ts.map +1 -1
  80. package/dist/cli/devtools/index.js.map +1 -1
  81. package/dist/cli/platform/index.d.ts +346 -290
  82. package/dist/cli/platform/index.d.ts.map +1 -1
  83. package/dist/cli/platform/index.js +106 -7
  84. package/dist/cli/platform/index.js.map +1 -1
  85. package/dist/cli/vendor/index.d.ts +12 -11
  86. package/dist/cli/vendor/index.d.ts.map +1 -1
  87. package/dist/cli/vendor/index.js.map +1 -1
  88. package/dist/command/index.d.ts +6 -5
  89. package/dist/command/index.d.ts.map +1 -1
  90. package/dist/command/index.js.map +1 -1
  91. package/dist/core/index.browser.js +1 -1
  92. package/dist/core/index.browser.js.map +1 -1
  93. package/dist/core/index.d.ts +119 -118
  94. package/dist/core/index.d.ts.map +1 -1
  95. package/dist/core/index.js +1 -1
  96. package/dist/core/index.js.map +1 -1
  97. package/dist/core/index.native.js +1 -1
  98. package/dist/core/index.native.js.map +1 -1
  99. package/dist/core/index.workerd.js +1 -1
  100. package/dist/core/index.workerd.js.map +1 -1
  101. package/dist/crypto/index.browser.js.map +1 -1
  102. package/dist/crypto/index.d.ts +3 -2
  103. package/dist/crypto/index.d.ts.map +1 -1
  104. package/dist/crypto/index.js.map +1 -1
  105. package/dist/datetime/index.js.map +1 -1
  106. package/dist/email/brevo/index.js.map +1 -1
  107. package/dist/email/core/index.d.ts +3 -2
  108. package/dist/email/core/index.d.ts.map +1 -1
  109. package/dist/email/core/index.js.map +1 -1
  110. package/dist/email/core/index.workerd.js.map +1 -1
  111. package/dist/email/smtp/index.d.ts +7 -6
  112. package/dist/email/smtp/index.d.ts.map +1 -1
  113. package/dist/email/smtp/index.js.map +1 -1
  114. package/dist/fake/index.js.map +1 -1
  115. package/dist/lock/core/index.d.ts +5 -4
  116. package/dist/lock/core/index.d.ts.map +1 -1
  117. package/dist/lock/core/index.js.map +1 -1
  118. package/dist/lock/redis/index.js.map +1 -1
  119. package/dist/logger/index.d.ts +10 -9
  120. package/dist/logger/index.d.ts.map +1 -1
  121. package/dist/logger/index.js.map +1 -1
  122. package/dist/mcp/index.d.ts +9 -8
  123. package/dist/mcp/index.d.ts.map +1 -1
  124. package/dist/mcp/index.js +1 -1
  125. package/dist/mcp/index.js.map +1 -1
  126. package/dist/orm/core/index.browser.js +9 -3
  127. package/dist/orm/core/index.browser.js.map +1 -1
  128. package/dist/orm/core/index.bun.js +31 -10
  129. package/dist/orm/core/index.bun.js.map +1 -1
  130. package/dist/orm/core/index.d.ts +33 -14
  131. package/dist/orm/core/index.d.ts.map +1 -1
  132. package/dist/orm/core/index.js +31 -10
  133. package/dist/orm/core/index.js.map +1 -1
  134. package/dist/orm/postgres/index.bun.js.map +1 -1
  135. package/dist/orm/postgres/index.d.ts +6 -5
  136. package/dist/orm/postgres/index.d.ts.map +1 -1
  137. package/dist/orm/postgres/index.js.map +1 -1
  138. package/dist/queue/core/index.d.ts +5 -4
  139. package/dist/queue/core/index.d.ts.map +1 -1
  140. package/dist/queue/core/index.js.map +1 -1
  141. package/dist/queue/core/index.workerd.js.map +1 -1
  142. package/dist/queue/redis/index.d.ts +3 -2
  143. package/dist/queue/redis/index.d.ts.map +1 -1
  144. package/dist/queue/redis/index.js.map +1 -1
  145. package/dist/react/auth/index.browser.js.map +1 -1
  146. package/dist/react/auth/index.js.map +1 -1
  147. package/dist/react/core/index.js.map +1 -1
  148. package/dist/react/form/index.d.ts +5 -0
  149. package/dist/react/form/index.d.ts.map +1 -1
  150. package/dist/react/form/index.js +8 -4
  151. package/dist/react/form/index.js.map +1 -1
  152. package/dist/react/head/index.browser.js.map +1 -1
  153. package/dist/react/head/index.js.map +1 -1
  154. package/dist/react/i18n/index.d.ts +2 -1
  155. package/dist/react/i18n/index.d.ts.map +1 -1
  156. package/dist/react/i18n/index.js.map +1 -1
  157. package/dist/react/intro/index.js.map +1 -1
  158. package/dist/react/router/index.browser.js.map +1 -1
  159. package/dist/react/router/index.d.ts +206 -205
  160. package/dist/react/router/index.d.ts.map +1 -1
  161. package/dist/react/router/index.js.map +1 -1
  162. package/dist/react/testing/index.js.map +1 -1
  163. package/dist/react/ui/index.d.ts +11 -11
  164. package/dist/react/ui/index.d.ts.map +1 -1
  165. package/dist/react/ui/index.js.map +1 -1
  166. package/dist/redis/index.bun.js.map +1 -1
  167. package/dist/redis/index.js.map +1 -1
  168. package/dist/retry/index.js.map +1 -1
  169. package/dist/router/index.js.map +1 -1
  170. package/dist/scheduler/index.d.ts +25 -2
  171. package/dist/scheduler/index.d.ts.map +1 -1
  172. package/dist/scheduler/index.js +12 -0
  173. package/dist/scheduler/index.js.map +1 -1
  174. package/dist/scheduler/index.workerd.js +12 -0
  175. package/dist/scheduler/index.workerd.js.map +1 -1
  176. package/dist/security/index.browser.js +29 -1
  177. package/dist/security/index.browser.js.map +1 -1
  178. package/dist/security/index.d.ts +82 -35
  179. package/dist/security/index.d.ts.map +1 -1
  180. package/dist/security/index.js +56 -3
  181. package/dist/security/index.js.map +1 -1
  182. package/dist/server/auth/index.d.ts +163 -158
  183. package/dist/server/auth/index.d.ts.map +1 -1
  184. package/dist/server/auth/index.js +16 -4
  185. package/dist/server/auth/index.js.map +1 -1
  186. package/dist/server/cookies/index.browser.js.map +1 -1
  187. package/dist/server/cookies/index.js.map +1 -1
  188. package/dist/server/core/index.browser.js.map +1 -1
  189. package/dist/server/core/index.d.ts +35 -34
  190. package/dist/server/core/index.d.ts.map +1 -1
  191. package/dist/server/core/index.js.map +1 -1
  192. package/dist/server/cors/index.d.ts +7 -6
  193. package/dist/server/cors/index.d.ts.map +1 -1
  194. package/dist/server/cors/index.js.map +1 -1
  195. package/dist/server/etag/index.js.map +1 -1
  196. package/dist/server/health/index.d.ts +16 -15
  197. package/dist/server/health/index.d.ts.map +1 -1
  198. package/dist/server/health/index.js.map +1 -1
  199. package/dist/server/links/index.browser.js.map +1 -1
  200. package/dist/server/links/index.d.ts +51 -50
  201. package/dist/server/links/index.d.ts.map +1 -1
  202. package/dist/server/links/index.js.map +1 -1
  203. package/dist/server/metrics/index.js.map +1 -1
  204. package/dist/server/proxy/index.js.map +1 -1
  205. package/dist/server/rate-limit/index.d.ts +6 -5
  206. package/dist/server/rate-limit/index.d.ts.map +1 -1
  207. package/dist/server/rate-limit/index.js.map +1 -1
  208. package/dist/server/static/index.js.map +1 -1
  209. package/dist/server/swagger/index.d.ts +2 -1
  210. package/dist/server/swagger/index.d.ts.map +1 -1
  211. package/dist/server/swagger/index.js.map +1 -1
  212. package/dist/sms/index.js.map +1 -1
  213. package/dist/system/index.browser.js.map +1 -1
  214. package/dist/system/index.js.map +1 -1
  215. package/dist/system/index.workerd.js.map +1 -1
  216. package/dist/topic/core/index.js.map +1 -1
  217. package/dist/topic/redis/index.d.ts +3 -2
  218. package/dist/topic/redis/index.d.ts.map +1 -1
  219. package/dist/topic/redis/index.js.map +1 -1
  220. package/package.json +33 -39
  221. package/src/api/audits/controllers/AdminAuditController.ts +29 -0
  222. package/src/api/audits/entities/audits.ts +1 -0
  223. package/src/api/files/controllers/FileController.ts +24 -0
  224. package/src/api/files/entities/files.ts +1 -0
  225. package/src/api/files/services/FileService.ts +41 -0
  226. package/src/api/jobs/__tests__/$job.spec.ts +501 -24
  227. package/src/api/jobs/entities/jobExecutionEntity.ts +4 -3
  228. package/src/api/jobs/index.ts +47 -10
  229. package/src/api/jobs/primitives/$job.ts +22 -9
  230. package/src/api/jobs/providers/DirectJobDispatcher.ts +71 -0
  231. package/src/api/jobs/providers/JobDispatcher.ts +49 -0
  232. package/src/api/jobs/providers/JobProvider.ts +385 -147
  233. package/src/api/jobs/providers/JobQueueProvider.ts +43 -18
  234. package/src/api/jobs/schemas/jobConfigAtom.ts +9 -3
  235. package/src/api/jobs/schemas/jobExecutionResourceSchema.ts +11 -0
  236. package/src/api/jobs/schemas/jobRegistrationSchema.ts +4 -2
  237. package/src/api/jobs/services/JobService.ts +21 -11
  238. package/src/api/keys/controllers/AdminApiKeyController.ts +23 -0
  239. package/src/api/keys/entities/apiKeyEntity.ts +1 -0
  240. package/src/api/keys/services/ApiKeyService.ts +42 -0
  241. package/src/api/notifications/__tests__/AlephaApiNotifications.spec.ts +63 -0
  242. package/src/api/notifications/controllers/AdminNotificationController.ts +48 -1
  243. package/src/api/notifications/index.ts +13 -3
  244. package/src/api/notifications/jobs/NotificationJobs.ts +0 -6
  245. package/src/api/parameters/controllers/AdminParameterController.ts +26 -0
  246. package/src/api/parameters/services/ParameterProvider.ts +18 -0
  247. package/src/api/payments/controllers/MockCheckoutController.ts +146 -0
  248. package/src/api/payments/index.ts +3 -0
  249. package/src/api/payments/providers/MemoryPaymentProvider.ts +9 -4
  250. package/src/api/payments/providers/PaymentProvider.ts +25 -9
  251. package/src/api/payments/services/PaymentService.ts +3 -0
  252. package/src/api/subscriptions/__tests__/BillingService.spec.ts +218 -0
  253. package/src/api/subscriptions/__tests__/SubscriptionService.spec.ts +278 -0
  254. package/src/api/subscriptions/controllers/AdminSubscriptionController.ts +212 -0
  255. package/src/api/subscriptions/controllers/SubscriptionController.ts +189 -0
  256. package/src/api/subscriptions/entities/subscriptionEvents.ts +54 -0
  257. package/src/api/subscriptions/entities/subscriptions.ts +68 -0
  258. package/src/api/subscriptions/index.ts +133 -0
  259. package/src/api/subscriptions/jobs/SubscriptionJobs.ts +382 -0
  260. package/src/api/subscriptions/middleware/$requireLimit.ts +50 -0
  261. package/src/api/subscriptions/middleware/$requirePlan.ts +49 -0
  262. package/src/api/subscriptions/notifications/SubscriptionNotifications.ts +110 -0
  263. package/src/api/subscriptions/schemas/cancelSubscriptionSchema.ts +8 -0
  264. package/src/api/subscriptions/schemas/changePlanSchema.ts +9 -0
  265. package/src/api/subscriptions/schemas/createSubscriptionSchema.ts +11 -0
  266. package/src/api/subscriptions/schemas/entitlementsSchema.ts +21 -0
  267. package/src/api/subscriptions/schemas/mrrSchema.ts +13 -0
  268. package/src/api/subscriptions/schemas/planDefinitionSchema.ts +71 -0
  269. package/src/api/subscriptions/schemas/planResourceSchema.ts +25 -0
  270. package/src/api/subscriptions/schemas/subscriptionEventResourceSchema.ts +8 -0
  271. package/src/api/subscriptions/schemas/subscriptionQuerySchema.ts +19 -0
  272. package/src/api/subscriptions/schemas/subscriptionResourceSchema.ts +6 -0
  273. package/src/api/subscriptions/schemas/subscriptionSettingsSchema.ts +32 -0
  274. package/src/api/subscriptions/schemas/subscriptionStatsSchema.ts +23 -0
  275. package/src/api/subscriptions/services/BillingService.ts +437 -0
  276. package/src/api/subscriptions/services/SubscriptionConfig.ts +56 -0
  277. package/src/api/subscriptions/services/SubscriptionService.ts +867 -0
  278. package/src/api/subscriptions/services/UsageService.ts +118 -0
  279. package/src/api/users/__tests__/Registration-emailMode.spec.ts +203 -0
  280. package/src/api/users/__tests__/UsernameSlugger.spec.ts +138 -0
  281. package/src/api/users/atoms/realmAuthSettingsAtom.ts +41 -3
  282. package/src/api/users/controllers/AdminSessionController.ts +29 -0
  283. package/src/api/users/controllers/AdminUserController.ts +32 -0
  284. package/src/api/users/index.ts +3 -0
  285. package/src/api/users/services/CredentialService.ts +5 -0
  286. package/src/api/users/services/RegistrationService.ts +49 -1
  287. package/src/api/users/services/SessionCrudService.ts +16 -0
  288. package/src/api/users/services/SessionService.ts +17 -59
  289. package/src/api/users/services/UsernameSlugger.ts +195 -0
  290. package/src/bucket/primitives/$bucket.ts +21 -0
  291. package/src/bucket/providers/CloudflareR2Provider.ts +15 -0
  292. package/src/bucket/providers/FileStorageProvider.ts +9 -0
  293. package/src/bucket/providers/LocalFileStorageProvider.ts +14 -0
  294. package/src/bucket/providers/MemoryFileStorageProvider.ts +9 -0
  295. package/src/bucket/providers/NodeS3BucketProvider.ts +35 -0
  296. package/src/cache/core/__tests__/$cache.memory.spec.ts +450 -0
  297. package/src/cache/core/__tests__/$cache.swr.spec.ts +394 -0
  298. package/src/cache/core/index.ts +16 -0
  299. package/src/cache/core/primitives/$cache.ts +367 -24
  300. package/src/cache/database/__tests__/DatabaseCacheProvider.behavior.spec.ts +203 -0
  301. package/src/cache/database/__tests__/DatabaseCacheProvider.spec.ts +110 -0
  302. package/src/cache/database/entities/cacheEntries.ts +55 -0
  303. package/src/cache/database/index.ts +36 -0
  304. package/src/cache/database/providers/DatabaseCacheProvider.ts +348 -0
  305. package/src/cli/core/services/ProjectScaffolder.ts +0 -2
  306. package/src/cli/core/tasks/BuildCloudflareTask.ts +33 -3
  307. package/src/cli/core/tasks/BuildSitemapTask.ts +7 -0
  308. package/src/cli/core/tasks/BuildVercelTask.ts +82 -3
  309. package/src/cli/core/templates/agentMd.ts +39 -4
  310. package/src/cli/core/templates/biomeJson.ts +25 -1
  311. package/src/cli/core/templates/saasAdminLayoutTsx.ts +2 -2
  312. package/src/cli/platform/__tests__/CloudflareAdapter.spec.ts +117 -0
  313. package/src/cli/platform/__tests__/detectResources.spec.ts +96 -0
  314. package/src/cli/platform/adapters/CloudflareAdapter.ts +104 -7
  315. package/src/cli/platform/atoms/platformOptions.ts +13 -0
  316. package/src/cli/platform/commands/platform.ts +7 -1
  317. package/src/cli/platform/schemas/platform.ts +1 -0
  318. package/src/cli/platform/services/CloudflareApi.ts +61 -0
  319. package/src/cli/platform/services/PlatformOrchestrator.ts +9 -4
  320. package/src/core/__tests__/$module.spec.ts +2 -2
  321. package/src/core/primitives/$module.ts +4 -4
  322. package/src/mcp/providers/McpServerProvider.ts +1 -1
  323. package/src/orm/core/providers/DatabaseTypeProvider.ts +9 -3
  324. package/src/orm/core/providers/drivers/DatabaseProvider.ts +1 -1
  325. package/src/orm/core/schemas/insertSchema.ts +10 -2
  326. package/src/orm/core/services/Repository.ts +27 -7
  327. package/src/react/form/hooks/useFormState.ts +8 -1
  328. package/src/react/form/index.ts +10 -1
  329. package/src/react/form/services/FormModel.ts +9 -3
  330. package/src/scheduler/index.ts +14 -0
  331. package/src/scheduler/providers/CronProvider.ts +13 -0
  332. package/src/security/atoms/currentTenantAtom.ts +34 -0
  333. package/src/security/index.browser.ts +1 -0
  334. package/src/security/index.ts +12 -1
  335. package/src/security/primitives/$issuer.ts +17 -1
  336. package/src/security/providers/SecurityProvider.ts +37 -0
  337. package/src/server/auth/__tests__/validateRedirectUri.spec.ts +78 -0
  338. package/src/server/auth/providers/ServerAuthProvider.ts +21 -5
  339. package/tsconfig.base.json +2 -1
  340. package/dist/react/websocket/index.d.ts +0 -117
  341. package/dist/react/websocket/index.d.ts.map +0 -1
  342. package/dist/react/websocket/index.js +0 -108
  343. package/dist/react/websocket/index.js.map +0 -1
  344. package/dist/websocket/index.browser.js +0 -844
  345. package/dist/websocket/index.browser.js.map +0 -1
  346. package/dist/websocket/index.d.ts +0 -876
  347. package/dist/websocket/index.d.ts.map +0 -1
  348. package/dist/websocket/index.js +0 -1175
  349. package/dist/websocket/index.js.map +0 -1
  350. package/src/react/websocket/hooks/useRoom.tsx +0 -251
  351. package/src/react/websocket/index.ts +0 -7
  352. package/src/websocket/__tests__/$channel.spec.ts +0 -30
  353. package/src/websocket/__tests__/$websocket-new.spec.ts +0 -195
  354. package/src/websocket/__tests__/RoomManager.spec.ts +0 -146
  355. package/src/websocket/__tests__/websocket-integration.spec.ts +0 -951
  356. package/src/websocket/errors/WebSocketError.ts +0 -34
  357. package/src/websocket/index.browser.ts +0 -25
  358. package/src/websocket/index.shared.ts +0 -8
  359. package/src/websocket/index.ts +0 -85
  360. package/src/websocket/interfaces/WebSocketInterfaces.ts +0 -252
  361. package/src/websocket/primitives/$channel.ts +0 -131
  362. package/src/websocket/primitives/$websocket.ts +0 -107
  363. package/src/websocket/providers/NodeWebSocketServerProvider.ts +0 -617
  364. package/src/websocket/providers/WebSocketServerProvider.ts +0 -56
  365. package/src/websocket/services/RoomManager.ts +0 -160
  366. package/src/websocket/services/WebSocketClient.ts +0 -642
  367. package/src/websocket/services/WebSocketTopicService.ts +0 -108
@@ -1,537 +1,237 @@
1
1
  import * as _$alepha from "alepha";
2
2
  import { Alepha, KIND, Primitive, Static, TNull, TObject, TOptional, TSchema, TUnion } from "alepha";
3
- import * as _$alepha_server0 from "alepha/server";
4
- import { ServerRequest } from "alepha/server";
5
3
  import * as _$alepha_orm0 from "alepha/orm";
6
4
  import { Page } from "alepha/orm";
5
+ import * as _$alepha_server0 from "alepha/server";
6
+ import { ServerRequest } from "alepha/server";
7
7
  import * as _$alepha_logger0 from "alepha/logger";
8
+ import * as _$typebox from "typebox";
8
9
  import { BuildExtraConfigColumns, SQL } from "drizzle-orm";
9
10
  import { PgColumnBuilderBase, PgSequenceOptions, PgTableExtraConfigValue, UpdateDeleteAction } from "drizzle-orm/pg-core";
10
- //#region ../../src/orm/core/schemas/insertSchema.d.ts
11
+ //#region ../../src/api/audits/entities/audits.d.ts
11
12
  /**
12
- * Transforms a TObject schema for insert operations.
13
- * All default properties at the root level are made optional.
14
- * Generated columns are excluded entirely.
15
- *
16
- * @example
17
- * Before: { name: string; age: number(default=0); fullName: generated }
18
- * After: { name: string; age?: number; }
13
+ * Audit severity levels for categorizing events.
19
14
  */
20
- type TObjectInsert<T extends TObject> = TObject<{ [K in keyof T["properties"] as T["properties"][K] extends {
21
- [PG_GENERATED]: any;
22
- } ? never : K]: T["properties"][K] extends {
23
- [PG_DEFAULT]: any;
24
- } | {
25
- "~optional": true;
26
- } ? TOptional<T["properties"][K]> : T["properties"][K] }>;
27
- //#endregion
28
- //#region ../../src/orm/core/schemas/updateSchema.d.ts
15
+ declare const auditSeveritySchema: _$typebox.TUnsafe<"info" | "warning" | "critical">;
16
+ type AuditSeverity = Static<typeof auditSeveritySchema>;
29
17
  /**
30
- * Transforms a TObject schema for update operations.
31
- * All optional properties at the root level are made nullable (i.e., `T | null`).
32
- * Generated columns are excluded entirely.
18
+ * Audit log entity for tracking important system events.
33
19
  *
34
- * @example
35
- * Before: { name?: string; age: number; fullName: generated }
36
- * After: { name?: string | null; age: number; }
20
+ * Stores comprehensive audit information including:
21
+ * - Who performed the action (userId, userRealm)
22
+ * - What happened (type, action, resource)
23
+ * - When it happened (createdAt)
24
+ * - Context and details (metadata, ipAddress, userAgent)
37
25
  */
38
- type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"] as T["properties"][K] extends {
39
- [PG_GENERATED]: any;
40
- } ? never : K]: T["properties"][K] extends TOptional<infer U> ? TOptional<TUnion<[U, TNull]>> : T["properties"][K] }>;
41
- //#endregion
42
- //#region ../../src/orm/core/primitives/$entity.d.ts
43
- interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
26
+ declare const audits: _$alepha_orm0.EntityPrimitive<_$typebox.TObject<{
27
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
28
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
29
+ organizationId: _$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_ORGANIZATION>;
44
30
  /**
45
- * The database table name that will be created for this entity.
46
- * If not provided, name will be inferred from the $repository variable name.
31
+ * Audit event type (e.g., "auth", "user", "payment", "system").
32
+ * Used for categorizing and filtering audit events.
47
33
  */
48
- name: string;
34
+ type: _$typebox.TString;
49
35
  /**
50
- * TypeBox schema defining the table structure and column types.
36
+ * Specific action performed (e.g., "login", "logout", "create", "update", "delete").
51
37
  */
52
- schema: T;
38
+ action: _$typebox.TString;
53
39
  /**
54
- * Database indexes to create for query optimization.
40
+ * Severity level of the event.
55
41
  */
56
- indexes?: (Keys | {
57
- /**
58
- * Single column to index.
59
- */
60
- column: Keys;
61
- /**
62
- * Whether this should be a unique index (enforces uniqueness constraint).
63
- */
64
- unique?: boolean;
65
- /**
66
- * Custom name for the index. If not provided, generates name automatically.
67
- */
68
- name?: string;
69
- /**
70
- * Partial index condition. Only rows matching this SQL expression are indexed.
71
- */
72
- where?: SQL;
73
- } | {
74
- /**
75
- * Multiple columns for composite index (order matters for query optimization).
76
- */
77
- columns: Keys[];
78
- /**
79
- * Whether this should be a unique index (enforces uniqueness constraint).
80
- */
81
- unique?: boolean;
82
- /**
83
- * Custom name for the index. If not provided, generates name automatically.
84
- */
85
- name?: string;
86
- /**
87
- * Partial index condition. Only rows matching this SQL expression are indexed.
88
- */
89
- where?: SQL;
90
- } | {
91
- /**
92
- * SQL expressions for expression-based indexes.
93
- *
94
- * Can include column references and SQL functions like `LOWER()`, `UPPER()`, etc.
95
- * Columns and expressions can be mixed together.
96
- *
97
- * @example
98
- * ```ts
99
- * // Case-insensitive unique username per realm
100
- * indexes: [{
101
- * expressions: (self) => [self.realm, sql`LOWER(${self.username})`],
102
- * unique: true,
103
- * name: "users_realm_username_lower_idx",
104
- * }]
105
- * ```
106
- */
107
- expressions: (self: Record<Keys & string, any>) => (SQL | any)[];
108
- /**
109
- * Whether this should be a unique index (enforces uniqueness constraint).
110
- */
111
- unique?: boolean;
112
- /**
113
- * Custom name for the index. If not provided, generates name automatically.
114
- */
115
- name: string;
116
- /**
117
- * Partial index condition. Only rows matching this SQL expression are indexed.
118
- */
119
- where?: SQL;
120
- })[];
42
+ severity: _$alepha_orm0.PgAttr<_$typebox.TUnsafe<"info" | "warning" | "critical">, typeof _$alepha_orm0.PG_DEFAULT>;
121
43
  /**
122
- * Foreign key constraints to maintain referential integrity.
44
+ * User ID who performed the action (null for system events).
123
45
  */
124
- foreignKeys?: Array<{
125
- /**
126
- * Optional name for the foreign key constraint.
127
- */
128
- name?: string;
129
- /**
130
- * Local columns that reference the foreign table.
131
- */
132
- columns: Array<keyof Static<T>>;
133
- /**
134
- * Referenced columns in the foreign table.
135
- * Must be EntityColumn references from other entities.
136
- */
137
- foreignColumns: Array<() => EntityColumn<any>>;
138
- }>;
46
+ userId: _$typebox.TOptional<_$typebox.TString>;
139
47
  /**
140
- * Additional table constraints for data validation.
141
- *
142
- * Constraints enforce business rules at the database level, providing
143
- * an additional layer of data integrity beyond application validation.
144
- *
145
- * **Constraint Types**:
146
- * - **Unique constraints**: Prevent duplicate values across columns
147
- * - **Check constraints**: Enforce custom validation rules with SQL expressions
148
- *
149
- * @example
150
- * ```ts
151
- * constraints: [
152
- * {
153
- * name: "unique_user_email",
154
- * columns: ["email"],
155
- * unique: true
156
- * },
157
- * {
158
- * name: "valid_age_range",
159
- * columns: ["age"],
160
- * check: sql`age >= 0 AND age <= 150`
161
- * },
162
- * {
163
- * name: "unique_user_username_per_tenant",
164
- * columns: ["tenantId", "username"],
165
- * unique: true
166
- * }
167
- * ]
168
- * ```
48
+ * User realm for multi-tenant support.
169
49
  */
170
- constraints?: Array<{
171
- /**
172
- * Columns involved in this constraint.
173
- */
174
- columns: Array<keyof Static<T>>;
175
- /**
176
- * Optional name for the constraint.
177
- */
178
- name?: string;
179
- /**
180
- * Whether this is a unique constraint.
181
- */
182
- unique?: boolean | {};
183
- /**
184
- * SQL expression for check constraint validation.
185
- */
186
- check?: SQL;
187
- }>;
50
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
188
51
  /**
189
- * Advanced Drizzle ORM configuration for complex table setups.
52
+ * User email at the time of the event (denormalized for history).
190
53
  */
191
- config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
192
- }
193
- declare class EntityPrimitive<T extends TObject = TObject> {
194
- readonly options: EntityPrimitiveOptions<T>;
195
- constructor(options: EntityPrimitiveOptions<T>);
196
- alias(alias: string): this;
197
- get cols(): EntityColumns<T>;
198
- get name(): string;
199
- get schema(): T;
200
- get insertSchema(): TObjectInsert<T>;
201
- get updateSchema(): TObjectUpdate<T>;
202
- }
203
- /**
204
- * Convert a schema to columns.
205
- */
206
- type FromSchema<T extends TObject> = { [key in keyof T["properties"]]: PgColumnBuilderBase };
207
- type EntityColumn<T extends TObject> = {
208
- name: string;
209
- entity: EntityPrimitive<T>;
210
- };
211
- type EntityColumns<T extends TObject> = { [key in keyof T["properties"]]: EntityColumn<T> };
212
- //#endregion
213
- //#region ../../src/orm/core/constants/PG_SYMBOLS.d.ts
214
- declare const PG_DEFAULT: unique symbol;
215
- declare const PG_PRIMARY_KEY: unique symbol;
216
- declare const PG_CREATED_AT: unique symbol;
217
- declare const PG_UPDATED_AT: unique symbol;
218
- declare const PG_DELETED_AT: unique symbol;
219
- declare const PG_VERSION: unique symbol;
220
- declare const PG_IDENTITY: unique symbol;
221
- declare const PG_ENUM: unique symbol;
222
- declare const PG_REF: unique symbol;
223
- declare const PG_GENERATED: unique symbol;
224
- declare const PG_ORGANIZATION: unique symbol;
225
- /**
226
- * @deprecated Use `PG_IDENTITY` instead.
227
- */
228
- declare const PG_SERIAL: unique symbol;
229
- type PgSymbols = {
230
- [PG_DEFAULT]: {};
231
- [PG_PRIMARY_KEY]: {};
232
- [PG_CREATED_AT]: {};
233
- [PG_UPDATED_AT]: {};
234
- [PG_DELETED_AT]: {};
235
- [PG_VERSION]: {};
236
- [PG_IDENTITY]: PgIdentityOptions;
237
- [PG_REF]: PgRefOptions;
238
- [PG_ENUM]: PgEnumOptions;
239
- [PG_GENERATED]: PgGeneratedOptions;
240
- [PG_ORGANIZATION]: {};
54
+ userEmail: _$typebox.TOptional<_$typebox.TString>;
241
55
  /**
242
- * @deprecated Use `PG_IDENTITY` instead.
56
+ * Resource type affected (e.g., "user", "order", "file").
243
57
  */
244
- [PG_SERIAL]: {};
245
- };
246
- type PgSymbolKeys = keyof PgSymbols;
247
- type PgIdentityOptions = {
248
- mode: "always" | "byDefault";
249
- } & PgSequenceOptions & {
250
- name?: string;
251
- };
252
- interface PgEnumOptions {
253
- name?: string;
254
- description?: string;
255
- }
256
- interface PgGeneratedOptions {
58
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
257
59
  /**
258
- * SQL expression for the generated column.
60
+ * Resource ID affected.
259
61
  */
260
- expression: SQL;
62
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
261
63
  /**
262
- * Storage mode for the generated column.
263
- * - `"stored"` — value is computed on write and stored on disk (default for PostgreSQL).
264
- * - `"virtual"` — value is computed on read (default for SQLite).
64
+ * Human-readable description of the event.
265
65
  */
266
- mode?: "stored" | "virtual";
267
- }
268
- interface PgRefOptions {
269
- ref: () => {
270
- name: string;
271
- entity: EntityPrimitive;
272
- };
273
- actions?: {
274
- onUpdate?: UpdateDeleteAction;
275
- onDelete?: UpdateDeleteAction;
276
- };
277
- }
278
- //#endregion
279
- //#region ../../src/orm/core/helpers/pgAttr.d.ts
280
- /**
281
- * Type representation.
282
- */
283
- type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
284
- //#endregion
285
- //#region ../../src/orm/core/schemas/databaseEnvSchema.d.ts
286
- /**
287
- * Base database environment schema.
288
- *
289
- * Defines the `DATABASE_URL` connection string used by all ORM providers
290
- * to determine the database driver and connection target.
291
- *
292
- * Supported URL formats:
293
- * - `sqlite://:memory:` or `sqlite://./path/to/db` — SQLite (Node.js or Bun)
294
- * - `postgres://user:password@host:port/database` — PostgreSQL (Node.js or Bun)
295
- * - `pglite://:memory:` or `pglite://./path` — PGlite (embedded Postgres)
296
- * - `d1://BINDING_NAME` — Cloudflare D1
297
- * - `hyperdrive://BINDING_NAME` — Cloudflare Hyperdrive
298
- */
299
- declare const databaseEnvSchema: _$alepha.TObject<{
300
- DATABASE_URL: _$alepha.TOptional<_$alepha.TString>;
301
- /**
302
- * Enable or disable push-based schema synchronization (drizzle-kit push).
303
- *
304
- * Defaults to `true` in development and test, `false` in production.
305
- * Set to `false` in development to skip automatic schema sync
306
- * (e.g. when managing migrations manually).
307
- */
308
- DATABASE_SYNC: _$alepha.TOptional<_$alepha.TBoolean>;
309
- }>;
310
- declare module "alepha" {
311
- interface Env extends Partial<Static<typeof databaseEnvSchema>> {}
312
- } //# sourceMappingURL=databaseEnvSchema.d.ts.map
313
- //#endregion
314
- //#region ../../src/api/audits/entities/audits.d.ts
315
- /**
316
- * Audit severity levels for categorizing events.
317
- */
318
- declare const auditSeveritySchema: _$alepha.TUnsafe<"info" | "warning" | "critical">;
319
- type AuditSeverity = Static<typeof auditSeveritySchema>;
320
- /**
321
- * Audit log entity for tracking important system events.
322
- *
323
- * Stores comprehensive audit information including:
324
- * - Who performed the action (userId, userRealm)
325
- * - What happened (type, action, resource)
326
- * - When it happened (createdAt)
327
- * - Context and details (metadata, ipAddress, userAgent)
328
- */
329
- declare const audits: _$alepha_orm0.EntityPrimitive<_$alepha.TObject<{
330
- id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
331
- createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
332
- /**
333
- * Audit event type (e.g., "auth", "user", "payment", "system").
334
- * Used for categorizing and filtering audit events.
335
- */
336
- type: _$alepha.TString;
337
- /**
338
- * Specific action performed (e.g., "login", "logout", "create", "update", "delete").
339
- */
340
- action: _$alepha.TString;
341
- /**
342
- * Severity level of the event.
343
- */
344
- severity: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"info" | "warning" | "critical">, typeof _$alepha_orm0.PG_DEFAULT>;
345
- /**
346
- * User ID who performed the action (null for system events).
347
- */
348
- userId: _$alepha.TOptional<_$alepha.TString>;
349
- /**
350
- * User realm for multi-tenant support.
351
- */
352
- userRealm: _$alepha.TOptional<_$alepha.TString>;
353
- /**
354
- * User email at the time of the event (denormalized for history).
355
- */
356
- userEmail: _$alepha.TOptional<_$alepha.TString>;
357
- /**
358
- * Resource type affected (e.g., "user", "order", "file").
359
- */
360
- resourceType: _$alepha.TOptional<_$alepha.TString>;
361
- /**
362
- * Resource ID affected.
363
- */
364
- resourceId: _$alepha.TOptional<_$alepha.TString>;
365
- /**
366
- * Human-readable description of the event.
367
- */
368
- description: _$alepha.TOptional<_$alepha.TString>;
66
+ description: _$typebox.TOptional<_$typebox.TString>;
369
67
  /**
370
68
  * Additional metadata/context as JSON.
371
69
  */
372
- metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
70
+ metadata: _$typebox.TOptional<_$typebox.TRecord<string, _$typebox.TAny>>;
373
71
  /**
374
72
  * Client IP address.
375
73
  */
376
- ipAddress: _$alepha.TOptional<_$alepha.TString>;
74
+ ipAddress: _$typebox.TOptional<_$typebox.TString>;
377
75
  /**
378
76
  * Client user agent.
379
77
  */
380
- userAgent: _$alepha.TOptional<_$alepha.TString>;
78
+ userAgent: _$typebox.TOptional<_$typebox.TString>;
381
79
  /**
382
80
  * Session ID if applicable.
383
81
  */
384
- sessionId: _$alepha.TOptional<_$alepha.TString>;
82
+ sessionId: _$typebox.TOptional<_$typebox.TString>;
385
83
  /**
386
84
  * Request ID for correlation.
387
85
  */
388
- requestId: _$alepha.TOptional<_$alepha.TString>;
86
+ requestId: _$typebox.TOptional<_$typebox.TString>;
389
87
  /**
390
88
  * Whether the action was successful.
391
89
  */
392
- success: _$alepha_orm0.PgAttr<_$alepha.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
90
+ success: _$alepha_orm0.PgAttr<_$typebox.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
393
91
  /**
394
92
  * Error message if the action failed.
395
93
  */
396
- errorMessage: _$alepha.TOptional<_$alepha.TString>;
94
+ errorMessage: _$typebox.TOptional<_$typebox.TString>;
397
95
  }>>;
398
- declare const auditEntitySchema: _$alepha.TObject<{
399
- id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
400
- createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
96
+ declare const auditEntitySchema: _$typebox.TObject<{
97
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
98
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
99
+ organizationId: _$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_ORGANIZATION>;
401
100
  /**
402
101
  * Audit event type (e.g., "auth", "user", "payment", "system").
403
102
  * Used for categorizing and filtering audit events.
404
103
  */
405
- type: _$alepha.TString;
104
+ type: _$typebox.TString;
406
105
  /**
407
106
  * Specific action performed (e.g., "login", "logout", "create", "update", "delete").
408
107
  */
409
- action: _$alepha.TString;
108
+ action: _$typebox.TString;
410
109
  /**
411
110
  * Severity level of the event.
412
111
  */
413
- severity: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"info" | "warning" | "critical">, typeof _$alepha_orm0.PG_DEFAULT>;
112
+ severity: _$alepha_orm0.PgAttr<_$typebox.TUnsafe<"info" | "warning" | "critical">, typeof _$alepha_orm0.PG_DEFAULT>;
414
113
  /**
415
114
  * User ID who performed the action (null for system events).
416
115
  */
417
- userId: _$alepha.TOptional<_$alepha.TString>;
116
+ userId: _$typebox.TOptional<_$typebox.TString>;
418
117
  /**
419
118
  * User realm for multi-tenant support.
420
119
  */
421
- userRealm: _$alepha.TOptional<_$alepha.TString>;
120
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
422
121
  /**
423
122
  * User email at the time of the event (denormalized for history).
424
123
  */
425
- userEmail: _$alepha.TOptional<_$alepha.TString>;
124
+ userEmail: _$typebox.TOptional<_$typebox.TString>;
426
125
  /**
427
126
  * Resource type affected (e.g., "user", "order", "file").
428
127
  */
429
- resourceType: _$alepha.TOptional<_$alepha.TString>;
128
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
430
129
  /**
431
130
  * Resource ID affected.
432
131
  */
433
- resourceId: _$alepha.TOptional<_$alepha.TString>;
132
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
434
133
  /**
435
134
  * Human-readable description of the event.
436
135
  */
437
- description: _$alepha.TOptional<_$alepha.TString>;
136
+ description: _$typebox.TOptional<_$typebox.TString>;
438
137
  /**
439
138
  * Additional metadata/context as JSON.
440
139
  */
441
- metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
140
+ metadata: _$typebox.TOptional<_$typebox.TRecord<string, _$typebox.TAny>>;
442
141
  /**
443
142
  * Client IP address.
444
143
  */
445
- ipAddress: _$alepha.TOptional<_$alepha.TString>;
144
+ ipAddress: _$typebox.TOptional<_$typebox.TString>;
446
145
  /**
447
146
  * Client user agent.
448
147
  */
449
- userAgent: _$alepha.TOptional<_$alepha.TString>;
148
+ userAgent: _$typebox.TOptional<_$typebox.TString>;
450
149
  /**
451
150
  * Session ID if applicable.
452
151
  */
453
- sessionId: _$alepha.TOptional<_$alepha.TString>;
152
+ sessionId: _$typebox.TOptional<_$typebox.TString>;
454
153
  /**
455
154
  * Request ID for correlation.
456
155
  */
457
- requestId: _$alepha.TOptional<_$alepha.TString>;
156
+ requestId: _$typebox.TOptional<_$typebox.TString>;
458
157
  /**
459
158
  * Whether the action was successful.
460
159
  */
461
- success: _$alepha_orm0.PgAttr<_$alepha.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
160
+ success: _$alepha_orm0.PgAttr<_$typebox.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
462
161
  /**
463
162
  * Error message if the action failed.
464
163
  */
465
- errorMessage: _$alepha.TOptional<_$alepha.TString>;
164
+ errorMessage: _$typebox.TOptional<_$typebox.TString>;
466
165
  }>;
467
- declare const auditEntityInsertSchema: _$alepha_orm0.TObjectInsert<_$alepha.TObject<{
468
- id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
469
- createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
166
+ declare const auditEntityInsertSchema: _$alepha_orm0.TObjectInsert<_$typebox.TObject<{
167
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
168
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
169
+ organizationId: _$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_ORGANIZATION>;
470
170
  /**
471
171
  * Audit event type (e.g., "auth", "user", "payment", "system").
472
172
  * Used for categorizing and filtering audit events.
473
173
  */
474
- type: _$alepha.TString;
174
+ type: _$typebox.TString;
475
175
  /**
476
176
  * Specific action performed (e.g., "login", "logout", "create", "update", "delete").
477
177
  */
478
- action: _$alepha.TString;
178
+ action: _$typebox.TString;
479
179
  /**
480
180
  * Severity level of the event.
481
181
  */
482
- severity: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"info" | "warning" | "critical">, typeof _$alepha_orm0.PG_DEFAULT>;
182
+ severity: _$alepha_orm0.PgAttr<_$typebox.TUnsafe<"info" | "warning" | "critical">, typeof _$alepha_orm0.PG_DEFAULT>;
483
183
  /**
484
184
  * User ID who performed the action (null for system events).
485
185
  */
486
- userId: _$alepha.TOptional<_$alepha.TString>;
186
+ userId: _$typebox.TOptional<_$typebox.TString>;
487
187
  /**
488
188
  * User realm for multi-tenant support.
489
189
  */
490
- userRealm: _$alepha.TOptional<_$alepha.TString>;
190
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
491
191
  /**
492
192
  * User email at the time of the event (denormalized for history).
493
193
  */
494
- userEmail: _$alepha.TOptional<_$alepha.TString>;
194
+ userEmail: _$typebox.TOptional<_$typebox.TString>;
495
195
  /**
496
196
  * Resource type affected (e.g., "user", "order", "file").
497
197
  */
498
- resourceType: _$alepha.TOptional<_$alepha.TString>;
198
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
499
199
  /**
500
200
  * Resource ID affected.
501
201
  */
502
- resourceId: _$alepha.TOptional<_$alepha.TString>;
202
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
503
203
  /**
504
204
  * Human-readable description of the event.
505
205
  */
506
- description: _$alepha.TOptional<_$alepha.TString>;
206
+ description: _$typebox.TOptional<_$typebox.TString>;
507
207
  /**
508
208
  * Additional metadata/context as JSON.
509
209
  */
510
- metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
210
+ metadata: _$typebox.TOptional<_$typebox.TRecord<string, _$typebox.TAny>>;
511
211
  /**
512
212
  * Client IP address.
513
213
  */
514
- ipAddress: _$alepha.TOptional<_$alepha.TString>;
214
+ ipAddress: _$typebox.TOptional<_$typebox.TString>;
515
215
  /**
516
216
  * Client user agent.
517
217
  */
518
- userAgent: _$alepha.TOptional<_$alepha.TString>;
218
+ userAgent: _$typebox.TOptional<_$typebox.TString>;
519
219
  /**
520
220
  * Session ID if applicable.
521
221
  */
522
- sessionId: _$alepha.TOptional<_$alepha.TString>;
222
+ sessionId: _$typebox.TOptional<_$typebox.TString>;
523
223
  /**
524
224
  * Request ID for correlation.
525
225
  */
526
- requestId: _$alepha.TOptional<_$alepha.TString>;
226
+ requestId: _$typebox.TOptional<_$typebox.TString>;
527
227
  /**
528
228
  * Whether the action was successful.
529
229
  */
530
- success: _$alepha_orm0.PgAttr<_$alepha.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
230
+ success: _$alepha_orm0.PgAttr<_$typebox.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
531
231
  /**
532
232
  * Error message if the action failed.
533
233
  */
534
- errorMessage: _$alepha.TOptional<_$alepha.TString>;
234
+ errorMessage: _$typebox.TOptional<_$typebox.TString>;
535
235
  }>>;
536
236
  type AuditEntity = Static<typeof audits.schema>;
537
237
  //#endregion
@@ -539,21 +239,21 @@ type AuditEntity = Static<typeof audits.schema>;
539
239
  /**
540
240
  * Query schema for searching and filtering audit logs.
541
241
  */
542
- declare const auditQuerySchema: _$alepha.TObject<{
543
- page: _$alepha.TOptional<_$alepha.TInteger>;
544
- size: _$alepha.TOptional<_$alepha.TInteger>;
545
- sort: _$alepha.TOptional<_$alepha.TString>;
546
- type: _$alepha.TOptional<_$alepha.TString>;
547
- action: _$alepha.TOptional<_$alepha.TString>;
548
- severity: _$alepha.TOptional<_$alepha.TUnsafe<"info" | "warning" | "critical">>;
549
- userId: _$alepha.TOptional<_$alepha.TString>;
550
- userRealm: _$alepha.TOptional<_$alepha.TString>;
551
- resourceType: _$alepha.TOptional<_$alepha.TString>;
552
- resourceId: _$alepha.TOptional<_$alepha.TString>;
553
- success: _$alepha.TOptional<_$alepha.TBoolean>;
554
- from: _$alepha.TOptional<_$alepha.TString>;
555
- to: _$alepha.TOptional<_$alepha.TString>;
556
- search: _$alepha.TOptional<_$alepha.TString>;
242
+ declare const auditQuerySchema: _$typebox.TObject<{
243
+ page: _$typebox.TOptional<_$typebox.TInteger>;
244
+ size: _$typebox.TOptional<_$typebox.TInteger>;
245
+ sort: _$typebox.TOptional<_$typebox.TString>;
246
+ type: _$typebox.TOptional<_$typebox.TString>;
247
+ action: _$typebox.TOptional<_$typebox.TString>;
248
+ severity: _$typebox.TOptional<_$typebox.TUnsafe<"info" | "warning" | "critical">>;
249
+ userId: _$typebox.TOptional<_$typebox.TString>;
250
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
251
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
252
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
253
+ success: _$typebox.TOptional<_$typebox.TBoolean>;
254
+ from: _$typebox.TOptional<_$typebox.TString>;
255
+ to: _$typebox.TOptional<_$typebox.TString>;
256
+ search: _$typebox.TOptional<_$typebox.TString>;
557
257
  }>;
558
258
  type AuditQuery = Static<typeof auditQuerySchema>;
559
259
  //#endregion
@@ -561,23 +261,23 @@ type AuditQuery = Static<typeof auditQuerySchema>;
561
261
  /**
562
262
  * Schema for creating a new audit log entry.
563
263
  */
564
- declare const createAuditSchema: _$alepha.TObject<{
565
- type: _$alepha.TString;
566
- action: _$alepha.TString;
567
- severity: _$alepha.TOptional<_$alepha.TUnsafe<"info" | "warning" | "critical">>;
568
- userId: _$alepha.TOptional<_$alepha.TString>;
569
- userRealm: _$alepha.TOptional<_$alepha.TString>;
570
- userEmail: _$alepha.TOptional<_$alepha.TString>;
571
- resourceType: _$alepha.TOptional<_$alepha.TString>;
572
- resourceId: _$alepha.TOptional<_$alepha.TString>;
573
- description: _$alepha.TOptional<_$alepha.TString>;
574
- metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
575
- ipAddress: _$alepha.TOptional<_$alepha.TString>;
576
- userAgent: _$alepha.TOptional<_$alepha.TString>;
577
- sessionId: _$alepha.TOptional<_$alepha.TString>;
578
- requestId: _$alepha.TOptional<_$alepha.TString>;
579
- success: _$alepha.TOptional<_$alepha.TBoolean>;
580
- errorMessage: _$alepha.TOptional<_$alepha.TString>;
264
+ declare const createAuditSchema: _$typebox.TObject<{
265
+ type: _$typebox.TString;
266
+ action: _$typebox.TString;
267
+ severity: _$typebox.TOptional<_$typebox.TUnsafe<"info" | "warning" | "critical">>;
268
+ userId: _$typebox.TOptional<_$typebox.TString>;
269
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
270
+ userEmail: _$typebox.TOptional<_$typebox.TString>;
271
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
272
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
273
+ description: _$typebox.TOptional<_$typebox.TString>;
274
+ metadata: _$typebox.TOptional<_$typebox.TRecord<string, _$typebox.TAny>>;
275
+ ipAddress: _$typebox.TOptional<_$typebox.TString>;
276
+ userAgent: _$typebox.TOptional<_$typebox.TString>;
277
+ sessionId: _$typebox.TOptional<_$typebox.TString>;
278
+ requestId: _$typebox.TOptional<_$typebox.TString>;
279
+ success: _$typebox.TOptional<_$typebox.TBoolean>;
280
+ errorMessage: _$typebox.TOptional<_$typebox.TString>;
581
281
  }>;
582
282
  type CreateAudit = Static<typeof createAuditSchema>;
583
283
  //#endregion
@@ -602,25 +302,26 @@ interface AuditTypeDefinition {
602
302
  declare class AuditService {
603
303
  protected readonly alepha: Alepha;
604
304
  protected readonly log: _$alepha_logger0.Logger;
605
- protected readonly repo: _$alepha_orm0.Repository<_$alepha.TObject<{
606
- id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
607
- createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
608
- type: _$alepha.TString;
609
- action: _$alepha.TString;
610
- severity: _$alepha_orm0.PgAttr<_$alepha.TUnsafe<"info" | "warning" | "critical">, typeof _$alepha_orm0.PG_DEFAULT>;
611
- userId: _$alepha.TOptional<_$alepha.TString>;
612
- userRealm: _$alepha.TOptional<_$alepha.TString>;
613
- userEmail: _$alepha.TOptional<_$alepha.TString>;
614
- resourceType: _$alepha.TOptional<_$alepha.TString>;
615
- resourceId: _$alepha.TOptional<_$alepha.TString>;
616
- description: _$alepha.TOptional<_$alepha.TString>;
617
- metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
618
- ipAddress: _$alepha.TOptional<_$alepha.TString>;
619
- userAgent: _$alepha.TOptional<_$alepha.TString>;
620
- sessionId: _$alepha.TOptional<_$alepha.TString>;
621
- requestId: _$alepha.TOptional<_$alepha.TString>;
622
- success: _$alepha_orm0.PgAttr<_$alepha.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
623
- errorMessage: _$alepha.TOptional<_$alepha.TString>;
305
+ protected readonly repo: _$alepha_orm0.Repository<_$typebox.TObject<{
306
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
307
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
308
+ organizationId: _$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_ORGANIZATION>;
309
+ type: _$typebox.TString;
310
+ action: _$typebox.TString;
311
+ severity: _$alepha_orm0.PgAttr<_$typebox.TUnsafe<"info" | "warning" | "critical">, typeof _$alepha_orm0.PG_DEFAULT>;
312
+ userId: _$typebox.TOptional<_$typebox.TString>;
313
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
314
+ userEmail: _$typebox.TOptional<_$typebox.TString>;
315
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
316
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
317
+ description: _$typebox.TOptional<_$typebox.TString>;
318
+ metadata: _$typebox.TOptional<_$typebox.TRecord<string, _$typebox.TAny>>;
319
+ ipAddress: _$typebox.TOptional<_$typebox.TString>;
320
+ userAgent: _$typebox.TOptional<_$typebox.TString>;
321
+ sessionId: _$typebox.TOptional<_$typebox.TString>;
322
+ requestId: _$typebox.TOptional<_$typebox.TString>;
323
+ success: _$alepha_orm0.PgAttr<_$typebox.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
324
+ errorMessage: _$typebox.TOptional<_$typebox.TString>;
624
325
  }>>;
625
326
  /**
626
327
  * Registry of audit types and their allowed actions.
@@ -721,73 +422,108 @@ declare class AdminAuditController {
721
422
  protected readonly url = "/audits";
722
423
  protected readonly group = "admin:audits";
723
424
  protected readonly auditService: AuditService;
425
+ protected readonly repo: _$alepha_orm0.Repository<_$typebox.TObject<{
426
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
427
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
428
+ organizationId: _$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_ORGANIZATION>;
429
+ type: _$typebox.TString;
430
+ action: _$typebox.TString;
431
+ severity: _$alepha_orm0.PgAttr<_$typebox.TUnsafe<"info" | "warning" | "critical">, typeof _$alepha_orm0.PG_DEFAULT>;
432
+ userId: _$typebox.TOptional<_$typebox.TString>;
433
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
434
+ userEmail: _$typebox.TOptional<_$typebox.TString>;
435
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
436
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
437
+ description: _$typebox.TOptional<_$typebox.TString>;
438
+ metadata: _$typebox.TOptional<_$typebox.TRecord<string, _$typebox.TAny>>;
439
+ ipAddress: _$typebox.TOptional<_$typebox.TString>;
440
+ userAgent: _$typebox.TOptional<_$typebox.TString>;
441
+ sessionId: _$typebox.TOptional<_$typebox.TString>;
442
+ requestId: _$typebox.TOptional<_$typebox.TString>;
443
+ success: _$alepha_orm0.PgAttr<_$typebox.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
444
+ errorMessage: _$typebox.TOptional<_$typebox.TString>;
445
+ }>>;
724
446
  /**
725
447
  * Find audit entries with filtering and pagination.
726
448
  */
727
449
  readonly findAudits: _$alepha_server0.ActionPrimitiveFn<{
728
- query: _$alepha.TObject<{
729
- page: _$alepha.TOptional<_$alepha.TInteger>;
730
- size: _$alepha.TOptional<_$alepha.TInteger>;
731
- sort: _$alepha.TOptional<_$alepha.TString>;
732
- type: _$alepha.TOptional<_$alepha.TString>;
733
- action: _$alepha.TOptional<_$alepha.TString>;
734
- severity: _$alepha.TOptional<_$alepha.TUnsafe<"info" | "warning" | "critical">>;
735
- userId: _$alepha.TOptional<_$alepha.TString>;
736
- userRealm: _$alepha.TOptional<_$alepha.TString>;
737
- resourceType: _$alepha.TOptional<_$alepha.TString>;
738
- resourceId: _$alepha.TOptional<_$alepha.TString>;
739
- success: _$alepha.TOptional<_$alepha.TBoolean>;
740
- from: _$alepha.TOptional<_$alepha.TString>;
741
- to: _$alepha.TOptional<_$alepha.TString>;
742
- search: _$alepha.TOptional<_$alepha.TString>;
450
+ query: _$typebox.TObject<{
451
+ page: _$typebox.TOptional<_$typebox.TInteger>;
452
+ size: _$typebox.TOptional<_$typebox.TInteger>;
453
+ sort: _$typebox.TOptional<_$typebox.TString>;
454
+ type: _$typebox.TOptional<_$typebox.TString>;
455
+ action: _$typebox.TOptional<_$typebox.TString>;
456
+ severity: _$typebox.TOptional<_$typebox.TUnsafe<"info" | "warning" | "critical">>;
457
+ userId: _$typebox.TOptional<_$typebox.TString>;
458
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
459
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
460
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
461
+ success: _$typebox.TOptional<_$typebox.TBoolean>;
462
+ from: _$typebox.TOptional<_$typebox.TString>;
463
+ to: _$typebox.TOptional<_$typebox.TString>;
464
+ search: _$typebox.TOptional<_$typebox.TString>;
743
465
  }>;
744
- response: _$alepha.TPage<_$alepha.TObject<{
745
- id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
746
- createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
747
- type: _$alepha.TString;
748
- action: _$alepha.TString;
749
- severity: PgAttr<_$alepha.TUnsafe<"info" | "warning" | "critical">, typeof PG_DEFAULT>;
750
- userId: _$alepha.TOptional<_$alepha.TString>;
751
- userRealm: _$alepha.TOptional<_$alepha.TString>;
752
- userEmail: _$alepha.TOptional<_$alepha.TString>;
753
- resourceType: _$alepha.TOptional<_$alepha.TString>;
754
- resourceId: _$alepha.TOptional<_$alepha.TString>;
755
- description: _$alepha.TOptional<_$alepha.TString>;
756
- metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
757
- ipAddress: _$alepha.TOptional<_$alepha.TString>;
758
- userAgent: _$alepha.TOptional<_$alepha.TString>;
759
- sessionId: _$alepha.TOptional<_$alepha.TString>;
760
- requestId: _$alepha.TOptional<_$alepha.TString>;
761
- success: PgAttr<_$alepha.TBoolean, typeof PG_DEFAULT>;
762
- errorMessage: _$alepha.TOptional<_$alepha.TString>;
466
+ response: _$alepha.TPage<_$typebox.TObject<{
467
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
468
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
469
+ organizationId: _$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_ORGANIZATION>;
470
+ type: _$typebox.TString;
471
+ action: _$typebox.TString;
472
+ severity: _$alepha_orm0.PgAttr<_$typebox.TUnsafe<"info" | "warning" | "critical">, typeof _$alepha_orm0.PG_DEFAULT>;
473
+ userId: _$typebox.TOptional<_$typebox.TString>;
474
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
475
+ userEmail: _$typebox.TOptional<_$typebox.TString>;
476
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
477
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
478
+ description: _$typebox.TOptional<_$typebox.TString>;
479
+ metadata: _$typebox.TOptional<_$typebox.TRecord<string, _$typebox.TAny>>;
480
+ ipAddress: _$typebox.TOptional<_$typebox.TString>;
481
+ userAgent: _$typebox.TOptional<_$typebox.TString>;
482
+ sessionId: _$typebox.TOptional<_$typebox.TString>;
483
+ requestId: _$typebox.TOptional<_$typebox.TString>;
484
+ success: _$alepha_orm0.PgAttr<_$typebox.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
485
+ errorMessage: _$typebox.TOptional<_$typebox.TString>;
763
486
  }>>;
764
487
  }>;
765
488
  /**
766
489
  * Get a single audit entry by ID.
767
490
  */
768
491
  readonly getAudit: _$alepha_server0.ActionPrimitiveFn<{
769
- params: _$alepha.TObject<{
770
- id: _$alepha.TString;
492
+ params: _$typebox.TObject<{
493
+ id: _$typebox.TString;
494
+ }>;
495
+ response: _$typebox.TObject<{
496
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
497
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
498
+ organizationId: _$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_ORGANIZATION>;
499
+ type: _$typebox.TString;
500
+ action: _$typebox.TString;
501
+ severity: _$alepha_orm0.PgAttr<_$typebox.TUnsafe<"info" | "warning" | "critical">, typeof _$alepha_orm0.PG_DEFAULT>;
502
+ userId: _$typebox.TOptional<_$typebox.TString>;
503
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
504
+ userEmail: _$typebox.TOptional<_$typebox.TString>;
505
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
506
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
507
+ description: _$typebox.TOptional<_$typebox.TString>;
508
+ metadata: _$typebox.TOptional<_$typebox.TRecord<string, _$typebox.TAny>>;
509
+ ipAddress: _$typebox.TOptional<_$typebox.TString>;
510
+ userAgent: _$typebox.TOptional<_$typebox.TString>;
511
+ sessionId: _$typebox.TOptional<_$typebox.TString>;
512
+ requestId: _$typebox.TOptional<_$typebox.TString>;
513
+ success: _$alepha_orm0.PgAttr<_$typebox.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
514
+ errorMessage: _$typebox.TOptional<_$typebox.TString>;
515
+ }>;
516
+ }>;
517
+ /**
518
+ * Delete many audit entries by id in one repository call. Use with care —
519
+ * audit logs are usually retained for compliance reasons.
520
+ */
521
+ readonly deleteAudits: _$alepha_server0.ActionPrimitiveFn<{
522
+ body: _$typebox.TObject<{
523
+ ids: _$typebox.TArray<_$typebox.TString>;
771
524
  }>;
772
- response: _$alepha.TObject<{
773
- id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
774
- createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
775
- type: _$alepha.TString;
776
- action: _$alepha.TString;
777
- severity: PgAttr<_$alepha.TUnsafe<"info" | "warning" | "critical">, typeof PG_DEFAULT>;
778
- userId: _$alepha.TOptional<_$alepha.TString>;
779
- userRealm: _$alepha.TOptional<_$alepha.TString>;
780
- userEmail: _$alepha.TOptional<_$alepha.TString>;
781
- resourceType: _$alepha.TOptional<_$alepha.TString>;
782
- resourceId: _$alepha.TOptional<_$alepha.TString>;
783
- description: _$alepha.TOptional<_$alepha.TString>;
784
- metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
785
- ipAddress: _$alepha.TOptional<_$alepha.TString>;
786
- userAgent: _$alepha.TOptional<_$alepha.TString>;
787
- sessionId: _$alepha.TOptional<_$alepha.TString>;
788
- requestId: _$alepha.TOptional<_$alepha.TString>;
789
- success: PgAttr<_$alepha.TBoolean, typeof PG_DEFAULT>;
790
- errorMessage: _$alepha.TOptional<_$alepha.TString>;
525
+ response: _$typebox.TObject<{
526
+ deleted: _$typebox.TArray<_$typebox.TString>;
791
527
  }>;
792
528
  }>;
793
529
  /**
@@ -795,168 +531,172 @@ declare class AdminAuditController {
795
531
  * System-only — this permission should never be assigned to human roles.
796
532
  */
797
533
  readonly createAudit: _$alepha_server0.ActionPrimitiveFn<{
798
- body: _$alepha.TObject<{
799
- type: _$alepha.TString;
800
- action: _$alepha.TString;
801
- severity: _$alepha.TOptional<_$alepha.TUnsafe<"info" | "warning" | "critical">>;
802
- userId: _$alepha.TOptional<_$alepha.TString>;
803
- userRealm: _$alepha.TOptional<_$alepha.TString>;
804
- userEmail: _$alepha.TOptional<_$alepha.TString>;
805
- resourceType: _$alepha.TOptional<_$alepha.TString>;
806
- resourceId: _$alepha.TOptional<_$alepha.TString>;
807
- description: _$alepha.TOptional<_$alepha.TString>;
808
- metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
809
- ipAddress: _$alepha.TOptional<_$alepha.TString>;
810
- userAgent: _$alepha.TOptional<_$alepha.TString>;
811
- sessionId: _$alepha.TOptional<_$alepha.TString>;
812
- requestId: _$alepha.TOptional<_$alepha.TString>;
813
- success: _$alepha.TOptional<_$alepha.TBoolean>;
814
- errorMessage: _$alepha.TOptional<_$alepha.TString>;
534
+ body: _$typebox.TObject<{
535
+ type: _$typebox.TString;
536
+ action: _$typebox.TString;
537
+ severity: _$typebox.TOptional<_$typebox.TUnsafe<"info" | "warning" | "critical">>;
538
+ userId: _$typebox.TOptional<_$typebox.TString>;
539
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
540
+ userEmail: _$typebox.TOptional<_$typebox.TString>;
541
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
542
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
543
+ description: _$typebox.TOptional<_$typebox.TString>;
544
+ metadata: _$typebox.TOptional<_$typebox.TRecord<string, _$typebox.TAny>>;
545
+ ipAddress: _$typebox.TOptional<_$typebox.TString>;
546
+ userAgent: _$typebox.TOptional<_$typebox.TString>;
547
+ sessionId: _$typebox.TOptional<_$typebox.TString>;
548
+ requestId: _$typebox.TOptional<_$typebox.TString>;
549
+ success: _$typebox.TOptional<_$typebox.TBoolean>;
550
+ errorMessage: _$typebox.TOptional<_$typebox.TString>;
815
551
  }>;
816
- response: _$alepha.TObject<{
817
- id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
818
- createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
819
- type: _$alepha.TString;
820
- action: _$alepha.TString;
821
- severity: PgAttr<_$alepha.TUnsafe<"info" | "warning" | "critical">, typeof PG_DEFAULT>;
822
- userId: _$alepha.TOptional<_$alepha.TString>;
823
- userRealm: _$alepha.TOptional<_$alepha.TString>;
824
- userEmail: _$alepha.TOptional<_$alepha.TString>;
825
- resourceType: _$alepha.TOptional<_$alepha.TString>;
826
- resourceId: _$alepha.TOptional<_$alepha.TString>;
827
- description: _$alepha.TOptional<_$alepha.TString>;
828
- metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
829
- ipAddress: _$alepha.TOptional<_$alepha.TString>;
830
- userAgent: _$alepha.TOptional<_$alepha.TString>;
831
- sessionId: _$alepha.TOptional<_$alepha.TString>;
832
- requestId: _$alepha.TOptional<_$alepha.TString>;
833
- success: PgAttr<_$alepha.TBoolean, typeof PG_DEFAULT>;
834
- errorMessage: _$alepha.TOptional<_$alepha.TString>;
552
+ response: _$typebox.TObject<{
553
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
554
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
555
+ organizationId: _$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_ORGANIZATION>;
556
+ type: _$typebox.TString;
557
+ action: _$typebox.TString;
558
+ severity: _$alepha_orm0.PgAttr<_$typebox.TUnsafe<"info" | "warning" | "critical">, typeof _$alepha_orm0.PG_DEFAULT>;
559
+ userId: _$typebox.TOptional<_$typebox.TString>;
560
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
561
+ userEmail: _$typebox.TOptional<_$typebox.TString>;
562
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
563
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
564
+ description: _$typebox.TOptional<_$typebox.TString>;
565
+ metadata: _$typebox.TOptional<_$typebox.TRecord<string, _$typebox.TAny>>;
566
+ ipAddress: _$typebox.TOptional<_$typebox.TString>;
567
+ userAgent: _$typebox.TOptional<_$typebox.TString>;
568
+ sessionId: _$typebox.TOptional<_$typebox.TString>;
569
+ requestId: _$typebox.TOptional<_$typebox.TString>;
570
+ success: _$alepha_orm0.PgAttr<_$typebox.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
571
+ errorMessage: _$typebox.TOptional<_$typebox.TString>;
835
572
  }>;
836
573
  }>;
837
574
  /**
838
575
  * Get audit entries for a specific user.
839
576
  */
840
577
  readonly findByUser: _$alepha_server0.ActionPrimitiveFn<{
841
- params: _$alepha.TObject<{
842
- userId: _$alepha.TString;
578
+ params: _$typebox.TObject<{
579
+ userId: _$typebox.TString;
843
580
  }>;
844
- query: _$alepha.TObject<{
845
- type: _$alepha.TOptional<_$alepha.TString>;
846
- search: _$alepha.TOptional<_$alepha.TString>;
847
- action: _$alepha.TOptional<_$alepha.TString>;
848
- severity: _$alepha.TOptional<_$alepha.TUnsafe<"info" | "warning" | "critical">>;
849
- sort: _$alepha.TOptional<_$alepha.TString>;
850
- userRealm: _$alepha.TOptional<_$alepha.TString>;
851
- resourceType: _$alepha.TOptional<_$alepha.TString>;
852
- resourceId: _$alepha.TOptional<_$alepha.TString>;
853
- success: _$alepha.TOptional<_$alepha.TBoolean>;
854
- page: _$alepha.TOptional<_$alepha.TInteger>;
855
- size: _$alepha.TOptional<_$alepha.TInteger>;
856
- from: _$alepha.TOptional<_$alepha.TString>;
857
- to: _$alepha.TOptional<_$alepha.TString>;
581
+ query: _$typebox.TObject<{
582
+ type: _$typebox.TOptional<_$typebox.TString>;
583
+ action: _$typebox.TOptional<_$typebox.TString>;
584
+ severity: _$typebox.TOptional<_$typebox.TUnsafe<"info" | "warning" | "critical">>;
585
+ search: _$typebox.TOptional<_$typebox.TString>;
586
+ sort: _$typebox.TOptional<_$typebox.TString>;
587
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
588
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
589
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
590
+ success: _$typebox.TOptional<_$typebox.TBoolean>;
591
+ page: _$typebox.TOptional<_$typebox.TInteger>;
592
+ size: _$typebox.TOptional<_$typebox.TInteger>;
593
+ from: _$typebox.TOptional<_$typebox.TString>;
594
+ to: _$typebox.TOptional<_$typebox.TString>;
858
595
  }>;
859
- response: _$alepha.TPage<_$alepha.TObject<{
860
- id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
861
- createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
862
- type: _$alepha.TString;
863
- action: _$alepha.TString;
864
- severity: PgAttr<_$alepha.TUnsafe<"info" | "warning" | "critical">, typeof PG_DEFAULT>;
865
- userId: _$alepha.TOptional<_$alepha.TString>;
866
- userRealm: _$alepha.TOptional<_$alepha.TString>;
867
- userEmail: _$alepha.TOptional<_$alepha.TString>;
868
- resourceType: _$alepha.TOptional<_$alepha.TString>;
869
- resourceId: _$alepha.TOptional<_$alepha.TString>;
870
- description: _$alepha.TOptional<_$alepha.TString>;
871
- metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
872
- ipAddress: _$alepha.TOptional<_$alepha.TString>;
873
- userAgent: _$alepha.TOptional<_$alepha.TString>;
874
- sessionId: _$alepha.TOptional<_$alepha.TString>;
875
- requestId: _$alepha.TOptional<_$alepha.TString>;
876
- success: PgAttr<_$alepha.TBoolean, typeof PG_DEFAULT>;
877
- errorMessage: _$alepha.TOptional<_$alepha.TString>;
596
+ response: _$alepha.TPage<_$typebox.TObject<{
597
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
598
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
599
+ organizationId: _$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_ORGANIZATION>;
600
+ type: _$typebox.TString;
601
+ action: _$typebox.TString;
602
+ severity: _$alepha_orm0.PgAttr<_$typebox.TUnsafe<"info" | "warning" | "critical">, typeof _$alepha_orm0.PG_DEFAULT>;
603
+ userId: _$typebox.TOptional<_$typebox.TString>;
604
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
605
+ userEmail: _$typebox.TOptional<_$typebox.TString>;
606
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
607
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
608
+ description: _$typebox.TOptional<_$typebox.TString>;
609
+ metadata: _$typebox.TOptional<_$typebox.TRecord<string, _$typebox.TAny>>;
610
+ ipAddress: _$typebox.TOptional<_$typebox.TString>;
611
+ userAgent: _$typebox.TOptional<_$typebox.TString>;
612
+ sessionId: _$typebox.TOptional<_$typebox.TString>;
613
+ requestId: _$typebox.TOptional<_$typebox.TString>;
614
+ success: _$alepha_orm0.PgAttr<_$typebox.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
615
+ errorMessage: _$typebox.TOptional<_$typebox.TString>;
878
616
  }>>;
879
617
  }>;
880
618
  /**
881
619
  * Get audit entries for a specific resource.
882
620
  */
883
621
  readonly findByResource: _$alepha_server0.ActionPrimitiveFn<{
884
- params: _$alepha.TObject<{
885
- resourceType: _$alepha.TString;
886
- resourceId: _$alepha.TString;
622
+ params: _$typebox.TObject<{
623
+ resourceType: _$typebox.TString;
624
+ resourceId: _$typebox.TString;
887
625
  }>;
888
- query: _$alepha.TObject<{
889
- type: _$alepha.TOptional<_$alepha.TString>;
890
- search: _$alepha.TOptional<_$alepha.TString>;
891
- action: _$alepha.TOptional<_$alepha.TString>;
892
- severity: _$alepha.TOptional<_$alepha.TUnsafe<"info" | "warning" | "critical">>;
893
- sort: _$alepha.TOptional<_$alepha.TString>;
894
- userId: _$alepha.TOptional<_$alepha.TString>;
895
- userRealm: _$alepha.TOptional<_$alepha.TString>;
896
- success: _$alepha.TOptional<_$alepha.TBoolean>;
897
- page: _$alepha.TOptional<_$alepha.TInteger>;
898
- size: _$alepha.TOptional<_$alepha.TInteger>;
899
- from: _$alepha.TOptional<_$alepha.TString>;
900
- to: _$alepha.TOptional<_$alepha.TString>;
626
+ query: _$typebox.TObject<{
627
+ type: _$typebox.TOptional<_$typebox.TString>;
628
+ action: _$typebox.TOptional<_$typebox.TString>;
629
+ severity: _$typebox.TOptional<_$typebox.TUnsafe<"info" | "warning" | "critical">>;
630
+ search: _$typebox.TOptional<_$typebox.TString>;
631
+ sort: _$typebox.TOptional<_$typebox.TString>;
632
+ userId: _$typebox.TOptional<_$typebox.TString>;
633
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
634
+ success: _$typebox.TOptional<_$typebox.TBoolean>;
635
+ page: _$typebox.TOptional<_$typebox.TInteger>;
636
+ size: _$typebox.TOptional<_$typebox.TInteger>;
637
+ from: _$typebox.TOptional<_$typebox.TString>;
638
+ to: _$typebox.TOptional<_$typebox.TString>;
901
639
  }>;
902
- response: _$alepha.TPage<_$alepha.TObject<{
903
- id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
904
- createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
905
- type: _$alepha.TString;
906
- action: _$alepha.TString;
907
- severity: PgAttr<_$alepha.TUnsafe<"info" | "warning" | "critical">, typeof PG_DEFAULT>;
908
- userId: _$alepha.TOptional<_$alepha.TString>;
909
- userRealm: _$alepha.TOptional<_$alepha.TString>;
910
- userEmail: _$alepha.TOptional<_$alepha.TString>;
911
- resourceType: _$alepha.TOptional<_$alepha.TString>;
912
- resourceId: _$alepha.TOptional<_$alepha.TString>;
913
- description: _$alepha.TOptional<_$alepha.TString>;
914
- metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
915
- ipAddress: _$alepha.TOptional<_$alepha.TString>;
916
- userAgent: _$alepha.TOptional<_$alepha.TString>;
917
- sessionId: _$alepha.TOptional<_$alepha.TString>;
918
- requestId: _$alepha.TOptional<_$alepha.TString>;
919
- success: PgAttr<_$alepha.TBoolean, typeof PG_DEFAULT>;
920
- errorMessage: _$alepha.TOptional<_$alepha.TString>;
640
+ response: _$alepha.TPage<_$typebox.TObject<{
641
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
642
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
643
+ organizationId: _$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_ORGANIZATION>;
644
+ type: _$typebox.TString;
645
+ action: _$typebox.TString;
646
+ severity: _$alepha_orm0.PgAttr<_$typebox.TUnsafe<"info" | "warning" | "critical">, typeof _$alepha_orm0.PG_DEFAULT>;
647
+ userId: _$typebox.TOptional<_$typebox.TString>;
648
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
649
+ userEmail: _$typebox.TOptional<_$typebox.TString>;
650
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
651
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
652
+ description: _$typebox.TOptional<_$typebox.TString>;
653
+ metadata: _$typebox.TOptional<_$typebox.TRecord<string, _$typebox.TAny>>;
654
+ ipAddress: _$typebox.TOptional<_$typebox.TString>;
655
+ userAgent: _$typebox.TOptional<_$typebox.TString>;
656
+ sessionId: _$typebox.TOptional<_$typebox.TString>;
657
+ requestId: _$typebox.TOptional<_$typebox.TString>;
658
+ success: _$alepha_orm0.PgAttr<_$typebox.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
659
+ errorMessage: _$typebox.TOptional<_$typebox.TString>;
921
660
  }>>;
922
661
  }>;
923
662
  /**
924
663
  * Get audit statistics.
925
664
  */
926
665
  readonly getAuditStats: _$alepha_server0.ActionPrimitiveFn<{
927
- query: _$alepha.TObject<{
928
- from: _$alepha.TOptional<_$alepha.TString>;
929
- to: _$alepha.TOptional<_$alepha.TString>;
930
- userRealm: _$alepha.TOptional<_$alepha.TString>;
666
+ query: _$typebox.TObject<{
667
+ from: _$typebox.TOptional<_$typebox.TString>;
668
+ to: _$typebox.TOptional<_$typebox.TString>;
669
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
931
670
  }>;
932
- response: _$alepha.TObject<{
933
- total: _$alepha.TInteger;
934
- byType: _$alepha.TRecord<"^.*$", _$alepha.TInteger>;
935
- bySeverity: _$alepha.TObject<{
936
- info: _$alepha.TInteger;
937
- warning: _$alepha.TInteger;
938
- critical: _$alepha.TInteger;
671
+ response: _$typebox.TObject<{
672
+ total: _$typebox.TInteger;
673
+ byType: _$typebox.TRecord<"^.*$", _$typebox.TInteger>;
674
+ bySeverity: _$typebox.TObject<{
675
+ info: _$typebox.TInteger;
676
+ warning: _$typebox.TInteger;
677
+ critical: _$typebox.TInteger;
939
678
  }>;
940
- successRate: _$alepha.TNumber;
941
- recentFailures: _$alepha.TArray<_$alepha.TObject<{
942
- id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
943
- createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
944
- type: _$alepha.TString;
945
- action: _$alepha.TString;
946
- severity: PgAttr<_$alepha.TUnsafe<"info" | "warning" | "critical">, typeof PG_DEFAULT>;
947
- userId: _$alepha.TOptional<_$alepha.TString>;
948
- userRealm: _$alepha.TOptional<_$alepha.TString>;
949
- userEmail: _$alepha.TOptional<_$alepha.TString>;
950
- resourceType: _$alepha.TOptional<_$alepha.TString>;
951
- resourceId: _$alepha.TOptional<_$alepha.TString>;
952
- description: _$alepha.TOptional<_$alepha.TString>;
953
- metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
954
- ipAddress: _$alepha.TOptional<_$alepha.TString>;
955
- userAgent: _$alepha.TOptional<_$alepha.TString>;
956
- sessionId: _$alepha.TOptional<_$alepha.TString>;
957
- requestId: _$alepha.TOptional<_$alepha.TString>;
958
- success: PgAttr<_$alepha.TBoolean, typeof PG_DEFAULT>;
959
- errorMessage: _$alepha.TOptional<_$alepha.TString>;
679
+ successRate: _$typebox.TNumber;
680
+ recentFailures: _$typebox.TArray<_$typebox.TObject<{
681
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
682
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
683
+ organizationId: _$alepha_orm0.PgAttr<_$typebox.TString, typeof _$alepha_orm0.PG_ORGANIZATION>;
684
+ type: _$typebox.TString;
685
+ action: _$typebox.TString;
686
+ severity: _$alepha_orm0.PgAttr<_$typebox.TUnsafe<"info" | "warning" | "critical">, typeof _$alepha_orm0.PG_DEFAULT>;
687
+ userId: _$typebox.TOptional<_$typebox.TString>;
688
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
689
+ userEmail: _$typebox.TOptional<_$typebox.TString>;
690
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
691
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
692
+ description: _$typebox.TOptional<_$typebox.TString>;
693
+ metadata: _$typebox.TOptional<_$typebox.TRecord<string, _$typebox.TAny>>;
694
+ ipAddress: _$typebox.TOptional<_$typebox.TString>;
695
+ userAgent: _$typebox.TOptional<_$typebox.TString>;
696
+ sessionId: _$typebox.TOptional<_$typebox.TString>;
697
+ requestId: _$typebox.TOptional<_$typebox.TString>;
698
+ success: _$alepha_orm0.PgAttr<_$typebox.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
699
+ errorMessage: _$typebox.TOptional<_$typebox.TString>;
960
700
  }>>;
961
701
  }>;
962
702
  }>;
@@ -964,21 +704,21 @@ declare class AdminAuditController {
964
704
  * Get registered audit types.
965
705
  */
966
706
  readonly getTypes: _$alepha_server0.ActionPrimitiveFn<{
967
- response: _$alepha.TArray<_$alepha.TObject<{
968
- type: _$alepha.TString;
969
- description: _$alepha.TOptional<_$alepha.TString>;
970
- actions: _$alepha.TArray<_$alepha.TString>;
707
+ response: _$typebox.TArray<_$typebox.TObject<{
708
+ type: _$typebox.TString;
709
+ description: _$typebox.TOptional<_$typebox.TString>;
710
+ actions: _$typebox.TArray<_$typebox.TString>;
971
711
  }>>;
972
712
  }>;
973
713
  /**
974
714
  * Get distinct values for filters.
975
715
  */
976
716
  readonly getFilterOptions: _$alepha_server0.ActionPrimitiveFn<{
977
- response: _$alepha.TObject<{
978
- types: _$alepha.TArray<_$alepha.TString>;
979
- actions: _$alepha.TArray<_$alepha.TString>;
980
- resourceTypes: _$alepha.TArray<_$alepha.TString>;
981
- userRealms: _$alepha.TArray<_$alepha.TString>;
717
+ response: _$typebox.TObject<{
718
+ types: _$typebox.TArray<_$typebox.TString>;
719
+ actions: _$typebox.TArray<_$typebox.TString>;
720
+ resourceTypes: _$typebox.TArray<_$typebox.TString>;
721
+ userRealms: _$typebox.TArray<_$typebox.TString>;
982
722
  }>;
983
723
  }>;
984
724
  }
@@ -1096,29 +836,336 @@ declare const $audit: {
1096
836
  [KIND]: typeof AuditPrimitive;
1097
837
  };
1098
838
  //#endregion
839
+ //#region ../../src/orm/core/schemas/insertSchema.d.ts
840
+ /**
841
+ * Transforms a TObject schema for insert operations.
842
+ * All default properties at the root level are made optional.
843
+ * Generated columns are excluded entirely.
844
+ *
845
+ * @example
846
+ * Before: { name: string; age: number(default=0); fullName: generated }
847
+ * After: { name: string; age?: number; }
848
+ */
849
+ type TObjectInsert<T extends TObject> = TObject<{ [K in keyof T["properties"] as T["properties"][K] extends {
850
+ [PG_GENERATED]: any;
851
+ } ? never : K]: T["properties"][K] extends {
852
+ [PG_DEFAULT]: any;
853
+ } | {
854
+ [PG_ORGANIZATION]: any;
855
+ } | {
856
+ "~optional": true;
857
+ } ? TOptional<T["properties"][K]> : T["properties"][K] }>;
858
+ //#endregion
859
+ //#region ../../src/orm/core/schemas/updateSchema.d.ts
860
+ /**
861
+ * Transforms a TObject schema for update operations.
862
+ * All optional properties at the root level are made nullable (i.e., `T | null`).
863
+ * Generated columns are excluded entirely.
864
+ *
865
+ * @example
866
+ * Before: { name?: string; age: number; fullName: generated }
867
+ * After: { name?: string | null; age: number; }
868
+ */
869
+ type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"] as T["properties"][K] extends {
870
+ [PG_GENERATED]: any;
871
+ } ? never : K]: T["properties"][K] extends TOptional<infer U> ? TOptional<TUnion<[U, TNull]>> : T["properties"][K] }>;
872
+ //#endregion
873
+ //#region ../../src/orm/core/primitives/$entity.d.ts
874
+ interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
875
+ /**
876
+ * The database table name that will be created for this entity.
877
+ * If not provided, name will be inferred from the $repository variable name.
878
+ */
879
+ name: string;
880
+ /**
881
+ * TypeBox schema defining the table structure and column types.
882
+ */
883
+ schema: T;
884
+ /**
885
+ * Database indexes to create for query optimization.
886
+ */
887
+ indexes?: (Keys | {
888
+ /**
889
+ * Single column to index.
890
+ */
891
+ column: Keys;
892
+ /**
893
+ * Whether this should be a unique index (enforces uniqueness constraint).
894
+ */
895
+ unique?: boolean;
896
+ /**
897
+ * Custom name for the index. If not provided, generates name automatically.
898
+ */
899
+ name?: string;
900
+ /**
901
+ * Partial index condition. Only rows matching this SQL expression are indexed.
902
+ */
903
+ where?: SQL;
904
+ } | {
905
+ /**
906
+ * Multiple columns for composite index (order matters for query optimization).
907
+ */
908
+ columns: Keys[];
909
+ /**
910
+ * Whether this should be a unique index (enforces uniqueness constraint).
911
+ */
912
+ unique?: boolean;
913
+ /**
914
+ * Custom name for the index. If not provided, generates name automatically.
915
+ */
916
+ name?: string;
917
+ /**
918
+ * Partial index condition. Only rows matching this SQL expression are indexed.
919
+ */
920
+ where?: SQL;
921
+ } | {
922
+ /**
923
+ * SQL expressions for expression-based indexes.
924
+ *
925
+ * Can include column references and SQL functions like `LOWER()`, `UPPER()`, etc.
926
+ * Columns and expressions can be mixed together.
927
+ *
928
+ * @example
929
+ * ```ts
930
+ * // Case-insensitive unique username per realm
931
+ * indexes: [{
932
+ * expressions: (self) => [self.realm, sql`LOWER(${self.username})`],
933
+ * unique: true,
934
+ * name: "users_realm_username_lower_idx",
935
+ * }]
936
+ * ```
937
+ */
938
+ expressions: (self: Record<Keys & string, any>) => (SQL | any)[];
939
+ /**
940
+ * Whether this should be a unique index (enforces uniqueness constraint).
941
+ */
942
+ unique?: boolean;
943
+ /**
944
+ * Custom name for the index. If not provided, generates name automatically.
945
+ */
946
+ name: string;
947
+ /**
948
+ * Partial index condition. Only rows matching this SQL expression are indexed.
949
+ */
950
+ where?: SQL;
951
+ })[];
952
+ /**
953
+ * Foreign key constraints to maintain referential integrity.
954
+ */
955
+ foreignKeys?: Array<{
956
+ /**
957
+ * Optional name for the foreign key constraint.
958
+ */
959
+ name?: string;
960
+ /**
961
+ * Local columns that reference the foreign table.
962
+ */
963
+ columns: Array<keyof Static<T>>;
964
+ /**
965
+ * Referenced columns in the foreign table.
966
+ * Must be EntityColumn references from other entities.
967
+ */
968
+ foreignColumns: Array<() => EntityColumn<any>>;
969
+ }>;
970
+ /**
971
+ * Additional table constraints for data validation.
972
+ *
973
+ * Constraints enforce business rules at the database level, providing
974
+ * an additional layer of data integrity beyond application validation.
975
+ *
976
+ * **Constraint Types**:
977
+ * - **Unique constraints**: Prevent duplicate values across columns
978
+ * - **Check constraints**: Enforce custom validation rules with SQL expressions
979
+ *
980
+ * @example
981
+ * ```ts
982
+ * constraints: [
983
+ * {
984
+ * name: "unique_user_email",
985
+ * columns: ["email"],
986
+ * unique: true
987
+ * },
988
+ * {
989
+ * name: "valid_age_range",
990
+ * columns: ["age"],
991
+ * check: sql`age >= 0 AND age <= 150`
992
+ * },
993
+ * {
994
+ * name: "unique_user_username_per_tenant",
995
+ * columns: ["tenantId", "username"],
996
+ * unique: true
997
+ * }
998
+ * ]
999
+ * ```
1000
+ */
1001
+ constraints?: Array<{
1002
+ /**
1003
+ * Columns involved in this constraint.
1004
+ */
1005
+ columns: Array<keyof Static<T>>;
1006
+ /**
1007
+ * Optional name for the constraint.
1008
+ */
1009
+ name?: string;
1010
+ /**
1011
+ * Whether this is a unique constraint.
1012
+ */
1013
+ unique?: boolean | {};
1014
+ /**
1015
+ * SQL expression for check constraint validation.
1016
+ */
1017
+ check?: SQL;
1018
+ }>;
1019
+ /**
1020
+ * Advanced Drizzle ORM configuration for complex table setups.
1021
+ */
1022
+ config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
1023
+ }
1024
+ declare class EntityPrimitive<T extends TObject = TObject> {
1025
+ readonly options: EntityPrimitiveOptions<T>;
1026
+ constructor(options: EntityPrimitiveOptions<T>);
1027
+ alias(alias: string): this;
1028
+ get cols(): EntityColumns<T>;
1029
+ get name(): string;
1030
+ get schema(): T;
1031
+ get insertSchema(): TObjectInsert<T>;
1032
+ get updateSchema(): TObjectUpdate<T>;
1033
+ }
1034
+ /**
1035
+ * Convert a schema to columns.
1036
+ */
1037
+ type FromSchema<T extends TObject> = { [key in keyof T["properties"]]: PgColumnBuilderBase };
1038
+ type EntityColumn<T extends TObject> = {
1039
+ name: string;
1040
+ entity: EntityPrimitive<T>;
1041
+ };
1042
+ type EntityColumns<T extends TObject> = { [key in keyof T["properties"]]: EntityColumn<T> };
1043
+ //#endregion
1044
+ //#region ../../src/orm/core/constants/PG_SYMBOLS.d.ts
1045
+ declare const PG_DEFAULT: unique symbol;
1046
+ declare const PG_PRIMARY_KEY: unique symbol;
1047
+ declare const PG_CREATED_AT: unique symbol;
1048
+ declare const PG_UPDATED_AT: unique symbol;
1049
+ declare const PG_DELETED_AT: unique symbol;
1050
+ declare const PG_VERSION: unique symbol;
1051
+ declare const PG_IDENTITY: unique symbol;
1052
+ declare const PG_ENUM: unique symbol;
1053
+ declare const PG_REF: unique symbol;
1054
+ declare const PG_GENERATED: unique symbol;
1055
+ declare const PG_ORGANIZATION: unique symbol;
1056
+ /**
1057
+ * @deprecated Use `PG_IDENTITY` instead.
1058
+ */
1059
+ declare const PG_SERIAL: unique symbol;
1060
+ type PgSymbols = {
1061
+ [PG_DEFAULT]: {};
1062
+ [PG_PRIMARY_KEY]: {};
1063
+ [PG_CREATED_AT]: {};
1064
+ [PG_UPDATED_AT]: {};
1065
+ [PG_DELETED_AT]: {};
1066
+ [PG_VERSION]: {};
1067
+ [PG_IDENTITY]: PgIdentityOptions;
1068
+ [PG_REF]: PgRefOptions;
1069
+ [PG_ENUM]: PgEnumOptions;
1070
+ [PG_GENERATED]: PgGeneratedOptions;
1071
+ [PG_ORGANIZATION]: {};
1072
+ /**
1073
+ * @deprecated Use `PG_IDENTITY` instead.
1074
+ */
1075
+ [PG_SERIAL]: {};
1076
+ };
1077
+ type PgSymbolKeys = keyof PgSymbols;
1078
+ type PgIdentityOptions = {
1079
+ mode: "always" | "byDefault";
1080
+ } & PgSequenceOptions & {
1081
+ name?: string;
1082
+ };
1083
+ interface PgEnumOptions {
1084
+ name?: string;
1085
+ description?: string;
1086
+ }
1087
+ interface PgGeneratedOptions {
1088
+ /**
1089
+ * SQL expression for the generated column.
1090
+ */
1091
+ expression: SQL;
1092
+ /**
1093
+ * Storage mode for the generated column.
1094
+ * - `"stored"` — value is computed on write and stored on disk (default for PostgreSQL).
1095
+ * - `"virtual"` — value is computed on read (default for SQLite).
1096
+ */
1097
+ mode?: "stored" | "virtual";
1098
+ }
1099
+ interface PgRefOptions {
1100
+ ref: () => {
1101
+ name: string;
1102
+ entity: EntityPrimitive;
1103
+ };
1104
+ actions?: {
1105
+ onUpdate?: UpdateDeleteAction;
1106
+ onDelete?: UpdateDeleteAction;
1107
+ };
1108
+ }
1109
+ //#endregion
1110
+ //#region ../../src/orm/core/helpers/pgAttr.d.ts
1111
+ /**
1112
+ * Type representation.
1113
+ */
1114
+ type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
1115
+ //#endregion
1116
+ //#region ../../src/orm/core/schemas/databaseEnvSchema.d.ts
1117
+ /**
1118
+ * Base database environment schema.
1119
+ *
1120
+ * Defines the `DATABASE_URL` connection string used by all ORM providers
1121
+ * to determine the database driver and connection target.
1122
+ *
1123
+ * Supported URL formats:
1124
+ * - `sqlite://:memory:` or `sqlite://./path/to/db` — SQLite (Node.js or Bun)
1125
+ * - `postgres://user:password@host:port/database` — PostgreSQL (Node.js or Bun)
1126
+ * - `pglite://:memory:` or `pglite://./path` — PGlite (embedded Postgres)
1127
+ * - `d1://BINDING_NAME` — Cloudflare D1
1128
+ * - `hyperdrive://BINDING_NAME` — Cloudflare Hyperdrive
1129
+ */
1130
+ declare const databaseEnvSchema: _$typebox.TObject<{
1131
+ DATABASE_URL: _$typebox.TOptional<_$typebox.TString>;
1132
+ /**
1133
+ * Enable or disable push-based schema synchronization (drizzle-kit push).
1134
+ *
1135
+ * Defaults to `true` in development and test, `false` in production.
1136
+ * Set to `false` in development to skip automatic schema sync
1137
+ * (e.g. when managing migrations manually).
1138
+ */
1139
+ DATABASE_SYNC: _$typebox.TOptional<_$typebox.TBoolean>;
1140
+ }>;
1141
+ declare module "alepha" {
1142
+ interface Env extends Partial<Static<typeof databaseEnvSchema>> {}
1143
+ } //# sourceMappingURL=databaseEnvSchema.d.ts.map
1144
+ //#endregion
1099
1145
  //#region ../../src/api/audits/schemas/auditResourceSchema.d.ts
1100
1146
  /**
1101
1147
  * Resource schema for audit log responses.
1102
1148
  */
1103
- declare const auditResourceSchema: _$alepha.TObject<{
1104
- id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1105
- createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1106
- type: _$alepha.TString;
1107
- action: _$alepha.TString;
1108
- severity: PgAttr<_$alepha.TUnsafe<"info" | "warning" | "critical">, typeof PG_DEFAULT>;
1109
- userId: _$alepha.TOptional<_$alepha.TString>;
1110
- userRealm: _$alepha.TOptional<_$alepha.TString>;
1111
- userEmail: _$alepha.TOptional<_$alepha.TString>;
1112
- resourceType: _$alepha.TOptional<_$alepha.TString>;
1113
- resourceId: _$alepha.TOptional<_$alepha.TString>;
1114
- description: _$alepha.TOptional<_$alepha.TString>;
1115
- metadata: _$alepha.TOptional<_$alepha.TRecord<string, _$alepha.TAny>>;
1116
- ipAddress: _$alepha.TOptional<_$alepha.TString>;
1117
- userAgent: _$alepha.TOptional<_$alepha.TString>;
1118
- sessionId: _$alepha.TOptional<_$alepha.TString>;
1119
- requestId: _$alepha.TOptional<_$alepha.TString>;
1120
- success: PgAttr<_$alepha.TBoolean, typeof PG_DEFAULT>;
1121
- errorMessage: _$alepha.TOptional<_$alepha.TString>;
1149
+ declare const auditResourceSchema: _$typebox.TObject<{
1150
+ id: PgAttr<PgAttr<_$typebox.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
1151
+ createdAt: PgAttr<PgAttr<_$typebox.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
1152
+ organizationId: PgAttr<_$typebox.TString, typeof PG_ORGANIZATION>;
1153
+ type: _$typebox.TString;
1154
+ action: _$typebox.TString;
1155
+ severity: PgAttr<_$typebox.TUnsafe<"info" | "warning" | "critical">, typeof PG_DEFAULT>;
1156
+ userId: _$typebox.TOptional<_$typebox.TString>;
1157
+ userRealm: _$typebox.TOptional<_$typebox.TString>;
1158
+ userEmail: _$typebox.TOptional<_$typebox.TString>;
1159
+ resourceType: _$typebox.TOptional<_$typebox.TString>;
1160
+ resourceId: _$typebox.TOptional<_$typebox.TString>;
1161
+ description: _$typebox.TOptional<_$typebox.TString>;
1162
+ metadata: _$typebox.TOptional<_$typebox.TRecord<string, _$typebox.TAny>>;
1163
+ ipAddress: _$typebox.TOptional<_$typebox.TString>;
1164
+ userAgent: _$typebox.TOptional<_$typebox.TString>;
1165
+ sessionId: _$typebox.TOptional<_$typebox.TString>;
1166
+ requestId: _$typebox.TOptional<_$typebox.TString>;
1167
+ success: PgAttr<_$typebox.TBoolean, typeof PG_DEFAULT>;
1168
+ errorMessage: _$typebox.TOptional<_$typebox.TString>;
1122
1169
  }>;
1123
1170
  type AuditResource = Static<typeof auditResourceSchema>;
1124
1171
  //#endregion