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.es5.js
CHANGED
|
@@ -90,6 +90,7 @@ var Api;
|
|
|
90
90
|
ECacheKey["EntityHistoricDataAnalysis"] = "entityhistoricdataanalysis";
|
|
91
91
|
ECacheKey["EntityHistoricDataPage"] = "entityhistoricdatapage";
|
|
92
92
|
ECacheKey["AccountLimits"] = "accountlimits";
|
|
93
|
+
ECacheKey["WorkflowType"] = "workflowtype";
|
|
93
94
|
})(ECacheKey = Api.ECacheKey || (Api.ECacheKey = {}));
|
|
94
95
|
// 1 minute.
|
|
95
96
|
Api.DEFAULT_CACHE_DURATION = 60 * 1000;
|
|
@@ -1046,7 +1047,7 @@ function parseResult(data) {
|
|
|
1046
1047
|
else if (encoding === "iso-8859-1") {
|
|
1047
1048
|
encoding = "utf-8";
|
|
1048
1049
|
}
|
|
1049
|
-
if (type == "application/octet-stream" || type == "model/gltf-binary") {
|
|
1050
|
+
if (type == "application/octet-stream" || type == "model/gltf-binary" || type == "application/nsx") {
|
|
1050
1051
|
if (encoding !== "utf-8") {
|
|
1051
1052
|
console.warn("Binary data is being returned with an unexpected encoding:", encoding);
|
|
1052
1053
|
}
|
|
@@ -17598,14 +17599,101 @@ var ExportNsx;
|
|
|
17598
17599
|
*/
|
|
17599
17600
|
function AccountBackup(params) {
|
|
17600
17601
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17601
|
-
let { api, req: reqParams } = params !== null && params !== void 0 ? params : {};
|
|
17602
|
+
let { api, backup, req: reqParams } = params !== null && params !== void 0 ? params : {};
|
|
17602
17603
|
if (!api) {
|
|
17603
17604
|
api = ENVIRONMENT.Api().GetBruceApi();
|
|
17604
17605
|
}
|
|
17605
|
-
return api.POST("export/nsx/accountBackup", {}, Api.PrepReqParams(reqParams));
|
|
17606
|
+
return api.POST("export/nsx/accountBackup", backup !== null && backup !== void 0 ? backup : {}, Api.PrepReqParams(reqParams));
|
|
17606
17607
|
});
|
|
17607
17608
|
}
|
|
17608
17609
|
ExportNsx.AccountBackup = AccountBackup;
|
|
17610
|
+
/**
|
|
17611
|
+
* Returns available account backup files, including whole-account NSX backups.
|
|
17612
|
+
*/
|
|
17613
|
+
function GetAccountBackupList(params) {
|
|
17614
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17615
|
+
let { api, req: reqParams } = params !== null && params !== void 0 ? params : {};
|
|
17616
|
+
if (!api) {
|
|
17617
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
17618
|
+
}
|
|
17619
|
+
return api.GET("account/restoreList", Api.PrepReqParams(reqParams));
|
|
17620
|
+
});
|
|
17621
|
+
}
|
|
17622
|
+
ExportNsx.GetAccountBackupList = GetAccountBackupList;
|
|
17623
|
+
/**
|
|
17624
|
+
* Downloads a saved whole-account NSX backup file.
|
|
17625
|
+
*/
|
|
17626
|
+
function DownloadAccountBackup(params) {
|
|
17627
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17628
|
+
let { api, fileName, req: reqParams } = params;
|
|
17629
|
+
if (!fileName) {
|
|
17630
|
+
throw ("fileName is required.");
|
|
17631
|
+
}
|
|
17632
|
+
if (!api) {
|
|
17633
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
17634
|
+
}
|
|
17635
|
+
return api.GET(`account/backup/nsx/${encodeURIComponent(fileName)}`, Api.PrepReqParams(reqParams));
|
|
17636
|
+
});
|
|
17637
|
+
}
|
|
17638
|
+
ExportNsx.DownloadAccountBackup = DownloadAccountBackup;
|
|
17639
|
+
/**
|
|
17640
|
+
* Deletes a saved whole-account NSX backup file.
|
|
17641
|
+
*/
|
|
17642
|
+
function DeleteAccountBackup(params) {
|
|
17643
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17644
|
+
let { api, fileName, req: reqParams } = params;
|
|
17645
|
+
if (!fileName) {
|
|
17646
|
+
throw ("fileName is required.");
|
|
17647
|
+
}
|
|
17648
|
+
if (!api) {
|
|
17649
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
17650
|
+
}
|
|
17651
|
+
return api.DELETE(`account/backup/nsx/${encodeURIComponent(fileName)}`, Api.PrepReqParams(reqParams));
|
|
17652
|
+
});
|
|
17653
|
+
}
|
|
17654
|
+
ExportNsx.DeleteAccountBackup = DeleteAccountBackup;
|
|
17655
|
+
/**
|
|
17656
|
+
* Parses the completed Pending Action result from running AccountBackup.
|
|
17657
|
+
*/
|
|
17658
|
+
function ParseAccountBackupResult(paResult) {
|
|
17659
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
17660
|
+
const parsed = parseObject(paResult);
|
|
17661
|
+
if (!parsed) {
|
|
17662
|
+
return {
|
|
17663
|
+
raw: null
|
|
17664
|
+
};
|
|
17665
|
+
}
|
|
17666
|
+
const resultSource = (parsed === null || parsed === void 0 ? void 0 : parsed.Result) != null ? parsed.Result : parsed;
|
|
17667
|
+
const rawResult = (_a = parseObject(resultSource)) !== null && _a !== void 0 ? _a : (typeof resultSource == "object" ? resultSource : null);
|
|
17668
|
+
const report = rawResult === null || rawResult === void 0 ? void 0 : rawResult.Report;
|
|
17669
|
+
return {
|
|
17670
|
+
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"],
|
|
17671
|
+
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"],
|
|
17672
|
+
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,
|
|
17673
|
+
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,
|
|
17674
|
+
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"],
|
|
17675
|
+
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"],
|
|
17676
|
+
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,
|
|
17677
|
+
report: report,
|
|
17678
|
+
stats: rawResult === null || rawResult === void 0 ? void 0 : rawResult.Stats,
|
|
17679
|
+
raw: rawResult
|
|
17680
|
+
};
|
|
17681
|
+
}
|
|
17682
|
+
ExportNsx.ParseAccountBackupResult = ParseAccountBackupResult;
|
|
17683
|
+
function parseObject(data) {
|
|
17684
|
+
if (data == null || data == undefined) {
|
|
17685
|
+
return null;
|
|
17686
|
+
}
|
|
17687
|
+
if (typeof data == "string") {
|
|
17688
|
+
try {
|
|
17689
|
+
return JSON.parse(data);
|
|
17690
|
+
}
|
|
17691
|
+
catch (_a) {
|
|
17692
|
+
return null;
|
|
17693
|
+
}
|
|
17694
|
+
}
|
|
17695
|
+
return data;
|
|
17696
|
+
}
|
|
17609
17697
|
})(ExportNsx || (ExportNsx = {}));
|
|
17610
17698
|
|
|
17611
17699
|
var ExportUsd;
|
|
@@ -21928,6 +22016,13 @@ var PendingAction;
|
|
|
21928
22016
|
EStatus["Complete"] = "COMPLETE";
|
|
21929
22017
|
EStatus["Failed"] = "FAILED";
|
|
21930
22018
|
})(EStatus = PendingAction.EStatus || (PendingAction.EStatus = {}));
|
|
22019
|
+
/**
|
|
22020
|
+
* Available server-side Pending Action result encodings.
|
|
22021
|
+
*/
|
|
22022
|
+
let EResultFormat;
|
|
22023
|
+
(function (EResultFormat) {
|
|
22024
|
+
EResultFormat["JSON"] = "JSON";
|
|
22025
|
+
})(EResultFormat = PendingAction.EResultFormat || (PendingAction.EResultFormat = {}));
|
|
21931
22026
|
/**
|
|
21932
22027
|
* Available message types.
|
|
21933
22028
|
*/
|
|
@@ -21945,14 +22040,20 @@ var PendingAction;
|
|
|
21945
22040
|
*/
|
|
21946
22041
|
function Get(params) {
|
|
21947
22042
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21948
|
-
let { api, actionId, req: reqParams } = params;
|
|
22043
|
+
let { api, actionId, result, req: reqParams } = params;
|
|
21949
22044
|
if (!actionId) {
|
|
21950
22045
|
throw ("Action ID is required.");
|
|
21951
22046
|
}
|
|
21952
22047
|
if (!api) {
|
|
21953
22048
|
api = ENVIRONMENT.Api().GetBruceApi();
|
|
21954
22049
|
}
|
|
21955
|
-
|
|
22050
|
+
let url = `pendingAction/${actionId}`;
|
|
22051
|
+
if (result) {
|
|
22052
|
+
const urlParams = new URLSearchParams();
|
|
22053
|
+
urlParams.append("Result", result);
|
|
22054
|
+
url += `?${urlParams.toString()}`;
|
|
22055
|
+
}
|
|
22056
|
+
const data = yield api.GET(url, Api.PrepReqParams(reqParams));
|
|
21956
22057
|
return {
|
|
21957
22058
|
action: data
|
|
21958
22059
|
};
|
|
@@ -22099,7 +22200,7 @@ var PendingAction;
|
|
|
22099
22200
|
*/
|
|
22100
22201
|
function OnCompletion(params) {
|
|
22101
22202
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22102
|
-
let { api, actionId, req: reqParams, interval: intMs, isDisposed, onMessage } = params;
|
|
22203
|
+
let { api, actionId, req: reqParams, interval: intMs, isDisposed, onMessage, result } = params;
|
|
22103
22204
|
if (!actionId) {
|
|
22104
22205
|
throw ("Action ID is required.");
|
|
22105
22206
|
}
|
|
@@ -22152,6 +22253,7 @@ var PendingAction;
|
|
|
22152
22253
|
const { action } = yield Get({
|
|
22153
22254
|
api,
|
|
22154
22255
|
actionId,
|
|
22256
|
+
result,
|
|
22155
22257
|
req: reqParams
|
|
22156
22258
|
});
|
|
22157
22259
|
if (action.Status !== EStatus.InProgress) {
|
|
@@ -23656,8 +23758,318 @@ var UrlUtils;
|
|
|
23656
23758
|
UrlUtils.ConstructUrl = ConstructUrl;
|
|
23657
23759
|
})(UrlUtils || (UrlUtils = {}));
|
|
23658
23760
|
|
|
23761
|
+
/**
|
|
23762
|
+
* Describes the "Workflow Type" concept within Nextspace.
|
|
23763
|
+
* The API names this record Workflow Item Type.
|
|
23764
|
+
*/
|
|
23765
|
+
var WorkflowType;
|
|
23766
|
+
(function (WorkflowType) {
|
|
23767
|
+
/**
|
|
23768
|
+
* Gets a workflow type by ID.
|
|
23769
|
+
* @param params
|
|
23770
|
+
*/
|
|
23771
|
+
function Get(params) {
|
|
23772
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23773
|
+
let { api, workflowTypeId, req: reqParams } = params;
|
|
23774
|
+
if (isInvalidId(workflowTypeId)) {
|
|
23775
|
+
throw ("Workflow Type ID is required.");
|
|
23776
|
+
}
|
|
23777
|
+
if (!api) {
|
|
23778
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
23779
|
+
}
|
|
23780
|
+
const key = GetCacheKey(workflowTypeId);
|
|
23781
|
+
const cache = api.GetCacheItem(key, reqParams);
|
|
23782
|
+
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
23783
|
+
return cache.data;
|
|
23784
|
+
}
|
|
23785
|
+
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
23786
|
+
try {
|
|
23787
|
+
const data = yield api.GET(`workflow/type/${workflowTypeId}`, Api.PrepReqParams(reqParams));
|
|
23788
|
+
res({
|
|
23789
|
+
workflowType: ParseResponse(data)
|
|
23790
|
+
});
|
|
23791
|
+
}
|
|
23792
|
+
catch (e) {
|
|
23793
|
+
rej(e);
|
|
23794
|
+
}
|
|
23795
|
+
}));
|
|
23796
|
+
api.SetCacheItem({
|
|
23797
|
+
key,
|
|
23798
|
+
value: req,
|
|
23799
|
+
req: reqParams
|
|
23800
|
+
});
|
|
23801
|
+
return req;
|
|
23802
|
+
});
|
|
23803
|
+
}
|
|
23804
|
+
WorkflowType.Get = Get;
|
|
23805
|
+
/**
|
|
23806
|
+
* Gets all workflow types.
|
|
23807
|
+
* @param params
|
|
23808
|
+
*/
|
|
23809
|
+
function GetList(params) {
|
|
23810
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23811
|
+
if (!params) {
|
|
23812
|
+
params = {};
|
|
23813
|
+
}
|
|
23814
|
+
let { api, req: reqParams } = params;
|
|
23815
|
+
if (!api) {
|
|
23816
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
23817
|
+
}
|
|
23818
|
+
const key = GetListCacheKey();
|
|
23819
|
+
const cache = api.GetCacheItem(key, reqParams);
|
|
23820
|
+
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
23821
|
+
return cache.data;
|
|
23822
|
+
}
|
|
23823
|
+
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
23824
|
+
try {
|
|
23825
|
+
const data = yield api.GET("workflow/types", Api.PrepReqParams(reqParams));
|
|
23826
|
+
res({
|
|
23827
|
+
workflowTypes: ParseListResponse(data)
|
|
23828
|
+
});
|
|
23829
|
+
}
|
|
23830
|
+
catch (e) {
|
|
23831
|
+
rej(e);
|
|
23832
|
+
}
|
|
23833
|
+
}));
|
|
23834
|
+
api.SetCacheItem({
|
|
23835
|
+
key,
|
|
23836
|
+
value: req,
|
|
23837
|
+
req: reqParams
|
|
23838
|
+
});
|
|
23839
|
+
return req;
|
|
23840
|
+
});
|
|
23841
|
+
}
|
|
23842
|
+
WorkflowType.GetList = GetList;
|
|
23843
|
+
/**
|
|
23844
|
+
* Creates or updates a workflow type.
|
|
23845
|
+
* This calls: POST workflow/type/{workflow_type_id} where 0 creates new.
|
|
23846
|
+
* @param params
|
|
23847
|
+
*/
|
|
23848
|
+
function Update(params) {
|
|
23849
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23850
|
+
let { api, workflowType: data, req: reqParams } = params;
|
|
23851
|
+
if (!api) {
|
|
23852
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
23853
|
+
}
|
|
23854
|
+
if (!data) {
|
|
23855
|
+
data = {};
|
|
23856
|
+
}
|
|
23857
|
+
const id = data.ID && data.ID > 0 ? data.ID : 0;
|
|
23858
|
+
const res = yield api.POST(`workflow/type/${id}`, data, Api.PrepReqParams(reqParams));
|
|
23859
|
+
const parsed = ParseResponse(res);
|
|
23860
|
+
api.Cache.Remove(GetListCacheKey());
|
|
23861
|
+
if (id > 0) {
|
|
23862
|
+
api.Cache.Remove(GetCacheKey(id));
|
|
23863
|
+
}
|
|
23864
|
+
if (parsed === null || parsed === void 0 ? void 0 : parsed.ID) {
|
|
23865
|
+
api.Cache.Remove(GetCacheKey(parsed.ID));
|
|
23866
|
+
}
|
|
23867
|
+
return {
|
|
23868
|
+
workflowType: parsed
|
|
23869
|
+
};
|
|
23870
|
+
});
|
|
23871
|
+
}
|
|
23872
|
+
WorkflowType.Update = Update;
|
|
23873
|
+
/**
|
|
23874
|
+
* Deletes a workflow type by ID.
|
|
23875
|
+
* @param params
|
|
23876
|
+
*/
|
|
23877
|
+
function Delete(params) {
|
|
23878
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23879
|
+
let { api, workflowTypeId, req: reqParams } = params;
|
|
23880
|
+
if (isInvalidId(workflowTypeId)) {
|
|
23881
|
+
throw ("Workflow Type ID is required.");
|
|
23882
|
+
}
|
|
23883
|
+
if (!api) {
|
|
23884
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
23885
|
+
}
|
|
23886
|
+
yield api.DELETE(`workflow/type/${workflowTypeId}`, Api.PrepReqParams(reqParams));
|
|
23887
|
+
api.Cache.Remove(GetCacheKey(workflowTypeId));
|
|
23888
|
+
api.Cache.Remove(GetListCacheKey());
|
|
23889
|
+
api.Cache.RemoveByStartsWith(GetStatusesCacheKey(workflowTypeId));
|
|
23890
|
+
});
|
|
23891
|
+
}
|
|
23892
|
+
WorkflowType.Delete = Delete;
|
|
23893
|
+
/**
|
|
23894
|
+
* Gets the workflow statuses enabled for a workflow type.
|
|
23895
|
+
* @param params
|
|
23896
|
+
*/
|
|
23897
|
+
function GetStatuses(params) {
|
|
23898
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23899
|
+
let { api, workflowTypeId, req: reqParams } = params;
|
|
23900
|
+
if (isInvalidId(workflowTypeId)) {
|
|
23901
|
+
throw ("Workflow Type ID is required.");
|
|
23902
|
+
}
|
|
23903
|
+
if (!api) {
|
|
23904
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
23905
|
+
}
|
|
23906
|
+
const key = GetStatusesCacheKey(workflowTypeId);
|
|
23907
|
+
const cache = api.GetCacheItem(key, reqParams);
|
|
23908
|
+
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
23909
|
+
return cache.data;
|
|
23910
|
+
}
|
|
23911
|
+
const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
23912
|
+
try {
|
|
23913
|
+
const data = yield api.GET(`workflow/type/${workflowTypeId}/statuses`, Api.PrepReqParams(reqParams));
|
|
23914
|
+
res({
|
|
23915
|
+
statuses: ParseStatusListResponse(data)
|
|
23916
|
+
});
|
|
23917
|
+
}
|
|
23918
|
+
catch (e) {
|
|
23919
|
+
rej(e);
|
|
23920
|
+
}
|
|
23921
|
+
}));
|
|
23922
|
+
api.SetCacheItem({
|
|
23923
|
+
key,
|
|
23924
|
+
value: req,
|
|
23925
|
+
req: reqParams
|
|
23926
|
+
});
|
|
23927
|
+
return req;
|
|
23928
|
+
});
|
|
23929
|
+
}
|
|
23930
|
+
WorkflowType.GetStatuses = GetStatuses;
|
|
23931
|
+
/**
|
|
23932
|
+
* Adds statuses to the list enabled for a workflow type.
|
|
23933
|
+
* @param params
|
|
23934
|
+
*/
|
|
23935
|
+
function AddStatuses(params) {
|
|
23936
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23937
|
+
let { api, workflowTypeId, workflowStatusIds, req: reqParams } = params;
|
|
23938
|
+
if (isInvalidId(workflowTypeId)) {
|
|
23939
|
+
throw ("Workflow Type ID is required.");
|
|
23940
|
+
}
|
|
23941
|
+
if (!(workflowStatusIds === null || workflowStatusIds === void 0 ? void 0 : workflowStatusIds.length)) {
|
|
23942
|
+
throw ("Workflow Status ID is required.");
|
|
23943
|
+
}
|
|
23944
|
+
if (!api) {
|
|
23945
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
23946
|
+
}
|
|
23947
|
+
yield api.POST(`workflow/type/${workflowTypeId}/status/add`, {
|
|
23948
|
+
"WorkflowStatus.ID": workflowStatusIds
|
|
23949
|
+
}, Api.PrepReqParams(reqParams));
|
|
23950
|
+
api.Cache.Remove(GetCacheKey(workflowTypeId));
|
|
23951
|
+
api.Cache.Remove(GetStatusesCacheKey(workflowTypeId));
|
|
23952
|
+
});
|
|
23953
|
+
}
|
|
23954
|
+
WorkflowType.AddStatuses = AddStatuses;
|
|
23955
|
+
/**
|
|
23956
|
+
* Removes statuses from the list enabled for a workflow type.
|
|
23957
|
+
* @param params
|
|
23958
|
+
*/
|
|
23959
|
+
function RemoveStatuses(params) {
|
|
23960
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23961
|
+
let { api, workflowTypeId, workflowStatusIds, req: reqParams } = params;
|
|
23962
|
+
if (isInvalidId(workflowTypeId)) {
|
|
23963
|
+
throw ("Workflow Type ID is required.");
|
|
23964
|
+
}
|
|
23965
|
+
if (!(workflowStatusIds === null || workflowStatusIds === void 0 ? void 0 : workflowStatusIds.length)) {
|
|
23966
|
+
throw ("Workflow Status ID is required.");
|
|
23967
|
+
}
|
|
23968
|
+
if (!api) {
|
|
23969
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
23970
|
+
}
|
|
23971
|
+
yield api.POST(`workflow/type/${workflowTypeId}/status/remove`, {
|
|
23972
|
+
"WorkflowStatus.ID": workflowStatusIds
|
|
23973
|
+
}, Api.PrepReqParams(reqParams));
|
|
23974
|
+
api.Cache.Remove(GetCacheKey(workflowTypeId));
|
|
23975
|
+
api.Cache.Remove(GetStatusesCacheKey(workflowTypeId));
|
|
23976
|
+
});
|
|
23977
|
+
}
|
|
23978
|
+
WorkflowType.RemoveStatuses = RemoveStatuses;
|
|
23979
|
+
/**
|
|
23980
|
+
* Normalizes response from workflow type get/update endpoints.
|
|
23981
|
+
*/
|
|
23982
|
+
function ParseResponse(response) {
|
|
23983
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
23984
|
+
const parsed = parseObject$6(response);
|
|
23985
|
+
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;
|
|
23986
|
+
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;
|
|
23987
|
+
}
|
|
23988
|
+
WorkflowType.ParseResponse = ParseResponse;
|
|
23989
|
+
/**
|
|
23990
|
+
* Normalizes response from workflow type list endpoints.
|
|
23991
|
+
*/
|
|
23992
|
+
function ParseListResponse(response) {
|
|
23993
|
+
return parseList(response, ["WorkflowTypes", "WorkflowItemTypes", "BruceWorkflowItemTypes"]);
|
|
23994
|
+
}
|
|
23995
|
+
WorkflowType.ParseListResponse = ParseListResponse;
|
|
23996
|
+
/**
|
|
23997
|
+
* Normalizes response from workflow type status list endpoints.
|
|
23998
|
+
*/
|
|
23999
|
+
function ParseStatusListResponse(response) {
|
|
24000
|
+
return parseList(response, ["Statuses", "WorkflowStatuses", "WorkflowItemStatuses", "BruceWorkflowItemStatuses"]);
|
|
24001
|
+
}
|
|
24002
|
+
WorkflowType.ParseStatusListResponse = ParseStatusListResponse;
|
|
24003
|
+
/**
|
|
24004
|
+
* Returns cache identifier for a workflow type by ID.
|
|
24005
|
+
* @param id
|
|
24006
|
+
* @returns
|
|
24007
|
+
*/
|
|
24008
|
+
function GetCacheKey(id) {
|
|
24009
|
+
return `${Api.ECacheKey.WorkflowType}${Api.ECacheKey.Id}${id}`;
|
|
24010
|
+
}
|
|
24011
|
+
WorkflowType.GetCacheKey = GetCacheKey;
|
|
24012
|
+
/**
|
|
24013
|
+
* Returns cache identifier for the workflow type list.
|
|
24014
|
+
* @returns
|
|
24015
|
+
*/
|
|
24016
|
+
function GetListCacheKey() {
|
|
24017
|
+
return Api.ECacheKey.WorkflowType;
|
|
24018
|
+
}
|
|
24019
|
+
WorkflowType.GetListCacheKey = GetListCacheKey;
|
|
24020
|
+
/**
|
|
24021
|
+
* Returns cache identifier for the statuses enabled for a workflow type.
|
|
24022
|
+
* @param workflowTypeId
|
|
24023
|
+
* @returns
|
|
24024
|
+
*/
|
|
24025
|
+
function GetStatusesCacheKey(workflowTypeId) {
|
|
24026
|
+
return `${Api.ECacheKey.WorkflowType}${Api.ECacheKey.Id}${workflowTypeId}${Api.ECacheKey.ListId}statuses`;
|
|
24027
|
+
}
|
|
24028
|
+
WorkflowType.GetStatusesCacheKey = GetStatusesCacheKey;
|
|
24029
|
+
})(WorkflowType || (WorkflowType = {}));
|
|
24030
|
+
// Alias that mirrors the API route/model wording.
|
|
24031
|
+
var WorkflowItemType = WorkflowType;
|
|
24032
|
+
function parseObject$6(data) {
|
|
24033
|
+
if (data == null || data == undefined) {
|
|
24034
|
+
return null;
|
|
24035
|
+
}
|
|
24036
|
+
if (typeof data == "string") {
|
|
24037
|
+
try {
|
|
24038
|
+
return JSON.parse(data);
|
|
24039
|
+
}
|
|
24040
|
+
catch (_a) {
|
|
24041
|
+
return null;
|
|
24042
|
+
}
|
|
24043
|
+
}
|
|
24044
|
+
return data;
|
|
24045
|
+
}
|
|
24046
|
+
function isInvalidId(id) {
|
|
24047
|
+
return id == null || id === "" || !isFinite(Number(id)) || Number(id) <= 0;
|
|
24048
|
+
}
|
|
24049
|
+
function parseList(response, wrapperKeys) {
|
|
24050
|
+
var _a, _b, _c, _d, _e, _f;
|
|
24051
|
+
const parsed = parseObject$6(response);
|
|
24052
|
+
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;
|
|
24053
|
+
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;
|
|
24054
|
+
if (Array.isArray(list)) {
|
|
24055
|
+
return list;
|
|
24056
|
+
}
|
|
24057
|
+
return [];
|
|
24058
|
+
}
|
|
24059
|
+
function getFirstWrappedArray(data, wrapperKeys) {
|
|
24060
|
+
if (!data) {
|
|
24061
|
+
return null;
|
|
24062
|
+
}
|
|
24063
|
+
for (const key of wrapperKeys) {
|
|
24064
|
+
if (Array.isArray(data[key])) {
|
|
24065
|
+
return data[key];
|
|
24066
|
+
}
|
|
24067
|
+
}
|
|
24068
|
+
return null;
|
|
24069
|
+
}
|
|
24070
|
+
|
|
23659
24071
|
// This is updated with the package.json version on build.
|
|
23660
|
-
const VERSION = "7.1.
|
|
24072
|
+
const VERSION = "7.1.100";
|
|
23661
24073
|
|
|
23662
|
-
export { VERSION, Account, AccountAudit, AccountConcept, AccountFeatures, AccountInvite, AccountLimits, AccountTemplate, AccountType, AnnDocument, AbstractApi, Api, ApiGetters, BruceApi, GlobalApi, GuardianApi, Assembly, Calculator, ChangeSet, ClientFile, ClientFileValueMap, Bounds, BruceEvent, BruceVariable, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, GeoJson, Geometry, LRUCache, UTC, CustomForm, DashboardView, DataFeed, DataLab, DataLabGroup, DataSource, DataTransform, Comment, Entity, EntityAttachment, EntityAttachmentType, EntityAttribute, EntityComment, EntityCoords, EntityHistoricData, EntityLink, EntityLod, EntityLodCategory, EntityRelation, EntityRelationType, EntitySource, EntityTableView, EntityTag, EntityType, EntityTypeRelation, EntityTypeTrigger, Ontology, OntologyDocument, ENVIRONMENT, ExportBrz, ExportCsv, ExportNsx, ExportUsd, Hexbin, ImportAssembly, ImportCad, ImportCsv, ImportGeoJson, ImportJson, ImportKml, ImportLcc, ImportTif, ImportedFile, Uploader, Markup, UIMarkup, NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED, NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED, NavigatorChatClient, NavigatorMcpWebSocketClient, Plugin, PluginAiTool, ProgramKey, MenuItem, ProjectView, ProjectViewBookmark, ProjectViewBookmarkGroup, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewLegacyTile, ProjectViewTile, ZoomControl, Scenario, HostingLocation, MessageBroker, PendingAction, RecordChangeFeed, Style, Tileset, Tracking, Permission, Session, User, UserGroup, UserMfaMethod, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils };
|
|
24074
|
+
export { VERSION, Account, AccountAudit, AccountConcept, AccountFeatures, AccountInvite, AccountLimits, AccountTemplate, AccountType, AnnDocument, AbstractApi, Api, ApiGetters, BruceApi, GlobalApi, GuardianApi, Assembly, Calculator, ChangeSet, ClientFile, ClientFileValueMap, Bounds, BruceEvent, BruceVariable, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, GeoJson, Geometry, LRUCache, UTC, CustomForm, DashboardView, DataFeed, DataLab, DataLabGroup, DataSource, DataTransform, Comment, Entity, EntityAttachment, EntityAttachmentType, EntityAttribute, EntityComment, EntityCoords, EntityHistoricData, EntityLink, EntityLod, EntityLodCategory, EntityRelation, EntityRelationType, EntitySource, EntityTableView, EntityTag, EntityType, EntityTypeRelation, EntityTypeTrigger, Ontology, OntologyDocument, ENVIRONMENT, ExportBrz, ExportCsv, ExportNsx, ExportUsd, Hexbin, ImportAssembly, ImportCad, ImportCsv, ImportGeoJson, ImportJson, ImportKml, ImportLcc, ImportTif, ImportedFile, Uploader, Markup, UIMarkup, NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED, NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED, NavigatorChatClient, NavigatorMcpWebSocketClient, Plugin, PluginAiTool, ProgramKey, MenuItem, ProjectView, ProjectViewBookmark, ProjectViewBookmarkGroup, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewLegacyTile, ProjectViewTile, ZoomControl, Scenario, HostingLocation, MessageBroker, PendingAction, RecordChangeFeed, Style, Tileset, Tracking, Permission, Session, User, UserGroup, UserMfaMethod, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, WorkflowType, WorkflowItemType };
|
|
23663
24075
|
//# sourceMappingURL=bruce-models.es5.js.map
|