alepha 0.15.0 → 0.15.1

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 (222) hide show
  1. package/README.md +43 -98
  2. package/dist/api/audits/index.d.ts +240 -240
  3. package/dist/api/audits/index.d.ts.map +1 -1
  4. package/dist/api/audits/index.js +2 -2
  5. package/dist/api/audits/index.js.map +1 -1
  6. package/dist/api/files/index.d.ts +185 -185
  7. package/dist/api/files/index.d.ts.map +1 -1
  8. package/dist/api/files/index.js +2 -2
  9. package/dist/api/files/index.js.map +1 -1
  10. package/dist/api/jobs/index.d.ts +245 -245
  11. package/dist/api/jobs/index.d.ts.map +1 -1
  12. package/dist/api/notifications/index.browser.js +4 -4
  13. package/dist/api/notifications/index.browser.js.map +1 -1
  14. package/dist/api/notifications/index.d.ts +74 -74
  15. package/dist/api/notifications/index.d.ts.map +1 -1
  16. package/dist/api/notifications/index.js +4 -4
  17. package/dist/api/notifications/index.js.map +1 -1
  18. package/dist/api/parameters/index.d.ts +221 -221
  19. package/dist/api/parameters/index.d.ts.map +1 -1
  20. package/dist/api/users/index.d.ts +1632 -1631
  21. package/dist/api/users/index.d.ts.map +1 -1
  22. package/dist/api/users/index.js +26 -34
  23. package/dist/api/users/index.js.map +1 -1
  24. package/dist/api/verifications/index.d.ts +132 -132
  25. package/dist/api/verifications/index.d.ts.map +1 -1
  26. package/dist/batch/index.d.ts +122 -122
  27. package/dist/batch/index.d.ts.map +1 -1
  28. package/dist/bucket/index.d.ts +163 -163
  29. package/dist/bucket/index.d.ts.map +1 -1
  30. package/dist/cache/core/index.d.ts +46 -46
  31. package/dist/cache/core/index.d.ts.map +1 -1
  32. package/dist/cache/redis/index.d.ts.map +1 -1
  33. package/dist/cache/redis/index.js +2 -2
  34. package/dist/cache/redis/index.js.map +1 -1
  35. package/dist/cli/index.d.ts +5933 -201
  36. package/dist/cli/index.d.ts.map +1 -1
  37. package/dist/cli/index.js +609 -169
  38. package/dist/cli/index.js.map +1 -1
  39. package/dist/command/index.d.ts +296 -296
  40. package/dist/command/index.d.ts.map +1 -1
  41. package/dist/command/index.js +19 -19
  42. package/dist/command/index.js.map +1 -1
  43. package/dist/core/index.browser.js +268 -79
  44. package/dist/core/index.browser.js.map +1 -1
  45. package/dist/core/index.d.ts +768 -694
  46. package/dist/core/index.d.ts.map +1 -1
  47. package/dist/core/index.js +268 -79
  48. package/dist/core/index.js.map +1 -1
  49. package/dist/core/index.native.js +268 -79
  50. package/dist/core/index.native.js.map +1 -1
  51. package/dist/datetime/index.d.ts +44 -44
  52. package/dist/datetime/index.d.ts.map +1 -1
  53. package/dist/email/index.d.ts +25 -25
  54. package/dist/email/index.d.ts.map +1 -1
  55. package/dist/fake/index.d.ts +5409 -5409
  56. package/dist/fake/index.d.ts.map +1 -1
  57. package/dist/fake/index.js +22 -22
  58. package/dist/fake/index.js.map +1 -1
  59. package/dist/file/index.d.ts +435 -435
  60. package/dist/file/index.d.ts.map +1 -1
  61. package/dist/lock/core/index.d.ts +208 -208
  62. package/dist/lock/core/index.d.ts.map +1 -1
  63. package/dist/lock/redis/index.d.ts.map +1 -1
  64. package/dist/logger/index.d.ts +24 -24
  65. package/dist/logger/index.d.ts.map +1 -1
  66. package/dist/logger/index.js +1 -5
  67. package/dist/logger/index.js.map +1 -1
  68. package/dist/mcp/index.d.ts +216 -198
  69. package/dist/mcp/index.d.ts.map +1 -1
  70. package/dist/mcp/index.js +28 -4
  71. package/dist/mcp/index.js.map +1 -1
  72. package/dist/orm/index.browser.js +9 -9
  73. package/dist/orm/index.browser.js.map +1 -1
  74. package/dist/orm/index.bun.js +83 -76
  75. package/dist/orm/index.bun.js.map +1 -1
  76. package/dist/orm/index.d.ts +961 -960
  77. package/dist/orm/index.d.ts.map +1 -1
  78. package/dist/orm/index.js +88 -81
  79. package/dist/orm/index.js.map +1 -1
  80. package/dist/queue/core/index.d.ts +244 -244
  81. package/dist/queue/core/index.d.ts.map +1 -1
  82. package/dist/queue/redis/index.d.ts.map +1 -1
  83. package/dist/redis/index.d.ts +105 -105
  84. package/dist/redis/index.d.ts.map +1 -1
  85. package/dist/retry/index.d.ts +69 -69
  86. package/dist/retry/index.d.ts.map +1 -1
  87. package/dist/router/index.d.ts +6 -6
  88. package/dist/router/index.d.ts.map +1 -1
  89. package/dist/scheduler/index.d.ts +108 -26
  90. package/dist/scheduler/index.d.ts.map +1 -1
  91. package/dist/scheduler/index.js +393 -1
  92. package/dist/scheduler/index.js.map +1 -1
  93. package/dist/security/index.d.ts +532 -209
  94. package/dist/security/index.d.ts.map +1 -1
  95. package/dist/security/index.js +1422 -11
  96. package/dist/security/index.js.map +1 -1
  97. package/dist/server/auth/index.d.ts +1296 -271
  98. package/dist/server/auth/index.d.ts.map +1 -1
  99. package/dist/server/auth/index.js +1249 -18
  100. package/dist/server/auth/index.js.map +1 -1
  101. package/dist/server/cache/index.d.ts +56 -56
  102. package/dist/server/cache/index.d.ts.map +1 -1
  103. package/dist/server/compress/index.d.ts +3 -3
  104. package/dist/server/compress/index.d.ts.map +1 -1
  105. package/dist/server/cookies/index.d.ts +6 -6
  106. package/dist/server/cookies/index.d.ts.map +1 -1
  107. package/dist/server/core/index.d.ts +196 -186
  108. package/dist/server/core/index.d.ts.map +1 -1
  109. package/dist/server/core/index.js +43 -27
  110. package/dist/server/core/index.js.map +1 -1
  111. package/dist/server/cors/index.d.ts +11 -11
  112. package/dist/server/cors/index.d.ts.map +1 -1
  113. package/dist/server/health/index.d.ts.map +1 -1
  114. package/dist/server/helmet/index.d.ts +2 -2
  115. package/dist/server/helmet/index.d.ts.map +1 -1
  116. package/dist/server/links/index.browser.js +9 -1
  117. package/dist/server/links/index.browser.js.map +1 -1
  118. package/dist/server/links/index.d.ts +83 -83
  119. package/dist/server/links/index.d.ts.map +1 -1
  120. package/dist/server/links/index.js +13 -5
  121. package/dist/server/links/index.js.map +1 -1
  122. package/dist/server/metrics/index.d.ts +514 -1
  123. package/dist/server/metrics/index.d.ts.map +1 -1
  124. package/dist/server/metrics/index.js +4462 -4
  125. package/dist/server/metrics/index.js.map +1 -1
  126. package/dist/server/multipart/index.d.ts +6 -6
  127. package/dist/server/multipart/index.d.ts.map +1 -1
  128. package/dist/server/proxy/index.d.ts +102 -102
  129. package/dist/server/proxy/index.d.ts.map +1 -1
  130. package/dist/server/rate-limit/index.d.ts +16 -16
  131. package/dist/server/rate-limit/index.d.ts.map +1 -1
  132. package/dist/server/static/index.d.ts +44 -44
  133. package/dist/server/static/index.d.ts.map +1 -1
  134. package/dist/server/swagger/index.d.ts +47 -47
  135. package/dist/server/swagger/index.d.ts.map +1 -1
  136. package/dist/sms/index.d.ts +11 -11
  137. package/dist/sms/index.d.ts.map +1 -1
  138. package/dist/sms/index.js +3 -3
  139. package/dist/sms/index.js.map +1 -1
  140. package/dist/thread/index.d.ts +71 -71
  141. package/dist/thread/index.d.ts.map +1 -1
  142. package/dist/thread/index.js +2 -2
  143. package/dist/thread/index.js.map +1 -1
  144. package/dist/topic/core/index.d.ts +318 -318
  145. package/dist/topic/core/index.d.ts.map +1 -1
  146. package/dist/topic/redis/index.d.ts +6 -6
  147. package/dist/topic/redis/index.d.ts.map +1 -1
  148. package/dist/vite/index.d.ts +2324 -1719
  149. package/dist/vite/index.d.ts.map +1 -1
  150. package/dist/vite/index.js +123 -475
  151. package/dist/vite/index.js.map +1 -1
  152. package/dist/websocket/index.browser.js +3 -3
  153. package/dist/websocket/index.browser.js.map +1 -1
  154. package/dist/websocket/index.d.ts +275 -275
  155. package/dist/websocket/index.d.ts.map +1 -1
  156. package/dist/websocket/index.js +3 -3
  157. package/dist/websocket/index.js.map +1 -1
  158. package/package.json +9 -9
  159. package/src/api/users/services/SessionService.ts +0 -10
  160. package/src/cli/apps/AlephaCli.ts +2 -2
  161. package/src/cli/apps/AlephaPackageBuilderCli.ts +9 -1
  162. package/src/cli/assets/apiHelloControllerTs.ts +2 -1
  163. package/src/cli/assets/biomeJson.ts +2 -1
  164. package/src/cli/assets/claudeMd.ts +9 -4
  165. package/src/cli/assets/dummySpecTs.ts +2 -1
  166. package/src/cli/assets/editorconfig.ts +2 -1
  167. package/src/cli/assets/mainBrowserTs.ts +2 -1
  168. package/src/cli/assets/mainCss.ts +24 -0
  169. package/src/cli/assets/tsconfigJson.ts +2 -1
  170. package/src/cli/assets/webAppRouterTs.ts +2 -1
  171. package/src/cli/assets/webHelloComponentTsx.ts +6 -2
  172. package/src/cli/atoms/appEntryOptions.ts +13 -0
  173. package/src/cli/atoms/buildOptions.ts +1 -1
  174. package/src/cli/atoms/changelogOptions.ts +1 -1
  175. package/src/cli/commands/build.ts +63 -47
  176. package/src/cli/commands/dev.ts +16 -33
  177. package/src/cli/commands/gen/env.ts +1 -1
  178. package/src/cli/commands/init.ts +17 -8
  179. package/src/cli/commands/lint.ts +1 -1
  180. package/src/cli/defineConfig.ts +9 -0
  181. package/src/cli/index.ts +2 -1
  182. package/src/cli/providers/AppEntryProvider.ts +131 -0
  183. package/src/cli/providers/ViteBuildProvider.ts +82 -0
  184. package/src/cli/providers/ViteDevServerProvider.ts +350 -0
  185. package/src/cli/providers/ViteTemplateProvider.ts +27 -0
  186. package/src/cli/services/AlephaCliUtils.ts +33 -2
  187. package/src/cli/services/PackageManagerUtils.ts +13 -6
  188. package/src/cli/services/ProjectScaffolder.ts +72 -49
  189. package/src/core/Alepha.ts +2 -8
  190. package/src/core/primitives/$module.ts +12 -0
  191. package/src/core/providers/KeylessJsonSchemaCodec.spec.ts +257 -0
  192. package/src/core/providers/KeylessJsonSchemaCodec.ts +396 -14
  193. package/src/core/providers/SchemaValidator.spec.ts +236 -0
  194. package/src/logger/providers/PrettyFormatterProvider.ts +0 -9
  195. package/src/mcp/errors/McpError.ts +30 -0
  196. package/src/mcp/index.ts +3 -0
  197. package/src/mcp/transports/SseMcpTransport.ts +16 -6
  198. package/src/orm/providers/DrizzleKitProvider.ts +3 -5
  199. package/src/orm/services/Repository.ts +11 -0
  200. package/src/server/core/index.ts +1 -1
  201. package/src/server/core/providers/BunHttpServerProvider.ts +1 -1
  202. package/src/server/core/providers/NodeHttpServerProvider.spec.ts +125 -0
  203. package/src/server/core/providers/NodeHttpServerProvider.ts +71 -22
  204. package/src/server/core/providers/ServerLoggerProvider.ts +2 -2
  205. package/src/server/core/providers/ServerProvider.ts +9 -12
  206. package/src/server/links/atoms/apiLinksAtom.ts +7 -0
  207. package/src/server/links/index.browser.ts +2 -0
  208. package/src/server/links/index.ts +2 -0
  209. package/src/vite/index.ts +3 -2
  210. package/src/vite/tasks/buildClient.ts +0 -1
  211. package/src/vite/tasks/buildServer.ts +68 -21
  212. package/src/vite/tasks/copyAssets.ts +5 -4
  213. package/src/vite/tasks/generateSitemap.ts +64 -23
  214. package/src/vite/tasks/index.ts +0 -2
  215. package/src/vite/tasks/prerenderPages.ts +49 -24
  216. package/src/cli/assets/indexHtml.ts +0 -15
  217. package/src/cli/commands/format.ts +0 -23
  218. package/src/vite/helpers/boot.ts +0 -117
  219. package/src/vite/plugins/viteAlephaDev.ts +0 -177
  220. package/src/vite/tasks/devServer.ts +0 -71
  221. package/src/vite/tasks/runAlepha.ts +0 -270
  222. /package/dist/orm/{chunk-DtkW-qnP.js → chunk-DH6iiROE.js} +0 -0
