@sphereon/ssi-sdk.data-store 0.30.2-feature.SPRIND.61.JARM.pex.fixes.39 → 0.30.2-feature.SPRIND.77.133
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/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 -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 +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 -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.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/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/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/types/issuanceBranding/issuanceBranding.d.ts +7 -2
- 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 +22 -0
- package/dist/utils/issuanceBranding/MappingUtils.d.ts.map +1 -0
- package/dist/utils/issuanceBranding/MappingUtils.js +100 -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.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 +55 -32
- package/src/index.ts +13 -26
- package/src/issuanceBranding/IssuanceBrandingStore.ts +26 -68
- package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +1 -1
- package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +34 -6
- package/src/migrations/sqlite/1685628973231-CreateIssuanceBranding.ts +3 -3
- 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/types/issuanceBranding/issuanceBranding.ts +9 -3
- 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 +116 -0
- package/src/utils/issuanceBranding/MappingUtils.ts +135 -0
- package/src/utils/presentationDefinition/MappingUtils.ts +4 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm'
|
|
2
|
-
import {
|
|
3
|
-
import { ImageAttributesEntity, imageAttributesEntityFrom } from './ImageAttributesEntity'
|
|
2
|
+
import { ImageAttributesEntity } from './ImageAttributesEntity'
|
|
4
3
|
import { validate, Validate, ValidationError } from 'class-validator'
|
|
5
|
-
import {
|
|
4
|
+
import { IsNonEmptyStringConstraint } from '../validators'
|
|
6
5
|
|
|
7
6
|
@Entity('BackgroundAttributes')
|
|
8
7
|
export class BackgroundAttributesEntity extends BaseEntity {
|
|
@@ -32,11 +31,3 @@ export class BackgroundAttributesEntity extends BaseEntity {
|
|
|
32
31
|
return
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
|
-
|
|
36
|
-
export const backgroundAttributesEntityFrom = (args: IBasicBackgroundAttributes): BackgroundAttributesEntity => {
|
|
37
|
-
const backgroundAttributesEntity: BackgroundAttributesEntity = new BackgroundAttributesEntity()
|
|
38
|
-
backgroundAttributesEntity.color = isEmptyString(args.color) ? undefined : args.color
|
|
39
|
-
backgroundAttributesEntity.image = args.image ? imageAttributesEntityFrom(args.image) : undefined
|
|
40
|
-
|
|
41
|
-
return backgroundAttributesEntity
|
|
42
|
-
}
|
|
@@ -12,8 +12,7 @@ import {
|
|
|
12
12
|
} from 'typeorm'
|
|
13
13
|
import { ArrayMinSize, IsNotEmpty, validate, ValidationError } from 'class-validator'
|
|
14
14
|
import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
|
|
15
|
-
import { CredentialLocaleBrandingEntity
|
|
16
|
-
import { IBasicCredentialBranding, IBasicCredentialLocaleBranding } from '../../types'
|
|
15
|
+
import { CredentialLocaleBrandingEntity } from './CredentialLocaleBrandingEntity'
|
|
17
16
|
|
|
18
17
|
@Entity('CredentialBranding')
|
|
19
18
|
@Index('IDX_CredentialBrandingEntity_vcHash', ['vcHash'])
|
|
@@ -66,14 +65,3 @@ export class CredentialBrandingEntity extends BaseEntity {
|
|
|
66
65
|
return
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
|
-
|
|
70
|
-
export const credentialBrandingEntityFrom = (args: IBasicCredentialBranding): CredentialBrandingEntity => {
|
|
71
|
-
const credentialBrandingEntity: CredentialBrandingEntity = new CredentialBrandingEntity()
|
|
72
|
-
credentialBrandingEntity.issuerCorrelationId = args.issuerCorrelationId
|
|
73
|
-
credentialBrandingEntity.vcHash = args.vcHash
|
|
74
|
-
credentialBrandingEntity.localeBranding = args.localeBranding.map((localeBranding: IBasicCredentialLocaleBranding) =>
|
|
75
|
-
credentialLocaleBrandingEntityFrom(localeBranding),
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
return credentialBrandingEntity
|
|
79
|
-
}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { ChildEntity, Column, JoinColumn, ManyToOne, Index } from 'typeorm'
|
|
2
|
-
import { IBasicCredentialLocaleBranding } from '../../types'
|
|
3
|
-
import { backgroundAttributesEntityFrom } from './BackgroundAttributesEntity'
|
|
4
2
|
import { CredentialBrandingEntity } from './CredentialBrandingEntity'
|
|
5
|
-
import { imageAttributesEntityFrom } from './ImageAttributesEntity'
|
|
6
3
|
import { BaseLocaleBrandingEntity } from './BaseLocaleBrandingEntity'
|
|
7
|
-
import { textAttributesEntityFrom } from './TextAttributesEntity'
|
|
8
|
-
import { isEmptyString } from '../validators'
|
|
9
4
|
|
|
10
5
|
@ChildEntity('CredentialLocaleBranding')
|
|
11
6
|
@Index('IDX_CredentialLocaleBrandingEntity_credentialBranding_locale', ['credentialBranding', 'locale'], { unique: true })
|
|
@@ -19,15 +14,3 @@ export class CredentialLocaleBrandingEntity extends BaseLocaleBrandingEntity {
|
|
|
19
14
|
@Column('text', { name: 'credentialBrandingId', nullable: false })
|
|
20
15
|
credentialBrandingId!: string
|
|
21
16
|
}
|
|
22
|
-
|
|
23
|
-
export const credentialLocaleBrandingEntityFrom = (args: IBasicCredentialLocaleBranding): CredentialLocaleBrandingEntity => {
|
|
24
|
-
const credentialLocaleBrandingEntity: CredentialLocaleBrandingEntity = new CredentialLocaleBrandingEntity()
|
|
25
|
-
credentialLocaleBrandingEntity.alias = isEmptyString(args.alias) ? undefined : args.alias
|
|
26
|
-
credentialLocaleBrandingEntity.locale = args.locale ? args.locale : ''
|
|
27
|
-
credentialLocaleBrandingEntity.logo = args.logo ? imageAttributesEntityFrom(args.logo) : undefined
|
|
28
|
-
credentialLocaleBrandingEntity.description = isEmptyString(args.description) ? undefined : args.description
|
|
29
|
-
credentialLocaleBrandingEntity.background = args.background ? backgroundAttributesEntityFrom(args.background) : undefined
|
|
30
|
-
credentialLocaleBrandingEntity.text = args.text ? textAttributesEntityFrom(args.text) : undefined
|
|
31
|
-
|
|
32
|
-
return credentialLocaleBrandingEntity
|
|
33
|
-
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm'
|
|
2
|
-
import {
|
|
3
|
-
import { ImageDimensionsEntity, imageDimensionsEntityFrom } from './ImageDimensionsEntity'
|
|
2
|
+
import { ImageDimensionsEntity } from './ImageDimensionsEntity'
|
|
4
3
|
import { validate, Validate, ValidationError } from 'class-validator'
|
|
5
|
-
import {
|
|
4
|
+
import { IsNonEmptyStringConstraint } from '../validators'
|
|
6
5
|
|
|
7
6
|
@Entity('ImageAttributes')
|
|
8
7
|
export class ImageAttributesEntity extends BaseEntity {
|
|
@@ -44,14 +43,3 @@ export class ImageAttributesEntity extends BaseEntity {
|
|
|
44
43
|
return
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
export const imageAttributesEntityFrom = (args: IBasicImageAttributes): ImageAttributesEntity => {
|
|
49
|
-
const imageAttributesEntity: ImageAttributesEntity = new ImageAttributesEntity()
|
|
50
|
-
imageAttributesEntity.uri = isEmptyString(args.uri) ? undefined : args.uri
|
|
51
|
-
imageAttributesEntity.dataUri = isEmptyString(args.dataUri) ? undefined : args.dataUri
|
|
52
|
-
imageAttributesEntity.mediaType = isEmptyString(args.mediaType) ? undefined : args.mediaType
|
|
53
|
-
imageAttributesEntity.alt = isEmptyString(args.alt) ? undefined : args.alt
|
|
54
|
-
imageAttributesEntity.dimensions = args.dimensions ? imageDimensionsEntityFrom(args.dimensions) : undefined
|
|
55
|
-
|
|
56
|
-
return imageAttributesEntity
|
|
57
|
-
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm'
|
|
2
|
-
import { IBasicImageDimensions } from '../../types'
|
|
3
2
|
|
|
4
3
|
@Entity('ImageDimensions')
|
|
5
4
|
export class ImageDimensionsEntity extends BaseEntity {
|
|
@@ -12,11 +11,3 @@ export class ImageDimensionsEntity extends BaseEntity {
|
|
|
12
11
|
@Column('integer', { name: 'height', nullable: false, unique: false })
|
|
13
12
|
height!: number
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
export const imageDimensionsEntityFrom = (args: IBasicImageDimensions): ImageDimensionsEntity => {
|
|
17
|
-
const imageDimensionsEntity: ImageDimensionsEntity = new ImageDimensionsEntity()
|
|
18
|
-
imageDimensionsEntity.width = args.width
|
|
19
|
-
imageDimensionsEntity.height = args.height
|
|
20
|
-
|
|
21
|
-
return imageDimensionsEntity
|
|
22
|
-
}
|
|
@@ -12,8 +12,7 @@ import {
|
|
|
12
12
|
} from 'typeorm'
|
|
13
13
|
import { ArrayMinSize, IsNotEmpty, validate, ValidationError } from 'class-validator'
|
|
14
14
|
import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
|
|
15
|
-
import { IssuerLocaleBrandingEntity
|
|
16
|
-
import { IBasicIssuerBranding, IBasicIssuerLocaleBranding } from '../../types'
|
|
15
|
+
import { IssuerLocaleBrandingEntity } from './IssuerLocaleBrandingEntity'
|
|
17
16
|
|
|
18
17
|
@Entity('IssuerBranding')
|
|
19
18
|
@Index('IDX_IssuerBrandingEntity_issuerCorrelationId', ['issuerCorrelationId'])
|
|
@@ -61,13 +60,3 @@ export class IssuerBrandingEntity extends BaseEntity {
|
|
|
61
60
|
return
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
|
-
|
|
65
|
-
export const issuerBrandingEntityFrom = (args: IBasicIssuerBranding): IssuerBrandingEntity => {
|
|
66
|
-
const issuerBrandingEntity: IssuerBrandingEntity = new IssuerBrandingEntity()
|
|
67
|
-
issuerBrandingEntity.issuerCorrelationId = args.issuerCorrelationId
|
|
68
|
-
issuerBrandingEntity.localeBranding = args.localeBranding.map((localeBranding: IBasicIssuerLocaleBranding) =>
|
|
69
|
-
issuerLocaleBrandingEntityFrom(localeBranding),
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
return issuerBrandingEntity
|
|
73
|
-
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { ChildEntity, Column, Index, JoinColumn, ManyToOne } from 'typeorm'
|
|
2
|
-
import { IBasicIssuerLocaleBranding } from '../../types'
|
|
3
|
-
import { backgroundAttributesEntityFrom } from './BackgroundAttributesEntity'
|
|
4
|
-
import { imageAttributesEntityFrom } from './ImageAttributesEntity'
|
|
5
2
|
import { IssuerBrandingEntity } from './IssuerBrandingEntity'
|
|
6
3
|
import { BaseLocaleBrandingEntity } from './BaseLocaleBrandingEntity'
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { IsNonEmptyStringConstraint } from '../validators'
|
|
5
|
+
import { Validate } from 'class-validator'
|
|
9
6
|
|
|
10
7
|
@ChildEntity('IssuerLocaleBranding')
|
|
11
8
|
@Index('IDX_IssuerLocaleBrandingEntity_issuerBranding_locale', ['issuerBranding', 'locale'], { unique: true })
|
|
@@ -16,18 +13,21 @@ export class IssuerLocaleBrandingEntity extends BaseLocaleBrandingEntity {
|
|
|
16
13
|
@JoinColumn({ name: 'issuerBrandingId' })
|
|
17
14
|
issuerBranding!: IssuerBrandingEntity
|
|
18
15
|
|
|
19
|
-
@Column('text', { name: '
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
@Column('text', { name: 'client_uri', nullable: true, unique: false })
|
|
17
|
+
@Validate(IsNonEmptyStringConstraint, { message: 'Blank client uris are not allowed' })
|
|
18
|
+
clientUri?: string
|
|
19
|
+
|
|
20
|
+
@Column('text', { name: 'tos_uri', nullable: true, unique: false })
|
|
21
|
+
@Validate(IsNonEmptyStringConstraint, { message: 'Blank tos uris are not allowed' })
|
|
22
|
+
tosUri?: string
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
issuerLocaleBrandingEntity.locale = args.locale ? args.locale : ''
|
|
27
|
-
issuerLocaleBrandingEntity.logo = args.logo ? imageAttributesEntityFrom(args.logo) : undefined
|
|
28
|
-
issuerLocaleBrandingEntity.description = isEmptyString(args.description) ? undefined : args.description
|
|
29
|
-
issuerLocaleBrandingEntity.background = args.background ? backgroundAttributesEntityFrom(args.background) : undefined
|
|
30
|
-
issuerLocaleBrandingEntity.text = args.text ? textAttributesEntityFrom(args.text) : undefined
|
|
24
|
+
@Column('text', { name: 'policy_uri', nullable: true, unique: false })
|
|
25
|
+
@Validate(IsNonEmptyStringConstraint, { message: 'Blank policy uris are not allowed' })
|
|
26
|
+
policyUri?: string
|
|
31
27
|
|
|
32
|
-
|
|
28
|
+
@Column('simple-array', { name: 'contacts', nullable: true, unique: false })
|
|
29
|
+
contacts?: Array<string>
|
|
30
|
+
|
|
31
|
+
@Column('text', { name: 'issuerBrandingId', nullable: false })
|
|
32
|
+
issuerBrandingId!: string
|
|
33
33
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, PrimaryGeneratedColumn } from 'typeorm'
|
|
2
|
-
import { IBasicTextAttributes } from '../../types'
|
|
3
2
|
import { validate, Validate, ValidationError } from 'class-validator'
|
|
4
|
-
import {
|
|
3
|
+
import { IsNonEmptyStringConstraint } from '../validators'
|
|
5
4
|
|
|
6
5
|
@Entity('TextAttributes')
|
|
7
6
|
export class TextAttributesEntity extends BaseEntity {
|
|
@@ -22,10 +21,3 @@ export class TextAttributesEntity extends BaseEntity {
|
|
|
22
21
|
return
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
|
-
|
|
26
|
-
export const textAttributesEntityFrom = (args: IBasicTextAttributes): TextAttributesEntity => {
|
|
27
|
-
const textAttributesEntity: TextAttributesEntity = new TextAttributesEntity()
|
|
28
|
-
textAttributesEntity.color = isEmptyString(args.color) ? undefined : args.color
|
|
29
|
-
|
|
30
|
-
return textAttributesEntity
|
|
31
|
-
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
2
|
+
import {
|
|
3
|
+
GetActivityEventsArgs,
|
|
4
|
+
GetAuditEventsArgs,
|
|
5
|
+
StoreActivityEventArgs,
|
|
6
|
+
StoreAuditEventArgs
|
|
7
|
+
} from '../types'
|
|
3
8
|
|
|
4
9
|
export abstract class AbstractEventLoggerStore {
|
|
5
10
|
abstract getAuditEvents(args: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>>
|
|
11
|
+
abstract getActivityEvents(args: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>>
|
|
6
12
|
abstract storeAuditEvent(args: StoreAuditEventArgs): Promise<AuditLoggingEvent>
|
|
13
|
+
abstract storeActivityEvent(args: StoreActivityEventArgs): Promise<ActivityLoggingEvent>
|
|
7
14
|
}
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
import { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
2
|
+
import { LoggingEventType, OrPromise } from '@sphereon/ssi-types'
|
|
1
3
|
import Debug, { Debugger } from 'debug'
|
|
2
4
|
import { DataSource } from 'typeorm'
|
|
3
|
-
import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
|
|
4
|
-
import { OrPromise } from '@sphereon/ssi-types'
|
|
5
5
|
import { AbstractEventLoggerStore } from './AbstractEventLoggerStore'
|
|
6
|
-
import { AuditEventEntity
|
|
7
|
-
import {
|
|
6
|
+
import { AuditEventEntity } from '../entities/eventLogger/AuditEventEntity'
|
|
7
|
+
import {
|
|
8
|
+
activityEventEntityFrom,
|
|
9
|
+
activityEventFrom,
|
|
10
|
+
auditEventEntityFrom,
|
|
11
|
+
auditEventFrom
|
|
12
|
+
} from '../utils/eventLogger/MappingUtils'
|
|
13
|
+
import {
|
|
14
|
+
GetActivityEventsArgs,
|
|
15
|
+
GetAuditEventsArgs,
|
|
16
|
+
StoreActivityEventArgs,
|
|
17
|
+
StoreAuditEventArgs
|
|
18
|
+
} from '../types'
|
|
8
19
|
|
|
9
20
|
const debug: Debugger = Debug('sphereon:ssi-sdk:event-store')
|
|
10
21
|
|
|
@@ -17,46 +28,58 @@ export class EventLoggerStore extends AbstractEventLoggerStore {
|
|
|
17
28
|
}
|
|
18
29
|
|
|
19
30
|
getAuditEvents = async (args?: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>> => {
|
|
20
|
-
const
|
|
31
|
+
const { filter = [] } = args ?? {}
|
|
32
|
+
|
|
33
|
+
const auditEventsFilter = filter.map((item) => ({ ...item, type: LoggingEventType.AUDIT }))
|
|
34
|
+
if (auditEventsFilter.length === 0) {
|
|
35
|
+
auditEventsFilter.push({ type: LoggingEventType.AUDIT })
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const connection = await this.dbConnection
|
|
21
39
|
debug('Getting audit events', args)
|
|
22
|
-
const result
|
|
23
|
-
|
|
40
|
+
const result = await connection.getRepository(AuditEventEntity).find({
|
|
41
|
+
where: auditEventsFilter
|
|
24
42
|
})
|
|
25
43
|
|
|
26
|
-
return result.map((event: AuditEventEntity) =>
|
|
44
|
+
return result.map((event: AuditEventEntity) => auditEventFrom(event))
|
|
27
45
|
}
|
|
28
46
|
|
|
29
47
|
storeAuditEvent = async (args: StoreAuditEventArgs): Promise<AuditLoggingEvent> => {
|
|
30
48
|
const { event } = args
|
|
31
49
|
|
|
32
|
-
const auditEventEntity
|
|
33
|
-
const connection
|
|
50
|
+
const auditEventEntity = auditEventEntityFrom(event)
|
|
51
|
+
const connection = await this.dbConnection
|
|
34
52
|
debug('Storing audit event', auditEventEntity)
|
|
35
|
-
const createdResult
|
|
53
|
+
const createdResult = await connection.getRepository(AuditEventEntity).save(auditEventEntity)
|
|
36
54
|
|
|
37
|
-
return
|
|
55
|
+
return auditEventFrom(createdResult)
|
|
38
56
|
}
|
|
39
57
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
correlationId: event.correlationId,
|
|
47
|
-
actionType: event.actionType,
|
|
48
|
-
actionSubType: event.actionSubType,
|
|
49
|
-
initiatorType: event.initiatorType,
|
|
50
|
-
partyAlias: event.partyAlias,
|
|
51
|
-
partyCorrelationId: event.partyCorrelationId,
|
|
52
|
-
partyCorrelationType: event.partyCorrelationType,
|
|
53
|
-
subSystemType: event.subSystemType,
|
|
54
|
-
system: event.system,
|
|
55
|
-
systemAlias: event.systemAlias,
|
|
56
|
-
systemCorrelationId: event.systemCorrelationId,
|
|
57
|
-
systemCorrelationIdType: event.systemCorrelationIdType,
|
|
58
|
-
...(event.data && { data: JSON.parse(event.data) }),
|
|
59
|
-
...(event.diagnosticData && { diagnosticData: JSON.parse(event.diagnosticData) }),
|
|
58
|
+
getActivityEvents = async (args?: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>> => {
|
|
59
|
+
const { filter = [] } = args ?? {}
|
|
60
|
+
|
|
61
|
+
const activityEventsFilter = filter.map((item) => ({ ...item, type: LoggingEventType.ACTIVITY }))
|
|
62
|
+
if (activityEventsFilter.length === 0) {
|
|
63
|
+
activityEventsFilter.push({ type: LoggingEventType.ACTIVITY })
|
|
60
64
|
}
|
|
65
|
+
|
|
66
|
+
const connection = await this.dbConnection
|
|
67
|
+
debug('Getting activity events', args)
|
|
68
|
+
const result = await connection.getRepository(AuditEventEntity).find({
|
|
69
|
+
where: activityEventsFilter
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
return result.map((event: AuditEventEntity) => activityEventFrom(event))
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
storeActivityEvent = async (args: StoreActivityEventArgs): Promise<ActivityLoggingEvent> => {
|
|
76
|
+
const { event } = args
|
|
77
|
+
|
|
78
|
+
const activityEventEntity = activityEventEntityFrom(event)
|
|
79
|
+
const connection = await this.dbConnection
|
|
80
|
+
debug('Storing activity event', activityEventEntity)
|
|
81
|
+
const createdResult = await connection.getRepository(AuditEventEntity).save(activityEventEntity)
|
|
82
|
+
|
|
83
|
+
return activityEventFrom(createdResult)
|
|
61
84
|
}
|
|
62
85
|
}
|
package/src/index.ts
CHANGED
|
@@ -8,14 +8,14 @@ import { DidAuthConfigEntity } from './entities/contact/DidAuthConfigEntity'
|
|
|
8
8
|
import { IdentityEntity } from './entities/contact/IdentityEntity'
|
|
9
9
|
import { IdentityMetadataItemEntity } from './entities/contact/IdentityMetadataItemEntity'
|
|
10
10
|
import { OpenIdConfigEntity } from './entities/contact/OpenIdConfigEntity'
|
|
11
|
-
import { BackgroundAttributesEntity
|
|
12
|
-
import { CredentialBrandingEntity
|
|
13
|
-
import { CredentialLocaleBrandingEntity
|
|
14
|
-
import { ImageAttributesEntity
|
|
15
|
-
import { ImageDimensionsEntity
|
|
16
|
-
import { IssuerLocaleBrandingEntity
|
|
17
|
-
import { IssuerBrandingEntity
|
|
18
|
-
import { TextAttributesEntity
|
|
11
|
+
import { BackgroundAttributesEntity } from './entities/issuanceBranding/BackgroundAttributesEntity'
|
|
12
|
+
import { CredentialBrandingEntity } from './entities/issuanceBranding/CredentialBrandingEntity'
|
|
13
|
+
import { CredentialLocaleBrandingEntity } from './entities/issuanceBranding/CredentialLocaleBrandingEntity'
|
|
14
|
+
import { ImageAttributesEntity } from './entities/issuanceBranding/ImageAttributesEntity'
|
|
15
|
+
import { ImageDimensionsEntity } from './entities/issuanceBranding/ImageDimensionsEntity'
|
|
16
|
+
import { IssuerLocaleBrandingEntity } from './entities/issuanceBranding/IssuerLocaleBrandingEntity'
|
|
17
|
+
import { IssuerBrandingEntity } from './entities/issuanceBranding/IssuerBrandingEntity'
|
|
18
|
+
import { TextAttributesEntity } from './entities/issuanceBranding/TextAttributesEntity'
|
|
19
19
|
import { StatusListEntity } from './entities/statusList2021/StatusList2021Entity'
|
|
20
20
|
import { StatusListEntryEntity } from './entities/statusList2021/StatusList2021EntryEntity'
|
|
21
21
|
import { MachineStateInfoEntity } from './entities/machineState/MachineStateInfoEntity'
|
|
@@ -33,10 +33,8 @@ export { DigitalCredentialStore } from './digitalCredential/DigitalCredentialSto
|
|
|
33
33
|
export { AbstractIssuanceBrandingStore } from './issuanceBranding/AbstractIssuanceBrandingStore'
|
|
34
34
|
export { IssuanceBrandingStore } from './issuanceBranding/IssuanceBrandingStore'
|
|
35
35
|
export { StatusListStore } from './statusList/StatusListStore'
|
|
36
|
-
import { AuditEventEntity
|
|
36
|
+
import { AuditEventEntity } from './entities/eventLogger/AuditEventEntity'
|
|
37
37
|
import { DigitalCredentialEntity } from './entities/digitalCredential/DigitalCredentialEntity'
|
|
38
|
-
import { digitalCredentialFrom, digitalCredentialsFrom, nonPersistedDigitalCredentialEntityFromAddArgs } from './utils/digitalCredential/MappingUtils'
|
|
39
|
-
import { isPresentationDefinitionEqual } from './utils/presentationDefinition/MappingUtils'
|
|
40
38
|
import { PresentationDefinitionItemEntity } from './entities/presentationDefinition/PresentationDefinitionItemEntity'
|
|
41
39
|
import { ContactMetadataItemEntity } from './entities/contact/ContactMetadataItemEntity'
|
|
42
40
|
export { AbstractEventLoggerStore } from './eventLogger/AbstractEventLoggerStore'
|
|
@@ -59,6 +57,10 @@ export {
|
|
|
59
57
|
export * from './types'
|
|
60
58
|
export * from './utils/contact/MappingUtils'
|
|
61
59
|
export * from './utils/digitalCredential/MappingUtils'
|
|
60
|
+
export * from './utils/eventLogger/MappingUtils'
|
|
61
|
+
export * from './utils/issuanceBranding/MappingUtils'
|
|
62
|
+
export * from './utils/presentationDefinition/MappingUtils'
|
|
63
|
+
export * from './utils/hasher'
|
|
62
64
|
|
|
63
65
|
export const DataStoreContactEntities = [
|
|
64
66
|
BaseConfigEntity,
|
|
@@ -133,28 +135,13 @@ export {
|
|
|
133
135
|
IssuerLocaleBrandingEntity,
|
|
134
136
|
ElectronicAddressEntity,
|
|
135
137
|
PhysicalAddressEntity,
|
|
136
|
-
backgroundAttributesEntityFrom,
|
|
137
|
-
credentialBrandingEntityFrom,
|
|
138
|
-
imageAttributesEntityFrom,
|
|
139
|
-
imageDimensionsEntityFrom,
|
|
140
|
-
issuerBrandingEntityFrom,
|
|
141
|
-
textAttributesEntityFrom,
|
|
142
|
-
issuerLocaleBrandingEntityFrom,
|
|
143
|
-
credentialLocaleBrandingEntityFrom,
|
|
144
138
|
IStatusListEntity,
|
|
145
139
|
IStatusListEntryEntity,
|
|
146
140
|
StatusListEntity,
|
|
147
141
|
StatusListEntryEntity,
|
|
148
142
|
AuditEventEntity,
|
|
149
|
-
auditEventEntityFrom,
|
|
150
143
|
DigitalCredentialEntity,
|
|
151
|
-
digitalCredentialFrom,
|
|
152
|
-
digitalCredentialsFrom,
|
|
153
|
-
nonPersistedDigitalCredentialEntityFromAddArgs,
|
|
154
144
|
MachineStateInfoEntity,
|
|
155
145
|
PresentationDefinitionItemEntity,
|
|
156
|
-
isPresentationDefinitionEqual,
|
|
157
146
|
ContactMetadataItemEntity,
|
|
158
147
|
}
|
|
159
|
-
|
|
160
|
-
export * from './utils/hasher'
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
import { OrPromise } from '@sphereon/ssi-types'
|
|
1
2
|
import Debug from 'debug'
|
|
2
3
|
import { DataSource, DeleteResult, In, Not, Repository } from 'typeorm'
|
|
3
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
credentialBrandingEntityFrom,
|
|
6
|
+
credentialBrandingFrom,
|
|
7
|
+
credentialLocaleBrandingEntityFrom,
|
|
8
|
+
issuerBrandingEntityFrom,
|
|
9
|
+
issuerBrandingFrom,
|
|
10
|
+
issuerLocaleBrandingEntityFrom,
|
|
11
|
+
localeBrandingFrom
|
|
12
|
+
} from '../utils/issuanceBranding/MappingUtils'
|
|
4
13
|
import { BackgroundAttributesEntity } from '../entities/issuanceBranding/BackgroundAttributesEntity'
|
|
5
14
|
import { ImageAttributesEntity } from '../entities/issuanceBranding/ImageAttributesEntity'
|
|
6
15
|
import { ImageDimensionsEntity } from '../entities/issuanceBranding/ImageDimensionsEntity'
|
|
7
|
-
import { IssuerBrandingEntity
|
|
8
|
-
import { CredentialBrandingEntity
|
|
9
|
-
import { CredentialLocaleBrandingEntity
|
|
10
|
-
import { IssuerLocaleBrandingEntity
|
|
16
|
+
import { IssuerBrandingEntity } from '../entities/issuanceBranding/IssuerBrandingEntity'
|
|
17
|
+
import { CredentialBrandingEntity } from '../entities/issuanceBranding/CredentialBrandingEntity'
|
|
18
|
+
import { CredentialLocaleBrandingEntity } from '../entities/issuanceBranding/CredentialLocaleBrandingEntity'
|
|
19
|
+
import { IssuerLocaleBrandingEntity } from '../entities/issuanceBranding/IssuerLocaleBrandingEntity'
|
|
11
20
|
import { BaseLocaleBrandingEntity } from '../entities/issuanceBranding/BaseLocaleBrandingEntity'
|
|
12
21
|
import { TextAttributesEntity } from '../entities/issuanceBranding/TextAttributesEntity'
|
|
13
22
|
import { AbstractIssuanceBrandingStore } from './AbstractIssuanceBrandingStore'
|
|
@@ -30,7 +39,6 @@ import {
|
|
|
30
39
|
IIssuerBrandingFilter,
|
|
31
40
|
IIssuerLocaleBranding,
|
|
32
41
|
IIssuerLocaleBrandingFilter,
|
|
33
|
-
ILocaleBranding,
|
|
34
42
|
IRemoveCredentialBrandingArgs,
|
|
35
43
|
IRemoveCredentialLocaleBrandingArgs,
|
|
36
44
|
IRemoveIssuerBrandingArgs,
|
|
@@ -71,7 +79,7 @@ export class IssuanceBrandingStore extends AbstractIssuanceBrandingStore {
|
|
|
71
79
|
debug('Adding credential branding', credentialBrandingEntity)
|
|
72
80
|
const createdResult: CredentialBrandingEntity = await repository.save(credentialBrandingEntity)
|
|
73
81
|
|
|
74
|
-
return
|
|
82
|
+
return credentialBrandingFrom(createdResult)
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
public getCredentialBranding = async (args?: IGetCredentialBrandingArgs): Promise<Array<ICredentialBranding>> => {
|
|
@@ -89,7 +97,7 @@ export class IssuanceBrandingStore extends AbstractIssuanceBrandingStore {
|
|
|
89
97
|
...(filter && { where: filter }),
|
|
90
98
|
})
|
|
91
99
|
|
|
92
|
-
return result.map((credentialBranding: CredentialBrandingEntity) =>
|
|
100
|
+
return result.map((credentialBranding: CredentialBrandingEntity) => credentialBrandingFrom(credentialBranding))
|
|
93
101
|
}
|
|
94
102
|
|
|
95
103
|
public removeCredentialBranding = async (args: IRemoveCredentialBrandingArgs): Promise<void> => {
|
|
@@ -133,7 +141,7 @@ export class IssuanceBrandingStore extends AbstractIssuanceBrandingStore {
|
|
|
133
141
|
debug('Updating credential branding', branding)
|
|
134
142
|
const result: CredentialBrandingEntity = await repository.save(branding, { transaction: true })
|
|
135
143
|
|
|
136
|
-
return
|
|
144
|
+
return credentialBrandingFrom(result)
|
|
137
145
|
}
|
|
138
146
|
|
|
139
147
|
public addCredentialLocaleBranding = async (args: IAddCredentialLocaleBrandingArgs): Promise<ICredentialBranding> => {
|
|
@@ -188,7 +196,7 @@ export class IssuanceBrandingStore extends AbstractIssuanceBrandingStore {
|
|
|
188
196
|
return Promise.reject(Error('Unable to get updated credential branding'))
|
|
189
197
|
}
|
|
190
198
|
|
|
191
|
-
return
|
|
199
|
+
return credentialBrandingFrom(result)
|
|
192
200
|
}
|
|
193
201
|
|
|
194
202
|
public getCredentialLocaleBranding = async (args?: IGetCredentialLocaleBrandingArgs): Promise<Array<ICredentialLocaleBranding>> => {
|
|
@@ -210,8 +218,7 @@ export class IssuanceBrandingStore extends AbstractIssuanceBrandingStore {
|
|
|
210
218
|
|
|
211
219
|
return credentialBrandingLocale
|
|
212
220
|
? credentialBrandingLocale.map(
|
|
213
|
-
(credentialLocaleBranding: CredentialLocaleBrandingEntity) =>
|
|
214
|
-
this.localeBrandingFrom(credentialLocaleBranding) as ICredentialLocaleBranding,
|
|
221
|
+
(credentialLocaleBranding: CredentialLocaleBrandingEntity) => localeBrandingFrom(credentialLocaleBranding) as ICredentialLocaleBranding,
|
|
215
222
|
)
|
|
216
223
|
: []
|
|
217
224
|
}
|
|
@@ -259,7 +266,7 @@ export class IssuanceBrandingStore extends AbstractIssuanceBrandingStore {
|
|
|
259
266
|
debug('Updating credential locale branding', localeBranding)
|
|
260
267
|
const updatedResult: CredentialLocaleBrandingEntity = await repository.save(localeBranding, { transaction: true })
|
|
261
268
|
|
|
262
|
-
return
|
|
269
|
+
return localeBrandingFrom(updatedResult) as ICredentialLocaleBranding
|
|
263
270
|
}
|
|
264
271
|
|
|
265
272
|
public addIssuerBranding = async (args: IAddIssuerBrandingArgs): Promise<IIssuerBranding> => {
|
|
@@ -281,7 +288,7 @@ export class IssuanceBrandingStore extends AbstractIssuanceBrandingStore {
|
|
|
281
288
|
debug('Adding issuer branding', issuerBrandingEntity)
|
|
282
289
|
const createdResult: IssuerBrandingEntity = await repository.save(issuerBrandingEntity)
|
|
283
290
|
|
|
284
|
-
return
|
|
291
|
+
return issuerBrandingFrom(createdResult)
|
|
285
292
|
}
|
|
286
293
|
|
|
287
294
|
public getIssuerBranding = async (args?: IGetIssuerBrandingArgs): Promise<Array<IIssuerBranding>> => {
|
|
@@ -299,7 +306,7 @@ export class IssuanceBrandingStore extends AbstractIssuanceBrandingStore {
|
|
|
299
306
|
...(filter && { where: filter }),
|
|
300
307
|
})
|
|
301
308
|
|
|
302
|
-
return result.map((issuerBranding: IssuerBrandingEntity) =>
|
|
309
|
+
return result.map((issuerBranding: IssuerBrandingEntity) => issuerBrandingFrom(issuerBranding))
|
|
303
310
|
}
|
|
304
311
|
|
|
305
312
|
public removeIssuerBranding = async (args: IRemoveIssuerBrandingArgs): Promise<void> => {
|
|
@@ -343,7 +350,7 @@ export class IssuanceBrandingStore extends AbstractIssuanceBrandingStore {
|
|
|
343
350
|
debug('Updating issuer branding', branding)
|
|
344
351
|
const result: IssuerBrandingEntity = await repository.save(branding, { transaction: true })
|
|
345
352
|
|
|
346
|
-
return
|
|
353
|
+
return issuerBrandingFrom(result)
|
|
347
354
|
}
|
|
348
355
|
|
|
349
356
|
public addIssuerLocaleBranding = async (args: IAddIssuerLocaleBrandingArgs): Promise<IIssuerBranding> => {
|
|
@@ -394,7 +401,7 @@ export class IssuanceBrandingStore extends AbstractIssuanceBrandingStore {
|
|
|
394
401
|
return Promise.reject(Error('Unable to get updated issuer branding'))
|
|
395
402
|
}
|
|
396
403
|
|
|
397
|
-
return
|
|
404
|
+
return issuerBrandingFrom(result)
|
|
398
405
|
}
|
|
399
406
|
|
|
400
407
|
public getIssuerLocaleBranding = async (args?: IGetIssuerLocaleBrandingArgs): Promise<Array<IIssuerLocaleBranding>> => {
|
|
@@ -416,7 +423,7 @@ export class IssuanceBrandingStore extends AbstractIssuanceBrandingStore {
|
|
|
416
423
|
|
|
417
424
|
return issuerLocaleBranding
|
|
418
425
|
? issuerLocaleBranding.map(
|
|
419
|
-
(issuerLocaleBranding: IssuerLocaleBrandingEntity) =>
|
|
426
|
+
(issuerLocaleBranding: IssuerLocaleBrandingEntity) => localeBrandingFrom(issuerLocaleBranding) as IIssuerLocaleBranding,
|
|
420
427
|
)
|
|
421
428
|
: []
|
|
422
429
|
}
|
|
@@ -462,56 +469,7 @@ export class IssuanceBrandingStore extends AbstractIssuanceBrandingStore {
|
|
|
462
469
|
debug('Updating issuer locale branding', localeBranding)
|
|
463
470
|
const updatedResult: IssuerLocaleBrandingEntity = await repository.save(localeBranding, { transaction: true })
|
|
464
471
|
|
|
465
|
-
return
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
private credentialBrandingFrom = (credentialBranding: CredentialBrandingEntity): ICredentialBranding => {
|
|
469
|
-
const result: ICredentialBranding = {
|
|
470
|
-
...credentialBranding,
|
|
471
|
-
localeBranding: credentialBranding.localeBranding.map((localeBranding: BaseLocaleBrandingEntity) => this.localeBrandingFrom(localeBranding)),
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
return this.replaceNullWithUndefined(result)
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
private issuerBrandingFrom = (issuerBranding: IssuerBrandingEntity): IIssuerBranding => {
|
|
478
|
-
const result: IIssuerBranding = {
|
|
479
|
-
...issuerBranding,
|
|
480
|
-
localeBranding: issuerBranding.localeBranding.map((localeBranding: BaseLocaleBrandingEntity) => this.localeBrandingFrom(localeBranding)),
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
return this.replaceNullWithUndefined(result)
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
private localeBrandingFrom = (localeBranding: BaseLocaleBrandingEntity): ILocaleBranding => {
|
|
487
|
-
const result: ILocaleBranding = {
|
|
488
|
-
...localeBranding,
|
|
489
|
-
locale: localeBranding.locale === '' ? undefined : localeBranding.locale,
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
return this.replaceNullWithUndefined(result)
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
private replaceNullWithUndefined(obj: any): any {
|
|
496
|
-
if (obj === null) {
|
|
497
|
-
return undefined
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
if (typeof obj !== 'object' || obj instanceof Date) {
|
|
501
|
-
return obj
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
if (Array.isArray(obj)) {
|
|
505
|
-
return obj.map((value: any) => this.replaceNullWithUndefined(value))
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
const result: any = {}
|
|
509
|
-
for (const key in obj) {
|
|
510
|
-
if (obj.hasOwnProperty(key)) {
|
|
511
|
-
result[key] = this.replaceNullWithUndefined(obj[key])
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
return result
|
|
472
|
+
return localeBrandingFrom(updatedResult) as IIssuerLocaleBranding
|
|
515
473
|
}
|
|
516
474
|
|
|
517
475
|
private hasDuplicateLocales = async (localeBranding: Array<IBasicCredentialLocaleBranding | IBasicIssuerLocaleBranding>): Promise<boolean> => {
|
|
@@ -19,7 +19,7 @@ export class CreateIssuanceBranding1685628974232 implements MigrationInterface {
|
|
|
19
19
|
`CREATE TABLE "TextAttributes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "color" character varying(255), CONSTRAINT "PK_TextAttributes_id" PRIMARY KEY ("id"))`,
|
|
20
20
|
)
|
|
21
21
|
await queryRunner.query(
|
|
22
|
-
`CREATE TABLE "BaseLocaleBranding" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "alias" character varying(255), "locale" character varying(255) NOT NULL, "description" character varying(255), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "credentialBrandingId" uuid, "issuerBrandingId" uuid, "type" character varying NOT NULL, "logoId" uuid, "backgroundId" uuid, "textId" uuid, CONSTRAINT "UQ_logoId" UNIQUE ("logoId"), CONSTRAINT "UQ_backgroundId" UNIQUE ("backgroundId"), CONSTRAINT "UQ_textId" UNIQUE ("textId"), CONSTRAINT "PK_BaseLocaleBranding_id" PRIMARY KEY ("id"))`,
|
|
22
|
+
`CREATE TABLE "BaseLocaleBranding" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "alias" character varying(255), "locale" character varying(255) NOT NULL, "description" character varying(255), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "credentialBrandingId" uuid, "issuerBrandingId" uuid, "type" character varying NOT NULL, "logoId" uuid, "backgroundId" uuid, "textId" uuid, "client_uri" character varying, "tos_uri" character varying, "policy_uri" character varying, "contacts" character varying, CONSTRAINT "UQ_logoId" UNIQUE ("logoId"), CONSTRAINT "UQ_backgroundId" UNIQUE ("backgroundId"), CONSTRAINT "UQ_textId" UNIQUE ("textId"), CONSTRAINT "PK_BaseLocaleBranding_id" PRIMARY KEY ("id"))`,
|
|
23
23
|
)
|
|
24
24
|
await queryRunner.query(
|
|
25
25
|
`CREATE UNIQUE INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale" ON "BaseLocaleBranding" ("credentialBrandingId", "locale")`,
|