@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.
Files changed (113) hide show
  1. package/dist/index.cjs +3775 -3800
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +339 -1270
  4. package/dist/index.d.ts +339 -1270
  5. package/dist/index.js +3706 -3731
  6. package/dist/index.js.map +1 -1
  7. package/package.json +9 -8
  8. package/src/__tests__/contact.entities.test.ts +4 -10
  9. package/src/__tests__/contact.store.test.ts +11 -6
  10. package/src/__tests__/digitalCredential.entities.test.ts +13 -6
  11. package/src/__tests__/digitalCredential.store.test.ts +6 -6
  12. package/src/__tests__/eventLogger.entities.test.ts +3 -3
  13. package/src/__tests__/eventLogger.store.test.ts +9 -4
  14. package/src/__tests__/issuanceBranding.entities.test.ts +2 -2
  15. package/src/__tests__/issuanceBranding.store.test.ts +3 -3
  16. package/src/__tests__/machineState.entities.test.ts +1 -1
  17. package/src/__tests__/machineState.store.test.ts +1 -1
  18. package/src/__tests__/pd-manager.entities.test.ts +27 -98
  19. package/src/__tests__/pd-manager.store.test.ts +151 -101
  20. package/src/__tests__/statusList.entities.test.ts +4 -4
  21. package/src/__tests__/statusList.store.test.ts +3 -3
  22. package/src/contact/ContactStore.ts +35 -35
  23. package/src/digitalCredential/DigitalCredentialStore.ts +6 -7
  24. package/src/entities/contact/BaseConfigEntity.ts +2 -2
  25. package/src/entities/contact/BaseContactEntity.ts +4 -5
  26. package/src/entities/contact/ConnectionEntity.ts +4 -4
  27. package/src/entities/contact/ContactMetadataItemEntity.ts +3 -4
  28. package/src/entities/contact/CorrelationIdentifierEntity.ts +3 -4
  29. package/src/entities/contact/DidAuthConfigEntity.ts +1 -2
  30. package/src/entities/contact/ElectronicAddressEntity.ts +15 -5
  31. package/src/entities/contact/IdentityEntity.ts +12 -11
  32. package/src/entities/contact/IdentityMetadataItemEntity.ts +3 -3
  33. package/src/entities/contact/NaturalPersonEntity.ts +5 -5
  34. package/src/entities/contact/OrganizationEntity.ts +1 -1
  35. package/src/entities/contact/PartyEntity.ts +7 -7
  36. package/src/entities/contact/PartyRelationshipEntity.ts +8 -8
  37. package/src/entities/contact/PartyTypeEntity.ts +4 -4
  38. package/src/entities/contact/PhysicalAddressEntity.ts +3 -3
  39. package/src/entities/digitalCredential/DigitalCredentialEntity.ts +4 -3
  40. package/src/entities/eventLogger/AuditEventEntity.ts +2 -2
  41. package/src/entities/issuanceBranding/BackgroundAttributesEntity.ts +2 -2
  42. package/src/entities/issuanceBranding/BaseLocaleBrandingEntity.ts +6 -7
  43. package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +2 -2
  44. package/src/entities/issuanceBranding/CredentialClaimsEntity.ts +2 -2
  45. package/src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts +2 -2
  46. package/src/entities/issuanceBranding/ImageAttributesEntity.ts +2 -2
  47. package/src/entities/issuanceBranding/IssuerBrandingEntity.ts +2 -2
  48. package/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts +3 -3
  49. package/src/entities/issuanceBranding/TextAttributesEntity.ts +1 -1
  50. package/src/entities/machineState/MachineStateInfoEntity.ts +1 -1
  51. package/src/entities/presentationDefinition/{PresentationDefinitionItemEntity.ts → DcqlQueryItemEntity.ts} +10 -14
  52. package/src/entities/statusList/BitstringStatusListEntryEntity.ts +1 -1
  53. package/src/entities/statusList/StatusListEntities.ts +3 -4
  54. package/src/eventLogger/EventLoggerStore.ts +2 -2
  55. package/src/index.ts +21 -26
  56. package/src/issuanceBranding/IssuanceBrandingStore.ts +25 -25
  57. package/src/machineState/MachineStateStore.ts +7 -7
  58. package/src/migrations/generic/1-CreateContacts.ts +1 -1
  59. package/src/migrations/generic/10-CreatePresentationDefinitions.ts +1 -1
  60. package/src/migrations/generic/11-FixCredentialClaimsReferenceUuid.ts +2 -2
  61. package/src/migrations/generic/12-CreateBitstringStatusList.ts +32 -2
  62. package/src/migrations/generic/13-CreateDcqlQueryItem.ts +67 -0
  63. package/src/migrations/generic/2-CreateIssuanceBranding.ts +1 -1
  64. package/src/migrations/generic/3-CreateContacts.ts +2 -2
  65. package/src/migrations/generic/4-CreateStatusList.ts +1 -1
  66. package/src/migrations/generic/5-CreateAuditEvents.ts +2 -2
  67. package/src/migrations/generic/6-CreateDigitalCredential.ts +1 -1
  68. package/src/migrations/generic/7-CreateMachineStateStore.ts +1 -1
  69. package/src/migrations/generic/8-CreateContacts.ts +1 -1
  70. package/src/migrations/generic/9-CreateContacts.ts +1 -1
  71. package/src/migrations/generic/index.ts +10 -5
  72. package/src/migrations/postgres/1659463079428-CreateContacts.ts +1 -1
  73. package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +1 -1
  74. package/src/migrations/postgres/1690925872592-CreateContacts.ts +1 -1
  75. package/src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts +1 -1
  76. package/src/migrations/postgres/1726588800000-CreateDcqlQueryItem.ts +25 -0
  77. package/src/migrations/postgres/1737110469001-UpdateStatusList.ts +1 -1
  78. package/src/migrations/postgres/1741895823000-CreateBitstringStatusList.ts +15 -2
  79. package/src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts +1 -1
  80. package/src/migrations/sqlite/1726617600000-CreateDcqlQueryItem.ts +24 -0
  81. package/src/presentationDefinition/PDStore.ts +45 -45
  82. package/src/statusList/IStatusListStore.ts +1 -1
  83. package/src/statusList/StatusListStore.ts +3 -3
  84. package/src/types/index.ts +0 -12
  85. package/src/types/statusList/IAbstractStatusListStore.ts +9 -9
  86. package/src/utils/ValidatorUtils.ts +1 -1
  87. package/src/utils/contact/MappingUtils.ts +10 -10
  88. package/src/utils/digitalCredential/MappingUtils.ts +3 -21
  89. package/src/utils/eventLogger/MappingUtils.ts +2 -2
  90. package/src/utils/issuanceBranding/MappingUtils.ts +13 -13
  91. package/src/utils/presentationDefinition/MappingUtils.ts +31 -22
  92. package/src/utils/statusList/MappingUtils.ts +1 -1
  93. package/src/contact/AbstractContactStore.ts +0 -71
  94. package/src/digitalCredential/AbstractDigitalCredentialStore.ts +0 -21
  95. package/src/eventLogger/AbstractEventLoggerStore.ts +0 -9
  96. package/src/issuanceBranding/AbstractIssuanceBrandingStore.ts +0 -41
  97. package/src/machineState/IAbstractMachineStateStore.ts +0 -65
  98. package/src/presentationDefinition/AbstractPDStore.ts +0 -20
  99. package/src/types/contact/IAbstractContactStore.ts +0 -161
  100. package/src/types/contact/contact.ts +0 -295
  101. package/src/types/contact/index.ts +0 -2
  102. package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +0 -43
  103. package/src/types/digitalCredential/enums.ts +0 -70
  104. package/src/types/digitalCredential/index.ts +0 -3
  105. package/src/types/digitalCredential/types.ts +0 -39
  106. package/src/types/eventLogger/IAbstractEventLoggerStore.ts +0 -22
  107. package/src/types/eventLogger/eventLogger.ts +0 -4
  108. package/src/types/issuanceBranding/IAbstractIssuanceBrandingStore.ts +0 -85
  109. package/src/types/issuanceBranding/issuanceBranding.ts +0 -138
  110. package/src/types/machineState/IAbstractMachineStateStore.ts +0 -68
  111. package/src/types/presentationDefinition/IAbstractPDStore.ts +0 -25
  112. package/src/types/presentationDefinition/presentationDefinition.ts +0 -19
  113. package/src/types/validation/validation.ts +0 -3
