alepha 0.7.7 → 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.
@@ -0,0 +1,72 @@
1
+ import { Alepha, HookDescriptor, Module } from "alepha";
2
+
3
+ //#region src/providers/ServerHelmetProvider.d.ts
4
+ type CspDirective = string | string[];
5
+ interface CspOptions {
6
+ directives: {
7
+ "default-src"?: CspDirective;
8
+ "script-src"?: CspDirective;
9
+ "style-src"?: CspDirective;
10
+ "img-src"?: CspDirective;
11
+ "connect-src"?: CspDirective;
12
+ "font-src"?: CspDirective;
13
+ "object-src"?: CspDirective;
14
+ "media-src"?: CspDirective;
15
+ "frame-src"?: CspDirective;
16
+ sandbox?: CspDirective | boolean;
17
+ "report-uri"?: string;
18
+ "child-src"?: CspDirective;
19
+ "form-action"?: CspDirective;
20
+ "frame-ancestors"?: CspDirective;
21
+ "plugin-types"?: CspDirective;
22
+ "base-uri"?: CspDirective;
23
+ [key: string]: CspDirective | undefined | boolean;
24
+ };
25
+ }
26
+ interface HstsOptions {
27
+ maxAge?: number;
28
+ includeSubDomains?: boolean;
29
+ preload?: boolean;
30
+ }
31
+ interface HelmetOptions {
32
+ isSecure?: boolean;
33
+ strictTransportSecurity?: HstsOptions | false;
34
+ xContentTypeOptions?: false;
35
+ xFrameOptions?: "DENY" | "SAMEORIGIN" | false;
36
+ xXssProtection?: false;
37
+ contentSecurityPolicy?: CspOptions | false;
38
+ referrerPolicy?: "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url" | false;
39
+ }
40
+ /**
41
+ * Provides a configurable way to apply essential HTTP security headers
42
+ * to every server response, without external dependencies.
43
+ */
44
+ declare class ServerHelmetProvider {
45
+ protected readonly alepha: Alepha;
46
+ /**
47
+ * The configuration options. These can be overridden during
48
+ * the application's configuration phase using `alepha.configure()`.
49
+ */
50
+ options: HelmetOptions;
51
+ private buildHeaders;
52
+ protected readonly onResponse: HookDescriptor<"server:onResponse">;
53
+ }
54
+ //#endregion
55
+ //#region src/index.d.ts
56
+ // ---------------------------------------------------------------------------------------------------------------------
57
+ /**
58
+ * Alepha Server Helmet Module
59
+ *
60
+ * Automatically adds important HTTP security headers to every response
61
+ * to help protect your application from common web vulnerabilities.
62
+ *
63
+ * @see {@link ServerHelmetProvider}
64
+ * @module alepha.server.helmet
65
+ */
66
+ declare class AlephaServerHelmet implements Module {
67
+ readonly name = "alepha.server.helmet";
68
+ readonly $services: (alepha: Alepha) => void;
69
+ }
70
+ //#endregion
71
+ export { AlephaServerHelmet, CspOptions, HelmetOptions, HstsOptions, ServerHelmetProvider };
72
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ export * from '@alepha/server-helmet'
package/server/links.d.ts CHANGED
@@ -1,18 +1,13 @@
1
- import * as _alepha_core23 from "@alepha/core";
2
- import * as _alepha_core24 from "@alepha/core";
3
- import * as _alepha_core0 from "@alepha/core";
4
- import { Alepha, KIND, Module, OPTIONS } from "@alepha/core";
5
- import * as _alepha_server16 from "@alepha/server";
6
- import { ActionDescriptor, ActionDescriptorHelper, ApiLink, ApiLinksResponse, ClientRequestOptions, FetchResponse, HttpClient, RequestConfigSchema, ServerActionDescriptorProvider, ServerHandler, ServerRemote, ServerRequestConfigEntry } from "@alepha/server";
7
- import * as _alepha_retry27 from "@alepha/retry";
8
- import { ProxyDescriptorOptions, ProxyDescriptorProvider } from "@alepha/server-proxy";
9
- import { ServiceAccountDescriptor, UserAccountToken } from "@alepha/security";
10
- import * as _sinclair_typebox1 from "@sinclair/typebox";
1
+ import { Alepha, HookDescriptor, KIND, Logger, Module, OPTIONS, TAny, TArray, TObject, TOptional, TRecord, TString } from "alepha";
2
+ import { ActionDescriptor, ActionDescriptorHelper, ApiLink, ApiLinksResponse, ClientRequestOptions, FetchResponse, HttpClient, RequestConfigSchema, RouteDescriptor, ServerActionDescriptorProvider, ServerHandler, ServerRemote, ServerRequestConfigEntry } from "alepha/server";
3
+ import { RetryDescriptor } from "alepha/retry";
4
+ import { ProxyDescriptorOptions, ProxyDescriptorProvider } from "alepha/server/proxy";
5
+ import { ServiceAccountDescriptor, UserAccountToken } from "alepha/security";
11
6
 
