@sphereon/ssi-sdk.data-store 0.34.1-fix.80 → 0.34.1-next.278
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 +3775 -3800
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +339 -1270
- package/dist/index.d.ts +339 -1270
- package/dist/index.js +3706 -3731
- package/dist/index.js.map +1 -1
- package/package.json +9 -8
- 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 +4 -4
- package/src/__tests__/statusList.store.test.ts +3 -3
- 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 +1 -1
- package/src/entities/statusList/StatusListEntities.ts +3 -4
- package/src/eventLogger/EventLoggerStore.ts +2 -2
- package/src/index.ts +21 -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 +32 -2
- 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 -5
- 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 +15 -2
- package/src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts +1 -1
- package/src/migrations/sqlite/1726617600000-CreateDcqlQueryItem.ts +24 -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/index.ts +0 -12
- package/src/types/statusList/IAbstractStatusListStore.ts +9 -9
- 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 +1 -1
- 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.data-store",
|
|
3
|
-
"version": "0.34.1-
|
|
3
|
+
"version": "0.34.1-next.278+0eacb25b",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -28,16 +28,17 @@
|
|
|
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-
|
|
32
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-
|
|
33
|
-
"@sphereon/ssi-sdk.agent-config": "0.34.1-
|
|
34
|
-
"@sphereon/ssi-sdk.core": "0.34.1-
|
|
35
|
-
"@sphereon/ssi-types": "0.34.1-
|
|
31
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.34.1-next.278+0eacb25b",
|
|
32
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-next.278+0eacb25b",
|
|
33
|
+
"@sphereon/ssi-sdk.agent-config": "0.34.1-next.278+0eacb25b",
|
|
34
|
+
"@sphereon/ssi-sdk.core": "0.34.1-next.278+0eacb25b",
|
|
35
|
+
"@sphereon/ssi-sdk.data-store-types": "0.34.1-next.278+0eacb25b",
|
|
36
|
+
"@sphereon/ssi-types": "0.34.1-next.278+0eacb25b",
|
|
36
37
|
"@veramo/core": "4.2.0",
|
|
37
38
|
"@veramo/utils": "4.2.0",
|
|
38
39
|
"blakejs": "^1.2.1",
|
|
39
40
|
"class-validator": "0.14.1",
|
|
40
|
-
"dcql": "0.
|
|
41
|
+
"dcql": "1.0.1",
|
|
41
42
|
"debug": "^4.3.5",
|
|
42
43
|
"typeorm": "0.3.20"
|
|
43
44
|
},
|
|
@@ -65,5 +66,5 @@
|
|
|
65
66
|
"PostgreSQL",
|
|
66
67
|
"Contact Store"
|
|
67
68
|
],
|
|
68
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "0eacb25b6e38cef88d04d696d84e3c2ebcf89ede"
|
|
69
70
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
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'
|
|
3
4
|
import { DataSource, FindOptionsWhere } from 'typeorm'
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
4
6
|
import { BaseContactEntity } from '../entities/contact/BaseContactEntity'
|
|
5
7
|
import { ConnectionEntity } from '../entities/contact/ConnectionEntity'
|
|
6
8
|
import { ContactMetadataItemEntity } from '../entities/contact/ContactMetadataItemEntity'
|
|
@@ -16,18 +18,11 @@ import { PartyEntity } from '../entities/contact/PartyEntity'
|
|
|
16
18
|
import { PartyRelationshipEntity } from '../entities/contact/PartyRelationshipEntity'
|
|
17
19
|
import { PartyTypeEntity } from '../entities/contact/PartyTypeEntity'
|
|
18
20
|
import { PhysicalAddressEntity } from '../entities/contact/PhysicalAddressEntity'
|
|
21
|
+
import { contactMetadataItemEntityFrom, DataStoreContactEntities, DataStoreMigrations, identityMetadataItemEntityFrom, partyTypeFrom } from '../index'
|
|
19
22
|
import {
|
|
20
|
-
contactMetadataItemEntityFrom,
|
|
21
|
-
CredentialRole,
|
|
22
|
-
DataStoreContactEntities,
|
|
23
|
-
DataStoreMigrations,
|
|
24
|
-
identityMetadataItemEntityFrom,
|
|
25
23
|
IdentityOrigin,
|
|
26
24
|
MetadataTypes,
|
|
27
25
|
PartyOrigin,
|
|
28
|
-
partyTypeFrom,
|
|
29
|
-
} from '../index'
|
|
30
|
-
import {
|
|
31
26
|
ConnectionType,
|
|
32
27
|
CorrelationIdentifierType,
|
|
33
28
|
NaturalPerson,
|
|
@@ -43,7 +38,7 @@ import {
|
|
|
43
38
|
NonPersistedPhysicalAddress,
|
|
44
39
|
Organization,
|
|
45
40
|
PartyTypeType,
|
|
46
|
-
} from '
|
|
41
|
+
} from '@sphereon/ssi-sdk.data-store-types'
|
|
47
42
|
import {
|
|
48
43
|
connectionEntityFrom,
|
|
49
44
|
didAuthConfigEntityFrom,
|
|
@@ -57,7 +52,6 @@ import {
|
|
|
57
52
|
partyTypeEntityFrom,
|
|
58
53
|
physicalAddressEntityFrom,
|
|
59
54
|
} from '../utils/contact/MappingUtils'
|
|
60
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
61
55
|
// TODO write test adding two contacts reusing the same contactType
|
|
62
56
|
|
|
63
57
|
describe('Database entities tests', (): void => {
|
|
@@ -1,10 +1,7 @@
|
|
|
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'
|
|
5
2
|
import {
|
|
3
|
+
ConnectionType,
|
|
6
4
|
CorrelationIdentifierType,
|
|
7
|
-
CredentialRole,
|
|
8
5
|
ElectronicAddress,
|
|
9
6
|
GetElectronicAddressesArgs,
|
|
10
7
|
GetIdentitiesArgs,
|
|
@@ -12,6 +9,9 @@ import {
|
|
|
12
9
|
GetPhysicalAddressesArgs,
|
|
13
10
|
GetRelationshipsArgs,
|
|
14
11
|
Identity,
|
|
12
|
+
IdentityOrigin,
|
|
13
|
+
MetadataItem,
|
|
14
|
+
MetadataTypes,
|
|
15
15
|
NaturalPerson,
|
|
16
16
|
NonPersistedElectronicAddress,
|
|
17
17
|
NonPersistedIdentity,
|
|
@@ -21,12 +21,17 @@ import {
|
|
|
21
21
|
NonPersistedPartyType,
|
|
22
22
|
NonPersistedPhysicalAddress,
|
|
23
23
|
Party,
|
|
24
|
+
PartyOrigin,
|
|
24
25
|
PartyRelationship,
|
|
25
26
|
PartyType,
|
|
26
27
|
PartyTypeType,
|
|
27
28
|
PhysicalAddress,
|
|
28
|
-
} from '
|
|
29
|
+
} from '@sphereon/ssi-sdk.data-store-types'
|
|
30
|
+
import { CredentialRole } from '@sphereon/ssi-types'
|
|
31
|
+
import { DataSource } from 'typeorm'
|
|
29
32
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
33
|
+
import { ContactStore } from '../contact/ContactStore'
|
|
34
|
+
import { DataStoreContactEntities, DataStoreMigrations } from '../index'
|
|
30
35
|
|
|
31
36
|
describe('Contact store tests', (): void => {
|
|
32
37
|
let dbConnection: DataSource
|
|
@@ -49,7 +54,7 @@ describe('Contact store tests', (): void => {
|
|
|
49
54
|
})
|
|
50
55
|
|
|
51
56
|
afterEach(async (): Promise<void> => {
|
|
52
|
-
await
|
|
57
|
+
await dbConnection.destroy()
|
|
53
58
|
})
|
|
54
59
|
|
|
55
60
|
it('should get party by contact metadata', async (): Promise<void> => {
|
|
@@ -1,13 +1,20 @@
|
|
|
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'
|
|
2
12
|
import { DataSource } from 'typeorm'
|
|
3
|
-
import {
|
|
4
|
-
import { DataStoreDigitalCredentialMigrations } from '../migrations'
|
|
13
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
5
14
|
import { DigitalCredentialEntity } from '../entities/digitalCredential/DigitalCredentialEntity'
|
|
6
|
-
import {
|
|
15
|
+
import { DataStoreDigitalCredentialEntities } from '../index'
|
|
16
|
+
import { DataStoreDigitalCredentialMigrations } from '../migrations'
|
|
7
17
|
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'
|
|
11
18
|
|
|
12
19
|
describe('Database entities tests', (): void => {
|
|
13
20
|
let dbConnection: DataSource
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
|
-
import {
|
|
2
|
+
import { defaultHasher } from '@sphereon/ssi-sdk.core'
|
|
3
|
+
import { CredentialRole, IVerifiablePresentation } from '@sphereon/ssi-types'
|
|
3
4
|
import { DataSource } from 'typeorm'
|
|
4
|
-
import {
|
|
5
|
-
import { CredentialRole, DataStoreDigitalCredentialEntities } from '../index'
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
6
6
|
import { DigitalCredentialStore } from '../digitalCredential/DigitalCredentialStore'
|
|
7
|
+
import { DataStoreDigitalCredentialEntities } from '../index'
|
|
8
|
+
import { DataStoreDigitalCredentialMigrations } from '../migrations'
|
|
7
9
|
import {
|
|
8
10
|
AddCredentialArgs,
|
|
9
11
|
CredentialCorrelationType,
|
|
@@ -13,9 +15,7 @@ import {
|
|
|
13
15
|
DocumentType,
|
|
14
16
|
GetCredentialsArgs,
|
|
15
17
|
GetCredentialsResponse,
|
|
16
|
-
} from '
|
|
17
|
-
import { defaultHasher } from '@sphereon/ssi-sdk.core'
|
|
18
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
18
|
+
} from '@sphereon/ssi-sdk.data-store-types'
|
|
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'
|
|
5
7
|
import { DataStoreEventLoggerEntities } from '../index'
|
|
6
8
|
import { DataStoreEventLoggerMigrations } from '../migrations'
|
|
7
|
-
import {
|
|
8
|
-
import { NonPersistedActivityLoggingEvent, NonPersistedAuditLoggingEvent } from '../types'
|
|
9
|
+
import { NonPersistedActivityLoggingEvent, NonPersistedAuditLoggingEvent } from '@sphereon/ssi-sdk.data-store-types'
|
|
9
10
|
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,11 +2,16 @@ 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 { DataStoreEventLoggerMigrations } from '../migrations'
|
|
6
|
-
import { DataStoreEventLoggerEntities } from '../index'
|
|
7
|
-
import { EventLoggerStore } from '../eventLogger/EventLoggerStore'
|
|
8
|
-
import { GetActivityEventsArgs, GetAuditEventsArgs, NonPersistedActivityLoggingEvent, NonPersistedAuditLoggingEvent } from '../types'
|
|
9
5
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
6
|
+
import { EventLoggerStore } from '../eventLogger/EventLoggerStore'
|
|
7
|
+
import { DataStoreEventLoggerEntities } from '../index'
|
|
8
|
+
import { DataStoreEventLoggerMigrations } from '../migrations'
|
|
9
|
+
import {
|
|
10
|
+
GetActivityEventsArgs,
|
|
11
|
+
GetAuditEventsArgs,
|
|
12
|
+
NonPersistedActivityLoggingEvent,
|
|
13
|
+
NonPersistedAuditLoggingEvent,
|
|
14
|
+
} from '@sphereon/ssi-sdk.data-store-types'
|
|
10
15
|
|
|
11
16
|
describe('Database entities tests', (): void => {
|
|
12
17
|
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 { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
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 { DataStoreMigrations } from '../migrations'
|
|
20
20
|
|
|
21
21
|
describe('Database entities tests', (): void => {
|
|
22
22
|
let dbConnection: DataSource
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
2
|
import { DataSource } from 'typeorm'
|
|
3
|
-
import {
|
|
4
|
-
import { DataStoreMigrations } from '../migrations'
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
5
4
|
import {
|
|
6
5
|
BackgroundAttributesEntity,
|
|
7
6
|
CredentialLocaleBrandingEntity,
|
|
@@ -26,7 +25,8 @@ import {
|
|
|
26
25
|
IUpdateIssuerLocaleBrandingArgs,
|
|
27
26
|
TextAttributesEntity,
|
|
28
27
|
} from '../index'
|
|
29
|
-
import {
|
|
28
|
+
import { IssuanceBrandingStore } from '../issuanceBranding/IssuanceBrandingStore'
|
|
29
|
+
import { DataStoreMigrations } from '../migrations'
|
|
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'
|
|
3
4
|
import { MachineStateInfoEntity } from '../entities/machineState/MachineStateInfoEntity'
|
|
4
5
|
|
|
5
6
|
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'
|
|
3
4
|
import { DataStoreMachineStateEntities, MachineStateStore, StoreMachineStatePersistArgs, StoreMachineStatesFindActiveArgs } from '../index'
|
|
4
5
|
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,11 +1,12 @@
|
|
|
1
1
|
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
|
|
2
2
|
import { DataSource } from 'typeorm'
|
|
3
|
-
import { PresentationDefinitionItemEntity } from '../entities/presentationDefinition/PresentationDefinitionItemEntity'
|
|
4
|
-
import { DataStorePresentationDefinitionMigrations } from '../migrations'
|
|
5
|
-
import { DataStorePresentationDefinitionEntities } from '../index'
|
|
6
3
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
4
|
+
import { DcqlQueryItemEntity } from '../entities/presentationDefinition/DcqlQueryItemEntity'
|
|
5
|
+
import { DataStorePresentationDefinitionEntities } from '../index'
|
|
6
|
+
import { DataStorePresentationDefinitionMigrations } from '../migrations'
|
|
7
|
+
import { SAMPLE_DCQL_QUERY_IMPORT } from './pd-manager.store.test'
|
|
7
8
|
|
|
8
|
-
describe('
|
|
9
|
+
describe('DcqlQueryItemEntity tests', (): void => {
|
|
9
10
|
let dbConnection: DataSource
|
|
10
11
|
|
|
11
12
|
beforeEach(async (): Promise<void> => {
|
|
@@ -25,59 +26,34 @@ describe('PresentationDefinitionItemEntity tests', (): void => {
|
|
|
25
26
|
await dbConnection.destroy()
|
|
26
27
|
})
|
|
27
28
|
|
|
28
|
-
it('should create and retrieve
|
|
29
|
-
const repository = dbConnection.getRepository(
|
|
30
|
-
const entity = new
|
|
31
|
-
entity.
|
|
29
|
+
it('should create and retrieve DcqlQueryItemEntity', async (): Promise<void> => {
|
|
30
|
+
const repository = dbConnection.getRepository(DcqlQueryItemEntity)
|
|
31
|
+
const entity = new DcqlQueryItemEntity()
|
|
32
|
+
entity.queryId = 'ajax-club'
|
|
32
33
|
entity.version = '1.0'
|
|
33
|
-
entity.
|
|
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
|
-
})
|
|
34
|
+
entity.query = JSON.stringify(SAMPLE_DCQL_QUERY_IMPORT.query)
|
|
48
35
|
|
|
49
36
|
const savedEntity = await repository.save(entity)
|
|
50
37
|
expect(savedEntity).toBeDefined()
|
|
51
38
|
expect(savedEntity.id).toBeDefined()
|
|
52
|
-
expect(savedEntity.
|
|
39
|
+
expect(savedEntity.query).toBeDefined()
|
|
53
40
|
|
|
54
41
|
const retrievedEntity = await repository.findOneBy({ id: savedEntity.id })
|
|
55
42
|
expect(retrievedEntity).toBeDefined()
|
|
56
|
-
expect(retrievedEntity!.
|
|
57
|
-
const parsedDcql = JSON.parse(retrievedEntity!.
|
|
58
|
-
expect(parsedDcql.credentials[0].id).toEqual('
|
|
43
|
+
expect(retrievedEntity!.query).toBeDefined()
|
|
44
|
+
const parsedDcql = JSON.parse(retrievedEntity!.query)
|
|
45
|
+
expect(parsedDcql.credentials[0].id).toEqual('clubcard-v1')
|
|
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)
|
|
59
49
|
})
|
|
60
50
|
|
|
61
|
-
it('should update
|
|
62
|
-
const repository = dbConnection.getRepository(
|
|
63
|
-
const entity = new
|
|
64
|
-
entity.
|
|
51
|
+
it('should update DcqlQueryItemEntity dcql query', async (): Promise<void> => {
|
|
52
|
+
const repository = dbConnection.getRepository(DcqlQueryItemEntity)
|
|
53
|
+
const entity = new DcqlQueryItemEntity()
|
|
54
|
+
entity.queryId = 'ajax-club'
|
|
65
55
|
entity.version = '1.0'
|
|
66
|
-
entity.
|
|
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
|
-
})
|
|
56
|
+
entity.query = JSON.stringify(SAMPLE_DCQL_QUERY_IMPORT.query)
|
|
81
57
|
|
|
82
58
|
const savedEntity = await repository.save(entity)
|
|
83
59
|
expect(savedEntity).toBeDefined()
|
|
@@ -85,67 +61,20 @@ describe('PresentationDefinitionItemEntity tests', (): void => {
|
|
|
85
61
|
const updatedDcql = {
|
|
86
62
|
credentials: [
|
|
87
63
|
{
|
|
88
|
-
id: '
|
|
64
|
+
id: 'updated-clubcard',
|
|
89
65
|
format: 'jwt_vc',
|
|
90
66
|
claims: [
|
|
91
67
|
{
|
|
92
|
-
|
|
93
|
-
claim_name: 'updatedClaim',
|
|
68
|
+
path: ['name'],
|
|
94
69
|
},
|
|
95
70
|
],
|
|
96
71
|
},
|
|
97
72
|
],
|
|
98
73
|
}
|
|
99
|
-
savedEntity.
|
|
74
|
+
savedEntity.query = JSON.stringify(updatedDcql)
|
|
100
75
|
const updatedEntity = await repository.save(savedEntity)
|
|
101
76
|
expect(updatedEntity).toBeDefined()
|
|
102
|
-
expect(JSON.parse(updatedEntity.
|
|
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()
|
|
77
|
+
expect(JSON.parse(updatedEntity.query).credentials[0].id).toEqual('updated-clubcard')
|
|
78
|
+
expect(JSON.parse(updatedEntity.query).credentials[0].format).toEqual('jwt_vc')
|
|
150
79
|
})
|
|
151
80
|
})
|