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.
Files changed (49) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +47 -44
  3. package/batch.d.ts +87 -88
  4. package/bucket.cjs +8 -0
  5. package/bucket.d.ts +194 -0
  6. package/bucket.js +1 -0
  7. package/cache/redis.d.ts +14 -16
  8. package/cache.d.ts +101 -170
  9. package/command.d.ts +70 -77
  10. package/core.d.ts +1043 -887
  11. package/datetime.d.ts +91 -117
  12. package/file.cjs +8 -0
  13. package/file.d.ts +56 -0
  14. package/file.js +1 -0
  15. package/lock/redis.d.ts +11 -13
  16. package/lock.d.ts +125 -117
  17. package/package.json +66 -38
  18. package/postgres.d.ts +232 -275
  19. package/queue/redis.d.ts +13 -15
  20. package/queue.d.ts +88 -116
  21. package/react/auth.d.ts +50 -55
  22. package/react/head.d.ts +5 -8
  23. package/react.d.ts +71 -73
  24. package/redis.d.ts +32 -14
  25. package/retry.d.ts +70 -58
  26. package/router.cjs +8 -0
  27. package/router.d.ts +45 -0
  28. package/router.js +1 -0
  29. package/scheduler.d.ts +54 -96
  30. package/security.d.ts +117 -119
  31. package/server/cache.d.ts +22 -31
  32. package/server/compress.d.ts +16 -7
  33. package/server/cookies.d.ts +70 -61
  34. package/server/cors.d.ts +15 -13
  35. package/server/health.d.ts +23 -26
  36. package/server/helmet.d.ts +17 -20
  37. package/server/links.d.ts +113 -90
  38. package/server/metrics.d.ts +25 -23
  39. package/server/multipart.d.ts +12 -16
  40. package/server/proxy.d.ts +25 -20
  41. package/server/security.cjs +8 -0
  42. package/server/security.d.ts +90 -0
  43. package/server/security.js +1 -0
  44. package/server/static.d.ts +67 -68
  45. package/server/swagger.d.ts +77 -65
  46. package/server.d.ts +265 -308
  47. package/topic/redis.d.ts +25 -26
  48. package/topic.d.ts +76 -122
  49. package/vite.d.ts +52 -36
@@ -1,37 +1,39 @@
1
- import { RouteDescriptor } from "alepha/server";
2
- import { Alepha, HookDescriptor, Module } from "alepha";
3
- import { Registry } from "prom-client";
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
- 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
- }
24
+ //# sourceMappingURL=ServerMetricsProvider.d.ts.map
19
25
  //#endregion
20
26
  //#region src/index.d.ts
21
- // ---------------------------------------------------------------------------------------------------------------------
22
27
  /**
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
- }
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
@@ -1,11 +1,11 @@
1
- import { ActionDescriptorHelper, ServerRoute } from "alepha/server";
2
- import { Alepha, FileLike, HookDescriptor, Module } from "alepha";
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
- * 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
- }
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 { Alepha, Async, HookDescriptor, KIND, Logger, Module, OPTIONS } from "alepha";
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
- interface ProxyDescriptor {
14
- [KIND]: "PROXY";
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/ProxyDescriptorProvider.d.ts
23
- declare class ProxyDescriptorProvider {
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
- declare class AlephaServerProxy implements Module {
36
- readonly name = "alepha.server.proxy";
37
- readonly $services: (alepha: Alepha) => void;
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, ProxyDescriptorProvider };
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'
@@ -1,88 +1,89 @@
1
- import { Alepha, HookDescriptor, KIND, Logger, OPTIONS } from "alepha";
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
- declare const KEY = "SERVE";
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
- * Prefix for the served path.
10
- *
11
- * @default "/"
12
- */
17
+ * Prefix for the served path.
18
+ *
19
+ * @default "/"
20
+ */
13
21
  path?: string;
14
22
  /**
15
- * Path to the directory to serve.
16
- *
17
- * @default process.cwd()
18
- */
23
+ * Path to the directory to serve.
24
+ *
25
+ * @default process.cwd()
26
+ */
19
27
  root?: string;
20
28
  /**
21
- * If true, descriptor will be ignored.
22
- *
23
- * @default false
24
- */
29
+ * If true, descriptor will be ignored.
30
+ *
31
+ * @default false
32
+ */
25
33
  disabled?: boolean;
26
34
  /**
27
- * Whether to keep dot files (e.g. `.gitignore`, `.env`) in the served directory.
28
- *
29
- * @default true
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
- * Whether to use the index.html file when the path is a directory.
34
- *
35
- * @default true
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
- * 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
- */
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
- * Optional name of the descriptor.
45
- * This is used for logging and debugging purposes.
46
- *
47
- * @default Key name.
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
- * Whether to use cache control headers.
52
- *
53
- * @default {}
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
- * Whether to use cache control headers.
60
- *
61
- * @default [.js, .css]
62
- */
67
+ * Whether to use cache control headers.
68
+ *
69
+ * @default [.js, .css]
70
+ */
63
71
  fileTypes: string[];
64
72
  /**
65
- * The maximum age of the cache in seconds.
66
- *
67
- * @default 60 * 60 * 24 * 2 // 2 days
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
- * Whether to use immutable cache control headers.
72
- *
73
- * @default true
74
- */
79
+ * Whether to use immutable cache control headers.
80
+ *
81
+ * @default true
82
+ */
75
83
  immutable: boolean;
76
84
  }
77
- interface ServeDescriptor {
78
- [KIND]: typeof KEY;
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
- list(name: string): string[];
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
- * 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
- }
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
@@ -1,18 +1,27 @@
1
- import { Alepha, HookDescriptor, KIND, Module, OPTIONS, TObject } from "alepha";
2
- import { ServerActionDescriptorProvider, ServerRouteAction, ServerRouterProvider } from "alepha/server";
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
- * @default: "/docs"
11
- */
19
+ * @default: "/docs"
20
+ */
12
21
  prefix?: string;
13
22
  /**
14
- * If true, docs will be disabled.
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
- * Default clientId.
26
- */
34
+ * Default clientId.
35
+ */
27
36
  clientId?: string;
28
37
  /**
29
- * realm query parameter (for oauth1) added to authorizationUrl and tokenUrl.
30
- */
38
+ * realm query parameter (for oauth1) added to authorizationUrl and tokenUrl.
39
+ */
31
40
  realm?: string;
32
41
  /**
33
- * application name, displayed in authorization popup.
34
- */
42
+ * application name, displayed in authorization popup.
43
+ */
35
44
  appName?: string;
36
45
  /**
37
- * scope separator for passing scopes, encoded before calling, default
38
- * value is a space (encoded value %20).
39
- *
40
- * @default ' '
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
- * string array or scope separator (i.e. space) separated string of
45
- * initially selected oauth scopes
46
- *
47
- * @default []
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
- * Additional query parameters added to authorizationUrl and tokenUrl.
52
- * MUST be an object
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
- * 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
- */
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
- * Only applies to Authorization Code flows. Proof Key for Code Exchange
68
- * brings enhanced security for OAuth public clients.
69
- *
70
- * @default false
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
- interface SwaggerDescriptor {
76
- [KIND]: "SWAGGER";
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
- protected readonly configure: HookDescriptor<"configure">;
92
- protected configureOpenApi(doc: SwaggerDescriptorOptions): OpenAPIV3.Document;
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: ServerRouteAction): {
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): Promise<void>;
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
- * 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
- 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