alepha 0.7.6 → 0.8.0
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/batch.cjs +8 -0
- package/batch.d.ts +114 -0
- package/batch.js +1 -0
- package/cache/redis.d.ts +15 -18
- package/cache.d.ts +115 -119
- package/command.cjs +8 -0
- package/command.d.ts +154 -0
- package/command.js +1 -0
- package/core.d.ts +800 -795
- package/datetime.d.ts +76 -76
- package/lock/redis.d.ts +12 -12
- package/lock.d.ts +70 -75
- package/package.json +102 -29
- package/postgres.d.ts +385 -278
- package/queue/redis.d.ts +15 -13
- package/queue.d.ts +16 -13
- package/react/auth.d.ts +16 -16
- package/react/head.cjs +8 -0
- package/react/head.d.ts +92 -0
- package/react/head.js +1 -0
- package/react.d.ts +90 -116
- package/redis.d.ts +20 -27
- package/retry.d.ts +74 -54
- package/scheduler.d.ts +14 -13
- package/security.d.ts +38 -41
- package/server/cache.d.ts +9 -7
- package/server/compress.cjs +8 -0
- package/server/compress.d.ts +26 -0
- package/server/compress.js +1 -0
- package/server/cookies.d.ts +71 -14
- package/server/cors.cjs +8 -0
- package/server/cors.d.ts +29 -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/helmet.cjs +8 -0
- package/server/helmet.d.ts +72 -0
- package/server/helmet.js +1 -0
- package/server/links.cjs +8 -0
- package/server/links.d.ts +179 -0
- package/server/links.js +1 -0
- package/server/metrics.cjs +8 -0
- package/server/metrics.d.ts +37 -0
- package/server/metrics.js +1 -0
- package/server/multipart.cjs +8 -0
- package/server/multipart.d.ts +48 -0
- package/server/multipart.js +1 -0
- package/server/proxy.cjs +8 -0
- package/server/proxy.d.ts +41 -0
- package/server/proxy.js +1 -0
- package/server/static.d.ts +63 -51
- package/server/swagger.d.ts +50 -50
- package/server.d.ts +220 -437
- package/topic/redis.d.ts +24 -23
- package/topic.d.ts +9 -19
- package/vite.d.ts +8 -1
package/server.d.ts
CHANGED
|
@@ -1,37 +1,40 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import * as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import * as
|
|
11
|
-
import * as _alepha_core3 from "@alepha/core";
|
|
12
|
-
import { Alepha, Async, FileLike, KIND, KIND as KIND$1, Module, OPTIONS, Static, StreamLike, TObject, TSchema } from "@alepha/core";
|
|
13
|
-
import { JwtProvider, Permission, SecurityProvider, ServiceAccountDescriptor, UserAccountToken } from "@alepha/security";
|
|
14
|
-
import { DateTimeProvider, DurationLike } from "@alepha/datetime";
|
|
15
|
-
import * as _alepha_cache6 from "@alepha/cache";
|
|
16
|
-
import * as _alepha_retry112 from "@alepha/retry";
|
|
1
|
+
import * as _alepha_core1 from "alepha";
|
|
2
|
+
import * as _alepha_core3 from "alepha";
|
|
3
|
+
import * as _alepha_core7 from "alepha";
|
|
4
|
+
import * as _alepha_core8 from "alepha";
|
|
5
|
+
import * as _alepha_core12 from "alepha";
|
|
6
|
+
import * as _alepha_core15 from "alepha";
|
|
7
|
+
import * as _alepha_core24 from "alepha";
|
|
8
|
+
import { Alepha, Async, FileLike, KIND, Module, OPTIONS, Static, StreamLike, TObject, TSchema } from "alepha";
|
|
9
|
+
import { JwtProvider, Permission, SecurityProvider, ServiceAccountDescriptor, UserAccountToken } from "alepha/security";
|
|
10
|
+
import * as _alepha_cache2 from "alepha/cache";
|
|
17
11
|
import { Readable } from "node:stream";
|
|
18
12
|
import { ReadableStream } from "node:stream/web";
|
|
19
|
-
import { Route, RouterProvider } from "
|
|
20
|
-
import { BusboyConfig } from "@fastify/busboy";
|
|
13
|
+
import { Route, RouterProvider } from "alepha/router";
|
|
21
14
|
import { IncomingMessage, ServerResponse as ServerResponse$1 } from "node:http";
|
|
22
|
-
import
|
|
23
|
-
import * as
|
|
24
|
-
import * as
|
|
25
|
-
import * as
|
|
26
|
-
import * as
|
|
27
|
-
import * as _sinclair_typebox91 from "@sinclair/typebox";
|
|
28
|
-
import * as _sinclair_typebox7 from "@sinclair/typebox";
|
|
29
|
-
import * as _sinclair_typebox1 from "@sinclair/typebox";
|
|
30
|
-
import * as http106 from "http";
|
|
15
|
+
import { DurationLike } from "alepha/datetime";
|
|
16
|
+
import * as _sinclair_typebox38 from "@sinclair/typebox";
|
|
17
|
+
import * as _sinclair_typebox64 from "@sinclair/typebox";
|
|
18
|
+
import * as _sinclair_typebox30 from "@sinclair/typebox";
|
|
19
|
+
import * as http20 from "http";
|
|
31
20
|
|
|
32
21
|
//#region src/constants/routeMethods.d.ts
|
|
33
22
|
declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
|
|
34
23
|
type RouteMethod = (typeof routeMethods)[number];
|
|
24
|
+
//# sourceMappingURL=routeMethods.d.ts.map
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/helpers/ServerReply.d.ts
|
|
27
|
+
declare class ServerReply {
|
|
28
|
+
headers: Record<string, string> & {
|
|
29
|
+
"set-cookie"?: string[];
|
|
30
|
+
};
|
|
31
|
+
status?: number;
|
|
32
|
+
body?: any;
|
|
33
|
+
redirect(url: string, status?: number): void;
|
|
34
|
+
setStatus(status: number): void;
|
|
35
|
+
setHeader(name: string, value: string): void;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=ServerReply.d.ts.map
|
|
35
38
|
//#endregion
|
|
36
39
|
//#region src/interfaces/index.d.ts
|
|
37
40
|
interface RequestConfigSchema {
|
|
@@ -79,14 +82,6 @@ type ResponseKind = "json" | "text" | "void" | "file" | "any";
|
|
|
79
82
|
type ResponseBodyType = string | Buffer | StreamLike | undefined | null | void;
|
|
80
83
|
type ServerHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (request: ServerRequest<TConfig>) => Async<ServerResponseBody<TConfig>>;
|
|
81
84
|
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
85
|
interface ServerResponse {
|
|
91
86
|
body: string | Buffer | ArrayBuffer | Readable | ReadableStream;
|
|
92
87
|
headers: Record<string, string>;
|
|
@@ -114,12 +109,12 @@ type ServerRouteSecure = boolean | {
|
|
|
114
109
|
realms?: string[];
|
|
115
110
|
organizations?: string[];
|
|
116
111
|
};
|
|
112
|
+
//# sourceMappingURL=index.d.ts.map
|
|
117
113
|
//#endregion
|
|
118
114
|
//#region src/helpers/ActionDescriptorHelper.d.ts
|
|
119
115
|
declare class ActionDescriptorHelper {
|
|
120
|
-
name(options: ActionDescriptorOptions,
|
|
116
|
+
name(options: ActionDescriptorOptions, instance: any, key: string): string;
|
|
121
117
|
path(options: ActionDescriptorOptions, _instance: any, key: string): string;
|
|
122
|
-
link(options: ActionDescriptorOptions, instance: any, key: string, prefix?: string): HttpClientLink;
|
|
123
118
|
method(options: {
|
|
124
119
|
method?: string;
|
|
125
120
|
schema?: any;
|
|
@@ -133,79 +128,38 @@ declare class ActionDescriptorHelper {
|
|
|
133
128
|
protected short(name: string): string;
|
|
134
129
|
fetchLinks(_url: string): void;
|
|
135
130
|
}
|
|
136
|
-
//#
|
|
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>;
|
|
131
|
+
//# sourceMappingURL=ActionDescriptorHelper.d.ts.map
|
|
159
132
|
//#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
|
|
274
|
+
[KIND]: typeof KEY$1;
|
|
325
275
|
[OPTIONS]: ActionDescriptorOptions<TConfig>;
|
|
326
276
|
/**
|
|
327
277
|
* Fetch or just call local route when available.
|
|
@@ -338,7 +288,7 @@ interface ActionDescriptor<TConfig extends RequestConfigSchema = RequestConfigSc
|
|
|
338
288
|
}
|
|
339
289
|
declare const $action: {
|
|
340
290
|
<TConfig extends RequestConfigSchema>(options: ActionDescriptorOptions<TConfig>): ActionDescriptor<TConfig>;
|
|
341
|
-
[KIND
|
|
291
|
+
[KIND]: string;
|
|
342
292
|
};
|
|
343
293
|
type ClientRequestEntry<TConfig extends RequestConfigSchema = RequestConfigSchema, T = ClientRequestEntryContainer<TConfig>> = { [K in keyof T as T[K] extends undefined ? never : K]: T[K] };
|
|
344
294
|
type ClientRequestEntryContainer<TConfig extends RequestConfigSchema = RequestConfigSchema> = {
|
|
@@ -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}
|
|
@@ -400,151 +350,149 @@ declare const isHttpError: (error: unknown) => error is HttpErrorLike;
|
|
|
400
350
|
interface HttpErrorLike extends Error {
|
|
401
351
|
status: number;
|
|
402
352
|
}
|
|
403
|
-
//#
|
|
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
|
-
};
|
|
353
|
+
//# sourceMappingURL=HttpError.d.ts.map
|
|
488
354
|
//#endregion
|
|
489
355
|
//#region src/descriptors/$route.d.ts
|
|
490
356
|
declare const KEY = "ROUTE";
|
|
491
357
|
interface RouteDescriptorOptions<TConfig extends RequestConfigSchema = RequestConfigSchema> extends ServerRoute<TConfig> {}
|
|
492
358
|
type RouteDescriptor<TConfig extends RequestConfigSchema = RequestConfigSchema> = {
|
|
493
|
-
[KIND
|
|
359
|
+
[KIND]: typeof KEY;
|
|
494
360
|
[OPTIONS]: RouteDescriptorOptions<TConfig>;
|
|
495
361
|
};
|
|
496
362
|
declare const $route: {
|
|
497
363
|
<TConfig extends RequestConfigSchema = RequestConfigSchema>(options: RouteDescriptorOptions<TConfig>): RouteDescriptor<TConfig>;
|
|
498
|
-
[KIND
|
|
364
|
+
[KIND]: string;
|
|
499
365
|
};
|
|
500
366
|
//#endregion
|
|
501
367
|
//#region src/errors/BadRequestError.d.ts
|
|
502
368
|
declare class BadRequestError extends HttpError {
|
|
503
369
|
constructor(message?: string, cause?: unknown);
|
|
504
370
|
}
|
|
371
|
+
//# sourceMappingURL=BadRequestError.d.ts.map
|
|
505
372
|
//#endregion
|
|
506
373
|
//#region src/errors/ConflictError.d.ts
|
|
507
374
|
declare class ConflictError extends HttpError {
|
|
508
375
|
constructor(message?: string, cause?: unknown);
|
|
509
376
|
}
|
|
377
|
+
//# sourceMappingURL=ConflictError.d.ts.map
|
|
510
378
|
//#endregion
|
|
511
379
|
//#region src/errors/ForbiddenError.d.ts
|
|
512
380
|
declare class ForbiddenError extends HttpError {
|
|
513
381
|
constructor(message?: string, cause?: unknown);
|
|
514
382
|
}
|
|
383
|
+
//# sourceMappingURL=ForbiddenError.d.ts.map
|
|
515
384
|
//#endregion
|
|
516
385
|
//#region src/errors/NotFoundError.d.ts
|
|
517
386
|
declare class NotFoundError extends HttpError {
|
|
518
387
|
constructor(message?: string, cause?: unknown);
|
|
519
388
|
}
|
|
389
|
+
//# sourceMappingURL=NotFoundError.d.ts.map
|
|
520
390
|
//#endregion
|
|
521
391
|
//#region src/errors/UnauthorizedError.d.ts
|
|
522
392
|
declare class UnauthorizedError extends HttpError {
|
|
523
393
|
constructor(message?: string, cause?: unknown);
|
|
524
394
|
}
|
|
395
|
+
//# sourceMappingURL=UnauthorizedError.d.ts.map
|
|
525
396
|
//#endregion
|
|
526
397
|
//#region src/errors/ValidationError.d.ts
|
|
527
398
|
declare class ValidationError extends HttpError {
|
|
528
399
|
constructor(message?: string, cause?: unknown);
|
|
529
400
|
}
|
|
401
|
+
//# sourceMappingURL=ValidationError.d.ts.map
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/schemas/apiLinksResponseSchema.d.ts
|
|
404
|
+
declare const apiLinkSchema: _sinclair_typebox38.TObject<{
|
|
405
|
+
name: _sinclair_typebox38.TString;
|
|
406
|
+
path: _sinclair_typebox38.TString;
|
|
407
|
+
method: _sinclair_typebox38.TOptional<_sinclair_typebox38.TString>;
|
|
408
|
+
group: _sinclair_typebox38.TOptional<_sinclair_typebox38.TString>;
|
|
409
|
+
requestBodyType: _sinclair_typebox38.TOptional<_sinclair_typebox38.TString>;
|
|
410
|
+
service: _sinclair_typebox38.TOptional<_sinclair_typebox38.TString>;
|
|
411
|
+
}>;
|
|
412
|
+
declare const apiLinksResponseSchema: _sinclair_typebox38.TObject<{
|
|
413
|
+
prefix: _sinclair_typebox38.TOptional<_sinclair_typebox38.TString>;
|
|
414
|
+
links: _sinclair_typebox38.TArray<_sinclair_typebox38.TObject<{
|
|
415
|
+
name: _sinclair_typebox38.TString;
|
|
416
|
+
path: _sinclair_typebox38.TString;
|
|
417
|
+
method: _sinclair_typebox38.TOptional<_sinclair_typebox38.TString>;
|
|
418
|
+
group: _sinclair_typebox38.TOptional<_sinclair_typebox38.TString>;
|
|
419
|
+
requestBodyType: _sinclair_typebox38.TOptional<_sinclair_typebox38.TString>;
|
|
420
|
+
service: _sinclair_typebox38.TOptional<_sinclair_typebox38.TString>;
|
|
421
|
+
}>>;
|
|
422
|
+
}>;
|
|
423
|
+
type ApiLinksResponse = Static<typeof apiLinksResponseSchema>;
|
|
424
|
+
type ApiLink = Static<typeof apiLinkSchema>;
|
|
425
|
+
//# sourceMappingURL=apiLinksResponseSchema.d.ts.map
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/schemas/errorSchema.d.ts
|
|
428
|
+
declare const errorSchema: _sinclair_typebox64.TObject<{
|
|
429
|
+
error: _sinclair_typebox64.TString;
|
|
430
|
+
status: _sinclair_typebox64.TNumber;
|
|
431
|
+
message: _sinclair_typebox64.TString;
|
|
432
|
+
details: _sinclair_typebox64.TOptional<_sinclair_typebox64.TString>;
|
|
433
|
+
cause: _sinclair_typebox64.TOptional<_sinclair_typebox64.TObject<{
|
|
434
|
+
name: _sinclair_typebox64.TString;
|
|
435
|
+
message: _sinclair_typebox64.TString;
|
|
436
|
+
}>>;
|
|
437
|
+
}>;
|
|
438
|
+
//# sourceMappingURL=errorSchema.d.ts.map
|
|
439
|
+
//#endregion
|
|
440
|
+
//#region src/schemas/okSchema.d.ts
|
|
441
|
+
declare const okSchema: _sinclair_typebox30.TObject<{
|
|
442
|
+
ok: _sinclair_typebox30.TBoolean;
|
|
443
|
+
id: _sinclair_typebox30.TOptional<_sinclair_typebox30.TUnion<[_sinclair_typebox30.TString, _sinclair_typebox30.TInteger]>>;
|
|
444
|
+
count: _sinclair_typebox30.TOptional<_sinclair_typebox30.TNumber>;
|
|
445
|
+
}>;
|
|
446
|
+
type Ok = Static<typeof okSchema>;
|
|
447
|
+
//# sourceMappingURL=okSchema.d.ts.map
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region src/providers/features/ServerLoggerProvider.d.ts
|
|
450
|
+
declare class ServerLoggerProvider {
|
|
451
|
+
protected readonly log: _alepha_core3.Logger;
|
|
452
|
+
protected readonly alepha: Alepha;
|
|
453
|
+
readonly onRequest: _alepha_core3.HookDescriptor<"server:onRequest">;
|
|
454
|
+
readonly onError: _alepha_core3.HookDescriptor<"server:onError">;
|
|
455
|
+
readonly onResponse: _alepha_core3.HookDescriptor<"server:onResponse">;
|
|
456
|
+
}
|
|
457
|
+
//# sourceMappingURL=ServerLoggerProvider.d.ts.map
|
|
530
458
|
//#endregion
|
|
531
|
-
//#region src/providers/features/
|
|
459
|
+
//#region src/providers/features/ServerNotReadyProvider.d.ts
|
|
532
460
|
/**
|
|
533
|
-
*
|
|
461
|
+
* On every request, this provider checks if the server is ready.
|
|
534
462
|
*
|
|
535
|
-
*
|
|
463
|
+
* If the server is not ready, it responds with a 503 status code and a message indicating that the server is not ready yet.
|
|
464
|
+
*
|
|
465
|
+
* The response also includes a `Retry-After` header indicating that the client should retry after 5 seconds.
|
|
536
466
|
*/
|
|
537
|
-
declare class
|
|
538
|
-
protected readonly dateTimeProvider: DateTimeProvider;
|
|
467
|
+
declare class ServerNotReadyProvider {
|
|
539
468
|
protected readonly alepha: Alepha;
|
|
540
|
-
readonly
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
469
|
+
readonly onRequest: _alepha_core7.HookDescriptor<"server:onRequest">;
|
|
470
|
+
}
|
|
471
|
+
//# sourceMappingURL=ServerNotReadyProvider.d.ts.map
|
|
472
|
+
//#endregion
|
|
473
|
+
//#region src/providers/features/ServerSecurityProvider.d.ts
|
|
474
|
+
declare class ServerSecurityProvider {
|
|
475
|
+
protected readonly log: _alepha_core8.Logger;
|
|
476
|
+
protected readonly securityProvider: SecurityProvider;
|
|
477
|
+
protected readonly jwtProvider: JwtProvider;
|
|
478
|
+
protected readonly alepha: Alepha;
|
|
479
|
+
readonly onClientRequest: _alepha_core8.HookDescriptor<"client:onRequest">;
|
|
480
|
+
protected readonly onRequest: _alepha_core8.HookDescriptor<"server:onRequest">;
|
|
481
|
+
protected readonly onRoute: _alepha_core8.HookDescriptor<"server:onRoute">;
|
|
482
|
+
}
|
|
483
|
+
//# sourceMappingURL=ServerSecurityProvider.d.ts.map
|
|
484
|
+
//#endregion
|
|
485
|
+
//#region src/providers/features/ServerTimingProvider.d.ts
|
|
486
|
+
type TimingMap = Record<string, [number, number]>;
|
|
487
|
+
declare class ServerTimingProvider {
|
|
488
|
+
protected readonly log: _alepha_core12.Logger;
|
|
489
|
+
protected readonly alepha: Alepha;
|
|
490
|
+
readonly onRequest: _alepha_core12.HookDescriptor<"server:onRequest">;
|
|
491
|
+
readonly onResponse: _alepha_core12.HookDescriptor<"server:onResponse">;
|
|
492
|
+
protected get handlerName(): string;
|
|
493
|
+
beginTiming(name: string): void;
|
|
494
|
+
endTiming(name: string): void;
|
|
495
|
+
protected setDuration(name: string, timing: TimingMap): void;
|
|
548
496
|
}
|
|
549
497
|
//#endregion
|
|
550
498
|
//#region src/providers/ServerRouterProvider.d.ts
|
|
@@ -557,7 +505,6 @@ declare class ServerHealthProvider {
|
|
|
557
505
|
*/
|
|
558
506
|
declare class ServerRouterProvider extends RouterProvider<ServerRouteWithHandler> {
|
|
559
507
|
protected readonly alepha: Alepha;
|
|
560
|
-
createRequestId(): string;
|
|
561
508
|
route<TConfig extends RequestConfigSchema = RequestConfigSchema>(route: ServerRoute<TConfig>): Promise<void>;
|
|
562
509
|
onRequest(route: ServerRoute, rawRequest: ServerRawRequest, responseKind: ResponseKind): Promise<ServerResponse>;
|
|
563
510
|
protected processRequest(request: ServerRequest, route: ServerRoute, responseKind: ResponseKind): Promise<{
|
|
@@ -575,31 +522,51 @@ declare class ServerRouterProvider extends RouterProvider<ServerRouteWithHandler
|
|
|
575
522
|
}, request: ServerRequestConfig): void;
|
|
576
523
|
serializeResponse(route: ServerRoute, reply: ServerReply, responseKind: ResponseKind): void;
|
|
577
524
|
}
|
|
525
|
+
//# sourceMappingURL=ServerRouterProvider.d.ts.map
|
|
578
526
|
//#endregion
|
|
579
|
-
//#region src/providers/
|
|
580
|
-
declare class
|
|
581
|
-
protected readonly log: _alepha_core57.Logger;
|
|
582
|
-
protected readonly routerProvider: ServerRouterProvider;
|
|
527
|
+
//#region src/providers/platforms/ServerProvider.d.ts
|
|
528
|
+
declare abstract class ServerProvider {
|
|
583
529
|
protected readonly alepha: Alepha;
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
proxy(options: ProxyDescriptorOptions): Promise<void>;
|
|
587
|
-
private getRawRequestBody;
|
|
530
|
+
abstract get hostname(): string;
|
|
531
|
+
protected isViteNotFound(url?: string, route?: Route, params?: Record<string, string>): boolean;
|
|
588
532
|
}
|
|
533
|
+
//# sourceMappingURL=ServerProvider.d.ts.map
|
|
589
534
|
//#endregion
|
|
590
|
-
//#region src/providers/platforms/
|
|
591
|
-
declare
|
|
592
|
-
|
|
535
|
+
//#region src/providers/platforms/NodeHttpServerProvider.d.ts
|
|
536
|
+
declare const envSchema$1: _alepha_core15.TObject<{
|
|
537
|
+
SERVER_PORT: _alepha_core15.TNumber;
|
|
538
|
+
SERVER_HOST: _alepha_core15.TString;
|
|
539
|
+
}>;
|
|
540
|
+
declare module "alepha" {
|
|
541
|
+
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
542
|
+
}
|
|
543
|
+
declare class NodeHttpServerProvider extends ServerProvider {
|
|
544
|
+
protected readonly alepha: Alepha;
|
|
545
|
+
protected readonly log: _alepha_core15.Logger;
|
|
546
|
+
protected readonly env: {
|
|
547
|
+
SERVER_PORT: number;
|
|
548
|
+
SERVER_HOST: string;
|
|
549
|
+
};
|
|
550
|
+
protected readonly router: ServerRouterProvider;
|
|
551
|
+
protected readonly server: http20.Server<typeof IncomingMessage, typeof ServerResponse$1>;
|
|
552
|
+
protected readonly onNodeRequest: _alepha_core15.HookDescriptor<"node:request">;
|
|
553
|
+
handle(req: IncomingMessage, res: ServerResponse$1): Promise<void>;
|
|
554
|
+
createRouterRequest(req: IncomingMessage, res: ServerResponse$1, params?: Record<string, string>): ServerRawRequest;
|
|
555
|
+
getProtocol(req: IncomingMessage): "http" | "https";
|
|
593
556
|
get hostname(): string;
|
|
557
|
+
readonly start: _alepha_core15.HookDescriptor<"start">;
|
|
558
|
+
protected readonly stop: _alepha_core15.HookDescriptor<"stop">;
|
|
559
|
+
protected listen(): Promise<void>;
|
|
560
|
+
protected close(): Promise<void>;
|
|
594
561
|
}
|
|
595
562
|
//#endregion
|
|
596
563
|
//#region src/providers/ServerActionDescriptorProvider.d.ts
|
|
597
|
-
declare const envSchema
|
|
598
|
-
SERVER_API_PREFIX:
|
|
599
|
-
SERVER_SECURITY_ENABLED:
|
|
564
|
+
declare const envSchema: _alepha_core24.TObject<{
|
|
565
|
+
SERVER_API_PREFIX: _alepha_core24.TString;
|
|
566
|
+
SERVER_SECURITY_ENABLED: _alepha_core24.TBoolean;
|
|
600
567
|
}>;
|
|
601
568
|
declare module "alepha" {
|
|
602
|
-
interface Env extends Partial<Static<typeof envSchema
|
|
569
|
+
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
603
570
|
interface State {
|
|
604
571
|
/**
|
|
605
572
|
* Real (or fake) user account, used for internal actions.
|
|
@@ -610,7 +577,7 @@ declare module "alepha" {
|
|
|
610
577
|
}
|
|
611
578
|
}
|
|
612
579
|
declare class ServerActionDescriptorProvider {
|
|
613
|
-
protected readonly log:
|
|
580
|
+
protected readonly log: _alepha_core24.Logger;
|
|
614
581
|
protected readonly alepha: Alepha;
|
|
615
582
|
protected readonly env: {
|
|
616
583
|
SERVER_API_PREFIX: string;
|
|
@@ -623,14 +590,14 @@ declare class ServerActionDescriptorProvider {
|
|
|
623
590
|
protected readonly actions: ServerRouteAction[];
|
|
624
591
|
getActions(): ServerRouteAction<RequestConfigSchema>[];
|
|
625
592
|
getPrefix(): string;
|
|
626
|
-
readonly configure:
|
|
593
|
+
readonly configure: _alepha_core24.HookDescriptor<"configure">;
|
|
627
594
|
registerAction(value: ActionDescriptor, key: string, instance: any, prefix?: string): Promise<void>;
|
|
628
595
|
/**
|
|
629
596
|
* Check a mock function for the specified route.
|
|
630
597
|
*
|
|
631
598
|
* This is mostly used for testing purposes.
|
|
632
599
|
*/
|
|
633
|
-
protected
|
|
600
|
+
protected createLocalHandler(action: ActionDescriptorOptions, permission: Permission): (config?: ServerRequestConfigEntry, options?: ClientRequestOptions) => Promise<any>;
|
|
634
601
|
/**
|
|
635
602
|
* Get the user account token for a local action call.
|
|
636
603
|
* It will check the options, context, and system user.
|
|
@@ -662,192 +629,17 @@ interface ServerRouteAction<TConfig extends RequestConfigSchema = RequestConfigS
|
|
|
662
629
|
group: string;
|
|
663
630
|
permission: Permission;
|
|
664
631
|
options: ActionDescriptorOptions;
|
|
632
|
+
localHandler: LocalHandler;
|
|
665
633
|
}
|
|
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
|
-
}
|
|
827
|
-
//#endregion
|
|
828
|
-
//#region src/schemas/errorSchema.d.ts
|
|
829
|
-
declare const errorSchema: _sinclair_typebox91.TObject<{
|
|
830
|
-
error: _sinclair_typebox91.TString;
|
|
831
|
-
status: _sinclair_typebox91.TNumber;
|
|
832
|
-
message: _sinclair_typebox91.TString;
|
|
833
|
-
details: _sinclair_typebox91.TOptional<_sinclair_typebox91.TString>;
|
|
834
|
-
cause: _sinclair_typebox91.TOptional<_sinclair_typebox91.TObject<{
|
|
835
|
-
name: _sinclair_typebox91.TString;
|
|
836
|
-
message: _sinclair_typebox91.TString;
|
|
837
|
-
}>>;
|
|
838
|
-
}>;
|
|
839
|
-
//#endregion
|
|
840
|
-
//#region src/schemas/okSchema.d.ts
|
|
841
|
-
declare const okSchema: _sinclair_typebox7.TObject<{
|
|
842
|
-
ok: _sinclair_typebox7.TBoolean;
|
|
843
|
-
id: _sinclair_typebox7.TOptional<_sinclair_typebox7.TUnion<[_sinclair_typebox7.TString, _sinclair_typebox7.TInteger]>>;
|
|
844
|
-
count: _sinclair_typebox7.TOptional<_sinclair_typebox7.TNumber>;
|
|
845
|
-
}>;
|
|
846
|
-
type Ok = Static<typeof okSchema>;
|
|
634
|
+
type LocalHandler<TConfig extends RequestConfigSchema = RequestConfigSchema> = (config?: ServerRequestConfigEntry<TConfig>, options?: ClientRequestOptions) => Promise<any>;
|
|
847
635
|
//#endregion
|
|
848
636
|
//#region src/index.d.ts
|
|
849
|
-
declare module "
|
|
637
|
+
declare module "alepha" {
|
|
850
638
|
interface Hooks {
|
|
639
|
+
"node:request": {
|
|
640
|
+
req: IncomingMessage;
|
|
641
|
+
res: ServerResponse$1;
|
|
642
|
+
};
|
|
851
643
|
"server:onRoute": {
|
|
852
644
|
route: ServerRoute;
|
|
853
645
|
};
|
|
@@ -870,7 +662,7 @@ declare module "@alepha/core" {
|
|
|
870
662
|
response: ServerResponse;
|
|
871
663
|
};
|
|
872
664
|
"client:onRequest": {
|
|
873
|
-
route:
|
|
665
|
+
route: HttpAction;
|
|
874
666
|
config: ServerRequestConfigEntry;
|
|
875
667
|
options: ClientRequestOptions;
|
|
876
668
|
headers: Record<string, string>;
|
|
@@ -878,30 +670,21 @@ declare module "@alepha/core" {
|
|
|
878
670
|
};
|
|
879
671
|
"client:beforeFetch": {
|
|
880
672
|
url: string;
|
|
881
|
-
options:
|
|
673
|
+
options: FetchOptions;
|
|
882
674
|
request: RequestInit;
|
|
883
675
|
};
|
|
884
676
|
"client:onError": {
|
|
885
|
-
route?:
|
|
677
|
+
route?: HttpAction;
|
|
886
678
|
error: HttpError;
|
|
887
679
|
};
|
|
888
680
|
}
|
|
889
681
|
}
|
|
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
682
|
declare class AlephaServer implements Module {
|
|
898
|
-
protected readonly env: {
|
|
899
|
-
SERVER_LINKS_ENABLED: boolean;
|
|
900
|
-
SERVER_HEALTH_ENABLED: boolean;
|
|
901
|
-
};
|
|
902
683
|
readonly name = "alepha.server";
|
|
903
684
|
readonly $services: (alepha: Alepha) => void;
|
|
904
685
|
}
|
|
686
|
+
//# sourceMappingURL=index.d.ts.map
|
|
687
|
+
|
|
905
688
|
//#endregion
|
|
906
|
-
export { $action, $
|
|
689
|
+
export { $action, $route, ActionDescriptor, ActionDescriptorHelper, ActionDescriptorOptions, AlephaServer, ApiLink, ApiLinksResponse, BadRequestError, ClientRequestEntry, ClientRequestEntryContainer, ClientRequestOptions, ClientRequestResponse, ConflictError, FetchActionArgs, FetchOptions, FetchResponse, ForbiddenError, HttpAction, HttpClient, HttpClientPendingRequests, HttpError, HttpErrorLike, LocalHandler, NodeHttpServerProvider, NotFoundError, Ok, RequestConfigSchema, ResponseBodyType, ResponseKind, RouteDescriptor, RouteDescriptorOptions, RouteMethod, ServerActionDescriptorProvider, ServerHandler, ServerLoggerProvider, ServerMiddlewareHandler, 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
690
|
//# sourceMappingURL=index.d.ts.map
|