bruce-models 7.1.114 → 7.1.116

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/README.md CHANGED
@@ -2,6 +2,50 @@
2
2
 
3
3
  This is a library which defines data-models for the Nextspace API and provides functions for communicating with the endpoints.
4
4
 
5
+ ### Workflow Item priority and parent
6
+
7
+ `WorkflowItem.IItem` and `WorkflowItem.ICreateItem` represent `Priority` as an optional
8
+ `number | null` (signed int32) and `"Parent.Item.ID"` as an optional `number | null`
9
+ (the API's int64 parent reference). Use parent IDs that JavaScript can represent
10
+ as safe integers. Priority accepts zero and negative values; the API defines no
11
+ fixed priority scale.
12
+
13
+ `Create` and `Update` accept both fields. On update, omit a field to preserve it or
14
+ send `null` to clear it. The API checks that the parent exists and prevents circular
15
+ parent chains. The focused helpers update existing items through
16
+ `POST workflow/item/{id}` and invalidate Workflow Item caches after success.
17
+
18
+ ```ts
19
+ import { WorkflowItem } from "bruce-models";
20
+
21
+ // Update one attribute while preserving other item fields.
22
+ await WorkflowItem.UpdatePriority({ api, workflowItemId: 9, priority: 3 });
23
+ await WorkflowItem.UpdateParent({ api, workflowItemId: 9, parentItemId: 5 });
24
+
25
+ // Clear priority or detach from the parent.
26
+ await WorkflowItem.UpdatePriority({ api, workflowItemId: 9, priority: null });
27
+ await WorkflowItem.UpdateParent({ api, workflowItemId: 9, parentItemId: null });
28
+
29
+ // Change both attributes in one request.
30
+ await WorkflowItem.Update({
31
+ api,
32
+ workflowItem: { ID: 9, Priority: 0, "Parent.Item.ID": 5 }
33
+ });
34
+
35
+ // List direct children, filtered and sorted by priority.
36
+ const { items } = await WorkflowItem.GetList({
37
+ api,
38
+ parentItemId: 5,
39
+ priority: [-2, 0, 3],
40
+ orderBy: WorkflowItem.EOrderBy.PRIORITY,
41
+ sortOrder: "DESC"
42
+ });
43
+ ```
44
+
45
+ `GetList` uses `GET workflow/itemsquery` with `Priority` and `ParentItemID` query
46
+ parameters. Both filters accept a single value or an array. Use
47
+ `WorkflowItem.EOrderBy.PARENT_ITEM_ID` to sort by parent instead.
48
+
5
49
  <br>
6
50
 
7
51
  ### Local build
@@ -28,4 +72,4 @@ This is a library which defines data-models for the Nextspace API and provides f
28
72
 
29
73
  - Bitbucket will run a build and test step.
30
74
 
31
- - Manually click `NPM Release` in Bitbucket Pipelines.
75
+ - Manually click `NPM Release` in Bitbucket Pipelines.
@@ -7175,11 +7175,18 @@ var Entity;
7175
7175
  function Update(params) {
7176
7176
  var _a, _b, _c, _d, _e, _f, _g;
7177
7177
  return __awaiter(this, void 0, void 0, function* () {
7178
- let { api, entity: data, entities, override, req: reqParams, migrated } = params;
7178
+ let { api, entity: data, entities, override, req: reqParams, migrated, skipSourcePush } = params;
7179
7179
  if (migrated == null || migrated == undefined) {
7180
7180
  // Changed to default = true. 18th April 2025.
7181
7181
  migrated = true;
7182
7182
  }
7183
+ let skipSourcePushParam = null;
7184
+ if (skipSourcePush === true) {
7185
+ skipSourcePushParam = "true";
7186
+ }
7187
+ else if (Array.isArray(skipSourcePush) && skipSourcePush.length) {
7188
+ skipSourcePushParam = skipSourcePush.join(",");
7189
+ }
7183
7190
  // Bulk save. Always using a v3 endpoint as v1 did not have a bulk save.
7184
7191
  if (entities === null || entities === void 0 ? void 0 : entities.length) {
7185
7192
  // If the Entities don't have IDs, then they must have a Type ID.
@@ -7194,7 +7201,10 @@ var Entity;
7194
7201
  if (!api) {
7195
7202
  api = ENVIRONMENT.Api().GetBruceApi();
7196
7203
  }
7197
- const reqUrl = `v3/entities`;
7204
+ let reqUrl = "v3/entities";
7205
+ if (skipSourcePushParam) {
7206
+ reqUrl += `?SkipSourcePush=${encodeURIComponent(skipSourcePushParam)}`;
7207
+ }
7198
7208
  const reqBody = {
7199
7209
  Items: entities,
7200
7210
  Override: override
@@ -7254,6 +7264,9 @@ var Entity;
7254
7264
  if (!migrated) {
7255
7265
  reqUrl += "&hasMigrated=false";
7256
7266
  }
7267
+ if (skipSourcePushParam) {
7268
+ reqUrl += `&SkipSourcePush=${encodeURIComponent(skipSourcePushParam)}`;
7269
+ }
7257
7270
  const res = yield api.POST(reqUrl, data, Api.PrepReqParams(reqParams));
7258
7271
  api.Cache.RemoveByContains(GetContainsKey(data.Bruce.ID));
7259
7272
  EntityHistoricData.ClearCacheByEntityIds(api, [data.Bruce.ID]);
@@ -22964,12 +22977,27 @@ var PendingAction;
22964
22977
  */
22965
22978
  var Tracking;
22966
22979
  (function (Tracking) {
22980
+ /**
22981
+ * Columns a transaction summary can be grouped by.
22982
+ * Guardian groups by App, Account, Type and Count when none are given.
22983
+ */
22984
+ let ETransactionGroupBy;
22985
+ (function (ETransactionGroupBy) {
22986
+ ETransactionGroupBy["App"] = "App";
22987
+ ETransactionGroupBy["Account"] = "Account";
22988
+ ETransactionGroupBy["User"] = "User";
22989
+ ETransactionGroupBy["Environment"] = "Environment";
22990
+ ETransactionGroupBy["Type"] = "Type";
22991
+ ETransactionGroupBy["Count"] = "Count";
22992
+ ETransactionGroupBy["Month"] = "Month";
22993
+ })(ETransactionGroupBy = Tracking.ETransactionGroupBy || (Tracking.ETransactionGroupBy = {}));
22967
22994
  /**
22968
22995
  * Returns tracking data based on provided parameters.
22969
22996
  * @param params
22970
22997
  * @returns
22971
22998
  */
22972
22999
  function GetData(params) {
23000
+ var _a;
22973
23001
  return __awaiter(this, void 0, void 0, function* () {
22974
23002
  let { api, req } = params;
22975
23003
  if (!api) {
@@ -22982,6 +23010,9 @@ var Tracking;
22982
23010
  if (params.cType) {
22983
23011
  query.append("CType", params.cType);
22984
23012
  }
23013
+ if (params.tType) {
23014
+ query.append("TType", params.tType);
23015
+ }
22985
23016
  if (params.tCount) {
22986
23017
  query.append("TCount", params.tCount);
22987
23018
  }
@@ -22991,12 +23022,27 @@ var Tracking;
22991
23022
  if (params.app) {
22992
23023
  query.append("App", params.app);
22993
23024
  }
23025
+ if (params.environment) {
23026
+ query.append("Environment", params.environment);
23027
+ }
23028
+ if (params.includeDeleted != null) {
23029
+ query.append("IncludeDeleted", String(params.includeDeleted));
23030
+ }
22994
23031
  if (params.year) {
22995
23032
  query.append("Year", String(params.year));
22996
23033
  }
22997
23034
  if (params.month) {
22998
23035
  query.append("Month", String(params.month));
22999
23036
  }
23037
+ if (params.fromYear) {
23038
+ query.append("FromYear", String(params.fromYear));
23039
+ }
23040
+ if (params.fromMonth) {
23041
+ query.append("FromMonth", String(params.fromMonth));
23042
+ }
23043
+ if ((_a = params.groupBy) === null || _a === void 0 ? void 0 : _a.length) {
23044
+ query.append("GroupBy", params.groupBy.join(","));
23045
+ }
23000
23046
  return yield api.GET("tracking?" + query.toString(), Api.PrepReqParams(req));
23001
23047
  });
23002
23048
  }
@@ -24419,6 +24465,26 @@ var UrlUtils;
24419
24465
 
24420
24466
  var WorkflowItem;
24421
24467
  (function (WorkflowItem) {
24468
+ /** Sort fields supported by workflow/itemsquery. */
24469
+ let EOrderBy;
24470
+ (function (EOrderBy) {
24471
+ EOrderBy["ID"] = "ID";
24472
+ EOrderBy["ENTITY_ID"] = "EntityID";
24473
+ EOrderBy["CREATED"] = "Created";
24474
+ EOrderBy["UPDATED"] = "Updated";
24475
+ EOrderBy["DUE_DATE"] = "DueDate";
24476
+ EOrderBy["CREATED_BY_USER_ID"] = "CreatedByUserID";
24477
+ EOrderBy["ITEM_TYPE_ID"] = "ItemTypeID";
24478
+ EOrderBy["ITEM_STATUS_ID"] = "ItemStatusID";
24479
+ EOrderBy["QUEUE_ID"] = "QueueID";
24480
+ EOrderBy["WORKFLOW_SCHEDULE_ID"] = "WorkflowScheduleID";
24481
+ EOrderBy["PRIORITY"] = "Priority";
24482
+ EOrderBy["PARENT_ITEM_ID"] = "ParentItemID";
24483
+ EOrderBy["DESCRIPTION"] = "Description";
24484
+ EOrderBy["UI_SLIDE_ID"] = "UISlideID";
24485
+ EOrderBy["THUMBNAIL_CLIENT_FILE_ID"] = "ThumbnailClientFileID";
24486
+ EOrderBy["RANDOM"] = "RANDOM";
24487
+ })(EOrderBy = WorkflowItem.EOrderBy || (WorkflowItem.EOrderBy = {}));
24422
24488
  function Get(params) {
24423
24489
  return __awaiter(this, void 0, void 0, function* () {
24424
24490
  let { api, workflowItemId, req } = params;
@@ -24509,6 +24575,7 @@ var WorkflowItem;
24509
24575
  });
24510
24576
  }
24511
24577
  WorkflowItem.GetStatistics = GetStatistics;
24578
+ /** Creates an item, including its optional Priority and Parent.Item.ID. */
24512
24579
  function Create(params) {
24513
24580
  var _a, _b, _c, _d, _e;
24514
24581
  return __awaiter(this, void 0, void 0, function* () {
@@ -24535,6 +24602,10 @@ var WorkflowItem;
24535
24602
  });
24536
24603
  }
24537
24604
  WorkflowItem.Create = Create;
24605
+ /**
24606
+ * Saves item changes. Omitted fields are preserved; null clears Priority or Parent.Item.ID.
24607
+ * The API validates that the parent exists and that its parent chain is not circular.
24608
+ */
24538
24609
  function Update(params) {
24539
24610
  return __awaiter(this, void 0, void 0, function* () {
24540
24611
  let { api, workflowItem, req } = params;
@@ -24554,6 +24625,45 @@ var WorkflowItem;
24554
24625
  });
24555
24626
  }
24556
24627
  WorkflowItem.Update = Update;
24628
+ /** Updates only the priority of an existing item. Pass null to clear it. */
24629
+ function UpdatePriority(params) {
24630
+ return __awaiter(this, void 0, void 0, function* () {
24631
+ const { api, workflowItemId, priority, req } = params;
24632
+ if (isInvalidId(workflowItemId) || !Number.isSafeInteger(Number(workflowItemId))) {
24633
+ throw ("Workflow Item ID is required.");
24634
+ }
24635
+ if (priority !== null && (!Number.isInteger(priority) || priority < -2147483648 || priority > 2147483647)) {
24636
+ throw ("Workflow Item priority must be a signed 32-bit integer or null.");
24637
+ }
24638
+ return Update({
24639
+ api,
24640
+ workflowItem: { ID: Number(workflowItemId), Priority: priority },
24641
+ req
24642
+ });
24643
+ });
24644
+ }
24645
+ WorkflowItem.UpdatePriority = UpdatePriority;
24646
+ /**
24647
+ * Updates only the parent of an existing item. Pass null to detach it.
24648
+ * The API validates parent existence and rejects circular parent chains.
24649
+ */
24650
+ function UpdateParent(params) {
24651
+ return __awaiter(this, void 0, void 0, function* () {
24652
+ const { api, workflowItemId, parentItemId, req } = params;
24653
+ if (isInvalidId(workflowItemId) || !Number.isSafeInteger(Number(workflowItemId))) {
24654
+ throw ("Workflow Item ID is required.");
24655
+ }
24656
+ if (parentItemId !== null && (!Number.isSafeInteger(parentItemId) || parentItemId <= 0)) {
24657
+ throw ("Parent Workflow Item ID must be a positive safe integer or null.");
24658
+ }
24659
+ return Update({
24660
+ api,
24661
+ workflowItem: { ID: Number(workflowItemId), "Parent.Item.ID": parentItemId },
24662
+ req
24663
+ });
24664
+ });
24665
+ }
24666
+ WorkflowItem.UpdateParent = UpdateParent;
24557
24667
  function Delete(params) {
24558
24668
  return __awaiter(this, void 0, void 0, function* () {
24559
24669
  let { api, workflowItemId, req } = params;
@@ -25189,7 +25299,7 @@ function getFirstWrappedArray(data, wrapperKeys) {
25189
25299
  }
25190
25300
 
25191
25301
  // This is updated with the package.json version on build.
25192
- const VERSION = "7.1.114";
25302
+ const VERSION = "7.1.116";
25193
25303
 
25194
25304
  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, RequestLane, 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, EntityTypeSource, 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, WorkflowItem, WorkflowSchedule, WorkflowType, WorkflowItemType };
25195
25305
  //# sourceMappingURL=bruce-models.es5.js.map