@sphereon/ssi-sdk.data-store 0.30.2-feature.SPRIND.61.JARM.36 → 0.30.2-next.5

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 (38) hide show
  1. package/dist/eventLogger/EventLoggerStore.d.ts +0 -1
  2. package/dist/eventLogger/EventLoggerStore.d.ts.map +1 -1
  3. package/dist/eventLogger/EventLoggerStore.js +3 -5
  4. package/dist/eventLogger/EventLoggerStore.js.map +1 -1
  5. package/dist/issuanceBranding/IssuanceBrandingStore.d.ts +0 -4
  6. package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -1
  7. package/dist/issuanceBranding/IssuanceBrandingStore.js +13 -42
  8. package/dist/issuanceBranding/IssuanceBrandingStore.js.map +1 -1
  9. package/dist/utils/FormattingUtils.d.ts +2 -0
  10. package/dist/utils/FormattingUtils.d.ts.map +1 -0
  11. package/dist/utils/FormattingUtils.js +23 -0
  12. package/dist/utils/FormattingUtils.js.map +1 -0
  13. package/dist/utils/contact/MappingUtils.d.ts.map +1 -1
  14. package/dist/utils/contact/MappingUtils.js +25 -12
  15. package/dist/utils/contact/MappingUtils.js.map +1 -1
  16. package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -1
  17. package/dist/utils/digitalCredential/MappingUtils.js +3 -1
  18. package/dist/utils/digitalCredential/MappingUtils.js.map +1 -1
  19. package/dist/utils/eventLogger/MappingUtils.d.ts +4 -0
  20. package/dist/utils/eventLogger/MappingUtils.d.ts.map +1 -0
  21. package/dist/utils/eventLogger/MappingUtils.js +10 -0
  22. package/dist/utils/eventLogger/MappingUtils.js.map +1 -0
  23. package/dist/utils/issuanceBranding/MappingUtils.d.ts +8 -0
  24. package/dist/utils/issuanceBranding/MappingUtils.d.ts.map +1 -0
  25. package/dist/utils/issuanceBranding/MappingUtils.js +20 -0
  26. package/dist/utils/issuanceBranding/MappingUtils.js.map +1 -0
  27. package/dist/utils/presentationDefinition/MappingUtils.d.ts.map +1 -1
  28. package/dist/utils/presentationDefinition/MappingUtils.js +3 -1
  29. package/dist/utils/presentationDefinition/MappingUtils.js.map +1 -1
  30. package/package.json +8 -9
  31. package/src/eventLogger/EventLoggerStore.ts +3 -25
  32. package/src/issuanceBranding/IssuanceBrandingStore.ts +14 -62
  33. package/src/utils/FormattingUtils.ts +21 -0
  34. package/src/utils/contact/MappingUtils.ts +39 -16
  35. package/src/utils/digitalCredential/MappingUtils.ts +4 -1
  36. package/src/utils/eventLogger/MappingUtils.ts +28 -0
  37. package/src/utils/issuanceBranding/MappingUtils.ts +32 -0
  38. 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,7 +68,7 @@ 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
74
  roles: [...new Set(party.identities?.flatMap((identity: IdentityEntity) => identity.roles))] ?? [],
