alepha 0.13.1 → 0.13.2

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 (296) hide show
  1. package/README.md +1 -1
  2. package/dist/api-files/index.d.ts +28 -91
  3. package/dist/api-files/index.js +10 -755
  4. package/dist/api-files/index.js.map +1 -1
  5. package/dist/api-jobs/index.d.ts +46 -46
  6. package/dist/api-jobs/index.js +13 -13
  7. package/dist/api-jobs/index.js.map +1 -1
  8. package/dist/api-notifications/index.d.ts +129 -146
  9. package/dist/api-notifications/index.js +17 -39
  10. package/dist/api-notifications/index.js.map +1 -1
  11. package/dist/api-parameters/index.d.ts +21 -22
  12. package/dist/api-parameters/index.js +22 -22
  13. package/dist/api-parameters/index.js.map +1 -1
  14. package/dist/api-users/index.d.ts +223 -2000
  15. package/dist/api-users/index.js +914 -4787
  16. package/dist/api-users/index.js.map +1 -1
  17. package/dist/api-verifications/index.d.ts +96 -96
  18. package/dist/batch/index.d.ts +13 -13
  19. package/dist/batch/index.js +8 -8
  20. package/dist/batch/index.js.map +1 -1
  21. package/dist/bucket/index.d.ts +14 -14
  22. package/dist/bucket/index.js +12 -12
  23. package/dist/bucket/index.js.map +1 -1
  24. package/dist/cache/index.d.ts +11 -11
  25. package/dist/cache/index.js +9 -9
  26. package/dist/cache/index.js.map +1 -1
  27. package/dist/cli/index.d.ts +28 -26
  28. package/dist/cli/index.js +50 -13
  29. package/dist/cli/index.js.map +1 -1
  30. package/dist/command/index.d.ts +19 -19
  31. package/dist/command/index.js +25 -25
  32. package/dist/command/index.js.map +1 -1
  33. package/dist/core/index.browser.js +218 -218
  34. package/dist/core/index.browser.js.map +1 -1
  35. package/dist/core/index.d.ts +232 -232
  36. package/dist/core/index.js +218 -218
  37. package/dist/core/index.js.map +1 -1
  38. package/dist/core/index.native.js +2113 -0
  39. package/dist/core/index.native.js.map +1 -0
  40. package/dist/datetime/index.d.ts +9 -9
  41. package/dist/datetime/index.js +7 -7
  42. package/dist/datetime/index.js.map +1 -1
  43. package/dist/email/index.d.ts +16 -16
  44. package/dist/email/index.js +9 -9
  45. package/dist/email/index.js.map +1 -1
  46. package/dist/file/index.js +1 -1
  47. package/dist/file/index.js.map +1 -1
  48. package/dist/lock/index.d.ts +9 -9
  49. package/dist/lock/index.js +8 -8
  50. package/dist/lock/index.js.map +1 -1
  51. package/dist/lock-redis/index.js +3 -66
  52. package/dist/lock-redis/index.js.map +1 -1
  53. package/dist/logger/index.d.ts +5 -5
  54. package/dist/logger/index.js +8 -8
  55. package/dist/logger/index.js.map +1 -1
  56. package/dist/orm/index.browser.js +114 -114
  57. package/dist/orm/index.browser.js.map +1 -1
  58. package/dist/orm/index.d.ts +218 -218
  59. package/dist/orm/index.js +46 -46
  60. package/dist/orm/index.js.map +1 -1
  61. package/dist/queue/index.d.ts +29 -29
  62. package/dist/queue/index.js +20 -20
  63. package/dist/queue/index.js.map +1 -1
  64. package/dist/queue-redis/index.d.ts +2 -2
  65. package/dist/redis/index.d.ts +10 -10
  66. package/dist/retry/index.d.ts +19 -19
  67. package/dist/retry/index.js +7 -7
  68. package/dist/retry/index.js.map +1 -1
  69. package/dist/scheduler/index.d.ts +16 -16
  70. package/dist/scheduler/index.js +9 -9
  71. package/dist/scheduler/index.js.map +1 -1
  72. package/dist/security/index.d.ts +80 -80
  73. package/dist/security/index.js +32 -32
  74. package/dist/security/index.js.map +1 -1
  75. package/dist/server/index.browser.js +1 -1
  76. package/dist/server/index.browser.js.map +1 -1
  77. package/dist/server/index.d.ts +101 -101
  78. package/dist/server/index.js +16 -16
  79. package/dist/server/index.js.map +1 -1
  80. package/dist/server-auth/index.browser.js +4 -982
  81. package/dist/server-auth/index.browser.js.map +1 -1
  82. package/dist/server-auth/index.d.ts +204 -785
  83. package/dist/server-auth/index.js +47 -1239
  84. package/dist/server-auth/index.js.map +1 -1
  85. package/dist/server-cache/index.d.ts +10 -10
  86. package/dist/server-cache/index.js +2 -2
  87. package/dist/server-cache/index.js.map +1 -1
  88. package/dist/server-compress/index.d.ts +4 -4
  89. package/dist/server-compress/index.js +1 -1
  90. package/dist/server-compress/index.js.map +1 -1
  91. package/dist/server-cookies/index.browser.js +8 -8
  92. package/dist/server-cookies/index.browser.js.map +1 -1
  93. package/dist/server-cookies/index.d.ts +17 -17
  94. package/dist/server-cookies/index.js +10 -10
  95. package/dist/server-cookies/index.js.map +1 -1
  96. package/dist/server-cors/index.d.ts +17 -17
  97. package/dist/server-cors/index.js +9 -9
  98. package/dist/server-cors/index.js.map +1 -1
  99. package/dist/server-health/index.d.ts +19 -19
  100. package/dist/server-helmet/index.d.ts +1 -1
  101. package/dist/server-links/index.browser.js +12 -12
  102. package/dist/server-links/index.browser.js.map +1 -1
  103. package/dist/server-links/index.d.ts +59 -251
  104. package/dist/server-links/index.js +23 -502
  105. package/dist/server-links/index.js.map +1 -1
  106. package/dist/server-metrics/index.d.ts +4 -4
  107. package/dist/server-multipart/index.d.ts +2 -2
  108. package/dist/server-proxy/index.d.ts +12 -12
  109. package/dist/server-proxy/index.js +10 -10
  110. package/dist/server-proxy/index.js.map +1 -1
  111. package/dist/server-rate-limit/index.d.ts +22 -22
  112. package/dist/server-rate-limit/index.js +12 -12
  113. package/dist/server-rate-limit/index.js.map +1 -1
  114. package/dist/server-security/index.d.ts +22 -22
  115. package/dist/server-security/index.js +15 -15
  116. package/dist/server-security/index.js.map +1 -1
  117. package/dist/server-static/index.d.ts +14 -14
  118. package/dist/server-static/index.js +8 -8
  119. package/dist/server-static/index.js.map +1 -1
  120. package/dist/server-swagger/index.d.ts +25 -184
  121. package/dist/server-swagger/index.js +21 -724
  122. package/dist/server-swagger/index.js.map +1 -1
  123. package/dist/sms/index.d.ts +14 -14
  124. package/dist/sms/index.js +9 -9
  125. package/dist/sms/index.js.map +1 -1
  126. package/dist/thread/index.d.ts +11 -11
  127. package/dist/thread/index.js +17 -17
  128. package/dist/thread/index.js.map +1 -1
  129. package/dist/topic/index.d.ts +26 -26
  130. package/dist/topic/index.js +16 -16
  131. package/dist/topic/index.js.map +1 -1
  132. package/dist/topic-redis/index.d.ts +1 -1
  133. package/dist/vite/index.d.ts +3 -3
  134. package/dist/vite/index.js +8 -8
  135. package/dist/vite/index.js.map +1 -1
  136. package/dist/websocket/index.browser.js +11 -11
  137. package/dist/websocket/index.browser.js.map +1 -1
  138. package/dist/websocket/index.d.ts +58 -58
  139. package/dist/websocket/index.js +13 -13
  140. package/dist/websocket/index.js.map +1 -1
  141. package/package.json +113 -52
  142. package/src/api-files/services/FileService.ts +5 -7
  143. package/src/api-jobs/index.ts +1 -1
  144. package/src/api-jobs/{descriptors → primitives}/$job.ts +8 -8
  145. package/src/api-jobs/providers/JobProvider.ts +9 -9
  146. package/src/api-jobs/services/JobService.ts +5 -5
  147. package/src/api-notifications/index.ts +5 -15
  148. package/src/api-notifications/{descriptors → primitives}/$notification.ts +10 -10
  149. package/src/api-notifications/services/NotificationSenderService.ts +3 -3
  150. package/src/api-parameters/index.ts +1 -1
  151. package/src/api-parameters/{descriptors → primitives}/$config.ts +7 -12
  152. package/src/api-users/index.ts +1 -1
  153. package/src/api-users/{descriptors → primitives}/$userRealm.ts +8 -8
  154. package/src/api-users/providers/UserRealmProvider.ts +1 -1
  155. package/src/batch/index.ts +3 -3
  156. package/src/batch/{descriptors → primitives}/$batch.ts +13 -16
  157. package/src/bucket/index.ts +8 -8
  158. package/src/bucket/{descriptors → primitives}/$bucket.ts +8 -8
  159. package/src/bucket/providers/LocalFileStorageProvider.ts +3 -3
  160. package/src/cache/index.ts +4 -4
  161. package/src/cache/{descriptors → primitives}/$cache.ts +15 -15
  162. package/src/cli/apps/AlephaPackageBuilderCli.ts +24 -2
  163. package/src/cli/commands/DrizzleCommands.ts +6 -6
  164. package/src/cli/commands/VerifyCommands.ts +1 -1
  165. package/src/cli/commands/ViteCommands.ts +6 -1
  166. package/src/cli/services/ProjectUtils.ts +34 -3
  167. package/src/command/index.ts +5 -5
  168. package/src/command/{descriptors → primitives}/$command.ts +9 -12
  169. package/src/command/providers/CliProvider.ts +10 -10
  170. package/src/core/Alepha.ts +30 -33
  171. package/src/core/constants/KIND.ts +1 -1
  172. package/src/core/constants/OPTIONS.ts +1 -1
  173. package/src/core/helpers/{descriptor.ts → primitive.ts} +18 -18
  174. package/src/core/helpers/ref.ts +1 -1
  175. package/src/core/index.shared.ts +8 -8
  176. package/src/core/{descriptors → primitives}/$context.ts +5 -5
  177. package/src/core/{descriptors → primitives}/$hook.ts +4 -4
  178. package/src/core/{descriptors → primitives}/$inject.ts +2 -2
  179. package/src/core/{descriptors → primitives}/$module.ts +9 -9
  180. package/src/core/{descriptors → primitives}/$use.ts +2 -2
  181. package/src/core/providers/CodecManager.ts +1 -1
  182. package/src/core/providers/JsonSchemaCodec.ts +1 -1
  183. package/src/core/providers/StateManager.ts +2 -2
  184. package/src/datetime/index.ts +3 -3
  185. package/src/datetime/{descriptors → primitives}/$interval.ts +6 -6
  186. package/src/email/index.ts +4 -4
  187. package/src/email/{descriptors → primitives}/$email.ts +8 -8
  188. package/src/file/index.ts +1 -1
  189. package/src/lock/index.ts +3 -3
  190. package/src/lock/{descriptors → primitives}/$lock.ts +10 -10
  191. package/src/logger/index.ts +8 -8
  192. package/src/logger/{descriptors → primitives}/$logger.ts +2 -2
  193. package/src/logger/services/Logger.ts +1 -1
  194. package/src/orm/constants/PG_SYMBOLS.ts +2 -2
  195. package/src/orm/index.browser.ts +2 -2
  196. package/src/orm/index.ts +8 -8
  197. package/src/orm/{descriptors → primitives}/$entity.ts +11 -11
  198. package/src/orm/{descriptors → primitives}/$repository.ts +2 -2
  199. package/src/orm/{descriptors → primitives}/$sequence.ts +8 -8
  200. package/src/orm/{descriptors → primitives}/$transaction.ts +4 -4
  201. package/src/orm/providers/PostgresTypeProvider.ts +3 -3
  202. package/src/orm/providers/RepositoryProvider.ts +4 -4
  203. package/src/orm/providers/drivers/DatabaseProvider.ts +7 -7
  204. package/src/orm/services/ModelBuilder.ts +9 -9
  205. package/src/orm/services/PgRelationManager.ts +2 -2
  206. package/src/orm/services/PostgresModelBuilder.ts +5 -5
  207. package/src/orm/services/Repository.ts +7 -7
  208. package/src/orm/services/SqliteModelBuilder.ts +5 -5
  209. package/src/queue/index.ts +7 -7
  210. package/src/queue/{descriptors → primitives}/$consumer.ts +15 -15
  211. package/src/queue/{descriptors → primitives}/$queue.ts +12 -12
  212. package/src/queue/providers/WorkerProvider.ts +7 -7
  213. package/src/retry/index.ts +3 -3
  214. package/src/retry/{descriptors → primitives}/$retry.ts +14 -14
  215. package/src/scheduler/index.ts +3 -3
  216. package/src/scheduler/{descriptors → primitives}/$scheduler.ts +9 -9
  217. package/src/scheduler/providers/CronProvider.ts +1 -1
  218. package/src/security/index.ts +9 -9
  219. package/src/security/{descriptors → primitives}/$permission.ts +7 -7
  220. package/src/security/{descriptors → primitives}/$realm.ts +6 -12
  221. package/src/security/{descriptors → primitives}/$role.ts +12 -12
  222. package/src/security/{descriptors → primitives}/$serviceAccount.ts +8 -8
  223. package/src/server/index.browser.ts +1 -1
  224. package/src/server/index.ts +14 -14
  225. package/src/server/{descriptors → primitives}/$action.ts +13 -13
  226. package/src/server/{descriptors → primitives}/$route.ts +9 -9
  227. package/src/server/providers/NodeHttpServerProvider.ts +1 -1
  228. package/src/server/services/HttpClient.ts +1 -1
  229. package/src/server-auth/index.browser.ts +1 -1
  230. package/src/server-auth/index.ts +6 -6
  231. package/src/server-auth/{descriptors → primitives}/$auth.ts +10 -10
  232. package/src/server-auth/{descriptors → primitives}/$authCredentials.ts +4 -4
  233. package/src/server-auth/{descriptors → primitives}/$authGithub.ts +4 -4
  234. package/src/server-auth/{descriptors → primitives}/$authGoogle.ts +4 -4
  235. package/src/server-auth/providers/ServerAuthProvider.ts +4 -4
  236. package/src/server-cache/providers/ServerCacheProvider.ts +7 -7
  237. package/src/server-compress/providers/ServerCompressProvider.ts +3 -3
  238. package/src/server-cookies/index.browser.ts +2 -2
  239. package/src/server-cookies/index.ts +5 -5
  240. package/src/server-cookies/{descriptors → primitives}/$cookie.browser.ts +12 -12
  241. package/src/server-cookies/{descriptors → primitives}/$cookie.ts +13 -13
  242. package/src/server-cookies/providers/ServerCookiesProvider.ts +4 -4
  243. package/src/server-cookies/services/CookieParser.ts +1 -1
  244. package/src/server-cors/index.ts +3 -3
  245. package/src/server-cors/{descriptors → primitives}/$cors.ts +11 -13
  246. package/src/server-cors/providers/ServerCorsProvider.ts +5 -5
  247. package/src/server-links/index.browser.ts +5 -5
  248. package/src/server-links/index.ts +9 -9
  249. package/src/server-links/{descriptors → primitives}/$remote.ts +11 -11
  250. package/src/server-links/providers/LinkProvider.ts +7 -7
  251. package/src/server-links/providers/{RemoteDescriptorProvider.ts → RemotePrimitiveProvider.ts} +6 -6
  252. package/src/server-links/providers/ServerLinksProvider.ts +3 -3
  253. package/src/server-proxy/index.ts +3 -3
  254. package/src/server-proxy/{descriptors → primitives}/$proxy.ts +8 -8
  255. package/src/server-proxy/providers/ServerProxyProvider.ts +4 -4
  256. package/src/server-rate-limit/index.ts +6 -6
  257. package/src/server-rate-limit/{descriptors → primitives}/$rateLimit.ts +13 -13
  258. package/src/server-rate-limit/providers/ServerRateLimitProvider.ts +5 -5
  259. package/src/server-security/index.ts +3 -3
  260. package/src/server-security/{descriptors → primitives}/$basicAuth.ts +13 -13
  261. package/src/server-security/providers/ServerBasicAuthProvider.ts +5 -5
  262. package/src/server-security/providers/ServerSecurityProvider.ts +4 -4
  263. package/src/server-static/index.ts +3 -3
  264. package/src/server-static/{descriptors → primitives}/$serve.ts +8 -10
  265. package/src/server-static/providers/ServerStaticProvider.ts +6 -6
  266. package/src/server-swagger/index.ts +5 -5
  267. package/src/server-swagger/{descriptors → primitives}/$swagger.ts +9 -9
  268. package/src/server-swagger/providers/ServerSwaggerProvider.ts +11 -10
  269. package/src/sms/index.ts +4 -4
  270. package/src/sms/{descriptors → primitives}/$sms.ts +8 -8
  271. package/src/thread/index.ts +3 -3
  272. package/src/thread/{descriptors → primitives}/$thread.ts +13 -13
  273. package/src/thread/providers/ThreadProvider.ts +7 -9
  274. package/src/topic/index.ts +5 -5
  275. package/src/topic/{descriptors → primitives}/$subscriber.ts +14 -14
  276. package/src/topic/{descriptors → primitives}/$topic.ts +10 -10
  277. package/src/topic/providers/TopicProvider.ts +4 -4
  278. package/src/vite/tasks/copyAssets.ts +1 -1
  279. package/src/vite/tasks/generateSitemap.ts +3 -3
  280. package/src/vite/tasks/prerenderPages.ts +2 -2
  281. package/src/vite/tasks/runAlepha.ts +2 -2
  282. package/src/websocket/index.browser.ts +3 -3
  283. package/src/websocket/index.shared.ts +2 -2
  284. package/src/websocket/index.ts +4 -4
  285. package/src/websocket/interfaces/WebSocketInterfaces.ts +3 -3
  286. package/src/websocket/{descriptors → primitives}/$channel.ts +10 -10
  287. package/src/websocket/{descriptors → primitives}/$websocket.ts +8 -8
  288. package/src/websocket/providers/NodeWebSocketServerProvider.ts +7 -7
  289. package/src/websocket/providers/WebSocketServerProvider.ts +3 -3
  290. package/src/websocket/services/WebSocketClient.ts +5 -5
  291. package/src/api-notifications/providers/MemorySmsProvider.ts +0 -20
  292. package/src/api-notifications/providers/SmsProvider.ts +0 -8
  293. /package/src/core/{descriptors → primitives}/$atom.ts +0 -0
  294. /package/src/core/{descriptors → primitives}/$env.ts +0 -0
  295. /package/src/server-auth/{descriptors → primitives}/$authApple.ts +0 -0
  296. /package/src/server-links/{descriptors → primitives}/$client.ts +0 -0
