bruce-models 2.5.3 → 2.5.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 +61 -0
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +61 -0
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/plugin/plugin.js +61 -0
- package/dist/lib/plugin/plugin.js.map +1 -1
- package/dist/types/plugin/plugin.d.ts +23 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -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.
|