@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.
Files changed (113) hide show
  1. package/dist/index.cjs +3844 -3819
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +1270 -339
  4. package/dist/index.d.ts +1270 -339
  5. package/dist/index.js +3791 -3766
  6. package/dist/index.js.map +1 -1
  7. package/package.json +8 -9
  8. package/src/__tests__/contact.entities.test.ts +10 -4
  9. package/src/__tests__/contact.store.test.ts +6 -11
  10. package/src/__tests__/digitalCredential.entities.test.ts +6 -13
  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 +4 -9
  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 +98 -27
  19. package/src/__tests__/pd-manager.store.test.ts +101 -151
  20. package/src/__tests__/statusList.entities.test.ts +4 -4
  21. package/src/__tests__/statusList.store.test.ts +3 -3
  22. package/src/contact/AbstractContactStore.ts +71 -0
  23. package/src/contact/ContactStore.ts +35 -35
  24. package/src/digitalCredential/AbstractDigitalCredentialStore.ts +21 -0
  25. package/src/digitalCredential/DigitalCredentialStore.ts +7 -6
  26. package/src/entities/contact/BaseConfigEntity.ts +2 -2
  27. package/src/entities/contact/BaseContactEntity.ts +5 -4
  28. package/src/entities/contact/ConnectionEntity.ts +4 -4
  29. package/src/entities/contact/ContactMetadataItemEntity.ts +4 -3
  30. package/src/entities/contact/CorrelationIdentifierEntity.ts +4 -3
  31. package/src/entities/contact/DidAuthConfigEntity.ts +2 -1
  32. package/src/entities/contact/ElectronicAddressEntity.ts +5 -15
  33. package/src/entities/contact/IdentityEntity.ts +11 -12
  34. package/src/entities/contact/IdentityMetadataItemEntity.ts +3 -3
  35. package/src/entities/contact/NaturalPersonEntity.ts +5 -5
  36. package/src/entities/contact/OrganizationEntity.ts +1 -1
  37. package/src/entities/contact/PartyEntity.ts +7 -7
  38. package/src/entities/contact/PartyRelationshipEntity.ts +8 -8
  39. package/src/entities/contact/PartyTypeEntity.ts +4 -4
  40. package/src/entities/contact/PhysicalAddressEntity.ts +3 -3
  41. package/src/entities/digitalCredential/DigitalCredentialEntity.ts +3 -4
  42. package/src/entities/eventLogger/AuditEventEntity.ts +2 -2
  43. package/src/entities/issuanceBranding/BackgroundAttributesEntity.ts +2 -2
  44. package/src/entities/issuanceBranding/BaseLocaleBrandingEntity.ts +7 -6
  45. package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +2 -2
  46. package/src/entities/issuanceBranding/CredentialClaimsEntity.ts +2 -2
  47. package/src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts +2 -2
  48. package/src/entities/issuanceBranding/ImageAttributesEntity.ts +2 -2
  49. package/src/entities/issuanceBranding/IssuerBrandingEntity.ts +2 -2
  50. package/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts +3 -3
  51. package/src/entities/issuanceBranding/TextAttributesEntity.ts +1 -1
  52. package/src/entities/machineState/MachineStateInfoEntity.ts +1 -1
  53. package/src/entities/presentationDefinition/{DcqlQueryItemEntity.ts → PresentationDefinitionItemEntity.ts} +14 -10
  54. package/src/entities/statusList/BitstringStatusListEntryEntity.ts +1 -1
  55. package/src/entities/statusList/StatusListEntities.ts +4 -3
  56. package/src/eventLogger/AbstractEventLoggerStore.ts +9 -0
  57. package/src/eventLogger/EventLoggerStore.ts +2 -2
  58. package/src/index.ts +26 -21
  59. package/src/issuanceBranding/AbstractIssuanceBrandingStore.ts +41 -0
  60. package/src/issuanceBranding/IssuanceBrandingStore.ts +25 -25
  61. package/src/machineState/IAbstractMachineStateStore.ts +65 -0
  62. package/src/machineState/MachineStateStore.ts +7 -7
  63. package/src/migrations/generic/1-CreateContacts.ts +1 -1
  64. package/src/migrations/generic/10-CreatePresentationDefinitions.ts +1 -1
  65. package/src/migrations/generic/11-FixCredentialClaimsReferenceUuid.ts +2 -2
  66. package/src/migrations/generic/12-CreateBitstringStatusList.ts +2 -32
  67. package/src/migrations/generic/2-CreateIssuanceBranding.ts +1 -1
  68. package/src/migrations/generic/3-CreateContacts.ts +2 -2
  69. package/src/migrations/generic/4-CreateStatusList.ts +1 -1
  70. package/src/migrations/generic/5-CreateAuditEvents.ts +2 -2
  71. package/src/migrations/generic/6-CreateDigitalCredential.ts +1 -1
  72. package/src/migrations/generic/7-CreateMachineStateStore.ts +1 -1
  73. package/src/migrations/generic/8-CreateContacts.ts +1 -1
  74. package/src/migrations/generic/9-CreateContacts.ts +1 -1
  75. package/src/migrations/generic/index.ts +5 -10
  76. package/src/migrations/postgres/1659463079428-CreateContacts.ts +1 -1
  77. package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +1 -1
  78. package/src/migrations/postgres/1690925872592-CreateContacts.ts +1 -1
  79. package/src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts +1 -1
  80. package/src/migrations/postgres/1737110469001-UpdateStatusList.ts +1 -1
  81. package/src/migrations/postgres/1741895823000-CreateBitstringStatusList.ts +2 -15
  82. package/src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts +1 -1
  83. package/src/presentationDefinition/AbstractPDStore.ts +20 -0
  84. package/src/presentationDefinition/PDStore.ts +45 -45
  85. package/src/statusList/IStatusListStore.ts +1 -1
  86. package/src/statusList/StatusListStore.ts +3 -3
  87. package/src/types/contact/IAbstractContactStore.ts +161 -0
  88. package/src/types/contact/contact.ts +295 -0
  89. package/src/types/contact/index.ts +2 -0
  90. package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +43 -0
  91. package/src/types/digitalCredential/enums.ts +70 -0
  92. package/src/types/digitalCredential/index.ts +3 -0
  93. package/src/types/digitalCredential/types.ts +39 -0
  94. package/src/types/eventLogger/IAbstractEventLoggerStore.ts +22 -0
  95. package/src/types/eventLogger/eventLogger.ts +4 -0
  96. package/src/types/index.ts +12 -0
  97. package/src/types/issuanceBranding/IAbstractIssuanceBrandingStore.ts +85 -0
  98. package/src/types/issuanceBranding/issuanceBranding.ts +138 -0
  99. package/src/types/machineState/IAbstractMachineStateStore.ts +68 -0
  100. package/src/types/presentationDefinition/IAbstractPDStore.ts +25 -0
  101. package/src/types/presentationDefinition/presentationDefinition.ts +19 -0
  102. package/src/types/statusList/IAbstractStatusListStore.ts +9 -9
  103. package/src/types/validation/validation.ts +3 -0
  104. package/src/utils/ValidatorUtils.ts +1 -1
  105. package/src/utils/contact/MappingUtils.ts +10 -10
  106. package/src/utils/digitalCredential/MappingUtils.ts +21 -3
  107. package/src/utils/eventLogger/MappingUtils.ts +2 -2
  108. package/src/utils/issuanceBranding/MappingUtils.ts +13 -13
  109. package/src/utils/presentationDefinition/MappingUtils.ts +22 -31
  110. package/src/utils/statusList/MappingUtils.ts +1 -1
  111. package/src/migrations/generic/13-CreateDcqlQueryItem.ts +0 -67
  112. package/src/migrations/postgres/1726588800000-CreateDcqlQueryItem.ts +0 -25
  113. package/src/migrations/sqlite/1726617600000-CreateDcqlQueryItem.ts +0 -24
