@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.
Files changed (155) hide show
  1. package/dist/contact/ContactStore.d.ts.map +1 -1
  2. package/dist/digitalCredential/DigitalCredentialStore.d.ts.map +1 -1
  3. package/dist/digitalCredential/DigitalCredentialStore.js +1 -3
  4. package/dist/digitalCredential/DigitalCredentialStore.js.map +1 -1
  5. package/dist/entities/digitalCredential/DigitalCredentialEntity.d.ts.map +1 -1
  6. package/dist/entities/digitalCredential/DigitalCredentialEntity.js +1 -1
  7. package/dist/entities/digitalCredential/DigitalCredentialEntity.js.map +1 -1
  8. package/dist/entities/eventLogger/AuditEventEntity.d.ts +8 -4
  9. package/dist/entities/eventLogger/AuditEventEntity.d.ts.map +1 -1
  10. package/dist/entities/eventLogger/AuditEventEntity.js +28 -25
  11. package/dist/entities/eventLogger/AuditEventEntity.js.map +1 -1
  12. package/dist/entities/issuanceBranding/BackgroundAttributesEntity.d.ts +0 -2
  13. package/dist/entities/issuanceBranding/BackgroundAttributesEntity.d.ts.map +1 -1
  14. package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js +1 -8
  15. package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js.map +1 -1
  16. package/dist/entities/issuanceBranding/CredentialBrandingEntity.d.ts +0 -2
  17. package/dist/entities/issuanceBranding/CredentialBrandingEntity.d.ts.map +1 -1
  18. package/dist/entities/issuanceBranding/CredentialBrandingEntity.js +1 -9
  19. package/dist/entities/issuanceBranding/CredentialBrandingEntity.js.map +1 -1
  20. package/dist/entities/issuanceBranding/CredentialClaimsEntity.d.ts +10 -0
  21. package/dist/entities/issuanceBranding/CredentialClaimsEntity.d.ts.map +1 -0
  22. package/dist/entities/issuanceBranding/CredentialClaimsEntity.js +70 -0
  23. package/dist/entities/issuanceBranding/CredentialClaimsEntity.js.map +1 -0
  24. package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.d.ts +2 -2
  25. package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.d.ts.map +1 -1
  26. package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js +12 -16
  27. package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js.map +1 -1
  28. package/dist/entities/issuanceBranding/ImageAttributesEntity.d.ts +0 -2
  29. package/dist/entities/issuanceBranding/ImageAttributesEntity.d.ts.map +1 -1
  30. package/dist/entities/issuanceBranding/ImageAttributesEntity.js +1 -11
  31. package/dist/entities/issuanceBranding/ImageAttributesEntity.js.map +1 -1
  32. package/dist/entities/issuanceBranding/ImageDimensionsEntity.d.ts +0 -2
  33. package/dist/entities/issuanceBranding/ImageDimensionsEntity.d.ts.map +1 -1
  34. package/dist/entities/issuanceBranding/ImageDimensionsEntity.js +1 -8
  35. package/dist/entities/issuanceBranding/ImageDimensionsEntity.js.map +1 -1
  36. package/dist/entities/issuanceBranding/IssuerBrandingEntity.d.ts +0 -2
  37. package/dist/entities/issuanceBranding/IssuerBrandingEntity.d.ts.map +1 -1
  38. package/dist/entities/issuanceBranding/IssuerBrandingEntity.js +1 -8
  39. package/dist/entities/issuanceBranding/IssuerBrandingEntity.js.map +1 -1
  40. package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.d.ts +4 -2
  41. package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.d.ts.map +1 -1
  42. package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js +21 -15
  43. package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js.map +1 -1
  44. package/dist/entities/issuanceBranding/TextAttributesEntity.d.ts +0 -2
  45. package/dist/entities/issuanceBranding/TextAttributesEntity.d.ts.map +1 -1
  46. package/dist/entities/issuanceBranding/TextAttributesEntity.js +1 -7
  47. package/dist/entities/issuanceBranding/TextAttributesEntity.js.map +1 -1
  48. package/dist/eventLogger/AbstractEventLoggerStore.d.ts +4 -2
  49. package/dist/eventLogger/AbstractEventLoggerStore.d.ts.map +1 -1
  50. package/dist/eventLogger/AbstractEventLoggerStore.js.map +1 -1
  51. package/dist/eventLogger/EventLoggerStore.d.ts +5 -4
  52. package/dist/eventLogger/EventLoggerStore.d.ts.map +1 -1
  53. package/dist/eventLogger/EventLoggerStore.js +35 -8
  54. package/dist/eventLogger/EventLoggerStore.js.map +1 -1
  55. package/dist/index.d.ts +20 -18
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +17 -26
  58. package/dist/index.js.map +1 -1
  59. package/dist/issuanceBranding/IssuanceBrandingStore.d.ts +1 -5
  60. package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -1
  61. package/dist/issuanceBranding/IssuanceBrandingStore.js +17 -46
  62. package/dist/issuanceBranding/IssuanceBrandingStore.js.map +1 -1
  63. package/dist/migrations/internal-migrations-ormconfig.d.ts.map +1 -1
  64. package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.d.ts.map +1 -1
  65. package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js +5 -1
  66. package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js.map +1 -1
  67. package/dist/migrations/postgres/1701634812183-CreateAuditEvents.d.ts.map +1 -1
  68. package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js +34 -6
  69. package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js.map +1 -1
  70. package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js +1 -1
  71. package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js.map +1 -1
  72. package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.d.ts.map +1 -1
  73. package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js +7 -3
  74. package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js.map +1 -1
  75. package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.d.ts.map +1 -1
  76. package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js +27 -1
  77. package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js.map +1 -1
  78. package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js +1 -1
  79. package/dist/presentationDefinition/PDStore.d.ts.map +1 -1
  80. package/dist/statusList/StatusListStore.js.map +1 -1
  81. package/dist/types/contact/contact.d.ts +3 -3
  82. package/dist/types/contact/contact.d.ts.map +1 -1
  83. package/dist/types/digitalCredential/digitalCredential.d.ts +2 -1
  84. package/dist/types/digitalCredential/digitalCredential.d.ts.map +1 -1
  85. package/dist/types/digitalCredential/digitalCredential.js +1 -0
  86. package/dist/types/digitalCredential/digitalCredential.js.map +1 -1
  87. package/dist/types/eventLogger/IAbstractEventLoggerStore.d.ts +9 -2
  88. package/dist/types/eventLogger/IAbstractEventLoggerStore.d.ts.map +1 -1
  89. package/dist/types/eventLogger/eventLogger.d.ts +3 -2
  90. package/dist/types/eventLogger/eventLogger.d.ts.map +1 -1
  91. package/dist/types/issuanceBranding/issuanceBranding.d.ts +21 -4
  92. package/dist/types/issuanceBranding/issuanceBranding.d.ts.map +1 -1
  93. package/dist/utils/FormattingUtils.d.ts +2 -0
  94. package/dist/utils/FormattingUtils.d.ts.map +1 -0
  95. package/dist/utils/FormattingUtils.js +23 -0
  96. package/dist/utils/FormattingUtils.js.map +1 -0
  97. package/dist/utils/SortingUtils.d.ts.map +1 -1
  98. package/dist/utils/contact/MappingUtils.d.ts.map +1 -1
  99. package/dist/utils/contact/MappingUtils.js +27 -14
  100. package/dist/utils/contact/MappingUtils.js.map +1 -1
  101. package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -1
  102. package/dist/utils/digitalCredential/MappingUtils.js +7 -5
  103. package/dist/utils/digitalCredential/MappingUtils.js.map +1 -1
  104. package/dist/utils/eventLogger/MappingUtils.d.ts +8 -0
  105. package/dist/utils/eventLogger/MappingUtils.d.ts.map +1 -0
  106. package/dist/utils/eventLogger/MappingUtils.js +70 -0
  107. package/dist/utils/eventLogger/MappingUtils.js.map +1 -0
  108. package/dist/utils/issuanceBranding/MappingUtils.d.ts +24 -0
  109. package/dist/utils/issuanceBranding/MappingUtils.d.ts.map +1 -0
  110. package/dist/utils/issuanceBranding/MappingUtils.js +109 -0
  111. package/dist/utils/issuanceBranding/MappingUtils.js.map +1 -0
  112. package/dist/utils/presentationDefinition/MappingUtils.d.ts.map +1 -1
  113. package/dist/utils/presentationDefinition/MappingUtils.js +5 -3
  114. package/dist/utils/presentationDefinition/MappingUtils.js.map +1 -1
  115. package/package.json +10 -9
  116. package/src/__tests__/contact.store.test.ts +46 -4
  117. package/src/__tests__/digitalCredential.entities.test.ts +1 -7
  118. package/src/__tests__/digitalCredential.store.test.ts +85 -4
  119. package/src/__tests__/eventLogger.entities.test.ts +60 -5
  120. package/src/__tests__/eventLogger.store.test.ts +461 -3
  121. package/src/__tests__/issuanceBranding.entities.test.ts +129 -0
  122. package/src/digitalCredential/DigitalCredentialStore.ts +1 -3
  123. package/src/entities/digitalCredential/DigitalCredentialEntity.ts +1 -1
  124. package/src/entities/eventLogger/AuditEventEntity.ts +23 -28
  125. package/src/entities/issuanceBranding/BackgroundAttributesEntity.ts +2 -11
  126. package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +1 -13
  127. package/src/entities/issuanceBranding/CredentialClaimsEntity.ts +35 -0
  128. package/src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts +11 -18
  129. package/src/entities/issuanceBranding/ImageAttributesEntity.ts +2 -14
  130. package/src/entities/issuanceBranding/ImageDimensionsEntity.ts +0 -9
  131. package/src/entities/issuanceBranding/IssuerBrandingEntity.ts +1 -12
  132. package/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts +17 -17
  133. package/src/entities/issuanceBranding/TextAttributesEntity.ts +1 -9
  134. package/src/eventLogger/AbstractEventLoggerStore.ts +4 -2
  135. package/src/eventLogger/EventLoggerStore.ts +45 -32
  136. package/src/index.ts +20 -30
  137. package/src/issuanceBranding/IssuanceBrandingStore.ts +26 -68
  138. package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +11 -1
  139. package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +34 -6
  140. package/src/migrations/postgres/1708525189001-CreateDigitalCredential.ts +1 -1
  141. package/src/migrations/sqlite/1685628973231-CreateIssuanceBranding.ts +11 -3
  142. package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +27 -1
  143. package/src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts +1 -1
  144. package/src/statusList/StatusListStore.ts +1 -1
  145. package/src/types/contact/contact.ts +3 -3
  146. package/src/types/digitalCredential/digitalCredential.ts +1 -0
  147. package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -2
  148. package/src/types/eventLogger/eventLogger.ts +3 -2
  149. package/src/types/issuanceBranding/issuanceBranding.ts +24 -6
  150. package/src/utils/FormattingUtils.ts +21 -0
  151. package/src/utils/contact/MappingUtils.ts +39 -13
  152. package/src/utils/digitalCredential/MappingUtils.ts +4 -1
  153. package/src/utils/eventLogger/MappingUtils.ts +117 -0
  154. package/src/utils/issuanceBranding/MappingUtils.ts +145 -0
  155. package/src/utils/presentationDefinition/MappingUtils.ts +4 -1
