bruce-models 7.1.104 → 7.1.106

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.
@@ -96,6 +96,10 @@
96
96
  ECacheKey["EntityHistoricDataPage"] = "entityhistoricdatapage";
97
97
  ECacheKey["AccountLimits"] = "accountlimits";
98
98
  ECacheKey["WorkflowType"] = "workflowtype";
99
+ ECacheKey["WorkflowStatus"] = "workflowstatus";
100
+ ECacheKey["WorkflowQueue"] = "workflowqueue";
101
+ ECacheKey["WorkflowItem"] = "workflowitem";
102
+ ECacheKey["WorkflowSchedule"] = "workflowschedule";
99
103
  })(ECacheKey = Api.ECacheKey || (Api.ECacheKey = {}));
100
104
  // 1 minute.
101
105
  Api.DEFAULT_CACHE_DURATION = 60 * 1000;
@@ -368,6 +372,7 @@
368
372
  EConcept["WORKFLOW_ITEM_STATUS"] = "wis";
369
373
  EConcept["WORKFLOW_ITEM_TYPE"] = "wit";
370
374
  EConcept["WORKFLOW_QUEUE"] = "wq";
375
+ EConcept["WORKFLOW_SCHEDULE"] = "ws";
371
376
  })(EConcept = AccountConcept.EConcept || (AccountConcept.EConcept = {}));
372
377
  let EAction;
373
378
  (function (EAction) {
@@ -699,6 +704,16 @@
699
704
  return [exports.Api.ECacheKey.ProjectView, exports.Api.ECacheKey.ProjectViewBookmark];
700
705
  case exports.AccountConcept.EConcept.RELATION_TYPE:
701
706
  return [exports.Api.ECacheKey.RelationType];
707
+ case exports.AccountConcept.EConcept.WORKFLOW_ITEM:
708
+ return [exports.Api.ECacheKey.WorkflowItem];
709
+ case exports.AccountConcept.EConcept.WORKFLOW_ITEM_STATUS:
710
+ return [exports.Api.ECacheKey.WorkflowStatus, exports.Api.ECacheKey.WorkflowType, exports.Api.ECacheKey.WorkflowItem];
711
+ case exports.AccountConcept.EConcept.WORKFLOW_ITEM_TYPE:
712
+ return [exports.Api.ECacheKey.WorkflowType, exports.Api.ECacheKey.WorkflowItem, exports.Api.ECacheKey.WorkflowSchedule];
713
+ case exports.AccountConcept.EConcept.WORKFLOW_QUEUE:
714
+ return [exports.Api.ECacheKey.WorkflowQueue, exports.Api.ECacheKey.WorkflowType, exports.Api.ECacheKey.WorkflowItem, exports.Api.ECacheKey.WorkflowSchedule];
715
+ case exports.AccountConcept.EConcept.WORKFLOW_SCHEDULE:
716
+ return [exports.Api.ECacheKey.WorkflowSchedule, exports.Api.ECacheKey.WorkflowItem];
702
717
  case exports.AccountConcept.EConcept.TILESET:
703
718
  return [exports.Api.ECacheKey.Tileset, exports.Api.ECacheKey.PublishTileset, exports.Api.ECacheKey.TilesetAccess];
704
719
  case exports.AccountConcept.EConcept.UI_ENTITY_DISPLAY_SETTING:
@@ -14235,6 +14250,15 @@
14235
14250
  EPolygonExtrusionType["Path"] = "PATH";
14236
14251
  EPolygonExtrusionType["Texture"] = "TEXTURE";
14237
14252
  })(EPolygonExtrusionType = Style.EPolygonExtrusionType || (Style.EPolygonExtrusionType = {}));
14253
+ /**
14254
+ * A look a renderer may put over a polygon, on top of whatever its fill already decided.
14255
+ * Default is "NONE".
14256
+ */
14257
+ let EEffectType;
14258
+ (function (EEffectType) {
14259
+ EEffectType["None"] = "NONE";
14260
+ EEffectType["Water"] = "WATER";
14261
+ })(EEffectType = Style.EEffectType || (Style.EEffectType = {}));
14238
14262
  /**
14239
14263
  * Returns a list of styles.
14240
14264
  * @param params
@@ -17343,7 +17367,7 @@
17343
17367
  try {
17344
17368
  const data = yield api.GET(`ontology/${ontologyId}`, exports.Api.PrepReqParams(reqParams));
17345
17369
  res({
17346
- ontology: ParseResponse(data)
17370
+ ontology: data
17347
17371
  });
17348
17372
  }
17349
17373
  catch (e) {
@@ -17371,10 +17395,11 @@
17371
17395
  return cache.data;
17372
17396
  }
17373
17397
  const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
17398
+ var _a;
17374
17399
  try {
17375
17400
  const data = yield api.GET("ontologies", exports.Api.PrepReqParams(reqParams));
17376
17401
  res({
17377
- ontologies: ParseListResponse(data)
17402
+ ontologies: (_a = data === null || data === void 0 ? void 0 : data.Items) !== null && _a !== void 0 ? _a : []
17378
17403
  });
17379
17404
  }
17380
17405
  catch (e) {
@@ -17406,7 +17431,7 @@
17406
17431
  api.Cache.Remove(GetCacheKey(data.ID));
17407
17432
  api.Cache.RemoveByStartsWith(GetListCacheKey());
17408
17433
  return {
17409
- ontology: ParseResponse(res)
17434
+ ontology: res
17410
17435
  };
17411
17436
  });
17412
17437
  }
@@ -17443,24 +17468,52 @@
17443
17468
  });
17444
17469
  }
17445
17470
  Ontology.Describe = Describe;
17446
- function ParseResponse(response) {
17447
- var _a, _b, _c, _d, _e, _f;
17448
- const parsed = parseObject$5(response);
17449
- const parsedResult = (_a = parseObject$5(parsed === null || parsed === void 0 ? void 0 : parsed.Result)) !== null && _a !== void 0 ? _a : parsed === null || parsed === void 0 ? void 0 : parsed.Result;
17450
- return (_f = (_e = (_d = (_c = (_b = parsed === null || parsed === void 0 ? void 0 : parsed.Ontology) !== null && _b !== void 0 ? _b : parsed === null || parsed === void 0 ? void 0 : parsed.BruceOntology) !== null && _c !== void 0 ? _c : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.Ontology) !== null && _d !== void 0 ? _d : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.BruceOntology) !== null && _e !== void 0 ? _e : parsedResult) !== null && _f !== void 0 ? _f : parsed;
17451
- }
17452
- Ontology.ParseResponse = ParseResponse;
17453
- function ParseListResponse(response) {
17454
- var _a, _b, _c, _d, _e, _f, _g, _h;
17455
- const parsed = parseObject$5(response);
17456
- const parsedResult = (_a = parseObject$5(parsed === null || parsed === void 0 ? void 0 : parsed.Result)) !== null && _a !== void 0 ? _a : parsed === null || parsed === void 0 ? void 0 : parsed.Result;
17457
- const list = (_h = (_g = (_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 : parsed === null || parsed === void 0 ? void 0 : parsed.Ontologies) !== null && _d !== void 0 ? _d : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.Ontologies) !== null && _e !== void 0 ? _e : parsed === null || parsed === void 0 ? void 0 : parsed.BruceOntologies) !== null && _f !== void 0 ? _f : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.BruceOntologies) !== null && _g !== void 0 ? _g : parsedResult) !== null && _h !== void 0 ? _h : parsed;
17458
- if (Array.isArray(list)) {
17459
- return list;
17460
- }
17461
- return [];
17471
+ /**
17472
+ * Reads an Ontology Diagram's records in one request.
17473
+ */
17474
+ function GetConnections(params) {
17475
+ return __awaiter(this, void 0, void 0, function* () {
17476
+ let { api, ontologyId, unassigned, entityTypeIds, depth, includeImports, includeParents, req: reqParams } = params;
17477
+ if (!api) {
17478
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
17479
+ }
17480
+ const hasEntityTypeIds = Array.isArray(entityTypeIds) && entityTypeIds.length > 0;
17481
+ if ((ontologyId == null || ontologyId === "") && !unassigned && !hasEntityTypeIds) {
17482
+ throw ("One of ontologyId, unassigned or entityTypeIds is required.");
17483
+ }
17484
+ const urlParams = new URLSearchParams();
17485
+ if (includeImports) {
17486
+ urlParams.append("IncludeImports", "true");
17487
+ }
17488
+ let url;
17489
+ if (!unassigned && !hasEntityTypeIds) {
17490
+ url = `ontology/${ontologyId}/connections`;
17491
+ }
17492
+ else {
17493
+ if (ontologyId != null && ontologyId !== "") {
17494
+ urlParams.append("Ontology.ID", String(ontologyId));
17495
+ }
17496
+ if (unassigned) {
17497
+ urlParams.append("Unassigned", "true");
17498
+ }
17499
+ for (const id of entityTypeIds !== null && entityTypeIds !== void 0 ? entityTypeIds : []) {
17500
+ urlParams.append("EntityType.ID", id);
17501
+ }
17502
+ if (depth != null) {
17503
+ urlParams.append("Depth", String(depth));
17504
+ }
17505
+ if (includeParents) {
17506
+ urlParams.append("IncludeParents", "true");
17507
+ }
17508
+ url = "ontologyConnections";
17509
+ }
17510
+ const query = urlParams.toString();
17511
+ return {
17512
+ connections: yield api.GET(query ? `${url}?${query}` : url, exports.Api.PrepReqParams(reqParams))
17513
+ };
17514
+ });
17462
17515
  }
