bruce-models 5.9.2 → 5.9.3

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.
@@ -35,6 +35,7 @@ var Api;
35
35
  (function (ECacheKey) {
36
36
  ECacheKey["Id"] = ":";
37
37
  ECacheKey["ListId"] = "::";
38
+ ECacheKey["Assembly"] = "assembly";
38
39
  ECacheKey["Entity"] = "entity";
39
40
  ECacheKey["EntityType"] = "entitytype";
40
41
  ECacheKey["ProjectView"] = "projectview";
@@ -1741,6 +1742,198 @@ var ENVIRONMENT;
1741
1742
  ENVIRONMENT.Reset = Reset;
1742
1743
  })(ENVIRONMENT || (ENVIRONMENT = {}));
1743
1744
 
1745
+ /**
1746
+ * Represents the assembly concept in Nextspace.
1747
+ * An assembly is a record of an Entity hierarchy, typically derived from a set Root Entity.
1748
+ * These are auto-generated from assembly imports (eg: IFC).
1749
+ */
1750
+ var Assembly;
1751
+ (function (Assembly) {
1752
+ /**
1753
+ * Returns an assembly record by ID.
1754
+ * @param params
1755
+ * @returns
1756
+ */
1757
+ function Get(params) {
1758
+ return __awaiter(this, void 0, void 0, function* () {
1759
+ let { api, assemblyId, req: reqParams } = params;
1760
+ if (!api) {
1761
+ api = ENVIRONMENT.Api().GetBruceApi();
1762
+ }
1763
+ if (!assemblyId) {
1764
+ throw ("Assembly ID is required.");
1765
+ }
1766
+ const key = GetCacheKey(assemblyId);
1767
+ const cache = api.GetCacheItem(key, reqParams);
1768
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
1769
+ return cache.data;
1770
+ }
1771
+ const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
1772
+ try {
1773
+ const data = yield api.GET(`v3/assembly/${assemblyId}`, Api.PrepReqParams(reqParams));
1774
+ res({
1775
+ assembly: data
1776
+ });
1777
+ }
1778
+ catch (e) {
1779
+ rej(e);
1780
+ }
1781
+ }));
1782
+ api.SetCacheItem({
1783
+ key,
1784
+ value: prom,
1785
+ req: reqParams
1786
+ });
1787
+ return prom;
1788
+ });
1789
+ }
1790
+ Assembly.Get = Get;
1791
+ /**
1792
+ * Gets a list of assembly records.
1793
+ * @param params
1794
+ * @returns
1795
+ */
1796
+ function GetList(params) {
1797
+ return __awaiter(this, void 0, void 0, function* () {
1798
+ let { api, req: reqParams } = params;
1799
+ if (!api) {
1800
+ api = ENVIRONMENT.Api().GetBruceApi();
1801
+ }
1802
+ const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
1803
+ try {
1804
+ let url = "v3/assemblies";
1805
+ const urlParams = new URLSearchParams();
1806
+ if (params.pageSize != null) {
1807
+ urlParams.append("PageSize", String(params.pageSize));
1808
+ }
1809
+ if (params.pageIndex != null) {
1810
+ urlParams.append("PageIndex", String(params.pageIndex));
1811
+ }
1812
+ if (params.parentId) {
1813
+ urlParams.append("ParentID", String(params.parentId));
1814
+ }
1815
+ url += "?" + urlParams.toString();
1816
+ const data = yield api.GET(url, Api.PrepReqParams(reqParams));
1817
+ const result = {};
1818
+ result.assemblies = data.Items ? data.Items : [];
1819
+ if (data.TotalCount != null) {
1820
+ result.totalCount = data.TotalCount;
1821
+ }
1822
+ if (data.NextPage != null) {
1823
+ result.nextPage = data.NextPage;
1824
+ }
1825
+ if (data.NextPageURL != null) {
1826
+ result.nextPageUrl = data.NextPageURL;
1827
+ }
1828
+ res(result);
1829
+ }
1830
+ catch (e) {
1831
+ rej(e);
1832
+ }
1833
+ }));
1834
+ return req;
1835
+ });
1836
+ }
1837
+ Assembly.GetList = GetList;
1838
+ /**
1839
+ * Creates or updates an assembly record.
1840
+ * @param params
1841
+ * @returns
1842
+ */
1843
+ function Update(params) {
1844
+ return __awaiter(this, void 0, void 0, function* () {
1845
+ let { api, assembly: data, req: reqParams } = params;
1846
+ if (!api) {
1847
+ api = ENVIRONMENT.Api().GetBruceApi();
1848
+ }
1849
+ if (!data.ID) {
1850
+ data.ID = 0;
1851
+ }
1852
+ const url = `v3/assembly/${data.ID}`;
1853
+ const res = yield api.POST(url, data, Api.PrepReqParams(reqParams));
1854
+ api.Cache.Remove(GetCacheKey(data.ID));
1855
+ return {
1856
+ assembly: res
1857
+ };
1858
+ });
1859
+ }
1860
+ Assembly.Update = Update;
1861
+ /**
1862
+ * Deletes an assembly record.
1863
+ * @param params
1864
+ */
1865
+ function Delete(params) {
1866
+ return __awaiter(this, void 0, void 0, function* () {
1867
+ let { api, assemblyId, req: reqParams } = params;
1868
+ if (!assemblyId) {
1869
+ throw ("Assembly ID is required.");
1870
+ }
1871
+ if (!api) {
1872
+ api = ENVIRONMENT.Api().GetBruceApi();
1873
+ }
1874
+ yield api.DELETE(`v3/assembly/${assemblyId}`, Api.PrepReqParams(reqParams));
1875
+ api.Cache.Remove(GetCacheKey(assemblyId));
1876
+ });
1877
+ }
1878
+ Assembly.Delete = Delete;
1879
+ /**
1880
+ * Deletes a list of assembly records based on specified conditions.
1881
+ * @param params
1882
+ */
1883
+ function DeleteList(params) {
1884
+ return __awaiter(this, void 0, void 0, function* () {
1885
+ let { api, req: reqParams } = params;
1886
+ if (!api) {
1887
+ api = ENVIRONMENT.Api().GetBruceApi();
1888
+ }
1889
+ let url = "v3/assemblies";
1890
+ const urlParams = new URLSearchParams();
1891
+ if (params.invalidRootIds) {
1892
+ urlParams.append("InvalidRootEntityID", "true");
1893
+ }
1894
+ url += "?" + urlParams.toString();
1895
+ yield api.DELETE(url, Api.PrepReqParams(reqParams));
1896
+ api.Cache.RemoveByStartsWith(Api.ECacheKey.Assembly);
1897
+ });
1898
+ }
1899
+ Assembly.DeleteList = DeleteList;
1900
+ /**
1901
+ * Runs a job to locate existing assemblies by searching for root Entity IDs.
1902
+ * Each unregistered root Entity ID will be used to create a new assembly.
1903
+ *
1904
+ * WARNING: on completion, you should kill cache.
1905
+ * Eg: api.Cache.RemoveByStartsWith(Api.ECacheKey.Assembly);
1906
+ * @param params
1907
+ */
1908
+ function SyncWithRootEntityIDs(params) {
1909
+ return __awaiter(this, void 0, void 0, function* () {
1910
+ if (!params) {
1911
+ params = {};
1912
+ }
1913
+ let { api, req: reqParams } = params;
1914
+ if (!api) {
1915
+ api = ENVIRONMENT.Api().GetBruceApi();
1916
+ }
1917
+ return yield api.POST("v3/assembly/resyncrootentitiestoassemblies", {}, Api.PrepReqParams(reqParams));
1918
+ });
1919
+ }
1920
+ Assembly.SyncWithRootEntityIDs = SyncWithRootEntityIDs;
1921
+ /**
1922
+ * Returns cache identifier for an assembly by ID.
1923
+ * Example: {
1924
+ * const api: BruceApi.Api = ...;
1925
+ * const key = GetCacheKey(5);
1926
+ * api.Cache.Remove(key);
1927
+ * }
1928
+ * @param assemblyId
1929
+ * @returns
1930
+ */
1931
+ function GetCacheKey(assemblyId) {
1932
+ return `${Api.ECacheKey.Assembly}${Api.ECacheKey.Id}${assemblyId}`;
1933
+ }
1934
+ Assembly.GetCacheKey = GetCacheKey;
1935
+ })(Assembly || (Assembly = {}));
1936
+
1744
1937
  /**
1745
1938
  * Describes communication with the "Annotated Document" concept in Bruce.
1746
1939
  * Annotated documents are files with hotspots that can link to Entity records.
@@ -15417,7 +15610,7 @@ var Scenario;
15417
15610
  })(Scenario || (Scenario = {}));
15418
15611
 
15419
15612
  // This is updated with the package.json version on build.
15420
- const VERSION = "5.9.2";
15613
+ const VERSION = "5.9.3";
15421
15614
 
15422
- 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, 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 };
15615
+ 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 };
15423
15616
  //# sourceMappingURL=bruce-models.es5.js.map