alepha 0.9.3 → 0.9.4

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.
package/redis.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import * as _alepha_core1 from "alepha";
2
- import * as _alepha_core3 from "alepha";
3
- import * as _alepha_core0 from "alepha";
4
- import { Alepha, Logger, Static, TNumber, TObject, TOptional, TString } from "alepha";
2
+ import { Alepha, Static, TNumber, TObject, TOptional, TString } from "alepha";
3
+ import * as _alepha_logger0 from "alepha/logger";
5
4
  import { RedisClientType, SetOptions, createClient } from "@redis/client";
6
5
 
7
6
  //#region src/providers/RedisProvider.d.ts
@@ -22,9 +21,13 @@ type RedisSetOptions = SetOptions;
22
21
  * Redis client provider.
23
22
  */
24
23
  declare class RedisProvider {
25
- protected readonly log: Logger;
24
+ protected readonly log: _alepha_logger0.Logger;
26
25
  protected readonly alepha: Alepha;
27
- protected readonly env: Static<typeof envSchema>;
26
+ protected readonly env: {
27
+ REDIS_PASSWORD?: string | undefined;
28
+ REDIS_PORT: number;
29
+ REDIS_HOST: string;
30
+ };
28
31
  protected readonly client: RedisClient;
29
32
  get publisher(): RedisClient;
30
33
  protected readonly start: _alepha_core1.HookDescriptor<"start">;
@@ -51,13 +54,13 @@ declare class RedisProvider {
51
54
  //#endregion
52
55
  //#region src/providers/RedisSubscriberProvider.d.ts
53
56
  declare class RedisSubscriberProvider {
54
- protected readonly log: Logger;
57
+ protected readonly log: _alepha_logger0.Logger;
55
58
  protected readonly alepha: Alepha;
56
59
  protected readonly redisProvider: RedisProvider;
57
60
  protected readonly client: RedisClient;
58
61
  get subscriber(): RedisClient;
59
- protected readonly start: _alepha_core3.HookDescriptor<"start">;
60
- protected readonly stop: _alepha_core3.HookDescriptor<"stop">;
62
+ protected readonly start: _alepha_core1.HookDescriptor<"start">;
63
+ protected readonly stop: _alepha_core1.HookDescriptor<"stop">;
61
64
  connect(): Promise<void>;
62
65
  close(): Promise<void>;
63
66
  /**
@@ -65,7 +68,6 @@ declare class RedisSubscriberProvider {
65
68
  */
66
69
  protected createClient(): RedisClient;
67
70
  }
68
- //# sourceMappingURL=RedisSubscriberProvider.d.ts.map
69
71
  //#endregion
70
72
  //#region src/index.d.ts
71
73
  /**
@@ -74,9 +76,7 @@ declare class RedisSubscriberProvider {
74
76
  * @see {@link RedisProvider}
75
77
  * @module alepha.redis
76
78
  */
77
- declare const AlephaRedis: _alepha_core0.Service<_alepha_core0.Module>;
78
- //# sourceMappingURL=index.d.ts.map
79
-
79
+ declare const AlephaRedis: _alepha_core1.Service<_alepha_core1.Module>;
80
80
  //#endregion
81
81
  export { AlephaRedis, RedisClient, RedisClientOptions, RedisProvider, RedisSetOptions, RedisSubscriberProvider };
82
82
  //# sourceMappingURL=index.d.ts.map
package/retry.d.ts CHANGED
@@ -84,20 +84,16 @@ interface RetryBackoffOptions {
84
84
  */
85
85
  jitter?: boolean;
86
86
  }
87
- //# sourceMappingURL=$retry.d.ts.map
88
87
  //#endregion
89
88
  //#region src/errors/RetryCancelError.d.ts
90
89
  declare class RetryCancelError extends AlephaError {
91
90
  constructor();
92
91
  }
93
- //# sourceMappingURL=RetryCancelError.d.ts.map
94
92
  //#endregion
95
93
  //#region src/errors/RetryTimeoutError.d.ts
96
94
  declare class RetryTimeoutError extends AlephaError {
97
95
  constructor(duration: number);
98
96
  }
99
- //# sourceMappingURL=RetryTimeoutError.d.ts.map
100
-
101
97
  //#endregion
102
98
  export { $retry, RetryBackoffOptions, RetryCancelError, RetryDescriptor, RetryDescriptorFn, RetryDescriptorOptions, RetryTimeoutError };
103
99
  //# sourceMappingURL=index.d.ts.map
package/router.d.ts CHANGED
@@ -39,7 +39,6 @@ interface Tree<T extends Route> {
39
39
  route: T;
40
40
  };
41
41
  }
42
- //# sourceMappingURL=RouterProvider.d.ts.map
43
42
  //#endregion
44
43
  export { Route, RouteMatch, RouterProvider, Tree };
45
44
  //# sourceMappingURL=index.d.ts.map
package/scheduler.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- import * as _alepha_core5 from "alepha";
2
- import * as _alepha_core1 from "alepha";
3
- import * as _alepha_core0 from "alepha";
1
+ import * as _alepha_core4 from "alepha";
4
2
  import { Alepha, Async, Descriptor, KIND, Static } from "alepha";
5
3
  import * as _alepha_lock0 from "alepha/lock";
6
4
  import { DateTime, DateTimeProvider, DurationLike } from "alepha/datetime";
5
+ import * as _alepha_logger0 from "alepha/logger";
7
6
  import { Cron } from "cron-schedule";
8
7
  import * as dayjs0 from "dayjs";
9
8
 
@@ -11,11 +10,11 @@ import * as dayjs0 from "dayjs";
11
10
  declare class CronProvider {
12
11
  protected readonly dt: DateTimeProvider;
13
12
  protected readonly alepha: Alepha;
14
- protected readonly log: _alepha_core5.Logger;
13
+ protected readonly log: _alepha_logger0.Logger;
15
14
  protected readonly cronJobs: Array<CronJob>;
16
15
  getCronJobs(): Array<CronJob>;
17
- protected readonly start: _alepha_core5.HookDescriptor<"start">;
18
- protected readonly stop: _alepha_core5.HookDescriptor<"stop">;
16
+ protected readonly start: _alepha_core4.HookDescriptor<"start">;
17
+ protected readonly stop: _alepha_core4.HookDescriptor<"stop">;
19
18
  protected boot(name: string | CronJob): void;
20
19
  abort(name: string | CronJob): void;
21
20
  /**
@@ -40,7 +39,6 @@ interface CronJob {
40
39
  onError?: (error: Error) => void;
41
40
  abort: AbortController;
42
41
  }
43
- //# sourceMappingURL=CronProvider.d.ts.map
44
42
  //#endregion
45
43
  //#region src/descriptors/$scheduler.d.ts
46
44
  /**
@@ -79,14 +77,14 @@ type SchedulerDescriptorOptions = {
79
77
  */
80
78
  lock?: boolean;
81
79
  };
82
- declare const envSchema: _alepha_core1.TObject<{
83
- SCHEDULER_PREFIX: _alepha_core1.TOptional<_alepha_core1.TString>;
80
+ declare const envSchema: _alepha_core4.TObject<{
81
+ SCHEDULER_PREFIX: _alepha_core4.TOptional<_alepha_core4.TString>;
84
82
  }>;
85
83
  declare module "alepha" {
86
84
  interface Env extends Partial<Static<typeof envSchema>> {}
87
85
  }
88
86
  declare class SchedulerDescriptor extends Descriptor<SchedulerDescriptorOptions> {
89
- protected readonly log: _alepha_core1.Logger;
87
+ protected readonly log: _alepha_logger0.Logger;
90
88
  protected readonly env: {
91
89
  SCHEDULER_PREFIX?: string | undefined;
92
90
  };
@@ -111,9 +109,7 @@ interface SchedulerHandlerArguments {
111
109
  * @see {@link $scheduler}
112
110
  * @module alepha.scheduler
113
111
  */
114
- declare const AlephaScheduler: _alepha_core0.Service<_alepha_core0.Module>;
115
- //# sourceMappingURL=index.d.ts.map
116
-
112
+ declare const AlephaScheduler: _alepha_core4.Service<_alepha_core4.Module>;
117
113
  //#endregion
118
114
  export { $scheduler, AlephaScheduler, SchedulerDescriptor, SchedulerDescriptorOptions, SchedulerHandlerArguments };
119
115
  //# sourceMappingURL=index.d.ts.map
package/security.d.ts CHANGED
@@ -1,33 +1,37 @@
1
- import * as _alepha_core2 from "alepha";
2
- import * as _alepha_core3 from "alepha";
3
1
  import * as _alepha_core1 from "alepha";
4
- import * as _alepha_core0 from "alepha";
5
2
  import { Alepha, Descriptor, KIND, Static } from "alepha";
3
+ import * as _alepha_logger1 from "alepha/logger";
6
4
  import { DateTimeProvider, Duration, DurationLike } from "alepha/datetime";
7
5
  import { CryptoKey, FlattenedJWSInput, JSONWebKeySet, JWSHeaderParameters, JWTHeaderParameters, JWTPayload, JWTVerifyResult, KeyObject } from "jose";
8
- import * as _sinclair_typebox0 from "@sinclair/typebox";
9
6
  import * as _sinclair_typebox13 from "@sinclair/typebox";
10
- import * as _sinclair_typebox23 from "@sinclair/typebox";
11
7
  import { JWTVerifyOptions } from "jose/jwt/verify";
12
8
 
13
9
  //#region src/schemas/userAccountInfoSchema.d.ts
14
- declare const userAccountInfoSchema: _sinclair_typebox0.TObject<{
15
- id: _sinclair_typebox0.TString;
16
- name: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
17
- email: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
18
- picture: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
19
- organizations: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
20
- roles: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
10
+ declare const userAccountInfoSchema: _sinclair_typebox13.TObject<{
11
+ id: _sinclair_typebox13.TString;
12
+ name: _sinclair_typebox13.TOptional<_sinclair_typebox13.TString>;
13
+ email: _sinclair_typebox13.TOptional<_sinclair_typebox13.TString>;
14
+ username: _sinclair_typebox13.TOptional<_sinclair_typebox13.TString>;
15
+ picture: _sinclair_typebox13.TOptional<_sinclair_typebox13.TString>;
16
+ sessionId: _sinclair_typebox13.TOptional<_sinclair_typebox13.TString>;
17
+ organizations: _sinclair_typebox13.TOptional<_sinclair_typebox13.TArray<_sinclair_typebox13.TString>>;
18
+ roles: _sinclair_typebox13.TOptional<_sinclair_typebox13.TArray<_sinclair_typebox13.TString>>;
21
19
  }>;
22
- type UserAccountInfo = Static<typeof userAccountInfoSchema>;
23
- //# sourceMappingURL=userAccountInfoSchema.d.ts.map
20
+ type UserAccount = Static<typeof userAccountInfoSchema>;
24
21
  //#endregion
25
22
  //#region src/interfaces/UserAccountToken.d.ts
26
- interface UserAccountToken extends UserAccountInfo {
23
+ /**
24
+ * Add contextual metadata to a user account info.
25
+ * E.g. UserAccountToken is a UserAccountInfo during a request.
26
+ */
27
+ interface UserAccountToken extends UserAccount {
27
28
  /**
28
29
  * Access token for the user.
29
30
  */
30
31
  token?: string;
32
+ /**
33
+ * Realm name of the user.
34
+ */
31
35
  realm?: string;
32
36
  /**
33
37
  * Is user dedicated to his own resources for this scope ?
@@ -35,7 +39,6 @@ interface UserAccountToken extends UserAccountInfo {
35
39
  */
36
40
  ownership?: string | boolean;
37
41
  }
38
- //# sourceMappingURL=UserAccountToken.d.ts.map
39
42
  //#endregion
40
43
  //#region src/schemas/permissionSchema.d.ts
41
44
  declare const permissionSchema: _sinclair_typebox13.TObject<{
@@ -46,28 +49,26 @@ declare const permissionSchema: _sinclair_typebox13.TObject<{
46
49
  path: _sinclair_typebox13.TOptional<_sinclair_typebox13.TString>;
47
50
  }>;
48
51
  type Permission = Static<typeof permissionSchema>;
49
- //# sourceMappingURL=permissionSchema.d.ts.map
50
52
  //#endregion
51
53
  //#region src/schemas/roleSchema.d.ts
52
- declare const roleSchema: _sinclair_typebox23.TObject<{
53
- name: _sinclair_typebox23.TString;
54
- description: _sinclair_typebox23.TOptional<_sinclair_typebox23.TString>;
55
- default: _sinclair_typebox23.TOptional<_sinclair_typebox23.TBoolean>;
56
- permissions: _sinclair_typebox23.TArray<_sinclair_typebox23.TObject<{
57
- name: _sinclair_typebox23.TString;
58
- ownership: _sinclair_typebox23.TOptional<_sinclair_typebox23.TBoolean>;
59
- exclude: _sinclair_typebox23.TOptional<_sinclair_typebox23.TArray<_sinclair_typebox23.TString>>;
54
+ declare const roleSchema: _sinclair_typebox13.TObject<{
55
+ name: _sinclair_typebox13.TString;
56
+ description: _sinclair_typebox13.TOptional<_sinclair_typebox13.TString>;
57
+ default: _sinclair_typebox13.TOptional<_sinclair_typebox13.TBoolean>;
58
+ permissions: _sinclair_typebox13.TArray<_sinclair_typebox13.TObject<{
59
+ name: _sinclair_typebox13.TString;
60
+ ownership: _sinclair_typebox13.TOptional<_sinclair_typebox13.TBoolean>;
61
+ exclude: _sinclair_typebox13.TOptional<_sinclair_typebox13.TArray<_sinclair_typebox13.TString>>;
60
62
  }>>;
61
63
  }>;
62
64
  type Role = Static<typeof roleSchema>;
63
- //# sourceMappingURL=roleSchema.d.ts.map
64
65
  //#endregion
65
66
  //#region src/providers/JwtProvider.d.ts
66
67
  /**
67
68
  * Provides utilities for working with JSON Web Tokens (JWT).
68
69
  */
69
70
  declare class JwtProvider {
70
- protected readonly log: _alepha_core2.Logger;
71
+ protected readonly log: _alepha_logger1.Logger;
71
72
  protected readonly keystore: KeyLoaderHolder[];
72
73
  protected readonly dateTimeProvider: DateTimeProvider;
73
74
  protected readonly encoder: TextEncoder;
@@ -114,6 +115,7 @@ interface JwtSignOptions {
114
115
  header?: Partial<JWTHeaderParameters>;
115
116
  }
116
117
  interface ExtendedJWTPayload extends JWTPayload {
118
+ sid?: string;
117
119
  name?: string;
118
120
  roles?: string[];
119
121
  email?: string;
@@ -126,20 +128,19 @@ interface JwtParseResult {
126
128
  keyName: string;
127
129
  result: JWTVerifyResult<ExtendedJWTPayload>;
128
130
  }
129
- //# sourceMappingURL=JwtProvider.d.ts.map
130
131
  //#endregion
131
132
  //#region src/providers/SecurityProvider.d.ts
132
- declare const envSchema: _alepha_core3.TObject<{
133
- SECURITY_SECRET_KEY: _alepha_core3.TString;
133
+ declare const envSchema: _alepha_core1.TObject<{
134
+ SECURITY_SECRET_KEY: _alepha_core1.TString;
134
135
  }>;
135
136
  declare module "alepha" {
136
137
  interface Env extends Partial<Static<typeof envSchema>> {}
137
138
  }
138
139
  declare class SecurityProvider {
139
- protected readonly UNKNOWN_USER_NAME = "Unknown User";
140
+ protected readonly UNKNOWN_USER_NAME = "Anonymous User";
140
141
  protected readonly PERMISSION_REGEXP: RegExp;
141
142
  protected readonly PERMISSION_REGEXP_WILDCARD: RegExp;
142
- protected readonly log: _alepha_core3.Logger;
143
+ protected readonly log: _alepha_logger1.Logger;
143
144
  protected readonly jwt: JwtProvider;
144
145
  protected readonly env: {
145
146
  SECURITY_SECRET_KEY: string;
@@ -153,8 +154,7 @@ declare class SecurityProvider {
153
154
  * The realms configured for the security provider.
154
155
  */
155
156
  protected readonly realms: Realm[];
156
- protected configure: _alepha_core3.HookDescriptor<"start">;
157
- protected ready: _alepha_core3.HookDescriptor<"ready">;
157
+ protected configure: _alepha_core1.HookDescriptor<"start">;
158
158
  /**
159
159
  * Adds a role to one or more realms.
160
160
  *
@@ -186,7 +186,7 @@ declare class SecurityProvider {
186
186
  *
187
187
  * @returns The user info created from the payload.
188
188
  */
189
- createUserFromPayload(payload: JWTPayload, realmName?: string): UserAccountInfo;
189
+ createUserFromPayload(payload: JWTPayload, realmName?: string): UserAccount;
190
190
  /**
191
191
  * Checks if the user has the specified permission.
192
192
  *
@@ -250,6 +250,7 @@ declare class SecurityProvider {
250
250
  * @return The user ID as a string.
251
251
  */
252
252
  getIdFromPayload(payload: Record<string, any>): string;
253
+ getSessionIdFromPayload(payload: Record<string, any>): string | undefined;
253
254
  /**
254
255
  * Retrieves the roles from the provided payload object.
255
256
  * @param payload - The payload object from which to extract the roles.
@@ -257,6 +258,7 @@ declare class SecurityProvider {
257
258
  */
258
259
  getRolesFromPayload(payload: Record<string, any>): string[];
259
260
  getPictureFromPayload(payload: Record<string, any>): string | undefined;
261
+ getUsernameFromPayload(payload: Record<string, any>): string | undefined;
260
262
  getEmailFromPayload(payload: Record<string, any>): string | undefined;
261
263
  /**
262
264
  * Returns the name from the given payload.
@@ -280,31 +282,15 @@ interface Realm {
280
282
  */
281
283
  secret?: string | JSONWebKeySet | (() => string);
282
284
  /**
283
- * Attach a user provider to the realm.
284
- *
285
- * This is useful when you want to use a custom user provider for a specific realm.
286
- */
287
- userAccountProvider?: SecurityUserAccountProvider;
288
- onLoadUser?: (user: UserAccountInfo) => Promise<void> | void;
289
- /**
290
- * Function to create a user profile from the raw JWT user data.
285
+ * Create the user account info based on the raw JWT payload.
286
+ * By default, SecurityProvider has his own implementation, but this method allow to override it.
291
287
  */
292
- profile?: (raw: Record<string, any>) => UserAccountInfo;
293
- }
294
- interface SecurityUserAccountProvider {
295
- jwks: string | undefined;
296
- synchronize(config: RealmConfig): Promise<void>;
288
+ profile?: (raw: Record<string, any>) => UserAccount;
297
289
  }
298
290
  interface SecurityCheckResult {
299
291
  isAuthorized: boolean;
300
292
  ownership: string | boolean | undefined;
301
293
  }
302
- interface RealmConfig {
303
- roles?: Array<Role>;
304
- smtp?: {
305
- host?: string;
306
- };
307
- }
308
294
  //#endregion
309
295
  //#region src/descriptors/$permission.d.ts
310
296
  /**
@@ -336,9 +322,8 @@ declare class PermissionDescriptor extends Descriptor<PermissionDescriptorOption
336
322
  /**
337
323
  * Check if the user has the permission.
338
324
  */
339
- can(user: UserAccountInfo): boolean;
325
+ can(user: UserAccount): boolean;
340
326
  }
341
- //# sourceMappingURL=$permission.d.ts.map
342
327
  //#endregion
343
328
  //#region src/descriptors/$realm.d.ts
344
329
  /**
@@ -366,7 +351,7 @@ type RealmDescriptorOptions = {
366
351
  /**
367
352
  * Parse the JWT payload to create a user account info.
368
353
  */
369
- profile?: (jwtPayload: Record<string, any>) => UserAccountInfo;
354
+ profile?: (jwtPayload: Record<string, any>) => UserAccount;
370
355
  } & (RealmInternal | RealmExternal);
371
356
  interface RealmSettings {
372
357
  accessToken?: {
@@ -382,15 +367,19 @@ interface RealmSettings {
382
367
  * @default 30 days
383
368
  */
384
369
  expiration?: DurationLike;
385
- /**
386
- * If true, no refresh token will be created.
387
- */
388
- disabled?: boolean;
389
- create?: (user: UserAccountInfo, refreshToken?: string) => Promise<{
390
- refresh_token: string;
391
- expires_in: number;
392
- }>;
393
370
  };
371
+ onCreateSession?: (user: UserAccount, config: {
372
+ expiresIn: number;
373
+ }) => Promise<{
374
+ refreshToken: string;
375
+ sessionId?: string;
376
+ }>;
377
+ onRefreshSession?: (refreshToken: string) => Promise<{
378
+ user: UserAccount;
379
+ expiresIn: number;
380
+ sessionId?: string;
381
+ }>;
382
+ onDeleteSession?: (refreshToken: string) => Promise<void>;
394
383
  }
395
384
  type RealmInternal = {
396
385
  /**
@@ -403,18 +392,12 @@ interface RealmExternal {
403
392
  * URL to the JWKS (JSON Web Key Set) to verify JWT tokens from external providers.
404
393
  */
405
394
  jwks: (() => string) | JSONWebKeySet;
406
- /**
407
- * Attach a user account provider to the realm to manage roles.
408
- *
409
- * For example, you can use a KeycloakUserProvider to automatically create/update realm roles inside Keycloak.
410
- */
411
- userAccountProvider?: SecurityUserAccountProvider | (() => SecurityUserAccountProvider);
412
395
  }
413
396
  declare class RealmDescriptor extends Descriptor<RealmDescriptorOptions> {
414
397
  protected readonly securityProvider: SecurityProvider;
415
398
  protected readonly dateTimeProvider: DateTimeProvider;
416
399
  protected readonly jwt: JwtProvider;
417
- protected readonly log: _alepha_core1.Logger;
400
+ protected readonly log: _alepha_logger1.Logger;
418
401
  get name(): string;
419
402
  get accessTokenExpiration(): Duration;
420
403
  get refreshTokenExpiration(): Duration;
@@ -435,7 +418,15 @@ declare class RealmDescriptor extends Descriptor<RealmDescriptorOptions> {
435
418
  /**
436
419
  * Create a token for the subject.
437
420
  */
438
- createToken(user: UserAccountInfo, refreshToken?: string): Promise<AccessTokenResponse>;
421
+ createToken(user: UserAccount, refreshToken?: {
422
+ sid?: string;
423
+ refresh_token?: string;
424
+ refresh_token_expires_in?: number;
425
+ }): Promise<AccessTokenResponse>;
426
+ refreshToken(refreshToken: string, accessToken?: string): Promise<{
427
+ tokens: AccessTokenResponse;
428
+ user: UserAccount;
429
+ }>;
439
430
  }
440
431
  interface CreateTokenOptions {
441
432
  sub: string;
@@ -451,7 +442,6 @@ interface AccessTokenResponse {
451
442
  refresh_token_expires_in?: number;
452
443
  scope?: string;
453
444
  }
454
- //# sourceMappingURL=$realm.d.ts.map
455
445
  //#endregion
456
446
  //#region src/descriptors/$role.d.ts
457
447
  /**
@@ -485,7 +475,6 @@ declare class RoleDescriptor extends Descriptor<RoleDescriptorOptions> {
485
475
  */
486
476
  get realm(): string | RealmDescriptor | undefined;
487
477
  }
488
- //# sourceMappingURL=$role.d.ts.map
489
478
  //#endregion
490
479
  //#region src/descriptors/$serviceAccount.d.ts
491
480
  /**
@@ -523,7 +512,7 @@ type ServiceAccountDescriptorOptions = {
523
512
  oauth2: Oauth2ServiceAccountDescriptorOptions;
524
513
  } | {
525
514
  realm: RealmDescriptor;
526
- user: UserAccountInfo;
515
+ user: UserAccount;
527
516
  });
528
517
  interface Oauth2ServiceAccountDescriptorOptions {
529
518
  /**
@@ -545,35 +534,30 @@ interface ServiceAccountDescriptor {
545
534
  interface ServiceAccountStore {
546
535
  response?: AccessTokenResponse;
547
536
  }
548
- //# sourceMappingURL=$serviceAccount.d.ts.map
549
537
  //#endregion
550
538
  //#region src/errors/InvalidPermissionError.d.ts
551
539
  declare class InvalidPermissionError extends Error {
552
540
  constructor(name: string);
553
541
  }
554
- //# sourceMappingURL=InvalidPermissionError.d.ts.map
555
542
  //#endregion
556
543
  //#region src/errors/SecurityError.d.ts
557
544
  declare class SecurityError extends Error {
558
545
  name: string;
559
546
  readonly status = 403;
560
547
  }
561
- //# sourceMappingURL=SecurityError.d.ts.map
562
548
  //#endregion
563
549
  //#region src/providers/CryptoProvider.d.ts
564
550
  declare class CryptoProvider {
565
551
  hashPassword(password: string): Promise<string>;
566
552
  verifyPassword(password: string, stored: string): Promise<boolean>;
567
553
  }
568
- //# sourceMappingURL=CryptoProvider.d.ts.map
569
-
570
554
  //#endregion
571
555
  //#region src/index.d.ts
572
556
  declare module "alepha" {
573
557
  interface Hooks {
574
558
  "security:user:created": {
575
559
  realm: string;
576
- user: UserAccountInfo;
560
+ user: UserAccount;
577
561
  };
578
562
  }
579
563
  }
@@ -589,9 +573,7 @@ declare module "alepha" {
589
573
  * @see {@link $permission}
590
574
  * @module alepha.security
591
575
  */
592
- declare const AlephaSecurity: _alepha_core0.Service<_alepha_core0.Module>;
593
- //# sourceMappingURL=index.d.ts.map
594
-
576
+ declare const AlephaSecurity: _alepha_core1.Service<_alepha_core1.Module>;
595
577
  //#endregion
596
- export { $permission, $realm, $role, $serviceAccount, AccessTokenResponse, AlephaSecurity, CreateTokenOptions, CryptoProvider, ExtendedJWTPayload, InvalidPermissionError, JwtParseResult, JwtProvider, JwtSignOptions, KeyLoader, KeyLoaderHolder, Oauth2ServiceAccountDescriptorOptions, Permission, PermissionDescriptor, PermissionDescriptorOptions, Realm, RealmConfig, RealmDescriptor, RealmDescriptorOptions, RealmExternal, RealmInternal, RealmSettings, Role, RoleDescriptor, RoleDescriptorOptions, SecurityCheckResult, SecurityError, SecurityProvider, SecurityUserAccountProvider, ServiceAccountDescriptor, ServiceAccountDescriptorOptions, ServiceAccountStore, UserAccountInfo, UserAccountToken, permissionSchema, roleSchema, userAccountInfoSchema };
578
+ export { $permission, $realm, $role, $serviceAccount, AccessTokenResponse, AlephaSecurity, CreateTokenOptions, CryptoProvider, ExtendedJWTPayload, InvalidPermissionError, JwtParseResult, JwtProvider, JwtSignOptions, KeyLoader, KeyLoaderHolder, Oauth2ServiceAccountDescriptorOptions, Permission, PermissionDescriptor, PermissionDescriptorOptions, Realm, RealmDescriptor, RealmDescriptorOptions, RealmExternal, RealmInternal, RealmSettings, Role, RoleDescriptor, RoleDescriptorOptions, SecurityCheckResult, SecurityError, SecurityProvider, ServiceAccountDescriptor, ServiceAccountDescriptorOptions, ServiceAccountStore, UserAccount, UserAccountToken, permissionSchema, roleSchema, userAccountInfoSchema };
597
579
  //# sourceMappingURL=index.d.ts.map
package/server/cache.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as _alepha_cache0 from "alepha/cache";
2
2
  import { CacheDescriptorOptions } from "alepha/cache";
3
3
  import * as _alepha_core1 from "alepha";
4
- import * as _alepha_core0 from "alepha";
5
4
  import { Alepha } from "alepha";
6
5
  import { DateTimeProvider, DurationLike } from "alepha/datetime";
6
+ import * as _alepha_logger0 from "alepha/logger";
7
7
  import { RequestConfigSchema, ServerRequest, ServerRoute } from "alepha/server";
8
8
 
9
9
  //#region src/providers/ServerCacheProvider.d.ts
@@ -16,7 +16,7 @@ declare module "alepha/server" {
16
16
  }
17
17
  }
18
18
  declare class ServerCacheProvider {
19
- protected readonly log: _alepha_core1.Logger;
19
+ protected readonly log: _alepha_logger0.Logger;
20
20
  protected readonly alepha: Alepha;
21
21
  protected readonly time: DateTimeProvider;
22
22
  protected readonly cache: _alepha_cache0.CacheDescriptorFn<RouteCacheEntry, any[]>;
@@ -72,9 +72,7 @@ interface RouteCacheEntry {
72
72
  * @see {@link ServerCacheProvider}
73
73
  * @module alepha.server.cache
74
74
  */
75
- declare const AlephaServerCache: _alepha_core0.Service<_alepha_core0.Module>;
76
- //# sourceMappingURL=index.d.ts.map
77
-
75
+ declare const AlephaServerCache: _alepha_core1.Service<_alepha_core1.Module>;
78
76
  //#endregion
79
77
  export { AlephaServerCache, ServerCacheProvider, ServerRouteCache };
80
78
  //# sourceMappingURL=index.d.ts.map
@@ -19,7 +19,6 @@ declare class ServerCompressProvider {
19
19
  interface ServerCompressProviderOptions {
20
20
  allowedContentTypes: string[];
21
21
  }
22
- //# sourceMappingURL=ServerCompressProvider.d.ts.map
23
22
  //#endregion
24
23
  //#region src/index.d.ts
25
24
  /**
@@ -28,8 +27,6 @@ interface ServerCompressProviderOptions {
28
27
  * Compresses responses using gzip, brotli, or zstd based on the `Accept-Encoding` header.
29
28
  */
30
29
  declare const AlephaServerCompress: _alepha_core0.Service<_alepha_core0.Module>;
31
- //# sourceMappingURL=index.d.ts.map
32
-
33
30
  //#endregion
34
31
  export { AlephaServerCompress, ServerCompressProvider, ServerCompressProviderOptions };
35
32
  //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import * as _alepha_core1 from "alepha";
2
- import * as _alepha_core0 from "alepha";
3
2
  import { Alepha, Descriptor, KIND, Static, TSchema } from "alepha";
4
3
  import { DateTimeProvider, DurationLike } from "alepha/datetime";
4
+ import * as _alepha_logger0 from "alepha/logger";
5
5
 
6
6
  //#region src/services/CookieParser.d.ts
7
7
  declare class CookieParser {
@@ -9,7 +9,6 @@ declare class CookieParser {
9
9
  serializeResponseCookies(cookies: Record<string, Cookie | null>, isHttps: boolean): string[];
10
10
  cookieToString(name: string, cookie: Cookie, isHttps?: boolean): string;
11
11
  }
12
- //# sourceMappingURL=CookieParser.d.ts.map
13
12
  //#endregion
14
13
  //#region src/providers/ServerCookiesProvider.d.ts
15
14
  declare const envSchema: _alepha_core1.TObject<{
@@ -23,7 +22,7 @@ declare module "alepha" {
23
22
  }
24
23
  declare class ServerCookiesProvider {
25
24
  protected readonly alepha: Alepha;
26
- protected readonly log: _alepha_core1.Logger;
25
+ protected readonly log: _alepha_logger0.Logger;
27
26
  protected readonly env: {
28
27
  COOKIE_SECRET?: string | undefined;
29
28
  };
@@ -34,6 +33,7 @@ declare class ServerCookiesProvider {
34
33
  protected readonly AUTH_TAG_LENGTH = 16;
35
34
  protected readonly SIGNATURE_LENGTH = 32;
36
35
  readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
36
+ readonly onAction: _alepha_core1.HookDescriptor<"action:onRequest">;
37
37
  readonly onSend: _alepha_core1.HookDescriptor<"server:onSend">;
38
38
  protected getCookiesFromContext(cookies?: Cookies): Cookies;
39
39
  getCookie<T extends TSchema>(name: string, options: CookieDescriptorOptions<T>, contextCookies?: Cookies): Static<T> | undefined;
@@ -130,7 +130,6 @@ interface Cookie {
130
130
  sameSite?: "strict" | "lax" | "none";
131
131
  domain?: string;
132
132
  }
133
- //# sourceMappingURL=$cookie.d.ts.map
134
133
  //#endregion
135
134
  //#region src/index.d.ts
136
135
  declare module "alepha/server" {
@@ -148,9 +147,7 @@ declare module "alepha/server" {
148
147
  * @see {@link $cookie}
149
148
  * @module alepha.server.cookies
150
149
  */
151
- declare const AlephaServerCookies: _alepha_core0.Service<_alepha_core0.Module>;
152
- //# sourceMappingURL=index.d.ts.map
153
-
150
+ declare const AlephaServerCookies: _alepha_core1.Service<_alepha_core1.Module>;
154
151
  //#endregion
155
152
  export { $cookie, AbstractCookieDescriptor, AlephaServerCookies, Cookie, CookieDescriptor, CookieDescriptorOptions, Cookies, ServerCookiesProvider };
156
153
  //# sourceMappingURL=index.d.ts.map
package/server/cors.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import * as _alepha_core1 from "alepha";
2
- import * as _alepha_core0 from "alepha";
3
2
  import { ServerRouterProvider } from "alepha/server";
4
3
 
5
4
  //#region src/providers/ServerCorsProvider.d.ts
@@ -17,15 +16,12 @@ interface ServerCorsProviderOptions {
17
16
  credentials?: boolean;
18
17
  maxAge?: number;
19
18
  }
20
- //# sourceMappingURL=ServerCorsProvider.d.ts.map
21
19
  //#endregion
22
20
  //#region src/index.d.ts
23
21
  /**
24
22
  * Plugin for configuring CORS on the Alepha server.
25
23
  */
26
- declare const AlephaServerCors: _alepha_core0.Service<_alepha_core0.Module>;
27
- //# sourceMappingURL=index.d.ts.map
28
-
24
+ declare const AlephaServerCors: _alepha_core1.Service<_alepha_core1.Module>;
29
25
  //#endregion
30
26
  export { AlephaServerCors, ServerCorsProvider, ServerCorsProviderOptions };
31
27
  //# sourceMappingURL=index.d.ts.map
@@ -22,7 +22,6 @@ declare class ServerHealthProvider {
22
22
  }>;
23
23
  }>;
24
24
  }
25
- //# sourceMappingURL=ServerHealthProvider.d.ts.map
26
25
  //#endregion
27
26
  //#region src/index.d.ts
28
27
  /**
@@ -32,8 +31,6 @@ declare class ServerHealthProvider {
32
31
  * @module alepha.server.health
33
32
  */
34
33
  declare const AlephaServerHealth: _alepha_core0.Service<_alepha_core0.Module>;
35
- //# sourceMappingURL=index.d.ts.map
36
-
37
34
  //#endregion
38
35
  export { AlephaServerHealth, ServerHealthProvider };
39
36
  //# sourceMappingURL=index.d.ts.map