bruce-models 5.2.4 → 5.2.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.
@@ -428,7 +428,8 @@
428
428
  params.headers[this.ssidHeader] = this.ssid;
429
429
  }
430
430
  const res = yield fetch(url, {
431
- headers: params.headers
431
+ headers: params.headers,
432
+ signal: params.abortSignal
432
433
  });
433
434
  return parseResult(res);
434
435
  });
@@ -452,7 +453,8 @@
452
453
  }
453
454
  const res = yield fetch(url, {
454
455
  headers: params.headers,
455
- method: "DELETE"
456
+ method: "DELETE",
457
+ signal: params.abortSignal
456
458
  });
457
459
  return parseResult(res);
458
460
  });
@@ -484,7 +486,8 @@
484
486
  const res = yield fetch(url, {
485
487
  headers: params.headers,
486
488
  method: "POST",
487
- body: data
489
+ body: data,
490
+ signal: params.abortSignal
488
491
  });
489
492
  return parseResult(res);
490
493
  });
@@ -516,7 +519,8 @@
516
519
  const res = yield fetch(url, {
517
520
  headers: params.headers,
518
521
  method: "PUT",
519
- body: data
522
+ body: data,
523
+ signal: params.abortSignal
520
524
  });
521
525
  return parseResult(res);
522
526
  });
@@ -552,7 +556,8 @@
552
556
  const res = yield fetch(url, {
553
557
  headers: params.headers,
554
558
  method: "POST",
555
- body: formData
559
+ body: formData,
560
+ signal: params.abortSignal
556
561
  });
557
562
  return parseResult(res);
558
563
  });
@@ -1247,6 +1252,51 @@
1247
1252
  });
1248
1253
  });
1249
1254
  }
1255
+ /**
1256
+ * Version check that returns true if the version is at least the provided version.
1257
+ * @param version
1258
+ */
1259
+ IsVersionAtLeast(version) {
1260
+ if (!this.version) {
1261
+ return false;
1262
+ }
1263
+ // Debug.
1264
+ if (typeof this.version == "string" && this.version.toLowerCase().includes("debug")) {
1265
+ return true;
1266
+ }
1267
+ // Bad data.
1268
+ if (!this.version.includes(".")) {
1269
+ return false;
1270
+ }
1271
+ /**
1272
+ * Compares two arrays of version parts.
1273
+ * Returns -1 if `a` is less than `b`, 1 if `a` is greater than `b`, or 0 if they are equal.
1274
+ * @param a
1275
+ * @param b
1276
+ */
1277
+ function compareVersions(a, b) {
1278
+ for (let i = 0; i < a.length; i++) {
1279
+ if (a[i] < b[i]) {
1280
+ return -1;
1281
+ }
1282
+ else if (a[i] > b[i]) {
1283
+ return 1;
1284
+ }
1285
+ }
1286
+ return 0;
1287
+ }
1288
+ /**
1289
+ * Splits a version string into an array of version parts.
1290
+ * Example format: "1.0.4836".
1291
+ * @param version
1292
+ */
1293
+ function splitVersion(version) {
1294
+ return version.split(".").map(part => parseInt(part));
1295
+ }
1296
+ const curSplit = splitVersion(this.version);
1297
+ const reqSplit = splitVersion(version);
1298
+ return compareVersions(curSplit, reqSplit) >= 0;
1299
+ }
1250
1300
  }
1251
1301
  BruceApi.Api = Api$$1;
1252
1302
  })(exports.BruceApi || (exports.BruceApi = {}));
@@ -14275,7 +14325,7 @@
14275
14325
  })(exports.DataSource || (exports.DataSource = {}));
14276
14326
 
14277
14327
  // This is updated with the package.json version on build.
14278
- const VERSION = "5.2.4";
14328
+ const VERSION = "5.2.6";
14279
14329
 
14280
14330
  exports.VERSION = VERSION;
14281
14331
  exports.AbstractApi = AbstractApi;