@sphereon/ssi-sdk.event-logger 0.30.2-unstable.8 → 0.31.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/README.md CHANGED
@@ -17,11 +17,15 @@ There are also functions that can be manually called to persist events. Current,
17
17
 
18
18
  Ideally this plugin should be used in combination with the event logger from our core package. This event logger will also default debug the events.
19
19
  This is mainly as a fallback for when no listener is present within the agent.
20
+ You can also store (credential) activity logs. which gets information related to a credential and the action that has performed on it.
20
21
 
21
22
  ## Available functions
22
23
 
23
24
  - loggerGetAuditEvents
24
25
  - loggerStoreAuditEvent
26
+ - loggerLogGeneralEvent
27
+ - loggerLogActivityEvent
28
+ - loggerGetActivityEvents
25
29
 
26
30
  ## Usage
27
31
 
@@ -1,6 +1,6 @@
1
- import { IAgentPlugin } from '@veramo/core';
2
1
  import { Loggers, LoggingEventType } from '@sphereon/ssi-types';
3
- import { EventLoggerOptions, IEventLogger, RequiredContext, LoggingEvent } from '../types/IEventLogger';
2
+ import { IAgentPlugin } from '@veramo/core';
3
+ import { EventLoggerOptions, IEventLogger, LoggingEvent, RequiredContext } from '../types/IEventLogger';
4
4
  /**
5
5
  * {@inheritDoc IEventLogger}
6
6
  */
@@ -15,7 +15,9 @@ export declare class EventLogger implements IAgentPlugin {
15
15
  constructor(options: EventLoggerOptions);
16
16
  onEvent(event: LoggingEvent, context: RequiredContext): Promise<void>;
17
17
  private loggerGetAuditEvents;
18
+ private loggerGetActivityEvents;
18
19
  private loggerLogGeneralEvent;
19
20
  private loggerLogAuditEvent;
21
+ private loggerLogActivityEvent;
20
22
  }
21
23
  //# sourceMappingURL=EventLogger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EventLogger.d.ts","sourceRoot":"","sources":["../../src/agent/EventLogger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAuB,M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K,CAAC,gBAAgB,CAAC,CAAK;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAA0B;IACjD,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAA;IAE/B,QAAQ,CAAC,OAAO,EAAE,YAAY,CAM7B;gBAEW,OAAO,EAAE,kBAAkB;IAuB1B,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;YAoBpE,oBAAoB;YAUpB,uBAAuB;YAUvB,qBAAqB;YAOrB,mBAAmB;YAoBnB,sBAAsB;CAmBrC"}
@@ -17,7 +17,13 @@ const index_1 = require("../index");
17
17
  * {@inheritDoc IEventLogger}
18
18
  */
19
19
  // Exposing the methods here for any REST implementation
20
- exports.eventLoggerAuditMethods = ['loggerGetAuditEvents', 'loggerLogAuditEvent', 'loggerLogGeneralEvent'];
20
+ exports.eventLoggerAuditMethods = [
21
+ 'loggerGetAuditEvents',
22
+ 'loggerLogAuditEvent',
23
+ 'loggerLogGeneralEvent',
24
+ 'loggerLogActivityEvent',
25
+ 'loggerGetActivityEvents',
26
+ ];
21
27
  exports.eventLoggerMethods = [...exports.eventLoggerAuditMethods];
22
28
  class EventLogger {
23
29
  constructor(options) {
@@ -28,6 +34,8 @@ class EventLogger {
28
34
  loggerGetAuditEvents: this.loggerGetAuditEvents.bind(this),
29
35
  loggerLogAuditEvent: this.loggerLogAuditEvent.bind(this),
30
36
  loggerLogGeneralEvent: this.loggerLogGeneralEvent.bind(this),
37
+ loggerLogActivityEvent: this.loggerLogActivityEvent.bind(this),
38
+ loggerGetActivityEvents: this.loggerGetActivityEvents.bind(this),
31
39
  };
32
40
  const { store, eventTypes } = options;
33
41
  const generalOpts = (_a = options.general) !== null && _a !== void 0 ? _a : { debugPkg: true };
@@ -61,6 +69,10 @@ class EventLogger {
61
69
  // TODO: We might also want to do this locally though, as these logs are not persisted typically
62
70
  yield context.agent.loggerLogGeneralEvent({ event: event.data });
63
71
  break;
72
+ case ssi_types_1.LoggingEventType.ACTIVITY:
73
+ // Calling the context of the agent to make sure the REST client is called when configured
74
+ yield context.agent.loggerLogActivityEvent({ event: event.data });
75
+ break;
64
76
  default:
65
77
  return Promise.reject(Error(`Event type ${event.type} not supported`));
66
78
  }
@@ -75,6 +87,15 @@ class EventLogger {
75
87
  return this.store.getAuditEvents({ filter });
76
88
  });
77
89
  }
