@lssm/module.audit-trail 0.0.0-canary-20251217054315 → 0.0.0-canary-20251217060433

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.
@@ -0,0 +1,11 @@
1
+ import { FeatureModuleSpec } from "@lssm/lib.contracts";
2
+
3
+ //#region src/audit-trail.feature.d.ts
4
+
5
+ /**
6
+ * Audit Trail feature module that bundles audit log querying,
7
+ * export, and statistics capabilities.
8
+ */
9
+ declare const AuditTrailFeature: FeatureModuleSpec;
10
+ //#endregion
11
+ export { AuditTrailFeature };
@@ -0,0 +1,582 @@
1
+ import * as _lssm_lib_schema0 from "@lssm/lib.schema";
2
+ import * as _lssm_lib_contracts0 from "@lssm/lib.contracts";
3
+
4
+ //#region src/contracts/index.d.ts
5
+ declare const AuditLogModel: _lssm_lib_schema0.SchemaModel<{
6
+ id: {
7
+ type: _lssm_lib_schema0.FieldType<string, string>;
8
+ isOptional: false;
9
+ };
10
+ eventName: {
11
+ type: _lssm_lib_schema0.FieldType<string, string>;
12
+ isOptional: false;
13
+ };
14
+ eventVersion: {
15
+ type: _lssm_lib_schema0.FieldType<number, number>;
16
+ isOptional: false;
17
+ };
18
+ payload: {
19
+ type: _lssm_lib_schema0.FieldType<Record<string, unknown>, Record<string, unknown>>;
20
+ isOptional: false;
21
+ };
22
+ actorId: {
23
+ type: _lssm_lib_schema0.FieldType<string, string>;
24
+ isOptional: true;
25
+ };
26
+ actorType: {
27
+ type: _lssm_lib_schema0.FieldType<string, string>;
28
+ isOptional: true;
29
+ };
30
+ actorEmail: {
31
+ type: _lssm_lib_schema0.FieldType<string, string>;
32
+ isOptional: true;
33
+ };
34
+ targetId: {
35
+ type: _lssm_lib_schema0.FieldType<string, string>;
36
+ isOptional: true;
37
+ };
38
+ targetType: {
39
+ type: _lssm_lib_schema0.FieldType<string, string>;
40
+ isOptional: true;
41
+ };
42
+ orgId: {
43
+ type: _lssm_lib_schema0.FieldType<string, string>;
44
+ isOptional: true;
45
+ };
46
+ traceId: {
47
+ type: _lssm_lib_schema0.FieldType<string, string>;
48
+ isOptional: true;
49
+ };
50
+ clientIp: {
51
+ type: _lssm_lib_schema0.FieldType<string, string>;
52
+ isOptional: true;
53
+ };
54
+ occurredAt: {
55
+ type: _lssm_lib_schema0.FieldType<Date, string>;
56
+ isOptional: false;
57
+ };
58
+ recordedAt: {
59
+ type: _lssm_lib_schema0.FieldType<Date, string>;
60
+ isOptional: false;
61
+ };
62
+ }>;
63
+ declare const AuditQueryInputModel: _lssm_lib_schema0.SchemaModel<{
64
+ eventName: {
65
+ type: _lssm_lib_schema0.FieldType<string, string>;
66
+ isOptional: true;
67
+ };
68
+ actorId: {
69
+ type: _lssm_lib_schema0.FieldType<string, string>;
70
+ isOptional: true;
71
+ };
72
+ targetId: {
73
+ type: _lssm_lib_schema0.FieldType<string, string>;
74
+ isOptional: true;
75
+ };
76
+ targetType: {
77
+ type: _lssm_lib_schema0.FieldType<string, string>;
78
+ isOptional: true;
79
+ };
80
+ orgId: {
81
+ type: _lssm_lib_schema0.FieldType<string, string>;
82
+ isOptional: true;
83
+ };
84
+ traceId: {
85
+ type: _lssm_lib_schema0.FieldType<string, string>;
86
+ isOptional: true;
87
+ };
88
+ from: {
89
+ type: _lssm_lib_schema0.FieldType<Date, string>;
90
+ isOptional: true;
91
+ };
92
+ to: {
93
+ type: _lssm_lib_schema0.FieldType<Date, string>;
94
+ isOptional: true;
95
+ };
96
+ limit: {
97
+ type: _lssm_lib_schema0.FieldType<number, number>;
98
+ isOptional: true;
99
+ defaultValue: number;
100
+ };
101
+ offset: {
102
+ type: _lssm_lib_schema0.FieldType<number, number>;
103
+ isOptional: true;
104
+ defaultValue: number;
105
+ };
106
+ }>;
107
+ declare const AuditQueryOutputModel: _lssm_lib_schema0.SchemaModel<{
108
+ logs: {
109
+ type: _lssm_lib_schema0.SchemaModel<{
110
+ id: {
111
+ type: _lssm_lib_schema0.FieldType<string, string>;
112
+ isOptional: false;
113
+ };
114
+ eventName: {
115
+ type: _lssm_lib_schema0.FieldType<string, string>;
116
+ isOptional: false;
117
+ };
118
+ eventVersion: {
119
+ type: _lssm_lib_schema0.FieldType<number, number>;
120
+ isOptional: false;
121
+ };
122
+ payload: {
123
+ type: _lssm_lib_schema0.FieldType<Record<string, unknown>, Record<string, unknown>>;
124
+ isOptional: false;
125
+ };
126
+ actorId: {
127
+ type: _lssm_lib_schema0.FieldType<string, string>;
128
+ isOptional: true;
129
+ };
130
+ actorType: {
131
+ type: _lssm_lib_schema0.FieldType<string, string>;
132
+ isOptional: true;
133
+ };
134
+ actorEmail: {
135
+ type: _lssm_lib_schema0.FieldType<string, string>;
136
+ isOptional: true;
137
+ };
138
+ targetId: {
139
+ type: _lssm_lib_schema0.FieldType<string, string>;
140
+ isOptional: true;
141
+ };
142
+ targetType: {
143
+ type: _lssm_lib_schema0.FieldType<string, string>;
144
+ isOptional: true;
145
+ };
146
+ orgId: {
147
+ type: _lssm_lib_schema0.FieldType<string, string>;
148
+ isOptional: true;
149
+ };
150
+ traceId: {
151
+ type: _lssm_lib_schema0.FieldType<string, string>;
152
+ isOptional: true;
153
+ };
154
+ clientIp: {
155
+ type: _lssm_lib_schema0.FieldType<string, string>;
156
+ isOptional: true;
157
+ };
158
+ occurredAt: {
159
+ type: _lssm_lib_schema0.FieldType<Date, string>;
160
+ isOptional: false;
161
+ };
162
+ recordedAt: {
163
+ type: _lssm_lib_schema0.FieldType<Date, string>;
164
+ isOptional: false;
165
+ };
166
+ }>;
167
+ isArray: true;
168
+ isOptional: false;
169
+ };
170
+ total: {
171
+ type: _lssm_lib_schema0.FieldType<number, number>;
172
+ isOptional: false;
173
+ };
174
+ hasMore: {
175
+ type: _lssm_lib_schema0.FieldType<boolean, boolean>;
176
+ isOptional: false;
177
+ };
178
+ }>;
179
+ declare const ExportFormatEnum: _lssm_lib_schema0.EnumType<[string, string, string]>;
180
+ declare const AuditExportInputModel: _lssm_lib_schema0.SchemaModel<{
181
+ orgId: {
182
+ type: _lssm_lib_schema0.FieldType<string, string>;
183
+ isOptional: false;
184
+ };
185
+ from: {
186
+ type: _lssm_lib_schema0.FieldType<Date, string>;
187
+ isOptional: false;
188
+ };
189
+ to: {
190
+ type: _lssm_lib_schema0.FieldType<Date, string>;
191
+ isOptional: false;
192
+ };
193
+ format: {
194
+ type: _lssm_lib_schema0.EnumType<[string, string, string]>;
195
+ isOptional: true;
196
+ defaultValue: string;
197
+ };
198
+ eventNames: {
199
+ type: _lssm_lib_schema0.FieldType<string, string>;
200
+ isArray: true;
201
+ isOptional: true;
202
+ };
203
+ }>;
204
+ declare const ExportStatusEnum: _lssm_lib_schema0.EnumType<[string, string, string, string]>;
205
+ declare const AuditExportOutputModel: _lssm_lib_schema0.SchemaModel<{
206
+ exportId: {
207
+ type: _lssm_lib_schema0.FieldType<string, string>;
208
+ isOptional: false;
209
+ };
210
+ status: {
211
+ type: _lssm_lib_schema0.EnumType<[string, string, string, string]>;
212
+ isOptional: false;
213
+ };
214
+ downloadUrl: {
215
+ type: _lssm_lib_schema0.FieldType<string, string>;
216
+ isOptional: true;
217
+ };
218
+ }>;
219
+ declare const AuditStatsInputModel: _lssm_lib_schema0.SchemaModel<{
220
+ orgId: {
221
+ type: _lssm_lib_schema0.FieldType<string, string>;
222
+ isOptional: true;
223
+ };
224
+ from: {
225
+ type: _lssm_lib_schema0.FieldType<Date, string>;
226
+ isOptional: true;
227
+ };
228
+ to: {
229
+ type: _lssm_lib_schema0.FieldType<Date, string>;
230
+ isOptional: true;
231
+ };
232
+ }>;
233
+ declare const AuditStatsOutputModel: _lssm_lib_schema0.SchemaModel<{
234
+ totalLogs: {
235
+ type: _lssm_lib_schema0.FieldType<number, number>;
236
+ isOptional: false;
237
+ };
238
+ uniqueActors: {
239
+ type: _lssm_lib_schema0.FieldType<number, number>;
240
+ isOptional: false;
241
+ };
242
+ uniqueTargets: {
243
+ type: _lssm_lib_schema0.FieldType<number, number>;
244
+ isOptional: false;
245
+ };
246
+ eventCounts: {
247
+ type: _lssm_lib_schema0.FieldType<Record<string, unknown>, Record<string, unknown>>;
248
+ isOptional: false;
249
+ };
250
+ }>;
251
+ /**
252
+ * Query audit logs.
253
+ */
254
+ declare const QueryAuditLogsContract: _lssm_lib_contracts0.ContractSpec<_lssm_lib_schema0.SchemaModel<{
255
+ eventName: {
256
+ type: _lssm_lib_schema0.FieldType<string, string>;
257
+ isOptional: true;
258
+ };
259
+ actorId: {
260
+ type: _lssm_lib_schema0.FieldType<string, string>;
261
+ isOptional: true;
262
+ };
263
+ targetId: {
264
+ type: _lssm_lib_schema0.FieldType<string, string>;
265
+ isOptional: true;
266
+ };
267
+ targetType: {
268
+ type: _lssm_lib_schema0.FieldType<string, string>;
269
+ isOptional: true;
270
+ };
271
+ orgId: {
272
+ type: _lssm_lib_schema0.FieldType<string, string>;
273
+ isOptional: true;
274
+ };
275
+ traceId: {
276
+ type: _lssm_lib_schema0.FieldType<string, string>;
277
+ isOptional: true;
278
+ };
279
+ from: {
280
+ type: _lssm_lib_schema0.FieldType<Date, string>;
281
+ isOptional: true;
282
+ };
283
+ to: {
284
+ type: _lssm_lib_schema0.FieldType<Date, string>;
285
+ isOptional: true;
286
+ };
287
+ limit: {
288
+ type: _lssm_lib_schema0.FieldType<number, number>;
289
+ isOptional: true;
290
+ defaultValue: number;
291
+ };
292
+ offset: {
293
+ type: _lssm_lib_schema0.FieldType<number, number>;
294
+ isOptional: true;
295
+ defaultValue: number;
296
+ };
297
+ }>, _lssm_lib_schema0.SchemaModel<{
298
+ logs: {
299
+ type: _lssm_lib_schema0.SchemaModel<{
300
+ id: {
301
+ type: _lssm_lib_schema0.FieldType<string, string>;
302
+ isOptional: false;
303
+ };
304
+ eventName: {
305
+ type: _lssm_lib_schema0.FieldType<string, string>;
306
+ isOptional: false;
307
+ };
308
+ eventVersion: {
309
+ type: _lssm_lib_schema0.FieldType<number, number>;
310
+ isOptional: false;
311
+ };
312
+ payload: {
313
+ type: _lssm_lib_schema0.FieldType<Record<string, unknown>, Record<string, unknown>>;
314
+ isOptional: false;
315
+ };
316
+ actorId: {
317
+ type: _lssm_lib_schema0.FieldType<string, string>;
318
+ isOptional: true;
319
+ };
320
+ actorType: {
321
+ type: _lssm_lib_schema0.FieldType<string, string>;
322
+ isOptional: true;
323
+ };
324
+ actorEmail: {
325
+ type: _lssm_lib_schema0.FieldType<string, string>;
326
+ isOptional: true;
327
+ };
328
+ targetId: {
329
+ type: _lssm_lib_schema0.FieldType<string, string>;
330
+ isOptional: true;
331
+ };
332
+ targetType: {
333
+ type: _lssm_lib_schema0.FieldType<string, string>;
334
+ isOptional: true;
335
+ };
336
+ orgId: {
337
+ type: _lssm_lib_schema0.FieldType<string, string>;
338
+ isOptional: true;
339
+ };
340
+ traceId: {
341
+ type: _lssm_lib_schema0.FieldType<string, string>;
342
+ isOptional: true;
343
+ };
344
+ clientIp: {
345
+ type: _lssm_lib_schema0.FieldType<string, string>;
346
+ isOptional: true;
347
+ };
348
+ occurredAt: {
349
+ type: _lssm_lib_schema0.FieldType<Date, string>;
350
+ isOptional: false;
351
+ };
352
+ recordedAt: {
353
+ type: _lssm_lib_schema0.FieldType<Date, string>;
354
+ isOptional: false;
355
+ };
356
+ }>;
357
+ isArray: true;
358
+ isOptional: false;
359
+ };
360
+ total: {
361
+ type: _lssm_lib_schema0.FieldType<number, number>;
362
+ isOptional: false;
363
+ };
364
+ hasMore: {
365
+ type: _lssm_lib_schema0.FieldType<boolean, boolean>;
366
+ isOptional: false;
367
+ };
368
+ }>, undefined>;
369
+ /**
370
+ * Get audit log by ID.
371
+ */
372
+ declare const GetAuditLogContract: _lssm_lib_contracts0.ContractSpec<_lssm_lib_schema0.SchemaModel<{
373
+ logId: {
374
+ type: _lssm_lib_schema0.FieldType<string, string>;
375
+ isOptional: false;
376
+ };
377
+ }>, _lssm_lib_schema0.SchemaModel<{
378
+ id: {
379
+ type: _lssm_lib_schema0.FieldType<string, string>;
380
+ isOptional: false;
381
+ };
382
+ eventName: {
383
+ type: _lssm_lib_schema0.FieldType<string, string>;
384
+ isOptional: false;
385
+ };
386
+ eventVersion: {
387
+ type: _lssm_lib_schema0.FieldType<number, number>;
388
+ isOptional: false;
389
+ };
390
+ payload: {
391
+ type: _lssm_lib_schema0.FieldType<Record<string, unknown>, Record<string, unknown>>;
392
+ isOptional: false;
393
+ };
394
+ actorId: {
395
+ type: _lssm_lib_schema0.FieldType<string, string>;
396
+ isOptional: true;
397
+ };
398
+ actorType: {
399
+ type: _lssm_lib_schema0.FieldType<string, string>;
400
+ isOptional: true;
401
+ };
402
+ actorEmail: {
403
+ type: _lssm_lib_schema0.FieldType<string, string>;
404
+ isOptional: true;
405
+ };
406
+ targetId: {
407
+ type: _lssm_lib_schema0.FieldType<string, string>;
408
+ isOptional: true;
409
+ };
410
+ targetType: {
411
+ type: _lssm_lib_schema0.FieldType<string, string>;
412
+ isOptional: true;
413
+ };
414
+ orgId: {
415
+ type: _lssm_lib_schema0.FieldType<string, string>;
416
+ isOptional: true;
417
+ };
418
+ traceId: {
419
+ type: _lssm_lib_schema0.FieldType<string, string>;
420
+ isOptional: true;
421
+ };
422
+ clientIp: {
423
+ type: _lssm_lib_schema0.FieldType<string, string>;
424
+ isOptional: true;
425
+ };
426
+ occurredAt: {
427
+ type: _lssm_lib_schema0.FieldType<Date, string>;
428
+ isOptional: false;
429
+ };
430
+ recordedAt: {
431
+ type: _lssm_lib_schema0.FieldType<Date, string>;
432
+ isOptional: false;
433
+ };
434
+ }>, undefined>;
435
+ /**
436
+ * Get audit logs by trace ID.
437
+ */
438
+ declare const GetAuditTraceContract: _lssm_lib_contracts0.ContractSpec<_lssm_lib_schema0.SchemaModel<{
439
+ traceId: {
440
+ type: _lssm_lib_schema0.FieldType<string, string>;
441
+ isOptional: false;
442
+ };
443
+ }>, _lssm_lib_schema0.SchemaModel<{
444
+ logs: {
445
+ type: _lssm_lib_schema0.SchemaModel<{
446
+ id: {
447
+ type: _lssm_lib_schema0.FieldType<string, string>;
448
+ isOptional: false;
449
+ };
450
+ eventName: {
451
+ type: _lssm_lib_schema0.FieldType<string, string>;
452
+ isOptional: false;
453
+ };
454
+ eventVersion: {
455
+ type: _lssm_lib_schema0.FieldType<number, number>;
456
+ isOptional: false;
457
+ };
458
+ payload: {
459
+ type: _lssm_lib_schema0.FieldType<Record<string, unknown>, Record<string, unknown>>;
460
+ isOptional: false;
461
+ };
462
+ actorId: {
463
+ type: _lssm_lib_schema0.FieldType<string, string>;
464
+ isOptional: true;
465
+ };
466
+ actorType: {
467
+ type: _lssm_lib_schema0.FieldType<string, string>;
468
+ isOptional: true;
469
+ };
470
+ actorEmail: {
471
+ type: _lssm_lib_schema0.FieldType<string, string>;
472
+ isOptional: true;
473
+ };
474
+ targetId: {
475
+ type: _lssm_lib_schema0.FieldType<string, string>;
476
+ isOptional: true;
477
+ };
478
+ targetType: {
479
+ type: _lssm_lib_schema0.FieldType<string, string>;
480
+ isOptional: true;
481
+ };
482
+ orgId: {
483
+ type: _lssm_lib_schema0.FieldType<string, string>;
484
+ isOptional: true;
485
+ };
486
+ traceId: {
487
+ type: _lssm_lib_schema0.FieldType<string, string>;
488
+ isOptional: true;
489
+ };
490
+ clientIp: {
491
+ type: _lssm_lib_schema0.FieldType<string, string>;
492
+ isOptional: true;
493
+ };
494
+ occurredAt: {
495
+ type: _lssm_lib_schema0.FieldType<Date, string>;
496
+ isOptional: false;
497
+ };
498
+ recordedAt: {
499
+ type: _lssm_lib_schema0.FieldType<Date, string>;
500
+ isOptional: false;
501
+ };
502
+ }>;
503
+ isArray: true;
504
+ isOptional: false;
505
+ };
506
+ }>, undefined>;
507
+ /**
508
+ * Export audit logs.
509
+ */
510
+ declare const ExportAuditLogsContract: _lssm_lib_contracts0.ContractSpec<_lssm_lib_schema0.SchemaModel<{
511
+ orgId: {
512
+ type: _lssm_lib_schema0.FieldType<string, string>;
513
+ isOptional: false;
514
+ };
515
+ from: {
516
+ type: _lssm_lib_schema0.FieldType<Date, string>;
517
+ isOptional: false;
518
+ };
519
+ to: {
520
+ type: _lssm_lib_schema0.FieldType<Date, string>;
521
+ isOptional: false;
522
+ };
523
+ format: {
524
+ type: _lssm_lib_schema0.EnumType<[string, string, string]>;
525
+ isOptional: true;
526
+ defaultValue: string;
527
+ };
528
+ eventNames: {
529
+ type: _lssm_lib_schema0.FieldType<string, string>;
530
+ isArray: true;
531
+ isOptional: true;
532
+ };
533
+ }>, _lssm_lib_schema0.SchemaModel<{
534
+ exportId: {
535
+ type: _lssm_lib_schema0.FieldType<string, string>;
536
+ isOptional: false;
537
+ };
538
+ status: {
539
+ type: _lssm_lib_schema0.EnumType<[string, string, string, string]>;
540
+ isOptional: false;
541
+ };
542
+ downloadUrl: {
543
+ type: _lssm_lib_schema0.FieldType<string, string>;
544
+ isOptional: true;
545
+ };
546
+ }>, undefined>;
547
+ /**
548
+ * Get audit statistics.
549
+ */
550
+ declare const GetAuditStatsContract: _lssm_lib_contracts0.ContractSpec<_lssm_lib_schema0.SchemaModel<{
551
+ orgId: {
552
+ type: _lssm_lib_schema0.FieldType<string, string>;
553
+ isOptional: true;
554
+ };
555
+ from: {
556
+ type: _lssm_lib_schema0.FieldType<Date, string>;
557
+ isOptional: true;
558
+ };
559
+ to: {
560
+ type: _lssm_lib_schema0.FieldType<Date, string>;
561
+ isOptional: true;
562
+ };
563
+ }>, _lssm_lib_schema0.SchemaModel<{
564
+ totalLogs: {
565
+ type: _lssm_lib_schema0.FieldType<number, number>;
566
+ isOptional: false;
567
+ };
568
+ uniqueActors: {
569
+ type: _lssm_lib_schema0.FieldType<number, number>;
570
+ isOptional: false;
571
+ };
572
+ uniqueTargets: {
573
+ type: _lssm_lib_schema0.FieldType<number, number>;
574
+ isOptional: false;
575
+ };
576
+ eventCounts: {
577
+ type: _lssm_lib_schema0.FieldType<Record<string, unknown>, Record<string, unknown>>;
578
+ isOptional: false;
579
+ };
580
+ }>, undefined>;
581
+ //#endregion
582
+ export { AuditExportInputModel, AuditExportOutputModel, AuditLogModel, AuditQueryInputModel, AuditQueryOutputModel, AuditStatsInputModel, AuditStatsOutputModel, ExportAuditLogsContract, ExportFormatEnum, ExportStatusEnum, GetAuditLogContract, GetAuditStatsContract, GetAuditTraceContract, QueryAuditLogsContract };
@@ -0,0 +1,90 @@
1
+ import * as _lssm_lib_schema147 from "@lssm/lib.schema";
2
+ import { ModuleSchemaContribution } from "@lssm/lib.schema";
3
+
4
+ //#region src/entities/index.d.ts
5
+ /**
6
+ * AuditLog entity - main audit log entry.
7
+ */
8
+ declare const AuditLogEntity: _lssm_lib_schema147.EntitySpec<{
9
+ id: _lssm_lib_schema147.EntityScalarField;
10
+ eventName: _lssm_lib_schema147.EntityScalarField;
11
+ eventVersion: _lssm_lib_schema147.EntityScalarField;
12
+ payload: _lssm_lib_schema147.EntityScalarField;
13
+ actorId: _lssm_lib_schema147.EntityScalarField;
14
+ actorType: _lssm_lib_schema147.EntityScalarField;
15
+ actorEmail: _lssm_lib_schema147.EntityScalarField;
16
+ targetId: _lssm_lib_schema147.EntityScalarField;
17
+ targetType: _lssm_lib_schema147.EntityScalarField;
18
+ orgId: _lssm_lib_schema147.EntityScalarField;
19
+ tenantId: _lssm_lib_schema147.EntityScalarField;
20
+ traceId: _lssm_lib_schema147.EntityScalarField;
21
+ spanId: _lssm_lib_schema147.EntityScalarField;
22
+ requestId: _lssm_lib_schema147.EntityScalarField;
23
+ sessionId: _lssm_lib_schema147.EntityScalarField;
24
+ clientIp: _lssm_lib_schema147.EntityScalarField;
25
+ userAgent: _lssm_lib_schema147.EntityScalarField;
26
+ tags: _lssm_lib_schema147.EntityScalarField;
27
+ metadata: _lssm_lib_schema147.EntityScalarField;
28
+ occurredAt: _lssm_lib_schema147.EntityScalarField;
29
+ recordedAt: _lssm_lib_schema147.EntityScalarField;
30
+ }>;
31
+ /**
32
+ * AuditLogArchive entity - archived logs for long-term retention.
33
+ */
34
+ declare const AuditLogArchiveEntity: _lssm_lib_schema147.EntitySpec<{
35
+ id: _lssm_lib_schema147.EntityScalarField;
36
+ batchId: _lssm_lib_schema147.EntityScalarField;
37
+ logCount: _lssm_lib_schema147.EntityScalarField;
38
+ fromDate: _lssm_lib_schema147.EntityScalarField;
39
+ toDate: _lssm_lib_schema147.EntityScalarField;
40
+ storagePath: _lssm_lib_schema147.EntityScalarField;
41
+ storageType: _lssm_lib_schema147.EntityScalarField;
42
+ compressedSize: _lssm_lib_schema147.EntityScalarField;
43
+ checksum: _lssm_lib_schema147.EntityScalarField;
44
+ retainUntil: _lssm_lib_schema147.EntityScalarField;
45
+ createdAt: _lssm_lib_schema147.EntityScalarField;
46
+ }>;
47
+ /**
48
+ * All audit trail entities for schema composition.
49
+ */
50
+ declare const auditTrailEntities: (_lssm_lib_schema147.EntitySpec<{
51
+ id: _lssm_lib_schema147.EntityScalarField;
52
+ eventName: _lssm_lib_schema147.EntityScalarField;
53
+ eventVersion: _lssm_lib_schema147.EntityScalarField;
54
+ payload: _lssm_lib_schema147.EntityScalarField;
55
+ actorId: _lssm_lib_schema147.EntityScalarField;
56
+ actorType: _lssm_lib_schema147.EntityScalarField;
57
+ actorEmail: _lssm_lib_schema147.EntityScalarField;
58
+ targetId: _lssm_lib_schema147.EntityScalarField;
59
+ targetType: _lssm_lib_schema147.EntityScalarField;
60
+ orgId: _lssm_lib_schema147.EntityScalarField;
61
+ tenantId: _lssm_lib_schema147.EntityScalarField;
62
+ traceId: _lssm_lib_schema147.EntityScalarField;
63
+ spanId: _lssm_lib_schema147.EntityScalarField;
64
+ requestId: _lssm_lib_schema147.EntityScalarField;
65
+ sessionId: _lssm_lib_schema147.EntityScalarField;
66
+ clientIp: _lssm_lib_schema147.EntityScalarField;
67
+ userAgent: _lssm_lib_schema147.EntityScalarField;
68
+ tags: _lssm_lib_schema147.EntityScalarField;
69
+ metadata: _lssm_lib_schema147.EntityScalarField;
70
+ occurredAt: _lssm_lib_schema147.EntityScalarField;
71
+ recordedAt: _lssm_lib_schema147.EntityScalarField;
72
+ }> | _lssm_lib_schema147.EntitySpec<{
73
+ id: _lssm_lib_schema147.EntityScalarField;
74
+ batchId: _lssm_lib_schema147.EntityScalarField;
75
+ logCount: _lssm_lib_schema147.EntityScalarField;
76
+ fromDate: _lssm_lib_schema147.EntityScalarField;
77
+ toDate: _lssm_lib_schema147.EntityScalarField;
78
+ storagePath: _lssm_lib_schema147.EntityScalarField;
79
+ storageType: _lssm_lib_schema147.EntityScalarField;
80
+ compressedSize: _lssm_lib_schema147.EntityScalarField;
81
+ checksum: _lssm_lib_schema147.EntityScalarField;
82
+ retainUntil: _lssm_lib_schema147.EntityScalarField;
83
+ createdAt: _lssm_lib_schema147.EntityScalarField;
84
+ }>)[];
85
+ /**
86
+ * Module schema contribution for audit trail.
87
+ */
88
+ declare const auditTrailSchemaContribution: ModuleSchemaContribution;
89
+ //#endregion
90
+ export { AuditLogArchiveEntity, AuditLogEntity, auditTrailEntities, auditTrailSchemaContribution };
@@ -0,0 +1,6 @@
1
+ import { AuditTrailFeature } from "./audit-trail.feature.js";
2
+ import { AuditExportInputModel, AuditExportOutputModel, AuditLogModel, AuditQueryInputModel, AuditQueryOutputModel, AuditStatsInputModel, AuditStatsOutputModel, ExportAuditLogsContract, ExportFormatEnum, ExportStatusEnum, GetAuditLogContract, GetAuditStatsContract, GetAuditTraceContract, QueryAuditLogsContract } from "./contracts/index.js";
3
+ import { AuditLogArchiveEntity, AuditLogEntity, auditTrailEntities, auditTrailSchemaContribution } from "./entities/index.js";
4
+ import { AuditStorageAdapter, ExtendedAuditQueryOptions, InMemoryAuditStorage, RetentionPolicy, RetentionPolicyConfig, createInMemoryAuditStorage } from "./storage/index.js";
5
+ import { AuditQueryOptions, AuditRecord, AuditStorage } from "@lssm/lib.bus";
6
+ export { AuditExportInputModel, AuditExportOutputModel, AuditLogArchiveEntity, AuditLogEntity, AuditLogModel, AuditQueryInputModel, type AuditQueryOptions, AuditQueryOutputModel, type AuditRecord, AuditStatsInputModel, AuditStatsOutputModel, type AuditStorage, AuditStorageAdapter, AuditTrailFeature, ExportAuditLogsContract, ExportFormatEnum, ExportStatusEnum, ExtendedAuditQueryOptions, GetAuditLogContract, GetAuditStatsContract, GetAuditTraceContract, InMemoryAuditStorage, QueryAuditLogsContract, RetentionPolicy, RetentionPolicyConfig, auditTrailEntities, auditTrailSchemaContribution, createInMemoryAuditStorage };
@@ -0,0 +1,87 @@
1
+ import { AuditQueryOptions, AuditRecord, AuditStorage } from "@lssm/lib.bus";
2
+
3
+ //#region src/storage/index.d.ts
4
+
5
+ /**
6
+ * Extended query options for audit storage.
7
+ */
8
+ interface ExtendedAuditQueryOptions extends AuditQueryOptions {
9
+ targetType?: string;
10
+ clientIp?: string;
11
+ sessionId?: string;
12
+ orderBy?: 'occurredAt' | 'recordedAt';
13
+ orderDir?: 'asc' | 'desc';
14
+ }
15
+ /**
16
+ * Audit storage adapter interface with extended capabilities.
17
+ */
18
+ interface AuditStorageAdapter extends AuditStorage {
19
+ /** Query audit records with extended options */
20
+ query(options: ExtendedAuditQueryOptions): Promise<AuditRecord[]>;
21
+ /** Count matching records */
22
+ count(options: Omit<ExtendedAuditQueryOptions, 'limit' | 'offset'>): Promise<number>;
23
+ /** Get a single record by ID */
24
+ getById(id: string): Promise<AuditRecord | null>;
25
+ /** Get all records for a trace */
26
+ getByTraceId(traceId: string): Promise<AuditRecord[]>;
27
+ /** Delete old records (for retention) */
28
+ deleteOlderThan(date: Date): Promise<number>;
29
+ }
30
+ /**
31
+ * In-memory audit storage for development/testing.
32
+ */
33
+ declare class InMemoryAuditStorage implements AuditStorageAdapter {
34
+ private records;
35
+ store(record: AuditRecord): Promise<void>;
36
+ query(options: ExtendedAuditQueryOptions): Promise<AuditRecord[]>;
37
+ count(options: Omit<ExtendedAuditQueryOptions, 'limit' | 'offset'>): Promise<number>;
38
+ getById(id: string): Promise<AuditRecord | null>;
39
+ getByTraceId(traceId: string): Promise<AuditRecord[]>;
40
+ deleteOlderThan(date: Date): Promise<number>;
41
+ /**
42
+ * Get all records (for testing).
43
+ */
44
+ getAll(): AuditRecord[];
45
+ /**
46
+ * Clear all records (for testing).
47
+ */
48
+ clear(): void;
49
+ }
50
+ /**
51
+ * Retention policy configuration.
52
+ */
53
+ interface RetentionPolicyConfig {
54
+ /** Days to keep detailed logs */
55
+ hotRetentionDays: number;
56
+ /** Days to keep archived logs (for compliance) */
57
+ archiveRetentionDays?: number;
58
+ /** Cron expression for cleanup schedule */
59
+ cleanupSchedule?: string;
60
+ }
61
+ /**
62
+ * Retention policy manager.
63
+ */
64
+ declare class RetentionPolicy {
65
+ private readonly config;
66
+ constructor(config: RetentionPolicyConfig);
67
+ /**
68
+ * Get the cutoff date for hot storage.
69
+ */
70
+ getHotCutoff(): Date;
71
+ /**
72
+ * Get the cutoff date for archive storage.
73
+ */
74
+ getArchiveCutoff(): Date | null;
75
+ /**
76
+ * Apply retention policy to storage.
77
+ */
78
+ apply(storage: AuditStorageAdapter): Promise<{
79
+ deletedCount: number;
80
+ }>;
81
+ }
82
+ /**
83
+ * Create an in-memory audit storage.
84
+ */
85
+ declare function createInMemoryAuditStorage(): InMemoryAuditStorage;
86
+ //#endregion
87
+ export { AuditStorageAdapter, ExtendedAuditQueryOptions, InMemoryAuditStorage, RetentionPolicy, RetentionPolicyConfig, createInMemoryAuditStorage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/module.audit-trail",
3
- "version": "0.0.0-canary-20251217054315",
3
+ "version": "0.0.0-canary-20251217060433",
4
4
  "description": "Audit trail module for tracking and querying system events",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -18,22 +18,22 @@
18
18
  "lint:check": "eslint src"
19
19
  },
