@sphereon/ssi-sdk.event-logger 0.30.1 → 0.30.2-unstable.4

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.
@@ -1,6 +1,6 @@
1
1
  import { IAgentPlugin } from '@veramo/core';
2
2
  import { Loggers, LoggingEventType } from '@sphereon/ssi-types';
3
- import { EventLoggerOptions, IEventLogger, RequiredContext, LoggingEvent } from '../types/IEventLogger';
3
+ import { EventLoggerOptions, IEventLogger, LoggingEvent, RequiredContext } from '../index';
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,MAAM,qBAAqB,CAAA;AAIpF,OAAO,EAAE,kBAAkB,EAAsB,YAAY,EAAE,eAAe,EAAqB,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAE9I;;GAEG;AAGH,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,MAAM,CAA4E,CAAA;AAC9H,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAgC,CAAA;AAE7E,qBAAa,WAAY,YAAW,YAAY;IAC9C,QAAQ,CAAC,MAAM,MAAsB;IACrC,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAK;IACjD,O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 @@ 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
  }
@@ -68,11 +80,20 @@ class EventLogger {
68
80
  }
69
81
  loggerGetAuditEvents(args) {
70
82
  return __awaiter(this, void 0, void 0, function* () {
71
- const { filter } = args !== null && args !== void 0 ? args : {};
83
+ const { filter = [] } = args !== null && args !== void 0 ? args : {};
72
84
  if (!this.store) {
73
85
  return Promise.reject(Error('No store available in options'));
74
86
  }
75
- return this.store.getAuditEvents({ filter });
87
+ return this.store.getAuditEvents({ filter: [...filter, { type: ssi_types_1.LoggingEventType.AUDIT }] });
88
+ });
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: [...filter, { type: ssi_types_1.LoggingEventType.ACTIVITY }] });
76
97
  });
77
98
  }
78
99
  loggerLogGeneralEvent(args) {
@@ -91,7 +112,19 @@ class EventLogger {
91
112
  return Promise.reject(Error('No store available in options'));
92
113
  }
93
114
  return this.store.storeAuditEvent({
94
- 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() }),
115
+ event: Object.assign(Object.assign({}, event), { type: ssi_types_1.LoggingEventType.AUDIT, 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() }),
116
+ });
117
+ });
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), { type: ssi_types_1.LoggingEventType.ACTIVITY, 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() }),
95
128
  });
96
129
  });
97
130
  }
@@ -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,uBAAuB,CAAC,CAAA;AACjH,QAAA,kBAAkB,GAAkB,CAAC,GAAG,+BAAuB,CAAC,CAAA;AAE7E,MAAa,WAAW;IAYtB,YAAY,OAA2B;;QAX9B,WAAM,GAAG,cAAM,CAAC,YAAY,CAAA;QAC5B,eAAU,GAA4B,EAAE,CAAA;QAIxC,YAAO,GAAiB;YAC/B,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC;YAC1D,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC;YACxD,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC;SAC7D,CAAA;QAGC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAAA;QACrC,MAAM,WAAW,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;QACzD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAE5B,MAAM,OAAO,GAAqB,EAAE,CAAA;QACpC,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,qBAAS,CAAC,SAAS,CAAC,CAAA;QACnC,CAAC;QACD,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YACxB,OAAO,CAAC,IAAI,CAAC,qBAAS,CAAC,OAAO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,4BAAgB,CAAC,KAAK,EAC5B,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;IAEa,sBAAsB,CAAC,IAA0B;;;YAC7D,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;YAEtB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;gBAChB,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CAAA;YAC/D,CAAC;YAED,OAAO,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC;gBACnC,KAAK,kCACA,KAAK,KACR,IAAI,EAAE,4BAAgB,CAAC,QAAQ,EAC/B,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;AAzHD,kCAyHC"}
@@ -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,44 @@ 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<NonPersistedAuditLoggingEvent>;
67
+ loggerLogActivityEvent(args: LogActivityEventArgs, context: RequiredContext): Promise<ActivityLoggingEvent>;
68
+ loggerGetActivityEvents(args?: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>>;
57
69
  }
58
70
 
