alepha 0.8.0 → 0.9.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 +47 -44
- package/batch.d.ts +87 -88
- package/bucket.cjs +8 -0
- package/bucket.d.ts +194 -0
- package/bucket.js +1 -0
- package/cache/redis.d.ts +14 -16
- package/cache.d.ts +101 -170
- package/command.d.ts +70 -77
- package/core.d.ts +1043 -887
- package/datetime.d.ts +91 -117
- package/file.cjs +8 -0
- package/file.d.ts +56 -0
- package/file.js +1 -0
- package/lock/redis.d.ts +11 -13
- package/lock.d.ts +125 -117
- package/package.json +66 -38
- package/postgres.d.ts +232 -275
- package/queue/redis.d.ts +13 -15
- package/queue.d.ts +88 -116
- package/react/auth.d.ts +50 -55
- package/react/head.d.ts +5 -8
- package/react.d.ts +71 -73
- package/redis.d.ts +32 -14
- package/retry.d.ts +70 -58
- package/router.cjs +8 -0
- package/router.d.ts +45 -0
- package/router.js +1 -0
- package/scheduler.d.ts +54 -96
- package/security.d.ts +117 -119
- package/server/cache.d.ts +22 -31
- package/server/compress.d.ts +16 -7
- package/server/cookies.d.ts +70 -61
- package/server/cors.d.ts +15 -13
- package/server/health.d.ts +23 -26
- package/server/helmet.d.ts +17 -20
- package/server/links.d.ts +113 -90
- package/server/metrics.d.ts +25 -23
- package/server/multipart.d.ts +12 -16
- package/server/proxy.d.ts +25 -20
- package/server/security.cjs +8 -0
- package/server/security.d.ts +90 -0
- package/server/security.js +1 -0
- package/server/static.d.ts +67 -68
- package/server/swagger.d.ts +77 -65
- package/server.d.ts +265 -308
- package/topic/redis.d.ts +25 -26
- package/topic.d.ts +76 -122
- package/vite.d.ts +52 -36
package/server/metrics.d.ts
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import * as _alepha_core0$1 from "alepha";
|
|
2
|
+
import * as _alepha_core0 from "alepha";
|
|
3
|
+
import { Alepha } from "alepha";
|
|
4
|
+
import * as _alepha_server0 from "alepha/server";
|
|
5
|
+
import { Histogram, Registry } from "prom-client";
|
|
4
6
|
|
|
5
7
|
//#region src/providers/ServerMetricsProvider.d.ts
|
|
8
|
+
declare class ServerMetricsProvider {
|
|
9
|
+
protected readonly register: Registry;
|
|
10
|
+
protected readonly alepha: Alepha;
|
|
11
|
+
protected httpRequestDuration?: Histogram<string>;
|
|
12
|
+
readonly options: ServerMetricsProviderOptions;
|
|
13
|
+
readonly metrics: _alepha_server0.RouteDescriptor<_alepha_server0.RequestConfigSchema>;
|
|
14
|
+
protected readonly onStart: _alepha_core0$1.HookDescriptor<"start">;
|
|
15
|
+
protected readonly onRequest: _alepha_core0$1.HookDescriptor<"server:onRequest">;
|
|
16
|
+
protected readonly onResponse: _alepha_core0$1.HookDescriptor<"server:onResponse">;
|
|
17
|
+
}
|
|
6
18
|
interface ServerMetricsProviderOptions {
|
|
7
19
|
prefix?: string;
|
|
8
20
|
gcDurationBuckets?: number[];
|
|
9
21
|
eventLoopMonitoringPrecision?: number;
|
|
10
22
|
labels?: object;
|
|
11
23
|
}
|
|
12
|
-
|
|
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
|
-
}
|
|
24
|
+
//# sourceMappingURL=ServerMetricsProvider.d.ts.map
|
|
19
25
|
//#endregion
|
|
20
26
|
//#region src/index.d.ts
|
|
21
|
-
// ---------------------------------------------------------------------------------------------------------------------
|
|
22
27
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
readonly name = "alepha.server.metrics";
|
|
33
|
-
readonly $services: (alepha: Alepha) => void;
|
|
34
|
-
}
|
|
28
|
+
* This module provides prometheus metrics for the Alepha server.
|
|
29
|
+
* Metrics are exposed at the `/metrics` endpoint.
|
|
30
|
+
*
|
|
31
|
+
* @see {@link ServerMetricsProvider}
|
|
32
|
+
* @module alepha.server.metrics
|
|
33
|
+
*/
|
|
34
|
+
declare const AlephaServerMetrics: _alepha_core0.ModuleDescriptor;
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
36
|
+
|
|
35
37
|
//#endregion
|
|
36
38
|
export { AlephaServerMetrics, ServerMetricsProvider, ServerMetricsProviderOptions };
|
|
37
39
|
//# sourceMappingURL=index.d.ts.map
|
package/server/multipart.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Alepha, FileLike, HookDescriptor
|
|
1
|
+
import * as _alepha_core0 from "alepha";
|
|
2
|
+
import { Alepha, FileLike, HookDescriptor } from "alepha";
|
|
3
|
+
import { ServerRoute } from "alepha/server";
|
|
3
4
|
import { BusboyConfig } from "@fastify/busboy";
|
|
4
5
|
import { IncomingMessage } from "node:http";
|
|
5
6
|
|
|
6
7
|
//#region src/providers/ServerMultipartProvider.d.ts
|
|
7
8
|
declare class ServerMultipartProvider {
|
|
8
|
-
protected readonly helper: ActionDescriptorHelper;
|
|
9
9
|
protected readonly alepha: Alepha;
|
|
10
10
|
readonly onRequest: HookDescriptor<"server:onRequest">;
|
|
11
11
|
readonly onSend: HookDescriptor<"server:onResponse">;
|
|
@@ -29,20 +29,16 @@ interface HybridFile extends FileLike {
|
|
|
29
29
|
}
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/index.d.ts
|
|
32
|
-
// ---------------------------------------------------------------------------------------------------------------------
|
|
33
32
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
readonly name = "alepha.server.multipart";
|
|
44
|
-
readonly $services: (alepha: Alepha) => void;
|
|
45
|
-
}
|
|
33
|
+
* This module provides support for handling multipart/form-data requests.
|
|
34
|
+
* It allows to parse body data containing t.file().
|
|
35
|
+
*
|
|
36
|
+
* @see {@link ServerMultipartProvider}
|
|
37
|
+
* @module alepha.server.multipart
|
|
38
|
+
*/
|
|
39
|
+
declare const AlephaServerMultipart: _alepha_core0.ModuleDescriptor;
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
41
|
+
|
|
46
42
|
//#endregion
|
|
47
43
|
export { AlephaServerMultipart, ServerMultipartProvider };
|
|
48
44
|
//# sourceMappingURL=index.d.ts.map
|
package/server/proxy.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _alepha_core0$1 from "alepha";
|
|
2
|
+
import * as _alepha_core0 from "alepha";
|
|
3
|
+
import { Alepha, Async, Descriptor, KIND } from "alepha";
|
|
2
4
|
import { ServerHandler, ServerRequest, ServerRouterProvider } from "alepha/server";
|
|
3
5
|
|
|
4
6
|
//#region src/descriptors/$proxy.d.ts
|
|
7
|
+
declare const $proxy: {
|
|
8
|
+
(options: ProxyDescriptorOptions): ProxyDescriptor;
|
|
9
|
+
[KIND]: typeof ProxyDescriptor;
|
|
10
|
+
};
|
|
5
11
|
type ProxyDescriptorOptions = {
|
|
6
12
|
path: string;
|
|
7
13
|
target: string | (() => string);
|
|
@@ -10,32 +16,31 @@ type ProxyDescriptorOptions = {
|
|
|
10
16
|
afterResponse?: (request: ServerRequest, proxyResponse: Response) => Async<void>;
|
|
11
17
|
rewrite?: (url: URL) => void;
|
|
12
18
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
[OPTIONS]: ProxyDescriptorOptions;
|
|
16
|
-
}
|
|
17
|
-
declare const $proxy: {
|
|
18
|
-
(options: ProxyDescriptorOptions): ProxyDescriptor;
|
|
19
|
-
[KIND]: string;
|
|
20
|
-
};
|
|
19
|
+
declare class ProxyDescriptor extends Descriptor<ProxyDescriptorOptions> {}
|
|
20
|
+
//# sourceMappingURL=$proxy.d.ts.map
|
|
21
21
|
//#endregion
|
|
22
|
-
//#region src/providers/
|
|
23
|
-
declare class
|
|
24
|
-
protected readonly log: Logger;
|
|
22
|
+
//#region src/providers/ServerProxyProvider.d.ts
|
|
23
|
+
declare class ServerProxyProvider {
|
|
24
|
+
protected readonly log: _alepha_core0$1.Logger;
|
|
25
25
|
protected readonly routerProvider: ServerRouterProvider;
|
|
26
26
|
protected readonly alepha: Alepha;
|
|
27
|
-
readonly configure: HookDescriptor<"configure">;
|
|
27
|
+
protected readonly configure: _alepha_core0$1.HookDescriptor<"configure">;
|
|
28
|
+
createProxy(options: ProxyDescriptorOptions): void;
|
|
28
29
|
createProxyHandler(target: string, options: Omit<ProxyDescriptorOptions, "path">): ServerHandler;
|
|
29
|
-
proxy(options: ProxyDescriptorOptions): Promise<void>;
|
|
30
30
|
private getRawRequestBody;
|
|
31
31
|
}
|
|
32
|
+
//# sourceMappingURL=ServerProxyProvider.d.ts.map
|
|
32
33
|
//#endregion
|
|
33
34
|
//#region src/index.d.ts
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Plugin for Alepha that provides a proxy server functionality.
|
|
37
|
+
*
|
|
38
|
+
* @see {@link $proxy}
|
|
39
|
+
* @module alepha.server.proxy
|
|
40
|
+
*/
|
|
41
|
+
declare const AlephaServerProxy: _alepha_core0.ModuleDescriptor;
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
43
|
+
|
|
39
44
|
//#endregion
|
|
40
|
-
export { $proxy, AlephaServerProxy, ProxyDescriptor, ProxyDescriptorOptions,
|
|
45
|
+
export { $proxy, AlephaServerProxy, ProxyDescriptor, ProxyDescriptorOptions, ServerProxyProvider };
|
|
41
46
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var m = require('@alepha/server-security');
|
|
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,90 @@
|
|
|
1
|
+
import * as _alepha_core0$1 from "alepha";
|
|
2
|
+
import * as _alepha_core0 from "alepha";
|
|
3
|
+
import { Alepha } from "alepha";
|
|
4
|
+
import { JwtProvider, Permission, SecurityProvider, UserAccountToken } from "alepha/security";
|
|
5
|
+
import { FetchOptions } from "alepha/server";
|
|
6
|
+
|
|
7
|
+
//#region src/providers/ServerSecurityProvider.d.ts
|
|
8
|
+
declare class ServerSecurityProvider {
|
|
9
|
+
protected readonly log: _alepha_core0$1.Logger;
|
|
10
|
+
protected readonly securityProvider: SecurityProvider;
|
|
11
|
+
protected readonly jwtProvider: JwtProvider;
|
|
12
|
+
protected readonly alepha: Alepha;
|
|
13
|
+
protected readonly onConfigure: _alepha_core0$1.HookDescriptor<"configure">;
|
|
14
|
+
protected readonly onActionRequest: _alepha_core0$1.HookDescriptor<"action:onRequest">;
|
|
15
|
+
protected readonly onRequest: _alepha_core0$1.HookDescriptor<"server:onRequest">;
|
|
16
|
+
/**
|
|
17
|
+
* Get the user account token for a local action call.
|
|
18
|
+
* There are three possible sources for the user:
|
|
19
|
+
* - `options.user`: the user passed in the options
|
|
20
|
+
* - `"system"`: the system user from the state (you MUST set state `server.security.system.user`)
|
|
21
|
+
* - `"context"`: the user from the request context (you MUST be in an HTTP request context)
|
|
22
|
+
*
|
|
23
|
+
* Priority order: `options.user` > `"system"` > `"context"`.
|
|
24
|
+
*
|
|
25
|
+
* In testing environment, if no user is provided, a test user is created based on the SecurityProvider's roles.
|
|
26
|
+
*/
|
|
27
|
+
protected createUserFromLocalFunctionContext(options: {
|
|
28
|
+
user?: UserAccountToken | "system" | "context";
|
|
29
|
+
}, permission?: Permission): UserAccountToken;
|
|
30
|
+
protected createTestUser(): UserAccountToken;
|
|
31
|
+
protected readonly onClientRequest: _alepha_core0$1.HookDescriptor<"client:onRequest">;
|
|
32
|
+
}
|
|
33
|
+
type ServerRouteSecure = boolean | {
|
|
34
|
+
permissions?: string[];
|
|
35
|
+
roles?: string[];
|
|
36
|
+
realms?: string[];
|
|
37
|
+
organizations?: string[];
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=ServerSecurityProvider.d.ts.map
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/index.d.ts
|
|
42
|
+
declare module "alepha" {
|
|
43
|
+
interface State {
|
|
44
|
+
/**
|
|
45
|
+
* Real (or fake) user account, used for internal actions.
|
|
46
|
+
*
|
|
47
|
+
* If you define this, you assume that all actions are executed by this user by default.
|
|
48
|
+
* > To force a different user, you need to pass it explicitly in the options.
|
|
49
|
+
*/
|
|
50
|
+
"server.security.system.user"?: UserAccountToken;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
declare module "alepha/server" {
|
|
54
|
+
interface ServerRequest<TConfig> {
|
|
55
|
+
user?: UserAccountToken;
|
|
56
|
+
}
|
|
57
|
+
interface ServerActionRequest<TConfig> {
|
|
58
|
+
user: UserAccountToken;
|
|
59
|
+
}
|
|
60
|
+
interface ServerRoute {
|
|
61
|
+
/**
|
|
62
|
+
* If true, the route will be protected by the security provider.
|
|
63
|
+
* All actions are secure by default, but you can disable it for specific actions.
|
|
64
|
+
*/
|
|
65
|
+
secure?: boolean;
|
|
66
|
+
}
|
|
67
|
+
interface ClientRequestOptions extends FetchOptions {
|
|
68
|
+
/**
|
|
69
|
+
* Forward user from the previous request.
|
|
70
|
+
* If "system", use system user. @see {ServerSecurityProvider.localSystemUser}
|
|
71
|
+
* If "context", use the user from the current context (e.g. request).
|
|
72
|
+
*
|
|
73
|
+
* @default "system" is provided, else "context" is used.
|
|
74
|
+
*/
|
|
75
|
+
user?: UserAccountToken | "system" | "context";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Plugin for Alepha Server that provides security features. Based on the Alepha Security module.
|
|
80
|
+
*
|
|
81
|
+
* By default, all $action will be guarded by a permission check.
|
|
82
|
+
*
|
|
83
|
+
* @see {@link ServerSecurityProvider}
|
|
84
|
+
* @module alepha.server.security
|
|
85
|
+
*/
|
|
86
|
+
declare const AlephaServerSecurity: _alepha_core0.ModuleDescriptor;
|
|
87
|
+
//# sourceMappingURL=index.d.ts.map
|
|
88
|
+
//#endregion
|
|
89
|
+
export { AlephaServerSecurity, ServerRouteSecure, ServerSecurityProvider };
|
|
90
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@alepha/server-security'
|
package/server/static.d.ts
CHANGED
|
@@ -1,88 +1,89 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _alepha_core0$1 from "alepha";
|
|
2
|
+
import * as _alepha_core0 from "alepha";
|
|
3
|
+
import { Alepha, Descriptor, KIND, Logger } from "alepha";
|
|
2
4
|
import { ServerHandler, ServerRouterProvider } from "alepha/server";
|
|
3
5
|
import { DateTimeProvider, DurationLike } from "alepha/datetime";
|
|
4
6
|
|
|
5
7
|
//#region src/descriptors/$serve.d.ts
|
|
6
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Create a new static file handler.
|
|
10
|
+
*/
|
|
11
|
+
declare const $serve: {
|
|
12
|
+
(options?: ServeDescriptorOptions): ServeDescriptor;
|
|
13
|
+
[KIND]: typeof ServeDescriptor;
|
|
14
|
+
};
|
|
7
15
|
interface ServeDescriptorOptions {
|
|
8
16
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
* Prefix for the served path.
|
|
18
|
+
*
|
|
19
|
+
* @default "/"
|
|
20
|
+
*/
|
|
13
21
|
path?: string;
|
|
14
22
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
* Path to the directory to serve.
|
|
24
|
+
*
|
|
25
|
+
* @default process.cwd()
|
|
26
|
+
*/
|
|
19
27
|
root?: string;
|
|
20
28
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
* If true, descriptor will be ignored.
|
|
30
|
+
*
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
25
33
|
disabled?: boolean;
|
|
26
34
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
* Whether to keep dot files (e.g. `.gitignore`, `.env`) in the served directory.
|
|
36
|
+
*
|
|
37
|
+
* @default true
|
|
38
|
+
*/
|
|
31
39
|
ignoreDotEnvFiles?: boolean;
|
|
32
40
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
* Whether to use the index.html file when the path is a directory.
|
|
42
|
+
*
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
37
45
|
indexFallback?: boolean;
|
|
38
46
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
* Force all requests "not found" to be served with the index.html file.
|
|
48
|
+
* This is useful for single-page applications (SPAs) that use client-side only routing.
|
|
49
|
+
*/
|
|
42
50
|
historyApiFallback?: boolean;
|
|
43
51
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
* Optional name of the descriptor.
|
|
53
|
+
* This is used for logging and debugging purposes.
|
|
54
|
+
*
|
|
55
|
+
* @default Key name.
|
|
56
|
+
*/
|
|
49
57
|
name?: string;
|
|
50
58
|
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
* Whether to use cache control headers.
|
|
60
|
+
*
|
|
61
|
+
* @default {}
|
|
62
|
+
*/
|
|
55
63
|
cacheControl?: Partial<CacheControlOptions> | false;
|
|
56
64
|
}
|
|
57
65
|
interface CacheControlOptions {
|
|
58
66
|
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
* Whether to use cache control headers.
|
|
68
|
+
*
|
|
69
|
+
* @default [.js, .css]
|
|
70
|
+
*/
|
|
63
71
|
fileTypes: string[];
|
|
64
72
|
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
* The maximum age of the cache in seconds.
|
|
74
|
+
*
|
|
75
|
+
* @default 60 * 60 * 24 * 2 // 2 days
|
|
76
|
+
*/
|
|
69
77
|
maxAge: DurationLike;
|
|
70
78
|
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
79
|
+
* Whether to use immutable cache control headers.
|
|
80
|
+
*
|
|
81
|
+
* @default true
|
|
82
|
+
*/
|
|
75
83
|
immutable: boolean;
|
|
76
84
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
[OPTIONS]: ServeDescriptorOptions;
|
|
80
|
-
list(): string[];
|
|
81
|
-
}
|
|
82
|
-
declare const $serve: {
|
|
83
|
-
(options?: ServeDescriptorOptions): ServeDescriptor;
|
|
84
|
-
[KIND]: string;
|
|
85
|
-
};
|
|
85
|
+
declare class ServeDescriptor extends Descriptor<ServeDescriptorOptions> {}
|
|
86
|
+
//# sourceMappingURL=$serve.d.ts.map
|
|
86
87
|
//#endregion
|
|
87
88
|
//#region src/providers/ServerStaticProvider.d.ts
|
|
88
89
|
declare class ServerStaticProvider {
|
|
@@ -91,9 +92,8 @@ declare class ServerStaticProvider {
|
|
|
91
92
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
92
93
|
protected readonly log: Logger;
|
|
93
94
|
protected readonly directories: ServeDirectory[];
|
|
94
|
-
protected readonly configure: HookDescriptor<"configure">;
|
|
95
|
-
|
|
96
|
-
serve(options: ServeDescriptorOptions): Promise<void>;
|
|
95
|
+
protected readonly configure: _alepha_core0$1.HookDescriptor<"configure">;
|
|
96
|
+
createStaticServer(options: ServeDescriptorOptions): Promise<void>;
|
|
97
97
|
createFileHandler(filepath: string, options: ServeDescriptorOptions): Promise<ServerHandler>;
|
|
98
98
|
protected getCacheFileTypes(): string[];
|
|
99
99
|
protected getCacheControl(filename: string, options: ServeDescriptorOptions): {
|
|
@@ -106,19 +106,18 @@ interface ServeDirectory {
|
|
|
106
106
|
options: ServeDescriptorOptions;
|
|
107
107
|
files: string[];
|
|
108
108
|
}
|
|
109
|
+
//# sourceMappingURL=ServerStaticProvider.d.ts.map
|
|
109
110
|
//#endregion
|
|
110
111
|
//#region src/index.d.ts
|
|
111
|
-
// ---------------------------------------------------------------------------------------------------------------------
|
|
112
112
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* @see {@link ServerStaticProvider}
|
|
116
|
-
* @module alepha.server.static
|
|
117
|
-
*/
|
|
118
|
-
declare
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
113
|
+
* Create static file server with `$static()`.
|
|
114
|
+
*
|
|
115
|
+
* @see {@link ServerStaticProvider}
|
|
116
|
+
* @module alepha.server.static
|
|
117
|
+
*/
|
|
118
|
+
declare const AlephaServerStatic: _alepha_core0.ModuleDescriptor;
|
|
119
|
+
//# sourceMappingURL=index.d.ts.map
|
|
120
|
+
|
|
122
121
|
//#endregion
|
|
123
122
|
export { $serve, AlephaServerStatic, CacheControlOptions, ServeDescriptor, ServeDescriptorOptions, ServeDirectory, ServerStaticProvider };
|
|
124
123
|
//# sourceMappingURL=index.d.ts.map
|
package/server/swagger.d.ts
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import * as _alepha_core0$1 from "alepha";
|
|
2
|
+
import * as _alepha_core0 from "alepha";
|
|
3
|
+
import { Alepha, Descriptor, KIND, TObject } from "alepha";
|
|
4
|
+
import { ActionDescriptor, RequestConfigSchema, ServerRouterProvider } from "alepha/server";
|
|
3
5
|
import { ServerStaticProvider } from "alepha/server/static";
|
|
4
6
|
import { OpenAPIV3 } from "openapi-types";
|
|
5
7
|
|
|
6
8
|
//#region src/descriptors/$swagger.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Create a new OpenAPI.
|
|
11
|
+
*/
|
|
12
|
+
declare const $swagger: {
|
|
13
|
+
(options: SwaggerDescriptorOptions): SwaggerDescriptor;
|
|
14
|
+
[KIND]: typeof SwaggerDescriptor;
|
|
15
|
+
};
|
|
7
16
|
interface SwaggerDescriptorOptions {
|
|
8
17
|
info: OpenAPIV3.InfoObject;
|
|
9
18
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
19
|
+
* @default: "/docs"
|
|
20
|
+
*/
|
|
12
21
|
prefix?: string;
|
|
13
22
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
23
|
+
* If true, docs will be disabled.
|
|
24
|
+
*/
|
|
16
25
|
disabled?: boolean;
|
|
17
26
|
excludeTags?: string[];
|
|
18
27
|
ui?: boolean | SwaggerUiOptions;
|
|
@@ -22,101 +31,104 @@ interface SwaggerUiOptions {
|
|
|
22
31
|
root?: string;
|
|
23
32
|
initOAuth?: {
|
|
24
33
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
* Default clientId.
|
|
35
|
+
*/
|
|
27
36
|
clientId?: string;
|
|
28
37
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
38
|
+
* realm query parameter (for oauth1) added to authorizationUrl and tokenUrl.
|
|
39
|
+
*/
|
|
31
40
|
realm?: string;
|
|
32
41
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
* application name, displayed in authorization popup.
|
|
43
|
+
*/
|
|
35
44
|
appName?: string;
|
|
36
45
|
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
* scope separator for passing scopes, encoded before calling, default
|
|
47
|
+
* value is a space (encoded value %20).
|
|
48
|
+
*
|
|
49
|
+
* @default ' '
|
|
50
|
+
*/
|
|
42
51
|
scopeSeparator?: string;
|
|
43
52
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
* string array or scope separator (i.e. space) separated string of
|
|
54
|
+
* initially selected oauth scopes
|
|
55
|
+
*
|
|
56
|
+
* @default []
|
|
57
|
+
*/
|
|
49
58
|
scopes?: string | string[];
|
|
50
59
|
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
* Additional query parameters added to authorizationUrl and tokenUrl.
|
|
61
|
+
* MUST be an object
|
|
62
|
+
*/
|
|
54
63
|
additionalQueryStringParams?: {
|
|
55
64
|
[key: string]: any;
|
|
56
65
|
};
|
|
57
66
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
* Only activated for the accessCode flow. During the authorization_code
|
|
68
|
+
* request to the tokenUrl, pass the Client Password using the HTTP Basic
|
|
69
|
+
* Authentication scheme (Authorization header with Basic
|
|
70
|
+
* base64encode(client_id + client_secret)).
|
|
71
|
+
*
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
65
74
|
useBasicAuthenticationWithAccessCodeGrant?: boolean;
|
|
66
75
|
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
76
|
+
* Only applies to Authorization Code flows. Proof Key for Code Exchange
|
|
77
|
+
* brings enhanced security for OAuth public clients.
|
|
78
|
+
*
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
72
81
|
usePkceWithAuthorizationCodeGrant?: boolean;
|
|
73
82
|
};
|
|
74
83
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
[OPTIONS]: SwaggerDescriptorOptions;
|
|
78
|
-
json(): OpenAPIV3.Document;
|
|
79
|
-
}
|
|
80
|
-
declare const $swagger: {
|
|
81
|
-
(options: SwaggerDescriptorOptions): SwaggerDescriptor;
|
|
82
|
-
[KIND]: string;
|
|
83
|
-
};
|
|
84
|
+
declare class SwaggerDescriptor extends Descriptor<SwaggerDescriptorOptions> {}
|
|
85
|
+
//# sourceMappingURL=$swagger.d.ts.map
|
|
84
86
|
//#endregion
|
|
85
87
|
//#region src/ServerSwaggerProvider.d.ts
|
|
86
88
|
declare class ServerSwaggerProvider {
|
|
87
|
-
protected readonly serverActionProvider: ServerActionDescriptorProvider;
|
|
88
89
|
protected readonly serverStaticProvider: ServerStaticProvider;
|
|
89
90
|
protected readonly serverRouterProvider: ServerRouterProvider;
|
|
90
91
|
protected readonly alepha: Alepha;
|
|
91
|
-
|
|
92
|
-
protected
|
|
92
|
+
json?: OpenAPIV3.Document;
|
|
93
|
+
protected readonly configure: _alepha_core0$1.HookDescriptor<"configure">;
|
|
94
|
+
createSwagger(options: SwaggerDescriptorOptions): Promise<OpenAPIV3.Document | undefined>;
|
|
95
|
+
protected configureOpenApi(actions: ActionDescriptor<RequestConfigSchema>[], doc: SwaggerDescriptorOptions): OpenAPIV3.Document;
|
|
93
96
|
isBodyMultipart(schema: TObject): boolean;
|
|
94
97
|
replacePathParams(url: string): string;
|
|
95
|
-
getResponseSchema(route:
|
|
98
|
+
getResponseSchema(route: ActionDescriptor<RequestConfigSchema>): {
|
|
96
99
|
type?: string;
|
|
97
100
|
schema?: any;
|
|
98
101
|
status: number;
|
|
99
102
|
} | undefined;
|
|
100
|
-
protected configureSwaggerApi(prefix: string, json: OpenAPIV3.Document):
|
|
103
|
+
protected configureSwaggerApi(prefix: string, json: OpenAPIV3.Document): void;
|
|
101
104
|
protected configureSwaggerUi(prefix: string, options: SwaggerDescriptorOptions): Promise<void>;
|
|
102
105
|
}
|
|
106
|
+
//# sourceMappingURL=ServerSwaggerProvider.d.ts.map
|
|
103
107
|
//#endregion
|
|
104
108
|
//#region src/index.d.ts
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
*
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
*
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
declare class AlephaServerSwagger implements Module {
|
|
117
|
-
readonly name = "alepha.server.swagger";
|
|
118
|
-
readonly $services: (alepha: Alepha) => Alepha;
|
|
109
|
+
declare module "alepha/server" {
|
|
110
|
+
interface ActionDescriptorOptions<TConfig extends RequestConfigSchema> {
|
|
111
|
+
/**
|
|
112
|
+
* Short description of the route.
|
|
113
|
+
*/
|
|
114
|
+
summary?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Don't include this action in the Swagger documentation.
|
|
117
|
+
*/
|
|
118
|
+
hide?: boolean;
|
|
119
|
+
}
|
|
119
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Plugin for Alepha Server that provides Swagger documentation capabilities.
|
|
123
|
+
* It generates OpenAPI v3 documentation for the server's endpoints ($action).
|
|
124
|
+
* It also provides a Swagger UI for interactive API documentation.
|
|
125
|
+
*
|
|
126
|
+
* @see {@link ServerSwaggerProvider}
|
|
127
|
+
* @module alepha.server.swagger
|
|
128
|
+
*/
|
|
129
|
+
declare const AlephaServerSwagger: _alepha_core0.ModuleDescriptor;
|
|
130
|
+
//# sourceMappingURL=index.d.ts.map
|
|
131
|
+
|
|
120
132
|
//#endregion
|
|
121
133
|
export { $swagger, AlephaServerSwagger, ServerSwaggerProvider, SwaggerDescriptor, SwaggerDescriptorOptions, SwaggerUiOptions };
|
|
122
134
|
//# sourceMappingURL=index.d.ts.map
|