@sphereon/ssi-sdk.data-store 0.30.2-feature.siop.fixes.41 → 0.30.2-next.103

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 (43) hide show
  1. package/dist/contact/ContactStore.d.ts.map +1 -1
  2. package/dist/digitalCredential/DigitalCredentialStore.d.ts.map +1 -1
  3. package/dist/eventLogger/EventLoggerStore.d.ts +0 -1
  4. package/dist/eventLogger/EventLoggerStore.d.ts.map +1 -1
  5. package/dist/eventLogger/EventLoggerStore.js +3 -5
  6. package/dist/eventLogger/EventLoggerStore.js.map +1 -1
  7. package/dist/issuanceBranding/IssuanceBrandingStore.d.ts +0 -4
  8. package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -1
  9. package/dist/issuanceBranding/IssuanceBrandingStore.js +13 -42
  10. package/dist/issuanceBranding/IssuanceBrandingStore.js.map +1 -1
  11. package/dist/migrations/internal-migrations-ormconfig.d.ts.map +1 -1
  12. package/dist/presentationDefinition/PDStore.d.ts.map +1 -1
  13. package/dist/utils/FormattingUtils.d.ts +2 -0
  14. package/dist/utils/FormattingUtils.d.ts.map +1 -0
  15. package/dist/utils/FormattingUtils.js +23 -0
  16. package/dist/utils/FormattingUtils.js.map +1 -0
  17. package/dist/utils/SortingUtils.d.ts.map +1 -1
  18. package/dist/utils/contact/MappingUtils.d.ts.map +1 -1
  19. package/dist/utils/contact/MappingUtils.js +27 -14
  20. package/dist/utils/contact/MappingUtils.js.map +1 -1
  21. package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -1
  22. package/dist/utils/digitalCredential/MappingUtils.js +7 -5
  23. package/dist/utils/digitalCredential/MappingUtils.js.map +1 -1
  24. package/dist/utils/eventLogger/MappingUtils.d.ts +4 -0
  25. package/dist/utils/eventLogger/MappingUtils.d.ts.map +1 -0
  26. package/dist/utils/eventLogger/MappingUtils.js +10 -0
  27. package/dist/utils/eventLogger/MappingUtils.js.map +1 -0
  28. package/dist/utils/issuanceBranding/MappingUtils.d.ts +8 -0
  29. package/dist/utils/issuanceBranding/MappingUtils.d.ts.map +1 -0
  30. package/dist/utils/issuanceBranding/MappingUtils.js +20 -0
  31. package/dist/utils/issuanceBranding/MappingUtils.js.map +1 -0
  32. package/dist/utils/presentationDefinition/MappingUtils.d.ts.map +1 -1
  33. package/dist/utils/presentationDefinition/MappingUtils.js +5 -3
  34. package/dist/utils/presentationDefinition/MappingUtils.js.map +1 -1
  35. package/package.json +7 -7
  36. package/src/eventLogger/EventLoggerStore.ts +3 -25
  37. package/src/issuanceBranding/IssuanceBrandingStore.ts +13 -63
  38. package/src/utils/FormattingUtils.ts +21 -0
  39. package/src/utils/contact/MappingUtils.ts +39 -13
  40. package/src/utils/digitalCredential/MappingUtils.ts +4 -1
  41. package/src/utils/eventLogger/MappingUtils.ts +28 -0
  42. package/src/utils/issuanceBranding/MappingUtils.ts +32 -0
  43. package/src/utils/presentationDefinition/MappingUtils.ts +4 -1
@@ -47,6 +47,7 @@ import { OpenIdConfigEntity } from '../../entities/contact/OpenIdConfigEntity'
47
47
  import { PartyTypeEntity } from '../../entities/contact/PartyTypeEntity'
48
48
  import { PhysicalAddressEntity } from '../../entities/contact/PhysicalAddressEntity'
49
49
  import { ContactMetadataItemEntity } from '../../entities/contact/ContactMetadataItemEntity'
50
+ import { replaceNullWithUndefined } from '../FormattingUtils'
50
51
 
