bruce-models 1.7.5 → 1.7.7
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 +73 -36
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +73 -36
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account.js +2 -2
- package/dist/lib/account/account.js.map +1 -1
- package/dist/lib/api/bruce-api.js +23 -21
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/entity/entity.js +43 -10
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/lib/entity/getters/entity-filter-getter.js +5 -3
- package/dist/lib/entity/getters/entity-filter-getter.js.map +1 -1
- package/dist/types/account/account.d.ts +3 -0
- package/dist/types/api/bruce-api.d.ts +2 -0
- package/dist/types/entity/entity.d.ts +2 -0
- package/dist/types/entity/getters/entity-filter-getter.d.ts +2 -1
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -820,14 +820,14 @@
|
|
|
820
820
|
Account.Create = Create;
|
|
821
821
|
function GetDbRegions(params) {
|
|
822
822
|
return __awaiter(this, void 0, void 0, function* () {
|
|
823
|
-
const { api, req: reqParams } = params;
|
|
823
|
+
const { api, req: reqParams, key } = params;
|
|
824
824
|
const cacheData = api.GetCacheItem(GetDbRegionListCacheKey(), reqParams);
|
|
825
825
|
if (cacheData) {
|
|
826
826
|
return cacheData;
|
|
827
827
|
}
|
|
828
828
|
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
829
829
|
try {
|
|
830
|
-
const data = yield api.GET(
|
|
830
|
+
const data = yield api.GET(`config/regions${key ? "?Key=" + key : ""}`, exports.Api.PrepReqParams(reqParams));
|
|
831
831
|
res(data);
|
|
832
832
|
}
|
|
833
833
|
catch (e) {
|
|
@@ -1108,29 +1108,31 @@
|
|
|
1108
1108
|
throw ("Specified Environment is not valid. SuppliedEnv=" + env);
|
|
1109
1109
|
}
|
|
1110
1110
|
this.baseUrl = url;
|
|
1111
|
-
if (cam
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
if (
|
|
1127
|
-
endpoint
|
|
1111
|
+
if (cam) {
|
|
1112
|
+
if (loadRegionalUrl) {
|
|
1113
|
+
// Attempt to load an account specific base url.
|
|
1114
|
+
// This could be one with a region specific endpoint.
|
|
1115
|
+
try {
|
|
1116
|
+
const settings = (yield exports.Account.GetAppSettings({
|
|
1117
|
+
api: cam,
|
|
1118
|
+
accountId: this.accountId,
|
|
1119
|
+
appId: exports.Account.EAppId.BruceApi
|
|
1120
|
+
})).settings;
|
|
1121
|
+
if (this.loadCancelled) {
|
|
1122
|
+
console.warn("BruceApi: Loading was cancelled due to SetBaseUrl being called, not setting regional base url.");
|
|
1123
|
+
return;
|
|
1124
|
+
}
|
|
1125
|
+
let endpoint = (_a = settings.BruceAPIURL) === null || _a === void 0 ? void 0 : _a[env];
|
|
1126
|
+
if (typeof endpoint == "string") {
|
|
1127
|
+
if (!endpoint.endsWith("/")) {
|
|
1128
|
+
endpoint += "/";
|
|
1129
|
+
}
|
|
1130
|
+
this.baseUrl = endpoint;
|
|
1128
1131
|
}
|
|
1129
|
-
this.baseUrl = endpoint;
|
|
1130
1132
|
}
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1133
|
+
catch (e) {
|
|
1134
|
+
console.error(e);
|
|
1135
|
+
}
|
|
1134
1136
|
}
|
|
1135
1137
|
}
|
|
1136
1138
|
try {
|
|
@@ -1849,7 +1851,7 @@
|
|
|
1849
1851
|
Entity.CalculateName = CalculateName;
|
|
1850
1852
|
function GetList(params) {
|
|
1851
1853
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1852
|
-
const { api, filter, req: reqParams } = params;
|
|
1854
|
+
const { api, filter, req: reqParams, viaCdn, viaCdnCacheToken } = params;
|
|
1853
1855
|
let requestFilter = {};
|
|
1854
1856
|
if (filter.entityTypeConditions) {
|
|
1855
1857
|
requestFilter = Object.assign({}, filter.entityTypeConditions);
|
|
@@ -1878,17 +1880,50 @@
|
|
|
1878
1880
|
PageIndex: filter.pageIndex,
|
|
1879
1881
|
PageSize: filter.pageSize
|
|
1880
1882
|
};
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
const
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
}
|
|
1883
|
+
let entities = [];
|
|
1884
|
+
if (viaCdn && api.EntityCdnUrl) {
|
|
1885
|
+
const url = new URL(api.EntityCdnUrl);
|
|
1886
|
+
const urlParams = new URLSearchParams(url.search);
|
|
1887
|
+
urlParams.set("cacheToken", String(viaCdnCacheToken ? viaCdnCacheToken : 0));
|
|
1888
|
+
if (body.SortOrder) {
|
|
1889
|
+
urlParams.set("SortOrder", body.SortOrder);
|
|
1890
|
+
}
|
|
1891
|
+
if (body.OrderBy) {
|
|
1892
|
+
urlParams.set("OrderBy", body.OrderBy);
|
|
1893
|
+
}
|
|
1894
|
+
if (body.Filter) {
|
|
1895
|
+
urlParams.set("Filter", JSON.stringify(body.Filter));
|
|
1896
|
+
}
|
|
1897
|
+
if (body.LODType) {
|
|
1898
|
+
urlParams.set("LODType", body.LODType);
|
|
1899
|
+
}
|
|
1900
|
+
if (body.BruceEntityType) {
|
|
1901
|
+
urlParams.set("BruceEntityType", body.BruceEntityType);
|
|
1902
|
+
}
|
|
1903
|
+
if (body.PageIndex) {
|
|
1904
|
+
urlParams.set("PageIndex", String(body.PageIndex));
|
|
1905
|
+
}
|
|
1906
|
+
if (body.PageSize) {
|
|
1907
|
+
urlParams.set("PageSize", String(body.PageSize));
|
|
1908
|
+
}
|
|
1909
|
+
const urlStr = url.toString() + "?" + urlParams.toString();
|
|
1910
|
+
const data = yield api.get(urlStr, exports.Api.PrepReqParams(reqParams));
|
|
1911
|
+
entities = data.Items;
|
|
1912
|
+
}
|
|
1913
|
+
else {
|
|
1914
|
+
const data = yield api.POST("entities", body, exports.Api.PrepReqParams(reqParams));
|
|
1915
|
+
entities = data.Items;
|
|
1916
|
+
// Only caching when non-CDN.
|
|
1917
|
+
for (let i = 0; i < entities.length; i++) {
|
|
1918
|
+
const entity = entities[i];
|
|
1919
|
+
const id = entity.Bruce.ID;
|
|
1920
|
+
api.Cache.Set(GetCacheKey(id), {
|
|
1921
|
+
entity: entity
|
|
1922
|
+
}, exports.Api.DEFAULT_CACHE_DURATION);
|
|
1923
|
+
}
|
|
1889
1924
|
}
|
|
1890
1925
|
return {
|
|
1891
|
-
entities
|
|
1926
|
+
entities
|
|
1892
1927
|
};
|
|
1893
1928
|
});
|
|
1894
1929
|
}
|
|
@@ -3998,7 +4033,7 @@
|
|
|
3998
4033
|
EStatus["Loading"] = "LOADING";
|
|
3999
4034
|
})(EStatus = EntityFilterGetter.EStatus || (EntityFilterGetter.EStatus = {}));
|
|
4000
4035
|
class Getter {
|
|
4001
|
-
constructor(api, viewPort, typeId, batchSize, attrFilter) {
|
|
4036
|
+
constructor(api, viewPort, typeId, batchSize, attrFilter, viaCdn) {
|
|
4002
4037
|
this.onUpdate = null;
|
|
4003
4038
|
this.LastStateUpdates = {};
|
|
4004
4039
|
this.onStateUpdate = null;
|
|
@@ -4014,7 +4049,8 @@
|
|
|
4014
4049
|
this.viewCenter = null;
|
|
4015
4050
|
this.api = api;
|
|
4016
4051
|
this.typeId = typeId;
|
|
4017
|
-
this.
|
|
4052
|
+
this.viaCdn = Boolean(viaCdn);
|
|
4053
|
+
this.batchSize = isNaN(batchSize) ? 300 : batchSize;
|
|
4018
4054
|
this.viewPort = viewPort;
|
|
4019
4055
|
this.attrFilter = attrFilter;
|
|
4020
4056
|
this.updateBounds();
|
|
@@ -4191,7 +4227,8 @@
|
|
|
4191
4227
|
bounds: curCell.GetBounds(),
|
|
4192
4228
|
sortOrder: exports.Api.ESortOrder.Asc,
|
|
4193
4229
|
entityTypeConditions: this.attrFilter
|
|
4194
|
-
}
|
|
4230
|
+
},
|
|
4231
|
+
viaCdn: this.viaCdn
|
|
4195
4232
|
});
|
|
4196
4233
|
const integrity = this.getIntegrityId();
|
|
4197
4234
|
if (loopIntegrity == integrity && entities) {
|