alepha 0.14.3 → 0.15.0

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 (317) hide show
  1. package/README.md +2 -5
  2. package/dist/api/audits/index.d.ts +620 -811
  3. package/dist/api/audits/index.d.ts.map +1 -1
  4. package/dist/api/files/index.d.ts +185 -377
  5. package/dist/api/files/index.d.ts.map +1 -1
  6. package/dist/api/files/index.js +0 -1
  7. package/dist/api/files/index.js.map +1 -1
  8. package/dist/api/jobs/index.d.ts +245 -435
  9. package/dist/api/jobs/index.d.ts.map +1 -1
  10. package/dist/api/notifications/index.d.ts +238 -429
  11. package/dist/api/notifications/index.d.ts.map +1 -1
  12. package/dist/api/parameters/index.d.ts +236 -427
  13. package/dist/api/parameters/index.d.ts.map +1 -1
  14. package/dist/api/users/index.browser.js +1 -2
  15. package/dist/api/users/index.browser.js.map +1 -1
  16. package/dist/api/users/index.d.ts +1010 -1196
  17. package/dist/api/users/index.d.ts.map +1 -1
  18. package/dist/api/users/index.js +178 -151
  19. package/dist/api/users/index.js.map +1 -1
  20. package/dist/api/verifications/index.d.ts +17 -17
  21. package/dist/api/verifications/index.d.ts.map +1 -1
  22. package/dist/batch/index.d.ts +122 -122
  23. package/dist/batch/index.d.ts.map +1 -1
  24. package/dist/batch/index.js +1 -2
  25. package/dist/batch/index.js.map +1 -1
  26. package/dist/bucket/index.d.ts +163 -163
  27. package/dist/bucket/index.d.ts.map +1 -1
  28. package/dist/cache/core/index.d.ts +46 -46
  29. package/dist/cache/core/index.d.ts.map +1 -1
  30. package/dist/cache/redis/index.d.ts.map +1 -1
  31. package/dist/cli/index.d.ts +384 -285
  32. package/dist/cli/index.d.ts.map +1 -1
  33. package/dist/cli/index.js +1113 -623
  34. package/dist/cli/index.js.map +1 -1
  35. package/dist/command/index.d.ts +299 -300
  36. package/dist/command/index.d.ts.map +1 -1
  37. package/dist/command/index.js +13 -9
  38. package/dist/command/index.js.map +1 -1
  39. package/dist/core/index.browser.js +445 -103
  40. package/dist/core/index.browser.js.map +1 -1
  41. package/dist/core/index.d.ts +733 -625
  42. package/dist/core/index.d.ts.map +1 -1
  43. package/dist/core/index.js +446 -103
  44. package/dist/core/index.js.map +1 -1
  45. package/dist/core/index.native.js +445 -103
  46. package/dist/core/index.native.js.map +1 -1
  47. package/dist/datetime/index.d.ts +44 -44
  48. package/dist/datetime/index.d.ts.map +1 -1
  49. package/dist/datetime/index.js +4 -4
  50. package/dist/datetime/index.js.map +1 -1
  51. package/dist/email/index.d.ts +97 -50
  52. package/dist/email/index.d.ts.map +1 -1
  53. package/dist/email/index.js +129 -33
  54. package/dist/email/index.js.map +1 -1
  55. package/dist/fake/index.d.ts +7981 -14
  56. package/dist/fake/index.d.ts.map +1 -1
  57. package/dist/file/index.d.ts +523 -390
  58. package/dist/file/index.d.ts.map +1 -1
  59. package/dist/file/index.js +253 -1
  60. package/dist/file/index.js.map +1 -1
  61. package/dist/lock/core/index.d.ts +208 -208
  62. package/dist/lock/core/index.d.ts.map +1 -1
  63. package/dist/lock/redis/index.d.ts.map +1 -1
  64. package/dist/logger/index.d.ts +25 -26
  65. package/dist/logger/index.d.ts.map +1 -1
  66. package/dist/logger/index.js +12 -2
  67. package/dist/logger/index.js.map +1 -1
  68. package/dist/mcp/index.d.ts +197 -197
  69. package/dist/mcp/index.d.ts.map +1 -1
  70. package/dist/mcp/index.js +1 -1
  71. package/dist/mcp/index.js.map +1 -1
  72. package/dist/orm/chunk-DtkW-qnP.js +38 -0
  73. package/dist/orm/index.browser.js.map +1 -1
  74. package/dist/orm/index.bun.js +2814 -0
  75. package/dist/orm/index.bun.js.map +1 -0
  76. package/dist/orm/index.d.ts +1228 -1216
  77. package/dist/orm/index.d.ts.map +1 -1
  78. package/dist/orm/index.js +2041 -1967
  79. package/dist/orm/index.js.map +1 -1
  80. package/dist/queue/core/index.d.ts +248 -248
  81. package/dist/queue/core/index.d.ts.map +1 -1
  82. package/dist/queue/redis/index.d.ts.map +1 -1
  83. package/dist/redis/index.bun.js +285 -0
  84. package/dist/redis/index.bun.js.map +1 -0
  85. package/dist/redis/index.d.ts +118 -136
  86. package/dist/redis/index.d.ts.map +1 -1
  87. package/dist/redis/index.js +18 -38
  88. package/dist/redis/index.js.map +1 -1
  89. package/dist/retry/index.d.ts +69 -69
  90. package/dist/retry/index.d.ts.map +1 -1
  91. package/dist/router/index.d.ts +6 -6
  92. package/dist/router/index.d.ts.map +1 -1
  93. package/dist/scheduler/index.d.ts +25 -25
  94. package/dist/scheduler/index.d.ts.map +1 -1
  95. package/dist/security/index.browser.js +5 -1
  96. package/dist/security/index.browser.js.map +1 -1
  97. package/dist/security/index.d.ts +417 -254
  98. package/dist/security/index.d.ts.map +1 -1
  99. package/dist/security/index.js +386 -86
  100. package/dist/security/index.js.map +1 -1
  101. package/dist/server/auth/index.d.ts +110 -110
  102. package/dist/server/auth/index.d.ts.map +1 -1
  103. package/dist/server/auth/index.js +20 -20
  104. package/dist/server/auth/index.js.map +1 -1
  105. package/dist/server/cache/index.d.ts +62 -47
  106. package/dist/server/cache/index.d.ts.map +1 -1
  107. package/dist/server/cache/index.js +56 -3
  108. package/dist/server/cache/index.js.map +1 -1
  109. package/dist/server/compress/index.d.ts +6 -0
  110. package/dist/server/compress/index.d.ts.map +1 -1
  111. package/dist/server/compress/index.js +36 -1
  112. package/dist/server/compress/index.js.map +1 -1
  113. package/dist/server/cookies/index.d.ts +6 -6
  114. package/dist/server/cookies/index.d.ts.map +1 -1
  115. package/dist/server/cookies/index.js +3 -3
  116. package/dist/server/cookies/index.js.map +1 -1
  117. package/dist/server/core/index.browser.js +2 -2
  118. package/dist/server/core/index.browser.js.map +1 -1
  119. package/dist/server/core/index.d.ts +242 -150
  120. package/dist/server/core/index.d.ts.map +1 -1
  121. package/dist/server/core/index.js +294 -125
  122. package/dist/server/core/index.js.map +1 -1
  123. package/dist/server/cors/index.d.ts +11 -12
  124. package/dist/server/cors/index.d.ts.map +1 -1
  125. package/dist/server/health/index.d.ts +0 -1
  126. package/dist/server/health/index.d.ts.map +1 -1
  127. package/dist/server/helmet/index.d.ts +2 -2
  128. package/dist/server/helmet/index.d.ts.map +1 -1
  129. package/dist/server/links/index.browser.js.map +1 -1
  130. package/dist/server/links/index.d.ts +123 -124
  131. package/dist/server/links/index.d.ts.map +1 -1
  132. package/dist/server/links/index.js +1 -2
  133. package/dist/server/links/index.js.map +1 -1
  134. package/dist/server/metrics/index.d.ts.map +1 -1
  135. package/dist/server/multipart/index.d.ts +6 -6
  136. package/dist/server/multipart/index.d.ts.map +1 -1
  137. package/dist/server/proxy/index.d.ts +102 -103
  138. package/dist/server/proxy/index.d.ts.map +1 -1
  139. package/dist/server/rate-limit/index.d.ts +16 -16
  140. package/dist/server/rate-limit/index.d.ts.map +1 -1
  141. package/dist/server/static/index.d.ts +44 -44
  142. package/dist/server/static/index.d.ts.map +1 -1
  143. package/dist/server/static/index.js +4 -0
  144. package/dist/server/static/index.js.map +1 -1
  145. package/dist/server/swagger/index.d.ts +48 -49
  146. package/dist/server/swagger/index.d.ts.map +1 -1
  147. package/dist/server/swagger/index.js +3 -5
  148. package/dist/server/swagger/index.js.map +1 -1
  149. package/dist/sms/index.d.ts +13 -11
  150. package/dist/sms/index.d.ts.map +1 -1
  151. package/dist/sms/index.js +7 -7
  152. package/dist/sms/index.js.map +1 -1
  153. package/dist/thread/index.d.ts +71 -72
  154. package/dist/thread/index.d.ts.map +1 -1
  155. package/dist/topic/core/index.d.ts +318 -318
  156. package/dist/topic/core/index.d.ts.map +1 -1
  157. package/dist/topic/redis/index.d.ts +6 -6
  158. package/dist/topic/redis/index.d.ts.map +1 -1
  159. package/dist/vite/index.d.ts +5805 -249
  160. package/dist/vite/index.d.ts.map +1 -1
  161. package/dist/vite/index.js +599 -513
  162. package/dist/vite/index.js.map +1 -1
  163. package/dist/websocket/index.browser.js +6 -6
  164. package/dist/websocket/index.browser.js.map +1 -1
  165. package/dist/websocket/index.d.ts +247 -247
  166. package/dist/websocket/index.d.ts.map +1 -1
  167. package/dist/websocket/index.js +6 -6
  168. package/dist/websocket/index.js.map +1 -1
  169. package/package.json +9 -14
  170. package/src/api/files/controllers/AdminFileStatsController.ts +0 -1
  171. package/src/api/users/atoms/realmAuthSettingsAtom.ts +5 -0
  172. package/src/api/users/controllers/{UserRealmController.ts → RealmController.ts} +11 -11
  173. package/src/api/users/entities/users.ts +1 -1
  174. package/src/api/users/index.ts +8 -8
  175. package/src/api/users/primitives/{$userRealm.ts → $realm.ts} +17 -19
  176. package/src/api/users/providers/{UserRealmProvider.ts → RealmProvider.ts} +26 -30
  177. package/src/api/users/schemas/{userRealmConfigSchema.ts → realmConfigSchema.ts} +2 -2
  178. package/src/api/users/services/CredentialService.ts +7 -7
  179. package/src/api/users/services/IdentityService.ts +4 -4
  180. package/src/api/users/services/RegistrationService.spec.ts +25 -27
  181. package/src/api/users/services/RegistrationService.ts +38 -27
  182. package/src/api/users/services/SessionCrudService.ts +3 -3
  183. package/src/api/users/services/SessionService.spec.ts +3 -3
  184. package/src/api/users/services/SessionService.ts +28 -9
  185. package/src/api/users/services/UserService.ts +7 -7
  186. package/src/batch/providers/BatchProvider.ts +1 -2
  187. package/src/cli/apps/AlephaCli.ts +0 -2
  188. package/src/cli/apps/AlephaPackageBuilderCli.ts +38 -19
  189. package/src/cli/assets/apiHelloControllerTs.ts +18 -0
  190. package/src/cli/assets/apiIndexTs.ts +16 -0
  191. package/src/cli/assets/claudeMd.ts +303 -0
  192. package/src/cli/assets/mainBrowserTs.ts +2 -2
  193. package/src/cli/assets/mainServerTs.ts +24 -0
  194. package/src/cli/assets/webAppRouterTs.ts +15 -0
  195. package/src/cli/assets/webHelloComponentTsx.ts +16 -0
  196. package/src/cli/assets/webIndexTs.ts +16 -0
  197. package/src/cli/atoms/buildOptions.ts +88 -0
  198. package/src/cli/commands/build.ts +70 -87
  199. package/src/cli/commands/db.ts +21 -22
  200. package/src/cli/commands/deploy.ts +17 -5
  201. package/src/cli/commands/dev.ts +22 -14
  202. package/src/cli/commands/format.ts +8 -2
  203. package/src/cli/commands/gen/env.ts +53 -0
  204. package/src/cli/commands/gen/openapi.ts +1 -1
  205. package/src/cli/commands/gen/resource.ts +15 -0
  206. package/src/cli/commands/gen.ts +7 -1
  207. package/src/cli/commands/init.ts +74 -30
  208. package/src/cli/commands/lint.ts +8 -2
  209. package/src/cli/commands/test.ts +8 -3
  210. package/src/cli/commands/typecheck.ts +5 -1
  211. package/src/cli/commands/verify.ts +5 -3
  212. package/src/cli/defineConfig.ts +49 -7
  213. package/src/cli/index.ts +0 -1
  214. package/src/cli/services/AlephaCliUtils.ts +39 -589
  215. package/src/cli/services/PackageManagerUtils.ts +301 -0
  216. package/src/cli/services/ProjectScaffolder.ts +306 -0
  217. package/src/command/helpers/Runner.spec.ts +2 -2
  218. package/src/command/helpers/Runner.ts +16 -4
  219. package/src/command/primitives/$command.ts +0 -6
  220. package/src/command/providers/CliProvider.ts +1 -3
  221. package/src/core/Alepha.ts +42 -0
  222. package/src/core/__tests__/Alepha-graph.spec.ts +4 -0
  223. package/src/core/index.shared.ts +1 -0
  224. package/src/core/index.ts +2 -0
  225. package/src/core/primitives/$hook.ts +6 -2
  226. package/src/core/primitives/$module.spec.ts +4 -0
  227. package/src/core/providers/AlsProvider.ts +1 -1
  228. package/src/core/providers/CodecManager.spec.ts +12 -6
  229. package/src/core/providers/CodecManager.ts +26 -6
  230. package/src/core/providers/EventManager.ts +169 -13
  231. package/src/core/providers/KeylessJsonSchemaCodec.spec.ts +621 -0
  232. package/src/core/providers/KeylessJsonSchemaCodec.ts +407 -0
  233. package/src/core/providers/StateManager.spec.ts +27 -16
  234. package/src/email/providers/LocalEmailProvider.spec.ts +111 -87
  235. package/src/email/providers/LocalEmailProvider.ts +52 -15
  236. package/src/email/providers/NodemailerEmailProvider.ts +167 -56
  237. package/src/file/errors/FileError.ts +7 -0
  238. package/src/file/index.ts +9 -1
  239. package/src/file/providers/MemoryFileSystemProvider.ts +393 -0
  240. package/src/logger/index.ts +15 -3
  241. package/src/mcp/transports/StdioMcpTransport.ts +1 -1
  242. package/src/orm/index.browser.ts +1 -19
  243. package/src/orm/index.bun.ts +77 -0
  244. package/src/orm/index.shared-server.ts +22 -0
  245. package/src/orm/index.shared.ts +15 -0
  246. package/src/orm/index.ts +13 -39
  247. package/src/orm/providers/drivers/BunPostgresProvider.ts +3 -5
  248. package/src/orm/providers/drivers/BunSqliteProvider.ts +1 -1
  249. package/src/orm/providers/drivers/CloudflareD1Provider.ts +4 -0
  250. package/src/orm/providers/drivers/DatabaseProvider.ts +4 -0
  251. package/src/orm/providers/drivers/PglitePostgresProvider.ts +4 -0
  252. package/src/orm/services/Repository.ts +8 -0
  253. package/src/queue/core/providers/WorkerProvider.spec.ts +48 -32
  254. package/src/redis/index.bun.ts +35 -0
  255. package/src/redis/providers/BunRedisProvider.ts +12 -43
  256. package/src/redis/providers/BunRedisSubscriberProvider.ts +2 -3
  257. package/src/redis/providers/NodeRedisProvider.ts +16 -34
  258. package/src/{server/security → security}/__tests__/BasicAuth.spec.ts +11 -11
  259. package/src/{server/security → security}/__tests__/ServerSecurityProvider-realm.spec.ts +21 -16
  260. package/src/{server/security/providers → security/__tests__}/ServerSecurityProvider.spec.ts +5 -5
  261. package/src/security/index.browser.ts +5 -0
  262. package/src/security/index.ts +90 -7
  263. package/src/security/primitives/{$realm.spec.ts → $issuer.spec.ts} +11 -11
  264. package/src/security/primitives/{$realm.ts → $issuer.ts} +20 -17
  265. package/src/security/primitives/$role.ts +5 -5
  266. package/src/security/primitives/$serviceAccount.spec.ts +5 -5
  267. package/src/security/primitives/$serviceAccount.ts +3 -3
  268. package/src/{server/security → security}/providers/ServerSecurityProvider.ts +5 -7
  269. package/src/server/auth/primitives/$auth.ts +10 -10
  270. package/src/server/auth/primitives/$authCredentials.ts +3 -3
  271. package/src/server/auth/primitives/$authGithub.ts +3 -3
  272. package/src/server/auth/primitives/$authGoogle.ts +3 -3
  273. package/src/server/auth/providers/ServerAuthProvider.ts +13 -13
  274. package/src/server/cache/providers/ServerCacheProvider.spec.ts +183 -0
  275. package/src/server/cache/providers/ServerCacheProvider.ts +95 -10
  276. package/src/server/compress/providers/ServerCompressProvider.ts +61 -2
  277. package/src/server/cookies/providers/ServerCookiesProvider.ts +3 -3
  278. package/src/server/core/helpers/ServerReply.ts +2 -2
  279. package/src/server/core/providers/NodeHttpServerProvider.ts +25 -6
  280. package/src/server/core/providers/ServerBodyParserProvider.ts +19 -23
  281. package/src/server/core/providers/ServerLoggerProvider.ts +23 -19
  282. package/src/server/core/providers/ServerProvider.ts +155 -22
  283. package/src/server/core/providers/ServerRouterProvider.ts +259 -115
  284. package/src/server/core/providers/ServerTimingProvider.ts +2 -2
  285. package/src/server/links/index.ts +1 -1
  286. package/src/server/links/providers/LinkProvider.ts +1 -1
  287. package/src/server/static/providers/ServerStaticProvider.ts +10 -0
  288. package/src/server/swagger/index.ts +1 -1
  289. package/src/server/swagger/providers/ServerSwaggerProvider.ts +5 -8
  290. package/src/sms/providers/LocalSmsProvider.spec.ts +153 -111
  291. package/src/sms/providers/LocalSmsProvider.ts +8 -7
  292. package/src/vite/helpers/boot.ts +28 -17
  293. package/src/vite/helpers/importViteReact.ts +13 -0
  294. package/src/vite/index.ts +1 -21
  295. package/src/vite/plugins/viteAlephaDev.ts +16 -1
  296. package/src/vite/plugins/viteAlephaSsrPreload.ts +222 -0
  297. package/src/vite/tasks/buildClient.ts +11 -0
  298. package/src/vite/tasks/buildServer.ts +59 -4
  299. package/src/vite/tasks/devServer.ts +71 -0
  300. package/src/vite/tasks/generateCloudflare.ts +7 -0
  301. package/src/vite/tasks/index.ts +2 -1
  302. package/dist/server/security/index.browser.js +0 -13
  303. package/dist/server/security/index.browser.js.map +0 -1
  304. package/dist/server/security/index.d.ts +0 -173
  305. package/dist/server/security/index.d.ts.map +0 -1
  306. package/dist/server/security/index.js +0 -311
  307. package/dist/server/security/index.js.map +0 -1
  308. package/src/cli/assets/appRouterTs.ts +0 -9
  309. package/src/cli/assets/mainTs.ts +0 -13
  310. package/src/cli/assets/viteConfigTs.ts +0 -14
  311. package/src/cli/commands/run.ts +0 -24
  312. package/src/server/security/index.browser.ts +0 -10
  313. package/src/server/security/index.ts +0 -94
  314. package/src/vite/plugins/viteAlepha.ts +0 -37
  315. package/src/vite/plugins/viteAlephaBuild.ts +0 -281
  316. /package/src/{server/security → security}/primitives/$basicAuth.ts +0 -0
  317. /package/src/{server/security → security}/providers/ServerBasicAuthProvider.ts +0 -0
