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.
@@ -423,7 +423,8 @@ class AbstractApi {
423
423
  params.headers[this.ssidHeader] = this.ssid;
424
424
  }
425
425
  const res = yield fetch(url, {
426
- headers: params.headers
426
+ headers: params.headers,
427
+ signal: params.abortSignal
427
428
  });
428
429
  return parseResult(res);
429
430
  });
@@ -447,7 +448,8 @@ class AbstractApi {
447
448
  }
448
449
  const res = yield fetch(url, {
449
450
  headers: params.headers,
450
- method: "DELETE"
451
+ method: "DELETE",
452
+ signal: params.abortSignal
451
453
  });
452
454
  return parseResult(res);
453
455
  });
@@ -479,7 +481,8 @@ class AbstractApi {
479
481
  const res = yield fetch(url, {
480
482
  headers: params.headers,
481
483
  method: "POST",
482
- body: data
484
+ body: data,
485
+ signal: params.abortSignal
483
486
  });
484
487
  return parseResult(res);
485
488
  });
@@ -511,7 +514,8 @@ class AbstractApi {
511
514
  const res = yield fetch(url, {
512
515
  headers: params.headers,
513
516
  method: "PUT",
514
- body: data
517
+ body: data,
518
+ signal: params.abortSignal
515
519
  });
516
520
  return parseResult(res);
517
521
  });
@@ -547,7 +551,8 @@ class AbstractApi {
547
551
  const res = yield fetch(url, {
548
552
  headers: params.headers,
549
553
  method: "POST",
550
- body: formData
554
+ body: formData,
555
+ signal: params.abortSignal
551
556
  });
552
557
  return parseResult(res);
553
558
  });
@@ -1256,6 +1261,51 @@ var BruceApi;
1256
1261
  });
1257
1262
  });
1258
1263
  }
1264
+ /**
1265
+ * Version check that returns true if the version is at least the provided version.
1266
+ * @param version
1267
+ */
1268
+ IsVersionAtLeast(version) {
1269
+ if (!this.version) {
1270
+ return false;
1271
+ }
1272
+ // Debug.
1273
+ if (typeof this.version == "string" && this.version.toLowerCase().includes("debug")) {
1274
+ return true;
1275
+ }
1276
+ // Bad data.
1277
+ if (!this.version.includes(".")) {
1278
+ return false;
1279
+ }
1280
+ /**
1281
+ * Compares two arrays of version parts.
1282
+ * Returns -1 if `a` is less than `b`, 1 if `a` is greater than `b`, or 0 if they are equal.
1283
+ * @param a
1284
+ * @param b
1285
+ */
1286
+ function compareVersions(a, b) {
1287
+ for (let i = 0; i < a.length; i++) {
1288
+ if (a[i] < b[i]) {
1289
+ return -1;
1290
+ }
1291
+ else if (a[i] > b[i]) {
1292
+ return 1;
1293
+ }
1294
+ }
1295
+ return 0;
1296
+ }
1297
+ /**
1298
+ * Splits a version string into an array of version parts.
1299
+ * Example format: "1.0.4836".
1300
+ * @param version
1301
+ */
1302
+ function splitVersion(version) {
1303
+ return version.split(".").map(part => parseInt(part));
1304
+ }
1305
+ const curSplit = splitVersion(this.version);
1306
+ const reqSplit = splitVersion(version);
1307
+ return compareVersions(curSplit, reqSplit) >= 0;
1308
+ }
1259
1309
  }
1260
1310
  BruceApi$$1.Api = Api$$1;
1261
1311
  })(BruceApi || (BruceApi = {}));
@@ -14555,7 +14605,7 @@ var DataSource;
14555
14605
  })(DataSource || (DataSource = {}));
14556
14606
 
14557
14607
  // This is updated with the package.json version on build.
14558
- const VERSION = "5.2.4";
14608
+ const VERSION = "5.2.6";
14559
14609
 
14560
14610
  export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
14561
14611
  //# sourceMappingURL=bruce-models.es5.js.map