@sphereon/ssi-sdk.data-store 0.30.1-unstable.4 → 0.30.1

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 (136) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +77 -77
  3. package/dist/contact/ContactStore.d.ts.map +1 -1
  4. package/dist/digitalCredential/DigitalCredentialStore.d.ts.map +1 -1
  5. package/dist/eventLogger/EventLoggerStore.d.ts.map +1 -1
  6. package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -1
  7. package/dist/migrations/internal-migrations-ormconfig.d.ts.map +1 -1
  8. package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js +33 -33
  9. package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.js +16 -16
  10. package/dist/migrations/postgres/1715761125001-CreateContacts.js +33 -33
  11. package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.js +12 -12
  12. package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js +32 -32
  13. package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.js +15 -15
  14. package/dist/migrations/sqlite/1710438363002-CreateContacts.js +13 -13
  15. package/dist/migrations/sqlite/1715761125002-CreateContacts.js +32 -32
  16. package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.js +9 -9
  17. package/dist/presentationDefinition/PDStore.d.ts.map +1 -1
  18. package/dist/utils/SortingUtils.d.ts.map +1 -1
  19. package/dist/utils/contact/MappingUtils.d.ts.map +1 -1
  20. package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -1
  21. package/dist/utils/digitalCredential/MappingUtils.js +4 -4
  22. package/dist/utils/digitalCredential/MappingUtils.js.map +1 -1
  23. package/dist/utils/presentationDefinition/MappingUtils.js +2 -2
  24. package/dist/utils/presentationDefinition/MappingUtils.js.map +1 -1
  25. package/package.json +8 -8
  26. package/src/__tests__/contact.entities.test.ts +2642 -2642
  27. package/src/__tests__/contact.store.test.ts +2649 -2649
  28. package/src/__tests__/digitalCredential.entities.test.ts +274 -274
  29. package/src/__tests__/digitalCredential.store.test.ts +330 -330
  30. package/src/__tests__/eventLogger.entities.test.ts +76 -76
  31. package/src/__tests__/eventLogger.store.test.ts +130 -130
  32. package/src/__tests__/issuanceBranding.entities.test.ts +846 -846
  33. package/src/__tests__/issuanceBranding.store.test.ts +1886 -1886
  34. package/src/__tests__/machineState.entities.test.ts +53 -53
  35. package/src/__tests__/machineState.store.test.ts +176 -176
  36. package/src/__tests__/pd-manager.entities.test.ts +73 -73
  37. package/src/__tests__/pd-manager.store.test.ts +193 -193
  38. package/src/contact/AbstractContactStore.ts +71 -71
  39. package/src/contact/ContactStore.ts +768 -768
  40. package/src/digitalCredential/AbstractDigitalCredentialStore.ts +21 -21
  41. package/src/digitalCredential/DigitalCredentialStore.ts +189 -189
  42. package/src/entities/contact/BaseContactEntity.ts +51 -51
  43. package/src/entities/contact/ConnectionEntity.ts +35 -35
  44. package/src/entities/contact/ContactMetadataItemEntity.ts +51 -51
  45. package/src/entities/contact/CorrelationIdentifierEntity.ts +43 -43
  46. package/src/entities/contact/DidAuthConfigEntity.ts +20 -20
  47. package/src/entities/contact/ElectronicAddressEntity.ts +70 -70
  48. package/src/entities/contact/IdentityEntity.ts +107 -107
  49. package/src/entities/contact/IdentityMetadataItemEntity.ts +48 -48
  50. package/src/entities/contact/NaturalPersonEntity.ts +44 -44
  51. package/src/entities/contact/OpenIdConfigEntity.ts +32 -32
  52. package/src/entities/contact/OrganizationEntity.ts +35 -35
  53. package/src/entities/contact/PartyEntity.ts +117 -117
  54. package/src/entities/contact/PartyRelationshipEntity.ts +68 -68
  55. package/src/entities/contact/PartyTypeEntity.ts +63 -63
  56. package/src/entities/contact/PhysicalAddressEntity.ts +95 -95
  57. package/src/entities/digitalCredential/DigitalCredentialEntity.ts +98 -98
  58. package/src/entities/eventLogger/AuditEventEntity.ts +92 -92
  59. package/src/entities/issuanceBranding/BackgroundAttributesEntity.ts +42 -42
  60. package/src/entities/issuanceBranding/BaseLocaleBrandingEntity.ts +87 -87
  61. package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +79 -79
  62. package/src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts +33 -33
  63. package/src/entities/issuanceBranding/ImageAttributesEntity.ts +57 -57
  64. package/src/entities/issuanceBranding/ImageDimensionsEntity.ts +22 -22
  65. package/src/entities/issuanceBranding/IssuerBrandingEntity.ts +73 -73
  66. package/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts +33 -33
  67. package/src/entities/issuanceBranding/TextAttributesEntity.ts +31 -31
  68. package/src/entities/machineState/MachineStateInfoEntity.ts +59 -59
  69. package/src/entities/presentationDefinition/PresentationDefinitionItemEntity.ts +44 -44
  70. package/src/entities/statusList2021/StatusList2021Entity.ts +96 -96
  71. package/src/entities/statusList2021/StatusList2021EntryEntity.ts +29 -29
  72. package/src/eventLogger/AbstractEventLoggerStore.ts +7 -7
  73. package/src/eventLogger/EventLoggerStore.ts +62 -62
  74. package/src/index.ts +160 -160
  75. package/src/issuanceBranding/IssuanceBrandingStore.ts +559 -559
  76. package/src/machineState/IAbstractMachineStateStore.ts +65 -65
  77. package/src/machineState/MachineStateStore.ts +149 -149
  78. package/src/migrations/generic/1-CreateContacts.ts +66 -66
  79. package/src/migrations/generic/10-CreatePresentationDefinitions.ts +66 -66
  80. package/src/migrations/generic/2-CreateIssuanceBranding.ts +64 -64
  81. package/src/migrations/generic/3-CreateContacts.ts +66 -66
  82. package/src/migrations/generic/4-CreateStatusList.ts +54 -54
  83. package/src/migrations/generic/5-CreateAuditEvents.ts +66 -66
  84. package/src/migrations/generic/6-CreateDigitalCredential.ts +66 -66
  85. package/src/migrations/generic/7-CreateMachineStateStore.ts +66 -66
  86. package/src/migrations/generic/8-CreateContacts.ts +66 -66
  87. package/src/migrations/generic/9-CreateContacts.ts +66 -66
  88. package/src/migrations/generic/index.ts +43 -43
  89. package/src/migrations/index.ts +10 -10
  90. package/src/migrations/postgres/1659463079428-CreateContacts.ts +63 -63
  91. package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +85 -85
  92. package/src/migrations/postgres/1690925872592-CreateContacts.ts +158 -158
  93. package/src/migrations/postgres/1693866470001-CreateStatusList.ts +24 -24
  94. package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +33 -33
  95. package/src/migrations/postgres/1708525189001-CreateDigitalCredential.ts +61 -61
  96. package/src/migrations/postgres/1708797018115-CreateMachineStateStore.ts +29 -29
  97. package/src/migrations/postgres/1710438363001-CreateContacts.ts +63 -63
  98. package/src/migrations/postgres/1715761125001-CreateContacts.ts +60 -60
  99. package/src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts +25 -25
  100. package/src/migrations/sqlite/1659463069549-CreateContacts.ts +110 -110
  101. package/src/migrations/sqlite/1685628973231-CreateIssuanceBranding.ts +119 -119
  102. package/src/migrations/sqlite/1690925872693-CreateContacts.ts +228 -228
  103. package/src/migrations/sqlite/1693866470000-CreateStatusList.ts +24 -24
  104. package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +15 -15
  105. package/src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts +46 -46
  106. package/src/migrations/sqlite/1708796002272-CreateMachineStateStore.ts +28 -28
  107. package/src/migrations/sqlite/1710438363002-CreateContacts.ts +83 -83
  108. package/src/migrations/sqlite/1715761125002-CreateContacts.ts +59 -59
  109. package/src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts +24 -24
  110. package/src/presentationDefinition/AbstractPDStore.ts +20 -20
  111. package/src/presentationDefinition/PDStore.ts +185 -185
  112. package/src/statusList/IStatusListStore.ts +44 -44
  113. package/src/statusList/StatusListStore.ts +236 -236
  114. package/src/types/contact/IAbstractContactStore.ts +161 -161
  115. package/src/types/contact/contact.ts +295 -295
  116. package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +42 -42
  117. package/src/types/digitalCredential/digitalCredential.ts +102 -102
  118. package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -12
  119. package/src/types/eventLogger/eventLogger.ts +3 -3
  120. package/src/types/index.ts +14 -14
  121. package/src/types/machineState/IAbstractMachineStateStore.ts +68 -68
  122. package/src/types/presentationDefinition/IAbstractPDStore.ts +25 -25
  123. package/src/types/presentationDefinition/presentationDefinition.ts +17 -17
  124. package/src/utils/SortingUtils.ts +16 -16
  125. package/src/utils/contact/MappingUtils.ts +506 -506
  126. package/src/utils/digitalCredential/MappingUtils.ts +160 -160
  127. package/src/utils/hasher.ts +19 -19
  128. package/src/utils/presentationDefinition/MappingUtils.ts +52 -52
  129. package/dist/entities/contact/IMetadataEntity.d.ts +0 -8
  130. package/dist/entities/contact/IMetadataEntity.d.ts.map +0 -1
  131. package/dist/entities/contact/IMetadataEntity.js +0 -2
  132. package/dist/entities/contact/IMetadataEntity.js.map +0 -1
  133. package/dist/migrations/generic/8-CreatePresentationDefinitions.d.ts +0 -7
  134. package/dist/migrations/generic/8-CreatePresentationDefinitions.d.ts.map +0 -1
  135. package/dist/migrations/generic/8-CreatePresentationDefinitions.js +0 -78
  136. package/dist/migrations/generic/8-CreatePresentationDefinitions.js.map +0 -1
