@sphereon/ssi-sdk.data-store 0.23.5-unstable.88 → 0.24.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 (146) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +77 -77
  3. package/dist/index.d.ts +3 -9
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +2 -15
  6. package/dist/index.js.map +1 -1
  7. package/dist/migrations/generic/index.d.ts +0 -2
  8. package/dist/migrations/generic/index.d.ts.map +1 -1
  9. package/dist/migrations/generic/index.js +1 -4
  10. package/dist/migrations/generic/index.js.map +1 -1
  11. package/dist/migrations/index.d.ts +1 -1
  12. package/dist/migrations/index.d.ts.map +1 -1
  13. package/dist/migrations/index.js +1 -2
  14. package/dist/migrations/index.js.map +1 -1
  15. package/dist/migrations/postgres/1690925872592-CreateContacts.js +1 -1
  16. package/dist/migrations/postgres/1690925872592-CreateContacts.js.map +1 -1
  17. package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js +22 -22
  18. package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.js +16 -16
  19. package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js +21 -21
  20. package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.js +15 -15
  21. package/dist/types/index.d.ts +0 -2
  22. package/dist/types/index.d.ts.map +1 -1
  23. package/dist/types/index.js +0 -2
  24. package/dist/types/index.js.map +1 -1
  25. package/package.json +4 -5
  26. package/src/__tests__/contact.entities.test.ts +2542 -2542
  27. package/src/__tests__/contact.store.test.ts +2471 -2471
  28. package/src/__tests__/digitalCredential.entities.test.ts +254 -254
  29. package/src/__tests__/digitalCredential.store.test.ts +294 -294
  30. package/src/__tests__/eventLogger.entities.test.ts +73 -73
  31. package/src/__tests__/eventLogger.store.test.ts +136 -136
  32. package/src/__tests__/issuanceBranding.entities.test.ts +844 -844
  33. package/src/__tests__/issuanceBranding.store.test.ts +1884 -1884
  34. package/src/__tests__/machineState.entities.test.ts +51 -51
  35. package/src/__tests__/machineState.store.test.ts +174 -174
  36. package/src/contact/AbstractContactStore.ts +71 -71
  37. package/src/contact/ContactStore.ts +723 -723
  38. package/src/digitalCredential/AbstractDigitalCredentialStore.ts +17 -17
  39. package/src/digitalCredential/DigitalCredentialStore.ts +127 -127
  40. package/src/entities/contact/BaseContactEntity.ts +39 -39
  41. package/src/entities/contact/ConnectionEntity.ts +29 -29
  42. package/src/entities/contact/CorrelationIdentifierEntity.ts +37 -37
  43. package/src/entities/contact/DidAuthConfigEntity.ts +14 -14
  44. package/src/entities/contact/ElectronicAddressEntity.ts +63 -63
  45. package/src/entities/contact/IdentityEntity.ts +97 -97
  46. package/src/entities/contact/IdentityMetadataItemEntity.ts +35 -35
  47. package/src/entities/contact/NaturalPersonEntity.ts +38 -38
  48. package/src/entities/contact/OpenIdConfigEntity.ts +26 -26
  49. package/src/entities/contact/OrganizationEntity.ts +34 -34
  50. package/src/entities/contact/PartyEntity.ts +110 -110
  51. package/src/entities/contact/PartyRelationshipEntity.ts +61 -61
  52. package/src/entities/contact/PartyTypeEntity.ts +62 -62
  53. package/src/entities/contact/PhysicalAddressEntity.ts +87 -87
  54. package/src/entities/digitalCredential/DigitalCredentialEntity.ts +64 -64
  55. package/src/entities/eventLogger/AuditEventEntity.ts +99 -99
  56. package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +78 -78
  57. package/src/entities/issuanceBranding/ImageAttributesEntity.ts +57 -57
  58. package/src/entities/issuanceBranding/IssuerBrandingEntity.ts +72 -72
  59. package/src/entities/machineState/MachineStateInfoEntity.ts +58 -58
  60. package/src/entities/statusList2021/StatusList2021Entity.ts +96 -96
  61. package/src/eventLogger/AbstractEventLoggerStore.ts +7 -7
  62. package/src/eventLogger/EventLoggerStore.ts +62 -62
  63. package/src/index.ts +141 -154
  64. package/src/issuanceBranding/IssuanceBrandingStore.ts +559 -559
  65. package/src/machineState/IAbstractMachineStateStore.ts +65 -65
  66. package/src/machineState/MachineStateStore.ts +149 -149
  67. package/src/migrations/generic/1-CreateContacts.ts +66 -66
  68. package/src/migrations/generic/2-CreateIssuanceBranding.ts +64 -64
  69. package/src/migrations/generic/3-CreateContacts.ts +66 -66
  70. package/src/migrations/generic/4-CreateStatusList.ts +54 -54
  71. package/src/migrations/generic/5-CreateAuditEvents.ts +66 -66
  72. package/src/migrations/generic/6-CreateDigitalCredential.ts +66 -66
  73. package/src/migrations/generic/7-CreateMachineStateStore.ts +66 -66
  74. package/src/migrations/generic/index.ts +33 -36
  75. package/src/migrations/index.ts +9 -10
  76. package/src/migrations/postgres/1659463079428-CreateContacts.ts +63 -63
  77. package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +85 -85
  78. package/src/migrations/postgres/1690925872592-CreateContacts.ts +104 -104
  79. package/src/migrations/postgres/1693866470001-CreateStatusList.ts +24 -24
  80. package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +33 -33
  81. package/src/migrations/postgres/1708525189001-CreateDigitalCredential.ts +44 -44
  82. package/src/migrations/postgres/1708797018115-CreateMachineStateStore.ts +29 -29
  83. package/src/migrations/sqlite/1659463069549-CreateContacts.ts +110 -110
  84. package/src/migrations/sqlite/1685628973231-CreateIssuanceBranding.ts +119 -119
  85. package/src/migrations/sqlite/1690925872693-CreateContacts.ts +161 -161
  86. package/src/migrations/sqlite/1693866470000-CreateStatusList.ts +24 -24
  87. package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +15 -15
  88. package/src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts +34 -34
  89. package/src/migrations/sqlite/1708796002272-CreateMachineStateStore.ts +28 -28
  90. package/src/statusList/StatusListStore.ts +237 -237
  91. package/src/types/contact/IAbstractContactStore.ts +161 -161
  92. package/src/types/contact/contact.ts +237 -237
  93. package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +37 -37
  94. package/src/types/digitalCredential/digitalCredential.ts +46 -46
  95. package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -12
  96. package/src/types/eventLogger/eventLogger.ts +3 -3
  97. package/src/types/index.ts +10 -12
  98. package/src/types/machineState/IAbstractMachineStateStore.ts +68 -68
  99. package/src/utils/SortingUtils.ts +16 -16
  100. package/src/utils/contact/MappingUtils.ts +385 -385
  101. package/src/utils/digitalCredential/MappingUtils.ts +122 -122
  102. package/dist/entities/presentationDefinitions/PresentationDefinitionItemEntity.d.ts +0 -13
  103. package/dist/entities/presentationDefinitions/PresentationDefinitionItemEntity.d.ts.map +0 -1
  104. package/dist/entities/presentationDefinitions/PresentationDefinitionItemEntity.js +0 -71
  105. package/dist/entities/presentationDefinitions/PresentationDefinitionItemEntity.js.map +0 -1
  106. package/dist/migrations/generic/8-CreatePresentationDefinitions.d.ts +0 -7
  107. package/dist/migrations/generic/8-CreatePresentationDefinitions.d.ts.map +0 -1
  108. package/dist/migrations/generic/8-CreatePresentationDefinitions.js +0 -78
  109. package/dist/migrations/generic/8-CreatePresentationDefinitions.js.map +0 -1
  110. package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.d.ts +0 -7
  111. package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.d.ts.map +0 -1
  112. package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.js +0 -40
  113. package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.js.map +0 -1
  114. package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.d.ts +0 -7
  115. package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.d.ts.map +0 -1
  116. package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.js +0 -37
  117. package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.js.map +0 -1
  118. package/dist/pd/AbstractPDStore.d.ts +0 -10
  119. package/dist/pd/AbstractPDStore.d.ts.map +0 -1
  120. package/dist/pd/AbstractPDStore.js +0 -7
  121. package/dist/pd/AbstractPDStore.js.map +0 -1
  122. package/dist/pd/PDStore.d.ts +0 -14
  123. package/dist/pd/PDStore.d.ts.map +0 -1
  124. package/dist/pd/PDStore.js +0 -90
  125. package/dist/pd/PDStore.js.map +0 -1
  126. package/dist/types/pd/IAbstractPDStore.d.ts +0 -14
  127. package/dist/types/pd/IAbstractPDStore.d.ts.map +0 -1
  128. package/dist/types/pd/IAbstractPDStore.js +0 -3
  129. package/dist/types/pd/IAbstractPDStore.js.map +0 -1
  130. package/dist/types/pd/pd.d.ts +0 -15
  131. package/dist/types/pd/pd.d.ts.map +0 -1
  132. package/dist/types/pd/pd.js +0 -3
  133. package/dist/types/pd/pd.js.map +0 -1
  134. package/dist/utils/presentationDefinitions/MappingUtils.d.ts +0 -6
  135. package/dist/utils/presentationDefinitions/MappingUtils.d.ts.map +0 -1
  136. package/dist/utils/presentationDefinitions/MappingUtils.js +0 -50
  137. package/dist/utils/presentationDefinitions/MappingUtils.js.map +0 -1
  138. package/src/entities/presentationDefinitions/PresentationDefinitionItemEntity.ts +0 -41
  139. package/src/migrations/generic/8-CreatePresentationDefinitions.ts +0 -66
  140. package/src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts +0 -24
  141. package/src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts +0 -23
  142. package/src/pd/AbstractPDStore.ts +0 -10
  143. package/src/pd/PDStore.ts +0 -103
  144. package/src/types/pd/IAbstractPDStore.ts +0 -19
  145. package/src/types/pd/pd.ts +0 -16
  146. package/src/utils/presentationDefinitions/MappingUtils.ts +0 -54