@@ -1,7 +1,6 @@
1
1
  import * as alepha160 from "alepha";
2
2
  import { Alepha, FileLike, Static, TNull, TObject, TOptional, TSchema, TUnion } from "alepha";
3
3
  import { BucketPrimitive } from "alepha/bucket";
4
- import "alepha/server/security";
5
4
  import * as alepha_server0 from "alepha/server";
6
5
  import { Ok } from "alepha/server";
7
6
  import { DateTime, DateTimeProvider, DurationLike } from "alepha/datetime";
@@ -9,19 +8,12 @@ import * as alepha_logger0 from "alepha/logger";
9
8
  import * as alepha_orm16 from "alepha/orm";
10
9
  import { Page } from "alepha/orm";
11
10
  import * as alepha_scheduler0 from "alepha/scheduler";
12
- import "bun";
13
- import "bun:sqlite";
14
- import "drizzle-orm/bun-sql";
15
- import "drizzle-orm/bun-sqlite";
16
11
  import "drizzle-orm/d1";
17
12
  import { UserAccountToken } from "alepha/security";
18
13
  import { BuildExtraConfigColumns, SQL } from "drizzle-orm";
19
14
  import { PgColumnBuilderBase, PgSequenceOptions, PgTableExtraConfigValue, UpdateDeleteAction } from "drizzle-orm/pg-core";
