alepha 0.7.2 → 0.7.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.
- package/{server/metrics.cjs → cache/redis.cjs} +3 -3
- package/cache/redis.d.ts +105 -0
- package/cache/redis.js +1 -0
- package/cache.d.ts +144 -217
- package/core.d.ts +122 -127
- package/datetime.d.ts +1 -1
- package/lock/redis.cjs +50 -0
- package/lock/redis.d.ts +26 -0
- package/lock/redis.js +47 -0
- package/lock.d.ts +58 -108
- package/package.json +41 -43
- package/postgres.d.ts +15 -26
- package/queue.d.ts +109 -162
- package/react/auth.d.ts +13 -5
- package/react.d.ts +20 -58
- package/redis.d.ts +11 -5
- package/retry.d.ts +30 -30
- package/scheduler.d.ts +22 -20
- package/security.d.ts +4 -4
- package/server/cache.cjs +12 -0
- package/server/cache.d.ts +51 -0
- package/server/cache.js +1 -0
- package/server/swagger.d.ts +7 -2
- package/server.d.ts +8 -30
- package/src/cache/redis.ts +1 -0
- package/src/lock/redis.ts +1 -0
- package/src/queue/redis.ts +1 -0
- package/src/server/cache.ts +1 -0
- package/src/topic/redis.ts +1 -0
- package/topic.d.ts +18 -84
- package/vite.d.ts +13 -19
- package/server/metrics.d.ts +0 -14
- package/server/metrics.js +0 -1
- package/src/server/metrics.ts +0 -1
package/scheduler.d.ts
CHANGED
|
@@ -2,9 +2,17 @@ import * as _alepha_core from '@alepha/core';
|
|
|
2
2
|
import { Async, KIND, OPTIONS, Static, Alepha } from '@alepha/core';
|
|
3
3
|
import { DurationLike, DateTimeProvider, Interval } from '@alepha/datetime';
|
|
4
4
|
import * as _alepha_lock from '@alepha/lock';
|
|
5
|
-
import {
|
|
5
|
+
import { ScheduledTask } from 'node-cron';
|
|
6
6
|
|
|
7
7
|
declare const KEY = "SCHEDULER";
|
|
8
|
+
/**
|
|
9
|
+
* Scheduler descriptor.
|
|
10
|
+
*/
|
|
11
|
+
declare const $scheduler: {
|
|
12
|
+
(options: SchedulerDescriptorOptions): SchedulerDescriptor;
|
|
13
|
+
[KIND]: string;
|
|
14
|
+
};
|
|
15
|
+
declare const isScheduler: (value: any) => value is SchedulerDescriptor;
|
|
8
16
|
type SchedulerDescriptorOptions = {
|
|
9
17
|
/**
|
|
10
18
|
* Function to run on schedule.
|
|
@@ -37,17 +45,6 @@ interface SchedulerDescriptor {
|
|
|
37
45
|
[OPTIONS]: SchedulerDescriptorOptions;
|
|
38
46
|
(): Promise<void>;
|
|
39
47
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Scheduler descriptor.
|
|
42
|
-
*
|
|
43
|
-
* @param options - The scheduler options.
|
|
44
|
-
* @returns The descriptor value.
|
|
45
|
-
*/
|
|
46
|
-
declare const $scheduler: {
|
|
47
|
-
(options: SchedulerDescriptorOptions): SchedulerDescriptor;
|
|
48
|
-
[KIND]: string;
|
|
49
|
-
};
|
|
50
|
-
declare const isScheduler: (value: any) => value is SchedulerDescriptor;
|
|
51
48
|
|
|
52
49
|
/** Symbol key applied to readonly types */
|
|
53
50
|
declare const ReadonlyKind: unique symbol;
|
|
@@ -157,9 +154,6 @@ declare class SchedulerDescriptorProvider {
|
|
|
157
154
|
protected run(options: SchedulerDescriptorOptions): Promise<void>;
|
|
158
155
|
/**
|
|
159
156
|
* Prefix the scheduler key.
|
|
160
|
-
*
|
|
161
|
-
* @param key
|
|
162
|
-
* @protected
|
|
163
157
|
*/
|
|
164
158
|
protected prefix(key: string): string;
|
|
165
159
|
/**
|
|
@@ -173,13 +167,21 @@ interface Scheduler {
|
|
|
173
167
|
name: string;
|
|
174
168
|
options: SchedulerDescriptorOptions;
|
|
175
169
|
trigger: () => Promise<void>;
|
|
176
|
-
|
|
170
|
+
cron?: ScheduledTask;
|
|
177
171
|
interval?: Interval;
|
|
178
172
|
}
|
|
179
173
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
174
|
+
/**
|
|
175
|
+
* Alepha Scheduler Module
|
|
176
|
+
*
|
|
177
|
+
* Generic interface for scheduling tasks.
|
|
178
|
+
*
|
|
179
|
+
* @see {@link $scheduler}
|
|
180
|
+
* @module alepha.scheduler
|
|
181
|
+
*/
|
|
182
|
+
declare class AlephaScheduler {
|
|
183
|
+
readonly name = "alepha.scheduler";
|
|
184
|
+
readonly $services: (alepha: Alepha) => Alepha;
|
|
183
185
|
}
|
|
184
186
|
|
|
185
|
-
export { $scheduler, type Scheduler, type SchedulerDescriptor, type SchedulerDescriptorOptions, SchedulerDescriptorProvider,
|
|
187
|
+
export { $scheduler, AlephaScheduler, type Scheduler, type SchedulerDescriptor, type SchedulerDescriptorOptions, SchedulerDescriptorProvider, isScheduler };
|
package/security.d.ts
CHANGED
|
@@ -697,9 +697,9 @@ declare module "alepha/core" {
|
|
|
697
697
|
};
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
|
-
declare class
|
|
701
|
-
|
|
702
|
-
|
|
700
|
+
declare class AlephaSecurity {
|
|
701
|
+
readonly name = "alepha.security";
|
|
702
|
+
readonly $services: (alepha: Alepha) => Alepha;
|
|
703
703
|
}
|
|
704
704
|
|
|
705
|
-
export { $permission, $realm, $role, $serviceAccount, type AccessTokenResponse, type ExtendedJWTPayload, InvalidPermissionError, type JwtParseResult, JwtProvider, type JwtServiceAccountDescriptorOptions, type JwtSignOptions, type KeyLoader, type KeyLoaderHolder, type Oauth2ServiceAccountDescriptorOptions, type Permission, type PermissionDescriptor, type PermissionDescriptorOptions, type Realm, type RealmConfig, type RealmDescriptor, type RealmDescriptorOptions, type Role, type RoleDescriptor, type RoleDescriptorOptions, type SecurityCheckResult, SecurityError,
|
|
705
|
+
export { $permission, $realm, $role, $serviceAccount, type AccessTokenResponse, AlephaSecurity, type ExtendedJWTPayload, InvalidPermissionError, type JwtParseResult, JwtProvider, type JwtServiceAccountDescriptorOptions, type JwtSignOptions, type KeyLoader, type KeyLoaderHolder, type Oauth2ServiceAccountDescriptorOptions, type Permission, type PermissionDescriptor, type PermissionDescriptorOptions, type Realm, type RealmConfig, type RealmDescriptor, type RealmDescriptorOptions, type Role, type RoleDescriptor, type RoleDescriptorOptions, type SecurityCheckResult, SecurityError, SecurityProvider, type SecurityUserAccountProvider, type ServiceAccountDescriptor, type ServiceAccountDescriptorOptions, type ServiceAccountStore, type UserAccountInfo, type UserAccountToken, permissionSchema, roleSchema };
|
package/server/cache.cjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var serverCache = require('@alepha/server-cache');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.keys(serverCache).forEach(function (k) {
|
|
8
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return serverCache[k]; }
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as _alepha_core from '@alepha/core';
|
|
2
|
+
import { Alepha, OPTIONS, Module } from '@alepha/core';
|
|
3
|
+
import { CacheDescriptorOptions, CacheDescriptorProvider, Cache } from '@alepha/cache';
|
|
4
|
+
import { DurationLike, DateTimeProvider } from '@alepha/datetime';
|
|
5
|
+
import { ServerHandler, ServerRequestConfig } from '@alepha/server';
|
|
6
|
+
|
|
7
|
+
declare module "alepha/server" {
|
|
8
|
+
interface ServerRoute {
|
|
9
|
+
cache?: ServiceRouteCache;
|
|
10
|
+
}
|
|
11
|
+
interface ActionDescriptor {
|
|
12
|
+
invalidate: () => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
declare class ServerCacheProvider {
|
|
16
|
+
protected readonly log: _alepha_core.Logger;
|
|
17
|
+
protected readonly alepha: Alepha;
|
|
18
|
+
protected readonly cacheProvider: CacheDescriptorProvider;
|
|
19
|
+
protected readonly time: DateTimeProvider;
|
|
20
|
+
protected readonly caches: Map<ServerHandler, RouteCache>;
|
|
21
|
+
readonly onConfigure: _alepha_core.HookDescriptor<"configure">;
|
|
22
|
+
readonly onRoute: _alepha_core.HookDescriptor<"server:onRoute">;
|
|
23
|
+
readonly onRequest: _alepha_core.HookDescriptor<"server:onRequest">;
|
|
24
|
+
readonly onSend: _alepha_core.HookDescriptor<"server:onResponse">;
|
|
25
|
+
generateETag(content: string): string;
|
|
26
|
+
invalidate(route: RouteLike): Promise<void>;
|
|
27
|
+
protected getCacheByRoute(route: RouteLike): RouteCache | undefined;
|
|
28
|
+
protected createCacheKey(args: ServerRequestConfig): string;
|
|
29
|
+
}
|
|
30
|
+
type ServiceRouteCache = boolean | DurationLike | Omit<CacheDescriptorOptions<any>, "handler" | "key">;
|
|
31
|
+
type RouteCache = Cache<{
|
|
32
|
+
contentType?: string;
|
|
33
|
+
body: string;
|
|
34
|
+
status?: number;
|
|
35
|
+
lastModified: string;
|
|
36
|
+
hash: string;
|
|
37
|
+
}>;
|
|
38
|
+
type RouteLike = {
|
|
39
|
+
[OPTIONS]: {
|
|
40
|
+
handler?: ServerHandler;
|
|
41
|
+
};
|
|
42
|
+
} | {
|
|
43
|
+
handler?: ServerHandler;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
declare class AlephaServerCache implements Module {
|
|
47
|
+
readonly name = "alepha.server.cache";
|
|
48
|
+
readonly $services: (alepha: Alepha) => Alepha;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { AlephaServerCache, ServerCacheProvider, type ServiceRouteCache };
|
package/server/cache.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@alepha/server-cache';
|
package/server/swagger.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _alepha_core from '@alepha/core';
|
|
2
|
-
import { KIND, OPTIONS, Alepha, TObject } from '@alepha/core';
|
|
2
|
+
import { KIND, OPTIONS, Alepha, TObject, Module } from '@alepha/core';
|
|
3
3
|
import { OpenAPIV3 } from 'openapi-types';
|
|
4
4
|
import { ServerActionDescriptorProvider, ServerRouterProvider, ServerRouteAction } from '@alepha/server';
|
|
5
5
|
import { ServerStaticProvider } from '@alepha/server-static';
|
|
@@ -100,4 +100,9 @@ declare class ServerSwaggerProvider {
|
|
|
100
100
|
protected configureSwaggerUi(prefix: string, options: SwaggerDescriptorOptions): Promise<void>;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
declare class AlephaServerSwagger implements Module {
|
|
104
|
+
readonly name = "alepha.server.swagger";
|
|
105
|
+
readonly $services: (alepha: Alepha) => Alepha;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export { $swagger, AlephaServerSwagger, ServerSwaggerProvider, type SwaggerDescriptor, type SwaggerDescriptorOptions, type SwaggerUiOptions };
|
package/server.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import * as _alepha_core from '@alepha/core';
|
|
2
|
-
import { Static as Static$1, TObject as TObject$1, TSchema as TSchema$2, Async, StreamLike, Alepha, FileLike, OPTIONS, KIND,
|
|
2
|
+
import { Static as Static$1, TObject as TObject$1, TSchema as TSchema$2, Async, StreamLike, Alepha, FileLike, OPTIONS, KIND, Module } from '@alepha/core';
|
|
3
3
|
export { KIND } from '@alepha/core';
|
|
4
|
-
import * as _alepha_cache from '@alepha/cache';
|
|
5
|
-
import { CacheDescriptorOptions } from '@alepha/cache';
|
|
6
|
-
import { DurationLike, DateTimeProvider } from '@alepha/datetime';
|
|
7
4
|
import { UserAccountToken, Permission, ServiceAccountDescriptor as ServiceAccountDescriptor$1, SecurityProvider, JwtProvider } from '@alepha/security';
|
|
8
5
|
import { IncomingMessage, ServerResponse as ServerResponse$1 } from 'node:http';
|
|
9
6
|
import { Readable } from 'node:stream';
|
|
10
7
|
import { ReadableStream } from 'node:stream/web';
|
|
11
8
|
import { Route, RouterProvider } from '@alepha/router';
|
|
9
|
+
import * as _alepha_cache from '@alepha/cache';
|
|
10
|
+
import { DurationLike, DateTimeProvider } from '@alepha/datetime';
|
|
12
11
|
import * as _alepha_retry from '@alepha/retry';
|
|
13
12
|
import { BusboyConfig } from '@fastify/busboy';
|
|
14
13
|
import * as http from 'http';
|
|
@@ -210,8 +209,6 @@ interface TSchema$1 extends TKind$1, SchemaOptions$1 {
|
|
|
210
209
|
declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
|
|
211
210
|
type RouteMethod = (typeof routeMethods)[number];
|
|
212
211
|
|
|
213
|
-
type ServiceRouteCache = boolean | DurationLike | Omit<CacheDescriptorOptions<any>, "handler" | "key">;
|
|
214
|
-
|
|
215
212
|
declare const envSchema$4: TObject$1<{
|
|
216
213
|
SERVER_ALS_ENABLED: TBoolean;
|
|
217
214
|
}>;
|
|
@@ -289,10 +286,6 @@ interface ServerRoute<TConfig extends RequestConfigSchema = RequestConfigSchema>
|
|
|
289
286
|
* @see ServerSecurityProvider
|
|
290
287
|
*/
|
|
291
288
|
secure?: ServerRouteSecure;
|
|
292
|
-
/**
|
|
293
|
-
* @see ServerCacheProvider
|
|
294
|
-
*/
|
|
295
|
-
cache?: ServiceRouteCache;
|
|
296
289
|
}
|
|
297
290
|
type ServerResponseBody<TConfig extends RequestConfigSchema = RequestConfigSchema> = TConfig["response"] extends TSchema$2 ? Static$1<TConfig["response"]> : ResponseBodyType;
|
|
298
291
|
type ResponseType = "json" | "text" | "void" | "file" | "any";
|
|
@@ -537,11 +530,6 @@ interface ActionDescriptorOptions<TConfig extends RequestConfigSchema = RequestC
|
|
|
537
530
|
* Main route handler. This is where the route logic is implemented.
|
|
538
531
|
*/
|
|
539
532
|
handler?: ServerHandler<TConfig>;
|
|
540
|
-
/**
|
|
541
|
-
* If true, the route will be cached.
|
|
542
|
-
* - Number as seconds or boolean to enable cache.
|
|
543
|
-
*/
|
|
544
|
-
cache?: boolean | DurationLike | Omit<CacheDescriptorOptions<any>, "handler" | "key">;
|
|
545
533
|
}
|
|
546
534
|
interface ActionDescriptor<TConfig extends RequestConfigSchema = RequestConfigSchema> {
|
|
547
535
|
[KIND]: typeof KEY$2;
|
|
@@ -558,11 +546,6 @@ interface ActionDescriptor<TConfig extends RequestConfigSchema = RequestConfigSc
|
|
|
558
546
|
* Name of the permission required to access this route.
|
|
559
547
|
*/
|
|
560
548
|
permission: () => string;
|
|
561
|
-
/**
|
|
562
|
-
* Invalidate the cache for this action.
|
|
563
|
-
* This is only available if the action has cache enabled.
|
|
564
|
-
*/
|
|
565
|
-
invalidate: () => Promise<void>;
|
|
566
549
|
}
|
|
567
550
|
declare const $action: {
|
|
568
551
|
<TConfig extends RequestConfigSchema>(options: ActionDescriptorOptions<TConfig>): ActionDescriptor<TConfig>;
|
|
@@ -982,8 +965,8 @@ declare class RemoteDescriptorProvider {
|
|
|
982
965
|
}) => Promise<{
|
|
983
966
|
prefix?: string | undefined;
|
|
984
967
|
links: {
|
|
985
|
-
group?: string | undefined;
|
|
986
968
|
method?: string | undefined;
|
|
969
|
+
group?: string | undefined;
|
|
987
970
|
requestBodyType?: string | undefined;
|
|
988
971
|
service?: string | undefined;
|
|
989
972
|
path: string;
|
|
@@ -1137,8 +1120,6 @@ type Ok = Static$1<typeof okSchema>;
|
|
|
1137
1120
|
declare const envSchema: _alepha_core.TObject<{
|
|
1138
1121
|
SERVER_LINKS_ENABLED: TBoolean;
|
|
1139
1122
|
SERVER_HEALTH_ENABLED: TBoolean;
|
|
1140
|
-
SERVER_NOT_READY_ENABLED: TBoolean;
|
|
1141
|
-
SERVER_TIMING_ENABLED: TOptional<TBoolean>;
|
|
1142
1123
|
}>;
|
|
1143
1124
|
declare module "@alepha/core" {
|
|
1144
1125
|
interface Hooks {
|
|
@@ -1185,16 +1166,13 @@ declare module "@alepha/core" {
|
|
|
1185
1166
|
interface Env extends Partial<Static$1<typeof envSchema>> {
|
|
1186
1167
|
}
|
|
1187
1168
|
}
|
|
1188
|
-
declare class
|
|
1189
|
-
static plugins: Array<Service>;
|
|
1169
|
+
declare class AlephaServer implements Module {
|
|
1190
1170
|
protected readonly env: {
|
|
1191
|
-
SERVER_TIMING_ENABLED?: boolean | undefined;
|
|
1192
1171
|
SERVER_LINKS_ENABLED: boolean;
|
|
1193
1172
|
SERVER_HEALTH_ENABLED: boolean;
|
|
1194
|
-
SERVER_NOT_READY_ENABLED: boolean;
|
|
1195
1173
|
};
|
|
1196
|
-
|
|
1197
|
-
|
|
1174
|
+
readonly name = "alepha.server";
|
|
1175
|
+
readonly $services: (alepha: Alepha) => void;
|
|
1198
1176
|
}
|
|
1199
1177
|
|
|
1200
|
-
export { $action, $client, $proxy, $remote, $route, type ActionDescriptor, type ActionDescriptorOptions, type ApiLink, type ApiLinksResponse, BadRequestError, type ClientRequestEntry, type ClientRequestEntryContainer, type ClientRequestOptions, type ClientRequestResponse, type ClientScope, ConflictError, type FetchFactoryAdditionalOptions, type FetchLinkArgs, type FetchResponse, type FetchRunOptions, ForbiddenError, HttpClient, type HttpClientLink, type HttpClientPendingRequests, HttpError, type HttpErrorLike, type HttpVirtualClient, NodeHttpServerProvider, NotFoundError, type Ok, type ProxyDescriptor, type ProxyDescriptorOptions, ProxyDescriptorProvider, type RemoteDescriptor, type RemoteDescriptorOptions, RemoteDescriptorProvider, type RequestConfigSchema, type ResponseBodyType, type ResponseType, type RouteDescriptor, type RouteDescriptorOptions, type RouteMethod, ServerActionDescriptorProvider, type ServerHandler, ServerHealthProvider, ServerLinksProvider, ServerLoggerProvider, type ServerMiddlewareHandler,
|
|
1178
|
+
export { $action, $client, $proxy, $remote, $route, type ActionDescriptor, type ActionDescriptorOptions, AlephaServer, type ApiLink, type ApiLinksResponse, BadRequestError, type ClientRequestEntry, type ClientRequestEntryContainer, type ClientRequestOptions, type ClientRequestResponse, type ClientScope, ConflictError, type FetchFactoryAdditionalOptions, type FetchLinkArgs, type FetchResponse, type FetchRunOptions, ForbiddenError, HttpClient, type HttpClientLink, type HttpClientPendingRequests, HttpError, type HttpErrorLike, type HttpVirtualClient, NodeHttpServerProvider, NotFoundError, type Ok, type ProxyDescriptor, type ProxyDescriptorOptions, ProxyDescriptorProvider, type RemoteDescriptor, type RemoteDescriptorOptions, RemoteDescriptorProvider, type RequestConfigSchema, type ResponseBodyType, type ResponseType, type RouteDescriptor, type RouteDescriptorOptions, type RouteMethod, ServerActionDescriptorProvider, type ServerHandler, ServerHealthProvider, ServerLinksProvider, ServerLoggerProvider, type ServerMiddlewareHandler, ServerMultipartProvider, ServerNotReadyProvider, ServerProvider, type ServerRawRequest, type ServerRemote, type ServerReply, type ServerRequest, type ServerRequestConfig, type ServerRequestConfigEntry, type ServerResponse, type ServerResponseBody, type ServerRoute, type ServerRouteAction, type ServerRouteSecure, type ServerRouteWithHandler, ServerRouterProvider, ServerSecurityProvider, ServerTimingProvider, UnauthorizedError, ValidationError, apiLinkSchema, apiLinksResponseSchema, errorNameByStatus, errorSchema, isHttpError, isServerAction, okSchema, routeMethods };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@alepha/cache-redis";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@alepha/lock-redis";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@alepha/queue-redis";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@alepha/server-cache";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@alepha/topic-redis";
|
package/topic.d.ts
CHANGED
|
@@ -1,50 +1,6 @@
|
|
|
1
1
|
import * as _alepha_core from '@alepha/core';
|
|
2
|
-
import { TSchema
|
|
2
|
+
import { TSchema, KIND, OPTIONS, Static, Alepha, Module } from '@alepha/core';
|
|
3
3
|
import { DurationLike, DateTimeProvider } from '@alepha/datetime';
|
|
4
|
-
import { RedisProvider, RedisSubscriberProvider } from '@alepha/redis';
|
|
5
|
-
|
|
6
|
-
/** Symbol key applied to readonly types */
|
|
7
|
-
declare const ReadonlyKind: unique symbol;
|
|
8
|
-
/** Symbol key applied to optional types */
|
|
9
|
-
declare const OptionalKind: unique symbol;
|
|
10
|
-
/** Symbol key applied to types */
|
|
11
|
-
declare const Hint: unique symbol;
|
|
12
|
-
/** Symbol key applied to types */
|
|
13
|
-
declare const Kind: unique symbol;
|
|
14
|
-
|
|
15
|
-
interface TUnsafe<T> extends TSchema {
|
|
16
|
-
[Kind]: string;
|
|
17
|
-
static: T;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface SchemaOptions {
|
|
21
|
-
$schema?: string;
|
|
22
|
-
/** Id for this schema */
|
|
23
|
-
$id?: string;
|
|
24
|
-
/** Title of this schema */
|
|
25
|
-
title?: string;
|
|
26
|
-
/** Description of this schema */
|
|
27
|
-
description?: string;
|
|
28
|
-
/** Default value for this schema */
|
|
29
|
-
default?: any;
|
|
30
|
-
/** Example values matching this schema */
|
|
31
|
-
examples?: any;
|
|
32
|
-
/** Optional annotation for readOnly */
|
|
33
|
-
readOnly?: boolean;
|
|
34
|
-
/** Optional annotation for writeOnly */
|
|
35
|
-
writeOnly?: boolean;
|
|
36
|
-
[prop: string]: any;
|
|
37
|
-
}
|
|
38
|
-
interface TKind {
|
|
39
|
-
[Kind]: string;
|
|
40
|
-
}
|
|
41
|
-
interface TSchema extends TKind, SchemaOptions {
|
|
42
|
-
[ReadonlyKind]?: string;
|
|
43
|
-
[OptionalKind]?: string;
|
|
44
|
-
[Hint]?: string;
|
|
45
|
-
params: unknown[];
|
|
46
|
-
static: unknown;
|
|
47
|
-
}
|
|
48
4
|
|
|
49
5
|
declare class TopicProvider {
|
|
50
6
|
constructor();
|
|
@@ -74,8 +30,8 @@ type UnSubscribeFn = () => Promise<void>;
|
|
|
74
30
|
|
|
75
31
|
declare const KEY$1 = "TOPIC";
|
|
76
32
|
interface TopicMessageSchema {
|
|
77
|
-
headers?: TSchema
|
|
78
|
-
payload: TSchema
|
|
33
|
+
headers?: TSchema;
|
|
34
|
+
payload: TSchema;
|
|
79
35
|
}
|
|
80
36
|
interface TopicDescriptorOptions<T extends TopicMessageSchema = TopicMessageSchema> {
|
|
81
37
|
name?: string;
|
|
@@ -178,29 +134,6 @@ declare class MemoryTopicProvider implements TopicProvider {
|
|
|
178
134
|
unsubscribe(topic: string): Promise<void>;
|
|
179
135
|
}
|
|
180
136
|
|
|
181
|
-
declare class RedisTopicProvider implements TopicProvider {
|
|
182
|
-
protected readonly env: {
|
|
183
|
-
REDIS_TOPIC_PREFIX: string;
|
|
184
|
-
};
|
|
185
|
-
protected readonly redisProvider: RedisProvider;
|
|
186
|
-
protected readonly redisSubscriberProvider: RedisSubscriberProvider;
|
|
187
|
-
protected readonly log: _alepha_core.Logger;
|
|
188
|
-
protected readonly stop: _alepha_core.HookDescriptor<"stop">;
|
|
189
|
-
prefix(queue: string): string;
|
|
190
|
-
/**
|
|
191
|
-
* Publish a message to a topic.
|
|
192
|
-
*/
|
|
193
|
-
publish(topic: string, message: string): Promise<void>;
|
|
194
|
-
/**
|
|
195
|
-
* Subscribe to a topic.
|
|
196
|
-
*/
|
|
197
|
-
subscribe(name: string, callback: SubscribeCallback): Promise<UnSubscribeFn>;
|
|
198
|
-
/**
|
|
199
|
-
* Unsubscribe from a topic.
|
|
200
|
-
*/
|
|
201
|
-
unsubscribe(name: string, callback?: SubscribeCallback): Promise<void>;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
137
|
declare class TopicDescriptorProvider {
|
|
205
138
|
protected readonly log: _alepha_core.Logger;
|
|
206
139
|
protected readonly alepha: Alepha;
|
|
@@ -267,19 +200,20 @@ declare class TopicDescriptorProvider {
|
|
|
267
200
|
};
|
|
268
201
|
}
|
|
269
202
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
203
|
+
/**
|
|
204
|
+
* Alepha Topic Module
|
|
205
|
+
*
|
|
206
|
+
* Generic interface for pub/sub messaging.
|
|
207
|
+
* Gives you the ability to create topics and subscribers.
|
|
208
|
+
* This module provides only a memory implementation of the topic provider.
|
|
209
|
+
*
|
|
210
|
+
* @see {@link $topic}
|
|
211
|
+
* @see {@link $subscriber}
|
|
212
|
+
* @module alepha.topic
|
|
213
|
+
*/
|
|
214
|
+
declare class AlephaTopic implements Module {
|
|
215
|
+
readonly name = "alepha.topic";
|
|
216
|
+
readonly $services: (alepha: Alepha) => Alepha;
|
|
283
217
|
}
|
|
284
218
|
|
|
285
|
-
export { $subscriber, $topic,
|
|
219
|
+
export { $subscriber, $topic, AlephaTopic, MemoryTopicProvider, type SubscribeCallback, type SubscriberDescriptor, type SubscriberDescriptorOptions, type TopicDescriptor, type TopicDescriptorOptions, TopicDescriptorProvider, type TopicMessage, type TopicMessageSchema, TopicProvider, TopicTimeoutError, type TopicWaitOptions, type UnSubscribeFn };
|
package/vite.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { Alepha } from '@alepha/core';
|
|
2
|
-
import {
|
|
2
|
+
import { Plugin } from 'vite';
|
|
3
3
|
import { BrotliOptions, ZlibOptions } from 'node:zlib';
|
|
4
4
|
|
|
5
5
|
interface ViteAlephaBuildOptions {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @default 'src/index.server.ts'
|
|
7
|
+
* Path to the entry file for the server build.
|
|
8
|
+
* If empty, SSR build will be skipped.
|
|
10
9
|
*/
|
|
11
|
-
|
|
10
|
+
serverEntry?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Set false to skip the client build.
|
|
13
|
+
* This is useful if you only want to build the server-side application.
|
|
14
|
+
*/
|
|
15
|
+
client?: false;
|
|
12
16
|
/**
|
|
13
17
|
* If true, the build will be optimized for Vercel deployment.
|
|
14
18
|
*
|
|
@@ -17,25 +21,15 @@ interface ViteAlephaBuildOptions {
|
|
|
17
21
|
* @default false
|
|
18
22
|
*/
|
|
19
23
|
vercel?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Vite server options to override the default server configuration.
|
|
22
|
-
*/
|
|
23
|
-
server?: false | UserConfig;
|
|
24
|
-
client?: false;
|
|
25
|
-
/**
|
|
26
|
-
* If true, all compatible pages will be pre-rendered.
|
|
27
|
-
*/
|
|
28
|
-
prerender?: boolean;
|
|
29
24
|
}
|
|
30
25
|
declare function viteAlephaBuild(options?: ViteAlephaBuildOptions): Promise<Plugin>;
|
|
31
26
|
|
|
32
27
|
interface ViteAlephaDevOptions {
|
|
33
28
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @default 'src/index.server.ts'
|
|
29
|
+
* Path to the entry file for the server build.
|
|
30
|
+
* If empty, plugin will be disabled.
|
|
37
31
|
*/
|
|
38
|
-
|
|
32
|
+
serverEntry?: string;
|
|
39
33
|
/**
|
|
40
34
|
* Enable or disable debug mode
|
|
41
35
|
*
|
|
@@ -44,7 +38,7 @@ interface ViteAlephaDevOptions {
|
|
|
44
38
|
debug?: boolean;
|
|
45
39
|
}
|
|
46
40
|
/**
|
|
47
|
-
*
|
|
41
|
+
* Plug Alepha into Vite development server.
|
|
48
42
|
*/
|
|
49
43
|
declare function viteAlephaDev(options?: ViteAlephaDevOptions): Promise<Plugin>;
|
|
50
44
|
|
package/server/metrics.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as _alepha_server from '@alepha/server';
|
|
2
|
-
|
|
3
|
-
declare class ServerMetricsProvider {
|
|
4
|
-
private readonly register;
|
|
5
|
-
private cpuUsage;
|
|
6
|
-
private memoryUsage;
|
|
7
|
-
private gcDuration;
|
|
8
|
-
private heapUsage;
|
|
9
|
-
readonly metrics: _alepha_server.ActionDescriptor<_alepha_server.RequestConfigSchema>;
|
|
10
|
-
constructor();
|
|
11
|
-
private collectMetrics;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { ServerMetricsProvider };
|
package/server/metrics.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@alepha/server-metrics';
|
package/src/server/metrics.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@alepha/server-metrics";
|