@@ -1,64 +1,64 @@
1
- import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
2
- import {
3
- CredentialCorrelationType,
4
- CredentialDocumentFormat,
5
- CredentialStateType,
6
- DocumentType,
7
- } from '../../types/digitalCredential/digitalCredential'
8
-
9
- @Entity('DigitalCredential')
10
- export class DigitalCredentialEntity extends BaseEntity {
11
- @PrimaryGeneratedColumn('uuid')
12
- id!: string
13
-
14
- @Column('simple-enum', { name: 'document_type', enum: DocumentType, nullable: false })
15
- documentType!: DocumentType
16
-
17
- @Column('simple-enum', { name: 'document_format', enum: CredentialDocumentFormat, nullable: false })
18
- documentFormat!: CredentialDocumentFormat
19
-
20
- @Column('text', { name: 'raw_document', nullable: false })
21
- rawDocument!: string
22
-
23
- @Column('text', { name: 'uniform_document', nullable: false })
24
- uniformDocument!: string
25
-
26
- @Column('text', { name: 'hash', nullable: false, unique: true })
27
- hash!: string
28
-
29
- @Column('simple-enum', { name: 'issuer_correlation_type', enum: CredentialCorrelationType, nullable: false })
30
- issuerCorrelationType!: CredentialCorrelationType
31
-
32
- @Column('simple-enum', { name: 'subject_correlation_type', enum: CredentialCorrelationType, nullable: true })
33
- subjectCorrelationType?: CredentialCorrelationType
34
-
35
- @Column('text', { name: 'issuer_correlation_id', nullable: false })
36
- issuerCorrelationId!: string
37
-
38
- @Column('text', { name: 'subject_correlation_id', nullable: true })
39
- subjectCorrelationId?: string
40
-
41
- @Column('simple-enum', { name: 'verified_state', enum: CredentialStateType, nullable: true })
42
- verifiedState?: CredentialStateType
43
-
44
- @Column('text', { name: 'tenant_id', nullable: true })
45
- tenantId?: string
46
-
47
- @CreateDateColumn({ name: 'created_at', nullable: false })
48
- createdAt!: Date
49
-
50
- @UpdateDateColumn({ name: 'last_updated_at', nullable: false })
51
- lastUpdatedAt!: Date
52
-
53
- @Column('date', { name: 'valid_until', nullable: true })
54
- validUntil?: Date
55
-
56
- @Column('date', { name: 'valid_from', nullable: true })
57
- validFrom?: Date
58
-
59
- @Column('date', { name: 'verified_at', nullable: true })
60
- verifiedAt?: Date
61
-
62
- @Column('date', { name: 'revoked_at', nullable: true })
63
- revokedAt?: Date
64
- }
1
+ import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
2
+ import {
3
+ CredentialCorrelationType,
4
+ CredentialDocumentFormat,
5
+ CredentialStateType,
6
+ DocumentType,
7
+ } from '../../types/digitalCredential/digitalCredential'
8
+
9
+ @Entity('DigitalCredential')
10
+ export class DigitalCredentialEntity extends BaseEntity {
11
+ @PrimaryGeneratedColumn('uuid')
12
+ id!: string
13
+
14
+ @Column('simple-enum', { name: 'document_type', enum: DocumentType, nullable: false })
15
+ documentType!: DocumentType
16
+
17
+ @Column('simple-enum', { name: 'document_format', enum: CredentialDocumentFormat, nullable: false })
18
+ documentFormat!: CredentialDocumentFormat
19
+
20
+ @Column('text', { name: 'raw_document', nullable: false })
21
+ rawDocument!: string
22
+
23
+ @Column('text', { name: 'uniform_document', nullable: false })
24
+ uniformDocument!: string
25
+
26
+ @Column('text', { name: 'hash', nullable: false, unique: true })
27
+ hash!: string
28
+
29
+ @Column('simple-enum', { name: 'issuer_correlation_type', enum: CredentialCorrelationType, nullable: false })
30
+ issuerCorrelationType!: CredentialCorrelationType
31
+
32
+ @Column('simple-enum', { name: 'subject_correlation_type', enum: CredentialCorrelationType, nullable: true })
33
+ subjectCorrelationType?: CredentialCorrelationType
34
+
35
+ @Column('text', { name: 'issuer_correlation_id', nullable: false })
36
+ issuerCorrelationId!: string
37
+
38
+ @Column('text', { name: 'subject_correlation_id', nullable: true })
39
+ subjectCorrelationId?: string
40
+
41
+ @Column('simple-enum', { name: 'verified_state', enum: CredentialStateType, nullable: true })
42
+ verifiedState?: CredentialStateType
43
+
44
+ @Column('text', { name: 'tenant_id', nullable: true })
45
+ tenantId?: string
46
+
47
+ @CreateDateColumn({ name: 'created_at', nullable: false })
48
+ createdAt!: Date
49
+
50
+ @UpdateDateColumn({ name: 'last_updated_at', nullable: false })
51
+ lastUpdatedAt!: Date
52
+
53
+ @Column('date', { name: 'valid_until', nullable: true })
54
+ validUntil?: Date
55
+
56
+ @Column('date', { name: 'valid_from', nullable: true })
57
+ validFrom?: Date
58
+
59
+ @Column('date', { name: 'verified_at', nullable: true })
60
+ verifiedAt?: Date
61
+
62
+ @Column('date', { name: 'revoked_at', nullable: true })
63
+ revokedAt?: Date
64
+ }
@@ -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: true, 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: true, 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,78 +1,78 @@
1
- import {
2
- BaseEntity,
3
- BeforeInsert,
4
- BeforeUpdate,
5
- Column,
6
- CreateDateColumn,
7
- Entity,
8
- Index,
9
- OneToMany,
10
- PrimaryGeneratedColumn,
11
- UpdateDateColumn,
12
- } from 'typeorm'
13
- import { ArrayMinSize, IsNotEmpty, validate, ValidationError } from 'class-validator'
14
- import { CredentialLocaleBrandingEntity, credentialLocaleBrandingEntityFrom } from './CredentialLocaleBrandingEntity'
15
- import { IBasicCredentialBranding, IBasicCredentialLocaleBranding } from '../../types'
16
-
17
- @Entity('CredentialBranding')
18
- @Index('IDX_CredentialBrandingEntity_vcHash', ['vcHash'])
19
- @Index('IDX_CredentialBrandingEntity_issuerCorrelationId', ['issuerCorrelationId'])
20
- export class CredentialBrandingEntity extends BaseEntity {
21
- @PrimaryGeneratedColumn('uuid')
22
- id!: string
23
-
24
- @Column({ name: 'vcHash', length: 255, nullable: false, unique: true })
25
- @IsNotEmpty({ message: 'Blank vcHashes are not allowed' })
26
- vcHash!: string
27
-
28
- @Column({ name: 'issuerCorrelationId', length: 255, nullable: false, unique: false })
29
- @IsNotEmpty({ message: 'Blank issuerCorrelationIds are not allowed' })
30
- issuerCorrelationId!: string
31
-
32
- @OneToMany(
33
- () => CredentialLocaleBrandingEntity,
34
- (credentialLocaleBrandingEntity: CredentialLocaleBrandingEntity) => credentialLocaleBrandingEntity.credentialBranding,
35
- {
36
- cascade: true,
37
- onDelete: 'CASCADE',
38
- eager: true,
39
- nullable: false,
40
- },
41
- )
42
- @ArrayMinSize(1, { message: 'localeBranding cannot be empty' })
43
- localeBranding!: Array<CredentialLocaleBrandingEntity>
44
-
45
- @CreateDateColumn({ name: 'created_at', nullable: false })
46
- createdAt!: Date
47
-
48
- @UpdateDateColumn({ name: 'last_updated_at', nullable: false })
49
- lastUpdatedAt!: Date
50
-
51
- // By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
52
- @BeforeInsert()
53
- @BeforeUpdate()
54
- updateUpdatedDate(): void {
55
- this.lastUpdatedAt = new Date()
56
- }
57
-
58
- @BeforeInsert()
59
- @BeforeUpdate()
60
- async validate(): Promise<undefined> {
61
- const validation: Array<ValidationError> = await validate(this)
62
- if (validation.length > 0) {
63
- return Promise.reject(Error(Object.values(validation[0].constraints!)[0]))
64
- }
65
- return
66
- }
67
- }
68
-
69
- export const credentialBrandingEntityFrom = (args: IBasicCredentialBranding): CredentialBrandingEntity => {
70
- const credentialBrandingEntity: CredentialBrandingEntity = new CredentialBrandingEntity()
71
- credentialBrandingEntity.issuerCorrelationId = args.issuerCorrelationId
72
- credentialBrandingEntity.vcHash = args.vcHash
73
- credentialBrandingEntity.localeBranding = args.localeBranding.map((localeBranding: IBasicCredentialLocaleBranding) =>
74
- credentialLocaleBrandingEntityFrom(localeBranding),
75
- )
76
-
77
- return credentialBrandingEntity
78
- }
1
+ import {
2
+ BaseEntity,
3
+ BeforeInsert,
4
+ BeforeUpdate,
5
+ Column,
6
+ CreateDateColumn,
7
+ Entity,
8
+ Index,
9
+ OneToMany,
10
+ PrimaryGeneratedColumn,
11
+ UpdateDateColumn,
12
+ } from 'typeorm'
13
+ import { ArrayMinSize, IsNotEmpty, validate, ValidationError } from 'class-validator'
14
+ import { CredentialLocaleBrandingEntity, credentialLocaleBrandingEntityFrom } from './CredentialLocaleBrandingEntity'
15
+ import { IBasicCredentialBranding, IBasicCredentialLocaleBranding } from '../../types'
16
+
17
+ @Entity('CredentialBranding')
18
+ @Index('IDX_CredentialBrandingEntity_vcHash', ['vcHash'])
19
+ @Index('IDX_CredentialBrandingEntity_issuerCorrelationId', ['issuerCorrelationId'])
20
+ export class CredentialBrandingEntity extends BaseEntity {
21
+ @PrimaryGeneratedColumn('uuid')
22
+ id!: string
23
+
24
+ @Column({ name: 'vcHash', length: 255, nullable: false, unique: true })
25
+ @IsNotEmpty({ message: 'Blank vcHashes are not allowed' })
26
+ vcHash!: string
27
+
28
+ @Column({ name: 'issuerCorrelationId', length: 255, nullable: false, unique: false })
29
+ @IsNotEmpty({ message: 'Blank issuerCorrelationIds are not allowed' })
30
+ issuerCorrelationId!: string
31
+
32
+ @OneToMany(
33
+ () => CredentialLocaleBrandingEntity,
34
+ (credentialLocaleBrandingEntity: CredentialLocaleBrandingEntity) => credentialLocaleBrandingEntity.credentialBranding,
35
+ {
36
+ cascade: true,
37
+ onDelete: 'CASCADE',
38
+ eager: true,
39
+ nullable: false,
40
+ },
41
+ )
42
+ @ArrayMinSize(1, { message: 'localeBranding cannot be empty' })
43
+ localeBranding!: Array<CredentialLocaleBrandingEntity>
44
+
45
+ @CreateDateColumn({ name: 'created_at', nullable: false })
46
+ createdAt!: Date
47
+
48
+ @UpdateDateColumn({ name: 'last_updated_at', nullable: false })
49
+ lastUpdatedAt!: Date
50
+
51
+ // By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
52
+ @BeforeInsert()
53
+ @BeforeUpdate()
54
+ updateUpdatedDate(): void {
55
+ this.lastUpdatedAt = new Date()
56
+ }
57
+
58
+ @BeforeInsert()
59
+ @BeforeUpdate()
60
+ async validate(): Promise<undefined> {
61
+ const validation: Array<ValidationError> = await validate(this)
62
+ if (validation.length > 0) {
63
+ return Promise.reject(Error(Object.values(validation[0].constraints!)[0]))
64
+ }
65
+ return
66
+ }
67
+ }
68
+
69
+ export const credentialBrandingEntityFrom = (args: IBasicCredentialBranding): CredentialBrandingEntity => {
70
+ const credentialBrandingEntity: CredentialBrandingEntity = new CredentialBrandingEntity()
71
+ credentialBrandingEntity.issuerCorrelationId = args.issuerCorrelationId
72
+ credentialBrandingEntity.vcHash = args.vcHash
73
+ credentialBrandingEntity.localeBranding = args.localeBranding.map((localeBranding: IBasicCredentialLocaleBranding) =>
74
+ credentialLocaleBrandingEntityFrom(localeBranding),
75
+ )
76
+
77
+ return credentialBrandingEntity
78
+ }
@@ -1,57 +1,57 @@
1
- import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm'
2
- import { IBasicImageAttributes } from '../../types'
3
- import { ImageDimensionsEntity, imageDimensionsEntityFrom } from './ImageDimensionsEntity'
4
- import { validate, Validate, ValidationError } from 'class-validator'
5
- import { isEmptyString, IsNonEmptyStringConstraint } from '../validators'
6
-
7
- @Entity('ImageAttributes')
8
- export class ImageAttributesEntity extends BaseEntity {
9
- @PrimaryGeneratedColumn('uuid')
10
- id!: string
11
-
12
- @Column({ name: 'uri', nullable: true, unique: false })
13
- @Validate(IsNonEmptyStringConstraint, { message: 'Blank image uri are not allowed' })
14
- uri?: string
15
-
16
- @Column({ name: 'dataUri', nullable: true, unique: false })
17
- @Validate(IsNonEmptyStringConstraint, { message: 'Blank image data uri are not allowed' })
18
- dataUri?: string
19
-
20
- @Column({ name: 'mediaType', length: 255, nullable: true, unique: false })
21
- @Validate(IsNonEmptyStringConstraint, { message: 'Blank image types are not allowed' })
22
- mediaType?: string
23
-
24
- @Column({ name: 'alt', length: 255, nullable: true, unique: false })
25
- @Validate(IsNonEmptyStringConstraint, { message: 'Blank image alts are not allowed' })
26
- alt?: string
27
-
28
- @OneToOne(() => ImageDimensionsEntity, {
29
- cascade: true,
30
- onDelete: 'CASCADE',
31
- eager: true,
32
- nullable: true,
33
- })
34
- @JoinColumn({ name: 'dimensionsId' })
35
- dimensions?: ImageDimensionsEntity
36
-
37
- @BeforeInsert()
38
- @BeforeUpdate()
39
- async validate(): Promise<undefined> {
40
- const validation: Array<ValidationError> = await validate(this)
41
- if (validation.length > 0) {
42
- return Promise.reject(Error(Object.values(validation[0].constraints!)[0]))
43
- }
44
- return
45
- }
46
- }
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
+ import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm'
2
+ import { IBasicImageAttributes } from '../../types'
3
+ import { ImageDimensionsEntity, imageDimensionsEntityFrom } from './ImageDimensionsEntity'
4
+ import { validate, Validate, ValidationError } from 'class-validator'
5
+ import { isEmptyString, IsNonEmptyStringConstraint } from '../validators'
6
+
7
+ @Entity('ImageAttributes')
8
+ export class ImageAttributesEntity extends BaseEntity {
9
+ @PrimaryGeneratedColumn('uuid')
10
+ id!: string
11
+
12
+ @Column({ name: 'uri', nullable: true, unique: false })
13
+ @Validate(IsNonEmptyStringConstraint, { message: 'Blank image uri are not allowed' })
14
+ uri?: string
15
+
16
+ @Column({ name: 'dataUri', nullable: true, unique: false })
17
+ @Validate(IsNonEmptyStringConstraint, { message: 'Blank image data uri are not allowed' })
18
+ dataUri?: string
19
+
20
+ @Column({ name: 'mediaType', length: 255, nullable: true, unique: false })
21
+ @Validate(IsNonEmptyStringConstraint, { message: 'Blank image types are not allowed' })
22
+ mediaType?: string
23
+
24
+ @Column({ name: 'alt', length: 255, nullable: true, unique: false })
25
+ @Validate(IsNonEmptyStringConstraint, { message: 'Blank image alts are not allowed' })
26
+ alt?: string
27
+
28
+ @OneToOne(() => ImageDimensionsEntity, {
29
+ cascade: true,
30
+ onDelete: 'CASCADE',
31
+ eager: true,
32
+ nullable: true,
33
+ })
34
+ @JoinColumn({ name: 'dimensionsId' })
35
+ dimensions?: ImageDimensionsEntity
36
+
37
+ @BeforeInsert()
38
+ @BeforeUpdate()
39
+ async validate(): Promise<undefined> {
40
+ const validation: Array<ValidationError> = await validate(this)
41
+ if (validation.length > 0) {
42
+ return Promise.reject(Error(Object.values(validation[0].constraints!)[0]))
43
+ }
44
+ return
45
+ }
46
+ }
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
+ }