@@ -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,12 +281,11 @@ 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
- const metadataItemEntityFrom = <T extends MetadataTypes, U extends { new (): any }>(
276
- item: NonPersistedMetadataItem<T>,
277
- EntityClass: U,
278
- ): InstanceType<U> | undefined => {
288
+ const metadataItemEntityFrom = <T extends MetadataTypes, U extends { new (): any }>(item: NonPersistedMetadataItem<T>, EntityClass: U): InstanceType<U> | undefined => {
279
289
  const { label, value } = item
280
290
 
281
291
  if (value === null || value === undefined) {
@@ -359,7 +369,7 @@ export const naturalPersonEntityFrom = (naturalPerson: NonPersistedNaturalPerson
359
369
  }
360
370
 
361
371
  export const naturalPersonFrom = (naturalPerson: NaturalPersonEntity): NaturalPerson => {
362
- return {
372
+ const result: NaturalPerson = {
363
373
  id: naturalPerson.id,
364
374
  firstName: naturalPerson.firstName,
365
375
  middleName: naturalPerson.middleName,
@@ -371,6 +381,8 @@ export const naturalPersonFrom = (naturalPerson: NaturalPersonEntity): NaturalPe
371
381
  createdAt: naturalPerson.createdAt,
372
382
  lastUpdatedAt: naturalPerson.lastUpdatedAt,
373
383
  }
384
+
385
+ return replaceNullWithUndefined(result)
374
386
  }
375
387
 
376
388
  export const openIdConfigEntityFrom = (config: NonPersistedOpenIdConfig): OpenIdConfigEntity => {
@@ -402,7 +414,7 @@ export const organizationEntityFrom = (organization: NonPersistedOrganization):
402
414
  }
403
415
 
404
416
  export const organizationFrom = (organization: OrganizationEntity): Organization => {
405
- return {
417
+ const result: Organization = {
406
418
  id: organization.id,
407
419
  legalName: organization.legalName,
408
420
  displayName: organization.displayName,
@@ -412,6 +424,8 @@ export const organizationFrom = (organization: OrganizationEntity): Organization
412
424
  createdAt: organization.createdAt,
413
425
  lastUpdatedAt: organization.lastUpdatedAt,
414
426
  }
427
+
428
+ return replaceNullWithUndefined(result)
415
429
  }
416
430
 
417
431
  export const partyRelationshipEntityFrom = (relationship: NonPersistedPartyRelationship): PartyRelationshipEntity => {
@@ -420,11 +434,12 @@ export const partyRelationshipEntityFrom = (relationship: NonPersistedPartyRelat
420
434
  partyRelationshipEntity.rightId = relationship.rightId
421
435
  partyRelationshipEntity.ownerId = relationship.ownerId
422
436
  partyRelationshipEntity.tenantId = relationship.tenantId
437
+
423
438
  return partyRelationshipEntity
424
439
  }
425
440
 
426
441
  export const partyRelationshipFrom = (relationship: PartyRelationshipEntity): PartyRelationship => {
427
- return {
442
+ const result: PartyRelationship = {
428
443
  id: relationship.id,
429
444
  leftId: relationship.leftId,
430
445
  rightId: relationship.rightId,
@@ -433,6 +448,8 @@ export const partyRelationshipFrom = (relationship: PartyRelationshipEntity): Pa
433
448
  createdAt: relationship.createdAt,
434
449
  lastUpdatedAt: relationship.lastUpdatedAt,
435
450
  }
451
+
452
+ return replaceNullWithUndefined(result)
436
453
  }
437
454
 
438
455
  export const partyTypeEntityFrom = (args: NonPersistedPartyType): PartyTypeEntity => {
@@ -450,7 +467,7 @@ export const partyTypeEntityFrom = (args: NonPersistedPartyType): PartyTypeEntit
450
467
  }
451
468
 
452
469
  export const partyTypeFrom = (partyType: PartyTypeEntity): PartyType => {
453
- return {
470
+ const result: PartyType = {
454
471
  id: partyType.id,
455
472
  type: partyType.type,
456
473
  origin: partyType.origin,
@@ -460,6 +477,8 @@ export const partyTypeFrom = (partyType: PartyTypeEntity): PartyType => {
460
477
  createdAt: partyType.createdAt,
461
478
  lastUpdatedAt: partyType.lastUpdatedAt,
462
479
  }
480
+
481
+ return replaceNullWithUndefined(result)
463
482
  }
464
483
 
465
484
  export const configFrom = (config: BaseConfigEntity): ConnectionConfig => {
@@ -473,7 +492,7 @@ export const configFrom = (config: BaseConfigEntity): ConnectionConfig => {
473
492
  }
474
493
 
475
494
  export const openIdConfigFrom = (config: OpenIdConfigEntity): OpenIdConfig => {
476
- return {
495
+ const result: OpenIdConfig = {
477
496
  id: config.id,
478
497
  clientId: config.clientId,
479
498
  clientSecret: config.clientSecret,
@@ -485,10 +504,12 @@ export const openIdConfigFrom = (config: OpenIdConfigEntity): OpenIdConfig => {
485
504
  ownerId: config.ownerId,
486
505
  tenantId: config.tenantId,
487
506
  }
507
+
508
+ return replaceNullWithUndefined(result)
488
509
  }
489
510
 
490
511
  export const didAuthConfigFrom = (config: DidAuthConfigEntity): DidAuthConfig => {
491
- return {
512
+ const result: DidAuthConfig = {
492
513
  id: config.id,
493
514
  idOpts: { identifier: config.identifier },
494
515
  stateId: '', // FIXME
@@ -497,6 +518,8 @@ export const didAuthConfigFrom = (config: DidAuthConfigEntity): DidAuthConfig =>
497
518
  ownerId: config.ownerId,
498
519
  tenantId: config.tenantId,
499
520
  }
521
+
522
+ return replaceNullWithUndefined(result)
500
523
  }
501
524
 
502
525
  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 => {