alepha 0.10.6 → 0.11.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/api/files.d.ts +336 -175
- package/api/jobs.d.ts +139 -195
- package/api/notifications.cjs +8 -0
- package/api/notifications.d.ts +264 -0
- package/api/notifications.js +1 -0
- package/api/users.d.ts +790 -261
- package/api/verifications.cjs +8 -0
- package/api/verifications.d.ts +1 -0
- package/api/verifications.js +1 -0
- package/batch.d.ts +1 -1
- package/bucket.d.ts +1 -195
- package/cache.d.ts +1 -1
- package/core.d.ts +301 -189
- package/datetime.d.ts +41 -10
- package/email.d.ts +41 -225
- package/logger.d.ts +19 -10
- package/package.json +70 -62
- package/postgres.d.ts +624 -1284
- package/react/auth.d.ts +1 -1
- package/react/form.d.ts +19 -8
- package/react/i18n.d.ts +8 -5
- package/react.d.ts +30 -10
- package/scheduler.d.ts +12 -2
- package/server/cache.d.ts +86 -11
- package/server/health.d.ts +31 -8
- package/server/multipart.d.ts +2 -2
- package/server/swagger.d.ts +6 -1
- package/server.d.ts +43 -29
- package/ui.cjs +8 -0
- package/ui.d.ts +619 -0
- package/ui.js +1 -0
- package/vite.d.ts +12 -5
package/react/auth.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ import * as _alepha_server_cookies0 from "alepha/server/cookies";
|
|
|
4
4
|
import { Cookies, ServerCookiesProvider } from "alepha/server/cookies";
|
|
5
5
|
import { DateTimeProvider } from "alepha/datetime";
|
|
6
6
|
import { AccessTokenResponse, RealmDescriptor, SecurityProvider, UserAccount, UserAccountToken } from "alepha/security";
|
|
7
|
-
import { Configuration } from "openid-client";
|
|
8
7
|
import * as _alepha_logger0 from "alepha/logger";
|
|
9
8
|
import * as _alepha_server0 from "alepha/server";
|
|
10
9
|
import { HttpClient } from "alepha/server";
|
|
11
10
|
import { HttpVirtualClient, ServerLinksProvider } from "alepha/server/links";
|
|
11
|
+
import { Configuration } from "openid-client";
|
|
12
12
|
import * as typebox143 from "typebox";
|
|
13
13
|
|
|
14
14
|
//#region src/schemas/tokensSchema.d.ts
|
package/react/form.d.ts
CHANGED
|
@@ -6,13 +6,20 @@ import * as _alepha_logger0 from "alepha/logger";
|
|
|
6
6
|
//#region src/services/FormModel.d.ts
|
|
7
7
|
declare class FormModel<T extends TObject> {
|
|
8
8
|
readonly id: string;
|
|
9
|
-
|
|
9
|
+
readonly options: FormCtrlOptions<T>;
|
|
10
10
|
protected readonly log: _alepha_logger0.Logger;
|
|
11
11
|
protected readonly alepha: Alepha;
|
|
12
12
|
protected readonly values: Record<string, any>;
|
|
13
13
|
input: SchemaToInput<T>;
|
|
14
14
|
constructor(id: string, options: FormCtrlOptions<T>);
|
|
15
|
-
|
|
15
|
+
get currentValues(): Record<string, any>;
|
|
16
|
+
get props(): {
|
|
17
|
+
noValidate: boolean;
|
|
18
|
+
onSubmit: (values: FormEventLike) => Promise<void>;
|
|
19
|
+
onReset: (event: FormEventLike) => Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
protected readonly reset: (event: FormEventLike) => Promise<void>;
|
|
22
|
+
protected readonly submit: (event: FormEventLike) => Promise<void>;
|
|
16
23
|
protected parseValuesFromFormElement<T extends TObject>(options: FormCtrlOptions<T>, store: Record<string, any>): Record<string, any>;
|
|
17
24
|
protected getValueFromInputObject<T extends TObject>(options: FormCtrlOptions<T>, values: Record<string, any>, key: string, value: FormDataEntryValue): void;
|
|
18
25
|
protected createProxyFromSchema<T extends TObject>(options: FormCtrlOptions<T>, schema: TSchema, context: {
|
|
@@ -126,17 +133,16 @@ declare const FormState: <T extends TObject>(props: {
|
|
|
126
133
|
declare const useForm: <T extends TObject>(options: FormCtrlOptions<T>) => FormModel<T>;
|
|
127
134
|
//#endregion
|
|
128
135
|
//#region src/hooks/useFormState.d.ts
|
|
129
|
-
interface UseFormStateReturn
|
|
136
|
+
interface UseFormStateReturn {
|
|
130
137
|
loading: boolean;
|
|
131
138
|
dirty: boolean;
|
|
132
|
-
values?:
|
|
139
|
+
values?: Record<string, any>;
|
|
133
140
|
error?: Error;
|
|
134
141
|
}
|
|
135
|
-
|
|
136
|
-
declare const useFormState: <T extends TObject>(target: FormModel<T> | {
|
|
142
|
+
declare const useFormState: <T extends TObject, Keys extends keyof UseFormStateReturn>(target: FormModel<T> | {
|
|
137
143
|
form: FormModel<T>;
|
|
138
144
|
path: string;
|
|
139
|
-
},
|
|
145
|
+
}, _events?: Keys[]) => Pick<UseFormStateReturn, Keys>;
|
|
140
146
|
//#endregion
|
|
141
147
|
//#region src/index.d.ts
|
|
142
148
|
declare module "alepha" {
|
|
@@ -145,11 +151,16 @@ declare module "alepha" {
|
|
|
145
151
|
id: string;
|
|
146
152
|
path: string;
|
|
147
153
|
};
|
|
154
|
+
"form:reset": {
|
|
155
|
+
id: string;
|
|
156
|
+
values: Record<string, any>;
|
|
157
|
+
};
|
|
148
158
|
"form:submit:begin": {
|
|
149
159
|
id: string;
|
|
150
160
|
};
|
|
151
161
|
"form:submit:success": {
|
|
152
162
|
id: string;
|
|
163
|
+
values: Record<string, any>;
|
|
153
164
|
};
|
|
154
165
|
"form:submit:error": {
|
|
155
166
|
id: string;
|
|
@@ -173,5 +184,5 @@ declare module "alepha" {
|
|
|
173
184
|
*/
|
|
174
185
|
declare const AlephaReactForm: _alepha_core0.Service<_alepha_core0.Module<{}>>;
|
|
175
186
|
//#endregion
|
|
176
|
-
export { AlephaReactForm, FormCtrlOptions, FormEventLike, FormModel, FormState,
|
|
187
|
+
export { AlephaReactForm, FormCtrlOptions, FormEventLike, FormModel, FormState, InputField, InputHTMLAttributesLike, SchemaToInput, UseFormStateReturn, useForm, useFormState };
|
|
177
188
|
//# sourceMappingURL=index.d.ts.map
|
package/react/i18n.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ import * as typebox0 from "typebox";
|
|
|
8
8
|
/**
|
|
9
9
|
* Hook to access the i18n service.
|
|
10
10
|
*/
|
|
11
|
-
declare const useI18n: <S extends object, K extends keyof ServiceDictionary<S>>() => I18nProvider<S, K> & {
|
|
12
|
-
tr(key: keyof ServiceDictionary<S>[K] | string, options?: {
|
|
11
|
+
declare const useI18n: <S extends object, K$1 extends keyof ServiceDictionary<S>>() => I18nProvider<S, K$1> & {
|
|
12
|
+
tr(key: keyof ServiceDictionary<S>[K$1] | string, options?: {
|
|
13
13
|
args?: string[];
|
|
14
14
|
default?: string;
|
|
15
15
|
}): string;
|
|
@@ -17,7 +17,7 @@ declare const useI18n: <S extends object, K extends keyof ServiceDictionary<S>>(
|
|
|
17
17
|
type ServiceDictionary<T extends object> = { [K in keyof T]: T[K] extends DictionaryDescriptor<infer U> ? U : never };
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/providers/I18nProvider.d.ts
|
|
20
|
-
declare class I18nProvider<S extends object, K extends keyof ServiceDictionary<S>> {
|
|
20
|
+
declare class I18nProvider<S extends object, K$1 extends keyof ServiceDictionary<S>> {
|
|
21
21
|
protected logger: _alepha_logger0.Logger;
|
|
22
22
|
protected alepha: Alepha;
|
|
23
23
|
protected cookie: _alepha_server_cookies0.AbstractCookieDescriptor<typebox0.TString>;
|
|
@@ -30,6 +30,9 @@ declare class I18nProvider<S extends object, K extends keyof ServiceDictionary<S
|
|
|
30
30
|
options: {
|
|
31
31
|
fallbackLang: string;
|
|
32
32
|
};
|
|
33
|
+
dateFormat: {
|
|
34
|
+
format: (value: Date) => string;
|
|
35
|
+
};
|
|
33
36
|
numberFormat: {
|
|
34
37
|
format: (value: number) => string;
|
|
35
38
|
};
|
|
@@ -37,11 +40,11 @@ declare class I18nProvider<S extends object, K extends keyof ServiceDictionary<S
|
|
|
37
40
|
protected readonly onRender: _alepha_core1.HookDescriptor<"server:onRequest">;
|
|
38
41
|
protected readonly onStart: _alepha_core1.HookDescriptor<"start">;
|
|
39
42
|
protected createFormatters(): void;
|
|
40
|
-
setLang(lang: string)
|
|
43
|
+
setLang: (lang: string) => Promise<void>;
|
|
41
44
|
protected readonly mutate: _alepha_core1.HookDescriptor<"state:mutate">;
|
|
42
45
|
get lang(): string;
|
|
43
46
|
translate: (key: string, args?: string[]) => string;
|
|
44
|
-
readonly tr: (key: keyof ServiceDictionary<S>[K] | string, options?: {
|
|
47
|
+
readonly tr: (key: keyof ServiceDictionary<S>[K$1] | string, options?: {
|
|
45
48
|
args?: string[];
|
|
46
49
|
default?: string;
|
|
47
50
|
}) => string;
|
package/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _alepha_core14 from "alepha";
|
|
2
|
-
import { Alepha, Async, Descriptor, Hooks, KIND, Service, State, Static, TObject, TSchema } from "alepha";
|
|
2
|
+
import { Alepha, Async, Configurable, Descriptor, Hooks, KIND, Service, State, Static, TObject, TSchema } from "alepha";
|
|
3
3
|
import { RequestConfigSchema, ServerHandler, ServerProvider, ServerRequest, ServerRouterProvider, ServerTimingProvider } from "alepha/server";
|
|
4
4
|
import { ServerRouteCache } from "alepha/server/cache";
|
|
5
5
|
import { ClientScope, HttpVirtualClient, LinkProvider, VirtualAction } from "alepha/server/links";
|
|
@@ -7,7 +7,7 @@ import * as _alepha_logger1 from "alepha/logger";
|
|
|
7
7
|
import * as react0 from "react";
|
|
8
8
|
import React, { AnchorHTMLAttributes, CSSProperties, ErrorInfo, FC, PropsWithChildren, ReactNode } from "react";
|
|
9
9
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
10
|
-
import { ServerStaticProvider } from "alepha/server/static";
|
|
10
|
+
import { ServeDescriptorOptions, ServerStaticProvider } from "alepha/server/static";
|
|
11
11
|
import { DateTimeProvider } from "alepha/datetime";
|
|
12
12
|
import { Route, RouterProvider } from "alepha/router";
|
|
13
13
|
|
|
@@ -813,14 +813,16 @@ declare module "alepha" {
|
|
|
813
813
|
"react.server.ssr"?: boolean;
|
|
814
814
|
}
|
|
815
815
|
}
|
|
816
|
-
|
|
816
|
+
interface ReactServerProviderOptions {
|
|
817
|
+
/**
|
|
818
|
+
* Override default options for the static file server.
|
|
819
|
+
* > Static file server is only created in non-serverless production mode.
|
|
820
|
+
*/
|
|
821
|
+
static?: Partial<Omit<ServeDescriptorOptions, "root">>;
|
|
822
|
+
}
|
|
823
|
+
declare class ReactServerProvider implements Configurable {
|
|
817
824
|
protected readonly log: _alepha_logger1.Logger;
|
|
818
825
|
protected readonly alepha: Alepha;
|
|
819
|
-
protected readonly pageApi: ReactPageProvider;
|
|
820
|
-
protected readonly serverProvider: ServerProvider;
|
|
821
|
-
protected readonly serverStaticProvider: ServerStaticProvider;
|
|
822
|
-
protected readonly serverRouterProvider: ServerRouterProvider;
|
|
823
|
-
protected readonly serverTimingProvider: ServerTimingProvider;
|
|
824
826
|
protected readonly env: {
|
|
825
827
|
REACT_SSR_ENABLED?: boolean | undefined;
|
|
826
828
|
REACT_SERVER_TEMPLATE?: string | undefined;
|
|
@@ -828,13 +830,31 @@ declare class ReactServerProvider {
|
|
|
828
830
|
REACT_SERVER_PREFIX: string;
|
|
829
831
|
REACT_ROOT_ID: string;
|
|
830
832
|
};
|
|
833
|
+
protected readonly pageApi: ReactPageProvider;
|
|
834
|
+
protected readonly serverProvider: ServerProvider;
|
|
835
|
+
protected readonly serverStaticProvider: ServerStaticProvider;
|
|
836
|
+
protected readonly serverRouterProvider: ServerRouterProvider;
|
|
837
|
+
protected readonly serverTimingProvider: ServerTimingProvider;
|
|
831
838
|
protected readonly ROOT_DIV_REGEX: RegExp;
|
|
832
839
|
protected preprocessedTemplate: PreprocessedTemplate | null;
|
|
840
|
+
options: ReactServerProviderOptions;
|
|
841
|
+
/**
|
|
842
|
+
* Configure the React server provider.
|
|
843
|
+
*/
|
|
833
844
|
readonly onConfigure: _alepha_core14.HookDescriptor<"configure">;
|
|
834
845
|
get template(): string;
|
|
835
846
|
protected registerPages(templateLoader: TemplateLoader): Promise<void>;
|
|
847
|
+
/**
|
|
848
|
+
* Get the public directory path where static files are located.
|
|
849
|
+
*/
|
|
836
850
|
protected getPublicDirectory(): string;
|
|
851
|
+
/**
|
|
852
|
+
* Configure the static file server to serve files from the given root directory.
|
|
853
|
+
*/
|
|
837
854
|
protected configureStaticServer(root: string): Promise<void>;
|
|
855
|
+
/**
|
|
856
|
+
* Configure Vite for SSR.
|
|
857
|
+
*/
|
|
838
858
|
protected configureVite(ssrEnabled: boolean): Promise<void>;
|
|
839
859
|
/**
|
|
840
860
|
* For testing purposes, creates a render function that can be used.
|
|
@@ -871,7 +891,7 @@ declare module "alepha" {
|
|
|
871
891
|
html: string;
|
|
872
892
|
};
|
|
873
893
|
"react:browser:render": {
|
|
874
|
-
root:
|
|
894
|
+
root: HTMLElement;
|
|
875
895
|
element: ReactNode;
|
|
876
896
|
state: ReactRouterState;
|
|
877
897
|
hydration?: ReactHydrationState;
|
|
@@ -905,5 +925,5 @@ declare module "alepha" {
|
|
|
905
925
|
*/
|
|
906
926
|
declare const AlephaReact: _alepha_core14.Service<_alepha_core14.Module<{}>>;
|
|
907
927
|
//#endregion
|
|
908
|
-
export { $page, AlephaContext, AlephaReact, AnchorProps, ClientOnly, CreateLayersResult, ErrorBoundary, ErrorHandler, ErrorViewer, Layer, Link, LinkProps, _default as NestedView, NotFoundPage as NotFound, PageAnimation, PageConfigSchema, PageDescriptor, PageDescriptorOptions, PageDescriptorRenderOptions, PageDescriptorRenderResult, PageRequestConfig, PageResolve, PageRoute, PageRouteEntry, PreviousLayerData, ReactBrowserProvider, ReactBrowserRendererOptions, ReactHydrationState, ReactPageProvider, ReactRouter, ReactRouterState, ReactServerProvider, Redirection, RouterGoOptions, RouterLayerContext, RouterLayerContextValue, RouterRenderOptions, RouterStackItem, TPropsDefault, TPropsParentDefault, TransitionOptions, UseActiveHook, UseActiveOptions, UseQueryParamsHookOptions, UseSchemaReturn, VirtualRouter, isPageRoute, ssrSchemaLoading, useActive, useAlepha, useClient, useInject, useQueryParams, useRouter, useRouterEvents, useRouterState, useSchema, useStore };
|
|
928
|
+
export { $page, AlephaContext, AlephaReact, AnchorProps, ClientOnly, CreateLayersResult, ErrorBoundary, ErrorHandler, ErrorViewer, Layer, Link, LinkProps, _default as NestedView, NotFoundPage as NotFound, PageAnimation, PageConfigSchema, PageDescriptor, PageDescriptorOptions, PageDescriptorRenderOptions, PageDescriptorRenderResult, PageRequestConfig, PageResolve, PageRoute, PageRouteEntry, PreviousLayerData, ReactBrowserProvider, ReactBrowserRendererOptions, ReactHydrationState, ReactPageProvider, ReactRouter, ReactRouterState, ReactServerProvider, ReactServerProviderOptions, Redirection, RouterGoOptions, RouterLayerContext, RouterLayerContextValue, RouterRenderOptions, RouterStackItem, TPropsDefault, TPropsParentDefault, TransitionOptions, UseActiveHook, UseActiveOptions, UseQueryParamsHookOptions, UseSchemaReturn, VirtualRouter, isPageRoute, ssrSchemaLoading, useActive, useAlepha, useClient, useInject, useQueryParams, useRouter, useRouterEvents, useRouterState, useSchema, useStore };
|
|
909
929
|
//# sourceMappingURL=index.d.ts.map
|
package/scheduler.d.ts
CHANGED
|
@@ -3,9 +3,19 @@ import { Alepha, Async, Descriptor, KIND, Static } from "alepha";
|
|
|
3
3
|
import * as _alepha_lock0 from "alepha/lock";
|
|
4
4
|
import { DateTime, DateTimeProvider, DurationLike } from "alepha/datetime";
|
|
5
5
|
import * as _alepha_logger0 from "alepha/logger";
|
|
6
|
-
import { Cron } from "cron-schedule";
|
|
7
6
|
import * as dayjs0 from "dayjs";
|
|
7
|
+
import { Cron } from "cron-schedule";
|
|
8
8
|
|
|
9
|
+
//#region src/constants/CRON.d.ts
|
|
10
|
+
declare const CRON: {
|
|
11
|
+
EVERY_MINUTE: string;
|
|
12
|
+
EVERY_5_MINUTES: string;
|
|
13
|
+
EVERY_15_MINUTES: string;
|
|
14
|
+
EVERY_30_MINUTES: string;
|
|
15
|
+
EVERY_HOUR: string;
|
|
16
|
+
EVERY_DAY_AT_MIDNIGHT: string;
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
9
19
|
//#region src/providers/CronProvider.d.ts
|
|
10
20
|
declare class CronProvider {
|
|
11
21
|
protected readonly dt: DateTimeProvider;
|
|
@@ -131,5 +141,5 @@ declare module "alepha" {
|
|
|
131
141
|
*/
|
|
132
142
|
declare const AlephaScheduler: _alepha_core4.Service<_alepha_core4.Module<{}>>;
|
|
133
143
|
//#endregion
|
|
134
|
-
export { $scheduler, AlephaScheduler, SchedulerDescriptor, SchedulerDescriptorOptions, SchedulerHandlerArguments };
|
|
144
|
+
export { $scheduler, AlephaScheduler, CRON, CronJob, CronProvider, SchedulerDescriptor, SchedulerDescriptorOptions, SchedulerHandlerArguments };
|
|
135
145
|
//# sourceMappingURL=index.d.ts.map
|
package/server/cache.d.ts
CHANGED
|
@@ -11,20 +11,12 @@ declare module "alepha/server" {
|
|
|
11
11
|
interface ServerRoute {
|
|
12
12
|
/**
|
|
13
13
|
* Enable caching for this route.
|
|
14
|
-
* If
|
|
15
|
-
* If
|
|
14
|
+
* - If true: enables both store and etag
|
|
15
|
+
* - If object: fine-grained control over store, etag, and cache-control headers
|
|
16
16
|
*
|
|
17
17
|
* @default false
|
|
18
18
|
*/
|
|
19
19
|
cache?: ServerRouteCache;
|
|
20
|
-
/**
|
|
21
|
-
* Enable ETag support for this route.
|
|
22
|
-
* If set to true, the server will generate and manage ETags automatically.
|
|
23
|
-
* If a string is provided, it will be used as a static ETag value.
|
|
24
|
-
*
|
|
25
|
-
* @default false
|
|
26
|
-
*/
|
|
27
|
-
etag?: boolean | string;
|
|
28
20
|
}
|
|
29
21
|
interface ActionDescriptor<TConfig extends RequestConfigSchema> {
|
|
30
22
|
invalidate: () => Promise<void>;
|
|
@@ -42,9 +34,92 @@ declare class ServerCacheProvider {
|
|
|
42
34
|
protected readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
|
|
43
35
|
protected readonly onSend: _alepha_core1.HookDescriptor<"server:onSend">;
|
|
44
36
|
protected readonly onResponse: _alepha_core1.HookDescriptor<"server:onResponse">;
|
|
37
|
+
buildCacheControlHeader(cache?: ServerRouteCache): string | undefined;
|
|
38
|
+
protected durationToSeconds(duration: number | DurationLike): number;
|
|
39
|
+
protected shouldStore(cache?: ServerRouteCache): boolean;
|
|
40
|
+
protected shouldUseEtag(cache?: ServerRouteCache): boolean;
|
|
45
41
|
protected createCacheKey(route: ServerRoute, config?: ServerRequest): string;
|
|
46
42
|
}
|
|
47
|
-
type ServerRouteCache =
|
|
43
|
+
type ServerRouteCache =
|
|
44
|
+
/**
|
|
45
|
+
* If true, enables caching with:
|
|
46
|
+
* - store: true
|
|
47
|
+
* - etag: true
|
|
48
|
+
*/
|
|
49
|
+
boolean
|
|
50
|
+
/**
|
|
51
|
+
* Object configuration for fine-grained cache control.
|
|
52
|
+
*
|
|
53
|
+
* If empty, no caching will be applied.
|
|
54
|
+
*/ | {
|
|
55
|
+
/**
|
|
56
|
+
* If true, enables storing cached responses. (in-memory, Redis, @see @alepha/cache for other providers)
|
|
57
|
+
* If a DurationLike is provided, it will be used as the TTL for the cache.
|
|
58
|
+
* If CacheDescriptorOptions is provided, it will be used to configure the cache storage.
|
|
59
|
+
*
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
store?: true | DurationLike | CacheDescriptorOptions;
|
|
63
|
+
/**
|
|
64
|
+
* If true, enables ETag support for the cached responses.
|
|
65
|
+
*/
|
|
66
|
+
etag?: true;
|
|
67
|
+
/**
|
|
68
|
+
* - If true, sets Cache-Control to "public, max-age=300" (5 minutes).
|
|
69
|
+
* - If string, sets Cache-Control to the provided value directly.
|
|
70
|
+
* - If object, configures Cache-Control directives.
|
|
71
|
+
*/
|
|
72
|
+
control?: true
|
|
73
|
+
/**
|
|
74
|
+
* If string, sets Cache-Control to the provided value directly.
|
|
75
|
+
*/ | string
|
|
76
|
+
/**
|
|
77
|
+
* If object, configures Cache-Control directives.
|
|
78
|
+
*/ | {
|
|
79
|
+
/**
|
|
80
|
+
* Indicates that the response may be cached by any cache.
|
|
81
|
+
*/
|
|
82
|
+
public?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Indicates that the response is intended for a single user and must not be stored by a shared cache.
|
|
85
|
+
*/
|
|
86
|
+
private?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Forces caches to submit the request to the origin server for validation before releasing a cached copy.
|
|
89
|
+
*/
|
|
90
|
+
noCache?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Instructs caches not to store the response.
|
|
93
|
+
*/
|
|
94
|
+
noStore?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Maximum amount of time a resource is considered fresh.
|
|
97
|
+
* Can be specified as a number (seconds) or as a DurationLike object.
|
|
98
|
+
*
|
|
99
|
+
* @example 300 // 5 minutes in seconds
|
|
100
|
+
* @example { minutes: 5 } // 5 minutes
|
|
101
|
+
* @example { hours: 1 } // 1 hour
|
|
102
|
+
*/
|
|
103
|
+
maxAge?: number | DurationLike;
|
|
104
|
+
/**
|
|
105
|
+
* Overrides max-age for shared caches (e.g., CDNs).
|
|
106
|
+
* Can be specified as a number (seconds) or as a DurationLike object.
|
|
107
|
+
*/
|
|
108
|
+
sMaxAge?: number | DurationLike;
|
|
109
|
+
/**
|
|
110
|
+
* Indicates that once a resource becomes stale, caches must not use it without successful validation.
|
|
111
|
+
*/
|
|
112
|
+
mustRevalidate?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Similar to must-revalidate, but only for shared caches.
|
|
115
|
+
*/
|
|
116
|
+
proxyRevalidate?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Indicates that the response can be stored but must be revalidated before each use.
|
|
119
|
+
*/
|
|
120
|
+
immutable?: boolean;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
48
123
|
interface RouteCacheEntry {
|
|
49
124
|
contentType?: string;
|
|
50
125
|
body: any;
|
package/server/health.d.ts
CHANGED
|
@@ -2,11 +2,12 @@ import * as _alepha_core0 from "alepha";
|
|
|
2
2
|
import { Alepha } from "alepha";
|
|
3
3
|
import * as _alepha_server0 from "alepha/server";
|
|
4
4
|
import { DateTimeProvider } from "alepha/datetime";
|
|
5
|
-
import * as
|
|
5
|
+
import * as typebox5 from "typebox";
|
|
6
|
+
import * as dayjs0 from "dayjs";
|
|
6
7
|
|
|
7
8
|
//#region src/providers/ServerHealthProvider.d.ts
|
|
8
9
|
/**
|
|
9
|
-
* Register `/health` endpoint.
|
|
10
|
+
* Register `/health` & `/healthz` endpoint.
|
|
10
11
|
*
|
|
11
12
|
* - Provides basic health information about the server.
|
|
12
13
|
*/
|
|
@@ -14,15 +15,37 @@ declare class ServerHealthProvider {
|
|
|
14
15
|
protected readonly time: DateTimeProvider;
|
|
15
16
|
protected readonly alepha: Alepha;
|
|
16
17
|
readonly health: _alepha_server0.RouteDescriptor<{
|
|
17
|
-
response:
|
|
18
|
-
message:
|
|
19
|
-
uptime:
|
|
20
|
-
date:
|
|
21
|
-
ready:
|
|
18
|
+
response: typebox5.TObject<{
|
|
19
|
+
message: typebox5.TString;
|
|
20
|
+
uptime: typebox5.TNumber;
|
|
21
|
+
date: typebox5.TCodec<typebox5.TString, dayjs0.Dayjs>;
|
|
22
|
+
ready: typebox5.TBoolean;
|
|
22
23
|
}>;
|
|
23
24
|
}>;
|
|
25
|
+
readonly healthz: _alepha_server0.RouteDescriptor<{
|
|
26
|
+
response: typebox5.TObject<{
|
|
27
|
+
message: typebox5.TString;
|
|
28
|
+
uptime: typebox5.TNumber;
|
|
29
|
+
date: typebox5.TCodec<typebox5.TString, dayjs0.Dayjs>;
|
|
30
|
+
ready: typebox5.TBoolean;
|
|
31
|
+
}>;
|
|
32
|
+
}>;
|
|
33
|
+
protected healthCheck(): {
|
|
34
|
+
message: string;
|
|
35
|
+
uptime: number;
|
|
36
|
+
date: dayjs0.Dayjs;
|
|
37
|
+
ready: boolean;
|
|
38
|
+
};
|
|
24
39
|
}
|
|
25
40
|
//#endregion
|
|
41
|
+
//#region src/schemas/healthSchema.d.ts
|
|
42
|
+
declare const healthSchema: typebox5.TObject<{
|
|
43
|
+
message: typebox5.TString;
|
|
44
|
+
uptime: typebox5.TNumber;
|
|
45
|
+
date: typebox5.TCodec<typebox5.TString, dayjs0.Dayjs>;
|
|
46
|
+
ready: typebox5.TBoolean;
|
|
47
|
+
}>;
|
|
48
|
+
//#endregion
|
|
26
49
|
//#region src/index.d.ts
|
|
27
50
|
/**
|
|
28
51
|
* Plugin for Alepha Server that provides health-check endpoints.
|
|
@@ -32,5 +55,5 @@ declare class ServerHealthProvider {
|
|
|
32
55
|
*/
|
|
33
56
|
declare const AlephaServerHealth: _alepha_core0.Service<_alepha_core0.Module<{}>>;
|
|
34
57
|
//#endregion
|
|
35
|
-
export { AlephaServerHealth, ServerHealthProvider };
|
|
58
|
+
export { AlephaServerHealth, ServerHealthProvider, healthSchema };
|
|
36
59
|
//# sourceMappingURL=index.d.ts.map
|
package/server/multipart.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _alepha_core0 from "alepha";
|
|
2
2
|
import { Alepha, FileLike, HookDescriptor } from "alepha";
|
|
3
3
|
import { ServerRoute } from "alepha/server";
|
|
4
|
-
import { BusboyConfig } from "@fastify/busboy";
|
|
5
4
|
import { IncomingMessage } from "node:http";
|
|
5
|
+
import { BusboyConfig } from "@fastify/busboy";
|
|
6
6
|
|
|
7
7
|
//#region src/providers/ServerMultipartProvider.d.ts
|
|
8
8
|
declare class ServerMultipartProvider {
|
|
@@ -10,7 +10,7 @@ declare class ServerMultipartProvider {
|
|
|
10
10
|
readonly onRequest: HookDescriptor<"server:onRequest">;
|
|
11
11
|
readonly onSend: HookDescriptor<"server:onResponse">;
|
|
12
12
|
handleMultipartBodyFromNode(route: ServerRoute, stream: IncomingMessage): Promise<{
|
|
13
|
-
body: Record<string,
|
|
13
|
+
body: Record<string, unknown>;
|
|
14
14
|
cleanup: () => Promise<void>;
|
|
15
15
|
}>;
|
|
16
16
|
parseMultipart(req: IncomingMessage, config?: Omit<BusboyConfig, "headers">): Promise<MultipartResult>;
|
package/server/swagger.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "alepha/server/security";
|
|
2
2
|
import * as _alepha_core1 from "alepha";
|
|
3
3
|
import { Alepha, Descriptor, KIND, TObject } from "alepha";
|
|
4
|
-
import { ActionDescriptor, RequestConfigSchema, ServerRouterProvider } from "alepha/server";
|
|
4
|
+
import { ActionDescriptor, RequestConfigSchema, ServerProvider, ServerRouterProvider } from "alepha/server";
|
|
5
5
|
import * as _alepha_logger0 from "alepha/logger";
|
|
6
6
|
import { ServerStaticProvider } from "alepha/server/static";
|
|
7
7
|
import { OpenAPIV3 } from "openapi-types";
|
|
@@ -99,9 +99,13 @@ declare class SwaggerDescriptor extends Descriptor<SwaggerDescriptorOptions> {}
|
|
|
99
99
|
declare class ServerSwaggerProvider {
|
|
100
100
|
protected readonly serverStaticProvider: ServerStaticProvider;
|
|
101
101
|
protected readonly serverRouterProvider: ServerRouterProvider;
|
|
102
|
+
protected readonly serverProvider: ServerProvider;
|
|
102
103
|
protected readonly alepha: Alepha;
|
|
103
104
|
protected readonly log: _alepha_logger0.Logger;
|
|
104
105
|
json?: OpenAPIV3.Document;
|
|
106
|
+
options: {
|
|
107
|
+
excludeKeys: string[];
|
|
108
|
+
};
|
|
105
109
|
protected readonly configure: _alepha_core1.HookDescriptor<"configure">;
|
|
106
110
|
createSwagger(options: SwaggerDescriptorOptions): Promise<OpenAPIV3.Document | undefined>;
|
|
107
111
|
protected configureOpenApi(actions: ActionDescriptor<RequestConfigSchema>[], doc: SwaggerDescriptorOptions): OpenAPIV3.Document;
|
|
@@ -114,6 +118,7 @@ declare class ServerSwaggerProvider {
|
|
|
114
118
|
} | undefined;
|
|
115
119
|
protected configureSwaggerApi(prefix: string, json: OpenAPIV3.Document): void;
|
|
116
120
|
protected configureSwaggerUi(prefix: string, options: SwaggerDescriptorOptions): Promise<void>;
|
|
121
|
+
removePrivateFields<T extends Record<string, any>>(obj: T, excludeList: string[]): T;
|
|
117
122
|
}
|
|
118
123
|
//#endregion
|
|
119
124
|
//#region src/index.d.ts
|
package/server.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alepha_core11 from "alepha";
|
|
2
2
|
import { Alepha, AlephaError, Async, Descriptor, FileLike, KIND, Static, StreamLike, TArray, TFile, TObject, TRecord, TSchema, TStream, TString, TVoid } from "alepha";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alepha_logger3 from "alepha/logger";
|
|
4
4
|
import { Readable } from "node:stream";
|
|
5
5
|
import { ReadableStream } from "node:stream/web";
|
|
6
6
|
import { Route, RouterProvider } from "alepha/router";
|
|
@@ -153,6 +153,10 @@ interface ServerRawRequest {
|
|
|
153
153
|
req: IncomingMessage;
|
|
154
154
|
res: ServerResponse$1;
|
|
155
155
|
};
|
|
156
|
+
web?: {
|
|
157
|
+
req: Request;
|
|
158
|
+
res?: Response;
|
|
159
|
+
};
|
|
156
160
|
};
|
|
157
161
|
}
|
|
158
162
|
//#endregion
|
|
@@ -161,6 +165,12 @@ declare abstract class ServerProvider {
|
|
|
161
165
|
protected readonly alepha: Alepha;
|
|
162
166
|
abstract get hostname(): string;
|
|
163
167
|
protected isViteNotFound(url?: string, route?: Route, params?: Record<string, string>): boolean;
|
|
168
|
+
protected createRouterRequest(req: {
|
|
169
|
+
method?: string;
|
|
170
|
+
url?: string;
|
|
171
|
+
headers?: Record<string, string | string[] | undefined>;
|
|
172
|
+
}, params?: Record<string, string>): ServerRawRequest;
|
|
173
|
+
protected getProtocol(headers: Record<string, string>): "http" | "https";
|
|
164
174
|
}
|
|
165
175
|
//#endregion
|
|
166
176
|
//#region src/services/ServerRequestParser.d.ts
|
|
@@ -176,13 +186,14 @@ declare class ServerRequestParser {
|
|
|
176
186
|
//#region src/providers/ServerTimingProvider.d.ts
|
|
177
187
|
type TimingMap = Record<string, [number, number]>;
|
|
178
188
|
declare class ServerTimingProvider {
|
|
179
|
-
protected readonly log:
|
|
189
|
+
protected readonly log: _alepha_logger3.Logger;
|
|
180
190
|
protected readonly alepha: Alepha;
|
|
181
191
|
options: {
|
|
192
|
+
prefix: string;
|
|
182
193
|
disabled: boolean;
|
|
183
194
|
};
|
|
184
|
-
readonly onRequest:
|
|
185
|
-
readonly onResponse:
|
|
195
|
+
readonly onRequest: _alepha_core11.HookDescriptor<"server:onRequest">;
|
|
196
|
+
readonly onResponse: _alepha_core11.HookDescriptor<"server:onResponse">;
|
|
186
197
|
protected get handlerName(): string;
|
|
187
198
|
beginTiming(name: string): void;
|
|
188
199
|
endTiming(name: string): void;
|
|
@@ -222,14 +233,12 @@ declare class ServerRouterProvider extends RouterProvider<ServerRouteMatcher> {
|
|
|
222
233
|
//#endregion
|
|
223
234
|
//#region src/services/HttpClient.d.ts
|
|
224
235
|
declare class HttpClient {
|
|
225
|
-
protected readonly log:
|
|
236
|
+
protected readonly log: _alepha_logger3.Logger;
|
|
226
237
|
protected readonly alepha: Alepha;
|
|
227
238
|
readonly cache: _alepha_cache0.CacheDescriptorFn<HttpClientCache, any[]>;
|
|
228
239
|
protected readonly pendingRequests: HttpClientPendingRequests;
|
|
229
240
|
fetchAction(args: FetchActionArgs): Promise<FetchResponse>;
|
|
230
|
-
fetch<T>(url: string, request?:
|
|
231
|
-
// standard options
|
|
232
|
-
options?: FetchOptions): Promise<FetchResponse<T>>;
|
|
241
|
+
fetch<T extends TSchema>(url: string, request?: RequestInitWithOptions<T>): Promise<FetchResponse<Static<T>>>;
|
|
233
242
|
protected url(host: string, action: HttpAction, args: ServerRequestConfigEntry): string;
|
|
234
243
|
protected body(init: RequestInit, headers: Record<string, string>, action: HttpAction, args?: ServerRequestConfigEntry): Promise<void>;
|
|
235
244
|
protected responseData(response: Response, options: FetchOptions): Promise<any>;
|
|
@@ -246,7 +255,7 @@ declare class HttpClient {
|
|
|
246
255
|
};
|
|
247
256
|
}, args?: ServerRequestConfigEntry): string;
|
|
248
257
|
}
|
|
249
|
-
interface FetchOptions {
|
|
258
|
+
interface FetchOptions<T extends TSchema = TSchema> {
|
|
250
259
|
/**
|
|
251
260
|
* Key to identify the request in the pending requests.
|
|
252
261
|
*/
|
|
@@ -254,12 +263,15 @@ interface FetchOptions {
|
|
|
254
263
|
/**
|
|
255
264
|
* The schema to validate the response against.
|
|
256
265
|
*/
|
|
257
|
-
schema?:
|
|
266
|
+
schema?: {
|
|
267
|
+
response?: T;
|
|
268
|
+
};
|
|
258
269
|
/**
|
|
259
270
|
* Built-in cache options.
|
|
260
271
|
*/
|
|
261
|
-
|
|
272
|
+
localCache?: boolean | number | DurationLike;
|
|
262
273
|
}
|
|
274
|
+
type RequestInitWithOptions<T extends TSchema = TSchema> = RequestInit & FetchOptions<T>;
|
|
263
275
|
interface FetchResponse<T = any> {
|
|
264
276
|
data: T;
|
|
265
277
|
status: number;
|
|
@@ -541,7 +553,7 @@ interface ActionDescriptorOptions<TConfig extends RequestConfigSchema> extends O
|
|
|
541
553
|
handler: ServerActionHandler<TConfig>;
|
|
542
554
|
}
|
|
543
555
|
declare class ActionDescriptor<TConfig extends RequestConfigSchema> extends Descriptor<ActionDescriptorOptions<TConfig>> {
|
|
544
|
-
protected readonly log:
|
|
556
|
+
protected readonly log: _alepha_logger3.Logger;
|
|
545
557
|
protected readonly env: {
|
|
546
558
|
SERVER_API_PREFIX: string;
|
|
547
559
|
};
|
|
@@ -713,9 +725,9 @@ declare const okSchema: typebox0.TObject<{
|
|
|
713
725
|
type Ok = Static<typeof okSchema>;
|
|
714
726
|
//#endregion
|
|
715
727
|
//#region src/providers/NodeHttpServerProvider.d.ts
|
|
716
|
-
declare const envSchema:
|
|
717
|
-
SERVER_PORT:
|
|
718
|
-
SERVER_HOST:
|
|
728
|
+
declare const envSchema: _alepha_core11.TObject<{
|
|
729
|
+
SERVER_PORT: _alepha_core11.TInteger;
|
|
730
|
+
SERVER_HOST: _alepha_core11.TString;
|
|
719
731
|
}>;
|
|
720
732
|
declare module "alepha" {
|
|
721
733
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
@@ -723,31 +735,29 @@ declare module "alepha" {
|
|
|
723
735
|
declare class NodeHttpServerProvider extends ServerProvider {
|
|
724
736
|
protected readonly alepha: Alepha;
|
|
725
737
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
726
|
-
protected readonly log:
|
|
738
|
+
protected readonly log: _alepha_logger3.Logger;
|
|
727
739
|
protected readonly env: {
|
|
728
740
|
SERVER_PORT: number;
|
|
729
741
|
SERVER_HOST: string;
|
|
730
742
|
};
|
|
731
743
|
protected readonly router: ServerRouterProvider;
|
|
732
744
|
protected readonly server: http0.Server<typeof IncomingMessage, typeof ServerResponse$1>;
|
|
733
|
-
protected readonly onNodeRequest:
|
|
745
|
+
protected readonly onNodeRequest: _alepha_core11.HookDescriptor<"node:request">;
|
|
734
746
|
handle(req: IncomingMessage, res: ServerResponse$1): Promise<void>;
|
|
735
|
-
createRouterRequest(req: IncomingMessage, res: ServerResponse$1, params?: Record<string, string>): ServerRawRequest;
|
|
736
|
-
getProtocol(req: IncomingMessage): "http" | "https";
|
|
737
747
|
get hostname(): string;
|
|
738
|
-
readonly start:
|
|
739
|
-
protected readonly stop:
|
|
748
|
+
readonly start: _alepha_core11.HookDescriptor<"start">;
|
|
749
|
+
protected readonly stop: _alepha_core11.HookDescriptor<"stop">;
|
|
740
750
|
protected listen(): Promise<void>;
|
|
741
751
|
protected close(): Promise<void>;
|
|
742
752
|
}
|
|
743
753
|
//#endregion
|
|
744
754
|
//#region src/providers/ServerLoggerProvider.d.ts
|
|
745
755
|
declare class ServerLoggerProvider {
|
|
746
|
-
protected readonly log:
|
|
756
|
+
protected readonly log: _alepha_logger3.Logger;
|
|
747
757
|
protected readonly alepha: Alepha;
|
|
748
|
-
readonly onRequest:
|
|
749
|
-
readonly onError:
|
|
750
|
-
readonly onResponse:
|
|
758
|
+
readonly onRequest: _alepha_core11.HookDescriptor<"server:onRequest">;
|
|
759
|
+
readonly onError: _alepha_core11.HookDescriptor<"server:onError">;
|
|
760
|
+
readonly onResponse: _alepha_core11.HookDescriptor<"server:onResponse">;
|
|
751
761
|
}
|
|
752
762
|
//#endregion
|
|
753
763
|
//#region src/providers/ServerNotReadyProvider.d.ts
|
|
@@ -760,7 +770,7 @@ declare class ServerLoggerProvider {
|
|
|
760
770
|
*/
|
|
761
771
|
declare class ServerNotReadyProvider {
|
|
762
772
|
protected readonly alepha: Alepha;
|
|
763
|
-
readonly onRequest:
|
|
773
|
+
readonly onRequest: _alepha_core11.HookDescriptor<"server:onRequest">;
|
|
764
774
|
}
|
|
765
775
|
//#endregion
|
|
766
776
|
//#region src/index.d.ts
|
|
@@ -815,6 +825,10 @@ declare module "alepha" {
|
|
|
815
825
|
req: IncomingMessage;
|
|
816
826
|
res: ServerResponse$1;
|
|
817
827
|
};
|
|
828
|
+
"web:request": {
|
|
829
|
+
req: Request;
|
|
830
|
+
res?: Response;
|
|
831
|
+
};
|
|
818
832
|
}
|
|
819
833
|
}
|
|
820
834
|
/**
|
|
@@ -828,7 +842,7 @@ declare module "alepha" {
|
|
|
828
842
|
* @see {@link $action}
|
|
829
843
|
* @module alepha.server
|
|
830
844
|
*/
|
|
831
|
-
declare const AlephaServer:
|
|
845
|
+
declare const AlephaServer: _alepha_core11.Service<_alepha_core11.Module<{}>>;
|
|
832
846
|
//#endregion
|
|
833
|
-
export { $action, $route, ActionDescriptor, ActionDescriptorFn, ActionDescriptorOptions, AlephaServer, BadRequestError, ClientRequestEntry, ClientRequestEntryContainer, ClientRequestOptions, ClientRequestResponse, ConflictError, ErrorSchema, FetchActionArgs, FetchOptions, FetchResponse, ForbiddenError, HttpAction, HttpClient, HttpClientPendingRequests, HttpError, HttpErrorLike, NodeHttpServerProvider, NotFoundError, Ok, RequestConfigSchema, ResponseBodyType, ResponseKind, RouteDescriptor, RouteDescriptorOptions, RouteMethod, ServerActionHandler, ServerActionRequest, ServerHandler, ServerLoggerProvider, ServerNotReadyProvider, ServerProvider, ServerRawRequest, ServerReply, ServerRequest, ServerRequestConfig, ServerRequestConfigEntry, ServerResponse, ServerResponseBody, ServerRoute, ServerRouteMatcher, ServerRouteRequestHandler, ServerRouterProvider, ServerTimingProvider, TRequestBody, TResponseBody, UnauthorizedError, ValidationError, errorNameByStatus, errorSchema, isHttpError, isMultipart, okSchema, routeMethods };
|
|
847
|
+
export { $action, $route, ActionDescriptor, ActionDescriptorFn, ActionDescriptorOptions, AlephaServer, BadRequestError, ClientRequestEntry, ClientRequestEntryContainer, ClientRequestOptions, ClientRequestResponse, ConflictError, ErrorSchema, FetchActionArgs, FetchOptions, FetchResponse, ForbiddenError, HttpAction, HttpClient, HttpClientPendingRequests, HttpError, HttpErrorLike, NodeHttpServerProvider, NotFoundError, Ok, RequestConfigSchema, RequestInitWithOptions, ResponseBodyType, ResponseKind, RouteDescriptor, RouteDescriptorOptions, RouteMethod, ServerActionHandler, ServerActionRequest, ServerHandler, ServerLoggerProvider, ServerNotReadyProvider, ServerProvider, ServerRawRequest, ServerReply, ServerRequest, ServerRequestConfig, ServerRequestConfigEntry, ServerResponse, ServerResponseBody, ServerRoute, ServerRouteMatcher, ServerRouteRequestHandler, ServerRouterProvider, ServerTimingProvider, TRequestBody, TResponseBody, UnauthorizedError, ValidationError, errorNameByStatus, errorSchema, isHttpError, isMultipart, okSchema, routeMethods };
|
|
834
848
|
//# sourceMappingURL=index.d.ts.map
|