@sphereon/ssi-sdk.data-store 0.18.1 → 0.18.2-unstable.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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.js +127 -127
- 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.js +5 -5
- 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/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/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 -113
- 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/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,54 +1,54 @@
|
|
|
1
|
-
import Debug from 'debug'
|
|
2
|
-
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
|
-
import { CreateStatusList1693866470001 } from '../postgres/1693866470001-CreateStatusList'
|
|
4
|
-
import { CreateStatusList1693866470002 } from '../sqlite/1693866470000-CreateStatusList'
|
|
5
|
-
|
|
6
|
-
const debug = Debug('sphereon:ssi-sdk:migrations')
|
|
7
|
-
|
|
8
|
-
export class CreateStatusList1693866470000 implements MigrationInterface {
|
|
9
|
-
name = 'CreateStatusList1693866470000'
|
|
10
|
-
|
|
11
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
12
|
-
debug('migration: creating issuance branding tables')
|
|
13
|
-
const dbType = queryRunner.connection.driver.options.type
|
|
14
|
-
if (dbType === 'postgres') {
|
|
15
|
-
debug('using postgres migration file')
|
|
16
|
-
const mig = new CreateStatusList1693866470001()
|
|
17
|
-
const up = await mig.up(queryRunner)
|
|
18
|
-
debug('Migration statements executed')
|
|
19
|
-
return up
|
|
20
|
-
} else if (dbType === 'sqlite' || dbType === 'react-native' || dbType === 'expo') {
|
|
21
|
-
debug('using sqlite/react-native migration file')
|
|
22
|
-
const mig = new CreateStatusList1693866470002()
|
|
23
|
-
const up = await mig.up(queryRunner)
|
|
24
|
-
debug('Migration statements executed')
|
|
25
|
-
return up
|
|
26
|
-
} else {
|
|
27
|
-
return Promise.reject(
|
|
28
|
-
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
34
|
-
debug('migration: reverting issuance branding tables')
|
|
35
|
-
const dbType = queryRunner.connection.driver.options.type
|
|
36
|
-
if (dbType === 'postgres') {
|
|
37
|
-
debug('using postgres migration file')
|
|
38
|
-
const mig = new CreateStatusList1693866470002()
|
|
39
|
-
const down = await mig.down(queryRunner)
|
|
40
|
-
debug('Migration statements executed')
|
|
41
|
-
return down
|
|
42
|
-
} else if (dbType === 'sqlite' || dbType === 'react-native' || dbType === 'expo') {
|
|
43
|
-
debug('using sqlite/react-native migration file')
|
|
44
|
-
const mig = new CreateStatusList1693866470002()
|
|
45
|
-
const down = await mig.down(queryRunner)
|
|
46
|
-
debug('Migration statements executed')
|
|
47
|
-
return down
|
|
48
|
-
} else {
|
|
49
|
-
return Promise.reject(
|
|
50
|
-
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
import Debug from 'debug'
|
|
2
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
|
+
import { CreateStatusList1693866470001 } from '../postgres/1693866470001-CreateStatusList'
|
|
4
|
+
import { CreateStatusList1693866470002 } from '../sqlite/1693866470000-CreateStatusList'
|
|
5
|
+
|
|
6
|
+
const debug = Debug('sphereon:ssi-sdk:migrations')
|
|
7
|
+
|
|
8
|
+
export class CreateStatusList1693866470000 implements MigrationInterface {
|
|
9
|
+
name = 'CreateStatusList1693866470000'
|
|
10
|
+
|
|
11
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
12
|
+
debug('migration: creating issuance branding tables')
|
|
13
|
+
const dbType = queryRunner.connection.driver.options.type
|
|
14
|
+
if (dbType === 'postgres') {
|
|
15
|
+
debug('using postgres migration file')
|
|
16
|
+
const mig = new CreateStatusList1693866470001()
|
|
17
|
+
const up = await mig.up(queryRunner)
|
|
18
|
+
debug('Migration statements executed')
|
|
19
|
+
return up
|
|
20
|
+
} else if (dbType === 'sqlite' || dbType === 'react-native' || dbType === 'expo') {
|
|
21
|
+
debug('using sqlite/react-native migration file')
|
|
22
|
+
const mig = new CreateStatusList1693866470002()
|
|
23
|
+
const up = await mig.up(queryRunner)
|
|
24
|
+
debug('Migration statements executed')
|
|
25
|
+
return up
|
|
26
|
+
} else {
|
|
27
|
+
return Promise.reject(
|
|
28
|
+
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
34
|
+
debug('migration: reverting issuance branding tables')
|
|
35
|
+
const dbType = queryRunner.connection.driver.options.type
|
|
36
|
+
if (dbType === 'postgres') {
|
|
37
|
+
debug('using postgres migration file')
|
|
38
|
+
const mig = new CreateStatusList1693866470002()
|
|
39
|
+
const down = await mig.down(queryRunner)
|
|
40
|
+
debug('Migration statements executed')
|
|
41
|
+
return down
|
|
42
|
+
} else if (dbType === 'sqlite' || dbType === 'react-native' || dbType === 'expo') {
|
|
43
|
+
debug('using sqlite/react-native migration file')
|
|
44
|
+
const mig = new CreateStatusList1693866470002()
|
|
45
|
+
const down = await mig.down(queryRunner)
|
|
46
|
+
debug('Migration statements executed')
|
|
47
|
+
return down
|
|
48
|
+
} else {
|
|
49
|
+
return Promise.reject(
|
|
50
|
+
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
-
import Debug, { Debugger } from 'debug'
|
|
3
|
-
import { CreateAuditEvents1701634819487 } from '../sqlite/1701634819487-CreateAuditEvents'
|
|
4
|
-
import { CreateAuditEvents1701634812183 } from '../postgres/1701634812183-CreateAuditEvents'
|
|
5
|
-
|
|
6
|
-
const debug: Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
7
|
-
|
|
8
|
-
export class CreateAuditEvents1701635835330 implements MigrationInterface {
|
|
9
|
-
name: string = 'CreateAuditEvents1701635835330'
|
|
10
|
-
|
|
11
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
12
|
-
debug('migration: creating audit events 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: CreateAuditEvents1701634812183 = new CreateAuditEvents1701634812183()
|
|
19
|
-
await mig.up(queryRunner)
|
|
20
|
-
debug('Migration statements executed')
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
case 'sqlite':
|
|
24
|
-
case 'expo':
|
|
25
|
-
case 'react-native': {
|
|
26
|
-
debug('using sqlite/react-native migration file')
|
|
27
|
-
const mig: CreateAuditEvents1701634819487 = new CreateAuditEvents1701634819487()
|
|
28
|
-
await mig.up(queryRunner)
|
|
29
|
-
debug('Migration statements executed')
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
default:
|
|
33
|
-
return Promise.reject(
|
|
34
|
-
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
40
|
-
debug('migration: reverting audit events tables')
|
|
41
|
-
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
42
|
-
|
|
43
|
-
switch (dbType) {
|
|
44
|
-
case 'postgres': {
|
|
45
|
-
debug('using postgres migration file')
|
|
46
|
-
const mig: CreateAuditEvents1701634812183 = new CreateAuditEvents1701634812183()
|
|
47
|
-
await mig.down(queryRunner)
|
|
48
|
-
debug('Migration statements executed')
|
|
49
|
-
return
|
|
50
|
-
}
|
|
51
|
-
case 'sqlite':
|
|
52
|
-
case 'expo':
|
|
53
|
-
case 'react-native': {
|
|
54
|
-
debug('using sqlite/react-native migration file')
|
|
55
|
-
const mig: CreateAuditEvents1701634819487 = new CreateAuditEvents1701634819487()
|
|
56
|
-
await mig.down(queryRunner)
|
|
57
|
-
debug('Migration statements executed')
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
default:
|
|
61
|
-
return Promise.reject(
|
|
62
|
-
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
1
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
import Debug, { Debugger } from 'debug'
|
|
3
|
+
import { CreateAuditEvents1701634819487 } from '../sqlite/1701634819487-CreateAuditEvents'
|
|
4
|
+
import { CreateAuditEvents1701634812183 } from '../postgres/1701634812183-CreateAuditEvents'
|
|
5
|
+
|
|
6
|
+
const debug: Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
7
|
+
|
|
8
|
+
export class CreateAuditEvents1701635835330 implements MigrationInterface {
|
|
9
|
+
name: string = 'CreateAuditEvents1701635835330'
|
|
10
|
+
|
|
11
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
12
|
+
debug('migration: creating audit events 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: CreateAuditEvents1701634812183 = new CreateAuditEvents1701634812183()
|
|
19
|
+
await mig.up(queryRunner)
|
|
20
|
+
debug('Migration statements executed')
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
case 'sqlite':
|
|
24
|
+
case 'expo':
|
|
25
|
+
case 'react-native': {
|
|
26
|
+
debug('using sqlite/react-native migration file')
|
|
27
|
+
const mig: CreateAuditEvents1701634819487 = new CreateAuditEvents1701634819487()
|
|
28
|
+
await mig.up(queryRunner)
|
|
29
|
+
debug('Migration statements executed')
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
default:
|
|
33
|
+
return Promise.reject(
|
|
34
|
+
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
40
|
+
debug('migration: reverting audit events tables')
|
|
41
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
42
|
+
|
|
43
|
+
switch (dbType) {
|
|
44
|
+
case 'postgres': {
|
|
45
|
+
debug('using postgres migration file')
|
|
46
|
+
const mig: CreateAuditEvents1701634812183 = new CreateAuditEvents1701634812183()
|
|
47
|
+
await mig.down(queryRunner)
|
|
48
|
+
debug('Migration statements executed')
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
case 'sqlite':
|
|
52
|
+
case 'expo':
|
|
53
|
+
case 'react-native': {
|
|
54
|
+
debug('using sqlite/react-native migration file')
|
|
55
|
+
const mig: CreateAuditEvents1701634819487 = new CreateAuditEvents1701634819487()
|
|
56
|
+
await mig.down(queryRunner)
|
|
57
|
+
debug('Migration statements executed')
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
default:
|
|
61
|
+
return Promise.reject(
|
|
62
|
+
`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { CreateContacts1659463079429 } from './1-CreateContacts'
|
|
2
|
-
import { CreateIssuanceBranding1659463079429 } from './2-CreateIssuanceBranding'
|
|
3
|
-
import { CreateContacts1690925872318 } from './3-CreateContacts'
|
|
4
|
-
import { CreateStatusList1693866470000 } from './4-CreateStatusList'
|
|
5
|
-
import { CreateAuditEvents1701635835330 } from './5-CreateAuditEvents'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The migrations array that SHOULD be used when initializing a TypeORM database connection.
|
|
9
|
-
*
|
|
10
|
-
* These ensure the correct creation of tables and the proper migrations of data when tables change between versions.
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
// Individual migrations per purpose. Allows parties to not run migrations and thus create/update tables if they are not using a particular feature (yet)
|
|
16
|
-
export const DataStoreContactMigrations = [CreateContacts1659463079429, CreateContacts1690925872318]
|
|
17
|
-
export const DataStoreIssuanceBrandingMigrations = [CreateIssuanceBranding1659463079429]
|
|
18
|
-
export const DataStoreStatusListMigrations = [CreateStatusList1693866470000]
|
|
19
|
-
export const DataStoreEventLoggerMigrations = [CreateAuditEvents1701635835330]
|
|
20
|
-
|
|
21
|
-
// All migrations together
|
|
22
|
-
export const DataStoreMigrations = [
|
|
23
|
-
...DataStoreContactMigrations,
|
|
24
|
-
...DataStoreIssuanceBrandingMigrations,
|
|
25
|
-
...DataStoreStatusListMigrations,
|
|
26
|
-
...DataStoreEventLoggerMigrations,
|
|
27
|
-
]
|
|
1
|
+
import { CreateContacts1659463079429 } from './1-CreateContacts'
|
|
2
|
+
import { CreateIssuanceBranding1659463079429 } from './2-CreateIssuanceBranding'
|
|
3
|
+
import { CreateContacts1690925872318 } from './3-CreateContacts'
|
|
4
|
+
import { CreateStatusList1693866470000 } from './4-CreateStatusList'
|
|
5
|
+
import { CreateAuditEvents1701635835330 } from './5-CreateAuditEvents'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The migrations array that SHOULD be used when initializing a TypeORM database connection.
|
|
9
|
+
*
|
|
10
|
+
* These ensure the correct creation of tables and the proper migrations of data when tables change between versions.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// Individual migrations per purpose. Allows parties to not run migrations and thus create/update tables if they are not using a particular feature (yet)
|
|
16
|
+
export const DataStoreContactMigrations = [CreateContacts1659463079429, CreateContacts1690925872318]
|
|
17
|
+
export const DataStoreIssuanceBrandingMigrations = [CreateIssuanceBranding1659463079429]
|
|
18
|
+
export const DataStoreStatusListMigrations = [CreateStatusList1693866470000]
|
|
19
|
+
export const DataStoreEventLoggerMigrations = [CreateAuditEvents1701635835330]
|
|
20
|
+
|
|
21
|
+
// All migrations together
|
|
22
|
+
export const DataStoreMigrations = [
|
|
23
|
+
...DataStoreContactMigrations,
|
|
24
|
+
...DataStoreIssuanceBrandingMigrations,
|
|
25
|
+
...DataStoreStatusListMigrations,
|
|
26
|
+
...DataStoreEventLoggerMigrations,
|
|
27
|
+
]
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
-
|
|
3
|
-
export class CreateStatusList1693866470001 implements MigrationInterface {
|
|
4
|
-
name = 'CreateStatusList1693866470001'
|
|
5
|
-
|
|
6
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
-
await queryRunner.query(
|
|
8
|
-
`CREATE TABLE "StatusListEntry" ("statusListId" character varying NOT NULL, "statusListIndex" integer NOT NULL, "credentialId" character varying, "credentialHash" character varying(128), "correlationId" character varying(255), "value" character varying(50), CONSTRAINT "PK_68704d2d13857360c6b44a3d1d0" PRIMARY KEY ("statusListId", "statusListIndex"))`
|
|
9
|
-
)
|
|
10
|
-
await queryRunner.query(`CREATE TYPE "public"."StatusList_type_enum" AS ENUM('StatusList2021')`)
|
|
11
|
-
await queryRunner.query(
|
|
12
|
-
`CREATE TYPE "public"."StatusList_drivertype_enum" AS ENUM('agent_typeorm', 'agent_kv_store', 'github', 'agent_filesystem')`
|
|
13
|
-
)
|
|
14
|
-
await queryRunner.query(`CREATE TYPE "public"."StatusList_credentialidmode_enum" AS ENUM('ISSUANCE', 'PERSISTENCE', 'NEVER')`)
|
|
15
|
-
await queryRunner.query(
|
|
16
|
-
`CREATE TABLE "StatusList" ("id" character varying NOT NULL, "correlationId" character varying NOT NULL, "length" integer NOT NULL, "issuer" text NOT NULL, "type" "public"."StatusList_type_enum" NOT NULL DEFAULT 'StatusList2021', "driverType" "public"."StatusList_drivertype_enum" NOT NULL DEFAULT 'agent_typeorm', "credentialIdMode" "public"."StatusList_credentialidmode_enum" NOT NULL DEFAULT 'ISSUANCE', "proofFormat" character varying NOT NULL DEFAULT 'lds', "indexingDirection" character varying NOT NULL DEFAULT 'rightToLeft', "statusPurpose" character varying NOT NULL DEFAULT 'revocation', "statusListCredential" text, CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId"), CONSTRAINT "PK_StatusList_Id" PRIMARY KEY ("id"))`
|
|
17
|
-
)
|
|
18
|
-
await queryRunner.query(
|
|
19
|
-
`ALTER TABLE "StatusListEntry" ADD CONSTRAINT "FK_statusListEntry_statusListId" FOREIGN KEY ("statusListId") REFERENCES "StatusList"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public async down(queryRunner: QueryRunner): Promise<void> {}
|
|
24
|
-
}
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class CreateStatusList1693866470001 implements MigrationInterface {
|
|
4
|
+
name = 'CreateStatusList1693866470001'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`CREATE TABLE "StatusListEntry" ("statusListId" character varying NOT NULL, "statusListIndex" integer NOT NULL, "credentialId" character varying, "credentialHash" character varying(128), "correlationId" character varying(255), "value" character varying(50), CONSTRAINT "PK_68704d2d13857360c6b44a3d1d0" PRIMARY KEY ("statusListId", "statusListIndex"))`
|
|
9
|
+
)
|
|
10
|
+
await queryRunner.query(`CREATE TYPE "public"."StatusList_type_enum" AS ENUM('StatusList2021')`)
|
|
11
|
+
await queryRunner.query(
|
|
12
|
+
`CREATE TYPE "public"."StatusList_drivertype_enum" AS ENUM('agent_typeorm', 'agent_kv_store', 'github', 'agent_filesystem')`
|
|
13
|
+
)
|
|
14
|
+
await queryRunner.query(`CREATE TYPE "public"."StatusList_credentialidmode_enum" AS ENUM('ISSUANCE', 'PERSISTENCE', 'NEVER')`)
|
|
15
|
+
await queryRunner.query(
|
|
16
|
+
`CREATE TABLE "StatusList" ("id" character varying NOT NULL, "correlationId" character varying NOT NULL, "length" integer NOT NULL, "issuer" text NOT NULL, "type" "public"."StatusList_type_enum" NOT NULL DEFAULT 'StatusList2021', "driverType" "public"."StatusList_drivertype_enum" NOT NULL DEFAULT 'agent_typeorm', "credentialIdMode" "public"."StatusList_credentialidmode_enum" NOT NULL DEFAULT 'ISSUANCE', "proofFormat" character varying NOT NULL DEFAULT 'lds', "indexingDirection" character varying NOT NULL DEFAULT 'rightToLeft', "statusPurpose" character varying NOT NULL DEFAULT 'revocation', "statusListCredential" text, CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId"), CONSTRAINT "PK_StatusList_Id" PRIMARY KEY ("id"))`
|
|
17
|
+
)
|
|
18
|
+
await queryRunner.query(
|
|
19
|
+
`ALTER TABLE "StatusListEntry" ADD CONSTRAINT "FK_statusListEntry_statusListId" FOREIGN KEY ("statusListId") REFERENCES "StatusList"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public async down(queryRunner: QueryRunner): Promise<void> {}
|
|
24
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
-
|
|
3
|
-
export class CreateAuditEvents1701634812183 implements MigrationInterface {
|
|
4
|
-
name = 'CreateAuditEvents1701634812183'
|
|
5
|
-
|
|
6
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
-
await queryRunner.query(`CREATE TYPE "public"."Level_enum" AS ENUM('0', '1', '2', '3')`)
|
|
8
|
-
await queryRunner.query(
|
|
9
|
-
`CREATE TYPE "public"."System_enum" AS ENUM('general', 'kms', 'identity', 'oid4vci', 'credentials', 'web3', 'profile', 'contact')`
|
|
10
|
-
)
|
|
11
|
-
await queryRunner.query(
|
|
12
|
-
`CREATE TYPE "public"."Subsystem_type_enum" AS ENUM('key', 'did_provider', 'did_resolver', 'oid4vp_op', 'oid4vci_client', 'siopv2_op', 'contact_manager', 'vc_issuer', 'vc_verifier', 'vc_persistence', 'transport', 'profile')`
|
|
13
|
-
)
|
|
14
|
-
await queryRunner.query(`CREATE TYPE "public"."Action_type_enum" AS ENUM('create', 'read', 'update', 'delete', 'execute')`)
|
|
15
|
-
await queryRunner.query(`CREATE TYPE "public"."Initiator_type_enum" AS ENUM('user', 'system', 'external')`)
|
|
16
|
-
await queryRunner.query(`CREATE TYPE "public"."System_correlation_id_type_enum" AS ENUM('did', 'email', 'hostname', 'phone', 'user')`)
|
|
17
|
-
await queryRunner.query(`CREATE TYPE "public"."Party_correlation_type_enum" AS ENUM('did', 'email', 'hostname', 'phone')`)
|
|
18
|
-
await queryRunner.query(
|
|
19
|
-
`CREATE TABLE "AuditEvents" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "timestamp" TIMESTAMP NOT NULL, "level" "public"."Level_enum" NOT NULL, "correlationId" TEXT NOT NULL, "system" "public"."System_enum" NOT NULL, "subSystemType" "public"."Subsystem_type_enum" NOT NULL, "actionType" "public"."Action_type_enum" NOT NULL, "actionSubType" TEXT NOT NULL, "initiatorType" "public"."Initiator_type_enum" NOT NULL, "systemCorrelationIdType" "public"."System_correlation_id_type_enum", "systemCorrelationId" TEXT, "systemAlias" TEXT NOT NULL, "partyCorrelationType" "public"."Party_correlation_type_enum", "partyCorrelationId" TEXT, "partyAlias" TEXT, "description" TEXT NOT NULL, "data" TEXT, "diagnosticData" TEXT, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_AuditEvents_id" PRIMARY KEY ("id"))`
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
24
|
-
await queryRunner.query(`DROP TABLE "AuditEvents"`)
|
|
25
|
-
await queryRunner.query(`DROP TYPE "public"."Party_correlation_type_enum`)
|
|
26
|
-
await queryRunner.query(`DROP TYPE "public"."System_correlation_id_type_enum`)
|
|
27
|
-
await queryRunner.query(`DROP TYPE "public"."Initiator_type_enum`)
|
|
28
|
-
await queryRunner.query(`DROP TYPE "public"."Action_type_enum`)
|
|
29
|
-
await queryRunner.query(`DROP TYPE "public"."Subsystem_type_enum`)
|
|
30
|
-
await queryRunner.query(`DROP TYPE "public"."System_enum`)
|
|
31
|
-
await queryRunner.query(`DROP TYPE "public"."Level_enum`)
|
|
32
|
-
}
|
|
33
|
-
}
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class CreateAuditEvents1701634812183 implements MigrationInterface {
|
|
4
|
+
name = 'CreateAuditEvents1701634812183'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`CREATE TYPE "public"."Level_enum" AS ENUM('0', '1', '2', '3')`)
|
|
8
|
+
await queryRunner.query(
|
|
9
|
+
`CREATE TYPE "public"."System_enum" AS ENUM('general', 'kms', 'identity', 'oid4vci', 'credentials', 'web3', 'profile', 'contact')`
|
|
10
|
+
)
|
|
11
|
+
await queryRunner.query(
|
|
12
|
+
`CREATE TYPE "public"."Subsystem_type_enum" AS ENUM('key', 'did_provider', 'did_resolver', 'oid4vp_op', 'oid4vci_client', 'siopv2_op', 'contact_manager', 'vc_issuer', 'vc_verifier', 'vc_persistence', 'transport', 'profile')`
|
|
13
|
+
)
|
|
14
|
+
await queryRunner.query(`CREATE TYPE "public"."Action_type_enum" AS ENUM('create', 'read', 'update', 'delete', 'execute')`)
|
|
15
|
+
await queryRunner.query(`CREATE TYPE "public"."Initiator_type_enum" AS ENUM('user', 'system', 'external')`)
|
|
16
|
+
await queryRunner.query(`CREATE TYPE "public"."System_correlation_id_type_enum" AS ENUM('did', 'email', 'hostname', 'phone', 'user')`)
|
|
17
|
+
await queryRunner.query(`CREATE TYPE "public"."Party_correlation_type_enum" AS ENUM('did', 'email', 'hostname', 'phone')`)
|
|
18
|
+
await queryRunner.query(
|
|
19
|
+
`CREATE TABLE "AuditEvents" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "timestamp" TIMESTAMP NOT NULL, "level" "public"."Level_enum" NOT NULL, "correlationId" TEXT NOT NULL, "system" "public"."System_enum" NOT NULL, "subSystemType" "public"."Subsystem_type_enum" NOT NULL, "actionType" "public"."Action_type_enum" NOT NULL, "actionSubType" TEXT NOT NULL, "initiatorType" "public"."Initiator_type_enum" NOT NULL, "systemCorrelationIdType" "public"."System_correlation_id_type_enum", "systemCorrelationId" TEXT, "systemAlias" TEXT NOT NULL, "partyCorrelationType" "public"."Party_correlation_type_enum", "partyCorrelationId" TEXT, "partyAlias" TEXT, "description" TEXT NOT NULL, "data" TEXT, "diagnosticData" TEXT, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_AuditEvents_id" PRIMARY KEY ("id"))`
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
24
|
+
await queryRunner.query(`DROP TABLE "AuditEvents"`)
|
|
25
|
+
await queryRunner.query(`DROP TYPE "public"."Party_correlation_type_enum`)
|
|
26
|
+
await queryRunner.query(`DROP TYPE "public"."System_correlation_id_type_enum`)
|
|
27
|
+
await queryRunner.query(`DROP TYPE "public"."Initiator_type_enum`)
|
|
28
|
+
await queryRunner.query(`DROP TYPE "public"."Action_type_enum`)
|
|
29
|
+
await queryRunner.query(`DROP TYPE "public"."Subsystem_type_enum`)
|
|
30
|
+
await queryRunner.query(`DROP TYPE "public"."System_enum`)
|
|
31
|
+
await queryRunner.query(`DROP TYPE "public"."Level_enum`)
|
|
32
|
+
}
|
|
33
|
+
}
|