bruce-models 4.8.1 → 4.8.3
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 +92 -69
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +92 -69
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/abstract-api.js +19 -57
- package/dist/lib/api/abstract-api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/entity/entity-type.js +12 -9
- package/dist/lib/entity/entity-type.js.map +1 -1
- package/dist/lib/server/pending-action.js +60 -2
- package/dist/lib/server/pending-action.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/entity/entity-type.d.ts +5 -3
- package/dist/types/server/pending-action.d.ts +2 -0
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -526,65 +526,27 @@ class AbstractApi {
|
|
|
526
526
|
*/
|
|
527
527
|
upload(url, blob, params) {
|
|
528
528
|
return __awaiter(this, void 0, void 0, function* () {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
if (xhr.upload) {
|
|
543
|
-
xhr.upload.onprogress = params === null || params === void 0 ? void 0 : params.onProgress;
|
|
544
|
-
}
|
|
545
|
-
else {
|
|
546
|
-
xhr.addEventListener("progress", params === null || params === void 0 ? void 0 : params.onProgress);
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
xhr.onreadystatechange = (e) => {
|
|
550
|
-
if (xhr.readyState == 4) {
|
|
551
|
-
if (xhr.status >= 400 || xhr.status < 200) {
|
|
552
|
-
rej(e);
|
|
553
|
-
}
|
|
554
|
-
else {
|
|
555
|
-
try {
|
|
556
|
-
res(JSON.parse(xhr.responseText));
|
|
557
|
-
}
|
|
558
|
-
catch (e) {
|
|
559
|
-
console.error(e, xhr.responseText);
|
|
560
|
-
res(xhr.responseText);
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
xhr.open("POST", url, true);
|
|
566
|
-
if (this.ssidHeader && this.ssid) {
|
|
567
|
-
xhr.setRequestHeader(this.ssidHeader, this.ssid);
|
|
568
|
-
}
|
|
569
|
-
let formData;
|
|
570
|
-
if ((params === null || params === void 0 ? void 0 : params.formData) instanceof FormData) {
|
|
571
|
-
formData = params === null || params === void 0 ? void 0 : params.formData;
|
|
572
|
-
}
|
|
573
|
-
else {
|
|
574
|
-
formData = new FormData();
|
|
575
|
-
if (params === null || params === void 0 ? void 0 : params.formData) {
|
|
576
|
-
for (const key in params.formData) {
|
|
577
|
-
formData.append(key, params.formData[key]);
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
formData.append("file", blob);
|
|
582
|
-
xhr.send(formData);
|
|
583
|
-
}
|
|
584
|
-
catch (e) {
|
|
585
|
-
rej(e);
|
|
529
|
+
if (!params) {
|
|
530
|
+
params = {};
|
|
531
|
+
}
|
|
532
|
+
params.headers = params.headers || {};
|
|
533
|
+
params.headers = Object.assign({}, params.headers);
|
|
534
|
+
if (this.ssidHeader && this.ssid) {
|
|
535
|
+
params.headers[this.ssidHeader] = this.ssid;
|
|
536
|
+
}
|
|
537
|
+
const formData = new FormData();
|
|
538
|
+
formData.append("file", blob);
|
|
539
|
+
if (params === null || params === void 0 ? void 0 : params.formData) {
|
|
540
|
+
for (const key in params.formData) {
|
|
541
|
+
formData.append(key, params.formData[key]);
|
|
586
542
|
}
|
|
543
|
+
}
|
|
544
|
+
const res = yield fetch(url, {
|
|
545
|
+
headers: params.headers,
|
|
546
|
+
method: "POST",
|
|
547
|
+
body: formData
|
|
587
548
|
});
|
|
549
|
+
return parseResult(res);
|
|
588
550
|
});
|
|
589
551
|
}
|
|
590
552
|
}
|
|
@@ -2594,21 +2556,24 @@ var EntityType;
|
|
|
2594
2556
|
*/
|
|
2595
2557
|
function ReIndex(params) {
|
|
2596
2558
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2597
|
-
let { api, entityTypeId: typeId, req } = params;
|
|
2598
|
-
if (!typeId) {
|
|
2599
|
-
throw ("Type ID is required.");
|
|
2600
|
-
}
|
|
2559
|
+
let { api, entityTypeId: typeId, req, dataTransformId, reSaveAll } = params;
|
|
2601
2560
|
if (!api) {
|
|
2602
2561
|
api = ENVIRONMENT.Api().GetBruceApi();
|
|
2603
2562
|
}
|
|
2604
2563
|
const urlParams = new URLSearchParams();
|
|
2605
|
-
if (
|
|
2606
|
-
urlParams.append("dataTransformID", String(
|
|
2564
|
+
if (dataTransformId) {
|
|
2565
|
+
urlParams.append("dataTransformID", String(dataTransformId));
|
|
2566
|
+
}
|
|
2567
|
+
if (reSaveAll) {
|
|
2568
|
+
urlParams.append("reSaveAll", "true");
|
|
2607
2569
|
}
|
|
2608
|
-
|
|
2570
|
+
let url = typeId ? `entityType/${typeId}/reindex` : "entities/reindex";
|
|
2571
|
+
url += "?" + urlParams.toString();
|
|
2609
2572
|
req = Api.PrepReqParams(req);
|
|
2610
|
-
const
|
|
2611
|
-
return
|
|
2573
|
+
const res = yield api.POST(url, {}, req);
|
|
2574
|
+
return {
|
|
2575
|
+
pendingActionId: res.PendingActionID
|
|
2576
|
+
};
|
|
2612
2577
|
});
|
|
2613
2578
|
}
|
|
2614
2579
|
EntityType.ReIndex = ReIndex;
|
|
@@ -10784,7 +10749,7 @@ var PendingAction;
|
|
|
10784
10749
|
*/
|
|
10785
10750
|
function OnCompletion(params) {
|
|
10786
10751
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10787
|
-
let { api, actionId, req: reqParams, interval: intMs, isDisposed } = params;
|
|
10752
|
+
let { api, actionId, req: reqParams, interval: intMs, isDisposed, onMessage } = params;
|
|
10788
10753
|
if (!actionId) {
|
|
10789
10754
|
throw ("Action ID is required.");
|
|
10790
10755
|
}
|
|
@@ -10794,10 +10759,43 @@ var PendingAction;
|
|
|
10794
10759
|
if (!intMs || intMs <= 0) {
|
|
10795
10760
|
intMs = 3000;
|
|
10796
10761
|
}
|
|
10762
|
+
// Map of found messages.
|
|
10763
|
+
const returnedMsgs = new Map();
|
|
10764
|
+
const returnedMsgsArr = [];
|
|
10797
10765
|
const res = yield new Promise((res, rej) => {
|
|
10766
|
+
let msgInterval = null;
|
|
10767
|
+
if (onMessage != null) {
|
|
10768
|
+
msgInterval = setInterval(() => __awaiter(this, void 0, void 0, function* () {
|
|
10769
|
+
try {
|
|
10770
|
+
const { messages } = yield GetMessages({
|
|
10771
|
+
api,
|
|
10772
|
+
actionId,
|
|
10773
|
+
order: Api.ESortOrder.Desc,
|
|
10774
|
+
startIndex: 0,
|
|
10775
|
+
amount: 5
|
|
10776
|
+
});
|
|
10777
|
+
for (let i = 0; i < messages.length; i++) {
|
|
10778
|
+
const message = messages[i];
|
|
10779
|
+
// If this is a new message we'll notify the callback.
|
|
10780
|
+
// We'll also add it to the map so we don't notify it again, and to return it later.
|
|
10781
|
+
if (!returnedMsgs.has(message.ID)) {
|
|
10782
|
+
returnedMsgs.set(message.ID, true);
|
|
10783
|
+
returnedMsgsArr.push(message);
|
|
10784
|
+
onMessage(message);
|
|
10785
|
+
}
|
|
10786
|
+
}
|
|
10787
|
+
}
|
|
10788
|
+
catch (e) {
|
|
10789
|
+
clearInterval(msgInterval);
|
|
10790
|
+
}
|
|
10791
|
+
}), 1000);
|
|
10792
|
+
}
|
|
10798
10793
|
let interval = setInterval(() => __awaiter(this, void 0, void 0, function* () {
|
|
10799
10794
|
if (isDisposed && isDisposed()) {
|
|
10800
10795
|
clearInterval(interval);
|
|
10796
|
+
if (msgInterval) {
|
|
10797
|
+
clearInterval(msgInterval);
|
|
10798
|
+
}
|
|
10801
10799
|
res(null);
|
|
10802
10800
|
}
|
|
10803
10801
|
try {
|
|
@@ -10808,16 +10806,41 @@ var PendingAction;
|
|
|
10808
10806
|
});
|
|
10809
10807
|
if (action.Status !== EStatus.InProgress) {
|
|
10810
10808
|
clearInterval(interval);
|
|
10809
|
+
if (msgInterval) {
|
|
10810
|
+
clearInterval(msgInterval);
|
|
10811
|
+
}
|
|
10811
10812
|
res(action);
|
|
10812
10813
|
}
|
|
10813
10814
|
}
|
|
10814
10815
|
catch (e) {
|
|
10816
|
+
clearInterval(interval);
|
|
10817
|
+
if (msgInterval) {
|
|
10818
|
+
clearInterval(msgInterval);
|
|
10819
|
+
}
|
|
10815
10820
|
rej(e);
|
|
10816
10821
|
}
|
|
10817
10822
|
}), intMs);
|
|
10818
10823
|
});
|
|
10824
|
+
// Gather latest 30 messages.
|
|
10825
|
+
if (!isDisposed || !isDisposed()) {
|
|
10826
|
+
const { messages } = yield GetMessages({
|
|
10827
|
+
api,
|
|
10828
|
+
actionId,
|
|
10829
|
+
order: Api.ESortOrder.Desc,
|
|
10830
|
+
startIndex: 0,
|
|
10831
|
+
amount: 30
|
|
10832
|
+
});
|
|
10833
|
+
for (let i = 0; i < messages.length; i++) {
|
|
10834
|
+
const message = messages[i];
|
|
10835
|
+
if (!returnedMsgs.has(message.ID)) {
|
|
10836
|
+
returnedMsgs.set(message.ID, true);
|
|
10837
|
+
returnedMsgsArr.push(message);
|
|
10838
|
+
}
|
|
10839
|
+
}
|
|
10840
|
+
}
|
|
10819
10841
|
return {
|
|
10820
|
-
action: res
|
|
10842
|
+
action: res,
|
|
10843
|
+
messages: returnedMsgsArr
|
|
10821
10844
|
};
|
|
10822
10845
|
});
|
|
10823
10846
|
}
|
|
@@ -14258,7 +14281,7 @@ var DataSource;
|
|
|
14258
14281
|
})(DataSource || (DataSource = {}));
|
|
14259
14282
|
|
|
14260
14283
|
// This is updated with the package.json version on build.
|
|
14261
|
-
const VERSION = "4.8.
|
|
14284
|
+
const VERSION = "4.8.3";
|
|
14262
14285
|
|
|
14263
14286
|
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, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
|
|
14264
14287
|
//# sourceMappingURL=bruce-models.es5.js.map
|