alepha 0.11.7 → 0.11.10

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.
Files changed (169) hide show
  1. package/README.md +55 -17
  2. package/dist/index.cjs +15805 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +1 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.js +15804 -0
  7. package/dist/index.js.map +1 -0
  8. package/package.json +36 -372
  9. package/src/assets/biomeJson.ts +33 -0
  10. package/src/assets/tsconfigJson.ts +17 -0
  11. package/src/assets/viteConfigTs.ts +14 -0
  12. package/src/commands/BiomeCommands.ts +60 -0
  13. package/src/commands/CoreCommands.ts +266 -0
  14. package/src/commands/DrizzleCommands.ts +403 -0
  15. package/src/commands/VerifyCommands.ts +48 -0
  16. package/src/commands/ViteCommands.ts +152 -0
  17. package/src/index.ts +35 -0
  18. package/src/services/ProcessRunner.ts +89 -0
  19. package/src/version.ts +7 -0
  20. package/api/files.cjs +0 -8
  21. package/api/files.d.ts +0 -438
  22. package/api/files.js +0 -1
  23. package/api/jobs.cjs +0 -8
  24. package/api/jobs.d.ts +0 -327
  25. package/api/jobs.js +0 -1
  26. package/api/notifications.cjs +0 -8
  27. package/api/notifications.d.ts +0 -263
  28. package/api/notifications.js +0 -1
  29. package/api/users.cjs +0 -8
  30. package/api/users.d.ts +0 -923
  31. package/api/users.js +0 -1
  32. package/api/verifications.cjs +0 -8
  33. package/api/verifications.d.ts +0 -1
  34. package/api/verifications.js +0 -1
  35. package/batch.cjs +0 -8
  36. package/batch.d.ts +0 -154
  37. package/batch.js +0 -1
  38. package/bucket.cjs +0 -8
  39. package/bucket.d.ts +0 -520
  40. package/bucket.js +0 -1
  41. package/cache/redis.cjs +0 -8
  42. package/cache/redis.d.ts +0 -40
  43. package/cache/redis.js +0 -1
  44. package/cache.cjs +0 -8
  45. package/cache.d.ts +0 -288
  46. package/cache.js +0 -1
  47. package/command.cjs +0 -8
  48. package/command.d.ts +0 -269
  49. package/command.js +0 -1
  50. package/core.cjs +0 -8
  51. package/core.d.ts +0 -1904
  52. package/core.js +0 -1
  53. package/datetime.cjs +0 -8
  54. package/datetime.d.ts +0 -144
  55. package/datetime.js +0 -1
  56. package/devtools.cjs +0 -8
  57. package/devtools.d.ts +0 -252
  58. package/devtools.js +0 -1
  59. package/email.cjs +0 -8
  60. package/email.d.ts +0 -187
  61. package/email.js +0 -1
  62. package/fake.cjs +0 -8
  63. package/fake.d.ts +0 -73
  64. package/fake.js +0 -1
  65. package/file.cjs +0 -8
  66. package/file.d.ts +0 -528
  67. package/file.js +0 -1
  68. package/lock/redis.cjs +0 -8
  69. package/lock/redis.d.ts +0 -24
  70. package/lock/redis.js +0 -1
  71. package/lock.cjs +0 -8
  72. package/lock.d.ts +0 -552
  73. package/lock.js +0 -1
  74. package/logger.cjs +0 -8
  75. package/logger.d.ts +0 -287
  76. package/logger.js +0 -1
  77. package/postgres.cjs +0 -8
  78. package/postgres.d.ts +0 -2143
  79. package/postgres.js +0 -1
  80. package/queue/redis.cjs +0 -8
  81. package/queue/redis.d.ts +0 -29
  82. package/queue/redis.js +0 -1
  83. package/queue.cjs +0 -8
  84. package/queue.d.ts +0 -760
  85. package/queue.js +0 -1
  86. package/react/auth.cjs +0 -8
  87. package/react/auth.d.ts +0 -504
  88. package/react/auth.js +0 -1
  89. package/react/form.cjs +0 -8
  90. package/react/form.d.ts +0 -211
  91. package/react/form.js +0 -1
  92. package/react/head.cjs +0 -8
  93. package/react/head.d.ts +0 -120
  94. package/react/head.js +0 -1
  95. package/react/i18n.cjs +0 -8
  96. package/react/i18n.d.ts +0 -168
  97. package/react/i18n.js +0 -1
  98. package/react.cjs +0 -8
  99. package/react.d.ts +0 -1263
  100. package/react.js +0 -1
  101. package/redis.cjs +0 -8
  102. package/redis.d.ts +0 -82
  103. package/redis.js +0 -1
  104. package/retry.cjs +0 -8
  105. package/retry.d.ts +0 -162
  106. package/retry.js +0 -1
  107. package/router.cjs +0 -8
  108. package/router.d.ts +0 -45
  109. package/router.js +0 -1
  110. package/scheduler.cjs +0 -8
  111. package/scheduler.d.ts +0 -145
  112. package/scheduler.js +0 -1
  113. package/security.cjs +0 -8
  114. package/security.d.ts +0 -586
  115. package/security.js +0 -1
  116. package/server/cache.cjs +0 -8
  117. package/server/cache.d.ts +0 -163
  118. package/server/cache.js +0 -1
  119. package/server/compress.cjs +0 -8
  120. package/server/compress.d.ts +0 -38
  121. package/server/compress.js +0 -1
  122. package/server/cookies.cjs +0 -8
  123. package/server/cookies.d.ts +0 -144
  124. package/server/cookies.js +0 -1
  125. package/server/cors.cjs +0 -8
  126. package/server/cors.d.ts +0 -45
  127. package/server/cors.js +0 -1
  128. package/server/health.cjs +0 -8
  129. package/server/health.d.ts +0 -58
  130. package/server/health.js +0 -1
  131. package/server/helmet.cjs +0 -8
  132. package/server/helmet.d.ts +0 -98
  133. package/server/helmet.js +0 -1
  134. package/server/links.cjs +0 -8
  135. package/server/links.d.ts +0 -322
  136. package/server/links.js +0 -1
  137. package/server/metrics.cjs +0 -8
  138. package/server/metrics.d.ts +0 -35
  139. package/server/metrics.js +0 -1
  140. package/server/multipart.cjs +0 -8
  141. package/server/multipart.d.ts +0 -42
  142. package/server/multipart.js +0 -1
  143. package/server/proxy.cjs +0 -8
  144. package/server/proxy.d.ts +0 -234
  145. package/server/proxy.js +0 -1
  146. package/server/security.cjs +0 -8
  147. package/server/security.d.ts +0 -92
  148. package/server/security.js +0 -1
  149. package/server/static.cjs +0 -8
  150. package/server/static.d.ts +0 -119
  151. package/server/static.js +0 -1
  152. package/server/swagger.cjs +0 -8
  153. package/server/swagger.d.ts +0 -161
  154. package/server/swagger.js +0 -1
  155. package/server.cjs +0 -8
  156. package/server.d.ts +0 -849
  157. package/server.js +0 -1
  158. package/topic/redis.cjs +0 -8
  159. package/topic/redis.d.ts +0 -42
  160. package/topic/redis.js +0 -1
  161. package/topic.cjs +0 -8
  162. package/topic.d.ts +0 -819
  163. package/topic.js +0 -1
  164. package/ui.cjs +0 -8
  165. package/ui.d.ts +0 -813
  166. package/ui.js +0 -1
  167. package/vite.cjs +0 -8
  168. package/vite.d.ts +0 -186
  169. package/vite.js +0 -1
package/bucket.d.ts DELETED
@@ -1,520 +0,0 @@
1
- import * as _alepha_core1 from "alepha";
2
- import { Alepha, AlephaError, Descriptor, FileLike, KIND, Service, Static } from "alepha";
3
- import { FileSystem } from "alepha/file";
4
- import * as fs from "node:fs";
5
- import * as _alepha_logger0 from "alepha/logger";
6
- import * as typebox0 from "typebox";
7
-
8
- //#region src/providers/FileStorageProvider.d.ts
9
- declare abstract class FileStorageProvider {
10
- /**
11
- * Uploads a file to the storage.
12
- *
13
- * @param bucketName - Container name
14
- * @param file - File to upload
15
- * @param fileId - Optional file identifier. If not provided, a unique ID will be generated.
16
- * @return The identifier of the uploaded file.
17
- */
18
- abstract upload(bucketName: string, file: FileLike, fileId?: string): Promise<string>;
19
- /**
20
- * Downloads a file from the storage.
21
- *
22
- * @param bucketName - Container name
23
- * @param fileId - Identifier of the file to download
24
- * @return The downloaded file as a FileLike object.
25
- */
26
- abstract download(bucketName: string, fileId: string): Promise<FileLike>;
27
- /**
28
- * Check if fileId exists in the storage bucket.
29
- *
30
- * @param bucketName - Container name
31
- * @param fileId - Identifier of the file to stream
32
- * @return True is the file exists, false otherwise.
33
- */
34
- abstract exists(bucketName: string, fileId: string): Promise<boolean>;
35
- /**
36
- * Delete permanently a file from the storage.
37
- *
38
- * @param bucketName - Container name
39
- * @param fileId - Identifier of the file to delete
40
- */
41
- abstract delete(bucketName: string, fileId: string): Promise<void>;
42
- }
43
- //#endregion
44
- //#region src/providers/MemoryFileStorageProvider.d.ts
45
- declare class MemoryFileStorageProvider implements FileStorageProvider {
46
- readonly files: Record<string, FileLike>;
47
- private readonly fileSystem;
48
- upload(bucketName: string, file: FileLike, fileId?: string): Promise<string>;
49
- download(bucketName: string, fileId: string): Promise<FileLike>;
50
- exists(bucketName: string, fileId: string): Promise<boolean>;
51
- delete(bucketName: string, fileId: string): Promise<void>;
52
- protected createId(): string;
53
- }
54
- //#endregion
55
- //#region src/descriptors/$bucket.d.ts
56
- /**
57
- * Creates a bucket descriptor for file storage and management with configurable validation.
58
- *
59
- * This descriptor provides a comprehensive file storage system that handles file uploads,
60
- * downloads, validation, and management across multiple storage backends. It supports
61
- * MIME type validation, size limits, and integrates seamlessly with various storage
62
- * providers for scalable file management in applications.
63
- *
64
- * **Key Features**
65
- *
66
- * - **Multi-Provider Support**: Works with filesystem, cloud storage (S3, Azure), and in-memory providers
67
- * - **File Validation**: Automatic MIME type checking and file size validation
68
- * - **Type Safety**: Full TypeScript support with FileLike interface compatibility
69
- * - **Event Integration**: Emits events for file operations (upload, delete) for monitoring
70
- * - **Flexible Configuration**: Per-bucket and per-operation configuration options
71
- * - **Automatic Detection**: Smart file type and size detection with fallback mechanisms
72
- * - **Error Handling**: Comprehensive error handling with descriptive error messages
73
- *
74
- * **Use Cases**
75
- *
76
- * Perfect for handling file storage requirements across applications:
77
- * - User profile picture and document uploads
78
- * - Product image and media management
79
- * - Document storage and retrieval systems
80
- * - Temporary file handling and processing
81
- * - Content delivery and asset management
82
- * - Backup and archival storage
83
- * - File-based data import/export workflows
84
- *
85
- * @example
86
- * **Basic file upload bucket:**
87
- * ```ts
88
- * import { $bucket } from "alepha/bucket";
89
- *
90
- * class MediaService {
91
- * images = $bucket({
92
- * name: "user-images",
93
- * description: "User uploaded profile images and photos",
94
- * mimeTypes: ["image/jpeg", "image/png", "image/gif", "image/webp"],
95
- * maxSize: 5 // 5MB limit
96
- * });
97
- *
98
- * async uploadProfileImage(file: FileLike, userId: string): Promise<string> {
99
- * // File is automatically validated against MIME types and size
100
- * const fileId = await this.images.upload(file);
101
- *
102
- * // Update user profile with new image
103
- * await this.userService.updateProfileImage(userId, fileId);
104
- *
105
- * return fileId;
106
- * }
107
- *
108
- * async getUserProfileImage(userId: string): Promise<FileLike> {
109
- * const user = await this.userService.getUser(userId);
110
- * if (!user.profileImageId) {
111
- * throw new Error('User has no profile image');
112
- * }
113
- *
114
- * return await this.images.download(user.profileImageId);
115
- * }
116
- * }
117
- * ```
118
- *
119
- * @example
120
- * **Document storage with multiple file types:**
121
- * ```ts
122
- * class DocumentManager {
123
- * documents = $bucket({
124
- * name: "company-documents",
125
- * description: "Legal documents, contracts, and reports",
126
- * mimeTypes: [
127
- * "application/pdf",
128
- * "application/msword",
129
- * "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
130
- * "text/plain",
131
- * "text/csv"
132
- * ],
133
- * maxSize: 50 // 50MB for large documents
134
- * });
135
- *
136
- * async uploadDocument(file: FileLike, metadata: { title: string; category: string; userId: string }): Promise<string> {
137
- * try {
138
- * const fileId = await this.documents.upload(file);
139
- *
140
- * // Store document metadata in database
141
- * await this.database.documents.create({
142
- * id: fileId,
143
- * title: metadata.title,
144
- * category: metadata.category,
145
- * uploadedBy: metadata.userId,
146
- * fileName: file.name,
147
- * fileSize: file.size,
148
- * mimeType: file.type,
149
- * uploadedAt: new Date()
150
- * });
151
- *
152
- * console.log(`Document uploaded successfully: ${metadata.title} (${fileId})`);
153
- * return fileId;
154
- *
155
- * } catch (error) {
156
- * console.error(`Failed to upload document: ${metadata.title}`, error);
157
- * throw error;
158
- * }
159
- * }
160
- *
161
- * async downloadDocument(documentId: string, userId: string): Promise<FileLike> {
162
- * // Check permissions
163
- * const document = await this.database.documents.findById(documentId);
164
- * if (!document) {
165
- * throw new Error('Document not found');
166
- * }
167
- *
168
- * const hasAccess = await this.permissionService.canAccessDocument(userId, documentId);
169
- * if (!hasAccess) {
170
- * throw new Error('Insufficient permissions to access document');
171
- * }
172
- *
173
- * // Download and return file
174
- * return await this.documents.download(documentId);
175
- * }
176
- *
177
- * async deleteDocument(documentId: string, userId: string): Promise<void> {
178
- * // Verify ownership or admin privileges
179
- * const document = await this.database.documents.findById(documentId);
180
- * if (document.uploadedBy !== userId && !await this.userService.isAdmin(userId)) {
181
- * throw new Error('Cannot delete document: insufficient permissions');
182
- * }
183
- *
184
- * // Delete from storage and database
185
- * await this.documents.delete(documentId);
186
- * await this.database.documents.delete(documentId);
187
- *
188
- * console.log(`Document deleted: ${document.title} (${documentId})`);
189
- * }
190
- * }
191
- * ```
192
- */
193
- declare const $bucket: {
194
- (options: BucketDescriptorOptions): BucketDescriptor;
195
- [KIND]: typeof BucketDescriptor;
196
- };
197
- interface BucketDescriptorOptions extends BucketFileOptions {
198
- /**
199
- * File storage provider configuration for the bucket.
200
- *
201
- * Options:
202
- * - **"memory"**: In-memory storage (default for development, lost on restart)
203
- * - **Service<FileStorageProvider>**: Custom provider class (e.g., S3FileStorageProvider, AzureBlobProvider)
204
- * - **undefined**: Uses the default file storage provider from dependency injection
205
- *
206
- * **Provider Selection Guidelines**:
207
- * - **Development**: Use "memory" for fast, simple testing without external dependencies
208
- * - **Production**: Use cloud providers (S3, Azure Blob, Google Cloud Storage) for scalability
209
- * - **Local deployment**: Use filesystem providers for on-premise installations
210
- * - **Hybrid**: Use different providers for different bucket types (temp files vs permanent storage)
211
- *
212
- * **Provider Capabilities**:
213
- * - File persistence and durability guarantees
214
- * - Scalability and performance characteristics
215
- * - Geographic distribution and CDN integration
216
- * - Cost implications for storage and bandwidth
217
- * - Backup and disaster recovery features
218
- *
219
- * @default Uses injected FileStorageProvider
220
- * @example "memory"
221
- * @example S3FileStorageProvider
222
- * @example AzureBlobStorageProvider
223
- */
224
- provider?: Service<FileStorageProvider> | "memory";
225
- /**
226
- * Unique name identifier for the bucket.
227
- *
228
- * This name is used for:
229
- * - Storage backend organization and partitioning
230
- * - File path generation and URL construction
231
- * - Logging, monitoring, and debugging
232
- * - Access control and permissions management
233
- * - Backup and replication configuration
234
- *
235
- * **Naming Conventions**:
236
- * - Use lowercase with hyphens for consistency
237
- * - Include purpose or content type in the name
238
- * - Avoid spaces and special characters
239
- * - Consider environment prefixes for deployment isolation
240
- *
241
- * If not provided, defaults to the property key where the bucket is declared.
242
- *
243
- * @example "user-avatars"
244
- * @example "product-images"
245
- * @example "legal-documents"
246
- * @example "temp-processing-files"
247
- */
248
- name?: string;
249
- }
250
- interface BucketFileOptions {
251
- /**
252
- * Human-readable description of the bucket's purpose and contents.
253
- *
254
- * Used for:
255
- * - Documentation generation and API references
256
- * - Developer onboarding and system understanding
257
- * - Monitoring dashboards and admin interfaces
258
- * - Compliance and audit documentation
259
- *
260
- * **Description Best Practices**:
261
- * - Explain what types of files this bucket stores
262
- * - Mention any special handling or processing requirements
263
- * - Include information about retention policies if applicable
264
- * - Note any compliance or security considerations
265
- *
266
- * @example "User profile pictures and avatar images"
267
- * @example "Product catalog images with automated thumbnail generation"
268
- * @example "Legal documents requiring long-term retention"
269
- * @example "Temporary files for data processing workflows"
270
- */
271
- description?: string;
272
- /**
273
- * Array of allowed MIME types for files uploaded to this bucket.
274
- *
275
- * When specified, only files with these exact MIME types will be accepted.
276
- * Files with disallowed MIME types will be rejected with an InvalidFileError.
277
- *
278
- * **MIME Type Categories**:
279
- * - Images: "image/jpeg", "image/png", "image/gif", "image/webp", "image/svg+xml"
280
- * - Documents: "application/pdf", "text/plain", "text/csv"
281
- * - Office: "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
282
- * - Archives: "application/zip", "application/x-tar", "application/gzip"
283
- * - Media: "video/mp4", "audio/mpeg", "audio/wav"
284
- *
285
- * **Security Considerations**:
286
- * - Always validate MIME types for user uploads
287
- * - Be cautious with executable file types
288
- * - Consider using allow-lists rather than deny-lists
289
- * - Remember that MIME types can be spoofed by malicious users
290
- *
291
- * If not specified, all MIME types are allowed (not recommended for user uploads).
292
- *
293
- * @example ["image/jpeg", "image/png"] // Only JPEG and PNG images
294
- * @example ["application/pdf", "text/plain"] // Documents only
295
- * @example ["video/mp4", "video/webm"] // Video files
296
- */
297
- mimeTypes?: string[];
298
- /**
299
- * Maximum file size allowed in megabytes (MB).
300
- *
301
- * Files larger than this limit will be rejected with an InvalidFileError.
302
- * This helps prevent:
303
- * - Storage quota exhaustion
304
- * - Memory issues during file processing
305
- * - Long upload times and timeouts
306
- * - Abuse of storage resources
307
- *
308
- * **Size Guidelines by File Type**:
309
- * - Profile images: 1-5 MB
310
- * - Product photos: 5-10 MB
311
- * - Documents: 10-50 MB
312
- * - Video files: 50-500 MB
313
- * - Data files: 100-1000 MB
314
- *
315
- * **Considerations**:
316
- * - Consider your storage costs and limits
317
- * - Factor in network upload speeds for users
318
- * - Account for processing requirements (thumbnails, compression)
319
- * - Set reasonable limits based on actual use cases
320
- *
321
- * @default 10 MB
322
- *
323
- * @example 1 // 1MB for small images
324
- * @example 25 // 25MB for documents
325
- * @example 100 // 100MB for media files
326
- */
327
- maxSize?: number;
328
- }
329
- declare class BucketDescriptor extends Descriptor<BucketDescriptorOptions> {
330
- readonly provider: FileStorageProvider | MemoryFileStorageProvider;
331
- private readonly fileSystem;
332
- get name(): string;
333
- /**
334
- * Uploads a file to the bucket.
335
- */
336
- upload(file: FileLike, options?: BucketFileOptions): Promise<string>;
337
- /**
338
- * Delete permanently a file from the bucket.
339
- */
340
- delete(fileId: string, skipHook?: boolean): Promise<void>;
341
- /**
342
- * Checks if a file exists in the bucket.
343
- */
344
- exists(fileId: string): Promise<boolean>;
345
- /**
346
- * Downloads a file from the bucket.
347
- */
348
- download(fileId: string): Promise<FileLike>;
349
- protected $provider(): FileStorageProvider | MemoryFileStorageProvider;
350
- }
351
- interface BucketFileOptions {
352
- /**
353
- * Optional description of the bucket.
354
- */
355
- description?: string;
356
- /**
357
- * Allowed MIME types.
358
- */
359
- mimeTypes?: string[];
360
- /**
361
- * Maximum size of the files in the bucket.
362
- *
363
- * @default 10
364
- */
365
- maxSize?: number;
366
- }
367
- //#endregion
368
- //#region src/errors/FileNotFoundError.d.ts
369
- declare class FileNotFoundError extends AlephaError {
370
- readonly status = 404;
371
- }
372
- //#endregion
373
- //#region src/services/FileMetadataService.d.ts
374
- interface FileMetadata {
375
- name: string;
376
- type: string;
377
- }
378
- /**
379
- * Service for encoding/decoding file metadata in storage streams.
380
- *
381
- * The metadata is stored at the beginning of the file with the following structure:
382
- * - 4-byte header: UInt32BE containing the metadata length
383
- * - N-byte metadata: JSON object containing file metadata (name, type)
384
- * - Remaining bytes: Actual file content
385
- *
386
- * @example
387
- * ```typescript
388
- * const service = new FileMetadataService();
389
- *
390
- * // Encode metadata and content for storage
391
- * const { header, metadata } = service.encodeMetadata({
392
- * name: "document.pdf",
393
- * type: "application/pdf"
394
- * });
395
- *
396
- * // Decode metadata from stored file
397
- * const fileHandle = await open(filePath, 'r');
398
- * const { metadata, contentStart } = await service.decodeMetadata(fileHandle);
399
- * ```
400
- */
401
- declare class FileMetadataService {
402
- /**
403
- * Length of the header containing metadata size (4 bytes for UInt32BE)
404
- */
405
- static readonly METADATA_HEADER_LENGTH = 4;
406
- /**
407
- * Encodes file metadata into header and metadata buffers.
408
- *
409
- * @param file - The file or metadata to encode
410
- * @returns Object containing the header buffer and metadata buffer
411
- */
412
- encodeMetadata(file: FileLike | FileMetadata): {
413
- header: Buffer;
414
- metadata: Buffer;
415
- };
416
- /**
417
- * Decodes file metadata from a file handle.
418
- *
419
- * @param fileHandle - File handle opened for reading
420
- * @returns Object containing the decoded metadata and content start position
421
- */
422
- decodeMetadata(fileHandle: {
423
- read: (buffer: Buffer, offset: number, length: number, position: number) => Promise<{
424
- bytesRead: number;
425
- }>;
426
- }): Promise<{
427
- metadata: FileMetadata;
428
- contentStart: number;
429
- }>;
430
- /**
431
- * Decodes file metadata from a buffer.
432
- *
433
- * @param buffer - Buffer containing the file with metadata
434
- * @returns Object containing the decoded metadata and content start position
435
- */
436
- decodeMetadataFromBuffer(buffer: Buffer): {
437
- metadata: FileMetadata;
438
- contentStart: number;
439
- };
440
- /**
441
- * Creates a complete buffer with metadata header, metadata, and content.
442
- *
443
- * @param file - The file to encode
444
- * @param content - The file content as a buffer
445
- * @returns Complete buffer ready for storage
446
- */
447
- createFileBuffer(file: FileLike | FileMetadata, content: Buffer): Buffer;
448
- }
449
- //#endregion
450
- //#region src/providers/LocalFileStorageProvider.d.ts
451
- /**
452
- * Local file storage configuration atom
453
- */
454
- declare const localFileStorageOptions: _alepha_core1.Atom<typebox0.TObject<{
455
- storagePath: typebox0.TString;
456
- }>, "alepha.bucket.local.options">;
457
- type LocalFileStorageProviderOptions = Static<typeof localFileStorageOptions.schema>;
458
- declare module "alepha" {
459
- interface State {
460
- [localFileStorageOptions.key]: LocalFileStorageProviderOptions;
461
- }
462
- }
463
- declare class LocalFileStorageProvider implements FileStorageProvider {
464
- protected readonly alepha: Alepha;
465
- protected readonly log: _alepha_logger0.Logger;
466
- protected readonly metadataService: FileMetadataService;
467
- protected readonly fileSystem: FileSystem;
468
- protected readonly options: Readonly<{
469
- storagePath: string;
470
- }>;
471
- protected get storagePath(): string;
472
- protected readonly onConfigure: _alepha_core1.HookDescriptor<"configure">;
473
- protected readonly onStart: _alepha_core1.HookDescriptor<"start">;
474
- upload(bucketName: string, file: FileLike, fileId?: string): Promise<string>;
475
- download(bucketName: string, fileId: string): Promise<FileLike>;
476
- exists(bucketName: string, fileId: string): Promise<boolean>;
477
- delete(bucketName: string, fileId: string): Promise<void>;
478
- protected stat(bucket: string, fileId: string): Promise<fs.Stats>;
479
- protected createId(): string;
480
- protected path(bucket: string, fileId?: string): string;
481
- protected isErrorNoEntry(error: unknown): boolean;
482
- }
483
- //#endregion
484
- //#region src/index.d.ts
485
- declare module "alepha" {
486
- interface Hooks {
487
- /**
488
- * Triggered when a file is uploaded to a bucket.
489
- * Can be used to perform actions after a file is uploaded, like creating a database record!
490
- */
491
- "bucket:file:uploaded": {
492
- id: string;
493
- file: FileLike;
494
- bucket: BucketDescriptor;
495
- options: BucketFileOptions;
496
- };
497
- /**
498
- * Triggered when a file is deleted from a bucket.
499
- */
500
- "bucket:file:deleted": {
501
- id: string;
502
- bucket: BucketDescriptor;
503
- };
504
- }
505
- }
506
- /**
507
- * Provides file storage capabilities through declarative bucket descriptors with support for multiple storage backends.
508
- *
509
- * The bucket module enables unified file operations across different storage systems using the `$bucket` descriptor
510
- * on class properties. It abstracts storage provider differences, offering consistent APIs for local filesystem,
511
- * cloud storage, or in-memory storage for testing environments.
512
- *
513
- * @see {@link $bucket}
514
- * @see {@link FileStorageProvider}
515
- * @module alepha.bucket
516
- */
517
- declare const AlephaBucket: _alepha_core1.Service<_alepha_core1.Module>;
518
- //#endregion
519
- export { $bucket, AlephaBucket, BucketDescriptor, BucketDescriptorOptions, BucketFileOptions, FileMetadata, FileMetadataService, FileNotFoundError, FileStorageProvider, LocalFileStorageProvider, LocalFileStorageProviderOptions, MemoryFileStorageProvider, localFileStorageOptions };
520
- //# sourceMappingURL=index.d.ts.map
package/bucket.js DELETED
@@ -1 +0,0 @@
1
- export * from '@alepha/bucket'
package/cache/redis.cjs DELETED
@@ -1,8 +0,0 @@
1
- 'use strict';
2
- var m = require('@alepha/cache-redis');
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
- });
package/cache/redis.d.ts DELETED
@@ -1,40 +0,0 @@
1
- import { CacheProvider } from "alepha/cache";
2
- import * as _alepha_core1 from "alepha";
3
- import { Alepha, Static } from "alepha";
4
- import * as _alepha_logger0 from "alepha/logger";
5
- import { RedisProvider } from "alepha/redis";
6
-
7
- //#region src/providers/RedisCacheProvider.d.ts
8
- declare const envSchema: _alepha_core1.TObject<{
9
- REDIS_CACHE_PREFIX: _alepha_core1.TOptional<_alepha_core1.TString>;
10
- }>;
11
- declare module "alepha" {
12
- interface Env extends Partial<Static<typeof envSchema>> {}
13
- }
14
- declare class RedisCacheProvider implements CacheProvider {
15
- protected readonly log: _alepha_logger0.Logger;
16
- protected readonly redisProvider: RedisProvider;
17
- protected readonly env: {
18
- REDIS_CACHE_PREFIX?: string | undefined;
19
- };
20
- protected readonly alepha: Alepha;
21
- get(name: string, key: string): Promise<Uint8Array | undefined>;
22
- set(name: string, key: string, value: Uint8Array | string, ttl?: number): Promise<Uint8Array>;
23
- del(name: string, ...keys: string[]): Promise<void>;
24
- has(name: string, key: string): Promise<boolean>;
25
- keys(name: string, filter?: string): Promise<string[]>;
26
- clear(): Promise<void>;
27
- protected prefix(...path: string[]): string;
28
- }
29
- //#endregion
30
- //#region src/index.d.ts
31
- /**
32
- * Plugin for Alepha Cache that provides Redis caching capabilities.
33
- *
34
- * @see {@link RedisCacheProvider}
35
- * @module alepha.cache.redis
36
- */
37
- declare const AlephaCacheRedis: _alepha_core1.Service<_alepha_core1.Module>;
38
- //#endregion
39
- export { AlephaCacheRedis, RedisCacheProvider };
40
- //# sourceMappingURL=index.d.ts.map
package/cache/redis.js DELETED
@@ -1 +0,0 @@
1
- export * from '@alepha/cache-redis'
package/cache.cjs DELETED
@@ -1,8 +0,0 @@
1
- 'use strict';
2
- var m = require('@alepha/cache');
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
- });