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.
Files changed (59) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +44 -44
  3. package/batch.cjs +8 -0
  4. package/batch.d.ts +114 -0
  5. package/batch.js +1 -0
  6. package/cache/redis.d.ts +15 -18
  7. package/cache.d.ts +115 -119
  8. package/command.cjs +8 -0
  9. package/command.d.ts +154 -0
  10. package/command.js +1 -0
  11. package/core.d.ts +800 -795
  12. package/datetime.d.ts +76 -76
  13. package/lock/redis.d.ts +12 -12
  14. package/lock.d.ts +70 -75
  15. package/package.json +102 -29
  16. package/postgres.d.ts +385 -278
  17. package/queue/redis.d.ts +15 -13
  18. package/queue.d.ts +16 -13
  19. package/react/auth.d.ts +16 -16
  20. package/react/head.cjs +8 -0
  21. package/react/head.d.ts +92 -0
  22. package/react/head.js +1 -0
  23. package/react.d.ts +90 -116
  24. package/redis.d.ts +20 -27
  25. package/retry.d.ts +74 -54
  26. package/scheduler.d.ts +14 -13
  27. package/security.d.ts +38 -41
  28. package/server/cache.d.ts +9 -7
  29. package/server/compress.cjs +8 -0
  30. package/server/compress.d.ts +26 -0
  31. package/server/compress.js +1 -0
  32. package/server/cookies.d.ts +71 -14
  33. package/server/cors.cjs +8 -0
  34. package/server/cors.d.ts +29 -0
  35. package/server/cors.js +1 -0
  36. package/server/health.cjs +8 -0
  37. package/server/health.d.ts +42 -0
  38. package/server/health.js +1 -0
  39. package/server/helmet.cjs +8 -0
  40. package/server/helmet.d.ts +72 -0
  41. package/server/helmet.js +1 -0
  42. package/server/links.cjs +8 -0
  43. package/server/links.d.ts +179 -0
  44. package/server/links.js +1 -0
  45. package/server/metrics.cjs +8 -0
  46. package/server/metrics.d.ts +37 -0
  47. package/server/metrics.js +1 -0
  48. package/server/multipart.cjs +8 -0
  49. package/server/multipart.d.ts +48 -0
  50. package/server/multipart.js +1 -0
  51. package/server/proxy.cjs +8 -0
  52. package/server/proxy.d.ts +41 -0
  53. package/server/proxy.js +1 -0
  54. package/server/static.d.ts +63 -51
  55. package/server/swagger.d.ts +50 -50
  56. package/server.d.ts +220 -437
  57. package/topic/redis.d.ts +24 -23
  58. package/topic.d.ts +9 -19
  59. package/vite.d.ts +8 -1