20
15
  import "alepha/retry";
21
- import "alepha/lock";
22
16
  import "drizzle-orm/sqlite-core";
23
- import "drizzle-orm/postgres-js";
24
- import "postgres";
25
17
 
26
18
  //#region ../../src/api/files/entities/files.d.ts
27
19
  declare const files: alepha_orm16.EntityPrimitive<alepha160.TObject<{
@@ -88,114 +80,114 @@ type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"]]:
88
80
  //#region ../../src/orm/primitives/$entity.d.ts
89
81
  interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
90
82
  /**
91
- * The database table name that will be created for this entity.
92
- * If not provided, name will be inferred from the $repository variable name.
93
- */
83
+ * The database table name that will be created for this entity.
84
+ * If not provided, name will be inferred from the $repository variable name.
85
+ */
94
86
  name: string;
95
87
  /**
96
- * TypeBox schema defining the table structure and column types.
97
- */
88
+ * TypeBox schema defining the table structure and column types.
89
+ */
98
90
  schema: T;
99
91
  /**
100
- * Database indexes to create for query optimization.
101
- */
92
+ * Database indexes to create for query optimization.
93
+ */
102
94
  indexes?: (Keys | {
103
95
  /**
104
- * Single column to index.
105
- */
96
+ * Single column to index.
97
+ */
106
98
  column: Keys;
107
99
  /**
108
- * Whether this should be a unique index (enforces uniqueness constraint).
109
- */
100
+ * Whether this should be a unique index (enforces uniqueness constraint).
101
+ */
110
102
  unique?: boolean;
111
103
  /**
112
- * Custom name for the index. If not provided, generates name automatically.
113
- */
104
+ * Custom name for the index. If not provided, generates name automatically.
105
+ */
114
106
  name?: string;
115
107
  } | {
116
108
  /**
117
- * Multiple columns for composite index (order matters for query optimization).
118
- */
109
+ * Multiple columns for composite index (order matters for query optimization).
110
+ */
119
111
  columns: Keys[];
120
112
  /**
121
- * Whether this should be a unique index (enforces uniqueness constraint).
122
- */
113
+ * Whether this should be a unique index (enforces uniqueness constraint).
114
+ */
123
115
  unique?: boolean;
124
116
  /**
125
- * Custom name for the index. If not provided, generates name automatically.
126
- */
117
+ * Custom name for the index. If not provided, generates name automatically.
118
+ */
127
119
  name?: string;
128
120
  })[];
129
121
  /**
130
- * Foreign key constraints to maintain referential integrity.
131
- */
122
+ * Foreign key constraints to maintain referential integrity.
123
+ */
132
124
  foreignKeys?: Array<{
133
125
  /**
134
- * Optional name for the foreign key constraint.
135
- */
126
+ * Optional name for the foreign key constraint.
127
+ */
136
128
  name?: string;
137
129
  /**
138
- * Local columns that reference the foreign table.
139
- */
130
+ * Local columns that reference the foreign table.
131
+ */
140
132
  columns: Array<keyof Static<T>>;
141
133
  /**
142
- * Referenced columns in the foreign table.
143
- * Must be EntityColumn references from other entities.
144
- */
134
+ * Referenced columns in the foreign table.
135
+ * Must be EntityColumn references from other entities.
136
+ */
145
137
  foreignColumns: Array<() => EntityColumn<any>>;
146
138
  }>;
147
139
  /**
148
- * Additional table constraints for data validation.
149
- *
150
- * Constraints enforce business rules at the database level, providing
151
- * an additional layer of data integrity beyond application validation.
152
- *
153
- * **Constraint Types**:
154
- * - **Unique constraints**: Prevent duplicate values across columns
155
- * - **Check constraints**: Enforce custom validation rules with SQL expressions
156
- *
157
- * @example
158
- * ```ts
159
- * constraints: [
160
- * {
161
- * name: "unique_user_email",
162
- * columns: ["email"],
163
- * unique: true
164
- * },
165
- * {
166
- * name: "valid_age_range",
167
- * columns: ["age"],
168
- * check: sql`age >= 0 AND age <= 150`
169
- * },
170
- * {
171
- * name: "unique_user_username_per_tenant",
172
- * columns: ["tenantId", "username"],
173
- * unique: true
174
- * }
175
- * ]
176
- * ```
177
- */
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
+ * ```
169
+ */
178
170
  constraints?: Array<{
179
171
  /**
180
- * Columns involved in this constraint.
181
- */
172
+ * Columns involved in this constraint.
173
+ */
182
174
  columns: Array<keyof Static<T>>;
183
175
  /**
184
- * Optional name for the constraint.
185
- */
176
+ * Optional name for the constraint.
177
+ */
186
178
  name?: string;
187
179
  /**
188
- * Whether this is a unique constraint.
189
- */
180
+ * Whether this is a unique constraint.
181
+ */
190
182
  unique?: boolean | {};
191
183
  /**
192
- * SQL expression for check constraint validation.
193
- */
184
+ * SQL expression for check constraint validation.
185
+ */
194
186
  check?: SQL;
195
187
  }>;
196
188
  /**
197
- * Advanced Drizzle ORM configuration for complex table setups.
198
- */
189
+ * Advanced Drizzle ORM configuration for complex table setups.
190
+ */
199
191
  config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
200
192
  }
201
193
  declare class EntityPrimitive<T extends TObject = TObject> {
@@ -243,8 +235,8 @@ type PgSymbols = {
243
235
  [PG_REF]: PgRefOptions;
244
236
  [PG_ENUM]: PgEnumOptions;
245
237
  /**
246
- * @deprecated Use `PG_IDENTITY` instead.
247
- */
238
+ * @deprecated Use `PG_IDENTITY` instead.
239
+ */
248
240
  [PG_SERIAL]: {};
249
241
  };
250
242
  type PgSymbolKeys = keyof PgSymbols;
@@ -274,190 +266,6 @@ interface PgRefOptions {
274
266
  */
275
267
  type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
276
268
  //#endregion
277
- //#region ../../src/orm/providers/drivers/BunPostgresProvider.d.ts
278
- declare module "alepha" {
279
- interface Env extends Partial<Static<typeof envSchema$1>> {}
280
- }
281
- declare const envSchema$1: alepha160.TObject<{
282
- /**
283
- * Main configuration for database connection.
284
- * Accept a string in the format of a Postgres connection URL.
285
- * Example: postgres://user:password@localhost:5432/database
286
- * or
287
- * Example: postgres://user:password@localhost:5432/database?sslmode=require
288
- */
289
- DATABASE_URL: alepha160.TOptional<alepha160.TString>;
290
- /**
291
- * In addition to the DATABASE_URL, you can specify the postgres schema name.
292
- */
293
- POSTGRES_SCHEMA: alepha160.TOptional<alepha160.TString>;
294
- }>;
295
- /**
296
- * Bun PostgreSQL provider using Drizzle ORM with Bun's native SQL client.
297
- *
298
- * This provider uses Bun's built-in SQL class for PostgreSQL connections,
299
- * which provides excellent performance on the Bun runtime.
300
- *
301
- * @example
302
- * ```ts
303
- * // Set DATABASE_URL environment variable
304
- * // DATABASE_URL=postgres://user:password@localhost:5432/database
305
- *
306
- * // Or configure programmatically
307
- * alepha.with({
308
- * provide: DatabaseProvider,
309
- * use: BunPostgresProvider,
310
- * });
311
- * ```
312
- */
313
- //#endregion
314
- //#region ../../src/orm/providers/drivers/BunSqliteProvider.d.ts
315
- /**
316
- * Configuration options for the Bun SQLite database provider.
317
- */
318
- declare const bunSqliteOptions: alepha160.Atom<alepha160.TObject<{
319
- path: alepha160.TOptional<alepha160.TString>;
320
- }>, "alepha.postgres.bun-sqlite.options">;
321
- type BunSqliteProviderOptions = Static<typeof bunSqliteOptions.schema>;
322
- declare module "alepha" {
323
- interface State {
324
- [bunSqliteOptions.key]: BunSqliteProviderOptions;
325
- }
326
- }
327
- /**
328
- * Bun SQLite provider using Drizzle ORM with Bun's native SQLite client.
329
- *
330
- * This provider uses Bun's built-in `bun:sqlite` for SQLite connections,
331
- * which provides excellent performance on the Bun runtime.
332
- *
333
- * @example
334
- * ```ts
335
- * // Set DATABASE_URL environment variable
336
- * // DATABASE_URL=sqlite://./my-database.db
337
- *
338
- * // Or configure programmatically
339
- * alepha.with({
340
- * provide: DatabaseProvider,
341
- * use: BunSqliteProvider,
342
- * });
343
- *
344
- * // Or use options atom
345
- * alepha.store.mut(bunSqliteOptions, (old) => ({
346
- * ...old,
347
- * path: ":memory:",
348
- * }));
349
- * ```
350
- */
351
- //#endregion
352
- //#region ../../src/orm/providers/drivers/NodePostgresProvider.d.ts
353
- declare module "alepha" {
354
- interface Env extends Partial<Static<typeof envSchema>> {}
355
- }
356
- declare const envSchema: alepha160.TObject<{
357
- /**
358
- * Main configuration for database connection.
359
- * Accept a string in the format of a Postgres connection URL.
360
- * Example: postgres://user:password@localhost:5432/database
361
- * or
362
- * Example: postgres://user:password@localhost:5432/database?sslmode=require
363
- */
364
- DATABASE_URL: alepha160.TOptional<alepha160.TString>;
365
- /**
366
- * In addition to the DATABASE_URL, you can specify the postgres schema name.
367
- *
368
- * It will monkey patch drizzle tables.
369
- */
370
- POSTGRES_SCHEMA: alepha160.TOptional<alepha160.TString>;
371
- }>;
372
- //#endregion
373
- //#region ../../src/orm/providers/drivers/NodeSqliteProvider.d.ts
374
- /**
375
- * Configuration options for the Node.js SQLite database provider.
376
- */
377
- declare const nodeSqliteOptions: alepha160.Atom<alepha160.TObject<{
378
- path: alepha160.TOptional<alepha160.TString>;
379
- }>, "alepha.postgres.node-sqlite.options">;
380
- type NodeSqliteProviderOptions = Static<typeof nodeSqliteOptions.schema>;
381
- declare module "alepha" {
382
- interface State {
383
- [nodeSqliteOptions.key]: NodeSqliteProviderOptions;
384
- }
385
- }
386
- /**
387
- * Add a fake support for SQLite in Node.js based on Postgres interfaces.
388
- *
389
- * This is NOT a real SQLite provider, it's a workaround to use SQLite with Drizzle ORM.
390
- * This is NOT recommended for production use.
391
- */
392
- //#endregion
393
- //#region ../../src/orm/index.d.ts
394
- declare module "alepha" {
395
- interface Hooks {
396
- /**
397
- * Fires before creating an entity in the repository.
398
- */
399
- "repository:create:before": {
400
- tableName: string;
401
- data: any;
402
- };
403
- /**
404
- * Fires after creating an entity in the repository.
405
- */
406
- "repository:create:after": {
407
- tableName: string;
408
- data: any;
409
- entity: any;
410
- };
411
- /**
412
- * Fires before updating entities in the repository.
413
- */
414
- "repository:update:before": {
415
- tableName: string;
416
- where: any;
417
- data: any;
418
- };
419
- /**
420
- * Fires after updating entities in the repository.
421
- */
422
- "repository:update:after": {
423
- tableName: string;
424
- where: any;
425
- data: any;
426
- entities: any[];
427
- };
428
- /**
429
- * Fires before deleting entities from the repository.
430
- */
431
- "repository:delete:before": {
432
- tableName: string;
433
- where: any;
434
- };
435
- /**
436
- * Fires after deleting entities from the repository.
437
- */
438
- "repository:delete:after": {
439
- tableName: string;
440
- where: any;
441
- ids: Array<string | number>;
442
- };
443
- /**
444
- * Fires before reading entities from the repository.
445
- */
446
- "repository:read:before": {
447
- tableName: string;
448
- query: any;
449
- };
450
- /**
451
- * Fires after reading entities from the repository.
452
- */
453
- "repository:read:after": {
454
- tableName: string;
455
- query: any;
456
- entities: any[];
457
- };
458
- }
459
- }
460
- //#endregion
461
269
  //#region ../../src/api/files/schemas/fileResourceSchema.d.ts
462
270
  declare const fileResourceSchema: alepha160.TObject<{
463
271
  id: PgAttr<PgAttr<alepha160.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
@@ -531,57 +339,57 @@ declare class FileService {
531
339
  protected onUploadFile: alepha160.HookPrimitive<"bucket:file:uploaded">;
532
340
  protected onDeleteBucketFile: alepha160.HookPrimitive<"bucket:file:deleted">;
533
341
  /**
534
- * Calculates SHA-256 checksum of a file.
535
- *
536
- * @param file - The file to calculate checksum for
537
- * @returns Hexadecimal string representation of the SHA-256 hash
538
- * @protected
539
- */
342
+ * Calculates SHA-256 checksum of a file.
343
+ *
344
+ * @param file - The file to calculate checksum for
345
+ * @returns Hexadecimal string representation of the SHA-256 hash
346
+ * @protected
347
+ */
540
348
  protected calculateChecksum(file: FileLike): Promise<string>;
541
349
  /**
542
- * Gets a bucket primitive by name.
543
- *
544
- * @param bucketName - The name of the bucket to retrieve (defaults to "default")
545
- * @returns The bucket primitive
546
- * @throws {NotFoundError} If the bucket is not found
547
- */
350
+ * Gets a bucket primitive by name.
351
+ *
352
+ * @param bucketName - The name of the bucket to retrieve (defaults to "default")
353
+ * @returns The bucket primitive
354
+ * @throws {NotFoundError} If the bucket is not found
355
+ */
548
356
  bucket(bucketName?: string): BucketPrimitive;
549
357
  /**
550
- * Finds files matching the given query criteria with pagination support.
551
- * Supports filtering by bucket, tags, name, mimeType, creator, and date range.
552
- *
553
- * @param q - Query parameters including bucket, tags, name, mimeType, creator, date range, pagination, and sorting
554
- * @returns Paginated list of file entities
555
- */
358
+ * Finds files matching the given query criteria with pagination support.
359
+ * Supports filtering by bucket, tags, name, mimeType, creator, and date range.
360
+ *
361
+ * @param q - Query parameters including bucket, tags, name, mimeType, creator, date range, pagination, and sorting
362
+ * @returns Paginated list of file entities
363
+ */
556
364
  findFiles(q?: FileQuery): Promise<Page<FileEntity>>;
557
365
  /**
558
- * Finds files that have expired based on their expiration date.
559
- * Limited to 1000 files per call to prevent memory issues.
560
- *
561
- * @returns Array of expired file entities
562
- */
366
+ * Finds files that have expired based on their expiration date.
367
+ * Limited to 1000 files per call to prevent memory issues.
368
+ *
369
+ * @returns Array of expired file entities
370
+ */
563
371
  findExpiredFiles(): Promise<FileEntity[]>;
564
372
  /**
565
- * Calculates an expiration date based on a TTL (time to live) duration.
566
- *
567
- * @param ttl - Duration like "1 day", "2 hours", etc.
568
- * @returns DateTime representation of the expiration date, or undefined if no TTL provided
569
- * @protected
570
- */
373
+ * Calculates an expiration date based on a TTL (time to live) duration.
374
+ *
375
+ * @param ttl - Duration like "1 day", "2 hours", etc.
376
+ * @returns DateTime representation of the expiration date, or undefined if no TTL provided
377
+ * @protected
378
+ */
571
379
  protected getExpirationDate(ttl?: DurationLike): string | undefined;
572
380
  /**
573
- * Uploads a file to a bucket and creates a database record with metadata.
574
- * Automatically calculates and stores the file checksum (SHA-256).
575
- *
576
- * @param file - The file to upload
577
- * @param options - Upload options including bucket, expiration, user, and tags
578
- * @param options.bucket - Target bucket name (defaults to "default")
579
- * @param options.expirationDate - When the file should expire
580
- * @param options.user - User performing the upload (for audit trail)
581
- * @param options.tags - Tags to associate with the file
582
- * @returns The created file entity with all metadata
583
- * @throws {NotFoundError} If the specified bucket doesn't exist
584
- */
381
+ * Uploads a file to a bucket and creates a database record with metadata.
382
+ * Automatically calculates and stores the file checksum (SHA-256).
383
+ *
384
+ * @param file - The file to upload
385
+ * @param options - Upload options including bucket, expiration, user, and tags
386
+ * @param options.bucket - Target bucket name (defaults to "default")
387
+ * @param options.expirationDate - When the file should expire
388
+ * @param options.user - User performing the upload (for audit trail)
389
+ * @param options.tags - Tags to associate with the file
390
+ * @returns The created file entity with all metadata
391
+ * @throws {NotFoundError} If the specified bucket doesn't exist
392
+ */
585
393
  uploadFile(file: FileLike, options?: {
586
394
  expirationDate?: string | DateTime;
587
395
  bucket?: string;
@@ -589,63 +397,63 @@ declare class FileService {
589
397
  tags?: string[];
590
398
  }): Promise<FileEntity>;
591
399
  /**
592
- * Streams a file from storage by its database ID.
593
- *
594
- * @param id - The database ID (UUID) of the file to stream
595
- * @returns The file object ready for streaming/downloading
596
- * @throws {NotFoundError} If the file doesn't exist in the database
597
- * @throws {FileNotFoundError} If the file exists in database but not in storage
598
- */
400
+ * Streams a file from storage by its database ID.
401
+ *
402
+ * @param id - The database ID (UUID) of the file to stream
403
+ * @returns The file object ready for streaming/downloading
404
+ * @throws {NotFoundError} If the file doesn't exist in the database
405
+ * @throws {FileNotFoundError} If the file exists in database but not in storage
406
+ */
599
407
  streamFile(id: string): Promise<FileLike>;
600
408
  /**
601
- * Updates file metadata (name, tags, expiration date).
602
- * Does not modify the actual file content in storage.
603
- *
604
- * @param id - The database ID (UUID) of the file to update
605
- * @param data - Partial file data to update
606
- * @param data.name - New file name
607
- * @param data.tags - New tags array
608
- * @param data.expirationDate - New expiration date
609
- * @returns The updated file entity
610
- * @throws {NotFoundError} If the file doesn't exist in the database
611
- */
409
+ * Updates file metadata (name, tags, expiration date).
410
+ * Does not modify the actual file content in storage.
411
+ *
412
+ * @param id - The database ID (UUID) of the file to update
413
+ * @param data - Partial file data to update
414
+ * @param data.name - New file name
415
+ * @param data.tags - New tags array
416
+ * @param data.expirationDate - New expiration date
417
+ * @returns The updated file entity
418
+ * @throws {NotFoundError} If the file doesn't exist in the database
419
+ */
612
420
  updateFile(id: string, data: {
613
421
  name?: string;
614
422
  tags?: string[];
615
423
  expirationDate?: DateTime | string;
616
424
  }): Promise<FileEntity>;
617
425
  /**
618
- * Deletes a file from both storage and database.
619
- * Handles cases where file is already deleted from storage gracefully.
620
- * Always ensures database record is removed even if storage deletion fails.
621
- *
622
- * @param id - The database ID (UUID) of the file to delete
623
- * @returns Success response with the deleted file ID
624
- * @throws {NotFoundError} If the file doesn't exist in the database
625
- */
426
+ * Deletes a file from both storage and database.
427
+ * Handles cases where file is already deleted from storage gracefully.
428
+ * Always ensures database record is removed even if storage deletion fails.
429
+ *
430
+ * @param id - The database ID (UUID) of the file to delete
431
+ * @returns Success response with the deleted file ID
432
+ * @throws {NotFoundError} If the file doesn't exist in the database
433
+ */
626
434
  deleteFile(id: string): Promise<Ok>;
627
435
  /**
628
- * Retrieves a file entity by its ID.
629
- * If already an entity object, returns it as-is (convenience method).
630
- *
631
- * @param id - Either a UUID string or an existing FileEntity object
632
- * @returns The file entity
633
- * @throws {NotFoundError} If the file doesn't exist in the database
634
- */
436
+ * Retrieves a file entity by its ID.
437
+ * If already an entity object, returns it as-is (convenience method).
438
+ *
439
+ * @param id - Either a UUID string or an existing FileEntity object
440
+ * @returns The file entity
441
+ * @throws {NotFoundError} If the file doesn't exist in the database
442
+ */
635
443
  getFileById(id: string | FileEntity): Promise<FileEntity>;
636
444
  /**
637
- * Gets storage statistics including total size, file count, and breakdowns by bucket and MIME type.
638
- *
639
- * @returns Storage statistics with aggregated data
640
- */
445
+ * Gets storage statistics including total size, file count, and breakdowns by bucket and MIME type.
446
+ *
447
+ * @returns Storage statistics with aggregated data
448
+ */
641
449
  getStorageStats(): Promise<StorageStats>;
642
450
  /**
643
- * Converts a file entity to a file resource (API response format).
644
- * Currently a pass-through, but allows for future transformation logic.
645
- *
646
- * @param entity - The file entity to convert
647
- * @returns The file resource for API responses
648
- */
451
+ * Converts a file entity to a file resource (API response format).
452
+ * Currently a pass-through, but allows for future transformation logic.
453
+ *
454
+ * @param entity - The file entity to convert
455
+ * @returns The file resource for API responses
456
+ */
649
457
  entityToResource(entity: FileEntity): FileResource;
650
458
  }
651
459
  //#endregion
@@ -659,10 +467,10 @@ declare class AdminFileStatsController {
659
467
  protected readonly group = "admin:files";
660
468
  protected readonly fileService: FileService;
661
469
  /**
662
- * GET /files/stats - Gets storage statistics.
663
- * Returns aggregated data including total size, file count,
664
- * and breakdowns by bucket and MIME type.
665
- */
470
+ * GET /files/stats - Gets storage statistics.
471
+ * Returns aggregated data including total size, file count,
472
+ * and breakdowns by bucket and MIME type.
473
+ */
666
474
  readonly getStats: alepha_server0.ActionPrimitiveFn<{
667
475
  response: alepha160.TObject<{
668
476
  totalSize: alepha160.TNumber;
@@ -690,9 +498,9 @@ declare class FileController {
690
498
  protected readonly group = "files";
691
499
  protected readonly fileService: FileService;
692
500
  /**
693
- * GET /files - Lists files with optional filtering and pagination.
694
- * Supports filtering by bucket and tags.
695
- */
501
+ * GET /files - Lists files with optional filtering and pagination.
502
+ * Supports filtering by bucket and tags.
503
+ */
696
504
  readonly findFiles: alepha_server0.ActionPrimitiveFn<{
697
505
  query: alepha160.TObject<{
698
506
  page: alepha160.TOptional<alepha160.TInteger>;
@@ -725,9 +533,9 @@ declare class FileController {
725
533
  }>>;
726
534
  }>;
727
535
  /**
728
- * DELETE /files/:id - Deletes a file from both storage and database.
729
- * Removes the file from the bucket and cleans up the database record.
730
- */
536
+ * DELETE /files/:id - Deletes a file from both storage and database.
537
+ * Removes the file from the bucket and cleans up the database record.
538
+ */
731
539
  readonly deleteFile: alepha_server0.ActionPrimitiveFn<{
732
540
  params: alepha160.TObject<{
733
541
  id: alepha160.TString;
@@ -739,10 +547,10 @@ declare class FileController {
739
547
  }>;
740
548
  }>;
741
549
  /**
742
- * POST /files - Uploads a new file to storage.
743
- * Creates a database record with metadata and calculates checksum.
744
- * Optionally specify bucket and expiration date.
745
- */
550
+ * POST /files - Uploads a new file to storage.
551
+ * Creates a database record with metadata and calculates checksum.
552
+ * Optionally specify bucket and expiration date.
553
+ */
746
554
  readonly uploadFile: alepha_server0.ActionPrimitiveFn<{
747
555
  body: alepha160.TObject<{
748
556
  file: alepha160.TFile;
@@ -770,9 +578,9 @@ declare class FileController {
770
578
  }>;
771
579
  }>;
772
580
  /**
773
- * PATCH /files/:id - Updates file metadata.
774
- * Allows updating name, tags, and expiration date without modifying file content.
775
- */
581
+ * PATCH /files/:id - Updates file metadata.
582
+ * Allows updating name, tags, and expiration date without modifying file content.
583
+ */
776
584
  readonly updateFile: alepha_server0.ActionPrimitiveFn<{
777
585
  params: alepha160.TObject<{
778
586
  id: alepha160.TString;
@@ -801,10 +609,10 @@ declare class FileController {
801
609
  }>;
802
610
  }>;
803
611
  /**
804
- * GET /files/:id - Streams/downloads a file by its ID.
805
- * Returns the file content with appropriate Content-Type header.
806
- * Cached with ETag support for 1 year (immutable).
807
- */
612
+ * GET /files/:id - Streams/downloads a file by its ID.
613
+ * Returns the file content with appropriate Content-Type header.
614
+ * Cached with ETag support for 1 year (immutable).
615
+ */
808
616
  readonly streamFile: alepha_server0.ActionPrimitiveFn<{
809
617
  params: alepha160.TObject<{
810
618
  id: alepha160.TString;
@@ -823,22 +631,22 @@ declare class FileJobs {
823
631
  declare module "alepha/bucket" {
824
632
  interface BucketFileOptions {
825
633
  /**
826
- * Time to live for the files in the bucket.
827
- */
634
+ * Time to live for the files in the bucket.
635
+ */
828
636
  ttl?: DurationLike;
829
637
  /**
830
- * Tags for the bucket.
831
- */
638
+ * Tags for the bucket.
639
+ */
832
640
  tags?: string[];
833
641
  /**
834
- * User performing the operation.
835
- */
642
+ * User performing the operation.
643
+ */
836
644
  user?: UserAccountToken;
837
645
  /**
838
- * Whether to persist the file metadata in the database.
839
- *
840
- * @default true
841
- */
646
+ * Whether to persist the file metadata in the database.
647
+ *
648
+ * @default true
649
+ */
842
650
  persist?: boolean;
843
651
  }
844
652
  }