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
|
@@ -3,22 +3,15 @@ import { KIND, Primitive, Static, TNull, TObject, TOptional, TSchema, TUnion } f
|
|
|
3
3
|
import * as alepha_server0 from "alepha/server";
|
|
4
4
|
import { DateTimeProvider } from "alepha/datetime";
|
|
5
5
|
import * as alepha_logger0 from "alepha/logger";
|
|
6
|
-
import * as
|
|
6
|
+
import * as alepha_orm0 from "alepha/orm";
|
|
7
7
|
import * as alepha_topic0 from "alepha/topic";
|
|
8
8
|
import * as alepha_scheduler0 from "alepha/scheduler";
|
|
9
|
-
import "bun";
|
|
10
|
-
import "bun:sqlite";
|
|
11
|
-
import "drizzle-orm/bun-sql";
|
|
12
|
-
import "drizzle-orm/bun-sqlite";
|
|
13
9
|
import "drizzle-orm/d1";
|
|
14
10
|
import { BuildExtraConfigColumns, SQL } from "drizzle-orm";
|
|
15
11
|
import { PgColumnBuilderBase, PgSequenceOptions, PgTableExtraConfigValue, UpdateDeleteAction } from "drizzle-orm/pg-core";
|
|
16
12
|
import "alepha/retry";
|
|
17
|
-
import "alepha/lock";
|
|
18
13
|
import * as typebox0 from "typebox";
|
|
19
14
|
import "drizzle-orm/sqlite-core";
|
|
20
|
-
import "drizzle-orm/postgres-js";
|
|
21
|
-
import "postgres";
|
|
22
15
|
import { UserAccount } from "alepha/security";
|
|
23
16
|
|
|
24
17
|
//#region ../../src/api/parameters/schemas/parameterStatusSchema.d.ts
|
|
@@ -38,66 +31,66 @@ type ParameterStatus = Static<typeof parameterStatusSchema>;
|
|
|
38
31
|
* - Activation scheduling
|
|
39
32
|
* - Audit trail (creator info)
|
|
40
33
|
*/
|
|
41
|
-
declare const parameters:
|
|
42
|
-
id:
|
|
43
|
-
createdAt:
|
|
44
|
-
updatedAt:
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
34
|
+
declare const parameters: alepha_orm0.EntityPrimitive<alepha624.TObject<{
|
|
35
|
+
id: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha624.TString, typeof alepha_orm0.PG_PRIMARY_KEY>, typeof alepha_orm0.PG_DEFAULT>;
|
|
36
|
+
createdAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha624.TString, typeof alepha_orm0.PG_CREATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
|
|
37
|
+
updatedAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha624.TString, typeof alepha_orm0.PG_UPDATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
|
|
38
|
+
/**
|
|
39
|
+
* Configuration name using dot notation for tree hierarchy.
|
|
40
|
+
* Examples: "app.features", "app.pricing.tiers", "system.limits"
|
|
41
|
+
*/
|
|
49
42
|
name: alepha624.TString;
|
|
50
43
|
/**
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
* The configuration content as JSON.
|
|
45
|
+
*/
|
|
53
46
|
content: alepha624.TRecord<string, alepha624.TAny>;
|
|
54
47
|
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
* Schema version hash for detecting schema changes.
|
|
49
|
+
* Used for auto-migration when schema evolves.
|
|
50
|
+
*/
|
|
58
51
|
schemaHash: alepha624.TString;
|
|
59
52
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
status:
|
|
53
|
+
* Current status of this parameter version.
|
|
54
|
+
*/
|
|
55
|
+
status: alepha_orm0.PgAttr<alepha624.TUnsafe<"expired" | "current" | "next" | "future">, typeof alepha_orm0.PG_DEFAULT>;
|
|
63
56
|
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
* When this version should become active.
|
|
58
|
+
* Default is immediate (now).
|
|
59
|
+
*/
|
|
67
60
|
activationDate: alepha624.TString;
|
|
68
61
|
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
* When this version was deactivated (became expired).
|
|
63
|
+
* Null if still active or scheduled.
|
|
64
|
+
*/
|
|
72
65
|
expiredAt: alepha624.TOptional<alepha624.TString>;
|
|
73
66
|
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
* Version number for this configuration.
|
|
68
|
+
* Auto-incremented per config name.
|
|
69
|
+
*/
|
|
77
70
|
version: alepha624.TInteger;
|
|
78
71
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
* Optional description of changes in this version.
|
|
73
|
+
*/
|
|
81
74
|
changeDescription: alepha624.TOptional<alepha624.TString>;
|
|
82
75
|
/**
|
|
83
|
-
|
|
84
|
-
|
|
76
|
+
* Optional tags for filtering/categorization.
|
|
77
|
+
*/
|
|
85
78
|
tags: alepha624.TOptional<alepha624.TArray<alepha624.TString>>;
|
|
86
79
|
/**
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
* Creator user ID (if available).
|
|
81
|
+
*/
|
|
89
82
|
creatorId: alepha624.TOptional<alepha624.TString>;
|
|
90
83
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
* Creator display name for audit trail.
|
|
85
|
+
*/
|
|
93
86
|
creatorName: alepha624.TOptional<alepha624.TString>;
|
|
94
87
|
/**
|
|
95
|
-
|
|
96
|
-
|
|
88
|
+
* Previous content before this change (for rollback reference).
|
|
89
|
+
*/
|
|
97
90
|
previousContent: alepha624.TOptional<alepha624.TRecord<string, alepha624.TAny>>;
|
|
98
91
|
/**
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
* Migration log if schema changed.
|
|
93
|
+
*/
|
|
101
94
|
migrationLog: alepha624.TOptional<alepha624.TString>;
|
|
102
95
|
}>>;
|
|
103
96
|
type Parameter = Static<typeof parameters.schema>;
|
|
@@ -133,114 +126,114 @@ type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"]]:
|
|
|
133
126
|
//#region ../../src/orm/primitives/$entity.d.ts
|
|
134
127
|
interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
|
|
135
128
|
/**
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
129
|
+
* The database table name that will be created for this entity.
|
|
130
|
+
* If not provided, name will be inferred from the $repository variable name.
|
|
131
|
+
*/
|
|
139
132
|
name: string;
|
|
140
133
|
/**
|
|
141
|
-
|
|
142
|
-
|
|
134
|
+
* TypeBox schema defining the table structure and column types.
|
|
135
|
+
*/
|
|
143
136
|
schema: T;
|
|
144
137
|
/**
|
|
145
|
-
|
|
146
|
-
|
|
138
|
+
* Database indexes to create for query optimization.
|
|
139
|
+
*/
|
|
147
140
|
indexes?: (Keys | {
|
|
148
141
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
142
|
+
* Single column to index.
|
|
143
|
+
*/
|
|
151
144
|
column: Keys;
|
|
152
145
|
/**
|
|
153
|
-
|
|
154
|
-
|
|
146
|
+
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
147
|
+
*/
|
|
155
148
|
unique?: boolean;
|
|
156
149
|
/**
|
|
157
|
-
|
|
158
|
-
|
|
150
|
+
* Custom name for the index. If not provided, generates name automatically.
|
|
151
|
+
*/
|
|
159
152
|
name?: string;
|
|
160
153
|
} | {
|
|
161
154
|
/**
|
|
162
|
-
|
|
163
|
-
|
|
155
|
+
* Multiple columns for composite index (order matters for query optimization).
|
|
156
|
+
*/
|
|
164
157
|
columns: Keys[];
|
|
165
158
|
/**
|
|
166
|
-
|
|
167
|
-
|
|
159
|
+
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
160
|
+
*/
|
|
168
161
|
unique?: boolean;
|
|
169
162
|
/**
|
|
170
|
-
|
|
171
|
-
|
|
163
|
+
* Custom name for the index. If not provided, generates name automatically.
|
|
164
|
+
*/
|
|
172
165
|
name?: string;
|
|
173
166
|
})[];
|
|
174
167
|
/**
|
|
175
|
-
|
|
176
|
-
|
|
168
|
+
* Foreign key constraints to maintain referential integrity.
|
|
169
|
+
*/
|
|
177
170
|
foreignKeys?: Array<{
|
|
178
171
|
/**
|
|
179
|
-
|
|
180
|
-
|
|
172
|
+
* Optional name for the foreign key constraint.
|
|
173
|
+
*/
|
|
181
174
|
name?: string;
|
|
182
175
|
/**
|
|
183
|
-
|
|
184
|
-
|
|
176
|
+
* Local columns that reference the foreign table.
|
|
177
|
+
*/
|
|
185
178
|
columns: Array<keyof Static<T>>;
|
|
186
179
|
/**
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
180
|
+
* Referenced columns in the foreign table.
|
|
181
|
+
* Must be EntityColumn references from other entities.
|
|
182
|
+
*/
|
|
190
183
|
foreignColumns: Array<() => EntityColumn<any>>;
|
|
191
184
|
}>;
|
|
192
185
|
/**
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
186
|
+
* Additional table constraints for data validation.
|
|
187
|
+
*
|
|
188
|
+
* Constraints enforce business rules at the database level, providing
|
|
189
|
+
* an additional layer of data integrity beyond application validation.
|
|
190
|
+
*
|
|
191
|
+
* **Constraint Types**:
|
|
192
|
+
* - **Unique constraints**: Prevent duplicate values across columns
|
|
193
|
+
* - **Check constraints**: Enforce custom validation rules with SQL expressions
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```ts
|
|
197
|
+
* constraints: [
|
|
198
|
+
* {
|
|
199
|
+
* name: "unique_user_email",
|
|
200
|
+
* columns: ["email"],
|
|
201
|
+
* unique: true
|
|
202
|
+
* },
|
|
203
|
+
* {
|
|
204
|
+
* name: "valid_age_range",
|
|
205
|
+
* columns: ["age"],
|
|
206
|
+
* check: sql`age >= 0 AND age <= 150`
|
|
207
|
+
* },
|
|
208
|
+
* {
|
|
209
|
+
* name: "unique_user_username_per_tenant",
|
|
210
|
+
* columns: ["tenantId", "username"],
|
|
211
|
+
* unique: true
|
|
212
|
+
* }
|
|
213
|
+
* ]
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
223
216
|
constraints?: Array<{
|
|
224
217
|
/**
|
|
225
|
-
|
|
226
|
-
|
|
218
|
+
* Columns involved in this constraint.
|
|
219
|
+
*/
|
|
227
220
|
columns: Array<keyof Static<T>>;
|
|
228
221
|
/**
|
|
229
|
-
|
|
230
|
-
|
|
222
|
+
* Optional name for the constraint.
|
|
223
|
+
*/
|
|
231
224
|
name?: string;
|
|
232
225
|
/**
|
|
233
|
-
|
|
234
|
-
|
|
226
|
+
* Whether this is a unique constraint.
|
|
227
|
+
*/
|
|
235
228
|
unique?: boolean | {};
|
|
236
229
|
/**
|
|
237
|
-
|
|
238
|
-
|
|
230
|
+
* SQL expression for check constraint validation.
|
|
231
|
+
*/
|
|
239
232
|
check?: SQL;
|
|
240
233
|
}>;
|
|
241
234
|
/**
|
|
242
|
-
|
|
243
|
-
|
|
235
|
+
* Advanced Drizzle ORM configuration for complex table setups.
|
|
236
|
+
*/
|
|
244
237
|
config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
|
|
245
238
|
}
|
|
246
239
|
declare class EntityPrimitive<T extends TObject = TObject> {
|
|
@@ -288,8 +281,8 @@ type PgSymbols = {
|
|
|
288
281
|
[PG_REF]: PgRefOptions;
|
|
289
282
|
[PG_ENUM]: PgEnumOptions;
|
|
290
283
|
/**
|
|
291
|
-
|
|
292
|
-
|
|
284
|
+
* @deprecated Use `PG_IDENTITY` instead.
|
|
285
|
+
*/
|
|
293
286
|
[PG_SERIAL]: {};
|
|
294
287
|
};
|
|
295
288
|
type PgSymbolKeys = keyof PgSymbols;
|
|
@@ -319,190 +312,6 @@ interface PgRefOptions {
|
|
|
319
312
|
*/
|
|
320
313
|
type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
|
|
321
314
|
//#endregion
|
|
322
|
-
//#region ../../src/orm/providers/drivers/BunPostgresProvider.d.ts
|
|
323
|
-
declare module "alepha" {
|
|
324
|
-
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
325
|
-
}
|
|
326
|
-
declare const envSchema$1: alepha624.TObject<{
|
|
327
|
-
/**
|
|
328
|
-
* Main configuration for database connection.
|
|
329
|
-
* Accept a string in the format of a Postgres connection URL.
|
|
330
|
-
* Example: postgres://user:password@localhost:5432/database
|
|
331
|
-
* or
|
|
332
|
-
* Example: postgres://user:password@localhost:5432/database?sslmode=require
|
|
333
|
-
*/
|
|
334
|
-
DATABASE_URL: alepha624.TOptional<alepha624.TString>;
|
|
335
|
-
/**
|
|
336
|
-
* In addition to the DATABASE_URL, you can specify the postgres schema name.
|
|
337
|
-
*/
|
|
338
|
-
POSTGRES_SCHEMA: alepha624.TOptional<alepha624.TString>;
|
|
339
|
-
}>;
|
|
340
|
-
/**
|
|
341
|
-
* Bun PostgreSQL provider using Drizzle ORM with Bun's native SQL client.
|
|
342
|
-
*
|
|
343
|
-
* This provider uses Bun's built-in SQL class for PostgreSQL connections,
|
|
344
|
-
* which provides excellent performance on the Bun runtime.
|
|
345
|
-
*
|
|
346
|
-
* @example
|
|
347
|
-
* ```ts
|
|
348
|
-
* // Set DATABASE_URL environment variable
|
|
349
|
-
* // DATABASE_URL=postgres://user:password@localhost:5432/database
|
|
350
|
-
*
|
|
351
|
-
* // Or configure programmatically
|
|
352
|
-
* alepha.with({
|
|
353
|
-
* provide: DatabaseProvider,
|
|
354
|
-
* use: BunPostgresProvider,
|
|
355
|
-
* });
|
|
356
|
-
* ```
|
|
357
|
-
*/
|
|
358
|
-
//#endregion
|
|
359
|
-
//#region ../../src/orm/providers/drivers/BunSqliteProvider.d.ts
|
|
360
|
-
/**
|
|
361
|
-
* Configuration options for the Bun SQLite database provider.
|
|
362
|
-
*/
|
|
363
|
-
declare const bunSqliteOptions: alepha624.Atom<alepha624.TObject<{
|
|
364
|
-
path: alepha624.TOptional<alepha624.TString>;
|
|
365
|
-
}>, "alepha.postgres.bun-sqlite.options">;
|
|
366
|
-
type BunSqliteProviderOptions = Static<typeof bunSqliteOptions.schema>;
|
|
367
|
-
declare module "alepha" {
|
|
368
|
-
interface State {
|
|
369
|
-
[bunSqliteOptions.key]: BunSqliteProviderOptions;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Bun SQLite provider using Drizzle ORM with Bun's native SQLite client.
|
|
374
|
-
*
|
|
375
|
-
* This provider uses Bun's built-in `bun:sqlite` for SQLite connections,
|
|
376
|
-
* which provides excellent performance on the Bun runtime.
|
|
377
|
-
*
|
|
378
|
-
* @example
|
|
379
|
-
* ```ts
|
|
380
|
-
* // Set DATABASE_URL environment variable
|
|
381
|
-
* // DATABASE_URL=sqlite://./my-database.db
|
|
382
|
-
*
|
|
383
|
-
* // Or configure programmatically
|
|
384
|
-
* alepha.with({
|
|
385
|
-
* provide: DatabaseProvider,
|
|
386
|
-
* use: BunSqliteProvider,
|
|
387
|
-
* });
|
|
388
|
-
*
|
|
389
|
-
* // Or use options atom
|
|
390
|
-
* alepha.store.mut(bunSqliteOptions, (old) => ({
|
|
391
|
-
* ...old,
|
|
392
|
-
* path: ":memory:",
|
|
393
|
-
* }));
|
|
394
|
-
* ```
|
|
395
|
-
*/
|
|
396
|
-
//#endregion
|
|
397
|
-
//#region ../../src/orm/providers/drivers/NodePostgresProvider.d.ts
|
|
398
|
-
declare module "alepha" {
|
|
399
|
-
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
400
|
-
}
|
|
401
|
-
declare const envSchema: alepha624.TObject<{
|
|
402
|
-
/**
|
|
403
|
-
* Main configuration for database connection.
|
|
404
|
-
* Accept a string in the format of a Postgres connection URL.
|
|
405
|
-
* Example: postgres://user:password@localhost:5432/database
|
|
406
|
-
* or
|
|
407
|
-
* Example: postgres://user:password@localhost:5432/database?sslmode=require
|
|
408
|
-
*/
|
|
409
|
-
DATABASE_URL: alepha624.TOptional<alepha624.TString>;
|
|
410
|
-
/**
|
|
411
|
-
* In addition to the DATABASE_URL, you can specify the postgres schema name.
|
|
412
|
-
*
|
|
413
|
-
* It will monkey patch drizzle tables.
|
|
414
|
-
*/
|
|
415
|
-
POSTGRES_SCHEMA: alepha624.TOptional<alepha624.TString>;
|
|
416
|
-
}>;
|
|
417
|
-
//#endregion
|
|
418
|
-
//#region ../../src/orm/providers/drivers/NodeSqliteProvider.d.ts
|
|
419
|
-
/**
|
|
420
|
-
* Configuration options for the Node.js SQLite database provider.
|
|
421
|
-
*/
|
|
422
|
-
declare const nodeSqliteOptions: alepha624.Atom<alepha624.TObject<{
|
|
423
|
-
path: alepha624.TOptional<alepha624.TString>;
|
|
424
|
-
}>, "alepha.postgres.node-sqlite.options">;
|
|
425
|
-
type NodeSqliteProviderOptions = Static<typeof nodeSqliteOptions.schema>;
|
|
426
|
-
declare module "alepha" {
|
|
427
|
-
interface State {
|
|
428
|
-
[nodeSqliteOptions.key]: NodeSqliteProviderOptions;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
/**
|
|
432
|
-
* Add a fake support for SQLite in Node.js based on Postgres interfaces.
|
|
433
|
-
*
|
|
434
|
-
* This is NOT a real SQLite provider, it's a workaround to use SQLite with Drizzle ORM.
|
|
435
|
-
* This is NOT recommended for production use.
|
|
436
|
-
*/
|
|
437
|
-
//#endregion
|
|
438
|
-
//#region ../../src/orm/index.d.ts
|
|
439
|
-
declare module "alepha" {
|
|
440
|
-
interface Hooks {
|
|
441
|
-
/**
|
|
442
|
-
* Fires before creating an entity in the repository.
|
|
443
|
-
*/
|
|
444
|
-
"repository:create:before": {
|
|
445
|
-
tableName: string;
|
|
446
|
-
data: any;
|
|
447
|
-
};
|
|
448
|
-
/**
|
|
449
|
-
* Fires after creating an entity in the repository.
|
|
450
|
-
*/
|
|
451
|
-
"repository:create:after": {
|
|
452
|
-
tableName: string;
|
|
453
|
-
data: any;
|
|
454
|
-
entity: any;
|
|
455
|
-
};
|
|
456
|
-
/**
|
|
457
|
-
* Fires before updating entities in the repository.
|
|
458
|
-
*/
|
|
459
|
-
"repository:update:before": {
|
|
460
|
-
tableName: string;
|
|
461
|
-
where: any;
|
|
462
|
-
data: any;
|
|
463
|
-
};
|
|
464
|
-
/**
|
|
465
|
-
* Fires after updating entities in the repository.
|
|
466
|
-
*/
|
|
467
|
-
"repository:update:after": {
|
|
468
|
-
tableName: string;
|
|
469
|
-
where: any;
|
|
470
|
-
data: any;
|
|
471
|
-
entities: any[];
|
|
472
|
-
};
|
|
473
|
-
/**
|
|
474
|
-
* Fires before deleting entities from the repository.
|
|
475
|
-
*/
|
|
476
|
-
"repository:delete:before": {
|
|
477
|
-
tableName: string;
|
|
478
|
-
where: any;
|
|
479
|
-
};
|
|
480
|
-
/**
|
|
481
|
-
* Fires after deleting entities from the repository.
|
|
482
|
-
*/
|
|
483
|
-
"repository:delete:after": {
|
|
484
|
-
tableName: string;
|
|
485
|
-
where: any;
|
|
486
|
-
ids: Array<string | number>;
|
|
487
|
-
};
|
|
488
|
-
/**
|
|
489
|
-
* Fires before reading entities from the repository.
|
|
490
|
-
*/
|
|
491
|
-
"repository:read:before": {
|
|
492
|
-
tableName: string;
|
|
493
|
-
query: any;
|
|
494
|
-
};
|
|
495
|
-
/**
|
|
496
|
-
* Fires after reading entities from the repository.
|
|
497
|
-
*/
|
|
498
|
-
"repository:read:after": {
|
|
499
|
-
tableName: string;
|
|
500
|
-
query: any;
|
|
501
|
-
entities: any[];
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
//#endregion
|
|
506
315
|
//#region ../../src/api/parameters/primitives/$config.d.ts
|
|
507
316
|
/**
|
|
508
317
|
* Creates a versioned configuration primitive for managing application settings.
|
|
@@ -550,21 +359,21 @@ declare module "alepha" {
|
|
|
550
359
|
*/
|
|
551
360
|
interface ConfigPrimitiveOptions<T extends TObject> {
|
|
552
361
|
/**
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
362
|
+
* Configuration name using dot notation for tree hierarchy.
|
|
363
|
+
* Examples: "app.features", "app.pricing.tiers", "system.limits"
|
|
364
|
+
*/
|
|
556
365
|
name?: string;
|
|
557
366
|
/**
|
|
558
|
-
|
|
559
|
-
|
|
367
|
+
* Human-readable description of the configuration.
|
|
368
|
+
*/
|
|
560
369
|
description?: string;
|
|
561
370
|
/**
|
|
562
|
-
|
|
563
|
-
|
|
371
|
+
* TypeBox schema defining the configuration structure.
|
|
372
|
+
*/
|
|
564
373
|
schema: T;
|
|
565
374
|
/**
|
|
566
|
-
|
|
567
|
-
|
|
375
|
+
* Default value used when no configuration exists in database.
|
|
376
|
+
*/
|
|
568
377
|
default: Static<T>;
|
|
569
378
|
}
|
|
570
379
|
declare class ConfigPrimitive<T extends TObject> extends Primitive<ConfigPrimitiveOptions<T>> {
|
|
@@ -579,45 +388,45 @@ declare class ConfigPrimitive<T extends TObject> extends Primitive<ConfigPrimiti
|
|
|
579
388
|
/** Whether initial load has completed */
|
|
580
389
|
protected loaded: boolean;
|
|
581
390
|
/**
|
|
582
|
-
|
|
583
|
-
|
|
391
|
+
* Configuration name (uses property key if not specified).
|
|
392
|
+
*/
|
|
584
393
|
get name(): string;
|
|
585
394
|
/**
|
|
586
|
-
|
|
587
|
-
|
|
395
|
+
* The TypeBox schema for this configuration.
|
|
396
|
+
*/
|
|
588
397
|
get schema(): T;
|
|
589
398
|
/**
|
|
590
|
-
|
|
591
|
-
|
|
399
|
+
* Get the current configuration value.
|
|
400
|
+
*/
|
|
592
401
|
get current(): Static<T>;
|
|
593
402
|
/**
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
get<Key
|
|
403
|
+
* Get a specific field from the current configuration.
|
|
404
|
+
*/
|
|
405
|
+
get<Key extends keyof Static<T>>(key: Key): Static<T>[Key];
|
|
597
406
|
/**
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
407
|
+
* Set a new configuration value.
|
|
408
|
+
*
|
|
409
|
+
* @param value - The new configuration value
|
|
410
|
+
* @param options - Optional settings (activation date, creator info, etc.)
|
|
411
|
+
*/
|
|
603
412
|
set(value: Static<T>, options?: SetConfigOptions): Promise<void>;
|
|
604
413
|
/**
|
|
605
|
-
|
|
606
|
-
|
|
414
|
+
* Subscribe to configuration changes.
|
|
415
|
+
*/
|
|
607
416
|
sub(fn: (curr: Static<T>) => void): () => void;
|
|
608
417
|
/**
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
418
|
+
* Reload configuration from database.
|
|
419
|
+
* Called when scheduled config activates or sync message received.
|
|
420
|
+
*/
|
|
612
421
|
reload(): Promise<void>;
|
|
613
422
|
/**
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
423
|
+
* Update from sync message (called by ConfigStore).
|
|
424
|
+
* Uses skipEvents to avoid infinite loops.
|
|
425
|
+
*/
|
|
617
426
|
updateFromSync(content: unknown): Promise<void>;
|
|
618
427
|
/**
|
|
619
|
-
|
|
620
|
-
|
|
428
|
+
* Get version history for this configuration.
|
|
429
|
+
*/
|
|
621
430
|
getHistory(): Promise<{
|
|
622
431
|
expiredAt?: string | undefined;
|
|
623
432
|
changeDescription?: string | undefined;
|
|
@@ -643,10 +452,11 @@ declare class ConfigPrimitive<T extends TObject> extends Primitive<ConfigPrimiti
|
|
|
643
452
|
migrationLog: alepha624.TOptional<alepha624.TString>;
|
|
644
453
|
}, string, alepha624.TAny> | undefined;
|
|
645
454
|
migrationLog?: string | undefined;
|
|
455
|
+
name: string;
|
|
456
|
+
status: "expired" | "current" | "next" | "future";
|
|
646
457
|
id: string;
|
|
647
458
|
createdAt: string;
|
|
648
459
|
updatedAt: string;
|
|
649
|
-
name: string;
|
|
650
460
|
content: typebox0.StaticRecord<[], "Decode", {}, {
|
|
651
461
|
id: PgAttr<PgAttr<alepha624.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
652
462
|
createdAt: PgAttr<PgAttr<alepha624.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
@@ -666,29 +476,28 @@ declare class ConfigPrimitive<T extends TObject> extends Primitive<ConfigPrimiti
|
|
|
666
476
|
migrationLog: alepha624.TOptional<alepha624.TString>;
|
|
667
477
|
}, string, alepha624.TAny>;
|
|
668
478
|
schemaHash: string;
|
|
669
|
-
status: "expired" | "current" | "next" | "future";
|
|
670
479
|
activationDate: string;
|
|
671
480
|
version: number;
|
|
672
481
|
}[]>;
|
|
673
482
|
/**
|
|
674
|
-
|
|
675
|
-
|
|
483
|
+
* Rollback to a specific version.
|
|
484
|
+
*/
|
|
676
485
|
rollback(version: number, options?: SetConfigOptions): Promise<void>;
|
|
677
486
|
/**
|
|
678
|
-
|
|
679
|
-
|
|
487
|
+
* Hook to load initial value from database on start.
|
|
488
|
+
*/
|
|
680
489
|
protected readonly onStart: alepha624.HookPrimitive<"start">;
|
|
681
490
|
/**
|
|
682
|
-
|
|
683
|
-
|
|
491
|
+
* Called after primitive creation to initialize.
|
|
492
|
+
*/
|
|
684
493
|
protected onInit(): void;
|
|
685
494
|
/**
|
|
686
|
-
|
|
687
|
-
|
|
495
|
+
* Load initial value from database.
|
|
496
|
+
*/
|
|
688
497
|
protected loadInitial(): Promise<void>;
|
|
689
498
|
/**
|
|
690
|
-
|
|
691
|
-
|
|
499
|
+
* Calculate a hash of the schema for migration detection.
|
|
500
|
+
*/
|
|
692
501
|
protected calculateSchemaHash(): string;
|
|
693
502
|
}
|
|
694
503
|
declare const $config: {
|
|
@@ -697,21 +506,21 @@ declare const $config: {
|
|
|
697
506
|
};
|
|
698
507
|
interface SetConfigOptions {
|
|
699
508
|
/**
|
|
700
|
-
|
|
701
|
-
|
|
509
|
+
* User making the change (for audit trail).
|
|
510
|
+
*/
|
|
702
511
|
user?: Pick<UserAccount, "id" | "email" | "name">;
|
|
703
512
|
/**
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
513
|
+
* When this configuration should become active.
|
|
514
|
+
* Default is immediate (now).
|
|
515
|
+
*/
|
|
707
516
|
activationDate?: Date;
|
|
708
517
|
/**
|
|
709
|
-
|
|
710
|
-
|
|
518
|
+
* Description of the change.
|
|
519
|
+
*/
|
|
711
520
|
changeDescription?: string;
|
|
712
521
|
/**
|
|
713
|
-
|
|
714
|
-
|
|
522
|
+
* Tags for filtering/categorization.
|
|
523
|
+
*/
|
|
715
524
|
tags?: string[];
|
|
716
525
|
}
|
|
717
526
|
//#endregion
|
|
@@ -739,14 +548,14 @@ interface ConfigSyncPayload {
|
|
|
739
548
|
declare class ConfigStore {
|
|
740
549
|
protected readonly log: alepha_logger0.Logger;
|
|
741
550
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
742
|
-
protected readonly repo:
|
|
743
|
-
id:
|
|
744
|
-
createdAt:
|
|
745
|
-
updatedAt:
|
|
551
|
+
protected readonly repo: alepha_orm0.Repository<TObject<{
|
|
552
|
+
id: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha624.TString, typeof alepha_orm0.PG_PRIMARY_KEY>, typeof alepha_orm0.PG_DEFAULT>;
|
|
553
|
+
createdAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha624.TString, typeof alepha_orm0.PG_CREATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
|
|
554
|
+
updatedAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha624.TString, typeof alepha_orm0.PG_UPDATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
|
|
746
555
|
name: alepha624.TString;
|
|
747
556
|
content: alepha624.TRecord<string, alepha624.TAny>;
|
|
748
557
|
schemaHash: alepha624.TString;
|
|
749
|
-
status:
|
|
558
|
+
status: alepha_orm0.PgAttr<alepha624.TUnsafe<"expired" | "current" | "next" | "future">, typeof alepha_orm0.PG_DEFAULT>;
|
|
750
559
|
activationDate: alepha624.TString;
|
|
751
560
|
expiredAt: alepha624.TOptional<alepha624.TString>;
|
|
752
561
|
version: alepha624.TInteger;
|
|
@@ -772,50 +581,50 @@ declare class ConfigStore {
|
|
|
772
581
|
}>;
|
|
773
582
|
}>;
|
|
774
583
|
/**
|
|
775
|
-
|
|
776
|
-
|
|
584
|
+
* Register a config primitive with the store.
|
|
585
|
+
*/
|
|
777
586
|
register(config: ConfigPrimitive<any>): void;
|
|
778
587
|
/**
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
588
|
+
* Load the current config value from database.
|
|
589
|
+
* Returns the current or next version if no current exists.
|
|
590
|
+
*/
|
|
782
591
|
load<T extends TObject>(name: string): Promise<Static<T> | null>;
|
|
783
592
|
/**
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
593
|
+
* Save a new config version.
|
|
594
|
+
*
|
|
595
|
+
* @param name - Config name (e.g., "app.features.flags")
|
|
596
|
+
* @param content - New config content
|
|
597
|
+
* @param schemaHash - Hash of the schema for migration detection
|
|
598
|
+
* @param options - Additional options (activation date, creator info, etc.)
|
|
599
|
+
*/
|
|
791
600
|
save<T extends TObject>(name: string, content: Static<T>, schemaHash: string, options?: SaveConfigOptions): Promise<Parameter>;
|
|
792
601
|
/**
|
|
793
|
-
|
|
794
|
-
|
|
602
|
+
* Get all versions of a config.
|
|
603
|
+
*/
|
|
795
604
|
getHistory(name: string): Promise<Parameter[]>;
|
|
796
605
|
/**
|
|
797
|
-
|
|
798
|
-
|
|
606
|
+
* Get a specific version of a config.
|
|
607
|
+
*/
|
|
799
608
|
getVersion(name: string, version: number): Promise<Parameter | null>;
|
|
800
609
|
/**
|
|
801
|
-
|
|
802
|
-
|
|
610
|
+
* Rollback to a previous version by creating a new version with old content.
|
|
611
|
+
*/
|
|
803
612
|
rollback(name: string, targetVersion: number, options?: SaveConfigOptions): Promise<Parameter>;
|
|
804
613
|
/**
|
|
805
|
-
|
|
806
|
-
|
|
614
|
+
* Get all configs by status.
|
|
615
|
+
*/
|
|
807
616
|
getByStatus(status: ParameterStatus): Promise<Parameter[]>;
|
|
808
617
|
/**
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
618
|
+
* Get current config value with fallback to default from registered primitive.
|
|
619
|
+
* Returns the in-memory current value which may be the default if never saved.
|
|
620
|
+
*/
|
|
812
621
|
getCurrentValue(name: string): {
|
|
813
622
|
content: unknown;
|
|
814
623
|
isDefault: boolean;
|
|
815
624
|
} | null;
|
|
816
625
|
/**
|
|
817
|
-
|
|
818
|
-
|
|
626
|
+
* Get config info including current value with default fallback.
|
|
627
|
+
*/
|
|
819
628
|
getCurrentWithDefault(name: string): Promise<{
|
|
820
629
|
current: Parameter | null;
|
|
821
630
|
next: Parameter | null;
|
|
@@ -824,38 +633,38 @@ declare class ConfigStore {
|
|
|
824
633
|
schema: TObject | null;
|
|
825
634
|
}>;
|
|
826
635
|
/**
|
|
827
|
-
|
|
828
|
-
|
|
636
|
+
* Get all unique config names (for tree view).
|
|
637
|
+
*/
|
|
829
638
|
getConfigNames(): Promise<string[]>;
|
|
830
639
|
/**
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
640
|
+
* Build a tree structure from config names for UI.
|
|
641
|
+
* Includes both database configs and registered (but not yet saved) configs.
|
|
642
|
+
*/
|
|
834
643
|
getConfigTree(): Promise<ConfigTreeNode[]>;
|
|
835
644
|
/**
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
645
|
+
* Check and activate scheduled configs that are due.
|
|
646
|
+
* Should be called periodically (e.g., via scheduler).
|
|
647
|
+
*/
|
|
839
648
|
activateScheduledConfigs(): Promise<void>;
|
|
840
649
|
/**
|
|
841
|
-
|
|
842
|
-
|
|
650
|
+
* Transition config statuses when a new current is activated.
|
|
651
|
+
*/
|
|
843
652
|
protected transitionStatuses(name: string, now: Date): Promise<void>;
|
|
844
653
|
/**
|
|
845
|
-
|
|
846
|
-
|
|
654
|
+
* Recalculate statuses based on activation dates.
|
|
655
|
+
*/
|
|
847
656
|
protected recalculateStatuses(name: string): Promise<void>;
|
|
848
657
|
/**
|
|
849
|
-
|
|
850
|
-
|
|
658
|
+
* Publish sync event to other instances.
|
|
659
|
+
*/
|
|
851
660
|
protected publishSync(name: string, version: number, content: unknown, status: ParameterStatus): Promise<void>;
|
|
852
661
|
/**
|
|
853
|
-
|
|
854
|
-
|
|
662
|
+
* Handle incoming sync message from other instances.
|
|
663
|
+
*/
|
|
855
664
|
protected handleSyncMessage(payload: ConfigSyncPayload): Promise<void>;
|
|
856
665
|
/**
|
|
857
|
-
|
|
858
|
-
|
|
666
|
+
* Build tree structure from dot-notation names.
|
|
667
|
+
*/
|
|
859
668
|
protected buildTree(names: string[]): ConfigTreeNode[];
|
|
860
669
|
}
|
|
861
670
|
interface SaveConfigOptions {
|
|
@@ -889,9 +698,9 @@ declare class AdminConfigController {
|
|
|
889
698
|
protected readonly group = "admin:configs";
|
|
890
699
|
protected readonly store: ConfigStore;
|
|
891
700
|
/**
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
701
|
+
* Get tree structure of all configuration names.
|
|
702
|
+
* Useful for admin UI navigation.
|
|
703
|
+
*/
|
|
895
704
|
getConfigTree: alepha_server0.ActionPrimitiveFn<{
|
|
896
705
|
response: alepha624.TArray<alepha624.TObject<{
|
|
897
706
|
name: alepha624.TString;
|
|
@@ -901,16 +710,16 @@ declare class AdminConfigController {
|
|
|
901
710
|
}>>;
|
|
902
711
|
}>;
|
|
903
712
|
/**
|
|
904
|
-
|
|
905
|
-
|
|
713
|
+
* List all unique configuration names.
|
|
714
|
+
*/
|
|
906
715
|
listConfigNames: alepha_server0.ActionPrimitiveFn<{
|
|
907
716
|
response: alepha624.TObject<{
|
|
908
717
|
names: alepha624.TArray<alepha624.TString>;
|
|
909
718
|
}>;
|
|
910
719
|
}>;
|
|
911
720
|
/**
|
|
912
|
-
|
|
913
|
-
|
|
721
|
+
* Get configurations by status.
|
|
722
|
+
*/
|
|
914
723
|
getByStatus: alepha_server0.ActionPrimitiveFn<{
|
|
915
724
|
params: alepha624.TObject<{
|
|
916
725
|
status: alepha624.TUnsafe<"expired" | "current" | "next" | "future">;
|
|
@@ -937,8 +746,8 @@ declare class AdminConfigController {
|
|
|
937
746
|
}>;
|
|
938
747
|
}>;
|
|
939
748
|
/**
|
|
940
|
-
|
|
941
|
-
|
|
749
|
+
* Get version history for a specific configuration.
|
|
750
|
+
*/
|
|
942
751
|
getHistory: alepha_server0.ActionPrimitiveFn<{
|
|
943
752
|
params: alepha624.TObject<{
|
|
944
753
|
name: alepha624.TString;
|
|
@@ -965,10 +774,10 @@ declare class AdminConfigController {
|
|
|
965
774
|
}>;
|
|
966
775
|
}>;
|
|
967
776
|
/**
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
777
|
+
* Get current and next values for a configuration.
|
|
778
|
+
* Includes defaultValue and currentValue from the registered primitive
|
|
779
|
+
* even if no versions exist in the database yet.
|
|
780
|
+
*/
|
|
972
781
|
getCurrent: alepha_server0.ActionPrimitiveFn<{
|
|
973
782
|
params: alepha624.TObject<{
|
|
974
783
|
name: alepha624.TString;
|
|
@@ -1016,8 +825,8 @@ declare class AdminConfigController {
|
|
|
1016
825
|
}>;
|
|
1017
826
|
}>;
|
|
1018
827
|
/**
|
|
1019
|
-
|
|
1020
|
-
|
|
828
|
+
* Get a specific version of a configuration.
|
|
829
|
+
*/
|
|
1021
830
|
getVersion: alepha_server0.ActionPrimitiveFn<{
|
|
1022
831
|
params: alepha624.TObject<{
|
|
1023
832
|
name: alepha624.TString;
|
|
@@ -1045,8 +854,8 @@ declare class AdminConfigController {
|
|
|
1045
854
|
}>;
|
|
1046
855
|
}>;
|
|
1047
856
|
/**
|
|
1048
|
-
|
|
1049
|
-
|
|
857
|
+
* Create a new configuration version.
|
|
858
|
+
*/
|
|
1050
859
|
createVersion: alepha_server0.ActionPrimitiveFn<{
|
|
1051
860
|
params: alepha624.TObject<{
|
|
1052
861
|
name: alepha624.TString;
|
|
@@ -1080,8 +889,8 @@ declare class AdminConfigController {
|
|
|
1080
889
|
}>;
|
|
1081
890
|
}>;
|
|
1082
891
|
/**
|
|
1083
|
-
|
|
1084
|
-
|
|
892
|
+
* Rollback to a previous version.
|
|
893
|
+
*/
|
|
1085
894
|
rollback: alepha_server0.ActionPrimitiveFn<{
|
|
1086
895
|
params: alepha624.TObject<{
|
|
1087
896
|
name: alepha624.TString;
|
|
@@ -1112,8 +921,8 @@ declare class AdminConfigController {
|
|
|
1112
921
|
}>;
|
|
1113
922
|
}>;
|
|
1114
923
|
/**
|
|
1115
|
-
|
|
1116
|
-
|
|
924
|
+
* Activate a scheduled version immediately.
|
|
925
|
+
*/
|
|
1117
926
|
activateNow: alepha_server0.ActionPrimitiveFn<{
|
|
1118
927
|
params: alepha624.TObject<{
|
|
1119
928
|
name: alepha624.TString;
|
|
@@ -1143,9 +952,9 @@ declare class AdminConfigController {
|
|
|
1143
952
|
}>;
|
|
1144
953
|
}>;
|
|
1145
954
|
/**
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
955
|
+
* Trigger activation check for all scheduled configs.
|
|
956
|
+
* Normally called by a scheduler, but exposed for manual triggering.
|
|
957
|
+
*/
|
|
1149
958
|
checkScheduled: alepha_server0.ActionPrimitiveFn<{
|
|
1150
959
|
response: alepha624.TObject<{
|
|
1151
960
|
message: alepha624.TString;
|
|
@@ -1165,8 +974,8 @@ declare class ConfigActivationScheduler {
|
|
|
1165
974
|
protected readonly log: alepha_logger0.Logger;
|
|
1166
975
|
protected readonly store: ConfigStore;
|
|
1167
976
|
/**
|
|
1168
|
-
|
|
1169
|
-
|
|
977
|
+
* Check for scheduled configurations every minute.
|
|
978
|
+
*/
|
|
1170
979
|
checkActivations: alepha_scheduler0.SchedulerPrimitive;
|
|
1171
980
|
}
|
|
1172
981
|
//#endregion
|