@sphereon/ssi-sdk.data-store 0.30.2-unstable.9 → 0.31.0
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,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'>
|
|
@@ -52,17 +52,29 @@ export interface IImageDimensions {
|
|
|
52
52
|
export interface IBasicImageDimensions extends Omit<IImageDimensions, 'id'> {}
|
|
53
53
|
export interface IPartialImageDimensions extends Partial<IImageDimensions> {}
|
|
54
54
|
|
|
55
|
-
export interface
|
|
55
|
+
export interface ICredentialClaim {
|
|
56
|
+
id: string
|
|
57
|
+
key: string
|
|
58
|
+
name: string
|
|
59
|
+
}
|
|
60
|
+
export interface IBasicCredentialClaim extends Omit<ICredentialClaim, 'id'> {}
|
|
61
|
+
export interface IPartialCredentialClaim extends Partial<ICredentialClaim> {}
|
|
62
|
+
|
|
63
|
+
export interface ICredentialLocaleBranding extends ILocaleBranding {
|
|
64
|
+
claims?: Array<ICredentialClaim>
|
|
65
|
+
}
|
|
56
66
|
export interface IBasicCredentialLocaleBranding
|
|
57
|
-
extends Omit<ICredentialLocaleBranding, 'id' | 'createdAt' | 'lastUpdatedAt' | 'logo' | 'background' | 'text'> {
|
|
67
|
+
extends Omit<ICredentialLocaleBranding, 'id' | 'createdAt' | 'lastUpdatedAt' | 'logo' | 'background' | 'text' | 'claims'> {
|
|
58
68
|
logo?: IBasicImageAttributes
|
|
59
69
|
background?: IBasicBackgroundAttributes
|
|
60
70
|
text?: IBasicTextAttributes
|
|
71
|
+
claims?: Array<IBasicCredentialClaim>
|
|
61
72
|
}
|
|
62
|
-
export interface IPartialCredentialLocaleBranding extends Partial<Omit<ICredentialLocaleBranding, 'logo' | 'background' | 'text'>> {
|
|
73
|
+
export interface IPartialCredentialLocaleBranding extends Partial<Omit<ICredentialLocaleBranding, 'logo' | 'background' | 'text' | 'claims'>> {
|
|
63
74
|
logo?: IPartialImageAttributes
|
|
64
75
|
background?: IPartialBackgroundAttributes
|
|
65
76
|
text?: IPartialTextAttributes
|
|
77
|
+
claims?: IPartialCredentialClaim
|
|
66
78
|
}
|
|
67
79
|
|
|
68
80
|
export interface ICredentialBranding {
|
|
@@ -80,17 +92,23 @@ export interface IPartialCredentialBranding extends Partial<Omit<ICredentialBran
|
|
|
80
92
|
localeBranding?: IPartialCredentialLocaleBranding
|
|
81
93
|
}
|
|
82
94
|
|
|
83
|
-
export interface IIssuerLocaleBranding extends ILocaleBranding {
|
|
95
|
+
export interface IIssuerLocaleBranding extends ILocaleBranding {
|
|
96
|
+
clientUri?: string
|
|
97
|
+
tosUri?: string
|
|
98
|
+
policyUri?: string
|
|
99
|
+
contacts?: Array<string>
|
|
100
|
+
}
|
|
84
101
|
export interface IBasicIssuerLocaleBranding
|
|
85
102
|
extends Omit<IIssuerLocaleBranding, 'id' | 'createdAt' | 'lastUpdatedAt' | 'logo' | 'background' | 'text'> {
|
|
86
103
|
logo?: IBasicImageAttributes
|
|
87
104
|
background?: IBasicBackgroundAttributes
|
|
88
105
|
text?: IBasicTextAttributes
|
|
89
106
|
}
|
|
90
|
-
export interface IPartialIssuerLocaleBranding extends Partial<Omit<IIssuerLocaleBranding, 'logo' | 'background' | 'text'>> {
|
|
107
|
+
export interface IPartialIssuerLocaleBranding extends Partial<Omit<IIssuerLocaleBranding, 'logo' | 'background' | 'text' | 'contacts'>> {
|
|
91
108
|
logo?: IPartialImageAttributes
|
|
92
109
|
background?: IPartialBackgroundAttributes
|
|
93
110
|
text?: IPartialTextAttributes
|
|
111
|
+
contacts?: string
|
|
94
112
|
}
|
|
95
113
|
|
|
96
114
|
export interface IIssuerBranding {
|
|
@@ -103,7 +121,7 @@ export interface IIssuerBranding {
|
|
|
103
121
|
export interface IBasicIssuerBranding extends Omit<IIssuerBranding, 'id' | 'createdAt' | 'lastUpdatedAt' | 'localeBranding'> {
|
|
104
122
|
localeBranding: Array<IBasicIssuerLocaleBranding>
|
|
105
123
|
}
|
|
106
|
-
export interface IPartialIssuerBranding extends Partial<Omit<
|
|
124
|
+
export interface IPartialIssuerBranding extends Partial<Omit<IIssuerBranding, 'localeBranding'>> {
|
|
107
125
|
localeBranding?: IPartialIssuerLocaleBranding
|
|
108
126
|
}
|
|
109
127
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const replaceNullWithUndefined = (obj: any): any => {
|
|
2
|
+
if (obj === null) {
|
|
3
|
+
return undefined
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
if (typeof obj !== 'object' || obj instanceof Date) {
|
|
7
|
+
return obj
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (Array.isArray(obj)) {
|
|
11
|
+
return obj.map((value: any) => replaceNullWithUndefined(value))
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const result: any = {}
|
|
15
|
+
for (const key in obj) {
|
|
16
|
+
if (obj.hasOwnProperty(key)) {
|
|
17
|
+
result[key] = replaceNullWithUndefined(obj[key])
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return result
|
|
21
|
+
}
|
|
@@ -47,6 +47,7 @@ import { OpenIdConfigEntity } from '../../entities/contact/OpenIdConfigEntity'
|
|
|
47
47
|
import { PartyTypeEntity } from '../../entities/contact/PartyTypeEntity'
|
|
48
48
|
import { PhysicalAddressEntity } from '../../entities/contact/PhysicalAddressEntity'
|
|
49
49
|
import { ContactMetadataItemEntity } from '../../entities/contact/ContactMetadataItemEntity'
|
|
50
|
+
import { replaceNullWithUndefined } from '../FormattingUtils'
|
|
50
51
|
|
|
51
52
|
export const partyEntityFrom = (party: NonPersistedParty): PartyEntity => {
|
|
52
53
|
const partyEntity: PartyEntity = new PartyEntity()
|
|
@@ -67,10 +68,10 @@ export const partyEntityFrom = (party: NonPersistedParty): PartyEntity => {
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
export const partyFrom = (party: PartyEntity): Party => {
|
|
70
|
-
|
|
71
|
+
const result: Party = {
|
|
71
72
|
id: party.id,
|
|
72
73
|
uri: party.uri,
|
|
73
|
-
roles: [...new Set(party.identities?.flatMap((identity: IdentityEntity) => identity.roles))]
|
|
74
|
+
roles: [...new Set(party.identities?.flatMap((identity: IdentityEntity) => identity.roles))],
|
|
74
75
|
identities: party.identities ? party.identities.map((identity: IdentityEntity) => identityFrom(identity)) : [],
|
|
75
76
|
electronicAddresses: party.electronicAddresses
|
|
76
77
|
? party.electronicAddresses.map((electronicAddress: ElectronicAddressEntity) => electronicAddressFrom(electronicAddress))
|
|
@@ -86,6 +87,8 @@ export const partyFrom = (party: PartyEntity): Party => {
|
|
|
86
87
|
createdAt: party.createdAt,
|
|
87
88
|
lastUpdatedAt: party.lastUpdatedAt,
|
|
88
89
|
}
|
|
90
|
+
|
|
91
|
+
return replaceNullWithUndefined(result)
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
export const contactEntityFrom = (contact: NonPersistedContact): BaseContactEntity => {
|
|
@@ -125,13 +128,15 @@ export const connectionEntityFrom = (connection: NonPersistedConnection): Connec
|
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
export const connectionFrom = (connection: ConnectionEntity): Connection => {
|
|
128
|
-
|
|
131
|
+
const result: Connection = {
|
|
129
132
|
id: connection.id,
|
|
130
133
|
type: connection.type,
|
|
131
134
|
ownerId: connection.ownerId,
|
|
132
135
|
tenantId: connection.tenantId,
|
|
133
136
|
config: configFrom(connection.config),
|
|
134
137
|
}
|
|
138
|
+
|
|
139
|
+
return replaceNullWithUndefined(result)
|
|
135
140
|
}
|
|
136
141
|
|
|
137
142
|
const configEntityFrom = (config: NonPersistedConnectionConfig): BaseConfigEntity => {
|
|
@@ -155,13 +160,15 @@ export const correlationIdentifierEntityFrom = (identifier: NonPersistedCorrelat
|
|
|
155
160
|
}
|
|
156
161
|
|
|
157
162
|
export const correlationIdentifierFrom = (identifier: CorrelationIdentifierEntity): CorrelationIdentifier => {
|
|
158
|
-
|
|
163
|
+
const result: CorrelationIdentifier = {
|
|
159
164
|
id: identifier.id,
|
|
160
165
|
type: identifier.type,
|
|
161
166
|
correlationId: identifier.correlationId,
|
|
162
167
|
ownerId: identifier.ownerId,
|
|
163
168
|
tenantId: identifier.tenantId,
|
|
164
169
|
}
|
|
170
|
+
|
|
171
|
+
return replaceNullWithUndefined(result)
|
|
165
172
|
}
|
|
166
173
|
|
|
167
174
|
export const didAuthConfigEntityFrom = (config: NonPersistedDidAuthConfig): DidAuthConfigEntity => {
|
|
@@ -196,7 +203,7 @@ export const electronicAddressEntityFrom = (electronicAddress: NonPersistedElect
|
|
|
196
203
|
}
|
|
197
204
|
|
|
198
205
|
export const electronicAddressFrom = (electronicAddress: ElectronicAddressEntity): ElectronicAddress => {
|
|
199
|
-
|
|
206
|
+
const result: ElectronicAddress = {
|
|
200
207
|
id: electronicAddress.id,
|
|
201
208
|
type: electronicAddress.type,
|
|
202
209
|
electronicAddress: electronicAddress.electronicAddress,
|
|
@@ -205,6 +212,8 @@ export const electronicAddressFrom = (electronicAddress: ElectronicAddressEntity
|
|
|
205
212
|
createdAt: electronicAddress.createdAt,
|
|
206
213
|
lastUpdatedAt: electronicAddress.lastUpdatedAt,
|
|
207
214
|
}
|
|
215
|
+
|
|
216
|
+
return replaceNullWithUndefined(result)
|
|
208
217
|
}
|
|
209
218
|
|
|
210
219
|
export const physicalAddressEntityFrom = (physicalAddress: NonPersistedPhysicalAddress): PhysicalAddressEntity => {
|
|
@@ -224,7 +233,7 @@ export const physicalAddressEntityFrom = (physicalAddress: NonPersistedPhysicalA
|
|
|
224
233
|
}
|
|
225
234
|
|
|
226
235
|
export const physicalAddressFrom = (physicalAddress: PhysicalAddressEntity): PhysicalAddress => {
|
|
227
|
-
|
|
236
|
+
const result: PhysicalAddress = {
|
|
228
237
|
id: physicalAddress.id,
|
|
229
238
|
type: physicalAddress.type,
|
|
230
239
|
streetName: physicalAddress.streetName,
|
|
@@ -239,6 +248,8 @@ export const physicalAddressFrom = (physicalAddress: PhysicalAddressEntity): Phy
|
|
|
239
248
|
createdAt: physicalAddress.createdAt,
|
|
240
249
|
lastUpdatedAt: physicalAddress.lastUpdatedAt,
|
|
241
250
|
}
|
|
251
|
+
|
|
252
|
+
return replaceNullWithUndefined(result)
|
|
242
253
|
}
|
|
243
254
|
|
|
244
255
|
export const identityEntityFrom = (entity: NonPersistedIdentity): IdentityEntity => {
|
|
@@ -257,7 +268,7 @@ export const identityEntityFrom = (entity: NonPersistedIdentity): IdentityEntity
|
|
|
257
268
|
}
|
|
258
269
|
|
|
259
270
|
export const identityFrom = (identity: IdentityEntity): Identity => {
|
|
260
|
-
|
|
271
|
+
const result: Identity = {
|
|
261
272
|
id: identity.id,
|
|
262
273
|
alias: identity.alias,
|
|
263
274
|
origin: identity.origin,
|
|
@@ -270,6 +281,8 @@ export const identityFrom = (identity: IdentityEntity): Identity => {
|
|
|
270
281
|
createdAt: identity.createdAt,
|
|
271
282
|
lastUpdatedAt: identity.createdAt,
|
|
272
283
|
}
|
|
284
|
+
|
|
285
|
+
return replaceNullWithUndefined(result)
|
|
273
286
|
}
|
|
274
287
|
|
|
275
288
|
const metadataItemEntityFrom = <T extends MetadataTypes, U extends { new (): any }>(
|
|
@@ -359,7 +372,7 @@ export const naturalPersonEntityFrom = (naturalPerson: NonPersistedNaturalPerson
|
|
|
359
372
|
}
|
|
360
373
|
|
|
361
374
|
export const naturalPersonFrom = (naturalPerson: NaturalPersonEntity): NaturalPerson => {
|
|
362
|
-
|
|
375
|
+
const result: NaturalPerson = {
|
|
363
376
|
id: naturalPerson.id,
|
|
364
377
|
firstName: naturalPerson.firstName,
|
|
365
378
|
middleName: naturalPerson.middleName,
|
|
@@ -371,6 +384,8 @@ export const naturalPersonFrom = (naturalPerson: NaturalPersonEntity): NaturalPe
|
|
|
371
384
|
createdAt: naturalPerson.createdAt,
|
|
372
385
|
lastUpdatedAt: naturalPerson.lastUpdatedAt,
|
|
373
386
|
}
|
|
387
|
+
|
|
388
|
+
return replaceNullWithUndefined(result)
|
|
374
389
|
}
|
|
375
390
|
|
|
376
391
|
export const openIdConfigEntityFrom = (config: NonPersistedOpenIdConfig): OpenIdConfigEntity => {
|
|
@@ -402,7 +417,7 @@ export const organizationEntityFrom = (organization: NonPersistedOrganization):
|
|
|
402
417
|
}
|
|
403
418
|
|
|
404
419
|
export const organizationFrom = (organization: OrganizationEntity): Organization => {
|
|
405
|
-
|
|
420
|
+
const result: Organization = {
|
|
406
421
|
id: organization.id,
|
|
407
422
|
legalName: organization.legalName,
|
|
408
423
|
displayName: organization.displayName,
|
|
@@ -412,6 +427,8 @@ export const organizationFrom = (organization: OrganizationEntity): Organization
|
|
|
412
427
|
createdAt: organization.createdAt,
|
|
413
428
|
lastUpdatedAt: organization.lastUpdatedAt,
|
|
414
429
|
}
|
|
430
|
+
|
|
431
|
+
return replaceNullWithUndefined(result)
|
|
415
432
|
}
|
|
416
433
|
|
|
417
434
|
export const partyRelationshipEntityFrom = (relationship: NonPersistedPartyRelationship): PartyRelationshipEntity => {
|
|
@@ -420,11 +437,12 @@ export const partyRelationshipEntityFrom = (relationship: NonPersistedPartyRelat
|
|
|
420
437
|
partyRelationshipEntity.rightId = relationship.rightId
|
|
421
438
|
partyRelationshipEntity.ownerId = relationship.ownerId
|
|
422
439
|
partyRelationshipEntity.tenantId = relationship.tenantId
|
|
440
|
+
|
|
423
441
|
return partyRelationshipEntity
|
|
424
442
|
}
|
|
425
443
|
|
|
426
444
|
export const partyRelationshipFrom = (relationship: PartyRelationshipEntity): PartyRelationship => {
|
|
427
|
-
|
|
445
|
+
const result: PartyRelationship = {
|
|
428
446
|
id: relationship.id,
|
|
429
447
|
leftId: relationship.leftId,
|
|
430
448
|
rightId: relationship.rightId,
|
|
@@ -433,6 +451,8 @@ export const partyRelationshipFrom = (relationship: PartyRelationshipEntity): Pa
|
|
|
433
451
|
createdAt: relationship.createdAt,
|
|
434
452
|
lastUpdatedAt: relationship.lastUpdatedAt,
|
|
435
453
|
}
|
|
454
|
+
|
|
455
|
+
return replaceNullWithUndefined(result)
|
|
436
456
|
}
|
|
437
457
|
|
|
438
458
|
export const partyTypeEntityFrom = (args: NonPersistedPartyType): PartyTypeEntity => {
|
|
@@ -450,7 +470,7 @@ export const partyTypeEntityFrom = (args: NonPersistedPartyType): PartyTypeEntit
|
|
|
450
470
|
}
|
|
451
471
|
|
|
452
472
|
export const partyTypeFrom = (partyType: PartyTypeEntity): PartyType => {
|
|
453
|
-
|
|
473
|
+
const result: PartyType = {
|
|
454
474
|
id: partyType.id,
|
|
455
475
|
type: partyType.type,
|
|
456
476
|
origin: partyType.origin,
|
|
@@ -460,6 +480,8 @@ export const partyTypeFrom = (partyType: PartyTypeEntity): PartyType => {
|
|
|
460
480
|
createdAt: partyType.createdAt,
|
|
461
481
|
lastUpdatedAt: partyType.lastUpdatedAt,
|
|
462
482
|
}
|
|
483
|
+
|
|
484
|
+
return replaceNullWithUndefined(result)
|
|
463
485
|
}
|
|
464
486
|
|
|
465
487
|
export const configFrom = (config: BaseConfigEntity): ConnectionConfig => {
|
|
@@ -473,7 +495,7 @@ export const configFrom = (config: BaseConfigEntity): ConnectionConfig => {
|
|
|
473
495
|
}
|
|
474
496
|
|
|
475
497
|
export const openIdConfigFrom = (config: OpenIdConfigEntity): OpenIdConfig => {
|
|
476
|
-
|
|
498
|
+
const result: OpenIdConfig = {
|
|
477
499
|
id: config.id,
|
|
478
500
|
clientId: config.clientId,
|
|
479
501
|
clientSecret: config.clientSecret,
|
|
@@ -485,10 +507,12 @@ export const openIdConfigFrom = (config: OpenIdConfigEntity): OpenIdConfig => {
|
|
|
485
507
|
ownerId: config.ownerId,
|
|
486
508
|
tenantId: config.tenantId,
|
|
487
509
|
}
|
|
510
|
+
|
|
511
|
+
return replaceNullWithUndefined(result)
|
|
488
512
|
}
|
|
489
513
|
|
|
490
514
|
export const didAuthConfigFrom = (config: DidAuthConfigEntity): DidAuthConfig => {
|
|
491
|
-
|
|
515
|
+
const result: DidAuthConfig = {
|
|
492
516
|
id: config.id,
|
|
493
517
|
idOpts: { identifier: config.identifier },
|
|
494
518
|
stateId: '', // FIXME
|
|
@@ -497,6 +521,8 @@ export const didAuthConfigFrom = (config: DidAuthConfigEntity): DidAuthConfig =>
|
|
|
497
521
|
ownerId: config.ownerId,
|
|
498
522
|
tenantId: config.tenantId,
|
|
499
523
|
}
|
|
524
|
+
|
|
525
|
+
return replaceNullWithUndefined(result)
|
|
500
526
|
}
|
|
501
527
|
|
|
502
528
|
export const isOpenIdConfig = (config: NonPersistedConnectionConfig | BaseConfigEntity): config is OpenIdConfig | OpenIdConfigEntity =>
|
|
@@ -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,117 @@
|
|
|
1
|
+
import { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
2
|
+
import { LoggingEventType } from '@sphereon/ssi-types'
|
|
3
|
+
import { replaceNullWithUndefined } from '../FormattingUtils'
|
|
4
|
+
import { AuditEventEntity } from '../../entities/eventLogger/AuditEventEntity'
|
|
5
|
+
import { NonPersistedActivityLoggingEvent, NonPersistedAuditLoggingEvent } from '../../types'
|
|
6
|
+
|
|
7
|
+
export const auditEventFrom = (event: AuditEventEntity): AuditLoggingEvent => {
|
|
8
|
+
const result: AuditLoggingEvent = {
|
|
9
|
+
id: event.id,
|
|
10
|
+
type: LoggingEventType.AUDIT,
|
|
11
|
+
description: event.description,
|
|
12
|
+
timestamp: event.timestamp,
|
|
13
|
+
level: event.level,
|
|
14
|
+
correlationId: event.correlationId,
|
|
15
|
+
actionType: event.actionType,
|
|
16
|
+
actionSubType: event.actionSubType,
|
|
17
|
+
initiatorType: event.initiatorType,
|
|
18
|
+
partyAlias: event.partyAlias,
|
|
19
|
+
partyCorrelationId: event.partyCorrelationId,
|
|
20
|
+
partyCorrelationType: event.partyCorrelationType,
|
|
21
|
+
subSystemType: event.subSystemType,
|
|
22
|
+
system: event.system,
|
|
23
|
+
systemAlias: event.systemAlias,
|
|
24
|
+
systemCorrelationId: event.systemCorrelationId,
|
|
25
|
+
systemCorrelationIdType: event.systemCorrelationIdType,
|
|
26
|
+
...(event.data && { data: JSON.parse(event.data) }),
|
|
27
|
+
...(event.diagnosticData && { diagnosticData: JSON.parse(event.diagnosticData) }),
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return replaceNullWithUndefined(result)
|
|
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
|
+
parentCredentialHash: event.parentCredentialHash,
|
|
66
|
+
sharePurpose: event.sharePurpose,
|
|
67
|
+
description: event.description,
|
|
68
|
+
timestamp: event.timestamp,
|
|
69
|
+
level: event.level,
|
|
70
|
+
correlationId: event.correlationId,
|
|
71
|
+
actionType: event.actionType,
|
|
72
|
+
actionSubType: event.actionSubType,
|
|
73
|
+
initiatorType: event.initiatorType,
|
|
74
|
+
partyAlias: event.partyAlias,
|
|
75
|
+
partyCorrelationId: event.partyCorrelationId,
|
|
76
|
+
partyCorrelationType: event.partyCorrelationType,
|
|
77
|
+
subSystemType: event.subSystemType,
|
|
78
|
+
system: event.system,
|
|
79
|
+
systemAlias: event.systemAlias,
|
|
80
|
+
systemCorrelationId: event.systemCorrelationId,
|
|
81
|
+
systemCorrelationIdType: event.systemCorrelationIdType,
|
|
82
|
+
...(event.data && { data: JSON.parse(event.data) }),
|
|
83
|
+
...(event.diagnosticData && { diagnosticData: JSON.parse(event.diagnosticData) }),
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return replaceNullWithUndefined(result)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const activityEventEntityFrom = (args: NonPersistedActivityLoggingEvent): AuditEventEntity => {
|
|
90
|
+
const activityEventEntity: AuditEventEntity = new AuditEventEntity()
|
|
91
|
+
activityEventEntity.type = LoggingEventType.ACTIVITY
|
|
92
|
+
activityEventEntity.timestamp = args.timestamp
|
|
93
|
+
activityEventEntity.level = args.level
|
|
94
|
+
activityEventEntity.correlationId = args.correlationId
|
|
95
|
+
activityEventEntity.system = args.system
|
|
96
|
+
activityEventEntity.subSystemType = args.subSystemType
|
|
97
|
+
activityEventEntity.actionType = args.actionType
|
|
98
|
+
activityEventEntity.actionSubType = args.actionSubType
|
|
99
|
+
activityEventEntity.initiatorType = args.initiatorType
|
|
100
|
+
activityEventEntity.systemCorrelationIdType = args.systemCorrelationIdType
|
|
101
|
+
activityEventEntity.systemCorrelationId = args.systemCorrelationId
|
|
102
|
+
activityEventEntity.systemAlias = args.systemAlias
|
|
103
|
+
activityEventEntity.partyCorrelationType = args.partyCorrelationType
|
|
104
|
+
activityEventEntity.partyCorrelationId = args.partyCorrelationId
|
|
105
|
+
activityEventEntity.partyAlias = args.partyAlias
|
|
106
|
+
activityEventEntity.description = args.description
|
|
107
|
+
activityEventEntity.partyCorrelationType = args.partyCorrelationType
|
|
108
|
+
activityEventEntity.data = JSON.stringify(args.data)
|
|
109
|
+
activityEventEntity.sharePurpose = args.sharePurpose
|
|
110
|
+
activityEventEntity.credentialType = args.credentialType
|
|
111
|
+
activityEventEntity.originalCredential = args.originalCredential
|
|
112
|
+
activityEventEntity.credentialHash = args.credentialHash
|
|
113
|
+
activityEventEntity.parentCredentialHash = args.parentCredentialHash
|
|
114
|
+
activityEventEntity.diagnosticData = JSON.stringify(args.diagnosticData)
|
|
115
|
+
|
|
116
|
+
return activityEventEntity
|
|
117
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { replaceNullWithUndefined } from '../FormattingUtils'
|
|
2
|
+
import { isEmptyString } from '../../entities/validators'
|
|
3
|
+
import { CredentialBrandingEntity } from '../../entities/issuanceBranding/CredentialBrandingEntity'
|
|
4
|
+
import { BaseLocaleBrandingEntity } from '../../entities/issuanceBranding/BaseLocaleBrandingEntity'
|
|
5
|
+
import { IssuerBrandingEntity } from '../../entities/issuanceBranding/IssuerBrandingEntity'
|
|
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 { CredentialClaimsEntity } from '../../entities/issuanceBranding/CredentialClaimsEntity'
|
|
13
|
+
import {
|
|
14
|
+
IBasicBackgroundAttributes,
|
|
15
|
+
IBasicCredentialBranding,
|
|
16
|
+
IBasicCredentialClaim,
|
|
17
|
+
IBasicCredentialLocaleBranding,
|
|
18
|
+
IBasicImageAttributes,
|
|
19
|
+
IBasicImageDimensions,
|
|
20
|
+
IBasicIssuerBranding,
|
|
21
|
+
IBasicIssuerLocaleBranding,
|
|
22
|
+
IBasicTextAttributes,
|
|
23
|
+
ICredentialBranding,
|
|
24
|
+
IIssuerBranding,
|
|
25
|
+
ILocaleBranding,
|
|
26
|
+
} from '../../types'
|
|
27
|
+
|
|
28
|
+
export const credentialBrandingFrom = (credentialBranding: CredentialBrandingEntity): ICredentialBranding => {
|
|
29
|
+
const result: ICredentialBranding = {
|
|
30
|
+
...credentialBranding,
|
|
31
|
+
localeBranding: credentialBranding.localeBranding.map((localeBranding: BaseLocaleBrandingEntity) => localeBrandingFrom(localeBranding)),
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return replaceNullWithUndefined(result)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const issuerBrandingFrom = (issuerBranding: IssuerBrandingEntity): IIssuerBranding => {
|
|
38
|
+
const result: IIssuerBranding = {
|
|
39
|
+
...issuerBranding,
|
|
40
|
+
localeBranding: issuerBranding.localeBranding.map((localeBranding: BaseLocaleBrandingEntity) => localeBrandingFrom(localeBranding)),
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return replaceNullWithUndefined(result)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const localeBrandingFrom = (localeBranding: BaseLocaleBrandingEntity): ILocaleBranding => {
|
|
47
|
+
const result: ILocaleBranding = {
|
|
48
|
+
...localeBranding,
|
|
49
|
+
locale: localeBranding.locale === '' ? undefined : localeBranding.locale,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return replaceNullWithUndefined(result)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const issuerLocaleBrandingEntityFrom = (args: IBasicIssuerLocaleBranding): IssuerLocaleBrandingEntity => {
|
|
56
|
+
const issuerLocaleBrandingEntity: IssuerLocaleBrandingEntity = new IssuerLocaleBrandingEntity()
|
|
57
|
+
issuerLocaleBrandingEntity.alias = isEmptyString(args.alias) ? undefined : args.alias
|
|
58
|
+
issuerLocaleBrandingEntity.locale = args.locale ? args.locale : ''
|
|
59
|
+
issuerLocaleBrandingEntity.logo = args.logo ? imageAttributesEntityFrom(args.logo) : undefined
|
|
60
|
+
issuerLocaleBrandingEntity.description = isEmptyString(args.description) ? undefined : args.description
|
|
61
|
+
issuerLocaleBrandingEntity.background = args.background ? backgroundAttributesEntityFrom(args.background) : undefined
|
|
62
|
+
issuerLocaleBrandingEntity.text = args.text ? textAttributesEntityFrom(args.text) : undefined
|
|
63
|
+
issuerLocaleBrandingEntity.clientUri = isEmptyString(args.clientUri) ? undefined : args.clientUri
|
|
64
|
+
issuerLocaleBrandingEntity.tosUri = isEmptyString(args.tosUri) ? undefined : args.tosUri
|
|
65
|
+
issuerLocaleBrandingEntity.policyUri = isEmptyString(args.policyUri) ? undefined : args.policyUri
|
|
66
|
+
issuerLocaleBrandingEntity.contacts = args.contacts
|
|
67
|
+
|
|
68
|
+
return issuerLocaleBrandingEntity
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const backgroundAttributesEntityFrom = (args: IBasicBackgroundAttributes): BackgroundAttributesEntity => {
|
|
72
|
+
const backgroundAttributesEntity: BackgroundAttributesEntity = new BackgroundAttributesEntity()
|
|
73
|
+
backgroundAttributesEntity.color = isEmptyString(args.color) ? undefined : args.color
|
|
74
|
+
backgroundAttributesEntity.image = args.image ? imageAttributesEntityFrom(args.image) : undefined
|
|
75
|
+
|
|
76
|
+
return backgroundAttributesEntity
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const credentialBrandingEntityFrom = (args: IBasicCredentialBranding): CredentialBrandingEntity => {
|
|
80
|
+
const credentialBrandingEntity: CredentialBrandingEntity = new CredentialBrandingEntity()
|
|
81
|
+
credentialBrandingEntity.issuerCorrelationId = args.issuerCorrelationId
|
|
82
|
+
credentialBrandingEntity.vcHash = args.vcHash
|
|
83
|
+
credentialBrandingEntity.localeBranding = args.localeBranding.map((localeBranding: IBasicCredentialLocaleBranding) =>
|
|
84
|
+
credentialLocaleBrandingEntityFrom(localeBranding),
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
return credentialBrandingEntity
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const credentialLocaleBrandingEntityFrom = (args: IBasicCredentialLocaleBranding): CredentialLocaleBrandingEntity => {
|
|
91
|
+
const credentialLocaleBrandingEntity: CredentialLocaleBrandingEntity = new CredentialLocaleBrandingEntity()
|
|
92
|
+
credentialLocaleBrandingEntity.alias = isEmptyString(args.alias) ? undefined : args.alias
|
|
93
|
+
credentialLocaleBrandingEntity.locale = args.locale ? args.locale : ''
|
|
94
|
+
credentialLocaleBrandingEntity.logo = args.logo ? imageAttributesEntityFrom(args.logo) : undefined
|
|
95
|
+
credentialLocaleBrandingEntity.description = isEmptyString(args.description) ? undefined : args.description
|
|
96
|
+
credentialLocaleBrandingEntity.background = args.background ? backgroundAttributesEntityFrom(args.background) : undefined
|
|
97
|
+
credentialLocaleBrandingEntity.text = args.text ? textAttributesEntityFrom(args.text) : undefined
|
|
98
|
+
credentialLocaleBrandingEntity.claims = args.claims ? args.claims.map((claim) => credentialClaimsEntityFrom(claim)) : []
|
|
99
|
+
|
|
100
|
+
return credentialLocaleBrandingEntity
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export const imageAttributesEntityFrom = (args: IBasicImageAttributes): ImageAttributesEntity => {
|
|
104
|
+
const imageAttributesEntity: ImageAttributesEntity = new ImageAttributesEntity()
|
|
105
|
+
imageAttributesEntity.uri = isEmptyString(args.uri) ? undefined : args.uri
|
|
106
|
+
imageAttributesEntity.dataUri = isEmptyString(args.dataUri) ? undefined : args.dataUri
|
|
107
|
+
imageAttributesEntity.mediaType = isEmptyString(args.mediaType) ? undefined : args.mediaType
|
|
108
|
+
imageAttributesEntity.alt = isEmptyString(args.alt) ? undefined : args.alt
|
|
109
|
+
imageAttributesEntity.dimensions = args.dimensions ? imageDimensionsEntityFrom(args.dimensions) : undefined
|
|
110
|
+
|
|
111
|
+
return imageAttributesEntity
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export const imageDimensionsEntityFrom = (args: IBasicImageDimensions): ImageDimensionsEntity => {
|
|
115
|
+
const imageDimensionsEntity: ImageDimensionsEntity = new ImageDimensionsEntity()
|
|
116
|
+
imageDimensionsEntity.width = args.width
|
|
117
|
+
imageDimensionsEntity.height = args.height
|
|
118
|
+
|
|
119
|
+
return imageDimensionsEntity
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export const issuerBrandingEntityFrom = (args: IBasicIssuerBranding): IssuerBrandingEntity => {
|
|
123
|
+
const issuerBrandingEntity: IssuerBrandingEntity = new IssuerBrandingEntity()
|
|
124
|
+
issuerBrandingEntity.issuerCorrelationId = args.issuerCorrelationId
|
|
125
|
+
issuerBrandingEntity.localeBranding = args.localeBranding.map((localeBranding: IBasicIssuerLocaleBranding) =>
|
|
126
|
+
issuerLocaleBrandingEntityFrom(localeBranding),
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
return issuerBrandingEntity
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const textAttributesEntityFrom = (args: IBasicTextAttributes): TextAttributesEntity => {
|
|
133
|
+
const textAttributesEntity: TextAttributesEntity = new TextAttributesEntity()
|
|
134
|
+
textAttributesEntity.color = isEmptyString(args.color) ? undefined : args.color
|
|
135
|
+
|
|
136
|
+
return textAttributesEntity
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export const credentialClaimsEntityFrom = (args: IBasicCredentialClaim): CredentialClaimsEntity => {
|
|
140
|
+
const credentialClaimsEntity: CredentialClaimsEntity = new CredentialClaimsEntity()
|
|
141
|
+
credentialClaimsEntity.key = args.key
|
|
142
|
+
credentialClaimsEntity.name = args.name
|
|
143
|
+
|
|
144
|
+
return credentialClaimsEntity
|
|
145
|
+
}
|