@sphereon/ssi-sdk.data-store 0.18.2-unstable.8 → 0.18.2-unstable.85
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 +33 -23
- package/dist/contact/AbstractContactStore.d.ts.map +1 -1
- package/dist/contact/AbstractContactStore.js +6 -6
- package/dist/contact/AbstractContactStore.js.map +1 -1
- package/dist/contact/ContactStore.d.ts +44 -32
- package/dist/contact/ContactStore.d.ts.map +1 -1
- package/dist/contact/ContactStore.js +528 -365
- package/dist/contact/ContactStore.js.map +1 -1
- package/dist/digitalCredential/AbstractDigitalCredentialStore.d.ts +10 -0
- package/dist/digitalCredential/AbstractDigitalCredentialStore.d.ts.map +1 -0
- package/dist/digitalCredential/AbstractDigitalCredentialStore.js +7 -0
- package/dist/digitalCredential/AbstractDigitalCredentialStore.js.map +1 -0
- package/dist/digitalCredential/DigitalCredentialStore.d.ts +15 -0
- package/dist/digitalCredential/DigitalCredentialStore.d.ts.map +1 -0
- package/dist/digitalCredential/DigitalCredentialStore.js +97 -0
- package/dist/digitalCredential/DigitalCredentialStore.js.map +1 -0
- 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/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 +14 -13
- package/dist/entities/contact/ElectronicAddressEntity.d.ts.map +1 -1
- package/dist/entities/contact/ElectronicAddressEntity.js +95 -91
- package/dist/entities/contact/ElectronicAddressEntity.js.map +1 -1
- package/dist/entities/contact/IdentityEntity.d.ts +20 -20
- package/dist/entities/contact/IdentityEntity.d.ts.map +1 -1
- 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 +21 -19
- package/dist/entities/contact/PartyEntity.d.ts.map +1 -1
- package/dist/entities/contact/PartyEntity.js +142 -131
- package/dist/entities/contact/PartyEntity.js.map +1 -1
- 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/contact/PhysicalAddressEntity.d.ts +21 -0
- package/dist/entities/contact/PhysicalAddressEntity.d.ts.map +1 -0
- package/dist/entities/contact/PhysicalAddressEntity.js +126 -0
- package/dist/entities/contact/PhysicalAddressEntity.js.map +1 -0
- package/dist/entities/digitalCredential/DigitalCredentialEntity.d.ts +23 -0
- package/dist/entities/digitalCredential/DigitalCredentialEntity.d.ts.map +1 -0
- package/dist/entities/digitalCredential/DigitalCredentialEntity.js +93 -0
- package/dist/entities/digitalCredential/DigitalCredentialEntity.js.map +1 -0
- 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 +45 -41
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +143 -127
- 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.d.ts.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.js +390 -374
- package/dist/issuanceBranding/IssuanceBrandingStore.js.map +1 -1
- package/dist/migrations/generic/1-CreateContacts.d.ts +6 -6
- package/dist/migrations/generic/1-CreateContacts.js +77 -77
- 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/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/{2-CreateContacts.d.ts → 6-CreateDigitalCredential.d.ts} +2 -2
- package/dist/migrations/generic/6-CreateDigitalCredential.d.ts.map +1 -0
- package/dist/migrations/generic/{2-CreateContacts.js → 6-CreateDigitalCredential.js} +23 -23
- package/dist/migrations/generic/6-CreateDigitalCredential.js.map +1 -0
- package/dist/migrations/generic/index.d.ts +18 -16
- package/dist/migrations/generic/index.d.ts.map +1 -1
- package/dist/migrations/generic/index.js +30 -27
- package/dist/migrations/generic/index.js.map +1 -1
- package/dist/migrations/index.d.ts +1 -1
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +10 -5
- 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/{generic/3-CreateStatusList.d.ts → postgres/1708525189001-CreateDigitalCredential.d.ts} +2 -2
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.d.ts.map +1 -0
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js +59 -0
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.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.d.ts.map +1 -1
- package/dist/migrations/sqlite/1690925872693-CreateContacts.js +104 -107
- package/dist/migrations/sqlite/1690925872693-CreateContacts.js.map +1 -1
- 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/migrations/{postgres/CreateStatusList1693866470001-CreateStatusList.d.ts → sqlite/1708525189002-CreateDigitalCredential.d.ts} +2 -2
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.d.ts.map +1 -0
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js +50 -0
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js.map +1 -0
- 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 +109 -74
- package/dist/types/contact/IAbstractContactStore.d.ts.map +1 -1
- package/dist/types/contact/IAbstractContactStore.js +2 -2
- package/dist/types/contact/contact.d.ts +196 -173
- package/dist/types/contact/contact.d.ts.map +1 -1
- package/dist/types/contact/contact.js +25 -25
- package/dist/types/contact/contact.js.map +1 -1
- package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.d.ts +27 -0
- package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.d.ts.map +1 -0
- package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.js +3 -0
- package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.js.map +1 -0
- package/dist/types/digitalCredential/digitalCredential.d.ts +41 -0
- package/dist/types/digitalCredential/digitalCredential.d.ts.map +1 -0
- package/dist/types/digitalCredential/digitalCredential.js +28 -0
- package/dist/types/digitalCredential/digitalCredential.js.map +1 -0
- 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 +49 -46
- package/dist/utils/contact/MappingUtils.d.ts.map +1 -1
- package/dist/utils/contact/MappingUtils.js +326 -290
- package/dist/utils/contact/MappingUtils.js.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.d.ts +9 -0
- package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -0
- package/dist/utils/digitalCredential/MappingUtils.js +92 -0
- package/dist/utils/digitalCredential/MappingUtils.js.map +1 -0
- package/package.json +5 -4
- package/src/__tests__/contact.entities.test.ts +323 -23
- package/src/__tests__/contact.store.test.ts +586 -10
- package/src/__tests__/digitalCredential.entities.test.ts +247 -0
- package/src/__tests__/digitalCredential.store.test.ts +194 -0
- package/src/__tests__/eventLogger.entities.test.ts +73 -73
- package/src/__tests__/eventLogger.store.test.ts +136 -136
- package/src/contact/AbstractContactStore.ts +38 -17
- package/src/contact/ContactStore.ts +715 -501
- package/src/digitalCredential/AbstractDigitalCredentialStore.ts +16 -0
- package/src/digitalCredential/DigitalCredentialStore.ts +107 -0
- package/src/entities/contact/ElectronicAddressEntity.ts +3 -0
- package/src/entities/contact/IdentityEntity.ts +1 -1
- package/src/entities/contact/PartyEntity.ts +11 -1
- package/src/entities/contact/PhysicalAddressEntity.ts +87 -0
- package/src/entities/digitalCredential/DigitalCredentialEntity.ts +64 -0
- 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 +131 -113
- package/src/issuanceBranding/IssuanceBrandingStore.ts +78 -62
- 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/6-CreateDigitalCredential.ts +66 -0
- package/src/migrations/generic/index.ts +30 -27
- package/src/migrations/index.ts +8 -1
- package/src/migrations/postgres/1693866470001-CreateStatusList.ts +24 -24
- package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +33 -33
- package/src/migrations/postgres/1708525189001-CreateDigitalCredential.ts +44 -0
- package/src/migrations/sqlite/1690925872693-CreateContacts.ts +158 -163
- package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +15 -15
- package/src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts +34 -0
- package/src/types/contact/IAbstractContactStore.ts +58 -8
- package/src/types/contact/contact.ts +29 -4
- package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +26 -0
- package/src/types/digitalCredential/digitalCredential.ts +45 -0
- package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -12
- package/src/types/eventLogger/eventLogger.ts +3 -3
- package/src/types/index.ts +9 -9
- package/src/utils/contact/MappingUtils.ts +39 -1
- package/src/utils/digitalCredential/MappingUtils.ts +112 -0
- package/dist/entities/contact/ContactEntity.d.ts +0 -16
- package/dist/entities/contact/ContactEntity.d.ts.map +0 -1
- package/dist/entities/contact/ContactEntity.js +0 -164
- package/dist/entities/contact/ContactEntity.js.map +0 -1
- package/dist/migrations/generic/1-CreateIssuanceBranding.d.ts +0 -7
- package/dist/migrations/generic/1-CreateIssuanceBranding.d.ts.map +0 -1
- package/dist/migrations/generic/1-CreateIssuanceBranding.js +0 -96
- package/dist/migrations/generic/1-CreateIssuanceBranding.js.map +0 -1
- package/dist/migrations/generic/2-CreateContacts.d.ts.map +0 -1
- package/dist/migrations/generic/2-CreateContacts.js.map +0 -1
- package/dist/migrations/generic/3-CreateStatusList.d.ts.map +0 -1
- package/dist/migrations/generic/3-CreateStatusList.js +0 -72
- package/dist/migrations/generic/3-CreateStatusList.js.map +0 -1
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.d.ts.map +0 -1
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.js +0 -32
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.js.map +0 -1
- package/dist/migrations/postgres/uuid.d.ts +0 -3
- package/dist/migrations/postgres/uuid.d.ts.map +0 -1
- package/dist/migrations/postgres/uuid.js +0 -25
- package/dist/migrations/postgres/uuid.js.map +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AddDigitalCredentialArgs,
|
|
3
|
+
GetDigitalCredentialArgs,
|
|
4
|
+
GetDigitalCredentialsArgs,
|
|
5
|
+
RemoveDigitalCredentialArgs,
|
|
6
|
+
UpdateDigitalCredentialStateArgs,
|
|
7
|
+
} from '../types/digitalCredential/IAbstractDigitalCredentialStore'
|
|
8
|
+
import { DigitalCredentialEntity } from '../entities/digitalCredential/DigitalCredentialEntity'
|
|
9
|
+
|
|
10
|
+
export abstract class AbstractDigitalCredentialStore {
|
|
11
|
+
abstract getDigitalCredential(args: GetDigitalCredentialArgs): Promise<DigitalCredentialEntity>
|
|
12
|
+
abstract getDigitalCredentials(args?: GetDigitalCredentialsArgs): Promise<Array<DigitalCredentialEntity>>
|
|
13
|
+
abstract addDigitalCredential(args: AddDigitalCredentialArgs): Promise<DigitalCredentialEntity>
|
|
14
|
+
abstract updateDigitalCredentialState(args: UpdateDigitalCredentialStateArgs): Promise<DigitalCredentialEntity>
|
|
15
|
+
abstract removeDigitalCredential(args: RemoveDigitalCredentialArgs): Promise<boolean>
|
|
16
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { AbstractDigitalCredentialStore } from './AbstractDigitalCredentialStore'
|
|
2
|
+
import {
|
|
3
|
+
AddDigitalCredentialArgs,
|
|
4
|
+
GetDigitalCredentialArgs,
|
|
5
|
+
GetDigitalCredentialsArgs,
|
|
6
|
+
RemoveDigitalCredentialArgs,
|
|
7
|
+
UpdateDigitalCredentialStateArgs,
|
|
8
|
+
} from '../types/digitalCredential/IAbstractDigitalCredentialStore'
|
|
9
|
+
import { OrPromise } from '@sphereon/ssi-types'
|
|
10
|
+
import { DataSource, Repository } from 'typeorm'
|
|
11
|
+
import Debug from 'debug'
|
|
12
|
+
import { DigitalCredentialEntity } from '../entities/digitalCredential/DigitalCredentialEntity'
|
|
13
|
+
import { nonPersistedDigitalCredentialEntityFromAddArgs } from '../utils/digitalCredential/MappingUtils'
|
|
14
|
+
import { FindOptionsWhere } from 'typeorm/find-options/FindOptionsWhere'
|
|
15
|
+
import { CredentialStateType, DigitalCredential, NonPersistedDigitalCredential } from '../types/digitalCredential/digitalCredential'
|
|
16
|
+
|
|
17
|
+
const debug: Debug.Debugger = Debug('sphereon:ssi-sdk:credential-store')
|
|
18
|
+
|
|
19
|
+
export class DigitalCredentialStore extends AbstractDigitalCredentialStore {
|
|
20
|
+
private readonly dbConnection: OrPromise<DataSource>
|
|
21
|
+
|
|
22
|
+
constructor(dbConnection: OrPromise<DataSource>) {
|
|
23
|
+
super()
|
|
24
|
+
this.dbConnection = dbConnection
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
addDigitalCredential = async (args: AddDigitalCredentialArgs): Promise<DigitalCredentialEntity> => {
|
|
28
|
+
debug('Adding credential', args)
|
|
29
|
+
const digitalCredentialEntityRepository: Repository<DigitalCredentialEntity> = (await this.dbConnection).getRepository(DigitalCredentialEntity)
|
|
30
|
+
const credentialEntity: NonPersistedDigitalCredential = nonPersistedDigitalCredentialEntityFromAddArgs(args)
|
|
31
|
+
const createdResult: DigitalCredentialEntity = await digitalCredentialEntityRepository.save(credentialEntity)
|
|
32
|
+
return Promise.resolve(createdResult)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getDigitalCredential = async (args: GetDigitalCredentialArgs): Promise<DigitalCredentialEntity> => {
|
|
36
|
+
const result: DigitalCredentialEntity | null = await (await this.dbConnection).getRepository(DigitalCredentialEntity).findOne({
|
|
37
|
+
where: args,
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
if (!result) {
|
|
41
|
+
return Promise.reject(Error(`No credential found for arg: ${args.toString()}`))
|
|
42
|
+
}
|
|
43
|
+
return result
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
getDigitalCredentials = async (args?: GetDigitalCredentialsArgs): Promise<Array<DigitalCredentialEntity>> => {
|
|
47
|
+
const result: Array<DigitalCredentialEntity> = await (await this.dbConnection).getRepository(DigitalCredentialEntity).find({
|
|
48
|
+
...(args?.filter && { where: args?.filter }),
|
|
49
|
+
})
|
|
50
|
+
if (!result) {
|
|
51
|
+
return Promise.reject(Error(`No credential found for arg: ${args?.toString()}`))
|
|
52
|
+
}
|
|
53
|
+
return result
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
removeDigitalCredential = async (args: RemoveDigitalCredentialArgs): Promise<boolean> => {
|
|
57
|
+
if (!args) {
|
|
58
|
+
return false
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let query: FindOptionsWhere<DigitalCredentialEntity> = {}
|
|
62
|
+
|
|
63
|
+
if ('id' in args) {
|
|
64
|
+
query.id = args.id
|
|
65
|
+
} else if ('hash' in args) {
|
|
66
|
+
query.hash = args.hash
|
|
67
|
+
} else {
|
|
68
|
+
return false
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
const connection = await this.dbConnection
|
|
72
|
+
const result = await connection.getRepository(DigitalCredentialEntity).delete(query)
|
|
73
|
+
return result.affected === 1
|
|
74
|
+
} catch (error) {
|
|
75
|
+
console.error('Error removing digital credential:', error)
|
|
76
|
+
return false
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
updateDigitalCredentialState = async (args: UpdateDigitalCredentialStateArgs): Promise<DigitalCredentialEntity> => {
|
|
81
|
+
const credentialRepository: Repository<DigitalCredentialEntity> = (await this.dbConnection).getRepository(DigitalCredentialEntity)
|
|
82
|
+
const whereClause: Record<string, any> = {}
|
|
83
|
+
if ('id' in args) {
|
|
84
|
+
whereClause.id = args.id
|
|
85
|
+
}
|
|
86
|
+
if ('hash' in args) {
|
|
87
|
+
whereClause.hash = args.hash
|
|
88
|
+
}
|
|
89
|
+
const credential: DigitalCredentialEntity | null = await credentialRepository.findOne({
|
|
90
|
+
where: whereClause,
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
if (!credential) {
|
|
94
|
+
return Promise.reject(Error(`No credential found for args: ${whereClause}`))
|
|
95
|
+
}
|
|
96
|
+
const updatedCredential: DigitalCredential = {
|
|
97
|
+
...credential,
|
|
98
|
+
verificationDate: args.verificationDate ?? new Date(),
|
|
99
|
+
lastUpdatedAt: new Date(),
|
|
100
|
+
...(args.verifiedState === CredentialStateType.REVOKED && { revocationDate: args.verificationDate ?? new Date() }),
|
|
101
|
+
verifiedState: args.verifiedState,
|
|
102
|
+
}
|
|
103
|
+
debug('Updating credential', credential)
|
|
104
|
+
const updatedResult: DigitalCredentialEntity = await credentialRepository.save(updatedCredential, { transaction: true })
|
|
105
|
+
return updatedResult
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -73,7 +73,7 @@ export class IdentityEntity extends BaseEntity {
|
|
|
73
73
|
party!: PartyEntity
|
|
74
74
|
|
|
75
75
|
@Column({ name: 'partyId', nullable: true })
|
|
76
|
-
partyId
|
|
76
|
+
partyId?: string
|
|
77
77
|
|
|
78
78
|
// By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
|
|
79
79
|
@BeforeInsert()
|
|
@@ -20,13 +20,14 @@ import { BaseContactEntity } from './BaseContactEntity'
|
|
|
20
20
|
import { PartyRelationshipEntity } from './PartyRelationshipEntity'
|
|
21
21
|
import { getConstraint } from '../../utils/ValidatorUtils'
|
|
22
22
|
import { ElectronicAddressEntity } from './ElectronicAddressEntity'
|
|
23
|
+
import { PhysicalAddressEntity } from './PhysicalAddressEntity'
|
|
23
24
|
|
|
24
25
|
@Entity('Party')
|
|
25
26
|
export class PartyEntity extends BaseEntity {
|
|
26
27
|
@PrimaryGeneratedColumn('uuid')
|
|
27
28
|
id!: string
|
|
28
29
|
|
|
29
|
-
@Column({ name: 'uri', length: 255 })
|
|
30
|
+
@Column({ name: 'uri', length: 255, nullable: true })
|
|
30
31
|
uri?: string
|
|
31
32
|
|
|
32
33
|
@OneToMany(() => IdentityEntity, (identity: IdentityEntity) => identity.party, {
|
|
@@ -47,6 +48,15 @@ export class PartyEntity extends BaseEntity {
|
|
|
47
48
|
@JoinColumn({ name: 'electronic_address_id' })
|
|
48
49
|
electronicAddresses!: Array<ElectronicAddressEntity>
|
|
49
50
|
|
|
51
|
+
@OneToMany(() => PhysicalAddressEntity, (physicalAddress: PhysicalAddressEntity) => physicalAddress.party, {
|
|
52
|
+
cascade: true,
|
|
53
|
+
onDelete: 'CASCADE',
|
|
54
|
+
eager: true,
|
|
55
|
+
nullable: false,
|
|
56
|
+
})
|
|
57
|
+
@JoinColumn({ name: 'physical_address_id' })
|
|
58
|
+
physicalAddresses!: Array<PhysicalAddressEntity>
|
|
59
|
+
|
|
50
60
|
@ManyToOne(() => PartyTypeEntity, (contactType: PartyTypeEntity) => contactType.parties, {
|
|
51
61
|
cascade: true,
|
|
52
62
|
nullable: false,
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { IsNotEmpty, validate, ValidationError } from 'class-validator'
|
|
2
|
+
import {
|
|
3
|
+
BaseEntity,
|
|
4
|
+
BeforeInsert,
|
|
5
|
+
BeforeUpdate,
|
|
6
|
+
Column,
|
|
7
|
+
CreateDateColumn,
|
|
8
|
+
Entity,
|
|
9
|
+
ManyToOne,
|
|
10
|
+
PrimaryGeneratedColumn,
|
|
11
|
+
UpdateDateColumn
|
|
12
|
+
} from 'typeorm'
|
|
13
|
+
import { getConstraint } from '../../utils/ValidatorUtils'
|
|
14
|
+
import { PhysicalAddressType, ValidationConstraint } from '../../types'
|
|
15
|
+
import { PartyEntity } from './PartyEntity'
|
|
16
|
+
|
|
17
|
+
@Entity('PhysicalAddress')
|
|
18
|
+
export class PhysicalAddressEntity extends BaseEntity {
|
|
19
|
+
@PrimaryGeneratedColumn('uuid')
|
|
20
|
+
id!: string
|
|
21
|
+
|
|
22
|
+
@Column({ name: 'type', length: 255, nullable: false })
|
|
23
|
+
@IsNotEmpty({ message: 'Blank physical address types are not allowed' })
|
|
24
|
+
type!: PhysicalAddressType
|
|
25
|
+
|
|
26
|
+
@Column({ name: 'street_name', length: 255, nullable: false })
|
|
27
|
+
@IsNotEmpty({ message: 'Blank street names are not allowed' })
|
|
28
|
+
streetName!: string
|
|
29
|
+
|
|
30
|
+
@Column({ name: 'street_number', length: 255, nullable: false })
|
|
31
|
+
@IsNotEmpty({ message: 'Blank street numbers are not allowed' })
|
|
32
|
+
streetNumber!: string
|
|
33
|
+
|
|
34
|
+
@Column({ name: 'postal_code', length: 255, nullable: false })
|
|
35
|
+
@IsNotEmpty({ message: 'Blank postal codes are not allowed' })
|
|
36
|
+
postalCode!: string
|
|
37
|
+
|
|
38
|
+
@Column({ name: 'city_name', length: 255, nullable: false })
|
|
39
|
+
@IsNotEmpty({ message: 'Blank city names are not allowed' })
|
|
40
|
+
cityName!: string
|
|
41
|
+
|
|
42
|
+
@Column({ name: 'province_name', length: 255, nullable: false })
|
|
43
|
+
@IsNotEmpty({ message: 'Blank province names are not allowed' })
|
|
44
|
+
provinceName!: string
|
|
45
|
+
|
|
46
|
+
@Column({ name: 'country_code', length: 2, nullable: false })
|
|
47
|
+
@IsNotEmpty({ message: 'Blank country codes are not allowed' })
|
|
48
|
+
countryCode!: string
|
|
49
|
+
|
|
50
|
+
@Column({ name: 'building_name', length: 255, nullable: true })
|
|
51
|
+
@IsNotEmpty({ message: 'Blank building names are not allowed' })
|
|
52
|
+
buildingName?: string
|
|
53
|
+
|
|
54
|
+
@ManyToOne(() => PartyEntity, (party: PartyEntity) => party.physicalAddresses, {
|
|
55
|
+
onDelete: 'CASCADE',
|
|
56
|
+
})
|
|
57
|
+
party!: PartyEntity
|
|
58
|
+
|
|
59
|
+
@Column({ name: 'partyId', nullable: true })
|
|
60
|
+
partyId?: string
|
|
61
|
+
|
|
62
|
+
@CreateDateColumn({ name: 'created_at', nullable: false })
|
|
63
|
+
createdAt!: Date
|
|
64
|
+
|
|
65
|
+
@UpdateDateColumn({ name: 'last_updated_at', nullable: false })
|
|
66
|
+
lastUpdatedAt!: Date
|
|
67
|
+
|
|
68
|
+
// By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
|
|
69
|
+
@BeforeInsert()
|
|
70
|
+
@BeforeUpdate()
|
|
71
|
+
updateUpdatedDate(): void {
|
|
72
|
+
this.lastUpdatedAt = new Date()
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@BeforeInsert()
|
|
76
|
+
@BeforeUpdate()
|
|
77
|
+
async validate(): Promise<void> {
|
|
78
|
+
const validation: Array<ValidationError> = await validate(this)
|
|
79
|
+
if (validation.length > 0) {
|
|
80
|
+
const constraint: ValidationConstraint | undefined = getConstraint(validation[0])
|
|
81
|
+
if (constraint) {
|
|
82
|
+
const message: string = Object.values(constraint!)[0]
|
|
83
|
+
return Promise.reject(Error(message))
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
|
|
2
|
+
import {
|
|
3
|
+
CredentialCorrelationType,
|
|
4
|
+
CredentialDocumentFormat,
|
|
5
|
+
CredentialStateType,
|
|
6
|
+
CredentialType,
|
|
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: 'credential_type', enum: CredentialType, nullable: false })
|
|
15
|
+
credentialType!: CredentialType
|
|
16
|
+
|
|
17
|
+
@Column('simple-enum', { name: 'document_format', enum: CredentialDocumentFormat, nullable: false })
|
|
18
|
+
documentFormat!: CredentialDocumentFormat
|
|
19
|
+
|
|
20
|
+
@Column('text', { name: 'raw', nullable: false })
|
|
21
|
+
raw!: 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: 'expires_at', nullable: true })
|
|
54
|
+
expiresAt?: Date
|
|
55
|
+
|
|
56
|
+
@Column('date', { name: 'issued_at', nullable: true })
|
|
57
|
+
issuedAt?: Date
|
|
58
|
+
|
|
59
|
+
@Column('date', { name: 'verification_date', nullable: true })
|
|
60
|
+
verificationDate?: Date
|
|
61
|
+
|
|
62
|
+
@Column('date', { name: 'revocation_date', nullable: true })
|
|
63
|
+
revocationDate?: 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:
|
|
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
|
+
}
|