@sphereon/ssi-sdk.data-store 0.18.2-next.9 → 0.18.2-unstable.13
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.
- package/LICENSE +201 -201
- package/README.md +77 -77
- package/dist/contact/AbstractContactStore.d.ts +23 -23
- package/dist/contact/AbstractContactStore.js +6 -6
- package/dist/contact/ContactStore.d.ts +32 -32
- package/dist/contact/ContactStore.js +365 -365
- package/dist/entities/contact/BaseConfigEntity.d.ts +6 -6
- package/dist/entities/contact/BaseConfigEntity.js +33 -33
- package/dist/entities/contact/BaseContactEntity.d.ts +9 -9
- package/dist/entities/contact/BaseContactEntity.js +53 -53
- package/dist/entities/contact/ConnectionEntity.d.ts +10 -10
- package/dist/entities/contact/ConnectionEntity.js +46 -46
- package/dist/entities/contact/ContactEntity.d.ts +16 -0
- package/dist/entities/contact/ContactEntity.d.ts.map +1 -0
- package/dist/entities/contact/ContactEntity.js +164 -0
- package/dist/entities/contact/ContactEntity.js.map +1 -0
- package/dist/entities/contact/CorrelationIdentifierEntity.d.ts +10 -10
- package/dist/entities/contact/CorrelationIdentifierEntity.js +71 -71
- package/dist/entities/contact/DidAuthConfigEntity.d.ts +6 -6
- package/dist/entities/contact/DidAuthConfigEntity.js +32 -32
- package/dist/entities/contact/ElectronicAddressEntity.d.ts +13 -13
- package/dist/entities/contact/ElectronicAddressEntity.js +91 -91
- package/dist/entities/contact/IdentityEntity.d.ts +20 -20
- package/dist/entities/contact/IdentityEntity.js +128 -128
- package/dist/entities/contact/IdentityMetadataItemEntity.d.ts +9 -9
- package/dist/entities/contact/IdentityMetadataItemEntity.js +68 -68
- package/dist/entities/contact/NaturalPersonEntity.d.ts +8 -8
- package/dist/entities/contact/NaturalPersonEntity.js +71 -71
- package/dist/entities/contact/OpenIdConfigEntity.d.ts +10 -10
- package/dist/entities/contact/OpenIdConfigEntity.js +48 -48
- package/dist/entities/contact/OrganizationEntity.d.ts +8 -8
- package/dist/entities/contact/OrganizationEntity.js +66 -66
- package/dist/entities/contact/PartyEntity.d.ts +19 -19
- package/dist/entities/contact/PartyEntity.js +131 -131
- package/dist/entities/contact/PartyRelationshipEntity.d.ts +12 -12
- package/dist/entities/contact/PartyRelationshipEntity.js +94 -94
- package/dist/entities/contact/PartyTypeEntity.d.ts +14 -14
- package/dist/entities/contact/PartyTypeEntity.js +103 -103
- package/dist/entities/eventLogger/AuditEventEntity.d.ts +26 -26
- package/dist/entities/eventLogger/AuditEventEntity.js +123 -123
- package/dist/entities/eventLogger/AuditEventEntity.js.map +1 -1
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.d.ts +10 -10
- package/dist/entities/issuanceBranding/BackgroundAttributesEntity.js +73 -73
- package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.d.ts +17 -17
- package/dist/entities/issuanceBranding/BaseLocaleBrandingEntity.js +119 -119
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.d.ts +14 -14
- package/dist/entities/issuanceBranding/CredentialBrandingEntity.js +101 -101
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.d.ts +8 -8
- package/dist/entities/issuanceBranding/CredentialLocaleBrandingEntity.js +48 -48
- package/dist/entities/issuanceBranding/ImageAttributesEntity.d.ts +13 -13
- package/dist/entities/issuanceBranding/ImageAttributesEntity.js +91 -91
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.d.ts +8 -8
- package/dist/entities/issuanceBranding/ImageDimensionsEntity.js +38 -38
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.d.ts +13 -13
- package/dist/entities/issuanceBranding/IssuerBrandingEntity.js +94 -94
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.d.ts +8 -8
- package/dist/entities/issuanceBranding/IssuerLocaleBrandingEntity.js +48 -48
- package/dist/entities/issuanceBranding/TextAttributesEntity.d.ts +8 -8
- package/dist/entities/issuanceBranding/TextAttributesEntity.js +61 -61
- package/dist/entities/statusList2021/StatusList2021Entity.d.ts +18 -18
- package/dist/entities/statusList2021/StatusList2021Entity.js +114 -114
- package/dist/entities/statusList2021/StatusList2021EntryEntity.d.ts +10 -10
- package/dist/entities/statusList2021/StatusList2021EntryEntity.js +50 -50
- package/dist/entities/validators/index.d.ts +6 -6
- package/dist/entities/validators/index.js +26 -26
- package/dist/eventLogger/AbstractEventLoggerStore.d.ts +6 -6
- package/dist/eventLogger/AbstractEventLoggerStore.js +6 -6
- package/dist/eventLogger/EventLoggerStore.d.ts +12 -12
- package/dist/eventLogger/EventLoggerStore.js +43 -43
- package/dist/index.d.ts +41 -41
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +127 -131
- package/dist/index.js.map +1 -1
- package/dist/issuanceBranding/AbstractIssuanceBrandingStore.d.ts +19 -19
- package/dist/issuanceBranding/AbstractIssuanceBrandingStore.js +6 -6
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts +30 -30
- package/dist/issuanceBranding/IssuanceBrandingStore.js +374 -374
- package/dist/migrations/generic/1-CreateContacts.d.ts +6 -6
- package/dist/migrations/generic/1-CreateContacts.js +77 -77
- package/dist/migrations/generic/1-CreateIssuanceBranding.d.ts +7 -0
- package/dist/migrations/generic/1-CreateIssuanceBranding.d.ts.map +1 -0
- package/dist/migrations/generic/1-CreateIssuanceBranding.js +96 -0
- package/dist/migrations/generic/1-CreateIssuanceBranding.js.map +1 -0
- package/dist/migrations/generic/2-CreateContacts.d.ts +7 -0
- package/dist/migrations/generic/2-CreateContacts.d.ts.map +1 -0
- package/dist/migrations/generic/2-CreateContacts.js +78 -0
- package/dist/migrations/generic/2-CreateContacts.js.map +1 -0
- package/dist/migrations/generic/2-CreateIssuanceBranding.d.ts +6 -6
- package/dist/migrations/generic/2-CreateIssuanceBranding.js +77 -77
- package/dist/migrations/generic/3-CreateContacts.d.ts +6 -6
- package/dist/migrations/generic/3-CreateContacts.js +77 -77
- package/dist/migrations/generic/3-CreateStatusList.d.ts +7 -0
- package/dist/migrations/generic/3-CreateStatusList.d.ts.map +1 -0
- package/dist/migrations/generic/3-CreateStatusList.js +72 -0
- package/dist/migrations/generic/3-CreateStatusList.js.map +1 -0
- package/dist/migrations/generic/4-CreateStatusList.d.ts +6 -6
- package/dist/migrations/generic/4-CreateStatusList.js +71 -71
- package/dist/migrations/generic/5-CreateAuditEvents.d.ts +6 -6
- package/dist/migrations/generic/5-CreateAuditEvents.js +77 -77
- package/dist/migrations/generic/index.d.ts +16 -16
- package/dist/migrations/generic/index.js +27 -27
- package/dist/migrations/index.d.ts +1 -1
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +5 -9
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/internal-migrations-ormconfig.d.ts +6 -6
- package/dist/migrations/internal-migrations-ormconfig.js +26 -26
- package/dist/migrations/postgres/1659463079428-CreateContacts.d.ts +6 -6
- package/dist/migrations/postgres/1659463079428-CreateContacts.js +56 -56
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.d.ts +6 -6
- package/dist/migrations/postgres/1685628974232-CreateIssuanceBranding.js +68 -68
- package/dist/migrations/postgres/1690925872592-CreateContacts.d.ts +6 -6
- package/dist/migrations/postgres/1690925872592-CreateContacts.js +68 -68
- package/dist/migrations/postgres/1693866470001-CreateStatusList.d.ts +6 -6
- package/dist/migrations/postgres/1693866470001-CreateStatusList.js +31 -31
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.d.ts +6 -6
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js +42 -42
- package/dist/migrations/postgres/1701634812183-CreateAuditEvents.js.map +1 -1
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.d.ts +7 -0
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.d.ts.map +1 -0
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.js +32 -0
- package/dist/migrations/postgres/CreateStatusList1693866470001-CreateStatusList.js.map +1 -0
- package/dist/migrations/postgres/uuid.d.ts +3 -0
- package/dist/migrations/postgres/uuid.d.ts.map +1 -0
- package/dist/migrations/postgres/uuid.js +25 -0
- package/dist/migrations/postgres/uuid.js.map +1 -0
- package/dist/migrations/sqlite/1659463069549-CreateContacts.d.ts +6 -6
- package/dist/migrations/sqlite/1659463069549-CreateContacts.js +78 -78
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.d.ts +6 -6
- package/dist/migrations/sqlite/1685628973231-CreateIssuanceBranding.js +88 -88
- package/dist/migrations/sqlite/1690925872693-CreateContacts.d.ts +6 -6
- package/dist/migrations/sqlite/1690925872693-CreateContacts.js +107 -107
- package/dist/migrations/sqlite/1693866470000-CreateStatusList.d.ts +6 -6
- package/dist/migrations/sqlite/1693866470000-CreateStatusList.js +31 -31
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.d.ts +6 -6
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js +28 -28
- package/dist/migrations/sqlite/1701634819487-CreateAuditEvents.js.map +1 -1
- package/dist/statusList/IStatusListStore.d.ts +19 -19
- package/dist/statusList/IStatusListStore.js +2 -2
- package/dist/statusList/StatusListStore.d.ts +35 -35
- package/dist/statusList/StatusListStore.js +212 -212
- package/dist/types/contact/IAbstractContactStore.d.ts +74 -74
- package/dist/types/contact/IAbstractContactStore.js +2 -2
- package/dist/types/contact/contact.d.ts +173 -173
- package/dist/types/contact/contact.js +25 -25
- package/dist/types/eventLogger/IAbstractEventLoggerStore.d.ts +9 -9
- package/dist/types/eventLogger/IAbstractEventLoggerStore.js +2 -2
- package/dist/types/eventLogger/eventLogger.d.ts +2 -2
- package/dist/types/eventLogger/eventLogger.js +2 -2
- package/dist/types/index.d.ts +9 -9
- package/dist/types/index.js +25 -25
- package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.d.ts +58 -58
- package/dist/types/issuanceBranding/IAbstractIssuanceBrandingStore.js +2 -2
- package/dist/types/issuanceBranding/issuanceBranding.d.ts +114 -114
- package/dist/types/issuanceBranding/issuanceBranding.js +2 -2
- package/dist/types/statusList/IAbstractStatusListStore.d.ts +37 -37
- package/dist/types/statusList/IAbstractStatusListStore.js +2 -2
- package/dist/types/statusList/statusList.d.ts +24 -24
- package/dist/types/statusList/statusList.js +2 -2
- package/dist/types/validation/validation.d.ts +3 -3
- package/dist/types/validation/validation.js +2 -2
- package/dist/utils/ValidatorUtils.d.ts +3 -3
- package/dist/utils/ValidatorUtils.js +12 -12
- package/dist/utils/contact/MappingUtils.d.ts +46 -46
- package/dist/utils/contact/MappingUtils.js +290 -290
- package/package.json +4 -4
- package/src/__tests__/eventLogger.entities.test.ts +73 -73
- package/src/__tests__/eventLogger.store.test.ts +136 -136
- package/src/contact/ContactStore.ts +501 -501
- package/src/entities/eventLogger/AuditEventEntity.ts +99 -99
- package/src/entities/statusList2021/StatusList2021Entity.ts +96 -96
- package/src/eventLogger/AbstractEventLoggerStore.ts +7 -7
- package/src/eventLogger/EventLoggerStore.ts +62 -62
- package/src/index.ts +113 -119
- package/src/migrations/generic/1-CreateContacts.ts +66 -66
- package/src/migrations/generic/2-CreateIssuanceBranding.ts +64 -64
- package/src/migrations/generic/3-CreateContacts.ts +66 -66
- package/src/migrations/generic/4-CreateStatusList.ts +54 -54
- package/src/migrations/generic/5-CreateAuditEvents.ts +66 -66
- package/src/migrations/generic/index.ts +27 -27
- package/src/migrations/index.ts +1 -7
- package/src/migrations/postgres/1693866470001-CreateStatusList.ts +24 -24
- package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +33 -33
- package/src/migrations/sqlite/1690925872693-CreateContacts.ts +163 -163
- package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +15 -15
- package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -12
- package/src/types/eventLogger/eventLogger.ts +3 -3
- package/src/types/index.ts +9 -9
|
@@ -1,291 +1,291 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isDidAuthConfig = exports.isOpenIdConfig = exports.didAuthConfigFrom = exports.openIdConfigFrom = exports.configFrom = exports.partyTypeFrom = exports.partyTypeEntityFrom = exports.partyRelationshipFrom = exports.partyRelationshipEntityFrom = exports.organizationFrom = exports.organizationEntityFrom = exports.openIdConfigEntityFrom = exports.naturalPersonFrom = exports.naturalPersonEntityFrom = exports.metadataItemFrom = exports.metadataItemEntityFrom = exports.identityFrom = exports.identityEntityFrom = exports.electronicAddressFrom = exports.electronicAddressEntityFrom = exports.didAuthConfigEntityFrom = exports.correlationIdentifierFrom = exports.correlationIdentifierEntityFrom = exports.connectionFrom = exports.connectionEntityFrom = exports.isOrganization = exports.isNaturalPerson = exports.contactFrom = exports.contactEntityFrom = exports.partyFrom = exports.partyEntityFrom = void 0;
|
|
4
|
-
const PartyEntity_1 = require("../../entities/contact/PartyEntity");
|
|
5
|
-
const IdentityEntity_1 = require("../../entities/contact/IdentityEntity");
|
|
6
|
-
const ElectronicAddressEntity_1 = require("../../entities/contact/ElectronicAddressEntity");
|
|
7
|
-
const PartyRelationshipEntity_1 = require("../../entities/contact/PartyRelationshipEntity");
|
|
8
|
-
const NaturalPersonEntity_1 = require("../../entities/contact/NaturalPersonEntity");
|
|
9
|
-
const OrganizationEntity_1 = require("../../entities/contact/OrganizationEntity");
|
|
10
|
-
const ConnectionEntity_1 = require("../../entities/contact/ConnectionEntity");
|
|
11
|
-
const CorrelationIdentifierEntity_1 = require("../../entities/contact/CorrelationIdentifierEntity");
|
|
12
|
-
const DidAuthConfigEntity_1 = require("../../entities/contact/DidAuthConfigEntity");
|
|
13
|
-
const IdentityMetadataItemEntity_1 = require("../../entities/contact/IdentityMetadataItemEntity");
|
|
14
|
-
const OpenIdConfigEntity_1 = require("../../entities/contact/OpenIdConfigEntity");
|
|
15
|
-
const PartyTypeEntity_1 = require("../../entities/contact/PartyTypeEntity");
|
|
16
|
-
const partyEntityFrom = (party) => {
|
|
17
|
-
const partyEntity = new PartyEntity_1.PartyEntity();
|
|
18
|
-
partyEntity.uri = party.uri;
|
|
19
|
-
partyEntity.identities = party.identities ? party.identities.map((identity) => (0, exports.identityEntityFrom)(identity)) : [];
|
|
20
|
-
partyEntity.electronicAddresses = party.electronicAddresses
|
|
21
|
-
? party.electronicAddresses.map((electronicAddress) => (0, exports.electronicAddressEntityFrom)(electronicAddress))
|
|
22
|
-
: [];
|
|
23
|
-
partyEntity.partyType = (0, exports.partyTypeEntityFrom)(party.partyType);
|
|
24
|
-
partyEntity.contact = (0, exports.contactEntityFrom)(party.contact);
|
|
25
|
-
return partyEntity;
|
|
26
|
-
};
|
|
27
|
-
exports.partyEntityFrom = partyEntityFrom;
|
|
28
|
-
const partyFrom = (party) => {
|
|
29
|
-
var _a, _b;
|
|
30
|
-
return {
|
|
31
|
-
id: party.id,
|
|
32
|
-
uri: party.uri,
|
|
33
|
-
roles: (_b = [...new Set((_a = party.identities) === null || _a === void 0 ? void 0 : _a.flatMap((identity) => identity.roles))]) !== null && _b !== void 0 ? _b : [],
|
|
34
|
-
identities: party.identities ? party.identities.map((identity) => (0, exports.identityFrom)(identity)) : [],
|
|
35
|
-
electronicAddresses: party.electronicAddresses
|
|
36
|
-
? party.electronicAddresses.map((electronicAddress) => (0, exports.electronicAddressFrom)(electronicAddress))
|
|
37
|
-
: [],
|
|
38
|
-
relationships: party.relationships ? party.relationships.map((relationship) => (0, exports.partyRelationshipFrom)(relationship)) : [],
|
|
39
|
-
partyType: (0, exports.partyTypeFrom)(party.partyType),
|
|
40
|
-
contact: (0, exports.contactFrom)(party.contact),
|
|
41
|
-
createdAt: party.createdAt,
|
|
42
|
-
lastUpdatedAt: party.lastUpdatedAt,
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
exports.partyFrom = partyFrom;
|
|
46
|
-
const contactEntityFrom = (contact) => {
|
|
47
|
-
if ((0, exports.isNaturalPerson)(contact)) {
|
|
48
|
-
return (0, exports.naturalPersonEntityFrom)(contact);
|
|
49
|
-
}
|
|
50
|
-
else if ((0, exports.isOrganization)(contact)) {
|
|
51
|
-
return (0, exports.organizationEntityFrom)(contact);
|
|
52
|
-
}
|
|
53
|
-
throw new Error('Contact not supported');
|
|
54
|
-
};
|
|
55
|
-
exports.contactEntityFrom = contactEntityFrom;
|
|
56
|
-
const contactFrom = (contact) => {
|
|
57
|
-
if ((0, exports.isNaturalPerson)(contact)) {
|
|
58
|
-
return (0, exports.naturalPersonFrom)(contact);
|
|
59
|
-
}
|
|
60
|
-
else if ((0, exports.isOrganization)(contact)) {
|
|
61
|
-
return (0, exports.organizationFrom)(contact);
|
|
62
|
-
}
|
|
63
|
-
throw new Error('Contact not supported');
|
|
64
|
-
};
|
|
65
|
-
exports.contactFrom = contactFrom;
|
|
66
|
-
const isNaturalPerson = (contact) => 'firstName' in contact && 'lastName' in contact;
|
|
67
|
-
exports.isNaturalPerson = isNaturalPerson;
|
|
68
|
-
const isOrganization = (contact) => 'legalName' in contact;
|
|
69
|
-
exports.isOrganization = isOrganization;
|
|
70
|
-
const connectionEntityFrom = (connection) => {
|
|
71
|
-
const connectionEntity = new ConnectionEntity_1.ConnectionEntity();
|
|
72
|
-
connectionEntity.type = connection.type;
|
|
73
|
-
connectionEntity.config = configEntityFrom(connection.config);
|
|
74
|
-
return connectionEntity;
|
|
75
|
-
};
|
|
76
|
-
exports.connectionEntityFrom = connectionEntityFrom;
|
|
77
|
-
const connectionFrom = (connection) => {
|
|
78
|
-
return {
|
|
79
|
-
id: connection.id,
|
|
80
|
-
type: connection.type,
|
|
81
|
-
config: (0, exports.configFrom)(connection.config),
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
exports.connectionFrom = connectionFrom;
|
|
85
|
-
const configEntityFrom = (config) => {
|
|
86
|
-
if ((0, exports.isOpenIdConfig)(config)) {
|
|
87
|
-
return (0, exports.openIdConfigEntityFrom)(config);
|
|
88
|
-
}
|
|
89
|
-
else if ((0, exports.isDidAuthConfig)(config)) {
|
|
90
|
-
return (0, exports.didAuthConfigEntityFrom)(config);
|
|
91
|
-
}
|
|
92
|
-
throw new Error('config type not supported');
|
|
93
|
-
};
|
|
94
|
-
const correlationIdentifierEntityFrom = (identifier) => {
|
|
95
|
-
const identifierEntity = new CorrelationIdentifierEntity_1.CorrelationIdentifierEntity();
|
|
96
|
-
identifierEntity.type = identifier.type;
|
|
97
|
-
identifierEntity.correlationId = identifier.correlationId;
|
|
98
|
-
return identifierEntity;
|
|
99
|
-
};
|
|
100
|
-
exports.correlationIdentifierEntityFrom = correlationIdentifierEntityFrom;
|
|
101
|
-
const correlationIdentifierFrom = (identifier) => {
|
|
102
|
-
return {
|
|
103
|
-
id: identifier.id,
|
|
104
|
-
type: identifier.type,
|
|
105
|
-
correlationId: identifier.correlationId,
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
exports.correlationIdentifierFrom = correlationIdentifierFrom;
|
|
109
|
-
const didAuthConfigEntityFrom = (config) => {
|
|
110
|
-
const didAuthConfig = new DidAuthConfigEntity_1.DidAuthConfigEntity();
|
|
111
|
-
didAuthConfig.identifier = config.identifier.did;
|
|
112
|
-
didAuthConfig.redirectUrl = config.redirectUrl;
|
|
113
|
-
didAuthConfig.sessionId = config.sessionId;
|
|
114
|
-
return didAuthConfig;
|
|
115
|
-
};
|
|
116
|
-
exports.didAuthConfigEntityFrom = didAuthConfigEntityFrom;
|
|
117
|
-
const electronicAddressEntityFrom = (electronicAddress) => {
|
|
118
|
-
const electronicAddressEntity = new ElectronicAddressEntity_1.ElectronicAddressEntity();
|
|
119
|
-
electronicAddressEntity.type = electronicAddress.type;
|
|
120
|
-
electronicAddressEntity.electronicAddress = electronicAddress.electronicAddress;
|
|
121
|
-
return electronicAddressEntity;
|
|
122
|
-
};
|
|
123
|
-
exports.electronicAddressEntityFrom = electronicAddressEntityFrom;
|
|
124
|
-
const electronicAddressFrom = (electronicAddress) => {
|
|
125
|
-
return {
|
|
126
|
-
id: electronicAddress.id,
|
|
127
|
-
type: electronicAddress.type,
|
|
128
|
-
electronicAddress: electronicAddress.electronicAddress,
|
|
129
|
-
createdAt: electronicAddress.createdAt,
|
|
130
|
-
lastUpdatedAt: electronicAddress.lastUpdatedAt,
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
exports.electronicAddressFrom = electronicAddressFrom;
|
|
134
|
-
const identityEntityFrom = (args) => {
|
|
135
|
-
const identityEntity = new IdentityEntity_1.IdentityEntity();
|
|
136
|
-
identityEntity.alias = args.alias;
|
|
137
|
-
identityEntity.roles = args.roles;
|
|
138
|
-
identityEntity.identifier = (0, exports.correlationIdentifierEntityFrom)(args.identifier);
|
|
139
|
-
identityEntity.connection = args.connection ? (0, exports.connectionEntityFrom)(args.connection) : undefined;
|
|
140
|
-
identityEntity.metadata = args.metadata ? args.metadata.map((item) => (0, exports.metadataItemEntityFrom)(item)) : [];
|
|
141
|
-
return identityEntity;
|
|
142
|
-
};
|
|
143
|
-
exports.identityEntityFrom = identityEntityFrom;
|
|
144
|
-
const identityFrom = (identity) => {
|
|
145
|
-
return Object.assign(Object.assign({ id: identity.id, alias: identity.alias, roles: identity.roles, identifier: (0, exports.correlationIdentifierFrom)(identity.identifier) }, (identity.connection && { connection: (0, exports.connectionFrom)(identity.connection) })), { metadata: identity.metadata ? identity.metadata.map((item) => (0, exports.metadataItemFrom)(item)) : [], createdAt: identity.createdAt, lastUpdatedAt: identity.createdAt });
|
|
146
|
-
};
|
|
147
|
-
exports.identityFrom = identityFrom;
|
|
148
|
-
const metadataItemEntityFrom = (item) => {
|
|
149
|
-
const metadataItemEntity = new IdentityMetadataItemEntity_1.IdentityMetadataItemEntity();
|
|
150
|
-
metadataItemEntity.label = item.label;
|
|
151
|
-
metadataItemEntity.value = item.value;
|
|
152
|
-
return metadataItemEntity;
|
|
153
|
-
};
|
|
154
|
-
exports.metadataItemEntityFrom = metadataItemEntityFrom;
|
|
155
|
-
const metadataItemFrom = (item) => {
|
|
156
|
-
return {
|
|
157
|
-
id: item.id,
|
|
158
|
-
label: item.label,
|
|
159
|
-
value: item.value,
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
exports.metadataItemFrom = metadataItemFrom;
|
|
163
|
-
const naturalPersonEntityFrom = (naturalPerson) => {
|
|
164
|
-
const naturalPersonEntity = new NaturalPersonEntity_1.NaturalPersonEntity();
|
|
165
|
-
naturalPersonEntity.firstName = naturalPerson.firstName;
|
|
166
|
-
naturalPersonEntity.middleName = naturalPerson.middleName;
|
|
167
|
-
naturalPersonEntity.lastName = naturalPerson.lastName;
|
|
168
|
-
naturalPersonEntity.displayName = naturalPerson.displayName;
|
|
169
|
-
return naturalPersonEntity;
|
|
170
|
-
};
|
|
171
|
-
exports.naturalPersonEntityFrom = naturalPersonEntityFrom;
|
|
172
|
-
const naturalPersonFrom = (naturalPerson) => {
|
|
173
|
-
return {
|
|
174
|
-
id: naturalPerson.id,
|
|
175
|
-
firstName: naturalPerson.firstName,
|
|
176
|
-
middleName: naturalPerson.middleName,
|
|
177
|
-
lastName: naturalPerson.lastName,
|
|
178
|
-
displayName: naturalPerson.displayName,
|
|
179
|
-
createdAt: naturalPerson.createdAt,
|
|
180
|
-
lastUpdatedAt: naturalPerson.lastUpdatedAt,
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
exports.naturalPersonFrom = naturalPersonFrom;
|
|
184
|
-
const openIdConfigEntityFrom = (config) => {
|
|
185
|
-
const openIdConfig = new OpenIdConfigEntity_1.OpenIdConfigEntity();
|
|
186
|
-
openIdConfig.clientId = config.clientId;
|
|
187
|
-
openIdConfig.clientSecret = config.clientSecret;
|
|
188
|
-
openIdConfig.scopes = config.scopes;
|
|
189
|
-
openIdConfig.issuer = config.issuer;
|
|
190
|
-
openIdConfig.redirectUrl = config.redirectUrl;
|
|
191
|
-
openIdConfig.dangerouslyAllowInsecureHttpRequests = config.dangerouslyAllowInsecureHttpRequests;
|
|
192
|
-
openIdConfig.clientAuthMethod = config.clientAuthMethod;
|
|
193
|
-
return openIdConfig;
|
|
194
|
-
};
|
|
195
|
-
exports.openIdConfigEntityFrom = openIdConfigEntityFrom;
|
|
196
|
-
const organizationEntityFrom = (organization) => {
|
|
197
|
-
const organizationEntity = new OrganizationEntity_1.OrganizationEntity();
|
|
198
|
-
organizationEntity.legalName = organization.legalName;
|
|
199
|
-
organizationEntity.displayName = organization.displayName;
|
|
200
|
-
return organizationEntity;
|
|
201
|
-
};
|
|
202
|
-
exports.organizationEntityFrom = organizationEntityFrom;
|
|
203
|
-
const organizationFrom = (organization) => {
|
|
204
|
-
return {
|
|
205
|
-
id: organization.id,
|
|
206
|
-
legalName: organization.legalName,
|
|
207
|
-
displayName: organization.displayName,
|
|
208
|
-
createdAt: organization.createdAt,
|
|
209
|
-
lastUpdatedAt: organization.lastUpdatedAt,
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
exports.organizationFrom = organizationFrom;
|
|
213
|
-
const partyRelationshipEntityFrom = (relationship) => {
|
|
214
|
-
const partyRelationshipEntity = new PartyRelationshipEntity_1.PartyRelationshipEntity();
|
|
215
|
-
partyRelationshipEntity.leftId = relationship.leftId;
|
|
216
|
-
partyRelationshipEntity.rightId = relationship.rightId;
|
|
217
|
-
return partyRelationshipEntity;
|
|
218
|
-
};
|
|
219
|
-
exports.partyRelationshipEntityFrom = partyRelationshipEntityFrom;
|
|
220
|
-
const partyRelationshipFrom = (relationship) => {
|
|
221
|
-
return {
|
|
222
|
-
id: relationship.id,
|
|
223
|
-
leftId: relationship.leftId,
|
|
224
|
-
rightId: relationship.rightId,
|
|
225
|
-
createdAt: relationship.createdAt,
|
|
226
|
-
lastUpdatedAt: relationship.lastUpdatedAt,
|
|
227
|
-
};
|
|
228
|
-
};
|
|
229
|
-
exports.partyRelationshipFrom = partyRelationshipFrom;
|
|
230
|
-
const partyTypeEntityFrom = (args) => {
|
|
231
|
-
const partyTypeEntity = new PartyTypeEntity_1.PartyTypeEntity();
|
|
232
|
-
if (args.id) {
|
|
233
|
-
partyTypeEntity.id = args.id;
|
|
234
|
-
}
|
|
235
|
-
partyTypeEntity.type = args.type;
|
|
236
|
-
partyTypeEntity.name = args.name;
|
|
237
|
-
partyTypeEntity.description = args.description;
|
|
238
|
-
partyTypeEntity.tenantId = args.tenantId;
|
|
239
|
-
return partyTypeEntity;
|
|
240
|
-
};
|
|
241
|
-
exports.partyTypeEntityFrom = partyTypeEntityFrom;
|
|
242
|
-
const partyTypeFrom = (partyType) => {
|
|
243
|
-
return {
|
|
244
|
-
id: partyType.id,
|
|
245
|
-
type: partyType.type,
|
|
246
|
-
name: partyType.name,
|
|
247
|
-
tenantId: partyType.tenantId,
|
|
248
|
-
description: partyType.description,
|
|
249
|
-
createdAt: partyType.createdAt,
|
|
250
|
-
lastUpdatedAt: partyType.lastUpdatedAt,
|
|
251
|
-
};
|
|
252
|
-
};
|
|
253
|
-
exports.partyTypeFrom = partyTypeFrom;
|
|
254
|
-
const configFrom = (config) => {
|
|
255
|
-
if ((0, exports.isOpenIdConfig)(config)) {
|
|
256
|
-
return (0, exports.openIdConfigFrom)(config);
|
|
257
|
-
}
|
|
258
|
-
else if ((0, exports.isDidAuthConfig)(config)) {
|
|
259
|
-
return (0, exports.didAuthConfigFrom)(config);
|
|
260
|
-
}
|
|
261
|
-
throw new Error('config type not supported');
|
|
262
|
-
};
|
|
263
|
-
exports.configFrom = configFrom;
|
|
264
|
-
const openIdConfigFrom = (config) => {
|
|
265
|
-
return {
|
|
266
|
-
id: config.id,
|
|
267
|
-
clientId: config.clientId,
|
|
268
|
-
clientSecret: config.clientSecret,
|
|
269
|
-
scopes: config.scopes,
|
|
270
|
-
issuer: config.issuer,
|
|
271
|
-
redirectUrl: config.redirectUrl,
|
|
272
|
-
dangerouslyAllowInsecureHttpRequests: config.dangerouslyAllowInsecureHttpRequests,
|
|
273
|
-
clientAuthMethod: config.clientAuthMethod,
|
|
274
|
-
};
|
|
275
|
-
};
|
|
276
|
-
exports.openIdConfigFrom = openIdConfigFrom;
|
|
277
|
-
const didAuthConfigFrom = (config) => {
|
|
278
|
-
return {
|
|
279
|
-
id: config.id,
|
|
280
|
-
identifier: { did: config.identifier, provider: '', keys: [], services: [] },
|
|
281
|
-
stateId: '',
|
|
282
|
-
redirectUrl: config.redirectUrl,
|
|
283
|
-
sessionId: config.sessionId,
|
|
284
|
-
};
|
|
285
|
-
};
|
|
286
|
-
exports.didAuthConfigFrom = didAuthConfigFrom;
|
|
287
|
-
const isOpenIdConfig = (config) => 'clientSecret' in config && 'issuer' in config && 'redirectUrl' in config;
|
|
288
|
-
exports.isOpenIdConfig = isOpenIdConfig;
|
|
289
|
-
const isDidAuthConfig = (config) => 'identifier' in config && 'redirectUrl' in config && 'sessionId' in config;
|
|
290
|
-
exports.isDidAuthConfig = isDidAuthConfig;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDidAuthConfig = exports.isOpenIdConfig = exports.didAuthConfigFrom = exports.openIdConfigFrom = exports.configFrom = exports.partyTypeFrom = exports.partyTypeEntityFrom = exports.partyRelationshipFrom = exports.partyRelationshipEntityFrom = exports.organizationFrom = exports.organizationEntityFrom = exports.openIdConfigEntityFrom = exports.naturalPersonFrom = exports.naturalPersonEntityFrom = exports.metadataItemFrom = exports.metadataItemEntityFrom = exports.identityFrom = exports.identityEntityFrom = exports.electronicAddressFrom = exports.electronicAddressEntityFrom = exports.didAuthConfigEntityFrom = exports.correlationIdentifierFrom = exports.correlationIdentifierEntityFrom = exports.connectionFrom = exports.connectionEntityFrom = exports.isOrganization = exports.isNaturalPerson = exports.contactFrom = exports.contactEntityFrom = exports.partyFrom = exports.partyEntityFrom = void 0;
|
|
4
|
+
const PartyEntity_1 = require("../../entities/contact/PartyEntity");
|
|
5
|
+
const IdentityEntity_1 = require("../../entities/contact/IdentityEntity");
|
|
6
|
+
const ElectronicAddressEntity_1 = require("../../entities/contact/ElectronicAddressEntity");
|
|
7
|
+
const PartyRelationshipEntity_1 = require("../../entities/contact/PartyRelationshipEntity");
|
|
8
|
+
const NaturalPersonEntity_1 = require("../../entities/contact/NaturalPersonEntity");
|
|
9
|
+
const OrganizationEntity_1 = require("../../entities/contact/OrganizationEntity");
|
|
10
|
+
const ConnectionEntity_1 = require("../../entities/contact/ConnectionEntity");
|
|
11
|
+
const CorrelationIdentifierEntity_1 = require("../../entities/contact/CorrelationIdentifierEntity");
|
|
12
|
+
const DidAuthConfigEntity_1 = require("../../entities/contact/DidAuthConfigEntity");
|
|
13
|
+
const IdentityMetadataItemEntity_1 = require("../../entities/contact/IdentityMetadataItemEntity");
|
|
14
|
+
const OpenIdConfigEntity_1 = require("../../entities/contact/OpenIdConfigEntity");
|
|
15
|
+
const PartyTypeEntity_1 = require("../../entities/contact/PartyTypeEntity");
|
|
16
|
+
const partyEntityFrom = (party) => {
|
|
17
|
+
const partyEntity = new PartyEntity_1.PartyEntity();
|
|
18
|
+
partyEntity.uri = party.uri;
|
|
19
|
+
partyEntity.identities = party.identities ? party.identities.map((identity) => (0, exports.identityEntityFrom)(identity)) : [];
|
|
20
|
+
partyEntity.electronicAddresses = party.electronicAddresses
|
|
21
|
+
? party.electronicAddresses.map((electronicAddress) => (0, exports.electronicAddressEntityFrom)(electronicAddress))
|
|
22
|
+
: [];
|
|
23
|
+
partyEntity.partyType = (0, exports.partyTypeEntityFrom)(party.partyType);
|
|
24
|
+
partyEntity.contact = (0, exports.contactEntityFrom)(party.contact);
|
|
25
|
+
return partyEntity;
|
|
26
|
+
};
|
|
27
|
+
exports.partyEntityFrom = partyEntityFrom;
|
|
28
|
+
const partyFrom = (party) => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
return {
|
|
31
|
+
id: party.id,
|
|
32
|
+
uri: party.uri,
|
|
33
|
+
roles: (_b = [...new Set((_a = party.identities) === null || _a === void 0 ? void 0 : _a.flatMap((identity) => identity.roles))]) !== null && _b !== void 0 ? _b : [],
|
|
34
|
+
identities: party.identities ? party.identities.map((identity) => (0, exports.identityFrom)(identity)) : [],
|
|
35
|
+
electronicAddresses: party.electronicAddresses
|
|
36
|
+
? party.electronicAddresses.map((electronicAddress) => (0, exports.electronicAddressFrom)(electronicAddress))
|
|
37
|
+
: [],
|
|
38
|
+
relationships: party.relationships ? party.relationships.map((relationship) => (0, exports.partyRelationshipFrom)(relationship)) : [],
|
|
39
|
+
partyType: (0, exports.partyTypeFrom)(party.partyType),
|
|
40
|
+
contact: (0, exports.contactFrom)(party.contact),
|
|
41
|
+
createdAt: party.createdAt,
|
|
42
|
+
lastUpdatedAt: party.lastUpdatedAt,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
exports.partyFrom = partyFrom;
|
|
46
|
+
const contactEntityFrom = (contact) => {
|
|
47
|
+
if ((0, exports.isNaturalPerson)(contact)) {
|
|
48
|
+
return (0, exports.naturalPersonEntityFrom)(contact);
|
|
49
|
+
}
|
|
50
|
+
else if ((0, exports.isOrganization)(contact)) {
|
|
51
|
+
return (0, exports.organizationEntityFrom)(contact);
|
|
52
|
+
}
|
|
53
|
+
throw new Error('Contact not supported');
|
|
54
|
+
};
|
|
55
|
+
exports.contactEntityFrom = contactEntityFrom;
|
|
56
|
+
const contactFrom = (contact) => {
|
|
57
|
+
if ((0, exports.isNaturalPerson)(contact)) {
|
|
58
|
+
return (0, exports.naturalPersonFrom)(contact);
|
|
59
|
+
}
|
|
60
|
+
else if ((0, exports.isOrganization)(contact)) {
|
|
61
|
+
return (0, exports.organizationFrom)(contact);
|
|
62
|
+
}
|
|
63
|
+
throw new Error('Contact not supported');
|
|
64
|
+
};
|
|
65
|
+
exports.contactFrom = contactFrom;
|
|
66
|
+
const isNaturalPerson = (contact) => 'firstName' in contact && 'lastName' in contact;
|
|
67
|
+
exports.isNaturalPerson = isNaturalPerson;
|
|
68
|
+
const isOrganization = (contact) => 'legalName' in contact;
|
|
69
|
+
exports.isOrganization = isOrganization;
|
|
70
|
+
const connectionEntityFrom = (connection) => {
|
|
71
|
+
const connectionEntity = new ConnectionEntity_1.ConnectionEntity();
|
|
72
|
+
connectionEntity.type = connection.type;
|
|
73
|
+
connectionEntity.config = configEntityFrom(connection.config);
|
|
74
|
+
return connectionEntity;
|
|
75
|
+
};
|
|
76
|
+
exports.connectionEntityFrom = connectionEntityFrom;
|
|
77
|
+
const connectionFrom = (connection) => {
|
|
78
|
+
return {
|
|
79
|
+
id: connection.id,
|
|
80
|
+
type: connection.type,
|
|
81
|
+
config: (0, exports.configFrom)(connection.config),
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
exports.connectionFrom = connectionFrom;
|
|
85
|
+
const configEntityFrom = (config) => {
|
|
86
|
+
if ((0, exports.isOpenIdConfig)(config)) {
|
|
87
|
+
return (0, exports.openIdConfigEntityFrom)(config);
|
|
88
|
+
}
|
|
89
|
+
else if ((0, exports.isDidAuthConfig)(config)) {
|
|
90
|
+
return (0, exports.didAuthConfigEntityFrom)(config);
|
|
91
|
+
}
|
|
92
|
+
throw new Error('config type not supported');
|
|
93
|
+
};
|
|
94
|
+
const correlationIdentifierEntityFrom = (identifier) => {
|
|
95
|
+
const identifierEntity = new CorrelationIdentifierEntity_1.CorrelationIdentifierEntity();
|
|
96
|
+
identifierEntity.type = identifier.type;
|
|
97
|
+
identifierEntity.correlationId = identifier.correlationId;
|
|
98
|
+
return identifierEntity;
|
|
99
|
+
};
|
|
100
|
+
exports.correlationIdentifierEntityFrom = correlationIdentifierEntityFrom;
|
|
101
|
+
const correlationIdentifierFrom = (identifier) => {
|
|
102
|
+
return {
|
|
103
|
+
id: identifier.id,
|
|
104
|
+
type: identifier.type,
|
|
105
|
+
correlationId: identifier.correlationId,
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
exports.correlationIdentifierFrom = correlationIdentifierFrom;
|
|
109
|
+
const didAuthConfigEntityFrom = (config) => {
|
|
110
|
+
const didAuthConfig = new DidAuthConfigEntity_1.DidAuthConfigEntity();
|
|
111
|
+
didAuthConfig.identifier = config.identifier.did;
|
|
112
|
+
didAuthConfig.redirectUrl = config.redirectUrl;
|
|
113
|
+
didAuthConfig.sessionId = config.sessionId;
|
|
114
|
+
return didAuthConfig;
|
|
115
|
+
};
|
|
116
|
+
exports.didAuthConfigEntityFrom = didAuthConfigEntityFrom;
|
|
117
|
+
const electronicAddressEntityFrom = (electronicAddress) => {
|
|
118
|
+
const electronicAddressEntity = new ElectronicAddressEntity_1.ElectronicAddressEntity();
|
|
119
|
+
electronicAddressEntity.type = electronicAddress.type;
|
|
120
|
+
electronicAddressEntity.electronicAddress = electronicAddress.electronicAddress;
|
|
121
|
+
return electronicAddressEntity;
|
|
122
|
+
};
|
|
123
|
+
exports.electronicAddressEntityFrom = electronicAddressEntityFrom;
|
|
124
|
+
const electronicAddressFrom = (electronicAddress) => {
|
|
125
|
+
return {
|
|
126
|
+
id: electronicAddress.id,
|
|
127
|
+
type: electronicAddress.type,
|
|
128
|
+
electronicAddress: electronicAddress.electronicAddress,
|
|
129
|
+
createdAt: electronicAddress.createdAt,
|
|
130
|
+
lastUpdatedAt: electronicAddress.lastUpdatedAt,
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
exports.electronicAddressFrom = electronicAddressFrom;
|
|
134
|
+
const identityEntityFrom = (args) => {
|
|
135
|
+
const identityEntity = new IdentityEntity_1.IdentityEntity();
|
|
136
|
+
identityEntity.alias = args.alias;
|
|
137
|
+
identityEntity.roles = args.roles;
|
|
138
|
+
identityEntity.identifier = (0, exports.correlationIdentifierEntityFrom)(args.identifier);
|
|
139
|
+
identityEntity.connection = args.connection ? (0, exports.connectionEntityFrom)(args.connection) : undefined;
|
|
140
|
+
identityEntity.metadata = args.metadata ? args.metadata.map((item) => (0, exports.metadataItemEntityFrom)(item)) : [];
|
|
141
|
+
return identityEntity;
|
|
142
|
+
};
|
|
143
|
+
exports.identityEntityFrom = identityEntityFrom;
|
|
144
|
+
const identityFrom = (identity) => {
|
|
145
|
+
return Object.assign(Object.assign({ id: identity.id, alias: identity.alias, roles: identity.roles, identifier: (0, exports.correlationIdentifierFrom)(identity.identifier) }, (identity.connection && { connection: (0, exports.connectionFrom)(identity.connection) })), { metadata: identity.metadata ? identity.metadata.map((item) => (0, exports.metadataItemFrom)(item)) : [], createdAt: identity.createdAt, lastUpdatedAt: identity.createdAt });
|
|
146
|
+
};
|
|
147
|
+
exports.identityFrom = identityFrom;
|
|
148
|
+
const metadataItemEntityFrom = (item) => {
|
|
149
|
+
const metadataItemEntity = new IdentityMetadataItemEntity_1.IdentityMetadataItemEntity();
|
|
150
|
+
metadataItemEntity.label = item.label;
|
|
151
|
+
metadataItemEntity.value = item.value;
|
|
152
|
+
return metadataItemEntity;
|
|
153
|
+
};
|
|
154
|
+
exports.metadataItemEntityFrom = metadataItemEntityFrom;
|
|
155
|
+
const metadataItemFrom = (item) => {
|
|
156
|
+
return {
|
|
157
|
+
id: item.id,
|
|
158
|
+
label: item.label,
|
|
159
|
+
value: item.value,
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
exports.metadataItemFrom = metadataItemFrom;
|
|
163
|
+
const naturalPersonEntityFrom = (naturalPerson) => {
|
|
164
|
+
const naturalPersonEntity = new NaturalPersonEntity_1.NaturalPersonEntity();
|
|
165
|
+
naturalPersonEntity.firstName = naturalPerson.firstName;
|
|
166
|
+
naturalPersonEntity.middleName = naturalPerson.middleName;
|
|
167
|
+
naturalPersonEntity.lastName = naturalPerson.lastName;
|
|
168
|
+
naturalPersonEntity.displayName = naturalPerson.displayName;
|
|
169
|
+
return naturalPersonEntity;
|
|
170
|
+
};
|
|
171
|
+
exports.naturalPersonEntityFrom = naturalPersonEntityFrom;
|
|
172
|
+
const naturalPersonFrom = (naturalPerson) => {
|
|
173
|
+
return {
|
|
174
|
+
id: naturalPerson.id,
|
|
175
|
+
firstName: naturalPerson.firstName,
|
|
176
|
+
middleName: naturalPerson.middleName,
|
|
177
|
+
lastName: naturalPerson.lastName,
|
|
178
|
+
displayName: naturalPerson.displayName,
|
|
179
|
+
createdAt: naturalPerson.createdAt,
|
|
180
|
+
lastUpdatedAt: naturalPerson.lastUpdatedAt,
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
exports.naturalPersonFrom = naturalPersonFrom;
|
|
184
|
+
const openIdConfigEntityFrom = (config) => {
|
|
185
|
+
const openIdConfig = new OpenIdConfigEntity_1.OpenIdConfigEntity();
|
|
186
|
+
openIdConfig.clientId = config.clientId;
|
|
187
|
+
openIdConfig.clientSecret = config.clientSecret;
|
|
188
|
+
openIdConfig.scopes = config.scopes;
|
|
189
|
+
openIdConfig.issuer = config.issuer;
|
|
190
|
+
openIdConfig.redirectUrl = config.redirectUrl;
|
|
191
|
+
openIdConfig.dangerouslyAllowInsecureHttpRequests = config.dangerouslyAllowInsecureHttpRequests;
|
|
192
|
+
openIdConfig.clientAuthMethod = config.clientAuthMethod;
|
|
193
|
+
return openIdConfig;
|
|
194
|
+
};
|
|
195
|
+
exports.openIdConfigEntityFrom = openIdConfigEntityFrom;
|
|
196
|
+
const organizationEntityFrom = (organization) => {
|
|
197
|
+
const organizationEntity = new OrganizationEntity_1.OrganizationEntity();
|
|
198
|
+
organizationEntity.legalName = organization.legalName;
|
|
199
|
+
organizationEntity.displayName = organization.displayName;
|
|
200
|
+
return organizationEntity;
|
|
201
|
+
};
|
|
202
|
+
exports.organizationEntityFrom = organizationEntityFrom;
|
|
203
|
+
const organizationFrom = (organization) => {
|
|
204
|
+
return {
|
|
205
|
+
id: organization.id,
|
|
206
|
+
legalName: organization.legalName,
|
|
207
|
+
displayName: organization.displayName,
|
|
208
|
+
createdAt: organization.createdAt,
|
|
209
|
+
lastUpdatedAt: organization.lastUpdatedAt,
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
exports.organizationFrom = organizationFrom;
|
|
213
|
+
const partyRelationshipEntityFrom = (relationship) => {
|
|
214
|
+
const partyRelationshipEntity = new PartyRelationshipEntity_1.PartyRelationshipEntity();
|
|
215
|
+
partyRelationshipEntity.leftId = relationship.leftId;
|
|
216
|
+
partyRelationshipEntity.rightId = relationship.rightId;
|
|
217
|
+
return partyRelationshipEntity;
|
|
218
|
+
};
|
|
219
|
+
exports.partyRelationshipEntityFrom = partyRelationshipEntityFrom;
|
|
220
|
+
const partyRelationshipFrom = (relationship) => {
|
|
221
|
+
return {
|
|
222
|
+
id: relationship.id,
|
|
223
|
+
leftId: relationship.leftId,
|
|
224
|
+
rightId: relationship.rightId,
|
|
225
|
+
createdAt: relationship.createdAt,
|
|
226
|
+
lastUpdatedAt: relationship.lastUpdatedAt,
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
exports.partyRelationshipFrom = partyRelationshipFrom;
|
|
230
|
+
const partyTypeEntityFrom = (args) => {
|
|
231
|
+
const partyTypeEntity = new PartyTypeEntity_1.PartyTypeEntity();
|
|
232
|
+
if (args.id) {
|
|
233
|
+
partyTypeEntity.id = args.id;
|
|
234
|
+
}
|
|
235
|
+
partyTypeEntity.type = args.type;
|
|
236
|
+
partyTypeEntity.name = args.name;
|
|
237
|
+
partyTypeEntity.description = args.description;
|
|
238
|
+
partyTypeEntity.tenantId = args.tenantId;
|
|
239
|
+
return partyTypeEntity;
|
|
240
|
+
};
|
|
241
|
+
exports.partyTypeEntityFrom = partyTypeEntityFrom;
|
|
242
|
+
const partyTypeFrom = (partyType) => {
|
|
243
|
+
return {
|
|
244
|
+
id: partyType.id,
|
|
245
|
+
type: partyType.type,
|
|
246
|
+
name: partyType.name,
|
|
247
|
+
tenantId: partyType.tenantId,
|
|
248
|
+
description: partyType.description,
|
|
249
|
+
createdAt: partyType.createdAt,
|
|
250
|
+
lastUpdatedAt: partyType.lastUpdatedAt,
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
exports.partyTypeFrom = partyTypeFrom;
|
|
254
|
+
const configFrom = (config) => {
|
|
255
|
+
if ((0, exports.isOpenIdConfig)(config)) {
|
|
256
|
+
return (0, exports.openIdConfigFrom)(config);
|
|
257
|
+
}
|
|
258
|
+
else if ((0, exports.isDidAuthConfig)(config)) {
|
|
259
|
+
return (0, exports.didAuthConfigFrom)(config);
|
|
260
|
+
}
|
|
261
|
+
throw new Error('config type not supported');
|
|
262
|
+
};
|
|
263
|
+
exports.configFrom = configFrom;
|
|
264
|
+
const openIdConfigFrom = (config) => {
|
|
265
|
+
return {
|
|
266
|
+
id: config.id,
|
|
267
|
+
clientId: config.clientId,
|
|
268
|
+
clientSecret: config.clientSecret,
|
|
269
|
+
scopes: config.scopes,
|
|
270
|
+
issuer: config.issuer,
|
|
271
|
+
redirectUrl: config.redirectUrl,
|
|
272
|
+
dangerouslyAllowInsecureHttpRequests: config.dangerouslyAllowInsecureHttpRequests,
|
|
273
|
+
clientAuthMethod: config.clientAuthMethod,
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
exports.openIdConfigFrom = openIdConfigFrom;
|
|
277
|
+
const didAuthConfigFrom = (config) => {
|
|
278
|
+
return {
|
|
279
|
+
id: config.id,
|
|
280
|
+
identifier: { did: config.identifier, provider: '', keys: [], services: [] },
|
|
281
|
+
stateId: '',
|
|
282
|
+
redirectUrl: config.redirectUrl,
|
|
283
|
+
sessionId: config.sessionId,
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
exports.didAuthConfigFrom = didAuthConfigFrom;
|
|
287
|
+
const isOpenIdConfig = (config) => 'clientSecret' in config && 'issuer' in config && 'redirectUrl' in config;
|
|
288
|
+
exports.isOpenIdConfig = isOpenIdConfig;
|
|
289
|
+
const isDidAuthConfig = (config) => 'identifier' in config && 'redirectUrl' in config && 'sessionId' in config;
|
|
290
|
+
exports.isDidAuthConfig = isDidAuthConfig;
|
|
291
291
|
//# sourceMappingURL=MappingUtils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.data-store",
|
|
3
|
-
"version": "0.18.2-
|
|
3
|
+
"version": "0.18.2-unstable.13+4e744e0b",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"typeorm-postgres:migration:run": "pnpm run typeorm -- migration:run -c migration-postgres"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@sphereon/ssi-sdk.core": "0.18.2-
|
|
17
|
-
"@sphereon/ssi-types": "0.18.2-
|
|
16
|
+
"@sphereon/ssi-sdk.core": "0.18.2-unstable.13+4e744e0b",
|
|
17
|
+
"@sphereon/ssi-types": "0.18.2-unstable.13+4e744e0b",
|
|
18
18
|
"@veramo/core": "4.2.0",
|
|
19
19
|
"class-validator": "^0.14.0",
|
|
20
20
|
"debug": "^4.3.4",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"PostgreSQL",
|
|
44
44
|
"Contact Store"
|
|
45
45
|
],
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "4e744e0bde523847bf8db70438dc8407a602b4ee"
|
|
47
47
|
}
|