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.
@@ -1041,51 +1041,11 @@ var BruceApi;
1041
1041
  if ((params === null || params === void 0 ? void 0 : params.cdn) && this.cdnBaseUrl) {
1042
1042
  return this.ConstructCdnUrl(params.url, params.urlParams);
1043
1043
  }
1044
- const tmp = new URL(this.baseUrl);
1045
- if (params === null || params === void 0 ? void 0 : params.urlParams) {
1046
- if (params.urlParams instanceof URLSearchParams) {
1047
- params.urlParams.forEach((value, key) => {
1048
- tmp.searchParams.append(key, value);
1049
- });
1050
- }
1051
- else {
1052
- for (const key in params.urlParams) {
1053
- tmp.searchParams.append(key, params.urlParams[key]);
1054
- }
1055
- }
1056
- }
1057
- // Ensure the url ends with a slash.
1058
- if (!tmp.pathname.endsWith("/")) {
1059
- tmp.pathname += "/";
1060
- }
1061
- let split;
1062
- if (params === null || params === void 0 ? void 0 : params.url) {
1063
- // Ensure we're only adding the path.
1064
- // The baseUrl could have included query params so have this extra logic.
1065
- split = params.url.split("?");
1066
- // Ensure the url does not start with a slash.
1067
- // This is because the base url already has a slash at the end.
1068
- let path = split[0];
1069
- if (path.startsWith("/")) {
1070
- path = path.substring(1);
1071
- }
1072
- tmp.pathname += path;
1073
- }
1074
- let full = tmp.toString();
1075
- // Append the query string if any exist.
1076
- if (split && split.length > 1) {
1077
- const query = split[1].split("&");
1078
- for (let q of query) {
1079
- if (full.includes("?")) {
1080
- full += "&";
1081
- }
1082
- else {
1083
- full += "?";
1084
- }
1085
- full += q;
1086
- }
1087
- }
1088
- return full;
1044
+ return UrlUtils.ConstructUrl({
1045
+ existing: this.baseUrl,
1046
+ url: params === null || params === void 0 ? void 0 : params.url,
1047
+ urlParams: params === null || params === void 0 ? void 0 : params.urlParams
1048
+ });
1089
1049
  }
1090
1050
  /**
1091
1051
  * Returns a url routed through the API's CDN.
@@ -1098,51 +1058,11 @@ var BruceApi;
1098
1058
  if (!this.cdnBaseUrl) {
1099
1059
  return null;
1100
1060
  }
1101
- const tmp = new URL(this.cdnBaseUrl);
1102
- if (urlParams) {
1103
- if (urlParams instanceof URLSearchParams) {
1104
- urlParams.forEach((value, key) => {
1105
- tmp.searchParams.append(key, value);
1106
- });
1107
- }
1108
- else {
1109
- for (const key in urlParams) {
1110
- tmp.searchParams.append(key, urlParams[key]);
1111
- }
1112
- }
1113
- }
1114
- // Ensure the url ends with a slash.
1115
- if (!tmp.pathname.endsWith("/")) {
1116
- tmp.pathname += "/";
1117
- }
1118
- let split;
1119
- if (url) {
1120
- // Ensure we're only adding the path.
1121
- // The baseUrl could have included query params so have this extra logic.
1122
- split = url.split("?");
1123
- // Ensure the url does not start with a slash.
1124
- // This is because the base url already has a slash at the end.
1125
- let path = split[0];
1126
- if (path.startsWith("/")) {
1127
- path = url.substring(1);
1128
- }
1129
- tmp.pathname += path;
1130
- }
1131
- let full = tmp.toString();
1132
- // Append the query string if any exist.
1133
- if (split && split.length > 1) {
1134
- const query = split[1].split("&");
1135
- for (let q of query) {
1136
- if (full.includes("?")) {
1137
- full += "&";
1138
- }
1139
- else {
1140
- full += "?";
1141
- }
1142
- full += q;
1143
- }
1144
- }
1145
- return full;
1061
+ return UrlUtils.ConstructUrl({
1062
+ existing: this.cdnBaseUrl,
1063
+ url: url,
1064
+ urlParams: urlParams
1065
+ });
1146
1066
  }
1147
1067
  /**
1148
1068
  * Warning: This will cancel the init process.
@@ -13495,6 +13415,58 @@ var UrlUtils;
13495
13415
  return urlObj.toString();
13496
13416
  }
13497
13417
  UrlUtils.AddQueryParam = AddQueryParam;
13418
+ /**
13419
+ * Returns a url with the provided url appended to the provided existing url.
13420
+ * @param params
13421
+ */
13422
+ function ConstructUrl(params) {
13423
+ const tmp = new URL(params.existing);
13424
+ if (params === null || params === void 0 ? void 0 : params.urlParams) {
13425
+ if (params.urlParams instanceof URLSearchParams) {
13426
+ params.urlParams.forEach((value, key) => {
13427
+ tmp.searchParams.append(key, value);
13428
+ });
13429
+ }
13430
+ else {
13431
+ for (const key in params.urlParams) {
13432
+ tmp.searchParams.append(key, params.urlParams[key]);
13433
+ }
13434
+ }
13435
+ }
13436
+ // Ensure the url ends with a slash.
13437
+ if (!tmp.pathname.endsWith("/")) {
13438
+ tmp.pathname += "/";
13439
+ }
13440
+ let split;
13441
+ if (params === null || params === void 0 ? void 0 : params.url) {
13442
+ // Ensure we're only adding the path.
13443
+ // 'existing' could have included query params so have this extra logic.
13444
+ split = params.url.split("?");
13445
+ // Ensure the url does not start with a slash.
13446
+ // This is because the existing url already has a slash at the end.
13447
+ let path = split[0];
13448
+ if (path.startsWith("/")) {
13449
+ path = path.substring(1);
13450
+ }
13451
+ tmp.pathname += path;
13452
+ }
13453
+ let full = tmp.toString();
13454
+ // Append the query string if any exist.
13455
+ if (split && split.length > 1) {
13456
+ const query = split[1].split("&");
13457
+ for (let q of query) {
13458
+ if (full.includes("?")) {
13459
+ full += "&";
13460
+ }
13461
+ else {
13462
+ full += "?";
13463
+ }
13464
+ full += q;
13465
+ }
13466
+ }
13467
+ return full;
13468
+ }
13469
+ UrlUtils.ConstructUrl = ConstructUrl;
13498
13470
  })(UrlUtils || (UrlUtils = {}));
