@sphereon/ssi-sdk.data-store 0.18.1 → 0.18.2-unstable.10
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/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.js +127 -127
- 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.js +5 -5
- 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/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/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 -113
- 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/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,375 +1,375 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.IssuanceBrandingStore = void 0;
|
|
16
|
-
const debug_1 = __importDefault(require("debug"));
|
|
17
|
-
const typeorm_1 = require("typeorm");
|
|
18
|
-
const BackgroundAttributesEntity_1 = require("../entities/issuanceBranding/BackgroundAttributesEntity");
|
|
19
|
-
const ImageAttributesEntity_1 = require("../entities/issuanceBranding/ImageAttributesEntity");
|
|
20
|
-
const ImageDimensionsEntity_1 = require("../entities/issuanceBranding/ImageDimensionsEntity");
|
|
21
|
-
const IssuerBrandingEntity_1 = require("../entities/issuanceBranding/IssuerBrandingEntity");
|
|
22
|
-
const CredentialBrandingEntity_1 = require("../entities/issuanceBranding/CredentialBrandingEntity");
|
|
23
|
-
const CredentialLocaleBrandingEntity_1 = require("../entities/issuanceBranding/CredentialLocaleBrandingEntity");
|
|
24
|
-
const IssuerLocaleBrandingEntity_1 = require("../entities/issuanceBranding/IssuerLocaleBrandingEntity");
|
|
25
|
-
const TextAttributesEntity_1 = require("../entities/issuanceBranding/TextAttributesEntity");
|
|
26
|
-
const AbstractIssuanceBrandingStore_1 = require("./AbstractIssuanceBrandingStore");
|
|
27
|
-
const debug = (0, debug_1.default)('sphereon:ssi-sdk:issuance-branding-store');
|
|
28
|
-
class IssuanceBrandingStore extends AbstractIssuanceBrandingStore_1.AbstractIssuanceBrandingStore {
|
|
29
|
-
constructor(dbConnection) {
|
|
30
|
-
super();
|
|
31
|
-
this.addCredentialBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
const repository = (yield this.dbConnection).getRepository(CredentialBrandingEntity_1.CredentialBrandingEntity);
|
|
33
|
-
const result = yield repository.findOne({
|
|
34
|
-
where: [{ vcHash: args.vcHash }],
|
|
35
|
-
});
|
|
36
|
-
if (result) {
|
|
37
|
-
return Promise.reject(Error(`Credential branding already present for vc with hash: ${args.vcHash}`));
|
|
38
|
-
}
|
|
39
|
-
if (yield this.hasDuplicateLocales(args.localeBranding)) {
|
|
40
|
-
return Promise.reject(Error(`Credential branding contains duplicate locales`));
|
|
41
|
-
}
|
|
42
|
-
const credentialBrandingEntity = (0, CredentialBrandingEntity_1.credentialBrandingEntityFrom)(args);
|
|
43
|
-
debug('Adding credential branding', credentialBrandingEntity);
|
|
44
|
-
const createdResult = yield repository.save(credentialBrandingEntity);
|
|
45
|
-
return this.credentialBrandingFrom(createdResult);
|
|
46
|
-
});
|
|
47
|
-
this.getCredentialBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
if (args === null || args === void 0 ? void 0 : args.filter) {
|
|
49
|
-
args === null || args === void 0 ? void 0 : args.filter.forEach((filter) => {
|
|
50
|
-
if (filter.localeBranding && 'locale' in filter.localeBranding && filter.localeBranding.locale === undefined) {
|
|
51
|
-
filter.localeBranding.locale = '';
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
debug('Getting credential branding', args);
|
|
56
|
-
const result = yield (yield this.dbConnection).getRepository(CredentialBrandingEntity_1.CredentialBrandingEntity).find(Object.assign({}, ((args === null || args === void 0 ? void 0 : args.filter) && { where: args === null || args === void 0 ? void 0 : args.filter })));
|
|
57
|
-
return result.map((credentialBranding) => this.credentialBrandingFrom(credentialBranding));
|
|
58
|
-
});
|
|
59
|
-
this.removeCredentialBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
const repository = (yield this.dbConnection).getRepository(CredentialBrandingEntity_1.CredentialBrandingEntity);
|
|
61
|
-
const credentialBranding = yield repository.find({
|
|
62
|
-
where: args.filter,
|
|
63
|
-
});
|
|
64
|
-
debug('Removing credential locale branding', args);
|
|
65
|
-
const localeBrandingDeletions = credentialBranding.map((credentialBranding) => credentialBranding.localeBranding.map((localeBranding) => __awaiter(this, void 0, void 0, function* () { return this.removeLocaleBranding(localeBranding); })));
|
|
66
|
-
yield Promise.all(localeBrandingDeletions);
|
|
67
|
-
debug('Removing credential branding', args);
|
|
68
|
-
const credentialBrandingDeletions = args.filter.map((filter) => __awaiter(this, void 0, void 0, function* () { return yield repository.delete(filter); }));
|
|
69
|
-
yield Promise.all(credentialBrandingDeletions);
|
|
70
|
-
});
|
|
71
|
-
this.updateCredentialBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
const repository = (yield this.dbConnection).getRepository(CredentialBrandingEntity_1.CredentialBrandingEntity);
|
|
73
|
-
const credentialBrandingEntity = yield repository.findOne({
|
|
74
|
-
where: { id: args.credentialBranding.id },
|
|
75
|
-
});
|
|
76
|
-
if (!credentialBrandingEntity) {
|
|
77
|
-
return Promise.reject(Error(`No credential branding found for id: ${args.credentialBranding.id}`));
|
|
78
|
-
}
|
|
79
|
-
const credentialBranding = Object.assign(Object.assign({}, args.credentialBranding), { localeBranding: credentialBrandingEntity.localeBranding });
|
|
80
|
-
debug('Updating credential branding', credentialBranding);
|
|
81
|
-
const result = yield repository.save(credentialBranding, { transaction: true });
|
|
82
|
-
return this.credentialBrandingFrom(result);
|
|
83
|
-
});
|
|
84
|
-
this.addCredentialLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
const credentialBrandingRepository = (yield this.dbConnection).getRepository(CredentialBrandingEntity_1.CredentialBrandingEntity);
|
|
86
|
-
const credentialBranding = yield credentialBrandingRepository.findOne({
|
|
87
|
-
where: { id: args.credentialBrandingId },
|
|
88
|
-
});
|
|
89
|
-
if (!credentialBranding) {
|
|
90
|
-
return Promise.reject(Error(`No credential branding found for id: ${args.credentialBrandingId}`));
|
|
91
|
-
}
|
|
92
|
-
const locales = yield (yield this.dbConnection).getRepository(CredentialLocaleBrandingEntity_1.CredentialLocaleBrandingEntity).find({
|
|
93
|
-
where: {
|
|
94
|
-
credentialBranding: {
|
|
95
|
-
id: args.credentialBrandingId,
|
|
96
|
-
},
|
|
97
|
-
locale: (0, typeorm_1.In)(args.localeBranding.map((localeBranding) => localeBranding.locale)),
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
if (locales && locales.length > 0) {
|
|
101
|
-
return Promise.reject(Error(`Credential branding already contains locales: ${locales === null || locales === void 0 ? void 0 : locales.map((credentialLocaleBrandingEntity) => credentialLocaleBrandingEntity.locale)}`));
|
|
102
|
-
}
|
|
103
|
-
const credentialLocaleBrandingRepository = (yield this.dbConnection).getRepository(CredentialLocaleBrandingEntity_1.CredentialLocaleBrandingEntity);
|
|
104
|
-
const addCredentialLocaleBranding = args.localeBranding.map((localeBranding) => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
const credentialLocaleBrandingEntity = (0, CredentialLocaleBrandingEntity_1.credentialLocaleBrandingEntityFrom)(localeBranding);
|
|
106
|
-
debug('Adding credential locale branding', credentialLocaleBrandingEntity);
|
|
107
|
-
credentialLocaleBrandingEntity.credentialBranding = credentialBranding;
|
|
108
|
-
yield credentialLocaleBrandingRepository.save(credentialLocaleBrandingEntity, { transaction: true });
|
|
109
|
-
}));
|
|
110
|
-
yield Promise.all(addCredentialLocaleBranding);
|
|
111
|
-
const result = yield credentialBrandingRepository.findOne({
|
|
112
|
-
where: { id: args.credentialBrandingId },
|
|
113
|
-
});
|
|
114
|
-
if (!result) {
|
|
115
|
-
return Promise.reject(Error('Unable to get updated credential branding'));
|
|
116
|
-
}
|
|
117
|
-
return this.credentialBrandingFrom(result);
|
|
118
|
-
});
|
|
119
|
-
this.getCredentialLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
120
|
-
if (args === null || args === void 0 ? void 0 : args.filter) {
|
|
121
|
-
args === null || args === void 0 ? void 0 : args.filter.forEach((filter) => {
|
|
122
|
-
if ('locale' in filter && filter.locale === undefined) {
|
|
123
|
-
filter.locale = '';
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
debug('Getting credential locale branding', args);
|
|
128
|
-
const credentialBrandingLocale = yield (yield this.dbConnection)
|
|
129
|
-
.getRepository(CredentialLocaleBrandingEntity_1.CredentialLocaleBrandingEntity)
|
|
130
|
-
.find(Object.assign({}, ((args === null || args === void 0 ? void 0 : args.filter) && { where: args === null || args === void 0 ? void 0 : args.filter })));
|
|
131
|
-
return credentialBrandingLocale
|
|
132
|
-
? credentialBrandingLocale.map((credentialLocaleBranding) => this.localeBrandingFrom(credentialLocaleBranding))
|
|
133
|
-
: [];
|
|
134
|
-
});
|
|
135
|
-
this.removeCredentialLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
136
|
-
const credentialLocaleBranding = yield (yield this.dbConnection)
|
|
137
|
-
.getRepository(CredentialLocaleBrandingEntity_1.CredentialLocaleBrandingEntity)
|
|
138
|
-
.find({
|
|
139
|
-
where: args.filter,
|
|
140
|
-
});
|
|
141
|
-
debug('Removing credential locale branding', args);
|
|
142
|
-
const localeBrandingDeletions = credentialLocaleBranding.map((localeBranding) => __awaiter(this, void 0, void 0, function* () { return this.removeLocaleBranding(localeBranding); }));
|
|
143
|
-
yield Promise.all(localeBrandingDeletions);
|
|
144
|
-
});
|
|
145
|
-
this.updateCredentialLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
146
|
-
const repository = (yield this.dbConnection).getRepository(CredentialLocaleBrandingEntity_1.CredentialLocaleBrandingEntity);
|
|
147
|
-
const result = yield repository.findOne({
|
|
148
|
-
where: { id: args.localeBranding.id },
|
|
149
|
-
});
|
|
150
|
-
if (!result) {
|
|
151
|
-
return Promise.reject(Error(`No credential locale branding found for id: ${args.localeBranding.id}`));
|
|
152
|
-
}
|
|
153
|
-
const locales = yield repository.find({
|
|
154
|
-
where: {
|
|
155
|
-
credentialBranding: {
|
|
156
|
-
id: result.credentialBrandingId,
|
|
157
|
-
},
|
|
158
|
-
id: (0, typeorm_1.Not)((0, typeorm_1.In)([args.localeBranding.id])),
|
|
159
|
-
locale: args.localeBranding.locale,
|
|
160
|
-
},
|
|
161
|
-
});
|
|
162
|
-
if (locales && locales.length > 0) {
|
|
163
|
-
return Promise.reject(Error(`Credential branding: ${result.credentialBrandingId} already contains locale: ${args.localeBranding.locale}`));
|
|
164
|
-
}
|
|
165
|
-
debug('Updating credential locale branding', args.localeBranding);
|
|
166
|
-
const updatedResult = yield repository.save(args.localeBranding, { transaction: true });
|
|
167
|
-
return this.localeBrandingFrom(updatedResult);
|
|
168
|
-
});
|
|
169
|
-
this.addIssuerBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
170
|
-
const repository = (yield this.dbConnection).getRepository(IssuerBrandingEntity_1.IssuerBrandingEntity);
|
|
171
|
-
const result = yield repository.findOne({
|
|
172
|
-
where: [{ issuerCorrelationId: args.issuerCorrelationId }],
|
|
173
|
-
});
|
|
174
|
-
if (result) {
|
|
175
|
-
return Promise.reject(Error(`Issuer branding already present for issuer with correlation id: ${args.issuerCorrelationId}`));
|
|
176
|
-
}
|
|
177
|
-
if (yield this.hasDuplicateLocales(args.localeBranding)) {
|
|
178
|
-
return Promise.reject(Error(`Issuer branding contains duplicate locales`));
|
|
179
|
-
}
|
|
180
|
-
const issuerBrandingEntity = (0, IssuerBrandingEntity_1.issuerBrandingEntityFrom)(args);
|
|
181
|
-
debug('Adding issuer branding', issuerBrandingEntity);
|
|
182
|
-
const createdResult = yield repository.save(issuerBrandingEntity);
|
|
183
|
-
return this.issuerBrandingFrom(createdResult);
|
|
184
|
-
});
|
|
185
|
-
this.getIssuerBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
186
|
-
if (args === null || args === void 0 ? void 0 : args.filter) {
|
|
187
|
-
args === null || args === void 0 ? void 0 : args.filter.forEach((filter) => {
|
|
188
|
-
if (filter.localeBranding && 'locale' in filter.localeBranding && filter.localeBranding.locale === undefined) {
|
|
189
|
-
filter.localeBranding.locale = '';
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
debug('Getting issuer branding', args);
|
|
194
|
-
const result = yield (yield this.dbConnection).getRepository(IssuerBrandingEntity_1.IssuerBrandingEntity).find(Object.assign({}, ((args === null || args === void 0 ? void 0 : args.filter) && { where: args === null || args === void 0 ? void 0 : args.filter })));
|
|
195
|
-
return result.map((issuerBranding) => this.issuerBrandingFrom(issuerBranding));
|
|
196
|
-
});
|
|
197
|
-
this.removeIssuerBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
198
|
-
const repository = (yield this.dbConnection).getRepository(IssuerBrandingEntity_1.IssuerBrandingEntity);
|
|
199
|
-
const issuerBranding = yield repository.find({
|
|
200
|
-
where: args.filter,
|
|
201
|
-
});
|
|
202
|
-
debug('Removing issuer locale branding', args);
|
|
203
|
-
const localeBrandingDeletions = issuerBranding.map((issuerBranding) => issuerBranding.localeBranding.map((localeBranding) => __awaiter(this, void 0, void 0, function* () { return this.removeLocaleBranding(localeBranding); })));
|
|
204
|
-
yield Promise.all(localeBrandingDeletions);
|
|
205
|
-
debug('Removing issuer branding', args);
|
|
206
|
-
const issuerBrandingDeletions = args.filter.map((filter) => __awaiter(this, void 0, void 0, function* () { return yield repository.delete(filter); }));
|
|
207
|
-
yield Promise.all(issuerBrandingDeletions);
|
|
208
|
-
});
|
|
209
|
-
this.updateIssuerBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
210
|
-
const repository = (yield this.dbConnection).getRepository(IssuerBrandingEntity_1.IssuerBrandingEntity);
|
|
211
|
-
const issuerBrandingEntity = yield repository.findOne({
|
|
212
|
-
where: { id: args.issuerBranding.id },
|
|
213
|
-
});
|
|
214
|
-
if (!issuerBrandingEntity) {
|
|
215
|
-
return Promise.reject(Error(`No issuer branding found for id: ${args.issuerBranding.id}`));
|
|
216
|
-
}
|
|
217
|
-
const issuerBranding = Object.assign(Object.assign({}, args.issuerBranding), { localeBranding: issuerBrandingEntity.localeBranding });
|
|
218
|
-
debug('Updating issuer branding', issuerBranding);
|
|
219
|
-
const result = yield repository.save(issuerBranding, { transaction: true });
|
|
220
|
-
return this.issuerBrandingFrom(result);
|
|
221
|
-
});
|
|
222
|
-
this.addIssuerLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
223
|
-
const issuerBrandingRepository = (yield this.dbConnection).getRepository(IssuerBrandingEntity_1.IssuerBrandingEntity);
|
|
224
|
-
const issuerBranding = yield issuerBrandingRepository.findOne({
|
|
225
|
-
where: { id: args.issuerBrandingId },
|
|
226
|
-
});
|
|
227
|
-
if (!issuerBranding) {
|
|
228
|
-
return Promise.reject(Error(`No issuer branding found for id: ${args.issuerBrandingId}`));
|
|
229
|
-
}
|
|
230
|
-
const locales = yield (yield this.dbConnection).getRepository(IssuerLocaleBrandingEntity_1.IssuerLocaleBrandingEntity).find({
|
|
231
|
-
where: {
|
|
232
|
-
issuerBranding: {
|
|
233
|
-
id: args.issuerBrandingId,
|
|
234
|
-
},
|
|
235
|
-
locale: (0, typeorm_1.In)(args.localeBranding.map((localeBranding) => localeBranding.locale)),
|
|
236
|
-
},
|
|
237
|
-
});
|
|
238
|
-
if (locales && locales.length > 0) {
|
|
239
|
-
return Promise.reject(Error(`Issuer branding already contains locales: ${locales === null || locales === void 0 ? void 0 : locales.map((issuerLocaleBrandingEntity) => issuerLocaleBrandingEntity.locale)}`));
|
|
240
|
-
}
|
|
241
|
-
const issuerLocaleBrandingRepository = (yield this.dbConnection).getRepository(IssuerLocaleBrandingEntity_1.IssuerLocaleBrandingEntity);
|
|
242
|
-
const addIssuerLocaleBranding = args.localeBranding.map((localeBranding) => __awaiter(this, void 0, void 0, function* () {
|
|
243
|
-
const issuerLocaleBrandingEntity = (0, IssuerLocaleBrandingEntity_1.issuerLocaleBrandingEntityFrom)(localeBranding);
|
|
244
|
-
debug('Adding issuer locale branding', issuerLocaleBrandingEntity);
|
|
245
|
-
issuerLocaleBrandingEntity.issuerBranding = issuerBranding;
|
|
246
|
-
yield issuerLocaleBrandingRepository.save(issuerLocaleBrandingEntity, { transaction: true });
|
|
247
|
-
}));
|
|
248
|
-
yield Promise.all(addIssuerLocaleBranding);
|
|
249
|
-
const result = yield issuerBrandingRepository.findOne({
|
|
250
|
-
where: { id: args.issuerBrandingId },
|
|
251
|
-
});
|
|
252
|
-
if (!result) {
|
|
253
|
-
return Promise.reject(Error('Unable to get updated issuer branding'));
|
|
254
|
-
}
|
|
255
|
-
return this.issuerBrandingFrom(result);
|
|
256
|
-
});
|
|
257
|
-
this.getIssuerLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
258
|
-
if (args === null || args === void 0 ? void 0 : args.filter) {
|
|
259
|
-
args === null || args === void 0 ? void 0 : args.filter.forEach((filter) => {
|
|
260
|
-
if ('locale' in filter && filter.locale === undefined) {
|
|
261
|
-
filter.locale = '';
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
debug('Getting issuer locale branding', args);
|
|
266
|
-
const issuerLocaleBranding = yield (yield this.dbConnection)
|
|
267
|
-
.getRepository(IssuerLocaleBrandingEntity_1.IssuerLocaleBrandingEntity)
|
|
268
|
-
.find(Object.assign({}, ((args === null || args === void 0 ? void 0 : args.filter) && { where: args === null || args === void 0 ? void 0 : args.filter })));
|
|
269
|
-
return issuerLocaleBranding
|
|
270
|
-
? issuerLocaleBranding.map((issuerLocaleBranding) => this.localeBrandingFrom(issuerLocaleBranding))
|
|
271
|
-
: [];
|
|
272
|
-
});
|
|
273
|
-
this.removeIssuerLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
274
|
-
const issuerLocaleBranding = yield (yield this.dbConnection).getRepository(IssuerLocaleBrandingEntity_1.IssuerLocaleBrandingEntity).find({
|
|
275
|
-
where: args.filter,
|
|
276
|
-
});
|
|
277
|
-
debug('Removing credential locale branding', args);
|
|
278
|
-
const localeBrandingDeletions = issuerLocaleBranding.map((localeBranding) => __awaiter(this, void 0, void 0, function* () { return this.removeLocaleBranding(localeBranding); }));
|
|
279
|
-
yield Promise.all(localeBrandingDeletions);
|
|
280
|
-
});
|
|
281
|
-
this.updateIssuerLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
282
|
-
const repository = (yield this.dbConnection).getRepository(IssuerLocaleBrandingEntity_1.IssuerLocaleBrandingEntity);
|
|
283
|
-
const result = yield repository.findOne({
|
|
284
|
-
where: { id: args.localeBranding.id },
|
|
285
|
-
});
|
|
286
|
-
if (!result) {
|
|
287
|
-
return Promise.reject(Error(`No issuer locale branding found for id: ${args.localeBranding.id}`));
|
|
288
|
-
}
|
|
289
|
-
const locales = yield repository.find({
|
|
290
|
-
where: {
|
|
291
|
-
issuerBranding: {
|
|
292
|
-
id: result.issuerBrandingId,
|
|
293
|
-
},
|
|
294
|
-
id: (0, typeorm_1.Not)((0, typeorm_1.In)([args.localeBranding.id])),
|
|
295
|
-
locale: args.localeBranding.locale,
|
|
296
|
-
},
|
|
297
|
-
});
|
|
298
|
-
if (locales && locales.length > 0) {
|
|
299
|
-
return Promise.reject(Error(`Issuer branding: ${result.issuerBrandingId} already contains locale: ${args.localeBranding.locale}`));
|
|
300
|
-
}
|
|
301
|
-
debug('Updating issuer locale branding', args.localeBranding);
|
|
302
|
-
const updatedResult = yield repository.save(args.localeBranding, { transaction: true });
|
|
303
|
-
return this.localeBrandingFrom(updatedResult);
|
|
304
|
-
});
|
|
305
|
-
this.credentialBrandingFrom = (credentialBranding) => {
|
|
306
|
-
const result = Object.assign(Object.assign({}, credentialBranding), { localeBranding: credentialBranding.localeBranding.map((localeBranding) => this.localeBrandingFrom(localeBranding)) });
|
|
307
|
-
return this.replaceNullWithUndefined(result);
|
|
308
|
-
};
|
|
309
|
-
this.issuerBrandingFrom = (issuerBranding) => {
|
|
310
|
-
const result = Object.assign(Object.assign({}, issuerBranding), { localeBranding: issuerBranding.localeBranding.map((localeBranding) => this.localeBrandingFrom(localeBranding)) });
|
|
311
|
-
return this.replaceNullWithUndefined(result);
|
|
312
|
-
};
|
|
313
|
-
this.localeBrandingFrom = (localeBranding) => {
|
|
314
|
-
const result = Object.assign(Object.assign({}, localeBranding), { locale: localeBranding.locale === '' ? undefined : localeBranding.locale });
|
|
315
|
-
return this.replaceNullWithUndefined(result);
|
|
316
|
-
};
|
|
317
|
-
this.hasDuplicateLocales = (localeBranding) => __awaiter(this, void 0, void 0, function* () {
|
|
318
|
-
let seen = new Set();
|
|
319
|
-
return localeBranding.some((localeBranding) => {
|
|
320
|
-
return seen.size === seen.add(localeBranding.locale).size;
|
|
321
|
-
});
|
|
322
|
-
});
|
|
323
|
-
this.removeLocaleBranding = (localeBranding) => __awaiter(this, void 0, void 0, function* () {
|
|
324
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
325
|
-
debug('Removing credential locale branding', localeBranding);
|
|
326
|
-
// Delete background image dimensions
|
|
327
|
-
if ((_b = (_a = localeBranding.background) === null || _a === void 0 ? void 0 : _a.image) === null || _b === void 0 ? void 0 : _b.dimensions) {
|
|
328
|
-
yield (yield this.dbConnection).getRepository(ImageDimensionsEntity_1.ImageDimensionsEntity).delete({ id: (_e = (_d = (_c = localeBranding.background) === null || _c === void 0 ? void 0 : _c.image) === null || _d === void 0 ? void 0 : _d.dimensions) === null || _e === void 0 ? void 0 : _e.id });
|
|
329
|
-
}
|
|
330
|
-
// Delete background image
|
|
331
|
-
if ((_f = localeBranding.background) === null || _f === void 0 ? void 0 : _f.image) {
|
|
332
|
-
yield (yield this.dbConnection).getRepository(ImageAttributesEntity_1.ImageAttributesEntity).delete({ id: (_h = (_g = localeBranding.background) === null || _g === void 0 ? void 0 : _g.image) === null || _h === void 0 ? void 0 : _h.id });
|
|
333
|
-
}
|
|
334
|
-
// Delete background
|
|
335
|
-
if (localeBranding.background) {
|
|
336
|
-
yield (yield this.dbConnection).getRepository(BackgroundAttributesEntity_1.BackgroundAttributesEntity).delete({ id: (_j = localeBranding.background) === null || _j === void 0 ? void 0 : _j.id });
|
|
337
|
-
}
|
|
338
|
-
// Delete logo image dimensions
|
|
339
|
-
if ((_k = localeBranding.logo) === null || _k === void 0 ? void 0 : _k.dimensions) {
|
|
340
|
-
yield (yield this.dbConnection).getRepository(ImageDimensionsEntity_1.ImageDimensionsEntity).delete({ id: (_m = (_l = localeBranding.logo) === null || _l === void 0 ? void 0 : _l.dimensions) === null || _m === void 0 ? void 0 : _m.id });
|
|
341
|
-
}
|
|
342
|
-
// Delete logo
|
|
343
|
-
if (localeBranding.logo) {
|
|
344
|
-
yield (yield this.dbConnection).getRepository(ImageAttributesEntity_1.ImageAttributesEntity).delete({ id: (_o = localeBranding.logo) === null || _o === void 0 ? void 0 : _o.id });
|
|
345
|
-
}
|
|
346
|
-
// Delete text
|
|
347
|
-
if (localeBranding.text) {
|
|
348
|
-
yield (yield this.dbConnection).getRepository(TextAttributesEntity_1.TextAttributesEntity).delete({ id: (_p = localeBranding.text) === null || _p === void 0 ? void 0 : _p.id });
|
|
349
|
-
}
|
|
350
|
-
// Delete locale branding
|
|
351
|
-
yield (yield this.dbConnection).getRepository(CredentialLocaleBrandingEntity_1.CredentialLocaleBrandingEntity).delete({ id: localeBranding.id });
|
|
352
|
-
});
|
|
353
|
-
this.dbConnection = dbConnection;
|
|
354
|
-
}
|
|
355
|
-
replaceNullWithUndefined(obj) {
|
|
356
|
-
if (obj === null) {
|
|
357
|
-
return undefined;
|
|
358
|
-
}
|
|
359
|
-
if (typeof obj !== 'object' || obj instanceof Date) {
|
|
360
|
-
return obj;
|
|
361
|
-
}
|
|
362
|
-
if (Array.isArray(obj)) {
|
|
363
|
-
return obj.map((value) => this.replaceNullWithUndefined(value));
|
|
364
|
-
}
|
|
365
|
-
const result = {};
|
|
366
|
-
for (const key in obj) {
|
|
367
|
-
if (obj.hasOwnProperty(key)) {
|
|
368
|
-
result[key] = this.replaceNullWithUndefined(obj[key]);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
return result;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
exports.IssuanceBrandingStore = IssuanceBrandingStore;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.IssuanceBrandingStore = void 0;
|
|
16
|
+
const debug_1 = __importDefault(require("debug"));
|
|
17
|
+
const typeorm_1 = require("typeorm");
|
|
18
|
+
const BackgroundAttributesEntity_1 = require("../entities/issuanceBranding/BackgroundAttributesEntity");
|
|
19
|
+
const ImageAttributesEntity_1 = require("../entities/issuanceBranding/ImageAttributesEntity");
|
|
20
|
+
const ImageDimensionsEntity_1 = require("../entities/issuanceBranding/ImageDimensionsEntity");
|
|
21
|
+
const IssuerBrandingEntity_1 = require("../entities/issuanceBranding/IssuerBrandingEntity");
|
|
22
|
+
const CredentialBrandingEntity_1 = require("../entities/issuanceBranding/CredentialBrandingEntity");
|
|
23
|
+
const CredentialLocaleBrandingEntity_1 = require("../entities/issuanceBranding/CredentialLocaleBrandingEntity");
|
|
24
|
+
const IssuerLocaleBrandingEntity_1 = require("../entities/issuanceBranding/IssuerLocaleBrandingEntity");
|
|
25
|
+
const TextAttributesEntity_1 = require("../entities/issuanceBranding/TextAttributesEntity");
|
|
26
|
+
const AbstractIssuanceBrandingStore_1 = require("./AbstractIssuanceBrandingStore");
|
|
27
|
+
const debug = (0, debug_1.default)('sphereon:ssi-sdk:issuance-branding-store');
|
|
28
|
+
class IssuanceBrandingStore extends AbstractIssuanceBrandingStore_1.AbstractIssuanceBrandingStore {
|
|
29
|
+
constructor(dbConnection) {
|
|
30
|
+
super();
|
|
31
|
+
this.addCredentialBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const repository = (yield this.dbConnection).getRepository(CredentialBrandingEntity_1.CredentialBrandingEntity);
|
|
33
|
+
const result = yield repository.findOne({
|
|
34
|
+
where: [{ vcHash: args.vcHash }],
|
|
35
|
+
});
|
|
36
|
+
if (result) {
|
|
37
|
+
return Promise.reject(Error(`Credential branding already present for vc with hash: ${args.vcHash}`));
|
|
38
|
+
}
|
|
39
|
+
if (yield this.hasDuplicateLocales(args.localeBranding)) {
|
|
40
|
+
return Promise.reject(Error(`Credential branding contains duplicate locales`));
|
|
41
|
+
}
|
|
42
|
+
const credentialBrandingEntity = (0, CredentialBrandingEntity_1.credentialBrandingEntityFrom)(args);
|
|
43
|
+
debug('Adding credential branding', credentialBrandingEntity);
|
|
44
|
+
const createdResult = yield repository.save(credentialBrandingEntity);
|
|
45
|
+
return this.credentialBrandingFrom(createdResult);
|
|
46
|
+
});
|
|
47
|
+
this.getCredentialBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
if (args === null || args === void 0 ? void 0 : args.filter) {
|
|
49
|
+
args === null || args === void 0 ? void 0 : args.filter.forEach((filter) => {
|
|
50
|
+
if (filter.localeBranding && 'locale' in filter.localeBranding && filter.localeBranding.locale === undefined) {
|
|
51
|
+
filter.localeBranding.locale = '';
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
debug('Getting credential branding', args);
|
|
56
|
+
const result = yield (yield this.dbConnection).getRepository(CredentialBrandingEntity_1.CredentialBrandingEntity).find(Object.assign({}, ((args === null || args === void 0 ? void 0 : args.filter) && { where: args === null || args === void 0 ? void 0 : args.filter })));
|
|
57
|
+
return result.map((credentialBranding) => this.credentialBrandingFrom(credentialBranding));
|
|
58
|
+
});
|
|
59
|
+
this.removeCredentialBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const repository = (yield this.dbConnection).getRepository(CredentialBrandingEntity_1.CredentialBrandingEntity);
|
|
61
|
+
const credentialBranding = yield repository.find({
|
|
62
|
+
where: args.filter,
|
|
63
|
+
});
|
|
64
|
+
debug('Removing credential locale branding', args);
|
|
65
|
+
const localeBrandingDeletions = credentialBranding.map((credentialBranding) => credentialBranding.localeBranding.map((localeBranding) => __awaiter(this, void 0, void 0, function* () { return this.removeLocaleBranding(localeBranding); })));
|
|
66
|
+
yield Promise.all(localeBrandingDeletions);
|
|
67
|
+
debug('Removing credential branding', args);
|
|
68
|
+
const credentialBrandingDeletions = args.filter.map((filter) => __awaiter(this, void 0, void 0, function* () { return yield repository.delete(filter); }));
|
|
69
|
+
yield Promise.all(credentialBrandingDeletions);
|
|
70
|
+
});
|
|
71
|
+
this.updateCredentialBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const repository = (yield this.dbConnection).getRepository(CredentialBrandingEntity_1.CredentialBrandingEntity);
|
|
73
|
+
const credentialBrandingEntity = yield repository.findOne({
|
|
74
|
+
where: { id: args.credentialBranding.id },
|
|
75
|
+
});
|
|
76
|
+
if (!credentialBrandingEntity) {
|
|
77
|
+
return Promise.reject(Error(`No credential branding found for id: ${args.credentialBranding.id}`));
|
|
78
|
+
}
|
|
79
|
+
const credentialBranding = Object.assign(Object.assign({}, args.credentialBranding), { localeBranding: credentialBrandingEntity.localeBranding });
|
|
80
|
+
debug('Updating credential branding', credentialBranding);
|
|
81
|
+
const result = yield repository.save(credentialBranding, { transaction: true });
|
|
82
|
+
return this.credentialBrandingFrom(result);
|
|
83
|
+
});
|
|
84
|
+
this.addCredentialLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
const credentialBrandingRepository = (yield this.dbConnection).getRepository(CredentialBrandingEntity_1.CredentialBrandingEntity);
|
|
86
|
+
const credentialBranding = yield credentialBrandingRepository.findOne({
|
|
87
|
+
where: { id: args.credentialBrandingId },
|
|
88
|
+
});
|
|
89
|
+
if (!credentialBranding) {
|
|
90
|
+
return Promise.reject(Error(`No credential branding found for id: ${args.credentialBrandingId}`));
|
|
91
|
+
}
|
|
92
|
+
const locales = yield (yield this.dbConnection).getRepository(CredentialLocaleBrandingEntity_1.CredentialLocaleBrandingEntity).find({
|
|
93
|
+
where: {
|
|
94
|
+
credentialBranding: {
|
|
95
|
+
id: args.credentialBrandingId,
|
|
96
|
+
},
|
|
97
|
+
locale: (0, typeorm_1.In)(args.localeBranding.map((localeBranding) => localeBranding.locale)),
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
if (locales && locales.length > 0) {
|
|
101
|
+
return Promise.reject(Error(`Credential branding already contains locales: ${locales === null || locales === void 0 ? void 0 : locales.map((credentialLocaleBrandingEntity) => credentialLocaleBrandingEntity.locale)}`));
|
|
102
|
+
}
|
|
103
|
+
const credentialLocaleBrandingRepository = (yield this.dbConnection).getRepository(CredentialLocaleBrandingEntity_1.CredentialLocaleBrandingEntity);
|
|
104
|
+
const addCredentialLocaleBranding = args.localeBranding.map((localeBranding) => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
const credentialLocaleBrandingEntity = (0, CredentialLocaleBrandingEntity_1.credentialLocaleBrandingEntityFrom)(localeBranding);
|
|
106
|
+
debug('Adding credential locale branding', credentialLocaleBrandingEntity);
|
|
107
|
+
credentialLocaleBrandingEntity.credentialBranding = credentialBranding;
|
|
108
|
+
yield credentialLocaleBrandingRepository.save(credentialLocaleBrandingEntity, { transaction: true });
|
|
109
|
+
}));
|
|
110
|
+
yield Promise.all(addCredentialLocaleBranding);
|
|
111
|
+
const result = yield credentialBrandingRepository.findOne({
|
|
112
|
+
where: { id: args.credentialBrandingId },
|
|
113
|
+
});
|
|
114
|
+
if (!result) {
|
|
115
|
+
return Promise.reject(Error('Unable to get updated credential branding'));
|
|
116
|
+
}
|
|
117
|
+
return this.credentialBrandingFrom(result);
|
|
118
|
+
});
|
|
119
|
+
this.getCredentialLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
if (args === null || args === void 0 ? void 0 : args.filter) {
|
|
121
|
+
args === null || args === void 0 ? void 0 : args.filter.forEach((filter) => {
|
|
122
|
+
if ('locale' in filter && filter.locale === undefined) {
|
|
123
|
+
filter.locale = '';
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
debug('Getting credential locale branding', args);
|
|
128
|
+
const credentialBrandingLocale = yield (yield this.dbConnection)
|
|
129
|
+
.getRepository(CredentialLocaleBrandingEntity_1.CredentialLocaleBrandingEntity)
|
|
130
|
+
.find(Object.assign({}, ((args === null || args === void 0 ? void 0 : args.filter) && { where: args === null || args === void 0 ? void 0 : args.filter })));
|
|
131
|
+
return credentialBrandingLocale
|
|
132
|
+
? credentialBrandingLocale.map((credentialLocaleBranding) => this.localeBrandingFrom(credentialLocaleBranding))
|
|
133
|
+
: [];
|
|
134
|
+
});
|
|
135
|
+
this.removeCredentialLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
const credentialLocaleBranding = yield (yield this.dbConnection)
|
|
137
|
+
.getRepository(CredentialLocaleBrandingEntity_1.CredentialLocaleBrandingEntity)
|
|
138
|
+
.find({
|
|
139
|
+
where: args.filter,
|
|
140
|
+
});
|
|
141
|
+
debug('Removing credential locale branding', args);
|
|
142
|
+
const localeBrandingDeletions = credentialLocaleBranding.map((localeBranding) => __awaiter(this, void 0, void 0, function* () { return this.removeLocaleBranding(localeBranding); }));
|
|
143
|
+
yield Promise.all(localeBrandingDeletions);
|
|
144
|
+
});
|
|
145
|
+
this.updateCredentialLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
const repository = (yield this.dbConnection).getRepository(CredentialLocaleBrandingEntity_1.CredentialLocaleBrandingEntity);
|
|
147
|
+
const result = yield repository.findOne({
|
|
148
|
+
where: { id: args.localeBranding.id },
|
|
149
|
+
});
|
|
150
|
+
if (!result) {
|
|
151
|
+
return Promise.reject(Error(`No credential locale branding found for id: ${args.localeBranding.id}`));
|
|
152
|
+
}
|
|
153
|
+
const locales = yield repository.find({
|
|
154
|
+
where: {
|
|
155
|
+
credentialBranding: {
|
|
156
|
+
id: result.credentialBrandingId,
|
|
157
|
+
},
|
|
158
|
+
id: (0, typeorm_1.Not)((0, typeorm_1.In)([args.localeBranding.id])),
|
|
159
|
+
locale: args.localeBranding.locale,
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
if (locales && locales.length > 0) {
|
|
163
|
+
return Promise.reject(Error(`Credential branding: ${result.credentialBrandingId} already contains locale: ${args.localeBranding.locale}`));
|
|
164
|
+
}
|
|
165
|
+
debug('Updating credential locale branding', args.localeBranding);
|
|
166
|
+
const updatedResult = yield repository.save(args.localeBranding, { transaction: true });
|
|
167
|
+
return this.localeBrandingFrom(updatedResult);
|
|
168
|
+
});
|
|
169
|
+
this.addIssuerBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
const repository = (yield this.dbConnection).getRepository(IssuerBrandingEntity_1.IssuerBrandingEntity);
|
|
171
|
+
const result = yield repository.findOne({
|
|
172
|
+
where: [{ issuerCorrelationId: args.issuerCorrelationId }],
|
|
173
|
+
});
|
|
174
|
+
if (result) {
|
|
175
|
+
return Promise.reject(Error(`Issuer branding already present for issuer with correlation id: ${args.issuerCorrelationId}`));
|
|
176
|
+
}
|
|
177
|
+
if (yield this.hasDuplicateLocales(args.localeBranding)) {
|
|
178
|
+
return Promise.reject(Error(`Issuer branding contains duplicate locales`));
|
|
179
|
+
}
|
|
180
|
+
const issuerBrandingEntity = (0, IssuerBrandingEntity_1.issuerBrandingEntityFrom)(args);
|
|
181
|
+
debug('Adding issuer branding', issuerBrandingEntity);
|
|
182
|
+
const createdResult = yield repository.save(issuerBrandingEntity);
|
|
183
|
+
return this.issuerBrandingFrom(createdResult);
|
|
184
|
+
});
|
|
185
|
+
this.getIssuerBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
186
|
+
if (args === null || args === void 0 ? void 0 : args.filter) {
|
|
187
|
+
args === null || args === void 0 ? void 0 : args.filter.forEach((filter) => {
|
|
188
|
+
if (filter.localeBranding && 'locale' in filter.localeBranding && filter.localeBranding.locale === undefined) {
|
|
189
|
+
filter.localeBranding.locale = '';
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
debug('Getting issuer branding', args);
|
|
194
|
+
const result = yield (yield this.dbConnection).getRepository(IssuerBrandingEntity_1.IssuerBrandingEntity).find(Object.assign({}, ((args === null || args === void 0 ? void 0 : args.filter) && { where: args === null || args === void 0 ? void 0 : args.filter })));
|
|
195
|
+
return result.map((issuerBranding) => this.issuerBrandingFrom(issuerBranding));
|
|
196
|
+
});
|
|
197
|
+
this.removeIssuerBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
198
|
+
const repository = (yield this.dbConnection).getRepository(IssuerBrandingEntity_1.IssuerBrandingEntity);
|
|
199
|
+
const issuerBranding = yield repository.find({
|
|
200
|
+
where: args.filter,
|
|
201
|
+
});
|
|
202
|
+
debug('Removing issuer locale branding', args);
|
|
203
|
+
const localeBrandingDeletions = issuerBranding.map((issuerBranding) => issuerBranding.localeBranding.map((localeBranding) => __awaiter(this, void 0, void 0, function* () { return this.removeLocaleBranding(localeBranding); })));
|
|
204
|
+
yield Promise.all(localeBrandingDeletions);
|
|
205
|
+
debug('Removing issuer branding', args);
|
|
206
|
+
const issuerBrandingDeletions = args.filter.map((filter) => __awaiter(this, void 0, void 0, function* () { return yield repository.delete(filter); }));
|
|
207
|
+
yield Promise.all(issuerBrandingDeletions);
|
|
208
|
+
});
|
|
209
|
+
this.updateIssuerBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
210
|
+
const repository = (yield this.dbConnection).getRepository(IssuerBrandingEntity_1.IssuerBrandingEntity);
|
|
211
|
+
const issuerBrandingEntity = yield repository.findOne({
|
|
212
|
+
where: { id: args.issuerBranding.id },
|
|
213
|
+
});
|
|
214
|
+
if (!issuerBrandingEntity) {
|
|
215
|
+
return Promise.reject(Error(`No issuer branding found for id: ${args.issuerBranding.id}`));
|
|
216
|
+
}
|
|
217
|
+
const issuerBranding = Object.assign(Object.assign({}, args.issuerBranding), { localeBranding: issuerBrandingEntity.localeBranding });
|
|
218
|
+
debug('Updating issuer branding', issuerBranding);
|
|
219
|
+
const result = yield repository.save(issuerBranding, { transaction: true });
|
|
220
|
+
return this.issuerBrandingFrom(result);
|
|
221
|
+
});
|
|
222
|
+
this.addIssuerLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
223
|
+
const issuerBrandingRepository = (yield this.dbConnection).getRepository(IssuerBrandingEntity_1.IssuerBrandingEntity);
|
|
224
|
+
const issuerBranding = yield issuerBrandingRepository.findOne({
|
|
225
|
+
where: { id: args.issuerBrandingId },
|
|
226
|
+
});
|
|
227
|
+
if (!issuerBranding) {
|
|
228
|
+
return Promise.reject(Error(`No issuer branding found for id: ${args.issuerBrandingId}`));
|
|
229
|
+
}
|
|
230
|
+
const locales = yield (yield this.dbConnection).getRepository(IssuerLocaleBrandingEntity_1.IssuerLocaleBrandingEntity).find({
|
|
231
|
+
where: {
|
|
232
|
+
issuerBranding: {
|
|
233
|
+
id: args.issuerBrandingId,
|
|
234
|
+
},
|
|
235
|
+
locale: (0, typeorm_1.In)(args.localeBranding.map((localeBranding) => localeBranding.locale)),
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
if (locales && locales.length > 0) {
|
|
239
|
+
return Promise.reject(Error(`Issuer branding already contains locales: ${locales === null || locales === void 0 ? void 0 : locales.map((issuerLocaleBrandingEntity) => issuerLocaleBrandingEntity.locale)}`));
|
|
240
|
+
}
|
|
241
|
+
const issuerLocaleBrandingRepository = (yield this.dbConnection).getRepository(IssuerLocaleBrandingEntity_1.IssuerLocaleBrandingEntity);
|
|
242
|
+
const addIssuerLocaleBranding = args.localeBranding.map((localeBranding) => __awaiter(this, void 0, void 0, function* () {
|
|
243
|
+
const issuerLocaleBrandingEntity = (0, IssuerLocaleBrandingEntity_1.issuerLocaleBrandingEntityFrom)(localeBranding);
|
|
244
|
+
debug('Adding issuer locale branding', issuerLocaleBrandingEntity);
|
|
245
|
+
issuerLocaleBrandingEntity.issuerBranding = issuerBranding;
|
|
246
|
+
yield issuerLocaleBrandingRepository.save(issuerLocaleBrandingEntity, { transaction: true });
|
|
247
|
+
}));
|
|
248
|
+
yield Promise.all(addIssuerLocaleBranding);
|
|
249
|
+
const result = yield issuerBrandingRepository.findOne({
|
|
250
|
+
where: { id: args.issuerBrandingId },
|
|
251
|
+
});
|
|
252
|
+
if (!result) {
|
|
253
|
+
return Promise.reject(Error('Unable to get updated issuer branding'));
|
|
254
|
+
}
|
|
255
|
+
return this.issuerBrandingFrom(result);
|
|
256
|
+
});
|
|
257
|
+
this.getIssuerLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
258
|
+
if (args === null || args === void 0 ? void 0 : args.filter) {
|
|
259
|
+
args === null || args === void 0 ? void 0 : args.filter.forEach((filter) => {
|
|
260
|
+
if ('locale' in filter && filter.locale === undefined) {
|
|
261
|
+
filter.locale = '';
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
debug('Getting issuer locale branding', args);
|
|
266
|
+
const issuerLocaleBranding = yield (yield this.dbConnection)
|
|
267
|
+
.getRepository(IssuerLocaleBrandingEntity_1.IssuerLocaleBrandingEntity)
|
|
268
|
+
.find(Object.assign({}, ((args === null || args === void 0 ? void 0 : args.filter) && { where: args === null || args === void 0 ? void 0 : args.filter })));
|
|
269
|
+
return issuerLocaleBranding
|
|
270
|
+
? issuerLocaleBranding.map((issuerLocaleBranding) => this.localeBrandingFrom(issuerLocaleBranding))
|
|
271
|
+
: [];
|
|
272
|
+
});
|
|
273
|
+
this.removeIssuerLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
274
|
+
const issuerLocaleBranding = yield (yield this.dbConnection).getRepository(IssuerLocaleBrandingEntity_1.IssuerLocaleBrandingEntity).find({
|
|
275
|
+
where: args.filter,
|
|
276
|
+
});
|
|
277
|
+
debug('Removing credential locale branding', args);
|
|
278
|
+
const localeBrandingDeletions = issuerLocaleBranding.map((localeBranding) => __awaiter(this, void 0, void 0, function* () { return this.removeLocaleBranding(localeBranding); }));
|
|
279
|
+
yield Promise.all(localeBrandingDeletions);
|
|
280
|
+
});
|
|
281
|
+
this.updateIssuerLocaleBranding = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
282
|
+
const repository = (yield this.dbConnection).getRepository(IssuerLocaleBrandingEntity_1.IssuerLocaleBrandingEntity);
|
|
283
|
+
const result = yield repository.findOne({
|
|
284
|
+
where: { id: args.localeBranding.id },
|
|
285
|
+
});
|
|
286
|
+
if (!result) {
|
|
287
|
+
return Promise.reject(Error(`No issuer locale branding found for id: ${args.localeBranding.id}`));
|
|
288
|
+
}
|
|
289
|
+
const locales = yield repository.find({
|
|
290
|
+
where: {
|
|
291
|
+
issuerBranding: {
|
|
292
|
+
id: result.issuerBrandingId,
|
|
293
|
+
},
|
|
294
|
+
id: (0, typeorm_1.Not)((0, typeorm_1.In)([args.localeBranding.id])),
|
|
295
|
+
locale: args.localeBranding.locale,
|
|
296
|
+
},
|
|
297
|
+
});
|
|
298
|
+
if (locales && locales.length > 0) {
|
|
299
|
+
return Promise.reject(Error(`Issuer branding: ${result.issuerBrandingId} already contains locale: ${args.localeBranding.locale}`));
|
|
300
|
+
}
|
|
301
|
+
debug('Updating issuer locale branding', args.localeBranding);
|
|
302
|
+
const updatedResult = yield repository.save(args.localeBranding, { transaction: true });
|
|
303
|
+
return this.localeBrandingFrom(updatedResult);
|
|
304
|
+
});
|
|
305
|
+
this.credentialBrandingFrom = (credentialBranding) => {
|
|
306
|
+
const result = Object.assign(Object.assign({}, credentialBranding), { localeBranding: credentialBranding.localeBranding.map((localeBranding) => this.localeBrandingFrom(localeBranding)) });
|
|
307
|
+
return this.replaceNullWithUndefined(result);
|
|
308
|
+
};
|
|
309
|
+
this.issuerBrandingFrom = (issuerBranding) => {
|
|
310
|
+
const result = Object.assign(Object.assign({}, issuerBranding), { localeBranding: issuerBranding.localeBranding.map((localeBranding) => this.localeBrandingFrom(localeBranding)) });
|
|
311
|
+
return this.replaceNullWithUndefined(result);
|
|
312
|
+
};
|
|
313
|
+
this.localeBrandingFrom = (localeBranding) => {
|
|
314
|
+
const result = Object.assign(Object.assign({}, localeBranding), { locale: localeBranding.locale === '' ? undefined : localeBranding.locale });
|
|
315
|
+
return this.replaceNullWithUndefined(result);
|
|
316
|
+
};
|
|
317
|
+
this.hasDuplicateLocales = (localeBranding) => __awaiter(this, void 0, void 0, function* () {
|
|
318
|
+
let seen = new Set();
|
|
319
|
+
return localeBranding.some((localeBranding) => {
|
|
320
|
+
return seen.size === seen.add(localeBranding.locale).size;
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
this.removeLocaleBranding = (localeBranding) => __awaiter(this, void 0, void 0, function* () {
|
|
324
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
325
|
+
debug('Removing credential locale branding', localeBranding);
|
|
326
|
+
// Delete background image dimensions
|
|
327
|
+
if ((_b = (_a = localeBranding.background) === null || _a === void 0 ? void 0 : _a.image) === null || _b === void 0 ? void 0 : _b.dimensions) {
|
|
328
|
+
yield (yield this.dbConnection).getRepository(ImageDimensionsEntity_1.ImageDimensionsEntity).delete({ id: (_e = (_d = (_c = localeBranding.background) === null || _c === void 0 ? void 0 : _c.image) === null || _d === void 0 ? void 0 : _d.dimensions) === null || _e === void 0 ? void 0 : _e.id });
|
|
329
|
+
}
|
|
330
|
+
// Delete background image
|
|
331
|
+
if ((_f = localeBranding.background) === null || _f === void 0 ? void 0 : _f.image) {
|
|
332
|
+
yield (yield this.dbConnection).getRepository(ImageAttributesEntity_1.ImageAttributesEntity).delete({ id: (_h = (_g = localeBranding.background) === null || _g === void 0 ? void 0 : _g.image) === null || _h === void 0 ? void 0 : _h.id });
|
|
333
|
+
}
|
|
334
|
+
// Delete background
|
|
335
|
+
if (localeBranding.background) {
|
|
336
|
+
yield (yield this.dbConnection).getRepository(BackgroundAttributesEntity_1.BackgroundAttributesEntity).delete({ id: (_j = localeBranding.background) === null || _j === void 0 ? void 0 : _j.id });
|
|
337
|
+
}
|
|
338
|
+
// Delete logo image dimensions
|
|
339
|
+
if ((_k = localeBranding.logo) === null || _k === void 0 ? void 0 : _k.dimensions) {
|
|
340
|
+
yield (yield this.dbConnection).getRepository(ImageDimensionsEntity_1.ImageDimensionsEntity).delete({ id: (_m = (_l = localeBranding.logo) === null || _l === void 0 ? void 0 : _l.dimensions) === null || _m === void 0 ? void 0 : _m.id });
|
|
341
|
+
}
|
|
342
|
+
// Delete logo
|
|
343
|
+
if (localeBranding.logo) {
|
|
344
|
+
yield (yield this.dbConnection).getRepository(ImageAttributesEntity_1.ImageAttributesEntity).delete({ id: (_o = localeBranding.logo) === null || _o === void 0 ? void 0 : _o.id });
|
|
345
|
+
}
|
|
346
|
+
// Delete text
|
|
347
|
+
if (localeBranding.text) {
|
|
348
|
+
yield (yield this.dbConnection).getRepository(TextAttributesEntity_1.TextAttributesEntity).delete({ id: (_p = localeBranding.text) === null || _p === void 0 ? void 0 : _p.id });
|
|
349
|
+
}
|
|
350
|
+
// Delete locale branding
|
|
351
|
+
yield (yield this.dbConnection).getRepository(CredentialLocaleBrandingEntity_1.CredentialLocaleBrandingEntity).delete({ id: localeBranding.id });
|
|
352
|
+
});
|
|
353
|
+
this.dbConnection = dbConnection;
|
|
354
|
+
}
|
|
355
|
+
replaceNullWithUndefined(obj) {
|
|
356
|
+
if (obj === null) {
|
|
357
|
+
return undefined;
|
|
358
|
+
}
|
|
359
|
+
if (typeof obj !== 'object' || obj instanceof Date) {
|
|
360
|
+
return obj;
|
|
361
|
+
}
|
|
362
|
+
if (Array.isArray(obj)) {
|
|
363
|
+
return obj.map((value) => this.replaceNullWithUndefined(value));
|
|
364
|
+
}
|
|
365
|
+
const result = {};
|
|
366
|
+
for (const key in obj) {
|
|
367
|
+
if (obj.hasOwnProperty(key)) {
|
|
368
|
+
result[key] = this.replaceNullWithUndefined(obj[key]);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return result;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
exports.IssuanceBrandingStore = IssuanceBrandingStore;
|
|
375
375
|
//# sourceMappingURL=IssuanceBrandingStore.js.map
|