bruce-models 2.5.3 → 2.5.5

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.
@@ -11585,6 +11585,67 @@ var Plugin;
11585
11585
  };
11586
11586
  }
11587
11587
  Plugin.GetLoadUrl = GetLoadUrl;
11588
+ function Update(params) {
11589
+ return __awaiter(this, void 0, void 0, function* () {
11590
+ let { plugin, api, req } = params;
11591
+ if (!api) {
11592
+ api = ENVIRONMENT.Api().GetBruceApi();
11593
+ }
11594
+ if (!plugin.Name || !plugin.ID) {
11595
+ throw ("Plugin name and ID are required.");
11596
+ }
11597
+ if (!plugin.ID) {
11598
+ plugin.ID = ObjectUtils.UId();
11599
+ }
11600
+ yield api.POST(`ui.plugin/${plugin.ID}`, plugin, Api.PrepReqParams(req));
11601
+ api.Cache.Remove(GetCacheKey(plugin.ID));
11602
+ api.Cache.Remove(GetListCacheKey());
11603
+ });
11604
+ }
11605
+ Plugin.Update = Update;
11606
+ function Delete(params) {
11607
+ return __awaiter(this, void 0, void 0, function* () {
11608
+ let { pluginId, api, req } = params;
11609
+ if (!api) {
11610
+ api = ENVIRONMENT.Api().GetBruceApi();
11611
+ }
11612
+ if (!pluginId) {
11613
+ throw ("Plugin ID is required.");
11614
+ }
11615
+ yield api.DELETE(`ui.plugin/${pluginId}`, Api.PrepReqParams(req));
11616
+ api.Cache.Remove(GetCacheKey(pluginId));
11617
+ api.Cache.Remove(GetListCacheKey());
11618
+ });
11619
+ }
11620
+ Plugin.Delete = Delete;
11621
+ /**
11622
+ * Warning: This will replace the contents of your plugin.
11623
+ * Upload only ZIP files.
11624
+ * @param params
11625
+ */
11626
+ function Upload(params) {
11627
+ return __awaiter(this, void 0, void 0, function* () {
11628
+ let { pluginId, api, file, onProgress, req } = params;
11629
+ if (!api) {
11630
+ api = ENVIRONMENT.Api().GetBruceApi();
11631
+ }
11632
+ if (!pluginId || !file) {
11633
+ throw ("Plugin ID and file are required.");
11634
+ }
11635
+ req = Api.PrepReqParams(req);
11636
+ req.onProgress = (progress) => {
11637
+ const percent = Math.round((progress.loaded / file.size) * 100);
11638
+ onProgress === null || onProgress === void 0 ? void 0 : onProgress({
11639
+ percent: percent,
11640
+ uploaded: false
11641
+ });
11642
+ };
11643
+ yield api.UPLOAD(`ui.plugin/${pluginId}/file`, file, req);
11644
+ api.Cache.Remove(GetCacheKey(pluginId));
11645
+ api.Cache.Remove(GetListCacheKey());
11646
+ });
11647
+ }
11648
+ Plugin.Upload = Upload;
11588
11649
  /**
11589
11650
  * Returns a run function to call that'll load a plugin within your provided container element.
11590
11651
  * The run function will return a dispose function to call to remove the plugin.
@@ -11624,7 +11685,7 @@ var Plugin;
11624
11685
  ${fileContent}
11625
11686
 
11626
11687
  const paramsId = "${paramsId}";
11627
- const containerId = "${container.id}";
11688
+ const containerId = "${container ? container.id : ""}";
11628
11689
  let container;
11629
11690
  if (containerId) {
11630
11691
  container = document.getElementById("${container.id}");
@@ -11633,7 +11694,7 @@ var Plugin;
11633
11694
  const params = window["${paramsId}"];
11634
11695
 
11635
11696
  window["${disposeId}"] = Run({
11636
- container,
11697
+ container: container,
11637
11698
  pluginParams: params
11638
11699
  });
11639
11700
  }