@@ -0,0 +1,2 @@
1
+ export * from './contact'
2
+ export * from './IAbstractContactStore'
@@ -0,0 +1,43 @@
1
+ import { HasherSync } from '@sphereon/ssi-types'
2
+ import { FindOptionsOrder } from 'typeorm'
3
+ import { DigitalCredentialEntity } from '../../entities/digitalCredential/DigitalCredentialEntity'
4
+ import { DigitalCredential } from './types'
5
+ import { CredentialCorrelationType, CredentialRole, CredentialStateType, RegulationType } from './enums'
6
+
7
+ export type GetCredentialArgs = { id: string } | { hash: string }
8
+
9
+ export type FindDigitalCredentialArgs = Array<Partial<DigitalCredential>>
10
+
11
+ export type GetCredentialsArgs = {
12
+ filter?: FindDigitalCredentialArgs
13
+ offset?: number
14
+ limit?: number
15
+ order?: string | FindOptionsOrder<DigitalCredentialEntity>
16
+ }
17
+
18
+ export type GetCredentialsResponse = {
19
+ data: Array<DigitalCredential>
20
+ total: number
21
+ }
22
+
23
+ export type AddCredentialArgs = {
24
+ rawDocument: string
25
+ kmsKeyRef?: string
26
+ identifierMethod?: string
27
+ regulationType?: RegulationType
28
+ parentId?: string
29
+ issuerCorrelationType: CredentialCorrelationType
30
+ subjectCorrelationType?: CredentialCorrelationType
31
+ issuerCorrelationId: string
32
+ subjectCorrelationId?: string
33
+ credentialRole: CredentialRole
34
+ tenantId?: string
35
+ state?: CredentialStateType
36
+ verifiedAt?: Date
37
+ revokedAt?: Date
38
+ opts?: { maxTimeSkewInMS?: number; hasher?: HasherSync }
39
+ }
40
+
41
+ export type UpdateCredentialStateArgs = GetCredentialArgs & { verifiedState: CredentialStateType; verifiedAt?: Date; revokedAt?: Date }
42
+
43
+ export type RemoveCredentialArgs = GetCredentialArgs
@@ -0,0 +1,70 @@
1
+ export enum DocumentType {
2
+ VC = 'VC',
3
+ VP = 'VP',
4
+ P = 'P',
5
+ C = 'C',
6
+ }
7
+
8
+ export enum RegulationType {
9
+ PID = 'PID',
10
+ QEAA = 'QEAA',
11
+ EAA = 'EAA',
12
+ NON_REGULATED = 'NON_REGULATED',
13
+ }
14
+
15
+ export enum CredentialDocumentFormat {
16
+ JSON_LD = 'JSON_LD',
17
+ JWT = 'JWT',
18
+ SD_JWT = 'SD_JWT',
19
+ MSO_MDOC = 'MSO_MDOC',
20
+ }
21
+
22
+ export namespace CredentialDocumentFormat {
23
+ export function fromSpecValue(credentialFormat: string) {
24
+ const format = credentialFormat.toLowerCase()
25
+ if (format.includes('sd')) {
26
+ return CredentialDocumentFormat.SD_JWT
27
+ } else if (format.includes('ldp')) {
28
+ return CredentialDocumentFormat.JSON_LD
29
+ } else if (format.includes('mso') || credentialFormat.includes('mdoc')) {
30
+ return CredentialDocumentFormat.MSO_MDOC
31
+ } else if (format.includes('jwt_')) {
32
+ return CredentialDocumentFormat.JWT
33
+ } else {
34
+ throw Error(`Could not map format ${format} to known format`)
35
+ }
36
+ }
37
+
38
+ export function toSpecValue(documentFormat: CredentialDocumentFormat, documentType: DocumentType) {
39
+ switch (documentFormat) {
40
+ case CredentialDocumentFormat.SD_JWT:
41
+ return 'vc+sd-jwt'
42
+ case CredentialDocumentFormat.MSO_MDOC:
43
+ return 'mso_mdoc'
44
+ case CredentialDocumentFormat.JSON_LD:
45
+ return documentType === DocumentType.C || documentType === DocumentType.VC ? 'ldp_vc' : 'ldp_vp'
46
+ case CredentialDocumentFormat.JWT:
47
+ return documentType === DocumentType.C || documentType === DocumentType.VC ? 'jwt_vc_json' : 'jwt_vp_json'
48
+ }
49
+ }
50
+ }
51
+
52
+ export enum CredentialCorrelationType {
53
+ DID = 'DID',
54
+ X509_SAN = 'X509_SAN',
55
+ KID = 'KID',
56
+ URL = 'URL',
57
+ }
58
+
59
+ export enum CredentialRole {
60
+ ISSUER = 'ISSUER',
61
+ VERIFIER = 'VERIFIER',
62
+ HOLDER = 'HOLDER',
63
+ FEDERATION_TRUST_ANCHOR = 'FEDERATION_TRUST_ANCHOR',
64
+ }
65
+
66
+ export enum CredentialStateType {
67
+ REVOKED = 'REVOKED',
68
+ VERIFIED = 'VERIFIED',
69
+ EXPIRED = 'EXPIRED',
70
+ }
@@ -0,0 +1,3 @@
1
+ export type * from './types'
2
+ export * from './enums'
3
+ export * from './IAbstractDigitalCredentialStore'
@@ -0,0 +1,39 @@
1
+ import { CredentialCorrelationType, CredentialDocumentFormat, CredentialRole, CredentialStateType, DocumentType, RegulationType } from './enums'
2
+
3
+ /**
4
+ * DigitalCredential
5
+ *
6
+ * @public
7
+ */
8
+ export type DigitalCredential = {
9
+ id: string
10
+ parentId?: string
11
+ documentType: DocumentType
12
+ documentFormat: CredentialDocumentFormat
13
+ credentialRole: CredentialRole
14
+ regulationType: RegulationType
15
+ rawDocument: string
16
+ uniformDocument: string
17
+ credentialId?: string
18
+ hash: string
19
+ kmsKeyRef?: string
20
+ identifierMethod?: string
21
+ issuerCorrelationType: CredentialCorrelationType
22
+ subjectCorrelationType?: CredentialCorrelationType
23
+ rpCorrelationType?: CredentialCorrelationType
24
+ isIssuerSigned?: boolean
25
+ issuerCorrelationId: string
26
+ subjectCorrelationId?: string
27
+ rpCorrelationId?: string
28
+ verifiedState?: CredentialStateType
29
+ tenantId?: string
30
+ createdAt: Date
31
+ presentedAt?: Date
32
+ lastUpdatedAt: Date
33
+ validUntil?: Date
34
+ validFrom?: Date
35
+ verifiedAt?: Date
36
+ revokedAt?: Date
37
+ }
38
+
39
+ export type NonPersistedDigitalCredential = Omit<DigitalCredential, 'id' | 'regulationType'> & { regulationType?: RegulationType }
@@ -0,0 +1,22 @@
1
+ import { PartialActivityLoggingEvent, PartialAuditLoggingEvent } from '@sphereon/ssi-sdk.core'
2
+ import { NonPersistedActivityLoggingEvent, NonPersistedAuditLoggingEvent } from './eventLogger'
3
+
4
+ export type FindAuditLoggingEventArgs = Array<PartialAuditLoggingEvent>
5
+
6
+ export type FindActivityLoggingEventArgs = Array<PartialActivityLoggingEvent>
7
+
8
+ export type StoreAuditEventArgs = {
9
+ event: NonPersistedAuditLoggingEvent
10
+ }
11
+
12
+ export type StoreActivityEventArgs = {
13
+ event: NonPersistedActivityLoggingEvent
14
+ }
15
+
16
+ export type GetAuditEventsArgs = {
17
+ filter?: FindAuditLoggingEventArgs
18
+ }
19
+
20
+ export type GetActivityEventsArgs = {
21
+ filter?: FindActivityLoggingEventArgs
22
+ }
@@ -0,0 +1,4 @@
1
+ import { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
2
+
3
+ export type NonPersistedAuditLoggingEvent = Omit<AuditLoggingEvent, 'id' | 'type'>
4
+ export type NonPersistedActivityLoggingEvent = Omit<ActivityLoggingEvent, 'id' | 'type'>
@@ -1,2 +1,14 @@
1
+ export * from './issuanceBranding/issuanceBranding'
2
+ export * from './issuanceBranding/IAbstractIssuanceBrandingStore'
3
+ export * from './contact/contact'
4
+ export * from './contact/IAbstractContactStore'
5
+ export * from './presentationDefinition/presentationDefinition'
6
+ export * from './presentationDefinition/IAbstractPDStore'
7
+ export * from './validation/validation'
1
8
  export * from './statusList/statusList'
2
9
  export * from './statusList/IAbstractStatusListStore'
10
+ export * from './eventLogger/IAbstractEventLoggerStore'
11
+ export * from './eventLogger/eventLogger'
12
+ export * from './machineState/IAbstractMachineStateStore'
13
+ export * from './digitalCredential'
14
+ export * from './digitalCredential/IAbstractDigitalCredentialStore'
@@ -0,0 +1,85 @@
1
+ import {
2
+ IBasicCredentialLocaleBranding,
3
+ IBasicIssuerLocaleBranding,
4
+ ICredentialBranding,
5
+ ICredentialLocaleBrandingFilter,
6
+ IIssuerBranding,
7
+ IIssuerBrandingFilter,
8
+ IIssuerLocaleBrandingFilter,
9
+ ILocaleBranding,
10
+ ICredentialBrandingFilter,
11
+ } from './issuanceBranding'
12
+
13
+ export type FindCredentialBrandingArgs = Array<ICredentialBrandingFilter>
14
+ export type FindCredentialLocaleBrandingArgs = Array<ICredentialLocaleBrandingFilter>
15
+ export type FindIssuerBrandingArgs = Array<IIssuerBrandingFilter>
16
+ export type FindIssuerLocaleBrandingArgs = Array<IIssuerLocaleBrandingFilter>
17
+
18
+ export interface IAddCredentialBrandingArgs {
19
+ vcHash: string
20
+ issuerCorrelationId: string
21
+ localeBranding: Array<IBasicCredentialLocaleBranding>
22
+ }
23
+
24
+ export interface IGetCredentialBrandingArgs {
25
+ filter?: FindCredentialBrandingArgs
26
+ }
27
+
28
+ export interface IUpdateCredentialBrandingArgs {
29
+ credentialBranding: Omit<ICredentialBranding, 'localeBranding' | 'createdAt' | 'lastUpdatedAt'>
30
+ }
31
+
32
+ export interface IRemoveCredentialBrandingArgs {
33
+ filter: FindCredentialBrandingArgs
34
+ }
35
+
36
+ export interface IAddCredentialLocaleBrandingArgs {
37
+ credentialBrandingId: string
38
+ localeBranding: Array<IBasicCredentialLocaleBranding>
39
+ }
40
+
41
+ export interface IUpdateCredentialLocaleBrandingArgs {
42
+ localeBranding: Omit<ILocaleBranding, 'createdAt' | 'lastUpdatedAt'>
43
+ }
44
+
45
+ export interface IRemoveCredentialLocaleBrandingArgs {
46
+ filter: FindCredentialLocaleBrandingArgs
47
+ }
48
+
49
+ export interface IGetCredentialLocaleBrandingArgs {
50
+ filter?: FindCredentialLocaleBrandingArgs
51
+ }
52
+
53
+ export interface IAddIssuerBrandingArgs {
54
+ issuerCorrelationId: string
55
+ localeBranding: Array<IBasicIssuerLocaleBranding>
56
+ }
57
+
58
+ export interface IGetIssuerBrandingArgs {
59
+ filter?: FindIssuerBrandingArgs
60
+ }
61
+
62
+ export interface IUpdateIssuerBrandingArgs {
63
+ issuerBranding: Omit<IIssuerBranding, 'localeBranding' | 'createdAt' | 'lastUpdatedAt'>
64
+ }
65
+
66
+ export interface IRemoveIssuerBrandingArgs {
67
+ filter: FindIssuerBrandingArgs
68
+ }
69
+
70
+ export interface IAddIssuerLocaleBrandingArgs {
71
+ issuerBrandingId: string
72
+ localeBranding: Array<IBasicIssuerLocaleBranding>
73
+ }
74
+
75
+ export interface IUpdateIssuerLocaleBrandingArgs {
76
+ localeBranding: Omit<ILocaleBranding, 'createdAt' | 'lastUpdatedAt'>
77
+ }
78
+
79
+ export interface IRemoveIssuerLocaleBrandingArgs {
80
+ filter: FindIssuerLocaleBrandingArgs
81
+ }
82
+
83
+ export interface IGetIssuerLocaleBrandingArgs {
84
+ filter?: FindIssuerLocaleBrandingArgs
85
+ }
@@ -0,0 +1,138 @@
1
+ export interface ILocaleBranding {
2
+ id: string
3
+ alias?: string
4
+ locale?: string
5
+ logo?: IImageAttributes
6
+ description?: string
7
+ background?: IBackgroundAttributes
8
+ text?: ITextAttributes
9
+ createdAt: Date
10
+ lastUpdatedAt: Date
11
+ }
12
+
13
+ export interface IImageAttributes {
14
+ id: string
15
+ uri?: string
16
+ dataUri?: string
17
+ mediaType?: string
18
+ alt?: string
19
+ dimensions?: IImageDimensions
20
+ }
21
+ export interface IBasicImageAttributes extends Omit<IImageAttributes, 'id' | 'dimensions'> {
22
+ dimensions?: IBasicImageDimensions
23
+ }
24
+ export interface IPartialImageAttributes extends Partial<Omit<IImageAttributes, 'dimensions'>> {
25
+ dimensions?: IPartialImageDimensions
26
+ }
27
+
28
+ export interface IBackgroundAttributes {
29
+ id: string
30
+ color?: string
31
+ image?: IImageAttributes
32
+ }
33
+ export interface IBasicBackgroundAttributes extends Omit<IBackgroundAttributes, 'id' | 'image'> {
34
+ image?: IBasicImageAttributes
35
+ }
36
+ export interface IPartialBackgroundAttributes extends Partial<Omit<IBackgroundAttributes, 'image'>> {
37
+ image?: IPartialImageAttributes
38
+ }
39
+
40
+ export interface ITextAttributes {
41
+ id: string
42
+ color?: string
43
+ }
44
+ export interface IBasicTextAttributes extends Omit<ITextAttributes, 'id'> {}
45
+ export interface IPartialTextAttributes extends Partial<ITextAttributes> {}
46
+
47
+ export interface IImageDimensions {
48
+ id: string
49
+ width: number
50
+ height: number
51
+ }
52
+ export interface IBasicImageDimensions extends Omit<IImageDimensions, 'id'> {}
53
+ export interface IPartialImageDimensions extends Partial<IImageDimensions> {}
54
+
55
+ export interface ICredentialClaim {
56
+ id: string
57
+ key: string
58
+ name: string
59
+ }
60
+ export interface IBasicCredentialClaim extends Omit<ICredentialClaim, 'id'> {}
61
+ export interface IPartialCredentialClaim extends Partial<ICredentialClaim> {}
62
+
63
+ export interface ICredentialLocaleBranding extends ILocaleBranding {
64
+ claims?: Array<ICredentialClaim>
65
+ }
66
+ export interface IBasicCredentialLocaleBranding
67
+ extends Omit<ICredentialLocaleBranding, 'id' | 'createdAt' | 'lastUpdatedAt' | 'logo' | 'background' | 'text' | 'claims'> {
68
+ logo?: IBasicImageAttributes
69
+ background?: IBasicBackgroundAttributes
70
+ text?: IBasicTextAttributes
71
+ claims?: Array<IBasicCredentialClaim>
72
+ }
73
+ export interface IPartialCredentialLocaleBranding extends Partial<Omit<ICredentialLocaleBranding, 'logo' | 'background' | 'text' | 'claims'>> {
74
+ logo?: IPartialImageAttributes
75
+ background?: IPartialBackgroundAttributes
76
+ text?: IPartialTextAttributes
77
+ claims?: IPartialCredentialClaim
78
+ }
79
+
80
+ export interface ICredentialBranding {
81
+ id: string
82
+ issuerCorrelationId: string
83
+ vcHash: string
84
+ localeBranding: Array<ICredentialLocaleBranding>
85
+ createdAt: Date
86
+ lastUpdatedAt: Date
87
+ }
88
+ export interface IBasicCredentialBranding extends Omit<ICredentialBranding, 'id' | 'createdAt' | 'lastUpdatedAt' | 'localeBranding'> {
89
+ localeBranding: Array<IBasicCredentialLocaleBranding>
90
+ }
91
+ export interface IPartialCredentialBranding extends Partial<Omit<ICredentialBranding, 'localeBranding'>> {
92
+ localeBranding?: IPartialCredentialLocaleBranding
93
+ }
94
+
95
+ export interface IIssuerLocaleBranding extends ILocaleBranding {
96
+ clientUri?: string
97
+ tosUri?: string
98
+ policyUri?: string
99
+ contacts?: Array<string>
100
+ }
101
+ export interface IBasicIssuerLocaleBranding
102
+ extends Omit<IIssuerLocaleBranding, 'id' | 'createdAt' | 'lastUpdatedAt' | 'logo' | 'background' | 'text'> {
103
+ logo?: IBasicImageAttributes
104
+ background?: IBasicBackgroundAttributes
105
+ text?: IBasicTextAttributes
106
+ }
107
+ export interface IPartialIssuerLocaleBranding extends Partial<Omit<IIssuerLocaleBranding, 'logo' | 'background' | 'text' | 'contacts'>> {
108
+ logo?: IPartialImageAttributes
109
+ background?: IPartialBackgroundAttributes
110
+ text?: IPartialTextAttributes
111
+ contacts?: string
112
+ }
113
+
114
+ export interface IIssuerBranding {
115
+ id: string
116
+ issuerCorrelationId: string
117
+ localeBranding: Array<IIssuerLocaleBranding>
118
+ createdAt: Date
119
+ lastUpdatedAt: Date
120
+ }
121
+ export interface IBasicIssuerBranding extends Omit<IIssuerBranding, 'id' | 'createdAt' | 'lastUpdatedAt' | 'localeBranding'> {
122
+ localeBranding: Array<IBasicIssuerLocaleBranding>
123
+ }
124
+ export interface IPartialIssuerBranding extends Partial<Omit<IIssuerBranding, 'localeBranding'>> {
125
+ localeBranding?: IPartialIssuerLocaleBranding
126
+ }
127
+
128
+ export interface ICredentialBrandingFilter extends IPartialCredentialBranding {}
129
+
130
+ export interface ICredentialLocaleBrandingFilter extends IPartialCredentialLocaleBranding {
131
+ credentialBranding?: IPartialCredentialBranding
132
+ }
133
+
134
+ export interface IIssuerBrandingFilter extends IPartialIssuerBranding {}
135
+
136
+ export interface IIssuerLocaleBrandingFilter extends IPartialIssuerLocaleBranding {
137
+ issuerBranding?: IPartialIssuerBranding
138
+ }
@@ -0,0 +1,68 @@
1
+ export type StoreMachineStatePersistArgs = Omit<StoreMachineStateInfo, 'createdAt' | 'updatedAt'>
2
+
3
+ export type StoreMachineStatesFindActiveArgs = Partial<Pick<StoreMachineStateInfo, 'machineName' | 'tenantId' | 'instanceId'>>
4
+
5
+ export type FindMachineStatesFilterArgs = Array<Partial<Omit<StoreMachineStateInfo, 'state'>>>
6
+
7
+ export type StoreFindMachineStatesArgs = {
8
+ filter: FindMachineStatesFilterArgs
9
+ }
10
+
11
+ export type StoreMachineStateGetArgs = Pick<StoreMachineStateInfo, 'instanceId' | 'tenantId'>
12
+
13
+ export type StoreMachineStateDeleteArgs = StoreMachineStateGetArgs
14
+ export type StoreMachineStateDeleteExpiredArgs = { machineName?: string; tenantId?: string; deleteDoneStates?: boolean }
15
+
16
+ export interface StoreMachineStateInfo {
17
+ /**
18
+ * Unique instance ID of the machine
19
+ */
20
+ instanceId: string
21
+
22
+ /**
23
+ * Session Id of the machine. Not necessarily unique
24
+ */
25
+ sessionId?: string
26
+
27
+ /**
28
+ * Machine name
29
+ */
30
+ machineName: string
31
+
32
+ /**
33
+ * The latest state name. Can be empty for a newly initialize machine
34
+ */
35
+ latestStateName?: string
36
+
37
+ /**
38
+ * event types like SET_TOC, SET_FIRSTNAME, .... Will be xstate.init on a newly initialized machine
39
+ */
40
+ latestEventType: string
41
+
42
+ /**
43
+ * Serialized Machine state
44
+ */
45
+ state: string
46
+
47
+ /**
48
+ * Represents the creation date
49
+ */
50
+ createdAt: Date
51
+
52
+ /**
53
+ * Represents the expiration date
54
+ */
55
+ expiresAt?: Date
56
+
57
+ /**
58
+ * Represents the update date
59
+ */
60
+ updatedAt: Date
61
+
62
+ /**
63
+ * Represents a counter for tracking updates.
64
+ */
65
+ updatedCount: number
66
+ completedAt?: Date
67
+ tenantId?: string
68
+ }
@@ -0,0 +1,25 @@
1
+ import { NonPersistedPresentationDefinitionItem, PresentationDefinitionItem, PresentationDefinitionItemFilter } from './presentationDefinition'
2
+
3
+ export type FindDefinitionArgs = Array<PresentationDefinitionItemFilter>
4
+
5
+ export type GetDefinitionArgs = {
6
+ itemId: string
7
+ }
8
+
9
+ export type HasDefinitionArgs = GetDefinitionArgs
10
+
11
+ export type GetDefinitionsArgs = {
12
+ filter?: FindDefinitionArgs
13
+ }
14
+
15
+ export type HasDefinitionsArgs = GetDefinitionsArgs
16
+
17
+ export type AddDefinitionArgs = NonPersistedPresentationDefinitionItem
18
+
19
+ export type UpdateDefinitionArgs = PresentationDefinitionItem
20
+
21
+ export type DeleteDefinitionArgs = {
22
+ itemId: string
23
+ }
24
+
25
+ export type DeleteDefinitionsArgs = GetDefinitionsArgs
@@ -0,0 +1,19 @@
1
+ import { IPresentationDefinition } from '@sphereon/pex'
2
+ import { DcqlQueryREST } from '@sphereon/ssi-types'
3
+
4
+ export type PresentationDefinitionItem = {
5
+ id: string
6
+ definitionId: string
7
+ tenantId?: string
8
+ version: string
9
+ name?: string
10
+ purpose?: string
11
+ definitionPayload: IPresentationDefinition
12
+ dcqlPayload?: DcqlQueryREST
13
+ createdAt: Date
14
+ lastUpdatedAt: Date
15
+ }
16
+
17
+ export type NonPersistedPresentationDefinitionItem = Omit<PresentationDefinitionItem, 'id' | 'createdAt' | 'lastUpdatedAt'>
18
+ export type PartialPresentationDefinitionItem = Partial<PresentationDefinitionItem>
19
+ export type PresentationDefinitionItemFilter = Partial<Omit<PresentationDefinitionItem, 'definitionPayload' | 'dcqlPayload'>>
@@ -1,3 +1,11 @@
1
+ import { FindOptionsWhere } from 'typeorm'
2
+ import {
3
+ BitstringStatusPurpose,
4
+ IBitstringStatusListEntryEntity,
5
+ IOAuthStatusListEntity,
6
+ IStatusList2021Entity,
7
+ IStatusListEntryEntity,
8
+ } from './statusList'
1
9
  import {
2
10
  CredentialProofFormat,
3
11
  IIssuer,
@@ -8,16 +16,8 @@ import {
8
16
  StatusListType,
9
17
  StatusPurpose2021,
10
18
  } from '@sphereon/ssi-types'
11
- import { FindOptionsWhere } from 'typeorm'
12
- import {
13
- BitstringStatusPurpose,
14
- IBitstringStatusListEntryEntity,
15
- IOAuthStatusListEntity,
16
- IStatusList2021Entity,
17
- IStatusListEntryEntity,
18
- } from './statusList'
19
19
 
20
- export type FindStatusListArgs = FindOptionsWhere<IStatusList2021Entity | IOAuthStatusListEntity>[] // TODO export our own FindOptionsWhere
20
+ export type FindStatusListArgs = FindOptionsWhere<IStatusList2021Entity | IOAuthStatusListEntity>[]
21
21
  export type FindStatusListEntryArgs = FindOptionsWhere<IStatusListEntryEntity>[] | FindOptionsWhere<IStatusListEntryEntity>
22
22
 
23
23
  export interface IStatusListEntryAvailableArgs {
@@ -0,0 +1,3 @@
1
+ export type ValidationConstraint = {
2
+ [x: string]: string
3
+ }
@@ -1,5 +1,5 @@
1
- import { type ValidationConstraint } from '@sphereon/ssi-sdk.data-store-types'
2
1
  import { ValidationError } from 'class-validator'
2
+ import { type ValidationConstraint } from '../types'
3
3
 
4
4
  export const getConstraint = (validation: ValidationError): ValidationConstraint | undefined => {
5
5
  if (validation.children && validation.children.length > 0) {
@@ -1,4 +1,5 @@
1
1
  import type {
2
+ MetadataTypes,
2
3
  Connection,
3
4
  ConnectionConfig,
4
5
  Contact,
@@ -7,7 +8,6 @@ import type {
7
8
  ElectronicAddress,
8
9
  Identity,
9
10
  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 '@sphereon/ssi-sdk.data-store-types'
34
- import { BaseConfigEntity } from '../../entities/contact/BaseConfigEntity'
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'
35
38
  import { BaseContactEntity } from '../../entities/contact/BaseContactEntity'
39
+ import { NaturalPersonEntity } from '../../entities/contact/NaturalPersonEntity'
40
+ import { OrganizationEntity } from '../../entities/contact/OrganizationEntity'
36
41
  import { ConnectionEntity } from '../../entities/contact/ConnectionEntity'
37
- import { ContactMetadataItemEntity } from '../../entities/contact/ContactMetadataItemEntity'
42
+ import { BaseConfigEntity } from '../../entities/contact/BaseConfigEntity'
38
43
  import { CorrelationIdentifierEntity } from '../../entities/contact/CorrelationIdentifierEntity'
39
44
  import { DidAuthConfigEntity } from '../../entities/contact/DidAuthConfigEntity'
40
- import { ElectronicAddressEntity } from '../../entities/contact/ElectronicAddressEntity'
41
- import { IdentityEntity } from '../../entities/contact/IdentityEntity'
42
45
  import { IdentityMetadataItemEntity } from '../../entities/contact/IdentityMetadataItemEntity'
43
- import { NaturalPersonEntity } from '../../entities/contact/NaturalPersonEntity'
44
46
  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'
48
47
  import { PartyTypeEntity } from '../../entities/contact/PartyTypeEntity'
49
48
  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,6 +1,3 @@
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'
4
1
  import {
5
2
  CredentialMapper,
6
3
  DocumentFormat,
@@ -13,7 +10,10 @@ import {
13
10
  } from '@sphereon/ssi-types'
14
11
  import { computeEntryHash } from '@veramo/utils'
15
12
  import { DigitalCredentialEntity } from '../../entities/digitalCredential/DigitalCredentialEntity'
13
+ import type { AddCredentialArgs, DigitalCredential, NonPersistedDigitalCredential } from '../../types'
14
+ import { CredentialDocumentFormat, DocumentType, RegulationType } from '../../types'
16
15
  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,6 +51,24 @@ 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
+
54
72
  function determineCredentialDocumentFormat(documentFormat: DocumentFormat): CredentialDocumentFormat {
55
73
  switch (documentFormat) {
56
74
  case DocumentFormat.JSONLD: