@sphereon/ssi-sdk.data-store 0.36.1-next.50 → 0.37.0

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.
Files changed (37) hide show
  1. package/dist/index.cjs +893 -110
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +23 -2
  4. package/dist/index.d.ts +23 -2
  5. package/dist/index.js +910 -125
  6. package/dist/index.js.map +1 -1
  7. package/package.json +9 -8
  8. package/src/__tests__/contact.entities.test.ts +3 -3
  9. package/src/__tests__/contact.store.test.ts +3 -3
  10. package/src/__tests__/issuanceBranding.entities.test.ts +5 -5
  11. package/src/__tests__/issuanceBranding.store.test.ts +314 -4
  12. package/src/contact/ContactStore.ts +51 -4
  13. package/src/entities/contact/OpenIdConfigEntity.ts +2 -2
  14. package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +44 -1
  15. package/src/entities/issuanceBranding/CredentialClaimsEntity.ts +3 -0
  16. package/src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts +64 -1
  17. package/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts +63 -1
  18. package/src/index.ts +12 -0
  19. package/src/issuanceBranding/IssuanceBrandingStore.ts +45 -6
  20. package/src/migrations/generic/15-AddBrandingState.ts +64 -0
  21. package/src/migrations/generic/15-AddServiceMetadata.ts +66 -0
  22. package/src/migrations/generic/16-MakeOpenIdClientSecretNullable.ts +62 -0
  23. package/src/migrations/generic/17-AddCredentialClaimOrder.ts +64 -0
  24. package/src/migrations/generic/index.ts +25 -1
  25. package/src/migrations/index.ts +4 -0
  26. package/src/migrations/postgres/1764000000001-AddServiceMetadata.ts +44 -0
  27. package/src/migrations/postgres/1766000000000-AddBrandingState.ts +15 -0
  28. package/src/migrations/postgres/1767000000001-MakeOpenIdClientSecretNullable.ts +32 -0
  29. package/src/migrations/postgres/1768000000000-AddCredentialClaimOrder.ts +13 -0
  30. package/src/migrations/sqlite/1764000000002-AddServiceMetadata.ts +41 -0
  31. package/src/migrations/sqlite/1766000000000-AddBrandingState.ts +87 -0
  32. package/src/migrations/sqlite/1767000000002-MakeOpenIdClientSecretNullable.ts +22 -0
  33. package/src/migrations/sqlite/1768000000000-AddCredentialClaimOrder.ts +34 -0
  34. package/src/utils/contact/MappingUtils.ts +1 -1
  35. package/src/utils/issuanceBranding/HashUtils.ts +30 -0
  36. package/src/utils/issuanceBranding/MappingUtils.ts +23 -1
  37. package/src/utils/presentationDefinition/MappingUtils.ts +5 -2
