bruce-models 7.1.25 → 7.1.27

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.
@@ -3276,14 +3276,14 @@
3276
3276
  */
3277
3277
  function Get(params) {
3278
3278
  return __awaiter(this, void 0, void 0, function* () {
3279
- let { api, entityTypeId: typeId, req: reqParams, expandLODs } = params;
3279
+ let { api, entityTypeId: typeId, req: reqParams, expandLODs, expandOntologyDiagramSettings } = params;
3280
3280
  if (!typeId) {
3281
3281
  throw ("Type ID is required.");
3282
3282
  }
3283
3283
  if (!api) {
3284
3284
  api = exports.ENVIRONMENT.Api().GetBruceApi();
3285
3285
  }
3286
- const key = GetCacheKey(typeId, expandLODs);
3286
+ const key = GetCacheKey(typeId, expandLODs, expandOntologyDiagramSettings);
3287
3287
  const cache = api.GetCacheItem(key, reqParams);
3288
3288
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
3289
3289
  return cache.data;
@@ -3291,9 +3291,10 @@
3291
3291
  const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
3292
3292
  try {
3293
3293
  const urlParams = new URLSearchParams();
3294
- if (expandLODs) {
3295
- urlParams.append("Expand", "LOD");
3296
- }
3294
+ appendEntityTypeExpandParams(urlParams, {
3295
+ expandLODs,
3296
+ expandOntologyDiagramSettings
3297
+ });
3297
3298
  const url = `entitytype/${typeId}?${urlParams.toString()}`;
3298
3299
  const data = yield api.GET(url, exports.Api.PrepReqParams(reqParams));
3299
3300
  appendInternalAttrSchema(data);
@@ -3340,7 +3341,7 @@
3340
3341
  */
3341
3342
  function GetList(params) {
3342
3343
  return __awaiter(this, void 0, void 0, function* () {
3343
- let { entityTypeIds, api, req: reqParams, parentTypeId, expandSettings, search, expandLODs } = params;
3344
+ let { entityTypeIds, api, req: reqParams, parentTypeId, expandSettings, search, expandLODs, expandOntologyDiagramSettings } = params;
3344
3345
  if (!api) {
3345
3346
  api = exports.ENVIRONMENT.Api().GetBruceApi();
3346
3347
  }
@@ -3349,6 +3350,7 @@
3349
3350
  parentTypeId,
3350
3351
  expandLODs,
3351
3352
  expandSettings,
3353
+ expandOntologyDiagramSettings,
3352
3354
  search
3353
3355
  }), reqParams);
3354
3356
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
@@ -3369,15 +3371,11 @@
3369
3371
  if (parentTypeId) {
3370
3372
  urlParams.append("ParentTypeID", parentTypeId);
3371
3373
  }
3372
- if (expandSettings && expandLODs) {
3373
- urlParams.append("Expand", "true");
3374
- }
3375
- else if (expandSettings) {
3376
- urlParams.append("Expand", "Schema");
3377
- }
3378
- else if (expandLODs) {
3379
- urlParams.append("Expand", "LOD");
3380
- }
3374
+ appendEntityTypeExpandParams(urlParams, {
3375
+ expandSettings,
3376
+ expandLODs,
3377
+ expandOntologyDiagramSettings
3378
+ });
3381
3379
  if (search) {
3382
3380
  urlParams.append("Search", search);
3383
3381
  }
@@ -3389,15 +3387,11 @@
3389
3387
  if (parentTypeId) {
3390
3388
  urlParams.append("ParentTypeID", parentTypeId);
3391
3389
  }
3392
- if (expandSettings && expandLODs) {
3393
- urlParams.append("Expand", "true");
3394
- }
3395
- else if (expandSettings) {
3396
- urlParams.append("Expand", "Schema");
3397
- }
3398
- else if (expandLODs) {
3399
- urlParams.append("Expand", "LOD");
3400
- }
3390
+ appendEntityTypeExpandParams(urlParams, {
3391
+ expandSettings,
3392
+ expandLODs,
3393
+ expandOntologyDiagramSettings
3394
+ });
3401
3395
  if (search) {
3402
3396
  urlParams.append("Search", search);
3403
3397
  }
@@ -3429,6 +3423,7 @@
3429
3423
  parentTypeId,
3430
3424
  expandSettings,
3431
3425
  expandLODs,
3426
+ expandOntologyDiagramSettings,
3432
3427
  search
3433
3428
  }),
3434
3429
  value: req,
@@ -3474,6 +3469,31 @@
3474
3469
  });
