bruce-models 6.0.8 → 6.1.0

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.
@@ -1802,55 +1802,89 @@ var Assembly;
1802
1802
  * @returns
1803
1803
  */
1804
1804
  function GetList(params) {
1805
+ var _a;
1805
1806
  return __awaiter(this, void 0, void 0, function* () {
1806
1807
  let { api, req: reqParams } = params;
1807
1808
  if (!api) {
1808
1809
  api = ENVIRONMENT.Api().GetBruceApi();
1809
1810
  }
1810
- const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
1811
- try {
1812
- let url = "v3/assemblies";
1813
- const urlParams = new URLSearchParams();
1814
- if (params.pageSize != null) {
1815
- urlParams.append("PageSize", String(params.pageSize));
1816
- }
1817
- if (params.pageIndex != null) {
1818
- urlParams.append("PageIndex", String(params.pageIndex));
1819
- }
1820
- if (params.parentId) {
1821
- urlParams.append("ParentID", String(params.parentId));
1822
- }
1823
- if (params.search) {
1824
- urlParams.append("Search", params.search);
1825
- }
1826
- if (params.withTilesets != null) {
1827
- urlParams.append("WithTilesets", String(params.withTilesets));
1828
- }
1829
- if (params.ids != null) {
1830
- for (let i = 0; i < params.ids.length; i++) {
1831
- urlParams.append("ID", String(params.ids[i]));
1811
+ // Separate code for IDs to avoid overloading URL.
1812
+ // If we're searching for IDs, we'll batch in 50 at a time then return the total.
1813
+ if (((_a = params.ids) === null || _a === void 0 ? void 0 : _a.length) && params.ids.length > 50) {
1814
+ const assemblies = [];
1815
+ let ids = [...params.ids];
1816
+ while (ids.length > 0) {
1817
+ const batch = ids.splice(0, 50);
1818
+ const result = yield GetList({
1819
+ api,
1820
+ req: reqParams,
1821
+ pageSize: batch.length,
1822
+ pageIndex: 0,
1823
+ ids: batch,
1824
+ parentId: params.parentId,
1825
+ search: params.search,
1826
+ withTilesets: params.withTilesets
1827
+ });
1828
+ assemblies.push(...result.assemblies);
1829
+ }
1830
+ const result = {};
1831
+ result.assemblies = assemblies;
1832
+ result.totalCount = assemblies.length;
1833
+ result.nextPage = false;
1834
+ return result;
1835
+ }
1836
+ else {
1837
+ const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
1838
+ try {
1839
+ let url = "v3/assemblies";
1840
+ const urlParams = new URLSearchParams();
1841
+ if (params.pageSize != null) {
1842
+ urlParams.append("PageSize", String(params.pageSize));
1832
1843
  }
1844
+ if (params.pageIndex != null) {
1845
+ urlParams.append("PageIndex", String(params.pageIndex));
1846
+ }
1847
+ if (params.parentId) {
1848
+ urlParams.append("ParentID", String(params.parentId));
1849
+ }
1850
+ if (params.search) {
1851
+ urlParams.append("Search", params.search);
1852
+ }
1853
+ if (params.withTilesets != null) {
1854
+ urlParams.append("WithTilesets", String(params.withTilesets));
1855
+ }
1856
+ if (params.ids != null) {
1857
+ for (let i = 0; i < params.ids.length; i++) {
1858
+ urlParams.append("ID", String(params.ids[i]));
1859
+ }
1860
+ if (params.pageIndex != null) {
1861
+ urlParams.append("PageIndex", String(0));
1862
+ }
1863
+ if (params.pageSize != null) {
1864
+ urlParams.append("PageSize", String(params.ids.length));
1865
+ }
1866
+ }
1867
+ url += "?" + urlParams.toString();
1868
+ const data = yield api.GET(url, Api.PrepReqParams(reqParams));
1869
+ const result = {};
1870
+ result.assemblies = data.Items ? data.Items : [];
1871
+ if (data.TotalCount != null) {
1872
+ result.totalCount = data.TotalCount;
1873
+ }
1874
+ if (data.NextPage != null) {
1875
+ result.nextPage = data.NextPage;
1876
+ }
1877
+ if (data.NextPageURL != null) {
1878
+ result.nextPageUrl = data.NextPageURL;
1879
+ }
1880
+ res(result);
1833
1881
  }
1834
- url += "?" + urlParams.toString();
1835
- const data = yield api.GET(url, Api.PrepReqParams(reqParams));
1836
- const result = {};
1837
- result.assemblies = data.Items ? data.Items : [];
1838
- if (data.TotalCount != null) {
1839
- result.totalCount = data.TotalCount;
1840
- }
1841
- if (data.NextPage != null) {
1842
- result.nextPage = data.NextPage;
1843
- }
1844
- if (data.NextPageURL != null) {
1845
- result.nextPageUrl = data.NextPageURL;
1882
+ catch (e) {
1883
+ rej(e);
1846
1884
  }
1847
- res(result);
1848
- }
1849
- catch (e) {
1850
- rej(e);
1851
- }
1852
- }));
1853
- return req;
1885
+ }));
1886
+ return req;
1887
+ }
1854
1888
  });