90
+ loggerGetActivityEvents(args) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ const { filter } = args !== null && args !== void 0 ? args : {};
93
+ if (!this.store) {
94
+ return Promise.reject(Error('No store available in options'));
95
+ }
96
+ return this.store.getActivityEvents({ filter });
97
+ });
98
+ }
78
99
  loggerLogGeneralEvent(args) {
79
100
  return __awaiter(this, void 0, void 0, function* () {
80
101
  var _a;
@@ -95,6 +116,18 @@ class EventLogger {
95
116
  });
96
117
  });
97
118
  }
119
+ loggerLogActivityEvent(args) {
120
+ return __awaiter(this, void 0, void 0, function* () {
121
+ var _a, _b;
122
+ const { event } = args;
123
+ if (!this.store) {
124
+ return Promise.reject(Error('No store available in options'));
125
+ }
126
+ return this.store.storeActivityEvent({
127
+ event: Object.assign(Object.assign({}, event), { system: event.system, subSystemType: event.subSystemType, initiatorType: event.initiatorType, level: (_a = event.level) !== null && _a !== void 0 ? _a : ssi_types_1.LogLevel.INFO, correlationId: (_b = event.correlationId) !== null && _b !== void 0 ? _b : (0, uuid_1.v4)(), timestamp: new Date() }),
128
+ });
129
+ });
130
+ }
98
131
  }
99
132
  exports.EventLogger = EventLogger;
100
133
  //# sourceMappingURL=EventLogger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EventLogger.js","sourceRoot":"","sources":["../../src/agent/EventLogger.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,mDAAoF;AAEpF,+BAAmC;AACnC,oCAAgE;AAGhE;;GAEG;AAEH,wDAAwD;AAC3C,QAAA,uBAAuB,GAAkB,CAAC,sBAAsB,EAAE,qBAAqB,EAAE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+B,CAAC,CAAC,CAAA;YAC/D,CAAC;YAED,OAAO,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC;gBACnC,KAAK,kCACA,KAAK,KACR,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,aAAa,EAAE,KAAK,CAAC,aAAa,EAClC,aAAa,EAAE,KAAK,CAAC,aAAa,EAClC,KAAK,EAAE,MAAA,KAAK,CAAC,KAAK,mCAAI,oBAAQ,CAAC,IAAI,EACnC,aAAa,EAAE,MAAA,KAAK,CAAC,aAAa,mCAAI,IAAA,SAAM,GAAE,EAC9C,SAAS,EAAE,IAAI,IAAI,EAAE,GACtB;aACF,CAAC,CAAA;QACJ,CAAC;KAAA;CACF;AA3HD,kCA2HC"}
@@ -1,5 +1,8 @@
1
1
  import { AbstractEventLoggerStore } from '@sphereon/ssi-sdk.data-store';
2
+ import { ActivityLoggingEvent } from '@sphereon/ssi-sdk.core';
2
3
  import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core';
4
+ import { CredentialType } from '@sphereon/ssi-sdk.core';
5
+ import { FindActivityLoggingEventArgs } from '@sphereon/ssi-sdk.data-store';
3
6
  import { FindAuditLoggingEventArgs } from '@sphereon/ssi-sdk.data-store';
4
7
  import { IAgentContext } from '@veramo/core';
5
8
  import { IAgentPlugin } from '@veramo/core';
@@ -8,6 +11,7 @@ import { IPluginMethodMap } from '@veramo/core';
8
11
  import { Loggers } from '@sphereon/ssi-types';
9
12
  import { LoggingEventType } from '@sphereon/ssi-types';
10
13
  import { LogLevel } from '@sphereon/ssi-types';
14
+ import { NonPersistedActivityLoggingEvent as NonPersistedActivityLoggingEvent_2 } from '@sphereon/ssi-sdk.core';
11
15
  import { NonPersistedAuditLoggingEvent as NonPersistedAuditLoggingEvent_2 } from '@sphereon/ssi-sdk.core';
12
16
  import { SubSystem } from '@sphereon/ssi-types';
13
17
  import { System } from '@sphereon/ssi-types';
@@ -21,8 +25,10 @@ export declare class EventLogger implements IAgentPlugin {
21
25
  constructor(options: EventLoggerOptions);
22
26
  onEvent(event: LoggingEvent, context: RequiredContext): Promise<void>;
23
27
  private loggerGetAuditEvents;
28
+ private loggerGetActivityEvents;
24
29
  private loggerLogGeneralEvent;
25
30
  private loggerLogAuditEvent;
31
+ private loggerLogActivityEvent;
26
32
  }
27
33
 
