bruce-models 3.6.8 → 3.6.9

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.
@@ -71,6 +71,7 @@ var Api;
71
71
  ECacheKey["CustomForm"] = "customform";
72
72
  ECacheKey["ImportedFile"] = "importedfile";
73
73
  ECacheKey["Plugin"] = "plugin";
74
+ ECacheKey["PluginIndexFile"] = "pluginindexfile";
74
75
  })(ECacheKey = Api.ECacheKey || (Api.ECacheKey = {}));
75
76
  // 1 minute.
76
77
  Api.DEFAULT_CACHE_DURATION = 60 * 1000;
@@ -10536,33 +10537,6 @@ var Markup;
10536
10537
 
10537
10538
  var Plugin;
10538
10539
  (function (Plugin) {
10539
- /**
10540
- * Returns cache identifier for a plugin.
10541
- * Example: {
10542
- * const api: BruceApi.Api = ...;
10543
- * const key = GetCacheKey("abc");
10544
- * api.Cache.Remove(key);
10545
- * }
10546
- * @param pluginId
10547
- * @returns
10548
- */
10549
- function GetCacheKey(pluginId) {
10550
- return `${Api.ECacheKey.Plugin}${Api.ECacheKey.Id}${pluginId}`;
10551
- }
10552
- Plugin.GetCacheKey = GetCacheKey;
10553
- /**
10554
- * Returns cache identifier for a list of plugins.
10555
- * Example: {
10556
- * const api: BruceApi.Api = ...;
10557
- * const key = GetListCacheKey();
10558
- * api.Cache.Remove(key);
10559
- * }
10560
- * @returns
10561
- */
10562
- function GetListCacheKey() {
10563
- return Api.ECacheKey.Plugin;
10564
- }
10565
- Plugin.GetListCacheKey = GetListCacheKey;
10566
10540
  /**
10567
10541
  * Returns a plugin record.
10568
10542
  * @param params
@@ -10673,6 +10647,7 @@ var Plugin;
10673
10647
  yield api.POST(`ui.plugin/${plugin.ID}`, plugin, Api.PrepReqParams(req));
10674
10648
  api.Cache.Remove(GetCacheKey(plugin.ID));
10675
10649
  api.Cache.Remove(GetListCacheKey());
10650
+ api.Cache.RemoveByStartsWith(GetIndexFileCacheKey(plugin.ID, ""));
10676
10651
  });
10677
10652
  }
10678
10653
  Plugin.Update = Update;
@@ -10692,6 +10667,7 @@ var Plugin;
10692
10667
  yield api.DELETE(`ui.plugin/${pluginId}`, Api.PrepReqParams(req));
10693
10668
  api.Cache.Remove(GetCacheKey(pluginId));
10694
10669
  api.Cache.Remove(GetListCacheKey());
10670
+ api.Cache.RemoveByStartsWith(GetIndexFileCacheKey(pluginId, ""));
10695
10671
  });
10696
10672
  }
10697
10673
  Plugin.Delete = Delete;
@@ -10720,6 +10696,7 @@ var Plugin;
10720
10696
  yield api.UPLOAD(`ui.plugin/${pluginId}/file`, file, req);
10721
10697
  api.Cache.Remove(GetCacheKey(pluginId));
10722
10698
  api.Cache.Remove(GetListCacheKey());
10699
+ api.Cache.RemoveByStartsWith(GetIndexFileCacheKey(pluginId, ""));
10723
10700
  });
10724
10701
  }
10725
10702
  Plugin.Upload = Upload;
@@ -10731,7 +10708,7 @@ var Plugin;
10731
10708
  */
10732
10709
  function GetRunFunction(params) {
10733
10710
  return __awaiter(this, void 0, void 0, function* () {
10734
- let { containerId, container, pluginParams, pluginId, plugin, api } = params;
10711
+ let { containerId, container, pluginParams, pluginId, plugin, api, req } = params;
10735
10712
  if (!containerId && container) {
10736
10713
  containerId = container.id;
10737
10714
  if (!containerId) {
@@ -10753,7 +10730,21 @@ var Plugin;
10753
10730
  pluginId,
10754
10731
  cacheKey: plugin.Version
10755
10732
  });
10756
- let fileContent = yield fetch(indexFileUrl).then((res) => res.text());
10733
+ req = Api.PrepReqParams(req);
10734
+ const cacheData = api.GetCacheItem(GetIndexFileCacheKey(pluginId, indexFileUrl), req);
10735
+ let fileContentProm = null;
10736
+ if (cacheData === null || cacheData === void 0 ? void 0 : cacheData.found) {
10737
+ fileContentProm = cacheData.data;
10738
+ }
10739
+ else {
10740
+ fileContentProm = fetch(indexFileUrl).then((res) => res.text());
10741
+ api.SetCacheItem({
10742
+ key: GetIndexFileCacheKey(pluginId, indexFileUrl),
10743
+ value: fileContentProm,
10744
+ req: req
10745
+ });
10746
+ }
10747
+ let fileContent = yield fileContentProm;
10757
10748
  const start = fileContent.indexOf("{");
10758
10749
  const end = fileContent.lastIndexOf("}");
10759
10750
  fileContent = fileContent.substring(start + 1, end);
@@ -10819,6 +10810,43 @@ var Plugin;
10819
10810
  });
10820
10811
  }
10821
10812
  Plugin.GetRunFunction = GetRunFunction;
10813
+ /**
10814
+ * Returns cache identifier for a plugin.
10815
+ * Example: {
10816
+ * const api: BruceApi.Api = ...;
10817
+ * const key = GetCacheKey("abc");
10818
+ * api.Cache.Remove(key);
10819
+ * }
10820
+ * @param pluginId
10821
+ * @returns
10822
+ */
10823
+ function GetCacheKey(pluginId) {
10824
+ return `${Api.ECacheKey.Plugin}${Api.ECacheKey.Id}${pluginId}`;
10825
+ }
10826
+ Plugin.GetCacheKey = GetCacheKey;
10827
+ /**
10828
+ * Returns cache identifier for a list of plugins.
10829
+ * Example: {
10830
+ * const api: BruceApi.Api = ...;
10831
+ * const key = GetListCacheKey();
10832
+ * api.Cache.Remove(key);
10833
+ * }
10834
+ * @returns
10835
+ */
10836
+ function GetListCacheKey() {
10837
+ return Api.ECacheKey.Plugin;
10838
+ }
10839
+ Plugin.GetListCacheKey = GetListCacheKey;
10840
+ /**
10841
+ * Returns cache identifier for a plugin index file.
10842
+ * @param pluginId
10843
+ * @param indexFileUrl
10844
+ * @returns
10845
+ */
10846
+ function GetIndexFileCacheKey(pluginId, indexFileUrl) {
10847
+ return `${Api.ECacheKey.PluginIndexFile}${Api.ECacheKey.Id}${pluginId}${Api.ECacheKey.Id}${indexFileUrl}`;
10848
+ }
10849
+ Plugin.GetIndexFileCacheKey = GetIndexFileCacheKey;
10822
10850
  })(Plugin || (Plugin = {}));
10823
10851
 
10824
10852
  var DataSource;
@@ -10969,7 +10997,7 @@ var DataSource;
10969
10997
  })(DataSource || (DataSource = {}));
10970
10998
 
10971
10999
  // This is updated with the package.json version on build.
10972
- const VERSION = "3.6.8";
11000
+ const VERSION = "3.6.9";
10973
11001
 
10974
11002
  export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
10975
11003
  //# sourceMappingURL=bruce-models.es5.js.map