@@ -1,19 +1,18 @@
1
1
  import * as alepha23 from "alepha";
2
- import { Alepha, AlephaError, Async, Descriptor, FileLike, KIND, Page, PageQuery, Static, StaticEncode, TNull, TObject, TOptional, TSchema, TUnion } from "alepha";
3
- import * as alepha_batch0 from "alepha/batch";
4
- import { DateTime, DateTimeProvider, DurationLike } from "alepha/datetime";
5
- import * as alepha_logger1 from "alepha/logger";
2
+ import { Alepha, AlephaError, Page, PageQuery, Primitive, Static, StaticEncode, TNull, TObject, TOptional, TSchema, TUnion } from "alepha";
3
+ import * as alepha_api_notifications0 from "alepha/api/notifications";
4
+ import { VerificationController } from "alepha/api/verifications";
6
5
  import * as alepha_orm204 from "alepha/orm";
7
6
  import { Page as Page$1, Repository } from "alepha/orm";
8
- import "alepha/queue";
9
- import { EmailProvider } from "alepha/email";
10
7
  import * as alepha_server0 from "alepha/server";
11
- import { ActionDescriptor, ClientRequestEntry, ClientRequestOptions, ClientRequestResponse, FetchOptions, FetchResponse, HttpClient, Ok, RequestConfigSchema, ServerHandler, ServerRequest, ServerRequestConfigEntry, ServerResponseBody, ServerRouterProvider, ServerTimingProvider } from "alepha/server";
8
+ import * as alepha_logger1 from "alepha/logger";
9
+ import { UserRealmOptions as UserRealmOptions$1 } from "alepha/api/users";
12
10
  import * as alepha_bucket0 from "alepha/bucket";
13
- import { BucketDescriptor } from "alepha/bucket";
14
11
  import * as alepha_cache0 from "alepha/cache";
15
- import { AccessTokenResponse, CryptoProvider, JwtProvider, RealmDescriptor, RealmDescriptorOptions, SecurityProvider, ServiceAccountDescriptor, UserAccount, UserAccountToken } from "alepha/security";
16
- import * as alepha_retry0 from "alepha/retry";
12
+ import { DateTime, DateTimeProvider } from "alepha/datetime";
13
+ import { CryptoProvider, RealmPrimitive, RealmPrimitiveOptions, UserAccount } from "alepha/security";
14
+ import * as alepha_server_links0 from "alepha/server/links";
15
+ import { OAuth2Profile, ServerAuthProvider, WithLinkFn, WithLoginFn } from "alepha/server/auth";
17
16
  import { FileSystemProvider } from "alepha/file";
18
17
  import * as drizzle_orm0 from "drizzle-orm";
19
18
  import { BuildExtraConfigColumns, SQL, SQLWrapper } from "drizzle-orm";
@@ -21,11 +20,12 @@ import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
21
20
  import { LockConfig, LockStrength, PgColumn, PgColumnBuilderBase, PgDatabase, PgInsertValue, PgSelectBase, PgSequenceOptions, PgTableExtraConfigValue, PgTableWithColumns, PgTransaction, UpdateDeleteAction } from "drizzle-orm/pg-core";
22
21
  import { PgTransactionConfig } from "drizzle-orm/pg-core/session";
23
22
  import * as DrizzleKit from "drizzle-kit/api";
23
+ import "alepha/retry";
24
24
  import "alepha/lock";
25
25
  import "drizzle-orm/postgres-js";
26
26
  import "postgres";
27
27
  import "drizzle-orm/sqlite-core";
28
- import { Configuration } from "openid-client";
28
+ import { FileController } from "alepha/api/files";
29
29
 
30
30
  //#region src/api-users/atoms/realmAuthSettingsAtom.d.ts
