@sphereon/ssi-sdk.data-store 0.30.2-feature.CWALL.254.basedon.from.funke.78 → 0.30.2-feature.FIDES.integration.225
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/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/CredentialLocaleBrandingEntity.d.ts +0 -2
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.d.ts.map +1 -1
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js +1 -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 -3
- package/dist/eventLogger/EventLoggerStore.d.ts.map +1 -1
- package/dist/eventLogger/EventLoggerStore.js +32 -3
- package/dist/eventLogger/EventLoggerStore.js.map +1 -1
- package/dist/index.d.ts +14 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -18
- package/dist/index.js.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.js +5 -5
- package/dist/issuanceBranding/IssuanceBrandingStore.js.map +1 -1
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js +1 -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.js +3 -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/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 +7 -2
- package/dist/types/issuanceBranding/issuanceBranding.d.ts.map +1 -1
- package/dist/utils/eventLogger/MappingUtils.d.ts +5 -1
- package/dist/utils/eventLogger/MappingUtils.d.ts.map +1 -1
- package/dist/utils/eventLogger/MappingUtils.js +62 -2
- package/dist/utils/eventLogger/MappingUtils.js.map +1 -1
- package/dist/utils/issuanceBranding/MappingUtils.d.ts +15 -1
- package/dist/utils/issuanceBranding/MappingUtils.d.ts.map +1 -1
- package/dist/utils/issuanceBranding/MappingUtils.js +81 -1
- package/dist/utils/issuanceBranding/MappingUtils.js.map +1 -1
- package/package.json +6 -6
- package/src/__tests__/contact.store.test.ts +59 -4
- package/src/__tests__/digitalCredential.entities.test.ts +5 -5
- 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/__tests__/issuanceBranding.entities.test.ts +8 -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/CredentialLocaleBrandingEntity.ts +0 -17
- 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 +9 -2
- package/src/eventLogger/EventLoggerStore.ts +56 -11
- package/src/index.ts +13 -26
- package/src/issuanceBranding/IssuanceBrandingStore.ts +14 -6
- package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +1 -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 +3 -3
- package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +27 -1
- package/src/migrations/sqlite/1708525189002-CreateDigitalCredential.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 +9 -3
- package/src/utils/eventLogger/MappingUtils.ts +90 -2
- package/src/utils/issuanceBranding/MappingUtils.ts +105 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution'
|
|
2
2
|
import { IIdentifier } from '@veramo/core'
|
|
3
|
-
import {
|
|
3
|
+
import { IIssuerLocaleBranding } from '../issuanceBranding/issuanceBranding'
|
|
4
4
|
import { CredentialRole } from '../digitalCredential/digitalCredential'
|
|
5
5
|
|
|
6
6
|
export type MetadataTypes = string | number | Date | boolean | undefined
|
|
@@ -26,7 +26,7 @@ export type Party = {
|
|
|
26
26
|
contact: Contact
|
|
27
27
|
partyType: PartyType
|
|
28
28
|
/**
|
|
29
|
-
* TODO: Integrate branding logic here in the future.
|
|
29
|
+
* TODO: Integrate branding logic here in the future. What we should do is make the issuance branding plugin part of the contact-manager and retrieve any branding there is.
|
|
30
30
|
*
|
|
31
31
|
* Currently, we are only defining the branding type within the SDK without implementing the associated logic. This is because:
|
|
32
32
|
* 1. We are combining two types from the SSI-SDK to create a new type that will be used across multiple places in the wallets (web & mobile).
|
|
@@ -35,7 +35,7 @@ export type Party = {
|
|
|
35
35
|
*
|
|
36
36
|
* For now, we are defining the type here and will use it in the mobile wallet has the logic for it. This is a temporary solution until we have the resources to integrate the branding logic fully.
|
|
37
37
|
*/
|
|
38
|
-
branding?:
|
|
38
|
+
branding?: IIssuerLocaleBranding
|
|
39
39
|
relationships: Array<PartyRelationship>
|
|
40
40
|
createdAt: Date
|
|
41
41
|
lastUpdatedAt: Date
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import { PartialAuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
2
|
-
import { NonPersistedAuditLoggingEvent } from './eventLogger'
|
|
1
|
+
import { PartialActivityLoggingEvent, PartialAuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
2
|
+
import { NonPersistedActivityLoggingEvent, NonPersistedAuditLoggingEvent } from './eventLogger'
|
|
3
3
|
|
|
4
4
|
export type FindAuditLoggingEventArgs = Array<PartialAuditLoggingEvent>
|
|
5
5
|
|
|
6
|
+
export type FindActivityLoggingEventArgs = Array<PartialActivityLoggingEvent>
|
|
7
|
+
|
|
6
8
|
export type StoreAuditEventArgs = {
|
|
7
9
|
event: NonPersistedAuditLoggingEvent
|
|
8
10
|
}
|
|
9
11
|
|
|
12
|
+
export type StoreActivityEventArgs = {
|
|
13
|
+
event: NonPersistedActivityLoggingEvent
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
export type GetAuditEventsArgs = {
|
|
11
17
|
filter?: FindAuditLoggingEventArgs
|
|
12
18
|
}
|
|
19
|
+
|
|
20
|
+
export type GetActivityEventsArgs = {
|
|
21
|
+
filter?: FindActivityLoggingEventArgs
|
|
22
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
1
|
+
import { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
2
2
|
|
|
3
|
-
export type NonPersistedAuditLoggingEvent = Omit<AuditLoggingEvent, 'id'>
|
|
3
|
+
export type NonPersistedAuditLoggingEvent = Omit<AuditLoggingEvent, 'id' | 'type'>
|
|
4
|
+
export type NonPersistedActivityLoggingEvent = Omit<ActivityLoggingEvent, 'id' | 'type'>
|
|
@@ -80,17 +80,23 @@ export interface IPartialCredentialBranding extends Partial<Omit<ICredentialBran
|
|
|
80
80
|
localeBranding?: IPartialCredentialLocaleBranding
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
export interface IIssuerLocaleBranding extends ILocaleBranding {
|
|
83
|
+
export interface IIssuerLocaleBranding extends ILocaleBranding {
|
|
84
|
+
clientUri?: string
|
|
85
|
+
tosUri?: string
|
|
86
|
+
policyUri?: string
|
|
87
|
+
contacts?: Array<string>
|
|
88
|
+
}
|
|
84
89
|
export interface IBasicIssuerLocaleBranding
|
|
85
90
|
extends Omit<IIssuerLocaleBranding, 'id' | 'createdAt' | 'lastUpdatedAt' | 'logo' | 'background' | 'text'> {
|
|
86
91
|
logo?: IBasicImageAttributes
|
|
87
92
|
background?: IBasicBackgroundAttributes
|
|
88
93
|
text?: IBasicTextAttributes
|
|
89
94
|
}
|
|
90
|
-
export interface IPartialIssuerLocaleBranding extends Partial<Omit<IIssuerLocaleBranding, 'logo' | 'background' | 'text'>> {
|
|
95
|
+
export interface IPartialIssuerLocaleBranding extends Partial<Omit<IIssuerLocaleBranding, 'logo' | 'background' | 'text' | 'contacts'>> {
|
|
91
96
|
logo?: IPartialImageAttributes
|
|
92
97
|
background?: IPartialBackgroundAttributes
|
|
93
98
|
text?: IPartialTextAttributes
|
|
99
|
+
contacts?: string
|
|
94
100
|
}
|
|
95
101
|
|
|
96
102
|
export interface IIssuerBranding {
|
|
@@ -103,7 +109,7 @@ export interface IIssuerBranding {
|
|
|
103
109
|
export interface IBasicIssuerBranding extends Omit<IIssuerBranding, 'id' | 'createdAt' | 'lastUpdatedAt' | 'localeBranding'> {
|
|
104
110
|
localeBranding: Array<IBasicIssuerLocaleBranding>
|
|
105
111
|
}
|
|
106
|
-
export interface IPartialIssuerBranding extends Partial<Omit<
|
|
112
|
+
export interface IPartialIssuerBranding extends Partial<Omit<IIssuerBranding, 'localeBranding'>> {
|
|
107
113
|
localeBranding?: IPartialIssuerLocaleBranding
|
|
108
114
|
}
|
|
109
115
|
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
2
|
+
import { LoggingEventType } from '@sphereon/ssi-types'
|
|
3
3
|
import { replaceNullWithUndefined } from '../FormattingUtils'
|
|
4
|
+
import { AuditEventEntity } from '../../entities/eventLogger/AuditEventEntity'
|
|
5
|
+
import { NonPersistedActivityLoggingEvent, NonPersistedAuditLoggingEvent } from '../../types'
|
|
4
6
|
|
|
5
7
|
export const auditEventFrom = (event: AuditEventEntity): AuditLoggingEvent => {
|
|
6
8
|
const result: AuditLoggingEvent = {
|
|
7
9
|
id: event.id,
|
|
10
|
+
type: LoggingEventType.AUDIT,
|
|
8
11
|
description: event.description,
|
|
9
12
|
timestamp: event.timestamp,
|
|
10
13
|
level: event.level,
|
|
@@ -26,3 +29,88 @@ export const auditEventFrom = (event: AuditEventEntity): AuditLoggingEvent => {
|
|
|
26
29
|
|
|
27
30
|
return replaceNullWithUndefined(result)
|
|
28
31
|
}
|
|
32
|
+
|
|
33
|
+
export const auditEventEntityFrom = (args: NonPersistedAuditLoggingEvent): AuditEventEntity => {
|
|
34
|
+
const auditEventEntity: AuditEventEntity = new AuditEventEntity()
|
|
35
|
+
auditEventEntity.type = LoggingEventType.AUDIT
|
|
36
|
+
auditEventEntity.timestamp = args.timestamp
|
|
37
|
+
auditEventEntity.level = args.level
|
|
38
|
+
auditEventEntity.correlationId = args.correlationId
|
|
39
|
+
auditEventEntity.system = args.system
|
|
40
|
+
auditEventEntity.subSystemType = args.subSystemType
|
|
41
|
+
auditEventEntity.actionType = args.actionType
|
|
42
|
+
auditEventEntity.actionSubType = args.actionSubType
|
|
43
|
+
auditEventEntity.initiatorType = args.initiatorType
|
|
44
|
+
auditEventEntity.systemCorrelationIdType = args.systemCorrelationIdType
|
|
45
|
+
auditEventEntity.systemCorrelationId = args.systemCorrelationId
|
|
46
|
+
auditEventEntity.systemAlias = args.systemAlias
|
|
47
|
+
auditEventEntity.partyCorrelationType = args.partyCorrelationType
|
|
48
|
+
auditEventEntity.partyCorrelationId = args.partyCorrelationId
|
|
49
|
+
auditEventEntity.partyAlias = args.partyAlias
|
|
50
|
+
auditEventEntity.description = args.description
|
|
51
|
+
auditEventEntity.partyCorrelationType = args.partyCorrelationType
|
|
52
|
+
auditEventEntity.data = JSON.stringify(args.data)
|
|
53
|
+
auditEventEntity.diagnosticData = JSON.stringify(args.diagnosticData)
|
|
54
|
+
|
|
55
|
+
return auditEventEntity
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const activityEventFrom = (event: AuditEventEntity): ActivityLoggingEvent => {
|
|
59
|
+
const result: ActivityLoggingEvent = {
|
|
60
|
+
id: event.id,
|
|
61
|
+
type: LoggingEventType.ACTIVITY,
|
|
62
|
+
credentialType: event.credentialType!,
|
|
63
|
+
originalCredential: event.originalCredential,
|
|
64
|
+
credentialHash: event.credentialHash,
|
|
65
|
+
sharePurpose: event.sharePurpose,
|
|
66
|
+
description: event.description,
|
|
67
|
+
timestamp: event.timestamp,
|
|
68
|
+
level: event.level,
|
|
69
|
+
correlationId: event.correlationId,
|
|
70
|
+
actionType: event.actionType,
|
|
71
|
+
actionSubType: event.actionSubType,
|
|
72
|
+
initiatorType: event.initiatorType,
|
|
73
|
+
partyAlias: event.partyAlias,
|
|
74
|
+
partyCorrelationId: event.partyCorrelationId,
|
|
75
|
+
partyCorrelationType: event.partyCorrelationType,
|
|
76
|
+
subSystemType: event.subSystemType,
|
|
77
|
+
system: event.system,
|
|
78
|
+
systemAlias: event.systemAlias,
|
|
79
|
+
systemCorrelationId: event.systemCorrelationId,
|
|
80
|
+
systemCorrelationIdType: event.systemCorrelationIdType,
|
|
81
|
+
...(event.data && { data: JSON.parse(event.data) }),
|
|
82
|
+
...(event.diagnosticData && { diagnosticData: JSON.parse(event.diagnosticData) }),
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return replaceNullWithUndefined(result)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const activityEventEntityFrom = (args: NonPersistedActivityLoggingEvent): AuditEventEntity => {
|
|
89
|
+
const activityEventEntity: AuditEventEntity = new AuditEventEntity()
|
|
90
|
+
activityEventEntity.type = LoggingEventType.ACTIVITY
|
|
91
|
+
activityEventEntity.timestamp = args.timestamp
|
|
92
|
+
activityEventEntity.level = args.level
|
|
93
|
+
activityEventEntity.correlationId = args.correlationId
|
|
94
|
+
activityEventEntity.system = args.system
|
|
95
|
+
activityEventEntity.subSystemType = args.subSystemType
|
|
96
|
+
activityEventEntity.actionType = args.actionType
|
|
97
|
+
activityEventEntity.actionSubType = args.actionSubType
|
|
98
|
+
activityEventEntity.initiatorType = args.initiatorType
|
|
99
|
+
activityEventEntity.systemCorrelationIdType = args.systemCorrelationIdType
|
|
100
|
+
activityEventEntity.systemCorrelationId = args.systemCorrelationId
|
|
101
|
+
activityEventEntity.systemAlias = args.systemAlias
|
|
102
|
+
activityEventEntity.partyCorrelationType = args.partyCorrelationType
|
|
103
|
+
activityEventEntity.partyCorrelationId = args.partyCorrelationId
|
|
104
|
+
activityEventEntity.partyAlias = args.partyAlias
|
|
105
|
+
activityEventEntity.description = args.description
|
|
106
|
+
activityEventEntity.partyCorrelationType = args.partyCorrelationType
|
|
107
|
+
activityEventEntity.data = JSON.stringify(args.data)
|
|
108
|
+
activityEventEntity.sharePurpose = args.sharePurpose
|
|
109
|
+
activityEventEntity.credentialType = args.credentialType
|
|
110
|
+
activityEventEntity.originalCredential = args.originalCredential
|
|
111
|
+
activityEventEntity.credentialHash = args.credentialHash
|
|
112
|
+
activityEventEntity.parentCredentialHash = args.parentCredentialHash
|
|
113
|
+
activityEventEntity.diagnosticData = JSON.stringify(args.diagnosticData)
|
|
114
|
+
|
|
115
|
+
return activityEventEntity
|
|
116
|
+
}
|
|
@@ -1,8 +1,27 @@
|
|
|
1
|
+
import { replaceNullWithUndefined } from '../FormattingUtils'
|
|
2
|
+
import { isEmptyString } from '../../entities/validators'
|
|
1
3
|
import { CredentialBrandingEntity } from '../../entities/issuanceBranding/CredentialBrandingEntity'
|
|
2
4
|
import { BaseLocaleBrandingEntity } from '../../entities/issuanceBranding/BaseLocaleBrandingEntity'
|
|
3
5
|
import { IssuerBrandingEntity } from '../../entities/issuanceBranding/IssuerBrandingEntity'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
+
import { ImageAttributesEntity } from '../../entities/issuanceBranding/ImageAttributesEntity'
|
|
7
|
+
import { BackgroundAttributesEntity } from '../../entities/issuanceBranding/BackgroundAttributesEntity'
|
|
8
|
+
import { TextAttributesEntity } from '../../entities/issuanceBranding/TextAttributesEntity'
|
|
9
|
+
import { IssuerLocaleBrandingEntity } from '../../entities/issuanceBranding/IssuerLocaleBrandingEntity'
|
|
10
|
+
import { CredentialLocaleBrandingEntity } from '../../entities/issuanceBranding/CredentialLocaleBrandingEntity'
|
|
11
|
+
import { ImageDimensionsEntity } from '../../entities/issuanceBranding/ImageDimensionsEntity'
|
|
12
|
+
import {
|
|
13
|
+
IBasicBackgroundAttributes,
|
|
14
|
+
IBasicCredentialBranding,
|
|
15
|
+
IBasicCredentialLocaleBranding,
|
|
16
|
+
IBasicImageAttributes,
|
|
17
|
+
IBasicImageDimensions,
|
|
18
|
+
IBasicIssuerBranding,
|
|
19
|
+
IBasicIssuerLocaleBranding,
|
|
20
|
+
IBasicTextAttributes,
|
|
21
|
+
ICredentialBranding,
|
|
22
|
+
IIssuerBranding,
|
|
23
|
+
ILocaleBranding
|
|
24
|
+
} from '../../types'
|
|
6
25
|
|
|
7
26
|
export const credentialBrandingFrom = (credentialBranding: CredentialBrandingEntity): ICredentialBranding => {
|
|
8
27
|
const result: ICredentialBranding = {
|
|
@@ -30,3 +49,87 @@ export const localeBrandingFrom = (localeBranding: BaseLocaleBrandingEntity): IL
|
|
|
30
49
|
|
|
31
50
|
return replaceNullWithUndefined(result)
|
|
32
51
|
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
export const issuerLocaleBrandingEntityFrom = (args: IBasicIssuerLocaleBranding): IssuerLocaleBrandingEntity => {
|
|
55
|
+
const issuerLocaleBrandingEntity: IssuerLocaleBrandingEntity = new IssuerLocaleBrandingEntity()
|
|
56
|
+
issuerLocaleBrandingEntity.alias = isEmptyString(args.alias) ? undefined : args.alias
|
|
57
|
+
issuerLocaleBrandingEntity.locale = args.locale ? args.locale : ''
|
|
58
|
+
issuerLocaleBrandingEntity.logo = args.logo ? imageAttributesEntityFrom(args.logo) : undefined
|
|
59
|
+
issuerLocaleBrandingEntity.description = isEmptyString(args.description) ? undefined : args.description
|
|
60
|
+
issuerLocaleBrandingEntity.background = args.background ? backgroundAttributesEntityFrom(args.background) : undefined
|
|
61
|
+
issuerLocaleBrandingEntity.text = args.text ? textAttributesEntityFrom(args.text) : undefined
|
|
62
|
+
issuerLocaleBrandingEntity.clientUri = isEmptyString(args.clientUri) ? undefined : args.clientUri
|
|
63
|
+
issuerLocaleBrandingEntity.tosUri = isEmptyString(args.tosUri) ? undefined : args.tosUri
|
|
64
|
+
issuerLocaleBrandingEntity.policyUri = isEmptyString(args.policyUri) ? undefined : args.policyUri
|
|
65
|
+
issuerLocaleBrandingEntity.contacts = args.contacts
|
|
66
|
+
|
|
67
|
+
return issuerLocaleBrandingEntity
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const backgroundAttributesEntityFrom = (args: IBasicBackgroundAttributes): BackgroundAttributesEntity => {
|
|
71
|
+
const backgroundAttributesEntity: BackgroundAttributesEntity = new BackgroundAttributesEntity()
|
|
72
|
+
backgroundAttributesEntity.color = isEmptyString(args.color) ? undefined : args.color
|
|
73
|
+
backgroundAttributesEntity.image = args.image ? imageAttributesEntityFrom(args.image) : undefined
|
|
74
|
+
|
|
75
|
+
return backgroundAttributesEntity
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const credentialBrandingEntityFrom = (args: IBasicCredentialBranding): CredentialBrandingEntity => {
|
|
79
|
+
const credentialBrandingEntity: CredentialBrandingEntity = new CredentialBrandingEntity()
|
|
80
|
+
credentialBrandingEntity.issuerCorrelationId = args.issuerCorrelationId
|
|
81
|
+
credentialBrandingEntity.vcHash = args.vcHash
|
|
82
|
+
credentialBrandingEntity.localeBranding = args.localeBranding.map((localeBranding: IBasicCredentialLocaleBranding) =>
|
|
83
|
+
credentialLocaleBrandingEntityFrom(localeBranding),
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
return credentialBrandingEntity
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const credentialLocaleBrandingEntityFrom = (args: IBasicCredentialLocaleBranding): CredentialLocaleBrandingEntity => {
|
|
90
|
+
const credentialLocaleBrandingEntity: CredentialLocaleBrandingEntity = new CredentialLocaleBrandingEntity()
|
|
91
|
+
credentialLocaleBrandingEntity.alias = isEmptyString(args.alias) ? undefined : args.alias
|
|
92
|
+
credentialLocaleBrandingEntity.locale = args.locale ? args.locale : ''
|
|
93
|
+
credentialLocaleBrandingEntity.logo = args.logo ? imageAttributesEntityFrom(args.logo) : undefined
|
|
94
|
+
credentialLocaleBrandingEntity.description = isEmptyString(args.description) ? undefined : args.description
|
|
95
|
+
credentialLocaleBrandingEntity.background = args.background ? backgroundAttributesEntityFrom(args.background) : undefined
|
|
96
|
+
credentialLocaleBrandingEntity.text = args.text ? textAttributesEntityFrom(args.text) : undefined
|
|
97
|
+
|
|
98
|
+
return credentialLocaleBrandingEntity
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const imageAttributesEntityFrom = (args: IBasicImageAttributes): ImageAttributesEntity => {
|
|
102
|
+
const imageAttributesEntity: ImageAttributesEntity = new ImageAttributesEntity()
|
|
103
|
+
imageAttributesEntity.uri = isEmptyString(args.uri) ? undefined : args.uri
|
|
104
|
+
imageAttributesEntity.dataUri = isEmptyString(args.dataUri) ? undefined : args.dataUri
|
|
105
|
+
imageAttributesEntity.mediaType = isEmptyString(args.mediaType) ? undefined : args.mediaType
|
|
106
|
+
imageAttributesEntity.alt = isEmptyString(args.alt) ? undefined : args.alt
|
|
107
|
+
imageAttributesEntity.dimensions = args.dimensions ? imageDimensionsEntityFrom(args.dimensions) : undefined
|
|
108
|
+
|
|
109
|
+
return imageAttributesEntity
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const imageDimensionsEntityFrom = (args: IBasicImageDimensions): ImageDimensionsEntity => {
|
|
113
|
+
const imageDimensionsEntity: ImageDimensionsEntity = new ImageDimensionsEntity()
|
|
114
|
+
imageDimensionsEntity.width = args.width
|
|
115
|
+
imageDimensionsEntity.height = args.height
|
|
116
|
+
|
|
117
|
+
return imageDimensionsEntity
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const issuerBrandingEntityFrom = (args: IBasicIssuerBranding): IssuerBrandingEntity => {
|
|
121
|
+
const issuerBrandingEntity: IssuerBrandingEntity = new IssuerBrandingEntity()
|
|
122
|
+
issuerBrandingEntity.issuerCorrelationId = args.issuerCorrelationId
|
|
123
|
+
issuerBrandingEntity.localeBranding = args.localeBranding.map((localeBranding: IBasicIssuerLocaleBranding) =>
|
|
124
|
+
issuerLocaleBrandingEntityFrom(localeBranding),
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
return issuerBrandingEntity
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const textAttributesEntityFrom = (args: IBasicTextAttributes): TextAttributesEntity => {
|
|
131
|
+
const textAttributesEntity: TextAttributesEntity = new TextAttributesEntity()
|
|
132
|
+
textAttributesEntity.color = isEmptyString(args.color) ? undefined : args.color
|
|
133
|
+
|
|
134
|
+
return textAttributesEntity
|
|
135
|
+
}
|