bruce-models 7.1.64 → 7.1.66

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
  }
@@ -8740,6 +8753,65 @@
8740
8753
  });
8741
8754
  }
8742
8755
  ClientFile.GetList = GetList;
8756
+ function GetFindGeneratedTextureCacheKey(entityTypeSourceId, attribute) {
8757
+ return `client-file-find-generated-texture-${entityTypeSourceId}-${attribute}`;
8758
+ }
8759
+ /**
8760
+ * Returns a generated texture file for given source ID + attribute combination.
8761
+ */
8762
+ function FindGeneratedTexture(params) {
8763
+ return __awaiter(this, void 0, void 0, function* () {
8764
+ let { api, entityTypeSourceId, attribute, req: reqParams } = params;
8765
+ if (!api) {
8766
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
8767
+ }
8768
+ const key = GetFindGeneratedTextureCacheKey(entityTypeSourceId, attribute);
8769
+ const cache = api.GetCacheItem(key, reqParams);
8770
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
8771
+ return cache.data;
8772
+ }
8773
+ const prom = (() => __awaiter(this, void 0, void 0, function* () {
8774
+ var _a;
8775
+ const res = yield GetList({
8776
+ api,
8777
+ filter: {
8778
+ PageSize: 1,
8779
+ PageIndex: 0,
8780
+ Purpose: "Polygon Texture",
8781
+ FilterRows: [
8782
+ {
8783
+ column: Filter.EColumn.Data,
8784
+ path: "generation/EntityType.Source.ID",
8785
+ rowOperator: Filter.ERowOperator.AND,
8786
+ value: String(entityTypeSourceId),
8787
+ includes: true,
8788
+ valueOperator: "equals",
8789
+ rows: []
8790
+ },
8791
+ {
8792
+ column: Filter.EColumn.Data,
8793
+ path: "generation/Attribute",
8794
+ rowOperator: Filter.ERowOperator.AND,
8795
+ value: attribute,
8796
+ includes: true,
8797
+ valueOperator: "equals",
8798
+ rows: []
8799
+ }
8800
+ ]
8801
+ },
8802
+ req: reqParams
8803
+ });
8804
+ return ((_a = res.clientFiles) === null || _a === void 0 ? void 0 : _a[0]) || null;
8805
+ }))();
8806
+ api.SetCacheItem({
8807
+ key,
8808
+ value: prom,
8809
+ req: reqParams
8810
+ });
8811
+ return prom;
8812
+ });
8813
+ }
8814
+ ClientFile.FindGeneratedTexture = FindGeneratedTexture;
8743
8815
  /**
8744
8816
  * Deletes a list of client files matching the filter.
8745
8817
  * @param params
@@ -13675,6 +13747,150 @@
13675
13747
  return data;
13676
13748
  }
13677
13749
 
13750
+ (function (Ontology) {
13751
+ function Get(params) {
13752
+ return __awaiter(this, void 0, void 0, function* () {
13753
+ let { api, ontologyId, req: reqParams } = params;
13754
+ if (ontologyId == null || ontologyId === "") {
13755
+ throw ("Ontology ID is required.");
13756
+ }
13757
+ if (!api) {
13758
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
13759
+ }
13760
+ const key = GetCacheKey(ontologyId);
13761
+ const cache = api.GetCacheItem(key, reqParams);
13762
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
13763
+ return cache.data;
13764
+ }
13765
+ const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
13766
+ try {
13767
+ const data = yield api.GET(`ontology/${ontologyId}`, exports.Api.PrepReqParams(reqParams));
13768
+ res({
13769
+ ontology: ParseResponse(data)
13770
+ });
13771
+ }
13772
+ catch (e) {
13773
+ rej(e);
13774
+ }
13775
+ }));
13776
+ api.SetCacheItem({
13777
+ key,
13778
+ value: req,
13779
+ req: reqParams
13780
+ });
13781
+ return req;
13782
+ });
13783
+ }
13784
+ Ontology.Get = Get;
13785
+ function GetList(params) {
13786
+ return __awaiter(this, void 0, void 0, function* () {
13787
+ let { api, req: reqParams } = params;
13788
+ if (!api) {
13789
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
13790
+ }
13791
+ const key = GetListCacheKey();
13792
+ const cache = api.GetCacheItem(key, reqParams);
13793
+ if (cache === null || cache === void 0 ? void 0 : cache.found) {
13794
+ return cache.data;
13795
+ }
13796
+ const req = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
13797
+ try {
13798
+ const data = yield api.GET("ontologies", exports.Api.PrepReqParams(reqParams));
13799
+ res({
13800
+ ontologies: ParseListResponse(data)
13801
+ });
13802
+ }
13803
+ catch (e) {
13804
+ rej(e);
13805
+ }
13806
+ }));
13807
+ api.SetCacheItem({
13808
+ key,
13809
+ value: req,
13810
+ req: reqParams
13811
+ });
13812
+ return req;
13813
+ });
13814
+ }
13815
+ Ontology.GetList = GetList;
13816
+ function Update(params) {
13817
+ return __awaiter(this, void 0, void 0, function* () {
13818
+ let { api, ontology: data, req: reqParams } = params;
13819
+ if (!api) {
13820
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
13821
+ }
13822
+ if (!data) {
13823
+ data = {};
13824
+ }
13825
+ if (data.ID == null || data.ID === "") {
13826
+ data.ID = exports.ObjectUtils.UId();
13827
+ }
13828
+ const res = yield api.POST(`ontology/${data.ID}`, data, exports.Api.PrepReqParams(reqParams));
13829
+ api.Cache.Remove(GetCacheKey(data.ID));
13830
+ api.Cache.RemoveByStartsWith(GetListCacheKey());
13831
+ return {
13832
+ ontology: ParseResponse(res)
13833
+ };
13834
+ });
13835
+ }
13836
+ Ontology.Update = Update;
13837
+ function Delete(params) {
13838
+ return __awaiter(this, void 0, void 0, function* () {
13839
+ let { api, ontologyId, req: reqParams } = params;
13840
+ if (ontologyId == null || ontologyId === "") {
13841
+ throw ("Ontology ID is required.");
13842
+ }
13843
+ if (!api) {
13844
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
13845
+ }
13846
+ yield api.DELETE(`ontology/${ontologyId}`, exports.Api.PrepReqParams(reqParams));
13847
+ api.Cache.Remove(GetCacheKey(ontologyId));
13848
+ api.Cache.RemoveByStartsWith(GetListCacheKey());
13849
+ });
13850
+ }
13851
+ Ontology.Delete = Delete;
13852
+ function ParseResponse(response) {
13853
+ var _a, _b, _c, _d, _e, _f;
13854
+ const parsed = parseObject$4(response);
13855
+ 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;
13856
+ 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;
13857
+ }
13858
+ Ontology.ParseResponse = ParseResponse;
13859
+ function ParseListResponse(response) {
13860
+ var _a, _b, _c, _d, _e, _f, _g, _h;
13861
+ const parsed = parseObject$4(response);
13862
+ 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;
13863
+ 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;
13864
+ if (Array.isArray(list)) {
13865
+ return list;
13866
+ }
13867
+ return [];
13868
+ }
13869
+ Ontology.ParseListResponse = ParseListResponse;
13870
+ function GetCacheKey(id) {
13871
+ return `${exports.Api.ECacheKey.Ontology}${exports.Api.ECacheKey.Id}${id}`;
13872
+ }
13873
+ Ontology.GetCacheKey = GetCacheKey;
13874
+ function GetListCacheKey() {
13875
+ return exports.Api.ECacheKey.Ontology;
13876
+ }
13877
+ Ontology.GetListCacheKey = GetListCacheKey;
13878
+ })(exports.Ontology || (exports.Ontology = {}));
13879
+ function parseObject$4(data) {
13880
+ if (data == null || data == undefined) {
13881
+ return null;
13882
+ }
13883
+ if (typeof data == "string") {
13884
+ try {
13885
+ return JSON.parse(data);
13886
+ }
13887
+ catch (_a) {
13888
+ return null;
13889
+ }
13890
+ }
13891
+ return data;
13892
+ }
13893
+
13678
13894
  (function (ExportBrz) {
13679
13895
  function Export(params) {
13680
13896
  return __awaiter(this, void 0, void 0, function* () {
@@ -19012,7 +19228,7 @@
19012
19228
  })(exports.UrlUtils || (exports.UrlUtils = {}));
19013
19229
 
19014
19230
  // This is updated with the package.json version on build.
19015
- const VERSION = "7.1.64";
19231
+ const VERSION = "7.1.66";
19016
19232
 
19017
19233
  exports.VERSION = VERSION;
19018
19234
  exports.AbstractApi = AbstractApi;