@sphereon/ssi-sdk.data-store 0.18.1 → 0.18.2-unstable.10

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 (180) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +77 -77
  3. package/dist/contact/AbstractContactStore.d.ts +23 -23
  4. package/dist/contact/AbstractContactStore.js +6 -6
  5. package/dist/contact/ContactStore.d.ts +32 -32
  6. package/dist/contact/ContactStore.js +365 -365
  7. package/dist/entities/contact/BaseConfigEntity.d.ts +6 -6
  8. package/dist/entities/contact/BaseConfigEntity.js +33 -33
  9. package/dist/entities/contact/BaseContactEntity.d.ts +9 -9
  10. package/dist/entities/contact/BaseContactEntity.js +53 -53
  11. package/dist/entities/contact/ConnectionEntity.d.ts +10 -10
  12. package/dist/entities/contact/ConnectionEntity.js +46 -46
  13. package/dist/entities/contact/ContactEntity.d.ts +16 -0
  14. package/dist/entities/contact/ContactEntity.d.ts.map +1 -0
  15. package/dist/entities/contact/ContactEntity.js +164 -0
  16. package/dist/entities/contact/ContactEntity.js.map +1 -0
  17. package/dist/entities/contact/CorrelationIdentifierEntity.d.ts +10 -10
  18. package/dist/entities/contact/CorrelationIdentifierEntity.js +71 -71
  19. package/dist/entities/contact/DidAuthConfigEntity.d.ts +6 -6
  20. package/dist/entities/contact/DidAuthConfigEntity.js +32 -32
  21. package/dist/entities/contact/ElectronicAddressEntity.d.ts +13 -13
  22. package/dist/entities/contact/ElectronicAddressEntity.js +91 -91
  23. package/dist/entities/contact/IdentityEntity.d.ts +20 -20
  24. package/dist/entities/contact/IdentityEntity.js +128 -128
  25. package/dist/entities/contact/IdentityMetadataItemEntity.d.ts +9 -9
  26. package/dist/entities/contact/IdentityMetadataItemEntity.js +68 -68
  27. package/dist/entities/contact/NaturalPersonEntity.d.ts +8 -8
  28. package/dist/entities/contact/NaturalPersonEntity.js +71 -71
  29. package/dist/entities/contact/OpenIdConfigEntity.d.ts +10 -10
  30. package/dist/entities/contact/OpenIdConfigEntity.js +48 -48
  31. package/dist/entities/contact/OrganizationEntity.d.ts +8 -8
  32. package/dist/entities/contact/OrganizationEntity.js +66 -66
  33. package/dist/entities/contact/PartyEntity.d.ts +19 -19
  34. package/dist/entities/contact/PartyEntity.js +131 -131
  35. package/dist/entities/contact/PartyRelationshipEntity.d.ts +12 -12
  36. package/dist/entities/contact/PartyRelationshipEntity.js +94 -94
  37. package/dist/entities/contact/PartyTypeEntity.d.ts +14 -14
  38. package/dist/entities/contact/PartyTypeEntity.js +103 -103
  39. package/dist/entities/eventLogger/AuditEventEntity.d.ts +26 -26
  40. package/dist/entities/eventLogger/AuditEventEntity.js +123 -123
  41. package/dist/entities/issuanceBranding/BackgroundAttributesEntity.d.ts +10 -10
  42. package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js +73 -73
  43. package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.d.ts +17 -17
  44. package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.js +119 -119
  45. package/dist/entities/issuanceBranding/CredentialBrandingEntity.d.ts +14 -14
  46. package/dist/entities/issuanceBranding/CredentialBrandingEntity.js +101 -101
  47. package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.d.ts +8 -8
  48. package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js +48 -48
  49. package/dist/entities/issuanceBranding/ImageAttributesEntity.d.ts +13 -13
  50. package/dist/entities/issuanceBranding/ImageAttributesEntity.js +91 -91
  51. package/dist/entities/issuanceBranding/ImageDimensionsEntity.d.ts +8 -8
  52. package/dist/entities/issuanceBranding/ImageDimensionsEntity.js +38 -38
  53. package/dist/entities/issuanceBranding/IssuerBrandingEntity.d.ts +13 -13
  54. package/dist/entities/issuanceBranding/IssuerBrandingEntity.js +94 -94
  55. package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.d.ts +8 -8
  56. package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js +48 -48
  57. package/dist/entities/issuanceBranding/TextAttributesEntity.d.ts +8 -8
  58. package/dist/entities/issuanceBranding/TextAttributesEntity.js +61 -61
  59. package/dist/entities/statusList2021/StatusList2021Entity.d.ts +18 -18
  60. package/dist/entities/statusList2021/StatusList2021Entity.js +114 -114
  61. package/dist/entities/statusList2021/StatusList2021EntryEntity.d.ts +10 -10
  62. package/dist/entities/statusList2021/StatusList2021EntryEntity.js +50 -50
  63. package/dist/entities/validators/index.d.ts +6 -6
  64. package/dist/entities/validators/index.js +26 -26
  65. package/dist/eventLogger/AbstractEventLoggerStore.d.ts +6 -6
  66. package/dist/eventLogger/AbstractEventLoggerStore.js +6 -6
  67. package/dist/eventLogger/EventLoggerStore.d.ts +12 -12
  68. package/dist/eventLogger/EventLoggerStore.js +43 -43
  69. package/dist/index.d.ts +41 -41
  70. package/dist/index.js +127 -127
  71. package/dist/issuanceBranding/AbstractIssuanceBrandingStore.d.ts +19 -19
  72. package/dist/issuanceBranding/AbstractIssuanceBrandingStore.js +6 -6
  73. package/dist/issuanceBranding/IssuanceBrandingStore.d.ts +30 -30
  74. package/dist/issuanceBranding/IssuanceBrandingStore.js +374 -374
  75. package/dist/migrations/generic/1-CreateContacts.d.ts +6 -6
  76. package/dist/migrations/generic/1-CreateContacts.js +77 -77
  77. package/dist/migrations/generic/1-CreateIssuanceBranding.d.ts +7 -0
  78. package/dist/migrations/generic/1-CreateIssuanceBranding.d.ts.map +1 -0
  79. package/dist/migrations/generic/1-CreateIssuanceBranding.js +96 -0
  80. package/dist/migrations/generic/1-CreateIssuanceBranding.js.map +1 -0
  81. package/dist/migrations/generic/2-CreateContacts.d.ts +7 -0
  82. package/dist/migrations/generic/2-CreateContacts.d.ts.map +1 -0
  83. package/dist/migrations/generic/2-CreateContacts.js +78 -0
  84. package/dist/migrations/generic/2-CreateContacts.js.map +1 -0
  85. package/dist/migrations/generic/2-CreateIssuanceBranding.d.ts +6 -6
  86. package/dist/migrations/generic/2-CreateIssuanceBranding.js +77 -77
  87. package/dist/migrations/generic/3-CreateContacts.d.ts +6 -6
  88. package/dist/migrations/generic/3-CreateContacts.js +77 -77
  89. package/dist/migrations/generic/3-CreateStatusList.d.ts +7 -0
  90. package/dist/migrations/generic/3-CreateStatusList.d.ts.map +1 -0
  91. package/dist/migrations/generic/3-CreateStatusList.js +72 -0
  92. package/dist/migrations/generic/3-CreateStatusList.js.map +1 -0
  93. package/dist/migrations/generic/4-CreateStatusList.d.ts +6 -6
  94. package/dist/migrations/generic/4-CreateStatusList.js +71 -71
  95. package/dist/migrations/generic/5-CreateAuditEvents.d.ts +6 -6
  96. package/dist/migrations/generic/5-CreateAuditEvents.js +77 -77
  97. package/dist/migrations/generic/index.d.ts +16 -16
  98. package/dist/migrations/generic/index.js +27 -27
  99. package/dist/migrations/index.d.ts +1 -1
  100. package/dist/migrations/index.js +5 -5
  101. package/dist/migrations/internal-migrations-ormconfig.d.ts +6 -6
  102. package/dist/migrations/internal-migrations-ormconfig.js +26 -26
  103. package/dist/migrations/postgres/1659463079428-CreateContacts.d.ts +6 -6
  104. package/dist/migrations/postgres/1659463079428-CreateContacts.js +56 -56
  105. package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.d.ts +6 -6
  106. package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js +68 -68
  107. package/dist/migrations/postgres/1690925872592-CreateContacts.d.ts +6 -6
  108. package/dist/migrations/postgres/1690925872592-CreateContacts.js +68 -68
  109. package/dist/migrations/postgres/1693866470001-CreateStatusList.d.ts +6 -6
  110. package/dist/migrations/postgres/1693866470001-CreateStatusList.js +31 -31
  111. package/dist/migrations/postgres/1701634812183-CreateAuditEvents.d.ts +6 -6
  112. package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js +42 -42
  113. package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.d.ts +7 -0
  114. package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.d.ts.map +1 -0
  115. package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.js +32 -0
  116. package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.js.map +1 -0
  117. package/dist/migrations/postgres/uuid.d.ts +3 -0
  118. package/dist/migrations/postgres/uuid.d.ts.map +1 -0
  119. package/dist/migrations/postgres/uuid.js +25 -0
  120. package/dist/migrations/postgres/uuid.js.map +1 -0
  121. package/dist/migrations/sqlite/1659463069549-CreateContacts.d.ts +6 -6
  122. package/dist/migrations/sqlite/1659463069549-CreateContacts.js +78 -78
  123. package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.d.ts +6 -6
  124. package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js +88 -88
  125. package/dist/migrations/sqlite/1690925872693-CreateContacts.d.ts +6 -6
  126. package/dist/migrations/sqlite/1690925872693-CreateContacts.js +107 -107
  127. package/dist/migrations/sqlite/1693866470000-CreateStatusList.d.ts +6 -6
  128. package/dist/migrations/sqlite/1693866470000-CreateStatusList.js +31 -31
  129. package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.d.ts +6 -6
  130. package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js +28 -28
  131. package/dist/statusList/IStatusListStore.d.ts +19 -19
  132. package/dist/statusList/IStatusListStore.js +2 -2
  133. package/dist/statusList/StatusListStore.d.ts +35 -35
  134. package/dist/statusList/StatusListStore.js +212 -212
  135. package/dist/types/contact/IAbstractContactStore.d.ts +74 -74
  136. package/dist/types/contact/IAbstractContactStore.js +2 -2
  137. package/dist/types/contact/contact.d.ts +173 -173
  138. package/dist/types/contact/contact.js +25 -25
  139. package/dist/types/eventLogger/IAbstractEventLoggerStore.d.ts +9 -9
  140. package/dist/types/eventLogger/IAbstractEventLoggerStore.js +2 -2
  141. package/dist/types/eventLogger/eventLogger.d.ts +2 -2
  142. package/dist/types/eventLogger/eventLogger.js +2 -2
  143. package/dist/types/index.d.ts +9 -9
  144. package/dist/types/index.js +25 -25
  145. package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.d.ts +58 -58
  146. package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.js +2 -2
  147. package/dist/types/issuanceBranding/issuanceBranding.d.ts +114 -114
  148. package/dist/types/issuanceBranding/issuanceBranding.js +2 -2
  149. package/dist/types/statusList/IAbstractStatusListStore.d.ts +37 -37
  150. package/dist/types/statusList/IAbstractStatusListStore.js +2 -2
  151. package/dist/types/statusList/statusList.d.ts +24 -24
  152. package/dist/types/statusList/statusList.js +2 -2
  153. package/dist/types/validation/validation.d.ts +3 -3
  154. package/dist/types/validation/validation.js +2 -2
  155. package/dist/utils/ValidatorUtils.d.ts +3 -3
  156. package/dist/utils/ValidatorUtils.js +12 -12
  157. package/dist/utils/contact/MappingUtils.d.ts +46 -46
  158. package/dist/utils/contact/MappingUtils.js +290 -290
  159. package/package.json +4 -4
  160. package/src/__tests__/eventLogger.entities.test.ts +73 -73
  161. package/src/__tests__/eventLogger.store.test.ts +136 -136
  162. package/src/contact/ContactStore.ts +501 -501
  163. package/src/entities/eventLogger/AuditEventEntity.ts +99 -99
  164. package/src/entities/statusList2021/StatusList2021Entity.ts +96 -96
  165. package/src/eventLogger/AbstractEventLoggerStore.ts +7 -7
  166. package/src/eventLogger/EventLoggerStore.ts +62 -62
  167. package/src/index.ts +113 -113
  168. package/src/migrations/generic/1-CreateContacts.ts +66 -66
  169. package/src/migrations/generic/2-CreateIssuanceBranding.ts +64 -64
  170. package/src/migrations/generic/3-CreateContacts.ts +66 -66
  171. package/src/migrations/generic/4-CreateStatusList.ts +54 -54
  172. package/src/migrations/generic/5-CreateAuditEvents.ts +66 -66
  173. package/src/migrations/generic/index.ts +27 -27
  174. package/src/migrations/postgres/1693866470001-CreateStatusList.ts +24 -24
  175. package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +33 -33
  176. package/src/migrations/sqlite/1690925872693-CreateContacts.ts +163 -163
  177. package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +15 -15
  178. package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -12
  179. package/src/types/eventLogger/eventLogger.ts +3 -3
  180. package/src/types/index.ts +9 -9
