@sphereon/ssi-sdk.data-store 0.30.2-unstable.9 → 0.31.1-fix.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.
- package/dist/contact/ContactStore.d.ts.map +1 -1
- package/dist/digitalCredential/DigitalCredentialStore.d.ts.map +1 -1
- package/dist/digitalCredential/DigitalCredentialStore.js +1 -3
- package/dist/digitalCredential/DigitalCredentialStore.js.map +1 -1
- package/dist/entities/digitalCredential/DigitalCredentialEntity.d.ts.map +1 -1
- package/dist/entities/digitalCredential/DigitalCredentialEntity.js +1 -1
- package/dist/entities/digitalCredential/DigitalCredentialEntity.js.map +1 -1
- package/dist/entities/eventLogger/AuditEventEntity.d.ts +8 -4
- package/dist/entities/eventLogger/AuditEventEntity.d.ts.map +1 -1
- package/dist/entities/eventLogger/AuditEventEntity.js +28 -25
- package/dist/entities/eventLogger/AuditEventEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.d.ts +0 -2
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js +1 -8
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.d.ts +0 -2
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.js +1 -9
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/CredentialClaimsEntity.d.ts +10 -0
- package/dist/entities/issuanceBranding/CredentialClaimsEntity.d.ts.map +1 -0
- package/dist/entities/issuanceBranding/CredentialClaimsEntity.js +70 -0
- package/dist/entities/issuanceBranding/CredentialClaimsEntity.js.map +1 -0
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.d.ts +2 -2
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js +12 -16
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/ImageAttributesEntity.d.ts +0 -2
- package/dist/entities/issuanceBranding/ImageAttributesEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/ImageAttributesEntity.js +1 -11
- package/dist/entities/issuanceBranding/ImageAttributesEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.d.ts +0 -2
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.js +1 -8
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.d.ts +0 -2
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.js +1 -8
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.d.ts +4 -2
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js +21 -15
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/TextAttributesEntity.d.ts +0 -2
- package/dist/entities/issuanceBranding/TextAttributesEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/TextAttributesEntity.js +1 -7
- package/dist/entities/issuanceBranding/TextAttributesEntity.js.map +1 -1
- package/dist/eventLogger/AbstractEventLoggerStore.d.ts +4 -2
- package/dist/eventLogger/AbstractEventLoggerStore.d.ts.map +1 -1
- package/dist/eventLogger/AbstractEventLoggerStore.js.map +1 -1
- package/dist/eventLogger/EventLoggerStore.d.ts +5 -4
- package/dist/eventLogger/EventLoggerStore.d.ts.map +1 -1
- package/dist/eventLogger/EventLoggerStore.js +35 -8
- package/dist/eventLogger/EventLoggerStore.js.map +1 -1
- package/dist/index.d.ts +20 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -26
- package/dist/index.js.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts +1 -5
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.js +17 -46
- package/dist/issuanceBranding/IssuanceBrandingStore.js.map +1 -1
- package/dist/migrations/internal-migrations-ormconfig.d.ts.map +1 -1
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.d.ts.map +1 -1
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js +5 -1
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js.map +1 -1
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.d.ts.map +1 -1
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js +34 -6
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js.map +1 -1
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js +1 -1
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js.map +1 -1
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.d.ts.map +1 -1
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js +7 -3
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js.map +1 -1
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.d.ts.map +1 -1
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js +27 -1
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js.map +1 -1
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js +1 -1
- package/dist/presentationDefinition/PDStore.d.ts.map +1 -1
- package/dist/statusList/StatusListStore.js.map +1 -1
- package/dist/types/contact/contact.d.ts +3 -3
- package/dist/types/contact/contact.d.ts.map +1 -1
- package/dist/types/digitalCredential/digitalCredential.d.ts +2 -1
- package/dist/types/digitalCredential/digitalCredential.d.ts.map +1 -1
- package/dist/types/digitalCredential/digitalCredential.js +1 -0
- package/dist/types/digitalCredential/digitalCredential.js.map +1 -1
- package/dist/types/eventLogger/IAbstractEventLoggerStore.d.ts +9 -2
- package/dist/types/eventLogger/IAbstractEventLoggerStore.d.ts.map +1 -1
- package/dist/types/eventLogger/eventLogger.d.ts +3 -2
- package/dist/types/eventLogger/eventLogger.d.ts.map +1 -1
- package/dist/types/issuanceBranding/issuanceBranding.d.ts +21 -4
- package/dist/types/issuanceBranding/issuanceBranding.d.ts.map +1 -1
- package/dist/utils/FormattingUtils.d.ts +2 -0
- package/dist/utils/FormattingUtils.d.ts.map +1 -0
- package/dist/utils/FormattingUtils.js +23 -0
- package/dist/utils/FormattingUtils.js.map +1 -0
- package/dist/utils/SortingUtils.d.ts.map +1 -1
- package/dist/utils/contact/MappingUtils.d.ts.map +1 -1
- package/dist/utils/contact/MappingUtils.js +27 -14
- package/dist/utils/contact/MappingUtils.js.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.js +7 -5
- package/dist/utils/digitalCredential/MappingUtils.js.map +1 -1
- package/dist/utils/eventLogger/MappingUtils.d.ts +8 -0
- package/dist/utils/eventLogger/MappingUtils.d.ts.map +1 -0
- package/dist/utils/eventLogger/MappingUtils.js +70 -0
- package/dist/utils/eventLogger/MappingUtils.js.map +1 -0
- package/dist/utils/issuanceBranding/MappingUtils.d.ts +24 -0
- package/dist/utils/issuanceBranding/MappingUtils.d.ts.map +1 -0
- package/dist/utils/issuanceBranding/MappingUtils.js +109 -0
- package/dist/utils/issuanceBranding/MappingUtils.js.map +1 -0
- package/dist/utils/presentationDefinition/MappingUtils.d.ts.map +1 -1
- package/dist/utils/presentationDefinition/MappingUtils.js +5 -3
- package/dist/utils/presentationDefinition/MappingUtils.js.map +1 -1
- package/package.json +10 -9
- package/src/__tests__/contact.store.test.ts +46 -4
- package/src/__tests__/digitalCredential.entities.test.ts +1 -7
- package/src/__tests__/digitalCredential.store.test.ts +85 -4
- package/src/__tests__/eventLogger.entities.test.ts +60 -5
- package/src/__tests__/eventLogger.store.test.ts +461 -3
- package/src/__tests__/issuanceBranding.entities.test.ts +129 -0
- package/src/digitalCredential/DigitalCredentialStore.ts +1 -3
- package/src/entities/digitalCredential/DigitalCredentialEntity.ts +1 -1
- package/src/entities/eventLogger/AuditEventEntity.ts +23 -28
- package/src/entities/issuanceBranding/BackgroundAttributesEntity.ts +2 -11
- package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +1 -13
- package/src/entities/issuanceBranding/CredentialClaimsEntity.ts +35 -0
- package/src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts +11 -18
- package/src/entities/issuanceBranding/ImageAttributesEntity.ts +2 -14
- package/src/entities/issuanceBranding/ImageDimensionsEntity.ts +0 -9
- package/src/entities/issuanceBranding/IssuerBrandingEntity.ts +1 -12
- package/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts +17 -17
- package/src/entities/issuanceBranding/TextAttributesEntity.ts +1 -9
- package/src/eventLogger/AbstractEventLoggerStore.ts +4 -2
- package/src/eventLogger/EventLoggerStore.ts +45 -32
- package/src/index.ts +20 -30
- package/src/issuanceBranding/IssuanceBrandingStore.ts +26 -68
- package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +11 -1
- package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +34 -6
- package/src/migrations/postgres/1708525189001-CreateDigitalCredential.ts +1 -1
- package/src/migrations/sqlite/1685628973231-CreateIssuanceBranding.ts +11 -3
- package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +27 -1
- package/src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts +1 -1
- package/src/statusList/StatusListStore.ts +1 -1
- package/src/types/contact/contact.ts +3 -3
- package/src/types/digitalCredential/digitalCredential.ts +1 -0
- package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -2
- package/src/types/eventLogger/eventLogger.ts +3 -2
- package/src/types/issuanceBranding/issuanceBranding.ts +24 -6
- package/src/utils/FormattingUtils.ts +21 -0
- package/src/utils/contact/MappingUtils.ts +39 -13
- package/src/utils/digitalCredential/MappingUtils.ts +4 -1
- package/src/utils/eventLogger/MappingUtils.ts +117 -0
- package/src/utils/issuanceBranding/MappingUtils.ts +145 -0
- package/src/utils/presentationDefinition/MappingUtils.ts +4 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
|
-
import {
|
|
2
|
+
import { ActivityLoggingEvent, AuditLoggingEvent, CredentialType, PartyCorrelationType } from '@sphereon/ssi-sdk.core'
|
|
3
|
+
import { ActionType, InitiatorType, LoggingEventType, LogLevel, SubSystem, System, SystemCorrelationIdType } from '@sphereon/ssi-types'
|
|
3
4
|
import { DataSource } from 'typeorm'
|
|
4
5
|
import { DataStoreEventLoggerMigrations } from '../migrations'
|
|
5
6
|
import { DataStoreEventLoggerEntities } from '../index'
|
|
6
|
-
import { AuditLoggingEvent, PartyCorrelationType } from '@sphereon/ssi-sdk.core'
|
|
7
7
|
import { EventLoggerStore } from '../eventLogger/EventLoggerStore'
|
|
8
|
-
import { GetAuditEventsArgs, NonPersistedAuditLoggingEvent } from '../types'
|
|
8
|
+
import { GetActivityEventsArgs, GetAuditEventsArgs, NonPersistedAuditLoggingEvent, NonPersistedActivityLoggingEvent } from '../types'
|
|
9
9
|
|
|
10
10
|
describe('Database entities tests', (): void => {
|
|
11
11
|
let dbConnection: DataSource
|
|
@@ -54,6 +54,7 @@ describe('Database entities tests', (): void => {
|
|
|
54
54
|
|
|
55
55
|
const savedAuditEvent: AuditLoggingEvent = await eventLoggerStore.storeAuditEvent({ event: auditEvent })
|
|
56
56
|
expect(savedAuditEvent).toBeDefined()
|
|
57
|
+
expect(savedAuditEvent.type).toEqual(LoggingEventType.AUDIT)
|
|
57
58
|
})
|
|
58
59
|
|
|
59
60
|
it('should get all audit events', async (): Promise<void> => {
|
|
@@ -83,6 +84,32 @@ describe('Database entities tests', (): void => {
|
|
|
83
84
|
const auditEvent2: AuditLoggingEvent = await eventLoggerStore.storeAuditEvent({ event: auditEvent })
|
|
84
85
|
expect(auditEvent2).toBeDefined()
|
|
85
86
|
|
|
87
|
+
const activityEvent: NonPersistedActivityLoggingEvent = {
|
|
88
|
+
timestamp: new Date(),
|
|
89
|
+
level: LogLevel.DEBUG,
|
|
90
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
91
|
+
originalCredential: 'test_credential_string',
|
|
92
|
+
credentialHash: '341a7897df58e472f9bf19b3b9abf7d5',
|
|
93
|
+
credentialType: CredentialType.SD_JWT,
|
|
94
|
+
system: System.GENERAL,
|
|
95
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
96
|
+
actionType: ActionType.EXECUTE,
|
|
97
|
+
actionSubType: 'Share credential',
|
|
98
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
99
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
100
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
101
|
+
systemAlias: 'test_alias',
|
|
102
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
103
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
104
|
+
partyAlias: 'test_alias',
|
|
105
|
+
description: 'test_description',
|
|
106
|
+
data: 'test_data_string',
|
|
107
|
+
diagnosticData: { data: 'test_data_string' },
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const storedActivityEvent: ActivityLoggingEvent = await eventLoggerStore.storeActivityEvent({ event: activityEvent })
|
|
111
|
+
expect(storedActivityEvent).toBeDefined()
|
|
112
|
+
|
|
86
113
|
const result: Array<AuditLoggingEvent> = await eventLoggerStore.getAuditEvents()
|
|
87
114
|
expect(result.length).toEqual(2)
|
|
88
115
|
})
|
|
@@ -120,6 +147,29 @@ describe('Database entities tests', (): void => {
|
|
|
120
147
|
})
|
|
121
148
|
|
|
122
149
|
it('should return no audit events if filter does not match', async (): Promise<void> => {
|
|
150
|
+
const auditEvent: NonPersistedAuditLoggingEvent = {
|
|
151
|
+
timestamp: new Date(),
|
|
152
|
+
level: LogLevel.DEBUG,
|
|
153
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
154
|
+
system: System.GENERAL,
|
|
155
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
156
|
+
actionType: ActionType.CREATE,
|
|
157
|
+
actionSubType: 'Key generation',
|
|
158
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
159
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
160
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
161
|
+
systemAlias: 'test_alias',
|
|
162
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
163
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
164
|
+
partyAlias: 'test_alias',
|
|
165
|
+
description: 'test_description',
|
|
166
|
+
data: 'test_data_string',
|
|
167
|
+
diagnosticData: { data: 'test_data_string' },
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const savedAuditEvent: AuditLoggingEvent = await eventLoggerStore.storeAuditEvent({ event: auditEvent })
|
|
171
|
+
expect(savedAuditEvent).toBeDefined()
|
|
172
|
+
|
|
123
173
|
const args: GetAuditEventsArgs = {
|
|
124
174
|
filter: [{ correlationId: 'unknown_id' }],
|
|
125
175
|
}
|
|
@@ -127,4 +177,412 @@ describe('Database entities tests', (): void => {
|
|
|
127
177
|
|
|
128
178
|
expect(result.length).toEqual(0)
|
|
129
179
|
})
|
|
180
|
+
|
|
181
|
+
it('should store activity event', async (): Promise<void> => {
|
|
182
|
+
const activityEvent: NonPersistedActivityLoggingEvent = {
|
|
183
|
+
timestamp: new Date(),
|
|
184
|
+
level: LogLevel.DEBUG,
|
|
185
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
186
|
+
originalCredential: 'test_credential_string',
|
|
187
|
+
credentialHash: '341a7897df58e472f9bf19b3b9abf7d5',
|
|
188
|
+
credentialType: CredentialType.SD_JWT,
|
|
189
|
+
system: System.GENERAL,
|
|
190
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
191
|
+
actionType: ActionType.EXECUTE,
|
|
192
|
+
actionSubType: 'Share credential',
|
|
193
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
194
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
195
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
196
|
+
systemAlias: 'test_alias',
|
|
197
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
198
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
199
|
+
partyAlias: 'test_alias',
|
|
200
|
+
description: 'test_description',
|
|
201
|
+
data: 'test_data_string',
|
|
202
|
+
diagnosticData: { data: 'test_data_string' },
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const savedActivityEvent: ActivityLoggingEvent = await eventLoggerStore.storeActivityEvent({ event: activityEvent })
|
|
206
|
+
expect(savedActivityEvent).toBeDefined()
|
|
207
|
+
expect(savedActivityEvent.type).toEqual(LoggingEventType.ACTIVITY)
|
|
208
|
+
expect(savedActivityEvent.originalCredential).toEqual(activityEvent.originalCredential)
|
|
209
|
+
expect(savedActivityEvent.credentialHash).toEqual(activityEvent.credentialHash)
|
|
210
|
+
expect(savedActivityEvent.credentialType).toEqual(activityEvent.credentialType)
|
|
211
|
+
expect(savedActivityEvent.data).toEqual(activityEvent.data)
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
it('should get all activity events', async (): Promise<void> => {
|
|
215
|
+
const activityEvent: NonPersistedActivityLoggingEvent = {
|
|
216
|
+
timestamp: new Date(),
|
|
217
|
+
level: LogLevel.DEBUG,
|
|
218
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
219
|
+
originalCredential: 'test_credential_string',
|
|
220
|
+
credentialHash: '341a7897df58e472f9bf19b3b9abf7d5',
|
|
221
|
+
credentialType: CredentialType.SD_JWT,
|
|
222
|
+
system: System.GENERAL,
|
|
223
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
224
|
+
actionType: ActionType.EXECUTE,
|
|
225
|
+
actionSubType: 'Share credential',
|
|
226
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
227
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
228
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
229
|
+
systemAlias: 'test_alias',
|
|
230
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
231
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
232
|
+
partyAlias: 'test_alias',
|
|
233
|
+
description: 'test_description',
|
|
234
|
+
data: 'test_data_string',
|
|
235
|
+
diagnosticData: { data: 'test_data_string' },
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const activityEvent1: ActivityLoggingEvent = await eventLoggerStore.storeActivityEvent({ event: activityEvent })
|
|
239
|
+
expect(activityEvent1).toBeDefined()
|
|
240
|
+
|
|
241
|
+
const activityEvent2: ActivityLoggingEvent = await eventLoggerStore.storeActivityEvent({ event: activityEvent })
|
|
242
|
+
expect(activityEvent2).toBeDefined()
|
|
243
|
+
|
|
244
|
+
const auditEvent: NonPersistedAuditLoggingEvent = {
|
|
245
|
+
timestamp: new Date(),
|
|
246
|
+
level: LogLevel.DEBUG,
|
|
247
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
248
|
+
system: System.GENERAL,
|
|
249
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
250
|
+
actionType: ActionType.CREATE,
|
|
251
|
+
actionSubType: 'Key generation',
|
|
252
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
253
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
254
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
255
|
+
systemAlias: 'test_alias',
|
|
256
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
257
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
258
|
+
partyAlias: 'test_alias',
|
|
259
|
+
description: 'test_description',
|
|
260
|
+
data: 'test_data_string',
|
|
261
|
+
diagnosticData: { data: 'test_data_string' },
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const storedAuditEvent: AuditLoggingEvent = await eventLoggerStore.storeAuditEvent({ event: auditEvent })
|
|
265
|
+
expect(storedAuditEvent).toBeDefined()
|
|
266
|
+
|
|
267
|
+
const result: Array<ActivityLoggingEvent> = await eventLoggerStore.getActivityEvents()
|
|
268
|
+
expect(result.length).toEqual(2)
|
|
269
|
+
})
|
|
270
|
+
|
|
271
|
+
it('should get activity events by filter', async (): Promise<void> => {
|
|
272
|
+
const activityEvent: NonPersistedActivityLoggingEvent = {
|
|
273
|
+
timestamp: new Date(),
|
|
274
|
+
level: LogLevel.DEBUG,
|
|
275
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
276
|
+
originalCredential: 'test_credential_string',
|
|
277
|
+
credentialHash: '341a7897df58e472f9bf19b3b9abf7d5',
|
|
278
|
+
credentialType: CredentialType.SD_JWT,
|
|
279
|
+
system: System.GENERAL,
|
|
280
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
281
|
+
actionType: ActionType.EXECUTE,
|
|
282
|
+
actionSubType: 'Share credential',
|
|
283
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
284
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
285
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
286
|
+
systemAlias: 'test_alias',
|
|
287
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
288
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
289
|
+
partyAlias: 'test_alias',
|
|
290
|
+
description: 'test_description',
|
|
291
|
+
data: 'test_data_string',
|
|
292
|
+
diagnosticData: { data: 'test_data_string' },
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const savedActivityEvent: ActivityLoggingEvent = await eventLoggerStore.storeActivityEvent({ event: activityEvent })
|
|
296
|
+
expect(savedActivityEvent).toBeDefined()
|
|
297
|
+
|
|
298
|
+
const args: GetActivityEventsArgs = {
|
|
299
|
+
filter: [{ credentialHash: savedActivityEvent.credentialHash }],
|
|
300
|
+
}
|
|
301
|
+
const result: Array<ActivityLoggingEvent> = await eventLoggerStore.getActivityEvents(args)
|
|
302
|
+
|
|
303
|
+
expect(result.length).toEqual(1)
|
|
304
|
+
})
|
|
305
|
+
|
|
306
|
+
it('should return no audit events if filter does not match', async (): Promise<void> => {
|
|
307
|
+
const activityEvent: NonPersistedActivityLoggingEvent = {
|
|
308
|
+
timestamp: new Date(),
|
|
309
|
+
level: LogLevel.DEBUG,
|
|
310
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
311
|
+
originalCredential: 'test_credential_string',
|
|
312
|
+
credentialHash: '341a7897df58e472f9bf19b3b9abf7d5',
|
|
313
|
+
credentialType: CredentialType.SD_JWT,
|
|
314
|
+
system: System.GENERAL,
|
|
315
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
316
|
+
actionType: ActionType.EXECUTE,
|
|
317
|
+
actionSubType: 'Share credential',
|
|
318
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
319
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
320
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
321
|
+
systemAlias: 'test_alias',
|
|
322
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
323
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
324
|
+
partyAlias: 'test_alias',
|
|
325
|
+
description: 'test_description',
|
|
326
|
+
data: 'test_data_string',
|
|
327
|
+
diagnosticData: { data: 'test_data_string' },
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const savedActivityEvent: ActivityLoggingEvent = await eventLoggerStore.storeActivityEvent({ event: activityEvent })
|
|
331
|
+
expect(savedActivityEvent).toBeDefined()
|
|
332
|
+
|
|
333
|
+
const args: GetActivityEventsArgs = {
|
|
334
|
+
filter: [{ credentialHash: 'unknown_hash' }],
|
|
335
|
+
}
|
|
336
|
+
const result: Array<ActivityLoggingEvent> = await eventLoggerStore.getActivityEvents(args)
|
|
337
|
+
|
|
338
|
+
expect(result.length).toEqual(0)
|
|
339
|
+
})
|
|
340
|
+
|
|
341
|
+
it('should get all activity events for a parent credential', async (): Promise<void> => {
|
|
342
|
+
const parentCredentialHash = 'df7037831edbde7f0f65f723ef5494d6'
|
|
343
|
+
|
|
344
|
+
const parentActivityEvent: NonPersistedActivityLoggingEvent = {
|
|
345
|
+
timestamp: new Date(),
|
|
346
|
+
level: LogLevel.DEBUG,
|
|
347
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
348
|
+
originalCredential: 'test_credential_string',
|
|
349
|
+
credentialHash: parentCredentialHash,
|
|
350
|
+
credentialType: CredentialType.SD_JWT,
|
|
351
|
+
system: System.GENERAL,
|
|
352
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
353
|
+
actionType: ActionType.EXECUTE,
|
|
354
|
+
actionSubType: 'Share credential',
|
|
355
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
356
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
357
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
358
|
+
systemAlias: 'test_alias',
|
|
359
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
360
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
361
|
+
partyAlias: 'test_alias',
|
|
362
|
+
description: 'test_description',
|
|
363
|
+
data: 'test_data_string',
|
|
364
|
+
diagnosticData: { data: 'test_data_string' },
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const storedParentActivityEvent: ActivityLoggingEvent = await eventLoggerStore.storeActivityEvent({ event: parentActivityEvent })
|
|
368
|
+
expect(storedParentActivityEvent).toBeDefined()
|
|
369
|
+
|
|
370
|
+
const childActivityEvent: NonPersistedActivityLoggingEvent = {
|
|
371
|
+
timestamp: new Date(),
|
|
372
|
+
level: LogLevel.DEBUG,
|
|
373
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
374
|
+
originalCredential: 'test_credential_string',
|
|
375
|
+
credentialHash: '341a7897df58e472f9bf19b3b9abf7d5',
|
|
376
|
+
parentCredentialHash,
|
|
377
|
+
credentialType: CredentialType.SD_JWT,
|
|
378
|
+
system: System.GENERAL,
|
|
379
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
380
|
+
actionType: ActionType.EXECUTE,
|
|
381
|
+
actionSubType: 'Share credential',
|
|
382
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
383
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
384
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
385
|
+
systemAlias: 'test_alias',
|
|
386
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
387
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
388
|
+
partyAlias: 'test_alias',
|
|
389
|
+
description: 'test_description',
|
|
390
|
+
data: 'test_data_string',
|
|
391
|
+
diagnosticData: { data: 'test_data_string' },
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const storedChildActivityEvent: ActivityLoggingEvent = await eventLoggerStore.storeActivityEvent({ event: childActivityEvent })
|
|
395
|
+
expect(storedChildActivityEvent).toBeDefined()
|
|
396
|
+
|
|
397
|
+
const otherActivityEvent: NonPersistedActivityLoggingEvent = {
|
|
398
|
+
timestamp: new Date(),
|
|
399
|
+
level: LogLevel.DEBUG,
|
|
400
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
401
|
+
originalCredential: 'test_credential_string',
|
|
402
|
+
credentialHash: 'a8360b0b0b2eed8d185738536ff5b841',
|
|
403
|
+
credentialType: CredentialType.SD_JWT,
|
|
404
|
+
system: System.GENERAL,
|
|
405
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
406
|
+
actionType: ActionType.EXECUTE,
|
|
407
|
+
actionSubType: 'Share credential', // TODO
|
|
408
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
409
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
410
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
411
|
+
systemAlias: 'test_alias',
|
|
412
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
413
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
414
|
+
partyAlias: 'test_alias',
|
|
415
|
+
description: 'test_description',
|
|
416
|
+
data: 'test_data_string',
|
|
417
|
+
diagnosticData: { data: 'test_data_string' },
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const storedOtherActivityEvent: ActivityLoggingEvent = await eventLoggerStore.storeActivityEvent({ event: otherActivityEvent })
|
|
421
|
+
expect(storedOtherActivityEvent).toBeDefined()
|
|
422
|
+
|
|
423
|
+
const receiveActivityEvent: NonPersistedActivityLoggingEvent = {
|
|
424
|
+
timestamp: new Date(),
|
|
425
|
+
level: LogLevel.DEBUG,
|
|
426
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
427
|
+
originalCredential: 'test_credential_string',
|
|
428
|
+
credentialHash: parentCredentialHash,
|
|
429
|
+
credentialType: CredentialType.SD_JWT,
|
|
430
|
+
system: System.GENERAL,
|
|
431
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
432
|
+
actionType: ActionType.EXECUTE,
|
|
433
|
+
actionSubType: 'Receive credential',
|
|
434
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
435
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
436
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
437
|
+
systemAlias: 'test_alias',
|
|
438
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
439
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
440
|
+
partyAlias: 'test_alias',
|
|
441
|
+
description: 'test_description',
|
|
442
|
+
data: 'test_data_string',
|
|
443
|
+
diagnosticData: { data: 'test_data_string' },
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
const storedReceiveActivityEvent: ActivityLoggingEvent = await eventLoggerStore.storeActivityEvent({ event: receiveActivityEvent })
|
|
447
|
+
expect(storedReceiveActivityEvent).toBeDefined()
|
|
448
|
+
|
|
449
|
+
const args: GetActivityEventsArgs = {
|
|
450
|
+
filter: [
|
|
451
|
+
{
|
|
452
|
+
credentialHash: parentCredentialHash,
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
parentCredentialHash,
|
|
456
|
+
},
|
|
457
|
+
],
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
const result: Array<ActivityLoggingEvent> = await eventLoggerStore.getActivityEvents(args)
|
|
461
|
+
expect(result.length).toEqual(3)
|
|
462
|
+
})
|
|
463
|
+
|
|
464
|
+
it('should get all activity events for a parent credential with a certain action', async (): Promise<void> => {
|
|
465
|
+
const parentCredentialHash = 'df7037831edbde7f0f65f723ef5494d6'
|
|
466
|
+
|
|
467
|
+
const parentActivityEvent: NonPersistedActivityLoggingEvent = {
|
|
468
|
+
timestamp: new Date(),
|
|
469
|
+
level: LogLevel.DEBUG,
|
|
470
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
471
|
+
originalCredential: 'test_credential_string',
|
|
472
|
+
credentialHash: parentCredentialHash,
|
|
473
|
+
credentialType: CredentialType.SD_JWT,
|
|
474
|
+
system: System.GENERAL,
|
|
475
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
476
|
+
actionType: ActionType.EXECUTE,
|
|
477
|
+
actionSubType: 'Share credential',
|
|
478
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
479
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
480
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
481
|
+
systemAlias: 'test_alias',
|
|
482
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
483
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
484
|
+
partyAlias: 'test_alias',
|
|
485
|
+
description: 'test_description',
|
|
486
|
+
data: 'test_data_string',
|
|
487
|
+
diagnosticData: { data: 'test_data_string' },
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
const storedParentActivityEvent: ActivityLoggingEvent = await eventLoggerStore.storeActivityEvent({ event: parentActivityEvent })
|
|
491
|
+
expect(storedParentActivityEvent).toBeDefined()
|
|
492
|
+
|
|
493
|
+
const childActivityEvent: NonPersistedActivityLoggingEvent = {
|
|
494
|
+
timestamp: new Date(),
|
|
495
|
+
level: LogLevel.DEBUG,
|
|
496
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
497
|
+
originalCredential: 'test_credential_string',
|
|
498
|
+
credentialHash: '341a7897df58e472f9bf19b3b9abf7d5',
|
|
499
|
+
parentCredentialHash,
|
|
500
|
+
credentialType: CredentialType.SD_JWT,
|
|
501
|
+
system: System.GENERAL,
|
|
502
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
503
|
+
actionType: ActionType.EXECUTE,
|
|
504
|
+
actionSubType: 'Share credential',
|
|
505
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
506
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
507
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
508
|
+
systemAlias: 'test_alias',
|
|
509
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
510
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
511
|
+
partyAlias: 'test_alias',
|
|
512
|
+
description: 'test_description',
|
|
513
|
+
data: 'test_data_string',
|
|
514
|
+
diagnosticData: { data: 'test_data_string' },
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
const storedChildActivityEvent: ActivityLoggingEvent = await eventLoggerStore.storeActivityEvent({ event: childActivityEvent })
|
|
518
|
+
expect(storedChildActivityEvent).toBeDefined()
|
|
519
|
+
|
|
520
|
+
const otherActivityEvent: NonPersistedActivityLoggingEvent = {
|
|
521
|
+
timestamp: new Date(),
|
|
522
|
+
level: LogLevel.DEBUG,
|
|
523
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
524
|
+
originalCredential: 'test_credential_string',
|
|
525
|
+
credentialHash: 'a8360b0b0b2eed8d185738536ff5b841',
|
|
526
|
+
credentialType: CredentialType.SD_JWT,
|
|
527
|
+
system: System.GENERAL,
|
|
528
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
529
|
+
actionType: ActionType.EXECUTE,
|
|
530
|
+
actionSubType: 'Share credential', // TODO
|
|
531
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
532
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
533
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
534
|
+
systemAlias: 'test_alias',
|
|
535
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
536
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
537
|
+
partyAlias: 'test_alias',
|
|
538
|
+
description: 'test_description',
|
|
539
|
+
data: 'test_data_string',
|
|
540
|
+
diagnosticData: { data: 'test_data_string' },
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
const storedOtherActivityEvent: ActivityLoggingEvent = await eventLoggerStore.storeActivityEvent({ event: otherActivityEvent })
|
|
544
|
+
expect(storedOtherActivityEvent).toBeDefined()
|
|
545
|
+
|
|
546
|
+
const receiveActivityEvent: NonPersistedActivityLoggingEvent = {
|
|
547
|
+
timestamp: new Date(),
|
|
548
|
+
level: LogLevel.DEBUG,
|
|
549
|
+
correlationId: 'b40b8474-58a2-4b23-9fde-bd6ee1902cdb',
|
|
550
|
+
originalCredential: 'test_credential_string',
|
|
551
|
+
credentialHash: parentCredentialHash,
|
|
552
|
+
credentialType: CredentialType.SD_JWT,
|
|
553
|
+
system: System.GENERAL,
|
|
554
|
+
subSystemType: SubSystem.DID_PROVIDER,
|
|
555
|
+
actionType: ActionType.EXECUTE,
|
|
556
|
+
actionSubType: 'Receive credential',
|
|
557
|
+
initiatorType: InitiatorType.EXTERNAL,
|
|
558
|
+
systemCorrelationIdType: SystemCorrelationIdType.DID,
|
|
559
|
+
systemCorrelationId: 'did:example:123456789abcdefghi',
|
|
560
|
+
systemAlias: 'test_alias',
|
|
561
|
+
partyCorrelationType: PartyCorrelationType.DID,
|
|
562
|
+
partyCorrelationId: '75cfd84a-0f3b-4fb1-97a3-a1506c7ab850',
|
|
563
|
+
partyAlias: 'test_alias',
|
|
564
|
+
description: 'test_description',
|
|
565
|
+
data: 'test_data_string',
|
|
566
|
+
diagnosticData: { data: 'test_data_string' },
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
const storedReceiveActivityEvent: ActivityLoggingEvent = await eventLoggerStore.storeActivityEvent({ event: receiveActivityEvent })
|
|
570
|
+
expect(storedReceiveActivityEvent).toBeDefined()
|
|
571
|
+
|
|
572
|
+
const args: GetActivityEventsArgs = {
|
|
573
|
+
filter: [
|
|
574
|
+
{
|
|
575
|
+
credentialHash: parentCredentialHash,
|
|
576
|
+
actionSubType: 'Share credential',
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
parentCredentialHash,
|
|
580
|
+
actionSubType: 'Share credential',
|
|
581
|
+
},
|
|
582
|
+
],
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
const result: Array<ActivityLoggingEvent> = await eventLoggerStore.getActivityEvents(args)
|
|
586
|
+
expect(result.length).toEqual(2)
|
|
587
|
+
})
|
|
130
588
|
})
|