alepha 0.15.0 → 0.15.1
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 +43 -98
- package/dist/api/audits/index.d.ts +240 -240
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/audits/index.js +2 -2
- package/dist/api/audits/index.js.map +1 -1
- package/dist/api/files/index.d.ts +185 -185
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/files/index.js +2 -2
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.d.ts +245 -245
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/notifications/index.browser.js +4 -4
- package/dist/api/notifications/index.browser.js.map +1 -1
- package/dist/api/notifications/index.d.ts +74 -74
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/notifications/index.js +4 -4
- package/dist/api/notifications/index.js.map +1 -1
- package/dist/api/parameters/index.d.ts +221 -221
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/users/index.d.ts +1632 -1631
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +26 -34
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.d.ts +132 -132
- 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/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/cache/redis/index.js +2 -2
- package/dist/cache/redis/index.js.map +1 -1
- package/dist/cli/index.d.ts +5933 -201
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +609 -169
- package/dist/cli/index.js.map +1 -1
- package/dist/command/index.d.ts +296 -296
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +19 -19
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +268 -79
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +768 -694
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +268 -79
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +268 -79
- 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/email/index.d.ts +25 -25
- package/dist/email/index.d.ts.map +1 -1
- package/dist/fake/index.d.ts +5409 -5409
- package/dist/fake/index.d.ts.map +1 -1
- package/dist/fake/index.js +22 -22
- package/dist/fake/index.js.map +1 -1
- package/dist/file/index.d.ts +435 -435
- package/dist/file/index.d.ts.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 +24 -24
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +1 -5
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.d.ts +216 -198
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +28 -4
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/index.browser.js +9 -9
- package/dist/orm/index.browser.js.map +1 -1
- package/dist/orm/index.bun.js +83 -76
- package/dist/orm/index.bun.js.map +1 -1
- package/dist/orm/index.d.ts +961 -960
- package/dist/orm/index.d.ts.map +1 -1
- package/dist/orm/index.js +88 -81
- package/dist/orm/index.js.map +1 -1
- package/dist/queue/core/index.d.ts +244 -244
- package/dist/queue/core/index.d.ts.map +1 -1
- package/dist/queue/redis/index.d.ts.map +1 -1
- package/dist/redis/index.d.ts +105 -105
- package/dist/redis/index.d.ts.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 +108 -26
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +393 -1
- package/dist/scheduler/index.js.map +1 -1
- package/dist/security/index.d.ts +532 -209
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1422 -11
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.d.ts +1296 -271
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +1249 -18
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cache/index.d.ts +56 -56
- package/dist/server/cache/index.d.ts.map +1 -1
- package/dist/server/compress/index.d.ts +3 -3
- package/dist/server/compress/index.d.ts.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/core/index.d.ts +196 -186
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +43 -27
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/cors/index.d.ts +11 -11
- package/dist/server/cors/index.d.ts.map +1 -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 +9 -1
- package/dist/server/links/index.browser.js.map +1 -1
- package/dist/server/links/index.d.ts +83 -83
- package/dist/server/links/index.d.ts.map +1 -1
- package/dist/server/links/index.js +13 -5
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/metrics/index.d.ts +514 -1
- package/dist/server/metrics/index.d.ts.map +1 -1
- package/dist/server/metrics/index.js +4462 -4
- package/dist/server/metrics/index.js.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 -102
- 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/swagger/index.d.ts +47 -47
- package/dist/server/swagger/index.d.ts.map +1 -1
- package/dist/sms/index.d.ts +11 -11
- package/dist/sms/index.d.ts.map +1 -1
- package/dist/sms/index.js +3 -3
- package/dist/sms/index.js.map +1 -1
- package/dist/thread/index.d.ts +71 -71
- package/dist/thread/index.d.ts.map +1 -1
- package/dist/thread/index.js +2 -2
- package/dist/thread/index.js.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 +2324 -1719
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +123 -475
- package/dist/vite/index.js.map +1 -1
- package/dist/websocket/index.browser.js +3 -3
- package/dist/websocket/index.browser.js.map +1 -1
- package/dist/websocket/index.d.ts +275 -275
- package/dist/websocket/index.d.ts.map +1 -1
- package/dist/websocket/index.js +3 -3
- package/dist/websocket/index.js.map +1 -1
- package/package.json +9 -9
- package/src/api/users/services/SessionService.ts +0 -10
- package/src/cli/apps/AlephaCli.ts +2 -2
- package/src/cli/apps/AlephaPackageBuilderCli.ts +9 -1
- package/src/cli/assets/apiHelloControllerTs.ts +2 -1
- package/src/cli/assets/biomeJson.ts +2 -1
- package/src/cli/assets/claudeMd.ts +9 -4
- package/src/cli/assets/dummySpecTs.ts +2 -1
- package/src/cli/assets/editorconfig.ts +2 -1
- package/src/cli/assets/mainBrowserTs.ts +2 -1
- package/src/cli/assets/mainCss.ts +24 -0
- package/src/cli/assets/tsconfigJson.ts +2 -1
- package/src/cli/assets/webAppRouterTs.ts +2 -1
- package/src/cli/assets/webHelloComponentTsx.ts +6 -2
- package/src/cli/atoms/appEntryOptions.ts +13 -0
- package/src/cli/atoms/buildOptions.ts +1 -1
- package/src/cli/atoms/changelogOptions.ts +1 -1
- package/src/cli/commands/build.ts +63 -47
- package/src/cli/commands/dev.ts +16 -33
- package/src/cli/commands/gen/env.ts +1 -1
- package/src/cli/commands/init.ts +17 -8
- package/src/cli/commands/lint.ts +1 -1
- package/src/cli/defineConfig.ts +9 -0
- package/src/cli/index.ts +2 -1
- package/src/cli/providers/AppEntryProvider.ts +131 -0
- package/src/cli/providers/ViteBuildProvider.ts +82 -0
- package/src/cli/providers/ViteDevServerProvider.ts +350 -0
- package/src/cli/providers/ViteTemplateProvider.ts +27 -0
- package/src/cli/services/AlephaCliUtils.ts +33 -2
- package/src/cli/services/PackageManagerUtils.ts +13 -6
- package/src/cli/services/ProjectScaffolder.ts +72 -49
- package/src/core/Alepha.ts +2 -8
- package/src/core/primitives/$module.ts +12 -0
- package/src/core/providers/KeylessJsonSchemaCodec.spec.ts +257 -0
- package/src/core/providers/KeylessJsonSchemaCodec.ts +396 -14
- package/src/core/providers/SchemaValidator.spec.ts +236 -0
- package/src/logger/providers/PrettyFormatterProvider.ts +0 -9
- package/src/mcp/errors/McpError.ts +30 -0
- package/src/mcp/index.ts +3 -0
- package/src/mcp/transports/SseMcpTransport.ts +16 -6
- package/src/orm/providers/DrizzleKitProvider.ts +3 -5
- package/src/orm/services/Repository.ts +11 -0
- package/src/server/core/index.ts +1 -1
- package/src/server/core/providers/BunHttpServerProvider.ts +1 -1
- package/src/server/core/providers/NodeHttpServerProvider.spec.ts +125 -0
- package/src/server/core/providers/NodeHttpServerProvider.ts +71 -22
- package/src/server/core/providers/ServerLoggerProvider.ts +2 -2
- package/src/server/core/providers/ServerProvider.ts +9 -12
- package/src/server/links/atoms/apiLinksAtom.ts +7 -0
- package/src/server/links/index.browser.ts +2 -0
- package/src/server/links/index.ts +2 -0
- package/src/vite/index.ts +3 -2
- package/src/vite/tasks/buildClient.ts +0 -1
- package/src/vite/tasks/buildServer.ts +68 -21
- package/src/vite/tasks/copyAssets.ts +5 -4
- package/src/vite/tasks/generateSitemap.ts +64 -23
- package/src/vite/tasks/index.ts +0 -2
- package/src/vite/tasks/prerenderPages.ts +49 -24
- package/src/cli/assets/indexHtml.ts +0 -15
- package/src/cli/commands/format.ts +0 -23
- package/src/vite/helpers/boot.ts +0 -117
- package/src/vite/plugins/viteAlephaDev.ts +0 -177
- package/src/vite/tasks/devServer.ts +0 -71
- package/src/vite/tasks/runAlepha.ts +0 -270
- /package/dist/orm/{chunk-DtkW-qnP.js → chunk-DH6iiROE.js} +0 -0
|
@@ -36,61 +36,61 @@ declare const parameters: alepha_orm0.EntityPrimitive<alepha624.TObject<{
|
|
|
36
36
|
createdAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha624.TString, typeof alepha_orm0.PG_CREATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
|
|
37
37
|
updatedAt: alepha_orm0.PgAttr<alepha_orm0.PgAttr<alepha624.TString, typeof alepha_orm0.PG_UPDATED_AT>, typeof alepha_orm0.PG_DEFAULT>;
|
|
38
38
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
* Configuration name using dot notation for tree hierarchy.
|
|
40
|
+
* Examples: "app.features", "app.pricing.tiers", "system.limits"
|
|
41
|
+
*/
|
|
42
42
|
name: alepha624.TString;
|
|
43
43
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
* The configuration content as JSON.
|
|
45
|
+
*/
|
|
46
46
|
content: alepha624.TRecord<string, alepha624.TAny>;
|
|
47
47
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
* Schema version hash for detecting schema changes.
|
|
49
|
+
* Used for auto-migration when schema evolves.
|
|
50
|
+
*/
|
|
51
51
|
schemaHash: alepha624.TString;
|
|
52
52
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
* Current status of this parameter version.
|
|
54
|
+
*/
|
|
55
55
|
status: alepha_orm0.PgAttr<alepha624.TUnsafe<"expired" | "current" | "next" | "future">, typeof alepha_orm0.PG_DEFAULT>;
|
|
56
56
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
* When this version should become active.
|
|
58
|
+
* Default is immediate (now).
|
|
59
|
+
*/
|
|
60
60
|
activationDate: alepha624.TString;
|
|
61
61
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
* When this version was deactivated (became expired).
|
|
63
|
+
* Null if still active or scheduled.
|
|
64
|
+
*/
|
|
65
65
|
expiredAt: alepha624.TOptional<alepha624.TString>;
|
|
66
66
|
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
* Version number for this configuration.
|
|
68
|
+
* Auto-incremented per config name.
|
|
69
|
+
*/
|
|
70
70
|
version: alepha624.TInteger;
|
|
71
71
|
/**
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
* Optional description of changes in this version.
|
|
73
|
+
*/
|
|
74
74
|
changeDescription: alepha624.TOptional<alepha624.TString>;
|
|
75
75
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
* Optional tags for filtering/categorization.
|
|
77
|
+
*/
|
|
78
78
|
tags: alepha624.TOptional<alepha624.TArray<alepha624.TString>>;
|
|
79
79
|
/**
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
* Creator user ID (if available).
|
|
81
|
+
*/
|
|
82
82
|
creatorId: alepha624.TOptional<alepha624.TString>;
|
|
83
83
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
* Creator display name for audit trail.
|
|
85
|
+
*/
|
|
86
86
|
creatorName: alepha624.TOptional<alepha624.TString>;
|
|
87
87
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
* Previous content before this change (for rollback reference).
|
|
89
|
+
*/
|
|
90
90
|
previousContent: alepha624.TOptional<alepha624.TRecord<string, alepha624.TAny>>;
|
|
91
91
|
/**
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
* Migration log if schema changed.
|
|
93
|
+
*/
|
|
94
94
|
migrationLog: alepha624.TOptional<alepha624.TString>;
|
|
95
95
|
}>>;
|
|
96
96
|
type Parameter = Static<typeof parameters.schema>;
|
|
@@ -126,114 +126,114 @@ type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"]]:
|
|
|
126
126
|
//#region ../../src/orm/primitives/$entity.d.ts
|
|
127
127
|
interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
|
|
128
128
|
/**
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
+
*/
|
|
132
132
|
name: string;
|
|
133
133
|
/**
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
* TypeBox schema defining the table structure and column types.
|
|
135
|
+
*/
|
|
136
136
|
schema: T;
|
|
137
137
|
/**
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
* Database indexes to create for query optimization.
|
|
139
|
+
*/
|
|
140
140
|
indexes?: (Keys | {
|
|
141
141
|
/**
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
* Single column to index.
|
|
143
|
+
*/
|
|
144
144
|
column: Keys;
|
|
145
145
|
/**
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
147
|
+
*/
|
|
148
148
|
unique?: boolean;
|
|
149
149
|
/**
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
* Custom name for the index. If not provided, generates name automatically.
|
|
151
|
+
*/
|
|
152
152
|
name?: string;
|
|
153
153
|
} | {
|
|
154
154
|
/**
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
* Multiple columns for composite index (order matters for query optimization).
|
|
156
|
+
*/
|
|
157
157
|
columns: Keys[];
|
|
158
158
|
/**
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
160
|
+
*/
|
|
161
161
|
unique?: boolean;
|
|
162
162
|
/**
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
* Custom name for the index. If not provided, generates name automatically.
|
|
164
|
+
*/
|
|
165
165
|
name?: string;
|
|
166
166
|
})[];
|
|
167
167
|
/**
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
* Foreign key constraints to maintain referential integrity.
|
|
169
|
+
*/
|
|
170
170
|
foreignKeys?: Array<{
|
|
171
171
|
/**
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
* Optional name for the foreign key constraint.
|
|
173
|
+
*/
|
|
174
174
|
name?: string;
|
|
175
175
|
/**
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
* Local columns that reference the foreign table.
|
|
177
|
+
*/
|
|
178
178
|
columns: Array<keyof Static<T>>;
|
|
179
179
|
/**
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
* Referenced columns in the foreign table.
|
|
181
|
+
* Must be EntityColumn references from other entities.
|
|
182
|
+
*/
|
|
183
183
|
foreignColumns: Array<() => EntityColumn<any>>;
|
|
184
184
|
}>;
|
|
185
185
|
/**
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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
|
+
*/
|
|
216
216
|
constraints?: Array<{
|
|
217
217
|
/**
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
* Columns involved in this constraint.
|
|
219
|
+
*/
|
|
220
220
|
columns: Array<keyof Static<T>>;
|
|
221
221
|
/**
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
* Optional name for the constraint.
|
|
223
|
+
*/
|
|
224
224
|
name?: string;
|
|
225
225
|
/**
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
* Whether this is a unique constraint.
|
|
227
|
+
*/
|
|
228
228
|
unique?: boolean | {};
|
|
229
229
|
/**
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
* SQL expression for check constraint validation.
|
|
231
|
+
*/
|
|
232
232
|
check?: SQL;
|
|
233
233
|
}>;
|
|
234
234
|
/**
|
|
235
|
-
|
|
236
|
-
|
|
235
|
+
* Advanced Drizzle ORM configuration for complex table setups.
|
|
236
|
+
*/
|
|
237
237
|
config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
|
|
238
238
|
}
|
|
239
239
|
declare class EntityPrimitive<T extends TObject = TObject> {
|
|
@@ -281,8 +281,8 @@ type PgSymbols = {
|
|
|
281
281
|
[PG_REF]: PgRefOptions;
|
|
282
282
|
[PG_ENUM]: PgEnumOptions;
|
|
283
283
|
/**
|
|
284
|
-
|
|
285
|
-
|
|
284
|
+
* @deprecated Use `PG_IDENTITY` instead.
|
|
285
|
+
*/
|
|
286
286
|
[PG_SERIAL]: {};
|
|
287
287
|
};
|
|
288
288
|
type PgSymbolKeys = keyof PgSymbols;
|
|
@@ -359,21 +359,21 @@ type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]:
|
|
|
359
359
|
*/
|
|
360
360
|
interface ConfigPrimitiveOptions<T extends TObject> {
|
|
361
361
|
/**
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
362
|
+
* Configuration name using dot notation for tree hierarchy.
|
|
363
|
+
* Examples: "app.features", "app.pricing.tiers", "system.limits"
|
|
364
|
+
*/
|
|
365
365
|
name?: string;
|
|
366
366
|
/**
|
|
367
|
-
|
|
368
|
-
|
|
367
|
+
* Human-readable description of the configuration.
|
|
368
|
+
*/
|
|
369
369
|
description?: string;
|
|
370
370
|
/**
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
* TypeBox schema defining the configuration structure.
|
|
372
|
+
*/
|
|
373
373
|
schema: T;
|
|
374
374
|
/**
|
|
375
|
-
|
|
376
|
-
|
|
375
|
+
* Default value used when no configuration exists in database.
|
|
376
|
+
*/
|
|
377
377
|
default: Static<T>;
|
|
378
378
|
}
|
|
379
379
|
declare class ConfigPrimitive<T extends TObject> extends Primitive<ConfigPrimitiveOptions<T>> {
|
|
@@ -388,45 +388,45 @@ declare class ConfigPrimitive<T extends TObject> extends Primitive<ConfigPrimiti
|
|
|
388
388
|
/** Whether initial load has completed */
|
|
389
389
|
protected loaded: boolean;
|
|
390
390
|
/**
|
|
391
|
-
|
|
392
|
-
|
|
391
|
+
* Configuration name (uses property key if not specified).
|
|
392
|
+
*/
|
|
393
393
|
get name(): string;
|
|
394
394
|
/**
|
|
395
|
-
|
|
396
|
-
|
|
395
|
+
* The TypeBox schema for this configuration.
|
|
396
|
+
*/
|
|
397
397
|
get schema(): T;
|
|
398
398
|
/**
|
|
399
|
-
|
|
400
|
-
|
|
399
|
+
* Get the current configuration value.
|
|
400
|
+
*/
|
|
401
401
|
get current(): Static<T>;
|
|
402
402
|
/**
|
|
403
|
-
|
|
404
|
-
|
|
403
|
+
* Get a specific field from the current configuration.
|
|
404
|
+
*/
|
|
405
405
|
get<Key extends keyof Static<T>>(key: Key): Static<T>[Key];
|
|
406
406
|
/**
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
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
|
+
*/
|
|
412
412
|
set(value: Static<T>, options?: SetConfigOptions): Promise<void>;
|
|
413
413
|
/**
|
|
414
|
-
|
|
415
|
-
|
|
414
|
+
* Subscribe to configuration changes.
|
|
415
|
+
*/
|
|
416
416
|
sub(fn: (curr: Static<T>) => void): () => void;
|
|
417
417
|
/**
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
418
|
+
* Reload configuration from database.
|
|
419
|
+
* Called when scheduled config activates or sync message received.
|
|
420
|
+
*/
|
|
421
421
|
reload(): Promise<void>;
|
|
422
422
|
/**
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
423
|
+
* Update from sync message (called by ConfigStore).
|
|
424
|
+
* Uses skipEvents to avoid infinite loops.
|
|
425
|
+
*/
|
|
426
426
|
updateFromSync(content: unknown): Promise<void>;
|
|
427
427
|
/**
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
* Get version history for this configuration.
|
|
429
|
+
*/
|
|
430
430
|
getHistory(): Promise<{
|
|
431
431
|
expiredAt?: string | undefined;
|
|
432
432
|
changeDescription?: string | undefined;
|
|
@@ -480,24 +480,24 @@ declare class ConfigPrimitive<T extends TObject> extends Primitive<ConfigPrimiti
|
|
|
480
480
|
version: number;
|
|
481
481
|
}[]>;
|
|
482
482
|
/**
|
|
483
|
-
|
|
484
|
-
|
|
483
|
+
* Rollback to a specific version.
|
|
484
|
+
*/
|
|
485
485
|
rollback(version: number, options?: SetConfigOptions): Promise<void>;
|
|
486
486
|
/**
|
|
487
|
-
|
|
488
|
-
|
|
487
|
+
* Hook to load initial value from database on start.
|
|
488
|
+
*/
|
|
489
489
|
protected readonly onStart: alepha624.HookPrimitive<"start">;
|
|
490
490
|
/**
|
|
491
|
-
|
|
492
|
-
|
|
491
|
+
* Called after primitive creation to initialize.
|
|
492
|
+
*/
|
|
493
493
|
protected onInit(): void;
|
|
494
494
|
/**
|
|
495
|
-
|
|
496
|
-
|
|
495
|
+
* Load initial value from database.
|
|
496
|
+
*/
|
|
497
497
|
protected loadInitial(): Promise<void>;
|
|
498
498
|
/**
|
|
499
|
-
|
|
500
|
-
|
|
499
|
+
* Calculate a hash of the schema for migration detection.
|
|
500
|
+
*/
|
|
501
501
|
protected calculateSchemaHash(): string;
|
|
502
502
|
}
|
|
503
503
|
declare const $config: {
|
|
@@ -506,21 +506,21 @@ declare const $config: {
|
|
|
506
506
|
};
|
|
507
507
|
interface SetConfigOptions {
|
|
508
508
|
/**
|
|
509
|
-
|
|
510
|
-
|
|
509
|
+
* User making the change (for audit trail).
|
|
510
|
+
*/
|
|
511
511
|
user?: Pick<UserAccount, "id" | "email" | "name">;
|
|
512
512
|
/**
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
513
|
+
* When this configuration should become active.
|
|
514
|
+
* Default is immediate (now).
|
|
515
|
+
*/
|
|
516
516
|
activationDate?: Date;
|
|
517
517
|
/**
|
|
518
|
-
|
|
519
|
-
|
|
518
|
+
* Description of the change.
|
|
519
|
+
*/
|
|
520
520
|
changeDescription?: string;
|
|
521
521
|
/**
|
|
522
|
-
|
|
523
|
-
|
|
522
|
+
* Tags for filtering/categorization.
|
|
523
|
+
*/
|
|
524
524
|
tags?: string[];
|
|
525
525
|
}
|
|
526
526
|
//#endregion
|
|
@@ -581,50 +581,50 @@ declare class ConfigStore {
|
|
|
581
581
|
}>;
|
|
582
582
|
}>;
|
|
583
583
|
/**
|
|
584
|
-
|
|
585
|
-
|
|
584
|
+
* Register a config primitive with the store.
|
|
585
|
+
*/
|
|
586
586
|
register(config: ConfigPrimitive<any>): void;
|
|
587
587
|
/**
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
588
|
+
* Load the current config value from database.
|
|
589
|
+
* Returns the current or next version if no current exists.
|
|
590
|
+
*/
|
|
591
591
|
load<T extends TObject>(name: string): Promise<Static<T> | null>;
|
|
592
592
|
/**
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
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
|
+
*/
|
|
600
600
|
save<T extends TObject>(name: string, content: Static<T>, schemaHash: string, options?: SaveConfigOptions): Promise<Parameter>;
|
|
601
601
|
/**
|
|
602
|
-
|
|
603
|
-
|
|
602
|
+
* Get all versions of a config.
|
|
603
|
+
*/
|
|
604
604
|
getHistory(name: string): Promise<Parameter[]>;
|
|
605
605
|
/**
|
|
606
|
-
|
|
607
|
-
|
|
606
|
+
* Get a specific version of a config.
|
|
607
|
+
*/
|
|
608
608
|
getVersion(name: string, version: number): Promise<Parameter | null>;
|
|
609
609
|
/**
|
|
610
|
-
|
|
611
|
-
|
|
610
|
+
* Rollback to a previous version by creating a new version with old content.
|
|
611
|
+
*/
|
|
612
612
|
rollback(name: string, targetVersion: number, options?: SaveConfigOptions): Promise<Parameter>;
|
|
613
613
|
/**
|
|
614
|
-
|
|
615
|
-
|
|
614
|
+
* Get all configs by status.
|
|
615
|
+
*/
|
|
616
616
|
getByStatus(status: ParameterStatus): Promise<Parameter[]>;
|
|
617
617
|
/**
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
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
|
+
*/
|
|
621
621
|
getCurrentValue(name: string): {
|
|
622
622
|
content: unknown;
|
|
623
623
|
isDefault: boolean;
|
|
624
624
|
} | null;
|
|
625
625
|
/**
|
|
626
|
-
|
|
627
|
-
|
|
626
|
+
* Get config info including current value with default fallback.
|
|
627
|
+
*/
|
|
628
628
|
getCurrentWithDefault(name: string): Promise<{
|
|
629
629
|
current: Parameter | null;
|
|
630
630
|
next: Parameter | null;
|
|
@@ -633,38 +633,38 @@ declare class ConfigStore {
|
|
|
633
633
|
schema: TObject | null;
|
|
634
634
|
}>;
|
|
635
635
|
/**
|
|
636
|
-
|
|
637
|
-
|
|
636
|
+
* Get all unique config names (for tree view).
|
|
637
|
+
*/
|
|
638
638
|
getConfigNames(): Promise<string[]>;
|
|
639
639
|
/**
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
640
|
+
* Build a tree structure from config names for UI.
|
|
641
|
+
* Includes both database configs and registered (but not yet saved) configs.
|
|
642
|
+
*/
|
|
643
643
|
getConfigTree(): Promise<ConfigTreeNode[]>;
|
|
644
644
|
/**
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
645
|
+
* Check and activate scheduled configs that are due.
|
|
646
|
+
* Should be called periodically (e.g., via scheduler).
|
|
647
|
+
*/
|
|
648
648
|
activateScheduledConfigs(): Promise<void>;
|
|
649
649
|
/**
|
|
650
|
-
|
|
651
|
-
|
|
650
|
+
* Transition config statuses when a new current is activated.
|
|
651
|
+
*/
|
|
652
652
|
protected transitionStatuses(name: string, now: Date): Promise<void>;
|
|
653
653
|
/**
|
|
654
|
-
|
|
655
|
-
|
|
654
|
+
* Recalculate statuses based on activation dates.
|
|
655
|
+
*/
|
|
656
656
|
protected recalculateStatuses(name: string): Promise<void>;
|
|
657
657
|
/**
|
|
658
|
-
|
|
659
|
-
|
|
658
|
+
* Publish sync event to other instances.
|
|
659
|
+
*/
|
|
660
660
|
protected publishSync(name: string, version: number, content: unknown, status: ParameterStatus): Promise<void>;
|
|
661
661
|
/**
|
|
662
|
-
|
|
663
|
-
|
|
662
|
+
* Handle incoming sync message from other instances.
|
|
663
|
+
*/
|
|
664
664
|
protected handleSyncMessage(payload: ConfigSyncPayload): Promise<void>;
|
|
665
665
|
/**
|
|
666
|
-
|
|
667
|
-
|
|
666
|
+
* Build tree structure from dot-notation names.
|
|
667
|
+
*/
|
|
668
668
|
protected buildTree(names: string[]): ConfigTreeNode[];
|
|
669
669
|
}
|
|
670
670
|
interface SaveConfigOptions {
|
|
@@ -698,9 +698,9 @@ declare class AdminConfigController {
|
|
|
698
698
|
protected readonly group = "admin:configs";
|
|
699
699
|
protected readonly store: ConfigStore;
|
|
700
700
|
/**
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
701
|
+
* Get tree structure of all configuration names.
|
|
702
|
+
* Useful for admin UI navigation.
|
|
703
|
+
*/
|
|
704
704
|
getConfigTree: alepha_server0.ActionPrimitiveFn<{
|
|
705
705
|
response: alepha624.TArray<alepha624.TObject<{
|
|
706
706
|
name: alepha624.TString;
|
|
@@ -710,16 +710,16 @@ declare class AdminConfigController {
|
|
|
710
710
|
}>>;
|
|
711
711
|
}>;
|
|
712
712
|
/**
|
|
713
|
-
|
|
714
|
-
|
|
713
|
+
* List all unique configuration names.
|
|
714
|
+
*/
|
|
715
715
|
listConfigNames: alepha_server0.ActionPrimitiveFn<{
|
|
716
716
|
response: alepha624.TObject<{
|
|
717
717
|
names: alepha624.TArray<alepha624.TString>;
|
|
718
718
|
}>;
|
|
719
719
|
}>;
|
|
720
720
|
/**
|
|
721
|
-
|
|
722
|
-
|
|
721
|
+
* Get configurations by status.
|
|
722
|
+
*/
|
|
723
723
|
getByStatus: alepha_server0.ActionPrimitiveFn<{
|
|
724
724
|
params: alepha624.TObject<{
|
|
725
725
|
status: alepha624.TUnsafe<"expired" | "current" | "next" | "future">;
|
|
@@ -746,8 +746,8 @@ declare class AdminConfigController {
|
|
|
746
746
|
}>;
|
|
747
747
|
}>;
|
|
748
748
|
/**
|
|
749
|
-
|
|
750
|
-
|
|
749
|
+
* Get version history for a specific configuration.
|
|
750
|
+
*/
|
|
751
751
|
getHistory: alepha_server0.ActionPrimitiveFn<{
|
|
752
752
|
params: alepha624.TObject<{
|
|
753
753
|
name: alepha624.TString;
|
|
@@ -774,10 +774,10 @@ declare class AdminConfigController {
|
|
|
774
774
|
}>;
|
|
775
775
|
}>;
|
|
776
776
|
/**
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
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
|
+
*/
|
|
781
781
|
getCurrent: alepha_server0.ActionPrimitiveFn<{
|
|
782
782
|
params: alepha624.TObject<{
|
|
783
783
|
name: alepha624.TString;
|
|
@@ -825,8 +825,8 @@ declare class AdminConfigController {
|
|
|
825
825
|
}>;
|
|
826
826
|
}>;
|
|
827
827
|
/**
|
|
828
|
-
|
|
829
|
-
|
|
828
|
+
* Get a specific version of a configuration.
|
|
829
|
+
*/
|
|
830
830
|
getVersion: alepha_server0.ActionPrimitiveFn<{
|
|
831
831
|
params: alepha624.TObject<{
|
|
832
832
|
name: alepha624.TString;
|
|
@@ -854,8 +854,8 @@ declare class AdminConfigController {
|
|
|
854
854
|
}>;
|
|
855
855
|
}>;
|
|
856
856
|
/**
|
|
857
|
-
|
|
858
|
-
|
|
857
|
+
* Create a new configuration version.
|
|
858
|
+
*/
|
|
859
859
|
createVersion: alepha_server0.ActionPrimitiveFn<{
|
|
860
860
|
params: alepha624.TObject<{
|
|
861
861
|
name: alepha624.TString;
|
|
@@ -889,8 +889,8 @@ declare class AdminConfigController {
|
|
|
889
889
|
}>;
|
|
890
890
|
}>;
|
|
891
891
|
/**
|
|
892
|
-
|
|
893
|
-
|
|
892
|
+
* Rollback to a previous version.
|
|
893
|
+
*/
|
|
894
894
|
rollback: alepha_server0.ActionPrimitiveFn<{
|
|
895
895
|
params: alepha624.TObject<{
|
|
896
896
|
name: alepha624.TString;
|
|
@@ -921,8 +921,8 @@ declare class AdminConfigController {
|
|
|
921
921
|
}>;
|
|
922
922
|
}>;
|
|
923
923
|
/**
|
|
924
|
-
|
|
925
|
-
|
|
924
|
+
* Activate a scheduled version immediately.
|
|
925
|
+
*/
|
|
926
926
|
activateNow: alepha_server0.ActionPrimitiveFn<{
|
|
927
927
|
params: alepha624.TObject<{
|
|
928
928
|
name: alepha624.TString;
|
|
@@ -952,9 +952,9 @@ declare class AdminConfigController {
|
|
|
952
952
|
}>;
|
|
953
953
|
}>;
|
|
954
954
|
/**
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
955
|
+
* Trigger activation check for all scheduled configs.
|
|
956
|
+
* Normally called by a scheduler, but exposed for manual triggering.
|
|
957
|
+
*/
|
|
958
958
|
checkScheduled: alepha_server0.ActionPrimitiveFn<{
|
|
959
959
|
response: alepha624.TObject<{
|
|
960
960
|
message: alepha624.TString;
|
|
@@ -974,8 +974,8 @@ declare class ConfigActivationScheduler {
|
|
|
974
974
|
protected readonly log: alepha_logger0.Logger;
|
|
975
975
|
protected readonly store: ConfigStore;
|
|
976
976
|
/**
|
|
977
|
-
|
|
978
|
-
|
|
977
|
+
* Check for scheduled configurations every minute.
|
|
978
|
+
*/
|
|
979
979
|
checkActivations: alepha_scheduler0.SchedulerPrimitive;
|
|
980
980
|
}
|
|
981
981
|
//#endregion
|