@contractspec/module.audit-trail 1.57.0 → 1.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/audit-trail.capability.d.ts +1 -6
- package/dist/audit-trail.capability.d.ts.map +1 -1
- package/dist/audit-trail.capability.js +17 -20
- package/dist/audit-trail.feature.d.ts +1 -6
- package/dist/audit-trail.feature.d.ts.map +1 -1
- package/dist/audit-trail.feature.js +31 -64
- package/dist/browser/audit-trail.capability.js +16 -0
- package/dist/browser/audit-trail.feature.js +32 -0
- package/dist/browser/contracts/index.js +241 -0
- package/dist/browser/entities/index.js +103 -0
- package/dist/browser/index.js +474 -0
- package/dist/browser/storage/index.js +101 -0
- package/dist/contracts/index.d.ts +549 -555
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +227 -355
- package/dist/entities/index.d.ts +70 -75
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +100 -122
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +474 -5
- package/dist/node/audit-trail.capability.js +16 -0
- package/dist/node/audit-trail.feature.js +32 -0
- package/dist/node/contracts/index.js +241 -0
- package/dist/node/entities/index.js +103 -0
- package/dist/node/index.js +474 -0
- package/dist/node/storage/index.js +101 -0
- package/dist/storage/index.d.ts +59 -63
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +100 -110
- package/package.json +86 -25
- package/dist/audit-trail.capability.js.map +0 -1
- package/dist/audit-trail.feature.js.map +0 -1
- package/dist/contracts/index.js.map +0 -1
- package/dist/entities/index.js.map +0 -1
- package/dist/storage/index.js.map +0 -1
package/dist/entities/index.d.ts
CHANGED
|
@@ -1,91 +1,86 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ModuleSchemaContribution } from "@contractspec/lib.schema";
|
|
3
|
-
|
|
4
|
-
//#region src/entities/index.d.ts
|
|
1
|
+
import type { ModuleSchemaContribution } from '@contractspec/lib.schema';
|
|
5
2
|
/**
|
|
6
3
|
* AuditLog entity - main audit log entry.
|
|
7
4
|
*/
|
|
8
|
-
declare const AuditLogEntity:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
5
|
+
export declare const AuditLogEntity: import("@contractspec/lib.schema").EntitySpec<{
|
|
6
|
+
id: import("@contractspec/lib.schema").EntityScalarField;
|
|
7
|
+
eventName: import("@contractspec/lib.schema").EntityScalarField;
|
|
8
|
+
eventVersion: import("@contractspec/lib.schema").EntityScalarField;
|
|
9
|
+
payload: import("@contractspec/lib.schema").EntityScalarField;
|
|
10
|
+
actorId: import("@contractspec/lib.schema").EntityScalarField;
|
|
11
|
+
actorType: import("@contractspec/lib.schema").EntityScalarField;
|
|
12
|
+
actorEmail: import("@contractspec/lib.schema").EntityScalarField;
|
|
13
|
+
targetId: import("@contractspec/lib.schema").EntityScalarField;
|
|
14
|
+
targetType: import("@contractspec/lib.schema").EntityScalarField;
|
|
15
|
+
orgId: import("@contractspec/lib.schema").EntityScalarField;
|
|
16
|
+
tenantId: import("@contractspec/lib.schema").EntityScalarField;
|
|
17
|
+
traceId: import("@contractspec/lib.schema").EntityScalarField;
|
|
18
|
+
spanId: import("@contractspec/lib.schema").EntityScalarField;
|
|
19
|
+
requestId: import("@contractspec/lib.schema").EntityScalarField;
|
|
20
|
+
sessionId: import("@contractspec/lib.schema").EntityScalarField;
|
|
21
|
+
clientIp: import("@contractspec/lib.schema").EntityScalarField;
|
|
22
|
+
userAgent: import("@contractspec/lib.schema").EntityScalarField;
|
|
23
|
+
tags: import("@contractspec/lib.schema").EntityScalarField;
|
|
24
|
+
metadata: import("@contractspec/lib.schema").EntityScalarField;
|
|
25
|
+
occurredAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
26
|
+
recordedAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
30
27
|
}>;
|
|
31
28
|
/**
|
|
32
29
|
* AuditLogArchive entity - archived logs for long-term retention.
|
|
33
30
|
*/
|
|
34
|
-
declare const AuditLogArchiveEntity:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
export declare const AuditLogArchiveEntity: import("@contractspec/lib.schema").EntitySpec<{
|
|
32
|
+
id: import("@contractspec/lib.schema").EntityScalarField;
|
|
33
|
+
batchId: import("@contractspec/lib.schema").EntityScalarField;
|
|
34
|
+
logCount: import("@contractspec/lib.schema").EntityScalarField;
|
|
35
|
+
fromDate: import("@contractspec/lib.schema").EntityScalarField;
|
|
36
|
+
toDate: import("@contractspec/lib.schema").EntityScalarField;
|
|
37
|
+
storagePath: import("@contractspec/lib.schema").EntityScalarField;
|
|
38
|
+
storageType: import("@contractspec/lib.schema").EntityScalarField;
|
|
39
|
+
compressedSize: import("@contractspec/lib.schema").EntityScalarField;
|
|
40
|
+
checksum: import("@contractspec/lib.schema").EntityScalarField;
|
|
41
|
+
retainUntil: import("@contractspec/lib.schema").EntityScalarField;
|
|
42
|
+
createdAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
46
43
|
}>;
|
|
47
44
|
/**
|
|
48
45
|
* All audit trail entities for schema composition.
|
|
49
46
|
*/
|
|
50
|
-
declare const auditTrailEntities: (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}> |
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
47
|
+
export declare const auditTrailEntities: (import("@contractspec/lib.schema").EntitySpec<{
|
|
48
|
+
id: import("@contractspec/lib.schema").EntityScalarField;
|
|
49
|
+
eventName: import("@contractspec/lib.schema").EntityScalarField;
|
|
50
|
+
eventVersion: import("@contractspec/lib.schema").EntityScalarField;
|
|
51
|
+
payload: import("@contractspec/lib.schema").EntityScalarField;
|
|
52
|
+
actorId: import("@contractspec/lib.schema").EntityScalarField;
|
|
53
|
+
actorType: import("@contractspec/lib.schema").EntityScalarField;
|
|
54
|
+
actorEmail: import("@contractspec/lib.schema").EntityScalarField;
|
|
55
|
+
targetId: import("@contractspec/lib.schema").EntityScalarField;
|
|
56
|
+
targetType: import("@contractspec/lib.schema").EntityScalarField;
|
|
57
|
+
orgId: import("@contractspec/lib.schema").EntityScalarField;
|
|
58
|
+
tenantId: import("@contractspec/lib.schema").EntityScalarField;
|
|
59
|
+
traceId: import("@contractspec/lib.schema").EntityScalarField;
|
|
60
|
+
spanId: import("@contractspec/lib.schema").EntityScalarField;
|
|
61
|
+
requestId: import("@contractspec/lib.schema").EntityScalarField;
|
|
62
|
+
sessionId: import("@contractspec/lib.schema").EntityScalarField;
|
|
63
|
+
clientIp: import("@contractspec/lib.schema").EntityScalarField;
|
|
64
|
+
userAgent: import("@contractspec/lib.schema").EntityScalarField;
|
|
65
|
+
tags: import("@contractspec/lib.schema").EntityScalarField;
|
|
66
|
+
metadata: import("@contractspec/lib.schema").EntityScalarField;
|
|
67
|
+
occurredAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
68
|
+
recordedAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
69
|
+
}> | import("@contractspec/lib.schema").EntitySpec<{
|
|
70
|
+
id: import("@contractspec/lib.schema").EntityScalarField;
|
|
71
|
+
batchId: import("@contractspec/lib.schema").EntityScalarField;
|
|
72
|
+
logCount: import("@contractspec/lib.schema").EntityScalarField;
|
|
73
|
+
fromDate: import("@contractspec/lib.schema").EntityScalarField;
|
|
74
|
+
toDate: import("@contractspec/lib.schema").EntityScalarField;
|
|
75
|
+
storagePath: import("@contractspec/lib.schema").EntityScalarField;
|
|
76
|
+
storageType: import("@contractspec/lib.schema").EntityScalarField;
|
|
77
|
+
compressedSize: import("@contractspec/lib.schema").EntityScalarField;
|
|
78
|
+
checksum: import("@contractspec/lib.schema").EntityScalarField;
|
|
79
|
+
retainUntil: import("@contractspec/lib.schema").EntityScalarField;
|
|
80
|
+
createdAt: import("@contractspec/lib.schema").EntityScalarField;
|
|
84
81
|
}>)[];
|
|
85
82
|
/**
|
|
86
83
|
* Module schema contribution for audit trail.
|
|
87
84
|
*/
|
|
88
|
-
declare const auditTrailSchemaContribution: ModuleSchemaContribution;
|
|
89
|
-
//#endregion
|
|
90
|
-
export { AuditLogArchiveEntity, AuditLogEntity, auditTrailEntities, auditTrailSchemaContribution };
|
|
85
|
+
export declare const auditTrailSchemaContribution: ModuleSchemaContribution;
|
|
91
86
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;EAqFzB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EA+BhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA0C,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,wBAG1C,CAAC"}
|
package/dist/entities/index.js
CHANGED
|
@@ -1,126 +1,104 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/entities/index.ts
|
|
1
3
|
import { defineEntity, field, index } from "@contractspec/lib.schema";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
description: "Custom tags for filtering"
|
|
72
|
-
}),
|
|
73
|
-
metadata: field.json({
|
|
74
|
-
isOptional: true,
|
|
75
|
-
description: "Additional metadata"
|
|
76
|
-
}),
|
|
77
|
-
occurredAt: field.dateTime({ description: "When the event occurred" }),
|
|
78
|
-
recordedAt: field.createdAt({ description: "When the log was recorded" })
|
|
79
|
-
},
|
|
80
|
-
indexes: [
|
|
81
|
-
index.on(["actorId", "occurredAt"]),
|
|
82
|
-
index.on(["targetId", "occurredAt"]),
|
|
83
|
-
index.on(["orgId", "occurredAt"]),
|
|
84
|
-
index.on(["eventName", "occurredAt"]),
|
|
85
|
-
index.on(["traceId"]),
|
|
86
|
-
index.on(["occurredAt"])
|
|
87
|
-
]
|
|
4
|
+
var AuditLogEntity = defineEntity({
|
|
5
|
+
name: "AuditLog",
|
|
6
|
+
description: "Audit log entry for tracking system events.",
|
|
7
|
+
schema: "lssm_audit",
|
|
8
|
+
map: "audit_log",
|
|
9
|
+
fields: {
|
|
10
|
+
id: field.id({ description: "Unique audit log ID" }),
|
|
11
|
+
eventName: field.string({ description: "Event name/type" }),
|
|
12
|
+
eventVersion: field.int({ description: "Event version" }),
|
|
13
|
+
payload: field.json({ description: "Event payload (may be redacted)" }),
|
|
14
|
+
actorId: field.string({
|
|
15
|
+
isOptional: true,
|
|
16
|
+
description: "User/service that triggered the event"
|
|
17
|
+
}),
|
|
18
|
+
actorType: field.string({
|
|
19
|
+
isOptional: true,
|
|
20
|
+
description: "Actor type (user, system, service)"
|
|
21
|
+
}),
|
|
22
|
+
actorEmail: field.string({
|
|
23
|
+
isOptional: true,
|
|
24
|
+
description: "Actor email (for searchability)"
|
|
25
|
+
}),
|
|
26
|
+
targetId: field.string({
|
|
27
|
+
isOptional: true,
|
|
28
|
+
description: "Resource affected by the event"
|
|
29
|
+
}),
|
|
30
|
+
targetType: field.string({
|
|
31
|
+
isOptional: true,
|
|
32
|
+
description: "Resource type"
|
|
33
|
+
}),
|
|
34
|
+
orgId: field.string({
|
|
35
|
+
isOptional: true,
|
|
36
|
+
description: "Organization context"
|
|
37
|
+
}),
|
|
38
|
+
tenantId: field.string({ isOptional: true, description: "Tenant context" }),
|
|
39
|
+
traceId: field.string({
|
|
40
|
+
isOptional: true,
|
|
41
|
+
description: "Distributed trace ID"
|
|
42
|
+
}),
|
|
43
|
+
spanId: field.string({ isOptional: true, description: "Span ID" }),
|
|
44
|
+
requestId: field.string({ isOptional: true, description: "Request ID" }),
|
|
45
|
+
sessionId: field.string({ isOptional: true, description: "Session ID" }),
|
|
46
|
+
clientIp: field.string({
|
|
47
|
+
isOptional: true,
|
|
48
|
+
description: "Client IP address"
|
|
49
|
+
}),
|
|
50
|
+
userAgent: field.string({
|
|
51
|
+
isOptional: true,
|
|
52
|
+
description: "User agent string"
|
|
53
|
+
}),
|
|
54
|
+
tags: field.json({
|
|
55
|
+
isOptional: true,
|
|
56
|
+
description: "Custom tags for filtering"
|
|
57
|
+
}),
|
|
58
|
+
metadata: field.json({
|
|
59
|
+
isOptional: true,
|
|
60
|
+
description: "Additional metadata"
|
|
61
|
+
}),
|
|
62
|
+
occurredAt: field.dateTime({ description: "When the event occurred" }),
|
|
63
|
+
recordedAt: field.createdAt({ description: "When the log was recorded" })
|
|
64
|
+
},
|
|
65
|
+
indexes: [
|
|
66
|
+
index.on(["actorId", "occurredAt"]),
|
|
67
|
+
index.on(["targetId", "occurredAt"]),
|
|
68
|
+
index.on(["orgId", "occurredAt"]),
|
|
69
|
+
index.on(["eventName", "occurredAt"]),
|
|
70
|
+
index.on(["traceId"]),
|
|
71
|
+
index.on(["occurredAt"])
|
|
72
|
+
]
|
|
88
73
|
});
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
createdAt: field.createdAt()
|
|
109
|
-
},
|
|
110
|
-
indexes: [index.on(["fromDate", "toDate"]), index.on(["retainUntil"])]
|
|
74
|
+
var AuditLogArchiveEntity = defineEntity({
|
|
75
|
+
name: "AuditLogArchive",
|
|
76
|
+
description: "Archived audit logs for long-term retention.",
|
|
77
|
+
schema: "lssm_audit",
|
|
78
|
+
map: "audit_log_archive",
|
|
79
|
+
fields: {
|
|
80
|
+
id: field.id(),
|
|
81
|
+
batchId: field.string({ description: "Archive batch ID" }),
|
|
82
|
+
logCount: field.int({ description: "Number of logs in batch" }),
|
|
83
|
+
fromDate: field.dateTime({ description: "Earliest log in batch" }),
|
|
84
|
+
toDate: field.dateTime({ description: "Latest log in batch" }),
|
|
85
|
+
storagePath: field.string({ description: "Path to archived data" }),
|
|
86
|
+
storageType: field.string({ description: "Storage type (s3, gcs, file)" }),
|
|
87
|
+
compressedSize: field.int({ description: "Compressed size in bytes" }),
|
|
88
|
+
checksum: field.string({ description: "SHA-256 checksum" }),
|
|
89
|
+
retainUntil: field.dateTime({ description: "When archive can be deleted" }),
|
|
90
|
+
createdAt: field.createdAt()
|
|
91
|
+
},
|
|
92
|
+
indexes: [index.on(["fromDate", "toDate"]), index.on(["retainUntil"])]
|
|
111
93
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
94
|
+
var auditTrailEntities = [AuditLogEntity, AuditLogArchiveEntity];
|
|
95
|
+
var auditTrailSchemaContribution = {
|
|
96
|
+
moduleId: "@contractspec/module.audit-trail",
|
|
97
|
+
entities: auditTrailEntities
|
|
98
|
+
};
|
|
99
|
+
export {
|
|
100
|
+
auditTrailSchemaContribution,
|
|
101
|
+
auditTrailEntities,
|
|
102
|
+
AuditLogEntity,
|
|
103
|
+
AuditLogArchiveEntity
|
|
122
104
|
};
|
|
123
|
-
|
|
124
|
-
//#endregion
|
|
125
|
-
export { AuditLogArchiveEntity, AuditLogEntity, auditTrailEntities, auditTrailSchemaContribution };
|
|
126
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export * from './entities';
|
|
2
|
+
export * from './contracts';
|
|
3
|
+
export * from './storage';
|
|
4
|
+
export * from './audit-trail.feature';
|
|
5
|
+
export type { AuditRecord, AuditStorage, AuditQueryOptions, } from '@contractspec/lib.bus';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,WAAW,CAAC;AAG1B,cAAc,uBAAuB,CAAC;AAGtC,YAAY,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,GAClB,MAAM,uBAAuB,CAAC"}
|