28
34
  /**
@@ -46,23 +52,51 @@ export declare type EventLoggerOptions = {
46
52
  general?: EventLoggerGeneralLogOpts;
47
53
  };
48
54
 
55
+ export declare type GetActivityEventsArgs = {
56
+ filter?: FindActivityLoggingEventArgs;
57
+ };
58
+
49
59
  export declare type GetAuditEventsArgs = {
50
60
  filter?: FindAuditLoggingEventArgs;
51
61
  };
52
62
 
53
63
  export declare interface IEventLogger extends IPluginMethodMap {
54
64
  loggerGetAuditEvents(args?: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>>;
55
- loggerLogAuditEvent(args: LogAuditEventArgs, context: RequiredContext): Promise<AuditLoggingEvent>;
56
- loggerLogGeneralEvent(args: LogAuditEventArgs, context: RequiredContext): Promise<NonPersistedAuditLoggingEvent>;
65
+ loggerLogAuditEvent(args: LogEventArgs, context: RequiredContext): Promise<AuditLoggingEvent>;
66
+ loggerLogGeneralEvent(args: LogEventArgs, context: RequiredContext): Promise<LogEventType>;
67
+ loggerLogActivityEvent(args: LogEventArgs, context: RequiredContext): Promise<ActivityLoggingEvent>;
68
+ loggerGetActivityEvents(args?: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>>;
57
69
  }
58
70
 
71
+ export declare type LogActivityEventArgs = {
72
+ event: NonPersistedActivityLoggingEvent;
73
+ };
74
+
59
75
  export declare type LogAuditEventArgs = {
60
76
  event: NonPersistedAuditLoggingEvent;
61
77
  };
62
78
 
79
+ export declare type LogEventArgs = {
80
+ event: LogEventType;
81
+ };
82
+
83
+ export declare type LogEventType = NonPersistedAuditLoggingEvent | NonPersistedActivityLoggingEvent;
84
+
63
85
  export declare type LoggingEvent = {
64
86
  type: LoggingEventType;
65
- data: NonPersistedAuditLoggingEvent;
87
+ data: LogEventType;
88
+ };
89
+
90
+ export declare type NonPersistedActivityLoggingEvent = Omit<NonPersistedActivityLoggingEvent_2, 'system' | 'subSystemType' | 'initiatorType'> & {
91
+ system: System;
92
+ subSystemType: SubSystem;
93
+ initiatorType: InitiatorType;
94
+ originalCredential?: string;
95
+ credentialHash?: string;
96
+ parentCredentialHash?: string;
97
+ credentialType?: CredentialType;
98
+ sharePurpose?: string;
99
+ data?: any;
66
100
  };
67
101
 
68
102
  export declare type NonPersistedAuditLoggingEvent = Omit<NonPersistedAuditLoggingEvent_2, 'system' | 'subSystemType' | 'initiatorType'> & {
@@ -1,11 +1,13 @@
1
1
  import { InitiatorType, LoggingEventType, LogLevel, SubSystem, System } from '@sphereon/ssi-types';
2
+ import { AuditLoggingEvent, CredentialType, NonPersistedAuditLoggingEvent as NPAuditLoggingEvent, NonPersistedActivityLoggingEvent as NPActivityLoggingEvent, ActivityLoggingEvent } from '@sphereon/ssi-sdk.core';
3
+ import { AbstractEventLoggerStore, FindActivityLoggingEventArgs, FindAuditLoggingEventArgs } from '@sphereon/ssi-sdk.data-store';
2
4
  import { IAgentContext, IPluginMethodMap } from '@veramo/core';
3
- import { AuditLoggingEvent, NonPersistedAuditLoggingEvent as NPAuditLoggingEvent } from '@sphereon/ssi-sdk.core';
4
- import { AbstractEventLoggerStore, FindAuditLoggingEventArgs } from '@sphereon/ssi-sdk.data-store';
5
5
  export interface IEventLogger extends IPluginMethodMap {
6
6
  loggerGetAuditEvents(args?: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>>;
7
- loggerLogAuditEvent(args: LogAuditEventArgs, context: RequiredContext): Promise<AuditLoggingEvent>;
8
- loggerLogGeneralEvent(args: LogAuditEventArgs, context: RequiredContext): Promise<NonPersistedAuditLoggingEvent>;
7
+ loggerLogAuditEvent(args: LogEventArgs, context: RequiredContext): Promise<AuditLoggingEvent>;
8
+ loggerLogGeneralEvent(args: LogEventArgs, context: RequiredContext): Promise<LogEventType>;
9
+ loggerLogActivityEvent(args: LogEventArgs, context: RequiredContext): Promise<ActivityLoggingEvent>;
10
+ loggerGetActivityEvents(args?: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>>;
9
11
  }
10
12
  export interface EventLoggerGeneralLogOpts {
11
13
  debugPkg?: boolean;
@@ -22,17 +24,38 @@ export type EventLoggerOptions = {
22
24
  export type GetAuditEventsArgs = {
23
25
  filter?: FindAuditLoggingEventArgs;
24
26
  };
27
+ export type GetActivityEventsArgs = {
28
+ filter?: FindActivityLoggingEventArgs;
29
+ };
30
+ export type LogEventArgs = {
31
+ event: LogEventType;
32
+ };
33
+ export type LogEventType = NonPersistedAuditLoggingEvent | NonPersistedActivityLoggingEvent;
25
34
  export type LogAuditEventArgs = {
26
35
  event: NonPersistedAuditLoggingEvent;
27
36
  };
37
+ export type LogActivityEventArgs = {
38
+ event: NonPersistedActivityLoggingEvent;
39
+ };
28
40
  export type NonPersistedAuditLoggingEvent = Omit<NPAuditLoggingEvent, 'system' | 'subSystemType' | 'initiatorType'> & {
29
41
  system: System;
30
42
  subSystemType: SubSystem;
31
43
  initiatorType: InitiatorType;
32
44
  };
45
+ export type NonPersistedActivityLoggingEvent = Omit<NPActivityLoggingEvent, 'system' | 'subSystemType' | 'initiatorType'> & {
46
+ system: System;
47
+ subSystemType: SubSystem;
48
+ initiatorType: InitiatorType;
49
+ originalCredential?: string;
50
+ credentialHash?: string;
51
+ parentCredentialHash?: string;
52
+ credentialType?: CredentialType;
53
+ sharePurpose?: string;
54
+ data?: any;
55
+ };
33
56
  export type LoggingEvent = {
34
57
  type: LoggingEventType;
35
- data: NonPersistedAuditLoggingEvent;
58
+ data: LogEventType;
36
59
  };
37
60
  export type RequiredContext = IAgentContext<IEventLogger>;
38
61
  //# sourceMappingURL=IEventLogger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IEventLogger.d.ts","sourceRoot":"","sources":["../../src/types/IEventLogger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,a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,GAAG,eAAe,GAAG,eAAe,CAAC,GAAG;IAC1H,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,SAAS,CAAA;IACxB,aAAa,EAAE,aAAa,CAAA;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,GAAG,CAAA;CACX,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,gBAAgB,CAAA;IACtB,IAAI,EAAE,YAAY,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC,YAAY,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk.event-logger",
3
- "version": "0.30.2-unstable.8+7f19535f",
3
+ "version": "0.31.0",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,13 +15,13 @@
15
15
  "generate-plugin-schema": "ts-node ../../packages/dev/bin/sphereon.js dev generate-plugin-schema"
16
16
  },
17
17
  "dependencies": {
18
- "@sphereon/ssi-sdk.data-store": "0.30.2-unstable.8+7f19535f",
19
- "@sphereon/ssi-types": "0.30.2-unstable.8+7f19535f",
18
+ "@sphereon/ssi-sdk.data-store": "0.31.0",
19
+ "@sphereon/ssi-types": "0.31.0",
20
20
  "uuid": "^9.0.1"
21
21
  },
22
22
  "devDependencies": {
23
- "@sphereon/ssi-sdk.agent-config": "0.30.2-unstable.8+7f19535f",
24
- "@sphereon/ssi-sdk.core": "0.30.2-unstable.8+7f19535f",
23
+ "@sphereon/ssi-sdk.agent-config": "0.31.0",
24
+ "@sphereon/ssi-sdk.core": "0.31.0",
25
25
  "@sphereon/ssi-sdk.data-store": "workspace:*",
26
26
  "@types/jest": "^27.5.2",
27
27
  "@types/uuid": "^9.0.8",
@@ -53,5 +53,6 @@
53
53
  "Logger",
54
54
  "Audit"
55
55
  ],
56
- "gitHead": "7f19535f52bd7a082adfdcb77f8db50681132f9d"
56
+ "nx": {},
57
+ "gitHead": "3010f7bc57ed5f8d7953b6bf893e3164ea1821e8"
57
58
  }
@@ -2,21 +2,21 @@
2
2
  "IEventLogger": {
3
3
  "components": {
4
4
  "schemas": {
5
- "GetAuditEventsArgs": {
5
+ "GetActivityEventsArgs": {
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "filter": {
9
- "$ref": "#/components/schemas/FindAuditLoggingEventArgs"
9
+ "$ref": "#/components/schemas/FindActivityLoggingEventArgs"
10
10
  }
11
11
  }
12
12
  },
13
- "FindAuditLoggingEventArgs": {
13
+ "FindActivityLoggingEventArgs": {
14
14
  "type": "array",
15
15
  "items": {
16
- "$ref": "#/components/schemas/PartialAuditLoggingEvent"
16
+ "$ref": "#/components/schemas/PartialActivityLoggingEvent"
17
17
  }
18
18
  },
19
- "PartialAuditLoggingEvent": {
19
+ "PartialActivityLoggingEvent": {
20
20
  "type": "object",
21
21
  "properties": {
22
22
  "level": {
@@ -35,6 +35,26 @@
35
35
  "id": {
36
36
  "type": "string"
37
37
  },
38
+ "type": {
39
+ "type": "object",
40
+ "properties": {}
41
+ },
42
+ "originalCredential": {
43
+ "type": "string"
44
+ },
45
+ "credentialHash": {
46
+ "type": "string"
47
+ },
48
+ "parentCredentialHash": {
49
+ "type": "string"
50
+ },
51
+ "credentialType": {
52
+ "type": "object",
53
+ "properties": {}
54
+ },
55
+ "sharePurpose": {
56
+ "type": "string"
57
+ },
38
58
  "system": {
39
59
  "type": "object",
40
60
  "properties": {}
@@ -88,12 +108,31 @@
88
108
  "data": {}
89
109
  }
90
110
  },
91
- "AuditLoggingEvent": {
111
+ "ActivityLoggingEvent": {
92
112
  "type": "object",
93
113
  "properties": {
94
114
  "id": {
95
115
  "type": "string"
96
116
  },
117
+ "type": {
118
+ "type": "string",
119
+ "const": "activity"
120
+ },
121
+ "originalCredential": {
122
+ "type": "string"
123
+ },
124
+ "credentialHash": {
125
+ "type": "string"
126
+ },
127
+ "parentCredentialHash": {
128
+ "type": "string"
129
+ },
130
+ "credentialType": {
131
+ "$ref": "#/components/schemas/CredentialType"
132
+ },
133
+ "sharePurpose": {
134
+ "type": "string"
135
+ },
97
136
  "correlationId": {
98
137
  "type": "string"
99
138
  },
@@ -153,7 +192,17 @@
153
192
  "level",
154
193
  "subSystemType",
155
194
  "system",
156
- "timestamp"
195
+ "timestamp",
196
+ "type"
197
+ ]
198
+ },
199
+ "CredentialType": {
200
+ "type": "string",
201
+ "enum": [
202
+ "JSON_LD",
203
+ "JWT",
204
+ "SD_JWT",
205
+ "MSO_MDOC"
157
206
  ]
158
207
  },
159
208
  "System": {
@@ -221,7 +270,11 @@
221
270
  "DID resolution",
222
271
  "DID service update",
223
272
  "VC issue",
224
- "VC verify"
273
+ "VC verify",
274
+ "VC share",
275
+ "VC delete",
276
+ "VC issue decline",
277
+ "VC share decline"
225
278
  ]
226
279
  },
227
280
  "InitiatorType": {
@@ -263,17 +316,190 @@
263
316
  4
264
317
  ]
265
318
  },
266
- "LogAuditEventArgs": {
319
+ "GetAuditEventsArgs": {
320
+ "type": "object",
321
+ "properties": {
322
+ "filter": {
323
+ "$ref": "#/components/schemas/FindAuditLoggingEventArgs"
324
+ }
325
+ }
326
+ },
327
+ "FindAuditLoggingEventArgs": {
328
+ "type": "array",
329
+ "items": {
330
+ "$ref": "#/components/schemas/PartialAuditLoggingEvent"
331
+ }
332
+ },
333
+ "PartialAuditLoggingEvent": {
334
+ "type": "object",
335
+ "properties": {
336
+ "level": {
337
+ "type": "object",
338
+ "properties": {}
339
+ },
340
+ "correlationId": {
341
+ "type": "string"
342
+ },
343
+ "timestamp": {
344
+ "type": "object",
345
+ "properties": {},
346
+ "format": "date-time"
347
+ },
348
+ "diagnosticData": {},
349
+ "id": {
350
+ "type": "string"
351
+ },
352
+ "type": {
353
+ "type": "object",
354
+ "properties": {}
355
+ },
356
+ "system": {
357
+ "type": "object",
358
+ "properties": {}
359
+ },
360
+ "subSystemType": {
361
+ "type": "object",
362
+ "properties": {}
363
+ },
364
+ "actionType": {
365
+ "type": "object",
366
+ "properties": {}
367
+ },
368
+ "actionSubType": {
369
+ "anyOf": [
370
+ {
371
+ "type": "object",
372
+ "properties": {}
373
+ },
374
+ {
375
+ "type": "string"
376
+ }
377
+ ]
378
+ },
379
+ "initiatorType": {
380
+ "type": "object",
381
+ "properties": {}
382
+ },
383
+ "systemCorrelationIdType": {
384
+ "type": "object",
385
+ "properties": {}
386
+ },
387
+ "systemCorrelationId": {
388
+ "type": "string"
389
+ },
390
+ "systemAlias": {
391
+ "type": "string"
392
+ },
393
+ "partyCorrelationType": {
394
+ "type": "object",
395
+ "properties": {}
396
+ },
397
+ "partyCorrelationId": {
398
+ "type": "string"
399
+ },
400
+ "partyAlias": {
401
+ "type": "string"
402
+ },
403
+ "description": {
404
+ "type": "string"
405
+ },
406
+ "data": {}
407
+ }
408
+ },
409
+ "AuditLoggingEvent": {
410
+ "type": "object",
411
+ "properties": {
412
+ "id": {
413
+ "type": "string"
414
+ },
415
+ "type": {
416
+ "type": "string",
417
+ "const": "audit"
418
+ },
419
+ "correlationId": {
420
+ "type": "string"
421
+ },
422
+ "system": {
423
+ "$ref": "#/components/schemas/System"
424
+ },
425
+ "subSystemType": {
426
+ "$ref": "#/components/schemas/SubSystem"
427
+ },
428
+ "actionType": {
429
+ "$ref": "#/components/schemas/ActionType"
430
+ },
431
+ "actionSubType": {
432
+ "$ref": "#/components/schemas/ActionSubType"
433
+ },
434
+ "initiatorType": {
435
+ "$ref": "#/components/schemas/InitiatorType"
436
+ },
437
+ "systemCorrelationIdType": {
438
+ "$ref": "#/components/schemas/SystemCorrelationIdType"
439
+ },
440
+ "systemCorrelationId": {
441
+ "type": "string"
442
+ },
443
+ "systemAlias": {
444
+ "type": "string"
445
+ },
446
+ "partyCorrelationType": {
447
+ "$ref": "#/components/schemas/PartyCorrelationType"
448
+ },
449
+ "partyCorrelationId": {
450
+ "type": "string"
451
+ },
452
+ "partyAlias": {
453
+ "type": "string"
454
+ },
455
+ "description": {
456
+ "type": "string"
457
+ },
458
+ "data": {},
459
+ "level": {
460
+ "$ref": "#/components/schemas/LogLevel"
461
+ },
462
+ "timestamp": {
463
+ "type": "string",
464
+ "format": "date-time"
465
+ },
466
+ "diagnosticData": {}
467
+ },
468
+ "required": [
469
+ "actionSubType",
470
+ "actionType",
471
+ "correlationId",
472
+ "description",
473
+ "id",
474
+ "initiatorType",
475
+ "level",
476
+ "subSystemType",
477
+ "system",
478
+ "timestamp",
479
+ "type"
480
+ ]
481
+ },
482
+ "LogEventArgs": {
267
483
  "type": "object",
268
484
  "properties": {
269
485
  "event": {
270
- "$ref": "#/components/schemas/NonPersistedAuditLoggingEvent"
486
+ "$ref": "#/components/schemas/LogEventType"
271
487
  }
272
488
  },
273
489
  "required": [
274
490
  "event"
275
491
  ]
276
492
  },
493
+ "LogEventType": {
494
+ "anyOf": [
495
+ {
496
+ "$ref": "#/components/schemas/NonPersistedAuditLoggingEvent"
497
+ },
498
+ {
499
+ "$ref": "#/components/schemas/NonPersistedActivityLoggingEvent"
500
+ }
501
+ ]
502
+ },
277
503
  "NonPersistedAuditLoggingEvent": {
278
504
  "type": "object",
279
505
  "properties": {
@@ -342,9 +568,106 @@
342
568
  "subSystemType",
343
569
  "system"
344
570
  ]
571
+ },
572
+ "NonPersistedActivityLoggingEvent": {
573
+ "type": "object",
574
+ "properties": {
575
+ "system": {
576
+ "$ref": "#/components/schemas/System"
577
+ },
578
+ "subSystemType": {
579
+ "$ref": "#/components/schemas/SubSystem"
580
+ },
581
+ "initiatorType": {
582
+ "$ref": "#/components/schemas/InitiatorType"
583
+ },
584
+ "originalCredential": {
585
+ "type": "string"
586
+ },
587
+ "credentialHash": {
588
+ "type": "string"
589
+ },
590
+ "parentCredentialHash": {
591
+ "type": "string"
592
+ },
593
+ "credentialType": {
594
+ "type": "object",
595
+ "properties": {}
596
+ },
597
+ "sharePurpose": {
598
+ "type": "string"
599
+ },
600
+ "data": {},
601
+ "diagnosticData": {},
602
+ "actionType": {
603
+ "type": "object",
604
+ "properties": {}
605
+ },
606
+ "actionSubType": {
607
+ "anyOf": [
608
+ {
609
+ "type": "object",
610
+ "properties": {}
611
+ },
612
+ {
613
+ "type": "string"
614
+ }
615
+ ]
616
+ },
617
+ "systemCorrelationIdType": {
618
+ "type": "object",
619
+ "properties": {}
620
+ },
621
+ "systemCorrelationId": {
622
+ "type": "string"
623
+ },
624
+ "systemAlias": {
625
+ "type": "string"
626
+ },
627
+ "partyCorrelationType": {
628
+ "type": "object",
629
+ "properties": {}
630
+ },
631
+ "partyCorrelationId": {
632
+ "type": "string"
633
+ },
634
+ "partyAlias": {
635
+ "type": "string"
636
+ },
637
+ "description": {
638
+ "type": "string"
639
+ },
640
+ "level": {
641
+ "type": "object",
642
+ "properties": {}
643
+ },
644
+ "correlationId": {
645
+ "type": "string"
646
+ }
647
+ },
648
+ "required": [
649
+ "actionSubType",
650
+ "actionType",
651
+ "description",
652
+ "initiatorType",
653
+ "subSystemType",
654
+ "system"
655
+ ]
345
656
  }
346
657
  },
347
658
  "methods": {
659
+ "loggerGetActivityEvents": {
660
+ "description": "",
661
+ "arguments": {
662
+ "$ref": "#/components/schemas/GetActivityEventsArgs"
663
+ },
664
+ "returnType": {
665
+ "type": "array",
666
+ "items": {
667
+ "$ref": "#/components/schemas/ActivityLoggingEvent"
668
+ }
669
+ }
670
+ },
348
671
  "loggerGetAuditEvents": {
349
672
  "description": "",
350
673
  "arguments": {
@@ -357,10 +680,19 @@
357
680
  }
358
681
  }
359
682
  },
683
+ "loggerLogActivityEvent": {
684
+ "description": "",
685
+ "arguments": {
686
+ "$ref": "#/components/schemas/LogEventArgs"
687
+ },
688
+ "returnType": {
689
+ "$ref": "#/components/schemas/ActivityLoggingEvent"
690
+ }
691
+ },
360
692
  "loggerLogAuditEvent": {
361
693
  "description": "",
362
694
  "arguments": {
363
- "$ref": "#/components/schemas/LogAuditEventArgs"
695
+ "$ref": "#/components/schemas/LogEventArgs"
364
696
  },
365
697
  "returnType": {
366
698
  "$ref": "#/components/schemas/AuditLoggingEvent"
@@ -369,10 +701,10 @@
369
701
  "loggerLogGeneralEvent": {
370
702
  "description": "",
371
703
  "arguments": {
372
- "$ref": "#/components/schemas/LogAuditEventArgs"
704
+ "$ref": "#/components/schemas/LogEventArgs"
373
705
  },
374
706
  "returnType": {
375
- "$ref": "#/components/schemas/NonPersistedAuditLoggingEvent"
707
+ "$ref": "#/components/schemas/LogEventType"
376
708
  }
377
709
  }
378
710
  }
@@ -1,17 +1,34 @@
1
1
  import { AbstractEventLoggerStore } from '@sphereon/ssi-sdk.data-store'
2
- import { IAgentPlugin } from '@veramo/core'
3
2
  import { Loggers, LoggingEventType, LogLevel, LogMethod } from '@sphereon/ssi-types'
4
- import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
3
+ import { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
4
+ import { IAgentPlugin } from '@veramo/core'
5
5
  import { v4 as uuidv4 } from 'uuid'
6
- import { NonPersistedAuditLoggingEvent, schema } from '../index'
7
- import { EventLoggerOptions, GetAuditEventsArgs, IEventLogger, RequiredContext, LogAuditEventArgs, LoggingEvent } from '../types/IEventLogger'
6
+ import { schema } from '../index'
7
+ import {
8
+ EventLoggerOptions,
9
+ GetActivityEventsArgs,
10
+ GetAuditEventsArgs,
11
+ IEventLogger,
12
+ LogActivityEventArgs,
13
+ LogAuditEventArgs,
14
+ LogEventArgs,
15
+ LoggingEvent,
16
+ LogEventType,
17
+ RequiredContext,
18
+ } from '../types/IEventLogger'
8
19
 
9
20
  /**
10
21
  * {@inheritDoc IEventLogger}
11
22
  */
