alepha 0.11.4 → 0.11.5
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/api/files.d.ts +439 -1
- package/api/jobs.d.ts +218 -1
- package/api/notifications.d.ts +264 -1
- package/api/users.d.ts +924 -1
- package/batch.d.ts +588 -1
- package/bucket.d.ts +511 -1
- package/cache/redis.d.ts +40 -1
- package/cache.d.ts +288 -1
- package/command.d.ts +252 -1
- package/core.d.ts +1827 -1
- package/devtools.d.ts +370 -1
- package/email.d.ts +144 -1
- package/fake.d.ts +73 -1
- package/file.d.ts +528 -1
- package/lock/redis.d.ts +24 -1
- package/lock.d.ts +552 -1
- package/logger.d.ts +285 -1
- package/package.json +51 -51
- package/postgres.d.ts +1861 -1
- package/queue/redis.d.ts +29 -1
- package/queue.d.ts +760 -1
- package/react/auth.d.ts +499 -1
- package/react/form.d.ts +188 -1
- package/react/head.d.ts +120 -1
- package/react/i18n.d.ts +168 -1
- package/react.d.ts +1238 -1
- package/redis.d.ts +82 -1
- package/scheduler.d.ts +145 -1
- package/security.d.ts +586 -1
- package/server/cache.d.ts +163 -1
- package/server/compress.d.ts +32 -1
- package/server/cookies.d.ts +144 -1
- package/server/cors.d.ts +27 -1
- package/server/health.d.ts +59 -1
- package/server/helmet.d.ts +69 -1
- package/server/links.d.ts +316 -1
- package/server/metrics.d.ts +35 -1
- package/server/multipart.d.ts +42 -1
- package/server/proxy.d.ts +234 -1
- package/server/security.d.ts +87 -1
- package/server/static.d.ts +119 -1
- package/server/swagger.d.ts +148 -1
- package/server.d.ts +849 -1
- package/topic/redis.d.ts +42 -1
- package/topic.d.ts +819 -1
- package/ui.d.ts +683 -1
- package/vite.d.ts +186 -1
package/server/security.d.ts
CHANGED
|
@@ -1 +1,87 @@
|
|
|
1
|
-
|
|
1
|
+
import * as _alepha_core1 from "alepha";
|
|
2
|
+
import { Alepha } from "alepha";
|
|
3
|
+
import { JwtProvider, Permission, SecurityProvider, UserAccount, UserAccountToken } from "alepha/security";
|
|
4
|
+
import { FetchOptions } from "alepha/server";
|
|
5
|
+
import * as _alepha_logger0 from "alepha/logger";
|
|
6
|
+
|
|
7
|
+
//#region src/providers/ServerSecurityProvider.d.ts
|
|
8
|
+
declare class ServerSecurityProvider {
|
|
9
|
+
protected readonly log: _alepha_logger0.Logger;
|
|
10
|
+
protected readonly securityProvider: SecurityProvider;
|
|
11
|
+
protected readonly jwtProvider: JwtProvider;
|
|
12
|
+
protected readonly alepha: Alepha;
|
|
13
|
+
protected readonly onConfigure: _alepha_core1.HookDescriptor<"configure">;
|
|
14
|
+
protected readonly onActionRequest: _alepha_core1.HookDescriptor<"action:onRequest">;
|
|
15
|
+
protected readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
|
|
16
|
+
protected check(user: UserAccountToken, secure: ServerRouteSecure): void;
|
|
17
|
+
/**
|
|
18
|
+
* Get the user account token for a local action call.
|
|
19
|
+
* There are three possible sources for the user:
|
|
20
|
+
* - `options.user`: the user passed in the options
|
|
21
|
+
* - `"system"`: the system user from the state (you MUST set state `server.security.system.user`)
|
|
22
|
+
* - `"context"`: the user from the request context (you MUST be in an HTTP request context)
|
|
23
|
+
*
|
|
24
|
+
* Priority order: `options.user` > `"system"` > `"context"`.
|
|
25
|
+
*
|
|
26
|
+
* In testing environment, if no user is provided, a test user is created based on the SecurityProvider's roles.
|
|
27
|
+
*/
|
|
28
|
+
protected createUserFromLocalFunctionContext(options: {
|
|
29
|
+
user?: UserAccountToken | "system" | "context";
|
|
30
|
+
}, permission?: Permission): UserAccountToken;
|
|
31
|
+
protected createTestUser(): UserAccountToken;
|
|
32
|
+
protected readonly onClientRequest: _alepha_core1.HookDescriptor<"client:onRequest">;
|
|
33
|
+
}
|
|
34
|
+
type ServerRouteSecure = {
|
|
35
|
+
realm?: string;
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/index.d.ts
|
|
39
|
+
declare module "alepha" {
|
|
40
|
+
interface State {
|
|
41
|
+
/**
|
|
42
|
+
* Real (or fake) user account, used for internal actions.
|
|
43
|
+
*
|
|
44
|
+
* If you define this, you assume that all actions are executed by this user by default.
|
|
45
|
+
* > To force a different user, you need to pass it explicitly in the options.
|
|
46
|
+
*/
|
|
47
|
+
"server.security.system.user"?: UserAccountToken;
|
|
48
|
+
user?: UserAccount;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
declare module "alepha/server" {
|
|
52
|
+
interface ServerRequest<TConfig> {
|
|
53
|
+
user?: UserAccountToken;
|
|
54
|
+
}
|
|
55
|
+
interface ServerActionRequest<TConfig> {
|
|
56
|
+
user: UserAccountToken;
|
|
57
|
+
}
|
|
58
|
+
interface ServerRoute {
|
|
59
|
+
/**
|
|
60
|
+
* If true, the route will be protected by the security provider.
|
|
61
|
+
* All actions are secure by default, but you can disable it for specific actions.
|
|
62
|
+
*/
|
|
63
|
+
secure?: boolean | ServerRouteSecure;
|
|
64
|
+
}
|
|
65
|
+
interface ClientRequestOptions extends FetchOptions {
|
|
66
|
+
/**
|
|
67
|
+
* Forward user from the previous request.
|
|
68
|
+
* If "system", use system user. @see {ServerSecurityProvider.localSystemUser}
|
|
69
|
+
* If "context", use the user from the current context (e.g. request).
|
|
70
|
+
*
|
|
71
|
+
* @default "system" if provided, else "context" if available.
|
|
72
|
+
*/
|
|
73
|
+
user?: UserAccountToken | "system" | "context";
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Plugin for Alepha Server that provides security features. Based on the Alepha Security module.
|
|
78
|
+
*
|
|
79
|
+
* By default, all $action will be guarded by a permission check.
|
|
80
|
+
*
|
|
81
|
+
* @see {@link ServerSecurityProvider}
|
|
82
|
+
* @module alepha.server.security
|
|
83
|
+
*/
|
|
84
|
+
declare const AlephaServerSecurity: _alepha_core1.Service<_alepha_core1.Module<{}>>;
|
|
85
|
+
//#endregion
|
|
86
|
+
export { AlephaServerSecurity, ServerRouteSecure, ServerSecurityProvider };
|
|
87
|
+
//# sourceMappingURL=index.d.ts.map
|
package/server/static.d.ts
CHANGED
|
@@ -1 +1,119 @@
|
|
|
1
|
-
|
|
1
|
+
import * as _alepha_core1 from "alepha";
|
|
2
|
+
import { Alepha, Descriptor, KIND } from "alepha";
|
|
3
|
+
import { ServerHandler, ServerRouterProvider } from "alepha/server";
|
|
4
|
+
import { DateTimeProvider, DurationLike } from "alepha/datetime";
|
|
5
|
+
import * as _alepha_logger0 from "alepha/logger";
|
|
6
|
+
|
|
7
|
+
//#region src/descriptors/$serve.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Create a new static file handler.
|
|
10
|
+
*/
|
|
11
|
+
declare const $serve: {
|
|
12
|
+
(options?: ServeDescriptorOptions): ServeDescriptor;
|
|
13
|
+
[KIND]: typeof ServeDescriptor;
|
|
14
|
+
};
|
|
15
|
+
interface ServeDescriptorOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Prefix for the served path.
|
|
18
|
+
*
|
|
19
|
+
* @default "/"
|
|
20
|
+
*/
|
|
21
|
+
path?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Path to the directory to serve.
|
|
24
|
+
*
|
|
25
|
+
* @default process.cwd()
|
|
26
|
+
*/
|
|
27
|
+
root?: string;
|
|
28
|
+
/**
|
|
29
|
+
* If true, descriptor will be ignored.
|
|
30
|
+
*
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to keep dot files (e.g. `.gitignore`, `.env`) in the served directory.
|
|
36
|
+
*
|
|
37
|
+
* @default true
|
|
38
|
+
*/
|
|
39
|
+
ignoreDotEnvFiles?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether to use the index.html file when the path is a directory.
|
|
42
|
+
*
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
45
|
+
indexFallback?: boolean;
|
|
46
|
+
/**
|
|
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
|
+
*/
|
|
50
|
+
historyApiFallback?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Optional name of the descriptor.
|
|
53
|
+
* This is used for logging and debugging purposes.
|
|
54
|
+
*
|
|
55
|
+
* @default Key name.
|
|
56
|
+
*/
|
|
57
|
+
name?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Whether to use cache control headers.
|
|
60
|
+
*
|
|
61
|
+
* @default {}
|
|
62
|
+
*/
|
|
63
|
+
cacheControl?: Partial<CacheControlOptions> | false;
|
|
64
|
+
}
|
|
65
|
+
interface CacheControlOptions {
|
|
66
|
+
/**
|
|
67
|
+
* Whether to use cache control headers.
|
|
68
|
+
*
|
|
69
|
+
* @default [.js, .css]
|
|
70
|
+
*/
|
|
71
|
+
fileTypes: string[];
|
|
72
|
+
/**
|
|
73
|
+
* The maximum age of the cache in seconds.
|
|
74
|
+
*
|
|
75
|
+
* @default 60 * 60 * 24 * 2 // 2 days
|
|
76
|
+
*/
|
|
77
|
+
maxAge: DurationLike;
|
|
78
|
+
/**
|
|
79
|
+
* Whether to use immutable cache control headers.
|
|
80
|
+
*
|
|
81
|
+
* @default true
|
|
82
|
+
*/
|
|
83
|
+
immutable: boolean;
|
|
84
|
+
}
|
|
85
|
+
declare class ServeDescriptor extends Descriptor<ServeDescriptorOptions> {}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/providers/ServerStaticProvider.d.ts
|
|
88
|
+
declare class ServerStaticProvider {
|
|
89
|
+
protected readonly alepha: Alepha;
|
|
90
|
+
protected readonly routerProvider: ServerRouterProvider;
|
|
91
|
+
protected readonly dateTimeProvider: DateTimeProvider;
|
|
92
|
+
protected readonly log: _alepha_logger0.Logger;
|
|
93
|
+
protected readonly directories: ServeDirectory[];
|
|
94
|
+
protected readonly configure: _alepha_core1.HookDescriptor<"configure">;
|
|
95
|
+
createStaticServer(options: ServeDescriptorOptions): Promise<void>;
|
|
96
|
+
createFileHandler(filepath: string, options: ServeDescriptorOptions): Promise<ServerHandler>;
|
|
97
|
+
protected getCacheFileTypes(): string[];
|
|
98
|
+
protected getCacheControl(filename: string, options: ServeDescriptorOptions): {
|
|
99
|
+
maxAge: number;
|
|
100
|
+
immutable: boolean;
|
|
101
|
+
} | undefined;
|
|
102
|
+
getAllFiles(dir: string, ignoreDotEnvFiles?: boolean): Promise<string[]>;
|
|
103
|
+
}
|
|
104
|
+
interface ServeDirectory {
|
|
105
|
+
options: ServeDescriptorOptions;
|
|
106
|
+
files: string[];
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/index.d.ts
|
|
110
|
+
/**
|
|
111
|
+
* Create static file server with `$static()`.
|
|
112
|
+
*
|
|
113
|
+
* @see {@link ServerStaticProvider}
|
|
114
|
+
* @module alepha.server.static
|
|
115
|
+
*/
|
|
116
|
+
declare const AlephaServerStatic: _alepha_core1.Service<_alepha_core1.Module<{}>>;
|
|
117
|
+
//#endregion
|
|
118
|
+
export { $serve, AlephaServerStatic, CacheControlOptions, ServeDescriptor, ServeDescriptorOptions, ServeDirectory, ServerStaticProvider };
|
|
119
|
+
//# sourceMappingURL=index.d.ts.map
|
package/server/swagger.d.ts
CHANGED
|
@@ -1 +1,148 @@
|
|
|
1
|
-
|
|
1
|
+
import "alepha/server/security";
|
|
2
|
+
import * as _alepha_core1 from "alepha";
|
|
3
|
+
import { Alepha, Descriptor, KIND, TObject } from "alepha";
|
|
4
|
+
import { ActionDescriptor, RequestConfigSchema, ServerProvider, ServerRouterProvider } from "alepha/server";
|
|
5
|
+
import { ServerStaticProvider } from "alepha/server/static";
|
|
6
|
+
import * as _alepha_logger0 from "alepha/logger";
|
|
7
|
+
import { OpenAPIV3 } from "openapi-types";
|
|
8
|
+
|
|
9
|
+
//#region src/descriptors/$swagger.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Create a new OpenAPI.
|
|
12
|
+
*/
|
|
13
|
+
declare const $swagger: {
|
|
14
|
+
(options?: SwaggerDescriptorOptions): SwaggerDescriptor;
|
|
15
|
+
[KIND]: typeof SwaggerDescriptor;
|
|
16
|
+
};
|
|
17
|
+
interface SwaggerDescriptorOptions {
|
|
18
|
+
info?: OpenAPIV3.InfoObject;
|
|
19
|
+
/**
|
|
20
|
+
* @default: "/docs"
|
|
21
|
+
*/
|
|
22
|
+
prefix?: string;
|
|
23
|
+
/**
|
|
24
|
+
* If true, docs will be disabled.
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Tags to exclude from the documentation.
|
|
29
|
+
*/
|
|
30
|
+
excludeTags?: string[];
|
|
31
|
+
/**
|
|
32
|
+
* Enable Swagger UI.
|
|
33
|
+
*
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
ui?: boolean | SwaggerUiOptions;
|
|
37
|
+
/**
|
|
38
|
+
* Function to rewrite the OpenAPI document before serving it.
|
|
39
|
+
*/
|
|
40
|
+
rewrite?: (doc: OpenAPIV3.Document) => void;
|
|
41
|
+
}
|
|
42
|
+
interface SwaggerUiOptions {
|
|
43
|
+
root?: string;
|
|
44
|
+
initOAuth?: {
|
|
45
|
+
/**
|
|
46
|
+
* Default clientId.
|
|
47
|
+
*/
|
|
48
|
+
clientId?: string;
|
|
49
|
+
/**
|
|
50
|
+
* realm query parameter (for oauth1) added to authorizationUrl and tokenUrl.
|
|
51
|
+
*/
|
|
52
|
+
realm?: string;
|
|
53
|
+
/**
|
|
54
|
+
* application name, displayed in authorization popup.
|
|
55
|
+
*/
|
|
56
|
+
appName?: string;
|
|
57
|
+
/**
|
|
58
|
+
* scope separator for passing scopes, encoded before calling, default
|
|
59
|
+
* value is a space (encoded value %20).
|
|
60
|
+
*
|
|
61
|
+
* @default ' '
|
|
62
|
+
*/
|
|
63
|
+
scopeSeparator?: string;
|
|
64
|
+
/**
|
|
65
|
+
* string array or scope separator (i.e. space) separated string of
|
|
66
|
+
* initially selected oauth scopes
|
|
67
|
+
*
|
|
68
|
+
* @default []
|
|
69
|
+
*/
|
|
70
|
+
scopes?: string | string[];
|
|
71
|
+
/**
|
|
72
|
+
* Additional query parameters added to authorizationUrl and tokenUrl.
|
|
73
|
+
* MUST be an object
|
|
74
|
+
*/
|
|
75
|
+
additionalQueryStringParams?: {
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Only activated for the accessCode flow. During the authorization_code
|
|
80
|
+
* request to the tokenUrl, pass the Client Password using the HTTP Basic
|
|
81
|
+
* Authentication scheme (Authorization header with Basic
|
|
82
|
+
* base64encode(client_id + client_secret)).
|
|
83
|
+
*
|
|
84
|
+
* @default false
|
|
85
|
+
*/
|
|
86
|
+
useBasicAuthenticationWithAccessCodeGrant?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Only applies to Authorization Code flows. Proof Key for Code Exchange
|
|
89
|
+
* brings enhanced security for OAuth public clients.
|
|
90
|
+
*
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
usePkceWithAuthorizationCodeGrant?: boolean;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
declare class SwaggerDescriptor extends Descriptor<SwaggerDescriptorOptions> {}
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/ServerSwaggerProvider.d.ts
|
|
99
|
+
declare class ServerSwaggerProvider {
|
|
100
|
+
protected readonly serverStaticProvider: ServerStaticProvider;
|
|
101
|
+
protected readonly serverRouterProvider: ServerRouterProvider;
|
|
102
|
+
protected readonly serverProvider: ServerProvider;
|
|
103
|
+
protected readonly alepha: Alepha;
|
|
104
|
+
protected readonly log: _alepha_logger0.Logger;
|
|
105
|
+
json?: OpenAPIV3.Document;
|
|
106
|
+
options: {
|
|
107
|
+
excludeKeys: string[];
|
|
108
|
+
};
|
|
109
|
+
protected readonly configure: _alepha_core1.HookDescriptor<"configure">;
|
|
110
|
+
createSwagger(options: SwaggerDescriptorOptions): Promise<OpenAPIV3.Document | undefined>;
|
|
111
|
+
protected configureOpenApi(actions: ActionDescriptor<RequestConfigSchema>[], doc: SwaggerDescriptorOptions): OpenAPIV3.Document;
|
|
112
|
+
isBodyMultipart(schema: TObject): boolean;
|
|
113
|
+
replacePathParams(url: string): string;
|
|
114
|
+
getResponseSchema(route: ActionDescriptor<RequestConfigSchema>): {
|
|
115
|
+
type?: string;
|
|
116
|
+
schema?: any;
|
|
117
|
+
status: number;
|
|
118
|
+
} | undefined;
|
|
119
|
+
protected configureSwaggerApi(prefix: string, json: OpenAPIV3.Document): void;
|
|
120
|
+
protected configureSwaggerUi(prefix: string, options: SwaggerDescriptorOptions): Promise<void>;
|
|
121
|
+
removePrivateFields<T extends Record<string, any>>(obj: T, excludeList: string[]): T;
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/index.d.ts
|
|
125
|
+
declare module "alepha/server" {
|
|
126
|
+
interface ActionDescriptorOptions<TConfig extends RequestConfigSchema> {
|
|
127
|
+
/**
|
|
128
|
+
* Short description of the route.
|
|
129
|
+
*/
|
|
130
|
+
summary?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Don't include this action in the Swagger documentation.
|
|
133
|
+
*/
|
|
134
|
+
hide?: boolean;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Plugin for Alepha Server that provides Swagger documentation capabilities.
|
|
139
|
+
* It generates OpenAPI v3 documentation for the server's endpoints ($action).
|
|
140
|
+
* It also provides a Swagger UI for interactive API documentation.
|
|
141
|
+
*
|
|
142
|
+
* @see {@link ServerSwaggerProvider}
|
|
143
|
+
* @module alepha.server.swagger
|
|
144
|
+
*/
|
|
145
|
+
declare const AlephaServerSwagger: _alepha_core1.Service<_alepha_core1.Module<{}>>;
|
|
146
|
+
//#endregion
|
|
147
|
+
export { $swagger, AlephaServerSwagger, ServerSwaggerProvider, SwaggerDescriptor, SwaggerDescriptorOptions, SwaggerUiOptions };
|
|
148
|
+
//# sourceMappingURL=index.d.ts.map
|