@lssm/module.audit-trail 0.0.0-canary-20251217083314 → 1.41.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.feature.js +1 -57
- package/dist/contracts/index.js +1 -373
- package/dist/entities/index.js +1 -126
- package/dist/index.js +1 -6
- package/dist/storage/index.js +1 -105
- package/package.json +11 -12
- package/dist/audit-trail.feature.d.ts +0 -11
- package/dist/contracts/index.d.ts +0 -582
- package/dist/entities/index.d.ts +0 -90
- package/dist/index.d.ts +0 -6
- package/dist/libs/contracts/dist/capabilities/openbanking.js +0 -88
- package/dist/libs/contracts/dist/client/index.js +0 -5
- package/dist/libs/contracts/dist/client/react/feature-render.js +0 -2
- package/dist/libs/contracts/dist/client/react/form-render.js +0 -4
- package/dist/libs/contracts/dist/client/react/index.js +0 -4
- package/dist/libs/contracts/dist/contract-registry/index.js +0 -1
- package/dist/libs/contracts/dist/contract-registry/schemas.js +0 -60
- package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/index.js +0 -29
- package/dist/libs/contracts/dist/docs/presentations.js +0 -71
- package/dist/libs/contracts/dist/docs/registry.js +0 -44
- package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
- package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
- package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
- package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
- package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
- package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
- package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
- package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
- package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
- package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
- package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
- package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
- package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
- package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
- package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
- package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
- package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
- package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
- package/dist/libs/contracts/dist/events.js +0 -1
- package/dist/libs/contracts/dist/experiments/evaluator.js +0 -1
- package/dist/libs/contracts/dist/index.js +0 -71
- package/dist/libs/contracts/dist/install.js +0 -2
- package/dist/libs/contracts/dist/integrations/contracts.js +0 -377
- package/dist/libs/contracts/dist/integrations/index.js +0 -18
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
- package/dist/libs/contracts/dist/integrations/openbanking/models.js +0 -242
- package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +0 -13
- package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +0 -52
- package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +0 -75
- package/dist/libs/contracts/dist/integrations/providers/gmail.js +0 -87
- package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +0 -66
- package/dist/libs/contracts/dist/integrations/providers/index.js +0 -11
- package/dist/libs/contracts/dist/integrations/providers/mistral.js +0 -68
- package/dist/libs/contracts/dist/integrations/providers/postmark.js +0 -68
- package/dist/libs/contracts/dist/integrations/providers/powens.js +0 -116
- package/dist/libs/contracts/dist/integrations/providers/qdrant.js +0 -73
- package/dist/libs/contracts/dist/integrations/providers/registry.js +0 -10
- package/dist/libs/contracts/dist/integrations/providers/stripe.js +0 -83
- package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +0 -61
- package/dist/libs/contracts/dist/jsonschema.js +0 -1
- package/dist/libs/contracts/dist/knowledge/contracts.js +0 -306
- package/dist/libs/contracts/dist/knowledge/index.js +0 -7
- package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +0 -34
- package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
- package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
- package/dist/libs/contracts/dist/knowledge/spaces/index.js +0 -6
- package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +0 -34
- package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +0 -37
- package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
- package/dist/libs/contracts/dist/llm/exporters.js +0 -19
- package/dist/libs/contracts/dist/llm/index.js +0 -2
- package/dist/libs/contracts/dist/llm/prompts.js +0 -1
- package/dist/libs/contracts/dist/onboarding-base.js +0 -196
- package/dist/libs/contracts/dist/openapi.js +0 -1
- package/dist/libs/contracts/dist/ownership.js +0 -21
- package/dist/libs/contracts/dist/presentations.js +0 -1
- package/dist/libs/contracts/dist/presentations.v2.js +0 -11
- package/dist/libs/contracts/dist/prompt.js +0 -1
- package/dist/libs/contracts/dist/promptRegistry.js +0 -1
- package/dist/libs/contracts/dist/regenerator/index.js +0 -1
- package/dist/libs/contracts/dist/regenerator/service.js +0 -6
- package/dist/libs/contracts/dist/registry.js +0 -2
- package/dist/libs/contracts/dist/resources.js +0 -1
- package/dist/libs/contracts/dist/schema/dist/EnumType.js +0 -2
- package/dist/libs/contracts/dist/schema/dist/FieldType.js +0 -49
- package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +0 -39
- package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
- package/dist/libs/contracts/dist/schema/dist/entity/index.js +0 -2
- package/dist/libs/contracts/dist/schema/dist/entity/types.js +0 -1
- package/dist/libs/contracts/dist/schema/dist/index.js +0 -6
- package/dist/libs/contracts/dist/server/graphql-pothos.js +0 -6
- package/dist/libs/contracts/dist/server/index.js +0 -8
- package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +0 -4
- package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +0 -2
- package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +0 -1
- package/dist/libs/contracts/dist/server/mcp/registerResources.js +0 -2
- package/dist/libs/contracts/dist/server/mcp/registerTools.js +0 -1
- package/dist/libs/contracts/dist/server/provider-mcp.js +0 -1
- package/dist/libs/contracts/dist/server/rest-elysia.js +0 -1
- package/dist/libs/contracts/dist/server/rest-express.js +0 -1
- package/dist/libs/contracts/dist/server/rest-generic.js +0 -1
- package/dist/libs/contracts/dist/server/rest-next-app.js +0 -1
- package/dist/libs/contracts/dist/server/rest-next-pages.js +0 -1
- package/dist/libs/contracts/dist/spec.js +0 -34
- package/dist/libs/contracts/dist/telemetry/index.js +0 -1
- package/dist/libs/contracts/dist/telemetry/tracker.js +0 -1
- package/dist/libs/contracts/dist/tests/index.js +0 -1
- package/dist/libs/contracts/dist/tests/runner.js +0 -2
- package/dist/libs/contracts/dist/workflow/index.js +0 -1
- package/dist/libs/contracts/dist/workflow/runner.js +0 -1
- package/dist/libs/schema/dist/EnumType.js +0 -56
- package/dist/libs/schema/dist/FieldType.js +0 -49
- package/dist/libs/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/libs/schema/dist/SchemaModel.js +0 -3
- package/dist/libs/schema/dist/entity/defineEntity.js +0 -230
- package/dist/libs/schema/dist/entity/index.js +0 -2
- package/dist/libs/schema/dist/entity/types.js +0 -1
- package/dist/libs/schema/dist/index.js +0 -6
- package/dist/storage/index.d.ts +0 -87
|
@@ -1,57 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Audit Trail feature module that bundles audit log querying,
|
|
4
|
-
* export, and statistics capabilities.
|
|
5
|
-
*/
|
|
6
|
-
const AuditTrailFeature = {
|
|
7
|
-
meta: {
|
|
8
|
-
key: "audit-trail",
|
|
9
|
-
title: "Audit Trail",
|
|
10
|
-
description: "Audit logging, querying, export, and compliance reporting",
|
|
11
|
-
domain: "platform",
|
|
12
|
-
owners: ["@platform.audit-trail"],
|
|
13
|
-
tags: [
|
|
14
|
-
"audit",
|
|
15
|
-
"compliance",
|
|
16
|
-
"logging",
|
|
17
|
-
"security"
|
|
18
|
-
],
|
|
19
|
-
stability: "stable"
|
|
20
|
-
},
|
|
21
|
-
operations: [
|
|
22
|
-
{
|
|
23
|
-
name: "audit.logs.export",
|
|
24
|
-
version: 1
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: "audit.logs.query",
|
|
28
|
-
version: 1
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
name: "audit.logs.get",
|
|
32
|
-
version: 1
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: "audit.trace.get",
|
|
36
|
-
version: 1
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: "audit.stats",
|
|
40
|
-
version: 1
|
|
41
|
-
}
|
|
42
|
-
],
|
|
43
|
-
events: [],
|
|
44
|
-
presentations: [],
|
|
45
|
-
opToPresentation: [],
|
|
46
|
-
presentationsTargets: [],
|
|
47
|
-
capabilities: {
|
|
48
|
-
provides: [{
|
|
49
|
-
key: "audit-trail",
|
|
50
|
-
version: 1
|
|
51
|
-
}],
|
|
52
|
-
requires: []
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
//#endregion
|
|
57
|
-
export { AuditTrailFeature };
|
|
1
|
+
const e={meta:{key:`audit-trail`,title:`Audit Trail`,description:`Audit logging, querying, export, and compliance reporting`,domain:`platform`,owners:[`@platform.audit-trail`],tags:[`audit`,`compliance`,`logging`,`security`],stability:`stable`},operations:[{name:`audit.logs.export`,version:1},{name:`audit.logs.query`,version:1},{name:`audit.logs.get`,version:1},{name:`audit.trace.get`,version:1},{name:`audit.stats`,version:1}],events:[],presentations:[],opToPresentation:[],presentationsTargets:[],capabilities:{provides:[{key:`audit-trail`,version:1}],requires:[]}};export{e as AuditTrailFeature};
|
package/dist/contracts/index.js
CHANGED
|
@@ -1,373 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ScalarTypeEnum } from "../libs/schema/dist/ScalarTypeEnum.js";
|
|
3
|
-
import "../libs/schema/dist/index.js";
|
|
4
|
-
import { defineSchemaModel } from "../libs/contracts/dist/schema/dist/SchemaModel.js";
|
|
5
|
-
import { defineCommand, defineQuery } from "../libs/contracts/dist/spec.js";
|
|
6
|
-
import "../libs/contracts/dist/index.js";
|
|
7
|
-
|
|
8
|
-
//#region src/contracts/index.ts
|
|
9
|
-
const OWNERS = ["platform.audit-trail"];
|
|
10
|
-
const AuditLogModel = defineSchemaModel({
|
|
11
|
-
name: "AuditLog",
|
|
12
|
-
description: "Detailed audit log entry",
|
|
13
|
-
fields: {
|
|
14
|
-
id: {
|
|
15
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
16
|
-
isOptional: false
|
|
17
|
-
},
|
|
18
|
-
eventName: {
|
|
19
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
20
|
-
isOptional: false
|
|
21
|
-
},
|
|
22
|
-
eventVersion: {
|
|
23
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
24
|
-
isOptional: false
|
|
25
|
-
},
|
|
26
|
-
payload: {
|
|
27
|
-
type: ScalarTypeEnum.JSONObject(),
|
|
28
|
-
isOptional: false
|
|
29
|
-
},
|
|
30
|
-
actorId: {
|
|
31
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
32
|
-
isOptional: true
|
|
33
|
-
},
|
|
34
|
-
actorType: {
|
|
35
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
36
|
-
isOptional: true
|
|
37
|
-
},
|
|
38
|
-
actorEmail: {
|
|
39
|
-
type: ScalarTypeEnum.EmailAddress(),
|
|
40
|
-
isOptional: true
|
|
41
|
-
},
|
|
42
|
-
targetId: {
|
|
43
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
44
|
-
isOptional: true
|
|
45
|
-
},
|
|
46
|
-
targetType: {
|
|
47
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
48
|
-
isOptional: true
|
|
49
|
-
},
|
|
50
|
-
orgId: {
|
|
51
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
52
|
-
isOptional: true
|
|
53
|
-
},
|
|
54
|
-
traceId: {
|
|
55
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
56
|
-
isOptional: true
|
|
57
|
-
},
|
|
58
|
-
clientIp: {
|
|
59
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
60
|
-
isOptional: true
|
|
61
|
-
},
|
|
62
|
-
occurredAt: {
|
|
63
|
-
type: ScalarTypeEnum.DateTime(),
|
|
64
|
-
isOptional: false
|
|
65
|
-
},
|
|
66
|
-
recordedAt: {
|
|
67
|
-
type: ScalarTypeEnum.DateTime(),
|
|
68
|
-
isOptional: false
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
const AuditQueryInputModel = defineSchemaModel({
|
|
73
|
-
name: "AuditQueryInput",
|
|
74
|
-
description: "Input for querying audit logs",
|
|
75
|
-
fields: {
|
|
76
|
-
eventName: {
|
|
77
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
78
|
-
isOptional: true
|
|
79
|
-
},
|
|
80
|
-
actorId: {
|
|
81
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
82
|
-
isOptional: true
|
|
83
|
-
},
|
|
84
|
-
targetId: {
|
|
85
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
86
|
-
isOptional: true
|
|
87
|
-
},
|
|
88
|
-
targetType: {
|
|
89
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
90
|
-
isOptional: true
|
|
91
|
-
},
|
|
92
|
-
orgId: {
|
|
93
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
94
|
-
isOptional: true
|
|
95
|
-
},
|
|
96
|
-
traceId: {
|
|
97
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
98
|
-
isOptional: true
|
|
99
|
-
},
|
|
100
|
-
from: {
|
|
101
|
-
type: ScalarTypeEnum.DateTime(),
|
|
102
|
-
isOptional: true
|
|
103
|
-
},
|
|
104
|
-
to: {
|
|
105
|
-
type: ScalarTypeEnum.DateTime(),
|
|
106
|
-
isOptional: true
|
|
107
|
-
},
|
|
108
|
-
limit: {
|
|
109
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
110
|
-
isOptional: true,
|
|
111
|
-
defaultValue: 100
|
|
112
|
-
},
|
|
113
|
-
offset: {
|
|
114
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
115
|
-
isOptional: true,
|
|
116
|
-
defaultValue: 0
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
const AuditQueryOutputModel = defineSchemaModel({
|
|
121
|
-
name: "AuditQueryOutput",
|
|
122
|
-
description: "Output from querying audit logs",
|
|
123
|
-
fields: {
|
|
124
|
-
logs: {
|
|
125
|
-
type: AuditLogModel,
|
|
126
|
-
isArray: true,
|
|
127
|
-
isOptional: false
|
|
128
|
-
},
|
|
129
|
-
total: {
|
|
130
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
131
|
-
isOptional: false
|
|
132
|
-
},
|
|
133
|
-
hasMore: {
|
|
134
|
-
type: ScalarTypeEnum.Boolean(),
|
|
135
|
-
isOptional: false
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
const ExportFormatEnum = defineEnum("ExportFormat", [
|
|
140
|
-
"json",
|
|
141
|
-
"csv",
|
|
142
|
-
"parquet"
|
|
143
|
-
]);
|
|
144
|
-
const AuditExportInputModel = defineSchemaModel({
|
|
145
|
-
name: "AuditExportInput",
|
|
146
|
-
description: "Input for exporting audit logs",
|
|
147
|
-
fields: {
|
|
148
|
-
orgId: {
|
|
149
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
150
|
-
isOptional: false
|
|
151
|
-
},
|
|
152
|
-
from: {
|
|
153
|
-
type: ScalarTypeEnum.DateTime(),
|
|
154
|
-
isOptional: false
|
|
155
|
-
},
|
|
156
|
-
to: {
|
|
157
|
-
type: ScalarTypeEnum.DateTime(),
|
|
158
|
-
isOptional: false
|
|
159
|
-
},
|
|
160
|
-
format: {
|
|
161
|
-
type: ExportFormatEnum,
|
|
162
|
-
isOptional: true,
|
|
163
|
-
defaultValue: "json"
|
|
164
|
-
},
|
|
165
|
-
eventNames: {
|
|
166
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
167
|
-
isArray: true,
|
|
168
|
-
isOptional: true
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
const ExportStatusEnum = defineEnum("ExportStatus", [
|
|
173
|
-
"pending",
|
|
174
|
-
"processing",
|
|
175
|
-
"completed",
|
|
176
|
-
"failed"
|
|
177
|
-
]);
|
|
178
|
-
const AuditExportOutputModel = defineSchemaModel({
|
|
179
|
-
name: "AuditExportOutput",
|
|
180
|
-
description: "Output from initiating an audit export",
|
|
181
|
-
fields: {
|
|
182
|
-
exportId: {
|
|
183
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
184
|
-
isOptional: false
|
|
185
|
-
},
|
|
186
|
-
status: {
|
|
187
|
-
type: ExportStatusEnum,
|
|
188
|
-
isOptional: false
|
|
189
|
-
},
|
|
190
|
-
downloadUrl: {
|
|
191
|
-
type: ScalarTypeEnum.URL(),
|
|
192
|
-
isOptional: true
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
const AuditStatsInputModel = defineSchemaModel({
|
|
197
|
-
name: "AuditStatsInput",
|
|
198
|
-
description: "Input for getting audit statistics",
|
|
199
|
-
fields: {
|
|
200
|
-
orgId: {
|
|
201
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
202
|
-
isOptional: true
|
|
203
|
-
},
|
|
204
|
-
from: {
|
|
205
|
-
type: ScalarTypeEnum.DateTime(),
|
|
206
|
-
isOptional: true
|
|
207
|
-
},
|
|
208
|
-
to: {
|
|
209
|
-
type: ScalarTypeEnum.DateTime(),
|
|
210
|
-
isOptional: true
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
const AuditStatsOutputModel = defineSchemaModel({
|
|
215
|
-
name: "AuditStatsOutput",
|
|
216
|
-
description: "Audit log statistics",
|
|
217
|
-
fields: {
|
|
218
|
-
totalLogs: {
|
|
219
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
220
|
-
isOptional: false
|
|
221
|
-
},
|
|
222
|
-
uniqueActors: {
|
|
223
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
224
|
-
isOptional: false
|
|
225
|
-
},
|
|
226
|
-
uniqueTargets: {
|
|
227
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
228
|
-
isOptional: false
|
|
229
|
-
},
|
|
230
|
-
eventCounts: {
|
|
231
|
-
type: ScalarTypeEnum.JSONObject(),
|
|
232
|
-
isOptional: false
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
/**
|
|
237
|
-
* Query audit logs.
|
|
238
|
-
*/
|
|
239
|
-
const QueryAuditLogsContract = defineQuery({
|
|
240
|
-
meta: {
|
|
241
|
-
name: "audit.logs.query",
|
|
242
|
-
version: 1,
|
|
243
|
-
stability: "stable",
|
|
244
|
-
owners: [...OWNERS],
|
|
245
|
-
tags: [
|
|
246
|
-
"audit",
|
|
247
|
-
"logs",
|
|
248
|
-
"query"
|
|
249
|
-
],
|
|
250
|
-
description: "Query audit logs with filters.",
|
|
251
|
-
goal: "Enable searching and filtering of audit history.",
|
|
252
|
-
context: "Admin dashboard, compliance reporting, debugging."
|
|
253
|
-
},
|
|
254
|
-
io: {
|
|
255
|
-
input: AuditQueryInputModel,
|
|
256
|
-
output: AuditQueryOutputModel
|
|
257
|
-
},
|
|
258
|
-
policy: { auth: "admin" }
|
|
259
|
-
});
|
|
260
|
-
/**
|
|
261
|
-
* Get audit log by ID.
|
|
262
|
-
*/
|
|
263
|
-
const GetAuditLogContract = defineQuery({
|
|
264
|
-
meta: {
|
|
265
|
-
name: "audit.logs.get",
|
|
266
|
-
version: 1,
|
|
267
|
-
stability: "stable",
|
|
268
|
-
owners: [...OWNERS],
|
|
269
|
-
tags: [
|
|
270
|
-
"audit",
|
|
271
|
-
"logs",
|
|
272
|
-
"get"
|
|
273
|
-
],
|
|
274
|
-
description: "Get a specific audit log by ID.",
|
|
275
|
-
goal: "View detailed audit log entry.",
|
|
276
|
-
context: "Log detail view."
|
|
277
|
-
},
|
|
278
|
-
io: {
|
|
279
|
-
input: defineSchemaModel({
|
|
280
|
-
name: "GetAuditLogInput",
|
|
281
|
-
fields: { logId: {
|
|
282
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
283
|
-
isOptional: false
|
|
284
|
-
} }
|
|
285
|
-
}),
|
|
286
|
-
output: AuditLogModel
|
|
287
|
-
},
|
|
288
|
-
policy: { auth: "admin" }
|
|
289
|
-
});
|
|
290
|
-
/**
|
|
291
|
-
* Get audit logs by trace ID.
|
|
292
|
-
*/
|
|
293
|
-
const GetAuditTraceContract = defineQuery({
|
|
294
|
-
meta: {
|
|
295
|
-
name: "audit.trace.get",
|
|
296
|
-
version: 1,
|
|
297
|
-
stability: "stable",
|
|
298
|
-
owners: [...OWNERS],
|
|
299
|
-
tags: [
|
|
300
|
-
"audit",
|
|
301
|
-
"trace",
|
|
302
|
-
"get"
|
|
303
|
-
],
|
|
304
|
-
description: "Get all audit logs for a trace.",
|
|
305
|
-
goal: "View complete request trace for debugging.",
|
|
306
|
-
context: "Request tracing, debugging."
|
|
307
|
-
},
|
|
308
|
-
io: {
|
|
309
|
-
input: defineSchemaModel({
|
|
310
|
-
name: "GetAuditTraceInput",
|
|
311
|
-
fields: { traceId: {
|
|
312
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
313
|
-
isOptional: false
|
|
314
|
-
} }
|
|
315
|
-
}),
|
|
316
|
-
output: defineSchemaModel({
|
|
317
|
-
name: "GetAuditTraceOutput",
|
|
318
|
-
fields: { logs: {
|
|
319
|
-
type: AuditLogModel,
|
|
320
|
-
isArray: true,
|
|
321
|
-
isOptional: false
|
|
322
|
-
} }
|
|
323
|
-
})
|
|
324
|
-
},
|
|
325
|
-
policy: { auth: "admin" }
|
|
326
|
-
});
|
|
327
|
-
/**
|
|
328
|
-
* Export audit logs.
|
|
329
|
-
*/
|
|
330
|
-
const ExportAuditLogsContract = defineCommand({
|
|
331
|
-
meta: {
|
|
332
|
-
name: "audit.logs.export",
|
|
333
|
-
version: 1,
|
|
334
|
-
stability: "stable",
|
|
335
|
-
owners: [...OWNERS],
|
|
336
|
-
tags: [
|
|
337
|
-
"audit",
|
|
338
|
-
"logs",
|
|
339
|
-
"export"
|
|
340
|
-
],
|
|
341
|
-
description: "Export audit logs for compliance reporting.",
|
|
342
|
-
goal: "Generate audit reports for compliance.",
|
|
343
|
-
context: "Compliance reporting, external audits."
|
|
344
|
-
},
|
|
345
|
-
io: {
|
|
346
|
-
input: AuditExportInputModel,
|
|
347
|
-
output: AuditExportOutputModel
|
|
348
|
-
},
|
|
349
|
-
policy: { auth: "admin" }
|
|
350
|
-
});
|
|
351
|
-
/**
|
|
352
|
-
* Get audit statistics.
|
|
353
|
-
*/
|
|
354
|
-
const GetAuditStatsContract = defineQuery({
|
|
355
|
-
meta: {
|
|
356
|
-
name: "audit.stats",
|
|
357
|
-
version: 1,
|
|
358
|
-
stability: "stable",
|
|
359
|
-
owners: [...OWNERS],
|
|
360
|
-
tags: ["audit", "stats"],
|
|
361
|
-
description: "Get audit log statistics.",
|
|
362
|
-
goal: "Monitor audit activity levels.",
|
|
363
|
-
context: "Admin dashboard, monitoring."
|
|
364
|
-
},
|
|
365
|
-
io: {
|
|
366
|
-
input: AuditStatsInputModel,
|
|
367
|
-
output: AuditStatsOutputModel
|
|
368
|
-
},
|
|
369
|
-
policy: { auth: "admin" }
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
//#endregion
|
|
373
|
-
export { AuditExportInputModel, AuditExportOutputModel, AuditLogModel, AuditQueryInputModel, AuditQueryOutputModel, AuditStatsInputModel, AuditStatsOutputModel, ExportAuditLogsContract, ExportFormatEnum, ExportStatusEnum, GetAuditLogContract, GetAuditStatsContract, GetAuditTraceContract, QueryAuditLogsContract };
|
|
1
|
+
import{ScalarTypeEnum as e,defineEnum as t}from"@lssm/lib.schema";import{defineCommand as n,defineQuery as r,defineSchemaModel as i}from"@lssm/lib.contracts";const a=[`platform.audit-trail`],o=i({name:`AuditLog`,description:`Detailed audit log entry`,fields:{id:{type:e.String_unsecure(),isOptional:!1},eventName:{type:e.String_unsecure(),isOptional:!1},eventVersion:{type:e.Int_unsecure(),isOptional:!1},payload:{type:e.JSONObject(),isOptional:!1},actorId:{type:e.String_unsecure(),isOptional:!0},actorType:{type:e.String_unsecure(),isOptional:!0},actorEmail:{type:e.EmailAddress(),isOptional:!0},targetId:{type:e.String_unsecure(),isOptional:!0},targetType:{type:e.String_unsecure(),isOptional:!0},orgId:{type:e.String_unsecure(),isOptional:!0},traceId:{type:e.String_unsecure(),isOptional:!0},clientIp:{type:e.String_unsecure(),isOptional:!0},occurredAt:{type:e.DateTime(),isOptional:!1},recordedAt:{type:e.DateTime(),isOptional:!1}}}),s=i({name:`AuditQueryInput`,description:`Input for querying audit logs`,fields:{eventName:{type:e.String_unsecure(),isOptional:!0},actorId:{type:e.String_unsecure(),isOptional:!0},targetId:{type:e.String_unsecure(),isOptional:!0},targetType:{type:e.String_unsecure(),isOptional:!0},orgId:{type:e.String_unsecure(),isOptional:!0},traceId:{type:e.String_unsecure(),isOptional:!0},from:{type:e.DateTime(),isOptional:!0},to:{type:e.DateTime(),isOptional:!0},limit:{type:e.Int_unsecure(),isOptional:!0,defaultValue:100},offset:{type:e.Int_unsecure(),isOptional:!0,defaultValue:0}}}),c=i({name:`AuditQueryOutput`,description:`Output from querying audit logs`,fields:{logs:{type:o,isArray:!0,isOptional:!1},total:{type:e.Int_unsecure(),isOptional:!1},hasMore:{type:e.Boolean(),isOptional:!1}}}),l=t(`ExportFormat`,[`json`,`csv`,`parquet`]),u=i({name:`AuditExportInput`,description:`Input for exporting audit logs`,fields:{orgId:{type:e.String_unsecure(),isOptional:!1},from:{type:e.DateTime(),isOptional:!1},to:{type:e.DateTime(),isOptional:!1},format:{type:l,isOptional:!0,defaultValue:`json`},eventNames:{type:e.String_unsecure(),isArray:!0,isOptional:!0}}}),d=t(`ExportStatus`,[`pending`,`processing`,`completed`,`failed`]),f=i({name:`AuditExportOutput`,description:`Output from initiating an audit export`,fields:{exportId:{type:e.String_unsecure(),isOptional:!1},status:{type:d,isOptional:!1},downloadUrl:{type:e.URL(),isOptional:!0}}}),p=i({name:`AuditStatsInput`,description:`Input for getting audit statistics`,fields:{orgId:{type:e.String_unsecure(),isOptional:!0},from:{type:e.DateTime(),isOptional:!0},to:{type:e.DateTime(),isOptional:!0}}}),m=i({name:`AuditStatsOutput`,description:`Audit log statistics`,fields:{totalLogs:{type:e.Int_unsecure(),isOptional:!1},uniqueActors:{type:e.Int_unsecure(),isOptional:!1},uniqueTargets:{type:e.Int_unsecure(),isOptional:!1},eventCounts:{type:e.JSONObject(),isOptional:!1}}}),h=r({meta:{name:`audit.logs.query`,version:1,stability:`stable`,owners:[...a],tags:[`audit`,`logs`,`query`],description:`Query audit logs with filters.`,goal:`Enable searching and filtering of audit history.`,context:`Admin dashboard, compliance reporting, debugging.`},io:{input:s,output:c},policy:{auth:`admin`}}),g=r({meta:{name:`audit.logs.get`,version:1,stability:`stable`,owners:[...a],tags:[`audit`,`logs`,`get`],description:`Get a specific audit log by ID.`,goal:`View detailed audit log entry.`,context:`Log detail view.`},io:{input:i({name:`GetAuditLogInput`,fields:{logId:{type:e.String_unsecure(),isOptional:!1}}}),output:o},policy:{auth:`admin`}}),_=r({meta:{name:`audit.trace.get`,version:1,stability:`stable`,owners:[...a],tags:[`audit`,`trace`,`get`],description:`Get all audit logs for a trace.`,goal:`View complete request trace for debugging.`,context:`Request tracing, debugging.`},io:{input:i({name:`GetAuditTraceInput`,fields:{traceId:{type:e.String_unsecure(),isOptional:!1}}}),output:i({name:`GetAuditTraceOutput`,fields:{logs:{type:o,isArray:!0,isOptional:!1}}})},policy:{auth:`admin`}}),v=n({meta:{name:`audit.logs.export`,version:1,stability:`stable`,owners:[...a],tags:[`audit`,`logs`,`export`],description:`Export audit logs for compliance reporting.`,goal:`Generate audit reports for compliance.`,context:`Compliance reporting, external audits.`},io:{input:u,output:f},policy:{auth:`admin`}}),y=r({meta:{name:`audit.stats`,version:1,stability:`stable`,owners:[...a],tags:[`audit`,`stats`],description:`Get audit log statistics.`,goal:`Monitor audit activity levels.`,context:`Admin dashboard, monitoring.`},io:{input:p,output:m},policy:{auth:`admin`}});export{u as AuditExportInputModel,f as AuditExportOutputModel,o as AuditLogModel,s as AuditQueryInputModel,c as AuditQueryOutputModel,p as AuditStatsInputModel,m as AuditStatsOutputModel,v as ExportAuditLogsContract,l as ExportFormatEnum,d as ExportStatusEnum,g as GetAuditLogContract,y as GetAuditStatsContract,_ as GetAuditTraceContract,h as QueryAuditLogsContract};
|
package/dist/entities/index.js
CHANGED
|
@@ -1,126 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../libs/schema/dist/index.js";
|
|
3
|
-
|
|
4
|
-
//#region src/entities/index.ts
|
|
5
|
-
/**
|
|
6
|
-
* AuditLog entity - main audit log entry.
|
|
7
|
-
*/
|
|
8
|
-
const AuditLogEntity = defineEntity({
|
|
9
|
-
name: "AuditLog",
|
|
10
|
-
description: "Audit log entry for tracking system events.",
|
|
11
|
-
schema: "lssm_audit",
|
|
12
|
-
map: "audit_log",
|
|
13
|
-
fields: {
|
|
14
|
-
id: field.id({ description: "Unique audit log ID" }),
|
|
15
|
-
eventName: field.string({ description: "Event name/type" }),
|
|
16
|
-
eventVersion: field.int({ description: "Event version" }),
|
|
17
|
-
payload: field.json({ description: "Event payload (may be redacted)" }),
|
|
18
|
-
actorId: field.string({
|
|
19
|
-
isOptional: true,
|
|
20
|
-
description: "User/service that triggered the event"
|
|
21
|
-
}),
|
|
22
|
-
actorType: field.string({
|
|
23
|
-
isOptional: true,
|
|
24
|
-
description: "Actor type (user, system, service)"
|
|
25
|
-
}),
|
|
26
|
-
actorEmail: field.string({
|
|
27
|
-
isOptional: true,
|
|
28
|
-
description: "Actor email (for searchability)"
|
|
29
|
-
}),
|
|
30
|
-
targetId: field.string({
|
|
31
|
-
isOptional: true,
|
|
32
|
-
description: "Resource affected by the event"
|
|
33
|
-
}),
|
|
34
|
-
targetType: field.string({
|
|
35
|
-
isOptional: true,
|
|
36
|
-
description: "Resource type"
|
|
37
|
-
}),
|
|
38
|
-
orgId: field.string({
|
|
39
|
-
isOptional: true,
|
|
40
|
-
description: "Organization context"
|
|
41
|
-
}),
|
|
42
|
-
tenantId: field.string({
|
|
43
|
-
isOptional: true,
|
|
44
|
-
description: "Tenant context"
|
|
45
|
-
}),
|
|
46
|
-
traceId: field.string({
|
|
47
|
-
isOptional: true,
|
|
48
|
-
description: "Distributed trace ID"
|
|
49
|
-
}),
|
|
50
|
-
spanId: field.string({
|
|
51
|
-
isOptional: true,
|
|
52
|
-
description: "Span ID"
|
|
53
|
-
}),
|
|
54
|
-
requestId: field.string({
|
|
55
|
-
isOptional: true,
|
|
56
|
-
description: "Request ID"
|
|
57
|
-
}),
|
|
58
|
-
sessionId: field.string({
|
|
59
|
-
isOptional: true,
|
|
60
|
-
description: "Session ID"
|
|
61
|
-
}),
|
|
62
|
-
clientIp: field.string({
|
|
63
|
-
isOptional: true,
|
|
64
|
-
description: "Client IP address"
|
|
65
|
-
}),
|
|
66
|
-
userAgent: field.string({
|
|
67
|
-
isOptional: true,
|
|
68
|
-
description: "User agent string"
|
|
69
|
-
}),
|
|
70
|
-
tags: field.json({
|
|
71
|
-
isOptional: true,
|
|
72
|
-
description: "Custom tags for filtering"
|
|
73
|
-
}),
|
|
74
|
-
metadata: field.json({
|
|
75
|
-
isOptional: true,
|
|
76
|
-
description: "Additional metadata"
|
|
77
|
-
}),
|
|
78
|
-
occurredAt: field.dateTime({ description: "When the event occurred" }),
|
|
79
|
-
recordedAt: field.createdAt({ description: "When the log was recorded" })
|
|
80
|
-
},
|
|
81
|
-
indexes: [
|
|
82
|
-
index.on(["actorId", "occurredAt"]),
|
|
83
|
-
index.on(["targetId", "occurredAt"]),
|
|
84
|
-
index.on(["orgId", "occurredAt"]),
|
|
85
|
-
index.on(["eventName", "occurredAt"]),
|
|
86
|
-
index.on(["traceId"]),
|
|
87
|
-
index.on(["occurredAt"])
|
|
88
|
-
]
|
|
89
|
-
});
|
|
90
|
-
/**
|
|
91
|
-
* AuditLogArchive entity - archived logs for long-term retention.
|
|
92
|
-
*/
|
|
93
|
-
const AuditLogArchiveEntity = defineEntity({
|
|
94
|
-
name: "AuditLogArchive",
|
|
95
|
-
description: "Archived audit logs for long-term retention.",
|
|
96
|
-
schema: "lssm_audit",
|
|
97
|
-
map: "audit_log_archive",
|
|
98
|
-
fields: {
|
|
99
|
-
id: field.id(),
|
|
100
|
-
batchId: field.string({ description: "Archive batch ID" }),
|
|
101
|
-
logCount: field.int({ description: "Number of logs in batch" }),
|
|
102
|
-
fromDate: field.dateTime({ description: "Earliest log in batch" }),
|
|
103
|
-
toDate: field.dateTime({ description: "Latest log in batch" }),
|
|
104
|
-
storagePath: field.string({ description: "Path to archived data" }),
|
|
105
|
-
storageType: field.string({ description: "Storage type (s3, gcs, file)" }),
|
|
106
|
-
compressedSize: field.int({ description: "Compressed size in bytes" }),
|
|
107
|
-
checksum: field.string({ description: "SHA-256 checksum" }),
|
|
108
|
-
retainUntil: field.dateTime({ description: "When archive can be deleted" }),
|
|
109
|
-
createdAt: field.createdAt()
|
|
110
|
-
},
|
|
111
|
-
indexes: [index.on(["fromDate", "toDate"]), index.on(["retainUntil"])]
|
|
112
|
-
});
|
|
113
|
-
/**
|
|
114
|
-
* All audit trail entities for schema composition.
|
|
115
|
-
*/
|
|
116
|
-
const auditTrailEntities = [AuditLogEntity, AuditLogArchiveEntity];
|
|
117
|
-
/**
|
|
118
|
-
* Module schema contribution for audit trail.
|
|
119
|
-
*/
|
|
120
|
-
const auditTrailSchemaContribution = {
|
|
121
|
-
moduleId: "@lssm/module.audit-trail",
|
|
122
|
-
entities: auditTrailEntities
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
//#endregion
|
|
126
|
-
export { AuditLogArchiveEntity, AuditLogEntity, auditTrailEntities, auditTrailSchemaContribution };
|
|
1
|
+
import{defineEntity as e,field as t,index as n}from"@lssm/lib.schema";const r=e({name:`AuditLog`,description:`Audit log entry for tracking system events.`,schema:`lssm_audit`,map:`audit_log`,fields:{id:t.id({description:`Unique audit log ID`}),eventName:t.string({description:`Event name/type`}),eventVersion:t.int({description:`Event version`}),payload:t.json({description:`Event payload (may be redacted)`}),actorId:t.string({isOptional:!0,description:`User/service that triggered the event`}),actorType:t.string({isOptional:!0,description:`Actor type (user, system, service)`}),actorEmail:t.string({isOptional:!0,description:`Actor email (for searchability)`}),targetId:t.string({isOptional:!0,description:`Resource affected by the event`}),targetType:t.string({isOptional:!0,description:`Resource type`}),orgId:t.string({isOptional:!0,description:`Organization context`}),tenantId:t.string({isOptional:!0,description:`Tenant context`}),traceId:t.string({isOptional:!0,description:`Distributed trace ID`}),spanId:t.string({isOptional:!0,description:`Span ID`}),requestId:t.string({isOptional:!0,description:`Request ID`}),sessionId:t.string({isOptional:!0,description:`Session ID`}),clientIp:t.string({isOptional:!0,description:`Client IP address`}),userAgent:t.string({isOptional:!0,description:`User agent string`}),tags:t.json({isOptional:!0,description:`Custom tags for filtering`}),metadata:t.json({isOptional:!0,description:`Additional metadata`}),occurredAt:t.dateTime({description:`When the event occurred`}),recordedAt:t.createdAt({description:`When the log was recorded`})},indexes:[n.on([`actorId`,`occurredAt`]),n.on([`targetId`,`occurredAt`]),n.on([`orgId`,`occurredAt`]),n.on([`eventName`,`occurredAt`]),n.on([`traceId`]),n.on([`occurredAt`])]}),i=e({name:`AuditLogArchive`,description:`Archived audit logs for long-term retention.`,schema:`lssm_audit`,map:`audit_log_archive`,fields:{id:t.id(),batchId:t.string({description:`Archive batch ID`}),logCount:t.int({description:`Number of logs in batch`}),fromDate:t.dateTime({description:`Earliest log in batch`}),toDate:t.dateTime({description:`Latest log in batch`}),storagePath:t.string({description:`Path to archived data`}),storageType:t.string({description:`Storage type (s3, gcs, file)`}),compressedSize:t.int({description:`Compressed size in bytes`}),checksum:t.string({description:`SHA-256 checksum`}),retainUntil:t.dateTime({description:`When archive can be deleted`}),createdAt:t.createdAt()},indexes:[n.on([`fromDate`,`toDate`]),n.on([`retainUntil`])]}),a=[r,i],o={moduleId:`@lssm/module.audit-trail`,entities:a};export{i as AuditLogArchiveEntity,r as AuditLogEntity,a as auditTrailEntities,o as auditTrailSchemaContribution};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { AuditLogArchiveEntity, AuditLogEntity, auditTrailEntities, auditTrailSchemaContribution } from "./entities/index.js";
|
|
3
|
-
import { AuditExportInputModel, AuditExportOutputModel, AuditLogModel, AuditQueryInputModel, AuditQueryOutputModel, AuditStatsInputModel, AuditStatsOutputModel, ExportAuditLogsContract, ExportFormatEnum, ExportStatusEnum, GetAuditLogContract, GetAuditStatsContract, GetAuditTraceContract, QueryAuditLogsContract } from "./contracts/index.js";
|
|
4
|
-
import { InMemoryAuditStorage, RetentionPolicy, createInMemoryAuditStorage } from "./storage/index.js";
|
|
5
|
-
|
|
6
|
-
export { AuditExportInputModel, AuditExportOutputModel, AuditLogArchiveEntity, AuditLogEntity, AuditLogModel, AuditQueryInputModel, AuditQueryOutputModel, AuditStatsInputModel, AuditStatsOutputModel, AuditTrailFeature, ExportAuditLogsContract, ExportFormatEnum, ExportStatusEnum, GetAuditLogContract, GetAuditStatsContract, GetAuditTraceContract, InMemoryAuditStorage, QueryAuditLogsContract, RetentionPolicy, auditTrailEntities, auditTrailSchemaContribution, createInMemoryAuditStorage };
|
|
1
|
+
import{AuditTrailFeature as e}from"./audit-trail.feature.js";import{AuditLogArchiveEntity as t,AuditLogEntity as n,auditTrailEntities as r,auditTrailSchemaContribution as i}from"./entities/index.js";import{AuditExportInputModel as a,AuditExportOutputModel as o,AuditLogModel as s,AuditQueryInputModel as c,AuditQueryOutputModel as l,AuditStatsInputModel as u,AuditStatsOutputModel as d,ExportAuditLogsContract as f,ExportFormatEnum as p,ExportStatusEnum as m,GetAuditLogContract as h,GetAuditStatsContract as g,GetAuditTraceContract as _,QueryAuditLogsContract as v}from"./contracts/index.js";import{InMemoryAuditStorage as y,RetentionPolicy as b,createInMemoryAuditStorage as x}from"./storage/index.js";export{a as AuditExportInputModel,o as AuditExportOutputModel,t as AuditLogArchiveEntity,n as AuditLogEntity,s as AuditLogModel,c as AuditQueryInputModel,l as AuditQueryOutputModel,u as AuditStatsInputModel,d as AuditStatsOutputModel,e as AuditTrailFeature,f as ExportAuditLogsContract,p as ExportFormatEnum,m as ExportStatusEnum,h as GetAuditLogContract,g as GetAuditStatsContract,_ as GetAuditTraceContract,y as InMemoryAuditStorage,v as QueryAuditLogsContract,b as RetentionPolicy,r as auditTrailEntities,i as auditTrailSchemaContribution,x as createInMemoryAuditStorage};
|
package/dist/storage/index.js
CHANGED
|
@@ -1,105 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* In-memory audit storage for development/testing.
|
|
4
|
-
*/
|
|
5
|
-
var InMemoryAuditStorage = class {
|
|
6
|
-
records = [];
|
|
7
|
-
async store(record) {
|
|
8
|
-
this.records.push(record);
|
|
9
|
-
}
|
|
10
|
-
async query(options) {
|
|
11
|
-
let results = [...this.records];
|
|
12
|
-
if (options.eventName) {
|
|
13
|
-
const pattern = options.eventName.replace(/\*/g, ".*");
|
|
14
|
-
const regex = /* @__PURE__ */ new RegExp(`^${pattern}$`);
|
|
15
|
-
results = results.filter((r) => regex.test(r.eventName));
|
|
16
|
-
}
|
|
17
|
-
if (options.actorId) results = results.filter((r) => r.metadata?.actorId === options.actorId);
|
|
18
|
-
if (options.targetId) results = results.filter((r) => r.metadata?.targetId === options.targetId);
|
|
19
|
-
if (options.targetType) results = results.filter((r) => r.metadata?.targetType === options.targetType);
|
|
20
|
-
if (options.orgId) results = results.filter((r) => r.metadata?.orgId === options.orgId);
|
|
21
|
-
if (options.traceId) results = results.filter((r) => r.traceId === options.traceId);
|
|
22
|
-
if (options.from) results = results.filter((r) => new Date(r.occurredAt) >= options.from);
|
|
23
|
-
if (options.to) results = results.filter((r) => new Date(r.occurredAt) <= options.to);
|
|
24
|
-
const orderBy = options.orderBy ?? "occurredAt";
|
|
25
|
-
const orderDir = options.orderDir ?? "desc";
|
|
26
|
-
results.sort((a, b) => {
|
|
27
|
-
const aTime = orderBy === "occurredAt" ? new Date(a.occurredAt).getTime() : a.recordedAt.getTime();
|
|
28
|
-
const bTime = orderBy === "occurredAt" ? new Date(b.occurredAt).getTime() : b.recordedAt.getTime();
|
|
29
|
-
return orderDir === "desc" ? bTime - aTime : aTime - bTime;
|
|
30
|
-
});
|
|
31
|
-
const offset = options.offset ?? 0;
|
|
32
|
-
const limit = options.limit ?? 100;
|
|
33
|
-
return results.slice(offset, offset + limit);
|
|
34
|
-
}
|
|
35
|
-
async count(options) {
|
|
36
|
-
return (await this.query({
|
|
37
|
-
...options,
|
|
38
|
-
limit: Infinity
|
|
39
|
-
})).length;
|
|
40
|
-
}
|
|
41
|
-
async getById(id) {
|
|
42
|
-
return this.records.find((r) => r.id === id) ?? null;
|
|
43
|
-
}
|
|
44
|
-
async getByTraceId(traceId) {
|
|
45
|
-
return this.query({ traceId });
|
|
46
|
-
}
|
|
47
|
-
async deleteOlderThan(date) {
|
|
48
|
-
const before = this.records.length;
|
|
49
|
-
this.records = this.records.filter((r) => new Date(r.occurredAt) >= date);
|
|
50
|
-
return before - this.records.length;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Get all records (for testing).
|
|
54
|
-
*/
|
|
55
|
-
getAll() {
|
|
56
|
-
return [...this.records];
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Clear all records (for testing).
|
|
60
|
-
*/
|
|
61
|
-
clear() {
|
|
62
|
-
this.records = [];
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Retention policy manager.
|
|
67
|
-
*/
|
|
68
|
-
var RetentionPolicy = class {
|
|
69
|
-
constructor(config) {
|
|
70
|
-
this.config = config;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Get the cutoff date for hot storage.
|
|
74
|
-
*/
|
|
75
|
-
getHotCutoff() {
|
|
76
|
-
const cutoff = /* @__PURE__ */ new Date();
|
|
77
|
-
cutoff.setDate(cutoff.getDate() - this.config.hotRetentionDays);
|
|
78
|
-
return cutoff;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Get the cutoff date for archive storage.
|
|
82
|
-
*/
|
|
83
|
-
getArchiveCutoff() {
|
|
84
|
-
if (!this.config.archiveRetentionDays) return null;
|
|
85
|
-
const cutoff = /* @__PURE__ */ new Date();
|
|
86
|
-
cutoff.setDate(cutoff.getDate() - this.config.archiveRetentionDays);
|
|
87
|
-
return cutoff;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Apply retention policy to storage.
|
|
91
|
-
*/
|
|
92
|
-
async apply(storage) {
|
|
93
|
-
const cutoff = this.getHotCutoff();
|
|
94
|
-
return { deletedCount: await storage.deleteOlderThan(cutoff) };
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* Create an in-memory audit storage.
|
|
99
|
-
*/
|
|
100
|
-
function createInMemoryAuditStorage() {
|
|
101
|
-
return new InMemoryAuditStorage();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
//#endregion
|
|
105
|
-
export { InMemoryAuditStorage, RetentionPolicy, createInMemoryAuditStorage };
|
|
1
|
+
var e=class{records=[];async store(e){this.records.push(e)}async query(e){let t=[...this.records];if(e.eventName){let n=e.eventName.replace(/\*/g,`.*`),r=RegExp(`^${n}$`);t=t.filter(e=>r.test(e.eventName))}e.actorId&&(t=t.filter(t=>t.metadata?.actorId===e.actorId)),e.targetId&&(t=t.filter(t=>t.metadata?.targetId===e.targetId)),e.targetType&&(t=t.filter(t=>t.metadata?.targetType===e.targetType)),e.orgId&&(t=t.filter(t=>t.metadata?.orgId===e.orgId)),e.traceId&&(t=t.filter(t=>t.traceId===e.traceId)),e.from&&(t=t.filter(t=>new Date(t.occurredAt)>=e.from)),e.to&&(t=t.filter(t=>new Date(t.occurredAt)<=e.to));let n=e.orderBy??`occurredAt`,r=e.orderDir??`desc`;t.sort((e,t)=>{let i=n===`occurredAt`?new Date(e.occurredAt).getTime():e.recordedAt.getTime(),a=n===`occurredAt`?new Date(t.occurredAt).getTime():t.recordedAt.getTime();return r===`desc`?a-i:i-a});let i=e.offset??0,a=e.limit??100;return t.slice(i,i+a)}async count(e){return(await this.query({...e,limit:1/0})).length}async getById(e){return this.records.find(t=>t.id===e)??null}async getByTraceId(e){return this.query({traceId:e})}async deleteOlderThan(e){let t=this.records.length;return this.records=this.records.filter(t=>new Date(t.occurredAt)>=e),t-this.records.length}getAll(){return[...this.records]}clear(){this.records=[]}},t=class{constructor(e){this.config=e}getHotCutoff(){let e=new Date;return e.setDate(e.getDate()-this.config.hotRetentionDays),e}getArchiveCutoff(){if(!this.config.archiveRetentionDays)return null;let e=new Date;return e.setDate(e.getDate()-this.config.archiveRetentionDays),e}async apply(e){let t=this.getHotCutoff();return{deletedCount:await e.deleteOlderThan(t)}}};function n(){return new e}export{e as InMemoryAuditStorage,t as RetentionPolicy,n as createInMemoryAuditStorage};
|