alepha 0.7.6 → 0.7.7
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/LICENSE +21 -21
- package/README.md +44 -44
- package/core.d.ts +2 -1
- package/datetime.d.ts +4 -4
- package/package.json +60 -25
- package/postgres.d.ts +262 -201
- package/react/auth.d.ts +4 -9
- package/react/head.cjs +8 -0
- package/react/head.d.ts +86 -0
- package/react/head.js +1 -0
- package/react.d.ts +54 -103
- package/scheduler.d.ts +0 -1
- package/security.d.ts +9 -22
- package/server/cache.d.ts +2 -2
- package/server/cookies.d.ts +5 -2
- package/server/cors.cjs +8 -0
- package/server/cors.d.ts +25 -0
- package/server/cors.js +1 -0
- package/server/health.cjs +8 -0
- package/server/health.d.ts +42 -0
- package/server/health.js +1 -0
- package/server/links.cjs +8 -0
- package/server/links.d.ts +188 -0
- package/server/links.js +1 -0
- package/server/proxy.cjs +8 -0
- package/server/proxy.d.ts +41 -0
- package/server/proxy.js +1 -0
- package/server.d.ts +207 -421
- package/topic.d.ts +0 -16
package/server.d.ts
CHANGED
|
@@ -1,38 +1,43 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as _alepha_core57 from "@alepha/core";
|
|
3
|
-
import * as _alepha_core61 from "@alepha/core";
|
|
4
|
-
import * as _alepha_core109 from "@alepha/core";
|
|
5
|
-
import * as _alepha_core43 from "@alepha/core";
|
|
6
|
-
import * as _alepha_core47 from "@alepha/core";
|
|
7
|
-
import * as _alepha_core49 from "@alepha/core";
|
|
8
|
-
import * as _alepha_core50 from "@alepha/core";
|
|
9
|
-
import * as _alepha_core54 from "@alepha/core";
|
|
10
|
-
import * as _alepha_core103 from "@alepha/core";
|
|
1
|
+
import * as _alepha_core1 from "@alepha/core";
|
|
11
2
|
import * as _alepha_core3 from "@alepha/core";
|
|
3
|
+
import * as _alepha_core7 from "@alepha/core";
|
|
4
|
+
import * as _alepha_core9 from "@alepha/core";
|
|
5
|
+
import * as _alepha_core71 from "@alepha/core";
|
|
6
|
+
import * as _alepha_core10 from "@alepha/core";
|
|
7
|
+
import * as _alepha_core15 from "@alepha/core";
|
|
8
|
+
import * as _alepha_core23 from "@alepha/core";
|
|
12
9
|
import { Alepha, Async, FileLike, KIND, KIND as KIND$1, Module, OPTIONS, Static, StreamLike, TObject, TSchema } from "@alepha/core";
|
|
13
10
|
import { JwtProvider, Permission, SecurityProvider, ServiceAccountDescriptor, UserAccountToken } from "@alepha/security";
|
|
14
|
-
import {
|
|
15
|
-
import * as
|
|
16
|
-
import * as _alepha_retry112 from "@alepha/retry";
|
|
11
|
+
import { BusboyConfig } from "@fastify/busboy";
|
|
12
|
+
import * as _alepha_cache2 from "@alepha/cache";
|
|
17
13
|
import { Readable } from "node:stream";
|
|
18
14
|
import { ReadableStream } from "node:stream/web";
|
|
19
15
|
import { Route, RouterProvider } from "@alepha/router";
|
|
20
|
-
import { BusboyConfig } from "@fastify/busboy";
|
|
21
16
|
import { IncomingMessage, ServerResponse as ServerResponse$1 } from "node:http";
|
|
22
|
-
import
|
|
23
|
-
import * as
|
|
24
|
-
import * as
|
|
17
|
+
import { DurationLike } from "@alepha/datetime";
|
|
18
|
+
import * as _sinclair_typebox13 from "@sinclair/typebox";
|
|
19
|
+
import * as _sinclair_typebox37 from "@sinclair/typebox";
|
|
25
20
|
import * as _sinclair_typebox21 from "@sinclair/typebox";
|
|
26
|
-
import * as
|
|
27
|
-
import * as
|
|
28
|
-
import * as
|
|
29
|
-
import * as _sinclair_typebox1 from "@sinclair/typebox";
|
|
30
|
-
import * as http106 from "http";
|
|
21
|
+
import * as _sinclair_typebox27 from "@sinclair/typebox";
|
|
22
|
+
import * as _sinclair_typebox63 from "@sinclair/typebox";
|
|
23
|
+
import * as http18 from "http";
|
|
31
24
|
|
|
32
25
|
//#region src/constants/routeMethods.d.ts
|
|
33
26
|
declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
|
|
34
27
|
type RouteMethod = (typeof routeMethods)[number];
|
|
35
28
|
//#endregion
|
|
29
|
+
//#region src/helpers/ServerReply.d.ts
|
|
30
|
+
declare class ServerReply {
|
|
31
|
+
headers: Record<string, string> & {
|
|
32
|
+
"set-cookie"?: string[];
|
|
33
|
+
};
|
|
34
|
+
status?: number;
|
|
35
|
+
body?: any;
|
|
36
|
+
redirect(url: string, status?: number): void;
|
|
37
|
+
setStatus(status: number): void;
|
|
38
|
+
setHeader(name: string, value: string): void;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
36
41
|
//#region src/interfaces/index.d.ts
|
|
37
42
|
interface RequestConfigSchema {
|
|
38
43
|
body?: TSchema;
|
|
@@ -79,14 +84,6 @@ type ResponseKind = "json" | "text" | "void" | "file" | "any";
|
|
|
79
84
|
type ResponseBodyType = string | Buffer | StreamLike | undefined | null | void;
|
|
80
85
|
type ServerHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (request: ServerRequest<TConfig>) => Async<ServerResponseBody<TConfig>>;
|
|
81
86
|
type ServerMiddlewareHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (request: ServerRequest<TConfig>) => Async<ServerResponseBody<TConfig> | undefined>;
|
|
82
|
-
interface ServerReply {
|
|
83
|
-
headers: Record<string, string> & {
|
|
84
|
-
"set-cookie"?: string[];
|
|
85
|
-
};
|
|
86
|
-
status?: number;
|
|
87
|
-
body?: any;
|
|
88
|
-
redirect(url: string): void;
|
|
89
|
-
}
|
|
90
87
|
interface ServerResponse {
|
|
91
88
|
body: string | Buffer | ArrayBuffer | Readable | ReadableStream;
|
|
92
89
|
headers: Record<string, string>;
|
|
@@ -117,9 +114,8 @@ type ServerRouteSecure = boolean | {
|
|
|
117
114
|
//#endregion
|
|
118
115
|
//#region src/helpers/ActionDescriptorHelper.d.ts
|
|
119
116
|
declare class ActionDescriptorHelper {
|
|
120
|
-
name(options: ActionDescriptorOptions,
|
|
117
|
+
name(options: ActionDescriptorOptions, instance: any, key: string): string;
|
|
121
118
|
path(options: ActionDescriptorOptions, _instance: any, key: string): string;
|
|
122
|
-
link(options: ActionDescriptorOptions, instance: any, key: string, prefix?: string): HttpClientLink;
|
|
123
119
|
method(options: {
|
|
124
120
|
method?: string;
|
|
125
121
|
schema?: any;
|
|
@@ -134,78 +130,36 @@ declare class ActionDescriptorHelper {
|
|
|
134
130
|
fetchLinks(_url: string): void;
|
|
135
131
|
}
|
|
136
132
|
//#endregion
|
|
137
|
-
//#region src/schemas/apiLinksResponseSchema.d.ts
|
|
138
|
-
declare const apiLinkSchema: _sinclair_typebox65.TObject<{
|
|
139
|
-
name: _sinclair_typebox65.TString;
|
|
140
|
-
path: _sinclair_typebox65.TString;
|
|
141
|
-
method: _sinclair_typebox65.TOptional<_sinclair_typebox65.TString>;
|
|
142
|
-
group: _sinclair_typebox65.TOptional<_sinclair_typebox65.TString>;
|
|
143
|
-
requestBodyType: _sinclair_typebox65.TOptional<_sinclair_typebox65.TString>;
|
|
144
|
-
service: _sinclair_typebox65.TOptional<_sinclair_typebox65.TString>;
|
|
145
|
-
}>;
|
|
146
|
-
declare const apiLinksResponseSchema: _sinclair_typebox65.TObject<{
|
|
147
|
-
prefix: _sinclair_typebox65.TOptional<_sinclair_typebox65.TString>;
|
|
148
|
-
links: _sinclair_typebox65.TArray<_sinclair_typebox65.TObject<{
|
|
149
|
-
name: _sinclair_typebox65.TString;
|
|
150
|
-
path: _sinclair_typebox65.TString;
|
|
151
|
-
method: _sinclair_typebox65.TOptional<_sinclair_typebox65.TString>;
|
|
152
|
-
group: _sinclair_typebox65.TOptional<_sinclair_typebox65.TString>;
|
|
153
|
-
requestBodyType: _sinclair_typebox65.TOptional<_sinclair_typebox65.TString>;
|
|
154
|
-
service: _sinclair_typebox65.TOptional<_sinclair_typebox65.TString>;
|
|
155
|
-
}>>;
|
|
156
|
-
}>;
|
|
157
|
-
type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
|
|
158
|
-
type ApiLink = Static<typeof apiLinkSchema>;
|
|
159
|
-
//#endregion
|
|
160
133
|
//#region src/services/HttpClient.d.ts
|
|
161
134
|
declare class HttpClient {
|
|
162
|
-
protected readonly log:
|
|
135
|
+
protected readonly log: _alepha_core1.Logger;
|
|
163
136
|
protected readonly alepha: Alepha;
|
|
164
137
|
protected readonly helper: ActionDescriptorHelper;
|
|
165
|
-
readonly cache:
|
|
138
|
+
readonly cache: _alepha_cache2.CacheDescriptor<HttpClientCache, any[]>;
|
|
166
139
|
protected readonly pendingRequests: HttpClientPendingRequests;
|
|
167
|
-
readonly URL_LINKS = "/api/_links";
|
|
168
|
-
links?: Array<HttpClientLink>;
|
|
169
|
-
pushLink(link: HttpClientLink): void;
|
|
170
140
|
clear(): Promise<void>;
|
|
171
|
-
|
|
141
|
+
fetchAction(args: FetchActionArgs): Promise<FetchResponse>;
|
|
142
|
+
fetch<T>(url: string, request?: RequestInit,
|
|
143
|
+
// standard options
|
|
144
|
+
options?: FetchOptions): Promise<FetchResponse<T>>;
|
|
172
145
|
json<T = any>(url: string, options?: RequestInit): Promise<T>;
|
|
173
|
-
protected url(host: string,
|
|
174
|
-
protected body(init: RequestInit, headers: Record<string, string>,
|
|
175
|
-
protected responseData(response: Response, options:
|
|
146
|
+
protected url(host: string, action: HttpAction, args: ServerRequestConfigEntry): string;
|
|
147
|
+
protected body(init: RequestInit, headers: Record<string, string>, action: HttpAction, args?: ServerRequestConfigEntry): Promise<void>;
|
|
148
|
+
protected responseData(response: Response, options: FetchOptions): Promise<any>;
|
|
176
149
|
protected isMaybeFile(response: Response): boolean;
|
|
177
150
|
protected createFileLike(response: Response, defaultFileName?: string): FileLike;
|
|
178
|
-
|
|
179
|
-
|
|
151
|
+
pathVariables(url: string, action: {
|
|
152
|
+
schema?: {
|
|
153
|
+
params?: TObject;
|
|
154
|
+
};
|
|
155
|
+
}, args?: ServerRequestConfigEntry): string;
|
|
156
|
+
queryParams(url: string, action: {
|
|
180
157
|
schema?: {
|
|
181
158
|
query?: TObject;
|
|
182
159
|
};
|
|
183
160
|
}, args?: ServerRequestConfigEntry): string;
|
|
184
|
-
/**
|
|
185
|
-
* Transform a link into a fetch-request then call fetch().
|
|
186
|
-
*/
|
|
187
|
-
fetchLink(args: FetchLinkArgs): Promise<FetchResponse>;
|
|
188
|
-
/**
|
|
189
|
-
* Create a proxy client.
|
|
190
|
-
* This allows to call actions as methods, e.g. `client.actionName()`.
|
|
191
|
-
*/
|
|
192
|
-
of<T extends object>(scope?: ClientScope): HttpVirtualClient<T>;
|
|
193
|
-
protected getLinkByName(name: string, options?: ClientScope): Promise<HttpClientLink>;
|
|
194
|
-
/**
|
|
195
|
-
* Resolve a link by its name and call it.
|
|
196
|
-
* - If link is local, it will call the local handler.
|
|
197
|
-
* - If link is remote, it will make a fetch request to the remote server.
|
|
198
|
-
*/
|
|
199
|
-
follow(name: string, config?: Partial<ServerRequestConfigEntry>, options?: ClientRequestOptions & ClientScope): Promise<any>;
|
|
200
|
-
protected followRemote(link: HttpClientLink, config?: Partial<ServerRequestConfigEntry>, options?: ClientRequestOptions): Promise<FetchResponse>;
|
|
201
|
-
can(name: string): boolean;
|
|
202
|
-
getLinks(force?: boolean): Promise<HttpClientLink[]>;
|
|
203
161
|
}
|
|
204
|
-
|
|
205
|
-
interface FetchFactoryAdditionalOptions {
|
|
206
|
-
host?: string | (() => string);
|
|
207
|
-
}
|
|
208
|
-
interface FetchRunOptions {
|
|
162
|
+
interface FetchOptions {
|
|
209
163
|
/**
|
|
210
164
|
* Key to identify the request in the pending requests.
|
|
211
165
|
*/
|
|
@@ -219,26 +173,6 @@ interface FetchRunOptions {
|
|
|
219
173
|
*/
|
|
220
174
|
cache?: boolean | number | DurationLike;
|
|
221
175
|
}
|
|
222
|
-
interface HttpClientLink extends ApiLink {
|
|
223
|
-
secured?: boolean;
|
|
224
|
-
prefix?: string;
|
|
225
|
-
host?: string;
|
|
226
|
-
service?: string;
|
|
227
|
-
schema?: RequestConfigSchema;
|
|
228
|
-
handler?: ServerHandler;
|
|
229
|
-
}
|
|
230
|
-
interface ClientScope {
|
|
231
|
-
group?: string;
|
|
232
|
-
service?: string;
|
|
233
|
-
}
|
|
234
|
-
type HttpVirtualClient<T> = { [K in keyof T as T[K] extends ActionDescriptor ? K : never]: T[K] extends ActionDescriptor<infer Schema> ? T[K] & {
|
|
235
|
-
can: () => boolean;
|
|
236
|
-
schema: Schema;
|
|
237
|
-
} : never };
|
|
238
|
-
interface HttpClientCache {
|
|
239
|
-
data: any;
|
|
240
|
-
etag?: string;
|
|
241
|
-
}
|
|
242
176
|
interface FetchResponse<T = any> {
|
|
243
177
|
data: T;
|
|
244
178
|
status: number;
|
|
@@ -246,15 +180,31 @@ interface FetchResponse<T = any> {
|
|
|
246
180
|
headers: Headers;
|
|
247
181
|
raw?: Response;
|
|
248
182
|
}
|
|
249
|
-
|
|
250
|
-
|
|
183
|
+
type HttpClientPendingRequests = Record<string, Promise<any> | undefined>;
|
|
184
|
+
interface HttpClientCache {
|
|
185
|
+
data: any;
|
|
186
|
+
etag?: string;
|
|
187
|
+
}
|
|
188
|
+
interface FetchActionArgs {
|
|
189
|
+
action: HttpAction;
|
|
251
190
|
host?: string;
|
|
252
191
|
config?: ServerRequestConfigEntry;
|
|
253
192
|
options?: ClientRequestOptions;
|
|
254
193
|
}
|
|
194
|
+
interface HttpAction {
|
|
195
|
+
method?: string;
|
|
196
|
+
prefix?: string;
|
|
197
|
+
path: string;
|
|
198
|
+
schema?: {
|
|
199
|
+
params?: TObject;
|
|
200
|
+
query?: TObject;
|
|
201
|
+
body?: TSchema;
|
|
202
|
+
response?: TSchema;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
255
205
|
//#endregion
|
|
256
206
|
//#region src/descriptors/$action.d.ts
|
|
257
|
-
declare const KEY$
|
|
207
|
+
declare const KEY$1 = "ACTION";
|
|
258
208
|
interface ActionDescriptorOptions<TConfig extends RequestConfigSchema = RequestConfigSchema> extends Omit<ServerRoute, "handler" | "path" | "schema"> {
|
|
259
209
|
/**
|
|
260
210
|
* Name the route.
|
|
@@ -321,7 +271,7 @@ interface ActionDescriptorOptions<TConfig extends RequestConfigSchema = RequestC
|
|
|
321
271
|
handler?: ServerHandler<TConfig>;
|
|
322
272
|
}
|
|
323
273
|
interface ActionDescriptor<TConfig extends RequestConfigSchema = RequestConfigSchema> {
|
|
324
|
-
[KIND$1]: typeof KEY$
|
|
274
|
+
[KIND$1]: typeof KEY$1;
|
|
325
275
|
[OPTIONS]: ActionDescriptorOptions<TConfig>;
|
|
326
276
|
/**
|
|
327
277
|
* Fetch or just call local route when available.
|
|
@@ -347,7 +297,7 @@ type ClientRequestEntryContainer<TConfig extends RequestConfigSchema = RequestCo
|
|
|
347
297
|
headers?: TConfig["headers"] extends TSchema ? Static<TConfig["headers"]> : undefined;
|
|
348
298
|
query?: TConfig["query"] extends TSchema ? Partial<Static<TConfig["query"]>> : undefined;
|
|
349
299
|
};
|
|
350
|
-
interface ClientRequestOptions extends
|
|
300
|
+
interface ClientRequestOptions extends FetchOptions {
|
|
351
301
|
/**
|
|
352
302
|
* Forward user from the previous request.
|
|
353
303
|
* If "system", use system user. @see {ServerSecurityProvider.localSystemUser}
|
|
@@ -401,91 +351,6 @@ interface HttpErrorLike extends Error {
|
|
|
401
351
|
status: number;
|
|
402
352
|
}
|
|
403
353
|
//#endregion
|
|
404
|
-
//#region src/descriptors/$client.d.ts
|
|
405
|
-
declare const $client: <T extends object>(scope?: ClientScope) => HttpVirtualClient<T>;
|
|
406
|
-
//#endregion
|
|
407
|
-
//#region src/descriptors/$proxy.d.ts
|
|
408
|
-
type ProxyDescriptorOptions = {
|
|
409
|
-
path: string;
|
|
410
|
-
target: string;
|
|
411
|
-
disabled?: boolean;
|
|
412
|
-
beforeRequest?: (request: ServerRequest, proxyRequest: RequestInit) => Async<void>;
|
|
413
|
-
afterResponse?: (request: ServerRequest, proxyResponse: Response) => Async<void>;
|
|
414
|
-
rewrite?: (url: URL) => void;
|
|
415
|
-
};
|
|
416
|
-
interface ProxyDescriptor {
|
|
417
|
-
[KIND$1]: "PROXY";
|
|
418
|
-
[OPTIONS]: ProxyDescriptorOptions;
|
|
419
|
-
}
|
|
420
|
-
declare const $proxy: {
|
|
421
|
-
(options: ProxyDescriptorOptions): ProxyDescriptor;
|
|
422
|
-
[KIND$1]: string;
|
|
423
|
-
};
|
|
424
|
-
//#endregion
|
|
425
|
-
//#region src/descriptors/$remote.d.ts
|
|
426
|
-
declare const KEY$1 = "REMOTE";
|
|
427
|
-
interface RemoteDescriptorOptions {
|
|
428
|
-
/**
|
|
429
|
-
* The URL of the remote service.
|
|
430
|
-
* You can use a function to generate the URL dynamically.
|
|
431
|
-
* You probably should use $inject(env) to get the URL from the environment.
|
|
432
|
-
*
|
|
433
|
-
* @example
|
|
434
|
-
* ```ts
|
|
435
|
-
* import { $remote } from "@alepha/server";
|
|
436
|
-
* import { $inject, t } from "@alepha/core";
|
|
437
|
-
*
|
|
438
|
-
* class App {
|
|
439
|
-
* env = $inject(t.object({
|
|
440
|
-
* REMOTE_URL: t.string({default: "http://localhost:3000"}),
|
|
441
|
-
* }));
|
|
442
|
-
* remote = $remote({
|
|
443
|
-
* url: this.env.REMOTE_URL,
|
|
444
|
-
* });
|
|
445
|
-
* }
|
|
446
|
-
* ```
|
|
447
|
-
*/
|
|
448
|
-
url: string | (() => string);
|
|
449
|
-
/**
|
|
450
|
-
* The name of the remote service.
|
|
451
|
-
*
|
|
452
|
-
* @default Member of the class containing the remote service.
|
|
453
|
-
*/
|
|
454
|
-
name?: string;
|
|
455
|
-
/**
|
|
456
|
-
* If true, all methods of the remote service will be exposed as actions in this context.
|
|
457
|
-
* > Note: Proxy will never use the service account, it just... proxies the request.
|
|
458
|
-
*/
|
|
459
|
-
proxy?: boolean | Partial<ProxyDescriptorOptions & {
|
|
460
|
-
/**
|
|
461
|
-
* If true, the remote service won't be available internally, only through the proxy.
|
|
462
|
-
*/
|
|
463
|
-
noInternal: boolean;
|
|
464
|
-
}>;
|
|
465
|
-
/**
|
|
466
|
-
* For communication between the server and the remote service with a security layer.
|
|
467
|
-
* This will be used for internal communication and will not be exposed to the client.
|
|
468
|
-
*/
|
|
469
|
-
serviceAccount?: ServiceAccountDescriptor;
|
|
470
|
-
}
|
|
471
|
-
interface RemoteDescriptor {
|
|
472
|
-
[KIND$1]: typeof KEY$1;
|
|
473
|
-
[OPTIONS]: RemoteDescriptorOptions;
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
* $remote is a descriptor that allows you to define a remote service access.
|
|
477
|
-
*
|
|
478
|
-
* Use it only when you have 2 or more services that need to communicate with each other.
|
|
479
|
-
*
|
|
480
|
-
* All remote services can be exposed as actions, ... or not.
|
|
481
|
-
*
|
|
482
|
-
* You can add a service account if you want to use a security layer.
|
|
483
|
-
*/
|
|
484
|
-
declare const $remote: {
|
|
485
|
-
(options: RemoteDescriptorOptions): RemoteDescriptor;
|
|
486
|
-
[KIND$1]: string;
|
|
487
|
-
};
|
|
488
|
-
//#endregion
|
|
489
354
|
//#region src/descriptors/$route.d.ts
|
|
490
355
|
declare const KEY = "ROUTE";
|
|
491
356
|
interface RouteDescriptorOptions<TConfig extends RequestConfigSchema = RequestConfigSchema> extends ServerRoute<TConfig> {}
|
|
@@ -528,23 +393,75 @@ declare class ValidationError extends HttpError {
|
|
|
528
393
|
constructor(message?: string, cause?: unknown);
|
|
529
394
|
}
|
|
530
395
|
//#endregion
|
|
531
|
-
//#region src/providers/features/
|
|
396
|
+
//#region src/providers/features/ServerLoggerProvider.d.ts
|
|
397
|
+
declare class ServerLoggerProvider {
|
|
398
|
+
protected readonly log: _alepha_core3.Logger;
|
|
399
|
+
protected readonly alepha: Alepha;
|
|
400
|
+
readonly onRequest: _alepha_core3.HookDescriptor<"server:onRequest">;
|
|
401
|
+
readonly onError: _alepha_core3.HookDescriptor<"server:onError">;
|
|
402
|
+
readonly onResponse: _alepha_core3.HookDescriptor<"server:onResponse">;
|
|
403
|
+
}
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/providers/features/ServerMultipartProvider.d.ts
|
|
406
|
+
declare class ServerMultipartProvider {
|
|
407
|
+
protected readonly helper: ActionDescriptorHelper;
|
|
408
|
+
protected readonly alepha: Alepha;
|
|
409
|
+
readonly onRequest: _alepha_core7.HookDescriptor<"server:onRequest">;
|
|
410
|
+
readonly onSend: _alepha_core7.HookDescriptor<"server:onResponse">;
|
|
411
|
+
handleMultipartBodyFromNode(route: ServerRoute, stream: IncomingMessage): Promise<{
|
|
412
|
+
body: Record<string, any>;
|
|
413
|
+
cleanup: () => Promise<void>;
|
|
414
|
+
}>;
|
|
415
|
+
parseMultipart(req: IncomingMessage, config?: Omit<BusboyConfig, "headers">): Promise<MultipartResult>;
|
|
416
|
+
}
|
|
417
|
+
interface MultipartResult {
|
|
418
|
+
fields: Record<string, string | string[]>;
|
|
419
|
+
files: Record<string, HybridFile>;
|
|
420
|
+
}
|
|
421
|
+
interface HybridFile extends FileLike {
|
|
422
|
+
cleanup(): Promise<void>;
|
|
423
|
+
_state: {
|
|
424
|
+
cleanup: boolean;
|
|
425
|
+
size: number;
|
|
426
|
+
tmpPath: string;
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/providers/features/ServerNotReadyProvider.d.ts
|
|
532
431
|
/**
|
|
533
|
-
*
|
|
432
|
+
* On every request, this provider checks if the server is ready.
|
|
433
|
+
*
|
|
434
|
+
* If the server is not ready, it responds with a 503 status code and a message indicating that the server is not ready yet.
|
|
534
435
|
*
|
|
535
|
-
*
|
|
436
|
+
* The response also includes a `Retry-After` header indicating that the client should retry after 5 seconds.
|
|
536
437
|
*/
|
|
537
|
-
declare class
|
|
538
|
-
protected readonly dateTimeProvider: DateTimeProvider;
|
|
438
|
+
declare class ServerNotReadyProvider {
|
|
539
439
|
protected readonly alepha: Alepha;
|
|
540
|
-
readonly
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
440
|
+
readonly onRequest: _alepha_core9.HookDescriptor<"server:onRequest">;
|
|
441
|
+
}
|
|
442
|
+
//#endregion
|
|
443
|
+
//#region src/providers/features/ServerSecurityProvider.d.ts
|
|
444
|
+
declare class ServerSecurityProvider {
|
|
445
|
+
protected readonly log: _alepha_core71.Logger;
|
|
446
|
+
protected readonly securityProvider: SecurityProvider;
|
|
447
|
+
protected readonly jwtProvider: JwtProvider;
|
|
448
|
+
protected readonly alepha: Alepha;
|
|
449
|
+
readonly onClientRequest: _alepha_core71.HookDescriptor<"client:onRequest">;
|
|
450
|
+
protected readonly onRequest: _alepha_core71.HookDescriptor<"server:onRequest">;
|
|
451
|
+
protected readonly onRoute: _alepha_core71.HookDescriptor<"server:onRoute">;
|
|
452
|
+
}
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region src/providers/features/ServerTimingProvider.d.ts
|
|
455
|
+
type TimingMap = Record<string, [number, number]>;
|
|
456
|
+
declare class ServerTimingProvider {
|
|
457
|
+
protected readonly log: _alepha_core10.Logger;
|
|
458
|
+
protected readonly alepha: Alepha;
|
|
459
|
+
readonly onRequest: _alepha_core10.HookDescriptor<"server:onRequest">;
|
|
460
|
+
readonly onResponse: _alepha_core10.HookDescriptor<"server:onResponse">;
|
|
461
|
+
protected get handlerName(): string;
|
|
462
|
+
beginTiming(name: string): void;
|
|
463
|
+
endTiming(name: string): void;
|
|
464
|
+
protected setDuration(name: string, timing: TimingMap): void;
|
|
548
465
|
}
|
|
549
466
|
//#endregion
|
|
550
467
|
//#region src/providers/ServerRouterProvider.d.ts
|
|
@@ -557,7 +474,6 @@ declare class ServerHealthProvider {
|
|
|
557
474
|
*/
|
|
558
475
|
declare class ServerRouterProvider extends RouterProvider<ServerRouteWithHandler> {
|
|
559
476
|
protected readonly alepha: Alepha;
|
|
560
|
-
createRequestId(): string;
|
|
561
477
|
route<TConfig extends RequestConfigSchema = RequestConfigSchema>(route: ServerRoute<TConfig>): Promise<void>;
|
|
562
478
|
onRequest(route: ServerRoute, rawRequest: ServerRawRequest, responseKind: ResponseKind): Promise<ServerResponse>;
|
|
563
479
|
protected processRequest(request: ServerRequest, route: ServerRoute, responseKind: ResponseKind): Promise<{
|
|
@@ -576,30 +492,70 @@ declare class ServerRouterProvider extends RouterProvider<ServerRouteWithHandler
|
|
|
576
492
|
serializeResponse(route: ServerRoute, reply: ServerReply, responseKind: ResponseKind): void;
|
|
577
493
|
}
|
|
578
494
|
//#endregion
|
|
579
|
-
//#region src/providers/ProxyDescriptorProvider.d.ts
|
|
580
|
-
declare class ProxyDescriptorProvider {
|
|
581
|
-
protected readonly log: _alepha_core57.Logger;
|
|
582
|
-
protected readonly routerProvider: ServerRouterProvider;
|
|
583
|
-
protected readonly alepha: Alepha;
|
|
584
|
-
readonly configure: _alepha_core57.HookDescriptor<"configure">;
|
|
585
|
-
createProxyHandler(options: Omit<ProxyDescriptorOptions, "path">): ServerHandler;
|
|
586
|
-
proxy(options: ProxyDescriptorOptions): Promise<void>;
|
|
587
|
-
private getRawRequestBody;
|
|
588
|
-
}
|
|
589
|
-
//#endregion
|
|
590
495
|
//#region src/providers/platforms/ServerProvider.d.ts
|
|
591
496
|
declare class ServerProvider {
|
|
592
497
|
constructor();
|
|
593
498
|
get hostname(): string;
|
|
594
499
|
}
|
|
595
500
|
//#endregion
|
|
596
|
-
//#region src/providers/
|
|
597
|
-
declare const envSchema$
|
|
598
|
-
|
|
599
|
-
|
|
501
|
+
//#region src/providers/platforms/NodeHttpServerProvider.d.ts
|
|
502
|
+
declare const envSchema$1: _alepha_core15.TObject<{
|
|
503
|
+
SERVER_PORT: _sinclair_typebox13.TNumber;
|
|
504
|
+
SERVER_HOST: _sinclair_typebox13.TString;
|
|
600
505
|
}>;
|
|
601
506
|
declare module "alepha" {
|
|
602
|
-
interface Env extends Partial<Static<typeof envSchema$
|
|
507
|
+
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
508
|
+
}
|
|
509
|
+
declare class NodeHttpServerProvider implements ServerProvider {
|
|
510
|
+
protected readonly alepha: Alepha;
|
|
511
|
+
protected readonly log: _alepha_core15.Logger;
|
|
512
|
+
protected readonly env: {
|
|
513
|
+
SERVER_PORT: number;
|
|
514
|
+
SERVER_HOST: string;
|
|
515
|
+
};
|
|
516
|
+
protected readonly router: ServerRouterProvider;
|
|
517
|
+
protected readonly server: http18.Server<typeof IncomingMessage, typeof ServerResponse$1>;
|
|
518
|
+
handle(req: IncomingMessage, res: ServerResponse$1): Promise<number | void>;
|
|
519
|
+
createRouterRequest(req: IncomingMessage, res: ServerResponse$1, params?: Record<string, string>): ServerRawRequest;
|
|
520
|
+
getProtocol(req: IncomingMessage): "http" | "https";
|
|
521
|
+
shouldHaveBody(method: string): boolean;
|
|
522
|
+
get hostname(): string;
|
|
523
|
+
readonly start: _alepha_core15.HookDescriptor<"start">;
|
|
524
|
+
protected readonly stop: _alepha_core15.HookDescriptor<"stop">;
|
|
525
|
+
protected listen(): Promise<void>;
|
|
526
|
+
protected close(): Promise<void>;
|
|
527
|
+
}
|
|
528
|
+
//#endregion
|
|
529
|
+
//#region src/schemas/apiLinksResponseSchema.d.ts
|
|
530
|
+
declare const apiLinkSchema: _sinclair_typebox37.TObject<{
|
|
531
|
+
name: _sinclair_typebox37.TString;
|
|
532
|
+
path: _sinclair_typebox37.TString;
|
|
533
|
+
method: _sinclair_typebox37.TOptional<_sinclair_typebox37.TString>;
|
|
534
|
+
group: _sinclair_typebox37.TOptional<_sinclair_typebox37.TString>;
|
|
535
|
+
requestBodyType: _sinclair_typebox37.TOptional<_sinclair_typebox37.TString>;
|
|
536
|
+
service: _sinclair_typebox37.TOptional<_sinclair_typebox37.TString>;
|
|
537
|
+
}>;
|
|
538
|
+
declare const apiLinksResponseSchema: _sinclair_typebox37.TObject<{
|
|
539
|
+
prefix: _sinclair_typebox37.TOptional<_sinclair_typebox37.TString>;
|
|
540
|
+
links: _sinclair_typebox37.TArray<_sinclair_typebox37.TObject<{
|
|
541
|
+
name: _sinclair_typebox37.TString;
|
|
542
|
+
path: _sinclair_typebox37.TString;
|
|
543
|
+
method: _sinclair_typebox37.TOptional<_sinclair_typebox37.TString>;
|
|
544
|
+
group: _sinclair_typebox37.TOptional<_sinclair_typebox37.TString>;
|
|
545
|
+
requestBodyType: _sinclair_typebox37.TOptional<_sinclair_typebox37.TString>;
|
|
546
|
+
service: _sinclair_typebox37.TOptional<_sinclair_typebox37.TString>;
|
|
547
|
+
}>>;
|
|
548
|
+
}>;
|
|
549
|
+
type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
|
|
550
|
+
type ApiLink = Static<typeof apiLinkSchema>;
|
|
551
|
+
//#endregion
|
|
552
|
+
//#region src/providers/ServerActionDescriptorProvider.d.ts
|
|
553
|
+
declare const envSchema: _alepha_core23.TObject<{
|
|
554
|
+
SERVER_API_PREFIX: _sinclair_typebox21.TString;
|
|
555
|
+
SERVER_SECURITY_ENABLED: _sinclair_typebox21.TBoolean;
|
|
556
|
+
}>;
|
|
557
|
+
declare module "alepha/core" {
|
|
558
|
+
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
603
559
|
interface State {
|
|
604
560
|
/**
|
|
605
561
|
* Real (or fake) user account, used for internal actions.
|
|
@@ -610,7 +566,7 @@ declare module "alepha" {
|
|
|
610
566
|
}
|
|
611
567
|
}
|
|
612
568
|
declare class ServerActionDescriptorProvider {
|
|
613
|
-
protected readonly log:
|
|
569
|
+
protected readonly log: _alepha_core23.Logger;
|
|
614
570
|
protected readonly alepha: Alepha;
|
|
615
571
|
protected readonly env: {
|
|
616
572
|
SERVER_API_PREFIX: string;
|
|
@@ -623,14 +579,14 @@ declare class ServerActionDescriptorProvider {
|
|
|
623
579
|
protected readonly actions: ServerRouteAction[];
|
|
624
580
|
getActions(): ServerRouteAction<RequestConfigSchema>[];
|
|
625
581
|
getPrefix(): string;
|
|
626
|
-
readonly configure:
|
|
582
|
+
readonly configure: _alepha_core23.HookDescriptor<"configure">;
|
|
627
583
|
registerAction(value: ActionDescriptor, key: string, instance: any, prefix?: string): Promise<void>;
|
|
628
584
|
/**
|
|
629
585
|
* Check a mock function for the specified route.
|
|
630
586
|
*
|
|
631
587
|
* This is mostly used for testing purposes.
|
|
632
588
|
*/
|
|
633
|
-
protected
|
|
589
|
+
protected createLocalHandler(action: ActionDescriptorOptions, permission: Permission): (config?: ServerRequestConfigEntry, options?: ClientRequestOptions) => Promise<any>;
|
|
634
590
|
/**
|
|
635
591
|
* Get the user account token for a local action call.
|
|
636
592
|
* It will check the options, context, and system user.
|
|
@@ -662,186 +618,27 @@ interface ServerRouteAction<TConfig extends RequestConfigSchema = RequestConfigS
|
|
|
662
618
|
group: string;
|
|
663
619
|
permission: Permission;
|
|
664
620
|
options: ActionDescriptorOptions;
|
|
621
|
+
localHandler: LocalHandler;
|
|
665
622
|
}
|
|
666
|
-
|
|
667
|
-
//#region src/providers/RemoteDescriptorProvider.d.ts
|
|
668
|
-
declare class RemoteDescriptorProvider {
|
|
669
|
-
static path: {
|
|
670
|
-
apiLinks: string;
|
|
671
|
-
};
|
|
672
|
-
protected readonly alepha: Alepha;
|
|
673
|
-
protected readonly client: HttpClient;
|
|
674
|
-
protected readonly proxyProvider: ProxyDescriptorProvider;
|
|
675
|
-
protected readonly remotes: Array<ServerRemote>;
|
|
676
|
-
protected readonly log: _alepha_core109.Logger;
|
|
677
|
-
getRemotes(): ServerRemote[];
|
|
678
|
-
readonly configure: _alepha_core109.HookDescriptor<"configure">;
|
|
679
|
-
readonly start: _alepha_core109.HookDescriptor<"start">;
|
|
680
|
-
registerRemote(value: RemoteDescriptor, key: string): Promise<void>;
|
|
681
|
-
protected readonly fetchLinks: _alepha_retry112.RetryDescriptor<(opts: {
|
|
682
|
-
service: string;
|
|
683
|
-
url: string;
|
|
684
|
-
authorization?: string;
|
|
685
|
-
}) => Promise<{
|
|
686
|
-
prefix?: string | undefined;
|
|
687
|
-
links: {
|
|
688
|
-
method?: string | undefined;
|
|
689
|
-
group?: string | undefined;
|
|
690
|
-
requestBodyType?: string | undefined;
|
|
691
|
-
service?: string | undefined;
|
|
692
|
-
name: string;
|
|
693
|
-
path: string;
|
|
694
|
-
}[];
|
|
695
|
-
}>>;
|
|
696
|
-
}
|
|
697
|
-
//#endregion
|
|
698
|
-
//#region src/providers/features/ServerLinksProvider.d.ts
|
|
699
|
-
declare class ServerLinksProvider {
|
|
700
|
-
protected readonly alepha: Alepha;
|
|
701
|
-
protected readonly client: HttpClient;
|
|
702
|
-
protected readonly remoteProvider: RemoteDescriptorProvider;
|
|
703
|
-
protected readonly serverActionDescriptorProvider: ServerActionDescriptorProvider;
|
|
704
|
-
readonly links: RouteDescriptor<{
|
|
705
|
-
response: _sinclair_typebox21.TObject<{
|
|
706
|
-
prefix: _sinclair_typebox21.TOptional<_sinclair_typebox21.TString>;
|
|
707
|
-
links: _sinclair_typebox21.TArray<_sinclair_typebox21.TObject<{
|
|
708
|
-
name: _sinclair_typebox21.TString;
|
|
709
|
-
path: _sinclair_typebox21.TString;
|
|
710
|
-
method: _sinclair_typebox21.TOptional<_sinclair_typebox21.TString>;
|
|
711
|
-
group: _sinclair_typebox21.TOptional<_sinclair_typebox21.TString>;
|
|
712
|
-
requestBodyType: _sinclair_typebox21.TOptional<_sinclair_typebox21.TString>;
|
|
713
|
-
service: _sinclair_typebox21.TOptional<_sinclair_typebox21.TString>;
|
|
714
|
-
}>>;
|
|
715
|
-
}>;
|
|
716
|
-
}>;
|
|
717
|
-
readonly schema: RouteDescriptor<{
|
|
718
|
-
params: _sinclair_typebox21.TObject<{
|
|
719
|
-
name: _sinclair_typebox21.TString;
|
|
720
|
-
}>;
|
|
721
|
-
response: _sinclair_typebox21.TRecord<_sinclair_typebox21.TString, _sinclair_typebox21.TAny>;
|
|
722
|
-
}>;
|
|
723
|
-
getLinks(options: {
|
|
724
|
-
user?: UserAccountToken;
|
|
725
|
-
authorization?: string;
|
|
726
|
-
}): Promise<ApiLinksResponse>;
|
|
727
|
-
}
|
|
728
|
-
//#endregion
|
|
729
|
-
//#region src/providers/features/ServerLoggerProvider.d.ts
|
|
730
|
-
declare class ServerLoggerProvider {
|
|
731
|
-
protected readonly log: _alepha_core43.Logger;
|
|
732
|
-
protected readonly alepha: Alepha;
|
|
733
|
-
readonly onRequest: _alepha_core43.HookDescriptor<"server:onRequest">;
|
|
734
|
-
readonly onError: _alepha_core43.HookDescriptor<"server:onError">;
|
|
735
|
-
readonly onResponse: _alepha_core43.HookDescriptor<"server:onResponse">;
|
|
736
|
-
}
|
|
737
|
-
//#endregion
|
|
738
|
-
//#region src/providers/features/ServerMultipartProvider.d.ts
|
|
739
|
-
declare class ServerMultipartProvider {
|
|
740
|
-
protected readonly helper: ActionDescriptorHelper;
|
|
741
|
-
protected readonly alepha: Alepha;
|
|
742
|
-
readonly onRequest: _alepha_core47.HookDescriptor<"server:onRequest">;
|
|
743
|
-
readonly onSend: _alepha_core47.HookDescriptor<"server:onResponse">;
|
|
744
|
-
handleMultipartBodyFromNode(route: ServerRoute, stream: IncomingMessage): Promise<{
|
|
745
|
-
body: Record<string, any>;
|
|
746
|
-
cleanup: () => Promise<void>;
|
|
747
|
-
}>;
|
|
748
|
-
parseMultipart(req: IncomingMessage, config?: Omit<BusboyConfig, "headers">): Promise<MultipartResult>;
|
|
749
|
-
}
|
|
750
|
-
interface MultipartResult {
|
|
751
|
-
fields: Record<string, string | string[]>;
|
|
752
|
-
files: Record<string, HybridFile>;
|
|
753
|
-
}
|
|
754
|
-
interface HybridFile extends FileLike {
|
|
755
|
-
cleanup(): Promise<void>;
|
|
756
|
-
_state: {
|
|
757
|
-
cleanup: boolean;
|
|
758
|
-
size: number;
|
|
759
|
-
tmpPath: string;
|
|
760
|
-
};
|
|
761
|
-
}
|
|
762
|
-
//#endregion
|
|
763
|
-
//#region src/providers/features/ServerNotReadyProvider.d.ts
|
|
764
|
-
/**
|
|
765
|
-
* On every request, this provider checks if the server is ready.
|
|
766
|
-
*
|
|
767
|
-
* If the server is not ready, it responds with a 503 status code and a message indicating that the server is not ready yet.
|
|
768
|
-
*
|
|
769
|
-
* The response also includes a `Retry-After` header indicating that the client should retry after 5 seconds.
|
|
770
|
-
*/
|
|
771
|
-
declare class ServerNotReadyProvider {
|
|
772
|
-
protected readonly alepha: Alepha;
|
|
773
|
-
readonly onRequest: _alepha_core49.HookDescriptor<"server:onRequest">;
|
|
774
|
-
}
|
|
775
|
-
//#endregion
|
|
776
|
-
//#region src/providers/features/ServerSecurityProvider.d.ts
|
|
777
|
-
declare class ServerSecurityProvider {
|
|
778
|
-
protected readonly log: _alepha_core50.Logger;
|
|
779
|
-
protected readonly securityProvider: SecurityProvider;
|
|
780
|
-
protected readonly jwtProvider: JwtProvider;
|
|
781
|
-
protected readonly alepha: Alepha;
|
|
782
|
-
readonly onClientRequest: _alepha_core50.HookDescriptor<"client:onRequest">;
|
|
783
|
-
protected readonly onRequest: _alepha_core50.HookDescriptor<"server:onRequest">;
|
|
784
|
-
protected readonly onRoute: _alepha_core50.HookDescriptor<"server:onRoute">;
|
|
785
|
-
}
|
|
786
|
-
//#endregion
|
|
787
|
-
//#region src/providers/features/ServerTimingProvider.d.ts
|
|
788
|
-
type TimingMap = Record<string, [number, number]>;
|
|
789
|
-
declare class ServerTimingProvider {
|
|
790
|
-
protected readonly log: _alepha_core54.Logger;
|
|
791
|
-
protected readonly alepha: Alepha;
|
|
792
|
-
readonly onRequest: _alepha_core54.HookDescriptor<"server:onRequest">;
|
|
793
|
-
readonly onResponse: _alepha_core54.HookDescriptor<"server:onResponse">;
|
|
794
|
-
protected get handlerName(): string;
|
|
795
|
-
beginTiming(name: string): void;
|
|
796
|
-
endTiming(name: string): void;
|
|
797
|
-
protected setDuration(name: string, timing: TimingMap): void;
|
|
798
|
-
}
|
|
799
|
-
//#endregion
|
|
800
|
-
//#region src/providers/platforms/NodeHttpServerProvider.d.ts
|
|
801
|
-
declare const envSchema$1: _alepha_core103.TObject<{
|
|
802
|
-
SERVER_PORT: _sinclair_typebox101.TNumber;
|
|
803
|
-
SERVER_HOST: _sinclair_typebox101.TString;
|
|
804
|
-
}>;
|
|
805
|
-
declare module "alepha/core" {
|
|
806
|
-
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
807
|
-
}
|
|
808
|
-
declare class NodeHttpServerProvider implements ServerProvider {
|
|
809
|
-
protected readonly alepha: Alepha;
|
|
810
|
-
protected readonly log: _alepha_core103.Logger;
|
|
811
|
-
protected readonly env: {
|
|
812
|
-
SERVER_PORT: number;
|
|
813
|
-
SERVER_HOST: string;
|
|
814
|
-
};
|
|
815
|
-
protected readonly router: ServerRouterProvider;
|
|
816
|
-
protected readonly server: http106.Server<typeof IncomingMessage, typeof ServerResponse$1>;
|
|
817
|
-
handle(req: IncomingMessage, res: ServerResponse$1): Promise<number | void>;
|
|
818
|
-
createRouterRequest(req: IncomingMessage, res: ServerResponse$1, params?: Record<string, string>): ServerRawRequest;
|
|
819
|
-
getProtocol(req: IncomingMessage): "http" | "https";
|
|
820
|
-
shouldHaveBody(method: string): boolean;
|
|
821
|
-
get hostname(): string;
|
|
822
|
-
readonly start: _alepha_core103.HookDescriptor<"start">;
|
|
823
|
-
protected readonly stop: _alepha_core103.HookDescriptor<"stop">;
|
|
824
|
-
protected listen(): Promise<void>;
|
|
825
|
-
protected close(): Promise<void>;
|
|
826
|
-
}
|
|
623
|
+
type LocalHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (config?: ServerRequestConfigEntry<TConfig>, options?: ClientRequestOptions) => Promise<any>;
|
|
827
624
|
//#endregion
|
|
828
625
|
//#region src/schemas/errorSchema.d.ts
|
|
829
|
-
declare const errorSchema:
|
|
830
|
-
error:
|
|
831
|
-
status:
|
|
832
|
-
message:
|
|
833
|
-
details:
|
|
834
|
-
cause:
|
|
835
|
-
name:
|
|
836
|
-
message:
|
|
626
|
+
declare const errorSchema: _sinclair_typebox27.TObject<{
|
|
627
|
+
error: _sinclair_typebox27.TString;
|
|
628
|
+
status: _sinclair_typebox27.TNumber;
|
|
629
|
+
message: _sinclair_typebox27.TString;
|
|
630
|
+
details: _sinclair_typebox27.TOptional<_sinclair_typebox27.TString>;
|
|
631
|
+
cause: _sinclair_typebox27.TOptional<_sinclair_typebox27.TObject<{
|
|
632
|
+
name: _sinclair_typebox27.TString;
|
|
633
|
+
message: _sinclair_typebox27.TString;
|
|
837
634
|
}>>;
|
|
838
635
|
}>;
|
|
839
636
|
//#endregion
|
|
840
637
|
//#region src/schemas/okSchema.d.ts
|
|
841
|
-
declare const okSchema:
|
|
842
|
-
ok:
|
|
843
|
-
id:
|
|
844
|
-
count:
|
|
638
|
+
declare const okSchema: _sinclair_typebox63.TObject<{
|
|
639
|
+
ok: _sinclair_typebox63.TBoolean;
|
|
640
|
+
id: _sinclair_typebox63.TOptional<_sinclair_typebox63.TUnion<[_sinclair_typebox63.TString, _sinclair_typebox63.TInteger]>>;
|
|
641
|
+
count: _sinclair_typebox63.TOptional<_sinclair_typebox63.TNumber>;
|
|
845
642
|
}>;
|
|
846
643
|
type Ok = Static<typeof okSchema>;
|
|
847
644
|
//#endregion
|
|
@@ -870,7 +667,7 @@ declare module "@alepha/core" {
|
|
|
870
667
|
response: ServerResponse;
|
|
871
668
|
};
|
|
872
669
|
"client:onRequest": {
|
|
873
|
-
route:
|
|
670
|
+
route: HttpAction;
|
|
874
671
|
config: ServerRequestConfigEntry;
|
|
875
672
|
options: ClientRequestOptions;
|
|
876
673
|
headers: Record<string, string>;
|
|
@@ -878,30 +675,19 @@ declare module "@alepha/core" {
|
|
|
878
675
|
};
|
|
879
676
|
"client:beforeFetch": {
|
|
880
677
|
url: string;
|
|
881
|
-
options:
|
|
678
|
+
options: FetchOptions;
|
|
882
679
|
request: RequestInit;
|
|
883
680
|
};
|
|
884
681
|
"client:onError": {
|
|
885
|
-
route?:
|
|
682
|
+
route?: HttpAction;
|
|
886
683
|
error: HttpError;
|
|
887
684
|
};
|
|
888
685
|
}
|
|
889
686
|
}
|
|
890
|
-
declare const envSchema: _alepha_core3.TObject<{
|
|
891
|
-
SERVER_LINKS_ENABLED: _sinclair_typebox1.TBoolean;
|
|
892
|
-
SERVER_HEALTH_ENABLED: _sinclair_typebox1.TBoolean;
|
|
893
|
-
}>;
|
|
894
|
-
declare module "@alepha/core" {
|
|
895
|
-
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
896
|
-
}
|
|
897
687
|
declare class AlephaServer implements Module {
|
|
898
|
-
protected readonly env: {
|
|
899
|
-
SERVER_LINKS_ENABLED: boolean;
|
|
900
|
-
SERVER_HEALTH_ENABLED: boolean;
|
|
901
|
-
};
|
|
902
688
|
readonly name = "alepha.server";
|
|
903
689
|
readonly $services: (alepha: Alepha) => void;
|
|
904
690
|
}
|
|
905
691
|
//#endregion
|
|
906
|
-
export { $action, $
|
|
692
|
+
export { $action, $route, ActionDescriptor, ActionDescriptorHelper, ActionDescriptorOptions, AlephaServer, ApiLink, ApiLinksResponse, BadRequestError, ClientRequestEntry, ClientRequestEntryContainer, ClientRequestOptions, ClientRequestResponse, ConflictError, FetchActionArgs, FetchOptions, FetchResponse, ForbiddenError, HttpAction, HttpClient, HttpClientPendingRequests, HttpError, HttpErrorLike, KIND, LocalHandler, NodeHttpServerProvider, NotFoundError, Ok, RequestConfigSchema, ResponseBodyType, ResponseKind, RouteDescriptor, RouteDescriptorOptions, RouteMethod, ServerActionDescriptorProvider, ServerHandler, ServerLoggerProvider, ServerMiddlewareHandler, ServerMultipartProvider, ServerNotReadyProvider, ServerProvider, ServerRawRequest, ServerRemote, ServerReply, ServerRequest, ServerRequestConfig, ServerRequestConfigEntry, ServerResponse, ServerResponseBody, ServerRoute, ServerRouteAction, ServerRouteSecure, ServerRouteWithHandler, ServerRouterProvider, ServerSecurityProvider, ServerTimingProvider, UnauthorizedError, ValidationError, apiLinkSchema, apiLinksResponseSchema, errorNameByStatus, errorSchema, isHttpError, isServerAction, okSchema, routeMethods };
|
|
907
693
|
//# sourceMappingURL=index.d.ts.map
|