alepha 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +47 -44
  3. package/batch.d.ts +87 -88
  4. package/bucket.cjs +8 -0
  5. package/bucket.d.ts +194 -0
  6. package/bucket.js +1 -0
  7. package/cache/redis.d.ts +14 -16
  8. package/cache.d.ts +101 -170
  9. package/command.d.ts +70 -77
  10. package/core.d.ts +1043 -887
  11. package/datetime.d.ts +91 -117
  12. package/file.cjs +8 -0
  13. package/file.d.ts +56 -0
  14. package/file.js +1 -0
  15. package/lock/redis.d.ts +11 -13
  16. package/lock.d.ts +125 -117
  17. package/package.json +66 -38
  18. package/postgres.d.ts +232 -275
  19. package/queue/redis.d.ts +13 -15
  20. package/queue.d.ts +88 -116
  21. package/react/auth.d.ts +50 -55
  22. package/react/head.d.ts +5 -8
  23. package/react.d.ts +71 -73
  24. package/redis.d.ts +32 -14
  25. package/retry.d.ts +70 -58
  26. package/router.cjs +8 -0
  27. package/router.d.ts +45 -0
  28. package/router.js +1 -0
  29. package/scheduler.d.ts +54 -96
  30. package/security.d.ts +117 -119
  31. package/server/cache.d.ts +22 -31
  32. package/server/compress.d.ts +16 -7
  33. package/server/cookies.d.ts +70 -61
  34. package/server/cors.d.ts +15 -13
  35. package/server/health.d.ts +23 -26
  36. package/server/helmet.d.ts +17 -20
  37. package/server/links.d.ts +113 -90
  38. package/server/metrics.d.ts +25 -23
  39. package/server/multipart.d.ts +12 -16
  40. package/server/proxy.d.ts +25 -20
  41. package/server/security.cjs +8 -0
  42. package/server/security.d.ts +90 -0
  43. package/server/security.js +1 -0
  44. package/server/static.d.ts +67 -68
  45. package/server/swagger.d.ts +77 -65
  46. package/server.d.ts +265 -308
  47. package/topic/redis.d.ts +25 -26
  48. package/topic.d.ts +76 -122
  49. package/vite.d.ts +52 -36
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Feunard
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Feunard
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,44 +1,47 @@
1
- <div align="center">
2
-
3
- <h1 >
4
- <img
5
- src="https://raw.githubusercontent.com/feunard/alepha/main/assets/logo.png"
6
- width="128"
7
- height="128"
8
- alt="Logo"
9
- valign="middle"
10
- />
11
- Alepha
12
- </h1>
13
- <p style="max-width: 512px">
14
- 🚧
15
- </p>
16
- <a href="https://www.npmjs.com/package/alepha"><img src="https://img.shields.io/npm/v/alepha.svg" alt="npm"/></a>
17
- <a href="https://www.npmjs.com/package/alepha"><img src="https://img.shields.io/npm/l/alepha.svg" alt="npm"/></a>
18
- <a href="https://codecov.io/gh/feunard/alepha"><img src="https://codecov.io/gh/feunard/alepha/graph/badge.svg?token=ZDLWI514CP" alt="npm"/></a>
19
- <a href="https://www.npmjs.com/package/alepha"><img src="https://img.shields.io/npm/dt/alepha.svg" alt="npm"/></a>
20
- <a href="https://github.com/feunard/alepha"><img src="https://img.shields.io/github/stars/feunard/alepha.svg?style=social" alt="GitHub stars"/></a>
21
- </div>
22
-
23
- ## Installation
24
-
25
- ```bash
26
- npm install alepha
27
- ```
28
-
29
- ## Usage
30
-
31
- Minimalist http server with a single endpoint.
32
-
33
- ```ts
34
- import { run } from "alepha";
35
- import { $action } from "alepha/server";
36
-
37
- class App {
38
- hello = $action({
39
- handler: () => "Hello world!",
40
- })
41
- }
42
-
43
- run(App);
44
- ```
1
+ <div align="center">
2
+ <h1 >
3
+ <img
4
+ src="https://raw.githubusercontent.com/feunard/alepha/main/assets/logo.png"
5
+ width="128"
6
+ height="128"
7
+ alt="Logo"
8
+ valign="middle"
9
+ />
10
+ Alepha
11
+ </h1>
12
+ <p style="max-width: 512px">
13
+ 🚧
14
+ </p>
15
+ <a href="https://www.npmjs.com/package/alepha"><img src="https://img.shields.io/npm/v/alepha.svg" alt="npm"/></a>
16
+ <a href="https://www.npmjs.com/package/alepha"><img src="https://img.shields.io/npm/l/alepha.svg" alt="npm"/></a>
17
+ <a href="https://codecov.io/gh/feunard/alepha"><img src="https://codecov.io/gh/feunard/alepha/graph/badge.svg?token=ZDLWI514CP" alt="npm"/></a>
18
+ <a href="https://www.npmjs.com/package/alepha"><img src="https://img.shields.io/npm/dt/alepha.svg" alt="npm"/></a>
19
+ <a href="https://github.com/feunard/alepha"><img src="https://img.shields.io/github/stars/feunard/alepha.svg?style=social" alt="GitHub stars"/></a>
20
+ </div>
21
+
22
+ Alepha is a convention-driven TypeScript framework for building robust, end-to-end type-safe applications, from serverless APIs to full-stack React apps.
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ npm install alepha
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ Minimalist http server with a single endpoint.
33
+
34
+ ```ts
35
+ import { run } from "alepha";
36
+ import { $action } from "alepha/server";
37
+
38
+ class App {
39
+ hello = $action({
40
+ handler: () => "Hello world!",
41
+ })
42
+ }
43
+
44
+ run(App);
45
+ ```
46
+
47
+ 👉 For more information, please visit the [documentation](https://feunard.github.io/alepha/).
package/batch.d.ts CHANGED
@@ -1,114 +1,113 @@
1
- import { Alepha, HookDescriptor, KIND, Logger, Module, OPTIONS, Static, TSchema } from "alepha";
2
- import { DateTimeProvider, DurationLike, Timeout } from "alepha/datetime";
1
+ import * as _alepha_core0$1 from "alepha";
2
+ import * as _alepha_core0 from "alepha";
3
+ import { Descriptor, KIND, Static, TSchema } from "alepha";
4
+ import { DateTimeProvider, DurationLike } from "alepha/datetime";
5
+ import * as _alepha_retry0 from "alepha/retry";
3
6
  import { RetryDescriptorOptions } from "alepha/retry";
4
7
 
5
8
  //#region src/descriptors/$batch.d.ts
6
- declare const KEY = "BATCH";
9
+ /**
10
+ * Creates a batch processor. This is useful for grouping multiple operations
11
+ * (like API calls or database writes) into a single one to improve performance.
12
+ */
13
+ declare const $batch: {
14
+ <TItem extends TSchema, TResponse>(options: BatchDescriptorOptions<TItem, TResponse>): BatchDescriptor<TItem, TResponse>;
15
+ [KIND]: typeof BatchDescriptor;
16
+ };
7
17
  interface BatchDescriptorOptions<TItem extends TSchema, TResponse = any> {
8
18
  /**
9
- * A TypeBox schema to validate each item pushed to the batch.
10
- */
19
+ * A TypeBox schema to validate each item pushed to the batch.
20
+ */
11
21
  schema: TItem;
12
22
  /**
13
- * The handler function that processes a batch of items.
14
- */
23
+ * The handler function that processes a batch of items.
24
+ */
15
25
  handler: (items: Static<TItem>[]) => TResponse;
16
26
  /**
17
- * The maximum number of items in a batch. When this size is reached,
18
- * the batch is flushed automatically.
19
- * @default 10
20
- */
27
+ * The maximum number of items in a batch. When this size is reached,
28
+ * the batch is flushed automatically.
29
+ * @default 10
30
+ */
21
31
  maxSize?: number;
22
32
  /**
23
- * The maximum duration to wait before flushing a batch, even if it's not full.
24
- * Starts from the moment the first item is added to a partition.
25
- * @default [1, "second"]
26
- */
33
+ * The maximum duration to wait before flushing a batch, even if it's not full.
34
+ * Starts from the moment the first item is added to a partition.
35
+ * @default [1, "second"]
36
+ */
27
37
  maxDuration?: DurationLike;
28
38
  /**
29
- * A function to determine the partition key for an item. Items with the
30
- * same key are batched together. If not provided, all items are placed in a single, default partition.
31
- */
39
+ * A function to determine the partition key for an item. Items with the
40
+ * same key are batched together. If not provided, all items are placed in a single, default partition.
41
+ */
32
42
  partitionBy?: (item: Static<TItem>) => string;
33
43
  /**
34
- * The maximum number of concurrent `handler` executions.
35
- * @default 1
36
- */
44
+ * The maximum number of concurrent `handler` executions.
45
+ * @default 1
46
+ */
37
47
  concurrency?: number;
38
48
  /**
39
- * Retry options for the batch handler if it fails.
40
- * Leverages the `@alepha/retry` module.
41
- */
49
+ * Retry options for the batch handler if it fails.
50
+ * Leverages the `@alepha/retry` module.
51
+ */
42
52
  retry?: Omit<RetryDescriptorOptions<() => Array<Static<TItem>>>, "handler">;
43
53
  }
44
- interface BatchDescriptor<TItem extends TSchema, TResponse = any> {
45
- [KIND]: typeof KEY;
46
- [OPTIONS]: BatchDescriptorOptions<TItem, TResponse>;
54
+ declare class BatchDescriptor<TItem extends TSchema, TResponse = any> extends Descriptor<BatchDescriptorOptions<TItem, TResponse>> {
55
+ protected readonly log: _alepha_core0$1.Logger;
56
+ protected readonly dateTime: DateTimeProvider;
57
+ protected readonly partitions: Map<any, any>;
58
+ protected activeHandlers: PromiseWithResolvers<void>[];
59
+ protected retry: _alepha_retry0.RetryDescriptorFn<(items: (TItem & {
60
+ params: [];
61
+ })["static"][]) => TResponse>;
47
62
  /**
48
- * Pushes an item into the batch. The item will be processed
49
- * asynchronously with other items when the batch is flushed.
50
- */
51
- push: (item: Static<TItem>) => Promise<TResponse>;
52
- /**
53
- * Manually triggers a flush for one or all partitions.
54
- * @param partitionKey Optional. If provided, only flushes the specified partition. Otherwise, all partitions are flushed.
55
- */
56
- flush: (partitionKey?: string) => Promise<TResponse>;
57
- }
58
- /**
59
- * Creates a batch processor. This is useful for grouping multiple operations
60
- * (like API calls or database writes) into a single one to improve performance.
61
- */
62
- declare const $batch: {
63
- <TItem extends TSchema, TResponse>(options: BatchDescriptorOptions<TItem, TResponse>): BatchDescriptor<TItem, TResponse>;
64
- [KIND]: string;
65
- };
66
- //#endregion
67
- //#region src/providers/BatchDescriptorProvider.d.ts
68
- interface PartitionState<TItem extends TSchema> {
69
- items: Static<TItem>[];
70
- timeout?: Timeout;
71
- // Promises to resolve/reject when the batch is processed
72
- resolvers: Array<{
73
- resolve: (result?: any) => void;
74
- reject: (reason?: any) => void;
75
- }>;
76
- }
77
- interface BatchInstance<TItem extends TSchema> {
78
- id: string;
79
- options: BatchDescriptorOptions<TItem>;
80
- partitions: Map<string, PartitionState<TItem>>;
81
- activeHandlers: PromiseWithResolvers<void>[];
82
- handler: (items: Static<TItem>[]) => Promise<void>;
83
- }
84
- declare class BatchDescriptorProvider {
85
- protected readonly alepha: Alepha;
86
- protected readonly log: Logger;
87
- protected readonly dateTimeProvider: DateTimeProvider;
88
- protected readonly instances: Map<string, BatchInstance<any>>;
89
- protected readonly configure: HookDescriptor<"configure">;
90
- // On application stop, flush all pending batches gracefully.
91
- protected readonly onStop: HookDescriptor<"stop">;
92
- protected push<TItem>(id: string, item: TItem): Promise<void>;
93
- protected flush(id: string, partitionKey?: string): Promise<void>;
94
- protected flushPartition<TItem extends TSchema>(instance: BatchInstance<TItem>, partitionKey: string): Promise<void>;
63
+ * Pushes an item into the batch. The item will be processed
64
+ * asynchronously with other items when the batch is flushed.
65
+ */
66
+ push(item: Static<TItem>): Promise<TResponse>;
67
+ flush(partitionKey?: string): Promise<void>;
68
+ protected flushPartition(partitionKey: string): Promise<void>;
69
+ protected readonly dispose: _alepha_core0$1.HookDescriptor<"stop">;
95
70
  }
71
+ //# sourceMappingURL=$batch.d.ts.map
96
72
  //#endregion
97
73
  //#region src/index.d.ts
98
- // ---------------------------------------------------------------------------------------------------------------------
99
74
  /**
100
- * Alepha Batch Module
101
- *
102
- * This module provides a powerful batch processing utility that can group
103
- * multiple operations into a single one based on size, time, or partitions.
104
- *
105
- * @see {@link $batch}
106
- * @module alepha.batch
107
- */
108
- declare class AlephaBatch implements Module {
109
- readonly name = "alepha.batch";
110
- readonly $services: (alepha: Alepha) => Alepha;
111
- }
75
+ * This module allows you to group multiple asynchronous operations into a single "batch," which is then processed together.
76
+ * This is an essential pattern for improving performance, reducing I/O, and interacting efficiently with rate-limited APIs or databases.
77
+ *
78
+ * ```ts
79
+ * import { Alepha, $hook, run, t } from "alepha";
80
+ * import { $batch } from "alepha/batch";
81
+ *
82
+ * class LoggingService {
83
+ * // define the batch processor
84
+ * logBatch = $batch({
85
+ * schema: t.string(),
86
+ * maxSize: 10,
87
+ * maxDuration: [5, "seconds"],
88
+ * handler: async (items) => {
89
+ * console.log(`[BATCH LOG] Processing ${items.length} events:`, items);
90
+ * },
91
+ * });
92
+ *
93
+ * // example of how to use it
94
+ * onReady = $hook({
95
+ * on: "ready",
96
+ * handler: async () => {
97
+ * this.logBatch.push("Application started.");
98
+ * this.logBatch.push("User authenticated.");
99
+ * // ... more events pushed from elsewhere in the app
100
+ * },
101
+ * });
102
+ * }
103
+ * ```
104
+ *
105
+ * @see {@link $batch}
106
+ * @module alepha.batch
107
+ */
108
+ declare const AlephaBatch: _alepha_core0.ModuleDescriptor;
109
+ //# sourceMappingURL=index.d.ts.map
110
+
112
111
  //#endregion
113
- export { $batch, AlephaBatch, BatchDescriptor, BatchDescriptorOptions, BatchDescriptorProvider };
112
+ export { $batch, AlephaBatch, BatchDescriptor, BatchDescriptorOptions };
114
113
  //# sourceMappingURL=index.d.ts.map
package/bucket.cjs ADDED
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ var m = require('@alepha/bucket');
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/bucket.d.ts ADDED
@@ -0,0 +1,194 @@
1
+ import * as _alepha_core0$1 from "alepha";
2
+ import * as _alepha_core0 from "alepha";
3
+ import { Alepha, Descriptor, FileLike, KIND, Service } from "alepha";
4
+ import * as fs from "node:fs";
5
+ import * as _sinclair_typebox0 from "@sinclair/typebox";
6
+
7
+ //#region src/providers/FileStorageProvider.d.ts
8
+ declare abstract class FileStorageProvider {
9
+ /**
10
+ * Uploads a file to the storage.
11
+ *
12
+ * @param bucketName - Container name
13
+ * @param file - File to upload
14
+ * @param fileId - Optional file identifier. If not provided, a unique ID will be generated.
15
+ * @return The identifier of the uploaded file.
16
+ */
17
+ abstract upload(bucketName: string, file: FileLike, fileId?: string): Promise<string>;
18
+ /**
19
+ * Downloads a file from the storage.
20
+ *
21
+ * @param bucketName - Container name
22
+ * @param fileId - Identifier of the file to download
23
+ * @return The downloaded file as a FileLike object.
24
+ */
25
+ abstract download(bucketName: string, fileId: string): Promise<FileLike>;
26
+ /**
27
+ * Check if fileId exists in the storage bucket.
28
+ *
29
+ * @param bucketName - Container name
30
+ * @param fileId - Identifier of the file to stream
31
+ * @return True is the file exists, false otherwise.
32
+ */
33
+ abstract exists(bucketName: string, fileId: string): Promise<boolean>;
34
+ /**
35
+ * Delete permanently a file from the storage.
36
+ *
37
+ * @param bucketName - Container name
38
+ * @param fileId - Identifier of the file to delete
39
+ */
40
+ abstract delete(bucketName: string, fileId: string): Promise<void>;
41
+ }
42
+ //# sourceMappingURL=FileStorageProvider.d.ts.map
43
+ //#endregion
44
+ //#region src/providers/MemoryFileStorageProvider.d.ts
45
+ declare class MemoryFileStorageProvider implements FileStorageProvider {
46
+ readonly files: Record<string, FileLike>;
47
+ upload(bucketName: string, file: FileLike, fileId?: string): Promise<string>;
48
+ download(bucketName: string, fileId: string): Promise<FileLike>;
49
+ exists(bucketName: string, fileId: string): Promise<boolean>;
50
+ delete(bucketName: string, fileId: string): Promise<void>;
51
+ protected createId(): string;
52
+ }
53
+ //# sourceMappingURL=MemoryFileStorageProvider.d.ts.map
54
+
55
+ //#endregion
56
+ //#region src/descriptors/$bucket.d.ts
57
+ /**
58
+ * Create a container for storing files.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * import { $bucket } from "alepha/bucket";
63
+ *
64
+ * class App {
65
+ * images = $bucket();
66
+ *
67
+ * uploadImage(file: FileLike): Promise<string> {
68
+ * return this.images.upload(file);
69
+ * }
70
+ * }
71
+ * ```
72
+ */
73
+ declare const $bucket: {
74
+ (options: BucketDescriptorOptions): BucketDescriptor;
75
+ [KIND]: typeof BucketDescriptor;
76
+ };
77
+ interface BucketDescriptorOptions extends BucketFileOptions {
78
+ /**
79
+ * File storage provider. If not provided, the default provider will be used.
80
+ */
81
+ provider?: Service<FileStorageProvider> | "memory";
82
+ /**
83
+ * Optional name of the bucket. If not provided, the key of the descriptor will be used.
84
+ */
85
+ name?: string;
86
+ }
87
+ declare class BucketDescriptor extends Descriptor<BucketDescriptorOptions> {
88
+ readonly provider: MemoryFileStorageProvider | FileStorageProvider;
89
+ get name(): string;
90
+ /**
91
+ * Uploads a file to the bucket.
92
+ */
93
+ upload(file: FileLike, options?: BucketFileOptions): Promise<string>;
94
+ /**
95
+ * Delete permanently a file from the bucket.
96
+ */
97
+ delete(fileId: string): Promise<void>;
98
+ /**
99
+ * Checks if a file exists in the bucket.
100
+ */
101
+ exists(fileId: string): Promise<boolean>;
102
+ /**
103
+ * Downloads a file from the bucket.
104
+ */
105
+ download(fileId: string): Promise<FileLike>;
106
+ protected $provider(): MemoryFileStorageProvider | FileStorageProvider;
107
+ }
108
+ interface BucketFileOptions {
109
+ /**
110
+ * Optional description of the bucket.
111
+ */
112
+ description?: string;
113
+ /**
114
+ * Allowed MIME types.
115
+ */
116
+ mimeTypes?: string[];
117
+ /**
118
+ * Maximum size of the files in the bucket.
119
+ *
120
+ * @default 10
121
+ */
122
+ maxSize?: number;
123
+ }
124
+ //# sourceMappingURL=$bucket.d.ts.map
125
+ //#endregion
126
+ //#region src/errors/FileNotFoundError.d.ts
127
+ declare class FileNotFoundError extends Error {
128
+ readonly status = 404;
129
+ }
130
+ //# sourceMappingURL=FileNotFoundError.d.ts.map
131
+ //#endregion
132
+ //#region src/providers/LocalFileStorageProvider.d.ts
133
+ declare class LocalFileStorageProvider implements FileStorageProvider {
134
+ static METADATA_HEADER_LENGTH: number;
135
+ protected readonly alepha: Alepha;
136
+ options: {
137
+ storagePath: string;
138
+ };
139
+ protected readonly configure: _alepha_core0$1.HookDescriptor<"start">;
140
+ upload(bucketName: string, file: FileLike, fileId?: string): Promise<string>;
141
+ download(bucketName: string, fileId: string): Promise<FileLike>;
142
+ exists(bucketName: string, fileId: string): Promise<boolean>;
143
+ delete(bucketName: string, fileId: string): Promise<void>;
144
+ protected stat(container: string, fileId: string): Promise<fs.Stats>;
145
+ protected createId(): string;
146
+ protected path(container: string, fileId?: string): string;
147
+ protected isErrorNoEntry(error: unknown): boolean;
148
+ }
149
+ declare const fileMetadataSchema: _sinclair_typebox0.TObject<{
150
+ name: _sinclair_typebox0.TString;
151
+ type: _sinclair_typebox0.TString;
152
+ size: _sinclair_typebox0.TNumber;
153
+ }>;
154
+ //# sourceMappingURL=LocalFileStorageProvider.d.ts.map
155
+ //#endregion
156
+ //#region src/index.d.ts
157
+ declare module "alepha" {
158
+ interface Hooks {
159
+ /**
160
+ * Triggered when a file is uploaded to a bucket.
161
+ * Can be used to perform actions after a file is uploaded, like creating a database record!
162
+ */
163
+ "bucket:file:uploaded": {
164
+ id: string;
165
+ file: FileLike;
166
+ bucket: BucketDescriptor;
167
+ options: BucketFileOptions;
168
+ };
169
+ /**
170
+ * Triggered when a file is deleted from a bucket.
171
+ */
172
+ "bucket:file:deleted": {
173
+ id: string;
174
+ bucket: BucketDescriptor;
175
+ };
176
+ }
177
+ }
178
+ /**
179
+ * Provides file storage capabilities through declarative bucket descriptors with support for multiple storage backends.
180
+ *
181
+ * The bucket module enables unified file operations across different storage systems using the `$bucket` descriptor
182
+ * on class properties. It abstracts storage provider differences, offering consistent APIs for local filesystem,
183
+ * cloud storage, or in-memory storage for testing environments.
184
+ *
185
+ * @see {@link $bucket}
186
+ * @see {@link FileStorageProvider}
187
+ * @module alepha.bucket
188
+ */
189
+ declare const AlephaBucket: _alepha_core0.ModuleDescriptor;
190
+ //# sourceMappingURL=index.d.ts.map
191
+
192
+ //#endregion
193
+ export { $bucket, AlephaBucket, BucketDescriptor, BucketDescriptorOptions, BucketFileOptions, FileNotFoundError, FileStorageProvider, LocalFileStorageProvider, MemoryFileStorageProvider, fileMetadataSchema };
194
+ //# sourceMappingURL=index.d.ts.map
package/bucket.js ADDED
@@ -0,0 +1 @@
1
+ export * from '@alepha/bucket'
package/cache/redis.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import { CacheProvider } from "alepha/cache";
2
- import { Alepha, Logger, Module, Static, TObject, TOptional, TString } from "alepha";
2
+ import * as _alepha_core0$1 from "alepha";
3
+ import * as _alepha_core0 from "alepha";
4
+ import { Alepha, Logger, Static } from "alepha";
3
5
  import { RedisProvider } from "alepha/redis";
4
6
 
5
7
  //#region src/providers/RedisCacheProvider.d.ts
6
- declare const envSchema: TObject<{
7
- REDIS_CACHE_PREFIX: TOptional<TString>;
8
+ declare const envSchema: _alepha_core0$1.TObject<{
9
+ REDIS_CACHE_PREFIX: _alepha_core0$1.TOptional<_alepha_core0$1.TString>;
8
10
  }>;
9
11
  declare module "alepha" {
10
12
  interface Env extends Partial<Static<typeof envSchema>> {}
@@ -18,24 +20,20 @@ declare class RedisCacheProvider implements CacheProvider {
18
20
  set(name: string, key: string, value: Uint8Array | string, ttl?: number): Promise<Uint8Array>;
19
21
  del(name: string, ...keys: string[]): Promise<void>;
20
22
  has(name: string, key: string): Promise<boolean>;
21
- keys(name: string): Promise<string[]>;
23
+ keys(name: string, filter?: string): Promise<string[]>;
22
24
  protected prefix(...path: string[]): string;
23
25
  }
24
26
  //#endregion
25
27
  //#region src/index.d.ts
26
- // ---------------------------------------------------------------------------------------------------------------------
27
28
  /**
28
- * Alepha Cache Redis Module
29
- *
30
- * Plugin for Alepha Cache that provides Redis caching capabilities.
31
- *
32
- * @see {@link RedisCacheProvider}
33
- * @module alepha.cache.redis
34
- */
35
- declare class AlephaCacheRedis implements Module {
36
- readonly name = "alepha.cache.redis";
37
- readonly $services: (alepha: Alepha) => Alepha;
38
- }
29
+ * Plugin for Alepha Cache that provides Redis caching capabilities.
30
+ *
31
+ * @see {@link RedisCacheProvider}
32
+ * @module alepha.cache.redis
33
+ */
34
+ declare const AlephaCacheRedis: _alepha_core0.ModuleDescriptor;
35
+ //# sourceMappingURL=index.d.ts.map
36
+
39
37
  //#endregion
40
38
  export { AlephaCacheRedis, RedisCacheProvider };
41
39
  //# sourceMappingURL=index.d.ts.map