@@ -0,0 +1,179 @@
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";
6
+
7
+ //#region src/providers/LinkProvider.d.ts
8
+ declare class LinkProvider {
9
+ readonly URL_LINKS = "/api/_links";
10
+ protected readonly log: Logger;
11
+ protected readonly alepha: Alepha;
12
+ protected readonly httpClient: HttpClient;
13
+ links?: Array<HttpClientLink>;
14
+ pushLink(link: HttpClientLink): void;
15
+ getLinks(force?: boolean): Promise<HttpClientLink[]>;
16
+ client<T extends object>(scope?: ClientScope): HttpVirtualClient<T>;
17
+ /**
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
+ */
22
+ follow(name: string, config?: Partial<ServerRequestConfigEntry>, options?: ClientRequestOptions & ClientScope): Promise<any>;
23
+ protected followRemote(link: HttpClientLink, config?: Partial<ServerRequestConfigEntry>, options?: ClientRequestOptions): Promise<FetchResponse>;
24
+ can(name: string): boolean;
25
+ protected getLinkByName(name: string, options?: ClientScope): Promise<HttpClientLink>;
26
+ }
27
+ // ---------------------------------------------------------------------------------------------------------------------
28
+ interface HttpClientLink extends ApiLink {
29
+ secured?: boolean;
30
+ prefix?: string;
31
+ // -- server only --
32
+ // only for remote actions
33
+ host?: string;
34
+ service?: string;
35
+ // used only for local actions, not for remote actions
36
+ schema?: RequestConfigSchema;
37
+ handler?: ServerHandler;
38
+ }
39
+ interface ClientScope {
40
+ group?: string;
41
+ service?: string;
42
+ }
43
+ type HttpVirtualClient<T> = { [K in keyof T as T[K] extends ActionDescriptor ? K : never]: T[K] extends ActionDescriptor<infer Schema> ? T[K] & {
44
+ can: () => boolean;
45
+ schema: Schema;
46
+ } : never };
47
+ //#endregion
48
+ //#region src/descriptors/$client.d.ts
49
+ declare const $client: <T extends object>(scope?: ClientScope) => HttpVirtualClient<T>;
50
+ //#endregion
51
+ //#region src/descriptors/$remote.d.ts
52
+ declare const KEY = "REMOTE";
53
+ interface RemoteDescriptorOptions {
54
+ /**
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
+ */
74
+ url: string | (() => string);
75
+ /**
76
+ * The name of the remote service.
77
+ *
78
+ * @default Member of the class containing the remote service.
79
+ */
80
+ name?: string;
81
+ /**
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
+ */
85
+ proxy?: boolean | Partial<ProxyDescriptorOptions & {
86
+ /**
87
+ * If true, the remote service won't be available internally, only through the proxy.
88
+ */
89
+ noInternal: boolean;
90
+ }>;
91
+ /**
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
+ */
95
+ serviceAccount?: ServiceAccountDescriptor;
96
+ }
97
+ interface RemoteDescriptor {
98
+ [KIND]: typeof KEY;
99
+ [OPTIONS]: RemoteDescriptorOptions;
100
+ }
101
+ /**
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
+ */
110
+ declare const $remote: {
111
+ (options: RemoteDescriptorOptions): RemoteDescriptor;
112
+ [KIND]: string;
113
+ };
114
+ //#endregion
115
+ //#region src/providers/RemoteDescriptorProvider.d.ts
116
+ declare class RemoteDescriptorProvider {
117
+ static path: {
118
+ apiLinks: string;
119
+ };
120
+ protected readonly alepha: Alepha;
121
+ protected readonly client: LinkProvider;
122
+ protected readonly proxyProvider: ProxyDescriptorProvider;
123
+ protected readonly remotes: Array<ServerRemote>;
124
+ protected readonly log: Logger;
125
+ getRemotes(): ServerRemote[];
126
+ readonly configure: HookDescriptor<"configure">;
127
+ readonly start: HookDescriptor<"start">;
128
+ registerRemote(value: RemoteDescriptor, key: string): Promise<void>;
129
+ protected readonly fetchLinks: RetryDescriptor<(opts: FetchLinksOptions) => Promise<ApiLinksResponse>>;
130
+ }
131
+ interface FetchLinksOptions {
132
+ service: string;
133
+ url: string;
134
+ authorization?: string;
135
+ }
136
+ //#endregion
137
+ //#region src/providers/ServerLinksProvider.d.ts
138
+ declare class ServerLinksProvider {
139
+ protected readonly alepha: Alepha;
140
+ protected readonly client: LinkProvider;
141
+ protected readonly helper: ActionDescriptorHelper;
142
+ protected readonly remoteProvider: RemoteDescriptorProvider;
143
+ protected readonly serverActionDescriptorProvider: ServerActionDescriptorProvider;
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>;
155
+ }>>;
156
+ }>;
157
+ }>;
158
+ readonly schema: RouteDescriptor<{
159
+ params: TObject<{
160
+ name: TString;
161
+ }>;
162
+ response: TRecord<TString, TAny>;
163
+ }>;
164
+ getLinks(options: GetLinksOptions): Promise<ApiLinksResponse>;
165
+ }
166
+ interface GetLinksOptions {
167
+ user?: UserAccountToken;
168
+ authorization?: string;
169
+ }
170
+ //#endregion
171
+ //#region src/index.d.ts
172
+ // ---------------------------------------------------------------------------------------------------------------------
173
+ declare class AlephaServerLinks implements Module {
174
+ readonly name = "alepha.server.links";
175
+ readonly $services: (alepha: Alepha) => void;
176
+ }
177
+ //#endregion
178
+ export { $client, $remote, AlephaServerLinks, ClientScope, FetchLinksOptions, GetLinksOptions, HttpClientLink, HttpVirtualClient, LinkProvider, RemoteDescriptor, RemoteDescriptorOptions, RemoteDescriptorProvider, ServerLinksProvider };
179
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ export * from '@alepha/server-links'
@@ -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'
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ var m = require('@alepha/server-proxy');
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,41 @@
1
+ import { Alepha, Async, HookDescriptor, KIND, Logger, Module, OPTIONS } from "alepha";
2
+ import { ServerHandler, ServerRequest, ServerRouterProvider } from "alepha/server";
3
+
4
+ //#region src/descriptors/$proxy.d.ts
5
+ type ProxyDescriptorOptions = {
6
+ path: string;
7
+ target: string | (() => string);
8
+ disabled?: boolean;
9
+ beforeRequest?: (request: ServerRequest, proxyRequest: RequestInit) => Async<void>;
10
+ afterResponse?: (request: ServerRequest, proxyResponse: Response) => Async<void>;
11
+ rewrite?: (url: URL) => void;
12
+ };
13
+ interface ProxyDescriptor {
14
+ [KIND]: "PROXY";
15
+ [OPTIONS]: ProxyDescriptorOptions;
16
+ }
17
+ declare const $proxy: {
18
+ (options: ProxyDescriptorOptions): ProxyDescriptor;
19
+ [KIND]: string;
20
+ };
21
+ //#endregion
22
+ //#region src/providers/ProxyDescriptorProvider.d.ts
23
+ declare class ProxyDescriptorProvider {
24
+ protected readonly log: Logger;
25
+ protected readonly routerProvider: ServerRouterProvider;
26
+ protected readonly alepha: Alepha;
27
+ readonly configure: HookDescriptor<"configure">;
28
+ createProxyHandler(target: string, options: Omit<ProxyDescriptorOptions, "path">): ServerHandler;
29
+ proxy(options: ProxyDescriptorOptions): Promise<void>;
30
+ private getRawRequestBody;
31
+ }
32
+ //#endregion
33
+ //#region src/index.d.ts
34
+ // ---------------------------------------------------------------------------------------------------------------------
35
+ declare class AlephaServerProxy implements Module {
36
+ readonly name = "alepha.server.proxy";
37
+ readonly $services: (alepha: Alepha) => void;
38
+ }
39
+ //#endregion
40
+ export { $proxy, AlephaServerProxy, ProxyDescriptor, ProxyDescriptorOptions, ProxyDescriptorProvider };
41
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ export * from '@alepha/server-proxy'
@@ -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
@@ -1,19 +1,18 @@
1
- import * as _alepha_core0 from "@alepha/core";
2
- import { Alepha, KIND, Module, OPTIONS, TObject } from "@alepha/core";
3
- import { ServerActionDescriptorProvider, ServerRouteAction, ServerRouterProvider } from "@alepha/server";
4
- import { ServerStaticProvider } from "@alepha/server-static";
1
+ import { Alepha, HookDescriptor, KIND, Module, OPTIONS, TObject } from "alepha";
2
+ import { ServerActionDescriptorProvider, ServerRouteAction, ServerRouterProvider } from "alepha/server";
3
+ import { ServerStaticProvider } from "alepha/server/static";
5
4
  import { OpenAPIV3 } from "openapi-types";
