@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.js
CHANGED
|
@@ -4958,10 +4958,54 @@ var ContactStore = class extends AbstractContactStore {
|
|
|
4958
4958
|
return Promise.reject(Error(`Connection type ${identity.connection.type}, does not match for provided config`));
|
|
4959
4959
|
}
|
|
4960
4960
|
}
|
|
4961
|
-
const
|
|
4961
|
+
const identityRepository = (await this.dbConnection).getRepository(IdentityEntity);
|
|
4962
|
+
const correlationIdentifierRepository = (await this.dbConnection).getRepository(CorrelationIdentifierEntity);
|
|
4963
|
+
const existingCorrelationIdentifier = await correlationIdentifierRepository.findOne({
|
|
4964
|
+
where: {
|
|
4965
|
+
correlationId: identity.identifier.correlationId
|
|
4966
|
+
}
|
|
4967
|
+
});
|
|
4968
|
+
if (existingCorrelationIdentifier) {
|
|
4969
|
+
const existingIdentity = await identityRepository.findOne({
|
|
4970
|
+
where: {
|
|
4971
|
+
identifier: {
|
|
4972
|
+
id: existingCorrelationIdentifier.id
|
|
4973
|
+
}
|
|
4974
|
+
}
|
|
4975
|
+
});
|
|
4976
|
+
if (existingIdentity) {
|
|
4977
|
+
debug("Identity with same correlationId already exists, returning existing identity", identity.identifier.correlationId);
|
|
4978
|
+
return identityFrom(existingIdentity);
|
|
4979
|
+
}
|
|
4980
|
+
}
|
|
4981
|
+
const existingAlias = await identityRepository.findOne({
|
|
4982
|
+
where: {
|
|
4983
|
+
alias: identity.alias
|
|
4984
|
+
}
|
|
4985
|
+
});
|
|
4986
|
+
let uniqueAlias = identity.alias;
|
|
4987
|
+
if (existingAlias) {
|
|
4988
|
+
let counter = 1;
|
|
4989
|
+
while (await identityRepository.findOne({
|
|
4990
|
+
where: {
|
|
4991
|
+
alias: `${identity.alias}_${counter}`
|
|
4992
|
+
}
|
|
4993
|
+
})) {
|
|
4994
|
+
counter++;
|
|
4995
|
+
}
|
|
4996
|
+
uniqueAlias = `${identity.alias}_${counter}`;
|
|
4997
|
+
debug("Alias collision detected, using unique alias", {
|
|
4998
|
+
original: identity.alias,
|
|
4999
|
+
unique: uniqueAlias
|
|
5000
|
+
});
|
|
5001
|
+
}
|
|
5002
|
+
const identityEntity = identityEntityFrom({
|
|
5003
|
+
...identity,
|
|
5004
|
+
alias: uniqueAlias
|
|
5005
|
+
});
|
|
4962
5006
|
identityEntity.party = party;
|
|
4963
5007
|
debug("Adding identity", identity);
|
|
4964
|
-
const result = await
|
|
5008
|
+
const result = await identityRepository.save(identityEntity, {
|
|
4965
5009
|
transaction: true
|
|
4966
5010
|
});
|
|
4967
5011
|
return identityFrom(result);
|
|
@@ -6913,8 +6957,9 @@ import Debug7 from "debug";
|
|
|
6913
6957
|
import { In as In4 } from "typeorm";
|
|
6914
6958
|
|
|
6915
6959
|
// src/utils/presentationDefinition/MappingUtils.ts
|
|
6916
|
-
import
|
|
6960
|
+
import blakejs from "blakejs";
|
|
6917
6961
|
import { DcqlQuery } from "dcql";
|
|
6962
|
+
var blake = blakejs.default ?? blakejs;
|
|
6918
6963
|
var dcqlQueryItemFrom = /* @__PURE__ */ __name((entity) => {
|
|
6919
6964
|
const result = {
|
|
6920
6965
|
id: entity.id,
|
|
@@ -6947,7 +6992,7 @@ var dcqlQueryEntityItemFrom = /* @__PURE__ */ __name((item) => {
|
|
|
6947
6992
|
return entity;
|
|
6948
6993
|
}, "dcqlQueryEntityItemFrom");
|
|
6949
6994
|
function hashPayload(payload) {
|
|
6950
|
-
return
|
|
6995
|
+
return blake.blake2bHex(JSON.stringify(payload));
|
|
6951
6996
|
}
|
|
6952
6997
|
__name(hashPayload, "hashPayload");
|
|
6953
6998
|
function isPresentationDefinitionEqual(base, compare) {
|