12
7
  //#region src/providers/LinkProvider.d.ts
13
8
  declare class LinkProvider {
14
9
  readonly URL_LINKS = "/api/_links";
15
- protected readonly log: _alepha_core23.Logger;
10
+ protected readonly log: Logger;
16
11
  protected readonly alepha: Alepha;
17
12
  protected readonly httpClient: HttpClient;
18
13
  links?: Array<HttpClientLink>;
@@ -20,20 +15,24 @@ declare class LinkProvider {
20
15
  getLinks(force?: boolean): Promise<HttpClientLink[]>;
21
16
  client<T extends object>(scope?: ClientScope): HttpVirtualClient<T>;
22
17
  /**
23
- * Resolve a link by its name and call it.
24
- * - If link is local, it will call the local handler.
25
- * - If link is remote, it will make a fetch request to the remote server.
26
- */
18
+ * Resolve a link by its name and call it.
19
+ * - If link is local, it will call the local handler.
20
+ * - If link is remote, it will make a fetch request to the remote server.
21
+ */
27
22
  follow(name: string, config?: Partial<ServerRequestConfigEntry>, options?: ClientRequestOptions & ClientScope): Promise<any>;
28
23
  protected followRemote(link: HttpClientLink, config?: Partial<ServerRequestConfigEntry>, options?: ClientRequestOptions): Promise<FetchResponse>;
29
24
  can(name: string): boolean;
30
25
  protected getLinkByName(name: string, options?: ClientScope): Promise<HttpClientLink>;
31
26
  }
27
+ // ---------------------------------------------------------------------------------------------------------------------
32
28
  interface HttpClientLink extends ApiLink {
33
29
  secured?: boolean;
34
30
  prefix?: string;
31
+ // -- server only --
32
+ // only for remote actions
35
33
  host?: string;
36
34
  service?: string;
35
+ // used only for local actions, not for remote actions
37
36
  schema?: RequestConfigSchema;
38
37
  handler?: ServerHandler;
39
38
  }
@@ -53,46 +52,46 @@ declare const $client: <T extends object>(scope?: ClientScope) => HttpVirtualCli
53
52
  declare const KEY = "REMOTE";
54
53
  interface RemoteDescriptorOptions {
55
54
  /**
56
- * The URL of the remote service.
57
- * You can use a function to generate the URL dynamically.
58
- * You probably should use $inject(env) to get the URL from the environment.
59
- *
60
- * @example
61
- * ```ts
62
- * import { $remote } from "@alepha/server";
63
- * import { $inject, t } from "@alepha/core";
64
- *
65
- * class App {
66
- * env = $inject(t.object({
67
- * REMOTE_URL: t.string({default: "http://localhost:3000"}),
68
- * }));
69
- * remote = $remote({
70
- * url: this.env.REMOTE_URL,
71
- * });
72
- * }
73
- * ```
74
- */
55
+ * The URL of the remote service.
56
+ * You can use a function to generate the URL dynamically.
57
+ * You probably should use $inject(env) to get the URL from the environment.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * import { $remote } from "alepha/server";
62
+ * import { $inject, t } from "alepha";
63
+ *
64
+ * class App {
65
+ * env = $inject(t.object({
66
+ * REMOTE_URL: t.string({default: "http://localhost:3000"}),
67
+ * }));
68
+ * remote = $remote({
69
+ * url: this.env.REMOTE_URL,
70
+ * });
71
+ * }
72
+ * ```
73
+ */
75
74
  url: string | (() => string);
76
75
  /**
77
- * The name of the remote service.
78
- *
79
- * @default Member of the class containing the remote service.
80
- */
76
+ * The name of the remote service.
77
+ *
78
+ * @default Member of the class containing the remote service.
79
+ */
81
80
  name?: string;
82
81
  /**
83
- * If true, all methods of the remote service will be exposed as actions in this context.
84
- * > Note: Proxy will never use the service account, it just... proxies the request.
85
- */
82
+ * If true, all methods of the remote service will be exposed as actions in this context.
83
+ * > Note: Proxy will never use the service account, it just... proxies the request.
84
+ */
86
85
  proxy?: boolean | Partial<ProxyDescriptorOptions & {
87
86
  /**
88
- * If true, the remote service won't be available internally, only through the proxy.
89
- */
87
+ * If true, the remote service won't be available internally, only through the proxy.
88
+ */
90
89
  noInternal: boolean;
91
90
  }>;
92
91
  /**
93
- * For communication between the server and the remote service with a security layer.
94
- * This will be used for internal communication and will not be exposed to the client.
95
- */
92
+ * For communication between the server and the remote service with a security layer.
93
+ * This will be used for internal communication and will not be exposed to the client.
94
+ */
96
95
  serviceAccount?: ServiceAccountDescriptor;
97
96
  }
98
97
  interface RemoteDescriptor {
@@ -100,14 +99,14 @@ interface RemoteDescriptor {
100
99
  [OPTIONS]: RemoteDescriptorOptions;
101
100
  }
102
101
  /**
103
- * $remote is a descriptor that allows you to define a remote service access.
104
- *
105
- * Use it only when you have 2 or more services that need to communicate with each other.
106
- *
107
- * All remote services can be exposed as actions, ... or not.
108
- *
109
- * You can add a service account if you want to use a security layer.
110
- */
102
+ * $remote is a descriptor that allows you to define a remote service access.
103
+ *
104
+ * Use it only when you have 2 or more services that need to communicate with each other.
105
+ *
106
+ * All remote services can be exposed as actions, ... or not.
107
+ *
108
+ * You can add a service account if you want to use a security layer.
109
+ */
111
110
  declare const $remote: {
112
111
  (options: RemoteDescriptorOptions): RemoteDescriptor;
113
112
  [KIND]: string;
@@ -122,26 +121,17 @@ declare class RemoteDescriptorProvider {
122
121
  protected readonly client: LinkProvider;
123
122
  protected readonly proxyProvider: ProxyDescriptorProvider;
124
123
  protected readonly remotes: Array<ServerRemote>;
125
- protected readonly log: _alepha_core24.Logger;
124
+ protected readonly log: Logger;
126
125
  getRemotes(): ServerRemote[];
127
- readonly configure: _alepha_core24.HookDescriptor<"configure">;
128
- readonly start: _alepha_core24.HookDescriptor<"start">;
126
+ readonly configure: HookDescriptor<"configure">;
127
+ readonly start: HookDescriptor<"start">;
129
128
  registerRemote(value: RemoteDescriptor, key: string): Promise<void>;
130
- protected readonly fetchLinks: _alepha_retry27.RetryDescriptor<(opts: {
131
- service: string;
132
- url: string;
133
- authorization?: string;
134
- }) => Promise<{
135
- prefix?: string | undefined;
136
- links: {
137
- method?: string | undefined;
138
- group?: string | undefined;
139
- requestBodyType?: string | undefined;
140
- service?: string | undefined;
141
- name: string;
142
- path: string;
143
- }[];
144
- }>>;
129
+ protected readonly fetchLinks: RetryDescriptor<(opts: FetchLinksOptions) => Promise<ApiLinksResponse>>;
130
+ }
131
+ interface FetchLinksOptions {
132
+ service: string;
133
+ url: string;
134
+ authorization?: string;
145
135
  }
146
136
  //#endregion
147
137
  //#region src/providers/ServerLinksProvider.d.ts
@@ -151,25 +141,25 @@ declare class ServerLinksProvider {
151
141
  protected readonly helper: ActionDescriptorHelper;
152
142
  protected readonly remoteProvider: RemoteDescriptorProvider;
153
143
  protected readonly serverActionDescriptorProvider: ServerActionDescriptorProvider;
154
- readonly onRoute: _alepha_core0.HookDescriptor<"server:onRoute">;
155
- readonly links: _alepha_server16.RouteDescriptor<{
156
- response: _sinclair_typebox1.TObject<{
157
- prefix: _sinclair_typebox1.TOptional<_sinclair_typebox1.TString>;
158
- links: _sinclair_typebox1.TArray<_sinclair_typebox1.TObject<{
159
- name: _sinclair_typebox1.TString;
160
- path: _sinclair_typebox1.TString;
161
- method: _sinclair_typebox1.TOptional<_sinclair_typebox1.TString>;
162
- group: _sinclair_typebox1.TOptional<_sinclair_typebox1.TString>;
163
- requestBodyType: _sinclair_typebox1.TOptional<_sinclair_typebox1.TString>;
164
- service: _sinclair_typebox1.TOptional<_sinclair_typebox1.TString>;
144
+ readonly onRoute: HookDescriptor<"server:onRoute">;
145
+ readonly links: RouteDescriptor<{
146
+ response: TObject<{
147
+ prefix: TOptional<TString>;
148
+ links: TArray<TObject<{
149
+ name: TString;
150
+ path: TString;
151
+ method: TOptional<TString>;
152
+ group: TOptional<TString>;
153
+ requestBodyType: TOptional<TString>;
154
+ service: TOptional<TString>;
165
155
  }>>;
166
156
  }>;
167
157
  }>;
168
- readonly schema: _alepha_server16.RouteDescriptor<{
169
- params: _sinclair_typebox1.TObject<{
170
- name: _sinclair_typebox1.TString;
158
+ readonly schema: RouteDescriptor<{
159
+ params: TObject<{
160
+ name: TString;
171
161
  }>;
172
- response: _sinclair_typebox1.TRecord<_sinclair_typebox1.TString, _sinclair_typebox1.TAny>;
162
+ response: TRecord<TString, TAny>;
173
163
  }>;
174
164
  getLinks(options: GetLinksOptions): Promise<ApiLinksResponse>;
175
165
  }
@@ -179,10 +169,11 @@ interface GetLinksOptions {
179
169
  }
180
170
  //#endregion
181
171
  //#region src/index.d.ts
172
+ // ---------------------------------------------------------------------------------------------------------------------
182
173
  declare class AlephaServerLinks implements Module {
183
174
  readonly name = "alepha.server.links";
184
175
  readonly $services: (alepha: Alepha) => void;
185
176
  }
186
177
  //#endregion
187
- export { $client, $remote, AlephaServerLinks, ClientScope, GetLinksOptions, HttpClientLink, HttpVirtualClient, LinkProvider, RemoteDescriptor, RemoteDescriptorOptions, RemoteDescriptorProvider, ServerLinksProvider };
178
+ export { $client, $remote, AlephaServerLinks, ClientScope, FetchLinksOptions, GetLinksOptions, HttpClientLink, HttpVirtualClient, LinkProvider, RemoteDescriptor, RemoteDescriptorOptions, RemoteDescriptorProvider, ServerLinksProvider };
188
179
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ var m = require('@alepha/server-metrics');
3
+ Object.keys(m).forEach(function (k) {
4
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
+ enumerable: true,
6
+ get: function () { return m[k]; }
7
+ });
8
+ });
@@ -0,0 +1,37 @@
1
+ import { RouteDescriptor } from "alepha/server";
2
+ import { Alepha, HookDescriptor, Module } from "alepha";
3
+ import { Registry } from "prom-client";
4
+
5
+ //#region src/providers/ServerMetricsProvider.d.ts
6
+ interface ServerMetricsProviderOptions {
7
+ prefix?: string;
8
+ gcDurationBuckets?: number[];
9
+ eventLoopMonitoringPrecision?: number;
10
+ labels?: object;
11
+ }
12
+ declare class ServerMetricsProvider {
13
+ protected readonly register: Registry;
14
+ protected readonly alepha: Alepha;
15
+ readonly options: ServerMetricsProviderOptions;
16
+ readonly metrics: RouteDescriptor;
17
+ protected readonly onStart: HookDescriptor<"start">;
18
+ }
19
+ //#endregion
20
+ //#region src/index.d.ts
21
+ // ---------------------------------------------------------------------------------------------------------------------
22
+ /**
23
+ * Alepha Server Metrics Module
24
+ *
25
+ * This module provides prometheus metrics for the Alepha server.
26
+ * Metrics are exposed at the `/metrics` endpoint.
27
+ *
28
+ * @see {@link ServerMetricsProvider}
29
+ * @module alepha.server.metrics
30
+ */
31
+ declare class AlephaServerMetrics implements Module {
32
+ readonly name = "alepha.server.metrics";
33
+ readonly $services: (alepha: Alepha) => void;
34
+ }
35
+ //#endregion
36
+ export { AlephaServerMetrics, ServerMetricsProvider, ServerMetricsProviderOptions };
37
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ export * from '@alepha/server-metrics'
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ var m = require('@alepha/server-multipart');
3
+ Object.keys(m).forEach(function (k) {
4
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
+ enumerable: true,
6
+ get: function () { return m[k]; }
7
+ });
8
+ });
@@ -0,0 +1,48 @@
1
+ import { ActionDescriptorHelper, ServerRoute } from "alepha/server";
2
+ import { Alepha, FileLike, HookDescriptor, Module } from "alepha";
3
+ import { BusboyConfig } from "@fastify/busboy";
4
+ import { IncomingMessage } from "node:http";
5
+
6
+ //#region src/providers/ServerMultipartProvider.d.ts
7
+ declare class ServerMultipartProvider {
8
+ protected readonly helper: ActionDescriptorHelper;
9
+ protected readonly alepha: Alepha;
10
+ readonly onRequest: HookDescriptor<"server:onRequest">;
11
+ readonly onSend: HookDescriptor<"server:onResponse">;
12
+ handleMultipartBodyFromNode(route: ServerRoute, stream: IncomingMessage): Promise<{
13
+ body: Record<string, any>;
14
+ cleanup: () => Promise<void>;
15
+ }>;
16
+ parseMultipart(req: IncomingMessage, config?: Omit<BusboyConfig, "headers">): Promise<MultipartResult>;
17
+ }
18
+ interface MultipartResult {
19
+ fields: Record<string, string | string[]>;
20
+ files: Record<string, HybridFile>;
21
+ }
22
+ interface HybridFile extends FileLike {
23
+ cleanup(): Promise<void>;
24
+ _state: {
25
+ cleanup: boolean;
26
+ size: number;
27
+ tmpPath: string;
28
+ };
29
+ }
30
+ //#endregion
31
+ //#region src/index.d.ts
32
+ // ---------------------------------------------------------------------------------------------------------------------
33
+ /**
34
+ * Alepha Server Multipart Module
35
+ *
36
+ * This module provides support for handling multipart/form-data requests.
37
+ * It allows to parse body data containing t.file().
38
+ *
39
+ * @see {@link ServerMultipartProvider}
40
+ * @module alepha.server.multipart
41
+ */
42
+ declare class AlephaServerMultipart implements Module {
43
+ readonly name = "alepha.server.multipart";
44
+ readonly $services: (alepha: Alepha) => void;
45
+ }
46
+ //#endregion
47
+ export { AlephaServerMultipart, ServerMultipartProvider };
48
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ export * from '@alepha/server-multipart'
package/server/proxy.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- import * as _alepha_core0 from "@alepha/core";
2
- import { Alepha, Async, KIND, Module, OPTIONS } from "@alepha/core";
3
- import { ServerHandler, ServerRequest, ServerRouterProvider } from "@alepha/server";
1
+ import { Alepha, Async, HookDescriptor, KIND, Logger, Module, OPTIONS } from "alepha";
2
+ import { ServerHandler, ServerRequest, ServerRouterProvider } from "alepha/server";
4
3
 
5
4
  //#region src/descriptors/$proxy.d.ts
6
5
  type ProxyDescriptorOptions = {
7
6
  path: string;
8
- target: string;
7
+ target: string | (() => string);
9
8
  disabled?: boolean;
10
9
  beforeRequest?: (request: ServerRequest, proxyRequest: RequestInit) => Async<void>;
11
10
  afterResponse?: (request: ServerRequest, proxyResponse: Response) => Async<void>;
@@ -22,16 +21,17 @@ declare const $proxy: {
22
21
  //#endregion
23
22
  //#region src/providers/ProxyDescriptorProvider.d.ts
24
23
  declare class ProxyDescriptorProvider {
25
- protected readonly log: _alepha_core0.Logger;
24
+ protected readonly log: Logger;
26
25
  protected readonly routerProvider: ServerRouterProvider;
27
26
  protected readonly alepha: Alepha;
28
- readonly configure: _alepha_core0.HookDescriptor<"configure">;
29
- createProxyHandler(options: Omit<ProxyDescriptorOptions, "path">): ServerHandler;
27
+ readonly configure: HookDescriptor<"configure">;
28
+ createProxyHandler(target: string, options: Omit<ProxyDescriptorOptions, "path">): ServerHandler;
30
29
  proxy(options: ProxyDescriptorOptions): Promise<void>;
31
30
  private getRawRequestBody;
32
31
  }
33
32
  //#endregion
34
33
  //#region src/index.d.ts
34
+ // ---------------------------------------------------------------------------------------------------------------------
35
35
  declare class AlephaServerProxy implements Module {
36
36
  readonly name = "alepha.server.proxy";
37
37
  readonly $services: (alepha: Alepha) => void;
@@ -1,78 +1,77 @@
1
- import * as _alepha_core0 from "@alepha/core";
2
- import { Alepha, KIND, OPTIONS } from "@alepha/core";
3
- import { DateTimeProvider, DurationLike } from "@alepha/datetime";
4
- import { ServerHandler, ServerRouterProvider } from "@alepha/server";
1
+ import { Alepha, HookDescriptor, KIND, Logger, OPTIONS } from "alepha";
2
+ import { ServerHandler, ServerRouterProvider } from "alepha/server";
3
+ import { DateTimeProvider, DurationLike } from "alepha/datetime";
5
4
 
6
5
  //#region src/descriptors/$serve.d.ts
7
6
  declare const KEY = "SERVE";
8
7
  interface ServeDescriptorOptions {
9
8
  /**
10
- * Prefix for the served path.
11
- *
12
- * @default "/"
13
- */
9
+ * Prefix for the served path.
10
+ *
11
+ * @default "/"
12
+ */
14
13
  path?: string;
15
14
  /**
16
- * Path to the directory to serve.
17
- *
18
- * @default process.cwd()
19
- */
15
+ * Path to the directory to serve.
16
+ *
17
+ * @default process.cwd()
18
+ */
20
19
  root?: string;
21
20
  /**
22
- * If true, descriptor will be ignored.
23
- *
24
- * @default false
25
- */
21
+ * If true, descriptor will be ignored.
22
+ *
23
+ * @default false
24
+ */
26
25
  disabled?: boolean;
27
26
  /**
28
- * Whether to keep dot files (e.g. `.gitignore`, `.env`) in the served directory.
29
- *
30
- * @default true
31
- */
27
+ * Whether to keep dot files (e.g. `.gitignore`, `.env`) in the served directory.
28
+ *
29
+ * @default true
30
+ */
32
31
  ignoreDotEnvFiles?: boolean;
33
32
  /**
34
- * Whether to use the index.html file when the path is a directory.
35
- *
36
- * @default true
37
- */
33
+ * Whether to use the index.html file when the path is a directory.
34
+ *
35
+ * @default true
36
+ */
38
37
  indexFallback?: boolean;
39
38
  /**
40
- * Force all requests "not found" to be served with the index.html file.
41
- * This is useful for single-page applications (SPAs) that use client-side only routing.
42
- */
39
+ * Force all requests "not found" to be served with the index.html file.
40
+ * This is useful for single-page applications (SPAs) that use client-side only routing.
41
+ */
43
42
  historyApiFallback?: boolean;
44
43
  /**
45
- * Optional name of the descriptor.
46
- * This is used for logging and debugging purposes.
47
- *
48
- * @default Key name.
49
- */
44
+ * Optional name of the descriptor.
45
+ * This is used for logging and debugging purposes.
46
+ *
47
+ * @default Key name.
48
+ */
50
49
  name?: string;
51
50
  /**
52
- * Whether to use cache control headers.
53
- *
54
- * @default {}
55
- */
51
+ * Whether to use cache control headers.
52
+ *
53
+ * @default {}
54
+ */
56
55
  cacheControl?: Partial<CacheControlOptions> | false;
57
56
  }
58
57
  interface CacheControlOptions {
59
58
  /**
60
- * Whether to use cache control headers.
61
- *
62
- * @default [.js, .css]
63
- */
59
+ * Whether to use cache control headers.
60
+ *
61
+ * @default [.js, .css]
62
+ */
64
63
  fileTypes: string[];
65
64
  /**
66
- * The maximum age of the cache in seconds.
67
- *
68
- * @default 60 * 60 * 24 * 2 // 2 days
69
- */
65
+ * The maximum age of the cache in seconds.
66
+ *
67
+ * @default 60 * 60 * 24 * 2 // 2 days
68
+ */
70
69
  maxAge: DurationLike;
71
70
  /**
72
- * Whether to use immutable cache control headers.
73
- *
74
- * @default true
75
- */
71
+ * Whether to use immutable cache control headers.
72
+ *
73
+ * @default true
74
+ */
76
75
  immutable: boolean;
77
76
  }
78
77
  interface ServeDescriptor {
@@ -90,9 +89,9 @@ 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: _alepha_core0.Logger;
92
+ protected readonly log: Logger;
94
93
  protected readonly directories: ServeDirectory[];
95
- protected readonly configure: _alepha_core0.HookDescriptor<"configure">;
94
+ protected readonly configure: HookDescriptor<"configure">;
96
95
  list(name: string): string[];
97
96
  serve(options: ServeDescriptorOptions): Promise<void>;
98
97
  createFileHandler(filepath: string, options: ServeDescriptorOptions): Promise<ServerHandler>;
@@ -108,5 +107,18 @@ interface ServeDirectory {
108
107
  files: string[];
109
108
  }
110
109
  //#endregion
111
- export { $serve, CacheControlOptions, ServeDescriptor, ServeDescriptorOptions, ServeDirectory, ServerStaticProvider };
110
+ //#region src/index.d.ts
111
+ // ---------------------------------------------------------------------------------------------------------------------
112
+ /**
113
+ * Alepha Server Static Module
114
+ *
115
+ * @see {@link ServerStaticProvider}
116
+ * @module alepha.server.static
117
+ */
118
+ declare class AlephaServerStatic {
119
+ readonly name = "alepha.server.static";
120
+ readonly $services: (alepha: Alepha) => void;
121
+ }
122
+ //#endregion
123
+ export { $serve, AlephaServerStatic, CacheControlOptions, ServeDescriptor, ServeDescriptorOptions, ServeDirectory, ServerStaticProvider };
112
124
  //# sourceMappingURL=index.d.ts.map