alepha 0.11.9 → 0.11.10
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/README.md +55 -17
- package/dist/index.cjs +15805 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +15804 -0
- package/dist/index.js.map +1 -0
- package/package.json +36 -365
- package/src/assets/biomeJson.ts +33 -0
- package/src/assets/tsconfigJson.ts +17 -0
- package/src/assets/viteConfigTs.ts +14 -0
- package/src/commands/BiomeCommands.ts +60 -0
- package/src/commands/CoreCommands.ts +266 -0
- package/src/commands/DrizzleCommands.ts +403 -0
- package/src/commands/VerifyCommands.ts +48 -0
- package/src/commands/ViteCommands.ts +152 -0
- package/src/index.ts +35 -0
- package/src/services/ProcessRunner.ts +89 -0
- package/src/version.ts +7 -0
- package/api/files.cjs +0 -8
- package/api/files.d.ts +0 -438
- package/api/files.js +0 -1
- package/api/jobs.cjs +0 -8
- package/api/jobs.d.ts +0 -327
- package/api/jobs.js +0 -1
- package/api/notifications.cjs +0 -8
- package/api/notifications.d.ts +0 -263
- package/api/notifications.js +0 -1
- package/api/users.cjs +0 -8
- package/api/users.d.ts +0 -923
- package/api/users.js +0 -1
- package/api/verifications.cjs +0 -8
- package/api/verifications.d.ts +0 -1
- package/api/verifications.js +0 -1
- package/batch.cjs +0 -8
- package/batch.d.ts +0 -154
- package/batch.js +0 -1
- package/bucket.cjs +0 -8
- package/bucket.d.ts +0 -520
- package/bucket.js +0 -1
- package/cache/redis.cjs +0 -8
- package/cache/redis.d.ts +0 -40
- package/cache/redis.js +0 -1
- package/cache.cjs +0 -8
- package/cache.d.ts +0 -288
- package/cache.js +0 -1
- package/command.cjs +0 -8
- package/command.d.ts +0 -269
- package/command.js +0 -1
- package/core.cjs +0 -8
- package/core.d.ts +0 -1904
- package/core.js +0 -1
- package/datetime.cjs +0 -8
- package/datetime.d.ts +0 -144
- package/datetime.js +0 -1
- package/devtools.cjs +0 -8
- package/devtools.d.ts +0 -252
- package/devtools.js +0 -1
- package/email.cjs +0 -8
- package/email.d.ts +0 -187
- package/email.js +0 -1
- package/fake.cjs +0 -8
- package/fake.d.ts +0 -73
- package/fake.js +0 -1
- package/file.cjs +0 -8
- package/file.d.ts +0 -528
- package/file.js +0 -1
- package/lock/redis.cjs +0 -8
- package/lock/redis.d.ts +0 -24
- package/lock/redis.js +0 -1
- package/lock.cjs +0 -8
- package/lock.d.ts +0 -552
- package/lock.js +0 -1
- package/logger.cjs +0 -8
- package/logger.d.ts +0 -287
- package/logger.js +0 -1
- package/postgres.cjs +0 -8
- package/postgres.d.ts +0 -2143
- package/postgres.js +0 -1
- package/queue/redis.cjs +0 -8
- package/queue/redis.d.ts +0 -29
- package/queue/redis.js +0 -1
- package/queue.cjs +0 -8
- package/queue.d.ts +0 -760
- package/queue.js +0 -1
- package/react/auth.cjs +0 -8
- package/react/auth.d.ts +0 -504
- package/react/auth.js +0 -1
- package/react/form.cjs +0 -8
- package/react/form.d.ts +0 -211
- package/react/form.js +0 -1
- package/react/head.cjs +0 -8
- package/react/head.d.ts +0 -120
- package/react/head.js +0 -1
- package/react/i18n.cjs +0 -8
- package/react/i18n.d.ts +0 -168
- package/react/i18n.js +0 -1
- package/react.cjs +0 -8
- package/react.d.ts +0 -1263
- package/react.js +0 -1
- package/redis.cjs +0 -8
- package/redis.d.ts +0 -82
- package/redis.js +0 -1
- package/retry.cjs +0 -8
- package/retry.d.ts +0 -162
- package/retry.js +0 -1
- package/router.cjs +0 -8
- package/router.d.ts +0 -45
- package/router.js +0 -1
- package/scheduler.cjs +0 -8
- package/scheduler.d.ts +0 -145
- package/scheduler.js +0 -1
- package/security.cjs +0 -8
- package/security.d.ts +0 -586
- package/security.js +0 -1
- package/server/cache.cjs +0 -8
- package/server/cache.d.ts +0 -163
- package/server/cache.js +0 -1
- package/server/compress.cjs +0 -8
- package/server/compress.d.ts +0 -38
- package/server/compress.js +0 -1
- package/server/cookies.cjs +0 -8
- package/server/cookies.d.ts +0 -144
- package/server/cookies.js +0 -1
- package/server/cors.cjs +0 -8
- package/server/cors.d.ts +0 -45
- package/server/cors.js +0 -1
- package/server/health.cjs +0 -8
- package/server/health.d.ts +0 -58
- package/server/health.js +0 -1
- package/server/helmet.cjs +0 -8
- package/server/helmet.d.ts +0 -98
- package/server/helmet.js +0 -1
- package/server/links.cjs +0 -8
- package/server/links.d.ts +0 -322
- package/server/links.js +0 -1
- package/server/metrics.cjs +0 -8
- package/server/metrics.d.ts +0 -35
- package/server/metrics.js +0 -1
- package/server/multipart.cjs +0 -8
- package/server/multipart.d.ts +0 -42
- package/server/multipart.js +0 -1
- package/server/proxy.cjs +0 -8
- package/server/proxy.d.ts +0 -234
- package/server/proxy.js +0 -1
- package/server/security.cjs +0 -8
- package/server/security.d.ts +0 -92
- package/server/security.js +0 -1
- package/server/static.cjs +0 -8
- package/server/static.d.ts +0 -119
- package/server/static.js +0 -1
- package/server/swagger.cjs +0 -8
- package/server/swagger.d.ts +0 -161
- package/server/swagger.js +0 -1
- package/server.cjs +0 -8
- package/server.d.ts +0 -849
- package/server.js +0 -1
- package/topic/redis.cjs +0 -8
- package/topic/redis.d.ts +0 -42
- package/topic/redis.js +0 -1
- package/topic.cjs +0 -8
- package/topic.d.ts +0 -819
- package/topic.js +0 -1
- package/vite.cjs +0 -8
- package/vite.d.ts +0 -186
- package/vite.js +0 -1
package/server/cache.d.ts
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
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
|
package/server/cache.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@alepha/server-cache'
|
package/server/compress.cjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var m = require('@alepha/server-compress');
|
|
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
|
-
});
|
package/server/compress.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as _alepha_core0 from "alepha";
|
|
2
|
-
import { Alepha, 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 module "alepha" {
|
|
8
|
-
interface State {
|
|
9
|
-
"alepha.server.compress.options"?: ServerCompressProviderOptions;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
declare class ServerCompressProvider {
|
|
13
|
-
static compressors: Record<string, {
|
|
14
|
-
compress: (...args: any[]) => Promise<Buffer>;
|
|
15
|
-
stream: (options?: any) => Transform;
|
|
16
|
-
} | undefined>;
|
|
17
|
-
protected readonly alepha: Alepha;
|
|
18
|
-
protected get options(): ServerCompressProviderOptions;
|
|
19
|
-
readonly onResponse: HookDescriptor<"server:onResponse">;
|
|
20
|
-
protected isAllowedContentType(contentType: string | undefined): boolean;
|
|
21
|
-
protected compress(encoding: keyof typeof ServerCompressProvider.compressors, response: ServerResponse): Promise<void>;
|
|
22
|
-
protected getParams(encoding: keyof typeof ServerCompressProvider.compressors): Record<number, any>;
|
|
23
|
-
protected setHeaders(response: ServerResponse, encoding: keyof typeof ServerCompressProvider.compressors): void;
|
|
24
|
-
}
|
|
25
|
-
interface ServerCompressProviderOptions {
|
|
26
|
-
allowedContentTypes: string[];
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/index.d.ts
|
|
30
|
-
/**
|
|
31
|
-
* Plugin for Alepha Server that provides server-side compression capabilities.
|
|
32
|
-
*
|
|
33
|
-
* Compresses responses using gzip, brotli, or zstd based on the `Accept-Encoding` header.
|
|
34
|
-
*/
|
|
35
|
-
declare const AlephaServerCompress: _alepha_core0.Service<_alepha_core0.Module>;
|
|
36
|
-
//#endregion
|
|
37
|
-
export { AlephaServerCompress, ServerCompressProvider, ServerCompressProviderOptions };
|
|
38
|
-
//# sourceMappingURL=index.d.ts.map
|
package/server/compress.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@alepha/server-compress'
|
package/server/cookies.cjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var m = require('@alepha/server-cookies');
|
|
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
|
-
});
|
package/server/cookies.d.ts
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
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
|
package/server/cookies.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@alepha/server-cookies'
|
package/server/cors.cjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var m = require('@alepha/server-cors');
|
|
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
|
-
});
|
package/server/cors.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import * as _alepha_core1 from "alepha";
|
|
2
|
-
import { Static } from "alepha";
|
|
3
|
-
import { ServerRouterProvider } from "alepha/server";
|
|
4
|
-
import * as typebox0 from "typebox";
|
|
5
|
-
|
|
6
|
-
//#region src/providers/ServerCorsProvider.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* CORS configuration atom
|
|
9
|
-
*/
|
|
10
|
-
declare const corsOptions: _alepha_core1.Atom<typebox0.TObject<{
|
|
11
|
-
origin: typebox0.TOptional<typebox0.TString>;
|
|
12
|
-
methods: typebox0.TArray<typebox0.TString>;
|
|
13
|
-
headers: typebox0.TArray<typebox0.TString>;
|
|
14
|
-
credentials: typebox0.TOptional<typebox0.TBoolean>;
|
|
15
|
-
maxAge: typebox0.TOptional<typebox0.TNumber>;
|
|
16
|
-
}>, "alepha.server.cors.options">;
|
|
17
|
-
type CorsOptions = Static<typeof corsOptions.schema>;
|
|
18
|
-
declare module "alepha" {
|
|
19
|
-
interface State {
|
|
20
|
-
[corsOptions.key]: CorsOptions;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
declare class ServerCorsProvider {
|
|
24
|
-
protected readonly serverRouterProvider: ServerRouterProvider;
|
|
25
|
-
protected readonly options: Readonly<{
|
|
26
|
-
origin?: string | undefined;
|
|
27
|
-
credentials?: boolean | undefined;
|
|
28
|
-
maxAge?: number | undefined;
|
|
29
|
-
methods: string[];
|
|
30
|
-
headers: string[];
|
|
31
|
-
}>;
|
|
32
|
-
protected readonly configure: _alepha_core1.HookDescriptor<"configure">;
|
|
33
|
-
protected readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
|
|
34
|
-
isOriginAllowed(origin: string | undefined, allowed: ServerCorsProviderOptions["origin"]): boolean;
|
|
35
|
-
}
|
|
36
|
-
type ServerCorsProviderOptions = CorsOptions;
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/index.d.ts
|
|
39
|
-
/**
|
|
40
|
-
* Plugin for configuring CORS on the Alepha server.
|
|
41
|
-
*/
|
|
42
|
-
declare const AlephaServerCors: _alepha_core1.Service<_alepha_core1.Module>;
|
|
43
|
-
//#endregion
|
|
44
|
-
export { AlephaServerCors, CorsOptions, ServerCorsProvider, ServerCorsProviderOptions, corsOptions };
|
|
45
|
-
//# sourceMappingURL=index.d.ts.map
|
package/server/cors.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@alepha/server-cors'
|
package/server/health.cjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var m = require('@alepha/server-health');
|
|
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
|
-
});
|
package/server/health.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
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 typebox4 from "typebox";
|
|
6
|
-
|
|
7
|
-
//#region src/providers/ServerHealthProvider.d.ts
|
|
8
|
-
/**
|
|
9
|
-
* Register `/health` & `/healthz` endpoint.
|
|
10
|
-
*
|
|
11
|
-
* - Provides basic health information about the server.
|
|
12
|
-
*/
|
|
13
|
-
declare class ServerHealthProvider {
|
|
14
|
-
protected readonly time: DateTimeProvider;
|
|
15
|
-
protected readonly alepha: Alepha;
|
|
16
|
-
readonly health: _alepha_server0.RouteDescriptor<{
|
|
17
|
-
response: typebox4.TObject<{
|
|
18
|
-
message: typebox4.TString;
|
|
19
|
-
uptime: typebox4.TNumber;
|
|
20
|
-
date: typebox4.TString;
|
|
21
|
-
ready: typebox4.TBoolean;
|
|
22
|
-
}>;
|
|
23
|
-
}>;
|
|
24
|
-
readonly healthz: _alepha_server0.RouteDescriptor<{
|
|
25
|
-
response: typebox4.TObject<{
|
|
26
|
-
message: typebox4.TString;
|
|
27
|
-
uptime: typebox4.TNumber;
|
|
28
|
-
date: typebox4.TString;
|
|
29
|
-
ready: typebox4.TBoolean;
|
|
30
|
-
}>;
|
|
31
|
-
}>;
|
|
32
|
-
protected healthCheck(): {
|
|
33
|
-
message: string;
|
|
34
|
-
uptime: number;
|
|
35
|
-
date: string;
|
|
36
|
-
ready: boolean;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region src/schemas/healthSchema.d.ts
|
|
41
|
-
declare const healthSchema: typebox4.TObject<{
|
|
42
|
-
message: typebox4.TString;
|
|
43
|
-
uptime: typebox4.TNumber;
|
|
44
|
-
date: typebox4.TString;
|
|
45
|
-
ready: typebox4.TBoolean;
|
|
46
|
-
}>;
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region src/index.d.ts
|
|
49
|
-
/**
|
|
50
|
-
* Plugin for Alepha Server that provides health-check endpoints.
|
|
51
|
-
*
|
|
52
|
-
* @see {@link ServerHealthProvider}
|
|
53
|
-
* @module alepha.server.health
|
|
54
|
-
*/
|
|
55
|
-
declare const AlephaServerHealth: _alepha_core0.Service<_alepha_core0.Module>;
|
|
56
|
-
//#endregion
|
|
57
|
-
export { AlephaServerHealth, ServerHealthProvider, healthSchema };
|
|
58
|
-
//# sourceMappingURL=index.d.ts.map
|
package/server/health.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@alepha/server-health'
|
package/server/helmet.cjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var m = require('@alepha/server-helmet');
|
|
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
|
-
});
|
package/server/helmet.d.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import * as _alepha_core1 from "alepha";
|
|
2
|
-
import { Alepha, Static } from "alepha";
|
|
3
|
-
import * as typebox0 from "typebox";
|
|
4
|
-
|
|
5
|
-
//#region src/providers/ServerHelmetProvider.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Helmet security headers configuration atom
|
|
8
|
-
*/
|
|
9
|
-
declare const helmetOptions: _alepha_core1.Atom<typebox0.TObject<{
|
|
10
|
-
isSecure: typebox0.TOptional<typebox0.TBoolean>;
|
|
11
|
-
strictTransportSecurity: typebox0.TOptional<typebox0.TObject<{
|
|
12
|
-
maxAge: typebox0.TOptional<typebox0.TNumber>;
|
|
13
|
-
includeSubDomains: typebox0.TOptional<typebox0.TBoolean>;
|
|
14
|
-
preload: typebox0.TOptional<typebox0.TBoolean>;
|
|
15
|
-
}>>;
|
|
16
|
-
xContentTypeOptions: typebox0.TOptional<typebox0.TBoolean>;
|
|
17
|
-
xFrameOptions: typebox0.TOptional<typebox0.TUnsafe<"DENY" | "SAMEORIGIN">>;
|
|
18
|
-
xXssProtection: typebox0.TOptional<typebox0.TBoolean>;
|
|
19
|
-
contentSecurityPolicy: typebox0.TOptional<typebox0.TObject<{
|
|
20
|
-
directives: typebox0.TRecord<"^.*$", typebox0.TAny>;
|
|
21
|
-
}>>;
|
|
22
|
-
referrerPolicy: typebox0.TOptional<typebox0.TUnsafe<"no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url">>;
|
|
23
|
-
}>, "alepha.server.helmet.options">;
|
|
24
|
-
type HelmetOptions = Static<typeof helmetOptions.schema>;
|
|
25
|
-
declare module "alepha" {
|
|
26
|
-
interface State {
|
|
27
|
-
[helmetOptions.key]: HelmetOptions;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
type CspDirective = string | string[];
|
|
31
|
-
interface CspDirectives {
|
|
32
|
-
"default-src"?: CspDirective;
|
|
33
|
-
"script-src"?: CspDirective;
|
|
34
|
-
"style-src"?: CspDirective;
|
|
35
|
-
"img-src"?: CspDirective;
|
|
36
|
-
"connect-src"?: CspDirective;
|
|
37
|
-
"font-src"?: CspDirective;
|
|
38
|
-
"object-src"?: CspDirective;
|
|
39
|
-
"media-src"?: CspDirective;
|
|
40
|
-
"frame-src"?: CspDirective;
|
|
41
|
-
sandbox?: CspDirective | boolean;
|
|
42
|
-
"report-uri"?: string;
|
|
43
|
-
"child-src"?: CspDirective;
|
|
44
|
-
"form-action"?: CspDirective;
|
|
45
|
-
"frame-ancestors"?: CspDirective;
|
|
46
|
-
"plugin-types"?: CspDirective;
|
|
47
|
-
"base-uri"?: CspDirective;
|
|
48
|
-
[key: string]: CspDirective | undefined | boolean;
|
|
49
|
-
}
|
|
50
|
-
interface CspOptions {
|
|
51
|
-
directives: CspDirectives;
|
|
52
|
-
}
|
|
53
|
-
interface HstsOptions {
|
|
54
|
-
maxAge?: number;
|
|
55
|
-
includeSubDomains?: boolean;
|
|
56
|
-
preload?: boolean;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Provides a configurable way to apply essential HTTP security headers
|
|
60
|
-
* to every server response, without external dependencies.
|
|
61
|
-
*/
|
|
62
|
-
declare class ServerHelmetProvider {
|
|
63
|
-
protected readonly alepha: Alepha;
|
|
64
|
-
/**
|
|
65
|
-
* The configuration options loaded from the atom.
|
|
66
|
-
*/
|
|
67
|
-
protected readonly options: Readonly<{
|
|
68
|
-
isSecure?: boolean | undefined;
|
|
69
|
-
strictTransportSecurity?: {
|
|
70
|
-
maxAge?: number | undefined;
|
|
71
|
-
includeSubDomains?: boolean | undefined;
|
|
72
|
-
preload?: boolean | undefined;
|
|
73
|
-
} | undefined;
|
|
74
|
-
xContentTypeOptions?: boolean | undefined;
|
|
75
|
-
xFrameOptions?: "DENY" | "SAMEORIGIN" | undefined;
|
|
76
|
-
xXssProtection?: boolean | undefined;
|
|
77
|
-
contentSecurityPolicy?: {
|
|
78
|
-
directives: Record<string, any>;
|
|
79
|
-
} | undefined;
|
|
80
|
-
referrerPolicy?: "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url" | undefined;
|
|
81
|
-
}>;
|
|
82
|
-
protected defaultCspDirectives(): CspDirectives;
|
|
83
|
-
protected buildHeaders(): Record<string, string>;
|
|
84
|
-
protected readonly onResponse: _alepha_core1.HookDescriptor<"server:onResponse">;
|
|
85
|
-
}
|
|
86
|
-
//#endregion
|
|
87
|
-
//#region src/index.d.ts
|
|
88
|
-
/**
|
|
89
|
-
* Automatically adds important HTTP security headers to every response
|
|
90
|
-
* to help protect your application from common web vulnerabilities.
|
|
91
|
-
*
|
|
92
|
-
* @see {@link ServerHelmetProvider}
|
|
93
|
-
* @module alepha.server.helmet
|
|
94
|
-
*/
|
|
95
|
-
declare const AlephaServerHelmet: _alepha_core1.Service<_alepha_core1.Module>;
|
|
96
|
-
//#endregion
|
|
97
|
-
export { AlephaServerHelmet, CspDirectives, CspOptions, HelmetOptions, HstsOptions, ServerHelmetProvider, helmetOptions };
|
|
98
|
-
//# sourceMappingURL=index.d.ts.map
|
package/server/helmet.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@alepha/server-helmet'
|
package/server/links.cjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var m = require('@alepha/server-links');
|
|
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
|
-
});
|