alepha 0.8.1 → 0.9.0
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 +47 -17
- package/batch.d.ts +83 -117
- package/bucket.cjs +8 -0
- package/bucket.d.ts +194 -0
- package/bucket.js +1 -0
- package/cache/redis.d.ts +14 -14
- package/cache.d.ts +101 -238
- package/command.d.ts +66 -71
- package/core.d.ts +1003 -851
- package/datetime.d.ts +90 -116
- package/file.d.ts +23 -13
- package/lock/redis.d.ts +11 -11
- package/lock.d.ts +121 -111
- package/package.json +54 -40
- package/postgres.d.ts +218 -393
- package/queue/redis.d.ts +13 -13
- package/queue.d.ts +84 -198
- package/react/auth.d.ts +47 -53
- package/react/head.d.ts +4 -7
- package/react.d.ts +47 -183
- package/redis.d.ts +31 -16
- package/retry.d.ts +70 -59
- package/router.d.ts +9 -9
- package/scheduler.d.ts +54 -93
- package/security.d.ts +95 -276
- package/server/cache.d.ts +22 -28
- package/server/compress.d.ts +16 -7
- package/server/cookies.d.ts +65 -233
- package/server/cors.d.ts +15 -13
- package/server/health.d.ts +23 -23
- package/server/helmet.d.ts +17 -18
- package/server/links.d.ts +108 -88
- package/server/metrics.d.ts +25 -21
- package/server/multipart.d.ts +12 -14
- package/server/proxy.d.ts +22 -17
- package/server/security.cjs +8 -0
- package/server/security.d.ts +90 -0
- package/server/security.js +1 -0
- package/server/static.d.ts +63 -67
- package/server/swagger.d.ts +73 -62
- package/server.d.ts +250 -446
- package/topic/redis.d.ts +25 -24
- package/topic.d.ts +68 -115
package/queue/redis.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import * as _alepha_core0 from "alepha";
|
|
2
|
+
import { Static } from "alepha";
|
|
1
3
|
import { QueueProvider } from "alepha/queue";
|
|
2
|
-
import { Alepha, Module, Static, TObject, TString } from "alepha";
|
|
3
4
|
import { RedisProvider } from "alepha/redis";
|
|
5
|
+
import * as _sinclair_typebox0 from "@sinclair/typebox";
|
|
4
6
|
|
|
5
7
|
//#region src/providers/RedisQueueProvider.d.ts
|
|
6
|
-
declare const envSchema: TObject<{
|
|
7
|
-
REDIS_QUEUE_PREFIX: TString;
|
|
8
|
+
declare const envSchema: _sinclair_typebox0.TObject<{
|
|
9
|
+
REDIS_QUEUE_PREFIX: _sinclair_typebox0.TString;
|
|
8
10
|
}>;
|
|
9
11
|
declare class RedisQueueProvider implements QueueProvider {
|
|
10
12
|
protected readonly env: Static<typeof envSchema>;
|
|
@@ -15,17 +17,15 @@ declare class RedisQueueProvider implements QueueProvider {
|
|
|
15
17
|
}
|
|
16
18
|
//#endregion
|
|
17
19
|
//#region src/index.d.ts
|
|
18
|
-
// ---------------------------------------------------------------------------------------------------------------------
|
|
19
20
|
/**
|
|
20
|
-
* Plugin for Alepha Queue that provides Redis queue capabilities.
|
|
21
|
-
*
|
|
22
|
-
* @see {@link RedisQueueProvider}
|
|
23
|
-
* @module alepha.queue.redis
|
|
24
|
-
*/
|
|
25
|
-
declare
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
21
|
+
* Plugin for Alepha Queue that provides Redis queue capabilities.
|
|
22
|
+
*
|
|
23
|
+
* @see {@link RedisQueueProvider}
|
|
24
|
+
* @module alepha.queue.redis
|
|
25
|
+
*/
|
|
26
|
+
declare const AlephaQueueRedis: _alepha_core0.ModuleDescriptor;
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
28
|
+
|
|
29
29
|
//#endregion
|
|
30
30
|
export { AlephaQueueRedis, RedisQueueProvider };
|
|
31
31
|
//# sourceMappingURL=index.d.ts.map
|
package/queue.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import * as _alepha_core0 from "alepha";
|
|
2
1
|
import * as _alepha_core1 from "alepha";
|
|
3
|
-
import
|
|
2
|
+
import * as _alepha_core2 from "alepha";
|
|
3
|
+
import * as _alepha_core0$1 from "alepha";
|
|
4
|
+
import * as _alepha_core0 from "alepha";
|
|
5
|
+
import { Alepha, Descriptor, KIND, Service, Static, TSchema } from "alepha";
|
|
4
6
|
import { DateTimeProvider } from "alepha/datetime";
|
|
5
7
|
|
|
6
8
|
//#region src/providers/QueueProvider.d.ts
|
|
@@ -28,96 +30,36 @@ declare abstract class QueueProvider {
|
|
|
28
30
|
}
|
|
29
31
|
//# sourceMappingURL=QueueProvider.d.ts.map
|
|
30
32
|
//#endregion
|
|
31
|
-
//#region src/descriptors/$queue.d.ts
|
|
32
|
-
declare const KEY$1 = "QUEUE";
|
|
33
|
-
/**
|
|
34
|
-
* Create a new queue.
|
|
35
|
-
*/
|
|
36
|
-
declare const $queue: {
|
|
37
|
-
<T extends QueueMessageSchema>(options: QueueDescriptorOptions<T>): QueueDescriptor<T>;
|
|
38
|
-
[KIND]: string;
|
|
39
|
-
};
|
|
40
|
-
interface QueueMessageSchema {
|
|
41
|
-
headers?: TSchema;
|
|
42
|
-
payload: TSchema;
|
|
43
|
-
}
|
|
44
|
-
interface QueueDescriptorOptions<T extends QueueMessageSchema> {
|
|
45
|
-
name?: string;
|
|
46
|
-
description?: string;
|
|
47
|
-
provider?: "memory" | (() => QueueProvider);
|
|
48
|
-
schema: T;
|
|
49
|
-
handler?: (message: {
|
|
50
|
-
payload: Static<T["payload"]>;
|
|
51
|
-
}) => Promise<void>;
|
|
52
|
-
}
|
|
53
|
-
interface QueueDescriptor<T extends QueueMessageSchema = QueueMessageSchema> {
|
|
54
|
-
[KIND]: typeof KEY$1;
|
|
55
|
-
[OPTIONS]: QueueDescriptorOptions<T>;
|
|
56
|
-
name(): string;
|
|
57
|
-
provider(): QueueProvider;
|
|
58
|
-
push(...payload: Array<Static<T["payload"]>>): Promise<void>;
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region src/descriptors/$consumer.d.ts
|
|
62
|
-
declare const KEY = "CONSUMER";
|
|
63
|
-
/**
|
|
64
|
-
* Consumer descriptor.
|
|
65
|
-
*/
|
|
66
|
-
declare const $consumer: {
|
|
67
|
-
<T extends QueueMessageSchema>(options: ConsumerDescriptorOptions<T>): ConsumerDescriptor<T>;
|
|
68
|
-
[KIND]: string;
|
|
69
|
-
};
|
|
70
|
-
interface ConsumerDescriptorOptions<T extends QueueMessageSchema = QueueMessageSchema> {
|
|
71
|
-
queue: QueueDescriptor<T>;
|
|
72
|
-
handler: (message: {
|
|
73
|
-
payload: Static<T["payload"]>;
|
|
74
|
-
}) => Promise<void>;
|
|
75
|
-
}
|
|
76
|
-
interface ConsumerDescriptor<T extends QueueMessageSchema = QueueMessageSchema> {
|
|
77
|
-
[KIND]: typeof KEY;
|
|
78
|
-
[OPTIONS]: ConsumerDescriptorOptions<T>;
|
|
79
|
-
queue(): QueueDescriptor<T>;
|
|
80
|
-
stop(): Promise<void>;
|
|
81
|
-
}
|
|
82
|
-
//#endregion
|
|
83
33
|
//#region src/providers/MemoryQueueProvider.d.ts
|
|
84
34
|
declare class MemoryQueueProvider implements QueueProvider {
|
|
85
|
-
protected readonly log:
|
|
35
|
+
protected readonly log: _alepha_core1.Logger;
|
|
86
36
|
protected queueList: Record<string, string[]>;
|
|
87
37
|
push(queue: string, ...messages: string[]): Promise<void>;
|
|
88
38
|
pop(queue: string): Promise<string | undefined>;
|
|
89
39
|
}
|
|
90
40
|
//# sourceMappingURL=MemoryQueueProvider.d.ts.map
|
|
91
41
|
//#endregion
|
|
92
|
-
//#region src/providers/
|
|
93
|
-
declare const envSchema:
|
|
42
|
+
//#region src/providers/WorkerProvider.d.ts
|
|
43
|
+
declare const envSchema: _alepha_core2.TObject<{
|
|
94
44
|
/**
|
|
95
45
|
* The interval in milliseconds to wait before checking for new messages.
|
|
96
46
|
*/
|
|
97
|
-
QUEUE_WORKER_INTERVAL:
|
|
47
|
+
QUEUE_WORKER_INTERVAL: _alepha_core2.TNumber;
|
|
98
48
|
/**
|
|
99
49
|
* The maximum interval in milliseconds to wait before checking for new messages.
|
|
100
50
|
*/
|
|
101
|
-
QUEUE_WORKER_MAX_INTERVAL:
|
|
51
|
+
QUEUE_WORKER_MAX_INTERVAL: _alepha_core2.TNumber;
|
|
102
52
|
/**
|
|
103
53
|
* The number of workers to run concurrently. Defaults to 1.
|
|
104
54
|
* Useful only if you are doing a lot of I/O.
|
|
105
55
|
*/
|
|
106
|
-
QUEUE_WORKER_CONCURRENCY:
|
|
56
|
+
QUEUE_WORKER_CONCURRENCY: _alepha_core2.TNumber;
|
|
107
57
|
}>;
|
|
108
58
|
declare module "alepha" {
|
|
109
59
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
110
60
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
consumers: Array<ConsumerDescriptorOptions>;
|
|
114
|
-
workerPromises: Array<Promise<void>>;
|
|
115
|
-
isWorkersRunning: boolean;
|
|
116
|
-
abortController: AbortController;
|
|
117
|
-
workerIntervals: Record<number, number>;
|
|
118
|
-
}
|
|
119
|
-
declare class QueueDescriptorProvider {
|
|
120
|
-
protected readonly log: _alepha_core1.Logger;
|
|
61
|
+
declare class WorkerProvider {
|
|
62
|
+
protected readonly log: _alepha_core2.Logger;
|
|
121
63
|
protected readonly env: {
|
|
122
64
|
QUEUE_WORKER_INTERVAL: number;
|
|
123
65
|
QUEUE_WORKER_MAX_INTERVAL: number;
|
|
@@ -125,43 +67,19 @@ declare class QueueDescriptorProvider {
|
|
|
125
67
|
};
|
|
126
68
|
protected readonly alepha: Alepha;
|
|
127
69
|
protected readonly queueProvider: QueueProvider;
|
|
128
|
-
protected readonly memoryQueueProvider: MemoryQueueProvider;
|
|
129
70
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
130
|
-
protected
|
|
131
|
-
protected
|
|
132
|
-
protected
|
|
133
|
-
protected
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Process the descriptors.
|
|
138
|
-
*
|
|
139
|
-
* @protected
|
|
140
|
-
*/
|
|
141
|
-
protected processDescriptors(): void;
|
|
142
|
-
/**
|
|
143
|
-
* Process the queue descriptors.
|
|
144
|
-
*
|
|
145
|
-
* @protected
|
|
146
|
-
*/
|
|
147
|
-
protected processQueueDescriptors(): void;
|
|
148
|
-
/**
|
|
149
|
-
* Process the consumer descriptors.
|
|
150
|
-
*/
|
|
151
|
-
protected processConsumerDescriptors(): void;
|
|
152
|
-
/**
|
|
153
|
-
* Get the provider for the queue.
|
|
154
|
-
*/
|
|
155
|
-
protected provider(options: QueueDescriptorOptions<any>): QueueProvider;
|
|
156
|
-
/**
|
|
157
|
-
* Push an item to the queue.
|
|
158
|
-
*/
|
|
159
|
-
protected push<T extends QueueMessageSchema>(queue: QueueDescriptor<T>, ...payloads: Array<Static<T["payload"]>>): Promise<void>;
|
|
71
|
+
protected workerPromises: Array<Promise<void>>;
|
|
72
|
+
protected isWorkersRunning: boolean;
|
|
73
|
+
protected abortController: AbortController;
|
|
74
|
+
protected workerIntervals: Record<number, number>;
|
|
75
|
+
protected consumers: Array<Consumer>;
|
|
76
|
+
protected readonly start: _alepha_core2.HookDescriptor<"start">;
|
|
160
77
|
/**
|
|
161
78
|
* Start the workers.
|
|
162
79
|
* This method will create an endless loop that will check for new messages!
|
|
163
80
|
*/
|
|
164
|
-
protected startWorkers(
|
|
81
|
+
protected startWorkers(): void;
|
|
82
|
+
protected readonly stop: _alepha_core2.HookDescriptor<"stop">;
|
|
165
83
|
/**
|
|
166
84
|
* Wait for the next message, where `n` is the worker number.
|
|
167
85
|
*
|
|
@@ -171,16 +89,13 @@ declare class QueueDescriptorProvider {
|
|
|
171
89
|
/**
|
|
172
90
|
* Get the next message.
|
|
173
91
|
*/
|
|
174
|
-
protected getNextMessage(
|
|
175
|
-
consumer: ConsumerDescriptorOptions;
|
|
176
|
-
message: string;
|
|
177
|
-
}>;
|
|
92
|
+
protected getNextMessage(): Promise<undefined | NextMessage>;
|
|
178
93
|
/**
|
|
179
94
|
* Process a message from a queue.
|
|
180
95
|
*/
|
|
181
96
|
protected processMessage(response: {
|
|
182
97
|
message: any;
|
|
183
|
-
consumer:
|
|
98
|
+
consumer: Consumer;
|
|
184
99
|
}): Promise<void>;
|
|
185
100
|
/**
|
|
186
101
|
* Stop the workers.
|
|
@@ -188,7 +103,67 @@ declare class QueueDescriptorProvider {
|
|
|
188
103
|
* This method will stop the workers and wait for them to finish processing.
|
|
189
104
|
*/
|
|
190
105
|
protected stopWorkers(): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Force the workers to get back to work. zug zug!
|
|
108
|
+
*/
|
|
109
|
+
wakeUp(): void;
|
|
110
|
+
}
|
|
111
|
+
interface Consumer<T extends TSchema = TSchema> {
|
|
112
|
+
queue: QueueDescriptor<T>;
|
|
113
|
+
handler: (message: QueueMessage<T>) => Promise<void>;
|
|
114
|
+
}
|
|
115
|
+
interface NextMessage {
|
|
116
|
+
consumer: Consumer;
|
|
117
|
+
message: string;
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/descriptors/$queue.d.ts
|
|
121
|
+
/**
|
|
122
|
+
* Create a new queue.
|
|
123
|
+
*/
|
|
124
|
+
declare const $queue: {
|
|
125
|
+
<T extends TSchema>(options: QueueDescriptorOptions<T>): QueueDescriptor<T>;
|
|
126
|
+
[KIND]: typeof QueueDescriptor;
|
|
127
|
+
};
|
|
128
|
+
interface QueueDescriptorOptions<T extends TSchema> {
|
|
129
|
+
name?: string;
|
|
130
|
+
description?: string;
|
|
131
|
+
provider?: "memory" | Service<QueueProvider>;
|
|
132
|
+
schema: T;
|
|
133
|
+
handler?: (message: QueueMessage<T>) => Promise<void>;
|
|
134
|
+
}
|
|
135
|
+
declare class QueueDescriptor<T extends TSchema> extends Descriptor<QueueDescriptorOptions<T>> {
|
|
136
|
+
protected readonly log: _alepha_core0$1.Logger;
|
|
137
|
+
protected readonly workerProvider: WorkerProvider;
|
|
138
|
+
readonly provider: QueueProvider | MemoryQueueProvider;
|
|
139
|
+
push(...payloads: Array<Static<T>>): Promise<void>;
|
|
140
|
+
get name(): string;
|
|
141
|
+
protected $provider(): QueueProvider | MemoryQueueProvider;
|
|
142
|
+
}
|
|
143
|
+
interface QueueMessageSchema {
|
|
144
|
+
payload: TSchema;
|
|
145
|
+
}
|
|
146
|
+
interface QueueMessage<T extends TSchema> {
|
|
147
|
+
payload: Static<T>;
|
|
191
148
|
}
|
|
149
|
+
//# sourceMappingURL=$queue.d.ts.map
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/descriptors/$consumer.d.ts
|
|
152
|
+
/**
|
|
153
|
+
* Consumer descriptor.
|
|
154
|
+
*/
|
|
155
|
+
declare const $consumer: {
|
|
156
|
+
<T extends TSchema>(options: ConsumerDescriptorOptions<T>): ConsumerDescriptor<T>;
|
|
157
|
+
[KIND]: typeof ConsumerDescriptor;
|
|
158
|
+
};
|
|
159
|
+
interface ConsumerDescriptorOptions<T extends TSchema> {
|
|
160
|
+
queue: QueueDescriptor<T>;
|
|
161
|
+
handler: (message: {
|
|
162
|
+
payload: Static<T["payload"]>;
|
|
163
|
+
}) => Promise<void>;
|
|
164
|
+
}
|
|
165
|
+
declare class ConsumerDescriptor<T extends TSchema> extends Descriptor<ConsumerDescriptorOptions<T>> {}
|
|
166
|
+
//# sourceMappingURL=$consumer.d.ts.map
|
|
192
167
|
//#endregion
|
|
193
168
|
//#region src/index.d.ts
|
|
194
169
|
/**
|
|
@@ -198,102 +173,13 @@ declare class QueueDescriptorProvider {
|
|
|
198
173
|
* on class properties. It supports schema validation, automatic retries, and multiple queue backends for
|
|
199
174
|
* building scalable, decoupled applications with robust error handling.
|
|
200
175
|
*
|
|
201
|
-
* **Key Features:**
|
|
202
|
-
* - Declarative queue definition with `$queue` descriptor
|
|
203
|
-
* - Schema validation for message payloads and headers
|
|
204
|
-
* - Built-in message handlers with automatic processing
|
|
205
|
-
* - Multiple queue backends (memory, Redis, etc.)
|
|
206
|
-
* - Type-safe message publishing and consumption
|
|
207
|
-
* - Automatic retry mechanisms and error handling
|
|
208
|
-
*
|
|
209
|
-
* **Basic Usage:**
|
|
210
|
-
* ```ts
|
|
211
|
-
* import { Alepha, run, t } from "alepha";
|
|
212
|
-
* import { AlephaQueue, $queue } from "alepha/queue";
|
|
213
|
-
*
|
|
214
|
-
* class EmailService {
|
|
215
|
-
* sendEmail = $queue({
|
|
216
|
-
* name: "emails",
|
|
217
|
-
* schema: {
|
|
218
|
-
* payload: t.object({
|
|
219
|
-
* to: t.string(),
|
|
220
|
-
* subject: t.string(),
|
|
221
|
-
* body: t.string(),
|
|
222
|
-
* }),
|
|
223
|
-
* },
|
|
224
|
-
* handler: async ({ payload }) => {
|
|
225
|
-
* // Process the email
|
|
226
|
-
* await sendEmailViaProvider(payload.to, payload.subject, payload.body);
|
|
227
|
-
* console.log(`Email sent to ${payload.to}`);
|
|
228
|
-
* },
|
|
229
|
-
* });
|
|
230
|
-
* }
|
|
231
|
-
*
|
|
232
|
-
* const alepha = Alepha.create()
|
|
233
|
-
* .with(AlephaQueue)
|
|
234
|
-
* .with(EmailService);
|
|
235
|
-
*
|
|
236
|
-
* run(alepha);
|
|
237
|
-
* ```
|
|
238
|
-
*
|
|
239
|
-
* **Queue Operations:**
|
|
240
|
-
* ```ts
|
|
241
|
-
* class NotificationService {
|
|
242
|
-
* notifications = $queue({
|
|
243
|
-
* name: "notifications",
|
|
244
|
-
* provider: "memory",
|
|
245
|
-
* schema: {
|
|
246
|
-
* payload: t.object({
|
|
247
|
-
* userId: t.string(),
|
|
248
|
-
* message: t.string(),
|
|
249
|
-
* type: t.union([t.literal("info"), t.literal("warning"), t.literal("error")]),
|
|
250
|
-
* }),
|
|
251
|
-
* },
|
|
252
|
-
* handler: async ({ payload }) => {
|
|
253
|
-
* await sendNotification(payload.userId, payload.message, payload.type);
|
|
254
|
-
* },
|
|
255
|
-
* });
|
|
256
|
-
*
|
|
257
|
-
* async notifyUser(userId: string, message: string, type: "info" | "warning" | "error") {
|
|
258
|
-
* // Push message to queue
|
|
259
|
-
* await this.notifications.push({ userId, message, type });
|
|
260
|
-
* }
|
|
261
|
-
* }
|
|
262
|
-
* ```
|
|
263
|
-
*
|
|
264
|
-
* **Batch Processing:**
|
|
265
|
-
* ```ts
|
|
266
|
-
* class BatchProcessor {
|
|
267
|
-
* processTasks = $queue({
|
|
268
|
-
* name: "batch-tasks",
|
|
269
|
-
* schema: {
|
|
270
|
-
* payload: t.object({
|
|
271
|
-
* taskId: t.string(),
|
|
272
|
-
* data: t.any(),
|
|
273
|
-
* }),
|
|
274
|
-
* },
|
|
275
|
-
* handler: async ({ payload }) => {
|
|
276
|
-
* await processTask(payload.taskId, payload.data);
|
|
277
|
-
* },
|
|
278
|
-
* });
|
|
279
|
-
*
|
|
280
|
-
* async submitBatch(tasks: Array<{ taskId: string; data: any }>) {
|
|
281
|
-
* // Push multiple messages at once
|
|
282
|
-
* await this.processTasks.push(...tasks);
|
|
283
|
-
* }
|
|
284
|
-
* }
|
|
285
|
-
* ```
|
|
286
|
-
*
|
|
287
176
|
* @see {@link $queue}
|
|
288
177
|
* @see {@link $consumer}
|
|
289
178
|
* @module alepha.queue
|
|
290
179
|
*/
|
|
291
|
-
declare
|
|
292
|
-
readonly name = "alepha.queue";
|
|
293
|
-
readonly $services: (alepha: Alepha) => Alepha;
|
|
294
|
-
}
|
|
180
|
+
declare const AlephaQueue: _alepha_core0.ModuleDescriptor;
|
|
295
181
|
//# sourceMappingURL=index.d.ts.map
|
|
296
182
|
|
|
297
183
|
//#endregion
|
|
298
|
-
export { $consumer, $queue, AlephaQueue, ConsumerDescriptor, ConsumerDescriptorOptions, MemoryQueueProvider, QueueDescriptor, QueueDescriptorOptions,
|
|
184
|
+
export { $consumer, $queue, AlephaQueue, ConsumerDescriptor, ConsumerDescriptorOptions, MemoryQueueProvider, QueueDescriptor, QueueDescriptorOptions, QueueMessage, QueueMessageSchema, QueueProvider };
|
|
299
185
|
//# sourceMappingURL=index.d.ts.map
|
package/react/auth.d.ts
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import * as _alepha_core0$1 from "alepha";
|
|
2
|
+
import * as _alepha_core4 from "alepha";
|
|
3
|
+
import * as _alepha_core0 from "alepha";
|
|
4
|
+
import { Alepha, Async, Descriptor, KIND } from "alepha";
|
|
5
|
+
import * as _alepha_server_cookies0 from "alepha/server/cookies";
|
|
5
6
|
import { Cookies, ServerCookiesProvider } from "alepha/server/cookies";
|
|
6
|
-
import * as
|
|
7
|
+
import * as _alepha_server0 from "alepha/server";
|
|
7
8
|
import { HttpClient } from "alepha/server";
|
|
8
9
|
import { Configuration } from "openid-client";
|
|
9
10
|
import { HttpVirtualClient } from "alepha/server/links";
|
|
10
11
|
import { UserAccountToken } from "alepha/security";
|
|
11
|
-
import * as
|
|
12
|
+
import * as _sinclair_typebox0 from "@sinclair/typebox";
|
|
12
13
|
|
|
13
14
|
//#region src/descriptors/$auth.d.ts
|
|
14
|
-
declare const KEY = "AUTH";
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
*/
|
|
18
15
|
declare const $auth: {
|
|
19
16
|
(options: AuthDescriptorOptions): AuthDescriptor;
|
|
20
|
-
[KIND]:
|
|
17
|
+
[KIND]: typeof AuthDescriptor;
|
|
21
18
|
};
|
|
22
|
-
type AccessToken = string;
|
|
23
19
|
interface AuthDescriptorOptions {
|
|
24
20
|
name?: string;
|
|
25
21
|
fallback?: () => Async<AccessToken>;
|
|
@@ -32,59 +28,60 @@ interface AuthDescriptorOptions {
|
|
|
32
28
|
logoutUri?: string;
|
|
33
29
|
};
|
|
34
30
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
jwks: () => string;
|
|
31
|
+
declare class AuthDescriptor extends Descriptor<AuthDescriptorOptions> {
|
|
32
|
+
get name(): string;
|
|
33
|
+
jwks(): string;
|
|
39
34
|
}
|
|
35
|
+
type AccessToken = string;
|
|
36
|
+
//# sourceMappingURL=$auth.d.ts.map
|
|
40
37
|
//#endregion
|
|
41
38
|
//#region src/providers/ReactAuthProvider.d.ts
|
|
42
39
|
declare class ReactAuthProvider {
|
|
43
|
-
protected readonly log:
|
|
40
|
+
protected readonly log: _alepha_core0$1.Logger;
|
|
44
41
|
protected readonly alepha: Alepha;
|
|
45
42
|
protected readonly serverCookiesProvider: ServerCookiesProvider;
|
|
46
43
|
protected authProviders: AuthProvider[];
|
|
47
|
-
protected readonly authorizationCode:
|
|
48
|
-
codeVerifier:
|
|
49
|
-
redirectUri:
|
|
44
|
+
protected readonly authorizationCode: _alepha_server_cookies0.CookieDescriptor<_sinclair_typebox0.TObject<{
|
|
45
|
+
codeVerifier: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
46
|
+
redirectUri: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
50
47
|
}>>;
|
|
51
|
-
readonly tokens:
|
|
52
|
-
provider:
|
|
53
|
-
access_token:
|
|
54
|
-
expires_in:
|
|
55
|
-
refresh_token:
|
|
56
|
-
id_token:
|
|
57
|
-
scope:
|
|
58
|
-
issued_at:
|
|
48
|
+
readonly tokens: _alepha_server_cookies0.CookieDescriptor<_sinclair_typebox0.TObject<{
|
|
49
|
+
provider: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
50
|
+
access_token: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
51
|
+
expires_in: _sinclair_typebox0.TOptional<_sinclair_typebox0.TNumber>;
|
|
52
|
+
refresh_token: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
53
|
+
id_token: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
54
|
+
scope: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
55
|
+
issued_at: _sinclair_typebox0.TOptional<_sinclair_typebox0.TNumber>;
|
|
59
56
|
}>>;
|
|
60
|
-
readonly user:
|
|
61
|
-
id:
|
|
62
|
-
name:
|
|
63
|
-
email:
|
|
64
|
-
picture:
|
|
57
|
+
readonly user: _alepha_server_cookies0.CookieDescriptor<_sinclair_typebox0.TObject<{
|
|
58
|
+
id: _sinclair_typebox0.TString;
|
|
59
|
+
name: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
60
|
+
email: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
61
|
+
picture: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
65
62
|
}>>;
|
|
66
|
-
readonly onRender:
|
|
67
|
-
protected readonly configure:
|
|
63
|
+
readonly onRender: _alepha_core0$1.HookDescriptor<"react:server:render:begin">;
|
|
64
|
+
protected readonly configure: _alepha_core0$1.HookDescriptor<"configure">;
|
|
68
65
|
protected getAccessTokenFromCookies(tokens: SessionTokens): Promise<string | undefined>;
|
|
69
66
|
/**
|
|
70
67
|
* Configure Fastify to forward Session Access Token to Header Authorization.
|
|
71
68
|
*/
|
|
72
|
-
protected readonly onRequest:
|
|
69
|
+
protected readonly onRequest: _alepha_core0$1.HookDescriptor<"server:onRequest">;
|
|
73
70
|
/**
|
|
74
71
|
*
|
|
75
72
|
* @param cookies
|
|
76
73
|
* @protected
|
|
77
74
|
*/
|
|
78
75
|
protected refresh(cookies: Cookies): Promise<SessionTokens | undefined>;
|
|
79
|
-
readonly login:
|
|
80
|
-
query:
|
|
81
|
-
redirect:
|
|
82
|
-
provider:
|
|
76
|
+
readonly login: _alepha_server0.RouteDescriptor<{
|
|
77
|
+
query: _sinclair_typebox0.TObject<{
|
|
78
|
+
redirect: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
79
|
+
provider: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
83
80
|
}>;
|
|
84
81
|
}>;
|
|
85
|
-
readonly callback:
|
|
86
|
-
query:
|
|
87
|
-
provider:
|
|
82
|
+
readonly callback: _alepha_server0.RouteDescriptor<{
|
|
83
|
+
query: _sinclair_typebox0.TObject<{
|
|
84
|
+
provider: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
88
85
|
}>;
|
|
89
86
|
}>;
|
|
90
87
|
/**
|
|
@@ -98,10 +95,10 @@ declare class ReactAuthProvider {
|
|
|
98
95
|
email: any;
|
|
99
96
|
picture: any;
|
|
100
97
|
} | undefined;
|
|
101
|
-
readonly logout:
|
|
102
|
-
query:
|
|
103
|
-
redirect:
|
|
104
|
-
provider:
|
|
98
|
+
readonly logout: _alepha_server0.RouteDescriptor<{
|
|
99
|
+
query: _sinclair_typebox0.TObject<{
|
|
100
|
+
redirect: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
101
|
+
provider: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
105
102
|
}>;
|
|
106
103
|
}>;
|
|
107
104
|
/**
|
|
@@ -162,7 +159,7 @@ interface AuthHook {
|
|
|
162
159
|
//#endregion
|
|
163
160
|
//#region src/services/ReactAuth.d.ts
|
|
164
161
|
declare class ReactAuth {
|
|
165
|
-
protected readonly log:
|
|
162
|
+
protected readonly log: _alepha_core4.Logger;
|
|
166
163
|
protected readonly alepha: Alepha;
|
|
167
164
|
protected readonly client: HttpClient;
|
|
168
165
|
static path: {
|
|
@@ -170,7 +167,7 @@ declare class ReactAuth {
|
|
|
170
167
|
callback: string;
|
|
171
168
|
logout: string;
|
|
172
169
|
};
|
|
173
|
-
readonly onRender:
|
|
170
|
+
readonly onRender: _alepha_core4.HookDescriptor<"react:transition:begin">;
|
|
174
171
|
get user(): UserAccountToken | undefined;
|
|
175
172
|
protected getUserFromCookies(): UserAccountToken | undefined;
|
|
176
173
|
login(): void;
|
|
@@ -193,10 +190,7 @@ declare module "alepha/react" {
|
|
|
193
190
|
* @see {@link ReactAuthProvider}
|
|
194
191
|
* @module alepha.react.auth
|
|
195
192
|
*/
|
|
196
|
-
declare
|
|
197
|
-
readonly name = "alepha.react.auth";
|
|
198
|
-
readonly $services: (alepha: Alepha) => void;
|
|
199
|
-
}
|
|
193
|
+
declare const AlephaReactAuth: _alepha_core0.ModuleDescriptor;
|
|
200
194
|
//# sourceMappingURL=index.d.ts.map
|
|
201
195
|
|
|
202
196
|
//#endregion
|
package/react/head.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import * as _alepha_core0$1 from "alepha";
|
|
2
|
+
import * as _alepha_core0 from "alepha";
|
|
1
3
|
import { PageConfigSchema, PageReactContext, PageRoute, RouterState, TPropsDefault, TPropsParentDefault } from "alepha/react";
|
|
2
|
-
import * as _alepha_core1 from "alepha";
|
|
3
|
-
import { Alepha, Module } from "alepha";
|
|
4
4
|
|
|
5
5
|
//#region src/interfaces/Head.d.ts
|
|
6
6
|
interface Head extends SimpleHead {
|
|
@@ -58,7 +58,7 @@ declare class HeadProvider {
|
|
|
58
58
|
//#region src/providers/ServerHeadProvider.d.ts
|
|
59
59
|
declare class ServerHeadProvider {
|
|
60
60
|
protected readonly headProvider: HeadProvider;
|
|
61
|
-
protected readonly onServerRenderEnd:
|
|
61
|
+
protected readonly onServerRenderEnd: _alepha_core0$1.HookDescriptor<"react:server:render:end">;
|
|
62
62
|
renderHead(template: string, head: SimpleHead): string;
|
|
63
63
|
protected mergeAttributes(existing: string, attrs: Record<string, string>): string;
|
|
64
64
|
protected parseAttributes(attrStr: string): Record<string, string>;
|
|
@@ -81,10 +81,7 @@ declare module "alepha/react" {
|
|
|
81
81
|
* @see {@link ServerHeadProvider}
|
|
82
82
|
* @module alepha.react.head
|
|
83
83
|
*/
|
|
84
|
-
declare
|
|
85
|
-
readonly name = "alepha.react.head";
|
|
86
|
-
readonly $services: (alepha: Alepha) => Alepha;
|
|
87
|
-
}
|
|
84
|
+
declare const AlephaReactHead: _alepha_core0.ModuleDescriptor;
|
|
88
85
|
//# sourceMappingURL=index.d.ts.map
|
|
89
86
|
|
|
90
87
|
//#endregion
|