@@ -1,5 +1,4 @@
1
1
  import type {
2
- MetadataTypes,
3
2
  Connection,
4
3
  ConnectionConfig,
5
4
  Contact,
@@ -8,6 +7,7 @@ import type {
8
7
  ElectronicAddress,
9
8
  Identity,
10
9
  MetadataItem,
10
+ MetadataTypes,
11
11
  NaturalPerson,
12
12
  NonPersistedConnection,
13
13
  NonPersistedConnectionConfig,
@@ -30,23 +30,23 @@ import type {
30
30
  PartyRelationship,
31
31
  PartyType,
32
32
  PhysicalAddress,
33
- } from '../../types'
34
- import { PartyEntity } from '../../entities/contact/PartyEntity'
35
- import { IdentityEntity } from '../../entities/contact/IdentityEntity'
36
- import { ElectronicAddressEntity } from '../../entities/contact/ElectronicAddressEntity'
37
- import { PartyRelationshipEntity } from '../../entities/contact/PartyRelationshipEntity'
33
+ } from '@sphereon/ssi-sdk.data-store-types'
34
+ import { BaseConfigEntity } from '../../entities/contact/BaseConfigEntity'
38
35
  import { BaseContactEntity } from '../../entities/contact/BaseContactEntity'
39
- import { NaturalPersonEntity } from '../../entities/contact/NaturalPersonEntity'
40
- import { OrganizationEntity } from '../../entities/contact/OrganizationEntity'
41
36
  import { ConnectionEntity } from '../../entities/contact/ConnectionEntity'
42
- import { BaseConfigEntity } from '../../entities/contact/BaseConfigEntity'
37
+ import { ContactMetadataItemEntity } from '../../entities/contact/ContactMetadataItemEntity'
43
38
  import { CorrelationIdentifierEntity } from '../../entities/contact/CorrelationIdentifierEntity'
44
39
  import { DidAuthConfigEntity } from '../../entities/contact/DidAuthConfigEntity'
40
+ import { ElectronicAddressEntity } from '../../entities/contact/ElectronicAddressEntity'
41
+ import { IdentityEntity } from '../../entities/contact/IdentityEntity'
45
42
  import { IdentityMetadataItemEntity } from '../../entities/contact/IdentityMetadataItemEntity'
43
+ import { NaturalPersonEntity } from '../../entities/contact/NaturalPersonEntity'
46
44
  import { OpenIdConfigEntity } from '../../entities/contact/OpenIdConfigEntity'
45
+ import { OrganizationEntity } from '../../entities/contact/OrganizationEntity'
46
+ import { PartyEntity } from '../../entities/contact/PartyEntity'
47
+ import { PartyRelationshipEntity } from '../../entities/contact/PartyRelationshipEntity'
47
48
  import { PartyTypeEntity } from '../../entities/contact/PartyTypeEntity'
48
49
  import { PhysicalAddressEntity } from '../../entities/contact/PhysicalAddressEntity'
49
- import { ContactMetadataItemEntity } from '../../entities/contact/ContactMetadataItemEntity'
50
50
  import { replaceNullWithUndefined } from '../FormattingUtils'
51
51
 
52
52
  export const partyEntityFrom = (party: NonPersistedParty): PartyEntity => {
@@ -1,3 +1,6 @@
1
+ import { defaultHasher } from '@sphereon/ssi-sdk.core'
2
+ import type { AddCredentialArgs, DigitalCredential, NonPersistedDigitalCredential } from '@sphereon/ssi-sdk.data-store-types'
3
+ import { CredentialDocumentFormat, DocumentType, RegulationType } from '@sphereon/ssi-sdk.data-store-types'
1
4
  import {
2
5
  CredentialMapper,
3
6
  DocumentFormat,
@@ -10,10 +13,7 @@ import {
10
13
  } from '@sphereon/ssi-types'
11
14
  import { computeEntryHash } from '@veramo/utils'
12
15
  import { DigitalCredentialEntity } from '../../entities/digitalCredential/DigitalCredentialEntity'
13
- import type { AddCredentialArgs, DigitalCredential, NonPersistedDigitalCredential } from '../../types'
14
- import { CredentialDocumentFormat, DocumentType, RegulationType } from '../../types'
15
16
  import { replaceNullWithUndefined } from '../FormattingUtils'
16
- import { defaultHasher } from '@sphereon/ssi-sdk.core'
17
17
 
18
18
  function determineDocumentType(raw: string): DocumentType {
19
19
  const rawDocument = parseRawDocument(raw)
@@ -51,24 +51,6 @@ export function parseRawDocument(raw: string): OriginalVerifiableCredential | Or
51
51
  }
52
52
  }
53
53
 
54
- export function ensureRawDocument(input: string | object): string {
55
- if (typeof input === 'string') {
56
- if (isHex(input) || ObjectUtils.isBase64(input)) {
57
- // mso_mdoc
58
- return input
59
- } else if (CredentialMapper.isJwtEncoded(input) || CredentialMapper.isSdJwtEncoded(input)) {
60
- return input
61
- }
62
- throw Error('Unknown input to be mapped as rawDocument')
63
- }
64
-
65
- try {
66
- return JSON.stringify(input)
67
- } catch (e) {
68
- throw new Error(`Can't stringify to a raw credential: ${input}`)
69
- }
70
- }
71
-
72
54
  function determineCredentialDocumentFormat(documentFormat: DocumentFormat): CredentialDocumentFormat {
73
55
  switch (documentFormat) {
74
56
  case DocumentFormat.JSONLD:
@@ -1,8 +1,8 @@
1
1
  import type { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
2
+ import type { NonPersistedActivityLoggingEvent, NonPersistedAuditLoggingEvent } from '@sphereon/ssi-sdk.data-store-types'
2
3
  import { LoggingEventType } from '@sphereon/ssi-types'
3
- import { replaceNullWithUndefined } from '../FormattingUtils'
4
4
  import { AuditEventEntity } from '../../entities/eventLogger/AuditEventEntity'
5
- import type { NonPersistedActivityLoggingEvent, NonPersistedAuditLoggingEvent } from '../../types'
5
+ import { replaceNullWithUndefined } from '../FormattingUtils'
6
6
 
7
7
  export const auditEventFrom = (event: AuditEventEntity): AuditLoggingEvent => {
8
8
  const result: AuditLoggingEvent = {
@@ -1,15 +1,3 @@
1
- import { replaceNullWithUndefined } from '../FormattingUtils'
2
- import { isEmptyString } from '../../entities/validators'
3
- import { CredentialBrandingEntity } from '../../entities/issuanceBranding/CredentialBrandingEntity'
4
- import { BaseLocaleBrandingEntity } from '../../entities/issuanceBranding/BaseLocaleBrandingEntity'
5
- import { IssuerBrandingEntity } from '../../entities/issuanceBranding/IssuerBrandingEntity'
6
- import { ImageAttributesEntity } from '../../entities/issuanceBranding/ImageAttributesEntity'
7
- import { BackgroundAttributesEntity } from '../../entities/issuanceBranding/BackgroundAttributesEntity'
8
- import { TextAttributesEntity } from '../../entities/issuanceBranding/TextAttributesEntity'
9
- import { IssuerLocaleBrandingEntity } from '../../entities/issuanceBranding/IssuerLocaleBrandingEntity'
10
- import { CredentialLocaleBrandingEntity } from '../../entities/issuanceBranding/CredentialLocaleBrandingEntity'
11
- import { ImageDimensionsEntity } from '../../entities/issuanceBranding/ImageDimensionsEntity'
12
- import { CredentialClaimsEntity } from '../../entities/issuanceBranding/CredentialClaimsEntity'
13
1
  import type {
14
2
  IBasicBackgroundAttributes,
15
3
  IBasicCredentialBranding,
@@ -23,7 +11,19 @@ import type {
23
11
  ICredentialBranding,
24
12
  IIssuerBranding,
25
13
  ILocaleBranding,
26
- } from '../../types'
14
+ } from '@sphereon/ssi-sdk.data-store-types'
15
+ import { BackgroundAttributesEntity } from '../../entities/issuanceBranding/BackgroundAttributesEntity'
16
+ import { BaseLocaleBrandingEntity } from '../../entities/issuanceBranding/BaseLocaleBrandingEntity'
17
+ import { CredentialBrandingEntity } from '../../entities/issuanceBranding/CredentialBrandingEntity'
18
+ import { CredentialClaimsEntity } from '../../entities/issuanceBranding/CredentialClaimsEntity'
19
+ import { CredentialLocaleBrandingEntity } from '../../entities/issuanceBranding/CredentialLocaleBrandingEntity'
20
+ import { ImageAttributesEntity } from '../../entities/issuanceBranding/ImageAttributesEntity'
21
+ import { ImageDimensionsEntity } from '../../entities/issuanceBranding/ImageDimensionsEntity'
22
+ import { IssuerBrandingEntity } from '../../entities/issuanceBranding/IssuerBrandingEntity'
23
+ import { IssuerLocaleBrandingEntity } from '../../entities/issuanceBranding/IssuerLocaleBrandingEntity'
24
+ import { TextAttributesEntity } from '../../entities/issuanceBranding/TextAttributesEntity'
25
+ import { isEmptyString } from '../../entities/validators'
26
+ import { replaceNullWithUndefined } from '../FormattingUtils'
27
27
 
28
28
  export const credentialBrandingFrom = (credentialBranding: CredentialBrandingEntity): ICredentialBranding => {
29
29
  const result: ICredentialBranding = {
@@ -1,58 +1,67 @@
1
- import { PresentationDefinitionItemEntity } from '../../entities/presentationDefinition/PresentationDefinitionItemEntity'
2
1
  import type { IPresentationDefinition } from '@sphereon/pex'
3
- import type { NonPersistedPresentationDefinitionItem, PartialPresentationDefinitionItem, PresentationDefinitionItem } from '../../types'
2
+ import type { DcqlQueryItem, NonPersistedDcqlQueryItem, PartialDcqlQueryItem } from '@sphereon/ssi-sdk.data-store-types'
4
3
  import * as blakepkg from 'blakejs'
4
+ import { DcqlQuery } from 'dcql'
5
+ import { DcqlQueryItemEntity } from '../../entities/presentationDefinition/DcqlQueryItemEntity'
5
6
  import { replaceNullWithUndefined } from '../FormattingUtils'
6
- import type { DcqlQueryREST } from '@sphereon/ssi-types'
7
7
 
8
- export const presentationDefinitionItemFrom = (entity: PresentationDefinitionItemEntity): PresentationDefinitionItem => {
9
- const result: PresentationDefinitionItem = {
8
+ export const dcqlQueryItemFrom = (entity: DcqlQueryItemEntity): DcqlQueryItem => {
9
+ const result: DcqlQueryItem = {
10
10
  id: entity.id,
11
11
  tenantId: entity.tenantId,
12
- definitionId: entity.definitionId,
12
+ queryId: entity.queryId,
13
13
  version: entity.version,
14
14
  name: entity.name,
15
15
  purpose: entity.purpose,
16
- definitionPayload: JSON.parse(entity.definitionPayload) as IPresentationDefinition,
17
- dcqlPayload: JSON.parse(entity.dcqlPayload) as DcqlQueryREST,
16
+ query: DcqlQuery.parse(JSON.parse(entity.query)),
18
17
  createdAt: entity.createdAt,
19
18
  lastUpdatedAt: entity.lastUpdatedAt,
20
19
  }
21
20
 
21
+ if (result.query) {
22
+ DcqlQuery.validate(result.query)
23
+ }
22
24
  return replaceNullWithUndefined(result)
23
25
  }
24
26
 
25
- export const presentationDefinitionEntityItemFrom = (item: NonPersistedPresentationDefinitionItem): PresentationDefinitionItemEntity => {
26
- const entity = new PresentationDefinitionItemEntity()
27
+ export const dcqlQueryEntityItemFrom = (item: NonPersistedDcqlQueryItem): DcqlQueryItemEntity => {
28
+ const entity = new DcqlQueryItemEntity()
27
29
 
28
30
  entity.tenantId = item.tenantId
29
- entity.definitionId = item.definitionId!
31
+ entity.queryId = item.queryId!
30
32
  entity.version = item.version
31
33
  entity.name = item.name
32
34
  entity.purpose = item.purpose
33
- entity.definitionPayload = JSON.stringify(item.definitionPayload!)
34
- entity.dcqlPayload = JSON.stringify(item.dcqlPayload!)
35
+ if (item.query) {
36
+ const dcqlQuery = DcqlQuery.parse(item.query)
37
+ DcqlQuery.validate(dcqlQuery)
38
+ entity.query = JSON.stringify(item.query)
39
+ }
35
40
  return entity
36
41
  }
37
42
 
38
- function hashPayload(payload: IPresentationDefinition): string {
43
+ function hashPayload(payload: IPresentationDefinition | DcqlQuery): string {
39
44
  return blakepkg.blake2bHex(JSON.stringify(payload))
40
45
  }
41
46
 
42
- export function isPresentationDefinitionEqual(base: PartialPresentationDefinitionItem, compare: PartialPresentationDefinitionItem): boolean {
47
+ export function isPresentationDefinitionEqual(base: PartialDcqlQueryItem, compare: PartialDcqlQueryItem): boolean {
43
48
  if (
44
- base.definitionId !== compare.definitionId ||
45
- base.tenantId != compare.tenantId ||
49
+ base.queryId !== compare.queryId ||
50
+ base.tenantId !== compare.tenantId ||
46
51
  base.version !== compare.version ||
47
- base.name != compare.name ||
48
- base.purpose != compare.purpose
52
+ base.name !== compare.name ||
53
+ base.purpose !== compare.purpose
49
54
  ) {
50
55
  return false
51
56
  }
52
57
 
53
- if (base.definitionPayload && compare.definitionPayload) {
54
- return hashPayload(base.definitionPayload) === hashPayload(compare.definitionPayload)
58
+ if (base.query && compare.query) {
59
+ if (hashPayload(base.query) !== hashPayload(compare.query)) {
60
+ return false
61
+ }
62
+ } else if (base.query || compare.query) {
63
+ return false
55
64
  }
56
65
 
57
- return false
66
+ return true
58
67
  }
@@ -1,11 +1,11 @@
1
1
  import { IBitstringStatusListEntity, IOAuthStatusListEntity, IStatusList2021Entity, IStatusListEntity } from '../../types'
2
+ import { StatusListType } from '@sphereon/ssi-types'
2
3
  import {
3
4
  BitstringStatusListEntity,
4
5
  OAuthStatusListEntity,
5
6
  StatusList2021Entity,
6
7
  StatusListEntity,
7
8
  } from '../../entities/statusList/StatusListEntities'
8
- import { StatusListType } from '@sphereon/ssi-types'
9
9
  import { replaceNullWithUndefined } from '../FormattingUtils'
10
10
 
11
11
  export const statusListEntityFrom = (args: IStatusListEntity): StatusListEntity => {
@@ -1,71 +0,0 @@
1
- import {
2
- AddElectronicAddressArgs,
3
- AddIdentityArgs,
4
- AddPartyArgs,
5
- AddPartyTypeArgs,
6
- AddPhysicalAddressArgs,
7
- AddRelationshipArgs,
8
- ElectronicAddress,
9
- GetElectronicAddressArgs,
10
- GetElectronicAddressesArgs,
11
- GetIdentitiesArgs,
12
- GetIdentityArgs,
13
- GetPartiesArgs,
14
- GetPartyArgs,
15
- GetPartyTypeArgs,
16
- GetPartyTypesArgs,
17
- GetPhysicalAddressArgs,
18
- GetPhysicalAddressesArgs,
19
- GetRelationshipArgs,
20
- GetRelationshipsArgs,
21
- Identity,
22
- Party,
23
- PartyRelationship,
24
- PartyType,
25
- PhysicalAddress,
26
- RemoveElectronicAddressArgs,
27
- RemoveIdentityArgs,
28
- RemovePartyArgs,
29
- RemovePartyTypeArgs,
30
- RemovePhysicalAddressArgs,
31
- RemoveRelationshipArgs,
32
- UpdateElectronicAddressArgs,
33
- UpdateIdentityArgs,
34
- UpdatePartyArgs,
35
- UpdatePartyTypeArgs,
36
- UpdatePhysicalAddressArgs,
37
- UpdateRelationshipArgs,
38
- } from '../types'
39
-
40
- export abstract class AbstractContactStore {
41
- abstract getParty(args: GetPartyArgs): Promise<Party>
42
- abstract getParties(args?: GetPartiesArgs): Promise<Array<Party>>
43
- abstract addParty(args: AddPartyArgs): Promise<Party>
44
- abstract updateParty(args: UpdatePartyArgs): Promise<Party>
45
- abstract removeParty(args: RemovePartyArgs): Promise<void>
46
- abstract getIdentity(args: GetIdentityArgs): Promise<Identity>
47
- abstract getIdentities(args?: GetIdentitiesArgs): Promise<Array<Identity>>
48
- abstract addIdentity(args: AddIdentityArgs): Promise<Identity>
49
- abstract updateIdentity(args: UpdateIdentityArgs): Promise<Identity>
50
- abstract removeIdentity(args: RemoveIdentityArgs): Promise<void>
51
- abstract getRelationship(args: GetRelationshipArgs): Promise<PartyRelationship>
52
- abstract getRelationships(args?: GetRelationshipsArgs): Promise<Array<PartyRelationship>>
53
- abstract addRelationship(args: AddRelationshipArgs): Promise<PartyRelationship>
54
- abstract updateRelationship(args: UpdateRelationshipArgs): Promise<PartyRelationship>
55
- abstract removeRelationship(args: RemoveRelationshipArgs): Promise<void>
56
- abstract getPartyType(args: GetPartyTypeArgs): Promise<PartyType>
57
- abstract getPartyTypes(args?: GetPartyTypesArgs): Promise<Array<PartyType>>
58
- abstract addPartyType(args: AddPartyTypeArgs): Promise<PartyType>
59
- abstract updatePartyType(args: UpdatePartyTypeArgs): Promise<PartyType>
60
- abstract removePartyType(args: RemovePartyTypeArgs): Promise<void>
61
- abstract getElectronicAddress(args: GetElectronicAddressArgs): Promise<ElectronicAddress>
62
- abstract getElectronicAddresses(args?: GetElectronicAddressesArgs): Promise<Array<ElectronicAddress>>
63
- abstract addElectronicAddress(args: AddElectronicAddressArgs): Promise<ElectronicAddress>
64
- abstract updateElectronicAddress(args: UpdateElectronicAddressArgs): Promise<ElectronicAddress>
65
- abstract removeElectronicAddress(args: RemoveElectronicAddressArgs): Promise<void>
66
- abstract getPhysicalAddress(args: GetPhysicalAddressArgs): Promise<PhysicalAddress>
67
- abstract getPhysicalAddresses(args?: GetPhysicalAddressesArgs): Promise<Array<PhysicalAddress>>
68
- abstract addPhysicalAddress(args: AddPhysicalAddressArgs): Promise<PhysicalAddress>
69
- abstract updatePhysicalAddress(args: UpdatePhysicalAddressArgs): Promise<PhysicalAddress>
70
- abstract removePhysicalAddress(args: RemovePhysicalAddressArgs): Promise<void>
71
- }
@@ -1,21 +0,0 @@
1
- import {
2
- AddCredentialArgs,
3
- DigitalCredential,
4
- GetCredentialArgs,
5
- GetCredentialsArgs,
6
- GetCredentialsResponse,
7
- RemoveCredentialArgs,
8
- UpdateCredentialStateArgs,
9
- } from '../types'
10
-
11
- export abstract class AbstractDigitalCredentialStore {
12
- abstract getCredential(args: GetCredentialArgs): Promise<DigitalCredential>
13
-
14
- abstract getCredentials(args?: GetCredentialsArgs): Promise<GetCredentialsResponse>
15
-
16
- abstract addCredential(args: AddCredentialArgs): Promise<DigitalCredential>
17
-
18
- abstract updateCredentialState(args: UpdateCredentialStateArgs): Promise<DigitalCredential>
19
-
20
- abstract removeCredential(args: RemoveCredentialArgs): Promise<boolean>
21
- }
@@ -1,9 +0,0 @@
1
- import type { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
2
- import type { GetActivityEventsArgs, GetAuditEventsArgs, StoreActivityEventArgs, StoreAuditEventArgs } from '../types'
3
-
4
- export abstract class AbstractEventLoggerStore {
5
- abstract getAuditEvents(args: GetAuditEventsArgs): Promise<Array<AuditLoggingEvent>>
6
- abstract getActivityEvents(args: GetActivityEventsArgs): Promise<Array<ActivityLoggingEvent>>
7
- abstract storeAuditEvent(args: StoreAuditEventArgs): Promise<AuditLoggingEvent>
8
- abstract storeActivityEvent(args: StoreActivityEventArgs): Promise<ActivityLoggingEvent>
9
- }
@@ -1,41 +0,0 @@
1
- import type {
2
- IAddCredentialBrandingArgs,
3
- IAddCredentialLocaleBrandingArgs,
4
- IAddIssuerBrandingArgs,
5
- IAddIssuerLocaleBrandingArgs,
6
- ICredentialBranding,
7
- ICredentialLocaleBranding,
8
- IGetCredentialBrandingArgs,
9
- IGetCredentialLocaleBrandingArgs,
10
- IGetIssuerBrandingArgs,
11
- IGetIssuerLocaleBrandingArgs,
12
- IIssuerBranding,
13
- IIssuerLocaleBranding,
14
- IRemoveCredentialBrandingArgs,
15
- IRemoveCredentialLocaleBrandingArgs,
16
- IRemoveIssuerBrandingArgs,
17
- IRemoveIssuerLocaleBrandingArgs,
18
- IUpdateCredentialBrandingArgs,
19
- IUpdateCredentialLocaleBrandingArgs,
20
- IUpdateIssuerBrandingArgs,
21
- IUpdateIssuerLocaleBrandingArgs,
22
- } from '../types'
23
-
24
- export abstract class AbstractIssuanceBrandingStore {
25
- public abstract addCredentialBranding(args: IAddCredentialBrandingArgs): Promise<ICredentialBranding>
26
- public abstract getCredentialBranding(args?: IGetCredentialBrandingArgs): Promise<Array<ICredentialBranding>>
27
- public abstract updateCredentialBranding(args: IUpdateCredentialBrandingArgs): Promise<ICredentialBranding>
28
- public abstract removeCredentialBranding(args: IRemoveCredentialBrandingArgs): Promise<void>
29
- public abstract addCredentialLocaleBranding(args: IAddCredentialLocaleBrandingArgs): Promise<ICredentialBranding>
30
- public abstract getCredentialLocaleBranding(args?: IGetCredentialLocaleBrandingArgs): Promise<Array<ICredentialLocaleBranding>>
31
- public abstract updateCredentialLocaleBranding(args: IUpdateCredentialLocaleBrandingArgs): Promise<ICredentialLocaleBranding>
32
- public abstract removeCredentialLocaleBranding(args: IRemoveCredentialLocaleBrandingArgs): Promise<void>
33
- public abstract addIssuerBranding(args: IAddIssuerBrandingArgs): Promise<IIssuerBranding>
34
- public abstract getIssuerBranding(args?: IGetIssuerBrandingArgs): Promise<Array<IIssuerBranding>>
35
- public abstract updateIssuerBranding(args: IUpdateIssuerBrandingArgs): Promise<IIssuerBranding>
36
- public abstract removeIssuerBranding(args: IRemoveIssuerBrandingArgs): Promise<void>
37
- public abstract addIssuerLocaleBranding(args: IAddIssuerLocaleBrandingArgs): Promise<IIssuerBranding>
38
- public abstract getIssuerLocaleBranding(args?: IGetIssuerLocaleBrandingArgs): Promise<Array<IIssuerLocaleBranding>>
39
- public abstract updateIssuerLocaleBranding(args: IUpdateIssuerLocaleBrandingArgs): Promise<IIssuerLocaleBranding>
40
- public abstract removeIssuerLocaleBranding(args: IRemoveIssuerLocaleBrandingArgs): Promise<void>
41
- }
@@ -1,65 +0,0 @@
1
- import type {
2
- StoreMachineStateDeleteExpiredArgs,
3
- StoreMachineStateDeleteArgs,
4
- StoreMachineStatesFindActiveArgs,
5
- StoreFindMachineStatesArgs,
6
- StoreMachineStatePersistArgs,
7
- StoreMachineStateInfo,
8
- StoreMachineStateGetArgs,
9
- } from '../types'
10
-
11
- /**
12
- * Represents an abstract class for storing machine states.
13
- * This class provides methods for persisting, retrieving, and deleting machine states.
14
- *
15
- * @interface
16
- */
17
- export abstract class IAbstractMachineStateStore {
18
- /**
19
- * Persists the machine state.
20
- *
21
- * @param {StoreMachineStatePersistArgs} state - The object containing the machine state to persist.
22
- * @return {Promise<StoreMachineStateInfo>} - A Promise that resolves to the information about the persisted machine state.
23
- */
24
- abstract persistMachineState(state: StoreMachineStatePersistArgs): Promise<StoreMachineStateInfo>
25
-
26
- /**
27
- * Finds active machine states based on the given arguments.
28
- *
29
- * @param {StoreMachineStatesFindActiveArgs} args - The arguments for finding active machine states.
30
- * @return {Promise<Array<StoreMachineStateInfo>>} - A promise that resolves with an array of active machine states.
31
- */
32
- abstract findActiveMachineStates(args: StoreMachineStatesFindActiveArgs): Promise<Array<StoreMachineStateInfo>>
33
-
34
- /**
35
- * Retrieves the state of a particular machine.
36
- *
37
- * @param {StoreMachineStateGetArgs} args - The arguments for retrieving the machine state.
38
- * @returns {Promise<StoreMachineStateInfo>} - A promise that resolves to the machine state information.
39
- */
40
- abstract getMachineState(args: StoreMachineStateGetArgs): Promise<StoreMachineStateInfo>
41
-
42
- /**
43
- * Finds the machine states based on the given arguments.
44
- *
45
- * @param {StoreFindMachineStatesArgs} [args] - The arguments to filter the machine states.
46
- * @returns {Promise<Array<StoreMachineStateInfo>>} - A promise that resolves to an array of machine state information.
47
- */
48
- abstract findMachineStates(args?: StoreFindMachineStatesArgs): Promise<Array<StoreMachineStateInfo>>
49
-
50
- /**
51
- * Deletes a machine state.
52
- *
53
- * @param {StoreMachineStateDeleteArgs} args - The arguments for deleting the machine state.
54
- * @return {Promise<boolean>} - A promise that resolves to a boolean indicating if the machine state was successfully deleted or not.
55
- */
56
- abstract deleteMachineState(args: StoreMachineStateDeleteArgs): Promise<boolean>
57
-
58
- /**
59
- * Deletes expired machine states from the database.
60
- *
61
- * @param {StoreMachineStateDeleteExpiredArgs} args - The arguments for deleting expired machine states.
62
- * @return {Promise<number>} - A promise that resolves to the number of deleted machine states.
63
- */
64
- abstract deleteExpiredMachineStates(args: StoreMachineStateDeleteExpiredArgs): Promise<number>
65
- }
@@ -1,20 +0,0 @@
1
- import type {
2
- GetDefinitionArgs,
3
- GetDefinitionsArgs,
4
- DeleteDefinitionArgs,
5
- PresentationDefinitionItem,
6
- AddDefinitionArgs,
7
- UpdateDefinitionArgs,
8
- DeleteDefinitionsArgs,
9
- } from '../types'
10
-
11
- export abstract class AbstractPDStore {
12
- abstract hasDefinition(args: GetDefinitionArgs): Promise<boolean>
13
- abstract hasDefinitions(args: GetDefinitionsArgs): Promise<boolean>
14
- abstract getDefinition(args: GetDefinitionArgs): Promise<PresentationDefinitionItem>
15
- abstract getDefinitions(args: GetDefinitionsArgs): Promise<Array<PresentationDefinitionItem>>
16
- abstract addDefinition(args: AddDefinitionArgs): Promise<PresentationDefinitionItem>
17
- abstract updateDefinition(args: UpdateDefinitionArgs): Promise<PresentationDefinitionItem>
18
- abstract deleteDefinition(args: DeleteDefinitionArgs): Promise<void>
19
- abstract deleteDefinitions(args: DeleteDefinitionsArgs): Promise<number>
20
- }
@@ -1,161 +0,0 @@
1
- import {
2
- ElectronicAddress,
3
- Identity,
4
- NonPersistedContact,
5
- NonPersistedElectronicAddress,
6
- NonPersistedIdentity,
7
- NonPersistedPartyType,
8
- NonPersistedPhysicalAddress,
9
- PartialElectronicAddress,
10
- PartialIdentity,
11
- PartialParty,
12
- PartialPartyRelationship,
13
- PartialPartyType,
14
- PartialPhysicalAddress,
15
- Party,
16
- PartyOrigin,
17
- PartyRelationship,
18
- PartyType,
19
- PartyTypeType,
20
- PhysicalAddress,
21
- } from './contact'
22
-
23
- export type FindPartyArgs = Array<PartialParty>
24
- export type FindIdentityArgs = Array<PartialIdentity>
25
- export type FindPartyTypeArgs = Array<PartialPartyType>
26
- export type FindRelationshipArgs = Array<PartialPartyRelationship>
27
- export type FindElectronicAddressArgs = Array<PartialElectronicAddress>
28
- export type FindPhysicalAddressArgs = Array<PartialPhysicalAddress>
29
-
30
- export type GetPartyArgs = {
31
- partyId: string
32
- }
33
-
34
- export type GetPartiesArgs = {
35
- filter?: FindPartyArgs
36
- }
37
-
38
- export type AddPartyArgs = {
39
- uri?: string
40
- partyType: NonPersistedPartyType
41
- contact: NonPersistedContact
42
- identities?: Array<NonPersistedIdentity>
43
- electronicAddresses?: Array<NonPersistedElectronicAddress>
44
- physicalAddresses?: Array<NonPersistedPhysicalAddress>
45
- }
46
-
47
- export type UpdatePartyArgs = {
48
- party: Omit<Party, 'identities' | 'electronicAddresses' | 'partyType' | 'createdAt' | 'lastUpdatedAt'>
49
- }
50
-
51
- export type RemovePartyArgs = {
52
- partyId: string
53
- }
54
-
55
- export type GetIdentityArgs = {
56
- identityId: string
57
- }
58
-
59
- export type GetIdentitiesArgs = {
60
- filter?: FindIdentityArgs
61
- }
62
-
63
- export type AddIdentityArgs = {
64
- partyId: string
65
- identity: NonPersistedIdentity
66
- }
67
-
68
- export type UpdateIdentityArgs = {
69
- identity: Identity
70
- }
71
-
72
- export type RemoveIdentityArgs = {
73
- identityId: string
74
- }
75
-
76
- export type RemoveRelationshipArgs = {
77
- relationshipId: string
78
- }
79
-
80
- export type AddRelationshipArgs = {
81
- leftId: string
82
- rightId: string
83
- }
84
-
85
- export type GetRelationshipArgs = {
86
- relationshipId: string
87
- }
88
-
89
- export type GetRelationshipsArgs = {
90
- filter: FindRelationshipArgs
91
- }
92
-
93
- export type UpdateRelationshipArgs = {
94
- relationship: Omit<PartyRelationship, 'createdAt' | 'lastUpdatedAt'>
95
- }
96
-
97
- export type AddPartyTypeArgs = {
98
- type: PartyTypeType
99
- origin: PartyOrigin
100
- name: string
101
- tenantId: string
102
- description?: string
103
- }
104
-
105
- export type GetPartyTypeArgs = {
106
- partyTypeId: string
107
- }
108
-
109
- export type GetPartyTypesArgs = {
110
- filter?: FindPartyTypeArgs
111
- }
112
-
113
- export type UpdatePartyTypeArgs = {
114
- partyType: Omit<PartyType, 'createdAt' | 'lastUpdatedAt'>
115
- }
116
-
117
- export type RemovePartyTypeArgs = {
118
- partyTypeId: string
119
- }
120
-
121
- export type GetElectronicAddressArgs = {
122
- electronicAddressId: string
123
- }
124
-
125
- export type GetElectronicAddressesArgs = {
126
- filter?: FindElectronicAddressArgs
127
- }
128
-
129
- export type AddElectronicAddressArgs = {
130
- partyId: string
131
- electronicAddress: NonPersistedElectronicAddress
132
- }
133
-
134
- export type UpdateElectronicAddressArgs = {
135
- electronicAddress: ElectronicAddress
136
- }
137
-
138
- export type RemoveElectronicAddressArgs = {
139
- electronicAddressId: string
140
- }
141
-
142
- export type GetPhysicalAddressArgs = {
143
- physicalAddressId: string
144
- }
145
-
146
- export type GetPhysicalAddressesArgs = {
147
- filter?: FindPhysicalAddressArgs
148
- }
149
-
150
- export type AddPhysicalAddressArgs = {
151
- partyId: string
152
- physicalAddress: NonPersistedPhysicalAddress
153
- }
154
-
155
- export type UpdatePhysicalAddressArgs = {
156
- physicalAddress: PhysicalAddress
157
- }
158
-
159
- export type RemovePhysicalAddressArgs = {
160
- physicalAddressId: string
161
- }