3475
3470
  }
3476
3471
  EntityType.Update = Update;
3472
+ /**
3473
+ * Updates only the OntologyDiagramSettings for the specified Entity Type.
3474
+ * This calls: POST entityType/{entityType_id}/ontologyDiagramSettings
3475
+ */
3476
+ function UpdateOntologyDiagramSettings(params) {
3477
+ return __awaiter(this, void 0, void 0, function* () {
3478
+ let { api, entityTypeId, ontologyDiagramSettings, req } = params;
3479
+ if (!entityTypeId) {
3480
+ throw ("Type ID is required.");
3481
+ }
3482
+ if (ontologyDiagramSettings == null) {
3483
+ throw ("OntologyDiagramSettings is required.");
3484
+ }
3485
+ if (!api) {
3486
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
3487
+ }
3488
+ const res = yield api.POST(`entityType/${entityTypeId}/ontologyDiagramSettings`, {
3489
+ OntologyDiagramSettings: ontologyDiagramSettings
3490
+ }, exports.Api.PrepReqParams(req));
3491
+ api.Cache.RemoveByStartsWith(GetCacheKey(entityTypeId));
3492
+ api.Cache.RemoveByStartsWith(GetListCacheKey());
3493
+ return ParseUpdateOntologyDiagramSettingsResponse(res);
3494
+ });
3495
+ }
3496
+ EntityType.UpdateOntologyDiagramSettings = UpdateOntologyDiagramSettings;
3477
3497
  /**
3478
3498
  * Starts a re-index background action on a specified Entity Type.
3479
3499
  * This will ensure searchable data follows the current schema version.
@@ -3648,6 +3668,21 @@
3648
3668
  return [];
3649
3669
  }
3650
3670
  EntityType.ParseDictionaryDataSchemaDependenciesResponse = ParseDictionaryDataSchemaDependenciesResponse;
3671
+ /**
3672
+ * Normalizes response from UpdateOntologyDiagramSettings.
3673
+ * Supports direct response payloads and wrapper shapes.
3674
+ */
3675
+ function ParseUpdateOntologyDiagramSettingsResponse(response) {
3676
+ var _a, _b, _c;
3677
+ const parsed = parseObject$1(response);
3678
+ const parsedResult = (_a = parseObject$1(parsed === null || parsed === void 0 ? void 0 : parsed.Result)) !== null && _a !== void 0 ? _a : parsed === null || parsed === void 0 ? void 0 : parsed.Result;
3679
+ return {
3680
+ entityTypeId: (_b = parsed === null || parsed === void 0 ? void 0 : parsed["EntityType.ID"]) !== null && _b !== void 0 ? _b : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult["EntityType.ID"],
3681
+ ontologyDiagramSettings: (_c = parsed === null || parsed === void 0 ? void 0 : parsed.OntologyDiagramSettings) !== null && _c !== void 0 ? _c : parsedResult === null || parsedResult === void 0 ? void 0 : parsedResult.OntologyDiagramSettings,
3682
+ raw: parsed
3683
+ };
3684
+ }
3685
+ EntityType.ParseUpdateOntologyDiagramSettingsResponse = ParseUpdateOntologyDiagramSettingsResponse;
3651
3686
  /**
3652
3687
  * Normalizes response from ExportOntology.
3653
3688
  * Supports both direct response payloads and wrapper shapes.
@@ -3725,11 +3760,14 @@
3725
3760
  * @param expandLODs
3726
3761
  * @returns
3727
3762
  */
