alepha 0.10.7 → 0.11.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.
package/retry.d.ts CHANGED
@@ -11,11 +11,11 @@ declare const $retry: {
11
11
  <T extends (...args: any[]) => any>(options: RetryDescriptorOptions<T>): RetryDescriptorFn<T>;
12
12
  [KIND]: typeof RetryDescriptor;
13
13
  };
14
- interface RetryDescriptorOptions<T$1 extends (...args: any[]) => any> {
14
+ interface RetryDescriptorOptions<T extends (...args: any[]) => any> {
15
15
  /**
16
16
  * The function to retry.
17
17
  */
18
- handler: T$1;
18
+ handler: T;
19
19
  /**
20
20
  * The maximum number of attempts.
21
21
  *
@@ -45,20 +45,20 @@ interface RetryDescriptorOptions<T$1 extends (...args: any[]) => any> {
45
45
  * A custom callback for when a retry attempt fails.
46
46
  * This is called before the delay.
47
47
  */
48
- onError?: (error: Error, attempt: number, ...args: Parameters<T$1>) => void;
48
+ onError?: (error: Error, attempt: number, ...args: Parameters<T>) => void;
49
49
  /**
50
50
  * An AbortSignal to allow for external cancellation of the retry loop.
51
51
  */
52
52
  signal?: AbortSignal;
53
53
  }
54
- declare class RetryDescriptor<T$1 extends (...args: any[]) => any> extends Descriptor<RetryDescriptorOptions<T$1>> {
54
+ declare class RetryDescriptor<T extends (...args: any[]) => any> extends Descriptor<RetryDescriptorOptions<T>> {
55
55
  protected readonly dateTimeProvider: DateTimeProvider;
56
56
  protected appAbortController: AbortController;
57
- constructor(args: DescriptorArgs<RetryDescriptorOptions<T$1>>);
58
- run(...args: Parameters<T$1>): Promise<ReturnType<T$1>>;
57
+ constructor(args: DescriptorArgs<RetryDescriptorOptions<T>>);
58
+ run(...args: Parameters<T>): Promise<ReturnType<T>>;
59
59
  }
60
- interface RetryDescriptorFn<T$1 extends (...args: any[]) => any> extends RetryDescriptor<T$1> {
61
- (...args: Parameters<T$1>): Promise<ReturnType<T$1>>;
60
+ interface RetryDescriptorFn<T extends (...args: any[]) => any> extends RetryDescriptor<T> {
61
+ (...args: Parameters<T>): Promise<ReturnType<T>>;
62
62
  }
63
63
  interface RetryBackoffOptions {
64
64
  /**
package/scheduler.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import * as _alepha_core4 from "alepha";
1
+ import * as _alepha_core1 from "alepha";
2
2
  import { Alepha, Async, Descriptor, KIND, Static } from "alepha";
3
3
  import * as _alepha_lock0 from "alepha/lock";
4
4
  import { DateTime, DateTimeProvider, DurationLike } from "alepha/datetime";
5
5
  import * as _alepha_logger0 from "alepha/logger";
6
- import { Cron } from "cron-schedule";
7
6
  import * as dayjs0 from "dayjs";
7
+ import { Cron } from "cron-schedule";
8
8
 
9
9
  //#region src/constants/CRON.d.ts
10
10
  declare const CRON: {
@@ -23,8 +23,8 @@ declare class CronProvider {
23
23
  protected readonly log: _alepha_logger0.Logger;
24
24
  protected readonly cronJobs: Array<CronJob>;
25
25
  getCronJobs(): Array<CronJob>;
26
- protected readonly start: _alepha_core4.HookDescriptor<"start">;
27
- protected readonly stop: _alepha_core4.HookDescriptor<"stop">;
26
+ protected readonly start: _alepha_core1.HookDescriptor<"start">;
27
+ protected readonly stop: _alepha_core1.HookDescriptor<"stop">;
28
28
  protected boot(name: string | CronJob): void;
29
29
  abort(name: string | CronJob): void;
30
30
  /**
@@ -87,8 +87,8 @@ type SchedulerDescriptorOptions = {
87
87
  */
88
88
  lock?: boolean;
89
89
  };
90
- declare const envSchema: _alepha_core4.TObject<{
91
- SCHEDULER_PREFIX: _alepha_core4.TOptional<_alepha_core4.TString>;
90
+ declare const envSchema: _alepha_core1.TObject<{
91
+ SCHEDULER_PREFIX: _alepha_core1.TOptional<_alepha_core1.TString>;
92
92
  }>;
93
93
  declare module "alepha" {
94
94
  interface Env extends Partial<Static<typeof envSchema>> {}
@@ -139,7 +139,7 @@ declare module "alepha" {
139
139
  * @see {@link $scheduler}
140
140
  * @module alepha.scheduler
141
141
  */
142
- declare const AlephaScheduler: _alepha_core4.Service<_alepha_core4.Module<{}>>;
142
+ declare const AlephaScheduler: _alepha_core1.Service<_alepha_core1.Module<{}>>;
143
143
  //#endregion
144
144
  export { $scheduler, AlephaScheduler, CRON, CronJob, CronProvider, SchedulerDescriptor, SchedulerDescriptorOptions, SchedulerHandlerArguments };
145
145
  //# sourceMappingURL=index.d.ts.map
package/security.d.ts CHANGED
@@ -130,6 +130,7 @@ interface JwtParseResult {
130
130
  }
131
131
  //#endregion
132
132
  //#region src/providers/SecurityProvider.d.ts
133
+ declare const DEFAULT_APP_SECRET = "05759934015388327323179852515731";
133
134
  declare const envSchema: _alepha_core1.TObject<{
134
135
  APP_SECRET: _alepha_core1.TString;
135
136
  }>;
@@ -581,5 +582,5 @@ declare module "alepha" {
581
582
  */
582
583
  declare const AlephaSecurity: _alepha_core1.Service<_alepha_core1.Module<{}>>;
583
584
  //#endregion
584
- 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 };
585
+ export { $permission, $realm, $role, $serviceAccount, AccessTokenResponse, AlephaSecurity, CreateTokenOptions, CryptoProvider, DEFAULT_APP_SECRET, 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 };
585
586
  //# sourceMappingURL=index.d.ts.map
@@ -2,7 +2,6 @@ import * as _alepha_core1 from "alepha";
2
2
  import { Alepha, Descriptor, KIND, Static, TSchema } from "alepha";
3
3
  import { DateTimeProvider, DurationLike } from "alepha/datetime";
4
4
  import * as _alepha_logger0 from "alepha/logger";
5
- import { SecurityProvider } from "alepha/security";
6
5
 
7
6
  //#region src/services/CookieParser.d.ts
8
7
  declare class CookieParser {
@@ -17,7 +16,9 @@ declare class ServerCookiesProvider {
17
16
  protected readonly log: _alepha_logger0.Logger;
18
17
  protected readonly cookieParser: CookieParser;
19
18
  protected readonly dateTimeProvider: DateTimeProvider;
20
- protected readonly securityProvider: SecurityProvider;
19
+ protected readonly env: {
20
+ APP_SECRET: string;
21
+ };
21
22
  protected readonly ALGORITHM = "aes-256-gcm";
22
23
  protected readonly IV_LENGTH = 16;
23
24
  protected readonly AUTH_TAG_LENGTH = 16;
@@ -45,9 +46,9 @@ declare const $cookie: {
45
46
  <T extends TSchema>(options: CookieDescriptorOptions<T>): AbstractCookieDescriptor<T>;
46
47
  [KIND]: typeof CookieDescriptor;
47
48
  };
48
- interface CookieDescriptorOptions<T$1 extends TSchema> {
49
+ interface CookieDescriptorOptions<T extends TSchema> {
49
50
  /** The schema for the cookie's value, used for validation and type safety. */
50
- schema: T$1;
51
+ schema: T;
51
52
  /** The name of the cookie. */
52
53
  name?: string;
53
54
  /** The cookie's path. Defaults to "/". */
@@ -69,28 +70,28 @@ interface CookieDescriptorOptions<T$1 extends TSchema> {
69
70
  /** If true, the cookie will be signed to prevent tampering. Requires `COOKIE_SECRET` env var. */
70
71
  sign?: boolean;
71
72
  }
72
- interface AbstractCookieDescriptor<T$1 extends TSchema> {
73
+ interface AbstractCookieDescriptor<T extends TSchema> {
73
74
  readonly name: string;
74
- readonly options: CookieDescriptorOptions<T$1>;
75
- set(value: Static<T$1>, options?: {
75
+ readonly options: CookieDescriptorOptions<T>;
76
+ set(value: Static<T>, options?: {
76
77
  cookies?: Cookies;
77
78
  ttl?: DurationLike;
78
79
  }): void;
79
80
  get(options?: {
80
81
  cookies?: Cookies;
81
- }): Static<T$1> | undefined;
82
+ }): Static<T> | undefined;
82
83
  del(options?: {
83
84
  cookies?: Cookies;
84
85
  }): void;
85
86
  }
86
- declare class CookieDescriptor<T$1 extends TSchema> extends Descriptor<CookieDescriptorOptions<T$1>> implements AbstractCookieDescriptor<T$1> {
87
+ declare class CookieDescriptor<T extends TSchema> extends Descriptor<CookieDescriptorOptions<T>> implements AbstractCookieDescriptor<T> {
87
88
  protected readonly serverCookiesProvider: ServerCookiesProvider;
88
- get schema(): T$1;
89
+ get schema(): T;
89
90
  get name(): string;
90
91
  /**
91
92
  * Sets the cookie with the given value in the current request's response.
92
93
  */
93
- set(value: Static<T$1>, options?: {
94
+ set(value: Static<T>, options?: {
94
95
  cookies?: Cookies;
95
96
  ttl?: DurationLike;
96
97
  }): void;
@@ -99,7 +100,7 @@ declare class CookieDescriptor<T$1 extends TSchema> extends Descriptor<CookieDes
99
100
  */
100
101
  get(options?: {
101
102
  cookies?: Cookies;
102
- }): Static<T$1> | undefined;
103
+ }): Static<T> | undefined;
103
104
  /**
104
105
  * Deletes the cookie in the current request's response.
105
106
  */
@@ -2,11 +2,12 @@ import * as _alepha_core0 from "alepha";
2
2
  import { Alepha } from "alepha";
3
3
  import * as _alepha_server0 from "alepha/server";
4
4
  import { DateTimeProvider } from "alepha/datetime";
5
- import * as typebox0 from "typebox";
5
+ import * as typebox5 from "typebox";
6
+ import * as dayjs0 from "dayjs";
6
7
 
7
8
  //#region src/providers/ServerHealthProvider.d.ts
8
9
  /**
9
- * Register `/health` endpoint.
10
+ * Register `/health` & `/healthz` endpoint.
10
11
  *
11
12
  * - Provides basic health information about the server.
12
13
  */
@@ -14,15 +15,37 @@ declare class ServerHealthProvider {
14
15
  protected readonly time: DateTimeProvider;
15
16
  protected readonly alepha: Alepha;
16
17
  readonly health: _alepha_server0.RouteDescriptor<{
17
- response: typebox0.TObject<{
18
- message: typebox0.TString;
19
- uptime: typebox0.TNumber;
20
- date: typebox0.TString;
21
- ready: typebox0.TBoolean;
18
+ response: typebox5.TObject<{
19
+ message: typebox5.TString;
20
+ uptime: typebox5.TNumber;
21
+ date: typebox5.TCodec<typebox5.TString, dayjs0.Dayjs>;
22
+ ready: typebox5.TBoolean;
22
23
  }>;
23
24
  }>;
25
+ readonly healthz: _alepha_server0.RouteDescriptor<{
26
+ response: typebox5.TObject<{
27
+ message: typebox5.TString;
28
+ uptime: typebox5.TNumber;
29
+ date: typebox5.TCodec<typebox5.TString, dayjs0.Dayjs>;
30
+ ready: typebox5.TBoolean;
31
+ }>;
32
+ }>;
33
+ protected healthCheck(): {
34
+ message: string;
35
+ uptime: number;
36
+ date: dayjs0.Dayjs;
37
+ ready: boolean;
38
+ };
24
39
  }
25
40
  //#endregion
41
+ //#region src/schemas/healthSchema.d.ts
42
+ declare const healthSchema: typebox5.TObject<{
43
+ message: typebox5.TString;
44
+ uptime: typebox5.TNumber;
45
+ date: typebox5.TCodec<typebox5.TString, dayjs0.Dayjs>;
46
+ ready: typebox5.TBoolean;
47
+ }>;
48
+ //#endregion
26
49
  //#region src/index.d.ts
27
50
  /**
28
51
  * Plugin for Alepha Server that provides health-check endpoints.
@@ -32,5 +55,5 @@ declare class ServerHealthProvider {
32
55
  */
33
56
  declare const AlephaServerHealth: _alepha_core0.Service<_alepha_core0.Module<{}>>;
34
57
  //#endregion
35
- export { AlephaServerHealth, ServerHealthProvider };
58
+ export { AlephaServerHealth, ServerHealthProvider, healthSchema };
36
59
  //# sourceMappingURL=index.d.ts.map
package/server/links.d.ts CHANGED
@@ -93,9 +93,9 @@ interface ClientScope {
93
93
  service?: string;
94
94
  hostname?: string;
95
95
  }
96
- type HttpVirtualClient<T$1> = { [K in keyof T$1 as T$1[K] extends ActionDescriptor<RequestConfigSchema> ? K : never]: T$1[K] extends ActionDescriptor<infer Schema> ? VirtualAction<Schema> : never };
97
- interface VirtualAction<T$1 extends RequestConfigSchema> extends Pick<ActionDescriptor<T$1>, "name" | "run" | "fetch"> {
98
- (config?: ClientRequestEntry<T$1>, opts?: ClientRequestOptions): Promise<ClientRequestResponse<T$1>>;
96
+ type HttpVirtualClient<T> = { [K in keyof T as T[K] extends ActionDescriptor<RequestConfigSchema> ? K : never]: T[K] extends ActionDescriptor<infer Schema> ? VirtualAction<Schema> : never };
97
+ interface VirtualAction<T extends RequestConfigSchema> extends Pick<ActionDescriptor<T>, "name" | "run" | "fetch"> {
98
+ (config?: ClientRequestEntry<T>, opts?: ClientRequestOptions): Promise<ClientRequestResponse<T>>;
99
99
  can: () => boolean;
100
100
  }
101
101
  //#endregion
@@ -1,8 +1,8 @@
1
1
  import * as _alepha_core0 from "alepha";
2
2
  import { Alepha, FileLike, HookDescriptor } from "alepha";
3
3
  import { ServerRoute } from "alepha/server";
4
- import { BusboyConfig } from "@fastify/busboy";
5
4
  import { IncomingMessage } from "node:http";
5
+ import { BusboyConfig } from "@fastify/busboy";
6
6
 
7
7
  //#region src/providers/ServerMultipartProvider.d.ts
8
8
  declare class ServerMultipartProvider {
@@ -10,7 +10,7 @@ declare class ServerMultipartProvider {
10
10
  readonly onRequest: HookDescriptor<"server:onRequest">;
11
11
  readonly onSend: HookDescriptor<"server:onResponse">;
12
12
  handleMultipartBodyFromNode(route: ServerRoute, stream: IncomingMessage): Promise<{
13
- body: Record<string, any>;
13
+ body: Record<string, unknown>;
14
14
  cleanup: () => Promise<void>;
15
15
  }>;
16
16
  parseMultipart(req: IncomingMessage, config?: Omit<BusboyConfig, "headers">): Promise<MultipartResult>;
@@ -103,6 +103,9 @@ declare class ServerSwaggerProvider {
103
103
  protected readonly alepha: Alepha;
104
104
  protected readonly log: _alepha_logger0.Logger;
105
105
  json?: OpenAPIV3.Document;
106
+ options: {
107
+ excludeKeys: string[];
108
+ };
106
109
  protected readonly configure: _alepha_core1.HookDescriptor<"configure">;
107
110
  createSwagger(options: SwaggerDescriptorOptions): Promise<OpenAPIV3.Document | undefined>;
108
111
  protected configureOpenApi(actions: ActionDescriptor<RequestConfigSchema>[], doc: SwaggerDescriptorOptions): OpenAPIV3.Document;
@@ -115,6 +118,7 @@ declare class ServerSwaggerProvider {
115
118
  } | undefined;
116
119
  protected configureSwaggerApi(prefix: string, json: OpenAPIV3.Document): void;
117
120
  protected configureSwaggerUi(prefix: string, options: SwaggerDescriptorOptions): Promise<void>;
121
+ removePrivateFields<T extends Record<string, any>>(obj: T, excludeList: string[]): T;
118
122
  }
119
123
  //#endregion
120
124
  //#region src/index.d.ts
package/server.d.ts CHANGED
@@ -68,14 +68,14 @@ interface RequestConfigSchema {
68
68
  headers?: TObject;
69
69
  response?: TResponseBody;
70
70
  }
71
- interface ServerRequestConfig<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> {
72
- body: TConfig$1["body"] extends TRequestBody ? Static<TConfig$1["body"]> : any;
73
- headers: TConfig$1["headers"] extends TObject ? Static<TConfig$1["headers"]> : Record<string, string>;
74
- params: TConfig$1["params"] extends TObject ? Static<TConfig$1["params"]> : Record<string, string>;
75
- query: TConfig$1["query"] extends TObject ? Static<TConfig$1["query"]> : Record<string, any>;
76
- }
77
- type ServerRequestConfigEntry<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> = Partial<ServerRequestConfig<TConfig$1>>;
78
- interface ServerRequest<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> extends ServerRequestConfig<TConfig$1> {
71
+ interface ServerRequestConfig<TConfig extends RequestConfigSchema = RequestConfigSchema> {
72
+ body: TConfig["body"] extends TRequestBody ? Static<TConfig["body"]> : any;
73
+ headers: TConfig["headers"] extends TObject ? Static<TConfig["headers"]> : Record<string, string>;
74
+ params: TConfig["params"] extends TObject ? Static<TConfig["params"]> : Record<string, string>;
75
+ query: TConfig["query"] extends TObject ? Static<TConfig["query"]> : Record<string, any>;
76
+ }
77
+ type ServerRequestConfigEntry<TConfig extends RequestConfigSchema = RequestConfigSchema> = Partial<ServerRequestConfig<TConfig>>;
78
+ interface ServerRequest<TConfig extends RequestConfigSchema = RequestConfigSchema> extends ServerRequestConfig<TConfig> {
79
79
  method: RouteMethod;
80
80
  url: URL;
81
81
  requestId: string;
@@ -120,19 +120,19 @@ interface ServerRequest<TConfig$1 extends RequestConfigSchema = RequestConfigSch
120
120
  };
121
121
  };
122
122
  }
123
- interface ServerRoute<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> extends Route {
124
- handler: ServerHandler<TConfig$1>;
123
+ interface ServerRoute<TConfig extends RequestConfigSchema = RequestConfigSchema> extends Route {
124
+ handler: ServerHandler<TConfig>;
125
125
  method?: RouteMethod;
126
- schema?: TConfig$1;
126
+ schema?: TConfig;
127
127
  /**
128
128
  * @see ServerLoggerProvider
129
129
  */
130
130
  silent?: boolean;
131
131
  }
132
- type ServerResponseBody<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> = TConfig$1["response"] extends TResponseBody ? Static<TConfig$1["response"]> : ResponseBodyType;
132
+ type ServerResponseBody<TConfig extends RequestConfigSchema = RequestConfigSchema> = TConfig["response"] extends TResponseBody ? Static<TConfig["response"]> : ResponseBodyType;
133
133
  type ResponseKind = "json" | "text" | "void" | "file" | "any";
134
134
  type ResponseBodyType = string | Buffer | StreamLike | undefined | null | void;
135
- type ServerHandler<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> = (request: ServerRequest<TConfig$1>) => Async<ServerResponseBody<TConfig$1>>;
135
+ type ServerHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (request: ServerRequest<TConfig>) => Async<ServerResponseBody<TConfig>>;
136
136
  interface ServerResponse {
137
137
  body: string | Buffer | ArrayBuffer | Readable | ReadableStream;
138
138
  headers: Record<string, string>;
@@ -238,9 +238,7 @@ declare class HttpClient {
238
238
  readonly cache: _alepha_cache0.CacheDescriptorFn<HttpClientCache, any[]>;
239
239
  protected readonly pendingRequests: HttpClientPendingRequests;
240
240
  fetchAction(args: FetchActionArgs): Promise<FetchResponse>;
241
- fetch<T>(url: string, request?: RequestInit,
242
- // standard options
243
- options?: FetchOptions): Promise<FetchResponse<T>>;
241
+ fetch<T extends TSchema>(url: string, request?: RequestInitWithOptions<T>): Promise<FetchResponse<Static<T>>>;
244
242
  protected url(host: string, action: HttpAction, args: ServerRequestConfigEntry): string;
245
243
  protected body(init: RequestInit, headers: Record<string, string>, action: HttpAction, args?: ServerRequestConfigEntry): Promise<void>;
246
244
  protected responseData(response: Response, options: FetchOptions): Promise<any>;
@@ -257,7 +255,7 @@ declare class HttpClient {
257
255
  };
258
256
  }, args?: ServerRequestConfigEntry): string;
259
257
  }
260
- interface FetchOptions {
258
+ interface FetchOptions<T extends TSchema = TSchema> {
261
259
  /**
262
260
  * Key to identify the request in the pending requests.
263
261
  */
@@ -265,14 +263,17 @@ interface FetchOptions {
265
263
  /**
266
264
  * The schema to validate the response against.
267
265
  */
268
- schema?: TSchema;
266
+ schema?: {
267
+ response?: T;
268
+ };
269
269
  /**
270
270
  * Built-in cache options.
271
271
  */
272
- cache?: boolean | number | DurationLike;
272
+ localCache?: boolean | number | DurationLike;
273
273
  }
274
- interface FetchResponse<T$1 = any> {
275
- data: T$1;
274
+ type RequestInitWithOptions<T extends TSchema = TSchema> = RequestInit & FetchOptions<T>;
275
+ interface FetchResponse<T = any> {
276
+ data: T;
276
277
  status: number;
277
278
  statusText: string;
278
279
  headers: Headers;
@@ -485,7 +486,7 @@ declare const $action: {
485
486
  <TConfig extends RequestConfigSchema>(options: ActionDescriptorOptions<TConfig>): ActionDescriptorFn<TConfig>;
486
487
  [KIND]: typeof ActionDescriptor;
487
488
  };
488
- interface ActionDescriptorOptions<TConfig$1 extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
489
+ interface ActionDescriptorOptions<TConfig extends RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema" | "mapParams"> {
489
490
  /**
490
491
  * Name of the action.
491
492
  *
@@ -536,7 +537,7 @@ interface ActionDescriptorOptions<TConfig$1 extends RequestConfigSchema> extends
536
537
  * - query: The request query-params schema.
537
538
  * - response: The response schema.
538
539
  */
539
- schema?: TConfig$1;
540
+ schema?: TConfig;
540
541
  /**
541
542
  * A short description of the action. Used for documentation purposes.
542
543
  */
@@ -549,9 +550,9 @@ interface ActionDescriptorOptions<TConfig$1 extends RequestConfigSchema> extends
549
550
  /**
550
551
  * Main route handler. This is where the route logic is implemented.
551
552
  */
552
- handler: ServerActionHandler<TConfig$1>;
553
+ handler: ServerActionHandler<TConfig>;
553
554
  }
554
- declare class ActionDescriptor<TConfig$1 extends RequestConfigSchema> extends Descriptor<ActionDescriptorOptions<TConfig$1>> {
555
+ declare class ActionDescriptor<TConfig extends RequestConfigSchema> extends Descriptor<ActionDescriptorOptions<TConfig>> {
555
556
  protected readonly log: _alepha_logger3.Logger;
556
557
  protected readonly env: {
557
558
  SERVER_API_PREFIX: string;
@@ -580,27 +581,27 @@ declare class ActionDescriptor<TConfig$1 extends RequestConfigSchema> extends De
580
581
  * Path is prefixed by `/api` by default.
581
582
  */
582
583
  get path(): string;
583
- get schema(): TConfig$1 | undefined;
584
+ get schema(): TConfig | undefined;
584
585
  getBodyContentType(): string | undefined;
585
586
  /**
586
587
  * Call the action handler directly.
587
588
  * There is no HTTP layer involved.
588
589
  */
589
- run(config?: ClientRequestEntry<TConfig$1>, options?: ClientRequestOptions): Promise<ClientRequestResponse<TConfig$1>>;
590
+ run(config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<ClientRequestResponse<TConfig>>;
590
591
  /**
591
592
  * Works like `run`, but always fetches (http request) the route.
592
593
  */
593
- fetch(config?: ClientRequestEntry<TConfig$1>, options?: ClientRequestOptions): Promise<FetchResponse<ClientRequestResponse<TConfig$1>>>;
594
+ fetch(config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<FetchResponse<ClientRequestResponse<TConfig>>>;
594
595
  }
595
- interface ActionDescriptorFn<TConfig$1 extends RequestConfigSchema> extends ActionDescriptor<TConfig$1> {
596
- (config?: ClientRequestEntry<TConfig$1>, options?: ClientRequestOptions): Promise<ClientRequestResponse<TConfig$1>>;
596
+ interface ActionDescriptorFn<TConfig extends RequestConfigSchema> extends ActionDescriptor<TConfig> {
597
+ (config?: ClientRequestEntry<TConfig>, options?: ClientRequestOptions): Promise<ClientRequestResponse<TConfig>>;
597
598
  }
598
- type ClientRequestEntry<TConfig$1 extends RequestConfigSchema, T$1 = ClientRequestEntryContainer<TConfig$1>> = { [K in keyof T$1 as T$1[K] extends undefined ? never : K]: T$1[K] };
599
- type ClientRequestEntryContainer<TConfig$1 extends RequestConfigSchema> = {
600
- body: TConfig$1["body"] extends TObject ? Static<TConfig$1["body"]> : undefined;
601
- params: TConfig$1["params"] extends TObject ? Static<TConfig$1["params"]> : undefined;
602
- headers?: TConfig$1["headers"] extends TObject ? Static<TConfig$1["headers"]> : undefined;
603
- query?: TConfig$1["query"] extends TObject ? Partial<Static<TConfig$1["query"]>> : undefined;
599
+ type ClientRequestEntry<TConfig extends RequestConfigSchema, T = ClientRequestEntryContainer<TConfig>> = { [K in keyof T as T[K] extends undefined ? never : K]: T[K] };
600
+ type ClientRequestEntryContainer<TConfig extends RequestConfigSchema> = {
601
+ body: TConfig["body"] extends TObject ? Static<TConfig["body"]> : undefined;
602
+ params: TConfig["params"] extends TObject ? Static<TConfig["params"]> : undefined;
603
+ headers?: TConfig["headers"] extends TObject ? Static<TConfig["headers"]> : undefined;
604
+ query?: TConfig["query"] extends TObject ? Partial<Static<TConfig["query"]>> : undefined;
604
605
  };
605
606
  interface ClientRequestOptions extends FetchOptions {
606
607
  /**
@@ -608,11 +609,11 @@ interface ClientRequestOptions extends FetchOptions {
608
609
  */
609
610
  request?: RequestInit;
610
611
  }
611
- type ClientRequestResponse<TConfig$1 extends RequestConfigSchema> = TConfig$1["response"] extends TSchema ? Static<TConfig$1["response"]> : any;
612
+ type ClientRequestResponse<TConfig extends RequestConfigSchema> = TConfig["response"] extends TSchema ? Static<TConfig["response"]> : any;
612
613
  /**
613
614
  * Specific handler for server actions.
614
615
  */
615
- type ServerActionHandler<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> = (request: ServerActionRequest<TConfig$1>) => Async<ServerResponseBody<TConfig$1>>;
616
+ type ServerActionHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (request: ServerActionRequest<TConfig>) => Async<ServerResponseBody<TConfig>>;
616
617
  /**
617
618
  * Server Action Request Interface
618
619
  *
@@ -620,7 +621,7 @@ type ServerActionHandler<TConfig$1 extends RequestConfigSchema = RequestConfigSc
620
621
  *
621
622
  * This is NOT Server Request, but a specific type for actions.
622
623
  */
623
- interface ServerActionRequest<TConfig$1 extends RequestConfigSchema> extends ServerRequest<TConfig$1> {}
624
+ interface ServerActionRequest<TConfig extends RequestConfigSchema> extends ServerRequest<TConfig> {}
624
625
  //#endregion
625
626
  //#region src/schemas/errorSchema.d.ts
626
627
  declare const errorSchema: typebox0.TObject<{
@@ -670,8 +671,8 @@ declare const $route: {
670
671
  <TConfig extends RequestConfigSchema>(options: RouteDescriptorOptions<TConfig>): RouteDescriptor<TConfig>;
671
672
  [KIND]: typeof RouteDescriptor;
672
673
  };
673
- interface RouteDescriptorOptions<TConfig$1 extends RequestConfigSchema = RequestConfigSchema> extends ServerRoute<TConfig$1> {}
674
- declare class RouteDescriptor<TConfig$1 extends RequestConfigSchema> extends Descriptor<RouteDescriptorOptions<TConfig$1>> {
674
+ interface RouteDescriptorOptions<TConfig extends RequestConfigSchema = RequestConfigSchema> extends ServerRoute<TConfig> {}
675
+ declare class RouteDescriptor<TConfig extends RequestConfigSchema> extends Descriptor<RouteDescriptorOptions<TConfig>> {
675
676
  protected readonly serverRouterProvider: ServerRouterProvider;
676
677
  protected onInit(): void;
677
678
  }
@@ -843,5 +844,5 @@ declare module "alepha" {
843
844
  */
844
845
  declare const AlephaServer: _alepha_core11.Service<_alepha_core11.Module<{}>>;
845
846
  //#endregion
846
- export { $action, $route, ActionDescriptor, ActionDescriptorFn, ActionDescriptorOptions, AlephaServer, BadRequestError, ClientRequestEntry, ClientRequestEntryContainer, ClientRequestOptions, ClientRequestResponse, ConflictError, ErrorSchema, FetchActionArgs, FetchOptions, FetchResponse, ForbiddenError, HttpAction, HttpClient, HttpClientPendingRequests, HttpError, HttpErrorLike, NodeHttpServerProvider, NotFoundError, Ok, RequestConfigSchema, ResponseBodyType, ResponseKind, RouteDescriptor, RouteDescriptorOptions, RouteMethod, ServerActionHandler, ServerActionRequest, ServerHandler, ServerLoggerProvider, ServerNotReadyProvider, ServerProvider, ServerRawRequest, ServerReply, ServerRequest, ServerRequestConfig, ServerRequestConfigEntry, ServerResponse, ServerResponseBody, ServerRoute, ServerRouteMatcher, ServerRouteRequestHandler, ServerRouterProvider, ServerTimingProvider, TRequestBody, TResponseBody, UnauthorizedError, ValidationError, errorNameByStatus, errorSchema, isHttpError, isMultipart, okSchema, routeMethods };
847
+ export { $action, $route, ActionDescriptor, ActionDescriptorFn, ActionDescriptorOptions, AlephaServer, BadRequestError, ClientRequestEntry, ClientRequestEntryContainer, ClientRequestOptions, ClientRequestResponse, ConflictError, ErrorSchema, FetchActionArgs, FetchOptions, FetchResponse, ForbiddenError, HttpAction, HttpClient, HttpClientPendingRequests, HttpError, HttpErrorLike, NodeHttpServerProvider, NotFoundError, Ok, RequestConfigSchema, RequestInitWithOptions, ResponseBodyType, ResponseKind, RouteDescriptor, RouteDescriptorOptions, RouteMethod, ServerActionHandler, ServerActionRequest, ServerHandler, ServerLoggerProvider, ServerNotReadyProvider, ServerProvider, ServerRawRequest, ServerReply, ServerRequest, ServerRequestConfig, ServerRequestConfigEntry, ServerResponse, ServerResponseBody, ServerRoute, ServerRouteMatcher, ServerRouteRequestHandler, ServerRouterProvider, ServerTimingProvider, TRequestBody, TResponseBody, UnauthorizedError, ValidationError, errorNameByStatus, errorSchema, isHttpError, isMultipart, okSchema, routeMethods };
847
848
  //# sourceMappingURL=index.d.ts.map
package/topic.d.ts CHANGED
@@ -220,7 +220,7 @@ declare const $topic: {
220
220
  <T extends TopicMessageSchema>(options: TopicDescriptorOptions<T>): TopicDescriptor<T>;
221
221
  [KIND]: typeof TopicDescriptor;
222
222
  };
223
- interface TopicDescriptorOptions<T$1 extends TopicMessageSchema> {
223
+ interface TopicDescriptorOptions<T extends TopicMessageSchema> {
224
224
  /**
225
225
  * Unique name identifier for the topic.
226
226
  *
@@ -329,7 +329,7 @@ interface TopicDescriptorOptions<T$1 extends TopicMessageSchema> {
329
329
  * }
330
330
  * ```
331
331
  */
332
- schema: T$1;
332
+ schema: T;
333
333
  /**
334
334
  * Default subscriber handler function that processes messages published to this topic.
335
335
  *
@@ -393,32 +393,32 @@ interface TopicDescriptorOptions<T$1 extends TopicMessageSchema> {
393
393
  * }
394
394
  * ```
395
395
  */
396
- handler?: TopicHandler<T$1>;
396
+ handler?: TopicHandler<T>;
397
397
  }
398
- declare class TopicDescriptor<T$1 extends TopicMessageSchema> extends Descriptor<TopicDescriptorOptions<T$1>> {
398
+ declare class TopicDescriptor<T extends TopicMessageSchema> extends Descriptor<TopicDescriptorOptions<T>> {
399
399
  protected readonly log: _alepha_logger0.Logger;
400
400
  protected readonly dateTimeProvider: DateTimeProvider;
401
401
  readonly provider: TopicProvider;
402
402
  get name(): string;
403
- publish(payload: TopicMessage<T$1>["payload"]): Promise<void>;
404
- subscribe(handler: TopicHandler<T$1>): Promise<UnSubscribeFn>;
405
- wait(options?: TopicWaitOptions<T$1>): Promise<TopicMessage<T$1>>;
403
+ publish(payload: TopicMessage<T>["payload"]): Promise<void>;
404
+ subscribe(handler: TopicHandler<T>): Promise<UnSubscribeFn>;
405
+ wait(options?: TopicWaitOptions<T>): Promise<TopicMessage<T>>;
406
406
  protected $provider(): TopicProvider;
407
- protected parseMessage(message: string): TopicMessage<T$1>;
407
+ protected parseMessage(message: string): TopicMessage<T>;
408
408
  }
409
- interface TopicMessage<T$1 extends TopicMessageSchema> {
410
- payload: Static<T$1["payload"]>;
409
+ interface TopicMessage<T extends TopicMessageSchema> {
410
+ payload: Static<T["payload"]>;
411
411
  }
412
- interface TopicWaitOptions<T$1 extends TopicMessageSchema> {
412
+ interface TopicWaitOptions<T extends TopicMessageSchema> {
413
413
  timeout?: DurationLike;
414
414
  filter?: (message: {
415
- payload: Static<T$1["payload"]>;
415
+ payload: Static<T["payload"]>;
416
416
  }) => boolean;
417
417
  }
418
418
  interface TopicMessageSchema {
419
419
  payload: TSchema;
420
420
  }
421
- type TopicHandler<T$1 extends TopicMessageSchema = TopicMessageSchema> = (message: TopicMessage<T$1>) => unknown;
421
+ type TopicHandler<T extends TopicMessageSchema = TopicMessageSchema> = (message: TopicMessage<T>) => unknown;
422
422
  //#endregion
423
423
  //#region src/descriptors/$subscriber.d.ts
424
424
  /**
@@ -636,7 +636,7 @@ declare const $subscriber: {
636
636
  <T extends TopicMessageSchema>(options: SubscriberDescriptorOptions<T>): SubscriberDescriptor<T>;
637
637
  [KIND]: typeof SubscriberDescriptor;
638
638
  };
639
- interface SubscriberDescriptorOptions<T$1 extends TopicMessageSchema> {
639
+ interface SubscriberDescriptorOptions<T extends TopicMessageSchema> {
640
640
  /**
641
641
  * The topic descriptor that this subscriber will listen to for messages.
642
642
  *
@@ -670,7 +670,7 @@ interface SubscriberDescriptorOptions<T$1 extends TopicMessageSchema> {
670
670
  * });
671
671
  * ```
672
672
  */
673
- topic: TopicDescriptor<T$1>;
673
+ topic: TopicDescriptor<T>;
674
674
  /**
675
675
  * Message handler function that processes individual messages from the topic.
676
676
  *
@@ -765,9 +765,9 @@ interface SubscriberDescriptorOptions<T$1 extends TopicMessageSchema> {
765
765
  * }
766
766
  * ```
767
767
  */
768
- handler: TopicHandler<T$1>;
768
+ handler: TopicHandler<T>;
769
769
  }
770
- declare class SubscriberDescriptor<T$1 extends TopicMessageSchema> extends Descriptor<SubscriberDescriptorOptions<T$1>> {}
770
+ declare class SubscriberDescriptor<T extends TopicMessageSchema> extends Descriptor<SubscriberDescriptorOptions<T>> {}
771
771
  //#endregion
772
772
  //#region src/errors/TopicTimeoutError.d.ts
773
773
  declare class TopicTimeoutError extends Error {