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,616 +1,106 @@
1
- import * as alepha254 from "alepha";
2
- import { Alepha, Async, Descriptor, KIND, Static, TSchema } from "alepha";
3
- import * as alepha_server6 from "alepha/server";
4
- import { ActionDescriptor, ClientRequestEntry, ClientRequestOptions, ClientRequestResponse, FetchOptions, FetchResponse, HttpClient, RequestConfigSchema, ServerHandler, ServerRequest, ServerRequestConfigEntry, ServerResponseBody, ServerRouterProvider, ServerTimingProvider } from "alepha/server";
5
- import { DateTimeProvider, DurationLike } from "alepha/datetime";
1
+ import * as alepha198 from "alepha";
2
+ import { Alepha, Async, KIND, Primitive, Static } from "alepha";
3
+ import * as alepha_server_cookies0 from "alepha/server/cookies";
4
+ import { Cookies, ServerCookiesProvider } from "alepha/server/cookies";
5
+ import { DateTimeProvider } from "alepha/datetime";
6
+ import { AccessTokenResponse, RealmPrimitive, SecurityProvider, UserAccount } from "alepha/security";
6
7
  import * as alepha_logger0 from "alepha/logger";
7
- import { AccessTokenResponse, JwtProvider, RealmDescriptor, SecurityProvider, ServiceAccountDescriptor, UserAccount, UserAccountToken } from "alepha/security";
8
- import * as alepha_retry0 from "alepha/retry";
8
+ import * as alepha_server0 from "alepha/server";
9
+ import { ServerLinksProvider } from "alepha/server/links";
9
10
  import { Configuration } from "openid-client";
10
11
 
