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
|
@@ -42,114 +42,114 @@ type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"]]:
|
|
|
42
42
|
//#region ../../src/orm/primitives/$entity.d.ts
|
|
43
43
|
interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
|
|
44
44
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
* The database table name that will be created for this entity.
|
|
46
|
+
* If not provided, name will be inferred from the $repository variable name.
|
|
47
|
+
*/
|
|
48
48
|
name: string;
|
|
49
49
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
* TypeBox schema defining the table structure and column types.
|
|
51
|
+
*/
|
|
52
52
|
schema: T;
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
* Database indexes to create for query optimization.
|
|
55
|
+
*/
|
|
56
56
|
indexes?: (Keys | {
|
|
57
57
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
* Single column to index.
|
|
59
|
+
*/
|
|
60
60
|
column: Keys;
|
|
61
61
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
63
|
+
*/
|
|
64
64
|
unique?: boolean;
|
|
65
65
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
* Custom name for the index. If not provided, generates name automatically.
|
|
67
|
+
*/
|
|
68
68
|
name?: string;
|
|
69
69
|
} | {
|
|
70
70
|
/**
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
* Multiple columns for composite index (order matters for query optimization).
|
|
72
|
+
*/
|
|
73
73
|
columns: Keys[];
|
|
74
74
|
/**
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
76
|
+
*/
|
|
77
77
|
unique?: boolean;
|
|
78
78
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
* Custom name for the index. If not provided, generates name automatically.
|
|
80
|
+
*/
|
|
81
81
|
name?: string;
|
|
82
82
|
})[];
|
|
83
83
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
* Foreign key constraints to maintain referential integrity.
|
|
85
|
+
*/
|
|
86
86
|
foreignKeys?: Array<{
|
|
87
87
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
* Optional name for the foreign key constraint.
|
|
89
|
+
*/
|
|
90
90
|
name?: string;
|
|
91
91
|
/**
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
* Local columns that reference the foreign table.
|
|
93
|
+
*/
|
|
94
94
|
columns: Array<keyof Static<T>>;
|
|
95
95
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
* Referenced columns in the foreign table.
|
|
97
|
+
* Must be EntityColumn references from other entities.
|
|
98
|
+
*/
|
|
99
99
|
foreignColumns: Array<() => EntityColumn<any>>;
|
|
100
100
|
}>;
|
|
101
101
|
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
102
|
+
* Additional table constraints for data validation.
|
|
103
|
+
*
|
|
104
|
+
* Constraints enforce business rules at the database level, providing
|
|
105
|
+
* an additional layer of data integrity beyond application validation.
|
|
106
|
+
*
|
|
107
|
+
* **Constraint Types**:
|
|
108
|
+
* - **Unique constraints**: Prevent duplicate values across columns
|
|
109
|
+
* - **Check constraints**: Enforce custom validation rules with SQL expressions
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```ts
|
|
113
|
+
* constraints: [
|
|
114
|
+
* {
|
|
115
|
+
* name: "unique_user_email",
|
|
116
|
+
* columns: ["email"],
|
|
117
|
+
* unique: true
|
|
118
|
+
* },
|
|
119
|
+
* {
|
|
120
|
+
* name: "valid_age_range",
|
|
121
|
+
* columns: ["age"],
|
|
122
|
+
* check: sql`age >= 0 AND age <= 150`
|
|
123
|
+
* },
|
|
124
|
+
* {
|
|
125
|
+
* name: "unique_user_username_per_tenant",
|
|
126
|
+
* columns: ["tenantId", "username"],
|
|
127
|
+
* unique: true
|
|
128
|
+
* }
|
|
129
|
+
* ]
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
132
|
constraints?: Array<{
|
|
133
133
|
/**
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
* Columns involved in this constraint.
|
|
135
|
+
*/
|
|
136
136
|
columns: Array<keyof Static<T>>;
|
|
137
137
|
/**
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
* Optional name for the constraint.
|
|
139
|
+
*/
|
|
140
140
|
name?: string;
|
|
141
141
|
/**
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
* Whether this is a unique constraint.
|
|
143
|
+
*/
|
|
144
144
|
unique?: boolean | {};
|
|
145
145
|
/**
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
* SQL expression for check constraint validation.
|
|
147
|
+
*/
|
|
148
148
|
check?: SQL;
|
|
149
149
|
}>;
|
|
150
150
|
/**
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
* Advanced Drizzle ORM configuration for complex table setups.
|
|
152
|
+
*/
|
|
153
153
|
config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
|
|
154
154
|
}
|
|
155
155
|
declare class EntityPrimitive<T extends TObject = TObject> {
|
|
@@ -197,8 +197,8 @@ type PgSymbols = {
|
|
|
197
197
|
[PG_REF]: PgRefOptions;
|
|
198
198
|
[PG_ENUM]: PgEnumOptions;
|
|
199
199
|
/**
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
* @deprecated Use `PG_IDENTITY` instead.
|
|
201
|
+
*/
|
|
202
202
|
[PG_SERIAL]: {};
|
|
203
203
|
};
|
|
204
204
|
type PgSymbolKeys = keyof PgSymbols;
|
|
@@ -247,207 +247,207 @@ declare const audits: alepha_orm12.EntityPrimitive<alepha381.TObject<{
|
|
|
247
247
|
id: alepha_orm12.PgAttr<alepha_orm12.PgAttr<alepha381.TString, typeof alepha_orm12.PG_PRIMARY_KEY>, typeof alepha_orm12.PG_DEFAULT>;
|
|
248
248
|
createdAt: alepha_orm12.PgAttr<alepha_orm12.PgAttr<alepha381.TString, typeof alepha_orm12.PG_CREATED_AT>, typeof alepha_orm12.PG_DEFAULT>;
|
|
249
249
|
/**
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
250
|
+
* Audit event type (e.g., "auth", "user", "payment", "system").
|
|
251
|
+
* Used for categorizing and filtering audit events.
|
|
252
|
+
*/
|
|
253
253
|
type: alepha381.TString;
|
|
254
254
|
/**
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
* Specific action performed (e.g., "login", "logout", "create", "update", "delete").
|
|
256
|
+
*/
|
|
257
257
|
action: alepha381.TString;
|
|
258
258
|
/**
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
* Severity level of the event.
|
|
260
|
+
*/
|
|
261
261
|
severity: alepha_orm12.PgAttr<alepha381.TUnsafe<"info" | "warning" | "critical">, typeof alepha_orm12.PG_DEFAULT>;
|
|
262
262
|
/**
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
* User ID who performed the action (null for system events).
|
|
264
|
+
*/
|
|
265
265
|
userId: alepha381.TOptional<alepha381.TString>;
|
|
266
266
|
/**
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
* User realm for multi-tenant support.
|
|
268
|
+
*/
|
|
269
269
|
userRealm: alepha381.TOptional<alepha381.TString>;
|
|
270
270
|
/**
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
* User email at the time of the event (denormalized for history).
|
|
272
|
+
*/
|
|
273
273
|
userEmail: alepha381.TOptional<alepha381.TString>;
|
|
274
274
|
/**
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
* Resource type affected (e.g., "user", "order", "file").
|
|
276
|
+
*/
|
|
277
277
|
resourceType: alepha381.TOptional<alepha381.TString>;
|
|
278
278
|
/**
|
|
279
|
-
|
|
280
|
-
|
|
279
|
+
* Resource ID affected.
|
|
280
|
+
*/
|
|
281
281
|
resourceId: alepha381.TOptional<alepha381.TString>;
|
|
282
282
|
/**
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
* Human-readable description of the event.
|
|
284
|
+
*/
|
|
285
285
|
description: alepha381.TOptional<alepha381.TString>;
|
|
286
286
|
/**
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
* Additional metadata/context as JSON.
|
|
288
|
+
*/
|
|
289
289
|
metadata: alepha381.TOptional<alepha381.TRecord<string, alepha381.TAny>>;
|
|
290
290
|
/**
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
* Client IP address.
|
|
292
|
+
*/
|
|
293
293
|
ipAddress: alepha381.TOptional<alepha381.TString>;
|
|
294
294
|
/**
|
|
295
|
-
|
|
296
|
-
|
|
295
|
+
* Client user agent.
|
|
296
|
+
*/
|
|
297
297
|
userAgent: alepha381.TOptional<alepha381.TString>;
|
|
298
298
|
/**
|
|
299
|
-
|
|
300
|
-
|
|
299
|
+
* Session ID if applicable.
|
|
300
|
+
*/
|
|
301
301
|
sessionId: alepha381.TOptional<alepha381.TString>;
|
|
302
302
|
/**
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
* Request ID for correlation.
|
|
304
|
+
*/
|
|
305
305
|
requestId: alepha381.TOptional<alepha381.TString>;
|
|
306
306
|
/**
|
|
307
|
-
|
|
308
|
-
|
|
307
|
+
* Whether the action was successful.
|
|
308
|
+
*/
|
|
309
309
|
success: alepha_orm12.PgAttr<alepha381.TBoolean, typeof alepha_orm12.PG_DEFAULT>;
|
|
310
310
|
/**
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
* Error message if the action failed.
|
|
312
|
+
*/
|
|
313
313
|
errorMessage: alepha381.TOptional<alepha381.TString>;
|
|
314
314
|
}>>;
|
|
315
315
|
declare const auditEntitySchema: alepha381.TObject<{
|
|
316
316
|
id: alepha_orm12.PgAttr<alepha_orm12.PgAttr<alepha381.TString, typeof alepha_orm12.PG_PRIMARY_KEY>, typeof alepha_orm12.PG_DEFAULT>;
|
|
317
317
|
createdAt: alepha_orm12.PgAttr<alepha_orm12.PgAttr<alepha381.TString, typeof alepha_orm12.PG_CREATED_AT>, typeof alepha_orm12.PG_DEFAULT>;
|
|
318
318
|
/**
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
319
|
+
* Audit event type (e.g., "auth", "user", "payment", "system").
|
|
320
|
+
* Used for categorizing and filtering audit events.
|
|
321
|
+
*/
|
|
322
322
|
type: alepha381.TString;
|
|
323
323
|
/**
|
|
324
|
-
|
|
325
|
-
|
|
324
|
+
* Specific action performed (e.g., "login", "logout", "create", "update", "delete").
|
|
325
|
+
*/
|
|
326
326
|
action: alepha381.TString;
|
|
327
327
|
/**
|
|
328
|
-
|
|
329
|
-
|
|
328
|
+
* Severity level of the event.
|
|
329
|
+
*/
|
|
330
330
|
severity: alepha_orm12.PgAttr<alepha381.TUnsafe<"info" | "warning" | "critical">, typeof alepha_orm12.PG_DEFAULT>;
|
|
331
331
|
/**
|
|
332
|
-
|
|
333
|
-
|
|
332
|
+
* User ID who performed the action (null for system events).
|
|
333
|
+
*/
|
|
334
334
|
userId: alepha381.TOptional<alepha381.TString>;
|
|
335
335
|
/**
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
* User realm for multi-tenant support.
|
|
337
|
+
*/
|
|
338
338
|
userRealm: alepha381.TOptional<alepha381.TString>;
|
|
339
339
|
/**
|
|
340
|
-
|
|
341
|
-
|
|
340
|
+
* User email at the time of the event (denormalized for history).
|
|
341
|
+
*/
|
|
342
342
|
userEmail: alepha381.TOptional<alepha381.TString>;
|
|
343
343
|
/**
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
* Resource type affected (e.g., "user", "order", "file").
|
|
345
|
+
*/
|
|
346
346
|
resourceType: alepha381.TOptional<alepha381.TString>;
|
|
347
347
|
/**
|
|
348
|
-
|
|
349
|
-
|
|
348
|
+
* Resource ID affected.
|
|
349
|
+
*/
|
|
350
350
|
resourceId: alepha381.TOptional<alepha381.TString>;
|
|
351
351
|
/**
|
|
352
|
-
|
|
353
|
-
|
|
352
|
+
* Human-readable description of the event.
|
|
353
|
+
*/
|
|
354
354
|
description: alepha381.TOptional<alepha381.TString>;
|
|
355
355
|
/**
|
|
356
|
-
|
|
357
|
-
|
|
356
|
+
* Additional metadata/context as JSON.
|
|
357
|
+
*/
|
|
358
358
|
metadata: alepha381.TOptional<alepha381.TRecord<string, alepha381.TAny>>;
|
|
359
359
|
/**
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
* Client IP address.
|
|
361
|
+
*/
|
|
362
362
|
ipAddress: alepha381.TOptional<alepha381.TString>;
|
|
363
363
|
/**
|
|
364
|
-
|
|
365
|
-
|
|
364
|
+
* Client user agent.
|
|
365
|
+
*/
|
|
366
366
|
userAgent: alepha381.TOptional<alepha381.TString>;
|
|
367
367
|
/**
|
|
368
|
-
|
|
369
|
-
|
|
368
|
+
* Session ID if applicable.
|
|
369
|
+
*/
|
|
370
370
|
sessionId: alepha381.TOptional<alepha381.TString>;
|
|
371
371
|
/**
|
|
372
|
-
|
|
373
|
-
|
|
372
|
+
* Request ID for correlation.
|
|
373
|
+
*/
|
|
374
374
|
requestId: alepha381.TOptional<alepha381.TString>;
|
|
375
375
|
/**
|
|
376
|
-
|
|
377
|
-
|
|
376
|
+
* Whether the action was successful.
|
|
377
|
+
*/
|
|
378
378
|
success: alepha_orm12.PgAttr<alepha381.TBoolean, typeof alepha_orm12.PG_DEFAULT>;
|
|
379
379
|
/**
|
|
380
|
-
|
|
381
|
-
|
|
380
|
+
* Error message if the action failed.
|
|
381
|
+
*/
|
|
382
382
|
errorMessage: alepha381.TOptional<alepha381.TString>;
|
|
383
383
|
}>;
|
|
384
384
|
declare const auditEntityInsertSchema: alepha_orm12.TObjectInsert<alepha381.TObject<{
|
|
385
385
|
id: alepha_orm12.PgAttr<alepha_orm12.PgAttr<alepha381.TString, typeof alepha_orm12.PG_PRIMARY_KEY>, typeof alepha_orm12.PG_DEFAULT>;
|
|
386
386
|
createdAt: alepha_orm12.PgAttr<alepha_orm12.PgAttr<alepha381.TString, typeof alepha_orm12.PG_CREATED_AT>, typeof alepha_orm12.PG_DEFAULT>;
|
|
387
387
|
/**
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
388
|
+
* Audit event type (e.g., "auth", "user", "payment", "system").
|
|
389
|
+
* Used for categorizing and filtering audit events.
|
|
390
|
+
*/
|
|
391
391
|
type: alepha381.TString;
|
|
392
392
|
/**
|
|
393
|
-
|
|
394
|
-
|
|
393
|
+
* Specific action performed (e.g., "login", "logout", "create", "update", "delete").
|
|
394
|
+
*/
|
|
395
395
|
action: alepha381.TString;
|
|
396
396
|
/**
|
|
397
|
-
|
|
398
|
-
|
|
397
|
+
* Severity level of the event.
|
|
398
|
+
*/
|
|
399
399
|
severity: alepha_orm12.PgAttr<alepha381.TUnsafe<"info" | "warning" | "critical">, typeof alepha_orm12.PG_DEFAULT>;
|
|
400
400
|
/**
|
|
401
|
-
|
|
402
|
-
|
|
401
|
+
* User ID who performed the action (null for system events).
|
|
402
|
+
*/
|
|
403
403
|
userId: alepha381.TOptional<alepha381.TString>;
|
|
404
404
|
/**
|
|
405
|
-
|
|
406
|
-
|
|
405
|
+
* User realm for multi-tenant support.
|
|
406
|
+
*/
|
|
407
407
|
userRealm: alepha381.TOptional<alepha381.TString>;
|
|
408
408
|
/**
|
|
409
|
-
|
|
410
|
-
|
|
409
|
+
* User email at the time of the event (denormalized for history).
|
|
410
|
+
*/
|
|
411
411
|
userEmail: alepha381.TOptional<alepha381.TString>;
|
|
412
412
|
/**
|
|
413
|
-
|
|
414
|
-
|
|
413
|
+
* Resource type affected (e.g., "user", "order", "file").
|
|
414
|
+
*/
|
|
415
415
|
resourceType: alepha381.TOptional<alepha381.TString>;
|
|
416
416
|
/**
|
|
417
|
-
|
|
418
|
-
|
|
417
|
+
* Resource ID affected.
|
|
418
|
+
*/
|
|
419
419
|
resourceId: alepha381.TOptional<alepha381.TString>;
|
|
420
420
|
/**
|
|
421
|
-
|
|
422
|
-
|
|
421
|
+
* Human-readable description of the event.
|
|
422
|
+
*/
|
|
423
423
|
description: alepha381.TOptional<alepha381.TString>;
|
|
424
424
|
/**
|
|
425
|
-
|
|
426
|
-
|
|
425
|
+
* Additional metadata/context as JSON.
|
|
426
|
+
*/
|
|
427
427
|
metadata: alepha381.TOptional<alepha381.TRecord<string, alepha381.TAny>>;
|
|
428
428
|
/**
|
|
429
|
-
|
|
430
|
-
|
|
429
|
+
* Client IP address.
|
|
430
|
+
*/
|
|
431
431
|
ipAddress: alepha381.TOptional<alepha381.TString>;
|
|
432
432
|
/**
|
|
433
|
-
|
|
434
|
-
|
|
433
|
+
* Client user agent.
|
|
434
|
+
*/
|
|
435
435
|
userAgent: alepha381.TOptional<alepha381.TString>;
|
|
436
436
|
/**
|
|
437
|
-
|
|
438
|
-
|
|
437
|
+
* Session ID if applicable.
|
|
438
|
+
*/
|
|
439
439
|
sessionId: alepha381.TOptional<alepha381.TString>;
|
|
440
440
|
/**
|
|
441
|
-
|
|
442
|
-
|
|
441
|
+
* Request ID for correlation.
|
|
442
|
+
*/
|
|
443
443
|
requestId: alepha381.TOptional<alepha381.TString>;
|
|
444
444
|
/**
|
|
445
|
-
|
|
446
|
-
|
|
445
|
+
* Whether the action was successful.
|
|
446
|
+
*/
|
|
447
447
|
success: alepha_orm12.PgAttr<alepha381.TBoolean, typeof alepha_orm12.PG_DEFAULT>;
|
|
448
448
|
/**
|
|
449
|
-
|
|
450
|
-
|
|
449
|
+
* Error message if the action failed.
|
|
450
|
+
*/
|
|
451
451
|
errorMessage: alepha381.TOptional<alepha381.TString>;
|
|
452
452
|
}>>;
|
|
453
453
|
type AuditEntity = Static<typeof audits.schema>;
|
|
@@ -540,77 +540,77 @@ declare class AuditService {
|
|
|
540
540
|
errorMessage: alepha381.TOptional<alepha381.TString>;
|
|
541
541
|
}>>;
|
|
542
542
|
/**
|
|
543
|
-
|
|
544
|
-
|
|
543
|
+
* Registry of audit types and their allowed actions.
|
|
544
|
+
*/
|
|
545
545
|
protected readonly auditTypes: Map<string, AuditTypeDefinition>;
|
|
546
546
|
/**
|
|
547
|
-
|
|
548
|
-
|
|
547
|
+
* Register an audit type with its allowed actions.
|
|
548
|
+
*/
|
|
549
549
|
registerType(definition: AuditTypeDefinition): void;
|
|
550
550
|
/**
|
|
551
|
-
|
|
552
|
-
|
|
551
|
+
* Get all registered audit types.
|
|
552
|
+
*/
|
|
553
553
|
getRegisteredTypes(): AuditTypeDefinition[];
|
|
554
554
|
/**
|
|
555
|
-
|
|
556
|
-
|
|
555
|
+
* Get current request context if available.
|
|
556
|
+
*/
|
|
557
557
|
protected getRequestContext(): ServerRequest | undefined;
|
|
558
558
|
/**
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
559
|
+
* Create a new audit log entry.
|
|
560
|
+
* Automatically populates ipAddress, userAgent, and requestId from the current request context.
|
|
561
|
+
*/
|
|
562
562
|
create(data: CreateAudit): Promise<AuditEntity>;
|
|
563
563
|
/**
|
|
564
|
-
|
|
565
|
-
|
|
564
|
+
* Record an audit event (convenience method).
|
|
565
|
+
*/
|
|
566
566
|
record(type: string, action: string, options?: Omit<CreateAudit, "type" | "action">): Promise<AuditEntity>;
|
|
567
567
|
/**
|
|
568
|
-
|
|
569
|
-
|
|
568
|
+
* Record an authentication event.
|
|
569
|
+
*/
|
|
570
570
|
recordAuth(action: "login" | "logout" | "login_failed" | "token_refresh" | "mfa_setup" | "mfa_verify", options?: Omit<CreateAudit, "type" | "action">): Promise<AuditEntity>;
|
|
571
571
|
/**
|
|
572
|
-
|
|
573
|
-
|
|
572
|
+
* Record a user management event.
|
|
573
|
+
*/
|
|
574
574
|
recordUser(action: "create" | "update" | "delete" | "enable" | "disable" | "role_change", options?: Omit<CreateAudit, "type" | "action">): Promise<AuditEntity>;
|
|
575
575
|
/**
|
|
576
|
-
|
|
577
|
-
|
|
576
|
+
* Record a data access event.
|
|
577
|
+
*/
|
|
578
578
|
recordAccess(action: "view" | "export" | "download", options?: Omit<CreateAudit, "type" | "action">): Promise<AuditEntity>;
|
|
579
579
|
/**
|
|
580
|
-
|
|
581
|
-
|
|
580
|
+
* Record a security event.
|
|
581
|
+
*/
|
|
582
582
|
recordSecurity(action: "permission_denied" | "suspicious_activity" | "rate_limited" | "blocked", options?: Omit<CreateAudit, "type" | "action">): Promise<AuditEntity>;
|
|
583
583
|
/**
|
|
584
|
-
|
|
585
|
-
|
|
584
|
+
* Record a system event.
|
|
585
|
+
*/
|
|
586
586
|
recordSystem(action: "startup" | "shutdown" | "config_change" | "maintenance" | "error", options?: Omit<CreateAudit, "type" | "action">): Promise<AuditEntity>;
|
|
587
587
|
/**
|
|
588
|
-
|
|
589
|
-
|
|
588
|
+
* Find audit entries with filtering and pagination.
|
|
589
|
+
*/
|
|
590
590
|
find(query?: AuditQuery): Promise<Page<AuditEntity>>;
|
|
591
591
|
/**
|
|
592
|
-
|
|
593
|
-
|
|
592
|
+
* Get audit entry by ID.
|
|
593
|
+
*/
|
|
594
594
|
getById(id: string): Promise<AuditEntity>;
|
|
595
595
|
/**
|
|
596
|
-
|
|
597
|
-
|
|
596
|
+
* Get audit entries for a specific user.
|
|
597
|
+
*/
|
|
598
598
|
findByUser(userId: string, query?: Omit<AuditQuery, "userId">): Promise<Page<AuditEntity>>;
|
|
599
599
|
/**
|
|
600
|
-
|
|
601
|
-
|
|
600
|
+
* Get audit entries for a specific resource.
|
|
601
|
+
*/
|
|
602
602
|
findByResource(resourceType: string, resourceId: string, query?: Omit<AuditQuery, "resourceType" | "resourceId">): Promise<Page<AuditEntity>>;
|
|
603
603
|
/**
|
|
604
|
-
|
|
605
|
-
|
|
604
|
+
* Get audit statistics for a time period.
|
|
605
|
+
*/
|
|
606
606
|
getStats(options?: {
|
|
607
607
|
from?: Date;
|
|
608
608
|
to?: Date;
|
|
609
609
|
userRealm?: string;
|
|
610
610
|
}): Promise<AuditStats>;
|
|
611
611
|
/**
|
|
612
|
-
|
|
613
|
-
|
|
612
|
+
* Delete old audit entries (for retention policy).
|
|
613
|
+
*/
|
|
614
614
|
deleteOlderThan(date: Date): Promise<number>;
|
|
615
615
|
}
|
|
616
616
|
/**
|
|
@@ -639,8 +639,8 @@ declare class AdminAuditController {
|
|
|
639
639
|
protected readonly group = "admin:audits";
|
|
640
640
|
protected readonly auditService: AuditService;
|
|
641
641
|
/**
|
|
642
|
-
|
|
643
|
-
|
|
642
|
+
* Find audit entries with filtering and pagination.
|
|
643
|
+
*/
|
|
644
644
|
readonly findAudits: alepha_server0.ActionPrimitiveFn<{
|
|
645
645
|
query: alepha381.TObject<{
|
|
646
646
|
page: alepha381.TOptional<alepha381.TInteger>;
|
|
@@ -680,8 +680,8 @@ declare class AdminAuditController {
|
|
|
680
680
|
}>>;
|
|
681
681
|
}>;
|
|
682
682
|
/**
|
|
683
|
-
|
|
684
|
-
|
|
683
|
+
* Get a single audit entry by ID.
|
|
684
|
+
*/
|
|
685
685
|
readonly getAudit: alepha_server0.ActionPrimitiveFn<{
|
|
686
686
|
params: alepha381.TObject<{
|
|
687
687
|
id: alepha381.TString;
|
|
@@ -708,8 +708,8 @@ declare class AdminAuditController {
|
|
|
708
708
|
}>;
|
|
709
709
|
}>;
|
|
710
710
|
/**
|
|
711
|
-
|
|
712
|
-
|
|
711
|
+
* Create a new audit entry.
|
|
712
|
+
*/
|
|
713
713
|
readonly createAudit: alepha_server0.ActionPrimitiveFn<{
|
|
714
714
|
body: alepha381.TObject<{
|
|
715
715
|
type: alepha381.TString;
|
|
@@ -751,8 +751,8 @@ declare class AdminAuditController {
|
|
|
751
751
|
}>;
|
|
752
752
|
}>;
|
|
753
753
|
/**
|
|
754
|
-
|
|
755
|
-
|
|
754
|
+
* Get audit entries for a specific user.
|
|
755
|
+
*/
|
|
756
756
|
readonly findByUser: alepha_server0.ActionPrimitiveFn<{
|
|
757
757
|
params: alepha381.TObject<{
|
|
758
758
|
userId: alepha381.TString;
|
|
@@ -794,8 +794,8 @@ declare class AdminAuditController {
|
|
|
794
794
|
}>>;
|
|
795
795
|
}>;
|
|
796
796
|
/**
|
|
797
|
-
|
|
798
|
-
|
|
797
|
+
* Get audit entries for a specific resource.
|
|
798
|
+
*/
|
|
799
799
|
readonly findByResource: alepha_server0.ActionPrimitiveFn<{
|
|
800
800
|
params: alepha381.TObject<{
|
|
801
801
|
resourceType: alepha381.TString;
|
|
@@ -837,8 +837,8 @@ declare class AdminAuditController {
|
|
|
837
837
|
}>>;
|
|
838
838
|
}>;
|
|
839
839
|
/**
|
|
840
|
-
|
|
841
|
-
|
|
840
|
+
* Get audit statistics.
|
|
841
|
+
*/
|
|
842
842
|
readonly getStats: alepha_server0.ActionPrimitiveFn<{
|
|
843
843
|
query: alepha381.TObject<{
|
|
844
844
|
from: alepha381.TOptional<alepha381.TString>;
|
|
@@ -877,8 +877,8 @@ declare class AdminAuditController {
|
|
|
877
877
|
}>;
|
|
878
878
|
}>;
|
|
879
879
|
/**
|
|
880
|
-
|
|
881
|
-
|
|
880
|
+
* Get registered audit types.
|
|
881
|
+
*/
|
|
882
882
|
readonly getTypes: alepha_server0.ActionPrimitiveFn<{
|
|
883
883
|
response: alepha381.TArray<alepha381.TObject<{
|
|
884
884
|
type: alepha381.TString;
|
|
@@ -887,8 +887,8 @@ declare class AdminAuditController {
|
|
|
887
887
|
}>>;
|
|
888
888
|
}>;
|
|
889
889
|
/**
|
|
890
|
-
|
|
891
|
-
|
|
890
|
+
* Get distinct values for filters.
|
|
891
|
+
*/
|
|
892
892
|
readonly getFilterOptions: alepha_server0.ActionPrimitiveFn<{
|
|
893
893
|
response: alepha381.TObject<{
|
|
894
894
|
types: alepha381.TArray<alepha381.TString>;
|
|
@@ -905,16 +905,16 @@ declare class AdminAuditController {
|
|
|
905
905
|
*/
|
|
906
906
|
interface AuditPrimitiveOptions {
|
|
907
907
|
/**
|
|
908
|
-
|
|
909
|
-
|
|
908
|
+
* Unique audit type identifier (e.g., "auth", "payment", "order").
|
|
909
|
+
*/
|
|
910
910
|
type: string;
|
|
911
911
|
/**
|
|
912
|
-
|
|
913
|
-
|
|
912
|
+
* Human-readable description of this audit type.
|
|
913
|
+
*/
|
|
914
914
|
description?: string;
|
|
915
915
|
/**
|
|
916
|
-
|
|
917
|
-
|
|
916
|
+
* List of allowed actions for this audit type.
|
|
917
|
+
*/
|
|
918
918
|
actions: string[];
|
|
919
919
|
}
|
|
920
920
|
/**
|
|
@@ -946,32 +946,32 @@ interface AuditPrimitiveOptions {
|
|
|
946
946
|
declare class AuditPrimitive extends Primitive<AuditPrimitiveOptions> {
|
|
947
947
|
protected readonly auditService: AuditService;
|
|
948
948
|
/**
|
|
949
|
-
|
|
950
|
-
|
|
949
|
+
* The audit type identifier.
|
|
950
|
+
*/
|
|
951
951
|
get type(): string;
|
|
952
952
|
/**
|
|
953
|
-
|
|
954
|
-
|
|
953
|
+
* The audit type description.
|
|
954
|
+
*/
|
|
955
955
|
get description(): string | undefined;
|
|
956
956
|
/**
|
|
957
|
-
|
|
958
|
-
|
|
957
|
+
* The allowed actions for this audit type.
|
|
958
|
+
*/
|
|
959
959
|
get actions(): string[];
|
|
960
960
|
/**
|
|
961
|
-
|
|
962
|
-
|
|
961
|
+
* Log an audit event for this type.
|
|
962
|
+
*/
|
|
963
963
|
log(action: string, options?: AuditLogOptions): Promise<void>;
|
|
964
964
|
/**
|
|
965
|
-
|
|
966
|
-
|
|
965
|
+
* Log a successful audit event.
|
|
966
|
+
*/
|
|
967
967
|
logSuccess(action: string, options?: Omit<AuditLogOptions, "success">): Promise<void>;
|
|
968
968
|
/**
|
|
969
|
-
|
|
970
|
-
|
|
969
|
+
* Log a failed audit event.
|
|
970
|
+
*/
|
|
971
971
|
logFailure(action: string, errorMessage: string, options?: Omit<AuditLogOptions, "success" | "errorMessage">): Promise<void>;
|
|
972
972
|
/**
|
|
973
|
-
|
|
974
|
-
|
|
973
|
+
* Called during initialization to register this audit type.
|
|
974
|
+
*/
|
|
975
975
|
protected onInit(): void;
|
|
976
976
|
}
|
|
977
977
|
/**
|