@sphereon/ssi-sdk.data-store 0.36.1-feature.vdx24.einvoice.inbox.141 → 0.36.1-feature.vdx24.einvoice.inbox.143
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/dist/index.cjs
CHANGED
|
@@ -5114,10 +5114,54 @@ var ContactStore = class extends import_ssi_sdk25.AbstractContactStore {
|
|
|
5114
5114
|
return Promise.reject(Error(`Connection type ${identity.connection.type}, does not match for provided config`));
|
|
5115
5115
|
}
|
|
5116
5116
|
}
|
|
5117
|
-
const
|
|
5117
|
+
const identityRepository = (await this.dbConnection).getRepository(IdentityEntity);
|
|
5118
|
+
const correlationIdentifierRepository = (await this.dbConnection).getRepository(CorrelationIdentifierEntity);
|
|
5119
|
+
const existingCorrelationIdentifier = await correlationIdentifierRepository.findOne({
|
|
5120
|
+
where: {
|
|
5121
|
+
correlationId: identity.identifier.correlationId
|
|
5122
|
+
}
|
|
5123
|
+
});
|
|
5124
|
+
if (existingCorrelationIdentifier) {
|
|
5125
|
+
const existingIdentity = await identityRepository.findOne({
|
|
5126
|
+
where: {
|
|
5127
|
+
identifier: {
|
|
5128
|
+
id: existingCorrelationIdentifier.id
|
|
5129
|
+
}
|
|
5130
|
+
}
|
|
5131
|
+
});
|
|
5132
|
+
if (existingIdentity) {
|
|
5133
|
+
debug("Identity with same correlationId already exists, returning existing identity", identity.identifier.correlationId);
|
|
5134
|
+
return identityFrom(existingIdentity);
|
|
5135
|
+
}
|
|
5136
|
+
}
|
|
5137
|
+
const existingAlias = await identityRepository.findOne({
|
|
5138
|
+
where: {
|
|
5139
|
+
alias: identity.alias
|
|
5140
|
+
}
|
|
5141
|
+
});
|
|
5142
|
+
let uniqueAlias = identity.alias;
|
|
5143
|
+
if (existingAlias) {
|
|
5144
|
+
let counter = 1;
|
|
5145
|
+
while (await identityRepository.findOne({
|
|
5146
|
+
where: {
|
|
5147
|
+
alias: `${identity.alias}_${counter}`
|
|
5148
|
+
}
|
|
5149
|
+
})) {
|
|
5150
|
+
counter++;
|
|
5151
|
+
}
|
|
5152
|
+
uniqueAlias = `${identity.alias}_${counter}`;
|
|
5153
|
+
debug("Alias collision detected, using unique alias", {
|
|
5154
|
+
original: identity.alias,
|
|
5155
|
+
unique: uniqueAlias
|
|
5156
|
+
});
|
|
5157
|
+
}
|
|
5158
|
+
const identityEntity = identityEntityFrom({
|
|
5159
|
+
...identity,
|
|
5160
|
+
alias: uniqueAlias
|
|
5161
|
+
});
|
|
5118
5162
|
identityEntity.party = party;
|
|
5119
5163
|
debug("Adding identity", identity);
|
|
5120
|
-
const result = await
|
|
5164
|
+
const result = await identityRepository.save(identityEntity, {
|
|
5121
5165
|
transaction: true
|
|
5122
5166
|
});
|
|
5123
5167
|
return identityFrom(result);
|
|
@@ -7069,8 +7113,9 @@ var import_debug7 = __toESM(require("debug"), 1);
|
|
|
7069
7113
|
var import_typeorm40 = require("typeorm");
|
|
7070
7114
|
|
|
7071
7115
|
// src/utils/presentationDefinition/MappingUtils.ts
|
|
7072
|
-
var
|
|
7116
|
+
var import_blakejs = __toESM(require("blakejs"), 1);
|
|
7073
7117
|
var import_dcql = require("dcql");
|
|
7118
|
+
var blake = import_blakejs.default.default ?? import_blakejs.default;
|
|
7074
7119
|
var dcqlQueryItemFrom = /* @__PURE__ */ __name((entity) => {
|
|
7075
7120
|
const result = {
|
|
7076
7121
|
id: entity.id,
|
|
@@ -7103,7 +7148,7 @@ var dcqlQueryEntityItemFrom = /* @__PURE__ */ __name((item) => {
|
|
|
7103
7148
|
return entity;
|
|
7104
7149
|
}, "dcqlQueryEntityItemFrom");
|
|
7105
7150
|
function hashPayload(payload) {
|
|
7106
|
-
return
|
|
7151
|
+
return blake.blake2bHex(JSON.stringify(payload));
|
|
7107
7152
|
}
|
|
7108
7153
|
__name(hashPayload, "hashPayload");
|
|
7109
7154
|
function isPresentationDefinitionEqual(base, compare) {
|