@sphereon/ssi-sdk.data-store 0.36.1-feature.fides.fixes.111 → 0.36.1-feature.fides.fixes.119
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 +38 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +38 -11
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/contact/ContactStore.ts +4 -1
- package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +3 -1
- package/src/issuanceBranding/IssuanceBrandingStore.ts +37 -9
- package/src/migrations/sqlite/1766000000000-AddBrandingState.ts +15 -2
package/dist/index.js
CHANGED
|
@@ -3118,7 +3118,9 @@ var CredentialBrandingEntity = class extends BaseEntity19 {
|
|
|
3118
3118
|
this.lastUpdatedAt = /* @__PURE__ */ new Date();
|
|
3119
3119
|
}
|
|
3120
3120
|
setState() {
|
|
3121
|
-
this.
|
|
3121
|
+
if (this.localeBranding && Array.isArray(this.localeBranding)) {
|
|
3122
|
+
this.state = this.computeState();
|
|
3123
|
+
}
|
|
3122
3124
|
}
|
|
3123
3125
|
async validate() {
|
|
3124
3126
|
const validation = await validate16(this);
|
|
@@ -4826,7 +4828,10 @@ var ContactStore = class extends AbstractContactStore {
|
|
|
4826
4828
|
const result = await partyRepository.find({
|
|
4827
4829
|
where: {
|
|
4828
4830
|
id: In(initialResult.map((party) => party.id))
|
|
4829
|
-
}
|
|
4831
|
+
},
|
|
4832
|
+
relations: [
|
|
4833
|
+
"contact"
|
|
4834
|
+
]
|
|
4830
4835
|
});
|
|
4831
4836
|
debug(`getParties() resulted in ${result.length} parties`);
|
|
4832
4837
|
return result.filter((party) => {
|
|
@@ -5775,19 +5780,39 @@ var IssuanceBrandingStore = class extends AbstractIssuanceBrandingStore {
|
|
|
5775
5780
|
});
|
|
5776
5781
|
}
|
|
5777
5782
|
debug3("Getting credential branding", args);
|
|
5778
|
-
const
|
|
5783
|
+
const repository = (await this.dbConnection).getRepository(CredentialBrandingEntity);
|
|
5784
|
+
if (knownStates && Object.keys(knownStates).length > 0) {
|
|
5785
|
+
const stateQuery = repository.createQueryBuilder("branding").select([
|
|
5786
|
+
"branding.id",
|
|
5787
|
+
"branding.state"
|
|
5788
|
+
]);
|
|
5789
|
+
if (filter) {
|
|
5790
|
+
stateQuery.where(filter);
|
|
5791
|
+
}
|
|
5792
|
+
const stateResults = await stateQuery.getRawMany().then((rows) => rows.map((row) => ({
|
|
5793
|
+
id: row.branding_id,
|
|
5794
|
+
state: row.branding_state
|
|
5795
|
+
})));
|
|
5796
|
+
const dirtyIds = stateResults.filter((result3) => {
|
|
5797
|
+
const knownState = knownStates[result3.id];
|
|
5798
|
+
return !knownState || knownState !== result3.state;
|
|
5799
|
+
}).map((result3) => result3.id);
|
|
5800
|
+
if (dirtyIds.length === 0) {
|
|
5801
|
+
return [];
|
|
5802
|
+
}
|
|
5803
|
+
const result2 = await repository.find({
|
|
5804
|
+
where: {
|
|
5805
|
+
id: In2(dirtyIds)
|
|
5806
|
+
}
|
|
5807
|
+
});
|
|
5808
|
+
return result2.map((branding) => credentialBrandingFrom(branding));
|
|
5809
|
+
}
|
|
5810
|
+
const result = await repository.find({
|
|
5779
5811
|
...filter && {
|
|
5780
5812
|
where: filter
|
|
5781
5813
|
}
|
|
5782
5814
|
});
|
|
5783
|
-
|
|
5784
|
-
if (!knownStates) {
|
|
5785
|
-
return credentialBranding;
|
|
5786
|
-
}
|
|
5787
|
-
return credentialBranding.filter((branding) => {
|
|
5788
|
-
const knownState = knownStates[branding.id];
|
|
5789
|
-
return !knownState || knownState !== branding.state;
|
|
5790
|
-
});
|
|
5815
|
+
return result.map((branding) => credentialBrandingFrom(branding));
|
|
5791
5816
|
}, "getCredentialBranding");
|
|
5792
5817
|
removeCredentialBranding = /* @__PURE__ */ __name(async (args) => {
|
|
5793
5818
|
const { filter } = args;
|
|
@@ -8170,6 +8195,7 @@ var AddBrandingStateSqlite1766000000000 = class {
|
|
|
8170
8195
|
await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD COLUMN "state" varchar(255) NOT NULL DEFAULT ''`);
|
|
8171
8196
|
}
|
|
8172
8197
|
async down(queryRunner) {
|
|
8198
|
+
await queryRunner.query(`PRAGMA foreign_keys = OFF`);
|
|
8173
8199
|
await queryRunner.query(`
|
|
8174
8200
|
CREATE TABLE "CredentialBranding_old"
|
|
8175
8201
|
(
|
|
@@ -8228,6 +8254,7 @@ var AddBrandingStateSqlite1766000000000 = class {
|
|
|
8228
8254
|
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale" ON "BaseLocaleBranding" ("credentialBrandingId", "locale")`);
|
|
8229
8255
|
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale" ON "BaseLocaleBranding" ("issuerBrandingId", "locale")`);
|
|
8230
8256
|
await queryRunner.query(`CREATE INDEX "IDX_BaseLocaleBranding_type" ON "BaseLocaleBranding" ("type")`);
|
|
8257
|
+
await queryRunner.query(`PRAGMA foreign_keys = ON`);
|
|
8231
8258
|
}
|
|
8232
8259
|
};
|
|
8233
8260
|
|