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.
@@ -11351,6 +11351,67 @@
11351
11351
  };
11352
11352
  }
11353
11353
  Plugin.GetLoadUrl = GetLoadUrl;
11354
+ function Update(params) {
11355
+ return __awaiter(this, void 0, void 0, function* () {
11356
+ let { plugin, api, req } = params;
11357
+ if (!api) {
11358
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
11359
+ }
11360
+ if (!plugin.Name || !plugin.ID) {
11361
+ throw ("Plugin name and ID are required.");
11362
+ }
11363
+ if (!plugin.ID) {
11364
+ plugin.ID = exports.ObjectUtils.UId();
11365
+ }
11366
+ yield api.POST(`ui.plugin/${plugin.ID}`, plugin, exports.Api.PrepReqParams(req));
11367
+ api.Cache.Remove(GetCacheKey(plugin.ID));
11368
+ api.Cache.Remove(GetListCacheKey());
11369
+ });
11370
+ }
11371
+ Plugin.Update = Update;
11372
+ function Delete(params) {
11373
+ return __awaiter(this, void 0, void 0, function* () {
11374
+ let { pluginId, api, req } = params;
11375
+ if (!api) {
11376
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
11377
+ }
11378
+ if (!pluginId) {
11379
+ throw ("Plugin ID is required.");
11380
+ }
11381
+ yield api.DELETE(`ui.plugin/${pluginId}`, exports.Api.PrepReqParams(req));
11382
+ api.Cache.Remove(GetCacheKey(pluginId));
11383
+ api.Cache.Remove(GetListCacheKey());
11384
+ });
11385
+ }
11386
+ Plugin.Delete = Delete;
11387
+ /**
11388
+ * Warning: This will replace the contents of your plugin.
11389
+ * Upload only ZIP files.
11390
+ * @param params
11391
+ */
11392
+ function Upload(params) {
11393
+ return __awaiter(this, void 0, void 0, function* () {
11394
+ let { pluginId, api, file, onProgress, req } = params;
11395
+ if (!api) {
11396
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
11397
+ }
11398
+ if (!pluginId || !file) {
11399
+ throw ("Plugin ID and file are required.");
11400
+ }
11401
+ req = exports.Api.PrepReqParams(req);
11402
+ req.onProgress = (progress) => {
11403
+ const percent = Math.round((progress.loaded / file.size) * 100);
11404
+ onProgress === null || onProgress === void 0 ? void 0 : onProgress({
11405
+ percent: percent,
11406
+ uploaded: false
11407
+ });
11408
+ };
11409
+ yield api.UPLOAD(`ui.plugin/${pluginId}/file`, file, req);
11410
+ api.Cache.Remove(GetCacheKey(pluginId));
11411
+ api.Cache.Remove(GetListCacheKey());
11412
+ });
11413
+ }
11414
+ Plugin.Upload = Upload;
11354
11415
  /**
11355
11416
  * Returns a run function to call that'll load a plugin within your provided container element.
11356
11417
  * The run function will return a dispose function to call to remove the plugin.
@@ -11390,7 +11451,7 @@
11390
11451
  ${fileContent}
11391
11452
 
11392
11453
  const paramsId = "${paramsId}";
11393
- const containerId = "${container.id}";
11454
+ const containerId = "${container ? container.id : ""}";
11394
11455
  let container;
11395
11456
  if (containerId) {
11396
11457
  container = document.getElementById("${container.id}");
@@ -11399,7 +11460,7 @@
11399
11460
  const params = window["${paramsId}"];
11400
11461
 
11401
11462
  window["${disposeId}"] = Run({
11402
- container,
11463
+ container: container,
11403
11464
  pluginParams: params
11404
11465
  });
11405
11466
  }