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