17463
- Ontology.ParseListResponse = ParseListResponse;
17516
+ Ontology.GetConnections = GetConnections;
17464
17517
  function GetCacheKey(id) {
17465
17518
  return `${exports.Api.ECacheKey.Ontology}${exports.Api.ECacheKey.Id}${id}`;
17466
17519
  }
@@ -17470,20 +17523,6 @@
17470
17523
  }
17471
17524
  Ontology.GetListCacheKey = GetListCacheKey;
17472
17525
  })(exports.Ontology || (exports.Ontology = {}));
17473
- function parseObject$5(data) {
17474
- if (data == null || data == undefined) {
17475
- return null;
17476
- }
17477
- if (typeof data == "string") {
17478
- try {
17479
- return JSON.parse(data);
17480
- }
17481
- catch (_a) {
17482
- return null;
17483
- }
17484
- }
17485
- return data;
17486
- }
17487
17526
 
17488
17527
  (function (ExportBrz) {
17489
17528
  function Export(params) {
@@ -23599,6 +23638,365 @@
23599
23638
  UrlUtils.ConstructUrl = ConstructUrl;
23600
23639
  })(exports.UrlUtils || (exports.UrlUtils = {}));
23601
23640
 
23641
+ (function (WorkflowItem) {
23642
+ function Get(params) {
23643
+ return __awaiter(this, void 0, void 0, function* () {
23644
+ let { api, workflowItemId, req } = params;
23645
+ if (isInvalidId(workflowItemId)) {
23646
+ throw ("Workflow Item ID is required.");
23647
+ }
23648
+ if (!api) {
23649
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
23650
+ }
23651
+ const key = GetCacheKey(workflowItemId);
23652
+ const cache = api.GetCacheItem(key, req);
23653
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
23654
+ return cache.data;
23655
+ }
23656
+ const request = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
23657
+ try {
23658
+ const data = yield api.GET(`workflow/item/${workflowItemId}`, exports.Api.PrepReqParams(req));
23659
+ res({ workflowItem: ParseResponse(data) });
23660
+ }
23661
+ catch (e) {
23662
+ rej(e);
23663
+ }
23664
+ }));
23665
+ api.SetCacheItem({ key, value: request, req });
23666
+ return request;
23667
+ });
23668
+ }
23669
+ WorkflowItem.Get = Get;
23670
+ function GetList(params) {
23671
+ return __awaiter(this, void 0, void 0, function* () {
23672
+ if (!params) {
23673
+ params = {};
23674
+ }
23675
+ let { api, req } = params;
23676
+ if (!api) {
23677
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
23678
+ }
23679
+ const url = BuildListUrl(params);
23680
+ const key = GetListCacheKey(params);
23681
+ const cache = api.GetCacheItem(key, req);
23682
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
23683
+ return cache.data;
23684
+ }
23685
+ const request = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
23686
+ try {
23687
+ const data = yield api.GET(url, exports.Api.PrepReqParams(req));
23688
+ res(ParseListResponse(data));
23689
+ }
23690
+ catch (e) {
23691
+ rej(e);
23692
+ }
23693
+ }));
23694
+ api.SetCacheItem({ key, value: request, req });
23695
+ return request;
23696
+ });
23697
+ }
23698
+ WorkflowItem.GetList = GetList;
23699
+ function Create(params) {
23700
+ var _a, _b, _c, _d, _e;
23701
+ return __awaiter(this, void 0, void 0, function* () {
23702
+ let { api, workflowItemTypeId, entityTypeId, workflowItem, req } = params;
23703
+ if (!api) {
23704
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
23705
+ }
23706
+ if (!workflowItem) {
23707
+ workflowItem = {};
23708
+ }
23709
+ const typeId = (_c = (_b = (_a = workflowItemTypeId !== null && workflowItemTypeId !== void 0 ? workflowItemTypeId : workflowItem["Workflow.ItemType.ID"]) !== null && _a !== void 0 ? _a : workflowItem["ItemType.ID"]) !== null && _b !== void 0 ? _b : workflowItem.WorkflowItemTypeID) !== null && _c !== void 0 ? _c : workflowItem.ItemTypeID;
23710
+ if (isInvalidId(typeId)) {
23711
+ throw ("Workflow Item Type ID is required.");
23712
+ }
23713
+ const typePath = encodePath(typeId);
23714
+ const entityTypePath = encodePath((_d = entityTypeId !== null && entityTypeId !== void 0 ? entityTypeId : workflowItem["EntityType.ID"]) !== null && _d !== void 0 ? _d : "");
23715
+ const data = yield api.POST(`workflow/createnew/${typePath}/${entityTypePath}`, workflowItem, exports.Api.PrepReqParams(req));
23716
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.WorkflowItem);
23717
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Entity);
23718
+ return {
23719
+ workflowItem: ParseResponse(data),
23720
+ entity: (_e = parseObject$5(data)) === null || _e === void 0 ? void 0 : _e.Entity
23721
+ };
23722
+ });
23723
+ }
23724
+ WorkflowItem.Create = Create;
23725
+ function Update(params) {
23726
+ return __awaiter(this, void 0, void 0, function* () {
23727
+ let { api, workflowItem, req } = params;
23728
+ if (!api) {
23729
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
23730
+ }
23731
+ if (!workflowItem) {
23732
+ workflowItem = {};
23733
+ }
23734
+ const id = workflowItem.ID && workflowItem.ID > 0 ? workflowItem.ID : 0;
23735
+ const data = yield api.POST(`workflow/item/${id}`, workflowItem, exports.Api.PrepReqParams(req));
23736
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.WorkflowItem);
23737
+ if (workflowItem["Entity.ID"]) {
23738
+ api.Cache.RemoveByStartsWith(`${exports.Api.ECacheKey.Entity}${exports.Api.ECacheKey.Id}${workflowItem["Entity.ID"]}`);
23739
+ }
23740
+ return { workflowItem: ParseResponse(data) };
23741
+ });
23742
+ }
23743
+ WorkflowItem.Update = Update;
23744
+ function Delete(params) {
23745
+ return __awaiter(this, void 0, void 0, function* () {
23746
+ let { api, workflowItemId, req } = params;
23747
+ if (isInvalidId(workflowItemId)) {
23748
+ throw ("Workflow Item ID is required.");
23749
+ }
23750
+ if (!api) {
23751
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
23752
+ }
23753
+ yield api.DELETE(`workflow/item/${workflowItemId}`, exports.Api.PrepReqParams(req));
23754
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.WorkflowItem);
23755
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.Entity);
23756
+ });
23757
+ }
23758
+ WorkflowItem.Delete = Delete;
23759
+ function BuildListUrl(params) {
23760
+ var _a;
23761
+ const q = new URLSearchParams();
23762
+ appendParam(q, "pageSize", params === null || params === void 0 ? void 0 : params.pageSize);
23763
+ appendParam(q, "pageIndex", params === null || params === void 0 ? void 0 : params.pageIndex);
23764
+ appendParam(q, "OrderBy", params === null || params === void 0 ? void 0 : params.orderBy);
23765
+ appendParam(q, "SortOrder", params === null || params === void 0 ? void 0 : params.sortOrder);
23766
+ appendParam(q, "statusend", params === null || params === void 0 ? void 0 : params.statusEnd);
23767
+ appendParam(q, "assignedtome", params === null || params === void 0 ? void 0 : params.assignedToMe);
23768
+ appendParam(q, "itemtypeid", params === null || params === void 0 ? void 0 : params.itemTypeId);
23769
+ appendParam(q, "queueid", params === null || params === void 0 ? void 0 : params.queueId);
23770
+ appendParam(q, "scheduleid", (_a = params === null || params === void 0 ? void 0 : params.scheduleId) !== null && _a !== void 0 ? _a : params === null || params === void 0 ? void 0 : params.workflowScheduleId);
23771
+ appendParam(q, "statusid", params === null || params === void 0 ? void 0 : params.statusId);
23772
+ appendParam(q, "CreatedByUserID", params === null || params === void 0 ? void 0 : params.createdByUserId);
23773
+ appendParam(q, "DueDate", params === null || params === void 0 ? void 0 : params.dueDate);
23774
+ appendParam(q, "DueDateFrom", params === null || params === void 0 ? void 0 : params.dueDateFrom);
23775
+ appendParam(q, "DueDateTo", params === null || params === void 0 ? void 0 : params.dueDateTo);
23776
+ appendParam(q, "SlideID", params === null || params === void 0 ? void 0 : params.slideId);
23777
+ appendParam(q, "EntityID", params === null || params === void 0 ? void 0 : params.entityId);
23778
+ appendParam(q, "SubjectEntityID", params === null || params === void 0 ? void 0 : params.subjectEntityId);
23779
+ appendParam(q, "Description", params === null || params === void 0 ? void 0 : params.description);
23780
+ appendParam(q, "Search", params === null || params === void 0 ? void 0 : params.search);
23781
+ const qs = q.toString();
23782
+ return qs ? `workflow/itemsquery?${qs}` : "workflow/itemsquery";
23783
+ }
23784
+ WorkflowItem.BuildListUrl = BuildListUrl;
23785
+ function ParseResponse(response) {
23786
+ var _a, _b, _c, _d;
23787
+ const parsed = parseObject$5(response);
23788
+ const parsedResult = (_a = parseObject$5(parsed === null || parsed === void 0 ? void 0 : parsed.Result)) !== null && _a !== void 0 ? _a : parsed === null || parsed === void 0 ? void 0 : parsed.Result;
23789
+ return (_d = (_c = (_b = parsed === null || parsed === void 0 ? void 0 : parsed.WorkflowItem) !== null && _b !== void 0 ? _b : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.WorkflowItem) !== null && _c !== void 0 ? _c : parsedResult) !== null && _d !== void 0 ? _d : parsed;
23790
+ }
23791
+ WorkflowItem.ParseResponse = ParseResponse;
23792
+ function ParseListResponse(response) {
23793
+ var _a;
23794
+ const parsed = parseObject$5(response);
23795
+ const parsedResult = (_a = parseObject$5(parsed === null || parsed === void 0 ? void 0 : parsed.Result)) !== null && _a !== void 0 ? _a : parsed === null || parsed === void 0 ? void 0 : parsed.Result;
23796
+ const source = parsedResult !== null && parsedResult !== void 0 ? parsedResult : parsed;
23797
+ const items = Array.isArray(source)
23798
+ ? source
23799
+ : Array.isArray(source === null || source === void 0 ? void 0 : source.Items)
23800
+ ? source.Items
23801
+ : [];
23802
+ return {
23803
+ items,
23804
+ totalCount: source === null || source === void 0 ? void 0 : source.TotalCount,
23805
+ nextPage: source === null || source === void 0 ? void 0 : source.NextPage,
23806
+ nextPageUrl: source === null || source === void 0 ? void 0 : source.NextPageURL
23807
+ };
23808
+ }
23809
+ WorkflowItem.ParseListResponse = ParseListResponse;
23810
+ function GetCacheKey(id) {
23811
+ return `${exports.Api.ECacheKey.WorkflowItem}${exports.Api.ECacheKey.Id}${id}`;
23812
+ }
23813
+ WorkflowItem.GetCacheKey = GetCacheKey;
23814
+ function GetListCacheKey(params) {
23815
+ return `${exports.Api.ECacheKey.WorkflowItem}${exports.Api.ECacheKey.ListId}${BuildListUrl(params)}`;
23816
+ }
23817
+ WorkflowItem.GetListCacheKey = GetListCacheKey;
23818
+ })(exports.WorkflowItem || (exports.WorkflowItem = {}));
23819
+ function appendParam(q, key, value) {
23820
+ if (value == null || value === "") {
23821
+ return;
23822
+ }
23823
+ if (Array.isArray(value)) {
23824
+ if (value.length) {
23825
+ q.append(key, value.join(","));
23826
+ }
23827
+ return;
23828
+ }
23829
+ q.append(key, String(value));
23830
+ }
23831
+ function parseObject$5(data) {
23832
+ if (data == null || data == undefined) {
23833
+ return null;
23834
+ }
23835
+ if (typeof data == "string") {
23836
+ try {
23837
+ return JSON.parse(data);
23838
+ }
23839
+ catch (_a) {
23840
+ return null;
23841
+ }
23842
+ }
23843
+ return data;
23844
+ }
23845
+ function isInvalidId(id) {
23846
+ return id == null || id === "" || !isFinite(Number(id)) || Number(id) <= 0;
23847
+ }
23848
+ function encodePath(value) {
23849
+ return encodeURIComponent(String(value !== null && value !== void 0 ? value : ""));
23850
+ }
23851
+
23852
+ (function (WorkflowSchedule) {
23853
+ function Get(params) {
23854
+ return __awaiter(this, void 0, void 0, function* () {
23855
+ let { api, workflowScheduleId, req } = params;
23856
+ if (isInvalidId$1(workflowScheduleId)) {
23857
+ throw ("Workflow Schedule ID is required.");
23858
+ }
23859
+ if (!api) {
23860
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
23861
+ }
23862
+ const key = GetCacheKey(workflowScheduleId);
23863
+ const cache = api.GetCacheItem(key, req);
23864
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
23865
+ return cache.data;
23866
+ }
23867
+ const request = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
23868
+ try {
23869
+ const data = yield api.GET(`workflow/schedule/${workflowScheduleId}`, exports.Api.PrepReqParams(req));
23870
+ res({ workflowSchedule: ParseResponse(data) });
23871
+ }
23872
+ catch (e) {
23873
+ rej(e);
23874
+ }
23875
+ }));
23876
+ api.SetCacheItem({ key, value: request, req });
23877
+ return request;
23878
+ });
23879
+ }
23880
+ WorkflowSchedule.Get = Get;
23881
+ function GetList(params) {
23882
+ return __awaiter(this, void 0, void 0, function* () {
23883
+ if (!params) {
23884
+ params = {};
23885
+ }
23886
+ let { api, req } = params;
23887
+ if (!api) {
23888
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
23889
+ }
23890
+ const key = GetListCacheKey();
23891
+ const cache = api.GetCacheItem(key, req);
23892
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
23893
+ return cache.data;
23894
+ }
23895
+ const request = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
23896
+ try {
23897
+ const data = yield api.GET("workflow/schedules", exports.Api.PrepReqParams(req));
23898
+ res({ workflowSchedules: ParseListResponse(data) });
23899
+ }
23900
+ catch (e) {
23901
+ rej(e);
23902
+ }
23903
+ }));
23904
+ api.SetCacheItem({ key, value: request, req });
23905
+ return request;
23906
+ });
23907
+ }
23908
+ WorkflowSchedule.GetList = GetList;
23909
+ function Update(params) {
23910
+ return __awaiter(this, void 0, void 0, function* () {
23911
+ let { api, workflowSchedule, req } = params;
23912
+ if (!api) {
23913
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
23914
+ }
23915
+ if (!workflowSchedule) {
23916
+ workflowSchedule = {};
23917
+ }
23918
+ const id = workflowSchedule.ID && workflowSchedule.ID > 0 ? workflowSchedule.ID : 0;
23919
+ const data = yield api.POST(`workflow/schedule/${id}`, workflowSchedule, exports.Api.PrepReqParams(req));
23920
+ const parsed = ParseResponse(data);
23921
+ api.Cache.Remove(GetListCacheKey());
23922
+ if (id > 0) {
23923
+ api.Cache.Remove(GetCacheKey(id));
23924
+ }
23925
+ if (parsed === null || parsed === void 0 ? void 0 : parsed.ID) {
23926
+ api.Cache.Remove(GetCacheKey(parsed.ID));
23927
+ }
23928
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.WorkflowItem);
23929
+ return { workflowSchedule: parsed };
23930
+ });
23931
+ }
23932
+ WorkflowSchedule.Update = Update;
23933
+ function Delete(params) {
23934
+ return __awaiter(this, void 0, void 0, function* () {
23935
+ let { api, workflowScheduleId, req } = params;
23936
+ if (isInvalidId$1(workflowScheduleId)) {
23937
+ throw ("Workflow Schedule ID is required.");
23938
+ }
23939
+ if (!api) {
23940
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
23941
+ }
23942
+ yield api.DELETE(`workflow/schedule/${workflowScheduleId}`, exports.Api.PrepReqParams(req));
23943
+ api.Cache.Remove(GetCacheKey(workflowScheduleId));
23944
+ api.Cache.Remove(GetListCacheKey());
23945
+ api.Cache.RemoveByStartsWith(exports.Api.ECacheKey.WorkflowItem);
23946
+ });
23947
+ }
23948
+ WorkflowSchedule.Delete = Delete;
23949
+ function ParseResponse(response) {
23950
+ var _a, _b, _c, _d;
23951
+ const parsed = parseObject$6(response);
23952
+ 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;
23953
+ return (_d = (_c = (_b = parsed === null || parsed === void 0 ? void 0 : parsed.WorkflowSchedule) !== null && _b !== void 0 ? _b : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.WorkflowSchedule) !== null && _c !== void 0 ? _c : parsedResult) !== null && _d !== void 0 ? _d : parsed;
23954
+ }
23955
+ WorkflowSchedule.ParseResponse = ParseResponse;
23956
+ function ParseListResponse(response) {
23957
+ var _a;
23958
+ const parsed = parseObject$6(response);
23959
+ 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;
23960
+ const source = parsedResult !== null && parsedResult !== void 0 ? parsedResult : parsed;
23961
+ if (Array.isArray(source === null || source === void 0 ? void 0 : source.Items)) {
23962
+ return source.Items;
23963
+ }
23964
+ if (Array.isArray(source === null || source === void 0 ? void 0 : source.WorkflowSchedules)) {
23965
+ return source.WorkflowSchedules;
23966
+ }
23967
+ if (Array.isArray(source)) {
23968
+ return source;
23969
+ }
23970
+ return [];
23971
+ }
23972
+ WorkflowSchedule.ParseListResponse = ParseListResponse;
23973
+ function GetCacheKey(id) {
23974
+ return `${exports.Api.ECacheKey.WorkflowSchedule}${exports.Api.ECacheKey.Id}${id}`;
23975
+ }
23976
+ WorkflowSchedule.GetCacheKey = GetCacheKey;
23977
+ function GetListCacheKey() {
23978
+ return exports.Api.ECacheKey.WorkflowSchedule;
23979
+ }
23980
+ WorkflowSchedule.GetListCacheKey = GetListCacheKey;
23981
+ })(exports.WorkflowSchedule || (exports.WorkflowSchedule = {}));
23982
+ function parseObject$6(data) {
23983
+ if (data == null || data == undefined) {
23984
+ return null;
23985
+ }
23986
+ if (typeof data == "string") {
23987
+ try {
23988
+ return JSON.parse(data);
23989
+ }
23990
+ catch (_a) {
23991
+ return null;
23992
+ }
23993
+ }
23994
+ return data;
23995
+ }
23996
+ function isInvalidId$1(id) {
23997
+ return id == null || id === "" || !isFinite(Number(id)) || Number(id) <= 0;
23998
+ }
23999
+
23602
24000
  (function (WorkflowType) {
23603
24001
  /**
23604
24002
  * Gets a workflow type by ID.
@@ -23607,7 +24005,7 @@
23607
24005
  function Get(params) {
23608
24006
  return __awaiter(this, void 0, void 0, function* () {
23609
24007
  let { api, workflowTypeId, req: reqParams } = params;
23610
- if (isInvalidId(workflowTypeId)) {
24008
+ if (isInvalidId$2(workflowTypeId)) {
23611
24009
  throw ("Workflow Type ID is required.");
23612
24010
  }
23613
24011
  if (!api) {
@@ -23713,7 +24111,7 @@
23713
24111
  function Delete(params) {
23714
24112
  return __awaiter(this, void 0, void 0, function* () {
23715
24113
  let { api, workflowTypeId, req: reqParams } = params;
23716
- if (isInvalidId(workflowTypeId)) {
24114
+ if (isInvalidId$2(workflowTypeId)) {
23717
24115
  throw ("Workflow Type ID is required.");
23718
24116
  }
23719
24117
  if (!api) {
@@ -23733,7 +24131,7 @@
23733
24131
  function GetStatuses(params) {
23734
24132
  return __awaiter(this, void 0, void 0, function* () {
23735
24133
  let { api, workflowTypeId, req: reqParams } = params;
23736
- if (isInvalidId(workflowTypeId)) {
24134
+ if (isInvalidId$2(workflowTypeId)) {
23737
24135
  throw ("Workflow Type ID is required.");
23738
24136
  }
23739
24137
  if (!api) {
@@ -23771,7 +24169,7 @@
23771
24169
  function AddStatuses(params) {
23772
24170
  return __awaiter(this, void 0, void 0, function* () {
23773
24171
  let { api, workflowTypeId, workflowStatusIds, req: reqParams } = params;
23774
- if (isInvalidId(workflowTypeId)) {
24172
+ if (isInvalidId$2(workflowTypeId)) {
23775
24173
  throw ("Workflow Type ID is required.");
23776
24174
  }
23777
24175
  if (!(workflowStatusIds === null || workflowStatusIds === void 0 ? void 0 : workflowStatusIds.length)) {
@@ -23795,7 +24193,7 @@
23795
24193
  function RemoveStatuses(params) {
23796
24194
  return __awaiter(this, void 0, void 0, function* () {
23797
24195
  let { api, workflowTypeId, workflowStatusIds, req: reqParams } = params;
23798
- if (isInvalidId(workflowTypeId)) {
24196
+ if (isInvalidId$2(workflowTypeId)) {
23799
24197
  throw ("Workflow Type ID is required.");
23800
24198
  }
23801
24199
  if (!(workflowStatusIds === null || workflowStatusIds === void 0 ? void 0 : workflowStatusIds.length)) {
@@ -23817,8 +24215,8 @@
23817
24215
  */
23818
24216
  function ParseResponse(response) {
23819
24217
  var _a, _b, _c, _d, _e, _f, _g, _h;
23820
- const parsed = parseObject$6(response);
23821
- 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;
24218
+ const parsed = parseObject$7(response);
24219
+ const parsedResult = (_a = parseObject$7(parsed === null || parsed === void 0 ? void 0 : parsed.Result)) !== null && _a !== void 0 ? _a : parsed === null || parsed === void 0 ? void 0 : parsed.Result;
23822
24220
  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;
23823
24221
  }
23824
24222
  WorkflowType.ParseResponse = ParseResponse;
@@ -23865,7 +24263,7 @@
23865
24263
  })(exports.WorkflowType || (exports.WorkflowType = {}));