31
31
  declare const realmAuthSettingsAtom: alepha23.Atom<alepha23.TObject<{
@@ -52,7 +52,7 @@ declare const realmAuthSettingsAtom: alepha23.Atom<alepha23.TObject<{
52
52
  type RealmAuthSettings = Static<typeof realmAuthSettingsAtom.schema>;
53
53
  //#endregion
54
54
  //#region src/api-users/entities/identities.d.ts
55
- declare const identities: alepha_orm204.EntityDescriptor<alepha23.TObject<{
55
+ declare const identities: alepha_orm204.EntityPrimitive<alepha23.TObject<{
56
56
  id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
57
57
  version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
58
58
  createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
@@ -66,7 +66,7 @@ declare const identities: alepha_orm204.EntityDescriptor<alepha23.TObject<{
66
66
  type IdentityEntity = Static<typeof identities.schema>;
67
67
  //#endregion
68
68
  //#region src/api-users/entities/sessions.d.ts
69
- declare const sessions: alepha_orm204.EntityDescriptor<alepha23.TObject<{
69
+ declare const sessions: alepha_orm204.EntityPrimitive<alepha23.TObject<{
70
70
  id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
71
71
  version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
72
72
  createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
@@ -85,7 +85,7 @@ type SessionEntity = Static<typeof sessions.schema>;
85
85
  //#endregion
86
86
  //#region src/api-users/entities/users.d.ts
87
87
  declare const DEFAULT_USER_REALM_NAME = "default";
88
- declare const users: alepha_orm204.EntityDescriptor<alepha23.TObject<{
88
+ declare const users: alepha_orm204.EntityPrimitive<alepha23.TObject<{
89
89
  id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
90
90
  version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
91
91
  createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
@@ -159,9 +159,9 @@ declare class UserRealmProvider {
159
159
  emailVerified: alepha_orm204.PgAttr<alepha23.TBoolean, typeof alepha_orm204.PG_DEFAULT>;
160
160
  }>>;
161
161
  protected realms: Map<string, UserRealm>;
162
- avatars: alepha_bucket0.BucketDescriptor;
163
- protected readonly onConfigure: alepha23.HookDescriptor<"configure">;
164
- register(userRealmName: string, userRealmOptions?: UserRealmOptions): void;
162
+ avatars: alepha_bucket0.BucketPrimitive;
163
+ protected readonly onConfigure: alepha23.HookPrimitive<"configure">;
164
+ register(userRealmName: string, userRealmOptions?: UserRealmOptions$1): void;
165
165
  /**
166
166
  * Gets a registered realm by name, auto-creating default if needed.
167
167
  */
@@ -218,7 +218,7 @@ declare class IdentityController {
218
218
  /**
219
219
  * Find identities with pagination and filtering.
220
220
  */
221
- readonly findIdentities: alepha_server0.ActionDescriptorFn<{
221
+ readonly findIdentities: alepha_server0.ActionPrimitiveFn<{
222
222
  query: alepha23.TObject<{
223
223
  page: alepha23.TOptional<alepha23.TInteger>;
224
224
  size: alepha23.TOptional<alepha23.TInteger>;
@@ -241,7 +241,7 @@ declare class IdentityController {
241
241
  /**
242
242
  * Get an identity by ID.
243
243
  */
244
- readonly getIdentity: alepha_server0.ActionDescriptorFn<{
244
+ readonly getIdentity: alepha_server0.ActionPrimitiveFn<{
245
245
  params: alepha23.TObject<{
246
246
  id: alepha23.TString;
247
247
  }>;
@@ -262,7 +262,7 @@ declare class IdentityController {
262
262
  /**
263
263
  * Delete an identity.
264
264
  */
265
- readonly deleteIdentity: alepha_server0.ActionDescriptorFn<{
265
+ readonly deleteIdentity: alepha_server0.ActionPrimitiveFn<{
266
266
  params: alepha23.TObject<{
267
267
  id: alepha23.TString;
268
268
  }>;
@@ -327,7 +327,7 @@ declare class SessionController {
327
327
  /**
328
328
  * Find sessions with pagination and filtering.
329
329
  */
330
- readonly findSessions: alepha_server0.ActionDescriptorFn<{
330
+ readonly findSessions: alepha_server0.ActionPrimitiveFn<{
331
331
  query: alepha23.TObject<{
332
332
  page: alepha23.TOptional<alepha23.TInteger>;
333
333
  size: alepha23.TOptional<alepha23.TInteger>;
@@ -354,7 +354,7 @@ declare class SessionController {
354
354
  /**
355
355
  * Get a session by ID.
356
356
  */
357
- readonly getSession: alepha_server0.ActionDescriptorFn<{
357
+ readonly getSession: alepha_server0.ActionPrimitiveFn<{
358
358
  params: alepha23.TObject<{
359
359
  id: alepha23.TString;
360
360
  }>;
@@ -380,7 +380,7 @@ declare class SessionController {
380
380
  /**
381
381
  * Delete a session.
382
382
  */
383
- readonly deleteSession: alepha_server0.ActionDescriptorFn<{
383
+ readonly deleteSession: alepha_server0.ActionPrimitiveFn<{
384
384
  params: alepha23.TObject<{
385
385
  id: alepha23.TString;
386
386
  }>;
@@ -395,485 +395,6 @@ declare class SessionController {
395
395
  }>;
396
396
  }
397
397
  //#endregion
398
- //#region src/server-security/providers/ServerBasicAuthProvider.d.ts
399
- interface BasicAuthOptions {
400
- username: string;
401
- password: string;
402
- }
403
- //#endregion
404
- //#region src/server-security/providers/ServerSecurityProvider.d.ts
405
- type ServerRouteSecure = {
406
- realm?: string;
407
- basic?: BasicAuthOptions;
408
- };
409
- //#endregion
410
- //#region src/server-security/index.d.ts
411
- declare module "alepha" {
412
- interface State {
413
- /**
414
- * Real (or fake) user account, used for internal actions.
415
- *
416
- * If you define this, you assume that all actions are executed by this user by default.
417
- * > To force a different user, you need to pass it explicitly in the options.
418
- */
419
- "alepha.server.security.system.user"?: UserAccountToken;
420
- /**
421
- * The authenticated user account attached to the server request state.
422
- *
423
- * @internal
424
- */
425
- "alepha.server.request.user"?: UserAccount;
426
- }
427
- }
428
- declare module "alepha/server" {
429
- interface ServerRequest<TConfig> {
430
- user?: UserAccountToken;
431
- }
432
- interface ServerActionRequest<TConfig> {
433
- user: UserAccountToken;
434
- }
435
- interface ServerRoute {
436
- /**
437
- * If true, the route will be protected by the security provider.
438
- * All actions are secure by default, but you can disable it for specific actions.
439
- */
440
- secure?: boolean | ServerRouteSecure;
441
- }
442
- interface ClientRequestOptions extends FetchOptions {
443
- /**
444
- * Forward user from the previous request.
445
- * If "system", use system user. @see {ServerSecurityProvider.localSystemUser}
446
- * If "context", use the user from the current context (e.g. request).
447
- *
448
- * @default "system" if provided, else "context" if available.
449
- */
450
- user?: UserAccountToken | "system" | "context";
451
- }
452
- }
453
- /**
454
- * Plugin for Alepha Server that provides security features. Based on the Alepha Security module.
455
- *
456
- * By default, all $action will be guarded by a permission check.
457
- *
458
- * @see {@link ServerSecurityProvider}
459
- * @module alepha.server.security
460
- */
461
- //#endregion
462
- //#region src/server-links/schemas/apiLinksResponseSchema.d.ts
463
- declare const apiLinkSchema: alepha23.TObject<{
464
- name: alepha23.TString;
465
- group: alepha23.TOptional<alepha23.TString>;
466
- path: alepha23.TString;
467
- method: alepha23.TOptional<alepha23.TString>;
468
- requestBodyType: alepha23.TOptional<alepha23.TString>;
469
- service: alepha23.TOptional<alepha23.TString>;
470
- }>;
471
- declare const apiLinksResponseSchema: alepha23.TObject<{
472
- prefix: alepha23.TOptional<alepha23.TString>;
473
- links: alepha23.TArray<alepha23.TObject<{
474
- name: alepha23.TString;
475
- group: alepha23.TOptional<alepha23.TString>;
476
- path: alepha23.TString;
477
- method: alepha23.TOptional<alepha23.TString>;
478
- requestBodyType: alepha23.TOptional<alepha23.TString>;
479
- service: alepha23.TOptional<alepha23.TString>;
480
- }>>;
481
- }>;
482
- type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
483
- type ApiLink = Static<typeof apiLinkSchema>;
484
- //#endregion
485
- //#region src/server-links/providers/LinkProvider.d.ts
486
- /**
487
- * Browser, SSR friendly, service to handle links.
488
- */
489
- declare class LinkProvider {
490
- static path: {
491
- apiLinks: string;
492
- apiSchema: string;
493
- };
494
- protected readonly log: alepha_logger1.Logger;
495
- protected readonly alepha: Alepha;
496
- protected readonly httpClient: HttpClient;
497
- protected serverLinks: Array<HttpClientLink>;
498
- /**
499
- * Get applicative links registered on the server.
500
- * This does not include lazy-loaded remote links.
501
- */
502
- getServerLinks(): HttpClientLink[];
503
- /**
504
- * Register a new link for the application.
505
- */
506
- registerLink(link: HttpClientLink): void;
507
- get links(): HttpClientLink[];
508
- /**
509
- * Force browser to refresh links from the server.
510
- */
511
- fetchLinks(): Promise<HttpClientLink[]>;
512
- /**
513
- * Create a virtual client that can be used to call actions.
514
- *
515
- * Use js Proxy under the hood.
516
- */
517
- client<T extends object>(scope?: ClientScope): HttpVirtualClient<T>;
518
- /**
519
- * Check if a link with the given name exists.
520
- * @param name
521
- */
522
- can(name: string): boolean;
523
- /**
524
- * Resolve a link by its name and call it.
525
- * - If link is local, it will call the local handler.
526
- * - If link is remote, it will make a fetch request to the remote server.
527
- */
528
- follow(name: string, config?: Partial<ServerRequestConfigEntry>, options?: ClientRequestOptions & ClientScope): Promise<any>;
529
- protected createVirtualAction<T extends RequestConfigSchema>(name: string, scope?: ClientScope): VirtualAction<T>;
530
- protected followRemote(link: HttpClientLink, config?: Partial<ServerRequestConfigEntry>, options?: ClientRequestOptions): Promise<FetchResponse>;
531
- protected getLinkByName(name: string, options?: ClientScope): Promise<HttpClientLink>;
532
- }
533
- interface HttpClientLink extends ApiLink {
534
- secured?: boolean | ServerRouteSecure;
535
- prefix?: string;
536
- host?: string;
537
- service?: string;
538
- schema?: RequestConfigSchema;
539
- handler?: (request: ServerRequest, options: ClientRequestOptions) => Async<ServerResponseBody>;
540
- }
541
- interface ClientScope {
542
- group?: string;
543
- service?: string;
544
- hostname?: string;
545
- }
546
- type HttpVirtualClient<T> = { [K in keyof T as T[K] extends ActionDescriptor<RequestConfigSchema> ? K : never]: T[K] extends ActionDescriptor<infer Schema> ? VirtualAction<Schema> : never };
547
- interface VirtualAction<T extends RequestConfigSchema> extends Pick<ActionDescriptor<T>, "name" | "run" | "fetch"> {
548
- (config?: ClientRequestEntry<T>, opts?: ClientRequestOptions): Promise<ClientRequestResponse<T>>;
549
- can: () => boolean;
550
- }
551
- //#endregion
552
- //#region src/server-proxy/descriptors/$proxy.d.ts
553
- type ProxyDescriptorOptions = {
554
- /**
555
- * Path pattern to match for proxying requests.
556
- *
557
- * Supports wildcards and path parameters:
558
- * - `/api/*` - Matches all paths starting with `/api/`
559
- * - `/api/v1/*` - Matches all paths starting with `/api/v1/`
560
- * - `/users/:id` - Matches `/users/123`, `/users/abc`, etc.
561
- *
562
- * @example "/api/*"
563
- * @example "/secure/admin/*"
564
- * @example "/users/:id/posts"
565
- */
566
- path: string;
567
- /**
568
- * Target URL to which matching requests should be forwarded.
569
- *
570
- * Can be either:
571
- * - **Static string**: A fixed URL like `"https://api.example.com"`
572
- * - **Dynamic function**: A function that returns the URL, enabling runtime target resolution
573
- *
574
- * The target URL will be combined with the remaining path from the original request.
575
- *
576
- * @example "https://api.example.com"
577
- * @example () => process.env.API_URL || "http://localhost:3001"
578
- */
579
- target: string | (() => string);
580
- /**
581
- * Whether this proxy is disabled.
582
- *
583
- * When `true`, requests matching the path will not be proxied and will be handled
584
- * by other routes or return 404. Useful for feature toggles or conditional proxying.
585
- *
586
- * @default false
587
- * @example !process.env.ENABLE_PROXY
588
- */
589
- disabled?: boolean;
590
- /**
591
- * Hook called before forwarding the request to the target server.
592
- *
593
- * Use this to:
594
- * - Add authentication headers
595
- * - Modify request headers or body
596
- * - Add request tracking/logging
597
- * - Transform the request before forwarding
598
- *
599
- * @param request - The original incoming server request
600
- * @param proxyRequest - The request that will be sent to the target (modifiable)
601
- *
602
- * @example
603
- * ```ts
604
- * beforeRequest: async (request, proxyRequest) => {
605
- * proxyRequest.headers = {
606
- * ...proxyRequest.headers,
607
- * 'Authorization': `Bearer ${await getToken()}`,
608
- * 'X-Request-ID': generateRequestId()
609
- * };
610
- * }
611
- * ```
612
- */
613
- beforeRequest?: (request: ServerRequest, proxyRequest: RequestInit) => Async<void>;
614
- /**
615
- * Hook called after receiving the response from the target server.
616
- *
617
- * Use this to:
618
- * - Log response details for monitoring
619
- * - Add custom headers to the response
620
- * - Transform response data
621
- * - Handle error responses
622
- *
623
- * @param request - The original incoming server request
624
- * @param proxyResponse - The response received from the target server
625
- *
626
- * @example
627
- * ```ts
628
- * afterResponse: async (request, proxyResponse) => {
629
- * console.log(`Proxy ${request.method} ${request.url} -> ${proxyResponse.status}`);
630
- *
631
- * if (!proxyResponse.ok) {
632
- * await logError(`Proxy error: ${proxyResponse.status}`, { request, response: proxyResponse });
633
- * }
634
- * }
635
- * ```
636
- */
637
- afterResponse?: (request: ServerRequest, proxyResponse: Response) => Async<void>;
638
- /**
639
- * Function to rewrite the URL before sending to the target server.
640
- *
641
- * Use this to:
642
- * - Remove or add path prefixes
643
- * - Transform path parameters
644
- * - Modify query parameters
645
- * - Change the URL structure entirely
646
- *
647
- * The function receives a mutable URL object and should modify it in-place.
648
- *
649
- * @param url - The URL object to modify (mutable)
650
- *
651
- * @example
652
- * ```ts
653
- * // Remove /api prefix when forwarding
654
- * rewrite: (url) => {
655
- * url.pathname = url.pathname.replace('/api', '');
656
- * }
657
- * ```
658
- *
659
- * @example
660
- * ```ts
661
- * // Add version prefix
662
- * rewrite: (url) => {
663
- * url.pathname = `/v2${url.pathname}`;
664
- * }
665
- * ```
666
- */
667
- rewrite?: (url: URL) => void;
668
- };
669
- //#endregion
670
- //#region src/server-proxy/providers/ServerProxyProvider.d.ts
671
- declare class ServerProxyProvider {
672
- protected readonly log: alepha_logger1.Logger;
673
- protected readonly routerProvider: ServerRouterProvider;
674
- protected readonly alepha: Alepha;
675
- protected readonly configure: alepha23.HookDescriptor<"configure">;
676
- createProxy(options: ProxyDescriptorOptions): void;
677
- createProxyHandler(target: string, options: Omit<ProxyDescriptorOptions, "path">): ServerHandler;
678
- private getRawRequestBody;
679
- }
680
- //#endregion
681
- //#region src/server-links/descriptors/$remote.d.ts
682
- interface RemoteDescriptorOptions {
683
- /**
684
- * The URL of the remote service.
685
- * You can use a function to generate the URL dynamically.
686
- * You probably should use $env(env) to get the URL from the environment.
687
- *
688
- * @example
689
- * ```ts
690
- * import { $remote } from "alepha/server";
691
- * import { $inject, t } from "alepha";
692
- *
693
- * class App {
694
- * env = $env(t.object({
695
- * REMOTE_URL: t.text({default: "http://localhost:3000"}),
696
- * }));
697
- * remote = $remote({
698
- * url: this.env.REMOTE_URL,
699
- * });
700
- * }
701
- * ```
702
- */
703
- url: string | (() => string);
704
- /**
705
- * The name of the remote service.
706
- *
707
- * @default Member of the class containing the remote service.
708
- */
709
- name?: string;
710
- /**
711
- * If true, all methods of the remote service will be exposed as actions in this context.
712
- * > Note: Proxy will never use the service account, it just... proxies the request.
713
- */
714
- proxy?: boolean | Partial<ProxyDescriptorOptions & {
715
- /**
716
- * If true, the remote service won't be available internally, only through the proxy.
717
- */
718
- noInternal: boolean;
719
- }>;
720
- /**
721
- * For communication between the server and the remote service with a security layer.
722
- * This will be used for internal communication and will not be exposed to the client.
723
- */
724
- serviceAccount?: ServiceAccountDescriptor;
725
- }
726
- declare class RemoteDescriptor extends Descriptor<RemoteDescriptorOptions> {
727
- get name(): string;
728
- }
729
- //#endregion
730
- //#region src/server-links/providers/RemoteDescriptorProvider.d.ts
731
- declare class RemoteDescriptorProvider {
732
- protected readonly env: {
733
- SERVER_API_PREFIX: string;
734
- };
735
- protected readonly alepha: Alepha;
736
- protected readonly proxyProvider: ServerProxyProvider;
737
- protected readonly linkProvider: LinkProvider;
738
- protected readonly remotes: Array<ServerRemote>;
739
- protected readonly log: alepha_logger1.Logger;
740
- getRemotes(): ServerRemote[];
741
- readonly configure: alepha23.HookDescriptor<"configure">;
742
- readonly start: alepha23.HookDescriptor<"start">;
743
- registerRemote(value: RemoteDescriptor): Promise<void>;
744
- protected readonly fetchLinks: alepha_retry0.RetryDescriptorFn<(opts: FetchLinksOptions) => Promise<ApiLinksResponse>>;
745
- }
746
- interface FetchLinksOptions {
747
- /**
748
- * Name of the remote service.
749
- */
750
- service: string;
751
- /**
752
- * URL to fetch links from.
753
- */
754
- url: string;
755
- /**
756
- * Authorization header containing access token.
757
- */
758
- authorization?: string;
759
- }
760
- interface ServerRemote {
761
- /**
762
- * URL of the remote service.
763
- */
764
- url: string;
765
- /**
766
- * Name of the remote service.
767
- */
768
- name: string;
769
- /**
770
- * Expose links as endpoint. It's not only internal.
771
- */
772
- proxy: boolean;
773
- /**
774
- * It's only used inside the application.
775
- */
776
- internal: boolean;
777
- /**
778
- * Links fetcher.
779
- */
780
- links: (args: {
781
- authorization?: string;
782
- }) => Promise<ApiLinksResponse>;
783
- /**
784
- * Fetches schema for the remote service.
785
- */
786
- schema: (args: {
787
- name: string;
788
- authorization?: string;
789
- }) => Promise<any>;
790
- /**
791
- * Force a default access token provider when not provided.
792
- */
793
- serviceAccount?: ServiceAccountDescriptor;
794
- /**
795
- * Prefix for the remote service links.
796
- */
797
- prefix: string;
798
- }
799
- //#endregion
800
- //#region src/server-links/providers/ServerLinksProvider.d.ts
801
- declare class ServerLinksProvider {
802
- protected readonly env: {
803
- SERVER_API_PREFIX: string;
804
- };
805
- protected readonly alepha: Alepha;
806
- protected readonly linkProvider: LinkProvider;
807
- protected readonly remoteProvider: RemoteDescriptorProvider;
808
- protected readonly serverTimingProvider: ServerTimingProvider;
809
- get prefix(): string;
810
- readonly onRoute: alepha23.HookDescriptor<"configure">;
811
- /**
812
- * First API - Get all API links for the user.
813
- *
814
- * This is based on the user's permissions.
815
- */
816
- readonly links: alepha_server0.RouteDescriptor<{
817
- response: alepha23.TObject<{
818
- prefix: alepha23.TOptional<alepha23.TString>;
819
- links: alepha23.TArray<alepha23.TObject<{
820
- name: alepha23.TString;
821
- group: alepha23.TOptional<alepha23.TString>;
822
- path: alepha23.TString;
823
- method: alepha23.TOptional<alepha23.TString>;
824
- requestBodyType: alepha23.TOptional<alepha23.TString>;
825
- service: alepha23.TOptional<alepha23.TString>;
826
- }>>;
827
- }>;
828
- }>;
829
- /**
830
- * Second API - Get schema for a specific API link.
831
- *
832
- * Note: Body/Response schema are not included in `links` API because it's TOO BIG.
833
- * I mean for 150+ links, you got 50ms of serialization time.
834
- */
835
- readonly schema: alepha_server0.RouteDescriptor<{
836
- params: alepha23.TObject<{
837
- name: alepha23.TString;
838
- }>;
839
- response: alepha23.TRecord<string, alepha23.TAny>;
840
- }>;
841
- getSchemaByName(name: string, options?: GetApiLinksOptions): Promise<RequestConfigSchema>;
842
- /**
843
- * Retrieves API links for the user based on their permissions.
844
- * Will check on local links and remote links.
845
- */
846
- getUserApiLinks(options: GetApiLinksOptions): Promise<ApiLinksResponse>;
847
- }
848
- interface GetApiLinksOptions {
849
- user?: UserAccountToken;
850
- authorization?: string;
851
- }
852
- //#endregion
853
- //#region src/server-links/index.d.ts
854
- declare module "alepha" {
855
- interface State {
856
- /**
857
- * API links attached to the server request state.
858
- *
859
- * @see {@link ApiLinksResponse}
860
- * @internal
861
- */
862
- "alepha.server.request.apiLinks"?: ApiLinksResponse;
863
- }
864
- }
865
- /**
866
- * Provides server-side link management and remote capabilities for client-server interactions.
867
- *
868
- * The server-links module enables declarative link definitions using `$remote` and `$client` descriptors,
869
- * facilitating seamless API endpoint management and client-server communication. It integrates with server
870
- * security features to ensure safe and controlled access to resources.
871
- *
872
- * @see {@link $remote}
873
- * @see {@link $client}
874
- * @module alepha.server.links
875
- */
876
- //#endregion
877
398
  //#region src/orm/schemas/insertSchema.d.ts
878
399
  /**
879
400
  * Transforms a TObject schema for insert operations.
@@ -901,8 +422,8 @@ type TObjectInsert<T extends TObject> = TObject<{ [K in keyof T["properties"]]:
901
422
  */
902
423
  type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"]]: T["properties"][K] extends TOptional<infer U> ? TOptional<TUnion<[U, TNull]>> : T["properties"][K] }>;
903
424
  //#endregion
904
- //#region src/orm/descriptors/$entity.d.ts
905
- interface EntityDescriptorOptions<T extends TObject, Keys = keyof Static<T>> {
425
+ //#region src/orm/primitives/$entity.d.ts
426
+ interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
906
427
  /**
907
428
  * The database table name that will be created for this entity.
908
429
  * If not provided, name will be inferred from the $repository variable name.
@@ -1014,9 +535,9 @@ interface EntityDescriptorOptions<T extends TObject, Keys = keyof Static<T>> {
1014
535
  */
1015
536
  config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
1016
537
  }
1017
- declare class EntityDescriptor<T extends TObject = TObject> {
1018
- readonly options: EntityDescriptorOptions<T>;
1019
- constructor(options: EntityDescriptorOptions<T>);
538
+ declare class EntityPrimitive<T extends TObject = TObject> {
539
+ readonly options: EntityPrimitiveOptions<T>;
540
+ constructor(options: EntityPrimitiveOptions<T>);
1020
541
  alias(alias: string): this;
1021
542
  get cols(): EntityColumns<T>;
1022
543
  get name(): string;
@@ -1036,7 +557,7 @@ type SchemaToTableConfig<T extends TObject> = {
1036
557
  };
1037
558
  type EntityColumn<T extends TObject> = {
1038
559
  name: string;
1039
- entity: EntityDescriptor<T>;
560
+ entity: EntityPrimitive<T>;
1040
561
  };
1041
562
  type EntityColumns<T extends TObject> = { [key in keyof T["properties"]]: EntityColumn<T> };
1042
563
  //#endregion
@@ -1082,7 +603,7 @@ interface PgEnumOptions {
1082
603
  interface PgRefOptions {
1083
604
  ref: () => {
1084
605
  name: string;
1085
- entity: EntityDescriptor;
606
+ entity: EntityPrimitive;
1086
607
  };
1087
608
  actions?: {
1088
609
  onUpdate?: UpdateDeleteAction;
@@ -1096,19 +617,6 @@ declare class DbError extends AlephaError {
1096
617
  constructor(message: string, cause?: unknown);
1097
618
  }
1098
619
  //#endregion
1099
- //#region src/orm/helpers/pgAttr.d.ts
1100
- /**
1101
- * Type representation.
1102
- */
1103
- type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
1104
- interface PgAttrField {
1105
- key: string;
1106
- type: TSchema;
1107
- data: any;
1108
- nested?: any[];
1109
- one?: boolean;
1110
- }
1111
- //#endregion
1112
620
  //#region src/orm/interfaces/FilterOperators.d.ts
1113
621
  interface FilterOperators<TValue> {
1114
622
  /**
@@ -1525,85 +1033,6 @@ interface FilterOperators<TValue> {
1525
1033
  arrayOverlaps?: TValue;
1526
1034
  }
1527
1035
  //#endregion
1528
- //#region src/orm/interfaces/PgQueryWhere.d.ts
1529
- type PgQueryWhere<T extends TObject, Relations extends PgRelationMap<TObject> | undefined = undefined> = (PgQueryWhereOperators<T> & PgQueryWhereConditions<T>) | (PgQueryWhereRelations<Relations> & PgQueryWhereOperators<T> & PgQueryWhereConditions<T, Relations>);
1530
- type PgQueryWhereOrSQL<T extends TObject, Relations extends PgRelationMap<TObject> | undefined = undefined> = SQLWrapper | PgQueryWhere<T, Relations>;
1531
- type PgQueryWhereOperators<T extends TObject> = { [Key in keyof Static<T>]?: FilterOperators<Static<T>[Key]> | Static<T>[Key] | (Static<T>[Key] extends object ? NestedJsonbQuery<Static<T>[Key]> : never) };
1532
- type PgQueryWhereConditions<T extends TObject, Relations extends PgRelationMap<TObject> | undefined = undefined> = {
1533
- /**
1534
- * Combine a list of conditions with the `and` operator. Conditions
1535
- * that are equal `undefined` are automatically ignored.
1536
- *
1537
- * ## Examples
1538
- *
1539
- * ```ts
1540
- * db.select().from(cars)
1541
- * .where(
1542
- * and(
1543
- * eq(cars.make, 'Volvo'),
1544
- * eq(cars.year, 1950),
1545
- * )
1546
- * )
1547
- * ```
1548
- */
1549
- and?: Array<PgQueryWhereOrSQL<T, Relations>>;
1550
- /**
1551
- * Combine a list of conditions with the `or` operator. Conditions
1552
- * that are equal `undefined` are automatically ignored.
1553
- *
1554
- * ## Examples
1555
- *
1556
- * ```ts
1557
- * db.select().from(cars)
1558
- * .where(
1559
- * or(
1560
- * eq(cars.make, 'GM'),
1561
- * eq(cars.make, 'Ford'),
1562
- * )
1563
- * )
1564
- * ```
1565
- */
1566
- or?: Array<PgQueryWhereOrSQL<T, Relations>>;
1567
- /**
1568
- * Negate the meaning of an expression using the `not` keyword.
1569
- *
1570
- * ## Examples
1571
- *
1572
- * ```ts
1573
- * // Select cars _not_ made by GM or Ford.
1574
- * db.select().from(cars)
1575
- * .where(not(inArray(cars.make, ['GM', 'Ford'])))
1576
- * ```
1577
- */
1578
- not?: PgQueryWhereOrSQL<T, Relations>;
1579
- /**
1580
- * Test whether a subquery evaluates to have any rows.
1581
- *
1582
- * ## Examples
1583
- *
1584
- * ```ts
1585
- * // Users whose `homeCity` column has a match in a cities
1586
- * // table.
1587
- * db
1588
- * .select()
1589
- * .from(users)
1590
- * .where(
1591
- * exists(db.select()
1592
- * .from(cities)
1593
- * .where(eq(users.homeCity, cities.id))),
1594
- * );
1595
- * ```
1596
- *
1597
- * @see notExists for the inverse of this test
1598
- */
1599
- exists?: SQLWrapper;
1600
- };
1601
- type PgQueryWhereRelations<Relations extends PgRelationMap<TObject> | undefined = undefined> = Relations extends PgRelationMap<TObject> ? { [K in keyof Relations]?: PgQueryWhere<Relations[K]["join"]["schema"], Relations[K]["with"]> } : {};
1602
- /**
1603
- * Recursively allow nested queries for JSONB object/array types
1604
- */
1605
- type NestedJsonbQuery<T> = T extends object ? T extends Array<infer U> ? U extends object ? { [K in keyof U]?: FilterOperators<U[K]> | U[K] } : FilterOperators<U> | U : { [K in keyof T]?: FilterOperators<T[K]> | T[K] | (T[K] extends object ? NestedJsonbQuery<T[K]> : never) } : FilterOperators<T> | T;
1606
- //#endregion
1607
1036
  //#region src/orm/interfaces/PgQuery.d.ts
1608
1037
  /**
1609
1038
  * Order direction for sorting
@@ -1653,15 +1082,107 @@ type PgRelation<Base extends TObject> = {
1653
1082
  with?: PgRelationMap<TObject>;
1654
1083
  };
1655
1084
  //#endregion
1656
- //#region src/orm/descriptors/$sequence.d.ts
1657
- interface SequenceDescriptorOptions extends PgSequenceOptions {
1085
+ //#region src/orm/interfaces/PgQueryWhere.d.ts
1086
+ type PgQueryWhere<T extends TObject, Relations extends PgRelationMap<TObject> | undefined = undefined> = (PgQueryWhereOperators<T> & PgQueryWhereConditions<T>) | (PgQueryWhereRelations<Relations> & PgQueryWhereOperators<T> & PgQueryWhereConditions<T, Relations>);
1087
+ type PgQueryWhereOrSQL<T extends TObject, Relations extends PgRelationMap<TObject> | undefined = undefined> = SQLWrapper | PgQueryWhere<T, Relations>;
1088
+ type PgQueryWhereOperators<T extends TObject> = { [Key in keyof Static<T>]?: FilterOperators<Static<T>[Key]> | Static<T>[Key] | (Static<T>[Key] extends object ? NestedJsonbQuery<Static<T>[Key]> : never) };
1089
+ type PgQueryWhereConditions<T extends TObject, Relations extends PgRelationMap<TObject> | undefined = undefined> = {
1090
+ /**
1091
+ * Combine a list of conditions with the `and` operator. Conditions
1092
+ * that are equal `undefined` are automatically ignored.
1093
+ *
1094
+ * ## Examples
1095
+ *
1096
+ * ```ts
1097
+ * db.select().from(cars)
1098
+ * .where(
1099
+ * and(
1100
+ * eq(cars.make, 'Volvo'),
1101
+ * eq(cars.year, 1950),
1102
+ * )
1103
+ * )
1104
+ * ```
1105
+ */
1106
+ and?: Array<PgQueryWhereOrSQL<T, Relations>>;
1107
+ /**
1108
+ * Combine a list of conditions with the `or` operator. Conditions
1109
+ * that are equal `undefined` are automatically ignored.
1110
+ *
1111
+ * ## Examples
1112
+ *
1113
+ * ```ts
1114
+ * db.select().from(cars)
1115
+ * .where(
1116
+ * or(
1117
+ * eq(cars.make, 'GM'),
1118
+ * eq(cars.make, 'Ford'),
1119
+ * )
1120
+ * )
1121
+ * ```
1122
+ */
1123
+ or?: Array<PgQueryWhereOrSQL<T, Relations>>;
1124
+ /**
1125
+ * Negate the meaning of an expression using the `not` keyword.
1126
+ *
1127
+ * ## Examples
1128
+ *
1129
+ * ```ts
1130
+ * // Select cars _not_ made by GM or Ford.
1131
+ * db.select().from(cars)
1132
+ * .where(not(inArray(cars.make, ['GM', 'Ford'])))
1133
+ * ```
1134
+ */
1135
+ not?: PgQueryWhereOrSQL<T, Relations>;
1136
+ /**
1137
+ * Test whether a subquery evaluates to have any rows.
1138
+ *
1139
+ * ## Examples
1140
+ *
1141
+ * ```ts
1142
+ * // Users whose `homeCity` column has a match in a cities
1143
+ * // table.
1144
+ * db
1145
+ * .select()
1146
+ * .from(users)
1147
+ * .where(
1148
+ * exists(db.select()
1149
+ * .from(cities)
1150
+ * .where(eq(users.homeCity, cities.id))),
1151
+ * );
1152
+ * ```
1153
+ *
1154
+ * @see notExists for the inverse of this test
1155
+ */
1156
+ exists?: SQLWrapper;
1157
+ };
1158
+ type PgQueryWhereRelations<Relations extends PgRelationMap<TObject> | undefined = undefined> = Relations extends PgRelationMap<TObject> ? { [K in keyof Relations]?: PgQueryWhere<Relations[K]["join"]["schema"], Relations[K]["with"]> } : {};
1159
+ /**
1160
+ * Recursively allow nested queries for JSONB object/array types
1161
+ */
1162
+ type NestedJsonbQuery<T> = T extends object ? T extends Array<infer U> ? U extends object ? { [K in keyof U]?: FilterOperators<U[K]> | U[K] } : FilterOperators<U> | U : { [K in keyof T]?: FilterOperators<T[K]> | T[K] | (T[K] extends object ? NestedJsonbQuery<T[K]> : never) } : FilterOperators<T> | T;
1163
+ //#endregion
1164
+ //#region src/orm/helpers/pgAttr.d.ts
1165
+ /**
1166
+ * Type representation.
1167
+ */
1168
+ type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
1169
+ interface PgAttrField {
1170
+ key: string;
1171
+ type: TSchema;
1172
+ data: any;
1173
+ nested?: any[];
1174
+ one?: boolean;
1175
+ }
1176
+ //#endregion
1177
+ //#region src/orm/primitives/$sequence.d.ts
1178
+ interface SequencePrimitiveOptions extends PgSequenceOptions {
1658
1179
  /**
1659
1180
  * The name of the sequence. If not provided, the property key will be used.
1660
1181
  */
1661
1182
  name?: string;
1662
1183
  provider?: DatabaseProvider;
1663
1184
  }
1664
- declare class SequenceDescriptor extends Descriptor<SequenceDescriptorOptions> {
1185
+ declare class SequencePrimitive extends Primitive<SequencePrimitiveOptions> {
1665
1186
  readonly provider: DatabaseProvider;
1666
1187
  onInit(): void;
1667
1188
  get name(): string;
@@ -1692,22 +1213,22 @@ interface TableConfigBuilders<TConfig> {
1692
1213
  }) => TConfig;
1693
1214
  }
1694
1215
  /**
1695
- * Abstract base class for transforming Alepha Descriptors (Entity, Sequence, etc...)
1216
+ * Abstract base class for transforming Alepha Primitives (Entity, Sequence, etc...)
1696
1217
  * into drizzle models (tables, enums, sequences, etc...).
1697
1218
  */
1698
1219
  declare abstract class ModelBuilder {
1699
1220
  /**
1700
- * Build a table from an entity descriptor.
1221
+ * Build a table from an entity primitive.
1701
1222
  */
1702
- abstract buildTable(entity: EntityDescriptor, options: {
1223
+ abstract buildTable(entity: EntityPrimitive, options: {
1703
1224
  tables: Map<string, unknown>;
1704
1225
  enums: Map<string, unknown>;
1705
1226
  schema: string;
1706
1227
  }): void;
1707
1228
  /**
1708
- * Build a sequence from a sequence descriptor.
1229
+ * Build a sequence from a sequence primitive.
1709
1230
  */
1710
- abstract buildSequence(sequence: SequenceDescriptor, options: {
1231
+ abstract buildSequence(sequence: SequencePrimitive, options: {
1711
1232
  sequences: Map<string, unknown>;
1712
1233
  schema: string;
1713
1234
  }): void;
@@ -1719,12 +1240,12 @@ declare abstract class ModelBuilder {
1719
1240
  * Build the table configuration function for any database.
1720
1241
  * This includes indexes, foreign keys, constraints, and custom config.
1721
1242
  *
1722
- * @param entity - The entity descriptor
1243
+ * @param entity - The entity primitive
1723
1244
  * @param builders - Database-specific builder functions
1724
1245
  * @param tableResolver - Function to resolve entity references to table columns
1725
1246
  * @param customConfigHandler - Optional handler for custom config
1726
1247
  */
1727
- protected buildTableConfig<TConfig, TSelf>(entity: EntityDescriptor, builders: TableConfigBuilders<TConfig>, tableResolver?: (entityName: string) => any, customConfigHandler?: (config: any, self: TSelf) => TConfig[]): ((self: TSelf) => TConfig[]) | undefined;
1248
+ protected buildTableConfig<TConfig, TSelf>(entity: EntityPrimitive, builders: TableConfigBuilders<TConfig>, tableResolver?: (entityName: string) => any, customConfigHandler?: (config: any, self: TSelf) => TConfig[]): ((self: TSelf) => TConfig[]) | undefined;
1728
1249
  }
1729
1250
  //#endregion
1730
1251
  //#region src/orm/providers/DrizzleKitProvider.d.ts
@@ -1788,9 +1309,9 @@ declare abstract class DatabaseProvider {
1788
1309
  readonly sequences: Map<string, unknown>;
1789
1310
  get name(): string;
1790
1311
  get schema(): string;
1791
- table<T extends TObject>(entity: EntityDescriptor<T>): PgTableWithColumns<SchemaToTableConfig<T>>;
1792
- registerEntity(entity: EntityDescriptor): void;
1793
- registerSequence(sequence: SequenceDescriptor): void;
1312
+ table<T extends TObject>(entity: EntityPrimitive<T>): PgTableWithColumns<SchemaToTableConfig<T>>;
1313
+ registerEntity(entity: EntityPrimitive): void;
1314
+ registerSequence(sequence: SequencePrimitive): void;
1794
1315
  abstract execute(statement: SQLLike): Promise<Record<string, unknown>[]>;
1795
1316
  run<T extends TObject>(statement: SQLLike, schema: T): Promise<Array<Static<T>>>;
1796
1317
  /**
@@ -1998,13 +1519,13 @@ declare class PgRelationManager {
1998
1519
  //#endregion
1999
1520
  //#region src/orm/services/Repository.d.ts
2000
1521
  declare abstract class Repository$1<T extends TObject> {
2001
- readonly entity: EntityDescriptor<T>;
1522
+ readonly entity: EntityPrimitive<T>;
2002
1523
  readonly provider: DatabaseProvider;
2003
1524
  protected readonly relationManager: PgRelationManager;
2004
1525
  protected readonly queryManager: QueryManager;
2005
1526
  protected readonly dateTimeProvider: DateTimeProvider;
2006
1527
  protected readonly alepha: Alepha;
2007
- constructor(entity: EntityDescriptor<T>, provider?: typeof DatabaseProvider);
1528
+ constructor(entity: EntityPrimitive<T>, provider?: typeof DatabaseProvider);
2008
1529
  /**
2009
1530
  * Represents the primary key of the table.
2010
1531
  * - Key is the name of the primary key column.
@@ -2379,470 +1900,81 @@ declare module "alepha" {
2379
1900
  }
2380
1901
  }
2381
1902
  //#endregion
2382
- //#region src/api-verifications/entities/verifications.d.ts
2383
- declare const verifications: alepha_orm204.EntityDescriptor<alepha23.TObject<{
2384
- id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
2385
- createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2386
- updatedAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_UPDATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2387
- version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
2388
- type: alepha23.TUnsafe<"link" | "code">;
2389
- target: alepha23.TString;
2390
- code: alepha23.TString;
2391
- verifiedAt: alepha23.TOptional<alepha23.TString>;
2392
- attempts: alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_DEFAULT>;
2393
- }>>;
2394
- type VerificationEntity = Static<typeof verifications.schema>;
2395
- //#endregion
2396
- //#region src/api-verifications/schemas/verificationSettingsSchema.d.ts
2397
- declare const verificationSettingsSchema: alepha23.TObject<{
2398
- code: alepha23.TObject<{
2399
- maxAttempts: alepha23.TInteger;
2400
- codeLength: alepha23.TInteger;
2401
- codeExpiration: alepha23.TInteger;
2402
- verificationCooldown: alepha23.TInteger;
2403
- limitPerDay: alepha23.TInteger;
2404
- }>;
2405
- link: alepha23.TObject<{
2406
- maxAttempts: alepha23.TInteger;
2407
- codeExpiration: alepha23.TInteger;
2408
- verificationCooldown: alepha23.TInteger;
2409
- limitPerDay: alepha23.TInteger;
2410
- }>;
2411
- purgeDays: alepha23.TInteger;
2412
- }>;
2413
- type VerificationSettings = Static<typeof verificationSettingsSchema>;
2414
- //#endregion
2415
- //#region src/api-verifications/parameters/VerificationParameters.d.ts
2416
- /**
2417
- * Verification settings configuration atom
2418
- */
2419
- declare const verificationOptions: alepha23.Atom<alepha23.TObject<{
2420
- code: alepha23.TObject<{
2421
- maxAttempts: alepha23.TInteger;
2422
- codeLength: alepha23.TInteger;
2423
- codeExpiration: alepha23.TInteger;
2424
- verificationCooldown: alepha23.TInteger;
2425
- limitPerDay: alepha23.TInteger;
2426
- }>;
2427
- link: alepha23.TObject<{
2428
- maxAttempts: alepha23.TInteger;
2429
- codeExpiration: alepha23.TInteger;
2430
- verificationCooldown: alepha23.TInteger;
2431
- limitPerDay: alepha23.TInteger;
2432
- }>;
2433
- purgeDays: alepha23.TInteger;
2434
- }>, "alepha.api.verifications.options">;
2435
- type VerificationOptions = Static<typeof verificationOptions.schema>;
2436
- declare module "alepha" {
2437
- interface State {
2438
- [verificationOptions.key]: VerificationOptions;
2439
- }
2440
- }
2441
- declare class VerificationParameters {
2442
- protected readonly options: Readonly<{
2443
- link: {
2444
- maxAttempts: number;
2445
- codeExpiration: number;
2446
- verificationCooldown: number;
2447
- limitPerDay: number;
2448
- };
2449
- code: {
2450
- maxAttempts: number;
2451
- codeLength: number;
2452
- codeExpiration: number;
2453
- verificationCooldown: number;
2454
- limitPerDay: number;
2455
- };
2456
- purgeDays: number;
2457
- }>;
2458
- get<K$1 extends keyof VerificationSettings>(key: K$1): VerificationSettings[K$1];
2459
- }
2460
- //#endregion
2461
- //#region src/api-verifications/schemas/requestVerificationCodeResponseSchema.d.ts
2462
- declare const requestVerificationCodeResponseSchema: alepha23.TObject<{
2463
- token: alepha23.TString;
2464
- codeExpiration: alepha23.TInteger;
2465
- verificationCooldown: alepha23.TInteger;
2466
- maxVerificationAttempts: alepha23.TInteger;
2467
- }>;
2468
- type RequestVerificationResponse = Static<typeof requestVerificationCodeResponseSchema>;
2469
- //#endregion
2470
- //#region src/api-verifications/schemas/validateVerificationCodeResponseSchema.d.ts
2471
- declare const validateVerificationCodeResponseSchema: alepha23.TObject<{
2472
- ok: alepha23.TBoolean;
2473
- alreadyVerified: alepha23.TOptional<alepha23.TBoolean>;
2474
- }>;
2475
- type ValidateVerificationCodeResponse = Static<typeof validateVerificationCodeResponseSchema>;
2476
- //#endregion
2477
- //#region src/api-verifications/schemas/verificationTypeEnumSchema.d.ts
2478
- declare const verificationTypeEnumSchema: alepha23.TUnsafe<"link" | "code">;
2479
- type VerificationTypeEnum = Static<typeof verificationTypeEnumSchema>;
2480
- //#endregion
2481
- //#region src/api-verifications/services/VerificationService.d.ts
2482
- declare class VerificationService {
2483
- protected readonly log: alepha_logger1.Logger;
2484
- protected readonly dateTimeProvider: DateTimeProvider;
2485
- protected readonly verificationParameters: VerificationParameters;
2486
- protected readonly verificationRepository: alepha_orm204.Repository<alepha23.TObject<{
2487
- id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
2488
- createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2489
- updatedAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_UPDATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2490
- version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
2491
- type: alepha23.TUnsafe<"link" | "code">;
2492
- target: alepha23.TString;
1903
+ //#region src/api-users/notifications/UserNotifications.d.ts
1904
+ declare class UserNotifications {
1905
+ readonly passwordReset: alepha_api_notifications0.NotificationPrimitive<alepha23.TObject<{
1906
+ email: alepha23.TString;
2493
1907
  code: alepha23.TString;
2494
- verifiedAt: alepha23.TOptional<alepha23.TString>;
2495
- attempts: alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_DEFAULT>;
1908
+ expiresInMinutes: alepha23.TNumber;
2496
1909
  }>>;
2497
- findByEntry(entry: VerificationEntry): Promise<VerificationEntity>;
2498
- findRecentsByEntry(entry: VerificationEntry): Promise<alepha_orm204.PgStatic<alepha23.TObject<{
2499
- id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
2500
- createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2501
- updatedAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_UPDATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2502
- version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
2503
- type: alepha23.TUnsafe<"link" | "code">;
2504
- target: alepha23.TString;
1910
+ readonly emailVerification: alepha_api_notifications0.NotificationPrimitive<alepha23.TObject<{
1911
+ email: alepha23.TString;
2505
1912
  code: alepha23.TString;
2506
- verifiedAt: alepha23.TOptional<alepha23.TString>;
2507
- attempts: alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_DEFAULT>;
2508
- }>, alepha_orm204.PgRelationMap<alepha23.TObject<{
2509
- id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
2510
- createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2511
- updatedAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_UPDATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2512
- version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
2513
- type: alepha23.TUnsafe<"link" | "code">;
2514
- target: alepha23.TString;
1913
+ expiresInMinutes: alepha23.TNumber;
1914
+ }>>;
1915
+ readonly phoneVerification: alepha_api_notifications0.NotificationPrimitive<alepha23.TObject<{
1916
+ phoneNumber: alepha23.TString;
2515
1917
  code: alepha23.TString;
2516
- verifiedAt: alepha23.TOptional<alepha23.TString>;
2517
- attempts: alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_DEFAULT>;
2518
- }>>>[]>;
2519
- /**
2520
- * Creates a verification entry and returns the token.
2521
- * The caller is responsible for sending notifications with the token.
2522
- * This allows for context-specific notifications (e.g., password reset vs email verification).
2523
- */
2524
- createVerification(entry: VerificationEntry): Promise<RequestVerificationResponse>;
2525
- verifyCode(entry: VerificationEntry, code: string): Promise<ValidateVerificationCodeResponse>;
2526
- hashCode(code: string): string;
2527
- generateToken(type: VerificationTypeEnum): string;
2528
- }
2529
- interface VerificationEntry {
2530
- type: VerificationTypeEnum;
2531
- target: string;
2532
- }
2533
- //#endregion
2534
- //#region src/api-verifications/controllers/VerificationController.d.ts
2535
- declare class VerificationController {
2536
- protected readonly verificationService: VerificationService;
2537
- readonly url = "/verifications";
2538
- readonly group = "verifications";
2539
- readonly requestVerificationCode: alepha_server0.ActionDescriptorFn<{
2540
- params: alepha23.TObject<{
2541
- type: alepha23.TUnsafe<"link" | "code">;
2542
- }>;
2543
- body: alepha23.TObject<{
2544
- target: alepha23.TString;
2545
- }>;
2546
- response: alepha23.TObject<{
2547
- token: alepha23.TString;
2548
- codeExpiration: alepha23.TInteger;
2549
- verificationCooldown: alepha23.TInteger;
2550
- maxVerificationAttempts: alepha23.TInteger;
2551
- }>;
2552
- }>;
2553
- readonly validateVerificationCode: alepha_server0.ActionDescriptorFn<{
2554
- params: alepha23.TObject<{
2555
- type: alepha23.TUnsafe<"link" | "code">;
2556
- }>;
2557
- body: alepha23.TObject<{
2558
- target: alepha23.TString;
2559
- token: alepha23.TString;
2560
- }>;
2561
- response: alepha23.TObject<{
2562
- ok: alepha23.TBoolean;
2563
- alreadyVerified: alepha23.TOptional<alepha23.TBoolean>;
2564
- }>;
2565
- }>;
1918
+ expiresInMinutes: alepha23.TNumber;
1919
+ }>>;
1920
+ readonly passwordResetLink: alepha_api_notifications0.NotificationPrimitive<alepha23.TObject<{
1921
+ email: alepha23.TString;
1922
+ resetUrl: alepha23.TString;
1923
+ expiresInMinutes: alepha23.TNumber;
1924
+ }>>;
1925
+ readonly emailVerificationLink: alepha_api_notifications0.NotificationPrimitive<alepha23.TObject<{
1926
+ email: alepha23.TString;
1927
+ verifyUrl: alepha23.TString;
1928
+ expiresInMinutes: alepha23.TNumber;
1929
+ }>>;
2566
1930
  }
2567
1931
  //#endregion
2568
- //#region src/api-notifications/schemas/notificationCreateSchema.d.ts
2569
- declare const notificationCreateSchema: alepha23.TObject<{
2570
- type: alepha23.TUnsafe<"email" | "sms">;
2571
- template: alepha23.TString;
2572
- contact: alepha23.TString;
2573
- variables: alepha23.TOptional<alepha23.TRecord<"^.*$", alepha23.TAny>>;
1932
+ //#region src/api-users/schemas/completePasswordResetRequestSchema.d.ts
1933
+ /**
1934
+ * Request schema for completing a password reset.
1935
+ *
1936
+ * Requires the intent ID from Phase 1, the verification code,
1937
+ * and the new password.
1938
+ */
1939
+ declare const completePasswordResetRequestSchema: alepha23.TObject<{
1940
+ intentId: alepha23.TString;
1941
+ code: alepha23.TString;
1942
+ newPassword: alepha23.TString;
2574
1943
  }>;
2575
- type NotificationCreate = Static<typeof notificationCreateSchema>;
1944
+ type CompletePasswordResetRequest = Static<typeof completePasswordResetRequestSchema>;
2576
1945
  //#endregion
2577
- //#region src/api-notifications/entities/notifications.d.ts
2578
- declare const notifications: alepha_orm204.EntityDescriptor<alepha23.TObject<{
2579
- id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
2580
- version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
2581
- createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2582
- updatedAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_UPDATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2583
- type: alepha23.TUnsafe<"email" | "sms">;
2584
- template: alepha23.TString;
2585
- category: alepha23.TOptional<alepha23.TString>;
2586
- critical: alepha23.TOptional<alepha23.TBoolean>;
2587
- sensitive: alepha23.TOptional<alepha23.TBoolean>;
2588
- contact: alepha23.TString;
2589
- variables: alepha23.TOptional<alepha23.TRecord<"^.*$", alepha23.TAny>>;
2590
- scheduledAt: alepha23.TOptional<alepha23.TString>;
2591
- sentAt: alepha23.TOptional<alepha23.TString>;
2592
- error: alepha23.TOptional<alepha23.TObject<{
2593
- at: alepha23.TString;
2594
- name: alepha23.TString;
2595
- message: alepha23.TString;
2596
- }>>;
2597
- }>>;
2598
- type NotificationEntity = Static<typeof notifications.schema>;
1946
+ //#region src/api-users/schemas/passwordResetIntentResponseSchema.d.ts
1947
+ /**
1948
+ * Response schema for password reset intent creation.
1949
+ *
1950
+ * Contains the intent ID needed for Phase 2 completion,
1951
+ * along with expiration time.
1952
+ */
1953
+ declare const passwordResetIntentResponseSchema: alepha23.TObject<{
1954
+ intentId: alepha23.TString;
1955
+ expiresAt: alepha23.TString;
1956
+ }>;
1957
+ type PasswordResetIntentResponse = Static<typeof passwordResetIntentResponseSchema>;
2599
1958
  //#endregion
2600
- //#region src/api-notifications/providers/SmsProvider.d.ts
2601
- declare abstract class SmsProvider {
2602
- abstract send(options: SmsSendOptions): Promise<void>;
2603
- }
2604
- interface SmsSendOptions {
2605
- to: string;
2606
- message: string;
1959
+ //#region src/api-users/services/CredentialService.d.ts
1960
+ /**
1961
+ * Intent stored in cache during the password reset flow.
1962
+ */
1963
+ interface PasswordResetIntent {
1964
+ email: string;
1965
+ userId: string;
1966
+ identityId: string;
1967
+ realmName?: string;
1968
+ expiresAt: string;
2607
1969
  }
2608
- //#endregion
2609
- //#region src/api-notifications/services/NotificationSenderService.d.ts
2610
- declare class NotificationSenderService {
2611
- protected readonly alepha: Alepha;
2612
- protected readonly log: alepha_logger1.Logger;
2613
- protected readonly notificationRepository: alepha_orm204.Repository<alepha23.TObject<{
2614
- id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
2615
- version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
2616
- createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2617
- updatedAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_UPDATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2618
- type: alepha23.TUnsafe<"email" | "sms">;
2619
- template: alepha23.TString;
2620
- category: alepha23.TOptional<alepha23.TString>;
2621
- critical: alepha23.TOptional<alepha23.TBoolean>;
2622
- sensitive: alepha23.TOptional<alepha23.TBoolean>;
2623
- contact: alepha23.TString;
2624
- variables: alepha23.TOptional<alepha23.TRecord<"^.*$", alepha23.TAny>>;
2625
- scheduledAt: alepha23.TOptional<alepha23.TString>;
2626
- sentAt: alepha23.TOptional<alepha23.TString>;
2627
- error: alepha23.TOptional<alepha23.TObject<{
2628
- at: alepha23.TString;
2629
- name: alepha23.TString;
2630
- message: alepha23.TString;
2631
- }>>;
2632
- }>>;
2633
- protected readonly dateTimeProvider: DateTimeProvider;
2634
- protected readonly emailProvider: EmailProvider;
2635
- protected readonly smsProvider: SmsProvider;
2636
- send(notificationId: string | NotificationEntity): Promise<void>;
2637
- renderSms(notification: NotificationEntity): {
2638
- to: string;
2639
- message: string;
2640
- };
2641
- renderEmail(notification: NotificationEntity): {
2642
- to: string;
2643
- subject: string;
2644
- body: string;
2645
- };
2646
- protected load(notification: NotificationEntity): {
2647
- template: NotificationDescriptor<alepha23.TObject<alepha23.TProperties>>;
2648
- variables: Record<string, any>;
2649
- contact: string;
2650
- };
2651
- }
2652
- //#endregion
2653
- //#region src/api-notifications/services/NotificationService.d.ts
2654
- declare const notificationServiceEnvSchema: alepha23.TObject<{
2655
- NOTIFICATION_QUEUE: alepha23.TOptional<alepha23.TBoolean>;
2656
- }>;
2657
- declare module "alepha" {
2658
- interface Env extends Partial<Static<typeof notificationServiceEnvSchema>> {}
2659
- }
2660
- declare class NotificationService {
2661
- protected readonly alepha: Alepha;
2662
- protected readonly log: alepha_logger1.Logger;
2663
- protected readonly env: {
2664
- NOTIFICATION_QUEUE?: boolean | undefined;
2665
- };
2666
- protected readonly notificationRepository: alepha_orm204.Repository<alepha23.TObject<{
2667
- id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
2668
- version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
2669
- createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2670
- updatedAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_UPDATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2671
- type: alepha23.TUnsafe<"email" | "sms">;
2672
- template: alepha23.TString;
2673
- category: alepha23.TOptional<alepha23.TString>;
2674
- critical: alepha23.TOptional<alepha23.TBoolean>;
2675
- sensitive: alepha23.TOptional<alepha23.TBoolean>;
2676
- contact: alepha23.TString;
2677
- variables: alepha23.TOptional<alepha23.TRecord<"^.*$", alepha23.TAny>>;
2678
- scheduledAt: alepha23.TOptional<alepha23.TString>;
2679
- sentAt: alepha23.TOptional<alepha23.TString>;
2680
- error: alepha23.TOptional<alepha23.TObject<{
2681
- at: alepha23.TString;
2682
- name: alepha23.TString;
2683
- message: alepha23.TString;
2684
- }>>;
2685
- }>>;
2686
- protected readonly dateTimeProvider: DateTimeProvider;
2687
- protected readonly notificationSenderService: NotificationSenderService;
2688
- readonly notificationBatch: alepha_batch0.BatchDescriptor<alepha23.TObject<{
2689
- type: alepha23.TUnsafe<"email" | "sms">;
2690
- template: alepha23.TString;
2691
- contact: alepha23.TString;
2692
- variables: alepha23.TOptional<alepha23.TRecord<"^.*$", alepha23.TAny>>;
2693
- }>, Promise<void>>;
2694
- findNotificationById(id: string): Promise<alepha_orm204.PgStatic<alepha23.TObject<{
2695
- id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
2696
- version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
2697
- createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2698
- updatedAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_UPDATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2699
- type: alepha23.TUnsafe<"email" | "sms">;
2700
- template: alepha23.TString;
2701
- category: alepha23.TOptional<alepha23.TString>;
2702
- critical: alepha23.TOptional<alepha23.TBoolean>;
2703
- sensitive: alepha23.TOptional<alepha23.TBoolean>;
2704
- contact: alepha23.TString;
2705
- variables: alepha23.TOptional<alepha23.TRecord<"^.*$", alepha23.TAny>>;
2706
- scheduledAt: alepha23.TOptional<alepha23.TString>;
2707
- sentAt: alepha23.TOptional<alepha23.TString>;
2708
- error: alepha23.TOptional<alepha23.TObject<{
2709
- at: alepha23.TString;
2710
- name: alepha23.TString;
2711
- message: alepha23.TString;
2712
- }>>;
2713
- }>, alepha_orm204.PgRelationMap<alepha23.TObject<{
2714
- id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
2715
- version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
2716
- createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2717
- updatedAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_UPDATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
2718
- type: alepha23.TUnsafe<"email" | "sms">;
2719
- template: alepha23.TString;
2720
- category: alepha23.TOptional<alepha23.TString>;
2721
- critical: alepha23.TOptional<alepha23.TBoolean>;
2722
- sensitive: alepha23.TOptional<alepha23.TBoolean>;
2723
- contact: alepha23.TString;
2724
- variables: alepha23.TOptional<alepha23.TRecord<"^.*$", alepha23.TAny>>;
2725
- scheduledAt: alepha23.TOptional<alepha23.TString>;
2726
- sentAt: alepha23.TOptional<alepha23.TString>;
2727
- error: alepha23.TOptional<alepha23.TObject<{
2728
- at: alepha23.TString;
2729
- name: alepha23.TString;
2730
- message: alepha23.TString;
2731
- }>>;
2732
- }>>>>;
2733
- /**
2734
- * Create a new notification.
2735
- */
2736
- createNotification(entry: NotificationCreate): Promise<void>;
2737
- }
2738
- //#endregion
2739
- //#region src/api-notifications/descriptors/$notification.d.ts
2740
- interface NotificationDescriptorOptions<T extends TObject> extends NotificationMessage<T> {
2741
- name?: string;
2742
- description?: string;
2743
- category?: string;
2744
- critical?: boolean;
2745
- sensitive?: boolean;
2746
- translations?: {
2747
- [lang: string]: NotificationMessage<T>;
2748
- };
2749
- schema: T;
2750
- }
2751
- declare class NotificationDescriptor<T extends TObject> extends Descriptor<NotificationDescriptorOptions<T>> {
2752
- protected readonly notificationService: NotificationService;
2753
- get name(): string;
2754
- push(options: NotificationPushOptions<T>): Promise<void>;
2755
- configure(options: Partial<NotificationDescriptorOptions<T>>): void;
2756
- }
2757
- interface NotificationPushOptions<T extends TObject> {
2758
- variables: StaticEncode<T>;
2759
- contact: string;
2760
- }
2761
- interface NotificationMessage<T extends TObject> {
2762
- email?: {
2763
- subject: string;
2764
- body: string | ((variables: Static<T>) => string);
2765
- };
2766
- sms?: {
2767
- message: string | ((variables: Static<T>) => string);
2768
- };
2769
- }
2770
- //#endregion
2771
- //#region src/api-users/notifications/UserNotifications.d.ts
2772
- declare class UserNotifications {
2773
- readonly passwordReset: NotificationDescriptor<alepha23.TObject<{
2774
- email: alepha23.TString;
2775
- code: alepha23.TString;
2776
- expiresInMinutes: alepha23.TNumber;
2777
- }>>;
2778
- readonly emailVerification: NotificationDescriptor<alepha23.TObject<{
2779
- email: alepha23.TString;
2780
- code: alepha23.TString;
2781
- expiresInMinutes: alepha23.TNumber;
2782
- }>>;
2783
- readonly phoneVerification: NotificationDescriptor<alepha23.TObject<{
2784
- phoneNumber: alepha23.TString;
2785
- code: alepha23.TString;
2786
- expiresInMinutes: alepha23.TNumber;
2787
- }>>;
2788
- readonly passwordResetLink: NotificationDescriptor<alepha23.TObject<{
2789
- email: alepha23.TString;
2790
- resetUrl: alepha23.TString;
2791
- expiresInMinutes: alepha23.TNumber;
2792
- }>>;
2793
- readonly emailVerificationLink: NotificationDescriptor<alepha23.TObject<{
2794
- email: alepha23.TString;
2795
- verifyUrl: alepha23.TString;
2796
- expiresInMinutes: alepha23.TNumber;
2797
- }>>;
2798
- }
2799
- //#endregion
2800
- //#region src/api-users/schemas/completePasswordResetRequestSchema.d.ts
2801
- /**
2802
- * Request schema for completing a password reset.
2803
- *
2804
- * Requires the intent ID from Phase 1, the verification code,
2805
- * and the new password.
2806
- */
2807
- declare const completePasswordResetRequestSchema: alepha23.TObject<{
2808
- intentId: alepha23.TString;
2809
- code: alepha23.TString;
2810
- newPassword: alepha23.TString;
2811
- }>;
2812
- type CompletePasswordResetRequest = Static<typeof completePasswordResetRequestSchema>;
2813
- //#endregion
2814
- //#region src/api-users/schemas/passwordResetIntentResponseSchema.d.ts
2815
- /**
2816
- * Response schema for password reset intent creation.
2817
- *
2818
- * Contains the intent ID needed for Phase 2 completion,
2819
- * along with expiration time.
2820
- */
2821
- declare const passwordResetIntentResponseSchema: alepha23.TObject<{
2822
- intentId: alepha23.TString;
2823
- expiresAt: alepha23.TString;
2824
- }>;
2825
- type PasswordResetIntentResponse = Static<typeof passwordResetIntentResponseSchema>;
2826
- //#endregion
2827
- //#region src/api-users/services/CredentialService.d.ts
2828
- /**
2829
- * Intent stored in cache during the password reset flow.
2830
- */
2831
- interface PasswordResetIntent {
2832
- email: string;
2833
- userId: string;
2834
- identityId: string;
2835
- realmName?: string;
2836
- expiresAt: string;
2837
- }
2838
- declare class CredentialService {
1970
+ declare class CredentialService {
2839
1971
  protected readonly log: alepha_logger1.Logger;
2840
1972
  protected readonly cryptoProvider: CryptoProvider;
2841
1973
  protected readonly dateTimeProvider: DateTimeProvider;
2842
- protected readonly verificationController: HttpVirtualClient<VerificationController>;
1974
+ protected readonly verificationController: alepha_server_links0.HttpVirtualClient<VerificationController>;
2843
1975
  protected readonly userNotifications: UserNotifications;
2844
1976
  protected readonly userRealmProvider: UserRealmProvider;
2845
- protected readonly intentCache: alepha_cache0.CacheDescriptorFn<PasswordResetIntent, any[]>;
1977
+ protected readonly intentCache: alepha_cache0.CachePrimitiveFn<PasswordResetIntent, any[]>;
2846
1978
  users(userRealmName?: string): Repository$1<alepha23.TObject<{
2847
1979
  id: PgAttr<PgAttr<alepha23.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
2848
1980
  version: PgAttr<PgAttr<alepha23.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
@@ -2980,10 +2112,10 @@ declare class RegistrationService {
2980
2112
  protected readonly log: alepha_logger1.Logger;
2981
2113
  protected readonly dateTimeProvider: DateTimeProvider;
2982
2114
  protected readonly cryptoProvider: CryptoProvider;
2983
- protected readonly verificationController: HttpVirtualClient<VerificationController>;
2115
+ protected readonly verificationController: alepha_server_links0.HttpVirtualClient<VerificationController>;
2984
2116
  protected readonly userNotifications: UserNotifications;
2985
2117
  protected readonly userRealmProvider: UserRealmProvider;
2986
- protected readonly intentCache: alepha_cache0.CacheDescriptorFn<RegistrationIntent, any[]>;
2118
+ protected readonly intentCache: alepha_cache0.CachePrimitiveFn<RegistrationIntent, any[]>;
2987
2119
  /**
2988
2120
  * Phase 1: Create a registration intent.
2989
2121
  *
@@ -3067,7 +2199,7 @@ type UserQuery = Static<typeof userQuerySchema>;
3067
2199
  //#region src/api-users/services/UserService.d.ts
3068
2200
  declare class UserService {
3069
2201
  protected readonly log: alepha_logger1.Logger;
3070
- protected readonly verificationController: HttpVirtualClient<VerificationController>;
2202
+ protected readonly verificationController: alepha_server_links0.HttpVirtualClient<VerificationController>;
3071
2203
  protected readonly userNotifications: UserNotifications;
3072
2204
  protected readonly userRealmProvider: UserRealmProvider;
3073
2205
  users(userRealmName?: string): alepha_orm204.Repository<alepha23.TObject<{
@@ -3131,7 +2263,7 @@ declare class UserController {
3131
2263
  * Phase 1: Create a registration intent.
3132
2264
  * Validates data, creates verification sessions, and stores intent in cache.
3133
2265
  */
3134
- readonly createRegistrationIntent: alepha_server0.ActionDescriptorFn<{
2266
+ readonly createRegistrationIntent: alepha_server0.ActionPrimitiveFn<{
3135
2267
  body: alepha23.TObject<{
3136
2268
  password: alepha23.TString;
3137
2269
  username: alepha23.TOptional<alepha23.TString>;
@@ -3155,7 +2287,7 @@ declare class UserController {
3155
2287
  /**
3156
2288
  * Find users with pagination and filtering.
3157
2289
  */
3158
- readonly findUsers: alepha_server0.ActionDescriptorFn<{
2290
+ readonly findUsers: alepha_server0.ActionPrimitiveFn<{
3159
2291
  query: alepha23.TObject<{
3160
2292
  page: alepha23.TOptional<alepha23.TInteger>;
3161
2293
  size: alepha23.TOptional<alepha23.TInteger>;
@@ -3187,7 +2319,7 @@ declare class UserController {
3187
2319
  /**
3188
2320
  * Get a user by ID.
3189
2321
  */
3190
- readonly getUser: alepha_server0.ActionDescriptorFn<{
2322
+ readonly getUser: alepha_server0.ActionPrimitiveFn<{
3191
2323
  params: alepha23.TObject<{
3192
2324
  id: alepha23.TString;
3193
2325
  }>;
@@ -3214,7 +2346,7 @@ declare class UserController {
3214
2346
  /**
3215
2347
  * Create a new user.
3216
2348
  */
3217
- readonly createUser: alepha_server0.ActionDescriptorFn<{
2349
+ readonly createUser: alepha_server0.ActionPrimitiveFn<{
3218
2350
  query: alepha23.TObject<{
3219
2351
  userRealmName: alepha23.TOptional<alepha23.TString>;
3220
2352
  }>;
@@ -3254,7 +2386,7 @@ declare class UserController {
3254
2386
  * Phase 2: Complete registration using an intent.
3255
2387
  * Validates verification codes and creates the user.
3256
2388
  */
3257
- readonly createUserFromIntent: alepha_server0.ActionDescriptorFn<{
2389
+ readonly createUserFromIntent: alepha_server0.ActionPrimitiveFn<{
3258
2390
  body: alepha23.TObject<{
3259
2391
  intentId: alepha23.TString;
3260
2392
  emailCode: alepha23.TOptional<alepha23.TString>;
@@ -3281,7 +2413,7 @@ declare class UserController {
3281
2413
  /**
3282
2414
  * Update a user.
3283
2415
  */
3284
- readonly updateUser: alepha_server0.ActionDescriptorFn<{
2416
+ readonly updateUser: alepha_server0.ActionPrimitiveFn<{
3285
2417
  params: alepha23.TObject<{
3286
2418
  id: alepha23.TString;
3287
2419
  }>;
@@ -3318,7 +2450,7 @@ declare class UserController {
3318
2450
  /**
3319
2451
  * Delete a user.
3320
2452
  */
3321
- readonly deleteUser: alepha_server0.ActionDescriptorFn<{
2453
+ readonly deleteUser: alepha_server0.ActionPrimitiveFn<{
3322
2454
  params: alepha23.TObject<{
3323
2455
  id: alepha23.TString;
3324
2456
  }>;
@@ -3335,7 +2467,7 @@ declare class UserController {
3335
2467
  * Phase 1: Create a password reset intent.
3336
2468
  * Validates email, sends verification code, and stores intent in cache.
3337
2469
  */
3338
- readonly createPasswordResetIntent: alepha_server0.ActionDescriptorFn<{
2470
+ readonly createPasswordResetIntent: alepha_server0.ActionPrimitiveFn<{
3339
2471
  query: alepha23.TObject<{
3340
2472
  userRealmName: alepha23.TOptional<alepha23.TString>;
3341
2473
  }>;
@@ -3351,7 +2483,7 @@ declare class UserController {
3351
2483
  * Phase 2: Complete password reset using an intent.
3352
2484
  * Validates verification code, updates password, and invalidates sessions.
3353
2485
  */
3354
- readonly completePasswordReset: alepha_server0.ActionDescriptorFn<{
2486
+ readonly completePasswordReset: alepha_server0.ActionPrimitiveFn<{
3355
2487
  body: alepha23.TObject<{
3356
2488
  intentId: alepha23.TString;
3357
2489
  code: alepha23.TString;
@@ -3366,7 +2498,7 @@ declare class UserController {
3366
2498
  /**
3367
2499
  * @deprecated Use createPasswordResetIntent instead
3368
2500
  */
3369
- requestPasswordReset: alepha_server0.ActionDescriptorFn<{
2501
+ requestPasswordReset: alepha_server0.ActionPrimitiveFn<{
3370
2502
  query: alepha23.TObject<{
3371
2503
  userRealmName: alepha23.TOptional<alepha23.TString>;
3372
2504
  }>;
@@ -3381,7 +2513,7 @@ declare class UserController {
3381
2513
  /**
3382
2514
  * @deprecated Use completePasswordReset instead
3383
2515
  */
3384
- validateResetToken: alepha_server0.ActionDescriptorFn<{
2516
+ validateResetToken: alepha_server0.ActionPrimitiveFn<{
3385
2517
  query: alepha23.TObject<{
3386
2518
  email: alepha23.TString;
3387
2519
  token: alepha23.TString;
@@ -3395,7 +2527,7 @@ declare class UserController {
3395
2527
  /**
3396
2528
  * @deprecated Use completePasswordReset instead
3397
2529
  */
3398
- resetPassword: alepha_server0.ActionDescriptorFn<{
2530
+ resetPassword: alepha_server0.ActionPrimitiveFn<{
3399
2531
  query: alepha23.TObject<{
3400
2532
  userRealmName: alepha23.TOptional<alepha23.TString>;
3401
2533
  }>;
@@ -3413,7 +2545,7 @@ declare class UserController {
3413
2545
  * Request email verification.
3414
2546
  * Generates a verification token using verification service and sends an email to the user.
3415
2547
  */
3416
- requestEmailVerification: alepha_server0.ActionDescriptorFn<{
2548
+ requestEmailVerification: alepha_server0.ActionPrimitiveFn<{
3417
2549
  query: alepha23.TObject<{
3418
2550
  userRealmName: alepha23.TOptional<alepha23.TString>;
3419
2551
  }>;
@@ -3429,7 +2561,7 @@ declare class UserController {
3429
2561
  * Verify email with a valid token.
3430
2562
  * Updates the user's emailVerified status.
3431
2563
  */
3432
- verifyEmail: alepha_server0.ActionDescriptorFn<{
2564
+ verifyEmail: alepha_server0.ActionPrimitiveFn<{
3433
2565
  query: alepha23.TObject<{
3434
2566
  userRealmName: alepha23.TOptional<alepha23.TString>;
3435
2567
  }>;
@@ -3445,7 +2577,7 @@ declare class UserController {
3445
2577
  /**
3446
2578
  * Check if an email is verified.
3447
2579
  */
3448
- checkEmailVerification: alepha_server0.ActionDescriptorFn<{
2580
+ checkEmailVerification: alepha_server0.ActionPrimitiveFn<{
3449
2581
  query: alepha23.TObject<{
3450
2582
  email: alepha23.TString;
3451
2583
  userRealmName: alepha23.TOptional<alepha23.TString>;
@@ -3456,535 +2588,6 @@ declare class UserController {
3456
2588
  }>;
3457
2589
  }
3458
2590
  //#endregion
3459
- //#region src/server-cookies/services/CookieParser.d.ts
3460
- declare class CookieParser {
3461
- parseRequestCookies(header: string): Record<string, string>;
3462
- serializeResponseCookies(cookies: Record<string, Cookie | null>, isHttps: boolean): string[];
3463
- cookieToString(name: string, cookie: Cookie, isHttps?: boolean): string;
3464
- }
3465
- //#endregion
3466
- //#region src/server-cookies/providers/ServerCookiesProvider.d.ts
3467
- declare class ServerCookiesProvider {
3468
- protected readonly alepha: Alepha;
3469
- protected readonly log: alepha_logger1.Logger;
3470
- protected readonly cookieParser: CookieParser;
3471
- protected readonly dateTimeProvider: DateTimeProvider;
3472
- protected readonly env: {
3473
- APP_SECRET: string;
3474
- };
3475
- protected readonly ALGORITHM = "aes-256-gcm";
3476
- protected readonly IV_LENGTH = 16;
3477
- protected readonly AUTH_TAG_LENGTH = 16;
3478
- protected readonly SIGNATURE_LENGTH = 32;
3479
- readonly onRequest: alepha23.HookDescriptor<"server:onRequest">;
3480
- readonly onAction: alepha23.HookDescriptor<"action:onRequest">;
3481
- readonly onSend: alepha23.HookDescriptor<"server:onSend">;
3482
- protected getCookiesFromContext(cookies?: Cookies): Cookies;
3483
- getCookie<T extends TSchema>(name: string, options: CookieDescriptorOptions<T>, contextCookies?: Cookies): Static<T> | undefined;
3484
- setCookie<T extends TSchema>(name: string, options: CookieDescriptorOptions<T>, data: Static<T>, contextCookies?: Cookies): void;
3485
- deleteCookie<T extends TSchema>(name: string, contextCookies?: Cookies): void;
3486
- protected encrypt(text: string): string;
3487
- protected decrypt(encryptedText: string): string;
3488
- secretKey(): string;
3489
- protected sign(data: string): string;
3490
- }
3491
- //#endregion
3492
- //#region src/server-cookies/descriptors/$cookie.d.ts
3493
- interface CookieDescriptorOptions<T extends TSchema> {
3494
- /** The schema for the cookie's value, used for validation and type safety. */
3495
- schema: T;
3496
- /** The name of the cookie. */
3497
- name?: string;
3498
- /** The cookie's path. Defaults to "/". */
3499
- path?: string;
3500
- /** Time-to-live for the cookie. Maps to `Max-Age`. */
3501
- ttl?: DurationLike;
3502
- /** If true, the cookie is only sent over HTTPS. Defaults to true in production. */
3503
- secure?: boolean;
3504
- /** If true, the cookie cannot be accessed by client-side scripts. */
3505
- httpOnly?: boolean;
3506
- /** SameSite policy for the cookie. Defaults to "lax". */
3507
- sameSite?: "strict" | "lax" | "none";
3508
- /** The domain for the cookie. */
3509
- domain?: string;
3510
- /** If true, the cookie value will be compressed using zlib. */
3511
- compress?: boolean;
3512
- /** If true, the cookie value will be encrypted. Requires `COOKIE_SECRET` env var. */
3513
- encrypt?: boolean;
3514
- /** If true, the cookie will be signed to prevent tampering. Requires `COOKIE_SECRET` env var. */
3515
- sign?: boolean;
3516
- }
3517
- interface AbstractCookieDescriptor<T extends TSchema> {
3518
- readonly name: string;
3519
- readonly options: CookieDescriptorOptions<T>;
3520
- set(value: Static<T>, options?: {
3521
- cookies?: Cookies;
3522
- ttl?: DurationLike;
3523
- }): void;
3524
- get(options?: {
3525
- cookies?: Cookies;
3526
- }): Static<T> | undefined;
3527
- del(options?: {
3528
- cookies?: Cookies;
3529
- }): void;
3530
- }
3531
- interface Cookies {
3532
- req: Record<string, string>;
3533
- res: Record<string, Cookie | null>;
3534
- }
3535
- interface Cookie {
3536
- value: string;
3537
- path?: string;
3538
- maxAge?: number;
3539
- secure?: boolean;
3540
- httpOnly?: boolean;
3541
- sameSite?: "strict" | "lax" | "none";
3542
- domain?: string;
3543
- }
3544
- //#endregion
3545
- //#region src/server-cookies/index.d.ts
3546
- declare module "alepha/server" {
3547
- interface ServerRequest {
3548
- cookies: Cookies;
3549
- }
3550
- }
3551
- /**
3552
- * Provides HTTP cookie management capabilities for server requests and responses with type-safe cookie descriptors.
3553
- *
3554
- * The server-cookies module enables declarative cookie handling using the `$cookie` descriptor on class properties.
3555
- * It offers automatic cookie parsing, secure cookie configuration, and seamless integration with server routes
3556
- * for managing user sessions, preferences, and authentication tokens.
3557
- *
3558
- * @see {@link $cookie}
3559
- * @module alepha.server.cookies
3560
- */
3561
- //#endregion
3562
- //#region src/server-auth/schemas/authenticationProviderSchema.d.ts
3563
- declare const authenticationProviderSchema: alepha23.TObject<{
3564
- name: alepha23.TString;
3565
- type: alepha23.TUnsafe<"OAUTH2" | "OIDC" | "CREDENTIALS">;
3566
- }>;
3567
- type AuthenticationProvider = Static<typeof authenticationProviderSchema>;
3568
- //#endregion
3569
- //#region src/server-auth/schemas/tokensSchema.d.ts
3570
- declare const tokensSchema: alepha23.TObject<{
3571
- provider: alepha23.TString;
3572
- access_token: alepha23.TString;
3573
- issued_at: alepha23.TNumber;
3574
- expires_in: alepha23.TOptional<alepha23.TNumber>;
3575
- refresh_token: alepha23.TOptional<alepha23.TString>;
3576
- refresh_token_expires_in: alepha23.TOptional<alepha23.TNumber>;
3577
- refresh_expires_in: alepha23.TOptional<alepha23.TNumber>;
3578
- id_token: alepha23.TOptional<alepha23.TString>;
3579
- scope: alepha23.TOptional<alepha23.TString>;
3580
- }>;
3581
- type Tokens = Static<typeof tokensSchema>;
3582
- //#endregion
3583
- //#region src/server-auth/providers/ServerAuthProvider.d.ts
3584
- declare class ServerAuthProvider {
3585
- protected readonly log: alepha_logger1.Logger;
3586
- protected readonly alepha: Alepha;
3587
- protected readonly serverCookiesProvider: ServerCookiesProvider;
3588
- protected readonly dateTimeProvider: DateTimeProvider;
3589
- protected readonly serverLinksProvider: ServerLinksProvider;
3590
- protected readonly authorizationCode: AbstractCookieDescriptor<alepha23.TObject<{
3591
- provider: alepha23.TString;
3592
- codeVerifier: alepha23.TOptional<alepha23.TString>;
3593
- redirectUri: alepha23.TOptional<alepha23.TString>;
3594
- state: alepha23.TOptional<alepha23.TString>;
3595
- nonce: alepha23.TOptional<alepha23.TString>;
3596
- }>>;
3597
- readonly tokens: AbstractCookieDescriptor<alepha23.TObject<{
3598
- provider: alepha23.TString;
3599
- access_token: alepha23.TString;
3600
- issued_at: alepha23.TNumber;
3601
- expires_in: alepha23.TOptional<alepha23.TNumber>;
3602
- refresh_token: alepha23.TOptional<alepha23.TString>;
3603
- refresh_token_expires_in: alepha23.TOptional<alepha23.TNumber>;
3604
- refresh_expires_in: alepha23.TOptional<alepha23.TNumber>;
3605
- id_token: alepha23.TOptional<alepha23.TString>;
3606
- scope: alepha23.TOptional<alepha23.TString>;
3607
- }>>;
3608
- get identities(): Array<AuthDescriptor>;
3609
- getAuthenticationProviders(filters?: {
3610
- realmName?: string;
3611
- }): AuthenticationProvider[];
3612
- protected readonly configure: alepha23.HookDescriptor<"configure">;
3613
- protected getAccessTokens(tokens: Tokens): string | undefined;
3614
- /**
3615
- * Fill request headers with access token from cookies or fallback to provider's fallback function.
3616
- */
3617
- protected readonly onRequest: alepha23.HookDescriptor<"server:onRequest">;
3618
- /**
3619
- * Convert cookies to tokens.
3620
- * If the tokens are expired, try to refresh them using the refresh token.
3621
- */
3622
- protected cookiesToTokens(cookies: Cookies): Promise<Tokens | undefined>;
3623
- protected refreshTokens(tokens: Tokens): Promise<Tokens | undefined>;
3624
- /**
3625
- * Get user information.
3626
- */
3627
- readonly userinfo: alepha_server0.RouteDescriptor<{
3628
- response: alepha23.TObject<{
3629
- user: alepha23.TOptional<alepha23.TObject<{
3630
- id: alepha23.TString;
3631
- name: alepha23.TOptional<alepha23.TString>;
3632
- email: alepha23.TOptional<alepha23.TString>;
3633
- username: alepha23.TOptional<alepha23.TString>;
3634
- picture: alepha23.TOptional<alepha23.TString>;
3635
- sessionId: alepha23.TOptional<alepha23.TString>;
3636
- organizations: alepha23.TOptional<alepha23.TArray<alepha23.TString>>;
3637
- roles: alepha23.TOptional<alepha23.TArray<alepha23.TString>>;
3638
- }>>;
3639
- api: alepha23.TObject<{
3640
- prefix: alepha23.TOptional<alepha23.TString>;
3641
- links: alepha23.TArray<alepha23.TObject<{
3642
- name: alepha23.TString;
3643
- group: alepha23.TOptional<alepha23.TString>;
3644
- path: alepha23.TString;
3645
- method: alepha23.TOptional<alepha23.TString>;
3646
- requestBodyType: alepha23.TOptional<alepha23.TString>;
3647
- service: alepha23.TOptional<alepha23.TString>;
3648
- }>>;
3649
- }>;
3650
- }>;
3651
- }>;
3652
- /**
3653
- * Refresh a token for internal providers.
3654
- */
3655
- readonly refresh: alepha_server0.RouteDescriptor<{
3656
- query: alepha23.TObject<{
3657
- provider: alepha23.TString;
3658
- }>;
3659
- body: alepha23.TObject<{
3660
- refresh_token: alepha23.TString;
3661
- access_token: alepha23.TOptional<alepha23.TString>;
3662
- }>;
3663
- response: alepha23.TObject<{
3664
- provider: alepha23.TString;
3665
- access_token: alepha23.TString;
3666
- issued_at: alepha23.TNumber;
3667
- expires_in: alepha23.TOptional<alepha23.TNumber>;
3668
- refresh_token: alepha23.TOptional<alepha23.TString>;
3669
- refresh_token_expires_in: alepha23.TOptional<alepha23.TNumber>;
3670
- refresh_expires_in: alepha23.TOptional<alepha23.TNumber>;
3671
- id_token: alepha23.TOptional<alepha23.TString>;
3672
- scope: alepha23.TOptional<alepha23.TString>;
3673
- }>;
3674
- }>;
3675
- /**
3676
- * Login for local password-based authentication.
3677
- */
3678
- readonly token: alepha_server0.RouteDescriptor<{
3679
- query: alepha23.TObject<{
3680
- provider: alepha23.TString;
3681
- }>;
3682
- body: alepha23.TObject<{
3683
- username: alepha23.TString;
3684
- password: alepha23.TString;
3685
- }>;
3686
- response: alepha23.TObject<{
3687
- provider: alepha23.TString;
3688
- access_token: alepha23.TString;
3689
- issued_at: alepha23.TNumber;
3690
- expires_in: alepha23.TOptional<alepha23.TNumber>;
3691
- refresh_token: alepha23.TOptional<alepha23.TString>;
3692
- refresh_token_expires_in: alepha23.TOptional<alepha23.TNumber>;
3693
- refresh_expires_in: alepha23.TOptional<alepha23.TNumber>;
3694
- id_token: alepha23.TOptional<alepha23.TString>;
3695
- scope: alepha23.TOptional<alepha23.TString>;
3696
- user: alepha23.TObject<{
3697
- id: alepha23.TString;
3698
- name: alepha23.TOptional<alepha23.TString>;
3699
- email: alepha23.TOptional<alepha23.TString>;
3700
- username: alepha23.TOptional<alepha23.TString>;
3701
- picture: alepha23.TOptional<alepha23.TString>;
3702
- sessionId: alepha23.TOptional<alepha23.TString>;
3703
- organizations: alepha23.TOptional<alepha23.TArray<alepha23.TString>>;
3704
- roles: alepha23.TOptional<alepha23.TArray<alepha23.TString>>;
3705
- }>;
3706
- api: alepha23.TObject<{
3707
- prefix: alepha23.TOptional<alepha23.TString>;
3708
- links: alepha23.TArray<alepha23.TObject<{
3709
- name: alepha23.TString;
3710
- group: alepha23.TOptional<alepha23.TString>;
3711
- path: alepha23.TString;
3712
- method: alepha23.TOptional<alepha23.TString>;
3713
- requestBodyType: alepha23.TOptional<alepha23.TString>;
3714
- service: alepha23.TOptional<alepha23.TString>;
3715
- }>>;
3716
- }>;
3717
- }>;
3718
- }>;
3719
- /**
3720
- * Oauth2/OIDC login route.
3721
- */
3722
- readonly login: alepha_server0.RouteDescriptor<{
3723
- query: alepha23.TObject<{
3724
- provider: alepha23.TString;
3725
- redirect_uri: alepha23.TOptional<alepha23.TString>;
3726
- }>;
3727
- }>;
3728
- /**
3729
- * Callback for OAuth2/OIDC providers.
3730
- * It handles the authorization code flow and retrieves the access token.
3731
- */
3732
- readonly callback: alepha_server0.RouteDescriptor<alepha_server0.RequestConfigSchema>;
3733
- /**
3734
- * Logout route for OAuth2/OIDC providers.
3735
- */
3736
- readonly logout: alepha_server0.RouteDescriptor<{
3737
- query: alepha23.TObject<{
3738
- post_logout_redirect_uri: alepha23.TOptional<alepha23.TString>;
3739
- }>;
3740
- }>;
3741
- protected provider(opts: string | {
3742
- provider: string;
3743
- }): AuthDescriptor;
3744
- protected setTokens(tokens: Tokens, cookies?: Cookies): void;
3745
- }
3746
- interface OAuth2Profile {
3747
- sub: string;
3748
- email?: string;
3749
- name?: string;
3750
- given_name?: string;
3751
- family_name?: string;
3752
- middle_name?: string;
3753
- nickname?: string;
3754
- preferred_username?: string;
3755
- profile?: string;
3756
- picture?: string;
3757
- website?: string;
3758
- email_verified?: boolean;
3759
- gender?: string;
3760
- birthdate?: string;
3761
- zoneinfo?: string;
3762
- locale?: string;
3763
- phone_number?: string;
3764
- phone_number_verified?: boolean;
3765
- address?: {
3766
- formatted?: string;
3767
- street_address?: string;
3768
- locality?: string;
3769
- region?: string;
3770
- postal_code?: string;
3771
- country?: string;
3772
- };
3773
- updated_at?: number;
3774
- [key: string]: unknown;
3775
- }
3776
- //#endregion
3777
- //#region src/server-auth/descriptors/$auth.d.ts
3778
- type AuthDescriptorOptions = {
3779
- /**
3780
- * Name of the identity provider.
3781
- * If not provided, it will be derived from the property key.
3782
- */
3783
- name?: string;
3784
- /**
3785
- * If true, auth provider will be skipped.
3786
- */
3787
- disabled?: boolean;
3788
- } & (AuthExternal | AuthInternal);
3789
- /**
3790
- * When you let an external service handle authentication. (e.g. Keycloak, Auth0, etc.)
3791
- */
3792
- type AuthExternal = {
3793
- /**
3794
- * Only OIDC is supported for external authentication.
3795
- */
3796
- oidc: OidcOptions;
3797
- /**
3798
- * For anonymous access, this will expect a service account access token.
3799
- *
3800
- * ```ts
3801
- * class App {
3802
- * anonymous = $serviceAccount(...);
3803
- * auth = $auth({
3804
- * // ... config ...
3805
- * fallback: this.anonymous,
3806
- * })
3807
- * }
3808
- * ```
3809
- */
3810
- fallback?: () => Async<AccessToken>;
3811
- };
3812
- /**
3813
- * When using your own authentication system, e.g. using a database to store user accounts.
3814
- * This is usually used with a custom login form.
3815
- *
3816
- * This relies on the `realm`, which is used to create/verify the access token.
3817
- */
3818
- type AuthInternal = {
3819
- realm: RealmDescriptor;
3820
- } & ({
3821
- /**
3822
- * The common username/password authentication.
3823
- *
3824
- * - It uses the OAuth2 Client Credentials flow to obtain an access token.
3825
- *
3826
- * This is usually used with a custom login form on your website or mobile app.
3827
- */
3828
- credentials: CredentialsOptions;
3829
- } | {
3830
- /**
3831
- * OAuth2 authentication. Delegates authentication to an OAuth2 provider. (e.g. Google, GitHub, etc.)
3832
- *
3833
- * - It uses the OAuth2 Authorization Code flow to obtain an access token and user information.
3834
- *
3835
- * This is usually used with a login button that redirects to the OAuth2 provider.
3836
- */
3837
- oauth: OAuth2Options;
3838
- } | {
3839
- /**
3840
- * Like OAuth2, but uses OIDC (OpenID Connect) for authentication and user information retrieval.
3841
- * OIDC is an identity layer on top of OAuth2, providing user authentication and profile information.
3842
- *
3843
- * - It uses the OAuth2 Authorization Code flow to obtain an access token and user information.
3844
- * - PCKE (Proof Key for Code Exchange) is recommended for security.
3845
- *
3846
- * This is usually used with a login button that redirects to the OIDC provider.
3847
- */
3848
- oidc: OidcOptions;
3849
- });
3850
- type CredentialsOptions = {
3851
- account: CredentialsFn;
3852
- };
3853
- type CredentialsFn = (credentials: Credentials) => Async<UserAccount | undefined>;
3854
- interface Credentials {
3855
- username: string;
3856
- password: string;
3857
- }
3858
- interface OidcOptions {
3859
- /**
3860
- * URL of the OIDC issuer.
3861
- */
3862
- issuer: string;
3863
- /**
3864
- * Client ID for the OIDC client.
3865
- */
3866
- clientId: string;
3867
- /**
3868
- * Client secret for the OIDC client.
3869
- * Optional if PKCE (Proof Key for Code Exchange) is used.
3870
- */
3871
- clientSecret?: string;
3872
- /**
3873
- * Redirect URI for the OIDC client.
3874
- * This is where the user will be redirected after authentication.
3875
- */
3876
- redirectUri?: string;
3877
- /**
3878
- * For external auth providers only.
3879
- * Take the ID token instead of the access token for validation.
3880
- */
3881
- useIdToken?: boolean;
3882
- /**
3883
- * URI to redirect the user after logout.
3884
- */
3885
- logoutUri?: string;
3886
- /**
3887
- * Optional scope for the OIDC client.
3888
- * @default "openid profile email".
3889
- */
3890
- scope?: string;
3891
- account?: LinkAccountFn;
3892
- }
3893
- interface LinkAccountOptions {
3894
- access_token: string;
3895
- user: OAuth2Profile;
3896
- id_token?: string;
3897
- expires_in?: number;
3898
- scope?: string;
3899
- }
3900
- type LinkAccountFn = (tokens: LinkAccountOptions) => Async<UserAccount>;
3901
- interface OAuth2Options {
3902
- /**
3903
- * URL of the OAuth2 authorization endpoint.
3904
- */
3905
- clientId: string;
3906
- /**
3907
- * Client secret for the OAuth2 client.
3908
- */
3909
- clientSecret: string;
3910
- /**
3911
- * URL of the OAuth2 authorization endpoint.
3912
- */
3913
- authorization: string;
3914
- /**
3915
- * URL of the OAuth2 token endpoint.
3916
- */
3917
- token: string;
3918
- /**
3919
- * Function to retrieve user profile information from the OAuth2 tokens.
3920
- */
3921
- userinfo: (tokens: Tokens) => Async<OAuth2Profile>;
3922
- account?: LinkAccountFn;
3923
- /**
3924
- * URL of the OAuth2 authorization endpoint.
3925
- */
3926
- redirectUri?: string;
3927
- /**
3928
- * URL of the OAuth2 authorization endpoint.
3929
- */
3930
- scope?: string;
3931
- }
3932
- declare class AuthDescriptor extends Descriptor<AuthDescriptorOptions> {
3933
- protected readonly securityProvider: SecurityProvider;
3934
- protected readonly dateTimeProvider: DateTimeProvider;
3935
- oauth?: Configuration;
3936
- get name(): string;
3937
- get jwks_uri(): string;
3938
- get scope(): string | undefined;
3939
- get redirect_uri(): string | undefined;
3940
- /**
3941
- * Refreshes the access token using the refresh token.
3942
- * Can be used on oauth2, oidc or credentials auth providers.
3943
- */
3944
- refresh(refreshToken: string, accessToken?: string): Promise<AccessTokenResponse>;
3945
- /**
3946
- * Extracts user information from the access token.
3947
- * This is used to create a user account from the access token.
3948
- */
3949
- user(tokens: Tokens): Promise<UserAccount>;
3950
- protected getUserFromIdToken(idToken: string): OAuth2Profile;
3951
- prepare(): Promise<void>;
3952
- }
3953
- type AccessToken = string | {
3954
- token: () => Async<string>;
3955
- };
3956
- interface WithLinkFn {
3957
- link?: (name: string) => (opts: LinkAccountOptions) => Async<UserAccount>;
3958
- }
3959
- interface WithLoginFn {
3960
- login?: (provider: string) => (creds: Credentials) => Async<UserAccount | undefined>;
3961
- }
3962
- //#endregion
3963
- //#region src/server-auth/index.d.ts
3964
- declare module "alepha" {
3965
- interface State {
3966
- /**
3967
- * The authenticated user account attached to the server request state.
3968
- *
3969
- * @internal
3970
- */
3971
- "alepha.server.request.user"?: UserAccount;
3972
- }
3973
- }
3974
- /**
3975
- * Allow authentication services for server applications.
3976
- * It provides login and logout functionalities.
3977
- *
3978
- * There are multiple authentication providers available (e.g., Google, GitHub).
3979
- * You can also delegate authentication to your own OIDC/OAuth2, for example using Keycloak or Auth0.
3980
- *
3981
- * It's cookie-based and SSR friendly.
3982
- *
3983
- * @see {@link $auth}
3984
- * @see {@link ServerAuthProvider}
3985
- * @module alepha.server.auth
3986
- */
3987
- //#endregion
3988
2591
  //#region src/api-users/controllers/UserRealmController.d.ts
3989
2592
  /**
3990
2593
  * Controller for exposing realm configuration.
@@ -3999,7 +2602,7 @@ declare class UserRealmController {
3999
2602
  * Get realm configuration settings.
4000
2603
  * This endpoint is not exposed in the API documentation.
4001
2604
  */
4002
- readonly getRealmConfig: alepha_server0.ActionDescriptorFn<{
2605
+ readonly getRealmConfig: alepha_server0.ActionPrimitiveFn<{
4003
2606
  query: alepha23.TObject<{
4004
2607
  userRealmName: alepha23.TOptional<alepha23.TString>;
4005
2608
  }>;
@@ -4032,7 +2635,7 @@ declare class UserRealmController {
4032
2635
  }>>;
4033
2636
  }>;
4034
2637
  }>;
4035
- readonly checkUsernameAvailability: alepha_server0.ActionDescriptorFn<{
2638
+ readonly checkUsernameAvailability: alepha_server0.ActionPrimitiveFn<{
4036
2639
  query: alepha23.TObject<{
4037
2640
  userRealmName: alepha23.TOptional<alepha23.TString>;
4038
2641
  }>;
@@ -4045,8 +2648,8 @@ declare class UserRealmController {
4045
2648
  }>;
4046
2649
  }
4047
2650
  //#endregion
4048
- //#region src/api-users/descriptors/$userRealm.d.ts
4049
- type UserRealmDescriptor = RealmDescriptor & WithLinkFn & WithLoginFn;
2651
+ //#region src/api-users/primitives/$userRealm.d.ts
2652
+ type UserRealmPrimitive = RealmPrimitive & WithLinkFn & WithLoginFn;
4050
2653
  /**
4051
2654
  * Already configured realm for user management.
4052
2655
  *
@@ -4060,7 +2663,7 @@ type UserRealmDescriptor = RealmDescriptor & WithLinkFn & WithLoginFn;
4060
2663
  * Environment Variables:
4061
2664
  * - `APP_SECRET`: Secret key for signing tokens (if not provided in options).
4062
2665
  */
4063
- declare const $userRealm: (options?: UserRealmOptions) => UserRealmDescriptor;
2666
+ declare const $userRealm: (options?: UserRealmOptions) => UserRealmPrimitive;
4064
2667
  interface UserRealmOptions {
4065
2668
  /**
4066
2669
  * Secret key for signing tokens.
@@ -4073,7 +2676,7 @@ interface UserRealmOptions {
4073
2676
  *
4074
2677
  * It's already pre-configured for user management with admin and user roles.
4075
2678
  */
4076
- realm?: Partial<RealmDescriptorOptions>;
2679
+ realm?: Partial<RealmPrimitiveOptions>;
4077
2680
  /**
4078
2681
  * Override entities.
4079
2682
  */
@@ -4201,386 +2804,6 @@ declare const userResourceSchema: alepha23.TObject<{
4201
2804
  }>;
4202
2805
  type UserResource = Static<typeof userResourceSchema>;
4203
2806
  //#endregion
4204
- //#region src/api-files/entities/files.d.ts
4205
- declare const files: alepha_orm204.EntityDescriptor<alepha23.TObject<{
4206
- id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
4207
- version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
4208
- createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
4209
- updatedAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_UPDATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
4210
- blobId: alepha23.TString;
4211
- creator: alepha23.TOptional<alepha23.TString>;
4212
- creatorRealm: alepha23.TOptional<alepha23.TString>;
4213
- creatorName: alepha23.TOptional<alepha23.TString>;
4214
- bucket: alepha23.TString;
4215
- expirationDate: alepha23.TOptional<alepha23.TString>;
4216
- name: alepha23.TString;
4217
- size: alepha23.TNumber;
4218
- mimeType: alepha23.TString;
4219
- tags: alepha23.TOptional<alepha23.TArray<alepha23.TString>>;
4220
- checksum: alepha23.TOptional<alepha23.TString>;
4221
- }>>;
4222
- type FileEntity = Static<typeof files.schema>;
4223
- //#endregion
4224
- //#region src/api-files/schemas/fileQuerySchema.d.ts
4225
- declare const fileQuerySchema: alepha23.TObject<{
4226
- page: alepha23.TOptional<alepha23.TInteger>;
4227
- size: alepha23.TOptional<alepha23.TInteger>;
4228
- sort: alepha23.TOptional<alepha23.TString>;
4229
- bucket: alepha23.TOptional<alepha23.TString>;
4230
- tags: alepha23.TOptional<alepha23.TArray<alepha23.TString>>;
4231
- name: alepha23.TOptional<alepha23.TString>;
4232
- mimeType: alepha23.TOptional<alepha23.TString>;
4233
- creator: alepha23.TOptional<alepha23.TString>;
4234
- createdAfter: alepha23.TOptional<alepha23.TString>;
4235
- createdBefore: alepha23.TOptional<alepha23.TString>;
4236
- }>;
4237
- type FileQuery = Static<typeof fileQuerySchema>;
4238
- //#endregion
4239
- //#region src/api-files/schemas/fileResourceSchema.d.ts
4240
- declare const fileResourceSchema: alepha23.TObject<{
4241
- id: PgAttr<PgAttr<alepha23.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
4242
- version: PgAttr<PgAttr<alepha23.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
4243
- createdAt: PgAttr<PgAttr<alepha23.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
4244
- updatedAt: PgAttr<PgAttr<alepha23.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
4245
- blobId: alepha23.TString;
4246
- creator: alepha23.TOptional<alepha23.TString>;
4247
- creatorRealm: alepha23.TOptional<alepha23.TString>;
4248
- creatorName: alepha23.TOptional<alepha23.TString>;
4249
- bucket: alepha23.TString;
4250
- expirationDate: alepha23.TOptional<alepha23.TString>;
4251
- name: alepha23.TString;
4252
- size: alepha23.TNumber;
4253
- mimeType: alepha23.TString;
4254
- tags: alepha23.TOptional<alepha23.TArray<alepha23.TString>>;
4255
- checksum: alepha23.TOptional<alepha23.TString>;
4256
- }>;
4257
- type FileResource = Static<typeof fileResourceSchema>;
4258
- //#endregion
4259
- //#region src/api-files/schemas/storageStatsSchema.d.ts
4260
- declare const storageStatsSchema: alepha23.TObject<{
4261
- totalSize: alepha23.TNumber;
4262
- totalFiles: alepha23.TNumber;
4263
- byBucket: alepha23.TArray<alepha23.TObject<{
4264
- bucket: alepha23.TString;
4265
- totalSize: alepha23.TNumber;
4266
- fileCount: alepha23.TNumber;
4267
- }>>;
4268
- byMimeType: alepha23.TArray<alepha23.TObject<{
4269
- mimeType: alepha23.TString;
4270
- fileCount: alepha23.TNumber;
4271
- }>>;
4272
- }>;
4273
- type StorageStats = Static<typeof storageStatsSchema>;
4274
- //#endregion
4275
- //#region src/api-files/services/FileService.d.ts
4276
- declare class FileService {
4277
- protected readonly alepha: Alepha;
4278
- protected readonly log: alepha_logger1.Logger;
4279
- protected readonly fileRepository: alepha_orm204.Repository<alepha23.TObject<{
4280
- id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
4281
- version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
4282
- createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
4283
- updatedAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_UPDATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
4284
- blobId: alepha23.TString;
4285
- creator: alepha23.TOptional<alepha23.TString>;
4286
- creatorRealm: alepha23.TOptional<alepha23.TString>;
4287
- creatorName: alepha23.TOptional<alepha23.TString>;
4288
- bucket: alepha23.TString;
4289
- expirationDate: alepha23.TOptional<alepha23.TString>;
4290
- name: alepha23.TString;
4291
- size: alepha23.TNumber;
4292
- mimeType: alepha23.TString;
4293
- tags: alepha23.TOptional<alepha23.TArray<alepha23.TString>>;
4294
- checksum: alepha23.TOptional<alepha23.TString>;
4295
- }>>;
4296
- protected readonly dateTimeProvider: DateTimeProvider;
4297
- protected readonly defaultBucket: BucketDescriptor;
4298
- protected onUploadFile: alepha23.HookDescriptor<"bucket:file:uploaded">;
4299
- protected onDeleteBucketFile: alepha23.HookDescriptor<"bucket:file:deleted">;
4300
- /**
4301
- * Calculates SHA-256 checksum of a file.
4302
- *
4303
- * @param file - The file to calculate checksum for
4304
- * @returns Hexadecimal string representation of the SHA-256 hash
4305
- * @protected
4306
- */
4307
- protected calculateChecksum(file: FileLike): Promise<string>;
4308
- /**
4309
- * Gets a bucket descriptor by name.
4310
- *
4311
- * @param bucketName - The name of the bucket to retrieve (defaults to "default")
4312
- * @returns The bucket descriptor
4313
- * @throws {NotFoundError} If the bucket is not found
4314
- */
4315
- bucket(bucketName?: string): BucketDescriptor;
4316
- /**
4317
- * Finds files matching the given query criteria with pagination support.
4318
- * Supports filtering by bucket, tags, name, mimeType, creator, and date range.
4319
- *
4320
- * @param q - Query parameters including bucket, tags, name, mimeType, creator, date range, pagination, and sorting
4321
- * @returns Paginated list of file entities
4322
- */
4323
- findFiles(q?: FileQuery): Promise<Page$1<FileEntity>>;
4324
- /**
4325
- * Finds files that have expired based on their expiration date.
4326
- * Limited to 1000 files per call to prevent memory issues.
4327
- *
4328
- * @returns Array of expired file entities
4329
- */
4330
- findExpiredFiles(): Promise<FileEntity[]>;
4331
- /**
4332
- * Calculates an expiration date based on a TTL (time to live) duration.
4333
- *
4334
- * @param ttl - Duration like "1 day", "2 hours", etc.
4335
- * @returns DateTime representation of the expiration date, or undefined if no TTL provided
4336
- * @protected
4337
- */
4338
- protected getExpirationDate(ttl?: DurationLike): string | undefined;
4339
- /**
4340
- * Uploads a file to a bucket and creates a database record with metadata.
4341
- * Automatically calculates and stores the file checksum (SHA-256).
4342
- *
4343
- * @param file - The file to upload
4344
- * @param options - Upload options including bucket, expiration, user, and tags
4345
- * @param options.bucket - Target bucket name (defaults to "default")
4346
- * @param options.expirationDate - When the file should expire
4347
- * @param options.user - User performing the upload (for audit trail)
4348
- * @param options.tags - Tags to associate with the file
4349
- * @returns The created file entity with all metadata
4350
- * @throws {NotFoundError} If the specified bucket doesn't exist
4351
- */
4352
- uploadFile(file: FileLike, options?: {
4353
- expirationDate?: string | DateTime;
4354
- bucket?: string;
4355
- user?: UserAccountToken;
4356
- tags?: string[];
4357
- }): Promise<FileEntity>;
4358
- /**
4359
- * Streams a file from storage by its database ID.
4360
- *
4361
- * @param id - The database ID (UUID) of the file to stream
4362
- * @returns The file object ready for streaming/downloading
4363
- * @throws {NotFoundError} If the file doesn't exist in the database
4364
- * @throws {FileNotFoundError} If the file exists in database but not in storage
4365
- */
4366
- streamFile(id: string): Promise<FileLike>;
4367
- /**
4368
- * Updates file metadata (name, tags, expiration date).
4369
- * Does not modify the actual file content in storage.
4370
- *
4371
- * @param id - The database ID (UUID) of the file to update
4372
- * @param data - Partial file data to update
4373
- * @param data.name - New file name
4374
- * @param data.tags - New tags array
4375
- * @param data.expirationDate - New expiration date
4376
- * @returns The updated file entity
4377
- * @throws {NotFoundError} If the file doesn't exist in the database
4378
- */
4379
- updateFile(id: string, data: {
4380
- name?: string;
4381
- tags?: string[];
4382
- expirationDate?: DateTime | string;
4383
- }): Promise<FileEntity>;
4384
- /**
4385
- * Deletes a file from both storage and database.
4386
- * Handles cases where file is already deleted from storage gracefully.
4387
- * Always ensures database record is removed even if storage deletion fails.
4388
- *
4389
- * @param id - The database ID (UUID) of the file to delete
4390
- * @returns Success response with the deleted file ID
4391
- * @throws {NotFoundError} If the file doesn't exist in the database
4392
- */
4393
- deleteFile(id: string): Promise<Ok>;
4394
- /**
4395
- * Retrieves a file entity by its ID.
4396
- * If already an entity object, returns it as-is (convenience method).
4397
- *
4398
- * @param id - Either a UUID string or an existing FileEntity object
4399
- * @returns The file entity
4400
- * @throws {NotFoundError} If the file doesn't exist in the database
4401
- */
4402
- getFileById(id: string | FileEntity): Promise<FileEntity>;
4403
- /**
4404
- * Gets storage statistics including total size, file count, and breakdowns by bucket and MIME type.
4405
- *
4406
- * @returns Storage statistics with aggregated data
4407
- */
4408
- getStorageStats(): Promise<StorageStats>;
4409
- /**
4410
- * Converts a file entity to a file resource (API response format).
4411
- * Currently a pass-through, but allows for future transformation logic.
4412
- *
4413
- * @param entity - The file entity to convert
4414
- * @returns The file resource for API responses
4415
- */
4416
- entityToResource(entity: FileEntity): FileResource;
4417
- }
4418
- //#endregion
4419
- //#region src/api-files/controllers/FileController.d.ts
4420
- /**
4421
- * REST API controller for file management operations.
4422
- * Provides endpoints for uploading, downloading, listing, and deleting files.
4423
- */
4424
- declare class FileController {
4425
- protected readonly url = "/files";
4426
- protected readonly group = "files";
4427
- protected readonly fileService: FileService;
4428
- /**
4429
- * GET /files - Lists files with optional filtering and pagination.
4430
- * Supports filtering by bucket and tags.
4431
- */
4432
- readonly findFiles: alepha_server0.ActionDescriptorFn<{
4433
- query: alepha23.TObject<{
4434
- page: alepha23.TOptional<alepha23.TInteger>;
4435
- size: alepha23.TOptional<alepha23.TInteger>;
4436
- sort: alepha23.TOptional<alepha23.TString>;
4437
- bucket: alepha23.TOptional<alepha23.TString>;
4438
- tags: alepha23.TOptional<alepha23.TArray<alepha23.TString>>;
4439
- name: alepha23.TOptional<alepha23.TString>;
4440
- mimeType: alepha23.TOptional<alepha23.TString>;
4441
- creator: alepha23.TOptional<alepha23.TString>;
4442
- createdAfter: alepha23.TOptional<alepha23.TString>;
4443
- createdBefore: alepha23.TOptional<alepha23.TString>;
4444
- }>;
4445
- response: alepha23.TPage<alepha23.TObject<{
4446
- id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
4447
- version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
4448
- createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
4449
- updatedAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_UPDATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
4450
- blobId: alepha23.TString;
4451
- creator: alepha23.TOptional<alepha23.TString>;
4452
- creatorRealm: alepha23.TOptional<alepha23.TString>;
4453
- creatorName: alepha23.TOptional<alepha23.TString>;
4454
- bucket: alepha23.TString;
4455
- expirationDate: alepha23.TOptional<alepha23.TString>;
4456
- name: alepha23.TString;
4457
- size: alepha23.TNumber;
4458
- mimeType: alepha23.TString;
4459
- tags: alepha23.TOptional<alepha23.TArray<alepha23.TString>>;
4460
- checksum: alepha23.TOptional<alepha23.TString>;
4461
- }>>;
4462
- }>;
4463
- /**
4464
- * DELETE /files/:id - Deletes a file from both storage and database.
4465
- * Removes the file from the bucket and cleans up the database record.
4466
- */
4467
- readonly deleteFile: alepha_server0.ActionDescriptorFn<{
4468
- params: alepha23.TObject<{
4469
- id: alepha23.TString;
4470
- }>;
4471
- response: alepha23.TObject<{
4472
- ok: alepha23.TBoolean;
4473
- id: alepha23.TOptional<alepha23.TUnion<[alepha23.TString, alepha23.TInteger]>>;
4474
- count: alepha23.TOptional<alepha23.TNumber>;
4475
- }>;
4476
- }>;
4477
- /**
4478
- * POST /files - Uploads a new file to storage.
4479
- * Creates a database record with metadata and calculates checksum.
4480
- * Optionally specify bucket and expiration date.
4481
- */
4482
- readonly uploadFile: alepha_server0.ActionDescriptorFn<{
4483
- body: alepha23.TObject<{
4484
- file: alepha23.TFile;
4485
- }>;
4486
- query: alepha23.TObject<{
4487
- expirationDate: alepha23.TOptional<alepha23.TString>;
4488
- bucket: alepha23.TOptional<alepha23.TString>;
4489
- }>;
4490
- response: alepha23.TObject<{
4491
- id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
4492
- version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
4493
- createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
4494
- updatedAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_UPDATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
4495
- blobId: alepha23.TString;
4496
- creator: alepha23.TOptional<alepha23.TString>;
4497
- creatorRealm: alepha23.TOptional<alepha23.TString>;
4498
- creatorName: alepha23.TOptional<alepha23.TString>;
4499
- bucket: alepha23.TString;
4500
- expirationDate: alepha23.TOptional<alepha23.TString>;
4501
- name: alepha23.TString;
4502
- size: alepha23.TNumber;
4503
- mimeType: alepha23.TString;
4504
- tags: alepha23.TOptional<alepha23.TArray<alepha23.TString>>;
4505
- checksum: alepha23.TOptional<alepha23.TString>;
4506
- }>;
4507
- }>;
4508
- /**
4509
- * PATCH /files/:id - Updates file metadata.
4510
- * Allows updating name, tags, and expiration date without modifying file content.
4511
- */
4512
- readonly updateFile: alepha_server0.ActionDescriptorFn<{
4513
- params: alepha23.TObject<{
4514
- id: alepha23.TString;
4515
- }>;
4516
- body: alepha23.TObject<{
4517
- name: alepha23.TOptional<alepha23.TString>;
4518
- tags: alepha23.TOptional<alepha23.TArray<alepha23.TString>>;
4519
- expirationDate: alepha23.TOptional<alepha23.TString>;
4520
- }>;
4521
- response: alepha23.TObject<{
4522
- id: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_PRIMARY_KEY>, typeof alepha_orm204.PG_DEFAULT>;
4523
- version: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TInteger, typeof alepha_orm204.PG_VERSION>, typeof alepha_orm204.PG_DEFAULT>;
4524
- createdAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_CREATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
4525
- updatedAt: alepha_orm204.PgAttr<alepha_orm204.PgAttr<alepha23.TString, typeof alepha_orm204.PG_UPDATED_AT>, typeof alepha_orm204.PG_DEFAULT>;
4526
- blobId: alepha23.TString;
4527
- creator: alepha23.TOptional<alepha23.TString>;
4528
- creatorRealm: alepha23.TOptional<alepha23.TString>;
4529
- creatorName: alepha23.TOptional<alepha23.TString>;
4530
- bucket: alepha23.TString;
4531
- expirationDate: alepha23.TOptional<alepha23.TString>;
4532
- name: alepha23.TString;
4533
- size: alepha23.TNumber;
4534
- mimeType: alepha23.TString;
4535
- tags: alepha23.TOptional<alepha23.TArray<alepha23.TString>>;
4536
- checksum: alepha23.TOptional<alepha23.TString>;
4537
- }>;
4538
- }>;
4539
- /**
4540
- * GET /files/:id - Streams/downloads a file by its ID.
4541
- * Returns the file content with appropriate Content-Type header.
4542
- * Cached with ETag support for 1 year (immutable).
4543
- */
4544
- readonly streamFile: alepha_server0.ActionDescriptorFn<{
4545
- params: alepha23.TObject<{
4546
- id: alepha23.TString;
4547
- }>;
4548
- response: alepha23.TFile;
4549
- }>;
4550
- }
4551
- //#endregion
4552
- //#region src/api-files/index.d.ts
4553
- declare module "alepha/bucket" {
4554
- interface BucketFileOptions {
4555
- /**
4556
- * Time to live for the files in the bucket.
4557
- */
4558
- ttl?: DurationLike;
4559
- /**
4560
- * Tags for the bucket.
4561
- */
4562
- tags?: string[];
4563
- /**
4564
- * User performing the operation.
4565
- */
4566
- user?: UserAccountToken;
4567
- /**
4568
- * Whether to persist the file metadata in the database.
4569
- *
4570
- * @default true
4571
- */
4572
- persist?: boolean;
4573
- }
4574
- }
4575
- /**
4576
- * Provides file management API endpoints for Alepha applications.
4577
- *
4578
- * This module includes file upload, download, storage management,
4579
- * and file metadata operations.
4580
- *
4581
- * @module alepha.api.files
4582
- */
4583
- //#endregion
4584
2807
  //#region src/api-users/services/SessionService.d.ts
4585
2808
  declare class SessionService {
4586
2809
  protected readonly alepha: Alepha;
@@ -4589,7 +2812,7 @@ declare class SessionService {
4589
2812
  protected readonly cryptoProvider: CryptoProvider;
4590
2813
  protected readonly log: alepha_logger1.Logger;
4591
2814
  protected readonly userRealmProvider: UserRealmProvider;
4592
- protected readonly fileController: HttpVirtualClient<FileController>;
2815
+ protected readonly fileController: alepha_server_links0.HttpVirtualClient<FileController>;
4593
2816
  users(userRealmName?: string): Repository$1<alepha23.TObject<{
4594
2817
  id: PgAttr<PgAttr<alepha23.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
4595
2818
  version: PgAttr<PgAttr<alepha23.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
@@ -4739,5 +2962,5 @@ declare class SessionService {
4739
2962
  */
4740
2963
  declare const AlephaApiUsers: alepha23.Service<alepha23.Module>;
4741
2964
  //#endregion
4742
- export { $userRealm, AlephaApiUsers, CompletePasswordResetRequest, CompleteRegistrationRequest, CreateUser, CredentialService, DEFAULT_USER_REALM_NAME, IdentityController, IdentityEntity, IdentityQuery, IdentityResource, IdentityService, LoginInput, PasswordResetIntentResponse, RealmAuthSettings, RegisterInput, RegistrationIntentResponse, RegistrationService, ResetPasswordInput, ResetPasswordRequest, SessionController, SessionCrudService, SessionEntity, SessionQuery, SessionResource, SessionService, UpdateUser, UserController, UserEntity, UserQuery, UserRealm, UserRealmConfig, UserRealmController, UserRealmDescriptor, UserRealmOptions, UserRealmProvider, UserRealmRepositories, UserResource, UserService, completePasswordResetRequestSchema, completeRegistrationRequestSchema, createUserSchema, identities, identityQuerySchema, identityResourceSchema, loginSchema, passwordResetIntentResponseSchema, realmAuthSettingsAtom, registerSchema, registrationIntentResponseSchema, resetPasswordRequestSchema, resetPasswordSchema, sessionQuerySchema, sessionResourceSchema, sessions, updateUserSchema, userQuerySchema, userRealmConfigSchema, userResourceSchema, users };
2965
+ export { $userRealm, AlephaApiUsers, CompletePasswordResetRequest, CompleteRegistrationRequest, CreateUser, CredentialService, DEFAULT_USER_REALM_NAME, IdentityController, IdentityEntity, IdentityQuery, IdentityResource, IdentityService, LoginInput, PasswordResetIntentResponse, RealmAuthSettings, RegisterInput, RegistrationIntentResponse, RegistrationService, ResetPasswordInput, ResetPasswordRequest, SessionController, SessionCrudService, SessionEntity, SessionQuery, SessionResource, SessionService, UpdateUser, UserController, UserEntity, UserQuery, UserRealm, UserRealmConfig, UserRealmController, UserRealmOptions, UserRealmPrimitive, UserRealmProvider, UserRealmRepositories, UserResource, UserService, completePasswordResetRequestSchema, completeRegistrationRequestSchema, createUserSchema, identities, identityQuerySchema, identityResourceSchema, loginSchema, passwordResetIntentResponseSchema, realmAuthSettingsAtom, registerSchema, registrationIntentResponseSchema, resetPasswordRequestSchema, resetPasswordSchema, sessionQuerySchema, sessionResourceSchema, sessions, updateUserSchema, userQuerySchema, userRealmConfigSchema, userResourceSchema, users };
4743
2966
  //# sourceMappingURL=index.d.ts.map