bruce-models 5.6.8 → 5.7.0
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/bruce-models.es5.js +19 -27
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +19 -27
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/abstract-api.js +17 -25
- package/dist/lib/api/abstract-api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/internal/uploader.js +1 -1
- package/dist/lib/internal/uploader.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -550,12 +550,6 @@ class AbstractApi {
|
|
|
550
550
|
if (this.ssidHeader) {
|
|
551
551
|
params.headers[this.ssidHeader] = this.GetSessionId();
|
|
552
552
|
}
|
|
553
|
-
/**
|
|
554
|
-
* If we support the legacy request and need it for progress, then we diverge there.
|
|
555
|
-
*/
|
|
556
|
-
if (window && window["XMLHttpRequest"] && params.onProgress) {
|
|
557
|
-
return legacyUpload(url, blob, params);
|
|
558
|
-
}
|
|
559
553
|
const formData = params.formData instanceof FormData ? params.formData : new FormData();
|
|
560
554
|
if (formData.has("file")) {
|
|
561
555
|
formData.delete("file");
|
|
@@ -567,6 +561,12 @@ class AbstractApi {
|
|
|
567
561
|
formData.append(key, params.formData[key]);
|
|
568
562
|
}
|
|
569
563
|
}
|
|
564
|
+
/**
|
|
565
|
+
* If we support the legacy request and need it for progress, then we diverge there.
|
|
566
|
+
*/
|
|
567
|
+
if (window && window["XMLHttpRequest"] && params.onProgress) {
|
|
568
|
+
return legacyUpload(url, params.headers, formData, params.onProgress, params.abortSignal);
|
|
569
|
+
}
|
|
570
570
|
const res = yield fetch(url, {
|
|
571
571
|
headers: params.headers,
|
|
572
572
|
method: "POST",
|
|
@@ -582,34 +582,26 @@ class AbstractApi {
|
|
|
582
582
|
* Unfortunately, this is needed to track progress when it's supported.
|
|
583
583
|
* Fetch doesn't have this capability.
|
|
584
584
|
* @param url
|
|
585
|
-
* @param blob
|
|
586
585
|
* @param params
|
|
587
586
|
*/
|
|
588
|
-
function legacyUpload(url,
|
|
589
|
-
params = Object.assign({}, params);
|
|
590
|
-
params.headers = Object.assign({}, params.headers);
|
|
591
|
-
const formData = new FormData();
|
|
592
|
-
formData.append("file", blob);
|
|
593
|
-
if (params.formData && !(params.formData instanceof FormData)) {
|
|
594
|
-
for (let key in params.formData) {
|
|
595
|
-
if (key !== "file") {
|
|
596
|
-
formData.append(key, params.formData[key]);
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
}
|
|
587
|
+
function legacyUpload(url, headers, formData, onProgress, abortSignal) {
|
|
600
588
|
return new Promise((resolve, reject) => {
|
|
601
589
|
const xhr = new window["XMLHttpRequest"]();
|
|
602
590
|
xhr.open("POST", url, true);
|
|
603
591
|
// Set custom headers.
|
|
604
|
-
if (
|
|
605
|
-
Object.
|
|
592
|
+
if (headers) {
|
|
593
|
+
Object.keys(headers).forEach((key) => {
|
|
594
|
+
let value = headers[key];
|
|
595
|
+
if (!value) {
|
|
596
|
+
value = "";
|
|
597
|
+
}
|
|
606
598
|
xhr.setRequestHeader(key, value);
|
|
607
599
|
});
|
|
608
600
|
}
|
|
609
601
|
// Progress event.
|
|
610
602
|
xhr.upload.onprogress = (event) => {
|
|
611
|
-
if (
|
|
612
|
-
|
|
603
|
+
if (onProgress && event.lengthComputable) {
|
|
604
|
+
onProgress(event);
|
|
613
605
|
}
|
|
614
606
|
};
|
|
615
607
|
// Success and error handling.
|
|
@@ -622,8 +614,8 @@ function legacyUpload(url, blob, params) {
|
|
|
622
614
|
}
|
|
623
615
|
};
|
|
624
616
|
xhr.onerror = () => reject(new Error("Network error occurred during file upload."));
|
|
625
|
-
if (
|
|
626
|
-
|
|
617
|
+
if (abortSignal) {
|
|
618
|
+
abortSignal.addEventListener("abort", () => {
|
|
627
619
|
xhr.abort();
|
|
628
620
|
reject(new Error("Upload aborted."));
|
|
629
621
|
});
|
|
@@ -8436,7 +8428,7 @@ var Uploader;
|
|
|
8436
8428
|
if (!api) {
|
|
8437
8429
|
api = ENVIRONMENT.Api().GetBruceApi();
|
|
8438
8430
|
}
|
|
8439
|
-
const FILE_PORTION_SIZE =
|
|
8431
|
+
const FILE_PORTION_SIZE = 50000000; // 50MB.
|
|
8440
8432
|
let fileSize = file.size;
|
|
8441
8433
|
let fileOffset = 0;
|
|
8442
8434
|
let filePartsCount = fileSize / FILE_PORTION_SIZE;
|
|
@@ -15271,7 +15263,7 @@ var Scenario;
|
|
|
15271
15263
|
})(Scenario || (Scenario = {}));
|
|
15272
15264
|
|
|
15273
15265
|
// This is updated with the package.json version on build.
|
|
15274
|
-
const VERSION = "5.
|
|
15266
|
+
const VERSION = "5.7.0";
|
|
15275
15267
|
|
|
15276
15268
|
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, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewBookmarkGroup, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario };
|
|
15277
15269
|
//# sourceMappingURL=bruce-models.es5.js.map
|