bruce-models 4.3.2 → 4.3.4
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 +28 -24
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +28 -24
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/entity/entity-type.js +16 -7
- package/dist/lib/entity/entity-type.js.map +1 -1
- package/dist/lib/util/path-utils.js +11 -16
- package/dist/lib/util/path-utils.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/entity/entity-type.d.ts +3 -1
- package/dist/types/util/path-utils.d.ts +2 -1
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -2791,7 +2791,7 @@
|
|
|
2791
2791
|
}
|
|
2792
2792
|
yield api.DELETE(`entitytype/${typeId}`, exports.Api.PrepReqParams(reqParams));
|
|
2793
2793
|
api.Cache.Remove(GetCacheKey(typeId));
|
|
2794
|
-
api.Cache.
|
|
2794
|
+
api.Cache.RemoveByStartsWith(GetListCacheKey());
|
|
2795
2795
|
});
|
|
2796
2796
|
}
|
|
2797
2797
|
EntityType.Delete = Delete;
|
|
@@ -2802,11 +2802,11 @@
|
|
|
2802
2802
|
*/
|
|
2803
2803
|
function GetList(params) {
|
|
2804
2804
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2805
|
-
let { api, req: reqParams, parentTypeId } = params;
|
|
2805
|
+
let { entityTypeIds, api, req: reqParams, parentTypeId } = params;
|
|
2806
2806
|
if (!api) {
|
|
2807
2807
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
2808
2808
|
}
|
|
2809
|
-
const cache = parentTypeId ? null : yield api.GetCacheItem(GetListCacheKey(), reqParams);
|
|
2809
|
+
const cache = parentTypeId ? null : yield api.GetCacheItem(GetListCacheKey(entityTypeIds), reqParams);
|
|
2810
2810
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
2811
2811
|
return cache.data;
|
|
2812
2812
|
}
|
|
@@ -2816,6 +2816,11 @@
|
|
|
2816
2816
|
if (parentTypeId) {
|
|
2817
2817
|
urlParams.append("parentEntityTypeID", parentTypeId);
|
|
2818
2818
|
}
|
|
2819
|
+
if (entityTypeIds) {
|
|
2820
|
+
for (const id of entityTypeIds) {
|
|
2821
|
+
urlParams.append("typeId", id);
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2819
2824
|
const data = yield api.GET("entitytypes?" + urlParams.toString(), exports.Api.PrepReqParams(reqParams));
|
|
2820
2825
|
res({
|
|
2821
2826
|
entityTypes: data.Items
|
|
@@ -2827,7 +2832,7 @@
|
|
|
2827
2832
|
}));
|
|
2828
2833
|
if (!parentTypeId) {
|
|
2829
2834
|
yield api.SetCacheItem({
|
|
2830
|
-
key: GetListCacheKey(),
|
|
2835
|
+
key: GetListCacheKey(entityTypeIds),
|
|
2831
2836
|
value: req,
|
|
2832
2837
|
req: reqParams,
|
|
2833
2838
|
duration: 60 * 5 // 5 minutes.
|
|
@@ -2859,7 +2864,7 @@
|
|
|
2859
2864
|
}
|
|
2860
2865
|
const res = yield api.POST(`entitytype/${data.ID}`, data, exports.Api.PrepReqParams(reqParams));
|
|
2861
2866
|
api.Cache.Remove(GetCacheKey(data.ID));
|
|
2862
|
-
api.Cache.
|
|
2867
|
+
api.Cache.RemoveByStartsWith(GetListCacheKey());
|
|
2863
2868
|
return {
|
|
2864
2869
|
entityType: res
|
|
2865
2870
|
};
|
|
@@ -2934,10 +2939,14 @@
|
|
|
2934
2939
|
* const key = GetListCacheKey();
|
|
2935
2940
|
* api.Cache.Remove(key);
|
|
2936
2941
|
* }
|
|
2942
|
+
* @param typeIds
|
|
2937
2943
|
* @returns
|
|
2938
2944
|
*/
|
|
2939
|
-
function GetListCacheKey() {
|
|
2940
|
-
|
|
2945
|
+
function GetListCacheKey(typeIds) {
|
|
2946
|
+
if (!typeIds) {
|
|
2947
|
+
typeIds = [];
|
|
2948
|
+
}
|
|
2949
|
+
return exports.Api.ECacheKey.EntityType + (typeIds.length ? exports.Api.ECacheKey.Id : "") + typeIds.join(",");
|
|
2941
2950
|
}
|
|
2942
2951
|
EntityType.GetListCacheKey = GetListCacheKey;
|
|
2943
2952
|
})(exports.EntityType || (exports.EntityType = {}));
|
|
@@ -2947,7 +2956,8 @@
|
|
|
2947
2956
|
*/
|
|
2948
2957
|
(function (PathUtils) {
|
|
2949
2958
|
/**
|
|
2950
|
-
* Parses a string path into an array of strings.
|
|
2959
|
+
* Parses a Bruce string path into an array of strings.
|
|
2960
|
+
* Example of path: "\"location\"/\"latitude\"" or "location/latitude".
|
|
2951
2961
|
* @param str
|
|
2952
2962
|
* @returns
|
|
2953
2963
|
*/
|
|
@@ -2955,23 +2965,17 @@
|
|
|
2955
2965
|
if (!(str === null || str === void 0 ? void 0 : str.length)) {
|
|
2956
2966
|
return [];
|
|
2957
2967
|
}
|
|
2958
|
-
const broken = str.split("
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
}
|
|
2965
|
-
broken[0] = top;
|
|
2968
|
+
const broken = str.split("/");
|
|
2969
|
+
// Remove quotes from the first and last chars.
|
|
2970
|
+
for (let i = 0; i < broken.length; i++) {
|
|
2971
|
+
let piece = broken[i];
|
|
2972
|
+
if (piece.startsWith("\"")) {
|
|
2973
|
+
piece = piece.substring(1);
|
|
2966
2974
|
}
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
if (bot.length > 0) {
|
|
2970
|
-
if (bot.charAt(bot.length - 1) == "\"") {
|
|
2971
|
-
bot = bot.substring(0, bot.length - 1);
|
|
2972
|
-
}
|
|
2973
|
-
broken[endIndex] = bot;
|
|
2975
|
+
if (piece.endsWith("\"")) {
|
|
2976
|
+
piece = piece.substring(0, piece.length - 1);
|
|
2974
2977
|
}
|
|
2978
|
+
broken[i] = piece;
|
|
2975
2979
|
}
|
|
2976
2980
|
return broken;
|
|
2977
2981
|
}
|
|
@@ -13075,7 +13079,7 @@
|
|
|
13075
13079
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
13076
13080
|
|
|
13077
13081
|
// This is updated with the package.json version on build.
|
|
13078
|
-
const VERSION = "4.3.
|
|
13082
|
+
const VERSION = "4.3.4";
|
|
13079
13083
|
|
|
13080
13084
|
exports.VERSION = VERSION;
|
|
13081
13085
|
exports.AbstractApi = AbstractApi;
|