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
@@ -3,8 +3,6 @@ import { Alepha, KIND, Primitive, Static } from "alepha";
3
3
  import { FetchOptions, ServerRequest, ServerRouterProvider, UnauthorizedError } from "alepha/server";
4
4
  import * as alepha_logger2 from "alepha/logger";
5
5
  import { DateTimeProvider, Duration, DurationLike } from "alepha/datetime";
6
- import { CryptoKey, FlattenedJWSInput, JSONWebKeySet, JWSHeaderParameters, JWTHeaderParameters, JWTPayload, JWTVerifyResult, KeyObject } from "jose";
7
- import { JWTVerifyOptions } from "jose/jwt/verify";
8
6
 
9
7
  //#region ../../src/security/schemas/userAccountInfoSchema.d.ts
10
8
  declare const userAccountInfoSchema: alepha3.TObject<{
@@ -26,17 +24,17 @@ type UserAccount = Static<typeof userAccountInfoSchema>;
26
24
  */
27
25
  interface UserAccountToken extends UserAccount {
28
26
  /**
29
- * Access token for the user.
30
- */
27
+ * Access token for the user.
28
+ */
31
29
  token?: string;
32
30
  /**
33
- * Realm name of the user.
34
- */
31
+ * Realm name of the user.
32
+ */
35
33
  realm?: string;
36
34
  /**
37
- * Is user dedicated to his own resources for this scope ?
38
- * Mostly, Admin is false and Customer is true.
39
- */
35
+ * Is user dedicated to his own resources for this scope ?
36
+ * Mostly, Admin is false and Customer is true.
37
+ */
40
38
  ownership?: string | boolean;
41
39
  }
42
40
  //#endregion
@@ -80,39 +78,39 @@ declare class ServerBasicAuthProvider {
80
78
  protected readonly routerProvider: ServerRouterProvider;
81
79
  protected readonly realm = "Secure Area";
82
80
  /**
83
- * Registered basic auth primitives with their configurations
84
- */
81
+ * Registered basic auth primitives with their configurations
82
+ */
85
83
  readonly registeredAuths: BasicAuthPrimitiveConfig[];
86
84
  /**
87
- * Register a basic auth configuration (called by primitives)
88
- */
85
+ * Register a basic auth configuration (called by primitives)
86
+ */
89
87
  registerAuth(config: BasicAuthPrimitiveConfig): void;
90
88
  readonly onStart: alepha3.HookPrimitive<"start">;
91
89
  /**
92
- * Hook into server:onRequest to check basic auth
93
- */
90
+ * Hook into server:onRequest to check basic auth
91
+ */
94
92
  readonly onRequest: alepha3.HookPrimitive<"server:onRequest">;
95
93
  /**
96
- * Hook into action:onRequest to check basic auth for actions
97
- */
94
+ * Hook into action:onRequest to check basic auth for actions
95
+ */
98
96
  readonly onActionRequest: alepha3.HookPrimitive<"action:onRequest">;
99
97
  /**
100
- * Check basic authentication
101
- */
98
+ * Check basic authentication
99
+ */
102
100
  checkAuth(request: ServerRequest, options: BasicAuthOptions): void;
103
101
  /**
104
- * Performs a timing-safe comparison of credentials to prevent timing attacks.
105
- * Always compares both username and password to avoid leaking which one is wrong.
106
- */
102
+ * Performs a timing-safe comparison of credentials to prevent timing attacks.
103
+ * Always compares both username and password to avoid leaking which one is wrong.
104
+ */
107
105
  protected timingSafeCredentialCheck(inputUsername: string, inputPassword: string, expectedUsername: string, expectedPassword: string): boolean;
108
106
  /**
109
- * Compares two buffers in constant time, handling different lengths safely.
110
- * Returns 1 if equal, 0 if not equal.
111
- */
107
+ * Compares two buffers in constant time, handling different lengths safely.
108
+ * Returns 1 if equal, 0 if not equal.
109
+ */
112
110
  protected safeCompare(input: Buffer, expected: Buffer): number;
113
111
  /**
114
- * Send WWW-Authenticate header
115
- */
112
+ * Send WWW-Authenticate header
113
+ */
116
114
  protected sendAuthRequired(request: ServerRequest): void;
117
115
  }
118
116
  declare const isBasicAuth: (value: unknown) => value is {
@@ -138,11 +136,336 @@ declare class BasicAuthPrimitive extends Primitive<BasicAuthPrimitiveConfig> imp
138
136
  get name(): string;
139
137
  protected onInit(): void;
140
138
  /**
141
- * Checks basic auth for the given request using this primitive's configuration.
142
- */
139
+ * Checks basic auth for the given request using this primitive's configuration.
140
+ */
143
141
  check(request: ServerRequest, options?: BasicAuthOptions): void;
144
142
  }
145
143
  //#endregion
144
+ //#region ../../../../node_modules/jose/dist/types/types.d.ts
145
+ /** Generic JSON Web Key Parameters. */
146
+ interface JWKParameters {
147
+ /** JWK "kty" (Key Type) Parameter */
148
+ kty?: string;
149
+ /**
150
+ * JWK "alg" (Algorithm) Parameter
151
+ *
152
+ * @see {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}
153
+ */
154
+ alg?: string;
155
+ /** JWK "key_ops" (Key Operations) Parameter */
156
+ key_ops?: string[];
157
+ /** JWK "ext" (Extractable) Parameter */
158
+ ext?: boolean;
159
+ /** JWK "use" (Public Key Use) Parameter */
160
+ use?: string;
161
+ /** JWK "x5c" (X.509 Certificate Chain) Parameter */
162
+ x5c?: string[];
163
+ /** JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter */
164
+ x5t?: string;
165
+ /** JWK "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter */
166
+ 'x5t#S256'?: string;
167
+ /** JWK "x5u" (X.509 URL) Parameter */
168
+ x5u?: string;
169
+ /** JWK "kid" (Key ID) Parameter */
170
+ kid?: string;
171
+ }
172
+ /**
173
+ * JSON Web Key ({@link https://www.rfc-editor.org/rfc/rfc7517 JWK}). "RSA", "EC", "OKP", "AKP", and
174
+ * "oct" key types are supported.
175
+ *
176
+ * @see {@link JWK_AKP_Public}
177
+ * @see {@link JWK_AKP_Private}
178
+ * @see {@link JWK_OKP_Public}
179
+ * @see {@link JWK_OKP_Private}
180
+ * @see {@link JWK_EC_Public}
181
+ * @see {@link JWK_EC_Private}
182
+ * @see {@link JWK_RSA_Public}
183
+ * @see {@link JWK_RSA_Private}
184
+ * @see {@link JWK_oct}
185
+ */
186
+ interface JWK extends JWKParameters {
187
+ /**
188
+ * - EC JWK "crv" (Curve) Parameter
189
+ * - OKP JWK "crv" (The Subtype of Key Pair) Parameter
190
+ */
191
+ crv?: string;
192
+ /**
193
+ * - Private RSA JWK "d" (Private Exponent) Parameter
194
+ * - Private EC JWK "d" (ECC Private Key) Parameter
195
+ * - Private OKP JWK "d" (The Private Key) Parameter
196
+ */
197
+ d?: string;
198
+ /** Private RSA JWK "dp" (First Factor CRT Exponent) Parameter */
199
+ dp?: string;
200
+ /** Private RSA JWK "dq" (Second Factor CRT Exponent) Parameter */
201
+ dq?: string;
202
+ /** RSA JWK "e" (Exponent) Parameter */
203
+ e?: string;
204
+ /** Oct JWK "k" (Key Value) Parameter */
205
+ k?: string;
206
+ /** RSA JWK "n" (Modulus) Parameter */
207
+ n?: string;
208
+ /** Private RSA JWK "p" (First Prime Factor) Parameter */
209
+ p?: string;
210
+ /** Private RSA JWK "q" (Second Prime Factor) Parameter */
211
+ q?: string;
212
+ /** Private RSA JWK "qi" (First CRT Coefficient) Parameter */
213
+ qi?: string;
214
+ /**
215
+ * - EC JWK "x" (X Coordinate) Parameter
216
+ * - OKP JWK "x" (The public key) Parameter
217
+ */
218
+ x?: string;
219
+ /** EC JWK "y" (Y Coordinate) Parameter */
220
+ y?: string;
221
+ /** AKP JWK "pub" (Public Key) Parameter */
222
+ pub?: string;
223
+ /** AKP JWK "priv" (Private key) Parameter */
224
+ priv?: string;
225
+ }
226
+ /**
227
+ * Flattened JWS definition for verify function inputs, allows payload as {@link !Uint8Array} for
228
+ * detached signature validation.
229
+ */
230
+ interface FlattenedJWSInput {
231
+ /**
232
+ * The "header" member MUST be present and contain the value JWS Unprotected Header when the JWS
233
+ * Unprotected Header value is non- empty; otherwise, it MUST be absent. This value is represented
234
+ * as an unencoded JSON object, rather than as a string. These Header Parameter values are not
235
+ * integrity protected.
236
+ */
237
+ header?: JWSHeaderParameters;
238
+ /**
239
+ * The "payload" member MUST be present and contain the value BASE64URL(JWS Payload). When RFC7797
240
+ * "b64": false is used the value passed may also be a {@link !Uint8Array}.
241
+ */
242
+ payload: string | Uint8Array;
243
+ /**
244
+ * The "protected" member MUST be present and contain the value BASE64URL(UTF8(JWS Protected
245
+ * Header)) when the JWS Protected Header value is non-empty; otherwise, it MUST be absent. These
246
+ * Header Parameter values are integrity protected.
247
+ */
248
+ protected?: string;
249
+ /** The "signature" member MUST be present and contain the value BASE64URL(JWS Signature). */
250
+ signature: string;
251
+ }
252
+ /** Header Parameters common to JWE and JWS */
253
+ interface JoseHeaderParameters {
254
+ /** "kid" (Key ID) Header Parameter */
255
+ kid?: string;
256
+ /** "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter */
257
+ x5t?: string;
258
+ /** "x5c" (X.509 Certificate Chain) Header Parameter */
259
+ x5c?: string[];
260
+ /** "x5u" (X.509 URL) Header Parameter */
261
+ x5u?: string;
262
+ /** "jku" (JWK Set URL) Header Parameter */
263
+ jku?: string;
264
+ /** "jwk" (JSON Web Key) Header Parameter */
265
+ jwk?: Pick<JWK, 'kty' | 'crv' | 'x' | 'y' | 'e' | 'n' | 'alg' | 'pub'>;
266
+ /** "typ" (Type) Header Parameter */
267
+ typ?: string;
268
+ /** "cty" (Content Type) Header Parameter */
269
+ cty?: string;
270
+ }
271
+ /** Recognized JWS Header Parameters, any other Header Members may also be present. */
272
+ interface JWSHeaderParameters extends JoseHeaderParameters {
273
+ /**
274
+ * JWS "alg" (Algorithm) Header Parameter
275
+ *
276
+ * @see {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}
277
+ */
278
+ alg?: string;
279
+ /**
280
+ * This JWS Extension Header Parameter modifies the JWS Payload representation and the JWS Signing
281
+ * Input computation as per {@link https://www.rfc-editor.org/rfc/rfc7797 RFC7797}.
282
+ */
283
+ b64?: boolean;
284
+ /** JWS "crit" (Critical) Header Parameter */
285
+ crit?: string[];
286
+ /** Any other JWS Header member. */
287
+ [propName: string]: unknown;
288
+ }
289
+ /** Shared Interface with a "crit" property for all sign, verify, encrypt and decrypt operations. */
290
+ interface CritOption {
291
+ /**
292
+ * An object with keys representing recognized "crit" (Critical) Header Parameter names. The value
293
+ * for those is either `true` or `false`. `true` when the Header Parameter MUST be integrity
294
+ * protected, `false` when it's irrelevant.
295
+ *
296
+ * This makes the "Extension Header Parameter "..." is not recognized" error go away.
297
+ *
298
+ * Use this when a given JWS/JWT/JWE profile requires the use of proprietary non-registered "crit"
299
+ * (Critical) Header Parameters. This will only make sure the Header Parameter is syntactically
300
+ * correct when provided and that it is optionally integrity protected. It will not process the
301
+ * Header Parameter in any way or reject the operation if it is missing. You MUST still verify the
302
+ * Header Parameter was present and process it according to the profile's validation steps after
303
+ * the operation succeeds.
304
+ *
305
+ * The JWS extension Header Parameter `b64` is always recognized and processed properly. No other
306
+ * registered Header Parameters that need this kind of default built-in treatment are currently
307
+ * available.
308
+ */
309
+ crit?: {
310
+ [propName: string]: boolean;
311
+ };
312
+ }
313
+ /** JWT Claims Set verification options. */
314
+ interface JWTClaimVerificationOptions {
315
+ /**
316
+ * Expected JWT "aud" (Audience) Claim value(s).
317
+ *
318
+ * This option makes the JWT "aud" (Audience) Claim presence required.
319
+ */
320
+ audience?: string | string[];
321
+ /**
322
+ * Clock skew tolerance
323
+ *
324
+ * - In seconds when number (e.g. 5)
325
+ * - Resolved into a number of seconds when a string (e.g. "5 seconds", "10 minutes", "2 hours").
326
+ *
327
+ * Used when validating the JWT "nbf" (Not Before) and "exp" (Expiration Time) claims, and when
328
+ * validating the "iat" (Issued At) claim if the {@link maxTokenAge `maxTokenAge` option} is set.
329
+ */
330
+ clockTolerance?: string | number;
331
+ /**
332
+ * Expected JWT "iss" (Issuer) Claim value(s).
333
+ *
334
+ * This option makes the JWT "iss" (Issuer) Claim presence required.
335
+ */
336
+ issuer?: string | string[];
337
+ /**
338
+ * Maximum time elapsed (in seconds) from the JWT "iat" (Issued At) Claim value.
339
+ *
340
+ * - In seconds when number (e.g. 5)
341
+ * - Resolved into a number of seconds when a string (e.g. "5 seconds", "10 minutes", "2 hours").
342
+ *
343
+ * This option makes the JWT "iat" (Issued At) Claim presence required.
344
+ */
345
+ maxTokenAge?: string | number;
346
+ /**
347
+ * Expected JWT "sub" (Subject) Claim value.
348
+ *
349
+ * This option makes the JWT "sub" (Subject) Claim presence required.
350
+ */
351
+ subject?: string;
352
+ /**
353
+ * Expected JWT "typ" (Type) Header Parameter value.
354
+ *
355
+ * This option makes the JWT "typ" (Type) Header Parameter presence required.
356
+ */
357
+ typ?: string;
358
+ /** Date to use when comparing NumericDate claims, defaults to `new Date()`. */
359
+ currentDate?: Date;
360
+ /**
361
+ * Array of required Claim Names that must be present in the JWT Claims Set. Default is that: if
362
+ * the {@link issuer `issuer` option} is set, then JWT "iss" (Issuer) Claim must be present; if the
363
+ * {@link audience `audience` option} is set, then JWT "aud" (Audience) Claim must be present; if
364
+ * the {@link subject `subject` option} is set, then JWT "sub" (Subject) Claim must be present; if
365
+ * the {@link maxTokenAge `maxTokenAge` option} is set, then JWT "iat" (Issued At) Claim must be
366
+ * present.
367
+ */
368
+ requiredClaims?: string[];
369
+ }
370
+ /** JWS Verification options. */
371
+ interface VerifyOptions extends CritOption {
372
+ /**
373
+ * A list of accepted JWS "alg" (Algorithm) Header Parameter values. By default all "alg"
374
+ * (Algorithm) values applicable for the used key/secret are allowed.
375
+ *
376
+ * > [!NOTE]\
377
+ * > Unsecured JWTs (`{ "alg": "none" }`) are never accepted by this API.
378
+ */
379
+ algorithms?: string[];
380
+ }
381
+ /** Recognized JWT Claims Set members, any other members may also be present. */
382
+ interface JWTPayload {
383
+ /**
384
+ * JWT Issuer
385
+ *
386
+ * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.1 RFC7519#section-4.1.1}
387
+ */
388
+ iss?: string;
389
+ /**
390
+ * JWT Subject
391
+ *
392
+ * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.2 RFC7519#section-4.1.2}
393
+ */
394
+ sub?: string;
395
+ /**
396
+ * JWT Audience
397
+ *
398
+ * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.3 RFC7519#section-4.1.3}
399
+ */
400
+ aud?: string | string[];
401
+ /**
402
+ * JWT ID
403
+ *
404
+ * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.7 RFC7519#section-4.1.7}
405
+ */
406
+ jti?: string;
407
+ /**
408
+ * JWT Not Before
409
+ *
410
+ * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.5 RFC7519#section-4.1.5}
411
+ */
412
+ nbf?: number;
413
+ /**
414
+ * JWT Expiration Time
415
+ *
416
+ * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.4 RFC7519#section-4.1.4}
417
+ */
418
+ exp?: number;
419
+ /**
420
+ * JWT Issued At
421
+ *
422
+ * @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.6 RFC7519#section-4.1.6}
423
+ */
424
+ iat?: number;
425
+ /** Any other JWT Claim Set member. */
426
+ [propName: string]: unknown;
427
+ }
428
+ /** Signed JSON Web Token (JWT) verification result */
429
+ interface JWTVerifyResult<PayloadType = JWTPayload> {
430
+ /** JWT Claims Set. */
431
+ payload: PayloadType & JWTPayload;
432
+ /** JWS Protected Header. */
433
+ protectedHeader: JWTHeaderParameters;
434
+ }
435
+ /** Recognized Compact JWS Header Parameters, any other Header Members may also be present. */
436
+ interface CompactJWSHeaderParameters extends JWSHeaderParameters {
437
+ alg: string;
438
+ }
439
+ /** Recognized Signed JWT Header Parameters, any other Header Members may also be present. */
440
+ interface JWTHeaderParameters extends CompactJWSHeaderParameters {
441
+ b64?: true;
442
+ }
443
+ /** JSON Web Key Set */
444
+ interface JSONWebKeySet {
445
+ keys: JWK[];
446
+ }
447
+ /**
448
+ * {@link !KeyObject} is a representation of a key/secret available in the Node.js runtime. You may
449
+ * use the Node.js runtime APIs {@link !createPublicKey}, {@link !createPrivateKey}, and
450
+ * {@link !createSecretKey} to obtain a {@link !KeyObject} from your existing key material.
451
+ */
452
+ interface KeyObject {
453
+ type: string;
454
+ }
455
+ /**
456
+ * {@link !CryptoKey} is a representation of a key/secret available in all supported runtimes. In
457
+ * addition to the {@link key/import Key Import Functions} you may use the
458
+ * {@link !SubtleCrypto.importKey} API to obtain a {@link !CryptoKey} from your existing key
459
+ * material.
460
+ */
461
+ type CryptoKey = Extract<Awaited<ReturnType<typeof crypto.subtle.generateKey>>, {
462
+ type: string;
463
+ }>;
464
+ //#endregion
465
+ //#region ../../../../node_modules/jose/dist/types/jwt/verify.d.ts
466
+ /** Combination of JWS Verification options and JWT Claims Set verification options. */
467
+ interface JWTVerifyOptions extends VerifyOptions, JWTClaimVerificationOptions {}
468
+ //#endregion
146
469
  //#region ../../src/security/providers/JwtProvider.d.ts
147
470
  /**
148
471
  * Provides utilities for working with JSON Web Tokens (JWT).
@@ -153,36 +476,36 @@ declare class JwtProvider {
153
476
  protected readonly dateTimeProvider: DateTimeProvider;
154
477
  protected readonly encoder: TextEncoder;
155
478
  /**
156
- * Adds a key loader to the embedded keystore.
157
- *
158
- * @param name
159
- * @param secretKeyOrJwks
160
- */
479
+ * Adds a key loader to the embedded keystore.
480
+ *
481
+ * @param name
482
+ * @param secretKeyOrJwks
483
+ */
161
484
  setKeyLoader(name: string, secretKeyOrJwks: string | JSONWebKeySet): void;
162
485
  /**
163
- * Retrieves the payload from a JSON Web Token (JWT).
164
- *
165
- * @param token - The JWT to extract the payload from.
166
- *
167
- * @return A Promise that resolves with the payload object from the token.
168
- */
486
+ * Retrieves the payload from a JSON Web Token (JWT).
487
+ *
488
+ * @param token - The JWT to extract the payload from.
489
+ *
490
+ * @return A Promise that resolves with the payload object from the token.
491
+ */
169
492
  parse(token: string, keyName?: string, options?: JWTVerifyOptions): Promise<JwtParseResult>;
170
493
  /**
171
- * Creates a JWT token with the provided payload and secret key.
172
- *
173
- * @param payload - The payload to be encoded in the token.
174
- * It should include the `realm_access` property which contains an array of roles.
175
- * @param keyName - The name of the key to use when signing the token.
176
- *
177
- * @returns The signed JWT token.
178
- */
494
+ * Creates a JWT token with the provided payload and secret key.
495
+ *
496
+ * @param payload - The payload to be encoded in the token.
497
+ * It should include the `realm_access` property which contains an array of roles.
498
+ * @param keyName - The name of the key to use when signing the token.
499
+ *
500
+ * @returns The signed JWT token.
501
+ */
179
502
  create(payload: ExtendedJWTPayload, keyName?: string, signOptions?: JwtSignOptions): Promise<string>;
180
503
  /**
181
- * Determines if the provided key is a secret key.
182
- *
183
- * @param key
184
- * @protected
185
- */
504
+ * Determines if the provided key is a secret key.
505
+ *
506
+ * @param key
507
+ * @protected
508
+ */
186
509
  protected isSecretKey(key: string): boolean;
187
510
  }
