alepha 0.14.3 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -5
- package/dist/api/audits/index.d.ts +620 -811
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/files/index.d.ts +185 -377
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/files/index.js +0 -1
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.d.ts +245 -435
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/notifications/index.d.ts +238 -429
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/parameters/index.d.ts +236 -427
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/users/index.browser.js +1 -2
- package/dist/api/users/index.browser.js.map +1 -1
- package/dist/api/users/index.d.ts +1010 -1196
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +178 -151
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.d.ts +17 -17
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/batch/index.d.ts +122 -122
- package/dist/batch/index.d.ts.map +1 -1
- package/dist/batch/index.js +1 -2
- package/dist/batch/index.js.map +1 -1
- package/dist/bucket/index.d.ts +163 -163
- package/dist/bucket/index.d.ts.map +1 -1
- package/dist/cache/core/index.d.ts +46 -46
- package/dist/cache/core/index.d.ts.map +1 -1
- package/dist/cache/redis/index.d.ts.map +1 -1
- package/dist/cli/index.d.ts +384 -285
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +1113 -623
- package/dist/cli/index.js.map +1 -1
- package/dist/command/index.d.ts +299 -300
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +13 -9
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +445 -103
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +733 -625
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +446 -103
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +445 -103
- package/dist/core/index.native.js.map +1 -1
- package/dist/datetime/index.d.ts +44 -44
- package/dist/datetime/index.d.ts.map +1 -1
- package/dist/datetime/index.js +4 -4
- package/dist/datetime/index.js.map +1 -1
- package/dist/email/index.d.ts +97 -50
- package/dist/email/index.d.ts.map +1 -1
- package/dist/email/index.js +129 -33
- package/dist/email/index.js.map +1 -1
- package/dist/fake/index.d.ts +7981 -14
- package/dist/fake/index.d.ts.map +1 -1
- package/dist/file/index.d.ts +523 -390
- package/dist/file/index.d.ts.map +1 -1
- package/dist/file/index.js +253 -1
- package/dist/file/index.js.map +1 -1
- package/dist/lock/core/index.d.ts +208 -208
- package/dist/lock/core/index.d.ts.map +1 -1
- package/dist/lock/redis/index.d.ts.map +1 -1
- package/dist/logger/index.d.ts +25 -26
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +12 -2
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.d.ts +197 -197
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/chunk-DtkW-qnP.js +38 -0
- package/dist/orm/index.browser.js.map +1 -1
- package/dist/orm/index.bun.js +2814 -0
- package/dist/orm/index.bun.js.map +1 -0
- package/dist/orm/index.d.ts +1228 -1216
- package/dist/orm/index.d.ts.map +1 -1
- package/dist/orm/index.js +2041 -1967
- package/dist/orm/index.js.map +1 -1
- package/dist/queue/core/index.d.ts +248 -248
- package/dist/queue/core/index.d.ts.map +1 -1
- package/dist/queue/redis/index.d.ts.map +1 -1
- package/dist/redis/index.bun.js +285 -0
- package/dist/redis/index.bun.js.map +1 -0
- package/dist/redis/index.d.ts +118 -136
- package/dist/redis/index.d.ts.map +1 -1
- package/dist/redis/index.js +18 -38
- package/dist/redis/index.js.map +1 -1
- package/dist/retry/index.d.ts +69 -69
- package/dist/retry/index.d.ts.map +1 -1
- package/dist/router/index.d.ts +6 -6
- package/dist/router/index.d.ts.map +1 -1
- package/dist/scheduler/index.d.ts +25 -25
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/security/index.browser.js +5 -1
- package/dist/security/index.browser.js.map +1 -1
- package/dist/security/index.d.ts +417 -254
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +386 -86
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.d.ts +110 -110
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +20 -20
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cache/index.d.ts +62 -47
- package/dist/server/cache/index.d.ts.map +1 -1
- package/dist/server/cache/index.js +56 -3
- package/dist/server/cache/index.js.map +1 -1
- package/dist/server/compress/index.d.ts +6 -0
- package/dist/server/compress/index.d.ts.map +1 -1
- package/dist/server/compress/index.js +36 -1
- package/dist/server/compress/index.js.map +1 -1
- package/dist/server/cookies/index.d.ts +6 -6
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/cookies/index.js +3 -3
- package/dist/server/cookies/index.js.map +1 -1
- package/dist/server/core/index.browser.js +2 -2
- package/dist/server/core/index.browser.js.map +1 -1
- package/dist/server/core/index.d.ts +242 -150
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +294 -125
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/cors/index.d.ts +11 -12
- package/dist/server/cors/index.d.ts.map +1 -1
- package/dist/server/health/index.d.ts +0 -1
- package/dist/server/health/index.d.ts.map +1 -1
- package/dist/server/helmet/index.d.ts +2 -2
- package/dist/server/helmet/index.d.ts.map +1 -1
- package/dist/server/links/index.browser.js.map +1 -1
- package/dist/server/links/index.d.ts +123 -124
- package/dist/server/links/index.d.ts.map +1 -1
- package/dist/server/links/index.js +1 -2
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/metrics/index.d.ts.map +1 -1
- package/dist/server/multipart/index.d.ts +6 -6
- package/dist/server/multipart/index.d.ts.map +1 -1
- package/dist/server/proxy/index.d.ts +102 -103
- package/dist/server/proxy/index.d.ts.map +1 -1
- package/dist/server/rate-limit/index.d.ts +16 -16
- package/dist/server/rate-limit/index.d.ts.map +1 -1
- package/dist/server/static/index.d.ts +44 -44
- package/dist/server/static/index.d.ts.map +1 -1
- package/dist/server/static/index.js +4 -0
- package/dist/server/static/index.js.map +1 -1
- package/dist/server/swagger/index.d.ts +48 -49
- package/dist/server/swagger/index.d.ts.map +1 -1
- package/dist/server/swagger/index.js +3 -5
- package/dist/server/swagger/index.js.map +1 -1
- package/dist/sms/index.d.ts +13 -11
- package/dist/sms/index.d.ts.map +1 -1
- package/dist/sms/index.js +7 -7
- package/dist/sms/index.js.map +1 -1
- package/dist/thread/index.d.ts +71 -72
- package/dist/thread/index.d.ts.map +1 -1
- package/dist/topic/core/index.d.ts +318 -318
- package/dist/topic/core/index.d.ts.map +1 -1
- package/dist/topic/redis/index.d.ts +6 -6
- package/dist/topic/redis/index.d.ts.map +1 -1
- package/dist/vite/index.d.ts +5805 -249
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +599 -513
- package/dist/vite/index.js.map +1 -1
- package/dist/websocket/index.browser.js +6 -6
- package/dist/websocket/index.browser.js.map +1 -1
- package/dist/websocket/index.d.ts +247 -247
- package/dist/websocket/index.d.ts.map +1 -1
- package/dist/websocket/index.js +6 -6
- package/dist/websocket/index.js.map +1 -1
- package/package.json +9 -14
- package/src/api/files/controllers/AdminFileStatsController.ts +0 -1
- package/src/api/users/atoms/realmAuthSettingsAtom.ts +5 -0
- package/src/api/users/controllers/{UserRealmController.ts → RealmController.ts} +11 -11
- package/src/api/users/entities/users.ts +1 -1
- package/src/api/users/index.ts +8 -8
- package/src/api/users/primitives/{$userRealm.ts → $realm.ts} +17 -19
- package/src/api/users/providers/{UserRealmProvider.ts → RealmProvider.ts} +26 -30
- package/src/api/users/schemas/{userRealmConfigSchema.ts → realmConfigSchema.ts} +2 -2
- package/src/api/users/services/CredentialService.ts +7 -7
- package/src/api/users/services/IdentityService.ts +4 -4
- package/src/api/users/services/RegistrationService.spec.ts +25 -27
- package/src/api/users/services/RegistrationService.ts +38 -27
- package/src/api/users/services/SessionCrudService.ts +3 -3
- package/src/api/users/services/SessionService.spec.ts +3 -3
- package/src/api/users/services/SessionService.ts +28 -9
- package/src/api/users/services/UserService.ts +7 -7
- package/src/batch/providers/BatchProvider.ts +1 -2
- package/src/cli/apps/AlephaCli.ts +0 -2
- package/src/cli/apps/AlephaPackageBuilderCli.ts +38 -19
- package/src/cli/assets/apiHelloControllerTs.ts +18 -0
- package/src/cli/assets/apiIndexTs.ts +16 -0
- package/src/cli/assets/claudeMd.ts +303 -0
- package/src/cli/assets/mainBrowserTs.ts +2 -2
- package/src/cli/assets/mainServerTs.ts +24 -0
- package/src/cli/assets/webAppRouterTs.ts +15 -0
- package/src/cli/assets/webHelloComponentTsx.ts +16 -0
- package/src/cli/assets/webIndexTs.ts +16 -0
- package/src/cli/atoms/buildOptions.ts +88 -0
- package/src/cli/commands/build.ts +70 -87
- package/src/cli/commands/db.ts +21 -22
- package/src/cli/commands/deploy.ts +17 -5
- package/src/cli/commands/dev.ts +22 -14
- package/src/cli/commands/format.ts +8 -2
- package/src/cli/commands/gen/env.ts +53 -0
- package/src/cli/commands/gen/openapi.ts +1 -1
- package/src/cli/commands/gen/resource.ts +15 -0
- package/src/cli/commands/gen.ts +7 -1
- package/src/cli/commands/init.ts +74 -30
- package/src/cli/commands/lint.ts +8 -2
- package/src/cli/commands/test.ts +8 -3
- package/src/cli/commands/typecheck.ts +5 -1
- package/src/cli/commands/verify.ts +5 -3
- package/src/cli/defineConfig.ts +49 -7
- package/src/cli/index.ts +0 -1
- package/src/cli/services/AlephaCliUtils.ts +39 -589
- package/src/cli/services/PackageManagerUtils.ts +301 -0
- package/src/cli/services/ProjectScaffolder.ts +306 -0
- package/src/command/helpers/Runner.spec.ts +2 -2
- package/src/command/helpers/Runner.ts +16 -4
- package/src/command/primitives/$command.ts +0 -6
- package/src/command/providers/CliProvider.ts +1 -3
- package/src/core/Alepha.ts +42 -0
- package/src/core/__tests__/Alepha-graph.spec.ts +4 -0
- package/src/core/index.shared.ts +1 -0
- package/src/core/index.ts +2 -0
- package/src/core/primitives/$hook.ts +6 -2
- package/src/core/primitives/$module.spec.ts +4 -0
- package/src/core/providers/AlsProvider.ts +1 -1
- package/src/core/providers/CodecManager.spec.ts +12 -6
- package/src/core/providers/CodecManager.ts +26 -6
- package/src/core/providers/EventManager.ts +169 -13
- package/src/core/providers/KeylessJsonSchemaCodec.spec.ts +621 -0
- package/src/core/providers/KeylessJsonSchemaCodec.ts +407 -0
- package/src/core/providers/StateManager.spec.ts +27 -16
- package/src/email/providers/LocalEmailProvider.spec.ts +111 -87
- package/src/email/providers/LocalEmailProvider.ts +52 -15
- package/src/email/providers/NodemailerEmailProvider.ts +167 -56
- package/src/file/errors/FileError.ts +7 -0
- package/src/file/index.ts +9 -1
- package/src/file/providers/MemoryFileSystemProvider.ts +393 -0
- package/src/logger/index.ts +15 -3
- package/src/mcp/transports/StdioMcpTransport.ts +1 -1
- package/src/orm/index.browser.ts +1 -19
- package/src/orm/index.bun.ts +77 -0
- package/src/orm/index.shared-server.ts +22 -0
- package/src/orm/index.shared.ts +15 -0
- package/src/orm/index.ts +13 -39
- package/src/orm/providers/drivers/BunPostgresProvider.ts +3 -5
- package/src/orm/providers/drivers/BunSqliteProvider.ts +1 -1
- package/src/orm/providers/drivers/CloudflareD1Provider.ts +4 -0
- package/src/orm/providers/drivers/DatabaseProvider.ts +4 -0
- package/src/orm/providers/drivers/PglitePostgresProvider.ts +4 -0
- package/src/orm/services/Repository.ts +8 -0
- package/src/queue/core/providers/WorkerProvider.spec.ts +48 -32
- package/src/redis/index.bun.ts +35 -0
- package/src/redis/providers/BunRedisProvider.ts +12 -43
- package/src/redis/providers/BunRedisSubscriberProvider.ts +2 -3
- package/src/redis/providers/NodeRedisProvider.ts +16 -34
- package/src/{server/security → security}/__tests__/BasicAuth.spec.ts +11 -11
- package/src/{server/security → security}/__tests__/ServerSecurityProvider-realm.spec.ts +21 -16
- package/src/{server/security/providers → security/__tests__}/ServerSecurityProvider.spec.ts +5 -5
- package/src/security/index.browser.ts +5 -0
- package/src/security/index.ts +90 -7
- package/src/security/primitives/{$realm.spec.ts → $issuer.spec.ts} +11 -11
- package/src/security/primitives/{$realm.ts → $issuer.ts} +20 -17
- package/src/security/primitives/$role.ts +5 -5
- package/src/security/primitives/$serviceAccount.spec.ts +5 -5
- package/src/security/primitives/$serviceAccount.ts +3 -3
- package/src/{server/security → security}/providers/ServerSecurityProvider.ts +5 -7
- package/src/server/auth/primitives/$auth.ts +10 -10
- package/src/server/auth/primitives/$authCredentials.ts +3 -3
- package/src/server/auth/primitives/$authGithub.ts +3 -3
- package/src/server/auth/primitives/$authGoogle.ts +3 -3
- package/src/server/auth/providers/ServerAuthProvider.ts +13 -13
- package/src/server/cache/providers/ServerCacheProvider.spec.ts +183 -0
- package/src/server/cache/providers/ServerCacheProvider.ts +95 -10
- package/src/server/compress/providers/ServerCompressProvider.ts +61 -2
- package/src/server/cookies/providers/ServerCookiesProvider.ts +3 -3
- package/src/server/core/helpers/ServerReply.ts +2 -2
- package/src/server/core/providers/NodeHttpServerProvider.ts +25 -6
- package/src/server/core/providers/ServerBodyParserProvider.ts +19 -23
- package/src/server/core/providers/ServerLoggerProvider.ts +23 -19
- package/src/server/core/providers/ServerProvider.ts +155 -22
- package/src/server/core/providers/ServerRouterProvider.ts +259 -115
- package/src/server/core/providers/ServerTimingProvider.ts +2 -2
- package/src/server/links/index.ts +1 -1
- package/src/server/links/providers/LinkProvider.ts +1 -1
- package/src/server/static/providers/ServerStaticProvider.ts +10 -0
- package/src/server/swagger/index.ts +1 -1
- package/src/server/swagger/providers/ServerSwaggerProvider.ts +5 -8
- package/src/sms/providers/LocalSmsProvider.spec.ts +153 -111
- package/src/sms/providers/LocalSmsProvider.ts +8 -7
- package/src/vite/helpers/boot.ts +28 -17
- package/src/vite/helpers/importViteReact.ts +13 -0
- package/src/vite/index.ts +1 -21
- package/src/vite/plugins/viteAlephaDev.ts +16 -1
- package/src/vite/plugins/viteAlephaSsrPreload.ts +222 -0
- package/src/vite/tasks/buildClient.ts +11 -0
- package/src/vite/tasks/buildServer.ts +59 -4
- package/src/vite/tasks/devServer.ts +71 -0
- package/src/vite/tasks/generateCloudflare.ts +7 -0
- package/src/vite/tasks/index.ts +2 -1
- package/dist/server/security/index.browser.js +0 -13
- package/dist/server/security/index.browser.js.map +0 -1
- package/dist/server/security/index.d.ts +0 -173
- package/dist/server/security/index.d.ts.map +0 -1
- package/dist/server/security/index.js +0 -311
- package/dist/server/security/index.js.map +0 -1
- package/src/cli/assets/appRouterTs.ts +0 -9
- package/src/cli/assets/mainTs.ts +0 -13
- package/src/cli/assets/viteConfigTs.ts +0 -14
- package/src/cli/commands/run.ts +0 -24
- package/src/server/security/index.browser.ts +0 -10
- package/src/server/security/index.ts +0 -94
- package/src/vite/plugins/viteAlepha.ts +0 -37
- package/src/vite/plugins/viteAlephaBuild.ts +0 -281
- /package/src/{server/security → security}/primitives/$basicAuth.ts +0 -0
- /package/src/{server/security → security}/providers/ServerBasicAuthProvider.ts +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as alepha160 from "alepha";
|
|
2
2
|
import { Alepha, FileLike, Static, TNull, TObject, TOptional, TSchema, TUnion } from "alepha";
|
|
3
3
|
import { BucketPrimitive } from "alepha/bucket";
|
|
4
|
-
import "alepha/server/security";
|
|
5
4
|
import * as alepha_server0 from "alepha/server";
|
|
6
5
|
import { Ok } from "alepha/server";
|
|
7
6
|
import { DateTime, DateTimeProvider, DurationLike } from "alepha/datetime";
|
|
@@ -9,19 +8,12 @@ import * as alepha_logger0 from "alepha/logger";
|
|
|
9
8
|
import * as alepha_orm16 from "alepha/orm";
|
|
10
9
|
import { Page } from "alepha/orm";
|
|
11
10
|
import * as alepha_scheduler0 from "alepha/scheduler";
|
|
12
|
-
import "bun";
|
|
13
|
-
import "bun:sqlite";
|
|
14
|
-
import "drizzle-orm/bun-sql";
|
|
15
|
-
import "drizzle-orm/bun-sqlite";
|
|
16
11
|
import "drizzle-orm/d1";
|
|
17
12
|
import { UserAccountToken } from "alepha/security";
|
|
18
13
|
import { BuildExtraConfigColumns, SQL } from "drizzle-orm";
|
|
19
14
|
import { PgColumnBuilderBase, PgSequenceOptions, PgTableExtraConfigValue, UpdateDeleteAction } from "drizzle-orm/pg-core";
|
|
20
15
|
import "alepha/retry";
|
|
21
|
-
import "alepha/lock";
|
|
22
16
|
import "drizzle-orm/sqlite-core";
|
|
23
|
-
import "drizzle-orm/postgres-js";
|
|
24
|
-
import "postgres";
|
|
25
17
|
|
|
26
18
|
//#region ../../src/api/files/entities/files.d.ts
|
|
27
19
|
declare const files: alepha_orm16.EntityPrimitive<alepha160.TObject<{
|
|
@@ -88,114 +80,114 @@ type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"]]:
|
|
|
88
80
|
//#region ../../src/orm/primitives/$entity.d.ts
|
|
89
81
|
interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
|
|
90
82
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
83
|
+
* The database table name that will be created for this entity.
|
|
84
|
+
* If not provided, name will be inferred from the $repository variable name.
|
|
85
|
+
*/
|
|
94
86
|
name: string;
|
|
95
87
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
88
|
+
* TypeBox schema defining the table structure and column types.
|
|
89
|
+
*/
|
|
98
90
|
schema: T;
|
|
99
91
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
92
|
+
* Database indexes to create for query optimization.
|
|
93
|
+
*/
|
|
102
94
|
indexes?: (Keys | {
|
|
103
95
|
/**
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
* Single column to index.
|
|
97
|
+
*/
|
|
106
98
|
column: Keys;
|
|
107
99
|
/**
|
|
108
|
-
|
|
109
|
-
|
|
100
|
+
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
101
|
+
*/
|
|
110
102
|
unique?: boolean;
|
|
111
103
|
/**
|
|
112
|
-
|
|
113
|
-
|
|
104
|
+
* Custom name for the index. If not provided, generates name automatically.
|
|
105
|
+
*/
|
|
114
106
|
name?: string;
|
|
115
107
|
} | {
|
|
116
108
|
/**
|
|
117
|
-
|
|
118
|
-
|
|
109
|
+
* Multiple columns for composite index (order matters for query optimization).
|
|
110
|
+
*/
|
|
119
111
|
columns: Keys[];
|
|
120
112
|
/**
|
|
121
|
-
|
|
122
|
-
|
|
113
|
+
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
114
|
+
*/
|
|
123
115
|
unique?: boolean;
|
|
124
116
|
/**
|
|
125
|
-
|
|
126
|
-
|
|
117
|
+
* Custom name for the index. If not provided, generates name automatically.
|
|
118
|
+
*/
|
|
127
119
|
name?: string;
|
|
128
120
|
})[];
|
|
129
121
|
/**
|
|
130
|
-
|
|
131
|
-
|
|
122
|
+
* Foreign key constraints to maintain referential integrity.
|
|
123
|
+
*/
|
|
132
124
|
foreignKeys?: Array<{
|
|
133
125
|
/**
|
|
134
|
-
|
|
135
|
-
|
|
126
|
+
* Optional name for the foreign key constraint.
|
|
127
|
+
*/
|
|
136
128
|
name?: string;
|
|
137
129
|
/**
|
|
138
|
-
|
|
139
|
-
|
|
130
|
+
* Local columns that reference the foreign table.
|
|
131
|
+
*/
|
|
140
132
|
columns: Array<keyof Static<T>>;
|
|
141
133
|
/**
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
134
|
+
* Referenced columns in the foreign table.
|
|
135
|
+
* Must be EntityColumn references from other entities.
|
|
136
|
+
*/
|
|
145
137
|
foreignColumns: Array<() => EntityColumn<any>>;
|
|
146
138
|
}>;
|
|
147
139
|
/**
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
140
|
+
* Additional table constraints for data validation.
|
|
141
|
+
*
|
|
142
|
+
* Constraints enforce business rules at the database level, providing
|
|
143
|
+
* an additional layer of data integrity beyond application validation.
|
|
144
|
+
*
|
|
145
|
+
* **Constraint Types**:
|
|
146
|
+
* - **Unique constraints**: Prevent duplicate values across columns
|
|
147
|
+
* - **Check constraints**: Enforce custom validation rules with SQL expressions
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* constraints: [
|
|
152
|
+
* {
|
|
153
|
+
* name: "unique_user_email",
|
|
154
|
+
* columns: ["email"],
|
|
155
|
+
* unique: true
|
|
156
|
+
* },
|
|
157
|
+
* {
|
|
158
|
+
* name: "valid_age_range",
|
|
159
|
+
* columns: ["age"],
|
|
160
|
+
* check: sql`age >= 0 AND age <= 150`
|
|
161
|
+
* },
|
|
162
|
+
* {
|
|
163
|
+
* name: "unique_user_username_per_tenant",
|
|
164
|
+
* columns: ["tenantId", "username"],
|
|
165
|
+
* unique: true
|
|
166
|
+
* }
|
|
167
|
+
* ]
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
178
170
|
constraints?: Array<{
|
|
179
171
|
/**
|
|
180
|
-
|
|
181
|
-
|
|
172
|
+
* Columns involved in this constraint.
|
|
173
|
+
*/
|
|
182
174
|
columns: Array<keyof Static<T>>;
|
|
183
175
|
/**
|
|
184
|
-
|
|
185
|
-
|
|
176
|
+
* Optional name for the constraint.
|
|
177
|
+
*/
|
|
186
178
|
name?: string;
|
|
187
179
|
/**
|
|
188
|
-
|
|
189
|
-
|
|
180
|
+
* Whether this is a unique constraint.
|
|
181
|
+
*/
|
|
190
182
|
unique?: boolean | {};
|
|
191
183
|
/**
|
|
192
|
-
|
|
193
|
-
|
|
184
|
+
* SQL expression for check constraint validation.
|
|
185
|
+
*/
|
|
194
186
|
check?: SQL;
|
|
195
187
|
}>;
|
|
196
188
|
/**
|
|
197
|
-
|
|
198
|
-
|
|
189
|
+
* Advanced Drizzle ORM configuration for complex table setups.
|
|
190
|
+
*/
|
|
199
191
|
config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
|
|
200
192
|
}
|
|
201
193
|
declare class EntityPrimitive<T extends TObject = TObject> {
|
|
@@ -243,8 +235,8 @@ type PgSymbols = {
|
|
|
243
235
|
[PG_REF]: PgRefOptions;
|
|
244
236
|
[PG_ENUM]: PgEnumOptions;
|
|
245
237
|
/**
|
|
246
|
-
|
|
247
|
-
|
|
238
|
+
* @deprecated Use `PG_IDENTITY` instead.
|
|
239
|
+
*/
|
|
248
240
|
[PG_SERIAL]: {};
|
|
249
241
|
};
|
|
250
242
|
type PgSymbolKeys = keyof PgSymbols;
|
|
@@ -274,190 +266,6 @@ interface PgRefOptions {
|
|
|
274
266
|
*/
|
|
275
267
|
type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
|
|
276
268
|
//#endregion
|
|
277
|
-
//#region ../../src/orm/providers/drivers/BunPostgresProvider.d.ts
|
|
278
|
-
declare module "alepha" {
|
|
279
|
-
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
280
|
-
}
|
|
281
|
-
declare const envSchema$1: alepha160.TObject<{
|
|
282
|
-
/**
|
|
283
|
-
* Main configuration for database connection.
|
|
284
|
-
* Accept a string in the format of a Postgres connection URL.
|
|
285
|
-
* Example: postgres://user:password@localhost:5432/database
|
|
286
|
-
* or
|
|
287
|
-
* Example: postgres://user:password@localhost:5432/database?sslmode=require
|
|
288
|
-
*/
|
|
289
|
-
DATABASE_URL: alepha160.TOptional<alepha160.TString>;
|
|
290
|
-
/**
|
|
291
|
-
* In addition to the DATABASE_URL, you can specify the postgres schema name.
|
|
292
|
-
*/
|
|
293
|
-
POSTGRES_SCHEMA: alepha160.TOptional<alepha160.TString>;
|
|
294
|
-
}>;
|
|
295
|
-
/**
|
|
296
|
-
* Bun PostgreSQL provider using Drizzle ORM with Bun's native SQL client.
|
|
297
|
-
*
|
|
298
|
-
* This provider uses Bun's built-in SQL class for PostgreSQL connections,
|
|
299
|
-
* which provides excellent performance on the Bun runtime.
|
|
300
|
-
*
|
|
301
|
-
* @example
|
|
302
|
-
* ```ts
|
|
303
|
-
* // Set DATABASE_URL environment variable
|
|
304
|
-
* // DATABASE_URL=postgres://user:password@localhost:5432/database
|
|
305
|
-
*
|
|
306
|
-
* // Or configure programmatically
|
|
307
|
-
* alepha.with({
|
|
308
|
-
* provide: DatabaseProvider,
|
|
309
|
-
* use: BunPostgresProvider,
|
|
310
|
-
* });
|
|
311
|
-
* ```
|
|
312
|
-
*/
|
|
313
|
-
//#endregion
|
|
314
|
-
//#region ../../src/orm/providers/drivers/BunSqliteProvider.d.ts
|
|
315
|
-
/**
|
|
316
|
-
* Configuration options for the Bun SQLite database provider.
|
|
317
|
-
*/
|
|
318
|
-
declare const bunSqliteOptions: alepha160.Atom<alepha160.TObject<{
|
|
319
|
-
path: alepha160.TOptional<alepha160.TString>;
|
|
320
|
-
}>, "alepha.postgres.bun-sqlite.options">;
|
|
321
|
-
type BunSqliteProviderOptions = Static<typeof bunSqliteOptions.schema>;
|
|
322
|
-
declare module "alepha" {
|
|
323
|
-
interface State {
|
|
324
|
-
[bunSqliteOptions.key]: BunSqliteProviderOptions;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Bun SQLite provider using Drizzle ORM with Bun's native SQLite client.
|
|
329
|
-
*
|
|
330
|
-
* This provider uses Bun's built-in `bun:sqlite` for SQLite connections,
|
|
331
|
-
* which provides excellent performance on the Bun runtime.
|
|
332
|
-
*
|
|
333
|
-
* @example
|
|
334
|
-
* ```ts
|
|
335
|
-
* // Set DATABASE_URL environment variable
|
|
336
|
-
* // DATABASE_URL=sqlite://./my-database.db
|
|
337
|
-
*
|
|
338
|
-
* // Or configure programmatically
|
|
339
|
-
* alepha.with({
|
|
340
|
-
* provide: DatabaseProvider,
|
|
341
|
-
* use: BunSqliteProvider,
|
|
342
|
-
* });
|
|
343
|
-
*
|
|
344
|
-
* // Or use options atom
|
|
345
|
-
* alepha.store.mut(bunSqliteOptions, (old) => ({
|
|
346
|
-
* ...old,
|
|
347
|
-
* path: ":memory:",
|
|
348
|
-
* }));
|
|
349
|
-
* ```
|
|
350
|
-
*/
|
|
351
|
-
//#endregion
|
|
352
|
-
//#region ../../src/orm/providers/drivers/NodePostgresProvider.d.ts
|
|
353
|
-
declare module "alepha" {
|
|
354
|
-
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
355
|
-
}
|
|
356
|
-
declare const envSchema: alepha160.TObject<{
|
|
357
|
-
/**
|
|
358
|
-
* Main configuration for database connection.
|
|
359
|
-
* Accept a string in the format of a Postgres connection URL.
|
|
360
|
-
* Example: postgres://user:password@localhost:5432/database
|
|
361
|
-
* or
|
|
362
|
-
* Example: postgres://user:password@localhost:5432/database?sslmode=require
|
|
363
|
-
*/
|
|
364
|
-
DATABASE_URL: alepha160.TOptional<alepha160.TString>;
|
|
365
|
-
/**
|
|
366
|
-
* In addition to the DATABASE_URL, you can specify the postgres schema name.
|
|
367
|
-
*
|
|
368
|
-
* It will monkey patch drizzle tables.
|
|
369
|
-
*/
|
|
370
|
-
POSTGRES_SCHEMA: alepha160.TOptional<alepha160.TString>;
|
|
371
|
-
}>;
|
|
372
|
-
//#endregion
|
|
373
|
-
//#region ../../src/orm/providers/drivers/NodeSqliteProvider.d.ts
|
|
374
|
-
/**
|
|
375
|
-
* Configuration options for the Node.js SQLite database provider.
|
|
376
|
-
*/
|
|
377
|
-
declare const nodeSqliteOptions: alepha160.Atom<alepha160.TObject<{
|
|
378
|
-
path: alepha160.TOptional<alepha160.TString>;
|
|
379
|
-
}>, "alepha.postgres.node-sqlite.options">;
|
|
380
|
-
type NodeSqliteProviderOptions = Static<typeof nodeSqliteOptions.schema>;
|
|
381
|
-
declare module "alepha" {
|
|
382
|
-
interface State {
|
|
383
|
-
[nodeSqliteOptions.key]: NodeSqliteProviderOptions;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Add a fake support for SQLite in Node.js based on Postgres interfaces.
|
|
388
|
-
*
|
|
389
|
-
* This is NOT a real SQLite provider, it's a workaround to use SQLite with Drizzle ORM.
|
|
390
|
-
* This is NOT recommended for production use.
|
|
391
|
-
*/
|
|
392
|
-
//#endregion
|
|
393
|
-
//#region ../../src/orm/index.d.ts
|
|
394
|
-
declare module "alepha" {
|
|
395
|
-
interface Hooks {
|
|
396
|
-
/**
|
|
397
|
-
* Fires before creating an entity in the repository.
|
|
398
|
-
*/
|
|
399
|
-
"repository:create:before": {
|
|
400
|
-
tableName: string;
|
|
401
|
-
data: any;
|
|
402
|
-
};
|
|
403
|
-
/**
|
|
404
|
-
* Fires after creating an entity in the repository.
|
|
405
|
-
*/
|
|
406
|
-
"repository:create:after": {
|
|
407
|
-
tableName: string;
|
|
408
|
-
data: any;
|
|
409
|
-
entity: any;
|
|
410
|
-
};
|
|
411
|
-
/**
|
|
412
|
-
* Fires before updating entities in the repository.
|
|
413
|
-
*/
|
|
414
|
-
"repository:update:before": {
|
|
415
|
-
tableName: string;
|
|
416
|
-
where: any;
|
|
417
|
-
data: any;
|
|
418
|
-
};
|
|
419
|
-
/**
|
|
420
|
-
* Fires after updating entities in the repository.
|
|
421
|
-
*/
|
|
422
|
-
"repository:update:after": {
|
|
423
|
-
tableName: string;
|
|
424
|
-
where: any;
|
|
425
|
-
data: any;
|
|
426
|
-
entities: any[];
|
|
427
|
-
};
|
|
428
|
-
/**
|
|
429
|
-
* Fires before deleting entities from the repository.
|
|
430
|
-
*/
|
|
431
|
-
"repository:delete:before": {
|
|
432
|
-
tableName: string;
|
|
433
|
-
where: any;
|
|
434
|
-
};
|
|
435
|
-
/**
|
|
436
|
-
* Fires after deleting entities from the repository.
|
|
437
|
-
*/
|
|
438
|
-
"repository:delete:after": {
|
|
439
|
-
tableName: string;
|
|
440
|
-
where: any;
|
|
441
|
-
ids: Array<string | number>;
|
|
442
|
-
};
|
|
443
|
-
/**
|
|
444
|
-
* Fires before reading entities from the repository.
|
|
445
|
-
*/
|
|
446
|
-
"repository:read:before": {
|
|
447
|
-
tableName: string;
|
|
448
|
-
query: any;
|
|
449
|
-
};
|
|
450
|
-
/**
|
|
451
|
-
* Fires after reading entities from the repository.
|
|
452
|
-
*/
|
|
453
|
-
"repository:read:after": {
|
|
454
|
-
tableName: string;
|
|
455
|
-
query: any;
|
|
456
|
-
entities: any[];
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
//#endregion
|
|
461
269
|
//#region ../../src/api/files/schemas/fileResourceSchema.d.ts
|
|
462
270
|
declare const fileResourceSchema: alepha160.TObject<{
|
|
463
271
|
id: PgAttr<PgAttr<alepha160.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
@@ -531,57 +339,57 @@ declare class FileService {
|
|
|
531
339
|
protected onUploadFile: alepha160.HookPrimitive<"bucket:file:uploaded">;
|
|
532
340
|
protected onDeleteBucketFile: alepha160.HookPrimitive<"bucket:file:deleted">;
|
|
533
341
|
/**
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
342
|
+
* Calculates SHA-256 checksum of a file.
|
|
343
|
+
*
|
|
344
|
+
* @param file - The file to calculate checksum for
|
|
345
|
+
* @returns Hexadecimal string representation of the SHA-256 hash
|
|
346
|
+
* @protected
|
|
347
|
+
*/
|
|
540
348
|
protected calculateChecksum(file: FileLike): Promise<string>;
|
|
541
349
|
/**
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
350
|
+
* Gets a bucket primitive by name.
|
|
351
|
+
*
|
|
352
|
+
* @param bucketName - The name of the bucket to retrieve (defaults to "default")
|
|
353
|
+
* @returns The bucket primitive
|
|
354
|
+
* @throws {NotFoundError} If the bucket is not found
|
|
355
|
+
*/
|
|
548
356
|
bucket(bucketName?: string): BucketPrimitive;
|
|
549
357
|
/**
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
358
|
+
* Finds files matching the given query criteria with pagination support.
|
|
359
|
+
* Supports filtering by bucket, tags, name, mimeType, creator, and date range.
|
|
360
|
+
*
|
|
361
|
+
* @param q - Query parameters including bucket, tags, name, mimeType, creator, date range, pagination, and sorting
|
|
362
|
+
* @returns Paginated list of file entities
|
|
363
|
+
*/
|
|
556
364
|
findFiles(q?: FileQuery): Promise<Page<FileEntity>>;
|
|
557
365
|
/**
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
366
|
+
* Finds files that have expired based on their expiration date.
|
|
367
|
+
* Limited to 1000 files per call to prevent memory issues.
|
|
368
|
+
*
|
|
369
|
+
* @returns Array of expired file entities
|
|
370
|
+
*/
|
|
563
371
|
findExpiredFiles(): Promise<FileEntity[]>;
|
|
564
372
|
/**
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
373
|
+
* Calculates an expiration date based on a TTL (time to live) duration.
|
|
374
|
+
*
|
|
375
|
+
* @param ttl - Duration like "1 day", "2 hours", etc.
|
|
376
|
+
* @returns DateTime representation of the expiration date, or undefined if no TTL provided
|
|
377
|
+
* @protected
|
|
378
|
+
*/
|
|
571
379
|
protected getExpirationDate(ttl?: DurationLike): string | undefined;
|
|
572
380
|
/**
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
381
|
+
* Uploads a file to a bucket and creates a database record with metadata.
|
|
382
|
+
* Automatically calculates and stores the file checksum (SHA-256).
|
|
383
|
+
*
|
|
384
|
+
* @param file - The file to upload
|
|
385
|
+
* @param options - Upload options including bucket, expiration, user, and tags
|
|
386
|
+
* @param options.bucket - Target bucket name (defaults to "default")
|
|
387
|
+
* @param options.expirationDate - When the file should expire
|
|
388
|
+
* @param options.user - User performing the upload (for audit trail)
|
|
389
|
+
* @param options.tags - Tags to associate with the file
|
|
390
|
+
* @returns The created file entity with all metadata
|
|
391
|
+
* @throws {NotFoundError} If the specified bucket doesn't exist
|
|
392
|
+
*/
|
|
585
393
|
uploadFile(file: FileLike, options?: {
|
|
586
394
|
expirationDate?: string | DateTime;
|
|
587
395
|
bucket?: string;
|
|
@@ -589,63 +397,63 @@ declare class FileService {
|
|
|
589
397
|
tags?: string[];
|
|
590
398
|
}): Promise<FileEntity>;
|
|
591
399
|
/**
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
400
|
+
* Streams a file from storage by its database ID.
|
|
401
|
+
*
|
|
402
|
+
* @param id - The database ID (UUID) of the file to stream
|
|
403
|
+
* @returns The file object ready for streaming/downloading
|
|
404
|
+
* @throws {NotFoundError} If the file doesn't exist in the database
|
|
405
|
+
* @throws {FileNotFoundError} If the file exists in database but not in storage
|
|
406
|
+
*/
|
|
599
407
|
streamFile(id: string): Promise<FileLike>;
|
|
600
408
|
/**
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
409
|
+
* Updates file metadata (name, tags, expiration date).
|
|
410
|
+
* Does not modify the actual file content in storage.
|
|
411
|
+
*
|
|
412
|
+
* @param id - The database ID (UUID) of the file to update
|
|
413
|
+
* @param data - Partial file data to update
|
|
414
|
+
* @param data.name - New file name
|
|
415
|
+
* @param data.tags - New tags array
|
|
416
|
+
* @param data.expirationDate - New expiration date
|
|
417
|
+
* @returns The updated file entity
|
|
418
|
+
* @throws {NotFoundError} If the file doesn't exist in the database
|
|
419
|
+
*/
|
|
612
420
|
updateFile(id: string, data: {
|
|
613
421
|
name?: string;
|
|
614
422
|
tags?: string[];
|
|
615
423
|
expirationDate?: DateTime | string;
|
|
616
424
|
}): Promise<FileEntity>;
|
|
617
425
|
/**
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
426
|
+
* Deletes a file from both storage and database.
|
|
427
|
+
* Handles cases where file is already deleted from storage gracefully.
|
|
428
|
+
* Always ensures database record is removed even if storage deletion fails.
|
|
429
|
+
*
|
|
430
|
+
* @param id - The database ID (UUID) of the file to delete
|
|
431
|
+
* @returns Success response with the deleted file ID
|
|
432
|
+
* @throws {NotFoundError} If the file doesn't exist in the database
|
|
433
|
+
*/
|
|
626
434
|
deleteFile(id: string): Promise<Ok>;
|
|
627
435
|
/**
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
436
|
+
* Retrieves a file entity by its ID.
|
|
437
|
+
* If already an entity object, returns it as-is (convenience method).
|
|
438
|
+
*
|
|
439
|
+
* @param id - Either a UUID string or an existing FileEntity object
|
|
440
|
+
* @returns The file entity
|
|
441
|
+
* @throws {NotFoundError} If the file doesn't exist in the database
|
|
442
|
+
*/
|
|
635
443
|
getFileById(id: string | FileEntity): Promise<FileEntity>;
|
|
636
444
|
/**
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
445
|
+
* Gets storage statistics including total size, file count, and breakdowns by bucket and MIME type.
|
|
446
|
+
*
|
|
447
|
+
* @returns Storage statistics with aggregated data
|
|
448
|
+
*/
|
|
641
449
|
getStorageStats(): Promise<StorageStats>;
|
|
642
450
|
/**
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
451
|
+
* Converts a file entity to a file resource (API response format).
|
|
452
|
+
* Currently a pass-through, but allows for future transformation logic.
|
|
453
|
+
*
|
|
454
|
+
* @param entity - The file entity to convert
|
|
455
|
+
* @returns The file resource for API responses
|
|
456
|
+
*/
|
|
649
457
|
entityToResource(entity: FileEntity): FileResource;
|
|
650
458
|
}
|
|
651
459
|
//#endregion
|
|
@@ -659,10 +467,10 @@ declare class AdminFileStatsController {
|
|
|
659
467
|
protected readonly group = "admin:files";
|
|
660
468
|
protected readonly fileService: FileService;
|
|
661
469
|
/**
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
470
|
+
* GET /files/stats - Gets storage statistics.
|
|
471
|
+
* Returns aggregated data including total size, file count,
|
|
472
|
+
* and breakdowns by bucket and MIME type.
|
|
473
|
+
*/
|
|
666
474
|
readonly getStats: alepha_server0.ActionPrimitiveFn<{
|
|
667
475
|
response: alepha160.TObject<{
|
|
668
476
|
totalSize: alepha160.TNumber;
|
|
@@ -690,9 +498,9 @@ declare class FileController {
|
|
|
690
498
|
protected readonly group = "files";
|
|
691
499
|
protected readonly fileService: FileService;
|
|
692
500
|
/**
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
501
|
+
* GET /files - Lists files with optional filtering and pagination.
|
|
502
|
+
* Supports filtering by bucket and tags.
|
|
503
|
+
*/
|
|
696
504
|
readonly findFiles: alepha_server0.ActionPrimitiveFn<{
|
|
697
505
|
query: alepha160.TObject<{
|
|
698
506
|
page: alepha160.TOptional<alepha160.TInteger>;
|
|
@@ -725,9 +533,9 @@ declare class FileController {
|
|
|
725
533
|
}>>;
|
|
726
534
|
}>;
|
|
727
535
|
/**
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
536
|
+
* DELETE /files/:id - Deletes a file from both storage and database.
|
|
537
|
+
* Removes the file from the bucket and cleans up the database record.
|
|
538
|
+
*/
|
|
731
539
|
readonly deleteFile: alepha_server0.ActionPrimitiveFn<{
|
|
732
540
|
params: alepha160.TObject<{
|
|
733
541
|
id: alepha160.TString;
|
|
@@ -739,10 +547,10 @@ declare class FileController {
|
|
|
739
547
|
}>;
|
|
740
548
|
}>;
|
|
741
549
|
/**
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
550
|
+
* POST /files - Uploads a new file to storage.
|
|
551
|
+
* Creates a database record with metadata and calculates checksum.
|
|
552
|
+
* Optionally specify bucket and expiration date.
|
|
553
|
+
*/
|
|
746
554
|
readonly uploadFile: alepha_server0.ActionPrimitiveFn<{
|
|
747
555
|
body: alepha160.TObject<{
|
|
748
556
|
file: alepha160.TFile;
|
|
@@ -770,9 +578,9 @@ declare class FileController {
|
|
|
770
578
|
}>;
|
|
771
579
|
}>;
|
|
772
580
|
/**
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
581
|
+
* PATCH /files/:id - Updates file metadata.
|
|
582
|
+
* Allows updating name, tags, and expiration date without modifying file content.
|
|
583
|
+
*/
|
|
776
584
|
readonly updateFile: alepha_server0.ActionPrimitiveFn<{
|
|
777
585
|
params: alepha160.TObject<{
|
|
778
586
|
id: alepha160.TString;
|
|
@@ -801,10 +609,10 @@ declare class FileController {
|
|
|
801
609
|
}>;
|
|
802
610
|
}>;
|
|
803
611
|
/**
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
612
|
+
* GET /files/:id - Streams/downloads a file by its ID.
|
|
613
|
+
* Returns the file content with appropriate Content-Type header.
|
|
614
|
+
* Cached with ETag support for 1 year (immutable).
|
|
615
|
+
*/
|
|
808
616
|
readonly streamFile: alepha_server0.ActionPrimitiveFn<{
|
|
809
617
|
params: alepha160.TObject<{
|
|
810
618
|
id: alepha160.TString;
|
|
@@ -823,22 +631,22 @@ declare class FileJobs {
|
|
|
823
631
|
declare module "alepha/bucket" {
|
|
824
632
|
interface BucketFileOptions {
|
|
825
633
|
/**
|
|
826
|
-
|
|
827
|
-
|
|
634
|
+
* Time to live for the files in the bucket.
|
|
635
|
+
*/
|
|
828
636
|
ttl?: DurationLike;
|
|
829
637
|
/**
|
|
830
|
-
|
|
831
|
-
|
|
638
|
+
* Tags for the bucket.
|
|
639
|
+
*/
|
|
832
640
|
tags?: string[];
|
|
833
641
|
/**
|
|
834
|
-
|
|
835
|
-
|
|
642
|
+
* User performing the operation.
|
|
643
|
+
*/
|
|
836
644
|
user?: UserAccountToken;
|
|
837
645
|
/**
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
646
|
+
* Whether to persist the file metadata in the database.
|
|
647
|
+
*
|
|
648
|
+
* @default true
|
|
649
|
+
*/
|
|
842
650
|
persist?: boolean;
|
|
843
651
|
}
|
|
844
652
|
}
|