12
23
 
13
24
  // Exposing the methods here for any REST implementation
14
- export const eventLoggerAuditMethods: Array<string> = ['loggerGetAuditEvents', 'loggerLogAuditEvent', 'loggerLogGeneralEvent']
25
+ export const eventLoggerAuditMethods: Array<string> = [
26
+ 'loggerGetAuditEvents',
27
+ 'loggerLogAuditEvent',
28
+ 'loggerLogGeneralEvent',
29
+ 'loggerLogActivityEvent',
30
+ 'loggerGetActivityEvents',
31
+ ]
15
32
  export const eventLoggerMethods: Array<string> = [...eventLoggerAuditMethods]
16
33
 
17
34
  export class EventLogger implements IAgentPlugin {
@@ -24,6 +41,8 @@ export class EventLogger implements IAgentPlugin {
24
41
  loggerGetAuditEvents: this.loggerGetAuditEvents.bind(this),
25
42
  loggerLogAuditEvent: this.loggerLogAuditEvent.bind(this),
26
43
  loggerLogGeneralEvent: this.loggerLogGeneralEvent.bind(this),
44
+ loggerLogActivityEvent: this.loggerLogActivityEvent.bind(this),
45
+ loggerGetActivityEvents: this.loggerGetActivityEvents.bind(this),
27
46
  }
28
47
 
29
48
  constructor(options: EventLoggerOptions) {
@@ -60,6 +79,10 @@ export class EventLogger implements IAgentPlugin {
60
79
  // TODO: We might also want to do this locally though, as these logs are not persisted typically
61
80
  await context.agent.loggerLogGeneralEvent({ event: event.data })
62
81
  break
82
+ case LoggingEventType.ACTIVITY:
83
+ // Calling the context of the agent to make sure the REST client is called when configured
84
+ await context.agent.loggerLogActivityEvent({ event: event.data })
85
+ break
63
86
  default:
64
87
  return Promise.reject(Error(`Event type ${event.type} not supported`))
65
88
  }
@@ -75,9 +98,20 @@ export class EventLogger implements IAgentPlugin {
75
98
  return this.store.getAuditEvents({ filter })
76
99
  }
77
100
 
78
- private async loggerLogGeneralEvent(args: LogAuditEventArgs): Promise<NonPersistedAuditLoggingEvent> {
101
+ private async loggerGetActivityEvents(args?: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>> {
102
+ const { filter } = args ?? {}
103
+
104
+ if (!this.store) {
105
+ return Promise.reject(Error('No store available in options'))
106
+ }
107
+
108
+ return this.store.getActivityEvents({ filter })
109
+ }
110
+
111
+ private async loggerLogGeneralEvent(args: LogEventArgs): Promise<LogEventType> {
79
112
  const { event } = args
80
113
  this.simpleLoggers.get(event.data.system).logl(event.data.level ?? LogLevel.INFO, event.data.data, event.data)
114
+
81
115
  return args.event
82
116
  }
83
117
 
@@ -100,4 +134,24 @@ export class EventLogger implements IAgentPlugin {
100
134
  },
101
135
  })
102
136
  }
137
+
138
+ private async loggerLogActivityEvent(args: LogActivityEventArgs): Promise<ActivityLoggingEvent> {
139
+ const { event } = args
140
+
141
+ if (!this.store) {
142
+ return Promise.reject(Error('No store available in options'))
143
+ }
144
+
145
+ return this.store.storeActivityEvent({
146
+ event: {
147
+ ...event,
148
+ system: event.system,
149
+ subSystemType: event.subSystemType,
150
+ initiatorType: event.initiatorType,
151
+ level: event.level ?? LogLevel.INFO,
152
+ correlationId: event.correlationId ?? uuidv4(),
153
+ timestamp: new Date(),
154
+ },
155
+ })
156
+ }
103
157
  }
