bruce-models 1.2.1 → 1.2.2
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 +31 -1
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +31 -1
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/entity/entity-lod.js +31 -1
- package/dist/lib/entity/entity-lod.js.map +1 -1
- package/dist/types/entity/entity-lod.d.ts +2 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -2706,6 +2706,10 @@
|
|
|
2706
2706
|
return exports.Api.ECacheKey.Lod + exports.Api.ECacheKey.EntityType + typeId + exports.Api.ECacheKey.Id + group;
|
|
2707
2707
|
}
|
|
2708
2708
|
EntityLod.GetTypeListKey = GetTypeListKey;
|
|
2709
|
+
function GetEntityListKey(entityId) {
|
|
2710
|
+
return exports.Api.ECacheKey.Lod + exports.Api.ECacheKey.Entity + entityId;
|
|
2711
|
+
}
|
|
2712
|
+
EntityLod.GetEntityListKey = GetEntityListKey;
|
|
2709
2713
|
function GetUrl(api, entityId, categoryId, level, strict) {
|
|
2710
2714
|
if (!entityId) {
|
|
2711
2715
|
throw ("Entity ID is required.");
|
|
@@ -2757,6 +2761,30 @@
|
|
|
2757
2761
|
});
|
|
2758
2762
|
}
|
|
2759
2763
|
EntityLod.GetLods = GetLods;
|
|
2764
|
+
function GetEntityLods(api, entityId, reqParams) {
|
|
2765
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2766
|
+
if (!entityId) {
|
|
2767
|
+
throw ("Entity id is required.");
|
|
2768
|
+
}
|
|
2769
|
+
const cacheData = api.GetCacheItem(GetEntityListKey(entityId), reqParams);
|
|
2770
|
+
if (cacheData) {
|
|
2771
|
+
return cacheData;
|
|
2772
|
+
}
|
|
2773
|
+
const req = api.GET(`entity/${entityId}/lods?includeClientFiles=yes`);
|
|
2774
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
2775
|
+
try {
|
|
2776
|
+
const data = yield req;
|
|
2777
|
+
res(data.Items);
|
|
2778
|
+
}
|
|
2779
|
+
catch (e) {
|
|
2780
|
+
rej(e);
|
|
2781
|
+
}
|
|
2782
|
+
}));
|
|
2783
|
+
api.Cache.Set(GetEntityListKey(entityId), prom, exports.Api.DEFAULT_CACHE_DURATION);
|
|
2784
|
+
return prom;
|
|
2785
|
+
});
|
|
2786
|
+
}
|
|
2787
|
+
EntityLod.GetEntityLods = GetEntityLods;
|
|
2760
2788
|
/**
|
|
2761
2789
|
* Returns lods for a specified entity type.
|
|
2762
2790
|
* @param api
|
|
@@ -2794,10 +2822,12 @@
|
|
|
2794
2822
|
if (!params["ClientFile.ID"] || !params["LODCategory.Key"] || (!params.Level && params.Level !== 0)) {
|
|
2795
2823
|
throw ("ClientFile.ID, LODCategory.Key and Level are required.");
|
|
2796
2824
|
}
|
|
2797
|
-
|
|
2825
|
+
const res = yield api.POST(`entity/${entityId}/lod/${params["LODCategory.Key"]}/${params.Level}`, {
|
|
2798
2826
|
"Level": 0,
|
|
2799
2827
|
"ClientFile.ID": params["ClientFile.ID"]
|
|
2800
2828
|
}, exports.Api.PrepReqParams(reqParams));
|
|
2829
|
+
api.Cache.Remove(GetEntityListKey(entityId));
|
|
2830
|
+
return res;
|
|
2801
2831
|
});
|
|
2802
2832
|
}
|
|
2803
2833
|
EntityLod.Update = Update;
|