11
- //#region src/server-cookies/services/CookieParser.d.ts
12
- declare class CookieParser {
13
- parseRequestCookies(header: string): Record<string, string>;
14
- serializeResponseCookies(cookies: Record<string, Cookie | null>, isHttps: boolean): string[];
15
- cookieToString(name: string, cookie: Cookie, isHttps?: boolean): string;
16
- }
17
- //#endregion
18
- //#region src/server-cookies/providers/ServerCookiesProvider.d.ts
19
- declare class ServerCookiesProvider {
20
- protected readonly alepha: Alepha;
21
- protected readonly log: alepha_logger0.Logger;
22
- protected readonly cookieParser: CookieParser;
23
- protected readonly dateTimeProvider: DateTimeProvider;
24
- protected readonly env: {
25
- APP_SECRET: string;
26
- };
27
- protected readonly ALGORITHM = "aes-256-gcm";
28
- protected readonly IV_LENGTH = 16;
29
- protected readonly AUTH_TAG_LENGTH = 16;
30
- protected readonly SIGNATURE_LENGTH = 32;
31
- readonly onRequest: alepha254.HookDescriptor<"server:onRequest">;
32
- readonly onAction: alepha254.HookDescriptor<"action:onRequest">;
33
- readonly onSend: alepha254.HookDescriptor<"server:onSend">;
34
- protected getCookiesFromContext(cookies?: Cookies): Cookies;
35
- getCookie<T extends TSchema>(name: string, options: CookieDescriptorOptions<T>, contextCookies?: Cookies): Static<T> | undefined;
36
- setCookie<T extends TSchema>(name: string, options: CookieDescriptorOptions<T>, data: Static<T>, contextCookies?: Cookies): void;
37
- deleteCookie<T extends TSchema>(name: string, contextCookies?: Cookies): void;
38
- protected encrypt(text: string): string;
39
- protected decrypt(encryptedText: string): string;
40
- secretKey(): string;
41
- protected sign(data: string): string;
42
- }
43
- //#endregion
44
- //#region src/server-cookies/descriptors/$cookie.d.ts
45
- interface CookieDescriptorOptions<T extends TSchema> {
46
- /** The schema for the cookie's value, used for validation and type safety. */
47
- schema: T;
48
- /** The name of the cookie. */
49
- name?: string;
50
- /** The cookie's path. Defaults to "/". */
51
- path?: string;
52
- /** Time-to-live for the cookie. Maps to `Max-Age`. */
53
- ttl?: DurationLike;
54
- /** If true, the cookie is only sent over HTTPS. Defaults to true in production. */
55
- secure?: boolean;
56
- /** If true, the cookie cannot be accessed by client-side scripts. */
57
- httpOnly?: boolean;
58
- /** SameSite policy for the cookie. Defaults to "lax". */
59
- sameSite?: "strict" | "lax" | "none";
60
- /** The domain for the cookie. */
61
- domain?: string;
62
- /** If true, the cookie value will be compressed using zlib. */
63
- compress?: boolean;
64
- /** If true, the cookie value will be encrypted. Requires `COOKIE_SECRET` env var. */
65
- encrypt?: boolean;
66
- /** If true, the cookie will be signed to prevent tampering. Requires `COOKIE_SECRET` env var. */
67
- sign?: boolean;
68
- }
69
- interface AbstractCookieDescriptor<T extends TSchema> {
70
- readonly name: string;
71
- readonly options: CookieDescriptorOptions<T>;
72
- set(value: Static<T>, options?: {
73
- cookies?: Cookies;
74
- ttl?: DurationLike;
75
- }): void;
76
- get(options?: {
77
- cookies?: Cookies;
78
- }): Static<T> | undefined;
79
- del(options?: {
80
- cookies?: Cookies;
81
- }): void;
82
- }
83
- interface Cookies {
84
- req: Record<string, string>;
85
- res: Record<string, Cookie | null>;
86
- }
87
- interface Cookie {
88
- value: string;
89
- path?: string;
90
- maxAge?: number;
91
- secure?: boolean;
92
- httpOnly?: boolean;
93
- sameSite?: "strict" | "lax" | "none";
94
- domain?: string;
95
- }
96
- //#endregion
97
- //#region src/server-cookies/index.d.ts
98
- declare module "alepha/server" {
99
- interface ServerRequest {
100
- cookies: Cookies;
101
- }
102
- }
103
- /**
104
- * Provides HTTP cookie management capabilities for server requests and responses with type-safe cookie descriptors.
105
- *
106
- * The server-cookies module enables declarative cookie handling using the `$cookie` descriptor on class properties.
107
- * It offers automatic cookie parsing, secure cookie configuration, and seamless integration with server routes
108
- * for managing user sessions, preferences, and authentication tokens.
109
- *
110
- * @see {@link $cookie}
111
- * @module alepha.server.cookies
112
- */
113
- //#endregion
114
- //#region src/server-security/providers/ServerBasicAuthProvider.d.ts
115
- interface BasicAuthOptions {
116
- username: string;
117
- password: string;
118
- }
119
- //#endregion
120
- //#region src/server-security/providers/ServerSecurityProvider.d.ts
121
- type ServerRouteSecure = {
122
- realm?: string;
123
- basic?: BasicAuthOptions;
12
+ //#region src/server-auth/constants/routes.d.ts
13
+ declare const alephaServerAuthRoutes: {
14
+ login: string;
15
+ callback: string;
16
+ logout: string;
17
+ token: string;
18
+ refresh: string;
19
+ userinfo: string;
124
20
  };
125
21
  //#endregion
126
- //#region src/server-security/index.d.ts
127
- declare module "alepha" {
128
- interface State {
129
- /**
130
- * Real (or fake) user account, used for internal actions.
131
- *
132
- * If you define this, you assume that all actions are executed by this user by default.
133
- * > To force a different user, you need to pass it explicitly in the options.
134
- */
135
- "alepha.server.security.system.user"?: UserAccountToken;
136
- /**
137
- * The authenticated user account attached to the server request state.
138
- *
139
- * @internal
140
- */
141
- "alepha.server.request.user"?: UserAccount;
142
- }
143
- }
144
- declare module "alepha/server" {
145
- interface ServerRequest<TConfig> {
146
- user?: UserAccountToken;
147
- }
148
- interface ServerActionRequest<TConfig> {
149
- user: UserAccountToken;
150
- }
151
- interface ServerRoute {
152
- /**
153
- * If true, the route will be protected by the security provider.
154
- * All actions are secure by default, but you can disable it for specific actions.
155
- */
156
- secure?: boolean | ServerRouteSecure;
157
- }
158
- interface ClientRequestOptions extends FetchOptions {
159
- /**
160
- * Forward user from the previous request.
161
- * If "system", use system user. @see {ServerSecurityProvider.localSystemUser}
162
- * If "context", use the user from the current context (e.g. request).
163
- *
164
- * @default "system" if provided, else "context" if available.
165
- */
166
- user?: UserAccountToken | "system" | "context";
167
- }
168
- }
169
- /**
170
- * Plugin for Alepha Server that provides security features. Based on the Alepha Security module.
171
- *
172
- * By default, all $action will be guarded by a permission check.
173
- *
174
- * @see {@link ServerSecurityProvider}
175
- * @module alepha.server.security
176
- */
177
- //#endregion
178
- //#region src/server-links/schemas/apiLinksResponseSchema.d.ts
179
- declare const apiLinkSchema: alepha254.TObject<{
180
- name: alepha254.TString;
181
- group: alepha254.TOptional<alepha254.TString>;
182
- path: alepha254.TString;
183
- method: alepha254.TOptional<alepha254.TString>;
184
- requestBodyType: alepha254.TOptional<alepha254.TString>;
185
- service: alepha254.TOptional<alepha254.TString>;
186
- }>;
187
- declare const apiLinksResponseSchema: alepha254.TObject<{
188
- prefix: alepha254.TOptional<alepha254.TString>;
189
- links: alepha254.TArray<alepha254.TObject<{
190
- name: alepha254.TString;
191
- group: alepha254.TOptional<alepha254.TString>;
192
- path: alepha254.TString;
193
- method: alepha254.TOptional<alepha254.TString>;
194
- requestBodyType: alepha254.TOptional<alepha254.TString>;
195
- service: alepha254.TOptional<alepha254.TString>;
196
- }>>;
22
+ //#region src/server-auth/schemas/authenticationProviderSchema.d.ts
23
+ declare const authenticationProviderSchema: alepha198.TObject<{
24
+ name: alepha198.TString;
25
+ type: alepha198.TUnsafe<"OAUTH2" | "OIDC" | "CREDENTIALS">;
197
26
  }>;
198
- type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
199
- type ApiLink = Static<typeof apiLinkSchema>;
200
- //#endregion
201
- //#region src/server-links/providers/LinkProvider.d.ts
202
- /**
203
- * Browser, SSR friendly, service to handle links.
204
- */
205
- declare class LinkProvider {
206
- static path: {
207
- apiLinks: string;
208
- apiSchema: string;
209
- };
210
- protected readonly log: alepha_logger0.Logger;
211
- protected readonly alepha: Alepha;
212
- protected readonly httpClient: HttpClient;
213
- protected serverLinks: Array<HttpClientLink>;
214
- /**
215
- * Get applicative links registered on the server.
216
- * This does not include lazy-loaded remote links.
217
- */
218
- getServerLinks(): HttpClientLink[];
219
- /**
220
- * Register a new link for the application.
221
- */
222
- registerLink(link: HttpClientLink): void;
223
- get links(): HttpClientLink[];
224
- /**
225
- * Force browser to refresh links from the server.
226
- */
227
- fetchLinks(): Promise<HttpClientLink[]>;
228
- /**
229
- * Create a virtual client that can be used to call actions.
230
- *
231
- * Use js Proxy under the hood.
232
- */
233
- client<T extends object>(scope?: ClientScope): HttpVirtualClient<T>;
234
- /**
235
- * Check if a link with the given name exists.
236
- * @param name
237
- */
238
- can(name: string): boolean;
239
- /**
240
- * Resolve a link by its name and call it.
241
- * - If link is local, it will call the local handler.
242
- * - If link is remote, it will make a fetch request to the remote server.
243
- */
244
- follow(name: string, config?: Partial<ServerRequestConfigEntry>, options?: ClientRequestOptions & ClientScope): Promise<any>;
245
- protected createVirtualAction<T extends RequestConfigSchema>(name: string, scope?: ClientScope): VirtualAction<T>;
246
- protected followRemote(link: HttpClientLink, config?: Partial<ServerRequestConfigEntry>, options?: ClientRequestOptions): Promise<FetchResponse>;
247
- protected getLinkByName(name: string, options?: ClientScope): Promise<HttpClientLink>;
248
- }
249
- interface HttpClientLink extends ApiLink {
250
- secured?: boolean | ServerRouteSecure;
251
- prefix?: string;
252
- host?: string;
253
- service?: string;
254
- schema?: RequestConfigSchema;
255
- handler?: (request: ServerRequest, options: ClientRequestOptions) => Async<ServerResponseBody>;
256
- }
257
- interface ClientScope {
258
- group?: string;
259
- service?: string;
260
- hostname?: string;
261
- }
262
- type HttpVirtualClient<T> = { [K in keyof T as T[K] extends ActionDescriptor<RequestConfigSchema> ? K : never]: T[K] extends ActionDescriptor<infer Schema> ? VirtualAction<Schema> : never };
263
- interface VirtualAction<T extends RequestConfigSchema> extends Pick<ActionDescriptor<T>, "name" | "run" | "fetch"> {
264
- (config?: ClientRequestEntry<T>, opts?: ClientRequestOptions): Promise<ClientRequestResponse<T>>;
265
- can: () => boolean;
266
- }
267
- //#endregion
268
- //#region src/server-proxy/descriptors/$proxy.d.ts
269
- type ProxyDescriptorOptions = {
270
- /**
271
- * Path pattern to match for proxying requests.
272
- *
273
- * Supports wildcards and path parameters:
274
- * - `/api/*` - Matches all paths starting with `/api/`
275
- * - `/api/v1/*` - Matches all paths starting with `/api/v1/`
276
- * - `/users/:id` - Matches `/users/123`, `/users/abc`, etc.
277
- *
278
- * @example "/api/*"
279
- * @example "/secure/admin/*"
280
- * @example "/users/:id/posts"
281
- */
282
- path: string;
283
- /**
284
- * Target URL to which matching requests should be forwarded.
285
- *
286
- * Can be either:
287
- * - **Static string**: A fixed URL like `"https://api.example.com"`
288
- * - **Dynamic function**: A function that returns the URL, enabling runtime target resolution
289
- *
290
- * The target URL will be combined with the remaining path from the original request.
291
- *
292
- * @example "https://api.example.com"
293
- * @example () => process.env.API_URL || "http://localhost:3001"
294
- */
295
- target: string | (() => string);
296
- /**
297
- * Whether this proxy is disabled.
298
- *
299
- * When `true`, requests matching the path will not be proxied and will be handled
300
- * by other routes or return 404. Useful for feature toggles or conditional proxying.
301
- *
302
- * @default false
303
- * @example !process.env.ENABLE_PROXY
304
- */
305
- disabled?: boolean;
306
- /**
307
- * Hook called before forwarding the request to the target server.
308
- *
309
- * Use this to:
310
- * - Add authentication headers
311
- * - Modify request headers or body
312
- * - Add request tracking/logging
313
- * - Transform the request before forwarding
314
- *
315
- * @param request - The original incoming server request
316
- * @param proxyRequest - The request that will be sent to the target (modifiable)
317
- *
318
- * @example
319
- * ```ts
320
- * beforeRequest: async (request, proxyRequest) => {
321
- * proxyRequest.headers = {
322
- * ...proxyRequest.headers,
323
- * 'Authorization': `Bearer ${await getToken()}`,
324
- * 'X-Request-ID': generateRequestId()
325
- * };
326
- * }
327
- * ```
328
- */
329
- beforeRequest?: (request: ServerRequest, proxyRequest: RequestInit) => Async<void>;
330
- /**
331
- * Hook called after receiving the response from the target server.
332
- *
333
- * Use this to:
334
- * - Log response details for monitoring
335
- * - Add custom headers to the response
336
- * - Transform response data
337
- * - Handle error responses
338
- *
339
- * @param request - The original incoming server request
340
- * @param proxyResponse - The response received from the target server
341
- *
342
- * @example
343
- * ```ts
344
- * afterResponse: async (request, proxyResponse) => {
345
- * console.log(`Proxy ${request.method} ${request.url} -> ${proxyResponse.status}`);
346
- *
347
- * if (!proxyResponse.ok) {
348
- * await logError(`Proxy error: ${proxyResponse.status}`, { request, response: proxyResponse });
349
- * }
350
- * }
351
- * ```
352
- */
353
- afterResponse?: (request: ServerRequest, proxyResponse: Response) => Async<void>;
354
- /**
355
- * Function to rewrite the URL before sending to the target server.
356
- *
357
- * Use this to:
358
- * - Remove or add path prefixes
359
- * - Transform path parameters
360
- * - Modify query parameters
361
- * - Change the URL structure entirely
362
- *
363
- * The function receives a mutable URL object and should modify it in-place.
364
- *
365
- * @param url - The URL object to modify (mutable)
366
- *
367
- * @example
368
- * ```ts
369
- * // Remove /api prefix when forwarding
370
- * rewrite: (url) => {
371
- * url.pathname = url.pathname.replace('/api', '');
372
- * }
373
- * ```
374
- *
375
- * @example
376
- * ```ts
377
- * // Add version prefix
378
- * rewrite: (url) => {
379
- * url.pathname = `/v2${url.pathname}`;
380
- * }
381
- * ```
382
- */
383
- rewrite?: (url: URL) => void;
384
- };
385
- //#endregion
386
- //#region src/server-proxy/providers/ServerProxyProvider.d.ts
387
- declare class ServerProxyProvider {
388
- protected readonly log: alepha_logger0.Logger;
389
- protected readonly routerProvider: ServerRouterProvider;
390
- protected readonly alepha: Alepha;
391
- protected readonly configure: alepha254.HookDescriptor<"configure">;
392
- createProxy(options: ProxyDescriptorOptions): void;
393
- createProxyHandler(target: string, options: Omit<ProxyDescriptorOptions, "path">): ServerHandler;
394
- private getRawRequestBody;
395
- }
396
- //#endregion
397
- //#region src/server-links/descriptors/$remote.d.ts
398
- interface RemoteDescriptorOptions {
399
- /**
400
- * The URL of the remote service.
401
- * You can use a function to generate the URL dynamically.
402
- * You probably should use $env(env) to get the URL from the environment.
403
- *
404
- * @example
405
- * ```ts
406
- * import { $remote } from "alepha/server";
407
- * import { $inject, t } from "alepha";
408
- *
409
- * class App {
410
- * env = $env(t.object({
411
- * REMOTE_URL: t.text({default: "http://localhost:3000"}),
412
- * }));
413
- * remote = $remote({
414
- * url: this.env.REMOTE_URL,
415
- * });
416
- * }
417
- * ```
418
- */
419
- url: string | (() => string);
420
- /**
421
- * The name of the remote service.
422
- *
423
- * @default Member of the class containing the remote service.
424
- */
425
- name?: string;
426
- /**
427
- * If true, all methods of the remote service will be exposed as actions in this context.
428
- * > Note: Proxy will never use the service account, it just... proxies the request.
429
- */
430
- proxy?: boolean | Partial<ProxyDescriptorOptions & {
431
- /**
432
- * If true, the remote service won't be available internally, only through the proxy.
433
- */
434
- noInternal: boolean;
435
- }>;
436
- /**
437
- * For communication between the server and the remote service with a security layer.
438
- * This will be used for internal communication and will not be exposed to the client.
439
- */
440
- serviceAccount?: ServiceAccountDescriptor;
441
- }
442
- declare class RemoteDescriptor extends Descriptor<RemoteDescriptorOptions> {
443
- get name(): string;
444
- }
445
- //#endregion
446
- //#region src/server-links/providers/RemoteDescriptorProvider.d.ts
447
- declare class RemoteDescriptorProvider {
448
- protected readonly env: {
449
- SERVER_API_PREFIX: string;
450
- };
451
- protected readonly alepha: Alepha;
452
- protected readonly proxyProvider: ServerProxyProvider;
453
- protected readonly linkProvider: LinkProvider;
454
- protected readonly remotes: Array<ServerRemote>;
455
- protected readonly log: alepha_logger0.Logger;
456
- getRemotes(): ServerRemote[];
457
- readonly configure: alepha254.HookDescriptor<"configure">;
458
- readonly start: alepha254.HookDescriptor<"start">;
459
- registerRemote(value: RemoteDescriptor): Promise<void>;
460
- protected readonly fetchLinks: alepha_retry0.RetryDescriptorFn<(opts: FetchLinksOptions) => Promise<ApiLinksResponse>>;
461
- }
462
- interface FetchLinksOptions {
463
- /**
464
- * Name of the remote service.
465
- */
466
- service: string;
467
- /**
468
- * URL to fetch links from.
469
- */
470
- url: string;
471
- /**
472
- * Authorization header containing access token.
473
- */
474
- authorization?: string;
475
- }
476
- interface ServerRemote {
477
- /**
478
- * URL of the remote service.
479
- */
480
- url: string;
481
- /**
482
- * Name of the remote service.
483
- */
484
- name: string;
485
- /**
486
- * Expose links as endpoint. It's not only internal.
487
- */
488
- proxy: boolean;
489
- /**
490
- * It's only used inside the application.
491
- */
492
- internal: boolean;
493
- /**
494
- * Links fetcher.
495
- */
496
- links: (args: {
497
- authorization?: string;
498
- }) => Promise<ApiLinksResponse>;
499
- /**
500
- * Fetches schema for the remote service.
501
- */
502
- schema: (args: {
503
- name: string;
504
- authorization?: string;
505
- }) => Promise<any>;
506
- /**
507
- * Force a default access token provider when not provided.
508
- */
509
- serviceAccount?: ServiceAccountDescriptor;
510
- /**
511
- * Prefix for the remote service links.
512
- */
513
- prefix: string;
514
- }
27
+ type AuthenticationProvider = Static<typeof authenticationProviderSchema>;
515
28
  //#endregion
516
- //#region src/server-links/providers/ServerLinksProvider.d.ts
517
- declare class ServerLinksProvider {
518
- protected readonly env: {
519
- SERVER_API_PREFIX: string;
520
- };
521
- protected readonly alepha: Alepha;
522
- protected readonly linkProvider: LinkProvider;
523
- protected readonly remoteProvider: RemoteDescriptorProvider;
524
- protected readonly serverTimingProvider: ServerTimingProvider;
525
- get prefix(): string;
526
- readonly onRoute: alepha254.HookDescriptor<"configure">;
527
- /**
528
- * First API - Get all API links for the user.
529
- *
530
- * This is based on the user's permissions.
531
- */
532
- readonly links: alepha_server6.RouteDescriptor<{
533
- response: alepha254.TObject<{
534
- prefix: alepha254.TOptional<alepha254.TString>;
535
- links: alepha254.TArray<alepha254.TObject<{
536
- name: alepha254.TString;
537
- group: alepha254.TOptional<alepha254.TString>;
538
- path: alepha254.TString;
539
- method: alepha254.TOptional<alepha254.TString>;
540
- requestBodyType: alepha254.TOptional<alepha254.TString>;
541
- service: alepha254.TOptional<alepha254.TString>;
542
- }>>;
543
- }>;
29
+ //#region src/server-auth/schemas/tokenResponseSchema.d.ts
30
+ declare const tokenResponseSchema: alepha198.TObject<{
31
+ provider: alepha198.TString;
32
+ access_token: alepha198.TString;
33
+ issued_at: alepha198.TNumber;
34
+ expires_in: alepha198.TOptional<alepha198.TNumber>;
35
+ refresh_token: alepha198.TOptional<alepha198.TString>;
36
+ refresh_token_expires_in: alepha198.TOptional<alepha198.TNumber>;
37
+ refresh_expires_in: alepha198.TOptional<alepha198.TNumber>;
38
+ id_token: alepha198.TOptional<alepha198.TString>;
39
+ scope: alepha198.TOptional<alepha198.TString>;
40
+ user: alepha198.TObject<{
41
+ id: alepha198.TString;
42
+ name: alepha198.TOptional<alepha198.TString>;
43
+ email: alepha198.TOptional<alepha198.TString>;
44
+ username: alepha198.TOptional<alepha198.TString>;
45
+ picture: alepha198.TOptional<alepha198.TString>;
46
+ sessionId: alepha198.TOptional<alepha198.TString>;
47
+ organizations: alepha198.TOptional<alepha198.TArray<alepha198.TString>>;
48
+ roles: alepha198.TOptional<alepha198.TArray<alepha198.TString>>;
544
49
  }>;
545
- /**
546
- * Second API - Get schema for a specific API link.
547
- *
548
- * Note: Body/Response schema are not included in `links` API because it's TOO BIG.
549
- * I mean for 150+ links, you got 50ms of serialization time.
550
- */
551
- readonly schema: alepha_server6.RouteDescriptor<{
552
- params: alepha254.TObject<{
553
- name: alepha254.TString;
554
- }>;
555
- response: alepha254.TRecord<string, alepha254.TAny>;
50
+ api: alepha198.TObject<{
51
+ prefix: alepha198.TOptional<alepha198.TString>;
52
+ links: alepha198.TArray<alepha198.TObject<{
53
+ name: alepha198.TString;
54
+ group: alepha198.TOptional<alepha198.TString>;
55
+ path: alepha198.TString;
56
+ method: alepha198.TOptional<alepha198.TString>;
57
+ requestBodyType: alepha198.TOptional<alepha198.TString>;
58
+ service: alepha198.TOptional<alepha198.TString>;
59
+ }>>;
556
60
  }>;
557
- getSchemaByName(name: string, options?: GetApiLinksOptions): Promise<RequestConfigSchema>;
558
- /**
559
- * Retrieves API links for the user based on their permissions.
560
- * Will check on local links and remote links.
561
- */
562
- getUserApiLinks(options: GetApiLinksOptions): Promise<ApiLinksResponse>;
563
- }
564
- interface GetApiLinksOptions {
565
- user?: UserAccountToken;
566
- authorization?: string;
567
- }
568
- //#endregion
569
- //#region src/server-links/index.d.ts
570
- declare module "alepha" {
571
- interface State {
572
- /**
573
- * API links attached to the server request state.
574
- *
575
- * @see {@link ApiLinksResponse}
576
- * @internal
577
- */
578
- "alepha.server.request.apiLinks"?: ApiLinksResponse;
579
- }
580
- }
581
- /**
582
- * Provides server-side link management and remote capabilities for client-server interactions.
583
- *
584
- * The server-links module enables declarative link definitions using `$remote` and `$client` descriptors,
585
- * facilitating seamless API endpoint management and client-server communication. It integrates with server
586
- * security features to ensure safe and controlled access to resources.
587
- *
588
- * @see {@link $remote}
589
- * @see {@link $client}
590
- * @module alepha.server.links
591
- */
592
- //#endregion
593
- //#region src/server-auth/schemas/authenticationProviderSchema.d.ts
594
- declare const authenticationProviderSchema: alepha254.TObject<{
595
- name: alepha254.TString;
596
- type: alepha254.TUnsafe<"OAUTH2" | "OIDC" | "CREDENTIALS">;
597
61
  }>;
598
- type AuthenticationProvider = Static<typeof authenticationProviderSchema>;
62
+ type TokenResponse = Static<typeof tokenResponseSchema>;
599
63
  //#endregion
600
64
  //#region src/server-auth/schemas/tokensSchema.d.ts
601
- declare const tokensSchema: alepha254.TObject<{
602
- provider: alepha254.TString;
603
- access_token: alepha254.TString;
604
- issued_at: alepha254.TNumber;
605
- expires_in: alepha254.TOptional<alepha254.TNumber>;
606
- refresh_token: alepha254.TOptional<alepha254.TString>;
607
- refresh_token_expires_in: alepha254.TOptional<alepha254.TNumber>;
608
- refresh_expires_in: alepha254.TOptional<alepha254.TNumber>;
609
- id_token: alepha254.TOptional<alepha254.TString>;
610
- scope: alepha254.TOptional<alepha254.TString>;
65
+ declare const tokensSchema: alepha198.TObject<{
66
+ provider: alepha198.TString;
67
+ access_token: alepha198.TString;
68
+ issued_at: alepha198.TNumber;
69
+ expires_in: alepha198.TOptional<alepha198.TNumber>;
70
+ refresh_token: alepha198.TOptional<alepha198.TString>;
71
+ refresh_token_expires_in: alepha198.TOptional<alepha198.TNumber>;
72
+ refresh_expires_in: alepha198.TOptional<alepha198.TNumber>;
73
+ id_token: alepha198.TOptional<alepha198.TString>;
74
+ scope: alepha198.TOptional<alepha198.TString>;
611
75
  }>;
612
76
  type Tokens = Static<typeof tokensSchema>;
613
77
  //#endregion
78
+ //#region src/server-auth/schemas/userinfoResponseSchema.d.ts
79
+ declare const userinfoResponseSchema: alepha198.TObject<{
80
+ user: alepha198.TOptional<alepha198.TObject<{
81
+ id: alepha198.TString;
82
+ name: alepha198.TOptional<alepha198.TString>;
83
+ email: alepha198.TOptional<alepha198.TString>;
84
+ username: alepha198.TOptional<alepha198.TString>;
85
+ picture: alepha198.TOptional<alepha198.TString>;
86
+ sessionId: alepha198.TOptional<alepha198.TString>;
87
+ organizations: alepha198.TOptional<alepha198.TArray<alepha198.TString>>;
88
+ roles: alepha198.TOptional<alepha198.TArray<alepha198.TString>>;
89
+ }>>;
90
+ api: alepha198.TObject<{
91
+ prefix: alepha198.TOptional<alepha198.TString>;
92
+ links: alepha198.TArray<alepha198.TObject<{
93
+ name: alepha198.TString;
94
+ group: alepha198.TOptional<alepha198.TString>;
95
+ path: alepha198.TString;
96
+ method: alepha198.TOptional<alepha198.TString>;
97
+ requestBodyType: alepha198.TOptional<alepha198.TString>;
98
+ service: alepha198.TOptional<alepha198.TString>;
99
+ }>>;
100
+ }>;
101
+ }>;
102
+ type UserinfoResponse = Static<typeof userinfoResponseSchema>;
103
+ //#endregion
614
104
  //#region src/server-auth/providers/ServerAuthProvider.d.ts
615
105
  declare class ServerAuthProvider {
616
106
  protected readonly log: alepha_logger0.Logger;
@@ -618,34 +108,34 @@ declare class ServerAuthProvider {
618
108
  protected readonly serverCookiesProvider: ServerCookiesProvider;
619
109
  protected readonly dateTimeProvider: DateTimeProvider;
620
110
  protected readonly serverLinksProvider: ServerLinksProvider;
621
- protected readonly authorizationCode: AbstractCookieDescriptor<alepha254.TObject<{
622
- provider: alepha254.TString;
623
- codeVerifier: alepha254.TOptional<alepha254.TString>;
624
- redirectUri: alepha254.TOptional<alepha254.TString>;
625
- state: alepha254.TOptional<alepha254.TString>;
626
- nonce: alepha254.TOptional<alepha254.TString>;
111
+ protected readonly authorizationCode: alepha_server_cookies0.AbstractCookiePrimitive<alepha198.TObject<{
112
+ provider: alepha198.TString;
113
+ codeVerifier: alepha198.TOptional<alepha198.TString>;
114
+ redirectUri: alepha198.TOptional<alepha198.TString>;
115
+ state: alepha198.TOptional<alepha198.TString>;
116
+ nonce: alepha198.TOptional<alepha198.TString>;
627
117
  }>>;
628
- readonly tokens: AbstractCookieDescriptor<alepha254.TObject<{
629
- provider: alepha254.TString;
630
- access_token: alepha254.TString;
631
- issued_at: alepha254.TNumber;
632
- expires_in: alepha254.TOptional<alepha254.TNumber>;
633
- refresh_token: alepha254.TOptional<alepha254.TString>;
634
- refresh_token_expires_in: alepha254.TOptional<alepha254.TNumber>;
635
- refresh_expires_in: alepha254.TOptional<alepha254.TNumber>;
636
- id_token: alepha254.TOptional<alepha254.TString>;
637
- scope: alepha254.TOptional<alepha254.TString>;
118
+ readonly tokens: alepha_server_cookies0.AbstractCookiePrimitive<alepha198.TObject<{
119
+ provider: alepha198.TString;
120
+ access_token: alepha198.TString;
121
+ issued_at: alepha198.TNumber;
122
+ expires_in: alepha198.TOptional<alepha198.TNumber>;
123
+ refresh_token: alepha198.TOptional<alepha198.TString>;
124
+ refresh_token_expires_in: alepha198.TOptional<alepha198.TNumber>;
125
+ refresh_expires_in: alepha198.TOptional<alepha198.TNumber>;
126
+ id_token: alepha198.TOptional<alepha198.TString>;
127
+ scope: alepha198.TOptional<alepha198.TString>;
638
128
  }>>;
639
- get identities(): Array<AuthDescriptor>;
129
+ get identities(): Array<AuthPrimitive>;
640
130
  getAuthenticationProviders(filters?: {
641
131
  realmName?: string;
642
132
  }): AuthenticationProvider[];
643
- protected readonly configure: alepha254.HookDescriptor<"configure">;
133
+ protected readonly configure: alepha198.HookPrimitive<"configure">;
644
134
  protected getAccessTokens(tokens: Tokens): string | undefined;
645
135
  /**
646
136
  * Fill request headers with access token from cookies or fallback to provider's fallback function.
647
137
  */
648
- protected readonly onRequest: alepha254.HookDescriptor<"server:onRequest">;
138
+ protected readonly onRequest: alepha198.HookPrimitive<"server:onRequest">;
649
139
  /**
650
140
  * Convert cookies to tokens.
651
141
  * If the tokens are expired, try to refresh them using the refresh token.
@@ -655,27 +145,27 @@ declare class ServerAuthProvider {
655
145
  /**
656
146
  * Get user information.
657
147
  */
658
- readonly userinfo: alepha_server6.RouteDescriptor<{
659
- response: alepha254.TObject<{
660
- user: alepha254.TOptional<alepha254.TObject<{
661
- id: alepha254.TString;
662
- name: alepha254.TOptional<alepha254.TString>;
663
- email: alepha254.TOptional<alepha254.TString>;
664
- username: alepha254.TOptional<alepha254.TString>;
665
- picture: alepha254.TOptional<alepha254.TString>;
666
- sessionId: alepha254.TOptional<alepha254.TString>;
667
- organizations: alepha254.TOptional<alepha254.TArray<alepha254.TString>>;
668
- roles: alepha254.TOptional<alepha254.TArray<alepha254.TString>>;
148
+ readonly userinfo: alepha_server0.RoutePrimitive<{
149
+ response: alepha198.TObject<{
150
+ user: alepha198.TOptional<alepha198.TObject<{
151
+ id: alepha198.TString;
152
+ name: alepha198.TOptional<alepha198.TString>;
153
+ email: alepha198.TOptional<alepha198.TString>;
154
+ username: alepha198.TOptional<alepha198.TString>;
155
+ picture: alepha198.TOptional<alepha198.TString>;
156
+ sessionId: alepha198.TOptional<alepha198.TString>;
157
+ organizations: alepha198.TOptional<alepha198.TArray<alepha198.TString>>;
158
+ roles: alepha198.TOptional<alepha198.TArray<alepha198.TString>>;
669
159
  }>>;
670
- api: alepha254.TObject<{
671
- prefix: alepha254.TOptional<alepha254.TString>;
672
- links: alepha254.TArray<alepha254.TObject<{
673
- name: alepha254.TString;
674
- group: alepha254.TOptional<alepha254.TString>;
675
- path: alepha254.TString;
676
- method: alepha254.TOptional<alepha254.TString>;
677
- requestBodyType: alepha254.TOptional<alepha254.TString>;
678
- service: alepha254.TOptional<alepha254.TString>;
160
+ api: alepha198.TObject<{
161
+ prefix: alepha198.TOptional<alepha198.TString>;
162
+ links: alepha198.TArray<alepha198.TObject<{
163
+ name: alepha198.TString;
164
+ group: alepha198.TOptional<alepha198.TString>;
165
+ path: alepha198.TString;
166
+ method: alepha198.TOptional<alepha198.TString>;
167
+ requestBodyType: alepha198.TOptional<alepha198.TString>;
168
+ service: alepha198.TOptional<alepha198.TString>;
679
169
  }>>;
680
170
  }>;
681
171
  }>;
@@ -683,66 +173,66 @@ declare class ServerAuthProvider {
683
173
  /**
684
174
  * Refresh a token for internal providers.
685
175
  */
686
- readonly refresh: alepha_server6.RouteDescriptor<{
687
- query: alepha254.TObject<{
688
- provider: alepha254.TString;
176
+ readonly refresh: alepha_server0.RoutePrimitive<{
177
+ query: alepha198.TObject<{
178
+ provider: alepha198.TString;
689
179
  }>;
690
- body: alepha254.TObject<{
691
- refresh_token: alepha254.TString;
692
- access_token: alepha254.TOptional<alepha254.TString>;
180
+ body: alepha198.TObject<{
181
+ refresh_token: alepha198.TString;
182
+ access_token: alepha198.TOptional<alepha198.TString>;
693
183
  }>;
694
- response: alepha254.TObject<{
695
- provider: alepha254.TString;
696
- access_token: alepha254.TString;
697
- issued_at: alepha254.TNumber;
698
- expires_in: alepha254.TOptional<alepha254.TNumber>;
699
- refresh_token: alepha254.TOptional<alepha254.TString>;
700
- refresh_token_expires_in: alepha254.TOptional<alepha254.TNumber>;
701
- refresh_expires_in: alepha254.TOptional<alepha254.TNumber>;
702
- id_token: alepha254.TOptional<alepha254.TString>;
703
- scope: alepha254.TOptional<alepha254.TString>;
184
+ response: alepha198.TObject<{
185
+ provider: alepha198.TString;
186
+ access_token: alepha198.TString;
187
+ issued_at: alepha198.TNumber;
188
+ expires_in: alepha198.TOptional<alepha198.TNumber>;
189
+ refresh_token: alepha198.TOptional<alepha198.TString>;
190
+ refresh_token_expires_in: alepha198.TOptional<alepha198.TNumber>;
191
+ refresh_expires_in: alepha198.TOptional<alepha198.TNumber>;
192
+ id_token: alepha198.TOptional<alepha198.TString>;
193
+ scope: alepha198.TOptional<alepha198.TString>;
704
194
  }>;
705
195
  }>;
706
196
  /**
707
197
  * Login for local password-based authentication.
708
198
  */
709
- readonly token: alepha_server6.RouteDescriptor<{
710
- query: alepha254.TObject<{
711
- provider: alepha254.TString;
199
+ readonly token: alepha_server0.RoutePrimitive<{
200
+ query: alepha198.TObject<{
201
+ provider: alepha198.TString;
712
202
  }>;
713
- body: alepha254.TObject<{
714
- username: alepha254.TString;
715
- password: alepha254.TString;
203
+ body: alepha198.TObject<{
204
+ username: alepha198.TString;
205
+ password: alepha198.TString;
716
206
  }>;
717
- response: alepha254.TObject<{
718
- provider: alepha254.TString;
719
- access_token: alepha254.TString;
720
- issued_at: alepha254.TNumber;
721
- expires_in: alepha254.TOptional<alepha254.TNumber>;
722
- refresh_token: alepha254.TOptional<alepha254.TString>;
723
- refresh_token_expires_in: alepha254.TOptional<alepha254.TNumber>;
724
- refresh_expires_in: alepha254.TOptional<alepha254.TNumber>;
725
- id_token: alepha254.TOptional<alepha254.TString>;
726
- scope: alepha254.TOptional<alepha254.TString>;
727
- user: alepha254.TObject<{
728
- id: alepha254.TString;
729
- name: alepha254.TOptional<alepha254.TString>;
730
- email: alepha254.TOptional<alepha254.TString>;
731
- username: alepha254.TOptional<alepha254.TString>;
732
- picture: alepha254.TOptional<alepha254.TString>;
733
- sessionId: alepha254.TOptional<alepha254.TString>;
734
- organizations: alepha254.TOptional<alepha254.TArray<alepha254.TString>>;
735
- roles: alepha254.TOptional<alepha254.TArray<alepha254.TString>>;
207
+ response: alepha198.TObject<{
208
+ provider: alepha198.TString;
209
+ access_token: alepha198.TString;
210
+ issued_at: alepha198.TNumber;
211
+ expires_in: alepha198.TOptional<alepha198.TNumber>;
212
+ refresh_token: alepha198.TOptional<alepha198.TString>;
213
+ refresh_token_expires_in: alepha198.TOptional<alepha198.TNumber>;
214
+ refresh_expires_in: alepha198.TOptional<alepha198.TNumber>;
215
+ id_token: alepha198.TOptional<alepha198.TString>;
216
+ scope: alepha198.TOptional<alepha198.TString>;
217
+ user: alepha198.TObject<{
218
+ id: alepha198.TString;
219
+ name: alepha198.TOptional<alepha198.TString>;
220
+ email: alepha198.TOptional<alepha198.TString>;
221
+ username: alepha198.TOptional<alepha198.TString>;
222
+ picture: alepha198.TOptional<alepha198.TString>;
223
+ sessionId: alepha198.TOptional<alepha198.TString>;
224
+ organizations: alepha198.TOptional<alepha198.TArray<alepha198.TString>>;
225
+ roles: alepha198.TOptional<alepha198.TArray<alepha198.TString>>;
736
226
  }>;
737
- api: alepha254.TObject<{
738
- prefix: alepha254.TOptional<alepha254.TString>;
739
- links: alepha254.TArray<alepha254.TObject<{
740
- name: alepha254.TString;
741
- group: alepha254.TOptional<alepha254.TString>;
742
- path: alepha254.TString;
743
- method: alepha254.TOptional<alepha254.TString>;
744
- requestBodyType: alepha254.TOptional<alepha254.TString>;
745
- service: alepha254.TOptional<alepha254.TString>;
227
+ api: alepha198.TObject<{
228
+ prefix: alepha198.TOptional<alepha198.TString>;
229
+ links: alepha198.TArray<alepha198.TObject<{
230
+ name: alepha198.TString;
231
+ group: alepha198.TOptional<alepha198.TString>;
232
+ path: alepha198.TString;
233
+ method: alepha198.TOptional<alepha198.TString>;
234
+ requestBodyType: alepha198.TOptional<alepha198.TString>;
235
+ service: alepha198.TOptional<alepha198.TString>;
746
236
  }>>;
747
237
  }>;
748
238
  }>;
@@ -750,28 +240,28 @@ declare class ServerAuthProvider {
750
240
  /**
751
241
  * Oauth2/OIDC login route.
752
242
  */
753
- readonly login: alepha_server6.RouteDescriptor<{
754
- query: alepha254.TObject<{
755
- provider: alepha254.TString;
756
- redirect_uri: alepha254.TOptional<alepha254.TString>;
243
+ readonly login: alepha_server0.RoutePrimitive<{
244
+ query: alepha198.TObject<{
245
+ provider: alepha198.TString;
246
+ redirect_uri: alepha198.TOptional<alepha198.TString>;
757
247
  }>;
758
248
  }>;
759
249
  /**
760
250
  * Callback for OAuth2/OIDC providers.
761
251
  * It handles the authorization code flow and retrieves the access token.
762
252
  */
763
- readonly callback: alepha_server6.RouteDescriptor<alepha_server6.RequestConfigSchema>;
253
+ readonly callback: alepha_server0.RoutePrimitive<alepha_server0.RequestConfigSchema>;
764
254
  /**
765
255
  * Logout route for OAuth2/OIDC providers.
766
256
  */
767
- readonly logout: alepha_server6.RouteDescriptor<{
768
- query: alepha254.TObject<{
769
- post_logout_redirect_uri: alepha254.TOptional<alepha254.TString>;
257
+ readonly logout: alepha_server0.RoutePrimitive<{
258
+ query: alepha198.TObject<{
259
+ post_logout_redirect_uri: alepha198.TOptional<alepha198.TString>;
770
260
  }>;
771
261
  }>;
772
262
  protected provider(opts: string | {
773
263
  provider: string;
774
- }): AuthDescriptor;
264
+ }): AuthPrimitive;
775
265
  protected setTokens(tokens: Tokens, cookies?: Cookies): void;
776
266
  }
777
267
  interface OAuth2Profile {
@@ -805,9 +295,9 @@ interface OAuth2Profile {
805
295
  [key: string]: unknown;
806
296
  }
807
297
  //#endregion
808
- //#region src/server-auth/descriptors/$auth.d.ts
298
+ //#region src/server-auth/primitives/$auth.d.ts
809
299
  /**
810
- * Creates an authentication provider descriptor for handling user login flows.
300
+ * Creates an authentication provider primitive for handling user login flows.
811
301
  *
812
302
  * Supports multiple authentication strategies: credentials (username/password), OAuth2,
813
303
  * and OIDC (OpenID Connect). Handles token management, user profile retrieval, and
@@ -841,10 +331,10 @@ interface OAuth2Profile {
841
331
  * ```
842
332
  */
843
333
  declare const $auth: {
844
- (options: AuthDescriptorOptions): AuthDescriptor;
845
- [KIND]: typeof AuthDescriptor;
334
+ (options: AuthPrimitiveOptions): AuthPrimitive;
335
+ [KIND]: typeof AuthPrimitive;
846
336
  };
847
- type AuthDescriptorOptions = {
337
+ type AuthPrimitiveOptions = {
848
338
  /**
849
339
  * Name of the identity provider.
850
340
  * If not provided, it will be derived from the property key.
@@ -885,7 +375,7 @@ type AuthExternal = {
885
375
  * This relies on the `realm`, which is used to create/verify the access token.
886
376
  */
887
377
  type AuthInternal = {
888
- realm: RealmDescriptor;
378
+ realm: RealmPrimitive;
889
379
  } & ({
890
380
  /**
891
381
  * The common username/password authentication.
@@ -998,7 +488,7 @@ interface OAuth2Options {
998
488
  */
999
489
  scope?: string;
1000
490
  }
1001
- declare class AuthDescriptor extends Descriptor<AuthDescriptorOptions> {
491
+ declare class AuthPrimitive extends Primitive<AuthPrimitiveOptions> {
1002
492
  protected readonly securityProvider: SecurityProvider;
1003
493
  protected readonly dateTimeProvider: DateTimeProvider;
1004
494
  oauth?: Configuration;
@@ -1029,17 +519,17 @@ interface WithLoginFn {
1029
519
  login?: (provider: string) => (creds: Credentials) => Async<UserAccount | undefined>;
1030
520
  }
1031
521
  //#endregion
1032
- //#region src/server-auth/descriptors/$authCredentials.d.ts
522
+ //#region src/server-auth/primitives/$authCredentials.d.ts
1033
523
  /**
1034
- * Already configured Credentials authentication descriptor.
524
+ * Already configured Credentials authentication primitive.
1035
525
  *
1036
526
  * Uses username and password to authenticate users.
1037
527
  */
1038
- declare const $authCredentials: (realm: RealmDescriptor & WithLoginFn, options?: Partial<CredentialsOptions>) => AuthDescriptor;
528
+ declare const $authCredentials: (realm: RealmPrimitive & WithLoginFn, options?: Partial<CredentialsOptions>) => AuthPrimitive;
1039
529
  //#endregion
1040
- //#region src/server-auth/descriptors/$authGithub.d.ts
530
+ //#region src/server-auth/primitives/$authGithub.d.ts
1041
531
  /**
1042
- * Already configured GitHub authentication descriptor.
532
+ * Already configured GitHub authentication primitive.
1043
533
  *
1044
534
  * Uses OAuth2 to authenticate users via their GitHub accounts.
1045
535
  * Upon successful authentication, it links the GitHub account to a user session.
@@ -1048,11 +538,11 @@ declare const $authCredentials: (realm: RealmDescriptor & WithLoginFn, options?:
1048
538
  * - `GITHUB_CLIENT_ID`: The client ID obtained from the GitHub Developer Settings.
1049
539
  * - `GITHUB_CLIENT_SECRET`: The client secret obtained from the GitHub Developer Settings.
1050
540
  */
1051
- declare const $authGithub: (realm: RealmDescriptor & WithLinkFn, options?: Partial<OidcOptions>) => AuthDescriptor;
541
+ declare const $authGithub: (realm: RealmPrimitive & WithLinkFn, options?: Partial<OidcOptions>) => AuthPrimitive;
1052
542
  //#endregion
1053
- //#region src/server-auth/descriptors/$authGoogle.d.ts
543
+ //#region src/server-auth/primitives/$authGoogle.d.ts
1054
544
  /**
1055
- * Already configured Google authentication descriptor.
545
+ * Already configured Google authentication primitive.
1056
546
  *
1057
547
  * Uses OpenID Connect (OIDC) to authenticate users via their Google accounts.
1058
548
  * Upon successful authentication, it links the Google account to a user session.
@@ -1061,78 +551,7 @@ declare const $authGithub: (realm: RealmDescriptor & WithLinkFn, options?: Parti
1061
551
  * - `GOOGLE_CLIENT_ID`: The client ID obtained from the Google Developer Console.
1062
552
  * - `GOOGLE_CLIENT_SECRET`: The client secret obtained from the Google Developer Console.
1063
553
  */
1064
- declare const $authGoogle: (realm: RealmDescriptor & WithLinkFn, options?: Partial<OidcOptions>) => AuthDescriptor;
1065
- //#endregion
1066
- //#region src/server-auth/constants/routes.d.ts
1067
- declare const alephaServerAuthRoutes: {
1068
- login: string;
1069
- callback: string;
1070
- logout: string;
1071
- token: string;
1072
- refresh: string;
1073
- userinfo: string;
1074
- };
1075
- //#endregion
1076
- //#region src/server-auth/schemas/tokenResponseSchema.d.ts
1077
- declare const tokenResponseSchema: alepha254.TObject<{
1078
- provider: alepha254.TString;
1079
- access_token: alepha254.TString;
1080
- issued_at: alepha254.TNumber;
1081
- expires_in: alepha254.TOptional<alepha254.TNumber>;
1082
- refresh_token: alepha254.TOptional<alepha254.TString>;
1083
- refresh_token_expires_in: alepha254.TOptional<alepha254.TNumber>;
1084
- refresh_expires_in: alepha254.TOptional<alepha254.TNumber>;
1085
- id_token: alepha254.TOptional<alepha254.TString>;
1086
- scope: alepha254.TOptional<alepha254.TString>;
1087
- user: alepha254.TObject<{
1088
- id: alepha254.TString;
1089
- name: alepha254.TOptional<alepha254.TString>;
1090
- email: alepha254.TOptional<alepha254.TString>;
1091
- username: alepha254.TOptional<alepha254.TString>;
1092
- picture: alepha254.TOptional<alepha254.TString>;
1093
- sessionId: alepha254.TOptional<alepha254.TString>;
1094
- organizations: alepha254.TOptional<alepha254.TArray<alepha254.TString>>;
1095
- roles: alepha254.TOptional<alepha254.TArray<alepha254.TString>>;
1096
- }>;
1097
- api: alepha254.TObject<{
1098
- prefix: alepha254.TOptional<alepha254.TString>;
1099
- links: alepha254.TArray<alepha254.TObject<{
1100
- name: alepha254.TString;
1101
- group: alepha254.TOptional<alepha254.TString>;
1102
- path: alepha254.TString;
1103
- method: alepha254.TOptional<alepha254.TString>;
1104
- requestBodyType: alepha254.TOptional<alepha254.TString>;
1105
- service: alepha254.TOptional<alepha254.TString>;
1106
- }>>;
1107
- }>;
1108
- }>;
1109
- type TokenResponse = Static<typeof tokenResponseSchema>;
1110
- //#endregion
1111
- //#region src/server-auth/schemas/userinfoResponseSchema.d.ts
1112
- declare const userinfoResponseSchema: alepha254.TObject<{
1113
- user: alepha254.TOptional<alepha254.TObject<{
1114
- id: alepha254.TString;
1115
- name: alepha254.TOptional<alepha254.TString>;
1116
- email: alepha254.TOptional<alepha254.TString>;
1117
- username: alepha254.TOptional<alepha254.TString>;
1118
- picture: alepha254.TOptional<alepha254.TString>;
1119
- sessionId: alepha254.TOptional<alepha254.TString>;
1120
- organizations: alepha254.TOptional<alepha254.TArray<alepha254.TString>>;
1121
- roles: alepha254.TOptional<alepha254.TArray<alepha254.TString>>;
1122
- }>>;
1123
- api: alepha254.TObject<{
1124
- prefix: alepha254.TOptional<alepha254.TString>;
1125
- links: alepha254.TArray<alepha254.TObject<{
1126
- name: alepha254.TString;
1127
- group: alepha254.TOptional<alepha254.TString>;
1128
- path: alepha254.TString;
1129
- method: alepha254.TOptional<alepha254.TString>;
1130
- requestBodyType: alepha254.TOptional<alepha254.TString>;
1131
- service: alepha254.TOptional<alepha254.TString>;
1132
- }>>;
1133
- }>;
1134
- }>;
1135
- type UserinfoResponse = Static<typeof userinfoResponseSchema>;
554
+ declare const $authGoogle: (realm: RealmPrimitive & WithLinkFn, options?: Partial<OidcOptions>) => AuthPrimitive;
1136
555
  //#endregion
1137
556
  //#region src/server-auth/index.d.ts
1138
557
  declare module "alepha" {
@@ -1158,7 +577,7 @@ declare module "alepha" {
1158
577
  * @see {@link ServerAuthProvider}
1159
578
  * @module alepha.server.auth
1160
579
  */
1161
- declare const AlephaServerAuth: alepha254.Service<alepha254.Module>;
580
+ declare const AlephaServerAuth: alepha198.Service<alepha198.Module>;
1162
581
  //#endregion
1163
- export { $auth, $authCredentials, $authGithub, $authGoogle, AccessToken, AlephaServerAuth, AuthDescriptor, AuthDescriptorOptions, AuthExternal, AuthInternal, AuthenticationProvider, Credentials, CredentialsFn, CredentialsOptions, LinkAccountFn, LinkAccountOptions, OAuth2Options, OAuth2Profile, OidcOptions, ServerAuthProvider, TokenResponse, Tokens, UserinfoResponse, WithLinkFn, WithLoginFn, alephaServerAuthRoutes, authenticationProviderSchema, tokenResponseSchema, tokensSchema, userinfoResponseSchema };
582
+ export { $auth, $authCredentials, $authGithub, $authGoogle, AccessToken, AlephaServerAuth, AuthExternal, AuthInternal, AuthPrimitive, AuthPrimitiveOptions, AuthenticationProvider, Credentials, CredentialsFn, CredentialsOptions, LinkAccountFn, LinkAccountOptions, OAuth2Options, OAuth2Profile, OidcOptions, ServerAuthProvider, TokenResponse, Tokens, UserinfoResponse, WithLinkFn, WithLoginFn, alephaServerAuthRoutes, authenticationProviderSchema, tokenResponseSchema, tokensSchema, userinfoResponseSchema };
1164
583
  //# sourceMappingURL=index.d.ts.map