@@ -1,12 +1,20 @@
1
1
  import { InitiatorType, LoggingEventType, LogLevel, SubSystem, System } from '@sphereon/ssi-types'
2
+ import {
3
+ AuditLoggingEvent,
4
+ CredentialType,
5
+ NonPersistedAuditLoggingEvent as NPAuditLoggingEvent,
6
+ NonPersistedActivityLoggingEvent as NPActivityLoggingEvent,
7
+ ActivityLoggingEvent,
8
+ } from '@sphereon/ssi-sdk.core'
9
+ import { AbstractEventLoggerStore, FindActivityLoggingEventArgs, FindAuditLoggingEventArgs } from '@sphereon/ssi-sdk.data-store'
2
10
  import { IAgentContext, IPluginMethodMap } from '@veramo/core'
3
- import { AuditLoggingEvent, NonPersistedAuditLoggingEvent as NPAuditLoggingEvent } from '@sphereon/ssi-sdk.core'
4
- import { AbstractEventLoggerStore, FindAuditLoggingEventArgs } from '@sphereon/ssi-sdk.data-store'
5
11
 
6
12
  export interface IEventLogger extends IPluginMethodMap {
7
13
  loggerGetAuditEvents(args?: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>>
8
- loggerLogAuditEvent(args: LogAuditEventArgs, context: RequiredContext): Promise<AuditLoggingEvent>
9
- loggerLogGeneralEvent(args: LogAuditEventArgs, context: RequiredContext): Promise<NonPersistedAuditLoggingEvent>
14
+ loggerLogAuditEvent(args: LogEventArgs, context: RequiredContext): Promise<AuditLoggingEvent>
15
+ loggerLogGeneralEvent(args: LogEventArgs, context: RequiredContext): Promise<LogEventType>
16
+ loggerLogActivityEvent(args: LogEventArgs, context: RequiredContext): Promise<ActivityLoggingEvent>
17
+ loggerGetActivityEvents(args?: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>>
10
18
  }
11
19
 
12
20
  export interface EventLoggerGeneralLogOpts {
@@ -27,19 +35,45 @@ export type GetAuditEventsArgs = {
27
35
  filter?: FindAuditLoggingEventArgs
28
36
  }
29
37
 
38
+ export type GetActivityEventsArgs = {
39
+ filter?: FindActivityLoggingEventArgs
40
+ }
41
+
42
+ export type LogEventArgs = {
43
+ event: LogEventType
44
+ }
45
+
46
+ export type LogEventType = NonPersistedAuditLoggingEvent | NonPersistedActivityLoggingEvent
47
+
30
48
  export type LogAuditEventArgs = {
31
49
  event: NonPersistedAuditLoggingEvent
32
50
  }
33
51
 
52
+ export type LogActivityEventArgs = {
53
+ event: NonPersistedActivityLoggingEvent
54
+ }
55
+
34
56
  export type NonPersistedAuditLoggingEvent = Omit<NPAuditLoggingEvent, 'system' | 'subSystemType' | 'initiatorType'> & {
35
57
  system: System
36
58
  subSystemType: SubSystem
37
59
  initiatorType: InitiatorType
38
60
  }
39
61
 
62
+ export type NonPersistedActivityLoggingEvent = Omit<NPActivityLoggingEvent, 'system' | 'subSystemType' | 'initiatorType'> & {
63
+ system: System
64
+ subSystemType: SubSystem
65
+ initiatorType: InitiatorType
66
+ originalCredential?: string
67
+ credentialHash?: string
68
+ parentCredentialHash?: string
69
+ credentialType?: CredentialType
70
+ sharePurpose?: string
71
+ data?: any
72
+ }
73
+
40
74
  export type LoggingEvent = {
41
75
  type: LoggingEventType
42
- data: NonPersistedAuditLoggingEvent
76
+ data: LogEventType
43
77
  }
44
78
 
45
79
  export type RequiredContext = IAgentContext<IEventLogger>