bruce-models 7.1.116 → 7.1.118

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.
@@ -17198,6 +17198,7 @@
17198
17198
  (function (EType) {
17199
17199
  EType["DataLabQuery"] = "DataLabQuery";
17200
17200
  EType["WorkflowTicket"] = "WorkflowTicket";
17201
+ EType["CreateEntity"] = "CreateEntity";
17201
17202
  })(EType = EntityTypeTrigger.EType || (EntityTypeTrigger.EType = {}));
17202
17203
  /**
17203
17204
  * Builds the Settings payload for a WorkflowTicket trigger.
@@ -23996,6 +23997,8 @@
23996
23997
  })(exports.EncryptUtils || (exports.EncryptUtils = {}));
23997
23998
 
23998
23999
  (function (UrlUtils) {
24000
+ // The "S:{expires}.{signature}/" segment the API puts in the path of URLs it signs.
24001
+ const SIGNED_SEGMENT = /\/S:(\d+)\.[A-Za-z0-9_-]+\//;
23999
24002
  /**
24000
24003
  * Returns a url-safe string that is human readable.
24001
24004
  * Eg: 'My Project View!' into 'My-Project-View'.
@@ -24025,6 +24028,52 @@
24025
24028
  return urlObj.toString();
24026
24029
  }
24027
24030
  UrlUtils.AddQueryParam = AddQueryParam;
24031
+ /**
24032
+ * Removes every occurrence of a query parameter from a url.
24033
+ * Eg: RemoveQueryParam('http://example.com/?key=value&other=1', 'key') => 'http://example.com/?other=1'
24034
+ * @param url absolute or relative url.
24035
+ * @param key decoded name of the parameter to remove.
24036
+ * @returns
24037
+ */
24038
+ function RemoveQueryParam(url, key) {
24039
+ if (!url) {
24040
+ return url;
24041
+ }
24042
+ const hashStart = url.indexOf("#");
24043
+ const hash = hashStart === -1 ? "" : url.substring(hashStart);
24044
+ const beforeHash = hashStart === -1 ? url : url.substring(0, hashStart);
24045
+ const queryStart = beforeHash.indexOf("?");
24046
+ if (queryStart === -1) {
24047
+ return url;
24048
+ }
24049
+ // Works on the raw string so the parameters that stay keep their exact encoding, which a signed query depends on.
24050
+ const kept = beforeHash.substring(queryStart + 1).split("&").filter(pair => {
24051
+ return decodeQueryName(pair.split("=")[0]) !== key;
24052
+ });
24053
+ const query = kept.length ? "?" + kept.join("&") : "";
24054
+ return beforeHash.substring(0, queryStart) + query + hash;
24055
+ }
24056
+ UrlUtils.RemoveQueryParam = RemoveQueryParam;
24057
+ /**
24058
+ * Returns true when the url carries an API signature that has not expired, so it authorises itself.
24059
+ * @param url
24060
+ * @returns
24061
+ */
24062
+ function IsSignedUrl(url) {
24063
+ const match = url === null || url === void 0 ? void 0 : url.match(SIGNED_SEGMENT);
24064
+ return !!match && Number(match[1]) * 1000 > Date.now();
24065
+ }
24066
+ UrlUtils.IsSignedUrl = IsSignedUrl;
24067
+ /**
24068
+ * Removes the API signature from a url.
24069
+ * 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.
24070
+ * @param url
24071
+ * @returns
24072
+ */
24073
+ function RemoveSignature(url) {
24074
+ return url ? url.replace(SIGNED_SEGMENT, "/") : url;
24075
+ }
24076
+ UrlUtils.RemoveSignature = RemoveSignature;
24028
24077
  /**
24029
24078
  * Returns a url with the provided url appended to the provided existing url.
24030
24079
  * @param params
@@ -24077,6 +24126,17 @@
24077
24126
  return full;
24078
24127
  }
24079
24128
  UrlUtils.ConstructUrl = ConstructUrl;
24129
+ /**
24130
+ * Decodes a query parameter name the way URLSearchParams does, keeping the raw name when it is malformed.
24131
+ */
24132
+ function decodeQueryName(name) {
24133
+ try {
24134
+ return decodeURIComponent(name.replace(/\+/g, " "));
24135
+ }
24136
+ catch (_a) {
24137
+ return name;
24138
+ }
24139
+ }
24080
24140
  })(exports.UrlUtils || (exports.UrlUtils = {}));
24081
24141
 
24082
24142
  (function (WorkflowItem) {
@@ -24908,7 +24968,7 @@
24908
24968
  }
24909
24969
 
24910
24970
  // This is updated with the package.json version on build.
24911
- const VERSION = "7.1.116";
24971
+ const VERSION = "7.1.118";
24912
24972
 
24913
24973
  exports.VERSION = VERSION;
24914
24974
  exports.AbstractApi = AbstractApi;