bruce-models 1.7.5 → 1.7.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.
- package/dist/bruce-models.es5.js +68 -33
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +68 -33
- 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/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/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -831,14 +831,14 @@ var Account;
|
|
|
831
831
|
Account.Create = Create;
|
|
832
832
|
function GetDbRegions(params) {
|
|
833
833
|
return __awaiter(this, void 0, void 0, function* () {
|
|
834
|
-
const { api, req: reqParams } = params;
|
|
834
|
+
const { api, req: reqParams, key } = params;
|
|
835
835
|
const cacheData = api.GetCacheItem(GetDbRegionListCacheKey(), reqParams);
|
|
836
836
|
if (cacheData) {
|
|
837
837
|
return cacheData;
|
|
838
838
|
}
|
|
839
839
|
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
840
840
|
try {
|
|
841
|
-
const data = yield api.GET(
|
|
841
|
+
const data = yield api.GET(`config/regions${key ? "?Key=" + key : ""}`, Api.PrepReqParams(reqParams));
|
|
842
842
|
res(data);
|
|
843
843
|
}
|
|
844
844
|
catch (e) {
|
|
@@ -1126,29 +1126,31 @@ var BruceApi;
|
|
|
1126
1126
|
throw ("Specified Environment is not valid. SuppliedEnv=" + env);
|
|
1127
1127
|
}
|
|
1128
1128
|
this.baseUrl = url;
|
|
1129
|
-
if (cam
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
if (
|
|
1145
|
-
endpoint
|
|
1129
|
+
if (cam) {
|
|
1130
|
+
if (loadRegionalUrl) {
|
|
1131
|
+
// Attempt to load an account specific base url.
|
|
1132
|
+
// This could be one with a region specific endpoint.
|
|
1133
|
+
try {
|
|
1134
|
+
const settings = (yield Account.GetAppSettings({
|
|
1135
|
+
api: cam,
|
|
1136
|
+
accountId: this.accountId,
|
|
1137
|
+
appId: Account.EAppId.BruceApi
|
|
1138
|
+
})).settings;
|
|
1139
|
+
if (this.loadCancelled) {
|
|
1140
|
+
console.warn("BruceApi: Loading was cancelled due to SetBaseUrl being called, not setting regional base url.");
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
let endpoint = (_a = settings.BruceAPIURL) === null || _a === void 0 ? void 0 : _a[env];
|
|
1144
|
+
if (typeof endpoint == "string") {
|
|
1145
|
+
if (!endpoint.endsWith("/")) {
|
|
1146
|
+
endpoint += "/";
|
|
1147
|
+
}
|
|
1148
|
+
this.baseUrl = endpoint;
|
|
1146
1149
|
}
|
|
1147
|
-
this.baseUrl = endpoint;
|
|
1148
1150
|
}
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1151
|
+
catch (e) {
|
|
1152
|
+
console.error(e);
|
|
1153
|
+
}
|
|
1152
1154
|
}
|
|
1153
1155
|
}
|
|
1154
1156
|
try {
|
|
@@ -1878,7 +1880,7 @@ var Entity;
|
|
|
1878
1880
|
Entity.CalculateName = CalculateName;
|
|
1879
1881
|
function GetList(params) {
|
|
1880
1882
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1881
|
-
const { api, filter, req: reqParams } = params;
|
|
1883
|
+
const { api, filter, req: reqParams, viaCdn, viaCdnCacheToken } = params;
|
|
1882
1884
|
let requestFilter = {};
|
|
1883
1885
|
if (filter.entityTypeConditions) {
|
|
1884
1886
|
requestFilter = Object.assign({}, filter.entityTypeConditions);
|
|
@@ -1907,17 +1909,50 @@ var Entity;
|
|
|
1907
1909
|
PageIndex: filter.pageIndex,
|
|
1908
1910
|
PageSize: filter.pageSize
|
|
1909
1911
|
};
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
const
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
}
|
|
1912
|
+
let entities = [];
|
|
1913
|
+
if (viaCdn && api.EntityCdnUrl) {
|
|
1914
|
+
const url = new URL(api.EntityCdnUrl);
|
|
1915
|
+
const urlParams = new URLSearchParams(url.search);
|
|
1916
|
+
urlParams.set("cacheToken", String(viaCdnCacheToken ? viaCdnCacheToken : 0));
|
|
1917
|
+
if (body.SortOrder) {
|
|
1918
|
+
urlParams.set("SortOrder", body.SortOrder);
|
|
1919
|
+
}
|
|
1920
|
+
if (body.OrderBy) {
|
|
1921
|
+
urlParams.set("OrderBy", body.OrderBy);
|
|
1922
|
+
}
|
|
1923
|
+
if (body.Filter) {
|
|
1924
|
+
urlParams.set("Filter", JSON.stringify(body.Filter));
|
|
1925
|
+
}
|
|
1926
|
+
if (body.LODType) {
|
|
1927
|
+
urlParams.set("LODType", body.LODType);
|
|
1928
|
+
}
|
|
1929
|
+
if (body.BruceEntityType) {
|
|
1930
|
+
urlParams.set("BruceEntityType", body.BruceEntityType);
|
|
1931
|
+
}
|
|
1932
|
+
if (body.PageIndex) {
|
|
1933
|
+
urlParams.set("PageIndex", String(body.PageIndex));
|
|
1934
|
+
}
|
|
1935
|
+
if (body.PageSize) {
|
|
1936
|
+
urlParams.set("PageSize", String(body.PageSize));
|
|
1937
|
+
}
|
|
1938
|
+
const urlStr = url.toString() + "?" + urlParams.toString();
|
|
1939
|
+
const data = yield api.get(urlStr, Api.PrepReqParams(reqParams));
|
|
1940
|
+
entities = data.Items;
|
|
1941
|
+
}
|
|
1942
|
+
else {
|
|
1943
|
+
const data = yield api.POST("entities", body, Api.PrepReqParams(reqParams));
|
|
1944
|
+
entities = data.Items;
|
|
1945
|
+
// Only caching when non-CDN.
|
|
1946
|
+
for (let i = 0; i < entities.length; i++) {
|
|
1947
|
+
const entity = entities[i];
|
|
1948
|
+
const id = entity.Bruce.ID;
|
|
1949
|
+
api.Cache.Set(GetCacheKey(id), {
|
|
1950
|
+
entity: entity
|
|
1951
|
+
}, Api.DEFAULT_CACHE_DURATION);
|
|
1952
|
+
}
|
|
1918
1953
|
}
|
|
1919
1954
|
return {
|
|
1920
|
-
entities
|
|
1955
|
+
entities
|
|
1921
1956
|
};
|
|
1922
1957
|
});
|
|
1923
1958
|
}
|