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/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.TNumber;
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.TNumber;
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.TNumber;
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 isWorkersRunning: boolean;
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. zug zug!
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
- * This descriptor provides a powerful message queue system that enables decoupled, asynchronous
121
- * communication between different parts of your application. It supports multiple storage backends,
122
- * type-safe message handling, and automatic worker processing with intelligent retry mechanisms.
123
- *
124
- * **Key Features**
125
- *
126
- * - **Type-Safe Messages**: Full TypeScript support with schema validation using TypeBox
127
- * - **Multiple Storage Backends**: Support for in-memory, Redis, and custom queue providers
128
- * - **Background Processing**: Automatic worker threads for message processing
129
- * - **Reliable Delivery**: Built-in retry mechanisms and error handling
130
- * - **Scalable Architecture**: Horizontal scaling support with distributed queue backends
131
- * - **Dead Letter Queues**: Failed message handling with configurable retry policies
132
- *
133
- * **Use Cases**
134
- *
135
- * Perfect for decoupling application components and handling asynchronous tasks:
136
- * - Background job processing
137
- * - Email and notification sending
138
- * - Image/file processing pipelines
139
- * - Event-driven architectures
140
- * - Microservice communication
141
- * - Long-running data operations
142
- *
143
- * @example
144
- * **Basic queue with automatic processing:**
145
- * ```ts
146
- * import { $queue } from "alepha/queue";
147
- * import { t } from "alepha";
148
- *
149
- * class NotificationService {
150
- * emailQueue = $queue({
151
- * name: "email-notifications",
152
- * schema: t.object({
153
- * to: t.string(),
154
- * subject: t.string(),
155
- * body: t.string(),
156
- * priority: t.optional(t.enum(["high", "normal"]))
157
- * }),
158
- * handler: async (message) => {
159
- * // This runs in a background worker
160
- * await this.sendEmail(message.payload);
161
- * console.log(`Email sent to ${message.payload.to}`);
162
- * }
163
- * });
164
- *
165
- * async sendWelcomeEmail(userEmail: string) {
166
- * // Push message to queue for background processing
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
- * **Batch processing with multiple messages:**
179
- * ```ts
180
- * class ImageProcessor {
181
- * imageQueue = $queue({
182
- * name: "image-processing",
183
- * description: "Process uploaded images for optimization and thumbnails",
184
- * schema: t.object({
185
- * imageId: t.string(),
186
- * originalUrl: t.string(),
187
- * userId: t.string(),
188
- * operations: t.array(t.union([
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
- * **Redis-backed queue for production scalability:**
222
- * ```ts
223
- * class OrderProcessor {
224
- * orderQueue = $queue({
225
- * name: "order-processing",
226
- * provider: RedisQueueProvider, // Use Redis for distributed processing
227
- * schema: t.object({
228
- * orderId: t.string(),
229
- * customerId: t.string(),
230
- * items: t.array(t.object({
231
- * productId: t.string(),
232
- * quantity: t.number(),
233
- * price: t.number()
234
- * })),
235
- * paymentMethod: t.string(),
236
- * shippingAddress: t.object({
237
- * street: t.string(),
238
- * city: t.string(),
239
- * zipCode: t.string(),
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["payload"]>;
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 _sinclair_typebox155 from "@sinclair/typebox";
12
+ import * as typebox143 from "typebox";
13
13
 
14
14
  //#region src/schemas/tokensSchema.d.ts
15
- declare const tokensSchema: _sinclair_typebox155.TObject<{
16
- provider: _sinclair_typebox155.TString;
17
- access_token: _sinclair_typebox155.TString;
18
- issued_at: _sinclair_typebox155.TNumber;
19
- expires_in: _sinclair_typebox155.TOptional<_sinclair_typebox155.TNumber>;
20
- refresh_token: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
21
- refresh_token_expires_in: _sinclair_typebox155.TOptional<_sinclair_typebox155.TNumber>;
22
- refresh_expires_in: _sinclair_typebox155.TOptional<_sinclair_typebox155.TNumber>;
23
- id_token: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
24
- scope: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
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<_sinclair_typebox155.TObject<{
78
- provider: _sinclair_typebox155.TString;
79
- codeVerifier: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
80
- redirectUri: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
81
- state: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
82
- nonce: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
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<_sinclair_typebox155.TObject<{
85
- provider: _sinclair_typebox155.TString;
86
- access_token: _sinclair_typebox155.TString;
87
- issued_at: _sinclair_typebox155.TNumber;
88
- expires_in: _sinclair_typebox155.TOptional<_sinclair_typebox155.TNumber>;
89
- refresh_token: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
90
- refresh_token_expires_in: _sinclair_typebox155.TOptional<_sinclair_typebox155.TNumber>;
91
- refresh_expires_in: _sinclair_typebox155.TOptional<_sinclair_typebox155.TNumber>;
92
- id_token: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
93
- scope: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
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: _sinclair_typebox155.TObject<{
116
- user: _sinclair_typebox155.TOptional<_sinclair_typebox155.TObject<{
117
- id: _sinclair_typebox155.TString;
118
- name: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
119
- email: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
120
- username: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
121
- picture: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
122
- sessionId: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
123
- organizations: _sinclair_typebox155.TOptional<_sinclair_typebox155.TArray<_sinclair_typebox155.TString>>;
124
- roles: _sinclair_typebox155.TOptional<_sinclair_typebox155.TArray<_sinclair_typebox155.TString>>;
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: _sinclair_typebox155.TObject<{
127
- prefix: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
128
- links: _sinclair_typebox155.TArray<_sinclair_typebox155.TObject<{
129
- name: _sinclair_typebox155.TString;
130
- group: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
131
- path: _sinclair_typebox155.TString;
132
- method: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
133
- requestBodyType: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
134
- service: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
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: _sinclair_typebox155.TObject<{
144
- provider: _sinclair_typebox155.TString;
139
+ query: typebox143.TObject<{
140
+ provider: typebox143.TString;
145
141
  }>;
146
- body: _sinclair_typebox155.TObject<{
147
- refresh_token: _sinclair_typebox155.TString;
148
- access_token: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
142
+ body: typebox143.TObject<{
143
+ refresh_token: typebox143.TString;
144
+ access_token: typebox143.TOptional<typebox143.TString>;
149
145
  }>;
150
- response: _sinclair_typebox155.TObject<{
151
- provider: _sinclair_typebox155.TString;
152
- access_token: _sinclair_typebox155.TString;
153
- issued_at: _sinclair_typebox155.TNumber;
154
- expires_in: _sinclair_typebox155.TOptional<_sinclair_typebox155.TNumber>;
155
- refresh_token: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
156
- refresh_token_expires_in: _sinclair_typebox155.TOptional<_sinclair_typebox155.TNumber>;
157
- refresh_expires_in: _sinclair_typebox155.TOptional<_sinclair_typebox155.TNumber>;
158
- id_token: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
159
- scope: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
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: _sinclair_typebox155.TObject<{
169
- provider: _sinclair_typebox155.TString;
162
+ query: typebox143.TObject<{
163
+ provider: typebox143.TString;
170
164
  }>;
171
- body: _sinclair_typebox155.TObject<{
172
- username: _sinclair_typebox155.TString;
173
- password: _sinclair_typebox155.TString;
165
+ body: typebox143.TObject<{
166
+ username: typebox143.TString;
167
+ password: typebox143.TString;
174
168
  }>;
175
- response: _sinclair_typebox155.TObject<{
176
- provider: _sinclair_typebox155.TString;
177
- access_token: _sinclair_typebox155.TString;
178
- issued_at: _sinclair_typebox155.TNumber;
179
- expires_in: _sinclair_typebox155.TOptional<_sinclair_typebox155.TNumber>;
180
- refresh_token: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
181
- refresh_token_expires_in: _sinclair_typebox155.TOptional<_sinclair_typebox155.TNumber>;
182
- refresh_expires_in: _sinclair_typebox155.TOptional<_sinclair_typebox155.TNumber>;
183
- id_token: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
184
- scope: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
185
- token: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
186
- realm: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
187
- user: _sinclair_typebox155.TObject<{
188
- id: _sinclair_typebox155.TString;
189
- name: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
190
- email: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
191
- username: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
192
- picture: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
193
- sessionId: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
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: _sinclair_typebox155.TObject<{
198
- prefix: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
199
- links: _sinclair_typebox155.TArray<_sinclair_typebox155.TObject<{
200
- name: _sinclair_typebox155.TString;
201
- group: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
202
- path: _sinclair_typebox155.TString;
203
- method: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
204
- requestBodyType: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
205
- service: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
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: _sinclair_typebox155.TObject<{
215
- provider: _sinclair_typebox155.TString;
216
- redirect_uri: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
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: _sinclair_typebox155.TObject<{
229
- post_logout_redirect_uri: _sinclair_typebox155.TOptional<_sinclair_typebox155.TString>;
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: TSchema, required: boolean, context: {
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 _sinclair_typebox0 from "@sinclair/typebox";
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<object, never>;
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<_sinclair_typebox0.TString>;
23
+ protected cookie: _alepha_server_cookies0.AbstractCookieDescriptor<typebox0.TString>;
19
24
  readonly registry: Array<{
20
25
  name: string;
21
26
  lang: string;