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