3728
- function GetCacheKey(typeId, expandLODs) {
3763
+ function GetCacheKey(typeId, expandLODs, expandOntologyDiagramSettings) {
3729
3764
  let key = `${exports.Api.ECacheKey.EntityType}${exports.Api.ECacheKey.Id}${typeId}`;
3730
3765
  if (expandLODs) {
3731
3766
  key += "_LOD_" + expandLODs;
3732
3767
  }
3768
+ if (expandOntologyDiagramSettings) {
3769
+ key += "_ONTOLOGY_DIAGRAM_SETTINGS_" + expandOntologyDiagramSettings;
3770
+ }
3733
3771
  return key;
3734
3772
  }
3735
3773
  EntityType.GetCacheKey = GetCacheKey;
@@ -3747,7 +3785,7 @@
3747
3785
  if (!params) {
3748
3786
  params = {};
3749
3787
  }
3750
- let { typeIds, expandSettings, parentTypeId, expandLODs, search } = params;
3788
+ let { typeIds, expandSettings, parentTypeId, expandLODs, expandOntologyDiagramSettings, search } = params;
3751
3789
  let key = exports.Api.ECacheKey.EntityType;
3752
3790
  if (!typeIds) {
3753
3791
  typeIds = [];
@@ -3762,8 +3800,12 @@
3762
3800
  if (!expandLODs) {
3763
3801
  expandLODs = false;
3764
3802
  }
3803
+ if (!expandOntologyDiagramSettings) {
3804
+ expandOntologyDiagramSettings = false;
3805
+ }
3765
3806
  key += "_SCHEMA_" + expandSettings;
3766
3807
  key += "_LOD_" + expandLODs;
3808
+ key += "_ONTOLOGY_DIAGRAM_SETTINGS_" + expandOntologyDiagramSettings;
3767
3809
  if (search) {
3768
3810
  key += "_SEARCH_" + search;
3769
3811
  }
@@ -3771,6 +3813,17 @@
3771
3813
  }
3772
3814
  EntityType.GetListCacheKey = GetListCacheKey;
3773
3815
  })(exports.EntityType || (exports.EntityType = {}));
3816
+ function appendEntityTypeExpandParams(urlParams, params) {
3817
+ if (params.expandSettings) {
3818
+ urlParams.append("Expand", "Schema");
3819
+ }
3820
+ if (params.expandLODs) {
3821
+ urlParams.append("Expand", "LOD");
3822
+ }
3823
+ if (params.expandOntologyDiagramSettings) {
3824
+ urlParams.append("Expand", "ontologydiagramsettings");
3825
+ }
3826
+ }
3774
3827
  function parseObject$1(data) {
3775
3828
  if (data == null || data == undefined) {
3776
3829
  return null;
@@ -4014,8 +4067,10 @@
4014
4067
  return cachedData;
4015
4068
  }
4016
4069
  else {
4070
+ // Cache may contain either the raw entity or a wrapped blob.
4071
+ const normalized = (cachedData === null || cachedData === void 0 ? void 0 : cachedData.Bruce) ? cachedData : cachedData === null || cachedData === void 0 ? void 0 : cachedData.entity;
4017
4072
  return Promise.resolve({
4018
- entity: cachedData
4073
+ entity: normalized
4019
4074
  });
4020
4075
  }
4021
4076
  }
@@ -17667,7 +17722,7 @@
17667
17722
  })(exports.ChangeSet || (exports.ChangeSet = {}));
17668
17723
 
17669
17724
  // This is updated with the package.json version on build.
17670
- const VERSION = "7.1.25";
17725
+ const VERSION = "7.1.27";
17671
17726
 
17672
17727
  exports.VERSION = VERSION;
17673
17728
  exports.AbstractApi = AbstractApi;