bruce-models 0.6.5 → 0.6.8
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 +292 -57
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +276 -50
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account.js +244 -230
- package/dist/lib/account/account.js.map +1 -1
- package/dist/lib/ann-document/ann-document.js +116 -116
- package/dist/lib/api/abstract-api.js +267 -267
- package/dist/lib/api/api.js +85 -85
- package/dist/lib/api/bruce-api.js +202 -140
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/api/cam-api.js +132 -132
- package/dist/lib/api/global-api.js +131 -131
- package/dist/lib/api/idm-api.js +132 -132
- package/dist/lib/bruce-models.js +83 -78
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/calculator/calculator.js +158 -158
- package/dist/lib/client-file/client-file.js +185 -185
- package/dist/lib/common/bounds.js +2 -2
- package/dist/lib/common/bruce-event.js +48 -48
- package/dist/lib/common/bruce-variable.js +54 -54
- package/dist/lib/common/cache.js +86 -86
- package/dist/lib/common/camera.js +11 -11
- package/dist/lib/common/cartes.js +55 -55
- package/dist/lib/common/carto.js +60 -60
- package/dist/lib/common/color.js +86 -86
- package/dist/lib/common/delay-queue.js +60 -60
- package/dist/lib/common/dictionary.js +2 -2
- package/dist/lib/common/geometry.js +120 -120
- package/dist/lib/common/transform.js +2 -2
- package/dist/lib/common/utc.js +39 -39
- package/dist/lib/custom-form/custom-form.js +136 -136
- package/dist/lib/data-lab/data-lab.js +90 -90
- package/dist/lib/entity/entity-attachment-type.js +132 -132
- package/dist/lib/entity/entity-attachment.js +208 -208
- package/dist/lib/entity/entity-comment.js +132 -132
- package/dist/lib/entity/entity-link.js +132 -132
- package/dist/lib/entity/entity-lod.js +189 -189
- package/dist/lib/entity/entity-relation-type.js +150 -150
- package/dist/lib/entity/entity-relation.js +189 -189
- package/dist/lib/entity/entity-source.js +176 -176
- package/dist/lib/entity/entity-tag.js +229 -229
- package/dist/lib/entity/entity-type.js +163 -163
- package/dist/lib/entity/entity.js +349 -349
- package/dist/lib/entity/getters/batched-data-getter.js +91 -91
- package/dist/lib/entity/getters/entity-filter-getter.js +344 -344
- package/dist/lib/entity/getters/entity-globe.js +135 -135
- package/dist/lib/entity/getters/view-monitor.js +2 -2
- package/dist/lib/import/import-cad.js +83 -0
- package/dist/lib/import/import-cad.js.map +1 -0
- package/dist/lib/import/import-csv.js +52 -0
- package/dist/lib/import/import-csv.js.map +1 -0
- package/dist/lib/import/import-json.js +52 -0
- package/dist/lib/import/import-json.js.map +1 -0
- package/dist/lib/import/import-kml.js +52 -0
- package/dist/lib/import/import-kml.js.map +1 -0
- package/dist/lib/import/imported-file.js +121 -121
- package/dist/lib/import/imported-file.js.map +1 -1
- package/dist/lib/markup/markup.js +40 -40
- package/dist/lib/program-key/program-key.js +152 -152
- package/dist/lib/project/menu-item.js +115 -115
- package/dist/lib/project/project-view-bookmark.js +172 -172
- package/dist/lib/project/project-view-tile-source.js +115 -115
- package/dist/lib/project/project-view.js +166 -166
- package/dist/lib/project/zoom-control.js +17 -17
- package/dist/lib/server/pending-action.js +106 -106
- package/dist/lib/server/task.js +113 -113
- package/dist/lib/style/style.js +152 -152
- package/dist/lib/tileset/tileset-cad.js +2 -2
- package/dist/lib/tileset/tileset-entities-map-tiles.js +18 -18
- package/dist/lib/tileset/tileset-entities.js +2 -2
- package/dist/lib/tileset/tileset-ext-map-tiles.js +17 -17
- package/dist/lib/tileset/tileset-ext-terrain-tiles.js +2 -2
- package/dist/lib/tileset/tileset-map-tiles.js +2 -2
- package/dist/lib/tileset/tileset-pointcloud.js +2 -2
- package/dist/lib/tileset/tileset-terrain-tiles.js +2 -2
- package/dist/lib/tileset/tileset.js +397 -397
- package/dist/lib/ucs/ucs.js +135 -135
- package/dist/lib/user/permission.js +20 -20
- package/dist/lib/user/session.js +160 -160
- package/dist/lib/user/user-group.js +139 -139
- package/dist/lib/user/user.js +451 -451
- package/dist/lib/util/encrypt-utils.js +20 -20
- package/dist/lib/util/math-utils.js +41 -41
- package/dist/lib/util/object-utils.js +17 -17
- package/dist/lib/util/path-utils.js +61 -61
- package/dist/lib/util/url-utils.js +107 -107
- package/dist/types/account/account.d.ts +11 -2
- package/dist/types/api/bruce-api.d.ts +2 -0
- package/dist/types/bruce-models.d.ts +5 -0
- package/dist/types/import/import-cad.d.ts +39 -0
- package/dist/types/import/import-csv.d.ts +26 -0
- package/dist/types/import/import-json.d.ts +21 -0
- package/dist/types/import/import-kml.d.ts +14 -0
- package/dist/types/import/imported-file.d.ts +2 -1
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -626,23 +626,18 @@
|
|
|
626
626
|
return AbstractApi;
|
|
627
627
|
}());
|
|
628
628
|
|
|
629
|
-
(function (
|
|
630
|
-
/**
|
|
631
|
-
* This is the request handler for Bruce Api,
|
|
632
|
-
* it should be passed to any method that wants to communicate with this particular api.
|
|
633
|
-
*/
|
|
629
|
+
(function (CamApi) {
|
|
634
630
|
var Api$$1 = /** @class */ (function (_super) {
|
|
635
631
|
__extends(Api$$1, _super);
|
|
636
|
-
function Api$$1(
|
|
637
|
-
var _this = _super.call(this, "
|
|
632
|
+
function Api$$1(env) {
|
|
633
|
+
var _this = _super.call(this, "SSID") || this;
|
|
638
634
|
_this.baseUrl = "";
|
|
639
|
-
_this.accountId = accountId;
|
|
640
635
|
_this.env = env !== null && env !== void 0 ? env : exports.Api.EEnv.PROD;
|
|
641
636
|
_this.setBaseUrl();
|
|
642
637
|
return _this;
|
|
643
638
|
}
|
|
644
639
|
Api$$1.prototype.setBaseUrl = function () {
|
|
645
|
-
var prefix = "https://
|
|
640
|
+
var prefix = "https://cam.nextspace";
|
|
646
641
|
var url;
|
|
647
642
|
var env = this.env.toUpperCase();
|
|
648
643
|
switch (env) {
|
|
@@ -693,13 +688,6 @@
|
|
|
693
688
|
});
|
|
694
689
|
});
|
|
695
690
|
};
|
|
696
|
-
Api$$1.prototype.PUT = function (url, data, params) {
|
|
697
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
698
|
-
return __generator(this, function (_a) {
|
|
699
|
-
return [2 /*return*/, this.put(this.baseUrl + url, data, params)];
|
|
700
|
-
});
|
|
701
|
-
});
|
|
702
|
-
};
|
|
703
691
|
Api$$1.prototype.UPLOAD = function (url, blob, params) {
|
|
704
692
|
return __awaiter(this, void 0, void 0, function () {
|
|
705
693
|
return __generator(this, function (_a) {
|
|
@@ -709,40 +697,80 @@
|
|
|
709
697
|
};
|
|
710
698
|
return Api$$1;
|
|
711
699
|
}(AbstractApi));
|
|
712
|
-
|
|
713
|
-
})(exports.
|
|
700
|
+
CamApi.Api = Api$$1;
|
|
701
|
+
})(exports.CamApi || (exports.CamApi = {}));
|
|
714
702
|
|
|
715
|
-
(function (
|
|
703
|
+
(function (BruceApi) {
|
|
704
|
+
/**
|
|
705
|
+
* This is the request handler for Bruce Api,
|
|
706
|
+
* it should be passed to any method that wants to communicate with this particular api.
|
|
707
|
+
*/
|
|
716
708
|
var Api$$1 = /** @class */ (function (_super) {
|
|
717
709
|
__extends(Api$$1, _super);
|
|
718
|
-
function Api$$1(env) {
|
|
719
|
-
var _this = _super.call(this, "
|
|
710
|
+
function Api$$1(accountId, env) {
|
|
711
|
+
var _this = _super.call(this, "x-sessionid") || this;
|
|
720
712
|
_this.baseUrl = "";
|
|
713
|
+
_this.accountId = accountId;
|
|
721
714
|
_this.env = env !== null && env !== void 0 ? env : exports.Api.EEnv.PROD;
|
|
722
|
-
_this.setBaseUrl();
|
|
715
|
+
_this.loadProm = _this.setBaseUrl();
|
|
723
716
|
return _this;
|
|
724
717
|
}
|
|
718
|
+
Object.defineProperty(Api$$1.prototype, "Loading", {
|
|
719
|
+
get: function () {
|
|
720
|
+
return this.loadProm;
|
|
721
|
+
},
|
|
722
|
+
enumerable: false,
|
|
723
|
+
configurable: true
|
|
724
|
+
});
|
|
725
725
|
Api$$1.prototype.setBaseUrl = function () {
|
|
726
|
-
var
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
726
|
+
var _a;
|
|
727
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
728
|
+
var prefix, url, env, camApi, settings, endpoint, e_1;
|
|
729
|
+
return __generator(this, function (_b) {
|
|
730
|
+
switch (_b.label) {
|
|
731
|
+
case 0:
|
|
732
|
+
prefix = "https://" + this.accountId + ".api.nextspace";
|
|
733
|
+
env = this.env.toUpperCase();
|
|
734
|
+
switch (env) {
|
|
735
|
+
case exports.Api.EEnv.DEV:
|
|
736
|
+
url = prefix + "-dev.net/";
|
|
737
|
+
break;
|
|
738
|
+
case exports.Api.EEnv.STG:
|
|
739
|
+
url = prefix + "-stg.net/";
|
|
740
|
+
break;
|
|
741
|
+
case exports.Api.EEnv.UAT:
|
|
742
|
+
url = prefix + "-uat.net/";
|
|
743
|
+
break;
|
|
744
|
+
case exports.Api.EEnv.PROD:
|
|
745
|
+
url = prefix + ".host/";
|
|
746
|
+
break;
|
|
747
|
+
default:
|
|
748
|
+
throw ("Specified Environment is not valid. SuppliedEnv=" + env);
|
|
749
|
+
}
|
|
750
|
+
this.baseUrl = url;
|
|
751
|
+
_b.label = 1;
|
|
752
|
+
case 1:
|
|
753
|
+
_b.trys.push([1, 3, , 4]);
|
|
754
|
+
camApi = new exports.CamApi.Api(env);
|
|
755
|
+
return [4 /*yield*/, exports.Account.GetAppSettings(camApi, this.accountId, exports.Account.EAppId.BruceApi)];
|
|
756
|
+
case 2:
|
|
757
|
+
settings = _b.sent();
|
|
758
|
+
endpoint = (_a = settings.BruceAPIURL) === null || _a === void 0 ? void 0 : _a[env];
|
|
759
|
+
if (typeof endpoint == "string") {
|
|
760
|
+
if (!endpoint.endsWith("/")) {
|
|
761
|
+
endpoint += "/";
|
|
762
|
+
}
|
|
763
|
+
this.baseUrl = endpoint;
|
|
764
|
+
}
|
|
765
|
+
return [3 /*break*/, 4];
|
|
766
|
+
case 3:
|
|
767
|
+
e_1 = _b.sent();
|
|
768
|
+
console.error(e_1);
|
|
769
|
+
return [3 /*break*/, 4];
|
|
770
|
+
case 4: return [2 /*return*/];
|
|
771
|
+
}
|
|
772
|
+
});
|
|
773
|
+
});
|
|
746
774
|
};
|
|
747
775
|
Api$$1.prototype.GetBaseUrl = function () {
|
|
748
776
|
return this.baseUrl;
|
|
@@ -755,36 +783,68 @@
|
|
|
755
783
|
};
|
|
756
784
|
Api$$1.prototype.GET = function (url, params) {
|
|
757
785
|
return __awaiter(this, void 0, void 0, function () {
|
|
786
|
+
var _this = this;
|
|
758
787
|
return __generator(this, function (_a) {
|
|
759
|
-
return [2 /*return*/,
|
|
788
|
+
return [2 /*return*/, new Promise(function (res, rej) {
|
|
789
|
+
_this.loadProm.then(function () {
|
|
790
|
+
_this.get(_this.baseUrl + url, params).then(res).catch(rej);
|
|
791
|
+
}).catch(rej);
|
|
792
|
+
})];
|
|
760
793
|
});
|
|
761
794
|
});
|
|
762
795
|
};
|
|
763
796
|
Api$$1.prototype.DELETE = function (url, params) {
|
|
764
797
|
return __awaiter(this, void 0, void 0, function () {
|
|
798
|
+
var _this = this;
|
|
765
799
|
return __generator(this, function (_a) {
|
|
766
|
-
return [2 /*return*/,
|
|
800
|
+
return [2 /*return*/, new Promise(function (res, rej) {
|
|
801
|
+
_this.loadProm.then(function () {
|
|
802
|
+
_this.delete(_this.baseUrl + url, params).then(res).catch(rej);
|
|
803
|
+
}).catch(rej);
|
|
804
|
+
})];
|
|
767
805
|
});
|
|
768
806
|
});
|
|
769
807
|
};
|
|
770
808
|
Api$$1.prototype.POST = function (url, data, params) {
|
|
771
809
|
return __awaiter(this, void 0, void 0, function () {
|
|
810
|
+
var _this = this;
|
|
772
811
|
return __generator(this, function (_a) {
|
|
773
|
-
return [2 /*return*/,
|
|
812
|
+
return [2 /*return*/, new Promise(function (res, rej) {
|
|
813
|
+
_this.loadProm.then(function () {
|
|
814
|
+
_this.post(_this.baseUrl + url, data, params).then(res).catch(rej);
|
|
815
|
+
}).catch(rej);
|
|
816
|
+
})];
|
|
817
|
+
});
|
|
818
|
+
});
|
|
819
|
+
};
|
|
820
|
+
Api$$1.prototype.PUT = function (url, data, params) {
|
|
821
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
822
|
+
var _this = this;
|
|
823
|
+
return __generator(this, function (_a) {
|
|
824
|
+
return [2 /*return*/, new Promise(function (res, rej) {
|
|
825
|
+
_this.loadProm.then(function () {
|
|
826
|
+
_this.put(_this.baseUrl + url, data, params).then(res).catch(rej);
|
|
827
|
+
}).catch(rej);
|
|
828
|
+
})];
|
|
774
829
|
});
|
|
775
830
|
});
|
|
776
831
|
};
|
|
777
832
|
Api$$1.prototype.UPLOAD = function (url, blob, params) {
|
|
778
833
|
return __awaiter(this, void 0, void 0, function () {
|
|
834
|
+
var _this = this;
|
|
779
835
|
return __generator(this, function (_a) {
|
|
780
|
-
return [2 /*return*/,
|
|
836
|
+
return [2 /*return*/, new Promise(function (res, rej) {
|
|
837
|
+
_this.loadProm.then(function () {
|
|
838
|
+
_this.upload(_this.baseUrl + url, blob, params).then(res).catch(rej);
|
|
839
|
+
}).catch(rej);
|
|
840
|
+
})];
|
|
781
841
|
});
|
|
782
842
|
});
|
|
783
843
|
};
|
|
784
844
|
return Api$$1;
|
|
785
845
|
}(AbstractApi));
|
|
786
|
-
|
|
787
|
-
})(exports.
|
|
846
|
+
BruceApi.Api = Api$$1;
|
|
847
|
+
})(exports.BruceApi || (exports.BruceApi = {}));
|
|
788
848
|
|
|
789
849
|
(function (IdmApi) {
|
|
790
850
|
/**
|
|
@@ -5655,6 +5715,15 @@
|
|
|
5655
5715
|
EDbRegion["Singapore"] = "SE";
|
|
5656
5716
|
EDbRegion["Australia"] = "AU";
|
|
5657
5717
|
})(EDbRegion = Account.EDbRegion || (Account.EDbRegion = {}));
|
|
5718
|
+
var EAppId;
|
|
5719
|
+
(function (EAppId) {
|
|
5720
|
+
EAppId["BruceApi"] = "BruceAPI";
|
|
5721
|
+
})(EAppId = Account.EAppId || (Account.EAppId = {}));
|
|
5722
|
+
var EStarterContent;
|
|
5723
|
+
(function (EStarterContent) {
|
|
5724
|
+
EStarterContent["Default"] = "default";
|
|
5725
|
+
EStarterContent["None"] = "none";
|
|
5726
|
+
})(EStarterContent = Account.EStarterContent || (Account.EStarterContent = {}));
|
|
5658
5727
|
Account.DbRegions = [
|
|
5659
5728
|
{
|
|
5660
5729
|
name: "North California, USA",
|
|
@@ -5799,18 +5868,23 @@
|
|
|
5799
5868
|
* @param id
|
|
5800
5869
|
* @param name
|
|
5801
5870
|
* @param region
|
|
5871
|
+
* @param starterContent
|
|
5802
5872
|
* @returns
|
|
5803
5873
|
*/
|
|
5804
|
-
function Create(api, id, name, region) {
|
|
5874
|
+
function Create(api, id, name, region, starterContent) {
|
|
5805
5875
|
return __awaiter(this, void 0, void 0, function () {
|
|
5806
5876
|
var reqData, res;
|
|
5807
5877
|
return __generator(this, function (_a) {
|
|
5808
5878
|
if (!id || !name || !region) {
|
|
5809
5879
|
throw new Error("Id, Name and Region are required.");
|
|
5810
5880
|
}
|
|
5881
|
+
if (!starterContent) {
|
|
5882
|
+
starterContent = EStarterContent.None;
|
|
5883
|
+
}
|
|
5811
5884
|
reqData = {
|
|
5812
5885
|
"Name": name,
|
|
5813
|
-
"DBLocation": region
|
|
5886
|
+
"DBLocation": region,
|
|
5887
|
+
"StarterContent": starterContent
|
|
5814
5888
|
};
|
|
5815
5889
|
res = api.POST("clientAccount/" + id, reqData, exports.Api.PrepReqParams());
|
|
5816
5890
|
api.Cache.Remove(GetListCacheKey(api.GetSessionId()));
|
|
@@ -6030,6 +6104,158 @@
|
|
|
6030
6104
|
})(Entity = DataLab.Entity || (DataLab.Entity = {}));
|
|
6031
6105
|
})(exports.DataLab || (exports.DataLab = {}));
|
|
6032
6106
|
|
|
6107
|
+
(function (ImportCad) {
|
|
6108
|
+
function Analyze(api, params) {
|
|
6109
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6110
|
+
return __generator(this, function (_a) {
|
|
6111
|
+
return [2 /*return*/, api.POST("entities/PrepareIFCForImport", params, exports.Api.PrepReqParams())];
|
|
6112
|
+
});
|
|
6113
|
+
});
|
|
6114
|
+
}
|
|
6115
|
+
ImportCad.Analyze = Analyze;
|
|
6116
|
+
function ImportEntities(api, params) {
|
|
6117
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6118
|
+
return __generator(this, function (_a) {
|
|
6119
|
+
return [2 /*return*/, api.POST("entities/importIFCWithProgress", params, exports.Api.PrepReqParams())];
|
|
6120
|
+
});
|
|
6121
|
+
});
|
|
6122
|
+
}
|
|
6123
|
+
ImportCad.ImportEntities = ImportEntities;
|
|
6124
|
+
/**
|
|
6125
|
+
* Parses the completed pending action result from running "ImportEntities".
|
|
6126
|
+
* This will return the root entity's id if any is present.
|
|
6127
|
+
* @param paResult
|
|
6128
|
+
*/
|
|
6129
|
+
function ParseRootId(paResult) {
|
|
6130
|
+
var _a;
|
|
6131
|
+
try {
|
|
6132
|
+
var obj = typeof paResult == "string" ? JSON.parse(paResult) : paResult;
|
|
6133
|
+
if ((_a = obj === null || obj === void 0 ? void 0 : obj.result) === null || _a === void 0 ? void 0 : _a.length) {
|
|
6134
|
+
return obj.result[0];
|
|
6135
|
+
}
|
|
6136
|
+
}
|
|
6137
|
+
catch (_b) {
|
|
6138
|
+
// Failed to parse json.
|
|
6139
|
+
}
|
|
6140
|
+
return null;
|
|
6141
|
+
}
|
|
6142
|
+
ImportCad.ParseRootId = ParseRootId;
|
|
6143
|
+
})(exports.ImportCad || (exports.ImportCad = {}));
|
|
6144
|
+
|
|
6145
|
+
(function (ImportCsv) {
|
|
6146
|
+
function ImportEntities(api, params) {
|
|
6147
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6148
|
+
return __generator(this, function (_a) {
|
|
6149
|
+
return [2 /*return*/, api.POST("entities/importCSVWithProgress2", params, exports.Api.PrepReqParams())];
|
|
6150
|
+
});
|
|
6151
|
+
});
|
|
6152
|
+
}
|
|
6153
|
+
ImportCsv.ImportEntities = ImportEntities;
|
|
6154
|
+
})(exports.ImportCsv || (exports.ImportCsv = {}));
|
|
6155
|
+
|
|
6156
|
+
(function (ImportJson) {
|
|
6157
|
+
function ImportEntities(api, params) {
|
|
6158
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6159
|
+
return __generator(this, function (_a) {
|
|
6160
|
+
return [2 /*return*/, api.POST("entities/importJsonWithProgress", params, exports.Api.PrepReqParams())];
|
|
6161
|
+
});
|
|
6162
|
+
});
|
|
6163
|
+
}
|
|
6164
|
+
ImportJson.ImportEntities = ImportEntities;
|
|
6165
|
+
})(exports.ImportJson || (exports.ImportJson = {}));
|
|
6166
|
+
|
|
6167
|
+
(function (ImportKml) {
|
|
6168
|
+
function ImportEntities(api, params) {
|
|
6169
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6170
|
+
return __generator(this, function (_a) {
|
|
6171
|
+
return [2 /*return*/, api.POST("entities/importKMLWithProgress2", params, exports.Api.PrepReqParams())];
|
|
6172
|
+
});
|
|
6173
|
+
});
|
|
6174
|
+
}
|
|
6175
|
+
ImportKml.ImportEntities = ImportEntities;
|
|
6176
|
+
})(exports.ImportKml || (exports.ImportKml = {}));
|
|
6177
|
+
|
|
6178
|
+
(function (ImportedFile) {
|
|
6179
|
+
function GetCacheKey(fileId) {
|
|
6180
|
+
return exports.Api.ECacheKey.ImportedFile + exports.Api.ECacheKey.Id + fileId;
|
|
6181
|
+
}
|
|
6182
|
+
ImportedFile.GetCacheKey = GetCacheKey;
|
|
6183
|
+
function GetListCacheKey(type, pageIndex) {
|
|
6184
|
+
return exports.Api.ECacheKey.ImportedFile + type + pageIndex;
|
|
6185
|
+
}
|
|
6186
|
+
ImportedFile.GetListCacheKey = GetListCacheKey;
|
|
6187
|
+
var EFileType;
|
|
6188
|
+
(function (EFileType) {
|
|
6189
|
+
EFileType["CAD"] = "CAD";
|
|
6190
|
+
EFileType["All"] = "All";
|
|
6191
|
+
})(EFileType = ImportedFile.EFileType || (ImportedFile.EFileType = {}));
|
|
6192
|
+
function GetList(api, type, pageIndex) {
|
|
6193
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6194
|
+
var cacheData, first, url, req, prom;
|
|
6195
|
+
var _this = this;
|
|
6196
|
+
return __generator(this, function (_a) {
|
|
6197
|
+
if (!type) {
|
|
6198
|
+
type = EFileType.All;
|
|
6199
|
+
}
|
|
6200
|
+
if (!pageIndex) {
|
|
6201
|
+
pageIndex = 0;
|
|
6202
|
+
}
|
|
6203
|
+
cacheData = api.Cache.Get(GetListCacheKey(type, pageIndex));
|
|
6204
|
+
if (cacheData) {
|
|
6205
|
+
return [2 /*return*/, cacheData];
|
|
6206
|
+
}
|
|
6207
|
+
first = true;
|
|
6208
|
+
url = "entityImportFiles";
|
|
6209
|
+
if (type != EFileType.All) {
|
|
6210
|
+
url += "?FileType=" + type;
|
|
6211
|
+
first = false;
|
|
6212
|
+
}
|
|
6213
|
+
if (pageIndex > 0) {
|
|
6214
|
+
url += (first ? "?" : "&") + "pageIndex=" + pageIndex;
|
|
6215
|
+
}
|
|
6216
|
+
req = api.GET(url);
|
|
6217
|
+
prom = new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
|
|
6218
|
+
var data, e_1;
|
|
6219
|
+
return __generator(this, function (_a) {
|
|
6220
|
+
switch (_a.label) {
|
|
6221
|
+
case 0:
|
|
6222
|
+
_a.trys.push([0, 2, , 3]);
|
|
6223
|
+
return [4 /*yield*/, req];
|
|
6224
|
+
case 1:
|
|
6225
|
+
data = _a.sent();
|
|
6226
|
+
res(data.Items);
|
|
6227
|
+
return [3 /*break*/, 3];
|
|
6228
|
+
case 2:
|
|
6229
|
+
e_1 = _a.sent();
|
|
6230
|
+
rej(e_1);
|
|
6231
|
+
return [3 /*break*/, 3];
|
|
6232
|
+
case 3: return [2 /*return*/];
|
|
6233
|
+
}
|
|
6234
|
+
});
|
|
6235
|
+
}); });
|
|
6236
|
+
api.Cache.Set(GetListCacheKey(type, pageIndex), prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
6237
|
+
return [2 /*return*/, prom];
|
|
6238
|
+
});
|
|
6239
|
+
});
|
|
6240
|
+
}
|
|
6241
|
+
ImportedFile.GetList = GetList;
|
|
6242
|
+
function Get(api, fileId) {
|
|
6243
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6244
|
+
var cacheData, req;
|
|
6245
|
+
return __generator(this, function (_a) {
|
|
6246
|
+
cacheData = api.Cache.Get(GetCacheKey(fileId));
|
|
6247
|
+
if (cacheData) {
|
|
6248
|
+
return [2 /*return*/, cacheData];
|
|
6249
|
+
}
|
|
6250
|
+
req = api.GET("entityImportFile/" + fileId);
|
|
6251
|
+
api.Cache.Set(GetCacheKey(fileId), req, exports.Api.DEFAULT_CACHE_DURATION);
|
|
6252
|
+
return [2 /*return*/, req];
|
|
6253
|
+
});
|
|
6254
|
+
});
|
|
6255
|
+
}
|
|
6256
|
+
ImportedFile.Get = Get;
|
|
6257
|
+
})(exports.ImportedFile || (exports.ImportedFile = {}));
|
|
6258
|
+
|
|
6033
6259
|
exports.AbstractApi = AbstractApi;
|
|
6034
6260
|
exports.BruceEvent = BruceEvent;
|
|
6035
6261
|
exports.CacheControl = CacheControl;
|