alepha 0.11.2 → 0.11.4

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 (50) hide show
  1. package/api/files.d.ts +1 -439
  2. package/api/jobs.d.ts +1 -218
  3. package/api/notifications.d.ts +1 -264
  4. package/api/users.d.ts +1 -924
  5. package/batch.d.ts +1 -585
  6. package/bucket.d.ts +1 -507
  7. package/cache/redis.d.ts +1 -40
  8. package/cache.d.ts +1 -288
  9. package/command.d.ts +1 -238
  10. package/core.d.ts +1 -1563
  11. package/datetime.d.ts +5 -3
  12. package/devtools.d.ts +1 -368
  13. package/email.d.ts +1 -144
  14. package/fake.cjs +8 -0
  15. package/fake.d.ts +1 -0
  16. package/fake.js +1 -0
  17. package/file.d.ts +1 -53
  18. package/lock/redis.d.ts +1 -24
  19. package/lock.d.ts +1 -552
  20. package/logger.d.ts +1 -284
  21. package/package.json +57 -50
  22. package/postgres.d.ts +1 -1931
  23. package/queue/redis.d.ts +1 -29
  24. package/queue.d.ts +1 -760
  25. package/react/auth.d.ts +1 -499
  26. package/react/form.d.ts +1 -188
  27. package/react/head.d.ts +1 -120
  28. package/react/i18n.d.ts +1 -118
  29. package/react.d.ts +1 -929
  30. package/redis.d.ts +1 -82
  31. package/scheduler.d.ts +1 -145
  32. package/security.d.ts +1 -586
  33. package/server/cache.d.ts +1 -163
  34. package/server/compress.d.ts +1 -32
  35. package/server/cookies.d.ts +1 -144
  36. package/server/cors.d.ts +1 -27
  37. package/server/health.d.ts +1 -59
  38. package/server/helmet.d.ts +1 -69
  39. package/server/links.d.ts +1 -316
  40. package/server/metrics.d.ts +1 -35
  41. package/server/multipart.d.ts +1 -42
  42. package/server/proxy.d.ts +1 -234
  43. package/server/security.d.ts +1 -87
  44. package/server/static.d.ts +1 -119
  45. package/server/swagger.d.ts +1 -148
  46. package/server.d.ts +1 -849
  47. package/topic/redis.d.ts +1 -42
  48. package/topic.d.ts +1 -819
  49. package/ui.d.ts +1 -619
  50. package/vite.d.ts +1 -197
