@sphereon/ssi-sdk.data-store 0.34.1-next.3 → 0.34.1-next.322
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/index.cjs +3377 -2924
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +357 -1203
- package/dist/index.d.ts +357 -1203
- package/dist/index.js +3300 -2847
- package/dist/index.js.map +1 -1
- package/package.json +10 -9
- package/src/__tests__/contact.entities.test.ts +4 -10
- package/src/__tests__/contact.store.test.ts +11 -6
- package/src/__tests__/digitalCredential.entities.test.ts +13 -6
- package/src/__tests__/digitalCredential.store.test.ts +6 -6
- package/src/__tests__/eventLogger.entities.test.ts +3 -3
- package/src/__tests__/eventLogger.store.test.ts +9 -4
- package/src/__tests__/issuanceBranding.entities.test.ts +2 -2
- package/src/__tests__/issuanceBranding.store.test.ts +3 -3
- package/src/__tests__/machineState.entities.test.ts +1 -1
- package/src/__tests__/machineState.store.test.ts +1 -1
- package/src/__tests__/pd-manager.entities.test.ts +27 -98
- package/src/__tests__/pd-manager.store.test.ts +151 -101
- package/src/__tests__/statusList.entities.test.ts +61 -4
- package/src/__tests__/statusList.store.test.ts +67 -4
- package/src/contact/ContactStore.ts +35 -35
- package/src/digitalCredential/DigitalCredentialStore.ts +6 -7
- package/src/entities/contact/BaseConfigEntity.ts +2 -2
- package/src/entities/contact/BaseContactEntity.ts +4 -5
- package/src/entities/contact/ConnectionEntity.ts +4 -4
- package/src/entities/contact/ContactMetadataItemEntity.ts +3 -4
- package/src/entities/contact/CorrelationIdentifierEntity.ts +3 -4
- package/src/entities/contact/DidAuthConfigEntity.ts +1 -2
- package/src/entities/contact/ElectronicAddressEntity.ts +15 -5
- package/src/entities/contact/IdentityEntity.ts +12 -11
- package/src/entities/contact/IdentityMetadataItemEntity.ts +3 -3
- package/src/entities/contact/NaturalPersonEntity.ts +5 -5
- package/src/entities/contact/OrganizationEntity.ts +1 -1
- package/src/entities/contact/PartyEntity.ts +7 -7
- package/src/entities/contact/PartyRelationshipEntity.ts +8 -8
- package/src/entities/contact/PartyTypeEntity.ts +4 -4
- package/src/entities/contact/PhysicalAddressEntity.ts +3 -3
- package/src/entities/digitalCredential/DigitalCredentialEntity.ts +4 -3
- package/src/entities/eventLogger/AuditEventEntity.ts +2 -2
- package/src/entities/issuanceBranding/BackgroundAttributesEntity.ts +2 -2
- package/src/entities/issuanceBranding/BaseLocaleBrandingEntity.ts +6 -7
- package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +2 -2
- package/src/entities/issuanceBranding/CredentialClaimsEntity.ts +2 -2
- package/src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts +2 -2
- package/src/entities/issuanceBranding/ImageAttributesEntity.ts +2 -2
- package/src/entities/issuanceBranding/IssuerBrandingEntity.ts +2 -2
- package/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts +3 -3
- package/src/entities/issuanceBranding/TextAttributesEntity.ts +1 -1
- package/src/entities/machineState/MachineStateInfoEntity.ts +1 -1
- package/src/entities/presentationDefinition/{PresentationDefinitionItemEntity.ts → DcqlQueryItemEntity.ts} +10 -14
- package/src/entities/statusList/BitstringStatusListEntryEntity.ts +60 -0
- package/src/entities/statusList/StatusList2021EntryEntity.ts +4 -3
- package/src/entities/statusList/StatusListEntities.ts +55 -7
- package/src/eventLogger/EventLoggerStore.ts +2 -2
- package/src/index.ts +31 -26
- package/src/issuanceBranding/IssuanceBrandingStore.ts +25 -25
- package/src/machineState/MachineStateStore.ts +7 -7
- package/src/migrations/generic/1-CreateContacts.ts +1 -1
- package/src/migrations/generic/10-CreatePresentationDefinitions.ts +1 -1
- package/src/migrations/generic/11-FixCredentialClaimsReferenceUuid.ts +2 -2
- package/src/migrations/generic/12-CreateBitstringStatusList.ts +82 -0
- package/src/migrations/generic/13-CreateDcqlQueryItem.ts +67 -0
- package/src/migrations/generic/2-CreateIssuanceBranding.ts +1 -1
- package/src/migrations/generic/3-CreateContacts.ts +2 -2
- package/src/migrations/generic/4-CreateStatusList.ts +1 -1
- package/src/migrations/generic/5-CreateAuditEvents.ts +2 -2
- package/src/migrations/generic/6-CreateDigitalCredential.ts +1 -1
- package/src/migrations/generic/7-CreateMachineStateStore.ts +1 -1
- package/src/migrations/generic/8-CreateContacts.ts +1 -1
- package/src/migrations/generic/9-CreateContacts.ts +1 -1
- package/src/migrations/generic/index.ts +10 -4
- package/src/migrations/postgres/1659463079428-CreateContacts.ts +1 -1
- package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +1 -1
- package/src/migrations/postgres/1690925872592-CreateContacts.ts +1 -1
- package/src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts +1 -1
- package/src/migrations/postgres/1726588800000-CreateDcqlQueryItem.ts +25 -0
- package/src/migrations/postgres/1737110469001-UpdateStatusList.ts +1 -1
- package/src/migrations/postgres/1741895823000-CreateBitstringStatusList.ts +67 -0
- package/src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts +1 -1
- package/src/migrations/sqlite/1726617600000-CreateDcqlQueryItem.ts +24 -0
- package/src/migrations/sqlite/1741895823001-CreateBitstringStatusList.ts +145 -0
- package/src/presentationDefinition/PDStore.ts +45 -45
- package/src/statusList/IStatusListStore.ts +14 -11
- package/src/statusList/StatusListStore.ts +74 -36
- package/src/types/index.ts +0 -12
- package/src/types/statusList/IAbstractStatusListStore.ts +55 -5
- package/src/types/statusList/statusList.ts +50 -2
- package/src/utils/ValidatorUtils.ts +1 -1
- package/src/utils/contact/MappingUtils.ts +10 -10
- package/src/utils/digitalCredential/MappingUtils.ts +3 -21
- package/src/utils/eventLogger/MappingUtils.ts +2 -2
- package/src/utils/issuanceBranding/MappingUtils.ts +13 -13
- package/src/utils/presentationDefinition/MappingUtils.ts +31 -22
- package/src/utils/statusList/MappingUtils.ts +71 -30
- package/src/contact/AbstractContactStore.ts +0 -71
- package/src/digitalCredential/AbstractDigitalCredentialStore.ts +0 -21
- package/src/eventLogger/AbstractEventLoggerStore.ts +0 -9
- package/src/issuanceBranding/AbstractIssuanceBrandingStore.ts +0 -41
- package/src/machineState/IAbstractMachineStateStore.ts +0 -65
- package/src/presentationDefinition/AbstractPDStore.ts +0 -20
- package/src/types/contact/IAbstractContactStore.ts +0 -161
- package/src/types/contact/contact.ts +0 -295
- package/src/types/contact/index.ts +0 -2
- package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +0 -43
- package/src/types/digitalCredential/enums.ts +0 -70
- package/src/types/digitalCredential/index.ts +0 -3
- package/src/types/digitalCredential/types.ts +0 -39
- package/src/types/eventLogger/IAbstractEventLoggerStore.ts +0 -22
- package/src/types/eventLogger/eventLogger.ts +0 -4
- package/src/types/issuanceBranding/IAbstractIssuanceBrandingStore.ts +0 -85
- package/src/types/issuanceBranding/issuanceBranding.ts +0 -138
- package/src/types/machineState/IAbstractMachineStateStore.ts +0 -68
- package/src/types/presentationDefinition/IAbstractPDStore.ts +0 -25
- package/src/types/presentationDefinition/presentationDefinition.ts +0 -19
- package/src/types/validation/validation.ts +0 -3
package/src/index.ts
CHANGED
|
@@ -1,52 +1,48 @@
|
|
|
1
1
|
import { BaseConfigEntity } from './entities/contact/BaseConfigEntity'
|
|
2
|
-
import { BaseLocaleBrandingEntity } from './entities/issuanceBranding/BaseLocaleBrandingEntity'
|
|
3
2
|
import { BaseContactEntity } from './entities/contact/BaseContactEntity'
|
|
4
3
|
import { ConnectionEntity } from './entities/contact/ConnectionEntity'
|
|
5
|
-
import {
|
|
4
|
+
import { ContactMetadataItemEntity } from './entities/contact/ContactMetadataItemEntity'
|
|
6
5
|
import { CorrelationIdentifierEntity } from './entities/contact/CorrelationIdentifierEntity'
|
|
7
6
|
import { DidAuthConfigEntity } from './entities/contact/DidAuthConfigEntity'
|
|
7
|
+
import { ElectronicAddressEntity } from './entities/contact/ElectronicAddressEntity'
|
|
8
8
|
import { IdentityEntity } from './entities/contact/IdentityEntity'
|
|
9
9
|
import { IdentityMetadataItemEntity } from './entities/contact/IdentityMetadataItemEntity'
|
|
10
|
+
import { NaturalPersonEntity } from './entities/contact/NaturalPersonEntity'
|
|
10
11
|
import { OpenIdConfigEntity } from './entities/contact/OpenIdConfigEntity'
|
|
12
|
+
import { OrganizationEntity } from './entities/contact/OrganizationEntity'
|
|
13
|
+
import { PartyEntity } from './entities/contact/PartyEntity'
|
|
14
|
+
// import { IStatusListEntity, IStatusListEntryEntity } from './types.'
|
|
15
|
+
import { PartyRelationshipEntity } from './entities/contact/PartyRelationshipEntity'
|
|
16
|
+
import { PartyTypeEntity } from './entities/contact/PartyTypeEntity'
|
|
17
|
+
import { PhysicalAddressEntity } from './entities/contact/PhysicalAddressEntity'
|
|
18
|
+
import { DigitalCredentialEntity } from './entities/digitalCredential/DigitalCredentialEntity'
|
|
19
|
+
import { AuditEventEntity } from './entities/eventLogger/AuditEventEntity'
|
|
11
20
|
import { BackgroundAttributesEntity } from './entities/issuanceBranding/BackgroundAttributesEntity'
|
|
21
|
+
import { BaseLocaleBrandingEntity } from './entities/issuanceBranding/BaseLocaleBrandingEntity'
|
|
12
22
|
import { CredentialBrandingEntity } from './entities/issuanceBranding/CredentialBrandingEntity'
|
|
23
|
+
import { CredentialClaimsEntity } from './entities/issuanceBranding/CredentialClaimsEntity'
|
|
13
24
|
import { CredentialLocaleBrandingEntity } from './entities/issuanceBranding/CredentialLocaleBrandingEntity'
|
|
14
25
|
import { ImageAttributesEntity } from './entities/issuanceBranding/ImageAttributesEntity'
|
|
15
26
|
import { ImageDimensionsEntity } from './entities/issuanceBranding/ImageDimensionsEntity'
|
|
16
|
-
import { IssuerLocaleBrandingEntity } from './entities/issuanceBranding/IssuerLocaleBrandingEntity'
|
|
17
27
|
import { IssuerBrandingEntity } from './entities/issuanceBranding/IssuerBrandingEntity'
|
|
28
|
+
import { IssuerLocaleBrandingEntity } from './entities/issuanceBranding/IssuerLocaleBrandingEntity'
|
|
18
29
|
import { TextAttributesEntity } from './entities/issuanceBranding/TextAttributesEntity'
|
|
19
|
-
import { OAuthStatusListEntity, StatusList2021Entity, StatusListEntity } from './entities/statusList/StatusListEntities'
|
|
20
|
-
import { StatusListEntryEntity } from './entities/statusList/StatusList2021EntryEntity'
|
|
21
30
|
import { MachineStateInfoEntity } from './entities/machineState/MachineStateInfoEntity'
|
|
22
|
-
// import { IStatusListEntity, IStatusListEntryEntity } from './types.'
|
|
23
|
-
import { PartyRelationshipEntity } from './entities/contact/PartyRelationshipEntity'
|
|
24
|
-
import { PartyTypeEntity } from './entities/contact/PartyTypeEntity'
|
|
25
|
-
import { OrganizationEntity } from './entities/contact/OrganizationEntity'
|
|
26
|
-
import { NaturalPersonEntity } from './entities/contact/NaturalPersonEntity'
|
|
27
|
-
import { ElectronicAddressEntity } from './entities/contact/ElectronicAddressEntity'
|
|
28
|
-
import { PhysicalAddressEntity } from './entities/contact/PhysicalAddressEntity'
|
|
29
|
-
import { AuditEventEntity } from './entities/eventLogger/AuditEventEntity'
|
|
30
|
-
import { DigitalCredentialEntity } from './entities/digitalCredential/DigitalCredentialEntity'
|
|
31
|
-
import { PresentationDefinitionItemEntity } from './entities/presentationDefinition/PresentationDefinitionItemEntity'
|
|
32
|
-
import { ContactMetadataItemEntity } from './entities/contact/ContactMetadataItemEntity'
|
|
33
|
-
import { CredentialClaimsEntity } from './entities/issuanceBranding/CredentialClaimsEntity'
|
|
34
31
|
|
|
35
32
|
import { Oid4vcStateEntity } from './entities/oid4vcState/Oid4vcStateEntity'
|
|
33
|
+
import { DcqlQueryItemEntity } from './entities/presentationDefinition/DcqlQueryItemEntity'
|
|
34
|
+
import { BitstringStatusListEntryEntity } from './entities/statusList/BitstringStatusListEntryEntity'
|
|
35
|
+
import { StatusListEntryEntity } from './entities/statusList/StatusList2021EntryEntity'
|
|
36
|
+
import { BitstringStatusListEntity, OAuthStatusListEntity, StatusList2021Entity, StatusListEntity } from './entities/statusList/StatusListEntities'
|
|
36
37
|
// import {PartyCorrelationType} from "@sphereon/ssi-sdk.core";
|
|
37
38
|
|
|
38
39
|
export { ContactStore } from './contact/ContactStore'
|
|
39
|
-
export { AbstractContactStore } from './contact/AbstractContactStore'
|
|
40
|
-
export { AbstractDigitalCredentialStore } from './digitalCredential/AbstractDigitalCredentialStore'
|
|
41
40
|
export { DigitalCredentialStore } from './digitalCredential/DigitalCredentialStore'
|
|
42
|
-
export { AbstractIssuanceBrandingStore } from './issuanceBranding/AbstractIssuanceBrandingStore'
|
|
43
41
|
export { IssuanceBrandingStore } from './issuanceBranding/IssuanceBrandingStore'
|
|
44
42
|
export { StatusListStore } from './statusList/StatusListStore'
|
|
45
|
-
export { AbstractEventLoggerStore } from '
|
|
43
|
+
export { AbstractEventLoggerStore } from '@sphereon/ssi-sdk.data-store-types'
|
|
46
44
|
export { EventLoggerStore } from './eventLogger/EventLoggerStore'
|
|
47
|
-
export { IAbstractMachineStateStore } from './machineState/IAbstractMachineStateStore'
|
|
48
45
|
export { MachineStateStore } from './machineState/MachineStateStore'
|
|
49
|
-
export { AbstractPDStore } from './presentationDefinition/AbstractPDStore'
|
|
50
46
|
export { PDStore } from './presentationDefinition/PDStore'
|
|
51
47
|
export {
|
|
52
48
|
DataStoreMigrations,
|
|
@@ -98,9 +94,16 @@ export const DataStoreIssuanceBrandingEntities = [
|
|
|
98
94
|
CredentialClaimsEntity,
|
|
99
95
|
]
|
|
100
96
|
|
|
101
|
-
export const DataStorePresentationDefinitionEntities = [
|
|
97
|
+
export const DataStorePresentationDefinitionEntities = [DcqlQueryItemEntity]
|
|
102
98
|
|
|
103
|
-
export const DataStoreStatusListEntities = [
|
|
99
|
+
export const DataStoreStatusListEntities = [
|
|
100
|
+
StatusListEntity,
|
|
101
|
+
StatusList2021Entity,
|
|
102
|
+
OAuthStatusListEntity,
|
|
103
|
+
BitstringStatusListEntity,
|
|
104
|
+
BitstringStatusListEntryEntity,
|
|
105
|
+
StatusListEntryEntity,
|
|
106
|
+
]
|
|
104
107
|
|
|
105
108
|
export const DataStoreEventLoggerEntities = [AuditEventEntity]
|
|
106
109
|
|
|
@@ -143,12 +146,14 @@ export {
|
|
|
143
146
|
PhysicalAddressEntity,
|
|
144
147
|
StatusListEntity,
|
|
145
148
|
StatusListEntryEntity,
|
|
149
|
+
BitstringStatusListEntryEntity,
|
|
146
150
|
OAuthStatusListEntity,
|
|
147
151
|
StatusList2021Entity,
|
|
152
|
+
BitstringStatusListEntity,
|
|
148
153
|
AuditEventEntity,
|
|
149
154
|
DigitalCredentialEntity,
|
|
150
155
|
MachineStateInfoEntity,
|
|
151
|
-
|
|
156
|
+
DcqlQueryItemEntity,
|
|
152
157
|
ContactMetadataItemEntity,
|
|
153
158
|
CredentialClaimsEntity,
|
|
154
159
|
Oid4vcStateEntity,
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
import { type OrPromise } from '@sphereon/ssi-types'
|
|
2
|
-
import Debug from 'debug'
|
|
3
|
-
import { DataSource, type DeleteResult, In, Not, type Repository } from 'typeorm'
|
|
4
|
-
import {
|
|
5
|
-
credentialBrandingEntityFrom,
|
|
6
|
-
credentialBrandingFrom,
|
|
7
|
-
credentialLocaleBrandingEntityFrom,
|
|
8
|
-
issuerBrandingEntityFrom,
|
|
9
|
-
issuerBrandingFrom,
|
|
10
|
-
issuerLocaleBrandingEntityFrom,
|
|
11
|
-
localeBrandingFrom,
|
|
12
|
-
} from '../utils/issuanceBranding/MappingUtils'
|
|
13
|
-
import { BackgroundAttributesEntity } from '../entities/issuanceBranding/BackgroundAttributesEntity'
|
|
14
|
-
import { ImageAttributesEntity } from '../entities/issuanceBranding/ImageAttributesEntity'
|
|
15
|
-
import { ImageDimensionsEntity } from '../entities/issuanceBranding/ImageDimensionsEntity'
|
|
16
|
-
import { IssuerBrandingEntity } from '../entities/issuanceBranding/IssuerBrandingEntity'
|
|
17
|
-
import { CredentialBrandingEntity } from '../entities/issuanceBranding/CredentialBrandingEntity'
|
|
18
|
-
import { CredentialLocaleBrandingEntity } from '../entities/issuanceBranding/CredentialLocaleBrandingEntity'
|
|
19
|
-
import { IssuerLocaleBrandingEntity } from '../entities/issuanceBranding/IssuerLocaleBrandingEntity'
|
|
20
|
-
import { BaseLocaleBrandingEntity } from '../entities/issuanceBranding/BaseLocaleBrandingEntity'
|
|
21
|
-
import { TextAttributesEntity } from '../entities/issuanceBranding/TextAttributesEntity'
|
|
22
|
-
import { AbstractIssuanceBrandingStore } from './AbstractIssuanceBrandingStore'
|
|
23
1
|
import type {
|
|
24
2
|
IAddCredentialBrandingArgs,
|
|
25
3
|
IAddCredentialLocaleBrandingArgs,
|
|
@@ -28,7 +6,7 @@ import type {
|
|
|
28
6
|
IBasicCredentialLocaleBranding,
|
|
29
7
|
IBasicIssuerLocaleBranding,
|
|
30
8
|
ICredentialBranding,
|
|
31
|
-
|
|
9
|
+
ICredentialBrandingFilter,
|
|
32
10
|
ICredentialLocaleBranding,
|
|
33
11
|
ICredentialLocaleBrandingFilter,
|
|
34
12
|
IGetCredentialBrandingArgs,
|
|
@@ -39,6 +17,7 @@ import type {
|
|
|
39
17
|
IIssuerBrandingFilter,
|
|
40
18
|
IIssuerLocaleBranding,
|
|
41
19
|
IIssuerLocaleBrandingFilter,
|
|
20
|
+
IPartialCredentialBranding,
|
|
42
21
|
IRemoveCredentialBrandingArgs,
|
|
43
22
|
IRemoveCredentialLocaleBrandingArgs,
|
|
44
23
|
IRemoveIssuerBrandingArgs,
|
|
@@ -47,8 +26,29 @@ import type {
|
|
|
47
26
|
IUpdateCredentialLocaleBrandingArgs,
|
|
48
27
|
IUpdateIssuerBrandingArgs,
|
|
49
28
|
IUpdateIssuerLocaleBrandingArgs,
|
|
50
|
-
|
|
51
|
-
} from '
|
|
29
|
+
} from '@sphereon/ssi-sdk.data-store-types'
|
|
30
|
+
import { AbstractIssuanceBrandingStore } from '@sphereon/ssi-sdk.data-store-types'
|
|
31
|
+
import { type OrPromise } from '@sphereon/ssi-types'
|
|
32
|
+
import Debug from 'debug'
|
|
33
|
+
import { DataSource, type DeleteResult, In, Not, type Repository } from 'typeorm'
|
|
34
|
+
import { BackgroundAttributesEntity } from '../entities/issuanceBranding/BackgroundAttributesEntity'
|
|
35
|
+
import { BaseLocaleBrandingEntity } from '../entities/issuanceBranding/BaseLocaleBrandingEntity'
|
|
36
|
+
import { CredentialBrandingEntity } from '../entities/issuanceBranding/CredentialBrandingEntity'
|
|
37
|
+
import { CredentialLocaleBrandingEntity } from '../entities/issuanceBranding/CredentialLocaleBrandingEntity'
|
|
38
|
+
import { ImageAttributesEntity } from '../entities/issuanceBranding/ImageAttributesEntity'
|
|
39
|
+
import { ImageDimensionsEntity } from '../entities/issuanceBranding/ImageDimensionsEntity'
|
|
40
|
+
import { IssuerBrandingEntity } from '../entities/issuanceBranding/IssuerBrandingEntity'
|
|
41
|
+
import { IssuerLocaleBrandingEntity } from '../entities/issuanceBranding/IssuerLocaleBrandingEntity'
|
|
42
|
+
import { TextAttributesEntity } from '../entities/issuanceBranding/TextAttributesEntity'
|
|
43
|
+
import {
|
|
44
|
+
credentialBrandingEntityFrom,
|
|
45
|
+
credentialBrandingFrom,
|
|
46
|
+
credentialLocaleBrandingEntityFrom,
|
|
47
|
+
issuerBrandingEntityFrom,
|
|
48
|
+
issuerBrandingFrom,
|
|
49
|
+
issuerLocaleBrandingEntityFrom,
|
|
50
|
+
localeBrandingFrom,
|
|
51
|
+
} from '../utils/issuanceBranding/MappingUtils'
|
|
52
52
|
|
|
53
53
|
const debug: Debug.Debugger = Debug('sphereon:ssi-sdk:issuance-branding-store')
|
|
54
54
|
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { type OrPromise } from '@sphereon/ssi-types'
|
|
2
|
-
import Debug from 'debug'
|
|
3
|
-
import { Brackets, DataSource, type FindOptionsWhere, IsNull, LessThan, Not } from 'typeorm'
|
|
4
|
-
|
|
5
|
-
import { MachineStateInfoEntity } from '../entities/machineState/MachineStateInfoEntity'
|
|
6
1
|
import type {
|
|
7
2
|
StoreFindMachineStatesArgs,
|
|
8
3
|
StoreMachineStateDeleteArgs,
|
|
@@ -11,8 +6,13 @@ import type {
|
|
|
11
6
|
StoreMachineStateInfo,
|
|
12
7
|
StoreMachineStatePersistArgs,
|
|
13
8
|
StoreMachineStatesFindActiveArgs,
|
|
14
|
-
} from '
|
|
15
|
-
import { IAbstractMachineStateStore } from '
|
|
9
|
+
} from '@sphereon/ssi-sdk.data-store-types'
|
|
10
|
+
import { IAbstractMachineStateStore } from '@sphereon/ssi-sdk.data-store-types'
|
|
11
|
+
import { type OrPromise } from '@sphereon/ssi-types'
|
|
12
|
+
import Debug from 'debug'
|
|
13
|
+
import { Brackets, DataSource, type FindOptionsWhere, IsNull, LessThan, Not } from 'typeorm'
|
|
14
|
+
|
|
15
|
+
import { MachineStateInfoEntity } from '../entities/machineState/MachineStateInfoEntity'
|
|
16
16
|
|
|
17
17
|
const debug = Debug('sphereon:ssi-sdk:machine-state:store')
|
|
18
18
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
1
|
import Debug from 'debug'
|
|
2
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
3
|
import { CreateContacts1659463079428 } from '../postgres/1659463079428-CreateContacts'
|
|
4
4
|
import { CreateContacts1659463069549 } from '../sqlite/1659463069549-CreateContacts'
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
1
|
import Debug from 'debug'
|
|
2
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
3
|
import { CreatePresentationDefinitions1716475165345 } from '../postgres/1716475165345-CreatePresentationDefinitions'
|
|
4
4
|
import { CreatePresentationDefinitions1716475165344 } from '../sqlite/1716475165344-CreatePresentationDefinitions'
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
1
|
import Debug from 'debug'
|
|
2
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
3
|
import { CreateIssuanceBranding1685628974232 } from '../postgres/1685628974232-CreateIssuanceBranding'
|
|
4
|
-
import { CreateIssuanceBranding1685628973231 } from '../sqlite/1685628973231-CreateIssuanceBranding'
|
|
5
4
|
import { FixCredentialClaimsReferencesUuidPG1741895822987 } from '../postgres/1741895822987-FixCredentialClaimsReferencesUuid'
|
|
5
|
+
import { CreateIssuanceBranding1685628973231 } from '../sqlite/1685628973231-CreateIssuanceBranding'
|
|
6
6
|
import { FixCredentialClaimsReferencesUuidSqlite1741895822987 } from '../sqlite/1741895822987-FixCredentialClaimsReferencesUuid'
|
|
7
7
|
|
|
8
8
|
const debug: Debug.Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import Debug from 'debug'
|
|
2
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
AddBitstringStatusListEnumPG1741895823000,
|
|
6
|
+
CreateBitstringStatusListPG1741895823000,
|
|
7
|
+
} from '../postgres/1741895823000-CreateBitstringStatusList'
|
|
8
|
+
import { CreateBitstringStatusListSqlite1741895823001 } from '../sqlite/1741895823001-CreateBitstringStatusList'
|
|
9
|
+
|
|
10
|
+
const debug: Debug.Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
11
|
+
|
|
12
|
+
export class AddBitstringStatusListEnum1741895823000 implements MigrationInterface {
|
|
13
|
+
name = 'AddBitstringStatusListEnum1741895823000'
|
|
14
|
+
|
|
15
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
16
|
+
debug('migration: creating bitstring status list tables')
|
|
17
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
18
|
+
switch (dbType) {
|
|
19
|
+
case 'postgres': {
|
|
20
|
+
const mig = new AddBitstringStatusListEnumPG1741895823000()
|
|
21
|
+
await mig.up(queryRunner)
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
case 'sqlite':
|
|
25
|
+
case 'expo':
|
|
26
|
+
case 'react-native': {
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
default:
|
|
30
|
+
return Promise.reject(`Migrations only supported for sqlite and postgres. Was ${dbType}`)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
35
|
+
public async down(queryRunner: QueryRunner): Promise<void> {}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class CreateBitstringStatusList1741895823000 implements MigrationInterface {
|
|
39
|
+
name = 'CreateBitstringStatusList1741895823000'
|
|
40
|
+
|
|
41
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
42
|
+
debug('migration: creating bitstring status list tables')
|
|
43
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
44
|
+
switch (dbType) {
|
|
45
|
+
case 'postgres': {
|
|
46
|
+
const mig = new CreateBitstringStatusListPG1741895823000()
|
|
47
|
+
await mig.up(queryRunner)
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
case 'sqlite':
|
|
51
|
+
case 'expo':
|
|
52
|
+
case 'react-native': {
|
|
53
|
+
const mig = new CreateBitstringStatusListSqlite1741895823001()
|
|
54
|
+
await mig.up(queryRunner)
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
default:
|
|
58
|
+
return Promise.reject(`Migrations only supported for sqlite and postgres. Was ${dbType}`)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
63
|
+
debug('migration: dropping bitstring status list tables')
|
|
64
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
65
|
+
switch (dbType) {
|
|
66
|
+
case 'postgres': {
|
|
67
|
+
const mig = new CreateBitstringStatusListPG1741895823000()
|
|
68
|
+
await mig.down(queryRunner)
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
case 'sqlite':
|
|
72
|
+
case 'expo':
|
|
73
|
+
case 'react-native': {
|
|
74
|
+
const mig = new CreateBitstringStatusListSqlite1741895823001()
|
|
75
|
+
await mig.down(queryRunner)
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
default:
|
|
79
|
+
return Promise.reject(`Migrations only supported for sqlite and postgres. Was ${dbType}`)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import Debug from 'debug'
|
|
2
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import { CreateDcqlQueryItemPG1726588800000 } from '../postgres/1726588800000-CreateDcqlQueryItem'
|
|
5
|
+
import { CreateDcqlQueryItemSQlite1726617600000 } from '../sqlite/1726617600000-CreateDcqlQueryItem'
|
|
6
|
+
|
|
7
|
+
const debug: Debug.Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
8
|
+
|
|
9
|
+
export class CreateDcqlQueryItem1726617600000 implements MigrationInterface {
|
|
10
|
+
name = 'CreateDcqlQueryItem1726617600000'
|
|
11
|
+
|
|
12
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
13
|
+
debug('migration: updating presentation definition item nullable fields')
|
|
14
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
15
|
+
|
|
16
|
+
switch (dbType) {
|
|
17
|
+
case 'postgres': {
|
|
18
|
+
debug('using postgres migration file')
|
|
19
|
+
const mig: CreateDcqlQueryItemPG1726588800000 = new CreateDcqlQueryItemPG1726588800000()
|
|
20
|
+
await mig.up(queryRunner)
|
|
21
|
+
debug('Migration statements executed')
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
case 'sqlite':
|
|
25
|
+
case 'expo':
|
|
26
|
+
case 'react-native': {
|
|
27
|
+
debug('using sqlite/react-native migration file')
|
|
28
|
+
const mig: CreateDcqlQueryItemSQlite1726617600000 = new CreateDcqlQueryItemSQlite1726617600000()
|
|
29
|
+
await mig.up(queryRunner)
|
|
30
|
+
debug('Migration statements executed')
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
default:
|
|
34
|
+
return Promise.reject(
|
|
35
|
+
`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`,
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
41
|
+
debug('migration: reverting presentation definition item nullable fields')
|
|
42
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
43
|
+
|
|
44
|
+
switch (dbType) {
|
|
45
|
+
case 'postgres': {
|
|
46
|
+
debug('using postgres migration file')
|
|
47
|
+
const mig: CreateDcqlQueryItemPG1726588800000 = new CreateDcqlQueryItemPG1726588800000()
|
|
48
|
+
await mig.down(queryRunner)
|
|
49
|
+
debug('Migration statements executed')
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
case 'sqlite':
|
|
53
|
+
case 'expo':
|
|
54
|
+
case 'react-native': {
|
|
55
|
+
debug('using sqlite/react-native migration file')
|
|
56
|
+
const mig: CreateDcqlQueryItemSQlite1726617600000 = new CreateDcqlQueryItemSQlite1726617600000()
|
|
57
|
+
await mig.down(queryRunner)
|
|
58
|
+
debug('Migration statements executed')
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
default:
|
|
62
|
+
return Promise.reject(
|
|
63
|
+
`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`,
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
1
|
import Debug from 'debug'
|
|
2
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
3
|
import { CreateIssuanceBranding1685628974232 } from '../postgres/1685628974232-CreateIssuanceBranding'
|
|
4
4
|
import { CreateIssuanceBranding1685628973231 } from '../sqlite/1685628973231-CreateIssuanceBranding'
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
1
|
import Debug from 'debug'
|
|
3
|
-
import {
|
|
2
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
4
3
|
import { CreateContacts1690925872592 } from '../postgres/1690925872592-CreateContacts'
|
|
4
|
+
import { CreateContacts1690925872693 } from '../sqlite/1690925872693-CreateContacts'
|
|
5
5
|
|
|
6
6
|
const debug: Debug.Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
7
7
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Debug from 'debug'
|
|
2
2
|
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
3
|
import { CreateStatusList1693866470001 } from '../postgres/1693866470001-CreateStatusList'
|
|
4
|
-
import { CreateStatusList1693866470002 } from '../sqlite/1693866470000-CreateStatusList'
|
|
5
4
|
import { UpdateStatusList1737110469001 } from '../postgres/1737110469001-UpdateStatusList'
|
|
5
|
+
import { CreateStatusList1693866470002 } from '../sqlite/1693866470000-CreateStatusList'
|
|
6
6
|
import { UpdateStatusList1737110469000 } from '../sqlite/1737110469000-UpdateStatusList'
|
|
7
7
|
|
|
8
8
|
const debug = Debug('sphereon:ssi-sdk:migrations')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
1
|
import Debug, { Debugger } from 'debug'
|
|
3
|
-
import {
|
|
2
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
4
3
|
import { CreateAuditEvents1701634812183 } from '../postgres/1701634812183-CreateAuditEvents'
|
|
4
|
+
import { CreateAuditEvents1701634819487 } from '../sqlite/1701634819487-CreateAuditEvents'
|
|
5
5
|
|
|
6
6
|
const debug: Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
1
|
import Debug, { Debugger } from 'debug'
|
|
2
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
3
|
import { CreateDigitalCredential1708525189001 } from '../postgres/1708525189001-CreateDigitalCredential'
|
|
4
4
|
import { CreateDigitalCredential1708525189002 } from '../sqlite/1708525189002-CreateDigitalCredential'
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
1
|
import Debug from 'debug'
|
|
2
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
3
|
import { CreateMachineStateStore1708797018115 } from '../postgres/1708797018115-CreateMachineStateStore'
|
|
4
4
|
import { CreateMachineStateStore1708796002272 } from '../sqlite/1708796002272-CreateMachineStateStore'
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
1
|
import Debug from 'debug'
|
|
2
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
3
|
import { CreateContacts1710438363001 } from '../postgres/1710438363001-CreateContacts'
|
|
4
4
|
import { CreateContacts1710438363002 } from '../sqlite/1710438363002-CreateContacts'
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
1
|
import Debug from 'debug'
|
|
2
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
3
|
import { CreateContacts1715761125001 } from '../postgres/1715761125001-CreateContacts'
|
|
4
4
|
import { CreateContacts1715761125002 } from '../sqlite/1715761125002-CreateContacts'
|
|
5
5
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { CreateContacts1659463079429 } from './1-CreateContacts'
|
|
2
|
+
import { CreatePresentationDefinitions1716533767523 } from './10-CreatePresentationDefinitions'
|
|
3
|
+
import { FixCredentialClaimsReferencesUuid1741895822987 } from './11-FixCredentialClaimsReferenceUuid'
|
|
4
|
+
import { AddBitstringStatusListEnum1741895823000, CreateBitstringStatusList1741895823000 } from './12-CreateBitstringStatusList'
|
|
5
|
+
import { CreateDcqlQueryItem1726617600000 } from './13-CreateDcqlQueryItem'
|
|
2
6
|
import { CreateIssuanceBranding1659463079429 } from './2-CreateIssuanceBranding'
|
|
3
7
|
import { CreateContacts1690925872318 } from './3-CreateContacts'
|
|
4
8
|
import { CreateStatusList1693866470000 } from './4-CreateStatusList'
|
|
@@ -7,8 +11,6 @@ import { CreateDigitalCredential1708525189000 } from './6-CreateDigitalCredentia
|
|
|
7
11
|
import { CreateMachineStateStore1708098041262 } from './7-CreateMachineStateStore'
|
|
8
12
|
import { CreateContacts1708525189000 } from './8-CreateContacts'
|
|
9
13
|
import { CreateContacts1715761125000 } from './9-CreateContacts'
|
|
10
|
-
import { CreatePresentationDefinitions1716533767523 } from './10-CreatePresentationDefinitions'
|
|
11
|
-
import { FixCredentialClaimsReferencesUuid1741895822987 } from './11-FixCredentialClaimsReferenceUuid'
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* The migrations array that SHOULD be used when initializing a TypeORM database connection.
|
|
@@ -26,11 +28,15 @@ export const DataStoreContactMigrations = [
|
|
|
26
28
|
CreateContacts1715761125000,
|
|
27
29
|
]
|
|
28
30
|
export const DataStoreIssuanceBrandingMigrations = [CreateIssuanceBranding1659463079429, FixCredentialClaimsReferencesUuid1741895822987]
|
|
29
|
-
export const DataStoreStatusListMigrations = [
|
|
31
|
+
export const DataStoreStatusListMigrations = [
|
|
32
|
+
CreateStatusList1693866470000,
|
|
33
|
+
AddBitstringStatusListEnum1741895823000,
|
|
34
|
+
CreateBitstringStatusList1741895823000,
|
|
35
|
+
]
|
|
30
36
|
export const DataStoreEventLoggerMigrations = [CreateAuditEvents1701635835330]
|
|
31
37
|
export const DataStoreDigitalCredentialMigrations = [CreateDigitalCredential1708525189000]
|
|
32
38
|
export const DataStoreMachineStateMigrations = [CreateMachineStateStore1708098041262]
|
|
33
|
-
export const DataStorePresentationDefinitionMigrations = [CreatePresentationDefinitions1716533767523]
|
|
39
|
+
export const DataStorePresentationDefinitionMigrations = [CreatePresentationDefinitions1716533767523, CreateDcqlQueryItem1726617600000]
|
|
34
40
|
|
|
35
41
|
// All migrations together
|
|
36
42
|
export const DataStoreMigrations = [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
1
|
import { enablePostgresUuidExtension } from '@sphereon/ssi-sdk.core'
|
|
2
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
3
|
|
|
4
4
|
export class CreateContacts1659463079428 implements MigrationInterface {
|
|
5
5
|
name = 'CreateContacts1659463079428'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
1
|
import { enablePostgresUuidExtension } from '@sphereon/ssi-sdk.core'
|
|
2
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
3
|
|
|
4
4
|
export class CreateIssuanceBranding1685628974232 implements MigrationInterface {
|
|
5
5
|
name = 'CreateIssuanceBranding1685628974232'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
1
|
import { enablePostgresUuidExtension } from '@sphereon/ssi-sdk.core'
|
|
2
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
3
|
|
|
4
4
|
export class CreateContacts1690925872592 implements MigrationInterface {
|
|
5
5
|
name = 'CreateContacts1690925872592'
|
|
@@ -13,7 +13,7 @@ CREATE TABLE "PresentationDefinitionItem" (
|
|
|
13
13
|
"version" TEXT NOT NULL,
|
|
14
14
|
"purpose" TEXT,
|
|
15
15
|
"definition_payload" TEXT NOT NULL,
|
|
16
|
-
"
|
|
16
|
+
"query" TEXT,
|
|
17
17
|
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
18
18
|
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
19
19
|
CONSTRAINT "PK_PresentationDefinitionItem_id" PRIMARY KEY ("id"))
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class CreateDcqlQueryItemPG1726588800000 implements MigrationInterface {
|
|
4
|
+
name = 'CreateDcqlQueryItemPG1726588800000'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`
|
|
8
|
+
CREATE TABLE "DcqlQueryItem" (
|
|
9
|
+
"id" uuid NOT NULL DEFAULT uuid_generate_v4(),
|
|
10
|
+
"tenant_id" TEXT,
|
|
11
|
+
"query_id" TEXT NOT NULL,
|
|
12
|
+
"name" TEXT,
|
|
13
|
+
"version" TEXT NOT NULL,
|
|
14
|
+
"purpose" TEXT,
|
|
15
|
+
"query" TEXT NOT NULL,
|
|
16
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
17
|
+
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
18
|
+
CONSTRAINT "PK_DcqlQueryItem_id" PRIMARY KEY ("id"))
|
|
19
|
+
`)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
23
|
+
await queryRunner.query(`DROP TABLE "DcqlQueryItem"`)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -10,7 +10,7 @@ export class UpdateStatusList1737110469001 implements MigrationInterface {
|
|
|
10
10
|
// Make columns nullable and add new columns
|
|
11
11
|
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "indexingDirection" DROP NOT NULL`)
|
|
12
12
|
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "statusPurpose" DROP NOT NULL`)
|
|
13
|
-
await queryRunner.query(`ALTER TABLE "StatusList" ADD "bitsPerStatus" integer`)
|
|
13
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD "bitsPerStatus" integer DEFAULT 1`)
|
|
14
14
|
await queryRunner.query(`ALTER TABLE "StatusList" ADD "expiresAt" timestamp with time zone`)
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class AddBitstringStatusListEnumPG1741895823000 implements MigrationInterface {
|
|
4
|
+
name = 'AddBitstringStatusListEnum1741895823000'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.startTransaction()
|
|
8
|
+
await queryRunner.query(`ALTER TYPE "StatusList_type_enum" ADD VALUE 'BitstringStatusList'`)
|
|
9
|
+
await queryRunner.commitTransaction()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
14
|
+
// Note: Cannot remove enum value in Postgres without recreating the type
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class CreateBitstringStatusListPG1741895823000 implements MigrationInterface {
|
|
19
|
+
name = 'CreateBitstringStatusList1741895823000'
|
|
20
|
+
|
|
21
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
22
|
+
// Add BitstringStatusList columns to StatusList table
|
|
23
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "ttl" integer`)
|
|
24
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "validFrom" TIMESTAMP`)
|
|
25
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "validUntil" TIMESTAMP`)
|
|
26
|
+
|
|
27
|
+
// Update type enum constraint to include BitstringStatusList
|
|
28
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP CONSTRAINT IF EXISTS "CHK_StatusList_type"`)
|
|
29
|
+
await queryRunner.query(
|
|
30
|
+
`ALTER TABLE "StatusList" ADD CONSTRAINT "CHK_StatusList_type" CHECK ("type" IN ('StatusList2021', 'OAuthStatusList', 'BitstringStatusList'))`,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
// Add inheritance discriminator column to StatusListEntry table
|
|
34
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "type" character varying NOT NULL DEFAULT 'StatusListEntryEntity'`)
|
|
35
|
+
|
|
36
|
+
// Add BitstringStatusListEntry specific columns to StatusListEntry table
|
|
37
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusPurpose" character varying`)
|
|
38
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "bitsPerStatus" integer DEFAULT 1`)
|
|
39
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusMessage" text`)
|
|
40
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusReference" text`)
|
|
41
|
+
|
|
42
|
+
// Add constraint for entry type
|
|
43
|
+
await queryRunner.query(
|
|
44
|
+
`ALTER TABLE "StatusListEntry" ADD CONSTRAINT "CHK_StatusListEntry_type" CHECK ("type" IN ('StatusListEntryEntity', 'bitstring'))`,
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
49
|
+
// Remove entry type constraint and columns
|
|
50
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP CONSTRAINT "CHK_StatusListEntry_type"`)
|
|
51
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "statusReference"`)
|
|
52
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "statusMessage"`)
|
|
53
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "bitsPerStatus"`)
|
|
54
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "statusPurpose"`)
|
|
55
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "type"`)
|
|
56
|
+
|
|
57
|
+
// Revert StatusList type constraint
|
|
58
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP CONSTRAINT "CHK_StatusList_type"`)
|
|
59
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD CONSTRAINT "CHK_StatusList_type" CHECK ("type" IN ('StatusList2021', 'OAuthStatusList'))`)
|
|
60
|
+
|
|
61
|
+
// Remove BitstringStatusList columns from StatusList table
|
|
62
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "validUntil"`)
|
|
63
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "validFrom"`)
|
|
64
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "ttl"`)
|
|
65
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "bitsPerStatus"`)
|
|
66
|
+
}
|
|
67
|
+
}
|