@sphereon/ssi-sdk.data-store 0.15.2-next.6 → 0.15.2-next.95
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/dist/contact/AbstractContactStore.d.ts +21 -11
- package/dist/contact/AbstractContactStore.d.ts.map +1 -1
- package/dist/contact/AbstractContactStore.js.map +1 -1
- package/dist/contact/ContactStore.d.ts +25 -21
- package/dist/contact/ContactStore.d.ts.map +1 -1
- package/dist/contact/ContactStore.js +216 -136
- package/dist/contact/ContactStore.js.map +1 -1
- package/dist/entities/contact/BaseConfigEntity.d.ts +2 -0
- package/dist/entities/contact/BaseConfigEntity.d.ts.map +1 -1
- package/dist/entities/contact/BaseConfigEntity.js +10 -2
- package/dist/entities/contact/BaseConfigEntity.js.map +1 -1
- package/dist/entities/contact/BaseContactEntity.d.ts +10 -0
- package/dist/entities/contact/BaseContactEntity.d.ts.map +1 -0
- package/dist/entities/contact/BaseContactEntity.js +54 -0
- package/dist/entities/contact/BaseContactEntity.js.map +1 -0
- package/dist/entities/contact/ConnectionEntity.d.ts +1 -2
- package/dist/entities/contact/ConnectionEntity.d.ts.map +1 -1
- package/dist/entities/contact/ConnectionEntity.js +2 -21
- package/dist/entities/contact/ConnectionEntity.js.map +1 -1
- package/dist/entities/contact/CorrelationIdentifierEntity.d.ts +2 -3
- package/dist/entities/contact/CorrelationIdentifierEntity.d.ts.map +1 -1
- package/dist/entities/contact/CorrelationIdentifierEntity.js +8 -11
- package/dist/entities/contact/CorrelationIdentifierEntity.js.map +1 -1
- package/dist/entities/contact/DidAuthConfigEntity.d.ts +0 -4
- package/dist/entities/contact/DidAuthConfigEntity.d.ts.map +1 -1
- package/dist/entities/contact/DidAuthConfigEntity.js +1 -17
- package/dist/entities/contact/DidAuthConfigEntity.js.map +1 -1
- package/dist/entities/contact/ElectronicAddressEntity.d.ts +14 -0
- package/dist/entities/contact/ElectronicAddressEntity.d.ts.map +1 -0
- package/dist/entities/contact/ElectronicAddressEntity.js +92 -0
- package/dist/entities/contact/ElectronicAddressEntity.js.map +1 -0
- package/dist/entities/contact/IdentityEntity.d.ts +5 -6
- package/dist/entities/contact/IdentityEntity.d.ts.map +1 -1
- package/dist/entities/contact/IdentityEntity.js +15 -20
- package/dist/entities/contact/IdentityEntity.js.map +1 -1
- package/dist/entities/contact/IdentityMetadataItemEntity.d.ts +1 -3
- package/dist/entities/contact/IdentityMetadataItemEntity.d.ts.map +1 -1
- package/dist/entities/contact/IdentityMetadataItemEntity.js +7 -10
- package/dist/entities/contact/IdentityMetadataItemEntity.js.map +1 -1
- package/dist/entities/contact/NaturalPersonEntity.d.ts +9 -0
- package/dist/entities/contact/NaturalPersonEntity.d.ts.map +1 -0
- package/dist/entities/contact/NaturalPersonEntity.js +72 -0
- package/dist/entities/contact/NaturalPersonEntity.js.map +1 -0
- package/dist/entities/contact/OpenIdConfigEntity.d.ts +0 -4
- package/dist/entities/contact/OpenIdConfigEntity.d.ts.map +1 -1
- package/dist/entities/contact/OpenIdConfigEntity.js +1 -22
- package/dist/entities/contact/OpenIdConfigEntity.js.map +1 -1
- package/dist/entities/contact/OrganizationEntity.d.ts +9 -0
- package/dist/entities/contact/OrganizationEntity.d.ts.map +1 -0
- package/dist/entities/contact/OrganizationEntity.js +67 -0
- package/dist/entities/contact/OrganizationEntity.js.map +1 -0
- package/dist/entities/contact/PartyEntity.d.ts +21 -0
- package/dist/entities/contact/PartyEntity.d.ts.map +1 -0
- package/dist/entities/contact/PartyEntity.js +155 -0
- package/dist/entities/contact/PartyEntity.js.map +1 -0
- package/dist/entities/contact/PartyRelationshipEntity.d.ts +13 -0
- package/dist/entities/contact/PartyRelationshipEntity.d.ts.map +1 -0
- package/dist/entities/contact/PartyRelationshipEntity.js +95 -0
- package/dist/entities/contact/PartyRelationshipEntity.js.map +1 -0
- package/dist/entities/contact/PartyTypeEntity.d.ts +15 -0
- package/dist/entities/contact/PartyTypeEntity.d.ts.map +1 -0
- package/dist/entities/contact/{ContactEntity.js → PartyTypeEntity.js} +35 -36
- package/dist/entities/contact/PartyTypeEntity.js.map +1 -0
- package/dist/entities/statusList2021/StatusList2021Entity.d.ts +19 -0
- package/dist/entities/statusList2021/StatusList2021Entity.d.ts.map +1 -0
- package/dist/entities/statusList2021/StatusList2021Entity.js +115 -0
- package/dist/entities/statusList2021/StatusList2021Entity.js.map +1 -0
- package/dist/entities/statusList2021/StatusList2021EntryEntity.d.ts +11 -0
- package/dist/entities/statusList2021/StatusList2021EntryEntity.d.ts.map +1 -0
- package/dist/entities/statusList2021/StatusList2021EntryEntity.js +51 -0
- package/dist/entities/statusList2021/StatusList2021EntryEntity.js.map +1 -0
- package/dist/index.d.ts +20 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -11
- package/dist/index.js.map +1 -1
- package/dist/migrations/generic/1-CreateContacts.d.ts.map +1 -1
- package/dist/migrations/generic/1-CreateContacts.js +36 -32
- package/dist/migrations/generic/1-CreateContacts.js.map +1 -1
- 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 +76 -0
- package/dist/migrations/generic/2-CreateContacts.js.map +1 -0
- package/dist/migrations/generic/{1-CreateIssuanceBranding.d.ts → 2-CreateIssuanceBranding.d.ts} +1 -1
- package/dist/migrations/generic/2-CreateIssuanceBranding.d.ts.map +1 -0
- package/dist/migrations/generic/2-CreateIssuanceBranding.js +76 -0
- package/dist/migrations/generic/2-CreateIssuanceBranding.js.map +1 -0
- 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/{1-CreateIssuanceBranding.js → 3-CreateStatusList.js} +11 -11
- package/dist/migrations/generic/3-CreateStatusList.js.map +1 -0
- package/dist/migrations/generic/index.d.ts +5 -0
- package/dist/migrations/generic/index.d.ts.map +1 -1
- package/dist/migrations/generic/index.js +10 -3
- package/dist/migrations/generic/index.js.map +1 -1
- package/dist/migrations/internal-migrations-ormconfig.d.ts +2 -1
- package/dist/migrations/internal-migrations-ormconfig.d.ts.map +1 -1
- package/dist/migrations/internal-migrations-ormconfig.js +0 -2
- package/dist/migrations/internal-migrations-ormconfig.js.map +1 -1
- package/dist/migrations/postgres/1659463079428-CreateContacts.d.ts.map +1 -1
- package/dist/migrations/postgres/1659463079428-CreateContacts.js +4 -2
- package/dist/migrations/postgres/1659463079428-CreateContacts.js.map +1 -1
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.d.ts.map +1 -1
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js +2 -0
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js.map +1 -1
- package/dist/migrations/postgres/1690925872592-CreateContacts.d.ts +7 -0
- package/dist/migrations/postgres/1690925872592-CreateContacts.d.ts.map +1 -0
- package/dist/migrations/postgres/1690925872592-CreateContacts.js +69 -0
- package/dist/migrations/postgres/1690925872592-CreateContacts.js.map +1 -0
- 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/1690925872693-CreateContacts.d.ts +7 -0
- package/dist/migrations/sqlite/1690925872693-CreateContacts.d.ts.map +1 -0
- package/dist/migrations/sqlite/1690925872693-CreateContacts.js +108 -0
- package/dist/migrations/sqlite/1690925872693-CreateContacts.js.map +1 -0
- package/dist/migrations/sqlite/1693866470000-CreateStatusList.d.ts +7 -0
- package/dist/migrations/sqlite/1693866470000-CreateStatusList.d.ts.map +1 -0
- package/dist/migrations/sqlite/1693866470000-CreateStatusList.js +32 -0
- package/dist/migrations/sqlite/1693866470000-CreateStatusList.js.map +1 -0
- package/dist/statusList/IStatusListStore.d.ts +20 -0
- package/dist/statusList/IStatusListStore.d.ts.map +1 -0
- package/dist/statusList/IStatusListStore.js +3 -0
- package/dist/statusList/IStatusListStore.js.map +1 -0
- package/dist/statusList/StatusListStore.d.ts +36 -0
- package/dist/statusList/StatusListStore.d.ts.map +1 -0
- package/dist/statusList/StatusListStore.js +213 -0
- package/dist/statusList/StatusListStore.js.map +1 -0
- package/dist/types/contact/IAbstractContactStore.d.ts +70 -36
- package/dist/types/contact/IAbstractContactStore.d.ts.map +1 -1
- package/dist/types/contact/contact.d.ts +139 -56
- package/dist/types/contact/contact.d.ts.map +1 -1
- package/dist/types/contact/contact.js +6 -1
- package/dist/types/contact/contact.js.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/statusList/IAbstractStatusListStore.d.ts +38 -0
- package/dist/types/statusList/IAbstractStatusListStore.d.ts.map +1 -0
- package/dist/types/statusList/IAbstractStatusListStore.js +3 -0
- package/dist/types/statusList/IAbstractStatusListStore.js.map +1 -0
- package/dist/types/statusList/statusList.d.ts +25 -0
- package/dist/types/statusList/statusList.d.ts.map +1 -0
- package/dist/types/statusList/statusList.js +3 -0
- package/dist/types/statusList/statusList.js.map +1 -0
- package/dist/types/validation/validation.d.ts +4 -0
- package/dist/types/validation/validation.d.ts.map +1 -0
- package/dist/types/validation/validation.js +3 -0
- package/dist/types/validation/validation.js.map +1 -0
- package/dist/utils/ValidatorUtils.d.ts +4 -0
- package/dist/utils/ValidatorUtils.d.ts.map +1 -0
- package/dist/utils/ValidatorUtils.js +13 -0
- package/dist/utils/ValidatorUtils.js.map +1 -0
- package/dist/utils/contact/MappingUtils.d.ts +47 -0
- package/dist/utils/contact/MappingUtils.d.ts.map +1 -0
- package/dist/utils/contact/MappingUtils.js +291 -0
- package/dist/utils/contact/MappingUtils.js.map +1 -0
- package/package.json +5 -4
- package/src/__tests__/contact.entities.test.ts +1457 -195
- package/src/__tests__/contact.store.test.ts +1302 -266
- package/src/contact/AbstractContactStore.ts +44 -22
- package/src/contact/ContactStore.ts +328 -204
- package/src/entities/contact/BaseConfigEntity.ts +10 -2
- package/src/entities/contact/BaseContactEntity.ts +30 -0
- package/src/entities/contact/ConnectionEntity.ts +4 -23
- package/src/entities/contact/CorrelationIdentifierEntity.ts +9 -13
- package/src/entities/contact/DidAuthConfigEntity.ts +1 -18
- package/src/entities/contact/ElectronicAddressEntity.ts +60 -0
- package/src/entities/contact/IdentityEntity.ts +18 -25
- package/src/entities/contact/IdentityMetadataItemEntity.ts +8 -12
- package/src/entities/contact/NaturalPersonEntity.ts +38 -0
- package/src/entities/contact/OpenIdConfigEntity.ts +1 -23
- package/src/entities/contact/OrganizationEntity.ts +34 -0
- package/src/entities/contact/PartyEntity.ts +118 -0
- package/src/entities/contact/PartyRelationshipEntity.ts +61 -0
- package/src/entities/contact/PartyTypeEntity.ts +59 -0
- package/src/entities/statusList2021/StatusList2021Entity.ts +95 -0
- package/src/entities/statusList2021/StatusList2021EntryEntity.ts +29 -0
- package/src/index.ts +36 -17
- package/src/migrations/generic/1-CreateContacts.ts +46 -36
- package/src/migrations/generic/2-CreateContacts.ts +64 -0
- package/src/migrations/generic/2-CreateIssuanceBranding.ts +62 -0
- package/src/migrations/generic/{1-CreateIssuanceBranding.ts → 3-CreateStatusList.ts} +9 -9
- package/src/migrations/generic/index.ts +11 -2
- package/src/migrations/internal-migrations-ormconfig.ts +2 -4
- package/src/migrations/postgres/1659463079428-CreateContacts.ts +4 -2
- package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +2 -0
- package/src/migrations/postgres/1690925872592-CreateContacts.ts +94 -0
- package/src/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.ts +24 -0
- package/src/migrations/postgres/uuid.ts +12 -0
- package/src/migrations/sqlite/1690925872693-CreateContacts.ts +163 -0
- package/src/migrations/sqlite/1693866470000-CreateStatusList.ts +24 -0
- package/src/statusList/IStatusListStore.ts +44 -0
- package/src/statusList/StatusListStore.ts +237 -0
- package/src/types/contact/IAbstractContactStore.ts +84 -27
- package/src/types/contact/contact.ts +144 -50
- package/src/types/index.ts +4 -0
- package/src/types/statusList/IAbstractStatusListStore.ts +47 -0
- package/src/types/statusList/statusList.ts +39 -0
- package/src/types/validation/validation.ts +3 -0
- package/src/utils/ValidatorUtils.ts +10 -0
- package/src/utils/contact/MappingUtils.ts +344 -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.map +0 -1
- package/dist/migrations/generic/1-CreateIssuanceBranding.d.ts.map +0 -1
- package/dist/migrations/generic/1-CreateIssuanceBranding.js.map +0 -1
- package/src/entities/contact/ContactEntity.ts +0 -74
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Entity, PrimaryGeneratedColumn, Column, Index, CreateDateColumn, UpdateDateColumn, OneToMany, BeforeInsert, BeforeUpdate } from 'typeorm'
|
|
2
|
+
import { PartyEntity } from './PartyEntity'
|
|
3
|
+
import { PartyTypeEnum, ValidationConstraint } from '../../types'
|
|
4
|
+
import { IsNotEmpty, Validate, validate, ValidationError } from 'class-validator'
|
|
5
|
+
import { IsNonEmptyStringConstraint } from '../validators'
|
|
6
|
+
import { getConstraint } from '../../utils/ValidatorUtils'
|
|
7
|
+
|
|
8
|
+
@Entity('PartyType')
|
|
9
|
+
@Index('IDX_PartyType_type_tenant_id', ['type', 'tenantId'], { unique: true })
|
|
10
|
+
export class PartyTypeEntity {
|
|
11
|
+
@PrimaryGeneratedColumn('uuid')
|
|
12
|
+
id!: string
|
|
13
|
+
|
|
14
|
+
@Column('simple-enum', { name: 'type', enum: PartyTypeEnum, nullable: false, unique: false })
|
|
15
|
+
type!: PartyTypeEnum
|
|
16
|
+
|
|
17
|
+
@Column({ name: 'name', length: 255, nullable: false, unique: true })
|
|
18
|
+
@IsNotEmpty({ message: 'Blank names are not allowed' })
|
|
19
|
+
name!: string
|
|
20
|
+
|
|
21
|
+
@Column({ name: 'description', length: 255, nullable: true, unique: false })
|
|
22
|
+
@Validate(IsNonEmptyStringConstraint, { message: 'Blank descriptions are not allowed' })
|
|
23
|
+
description?: string
|
|
24
|
+
|
|
25
|
+
@Column({ name: 'tenant_id', length: 255, nullable: false, unique: false })
|
|
26
|
+
@IsNotEmpty({ message: "Blank tenant id's are not allowed" })
|
|
27
|
+
tenantId!: string
|
|
28
|
+
|
|
29
|
+
@OneToMany(() => PartyEntity, (party: PartyEntity) => party.partyType, {
|
|
30
|
+
nullable: false,
|
|
31
|
+
})
|
|
32
|
+
parties!: Array<PartyEntity>
|
|
33
|
+
|
|
34
|
+
@CreateDateColumn({ name: 'created_at', nullable: false })
|
|
35
|
+
createdAt!: Date
|
|
36
|
+
|
|
37
|
+
@UpdateDateColumn({ name: 'last_updated_at', nullable: false })
|
|
38
|
+
lastUpdatedAt!: Date
|
|
39
|
+
|
|
40
|
+
// By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
|
|
41
|
+
@BeforeInsert()
|
|
42
|
+
@BeforeUpdate()
|
|
43
|
+
updateUpdatedDate(): void {
|
|
44
|
+
this.lastUpdatedAt = new Date()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@BeforeInsert()
|
|
48
|
+
@BeforeUpdate()
|
|
49
|
+
async validate(): Promise<void> {
|
|
50
|
+
const validation: Array<ValidationError> = await validate(this)
|
|
51
|
+
if (validation.length > 0) {
|
|
52
|
+
const constraint: ValidationConstraint | undefined = getConstraint(validation[0])
|
|
53
|
+
if (constraint) {
|
|
54
|
+
const message: string = Object.values(constraint!)[0]
|
|
55
|
+
return Promise.reject(Error(message))
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IIssuer,
|
|
3
|
+
OriginalVerifiableCredential,
|
|
4
|
+
StatusListCredentialIdMode,
|
|
5
|
+
StatusListDriverType,
|
|
6
|
+
StatusListIndexingDirection,
|
|
7
|
+
StatusListType,
|
|
8
|
+
StatusPurpose2021,
|
|
9
|
+
} from '@sphereon/ssi-types'
|
|
10
|
+
import { ProofFormat } from '@veramo/core'
|
|
11
|
+
import { BaseEntity, Column, Entity, OneToMany, PrimaryColumn, Unique } from 'typeorm'
|
|
12
|
+
import { StatusListEntryEntity } from './StatusList2021EntryEntity'
|
|
13
|
+
|
|
14
|
+
@Entity('StatusList')
|
|
15
|
+
@Unique('UQ_correlationId', ['correlationId'])
|
|
16
|
+
export class StatusListEntity extends BaseEntity {
|
|
17
|
+
@PrimaryColumn({ name: 'id', type: 'varchar' })
|
|
18
|
+
id!: string
|
|
19
|
+
|
|
20
|
+
@Column({ name: 'correlationId', type: 'varchar', nullable: false })
|
|
21
|
+
correlationId!: string
|
|
22
|
+
|
|
23
|
+
@Column({ name: 'length', nullable: false, unique: false })
|
|
24
|
+
length!: number
|
|
25
|
+
|
|
26
|
+
@Column({
|
|
27
|
+
name: 'issuer',
|
|
28
|
+
type: 'text',
|
|
29
|
+
nullable: false,
|
|
30
|
+
unique: false,
|
|
31
|
+
transformer: {
|
|
32
|
+
from(value: string): string | IIssuer {
|
|
33
|
+
if (value?.trim()?.startsWith('{')) {
|
|
34
|
+
return JSON.parse(value)
|
|
35
|
+
}
|
|
36
|
+
return value
|
|
37
|
+
},
|
|
38
|
+
to(value: string | IIssuer): string {
|
|
39
|
+
if (typeof value === 'string') {
|
|
40
|
+
return value
|
|
41
|
+
}
|
|
42
|
+
return JSON.stringify(value)
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
issuer!: string | IIssuer
|
|
47
|
+
|
|
48
|
+
@Column('simple-enum', { name: 'type', enum: StatusListType, nullable: false, default: StatusListType.StatusList2021 })
|
|
49
|
+
type!: StatusListType
|
|
50
|
+
|
|
51
|
+
@Column('simple-enum', { name: 'driverType', enum: StatusListDriverType, nullable: false, default: StatusListDriverType.AGENT_TYPEORM })
|
|
52
|
+
driverType!: StatusListDriverType
|
|
53
|
+
|
|
54
|
+
@Column('simple-enum', {
|
|
55
|
+
name: 'credentialIdMode',
|
|
56
|
+
enum: StatusListCredentialIdMode,
|
|
57
|
+
nullable: false,
|
|
58
|
+
default: StatusListCredentialIdMode.ISSUANCE,
|
|
59
|
+
})
|
|
60
|
+
credentialIdMode!: StatusListCredentialIdMode
|
|
61
|
+
|
|
62
|
+
@Column({ type: 'varchar', name: 'proofFormat', enum: ['lds', 'jwt'], nullable: false, default: 'lds' })
|
|
63
|
+
proofFormat!: ProofFormat
|
|
64
|
+
|
|
65
|
+
@Column({ type: 'varchar', name: 'indexingDirection', enum: ['rightToLeft'], nullable: false, default: 'rightToLeft' })
|
|
66
|
+
indexingDirection!: StatusListIndexingDirection
|
|
67
|
+
|
|
68
|
+
@Column({ type: 'varchar', name: 'statusPurpose', nullable: false, default: 'revocation' })
|
|
69
|
+
statusPurpose!: StatusPurpose2021
|
|
70
|
+
|
|
71
|
+
@Column({
|
|
72
|
+
name: 'statusListCredential',
|
|
73
|
+
type: 'text',
|
|
74
|
+
nullable: true,
|
|
75
|
+
unique: false,
|
|
76
|
+
transformer: {
|
|
77
|
+
from(value: string): OriginalVerifiableCredential {
|
|
78
|
+
if (value?.startsWith('ey')) {
|
|
79
|
+
return value
|
|
80
|
+
}
|
|
81
|
+
return JSON.parse(value)
|
|
82
|
+
},
|
|
83
|
+
to(value: OriginalVerifiableCredential): string {
|
|
84
|
+
if (typeof value === 'string') {
|
|
85
|
+
return value
|
|
86
|
+
}
|
|
87
|
+
return JSON.stringify(value)
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
|
+
statusListCredential?: OriginalVerifiableCredential
|
|
92
|
+
|
|
93
|
+
@OneToMany((type) => StatusListEntryEntity, (entry) => entry.statusList)
|
|
94
|
+
statusListEntries!: StatusListEntryEntity[]
|
|
95
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Validate } from 'class-validator'
|
|
2
|
+
import { BaseEntity, Column, Entity, ManyToOne, PrimaryColumn } from 'typeorm'
|
|
3
|
+
import { IsNonEmptyStringConstraint } from '../validators'
|
|
4
|
+
import { StatusListEntity } from './StatusList2021Entity'
|
|
5
|
+
|
|
6
|
+
@Entity('StatusListEntry')
|
|
7
|
+
// @Unique('uq_credential_statuslist', ['statusList', 'credentialId']) // disabled because one prop can be null
|
|
8
|
+
// @Unique('uq_credentialHash_statuslistId', ['statusList', 'credentialHash']) // disabled because one prop can be null
|
|
9
|
+
export class StatusListEntryEntity extends BaseEntity {
|
|
10
|
+
@PrimaryColumn({ name: 'statusListId', type: 'varchar' })
|
|
11
|
+
@ManyToOne(() => StatusListEntity, (statusList) => statusList.statusListEntries)
|
|
12
|
+
statusList!: StatusListEntity
|
|
13
|
+
|
|
14
|
+
@PrimaryColumn({ name: 'statusListIndex', nullable: false, unique: false })
|
|
15
|
+
@Validate(IsNonEmptyStringConstraint, { message: 'Status list index is required' })
|
|
16
|
+
statusListIndex!: number
|
|
17
|
+
|
|
18
|
+
@Column({ name: 'credentialId', nullable: true })
|
|
19
|
+
credentialId?: string
|
|
20
|
+
|
|
21
|
+
@Column({ name: 'credentialHash', length: 128, nullable: true, unique: false })
|
|
22
|
+
credentialHash?: string
|
|
23
|
+
|
|
24
|
+
@Column({ name: 'correlationId', length: 255, nullable: true, unique: false })
|
|
25
|
+
correlationId?: string
|
|
26
|
+
|
|
27
|
+
@Column({ name: 'value', length: 50, nullable: true, unique: false })
|
|
28
|
+
value?: string
|
|
29
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { BaseConfigEntity } from './entities/contact/BaseConfigEntity'
|
|
2
2
|
import { BaseLocaleBrandingEntity } from './entities/issuanceBranding/BaseLocaleBrandingEntity'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
3
|
+
import { BaseContactEntity } from './entities/contact/BaseContactEntity'
|
|
4
|
+
import { ConnectionEntity } from './entities/contact/ConnectionEntity'
|
|
5
|
+
import { PartyEntity } from './entities/contact/PartyEntity'
|
|
6
|
+
import { CorrelationIdentifierEntity } from './entities/contact/CorrelationIdentifierEntity'
|
|
7
|
+
import { DidAuthConfigEntity } from './entities/contact/DidAuthConfigEntity'
|
|
8
|
+
import { IdentityEntity } from './entities/contact/IdentityEntity'
|
|
9
|
+
import { IdentityMetadataItemEntity } from './entities/contact/IdentityMetadataItemEntity'
|
|
10
|
+
import { OpenIdConfigEntity } from './entities/contact/OpenIdConfigEntity'
|
|
10
11
|
import { BackgroundAttributesEntity, backgroundAttributesEntityFrom } from './entities/issuanceBranding/BackgroundAttributesEntity'
|
|
11
12
|
import { CredentialBrandingEntity, credentialBrandingEntityFrom } from './entities/issuanceBranding/CredentialBrandingEntity'
|
|
12
13
|
import { CredentialLocaleBrandingEntity, credentialLocaleBrandingEntityFrom } from './entities/issuanceBranding/CredentialLocaleBrandingEntity'
|
|
@@ -15,23 +16,38 @@ import { ImageDimensionsEntity, imageDimensionsEntityFrom } from './entities/iss
|
|
|
15
16
|
import { IssuerLocaleBrandingEntity, issuerLocaleBrandingEntityFrom } from './entities/issuanceBranding/IssuerLocaleBrandingEntity'
|
|
16
17
|
import { IssuerBrandingEntity, issuerBrandingEntityFrom } from './entities/issuanceBranding/IssuerBrandingEntity'
|
|
17
18
|
import { TextAttributesEntity, textAttributesEntityFrom } from './entities/issuanceBranding/TextAttributesEntity'
|
|
18
|
-
|
|
19
|
+
import { StatusListEntity } from './entities/statusList2021/StatusList2021Entity'
|
|
20
|
+
import { StatusListEntryEntity } from './entities/statusList2021/StatusList2021EntryEntity'
|
|
21
|
+
import { IStatusListEntity, IStatusListEntryEntity } from './types'
|
|
22
|
+
import { PartyRelationshipEntity } from './entities/contact/PartyRelationshipEntity'
|
|
23
|
+
import { PartyTypeEntity } from './entities/contact/PartyTypeEntity'
|
|
24
|
+
import { OrganizationEntity } from './entities/contact/OrganizationEntity'
|
|
25
|
+
import { NaturalPersonEntity } from './entities/contact/NaturalPersonEntity'
|
|
26
|
+
import { ElectronicAddressEntity } from './entities/contact/ElectronicAddressEntity'
|
|
19
27
|
export { ContactStore } from './contact/ContactStore'
|
|
20
28
|
export { AbstractContactStore } from './contact/AbstractContactStore'
|
|
21
29
|
export { AbstractIssuanceBrandingStore } from './issuanceBranding/AbstractIssuanceBrandingStore'
|
|
22
30
|
export { IssuanceBrandingStore } from './issuanceBranding/IssuanceBrandingStore'
|
|
31
|
+
export { StatusListStore } from './statusList/StatusListStore'
|
|
23
32
|
export { DataStoreMigrations } from './migrations'
|
|
24
33
|
export * from './types'
|
|
34
|
+
export * from './utils/contact/MappingUtils'
|
|
25
35
|
|
|
26
36
|
export const DataStoreContactEntities = [
|
|
27
37
|
BaseConfigEntity,
|
|
28
38
|
ConnectionEntity,
|
|
29
|
-
|
|
39
|
+
PartyEntity,
|
|
30
40
|
IdentityEntity,
|
|
31
41
|
IdentityMetadataItemEntity,
|
|
32
42
|
CorrelationIdentifierEntity,
|
|
33
43
|
DidAuthConfigEntity,
|
|
34
44
|
OpenIdConfigEntity,
|
|
45
|
+
PartyRelationshipEntity,
|
|
46
|
+
PartyTypeEntity,
|
|
47
|
+
BaseContactEntity,
|
|
48
|
+
OrganizationEntity,
|
|
49
|
+
NaturalPersonEntity,
|
|
50
|
+
ElectronicAddressEntity,
|
|
35
51
|
]
|
|
36
52
|
|
|
37
53
|
export const DataStoreIssuanceBrandingEntities = [
|
|
@@ -46,10 +62,15 @@ export const DataStoreIssuanceBrandingEntities = [
|
|
|
46
62
|
IssuerLocaleBrandingEntity,
|
|
47
63
|
]
|
|
48
64
|
|
|
65
|
+
export const DataStoreStatusListEntities = [StatusListEntity, StatusListEntryEntity]
|
|
66
|
+
|
|
67
|
+
// All entities combined if a party wants to enable them all at once
|
|
68
|
+
export const DataStoreEntities = [...DataStoreContactEntities, ...DataStoreIssuanceBrandingEntities, ...DataStoreStatusListEntities]
|
|
69
|
+
|
|
49
70
|
export {
|
|
50
71
|
BaseConfigEntity,
|
|
51
72
|
ConnectionEntity,
|
|
52
|
-
|
|
73
|
+
PartyEntity,
|
|
53
74
|
CorrelationIdentifierEntity,
|
|
54
75
|
DidAuthConfigEntity,
|
|
55
76
|
IdentityEntity,
|
|
@@ -64,13 +85,7 @@ export {
|
|
|
64
85
|
TextAttributesEntity,
|
|
65
86
|
CredentialLocaleBrandingEntity,
|
|
66
87
|
IssuerLocaleBrandingEntity,
|
|
67
|
-
|
|
68
|
-
connectionEntityFrom,
|
|
69
|
-
contactEntityFrom,
|
|
70
|
-
correlationIdentifierEntityFrom,
|
|
71
|
-
identityEntityFrom,
|
|
72
|
-
didAuthConfigEntityFrom,
|
|
73
|
-
openIdConfigEntityFrom,
|
|
88
|
+
ElectronicAddressEntity,
|
|
74
89
|
backgroundAttributesEntityFrom,
|
|
75
90
|
credentialBrandingEntityFrom,
|
|
76
91
|
imageAttributesEntityFrom,
|
|
@@ -79,4 +94,8 @@ export {
|
|
|
79
94
|
textAttributesEntityFrom,
|
|
80
95
|
issuerLocaleBrandingEntityFrom,
|
|
81
96
|
credentialLocaleBrandingEntityFrom,
|
|
97
|
+
IStatusListEntity,
|
|
98
|
+
IStatusListEntryEntity,
|
|
99
|
+
StatusListEntity,
|
|
100
|
+
StatusListEntryEntity,
|
|
82
101
|
}
|
|
@@ -1,54 +1,64 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
1
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
2
|
import Debug from 'debug'
|
|
3
3
|
import { CreateContacts1659463079428 } from '../postgres/1659463079428-CreateContacts'
|
|
4
4
|
import { CreateContacts1659463069549 } from '../sqlite/1659463069549-CreateContacts'
|
|
5
5
|
|
|
6
|
-
const debug = Debug('sphereon:ssi-sdk:migrations')
|
|
6
|
+
const debug: Debug.Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
7
7
|
|
|
8
8
|
export class CreateContacts1659463079429 implements MigrationInterface {
|
|
9
9
|
name = 'CreateContacts1659463079429'
|
|
10
10
|
|
|
11
11
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
12
12
|
debug('migration: creating contacts tables')
|
|
13
|
-
const dbType = queryRunner.connection.driver.options.type
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
13
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
14
|
+
|
|
15
|
+
switch (dbType) {
|
|
16
|
+
case 'postgres': {
|
|
17
|
+
debug('using postgres migration file')
|
|
18
|
+
const mig: CreateContacts1659463079428 = new CreateContacts1659463079428()
|
|
19
|
+
await mig.up(queryRunner)
|
|
20
|
+
debug('Migration statements executed')
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
case 'sqlite':
|
|
24
|
+
case 'react-native': {
|
|
25
|
+
debug('using sqlite/react-native migration file')
|
|
26
|
+
const mig: CreateContacts1659463069549 = new CreateContacts1659463069549()
|
|
27
|
+
await mig.up(queryRunner)
|
|
28
|
+
debug('Migration statements executed')
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
default:
|
|
32
|
+
return Promise.reject(
|
|
33
|
+
"Migrations are currently only supported for sqlite, react-native and postgres. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now"
|
|
34
|
+
)
|
|
30
35
|
}
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
34
39
|
debug('migration: reverting contacts tables')
|
|
35
|
-
const dbType = queryRunner.connection.driver.options.type
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
41
|
+
|
|
42
|
+
switch (dbType) {
|
|
43
|
+
case 'postgres': {
|
|
44
|
+
debug('using postgres migration file')
|
|
45
|
+
const mig: CreateContacts1659463079428 = new CreateContacts1659463079428()
|
|
46
|
+
await mig.down(queryRunner)
|
|
47
|
+
debug('Migration statements executed')
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
case 'sqlite':
|
|
51
|
+
case 'react-native': {
|
|
52
|
+
debug('using sqlite/react-native migration file')
|
|
53
|
+
const mig: CreateContacts1659463069549 = new CreateContacts1659463069549()
|
|
54
|
+
await mig.down(queryRunner)
|
|
55
|
+
debug('Migration statements executed')
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
default:
|
|
59
|
+
return Promise.reject(
|
|
60
|
+
"Migrations are currently only supported for sqlite, react-native and postgres. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now"
|
|
61
|
+
)
|
|
52
62
|
}
|
|
53
63
|
}
|
|
54
64
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
import Debug from 'debug'
|
|
3
|
+
import { CreateContacts1690925872693 } from '../sqlite/1690925872693-CreateContacts'
|
|
4
|
+
import { CreateContacts1690925872592 } from '../postgres/1690925872592-CreateContacts'
|
|
5
|
+
|
|
6
|
+
const debug: Debug.Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
7
|
+
|
|
8
|
+
export class CreateContacts1690925872318 implements MigrationInterface {
|
|
9
|
+
name = 'CreateContacts1690925872318'
|
|
10
|
+
|
|
11
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
12
|
+
debug('migration: creating contacts tables')
|
|
13
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
14
|
+
|
|
15
|
+
switch (dbType) {
|
|
16
|
+
case 'postgres': {
|
|
17
|
+
debug('using postgres migration file')
|
|
18
|
+
const mig: CreateContacts1690925872592 = new CreateContacts1690925872592()
|
|
19
|
+
await mig.up(queryRunner)
|
|
20
|
+
debug('Migration statements executed')
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
case 'sqlite':
|
|
24
|
+
case 'react-native': {
|
|
25
|
+
debug('using sqlite/react-native migration file')
|
|
26
|
+
const mig: CreateContacts1690925872693 = new CreateContacts1690925872693()
|
|
27
|
+
await mig.up(queryRunner)
|
|
28
|
+
debug('Migration statements executed')
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
default:
|
|
32
|
+
return Promise.reject(
|
|
33
|
+
"Migrations are currently only supported for sqlite, react-native and postgres. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now"
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
39
|
+
debug('migration: reverting contacts tables')
|
|
40
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
41
|
+
|
|
42
|
+
switch (dbType) {
|
|
43
|
+
case 'postgres': {
|
|
44
|
+
debug('using postgres migration file')
|
|
45
|
+
const mig: CreateContacts1690925872592 = new CreateContacts1690925872592()
|
|
46
|
+
await mig.down(queryRunner)
|
|
47
|
+
debug('Migration statements executed')
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
case 'sqlite':
|
|
51
|
+
case 'react-native': {
|
|
52
|
+
debug('using sqlite/react-native migration file')
|
|
53
|
+
const mig: CreateContacts1690925872693 = new CreateContacts1690925872693()
|
|
54
|
+
await mig.down(queryRunner)
|
|
55
|
+
debug('Migration statements executed')
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
default:
|
|
59
|
+
return Promise.reject(
|
|
60
|
+
"Migrations are currently only supported for sqlite, react-native and postgres. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now"
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
import Debug from 'debug'
|
|
3
|
+
import { CreateIssuanceBranding1685628974232 } from '../postgres/1685628974232-CreateIssuanceBranding'
|
|
4
|
+
import { CreateIssuanceBranding1685628973231 } from '../sqlite/1685628973231-CreateIssuanceBranding'
|
|
5
|
+
|
|
6
|
+
const debug: Debug.Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
7
|
+
|
|
8
|
+
export class CreateIssuanceBranding1659463079429 implements MigrationInterface {
|
|
9
|
+
name = 'CreateIssuanceBranding1659463079429'
|
|
10
|
+
|
|
11
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
12
|
+
debug('migration: creating issuance branding tables')
|
|
13
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
14
|
+
switch (dbType) {
|
|
15
|
+
case 'postgres': {
|
|
16
|
+
debug('using postgres migration file')
|
|
17
|
+
const mig: CreateIssuanceBranding1685628974232 = new CreateIssuanceBranding1685628974232()
|
|
18
|
+
await mig.up(queryRunner)
|
|
19
|
+
debug('Migration statements executed')
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
case 'sqlite':
|
|
23
|
+
case 'react-native': {
|
|
24
|
+
debug('using sqlite/react-native migration file')
|
|
25
|
+
const mig: CreateIssuanceBranding1685628973231 = new CreateIssuanceBranding1685628973231()
|
|
26
|
+
await mig.up(queryRunner)
|
|
27
|
+
debug('Migration statements executed')
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
default:
|
|
31
|
+
return Promise.reject(
|
|
32
|
+
"Migrations are currently only supported for sqlite, react-native and postgres. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now"
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
38
|
+
debug('migration: reverting issuance branding tables')
|
|
39
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
40
|
+
switch (dbType) {
|
|
41
|
+
case 'postgres': {
|
|
42
|
+
debug('using postgres migration file')
|
|
43
|
+
const mig: CreateIssuanceBranding1685628974232 = new CreateIssuanceBranding1685628974232()
|
|
44
|
+
await mig.down(queryRunner)
|
|
45
|
+
debug('Migration statements executed')
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
case 'sqlite':
|
|
49
|
+
case 'react-native': {
|
|
50
|
+
debug('using sqlite/react-native migration file')
|
|
51
|
+
const mig: CreateIssuanceBranding1685628973231 = new CreateIssuanceBranding1685628973231()
|
|
52
|
+
await mig.down(queryRunner)
|
|
53
|
+
debug('Migration statements executed')
|
|
54
|
+
return
|
|
55
|
+
}
|
|
56
|
+
default:
|
|
57
|
+
return Promise.reject(
|
|
58
|
+
"Migrations are currently only supported for sqlite, react-native and postgres. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now"
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
1
|
import Debug from 'debug'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
|
+
import { CreateStatusList1693866470001 } from '../postgres/CreateStatusList1693866470001-CreateStatusList'
|
|
4
|
+
import { CreateStatusList1693866470002 } from '../sqlite/1693866470000-CreateStatusList'
|
|
5
5
|
|
|
6
6
|
const debug = Debug('sphereon:ssi-sdk:migrations')
|
|
7
7
|
|
|
8
|
-
export class
|
|
9
|
-
name = '
|
|
8
|
+
export class CreateStatusList1693866470000 implements MigrationInterface {
|
|
9
|
+
name = 'CreateStatusList1693866470000'
|
|
10
10
|
|
|
11
11
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
12
12
|
debug('migration: creating issuance branding tables')
|
|
13
13
|
const dbType = queryRunner.connection.driver.options.type
|
|
14
14
|
if (dbType === 'postgres') {
|
|
15
15
|
debug('using postgres migration file')
|
|
16
|
-
const mig = new
|
|
16
|
+
const mig = new CreateStatusList1693866470001()
|
|
17
17
|
const up = await mig.up(queryRunner)
|
|
18
18
|
debug('Migration statements executed')
|
|
19
19
|
return up
|
|
20
20
|
} else if (dbType === 'sqlite' || 'react-native') {
|
|
21
21
|
debug('using sqlite/react-native migration file')
|
|
22
|
-
const mig = new
|
|
22
|
+
const mig = new CreateStatusList1693866470002()
|
|
23
23
|
const up = await mig.up(queryRunner)
|
|
24
24
|
debug('Migration statements executed')
|
|
25
25
|
return up
|
|
@@ -35,13 +35,13 @@ export class CreateIssuanceBranding1659463079429 implements MigrationInterface {
|
|
|
35
35
|
const dbType = queryRunner.connection.driver.options.type
|
|
36
36
|
if (dbType === 'postgres') {
|
|
37
37
|
debug('using postgres migration file')
|
|
38
|
-
const mig = new
|
|
38
|
+
const mig = new CreateStatusList1693866470002()
|
|
39
39
|
const down = await mig.down(queryRunner)
|
|
40
40
|
debug('Migration statements executed')
|
|
41
41
|
return down
|
|
42
42
|
} else if (dbType === 'sqlite' || 'react-native') {
|
|
43
43
|
debug('using sqlite/react-native migration file')
|
|
44
|
-
const mig = new
|
|
44
|
+
const mig = new CreateStatusList1693866470002()
|
|
45
45
|
const down = await mig.down(queryRunner)
|
|
46
46
|
debug('Migration statements executed')
|
|
47
47
|
return down
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { CreateContacts1659463079429 } from './1-CreateContacts'
|
|
2
|
-
import {
|
|
2
|
+
import { CreateContacts1690925872318 } from './2-CreateContacts'
|
|
3
|
+
import { CreateIssuanceBranding1659463079429 } from './2-CreateIssuanceBranding'
|
|
4
|
+
import { CreateStatusList1693866470000 } from './3-CreateStatusList'
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* The migrations array that SHOULD be used when initializing a TypeORM database connection.
|
|
@@ -8,4 +10,11 @@ import { CreateIssuanceBranding1659463079429 } from './1-CreateIssuanceBranding'
|
|
|
8
10
|
*
|
|
9
11
|
* @public
|
|
10
12
|
*/
|
|
11
|
-
|
|
13
|
+
|
|
14
|
+
// Individual migrations per purpose. Allows parties to not run migrations and thus create/update tables if they are not using a particular feature (yet)
|
|
15
|
+
export const DataStoreContactMigrations = [CreateContacts1659463079429, CreateContacts1690925872318]
|
|
16
|
+
export const DataStoreIssuanceBrandingMigrations = [CreateIssuanceBranding1659463079429]
|
|
17
|
+
export const DataStoreStatusListMigrations = [CreateStatusList1693866470000]
|
|
18
|
+
|
|
19
|
+
// All migrations together
|
|
20
|
+
export const DataStoreMigrations = [...DataStoreContactMigrations, ...DataStoreIssuanceBrandingMigrations, ...DataStoreStatusListMigrations]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DataSourceOptions } from 'typeorm'
|
|
2
2
|
import { DataStoreContactEntities, DataStoreMigrations } from '../index'
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -7,7 +7,6 @@ import { DataStoreContactEntities, DataStoreMigrations } from '../index'
|
|
|
7
7
|
export default [
|
|
8
8
|
{
|
|
9
9
|
type: 'sqlite',
|
|
10
|
-
name: 'migration-sqlite',
|
|
11
10
|
database: 'migration.sqlite',
|
|
12
11
|
migrationsRun: false,
|
|
13
12
|
synchronize: false,
|
|
@@ -17,7 +16,6 @@ export default [
|
|
|
17
16
|
},
|
|
18
17
|
{
|
|
19
18
|
type: 'postgres',
|
|
20
|
-
name: 'migration-postgres',
|
|
21
19
|
database: 'migration-postgres',
|
|
22
20
|
migrationsRun: false,
|
|
23
21
|
synchronize: false,
|
|
@@ -25,4 +23,4 @@ export default [
|
|
|
25
23
|
entities: [...DataStoreContactEntities],
|
|
26
24
|
migrations: [...DataStoreMigrations],
|
|
27
25
|
},
|
|
28
|
-
] as
|
|
26
|
+
] as DataSourceOptions[]
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
import { enableUuidv4 } from './uuid'
|
|
2
3
|
|
|
3
4
|
export class CreateContacts1659463079428 implements MigrationInterface {
|
|
4
5
|
name = 'CreateContacts1659463079428'
|
|
5
6
|
|
|
6
7
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
8
|
+
await enableUuidv4(queryRunner)
|
|
7
9
|
await queryRunner.query(
|
|
8
10
|
`CREATE TABLE "BaseConfigEntity" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "client_id" character varying(255), "client_secret" character varying(255), "scopes" text, "issuer" character varying(255), "redirect_url" text, "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "identifier" character varying(255), "session_id" character varying(255), "type" character varying NOT NULL, "connectionId" uuid, CONSTRAINT "REL_BaseConfig_connectionId" UNIQUE ("connectionId"), CONSTRAINT "PK_BaseConfigEntity_id" PRIMARY KEY ("id"))`
|
|
9
11
|
)
|
|
@@ -13,13 +15,13 @@ export class CreateContacts1659463079428 implements MigrationInterface {
|
|
|
13
15
|
`CREATE TABLE "CorrelationIdentifier" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" "public"."CorrelationIdentifier_type_enum" NOT NULL, "correlation_id" text NOT NULL, "identityId" uuid, CONSTRAINT "UQ_Correlation_id" UNIQUE ("correlation_id"), CONSTRAINT "REL_CorrelationIdentifier_identityId" UNIQUE ("identityId"), CONSTRAINT "PK_CorrelationIdentifier_id" PRIMARY KEY ("id"))`
|
|
14
16
|
)
|
|
15
17
|
await queryRunner.query(
|
|
16
|
-
`CREATE TABLE "Contact" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying(255) NOT NULL, "alias" character varying(255) NOT NULL, "uri" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_Name" UNIQUE ("name"), CONSTRAINT "
|
|
18
|
+
`CREATE TABLE "Contact" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "name" character varying(255) NOT NULL, "alias" character varying(255) NOT NULL, "uri" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_Name" UNIQUE ("name"), CONSTRAINT "UQ_Contact_Alias" UNIQUE ("alias"), CONSTRAINT "PK_Contact_id" PRIMARY KEY ("id"))`
|
|
17
19
|
)
|
|
18
20
|
await queryRunner.query(
|
|
19
21
|
`CREATE TABLE "IdentityMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "label" character varying(255) NOT NULL, "value" character varying(255) NOT NULL, "identityId" uuid, CONSTRAINT "PK_IdentityMetadata_id" PRIMARY KEY ("id"))`
|
|
20
22
|
)
|
|
21
23
|
await queryRunner.query(
|
|
22
|
-
`CREATE TABLE "Identity" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "alias" character varying(255) NOT NULL, "roles" text, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "contactId" uuid, CONSTRAINT "
|
|
24
|
+
`CREATE TABLE "Identity" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "alias" character varying(255) NOT NULL, "roles" text, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "contactId" uuid, CONSTRAINT "UQ_Identity_Alias" UNIQUE ("alias"), CONSTRAINT "PK_Identity_id" PRIMARY KEY ("id"))`
|
|
23
25
|
)
|
|
24
26
|
await queryRunner.query(`CREATE TYPE "public"."Connection_type_enum" AS ENUM('OIDC', 'SIOPv2', 'SIOPv2+OpenID4VP')`)
|
|
25
27
|
await queryRunner.query(
|