UNPKG

@sphereon/ssi-sdk.event-logger

Version:

89 lines (84 loc) 3.71 kB
import { System, SubSystem, InitiatorType, LoggingEventType, LogLevel, Loggers } from '@sphereon/ssi-types'; import { IPluginMethodMap, IAgentContext, IAgentPlugin } from '@veramo/core'; import { AuditLoggingEvent, NonPersistedAuditLoggingEvent as NonPersistedAuditLoggingEvent$1, NonPersistedActivityLoggingEvent as NonPersistedActivityLoggingEvent$1, CredentialType, ActivityLoggingEvent } from '@sphereon/ssi-sdk.core'; import { FindAuditLoggingEventArgs, FindActivityLoggingEventArgs, AbstractEventLoggerStore } from '@sphereon/ssi-sdk.data-store'; interface IEventLogger extends IPluginMethodMap { loggerGetAuditEvents(args?: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>>; loggerLogAuditEvent(args: LogEventArgs, context: RequiredContext): Promise<AuditLoggingEvent>; loggerLogGeneralEvent(args: LogEventArgs, context: RequiredContext): Promise<LogEventType>; loggerLogActivityEvent(args: LogEventArgs, context: RequiredContext): Promise<ActivityLoggingEvent>; loggerGetActivityEvents(args?: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>>; } interface EventLoggerGeneralLogOpts { debugPkg?: boolean; console?: boolean; events?: boolean; eventName?: string; defaultLogLevel?: LogLevel; } type EventLoggerOptions = { store?: AbstractEventLoggerStore; eventTypes: Array<LoggingEventType>; general?: EventLoggerGeneralLogOpts; }; type GetAuditEventsArgs = { filter?: FindAuditLoggingEventArgs; }; type GetActivityEventsArgs = { filter?: FindActivityLoggingEventArgs; }; type LogEventArgs = { event: LogEventType; }; type LogEventType = NonPersistedAuditLoggingEvent | NonPersistedActivityLoggingEvent; type LogAuditEventArgs = { event: NonPersistedAuditLoggingEvent; }; type LogActivityEventArgs = { event: NonPersistedActivityLoggingEvent; }; type NonPersistedAuditLoggingEvent = Omit<NonPersistedAuditLoggingEvent$1, 'system' | 'subSystemType' | 'initiatorType'> & { system: System; subSystemType: SubSystem; initiatorType: InitiatorType; }; type NonPersistedActivityLoggingEvent = Omit<NonPersistedActivityLoggingEvent$1, 'system' | 'subSystemType' | 'initiatorType'> & { system: System; subSystemType: SubSystem; initiatorType: InitiatorType; originalCredential?: string; credentialHash?: string; parentCredentialHash?: string; credentialType?: CredentialType; sharePurpose?: string; data?: any; }; type LoggingEvent = { type: LoggingEventType; data: LogEventType; }; type RequiredContext = IAgentContext<IEventLogger>; /** * {@inheritDoc IEventLogger} */ declare const eventLoggerAuditMethods: Array<string>; declare const eventLoggerMethods: Array<string>; declare class EventLogger implements IAgentPlugin { readonly schema: any; readonly eventTypes: Array<LoggingEventType>; private readonly store?; readonly simpleLoggers: Loggers; readonly methods: IEventLogger; constructor(options: EventLoggerOptions); onEvent(event: LoggingEvent, context: RequiredContext): Promise<void>; private loggerGetAuditEvents; private loggerGetActivityEvents; private loggerLogGeneralEvent; private loggerLogAuditEvent; private loggerLogActivityEvent; } /** * @public */ declare const schema: any; export { EventLogger, type EventLoggerGeneralLogOpts, type EventLoggerOptions, type GetActivityEventsArgs, type GetAuditEventsArgs, type IEventLogger, type LogActivityEventArgs, type LogAuditEventArgs, type LogEventArgs, type LogEventType, type LoggingEvent, type NonPersistedActivityLoggingEvent, type NonPersistedAuditLoggingEvent, type RequiredContext, eventLoggerAuditMethods, eventLoggerMethods, schema };