alepha 0.7.3 → 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/cache/redis.cjs +12 -0
- 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 +36 -38
- 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 +20 -18
- package/security.d.ts +4 -4
- package/server/cache.d.ts +5 -5
- package/server/swagger.d.ts +7 -2
- package/server.d.ts +5 -10
- package/src/cache/redis.ts +1 -0
- package/src/lock/redis.ts +1 -0
- package/src/queue/redis.ts +1 -0
- package/src/topic/redis.ts +1 -0
- package/topic.d.ts +18 -84
package/scheduler.d.ts
CHANGED
|
@@ -5,6 +5,14 @@ import * as _alepha_lock from '@alepha/lock';
|
|
|
5
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
|
/**
|
|
@@ -177,9 +171,17 @@ interface Scheduler {
|
|
|
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.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _alepha_core from '@alepha/core';
|
|
2
|
-
import { Alepha, OPTIONS } from '@alepha/core';
|
|
2
|
+
import { Alepha, OPTIONS, Module } from '@alepha/core';
|
|
3
3
|
import { CacheDescriptorOptions, CacheDescriptorProvider, Cache } from '@alepha/cache';
|
|
4
4
|
import { DurationLike, DateTimeProvider } from '@alepha/datetime';
|
|
5
5
|
import { ServerHandler, ServerRequestConfig } from '@alepha/server';
|
|
@@ -43,9 +43,9 @@ type RouteLike = {
|
|
|
43
43
|
handler?: ServerHandler;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
declare class
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
declare class AlephaServerCache implements Module {
|
|
47
|
+
readonly name = "alepha.server.cache";
|
|
48
|
+
readonly $services: (alepha: Alepha) => Alepha;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export {
|
|
51
|
+
export { AlephaServerCache, ServerCacheProvider, type ServiceRouteCache };
|
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,5 +1,5 @@
|
|
|
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
4
|
import { UserAccountToken, Permission, ServiceAccountDescriptor as ServiceAccountDescriptor$1, SecurityProvider, JwtProvider } from '@alepha/security';
|
|
5
5
|
import { IncomingMessage, ServerResponse as ServerResponse$1 } from 'node:http';
|
|
@@ -1120,8 +1120,6 @@ type Ok = Static$1<typeof okSchema>;
|
|
|
1120
1120
|
declare const envSchema: _alepha_core.TObject<{
|
|
1121
1121
|
SERVER_LINKS_ENABLED: TBoolean;
|
|
1122
1122
|
SERVER_HEALTH_ENABLED: TBoolean;
|
|
1123
|
-
SERVER_NOT_READY_ENABLED: TBoolean;
|
|
1124
|
-
SERVER_TIMING_ENABLED: TOptional<TBoolean>;
|
|
1125
1123
|
}>;
|
|
1126
1124
|
declare module "@alepha/core" {
|
|
1127
1125
|
interface Hooks {
|
|
@@ -1168,16 +1166,13 @@ declare module "@alepha/core" {
|
|
|
1168
1166
|
interface Env extends Partial<Static$1<typeof envSchema>> {
|
|
1169
1167
|
}
|
|
1170
1168
|
}
|
|
1171
|
-
declare class
|
|
1172
|
-
static plugins: Array<Service>;
|
|
1169
|
+
declare class AlephaServer implements Module {
|
|
1173
1170
|
protected readonly env: {
|
|
1174
|
-
SERVER_TIMING_ENABLED?: boolean | undefined;
|
|
1175
1171
|
SERVER_LINKS_ENABLED: boolean;
|
|
1176
1172
|
SERVER_HEALTH_ENABLED: boolean;
|
|
1177
|
-
SERVER_NOT_READY_ENABLED: boolean;
|
|
1178
1173
|
};
|
|
1179
|
-
|
|
1180
|
-
|
|
1174
|
+
readonly name = "alepha.server";
|
|
1175
|
+
readonly $services: (alepha: Alepha) => void;
|
|
1181
1176
|
}
|
|
1182
1177
|
|
|
1183
|
-
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/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 };
|