package/server/cache.d.ts CHANGED
@@ -1,163 +1 @@
1
- import * as _alepha_cache0 from "alepha/cache";
2
- import { CacheDescriptorOptions } from "alepha/cache";
3
- import * as _alepha_core1 from "alepha";
4
- import { Alepha } from "alepha";
5
- import { DateTimeProvider, DurationLike } from "alepha/datetime";
6
- import * as _alepha_logger0 from "alepha/logger";
7
- import { RequestConfigSchema, ServerRequest, ServerRoute } from "alepha/server";
8
-
9
- //#region src/providers/ServerCacheProvider.d.ts
10
- declare module "alepha/server" {
11
- interface ServerRoute {
12
- /**
13
- * Enable caching for this route.
14
- * - If true: enables both store and etag
15
- * - If object: fine-grained control over store, etag, and cache-control headers
16
- *
17
- * @default false
18
- */
19
- cache?: ServerRouteCache;
20
- }
21
- interface ActionDescriptor<TConfig extends RequestConfigSchema> {
22
- invalidate: () => Promise<void>;
23
- }
24
- }
25
- declare class ServerCacheProvider {
26
- protected readonly log: _alepha_logger0.Logger;
27
- protected readonly alepha: Alepha;
28
- protected readonly time: DateTimeProvider;
29
- protected readonly cache: _alepha_cache0.CacheDescriptorFn<RouteCacheEntry, any[]>;
30
- generateETag(content: string): string;
31
- invalidate(route: ServerRoute): Promise<void>;
32
- protected readonly onActionRequest: _alepha_core1.HookDescriptor<"action:onRequest">;
33
- protected readonly onActionResponse: _alepha_core1.HookDescriptor<"action:onResponse">;
34
- protected readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
35
- protected readonly onSend: _alepha_core1.HookDescriptor<"server:onSend">;
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;
41
- protected createCacheKey(route: ServerRoute, config?: ServerRequest): string;
42
- }
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
- };
123
- interface RouteCacheEntry {
124
- contentType?: string;
125
- body: any;
126
- status?: number;
127
- lastModified: string;
128
- hash: string;
129
- }
130
- //#endregion
131
- //#region src/index.d.ts
132
- /**
133
- * Plugin for Alepha Server that provides server-side caching capabilities.
134
- * It uses the Alepha Cache module to cache responses from server actions ($action).
135
- * It also provides a ETag-based cache invalidation mechanism.
136
- *
137
- * @example
138
- * ```ts
139
- * import { Alepha } from "alepha";
140
- * import { $action } from "alepha/server";
141
- * import { AlephaServerCache } from "alepha/server/cache";
142
- *
143
- * class ApiServer {
144
- * hello = $action({
145
- * cache: true,
146
- * handler: () => "Hello, World!",
147
- * });
148
- * }
149
- *
150
- * const alepha = Alepha.create()
151
- * .with(AlephaServerCache)
152
- * .with(ApiServer);
153
- *
154
- * run(alepha);
155
- * ```
156
- *
157
- * @see {@link ServerCacheProvider}
158
- * @module alepha.server.cache
159
- */
160
- declare const AlephaServerCache: _alepha_core1.Service<_alepha_core1.Module<{}>>;
161
- //#endregion
162
- export { AlephaServerCache, ServerCacheProvider, ServerRouteCache };
163
- //# sourceMappingURL=index.d.ts.map
1
+ export * from '@alepha/server-cache';
@@ -1,32 +1 @@
1
- import * as _alepha_core0 from "alepha";
2
- import { HookDescriptor } from "alepha";
3
- import { ServerResponse } from "alepha/server";
4
- import { Transform } from "node:stream";
5
-
6
- //#region src/providers/ServerCompressProvider.d.ts
7
- declare class ServerCompressProvider {
8
- static compressors: Record<string, {
9
- compress: (...args: any[]) => Promise<Buffer>;
10
- stream: (options?: any) => Transform;
11
- } | undefined>;
12
- options: ServerCompressProviderOptions;
13
- readonly onResponse: HookDescriptor<"server:onResponse">;
14
- protected isAllowedContentType(contentType: string | undefined): boolean;
15
- protected compress(encoding: keyof typeof ServerCompressProvider.compressors, response: ServerResponse): Promise<void>;
16
- protected getParams(encoding: keyof typeof ServerCompressProvider.compressors): Record<number, any>;
17
- protected setHeaders(response: ServerResponse, encoding: keyof typeof ServerCompressProvider.compressors): void;
18
- }
19
- interface ServerCompressProviderOptions {
20
- allowedContentTypes: string[];
21
- }
22
- //#endregion
23
- //#region src/index.d.ts
24
- /**
25
- * Plugin for Alepha Server that provides server-side compression capabilities.
26
- *
27
- * Compresses responses using gzip, brotli, or zstd based on the `Accept-Encoding` header.
28
- */
29
- declare const AlephaServerCompress: _alepha_core0.Service<_alepha_core0.Module<{}>>;
30
- //#endregion
31
- export { AlephaServerCompress, ServerCompressProvider, ServerCompressProviderOptions };
32
- //# sourceMappingURL=index.d.ts.map
1
+ export * from '@alepha/server-compress';
@@ -1,144 +1 @@
1
- import * as _alepha_core1 from "alepha";
2
- import { Alepha, Descriptor, KIND, Static, TSchema } from "alepha";
3
- import { DateTimeProvider, DurationLike } from "alepha/datetime";
4
- import * as _alepha_logger0 from "alepha/logger";
5
-
6
- //#region src/services/CookieParser.d.ts
7
- declare class CookieParser {
8
- parseRequestCookies(header: string): Record<string, string>;
9
- serializeResponseCookies(cookies: Record<string, Cookie | null>, isHttps: boolean): string[];
10
- cookieToString(name: string, cookie: Cookie, isHttps?: boolean): string;
11
- }
12
- //#endregion
13
- //#region src/providers/ServerCookiesProvider.d.ts
14
- declare class ServerCookiesProvider {
15
- protected readonly alepha: Alepha;
16
- protected readonly log: _alepha_logger0.Logger;
17
- protected readonly cookieParser: CookieParser;
18
- protected readonly dateTimeProvider: DateTimeProvider;
19
- protected readonly env: {
20
- APP_SECRET: string;
21
- };
22
- protected readonly ALGORITHM = "aes-256-gcm";
23
- protected readonly IV_LENGTH = 16;
24
- protected readonly AUTH_TAG_LENGTH = 16;
25
- protected readonly SIGNATURE_LENGTH = 32;
26
- readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
27
- readonly onAction: _alepha_core1.HookDescriptor<"action:onRequest">;
28
- readonly onSend: _alepha_core1.HookDescriptor<"server:onSend">;
29
- protected getCookiesFromContext(cookies?: Cookies): Cookies;
30
- getCookie<T extends TSchema>(name: string, options: CookieDescriptorOptions<T>, contextCookies?: Cookies): Static<T> | undefined;
31
- setCookie<T extends TSchema>(name: string, options: CookieDescriptorOptions<T>, data: Static<T>, contextCookies?: Cookies): void;
32
- deleteCookie<T extends TSchema>(name: string, contextCookies?: Cookies): void;
33
- protected encrypt(text: string): string;
34
- protected decrypt(encryptedText: string): string;
35
- secretKey(): string;
36
- protected sign(data: string): string;
37
- }
38
- //#endregion
39
- //#region src/descriptors/$cookie.d.ts
40
- /**
41
- * Declares a type-safe, configurable HTTP cookie.
42
- * This descriptor provides methods to get, set, and delete the cookie
43
- * within the server request/response cycle.
44
- */
45
- declare const $cookie: {
46
- <T extends TSchema>(options: CookieDescriptorOptions<T>): AbstractCookieDescriptor<T>;
47
- [KIND]: typeof CookieDescriptor;
48
- };
49
- interface CookieDescriptorOptions<T extends TSchema> {
50
- /** The schema for the cookie's value, used for validation and type safety. */
51
- schema: T;
52
- /** The name of the cookie. */
53
- name?: string;
54
- /** The cookie's path. Defaults to "/". */
55
- path?: string;
56
- /** Time-to-live for the cookie. Maps to `Max-Age`. */
57
- ttl?: DurationLike;
58
- /** If true, the cookie is only sent over HTTPS. Defaults to true in production. */
59
- secure?: boolean;
60
- /** If true, the cookie cannot be accessed by client-side scripts. */
61
- httpOnly?: boolean;
62
- /** SameSite policy for the cookie. Defaults to "lax". */
63
- sameSite?: "strict" | "lax" | "none";
64
- /** The domain for the cookie. */
65
- domain?: string;
66
- /** If true, the cookie value will be compressed using zlib. */
67
- compress?: boolean;
68
- /** If true, the cookie value will be encrypted. Requires `COOKIE_SECRET` env var. */
69
- encrypt?: boolean;
70
- /** If true, the cookie will be signed to prevent tampering. Requires `COOKIE_SECRET` env var. */
71
- sign?: boolean;
72
- }
73
- interface AbstractCookieDescriptor<T extends TSchema> {
74
- readonly name: string;
75
- readonly options: CookieDescriptorOptions<T>;
76
- set(value: Static<T>, options?: {
77
- cookies?: Cookies;
78
- ttl?: DurationLike;
79
- }): void;
80
- get(options?: {
81
- cookies?: Cookies;
82
- }): Static<T> | undefined;
83
- del(options?: {
84
- cookies?: Cookies;
85
- }): void;
86
- }
87
- declare class CookieDescriptor<T extends TSchema> extends Descriptor<CookieDescriptorOptions<T>> implements AbstractCookieDescriptor<T> {
88
- protected readonly serverCookiesProvider: ServerCookiesProvider;
89
- get schema(): T;
90
- get name(): string;
91
- /**
92
- * Sets the cookie with the given value in the current request's response.
93
- */
94
- set(value: Static<T>, options?: {
95
- cookies?: Cookies;
96
- ttl?: DurationLike;
97
- }): void;
98
- /**
99
- * Gets the cookie value from the current request. Returns undefined if not found or invalid.
100
- */
101
- get(options?: {
102
- cookies?: Cookies;
103
- }): Static<T> | undefined;
104
- /**
105
- * Deletes the cookie in the current request's response.
106
- */
107
- del(options?: {
108
- cookies?: Cookies;
109
- }): void;
110
- }
111
- interface Cookies {
112
- req: Record<string, string>;
113
- res: Record<string, Cookie | null>;
114
- }
115
- interface Cookie {
116
- value: string;
117
- path?: string;
118
- maxAge?: number;
119
- secure?: boolean;
120
- httpOnly?: boolean;
121
- sameSite?: "strict" | "lax" | "none";
122
- domain?: string;
123
- }
124
- //#endregion
125
- //#region src/index.d.ts
126
- declare module "alepha/server" {
127
- interface ServerRequest {
128
- cookies: Cookies;
129
- }
130
- }
131
- /**
132
- * Provides HTTP cookie management capabilities for server requests and responses with type-safe cookie descriptors.
133
- *
134
- * The server-cookies module enables declarative cookie handling using the `$cookie` descriptor on class properties.
135
- * It offers automatic cookie parsing, secure cookie configuration, and seamless integration with server routes
136
- * for managing user sessions, preferences, and authentication tokens.
137
- *
138
- * @see {@link $cookie}
139
- * @module alepha.server.cookies
140
- */
141
- declare const AlephaServerCookies: _alepha_core1.Service<_alepha_core1.Module<{}>>;
142
- //#endregion
143
- export { $cookie, AbstractCookieDescriptor, AlephaServerCookies, Cookie, CookieDescriptor, CookieDescriptorOptions, Cookies, ServerCookiesProvider };
144
- //# sourceMappingURL=index.d.ts.map
1
+ export * from '@alepha/server-cookies';
package/server/cors.d.ts CHANGED
@@ -1,27 +1 @@
1
- import * as _alepha_core1 from "alepha";
2
- import { ServerRouterProvider } from "alepha/server";
3
-
4
- //#region src/providers/ServerCorsProvider.d.ts
5
- declare class ServerCorsProvider {
6
- protected readonly serverRouterProvider: ServerRouterProvider;
7
- options: ServerCorsProviderOptions;
8
- protected readonly configure: _alepha_core1.HookDescriptor<"configure">;
9
- protected readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
10
- isOriginAllowed(origin: string | undefined, allowed: ServerCorsProviderOptions["origin"]): boolean;
11
- }
12
- interface ServerCorsProviderOptions {
13
- origin?: string | string[] | ((origin: string | undefined) => boolean);
14
- methods: string[];
15
- headers: string[];
16
- credentials?: boolean;
17
- maxAge?: number;
18
- }
19
- //#endregion
20
- //#region src/index.d.ts
21
- /**
22
- * Plugin for configuring CORS on the Alepha server.
23
- */
24
- declare const AlephaServerCors: _alepha_core1.Service<_alepha_core1.Module<ServerCorsProviderOptions>>;
25
- //#endregion
26
- export { AlephaServerCors, ServerCorsProvider, ServerCorsProviderOptions };
27
- //# sourceMappingURL=index.d.ts.map
1
+ export * from '@alepha/server-cors';
@@ -1,59 +1 @@
1
- import * as _alepha_core0 from "alepha";
2
- import { Alepha } from "alepha";
3
- import * as _alepha_server0 from "alepha/server";
4
- import { DateTimeProvider } from "alepha/datetime";
5
- import * as typebox5 from "typebox";
6
- import * as dayjs0 from "dayjs";
7
-
8
- //#region src/providers/ServerHealthProvider.d.ts
9
- /**
10
- * Register `/health` & `/healthz` endpoint.
11
- *
12
- * - Provides basic health information about the server.
13
- */
14
- declare class ServerHealthProvider {
15
- protected readonly time: DateTimeProvider;
16
- protected readonly alepha: Alepha;
17
- readonly health: _alepha_server0.RouteDescriptor<{
18
- response: typebox5.TObject<{
19
- message: typebox5.TString;
20
- uptime: typebox5.TNumber;
21
- date: typebox5.TCodec<typebox5.TString, dayjs0.Dayjs>;
22
- ready: typebox5.TBoolean;
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
- };
39
- }
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
49
- //#region src/index.d.ts
50
- /**
51
- * Plugin for Alepha Server that provides health-check endpoints.
52
- *
53
- * @see {@link ServerHealthProvider}
54
- * @module alepha.server.health
55
- */
56
- declare const AlephaServerHealth: _alepha_core0.Service<_alepha_core0.Module<{}>>;
57
- //#endregion
58
- export { AlephaServerHealth, ServerHealthProvider, healthSchema };
59
- //# sourceMappingURL=index.d.ts.map
1
+ export * from '@alepha/server-health';
@@ -1,69 +1 @@
1
- import * as _alepha_core1 from "alepha";
2
- import { Alepha } from "alepha";
3
-
4
- //#region src/providers/ServerHelmetProvider.d.ts
5
- type CspDirective = string | string[];
6
- interface CspDirectives {
7
- "default-src"?: CspDirective;
8
- "script-src"?: CspDirective;
9
- "style-src"?: CspDirective;
10
- "img-src"?: CspDirective;
11
- "connect-src"?: CspDirective;
12
- "font-src"?: CspDirective;
13
- "object-src"?: CspDirective;
14
- "media-src"?: CspDirective;
15
- "frame-src"?: CspDirective;
16
- sandbox?: CspDirective | boolean;
17
- "report-uri"?: string;
18
- "child-src"?: CspDirective;
19
- "form-action"?: CspDirective;
20
- "frame-ancestors"?: CspDirective;
21
- "plugin-types"?: CspDirective;
22
- "base-uri"?: CspDirective;
23
- [key: string]: CspDirective | undefined | boolean;
24
- }
25
- interface CspOptions {
26
- directives: CspDirectives;
27
- }
28
- interface HstsOptions {
29
- maxAge?: number;
30
- includeSubDomains?: boolean;
31
- preload?: boolean;
32
- }
33
- interface HelmetOptions {
34
- isSecure?: boolean;
35
- strictTransportSecurity?: HstsOptions | false;
36
- xContentTypeOptions?: false;
37
- xFrameOptions?: "DENY" | "SAMEORIGIN" | false;
38
- xXssProtection?: false;
39
- contentSecurityPolicy?: CspOptions | false | "default";
40
- referrerPolicy?: "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url" | false;
41
- }
42
- /**
43
- * Provides a configurable way to apply essential HTTP security headers
44
- * to every server response, without external dependencies.
45
- */
46
- declare class ServerHelmetProvider {
47
- protected readonly alepha: Alepha;
48
- /**
49
- * The configuration options. These can be overridden during
50
- * the application's configuration phase using `alepha.configure()`.
51
- */
52
- options: HelmetOptions;
53
- protected defaultCspDirectives(): CspDirectives;
54
- protected buildHeaders(): Record<string, string>;
55
- protected readonly onResponse: _alepha_core1.HookDescriptor<"server:onResponse">;
56
- }
57
- //#endregion
58
- //#region src/index.d.ts
59
- /**
60
- * Automatically adds important HTTP security headers to every response
61
- * to help protect your application from common web vulnerabilities.
62
- *
63
- * @see {@link ServerHelmetProvider}
64
- * @module alepha.server.helmet
65
- */
66
- declare const AlephaServerHelmet: _alepha_core1.Service<_alepha_core1.Module<{}>>;
67
- //#endregion
68
- export { AlephaServerHelmet, CspDirectives, CspOptions, HelmetOptions, HstsOptions, ServerHelmetProvider };
69
- //# sourceMappingURL=index.d.ts.map
1
+ export * from '@alepha/server-helmet';