6
5
 
7
6
  //#region src/descriptors/$swagger.d.ts
8
7
  interface SwaggerDescriptorOptions {
9
8
  info: OpenAPIV3.InfoObject;
10
9
  /**
11
- * @default: "/docs"
12
- */
10
+ * @default: "/docs"
11
+ */
13
12
  prefix?: string;
14
13
  /**
15
- * If true, docs will be disabled.
16
- */
14
+ * If true, docs will be disabled.
15
+ */
17
16
  disabled?: boolean;
18
17
  excludeTags?: string[];
19
18
  ui?: boolean | SwaggerUiOptions;
@@ -23,53 +22,53 @@ interface SwaggerUiOptions {
23
22
  root?: string;
24
23
  initOAuth?: {
25
24
  /**
26
- * Default clientId.
27
- */
25
+ * Default clientId.
26
+ */
28
27
  clientId?: string;
29
28
  /**
30
- * realm query parameter (for oauth1) added to authorizationUrl and tokenUrl.
31
- */
29
+ * realm query parameter (for oauth1) added to authorizationUrl and tokenUrl.
30
+ */
32
31
  realm?: string;
33
32
  /**
34
- * application name, displayed in authorization popup.
35
- */
33
+ * application name, displayed in authorization popup.
34
+ */
36
35
  appName?: string;
37
36
  /**
38
- * scope separator for passing scopes, encoded before calling, default
39
- * value is a space (encoded value %20).
40
- *
41
- * @default ' '
42
- */
37
+ * scope separator for passing scopes, encoded before calling, default
38
+ * value is a space (encoded value %20).
39
+ *
40
+ * @default ' '
41
+ */
43
42
  scopeSeparator?: string;
44
43
  /**
45
- * string array or scope separator (i.e. space) separated string of
46
- * initially selected oauth scopes
47
- *
48
- * @default []
49
- */
44
+ * string array or scope separator (i.e. space) separated string of
45
+ * initially selected oauth scopes
46
+ *
47
+ * @default []
48
+ */
50
49
  scopes?: string | string[];
51
50
  /**
52
- * Additional query parameters added to authorizationUrl and tokenUrl.
53
- * MUST be an object
54
- */
51
+ * Additional query parameters added to authorizationUrl and tokenUrl.
52
+ * MUST be an object
53
+ */
55
54
  additionalQueryStringParams?: {
56
55
  [key: string]: any;
57
56
  };
58
57
  /**
59
- * Only activated for the accessCode flow. During the authorization_code
60
- * request to the tokenUrl, pass the Client Password using the HTTP Basic
61
- * Authentication scheme (Authorization header with Basic
62
- * base64encode(client_id + client_secret)).
63
- *
64
- * @default false
65
- */
58
+ * Only activated for the accessCode flow. During the authorization_code
59
+ * request to the tokenUrl, pass the Client Password using the HTTP Basic
60
+ * Authentication scheme (Authorization header with Basic
61
+ * base64encode(client_id + client_secret)).
62
+ *
63
+ * @default false
64
+ */
66
65
  useBasicAuthenticationWithAccessCodeGrant?: boolean;
67
66
  /**
68
- * Only applies to Authorization Code flows. Proof Key for Code Exchange
69
- * brings enhanced security for OAuth public clients.
70
- *
71
- * @default false
72
- */
67
+ * Only applies to Authorization Code flows. Proof Key for Code Exchange
68
+ * brings enhanced security for OAuth public clients.
69
+ *
70
+ * @default false
71
+ */
73
72
  usePkceWithAuthorizationCodeGrant?: boolean;
74
73
  };
75
74
  }
@@ -89,8 +88,8 @@ declare class ServerSwaggerProvider {
89
88
  protected readonly serverStaticProvider: ServerStaticProvider;
90
89
  protected readonly serverRouterProvider: ServerRouterProvider;
91
90
  protected readonly alepha: Alepha;
92
- protected readonly configure: _alepha_core0.HookDescriptor<"configure">;
93
- protected configureOpenApi(doc: SwaggerDescriptorOptions): any;
91
+ protected readonly configure: HookDescriptor<"configure">;
92
+ protected configureOpenApi(doc: SwaggerDescriptorOptions): OpenAPIV3.Document;
94
93
  isBodyMultipart(schema: TObject): boolean;
95
94
  replacePathParams(url: string): string;
96
95
  getResponseSchema(route: ServerRouteAction): {
@@ -103,16 +102,17 @@ declare class ServerSwaggerProvider {
103
102
  }
104
103
  //#endregion
105
104
  //#region src/index.d.ts
105
+ // ---------------------------------------------------------------------------------------------------------------------
106
106
  /**
107
- * Alepha Server Swagger Module
108
- *
109
- * Plugin for Alepha Server that provides Swagger documentation capabilities.
110
- * It generates OpenAPI v3 documentation for the server's endpoints ($action).
111
- * It also provides a Swagger UI for interactive API documentation.
112
- *
113
- * @see {@link ServerSwaggerProvider}
114
- * @module alepha.server.swagger
115
- */
107
+ * Alepha Server Swagger Module
108
+ *
109
+ * Plugin for Alepha Server that provides Swagger documentation capabilities.
110
+ * It generates OpenAPI v3 documentation for the server's endpoints ($action).
111
+ * It also provides a Swagger UI for interactive API documentation.
112
+ *
113
+ * @see {@link ServerSwaggerProvider}
114
+ * @module alepha.server.swagger
115
+ */
116
116
  declare class AlephaServerSwagger implements Module {
117
117
  readonly name = "alepha.server.swagger";
118
118
  readonly $services: (alepha: Alepha) => Alepha;