@@ -1,99 +1,99 @@
1
- import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
2
- import {
3
- ActionType,
4
- InitiatorType,
5
- LogLevel,
6
- PartyCorrelationType,
7
- SubSystem,
8
- System,
9
- SystemCorrelationIdType,
10
- ActionSubType,
11
- } from '@sphereon/ssi-sdk.core'
12
- import { NonPersistedAuditLoggingEvent } from '../../types'
13
-
14
- @Entity('AuditEvents')
15
- export class AuditEventEntity extends BaseEntity {
16
- @PrimaryGeneratedColumn('uuid')
17
- id!: string
18
-
19
- @Column({ name: 'timestamp', nullable: false, unique: false })
20
- timestamp!: Date
21
-
22
- @Column('simple-enum', { name: 'level', enum: LogLevel, nullable: false, unique: false })
23
- level!: LogLevel
24
-
25
- @Column({ name: 'correlationId', nullable: false, unique: false })
26
- correlationId!: string
27
-
28
- @Column('simple-enum', { name: 'system', enum: System, nullable: false, unique: false })
29
- system!: System
30
-
31
- @Column('simple-enum', { name: 'subSystemType', enum: SubSystem, nullable: false, unique: false })
32
- subSystemType!: SubSystem
33
-
34
- @Column('simple-enum', { name: 'actionType', enum: ActionType, nullable: false, unique: false })
35
- actionType!: ActionType
36
-
37
- @Column({ name: 'actionSubType', nullable: false, unique: false })
38
- actionSubType!: ActionSubType
39
-
40
- @Column('simple-enum', { name: 'initiatorType', enum: InitiatorType, nullable: false, unique: false })
41
- initiatorType!: InitiatorType
42
-
43
- @Column('simple-enum', { name: 'systemCorrelationIdType', enum: SystemCorrelationIdType, nullable: true, unique: false })
44
- systemCorrelationIdType?: SystemCorrelationIdType
45
-
46
- @Column({ name: 'systemCorrelationId', nullable: true, unique: false })
47
- systemCorrelationId?: string
48
-
49
- @Column({ name: 'systemAlias', nullable: false, unique: false })
50
- systemAlias?: string
51
-
52
- @Column('simple-enum', { name: 'partyCorrelationType', enum: PartyCorrelationType, nullable: true, unique: false })
53
- partyCorrelationType?: PartyCorrelationType
54
-
55
- @Column({ name: 'partyCorrelationId', nullable: true, unique: false })
56
- partyCorrelationId?: string
57
-
58
- @Column({ name: 'partyAlias', nullable: true, unique: false })
59
- partyAlias?: string
60
-
61
- @Column({ name: 'description', nullable: false, unique: false })
62
- description!: string
63
-
64
- @Column({ name: 'data', nullable: true, unique: false })
65
- data?: string
66
-
67
- @Column({ name: 'diagnosticData', nullable: true, unique: false })
68
- diagnosticData?: string
69
-
70
- @CreateDateColumn({ name: 'created_at', nullable: false })
71
- createdAt!: Date
72
-
73
- @UpdateDateColumn({ name: 'last_updated_at', nullable: false })
74
- lastUpdatedAt!: Date
75
- }
76
-
77
- export const auditEventEntityFrom = (args: NonPersistedAuditLoggingEvent): AuditEventEntity => {
78
- const auditEventEntity: AuditEventEntity = new AuditEventEntity()
79
- auditEventEntity.timestamp = args.timestamp
80
- auditEventEntity.level = args.level
81
- auditEventEntity.correlationId = args.correlationId
82
- auditEventEntity.system = args.system
83
- auditEventEntity.subSystemType = args.subSystemType
84
- auditEventEntity.actionType = args.actionType
85
- auditEventEntity.actionSubType = args.actionSubType
86
- auditEventEntity.initiatorType = args.initiatorType
87
- auditEventEntity.systemCorrelationIdType = args.systemCorrelationIdType
88
- auditEventEntity.systemCorrelationId = args.systemCorrelationId
89
- auditEventEntity.systemAlias = args.systemAlias
90
- auditEventEntity.partyCorrelationType = args.partyCorrelationType
91
- auditEventEntity.partyCorrelationId = args.partyCorrelationId
92
- auditEventEntity.partyAlias = args.partyAlias
93
- auditEventEntity.description = args.description
94
- auditEventEntity.partyCorrelationType = args.partyCorrelationType
95
- auditEventEntity.data = JSON.stringify(args.data)
96
- auditEventEntity.diagnosticData = JSON.stringify(args.diagnosticData)
97
-
98
- return auditEventEntity
99
- }
1
+ import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
2
+ import {
3
+ ActionType,
4
+ InitiatorType,
5
+ LogLevel,
6
+ PartyCorrelationType,
7
+ SubSystem,
8
+ System,
9
+ SystemCorrelationIdType,
10
+ ActionSubType,
11
+ } from '@sphereon/ssi-sdk.core'
12
+ import { NonPersistedAuditLoggingEvent } from '../../types'
13
+
14
+ @Entity('AuditEvents')
15
+ export class AuditEventEntity extends BaseEntity {
16
+ @PrimaryGeneratedColumn('uuid')
17
+ id!: string
18
+
19
+ @Column({ name: 'timestamp', nullable: false, unique: false })
20
+ timestamp!: Date
21
+
22
+ @Column('simple-enum', { name: 'level', enum: LogLevel, nullable: false, unique: false })
23
+ level!: LogLevel
24
+
25
+ @Column({ name: 'correlationId', nullable: false, unique: false })
26
+ correlationId!: string
27
+
28
+ @Column('simple-enum', { name: 'system', enum: System, nullable: false, unique: false })
29
+ system!: System
30
+
31
+ @Column('simple-enum', { name: 'subSystemType', enum: SubSystem, nullable: false, unique: false })
32
+ subSystemType!: SubSystem
33
+
34
+ @Column('simple-enum', { name: 'actionType', enum: ActionType, nullable: false, unique: false })
35
+ actionType!: ActionType
36
+
37
+ @Column({ name: 'actionSubType', nullable: false, unique: false })
38
+ actionSubType!: ActionSubType
39
+
40
+ @Column('simple-enum', { name: 'initiatorType', enum: InitiatorType, nullable: false, unique: false })
41
+ initiatorType!: InitiatorType
42
+
43
+ @Column('simple-enum', { name: 'systemCorrelationIdType', enum: SystemCorrelationIdType, nullable: true, unique: false })
44
+ systemCorrelationIdType?: SystemCorrelationIdType
45
+
46
+ @Column({ name: 'systemCorrelationId', nullable: true, unique: false })
47
+ systemCorrelationId?: string
48
+
49
+ @Column({ name: 'systemAlias', nullable: false, unique: false })
50
+ systemAlias?: string
51
+
52
+ @Column('simple-enum', { name: 'partyCorrelationType', enum: PartyCorrelationType, nullable: true, unique: false })
53
+ partyCorrelationType?: PartyCorrelationType
54
+
55
+ @Column({ name: 'partyCorrelationId', nullable: true, unique: false })
56
+ partyCorrelationId?: string
57
+
58
+ @Column({ name: 'partyAlias', nullable: true, unique: false })
59
+ partyAlias?: string
60
+
61
+ @Column({ name: 'description', nullable: false, unique: false })
62
+ description!: string
63
+
64
+ @Column({ name: 'data', nullable: true, unique: false })
65
+ data?: string
66
+
67
+ @Column({ name: 'diagnosticData', nullable: true, unique: false })
68
+ diagnosticData?: string
69
+
70
+ @CreateDateColumn({ name: 'created_at', nullable: false })
71
+ createdAt!: Date
72
+
73
+ @UpdateDateColumn({ name: 'last_updated_at', nullable: false })
74
+ lastUpdatedAt!: Date
75
+ }
76
+
77
+ export const auditEventEntityFrom = (args: NonPersistedAuditLoggingEvent): AuditEventEntity => {
78
+ const auditEventEntity: AuditEventEntity = new AuditEventEntity()
79
+ auditEventEntity.timestamp = args.timestamp
80
+ auditEventEntity.level = args.level
81
+ auditEventEntity.correlationId = args.correlationId
82
+ auditEventEntity.system = args.system
83
+ auditEventEntity.subSystemType = args.subSystemType
84
+ auditEventEntity.actionType = args.actionType
85
+ auditEventEntity.actionSubType = args.actionSubType
86
+ auditEventEntity.initiatorType = args.initiatorType
87
+ auditEventEntity.systemCorrelationIdType = args.systemCorrelationIdType
88
+ auditEventEntity.systemCorrelationId = args.systemCorrelationId
89
+ auditEventEntity.systemAlias = args.systemAlias
90
+ auditEventEntity.partyCorrelationType = args.partyCorrelationType
91
+ auditEventEntity.partyCorrelationId = args.partyCorrelationId
92
+ auditEventEntity.partyAlias = args.partyAlias
93
+ auditEventEntity.description = args.description
94
+ auditEventEntity.partyCorrelationType = args.partyCorrelationType
95
+ auditEventEntity.data = JSON.stringify(args.data)
96
+ auditEventEntity.diagnosticData = JSON.stringify(args.diagnosticData)
97
+
98
+ return auditEventEntity
99
+ }
@@ -1,96 +1,96 @@
1
- import {
2
- IIssuer,
3
- JwtDecodedVerifiableCredential,
4
- StatusListCredentialIdMode,
5
- StatusListDriverType,
6
- StatusListIndexingDirection,
7
- StatusListType,
8
- StatusPurpose2021,
9
- W3CVerifiableCredential,
10
- } from '@sphereon/ssi-types'
11
- import { ProofFormat } from '@veramo/core'
12
- import { BaseEntity, Column, Entity, OneToMany, PrimaryColumn, Unique } from 'typeorm'
13
- import { StatusListEntryEntity } from './StatusList2021EntryEntity'
14
-
15
- @Entity('StatusList')
16
- @Unique('UQ_correlationId', ['correlationId'])
17
- export class StatusListEntity extends BaseEntity {
18
- @PrimaryColumn({ name: 'id', type: 'varchar' })
19
- id!: string
20
-
21
- @Column({ name: 'correlationId', type: 'varchar', nullable: false })
22
- correlationId!: string
23
-
24
- @Column({ name: 'length', nullable: false, unique: false })
25
- length!: number
26
-
27
- @Column({
28
- name: 'issuer',
29
- type: 'text',
30
- nullable: false,
31
- unique: false,
32
- transformer: {
33
- from(value: string): string | IIssuer {
34
- if (value?.trim()?.startsWith('{')) {
35
- return JSON.parse(value)
36
- }
37
- return value
38
- },
39
- to(value: string | IIssuer): string {
40
- if (typeof value === 'string') {
41
- return value
42
- }
43
- return JSON.stringify(value)
44
- },
45
- },
46
- })
47
- issuer!: string | IIssuer
48
-
49
- @Column('simple-enum', { name: 'type', enum: StatusListType, nullable: false, default: StatusListType.StatusList2021 })
50
- type!: StatusListType
51
-
52
- @Column('simple-enum', { name: 'driverType', enum: StatusListDriverType, nullable: false, default: StatusListDriverType.AGENT_TYPEORM })
53
- driverType!: StatusListDriverType
54
-
55
- @Column('simple-enum', {
56
- name: 'credentialIdMode',
57
- enum: StatusListCredentialIdMode,
58
- nullable: false,
59
- default: StatusListCredentialIdMode.ISSUANCE,
60
- })
61
- credentialIdMode!: StatusListCredentialIdMode
62
-
63
- @Column({ type: 'varchar', name: 'proofFormat', enum: ['lds', 'jwt'], nullable: false, default: 'lds' })
64
- proofFormat!: ProofFormat
65
-
66
- @Column({ type: 'varchar', name: 'indexingDirection', enum: ['rightToLeft'], nullable: false, default: 'rightToLeft' })
67
- indexingDirection!: StatusListIndexingDirection
68
-
69
- @Column({ type: 'varchar', name: 'statusPurpose', nullable: false, default: 'revocation' })
70
- statusPurpose!: StatusPurpose2021
71
-
72
- @Column({
73
- name: 'statusListCredential',
74
- type: 'text',
75
- nullable: true,
76
- unique: false,
77
- transformer: {
78
- from(value: string): W3CVerifiableCredential | JwtDecodedVerifiableCredential {
79
- if (value?.startsWith('ey')) {
80
- return value
81
- }
82
- return JSON.parse(value)
83
- },
84
- to(value: W3CVerifiableCredential | JwtDecodedVerifiableCredential): string {
85
- if (typeof value === 'string') {
86
- return value
87
- }
88
- return JSON.stringify(value)
89
- },
90
- },
91
- })
92
- statusListCredential?: W3CVerifiableCredential | JwtDecodedVerifiableCredential
93
-
94
- @OneToMany((type) => StatusListEntryEntity, (entry) => entry.statusList)
95
- statusListEntries!: StatusListEntryEntity[]
96
- }
1
+ import {
2
+ IIssuer,
3
+ JwtDecodedVerifiableCredential,
4
+ StatusListCredentialIdMode,
5
+ StatusListDriverType,
6
+ StatusListIndexingDirection,
7
+ StatusListType,
8
+ StatusPurpose2021,
9
+ W3CVerifiableCredential,
10
+ } from '@sphereon/ssi-types'
11
+ import { ProofFormat } from '@veramo/core'
12
+ import { BaseEntity, Column, Entity, OneToMany, PrimaryColumn, Unique } from 'typeorm'
13
+ import { StatusListEntryEntity } from './StatusList2021EntryEntity'
14
+
15
+ @Entity('StatusList')
16
+ @Unique('UQ_correlationId', ['correlationId'])
17
+ export class StatusListEntity extends BaseEntity {
18
+ @PrimaryColumn({ name: 'id', type: 'varchar' })
19
+ id!: string
20
+
21
+ @Column({ name: 'correlationId', type: 'varchar', nullable: false })
22
+ correlationId!: string
23
+
24
+ @Column({ name: 'length', nullable: false, unique: false })
25
+ length!: number
26
+
27
+ @Column({
28
+ name: 'issuer',
29
+ type: 'text',
30
+ nullable: false,
31
+ unique: false,
32
+ transformer: {
33
+ from(value: string): string | IIssuer {
34
+ if (value?.trim()?.startsWith('{')) {
35
+ return JSON.parse(value)
36
+ }
37
+ return value
38
+ },
39
+ to(value: string | IIssuer): string {
40
+ if (typeof value === 'string') {
41
+ return value
42
+ }
43
+ return JSON.stringify(value)
44
+ },
45
+ },
46
+ })
47
+ issuer!: string | IIssuer
48
+
49
+ @Column('simple-enum', { name: 'type', enum: StatusListType, nullable: false, default: StatusListType.StatusList2021 })
50
+ type!: StatusListType
51
+
52
+ @Column('simple-enum', { name: 'driverType', enum: StatusListDriverType, nullable: false, default: StatusListDriverType.AGENT_TYPEORM })
53
+ driverType!: StatusListDriverType
54
+
55
+ @Column('simple-enum', {
56
+ name: 'credentialIdMode',
57
+ enum: StatusListCredentialIdMode,
58
+ nullable: false,
59
+ default: StatusListCredentialIdMode.ISSUANCE,
60
+ })
61
+ credentialIdMode!: StatusListCredentialIdMode
62
+
63
+ @Column({ type: 'varchar', name: 'proofFormat', enum: ['lds', 'jwt'], nullable: false, default: 'lds' })
64
+ proofFormat!: ProofFormat
65
+
66
+ @Column({ type: 'varchar', name: 'indexingDirection', enum: ['rightToLeft'], nullable: false, default: 'rightToLeft' })
67
+ indexingDirection!: StatusListIndexingDirection
68
+
69
+ @Column({ type: 'varchar', name: 'statusPurpose', nullable: false, default: 'revocation' })
70
+ statusPurpose!: StatusPurpose2021
71
+
72
+ @Column({
73
+ name: 'statusListCredential',
74
+ type: 'text',
75
+ nullable: true,
76
+ unique: false,
77
+ transformer: {
78
+ from(value: string): W3CVerifiableCredential | JwtDecodedVerifiableCredential {
79
+ if (value?.startsWith('ey')) {
80
+ return value
81
+ }
82
+ return JSON.parse(value)
83
+ },
84
+ to(value: W3CVerifiableCredential | JwtDecodedVerifiableCredential): string {
85
+ if (typeof value === 'string') {
86
+ return value
87
+ }
88
+ return JSON.stringify(value)
89
+ },
90
+ },
91
+ })
92
+ statusListCredential?: W3CVerifiableCredential | JwtDecodedVerifiableCredential
93
+
94
+ @OneToMany((type) => StatusListEntryEntity, (entry) => entry.statusList)
95
+ statusListEntries!: StatusListEntryEntity[]
96
+ }
@@ -1,7 +1,7 @@
1
- import { GetAuditEventsArgs, StoreAuditEventArgs } from '../types'
2
- import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
3
-
4
- export abstract class AbstractEventLoggerStore {
5
- abstract getAuditEvents(args: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>>
6
- abstract storeAuditEvent(args: StoreAuditEventArgs): Promise<AuditLoggingEvent>
7
- }
1
+ import { GetAuditEventsArgs, StoreAuditEventArgs } from '../types'
2
+ import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
3
+
4
+ export abstract class AbstractEventLoggerStore {
5
+ abstract getAuditEvents(args: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>>
6
+ abstract storeAuditEvent(args: StoreAuditEventArgs): Promise<AuditLoggingEvent>
7
+ }
@@ -1,62 +1,62 @@
1
- import Debug, { Debugger } from 'debug'
2
- import { DataSource } from 'typeorm'
3
- import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
4
- import { OrPromise } from '@sphereon/ssi-types'
5
- import { AbstractEventLoggerStore } from './AbstractEventLoggerStore'
6
- import { AuditEventEntity, auditEventEntityFrom } from '../entities/eventLogger/AuditEventEntity'
7
- import { GetAuditEventsArgs, StoreAuditEventArgs } from '../types'
8
-
9
- const debug: Debugger = Debug('sphereon:ssi-sdk:event-store')
10
-
11
- export class EventLoggerStore extends AbstractEventLoggerStore {
12
- private readonly dbConnection: OrPromise<DataSource>
13
-
14
- constructor(dbConnection: OrPromise<DataSource>) {
15
- super()
16
- this.dbConnection = dbConnection
17
- }
18
-
19
- getAuditEvents = async (args?: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>> => {
20
- const connection: DataSource = await this.dbConnection // TODO apply everywhere
21
- debug('Getting audit events', args)
22
- const result: Array<AuditEventEntity> = await connection.getRepository(AuditEventEntity).find({
23
- ...(args?.filter && { where: args?.filter }),
24
- })
25
-
26
- return result.map((event: AuditEventEntity) => this.auditEventFrom(event))
27
- }
28
-
29
- storeAuditEvent = async (args: StoreAuditEventArgs): Promise<AuditLoggingEvent> => {
30
- const { event } = args
31
-
32
- const auditEventEntity: AuditEventEntity = auditEventEntityFrom(event)
33
- const connection: DataSource = await this.dbConnection
34
- debug('Storing audit event', auditEventEntity)
35
- const createdResult: AuditEventEntity = await connection.getRepository(AuditEventEntity).save(auditEventEntity)
36
-
37
- return this.auditEventFrom(createdResult)
38
- }
39
-
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) }),
60
- }
61
- }
62
- }
1
+ import Debug, { Debugger } from 'debug'
2
+ import { DataSource } from 'typeorm'
3
+ import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
4
+ import { OrPromise } from '@sphereon/ssi-types'
5
+ import { AbstractEventLoggerStore } from './AbstractEventLoggerStore'
6
+ import { AuditEventEntity, auditEventEntityFrom } from '../entities/eventLogger/AuditEventEntity'
7
+ import { GetAuditEventsArgs, StoreAuditEventArgs } from '../types'
8
+
9
+ const debug: Debugger = Debug('sphereon:ssi-sdk:event-store')
10
+
11
+ export class EventLoggerStore extends AbstractEventLoggerStore {
12
+ private readonly dbConnection: OrPromise<DataSource>
13
+
14
+ constructor(dbConnection: OrPromise<DataSource>) {
15
+ super()
16
+ this.dbConnection = dbConnection
17
+ }
18
+
19
+ getAuditEvents = async (args?: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>> => {
20
+ const connection: DataSource = await this.dbConnection // TODO apply everywhere
21
+ debug('Getting audit events', args)
22
+ const result: Array<AuditEventEntity> = await connection.getRepository(AuditEventEntity).find({
23
+ ...(args?.filter && { where: args?.filter }),
24
+ })
25
+
26
+ return result.map((event: AuditEventEntity) => this.auditEventFrom(event))
27
+ }
28
+
29
+ storeAuditEvent = async (args: StoreAuditEventArgs): Promise<AuditLoggingEvent> => {
30
+ const { event } = args
31
+
32
+ const auditEventEntity: AuditEventEntity = auditEventEntityFrom(event)
33
+ const connection: DataSource = await this.dbConnection
34
+ debug('Storing audit event', auditEventEntity)
35
+ const createdResult: AuditEventEntity = await connection.getRepository(AuditEventEntity).save(auditEventEntity)
36
+
37
+ return this.auditEventFrom(createdResult)
38
+ }
39
+
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) }),
60
+ }
61
+ }
62
+ }