@sphereon/ssi-sdk.data-store 0.34.1-feature.SSISDK.17.bitstring.sl.9 → 0.34.1-next.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2956,14 +2956,19 @@ _ts_decorate26([
2956
2956
  _ts_metadata25("design:type", String)
2957
2957
  ], StatusListEntryEntity.prototype, "value", void 0);
2958
2958
  StatusListEntryEntity = _ts_decorate26([
2959
- (0, import_typeorm25.Entity)("StatusListEntry")
2959
+ (0, import_typeorm25.Entity)("StatusListEntry"),
2960
+ (0, import_typeorm25.TableInheritance)({
2961
+ column: {
2962
+ type: "varchar",
2963
+ name: "type"
2964
+ }
2965
+ })
2960
2966
  ], StatusListEntryEntity);
2961
2967
 
2962
2968
  // src/entities/statusList/StatusListEntities.ts
2963
2969
  var import_ssi_sdk13 = require("@sphereon/ssi-sdk.agent-config");
2964
2970
 
2965
2971
  // src/entities/statusList/BitstringStatusListEntryEntity.ts
2966
- var import_class_validator19 = require("class-validator");
2967
2972
  var import_typeorm26 = require("typeorm");
2968
2973
  function _ts_decorate27(decorators, target, key, desc) {
2969
2974
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -2976,77 +2981,15 @@ function _ts_metadata26(k, v) {
2976
2981
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
2977
2982
  }
2978
2983
  __name(_ts_metadata26, "_ts_metadata");
2979
- var BitstringStatusListEntryEntity = class extends import_typeorm26.BaseEntity {
2984
+ var BitstringStatusListEntryEntity = class extends StatusListEntryEntity {
2980
2985
  static {
2981
2986
  __name(this, "BitstringStatusListEntryEntity");
2982
2987
  }
2983
- statusListId;
2984
- statusListIndex;
2985
- statusList;
2986
- credentialId;
2987
- credentialHash;
2988
- entryCorrelationId;
2989
2988
  statusPurpose;
2990
2989
  bitsPerStatus;
2991
2990
  statusMessage;
2992
2991
  statusReference;
2993
2992
  };
2994
- _ts_decorate27([
2995
- (0, import_typeorm26.PrimaryColumn)({
2996
- name: "statusListId",
2997
- type: "varchar",
2998
- nullable: false,
2999
- unique: false
3000
- }),
3001
- (0, import_class_validator19.Validate)(IsNonEmptyStringConstraint, {
3002
- message: "Status list id is required"
3003
- }),
3004
- _ts_metadata26("design:type", String)
3005
- ], BitstringStatusListEntryEntity.prototype, "statusListId", void 0);
3006
- _ts_decorate27([
3007
- (0, import_typeorm26.PrimaryColumn)({
3008
- name: "statusListIndex",
3009
- type: "integer",
3010
- nullable: false,
3011
- unique: false
3012
- }),
3013
- _ts_metadata26("design:type", Number)
3014
- ], BitstringStatusListEntryEntity.prototype, "statusListIndex", void 0);
3015
- _ts_decorate27([
3016
- (0, import_typeorm26.ManyToOne)(() => BitstringStatusListEntity, (statusList) => statusList.statusListEntries),
3017
- (0, import_typeorm26.JoinColumn)({
3018
- name: "statusListId"
3019
- }),
3020
- _ts_metadata26("design:type", typeof BitstringStatusListEntity === "undefined" ? Object : BitstringStatusListEntity)
3021
- ], BitstringStatusListEntryEntity.prototype, "statusList", void 0);
3022
- _ts_decorate27([
3023
- (0, import_typeorm26.Column)({
3024
- name: "credentialId",
3025
- type: "text",
3026
- nullable: true
3027
- }),
3028
- _ts_metadata26("design:type", String)
3029
- ], BitstringStatusListEntryEntity.prototype, "credentialId", void 0);
3030
- _ts_decorate27([
3031
- (0, import_typeorm26.Column)({
3032
- name: "credentialHash",
3033
- length: 128,
3034
- type: "varchar",
3035
- nullable: true,
3036
- unique: false
3037
- }),
3038
- _ts_metadata26("design:type", String)
3039
- ], BitstringStatusListEntryEntity.prototype, "credentialHash", void 0);
3040
- _ts_decorate27([
3041
- (0, import_typeorm26.Column)({
3042
- name: "correlationId",
3043
- length: 255,
3044
- type: "varchar",
3045
- nullable: true,
3046
- unique: false
3047
- }),
3048
- _ts_metadata26("design:type", String)
3049
- ], BitstringStatusListEntryEntity.prototype, "entryCorrelationId", void 0);
3050
2993
  _ts_decorate27([
3051
2994
  (0, import_typeorm26.Column)({
3052
2995
  type: "varchar",
@@ -3115,7 +3058,7 @@ _ts_decorate27([
3115
3058
  _ts_metadata26("design:type", Object)
3116
3059
  ], BitstringStatusListEntryEntity.prototype, "statusReference", void 0);
3117
3060
  BitstringStatusListEntryEntity = _ts_decorate27([
3118
- (0, import_typeorm26.Entity)("BitstringStatusListEntry")
3061
+ (0, import_typeorm26.ChildEntity)("bitstring")
3119
3062
  ], BitstringStatusListEntryEntity);
3120
3063
 
3121
3064
  // src/entities/statusList/StatusListEntities.ts
@@ -3130,14 +3073,15 @@ function _ts_metadata27(k, v) {
3130
3073
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
3131
3074
  }
3132
3075
  __name(_ts_metadata27, "_ts_metadata");
3133
- var { BaseEntity: BaseEntity21, ChildEntity: ChildEntity5, Column: Column25, Entity: Entity23, OneToMany: OneToMany8, PrimaryColumn: PrimaryColumn3, TableInheritance: TableInheritance4, Unique } = import_typeorm27.default;
3134
- var StatusListEntity = class extends BaseEntity21 {
3076
+ var { BaseEntity: BaseEntity20, ChildEntity: ChildEntity6, Column: Column25, Entity: Entity22, OneToMany: OneToMany8, PrimaryColumn: PrimaryColumn2, TableInheritance: TableInheritance5, Unique } = import_typeorm27.default;
3077
+ var StatusListEntity = class extends BaseEntity20 {
3135
3078
  static {
3136
3079
  __name(this, "StatusListEntity");
3137
3080
  }
3138
3081
  id;
3139
3082
  correlationId;
3140
3083
  length;
3084
+ type;
3141
3085
  issuer;
3142
3086
  driverType;
3143
3087
  credentialIdMode;
@@ -3145,7 +3089,7 @@ var StatusListEntity = class extends BaseEntity21 {
3145
3089
  statusListCredential;
3146
3090
  };
3147
3091
  _ts_decorate28([
3148
- PrimaryColumn3({
3092
+ PrimaryColumn2({
3149
3093
  name: "id",
3150
3094
  type: "varchar"
3151
3095
  }),
@@ -3168,6 +3112,14 @@ _ts_decorate28([
3168
3112
  }),
3169
3113
  _ts_metadata27("design:type", Number)
3170
3114
  ], StatusListEntity.prototype, "length", void 0);
3115
+ _ts_decorate28([
3116
+ Column25("simple-enum", {
3117
+ name: "type",
3118
+ enum: import_ssi_types.StatusListType,
3119
+ nullable: false
3120
+ }),
3121
+ _ts_metadata27("design:type", typeof import_ssi_types.StatusListType === "undefined" ? Object : import_ssi_types.StatusListType)
3122
+ ], StatusListEntity.prototype, "type", void 0);
3171
3123
  _ts_decorate28([
3172
3124
  Column25({
3173
3125
  name: "issuer",
@@ -3246,11 +3198,11 @@ _ts_decorate28([
3246
3198
  _ts_metadata27("design:type", typeof StatusListCredential === "undefined" ? Object : StatusListCredential)
3247
3199
  ], StatusListEntity.prototype, "statusListCredential", void 0);
3248
3200
  StatusListEntity = _ts_decorate28([
3249
- Entity23("StatusList"),
3201
+ Entity22("StatusList"),
3250
3202
  Unique("UQ_correlationId", [
3251
3203
  "correlationId"
3252
3204
  ]),
3253
- TableInheritance4({
3205
+ TableInheritance5({
3254
3206
  column: {
3255
3207
  type: "simple-enum",
3256
3208
  name: "type",
@@ -3292,7 +3244,7 @@ _ts_decorate28([
3292
3244
  _ts_metadata27("design:type", Array)
3293
3245
  ], StatusList2021Entity.prototype, "statusListEntries", void 0);
3294
3246
  StatusList2021Entity = _ts_decorate28([
3295
- ChildEntity5(import_ssi_types.StatusListType.StatusList2021)
3247
+ ChildEntity6(import_ssi_types.StatusListType.StatusList2021)
3296
3248
  ], StatusList2021Entity);
3297
3249
  var OAuthStatusListEntity = class extends StatusListEntity {
3298
3250
  static {
@@ -3318,7 +3270,7 @@ _ts_decorate28([
3318
3270
  _ts_metadata27("design:type", typeof Date === "undefined" ? Object : Date)
3319
3271
  ], OAuthStatusListEntity.prototype, "expiresAt", void 0);
3320
3272
  OAuthStatusListEntity = _ts_decorate28([
3321
- ChildEntity5(import_ssi_types.StatusListType.OAuthStatusList)
3273
+ ChildEntity6(import_ssi_types.StatusListType.OAuthStatusList)
3322
3274
  ], OAuthStatusListEntity);
3323
3275
  var BitstringStatusListEntity = class extends StatusListEntity {
3324
3276
  static {
@@ -3390,7 +3342,7 @@ _ts_decorate28([
3390
3342
  _ts_metadata27("design:type", Array)
3391
3343
  ], BitstringStatusListEntity.prototype, "statusListEntries", void 0);
3392
3344
  BitstringStatusListEntity = _ts_decorate28([
3393
- ChildEntity5(import_ssi_types.StatusListType.BitstringStatusList)
3345
+ ChildEntity6(import_ssi_types.StatusListType.BitstringStatusList)
3394
3346
  ], BitstringStatusListEntity);
3395
3347
 
3396
3348
  // src/entities/machineState/MachineStateInfoEntity.ts
@@ -3526,7 +3478,7 @@ MachineStateInfoEntity = _ts_decorate29([
3526
3478
  ], MachineStateInfoEntity);
3527
3479
 
3528
3480
  // src/entities/contact/OrganizationEntity.ts
3529
- var import_class_validator20 = require("class-validator");
3481
+ var import_class_validator19 = require("class-validator");
3530
3482
  var import_typeorm29 = require("typeorm");
3531
3483
  function _ts_decorate30(decorators, target, key, desc) {
3532
3484
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -3548,7 +3500,7 @@ var OrganizationEntity = class extends BaseContactEntity {
3548
3500
  ownerId;
3549
3501
  tenantId;
3550
3502
  async validate() {
3551
- const validation = await (0, import_class_validator20.validate)(this);
3503
+ const validation = await (0, import_class_validator19.validate)(this);
3552
3504
  if (validation.length > 0) {
3553
3505
  const constraint = getConstraint(validation[0]);
3554
3506
  if (constraint) {
@@ -3565,7 +3517,7 @@ _ts_decorate30([
3565
3517
  nullable: false,
3566
3518
  unique: true
3567
3519
  }),
3568
- (0, import_class_validator20.IsNotEmpty)({
3520
+ (0, import_class_validator19.IsNotEmpty)({
3569
3521
  message: "Blank legal names are not allowed"
3570
3522
  }),
3571
3523
  _ts_metadata29("design:type", String)
@@ -3577,7 +3529,7 @@ _ts_decorate30([
3577
3529
  nullable: false,
3578
3530
  unique: false
3579
3531
  }),
3580
- (0, import_class_validator20.IsNotEmpty)({
3532
+ (0, import_class_validator19.IsNotEmpty)({
3581
3533
  message: "Blank display names are not allowed"
3582
3534
  }),
3583
3535
  _ts_metadata29("design:type", String)
@@ -3609,7 +3561,7 @@ OrganizationEntity = _ts_decorate30([
3609
3561
 
3610
3562
  // src/entities/contact/NaturalPersonEntity.ts
3611
3563
  var import_typeorm30 = require("typeorm");
3612
- var import_class_validator21 = require("class-validator");
3564
+ var import_class_validator20 = require("class-validator");
3613
3565
  function _ts_decorate31(decorators, target, key, desc) {
3614
3566
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3615
3567
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -3632,7 +3584,7 @@ var NaturalPersonEntity = class extends BaseContactEntity {
3632
3584
  ownerId;
3633
3585
  tenantId;
3634
3586
  async validate() {
3635
- const validation = await (0, import_class_validator21.validate)(this);
3587
+ const validation = await (0, import_class_validator20.validate)(this);
3636
3588
  if (validation.length > 0) {
3637
3589
  const constraint = getConstraint(validation[0]);
3638
3590
  if (constraint) {
@@ -3649,7 +3601,7 @@ _ts_decorate31([
3649
3601
  nullable: false,
3650
3602
  unique: false
3651
3603
  }),
3652
- (0, import_class_validator21.IsNotEmpty)({
3604
+ (0, import_class_validator20.IsNotEmpty)({
3653
3605
  message: "Blank first names are not allowed"
3654
3606
  }),
3655
3607
  _ts_metadata30("design:type", String)
@@ -3661,7 +3613,7 @@ _ts_decorate31([
3661
3613
  nullable: true,
3662
3614
  unique: false
3663
3615
  }),
3664
- (0, import_class_validator21.Validate)(IsNonEmptyStringConstraint, {
3616
+ (0, import_class_validator20.Validate)(IsNonEmptyStringConstraint, {
3665
3617
  message: "Blank middle names are not allowed"
3666
3618
  }),
3667
3619
  _ts_metadata30("design:type", String)
@@ -3673,7 +3625,7 @@ _ts_decorate31([
3673
3625
  nullable: false,
3674
3626
  unique: false
3675
3627
  }),
3676
- (0, import_class_validator21.IsNotEmpty)({
3628
+ (0, import_class_validator20.IsNotEmpty)({
3677
3629
  message: "Blank last names are not allowed"
3678
3630
  }),
3679
3631
  _ts_metadata30("design:type", String)
@@ -3685,7 +3637,7 @@ _ts_decorate31([
3685
3637
  nullable: false,
3686
3638
  unique: false
3687
3639
  }),
3688
- (0, import_class_validator21.IsNotEmpty)({
3640
+ (0, import_class_validator20.IsNotEmpty)({
3689
3641
  message: "Blank display names are not allowed"
3690
3642
  }),
3691
3643
  _ts_metadata30("design:type", String)
@@ -4244,7 +4196,7 @@ DigitalCredentialEntity = _ts_decorate33([
4244
4196
 
4245
4197
  // src/entities/presentationDefinition/PresentationDefinitionItemEntity.ts
4246
4198
  var import_typeorm33 = require("typeorm");
4247
- var import_class_validator22 = require("class-validator");
4199
+ var import_class_validator21 = require("class-validator");
4248
4200
  var import_ssi_sdk18 = require("@sphereon/ssi-sdk.agent-config");
4249
4201
  function _ts_decorate34(decorators, target, key, desc) {
4250
4202
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -4288,7 +4240,7 @@ _ts_decorate34([
4288
4240
  nullable: false,
4289
4241
  unique: false
4290
4242
  }),
4291
- (0, import_class_validator22.IsNotEmpty)({
4243
+ (0, import_class_validator21.IsNotEmpty)({
4292
4244
  message: "A blank definition id field is not allowed"
4293
4245
  }),
4294
4246
  _ts_metadata33("design:type", String)
@@ -4301,7 +4253,7 @@ _ts_decorate34([
4301
4253
  nullable: false,
4302
4254
  unique: false
4303
4255
  }),
4304
- (0, import_class_validator22.IsNotEmpty)({
4256
+ (0, import_class_validator21.IsNotEmpty)({
4305
4257
  message: "A blank version field is not allowed"
4306
4258
  }),
4307
4259
  _ts_metadata33("design:type", String)
@@ -4343,7 +4295,7 @@ _ts_decorate34([
4343
4295
  nullable: false,
4344
4296
  unique: false
4345
4297
  }),
4346
- (0, import_class_validator22.IsNotEmpty)({
4298
+ (0, import_class_validator21.IsNotEmpty)({
4347
4299
  message: "A blank PD definition payload field is not allowed"
4348
4300
  }),
4349
4301
  _ts_metadata33("design:type", String)
@@ -4355,7 +4307,7 @@ _ts_decorate34([
4355
4307
  nullable: true,
4356
4308
  unique: false
4357
4309
  }),
4358
- (0, import_class_validator22.IsNotEmpty)({
4310
+ (0, import_class_validator21.IsNotEmpty)({
4359
4311
  message: "A blank dcql definition payload field is not allowed"
4360
4312
  }),
4361
4313
  _ts_metadata33("design:type", String)
@@ -6236,52 +6188,55 @@ var import_typeorm37 = require("typeorm");
6236
6188
  // src/utils/statusList/MappingUtils.ts
6237
6189
  var import_ssi_types3 = require("@sphereon/ssi-types");
6238
6190
  var statusListEntityFrom = /* @__PURE__ */ __name((args) => {
6239
- if (args.type === import_ssi_types3.StatusListType.StatusList2021) {
6240
- const entity = new StatusList2021Entity();
6241
- const sl2021 = args;
6242
- entity.indexingDirection = sl2021.indexingDirection;
6243
- entity.statusPurpose = sl2021.statusPurpose;
6244
- setBaseFields(entity, args);
6245
- Object.defineProperty(entity, "type", {
6246
- value: import_ssi_types3.StatusListType.StatusList2021,
6247
- enumerable: true,
6248
- configurable: true
6249
- });
6250
- return entity;
6251
- }
6252
- if (args.type === import_ssi_types3.StatusListType.OAuthStatusList) {
6253
- const entity = new OAuthStatusListEntity();
6254
- const oauthSl = args;
6255
- entity.bitsPerStatus = oauthSl.bitsPerStatus;
6256
- entity.expiresAt = oauthSl.expiresAt;
6257
- setBaseFields(entity, args);
6258
- Object.defineProperty(entity, "type", {
6259
- value: import_ssi_types3.StatusListType.OAuthStatusList,
6260
- enumerable: true,
6261
- configurable: true
6262
- });
6263
- return entity;
6264
- }
6265
- if (args.type === import_ssi_types3.StatusListType.BitstringStatusList) {
6266
- const entity = new BitstringStatusListEntity();
6267
- const bitstringsl = args;
6268
- if (!bitstringsl.bitsPerStatus) {
6269
- throw Error("bitsPerStatus must be set for BitstringStatusList");
6270
- }
6271
- entity.statusPurpose = bitstringsl.statusPurpose;
6272
- entity.bitsPerStatus = bitstringsl.bitsPerStatus;
6273
- entity.validFrom = bitstringsl.validFrom;
6274
- entity.validUntil = bitstringsl.validUntil;
6275
- entity.ttl = bitstringsl.ttl;
6276
- setBaseFields(entity, args);
6277
- Object.defineProperty(entity, "type", {
6278
- value: import_ssi_types3.StatusListType.BitstringStatusList,
6279
- enumerable: true,
6280
- configurable: true
6281
- });
6282
- return entity;
6191
+ switch (args.type) {
6192
+ case import_ssi_types3.StatusListType.StatusList2021: {
6193
+ const entity = new StatusList2021Entity();
6194
+ const sl2021 = args;
6195
+ entity.indexingDirection = sl2021.indexingDirection;
6196
+ entity.statusPurpose = sl2021.statusPurpose;
6197
+ setBaseFields(entity, args);
6198
+ Object.defineProperty(entity, "type", {
6199
+ value: import_ssi_types3.StatusListType.StatusList2021,
6200
+ enumerable: true,
6201
+ configurable: true
6202
+ });
6203
+ return entity;
6204
+ }
6205
+ case import_ssi_types3.StatusListType.OAuthStatusList: {
6206
+ const entity = new OAuthStatusListEntity();
6207
+ const oauthSl = args;
6208
+ entity.bitsPerStatus = oauthSl.bitsPerStatus;
6209
+ entity.expiresAt = oauthSl.expiresAt;
6210
+ setBaseFields(entity, args);
6211
+ Object.defineProperty(entity, "type", {
6212
+ value: import_ssi_types3.StatusListType.OAuthStatusList,
6213
+ enumerable: true,
6214
+ configurable: true
6215
+ });
6216
+ return entity;
6217
+ }
6218
+ case import_ssi_types3.StatusListType.BitstringStatusList: {
6219
+ const entity = new BitstringStatusListEntity();
6220
+ const bitstringsl = args;
6221
+ if (!bitstringsl.bitsPerStatus) {
6222
+ throw Error("bitsPerStatus must be set for BitstringStatusList");
6223
+ }
6224
+ entity.statusPurpose = bitstringsl.statusPurpose;
6225
+ entity.bitsPerStatus = bitstringsl.bitsPerStatus;
6226
+ entity.validFrom = bitstringsl.validFrom;
6227
+ entity.validUntil = bitstringsl.validUntil;
6228
+ entity.ttl = bitstringsl.ttl;
6229
+ setBaseFields(entity, args);
6230
+ Object.defineProperty(entity, "type", {
6231
+ value: import_ssi_types3.StatusListType.BitstringStatusList,
6232
+ enumerable: true,
6233
+ configurable: true
6234
+ });
6235
+ return entity;
6236
+ }
6237
+ default:
6238
+ throw new Error(`Invalid status list type ${args.type}`);
6283
6239
  }
6284
- throw new Error(`Invalid status list type ${args.type}`);
6285
6240
  }, "statusListEntityFrom");
6286
6241
  var statusListFrom = /* @__PURE__ */ __name((entity) => {
6287
6242
  if (entity instanceof StatusList2021Entity) {
@@ -6364,7 +6319,7 @@ var StatusListStore = class {
6364
6319
  ...args,
6365
6320
  id: args.statusListId
6366
6321
  });
6367
- const repo = await this.getStatusListEntryRepo();
6322
+ const repo = await this.getStatusListEntryRepo(statusList.type);
6368
6323
  const results = (await repo.find({
6369
6324
  where: {
6370
6325
  statusListId: statusList.id,
@@ -6374,23 +6329,34 @@ var StatusListStore = class {
6374
6329
  return statusListIndex.filter((index) => !results.includes(index));
6375
6330
  }
6376
6331
  async addStatusListEntry(args) {
6377
- return (await this.getStatusListEntryRepo()).save(args);
6332
+ if (!args.statusListId) {
6333
+ throw new Error("statusListId is required");
6334
+ }
6335
+ const statusList = await this.getStatusList({
6336
+ id: args.statusListId
6337
+ });
6338
+ return await (await this.getStatusListEntryRepo(statusList.type)).save(args);
6378
6339
  }
6379
6340
  async updateStatusListEntry(args) {
6380
- const statusListId = args.statusListId ?? args.statusList?.id;
6341
+ const statusListId = args.statusListId;
6342
+ if (!statusListId) {
6343
+ throw new Error("statusListId is required");
6344
+ }
6345
+ const statusList = await this.getStatusList({
6346
+ id: statusListId
6347
+ });
6381
6348
  const result = await this.getStatusListEntryByIndex({
6382
6349
  ...args,
6383
6350
  statusListId,
6384
6351
  errorOnNotFound: false
6385
6352
  });
6386
6353
  const updatedEntry = {
6387
- value: args.value,
6388
- correlationId: args.correlationId,
6389
- credentialHash: args.credentialHash,
6390
- credentialId: args.credentialId
6354
+ ...result,
6355
+ ...args,
6356
+ statusListId
6391
6357
  };
6392
6358
  const updStatusListId = result?.statusListId ?? statusListId;
6393
- const updateResult = await (await this.getStatusListEntryRepo()).upsert({
6359
+ const updateResult = await (await this.getStatusListEntryRepo(statusList.type)).upsert({
6394
6360
  ...result ?? {
6395
6361
  statusListId: updStatusListId,
6396
6362
  statusListIndex: args.statusListIndex
@@ -6402,7 +6368,7 @@ var StatusListStore = class {
6402
6368
  "statusListIndex"
6403
6369
  ]
6404
6370
  });
6405
- console.log(updateResult);
6371
+ debug4(updateResult);
6406
6372
  return await this.getStatusListEntryByIndex({
6407
6373
  ...args,
6408
6374
  statusListId: updStatusListId,
@@ -6416,7 +6382,12 @@ var StatusListStore = class {
6416
6382
  if (!statusListIndex && !entryCorrelationId) {
6417
6383
  throw Error(`Cannot get statusList entry without either a statusListIndex or entryCorrelationId`);
6418
6384
  }
6419
- const result = await (await this.getStatusListEntryRepo()).findOne({
6385
+ const statusList = statusListId ? await this.getStatusList({
6386
+ id: statusListId
6387
+ }) : await this.getStatusList({
6388
+ correlationId: statusListCorrelationId
6389
+ });
6390
+ const result = await (await this.getStatusListEntryRepo(statusList.type)).findOne({
6420
6391
  where: {
6421
6392
  ...statusListId && {
6422
6393
  statusListId
@@ -6460,8 +6431,8 @@ var StatusListStore = class {
6460
6431
  },
6461
6432
  credentialId
6462
6433
  };
6463
- console.log(`Entries: ${JSON.stringify(await (await this.getStatusListEntryRepo()).find(), null, 2)}`);
6464
- const result = await (await this.getStatusListEntryRepo()).findOne({
6434
+ debug4(`Entries: ${JSON.stringify(await (await this.getStatusListEntryRepo(statusList.type)).find(), null, 2)}`);
6435
+ const result = await (await this.getStatusListEntryRepo(statusList.type)).findOne({
6465
6436
  where
6466
6437
  });
6467
6438
  if (!result && args.errorOnNotFound) {
@@ -6477,7 +6448,11 @@ var StatusListStore = class {
6477
6448
  error2 = true;
6478
6449
  }
6479
6450
  if (!error) {
6480
- const result = await (await this.getStatusListEntryRepo()).delete({
6451
+ const statusList = await this.getStatusList({
6452
+ id: args.statusListId,
6453
+ correlationId: args.statusListCorrelationId
6454
+ });
6455
+ const result = await (await this.getStatusListEntryRepo(statusList.type)).delete({
6481
6456
  ...args.statusListId && {
6482
6457
  statusList: args.statusListId
6483
6458
  },
@@ -6498,9 +6473,12 @@ var StatusListStore = class {
6498
6473
  error2 = true;
6499
6474
  }
6500
6475
  if (error) {
6501
- console.log(`Could not delete statusList ${args.statusListId} entry by index ${args.statusListIndex}`);
6476
+ console.error(`Could not delete statusList ${args.statusListId} entry by index ${args.statusListIndex}`);
6502
6477
  } else {
6503
- const result = await (await this.getStatusListEntryRepo()).delete({
6478
+ const statusList = await this.getStatusList({
6479
+ id: args.statusListId
6480
+ });
6481
+ const result = await (await this.getStatusListEntryRepo(statusList.type)).delete({
6504
6482
  ...args.statusListId && {
6505
6483
  statusList: args.statusListId
6506
6484
  },
@@ -6514,15 +6492,16 @@ var StatusListStore = class {
6514
6492
  return !error;
6515
6493
  }
6516
6494
  async getStatusListEntries(args) {
6517
- return (await this.getStatusListEntryRepo()).find({
6495
+ const statusList = await this.getStatusList({
6496
+ id: args.statusListId
6497
+ });
6498
+ const results = await (await this.getStatusListEntryRepo(statusList.type)).find({
6518
6499
  where: {
6519
6500
  ...args?.filter,
6520
6501
  statusList: args.statusListId
6521
6502
  }
6522
6503
  });
6523
- }
6524
- async getStatusList(args) {
6525
- return statusListFrom(await this.getStatusListEntity(args));
6504
+ return results;
6526
6505
  }
6527
6506
  async getStatusListEntity(args) {
6528
6507
  if (!args.id && !args.correlationId) {
@@ -6546,6 +6525,10 @@ var StatusListStore = class {
6546
6525
  }
6547
6526
  return result;
6548
6527
  }
6528
+ async getStatusList(args) {
6529
+ const entity = await this.getStatusListEntity(args);
6530
+ return statusListFrom(entity);
6531
+ }
6549
6532
  async getStatusLists(args) {
6550
6533
  const result = await (await this.getStatusListRepo()).find({
6551
6534
  where: args.filter
@@ -6586,7 +6569,7 @@ var StatusListStore = class {
6586
6569
  }
6587
6570
  async removeStatusList(args) {
6588
6571
  const result = await this.getStatusListEntity(args);
6589
- await (await this.getStatusListEntryRepo()).delete({
6572
+ await (await this.getStatusListEntryRepo(result.type)).delete({
6590
6573
  statusListId: result.id
6591
6574
  });
6592
6575
  const deletedEntity = await (await this.getStatusListRepo()).remove(result);
@@ -6608,8 +6591,14 @@ var StatusListStore = class {
6608
6591
  return dataSource.getRepository(StatusListEntity);
6609
6592
  }
6610
6593
  }
6611
- async getStatusListEntryRepo() {
6612
- return (await this.getDS()).getRepository(StatusListEntryEntity);
6594
+ async getStatusListEntryRepo(type) {
6595
+ const dataSource = await this.getDS();
6596
+ switch (type) {
6597
+ case import_ssi_types4.StatusListType.BitstringStatusList:
6598
+ return dataSource.getRepository(BitstringStatusListEntryEntity);
6599
+ default:
6600
+ return dataSource.getRepository(StatusListEntryEntity);
6601
+ }
6613
6602
  }
6614
6603
  };
6615
6604
 
@@ -9093,29 +9082,20 @@ var CreateBitstringStatusListPG1741895823000 = class {
9093
9082
  await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "validUntil" TIMESTAMP`);
9094
9083
  await queryRunner.query(`ALTER TABLE "StatusList" DROP CONSTRAINT IF EXISTS "CHK_StatusList_type"`);
9095
9084
  await queryRunner.query(`ALTER TABLE "StatusList" ADD CONSTRAINT "CHK_StatusList_type" CHECK ("type" IN ('StatusList2021', 'OAuthStatusList', 'BitstringStatusList'))`);
9096
- await queryRunner.query(`
9097
- CREATE TABLE "BitstringStatusListEntry" (
9098
- "statusListId" character varying NOT NULL,
9099
- "statusListIndex" integer NOT NULL,
9100
- "credentialId" text,
9101
- "credentialHash" character varying(128),
9102
- "correlationId" character varying(255),
9103
- "statusPurpose" character varying NOT NULL,
9104
- "bitsPerStatus" integer DEFAULT 1,
9105
- "statusMessage" text,
9106
- "statusReference" text,
9107
- CONSTRAINT "PK_BitstringStatusListEntry" PRIMARY KEY ("statusListId", "statusListIndex")
9108
- )
9109
- `);
9110
- await queryRunner.query(`
9111
- ALTER TABLE "BitstringStatusListEntry"
9112
- ADD CONSTRAINT "FK_BitstringStatusListEntry_statusListId"
9113
- FOREIGN KEY ("statusListId") REFERENCES "StatusList"("id") ON DELETE NO ACTION ON UPDATE NO ACTION
9114
- `);
9085
+ await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "type" character varying NOT NULL DEFAULT 'StatusListEntryEntity'`);
9086
+ await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusPurpose" character varying`);
9087
+ await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "bitsPerStatus" integer DEFAULT 1`);
9088
+ await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusMessage" text`);
9089
+ await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusReference" text`);
9090
+ await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD CONSTRAINT "CHK_StatusListEntry_type" CHECK ("type" IN ('StatusListEntryEntity', 'bitstring'))`);
9115
9091
  }
9116
9092
  async down(queryRunner) {
9117
- await queryRunner.query(`ALTER TABLE "BitstringStatusListEntry" DROP CONSTRAINT "FK_BitstringStatusListEntry_statusListId"`);
9118
- await queryRunner.query(`DROP TABLE "BitstringStatusListEntry"`);
9093
+ await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP CONSTRAINT "CHK_StatusListEntry_type"`);
9094
+ await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "statusReference"`);
9095
+ await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "statusMessage"`);
9096
+ await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "bitsPerStatus"`);
9097
+ await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "statusPurpose"`);
9098
+ await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "type"`);
9119
9099
  await queryRunner.query(`ALTER TABLE "StatusList" DROP CONSTRAINT "CHK_StatusList_type"`);
9120
9100
  await queryRunner.query(`ALTER TABLE "StatusList" ADD CONSTRAINT "CHK_StatusList_type" CHECK ("type" IN ('StatusList2021', 'OAuthStatusList'))`);
9121
9101
  await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "validUntil"`);
@@ -9141,7 +9121,7 @@ var CreateBitstringStatusListSqlite1741895823001 = class {
9141
9121
  "type" varchar CHECK( "type" IN ('StatusList2021', 'OAuthStatusList', 'BitstringStatusList') ) NOT NULL DEFAULT ('StatusList2021'),
9142
9122
  "driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
9143
9123
  "credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
9144
- "proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt') ) NOT NULL DEFAULT ('lds'),
9124
+ "proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt', 'vc+jwt') ) NOT NULL DEFAULT ('lds'),
9145
9125
  "indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ),
9146
9126
  "statusPurpose" varchar,
9147
9127
  "statusListCredential" text,
@@ -9168,22 +9148,59 @@ var CreateBitstringStatusListSqlite1741895823001 = class {
9168
9148
  await queryRunner.query(`DROP TABLE "StatusList"`);
9169
9149
  await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`);
9170
9150
  await queryRunner.query(`
9171
- CREATE TABLE "BitstringStatusListEntry" (
9151
+ CREATE TABLE "temporary_StatusListEntry" (
9172
9152
  "statusListId" varchar NOT NULL,
9173
9153
  "statusListIndex" integer NOT NULL,
9174
9154
  "credentialId" text,
9175
9155
  "credentialHash" varchar(128),
9176
9156
  "correlationId" varchar(255),
9177
- "statusPurpose" varchar NOT NULL,
9157
+ "value" varchar(50),
9158
+ "type" varchar CHECK( "type" IN ('StatusListEntryEntity', 'bitstring') ) NOT NULL DEFAULT ('StatusListEntryEntity'),
9159
+ "statusPurpose" varchar,
9178
9160
  "bitsPerStatus" integer DEFAULT (1),
9179
9161
  "statusMessage" text,
9180
9162
  "statusReference" text,
9181
9163
  PRIMARY KEY ("statusListId", "statusListIndex")
9182
9164
  )
9183
9165
  `);
9166
+ await queryRunner.query(`
9167
+ INSERT INTO "temporary_StatusListEntry"(
9168
+ "statusListId", "statusListIndex", "credentialId", "credentialHash",
9169
+ "correlationId", "value", "type"
9170
+ )
9171
+ SELECT
9172
+ "statusListId", "statusListIndex", "credentialId", "credentialHash",
9173
+ "correlationId", "value", 'StatusListEntryEntity'
9174
+ FROM "StatusListEntry"
9175
+ `);
9176
+ await queryRunner.query(`DROP TABLE "StatusListEntry"`);
9177
+ await queryRunner.query(`ALTER TABLE "temporary_StatusListEntry" RENAME TO "StatusListEntry"`);
9184
9178
  }
9185
9179
  async down(queryRunner) {
9186
- await queryRunner.query(`DROP TABLE "BitstringStatusListEntry"`);
9180
+ await queryRunner.query(`
9181
+ CREATE TABLE "temporary_StatusListEntry" (
9182
+ "statusListId" varchar NOT NULL,
9183
+ "statusListIndex" integer NOT NULL,
9184
+ "credentialId" text,
9185
+ "credentialHash" varchar(128),
9186
+ "correlationId" varchar(255),
9187
+ "value" varchar(50),
9188
+ PRIMARY KEY ("statusListId", "statusListIndex")
9189
+ )
9190
+ `);
9191
+ await queryRunner.query(`
9192
+ INSERT INTO "temporary_StatusListEntry"(
9193
+ "statusListId", "statusListIndex", "credentialId", "credentialHash",
9194
+ "correlationId", "value"
9195
+ )
9196
+ SELECT
9197
+ "statusListId", "statusListIndex", "credentialId", "credentialHash",
9198
+ "correlationId", "value"
9199
+ FROM "StatusListEntry"
9200
+ WHERE "type" = 'StatusListEntryEntity'
9201
+ `);
9202
+ await queryRunner.query(`DROP TABLE "StatusListEntry"`);
9203
+ await queryRunner.query(`ALTER TABLE "temporary_StatusListEntry" RENAME TO "StatusListEntry"`);
9187
9204
  await queryRunner.query(`
9188
9205
  CREATE TABLE "temporary_StatusList" (
9189
9206
  "id" varchar PRIMARY KEY NOT NULL,
@@ -9193,7 +9210,7 @@ var CreateBitstringStatusListSqlite1741895823001 = class {
9193
9210
  "type" varchar CHECK( "type" IN ('StatusList2021', 'OAuthStatusList') ) NOT NULL DEFAULT ('StatusList2021'),
9194
9211
  "driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
9195
9212
  "credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
9196
- "proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt') ) NOT NULL DEFAULT ('lds'),
9213
+ "proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt', 'vc+jwt') ) NOT NULL DEFAULT ('lds'),
9197
9214
  "indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ),
9198
9215
  "statusPurpose" varchar,
9199
9216
  "statusListCredential" text,