bruce-models 7.1.98 → 7.1.100
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 +420 -8
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +415 -7
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/abstract-api.js +1 -1
- package/dist/lib/api/abstract-api.js.map +1 -1
- package/dist/lib/api/api.js +1 -0
- package/dist/lib/api/api.js.map +1 -1
- package/dist/lib/bruce-models.js +2 -1
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/export/export-nsx.js +89 -2
- package/dist/lib/export/export-nsx.js.map +1 -1
- package/dist/lib/server/pending-action.js +17 -3
- package/dist/lib/server/pending-action.js.map +1 -1
- package/dist/lib/workflow/workflow-type.js +324 -0
- package/dist/lib/workflow/workflow-type.js.map +1 -0
- package/dist/types/api/api.d.ts +2 -1
- package/dist/types/bruce-models.d.ts +2 -1
- package/dist/types/export/export-nsx.d.ts +88 -0
- package/dist/types/server/pending-action.d.ts +14 -6
- package/dist/types/workflow/workflow-type.d.ts +158 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
ECacheKey["EntityHistoricDataAnalysis"] = "entityhistoricdataanalysis";
|
|
96
96
|
ECacheKey["EntityHistoricDataPage"] = "entityhistoricdatapage";
|
|
97
97
|
ECacheKey["AccountLimits"] = "accountlimits";
|
|
98
|
+
ECacheKey["WorkflowType"] = "workflowtype";
|
|
98
99
|
})(ECacheKey = Api.ECacheKey || (Api.ECacheKey = {}));
|
|
99
100
|
// 1 minute.
|
|
100
101
|
Api.DEFAULT_CACHE_DURATION = 60 * 1000;
|
|
@@ -1041,7 +1042,7 @@
|
|
|
1041
1042
|
else if (encoding === "iso-8859-1") {
|
|
1042
1043
|
encoding = "utf-8";
|
|
1043
1044
|
}
|
|
1044
|
-
if (type == "application/octet-stream" || type == "model/gltf-binary") {
|
|
1045
|
+
if (type == "application/octet-stream" || type == "model/gltf-binary" || type == "application/nsx") {
|
|
1045
1046
|
if (encoding !== "utf-8") {
|
|
1046
1047
|
console.warn("Binary data is being returned with an unexpected encoding:", encoding);
|
|
1047
1048
|
}
|
|
@@ -17349,14 +17350,101 @@
|
|
|
17349
17350
|
*/
|
|
17350
17351
|
function AccountBackup(params) {
|
|
17351
17352
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17352
|
-
let { api, req: reqParams } = params !== null && params !== void 0 ? params : {};
|
|
17353
|
+
let { api, backup, req: reqParams } = params !== null && params !== void 0 ? params : {};
|
|
17353
17354
|
if (!api) {
|
|
17354
17355
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
17355
17356
|
}
|
|
17356
|
-
return api.POST("export/nsx/accountBackup", {}, exports.Api.PrepReqParams(reqParams));
|
|
17357
|
+
return api.POST("export/nsx/accountBackup", backup !== null && backup !== void 0 ? backup : {}, exports.Api.PrepReqParams(reqParams));
|
|
17357
17358
|
});
|
|
17358
17359
|
}
|
|
17359
17360
|
ExportNsx.AccountBackup = AccountBackup;
|
|
17361
|
+
/**
|
|
17362
|
+
* Returns available account backup files, including whole-account NSX backups.
|
|
17363
|
+
*/
|
|
17364
|
+
function GetAccountBackupList(params) {
|
|
17365
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17366
|
+
let { api, req: reqParams } = params !== null && params !== void 0 ? params : {};
|
|
17367
|
+
if (!api) {
|
|
17368
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
17369
|
+
}
|
|
17370
|
+
return api.GET("account/restoreList", exports.Api.PrepReqParams(reqParams));
|
|
17371
|
+
});
|
|
17372
|
+
}
|
|
17373
|
+
ExportNsx.GetAccountBackupList = GetAccountBackupList;
|
|
17374
|
+
/**
|
|
17375
|
+
* Downloads a saved whole-account NSX backup file.
|
|
17376
|
+
*/
|
|
17377
|
+
function DownloadAccountBackup(params) {
|
|
17378
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17379
|
+
let { api, fileName, req: reqParams } = params;
|
|
17380
|
+
if (!fileName) {
|
|
17381
|
+
throw ("fileName is required.");
|
|
17382
|
+
}
|
|
17383
|
+
if (!api) {
|
|
17384
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
17385
|
+
}
|
|
17386
|
+
return api.GET(`account/backup/nsx/${encodeURIComponent(fileName)}`, exports.Api.PrepReqParams(reqParams));
|
|
17387
|
+
});
|
|
17388
|
+
}
|
|
17389
|
+
ExportNsx.DownloadAccountBackup = DownloadAccountBackup;
|
|
17390
|
+
/**
|
|
17391
|
+
* Deletes a saved whole-account NSX backup file.
|
|
17392
|
+
*/
|
|
17393
|
+
function DeleteAccountBackup(params) {
|
|
17394
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17395
|
+
let { api, fileName, req: reqParams } = params;
|
|
17396
|
+
if (!fileName) {
|
|
17397
|
+
throw ("fileName is required.");
|
|
17398
|
+
}
|
|
17399
|
+
if (!api) {
|
|
17400
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
17401
|
+
}
|
|
17402
|
+
return api.DELETE(`account/backup/nsx/${encodeURIComponent(fileName)}`, exports.Api.PrepReqParams(reqParams));
|
|
17403
|
+
});
|
|
17404
|
+
}
|
|
17405
|
+
ExportNsx.DeleteAccountBackup = DeleteAccountBackup;
|
|
17406
|
+
/**
|
|
17407
|
+
* Parses the completed Pending Action result from running AccountBackup.
|
|
17408
|
+
*/
|
|
17409
|
+
function ParseAccountBackupResult(paResult) {
|
|
17410
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
17411
|
+
const parsed = parseObject(paResult);
|
|
17412
|
+
if (!parsed) {
|
|
17413
|
+
return {
|
|
17414
|
+
raw: null
|
|
17415
|
+
};
|
|
17416
|
+
}
|
|
17417
|
+
const resultSource = (parsed === null || parsed === void 0 ? void 0 : parsed.Result) != null ? parsed.Result : parsed;
|
|
17418
|
+
const rawResult = (_a = parseObject(resultSource)) !== null && _a !== void 0 ? _a : (typeof resultSource == "object" ? resultSource : null);
|
|
17419
|
+
const report = rawResult === null || rawResult === void 0 ? void 0 : rawResult.Report;
|
|
17420
|
+
return {
|
|
17421
|
+
accountId: (_b = rawResult === null || rawResult === void 0 ? void 0 : rawResult["Account.ID"]) !== null && _b !== void 0 ? _b : report === null || report === void 0 ? void 0 : report["Account.ID"],
|
|
17422
|
+
createdUtc: (_c = rawResult === null || rawResult === void 0 ? void 0 : rawResult["Created.UTC"]) !== null && _c !== void 0 ? _c : report === null || report === void 0 ? void 0 : report["Created.UTC"],
|
|
17423
|
+
fileName: (_d = rawResult === null || rawResult === void 0 ? void 0 : rawResult.FileName) !== null && _d !== void 0 ? _d : report === null || report === void 0 ? void 0 : report.FileName,
|
|
17424
|
+
storePath: (_e = rawResult === null || rawResult === void 0 ? void 0 : rawResult.StorePath) !== null && _e !== void 0 ? _e : report === null || report === void 0 ? void 0 : report.StorePath,
|
|
17425
|
+
sizeBytes: (_f = rawResult === null || rawResult === void 0 ? void 0 : rawResult["Size.Bytes"]) !== null && _f !== void 0 ? _f : report === null || report === void 0 ? void 0 : report["Size.Bytes"],
|
|
17426
|
+
downloadUrl: (_g = rawResult === null || rawResult === void 0 ? void 0 : rawResult["Download.URL"]) !== null && _g !== void 0 ? _g : report === null || report === void 0 ? void 0 : report["Download.URL"],
|
|
17427
|
+
message: (_h = rawResult === null || rawResult === void 0 ? void 0 : rawResult.Message) !== null && _h !== void 0 ? _h : report === null || report === void 0 ? void 0 : report.Message,
|
|
17428
|
+
report: report,
|
|
17429
|
+
stats: rawResult === null || rawResult === void 0 ? void 0 : rawResult.Stats,
|
|
17430
|
+
raw: rawResult
|
|
17431
|
+
};
|
|
17432
|
+
}
|
|
17433
|
+
ExportNsx.ParseAccountBackupResult = ParseAccountBackupResult;
|
|
17434
|
+
function parseObject(data) {
|
|
17435
|
+
if (data == null || data == undefined) {
|
|
17436
|
+
return null;
|
|
17437
|
+
}
|
|
17438
|
+
if (typeof data == "string") {
|
|
17439
|
+
try {
|
|
17440
|
+
return JSON.parse(data);
|
|
17441
|
+
}
|
|
17442
|
+
catch (_a) {
|
|
17443
|
+
return null;
|
|
17444
|
+
}
|
|
17445
|
+
}
|
|
17446
|
+
return data;
|
|
17447
|
+
}
|
|
17360
17448
|
})(exports.ExportNsx || (exports.ExportNsx = {}));
|
|
17361
17449
|
|
|
17362
17450
|
(function (ExportUsd) {
|
|
@@ -21577,6 +21665,13 @@
|
|
|
21577
21665
|
EStatus["Complete"] = "COMPLETE";
|
|
21578
21666
|
EStatus["Failed"] = "FAILED";
|
|
21579
21667
|
})(EStatus = PendingAction.EStatus || (PendingAction.EStatus = {}));
|
|
21668
|
+
/**
|
|
21669
|
+
* Available server-side Pending Action result encodings.
|
|
21670
|
+
*/
|
|
21671
|
+
let EResultFormat;
|
|
21672
|
+
(function (EResultFormat) {
|
|
21673
|
+
EResultFormat["JSON"] = "JSON";
|
|
21674
|
+
})(EResultFormat = PendingAction.EResultFormat || (PendingAction.EResultFormat = {}));
|
|
21580
21675
|
/**
|
|
21581
21676
|
* Available message types.
|
|
21582
21677
|
*/
|
|
@@ -21594,14 +21689,20 @@
|
|
|
21594
21689
|
*/
|
|
21595
21690
|
function Get(params) {
|
|
21596
21691
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21597
|
-
let { api, actionId, req: reqParams } = params;
|
|
21692
|
+
let { api, actionId, result, req: reqParams } = params;
|
|
21598
21693
|
if (!actionId) {
|
|
21599
21694
|
throw ("Action ID is required.");
|
|
21600
21695
|
}
|
|
21601
21696
|
if (!api) {
|
|
21602
21697
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
21603
21698
|
}
|
|
21604
|
-
|
|
21699
|
+
let url = `pendingAction/${actionId}`;
|
|
21700
|
+
if (result) {
|
|
21701
|
+
const urlParams = new URLSearchParams();
|
|
21702
|
+
urlParams.append("Result", result);
|
|
21703
|
+
url += `?${urlParams.toString()}`;
|
|
21704
|
+
}
|
|
21705
|
+
const data = yield api.GET(url, exports.Api.PrepReqParams(reqParams));
|
|
21605
21706
|
return {
|
|
21606
21707
|
action: data
|
|
21607
21708
|
};
|
|
@@ -21748,7 +21849,7 @@
|
|
|
21748
21849
|
*/
|
|
21749
21850
|
function OnCompletion(params) {
|
|
21750
21851
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21751
|
-
let { api, actionId, req: reqParams, interval: intMs, isDisposed, onMessage } = params;
|
|
21852
|
+
let { api, actionId, req: reqParams, interval: intMs, isDisposed, onMessage, result } = params;
|
|
21752
21853
|
if (!actionId) {
|
|
21753
21854
|
throw ("Action ID is required.");
|
|
21754
21855
|
}
|
|
@@ -21801,6 +21902,7 @@
|
|
|
21801
21902
|
const { action } = yield Get({
|
|
21802
21903
|
api,
|
|
21803
21904
|
actionId,
|
|
21905
|
+
result,
|
|
21804
21906
|
req: reqParams
|
|
21805
21907
|
});
|
|
21806
21908
|
if (action.Status !== EStatus.InProgress) {
|
|
@@ -23277,8 +23379,313 @@
|
|
|
23277
23379
|
UrlUtils.ConstructUrl = ConstructUrl;
|
|
23278
23380
|
})(exports.UrlUtils || (exports.UrlUtils = {}));
|
|
23279
23381
|
|
|
23382
|
+
(function (WorkflowType) {
|
|
23383
|
+
/**
|
|
23384
|
+
* Gets a workflow type by ID.
|
|
23385
|
+
* @param params
|
|
23386
|
+
*/
|
|
23387
|
+
function Get(params) {
|
|
23388
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23389
|
+
let { api, workflowTypeId, req: reqParams } = params;
|
|
23390
|
+
if (isInvalidId(workflowTypeId)) {
|
|
23391
|
+
throw ("Workflow Type ID is required.");
|
|
23392
|
+
}
|
|
23393
|
+
if (!api) {
|
|
23394
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
23395
|
+
}
|
|
23396
|
+
const key = GetCacheKey(workflowTypeId);
|
|
23397
|
+
const cache = api.GetCacheItem(key, reqParams);
|
|
23398
|
+
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
23399
|
+
return cache.data;
|
|
23400
|
+
}
|
|
23401
|
+
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
23402
|
+
try {
|
|
23403
|
+
const data = yield api.GET(`workflow/type/${workflowTypeId}`, exports.Api.PrepReqParams(reqParams));
|
|
23404
|
+
res({
|
|
23405
|
+
workflowType: ParseResponse(data)
|
|
23406
|
+
});
|
|
23407
|
+
}
|
|
23408
|
+
catch (e) {
|
|
23409
|
+
rej(e);
|
|
23410
|
+
}
|
|
23411
|
+
}));
|
|
23412
|
+
api.SetCacheItem({
|
|
23413
|
+
key,
|
|
23414
|
+
value: req,
|
|
23415
|
+
req: reqParams
|
|
23416
|
+
});
|
|
23417
|
+
return req;
|
|
23418
|
+
});
|
|
23419
|
+
}
|
|
23420
|
+
WorkflowType.Get = Get;
|
|
23421
|
+
/**
|
|
23422
|
+
* Gets all workflow types.
|
|
23423
|
+
* @param params
|
|
23424
|
+
*/
|
|
23425
|
+
function GetList(params) {
|
|
23426
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23427
|
+
if (!params) {
|
|
23428
|
+
params = {};
|
|
23429
|
+
}
|
|
23430
|
+
let { api, req: reqParams } = params;
|
|
23431
|
+
if (!api) {
|
|
23432
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
23433
|
+
}
|
|
23434
|
+
const key = GetListCacheKey();
|
|
23435
|
+
const cache = api.GetCacheItem(key, reqParams);
|
|
23436
|
+
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
23437
|
+
return cache.data;
|
|
23438
|
+
}
|
|
23439
|
+
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
23440
|
+
try {
|
|
23441
|
+
const data = yield api.GET("workflow/types", exports.Api.PrepReqParams(reqParams));
|
|
23442
|
+
res({
|
|
23443
|
+
workflowTypes: ParseListResponse(data)
|
|
23444
|
+
});
|
|
23445
|
+
}
|
|
23446
|
+
catch (e) {
|
|
23447
|
+
rej(e);
|
|
23448
|
+
}
|
|
23449
|
+
}));
|
|
23450
|
+
api.SetCacheItem({
|
|
23451
|
+
key,
|
|
23452
|
+
value: req,
|
|
23453
|
+
req: reqParams
|
|
23454
|
+
});
|
|
23455
|
+
return req;
|
|
23456
|
+
});
|
|
23457
|
+
}
|
|
23458
|
+
WorkflowType.GetList = GetList;
|
|
23459
|
+
/**
|
|
23460
|
+
* Creates or updates a workflow type.
|
|
23461
|
+
* This calls: POST workflow/type/{workflow_type_id} where 0 creates new.
|
|
23462
|
+
* @param params
|
|
23463
|
+
*/
|
|
23464
|
+
function Update(params) {
|
|
23465
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23466
|
+
let { api, workflowType: data, req: reqParams } = params;
|
|
23467
|
+
if (!api) {
|
|
23468
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
23469
|
+
}
|
|
23470
|
+
if (!data) {
|
|
23471
|
+
data = {};
|
|
23472
|
+
}
|
|
23473
|
+
const id = data.ID && data.ID > 0 ? data.ID : 0;
|
|
23474
|
+
const res = yield api.POST(`workflow/type/${id}`, data, exports.Api.PrepReqParams(reqParams));
|
|
23475
|
+
const parsed = ParseResponse(res);
|
|
23476
|
+
api.Cache.Remove(GetListCacheKey());
|
|
23477
|
+
if (id > 0) {
|
|
23478
|
+
api.Cache.Remove(GetCacheKey(id));
|
|
23479
|
+
}
|
|
23480
|
+
if (parsed === null || parsed === void 0 ? void 0 : parsed.ID) {
|
|
23481
|
+
api.Cache.Remove(GetCacheKey(parsed.ID));
|
|
23482
|
+
}
|
|
23483
|
+
return {
|
|
23484
|
+
workflowType: parsed
|
|
23485
|
+
};
|
|
23486
|
+
});
|
|
23487
|
+
}
|
|
23488
|
+
WorkflowType.Update = Update;
|
|
23489
|
+
/**
|
|
23490
|
+
* Deletes a workflow type by ID.
|
|
23491
|
+
* @param params
|
|
23492
|
+
*/
|
|
23493
|
+
function Delete(params) {
|
|
23494
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23495
|
+
let { api, workflowTypeId, req: reqParams } = params;
|
|
23496
|
+
if (isInvalidId(workflowTypeId)) {
|
|
23497
|
+
throw ("Workflow Type ID is required.");
|
|
23498
|
+
}
|
|
23499
|
+
if (!api) {
|
|
23500
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
23501
|
+
}
|
|
23502
|
+
yield api.DELETE(`workflow/type/${workflowTypeId}`, exports.Api.PrepReqParams(reqParams));
|
|
23503
|
+
api.Cache.Remove(GetCacheKey(workflowTypeId));
|
|
23504
|
+
api.Cache.Remove(GetListCacheKey());
|
|
23505
|
+
api.Cache.RemoveByStartsWith(GetStatusesCacheKey(workflowTypeId));
|
|
23506
|
+
});
|
|
23507
|
+
}
|
|
23508
|
+
WorkflowType.Delete = Delete;
|
|
23509
|
+
/**
|
|
23510
|
+
* Gets the workflow statuses enabled for a workflow type.
|
|
23511
|
+
* @param params
|
|
23512
|
+
*/
|
|
23513
|
+
function GetStatuses(params) {
|
|
23514
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23515
|
+
let { api, workflowTypeId, req: reqParams } = params;
|
|
23516
|
+
if (isInvalidId(workflowTypeId)) {
|
|
23517
|
+
throw ("Workflow Type ID is required.");
|
|
23518
|
+
}
|
|
23519
|
+
if (!api) {
|
|
23520
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
23521
|
+
}
|
|
23522
|
+
const key = GetStatusesCacheKey(workflowTypeId);
|
|
23523
|
+
const cache = api.GetCacheItem(key, reqParams);
|
|
23524
|
+
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
23525
|
+
return cache.data;
|
|
23526
|
+
}
|
|
23527
|
+
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
23528
|
+
try {
|
|
23529
|
+
const data = yield api.GET(`workflow/type/${workflowTypeId}/statuses`, exports.Api.PrepReqParams(reqParams));
|
|
23530
|
+
res({
|
|
23531
|
+
statuses: ParseStatusListResponse(data)
|
|
23532
|
+
});
|
|
23533
|
+
}
|
|
23534
|
+
catch (e) {
|
|
23535
|
+
rej(e);
|
|
23536
|
+
}
|
|
23537
|
+
}));
|
|
23538
|
+
api.SetCacheItem({
|
|
23539
|
+
key,
|
|
23540
|
+
value: req,
|
|
23541
|
+
req: reqParams
|
|
23542
|
+
});
|
|
23543
|
+
return req;
|
|
23544
|
+
});
|
|
23545
|
+
}
|
|
23546
|
+
WorkflowType.GetStatuses = GetStatuses;
|
|
23547
|
+
/**
|
|
23548
|
+
* Adds statuses to the list enabled for a workflow type.
|
|
23549
|
+
* @param params
|
|
23550
|
+
*/
|
|
23551
|
+
function AddStatuses(params) {
|
|
23552
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23553
|
+
let { api, workflowTypeId, workflowStatusIds, req: reqParams } = params;
|
|
23554
|
+
if (isInvalidId(workflowTypeId)) {
|
|
23555
|
+
throw ("Workflow Type ID is required.");
|
|
23556
|
+
}
|
|
23557
|
+
if (!(workflowStatusIds === null || workflowStatusIds === void 0 ? void 0 : workflowStatusIds.length)) {
|
|
23558
|
+
throw ("Workflow Status ID is required.");
|
|
23559
|
+
}
|
|
23560
|
+
if (!api) {
|
|
23561
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
23562
|
+
}
|
|
23563
|
+
yield api.POST(`workflow/type/${workflowTypeId}/status/add`, {
|
|
23564
|
+
"WorkflowStatus.ID": workflowStatusIds
|
|
23565
|
+
}, exports.Api.PrepReqParams(reqParams));
|
|
23566
|
+
api.Cache.Remove(GetCacheKey(workflowTypeId));
|
|
23567
|
+
api.Cache.Remove(GetStatusesCacheKey(workflowTypeId));
|
|
23568
|
+
});
|
|
23569
|
+
}
|
|
23570
|
+
WorkflowType.AddStatuses = AddStatuses;
|
|
23571
|
+
/**
|
|
23572
|
+
* Removes statuses from the list enabled for a workflow type.
|
|
23573
|
+
* @param params
|
|
23574
|
+
*/
|
|
23575
|
+
function RemoveStatuses(params) {
|
|
23576
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23577
|
+
let { api, workflowTypeId, workflowStatusIds, req: reqParams } = params;
|
|
23578
|
+
if (isInvalidId(workflowTypeId)) {
|
|
23579
|
+
throw ("Workflow Type ID is required.");
|
|
23580
|
+
}
|
|
23581
|
+
if (!(workflowStatusIds === null || workflowStatusIds === void 0 ? void 0 : workflowStatusIds.length)) {
|
|
23582
|
+
throw ("Workflow Status ID is required.");
|
|
23583
|
+
}
|
|
23584
|
+
if (!api) {
|
|
23585
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
23586
|
+
}
|
|
23587
|
+
yield api.POST(`workflow/type/${workflowTypeId}/status/remove`, {
|
|
23588
|
+
"WorkflowStatus.ID": workflowStatusIds
|
|
23589
|
+
}, exports.Api.PrepReqParams(reqParams));
|
|
23590
|
+
api.Cache.Remove(GetCacheKey(workflowTypeId));
|
|
23591
|
+
api.Cache.Remove(GetStatusesCacheKey(workflowTypeId));
|
|
23592
|
+
});
|
|
23593
|
+
}
|
|
23594
|
+
WorkflowType.RemoveStatuses = RemoveStatuses;
|
|
23595
|
+
/**
|
|
23596
|
+
* Normalizes response from workflow type get/update endpoints.
|
|
23597
|
+
*/
|
|
23598
|
+
function ParseResponse(response) {
|
|
23599
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
23600
|
+
const parsed = parseObject$6(response);
|
|
23601
|
+
const parsedResult = (_a = parseObject$6(parsed === null || parsed === void 0 ? void 0 : parsed.Result)) !== null && _a !== void 0 ? _a : parsed === null || parsed === void 0 ? void 0 : parsed.Result;
|
|
23602
|
+
return (_h = (_g = (_f = (_e = (_d = (_c = (_b = parsed === null || parsed === void 0 ? void 0 : parsed.WorkflowType) !== null && _b !== void 0 ? _b : parsed === null || parsed === void 0 ? void 0 : parsed.WorkflowItemType) !== null && _c !== void 0 ? _c : parsed === null || parsed === void 0 ? void 0 : parsed.BruceWorkflowItemType) !== null && _d !== void 0 ? _d : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.WorkflowType) !== null && _e !== void 0 ? _e : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.WorkflowItemType) !== null && _f !== void 0 ? _f : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.BruceWorkflowItemType) !== null && _g !== void 0 ? _g : parsedResult) !== null && _h !== void 0 ? _h : parsed;
|
|
23603
|
+
}
|
|
23604
|
+
WorkflowType.ParseResponse = ParseResponse;
|
|
23605
|
+
/**
|
|
23606
|
+
* Normalizes response from workflow type list endpoints.
|
|
23607
|
+
*/
|
|
23608
|
+
function ParseListResponse(response) {
|
|
23609
|
+
return parseList(response, ["WorkflowTypes", "WorkflowItemTypes", "BruceWorkflowItemTypes"]);
|
|
23610
|
+
}
|
|
23611
|
+
WorkflowType.ParseListResponse = ParseListResponse;
|
|
23612
|
+
/**
|
|
23613
|
+
* Normalizes response from workflow type status list endpoints.
|
|
23614
|
+
*/
|
|
23615
|
+
function ParseStatusListResponse(response) {
|
|
23616
|
+
return parseList(response, ["Statuses", "WorkflowStatuses", "WorkflowItemStatuses", "BruceWorkflowItemStatuses"]);
|
|
23617
|
+
}
|
|
23618
|
+
WorkflowType.ParseStatusListResponse = ParseStatusListResponse;
|
|
23619
|
+
/**
|
|
23620
|
+
* Returns cache identifier for a workflow type by ID.
|
|
23621
|
+
* @param id
|
|
23622
|
+
* @returns
|
|
23623
|
+
*/
|
|
23624
|
+
function GetCacheKey(id) {
|
|
23625
|
+
return `${exports.Api.ECacheKey.WorkflowType}${exports.Api.ECacheKey.Id}${id}`;
|
|
23626
|
+
}
|
|
23627
|
+
WorkflowType.GetCacheKey = GetCacheKey;
|
|
23628
|
+
/**
|
|
23629
|
+
* Returns cache identifier for the workflow type list.
|
|
23630
|
+
* @returns
|
|
23631
|
+
*/
|
|
23632
|
+
function GetListCacheKey() {
|
|
23633
|
+
return exports.Api.ECacheKey.WorkflowType;
|
|
23634
|
+
}
|
|
23635
|
+
WorkflowType.GetListCacheKey = GetListCacheKey;
|
|
23636
|
+
/**
|
|
23637
|
+
* Returns cache identifier for the statuses enabled for a workflow type.
|
|
23638
|
+
* @param workflowTypeId
|
|
23639
|
+
* @returns
|
|
23640
|
+
*/
|
|
23641
|
+
function GetStatusesCacheKey(workflowTypeId) {
|
|
23642
|
+
return `${exports.Api.ECacheKey.WorkflowType}${exports.Api.ECacheKey.Id}${workflowTypeId}${exports.Api.ECacheKey.ListId}statuses`;
|
|
23643
|
+
}
|
|
23644
|
+
WorkflowType.GetStatusesCacheKey = GetStatusesCacheKey;
|
|
23645
|
+
})(exports.WorkflowType || (exports.WorkflowType = {}));
|
|
23646
|
+
// Alias that mirrors the API route/model wording.
|
|
23647
|
+
var WorkflowItemType = exports.WorkflowType;
|
|
23648
|
+
function parseObject$6(data) {
|
|
23649
|
+
if (data == null || data == undefined) {
|
|
23650
|
+
return null;
|
|
23651
|
+
}
|
|
23652
|
+
if (typeof data == "string") {
|
|
23653
|
+
try {
|
|
23654
|
+
return JSON.parse(data);
|
|
23655
|
+
}
|
|
23656
|
+
catch (_a) {
|
|
23657
|
+
return null;
|
|
23658
|
+
}
|
|
23659
|
+
}
|
|
23660
|
+
return data;
|
|
23661
|
+
}
|
|
23662
|
+
function isInvalidId(id) {
|
|
23663
|
+
return id == null || id === "" || !isFinite(Number(id)) || Number(id) <= 0;
|
|
23664
|
+
}
|
|
23665
|
+
function parseList(response, wrapperKeys) {
|
|
23666
|
+
var _a, _b, _c, _d, _e, _f;
|
|
23667
|
+
const parsed = parseObject$6(response);
|
|
23668
|
+
const parsedResult = (_a = parseObject$6(parsed === null || parsed === void 0 ? void 0 : parsed.Result)) !== null && _a !== void 0 ? _a : parsed === null || parsed === void 0 ? void 0 : parsed.Result;
|
|
23669
|
+
const list = (_f = (_e = (_d = (_c = (_b = parsed === null || parsed === void 0 ? void 0 : parsed.Items) !== null && _b !== void 0 ? _b : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.Items) !== null && _c !== void 0 ? _c : getFirstWrappedArray(parsed, wrapperKeys)) !== null && _d !== void 0 ? _d : getFirstWrappedArray(parsedResult, wrapperKeys)) !== null && _e !== void 0 ? _e : parsedResult) !== null && _f !== void 0 ? _f : parsed;
|
|
23670
|
+
if (Array.isArray(list)) {
|
|
23671
|
+
return list;
|
|
23672
|
+
}
|
|
23673
|
+
return [];
|
|
23674
|
+
}
|
|
23675
|
+
function getFirstWrappedArray(data, wrapperKeys) {
|
|
23676
|
+
if (!data) {
|
|
23677
|
+
return null;
|
|
23678
|
+
}
|
|
23679
|
+
for (const key of wrapperKeys) {
|
|
23680
|
+
if (Array.isArray(data[key])) {
|
|
23681
|
+
return data[key];
|
|
23682
|
+
}
|
|
23683
|
+
}
|
|
23684
|
+
return null;
|
|
23685
|
+
}
|
|
23686
|
+
|
|
23280
23687
|
// This is updated with the package.json version on build.
|
|
23281
|
-
const VERSION = "7.1.
|
|
23688
|
+
const VERSION = "7.1.100";
|
|
23282
23689
|
|
|
23283
23690
|
exports.VERSION = VERSION;
|
|
23284
23691
|
exports.AbstractApi = AbstractApi;
|
|
@@ -23291,6 +23698,7 @@
|
|
|
23291
23698
|
exports.NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED = NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED;
|
|
23292
23699
|
exports.NavigatorChatClient = NavigatorChatClient;
|
|
23293
23700
|
exports.NavigatorMcpWebSocketClient = NavigatorMcpWebSocketClient;
|
|
23701
|
+
exports.WorkflowItemType = WorkflowItemType;
|
|
23294
23702
|
|
|
23295
23703
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
23296
23704
|
|