59
- export declare type LogAuditEventArgs = {
60
- event: NonPersistedAuditLoggingEvent;
71
+ export declare type LogActivityEventArgs = {
72
+ event: NonPersistedActivityLoggingEvent;
73
+ };
74
+
75
+ export declare type LogEventArgs = {
76
+ event: NonPersistedAuditLoggingEvent | NonPersistedActivityLoggingEvent;
61
77
  };
62
78
 
63
79
  export declare type LoggingEvent = {
64
80
  type: LoggingEventType;
65
- data: NonPersistedAuditLoggingEvent;
81
+ data: NonPersistedAuditLoggingEvent | NonPersistedActivityLoggingEvent;
82
+ };
83
+
84
+ export declare type NonPersistedActivityLoggingEvent = Omit<NonPersistedActivityLoggingEvent_2, 'system' | 'subSystemType' | 'initiatorType'> & {
85
+ system: System;
86
+ subSystemType: SubSystem;
87
+ initiatorType: InitiatorType;
88
+ originalCredential?: string;
89
+ credentialHash?: string;
90
+ credentialType?: CredentialType;
91
+ sharePurpose?: string;
92
+ data?: any;
66
93
  };
67
94
 
68
95
  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
2
  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';
3
+ import { AuditLoggingEvent, CredentialType, NonPersistedAuditLoggingEvent as NPAuditLoggingEvent, NonPersistedActivityLoggingEvent as NPActivityLoggingEvent, ActivityLoggingEvent } from '@sphereon/ssi-sdk.core';
4
+ import { AbstractEventLoggerStore, FindActivityLoggingEventArgs, 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<NonPersistedAuditLoggingEvent>;
9
+ loggerLogActivityEvent(args: LogActivityEventArgs, 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,33 @@ export type EventLoggerOptions = {
22
24
  export type GetAuditEventsArgs = {
23
25
  filter?: FindAuditLoggingEventArgs;
24
26
  };
25
- export type LogAuditEventArgs = {
26
- event: NonPersistedAuditLoggingEvent;
27
+ export type GetActivityEventsArgs = {
28
+ filter?: FindActivityLoggingEventArgs;
29
+ };
30
+ export type LogEventArgs = {
31
+ event: NonPersistedAuditLoggingEvent | NonPersistedActivityLoggingEvent;
32
+ };
33
+ export type LogActivityEventArgs = {
34
+ event: NonPersistedActivityLoggingEvent;
27
35
  };
28
36
  export type NonPersistedAuditLoggingEvent = Omit<NPAuditLoggingEvent, 'system' | 'subSystemType' | 'initiatorType'> & {
29
37
  system: System;
30
38
  subSystemType: SubSystem;
31
39
  initiatorType: InitiatorType;
32
40
  };
41
+ export type NonPersistedActivityLoggingEvent = Omit<NPActivityLoggingEvent, 'system' | 'subSystemType' | 'initiatorType'> & {
42
+ system: System;
43
+ subSystemType: SubSystem;
44
+ initiatorType: InitiatorType;
45
+ originalCredential?: string;
46
+ credentialHash?: string;
47
+ credentialType?: CredentialType;
48
+ sharePurpose?: string;
49
+ data?: any;
50
+ };
33
51
  export type LoggingEvent = {
34
52
  type: LoggingEventType;
35
- data: NonPersistedAuditLoggingEvent;
53
+ data: NonPersistedAuditLoggingEvent | NonPersistedActivityLoggingEvent;
36
54
  };
37
55
  export type RequiredContext = IAgentContext<IEventLogger>;
38
56
  //# 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,aAAa,EAAE,gBAAgB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAClG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,IAAI,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAChH,OAAO,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAA;AAElG,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,oBAAoB,CAAC,IAAI,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAClF,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAClG,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAA;CACjH;AAED,MAAM,WAAW,yBAAyB;IACxC,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AAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,6BAA6B,GAAG,gCAAgC,CAAA;CACxE,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,gCAAgC,CAAA;CACxC,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,eAAe,GAAG,eAAe,CAAC,GAAG;IACpH,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,SAAS,CAAA;IACxB,aAAa,EAAE,aAAa,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,gCAAgC,GAAG,IAAI,CAAC,sBAAsB,EAAE,QAAQ,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,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,6BAA6B,GAAG,gCAAgC,CAAA;CACvE,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.1",
3
+ "version": "0.30.2-unstable.4+24c0176d",
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.1",
19
- "@sphereon/ssi-types": "0.30.1",
18
+ "@sphereon/ssi-sdk.data-store": "0.30.2-unstable.4+24c0176d",
19
+ "@sphereon/ssi-types": "0.30.2-unstable.4+24c0176d",
20
20
  "uuid": "^9.0.1"
21
21
  },
22
22
  "devDependencies": {
23
- "@sphereon/ssi-sdk.agent-config": "0.30.1",
24
- "@sphereon/ssi-sdk.core": "0.30.1",
23
+ "@sphereon/ssi-sdk.agent-config": "0.30.2-unstable.4+24c0176d",
24
+ "@sphereon/ssi-sdk.core": "0.30.2-unstable.4+24c0176d",
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,5 @@
53
53
  "Logger",
54
54
  "Audit"
55
55
  ],
56
- "gitHead": "c41d295c136cc35d7be3ea650fc610cf05aaf1a3"
56
+ "gitHead": "24c0176de9ebc6f9b83a23620324fa1a721316ea"
57
57
  }
@@ -2,6 +2,218 @@
2
2
  "IEventLogger": {
3
3
  "components": {
4
4
  "schemas": {
5
+ "GetActivityEventsArgs": {
6
+ "type": "object",
7
+ "properties": {
8
+ "filter": {
9
+ "$ref": "#/components/schemas/FindActivityLoggingEventArgs"
10
+ }
11
+ }
12
+ },
13
+ "FindActivityLoggingEventArgs": {
14
+ "type": "array",
15
+ "items": {
16
+ "$ref": "#/components/schemas/PartialActivityLoggingEvent"
17
+ }
18
+ },
19
+ "PartialActivityLoggingEvent": {
20
+ "type": "object",
21
+ "properties": {
22
+ "type": {
23
+ "type": "object",
24
+ "properties": {}
25
+ },
26
+ "level": {
27
+ "type": "object",
28
+ "properties": {}
29
+ },
30
+ "correlationId": {
31
+ "type": "string"
32
+ },
33
+ "timestamp": {
34
+ "type": "object",
35
+ "properties": {},
36
+ "format": "date-time"
37
+ },
38
+ "diagnosticData": {},
39
+ "id": {
40
+ "type": "string"
41
+ },
42
+ "system": {
43
+ "type": "object",
44
+ "properties": {}
45
+ },
46
+ "subSystemType": {
47
+ "type": "object",
48
+ "properties": {}
49
+ },
50
+ "actionType": {
51
+ "type": "object",
52
+ "properties": {}
53
+ },
54
+ "actionSubType": {
55
+ "anyOf": [
56
+ {
57
+ "type": "object",
58
+ "properties": {}
59
+ },
60
+ {
61
+ "type": "string"
62
+ }
63
+ ]
64
+ },
65
+ "initiatorType": {
66
+ "type": "object",
67
+ "properties": {}
68
+ },
69
+ "systemCorrelationIdType": {
70
+ "type": "object",
71
+ "properties": {}
72
+ },
73
+ "systemCorrelationId": {
74
+ "type": "string"
75
+ },
76
+ "systemAlias": {
77
+ "type": "string"
78
+ },
79
+ "partyCorrelationType": {
80
+ "type": "object",
81
+ "properties": {}
82
+ },
83
+ "partyCorrelationId": {
84
+ "type": "string"
85
+ },
86
+ "partyAlias": {
87
+ "type": "string"
88
+ },
89
+ "description": {
90
+ "type": "string"
91
+ },
92
+ "originalCredential": {
93
+ "type": "string"
94
+ },
95
+ "credentialHash": {
96
+ "type": "string"
97
+ },
98
+ "credentialType": {
99
+ "type": "object",
100
+ "properties": {}
101
+ },
102
+ "sharePurpose": {
103
+ "type": "string"
104
+ },
105
+ "data": {}
106
+ }
107
+ },
108
+ "ActivityLoggingEvent": {
109
+ "type": "object",
110
+ "properties": {
111
+ "originalCredential": {
112
+ "type": "string"
113
+ },
114
+ "credentialHash": {
115
+ "type": "string"
116
+ },
117
+ "credentialType": {
118
+ "$ref": "#/components/schemas/CredentialType"
119
+ },
120
+ "sharePurpose": {
121
+ "type": "string"
122
+ },
123
+ "data": {},
124
+ "type": {
125
+ "type": "object",
126
+ "properties": {}
127
+ },
128
+ "level": {
129
+ "type": "object",
130
+ "properties": {}
131
+ },
132
+ "correlationId": {
133
+ "type": "string"
134
+ },
135
+ "timestamp": {
136
+ "type": "object",
137
+ "properties": {},
138
+ "format": "date-time"
139
+ },
140
+ "diagnosticData": {},
141
+ "id": {
142
+ "type": "string"
143
+ },
144
+ "system": {
145
+ "type": "object",
146
+ "properties": {}
147
+ },
148
+ "subSystemType": {
149
+ "type": "object",
150
+ "properties": {}
151
+ },
152
+ "actionType": {
153
+ "type": "object",
154
+ "properties": {}
155
+ },
156
+ "actionSubType": {
157
+ "anyOf": [
158
+ {
159
+ "type": "object",
160
+ "properties": {}
161
+ },
162
+ {
163
+ "type": "string"
164
+ }
165
+ ]
166
+ },
167
+ "initiatorType": {
168
+ "type": "object",
169
+ "properties": {}
170
+ },
171
+ "systemCorrelationIdType": {
172
+ "type": "object",
173
+ "properties": {}
174
+ },
175
+ "systemCorrelationId": {
176
+ "type": "string"
177
+ },
178
+ "systemAlias": {
179
+ "type": "string"
180
+ },
181
+ "partyCorrelationType": {
182
+ "type": "object",
183
+ "properties": {}
184
+ },
185
+ "partyCorrelationId": {
186
+ "type": "string"
187
+ },
188
+ "partyAlias": {
189
+ "type": "string"
190
+ },
191
+ "description": {
192
+ "type": "string"
193
+ }
194
+ },
195
+ "required": [
196
+ "actionSubType",
197
+ "actionType",
198
+ "description",
199
+ "id",
200
+ "initiatorType",
201
+ "level",
202
+ "subSystemType",
203
+ "system",
204
+ "timestamp",
205
+ "type"
206
+ ]
207
+ },
208
+ "CredentialType": {
209
+ "type": "string",
210
+ "enum": [
211
+ "JSON_LD",
212
+ "JWT",
213
+ "SD_JWT",
214
+ "MSO_MDOC"
215
+ ]
216
+ },
5
217
  "GetAuditEventsArgs": {
6
218
  "type": "object",
7
219
  "properties": {
@@ -19,6 +231,10 @@
19
231
  "PartialAuditLoggingEvent": {
20
232
  "type": "object",
21
233
  "properties": {
234
+ "type": {
235
+ "type": "object",
236
+ "properties": {}
237
+ },
22
238
  "level": {
23
239
  "type": "object",
24
240
  "properties": {}
@@ -134,6 +350,9 @@
134
350
  "type": "string"
135
351
  },
136
352
  "data": {},
353
+ "type": {
354
+ "$ref": "#/components/schemas/LoggingEventType"
355
+ },
137
356
  "level": {
138
357
  "$ref": "#/components/schemas/LogLevel"
139
358
  },
@@ -153,7 +372,8 @@
153
372
  "level",
154
373
  "subSystemType",
155
374
  "system",
156
- "timestamp"
375
+ "timestamp",
376
+ "type"
157
377
  ]
158
378
  },
159
379
  "System": {
@@ -253,6 +473,14 @@
253
473
  "phone"
254
474
  ]
255
475
  },
476
+ "LoggingEventType": {
477
+ "type": "string",
478
+ "enum": [
479
+ "audit",
480
+ "activity",
481
+ "general"
482
+ ]
483
+ },
256
484
  "LogLevel": {
257
485
  "type": "number",
258
486
  "enum": [
@@ -263,11 +491,116 @@
263
491
  4
264
492
  ]
265
493
  },
266
- "LogAuditEventArgs": {
494
+ "LogActivityEventArgs": {
267
495
  "type": "object",
268
496
  "properties": {
269
497
  "event": {
270
- "$ref": "#/components/schemas/NonPersistedAuditLoggingEvent"
498
+ "$ref": "#/components/schemas/NonPersistedActivityLoggingEvent"
499
+ }
500
+ },
501
+ "required": [
502
+ "event"
503
+ ]
504
+ },
505
+ "NonPersistedActivityLoggingEvent": {
506
+ "type": "object",
507
+ "properties": {
508
+ "system": {
509
+ "$ref": "#/components/schemas/System"
510
+ },
511
+ "subSystemType": {
512
+ "$ref": "#/components/schemas/SubSystem"
513
+ },
514
+ "initiatorType": {
515
+ "$ref": "#/components/schemas/InitiatorType"
516
+ },
517
+ "originalCredential": {
518
+ "type": "string"
519
+ },
520
+ "credentialHash": {
521
+ "type": "string"
522
+ },
523
+ "credentialType": {
524
+ "type": "object",
525
+ "properties": {}
526
+ },
527
+ "sharePurpose": {
528
+ "type": "string"
529
+ },
530
+ "data": {},
531
+ "type": {
532
+ "type": "object",
533
+ "properties": {}
534
+ },
535
+ "diagnosticData": {},
536
+ "actionType": {
537
+ "type": "object",
538
+ "properties": {}
539
+ },
540
+ "actionSubType": {
541
+ "anyOf": [
542
+ {
543
+ "type": "object",
544
+ "properties": {}
545
+ },
546
+ {
547
+ "type": "string"
548
+ }
549
+ ]
550
+ },
551
+ "systemCorrelationIdType": {
552
+ "type": "object",
553
+ "properties": {}
554
+ },
555
+ "systemCorrelationId": {
556
+ "type": "string"
557
+ },
558
+ "systemAlias": {
559
+ "type": "string"
560
+ },
561
+ "partyCorrelationType": {
562
+ "type": "object",
563
+ "properties": {}
564
+ },
565
+ "partyCorrelationId": {
566
+ "type": "string"
567
+ },
568
+ "partyAlias": {
569
+ "type": "string"
570
+ },
571
+ "description": {
572
+ "type": "string"
573
+ },
574
+ "level": {
575
+ "type": "object",
576
+ "properties": {}
577
+ },
578
+ "correlationId": {
579
+ "type": "string"
580
+ }
581
+ },
582
+ "required": [
583
+ "actionSubType",
584
+ "actionType",
585
+ "description",
586
+ "initiatorType",
587
+ "subSystemType",
588
+ "system",
589
+ "type"
590
+ ]
591
+ },
592
+ "LogEventArgs": {
593
+ "type": "object",
594
+ "properties": {
595
+ "event": {
596
+ "anyOf": [
597
+ {
598
+ "$ref": "#/components/schemas/NonPersistedAuditLoggingEvent"
599
+ },
600
+ {
601
+ "$ref": "#/components/schemas/NonPersistedActivityLoggingEvent"
602
+ }
603
+ ]
271
604
  }
272
605
  },
273
606
  "required": [
@@ -286,6 +619,10 @@
286
619
  "initiatorType": {
287
620
  "$ref": "#/components/schemas/InitiatorType"
288
621
  },
622
+ "type": {
623
+ "type": "object",
624
+ "properties": {}
625
+ },
289
626
  "diagnosticData": {},
290
627
  "actionType": {
291
628
  "type": "object",
@@ -340,11 +677,24 @@
340
677
  "description",
341
678
  "initiatorType",
342
679
  "subSystemType",
343
- "system"
680
+ "system",
681
+ "type"
344
682
  ]
345
683
  }
346
684
  },
347
685
  "methods": {
686
+ "loggerGetActivityEvents": {
687
+ "description": "",
688
+ "arguments": {
689
+ "$ref": "#/components/schemas/GetActivityEventsArgs"
690
+ },
691
+ "returnType": {
692
+ "type": "array",
693
+ "items": {
694
+ "$ref": "#/components/schemas/ActivityLoggingEvent"
695
+ }
696
+ }
697
+ },
348
698
  "loggerGetAuditEvents": {
349
699
  "description": "",
350
700
  "arguments": {
@@ -357,10 +707,19 @@
357
707
  }
358
708
  }
359
709
  },
710
+ "loggerLogActivityEvent": {
711
+ "description": "",
712
+ "arguments": {
713
+ "$ref": "#/components/schemas/LogActivityEventArgs"
714
+ },
715
+ "returnType": {
716
+ "$ref": "#/components/schemas/ActivityLoggingEvent"
717
+ }
718
+ },
360
719
  "loggerLogAuditEvent": {
361
720
  "description": "",
362
721
  "arguments": {
363
- "$ref": "#/components/schemas/LogAuditEventArgs"
722
+ "$ref": "#/components/schemas/LogEventArgs"
364
723
  },
365
724
  "returnType": {
366
725
  "$ref": "#/components/schemas/AuditLoggingEvent"
@@ -369,7 +728,7 @@
369
728
  "loggerLogGeneralEvent": {
370
729
  "description": "",
371
730
  "arguments": {
372
- "$ref": "#/components/schemas/LogAuditEventArgs"
731
+ "$ref": "#/components/schemas/LogEventArgs"
373
732
  },
374
733
  "returnType": {
375
734
  "$ref": "#/components/schemas/NonPersistedAuditLoggingEvent"
@@ -1,17 +1,34 @@
1
1
  import { AbstractEventLoggerStore } from '@sphereon/ssi-sdk.data-store'
2
2
  import { IAgentPlugin } from '@veramo/core'
3
3
  import { Loggers, LoggingEventType, LogLevel, LogMethod } from '@sphereon/ssi-types'
4
- import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
4
+ import { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.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 {
7
+ EventLoggerOptions,
8
+ GetActivityEventsArgs,
9
+ GetAuditEventsArgs,
10
+ IEventLogger,
11
+ LogActivityEventArgs,
12
+ LogEventArgs,
13
+ LoggingEvent,
14
+ NonPersistedActivityLoggingEvent,
15
+ NonPersistedAuditLoggingEvent,
16
+ RequiredContext,
17
+ schema,
18
+ } from '../index'
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,28 +79,39 @@ 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 as NonPersistedActivityLoggingEvent })
85
+ break
63
86
  default:
64
87
  return Promise.reject(Error(`Event type ${event.type} not supported`))
65
88
  }
66
89
  }
67
90
 
68
91
  private async loggerGetAuditEvents(args?: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>> {
69
- const { filter } = args ?? {}
70
-
92
+ const { filter = [] } = args ?? {}
71
93
  if (!this.store) {
72
94
  return Promise.reject(Error('No store available in options'))
73
95
  }
96
+ return this.store.getAuditEvents({ filter: [...filter, { type: LoggingEventType.AUDIT }] })
97
+ }
74
98
 
75
- return this.store.getAuditEvents({ filter })
99
+ private async loggerGetActivityEvents(args?: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>> {
100
+ const { filter = [] } = args ?? {}
101
+
102
+ if (!this.store) {
103
+ return Promise.reject(Error('No store available in options'))
104
+ }
105
+ return this.store.getActivityEvents({ filter: [...filter, { type: LoggingEventType.ACTIVITY }] })
76
106
  }
77
107
 
78
- private async loggerLogGeneralEvent(args: LogAuditEventArgs): Promise<NonPersistedAuditLoggingEvent> {
108
+ private async loggerLogGeneralEvent(args: LogEventArgs): Promise<NonPersistedAuditLoggingEvent> {
79
109
  const { event } = args
80
110
  this.simpleLoggers.get(event.data.system).logl(event.data.level ?? LogLevel.INFO, event.data.data, event.data)
81
111
  return args.event
82
112
  }
83
113
 
84
- private async loggerLogAuditEvent(args: LogAuditEventArgs): Promise<AuditLoggingEvent> {
114
+ private async loggerLogAuditEvent(args: LogEventArgs): Promise<AuditLoggingEvent> {
85
115
  const { event } = args
86
116
 
87
117
  if (!this.store) {
@@ -91,6 +121,28 @@ export class EventLogger implements IAgentPlugin {
91
121
  return this.store.storeAuditEvent({
92
122
  event: {
93
123
  ...event,
124
+ type: LoggingEventType.AUDIT,
125
+ system: event.system,
126
+ subSystemType: event.subSystemType,
127
+ initiatorType: event.initiatorType,
128
+ level: event.level ?? LogLevel.INFO,
129
+ correlationId: event.correlationId ?? uuidv4(),
130
+ timestamp: new Date(),
131
+ },
132
+ })
133
+ }
134
+
135
+ private async loggerLogActivityEvent(args: LogActivityEventArgs): Promise<ActivityLoggingEvent> {
136
+ const { event } = args
137
+
138
+ if (!this.store) {
139
+ return Promise.reject(Error('No store available in options'))
140
+ }
141
+
142
+ return this.store.storeActivityEvent({
143
+ event: {
144
+ ...event,
145
+ type: LoggingEventType.ACTIVITY,
94
146
  system: event.system,
95
147
  subSystemType: event.subSystemType,
96
148
  initiatorType: event.initiatorType,
@@ -1,12 +1,20 @@
1
1
  import { InitiatorType, LoggingEventType, LogLevel, SubSystem, System } from '@sphereon/ssi-types'
2
2
  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'
3
+ import {
4
+ AuditLoggingEvent,
5
+ CredentialType,
6
+ NonPersistedAuditLoggingEvent as NPAuditLoggingEvent,
7
+ NonPersistedActivityLoggingEvent as NPActivityLoggingEvent,
8
+ ActivityLoggingEvent,
9
+ } from '@sphereon/ssi-sdk.core'
10
+ import { AbstractEventLoggerStore, FindActivityLoggingEventArgs, 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<NonPersistedAuditLoggingEvent>
16
+ loggerLogActivityEvent(args: LogActivityEventArgs, context: RequiredContext): Promise<ActivityLoggingEvent>
17
+ loggerGetActivityEvents(args?: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>>
10
18
  }
11
19
 
12
20
  export interface EventLoggerGeneralLogOpts {
@@ -27,8 +35,16 @@ export type GetAuditEventsArgs = {
27
35
  filter?: FindAuditLoggingEventArgs
28
36
  }
29
37
 
30
- export type LogAuditEventArgs = {
31
- event: NonPersistedAuditLoggingEvent
38
+ export type GetActivityEventsArgs = {
39
+ filter?: FindActivityLoggingEventArgs
40
+ }
41
+
42
+ export type LogEventArgs = {
43
+ event: NonPersistedAuditLoggingEvent | NonPersistedActivityLoggingEvent
44
+ }
45
+
46
+ export type LogActivityEventArgs = {
47
+ event: NonPersistedActivityLoggingEvent
32
48
  }
33
49
 
34
50
  export type NonPersistedAuditLoggingEvent = Omit<NPAuditLoggingEvent, 'system' | 'subSystemType' | 'initiatorType'> & {
@@ -37,9 +53,20 @@ export type NonPersistedAuditLoggingEvent = Omit<NPAuditLoggingEvent, 'system' |
37
53
  initiatorType: InitiatorType
38
54
  }
39
55
 
56
+ export type NonPersistedActivityLoggingEvent = Omit<NPActivityLoggingEvent, 'system' | 'subSystemType' | 'initiatorType'> & {
57
+ system: System
58
+ subSystemType: SubSystem
59
+ initiatorType: InitiatorType
60
+ originalCredential?: string
61
+ credentialHash?: string
62
+ credentialType?: CredentialType
63
+ sharePurpose?: string
64
+ data?: any
65
+ }
66
+
40
67
  export type LoggingEvent = {
41
68
  type: LoggingEventType
42
- data: NonPersistedAuditLoggingEvent
69
+ data: NonPersistedAuditLoggingEvent | NonPersistedActivityLoggingEvent
43
70
  }
44
71
 
45
72
  export type RequiredContext = IAgentContext<IEventLogger>