bruce-models 6.2.0 → 6.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.
@@ -2705,21 +2705,26 @@
2705
2705
  */
2706
2706
  function Get(params) {
2707
2707
  return __awaiter(this, void 0, void 0, function* () {
2708
- let { api, entityTypeId: typeId, req: reqParams } = params;
2708
+ let { api, entityTypeId: typeId, req: reqParams, expandLODs } = params;
2709
2709
  if (!typeId) {
2710
2710
  throw ("Type ID is required.");
2711
2711
  }
2712
2712
  if (!api) {
2713
2713
  api = exports.ENVIRONMENT.Api().GetBruceApi();
2714
2714
  }
2715
- const key = GetCacheKey(typeId);
2715
+ const key = GetCacheKey(typeId, expandLODs);
2716
2716
  const cache = api.GetCacheItem(key, reqParams);
2717
2717
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
2718
2718
  return cache.data;
2719
2719
  }
2720
2720
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
2721
2721
  try {
2722
- const data = yield api.GET(`entitytype/${typeId}`, exports.Api.PrepReqParams(reqParams));
2722
+ const urlParams = new URLSearchParams();
2723
+ if (expandLODs) {
2724
+ urlParams.append("Expand", "LOD");
2725
+ }
2726
+ const url = `entitytype/${typeId}?${urlParams.toString()}`;
2727
+ const data = yield api.GET(url, exports.Api.PrepReqParams(reqParams));
2723
2728
  appendInternalAttrSchema(data);
2724
2729
  res({
2725
2730
  entityType: data
@@ -2752,7 +2757,7 @@
2752
2757
  api = exports.ENVIRONMENT.Api().GetBruceApi();
2753
2758
  }
2754
2759
  yield api.DELETE(`entitytype/${typeId}`, exports.Api.PrepReqParams(reqParams));
2755
- api.Cache.Remove(GetCacheKey(typeId));
2760
+ api.Cache.RemoveByStartsWith(GetCacheKey(typeId));
2756
2761
  api.Cache.RemoveByStartsWith(GetListCacheKey());
2757
2762
  });
2758
2763
  }
@@ -2764,13 +2769,14 @@
2764
2769
  */
2765
2770
  function GetList(params) {
2766
2771
  return __awaiter(this, void 0, void 0, function* () {
2767
- let { entityTypeIds, api, req: reqParams, parentTypeId, expandSettings, search } = params;
2772
+ let { entityTypeIds, api, req: reqParams, parentTypeId, expandSettings, search, expandLODs } = params;
2768
2773
  if (!api) {
2769
2774
  api = exports.ENVIRONMENT.Api().GetBruceApi();
2770
2775
  }
2771
2776
  const cache = api.GetCacheItem(GetListCacheKey({
2772
2777
  typeIds: entityTypeIds,
2773
2778
  parentTypeId,
2779
+ expandLODs,
2774
2780
  expandSettings,
2775
2781
  search
2776
2782
  }), reqParams);
@@ -2787,16 +2793,22 @@
2787
2793
  const batch = entityTypeIds.slice(i, i + BATCH_SIZE);
2788
2794
  const urlParams = new URLSearchParams();
2789
2795
  for (const id of batch) {
2790
- urlParams.append("typeId", id);
2796
+ urlParams.append("ID", id);
2791
2797
  }
2792
2798
  if (parentTypeId) {
2793
- urlParams.append("parentEntityTypeID", parentTypeId);
2799
+ urlParams.append("ParentTypeID", parentTypeId);
2800
+ }
2801
+ if (expandSettings && expandLODs) {
2802
+ urlParams.append("Expand", "true");
2794
2803
  }
2795
- if (expandSettings) {
2796
- urlParams.append("expandSettings", "true");
2804
+ else if (expandSettings) {
2805
+ urlParams.append("Expand", "Schema");
2806
+ }
2807
+ else if (expandLODs) {
2808
+ urlParams.append("Expand", "LOD");
2797
2809
  }
2798
2810
  if (search) {
2799
- urlParams.append("search", search);
2811
+ urlParams.append("Search", search);
2800
2812
  }
2801
2813
  reqs.push(api.GET("entitytypes?" + urlParams.toString(), exports.Api.PrepReqParams(reqParams)));
2802
2814
  }
@@ -2804,13 +2816,19 @@
2804
2816
  else {
2805
2817
  const urlParams = new URLSearchParams();
2806
2818
  if (parentTypeId) {
2807
- urlParams.append("parentEntityTypeID", parentTypeId);
2819
+ urlParams.append("ParentTypeID", parentTypeId);
2820
+ }
2821
+ if (expandSettings && expandLODs) {
2822
+ urlParams.append("Expand", "true");
2823
+ }
2824
+ else if (expandSettings) {
2825
+ urlParams.append("Expand", "Schema");
2808
2826
  }
2809
- if (expandSettings) {
2810
- urlParams.append("expandSettings", "true");
2827
+ else if (expandLODs) {
2828
+ urlParams.append("Expand", "LOD");
2811
2829
  }
2812
2830
  if (search) {
2813
- urlParams.append("search", search);
2831
+ urlParams.append("Search", search);
2814
2832
  }
2815
2833
  reqs.push(api.GET("entitytypes?" + urlParams.toString(), exports.Api.PrepReqParams(reqParams)));
2816
2834
  }
@@ -2839,6 +2857,7 @@
2839
2857
  typeIds: entityTypeIds,
2840
2858
  parentTypeId,
2841
2859
  expandSettings,
2860
+ expandLODs,
2842
2861
  search
2843
2862
  }),
2844
2863
  value: req,
@@ -2872,7 +2891,7 @@
2872
2891
  }
2873
2892
  appendInternalAttrSchema(data);
2874
2893
  const res = yield api.POST(`entitytype/${data.ID}`, data, exports.Api.PrepReqParams(reqParams));
2875
- api.Cache.Remove(GetCacheKey(data.ID));
2894
+ api.Cache.RemoveByStartsWith(GetCacheKey(data.ID));
2876
2895
  api.Cache.RemoveByStartsWith(GetListCacheKey());
2877
2896
  return {
2878
2897
  entityType: res
@@ -2938,10 +2957,15 @@
2938
2957
  * api.Cache.Remove(key);
2939
2958
  * }
2940
2959
  * @param typeId
2960
+ * @param expandLODs
2941
2961
  * @returns
2942
2962
  */
2943
- function GetCacheKey(typeId) {
2944
- return `${exports.Api.ECacheKey.EntityType}${exports.Api.ECacheKey.Id}${typeId}`;
2963
+ function GetCacheKey(typeId, expandLODs) {
2964
+ let key = `${exports.Api.ECacheKey.EntityType}${exports.Api.ECacheKey.Id}${typeId}`;
2965
+ if (expandLODs) {
2966
+ key += "_LOD_" + expandLODs;
2967
+ }
2968
+ return key;
2945
2969
  }
2946
2970
  EntityType.GetCacheKey = GetCacheKey;
2947
2971
  /**
@@ -2958,7 +2982,7 @@
2958
2982
  if (!params) {
2959
2983
  params = {};
2960
2984
  }
2961
- let { typeIds, expandSettings, parentTypeId, search } = params;
2985
+ let { typeIds, expandSettings, parentTypeId, expandLODs, search } = params;
2962
2986
  let key = exports.Api.ECacheKey.EntityType;
2963
2987
  if (!typeIds) {
2964
2988
  typeIds = [];
@@ -2970,7 +2994,14 @@
2970
2994
  if (!expandSettings) {
2971
2995
  expandSettings = false;
2972
2996
  }
2973
- key += "_EXPAND_" + expandSettings;
2997
+ if (!expandLODs) {
2998
+ expandLODs = false;
2999
+ }
3000
+ key += "_SCHEMA_" + expandSettings;
3001
+ key += "_LOD_" + expandLODs;
3002
+ if (search) {
3003
+ key += "_SEARCH_" + search;
3004
+ }
2974
3005
  return key;
2975
3006
  }
2976
3007
  EntityType.GetListCacheKey = GetListCacheKey;
@@ -15593,7 +15624,7 @@
15593
15624
  })(exports.Tracking || (exports.Tracking = {}));
15594
15625
 
15595
15626
  // This is updated with the package.json version on build.
15596
- const VERSION = "6.2.0";
15627
+ const VERSION = "6.2.2";
15597
15628
 
15598
15629
  exports.VERSION = VERSION;
15599
15630
  exports.AbstractApi = AbstractApi;