13499
13471
 
13500
13472
  /**
@@ -13611,7 +13583,7 @@ var DataLabGroup;
13611
13583
  * @param params
13612
13584
  * @returns
13613
13585
  */
13614
- function GetGroupList(params) {
13586
+ function GetList(params) {
13615
13587
  return __awaiter(this, void 0, void 0, function* () {
13616
13588
  if (!params) {
13617
13589
  params = {};
@@ -13626,35 +13598,46 @@ var DataLabGroup;
13626
13598
  };
13627
13599
  });
13628
13600
  }
13629
- DataLabGroup.GetGroupList = GetGroupList;
13601
+ DataLabGroup.GetList = GetList;
13630
13602
  /**
13631
13603
  * Creates or updates a saved query group.
13632
13604
  * @param params
13633
13605
  */
13634
- function UpdateGroup(params) {
13606
+ function Update(params) {
13635
13607
  return __awaiter(this, void 0, void 0, function* () {
13636
- let { api, group, req } = params;
13608
+ let { api, group, groups, req } = params;
13637
13609
  if (!api) {
13638
13610
  api = ENVIRONMENT.Api().GetBruceApi();
13639
13611
  }
13640
- let url = "entities/datalab/savedQueryGroup";
13641
- if (group.ID) {
13642
- url += `/${group.ID}`;
13612
+ if (groups === null || groups === void 0 ? void 0 : groups.length) {
13613
+ const body = {
13614
+ Items: groups
13615
+ };
13616
+ const res = yield api.POST("entities/datalab/savedQueryGroups", body, Api.PrepReqParams(req));
13617
+ return {
13618
+ groups: res.Items
13619
+ };
13620
+ }
13621
+ else {
13622
+ let url = "entities/datalab/savedQueryGroup";
13623
+ if (group.ID) {
13624
+ url += `/${group.ID}`;
13625
+ }
13626
+ const res = yield api.POST(url, group, Api.PrepReqParams(req));
13627
+ return {
13628
+ group: res
13629
+ };
13643
13630
  }
13644
- const res = yield api.POST(url, group, Api.PrepReqParams(req));
13645
- return {
13646
- group: res
13647
- };
13648
13631
  });
13649
13632
  }
13650
- DataLabGroup.UpdateGroup = UpdateGroup;
13633
+ DataLabGroup.Update = Update;
13651
13634
  /**
13652
13635
  * Deletes a saved query group by ID.
13653
13636
  * This will either ungroup or delete the related queries.
13654
13637
  * @param params
13655
13638
  * @returns
13656
13639
  */
13657
- function DeleteGroup(params) {
13640
+ function Delete(params) {
13658
13641
  return __awaiter(this, void 0, void 0, function* () {
13659
13642
  let { api, groupId, req, queryAction } = params;
13660
13643
  if (!groupId || groupId <= 0) {
@@ -13679,7 +13662,7 @@ var DataLabGroup;
13679
13662
  };
13680
13663
  });
13681
13664
  }
13682
- DataLabGroup.DeleteGroup = DeleteGroup;
13665
+ DataLabGroup.Delete = Delete;
13683
13666
  })(DataLabGroup || (DataLabGroup = {}));
13684
13667
 
13685
13668
  var ImportAssembly;
@@ -14735,7 +14718,7 @@ var DataSource;
14735
14718
  })(DataSource || (DataSource = {}));
14736
14719
 
14737
14720
  // This is updated with the package.json version on build.
14738
- const VERSION = "5.3.3";
14721
+ const VERSION = "5.3.5";
14739
14722
 
14740
14723
  export { VERSION, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
14741
14724
  //# sourceMappingURL=bruce-models.es5.js.map