@@ -1,10 +1,11 @@
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, auditEventEntityFrom } from '../entities/eventLogger/AuditEventEntity'
7
- import { GetAuditEventsArgs, StoreAuditEventArgs } from '../types'
6
+ import { AuditEventEntity } from '../entities/eventLogger/AuditEventEntity'
7
+ import { activityEventEntityFrom, activityEventFrom, auditEventEntityFrom, auditEventFrom } from '../utils/eventLogger/MappingUtils'
8
+ import { GetActivityEventsArgs, GetAuditEventsArgs, StoreActivityEventArgs, StoreAuditEventArgs } from '../types'
8
9
 
9
10
  const debug: Debugger = Debug('sphereon:ssi-sdk:event-store')
10
11
 
@@ -17,46 +18,58 @@ export class EventLoggerStore extends AbstractEventLoggerStore {
17
18
  }
18
19
 
19
20
  getAuditEvents = async (args?: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>> => {
20
- const connection: DataSource = await this.dbConnection // TODO apply everywhere
21
+ const { filter = [] } = args ?? {}
22
+
23
+ const auditEventsFilter = filter.map((item) => ({ ...item, type: LoggingEventType.AUDIT }))
24
+ if (auditEventsFilter.length === 0) {
25
+ auditEventsFilter.push({ type: LoggingEventType.AUDIT })
26
+ }
27
+
28
+ const connection = await this.dbConnection
21
29
  debug('Getting audit events', args)
22
- const result: Array<AuditEventEntity> = await connection.getRepository(AuditEventEntity).find({
23
- ...(args?.filter && { where: args?.filter }),
30
+ const result = await connection.getRepository(AuditEventEntity).find({
31
+ where: auditEventsFilter,
24
32
  })
25
33
 
26
- return result.map((event: AuditEventEntity) => this.auditEventFrom(event))
34
+ return result.map((event: AuditEventEntity) => auditEventFrom(event))
27
35
  }
28
36
 
29
37
  storeAuditEvent = async (args: StoreAuditEventArgs): Promise<AuditLoggingEvent> => {
30
38
  const { event } = args
31
39
 
32
- const auditEventEntity: AuditEventEntity = auditEventEntityFrom(event)
33
- const connection: DataSource = await this.dbConnection
40
+ const auditEventEntity = auditEventEntityFrom(event)
41
+ const connection = await this.dbConnection
34
42
  debug('Storing audit event', auditEventEntity)
35
- const createdResult: AuditEventEntity = await connection.getRepository(AuditEventEntity).save(auditEventEntity)
43
+ const createdResult = await connection.getRepository(AuditEventEntity).save(auditEventEntity)
36
44
 
37
- return this.auditEventFrom(createdResult)
45
+ return auditEventFrom(createdResult)
38
46
  }
39
47
 
40
- private auditEventFrom = (event: AuditEventEntity): AuditLoggingEvent => {
41
- return {
42
- id: event.id,
43
- description: event.description,
44
- timestamp: event.timestamp,
45
- level: event.level,
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) }),
48
+ getActivityEvents = async (args?: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>> => {
49
+ const { filter = [] } = args ?? {}
50
+
51
+ const activityEventsFilter = filter.map((item) => ({ ...item, type: LoggingEventType.ACTIVITY }))
52
+ if (activityEventsFilter.length === 0) {
53
+ activityEventsFilter.push({ type: LoggingEventType.ACTIVITY })
60
54
  }
55
+
56
+ const connection = await this.dbConnection
57
+ debug('Getting activity events', args)
58
+ const result = await connection.getRepository(AuditEventEntity).find({
59
+ where: activityEventsFilter,
60
+ })
61
+
62
+ return result.map((event: AuditEventEntity) => activityEventFrom(event))
63
+ }
64
+
65
+ storeActivityEvent = async (args: StoreActivityEventArgs): Promise<ActivityLoggingEvent> => {
66
+ const { event } = args
67
+
68
+ const activityEventEntity = activityEventEntityFrom(event)
69
+ const connection = await this.dbConnection
70
+ debug('Storing activity event', activityEventEntity)
71
+ const createdResult = await connection.getRepository(AuditEventEntity).save(activityEventEntity)
72
+
73
+ return activityEventFrom(createdResult)
61
74
  }
62
75
  }
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, backgroundAttributesEntityFrom } from './entities/issuanceBranding/BackgroundAttributesEntity'
12
- import { CredentialBrandingEntity, credentialBrandingEntityFrom } from './entities/issuanceBranding/CredentialBrandingEntity'
13
- import { CredentialLocaleBrandingEntity, credentialLocaleBrandingEntityFrom } from './entities/issuanceBranding/CredentialLocaleBrandingEntity'
14
- import { ImageAttributesEntity, imageAttributesEntityFrom } from './entities/issuanceBranding/ImageAttributesEntity'
15
- import { ImageDimensionsEntity, imageDimensionsEntityFrom } from './entities/issuanceBranding/ImageDimensionsEntity'
16
- import { IssuerLocaleBrandingEntity, issuerLocaleBrandingEntityFrom } from './entities/issuanceBranding/IssuerLocaleBrandingEntity'
17
- import { IssuerBrandingEntity, issuerBrandingEntityFrom } from './entities/issuanceBranding/IssuerBrandingEntity'
18
- import { TextAttributesEntity, textAttributesEntityFrom } from './entities/issuanceBranding/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'
@@ -26,6 +26,12 @@ import { OrganizationEntity } from './entities/contact/OrganizationEntity'
26
26
  import { NaturalPersonEntity } from './entities/contact/NaturalPersonEntity'
27
27
  import { ElectronicAddressEntity } from './entities/contact/ElectronicAddressEntity'
28
28
  import { PhysicalAddressEntity } from './entities/contact/PhysicalAddressEntity'
29
+ import { AuditEventEntity } from './entities/eventLogger/AuditEventEntity'
30
+ import { DigitalCredentialEntity } from './entities/digitalCredential/DigitalCredentialEntity'
31
+ import { PresentationDefinitionItemEntity } from './entities/presentationDefinition/PresentationDefinitionItemEntity'
32
+ import { ContactMetadataItemEntity } from './entities/contact/ContactMetadataItemEntity'
33
+ import { CredentialClaimsEntity } from './entities/issuanceBranding/CredentialClaimsEntity'
34
+
29
35
  export { ContactStore } from './contact/ContactStore'
30
36
  export { AbstractContactStore } from './contact/AbstractContactStore'
31
37
  export { AbstractDigitalCredentialStore } from './digitalCredential/AbstractDigitalCredentialStore'
@@ -33,19 +39,12 @@ export { DigitalCredentialStore } from './digitalCredential/DigitalCredentialSto
33
39
  export { AbstractIssuanceBrandingStore } from './issuanceBranding/AbstractIssuanceBrandingStore'
34
40
  export { IssuanceBrandingStore } from './issuanceBranding/IssuanceBrandingStore'
35
41
  export { StatusListStore } from './statusList/StatusListStore'
36
- import { AuditEventEntity, auditEventEntityFrom } from './entities/eventLogger/AuditEventEntity'
37
- import { DigitalCredentialEntity } from './entities/digitalCredential/DigitalCredentialEntity'
38
- import { digitalCredentialFrom, digitalCredentialsFrom, nonPersistedDigitalCredentialEntityFromAddArgs } from './utils/digitalCredential/MappingUtils'
39
- import { isPresentationDefinitionEqual } from './utils/presentationDefinition/MappingUtils'
40
- import { PresentationDefinitionItemEntity } from './entities/presentationDefinition/PresentationDefinitionItemEntity'
41
- import { ContactMetadataItemEntity } from './entities/contact/ContactMetadataItemEntity'
42
42
  export { AbstractEventLoggerStore } from './eventLogger/AbstractEventLoggerStore'
43
43
  export { EventLoggerStore } from './eventLogger/EventLoggerStore'
44
44
  export { IAbstractMachineStateStore } from './machineState/IAbstractMachineStateStore'
45
45
  export { MachineStateStore } from './machineState/MachineStateStore'
46
46
  export { AbstractPDStore } from './presentationDefinition/AbstractPDStore'
47
47
  export { PDStore } from './presentationDefinition/PDStore'
48
-
49
48
  export {
50
49
  DataStoreMigrations,
51
50
  DataStoreEventLoggerMigrations,
@@ -59,6 +58,10 @@ export {
59
58
  export * from './types'
60
59
  export * from './utils/contact/MappingUtils'
61
60
  export * from './utils/digitalCredential/MappingUtils'
61
+ export * from './utils/eventLogger/MappingUtils'
62
+ export * from './utils/issuanceBranding/MappingUtils'
63
+ export * from './utils/presentationDefinition/MappingUtils'
64
+ export * from './utils/hasher'
62
65
 
63
66
  export const DataStoreContactEntities = [
64
67
  BaseConfigEntity,
@@ -89,6 +92,7 @@ export const DataStoreIssuanceBrandingEntities = [
89
92
  TextAttributesEntity,
90
93
  CredentialLocaleBrandingEntity,
91
94
  IssuerLocaleBrandingEntity,
95
+ CredentialClaimsEntity,
92
96
  ]
93
97
 
94
98
  export const DataStorePresentationDefinitionEntities = [PresentationDefinitionItemEntity]
@@ -133,28 +137,14 @@ export {
133
137
  IssuerLocaleBrandingEntity,
134
138
  ElectronicAddressEntity,
135
139
  PhysicalAddressEntity,
136
- backgroundAttributesEntityFrom,
137
- credentialBrandingEntityFrom,
138
- imageAttributesEntityFrom,
139
- imageDimensionsEntityFrom,
140
- issuerBrandingEntityFrom,
141
- textAttributesEntityFrom,
142
- issuerLocaleBrandingEntityFrom,
143
- credentialLocaleBrandingEntityFrom,
144
140
  IStatusListEntity,
145
141
  IStatusListEntryEntity,
146
142
  StatusListEntity,
147
143
  StatusListEntryEntity,
148
144
  AuditEventEntity,
149
- auditEventEntityFrom,
150
145
  DigitalCredentialEntity,
151
- digitalCredentialFrom,
152
- digitalCredentialsFrom,
153
- nonPersistedDigitalCredentialEntityFromAddArgs,
154
146
  MachineStateInfoEntity,
155
147
  PresentationDefinitionItemEntity,
156
- isPresentationDefinitionEqual,
157
148
  ContactMetadataItemEntity,
149
+ CredentialClaimsEntity,
158
150
  }
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 { OrPromise } from '@sphereon/ssi-types'
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, issuerBrandingEntityFrom } from '../entities/issuanceBranding/IssuerBrandingEntity'
8
- import { CredentialBrandingEntity, credentialBrandingEntityFrom } from '../entities/issuanceBranding/CredentialBrandingEntity'
9
- import { CredentialLocaleBrandingEntity, credentialLocaleBrandingEntityFrom } from '../entities/issuanceBranding/CredentialLocaleBrandingEntity'
10
- import { IssuerLocaleBrandingEntity, issuerLocaleBrandingEntityFrom } from '../entities/issuanceBranding/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 this.credentialBrandingFrom(createdResult)
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) => this.credentialBrandingFrom(credentialBranding))
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 this.credentialBrandingFrom(result)
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 this.credentialBrandingFrom(result)
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 this.localeBrandingFrom(updatedResult) as ICredentialLocaleBranding
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 this.issuerBrandingFrom(createdResult)
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) => this.issuerBrandingFrom(issuerBranding))
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 this.issuerBrandingFrom(result)
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 this.issuerBrandingFrom(result)
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) => this.localeBrandingFrom(issuerLocaleBranding) as IIssuerLocaleBranding,
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 this.localeBrandingFrom(updatedResult) as IIssuerLocaleBranding
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")`,
@@ -28,6 +28,14 @@ export class CreateIssuanceBranding1685628974232 implements MigrationInterface {
28
28
  `CREATE UNIQUE INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale" ON "BaseLocaleBranding" ("issuerBrandingId", "locale")`,
29
29
  )