51
52
  export const partyEntityFrom = (party: NonPersistedParty): PartyEntity => {
52
53
  const partyEntity: PartyEntity = new PartyEntity()
@@ -67,10 +68,10 @@ export const partyEntityFrom = (party: NonPersistedParty): PartyEntity => {
67
68
  }
68
69
 
69
70
  export const partyFrom = (party: PartyEntity): Party => {
70
- return {
71
+ const result: Party = {
71
72
  id: party.id,
72
73
  uri: party.uri,
73
- roles: [...new Set(party.identities?.flatMap((identity: IdentityEntity) => identity.roles))] ?? [],
74
+ roles: [...new Set(party.identities?.flatMap((identity: IdentityEntity) => identity.roles))],
74
75
  identities: party.identities ? party.identities.map((identity: IdentityEntity) => identityFrom(identity)) : [],
75
76
  electronicAddresses: party.electronicAddresses
76
77
  ? party.electronicAddresses.map((electronicAddress: ElectronicAddressEntity) => electronicAddressFrom(electronicAddress))
@@ -86,6 +87,8 @@ export const partyFrom = (party: PartyEntity): Party => {
86
87
  createdAt: party.createdAt,
87
88
  lastUpdatedAt: party.lastUpdatedAt,
88
89
  }
90
+
91
+ return replaceNullWithUndefined(result)
89
92
  }
90
93
 
91
94
  export const contactEntityFrom = (contact: NonPersistedContact): BaseContactEntity => {
@@ -125,13 +128,15 @@ export const connectionEntityFrom = (connection: NonPersistedConnection): Connec
125
128
  }
126
129
 
127
130
  export const connectionFrom = (connection: ConnectionEntity): Connection => {
128
- return {
131
+ const result: Connection = {
129
132
  id: connection.id,
130
133
  type: connection.type,
131
134
  ownerId: connection.ownerId,
132
135
  tenantId: connection.tenantId,
133
136
  config: configFrom(connection.config),
134
137
  }
138
+
139
+ return replaceNullWithUndefined(result)
135
140
  }
136
141
 
137
142
  const configEntityFrom = (config: NonPersistedConnectionConfig): BaseConfigEntity => {
@@ -155,13 +160,15 @@ export const correlationIdentifierEntityFrom = (identifier: NonPersistedCorrelat
155
160
  }
156
161
 
157
162
  export const correlationIdentifierFrom = (identifier: CorrelationIdentifierEntity): CorrelationIdentifier => {
158
- return {
163
+ const result: CorrelationIdentifier = {
159
164
  id: identifier.id,
160
165
  type: identifier.type,
161
166
  correlationId: identifier.correlationId,
162
167
  ownerId: identifier.ownerId,
163
168
  tenantId: identifier.tenantId,
164
169
  }
170
+
171
+ return replaceNullWithUndefined(result)
165
172
  }
166
173
 
167
174
  export const didAuthConfigEntityFrom = (config: NonPersistedDidAuthConfig): DidAuthConfigEntity => {
@@ -196,7 +203,7 @@ export const electronicAddressEntityFrom = (electronicAddress: NonPersistedElect
196
203
  }
197
204
 
198
205
  export const electronicAddressFrom = (electronicAddress: ElectronicAddressEntity): ElectronicAddress => {
199
- return {
206
+ const result: ElectronicAddress = {
200
207
  id: electronicAddress.id,
201
208
  type: electronicAddress.type,
202
209
  electronicAddress: electronicAddress.electronicAddress,
@@ -205,6 +212,8 @@ export const electronicAddressFrom = (electronicAddress: ElectronicAddressEntity
205
212
  createdAt: electronicAddress.createdAt,
206
213
  lastUpdatedAt: electronicAddress.lastUpdatedAt,
207
214
  }
215
+
216
+ return replaceNullWithUndefined(result)
208
217
  }
209
218
 
210
219
  export const physicalAddressEntityFrom = (physicalAddress: NonPersistedPhysicalAddress): PhysicalAddressEntity => {
@@ -224,7 +233,7 @@ export const physicalAddressEntityFrom = (physicalAddress: NonPersistedPhysicalA
224
233
  }
225
234
 
226
235
  export const physicalAddressFrom = (physicalAddress: PhysicalAddressEntity): PhysicalAddress => {
227
- return {
236
+ const result: PhysicalAddress = {
228
237
  id: physicalAddress.id,
229
238
  type: physicalAddress.type,
230
239
  streetName: physicalAddress.streetName,
@@ -239,6 +248,8 @@ export const physicalAddressFrom = (physicalAddress: PhysicalAddressEntity): Phy
239
248
  createdAt: physicalAddress.createdAt,
240
249
  lastUpdatedAt: physicalAddress.lastUpdatedAt,
241
250
  }
251
+
252
+ return replaceNullWithUndefined(result)
242
253
  }
243
254
 
244
255
  export const identityEntityFrom = (entity: NonPersistedIdentity): IdentityEntity => {
@@ -257,7 +268,7 @@ export const identityEntityFrom = (entity: NonPersistedIdentity): IdentityEntity
257
268
  }
258
269
 
259
270
  export const identityFrom = (identity: IdentityEntity): Identity => {
260
- return {
271
+ const result: Identity = {
261
272
  id: identity.id,
262
273
  alias: identity.alias,
263
274
  origin: identity.origin,
@@ -270,6 +281,8 @@ export const identityFrom = (identity: IdentityEntity): Identity => {
270
281
  createdAt: identity.createdAt,
271
282
  lastUpdatedAt: identity.createdAt,
272
283
  }
284
+
285
+ return replaceNullWithUndefined(result)
273
286
  }
274
287
 
275
288
  const metadataItemEntityFrom = <T extends MetadataTypes, U extends { new (): any }>(
@@ -359,7 +372,7 @@ export const naturalPersonEntityFrom = (naturalPerson: NonPersistedNaturalPerson
359
372
  }
360
373
 
361
374
  export const naturalPersonFrom = (naturalPerson: NaturalPersonEntity): NaturalPerson => {
362
- return {
375
+ const result: NaturalPerson = {
363
376
  id: naturalPerson.id,
364
377
  firstName: naturalPerson.firstName,
365
378
  middleName: naturalPerson.middleName,
@@ -371,6 +384,8 @@ export const naturalPersonFrom = (naturalPerson: NaturalPersonEntity): NaturalPe
371
384
  createdAt: naturalPerson.createdAt,
372
385
  lastUpdatedAt: naturalPerson.lastUpdatedAt,
373
386
  }
387
+
388
+ return replaceNullWithUndefined(result)
374
389
  }
375
390
 
376
391
  export const openIdConfigEntityFrom = (config: NonPersistedOpenIdConfig): OpenIdConfigEntity => {
@@ -402,7 +417,7 @@ export const organizationEntityFrom = (organization: NonPersistedOrganization):
402
417
  }
403
418
 
404
419
  export const organizationFrom = (organization: OrganizationEntity): Organization => {
405
- return {
420
+ const result: Organization = {
406
421
  id: organization.id,
407
422
  legalName: organization.legalName,
408
423
  displayName: organization.displayName,
@@ -412,6 +427,8 @@ export const organizationFrom = (organization: OrganizationEntity): Organization
412
427
  createdAt: organization.createdAt,
413
428
  lastUpdatedAt: organization.lastUpdatedAt,
414
429
  }
430
+
431
+ return replaceNullWithUndefined(result)
415
432
  }
416
433
 
417
434
  export const partyRelationshipEntityFrom = (relationship: NonPersistedPartyRelationship): PartyRelationshipEntity => {
@@ -420,11 +437,12 @@ export const partyRelationshipEntityFrom = (relationship: NonPersistedPartyRelat
420
437
  partyRelationshipEntity.rightId = relationship.rightId
421
438
  partyRelationshipEntity.ownerId = relationship.ownerId
422
439
  partyRelationshipEntity.tenantId = relationship.tenantId
440
+
423
441
  return partyRelationshipEntity
424
442
  }
425
443
 
426
444
  export const partyRelationshipFrom = (relationship: PartyRelationshipEntity): PartyRelationship => {
427
- return {
445
+ const result: PartyRelationship = {
428
446
  id: relationship.id,
429
447
  leftId: relationship.leftId,
430
448
  rightId: relationship.rightId,
@@ -433,6 +451,8 @@ export const partyRelationshipFrom = (relationship: PartyRelationshipEntity): Pa
433
451
  createdAt: relationship.createdAt,
434
452
  lastUpdatedAt: relationship.lastUpdatedAt,
435
453
  }
454
+
455
+ return replaceNullWithUndefined(result)
436
456
  }
437
457
 
438
458
  export const partyTypeEntityFrom = (args: NonPersistedPartyType): PartyTypeEntity => {
@@ -450,7 +470,7 @@ export const partyTypeEntityFrom = (args: NonPersistedPartyType): PartyTypeEntit
450
470
  }
451
471
 
452
472
  export const partyTypeFrom = (partyType: PartyTypeEntity): PartyType => {
453
- return {
473
+ const result: PartyType = {
454
474
  id: partyType.id,
455
475
  type: partyType.type,
456
476
  origin: partyType.origin,
@@ -460,6 +480,8 @@ export const partyTypeFrom = (partyType: PartyTypeEntity): PartyType => {
460
480
  createdAt: partyType.createdAt,
461
481
  lastUpdatedAt: partyType.lastUpdatedAt,
462
482
  }
483
+
484
+ return replaceNullWithUndefined(result)
463
485
  }
464
486
 
465
487
  export const configFrom = (config: BaseConfigEntity): ConnectionConfig => {
@@ -473,7 +495,7 @@ export const configFrom = (config: BaseConfigEntity): ConnectionConfig => {
473
495
  }
474
496
 
475
497
  export const openIdConfigFrom = (config: OpenIdConfigEntity): OpenIdConfig => {
476
- return {
498
+ const result: OpenIdConfig = {
477
499
  id: config.id,
478
500
  clientId: config.clientId,
479
501
  clientSecret: config.clientSecret,
@@ -485,10 +507,12 @@ export const openIdConfigFrom = (config: OpenIdConfigEntity): OpenIdConfig => {
485
507
  ownerId: config.ownerId,
486
508
  tenantId: config.tenantId,
487
509
  }
510
+
511
+ return replaceNullWithUndefined(result)
488
512
  }
489
513
 
490
514
  export const didAuthConfigFrom = (config: DidAuthConfigEntity): DidAuthConfig => {
491
- return {
515
+ const result: DidAuthConfig = {
492
516
  id: config.id,
493
517
  idOpts: { identifier: config.identifier },
494
518
  stateId: '', // FIXME
@@ -497,6 +521,8 @@ export const didAuthConfigFrom = (config: DidAuthConfigEntity): DidAuthConfig =>
497
521
  ownerId: config.ownerId,
498
522
  tenantId: config.tenantId,
499
523
  }
524
+
525
+ return replaceNullWithUndefined(result)
500
526
  }
501
527
 
502
528
  export const isOpenIdConfig = (config: NonPersistedConnectionConfig | BaseConfigEntity): config is OpenIdConfig | OpenIdConfigEntity =>
@@ -18,6 +18,7 @@ import {
18
18
  NonPersistedDigitalCredential,
19
19
  RegulationType,
20
20
  } from '../../types'
21
+ import { replaceNullWithUndefined } from '../FormattingUtils'
21
22
 
22
23
  function determineDocumentType(raw: string): DocumentType {
23
24
  const rawDocument = parseRawDocument(raw)
@@ -150,9 +151,11 @@ export const nonPersistedDigitalCredentialEntityFromAddArgs = (addCredentialArgs
150
151
  }
151
152
 
152
153
  export const digitalCredentialFrom = (credentialEntity: DigitalCredentialEntity): DigitalCredential => {
153
- return {
154
+ const result: DigitalCredential = {
154
155
  ...credentialEntity,
155
156
  }
157
+
158
+ return replaceNullWithUndefined(result)
156
159
  }
157
160
 
158
161
  export const digitalCredentialsFrom = (credentialEntities: Array<DigitalCredentialEntity>): DigitalCredential[] => {
@@ -0,0 +1,28 @@
1
+ import { AuditEventEntity } from '../../entities/eventLogger/AuditEventEntity'
2
+ import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
3
+ import { replaceNullWithUndefined } from '../FormattingUtils'
4
+
5
+ export const auditEventFrom = (event: AuditEventEntity): AuditLoggingEvent => {
6
+ const result: AuditLoggingEvent = {
7
+ id: event.id,
8
+ description: event.description,
9
+ timestamp: event.timestamp,
10
+ level: event.level,
11
+ correlationId: event.correlationId,
12
+ actionType: event.actionType,
13
+ actionSubType: event.actionSubType,
14
+ initiatorType: event.initiatorType,
15
+ partyAlias: event.partyAlias,
16
+ partyCorrelationId: event.partyCorrelationId,
17
+ partyCorrelationType: event.partyCorrelationType,
18
+ subSystemType: event.subSystemType,
19
+ system: event.system,
20
+ systemAlias: event.systemAlias,
21
+ systemCorrelationId: event.systemCorrelationId,
22
+ systemCorrelationIdType: event.systemCorrelationIdType,
23
+ ...(event.data && { data: JSON.parse(event.data) }),
24
+ ...(event.diagnosticData && { diagnosticData: JSON.parse(event.diagnosticData) }),
25
+ }
26
+
27
+ return replaceNullWithUndefined(result)
28
+ }
@@ -0,0 +1,32 @@
1
+ import { CredentialBrandingEntity } from '../../entities/issuanceBranding/CredentialBrandingEntity'
2
+ import { BaseLocaleBrandingEntity } from '../../entities/issuanceBranding/BaseLocaleBrandingEntity'
3
+ import { IssuerBrandingEntity } from '../../entities/issuanceBranding/IssuerBrandingEntity'
4
+ import { replaceNullWithUndefined } from '../FormattingUtils'
5
+ import { ICredentialBranding, IIssuerBranding, ILocaleBranding } from '../../types'
6
+
7
+ export const credentialBrandingFrom = (credentialBranding: CredentialBrandingEntity): ICredentialBranding => {
8
+ const result: ICredentialBranding = {
9
+ ...credentialBranding,
10
+ localeBranding: credentialBranding.localeBranding.map((localeBranding: BaseLocaleBrandingEntity) => localeBrandingFrom(localeBranding)),
11
+ }
12
+
13
+ return replaceNullWithUndefined(result)
14
+ }
15
+
16
+ export const issuerBrandingFrom = (issuerBranding: IssuerBrandingEntity): IIssuerBranding => {
17
+ const result: IIssuerBranding = {
18
+ ...issuerBranding,
19
+ localeBranding: issuerBranding.localeBranding.map((localeBranding: BaseLocaleBrandingEntity) => localeBrandingFrom(localeBranding)),
20
+ }
21
+
22
+ return replaceNullWithUndefined(result)
23
+ }
24
+
25
+ export const localeBrandingFrom = (localeBranding: BaseLocaleBrandingEntity): ILocaleBranding => {
26
+ const result: ILocaleBranding = {
27
+ ...localeBranding,
28
+ locale: localeBranding.locale === '' ? undefined : localeBranding.locale,
29
+ }
30
+
31
+ return replaceNullWithUndefined(result)
32
+ }
@@ -2,9 +2,10 @@ import { PresentationDefinitionItemEntity } from '../../entities/presentationDef
2
2
  import { IPresentationDefinition } from '@sphereon/pex'
3
3
  import { NonPersistedPresentationDefinitionItem, PartialPresentationDefinitionItem, PresentationDefinitionItem } from '../../types'
4
4
  import { blake2bHex } from 'blakejs'
5
+ import { replaceNullWithUndefined } from '../FormattingUtils'
5
6
 
6
7
  export const presentationDefinitionItemFrom = (entity: PresentationDefinitionItemEntity): PresentationDefinitionItem => {
7
- return {
8
+ const result: PresentationDefinitionItem = {
8
9
  id: entity.id,
9
10
  tenantId: entity.tenantId,
10
11
  definitionId: entity.definitionId,
@@ -15,6 +16,8 @@ export const presentationDefinitionItemFrom = (entity: PresentationDefinitionIte
15
16
  createdAt: entity.createdAt,
16
17
  lastUpdatedAt: entity.lastUpdatedAt,
17
18
  }
19
+
20
+ return replaceNullWithUndefined(result)
18
21
  }
19
22
 
20
23
  export const presentationDefinitionEntityItemFrom = (item: NonPersistedPresentationDefinitionItem): PresentationDefinitionItemEntity => {