bruce-models 7.1.117 → 7.1.119

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.
@@ -8795,6 +8795,7 @@
8795
8795
  EConcept["ENTITY_TYPE"] = "ET";
8796
8796
  EConcept["ENTITY_LOD"] = "EL";
8797
8797
  EConcept["ENTITY_RELATION"] = "ER";
8798
+ EConcept["ASSEMBLY"] = "A";
8798
8799
  })(EConcept = ChangeSet.EConcept || (ChangeSet.EConcept = {}));
8799
8800
  /**
8800
8801
  * Updates existing or creates new Change Set record.
@@ -8831,11 +8832,18 @@
8831
8832
  */
8832
8833
  function Get(params) {
8833
8834
  return __awaiter(this, void 0, void 0, function* () {
8834
- let { id, expandCount, api, req: reqParams } = params;
8835
+ let { id, expandCount, expandCountByConcept, api, req: reqParams } = params;
8835
8836
  if (!api) {
8836
8837
  api = exports.ENVIRONMENT.Api().GetBruceApi();
8837
8838
  }
8838
- const query = expandCount ? "?Expand=Count" : "";
8839
+ const expand = [];
8840
+ if (expandCount) {
8841
+ expand.push("Count");
8842
+ }
8843
+ if (expandCountByConcept) {
8844
+ expand.push("CountByConcept");
8845
+ }
8846
+ const query = expand.length ? `?Expand=${expand.join(",")}` : "";
8839
8847
  return yield api.GET(`v3/change/${id}${query}`, exports.Api.PrepReqParams(reqParams));
8840
8848
  });
8841
8849
  }
@@ -8894,13 +8902,10 @@
8894
8902
  ChangeSet.Reject = Reject;
8895
8903
  /**
8896
8904
  * Gets the paged list of Change Items for the specified Change Set.
8897
- * Optionally filter by Concept (E, ET, EL, ER) and/or EntityID.
8898
- * TotalCount is returned when PageIndex is 0 (the default).
8899
- * Pass -1 for both pageSize and pageIndex to get only TotalCount.
8900
8905
  */
8901
8906
  function GetItems(params) {
8902
8907
  return __awaiter(this, void 0, void 0, function* () {
8903
- let { id, api, req: reqParams, pageSize, pageIndex, concept, entityId } = params;
8908
+ let { id, api, req: reqParams, pageSize, pageIndex, concept, action, entityId } = params;
8904
8909
  if (!api) {
8905
8910
  api = exports.ENVIRONMENT.Api().GetBruceApi();
8906
8911
  }
@@ -8914,6 +8919,9 @@
8914
8919
  if (concept != null) {
8915
8920
  urlParams.append("Concept", concept);
8916
8921
  }
8922
+ if (action != null) {
8923
+ urlParams.append("Action", action);
8924
+ }
8917
8925
  if (entityId != null) {
8918
8926
  urlParams.append("EntityID", entityId);
8919
8927
  }
@@ -8922,6 +8930,27 @@
8922
8930
  });
8923
8931
  }
8924
8932
  ChangeSet.GetItems = GetItems;
