@sphereon/ssi-sdk.data-store 0.34.1-feature.FIDES.1.274 → 0.34.1-feature.IDK.11.48
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 +3844 -3819
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1270 -339
- package/dist/index.d.ts +1270 -339
- package/dist/index.js +3791 -3766
- package/dist/index.js.map +1 -1
- package/package.json +8 -9
- package/src/__tests__/contact.entities.test.ts +10 -4
- package/src/__tests__/contact.store.test.ts +6 -11
- package/src/__tests__/digitalCredential.entities.test.ts +6 -13
- 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 +4 -9
- 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 +98 -27
- package/src/__tests__/pd-manager.store.test.ts +101 -151
- package/src/__tests__/statusList.entities.test.ts +4 -4
- package/src/__tests__/statusList.store.test.ts +3 -3
- package/src/contact/AbstractContactStore.ts +71 -0
- package/src/contact/ContactStore.ts +35 -35
- package/src/digitalCredential/AbstractDigitalCredentialStore.ts +21 -0
- package/src/digitalCredential/DigitalCredentialStore.ts +7 -6
- package/src/entities/contact/BaseConfigEntity.ts +2 -2
- package/src/entities/contact/BaseContactEntity.ts +5 -4
- package/src/entities/contact/ConnectionEntity.ts +4 -4
- package/src/entities/contact/ContactMetadataItemEntity.ts +4 -3
- package/src/entities/contact/CorrelationIdentifierEntity.ts +4 -3
- package/src/entities/contact/DidAuthConfigEntity.ts +2 -1
- package/src/entities/contact/ElectronicAddressEntity.ts +5 -15
- package/src/entities/contact/IdentityEntity.ts +11 -12
- 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 +3 -4
- package/src/entities/eventLogger/AuditEventEntity.ts +2 -2
- package/src/entities/issuanceBranding/BackgroundAttributesEntity.ts +2 -2
- package/src/entities/issuanceBranding/BaseLocaleBrandingEntity.ts +7 -6
- 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/{DcqlQueryItemEntity.ts → PresentationDefinitionItemEntity.ts} +14 -10
- package/src/entities/statusList/BitstringStatusListEntryEntity.ts +1 -1
- package/src/entities/statusList/StatusListEntities.ts +4 -3
- package/src/eventLogger/AbstractEventLoggerStore.ts +9 -0
- package/src/eventLogger/EventLoggerStore.ts +2 -2
- package/src/index.ts +26 -21
- package/src/issuanceBranding/AbstractIssuanceBrandingStore.ts +41 -0
- package/src/issuanceBranding/IssuanceBrandingStore.ts +25 -25
- package/src/machineState/IAbstractMachineStateStore.ts +65 -0
- 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 +2 -32
- 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 +5 -10
- 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/1737110469001-UpdateStatusList.ts +1 -1
- package/src/migrations/postgres/1741895823000-CreateBitstringStatusList.ts +2 -15
- package/src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts +1 -1
- package/src/presentationDefinition/AbstractPDStore.ts +20 -0
- package/src/presentationDefinition/PDStore.ts +45 -45
- package/src/statusList/IStatusListStore.ts +1 -1
- package/src/statusList/StatusListStore.ts +3 -3
- package/src/types/contact/IAbstractContactStore.ts +161 -0
- package/src/types/contact/contact.ts +295 -0
- package/src/types/contact/index.ts +2 -0
- package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +43 -0
- package/src/types/digitalCredential/enums.ts +70 -0
- package/src/types/digitalCredential/index.ts +3 -0
- package/src/types/digitalCredential/types.ts +39 -0
- package/src/types/eventLogger/IAbstractEventLoggerStore.ts +22 -0
- package/src/types/eventLogger/eventLogger.ts +4 -0
- package/src/types/index.ts +12 -0
- package/src/types/issuanceBranding/IAbstractIssuanceBrandingStore.ts +85 -0
- package/src/types/issuanceBranding/issuanceBranding.ts +138 -0
- package/src/types/machineState/IAbstractMachineStateStore.ts +68 -0
- package/src/types/presentationDefinition/IAbstractPDStore.ts +25 -0
- package/src/types/presentationDefinition/presentationDefinition.ts +19 -0
- package/src/types/statusList/IAbstractStatusListStore.ts +9 -9
- package/src/types/validation/validation.ts +3 -0
- package/src/utils/ValidatorUtils.ts +1 -1
- package/src/utils/contact/MappingUtils.ts +10 -10
- package/src/utils/digitalCredential/MappingUtils.ts +21 -3
- package/src/utils/eventLogger/MappingUtils.ts +2 -2
- package/src/utils/issuanceBranding/MappingUtils.ts +13 -13
- package/src/utils/presentationDefinition/MappingUtils.ts +22 -31
- package/src/utils/statusList/MappingUtils.ts +1 -1
- package/src/migrations/generic/13-CreateDcqlQueryItem.ts +0 -67
- package/src/migrations/postgres/1726588800000-CreateDcqlQueryItem.ts +0 -25
- package/src/migrations/sqlite/1726617600000-CreateDcqlQueryItem.ts +0 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.data-store",
|
|
3
|
-
"version": "0.34.1-feature.
|
|
3
|
+
"version": "0.34.1-feature.IDK.11.48+640da718",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -28,17 +28,16 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@sphereon/kmp-mdoc-core": "0.2.0-SNAPSHOT.26",
|
|
30
30
|
"@sphereon/pex": "5.0.0-unstable.28",
|
|
31
|
-
"@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.
|
|
32
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-feature.
|
|
33
|
-
"@sphereon/ssi-sdk.agent-config": "0.34.1-feature.
|
|
34
|
-
"@sphereon/ssi-sdk.core": "0.34.1-feature.
|
|
35
|
-
"@sphereon/ssi-
|
|
36
|
-
"@sphereon/ssi-types": "0.34.1-feature.FIDES.1.274+3d1f4edd",
|
|
31
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.IDK.11.48+640da718",
|
|
32
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-feature.IDK.11.48+640da718",
|
|
33
|
+
"@sphereon/ssi-sdk.agent-config": "0.34.1-feature.IDK.11.48+640da718",
|
|
34
|
+
"@sphereon/ssi-sdk.core": "0.34.1-feature.IDK.11.48+640da718",
|
|
35
|
+
"@sphereon/ssi-types": "0.34.1-feature.IDK.11.48+640da718",
|
|
37
36
|
"@veramo/core": "4.2.0",
|
|
38
37
|
"@veramo/utils": "4.2.0",
|
|
39
38
|
"blakejs": "^1.2.1",
|
|
40
39
|
"class-validator": "0.14.1",
|
|
41
|
-
"dcql": "
|
|
40
|
+
"dcql": "0.2.19",
|
|
42
41
|
"debug": "^4.3.5",
|
|
43
42
|
"typeorm": "0.3.20"
|
|
44
43
|
},
|
|
@@ -66,5 +65,5 @@
|
|
|
66
65
|
"PostgreSQL",
|
|
67
66
|
"Contact Store"
|
|
68
67
|
],
|
|
69
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "640da718d6ce394653ae6ef0276b584b2b7456df"
|
|
70
69
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { getDID } from '@sphereon/ssi-sdk-ext.did-utils'
|
|
2
2
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
3
|
-
import { CredentialRole } from '@sphereon/ssi-types'
|
|
4
3
|
import { DataSource, FindOptionsWhere } from 'typeorm'
|
|
5
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
6
4
|
import { BaseContactEntity } from '../entities/contact/BaseContactEntity'
|
|
7
5
|
import { ConnectionEntity } from '../entities/contact/ConnectionEntity'
|
|
8
6
|
import { ContactMetadataItemEntity } from '../entities/contact/ContactMetadataItemEntity'
|
|
@@ -18,11 +16,18 @@ import { PartyEntity } from '../entities/contact/PartyEntity'
|
|
|
18
16
|
import { PartyRelationshipEntity } from '../entities/contact/PartyRelationshipEntity'
|
|
19
17
|
import { PartyTypeEntity } from '../entities/contact/PartyTypeEntity'
|
|
20
18
|
import { PhysicalAddressEntity } from '../entities/contact/PhysicalAddressEntity'
|
|
21
|
-
import { contactMetadataItemEntityFrom, DataStoreContactEntities, DataStoreMigrations, identityMetadataItemEntityFrom, partyTypeFrom } from '../index'
|
|
22
19
|
import {
|
|
20
|
+
contactMetadataItemEntityFrom,
|
|
21
|
+
CredentialRole,
|
|
22
|
+
DataStoreContactEntities,
|
|
23
|
+
DataStoreMigrations,
|
|
24
|
+
identityMetadataItemEntityFrom,
|
|
23
25
|
IdentityOrigin,
|
|
24
26
|
MetadataTypes,
|
|
25
27
|
PartyOrigin,
|
|
28
|
+
partyTypeFrom,
|
|
29
|
+
} from '../index'
|
|
30
|
+
import {
|
|
26
31
|
ConnectionType,
|
|
27
32
|
CorrelationIdentifierType,
|
|
28
33
|
NaturalPerson,
|
|
@@ -38,7 +43,7 @@ import {
|
|
|
38
43
|
NonPersistedPhysicalAddress,
|
|
39
44
|
Organization,
|
|
40
45
|
PartyTypeType,
|
|
41
|
-
} from '
|
|
46
|
+
} from '../types'
|
|
42
47
|
import {
|
|
43
48
|
connectionEntityFrom,
|
|
44
49
|
didAuthConfigEntityFrom,
|
|
@@ -52,6 +57,7 @@ import {
|
|
|
52
57
|
partyTypeEntityFrom,
|
|
53
58
|
physicalAddressEntityFrom,
|
|
54
59
|
} from '../utils/contact/MappingUtils'
|
|
60
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
55
61
|
// TODO write test adding two contacts reusing the same contactType
|
|
56
62
|
|
|
57
63
|
describe('Database entities tests', (): void => {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
|
+
import { DataSource } from 'typeorm'
|
|
3
|
+
import { ConnectionType, DataStoreContactEntities, DataStoreMigrations, IdentityOrigin, MetadataItem, MetadataTypes, PartyOrigin } from '../index'
|
|
4
|
+
import { ContactStore } from '../contact/ContactStore'
|
|
2
5
|
import {
|
|
3
|
-
ConnectionType,
|
|
4
6
|
CorrelationIdentifierType,
|
|
7
|
+
CredentialRole,
|
|
5
8
|
ElectronicAddress,
|
|
6
9
|
GetElectronicAddressesArgs,
|
|
7
10
|
GetIdentitiesArgs,
|
|
@@ -9,9 +12,6 @@ import {
|
|
|
9
12
|
GetPhysicalAddressesArgs,
|
|
10
13
|
GetRelationshipsArgs,
|
|
11
14
|
Identity,
|
|
12
|
-
IdentityOrigin,
|
|
13
|
-
MetadataItem,
|
|
14
|
-
MetadataTypes,
|
|
15
15
|
NaturalPerson,
|
|
16
16
|
NonPersistedElectronicAddress,
|
|
17
17
|
NonPersistedIdentity,
|
|
@@ -21,17 +21,12 @@ import {
|
|
|
21
21
|
NonPersistedPartyType,
|
|
22
22
|
NonPersistedPhysicalAddress,
|
|
23
23
|
Party,
|
|
24
|
-
PartyOrigin,
|
|
25
24
|
PartyRelationship,
|
|
26
25
|
PartyType,
|
|
27
26
|
PartyTypeType,
|
|
28
27
|
PhysicalAddress,
|
|
29
|
-
} from '
|
|
30
|
-
import { CredentialRole } from '@sphereon/ssi-types'
|
|
31
|
-
import { DataSource } from 'typeorm'
|
|
28
|
+
} from '../types'
|
|
32
29
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
33
|
-
import { ContactStore } from '../contact/ContactStore'
|
|
34
|
-
import { DataStoreContactEntities, DataStoreMigrations } from '../index'
|
|
35
30
|
|
|
36
31
|
describe('Contact store tests', (): void => {
|
|
37
32
|
let dbConnection: DataSource
|
|
@@ -54,7 +49,7 @@ describe('Contact store tests', (): void => {
|
|
|
54
49
|
})
|
|
55
50
|
|
|
56
51
|
afterEach(async (): Promise<void> => {
|
|
57
|
-
await dbConnection.destroy()
|
|
52
|
+
await (await dbConnection).destroy()
|
|
58
53
|
})
|
|
59
54
|
|
|
60
55
|
it('should get party by contact metadata', async (): Promise<void> => {
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
|
-
import { defaultHasher } from '@sphereon/ssi-sdk.core'
|
|
3
|
-
import {
|
|
4
|
-
AddCredentialArgs,
|
|
5
|
-
CredentialCorrelationType,
|
|
6
|
-
CredentialDocumentFormat,
|
|
7
|
-
DocumentType,
|
|
8
|
-
NonPersistedDigitalCredential,
|
|
9
|
-
} from '@sphereon/ssi-sdk.data-store-types'
|
|
10
|
-
import { CredentialRole } from '@sphereon/ssi-types'
|
|
11
|
-
import { computeEntryHash } from '@veramo/utils'
|
|
12
2
|
import { DataSource } from 'typeorm'
|
|
13
|
-
import {
|
|
14
|
-
import { DigitalCredentialEntity } from '../entities/digitalCredential/DigitalCredentialEntity'
|
|
15
|
-
import { DataStoreDigitalCredentialEntities } from '../index'
|
|
3
|
+
import { CredentialRole, DataStoreDigitalCredentialEntities } from '../index'
|
|
16
4
|
import { DataStoreDigitalCredentialMigrations } from '../migrations'
|
|
5
|
+
import { DigitalCredentialEntity } from '../entities/digitalCredential/DigitalCredentialEntity'
|
|
6
|
+
import { computeEntryHash } from '@veramo/utils'
|
|
17
7
|
import { nonPersistedDigitalCredentialEntityFromAddArgs } from '../utils/digitalCredential/MappingUtils'
|
|
8
|
+
import { AddCredentialArgs, CredentialCorrelationType, CredentialDocumentFormat, DocumentType, NonPersistedDigitalCredential } from '../types'
|
|
9
|
+
import { defaultHasher } from '@sphereon/ssi-sdk.core'
|
|
10
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
18
11
|
|
|
19
12
|
describe('Database entities tests', (): void => {
|
|
20
13
|
let dbConnection: DataSource
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
|
-
import {
|
|
3
|
-
import { CredentialRole, IVerifiablePresentation } from '@sphereon/ssi-types'
|
|
2
|
+
import { IVerifiablePresentation } from '@sphereon/ssi-types'
|
|
4
3
|
import { DataSource } from 'typeorm'
|
|
5
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
6
|
-
import { DigitalCredentialStore } from '../digitalCredential/DigitalCredentialStore'
|
|
7
|
-
import { DataStoreDigitalCredentialEntities } from '../index'
|
|
8
4
|
import { DataStoreDigitalCredentialMigrations } from '../migrations'
|
|
5
|
+
import { CredentialRole, DataStoreDigitalCredentialEntities } from '../index'
|
|
6
|
+
import { DigitalCredentialStore } from '../digitalCredential/DigitalCredentialStore'
|
|
9
7
|
import {
|
|
10
8
|
AddCredentialArgs,
|
|
11
9
|
CredentialCorrelationType,
|
|
@@ -15,7 +13,9 @@ import {
|
|
|
15
13
|
DocumentType,
|
|
16
14
|
GetCredentialsArgs,
|
|
17
15
|
GetCredentialsResponse,
|
|
18
|
-
} from '
|
|
16
|
+
} from '../types'
|
|
17
|
+
import { defaultHasher } from '@sphereon/ssi-sdk.core'
|
|
18
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
19
19
|
|
|
20
20
|
describe('Database entities tests', (): void => {
|
|
21
21
|
let dbConnection: DataSource
|
|
@@ -2,12 +2,12 @@ import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
|
2
2
|
import { CredentialType, PartyCorrelationType } from '@sphereon/ssi-sdk.core'
|
|
3
3
|
import { ActionType, InitiatorType, LoggingEventType, LogLevel, SubSystem, System, SystemCorrelationIdType } from '@sphereon/ssi-types'
|
|
4
4
|
import { DataSource } from 'typeorm'
|
|
5
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
6
|
-
import { AuditEventEntity } from '../entities/eventLogger/AuditEventEntity'
|
|
7
5
|
import { DataStoreEventLoggerEntities } from '../index'
|
|
8
6
|
import { DataStoreEventLoggerMigrations } from '../migrations'
|
|
9
|
-
import {
|
|
7
|
+
import { AuditEventEntity } from '../entities/eventLogger/AuditEventEntity'
|
|
8
|
+
import { NonPersistedActivityLoggingEvent, NonPersistedAuditLoggingEvent } from '../types'
|
|
10
9
|
import { activityEventEntityFrom, auditEventEntityFrom } from '../utils/eventLogger/MappingUtils'
|
|
10
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
11
11
|
|
|
12
12
|
describe('Database entities tests', (): void => {
|
|
13
13
|
let dbConnection: DataSource
|
|
@@ -2,16 +2,11 @@ import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
|
2
2
|
import { ActivityLoggingEvent, AuditLoggingEvent, CredentialType, PartyCorrelationType } from '@sphereon/ssi-sdk.core'
|
|
3
3
|
import { ActionType, InitiatorType, LoggingEventType, LogLevel, SubSystem, System, SystemCorrelationIdType } from '@sphereon/ssi-types'
|
|
4
4
|
import { DataSource } from 'typeorm'
|
|
5
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
6
|
-
import { EventLoggerStore } from '../eventLogger/EventLoggerStore'
|
|
7
|
-
import { DataStoreEventLoggerEntities } from '../index'
|
|
8
5
|
import { DataStoreEventLoggerMigrations } from '../migrations'
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
NonPersistedAuditLoggingEvent,
|
|
14
|
-
} from '@sphereon/ssi-sdk.data-store-types'
|
|
6
|
+
import { DataStoreEventLoggerEntities } from '../index'
|
|
7
|
+
import { EventLoggerStore } from '../eventLogger/EventLoggerStore'
|
|
8
|
+
import { GetActivityEventsArgs, GetAuditEventsArgs, NonPersistedActivityLoggingEvent, NonPersistedAuditLoggingEvent } from '../types'
|
|
9
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
15
10
|
|
|
16
11
|
describe('Database entities tests', (): void => {
|
|
17
12
|
let dbConnection: DataSource
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
2
|
import { DataSource, Repository } from 'typeorm'
|
|
3
|
-
import {
|
|
3
|
+
import { DataStoreMigrations } from '../migrations'
|
|
4
4
|
import {
|
|
5
5
|
CredentialBrandingEntity,
|
|
6
6
|
credentialBrandingEntityFrom,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
IssuerLocaleBrandingEntity,
|
|
17
17
|
issuerLocaleBrandingEntityFrom,
|
|
18
18
|
} from '../index'
|
|
19
|
-
import {
|
|
19
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
20
20
|
|
|
21
21
|
describe('Database entities tests', (): void => {
|
|
22
22
|
let dbConnection: DataSource
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
2
|
import { DataSource } from 'typeorm'
|
|
3
|
-
import {
|
|
3
|
+
import { IssuanceBrandingStore } from '../issuanceBranding/IssuanceBrandingStore'
|
|
4
|
+
import { DataStoreMigrations } from '../migrations'
|
|
4
5
|
import {
|
|
5
6
|
BackgroundAttributesEntity,
|
|
6
7
|
CredentialLocaleBrandingEntity,
|
|
@@ -25,8 +26,7 @@ import {
|
|
|
25
26
|
IUpdateIssuerLocaleBrandingArgs,
|
|
26
27
|
TextAttributesEntity,
|
|
27
28
|
} from '../index'
|
|
28
|
-
import {
|
|
29
|
-
import { DataStoreMigrations } from '../migrations'
|
|
29
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
30
30
|
|
|
31
31
|
describe('Issuance branding store tests', (): void => {
|
|
32
32
|
let dbConnection: DataSource
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
2
|
import { DataSource } from 'typeorm'
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
4
3
|
import { MachineStateInfoEntity } from '../entities/machineState/MachineStateInfoEntity'
|
|
5
4
|
|
|
6
5
|
import { DataStoreMachineStateEntities, DataStoreMachineStateMigrations, MachineStateStore, StoreMachineStatePersistArgs } from '../index'
|
|
6
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
7
7
|
|
|
8
8
|
describe('Machine State Info Database entities tests', (): void => {
|
|
9
9
|
let dbConnection: DataSource
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
2
|
import { DataSource } from 'typeorm'
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
4
3
|
import { DataStoreMachineStateEntities, MachineStateStore, StoreMachineStatePersistArgs, StoreMachineStatesFindActiveArgs } from '../index'
|
|
5
4
|
import { DataStoreMachineStateMigrations } from '../migrations'
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
6
6
|
|
|
7
7
|
describe('Machine State store tests', (): void => {
|
|
8
8
|
let dbConnection: DataSource
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
2
|
import { DataSource } from 'typeorm'
|
|
3
|
-
import {
|
|
4
|
-
import { DcqlQueryItemEntity } from '../entities/presentationDefinition/DcqlQueryItemEntity'
|
|
5
|
-
import { DataStorePresentationDefinitionEntities } from '../index'
|
|
3
|
+
import { PresentationDefinitionItemEntity } from '../entities/presentationDefinition/PresentationDefinitionItemEntity'
|
|
6
4
|
import { DataStorePresentationDefinitionMigrations } from '../migrations'
|
|
7
|
-
import {
|
|
5
|
+
import { DataStorePresentationDefinitionEntities } from '../index'
|
|
6
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
8
7
|
|
|
9
|
-
describe('
|
|
8
|
+
describe('PresentationDefinitionItemEntity tests', (): void => {
|
|
10
9
|
let dbConnection: DataSource
|
|
11
10
|
|
|
12
11
|
beforeEach(async (): Promise<void> => {
|
|
@@ -26,34 +25,59 @@ describe('DcqlQueryItemEntity tests', (): void => {
|
|
|
26
25
|
await dbConnection.destroy()
|
|
27
26
|
})
|
|
28
27
|
|
|
29
|
-
it('should create and retrieve
|
|
30
|
-
const repository = dbConnection.getRepository(
|
|
31
|
-
const entity = new
|
|
32
|
-
entity.
|
|
28
|
+
it('should create and retrieve PresentationDefinitionItemEntity with dcqlPayload', async (): Promise<void> => {
|
|
29
|
+
const repository = dbConnection.getRepository(PresentationDefinitionItemEntity)
|
|
30
|
+
const entity = new PresentationDefinitionItemEntity()
|
|
31
|
+
entity.definitionId = 'definition1'
|
|
33
32
|
entity.version = '1.0'
|
|
34
|
-
entity.
|
|
33
|
+
entity.definitionPayload = JSON.stringify({ id: 'definition1', input_descriptors: [] })
|
|
34
|
+
entity.dcqlPayload = JSON.stringify({
|
|
35
|
+
credentials: [
|
|
36
|
+
{
|
|
37
|
+
id: 'credential1',
|
|
38
|
+
format: 'jwt_vc',
|
|
39
|
+
claims: [
|
|
40
|
+
{
|
|
41
|
+
namespace: 'test',
|
|
42
|
+
claim_name: 'testClaim',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
})
|
|
35
48
|
|
|
36
49
|
const savedEntity = await repository.save(entity)
|
|
37
50
|
expect(savedEntity).toBeDefined()
|
|
38
51
|
expect(savedEntity.id).toBeDefined()
|
|
39
|
-
expect(savedEntity.
|
|
52
|
+
expect(savedEntity.dcqlPayload).toBeDefined()
|
|
40
53
|
|
|
41
54
|
const retrievedEntity = await repository.findOneBy({ id: savedEntity.id })
|
|
42
55
|
expect(retrievedEntity).toBeDefined()
|
|
43
|
-
expect(retrievedEntity!.
|
|
44
|
-
const parsedDcql = JSON.parse(retrievedEntity!.
|
|
45
|
-
expect(parsedDcql.credentials[0].id).toEqual('
|
|
46
|
-
expect(parsedDcql.credentials[0].format).toEqual('dc+sd-jwt')
|
|
47
|
-
expect(parsedDcql.credentials[0].meta.vct_values).toContain('clubcard-v1')
|
|
48
|
-
expect(parsedDcql.credentials[0].claims).toHaveLength(4)
|
|
56
|
+
expect(retrievedEntity!.dcqlPayload).toBeDefined()
|
|
57
|
+
const parsedDcql = JSON.parse(retrievedEntity!.dcqlPayload)
|
|
58
|
+
expect(parsedDcql.credentials[0].id).toEqual('credential1')
|
|
49
59
|
})
|
|
50
60
|
|
|
51
|
-
it('should update
|
|
52
|
-
const repository = dbConnection.getRepository(
|
|
53
|
-
const entity = new
|
|
54
|
-
entity.
|
|
61
|
+
it('should update PresentationDefinitionItemEntity dcqlPayload', async (): Promise<void> => {
|
|
62
|
+
const repository = dbConnection.getRepository(PresentationDefinitionItemEntity)
|
|
63
|
+
const entity = new PresentationDefinitionItemEntity()
|
|
64
|
+
entity.definitionId = 'definition1'
|
|
55
65
|
entity.version = '1.0'
|
|
56
|
-
entity.
|
|
66
|
+
entity.definitionPayload = JSON.stringify({ id: 'definition1', input_descriptors: [] })
|
|
67
|
+
entity.dcqlPayload = JSON.stringify({
|
|
68
|
+
credentials: [
|
|
69
|
+
{
|
|
70
|
+
id: 'credential1',
|
|
71
|
+
format: 'jwt_vc',
|
|
72
|
+
claims: [
|
|
73
|
+
{
|
|
74
|
+
namespace: 'test',
|
|
75
|
+
claim_name: 'testClaim',
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
})
|
|
57
81
|
|
|
58
82
|
const savedEntity = await repository.save(entity)
|
|
59
83
|
expect(savedEntity).toBeDefined()
|
|
@@ -61,20 +85,67 @@ describe('DcqlQueryItemEntity tests', (): void => {
|
|
|
61
85
|
const updatedDcql = {
|
|
62
86
|
credentials: [
|
|
63
87
|
{
|
|
64
|
-
id: '
|
|
88
|
+
id: 'credential2',
|
|
65
89
|
format: 'jwt_vc',
|
|
66
90
|
claims: [
|
|
67
91
|
{
|
|
68
|
-
|
|
92
|
+
namespace: 'test',
|
|
93
|
+
claim_name: 'updatedClaim',
|
|
69
94
|
},
|
|
70
95
|
],
|
|
71
96
|
},
|
|
72
97
|
],
|
|
73
98
|
}
|
|
74
|
-
savedEntity.
|
|
99
|
+
savedEntity.dcqlPayload = JSON.stringify(updatedDcql)
|
|
75
100
|
const updatedEntity = await repository.save(savedEntity)
|
|
76
101
|
expect(updatedEntity).toBeDefined()
|
|
77
|
-
expect(JSON.parse(updatedEntity.
|
|
78
|
-
|
|
102
|
+
expect(JSON.parse(updatedEntity.dcqlPayload).credentials[0].id).toEqual('credential2')
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
it('should create and retrieve PresentationDefinitionItemEntity', async (): Promise<void> => {
|
|
106
|
+
const repository = dbConnection.getRepository(PresentationDefinitionItemEntity)
|
|
107
|
+
const entity = new PresentationDefinitionItemEntity()
|
|
108
|
+
entity.definitionId = 'definition1'
|
|
109
|
+
entity.version = '1.0'
|
|
110
|
+
entity.definitionPayload = JSON.stringify({ id: 'definition1', input_descriptors: [] })
|
|
111
|
+
|
|
112
|
+
const savedEntity = await repository.save(entity)
|
|
113
|
+
expect(savedEntity).toBeDefined()
|
|
114
|
+
expect(savedEntity.id).toBeDefined()
|
|
115
|
+
|
|
116
|
+
const retrievedEntity = await repository.findOneBy({ id: savedEntity.id })
|
|
117
|
+
expect(retrievedEntity).toBeDefined()
|
|
118
|
+
expect(retrievedEntity!.definitionId).toEqual('definition1')
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
it('should update PresentationDefinitionItemEntity', async (): Promise<void> => {
|
|
122
|
+
const repository = dbConnection.getRepository(PresentationDefinitionItemEntity)
|
|
123
|
+
const entity = new PresentationDefinitionItemEntity()
|
|
124
|
+
entity.definitionId = 'definition1'
|
|
125
|
+
entity.version = '1.0'
|
|
126
|
+
entity.definitionPayload = JSON.stringify({ id: 'definition1', input_descriptors: [] })
|
|
127
|
+
|
|
128
|
+
const savedEntity = await repository.save(entity)
|
|
129
|
+
expect(savedEntity).toBeDefined()
|
|
130
|
+
|
|
131
|
+
savedEntity.version = '1.1'
|
|
132
|
+
const updatedEntity = await repository.save(savedEntity)
|
|
133
|
+
expect(updatedEntity).toBeDefined()
|
|
134
|
+
expect(updatedEntity.version).toEqual('1.1')
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
it('should delete PresentationDefinitionItemEntity', async (): Promise<void> => {
|
|
138
|
+
const repository = dbConnection.getRepository(PresentationDefinitionItemEntity)
|
|
139
|
+
const entity = new PresentationDefinitionItemEntity()
|
|
140
|
+
entity.definitionId = 'definition1'
|
|
141
|
+
entity.version = '1.0'
|
|
142
|
+
entity.definitionPayload = JSON.stringify({ id: 'definition1', input_descriptors: [] })
|
|
143
|
+
|
|
144
|
+
const savedEntity = await repository.save(entity)
|
|
145
|
+
expect(savedEntity).toBeDefined()
|
|
146
|
+
|
|
147
|
+
await repository.delete(savedEntity.id)
|
|
148
|
+
const retrievedEntity = await repository.findOneBy({ id: savedEntity.id })
|
|
149
|
+
expect(retrievedEntity).toBeNull()
|
|
79
150
|
})
|
|
80
151
|
})
|