bruce-models 5.3.3 → 5.3.5

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.
@@ -1032,51 +1032,11 @@
1032
1032
  if ((params === null || params === void 0 ? void 0 : params.cdn) && this.cdnBaseUrl) {
1033
1033
  return this.ConstructCdnUrl(params.url, params.urlParams);
1034
1034
  }
1035
- const tmp = new URL(this.baseUrl);
1036
- if (params === null || params === void 0 ? void 0 : params.urlParams) {
1037
- if (params.urlParams instanceof URLSearchParams) {
1038
- params.urlParams.forEach((value, key) => {
1039
- tmp.searchParams.append(key, value);
1040
- });
1041
- }
1042
- else {
1043
- for (const key in params.urlParams) {
1044
- tmp.searchParams.append(key, params.urlParams[key]);
1045
- }
1046
- }
1047
- }
1048
- // Ensure the url ends with a slash.
1049
- if (!tmp.pathname.endsWith("/")) {
1050
- tmp.pathname += "/";
1051
- }
1052
- let split;
1053
- if (params === null || params === void 0 ? void 0 : params.url) {
1054
- // Ensure we're only adding the path.
1055
- // The baseUrl could have included query params so have this extra logic.
1056
- split = params.url.split("?");
1057
- // Ensure the url does not start with a slash.
1058
- // This is because the base url already has a slash at the end.
1059
- let path = split[0];
1060
- if (path.startsWith("/")) {
1061
- path = path.substring(1);
1062
- }
1063
- tmp.pathname += path;
1064
- }
1065
- let full = tmp.toString();
1066
- // Append the query string if any exist.
1067
- if (split && split.length > 1) {
1068
- const query = split[1].split("&");
1069
- for (let q of query) {
1070
- if (full.includes("?")) {
1071
- full += "&";
1072
- }
1073
- else {
1074
- full += "?";
1075
- }
1076
- full += q;
1077
- }
1078
- }
1079
- return full;
1035
+ return exports.UrlUtils.ConstructUrl({
1036
+ existing: this.baseUrl,
1037
+ url: params === null || params === void 0 ? void 0 : params.url,
1038
+ urlParams: params === null || params === void 0 ? void 0 : params.urlParams
1039
+ });
1080
1040
  }
1081
1041
  /**
1082
1042
  * Returns a url routed through the API's CDN.
@@ -1089,51 +1049,11 @@
1089
1049
  if (!this.cdnBaseUrl) {
1090
1050
  return null;
1091
1051
  }
1092
- const tmp = new URL(this.cdnBaseUrl);
1093
- if (urlParams) {
1094
- if (urlParams instanceof URLSearchParams) {
1095
- urlParams.forEach((value, key) => {
1096
- tmp.searchParams.append(key, value);
1097
- });
1098
- }
1099
- else {
1100
- for (const key in urlParams) {
1101
- tmp.searchParams.append(key, urlParams[key]);
1102
- }
1103
- }
1104
- }
1105
- // Ensure the url ends with a slash.
1106
- if (!tmp.pathname.endsWith("/")) {
1107
- tmp.pathname += "/";
1108
- }
1109
- let split;
1110
- if (url) {
1111
- // Ensure we're only adding the path.
1112
- // The baseUrl could have included query params so have this extra logic.
1113
- split = url.split("?");
1114
- // Ensure the url does not start with a slash.
1115
- // This is because the base url already has a slash at the end.
1116
- let path = split[0];
1117
- if (path.startsWith("/")) {
1118
- path = url.substring(1);
1119
- }
1120
- tmp.pathname += path;
1121
- }
1122
- let full = tmp.toString();
1123
- // Append the query string if any exist.
1124
- if (split && split.length > 1) {
1125
- const query = split[1].split("&");
1126
- for (let q of query) {
1127
- if (full.includes("?")) {
1128
- full += "&";
1129
- }
1130
- else {
1131
- full += "?";
1132
- }
1133
- full += q;
1134
- }
1135
- }
1136
- return full;
1052
+ return exports.UrlUtils.ConstructUrl({
1053
+ existing: this.cdnBaseUrl,
1054
+ url: url,
1055
+ urlParams: urlParams
1056
+ });
1137
1057
  }
1138
1058
  /**
1139
1059
  * Warning: This will cancel the init process.
@@ -13242,6 +13162,58 @@
13242
13162
  return urlObj.toString();
13243
13163
  }
13244
13164
  UrlUtils.AddQueryParam = AddQueryParam;
13165
+ /**
13166
+ * Returns a url with the provided url appended to the provided existing url.
13167
+ * @param params
13168
+ */
13169
+ function ConstructUrl(params) {
13170
+ const tmp = new URL(params.existing);
13171
+ if (params === null || params === void 0 ? void 0 : params.urlParams) {
13172
+ if (params.urlParams instanceof URLSearchParams) {
13173
+ params.urlParams.forEach((value, key) => {
13174
+ tmp.searchParams.append(key, value);
13175
+ });
13176
+ }
13177
+ else {
13178
+ for (const key in params.urlParams) {
13179
+ tmp.searchParams.append(key, params.urlParams[key]);
13180
+ }
13181
+ }
13182
+ }
13183
+ // Ensure the url ends with a slash.
13184
+ if (!tmp.pathname.endsWith("/")) {
13185
+ tmp.pathname += "/";
13186
+ }
13187
+ let split;
13188
+ if (params === null || params === void 0 ? void 0 : params.url) {
13189
+ // Ensure we're only adding the path.
13190
+ // 'existing' could have included query params so have this extra logic.
13191
+ split = params.url.split("?");
13192
+ // Ensure the url does not start with a slash.
13193
+ // This is because the existing url already has a slash at the end.
13194
+ let path = split[0];
13195
+ if (path.startsWith("/")) {
13196
+ path = path.substring(1);
13197
+ }
13198
+ tmp.pathname += path;
13199
+ }
13200
+ let full = tmp.toString();
13201
+ // Append the query string if any exist.
13202
+ if (split && split.length > 1) {
13203
+ const query = split[1].split("&");
13204
+ for (let q of query) {
13205
+ if (full.includes("?")) {
13206
+ full += "&";
13207
+ }
13208
+ else {
13209
+ full += "?";
13210
+ }
13211
+ full += q;
13212
+ }
13213
+ }
13214
+ return full;
13215
+ }
13216
+ UrlUtils.ConstructUrl = ConstructUrl;
13245
13217
  })(exports.UrlUtils || (exports.UrlUtils = {}));