188
511
  type KeyLoader = (protectedHeader?: JWSHeaderParameters, token?: FlattenedJWSInput) => Promise<CryptoKey | KeyObject>;
@@ -252,122 +575,122 @@ declare class SecurityProvider {
252
575
  protected readonly alepha: Alepha;
253
576
  get secretKey(): string;
254
577
  /**
255
- * The permissions configured for the security provider.
256
- */
578
+ * The permissions configured for the security provider.
579
+ */
257
580
  protected readonly permissions: Permission[];
258
581
  /**
259
- * The realms configured for the security provider.
260
- */
582
+ * The realms configured for the security provider.
583
+ */
261
584
  protected readonly realms: Realm[];
262
585
  protected start: alepha3.HookPrimitive<"start">;
263
586
  /**
264
- * Adds a role to one or more realms.
265
- *
266
- * @param role
267
- * @param realms
268
- */
587
+ * Adds a role to one or more realms.
588
+ *
589
+ * @param role
590
+ * @param realms
591
+ */
269
592
  createRole(role: Role, ...realms: string[]): Role;
270
593
  /**
271
- * Adds a permission to the security provider.
272
- *
273
- * @param raw - The permission to add.
274
- */
594
+ * Adds a permission to the security provider.
595
+ *
596
+ * @param raw - The permission to add.
597
+ */
275
598
  createPermission(raw: Permission | string): Permission;
276
599
  createRealm(realm: Realm): void;
277
600
  /**
278
- * Updates the roles for a realm then synchronizes the user account provider if available.
279
- *
280
- * Only available when the app is started.
281
- *
282
- * @param realm - The realm to update the roles for.
283
- * @param roles - The roles to update.
284
- */
601
+ * Updates the roles for a realm then synchronizes the user account provider if available.
602
+ *
603
+ * Only available when the app is started.
604
+ *
605
+ * @param realm - The realm to update the roles for.
606
+ * @param roles - The roles to update.
607
+ */
285
608
  updateRealm(realm: string, roles: Role[]): Promise<void>;
286
609
  /**
287
- * Creates a user account from the provided payload.
288
- *
289
- * @param payload - The payload to create the user account from.
290
- * @param [realmName] - The realm containing the roles. Default is all.
291
- *
292
- * @returns The user info created from the payload.
293
- */
610
+ * Creates a user account from the provided payload.
611
+ *
612
+ * @param payload - The payload to create the user account from.
613
+ * @param [realmName] - The realm containing the roles. Default is all.
614
+ *
615
+ * @returns The user info created from the payload.
616
+ */
294
617
  createUserFromPayload(payload: JWTPayload, realmName?: string): UserAccount;
295
618
  /**
296
- * Checks if the user has the specified permission.
297
- *
298
- * Bonus: we check also if the user has "ownership" flag.
299
- *
300
- * @param permissionLike - The permission to check for.
301
- * @param roleEntries - The roles to check for the permission.
302
- */
619
+ * Checks if the user has the specified permission.
620
+ *
621
+ * Bonus: we check also if the user has "ownership" flag.
622
+ *
623
+ * @param permissionLike - The permission to check for.
624
+ * @param roleEntries - The roles to check for the permission.
625
+ */
303
626
  checkPermission(permissionLike: string | Permission, ...roleEntries: string[]): SecurityCheckResult;
304
627
  /**
305
- * Creates a user account from the provided payload.
306
- */
628
+ * Creates a user account from the provided payload.
629
+ */
307
630
  createUserFromToken(headerOrToken?: string, options?: {
308
631
  permission?: Permission | string;
309
632
  realm?: string;
310
633
  verify?: JWTVerifyOptions;
311
634
  }): Promise<UserAccountToken>;
312
635
  /**
313
- * Checks if a user has a specific role.
314
- *
315
- * @param roleName - The role to check for.
316
- * @param permission - The permission to check for.
317
- * @returns True if the user has the role, false otherwise.
318
- */
636
+ * Checks if a user has a specific role.
637
+ *
638
+ * @param roleName - The role to check for.
639
+ * @param permission - The permission to check for.
640
+ * @returns True if the user has the role, false otherwise.
641
+ */
319
642
  can(roleName: string, permission: string | Permission): boolean;
320
643
  /**
321
- * Checks if a user has ownership of a specific permission.
322
- */
644
+ * Checks if a user has ownership of a specific permission.
645
+ */
323
646
  ownership(roleName: string, permission: string | Permission): string | boolean | undefined;
324
647
  /**
325
- * Converts a permission object to a string.
326
- *
327
- * @param permission
328
- */
648
+ * Converts a permission object to a string.
649
+ *
650
+ * @param permission
651
+ */
329
652
  permissionToString(permission: Permission | string): string;
330
653
  getRealms(): Realm[];
331
654
  /**
332
- * Retrieves the user account from the provided user ID.
333
- *
334
- * @param realm
335
- */
655
+ * Retrieves the user account from the provided user ID.
656
+ *
657
+ * @param realm
658
+ */
336
659
  getRoles(realm?: string): Role[];
337
660
  /**
338
- * Returns all permissions.
339
- *
340
- * @param user - Filter permissions by user.
341
- *
342
- * @return An array containing all permissions.
343
- */
661
+ * Returns all permissions.
662
+ *
663
+ * @param user - Filter permissions by user.
664
+ *
665
+ * @return An array containing all permissions.
666
+ */
344
667
  getPermissions(user?: {
345
668
  roles?: Array<Role | string>;
346
669
  realm?: string;
347
670
  }): Permission[];
348
671
  /**
349
- * Retrieves the user ID from the provided payload object.
350
- *
351
- * @param payload - The payload object from which to extract the user ID.
352
- * @return The user ID as a string.
353
- */
672
+ * Retrieves the user ID from the provided payload object.
673
+ *
674
+ * @param payload - The payload object from which to extract the user ID.
675
+ * @return The user ID as a string.
676
+ */
354
677
  getIdFromPayload(payload: Record<string, any>): string;
355
678
  getSessionIdFromPayload(payload: Record<string, any>): string | undefined;
356
679
  /**
357
- * Retrieves the roles from the provided payload object.
358
- * @param payload - The payload object from which to extract the roles.
359
- * @return An array of role strings.
360
- */
680
+ * Retrieves the roles from the provided payload object.
681
+ * @param payload - The payload object from which to extract the roles.
682
+ * @return An array of role strings.
683
+ */
361
684
  getRolesFromPayload(payload: Record<string, any>): string[];
362
685
  getPictureFromPayload(payload: Record<string, any>): string | undefined;
363
686
  getUsernameFromPayload(payload: Record<string, any>): string | undefined;
364
687
  getEmailFromPayload(payload: Record<string, any>): string | undefined;
365
688
  /**
366
- * Returns the name from the given payload.
367
- *
368
- * @param payload - The payload object.
369
- * @returns The name extracted from the payload, or an empty string if the payload is falsy or no name is found.
370
- */
689
+ * Returns the name from the given payload.
690
+ *
691
+ * @param payload - The payload object.
692
+ * @returns The name extracted from the payload, or an empty string if the payload is falsy or no name is found.
693
+ */
371
694
  getNameFromPayload(payload: Record<string, any>): string;
372
695
  getOrganizationsFromPayload(payload: Record<string, any>): string[] | undefined;
373
696
  }
