alepha 0.9.2 → 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.
@@ -36,9 +36,7 @@ interface HybridFile extends FileLike {
36
36
  * @see {@link ServerMultipartProvider}
37
37
  * @module alepha.server.multipart
38
38
  */
39
- declare const AlephaServerMultipart: _alepha_core0.ModuleDescriptor;
40
- //# sourceMappingURL=index.d.ts.map
41
-
39
+ declare const AlephaServerMultipart: _alepha_core0.Service<_alepha_core0.Module>;
42
40
  //#endregion
43
41
  export { AlephaServerMultipart, ServerMultipartProvider };
44
42
  //# sourceMappingURL=index.d.ts.map
package/server/proxy.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import * as _alepha_core0$1 from "alepha";
2
- import * as _alepha_core0 from "alepha";
1
+ import * as _alepha_core1 from "alepha";
3
2
  import { Alepha, Async, Descriptor, KIND } from "alepha";
4
3
  import { ServerHandler, ServerRequest, ServerRouterProvider } from "alepha/server";
4
+ import * as _alepha_logger0 from "alepha/logger";
5
5
 
6
6
  //#region src/descriptors/$proxy.d.ts
7
7
  declare const $proxy: {
@@ -17,19 +17,17 @@ type ProxyDescriptorOptions = {
17
17
  rewrite?: (url: URL) => void;
18
18
  };
19
19
  declare class ProxyDescriptor extends Descriptor<ProxyDescriptorOptions> {}
20
- //# sourceMappingURL=$proxy.d.ts.map
21
20
  //#endregion
22
21
  //#region src/providers/ServerProxyProvider.d.ts
23
22
  declare class ServerProxyProvider {
24
- protected readonly log: _alepha_core0$1.Logger;
23
+ protected readonly log: _alepha_logger0.Logger;
25
24
  protected readonly routerProvider: ServerRouterProvider;
26
25
  protected readonly alepha: Alepha;
27
- protected readonly configure: _alepha_core0$1.HookDescriptor<"configure">;
26
+ protected readonly configure: _alepha_core1.HookDescriptor<"configure">;
28
27
  createProxy(options: ProxyDescriptorOptions): void;
29
28
  createProxyHandler(target: string, options: Omit<ProxyDescriptorOptions, "path">): ServerHandler;
30
29
  private getRawRequestBody;
31
30
  }
32
- //# sourceMappingURL=ServerProxyProvider.d.ts.map
33
31
  //#endregion
34
32
  //#region src/index.d.ts
35
33
  /**
@@ -38,9 +36,7 @@ declare class ServerProxyProvider {
38
36
  * @see {@link $proxy}
39
37
  * @module alepha.server.proxy
40
38
  */
41
- declare const AlephaServerProxy: _alepha_core0.ModuleDescriptor;
42
- //# sourceMappingURL=index.d.ts.map
43
-
39
+ declare const AlephaServerProxy: _alepha_core1.Service<_alepha_core1.Module>;
44
40
  //#endregion
45
41
  export { $proxy, AlephaServerProxy, ProxyDescriptor, ProxyDescriptorOptions, ServerProxyProvider };
46
42
  //# sourceMappingURL=index.d.ts.map
@@ -1,18 +1,18 @@
1
- import * as _alepha_core0$1 from "alepha";
2
- import * as _alepha_core0 from "alepha";
1
+ import * as _alepha_core1 from "alepha";
3
2
  import { Alepha } from "alepha";
4
- import { JwtProvider, Permission, SecurityProvider, UserAccountToken } from "alepha/security";
3
+ import { JwtProvider, Permission, SecurityProvider, UserAccount, UserAccountToken } from "alepha/security";
5
4
  import { FetchOptions } from "alepha/server";
5
+ import * as _alepha_logger0 from "alepha/logger";
6
6
 
7
7
  //#region src/providers/ServerSecurityProvider.d.ts
8
8
  declare class ServerSecurityProvider {
9
- protected readonly log: _alepha_core0$1.Logger;
9
+ protected readonly log: _alepha_logger0.Logger;
10
10
  protected readonly securityProvider: SecurityProvider;
11
11
  protected readonly jwtProvider: JwtProvider;
12
12
  protected readonly alepha: Alepha;
13
- protected readonly onConfigure: _alepha_core0$1.HookDescriptor<"configure">;
14
- protected readonly onActionRequest: _alepha_core0$1.HookDescriptor<"action:onRequest">;
15
- protected readonly onRequest: _alepha_core0$1.HookDescriptor<"server:onRequest">;
13
+ protected readonly onConfigure: _alepha_core1.HookDescriptor<"configure">;
14
+ protected readonly onActionRequest: _alepha_core1.HookDescriptor<"action:onRequest">;
15
+ protected readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
16
16
  /**
17
17
  * Get the user account token for a local action call.
18
18
  * There are three possible sources for the user:
@@ -28,7 +28,7 @@ declare class ServerSecurityProvider {
28
28
  user?: UserAccountToken | "system" | "context";
29
29
  }, permission?: Permission): UserAccountToken;
30
30
  protected createTestUser(): UserAccountToken;
31
- protected readonly onClientRequest: _alepha_core0$1.HookDescriptor<"client:onRequest">;
31
+ protected readonly onClientRequest: _alepha_core1.HookDescriptor<"client:onRequest">;
32
32
  }
33
33
  type ServerRouteSecure = boolean | {
34
34
  permissions?: string[];
@@ -36,7 +36,6 @@ type ServerRouteSecure = boolean | {
36
36
  realms?: string[];
37
37
  organizations?: string[];
38
38
  };
39
- //# sourceMappingURL=ServerSecurityProvider.d.ts.map
40
39
  //#endregion
41
40
  //#region src/index.d.ts
42
41
  declare module "alepha" {
@@ -48,6 +47,7 @@ declare module "alepha" {
48
47
  * > To force a different user, you need to pass it explicitly in the options.
49
48
  */
50
49
  "server.security.system.user"?: UserAccountToken;
50
+ user?: UserAccount;
51
51
  }
52
52
  }
53
53
  declare module "alepha/server" {
@@ -62,9 +62,7 @@ declare module "alepha/server" {
62
62
  * If true, the route will be protected by the security provider.
63
63
  * All actions are secure by default, but you can disable it for specific actions.
64
64
  */
65
- secure?: boolean | {
66
- optional?: boolean;
67
- };
65
+ secure?: boolean;
68
66
  }
69
67
  interface ClientRequestOptions extends FetchOptions {
70
68
  /**
@@ -72,7 +70,7 @@ declare module "alepha/server" {
72
70
  * If "system", use system user. @see {ServerSecurityProvider.localSystemUser}
73
71
  * If "context", use the user from the current context (e.g. request).
74
72
  *
75
- * @default "system" is provided, else "context" is used.
73
+ * @default "system" if provided, else "context" if available.
76
74
  */
77
75
  user?: UserAccountToken | "system" | "context";
78
76
  }
@@ -85,8 +83,7 @@ declare module "alepha/server" {
85
83
  * @see {@link ServerSecurityProvider}
86
84
  * @module alepha.server.security
87
85
  */
88
- declare const AlephaServerSecurity: _alepha_core0.ModuleDescriptor;
89
- //# sourceMappingURL=index.d.ts.map
86
+ declare const AlephaServerSecurity: _alepha_core1.Service<_alepha_core1.Module>;
90
87
  //#endregion
91
88
  export { AlephaServerSecurity, ServerRouteSecure, ServerSecurityProvider };
92
89
  //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,8 @@
1
- import * as _alepha_core0$1 from "alepha";
2
- import * as _alepha_core0 from "alepha";
3
- import { Alepha, Descriptor, KIND, Logger } from "alepha";
1
+ import * as _alepha_core1 from "alepha";
2
+ import { Alepha, Descriptor, KIND } from "alepha";
4
3
  import { ServerHandler, ServerRouterProvider } from "alepha/server";
5
4
  import { DateTimeProvider, DurationLike } from "alepha/datetime";
5
+ import * as _alepha_logger0 from "alepha/logger";
6
6
 
7
7
  //#region src/descriptors/$serve.d.ts
8
8
  /**
@@ -83,16 +83,15 @@ interface CacheControlOptions {
83
83
  immutable: boolean;
84
84
  }
85
85
  declare class ServeDescriptor extends Descriptor<ServeDescriptorOptions> {}
86
- //# sourceMappingURL=$serve.d.ts.map
87
86
  //#endregion
88
87
  //#region src/providers/ServerStaticProvider.d.ts
89
88
  declare class ServerStaticProvider {
90
89
  protected readonly alepha: Alepha;
91
90
  protected readonly routerProvider: ServerRouterProvider;
92
91
  protected readonly dateTimeProvider: DateTimeProvider;
93
- protected readonly log: Logger;
92
+ protected readonly log: _alepha_logger0.Logger;
94
93
  protected readonly directories: ServeDirectory[];
95
- protected readonly configure: _alepha_core0$1.HookDescriptor<"configure">;
94
+ protected readonly configure: _alepha_core1.HookDescriptor<"configure">;
96
95
  createStaticServer(options: ServeDescriptorOptions): Promise<void>;
97
96
  createFileHandler(filepath: string, options: ServeDescriptorOptions): Promise<ServerHandler>;
98
97
  protected getCacheFileTypes(): string[];
@@ -106,7 +105,6 @@ interface ServeDirectory {
106
105
  options: ServeDescriptorOptions;
107
106
  files: string[];
108
107
  }
109
- //# sourceMappingURL=ServerStaticProvider.d.ts.map
110
108
  //#endregion
111
109
  //#region src/index.d.ts
112
110
  /**
@@ -115,9 +113,7 @@ interface ServeDirectory {
115
113
  * @see {@link ServerStaticProvider}
116
114
  * @module alepha.server.static
117
115
  */
118
- declare const AlephaServerStatic: _alepha_core0.ModuleDescriptor;
119
- //# sourceMappingURL=index.d.ts.map
120
-
116
+ declare const AlephaServerStatic: _alepha_core1.Service<_alepha_core1.Module>;
121
117
  //#endregion
122
118
  export { $serve, AlephaServerStatic, CacheControlOptions, ServeDescriptor, ServeDescriptorOptions, ServeDirectory, ServerStaticProvider };
123
119
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
- import * as _alepha_core0$1 from "alepha";
2
- import * as _alepha_core0 from "alepha";
1
+ import "alepha/server/security";
2
+ import * as _alepha_core1 from "alepha";
3
3
  import { Alepha, Descriptor, KIND, TObject } from "alepha";
4
4
  import { ActionDescriptor, RequestConfigSchema, ServerRouterProvider } from "alepha/server";
5
5
  import { ServerStaticProvider } from "alepha/server/static";
@@ -82,7 +82,6 @@ interface SwaggerUiOptions {
82
82
  };
83
83
  }
84
84
  declare class SwaggerDescriptor extends Descriptor<SwaggerDescriptorOptions> {}
85
- //# sourceMappingURL=$swagger.d.ts.map
86
85
  //#endregion
87
86
  //#region src/ServerSwaggerProvider.d.ts
88
87
  declare class ServerSwaggerProvider {
@@ -90,7 +89,7 @@ declare class ServerSwaggerProvider {
90
89
  protected readonly serverRouterProvider: ServerRouterProvider;
91
90
  protected readonly alepha: Alepha;
92
91
  json?: OpenAPIV3.Document;
93
- protected readonly configure: _alepha_core0$1.HookDescriptor<"configure">;
92
+ protected readonly configure: _alepha_core1.HookDescriptor<"configure">;
94
93
  createSwagger(options: SwaggerDescriptorOptions): Promise<OpenAPIV3.Document | undefined>;
95
94
  protected configureOpenApi(actions: ActionDescriptor<RequestConfigSchema>[], doc: SwaggerDescriptorOptions): OpenAPIV3.Document;
96
95
  isBodyMultipart(schema: TObject): boolean;
@@ -103,7 +102,6 @@ declare class ServerSwaggerProvider {
103
102
  protected configureSwaggerApi(prefix: string, json: OpenAPIV3.Document): void;
104
103
  protected configureSwaggerUi(prefix: string, options: SwaggerDescriptorOptions): Promise<void>;
105
104
  }
106
- //# sourceMappingURL=ServerSwaggerProvider.d.ts.map
107
105
  //#endregion
108
106
  //#region src/index.d.ts
109
107
  declare module "alepha/server" {
@@ -126,9 +124,7 @@ declare module "alepha/server" {
126
124
  * @see {@link ServerSwaggerProvider}
127
125
  * @module alepha.server.swagger
128
126
  */
129
- declare const AlephaServerSwagger: _alepha_core0.ModuleDescriptor;
130
- //# sourceMappingURL=index.d.ts.map
131
-
127
+ declare const AlephaServerSwagger: _alepha_core1.Service<_alepha_core1.Module>;
132
128
  //#endregion
133
129
  export { $swagger, AlephaServerSwagger, ServerSwaggerProvider, SwaggerDescriptor, SwaggerDescriptorOptions, SwaggerUiOptions };
134
130
  //# sourceMappingURL=index.d.ts.map
package/server.d.ts CHANGED
@@ -1,26 +1,18 @@
1
1
  import * as _alepha_core1 from "alepha";
2
- import * as _alepha_core0$1 from "alepha";
3
- import * as _alepha_core6 from "alepha";
4
- import * as _alepha_core2 from "alepha";
5
- import * as _alepha_core13 from "alepha";
6
- import * as _alepha_core14 from "alepha";
7
- import * as _alepha_core0 from "alepha";
8
- import { Alepha, Async, Descriptor, FileLike, KIND, Static, StreamLike, TObject, TSchema } from "alepha";
2
+ import { Alepha, AlephaError, Async, Descriptor, FileLike, KIND, Static, StreamLike, TObject, TSchema } from "alepha";
3
+ import * as _alepha_logger0 from "alepha/logger";
9
4
  import { Readable } from "node:stream";
10
5
  import { ReadableStream } from "node:stream/web";
11
6
  import { Route, RouterProvider } from "alepha/router";
12
7
  import * as _alepha_cache0 from "alepha/cache";
13
8
  import { IncomingMessage, ServerResponse as ServerResponse$1 } from "node:http";
14
9
  import { DateTimeProvider, DurationLike } from "alepha/datetime";
15
- import * as _sinclair_typebox17 from "@sinclair/typebox";
16
10
  import * as _sinclair_typebox7 from "@sinclair/typebox";
17
- import * as _sinclair_typebox0 from "@sinclair/typebox";
18
11
  import * as http0 from "http";
19
12
 
20
13
  //#region src/constants/routeMethods.d.ts
21
14
  declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
22
15
  type RouteMethod = (typeof routeMethods)[number];
23
- //# sourceMappingURL=routeMethods.d.ts.map
24
16
  //#endregion
25
17
  //#region src/helpers/ServerReply.d.ts
26
18
  declare class ServerReply {
@@ -33,7 +25,22 @@ declare class ServerReply {
33
25
  setStatus(status: number): void;
34
26
  setHeader(name: string, value: string): void;
35
27
  }
36
- //# sourceMappingURL=ServerReply.d.ts.map
28
+ //#endregion
29
+ //#region src/services/UserAgentParser.d.ts
30
+ interface UserAgentInfo {
31
+ os: "Windows" | "Android" | "Ubuntu" | "MacOS" | "iOS" | "Linux" | "FreeBSD" | "OpenBSD" | "ChromeOS" | "BlackBerry" | "Symbian" | "Windows Phone";
32
+ browser: "Chrome" | "Firefox" | "Safari" | "Edge" | "Opera" | "Internet Explorer" | "Brave" | "Vivaldi" | "Samsung Browser" | "UC Browser" | "Yandex";
33
+ device: "Mobile" | "Desktop" | "Tablet";
34
+ }
35
+ /**
36
+ * Simple User-Agent parser to detect OS, browser, and device type.
37
+ * This parser is not exhaustive and may not cover all edge cases.
38
+ *
39
+ * Use result for non
40
+ */
41
+ declare class UserAgentParser {
42
+ parse(userAgent?: string): UserAgentInfo;
43
+ }
37
44
  //#endregion
38
45
  //#region src/interfaces/ServerRequest.d.ts
39
46
  interface RequestConfigSchema {
@@ -53,6 +60,14 @@ type ServerRequestConfigEntry<TConfig extends RequestConfigSchema = RequestConfi
53
60
  interface ServerRequest<TConfig extends RequestConfigSchema = RequestConfigSchema> extends ServerRequestConfig<TConfig> {
54
61
  method: RouteMethod;
55
62
  url: URL;
63
+ ip?: string;
64
+ /**
65
+ * Browser user agent information.
66
+ * Information are not guaranteed to be accurate. Use with caution.
67
+ *
68
+ * @see {@link UserAgentParser}
69
+ */
70
+ userAgent: UserAgentInfo;
56
71
  metadata: Record<string, any>;
57
72
  reply: ServerReply;
58
73
  raw: {
@@ -97,7 +112,6 @@ interface ServerRawRequest {
97
112
  };
98
113
  };
99
114
  }
100
- //# sourceMappingURL=ServerRequest.d.ts.map
101
115
  //#endregion
102
116
  //#region src/providers/ServerProvider.d.ts
103
117
  declare abstract class ServerProvider {
@@ -105,8 +119,19 @@ declare abstract class ServerProvider {
105
119
  abstract get hostname(): string;
106
120
  protected isViteNotFound(url?: string, route?: Route, params?: Record<string, string>): boolean;
107
121
  }
108
- //# sourceMappingURL=ServerProvider.d.ts.map
109
-
122
+ //#endregion
123
+ //#region src/providers/ServerTimingProvider.d.ts
124
+ type TimingMap = Record<string, [number, number]>;
125
+ declare class ServerTimingProvider {
126
+ protected readonly log: _alepha_logger0.Logger;
127
+ protected readonly alepha: Alepha;
128
+ readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
129
+ readonly onResponse: _alepha_core1.HookDescriptor<"server:onResponse">;
130
+ protected get handlerName(): string;
131
+ beginTiming(name: string): void;
132
+ endTiming(name: string): void;
133
+ protected setDuration(name: string, timing: TimingMap): void;
134
+ }
110
135
  //#endregion
111
136
  //#region src/providers/ServerRouterProvider.d.ts
112
137
  /**
@@ -119,9 +144,12 @@ declare abstract class ServerProvider {
119
144
  declare class ServerRouterProvider extends RouterProvider<ServerRouteMatcher> {
120
145
  protected readonly alepha: Alepha;
121
146
  protected readonly routes: ServerRoute[];
147
+ protected readonly serverTimingProvider: ServerTimingProvider;
148
+ protected readonly userAgentParser: UserAgentParser;
122
149
  getRoutes(): ServerRoute[];
123
150
  createRoute<TConfig extends RequestConfigSchema = RequestConfigSchema>(route: ServerRoute<TConfig>): void;
124
151
  onRequest(route: ServerRoute, rawRequest: ServerRawRequest, responseKind: ResponseKind): Promise<ServerResponse>;
152
+ protected getClientIp(request: ServerRawRequest): string | undefined;
125
153
  protected processRequest(request: ServerRequest, route: ServerRoute, responseKind: ResponseKind): Promise<{
126
154
  status: number;
127
155
  headers: Record<string, string> & {
@@ -130,18 +158,17 @@ declare class ServerRouterProvider extends RouterProvider<ServerRouteMatcher> {
130
158
  body: any;
131
159
  }>;
132
160
  protected runRouteHandler(route: ServerRoute, request: ServerRequest, responseKind: ResponseKind): Promise<void>;
161
+ serializeResponse(route: ServerRoute, reply: ServerReply, responseKind: ResponseKind): void;
133
162
  protected getResponseType(schema?: RequestConfigSchema): ResponseKind;
134
163
  protected errorHandler(route: ServerRoute, request: ServerRequest, error: Error): Promise<void>;
135
164
  validateRequest(route: {
136
165
  schema?: RequestConfigSchema;
137
166
  }, request: ServerRequestConfig): void;
138
- serializeResponse(route: ServerRoute, reply: ServerReply, responseKind: ResponseKind): void;
139
167
  }
140
- //# sourceMappingURL=ServerRouterProvider.d.ts.map
141
168
  //#endregion
142
169
  //#region src/services/HttpClient.d.ts
143
170
  declare class HttpClient {
144
- protected readonly log: _alepha_core1.Logger;
171
+ protected readonly log: _alepha_logger0.Logger;
145
172
  protected readonly alepha: Alepha;
146
173
  readonly cache: _alepha_cache0.CacheDescriptorFn<HttpClientCache, any[]>;
147
174
  protected readonly pendingRequests: HttpClientPendingRequests;
@@ -203,6 +230,7 @@ interface HttpAction {
203
230
  method?: string;
204
231
  prefix?: string;
205
232
  path: string;
233
+ requestBodyType?: string;
206
234
  schema?: {
207
235
  params?: TObject;
208
236
  query?: TObject;
@@ -300,7 +328,7 @@ interface ActionDescriptorOptions<TConfig extends RequestConfigSchema> extends O
300
328
  handler: ServerActionHandler<TConfig>;
301
329
  }
302
330
  declare class ActionDescriptor<TConfig extends RequestConfigSchema> extends Descriptor<ActionDescriptorOptions<TConfig>> {
303
- protected readonly log: _alepha_core0$1.Logger;
331
+ protected readonly log: _alepha_logger0.Logger;
304
332
  protected readonly env: {
305
333
  SERVER_API_PREFIX: string;
306
334
  };
@@ -366,10 +394,12 @@ type ServerActionHandler<TConfig extends RequestConfigSchema = RequestConfigSche
366
394
  * This is NOT Server Request, but a specific type for actions.
367
395
  */
368
396
  interface ServerActionRequest<TConfig extends RequestConfigSchema> extends ServerRequest<TConfig> {}
369
- //# sourceMappingURL=$action.d.ts.map
370
397
  //#endregion
371
398
  //#region src/errors/HttpError.d.ts
372
- declare class HttpError extends Error {
399
+ declare const isHttpError: (error: unknown, status?: number) => error is HttpErrorLike;
400
+ declare class HttpError extends AlephaError {
401
+ name: string;
402
+ static is: (error: unknown, status?: number) => error is HttpErrorLike;
373
403
  static toJSON(error: HttpError): {
374
404
  status: number;
375
405
  error: string | undefined;
@@ -401,11 +431,9 @@ declare class HttpError extends Error {
401
431
  }, cause?: unknown);
402
432
  }
403
433
  declare const errorNameByStatus: Record<number, string>;
404
- declare const isHttpError: (error: unknown) => error is HttpErrorLike;
405
434
  interface HttpErrorLike extends Error {
406
435
  status: number;
407
436
  }
408
- //# sourceMappingURL=HttpError.d.ts.map
409
437
  //#endregion
410
438
  //#region src/descriptors/$route.d.ts
411
439
  /**
@@ -425,73 +453,42 @@ declare class RouteDescriptor<TConfig extends RequestConfigSchema> extends Descr
425
453
  protected readonly serverRouterProvider: ServerRouterProvider;
426
454
  protected onInit(): void;
427
455
  }
428
- //# sourceMappingURL=$route.d.ts.map
429
456
  //#endregion
430
457
  //#region src/errors/BadRequestError.d.ts
431
458
  declare class BadRequestError extends HttpError {
432
459
  constructor(message?: string, cause?: unknown);
433
460
  }
434
- //# sourceMappingURL=BadRequestError.d.ts.map
435
461
  //#endregion
436
462
  //#region src/errors/ConflictError.d.ts
437
463
  declare class ConflictError extends HttpError {
438
464
  constructor(message?: string, cause?: unknown);
439
465
  }
440
- //# sourceMappingURL=ConflictError.d.ts.map
441
466
  //#endregion
442
467
  //#region src/errors/ForbiddenError.d.ts
443
468
  declare class ForbiddenError extends HttpError {
444
469
  constructor(message?: string, cause?: unknown);
445
470
  }
446
- //# sourceMappingURL=ForbiddenError.d.ts.map
447
471
  //#endregion
448
472
  //#region src/errors/NotFoundError.d.ts
449
473
  declare class NotFoundError extends HttpError {
450
474
  constructor(message?: string, cause?: unknown);
451
475
  }
452
- //# sourceMappingURL=NotFoundError.d.ts.map
453
476
  //#endregion
454
477
  //#region src/errors/UnauthorizedError.d.ts
455
478
  declare class UnauthorizedError extends HttpError {
456
479
  constructor(message?: string, cause?: unknown);
457
480
  }
458
- //# sourceMappingURL=UnauthorizedError.d.ts.map
459
481
  //#endregion
460
482
  //#region src/errors/ValidationError.d.ts
461
483
  declare class ValidationError extends HttpError {
462
484
  constructor(message?: string, cause?: unknown);
463
485
  }
464
- //# sourceMappingURL=ValidationError.d.ts.map
465
486
  //#endregion
466
487
  //#region src/helpers/isMultipart.d.ts
467
488
  declare const isMultipart: (options: {
468
489
  schema?: RequestConfigSchema;
490
+ requestBodyType?: string;
469
491
  }) => boolean;
470
- //# sourceMappingURL=isMultipart.d.ts.map
471
- //#endregion
472
- //#region src/schemas/apiLinksResponseSchema.d.ts
473
- declare const apiLinkSchema: _sinclair_typebox17.TObject<{
474
- name: _sinclair_typebox17.TString;
475
- path: _sinclair_typebox17.TString;
476
- method: _sinclair_typebox17.TOptional<_sinclair_typebox17.TString>;
477
- group: _sinclair_typebox17.TOptional<_sinclair_typebox17.TString>;
478
- requestBodyType: _sinclair_typebox17.TOptional<_sinclair_typebox17.TString>;
479
- service: _sinclair_typebox17.TOptional<_sinclair_typebox17.TString>;
480
- }>;
481
- declare const apiLinksResponseSchema: _sinclair_typebox17.TObject<{
482
- prefix: _sinclair_typebox17.TOptional<_sinclair_typebox17.TString>;
483
- links: _sinclair_typebox17.TArray<_sinclair_typebox17.TObject<{
484
- name: _sinclair_typebox17.TString;
485
- path: _sinclair_typebox17.TString;
486
- method: _sinclair_typebox17.TOptional<_sinclair_typebox17.TString>;
487
- group: _sinclair_typebox17.TOptional<_sinclair_typebox17.TString>;
488
- requestBodyType: _sinclair_typebox17.TOptional<_sinclair_typebox17.TString>;
489
- service: _sinclair_typebox17.TOptional<_sinclair_typebox17.TString>;
490
- }>>;
491
- }>;
492
- type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
493
- type ApiLink = Static<typeof apiLinkSchema>;
494
- //# sourceMappingURL=apiLinksResponseSchema.d.ts.map
495
492
  //#endregion
496
493
  //#region src/schemas/errorSchema.d.ts
497
494
  declare const errorSchema: _sinclair_typebox7.TObject<{
@@ -504,21 +501,19 @@ declare const errorSchema: _sinclair_typebox7.TObject<{
504
501
  message: _sinclair_typebox7.TString;
505
502
  }>>;
506
503
  }>;
507
- //# sourceMappingURL=errorSchema.d.ts.map
508
504
  //#endregion
509
505
  //#region src/schemas/okSchema.d.ts
510
- declare const okSchema: _sinclair_typebox0.TObject<{
511
- ok: _sinclair_typebox0.TBoolean;
512
- id: _sinclair_typebox0.TOptional<_sinclair_typebox0.TUnion<[_sinclair_typebox0.TString, _sinclair_typebox0.TInteger]>>;
513
- count: _sinclair_typebox0.TOptional<_sinclair_typebox0.TNumber>;
506
+ declare const okSchema: _sinclair_typebox7.TObject<{
507
+ ok: _sinclair_typebox7.TBoolean;
508
+ id: _sinclair_typebox7.TOptional<_sinclair_typebox7.TUnion<[_sinclair_typebox7.TString, _sinclair_typebox7.TInteger]>>;
509
+ count: _sinclair_typebox7.TOptional<_sinclair_typebox7.TNumber>;
514
510
  }>;
515
511
  type Ok = Static<typeof okSchema>;
516
- //# sourceMappingURL=okSchema.d.ts.map
517
512
  //#endregion
518
513
  //#region src/providers/NodeHttpServerProvider.d.ts
519
- declare const envSchema: _alepha_core6.TObject<{
520
- SERVER_PORT: _alepha_core6.TNumber;
521
- SERVER_HOST: _alepha_core6.TString;
514
+ declare const envSchema: _alepha_core1.TObject<{
515
+ SERVER_PORT: _alepha_core1.TNumber;
516
+ SERVER_HOST: _alepha_core1.TString;
522
517
  }>;
523
518
  declare module "alepha" {
524
519
  interface Env extends Partial<Static<typeof envSchema>> {}
@@ -526,33 +521,32 @@ declare module "alepha" {
526
521
  declare class NodeHttpServerProvider extends ServerProvider {
527
522
  protected readonly alepha: Alepha;
528
523
  protected readonly dateTimeProvider: DateTimeProvider;
529
- protected readonly log: _alepha_core6.Logger;
524
+ protected readonly log: _alepha_logger0.Logger;
530
525
  protected readonly env: {
531
526
  SERVER_PORT: number;
532
527
  SERVER_HOST: string;
533
528
  };
534
529
  protected readonly router: ServerRouterProvider;
535
530
  protected readonly server: http0.Server<typeof IncomingMessage, typeof ServerResponse$1>;
536
- protected readonly onNodeRequest: _alepha_core6.HookDescriptor<"node:request">;
531
+ protected readonly onNodeRequest: _alepha_core1.HookDescriptor<"node:request">;
537
532
  handle(req: IncomingMessage, res: ServerResponse$1): Promise<void>;
538
533
  createRouterRequest(req: IncomingMessage, res: ServerResponse$1, params?: Record<string, string>): ServerRawRequest;
539
534
  getProtocol(req: IncomingMessage): "http" | "https";
540
535
  get hostname(): string;
541
- readonly start: _alepha_core6.HookDescriptor<"start">;
542
- protected readonly stop: _alepha_core6.HookDescriptor<"stop">;
536
+ readonly start: _alepha_core1.HookDescriptor<"start">;
537
+ protected readonly stop: _alepha_core1.HookDescriptor<"stop">;
543
538
  protected listen(): Promise<void>;
544
539
  protected close(): Promise<void>;
545
540
  }
546
541
  //#endregion
547
542
  //#region src/providers/ServerLoggerProvider.d.ts
548
543
  declare class ServerLoggerProvider {
549
- protected readonly log: _alepha_core2.Logger;
544
+ protected readonly log: _alepha_logger0.Logger;
550
545
  protected readonly alepha: Alepha;
551
- readonly onRequest: _alepha_core2.HookDescriptor<"server:onRequest">;
552
- readonly onError: _alepha_core2.HookDescriptor<"server:onError">;
553
- readonly onResponse: _alepha_core2.HookDescriptor<"server:onResponse">;
546
+ readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
547
+ readonly onError: _alepha_core1.HookDescriptor<"server:onError">;
548
+ readonly onResponse: _alepha_core1.HookDescriptor<"server:onResponse">;
554
549
  }
555
- //# sourceMappingURL=ServerLoggerProvider.d.ts.map
556
550
  //#endregion
557
551
  //#region src/providers/ServerNotReadyProvider.d.ts
558
552
  /**
@@ -564,21 +558,7 @@ declare class ServerLoggerProvider {
564
558
  */
565
559
  declare class ServerNotReadyProvider {
566
560
  protected readonly alepha: Alepha;
567
- readonly onRequest: _alepha_core13.HookDescriptor<"server:onRequest">;
568
- }
569
- //# sourceMappingURL=ServerNotReadyProvider.d.ts.map
570
- //#endregion
571
- //#region src/providers/ServerTimingProvider.d.ts
572
- type TimingMap = Record<string, [number, number]>;
573
- declare class ServerTimingProvider {
574
- protected readonly log: _alepha_core14.Logger;
575
- protected readonly alepha: Alepha;
576
- readonly onRequest: _alepha_core14.HookDescriptor<"server:onRequest">;
577
- readonly onResponse: _alepha_core14.HookDescriptor<"server:onResponse">;
578
- protected get handlerName(): string;
579
- beginTiming(name: string): void;
580
- endTiming(name: string): void;
581
- protected setDuration(name: string, timing: TimingMap): void;
561
+ readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
582
562
  }
583
563
  //#endregion
584
564
  //#region src/index.d.ts
@@ -589,6 +569,12 @@ declare module "alepha" {
589
569
  request: ServerRequest;
590
570
  options: ClientRequestOptions;
591
571
  };
572
+ "action:onResponse": {
573
+ action: ActionDescriptor<RequestConfigSchema>;
574
+ request: ServerRequest;
575
+ options: ClientRequestOptions;
576
+ response: any;
577
+ };
592
578
  "server:onRequest": {
593
579
  route: ServerRoute;
594
580
  request: ServerRequest;
@@ -640,9 +626,7 @@ declare module "alepha" {
640
626
  * @see {@link $action}
641
627
  * @module alepha.server
642
628
  */
643
- declare const AlephaServer: _alepha_core0.ModuleDescriptor;
644
- //# sourceMappingURL=index.d.ts.map
645
-
629
+ declare const AlephaServer: _alepha_core1.Service<_alepha_core1.Module>;
646
630
  //#endregion
647
- export { $action, $route, ActionDescriptor, ActionDescriptorOptions, AlephaServer, ApiLink, ApiLinksResponse, BadRequestError, ClientRequestEntry, ClientRequestEntryContainer, ClientRequestOptions, ClientRequestResponse, ConflictError, FetchActionArgs, FetchOptions, FetchResponse, ForbiddenError, HttpAction, HttpClient, HttpClientPendingRequests, HttpError, HttpErrorLike, NodeHttpServerProvider, NotFoundError, Ok, RequestConfigSchema, ResponseBodyType, ResponseKind, RouteDescriptor, RouteDescriptorOptions, RouteMethod, ServerActionHandler, ServerActionRequest, ServerHandler, ServerLoggerProvider, ServerMiddlewareHandler, ServerNotReadyProvider, ServerProvider, ServerRawRequest, ServerReply, ServerRequest, ServerRequestConfig, ServerRequestConfigEntry, ServerResponse, ServerResponseBody, ServerRoute, ServerRouteMatcher, ServerRouterProvider, ServerTimingProvider, UnauthorizedError, ValidationError, apiLinkSchema, apiLinksResponseSchema, errorNameByStatus, errorSchema, isHttpError, isMultipart, okSchema, routeMethods };
631
+ export { $action, $route, ActionDescriptor, ActionDescriptorOptions, AlephaServer, BadRequestError, ClientRequestEntry, ClientRequestEntryContainer, ClientRequestOptions, ClientRequestResponse, ConflictError, FetchActionArgs, FetchOptions, FetchResponse, ForbiddenError, HttpAction, HttpClient, HttpClientPendingRequests, HttpError, HttpErrorLike, NodeHttpServerProvider, NotFoundError, Ok, RequestConfigSchema, ResponseBodyType, ResponseKind, RouteDescriptor, RouteDescriptorOptions, RouteMethod, ServerActionHandler, ServerActionRequest, ServerHandler, ServerLoggerProvider, ServerMiddlewareHandler, ServerNotReadyProvider, ServerProvider, ServerRawRequest, ServerReply, ServerRequest, ServerRequestConfig, ServerRequestConfigEntry, ServerResponse, ServerResponseBody, ServerRoute, ServerRouteMatcher, ServerRouterProvider, ServerTimingProvider, UnauthorizedError, ValidationError, errorNameByStatus, errorSchema, isHttpError, isMultipart, okSchema, routeMethods };
648
632
  //# sourceMappingURL=index.d.ts.map
package/topic/redis.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import * as _alepha_core0$1 from "alepha";
2
- import * as _alepha_core0 from "alepha";
1
+ import * as _alepha_core1 from "alepha";
3
2
  import { Alepha } from "alepha";
4
3
  import { SubscribeCallback, TopicProvider, UnSubscribeFn } from "alepha/topic";
4
+ import * as _alepha_logger0 from "alepha/logger";
5
5
  import { RedisProvider, RedisSubscriberProvider } from "alepha/redis";
6
6
 
7
7
  //#region src/providers/RedisTopicProvider.d.ts
@@ -12,8 +12,8 @@ declare class RedisTopicProvider extends TopicProvider {
12
12
  protected readonly alepha: Alepha;
13
13
  protected readonly redisProvider: RedisProvider;
14
14
  protected readonly redisSubscriberProvider: RedisSubscriberProvider;
15
- protected readonly log: _alepha_core0$1.Logger;
16
- protected readonly start: _alepha_core0$1.HookDescriptor<"start">;
15
+ protected readonly log: _alepha_logger0.Logger;
16
+ protected readonly start: _alepha_core1.HookDescriptor<"start">;
17
17
  prefix(queue: string): string;
18
18
  /**
19
19
  * Publish a message to a topic.
@@ -28,7 +28,6 @@ declare class RedisTopicProvider extends TopicProvider {
28
28
  */
29
29
  unsubscribe(name: string, callback?: SubscribeCallback): Promise<void>;
30
30
  }
31
- //# sourceMappingURL=RedisTopicProvider.d.ts.map
32
31
  //#endregion
33
32
  //#region src/index.d.ts
34
33
  /**
@@ -37,9 +36,7 @@ declare class RedisTopicProvider extends TopicProvider {
37
36
  * @see {@link RedisTopicProvider}
38
37
  * @module alepha.topic.redis
39
38
  */
40
- declare const AlephaTopicRedis: _alepha_core0.ModuleDescriptor;
41
- //# sourceMappingURL=index.d.ts.map
42
-
39
+ declare const AlephaTopicRedis: _alepha_core1.Service<_alepha_core1.Module>;
43
40
  //#endregion
44
41
  export { AlephaTopicRedis, RedisTopicProvider };
45
42
  //# sourceMappingURL=index.d.ts.map