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.
- package/README.md +55 -17
- package/dist/index.cjs +15805 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +15804 -0
- package/dist/index.js.map +1 -0
- package/package.json +36 -372
- package/src/assets/biomeJson.ts +33 -0
- package/src/assets/tsconfigJson.ts +17 -0
- package/src/assets/viteConfigTs.ts +14 -0
- package/src/commands/BiomeCommands.ts +60 -0
- package/src/commands/CoreCommands.ts +266 -0
- package/src/commands/DrizzleCommands.ts +403 -0
- package/src/commands/VerifyCommands.ts +48 -0
- package/src/commands/ViteCommands.ts +152 -0
- package/src/index.ts +35 -0
- package/src/services/ProcessRunner.ts +89 -0
- package/src/version.ts +7 -0
- package/api/files.cjs +0 -8
- package/api/files.d.ts +0 -438
- package/api/files.js +0 -1
- package/api/jobs.cjs +0 -8
- package/api/jobs.d.ts +0 -327
- package/api/jobs.js +0 -1
- package/api/notifications.cjs +0 -8
- package/api/notifications.d.ts +0 -263
- package/api/notifications.js +0 -1
- package/api/users.cjs +0 -8
- package/api/users.d.ts +0 -923
- package/api/users.js +0 -1
- package/api/verifications.cjs +0 -8
- package/api/verifications.d.ts +0 -1
- package/api/verifications.js +0 -1
- package/batch.cjs +0 -8
- package/batch.d.ts +0 -154
- package/batch.js +0 -1
- package/bucket.cjs +0 -8
- package/bucket.d.ts +0 -520
- package/bucket.js +0 -1
- package/cache/redis.cjs +0 -8
- package/cache/redis.d.ts +0 -40
- package/cache/redis.js +0 -1
- package/cache.cjs +0 -8
- package/cache.d.ts +0 -288
- package/cache.js +0 -1
- package/command.cjs +0 -8
- package/command.d.ts +0 -269
- package/command.js +0 -1
- package/core.cjs +0 -8
- package/core.d.ts +0 -1904
- package/core.js +0 -1
- package/datetime.cjs +0 -8
- package/datetime.d.ts +0 -144
- package/datetime.js +0 -1
- package/devtools.cjs +0 -8
- package/devtools.d.ts +0 -252
- package/devtools.js +0 -1
- package/email.cjs +0 -8
- package/email.d.ts +0 -187
- package/email.js +0 -1
- package/fake.cjs +0 -8
- package/fake.d.ts +0 -73
- package/fake.js +0 -1
- package/file.cjs +0 -8
- package/file.d.ts +0 -528
- package/file.js +0 -1
- package/lock/redis.cjs +0 -8
- package/lock/redis.d.ts +0 -24
- package/lock/redis.js +0 -1
- package/lock.cjs +0 -8
- package/lock.d.ts +0 -552
- package/lock.js +0 -1
- package/logger.cjs +0 -8
- package/logger.d.ts +0 -287
- package/logger.js +0 -1
- package/postgres.cjs +0 -8
- package/postgres.d.ts +0 -2143
- package/postgres.js +0 -1
- package/queue/redis.cjs +0 -8
- package/queue/redis.d.ts +0 -29
- package/queue/redis.js +0 -1
- package/queue.cjs +0 -8
- package/queue.d.ts +0 -760
- package/queue.js +0 -1
- package/react/auth.cjs +0 -8
- package/react/auth.d.ts +0 -504
- package/react/auth.js +0 -1
- package/react/form.cjs +0 -8
- package/react/form.d.ts +0 -211
- package/react/form.js +0 -1
- package/react/head.cjs +0 -8
- package/react/head.d.ts +0 -120
- package/react/head.js +0 -1
- package/react/i18n.cjs +0 -8
- package/react/i18n.d.ts +0 -168
- package/react/i18n.js +0 -1
- package/react.cjs +0 -8
- package/react.d.ts +0 -1263
- package/react.js +0 -1
- package/redis.cjs +0 -8
- package/redis.d.ts +0 -82
- package/redis.js +0 -1
- package/retry.cjs +0 -8
- package/retry.d.ts +0 -162
- package/retry.js +0 -1
- package/router.cjs +0 -8
- package/router.d.ts +0 -45
- package/router.js +0 -1
- package/scheduler.cjs +0 -8
- package/scheduler.d.ts +0 -145
- package/scheduler.js +0 -1
- package/security.cjs +0 -8
- package/security.d.ts +0 -586
- package/security.js +0 -1
- package/server/cache.cjs +0 -8
- package/server/cache.d.ts +0 -163
- package/server/cache.js +0 -1
- package/server/compress.cjs +0 -8
- package/server/compress.d.ts +0 -38
- package/server/compress.js +0 -1
- package/server/cookies.cjs +0 -8
- package/server/cookies.d.ts +0 -144
- package/server/cookies.js +0 -1
- package/server/cors.cjs +0 -8
- package/server/cors.d.ts +0 -45
- package/server/cors.js +0 -1
- package/server/health.cjs +0 -8
- package/server/health.d.ts +0 -58
- package/server/health.js +0 -1
- package/server/helmet.cjs +0 -8
- package/server/helmet.d.ts +0 -98
- package/server/helmet.js +0 -1
- package/server/links.cjs +0 -8
- package/server/links.d.ts +0 -322
- package/server/links.js +0 -1
- package/server/metrics.cjs +0 -8
- package/server/metrics.d.ts +0 -35
- package/server/metrics.js +0 -1
- package/server/multipart.cjs +0 -8
- package/server/multipart.d.ts +0 -42
- package/server/multipart.js +0 -1
- package/server/proxy.cjs +0 -8
- package/server/proxy.d.ts +0 -234
- package/server/proxy.js +0 -1
- package/server/security.cjs +0 -8
- package/server/security.d.ts +0 -92
- package/server/security.js +0 -1
- package/server/static.cjs +0 -8
- package/server/static.d.ts +0 -119
- package/server/static.js +0 -1
- package/server/swagger.cjs +0 -8
- package/server/swagger.d.ts +0 -161
- package/server/swagger.js +0 -1
- package/server.cjs +0 -8
- package/server.d.ts +0 -849
- package/server.js +0 -1
- package/topic/redis.cjs +0 -8
- package/topic/redis.d.ts +0 -42
- package/topic/redis.js +0 -1
- package/topic.cjs +0 -8
- package/topic.d.ts +0 -819
- package/topic.js +0 -1
- package/ui.cjs +0 -8
- package/ui.d.ts +0 -813
- package/ui.js +0 -1
- package/vite.cjs +0 -8
- package/vite.d.ts +0 -186
- package/vite.js +0 -1
package/api/files.d.ts
DELETED
|
@@ -1,438 +0,0 @@
|
|
|
1
|
-
import { BucketDescriptor } from "alepha/bucket";
|
|
2
|
-
import * as _alepha_core1 from "alepha";
|
|
3
|
-
import { Alepha, FileLike, Static } from "alepha";
|
|
4
|
-
import "alepha/server/security";
|
|
5
|
-
import * as _alepha_postgres64 from "alepha/postgres";
|
|
6
|
-
import { Page } from "alepha/postgres";
|
|
7
|
-
import * as _alepha_server0 from "alepha/server";
|
|
8
|
-
import { Ok } from "alepha/server";
|
|
9
|
-
import { DateTime, DateTimeProvider, DurationLike } from "alepha/datetime";
|
|
10
|
-
import * as _alepha_logger0 from "alepha/logger";
|
|
11
|
-
import { UserAccountToken } from "alepha/security";
|
|
12
|
-
import * as typebox172 from "typebox";
|
|
13
|
-
|
|
14
|
-
//#region src/entities/files.d.ts
|
|
15
|
-
declare const files: _alepha_postgres64.EntityDescriptor<typebox172.TObject<{
|
|
16
|
-
id: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_PRIMARY_KEY>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
17
|
-
version: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TInteger, typeof _alepha_postgres64.PG_VERSION>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
18
|
-
createdAt: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_CREATED_AT>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
19
|
-
updatedAt: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_UPDATED_AT>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
20
|
-
blobId: typebox172.TString;
|
|
21
|
-
creator: typebox172.TOptional<typebox172.TString>;
|
|
22
|
-
creatorRealm: typebox172.TOptional<typebox172.TString>;
|
|
23
|
-
creatorName: typebox172.TOptional<typebox172.TString>;
|
|
24
|
-
bucket: typebox172.TString;
|
|
25
|
-
expirationDate: typebox172.TOptional<typebox172.TString>;
|
|
26
|
-
name: typebox172.TString;
|
|
27
|
-
size: typebox172.TNumber;
|
|
28
|
-
mimeType: typebox172.TString;
|
|
29
|
-
tags: typebox172.TOptional<typebox172.TArray<typebox172.TString>>;
|
|
30
|
-
checksum: typebox172.TOptional<typebox172.TString>;
|
|
31
|
-
}>>;
|
|
32
|
-
type FileEntity = Static<typeof files.schema>;
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/schemas/fileQuerySchema.d.ts
|
|
35
|
-
declare const fileQuerySchema: typebox172.TObject<{
|
|
36
|
-
page: typebox172.TOptional<typebox172.TInteger>;
|
|
37
|
-
size: typebox172.TOptional<typebox172.TInteger>;
|
|
38
|
-
sort: typebox172.TOptional<typebox172.TString>;
|
|
39
|
-
bucket: typebox172.TOptional<typebox172.TString>;
|
|
40
|
-
tags: typebox172.TOptional<typebox172.TArray<typebox172.TString>>;
|
|
41
|
-
name: typebox172.TOptional<typebox172.TString>;
|
|
42
|
-
mimeType: typebox172.TOptional<typebox172.TString>;
|
|
43
|
-
creator: typebox172.TOptional<typebox172.TString>;
|
|
44
|
-
createdAfter: typebox172.TOptional<typebox172.TString>;
|
|
45
|
-
createdBefore: typebox172.TOptional<typebox172.TString>;
|
|
46
|
-
}>;
|
|
47
|
-
type FileQuery = Static<typeof fileQuerySchema>;
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/schemas/fileResourceSchema.d.ts
|
|
50
|
-
declare const fileResourceSchema: typebox172.TObject<{
|
|
51
|
-
id: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_PRIMARY_KEY>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
52
|
-
version: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TInteger, typeof _alepha_postgres64.PG_VERSION>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
53
|
-
createdAt: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_CREATED_AT>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
54
|
-
updatedAt: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_UPDATED_AT>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
55
|
-
blobId: typebox172.TString;
|
|
56
|
-
creator: typebox172.TOptional<typebox172.TString>;
|
|
57
|
-
creatorRealm: typebox172.TOptional<typebox172.TString>;
|
|
58
|
-
creatorName: typebox172.TOptional<typebox172.TString>;
|
|
59
|
-
bucket: typebox172.TString;
|
|
60
|
-
expirationDate: typebox172.TOptional<typebox172.TString>;
|
|
61
|
-
name: typebox172.TString;
|
|
62
|
-
size: typebox172.TNumber;
|
|
63
|
-
mimeType: typebox172.TString;
|
|
64
|
-
tags: typebox172.TOptional<typebox172.TArray<typebox172.TString>>;
|
|
65
|
-
checksum: typebox172.TOptional<typebox172.TString>;
|
|
66
|
-
}>;
|
|
67
|
-
type FileResource = Static<typeof fileResourceSchema>;
|
|
68
|
-
//#endregion
|
|
69
|
-
//#region src/schemas/storageStatsSchema.d.ts
|
|
70
|
-
declare const bucketStatsSchema: typebox172.TObject<{
|
|
71
|
-
bucket: typebox172.TString;
|
|
72
|
-
totalSize: typebox172.TNumber;
|
|
73
|
-
fileCount: typebox172.TNumber;
|
|
74
|
-
}>;
|
|
75
|
-
declare const mimeTypeStatsSchema: typebox172.TObject<{
|
|
76
|
-
mimeType: typebox172.TString;
|
|
77
|
-
fileCount: typebox172.TNumber;
|
|
78
|
-
}>;
|
|
79
|
-
declare const storageStatsSchema: typebox172.TObject<{
|
|
80
|
-
totalSize: typebox172.TNumber;
|
|
81
|
-
totalFiles: typebox172.TNumber;
|
|
82
|
-
byBucket: typebox172.TArray<typebox172.TObject<{
|
|
83
|
-
bucket: typebox172.TString;
|
|
84
|
-
totalSize: typebox172.TNumber;
|
|
85
|
-
fileCount: typebox172.TNumber;
|
|
86
|
-
}>>;
|
|
87
|
-
byMimeType: typebox172.TArray<typebox172.TObject<{
|
|
88
|
-
mimeType: typebox172.TString;
|
|
89
|
-
fileCount: typebox172.TNumber;
|
|
90
|
-
}>>;
|
|
91
|
-
}>;
|
|
92
|
-
type BucketStats = Static<typeof bucketStatsSchema>;
|
|
93
|
-
type MimeTypeStats = Static<typeof mimeTypeStatsSchema>;
|
|
94
|
-
type StorageStats = Static<typeof storageStatsSchema>;
|
|
95
|
-
//#endregion
|
|
96
|
-
//#region src/services/FileService.d.ts
|
|
97
|
-
declare class FileService {
|
|
98
|
-
protected readonly alepha: Alepha;
|
|
99
|
-
protected readonly log: _alepha_logger0.Logger;
|
|
100
|
-
protected readonly fileRepository: _alepha_postgres64.Repository<typebox172.TObject<{
|
|
101
|
-
id: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_PRIMARY_KEY>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
102
|
-
version: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TInteger, typeof _alepha_postgres64.PG_VERSION>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
103
|
-
createdAt: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_CREATED_AT>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
104
|
-
updatedAt: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_UPDATED_AT>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
105
|
-
blobId: typebox172.TString;
|
|
106
|
-
creator: typebox172.TOptional<typebox172.TString>;
|
|
107
|
-
creatorRealm: typebox172.TOptional<typebox172.TString>;
|
|
108
|
-
creatorName: typebox172.TOptional<typebox172.TString>;
|
|
109
|
-
bucket: typebox172.TString;
|
|
110
|
-
expirationDate: typebox172.TOptional<typebox172.TString>;
|
|
111
|
-
name: typebox172.TString;
|
|
112
|
-
size: typebox172.TNumber;
|
|
113
|
-
mimeType: typebox172.TString;
|
|
114
|
-
tags: typebox172.TOptional<typebox172.TArray<typebox172.TString>>;
|
|
115
|
-
checksum: typebox172.TOptional<typebox172.TString>;
|
|
116
|
-
}>>;
|
|
117
|
-
protected readonly dateTimeProvider: DateTimeProvider;
|
|
118
|
-
protected readonly defaultBucket: BucketDescriptor;
|
|
119
|
-
protected onUploadFile: _alepha_core1.HookDescriptor<"bucket:file:uploaded">;
|
|
120
|
-
protected onDeleteBucketFile: _alepha_core1.HookDescriptor<"bucket:file:deleted">;
|
|
121
|
-
/**
|
|
122
|
-
* Calculates SHA-256 checksum of a file.
|
|
123
|
-
*
|
|
124
|
-
* @param file - The file to calculate checksum for
|
|
125
|
-
* @returns Hexadecimal string representation of the SHA-256 hash
|
|
126
|
-
* @protected
|
|
127
|
-
*/
|
|
128
|
-
protected calculateChecksum(file: FileLike): Promise<string>;
|
|
129
|
-
/**
|
|
130
|
-
* Gets a bucket descriptor by name.
|
|
131
|
-
*
|
|
132
|
-
* @param bucketName - The name of the bucket to retrieve (defaults to "default")
|
|
133
|
-
* @returns The bucket descriptor
|
|
134
|
-
* @throws {NotFoundError} If the bucket is not found
|
|
135
|
-
*/
|
|
136
|
-
bucket(bucketName?: string): BucketDescriptor;
|
|
137
|
-
/**
|
|
138
|
-
* Finds files matching the given query criteria with pagination support.
|
|
139
|
-
* Supports filtering by bucket, tags, name, mimeType, creator, and date range.
|
|
140
|
-
*
|
|
141
|
-
* @param q - Query parameters including bucket, tags, name, mimeType, creator, date range, pagination, and sorting
|
|
142
|
-
* @returns Paginated list of file entities
|
|
143
|
-
*/
|
|
144
|
-
findFiles(q?: FileQuery): Promise<Page<FileEntity>>;
|
|
145
|
-
/**
|
|
146
|
-
* Finds files that have expired based on their expiration date.
|
|
147
|
-
* Limited to 1000 files per call to prevent memory issues.
|
|
148
|
-
*
|
|
149
|
-
* @returns Array of expired file entities
|
|
150
|
-
*/
|
|
151
|
-
findExpiredFiles(): Promise<FileEntity[]>;
|
|
152
|
-
/**
|
|
153
|
-
* Calculates an expiration date based on a TTL (time to live) duration.
|
|
154
|
-
*
|
|
155
|
-
* @param ttl - Duration like "1 day", "2 hours", etc.
|
|
156
|
-
* @returns DateTime representation of the expiration date, or undefined if no TTL provided
|
|
157
|
-
* @protected
|
|
158
|
-
*/
|
|
159
|
-
protected getExpirationDate(ttl?: DurationLike): string | undefined;
|
|
160
|
-
/**
|
|
161
|
-
* Uploads a file to a bucket and creates a database record with metadata.
|
|
162
|
-
* Automatically calculates and stores the file checksum (SHA-256).
|
|
163
|
-
*
|
|
164
|
-
* @param file - The file to upload
|
|
165
|
-
* @param options - Upload options including bucket, expiration, user, and tags
|
|
166
|
-
* @param options.bucket - Target bucket name (defaults to "default")
|
|
167
|
-
* @param options.expirationDate - When the file should expire
|
|
168
|
-
* @param options.user - User performing the upload (for audit trail)
|
|
169
|
-
* @param options.tags - Tags to associate with the file
|
|
170
|
-
* @returns The created file entity with all metadata
|
|
171
|
-
* @throws {NotFoundError} If the specified bucket doesn't exist
|
|
172
|
-
*/
|
|
173
|
-
uploadFile(file: FileLike, options?: {
|
|
174
|
-
expirationDate?: string | DateTime;
|
|
175
|
-
bucket?: string;
|
|
176
|
-
user?: UserAccountToken;
|
|
177
|
-
tags?: string[];
|
|
178
|
-
}): Promise<FileEntity>;
|
|
179
|
-
/**
|
|
180
|
-
* Streams a file from storage by its database ID.
|
|
181
|
-
*
|
|
182
|
-
* @param id - The database ID (UUID) of the file to stream
|
|
183
|
-
* @returns The file object ready for streaming/downloading
|
|
184
|
-
* @throws {NotFoundError} If the file doesn't exist in the database
|
|
185
|
-
* @throws {FileNotFoundError} If the file exists in database but not in storage
|
|
186
|
-
*/
|
|
187
|
-
streamFile(id: string): Promise<FileLike>;
|
|
188
|
-
/**
|
|
189
|
-
* Updates file metadata (name, tags, expiration date).
|
|
190
|
-
* Does not modify the actual file content in storage.
|
|
191
|
-
*
|
|
192
|
-
* @param id - The database ID (UUID) of the file to update
|
|
193
|
-
* @param data - Partial file data to update
|
|
194
|
-
* @param data.name - New file name
|
|
195
|
-
* @param data.tags - New tags array
|
|
196
|
-
* @param data.expirationDate - New expiration date
|
|
197
|
-
* @returns The updated file entity
|
|
198
|
-
* @throws {NotFoundError} If the file doesn't exist in the database
|
|
199
|
-
*/
|
|
200
|
-
updateFile(id: string, data: {
|
|
201
|
-
name?: string;
|
|
202
|
-
tags?: string[];
|
|
203
|
-
expirationDate?: DateTime | string;
|
|
204
|
-
}): Promise<FileEntity>;
|
|
205
|
-
/**
|
|
206
|
-
* Deletes a file from both storage and database.
|
|
207
|
-
* Handles cases where file is already deleted from storage gracefully.
|
|
208
|
-
* Always ensures database record is removed even if storage deletion fails.
|
|
209
|
-
*
|
|
210
|
-
* @param id - The database ID (UUID) of the file to delete
|
|
211
|
-
* @returns Success response with the deleted file ID
|
|
212
|
-
* @throws {NotFoundError} If the file doesn't exist in the database
|
|
213
|
-
*/
|
|
214
|
-
deleteFile(id: string): Promise<Ok>;
|
|
215
|
-
/**
|
|
216
|
-
* Retrieves a file entity by its ID.
|
|
217
|
-
* If already an entity object, returns it as-is (convenience method).
|
|
218
|
-
*
|
|
219
|
-
* @param id - Either a UUID string or an existing FileEntity object
|
|
220
|
-
* @returns The file entity
|
|
221
|
-
* @throws {NotFoundError} If the file doesn't exist in the database
|
|
222
|
-
*/
|
|
223
|
-
getFileById(id: string | FileEntity): Promise<FileEntity>;
|
|
224
|
-
/**
|
|
225
|
-
* Gets storage statistics including total size, file count, and breakdowns by bucket and MIME type.
|
|
226
|
-
*
|
|
227
|
-
* @returns Storage statistics with aggregated data
|
|
228
|
-
*/
|
|
229
|
-
getStorageStats(): Promise<StorageStats>;
|
|
230
|
-
/**
|
|
231
|
-
* Converts a file entity to a file resource (API response format).
|
|
232
|
-
* Currently a pass-through, but allows for future transformation logic.
|
|
233
|
-
*
|
|
234
|
-
* @param entity - The file entity to convert
|
|
235
|
-
* @returns The file resource for API responses
|
|
236
|
-
*/
|
|
237
|
-
entityToResource(entity: FileEntity): FileResource;
|
|
238
|
-
}
|
|
239
|
-
//#endregion
|
|
240
|
-
//#region src/controllers/FileController.d.ts
|
|
241
|
-
/**
|
|
242
|
-
* REST API controller for file management operations.
|
|
243
|
-
* Provides endpoints for uploading, downloading, listing, and deleting files.
|
|
244
|
-
*/
|
|
245
|
-
declare class FileController {
|
|
246
|
-
protected readonly url = "/files";
|
|
247
|
-
protected readonly group = "files";
|
|
248
|
-
protected readonly fileService: FileService;
|
|
249
|
-
/**
|
|
250
|
-
* GET /files - Lists files with optional filtering and pagination.
|
|
251
|
-
* Supports filtering by bucket and tags.
|
|
252
|
-
*/
|
|
253
|
-
readonly findFiles: _alepha_server0.ActionDescriptorFn<{
|
|
254
|
-
query: typebox172.TObject<{
|
|
255
|
-
page: typebox172.TOptional<typebox172.TInteger>;
|
|
256
|
-
size: typebox172.TOptional<typebox172.TInteger>;
|
|
257
|
-
sort: typebox172.TOptional<typebox172.TString>;
|
|
258
|
-
bucket: typebox172.TOptional<typebox172.TString>;
|
|
259
|
-
tags: typebox172.TOptional<typebox172.TArray<typebox172.TString>>;
|
|
260
|
-
name: typebox172.TOptional<typebox172.TString>;
|
|
261
|
-
mimeType: typebox172.TOptional<typebox172.TString>;
|
|
262
|
-
creator: typebox172.TOptional<typebox172.TString>;
|
|
263
|
-
createdAfter: typebox172.TOptional<typebox172.TString>;
|
|
264
|
-
createdBefore: typebox172.TOptional<typebox172.TString>;
|
|
265
|
-
}>;
|
|
266
|
-
response: _alepha_core1.TPage<typebox172.TObject<{
|
|
267
|
-
id: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_PRIMARY_KEY>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
268
|
-
version: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TInteger, typeof _alepha_postgres64.PG_VERSION>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
269
|
-
createdAt: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_CREATED_AT>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
270
|
-
updatedAt: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_UPDATED_AT>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
271
|
-
blobId: typebox172.TString;
|
|
272
|
-
creator: typebox172.TOptional<typebox172.TString>;
|
|
273
|
-
creatorRealm: typebox172.TOptional<typebox172.TString>;
|
|
274
|
-
creatorName: typebox172.TOptional<typebox172.TString>;
|
|
275
|
-
bucket: typebox172.TString;
|
|
276
|
-
expirationDate: typebox172.TOptional<typebox172.TString>;
|
|
277
|
-
name: typebox172.TString;
|
|
278
|
-
size: typebox172.TNumber;
|
|
279
|
-
mimeType: typebox172.TString;
|
|
280
|
-
tags: typebox172.TOptional<typebox172.TArray<typebox172.TString>>;
|
|
281
|
-
checksum: typebox172.TOptional<typebox172.TString>;
|
|
282
|
-
}>>;
|
|
283
|
-
}>;
|
|
284
|
-
/**
|
|
285
|
-
* DELETE /files/:id - Deletes a file from both storage and database.
|
|
286
|
-
* Removes the file from the bucket and cleans up the database record.
|
|
287
|
-
*/
|
|
288
|
-
readonly deleteFile: _alepha_server0.ActionDescriptorFn<{
|
|
289
|
-
params: typebox172.TObject<{
|
|
290
|
-
id: typebox172.TString;
|
|
291
|
-
}>;
|
|
292
|
-
response: typebox172.TObject<{
|
|
293
|
-
ok: typebox172.TBoolean;
|
|
294
|
-
id: typebox172.TOptional<typebox172.TUnion<[typebox172.TString, typebox172.TInteger]>>;
|
|
295
|
-
count: typebox172.TOptional<typebox172.TNumber>;
|
|
296
|
-
}>;
|
|
297
|
-
}>;
|
|
298
|
-
/**
|
|
299
|
-
* POST /files - Uploads a new file to storage.
|
|
300
|
-
* Creates a database record with metadata and calculates checksum.
|
|
301
|
-
* Optionally specify bucket and expiration date.
|
|
302
|
-
*/
|
|
303
|
-
readonly uploadFile: _alepha_server0.ActionDescriptorFn<{
|
|
304
|
-
body: typebox172.TObject<{
|
|
305
|
-
file: _alepha_core1.TFile;
|
|
306
|
-
}>;
|
|
307
|
-
query: typebox172.TObject<{
|
|
308
|
-
expirationDate: typebox172.TOptional<typebox172.TString>;
|
|
309
|
-
bucket: typebox172.TOptional<typebox172.TString>;
|
|
310
|
-
}>;
|
|
311
|
-
response: typebox172.TObject<{
|
|
312
|
-
id: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_PRIMARY_KEY>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
313
|
-
version: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TInteger, typeof _alepha_postgres64.PG_VERSION>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
314
|
-
createdAt: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_CREATED_AT>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
315
|
-
updatedAt: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_UPDATED_AT>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
316
|
-
blobId: typebox172.TString;
|
|
317
|
-
creator: typebox172.TOptional<typebox172.TString>;
|
|
318
|
-
creatorRealm: typebox172.TOptional<typebox172.TString>;
|
|
319
|
-
creatorName: typebox172.TOptional<typebox172.TString>;
|
|
320
|
-
bucket: typebox172.TString;
|
|
321
|
-
expirationDate: typebox172.TOptional<typebox172.TString>;
|
|
322
|
-
name: typebox172.TString;
|
|
323
|
-
size: typebox172.TNumber;
|
|
324
|
-
mimeType: typebox172.TString;
|
|
325
|
-
tags: typebox172.TOptional<typebox172.TArray<typebox172.TString>>;
|
|
326
|
-
checksum: typebox172.TOptional<typebox172.TString>;
|
|
327
|
-
}>;
|
|
328
|
-
}>;
|
|
329
|
-
/**
|
|
330
|
-
* PATCH /files/:id - Updates file metadata.
|
|
331
|
-
* Allows updating name, tags, and expiration date without modifying file content.
|
|
332
|
-
*/
|
|
333
|
-
readonly updateFile: _alepha_server0.ActionDescriptorFn<{
|
|
334
|
-
params: typebox172.TObject<{
|
|
335
|
-
id: typebox172.TString;
|
|
336
|
-
}>;
|
|
337
|
-
body: typebox172.TObject<{
|
|
338
|
-
name: typebox172.TOptional<typebox172.TString>;
|
|
339
|
-
tags: typebox172.TOptional<typebox172.TArray<typebox172.TString>>;
|
|
340
|
-
expirationDate: typebox172.TOptional<typebox172.TString>;
|
|
341
|
-
}>;
|
|
342
|
-
response: typebox172.TObject<{
|
|
343
|
-
id: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_PRIMARY_KEY>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
344
|
-
version: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TInteger, typeof _alepha_postgres64.PG_VERSION>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
345
|
-
createdAt: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_CREATED_AT>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
346
|
-
updatedAt: _alepha_postgres64.PgAttr<_alepha_postgres64.PgAttr<typebox172.TString, typeof _alepha_postgres64.PG_UPDATED_AT>, typeof _alepha_postgres64.PG_DEFAULT>;
|
|
347
|
-
blobId: typebox172.TString;
|
|
348
|
-
creator: typebox172.TOptional<typebox172.TString>;
|
|
349
|
-
creatorRealm: typebox172.TOptional<typebox172.TString>;
|
|
350
|
-
creatorName: typebox172.TOptional<typebox172.TString>;
|
|
351
|
-
bucket: typebox172.TString;
|
|
352
|
-
expirationDate: typebox172.TOptional<typebox172.TString>;
|
|
353
|
-
name: typebox172.TString;
|
|
354
|
-
size: typebox172.TNumber;
|
|
355
|
-
mimeType: typebox172.TString;
|
|
356
|
-
tags: typebox172.TOptional<typebox172.TArray<typebox172.TString>>;
|
|
357
|
-
checksum: typebox172.TOptional<typebox172.TString>;
|
|
358
|
-
}>;
|
|
359
|
-
}>;
|
|
360
|
-
/**
|
|
361
|
-
* GET /files/:id - Streams/downloads a file by its ID.
|
|
362
|
-
* Returns the file content with appropriate Content-Type header.
|
|
363
|
-
* Cached with ETag support for 1 year (immutable).
|
|
364
|
-
*/
|
|
365
|
-
readonly streamFile: _alepha_server0.ActionDescriptorFn<{
|
|
366
|
-
params: typebox172.TObject<{
|
|
367
|
-
id: typebox172.TString;
|
|
368
|
-
}>;
|
|
369
|
-
response: _alepha_core1.TFile;
|
|
370
|
-
}>;
|
|
371
|
-
}
|
|
372
|
-
//#endregion
|
|
373
|
-
//#region src/controllers/StorageStatsController.d.ts
|
|
374
|
-
/**
|
|
375
|
-
* REST API controller for storage analytics and statistics.
|
|
376
|
-
* Provides endpoints for viewing storage usage metrics.
|
|
377
|
-
*/
|
|
378
|
-
declare class StorageStatsController {
|
|
379
|
-
protected readonly url = "/files/stats";
|
|
380
|
-
protected readonly group = "files";
|
|
381
|
-
protected readonly fileService: FileService;
|
|
382
|
-
/**
|
|
383
|
-
* GET /files/stats - Gets storage statistics.
|
|
384
|
-
* Returns aggregated data including total size, file count,
|
|
385
|
-
* and breakdowns by bucket and MIME type.
|
|
386
|
-
*/
|
|
387
|
-
readonly getStats: _alepha_server0.ActionDescriptorFn<{
|
|
388
|
-
response: typebox172.TObject<{
|
|
389
|
-
totalSize: typebox172.TNumber;
|
|
390
|
-
totalFiles: typebox172.TNumber;
|
|
391
|
-
byBucket: typebox172.TArray<typebox172.TObject<{
|
|
392
|
-
bucket: typebox172.TString;
|
|
393
|
-
totalSize: typebox172.TNumber;
|
|
394
|
-
fileCount: typebox172.TNumber;
|
|
395
|
-
}>>;
|
|
396
|
-
byMimeType: typebox172.TArray<typebox172.TObject<{
|
|
397
|
-
mimeType: typebox172.TString;
|
|
398
|
-
fileCount: typebox172.TNumber;
|
|
399
|
-
}>>;
|
|
400
|
-
}>;
|
|
401
|
-
}>;
|
|
402
|
-
}
|
|
403
|
-
//#endregion
|
|
404
|
-
//#region src/index.d.ts
|
|
405
|
-
declare module "alepha/bucket" {
|
|
406
|
-
interface BucketFileOptions {
|
|
407
|
-
/**
|
|
408
|
-
* Time to live for the files in the bucket.
|
|
409
|
-
*/
|
|
410
|
-
ttl?: DurationLike;
|
|
411
|
-
/**
|
|
412
|
-
* Tags for the bucket.
|
|
413
|
-
*/
|
|
414
|
-
tags?: string[];
|
|
415
|
-
/**
|
|
416
|
-
* User performing the operation.
|
|
417
|
-
*/
|
|
418
|
-
user?: UserAccountToken;
|
|
419
|
-
/**
|
|
420
|
-
* Whether to persist the file metadata in the database.
|
|
421
|
-
*
|
|
422
|
-
* @default true
|
|
423
|
-
*/
|
|
424
|
-
persist?: boolean;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Provides file management API endpoints for Alepha applications.
|
|
429
|
-
*
|
|
430
|
-
* This module includes file upload, download, storage management,
|
|
431
|
-
* and file metadata operations.
|
|
432
|
-
*
|
|
433
|
-
* @module alepha.api.files
|
|
434
|
-
*/
|
|
435
|
-
declare const AlephaApiFiles: _alepha_core1.Service<_alepha_core1.Module>;
|
|
436
|
-
//#endregion
|
|
437
|
-
export { AlephaApiFiles, BucketStats, FileController, FileEntity, FileService, MimeTypeStats, StorageStats, StorageStatsController, bucketStatsSchema, files, mimeTypeStatsSchema, storageStatsSchema };
|
|
438
|
-
//# sourceMappingURL=index.d.ts.map
|
package/api/files.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@alepha/api-files'
|
package/api/jobs.cjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var m = require('@alepha/api-jobs');
|
|
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
|
-
});
|