@@ -378,15 +701,15 @@ interface Realm {
378
701
  name: string;
379
702
  roles: Role[];
380
703
  /**
381
- * The secret key for the realm.
382
- *
383
- * Can be also a JWKS URL.
384
- */
704
+ * The secret key for the realm.
705
+ *
706
+ * Can be also a JWKS URL.
707
+ */
385
708
  secret?: string | JSONWebKeySet | (() => string);
386
709
  /**
387
- * Create the user account info based on the raw JWT payload.
388
- * By default, SecurityProvider has his own implementation, but this method allow to override it.
389
- */
710
+ * Create the user account info based on the raw JWT payload.
711
+ * By default, SecurityProvider has his own implementation, but this method allow to override it.
712
+ */
390
713
  profile?: (raw: Record<string, any>) => UserAccount;
391
714
  }
392
715
  interface SecurityCheckResult {
@@ -407,40 +730,40 @@ declare const $issuer: {
407
730
  };
408
731
  type IssuerPrimitiveOptions = {
409
732
  /**
410
- * Define the issuer name.
411
- * If not provided, it will use the property key.
412
- */
733
+ * Define the issuer name.
734
+ * If not provided, it will use the property key.
735
+ */
413
736
  name?: string;
414
737
  /**
415
- * Short description about the issuer.
416
- */
738
+ * Short description about the issuer.
739
+ */
417
740
  description?: string;
418
741
  /**
419
- * All roles available in the issuer. Role is a string (role name) or a Role object (embedded role).
420
- */
742
+ * All roles available in the issuer. Role is a string (role name) or a Role object (embedded role).
743
+ */
421
744
  roles?: Array<string | Role>;
422
745
  /**
423
- * Issuer settings.
424
- */
746
+ * Issuer settings.
747
+ */
425
748
  settings?: IssuerSettings;
426
749
  /**
427
- * Parse the JWT payload to create a user account info.
428
- */
750
+ * Parse the JWT payload to create a user account info.
751
+ */
429
752
  profile?: (jwtPayload: Record<string, any>) => UserAccount;
430
753
  } & (IssuerInternal | IssuerExternal);
431
754
  interface IssuerSettings {
432
755
  accessToken?: {
433
756
  /**
434
- * Lifetime of the access token.
435
- * @default 15 minutes
436
- */
757
+ * Lifetime of the access token.
758
+ * @default 15 minutes
759
+ */
437
760
  expiration?: DurationLike;
438
761
  };
439
762
  refreshToken?: {
440
763
  /**
441
- * Lifetime of the refresh token.
442
- * @default 30 days
443
- */
764
+ * Lifetime of the refresh token.
765
+ * @default 30 days
766
+ */
444
767
  expiration?: DurationLike;
445
768
  };
446
769
  onCreateSession?: (user: UserAccount, config: {
@@ -458,14 +781,14 @@ interface IssuerSettings {
458
781
  }
459
782
  type IssuerInternal = {
460
783
  /**
461
- * Internal secret to sign JWT tokens and verify them.
462
- */
784
+ * Internal secret to sign JWT tokens and verify them.
785
+ */
463
786
  secret: string;
464
787
  };
465
788
  interface IssuerExternal {
466
789
  /**
467
- * URL to the JWKS (JSON Web Key Set) to verify JWT tokens from external providers.
468
- */
790
+ * URL to the JWKS (JSON Web Key Set) to verify JWT tokens from external providers.
791
+ */
469
792
  jwks: (() => string) | JSONWebKeySet;
470
793
  }
471
794
  declare class IssuerPrimitive extends Primitive<IssuerPrimitiveOptions> {
@@ -478,21 +801,21 @@ declare class IssuerPrimitive extends Primitive<IssuerPrimitiveOptions> {
478
801
  get refreshTokenExpiration(): Duration;
479
802
  protected onInit(): void;
480
803
  /**
481
- * Get all roles in the issuer.
482
- */
804
+ * Get all roles in the issuer.
805
+ */
483
806
  getRoles(): Role[];
484
807
  /**
485
- * Set all roles in the issuer.
486
- */
808
+ * Set all roles in the issuer.
809
+ */
487
810
  setRoles(roles: Role[]): Promise<void>;
488
811
  /**
489
- * Get a role by name, throws an error if not found.
490
- */
812
+ * Get a role by name, throws an error if not found.
813
+ */
491
814
  getRoleByName(name: string): Role;
492
815
  parseToken(token: string): Promise<JWTPayload>;
493
816
  /**
494
- * Create a token for the subject.
495
- */
817
+ * Create a token for the subject.
818
+ */
496
819
  createToken(user: UserAccount, refreshToken?: {
497
820
  sid?: string;
498
821
  refresh_token?: string;
@@ -528,16 +851,16 @@ declare const $permission: {
528
851
  };
529
852
  interface PermissionPrimitiveOptions {
530
853
  /**
531
- * Name of the permission. Use Property name is not provided.
532
- */
854
+ * Name of the permission. Use Property name is not provided.
855
+ */
533
856
  name?: string;
534
857
  /**
535
- * Group of the permission. Use Class name is not provided.
536
- */
858
+ * Group of the permission. Use Class name is not provided.
859
+ */
537
860
  group?: string;
538
861
  /**
539
- * Describe the permission.
540
- */
862
+ * Describe the permission.
863
+ */
541
864
  description?: string;
542
865
  }
543
866
  declare class PermissionPrimitive extends Primitive<PermissionPrimitiveOptions> {
@@ -547,8 +870,8 @@ declare class PermissionPrimitive extends Primitive<PermissionPrimitiveOptions>
547
870
  toString(): string;
548
871
  protected onInit(): void;
549
872
  /**
550
- * Check if the user has the permission.
551
- */
873
+ * Check if the user has the permission.
874
+ */
552
875
  can(user?: UserAccount): boolean;
553
876
  }
554
877
  //#endregion
@@ -562,12 +885,12 @@ declare const $role: {
562
885
  };
563
886
  interface RolePrimitiveOptions {
564
887
  /**
565
- * Name of the role.
566
- */
888
+ * Name of the role.
889
+ */
567
890
  name?: string;
568
891
  /**
569
- * Describe the role.
570
- */
892
+ * Describe the role.
893
+ */
571
894
  description?: string;
572
895
  issuer?: string | IssuerPrimitive;
573
896
  permissions?: Array<string | {
@@ -581,8 +904,8 @@ declare class RolePrimitive extends Primitive<RolePrimitiveOptions> {
581
904
  get name(): string;
582
905
  protected onInit(): void;
583
906
  /**
584
- * Get the issuer of the role.
585
- */
907
+ * Get the issuer of the role.
908
+ */
586
909
  get issuer(): string | IssuerPrimitive | undefined;
587
910
  can(permission: string | PermissionPrimitive): boolean;
588
911
  check(permission: string | PermissionPrimitive): SecurityCheckResult;
@@ -628,16 +951,16 @@ type ServiceAccountPrimitiveOptions = {
628
951
  });
629
952
  interface Oauth2ServiceAccountPrimitiveOptions {
630
953
  /**
631
- * Get Token URL.
632
- */
954
+ * Get Token URL.
955
+ */
633
956
  url: string;
634
957
  /**
635
- * Client ID.
636
- */
958
+ * Client ID.
959
+ */
637
960
  clientId: string;
638
961
  /**
639
- * Client Secret.
640
- */
962
+ * Client Secret.
963
+ */
641
964
  clientSecret: string;
642
965
  }
643
966
  interface ServiceAccountPrimitive {
@@ -665,16 +988,16 @@ declare class ServerSecurityProvider {
665
988
  protected readonly onRequest: alepha3.HookPrimitive<"server:onRequest">;
666
989
  protected check(user: UserAccountToken, secure: ServerRouteSecure): void;
667
990
  /**
668
- * Get the user account token for a local action call.
669
- * There are three possible sources for the user:
670
- * - `options.user`: the user passed in the options
671
- * - `"system"`: the system user from the state (you MUST set state `server.security.system.user`)
672
- * - `"context"`: the user from the request context (you MUST be in an HTTP request context)
673
- *
674
- * Priority order: `options.user` > `"system"` > `"context"`.
675
- *
676
- * In testing environment, if no user is provided, a test user is created based on the SecurityProvider's roles.
677
- */
991
+ * Get the user account token for a local action call.
992
+ * There are three possible sources for the user:
993
+ * - `options.user`: the user passed in the options
994
+ * - `"system"`: the system user from the state (you MUST set state `server.security.system.user`)
995
+ * - `"context"`: the user from the request context (you MUST be in an HTTP request context)
996
+ *
997
+ * Priority order: `options.user` > `"system"` > `"context"`.
998
+ *
999
+ * In testing environment, if no user is provided, a test user is created based on the SecurityProvider's roles.
1000
+ */
678
1001
  protected createUserFromLocalFunctionContext(options: {
679
1002
  user?: UserAccountToken | "system" | "context";
680
1003
  }, permission?: Permission): UserAccountToken;
@@ -696,17 +1019,17 @@ declare module "alepha" {
696
1019
  }
697
1020
  interface State {
698
1021
  /**
699
- * Real (or fake) user account, used for internal actions.
700
- *
701
- * If you define this, you assume that all actions are executed by this user by default.
702
- * > To force a different user, you need to pass it explicitly in the options.
703
- */
1022
+ * Real (or fake) user account, used for internal actions.
1023
+ *
1024
+ * If you define this, you assume that all actions are executed by this user by default.
1025
+ * > To force a different user, you need to pass it explicitly in the options.
1026
+ */
704
1027
  "alepha.server.security.system.user"?: UserAccountToken;
705
1028
  /**
706
- * The authenticated user account attached to the server request state.
707
- *
708
- * @internal
709
- */
1029
+ * The authenticated user account attached to the server request state.
1030
+ *
1031
+ * @internal
1032
+ */
710
1033
  "alepha.server.request.user"?: UserAccount;
711
1034
  }
712
1035
  }
@@ -719,19 +1042,19 @@ declare module "alepha/server" {
719
1042
  }
720
1043
  interface ServerRoute {
721
1044
  /**
722
- * If true, the route will be protected by the security provider.
723
- * All actions are secure by default, but you can disable it for specific actions.
724
- */
1045
+ * If true, the route will be protected by the security provider.
1046
+ * All actions are secure by default, but you can disable it for specific actions.
1047
+ */
725
1048
  secure?: boolean | ServerRouteSecure;
726
1049
  }
727
1050
  interface ClientRequestOptions extends FetchOptions {
728
1051
  /**
729
- * Forward user from the previous request.
730
- * If "system", use system user. @see {ServerSecurityProvider.localSystemUser}
731
- * If "context", use the user from the current context (e.g. request).
732
- *
733
- * @default "system" if provided, else "context" if available.
734
- */
1052
+ * Forward user from the previous request.
1053
+ * If "system", use system user. @see {ServerSecurityProvider.localSystemUser}
1054
+ * If "context", use the user from the current context (e.g. request).
1055
+ *
1056
+ * @default "system" if provided, else "context" if available.
1057
+ */
735
1058
  user?: UserAccountToken | "system" | "context";
736
1059
  }
737
1060
  }