8933
+ /**
8934
+ * Locates the first Change Item naming an Entity, so a paged list can turn to the page holding it.
8935
+ */
8936
+ function GetItemsIndexOf(params) {
8937
+ return __awaiter(this, void 0, void 0, function* () {
8938
+ let { id, entityId, concept, action, api, req: reqParams } = params;
8939
+ if (!api) {
8940
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
8941
+ }
8942
+ const urlParams = new URLSearchParams();
8943
+ urlParams.append("IndexOf", entityId);
8944
+ if (concept != null) {
8945
+ urlParams.append("Concept", concept);
8946
+ }
8947
+ if (action != null) {
8948
+ urlParams.append("Action", action);
8949
+ }
8950
+ return api.GET(`v3/change/${id}/items?${urlParams.toString()}`, exports.Api.PrepReqParams(reqParams));
8951
+ });
8952
+ }
8953
+ ChangeSet.GetItemsIndexOf = GetItemsIndexOf;
8925
8954
  /**
8926
8955
  * Updates existing or creates new Change Item within the specified Change Set.
8927
8956
  * To create a new item omit changeItem.ID or set it to 0.
@@ -23997,6 +24026,8 @@
23997
24026
  })(exports.EncryptUtils || (exports.EncryptUtils = {}));
23998
24027
 
23999
24028
  (function (UrlUtils) {
24029
+ // The "S:{expires}.{signature}/" segment the API puts in the path of URLs it signs.
24030
+ const SIGNED_SEGMENT = /\/S:(\d+)\.[A-Za-z0-9_-]+\//;
24000
24031
  /**
24001
24032
  * Returns a url-safe string that is human readable.
24002
24033
  * Eg: 'My Project View!' into 'My-Project-View'.
@@ -24026,6 +24057,52 @@
24026
24057
  return urlObj.toString();
24027
24058
  }
24028
24059
  UrlUtils.AddQueryParam = AddQueryParam;
24060
+ /**
24061
+ * Removes every occurrence of a query parameter from a url.
24062
+ * Eg: RemoveQueryParam('http://example.com/?key=value&other=1', 'key') => 'http://example.com/?other=1'
24063
+ * @param url absolute or relative url.
24064
+ * @param key decoded name of the parameter to remove.
24065
+ * @returns
24066
+ */
24067
+ function RemoveQueryParam(url, key) {
24068
+ if (!url) {
24069
+ return url;
24070
+ }
24071
+ const hashStart = url.indexOf("#");
24072
+ const hash = hashStart === -1 ? "" : url.substring(hashStart);
24073
+ const beforeHash = hashStart === -1 ? url : url.substring(0, hashStart);
24074
+ const queryStart = beforeHash.indexOf("?");
24075
+ if (queryStart === -1) {
24076
+ return url;
24077
+ }
24078
+ // Works on the raw string so the parameters that stay keep their exact encoding, which a signed query depends on.
24079
+ const kept = beforeHash.substring(queryStart + 1).split("&").filter(pair => {
24080
+ return decodeQueryName(pair.split("=")[0]) !== key;
24081
+ });
24082
+ const query = kept.length ? "?" + kept.join("&") : "";
24083
+ return beforeHash.substring(0, queryStart) + query + hash;
24084
+ }
24085
+ UrlUtils.RemoveQueryParam = RemoveQueryParam;
24086
+ /**
24087
+ * Returns true when the url carries an API signature that has not expired, so it authorises itself.
24088
+ * @param url
24089
+ * @returns
24090
+ */
24091
+ function IsSignedUrl(url) {
24092
+ const match = url === null || url === void 0 ? void 0 : url.match(SIGNED_SEGMENT);
24093
+ return !!match && Number(match[1]) * 1000 > Date.now();
24094
+ }
24095
+ UrlUtils.IsSignedUrl = IsSignedUrl;
24096
+ /**
24097
+ * Removes the API signature from a url.
24098
+ * Eg: comparing two urls for the same file that were signed at different times, or a link leaving the app that should grant no more than the reader's own access.
24099
+ * @param url
24100
+ * @returns
24101
+ */
24102
+ function RemoveSignature(url) {
24103
+ return url ? url.replace(SIGNED_SEGMENT, "/") : url;
24104
+ }
24105
+ UrlUtils.RemoveSignature = RemoveSignature;
24029
24106
  /**
24030
24107
  * Returns a url with the provided url appended to the provided existing url.
24031
24108
  * @param params
@@ -24078,6 +24155,17 @@
24078
24155
  return full;
24079
24156
  }
24080
24157
  UrlUtils.ConstructUrl = ConstructUrl;
24158
+ /**
24159
+ * Decodes a query parameter name the way URLSearchParams does, keeping the raw name when it is malformed.
24160
+ */
24161
+ function decodeQueryName(name) {
24162
+ try {
24163
+ return decodeURIComponent(name.replace(/\+/g, " "));
24164
+ }
24165
+ catch (_a) {
24166
+ return name;
24167
+ }
24168
+ }
24081
24169
  })(exports.UrlUtils || (exports.UrlUtils = {}));
24082
24170
 
24083
24171
  (function (WorkflowItem) {
@@ -24909,7 +24997,7 @@
24909
24997
  }
24910
24998
 
24911
24999
  // This is updated with the package.json version on build.
24912
- const VERSION = "7.1.117";
25000
+ const VERSION = "7.1.119";
24913
25001
 
24914
25002
  exports.VERSION = VERSION;
24915
25003
  exports.AbstractApi = AbstractApi;