@sphereon/ssi-sdk.data-store 0.36.1-feature.vdx24.einvoice.inbox.127 → 0.36.1-feature.vdx24.einvoice.inbox.138

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
@@ -2874,10 +2874,23 @@ BaseLocaleBrandingEntity = _ts_decorate24([
2874
2874
  // src/entities/issuanceBranding/CredentialBrandingEntity.ts
2875
2875
  import { typeOrmDateTime as typeOrmDateTime13 } from "@sphereon/ssi-sdk.agent-config";
2876
2876
  import { ArrayMinSize, IsNotEmpty as IsNotEmpty10, validate as validate16 } from "class-validator";
2877
- import { BaseEntity as BaseEntity19, BeforeInsert as BeforeInsert18, BeforeUpdate as BeforeUpdate18, Column as Column24, CreateDateColumn as CreateDateColumn11, Entity as Entity21, Index as Index5, OneToMany as OneToMany6, PrimaryGeneratedColumn as PrimaryGeneratedColumn21, UpdateDateColumn as UpdateDateColumn11 } from "typeorm";
2877
+ import { BaseEntity as BaseEntity19, BeforeInsert as BeforeInsert19, BeforeUpdate as BeforeUpdate19, Column as Column24, CreateDateColumn as CreateDateColumn11, Entity as Entity21, Index as Index5, OneToMany as OneToMany6, PrimaryGeneratedColumn as PrimaryGeneratedColumn21, UpdateDateColumn as UpdateDateColumn11 } from "typeorm";
2878
2878
 
2879
2879
  // src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts
2880
- import { ChildEntity as ChildEntity5, Column as Column23, Index as Index4, JoinColumn as JoinColumn11, ManyToOne as ManyToOne9, OneToMany as OneToMany5 } from "typeorm";
2880
+ import { BeforeInsert as BeforeInsert18, BeforeUpdate as BeforeUpdate18, ChildEntity as ChildEntity5, Column as Column23, Index as Index4, JoinColumn as JoinColumn11, ManyToOne as ManyToOne9, OneToMany as OneToMany5 } from "typeorm";
2881
+
2882
+ // src/utils/issuanceBranding/HashUtils.ts
2883
+ var FNV_PRIME = 0x100000001b3n;
2884
+ var OFFSET_BASIS = 0xcbf29ce484222325n;
2885
+ function computeCompactHash(input) {
2886
+ let hash = OFFSET_BASIS;
2887
+ for (let i = 0; i < input.length; i++) {
2888
+ hash ^= BigInt(input.charCodeAt(i));
2889
+ hash = hash * FNV_PRIME & 0xffffffffffffffffn;
2890
+ }
2891
+ return hash.toString(36);
2892
+ }
2893
+ __name(computeCompactHash, "computeCompactHash");
2881
2894
 
2882
2895
  // src/entities/issuanceBranding/CredentialClaimsEntity.ts
2883
2896
  import { validate as validate15, Validate as Validate8 } from "class-validator";
@@ -2983,6 +2996,10 @@ var CredentialLocaleBrandingEntity = class extends BaseLocaleBrandingEntity {
2983
2996
  credentialBranding;
2984
2997
  claims;
2985
2998
  credentialBrandingId;
2999
+ state;
3000
+ setState() {
3001
+ this.state = computeCredentialLocaleBrandingState(this);
3002
+ }
2986
3003
  };
2987
3004
  _ts_decorate26([
2988
3005
  ManyToOne9(() => CredentialBrandingEntity, (credentialBranding) => credentialBranding.localeBranding, {
@@ -3012,6 +3029,21 @@ _ts_decorate26([
3012
3029
  }),
3013
3030
  _ts_metadata25("design:type", String)
3014
3031
  ], CredentialLocaleBrandingEntity.prototype, "credentialBrandingId", void 0);
3032
+ _ts_decorate26([
3033
+ Column23("varchar", {
3034
+ name: "state",
3035
+ length: 255,
3036
+ nullable: false
3037
+ }),
3038
+ _ts_metadata25("design:type", String)
3039
+ ], CredentialLocaleBrandingEntity.prototype, "state", void 0);
3040
+ _ts_decorate26([
3041
+ BeforeInsert18(),
3042
+ BeforeUpdate18(),
3043
+ _ts_metadata25("design:type", Function),
3044
+ _ts_metadata25("design:paramtypes", []),
3045
+ _ts_metadata25("design:returntype", void 0)
3046
+ ], CredentialLocaleBrandingEntity.prototype, "setState", null);
3015
3047
  CredentialLocaleBrandingEntity = _ts_decorate26([
3016
3048
  ChildEntity5("CredentialLocaleBranding"),
3017
3049
  Index4("IDX_CredentialLocaleBrandingEntity_credentialBranding_locale", [
@@ -3021,6 +3053,45 @@ CredentialLocaleBrandingEntity = _ts_decorate26([
3021
3053
  unique: true
3022
3054
  })
3023
3055
  ], CredentialLocaleBrandingEntity);
3056
+ var computeCredentialLocaleBrandingState = /* @__PURE__ */ __name((localeBranding) => {
3057
+ const sortedClaims = (localeBranding.claims ?? []).map((claim) => ({
3058
+ key: claim.key,
3059
+ name: claim.name
3060
+ })).sort((first, second) => first.key.localeCompare(second.key));
3061
+ const payload = {
3062
+ alias: localeBranding.alias ?? null,
3063
+ locale: localeBranding.locale ?? null,
3064
+ description: localeBranding.description ?? null,
3065
+ logo: localeBranding.logo ? {
3066
+ uri: localeBranding.logo.uri ?? null,
3067
+ dataUri: localeBranding.logo.dataUri ?? null,
3068
+ mediaType: localeBranding.logo.mediaType ?? null,
3069
+ alt: localeBranding.logo.alt ?? null,
3070
+ dimensions: localeBranding.logo.dimensions ? {
3071
+ width: localeBranding.logo.dimensions.width,
3072
+ height: localeBranding.logo.dimensions.height
3073
+ } : null
3074
+ } : null,
3075
+ background: localeBranding.background ? {
3076
+ color: localeBranding.background.color ?? null,
3077
+ image: localeBranding.background.image ? {
3078
+ uri: localeBranding.background.image.uri ?? null,
3079
+ dataUri: localeBranding.background.image.dataUri ?? null,
3080
+ mediaType: localeBranding.background.image.mediaType ?? null,
3081
+ alt: localeBranding.background.image.alt ?? null,
3082
+ dimensions: localeBranding.background.image.dimensions ? {
3083
+ width: localeBranding.background.image.dimensions.width,
3084
+ height: localeBranding.background.image.dimensions.height
3085
+ } : null
3086
+ } : null
3087
+ } : null,
3088
+ text: localeBranding.text ? {
3089
+ color: localeBranding.text.color ?? null
3090
+ } : null,
3091
+ claims: sortedClaims
3092
+ };
3093
+ return computeCompactHash(JSON.stringify(payload));
3094
+ }, "computeCredentialLocaleBrandingState");
3024
3095
 
3025
3096
  // src/entities/issuanceBranding/CredentialBrandingEntity.ts
3026
3097
  function _ts_decorate27(decorators, target, key, desc) {
@@ -3041,6 +3112,7 @@ var CredentialBrandingEntity = class extends BaseEntity19 {
3041
3112
  id;
3042
3113
  vcHash;
3043
3114
  issuerCorrelationId;
3115
+ state;
3044
3116
  localeBranding;
3045
3117
  createdAt;
3046
3118
  lastUpdatedAt;
@@ -3048,6 +3120,11 @@ var CredentialBrandingEntity = class extends BaseEntity19 {
3048
3120
  updateUpdatedDate() {
3049
3121
  this.lastUpdatedAt = /* @__PURE__ */ new Date();
3050
3122
  }
3123
+ setState() {
3124
+ if (this.localeBranding && Array.isArray(this.localeBranding)) {
3125
+ this.state = this.computeState();
3126
+ }
3127
+ }
3051
3128
  async validate() {
3052
3129
  const validation = await validate16(this);
3053
3130
  if (validation.length > 0) {
@@ -3055,6 +3132,31 @@ var CredentialBrandingEntity = class extends BaseEntity19 {
3055
3132
  }
3056
3133
  return;
3057
3134
  }
3135
+ computeState() {
3136
+ const localeStates = (this.localeBranding ?? []).map((localeBranding) => ({
3137
+ locale: localeBranding.locale ?? "",
3138
+ alias: localeBranding.alias ?? "",
3139
+ id: localeBranding.id ?? "",
3140
+ state: computeCredentialLocaleBrandingState(localeBranding)
3141
+ }));
3142
+ localeStates.sort((first, second) => {
3143
+ const localeCompare = first.locale.localeCompare(second.locale);
3144
+ if (localeCompare !== 0) {
3145
+ return localeCompare;
3146
+ }
3147
+ const aliasCompare = first.alias.localeCompare(second.alias);
3148
+ if (aliasCompare !== 0) {
3149
+ return aliasCompare;
3150
+ }
3151
+ return first.id.localeCompare(second.id);
3152
+ });
3153
+ const payload = {
3154
+ issuerCorrelationId: this.issuerCorrelationId,
3155
+ vcHash: this.vcHash,
3156
+ localeBranding: localeStates.map((entry) => entry.state)
3157
+ };
3158
+ return computeCompactHash(JSON.stringify(payload));
3159
+ }
3058
3160
  };
3059
3161
  _ts_decorate27([
3060
3162
  PrimaryGeneratedColumn21("uuid"),
@@ -3084,6 +3186,14 @@ _ts_decorate27([
3084
3186
  }),
3085
3187
  _ts_metadata26("design:type", String)
3086
3188
  ], CredentialBrandingEntity.prototype, "issuerCorrelationId", void 0);
3189
+ _ts_decorate27([
3190
+ Column24("varchar", {
3191
+ name: "state",
3192
+ length: 255,
3193
+ nullable: false
3194
+ }),
3195
+ _ts_metadata26("design:type", String)
3196
+ ], CredentialBrandingEntity.prototype, "state", void 0);
3087
3197
  _ts_decorate27([
3088
3198
  OneToMany6(() => CredentialLocaleBrandingEntity, (credentialLocaleBrandingEntity) => credentialLocaleBrandingEntity.credentialBranding, {
3089
3199
  cascade: true,
@@ -3113,15 +3223,22 @@ _ts_decorate27([
3113
3223
  _ts_metadata26("design:type", typeof Date === "undefined" ? Object : Date)
3114
3224
  ], CredentialBrandingEntity.prototype, "lastUpdatedAt", void 0);
3115
3225
  _ts_decorate27([
3116
- BeforeInsert18(),
3117
- BeforeUpdate18(),
3226
+ BeforeInsert19(),
3227
+ BeforeUpdate19(),
3118
3228
  _ts_metadata26("design:type", Function),
3119
3229
  _ts_metadata26("design:paramtypes", []),
3120
3230
  _ts_metadata26("design:returntype", void 0)
3121
3231
  ], CredentialBrandingEntity.prototype, "updateUpdatedDate", null);
3122
3232
  _ts_decorate27([
3123
- BeforeInsert18(),
3124
- BeforeUpdate18(),
3233
+ BeforeInsert19(),
3234
+ BeforeUpdate19(),
3235
+ _ts_metadata26("design:type", Function),
3236
+ _ts_metadata26("design:paramtypes", []),
3237
+ _ts_metadata26("design:returntype", void 0)
3238
+ ], CredentialBrandingEntity.prototype, "setState", null);
3239
+ _ts_decorate27([
3240
+ BeforeInsert19(),
3241
+ BeforeUpdate19(),
3125
3242
  _ts_metadata26("design:type", Function),
3126
3243
  _ts_metadata26("design:paramtypes", []),
3127
3244
  _ts_metadata26("design:returntype", Promise)
@@ -3139,11 +3256,11 @@ CredentialBrandingEntity = _ts_decorate27([
3139
3256
  // src/entities/issuanceBranding/IssuerBrandingEntity.ts
3140
3257
  import { typeOrmDateTime as typeOrmDateTime14 } from "@sphereon/ssi-sdk.agent-config";
3141
3258
  import { ArrayMinSize as ArrayMinSize2, IsNotEmpty as IsNotEmpty11, validate as validate17 } from "class-validator";
3142
- import { BaseEntity as BaseEntity20, BeforeInsert as BeforeInsert19, BeforeUpdate as BeforeUpdate19, Column as Column26, CreateDateColumn as CreateDateColumn12, Entity as Entity22, Index as Index7, OneToMany as OneToMany7, PrimaryGeneratedColumn as PrimaryGeneratedColumn22, UpdateDateColumn as UpdateDateColumn12 } from "typeorm";
3259
+ import { BaseEntity as BaseEntity20, BeforeInsert as BeforeInsert21, BeforeUpdate as BeforeUpdate21, Column as Column26, CreateDateColumn as CreateDateColumn12, Entity as Entity22, Index as Index7, OneToMany as OneToMany7, PrimaryGeneratedColumn as PrimaryGeneratedColumn22, UpdateDateColumn as UpdateDateColumn12 } from "typeorm";
3143
3260
 
3144
3261
  // src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts
3145
3262
  import { Validate as Validate9 } from "class-validator";
3146
- import { ChildEntity as ChildEntity6, Column as Column25, Index as Index6, JoinColumn as JoinColumn12, ManyToOne as ManyToOne10 } from "typeorm";
3263
+ import { BeforeInsert as BeforeInsert20, BeforeUpdate as BeforeUpdate20, ChildEntity as ChildEntity6, Column as Column25, Index as Index6, JoinColumn as JoinColumn12, ManyToOne as ManyToOne10 } from "typeorm";
3147
3264
  function _ts_decorate28(decorators, target, key, desc) {
3148
3265
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3149
3266
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -3165,6 +3282,48 @@ var IssuerLocaleBrandingEntity = class extends BaseLocaleBrandingEntity {
3165
3282
  policyUri;
3166
3283
  contacts;
3167
3284
  issuerBrandingId;
3285
+ state;
3286
+ setState() {
3287
+ this.state = this.computeState();
3288
+ }
3289
+ computeState() {
3290
+ const payload = {
3291
+ alias: this.alias ?? null,
3292
+ locale: this.locale ?? null,
3293
+ description: this.description ?? null,
3294
+ clientUri: this.clientUri ?? null,
3295
+ tosUri: this.tosUri ?? null,
3296
+ policyUri: this.policyUri ?? null,
3297
+ contacts: this.contacts ?? null,
3298
+ logo: this.logo ? {
3299
+ uri: this.logo.uri ?? null,
3300
+ dataUri: this.logo.dataUri ?? null,
3301
+ mediaType: this.logo.mediaType ?? null,
3302
+ alt: this.logo.alt ?? null,
3303
+ dimensions: this.logo.dimensions ? {
3304
+ width: this.logo.dimensions.width,
3305
+ height: this.logo.dimensions.height
3306
+ } : null
3307
+ } : null,
3308
+ background: this.background ? {
3309
+ color: this.background.color ?? null,
3310
+ image: this.background.image ? {
3311
+ uri: this.background.image.uri ?? null,
3312
+ dataUri: this.background.image.dataUri ?? null,
3313
+ mediaType: this.background.image.mediaType ?? null,
3314
+ alt: this.background.image.alt ?? null,
3315
+ dimensions: this.background.image.dimensions ? {
3316
+ width: this.background.image.dimensions.width,
3317
+ height: this.background.image.dimensions.height
3318
+ } : null
3319
+ } : null
3320
+ } : null,
3321
+ text: this.text ? {
3322
+ color: this.text.color ?? null
3323
+ } : null
3324
+ };
3325
+ return computeCompactHash(JSON.stringify(payload));
3326
+ }
3168
3327
  };
3169
3328
  _ts_decorate28([
3170
3329
  ManyToOne10(() => IssuerBrandingEntity, (issuerBranding) => issuerBranding.localeBranding, {
@@ -3223,6 +3382,21 @@ _ts_decorate28([
3223
3382
  }),
3224
3383
  _ts_metadata27("design:type", String)
3225
3384
  ], IssuerLocaleBrandingEntity.prototype, "issuerBrandingId", void 0);
3385
+ _ts_decorate28([
3386
+ Column25("varchar", {
3387
+ name: "state",
3388
+ length: 255,
3389
+ nullable: false
3390
+ }),
3391
+ _ts_metadata27("design:type", String)
3392
+ ], IssuerLocaleBrandingEntity.prototype, "state", void 0);
3393
+ _ts_decorate28([
3394
+ BeforeInsert20(),
3395
+ BeforeUpdate20(),
3396
+ _ts_metadata27("design:type", Function),
3397
+ _ts_metadata27("design:paramtypes", []),
3398
+ _ts_metadata27("design:returntype", void 0)
3399
+ ], IssuerLocaleBrandingEntity.prototype, "setState", null);
3226
3400
  IssuerLocaleBrandingEntity = _ts_decorate28([
3227
3401
  ChildEntity6("IssuerLocaleBranding"),
3228
3402
  Index6("IDX_IssuerLocaleBrandingEntity_issuerBranding_locale", [
@@ -3311,15 +3485,15 @@ _ts_decorate29([
3311
3485
  _ts_metadata28("design:type", typeof Date === "undefined" ? Object : Date)
3312
3486
  ], IssuerBrandingEntity.prototype, "lastUpdatedAt", void 0);
3313
3487
  _ts_decorate29([
3314
- BeforeInsert19(),
3315
- BeforeUpdate19(),
3488
+ BeforeInsert21(),
3489
+ BeforeUpdate21(),
3316
3490
  _ts_metadata28("design:type", Function),
3317
3491
  _ts_metadata28("design:paramtypes", []),
3318
3492
  _ts_metadata28("design:returntype", void 0)
3319
3493
  ], IssuerBrandingEntity.prototype, "updateUpdatedDate", null);
3320
3494
  _ts_decorate29([
3321
- BeforeInsert19(),
3322
- BeforeUpdate19(),
3495
+ BeforeInsert21(),
3496
+ BeforeUpdate21(),
3323
3497
  _ts_metadata28("design:type", Function),
3324
3498
  _ts_metadata28("design:paramtypes", []),
3325
3499
  _ts_metadata28("design:returntype", Promise)
@@ -3570,7 +3744,7 @@ Oid4vcStateEntity = _ts_decorate31([
3570
3744
  // src/entities/presentationDefinition/DcqlQueryItemEntity.ts
3571
3745
  import { typeOrmDateTime as typeOrmDateTime17 } from "@sphereon/ssi-sdk.agent-config";
3572
3746
  import { IsNotEmpty as IsNotEmpty12 } from "class-validator";
3573
- import { BaseEntity as BaseEntity23, BeforeInsert as BeforeInsert20, BeforeUpdate as BeforeUpdate20, Column as Column29, CreateDateColumn as CreateDateColumn15, Entity as Entity25, Index as Index8, PrimaryGeneratedColumn as PrimaryGeneratedColumn23, UpdateDateColumn as UpdateDateColumn15 } from "typeorm";
3747
+ import { BaseEntity as BaseEntity23, BeforeInsert as BeforeInsert22, BeforeUpdate as BeforeUpdate22, Column as Column29, CreateDateColumn as CreateDateColumn15, Entity as Entity25, Index as Index8, PrimaryGeneratedColumn as PrimaryGeneratedColumn23, UpdateDateColumn as UpdateDateColumn15 } from "typeorm";
3574
3748
  function _ts_decorate32(decorators, target, key, desc) {
3575
3749
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3576
3750
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -3689,8 +3863,8 @@ _ts_decorate32([
3689
3863
  _ts_metadata31("design:type", typeof Date === "undefined" ? Object : Date)
3690
3864
  ], DcqlQueryItemEntity.prototype, "lastUpdatedAt", void 0);
3691
3865
  _ts_decorate32([
3692
- BeforeInsert20(),
3693
- BeforeUpdate20(),
3866
+ BeforeInsert22(),
3867
+ BeforeUpdate22(),
3694
3868
  _ts_metadata31("design:type", Function),
3695
3869
  _ts_metadata31("design:paramtypes", []),
3696
3870
  _ts_metadata31("design:returntype", void 0)
@@ -4657,10 +4831,19 @@ var ContactStore = class extends AbstractContactStore {
4657
4831
  const result = await partyRepository.find({
4658
4832
  where: {
4659
4833
  id: In(initialResult.map((party) => party.id))
4660
- }
4834
+ },
4835
+ relations: [
4836
+ "contact"
4837
+ ]
4661
4838
  });
4662
4839
  debug(`getParties() resulted in ${result.length} parties`);
4663
- return result.map(partyFrom);
4840
+ return result.filter((party) => {
4841
+ if (!party.contact) {
4842
+ console.warn(`party ${party.id} does not have an associated contact`);
4843
+ return false;
4844
+ }
4845
+ return true;
4846
+ }).map(partyFrom);
4664
4847
  }, "getParties");
4665
4848
  addParty = /* @__PURE__ */ __name(async (args) => {
4666
4849
  const { identities, contact, partyType } = args;
@@ -5456,7 +5639,7 @@ import { In as In2, Not } from "typeorm";
5456
5639
  var credentialBrandingFrom = /* @__PURE__ */ __name((credentialBranding) => {
5457
5640
  const result = {
5458
5641
  ...credentialBranding,
5459
- localeBranding: credentialBranding.localeBranding.map((localeBranding) => localeBrandingFrom(localeBranding))
5642
+ localeBranding: credentialBranding.localeBranding.map((localeBranding) => credentialLocaleBrandingFromEntity(localeBranding))
5460
5643
  };
5461
5644
  return replaceNullWithUndefined(result);
5462
5645
  }, "credentialBrandingFrom");
@@ -5474,6 +5657,19 @@ var localeBrandingFrom = /* @__PURE__ */ __name((localeBranding) => {
5474
5657
  };
5475
5658
  return replaceNullWithUndefined(result);
5476
5659
  }, "localeBrandingFrom");
5660
+ var credentialLocaleBrandingFromEntity = /* @__PURE__ */ __name((localeBranding) => {
5661
+ const base = localeBrandingFrom(localeBranding);
5662
+ const result = {
5663
+ ...base,
5664
+ state: localeBranding.state,
5665
+ claims: localeBranding.claims ? localeBranding.claims.map((claim) => ({
5666
+ id: claim.id,
5667
+ key: claim.key,
5668
+ name: claim.name
5669
+ })) : void 0
5670
+ };
5671
+ return replaceNullWithUndefined(result);
5672
+ }, "credentialLocaleBrandingFromEntity");
5477
5673
  var issuerLocaleBrandingEntityFrom = /* @__PURE__ */ __name((args) => {
5478
5674
  const issuerLocaleBrandingEntity = new IssuerLocaleBrandingEntity();
5479
5675
  issuerLocaleBrandingEntity.alias = isEmptyString(args.alias) ? void 0 : args.alias;
@@ -5578,7 +5774,7 @@ var IssuanceBrandingStore = class extends AbstractIssuanceBrandingStore {
5578
5774
  return credentialBrandingFrom(createdResult);
5579
5775
  }, "addCredentialBranding");
5580
5776
  getCredentialBranding = /* @__PURE__ */ __name(async (args) => {
5581
- const { filter } = args ?? {};
5777
+ const { filter, knownStates } = args ?? {};
5582
5778
  if (filter) {
5583
5779
  filter.forEach((filter2) => {
5584
5780
  if (filter2.localeBranding && "locale" in filter2.localeBranding && filter2.localeBranding.locale === void 0) {
@@ -5587,12 +5783,39 @@ var IssuanceBrandingStore = class extends AbstractIssuanceBrandingStore {
5587
5783
  });
5588
5784
  }
5589
5785
  debug3("Getting credential branding", args);
5590
- const result = await (await this.dbConnection).getRepository(CredentialBrandingEntity).find({
5786
+ const repository = (await this.dbConnection).getRepository(CredentialBrandingEntity);
5787
+ if (knownStates && Object.keys(knownStates).length > 0) {
5788
+ const stateQuery = repository.createQueryBuilder("branding").select([
5789
+ "branding.id",
5790
+ "branding.state"
5791
+ ]);
5792
+ if (filter) {
5793
+ stateQuery.where(filter);
5794
+ }
5795
+ const stateResults = await stateQuery.getRawMany().then((rows) => rows.map((row) => ({
5796
+ id: row.branding_id,
5797
+ state: row.branding_state
5798
+ })));
5799
+ const dirtyIds = stateResults.filter((result3) => {
5800
+ const knownState = knownStates[result3.id];
5801
+ return !knownState || knownState !== result3.state;
5802
+ }).map((result3) => result3.id);
5803
+ if (dirtyIds.length === 0) {
5804
+ return [];
5805
+ }
5806
+ const result2 = await repository.find({
5807
+ where: {
5808
+ id: In2(dirtyIds)
5809
+ }
5810
+ });
5811
+ return result2.map((branding) => credentialBrandingFrom(branding));
5812
+ }
5813
+ const result = await repository.find({
5591
5814
  ...filter && {
5592
5815
  where: filter
5593
5816
  }
5594
5817
  });
5595
- return result.map((credentialBranding) => credentialBrandingFrom(credentialBranding));
5818
+ return result.map((branding) => credentialBrandingFrom(branding));
5596
5819
  }, "getCredentialBranding");
5597
5820
  removeCredentialBranding = /* @__PURE__ */ __name(async (args) => {
5598
5821
  const { filter } = args;
@@ -5685,7 +5908,7 @@ var IssuanceBrandingStore = class extends AbstractIssuanceBrandingStore {
5685
5908
  where: filter
5686
5909
  }
5687
5910
  });
5688
- return credentialBrandingLocale ? credentialBrandingLocale.map((credentialLocaleBranding) => localeBrandingFrom(credentialLocaleBranding)) : [];
5911
+ return credentialBrandingLocale ? credentialBrandingLocale.map((credentialLocaleBranding) => credentialLocaleBrandingFromEntity(credentialLocaleBranding)) : [];
5689
5912
  }, "getCredentialLocaleBranding");
5690
5913
  removeCredentialLocaleBranding = /* @__PURE__ */ __name(async (args) => {
5691
5914
  const { filter } = args;
@@ -7948,12 +8171,162 @@ var AddLinkedVpFields1763387280000 = class {
7948
8171
  }
7949
8172
  };
7950
8173
 
8174
+ // src/migrations/generic/15-AddBrandingState.ts
8175
+ import Debug14 from "debug";
8176
+
8177
+ // src/migrations/postgres/1766000000000-AddBrandingState.ts
8178
+ var AddBrandingStatePostgres1766000000000 = class {
8179
+ static {
8180
+ __name(this, "AddBrandingStatePostgres1766000000000");
8181
+ }
8182
+ name = "AddBrandingState1766000000000";
8183
+ async up(queryRunner) {
8184
+ await queryRunner.query(`ALTER TABLE "CredentialBranding" ADD "state" character varying(255) NOT NULL DEFAULT ''`);
8185
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD "state" character varying(255) NOT NULL DEFAULT ''`);
8186
+ }
8187
+ async down(queryRunner) {
8188
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP COLUMN "state"`);
8189
+ await queryRunner.query(`ALTER TABLE "CredentialBranding" DROP COLUMN "state"`);
8190
+ }
8191
+ };
8192
+
8193
+ // src/migrations/sqlite/1766000000000-AddBrandingState.ts
8194
+ var AddBrandingStateSqlite1766000000000 = class {
8195
+ static {
8196
+ __name(this, "AddBrandingStateSqlite1766000000000");
8197
+ }
8198
+ name = "AddBrandingState1766000000000";
8199
+ async up(queryRunner) {
8200
+ await queryRunner.query(`ALTER TABLE "CredentialBranding" ADD COLUMN "state" varchar(255) NOT NULL DEFAULT ''`);
8201
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD COLUMN "state" varchar(255) NOT NULL DEFAULT ''`);
8202
+ }
8203
+ async down(queryRunner) {
8204
+ await queryRunner.query(`PRAGMA foreign_keys = OFF`);
8205
+ await queryRunner.query(`
8206
+ CREATE TABLE "CredentialBranding_old"
8207
+ (
8208
+ "id" varchar PRIMARY KEY NOT NULL,
8209
+ "vcHash" varchar(255) NOT NULL,
8210
+ "issuerCorrelationId" varchar(255) NOT NULL,
8211
+ "created_at" datetime NOT NULL DEFAULT (datetime('now')),
8212
+ "last_updated_at" datetime NOT NULL DEFAULT (datetime('now'))
8213
+ )
8214
+ `);
8215
+ await queryRunner.query(`
8216
+ INSERT INTO "CredentialBranding_old" ("id", "vcHash", "issuerCorrelationId", "created_at", "last_updated_at")
8217
+ SELECT "id", "vcHash", "issuerCorrelationId", "created_at", "last_updated_at"
8218
+ FROM "CredentialBranding"
8219
+ `);
8220
+ await queryRunner.query(`DROP TABLE "CredentialBranding"`);
8221
+ await queryRunner.query(`ALTER TABLE "CredentialBranding_old" RENAME TO "CredentialBranding"`);
8222
+ await queryRunner.query(`CREATE INDEX "IDX_CredentialBrandingEntity_issuerCorrelationId" ON "CredentialBranding" ("issuerCorrelationId")`);
8223
+ await queryRunner.query(`CREATE INDEX "IDX_CredentialBrandingEntity_vcHash" ON "CredentialBranding" ("vcHash")`);
8224
+ await queryRunner.query(`
8225
+ CREATE TABLE "BaseLocaleBranding_old"
8226
+ (
8227
+ "id" varchar PRIMARY KEY NOT NULL,
8228
+ "alias" varchar(255),
8229
+ "locale" varchar(255) NOT NULL,
8230
+ "description" varchar(255),
8231
+ "created_at" datetime NOT NULL DEFAULT (datetime('now')),
8232
+ "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')),
8233
+ "credentialBrandingId" varchar,
8234
+ "issuerBrandingId" varchar,
8235
+ "type" varchar NOT NULL,
8236
+ "logoId" varchar,
8237
+ "backgroundId" varchar,
8238
+ "textId" varchar,
8239
+ "client_uri" varchar,
8240
+ "tos_uri" varchar,
8241
+ "policy_uri" varchar,
8242
+ "contacts" varchar,
8243
+ CONSTRAINT "UQ_logoId" UNIQUE ("logoId"),
8244
+ CONSTRAINT "UQ_backgroundId" UNIQUE ("backgroundId"),
8245
+ CONSTRAINT "UQ_textId" UNIQUE ("textId"),
8246
+ CONSTRAINT "FK_BaseLocaleBranding_logoId" FOREIGN KEY ("logoId") REFERENCES "ImageAttributes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
8247
+ CONSTRAINT "FK_BaseLocaleBranding_backgroundId" FOREIGN KEY ("backgroundId") REFERENCES "BackgroundAttributes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
8248
+ CONSTRAINT "FK_BaseLocaleBranding_textId" FOREIGN KEY ("textId") REFERENCES "TextAttributes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
8249
+ CONSTRAINT "FK_BaseLocaleBranding_credentialBrandingId" FOREIGN KEY ("credentialBrandingId") REFERENCES "CredentialBranding" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
8250
+ CONSTRAINT "FK_BaseLocaleBranding_issuerBrandingId" FOREIGN KEY ("issuerBrandingId") REFERENCES "IssuerBranding" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
8251
+ )
8252
+ `);
8253
+ await queryRunner.query(`
8254
+ INSERT INTO "BaseLocaleBranding_old" ("id", "alias", "locale", "description", "created_at", "last_updated_at", "credentialBrandingId", "issuerBrandingId", "type", "logoId", "backgroundId", "textId", "client_uri", "tos_uri", "policy_uri", "contacts")
8255
+ SELECT "id", "alias", "locale", "description", "created_at", "last_updated_at", "credentialBrandingId", "issuerBrandingId", "type", "logoId", "backgroundId", "textId", "client_uri", "tos_uri", "policy_uri", "contacts"
8256
+ FROM "BaseLocaleBranding"
8257
+ `);
8258
+ await queryRunner.query(`DROP TABLE "BaseLocaleBranding"`);
8259
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding_old" RENAME TO "BaseLocaleBranding"`);
8260
+ await queryRunner.query(`CREATE UNIQUE INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale" ON "BaseLocaleBranding" ("credentialBrandingId", "locale")`);
8261
+ await queryRunner.query(`CREATE UNIQUE INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale" ON "BaseLocaleBranding" ("issuerBrandingId", "locale")`);
8262
+ await queryRunner.query(`CREATE INDEX "IDX_BaseLocaleBranding_type" ON "BaseLocaleBranding" ("type")`);
8263
+ await queryRunner.query(`PRAGMA foreign_keys = ON`);
8264
+ }
8265
+ };
8266
+
8267
+ // src/migrations/generic/15-AddBrandingState.ts
8268
+ var debug14 = Debug14("sphereon:ssi-sdk:migrations");
8269
+ var AddBrandingState1766000000000 = class {
8270
+ static {
8271
+ __name(this, "AddBrandingState1766000000000");
8272
+ }
8273
+ name = "AddBrandingState1766000000000";
8274
+ async up(queryRunner) {
8275
+ debug14("migration: adding branding state checksum columns");
8276
+ const dbType = queryRunner.connection.driver.options.type;
8277
+ switch (dbType) {
8278
+ case "postgres": {
8279
+ debug14("using postgres migration file");
8280
+ const mig = new AddBrandingStatePostgres1766000000000();
8281
+ await mig.up(queryRunner);
8282
+ debug14("Migration statements executed");
8283
+ return;
8284
+ }
8285
+ case "sqlite":
8286
+ case "expo":
8287
+ case "react-native": {
8288
+ debug14("using sqlite/react-native migration file");
8289
+ const mig = new AddBrandingStateSqlite1766000000000();
8290
+ await mig.up(queryRunner);
8291
+ debug14("Migration statements executed");
8292
+ return;
8293
+ }
8294
+ default:
8295
+ return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
8296
+ }
8297
+ }
8298
+ async down(queryRunner) {
8299
+ debug14("migration: removing branding state checksum columns");
8300
+ const dbType = queryRunner.connection.driver.options.type;
8301
+ switch (dbType) {
8302
+ case "postgres": {
8303
+ debug14("using postgres migration file");
8304
+ const mig = new AddBrandingStatePostgres1766000000000();
8305
+ await mig.down(queryRunner);
8306
+ debug14("Migration statements executed");
8307
+ return;
8308
+ }
8309
+ case "sqlite":
8310
+ case "expo":
8311
+ case "react-native": {
8312
+ debug14("using sqlite/react-native migration file");
8313
+ const mig = new AddBrandingStateSqlite1766000000000();
8314
+ await mig.down(queryRunner);
8315
+ debug14("Migration statements executed");
8316
+ return;
8317
+ }
8318
+ default:
8319
+ return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
8320
+ }
8321
+ }
8322
+ };
8323
+
7951
8324
  // src/migrations/generic/15-AddServiceMetadata.ts
7952
- import Debug16 from "debug";
8325
+ import Debug17 from "debug";
7953
8326
 
7954
8327
  // src/migrations/postgres/1764000000001-AddServiceMetadata.ts
7955
- import Debug14 from "debug";
7956
- var debug14 = Debug14("sphereon:ssi-sdk:migrations");
8328
+ import Debug15 from "debug";
8329
+ var debug15 = Debug15("sphereon:ssi-sdk:migrations");
7957
8330
  var AddServiceMetadata1764000000001 = class {
7958
8331
  static {
7959
8332
  __name(this, "AddServiceMetadata1764000000001");
@@ -7962,7 +8335,7 @@ var AddServiceMetadata1764000000001 = class {
7962
8335
  async up(queryRunner) {
7963
8336
  const table = await queryRunner.getTable("service");
7964
8337
  if (!table) {
7965
- debug14("AddServiceMetadata: Skipping migration - service table does not exist. This is expected if Veramo DID Manager is not being used. If you need service metadata support, ensure Veramo migrations run before SSI-SDK migrations.");
8338
+ debug15("AddServiceMetadata: Skipping migration - service table does not exist. This is expected if Veramo DID Manager is not being used. If you need service metadata support, ensure Veramo migrations run before SSI-SDK migrations.");
7966
8339
  console.warn("[SSI-SDK Migration] AddServiceMetadata: Skipping - service table does not exist (Veramo DID Manager not in use)");
7967
8340
  return;
7968
8341
  }
@@ -7970,7 +8343,7 @@ var AddServiceMetadata1764000000001 = class {
7970
8343
  ALTER TABLE "service"
7971
8344
  ADD COLUMN IF NOT EXISTS "metadata" jsonb
7972
8345
  `);
7973
- debug14("AddServiceMetadata: Added metadata column to service table");
8346
+ debug15("AddServiceMetadata: Added metadata column to service table");
7974
8347
  }
7975
8348
  async down(queryRunner) {
7976
8349
  const table = await queryRunner.getTable("service");
@@ -7985,8 +8358,8 @@ var AddServiceMetadata1764000000001 = class {
7985
8358
  };
7986
8359
 
7987
8360
  // src/migrations/sqlite/1764000000002-AddServiceMetadata.ts
7988
- import Debug15 from "debug";
7989
- var debug15 = Debug15("sphereon:ssi-sdk:migrations");
8361
+ import Debug16 from "debug";
8362
+ var debug16 = Debug16("sphereon:ssi-sdk:migrations");
7990
8363
  var AddServiceMetadata1764000000002 = class {
7991
8364
  static {
7992
8365
  __name(this, "AddServiceMetadata1764000000002");
@@ -7995,7 +8368,7 @@ var AddServiceMetadata1764000000002 = class {
7995
8368
  async up(queryRunner) {
7996
8369
  const table = await queryRunner.getTable("service");
7997
8370
  if (!table) {
7998
- debug15("AddServiceMetadata: Skipping migration - service table does not exist. This is expected if Veramo DID Manager is not being used. If you need service metadata support, ensure Veramo migrations run before SSI-SDK migrations.");
8371
+ debug16("AddServiceMetadata: Skipping migration - service table does not exist. This is expected if Veramo DID Manager is not being used. If you need service metadata support, ensure Veramo migrations run before SSI-SDK migrations.");
7999
8372
  console.warn("[SSI-SDK Migration] AddServiceMetadata: Skipping - service table does not exist (Veramo DID Manager not in use)");
8000
8373
  return;
8001
8374
  }
@@ -8005,7 +8378,7 @@ var AddServiceMetadata1764000000002 = class {
8005
8378
  ALTER TABLE "service"
8006
8379
  ADD COLUMN "metadata" text
8007
8380
  `);
8008
- debug15("AddServiceMetadata: Added metadata column to service table");
8381
+ debug16("AddServiceMetadata: Added metadata column to service table");
8009
8382
  }
8010
8383
  }
8011
8384
  async down(queryRunner) {
@@ -8013,30 +8386,30 @@ var AddServiceMetadata1764000000002 = class {
8013
8386
  };
8014
8387
 
8015
8388
  // src/migrations/generic/15-AddServiceMetadata.ts
8016
- var debug16 = Debug16("sphereon:ssi-sdk:migrations");
8389
+ var debug17 = Debug17("sphereon:ssi-sdk:migrations");
8017
8390
  var AddServiceMetadata1764000000000 = class {
8018
8391
  static {
8019
8392
  __name(this, "AddServiceMetadata1764000000000");
8020
8393
  }
8021
8394
  name = "AddServiceMetadata1764000000000";
8022
8395
  async up(queryRunner) {
8023
- debug16("migration: adding metadata column to service table");
8396
+ debug17("migration: adding metadata column to service table");
8024
8397
  const dbType = queryRunner.connection.driver.options.type;
8025
8398
  switch (dbType) {
8026
8399
  case "postgres": {
8027
- debug16("using postgres migration file for AddServiceMetadata");
8400
+ debug17("using postgres migration file for AddServiceMetadata");
8028
8401
  const mig = new AddServiceMetadata1764000000001();
8029
8402
  await mig.up(queryRunner);
8030
- debug16("Postgres migration statements for AddServiceMetadata executed");
8403
+ debug17("Postgres migration statements for AddServiceMetadata executed");
8031
8404
  return;
8032
8405
  }
8033
8406
  case "sqlite":
8034
8407
  case "expo":
8035
8408
  case "react-native": {
8036
- debug16("using sqlite/react-native migration file for AddServiceMetadata");
8409
+ debug17("using sqlite/react-native migration file for AddServiceMetadata");
8037
8410
  const mig = new AddServiceMetadata1764000000002();
8038
8411
  await mig.up(queryRunner);
8039
- debug16("SQLite migration statements for AddServiceMetadata executed");
8412
+ debug17("SQLite migration statements for AddServiceMetadata executed");
8040
8413
  return;
8041
8414
  }
8042
8415
  default:
@@ -8044,23 +8417,23 @@ var AddServiceMetadata1764000000000 = class {
8044
8417
  }
8045
8418
  }
8046
8419
  async down(queryRunner) {
8047
- debug16("migration: reverting metadata column from service table");
8420
+ debug17("migration: reverting metadata column from service table");
8048
8421
  const dbType = queryRunner.connection.driver.options.type;
8049
8422
  switch (dbType) {
8050
8423
  case "postgres": {
8051
- debug16("using postgres migration file for AddServiceMetadata");
8424
+ debug17("using postgres migration file for AddServiceMetadata");
8052
8425
  const mig = new AddServiceMetadata1764000000001();
8053
8426
  await mig.down(queryRunner);
8054
- debug16("Postgres migration statements for AddServiceMetadata reverted");
8427
+ debug17("Postgres migration statements for AddServiceMetadata reverted");
8055
8428
  return;
8056
8429
  }
8057
8430
  case "sqlite":
8058
8431
  case "expo":
8059
8432
  case "react-native": {
8060
- debug16("using sqlite/react-native migration file for AddServiceMetadata");
8433
+ debug17("using sqlite/react-native migration file for AddServiceMetadata");
8061
8434
  const mig = new AddServiceMetadata1764000000002();
8062
8435
  await mig.down(queryRunner);
8063
- debug16("SQLite migration statements for AddServiceMetadata reverted");
8436
+ debug17("SQLite migration statements for AddServiceMetadata reverted");
8064
8437
  return;
8065
8438
  }
8066
8439
  default:
@@ -8070,31 +8443,31 @@ var AddServiceMetadata1764000000000 = class {
8070
8443
  };
8071
8444
 
8072
8445
  // src/migrations/generic/2-CreateIssuanceBranding.ts
8073
- import Debug17 from "debug";
8074
- var debug17 = Debug17("sphereon:ssi-sdk:migrations");
8446
+ import Debug18 from "debug";
8447
+ var debug18 = Debug18("sphereon:ssi-sdk:migrations");
8075
8448
  var CreateIssuanceBranding1659463079429 = class {
8076
8449
  static {
8077
8450
  __name(this, "CreateIssuanceBranding1659463079429");
8078
8451
  }
8079
8452
  name = "CreateIssuanceBranding1659463079429";
8080
8453
  async up(queryRunner) {
8081
- debug17("migration: creating issuance branding tables");
8454
+ debug18("migration: creating issuance branding tables");
8082
8455
  const dbType = queryRunner.connection.driver.options.type;
8083
8456
  switch (dbType) {
8084
8457
  case "postgres": {
8085
- debug17("using postgres migration file");
8458
+ debug18("using postgres migration file");
8086
8459
  const mig = new CreateIssuanceBranding1685628974232();
8087
8460
  await mig.up(queryRunner);
8088
- debug17("Migration statements executed");
8461
+ debug18("Migration statements executed");
8089
8462
  return;
8090
8463
  }
8091
8464
  case "sqlite":
8092
8465
  case "expo":
8093
8466
  case "react-native": {
8094
- debug17("using sqlite/react-native migration file");
8467
+ debug18("using sqlite/react-native migration file");
8095
8468
  const mig = new CreateIssuanceBranding1685628973231();
8096
8469
  await mig.up(queryRunner);
8097
- debug17("Migration statements executed");
8470
+ debug18("Migration statements executed");
8098
8471
  return;
8099
8472
  }
8100
8473
  default:
@@ -8102,23 +8475,23 @@ var CreateIssuanceBranding1659463079429 = class {
8102
8475
  }
8103
8476
  }
8104
8477
  async down(queryRunner) {
8105
- debug17("migration: reverting issuance branding tables");
8478
+ debug18("migration: reverting issuance branding tables");
8106
8479
  const dbType = queryRunner.connection.driver.options.type;
8107
8480
  switch (dbType) {
8108
8481
  case "postgres": {
8109
- debug17("using postgres migration file");
8482
+ debug18("using postgres migration file");
8110
8483
  const mig = new CreateIssuanceBranding1685628974232();
8111
8484
  await mig.down(queryRunner);
8112
- debug17("Migration statements executed");
8485
+ debug18("Migration statements executed");
8113
8486
  return;
8114
8487
  }
8115
8488
  case "sqlite":
8116
8489
  case "expo":
8117
8490
  case "react-native": {
8118
- debug17("using sqlite/react-native migration file");
8491
+ debug18("using sqlite/react-native migration file");
8119
8492
  const mig = new CreateIssuanceBranding1685628973231();
8120
8493
  await mig.down(queryRunner);
8121
- debug17("Migration statements executed");
8494
+ debug18("Migration statements executed");
8122
8495
  return;
8123
8496
  }
8124
8497
  default:
@@ -8128,7 +8501,7 @@ var CreateIssuanceBranding1659463079429 = class {
8128
8501
  };
8129
8502
 
8130
8503
  // src/migrations/generic/3-CreateContacts.ts
8131
- import Debug18 from "debug";
8504
+ import Debug19 from "debug";
8132
8505
 
8133
8506
  // src/migrations/postgres/1690925872592-CreateContacts.ts
8134
8507
  import { enablePostgresUuidExtension as enablePostgresUuidExtension3 } from "@sphereon/ssi-sdk.core";
@@ -8349,30 +8722,30 @@ var CreateContacts1690925872693 = class {
8349
8722
  };
8350
8723
 
8351
8724
  // src/migrations/generic/3-CreateContacts.ts
8352
- var debug18 = Debug18("sphereon:ssi-sdk:migrations");
8725
+ var debug19 = Debug19("sphereon:ssi-sdk:migrations");
8353
8726
  var CreateContacts1690925872318 = class {
8354
8727
  static {
8355
8728
  __name(this, "CreateContacts1690925872318");
8356
8729
  }
8357
8730
  name = "CreateContacts1690925872318";
8358
8731
  async up(queryRunner) {
8359
- debug18("migration: creating contacts tables");
8732
+ debug19("migration: creating contacts tables");
8360
8733
  const dbType = queryRunner.connection.driver.options.type;
8361
8734
  switch (dbType) {
8362
8735
  case "postgres": {
8363
- debug18("using postgres migration file");
8736
+ debug19("using postgres migration file");
8364
8737
  const mig = new CreateContacts1690925872592();
8365
8738
  await mig.up(queryRunner);
8366
- debug18("Migration statements executed");
8739
+ debug19("Migration statements executed");
8367
8740
  return;
8368
8741
  }
8369
8742
  case "sqlite":
8370
8743
  case "expo":
8371
8744
  case "react-native": {
8372
- debug18("using sqlite/react-native migration file");
8745
+ debug19("using sqlite/react-native migration file");
8373
8746
  const mig = new CreateContacts1690925872693();
8374
8747
  await mig.up(queryRunner);
8375
- debug18("Migration statements executed");
8748
+ debug19("Migration statements executed");
8376
8749
  return;
8377
8750
  }
8378
8751
  default:
@@ -8380,23 +8753,23 @@ var CreateContacts1690925872318 = class {
8380
8753
  }
8381
8754
  }
8382
8755
  async down(queryRunner) {
8383
- debug18("migration: reverting contacts tables");
8756
+ debug19("migration: reverting contacts tables");
8384
8757
  const dbType = queryRunner.connection.driver.options.type;
8385
8758
  switch (dbType) {
8386
8759
  case "postgres": {
8387
- debug18("using postgres migration file");
8760
+ debug19("using postgres migration file");
8388
8761
  const mig = new CreateContacts1690925872592();
8389
8762
  await mig.down(queryRunner);
8390
- debug18("Migration statements executed");
8763
+ debug19("Migration statements executed");
8391
8764
  return;
8392
8765
  }
8393
8766
  case "sqlite":
8394
8767
  case "expo":
8395
8768
  case "react-native": {
8396
- debug18("using sqlite/react-native migration file");
8769
+ debug19("using sqlite/react-native migration file");
8397
8770
  const mig = new CreateContacts1690925872693();
8398
8771
  await mig.down(queryRunner);
8399
- debug18("Migration statements executed");
8772
+ debug19("Migration statements executed");
8400
8773
  return;
8401
8774
  }
8402
8775
  default:
@@ -8406,7 +8779,7 @@ var CreateContacts1690925872318 = class {
8406
8779
  };
8407
8780
 
8408
8781
  // src/migrations/generic/4-CreateStatusList.ts
8409
- import Debug19 from "debug";
8782
+ import Debug20 from "debug";
8410
8783
 
8411
8784
  // src/migrations/postgres/1693866470001-CreateStatusList.ts
8412
8785
  var CreateStatusList1693866470001 = class {
@@ -8612,53 +8985,53 @@ var UpdateStatusList1737110469000 = class {
8612
8985
  };
8613
8986
 
8614
8987
  // src/migrations/generic/4-CreateStatusList.ts
8615
- var debug19 = Debug19("sphereon:ssi-sdk:migrations");
8988
+ var debug20 = Debug20("sphereon:ssi-sdk:migrations");
8616
8989
  var CreateStatusList1693866470000 = class {
8617
8990
  static {
8618
8991
  __name(this, "CreateStatusList1693866470000");
8619
8992
  }
8620
8993
  name = "CreateStatusList1693866470000";
8621
8994
  async up(queryRunner) {
8622
- debug19("migration: creating issuance branding tables");
8995
+ debug20("migration: creating issuance branding tables");
8623
8996
  const dbType = queryRunner.connection.driver.options.type;
8624
8997
  if (dbType === "postgres") {
8625
- debug19("using postgres migration files");
8998
+ debug20("using postgres migration files");
8626
8999
  const createMig = new CreateStatusList1693866470001();
8627
9000
  await createMig.up(queryRunner);
8628
9001
  const updateMig = new UpdateStatusList1737110469001();
8629
9002
  const up = await updateMig.up(queryRunner);
8630
- debug19("Migration statements executed");
9003
+ debug20("Migration statements executed");
8631
9004
  return up;
8632
9005
  } else if (dbType === "sqlite" || dbType === "react-native" || dbType === "expo") {
8633
- debug19("using sqlite/react-native migration files");
9006
+ debug20("using sqlite/react-native migration files");
8634
9007
  const createMig = new CreateStatusList1693866470002();
8635
9008
  await createMig.up(queryRunner);
8636
9009
  const updateMig = new UpdateStatusList1737110469000();
8637
9010
  const up = await updateMig.up(queryRunner);
8638
- debug19("Migration statements executed");
9011
+ debug20("Migration statements executed");
8639
9012
  return up;
8640
9013
  } else {
8641
9014
  return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
8642
9015
  }
8643
9016
  }
8644
9017
  async down(queryRunner) {
8645
- debug19("migration: reverting issuance branding tables");
9018
+ debug20("migration: reverting issuance branding tables");
8646
9019
  const dbType = queryRunner.connection.driver.options.type;
8647
9020
  if (dbType === "postgres") {
8648
- debug19("using postgres migration files");
9021
+ debug20("using postgres migration files");
8649
9022
  const updateMig = new UpdateStatusList1737110469001();
8650
9023
  await updateMig.down(queryRunner);
8651
9024
  const createMig = new CreateStatusList1693866470001();
8652
9025
  const down = await createMig.down(queryRunner);
8653
- debug19("Migration statements executed");
9026
+ debug20("Migration statements executed");
8654
9027
  return down;
8655
9028
  } else if (dbType === "sqlite" || dbType === "react-native" || dbType === "expo") {
8656
- debug19("using sqlite/react-native migration files");
9029
+ debug20("using sqlite/react-native migration files");
8657
9030
  const updateMig = new UpdateStatusList1737110469000();
8658
9031
  await updateMig.down(queryRunner);
8659
9032
  const createMig = new CreateStatusList1693866470002();
8660
9033
  const down = await createMig.down(queryRunner);
8661
- debug19("Migration statements executed");
9034
+ debug20("Migration statements executed");
8662
9035
  return down;
8663
9036
  } else {
8664
9037
  return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
@@ -8667,7 +9040,7 @@ var CreateStatusList1693866470000 = class {
8667
9040
  };
8668
9041
 
8669
9042
  // src/migrations/generic/5-CreateAuditEvents.ts
8670
- import Debug20 from "debug";
9043
+ import Debug21 from "debug";
8671
9044
 
8672
9045
  // src/migrations/postgres/1701634812183-CreateAuditEvents.ts
8673
9046
  var CreateAuditEvents1701634812183 = class {
@@ -8766,30 +9139,30 @@ var CreateAuditEvents1701634819487 = class {
8766
9139
  };
8767
9140
 
8768
9141
  // src/migrations/generic/5-CreateAuditEvents.ts
8769
- var debug20 = Debug20("sphereon:ssi-sdk:migrations");
9142
+ var debug21 = Debug21("sphereon:ssi-sdk:migrations");
8770
9143
  var CreateAuditEvents1701635835330 = class {
8771
9144
  static {
8772
9145
  __name(this, "CreateAuditEvents1701635835330");
8773
9146
  }
8774
9147
  name = "CreateAuditEvents1701635835330";
8775
9148
  async up(queryRunner) {
8776
- debug20("migration: creating audit events tables");
9149
+ debug21("migration: creating audit events tables");
8777
9150
  const dbType = queryRunner.connection.driver.options.type;
8778
9151
  switch (dbType) {
8779
9152
  case "postgres": {
8780
- debug20("using postgres migration file");
9153
+ debug21("using postgres migration file");
8781
9154
  const mig = new CreateAuditEvents1701634812183();
8782
9155
  await mig.up(queryRunner);
8783
- debug20("Migration statements executed");
9156
+ debug21("Migration statements executed");
8784
9157
  return;
8785
9158
  }
8786
9159
  case "sqlite":
8787
9160
  case "expo":
8788
9161
  case "react-native": {
8789
- debug20("using sqlite/react-native migration file");
9162
+ debug21("using sqlite/react-native migration file");
8790
9163
  const mig = new CreateAuditEvents1701634819487();
8791
9164
  await mig.up(queryRunner);
8792
- debug20("Migration statements executed");
9165
+ debug21("Migration statements executed");
8793
9166
  return;
8794
9167
  }
8795
9168
  default:
@@ -8797,23 +9170,23 @@ var CreateAuditEvents1701635835330 = class {
8797
9170
  }
8798
9171
  }
8799
9172
  async down(queryRunner) {
8800
- debug20("migration: reverting audit events tables");
9173
+ debug21("migration: reverting audit events tables");
8801
9174
  const dbType = queryRunner.connection.driver.options.type;
8802
9175
  switch (dbType) {
8803
9176
  case "postgres": {
8804
- debug20("using postgres migration file");
9177
+ debug21("using postgres migration file");
8805
9178
  const mig = new CreateAuditEvents1701634812183();
8806
9179
  await mig.down(queryRunner);
8807
- debug20("Migration statements executed");
9180
+ debug21("Migration statements executed");
8808
9181
  return;
8809
9182
  }
8810
9183
  case "sqlite":
8811
9184
  case "expo":
8812
9185
  case "react-native": {
8813
- debug20("using sqlite/react-native migration file");
9186
+ debug21("using sqlite/react-native migration file");
8814
9187
  const mig = new CreateAuditEvents1701634819487();
8815
9188
  await mig.down(queryRunner);
8816
- debug20("Migration statements executed");
9189
+ debug21("Migration statements executed");
8817
9190
  return;
8818
9191
  }
8819
9192
  default:
@@ -8823,7 +9196,7 @@ var CreateAuditEvents1701635835330 = class {
8823
9196
  };
8824
9197
 
8825
9198
  // src/migrations/generic/6-CreateDigitalCredential.ts
8826
- import Debug21 from "debug";
9199
+ import Debug22 from "debug";
8827
9200
 
8828
9201
  // src/migrations/postgres/1708525189001-CreateDigitalCredential.ts
8829
9202
  var CreateDigitalCredential1708525189001 = class {
@@ -8931,30 +9304,30 @@ var CreateDigitalCredential1708525189002 = class {
8931
9304
  };
8932
9305
 
8933
9306
  // src/migrations/generic/6-CreateDigitalCredential.ts
8934
- var debug21 = Debug21("sphereon:ssi-sdk:migrations");
9307
+ var debug22 = Debug22("sphereon:ssi-sdk:migrations");
8935
9308
  var CreateDigitalCredential1708525189000 = class {
8936
9309
  static {
8937
9310
  __name(this, "CreateDigitalCredential1708525189000");
8938
9311
  }
8939
9312
  name = "CreateDigitalCredential1708525189000";
8940
9313
  async up(queryRunner) {
8941
- debug21("migration: creating DigitalCredential tables");
9314
+ debug22("migration: creating DigitalCredential tables");
8942
9315
  const dbType = queryRunner.connection.driver.options.type;
8943
9316
  switch (dbType) {
8944
9317
  case "postgres": {
8945
- debug21("using postgres migration file for DigitalCredential");
9318
+ debug22("using postgres migration file for DigitalCredential");
8946
9319
  const mig = new CreateDigitalCredential1708525189001();
8947
9320
  await mig.up(queryRunner);
8948
- debug21("Postgres Migration statements for DigitalCredential executed");
9321
+ debug22("Postgres Migration statements for DigitalCredential executed");
8949
9322
  return;
8950
9323
  }
8951
9324
  case "sqlite":
8952
9325
  case "expo":
8953
9326
  case "react-native": {
8954
- debug21("using sqlite/react-native migration file for DigitalCredential");
9327
+ debug22("using sqlite/react-native migration file for DigitalCredential");
8955
9328
  const mig = new CreateDigitalCredential1708525189002();
8956
9329
  await mig.up(queryRunner);
8957
- debug21("SQLite Migration statements for DigitalCredential executed");
9330
+ debug22("SQLite Migration statements for DigitalCredential executed");
8958
9331
  return;
8959
9332
  }
8960
9333
  default:
@@ -8962,23 +9335,23 @@ var CreateDigitalCredential1708525189000 = class {
8962
9335
  }
8963
9336
  }
8964
9337
  async down(queryRunner) {
8965
- debug21("migration: reverting DigitalCredential tables");
9338
+ debug22("migration: reverting DigitalCredential tables");
8966
9339
  const dbType = queryRunner.connection.driver.options.type;
8967
9340
  switch (dbType) {
8968
9341
  case "postgres": {
8969
- debug21("using postgres migration file for DigitalCredential");
9342
+ debug22("using postgres migration file for DigitalCredential");
8970
9343
  const mig = new CreateDigitalCredential1708525189001();
8971
9344
  await mig.down(queryRunner);
8972
- debug21("Postgres Migration statements for DigitalCredential reverted");
9345
+ debug22("Postgres Migration statements for DigitalCredential reverted");
8973
9346
  return;
8974
9347
  }
8975
9348
  case "sqlite":
8976
9349
  case "expo":
8977
9350
  case "react-native": {
8978
- debug21("using sqlite/react-native migration file for DigitalCredential");
9351
+ debug22("using sqlite/react-native migration file for DigitalCredential");
8979
9352
  const mig = new CreateDigitalCredential1708525189002();
8980
9353
  await mig.down(queryRunner);
8981
- debug21("SQLite Migration statements for DigitalCredential reverted");
9354
+ debug22("SQLite Migration statements for DigitalCredential reverted");
8982
9355
  return;
8983
9356
  }
8984
9357
  default:
@@ -8988,7 +9361,7 @@ var CreateDigitalCredential1708525189000 = class {
8988
9361
  };
8989
9362
 
8990
9363
  // src/migrations/generic/7-CreateMachineStateStore.ts
8991
- import Debug22 from "debug";
9364
+ import Debug23 from "debug";
8992
9365
 
8993
9366
  // src/migrations/postgres/1708797018115-CreateMachineStateStore.ts
8994
9367
  var CreateMachineStateStore1708797018115 = class {
@@ -9050,30 +9423,30 @@ var CreateMachineStateStore1708796002272 = class {
9050
9423
  };
9051
9424
 
9052
9425
  // src/migrations/generic/7-CreateMachineStateStore.ts
9053
- var debug22 = Debug22("sphereon:ssi-sdk:migrations");
9426
+ var debug23 = Debug23("sphereon:ssi-sdk:migrations");
9054
9427
  var CreateMachineStateStore1708098041262 = class {
9055
9428
  static {
9056
9429
  __name(this, "CreateMachineStateStore1708098041262");
9057
9430
  }
9058
9431
  name = "CreateMachineStateStore1708098041262";
9059
9432
  async up(queryRunner) {
9060
- debug22("migration: creating machine state tables");
9433
+ debug23("migration: creating machine state tables");
9061
9434
  const dbType = queryRunner.connection.driver.options.type;
9062
9435
  switch (dbType) {
9063
9436
  case "postgres": {
9064
- debug22("using postgres migration file");
9437
+ debug23("using postgres migration file");
9065
9438
  const mig = new CreateMachineStateStore1708797018115();
9066
9439
  await mig.up(queryRunner);
9067
- debug22("Migration statements executed");
9440
+ debug23("Migration statements executed");
9068
9441
  return;
9069
9442
  }
9070
9443
  case "sqlite":
9071
9444
  case "expo":
9072
9445
  case "react-native": {
9073
- debug22("using sqlite/react-native migration file");
9446
+ debug23("using sqlite/react-native migration file");
9074
9447
  const mig = new CreateMachineStateStore1708796002272();
9075
9448
  await mig.up(queryRunner);
9076
- debug22("Migration statements executed");
9449
+ debug23("Migration statements executed");
9077
9450
  return;
9078
9451
  }
9079
9452
  default:
@@ -9081,23 +9454,23 @@ var CreateMachineStateStore1708098041262 = class {
9081
9454
  }
9082
9455
  }
9083
9456
  async down(queryRunner) {
9084
- debug22("migration: reverting machine state tables");
9457
+ debug23("migration: reverting machine state tables");
9085
9458
  const dbType = queryRunner.connection.driver.options.type;
9086
9459
  switch (dbType) {
9087
9460
  case "postgres": {
9088
- debug22("using postgres migration file");
9461
+ debug23("using postgres migration file");
9089
9462
  const mig = new CreateMachineStateStore1708797018115();
9090
9463
  await mig.down(queryRunner);
9091
- debug22("Migration statements executed");
9464
+ debug23("Migration statements executed");
9092
9465
  return;
9093
9466
  }
9094
9467
  case "sqlite":
9095
9468
  case "expo":
9096
9469
  case "react-native": {
9097
- debug22("using sqlite/react-native migration file");
9470
+ debug23("using sqlite/react-native migration file");
9098
9471
  const mig = new CreateMachineStateStore1708796002272();
9099
9472
  await mig.down(queryRunner);
9100
- debug22("Migration statements executed");
9473
+ debug23("Migration statements executed");
9101
9474
  return;
9102
9475
  }
9103
9476
  default:
@@ -9107,7 +9480,7 @@ var CreateMachineStateStore1708098041262 = class {
9107
9480
  };
9108
9481
 
9109
9482
  // src/migrations/generic/8-CreateContacts.ts
9110
- import Debug23 from "debug";
9483
+ import Debug24 from "debug";
9111
9484
 
9112
9485
  // src/migrations/postgres/1710438363001-CreateContacts.ts
9113
9486
  var CreateContacts1710438363001 = class {
@@ -9221,30 +9594,30 @@ var CreateContacts1710438363002 = class {
9221
9594
  };
9222
9595
 
9223
9596
  // src/migrations/generic/8-CreateContacts.ts
9224
- var debug23 = Debug23("sphereon:ssi-sdk:migrations");
9597
+ var debug24 = Debug24("sphereon:ssi-sdk:migrations");
9225
9598
  var CreateContacts1708525189000 = class {
9226
9599
  static {
9227
9600
  __name(this, "CreateContacts1708525189000");
9228
9601
  }
9229
9602
  name = "CreateContacts1708525189000";
9230
9603
  async up(queryRunner) {
9231
- debug23("migration: updating contact tables");
9604
+ debug24("migration: updating contact tables");
9232
9605
  const dbType = queryRunner.connection.driver.options.type;
9233
9606
  switch (dbType) {
9234
9607
  case "postgres": {
9235
- debug23("using postgres migration file");
9608
+ debug24("using postgres migration file");
9236
9609
  const mig = new CreateContacts1710438363001();
9237
9610
  await mig.up(queryRunner);
9238
- debug23("Migration statements executed");
9611
+ debug24("Migration statements executed");
9239
9612
  return;
9240
9613
  }
9241
9614
  case "sqlite":
9242
9615
  case "expo":
9243
9616
  case "react-native": {
9244
- debug23("using sqlite/react-native migration file");
9617
+ debug24("using sqlite/react-native migration file");
9245
9618
  const mig = new CreateContacts1710438363002();
9246
9619
  await mig.up(queryRunner);
9247
- debug23("Migration statements executed");
9620
+ debug24("Migration statements executed");
9248
9621
  return;
9249
9622
  }
9250
9623
  default:
@@ -9252,23 +9625,23 @@ var CreateContacts1708525189000 = class {
9252
9625
  }
9253
9626
  }
9254
9627
  async down(queryRunner) {
9255
- debug23("migration: reverting machine state tables");
9628
+ debug24("migration: reverting machine state tables");
9256
9629
  const dbType = queryRunner.connection.driver.options.type;
9257
9630
  switch (dbType) {
9258
9631
  case "postgres": {
9259
- debug23("using postgres migration file");
9632
+ debug24("using postgres migration file");
9260
9633
  const mig = new CreateContacts1710438363001();
9261
9634
  await mig.down(queryRunner);
9262
- debug23("Migration statements executed");
9635
+ debug24("Migration statements executed");
9263
9636
  return;
9264
9637
  }
9265
9638
  case "sqlite":
9266
9639
  case "expo":
9267
9640
  case "react-native": {
9268
- debug23("using sqlite/react-native migration file");
9641
+ debug24("using sqlite/react-native migration file");
9269
9642
  const mig = new CreateContacts1710438363002();
9270
9643
  await mig.down(queryRunner);
9271
- debug23("Migration statements executed");
9644
+ debug24("Migration statements executed");
9272
9645
  return;
9273
9646
  }
9274
9647
  default:
@@ -9278,7 +9651,7 @@ var CreateContacts1708525189000 = class {
9278
9651
  };
9279
9652
 
9280
9653
  // src/migrations/generic/9-CreateContacts.ts
9281
- import Debug24 from "debug";
9654
+ import Debug25 from "debug";
9282
9655
 
9283
9656
  // src/migrations/postgres/1715761125001-CreateContacts.ts
9284
9657
  var CreateContacts1715761125001 = class {
@@ -9390,30 +9763,30 @@ var CreateContacts1715761125002 = class {
9390
9763
  };
9391
9764
 
9392
9765
  // src/migrations/generic/9-CreateContacts.ts
9393
- var debug24 = Debug24("sphereon:ssi-sdk:migrations");
9766
+ var debug25 = Debug25("sphereon:ssi-sdk:migrations");
9394
9767
  var CreateContacts1715761125000 = class {
9395
9768
  static {
9396
9769
  __name(this, "CreateContacts1715761125000");
9397
9770
  }
9398
9771
  name = "CreateContacts1715761125000";
9399
9772
  async up(queryRunner) {
9400
- debug24("migration: updating contact tables");
9773
+ debug25("migration: updating contact tables");
9401
9774
  const dbType = queryRunner.connection.driver.options.type;
9402
9775
  switch (dbType) {
9403
9776
  case "postgres": {
9404
- debug24("using postgres migration file");
9777
+ debug25("using postgres migration file");
9405
9778
  const mig = new CreateContacts1715761125001();
9406
9779
  await mig.up(queryRunner);
9407
- debug24("Migration statements executed");
9780
+ debug25("Migration statements executed");
9408
9781
  return;
9409
9782
  }
9410
9783
  case "sqlite":
9411
9784
  case "expo":
9412
9785
  case "react-native": {
9413
- debug24("using sqlite/react-native migration file");
9786
+ debug25("using sqlite/react-native migration file");
9414
9787
  const mig = new CreateContacts1715761125002();
9415
9788
  await mig.up(queryRunner);
9416
- debug24("Migration statements executed");
9789
+ debug25("Migration statements executed");
9417
9790
  return;
9418
9791
  }
9419
9792
  default:
@@ -9421,23 +9794,23 @@ var CreateContacts1715761125000 = class {
9421
9794
  }
9422
9795
  }
9423
9796
  async down(queryRunner) {
9424
- debug24("migration: reverting machine state tables");
9797
+ debug25("migration: reverting machine state tables");
9425
9798
  const dbType = queryRunner.connection.driver.options.type;
9426
9799
  switch (dbType) {
9427
9800
  case "postgres": {
9428
- debug24("using postgres migration file");
9801
+ debug25("using postgres migration file");
9429
9802
  const mig = new CreateContacts1715761125001();
9430
9803
  await mig.down(queryRunner);
9431
- debug24("Migration statements executed");
9804
+ debug25("Migration statements executed");
9432
9805
  return;
9433
9806
  }
9434
9807
  case "sqlite":
9435
9808
  case "expo":
9436
9809
  case "react-native": {
9437
- debug24("using sqlite/react-native migration file");
9810
+ debug25("using sqlite/react-native migration file");
9438
9811
  const mig = new CreateContacts1715761125002();
9439
9812
  await mig.down(queryRunner);
9440
- debug24("Migration statements executed");
9813
+ debug25("Migration statements executed");
9441
9814
  return;
9442
9815
  }
9443
9816
  default:
@@ -9455,7 +9828,8 @@ var DataStoreContactMigrations = [
9455
9828
  ];
9456
9829
  var DataStoreIssuanceBrandingMigrations = [
9457
9830
  CreateIssuanceBranding1659463079429,
9458
- FixCredentialClaimsReferencesUuid1741895822987
9831
+ FixCredentialClaimsReferencesUuid1741895822987,
9832
+ AddBrandingState1766000000000
9459
9833
  ];
9460
9834
  var DataStoreStatusListMigrations = [
9461
9835
  CreateStatusList1693866470000,
@@ -9807,6 +10181,7 @@ export {
9807
10181
  credentialBrandingFrom,
9808
10182
  credentialClaimsEntityFrom,
9809
10183
  credentialLocaleBrandingEntityFrom,
10184
+ credentialLocaleBrandingFromEntity,
9810
10185
  dcqlQueryEntityItemFrom,
9811
10186
  dcqlQueryItemFrom,
9812
10187
  didAuthConfigEntityFrom,