@sphereon/ssi-sdk.data-store 0.21.2-next.7 → 0.21.2-unstable.26

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 (40) hide show
  1. package/dist/entities/contact/PartyTypeEntity.d.ts +2 -1
  2. package/dist/entities/contact/PartyTypeEntity.d.ts.map +1 -1
  3. package/dist/entities/contact/PartyTypeEntity.js +4 -0
  4. package/dist/entities/contact/PartyTypeEntity.js.map +1 -1
  5. package/dist/entities/issuanceBranding/ImageAttributesEntity.js +2 -2
  6. package/dist/entities/issuanceBranding/ImageAttributesEntity.js.map +1 -1
  7. package/dist/migrations/postgres/1659463079428-CreateContacts.d.ts.map +1 -1
  8. package/dist/migrations/postgres/1659463079428-CreateContacts.js +0 -16
  9. package/dist/migrations/postgres/1659463079428-CreateContacts.js.map +1 -1
  10. package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js +1 -1
  11. package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js.map +1 -1
  12. package/dist/migrations/postgres/1690925872592-CreateContacts.d.ts.map +1 -1
  13. package/dist/migrations/postgres/1690925872592-CreateContacts.js +5 -2
  14. package/dist/migrations/postgres/1690925872592-CreateContacts.js.map +1 -1
  15. package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js +3 -3
  16. package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js.map +1 -1
  17. package/dist/migrations/sqlite/1690925872693-CreateContacts.js +1 -1
  18. package/dist/migrations/sqlite/1690925872693-CreateContacts.js.map +1 -1
  19. package/dist/types/contact/IAbstractContactStore.d.ts +2 -1
  20. package/dist/types/contact/IAbstractContactStore.d.ts.map +1 -1
  21. package/dist/types/contact/contact.d.ts +5 -0
  22. package/dist/types/contact/contact.d.ts.map +1 -1
  23. package/dist/types/contact/contact.js +6 -1
  24. package/dist/types/contact/contact.js.map +1 -1
  25. package/dist/utils/contact/MappingUtils.d.ts.map +1 -1
  26. package/dist/utils/contact/MappingUtils.js +2 -0
  27. package/dist/utils/contact/MappingUtils.js.map +1 -1
  28. package/package.json +4 -4
  29. package/src/__tests__/contact.entities.test.ts +51 -1
  30. package/src/__tests__/contact.store.test.ts +74 -1
  31. package/src/entities/contact/PartyTypeEntity.ts +5 -2
  32. package/src/entities/issuanceBranding/ImageAttributesEntity.ts +2 -2
  33. package/src/migrations/postgres/1659463079428-CreateContacts.ts +0 -18
  34. package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +1 -1
  35. package/src/migrations/postgres/1690925872592-CreateContacts.ts +9 -2
  36. package/src/migrations/sqlite/1685628973231-CreateIssuanceBranding.ts +3 -3
  37. package/src/migrations/sqlite/1690925872693-CreateContacts.ts +1 -1
  38. package/src/types/contact/IAbstractContactStore.ts +2 -0
  39. package/src/types/contact/contact.ts +6 -0
  40. package/src/utils/contact/MappingUtils.ts +2 -0
@@ -1,5 +1,5 @@
1
1
  import { DataSource } from 'typeorm'
2
- import { DataStoreMigrations, DataStoreContactEntities } from '../index'
2
+ import { DataStoreContactEntities, DataStoreMigrations, PartyOrigin } from '../index'
3
3
  import { ContactStore } from '../contact/ContactStore'
