@sphereon/ssi-sdk.data-store 0.18.2-next.9 → 0.18.2-unstable.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/README.md +77 -77
- package/dist/contact/AbstractContactStore.d.ts +23 -23
- package/dist/contact/AbstractContactStore.js +6 -6
- package/dist/contact/ContactStore.d.ts +32 -32
- package/dist/contact/ContactStore.js +365 -365
- package/dist/entities/contact/BaseConfigEntity.d.ts +6 -6
- package/dist/entities/contact/BaseConfigEntity.js +33 -33
- package/dist/entities/contact/BaseContactEntity.d.ts +9 -9
- package/dist/entities/contact/BaseContactEntity.js +53 -53
- package/dist/entities/contact/ConnectionEntity.d.ts +10 -10
- package/dist/entities/contact/ConnectionEntity.js +46 -46
- package/dist/entities/contact/ContactEntity.d.ts +16 -0
- package/dist/entities/contact/ContactEntity.d.ts.map +1 -0
- package/dist/entities/contact/ContactEntity.js +164 -0
- package/dist/entities/contact/ContactEntity.js.map +1 -0
- package/dist/entities/contact/CorrelationIdentifierEntity.d.ts +10 -10
- package/dist/entities/contact/CorrelationIdentifierEntity.js +71 -71
- package/dist/entities/contact/DidAuthConfigEntity.d.ts +6 -6
- package/dist/entities/contact/DidAuthConfigEntity.js +32 -32
- package/dist/entities/contact/ElectronicAddressEntity.d.ts +13 -13
- package/dist/entities/contact/ElectronicAddressEntity.js +91 -91
- package/dist/entities/contact/IdentityEntity.d.ts +20 -20
- package/dist/entities/contact/IdentityEntity.js +128 -128
- package/dist/entities/contact/IdentityMetadataItemEntity.d.ts +9 -9
- package/dist/entities/contact/IdentityMetadataItemEntity.js +68 -68
- package/dist/entities/contact/NaturalPersonEntity.d.ts +8 -8
- package/dist/entities/contact/NaturalPersonEntity.js +71 -71
- package/dist/entities/contact/OpenIdConfigEntity.d.ts +10 -10
- package/dist/entities/contact/OpenIdConfigEntity.js +48 -48
- package/dist/entities/contact/OrganizationEntity.d.ts +8 -8
- package/dist/entities/contact/OrganizationEntity.js +66 -66
- package/dist/entities/contact/PartyEntity.d.ts +19 -19
- package/dist/entities/contact/PartyEntity.js +131 -131
- package/dist/entities/contact/PartyRelationshipEntity.d.ts +12 -12
- package/dist/entities/contact/PartyRelationshipEntity.js +94 -94
- package/dist/entities/contact/PartyTypeEntity.d.ts +14 -14
- package/dist/entities/contact/PartyTypeEntity.js +103 -103
- package/dist/entities/eventLogger/AuditEventEntity.d.ts +26 -26
- package/dist/entities/eventLogger/AuditEventEntity.js +123 -123
- package/dist/entities/eventLogger/AuditEventEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.d.ts +10 -10
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js +73 -73
- package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.d.ts +17 -17
- package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.js +119 -119
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.d.ts +14 -14
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.js +101 -101
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.d.ts +8 -8
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js +48 -48
- package/dist/entities/issuanceBranding/ImageAttributesEntity.d.ts +13 -13
- package/dist/entities/issuanceBranding/ImageAttributesEntity.js +91 -91
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.d.ts +8 -8
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.js +38 -38
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.d.ts +13 -13
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.js +94 -94
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.d.ts +8 -8
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js +48 -48
- package/dist/entities/issuanceBranding/TextAttributesEntity.d.ts +8 -8
- package/dist/entities/issuanceBranding/TextAttributesEntity.js +61 -61
- package/dist/entities/statusList2021/StatusList2021Entity.d.ts +18 -18
- package/dist/entities/statusList2021/StatusList2021Entity.js +114 -114
- package/dist/entities/statusList2021/StatusList2021EntryEntity.d.ts +10 -10
- package/dist/entities/statusList2021/StatusList2021EntryEntity.js +50 -50
- package/dist/entities/validators/index.d.ts +6 -6
- package/dist/entities/validators/index.js +26 -26
- package/dist/eventLogger/AbstractEventLoggerStore.d.ts +6 -6
- package/dist/eventLogger/AbstractEventLoggerStore.js +6 -6
- package/dist/eventLogger/EventLoggerStore.d.ts +12 -12
- package/dist/eventLogger/EventLoggerStore.js +43 -43
- package/dist/index.d.ts +41 -41
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +127 -131
- package/dist/index.js.map +1 -1
- package/dist/issuanceBranding/AbstractIssuanceBrandingStore.d.ts +19 -19
- package/dist/issuanceBranding/AbstractIssuanceBrandingStore.js +6 -6
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts +30 -30
- package/dist/issuanceBranding/IssuanceBrandingStore.js +374 -374
- package/dist/migrations/generic/1-CreateContacts.d.ts +6 -6
- package/dist/migrations/generic/1-CreateContacts.js +77 -77
- package/dist/migrations/generic/1-CreateIssuanceBranding.d.ts +7 -0
- package/dist/migrations/generic/1-CreateIssuanceBranding.d.ts.map +1 -0
- package/dist/migrations/generic/1-CreateIssuanceBranding.js +96 -0
- package/dist/migrations/generic/1-CreateIssuanceBranding.js.map +1 -0
- package/dist/migrations/generic/2-CreateContacts.d.ts +7 -0
- package/dist/migrations/generic/2-CreateContacts.d.ts.map +1 -0
- package/dist/migrations/generic/2-CreateContacts.js +78 -0
- package/dist/migrations/generic/2-CreateContacts.js.map +1 -0
- package/dist/migrations/generic/2-CreateIssuanceBranding.d.ts +6 -6
- package/dist/migrations/generic/2-CreateIssuanceBranding.js +77 -77
- package/dist/migrations/generic/3-CreateContacts.d.ts +6 -6
- package/dist/migrations/generic/3-CreateContacts.js +77 -77
- package/dist/migrations/generic/3-CreateStatusList.d.ts +7 -0
- package/dist/migrations/generic/3-CreateStatusList.d.ts.map +1 -0
- package/dist/migrations/generic/3-CreateStatusList.js +72 -0
- package/dist/migrations/generic/3-CreateStatusList.js.map +1 -0
- package/dist/migrations/generic/4-CreateStatusList.d.ts +6 -6
- package/dist/migrations/generic/4-CreateStatusList.js +71 -71
- package/dist/migrations/generic/5-CreateAuditEvents.d.ts +6 -6
- package/dist/migrations/generic/5-CreateAuditEvents.js +77 -77
- package/dist/migrations/generic/index.d.ts +16 -16
- package/dist/migrations/generic/index.js +27 -27
- package/dist/migrations/index.d.ts +1 -1
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +5 -9
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/internal-migrations-ormconfig.d.ts +6 -6
- package/dist/migrations/internal-migrations-ormconfig.js +26 -26
- package/dist/migrations/postgres/1659463079428-CreateContacts.d.ts +6 -6
- package/dist/migrations/postgres/1659463079428-CreateContacts.js +56 -56
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.d.ts +6 -6
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js +68 -68
- package/dist/migrations/postgres/1690925872592-CreateContacts.d.ts +6 -6
- package/dist/migrations/postgres/1690925872592-CreateContacts.js +68 -68
- package/dist/migrations/postgres/1693866470001-CreateStatusList.d.ts +6 -6
- package/dist/migrations/postgres/1693866470001-CreateStatusList.js +31 -31
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.d.ts +6 -6
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js +42 -42
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js.map +1 -1
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.d.ts +7 -0
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.d.ts.map +1 -0
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.js +32 -0
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.js.map +1 -0
- package/dist/migrations/postgres/uuid.d.ts +3 -0
- package/dist/migrations/postgres/uuid.d.ts.map +1 -0
- package/dist/migrations/postgres/uuid.js +25 -0
- package/dist/migrations/postgres/uuid.js.map +1 -0
- package/dist/migrations/sqlite/1659463069549-CreateContacts.d.ts +6 -6
- package/dist/migrations/sqlite/1659463069549-CreateContacts.js +78 -78
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.d.ts +6 -6
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js +88 -88
- package/dist/migrations/sqlite/1690925872693-CreateContacts.d.ts +6 -6
- package/dist/migrations/sqlite/1690925872693-CreateContacts.js +107 -107
- package/dist/migrations/sqlite/1693866470000-CreateStatusList.d.ts +6 -6
- package/dist/migrations/sqlite/1693866470000-CreateStatusList.js +31 -31
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.d.ts +6 -6
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js +28 -28
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js.map +1 -1
- package/dist/statusList/IStatusListStore.d.ts +19 -19
- package/dist/statusList/IStatusListStore.js +2 -2
- package/dist/statusList/StatusListStore.d.ts +35 -35
- package/dist/statusList/StatusListStore.js +212 -212
- package/dist/types/contact/IAbstractContactStore.d.ts +74 -74
- package/dist/types/contact/IAbstractContactStore.js +2 -2
- package/dist/types/contact/contact.d.ts +173 -173
- package/dist/types/contact/contact.js +25 -25
- package/dist/types/eventLogger/IAbstractEventLoggerStore.d.ts +9 -9
- package/dist/types/eventLogger/IAbstractEventLoggerStore.js +2 -2
- package/dist/types/eventLogger/eventLogger.d.ts +2 -2
- package/dist/types/eventLogger/eventLogger.js +2 -2
- package/dist/types/index.d.ts +9 -9
- package/dist/types/index.js +25 -25
- package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.d.ts +58 -58
- package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.js +2 -2
- package/dist/types/issuanceBranding/issuanceBranding.d.ts +114 -114
- package/dist/types/issuanceBranding/issuanceBranding.js +2 -2
- package/dist/types/statusList/IAbstractStatusListStore.d.ts +37 -37
- package/dist/types/statusList/IAbstractStatusListStore.js +2 -2
- package/dist/types/statusList/statusList.d.ts +24 -24
- package/dist/types/statusList/statusList.js +2 -2
- package/dist/types/validation/validation.d.ts +3 -3
- package/dist/types/validation/validation.js +2 -2
- package/dist/utils/ValidatorUtils.d.ts +3 -3
- package/dist/utils/ValidatorUtils.js +12 -12
- package/dist/utils/contact/MappingUtils.d.ts +46 -46
- package/dist/utils/contact/MappingUtils.js +290 -290
- package/package.json +4 -4
- package/src/__tests__/eventLogger.entities.test.ts +73 -73
- package/src/__tests__/eventLogger.store.test.ts +136 -136
- package/src/contact/ContactStore.ts +501 -501
- package/src/entities/eventLogger/AuditEventEntity.ts +99 -99
- package/src/entities/statusList2021/StatusList2021Entity.ts +96 -96
- package/src/eventLogger/AbstractEventLoggerStore.ts +7 -7
- package/src/eventLogger/EventLoggerStore.ts +62 -62
- package/src/index.ts +113 -119
- package/src/migrations/generic/1-CreateContacts.ts +66 -66
- package/src/migrations/generic/2-CreateIssuanceBranding.ts +64 -64
- package/src/migrations/generic/3-CreateContacts.ts +66 -66
- package/src/migrations/generic/4-CreateStatusList.ts +54 -54
- package/src/migrations/generic/5-CreateAuditEvents.ts +66 -66
- package/src/migrations/generic/index.ts +27 -27
- package/src/migrations/index.ts +1 -7
- package/src/migrations/postgres/1693866470001-CreateStatusList.ts +24 -24
- package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +33 -33
- package/src/migrations/sqlite/1690925872693-CreateContacts.ts +163 -163
- package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +15 -15
- package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -12
- package/src/types/eventLogger/eventLogger.ts +3 -3
- 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:
|
|
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
|
+
}
|