20
20
  "dependencies": {
21
- "@lssm/lib.schema": "0.0.0-canary-20251217054315",
22
- "@lssm/lib.contracts": "0.0.0-canary-20251217054315",
23
- "@lssm/lib.bus": "0.0.0-canary-20251217054315",
21
+ "@lssm/lib.schema": "0.0.0-canary-20251217060433",
22
+ "@lssm/lib.contracts": "0.0.0-canary-20251217060433",
23
+ "@lssm/lib.bus": "0.0.0-canary-20251217060433",
24
24
  "zod": "^4.1.13"
25
25
  },
26
26
  "devDependencies": {
27
- "@lssm/tool.typescript": "0.0.0-canary-20251217054315",
28
- "@lssm/tool.tsdown": "0.0.0-canary-20251217054315",
27
+ "@lssm/tool.typescript": "0.0.0-canary-20251217060433",
28
+ "@lssm/tool.tsdown": "0.0.0-canary-20251217060433",
29
29
  "typescript": "^5.9.3"
30
30
  },
31
31
  "exports": {
32
- ".": "./src/index.ts",
33
- "./audit-trail.feature": "./src/audit-trail.feature.ts",
34
- "./contracts": "./src/contracts/index.ts",
35
- "./entities": "./src/entities/index.ts",
36
- "./storage": "./src/storage/index.ts",
32
+ ".": "./dist/index.js",
33
+ "./audit-trail.feature": "./dist/audit-trail.feature.js",
34
+ "./contracts": "./dist/contracts/index.js",
35
+ "./entities": "./dist/entities/index.js",
36
+ "./storage": "./dist/storage/index.js",
37
37
  "./*": "./*"
38
38
  },
39
39
  "module": "./dist/index.js",