alepha 0.10.6 → 0.11.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/api/files.d.ts +336 -175
- package/api/jobs.d.ts +139 -195
- package/api/notifications.cjs +8 -0
- package/api/notifications.d.ts +264 -0
- package/api/notifications.js +1 -0
- package/api/users.d.ts +790 -261
- package/api/verifications.cjs +8 -0
- package/api/verifications.d.ts +1 -0
- package/api/verifications.js +1 -0
- package/batch.d.ts +1 -1
- package/bucket.d.ts +1 -195
- package/cache.d.ts +1 -1
- package/core.d.ts +301 -189
- package/datetime.d.ts +41 -10
- package/email.d.ts +41 -225
- package/logger.d.ts +19 -10
- package/package.json +70 -62
- package/postgres.d.ts +624 -1284
- package/react/auth.d.ts +1 -1
- package/react/form.d.ts +19 -8
- package/react/i18n.d.ts +8 -5
- package/react.d.ts +30 -10
- package/scheduler.d.ts +12 -2
- package/server/cache.d.ts +86 -11
- package/server/health.d.ts +31 -8
- package/server/multipart.d.ts +2 -2
- package/server/swagger.d.ts +6 -1
- package/server.d.ts +43 -29
- package/ui.cjs +8 -0
- package/ui.d.ts +619 -0
- package/ui.js +1 -0
- package/vite.d.ts +12 -5
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var m = require('@alepha/api-verifications');
|
|
3
|
+
Object.keys(m).forEach(function (k) {
|
|
4
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function () { return m[k]; }
|
|
7
|
+
});
|
|
8
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@alepha/api-verifications';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@alepha/api-verifications'
|
package/batch.d.ts
CHANGED
|
@@ -533,7 +533,7 @@ declare class BatchDescriptor<TItem extends TSchema, TResponse = any> extends De
|
|
|
533
533
|
protected readonly dateTime: DateTimeProvider;
|
|
534
534
|
protected readonly partitions: Map<any, any>;
|
|
535
535
|
protected activeHandlers: PromiseWithResolvers<void>[];
|
|
536
|
-
protected retry: _alepha_retry0.RetryDescriptorFn<(items: typebox0.StaticType<[], "
|
|
536
|
+
protected retry: _alepha_retry0.RetryDescriptorFn<(items: typebox0.StaticType<[], "Decode", {}, {}, TItem>[]) => TResponse>;
|
|
537
537
|
/**
|
|
538
538
|
* Pushes an item into the batch. The item will be processed
|
|
539
539
|
* asynchronously with other items when the batch is flushed.
|
package/bucket.d.ts
CHANGED
|
@@ -187,200 +187,6 @@ declare class MemoryFileStorageProvider implements FileStorageProvider {
|
|
|
187
187
|
* }
|
|
188
188
|
* }
|
|
189
189
|
* ```
|
|
190
|
-
*
|
|
191
|
-
* @example
|
|
192
|
-
* **Cloud storage integration with custom provider:**
|
|
193
|
-
* ```ts
|
|
194
|
-
* class ProductImageService {
|
|
195
|
-
* productImages = $bucket({
|
|
196
|
-
* name: "product-images",
|
|
197
|
-
* provider: S3FileStorageProvider, // Use AWS S3 for production storage
|
|
198
|
-
* description: "Product catalog images and thumbnails",
|
|
199
|
-
* mimeTypes: ["image/jpeg", "image/png", "image/webp"],
|
|
200
|
-
* maxSize: 10 // 10MB for high-quality product images
|
|
201
|
-
* });
|
|
202
|
-
*
|
|
203
|
-
* thumbnails = $bucket({
|
|
204
|
-
* name: "product-thumbnails",
|
|
205
|
-
* provider: S3FileStorageProvider,
|
|
206
|
-
* description: "Generated product thumbnail images",
|
|
207
|
-
* mimeTypes: ["image/jpeg", "image/webp"],
|
|
208
|
-
* maxSize: 1 // 1MB for thumbnails
|
|
209
|
-
* });
|
|
210
|
-
*
|
|
211
|
-
* async uploadProductImage(productId: string, file: FileLike): Promise<{ imageId: string; thumbnailId: string }> {
|
|
212
|
-
* try {
|
|
213
|
-
* // Upload original image
|
|
214
|
-
* const imageId = await this.productImages.upload(file);
|
|
215
|
-
*
|
|
216
|
-
* // Generate and upload thumbnail
|
|
217
|
-
* const thumbnailFile = await this.imageProcessor.generateThumbnail(file, {
|
|
218
|
-
* width: 300,
|
|
219
|
-
* height: 300,
|
|
220
|
-
* format: 'webp',
|
|
221
|
-
* quality: 80
|
|
222
|
-
* });
|
|
223
|
-
*
|
|
224
|
-
* const thumbnailId = await this.thumbnails.upload(thumbnailFile);
|
|
225
|
-
*
|
|
226
|
-
* // Update product in database
|
|
227
|
-
* await this.database.products.update(productId, {
|
|
228
|
-
* imageId,
|
|
229
|
-
* thumbnailId,
|
|
230
|
-
* imageUpdatedAt: new Date()
|
|
231
|
-
* });
|
|
232
|
-
*
|
|
233
|
-
* console.log(`Product images uploaded for ${productId}: image=${imageId}, thumbnail=${thumbnailId}`);
|
|
234
|
-
*
|
|
235
|
-
* return { imageId, thumbnailId };
|
|
236
|
-
*
|
|
237
|
-
* } catch (error) {
|
|
238
|
-
* console.error(`Failed to upload product image for ${productId}`, error);
|
|
239
|
-
* throw error;
|
|
240
|
-
* }
|
|
241
|
-
* }
|
|
242
|
-
*
|
|
243
|
-
* async getProductImage(productId: string, thumbnail: boolean = false): Promise<FileLike> {
|
|
244
|
-
* const product = await this.database.products.findById(productId);
|
|
245
|
-
* if (!product) {
|
|
246
|
-
* throw new Error(`Product ${productId} not found`);
|
|
247
|
-
* }
|
|
248
|
-
*
|
|
249
|
-
* const imageId = thumbnail ? product.thumbnailId : product.imageId;
|
|
250
|
-
* if (!imageId) {
|
|
251
|
-
* throw new Error(`Product ${productId} has no ${thumbnail ? 'thumbnail' : 'image'}`);
|
|
252
|
-
* }
|
|
253
|
-
*
|
|
254
|
-
* const bucket = thumbnail ? this.thumbnails : this.productImages;
|
|
255
|
-
* return await bucket.download(imageId);
|
|
256
|
-
* }
|
|
257
|
-
* }
|
|
258
|
-
* ```
|
|
259
|
-
*
|
|
260
|
-
* @example
|
|
261
|
-
* **Temporary file processing with memory storage:**
|
|
262
|
-
* ```ts
|
|
263
|
-
* class FileProcessingService {
|
|
264
|
-
* tempFiles = $bucket({
|
|
265
|
-
* name: "temp-processing",
|
|
266
|
-
* provider: "memory", // Use in-memory storage for temporary files
|
|
267
|
-
* description: "Temporary files during processing workflows",
|
|
268
|
-
* maxSize: 100 // Large limit for processing workflows
|
|
269
|
-
* });
|
|
270
|
-
*
|
|
271
|
-
* async processDataFile(inputFile: FileLike, transformations: string[]): Promise<FileLike> {
|
|
272
|
-
* let currentFile = inputFile;
|
|
273
|
-
* const intermediateFiles: string[] = [];
|
|
274
|
-
*
|
|
275
|
-
* try {
|
|
276
|
-
* // Upload initial file to temp storage
|
|
277
|
-
* let currentFileId = await this.tempFiles.upload(currentFile);
|
|
278
|
-
* intermediateFiles.push(currentFileId);
|
|
279
|
-
*
|
|
280
|
-
* // Apply each transformation
|
|
281
|
-
* for (const transformation of transformations) {
|
|
282
|
-
* console.log(`Applying transformation: ${transformation}`);
|
|
283
|
-
*
|
|
284
|
-
* // Download current file
|
|
285
|
-
* currentFile = await this.tempFiles.download(currentFileId);
|
|
286
|
-
*
|
|
287
|
-
* // Apply transformation
|
|
288
|
-
* const transformedFile = await this.applyTransformation(currentFile, transformation);
|
|
289
|
-
*
|
|
290
|
-
* // Upload transformed file
|
|
291
|
-
* currentFileId = await this.tempFiles.upload(transformedFile);
|
|
292
|
-
* intermediateFiles.push(currentFileId);
|
|
293
|
-
* }
|
|
294
|
-
*
|
|
295
|
-
* // Download final result
|
|
296
|
-
* const finalFile = await this.tempFiles.download(currentFileId);
|
|
297
|
-
*
|
|
298
|
-
* console.log(`File processing completed with ${transformations.length} transformations`);
|
|
299
|
-
* return finalFile;
|
|
300
|
-
*
|
|
301
|
-
* } finally {
|
|
302
|
-
* // Clean up all intermediate files
|
|
303
|
-
* for (const fileId of intermediateFiles) {
|
|
304
|
-
* try {
|
|
305
|
-
* await this.tempFiles.delete(fileId);
|
|
306
|
-
* } catch (error) {
|
|
307
|
-
* console.warn(`Failed to clean up temp file ${fileId}:`, error.message);
|
|
308
|
-
* }
|
|
309
|
-
* }
|
|
310
|
-
* console.log(`Cleaned up ${intermediateFiles.length} temporary files`);
|
|
311
|
-
* }
|
|
312
|
-
* }
|
|
313
|
-
* }
|
|
314
|
-
* ```
|
|
315
|
-
*
|
|
316
|
-
* @example
|
|
317
|
-
* **File validation with dynamic configuration:**
|
|
318
|
-
* ```ts
|
|
319
|
-
* class UserContentService {
|
|
320
|
-
* userContent = $bucket({
|
|
321
|
-
* name: "user-content",
|
|
322
|
-
* description: "User-generated content with flexible validation"
|
|
323
|
-
* // Base configuration - can be overridden per operation
|
|
324
|
-
* });
|
|
325
|
-
*
|
|
326
|
-
* async uploadUserFile(file: FileLike, userId: string, contentType: 'avatar' | 'document' | 'media'): Promise<string> {
|
|
327
|
-
* // Dynamic validation based on content type
|
|
328
|
-
* const validationConfig = this.getValidationConfig(contentType, userId);
|
|
329
|
-
*
|
|
330
|
-
* try {
|
|
331
|
-
* // Upload with specific validation rules
|
|
332
|
-
* const fileId = await this.userContent.upload(file, validationConfig);
|
|
333
|
-
*
|
|
334
|
-
* // Log upload for audit trail
|
|
335
|
-
* await this.auditLogger.log({
|
|
336
|
-
* action: 'file_upload',
|
|
337
|
-
* userId,
|
|
338
|
-
* fileId,
|
|
339
|
-
* contentType,
|
|
340
|
-
* fileName: file.name,
|
|
341
|
-
* fileSize: file.size,
|
|
342
|
-
* mimeType: file.type
|
|
343
|
-
* });
|
|
344
|
-
*
|
|
345
|
-
* return fileId;
|
|
346
|
-
*
|
|
347
|
-
* } catch (error) {
|
|
348
|
-
* console.error(`File upload failed for user ${userId}`, {
|
|
349
|
-
* contentType,
|
|
350
|
-
* fileName: file.name,
|
|
351
|
-
* error: error.message
|
|
352
|
-
* });
|
|
353
|
-
* throw error;
|
|
354
|
-
* }
|
|
355
|
-
* }
|
|
356
|
-
*
|
|
357
|
-
* private getValidationConfig(contentType: string, userId: string) {
|
|
358
|
-
* const baseConfig = {
|
|
359
|
-
* avatar: {
|
|
360
|
-
* mimeTypes: ['image/jpeg', 'image/png'],
|
|
361
|
-
* maxSize: 2 // 2MB for avatars
|
|
362
|
-
* },
|
|
363
|
-
* document: {
|
|
364
|
-
* mimeTypes: ['application/pdf', 'text/plain'],
|
|
365
|
-
* maxSize: 10 // 10MB for documents
|
|
366
|
-
* },
|
|
367
|
-
* media: {
|
|
368
|
-
* mimeTypes: ['image/jpeg', 'image/png', 'video/mp4'],
|
|
369
|
-
* maxSize: 50 // 50MB for media files
|
|
370
|
-
* }
|
|
371
|
-
* };
|
|
372
|
-
*
|
|
373
|
-
* const config = baseConfig[contentType];
|
|
374
|
-
*
|
|
375
|
-
* // Premium users get higher limits
|
|
376
|
-
* if (this.userService.isPremium(userId)) {
|
|
377
|
-
* config.maxSize *= 2;
|
|
378
|
-
* }
|
|
379
|
-
*
|
|
380
|
-
* return config;
|
|
381
|
-
* }
|
|
382
|
-
* }
|
|
383
|
-
* ```
|
|
384
190
|
*/
|
|
385
191
|
declare const $bucket: {
|
|
386
192
|
(options: BucketDescriptorOptions): BucketDescriptor;
|
|
@@ -528,7 +334,7 @@ declare class BucketDescriptor extends Descriptor<BucketDescriptorOptions> {
|
|
|
528
334
|
/**
|
|
529
335
|
* Delete permanently a file from the bucket.
|
|
530
336
|
*/
|
|
531
|
-
delete(fileId: string): Promise<void>;
|
|
337
|
+
delete(fileId: string, skipHook?: boolean): Promise<void>;
|
|
532
338
|
/**
|
|
533
339
|
* Checks if a file exists in the bucket.
|
|
534
340
|
*/
|
package/cache.d.ts
CHANGED
|
@@ -185,7 +185,7 @@ declare const $cache: {
|
|
|
185
185
|
<TReturn = string, TParameter extends any[] = any[]>(options?: CacheDescriptorOptions<TReturn, TParameter>): CacheDescriptorFn<TReturn, TParameter>;
|
|
186
186
|
[KIND]: typeof CacheDescriptor;
|
|
187
187
|
};
|
|
188
|
-
interface CacheDescriptorOptions<TReturn, TParameter extends any[] = any[]> {
|
|
188
|
+
interface CacheDescriptorOptions<TReturn = any, TParameter extends any[] = any[]> {
|
|
189
189
|
/**
|
|
190
190
|
* The cache name. This is useful for invalidating multiple caches at once.
|
|
191
191
|
*
|