bruce-models 7.1.97 → 7.1.99

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.
@@ -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;
@@ -16983,13 +16984,21 @@ var EntityTypeTrigger;
16983
16984
  EType["DataLabQuery"] = "DataLabQuery";
16984
16985
  EType["WorkflowTicket"] = "WorkflowTicket";
16985
16986
  })(EType = EntityTypeTrigger.EType || (EntityTypeTrigger.EType = {}));
16987
+ /**
16988
+ * Builds the Settings payload for a WorkflowTicket trigger.
16989
+ * @param params
16990
+ */
16986
16991
  function BuildWorkflowTicketSettings(params) {
16987
16992
  var _a;
16988
16993
  const settings = Object.assign(Object.assign({}, ((_a = params.extraSettings) !== null && _a !== void 0 ? _a : {})), { Condition: params.condition, WorkflowTicket: {
16989
- "Workflow.ItemType.ID": params.workflowItemTypeId,
16990
- "Workflow.Queue.ID": params.queueId,
16991
- "Workflow.ItemStatus.ID": params.statusId
16994
+ "Workflow.ItemType.ID": params.workflowItemTypeId
16992
16995
  } });
16996
+ if (params.queueId != null && params.queueId !== "") {
16997
+ settings.WorkflowTicket["Workflow.Queue.ID"] = params.queueId;
16998
+ }
16999
+ if (params.statusId != null && params.statusId !== "") {
17000
+ settings.WorkflowTicket["Workflow.ItemStatus.ID"] = params.statusId;
17001
+ }
16993
17002
  if (params.description != null && params.description !== "") {
16994
17003
  settings.WorkflowTicket.Description = params.description;
16995
17004
  }
@@ -23648,8 +23657,318 @@ var UrlUtils;
23648
23657
  UrlUtils.ConstructUrl = ConstructUrl;
23649
23658
  })(UrlUtils || (UrlUtils = {}));
23650
23659
 
23660
+ /**
23661
+ * Describes the "Workflow Type" concept within Nextspace.
23662
+ * The API names this record Workflow Item Type.
23663
+ */
23664
+ var WorkflowType;
23665
+ (function (WorkflowType) {
23666
+ /**
23667
+ * Gets a workflow type by ID.
23668
+ * @param params
23669
+ */
23670
+ function Get(params) {
23671
+ return __awaiter(this, void 0, void 0, function* () {
23672
+ let { api, workflowTypeId, req: reqParams } = params;
23673
+ if (isInvalidId(workflowTypeId)) {
23674
+ throw ("Workflow Type ID is required.");
23675
+ }
23676
+ if (!api) {
23677
+ api = ENVIRONMENT.Api().GetBruceApi();
23678
+ }
23679
+ const key = GetCacheKey(workflowTypeId);
23680
+ const cache = api.GetCacheItem(key, reqParams);
23681
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
23682
+ return cache.data;
23683
+ }
23684
+ const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
23685
+ try {
23686
+ const data = yield api.GET(`workflow/type/${workflowTypeId}`, Api.PrepReqParams(reqParams));
23687
+ res({
23688
+ workflowType: ParseResponse(data)
23689
+ });
23690
+ }
23691
+ catch (e) {
23692
+ rej(e);
23693
+ }
23694
+ }));
23695
+ api.SetCacheItem({
23696
+ key,
23697
+ value: req,
23698
+ req: reqParams
23699
+ });
23700
+ return req;
23701
+ });
23702
+ }
23703
+ WorkflowType.Get = Get;
23704
+ /**
23705
+ * Gets all workflow types.
23706
+ * @param params
23707
+ */
23708
+ function GetList(params) {
23709
+ return __awaiter(this, void 0, void 0, function* () {
23710
+ if (!params) {
23711
+ params = {};
23712
+ }
23713
+ let { api, req: reqParams } = params;
23714
+ if (!api) {
23715
+ api = ENVIRONMENT.Api().GetBruceApi();
23716
+ }
23717
+ const key = GetListCacheKey();
23718
+ const cache = api.GetCacheItem(key, reqParams);
23719
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
23720
+ return cache.data;
23721
+ }
23722
+ const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
23723
+ try {
23724
+ const data = yield api.GET("workflow/types", Api.PrepReqParams(reqParams));
23725
+ res({
23726
+ workflowTypes: ParseListResponse(data)
23727
+ });
23728
+ }
23729
+ catch (e) {
23730
+ rej(e);
23731
+ }
23732
+ }));
23733
+ api.SetCacheItem({
23734
+ key,
23735
+ value: req,
23736
+ req: reqParams
23737
+ });
23738
+ return req;
23739
+ });
23740
+ }
23741
+ WorkflowType.GetList = GetList;
23742
+ /**
23743
+ * Creates or updates a workflow type.
23744
+ * This calls: POST workflow/type/{workflow_type_id} where 0 creates new.
23745
+ * @param params
23746
+ */
23747
+ function Update(params) {
23748
+ return __awaiter(this, void 0, void 0, function* () {
23749
+ let { api, workflowType: data, req: reqParams } = params;
23750
+ if (!api) {
23751
+ api = ENVIRONMENT.Api().GetBruceApi();
23752
+ }
23753
+ if (!data) {
23754
+ data = {};
23755
+ }
23756
+ const id = data.ID && data.ID > 0 ? data.ID : 0;
23757
+ const res = yield api.POST(`workflow/type/${id}`, data, Api.PrepReqParams(reqParams));
23758
+ const parsed = ParseResponse(res);
23759
+ api.Cache.Remove(GetListCacheKey());
23760
+ if (id > 0) {
23761
+ api.Cache.Remove(GetCacheKey(id));
23762
+ }
23763
+ if (parsed === null || parsed === void 0 ? void 0 : parsed.ID) {
23764
+ api.Cache.Remove(GetCacheKey(parsed.ID));
23765
+ }
23766
+ return {
23767
+ workflowType: parsed
23768
+ };
23769
+ });
23770
+ }
23771
+ WorkflowType.Update = Update;
23772
+ /**
23773
+ * Deletes a workflow type by ID.
23774
+ * @param params
23775
+ */
23776
+ function Delete(params) {
23777
+ return __awaiter(this, void 0, void 0, function* () {
23778
+ let { api, workflowTypeId, req: reqParams } = params;
23779
+ if (isInvalidId(workflowTypeId)) {
23780
+ throw ("Workflow Type ID is required.");
23781
+ }
23782
+ if (!api) {
23783
+ api = ENVIRONMENT.Api().GetBruceApi();
23784
+ }
23785
+ yield api.DELETE(`workflow/type/${workflowTypeId}`, Api.PrepReqParams(reqParams));
23786
+ api.Cache.Remove(GetCacheKey(workflowTypeId));
23787
+ api.Cache.Remove(GetListCacheKey());
23788
+ api.Cache.RemoveByStartsWith(GetStatusesCacheKey(workflowTypeId));
23789
+ });
23790
+ }
23791
+ WorkflowType.Delete = Delete;
23792
+ /**
23793
+ * Gets the workflow statuses enabled for a workflow type.
23794
+ * @param params
23795
+ */
23796
+ function GetStatuses(params) {
23797
+ return __awaiter(this, void 0, void 0, function* () {
23798
+ let { api, workflowTypeId, req: reqParams } = params;
23799
+ if (isInvalidId(workflowTypeId)) {
23800
+ throw ("Workflow Type ID is required.");
23801
+ }
23802
+ if (!api) {
23803
+ api = ENVIRONMENT.Api().GetBruceApi();
23804
+ }
23805
+ const key = GetStatusesCacheKey(workflowTypeId);
23806
+ const cache = api.GetCacheItem(key, reqParams);
23807
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
23808
+ return cache.data;
23809
+ }
23810
+ const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
23811
+ try {
23812
+ const data = yield api.GET(`workflow/type/${workflowTypeId}/statuses`, Api.PrepReqParams(reqParams));
23813
+ res({
23814
+ statuses: ParseStatusListResponse(data)
23815
+ });
23816
+ }
23817
+ catch (e) {
23818
+ rej(e);
23819
+ }
23820
+ }));
23821
+ api.SetCacheItem({
23822
+ key,
23823
+ value: req,
23824
+ req: reqParams
23825
+ });
23826
+ return req;
23827
+ });
23828
+ }
23829
+ WorkflowType.GetStatuses = GetStatuses;
23830
+ /**
23831
+ * Adds statuses to the list enabled for a workflow type.
23832
+ * @param params
23833
+ */
23834
+ function AddStatuses(params) {
23835
+ return __awaiter(this, void 0, void 0, function* () {
23836
+ let { api, workflowTypeId, workflowStatusIds, req: reqParams } = params;
23837
+ if (isInvalidId(workflowTypeId)) {
23838
+ throw ("Workflow Type ID is required.");
23839
+ }
23840
+ if (!(workflowStatusIds === null || workflowStatusIds === void 0 ? void 0 : workflowStatusIds.length)) {
23841
+ throw ("Workflow Status ID is required.");
23842
+ }
23843
+ if (!api) {
23844
+ api = ENVIRONMENT.Api().GetBruceApi();
23845
+ }
23846
+ yield api.POST(`workflow/type/${workflowTypeId}/status/add`, {
23847
+ "WorkflowStatus.ID": workflowStatusIds
23848
+ }, Api.PrepReqParams(reqParams));
23849
+ api.Cache.Remove(GetCacheKey(workflowTypeId));
23850
+ api.Cache.Remove(GetStatusesCacheKey(workflowTypeId));
23851
+ });
23852
+ }
23853
+ WorkflowType.AddStatuses = AddStatuses;
23854
+ /**
23855
+ * Removes statuses from the list enabled for a workflow type.
23856
+ * @param params
23857
+ */
23858
+ function RemoveStatuses(params) {
23859
+ return __awaiter(this, void 0, void 0, function* () {
23860
+ let { api, workflowTypeId, workflowStatusIds, req: reqParams } = params;
23861
+ if (isInvalidId(workflowTypeId)) {
23862
+ throw ("Workflow Type ID is required.");
23863
+ }
23864
+ if (!(workflowStatusIds === null || workflowStatusIds === void 0 ? void 0 : workflowStatusIds.length)) {
23865
+ throw ("Workflow Status ID is required.");
23866
+ }
23867
+ if (!api) {
23868
+ api = ENVIRONMENT.Api().GetBruceApi();
23869
+ }
23870
+ yield api.POST(`workflow/type/${workflowTypeId}/status/remove`, {
23871
+ "WorkflowStatus.ID": workflowStatusIds
23872
+ }, Api.PrepReqParams(reqParams));
23873
+ api.Cache.Remove(GetCacheKey(workflowTypeId));
23874
+ api.Cache.Remove(GetStatusesCacheKey(workflowTypeId));
23875
+ });
23876
+ }
23877
+ WorkflowType.RemoveStatuses = RemoveStatuses;
23878
+ /**
23879
+ * Normalizes response from workflow type get/update endpoints.
23880
+ */
23881
+ function ParseResponse(response) {
23882
+ var _a, _b, _c, _d, _e, _f, _g, _h;
23883
+ const parsed = parseObject$6(response);
23884
+ 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;
23885
+ 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;
23886
+ }
23887
+ WorkflowType.ParseResponse = ParseResponse;
23888
+ /**
23889
+ * Normalizes response from workflow type list endpoints.
23890
+ */
23891
+ function ParseListResponse(response) {
23892
+ return parseList(response, ["WorkflowTypes", "WorkflowItemTypes", "BruceWorkflowItemTypes"]);
23893
+ }
23894
+ WorkflowType.ParseListResponse = ParseListResponse;
23895
+ /**
23896
+ * Normalizes response from workflow type status list endpoints.
23897
+ */
23898
+ function ParseStatusListResponse(response) {
23899
+ return parseList(response, ["Statuses", "WorkflowStatuses", "WorkflowItemStatuses", "BruceWorkflowItemStatuses"]);
23900
+ }
23901
+ WorkflowType.ParseStatusListResponse = ParseStatusListResponse;
23902
+ /**
23903
+ * Returns cache identifier for a workflow type by ID.
23904
+ * @param id
23905
+ * @returns
23906
+ */
23907
+ function GetCacheKey(id) {
23908
+ return `${Api.ECacheKey.WorkflowType}${Api.ECacheKey.Id}${id}`;
23909
+ }
23910
+ WorkflowType.GetCacheKey = GetCacheKey;
23911
+ /**
23912
+ * Returns cache identifier for the workflow type list.
23913
+ * @returns
23914
+ */
23915
+ function GetListCacheKey() {
23916
+ return Api.ECacheKey.WorkflowType;
23917
+ }
23918
+ WorkflowType.GetListCacheKey = GetListCacheKey;
23919
+ /**
23920
+ * Returns cache identifier for the statuses enabled for a workflow type.
23921
+ * @param workflowTypeId
23922
+ * @returns
23923
+ */
23924
+ function GetStatusesCacheKey(workflowTypeId) {
23925
+ return `${Api.ECacheKey.WorkflowType}${Api.ECacheKey.Id}${workflowTypeId}${Api.ECacheKey.ListId}statuses`;
23926
+ }
23927
+ WorkflowType.GetStatusesCacheKey = GetStatusesCacheKey;
23928
+ })(WorkflowType || (WorkflowType = {}));
23929
+ // Alias that mirrors the API route/model wording.
23930
+ var WorkflowItemType = WorkflowType;
23931
+ function parseObject$6(data) {
23932
+ if (data == null || data == undefined) {
23933
+ return null;
23934
+ }
23935
+ if (typeof data == "string") {
23936
+ try {
23937
+ return JSON.parse(data);
23938
+ }
23939
+ catch (_a) {
23940
+ return null;
23941
+ }
23942
+ }
23943
+ return data;
23944
+ }
23945
+ function isInvalidId(id) {
23946
+ return id == null || id === "" || !isFinite(Number(id)) || Number(id) <= 0;
23947
+ }
23948
+ function parseList(response, wrapperKeys) {
23949
+ var _a, _b, _c, _d, _e, _f;
23950
+ const parsed = parseObject$6(response);
23951
+ 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;
23952
+ 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;
23953
+ if (Array.isArray(list)) {
23954
+ return list;
23955
+ }
23956
+ return [];
23957
+ }
23958
+ function getFirstWrappedArray(data, wrapperKeys) {
23959
+ if (!data) {
23960
+ return null;
23961
+ }
23962
+ for (const key of wrapperKeys) {
23963
+ if (Array.isArray(data[key])) {
23964
+ return data[key];
23965
+ }
23966
+ }
23967
+ return null;
23968
+ }
23969
+
23651
23970
  // This is updated with the package.json version on build.
23652
- const VERSION = "7.1.97";
23971
+ const VERSION = "7.1.99";
23653
23972
 
23654
- 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 };
23973
+ 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 };
23655
23974
  //# sourceMappingURL=bruce-models.es5.js.map