1855
1889
  }
1856
1890
  Assembly.GetList = GetList;
@@ -11443,6 +11477,52 @@ var PendingAction;
11443
11477
  });
11444
11478
  }
11445
11479
  PendingAction.Get = Get;
11480
+ /**
11481
+ * Returns a list of pending action records by their IDs.
11482
+ * @param params
11483
+ */
11484
+ function GetList(params) {
11485
+ var _a;
11486
+ return __awaiter(this, void 0, void 0, function* () {
11487
+ let { api, ids, reqParams } = params;
11488
+ if (!ids || ids.length === 0) {
11489
+ throw ("IDs are required.");
11490
+ }
11491
+ if (!api) {
11492
+ api = ENVIRONMENT.Api().GetBruceApi();
11493
+ }
11494
+ // Separate code for IDs to avoid overloading URL.
11495
+ // If we're searching for IDs, we'll batch in 50 at a time then return the total.
11496
+ if (((_a = params.ids) === null || _a === void 0 ? void 0 : _a.length) && params.ids.length > 50) {
11497
+ const actions = [];
11498
+ let ids = [...params.ids];
11499
+ while (ids.length > 0) {
11500
+ const batch = ids.splice(0, 50);
11501
+ const result = yield GetList({
11502
+ ids: batch,
11503
+ api,
11504
+ reqParams
11505
+ });
11506
+ actions.push(...result.actions);
11507
+ }
11508
+ const result = {};
11509
+ result.actions = actions;
11510
+ return result;
11511
+ }
11512
+ else {
11513
+ const urlParams = new URLSearchParams();
11514
+ urlParams.append("IDs", ids.join(","));
11515
+ urlParams.append("PageSize", ids.length.toString());
11516
+ urlParams.append("PageIndex", "0");
11517
+ const url = `pendingActions?${urlParams.toString()}`;
11518
+ const data = yield api.GET(url, Api.PrepReqParams(reqParams));
11519
+ return {
11520
+ actions: data.Items
11521
+ };
11522
+ }
11523
+ });
11524
+ }
11525
+ PendingAction.GetList = GetList;
11446
11526
  /**
11447
11527
  * Returns a list of pending action records.
11448
11528
  * @param params
@@ -15738,7 +15818,7 @@ var Scenario;
15738
15818
  })(Scenario || (Scenario = {}));
15739
15819
 
15740
15820
  // This is updated with the package.json version on build.
15741
- const VERSION = "6.0.8";
15821
+ const VERSION = "6.1.0";
15742
15822
 
15743
15823
  export { VERSION, Assembly, 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, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewBookmarkGroup, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario };
15744
15824
  //# sourceMappingURL=bruce-models.es5.js.map