4
4
  import {
5
5
  CorrelationIdentifierEnum,
@@ -54,6 +54,7 @@ describe('Contact store tests', (): void => {
54
54
  uri: 'example.com',
55
55
  partyType: {
56
56
  type: PartyTypeEnum.NATURAL_PERSON,
57
+ origin: PartyOrigin.internal,
57
58
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
58
59
  name: 'example_name',
59
60
  },
@@ -84,6 +85,7 @@ describe('Contact store tests', (): void => {
84
85
  uri: 'example.com',
85
86
  partyType: {
86
87
  type: PartyTypeEnum.NATURAL_PERSON,
88
+ origin: PartyOrigin.internal,
87
89
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
88
90
  name: 'example_name1',
89
91
  },
@@ -101,6 +103,7 @@ describe('Contact store tests', (): void => {
101
103
  uri: 'example.com',
102
104
  partyType: {
103
105
  type: PartyTypeEnum.NATURAL_PERSON,
106
+ origin: PartyOrigin.internal,
104
107
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
105
108
  name: 'example_name2',
106
109
  },
@@ -125,6 +128,7 @@ describe('Contact store tests', (): void => {
125
128
  uri: 'example.com',
126
129
  partyType: {
127
130
  type: PartyTypeEnum.NATURAL_PERSON,
131
+ origin: PartyOrigin.internal,
128
132
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
129
133
  name: 'example_name',
130
134
  },
@@ -172,6 +176,7 @@ describe('Contact store tests', (): void => {
172
176
  uri: 'example.com',
173
177
  partyType: {
174
178
  type: PartyTypeEnum.NATURAL_PERSON,
179
+ origin: PartyOrigin.internal,
175
180
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
176
181
  name: 'example_name',
177
182
  },
@@ -239,6 +244,7 @@ describe('Contact store tests', (): void => {
239
244
  uri: 'example.com',
240
245
  partyType: {
241
246
  type: PartyTypeEnum.NATURAL_PERSON,
247
+ origin: PartyOrigin.internal,
242
248
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
243
249
  name: 'something',
244
250
  },
@@ -282,6 +288,7 @@ describe('Contact store tests', (): void => {
282
288
  uri: 'example.com',
283
289
  partyType: {
284
290
  type: PartyTypeEnum.NATURAL_PERSON,
291
+ origin: PartyOrigin.internal,
285
292
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
286
293
  name: 'example_name',
287
294
  },
@@ -315,6 +322,7 @@ describe('Contact store tests', (): void => {
315
322
  uri: 'example.com',
316
323
  partyType: {
317
324
  type: PartyTypeEnum.NATURAL_PERSON,
325
+ origin: PartyOrigin.internal,
318
326
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
319
327
  name: 'example_name',
320
328
  },
@@ -366,6 +374,7 @@ describe('Contact store tests', (): void => {
366
374
  uri: 'example.com',
367
375
  partyType: {
368
376
  type: PartyTypeEnum.NATURAL_PERSON,
377
+ origin: PartyOrigin.internal,
369
378
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
370
379
  name: 'example_name',
371
380
  },
@@ -391,6 +400,7 @@ describe('Contact store tests', (): void => {
391
400
  uri: 'example.com',
392
401
  partyType: {
393
402
  type: PartyTypeEnum.NATURAL_PERSON,
403
+ origin: PartyOrigin.internal,
394
404
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
395
405
  name: 'example_name',
396
406
  },
@@ -434,6 +444,7 @@ describe('Contact store tests', (): void => {
434
444
  uri: 'example.com',
435
445
  partyType: {
436
446
  type: PartyTypeEnum.NATURAL_PERSON,
447
+ origin: PartyOrigin.internal,
437
448
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
438
449
  name: 'something',
439
450
  },
@@ -471,6 +482,7 @@ describe('Contact store tests', (): void => {
471
482
  uri: 'example.com',
472
483
  partyType: {
473
484
  type: PartyTypeEnum.NATURAL_PERSON,
485
+ origin: PartyOrigin.internal,
474
486
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
475
487
  name: 'example_name',
476
488
  },
@@ -528,6 +540,7 @@ describe('Contact store tests', (): void => {
528
540
  uri: 'example.com',
529
541
  partyType: {
530
542
  type: PartyTypeEnum.NATURAL_PERSON,
543
+ origin: PartyOrigin.internal,
531
544
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
532
545
  name: 'example_name',
533
546
  },
@@ -560,6 +573,7 @@ describe('Contact store tests', (): void => {
560
573
  uri: 'example.com',
561
574
  partyType: {
562
575
  type: PartyTypeEnum.NATURAL_PERSON,
576
+ origin: PartyOrigin.internal,
563
577
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
564
578
  name: 'example_name',
565
579
  },
@@ -594,6 +608,7 @@ describe('Contact store tests', (): void => {
594
608
  uri: 'example.com',
595
609
  partyType: {
596
610
  type: PartyTypeEnum.NATURAL_PERSON,
611
+ origin: PartyOrigin.internal,
597
612
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
598
613
  name: 'example_name',
599
614
  },
@@ -634,6 +649,7 @@ describe('Contact store tests', (): void => {
634
649
  uri: 'example.com',
635
650
  partyType: {
636
651
  type: PartyTypeEnum.NATURAL_PERSON,
652
+ origin: PartyOrigin.internal,
637
653
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
638
654
  name: 'example_name',
639
655
  },
@@ -683,6 +699,7 @@ describe('Contact store tests', (): void => {
683
699
  uri: 'example.com',
684
700
  partyType: {
685
701
  type: PartyTypeEnum.NATURAL_PERSON,
702
+ origin: PartyOrigin.internal,
686
703
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
687
704
  name: 'example_name',
688
705
  },
@@ -728,6 +745,7 @@ describe('Contact store tests', (): void => {
728
745
  uri: 'example.com',
729
746
  partyType: {
730
747
  type: PartyTypeEnum.NATURAL_PERSON,
748
+ origin: PartyOrigin.internal,
731
749
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
732
750
  name: 'example_name',
733
751
  },
@@ -778,6 +796,7 @@ describe('Contact store tests', (): void => {
778
796
  uri: 'example.com',
779
797
  partyType: {
780
798
  type: PartyTypeEnum.NATURAL_PERSON,
799
+ origin: PartyOrigin.internal,
781
800
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
782
801
  name: 'example_name',
783
802
  },
@@ -828,6 +847,7 @@ describe('Contact store tests', (): void => {
828
847
  uri: 'example.com',
829
848
  partyType: {
830
849
  type: PartyTypeEnum.NATURAL_PERSON,
850
+ origin: PartyOrigin.internal,
831
851
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
832
852
  name: 'example_name',
833
853
  },
@@ -867,6 +887,7 @@ describe('Contact store tests', (): void => {
867
887
  uri: 'example.com',
868
888
  partyType: {
869
889
  type: PartyTypeEnum.NATURAL_PERSON,
890
+ origin: PartyOrigin.internal,
870
891
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
871
892
  name: 'example_name',
872
893
  },
@@ -900,6 +921,7 @@ describe('Contact store tests', (): void => {
900
921
  uri: 'example.com',
901
922
  partyType: {
902
923
  type: PartyTypeEnum.NATURAL_PERSON,
924
+ origin: PartyOrigin.internal,
903
925
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
904
926
  name: 'example_name',
905
927
  },
@@ -935,6 +957,7 @@ describe('Contact store tests', (): void => {
935
957
  uri: 'example.com',
936
958
  partyType: {
937
959
  type: PartyTypeEnum.NATURAL_PERSON,
960
+ origin: PartyOrigin.internal,
938
961
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
939
962
  name: 'example_name',
940
963
  },
@@ -972,6 +995,7 @@ describe('Contact store tests', (): void => {
972
995
  uri: 'example.com',
973
996
  partyType: {
974
997
  type: PartyTypeEnum.NATURAL_PERSON,
998
+ origin: PartyOrigin.internal,
975
999
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
976
1000
  name: 'example_name',
977
1001
  },
@@ -1022,6 +1046,7 @@ describe('Contact store tests', (): void => {
1022
1046
  uri: 'example1.com',
1023
1047
  partyType: {
1024
1048
  type: PartyTypeEnum.NATURAL_PERSON,
1049
+ origin: PartyOrigin.internal,
1025
1050
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1026
1051
  name: 'example_name1',
1027
1052
  },
@@ -1039,6 +1064,7 @@ describe('Contact store tests', (): void => {
1039
1064
  uri: 'example2.com',
1040
1065
  partyType: {
1041
1066
  type: PartyTypeEnum.NATURAL_PERSON,
1067
+ origin: PartyOrigin.external,
1042
1068
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
1043
1069
  name: 'example_name2',
1044
1070
  },
@@ -1071,6 +1097,7 @@ describe('Contact store tests', (): void => {
1071
1097
  uri: 'example1.com',
1072
1098
  partyType: {
1073
1099
  type: PartyTypeEnum.NATURAL_PERSON,
1100
+ origin: PartyOrigin.internal,
1074
1101
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1075
1102
  name: 'example_name1',
1076
1103
  },
@@ -1088,6 +1115,7 @@ describe('Contact store tests', (): void => {
1088
1115
  uri: 'example2.com',
1089
1116
  partyType: {
1090
1117
  type: PartyTypeEnum.NATURAL_PERSON,
1118
+ origin: PartyOrigin.internal,
1091
1119
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
1092
1120
  name: 'example_name2',
1093
1121
  },
@@ -1125,6 +1153,7 @@ describe('Contact store tests', (): void => {
1125
1153
  uri: 'example1.com',
1126
1154
  partyType: {
1127
1155
  type: PartyTypeEnum.NATURAL_PERSON,
1156
+ origin: PartyOrigin.internal,
1128
1157
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1129
1158
  name: 'example_name1',
1130
1159
  },
@@ -1142,6 +1171,7 @@ describe('Contact store tests', (): void => {
1142
1171
  uri: 'example2.com',
1143
1172
  partyType: {
1144
1173
  type: PartyTypeEnum.NATURAL_PERSON,
1174
+ origin: PartyOrigin.internal,
1145
1175
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
1146
1176
  name: 'example_name2',
1147
1177
  },
@@ -1178,6 +1208,7 @@ describe('Contact store tests', (): void => {
1178
1208
  uri: 'example1.com',
1179
1209
  partyType: {
1180
1210
  type: PartyTypeEnum.NATURAL_PERSON,
1211
+ origin: PartyOrigin.internal,
1181
1212
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1182
1213
  name: 'example_name1',
1183
1214
  },
@@ -1195,6 +1226,7 @@ describe('Contact store tests', (): void => {
1195
1226
  uri: 'example2.com',
1196
1227
  partyType: {
1197
1228
  type: PartyTypeEnum.NATURAL_PERSON,
1229
+ origin: PartyOrigin.internal,
1198
1230
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
1199
1231
  name: 'example_name2',
1200
1232
  },
@@ -1240,6 +1272,7 @@ describe('Contact store tests', (): void => {
1240
1272
  uri: 'example1.com',
1241
1273
  partyType: {
1242
1274
  type: PartyTypeEnum.NATURAL_PERSON,
1275
+ origin: PartyOrigin.internal,
1243
1276
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1244
1277
  name: 'example_name1',
1245
1278
  },
@@ -1257,6 +1290,7 @@ describe('Contact store tests', (): void => {
1257
1290
  uri: 'example2.com',
1258
1291
  partyType: {
1259
1292
  type: PartyTypeEnum.NATURAL_PERSON,
1293
+ origin: PartyOrigin.external,
1260
1294
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
1261
1295
  name: 'example_name2',
1262
1296
  },
@@ -1309,6 +1343,7 @@ describe('Contact store tests', (): void => {
1309
1343
  uri: 'example1.com',
1310
1344
  partyType: {
1311
1345
  type: PartyTypeEnum.NATURAL_PERSON,
1346
+ origin: PartyOrigin.internal,
1312
1347
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1313
1348
  name: 'example_name1',
1314
1349
  },
@@ -1326,6 +1361,7 @@ describe('Contact store tests', (): void => {
1326
1361
  uri: 'example2.com',
1327
1362
  partyType: {
1328
1363
  type: PartyTypeEnum.NATURAL_PERSON,
1364
+ origin: PartyOrigin.external,
1329
1365
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
1330
1366
  name: 'example_name2',
1331
1367
  },
@@ -1343,6 +1379,7 @@ describe('Contact store tests', (): void => {
1343
1379
  uri: 'example3.com',
1344
1380
  partyType: {
1345
1381
  type: PartyTypeEnum.NATURAL_PERSON,
1382
+ origin: PartyOrigin.internal,
1346
1383
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d287',
1347
1384
  name: 'example_name3',
1348
1385
  },
@@ -1382,6 +1419,7 @@ describe('Contact store tests', (): void => {
1382
1419
  uri: 'example1.com',
1383
1420
  partyType: {
1384
1421
  type: PartyTypeEnum.NATURAL_PERSON,
1422
+ origin: PartyOrigin.external,
1385
1423
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1386
1424
  name: 'example_name1',
1387
1425
  },
@@ -1399,6 +1437,7 @@ describe('Contact store tests', (): void => {
1399
1437
  uri: 'example2.com',
1400
1438
  partyType: {
1401
1439
  type: PartyTypeEnum.NATURAL_PERSON,
1440
+ origin: PartyOrigin.internal,
1402
1441
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
1403
1442
  name: 'example_name2',
1404
1443
  },
@@ -1435,6 +1474,7 @@ describe('Contact store tests', (): void => {
1435
1474
  uri: 'example1.com',
1436
1475
  partyType: {
1437
1476
  type: PartyTypeEnum.NATURAL_PERSON,
1477
+ origin: PartyOrigin.external,
1438
1478
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1439
1479
  name: 'example_name1',
1440
1480
  },
@@ -1452,6 +1492,7 @@ describe('Contact store tests', (): void => {
1452
1492
  uri: 'example2.com',
1453
1493
  partyType: {
1454
1494
  type: PartyTypeEnum.NATURAL_PERSON,
1495
+ origin: PartyOrigin.internal,
1455
1496
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
1456
1497
  name: 'example_name2',
1457
1498
  },
@@ -1487,6 +1528,7 @@ describe('Contact store tests', (): void => {
1487
1528
  uri: 'example1.com',
1488
1529
  partyType: {
1489
1530
  type: PartyTypeEnum.NATURAL_PERSON,
1531
+ origin: PartyOrigin.external,
1490
1532
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1491
1533
  name: 'example_name1',
1492
1534
  },
@@ -1504,6 +1546,7 @@ describe('Contact store tests', (): void => {
1504
1546
  uri: 'example2.com',
1505
1547
  partyType: {
1506
1548
  type: PartyTypeEnum.NATURAL_PERSON,
1549
+ origin: PartyOrigin.external,
1507
1550
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
1508
1551
  name: 'example_name2',
1509
1552
  },
@@ -1537,6 +1580,7 @@ describe('Contact store tests', (): void => {
1537
1580
  it('should add party type', async (): Promise<void> => {
1538
1581
  const partyType: NonPersistedPartyType = {
1539
1582
  type: PartyTypeEnum.NATURAL_PERSON,
1583
+ origin: PartyOrigin.external,
1540
1584
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
1541
1585
  name: 'example_name',
1542
1586
  description: 'example_description',
@@ -1548,6 +1592,7 @@ describe('Contact store tests', (): void => {
1548
1592
  expect(result).toBeDefined()
1549
1593
  expect(result.name).toEqual(partyType.name)
1550
1594
  expect(result.type).toEqual(partyType.type)
1595
+ expect(result.origin).toEqual(partyType.origin)
1551
1596
  expect(result.tenantId).toEqual(partyType.tenantId)
1552
1597
  expect(result.description).toEqual(partyType.description)
1553
1598
  expect(result.lastUpdatedAt).toBeDefined()
@@ -1557,6 +1602,7 @@ describe('Contact store tests', (): void => {
1557
1602
  it('should get party types by filter', async (): Promise<void> => {
1558
1603
  const partyType1: NonPersistedPartyType = {
1559
1604
  type: PartyTypeEnum.NATURAL_PERSON,
1605
+ origin: PartyOrigin.external,
1560
1606
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
1561
1607
  name: 'example_name1',
1562
1608
  description: 'example_description1',
@@ -1566,6 +1612,7 @@ describe('Contact store tests', (): void => {
1566
1612
 
1567
1613
  const partyType2: NonPersistedPartyType = {
1568
1614
  type: PartyTypeEnum.NATURAL_PERSON,
1615
+ origin: PartyOrigin.external,
1569
1616
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d287',
1570
1617
  name: 'example_name2',
1571
1618
  description: 'example_description2',
@@ -1590,6 +1637,7 @@ describe('Contact store tests', (): void => {
1590
1637
  it('should return no party types if filter does not match', async (): Promise<void> => {
1591
1638
  const partyType1: NonPersistedPartyType = {
1592
1639
  type: PartyTypeEnum.NATURAL_PERSON,
1640
+ origin: PartyOrigin.internal,
1593
1641
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
1594
1642
  name: 'example_name1',
1595
1643
  description: 'example_description1',
@@ -1599,6 +1647,7 @@ describe('Contact store tests', (): void => {
1599
1647
 
1600
1648
  const partyType2: NonPersistedPartyType = {
1601
1649
  type: PartyTypeEnum.NATURAL_PERSON,
1650
+ origin: PartyOrigin.internal,
1602
1651
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d287',
1603
1652
  name: 'example_name2',
1604
1653
  description: 'example_description2',
@@ -1623,6 +1672,7 @@ describe('Contact store tests', (): void => {
1623
1672
  it('should throw error when updating party type with unknown id', async (): Promise<void> => {
1624
1673
  const partyType: NonPersistedPartyType = {
1625
1674
  type: PartyTypeEnum.NATURAL_PERSON,
1675
+ origin: PartyOrigin.internal,
1626
1676
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
1627
1677
  name: 'example_name',
1628
1678
  description: 'example_description',
@@ -1643,6 +1693,7 @@ describe('Contact store tests', (): void => {
1643
1693
  it('should update party type by id', async (): Promise<void> => {
1644
1694
  const partyType: NonPersistedPartyType = {
1645
1695
  type: PartyTypeEnum.NATURAL_PERSON,
1696
+ origin: PartyOrigin.external,
1646
1697
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
1647
1698
  name: 'example_name',
1648
1699
  description: 'example_description',
@@ -1671,6 +1722,7 @@ describe('Contact store tests', (): void => {
1671
1722
  it('should remove party type', async (): Promise<void> => {
1672
1723
  const partyType: NonPersistedPartyType = {
1673
1724
  type: PartyTypeEnum.NATURAL_PERSON,
1725
+ origin: PartyOrigin.internal,
1674
1726
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d288',
1675
1727
  name: 'example_name',
1676
1728
  description: 'example_description',
@@ -1698,6 +1750,7 @@ describe('Contact store tests', (): void => {
1698
1750
  uri: 'example.com',
1699
1751
  partyType: {
1700
1752
  type: PartyTypeEnum.NATURAL_PERSON,
1753
+ origin: PartyOrigin.external,
1701
1754
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1702
1755
  name: 'example_name',
1703
1756
  },
@@ -1719,6 +1772,7 @@ describe('Contact store tests', (): void => {
1719
1772
  it('Should save party with existing party type', async (): Promise<void> => {
1720
1773
  const partyType: NonPersistedPartyType = {
1721
1774
  type: PartyTypeEnum.NATURAL_PERSON,
1775
+ origin: PartyOrigin.internal,
1722
1776
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1723
1777
  name: 'example_name',
1724
1778
  }
@@ -1742,16 +1796,19 @@ describe('Contact store tests', (): void => {
1742
1796
  expect(result?.partyType).toBeDefined()
1743
1797
  expect(result?.partyType.id).toEqual(savedPartyType.id)
1744
1798
  expect(result?.partyType.type).toEqual(savedPartyType.type)
1799
+ expect(result?.partyType.origin).toEqual(savedPartyType.origin)
1745
1800
  expect(result?.partyType.tenantId).toEqual(savedPartyType.tenantId)
1746
1801
  expect(result?.partyType.name).toEqual(savedPartyType.name)
1747
1802
  })
1748
1803
 
1749
1804
  it('should throw error when adding person party with wrong contact type', async (): Promise<void> => {
1750
1805
  const partyType = PartyTypeEnum.ORGANIZATION
1806
+ const partyTypeOrigin = PartyOrigin.internal
1751
1807
  const party: NonPersistedParty = {
1752
1808
  uri: 'example.com',
1753
1809
  partyType: {
1754
1810
  type: partyType,
1811
+ origin: partyTypeOrigin,
1755
1812
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1756
1813
  name: 'example_name',
1757
1814
  },
@@ -1768,10 +1825,12 @@ describe('Contact store tests', (): void => {
1768
1825
 
1769
1826
  it('should throw error when adding organization party with wrong contact type', async (): Promise<void> => {
1770
1827
  const partyType = PartyTypeEnum.NATURAL_PERSON
1828
+ const partyTypeOrigin = PartyOrigin.external
1771
1829
  const party: NonPersistedParty = {
1772
1830
  uri: 'example.com',
1773
1831
  partyType: {
1774
1832
  type: partyType,
1833
+ origin: partyTypeOrigin,
1775
1834
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1776
1835
  name: 'example_name',
1777
1836
  },
@@ -1789,6 +1848,7 @@ describe('Contact store tests', (): void => {
1789
1848
  uri: 'example.com',
1790
1849
  partyType: {
1791
1850
  type: PartyTypeEnum.NATURAL_PERSON,
1851
+ origin: PartyOrigin.internal,
1792
1852
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1793
1853
  name: 'example_name',
1794
1854
  },
@@ -1827,6 +1887,7 @@ describe('Contact store tests', (): void => {
1827
1887
  uri: 'example.com',
1828
1888
  partyType: {
1829
1889
  type: PartyTypeEnum.NATURAL_PERSON,
1890
+ origin: PartyOrigin.external,
1830
1891
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1831
1892
  name: 'example_name',
1832
1893
  },
@@ -1874,6 +1935,7 @@ describe('Contact store tests', (): void => {
1874
1935
  uri: 'example.com',
1875
1936
  partyType: {
1876
1937
  type: PartyTypeEnum.NATURAL_PERSON,
1938
+ origin: PartyOrigin.internal,
1877
1939
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1878
1940
  name: 'example_name',
1879
1941
  },
@@ -1917,6 +1979,7 @@ describe('Contact store tests', (): void => {
1917
1979
  uri: 'example.com',
1918
1980
  partyType: {
1919
1981
  type: PartyTypeEnum.NATURAL_PERSON,
1982
+ origin: PartyOrigin.external,
1920
1983
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1921
1984
  name: 'example_name',
1922
1985
  },
@@ -1965,6 +2028,7 @@ describe('Contact store tests', (): void => {
1965
2028
  uri: 'example.com',
1966
2029
  partyType: {
1967
2030
  type: PartyTypeEnum.NATURAL_PERSON,
2031
+ origin: PartyOrigin.internal,
1968
2032
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1969
2033
  name: 'example_name',
1970
2034
  },
@@ -1994,6 +2058,7 @@ describe('Contact store tests', (): void => {
1994
2058
  uri: 'example.com',
1995
2059
  partyType: {
1996
2060
  type: PartyTypeEnum.NATURAL_PERSON,
2061
+ origin: PartyOrigin.external,
1997
2062
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
1998
2063
  name: 'example_name',
1999
2064
  },
@@ -2027,6 +2092,7 @@ describe('Contact store tests', (): void => {
2027
2092
  uri: 'example.com',
2028
2093
  partyType: {
2029
2094
  type: PartyTypeEnum.NATURAL_PERSON,
2095
+ origin: PartyOrigin.internal,
2030
2096
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
2031
2097
  name: 'example_name',
2032
2098
  },
@@ -2067,6 +2133,7 @@ describe('Contact store tests', (): void => {
2067
2133
  uri: 'example.com',
2068
2134
  partyType: {
2069
2135
  type: PartyTypeEnum.NATURAL_PERSON,
2136
+ origin: PartyOrigin.external,
2070
2137
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
2071
2138
  name: 'example_name',
2072
2139
  },
@@ -2109,6 +2176,7 @@ describe('Contact store tests', (): void => {
2109
2176
  uri: 'example.com',
2110
2177
  partyType: {
2111
2178
  type: PartyTypeEnum.NATURAL_PERSON,
2179
+ origin: PartyOrigin.internal,
2112
2180
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
2113
2181
  name: 'example_name',
2114
2182
  },
@@ -2168,6 +2236,7 @@ describe('Contact store tests', (): void => {
2168
2236
  uri: 'example.com',
2169
2237
  partyType: {
2170
2238
  type: PartyTypeEnum.NATURAL_PERSON,
2239
+ origin: PartyOrigin.external,
2171
2240
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
2172
2241
  name: 'example_name',
2173
2242
  },
@@ -2223,6 +2292,7 @@ describe('Contact store tests', (): void => {
2223
2292
  uri: 'example.com',
2224
2293
  partyType: {
2225
2294
  type: PartyTypeEnum.NATURAL_PERSON,
2295
+ origin: PartyOrigin.internal,
2226
2296
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
2227
2297
  name: 'example_name',
2228
2298
  },
@@ -2283,6 +2353,7 @@ describe('Contact store tests', (): void => {
2283
2353
  uri: 'example.com',
2284
2354
  partyType: {
2285
2355
  type: PartyTypeEnum.NATURAL_PERSON,
2356
+ origin: PartyOrigin.external,
2286
2357
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
2287
2358
  name: 'example_name',
2288
2359
  },
@@ -2318,6 +2389,7 @@ describe('Contact store tests', (): void => {
2318
2389
  uri: 'example.com',
2319
2390
  partyType: {
2320
2391
  type: PartyTypeEnum.NATURAL_PERSON,
2392
+ origin: PartyOrigin.internal,
2321
2393
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
2322
2394
  name: 'example_name',
2323
2395
  },
@@ -2357,6 +2429,7 @@ describe('Contact store tests', (): void => {
2357
2429
  uri: 'example.com',
2358
2430
  partyType: {
2359
2431
  type: PartyTypeEnum.NATURAL_PERSON,
2432
+ origin: PartyOrigin.external,
2360
2433
  tenantId: '0605761c-4113-4ce5-a6b2-9cbae2f9d289',
2361
2434
  name: 'example_name',
2362
2435
  },
@@ -1,6 +1,6 @@
1
- import { Entity, PrimaryGeneratedColumn, Column, Index, CreateDateColumn, UpdateDateColumn, OneToMany, BeforeInsert, BeforeUpdate } from 'typeorm'
1
+ import { BeforeInsert, BeforeUpdate, Column, CreateDateColumn, Entity, Index, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
2
2
  import { PartyEntity } from './PartyEntity'
3
- import { PartyTypeEnum, ValidationConstraint } from '../../types'
3
+ import { PartyOrigin, PartyTypeEnum, ValidationConstraint } from '../../types'
4
4
  import { IsNotEmpty, Validate, validate, ValidationError } from 'class-validator'
5
5
  import { IsNonEmptyStringConstraint } from '../validators'
6
6
  import { getConstraint } from '../../utils/ValidatorUtils'
@@ -14,6 +14,9 @@ export class PartyTypeEntity {
14
14
  @Column('simple-enum', { name: 'type', enum: PartyTypeEnum, nullable: false, unique: false })
15
15
  type!: PartyTypeEnum
16
16
 
17
+ @Column('simple-enum', { name: 'origin', enum: PartyOrigin, default: 'external', nullable: false, unique: false })
18
+ origin!: PartyOrigin
19
+
17
20
  @Column({ name: 'name', length: 255, nullable: false, unique: true })
18
21
  @IsNotEmpty({ message: 'Blank names are not allowed' })
19
22
  name!: string
@@ -9,11 +9,11 @@ export class ImageAttributesEntity extends BaseEntity {
9
9
  @PrimaryGeneratedColumn('uuid')
10
10
  id!: string
11
11
 
12
- @Column({ name: 'uri', length: 255, nullable: true, unique: false })
12
+ @Column({ name: 'uri', nullable: true, unique: false })
13
13
  @Validate(IsNonEmptyStringConstraint, { message: 'Blank image uri are not allowed' })
14
14
  uri?: string
15
15
 
16
- @Column({ name: 'dataUri', length: 255, nullable: true, unique: false })
16
+ @Column({ name: 'dataUri', nullable: true, unique: false })
17
17
  @Validate(IsNonEmptyStringConstraint, { message: 'Blank image data uri are not allowed' })
18
18
  dataUri?: string
19
19
 
@@ -42,24 +42,6 @@ export class CreateContacts1659463079428 implements MigrationInterface {
42
42
  await queryRunner.query(
43
43
  `ALTER TABLE "Connection" ADD CONSTRAINT "FK_Connection_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
44
44
  )
45
-
46
- await queryRunner.query(`
47
- CREATE TABLE "PhysicalAddress" (
48
- "id" text PRIMARY KEY NOT NULL,
49
- "type" varchar(255) NOT NULL,
50
- "street_name" varchar(255) NOT NULL,
51
- "street_number" varchar(255) NOT NULL,
52
- "postal_code" varchar(255) NOT NULL,
53
- "city_name" varchar(255) NOT NULL,
54
- "province_name" varchar(255) NOT NULL,
55
- "country_code" varchar(2) NOT NULL,
56
- "building_name" varchar(255),
57
- "partyId" uuid,
58
- "created_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
59
- "last_updated_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
60
- CONSTRAINT "FK_PhysicalAddressEntity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE
61
- );`
62
- );
63
45
  }
64
46
 
65
47
  public async down(queryRunner: QueryRunner): Promise<void> {
@@ -10,7 +10,7 @@ export class CreateIssuanceBranding1685628974232 implements MigrationInterface {
10
10
  `CREATE TABLE "ImageDimensions" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "width" integer NOT NULL, "height" integer NOT NULL, CONSTRAINT "PK_ImageDimensions_id" PRIMARY KEY ("id"))`,
11
11
  )
12
12
  await queryRunner.query(
13
- `CREATE TABLE "ImageAttributes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "uri" character varying(255), "dataUri" character varying(255), "mediaType" character varying(255), "alt" character varying(255), "dimensionsId" uuid, CONSTRAINT "UQ_dimensionsId" UNIQUE ("dimensionsId"), CONSTRAINT "PK_ImageAttributes_id" PRIMARY KEY ("id"))`,
13
+ `CREATE TABLE "ImageAttributes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "uri" character varying, "dataUri" character varying, "mediaType" character varying(255), "alt" character varying(255), "dimensionsId" uuid, CONSTRAINT "UQ_dimensionsId" UNIQUE ("dimensionsId"), CONSTRAINT "PK_ImageAttributes_id" PRIMARY KEY ("id"))`,
14
14
  )
15
15
  await queryRunner.query(
16
16
  `CREATE TABLE "BackgroundAttributes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "color" character varying(255), "imageId" uuid, CONSTRAINT "UQ_imageId" UNIQUE ("imageId"), CONSTRAINT "PK_BackgroundAttributes_id" PRIMARY KEY ("id"))`,
@@ -13,8 +13,9 @@ export class CreateContacts1690925872592 implements MigrationInterface {
13
13
  await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME COLUMN "identityId" TO "identity_id"`)
14
14
  await queryRunner.query(`ALTER TABLE "Connection" RENAME COLUMN "identityId" TO "identity_id"`)
15
15
  await queryRunner.query(`CREATE TYPE "public"."PartyType_type_enum" AS ENUM('naturalPerson', 'organization')`)
16
+ await queryRunner.query(`CREATE TYPE "public"."PartyOrigin_type_enum" AS ENUM('internal', 'external')`)
16
17
  await queryRunner.query(
17
- `CREATE TABLE "PartyType" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" "public"."PartyType_type_enum" NOT NULL, "name" character varying(255) NOT NULL, "description" character varying(255), "tenant_id" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_PartyType_name" UNIQUE ("name"), CONSTRAINT "PK_PartyType_id" PRIMARY KEY ("id"))`,
18
+ `CREATE TABLE "PartyType" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" "public"."PartyType_type_enum" NOT NULL, "origin" "public"."PartyOrigin_type_enum" NOT NULL DEFAULT 'external', "name" character varying(255) NOT NULL, "description" character varying(255), "tenant_id" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_PartyType_name" UNIQUE ("name"), CONSTRAINT "PK_PartyType_id" PRIMARY KEY ("id"))`,
18
19
  )
19
20
  await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyType_type_tenant_id" ON "PartyType" ("type", "tenant_id")`)
20
21
  await queryRunner.query(
@@ -29,7 +30,10 @@ export class CreateContacts1690925872592 implements MigrationInterface {
29
30
  `CREATE TABLE "ElectronicAddress" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" character varying(255) NOT NULL, "electronic_address" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "partyId" uuid, CONSTRAINT "PK_ElectronicAddress_id" PRIMARY KEY ("id"))`,
30
31
  )
31
32
  await queryRunner.query(
32
- `CREATE TABLE "Party" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "uri" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "party_type_id" uuid NOT NULL, CONSTRAINT "PK_Party_id" PRIMARY KEY ("id"))`,
33
+ `CREATE TABLE "PhysicalAddress" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" character varying(255) NOT NULL, "street_name" character varying(255) NOT NULL, "street_number" character varying(255) NOT NULL, "postal_code" character varying(255) NOT NULL, "city_name" character varying(255) NOT NULL, "province_name" character varying(255) NOT NULL, "country_code" character varying(2) NOT NULL, "building_name" character varying(255), "partyId" uuid, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_PhysicalAddress_id" PRIMARY KEY ("id"))`
34
+ );
35
+ await queryRunner.query(
36
+ `CREATE TABLE "Party" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "uri" character varying(255), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "party_type_id" uuid NOT NULL, CONSTRAINT "PK_Party_id" PRIMARY KEY ("id"))`,
33
37
  )
34
38
  await queryRunner.query(
35
39
  `CREATE TABLE "BaseConfig" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "identifier" character varying(255), "redirect_url" character varying(255), "session_id" character varying(255), "client_id" character varying(255), "client_secret" character varying(255), "scopes" text, "issuer" character varying(255), "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "type" character varying NOT NULL, "connection_id" uuid, CONSTRAINT "REL_BaseConfig_connection_id" UNIQUE ("connection_id"), CONSTRAINT "PK_BaseConfig_id" PRIMARY KEY ("id"))`,
@@ -55,6 +59,9 @@ export class CreateContacts1690925872592 implements MigrationInterface {
55
59
  await queryRunner.query(
56
60
  `ALTER TABLE "ElectronicAddress" ADD CONSTRAINT "FK_ElectronicAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
57
61
  )
62
+ await queryRunner.query(
63
+ `ALTER TABLE "PhysicalAddress" ADD CONSTRAINT "FK_PhysicalAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
64
+ )
58
65
  await queryRunner.query(
59
66
  `ALTER TABLE "Party" ADD CONSTRAINT "FK_Party_party_type_id" FOREIGN KEY ("party_type_id") REFERENCES "PartyType"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
60
67
  )