30
30
  await queryRunner.query(`CREATE INDEX "IDX_BaseLocaleBranding_type" ON "BaseLocaleBranding" ("type")`)
31
+
32
+ await queryRunner.query(
33
+ `CREATE TABLE "CredentialClaims" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "key" character varying(255) NOT NULL, "name" character varying(255) NOT NULL, "credentialLocaleBrandingId" character varying, CONSTRAINT "PK_CredentialClaims_id" PRIMARY KEY ("id"))`,
34
+ )
35
+ await queryRunner.query(
36
+ `CREATE UNIQUE INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale" ON "CredentialClaims" ("credentialLocaleBrandingId", "key")`,
37
+ )
38
+
31
39
  await queryRunner.query(
32
40
  `CREATE TABLE "CredentialBranding" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "vcHash" character varying(255) NOT NULL, "issuerCorrelationId" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_vcHash" UNIQUE ("vcHash"), CONSTRAINT "PK_CredentialBranding_id" PRIMARY KEY ("id"))`,
33
41
  )
@@ -76,6 +84,8 @@ export class CreateIssuanceBranding1685628974232 implements MigrationInterface {
76
84
  await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_BaseLocaleBranding_type"`)
77
85
  await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale"`)
78
86
  await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale"`)
87
+ await queryRunner.query(`ALTER TABLE "CredentialClaims" DROP INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale"`)
88
+ await queryRunner.query(`DROP TABLE "CredentialClaims"`)
79
89
  await queryRunner.query(`DROP TABLE "BaseLocaleBranding"`)
80
90
  await queryRunner.query(`DROP TABLE "TextAttributes"`)
81
91
  await queryRunner.query(`DROP TABLE "BackgroundAttributes"`)
@@ -4,19 +4,47 @@ export class CreateAuditEvents1701634812183 implements MigrationInterface {
4
4
  name = 'CreateAuditEvents1701634812183'
5
5
 
6
6
  public async up(queryRunner: QueryRunner): Promise<void> {
7
- await queryRunner.query(`CREATE TYPE "public"."Level_enum" AS ENUM('0', '1', '2', '3')`)
7
+ await queryRunner.query(`CREATE TYPE "public"."Level_enum" AS ENUM('0', '1', '2', '3', '4')`)
8
8
  await queryRunner.query(
9
- `CREATE TYPE "public"."System_enum" AS ENUM('general', 'kms', 'identity', 'oid4vci', 'credentials', 'web3', 'profile', 'contact')`,
9
+ `CREATE TYPE "public"."System_enum" AS ENUM('general', 'kms', 'identity', 'oid4vci', 'oid4vp', 'siopv2', 'PE', 'credentials', 'web3', 'profile', 'contact')`,
10
10
  )
11
11
  await queryRunner.query(
12
- `CREATE TYPE "public"."Subsystem_type_enum" AS ENUM('key', 'did_provider', 'did_resolver', 'oid4vp_op', 'oid4vci_client', 'siopv2_op', 'contact_manager', 'vc_issuer', 'vc_verifier', 'vc_persistence', 'transport', 'profile')`,
12
+ `CREATE TYPE "public"."Subsystem_type_enum" AS ENUM('key', 'did_provider', 'did_resolver', 'oid4vp_op', 'oid4vci_client', 'siopv2_op', 'contact_manager', 'vc_issuer', 'vc_verifier', 'vc_persistence', 'transport', 'profile', 'api')`,
13
13
  )
14
14
  await queryRunner.query(`CREATE TYPE "public"."Action_type_enum" AS ENUM('create', 'read', 'update', 'delete', 'execute')`)
15
15
  await queryRunner.query(`CREATE TYPE "public"."Initiator_type_enum" AS ENUM('user', 'system', 'external')`)
16
- await queryRunner.query(`CREATE TYPE "public"."System_correlation_id_type_enum" AS ENUM('did', 'email', 'hostname', 'phone', 'user')`)
17
- await queryRunner.query(`CREATE TYPE "public"."Party_correlation_type_enum" AS ENUM('did', 'email', 'hostname', 'phone')`)
16
+ await queryRunner.query(`CREATE TYPE "public"."System_correlation_id_type_enum" AS ENUM('did', 'url', 'email', 'hostname', 'phone', 'user')`)
17
+ await queryRunner.query(`CREATE TYPE "public"."Party_correlation_type_enum" AS ENUM('did', 'url', 'email', 'hostname', 'phone')`)
18
+ await queryRunner.query(`CREATE TYPE "public"."Event_type_enum" AS ENUM('audit', 'activity', 'general')`)
19
+ await queryRunner.query(`CREATE TYPE "public"."Event_credential_type_enum" AS ENUM('JSON_LD', 'JWT', 'SD_JWT', 'MSO_MDOC')`)
18
20
  await queryRunner.query(
19
- `CREATE TABLE "AuditEvents" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "timestamp" TIMESTAMP NOT NULL, "level" "public"."Level_enum" NOT NULL, "correlationId" TEXT NOT NULL, "system" "public"."System_enum" NOT NULL, "subSystemType" "public"."Subsystem_type_enum" NOT NULL, "actionType" "public"."Action_type_enum" NOT NULL, "actionSubType" TEXT NOT NULL, "initiatorType" "public"."Initiator_type_enum" NOT NULL, "systemCorrelationIdType" "public"."System_correlation_id_type_enum", "systemCorrelationId" TEXT, "systemAlias" TEXT, "partyCorrelationType" "public"."Party_correlation_type_enum", "partyCorrelationId" TEXT, "partyAlias" TEXT, "description" TEXT NOT NULL, "data" TEXT, "diagnosticData" TEXT, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_AuditEvents_id" PRIMARY KEY ("id"))`,
21
+ `CREATE TABLE "AuditEvents" (
22
+ "id" uuid NOT NULL DEFAULT uuid_generate_v4(),
23
+ "eventType" "public"."Event_type_enum" NOT NULL,
24
+ "timestamp" TIMESTAMP NOT NULL,
25
+ "level" "public"."Level_enum" NOT NULL,
26
+ "correlationId" TEXT NOT NULL,
27
+ "system" "public"."System_enum" NOT NULL,
28
+ "subSystemType" "public"."Subsystem_type_enum" NOT NULL,
29
+ "actionType" "public"."Action_type_enum" NOT NULL,
30
+ "actionSubType" TEXT NOT NULL,
31
+ "initiatorType" "public"."Initiator_type_enum" NOT NULL,
32
+ "systemCorrelationIdType" "public"."System_correlation_id_type_enum",
33
+ "systemCorrelationId" TEXT,
34
+ "systemAlias" TEXT,
35
+ "partyCorrelationType" "public"."Party_correlation_type_enum",
36
+ "partyCorrelationId" TEXT,
37
+ "partyAlias" TEXT,
38
+ "credentialType" "public"."Event_credential_type_enum",
39
+ "credentialHash" TEXT,
40
+ "originalCredential" TEXT,
41
+ "sharePurpose" TEXT,
42
+ "description" TEXT NOT NULL,
43
+ "data" TEXT,
44
+ "diagnosticData" TEXT,
45
+ "created_at" TIMESTAMP NOT NULL DEFAULT now(),
46
+ "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
47
+ CONSTRAINT "PK_AuditEvents_id" PRIMARY KEY ("id"))`,
20
48
  )
21
49
  }
22
50
 
@@ -7,7 +7,7 @@ export class CreateDigitalCredential1708525189001 implements MigrationInterface
7
7
  await queryRunner.query(`CREATE TYPE "digital_document_type" AS ENUM('VC', 'VP', 'C', 'P')`)
8
8
  await queryRunner.query(`CREATE TYPE "digital_regulation_type" AS ENUM('PID', 'QEAA', 'EAA', 'NON_REGULATED')`)
9
9
  await queryRunner.query(`CREATE TYPE "digital_credential_document_format" AS ENUM('JSON_LD', 'JWT', 'SD_JWT', 'MSO_MDOC')`)
10
- await queryRunner.query(`CREATE TYPE "digital_credential_credential_role" AS ENUM('ISSUER', 'VERIFIER', 'HOLDER')`)
10
+ await queryRunner.query(`CREATE TYPE "digital_credential_credential_role" AS ENUM('ISSUER', 'VERIFIER', 'HOLDER', 'FEDERATION_TRUST_ANCHOR')`)
11
11
  await queryRunner.query(`CREATE TYPE "digital_credential_correlation_type" AS ENUM('DID', 'KID', 'URL', 'X509_SAN')`)
12
12
  await queryRunner.query(`CREATE TYPE "digital_credential_state_type" AS ENUM('REVOKED', 'VERIFIED', 'EXPIRED')`)
13
13
 
@@ -13,7 +13,7 @@ export class CreateIssuanceBranding1685628973231 implements MigrationInterface {
13
13
  )
14
14
  await queryRunner.query(`CREATE TABLE "TextAttributes" ("id" varchar PRIMARY KEY NOT NULL, "color" varchar(255))`)
15
15
  await queryRunner.query(
16
- `CREATE TABLE "BaseLocaleBranding" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255), "locale" varchar(255) NOT NULL, "description" varchar(255), "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "credentialBrandingId" varchar, "issuerBrandingId" varchar, "type" varchar NOT NULL, "logoId" varchar, "backgroundId" varchar, "textId" varchar, CONSTRAINT "UQ_logoId" UNIQUE ("logoId"), CONSTRAINT "UQ_backgroundId" UNIQUE ("backgroundId"), CONSTRAINT "UQ_textId" UNIQUE ("textId"))`,
16
+ `CREATE TABLE "BaseLocaleBranding" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255), "locale" varchar(255) NOT NULL, "description" varchar(255), "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "credentialBrandingId" varchar, "issuerBrandingId" varchar, "type" varchar NOT NULL, "logoId" varchar, "backgroundId" varchar, "textId" varchar, "client_uri" varchar, "tos_uri" varchar, "policy_uri" varchar, "contacts" varchar, CONSTRAINT "UQ_logoId" UNIQUE ("logoId"), CONSTRAINT "UQ_backgroundId" UNIQUE ("backgroundId"), CONSTRAINT "UQ_textId" UNIQUE ("textId"))`,
17
17
  )
18
18
  await queryRunner.query(
19
19
  `CREATE UNIQUE INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale" ON "BaseLocaleBranding" ("credentialBrandingId", "locale")`,
@@ -22,6 +22,12 @@ export class CreateIssuanceBranding1685628973231 implements MigrationInterface {
22
22
  `CREATE UNIQUE INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale" ON "BaseLocaleBranding" ("issuerBrandingId", "locale")`,
23
23
  )
24
24
  await queryRunner.query(`CREATE INDEX "IDX_BaseLocaleBranding_type" ON "BaseLocaleBranding" ("type")`)
25
+ await queryRunner.query(
26
+ `CREATE TABLE "CredentialClaims" ("id" varchar PRIMARY KEY NOT NULL, "key" varchar(255) NOT NULL, "name" varchar(255) NOT NULL, "credentialLocaleBrandingId" varchar)`,
27
+ )
28
+ await queryRunner.query(
29
+ `CREATE UNIQUE INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale" ON "CredentialClaims" ("credentialLocaleBrandingId", "key")`,
30
+ )
25
31
  await queryRunner.query(
26
32
  `CREATE TABLE "CredentialBranding" ("id" varchar PRIMARY KEY NOT NULL, "vcHash" varchar(255) NOT NULL, "issuerCorrelationId" varchar(255) NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "UQ_vcHash" UNIQUE ("vcHash"))`,
27
33
  )
@@ -51,7 +57,7 @@ export class CreateIssuanceBranding1685628973231 implements MigrationInterface {
51
57
  await queryRunner.query(`DROP INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale"`)
52
58
  await queryRunner.query(`DROP INDEX "IDX_BaseLocaleBranding_type"`)
53
59
  await queryRunner.query(
54
- `CREATE TABLE "temporary_BaseLocaleBranding" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255), "locale" varchar(255) NOT NULL, "description" varchar(255), "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "credentialBrandingId" varchar, "issuerBrandingId" varchar, "type" varchar NOT NULL, "logoId" varchar, "backgroundId" varchar, "textId" varchar, CONSTRAINT "UQ_logoId" UNIQUE ("logoId"), CONSTRAINT "UQ_backgroundId" UNIQUE ("backgroundId"), CONSTRAINT "UQ_textId" UNIQUE ("textId"), CONSTRAINT "FK_BaseLocaleBranding_logoId" FOREIGN KEY ("logoId") REFERENCES "ImageAttributes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_BaseLocaleBranding_backgroundId" FOREIGN KEY ("backgroundId") REFERENCES "BackgroundAttributes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_BaseLocaleBranding_textId" FOREIGN KEY ("textId") REFERENCES "TextAttributes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_BaseLocaleBranding_credentialBrandingId" FOREIGN KEY ("credentialBrandingId") REFERENCES "CredentialBranding" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_BaseLocaleBranding_issuerBrandingId" FOREIGN KEY ("issuerBrandingId") REFERENCES "IssuerBranding" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`,
60
+ `CREATE TABLE "temporary_BaseLocaleBranding" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255), "locale" varchar(255) NOT NULL, "description" varchar(255), "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "credentialBrandingId" varchar, "issuerBrandingId" varchar, "type" varchar NOT NULL, "logoId" varchar, "backgroundId" varchar, "textId" varchar, "client_uri" varchar, "tos_uri" varchar, "policy_uri" varchar, "contacts" varchar, CONSTRAINT "UQ_logoId" UNIQUE ("logoId"), CONSTRAINT "UQ_backgroundId" UNIQUE ("backgroundId"), CONSTRAINT "UQ_textId" UNIQUE ("textId"), CONSTRAINT "FK_BaseLocaleBranding_logoId" FOREIGN KEY ("logoId") REFERENCES "ImageAttributes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_BaseLocaleBranding_backgroundId" FOREIGN KEY ("backgroundId") REFERENCES "BackgroundAttributes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_BaseLocaleBranding_textId" FOREIGN KEY ("textId") REFERENCES "TextAttributes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_BaseLocaleBranding_credentialBrandingId" FOREIGN KEY ("credentialBrandingId") REFERENCES "CredentialBranding" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_BaseLocaleBranding_issuerBrandingId" FOREIGN KEY ("issuerBrandingId") REFERENCES "IssuerBranding" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`,
55
61
  )
56
62
  await queryRunner.query(
57
63
  `INSERT INTO "temporary_BaseLocaleBranding"("id", "alias", "locale", "description", "created_at", "last_updated_at", "credentialBrandingId", "issuerBrandingId", "type", "logoId", "backgroundId", "textId") SELECT "id", "alias", "locale", "description", "created_at", "last_updated_at", "credentialBrandingId", "issuerBrandingId", "type", "logoId", "backgroundId", "textId" FROM "BaseLocaleBranding"`,
@@ -73,7 +79,7 @@ export class CreateIssuanceBranding1685628973231 implements MigrationInterface {
73
79
  await queryRunner.query(`DROP INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale"`)
74
80
  await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" RENAME TO "temporary_BaseLocaleBranding"`)
75
81
  await queryRunner.query(
76
- `CREATE TABLE "BaseLocaleBranding" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255), "locale" varchar(255) NOT NULL, "description" varchar(255), "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "credentialBrandingId" varchar, "issuerBrandingId" varchar, "type" varchar NOT NULL, "logoId" varchar, "backgroundId" varchar, "textId" varchar, CONSTRAINT "UQ_logoId" UNIQUE ("logoId"), CONSTRAINT "UQ_backgroundId" UNIQUE ("backgroundId"), CONSTRAINT "UQ_textId" UNIQUE ("textId"))`,
82
+ `CREATE TABLE "BaseLocaleBranding" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255), "locale" varchar(255) NOT NULL, "description" varchar(255), "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "credentialBrandingId" varchar, "issuerBrandingId" varchar, "type" varchar NOT NULL, "logoId" varchar, "backgroundId" varchar, "textId" varchar, "client_uri" varchar, "tos_uri" varchar, "policy_uri" varchar, "contacts" varchar, CONSTRAINT "UQ_logoId" UNIQUE ("logoId"), CONSTRAINT "UQ_backgroundId" UNIQUE ("backgroundId"), CONSTRAINT "UQ_textId" UNIQUE ("textId"))`,
77
83
  )
78
84
  await queryRunner.query(
79
85
  `INSERT INTO "BaseLocaleBranding"("id", "alias", "locale", "description", "created_at", "last_updated_at", "credentialBrandingId", "issuerBrandingId", "type", "logoId", "backgroundId", "textId") SELECT "id", "alias", "locale", "description", "created_at", "last_updated_at", "credentialBrandingId", "issuerBrandingId", "type", "logoId", "backgroundId", "textId" FROM "BaseLocaleBranding"`,
@@ -108,6 +114,8 @@ export class CreateIssuanceBranding1685628973231 implements MigrationInterface {
108
114
  await queryRunner.query(`DROP INDEX "IDX_CredentialBrandingEntity_issuerCorrelationId"`)
109
115
  await queryRunner.query(`DROP TABLE "CredentialBranding"`)
110
116
  await queryRunner.query(`DROP INDEX "IDX_BaseLocaleBranding_type"`)
117
+ await queryRunner.query(`DROP INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale"`)
118
+ await queryRunner.query(`DROP TABLE "CredentialClaims"`)
111
119
  await queryRunner.query(`DROP INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale"`)
112
120
  await queryRunner.query(`DROP INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale"`)
113
121
  await queryRunner.query(`DROP TABLE "BaseLocaleBranding"`)
@@ -5,7 +5,33 @@ export class CreateAuditEvents1701634819487 implements MigrationInterface {
5
5
 
6
6
  public async up(queryRunner: QueryRunner): Promise<void> {
7
7
  await queryRunner.query(
8
- `CREATE TABLE "AuditEvents" ("id" varchar PRIMARY KEY NOT NULL, "timestamp" datetime NOT NULL, "level" varchar CHECK( "level" IN ('0','1','2','3') ) NOT NULL, "correlationId" varchar NOT NULL, "system" varchar CHECK( "system" IN ('general','kms','identity','oid4vci','credentials','web3','profile','contact') ) NOT NULL, "subSystemType" varchar CHECK( "subSystemType" IN ('key','did_provider','did_resolver','oid4vp_op','oid4vci_client','siopv2_op','contact_manager','vc_issuer','vc_verifier','vc_persistence','transport','profile') ) NOT NULL, "actionType" varchar CHECK( "actionType" IN ('create','read','update','delete','execute') ) NOT NULL, "actionSubType" varchar NOT NULL, "initiatorType" varchar CHECK( "initiatorType" IN ('user','system','external') ) NOT NULL, "systemCorrelationIdType" varchar CHECK( "systemCorrelationIdType" IN ('did','email','hostname','phone','user') ), "systemCorrelationId" varchar, "systemAlias" varchar, "partyCorrelationType" varchar CHECK( "partyCorrelationType" IN ('did','email','hostname','phone') ), "partyCorrelationId" varchar, "partyAlias" varchar, "description" varchar NOT NULL, "data" varchar, "diagnosticData" varchar, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')))`,
8
+ `CREATE TABLE "AuditEvents" (
9
+ "id" varchar PRIMARY KEY NOT NULL,
10
+ "eventType" varchar CHECK( "eventType" IN ('audit','activity','general') ) NOT NULL,
11
+ "timestamp" datetime NOT NULL,
12
+ "level" varchar CHECK( "level" IN ('0','1','2','3','4') ) NOT NULL,
13
+ "correlationId" varchar NOT NULL,
14
+ "system" varchar CHECK( "system" IN ('general','kms','identity','oid4vci','oid4vp','siopv2','PE','credentials','web3','profile','contact') ) NOT NULL,
15
+ "subSystemType" varchar CHECK( "subSystemType" IN ('key','did_provider','did_resolver','oid4vp_op','oid4vci_client','siopv2_op','contact_manager','vc_issuer','vc_verifier','vc_persistence','transport','profile','api') ) NOT NULL,
16
+ "actionType" varchar CHECK( "actionType" IN ('create','read','update','delete','execute') ) NOT NULL,
17
+ "actionSubType" varchar NOT NULL,
18
+ "initiatorType" varchar CHECK( "initiatorType" IN ('user','system','external') ) NOT NULL,
19
+ "systemCorrelationIdType" varchar CHECK( "systemCorrelationIdType" IN ('did','url','email','hostname','phone','user') ),
20
+ "systemCorrelationId" varchar,
21
+ "systemAlias" varchar,
22
+ "partyCorrelationType" varchar CHECK( "partyCorrelationType" IN ('did','url','email','hostname','phone') ),
23
+ "partyCorrelationId" varchar,
24
+ "partyAlias" varchar,
25
+ "credentialType" varchar CHECK( "credentialType" IN ('JSON_LD','JWT','SD_JWT','MSO_MDOC') ),
26
+ "credentialHash" varchar,
27
+ "parentCredentialHash" varchar,
28
+ "originalCredential" varchar,
29
+ "sharePurpose" varchar,
30
+ "description" varchar NOT NULL,
31
+ "data" varchar,
32
+ "diagnosticData" varchar,
33
+ "created_at" datetime NOT NULL DEFAULT (datetime('now')),
34
+ "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')))`,
9
35
  )
10
36
  }
11
37
 
@@ -12,7 +12,7 @@ export class CreateDigitalCredential1708525189002 implements MigrationInterface
12
12
  "document_type" varchar CHECK( "document_type" IN ('VC', 'VP', 'C', 'P') ) NOT NULL,
13
13
  "regulation_type" varchar CHECK( "regulation_type" IN ('PID', 'QEAA', 'EAA', 'NON_REGULATED') ) NOT NULL DEFAULT 'NON_REGULATED',
14
14
  "document_format" varchar CHECK( "document_format" IN ('JSON_LD', 'JWT', 'SD_JWT', 'MSO_MDOC') ) NOT NULL,
15
- "credential_role" varchar CHECK( "credential_role" IN ('ISSUER', 'VERIFIER', 'HOLDER') ) NOT NULL,
15
+ "credential_role" varchar CHECK( "credential_role" IN ('ISSUER', 'VERIFIER', 'HOLDER', 'FEDERATION_TRUST_ANCHOR') ) NOT NULL,
16
16
  "raw_document" text NOT NULL,
17
17
  "uniform_document" text NOT NULL,
18
18
  "credential_id" text,
@@ -172,7 +172,7 @@ export class StatusListStore implements IStatusListStore {
172
172
  } else if (args.correlationId) {
173
173
  where.push({ correlationId: args.correlationId })
174
174
  }
175
- const result = await (await this.getStatusListRepo()).findOne({where})
175
+ const result = await (await this.getStatusListRepo()).findOne({ where })
176
176
  if (!result) {
177
177
  throw Error(`No status list found for id ${args.id}`)
178
178
  }