bruce-models 7.1.63 → 7.1.65

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.
@@ -44,6 +44,7 @@
44
44
  ECacheKey["Assembly"] = "assembly";
45
45
  ECacheKey["Entity"] = "entity";
46
46
  ECacheKey["EntityType"] = "entitytype";
47
+ ECacheKey["Ontology"] = "ontology";
47
48
  ECacheKey["EntityTypeTrigger"] = "entitytypetrigger";
48
49
  ECacheKey["DataFeed"] = "datafeed";
49
50
  ECacheKey["ProjectView"] = "projectview";
@@ -5223,7 +5224,7 @@
5223
5224
  */
5224
5225
  function GetList(params) {
5225
5226
  return __awaiter(this, void 0, void 0, function* () {
5226
- let { entityTypeIds, api, req: reqParams, parentTypeId, expandSettings, search, expandLODs, expandOntologyDiagramSettings } = params;
5227
+ let { entityTypeIds, api, req: reqParams, parentTypeId, ontologyId, expandSettings, search, expandLODs, expandOntologyDiagramSettings } = params;
5227
5228
  if (!api) {
5228
5229
  api = exports.ENVIRONMENT.Api().GetBruceApi();
5229
5230
  }
@@ -5253,6 +5254,10 @@
5253
5254
  if (parentTypeId) {
5254
5255
  urlParams.append("ParentTypeID", parentTypeId);
5255
5256
  }
5257
+ if (ontologyId != null && ontologyId !== "") {
5258
+ urlParams.append("Ontology.ID", String(ontologyId));
5259
+ urlParams.append("ontologyId", String(ontologyId));
5260
+ }
5256
5261
  appendEntityTypeExpandParams(urlParams, {
5257
5262
  expandSettings,
5258
5263
  expandLODs,
@@ -5269,6 +5274,10 @@
5269
5274
  if (parentTypeId) {
5270
5275
  urlParams.append("ParentTypeID", parentTypeId);
5271
5276
  }
5277
+ if (ontologyId != null && ontologyId !== "") {
5278
+ urlParams.append("Ontology.ID", String(ontologyId));
5279
+ urlParams.append("ontologyId", String(ontologyId));
5280
+ }
5272
5281
  appendEntityTypeExpandParams(urlParams, {
5273
5282
  expandSettings,
5274
5283
  expandLODs,
@@ -5306,7 +5315,8 @@
5306
5315
  expandSettings,
5307
5316
  expandLODs,
5308
5317
  expandOntologyDiagramSettings,
5309
- search
5318
+ search,
5319
+ ontologyId
5310
5320
  }),
5311
5321
  value: req,
5312
5322
  req: reqParams,
@@ -5734,7 +5744,7 @@
5734
5744
  if (!params) {
5735
5745
  params = {};
5736
5746
  }
5737
- let { typeIds, expandSettings, parentTypeId, expandLODs, expandOntologyDiagramSettings, search } = params;
5747
+ let { typeIds, expandSettings, parentTypeId, ontologyId, expandLODs, expandOntologyDiagramSettings, search } = params;
5738
5748
  let key = exports.Api.ECacheKey.EntityType;
5739
5749
  if (!typeIds) {
5740
5750
  typeIds = [];
@@ -5743,6 +5753,9 @@
5743
5753
  if (parentTypeId) {
5744
5754
  key += "_PARENT_" + parentTypeId;
5745
5755
  }
5756
+ if (ontologyId != null && ontologyId !== "") {
5757
+ key += "_ONTOLOGY_" + ontologyId;
5758
+ }
5746
5759
  if (!expandSettings) {
5747
5760
  expandSettings = false;
5748
5761
  }
@@ -10918,6 +10931,23 @@
10918
10931
  // Render a cylinder with a fixed meter size.
10919
10932
  EPointType["Cylinder"] = "CYLINDER";
10920
10933
  })(EPointType = Style.EPointType || (Style.EPointType = {}));
10934
+ /**
10935
+ * Dictates whether a polygon renders a flat colour fill or a texture image.
10936
+ * Default is "COLOR".
10937
+ */
10938
+ let EPolygonFillType;
10939
+ (function (EPolygonFillType) {
10940
+ EPolygonFillType["Color"] = "COLOR";
10941
+ EPolygonFillType["Texture"] = "TEXTURE";
10942
+ })(EPolygonFillType = Style.EPolygonFillType || (Style.EPolygonFillType = {}));
10943
+ /**
10944
+ * Available ways to tint a rendered texture into a colour gradient.
10945
+ * Currently used for ERDDAP generated textures which are BLACK_WHITE scale images to be recoloured by UI.
10946
+ */
10947
+ let ETextureColorMaskType;
10948
+ (function (ETextureColorMaskType) {
10949
+ ETextureColorMaskType["BlackWhite"] = "BLACK_WHITE";
10950
+ })(ETextureColorMaskType = Style.ETextureColorMaskType || (Style.ETextureColorMaskType = {}));
10921
10951
  /**
10922
10952
  * Returns a list of styles.
10923
10953
  * @param params
@@ -13658,6 +13688,150 @@
13658
13688
  return data;
13659
13689
  }
13660
13690
 
13691
+ (function (Ontology) {
13692
+ function Get(params) {
13693
+ return __awaiter(this, void 0, void 0, function* () {
13694
+ let { api, ontologyId, req: reqParams } = params;
13695
+ if (ontologyId == null || ontologyId === "") {
13696
+ throw ("Ontology ID is required.");
13697
+ }
13698
+ if (!api) {
13699
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
13700
+ }
13701
+ const key = GetCacheKey(ontologyId);
13702
+ const cache = api.GetCacheItem(key, reqParams);
13703
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
13704
+ return cache.data;
13705
+ }
13706
+ const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
13707
+ try {
13708
+ const data = yield api.GET(`ontology/${ontologyId}`, exports.Api.PrepReqParams(reqParams));
13709
+ res({
13710
+ ontology: ParseResponse(data)
13711
+ });
13712
+ }
13713
+ catch (e) {
13714
+ rej(e);
13715
+ }
13716
+ }));
13717
+ api.SetCacheItem({
13718
+ key,
13719
+ value: req,
13720
+ req: reqParams
13721
+ });
13722
+ return req;
13723
+ });
13724
+ }
13725
+ Ontology.Get = Get;
13726
+ function GetList(params) {
13727
+ return __awaiter(this, void 0, void 0, function* () {
13728
+ let { api, req: reqParams } = params;
13729
+ if (!api) {
13730
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
13731
+ }
13732
+ const key = GetListCacheKey();
13733
+ const cache = api.GetCacheItem(key, reqParams);
13734
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
13735
+ return cache.data;
13736
+ }
13737
+ const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
13738
+ try {
13739
+ const data = yield api.GET("ontologies", exports.Api.PrepReqParams(reqParams));
13740
+ res({
13741
+ ontologies: ParseListResponse(data)
13742
+ });
13743
+ }
13744
+ catch (e) {
13745
+ rej(e);
13746
+ }
13747
+ }));
13748
+ api.SetCacheItem({
13749
+ key,
13750
+ value: req,
13751
+ req: reqParams
13752
+ });
13753
+ return req;
13754
+ });
13755
+ }
13756
+ Ontology.GetList = GetList;
13757
+ function Update(params) {
13758
+ return __awaiter(this, void 0, void 0, function* () {
13759
+ let { api, ontology: data, req: reqParams } = params;
13760
+ if (!api) {
13761
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
13762
+ }
13763
+ if (!data) {
13764
+ data = {};
13765
+ }
13766
+ if (data.ID == null || data.ID === "") {
13767
+ data.ID = exports.ObjectUtils.UId();
13768
+ }
13769
+ const res = yield api.POST(`ontology/${data.ID}`, data, exports.Api.PrepReqParams(reqParams));
13770
+ api.Cache.Remove(GetCacheKey(data.ID));
13771
+ api.Cache.RemoveByStartsWith(GetListCacheKey());
13772
+ return {
13773
+ ontology: ParseResponse(res)
13774
+ };
13775
+ });
13776
+ }
13777
+ Ontology.Update = Update;
13778
+ function Delete(params) {
13779
+ return __awaiter(this, void 0, void 0, function* () {
13780
+ let { api, ontologyId, req: reqParams } = params;
13781
+ if (ontologyId == null || ontologyId === "") {
13782
+ throw ("Ontology ID is required.");
13783
+ }
13784
+ if (!api) {
13785
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
13786
+ }
13787
+ yield api.DELETE(`ontology/${ontologyId}`, exports.Api.PrepReqParams(reqParams));
13788
+ api.Cache.Remove(GetCacheKey(ontologyId));
13789
+ api.Cache.RemoveByStartsWith(GetListCacheKey());
13790
+ });
13791
+ }
13792
+ Ontology.Delete = Delete;
13793
+ function ParseResponse(response) {
13794
+ var _a, _b, _c, _d, _e, _f;
13795
+ const parsed = parseObject$4(response);
13796
+ const parsedResult = (_a = parseObject$4(parsed === null || parsed === void 0 ? void 0 : parsed.Result)) !== null && _a !== void 0 ? _a : parsed === null || parsed === void 0 ? void 0 : parsed.Result;
13797
+ return (_f = (_e = (_d = (_c = (_b = parsed === null || parsed === void 0 ? void 0 : parsed.Ontology) !== null && _b !== void 0 ? _b : parsed === null || parsed === void 0 ? void 0 : parsed.BruceOntology) !== null && _c !== void 0 ? _c : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.Ontology) !== null && _d !== void 0 ? _d : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.BruceOntology) !== null && _e !== void 0 ? _e : parsedResult) !== null && _f !== void 0 ? _f : parsed;
13798
+ }
13799
+ Ontology.ParseResponse = ParseResponse;
13800
+ function ParseListResponse(response) {
13801
+ var _a, _b, _c, _d, _e, _f, _g, _h;
13802
+ const parsed = parseObject$4(response);
13803
+ const parsedResult = (_a = parseObject$4(parsed === null || parsed === void 0 ? void 0 : parsed.Result)) !== null && _a !== void 0 ? _a : parsed === null || parsed === void 0 ? void 0 : parsed.Result;
13804
+ const list = (_h = (_g = (_f = (_e = (_d = (_c = (_b = parsed === null || parsed === void 0 ? void 0 : parsed.Items) !== null && _b !== void 0 ? _b : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.Items) !== null && _c !== void 0 ? _c : parsed === null || parsed === void 0 ? void 0 : parsed.Ontologies) !== null && _d !== void 0 ? _d : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.Ontologies) !== null && _e !== void 0 ? _e : parsed === null || parsed === void 0 ? void 0 : parsed.BruceOntologies) !== null && _f !== void 0 ? _f : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.BruceOntologies) !== null && _g !== void 0 ? _g : parsedResult) !== null && _h !== void 0 ? _h : parsed;
13805
+ if (Array.isArray(list)) {
13806
+ return list;
13807
+ }
13808
+ return [];
13809
+ }
13810
+ Ontology.ParseListResponse = ParseListResponse;
13811
+ function GetCacheKey(id) {
13812
+ return `${exports.Api.ECacheKey.Ontology}${exports.Api.ECacheKey.Id}${id}`;
13813
+ }
13814
+ Ontology.GetCacheKey = GetCacheKey;
13815
+ function GetListCacheKey() {
13816
+ return exports.Api.ECacheKey.Ontology;
13817
+ }
13818
+ Ontology.GetListCacheKey = GetListCacheKey;
13819
+ })(exports.Ontology || (exports.Ontology = {}));
13820
+ function parseObject$4(data) {
13821
+ if (data == null || data == undefined) {
13822
+ return null;
13823
+ }
13824
+ if (typeof data == "string") {
13825
+ try {
13826
+ return JSON.parse(data);
13827
+ }
13828
+ catch (_a) {
13829
+ return null;
13830
+ }
13831
+ }
13832
+ return data;
13833
+ }
13834
+
13661
13835
  (function (ExportBrz) {
13662
13836
  function Export(params) {
13663
13837
  return __awaiter(this, void 0, void 0, function* () {
@@ -18995,7 +19169,7 @@
18995
19169
  })(exports.UrlUtils || (exports.UrlUtils = {}));
18996
19170
 
18997
19171
  // This is updated with the package.json version on build.
18998
- const VERSION = "7.1.63";
19172
+ const VERSION = "7.1.65";
18999
19173
 
19000
19174
  exports.VERSION = VERSION;
19001
19175
  exports.AbstractApi = AbstractApi;