package/dist/index.cjs CHANGED
@@ -51,6 +51,7 @@ __export(index_exports, {
51
51
  DataStoreDigitalCredentialEntities: () => DataStoreDigitalCredentialEntities,
52
52
  DataStoreDigitalCredentialMigrations: () => DataStoreDigitalCredentialMigrations,
53
53
  DataStoreEntities: () => DataStoreEntities,
54
+ DataStoreEntitiesWithVeramo: () => DataStoreEntitiesWithVeramo,
54
55
  DataStoreEventLoggerEntities: () => DataStoreEventLoggerEntities,
55
56
  DataStoreEventLoggerMigrations: () => DataStoreEventLoggerMigrations,
56
57
  DataStoreIssuanceBrandingEntities: () => DataStoreIssuanceBrandingEntities,
@@ -58,9 +59,11 @@ __export(index_exports, {
58
59
  DataStoreMachineStateEntities: () => DataStoreMachineStateEntities,
59
60
  DataStoreMachineStateMigrations: () => DataStoreMachineStateMigrations,
60
61
  DataStoreMigrations: () => DataStoreMigrations,
62
+ DataStoreMigrationsWithVeramo: () => DataStoreMigrationsWithVeramo,
61
63
  DataStoreOid4vcStateEntities: () => DataStoreOid4vcStateEntities,
62
64
  DataStorePresentationDefinitionEntities: () => DataStorePresentationDefinitionEntities,
63
65
  DataStorePresentationDefinitionMigrations: () => DataStorePresentationDefinitionMigrations,
66
+ DataStoreServiceMigrations: () => DataStoreServiceMigrations,
64
67
  DataStoreStatusListEntities: () => DataStoreStatusListEntities,
65
68
  DataStoreStatusListMigrations: () => DataStoreStatusListMigrations,
66
69
  DcqlQueryItemEntity: () => DcqlQueryItemEntity,
@@ -89,6 +92,8 @@ __export(index_exports, {
89
92
  StatusListEntryEntity: () => StatusListEntryEntity,
90
93
  StatusListStore: () => StatusListStore,
91
94
  TextAttributesEntity: () => TextAttributesEntity,
95
+ VeramoDataStoreEntities: () => import_data_store.Entities,
96
+ VeramoDataStoreMigrations: () => import_data_store.migrations,
92
97
  activityEventEntityFrom: () => activityEventEntityFrom,
93
98
  activityEventFrom: () => activityEventFrom,
94
99
  auditEventEntityFrom: () => auditEventEntityFrom,
@@ -106,6 +111,7 @@ __export(index_exports, {
106
111
  credentialBrandingFrom: () => credentialBrandingFrom,
107
112
  credentialClaimsEntityFrom: () => credentialClaimsEntityFrom,
108
113
  credentialLocaleBrandingEntityFrom: () => credentialLocaleBrandingEntityFrom,
114
+ credentialLocaleBrandingFromEntity: () => credentialLocaleBrandingFromEntity,
109
115
  dcqlQueryEntityItemFrom: () => dcqlQueryEntityItemFrom,
110
116
  dcqlQueryItemFrom: () => dcqlQueryItemFrom,
111
117
  didAuthConfigEntityFrom: () => didAuthConfigEntityFrom,
@@ -152,6 +158,7 @@ __export(index_exports, {
152
158
  textAttributesEntityFrom: () => textAttributesEntityFrom
153
159
  });
154
160
  module.exports = __toCommonJS(index_exports);
161
+ var import_data_store2 = require("@veramo/data-store");
155
162
 
156
163
  // src/entities/contact/BaseConfigEntity.ts
157
164
  var import_typeorm12 = require("typeorm");
@@ -1893,7 +1900,7 @@ _ts_decorate16([
1893
1900
  (0, import_typeorm15.Column)("varchar", {
1894
1901
  name: "client_secret",
1895
1902
  length: 255,
1896
- nullable: false
1903
+ nullable: true
1897
1904
  }),
1898
1905
  _ts_metadata15("design:type", String)
1899
1906
  ], OpenIdConfigEntity.prototype, "clientSecret", void 0);
@@ -3028,6 +3035,19 @@ var import_typeorm26 = require("typeorm");
3028
3035
  // src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts
3029
3036
  var import_typeorm25 = require("typeorm");
3030
3037
 
3038
+ // src/utils/issuanceBranding/HashUtils.ts
3039
+ var FNV_PRIME = 0x100000001b3n;
3040
+ var OFFSET_BASIS = 0xcbf29ce484222325n;
3041
+ function computeCompactHash(input) {
3042
+ let hash = OFFSET_BASIS;
3043
+ for (let i = 0; i < input.length; i++) {
3044
+ hash ^= BigInt(input.charCodeAt(i));
3045
+ hash = hash * FNV_PRIME & 0xffffffffffffffffn;
3046
+ }
3047
+ return hash.toString(36);
3048
+ }
3049
+ __name(computeCompactHash, "computeCompactHash");
3050
+
3031
3051
  // src/entities/issuanceBranding/CredentialClaimsEntity.ts
3032
3052
  var import_class_validator16 = require("class-validator");
3033
3053
  var import_typeorm24 = require("typeorm");
@@ -3049,6 +3069,7 @@ var CredentialClaimsEntity = class extends import_typeorm24.BaseEntity {
3049
3069
  id;
3050
3070
  key;
3051
3071
  name;
3072
+ order;
3052
3073
  credentialLocaleBranding;
3053
3074
  async validate() {
3054
3075
  const validation = await (0, import_class_validator16.validate)(this);
@@ -3086,6 +3107,13 @@ _ts_decorate25([
3086
3107
  }),
3087
3108
  _ts_metadata24("design:type", String)
3088
3109
  ], CredentialClaimsEntity.prototype, "name", void 0);
3110
+ _ts_decorate25([
3111
+ (0, import_typeorm24.Column)("integer", {
3112
+ name: "order",
3113
+ nullable: true
3114
+ }),
3115
+ _ts_metadata24("design:type", Number)
3116
+ ], CredentialClaimsEntity.prototype, "order", void 0);
3089
3117
  _ts_decorate25([
3090
3118
  (0, import_typeorm24.ManyToOne)(() => CredentialLocaleBrandingEntity, (credentialLocaleBranding) => credentialLocaleBranding.claims, {
3091
3119
  cascade: [
@@ -3132,6 +3160,10 @@ var CredentialLocaleBrandingEntity = class extends BaseLocaleBrandingEntity {
3132
3160
  credentialBranding;
3133
3161
  claims;
3134
3162
  credentialBrandingId;
3163
+ state;
3164
+ setState() {
3165
+ this.state = computeCredentialLocaleBrandingState(this);
3166
+ }
3135
3167
  };
3136
3168
  _ts_decorate26([
3137
3169
  (0, import_typeorm25.ManyToOne)(() => CredentialBrandingEntity, (credentialBranding) => credentialBranding.localeBranding, {
@@ -3161,6 +3193,21 @@ _ts_decorate26([
3161
3193
  }),
3162
3194
  _ts_metadata25("design:type", String)
3163
3195
  ], CredentialLocaleBrandingEntity.prototype, "credentialBrandingId", void 0);
3196
+ _ts_decorate26([
3197
+ (0, import_typeorm25.Column)("varchar", {
3198
+ name: "state",
3199
+ length: 255,
3200
+ nullable: false
3201
+ }),
3202
+ _ts_metadata25("design:type", String)
3203
+ ], CredentialLocaleBrandingEntity.prototype, "state", void 0);
3204
+ _ts_decorate26([
3205
+ (0, import_typeorm25.BeforeInsert)(),
3206
+ (0, import_typeorm25.BeforeUpdate)(),
3207
+ _ts_metadata25("design:type", Function),
3208
+ _ts_metadata25("design:paramtypes", []),
3209
+ _ts_metadata25("design:returntype", void 0)
3210
+ ], CredentialLocaleBrandingEntity.prototype, "setState", null);
3164
3211
  CredentialLocaleBrandingEntity = _ts_decorate26([
3165
3212
  (0, import_typeorm25.ChildEntity)("CredentialLocaleBranding"),
3166
3213
  (0, import_typeorm25.Index)("IDX_CredentialLocaleBrandingEntity_credentialBranding_locale", [
@@ -3170,6 +3217,45 @@ CredentialLocaleBrandingEntity = _ts_decorate26([
3170
3217
  unique: true
3171
3218
  })
3172
3219
  ], CredentialLocaleBrandingEntity);
3220
+ var computeCredentialLocaleBrandingState = /* @__PURE__ */ __name((localeBranding) => {
3221
+ const sortedClaims = (localeBranding.claims ?? []).map((claim) => ({
3222
+ key: claim.key,
3223
+ name: claim.name
3224
+ })).sort((first, second) => first.key.localeCompare(second.key));
3225
+ const payload = {
3226
+ alias: localeBranding.alias ?? null,
3227
+ locale: localeBranding.locale ?? null,
3228
+ description: localeBranding.description ?? null,
3229
+ logo: localeBranding.logo ? {
3230
+ uri: localeBranding.logo.uri ?? null,
3231
+ dataUri: localeBranding.logo.dataUri ?? null,
3232
+ mediaType: localeBranding.logo.mediaType ?? null,
3233
+ alt: localeBranding.logo.alt ?? null,
3234
+ dimensions: localeBranding.logo.dimensions ? {
3235
+ width: localeBranding.logo.dimensions.width,
3236
+ height: localeBranding.logo.dimensions.height
3237
+ } : null
3238
+ } : null,
3239
+ background: localeBranding.background ? {
3240
+ color: localeBranding.background.color ?? null,
3241
+ image: localeBranding.background.image ? {
3242
+ uri: localeBranding.background.image.uri ?? null,
3243
+ dataUri: localeBranding.background.image.dataUri ?? null,
3244
+ mediaType: localeBranding.background.image.mediaType ?? null,
3245
+ alt: localeBranding.background.image.alt ?? null,
3246
+ dimensions: localeBranding.background.image.dimensions ? {
3247
+ width: localeBranding.background.image.dimensions.width,
3248
+ height: localeBranding.background.image.dimensions.height
3249
+ } : null
3250
+ } : null
3251
+ } : null,
3252
+ text: localeBranding.text ? {
3253
+ color: localeBranding.text.color ?? null
3254
+ } : null,
3255
+ claims: sortedClaims
3256
+ };
3257
+ return computeCompactHash(JSON.stringify(payload));
3258
+ }, "computeCredentialLocaleBrandingState");
3173
3259
 
3174
3260
  // src/entities/issuanceBranding/CredentialBrandingEntity.ts
3175
3261
  function _ts_decorate27(decorators, target, key, desc) {
@@ -3190,6 +3276,7 @@ var CredentialBrandingEntity = class extends import_typeorm26.BaseEntity {
3190
3276
  id;
3191
3277
  vcHash;
3192
3278
  issuerCorrelationId;
3279
+ state;
3193
3280
  localeBranding;
3194
3281
  createdAt;
3195
3282
  lastUpdatedAt;
@@ -3197,6 +3284,11 @@ var CredentialBrandingEntity = class extends import_typeorm26.BaseEntity {
3197
3284
  updateUpdatedDate() {
3198
3285
  this.lastUpdatedAt = /* @__PURE__ */ new Date();
3199
3286
  }
3287
+ setState() {
3288
+ if (this.localeBranding && Array.isArray(this.localeBranding)) {
3289
+ this.state = this.computeState();
3290
+ }
3291
+ }
3200
3292
  async validate() {
3201
3293
  const validation = await (0, import_class_validator17.validate)(this);
3202
3294
  if (validation.length > 0) {
@@ -3204,6 +3296,31 @@ var CredentialBrandingEntity = class extends import_typeorm26.BaseEntity {
3204
3296
  }
3205
3297
  return;
3206
3298
  }
3299
+ computeState() {
3300
+ const localeStates = (this.localeBranding ?? []).map((localeBranding) => ({
3301
+ locale: localeBranding.locale ?? "",
3302
+ alias: localeBranding.alias ?? "",
3303
+ id: localeBranding.id ?? "",
3304
+ state: computeCredentialLocaleBrandingState(localeBranding)
3305
+ }));
3306
+ localeStates.sort((first, second) => {
3307
+ const localeCompare = first.locale.localeCompare(second.locale);
3308
+ if (localeCompare !== 0) {
3309
+ return localeCompare;
3310
+ }
3311
+ const aliasCompare = first.alias.localeCompare(second.alias);
3312
+ if (aliasCompare !== 0) {
3313
+ return aliasCompare;
3314
+ }
3315
+ return first.id.localeCompare(second.id);
3316
+ });
3317
+ const payload = {
3318
+ issuerCorrelationId: this.issuerCorrelationId,
3319
+ vcHash: this.vcHash,
3320
+ localeBranding: localeStates.map((entry) => entry.state)
3321
+ };
3322
+ return computeCompactHash(JSON.stringify(payload));
3323
+ }
3207
3324
  };
3208
3325
  _ts_decorate27([
3209
3326
  (0, import_typeorm26.PrimaryGeneratedColumn)("uuid"),
@@ -3233,6 +3350,14 @@ _ts_decorate27([
3233
3350
  }),
3234
3351
  _ts_metadata26("design:type", String)
3235
3352
  ], CredentialBrandingEntity.prototype, "issuerCorrelationId", void 0);
3353
+ _ts_decorate27([
3354
+ (0, import_typeorm26.Column)("varchar", {
3355
+ name: "state",
3356
+ length: 255,
3357
+ nullable: false
3358
+ }),
3359
+ _ts_metadata26("design:type", String)
3360
+ ], CredentialBrandingEntity.prototype, "state", void 0);
3236
3361
  _ts_decorate27([
3237
3362
  (0, import_typeorm26.OneToMany)(() => CredentialLocaleBrandingEntity, (credentialLocaleBrandingEntity) => credentialLocaleBrandingEntity.credentialBranding, {
3238
3363
  cascade: true,
@@ -3268,6 +3393,13 @@ _ts_decorate27([
3268
3393
  _ts_metadata26("design:paramtypes", []),
3269
3394
  _ts_metadata26("design:returntype", void 0)
3270
3395
  ], CredentialBrandingEntity.prototype, "updateUpdatedDate", null);
3396
+ _ts_decorate27([
3397
+ (0, import_typeorm26.BeforeInsert)(),
3398
+ (0, import_typeorm26.BeforeUpdate)(),
3399
+ _ts_metadata26("design:type", Function),
3400
+ _ts_metadata26("design:paramtypes", []),
3401
+ _ts_metadata26("design:returntype", void 0)
3402
+ ], CredentialBrandingEntity.prototype, "setState", null);
3271
3403
  _ts_decorate27([
3272
3404
  (0, import_typeorm26.BeforeInsert)(),
3273
3405
  (0, import_typeorm26.BeforeUpdate)(),
@@ -3314,6 +3446,48 @@ var IssuerLocaleBrandingEntity = class extends BaseLocaleBrandingEntity {
3314
3446
  policyUri;
3315
3447
  contacts;
3316
3448
  issuerBrandingId;
3449
+ state;
3450
+ setState() {
3451
+ this.state = this.computeState();
3452
+ }
3453
+ computeState() {
3454
+ const payload = {
3455
+ alias: this.alias ?? null,
3456
+ locale: this.locale ?? null,
3457
+ description: this.description ?? null,
3458
+ clientUri: this.clientUri ?? null,
3459
+ tosUri: this.tosUri ?? null,
3460
+ policyUri: this.policyUri ?? null,
3461
+ contacts: this.contacts ?? null,
3462
+ logo: this.logo ? {
3463
+ uri: this.logo.uri ?? null,
3464
+ dataUri: this.logo.dataUri ?? null,
3465
+ mediaType: this.logo.mediaType ?? null,
3466
+ alt: this.logo.alt ?? null,
3467
+ dimensions: this.logo.dimensions ? {
3468
+ width: this.logo.dimensions.width,
3469
+ height: this.logo.dimensions.height
3470
+ } : null
3471
+ } : null,
3472
+ background: this.background ? {
3473
+ color: this.background.color ?? null,
3474
+ image: this.background.image ? {
3475
+ uri: this.background.image.uri ?? null,
3476
+ dataUri: this.background.image.dataUri ?? null,
3477
+ mediaType: this.background.image.mediaType ?? null,
3478
+ alt: this.background.image.alt ?? null,
3479
+ dimensions: this.background.image.dimensions ? {
3480
+ width: this.background.image.dimensions.width,
3481
+ height: this.background.image.dimensions.height
3482
+ } : null
3483
+ } : null
3484
+ } : null,
3485
+ text: this.text ? {
3486
+ color: this.text.color ?? null
3487
+ } : null
3488
+ };
3489
+ return computeCompactHash(JSON.stringify(payload));
3490
+ }
3317
3491
  };
3318
3492
  _ts_decorate28([
3319
3493
  (0, import_typeorm27.ManyToOne)(() => IssuerBrandingEntity, (issuerBranding) => issuerBranding.localeBranding, {
@@ -3372,6 +3546,21 @@ _ts_decorate28([
3372
3546
  }),
3373
3547
  _ts_metadata27("design:type", String)
3374
3548
  ], IssuerLocaleBrandingEntity.prototype, "issuerBrandingId", void 0);
3549
+ _ts_decorate28([
3550
+ (0, import_typeorm27.Column)("varchar", {
3551
+ name: "state",
3552
+ length: 255,
3553
+ nullable: false
3554
+ }),
3555
+ _ts_metadata27("design:type", String)
3556
+ ], IssuerLocaleBrandingEntity.prototype, "state", void 0);
3557
+ _ts_decorate28([
3558
+ (0, import_typeorm27.BeforeInsert)(),
3559
+ (0, import_typeorm27.BeforeUpdate)(),
3560
+ _ts_metadata27("design:type", Function),
3561
+ _ts_metadata27("design:paramtypes", []),
3562
+ _ts_metadata27("design:returntype", void 0)
3563
+ ], IssuerLocaleBrandingEntity.prototype, "setState", null);
3375
3564
  IssuerLocaleBrandingEntity = _ts_decorate28([
3376
3565
  (0, import_typeorm27.ChildEntity)("IssuerLocaleBranding"),
3377
3566
  (0, import_typeorm27.Index)("IDX_IssuerLocaleBrandingEntity_issuerBranding_locale", [
@@ -4766,7 +4955,7 @@ var didAuthConfigFrom = /* @__PURE__ */ __name((config) => {
4766
4955
  };
4767
4956
  return replaceNullWithUndefined(result);
4768
4957
  }, "didAuthConfigFrom");
4769
- var isOpenIdConfig = /* @__PURE__ */ __name((config) => "clientSecret" in config && "issuer" in config && "redirectUrl" in config, "isOpenIdConfig");
4958
+ var isOpenIdConfig = /* @__PURE__ */ __name((config) => "clientId" in config && "issuer" in config && "redirectUrl" in config, "isOpenIdConfig");
4770
4959
  var isDidAuthConfig = /* @__PURE__ */ __name((config) => ("identifier" in config || "idOpts" in config && "identifier" in config.idOpts) && "redirectUrl" in config && "sessionId" in config, "isDidAuthConfig");
4771
4960
 
4772
4961
  // src/contact/ContactStore.ts
@@ -4806,10 +4995,19 @@ var ContactStore = class extends import_ssi_sdk25.AbstractContactStore {
4806
4995
  const result = await partyRepository.find({
4807
4996
  where: {
4808
4997
  id: (0, import_typeorm35.In)(initialResult.map((party) => party.id))
4809
- }
4998
+ },
4999
+ relations: [
5000
+ "contact"
5001
+ ]
4810
5002
  });
4811
5003
  debug(`getParties() resulted in ${result.length} parties`);
4812
- return result.map(partyFrom);
5004
+ return result.filter((party) => {
5005
+ if (!party.contact) {
5006
+ console.warn(`party ${party.id} does not have an associated contact`);
5007
+ return false;
5008
+ }
5009
+ return true;
5010
+ }).map(partyFrom);
4813
5011
  }, "getParties");
4814
5012
  addParty = /* @__PURE__ */ __name(async (args) => {
4815
5013
  const { identities, contact, partyType } = args;
@@ -4924,10 +5122,54 @@ var ContactStore = class extends import_ssi_sdk25.AbstractContactStore {
4924
5122
  return Promise.reject(Error(`Connection type ${identity.connection.type}, does not match for provided config`));
4925
5123
  }
4926
5124
  }
4927
- const identityEntity = identityEntityFrom(identity);
5125
+ const identityRepository = (await this.dbConnection).getRepository(IdentityEntity);
5126
+ const correlationIdentifierRepository = (await this.dbConnection).getRepository(CorrelationIdentifierEntity);
5127
+ const existingCorrelationIdentifier = await correlationIdentifierRepository.findOne({
5128
+ where: {
5129
+ correlationId: identity.identifier.correlationId
5130
+ }
5131
+ });
5132
+ if (existingCorrelationIdentifier) {
5133
+ const existingIdentity = await identityRepository.findOne({
5134
+ where: {
5135
+ identifier: {
5136
+ id: existingCorrelationIdentifier.id
5137
+ }
5138
+ }
5139
+ });
5140
+ if (existingIdentity) {
5141
+ debug("Identity with same correlationId already exists, returning existing identity", identity.identifier.correlationId);
5142
+ return identityFrom(existingIdentity);
5143
+ }
5144
+ }
5145
+ const existingAlias = await identityRepository.findOne({
5146
+ where: {
5147
+ alias: identity.alias
5148
+ }
5149
+ });
5150
+ let uniqueAlias = identity.alias;
5151
+ if (existingAlias) {
5152
+ let counter = 1;
5153
+ while (await identityRepository.findOne({
5154
+ where: {
5155
+ alias: `${identity.alias}_${counter}`
5156
+ }
5157
+ })) {
5158
+ counter++;
5159
+ }
5160
+ uniqueAlias = `${identity.alias}_${counter}`;
5161
+ debug("Alias collision detected, using unique alias", {
5162
+ original: identity.alias,
5163
+ unique: uniqueAlias
5164
+ });
5165
+ }
5166
+ const identityEntity = identityEntityFrom({
5167
+ ...identity,
5168
+ alias: uniqueAlias
5169
+ });
4928
5170
  identityEntity.party = party;
4929
5171
  debug("Adding identity", identity);
4930
- const result = await (await this.dbConnection).getRepository(IdentityEntity).save(identityEntity, {
5172
+ const result = await identityRepository.save(identityEntity, {
4931
5173
  transaction: true
4932
5174
  });
4933
5175
  return identityFrom(result);
@@ -5605,7 +5847,7 @@ var import_typeorm37 = require("typeorm");
5605
5847
  var credentialBrandingFrom = /* @__PURE__ */ __name((credentialBranding) => {
5606
5848
  const result = {
5607
5849
  ...credentialBranding,
5608
- localeBranding: credentialBranding.localeBranding.map((localeBranding) => localeBrandingFrom(localeBranding))
5850
+ localeBranding: credentialBranding.localeBranding.map((localeBranding) => credentialLocaleBrandingFromEntity(localeBranding))
5609
5851
  };
5610
5852
  return replaceNullWithUndefined(result);
5611
5853
  }, "credentialBrandingFrom");
@@ -5623,6 +5865,22 @@ var localeBrandingFrom = /* @__PURE__ */ __name((localeBranding) => {
5623
5865
  };
5624
5866
  return replaceNullWithUndefined(result);
5625
5867
  }, "localeBrandingFrom");
5868
+ var credentialLocaleBrandingFromEntity = /* @__PURE__ */ __name((localeBranding) => {
5869
+ const base = localeBrandingFrom(localeBranding);
5870
+ const result = {
5871
+ ...base,
5872
+ state: localeBranding.state,
5873
+ claims: localeBranding.claims ? localeBranding.claims.map((claim) => ({
5874
+ id: claim.id,
5875
+ key: claim.key,
5876
+ name: claim.name,
5877
+ ...claim.order != null && {
5878
+ order: claim.order
5879
+ }
5880
+ })) : void 0
5881
+ };
5882
+ return replaceNullWithUndefined(result);
5883
+ }, "credentialLocaleBrandingFromEntity");
5626
5884
  var issuerLocaleBrandingEntityFrom = /* @__PURE__ */ __name((args) => {
5627
5885
  const issuerLocaleBrandingEntity = new IssuerLocaleBrandingEntity();
5628
5886
  issuerLocaleBrandingEntity.alias = isEmptyString(args.alias) ? void 0 : args.alias;
@@ -5691,6 +5949,7 @@ var credentialClaimsEntityFrom = /* @__PURE__ */ __name((args) => {
5691
5949
  const credentialClaimsEntity = new CredentialClaimsEntity();
5692
5950
  credentialClaimsEntity.key = args.key;
5693
5951
  credentialClaimsEntity.name = args.name;
5952
+ credentialClaimsEntity.order = args.order;
5694
5953
  return credentialClaimsEntity;
5695
5954
  }, "credentialClaimsEntityFrom");
5696
5955
 
@@ -5727,7 +5986,7 @@ var IssuanceBrandingStore = class extends import_ssi_sdk27.AbstractIssuanceBrand
5727
5986
  return credentialBrandingFrom(createdResult);
5728
5987
  }, "addCredentialBranding");
5729
5988
  getCredentialBranding = /* @__PURE__ */ __name(async (args) => {
5730
- const { filter } = args ?? {};
5989
+ const { filter, knownStates } = args ?? {};
5731
5990
  if (filter) {
5732
5991
  filter.forEach((filter2) => {
5733
5992
  if (filter2.localeBranding && "locale" in filter2.localeBranding && filter2.localeBranding.locale === void 0) {
@@ -5736,12 +5995,39 @@ var IssuanceBrandingStore = class extends import_ssi_sdk27.AbstractIssuanceBrand
5736
5995
  });
5737
5996
  }
5738
5997
  debug3("Getting credential branding", args);
5739
- const result = await (await this.dbConnection).getRepository(CredentialBrandingEntity).find({
5998
+ const repository = (await this.dbConnection).getRepository(CredentialBrandingEntity);
5999
+ if (knownStates && Object.keys(knownStates).length > 0) {
6000
+ const stateQuery = repository.createQueryBuilder("branding").select([
6001
+ "branding.id",
6002
+ "branding.state"
6003
+ ]);
6004
+ if (filter) {
6005
+ stateQuery.where(filter);
6006
+ }
6007
+ const stateResults = await stateQuery.getRawMany().then((rows) => rows.map((row) => ({
6008
+ id: row.branding_id,
6009
+ state: row.branding_state
6010
+ })));
6011
+ const dirtyIds = stateResults.filter((result3) => {
6012
+ const knownState = knownStates[result3.id];
6013
+ return !knownState || knownState !== result3.state;
6014
+ }).map((result3) => result3.id);
6015
+ if (dirtyIds.length === 0) {
6016
+ return [];
6017
+ }
6018
+ const result2 = await repository.find({
6019
+ where: {
6020
+ id: (0, import_typeorm37.In)(dirtyIds)
6021
+ }
6022
+ });
6023
+ return result2.map((branding) => credentialBrandingFrom(branding));
6024
+ }
6025
+ const result = await repository.find({
5740
6026
  ...filter && {
5741
6027
  where: filter
5742
6028
  }
5743
6029
  });
5744
- return result.map((credentialBranding) => credentialBrandingFrom(credentialBranding));
6030
+ return result.map((branding) => credentialBrandingFrom(branding));
5745
6031
  }, "getCredentialBranding");
5746
6032
  removeCredentialBranding = /* @__PURE__ */ __name(async (args) => {
5747
6033
  const { filter } = args;
@@ -5834,7 +6120,7 @@ var IssuanceBrandingStore = class extends import_ssi_sdk27.AbstractIssuanceBrand
5834
6120
  where: filter
5835
6121
  }
5836
6122
  });
5837
- return credentialBrandingLocale ? credentialBrandingLocale.map((credentialLocaleBranding) => localeBrandingFrom(credentialLocaleBranding)) : [];
6123
+ return credentialBrandingLocale ? credentialBrandingLocale.map((credentialLocaleBranding) => credentialLocaleBrandingFromEntity(credentialLocaleBranding)) : [];
5838
6124
  }, "getCredentialLocaleBranding");
5839
6125
  removeCredentialLocaleBranding = /* @__PURE__ */ __name(async (args) => {
5840
6126
  const { filter } = args;
@@ -6839,8 +7125,9 @@ var import_debug7 = __toESM(require("debug"), 1);
6839
7125
  var import_typeorm40 = require("typeorm");
6840
7126
 
6841
7127
  // src/utils/presentationDefinition/MappingUtils.ts
6842
- var blakepkg = __toESM(require("blakejs"), 1);
7128
+ var blakejs = __toESM(require("blakejs"), 1);
6843
7129
  var import_dcql = require("dcql");
7130
+ var blake = blakejs.default ?? blakejs;
6844
7131
  var dcqlQueryItemFrom = /* @__PURE__ */ __name((entity) => {
6845
7132
  const result = {
6846
7133
  id: entity.id,
@@ -6873,7 +7160,7 @@ var dcqlQueryEntityItemFrom = /* @__PURE__ */ __name((item) => {
6873
7160
  return entity;
6874
7161
  }, "dcqlQueryEntityItemFrom");
6875
7162
  function hashPayload(payload) {
6876
- return blakepkg.blake2bHex(JSON.stringify(payload));
7163
+ return blake.blake2bHex(JSON.stringify(payload));
6877
7164
  }
6878
7165
  __name(hashPayload, "hashPayload");
6879
7166
  function isPresentationDefinitionEqual(base, compare) {
@@ -7046,6 +7333,9 @@ var cleanFilter = /* @__PURE__ */ __name((filter) => {
7046
7333
  });
7047
7334
  }, "cleanFilter");
7048
7335
 
7336
+ // src/migrations/generic/index.ts
7337
+ var import_data_store = require("@veramo/data-store");
7338
+
7049
7339
  // src/migrations/generic/1-CreateContacts.ts
7050
7340
  var import_debug8 = __toESM(require("debug"), 1);
7051
7341
 
@@ -8094,21 +8384,113 @@ var AddLinkedVpFields1763387280000 = class {
8094
8384
  }
8095
8385
  };
8096
8386
 
8097
- // src/migrations/generic/2-CreateIssuanceBranding.ts
8387
+ // src/migrations/generic/15-AddBrandingState.ts
8098
8388
  var import_debug14 = __toESM(require("debug"), 1);
8389
+
8390
+ // src/migrations/postgres/1766000000000-AddBrandingState.ts
8391
+ var AddBrandingStatePostgres1766000000000 = class {
8392
+ static {
8393
+ __name(this, "AddBrandingStatePostgres1766000000000");
8394
+ }
8395
+ name = "AddBrandingState1766000000000";
8396
+ async up(queryRunner) {
8397
+ await queryRunner.query(`ALTER TABLE "CredentialBranding" ADD "state" character varying(255) NOT NULL DEFAULT ''`);
8398
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD "state" character varying(255) NOT NULL DEFAULT ''`);
8399
+ }
8400
+ async down(queryRunner) {
8401
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP COLUMN "state"`);
8402
+ await queryRunner.query(`ALTER TABLE "CredentialBranding" DROP COLUMN "state"`);
8403
+ }
8404
+ };
8405
+
8406
+ // src/migrations/sqlite/1766000000000-AddBrandingState.ts
8407
+ var AddBrandingStateSqlite1766000000000 = class {
8408
+ static {
8409
+ __name(this, "AddBrandingStateSqlite1766000000000");
8410
+ }
8411
+ name = "AddBrandingState1766000000000";
8412
+ async up(queryRunner) {
8413
+ await queryRunner.query(`ALTER TABLE "CredentialBranding" ADD COLUMN "state" varchar(255) NOT NULL DEFAULT ''`);
8414
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD COLUMN "state" varchar(255) NOT NULL DEFAULT ''`);
8415
+ }
8416
+ async down(queryRunner) {
8417
+ await queryRunner.query(`PRAGMA foreign_keys = OFF`);
8418
+ await queryRunner.query(`
8419
+ CREATE TABLE "CredentialBranding_old"
8420
+ (
8421
+ "id" varchar PRIMARY KEY NOT NULL,
8422
+ "vcHash" varchar(255) NOT NULL,
8423
+ "issuerCorrelationId" varchar(255) NOT NULL,
8424
+ "created_at" datetime NOT NULL DEFAULT (datetime('now')),
8425
+ "last_updated_at" datetime NOT NULL DEFAULT (datetime('now'))
8426
+ )
8427
+ `);
8428
+ await queryRunner.query(`
8429
+ INSERT INTO "CredentialBranding_old" ("id", "vcHash", "issuerCorrelationId", "created_at", "last_updated_at")
8430
+ SELECT "id", "vcHash", "issuerCorrelationId", "created_at", "last_updated_at"
8431
+ FROM "CredentialBranding"
8432
+ `);
8433
+ await queryRunner.query(`DROP TABLE "CredentialBranding"`);
8434
+ await queryRunner.query(`ALTER TABLE "CredentialBranding_old" RENAME TO "CredentialBranding"`);
8435
+ await queryRunner.query(`CREATE INDEX "IDX_CredentialBrandingEntity_issuerCorrelationId" ON "CredentialBranding" ("issuerCorrelationId")`);
8436
+ await queryRunner.query(`CREATE INDEX "IDX_CredentialBrandingEntity_vcHash" ON "CredentialBranding" ("vcHash")`);
8437
+ await queryRunner.query(`
8438
+ CREATE TABLE "BaseLocaleBranding_old"
8439
+ (
8440
+ "id" varchar PRIMARY KEY NOT NULL,
8441
+ "alias" varchar(255),
8442
+ "locale" varchar(255) NOT NULL,
8443
+ "description" varchar(255),
8444
+ "created_at" datetime NOT NULL DEFAULT (datetime('now')),
8445
+ "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')),
8446
+ "credentialBrandingId" varchar,
8447
+ "issuerBrandingId" varchar,
8448
+ "type" varchar NOT NULL,
8449
+ "logoId" varchar,
8450
+ "backgroundId" varchar,
8451
+ "textId" varchar,
8452
+ "client_uri" varchar,
8453
+ "tos_uri" varchar,
8454
+ "policy_uri" varchar,
8455
+ "contacts" varchar,
8456
+ CONSTRAINT "UQ_logoId" UNIQUE ("logoId"),
8457
+ CONSTRAINT "UQ_backgroundId" UNIQUE ("backgroundId"),
8458
+ CONSTRAINT "UQ_textId" UNIQUE ("textId"),
8459
+ CONSTRAINT "FK_BaseLocaleBranding_logoId" FOREIGN KEY ("logoId") REFERENCES "ImageAttributes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
8460
+ CONSTRAINT "FK_BaseLocaleBranding_backgroundId" FOREIGN KEY ("backgroundId") REFERENCES "BackgroundAttributes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
8461
+ CONSTRAINT "FK_BaseLocaleBranding_textId" FOREIGN KEY ("textId") REFERENCES "TextAttributes" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
8462
+ CONSTRAINT "FK_BaseLocaleBranding_credentialBrandingId" FOREIGN KEY ("credentialBrandingId") REFERENCES "CredentialBranding" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
8463
+ CONSTRAINT "FK_BaseLocaleBranding_issuerBrandingId" FOREIGN KEY ("issuerBrandingId") REFERENCES "IssuerBranding" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
8464
+ )
8465
+ `);
8466
+ await queryRunner.query(`
8467
+ 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")
8468
+ SELECT "id", "alias", "locale", "description", "created_at", "last_updated_at", "credentialBrandingId", "issuerBrandingId", "type", "logoId", "backgroundId", "textId", "client_uri", "tos_uri", "policy_uri", "contacts"
8469
+ FROM "BaseLocaleBranding"
8470
+ `);
8471
+ await queryRunner.query(`DROP TABLE "BaseLocaleBranding"`);
8472
+ await queryRunner.query(`ALTER TABLE "BaseLocaleBranding_old" RENAME TO "BaseLocaleBranding"`);
8473
+ await queryRunner.query(`CREATE UNIQUE INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale" ON "BaseLocaleBranding" ("credentialBrandingId", "locale")`);
8474
+ await queryRunner.query(`CREATE UNIQUE INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale" ON "BaseLocaleBranding" ("issuerBrandingId", "locale")`);
8475
+ await queryRunner.query(`CREATE INDEX "IDX_BaseLocaleBranding_type" ON "BaseLocaleBranding" ("type")`);
8476
+ await queryRunner.query(`PRAGMA foreign_keys = ON`);
8477
+ }
8478
+ };
8479
+
8480
+ // src/migrations/generic/15-AddBrandingState.ts
8099
8481
  var debug14 = (0, import_debug14.default)("sphereon:ssi-sdk:migrations");
8100
- var CreateIssuanceBranding1659463079429 = class {
8482
+ var AddBrandingState1766000000000 = class {
8101
8483
  static {
8102
- __name(this, "CreateIssuanceBranding1659463079429");
8484
+ __name(this, "AddBrandingState1766000000000");
8103
8485
  }
8104
- name = "CreateIssuanceBranding1659463079429";
8486
+ name = "AddBrandingState1766000000000";
8105
8487
  async up(queryRunner) {
8106
- debug14("migration: creating issuance branding tables");
8488
+ debug14("migration: adding branding state checksum columns");
8107
8489
  const dbType = queryRunner.connection.driver.options.type;
8108
8490
  switch (dbType) {
8109
8491
  case "postgres": {
8110
8492
  debug14("using postgres migration file");
8111
- const mig = new CreateIssuanceBranding1685628974232();
8493
+ const mig = new AddBrandingStatePostgres1766000000000();
8112
8494
  await mig.up(queryRunner);
8113
8495
  debug14("Migration statements executed");
8114
8496
  return;
@@ -8117,7 +8499,7 @@ var CreateIssuanceBranding1659463079429 = class {
8117
8499
  case "expo":
8118
8500
  case "react-native": {
8119
8501
  debug14("using sqlite/react-native migration file");
8120
- const mig = new CreateIssuanceBranding1685628973231();
8502
+ const mig = new AddBrandingStateSqlite1766000000000();
8121
8503
  await mig.up(queryRunner);
8122
8504
  debug14("Migration statements executed");
8123
8505
  return;
@@ -8127,12 +8509,12 @@ var CreateIssuanceBranding1659463079429 = class {
8127
8509
  }
8128
8510
  }
8129
8511
  async down(queryRunner) {
8130
- debug14("migration: reverting issuance branding tables");
8512
+ debug14("migration: removing branding state checksum columns");
8131
8513
  const dbType = queryRunner.connection.driver.options.type;
8132
8514
  switch (dbType) {
8133
8515
  case "postgres": {
8134
8516
  debug14("using postgres migration file");
8135
- const mig = new CreateIssuanceBranding1685628974232();
8517
+ const mig = new AddBrandingStatePostgres1766000000000();
8136
8518
  await mig.down(queryRunner);
8137
8519
  debug14("Migration statements executed");
8138
8520
  return;
@@ -8141,7 +8523,7 @@ var CreateIssuanceBranding1659463079429 = class {
8141
8523
  case "expo":
8142
8524
  case "react-native": {
8143
8525
  debug14("using sqlite/react-native migration file");
8144
- const mig = new CreateIssuanceBranding1685628973231();
8526
+ const mig = new AddBrandingStateSqlite1766000000000();
8145
8527
  await mig.down(queryRunner);
8146
8528
  debug14("Migration statements executed");
8147
8529
  return;
@@ -8152,8 +8534,394 @@ var CreateIssuanceBranding1659463079429 = class {
8152
8534
  }
8153
8535
  };
8154
8536
 
8155
- // src/migrations/generic/3-CreateContacts.ts
8537
+ // src/migrations/generic/15-AddServiceMetadata.ts
8538
+ var import_debug17 = __toESM(require("debug"), 1);
8539
+
8540
+ // src/migrations/postgres/1764000000001-AddServiceMetadata.ts
8156
8541
  var import_debug15 = __toESM(require("debug"), 1);
8542
+ var debug15 = (0, import_debug15.default)("sphereon:ssi-sdk:migrations");
8543
+ var AddServiceMetadata1764000000001 = class {
8544
+ static {
8545
+ __name(this, "AddServiceMetadata1764000000001");
8546
+ }
8547
+ name = "AddServiceMetadata1764000000001";
8548
+ async up(queryRunner) {
8549
+ const table = await queryRunner.getTable("service");
8550
+ if (!table) {
8551
+ 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.");
8552
+ console.warn("[SSI-SDK Migration] AddServiceMetadata: Skipping - service table does not exist (Veramo DID Manager not in use)");
8553
+ return;
8554
+ }
8555
+ await queryRunner.query(`
8556
+ ALTER TABLE "service"
8557
+ ADD COLUMN IF NOT EXISTS "metadata" jsonb
8558
+ `);
8559
+ debug15("AddServiceMetadata: Added metadata column to service table");
8560
+ }
8561
+ async down(queryRunner) {
8562
+ const table = await queryRunner.getTable("service");
8563
+ if (!table) {
8564
+ return;
8565
+ }
8566
+ await queryRunner.query(`
8567
+ ALTER TABLE "service"
8568
+ DROP COLUMN IF EXISTS "metadata"
8569
+ `);
8570
+ }
8571
+ };
8572
+
8573
+ // src/migrations/sqlite/1764000000002-AddServiceMetadata.ts
8574
+ var import_debug16 = __toESM(require("debug"), 1);
8575
+ var debug16 = (0, import_debug16.default)("sphereon:ssi-sdk:migrations");
8576
+ var AddServiceMetadata1764000000002 = class {
8577
+ static {
8578
+ __name(this, "AddServiceMetadata1764000000002");
8579
+ }
8580
+ name = "AddServiceMetadata1764000000002";
8581
+ async up(queryRunner) {
8582
+ const table = await queryRunner.getTable("service");
8583
+ if (!table) {
8584
+ 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.");
8585
+ console.warn("[SSI-SDK Migration] AddServiceMetadata: Skipping - service table does not exist (Veramo DID Manager not in use)");
8586
+ return;
8587
+ }
8588
+ const hasMetadataColumn = table.columns.some((col) => col.name === "metadata");
8589
+ if (!hasMetadataColumn) {
8590
+ await queryRunner.query(`
8591
+ ALTER TABLE "service"
8592
+ ADD COLUMN "metadata" text
8593
+ `);
8594
+ debug16("AddServiceMetadata: Added metadata column to service table");
8595
+ }
8596
+ }
8597
+ async down(queryRunner) {
8598
+ }
8599
+ };
8600
+
8601
+ // src/migrations/generic/15-AddServiceMetadata.ts
8602
+ var debug17 = (0, import_debug17.default)("sphereon:ssi-sdk:migrations");
8603
+ var AddServiceMetadata1764000000000 = class {
8604
+ static {
8605
+ __name(this, "AddServiceMetadata1764000000000");
8606
+ }
8607
+ name = "AddServiceMetadata1764000000000";
8608
+ async up(queryRunner) {
8609
+ debug17("migration: adding metadata column to service table");
8610
+ const dbType = queryRunner.connection.driver.options.type;
8611
+ switch (dbType) {
8612
+ case "postgres": {
8613
+ debug17("using postgres migration file for AddServiceMetadata");
8614
+ const mig = new AddServiceMetadata1764000000001();
8615
+ await mig.up(queryRunner);
8616
+ debug17("Postgres migration statements for AddServiceMetadata executed");
8617
+ return;
8618
+ }
8619
+ case "sqlite":
8620
+ case "expo":
8621
+ case "react-native": {
8622
+ debug17("using sqlite/react-native migration file for AddServiceMetadata");
8623
+ const mig = new AddServiceMetadata1764000000002();
8624
+ await mig.up(queryRunner);
8625
+ debug17("SQLite migration statements for AddServiceMetadata executed");
8626
+ return;
8627
+ }
8628
+ default:
8629
+ return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo, and postgres for AddServiceMetadata. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
8630
+ }
8631
+ }
8632
+ async down(queryRunner) {
8633
+ debug17("migration: reverting metadata column from service table");
8634
+ const dbType = queryRunner.connection.driver.options.type;
8635
+ switch (dbType) {
8636
+ case "postgres": {
8637
+ debug17("using postgres migration file for AddServiceMetadata");
8638
+ const mig = new AddServiceMetadata1764000000001();
8639
+ await mig.down(queryRunner);
8640
+ debug17("Postgres migration statements for AddServiceMetadata reverted");
8641
+ return;
8642
+ }
8643
+ case "sqlite":
8644
+ case "expo":
8645
+ case "react-native": {
8646
+ debug17("using sqlite/react-native migration file for AddServiceMetadata");
8647
+ const mig = new AddServiceMetadata1764000000002();
8648
+ await mig.down(queryRunner);
8649
+ debug17("SQLite migration statements for AddServiceMetadata reverted");
8650
+ return;
8651
+ }
8652
+ default:
8653
+ return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo, and postgres for AddServiceMetadata. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
8654
+ }
8655
+ }
8656
+ };
8657
+
8658
+ // src/migrations/generic/16-MakeOpenIdClientSecretNullable.ts
8659
+ var import_debug20 = __toESM(require("debug"), 1);
8660
+
8661
+ // src/migrations/postgres/1767000000001-MakeOpenIdClientSecretNullable.ts
8662
+ var import_debug18 = __toESM(require("debug"), 1);
8663
+ var debug18 = (0, import_debug18.default)("sphereon:ssi-sdk:migrations");
8664
+ var MakeOpenIdClientSecretNullable1767000000001 = class {
8665
+ static {
8666
+ __name(this, "MakeOpenIdClientSecretNullable1767000000001");
8667
+ }
8668
+ name = "MakeOpenIdClientSecretNullable1767000000001";
8669
+ async up(queryRunner) {
8670
+ const table = await queryRunner.getTable("BaseConfig");
8671
+ if (!table) {
8672
+ debug18("MakeOpenIdClientSecretNullable: Skipping migration - BaseConfig table does not exist");
8673
+ return;
8674
+ }
8675
+ const column = table.columns.find((col) => col.name === "client_secret");
8676
+ if (column && !column.isNullable) {
8677
+ await queryRunner.query(`ALTER TABLE "BaseConfig" ALTER COLUMN "client_secret" DROP NOT NULL`);
8678
+ debug18("MakeOpenIdClientSecretNullable: Made client_secret nullable");
8679
+ }
8680
+ }
8681
+ async down(queryRunner) {
8682
+ const table = await queryRunner.getTable("BaseConfig");
8683
+ if (!table) {
8684
+ return;
8685
+ }
8686
+ await queryRunner.query(`UPDATE "BaseConfig" SET "client_secret" = '' WHERE "client_secret" IS NULL`);
8687
+ await queryRunner.query(`ALTER TABLE "BaseConfig" ALTER COLUMN "client_secret" SET NOT NULL`);
8688
+ }
8689
+ };
8690
+
8691
+ // src/migrations/sqlite/1767000000002-MakeOpenIdClientSecretNullable.ts
8692
+ var import_debug19 = __toESM(require("debug"), 1);
8693
+ var debug19 = (0, import_debug19.default)("sphereon:ssi-sdk:migrations");
8694
+ var MakeOpenIdClientSecretNullable1767000000002 = class {
8695
+ static {
8696
+ __name(this, "MakeOpenIdClientSecretNullable1767000000002");
8697
+ }
8698
+ name = "MakeOpenIdClientSecretNullable1767000000002";
8699
+ async up(queryRunner) {
8700
+ debug19("MakeOpenIdClientSecretNullable: SQLite does not support ALTER COLUMN, no action needed for nullable change");
8701
+ }
8702
+ async down(queryRunner) {
8703
+ }
8704
+ };
8705
+
8706
+ // src/migrations/generic/16-MakeOpenIdClientSecretNullable.ts
8707
+ var debug20 = (0, import_debug20.default)("sphereon:ssi-sdk:migrations");
8708
+ var MakeOpenIdClientSecretNullable1767000000000 = class {
8709
+ static {
8710
+ __name(this, "MakeOpenIdClientSecretNullable1767000000000");
8711
+ }
8712
+ name = "MakeOpenIdClientSecretNullable1767000000000";
8713
+ async up(queryRunner) {
8714
+ debug20("migration: making client_secret nullable in BaseConfig table");
8715
+ const dbType = queryRunner.connection.driver.options.type;
8716
+ switch (dbType) {
8717
+ case "postgres": {
8718
+ debug20("using postgres migration file for MakeOpenIdClientSecretNullable");
8719
+ const mig = new MakeOpenIdClientSecretNullable1767000000001();
8720
+ await mig.up(queryRunner);
8721
+ debug20("Postgres migration statements for MakeOpenIdClientSecretNullable executed");
8722
+ return;
8723
+ }
8724
+ case "sqlite":
8725
+ case "expo":
8726
+ case "react-native": {
8727
+ debug20("using sqlite/react-native migration file for MakeOpenIdClientSecretNullable");
8728
+ const mig = new MakeOpenIdClientSecretNullable1767000000002();
8729
+ await mig.up(queryRunner);
8730
+ debug20("SQLite migration statements for MakeOpenIdClientSecretNullable executed");
8731
+ return;
8732
+ }
8733
+ default:
8734
+ return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo, and postgres for MakeOpenIdClientSecretNullable. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
8735
+ }
8736
+ }
8737
+ async down(queryRunner) {
8738
+ debug20("migration: reverting client_secret nullable in BaseConfig table");
8739
+ const dbType = queryRunner.connection.driver.options.type;
8740
+ switch (dbType) {
8741
+ case "postgres": {
8742
+ const mig = new MakeOpenIdClientSecretNullable1767000000001();
8743
+ await mig.down(queryRunner);
8744
+ return;
8745
+ }
8746
+ case "sqlite":
8747
+ case "expo":
8748
+ case "react-native": {
8749
+ const mig = new MakeOpenIdClientSecretNullable1767000000002();
8750
+ await mig.down(queryRunner);
8751
+ return;
8752
+ }
8753
+ default:
8754
+ return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo, and postgres for MakeOpenIdClientSecretNullable. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
8755
+ }
8756
+ }
8757
+ };
8758
+
8759
+ // src/migrations/generic/17-AddCredentialClaimOrder.ts
8760
+ var import_debug21 = __toESM(require("debug"), 1);
8761
+
8762
+ // src/migrations/postgres/1768000000000-AddCredentialClaimOrder.ts
8763
+ var AddCredentialClaimOrderPostgres1768000000000 = class {
8764
+ static {
8765
+ __name(this, "AddCredentialClaimOrderPostgres1768000000000");
8766
+ }
8767
+ name = "AddCredentialClaimOrder1768000000000";
8768
+ async up(queryRunner) {
8769
+ await queryRunner.query(`ALTER TABLE "CredentialClaims" ADD "order" integer`);
8770
+ }
8771
+ async down(queryRunner) {
8772
+ await queryRunner.query(`ALTER TABLE "CredentialClaims" DROP COLUMN "order"`);
8773
+ }
8774
+ };
8775
+
8776
+ // src/migrations/sqlite/1768000000000-AddCredentialClaimOrder.ts
8777
+ var AddCredentialClaimOrderSqlite1768000000000 = class {
8778
+ static {
8779
+ __name(this, "AddCredentialClaimOrderSqlite1768000000000");
8780
+ }
8781
+ name = "AddCredentialClaimOrder1768000000000";
8782
+ async up(queryRunner) {
8783
+ await queryRunner.query(`ALTER TABLE "CredentialClaims" ADD COLUMN "order" integer`);
8784
+ }
8785
+ async down(queryRunner) {
8786
+ await queryRunner.query(`PRAGMA foreign_keys = OFF`);
8787
+ await queryRunner.query(`
8788
+ CREATE TABLE "CredentialClaims_old" (
8789
+ "id" varchar PRIMARY KEY NOT NULL,
8790
+ "key" varchar(255) NOT NULL,
8791
+ "name" varchar(255) NOT NULL,
8792
+ "credentialLocaleBrandingId" varchar,
8793
+ CONSTRAINT "FK_CredentialClaims_credentialLocaleBrandingId" FOREIGN KEY ("credentialLocaleBrandingId") REFERENCES "BaseLocaleBranding" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
8794
+ )
8795
+ `);
8796
+ await queryRunner.query(`
8797
+ INSERT INTO "CredentialClaims_old" ("id", "key", "name", "credentialLocaleBrandingId")
8798
+ SELECT "id", "key", "name", "credentialLocaleBrandingId"
8799
+ FROM "CredentialClaims"
8800
+ `);
8801
+ await queryRunner.query(`DROP TABLE "CredentialClaims"`);
8802
+ await queryRunner.query(`ALTER TABLE "CredentialClaims_old" RENAME TO "CredentialClaims"`);
8803
+ await queryRunner.query(`CREATE UNIQUE INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale" ON "CredentialClaims" ("credentialLocaleBrandingId", "key")`);
8804
+ await queryRunner.query(`PRAGMA foreign_keys = ON`);
8805
+ }
8806
+ };
8807
+
8808
+ // src/migrations/generic/17-AddCredentialClaimOrder.ts
8809
+ var debug21 = (0, import_debug21.default)("sphereon:ssi-sdk:migrations");
8810
+ var AddCredentialClaimOrder1768000000000 = class {
8811
+ static {
8812
+ __name(this, "AddCredentialClaimOrder1768000000000");
8813
+ }
8814
+ name = "AddCredentialClaimOrder1768000000000";
8815
+ async up(queryRunner) {
8816
+ debug21("migration: adding credential claim order column");
8817
+ const dbType = queryRunner.connection.driver.options.type;
8818
+ switch (dbType) {
8819
+ case "postgres": {
8820
+ debug21("using postgres migration file");
8821
+ const mig = new AddCredentialClaimOrderPostgres1768000000000();
8822
+ await mig.up(queryRunner);
8823
+ debug21("Migration statements executed");
8824
+ return;
8825
+ }
8826
+ case "sqlite":
8827
+ case "expo":
8828
+ case "react-native": {
8829
+ debug21("using sqlite/react-native migration file");
8830
+ const mig = new AddCredentialClaimOrderSqlite1768000000000();
8831
+ await mig.up(queryRunner);
8832
+ debug21("Migration statements executed");
8833
+ return;
8834
+ }
8835
+ default:
8836
+ 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`);
8837
+ }
8838
+ }
8839
+ async down(queryRunner) {
8840
+ debug21("migration: removing credential claim order column");
8841
+ const dbType = queryRunner.connection.driver.options.type;
8842
+ switch (dbType) {
8843
+ case "postgres": {
8844
+ debug21("using postgres migration file");
8845
+ const mig = new AddCredentialClaimOrderPostgres1768000000000();
8846
+ await mig.down(queryRunner);
8847
+ debug21("Migration statements executed");
8848
+ return;
8849
+ }
8850
+ case "sqlite":
8851
+ case "expo":
8852
+ case "react-native": {
8853
+ debug21("using sqlite/react-native migration file");
8854
+ const mig = new AddCredentialClaimOrderSqlite1768000000000();
8855
+ await mig.down(queryRunner);
8856
+ debug21("Migration statements executed");
8857
+ return;
8858
+ }
8859
+ default:
8860
+ 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`);
8861
+ }
8862
+ }
8863
+ };
8864
+
8865
+ // src/migrations/generic/2-CreateIssuanceBranding.ts
8866
+ var import_debug22 = __toESM(require("debug"), 1);
8867
+ var debug22 = (0, import_debug22.default)("sphereon:ssi-sdk:migrations");
8868
+ var CreateIssuanceBranding1659463079429 = class {
8869
+ static {
8870
+ __name(this, "CreateIssuanceBranding1659463079429");
8871
+ }
8872
+ name = "CreateIssuanceBranding1659463079429";
8873
+ async up(queryRunner) {
8874
+ debug22("migration: creating issuance branding tables");
8875
+ const dbType = queryRunner.connection.driver.options.type;
8876
+ switch (dbType) {
8877
+ case "postgres": {
8878
+ debug22("using postgres migration file");
8879
+ const mig = new CreateIssuanceBranding1685628974232();
8880
+ await mig.up(queryRunner);
8881
+ debug22("Migration statements executed");
8882
+ return;
8883
+ }
8884
+ case "sqlite":
8885
+ case "expo":
8886
+ case "react-native": {
8887
+ debug22("using sqlite/react-native migration file");
8888
+ const mig = new CreateIssuanceBranding1685628973231();
8889
+ await mig.up(queryRunner);
8890
+ debug22("Migration statements executed");
8891
+ return;
8892
+ }
8893
+ default:
8894
+ 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`);
8895
+ }
8896
+ }
8897
+ async down(queryRunner) {
8898
+ debug22("migration: reverting issuance branding tables");
8899
+ const dbType = queryRunner.connection.driver.options.type;
8900
+ switch (dbType) {
8901
+ case "postgres": {
8902
+ debug22("using postgres migration file");
8903
+ const mig = new CreateIssuanceBranding1685628974232();
8904
+ await mig.down(queryRunner);
8905
+ debug22("Migration statements executed");
8906
+ return;
8907
+ }
8908
+ case "sqlite":
8909
+ case "expo":
8910
+ case "react-native": {
8911
+ debug22("using sqlite/react-native migration file");
8912
+ const mig = new CreateIssuanceBranding1685628973231();
8913
+ await mig.down(queryRunner);
8914
+ debug22("Migration statements executed");
8915
+ return;
8916
+ }
8917
+ default:
8918
+ 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`);
8919
+ }
8920
+ }
8921
+ };
8922
+
8923
+ // src/migrations/generic/3-CreateContacts.ts
8924
+ var import_debug23 = __toESM(require("debug"), 1);
8157
8925
 
8158
8926
  // src/migrations/postgres/1690925872592-CreateContacts.ts
8159
8927
  var import_ssi_sdk33 = require("@sphereon/ssi-sdk.core");
@@ -8374,30 +9142,30 @@ var CreateContacts1690925872693 = class {
8374
9142
  };
8375
9143
 
8376
9144
  // src/migrations/generic/3-CreateContacts.ts
8377
- var debug15 = (0, import_debug15.default)("sphereon:ssi-sdk:migrations");
9145
+ var debug23 = (0, import_debug23.default)("sphereon:ssi-sdk:migrations");
8378
9146
  var CreateContacts1690925872318 = class {
8379
9147
  static {
8380
9148
  __name(this, "CreateContacts1690925872318");
8381
9149
  }
8382
9150
  name = "CreateContacts1690925872318";
8383
9151
  async up(queryRunner) {
8384
- debug15("migration: creating contacts tables");
9152
+ debug23("migration: creating contacts tables");
8385
9153
  const dbType = queryRunner.connection.driver.options.type;
8386
9154
  switch (dbType) {
8387
9155
  case "postgres": {
8388
- debug15("using postgres migration file");
9156
+ debug23("using postgres migration file");
8389
9157
  const mig = new CreateContacts1690925872592();
8390
9158
  await mig.up(queryRunner);
8391
- debug15("Migration statements executed");
9159
+ debug23("Migration statements executed");
8392
9160
  return;
8393
9161
  }
8394
9162
  case "sqlite":
8395
9163
  case "expo":
8396
9164
  case "react-native": {
8397
- debug15("using sqlite/react-native migration file");
9165
+ debug23("using sqlite/react-native migration file");
8398
9166
  const mig = new CreateContacts1690925872693();
8399
9167
  await mig.up(queryRunner);
8400
- debug15("Migration statements executed");
9168
+ debug23("Migration statements executed");
8401
9169
  return;
8402
9170
  }
8403
9171
  default:
@@ -8405,23 +9173,23 @@ var CreateContacts1690925872318 = class {
8405
9173
  }
8406
9174
  }
8407
9175
  async down(queryRunner) {
8408
- debug15("migration: reverting contacts tables");
9176
+ debug23("migration: reverting contacts tables");
8409
9177
  const dbType = queryRunner.connection.driver.options.type;
8410
9178
  switch (dbType) {
8411
9179
  case "postgres": {
8412
- debug15("using postgres migration file");
9180
+ debug23("using postgres migration file");
8413
9181
  const mig = new CreateContacts1690925872592();
8414
9182
  await mig.down(queryRunner);
8415
- debug15("Migration statements executed");
9183
+ debug23("Migration statements executed");
8416
9184
  return;
8417
9185
  }
8418
9186
  case "sqlite":
8419
9187
  case "expo":
8420
9188
  case "react-native": {
8421
- debug15("using sqlite/react-native migration file");
9189
+ debug23("using sqlite/react-native migration file");
8422
9190
  const mig = new CreateContacts1690925872693();
8423
9191
  await mig.down(queryRunner);
8424
- debug15("Migration statements executed");
9192
+ debug23("Migration statements executed");
8425
9193
  return;
8426
9194
  }
8427
9195
  default:
@@ -8431,7 +9199,7 @@ var CreateContacts1690925872318 = class {
8431
9199
  };
8432
9200
 
8433
9201
  // src/migrations/generic/4-CreateStatusList.ts
8434
- var import_debug16 = __toESM(require("debug"), 1);
9202
+ var import_debug24 = __toESM(require("debug"), 1);
8435
9203
 
8436
9204
  // src/migrations/postgres/1693866470001-CreateStatusList.ts
8437
9205
  var CreateStatusList1693866470001 = class {
@@ -8637,53 +9405,53 @@ var UpdateStatusList1737110469000 = class {
8637
9405
  };
8638
9406
 
8639
9407
  // src/migrations/generic/4-CreateStatusList.ts
8640
- var debug16 = (0, import_debug16.default)("sphereon:ssi-sdk:migrations");
9408
+ var debug24 = (0, import_debug24.default)("sphereon:ssi-sdk:migrations");
8641
9409
  var CreateStatusList1693866470000 = class {
8642
9410
  static {
8643
9411
  __name(this, "CreateStatusList1693866470000");
8644
9412
  }
8645
9413
  name = "CreateStatusList1693866470000";
8646
9414
  async up(queryRunner) {
8647
- debug16("migration: creating issuance branding tables");
9415
+ debug24("migration: creating issuance branding tables");
8648
9416
  const dbType = queryRunner.connection.driver.options.type;
8649
9417
  if (dbType === "postgres") {
8650
- debug16("using postgres migration files");
9418
+ debug24("using postgres migration files");
8651
9419
  const createMig = new CreateStatusList1693866470001();
8652
9420
  await createMig.up(queryRunner);
8653
9421
  const updateMig = new UpdateStatusList1737110469001();
8654
9422
  const up = await updateMig.up(queryRunner);
8655
- debug16("Migration statements executed");
9423
+ debug24("Migration statements executed");
8656
9424
  return up;
8657
9425
  } else if (dbType === "sqlite" || dbType === "react-native" || dbType === "expo") {
8658
- debug16("using sqlite/react-native migration files");
9426
+ debug24("using sqlite/react-native migration files");
8659
9427
  const createMig = new CreateStatusList1693866470002();
8660
9428
  await createMig.up(queryRunner);
8661
9429
  const updateMig = new UpdateStatusList1737110469000();
8662
9430
  const up = await updateMig.up(queryRunner);
8663
- debug16("Migration statements executed");
9431
+ debug24("Migration statements executed");
8664
9432
  return up;
8665
9433
  } else {
8666
9434
  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
9435
  }
8668
9436
  }
8669
9437
  async down(queryRunner) {
8670
- debug16("migration: reverting issuance branding tables");
9438
+ debug24("migration: reverting issuance branding tables");
8671
9439
  const dbType = queryRunner.connection.driver.options.type;
8672
9440
  if (dbType === "postgres") {
8673
- debug16("using postgres migration files");
9441
+ debug24("using postgres migration files");
8674
9442
  const updateMig = new UpdateStatusList1737110469001();
8675
9443
  await updateMig.down(queryRunner);
8676
9444
  const createMig = new CreateStatusList1693866470001();
8677
9445
  const down = await createMig.down(queryRunner);
8678
- debug16("Migration statements executed");
9446
+ debug24("Migration statements executed");
8679
9447
  return down;
8680
9448
  } else if (dbType === "sqlite" || dbType === "react-native" || dbType === "expo") {
8681
- debug16("using sqlite/react-native migration files");
9449
+ debug24("using sqlite/react-native migration files");
8682
9450
  const updateMig = new UpdateStatusList1737110469000();
8683
9451
  await updateMig.down(queryRunner);
8684
9452
  const createMig = new CreateStatusList1693866470002();
8685
9453
  const down = await createMig.down(queryRunner);
8686
- debug16("Migration statements executed");
9454
+ debug24("Migration statements executed");
8687
9455
  return down;
8688
9456
  } else {
8689
9457
  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`);
@@ -8692,7 +9460,7 @@ var CreateStatusList1693866470000 = class {
8692
9460
  };
8693
9461
 
8694
9462
  // src/migrations/generic/5-CreateAuditEvents.ts
8695
- var import_debug17 = __toESM(require("debug"), 1);
9463
+ var import_debug25 = __toESM(require("debug"), 1);
8696
9464
 
8697
9465
  // src/migrations/postgres/1701634812183-CreateAuditEvents.ts
8698
9466
  var CreateAuditEvents1701634812183 = class {
@@ -8791,30 +9559,30 @@ var CreateAuditEvents1701634819487 = class {
8791
9559
  };
8792
9560
 
8793
9561
  // src/migrations/generic/5-CreateAuditEvents.ts
8794
- var debug17 = (0, import_debug17.default)("sphereon:ssi-sdk:migrations");
9562
+ var debug25 = (0, import_debug25.default)("sphereon:ssi-sdk:migrations");
8795
9563
  var CreateAuditEvents1701635835330 = class {
8796
9564
  static {
8797
9565
  __name(this, "CreateAuditEvents1701635835330");
8798
9566
  }
8799
9567
  name = "CreateAuditEvents1701635835330";
8800
9568
  async up(queryRunner) {
8801
- debug17("migration: creating audit events tables");
9569
+ debug25("migration: creating audit events tables");
8802
9570
  const dbType = queryRunner.connection.driver.options.type;
8803
9571
  switch (dbType) {
8804
9572
  case "postgres": {
8805
- debug17("using postgres migration file");
9573
+ debug25("using postgres migration file");
8806
9574
  const mig = new CreateAuditEvents1701634812183();
8807
9575
  await mig.up(queryRunner);
8808
- debug17("Migration statements executed");
9576
+ debug25("Migration statements executed");
8809
9577
  return;
8810
9578
  }
8811
9579
  case "sqlite":
8812
9580
  case "expo":
8813
9581
  case "react-native": {
8814
- debug17("using sqlite/react-native migration file");
9582
+ debug25("using sqlite/react-native migration file");
8815
9583
  const mig = new CreateAuditEvents1701634819487();
8816
9584
  await mig.up(queryRunner);
8817
- debug17("Migration statements executed");
9585
+ debug25("Migration statements executed");
8818
9586
  return;
8819
9587
  }
8820
9588
  default:
@@ -8822,23 +9590,23 @@ var CreateAuditEvents1701635835330 = class {
8822
9590
  }
8823
9591
  }
8824
9592
  async down(queryRunner) {
8825
- debug17("migration: reverting audit events tables");
9593
+ debug25("migration: reverting audit events tables");
8826
9594
  const dbType = queryRunner.connection.driver.options.type;
8827
9595
  switch (dbType) {
8828
9596
  case "postgres": {
8829
- debug17("using postgres migration file");
9597
+ debug25("using postgres migration file");
8830
9598
  const mig = new CreateAuditEvents1701634812183();
8831
9599
  await mig.down(queryRunner);
8832
- debug17("Migration statements executed");
9600
+ debug25("Migration statements executed");
8833
9601
  return;
8834
9602
  }
8835
9603
  case "sqlite":
8836
9604
  case "expo":
8837
9605
  case "react-native": {
8838
- debug17("using sqlite/react-native migration file");
9606
+ debug25("using sqlite/react-native migration file");
8839
9607
  const mig = new CreateAuditEvents1701634819487();
8840
9608
  await mig.down(queryRunner);
8841
- debug17("Migration statements executed");
9609
+ debug25("Migration statements executed");
8842
9610
  return;
8843
9611
  }
8844
9612
  default:
@@ -8848,7 +9616,7 @@ var CreateAuditEvents1701635835330 = class {
8848
9616
  };
8849
9617
 
8850
9618
  // src/migrations/generic/6-CreateDigitalCredential.ts
8851
- var import_debug18 = __toESM(require("debug"), 1);
9619
+ var import_debug26 = __toESM(require("debug"), 1);
8852
9620
 
8853
9621
  // src/migrations/postgres/1708525189001-CreateDigitalCredential.ts
8854
9622
  var CreateDigitalCredential1708525189001 = class {
@@ -8956,30 +9724,30 @@ var CreateDigitalCredential1708525189002 = class {
8956
9724
  };
8957
9725
 
8958
9726
  // src/migrations/generic/6-CreateDigitalCredential.ts
8959
- var debug18 = (0, import_debug18.default)("sphereon:ssi-sdk:migrations");
9727
+ var debug26 = (0, import_debug26.default)("sphereon:ssi-sdk:migrations");
8960
9728
  var CreateDigitalCredential1708525189000 = class {
8961
9729
  static {
8962
9730
  __name(this, "CreateDigitalCredential1708525189000");
8963
9731
  }
8964
9732
  name = "CreateDigitalCredential1708525189000";
8965
9733
  async up(queryRunner) {
8966
- debug18("migration: creating DigitalCredential tables");
9734
+ debug26("migration: creating DigitalCredential tables");
8967
9735
  const dbType = queryRunner.connection.driver.options.type;
8968
9736
  switch (dbType) {
8969
9737
  case "postgres": {
8970
- debug18("using postgres migration file for DigitalCredential");
9738
+ debug26("using postgres migration file for DigitalCredential");
8971
9739
  const mig = new CreateDigitalCredential1708525189001();
8972
9740
  await mig.up(queryRunner);
8973
- debug18("Postgres Migration statements for DigitalCredential executed");
9741
+ debug26("Postgres Migration statements for DigitalCredential executed");
8974
9742
  return;
8975
9743
  }
8976
9744
  case "sqlite":
8977
9745
  case "expo":
8978
9746
  case "react-native": {
8979
- debug18("using sqlite/react-native migration file for DigitalCredential");
9747
+ debug26("using sqlite/react-native migration file for DigitalCredential");
8980
9748
  const mig = new CreateDigitalCredential1708525189002();
8981
9749
  await mig.up(queryRunner);
8982
- debug18("SQLite Migration statements for DigitalCredential executed");
9750
+ debug26("SQLite Migration statements for DigitalCredential executed");
8983
9751
  return;
8984
9752
  }
8985
9753
  default:
@@ -8987,23 +9755,23 @@ var CreateDigitalCredential1708525189000 = class {
8987
9755
  }
8988
9756
  }
8989
9757
  async down(queryRunner) {
8990
- debug18("migration: reverting DigitalCredential tables");
9758
+ debug26("migration: reverting DigitalCredential tables");
8991
9759
  const dbType = queryRunner.connection.driver.options.type;
8992
9760
  switch (dbType) {
8993
9761
  case "postgres": {
8994
- debug18("using postgres migration file for DigitalCredential");
9762
+ debug26("using postgres migration file for DigitalCredential");
8995
9763
  const mig = new CreateDigitalCredential1708525189001();
8996
9764
  await mig.down(queryRunner);
8997
- debug18("Postgres Migration statements for DigitalCredential reverted");
9765
+ debug26("Postgres Migration statements for DigitalCredential reverted");
8998
9766
  return;
8999
9767
  }
9000
9768
  case "sqlite":
9001
9769
  case "expo":
9002
9770
  case "react-native": {
9003
- debug18("using sqlite/react-native migration file for DigitalCredential");
9771
+ debug26("using sqlite/react-native migration file for DigitalCredential");
9004
9772
  const mig = new CreateDigitalCredential1708525189002();
9005
9773
  await mig.down(queryRunner);
9006
- debug18("SQLite Migration statements for DigitalCredential reverted");
9774
+ debug26("SQLite Migration statements for DigitalCredential reverted");
9007
9775
  return;
9008
9776
  }
9009
9777
  default:
@@ -9013,7 +9781,7 @@ var CreateDigitalCredential1708525189000 = class {
9013
9781
  };
9014
9782
 
9015
9783
  // src/migrations/generic/7-CreateMachineStateStore.ts
9016
- var import_debug19 = __toESM(require("debug"), 1);
9784
+ var import_debug27 = __toESM(require("debug"), 1);
9017
9785
 
9018
9786
  // src/migrations/postgres/1708797018115-CreateMachineStateStore.ts
9019
9787
  var CreateMachineStateStore1708797018115 = class {
@@ -9075,30 +9843,30 @@ var CreateMachineStateStore1708796002272 = class {
9075
9843
  };
9076
9844
 
9077
9845
  // src/migrations/generic/7-CreateMachineStateStore.ts
9078
- var debug19 = (0, import_debug19.default)("sphereon:ssi-sdk:migrations");
9846
+ var debug27 = (0, import_debug27.default)("sphereon:ssi-sdk:migrations");
9079
9847
  var CreateMachineStateStore1708098041262 = class {
9080
9848
  static {
9081
9849
  __name(this, "CreateMachineStateStore1708098041262");
9082
9850
  }
9083
9851
  name = "CreateMachineStateStore1708098041262";
9084
9852
  async up(queryRunner) {
9085
- debug19("migration: creating machine state tables");
9853
+ debug27("migration: creating machine state tables");
9086
9854
  const dbType = queryRunner.connection.driver.options.type;
9087
9855
  switch (dbType) {
9088
9856
  case "postgres": {
9089
- debug19("using postgres migration file");
9857
+ debug27("using postgres migration file");
9090
9858
  const mig = new CreateMachineStateStore1708797018115();
9091
9859
  await mig.up(queryRunner);
9092
- debug19("Migration statements executed");
9860
+ debug27("Migration statements executed");
9093
9861
  return;
9094
9862
  }
9095
9863
  case "sqlite":
9096
9864
  case "expo":
9097
9865
  case "react-native": {
9098
- debug19("using sqlite/react-native migration file");
9866
+ debug27("using sqlite/react-native migration file");
9099
9867
  const mig = new CreateMachineStateStore1708796002272();
9100
9868
  await mig.up(queryRunner);
9101
- debug19("Migration statements executed");
9869
+ debug27("Migration statements executed");
9102
9870
  return;
9103
9871
  }
9104
9872
  default:
@@ -9106,23 +9874,23 @@ var CreateMachineStateStore1708098041262 = class {
9106
9874
  }
9107
9875
  }
9108
9876
  async down(queryRunner) {
9109
- debug19("migration: reverting machine state tables");
9877
+ debug27("migration: reverting machine state tables");
9110
9878
  const dbType = queryRunner.connection.driver.options.type;
9111
9879
  switch (dbType) {
9112
9880
  case "postgres": {
9113
- debug19("using postgres migration file");
9881
+ debug27("using postgres migration file");
9114
9882
  const mig = new CreateMachineStateStore1708797018115();
9115
9883
  await mig.down(queryRunner);
9116
- debug19("Migration statements executed");
9884
+ debug27("Migration statements executed");
9117
9885
  return;
9118
9886
  }
9119
9887
  case "sqlite":
9120
9888
  case "expo":
9121
9889
  case "react-native": {
9122
- debug19("using sqlite/react-native migration file");
9890
+ debug27("using sqlite/react-native migration file");
9123
9891
  const mig = new CreateMachineStateStore1708796002272();
9124
9892
  await mig.down(queryRunner);
9125
- debug19("Migration statements executed");
9893
+ debug27("Migration statements executed");
9126
9894
  return;
9127
9895
  }
9128
9896
  default:
@@ -9132,7 +9900,7 @@ var CreateMachineStateStore1708098041262 = class {
9132
9900
  };
9133
9901
 
9134
9902
  // src/migrations/generic/8-CreateContacts.ts
9135
- var import_debug20 = __toESM(require("debug"), 1);
9903
+ var import_debug28 = __toESM(require("debug"), 1);
9136
9904
 
9137
9905
  // src/migrations/postgres/1710438363001-CreateContacts.ts
9138
9906
  var CreateContacts1710438363001 = class {
@@ -9246,30 +10014,30 @@ var CreateContacts1710438363002 = class {
9246
10014
  };
9247
10015
 
9248
10016
  // src/migrations/generic/8-CreateContacts.ts
9249
- var debug20 = (0, import_debug20.default)("sphereon:ssi-sdk:migrations");
10017
+ var debug28 = (0, import_debug28.default)("sphereon:ssi-sdk:migrations");
9250
10018
  var CreateContacts1708525189000 = class {
9251
10019
  static {
9252
10020
  __name(this, "CreateContacts1708525189000");
9253
10021
  }
9254
10022
  name = "CreateContacts1708525189000";
9255
10023
  async up(queryRunner) {
9256
- debug20("migration: updating contact tables");
10024
+ debug28("migration: updating contact tables");
9257
10025
  const dbType = queryRunner.connection.driver.options.type;
9258
10026
  switch (dbType) {
9259
10027
  case "postgres": {
9260
- debug20("using postgres migration file");
10028
+ debug28("using postgres migration file");
9261
10029
  const mig = new CreateContacts1710438363001();
9262
10030
  await mig.up(queryRunner);
9263
- debug20("Migration statements executed");
10031
+ debug28("Migration statements executed");
9264
10032
  return;
9265
10033
  }
9266
10034
  case "sqlite":
9267
10035
  case "expo":
9268
10036
  case "react-native": {
9269
- debug20("using sqlite/react-native migration file");
10037
+ debug28("using sqlite/react-native migration file");
9270
10038
  const mig = new CreateContacts1710438363002();
9271
10039
  await mig.up(queryRunner);
9272
- debug20("Migration statements executed");
10040
+ debug28("Migration statements executed");
9273
10041
  return;
9274
10042
  }
9275
10043
  default:
@@ -9277,23 +10045,23 @@ var CreateContacts1708525189000 = class {
9277
10045
  }
9278
10046
  }
9279
10047
  async down(queryRunner) {
9280
- debug20("migration: reverting machine state tables");
10048
+ debug28("migration: reverting machine state tables");
9281
10049
  const dbType = queryRunner.connection.driver.options.type;
9282
10050
  switch (dbType) {
9283
10051
  case "postgres": {
9284
- debug20("using postgres migration file");
10052
+ debug28("using postgres migration file");
9285
10053
  const mig = new CreateContacts1710438363001();
9286
10054
  await mig.down(queryRunner);
9287
- debug20("Migration statements executed");
10055
+ debug28("Migration statements executed");
9288
10056
  return;
9289
10057
  }
9290
10058
  case "sqlite":
9291
10059
  case "expo":
9292
10060
  case "react-native": {
9293
- debug20("using sqlite/react-native migration file");
10061
+ debug28("using sqlite/react-native migration file");
9294
10062
  const mig = new CreateContacts1710438363002();
9295
10063
  await mig.down(queryRunner);
9296
- debug20("Migration statements executed");
10064
+ debug28("Migration statements executed");
9297
10065
  return;
9298
10066
  }
9299
10067
  default:
@@ -9303,7 +10071,7 @@ var CreateContacts1708525189000 = class {
9303
10071
  };
9304
10072
 
9305
10073
  // src/migrations/generic/9-CreateContacts.ts
9306
- var import_debug21 = __toESM(require("debug"), 1);
10074
+ var import_debug29 = __toESM(require("debug"), 1);
9307
10075
 
9308
10076
  // src/migrations/postgres/1715761125001-CreateContacts.ts
9309
10077
  var CreateContacts1715761125001 = class {
@@ -9415,30 +10183,30 @@ var CreateContacts1715761125002 = class {
9415
10183
  };
9416
10184
 
9417
10185
  // src/migrations/generic/9-CreateContacts.ts
9418
- var debug21 = (0, import_debug21.default)("sphereon:ssi-sdk:migrations");
10186
+ var debug29 = (0, import_debug29.default)("sphereon:ssi-sdk:migrations");
9419
10187
  var CreateContacts1715761125000 = class {
9420
10188
  static {
9421
10189
  __name(this, "CreateContacts1715761125000");
9422
10190
  }
9423
10191
  name = "CreateContacts1715761125000";
9424
10192
  async up(queryRunner) {
9425
- debug21("migration: updating contact tables");
10193
+ debug29("migration: updating contact tables");
9426
10194
  const dbType = queryRunner.connection.driver.options.type;
9427
10195
  switch (dbType) {
9428
10196
  case "postgres": {
9429
- debug21("using postgres migration file");
10197
+ debug29("using postgres migration file");
9430
10198
  const mig = new CreateContacts1715761125001();
9431
10199
  await mig.up(queryRunner);
9432
- debug21("Migration statements executed");
10200
+ debug29("Migration statements executed");
9433
10201
  return;
9434
10202
  }
9435
10203
  case "sqlite":
9436
10204
  case "expo":
9437
10205
  case "react-native": {
9438
- debug21("using sqlite/react-native migration file");
10206
+ debug29("using sqlite/react-native migration file");
9439
10207
  const mig = new CreateContacts1715761125002();
9440
10208
  await mig.up(queryRunner);
9441
- debug21("Migration statements executed");
10209
+ debug29("Migration statements executed");
9442
10210
  return;
9443
10211
  }
9444
10212
  default:
@@ -9446,23 +10214,23 @@ var CreateContacts1715761125000 = class {
9446
10214
  }
9447
10215
  }
9448
10216
  async down(queryRunner) {
9449
- debug21("migration: reverting machine state tables");
10217
+ debug29("migration: reverting machine state tables");
9450
10218
  const dbType = queryRunner.connection.driver.options.type;
9451
10219
  switch (dbType) {
9452
10220
  case "postgres": {
9453
- debug21("using postgres migration file");
10221
+ debug29("using postgres migration file");
9454
10222
  const mig = new CreateContacts1715761125001();
9455
10223
  await mig.down(queryRunner);
9456
- debug21("Migration statements executed");
10224
+ debug29("Migration statements executed");
9457
10225
  return;
9458
10226
  }
9459
10227
  case "sqlite":
9460
10228
  case "expo":
9461
10229
  case "react-native": {
9462
- debug21("using sqlite/react-native migration file");
10230
+ debug29("using sqlite/react-native migration file");
9463
10231
  const mig = new CreateContacts1715761125002();
9464
10232
  await mig.down(queryRunner);
9465
- debug21("Migration statements executed");
10233
+ debug29("Migration statements executed");
9466
10234
  return;
9467
10235
  }
9468
10236
  default:
@@ -9476,11 +10244,14 @@ var DataStoreContactMigrations = [
9476
10244
  CreateContacts1659463079429,
9477
10245
  CreateContacts1690925872318,
9478
10246
  CreateContacts1708525189000,
9479
- CreateContacts1715761125000
10247
+ CreateContacts1715761125000,
10248
+ MakeOpenIdClientSecretNullable1767000000000
9480
10249
  ];
9481
10250
  var DataStoreIssuanceBrandingMigrations = [
9482
10251
  CreateIssuanceBranding1659463079429,
9483
- FixCredentialClaimsReferencesUuid1741895822987
10252
+ FixCredentialClaimsReferencesUuid1741895822987,
10253
+ AddBrandingState1766000000000,
10254
+ AddCredentialClaimOrder1768000000000
9484
10255
  ];
9485
10256
  var DataStoreStatusListMigrations = [
9486
10257
  CreateStatusList1693866470000,
@@ -9501,6 +10272,9 @@ var DataStorePresentationDefinitionMigrations = [
9501
10272
  CreatePresentationDefinitions1716533767523,
9502
10273
  CreateDcqlQueryItem1726617600000
9503
10274
  ];
10275
+ var DataStoreServiceMigrations = [
10276
+ AddServiceMetadata1764000000000
10277
+ ];
9504
10278
  var DataStoreMigrations = [
9505
10279
  ...DataStoreContactMigrations,
9506
10280
  ...DataStoreIssuanceBrandingMigrations,
@@ -9508,7 +10282,12 @@ var DataStoreMigrations = [
9508
10282
  ...DataStoreEventLoggerMigrations,
9509
10283
  ...DataStoreDigitalCredentialMigrations,
9510
10284
  ...DataStoreMachineStateMigrations,
9511
- ...DataStorePresentationDefinitionMigrations
10285
+ ...DataStorePresentationDefinitionMigrations,
10286
+ ...DataStoreServiceMigrations
10287
+ ];
10288
+ var DataStoreMigrationsWithVeramo = [
10289
+ ...import_data_store.migrations,
10290
+ ...DataStoreMigrations
9512
10291
  ];
9513
10292
 
9514
10293
  // src/utils/digitalCredential/MappingUtils.ts
@@ -9739,4 +10518,8 @@ var DataStoreEntities = [
9739
10518
  ...DataStoreMachineStateEntities,
9740
10519
  ...DataStorePresentationDefinitionEntities
9741
10520
  ];
10521
+ var DataStoreEntitiesWithVeramo = [
10522
+ ...import_data_store2.Entities,
10523
+ ...DataStoreEntities
10524
+ ];
9742
10525
  //# sourceMappingURL=index.cjs.map