@@ -1,10 +1,9 @@
1
- import * as alepha181 from "alepha";
1
+ import * as alepha206 from "alepha";
2
2
  import { Alepha, Async, KIND, Primitive, Static } from "alepha";
3
3
  import * as alepha_server_cookies0 from "alepha/server/cookies";
4
4
  import { Cookies, ServerCookiesProvider } from "alepha/server/cookies";
5
5
  import { DateTimeProvider } from "alepha/datetime";
6
6
  import { AccessTokenResponse, IssuerPrimitive, SecurityProvider, UserAccount } from "alepha/security";
7
- import { Configuration } from "openid-client";
8
7
  import * as alepha_logger0 from "alepha/logger";
9
8
  import * as alepha_server0 from "alepha/server";
10
9
  import { ServerLinksProvider } from "alepha/server/links";
@@ -20,45 +19,45 @@ declare const alephaServerAuthRoutes: {
20
19
  };
21
20
  //#endregion
22
21
  //#region ../../src/server/auth/schemas/authenticationProviderSchema.d.ts
23
- declare const authenticationProviderSchema: alepha181.TObject<{
24
- name: alepha181.TString;
25
- type: alepha181.TUnsafe<"OAUTH2" | "OIDC" | "CREDENTIALS">;
22
+ declare const authenticationProviderSchema: alepha206.TObject<{
23
+ name: alepha206.TString;
24
+ type: alepha206.TUnsafe<"OAUTH2" | "OIDC" | "CREDENTIALS">;
26
25
  }>;
27
26
  type AuthenticationProvider = Static<typeof authenticationProviderSchema>;
28
27
  //#endregion
29
28
  //#region ../../src/server/auth/schemas/tokenResponseSchema.d.ts
30
- declare const tokenResponseSchema: alepha181.TObject<{
31
- provider: alepha181.TString;
32
- access_token: alepha181.TString;
33
- issued_at: alepha181.TNumber;
34
- expires_in: alepha181.TOptional<alepha181.TNumber>;
35
- refresh_token: alepha181.TOptional<alepha181.TString>;
36
- refresh_token_expires_in: alepha181.TOptional<alepha181.TNumber>;
37
- refresh_expires_in: alepha181.TOptional<alepha181.TNumber>;
38
- id_token: alepha181.TOptional<alepha181.TString>;
39
- scope: alepha181.TOptional<alepha181.TString>;
40
- user: alepha181.TObject<{
41
- id: alepha181.TString;
42
- name: alepha181.TOptional<alepha181.TString>;
43
- email: alepha181.TOptional<alepha181.TString>;
44
- username: alepha181.TOptional<alepha181.TString>;
45
- picture: alepha181.TOptional<alepha181.TString>;
46
- sessionId: alepha181.TOptional<alepha181.TString>;
47
- organizations: alepha181.TOptional<alepha181.TArray<alepha181.TString>>;
48
- roles: alepha181.TOptional<alepha181.TArray<alepha181.TString>>;
29
+ declare const tokenResponseSchema: alepha206.TObject<{
30
+ provider: alepha206.TString;
31
+ access_token: alepha206.TString;
32
+ issued_at: alepha206.TNumber;
33
+ expires_in: alepha206.TOptional<alepha206.TNumber>;
34
+ refresh_token: alepha206.TOptional<alepha206.TString>;
35
+ refresh_token_expires_in: alepha206.TOptional<alepha206.TNumber>;
36
+ refresh_expires_in: alepha206.TOptional<alepha206.TNumber>;
37
+ id_token: alepha206.TOptional<alepha206.TString>;
38
+ scope: alepha206.TOptional<alepha206.TString>;
39
+ user: alepha206.TObject<{
40
+ id: alepha206.TString;
41
+ name: alepha206.TOptional<alepha206.TString>;
42
+ email: alepha206.TOptional<alepha206.TString>;
43
+ username: alepha206.TOptional<alepha206.TString>;
44
+ picture: alepha206.TOptional<alepha206.TString>;
45
+ sessionId: alepha206.TOptional<alepha206.TString>;
46
+ organizations: alepha206.TOptional<alepha206.TArray<alepha206.TString>>;
47
+ roles: alepha206.TOptional<alepha206.TArray<alepha206.TString>>;
49
48
  }>;
50
- api: alepha181.TObject<{
51
- prefix: alepha181.TOptional<alepha181.TString>;
52
- links: alepha181.TArray<alepha181.TObject<{
53
- name: alepha181.TString;
54
- group: alepha181.TOptional<alepha181.TString>;
55
- path: alepha181.TString;
56
- method: alepha181.TOptional<alepha181.TString>;
57
- requestBodyType: alepha181.TOptional<alepha181.TString>;
58
- service: alepha181.TOptional<alepha181.TString>;
59
- rawSchema: alepha181.TOptional<alepha181.TObject<{
60
- body: alepha181.TOptional<alepha181.TString>;
61
- response: alepha181.TOptional<alepha181.TString>;
49
+ api: alepha206.TObject<{
50
+ prefix: alepha206.TOptional<alepha206.TString>;
51
+ links: alepha206.TArray<alepha206.TObject<{
52
+ name: alepha206.TString;
53
+ group: alepha206.TOptional<alepha206.TString>;
54
+ path: alepha206.TString;
55
+ method: alepha206.TOptional<alepha206.TString>;
56
+ requestBodyType: alepha206.TOptional<alepha206.TString>;
57
+ service: alepha206.TOptional<alepha206.TString>;
58
+ rawSchema: alepha206.TOptional<alepha206.TObject<{
59
+ body: alepha206.TOptional<alepha206.TString>;
60
+ response: alepha206.TOptional<alepha206.TString>;
62
61
  }>>;
63
62
  }>>;
64
63
  }>;
@@ -66,49 +65,1075 @@ declare const tokenResponseSchema: alepha181.TObject<{
66
65
  type TokenResponse = Static<typeof tokenResponseSchema>;
67
66
  //#endregion
68
67
  //#region ../../src/server/auth/schemas/tokensSchema.d.ts
69
- declare const tokensSchema: alepha181.TObject<{
70
- provider: alepha181.TString;
71
- access_token: alepha181.TString;
72
- issued_at: alepha181.TNumber;
73
- expires_in: alepha181.TOptional<alepha181.TNumber>;
74
- refresh_token: alepha181.TOptional<alepha181.TString>;
75
- refresh_token_expires_in: alepha181.TOptional<alepha181.TNumber>;
76
- refresh_expires_in: alepha181.TOptional<alepha181.TNumber>;
77
- id_token: alepha181.TOptional<alepha181.TString>;
78
- scope: alepha181.TOptional<alepha181.TString>;
68
+ declare const tokensSchema: alepha206.TObject<{
69
+ provider: alepha206.TString;
70
+ access_token: alepha206.TString;
71
+ issued_at: alepha206.TNumber;
72
+ expires_in: alepha206.TOptional<alepha206.TNumber>;
73
+ refresh_token: alepha206.TOptional<alepha206.TString>;
74
+ refresh_token_expires_in: alepha206.TOptional<alepha206.TNumber>;
75
+ refresh_expires_in: alepha206.TOptional<alepha206.TNumber>;
76
+ id_token: alepha206.TOptional<alepha206.TString>;
77
+ scope: alepha206.TOptional<alepha206.TString>;
79
78
  }>;
80
79
  type Tokens = Static<typeof tokensSchema>;
81
80
  //#endregion
82
81
  //#region ../../src/server/auth/schemas/userinfoResponseSchema.d.ts
83
- declare const userinfoResponseSchema: alepha181.TObject<{
84
- user: alepha181.TOptional<alepha181.TObject<{
85
- id: alepha181.TString;
86
- name: alepha181.TOptional<alepha181.TString>;
87
- email: alepha181.TOptional<alepha181.TString>;
88
- username: alepha181.TOptional<alepha181.TString>;
89
- picture: alepha181.TOptional<alepha181.TString>;
90
- sessionId: alepha181.TOptional<alepha181.TString>;
91
- organizations: alepha181.TOptional<alepha181.TArray<alepha181.TString>>;
92
- roles: alepha181.TOptional<alepha181.TArray<alepha181.TString>>;
82
+ declare const userinfoResponseSchema: alepha206.TObject<{
83
+ user: alepha206.TOptional<alepha206.TObject<{
84
+ id: alepha206.TString;
85
+ name: alepha206.TOptional<alepha206.TString>;
86
+ email: alepha206.TOptional<alepha206.TString>;
87
+ username: alepha206.TOptional<alepha206.TString>;
88
+ picture: alepha206.TOptional<alepha206.TString>;
89
+ sessionId: alepha206.TOptional<alepha206.TString>;
90
+ organizations: alepha206.TOptional<alepha206.TArray<alepha206.TString>>;
91
+ roles: alepha206.TOptional<alepha206.TArray<alepha206.TString>>;
93
92
  }>>;
94
- api: alepha181.TObject<{
95
- prefix: alepha181.TOptional<alepha181.TString>;
96
- links: alepha181.TArray<alepha181.TObject<{
97
- name: alepha181.TString;
98
- group: alepha181.TOptional<alepha181.TString>;
99
- path: alepha181.TString;
100
- method: alepha181.TOptional<alepha181.TString>;
101
- requestBodyType: alepha181.TOptional<alepha181.TString>;
102
- service: alepha181.TOptional<alepha181.TString>;
103
- rawSchema: alepha181.TOptional<alepha181.TObject<{
104
- body: alepha181.TOptional<alepha181.TString>;
105
- response: alepha181.TOptional<alepha181.TString>;
93
+ api: alepha206.TObject<{
94
+ prefix: alepha206.TOptional<alepha206.TString>;
95
+ links: alepha206.TArray<alepha206.TObject<{
96
+ name: alepha206.TString;
97
+ group: alepha206.TOptional<alepha206.TString>;
98
+ path: alepha206.TString;
99
+ method: alepha206.TOptional<alepha206.TString>;
100
+ requestBodyType: alepha206.TOptional<alepha206.TString>;
101
+ service: alepha206.TOptional<alepha206.TString>;
102
+ rawSchema: alepha206.TOptional<alepha206.TObject<{
103
+ body: alepha206.TOptional<alepha206.TString>;
104
+ response: alepha206.TOptional<alepha206.TString>;
106
105
  }>>;
107
106
  }>>;
108
107
  }>;
109
108
  }>;
110
109
  type UserinfoResponse = Static<typeof userinfoResponseSchema>;
111
110
  //#endregion
111
+ //#region ../../../../node_modules/oauth4webapi/build/index.d.ts
112
+ /**
113
+ * JSON Object
114
+ */
115
+ type JsonObject = { [Key in string]?: JsonValue };
116
+ /**
117
+ * JSON Array
118
+ */
119
+ type JsonArray = JsonValue[];
120
+ /**
121
+ * JSON Primitives
122
+ */
123
+ type JsonPrimitive = string | number | boolean | null;
124
+ /**
125
+ * JSON Values
126
+ */
127
+ type JsonValue = JsonPrimitive | JsonObject | JsonArray;
128
+ /**
129
+ * Use to adjust the assumed current time. Positive and negative finite values representing seconds
130
+ * are allowed. Default is `0` (Date.now() + 0 seconds is used).
131
+ *
132
+ * @example
133
+ *
134
+ * When the local clock is mistakenly 1 hour in the past
135
+ *
136
+ * ```ts
137
+ * let client: oauth.Client = {
138
+ * client_id: 'abc4ba37-4ab8-49b5-99d4-9441ba35d428',
139
+ * // ... other metadata
140
+ * [oauth.clockSkew]: +(60 * 60),
141
+ * }
142
+ * ```
143
+ *
144
+ * @example
145
+ *
146
+ * When the local clock is mistakenly 1 hour in the future
147
+ *
148
+ * ```ts
149
+ * let client: oauth.Client = {
150
+ * client_id: 'abc4ba37-4ab8-49b5-99d4-9441ba35d428',
151
+ * // ... other metadata
152
+ * [oauth.clockSkew]: -(60 * 60),
153
+ * }
154
+ * ```
155
+ */
156
+ declare const clockSkew: unique symbol;
157
+ /**
158
+ * Use to set allowed clock tolerance when checking DateTime JWT Claims. Only positive finite values
159
+ * representing seconds are allowed. Default is `30` (30 seconds).
160
+ *
161
+ * @example
162
+ *
163
+ * Tolerate 30 seconds clock skew when validating JWT claims like exp or nbf.
164
+ *
165
+ * ```ts
166
+ * let client: oauth.Client = {
167
+ * client_id: 'abc4ba37-4ab8-49b5-99d4-9441ba35d428',
168
+ * // ... other metadata
169
+ * [oauth.clockTolerance]: 30,
170
+ * }
171
+ * ```
172
+ */
173
+ declare const clockTolerance: unique symbol;
174
+ /**
175
+ * When configured on an interface that extends {@link HttpRequestOptions}, this applies to `options`
176
+ * parameter for functions that may trigger HTTP requests, this replaces the use of global fetch. As
177
+ * a fetch replacement the arguments and expected return are the same as fetch.
178
+ *
179
+ * In theory any module that claims to be compatible with the Fetch API can be used but your mileage
180
+ * may vary. No workarounds to allow use of non-conform {@link !Response}s will be considered.
181
+ *
182
+ * If you only need to update the {@link !Request} properties you do not need to use a Fetch API
183
+ * module, just change what you need and pass it to globalThis.fetch just like this module would
184
+ * normally do.
185
+ *
186
+ * Its intended use cases are:
187
+ *
188
+ * - {@link !Request}/{@link !Response} tracing and logging
189
+ * - Custom caching strategies for responses of Authorization Server Metadata and JSON Web Key Set
190
+ * (JWKS) endpoints
191
+ * - Changing the {@link !Request} properties like headers, body, credentials, mode before it is passed
192
+ * to fetch
193
+ *
194
+ * Known caveats:
195
+ *
196
+ * - Expect Type-related issues when passing the inputs through to fetch-like modules, they hardly
197
+ * ever get their typings inline with actual fetch, you should `@ts-expect-error` them.
198
+ *
199
+ * @example
200
+ *
201
+ * Using [sindresorhus/ky](https://github.com/sindresorhus/ky) for retries and its hooks feature for
202
+ * logging outgoing requests and their responses.
203
+ *
204
+ * ```js
205
+ * import ky from 'ky'
206
+ *
207
+ * // example use
208
+ * await oauth.discoveryRequest(new URL('https://as.example.com'), {
209
+ * [oauth.customFetch]: (...args) =>
210
+ * ky(args[0], {
211
+ * ...args[1],
212
+ * hooks: {
213
+ * beforeRequest: [
214
+ * (request) => {
215
+ * logRequest(request)
216
+ * },
217
+ * ],
218
+ * beforeRetry: [
219
+ * ({ request, error, retryCount }) => {
220
+ * logRetry(request, error, retryCount)
221
+ * },
222
+ * ],
223
+ * afterResponse: [
224
+ * (request, _, response) => {
225
+ * logResponse(request, response)
226
+ * },
227
+ * ],
228
+ * },
229
+ * }),
230
+ * })
231
+ * ```
232
+ *
233
+ * @example
234
+ *
235
+ * Using [nodejs/undici](https://github.com/nodejs/undici) to detect and use HTTP proxies.
236
+ *
237
+ * ```ts
238
+ * import * as undici from 'undici'
239
+ *
240
+ * // see https://undici.nodejs.org/#/docs/api/EnvHttpProxyAgent
241
+ * let envHttpProxyAgent = new undici.EnvHttpProxyAgent()
242
+ *
243
+ * // example use
244
+ * await oauth.discoveryRequest(new URL('https://as.example.com'), {
245
+ * // @ts-ignore
246
+ * [oauth.customFetch](...args) {
247
+ * return undici.fetch(args[0], { ...args[1], dispatcher: envHttpProxyAgent }) // prettier-ignore
248
+ * },
249
+ * })
250
+ * ```
251
+ *
252
+ * @example
253
+ *
254
+ * Using [nodejs/undici](https://github.com/nodejs/undici) to automatically retry network errors.
255
+ *
256
+ * ```ts
257
+ * import * as undici from 'undici'
258
+ *
259
+ * // see https://undici.nodejs.org/#/docs/api/RetryAgent
260
+ * let retryAgent = new undici.RetryAgent(new undici.Agent(), {
261
+ * statusCodes: [],
262
+ * errorCodes: [
263
+ * 'ECONNRESET',
264
+ * 'ECONNREFUSED',
265
+ * 'ENOTFOUND',
266
+ * 'ENETDOWN',
267
+ * 'ENETUNREACH',
268
+ * 'EHOSTDOWN',
269
+ * 'UND_ERR_SOCKET',
270
+ * ],
271
+ * })
272
+ *
273
+ * // example use
274
+ * await oauth.discoveryRequest(new URL('https://as.example.com'), {
275
+ * // @ts-ignore
276
+ * [oauth.customFetch](...args) {
277
+ * return undici.fetch(args[0], { ...args[1], dispatcher: retryAgent }) // prettier-ignore
278
+ * },
279
+ * })
280
+ * ```
281
+ *
282
+ * @example
283
+ *
284
+ * Using [nodejs/undici](https://github.com/nodejs/undici) to mock responses in tests.
285
+ *
286
+ * ```ts
287
+ * import * as undici from 'undici'
288
+ *
289
+ * // see https://undici.nodejs.org/#/docs/api/MockAgent
290
+ * let mockAgent = new undici.MockAgent()
291
+ * mockAgent.disableNetConnect()
292
+ *
293
+ * // example use
294
+ * await oauth.discoveryRequest(new URL('https://as.example.com'), {
295
+ * // @ts-ignore
296
+ * [oauth.customFetch](...args) {
297
+ * return undici.fetch(args[0], { ...args[1], dispatcher: mockAgent }) // prettier-ignore
298
+ * },
299
+ * })
300
+ * ```
301
+ */
302
+ declare const customFetch$1: unique symbol;
303
+ /**
304
+ * Authorization Server Metadata
305
+ *
306
+ * @group Authorization Server Metadata
307
+ *
308
+ * @see [IANA OAuth Authorization Server Metadata registry](https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#authorization-server-metadata)
309
+ */
310
+ interface AuthorizationServer {
311
+ /**
312
+ * Authorization server's Issuer Identifier URL.
313
+ */
314
+ readonly issuer: string;
315
+ /**
316
+ * URL of the authorization server's authorization endpoint.
317
+ */
318
+ readonly authorization_endpoint?: string;
319
+ /**
320
+ * URL of the authorization server's token endpoint.
321
+ */
322
+ readonly token_endpoint?: string;
323
+ /**
324
+ * URL of the authorization server's JWK Set document.
325
+ */
326
+ readonly jwks_uri?: string;
327
+ /**
328
+ * URL of the authorization server's Dynamic Client Registration Endpoint.
329
+ */
330
+ readonly registration_endpoint?: string;
331
+ /**
332
+ * JSON array containing a list of the `scope` values that this authorization server supports.
333
+ */
334
+ readonly scopes_supported?: string[];
335
+ /**
336
+ * JSON array containing a list of the `response_type` values that this authorization server
337
+ * supports.
338
+ */
339
+ readonly response_types_supported?: string[];
340
+ /**
341
+ * JSON array containing a list of the `response_mode` values that this authorization server
342
+ * supports.
343
+ */
344
+ readonly response_modes_supported?: string[];
345
+ /**
346
+ * JSON array containing a list of the `grant_type` values that this authorization server
347
+ * supports.
348
+ */
349
+ readonly grant_types_supported?: string[];
350
+ /**
351
+ * JSON array containing a list of client authentication methods supported by this token endpoint.
352
+ */
353
+ readonly token_endpoint_auth_methods_supported?: string[];
354
+ /**
355
+ * JSON array containing a list of the JWS signing algorithms supported by the token endpoint for
356
+ * the signature on the JWT used to authenticate the client at the token endpoint.
357
+ */
358
+ readonly token_endpoint_auth_signing_alg_values_supported?: string[];
359
+ /**
360
+ * URL of a page containing human-readable information that developers might want or need to know
361
+ * when using the authorization server.
362
+ */
363
+ readonly service_documentation?: string;
364
+ /**
365
+ * Languages and scripts supported for the user interface, represented as a JSON array of language
366
+ * tag values from RFC 5646.
367
+ */
368
+ readonly ui_locales_supported?: string[];
369
+ /**
370
+ * URL that the authorization server provides to the person registering the client to read about
371
+ * the authorization server's requirements on how the client can use the data provided by the
372
+ * authorization server.
373
+ */
374
+ readonly op_policy_uri?: string;
375
+ /**
376
+ * URL that the authorization server provides to the person registering the client to read about
377
+ * the authorization server's terms of service.
378
+ */
379
+ readonly op_tos_uri?: string;
380
+ /**
381
+ * URL of the authorization server's revocation endpoint.
382
+ */
383
+ readonly revocation_endpoint?: string;
384
+ /**
385
+ * JSON array containing a list of client authentication methods supported by this revocation
386
+ * endpoint.
387
+ */
388
+ readonly revocation_endpoint_auth_methods_supported?: string[];
389
+ /**
390
+ * JSON array containing a list of the JWS signing algorithms supported by the revocation endpoint
391
+ * for the signature on the JWT used to authenticate the client at the revocation endpoint.
392
+ */
393
+ readonly revocation_endpoint_auth_signing_alg_values_supported?: string[];
394
+ /**
395
+ * URL of the authorization server's introspection endpoint.
396
+ */
397
+ readonly introspection_endpoint?: string;
398
+ /**
399
+ * JSON array containing a list of client authentication methods supported by this introspection
400
+ * endpoint.
401
+ */
402
+ readonly introspection_endpoint_auth_methods_supported?: string[];
403
+ /**
404
+ * JSON array containing a list of the JWS signing algorithms supported by the introspection
405
+ * endpoint for the signature on the JWT used to authenticate the client at the introspection
406
+ * endpoint.
407
+ */
408
+ readonly introspection_endpoint_auth_signing_alg_values_supported?: string[];
409
+ /**
410
+ * PKCE code challenge methods supported by this authorization server.
411
+ */
412
+ readonly code_challenge_methods_supported?: string[];
413
+ /**
414
+ * Signed JWT containing metadata values about the authorization server as claims.
415
+ */
416
+ readonly signed_metadata?: string;
417
+ /**
418
+ * URL of the authorization server's device authorization endpoint.
419
+ */
420
+ readonly device_authorization_endpoint?: string;
421
+ /**
422
+ * Indicates authorization server support for mutual-TLS client certificate-bound access tokens.
423
+ */
424
+ readonly tls_client_certificate_bound_access_tokens?: boolean;
425
+ /**
426
+ * JSON object containing alternative authorization server endpoints, which a client intending to
427
+ * do mutual TLS will use in preference to the conventional endpoints.
428
+ */
429
+ readonly mtls_endpoint_aliases?: MTLSEndpointAliases;
430
+ /**
431
+ * URL of the authorization server's UserInfo Endpoint.
432
+ */
433
+ readonly userinfo_endpoint?: string;
434
+ /**
435
+ * JSON array containing a list of the Authentication Context Class References that this
436
+ * authorization server supports.
437
+ */
438
+ readonly acr_values_supported?: string[];
439
+ /**
440
+ * JSON array containing a list of the Subject Identifier types that this authorization server
441
+ * supports.
442
+ */
443
+ readonly subject_types_supported?: string[];
444
+ /**
445
+ * JSON array containing a list of the JWS `alg` values supported by the authorization server for
446
+ * the ID Token.
447
+ */
448
+ readonly id_token_signing_alg_values_supported?: string[];
449
+ /**
450
+ * JSON array containing a list of the JWE `alg` values supported by the authorization server for
451
+ * the ID Token.
452
+ */
453
+ readonly id_token_encryption_alg_values_supported?: string[];
454
+ /**
455
+ * JSON array containing a list of the JWE `enc` values supported by the authorization server for
456
+ * the ID Token.
457
+ */
458
+ readonly id_token_encryption_enc_values_supported?: string[];
459
+ /**
460
+ * JSON array containing a list of the JWS `alg` values supported by the UserInfo Endpoint.
461
+ */
462
+ readonly userinfo_signing_alg_values_supported?: string[];
463
+ /**
464
+ * JSON array containing a list of the JWE `alg` values supported by the UserInfo Endpoint.
465
+ */
466
+ readonly userinfo_encryption_alg_values_supported?: string[];
467
+ /**
468
+ * JSON array containing a list of the JWE `enc` values supported by the UserInfo Endpoint.
469
+ */
470
+ readonly userinfo_encryption_enc_values_supported?: string[];
471
+ /**
472
+ * JSON array containing a list of the JWS `alg` values supported by the authorization server for
473
+ * Request Objects.
474
+ */
475
+ readonly request_object_signing_alg_values_supported?: string[];
476
+ /**
477
+ * JSON array containing a list of the JWE `alg` values supported by the authorization server for
478
+ * Request Objects.
479
+ */
480
+ readonly request_object_encryption_alg_values_supported?: string[];
481
+ /**
482
+ * JSON array containing a list of the JWE `enc` values supported by the authorization server for
483
+ * Request Objects.
484
+ */
485
+ readonly request_object_encryption_enc_values_supported?: string[];
486
+ /**
487
+ * JSON array containing a list of the `display` parameter values that the authorization server
488
+ * supports.
489
+ */
490
+ readonly display_values_supported?: string[];
491
+ /**
492
+ * JSON array containing a list of the Claim Types that the authorization server supports.
493
+ */
494
+ readonly claim_types_supported?: string[];
495
+ /**
496
+ * JSON array containing a list of the Claim Names of the Claims that the authorization server MAY
497
+ * be able to supply values for.
498
+ */
499
+ readonly claims_supported?: string[];
500
+ /**
501
+ * Languages and scripts supported for values in Claims being returned, represented as a JSON
502
+ * array of RFC 5646 language tag values.
503
+ */
504
+ readonly claims_locales_supported?: string[];
505
+ /**
506
+ * Boolean value specifying whether the authorization server supports use of the `claims`
507
+ * parameter.
508
+ */
509
+ readonly claims_parameter_supported?: boolean;
510
+ /**
511
+ * Boolean value specifying whether the authorization server supports use of the `request`
512
+ * parameter.
513
+ */
514
+ readonly request_parameter_supported?: boolean;
515
+ /**
516
+ * Boolean value specifying whether the authorization server supports use of the `request_uri`
517
+ * parameter.
518
+ */
519
+ readonly request_uri_parameter_supported?: boolean;
520
+ /**
521
+ * Boolean value specifying whether the authorization server requires any `request_uri` values
522
+ * used to be pre-registered.
523
+ */
524
+ readonly require_request_uri_registration?: boolean;
525
+ /**
526
+ * Indicates where authorization request needs to be protected as Request Object and provided
527
+ * through either `request` or `request_uri` parameter.
528
+ */
529
+ readonly require_signed_request_object?: boolean;
530
+ /**
531
+ * URL of the authorization server's pushed authorization request endpoint.
532
+ */
533
+ readonly pushed_authorization_request_endpoint?: string;
534
+ /**
535
+ * Indicates whether the authorization server accepts authorization requests only via PAR.
536
+ */
537
+ readonly require_pushed_authorization_requests?: boolean;
538
+ /**
539
+ * JSON array containing a list of algorithms supported by the authorization server for
540
+ * introspection response signing.
541
+ */
542
+ readonly introspection_signing_alg_values_supported?: string[];
543
+ /**
544
+ * JSON array containing a list of algorithms supported by the authorization server for
545
+ * introspection response content key encryption (`alg` value).
546
+ */
547
+ readonly introspection_encryption_alg_values_supported?: string[];
548
+ /**
549
+ * JSON array containing a list of algorithms supported by the authorization server for
550
+ * introspection response content encryption (`enc` value).
551
+ */
552
+ readonly introspection_encryption_enc_values_supported?: string[];
553
+ /**
554
+ * Boolean value indicating whether the authorization server provides the `iss` parameter in the
555
+ * authorization response.
556
+ */
557
+ readonly authorization_response_iss_parameter_supported?: boolean;
558
+ /**
559
+ * JSON array containing a list of algorithms supported by the authorization server for
560
+ * introspection response signing.
561
+ */
562
+ readonly authorization_signing_alg_values_supported?: string[];
563
+ /**
564
+ * JSON array containing a list of algorithms supported by the authorization server for
565
+ * introspection response encryption (`alg` value).
566
+ */
567
+ readonly authorization_encryption_alg_values_supported?: string[];
568
+ /**
569
+ * JSON array containing a list of algorithms supported by the authorization server for
570
+ * introspection response encryption (`enc` value).
571
+ */
572
+ readonly authorization_encryption_enc_values_supported?: string[];
573
+ /**
574
+ * CIBA Backchannel Authentication Endpoint.
575
+ */
576
+ readonly backchannel_authentication_endpoint?: string;
577
+ /**
578
+ * JSON array containing a list of the JWS signing algorithms supported for validation of signed
579
+ * CIBA authentication requests.
580
+ */
581
+ readonly backchannel_authentication_request_signing_alg_values_supported?: string[];
582
+ /**
583
+ * Supported CIBA authentication result delivery modes.
584
+ */
585
+ readonly backchannel_token_delivery_modes_supported?: string[];
586
+ /**
587
+ * Indicates whether the authorization server supports the use of the CIBA `user_code` parameter.
588
+ */
589
+ readonly backchannel_user_code_parameter_supported?: boolean;
590
+ /**
591
+ * URL of an authorization server iframe that supports cross-origin communications for session
592
+ * state information with the RP Client, using the HTML5 postMessage API.
593
+ */
594
+ readonly check_session_iframe?: string;
595
+ /**
596
+ * JSON array containing a list of the JWS algorithms supported for DPoP Proof JWTs.
597
+ */
598
+ readonly dpop_signing_alg_values_supported?: string[];
599
+ /**
600
+ * URL at the authorization server to which an RP can perform a redirect to request that the
601
+ * End-User be logged out at the authorization server.
602
+ */
603
+ readonly end_session_endpoint?: string;
604
+ /**
605
+ * Boolean value specifying whether the authorization server can pass `iss` (issuer) and `sid`
606
+ * (session ID) query parameters to identify the RP session with the authorization server when the
607
+ * `frontchannel_logout_uri` is used.
608
+ */
609
+ readonly frontchannel_logout_session_supported?: boolean;
610
+ /**
611
+ * Boolean value specifying whether the authorization server supports HTTP-based logout.
612
+ */
613
+ readonly frontchannel_logout_supported?: boolean;
614
+ /**
615
+ * Boolean value specifying whether the authorization server can pass a `sid` (session ID) Claim
616
+ * in the Logout Token to identify the RP session with the OP.
617
+ */
618
+ readonly backchannel_logout_session_supported?: boolean;
619
+ /**
620
+ * Boolean value specifying whether the authorization server supports back-channel logout.
621
+ */
622
+ readonly backchannel_logout_supported?: boolean;
623
+ /**
624
+ * JSON array containing a list of resource identifiers for OAuth protected resources.
625
+ */
626
+ readonly protected_resources?: string[];
627
+ readonly [metadata: string]: JsonValue | undefined;
628
+ }
629
+ interface MTLSEndpointAliases extends Pick<AuthorizationServer, 'backchannel_authentication_endpoint' | 'device_authorization_endpoint' | 'introspection_endpoint' | 'pushed_authorization_request_endpoint' | 'revocation_endpoint' | 'token_endpoint' | 'userinfo_endpoint'> {
630
+ readonly [metadata: string]: string | undefined;
631
+ }
632
+ /**
633
+ * Recognized Client Metadata that have an effect on the exposed functionality.
634
+ *
635
+ * @see [IANA OAuth Client Registration Metadata registry](https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#client-metadata)
636
+ */
637
+ interface Client {
638
+ /**
639
+ * Client identifier.
640
+ */
641
+ client_id: string;
642
+ /**
643
+ * JWS `alg` algorithm required for signing the ID Token issued to this Client. When not
644
+ * configured the default is to allow only algorithms listed in
645
+ * {@link AuthorizationServer.id_token_signing_alg_values_supported `as.id_token_signing_alg_values_supported`}
646
+ * and fall back to `RS256` when the authorization server metadata is not set.
647
+ */
648
+ id_token_signed_response_alg?: string;
649
+ /**
650
+ * JWS `alg` algorithm required for signing authorization responses. When not configured the
651
+ * default is to allow only algorithms listed in
652
+ * {@link AuthorizationServer.authorization_signing_alg_values_supported `as.authorization_signing_alg_values_supported`}
653
+ * and fall back to `RS256` when the authorization server metadata is not set.
654
+ */
655
+ authorization_signed_response_alg?: string;
656
+ /**
657
+ * Boolean value specifying whether the {@link IDToken.auth_time `auth_time`} Claim in the ID Token
658
+ * is REQUIRED. Default is `false`.
659
+ */
660
+ require_auth_time?: boolean;
661
+ /**
662
+ * JWS `alg` algorithm REQUIRED for signing UserInfo Responses. When not configured the default is
663
+ * to allow only algorithms listed in
664
+ * {@link AuthorizationServer.userinfo_signing_alg_values_supported `as.userinfo_signing_alg_values_supported`}
665
+ * and fail otherwise.
666
+ */
667
+ userinfo_signed_response_alg?: string;
668
+ /**
669
+ * JWS `alg` algorithm REQUIRED for signed introspection responses. When not configured the
670
+ * default is to allow only algorithms listed in
671
+ * {@link AuthorizationServer.introspection_signing_alg_values_supported `as.introspection_signing_alg_values_supported`}
672
+ * and fall back to `RS256` when the authorization server metadata is not set.
673
+ */
674
+ introspection_signed_response_alg?: string;
675
+ /**
676
+ * Default Maximum Authentication Age.
677
+ */
678
+ default_max_age?: number;
679
+ /**
680
+ * Indicates the requirement for a client to use mutual TLS endpoint aliases defined by the AS
681
+ * where present. Default is `false`.
682
+ *
683
+ * When combined with {@link customFetch} (to use a Fetch API implementation that supports client
684
+ * certificates) this can be used to target security profiles that utilize Mutual-TLS for either
685
+ * client authentication or sender constraining.
686
+ *
687
+ * @example
688
+ *
689
+ * (Node.js) Using [nodejs/undici](https://github.com/nodejs/undici) for Mutual-TLS Client
690
+ * Authentication and Certificate-Bound Access Tokens support.
691
+ *
692
+ * ```ts
693
+ * import * as undici from 'undici'
694
+ *
695
+ * let as!: oauth.AuthorizationServer
696
+ * let client!: oauth.Client & { use_mtls_endpoint_aliases: true }
697
+ * let params!: URLSearchParams
698
+ * let key!: string // PEM-encoded key
699
+ * let cert!: string // PEM-encoded certificate
700
+ *
701
+ * let clientAuth = oauth.TlsClientAuth()
702
+ * let agent = new undici.Agent({ connect: { key, cert } })
703
+ *
704
+ * let response = await oauth.pushedAuthorizationRequest(as, client, clientAuth, params, {
705
+ * // @ts-ignore
706
+ * [oauth.customFetch]: (...args) =>
707
+ * undici.fetch(args[0], { ...args[1], dispatcher: agent }),
708
+ * })
709
+ * ```
710
+ *
711
+ * @example
712
+ *
713
+ * (Deno) Using Deno.createHttpClient API for Mutual-TLS Client Authentication and
714
+ * Certificate-Bound Access Tokens support.
715
+ *
716
+ * ```ts
717
+ * let as!: oauth.AuthorizationServer
718
+ * let client!: oauth.Client & { use_mtls_endpoint_aliases: true }
719
+ * let params!: URLSearchParams
720
+ * let key!: string // PEM-encoded key
721
+ * let cert!: string // PEM-encoded certificate
722
+ *
723
+ * let clientAuth = oauth.TlsClientAuth()
724
+ * // @ts-ignore
725
+ * let agent = Deno.createHttpClient({ key, cert })
726
+ *
727
+ * let response = await oauth.pushedAuthorizationRequest(as, client, clientAuth, params, {
728
+ * // @ts-ignore
729
+ * [oauth.customFetch]: (...args) => fetch(args[0], { ...args[1], client: agent }),
730
+ * })
731
+ * ```
732
+ *
733
+ * @see [RFC 8705 - OAuth 2.0 Mutual-TLS Client Authentication and Certificate-Bound Access Tokens](https://www.rfc-editor.org/rfc/rfc8705.html)
734
+ */
735
+ use_mtls_endpoint_aliases?: boolean;
736
+ /**
737
+ * See {@link clockSkew}.
738
+ */
739
+ [clockSkew]?: number;
740
+ /**
741
+ * See {@link clockTolerance}.
742
+ */
743
+ [clockTolerance]?: number;
744
+ [metadata: string]: JsonValue | undefined;
745
+ }
746
+ /**
747
+ * Removes all Symbol properties from a type
748
+ */
749
+ type OmitSymbolProperties<T> = { [K in keyof T as K extends symbol ? never : K]: T[K] };
750
+ //#endregion
751
+ //#region ../../../../node_modules/openid-client/build/index.d.ts
752
+ /**
753
+ * Implementation of the Client's Authentication Method at the Authorization
754
+ * Server.
755
+ *
756
+ * The default is {@link ClientSecretPost} if {@link ClientMetadata.client_secret}
757
+ * is present, {@link None} otherwise.
758
+ *
759
+ * Other Client Authentication Methods must be provided explicitly and their
760
+ * implementations are linked below.
761
+ *
762
+ * @see {@link ClientSecretBasic}
763
+ * @see {@link ClientSecretJwt}
764
+ * @see {@link ClientSecretPost}
765
+ * @see {@link None}
766
+ * @see {@link PrivateKeyJwt}
767
+ * @see {@link TlsClientAuth}
768
+ */
769
+ type ClientAuth = (as: ServerMetadata, client: ClientMetadata, body: URLSearchParams, headers: Headers) => void;
770
+ /**
771
+ * When set on a {@link Configuration}, this replaces the use of global fetch. As
772
+ * a fetch replacement the arguments and expected return are the same as fetch.
773
+ *
774
+ * In theory any module that claims to be compatible with the
775
+ * {@link !fetch Fetch API} can be used but your mileage may vary. No workarounds
776
+ * to allow use of non-conform {@link !Response} instances will be considered.
777
+ *
778
+ * If you only need to update the {@link !Request} properties you do not need to
779
+ * use a {@link !fetch Fetch API} module, just change what you need and pass it
780
+ * to globalThis.fetch just like this module would normally do.
781
+ *
782
+ * Its intended use cases are:
783
+ *
784
+ * - {@link !Request}/{@link !Response} tracing and logging
785
+ * - Custom caching strategies
786
+ * - Changing the {@link !Request} properties like headers, body, credentials, mode
787
+ * before it is passed to fetch
788
+ *
789
+ * Known caveats:
790
+ *
791
+ * - Expect Type-related issues when passing the inputs through to fetch-like
792
+ * modules, they hardly ever get their typings inline with actual fetch, you
793
+ * should `@ts-expect-error` them.
794
+ *
795
+ * @example
796
+ *
797
+ * Using [sindresorhus/ky](https://github.com/sindresorhus/ky) for retries and
798
+ * its hooks feature for logging outgoing requests and their responses.
799
+ *
800
+ * ```ts
801
+ * import ky from 'ky'
802
+ *
803
+ * let config!: client.Configuration
804
+ * let logRequest!: (request: Request) => void
805
+ * let logResponse!: (request: Request, response: Response) => void
806
+ * let logRetry!: (
807
+ * request: Request,
808
+ * error: Error,
809
+ * retryCount: number,
810
+ * ) => void
811
+ *
812
+ * config[client.customFetch] = (...args) =>
813
+ * // @ts-expect-error
814
+ * ky(args[0], {
815
+ * ...args[1],
816
+ * hooks: {
817
+ * beforeRequest: [
818
+ * (request) => {
819
+ * logRequest(request)
820
+ * },
821
+ * ],
822
+ * beforeRetry: [
823
+ * ({ request, error, retryCount }) => {
824
+ * logRetry(request, error, retryCount)
825
+ * },
826
+ * ],
827
+ * afterResponse: [
828
+ * (request, _, response) => {
829
+ * logResponse(request, response)
830
+ * },
831
+ * ],
832
+ * },
833
+ * })
834
+ * ```
835
+ *
836
+ * @example
837
+ *
838
+ * Using [nodejs/undici](https://github.com/nodejs/undici) to detect and use
839
+ * HTTP proxies.
840
+ *
841
+ * ```ts
842
+ * import * as undici from 'undici'
843
+ *
844
+ * // see https://undici.nodejs.org/#/docs/api/EnvHttpProxyAgent
845
+ * let envHttpProxyAgent = new undici.EnvHttpProxyAgent()
846
+ *
847
+ * let config!: client.Configuration
848
+ *
849
+ * // @ts-ignore
850
+ * config[client.customFetch] = (...args) => {
851
+ * // @ts-ignore
852
+ * return undici.fetch(args[0], { ...args[1], dispatcher: envHttpProxyAgent }) // prettier-ignore
853
+ * }
854
+ * ```
855
+ *
856
+ * @example
857
+ *
858
+ * Using [nodejs/undici](https://github.com/nodejs/undici) to automatically
859
+ * retry network errors.
860
+ *
861
+ * ```ts
862
+ * import * as undici from 'undici'
863
+ *
864
+ * // see https://undici.nodejs.org/#/docs/api/RetryAgent
865
+ * let retryAgent = new undici.RetryAgent(new undici.Agent(), {
866
+ * statusCodes: [],
867
+ * errorCodes: [
868
+ * 'ECONNRESET',
869
+ * 'ECONNREFUSED',
870
+ * 'ENOTFOUND',
871
+ * 'ENETDOWN',
872
+ * 'ENETUNREACH',
873
+ * 'EHOSTDOWN',
874
+ * 'UND_ERR_SOCKET',
875
+ * ],
876
+ * })
877
+ *
878
+ * let config!: client.Configuration
879
+ *
880
+ * // @ts-ignore
881
+ * config[client.customFetch] = (...args) => {
882
+ * // @ts-ignore
883
+ * return undici.fetch(args[0], { ...args[1], dispatcher: retryAgent }) // prettier-ignore
884
+ * }
885
+ * ```
886
+ *
887
+ * @example
888
+ *
889
+ * Using [nodejs/undici](https://github.com/nodejs/undici) to mock responses in
890
+ * tests.
891
+ *
892
+ * ```ts
893
+ * import * as undici from 'undici'
894
+ *
895
+ * // see https://undici.nodejs.org/#/docs/api/MockAgent
896
+ * let mockAgent = new undici.MockAgent()
897
+ * mockAgent.disableNetConnect()
898
+ *
899
+ * let config!: client.Configuration
900
+ *
901
+ * // @ts-ignore
902
+ * config[client.customFetch] = (...args) => {
903
+ * // @ts-ignore
904
+ * return undici.fetch(args[0], { ...args[1], dispatcher: mockAgent }) // prettier-ignore
905
+ * }
906
+ * ```
907
+ */
908
+ declare const customFetch: typeof customFetch$1;
909
+ type FetchBody = ArrayBuffer | null | ReadableStream | string | Uint8Array | undefined | URLSearchParams;
910
+ /**
911
+ * A subset of the [IANA OAuth Client Metadata
912
+ * registry](https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#client-metadata)
913
+ * that has an effect on how the Client functions
914
+ *
915
+ * @group You are probably looking for this
916
+ */
917
+ interface ClientMetadata extends Client {
918
+ /**
919
+ * Client secret.
920
+ */
921
+ client_secret?: string;
922
+ /**
923
+ * Indicates the requirement for a client to use mutual TLS endpoint aliases
924
+ * indicated by the
925
+ * {@link ServerMetadata.mtls_endpoint_aliases Authorization Server Metadata}.
926
+ * Default is `false`.
927
+ *
928
+ * When combined with {@link customFetch} (to use a {@link !fetch Fetch API}
929
+ * implementation that supports client certificates) this can be used to
930
+ * target security profiles that utilize Mutual-TLS for either client
931
+ * authentication or sender constraining.
932
+ *
933
+ * @example
934
+ *
935
+ * (Node.js) Using [nodejs/undici](https://github.com/nodejs/undici) for
936
+ * Mutual-TLS Client Authentication and Certificate-Bound Access Tokens
937
+ * support.
938
+ *
939
+ * ```ts
940
+ * import * as undici from 'undici'
941
+ *
942
+ * let config!: client.Configuration
943
+ * let key!: string // PEM-encoded key
944
+ * let cert!: string // PEM-encoded certificate
945
+ *
946
+ * let agent = new undici.Agent({ connect: { key, cert } })
947
+ *
948
+ * config[client.customFetch] = (...args) =>
949
+ * // @ts-expect-error
950
+ * undici.fetch(args[0], { ...args[1], dispatcher: agent })
951
+ * ```
952
+ *
953
+ * @example
954
+ *
955
+ * (Deno) Using Deno.createHttpClient API for Mutual-TLS Client Authentication
956
+ * and Certificate-Bound Access Tokens support.
957
+ *
958
+ * ```ts
959
+ * let config!: client.Configuration
960
+ * let key!: string // PEM-encoded key
961
+ * let cert!: string // PEM-encoded certificate
962
+ *
963
+ * // @ts-expect-error
964
+ * let agent = Deno.createHttpClient({ key, cert })
965
+ *
966
+ * config[client.customFetch] = (...args) =>
967
+ * // @ts-expect-error
968
+ * fetch(args[0], { ...args[1], client: agent })
969
+ * ```
970
+ *
971
+ * @see [RFC 8705 - OAuth 2.0 Mutual-TLS Client Authentication and Certificate-Bound Access Tokens](https://www.rfc-editor.org/rfc/rfc8705.html)
972
+ */
973
+ use_mtls_endpoint_aliases?: boolean;
974
+ }
975
+ /**
976
+ * Authorization Server Metadata
977
+ *
978
+ * @group You are probably looking for this
979
+ *
980
+ * @see [IANA OAuth Authorization Server Metadata registry](https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#authorization-server-metadata)
981
+ */
982
+ interface ServerMetadata extends AuthorizationServer {}
983
+ interface ServerMetadataHelpers {
984
+ /**
985
+ * Determines whether the Authorization Server supports a given Code Challenge
986
+ * Method
987
+ *
988
+ * @param method Code Challenge Method. Default is `S256`
989
+ */
990
+ supportsPKCE(method?: string): boolean;
991
+ }
992
+ /**
993
+ * Public methods available on a {@link Configuration} instance
994
+ */
995
+ interface ConfigurationMethods {
996
+ /**
997
+ * Used to retrieve the Authorization Server Metadata
998
+ */
999
+ serverMetadata(): Readonly<ServerMetadata> & ServerMetadataHelpers;
1000
+ /**
1001
+ * Used to retrieve the Client Metadata
1002
+ */
1003
+ clientMetadata(): Readonly<OmitSymbolProperties<ClientMetadata>>;
1004
+ }
1005
+ interface CustomFetchOptions {
1006
+ /**
1007
+ * The request body content to send to the server
1008
+ */
1009
+ body: FetchBody;
1010
+ /**
1011
+ * HTTP Headers
1012
+ */
1013
+ headers: Record<string, string>;
1014
+ /**
1015
+ * The
1016
+ * {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods request method}
1017
+ */
1018
+ method: string;
1019
+ /**
1020
+ * See {@link !Request.redirect}
1021
+ */
1022
+ redirect: 'manual';
1023
+ /**
1024
+ * An AbortSignal configured as per the {@link ConfigurationProperties.timeout}
1025
+ * value
1026
+ */
1027
+ signal?: AbortSignal;
1028
+ }
1029
+ /**
1030
+ * @see {@link customFetch}
1031
+ */
1032
+ type CustomFetch = (
1033
+ /**
1034
+ * URL the request is being made sent to {@link !fetch} as the `resource`
1035
+ * argument
1036
+ */
1037
+ url: string,
1038
+ /**
1039
+ * Options otherwise sent to {@link !fetch} as the `options` argument
1040
+ */
1041
+ options: CustomFetchOptions) => Promise<Response>;
1042
+ /**
1043
+ * Public properties available on a {@link Configuration} instance
1044
+ */
1045
+ interface ConfigurationProperties {
1046
+ /**
1047
+ * Custom {@link !fetch Fetch API} implementation to use for the HTTP Requests
1048
+ * the client will be making.
1049
+ *
1050
+ * @see {@link customFetch}
1051
+ */
1052
+ [customFetch]?: CustomFetch;
1053
+ /**
1054
+ * Timeout (in seconds) for the HTTP Requests the client will be making.
1055
+ * Default is `30` (seconds)
1056
+ */
1057
+ timeout?: number;
1058
+ }
1059
+ /**
1060
+ * Configuration is an abstraction over the
1061
+ * {@link ServerMetadata OAuth 2.0 Authorization Server metadata} and
1062
+ * {@link ClientMetadata OAuth 2.0 Client metadata}
1063
+ *
1064
+ * Configuration instances are obtained either through
1065
+ *
1066
+ * - (RECOMMENDED) the {@link discovery} function that discovers the
1067
+ * {@link ServerMetadata OAuth 2.0 Authorization Server metadata} using the
1068
+ * Authorization Server's Issuer Identifier, or
1069
+ * - The {@link Configuration} constructor if the
1070
+ * {@link ServerMetadata OAuth 2.0 Authorization Server metadata} is known
1071
+ * upfront
1072
+ *
1073
+ * @example
1074
+ *
1075
+ * (RECOMMENDED) Setting up a Configuration with a Server Metadata discovery
1076
+ * step
1077
+ *
1078
+ * ```ts
1079
+ * let server!: URL
1080
+ * let clientId!: string
1081
+ * let clientSecret!: string | undefined
1082
+ *
1083
+ * let config = await client.discovery(server, clientId, clientSecret)
1084
+ * ```
1085
+ *
1086
+ * @example
1087
+ *
1088
+ * Setting up a Configuration with a constructor
1089
+ *
1090
+ * ```ts
1091
+ * let server!: client.ServerMetadata
1092
+ * let clientId!: string
1093
+ * let clientSecret!: string | undefined
1094
+ *
1095
+ * let config = new client.Configuration(server, clientId, clientSecret)
1096
+ * ```
1097
+ *
1098
+ * @group Configuration
1099
+ */
1100
+ declare class Configuration implements ConfigurationMethods, ConfigurationProperties {
1101
+ /**
1102
+ * @param server Authorization Server Metadata
1103
+ * @param clientId Client Identifier at the Authorization Server
1104
+ * @param metadata Client Metadata, when a string is passed it is a shorthand
1105
+ * for passing just {@link ClientMetadata.client_secret}.
1106
+ * @param clientAuthentication Implementation of the Client's Authentication
1107
+ * Method at the Authorization Server. Default is {@link ClientSecretPost}
1108
+ * using the {@link ClientMetadata.client_secret}.
1109
+ */
1110
+ constructor(server: ServerMetadata, clientId: string, metadata?: Partial<ClientMetadata> | string, clientAuthentication?: ClientAuth);
1111
+ /**
1112
+ * @ignore
1113
+ */
1114
+ serverMetadata(): Readonly<ServerMetadata> & ServerMetadataHelpers;
1115
+ /**
1116
+ * @ignore
1117
+ */
1118
+ clientMetadata(): Readonly<OmitSymbolProperties<ClientMetadata>>;
1119
+ /**
1120
+ * @ignore
1121
+ */
1122
+ get timeout(): number | undefined;
1123
+ /**
1124
+ * @ignore
1125
+ */
1126
+ set timeout(value: number | undefined);
1127
+ /**
1128
+ * @ignore
1129
+ */
1130
+ get [customFetch](): CustomFetch | undefined;
1131
+ /**
1132
+ * @ignore
1133
+ */
1134
+ set [customFetch](value: CustomFetch);
1135
+ }
1136
+ //#endregion
112
1137
  //#region ../../src/server/auth/providers/ServerAuthProvider.d.ts
113
1138
  declare class ServerAuthProvider {
114
1139
  protected readonly log: alepha_logger0.Logger;
@@ -116,173 +1141,173 @@ declare class ServerAuthProvider {
116
1141
  protected readonly serverCookiesProvider: ServerCookiesProvider;
117
1142
  protected readonly dateTimeProvider: DateTimeProvider;
118
1143
  protected readonly serverLinksProvider: ServerLinksProvider;
119
- protected readonly authorizationCode: alepha_server_cookies0.AbstractCookiePrimitive<alepha181.TObject<{
120
- provider: alepha181.TString;
121
- realm: alepha181.TOptional<alepha181.TString>;
122
- codeVerifier: alepha181.TOptional<alepha181.TString>;
123
- redirectUri: alepha181.TOptional<alepha181.TString>;
124
- state: alepha181.TOptional<alepha181.TString>;
125
- nonce: alepha181.TOptional<alepha181.TString>;
1144
+ protected readonly authorizationCode: alepha_server_cookies0.AbstractCookiePrimitive<alepha206.TObject<{
1145
+ provider: alepha206.TString;
1146
+ realm: alepha206.TOptional<alepha206.TString>;
1147
+ codeVerifier: alepha206.TOptional<alepha206.TString>;
1148
+ redirectUri: alepha206.TOptional<alepha206.TString>;
1149
+ state: alepha206.TOptional<alepha206.TString>;
1150
+ nonce: alepha206.TOptional<alepha206.TString>;
126
1151
  }>>;
127
- readonly tokens: alepha_server_cookies0.AbstractCookiePrimitive<alepha181.TObject<{
128
- provider: alepha181.TString;
129
- access_token: alepha181.TString;
130
- issued_at: alepha181.TNumber;
131
- expires_in: alepha181.TOptional<alepha181.TNumber>;
132
- refresh_token: alepha181.TOptional<alepha181.TString>;
133
- refresh_token_expires_in: alepha181.TOptional<alepha181.TNumber>;
134
- refresh_expires_in: alepha181.TOptional<alepha181.TNumber>;
135
- id_token: alepha181.TOptional<alepha181.TString>;
136
- scope: alepha181.TOptional<alepha181.TString>;
1152
+ readonly tokens: alepha_server_cookies0.AbstractCookiePrimitive<alepha206.TObject<{
1153
+ provider: alepha206.TString;
1154
+ access_token: alepha206.TString;
1155
+ issued_at: alepha206.TNumber;
1156
+ expires_in: alepha206.TOptional<alepha206.TNumber>;
1157
+ refresh_token: alepha206.TOptional<alepha206.TString>;
1158
+ refresh_token_expires_in: alepha206.TOptional<alepha206.TNumber>;
1159
+ refresh_expires_in: alepha206.TOptional<alepha206.TNumber>;
1160
+ id_token: alepha206.TOptional<alepha206.TString>;
1161
+ scope: alepha206.TOptional<alepha206.TString>;
137
1162
  }>>;
138
1163
  get identities(): Array<AuthPrimitive>;
139
1164
  getAuthenticationProviders(filters?: {
140
1165
  realmName?: string;
141
1166
  }): AuthenticationProvider[];
142
- protected readonly configure: alepha181.HookPrimitive<"configure">;
1167
+ protected readonly configure: alepha206.HookPrimitive<"configure">;
143
1168
  protected getAccessTokens(tokens: Tokens): string | undefined;
144
1169
  /**
145
- * Fill request headers with access token from cookies or fallback to provider's fallback function.
146
- */
147
- protected readonly onRequest: alepha181.HookPrimitive<"server:onRequest">;
1170
+ * Fill request headers with access token from cookies or fallback to provider's fallback function.
1171
+ */
1172
+ protected readonly onRequest: alepha206.HookPrimitive<"server:onRequest">;
148
1173
  /**
149
- * Convert cookies to tokens.
150
- * If the tokens are expired, try to refresh them using the refresh token.
151
- */
1174
+ * Convert cookies to tokens.
1175
+ * If the tokens are expired, try to refresh them using the refresh token.
1176
+ */
152
1177
  protected cookiesToTokens(cookies: Cookies): Promise<Tokens | undefined>;
153
1178
  protected refreshTokens(tokens: Tokens): Promise<Tokens | undefined>;
154
1179
  /**
155
- * Get user information.
156
- */
1180
+ * Get user information.
1181
+ */
157
1182
  readonly userinfo: alepha_server0.RoutePrimitive<{
158
- response: alepha181.TObject<{
159
- user: alepha181.TOptional<alepha181.TObject<{
160
- id: alepha181.TString;
161
- name: alepha181.TOptional<alepha181.TString>;
162
- email: alepha181.TOptional<alepha181.TString>;
163
- username: alepha181.TOptional<alepha181.TString>;
164
- picture: alepha181.TOptional<alepha181.TString>;
165
- sessionId: alepha181.TOptional<alepha181.TString>;
166
- organizations: alepha181.TOptional<alepha181.TArray<alepha181.TString>>;
167
- roles: alepha181.TOptional<alepha181.TArray<alepha181.TString>>;
1183
+ response: alepha206.TObject<{
1184
+ user: alepha206.TOptional<alepha206.TObject<{
1185
+ id: alepha206.TString;
1186
+ name: alepha206.TOptional<alepha206.TString>;
1187
+ email: alepha206.TOptional<alepha206.TString>;
1188
+ username: alepha206.TOptional<alepha206.TString>;
1189
+ picture: alepha206.TOptional<alepha206.TString>;
1190
+ sessionId: alepha206.TOptional<alepha206.TString>;
1191
+ organizations: alepha206.TOptional<alepha206.TArray<alepha206.TString>>;
1192
+ roles: alepha206.TOptional<alepha206.TArray<alepha206.TString>>;
168
1193
  }>>;
169
- api: alepha181.TObject<{
170
- prefix: alepha181.TOptional<alepha181.TString>;
171
- links: alepha181.TArray<alepha181.TObject<{
172
- name: alepha181.TString;
173
- group: alepha181.TOptional<alepha181.TString>;
174
- path: alepha181.TString;
175
- method: alepha181.TOptional<alepha181.TString>;
176
- requestBodyType: alepha181.TOptional<alepha181.TString>;
177
- service: alepha181.TOptional<alepha181.TString>;
178
- rawSchema: alepha181.TOptional<alepha181.TObject<{
179
- body: alepha181.TOptional<alepha181.TString>;
180
- response: alepha181.TOptional<alepha181.TString>;
1194
+ api: alepha206.TObject<{
1195
+ prefix: alepha206.TOptional<alepha206.TString>;
1196
+ links: alepha206.TArray<alepha206.TObject<{
1197
+ name: alepha206.TString;
1198
+ group: alepha206.TOptional<alepha206.TString>;
1199
+ path: alepha206.TString;
1200
+ method: alepha206.TOptional<alepha206.TString>;
1201
+ requestBodyType: alepha206.TOptional<alepha206.TString>;
1202
+ service: alepha206.TOptional<alepha206.TString>;
1203
+ rawSchema: alepha206.TOptional<alepha206.TObject<{
1204
+ body: alepha206.TOptional<alepha206.TString>;
1205
+ response: alepha206.TOptional<alepha206.TString>;
181
1206
  }>>;
182
1207
  }>>;
183
1208
  }>;
184
1209
  }>;
185
1210
  }>;
186
1211
  /**
187
- * Refresh a token for internal providers.
188
- */
1212
+ * Refresh a token for internal providers.
1213
+ */
189
1214
  readonly refresh: alepha_server0.RoutePrimitive<{
190
- query: alepha181.TObject<{
191
- provider: alepha181.TString;
1215
+ query: alepha206.TObject<{
1216
+ provider: alepha206.TString;
192
1217
  }>;
193
- body: alepha181.TObject<{
194
- refresh_token: alepha181.TString;
195
- access_token: alepha181.TOptional<alepha181.TString>;
1218
+ body: alepha206.TObject<{
1219
+ refresh_token: alepha206.TString;
1220
+ access_token: alepha206.TOptional<alepha206.TString>;
196
1221
  }>;
197
- response: alepha181.TObject<{
198
- provider: alepha181.TString;
199
- access_token: alepha181.TString;
200
- issued_at: alepha181.TNumber;
201
- expires_in: alepha181.TOptional<alepha181.TNumber>;
202
- refresh_token: alepha181.TOptional<alepha181.TString>;
203
- refresh_token_expires_in: alepha181.TOptional<alepha181.TNumber>;
204
- refresh_expires_in: alepha181.TOptional<alepha181.TNumber>;
205
- id_token: alepha181.TOptional<alepha181.TString>;
206
- scope: alepha181.TOptional<alepha181.TString>;
1222
+ response: alepha206.TObject<{
1223
+ provider: alepha206.TString;
1224
+ access_token: alepha206.TString;
1225
+ issued_at: alepha206.TNumber;
1226
+ expires_in: alepha206.TOptional<alepha206.TNumber>;
1227
+ refresh_token: alepha206.TOptional<alepha206.TString>;
1228
+ refresh_token_expires_in: alepha206.TOptional<alepha206.TNumber>;
1229
+ refresh_expires_in: alepha206.TOptional<alepha206.TNumber>;
1230
+ id_token: alepha206.TOptional<alepha206.TString>;
1231
+ scope: alepha206.TOptional<alepha206.TString>;
207
1232
  }>;
208
1233
  }>;
209
1234
  /**
210
- * Login for local password-based authentication.
211
- */
1235
+ * Login for local password-based authentication.
1236
+ */
212
1237
  readonly token: alepha_server0.RoutePrimitive<{
213
- query: alepha181.TObject<{
214
- provider: alepha181.TString;
215
- realm: alepha181.TOptional<alepha181.TString>;
1238
+ query: alepha206.TObject<{
1239
+ provider: alepha206.TString;
1240
+ realm: alepha206.TOptional<alepha206.TString>;
216
1241
  }>;
217
- body: alepha181.TObject<{
218
- username: alepha181.TString;
219
- password: alepha181.TString;
1242
+ body: alepha206.TObject<{
1243
+ username: alepha206.TString;
1244
+ password: alepha206.TString;
220
1245
  }>;
221
- response: alepha181.TObject<{
222
- provider: alepha181.TString;
223
- access_token: alepha181.TString;
224
- issued_at: alepha181.TNumber;
225
- expires_in: alepha181.TOptional<alepha181.TNumber>;
226
- refresh_token: alepha181.TOptional<alepha181.TString>;
227
- refresh_token_expires_in: alepha181.TOptional<alepha181.TNumber>;
228
- refresh_expires_in: alepha181.TOptional<alepha181.TNumber>;
229
- id_token: alepha181.TOptional<alepha181.TString>;
230
- scope: alepha181.TOptional<alepha181.TString>;
231
- user: alepha181.TObject<{
232
- id: alepha181.TString;
233
- name: alepha181.TOptional<alepha181.TString>;
234
- email: alepha181.TOptional<alepha181.TString>;
235
- username: alepha181.TOptional<alepha181.TString>;
236
- picture: alepha181.TOptional<alepha181.TString>;
237
- sessionId: alepha181.TOptional<alepha181.TString>;
238
- organizations: alepha181.TOptional<alepha181.TArray<alepha181.TString>>;
239
- roles: alepha181.TOptional<alepha181.TArray<alepha181.TString>>;
1246
+ response: alepha206.TObject<{
1247
+ provider: alepha206.TString;
1248
+ access_token: alepha206.TString;
1249
+ issued_at: alepha206.TNumber;
1250
+ expires_in: alepha206.TOptional<alepha206.TNumber>;
1251
+ refresh_token: alepha206.TOptional<alepha206.TString>;
1252
+ refresh_token_expires_in: alepha206.TOptional<alepha206.TNumber>;
1253
+ refresh_expires_in: alepha206.TOptional<alepha206.TNumber>;
1254
+ id_token: alepha206.TOptional<alepha206.TString>;
1255
+ scope: alepha206.TOptional<alepha206.TString>;
1256
+ user: alepha206.TObject<{
1257
+ id: alepha206.TString;
1258
+ name: alepha206.TOptional<alepha206.TString>;
1259
+ email: alepha206.TOptional<alepha206.TString>;
1260
+ username: alepha206.TOptional<alepha206.TString>;
1261
+ picture: alepha206.TOptional<alepha206.TString>;
1262
+ sessionId: alepha206.TOptional<alepha206.TString>;
1263
+ organizations: alepha206.TOptional<alepha206.TArray<alepha206.TString>>;
1264
+ roles: alepha206.TOptional<alepha206.TArray<alepha206.TString>>;
240
1265
  }>;
241
- api: alepha181.TObject<{
242
- prefix: alepha181.TOptional<alepha181.TString>;
243
- links: alepha181.TArray<alepha181.TObject<{
244
- name: alepha181.TString;
245
- group: alepha181.TOptional<alepha181.TString>;
246
- path: alepha181.TString;
247
- method: alepha181.TOptional<alepha181.TString>;
248
- requestBodyType: alepha181.TOptional<alepha181.TString>;
249
- service: alepha181.TOptional<alepha181.TString>;
250
- rawSchema: alepha181.TOptional<alepha181.TObject<{
251
- body: alepha181.TOptional<alepha181.TString>;
252
- response: alepha181.TOptional<alepha181.TString>;
1266
+ api: alepha206.TObject<{
1267
+ prefix: alepha206.TOptional<alepha206.TString>;
1268
+ links: alepha206.TArray<alepha206.TObject<{
1269
+ name: alepha206.TString;
1270
+ group: alepha206.TOptional<alepha206.TString>;
1271
+ path: alepha206.TString;
1272
+ method: alepha206.TOptional<alepha206.TString>;
1273
+ requestBodyType: alepha206.TOptional<alepha206.TString>;
1274
+ service: alepha206.TOptional<alepha206.TString>;
1275
+ rawSchema: alepha206.TOptional<alepha206.TObject<{
1276
+ body: alepha206.TOptional<alepha206.TString>;
1277
+ response: alepha206.TOptional<alepha206.TString>;
253
1278
  }>>;
254
1279
  }>>;
255
1280
  }>;
256
1281
  }>;
257
1282
  }>;
258
1283
  /**
259
- * Oauth2/OIDC login route.
260
- */
1284
+ * Oauth2/OIDC login route.
1285
+ */
261
1286
  readonly login: alepha_server0.RoutePrimitive<{
262
- query: alepha181.TObject<{
263
- provider: alepha181.TString;
264
- realm: alepha181.TOptional<alepha181.TString>;
265
- redirect_uri: alepha181.TOptional<alepha181.TString>;
1287
+ query: alepha206.TObject<{
1288
+ provider: alepha206.TString;
1289
+ realm: alepha206.TOptional<alepha206.TString>;
1290
+ redirect_uri: alepha206.TOptional<alepha206.TString>;
266
1291
  }>;
267
1292
  }>;
268
1293
  /**
269
- * Callback for OAuth2/OIDC providers.
270
- * It handles the authorization code flow and retrieves the access token.
271
- */
1294
+ * Callback for OAuth2/OIDC providers.
1295
+ * It handles the authorization code flow and retrieves the access token.
1296
+ */
272
1297
  readonly callback: alepha_server0.RoutePrimitive<alepha_server0.RequestConfigSchema>;
273
1298
  /**
274
- * Logout route for OAuth2/OIDC providers.
275
- */
1299
+ * Logout route for OAuth2/OIDC providers.
1300
+ */
276
1301
  readonly logout: alepha_server0.RoutePrimitive<{
277
- query: alepha181.TObject<{
278
- post_logout_redirect_uri: alepha181.TOptional<alepha181.TString>;
1302
+ query: alepha206.TObject<{
1303
+ post_logout_redirect_uri: alepha206.TOptional<alepha206.TString>;
279
1304
  }>;
280
1305
  }>;
281
1306
  /**
282
- * Find an auth provider by name and optionally by realm.
283
- * When realm is specified, it filters providers by both name and realm.
284
- * This enables multi-realm setups where multiple providers share the same name (e.g., "credentials").
285
- */
1307
+ * Find an auth provider by name and optionally by realm.
1308
+ * When realm is specified, it filters providers by both name and realm.
1309
+ * This enables multi-realm setups where multiple providers share the same name (e.g., "credentials").
1310
+ */
286
1311
  protected provider(opts: string | {
287
1312
  provider: string;
288
1313
  realm?: string;
@@ -362,13 +1387,13 @@ declare const $auth: {
362
1387
  };
363
1388
  type AuthPrimitiveOptions = {
364
1389
  /**
365
- * Name of the identity provider.
366
- * If not provided, it will be derived from the property key.
367
- */
1390
+ * Name of the identity provider.
1391
+ * If not provided, it will be derived from the property key.
1392
+ */
368
1393
  name?: string;
369
1394
  /**
370
- * If true, auth provider will be skipped.
371
- */
1395
+ * If true, auth provider will be skipped.
1396
+ */
372
1397
  disabled?: boolean;
373
1398
  } & (AuthExternal | AuthInternal);
374
1399
  /**
@@ -376,22 +1401,22 @@ type AuthPrimitiveOptions = {
376
1401
  */
377
1402
  type AuthExternal = {
378
1403
  /**
379
- * Only OIDC is supported for external authentication.
380
- */
1404
+ * Only OIDC is supported for external authentication.
1405
+ */
381
1406
  oidc: OidcOptions;
382
1407
  /**
383
- * For anonymous access, this will expect a service account access token.
384
- *
385
- * ```ts
386
- * class App {
387
- * anonymous = $serviceAccount(...);
388
- * auth = $auth({
389
- * // ... config ...
390
- * fallback: this.anonymous,
391
- * })
392
- * }
393
- * ```
394
- */
1408
+ * For anonymous access, this will expect a service account access token.
1409
+ *
1410
+ * ```ts
1411
+ * class App {
1412
+ * anonymous = $serviceAccount(...);
1413
+ * auth = $auth({
1414
+ * // ... config ...
1415
+ * fallback: this.anonymous,
1416
+ * })
1417
+ * }
1418
+ * ```
1419
+ */
395
1420
  fallback?: () => Async<AccessToken>;
396
1421
  };
397
1422
  /**
@@ -404,32 +1429,32 @@ type AuthInternal = {
404
1429
  issuer: IssuerPrimitive;
405
1430
  } & ({
406
1431
  /**
407
- * The common username/password authentication.
408
- *
409
- * - It uses the OAuth2 Client Credentials flow to obtain an access token.
410
- *
411
- * This is usually used with a custom login form on your website or mobile app.
412
- */
1432
+ * The common username/password authentication.
1433
+ *
1434
+ * - It uses the OAuth2 Client Credentials flow to obtain an access token.
1435
+ *
1436
+ * This is usually used with a custom login form on your website or mobile app.
1437
+ */
413
1438
  credentials: CredentialsOptions;
414
1439
  } | {
415
1440
  /**
416
- * OAuth2 authentication. Delegates authentication to an OAuth2 provider. (e.g. Google, GitHub, etc.)
417
- *
418
- * - It uses the OAuth2 Authorization Code flow to obtain an access token and user information.
419
- *
420
- * This is usually used with a login button that redirects to the OAuth2 provider.
421
- */
1441
+ * OAuth2 authentication. Delegates authentication to an OAuth2 provider. (e.g. Google, GitHub, etc.)
1442
+ *
1443
+ * - It uses the OAuth2 Authorization Code flow to obtain an access token and user information.
1444
+ *
1445
+ * This is usually used with a login button that redirects to the OAuth2 provider.
1446
+ */
422
1447
  oauth: OAuth2Options;
423
1448
  } | {
424
1449
  /**
425
- * Like OAuth2, but uses OIDC (OpenID Connect) for authentication and user information retrieval.
426
- * OIDC is an identity layer on top of OAuth2, providing user authentication and profile information.
427
- *
428
- * - It uses the OAuth2 Authorization Code flow to obtain an access token and user information.
429
- * - PCKE (Proof Key for Code Exchange) is recommended for security.
430
- *
431
- * This is usually used with a login button that redirects to the OIDC provider.
432
- */
1450
+ * Like OAuth2, but uses OIDC (OpenID Connect) for authentication and user information retrieval.
1451
+ * OIDC is an identity layer on top of OAuth2, providing user authentication and profile information.
1452
+ *
1453
+ * - It uses the OAuth2 Authorization Code flow to obtain an access token and user information.
1454
+ * - PCKE (Proof Key for Code Exchange) is recommended for security.
1455
+ *
1456
+ * This is usually used with a login button that redirects to the OIDC provider.
1457
+ */
433
1458
  oidc: OidcOptions;
434
1459
  });
435
1460
  type CredentialsOptions = {
@@ -442,36 +1467,36 @@ interface Credentials {
442
1467
  }
443
1468
  interface OidcOptions {
444
1469
  /**
445
- * URL of the OIDC issuer.
446
- */
1470
+ * URL of the OIDC issuer.
1471
+ */
447
1472
  issuer: string;
448
1473
  /**
449
- * Client ID for the OIDC client.
450
- */
1474
+ * Client ID for the OIDC client.
1475
+ */
451
1476
  clientId: string;
452
1477
  /**
453
- * Client secret for the OIDC client.
454
- * Optional if PKCE (Proof Key for Code Exchange) is used.
455
- */
1478
+ * Client secret for the OIDC client.
1479
+ * Optional if PKCE (Proof Key for Code Exchange) is used.
1480
+ */
456
1481
  clientSecret?: string;
457
1482
  /**
458
- * Redirect URI for the OIDC client.
459
- * This is where the user will be redirected after authentication.
460
- */
1483
+ * Redirect URI for the OIDC client.
1484
+ * This is where the user will be redirected after authentication.
1485
+ */
461
1486
  redirectUri?: string;
462
1487
  /**
463
- * For external auth providers only.
464
- * Take the ID token instead of the access token for validation.
465
- */
1488
+ * For external auth providers only.
1489
+ * Take the ID token instead of the access token for validation.
1490
+ */
466
1491
  useIdToken?: boolean;
467
1492
  /**
468
- * URI to redirect the user after logout.
469
- */
1493
+ * URI to redirect the user after logout.
1494
+ */
470
1495
  logoutUri?: string;
471
1496
  /**
472
- * Optional scope for the OIDC client.
473
- * @default "openid profile email".
474
- */
1497
+ * Optional scope for the OIDC client.
1498
+ * @default "openid profile email".
1499
+ */
475
1500
  scope?: string;
476
1501
  account?: LinkAccountFn;
477
1502
  }
@@ -485,33 +1510,33 @@ interface LinkAccountOptions {
485
1510
  type LinkAccountFn = (tokens: LinkAccountOptions) => Async<UserAccount>;
486
1511
  interface OAuth2Options {
487
1512
  /**
488
- * URL of the OAuth2 authorization endpoint.
489
- */
1513
+ * URL of the OAuth2 authorization endpoint.
1514
+ */
490
1515
  clientId: string;
491
1516
  /**
492
- * Client secret for the OAuth2 client.
493
- */
1517
+ * Client secret for the OAuth2 client.
1518
+ */
494
1519
  clientSecret: string;
495
1520
  /**
496
- * URL of the OAuth2 authorization endpoint.
497
- */
1521
+ * URL of the OAuth2 authorization endpoint.
1522
+ */
498
1523
  authorization: string;
499
1524
  /**
500
- * URL of the OAuth2 token endpoint.
501
- */
1525
+ * URL of the OAuth2 token endpoint.
1526
+ */
502
1527
  token: string;
503
1528
  /**
504
- * Function to retrieve user profile information from the OAuth2 tokens.
505
- */
1529
+ * Function to retrieve user profile information from the OAuth2 tokens.
1530
+ */
506
1531
  userinfo: (tokens: Tokens) => Async<OAuth2Profile>;
507
1532
  account?: LinkAccountFn;
508
1533
  /**
509
- * URL of the OAuth2 authorization endpoint.
510
- */
1534
+ * URL of the OAuth2 authorization endpoint.
1535
+ */
511
1536
  redirectUri?: string;
512
1537
  /**
513
- * URL of the OAuth2 authorization endpoint.
514
- */
1538
+ * URL of the OAuth2 authorization endpoint.
1539
+ */
515
1540
  scope?: string;
516
1541
  }
517
1542
  declare class AuthPrimitive extends Primitive<AuthPrimitiveOptions> {
@@ -524,14 +1549,14 @@ declare class AuthPrimitive extends Primitive<AuthPrimitiveOptions> {
524
1549
  get scope(): string | undefined;
525
1550
  get redirect_uri(): string | undefined;
526
1551
  /**
527
- * Refreshes the access token using the refresh token.
528
- * Can be used on oauth2, oidc or credentials auth providers.
529
- */
1552
+ * Refreshes the access token using the refresh token.
1553
+ * Can be used on oauth2, oidc or credentials auth providers.
1554
+ */
530
1555
  refresh(refreshToken: string, accessToken?: string): Promise<AccessTokenResponse>;
531
1556
  /**
532
- * Extracts user information from the access token.
533
- * This is used to create a user account from the access token.
534
- */
1557
+ * Extracts user information from the access token.
1558
+ * This is used to create a user account from the access token.
1559
+ */
535
1560
  user(tokens: Tokens): Promise<UserAccount>;
536
1561
  protected getUserFromIdToken(idToken: string): OAuth2Profile;
537
1562
  prepare(): Promise<void>;
@@ -584,10 +1609,10 @@ declare const $authGoogle: (realm: IssuerPrimitive & WithLinkFn, options?: Parti
584
1609
  declare module "alepha" {
585
1610
  interface State {
586
1611
  /**
587
- * The authenticated user account attached to the server request state.
588
- *
589
- * @internal
590
- */
1612
+ * The authenticated user account attached to the server request state.
1613
+ *
1614
+ * @internal
1615
+ */
591
1616
  "alepha.server.request.user"?: UserAccount;
592
1617
  }
593
1618
  }
@@ -604,7 +1629,7 @@ declare module "alepha" {
604
1629
  * @see {@link ServerAuthProvider}
605
1630
  * @module alepha.server.auth
606
1631
  */
607
- declare const AlephaServerAuth: alepha181.Service<alepha181.Module>;
1632
+ declare const AlephaServerAuth: alepha206.Service<alepha206.Module>;
608
1633
  //#endregion
609
1634
  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 };
610
1635
  //# sourceMappingURL=index.d.ts.map