23866
24264
  // Alias that mirrors the API route/model wording.
23867
24265
  var WorkflowItemType = exports.WorkflowType;
23868
- function parseObject$6(data) {
24266
+ function parseObject$7(data) {
23869
24267
  if (data == null || data == undefined) {
23870
24268
  return null;
23871
24269
  }
@@ -23879,13 +24277,13 @@
23879
24277
  }
23880
24278
  return data;
23881
24279
  }
23882
- function isInvalidId(id) {
24280
+ function isInvalidId$2(id) {
23883
24281
  return id == null || id === "" || !isFinite(Number(id)) || Number(id) <= 0;
23884
24282
  }
23885
24283
  function parseList(response, wrapperKeys) {
23886
24284
  var _a, _b, _c, _d, _e, _f;
23887
- const parsed = parseObject$6(response);
23888
- 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;
24285
+ const parsed = parseObject$7(response);
24286
+ const parsedResult = (_a = parseObject$7(parsed === null || parsed === void 0 ? void 0 : parsed.Result)) !== null && _a !== void 0 ? _a : parsed === null || parsed === void 0 ? void 0 : parsed.Result;
23889
24287
  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;
23890
24288
  if (Array.isArray(list)) {
23891
24289
  return list;
@@ -23905,7 +24303,7 @@
23905
24303
  }
23906
24304
 
23907
24305
  // This is updated with the package.json version on build.
23908
- const VERSION = "7.1.104";
24306
+ const VERSION = "7.1.106";
23909
24307
 
23910
24308
  exports.VERSION = VERSION;
23911
24309
  exports.AbstractApi = AbstractApi;