@0xpolygonid/js-sdk 1.17.4 → 1.17.6

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.
@@ -592,6 +592,13 @@ var PolygonIdSdk = (function (exports) {
592
592
  return b$5.encodeString(b);
593
593
  }
594
594
 
595
+ /**
596
+ * Merges two objects together, prioritizing the properties of the second object.
597
+ * If a property exists in both objects, the value from the second object will be used.
598
+ * @param credSubject - The first object to merge.
599
+ * @param otherCredSubject - The second object to merge.
600
+ * @returns A new object with the merged properties.
601
+ */
595
602
  function mergeObjects(credSubject, otherCredSubject) {
596
603
  let result = {};
597
604
  const credSubjectKeys = Object.keys(credSubject);
@@ -7614,6 +7621,7 @@ var PolygonIdSdk = (function (exports) {
7614
7621
  exports.SupportedCurrencies = void 0;
7615
7622
  (function (SupportedCurrencies) {
7616
7623
  SupportedCurrencies["ETH"] = "ETH";
7624
+ SupportedCurrencies["MATIC"] = "MATIC";
7617
7625
  })(exports.SupportedCurrencies || (exports.SupportedCurrencies = {}));
7618
7626
  /**
7619
7627
  * DisplayMethodType type for display method
@@ -49402,45 +49410,29 @@ var PolygonIdSdk = (function (exports) {
49402
49410
  throw new Error(exports.CircuitError.EmptyQueryValue);
49403
49411
  }
49404
49412
  validateValueArraySize(maxArrSize) {
49405
- switch (this.values.length) {
49406
- case 0: {
49407
- const zeroArrSizeOps = [exports.Operators.NOOP, exports.Operators.SD, exports.Operators.NULLIFY];
49408
- if (!zeroArrSizeOps.includes(this.operator)) {
49409
- throw new Error(exports.CircuitError.InvalidValuesArrSize);
49410
- }
49411
- return;
49412
- }
49413
- case 1: {
49414
- const oneArrSizeOps = [
49415
- exports.Operators.EQ,
49416
- exports.Operators.LT,
49417
- exports.Operators.GT,
49418
- exports.Operators.NE,
49419
- exports.Operators.LTE,
49420
- exports.Operators.GTE,
49421
- exports.Operators.EXISTS
49422
- ];
49423
- if (!oneArrSizeOps.includes(this.operator)) {
49424
- throw new Error(exports.CircuitError.InvalidValuesArrSize);
49425
- }
49426
- return;
49427
- }
49428
- case 2: {
49429
- const twoArrSizeOps = [exports.Operators.BETWEEN, exports.Operators.NONBETWEEN];
49430
- if (!twoArrSizeOps.includes(this.operator)) {
49431
- throw new Error(exports.CircuitError.InvalidValuesArrSize);
49432
- }
49433
- return;
49434
- }
49435
- default: {
49436
- const maxArrSizeOps = [exports.Operators.IN, exports.Operators.NIN];
49437
- if (!maxArrSizeOps.includes(this.operator)) {
49438
- throw new Error(exports.CircuitError.InvalidOperationType);
49439
- }
49440
- if (!this.values.length || this.values.length > maxArrSize) {
49441
- throw new Error(exports.CircuitError.InvalidValuesArrSize);
49442
- }
49443
- }
49413
+ if ([exports.Operators.NOOP, exports.Operators.SD, exports.Operators.NULLIFY].includes(this.operator) &&
49414
+ this.values.length !== 0) {
49415
+ throw new Error(exports.CircuitError.InvalidValuesArrSize);
49416
+ }
49417
+ else if ([
49418
+ exports.Operators.EQ,
49419
+ exports.Operators.LT,
49420
+ exports.Operators.GT,
49421
+ exports.Operators.NE,
49422
+ exports.Operators.LTE,
49423
+ exports.Operators.GTE,
49424
+ exports.Operators.EXISTS
49425
+ ].includes(this.operator) &&
49426
+ this.values.length !== 1) {
49427
+ throw new Error(exports.CircuitError.InvalidValuesArrSize);
49428
+ }
49429
+ else if ([exports.Operators.BETWEEN, exports.Operators.NONBETWEEN].includes(this.operator) &&
49430
+ this.values.length !== 2) {
49431
+ throw new Error(exports.CircuitError.InvalidValuesArrSize);
49432
+ }
49433
+ else if ([exports.Operators.IN, exports.Operators.NIN].includes(this.operator) &&
49434
+ this.values.length > maxArrSize) {
49435
+ throw new Error(exports.CircuitError.InvalidValuesArrSize);
49444
49436
  }
49445
49437
  }
49446
49438
  }
@@ -77067,7 +77059,7 @@ var PolygonIdSdk = (function (exports) {
77067
77059
  * Returns a Map where the key is the groupId and the value is an object containing the query and linkNonce.
77068
77060
  *
77069
77061
  * @param requestScope - An array of ZeroKnowledgeProofRequest objects.
77070
- * @returns A Map<number, { query: JSONObject; linkNonce: number }> representing the grouped queries.
77062
+ * @returns A Map<number, { query: JsonDocumentObject; linkNonce: number }> representing the grouped queries.
77071
77063
  */
77072
77064
  const getGroupedQueries = (requestScope) => requestScope.reduce((acc, proofReq) => {
77073
77065
  const groupId = proofReq.query.groupId;
@@ -80342,6 +80334,7 @@ var PolygonIdSdk = (function (exports) {
80342
80334
  break;
80343
80335
  }
80344
80336
  catch (err) {
80337
+ // eslint-disable-next-line no-console
80345
80338
  console.warn(`Error while transiting state, retrying state transition, attempt: ${attempt}`, err);
80346
80339
  }
80347
80340
  } while (--attempt);