@sphereon/ssi-sdk.data-store 0.30.2-feature.siop.fixes.41 → 0.30.2-fix.136
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/eventLogger/AuditEventEntity.d.ts +10 -3
- package/dist/entities/eventLogger/AuditEventEntity.d.ts.map +1 -1
- package/dist/entities/eventLogger/AuditEventEntity.js +57 -1
- package/dist/entities/eventLogger/AuditEventEntity.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 +34 -7
- package/dist/eventLogger/EventLoggerStore.js.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts +0 -4
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.js +13 -42
- package/dist/issuanceBranding/IssuanceBrandingStore.js.map +1 -1
- package/dist/migrations/internal-migrations-ormconfig.d.ts.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/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/presentationDefinition/PDStore.d.ts.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/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 +5 -0
- package/dist/utils/eventLogger/MappingUtils.d.ts.map +1 -0
- package/dist/utils/eventLogger/MappingUtils.js +16 -0
- package/dist/utils/eventLogger/MappingUtils.js.map +1 -0
- package/dist/utils/issuanceBranding/MappingUtils.d.ts +8 -0
- package/dist/utils/issuanceBranding/MappingUtils.d.ts.map +1 -0
- package/dist/utils/issuanceBranding/MappingUtils.js +20 -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 +7 -7
- package/src/__tests__/digitalCredential.store.test.ts +83 -4
- package/src/__tests__/eventLogger.entities.test.ts +60 -5
- package/src/__tests__/eventLogger.store.test.ts +480 -3
- package/src/digitalCredential/DigitalCredentialStore.ts +1 -3
- package/src/entities/eventLogger/AuditEventEntity.ts +54 -3
- package/src/eventLogger/AbstractEventLoggerStore.ts +9 -2
- package/src/eventLogger/EventLoggerStore.ts +54 -32
- package/src/issuanceBranding/IssuanceBrandingStore.ts +13 -63
- package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +34 -6
- package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +27 -1
- package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -2
- package/src/types/eventLogger/eventLogger.ts +3 -2
- 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 +61 -0
- package/src/utils/issuanceBranding/MappingUtils.ts +32 -0
- package/src/utils/presentationDefinition/MappingUtils.ts +4 -1
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
NonPersistedDigitalCredential,
|
|
19
19
|
RegulationType,
|
|
20
20
|
} from '../../types'
|
|
21
|
+
import { replaceNullWithUndefined } from '../FormattingUtils'
|
|
21
22
|
|
|
22
23
|
function determineDocumentType(raw: string): DocumentType {
|
|
23
24
|
const rawDocument = parseRawDocument(raw)
|
|
@@ -150,9 +151,11 @@ export const nonPersistedDigitalCredentialEntityFromAddArgs = (addCredentialArgs
|
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
export const digitalCredentialFrom = (credentialEntity: DigitalCredentialEntity): DigitalCredential => {
|
|
153
|
-
|
|
154
|
+
const result: DigitalCredential = {
|
|
154
155
|
...credentialEntity,
|
|
155
156
|
}
|
|
157
|
+
|
|
158
|
+
return replaceNullWithUndefined(result)
|
|
156
159
|
}
|
|
157
160
|
|
|
158
161
|
export const digitalCredentialsFrom = (credentialEntities: Array<DigitalCredentialEntity>): DigitalCredential[] => {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { AuditEventEntity } from '../../entities/eventLogger/AuditEventEntity'
|
|
2
|
+
import { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
3
|
+
import { LoggingEventType } from '@sphereon/ssi-types'
|
|
4
|
+
import { replaceNullWithUndefined } from '../FormattingUtils'
|
|
5
|
+
|
|
6
|
+
export const auditEventFrom = (event: AuditEventEntity): AuditLoggingEvent => {
|
|
7
|
+
const result: AuditLoggingEvent = {
|
|
8
|
+
id: event.id,
|
|
9
|
+
type: LoggingEventType.AUDIT,
|
|
10
|
+
description: event.description,
|
|
11
|
+
timestamp: event.timestamp,
|
|
12
|
+
level: event.level,
|
|
13
|
+
correlationId: event.correlationId,
|
|
14
|
+
actionType: event.actionType,
|
|
15
|
+
actionSubType: event.actionSubType,
|
|
16
|
+
initiatorType: event.initiatorType,
|
|
17
|
+
partyAlias: event.partyAlias,
|
|
18
|
+
partyCorrelationId: event.partyCorrelationId,
|
|
19
|
+
partyCorrelationType: event.partyCorrelationType,
|
|
20
|
+
subSystemType: event.subSystemType,
|
|
21
|
+
system: event.system,
|
|
22
|
+
systemAlias: event.systemAlias,
|
|
23
|
+
systemCorrelationId: event.systemCorrelationId,
|
|
24
|
+
systemCorrelationIdType: event.systemCorrelationIdType,
|
|
25
|
+
...(event.data && { data: JSON.parse(event.data) }),
|
|
26
|
+
...(event.diagnosticData && { diagnosticData: JSON.parse(event.diagnosticData) }),
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return replaceNullWithUndefined(result)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const activityEventFrom = (event: AuditEventEntity): ActivityLoggingEvent => {
|
|
33
|
+
|
|
34
|
+
const result: ActivityLoggingEvent = {
|
|
35
|
+
id: event.id,
|
|
36
|
+
type: LoggingEventType.ACTIVITY,
|
|
37
|
+
credentialType: event.credentialType!,
|
|
38
|
+
originalCredential: event.originalCredential,
|
|
39
|
+
credentialHash: event.credentialHash,
|
|
40
|
+
sharePurpose: event.sharePurpose,
|
|
41
|
+
description: event.description,
|
|
42
|
+
timestamp: event.timestamp,
|
|
43
|
+
level: event.level,
|
|
44
|
+
correlationId: event.correlationId,
|
|
45
|
+
actionType: event.actionType,
|
|
46
|
+
actionSubType: event.actionSubType,
|
|
47
|
+
initiatorType: event.initiatorType,
|
|
48
|
+
partyAlias: event.partyAlias,
|
|
49
|
+
partyCorrelationId: event.partyCorrelationId,
|
|
50
|
+
partyCorrelationType: event.partyCorrelationType,
|
|
51
|
+
subSystemType: event.subSystemType,
|
|
52
|
+
system: event.system,
|
|
53
|
+
systemAlias: event.systemAlias,
|
|
54
|
+
systemCorrelationId: event.systemCorrelationId,
|
|
55
|
+
systemCorrelationIdType: event.systemCorrelationIdType,
|
|
56
|
+
...(event.data && { data: JSON.parse(event.data) }),
|
|
57
|
+
...(event.diagnosticData && { diagnosticData: JSON.parse(event.diagnosticData) }),
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return replaceNullWithUndefined(result)
|
|
61
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CredentialBrandingEntity } from '../../entities/issuanceBranding/CredentialBrandingEntity'
|
|
2
|
+
import { BaseLocaleBrandingEntity } from '../../entities/issuanceBranding/BaseLocaleBrandingEntity'
|
|
3
|
+
import { IssuerBrandingEntity } from '../../entities/issuanceBranding/IssuerBrandingEntity'
|
|
4
|
+
import { replaceNullWithUndefined } from '../FormattingUtils'
|
|
5
|
+
import { ICredentialBranding, IIssuerBranding, ILocaleBranding } from '../../types'
|
|
6
|
+
|
|
7
|
+
export const credentialBrandingFrom = (credentialBranding: CredentialBrandingEntity): ICredentialBranding => {
|
|
8
|
+
const result: ICredentialBranding = {
|
|
9
|
+
...credentialBranding,
|
|
10
|
+
localeBranding: credentialBranding.localeBranding.map((localeBranding: BaseLocaleBrandingEntity) => localeBrandingFrom(localeBranding)),
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return replaceNullWithUndefined(result)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const issuerBrandingFrom = (issuerBranding: IssuerBrandingEntity): IIssuerBranding => {
|
|
17
|
+
const result: IIssuerBranding = {
|
|
18
|
+
...issuerBranding,
|
|
19
|
+
localeBranding: issuerBranding.localeBranding.map((localeBranding: BaseLocaleBrandingEntity) => localeBrandingFrom(localeBranding)),
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return replaceNullWithUndefined(result)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const localeBrandingFrom = (localeBranding: BaseLocaleBrandingEntity): ILocaleBranding => {
|
|
26
|
+
const result: ILocaleBranding = {
|
|
27
|
+
...localeBranding,
|
|
28
|
+
locale: localeBranding.locale === '' ? undefined : localeBranding.locale,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return replaceNullWithUndefined(result)
|
|
32
|
+
}
|
|
@@ -2,9 +2,10 @@ import { PresentationDefinitionItemEntity } from '../../entities/presentationDef
|
|
|
2
2
|
import { IPresentationDefinition } from '@sphereon/pex'
|
|
3
3
|
import { NonPersistedPresentationDefinitionItem, PartialPresentationDefinitionItem, PresentationDefinitionItem } from '../../types'
|
|
4
4
|
import { blake2bHex } from 'blakejs'
|
|
5
|
+
import { replaceNullWithUndefined } from '../FormattingUtils'
|
|
5
6
|
|
|
6
7
|
export const presentationDefinitionItemFrom = (entity: PresentationDefinitionItemEntity): PresentationDefinitionItem => {
|
|
7
|
-
|
|
8
|
+
const result: PresentationDefinitionItem = {
|
|
8
9
|
id: entity.id,
|
|
9
10
|
tenantId: entity.tenantId,
|
|
10
11
|
definitionId: entity.definitionId,
|
|
@@ -15,6 +16,8 @@ export const presentationDefinitionItemFrom = (entity: PresentationDefinitionIte
|
|
|
15
16
|
createdAt: entity.createdAt,
|
|
16
17
|
lastUpdatedAt: entity.lastUpdatedAt,
|
|
17
18
|
}
|
|
19
|
+
|
|
20
|
+
return replaceNullWithUndefined(result)
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
export const presentationDefinitionEntityItemFrom = (item: NonPersistedPresentationDefinitionItem): PresentationDefinitionItemEntity => {
|