@sphereon/ssi-sdk.data-store 0.34.1-feature.SSISDK.17.bitstring.sl.24 → 0.34.1-feature.SSISDK.17.bitstring.sl.26

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
@@ -6188,52 +6188,55 @@ var import_typeorm37 = require("typeorm");
6188
6188
  // src/utils/statusList/MappingUtils.ts
6189
6189
  var import_ssi_types3 = require("@sphereon/ssi-types");
6190
6190
  var statusListEntityFrom = /* @__PURE__ */ __name((args) => {
6191
- if (args.type === import_ssi_types3.StatusListType.StatusList2021) {
6192
- const entity = new StatusList2021Entity();
6193
- const sl2021 = args;
6194
- entity.indexingDirection = sl2021.indexingDirection;
6195
- entity.statusPurpose = sl2021.statusPurpose;
6196
- setBaseFields(entity, args);
6197
- Object.defineProperty(entity, "type", {
6198
- value: import_ssi_types3.StatusListType.StatusList2021,
6199
- enumerable: true,
6200
- configurable: true
6201
- });
6202
- return entity;
6203
- }
6204
- if (args.type === import_ssi_types3.StatusListType.OAuthStatusList) {
6205
- const entity = new OAuthStatusListEntity();
6206
- const oauthSl = args;
6207
- entity.bitsPerStatus = oauthSl.bitsPerStatus;
6208
- entity.expiresAt = oauthSl.expiresAt;
6209
- setBaseFields(entity, args);
6210
- Object.defineProperty(entity, "type", {
6211
- value: import_ssi_types3.StatusListType.OAuthStatusList,
6212
- enumerable: true,
6213
- configurable: true
6214
- });
6215
- return entity;
6216
- }
6217
- if (args.type === import_ssi_types3.StatusListType.BitstringStatusList) {
6218
- const entity = new BitstringStatusListEntity();
6219
- const bitstringsl = args;
6220
- if (!bitstringsl.bitsPerStatus) {
6221
- throw Error("bitsPerStatus must be set for BitstringStatusList");
6222
- }
6223
- entity.statusPurpose = bitstringsl.statusPurpose;
6224
- entity.bitsPerStatus = bitstringsl.bitsPerStatus;
6225
- entity.validFrom = bitstringsl.validFrom;
6226
- entity.validUntil = bitstringsl.validUntil;
6227
- entity.ttl = bitstringsl.ttl;
6228
- setBaseFields(entity, args);
6229
- Object.defineProperty(entity, "type", {
6230
- value: import_ssi_types3.StatusListType.BitstringStatusList,
6231
- enumerable: true,
6232
- configurable: true
6233
- });
6234
- 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}`);
6235
6239
  }
6236
- throw new Error(`Invalid status list type ${args.type}`);
6237
6240
  }, "statusListEntityFrom");
6238
6241
  var statusListFrom = /* @__PURE__ */ __name((entity) => {
6239
6242
  if (entity instanceof StatusList2021Entity) {
@@ -6332,8 +6335,7 @@ var StatusListStore = class {
6332
6335
  const statusList = await this.getStatusList({
6333
6336
  id: args.statusListId
6334
6337
  });
6335
- const result = await (await this.getStatusListEntryRepo(statusList.type)).save(args);
6336
- return result;
6338
+ return await (await this.getStatusListEntryRepo(statusList.type)).save(args);
6337
6339
  }
6338
6340
  async updateStatusListEntry(args) {
6339
6341
  const statusListId = args.statusListId;
@@ -6366,7 +6368,7 @@ var StatusListStore = class {
6366
6368
  "statusListIndex"
6367
6369
  ]
6368
6370
  });
6369
- console.log(updateResult);
6371
+ debug4(updateResult);
6370
6372
  return await this.getStatusListEntryByIndex({
6371
6373
  ...args,
6372
6374
  statusListId: updStatusListId,
@@ -6429,7 +6431,7 @@ var StatusListStore = class {
6429
6431
  },
6430
6432
  credentialId
6431
6433
  };
6432
- console.log(`Entries: ${JSON.stringify(await (await this.getStatusListEntryRepo(statusList.type)).find(), null, 2)}`);
6434
+ debug4(`Entries: ${JSON.stringify(await (await this.getStatusListEntryRepo(statusList.type)).find(), null, 2)}`);
6433
6435
  const result = await (await this.getStatusListEntryRepo(statusList.type)).findOne({
6434
6436
  where
6435
6437
  });
@@ -6471,7 +6473,7 @@ var StatusListStore = class {
6471
6473
  error2 = true;
6472
6474
  }
6473
6475
  if (error) {
6474
- 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}`);
6475
6477
  } else {
6476
6478
  const statusList = await this.getStatusList({
6477
6479
  id: args.statusListId