alepha 0.9.5 → 0.10.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 +0 -46
- package/batch.d.ts +2 -3
- package/bucket.d.ts +7 -7
- package/command.d.ts +30 -8
- package/core.d.ts +374 -329
- package/email.d.ts +105 -23
- package/logger.d.ts +45 -12
- package/package.json +56 -45
- package/postgres.d.ts +95 -131
- package/queue/redis.d.ts +3 -3
- package/queue.d.ts +105 -171
- package/react/auth.d.ts +99 -107
- package/react/form.d.ts +4 -1
- package/react/i18n.d.ts +8 -3
- package/react.d.ts +100 -7
- package/redis.d.ts +5 -5
- package/security.d.ts +24 -24
- package/server/cache.d.ts +1 -0
- package/server/health.d.ts +6 -6
- package/server/links.d.ts +29 -29
- package/server.d.ts +58 -73
- package/topic.d.ts +0 -1
- package/vite.d.ts +24 -0
package/queue.d.ts
CHANGED
|
@@ -40,16 +40,16 @@ declare const envSchema: _alepha_core1.TObject<{
|
|
|
40
40
|
/**
|
|
41
41
|
* The interval in milliseconds to wait before checking for new messages.
|
|
42
42
|
*/
|
|
43
|
-
QUEUE_WORKER_INTERVAL: _alepha_core1.
|
|
43
|
+
QUEUE_WORKER_INTERVAL: _alepha_core1.TInteger;
|
|
44
44
|
/**
|
|
45
45
|
* The maximum interval in milliseconds to wait before checking for new messages.
|
|
46
46
|
*/
|
|
47
|
-
QUEUE_WORKER_MAX_INTERVAL: _alepha_core1.
|
|
47
|
+
QUEUE_WORKER_MAX_INTERVAL: _alepha_core1.TInteger;
|
|
48
48
|
/**
|
|
49
49
|
* The number of workers to run concurrently. Defaults to 1.
|
|
50
50
|
* Useful only if you are doing a lot of I/O.
|
|
51
51
|
*/
|
|
52
|
-
QUEUE_WORKER_CONCURRENCY: _alepha_core1.
|
|
52
|
+
QUEUE_WORKER_CONCURRENCY: _alepha_core1.TInteger;
|
|
53
53
|
}>;
|
|
54
54
|
declare module "alepha" {
|
|
55
55
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
@@ -65,10 +65,11 @@ declare class WorkerProvider {
|
|
|
65
65
|
protected readonly queueProvider: QueueProvider;
|
|
66
66
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
67
67
|
protected workerPromises: Array<Promise<void>>;
|
|
68
|
-
protected
|
|
68
|
+
protected workersRunning: number;
|
|
69
69
|
protected abortController: AbortController;
|
|
70
70
|
protected workerIntervals: Record<number, number>;
|
|
71
71
|
protected consumers: Array<Consumer>;
|
|
72
|
+
get isRunning(): boolean;
|
|
72
73
|
protected readonly start: _alepha_core1.HookDescriptor<"start">;
|
|
73
74
|
/**
|
|
74
75
|
* Start the workers.
|
|
@@ -100,7 +101,7 @@ declare class WorkerProvider {
|
|
|
100
101
|
*/
|
|
101
102
|
protected stopWorkers(): Promise<void>;
|
|
102
103
|
/**
|
|
103
|
-
* Force the workers to get back to work.
|
|
104
|
+
* Force the workers to get back to work.
|
|
104
105
|
*/
|
|
105
106
|
wakeUp(): void;
|
|
106
107
|
}
|
|
@@ -117,179 +118,112 @@ interface NextMessage {
|
|
|
117
118
|
/**
|
|
118
119
|
* Creates a queue descriptor for asynchronous message processing with background workers.
|
|
119
120
|
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* **
|
|
125
|
-
*
|
|
126
|
-
* -
|
|
127
|
-
* -
|
|
128
|
-
* -
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* -
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* -
|
|
138
|
-
* -
|
|
139
|
-
* -
|
|
140
|
-
* -
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* })
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
* await this.emailQueue.push({
|
|
168
|
-
* to: userEmail,
|
|
169
|
-
* subject: "Welcome to our platform!",
|
|
170
|
-
* body: "Thank you for joining us...",
|
|
171
|
-
* priority: "high"
|
|
172
|
-
* });
|
|
121
|
+
* The $queue descriptor enables powerful asynchronous communication patterns in your application.
|
|
122
|
+
* It provides type-safe message queuing with automatic worker processing, making it perfect for
|
|
123
|
+
* decoupling components and handling background tasks efficiently.
|
|
124
|
+
*
|
|
125
|
+
* **Background Processing**
|
|
126
|
+
* - Automatic worker threads for non-blocking message processing
|
|
127
|
+
* - Built-in retry mechanisms and error handling
|
|
128
|
+
* - Dead letter queues for failed message handling
|
|
129
|
+
* - Graceful shutdown and worker lifecycle management
|
|
130
|
+
*
|
|
131
|
+
* **Type Safety**
|
|
132
|
+
* - Full TypeScript support with schema validation using TypeBox
|
|
133
|
+
* - Type-safe message payloads with automatic inference
|
|
134
|
+
* - Runtime validation of all queued messages
|
|
135
|
+
* - Compile-time errors for invalid message structures
|
|
136
|
+
*
|
|
137
|
+
* **Storage Flexibility**
|
|
138
|
+
* - Memory provider for development and testing
|
|
139
|
+
* - Redis provider for production scalability and persistence
|
|
140
|
+
* - Custom provider support for specialized backends
|
|
141
|
+
* - Automatic failover and connection pooling
|
|
142
|
+
*
|
|
143
|
+
* **Performance & Scalability**
|
|
144
|
+
* - Batch processing support for high-throughput scenarios
|
|
145
|
+
* - Horizontal scaling with distributed queue backends
|
|
146
|
+
* - Configurable concurrency and worker pools
|
|
147
|
+
* - Efficient serialization and message routing
|
|
148
|
+
*
|
|
149
|
+
* **Reliability**
|
|
150
|
+
* - Message persistence across application restarts
|
|
151
|
+
* - Automatic retry with exponential backoff
|
|
152
|
+
* - Dead letter handling for permanently failed messages
|
|
153
|
+
* - Comprehensive logging and monitoring integration
|
|
154
|
+
*
|
|
155
|
+
* @example Basic notification queue
|
|
156
|
+
* ```typescript
|
|
157
|
+
* const emailQueue = $queue({
|
|
158
|
+
* name: "email-notifications",
|
|
159
|
+
* schema: t.object({
|
|
160
|
+
* to: t.string(),
|
|
161
|
+
* subject: t.string(),
|
|
162
|
+
* body: t.string(),
|
|
163
|
+
* priority: t.optional(t.enum(["high", "normal"]))
|
|
164
|
+
* }),
|
|
165
|
+
* handler: async (message) => {
|
|
166
|
+
* await emailService.send(message.payload);
|
|
167
|
+
* console.log(`Email sent to ${message.payload.to}`);
|
|
173
168
|
* }
|
|
174
|
-
* }
|
|
169
|
+
* });
|
|
170
|
+
*
|
|
171
|
+
* // Push messages for background processing
|
|
172
|
+
* await emailQueue.push({
|
|
173
|
+
* to: "user@example.com",
|
|
174
|
+
* subject: "Welcome!",
|
|
175
|
+
* body: "Welcome to our platform",
|
|
176
|
+
* priority: "high"
|
|
177
|
+
* });
|
|
175
178
|
* ```
|
|
176
179
|
*
|
|
177
|
-
* @example
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
* t.literal("resize"),
|
|
190
|
-
* t.literal("compress"),
|
|
191
|
-
* t.literal("thumbnail")
|
|
192
|
-
* ]))
|
|
193
|
-
* }),
|
|
194
|
-
* handler: async (message) => {
|
|
195
|
-
* const { imageId, originalUrl, operations } = message.payload;
|
|
196
|
-
*
|
|
197
|
-
* for (const operation of operations) {
|
|
198
|
-
* await this.processImage(imageId, originalUrl, operation);
|
|
199
|
-
* }
|
|
200
|
-
*
|
|
201
|
-
* console.log(`Processed image ${imageId} with operations: ${operations.join(", ")}`);
|
|
180
|
+
* @example Batch processing with Redis
|
|
181
|
+
* ```typescript
|
|
182
|
+
* const imageQueue = $queue({
|
|
183
|
+
* name: "image-processing",
|
|
184
|
+
* provider: RedisQueueProvider,
|
|
185
|
+
* schema: t.object({
|
|
186
|
+
* imageId: t.string(),
|
|
187
|
+
* operations: t.array(t.enum(["resize", "compress", "thumbnail"]))
|
|
188
|
+
* }),
|
|
189
|
+
* handler: async (message) => {
|
|
190
|
+
* for (const op of message.payload.operations) {
|
|
191
|
+
* await processImage(message.payload.imageId, op);
|
|
202
192
|
* }
|
|
203
|
-
* });
|
|
204
|
-
*
|
|
205
|
-
* async processUploadedImages(images: Array<{id: string; url: string; userId: string}>) {
|
|
206
|
-
* // Process multiple images in parallel
|
|
207
|
-
* const messages = images.map(img => ({
|
|
208
|
-
* imageId: img.id,
|
|
209
|
-
* originalUrl: img.url,
|
|
210
|
-
* userId: img.userId,
|
|
211
|
-
* operations: ["resize", "compress", "thumbnail"] as const
|
|
212
|
-
* }));
|
|
213
|
-
*
|
|
214
|
-
* // Push all messages at once for efficient batch processing
|
|
215
|
-
* await this.imageQueue.push(...messages);
|
|
216
193
|
* }
|
|
217
|
-
* }
|
|
194
|
+
* });
|
|
195
|
+
*
|
|
196
|
+
* // Batch processing multiple images
|
|
197
|
+
* await imageQueue.push(
|
|
198
|
+
* { imageId: "img1", operations: ["resize", "thumbnail"] },
|
|
199
|
+
* { imageId: "img2", operations: ["compress"] },
|
|
200
|
+
* { imageId: "img3", operations: ["resize", "compress", "thumbnail"] }
|
|
201
|
+
* );
|
|
218
202
|
* ```
|
|
219
203
|
*
|
|
220
|
-
* @example
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
* country: t.string()
|
|
241
|
-
* })
|
|
242
|
-
* }),
|
|
243
|
-
* handler: async (message) => {
|
|
244
|
-
* const { orderId, customerId, items } = message.payload;
|
|
245
|
-
*
|
|
246
|
-
* // Process payment
|
|
247
|
-
* await this.processPayment(orderId, items);
|
|
248
|
-
*
|
|
249
|
-
* // Update inventory
|
|
250
|
-
* await this.updateInventory(items);
|
|
251
|
-
*
|
|
252
|
-
* // Send confirmation email
|
|
253
|
-
* await this.sendOrderConfirmation(customerId, orderId);
|
|
254
|
-
*
|
|
255
|
-
* // Schedule shipping
|
|
256
|
-
* await this.scheduleShipping(orderId, message.payload.shippingAddress);
|
|
257
|
-
*
|
|
258
|
-
* console.log(`Order ${orderId} processed successfully`);
|
|
204
|
+
* @example Development with memory provider
|
|
205
|
+
* ```typescript
|
|
206
|
+
* const taskQueue = $queue({
|
|
207
|
+
* name: "dev-tasks",
|
|
208
|
+
* provider: "memory",
|
|
209
|
+
* schema: t.object({
|
|
210
|
+
* taskType: t.enum(["cleanup", "backup", "report"]),
|
|
211
|
+
* data: t.record(t.string(), t.any())
|
|
212
|
+
* }),
|
|
213
|
+
* handler: async (message) => {
|
|
214
|
+
* switch (message.payload.taskType) {
|
|
215
|
+
* case "cleanup":
|
|
216
|
+
* await performCleanup(message.payload.data);
|
|
217
|
+
* break;
|
|
218
|
+
* case "backup":
|
|
219
|
+
* await createBackup(message.payload.data);
|
|
220
|
+
* break;
|
|
221
|
+
* case "report":
|
|
222
|
+
* await generateReport(message.payload.data);
|
|
223
|
+
* break;
|
|
259
224
|
* }
|
|
260
|
-
* }
|
|
261
|
-
* }
|
|
262
|
-
* ```
|
|
263
|
-
*
|
|
264
|
-
* @example
|
|
265
|
-
* **Memory-only queue for development and testing:**
|
|
266
|
-
* ```ts
|
|
267
|
-
* class DevTaskProcessor {
|
|
268
|
-
* taskQueue = $queue({
|
|
269
|
-
* name: "dev-tasks",
|
|
270
|
-
* provider: "memory", // Use in-memory queue for development
|
|
271
|
-
* schema: t.object({
|
|
272
|
-
* taskType: t.enum(["cleanup", "backup", "report"]),
|
|
273
|
-
* data: t.record(t.string(), t.any()),
|
|
274
|
-
* scheduledAt: t.optional(t.string())
|
|
275
|
-
* }),
|
|
276
|
-
* handler: async (message) => {
|
|
277
|
-
* const { taskType, data } = message.payload;
|
|
278
|
-
*
|
|
279
|
-
* switch (taskType) {
|
|
280
|
-
* case "cleanup":
|
|
281
|
-
* await this.performCleanup(data);
|
|
282
|
-
* break;
|
|
283
|
-
* case "backup":
|
|
284
|
-
* await this.createBackup(data);
|
|
285
|
-
* break;
|
|
286
|
-
* case "report":
|
|
287
|
-
* await this.generateReport(data);
|
|
288
|
-
* break;
|
|
289
|
-
* }
|
|
290
|
-
* }
|
|
291
|
-
* });
|
|
292
|
-
* }
|
|
225
|
+
* }
|
|
226
|
+
* });
|
|
293
227
|
* ```
|
|
294
228
|
*/
|
|
295
229
|
declare const $queue: {
|
|
@@ -803,7 +737,7 @@ interface ConsumerDescriptorOptions<T extends TSchema> {
|
|
|
803
737
|
* ```
|
|
804
738
|
*/
|
|
805
739
|
handler: (message: {
|
|
806
|
-
payload: Static<T
|
|
740
|
+
payload: Static<T>;
|
|
807
741
|
}) => Promise<void>;
|
|
808
742
|
}
|
|
809
743
|
declare class ConsumerDescriptor<T extends TSchema> extends Descriptor<ConsumerDescriptorOptions<T>> {}
|
package/react/auth.d.ts
CHANGED
|
@@ -9,21 +9,19 @@ import * as _alepha_logger0 from "alepha/logger";
|
|
|
9
9
|
import * as _alepha_server0 from "alepha/server";
|
|
10
10
|
import { HttpClient } from "alepha/server";
|
|
11
11
|
import { HttpVirtualClient, ServerLinksProvider } from "alepha/server/links";
|
|
12
|
-
import * as
|
|
12
|
+
import * as typebox143 from "typebox";
|
|
13
13
|
|
|
14
14
|
//#region src/schemas/tokensSchema.d.ts
|
|
15
|
-
declare const tokensSchema:
|
|
16
|
-
provider:
|
|
17
|
-
access_token:
|
|
18
|
-
issued_at:
|
|
19
|
-
expires_in:
|
|
20
|
-
refresh_token:
|
|
21
|
-
refresh_token_expires_in:
|
|
22
|
-
refresh_expires_in:
|
|
23
|
-
id_token:
|
|
24
|
-
scope:
|
|
25
|
-
token: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
|
|
26
|
-
realm: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
|
|
15
|
+
declare const tokensSchema: typebox143.TObject<{
|
|
16
|
+
provider: typebox143.TString;
|
|
17
|
+
access_token: typebox143.TString;
|
|
18
|
+
issued_at: typebox143.TNumber;
|
|
19
|
+
expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
20
|
+
refresh_token: typebox143.TOptional<typebox143.TString>;
|
|
21
|
+
refresh_token_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
22
|
+
refresh_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
23
|
+
id_token: typebox143.TOptional<typebox143.TString>;
|
|
24
|
+
scope: typebox143.TOptional<typebox143.TString>;
|
|
27
25
|
}>;
|
|
28
26
|
type Tokens = Static<typeof tokensSchema>;
|
|
29
27
|
//#endregion
|
|
@@ -74,25 +72,23 @@ declare class ReactAuthProvider {
|
|
|
74
72
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
75
73
|
protected readonly serverLinksProvider: ServerLinksProvider;
|
|
76
74
|
protected readonly reactAuth: ReactAuth;
|
|
77
|
-
protected readonly authorizationCode: _alepha_server_cookies0.AbstractCookieDescriptor<
|
|
78
|
-
provider:
|
|
79
|
-
codeVerifier:
|
|
80
|
-
redirectUri:
|
|
81
|
-
state:
|
|
82
|
-
nonce:
|
|
75
|
+
protected readonly authorizationCode: _alepha_server_cookies0.AbstractCookieDescriptor<typebox143.TObject<{
|
|
76
|
+
provider: typebox143.TString;
|
|
77
|
+
codeVerifier: typebox143.TOptional<typebox143.TString>;
|
|
78
|
+
redirectUri: typebox143.TOptional<typebox143.TString>;
|
|
79
|
+
state: typebox143.TOptional<typebox143.TString>;
|
|
80
|
+
nonce: typebox143.TOptional<typebox143.TString>;
|
|
83
81
|
}>>;
|
|
84
|
-
readonly tokens: _alepha_server_cookies0.AbstractCookieDescriptor<
|
|
85
|
-
provider:
|
|
86
|
-
access_token:
|
|
87
|
-
issued_at:
|
|
88
|
-
expires_in:
|
|
89
|
-
refresh_token:
|
|
90
|
-
refresh_token_expires_in:
|
|
91
|
-
refresh_expires_in:
|
|
92
|
-
id_token:
|
|
93
|
-
scope:
|
|
94
|
-
token: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
|
|
95
|
-
realm: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
|
|
82
|
+
readonly tokens: _alepha_server_cookies0.AbstractCookieDescriptor<typebox143.TObject<{
|
|
83
|
+
provider: typebox143.TString;
|
|
84
|
+
access_token: typebox143.TString;
|
|
85
|
+
issued_at: typebox143.TNumber;
|
|
86
|
+
expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
87
|
+
refresh_token: typebox143.TOptional<typebox143.TString>;
|
|
88
|
+
refresh_token_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
89
|
+
refresh_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
90
|
+
id_token: typebox143.TOptional<typebox143.TString>;
|
|
91
|
+
scope: typebox143.TOptional<typebox143.TString>;
|
|
96
92
|
}>>;
|
|
97
93
|
readonly onRender: _alepha_core4.HookDescriptor<"react:server:render:begin">;
|
|
98
94
|
get identities(): Array<AuthDescriptor>;
|
|
@@ -112,26 +108,26 @@ declare class ReactAuthProvider {
|
|
|
112
108
|
* Get user information.
|
|
113
109
|
*/
|
|
114
110
|
readonly userinfo: _alepha_server0.RouteDescriptor<{
|
|
115
|
-
response:
|
|
116
|
-
user:
|
|
117
|
-
id:
|
|
118
|
-
name:
|
|
119
|
-
email:
|
|
120
|
-
username:
|
|
121
|
-
picture:
|
|
122
|
-
sessionId:
|
|
123
|
-
organizations:
|
|
124
|
-
roles:
|
|
111
|
+
response: typebox143.TObject<{
|
|
112
|
+
user: typebox143.TOptional<typebox143.TObject<{
|
|
113
|
+
id: typebox143.TString;
|
|
114
|
+
name: typebox143.TOptional<typebox143.TString>;
|
|
115
|
+
email: typebox143.TOptional<typebox143.TString>;
|
|
116
|
+
username: typebox143.TOptional<typebox143.TString>;
|
|
117
|
+
picture: typebox143.TOptional<typebox143.TString>;
|
|
118
|
+
sessionId: typebox143.TOptional<typebox143.TString>;
|
|
119
|
+
organizations: typebox143.TOptional<typebox143.TArray<typebox143.TString>>;
|
|
120
|
+
roles: typebox143.TOptional<typebox143.TArray<typebox143.TString>>;
|
|
125
121
|
}>>;
|
|
126
|
-
api:
|
|
127
|
-
prefix:
|
|
128
|
-
links:
|
|
129
|
-
name:
|
|
130
|
-
group:
|
|
131
|
-
path:
|
|
132
|
-
method:
|
|
133
|
-
requestBodyType:
|
|
134
|
-
service:
|
|
122
|
+
api: typebox143.TObject<{
|
|
123
|
+
prefix: typebox143.TOptional<typebox143.TString>;
|
|
124
|
+
links: typebox143.TArray<typebox143.TObject<{
|
|
125
|
+
name: typebox143.TString;
|
|
126
|
+
group: typebox143.TOptional<typebox143.TString>;
|
|
127
|
+
path: typebox143.TString;
|
|
128
|
+
method: typebox143.TOptional<typebox143.TString>;
|
|
129
|
+
requestBodyType: typebox143.TOptional<typebox143.TString>;
|
|
130
|
+
service: typebox143.TOptional<typebox143.TString>;
|
|
135
131
|
}>>;
|
|
136
132
|
}>;
|
|
137
133
|
}>;
|
|
@@ -140,69 +136,65 @@ declare class ReactAuthProvider {
|
|
|
140
136
|
* Refresh a token for internal providers.
|
|
141
137
|
*/
|
|
142
138
|
readonly refresh: _alepha_server0.RouteDescriptor<{
|
|
143
|
-
query:
|
|
144
|
-
provider:
|
|
139
|
+
query: typebox143.TObject<{
|
|
140
|
+
provider: typebox143.TString;
|
|
145
141
|
}>;
|
|
146
|
-
body:
|
|
147
|
-
refresh_token:
|
|
148
|
-
access_token:
|
|
142
|
+
body: typebox143.TObject<{
|
|
143
|
+
refresh_token: typebox143.TString;
|
|
144
|
+
access_token: typebox143.TOptional<typebox143.TString>;
|
|
149
145
|
}>;
|
|
150
|
-
response:
|
|
151
|
-
provider:
|
|
152
|
-
access_token:
|
|
153
|
-
issued_at:
|
|
154
|
-
expires_in:
|
|
155
|
-
refresh_token:
|
|
156
|
-
refresh_token_expires_in:
|
|
157
|
-
refresh_expires_in:
|
|
158
|
-
id_token:
|
|
159
|
-
scope:
|
|
160
|
-
token: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
|
|
161
|
-
realm: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
|
|
146
|
+
response: typebox143.TObject<{
|
|
147
|
+
provider: typebox143.TString;
|
|
148
|
+
access_token: typebox143.TString;
|
|
149
|
+
issued_at: typebox143.TNumber;
|
|
150
|
+
expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
151
|
+
refresh_token: typebox143.TOptional<typebox143.TString>;
|
|
152
|
+
refresh_token_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
153
|
+
refresh_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
154
|
+
id_token: typebox143.TOptional<typebox143.TString>;
|
|
155
|
+
scope: typebox143.TOptional<typebox143.TString>;
|
|
162
156
|
}>;
|
|
163
157
|
}>;
|
|
164
158
|
/**
|
|
165
159
|
* Login for local password-based authentication.
|
|
166
160
|
*/
|
|
167
161
|
readonly token: _alepha_server0.RouteDescriptor<{
|
|
168
|
-
query:
|
|
169
|
-
provider:
|
|
162
|
+
query: typebox143.TObject<{
|
|
163
|
+
provider: typebox143.TString;
|
|
170
164
|
}>;
|
|
171
|
-
body:
|
|
172
|
-
username:
|
|
173
|
-
password:
|
|
165
|
+
body: typebox143.TObject<{
|
|
166
|
+
username: typebox143.TString;
|
|
167
|
+
password: typebox143.TString;
|
|
174
168
|
}>;
|
|
175
|
-
response:
|
|
176
|
-
provider:
|
|
177
|
-
access_token:
|
|
178
|
-
issued_at:
|
|
179
|
-
expires_in:
|
|
180
|
-
refresh_token:
|
|
181
|
-
refresh_token_expires_in:
|
|
182
|
-
refresh_expires_in:
|
|
183
|
-
id_token:
|
|
184
|
-
scope:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
organizations: _sinclair_typebox155.TOptional<_sinclair_typebox155.TArray<_sinclair_typebox155.TString>>;
|
|
195
|
-
roles: _sinclair_typebox155.TOptional<_sinclair_typebox155.TArray<_sinclair_typebox155.TString>>;
|
|
169
|
+
response: typebox143.TObject<{
|
|
170
|
+
provider: typebox143.TString;
|
|
171
|
+
access_token: typebox143.TString;
|
|
172
|
+
issued_at: typebox143.TNumber;
|
|
173
|
+
expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
174
|
+
refresh_token: typebox143.TOptional<typebox143.TString>;
|
|
175
|
+
refresh_token_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
176
|
+
refresh_expires_in: typebox143.TOptional<typebox143.TNumber>;
|
|
177
|
+
id_token: typebox143.TOptional<typebox143.TString>;
|
|
178
|
+
scope: typebox143.TOptional<typebox143.TString>;
|
|
179
|
+
user: typebox143.TObject<{
|
|
180
|
+
id: typebox143.TString;
|
|
181
|
+
name: typebox143.TOptional<typebox143.TString>;
|
|
182
|
+
email: typebox143.TOptional<typebox143.TString>;
|
|
183
|
+
username: typebox143.TOptional<typebox143.TString>;
|
|
184
|
+
picture: typebox143.TOptional<typebox143.TString>;
|
|
185
|
+
sessionId: typebox143.TOptional<typebox143.TString>;
|
|
186
|
+
organizations: typebox143.TOptional<typebox143.TArray<typebox143.TString>>;
|
|
187
|
+
roles: typebox143.TOptional<typebox143.TArray<typebox143.TString>>;
|
|
196
188
|
}>;
|
|
197
|
-
api:
|
|
198
|
-
prefix:
|
|
199
|
-
links:
|
|
200
|
-
name:
|
|
201
|
-
group:
|
|
202
|
-
path:
|
|
203
|
-
method:
|
|
204
|
-
requestBodyType:
|
|
205
|
-
service:
|
|
189
|
+
api: typebox143.TObject<{
|
|
190
|
+
prefix: typebox143.TOptional<typebox143.TString>;
|
|
191
|
+
links: typebox143.TArray<typebox143.TObject<{
|
|
192
|
+
name: typebox143.TString;
|
|
193
|
+
group: typebox143.TOptional<typebox143.TString>;
|
|
194
|
+
path: typebox143.TString;
|
|
195
|
+
method: typebox143.TOptional<typebox143.TString>;
|
|
196
|
+
requestBodyType: typebox143.TOptional<typebox143.TString>;
|
|
197
|
+
service: typebox143.TOptional<typebox143.TString>;
|
|
206
198
|
}>>;
|
|
207
199
|
}>;
|
|
208
200
|
}>;
|
|
@@ -211,9 +203,9 @@ declare class ReactAuthProvider {
|
|
|
211
203
|
* Oauth2/OIDC login route.
|
|
212
204
|
*/
|
|
213
205
|
readonly login: _alepha_server0.RouteDescriptor<{
|
|
214
|
-
query:
|
|
215
|
-
provider:
|
|
216
|
-
redirect_uri:
|
|
206
|
+
query: typebox143.TObject<{
|
|
207
|
+
provider: typebox143.TString;
|
|
208
|
+
redirect_uri: typebox143.TOptional<typebox143.TString>;
|
|
217
209
|
}>;
|
|
218
210
|
}>;
|
|
219
211
|
/**
|
|
@@ -225,8 +217,8 @@ declare class ReactAuthProvider {
|
|
|
225
217
|
* Logout route for OAuth2/OIDC providers.
|
|
226
218
|
*/
|
|
227
219
|
readonly logout: _alepha_server0.RouteDescriptor<{
|
|
228
|
-
query:
|
|
229
|
-
post_logout_redirect_uri:
|
|
220
|
+
query: typebox143.TObject<{
|
|
221
|
+
post_logout_redirect_uri: typebox143.TOptional<typebox143.TString>;
|
|
230
222
|
}>;
|
|
231
223
|
}>;
|
|
232
224
|
protected provider(opts: string | {
|
package/react/form.d.ts
CHANGED
|
@@ -19,10 +19,13 @@ declare class FormModel<T extends TObject> {
|
|
|
19
19
|
parent: string;
|
|
20
20
|
store: Record<string, any>;
|
|
21
21
|
}): SchemaToInput<T>;
|
|
22
|
-
protected createInputFromSchema<T extends TObject>(name: keyof Static<T> & string, options: FormCtrlOptions<T>, schema:
|
|
22
|
+
protected createInputFromSchema<T extends TObject>(name: keyof Static<T> & string, options: FormCtrlOptions<T>, schema: TObject, required: boolean, context: {
|
|
23
23
|
parent: string;
|
|
24
24
|
store: Record<string, any>;
|
|
25
25
|
}): InputField;
|
|
26
|
+
/**
|
|
27
|
+
* Convert an input value from HTML to the correct type based on the schema.
|
|
28
|
+
*/
|
|
26
29
|
protected getValueFromInput(input: FormDataEntryValue, schema: TSchema): any;
|
|
27
30
|
protected valueToInputEntry(value: any): string | number | boolean;
|
|
28
31
|
}
|
package/react/i18n.d.ts
CHANGED
|
@@ -2,20 +2,25 @@ import * as _alepha_core1 from "alepha";
|
|
|
2
2
|
import { Alepha, Descriptor, KIND } from "alepha";
|
|
3
3
|
import * as _alepha_logger0 from "alepha/logger";
|
|
4
4
|
import * as _alepha_server_cookies0 from "alepha/server/cookies";
|
|
5
|
-
import * as
|
|
5
|
+
import * as typebox0 from "typebox";
|
|
6
6
|
|
|
7
7
|
//#region src/hooks/useI18n.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* Hook to access the i18n service.
|
|
10
10
|
*/
|
|
11
|
-
declare const useI18n: <S extends object, K extends keyof ServiceDictionary<S>>() => I18nProvider<
|
|
11
|
+
declare const useI18n: <S extends object, K extends keyof ServiceDictionary<S>>() => I18nProvider<S, K> & {
|
|
12
|
+
tr(key: keyof ServiceDictionary<S>[K] | string, options?: {
|
|
13
|
+
args?: string[];
|
|
14
|
+
default?: string;
|
|
15
|
+
}): string;
|
|
16
|
+
};
|
|
12
17
|
type ServiceDictionary<T extends object> = { [K in keyof T]: T[K] extends DictionaryDescriptor<infer U> ? U : never };
|
|
13
18
|
//#endregion
|
|
14
19
|
//#region src/providers/I18nProvider.d.ts
|
|
15
20
|
declare class I18nProvider<S extends object, K extends keyof ServiceDictionary<S>> {
|
|
16
21
|
protected logger: _alepha_logger0.Logger;
|
|
17
22
|
protected alepha: Alepha;
|
|
18
|
-
protected cookie: _alepha_server_cookies0.AbstractCookieDescriptor<
|
|
23
|
+
protected cookie: _alepha_server_cookies0.AbstractCookieDescriptor<typebox0.TString>;
|
|
19
24
|
readonly registry: Array<{
|
|
20
25
|
name: string;
|
|
21
26
|
lang: string;
|