13246
13218
 
13247
13219
  (function (DataLab) {
@@ -13351,7 +13323,7 @@
13351
13323
  * @param params
13352
13324
  * @returns
13353
13325
  */
13354
- function GetGroupList(params) {
13326
+ function GetList(params) {
13355
13327
  return __awaiter(this, void 0, void 0, function* () {
13356
13328
  if (!params) {
13357
13329
  params = {};
@@ -13366,35 +13338,46 @@
13366
13338
  };
13367
13339
  });
13368
13340
  }
13369
- DataLabGroup.GetGroupList = GetGroupList;
13341
+ DataLabGroup.GetList = GetList;
13370
13342
  /**
13371
13343
  * Creates or updates a saved query group.
13372
13344
  * @param params
13373
13345
  */
13374
- function UpdateGroup(params) {
13346
+ function Update(params) {
13375
13347
  return __awaiter(this, void 0, void 0, function* () {
13376
- let { api, group, req } = params;
13348
+ let { api, group, groups, req } = params;
13377
13349
  if (!api) {
13378
13350
  api = exports.ENVIRONMENT.Api().GetBruceApi();
13379
13351
  }
13380
- let url = "entities/datalab/savedQueryGroup";
13381
- if (group.ID) {
13382
- url += `/${group.ID}`;
13352
+ if (groups === null || groups === void 0 ? void 0 : groups.length) {
13353
+ const body = {
13354
+ Items: groups
13355
+ };
13356
+ const res = yield api.POST("entities/datalab/savedQueryGroups", body, exports.Api.PrepReqParams(req));
13357
+ return {
13358
+ groups: res.Items
13359
+ };
13360
+ }
13361
+ else {
13362
+ let url = "entities/datalab/savedQueryGroup";
13363
+ if (group.ID) {
13364
+ url += `/${group.ID}`;
13365
+ }
13366
+ const res = yield api.POST(url, group, exports.Api.PrepReqParams(req));
13367
+ return {
13368
+ group: res
13369
+ };
13383
13370
  }
13384
- const res = yield api.POST(url, group, exports.Api.PrepReqParams(req));
13385
- return {
13386
- group: res
13387
- };
13388
13371
  });
13389
13372
  }
13390
- DataLabGroup.UpdateGroup = UpdateGroup;
13373
+ DataLabGroup.Update = Update;
13391
13374
  /**
13392
13375
  * Deletes a saved query group by ID.
13393
13376
  * This will either ungroup or delete the related queries.
13394
13377
  * @param params
13395
13378
  * @returns
13396
13379
  */
13397
- function DeleteGroup(params) {
13380
+ function Delete(params) {
13398
13381
  return __awaiter(this, void 0, void 0, function* () {
13399
13382
  let { api, groupId, req, queryAction } = params;
13400
13383
  if (!groupId || groupId <= 0) {
@@ -13419,7 +13402,7 @@
13419
13402
  };
13420
13403
  });
13421
13404
  }
13422
- DataLabGroup.DeleteGroup = DeleteGroup;
13405
+ DataLabGroup.Delete = Delete;
13423
13406
  })(exports.DataLabGroup || (exports.DataLabGroup = {}));
13424
13407
 
13425
13408
  (function (ImportAssembly) {
@@ -14454,7 +14437,7 @@
14454
14437
  })(exports.DataSource || (exports.DataSource = {}));
14455
14438
 
14456
14439
  // This is updated with the package.json version on build.
14457
- const VERSION = "5.3.3";
14440
+ const VERSION = "5.3.5";
14458
14441
 
14459
14442
  exports.VERSION = VERSION;
14460
14443
  exports.AbstractApi = AbstractApi;