alepha 0.6.7 → 0.6.9
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.d.ts +353 -1
- package/core.d.ts +998 -19
- package/datetime.d.ts +167 -1
- package/lock.d.ts +280 -1
- package/package.json +36 -22
- package/postgres.d.ts +1452 -1
- package/queue.d.ts +305 -1
- package/react/auth.d.ts +300 -1
- package/react.d.ts +617 -1
- package/redis.d.ts +135 -1
- package/scheduler.d.ts +185 -1
- package/security.d.ts +651 -1
- package/server/cookies.d.ts +56 -1
- package/server/metrics.d.ts +14 -1
- package/server/proxy.d.ts +34 -1
- package/server/static.d.ts +103 -1
- package/server/swagger.d.ts +102 -1
- package/server.d.ts +879 -1
- package/topic.d.ts +301 -1
- package/vite.d.ts +80 -1
package/topic.d.ts
CHANGED
|
@@ -1 +1,301 @@
|
|
|
1
|
-
|
|
1
|
+
import * as _alepha_core from '@alepha/core';
|
|
2
|
+
import { TSchema as TSchema$1, KIND, OPTIONS, Static, Alepha } from '@alepha/core';
|
|
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
|
+
|
|
49
|
+
declare class TopicProvider {
|
|
50
|
+
/**
|
|
51
|
+
* Publish a message to a topic.
|
|
52
|
+
*
|
|
53
|
+
* @param topic - The topic to publish to.
|
|
54
|
+
* @param message - The message to publish.
|
|
55
|
+
*/
|
|
56
|
+
publish(topic: string, message: string): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Subscribe to a topic.
|
|
59
|
+
*
|
|
60
|
+
* @param topic - The topic to subscribe to.
|
|
61
|
+
* @param callback - The callback to call when a message is received.
|
|
62
|
+
*/
|
|
63
|
+
subscribe(topic: string, callback: SubscribeCallback): Promise<UnSubscribeFn>;
|
|
64
|
+
/**
|
|
65
|
+
* Unsubscribe from a topic.
|
|
66
|
+
*
|
|
67
|
+
* @param topic - The topic to unsubscribe from.
|
|
68
|
+
*/
|
|
69
|
+
unsubscribe(topic: string): Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
type SubscribeCallback = (message: string) => Promise<void> | void;
|
|
72
|
+
type UnSubscribeFn = () => Promise<void>;
|
|
73
|
+
|
|
74
|
+
declare const KEY$1 = "TOPIC";
|
|
75
|
+
interface TopicMessageSchema {
|
|
76
|
+
headers?: TSchema$1;
|
|
77
|
+
payload: TSchema$1;
|
|
78
|
+
}
|
|
79
|
+
interface TopicDescriptorOptions<T extends TopicMessageSchema = TopicMessageSchema> {
|
|
80
|
+
name?: string;
|
|
81
|
+
description?: string;
|
|
82
|
+
provider?: "memory" | (() => TopicProvider);
|
|
83
|
+
schema: T;
|
|
84
|
+
handler?: (message: {
|
|
85
|
+
payload: Static<T["payload"]>;
|
|
86
|
+
}) => Promise<void>;
|
|
87
|
+
}
|
|
88
|
+
interface TopicDescriptor<T extends TopicMessageSchema = TopicMessageSchema> {
|
|
89
|
+
[KIND]: typeof KEY$1;
|
|
90
|
+
[OPTIONS]: TopicDescriptorOptions<T>;
|
|
91
|
+
name(): string;
|
|
92
|
+
provider(): TopicProvider;
|
|
93
|
+
publish(payload: Static<T["payload"]>): Promise<void>;
|
|
94
|
+
subscribe(fn: (message: TopicMessage<T>) => void): Promise<UnSubscribeFn>;
|
|
95
|
+
wait(options?: TopicWaitOptions<T>): Promise<Static<T["payload"]>>;
|
|
96
|
+
}
|
|
97
|
+
interface TopicMessage<T extends TopicMessageSchema = TopicMessageSchema> {
|
|
98
|
+
payload: Static<T["payload"]>;
|
|
99
|
+
}
|
|
100
|
+
interface TopicWaitOptions<T extends TopicMessageSchema> {
|
|
101
|
+
timeout?: DurationLike;
|
|
102
|
+
filter?: (message: {
|
|
103
|
+
payload: Static<T["payload"]>;
|
|
104
|
+
}) => boolean;
|
|
105
|
+
}
|
|
106
|
+
declare const $topic: {
|
|
107
|
+
<T extends TopicMessageSchema>(options: TopicDescriptorOptions<T>): TopicDescriptor<T>;
|
|
108
|
+
[KIND]: string;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
declare const KEY = "SUBSCRIBER";
|
|
112
|
+
/**
|
|
113
|
+
*
|
|
114
|
+
*/
|
|
115
|
+
interface SubscriberDescriptorOptions<T extends TopicMessageSchema = TopicMessageSchema> {
|
|
116
|
+
/**
|
|
117
|
+
*
|
|
118
|
+
*/
|
|
119
|
+
topic: TopicDescriptor<T>;
|
|
120
|
+
/**
|
|
121
|
+
*
|
|
122
|
+
* @param message
|
|
123
|
+
*/
|
|
124
|
+
handler: (message: {
|
|
125
|
+
payload: Static<T["payload"]>;
|
|
126
|
+
}) => Promise<void>;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
*
|
|
130
|
+
*/
|
|
131
|
+
interface SubscriberDescriptor<T extends TopicMessageSchema = TopicMessageSchema> {
|
|
132
|
+
[KIND]: typeof KEY;
|
|
133
|
+
[OPTIONS]: SubscriberDescriptorOptions<T>;
|
|
134
|
+
/**
|
|
135
|
+
*
|
|
136
|
+
*/
|
|
137
|
+
topic: () => TopicDescriptor<T>;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Subscriber descriptor.
|
|
141
|
+
*
|
|
142
|
+
* @param options - The subscriber options.
|
|
143
|
+
* @returns The descriptor value.
|
|
144
|
+
*/
|
|
145
|
+
declare const $subscriber: {
|
|
146
|
+
<T extends TopicMessageSchema>(options: SubscriberDescriptorOptions<T>): SubscriberDescriptor<T>;
|
|
147
|
+
[KIND]: string;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
declare class TopicTimeoutError extends Error {
|
|
151
|
+
readonly topic: string;
|
|
152
|
+
readonly timeout: number;
|
|
153
|
+
constructor(topic: string, timeout: number);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
declare class MemoryTopicProvider implements TopicProvider {
|
|
157
|
+
protected readonly subscriptions: Record<string, SubscribeCallback[]>;
|
|
158
|
+
/**
|
|
159
|
+
* Publish a message to a topic.
|
|
160
|
+
*
|
|
161
|
+
* @param topic
|
|
162
|
+
* @param message
|
|
163
|
+
*/
|
|
164
|
+
publish(topic: string, message: string): Promise<void>;
|
|
165
|
+
/**
|
|
166
|
+
* Subscribe to a topic.
|
|
167
|
+
*
|
|
168
|
+
* @param topic - The topic to subscribe to.
|
|
169
|
+
* @param callback
|
|
170
|
+
*/
|
|
171
|
+
subscribe(topic: string, callback: SubscribeCallback): Promise<UnSubscribeFn>;
|
|
172
|
+
/**
|
|
173
|
+
* Unsubscribe from a topic.
|
|
174
|
+
*
|
|
175
|
+
* @param topic - The topic to unsubscribe from.
|
|
176
|
+
*/
|
|
177
|
+
unsubscribe(topic: string): Promise<void>;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
declare class RedisTopicProvider implements TopicProvider {
|
|
181
|
+
protected readonly env: {
|
|
182
|
+
REDIS_TOPIC_PREFIX: string;
|
|
183
|
+
};
|
|
184
|
+
protected readonly redisProvider: RedisProvider;
|
|
185
|
+
protected readonly redisSubscriberProvider: RedisSubscriberProvider;
|
|
186
|
+
protected readonly subscriptions: Record<string, SubscribeCallback[]>;
|
|
187
|
+
protected readonly log: _alepha_core.Logger;
|
|
188
|
+
protected readonly start: _alepha_core.HookDescriptor<"start">;
|
|
189
|
+
protected readonly stop: _alepha_core.HookDescriptor<"stop">;
|
|
190
|
+
prefix(queue: string): string;
|
|
191
|
+
/**
|
|
192
|
+
* Publish a message to a topic.
|
|
193
|
+
*
|
|
194
|
+
* @param topic
|
|
195
|
+
* @param message
|
|
196
|
+
*/
|
|
197
|
+
publish(topic: string, message: string): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Subscribe to a topic.
|
|
200
|
+
*
|
|
201
|
+
* @param name
|
|
202
|
+
* @param callback
|
|
203
|
+
*/
|
|
204
|
+
subscribe(name: string, callback: SubscribeCallback): Promise<UnSubscribeFn>;
|
|
205
|
+
/**
|
|
206
|
+
* Unsubscribe from a topic.
|
|
207
|
+
*
|
|
208
|
+
* @param name
|
|
209
|
+
* @param callback
|
|
210
|
+
*/
|
|
211
|
+
unsubscribe(name: string, callback?: SubscribeCallback): Promise<void>;
|
|
212
|
+
/**
|
|
213
|
+
* Listen for messages.
|
|
214
|
+
*
|
|
215
|
+
* @protected
|
|
216
|
+
*/
|
|
217
|
+
protected listen(): void;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
declare class TopicDescriptorProvider {
|
|
221
|
+
protected readonly log: _alepha_core.Logger;
|
|
222
|
+
protected readonly alepha: Alepha;
|
|
223
|
+
protected readonly dateTimeProvider: DateTimeProvider;
|
|
224
|
+
protected readonly topicProvider: TopicProvider;
|
|
225
|
+
protected readonly memoryTopicProvider: MemoryTopicProvider;
|
|
226
|
+
protected readonly topics: TopicDescriptor[];
|
|
227
|
+
protected readonly subscribers: Array<SubscriberDescriptorOptions & {
|
|
228
|
+
unsub?: UnSubscribeFn;
|
|
229
|
+
}>;
|
|
230
|
+
protected readonly configure: _alepha_core.HookDescriptor<"configure">;
|
|
231
|
+
protected readonly start: _alepha_core.HookDescriptor<"start">;
|
|
232
|
+
/**
|
|
233
|
+
* Process the descriptors.
|
|
234
|
+
*
|
|
235
|
+
* @protected
|
|
236
|
+
*/
|
|
237
|
+
protected processDescriptors(): void;
|
|
238
|
+
/**
|
|
239
|
+
* Process the queue descriptors.
|
|
240
|
+
*
|
|
241
|
+
* @protected
|
|
242
|
+
*/
|
|
243
|
+
protected processTopicDescriptors(): void;
|
|
244
|
+
/**
|
|
245
|
+
* Wait for a message on the topic.
|
|
246
|
+
*
|
|
247
|
+
* @param topic
|
|
248
|
+
* @param options
|
|
249
|
+
* @protected
|
|
250
|
+
*/
|
|
251
|
+
protected wait(topic: TopicDescriptor, options?: TopicWaitOptions<any>): Promise<unknown>;
|
|
252
|
+
/**
|
|
253
|
+
* Process the consumer descriptors.
|
|
254
|
+
*
|
|
255
|
+
* @protected
|
|
256
|
+
*/
|
|
257
|
+
protected processSubscriberDescriptors(): void;
|
|
258
|
+
/**
|
|
259
|
+
* Get the provider for the queue.
|
|
260
|
+
*
|
|
261
|
+
* @param options - The queue options.
|
|
262
|
+
* @protected
|
|
263
|
+
*/
|
|
264
|
+
protected provider(options: TopicDescriptorOptions): TopicProvider;
|
|
265
|
+
/**
|
|
266
|
+
* Publish a message to the topic.
|
|
267
|
+
*
|
|
268
|
+
* @param topic
|
|
269
|
+
* @param message
|
|
270
|
+
* @protected
|
|
271
|
+
*/
|
|
272
|
+
protected publish<T extends TopicMessageSchema = TopicMessageSchema>(topic: TopicDescriptor<T>, message: TopicMessage<T>): Promise<void>;
|
|
273
|
+
/**
|
|
274
|
+
* Process a message.
|
|
275
|
+
*
|
|
276
|
+
* @param subscriber
|
|
277
|
+
* @param message
|
|
278
|
+
* @protected
|
|
279
|
+
*/
|
|
280
|
+
protected processMessage(subscriber: SubscriberDescriptorOptions, message: string): Promise<void>;
|
|
281
|
+
protected parseMessage(schema: any, message: string): {
|
|
282
|
+
payload: any;
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
declare const envSchema: _alepha_core.TObject<{
|
|
287
|
+
TOPIC_PROVIDER: TUnsafe<"memory" | "redis">;
|
|
288
|
+
}>;
|
|
289
|
+
declare module "alepha" {
|
|
290
|
+
interface Env extends Partial<Static<typeof envSchema>> {
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
declare class TopicModule {
|
|
294
|
+
protected readonly alepha: Alepha;
|
|
295
|
+
protected readonly env: {
|
|
296
|
+
TOPIC_PROVIDER: "memory" | "redis";
|
|
297
|
+
};
|
|
298
|
+
constructor();
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export { $subscriber, $topic, MemoryTopicProvider, RedisTopicProvider, type SubscribeCallback, type SubscriberDescriptor, type SubscriberDescriptorOptions, type TopicDescriptor, type TopicDescriptorOptions, TopicDescriptorProvider, type TopicMessage, type TopicMessageSchema, TopicModule, TopicProvider, TopicTimeoutError, type TopicWaitOptions, type UnSubscribeFn };
|
package/vite.d.ts
CHANGED
|
@@ -1 +1,80 @@
|
|
|
1
|
-
|
|
1
|
+
import viteReactPlugin from '@vitejs/plugin-react';
|
|
2
|
+
import { Plugin } from 'vite';
|
|
3
|
+
|
|
4
|
+
interface ViteAlephaBuildOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The entry point for the application. This is the file that will be executed when the application is run.
|
|
7
|
+
*
|
|
8
|
+
* @default 'src/index.ts'
|
|
9
|
+
*/
|
|
10
|
+
entry?: string;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
vercel?: boolean | {
|
|
15
|
+
projectId: string;
|
|
16
|
+
orgId: string;
|
|
17
|
+
settings: any;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
declare function viteAlephaBuild(options?: ViteAlephaBuildOptions): Plugin;
|
|
24
|
+
|
|
25
|
+
interface ViteAlephaDevOptions {
|
|
26
|
+
/**
|
|
27
|
+
* The entry point for the application. This is the file that will be executed when the application is run.
|
|
28
|
+
*
|
|
29
|
+
* @default 'src/index.ts'
|
|
30
|
+
*/
|
|
31
|
+
entry?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Enable or disable debug mode
|
|
34
|
+
*
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
debug?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Enable or disable Vercel support
|
|
40
|
+
*/
|
|
41
|
+
vercel?: boolean | {
|
|
42
|
+
projectId: string;
|
|
43
|
+
orgId: string;
|
|
44
|
+
settings: any;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
declare function viteAlephaDev(options?: ViteAlephaDevOptions): Plugin;
|
|
51
|
+
|
|
52
|
+
type ViteAlephaOptions = ViteAlephaDevOptions & ViteAlephaBuildOptions;
|
|
53
|
+
declare function viteAlepha(options?: ViteAlephaOptions): Plugin[];
|
|
54
|
+
|
|
55
|
+
interface ViteAlephaBuildVercelOptions {
|
|
56
|
+
/**
|
|
57
|
+
* The name of the output file.
|
|
58
|
+
*
|
|
59
|
+
* @default 'index'
|
|
60
|
+
*/
|
|
61
|
+
filename?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The name of the client directory.
|
|
64
|
+
*
|
|
65
|
+
* @default 'client'
|
|
66
|
+
*/
|
|
67
|
+
client?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
declare function viteAlephaBuildVercel(opts?: ViteAlephaBuildVercelOptions): {
|
|
73
|
+
name: string;
|
|
74
|
+
apply: string;
|
|
75
|
+
writeBundle(): void;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
declare const viteReact: typeof viteReactPlugin;
|
|
79
|
+
|
|
80
|
+
export { type ViteAlephaBuildOptions, type ViteAlephaBuildVercelOptions, type ViteAlephaDevOptions, type ViteAlephaOptions, viteAlepha, viteAlephaBuild, viteAlephaBuildVercel, viteAlephaDev, viteReact };
|