@@ -1,295 +1,295 @@
1
- import { ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution'
2
- import { IIdentifier } from '@veramo/core'
3
- import { ILocaleBranding } from '../issuanceBranding/issuanceBranding'
4
- import { CredentialRole } from '../digitalCredential/digitalCredential'
5
-
6
- export type MetadataTypes = string | number | Date | boolean | undefined
7
-
8
- export interface IMetadataEntity {
9
- // TODO move to types
10
- label: string
11
- stringValue?: string
12
- numberValue?: number
13
- dateValue?: Date
14
- boolValue?: boolean
15
- }
16
-
17
- export type Party = {
18
- id: string
19
- uri?: string
20
- roles: Array<CredentialRole>
21
- ownerId?: string
22
- tenantId?: string
23
- identities: Array<Identity>
24
- electronicAddresses: Array<ElectronicAddress>
25
- physicalAddresses: Array<PhysicalAddress>
26
- contact: Contact
27
- partyType: PartyType
28
- /**
29
- * TODO: Integrate branding logic here in the future.
30
- *
31
- * Currently, we are only defining the branding type within the SDK without implementing the associated logic. This is because:
32
- * 1. We are combining two types from the SSI-SDK to create a new type that will be used across multiple places in the wallets (web & mobile).
33
- * 2. While it makes sense to have this combined type in the SDK, the logic to support database connections for these types is complex. The types belong to different modules, and we don't use them together currently.
34
- * 3. Implementing the full logic now would require significant changes and cross-module interactions, which we don't have the time to address at present.
35
- *
36
- * For now, we are defining the type here and will use it in the mobile wallet has the logic for it. This is a temporary solution until we have the resources to integrate the branding logic fully.
37
- */
38
- branding?: ILocaleBranding
39
- relationships: Array<PartyRelationship>
40
- createdAt: Date
41
- lastUpdatedAt: Date
42
- }
43
- export type NonPersistedParty = Omit<
44
- Party,
45
- | 'id'
46
- | 'identities'
47
- | 'electronicAddresses'
48
- | 'physicalAddresses'
49
- | 'contact'
50
- | 'roles'
51
- | 'partyType'
52
- | 'relationships'
53
- | 'createdAt'
54
- | 'lastUpdatedAt'
55
- > & {
56
- identities?: Array<NonPersistedIdentity>
57
- electronicAddresses?: Array<NonPersistedElectronicAddress>
58
- physicalAddresses?: Array<NonPersistedPhysicalAddress>
59
- contact: NonPersistedContact
60
- partyType: NonPersistedPartyType
61
- relationships?: Array<NonPersistedPartyRelationship>
62
- }
63
- export type PartialParty = Partial<
64
- Omit<Party, 'identities' | 'electronicAddresses' | 'physicalAddresses' | 'contact' | 'partyType' | 'relationships'>
65
- > & {
66
- identities?: PartialIdentity
67
- electronicAddresses?: PartialElectronicAddress
68
- physicalAddresses?: PartialPhysicalAddress
69
- contact?: PartialContact
70
- partyType?: PartialPartyType
71
- relationships?: PartialPartyRelationship
72
- }
73
-
74
- export type Identity = {
75
- id: string
76
- alias: string
77
- ownerId?: string
78
- tenantId?: string
79
- origin: IdentityOrigin
80
- roles: Array<CredentialRole>
81
- identifier: CorrelationIdentifier
82
- connection?: Connection
83
- metadata?: Array<MetadataItem<MetadataTypes>>
84
- createdAt: Date
85
- lastUpdatedAt: Date
86
- }
87
- export type NonPersistedIdentity = Omit<Identity, 'id' | 'identifier' | 'connection' | 'metadata' | 'origin' | 'createdAt' | 'lastUpdatedAt'> & {
88
- origin: IdentityOrigin
89
- identifier: NonPersistedCorrelationIdentifier
90
- connection?: NonPersistedConnection
91
- metadata?: Array<NonPersistedMetadataItem<MetadataTypes>>
92
- }
93
- export type PartialIdentity = Partial<Omit<Identity, 'identifier' | 'connection' | 'metadata' | 'origin' | 'roles'>> & {
94
- identifier?: PartialCorrelationIdentifier
95
- connection?: PartialConnection
96
- metadata?: PartialMetadataItem<MetadataTypes> // Usage: FindIdentityArgs = Array<PartialIdentity>
97
- origin?: IdentityOrigin
98
- roles?: CredentialRole
99
- partyId?: string
100
- }
101
-
102
- export type MetadataItem<T extends MetadataTypes> = {
103
- id: string
104
- label: string
105
- value: T
106
- }
107
-
108
- export type NonPersistedMetadataItem<T extends MetadataTypes> = Omit<MetadataItem<T>, 'id'>
109
- export type PartialMetadataItem<T extends MetadataTypes> = Partial<MetadataItem<T>>
110
-
111
- export type CorrelationIdentifier = {
112
- id: string
113
- ownerId?: string
114
- tenantId?: string
115
- type: CorrelationIdentifierType
116
- correlationId: string
117
- }
118
- export type NonPersistedCorrelationIdentifier = Omit<CorrelationIdentifier, 'id'>
119
- export type PartialCorrelationIdentifier = Partial<CorrelationIdentifier>
120
-
121
- export type Connection = {
122
- id: string
123
- ownerId?: string
124
- tenantId?: string
125
- type: ConnectionType
126
- config: ConnectionConfig
127
- }
128
- export type NonPersistedConnection = Omit<Connection, 'id' | 'config'> & {
129
- config: NonPersistedConnectionConfig
130
- }
131
- export type PartialConnection = Partial<Omit<Connection, 'config'>> & {
132
- config: PartialConnectionConfig
133
- }
134
-
135
- export type OpenIdConfig = {
136
- id: string
137
- clientId: string
138
- clientSecret: string
139
- ownerId?: string
140
- tenantId?: string
141
- scopes: Array<string>
142
- issuer: string
143
- redirectUrl: string
144
- dangerouslyAllowInsecureHttpRequests: boolean
145
- clientAuthMethod: 'basic' | 'post' | undefined
146
- }
147
- export type NonPersistedOpenIdConfig = Omit<OpenIdConfig, 'id'>
148
- export type PartialOpenIdConfig = Partial<OpenIdConfig>
149
-
150
- export type DidAuthConfig = {
151
- id: string
152
- idOpts: ManagedIdentifierOptsOrResult
153
- stateId: string
154
- ownerId?: string
155
- tenantId?: string
156
- redirectUrl: string
157
- sessionId: string
158
- }
159
- export type NonPersistedDidAuthConfig = Omit<DidAuthConfig, 'id'>
160
- export type PartialDidAuthConfig = Partial<Omit<DidAuthConfig, 'identifier'>> & {
161
- identifier: Partial<IIdentifier> // TODO, we need to create partials for sub types in IIdentifier
162
- }
163
-
164
- export type ConnectionConfig = OpenIdConfig | DidAuthConfig
165
- export type NonPersistedConnectionConfig = NonPersistedDidAuthConfig | NonPersistedOpenIdConfig
166
- export type PartialConnectionConfig = PartialOpenIdConfig | PartialDidAuthConfig
167
-
168
- export type NaturalPerson = {
169
- id: string
170
- firstName: string
171
- lastName: string
172
- middleName?: string
173
- displayName: string
174
- metadata?: Array<MetadataItem<MetadataTypes>>
175
- ownerId?: string
176
- tenantId?: string
177
- createdAt: Date
178
- lastUpdatedAt: Date
179
- }
180
-
181
- export type NonPersistedNaturalPerson = Omit<NaturalPerson, 'id' | 'createdAt' | 'lastUpdatedAt'>
182
-
183
- export type PartialNaturalPerson = Partial<Omit<NaturalPerson, 'metadata'>> & {
184
- metadata?: PartialMetadataItem<MetadataTypes>
185
- }
186
-
187
- export type Organization = {
188
- id: string
189
- legalName: string
190
- displayName: string
191
- metadata?: Array<MetadataItem<MetadataTypes>>
192
- ownerId?: string
193
- tenantId?: string
194
- createdAt: Date
195
- lastUpdatedAt: Date
196
- }
197
- export type NonPersistedOrganization = Omit<Organization, 'id' | 'createdAt' | 'lastUpdatedAt'>
198
- export type PartialOrganization = Partial<Omit<Organization, 'metadata'>> & {
199
- metadata?: PartialMetadataItem<MetadataTypes>
200
- }
201
-
202
- export type Contact = NaturalPerson | Organization
203
- export type NonPersistedContact = NonPersistedNaturalPerson | NonPersistedOrganization
204
- export type PartialContact = PartialNaturalPerson | PartialOrganization
205
-
206
- export type PartyType = {
207
- id: string
208
- type: PartyTypeType
209
- origin: PartyOrigin
210
- name: string
211
- tenantId: string
212
- description?: string
213
- createdAt: Date
214
- lastUpdatedAt: Date
215
- }
216
- export type NonPersistedPartyType = Omit<PartyType, 'id' | 'createdAt' | 'lastUpdatedAt'> & {
217
- id?: string
218
- }
219
- export type PartialPartyType = Partial<PartyType>
220
-
221
- export type PartyRelationship = {
222
- id: string
223
- leftId: string
224
- rightId: string
225
- ownerId?: string
226
- tenantId?: string
227
- createdAt: Date
228
- lastUpdatedAt: Date
229
- }
230
- export type NonPersistedPartyRelationship = Omit<PartyRelationship, 'id' | 'createdAt' | 'lastUpdatedAt'>
231
- export type PartialPartyRelationship = Partial<PartyRelationship>
232
-
233
- export type ElectronicAddress = {
234
- id: string
235
- type: ElectronicAddressType
236
- electronicAddress: string
237
- ownerId?: string
238
- tenantId?: string
239
- createdAt: Date
240
- lastUpdatedAt: Date
241
- }
242
- export type NonPersistedElectronicAddress = Omit<ElectronicAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>
243
- export type PartialElectronicAddress = Partial<ElectronicAddress> & {
244
- partyId?: string
245
- }
246
-
247
- export type PhysicalAddress = {
248
- id: string
249
- type: PhysicalAddressType
250
- streetName: string
251
- streetNumber: string
252
- postalCode: string
253
- cityName: string
254
- provinceName: string
255
- countryCode: string
256
- buildingName?: string
257
- ownerId?: string
258
- tenantId?: string
259
- createdAt: Date
260
- lastUpdatedAt: Date
261
- }
262
- export type NonPersistedPhysicalAddress = Omit<PhysicalAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>
263
- export type PartialPhysicalAddress = Partial<PhysicalAddress> & {
264
- partyId?: string
265
- }
266
-
267
- export type ElectronicAddressType = 'email' | 'phone'
268
-
269
- export type PhysicalAddressType = 'home' | 'visit' | 'postal'
270
-
271
- export enum ConnectionType {
272
- OPENID_CONNECT = 'OIDC',
273
- SIOPv2 = 'SIOPv2',
274
- SIOPv2_OpenID4VP = 'SIOPv2+OpenID4VP',
275
- }
276
-
277
- export enum CorrelationIdentifierType {
278
- DID = 'did',
279
- URL = 'url',
280
- }
281
-
282
- export enum PartyTypeType {
283
- NATURAL_PERSON = 'naturalPerson',
284
- ORGANIZATION = 'organization',
285
- }
286
-
287
- export enum PartyOrigin {
288
- INTERNAL = 'INTERNAL',
289
- EXTERNAL = 'EXTERNAL',
290
- }
291
-
292
- export enum IdentityOrigin {
293
- INTERNAL = 'INTERNAL',
294
- EXTERNAL = 'EXTERNAL',
295
- }
1
+ import { ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution'
2
+ import { IIdentifier } from '@veramo/core'
3
+ import { ILocaleBranding } from '../issuanceBranding/issuanceBranding'
4
+ import { CredentialRole } from '../digitalCredential/digitalCredential'
5
+
6
+ export type MetadataTypes = string | number | Date | boolean | undefined
7
+
8
+ export interface IMetadataEntity {
9
+ // TODO move to types
10
+ label: string
11
+ stringValue?: string
12
+ numberValue?: number
13
+ dateValue?: Date
14
+ boolValue?: boolean
15
+ }
16
+
17
+ export type Party = {
18
+ id: string
19
+ uri?: string
20
+ roles: Array<CredentialRole>
21
+ ownerId?: string
22
+ tenantId?: string
23
+ identities: Array<Identity>
24
+ electronicAddresses: Array<ElectronicAddress>
25
+ physicalAddresses: Array<PhysicalAddress>
26
+ contact: Contact
27
+ partyType: PartyType
28
+ /**
29
+ * TODO: Integrate branding logic here in the future.
30
+ *
31
+ * Currently, we are only defining the branding type within the SDK without implementing the associated logic. This is because:
32
+ * 1. We are combining two types from the SSI-SDK to create a new type that will be used across multiple places in the wallets (web & mobile).
33
+ * 2. While it makes sense to have this combined type in the SDK, the logic to support database connections for these types is complex. The types belong to different modules, and we don't use them together currently.
34
+ * 3. Implementing the full logic now would require significant changes and cross-module interactions, which we don't have the time to address at present.
35
+ *
36
+ * For now, we are defining the type here and will use it in the mobile wallet has the logic for it. This is a temporary solution until we have the resources to integrate the branding logic fully.
37
+ */
38
+ branding?: ILocaleBranding
39
+ relationships: Array<PartyRelationship>
40
+ createdAt: Date
41
+ lastUpdatedAt: Date
42
+ }
43
+ export type NonPersistedParty = Omit<
44
+ Party,
45
+ | 'id'
46
+ | 'identities'
47
+ | 'electronicAddresses'
48
+ | 'physicalAddresses'
49
+ | 'contact'
50
+ | 'roles'
51
+ | 'partyType'
52
+ | 'relationships'
53
+ | 'createdAt'
54
+ | 'lastUpdatedAt'
55
+ > & {
56
+ identities?: Array<NonPersistedIdentity>
57
+ electronicAddresses?: Array<NonPersistedElectronicAddress>
58
+ physicalAddresses?: Array<NonPersistedPhysicalAddress>
59
+ contact: NonPersistedContact
60
+ partyType: NonPersistedPartyType
61
+ relationships?: Array<NonPersistedPartyRelationship>
62
+ }
63
+ export type PartialParty = Partial<
64
+ Omit<Party, 'identities' | 'electronicAddresses' | 'physicalAddresses' | 'contact' | 'partyType' | 'relationships'>
65
+ > & {
66
+ identities?: PartialIdentity
67
+ electronicAddresses?: PartialElectronicAddress
68
+ physicalAddresses?: PartialPhysicalAddress
69
+ contact?: PartialContact
70
+ partyType?: PartialPartyType
71
+ relationships?: PartialPartyRelationship
72
+ }
73
+
74
+ export type Identity = {
75
+ id: string
76
+ alias: string
77
+ ownerId?: string
78
+ tenantId?: string
79
+ origin: IdentityOrigin
80
+ roles: Array<CredentialRole>
81
+ identifier: CorrelationIdentifier
82
+ connection?: Connection
83
+ metadata?: Array<MetadataItem<MetadataTypes>>
84
+ createdAt: Date
85
+ lastUpdatedAt: Date
86
+ }
87
+ export type NonPersistedIdentity = Omit<Identity, 'id' | 'identifier' | 'connection' | 'metadata' | 'origin' | 'createdAt' | 'lastUpdatedAt'> & {
88
+ origin: IdentityOrigin
89
+ identifier: NonPersistedCorrelationIdentifier
90
+ connection?: NonPersistedConnection
91
+ metadata?: Array<NonPersistedMetadataItem<MetadataTypes>>
92
+ }
93
+ export type PartialIdentity = Partial<Omit<Identity, 'identifier' | 'connection' | 'metadata' | 'origin' | 'roles'>> & {
94
+ identifier?: PartialCorrelationIdentifier
95
+ connection?: PartialConnection
96
+ metadata?: PartialMetadataItem<MetadataTypes> // Usage: FindIdentityArgs = Array<PartialIdentity>
97
+ origin?: IdentityOrigin
98
+ roles?: CredentialRole
99
+ partyId?: string
100
+ }
101
+
102
+ export type MetadataItem<T extends MetadataTypes> = {
103
+ id: string
104
+ label: string
105
+ value: T
106
+ }
107
+
108
+ export type NonPersistedMetadataItem<T extends MetadataTypes> = Omit<MetadataItem<T>, 'id'>
109
+ export type PartialMetadataItem<T extends MetadataTypes> = Partial<MetadataItem<T>>
110
+
111
+ export type CorrelationIdentifier = {
112
+ id: string
113
+ ownerId?: string
114
+ tenantId?: string
115
+ type: CorrelationIdentifierType
116
+ correlationId: string
117
+ }
118
+ export type NonPersistedCorrelationIdentifier = Omit<CorrelationIdentifier, 'id'>
119
+ export type PartialCorrelationIdentifier = Partial<CorrelationIdentifier>
120
+
121
+ export type Connection = {
122
+ id: string
123
+ ownerId?: string
124
+ tenantId?: string
125
+ type: ConnectionType
126
+ config: ConnectionConfig
127
+ }
128
+ export type NonPersistedConnection = Omit<Connection, 'id' | 'config'> & {
129
+ config: NonPersistedConnectionConfig
130
+ }
131
+ export type PartialConnection = Partial<Omit<Connection, 'config'>> & {
132
+ config: PartialConnectionConfig
133
+ }
134
+
135
+ export type OpenIdConfig = {
136
+ id: string
137
+ clientId: string
138
+ clientSecret: string
139
+ ownerId?: string
140
+ tenantId?: string
141
+ scopes: Array<string>
142
+ issuer: string
143
+ redirectUrl: string
144
+ dangerouslyAllowInsecureHttpRequests: boolean
145
+ clientAuthMethod: 'basic' | 'post' | undefined
146
+ }
147
+ export type NonPersistedOpenIdConfig = Omit<OpenIdConfig, 'id'>
148
+ export type PartialOpenIdConfig = Partial<OpenIdConfig>
149
+
150
+ export type DidAuthConfig = {
151
+ id: string
152
+ idOpts: ManagedIdentifierOptsOrResult
153
+ stateId: string
154
+ ownerId?: string
155
+ tenantId?: string
156
+ redirectUrl: string
157
+ sessionId: string
158
+ }
159
+ export type NonPersistedDidAuthConfig = Omit<DidAuthConfig, 'id'>
160
+ export type PartialDidAuthConfig = Partial<Omit<DidAuthConfig, 'identifier'>> & {
161
+ identifier: Partial<IIdentifier> // TODO, we need to create partials for sub types in IIdentifier
162
+ }
163
+
164
+ export type ConnectionConfig = OpenIdConfig | DidAuthConfig
165
+ export type NonPersistedConnectionConfig = NonPersistedDidAuthConfig | NonPersistedOpenIdConfig
166
+ export type PartialConnectionConfig = PartialOpenIdConfig | PartialDidAuthConfig
167
+
168
+ export type NaturalPerson = {
169
+ id: string
170
+ firstName: string
171
+ lastName: string
172
+ middleName?: string
173
+ displayName: string
174
+ metadata?: Array<MetadataItem<MetadataTypes>>
175
+ ownerId?: string
176
+ tenantId?: string
177
+ createdAt: Date
178
+ lastUpdatedAt: Date
179
+ }
180
+
181
+ export type NonPersistedNaturalPerson = Omit<NaturalPerson, 'id' | 'createdAt' | 'lastUpdatedAt'>
182
+
183
+ export type PartialNaturalPerson = Partial<Omit<NaturalPerson, 'metadata'>> & {
184
+ metadata?: PartialMetadataItem<MetadataTypes>
185
+ }
186
+
187
+ export type Organization = {
188
+ id: string
189
+ legalName: string
190
+ displayName: string
191
+ metadata?: Array<MetadataItem<MetadataTypes>>
192
+ ownerId?: string
193
+ tenantId?: string
194
+ createdAt: Date
195
+ lastUpdatedAt: Date
196
+ }
197
+ export type NonPersistedOrganization = Omit<Organization, 'id' | 'createdAt' | 'lastUpdatedAt'>
198
+ export type PartialOrganization = Partial<Omit<Organization, 'metadata'>> & {
199
+ metadata?: PartialMetadataItem<MetadataTypes>
200
+ }
201
+
202
+ export type Contact = NaturalPerson | Organization
203
+ export type NonPersistedContact = NonPersistedNaturalPerson | NonPersistedOrganization
204
+ export type PartialContact = PartialNaturalPerson | PartialOrganization
205
+
206
+ export type PartyType = {
207
+ id: string
208
+ type: PartyTypeType
209
+ origin: PartyOrigin
210
+ name: string
211
+ tenantId: string
212
+ description?: string
213
+ createdAt: Date
214
+ lastUpdatedAt: Date
215
+ }
216
+ export type NonPersistedPartyType = Omit<PartyType, 'id' | 'createdAt' | 'lastUpdatedAt'> & {
217
+ id?: string
218
+ }
219
+ export type PartialPartyType = Partial<PartyType>
220
+
221
+ export type PartyRelationship = {
222
+ id: string
223
+ leftId: string
224
+ rightId: string
225
+ ownerId?: string
226
+ tenantId?: string
227
+ createdAt: Date
228
+ lastUpdatedAt: Date
229
+ }
230
+ export type NonPersistedPartyRelationship = Omit<PartyRelationship, 'id' | 'createdAt' | 'lastUpdatedAt'>
231
+ export type PartialPartyRelationship = Partial<PartyRelationship>
232
+
233
+ export type ElectronicAddress = {
234
+ id: string
235
+ type: ElectronicAddressType
236
+ electronicAddress: string
237
+ ownerId?: string
238
+ tenantId?: string
239
+ createdAt: Date
240
+ lastUpdatedAt: Date
241
+ }
242
+ export type NonPersistedElectronicAddress = Omit<ElectronicAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>
243
+ export type PartialElectronicAddress = Partial<ElectronicAddress> & {
244
+ partyId?: string
245
+ }
246
+
247
+ export type PhysicalAddress = {
248
+ id: string
249
+ type: PhysicalAddressType
250
+ streetName: string
251
+ streetNumber: string
252
+ postalCode: string
253
+ cityName: string
254
+ provinceName: string
255
+ countryCode: string
256
+ buildingName?: string
257
+ ownerId?: string
258
+ tenantId?: string
259
+ createdAt: Date
260
+ lastUpdatedAt: Date
261
+ }
262
+ export type NonPersistedPhysicalAddress = Omit<PhysicalAddress, 'id' | 'createdAt' | 'lastUpdatedAt'>
263
+ export type PartialPhysicalAddress = Partial<PhysicalAddress> & {
264
+ partyId?: string
265
+ }
266
+
267
+ export type ElectronicAddressType = 'email' | 'phone'
268
+
269
+ export type PhysicalAddressType = 'home' | 'visit' | 'postal'
270
+
271
+ export enum ConnectionType {
272
+ OPENID_CONNECT = 'OIDC',
273
+ SIOPv2 = 'SIOPv2',
274
+ SIOPv2_OpenID4VP = 'SIOPv2+OpenID4VP',
275
+ }
276
+
277
+ export enum CorrelationIdentifierType {
278
+ DID = 'did',
279
+ URL = 'url',
280
+ }
281
+
282
+ export enum PartyTypeType {
283
+ NATURAL_PERSON = 'naturalPerson',
284
+ ORGANIZATION = 'organization',
285
+ }
286
+
287
+ export enum PartyOrigin {
288
+ INTERNAL = 'INTERNAL',
289
+ EXTERNAL = 'EXTERNAL',
290
+ }
291
+
292
+ export enum IdentityOrigin {
293
+ INTERNAL = 'INTERNAL',
294
+ EXTERNAL = 'EXTERNAL',
295
+ }
@@ -1,42 +1,42 @@
1
- import { CredentialCorrelationType, CredentialRole, CredentialStateType, DigitalCredential, RegulationType } from './digitalCredential'
2
- import { Hasher } from '@sphereon/ssi-types'
3
- import { FindOptionsOrder } from 'typeorm'
4
- import { DigitalCredentialEntity } from '../../entities/digitalCredential/DigitalCredentialEntity'
5
-
6
- export type GetCredentialArgs = { id: string } | { hash: string }
7
-
8
- export type FindDigitalCredentialArgs = Array<Partial<DigitalCredential>>
9
-
10
- export type GetCredentialsArgs = {
11
- filter?: FindDigitalCredentialArgs
12
- offset?: number
13
- limit?: number
14
- order?: string | FindOptionsOrder<DigitalCredentialEntity>
15
- }
16
-
17
- export type GetCredentialsResponse = {
18
- data: Array<DigitalCredential>
19
- total: number
20
- }
21
-
22
- export type AddCredentialArgs = {
23
- rawDocument: string
24
- kmsKeyRef?: string
25
- identifierMethod?: string
26
- regulationType?: RegulationType
27
- parentId?: string
28
- issuerCorrelationType: CredentialCorrelationType
29
- subjectCorrelationType?: CredentialCorrelationType
30
- issuerCorrelationId: string
31
- subjectCorrelationId?: string
32
- credentialRole: CredentialRole
33
- tenantId?: string
34
- state?: CredentialStateType
35
- verifiedAt?: Date
36
- revokedAt?: Date
37
- opts?: { maxTimeSkewInMS?: number; hasher?: Hasher }
38
- }
39
-
40
- export type UpdateCredentialStateArgs = GetCredentialArgs & { verifiedState: CredentialStateType; verifiedAt?: Date; revokedAt?: Date }
41
-
42
- export type RemoveCredentialArgs = GetCredentialArgs
1
+ import { CredentialCorrelationType, CredentialRole, CredentialStateType, DigitalCredential, RegulationType } from './digitalCredential'
2
+ import { Hasher } from '@sphereon/ssi-types'
3
+ import { FindOptionsOrder } from 'typeorm'
4
+ import { DigitalCredentialEntity } from '../../entities/digitalCredential/DigitalCredentialEntity'
5
+
6
+ export type GetCredentialArgs = { id: string } | { hash: string }
7
+
8
+ export type FindDigitalCredentialArgs = Array<Partial<DigitalCredential>>
9
+
10
+ export type GetCredentialsArgs = {
11
+ filter?: FindDigitalCredentialArgs
12
+ offset?: number
13
+ limit?: number
14
+ order?: string | FindOptionsOrder<DigitalCredentialEntity>
15
+ }
16
+
17
+ export type GetCredentialsResponse = {
18
+ data: Array<DigitalCredential>
19
+ total: number
20
+ }
21
+
22
+ export type AddCredentialArgs = {
23
+ rawDocument: string
24
+ kmsKeyRef?: string
25
+ identifierMethod?: string
26
+ regulationType?: RegulationType
27
+ parentId?: string
28
+ issuerCorrelationType: CredentialCorrelationType
29
+ subjectCorrelationType?: CredentialCorrelationType
30
+ issuerCorrelationId: string
31
+ subjectCorrelationId?: string
32
+ credentialRole: CredentialRole
33
+ tenantId?: string
34
+ state?: CredentialStateType
35
+ verifiedAt?: Date
36
+ revokedAt?: Date
37
+ opts?: { maxTimeSkewInMS?: number; hasher?: Hasher }
38
+ }
39
+
40
+ export type UpdateCredentialStateArgs = GetCredentialArgs & { verifiedState: CredentialStateType; verifiedAt?: Date; revokedAt?: Date }
41
+
42
+ export type RemoveCredentialArgs = GetCredentialArgs