bruce-models 3.9.5 → 3.9.7

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.
@@ -3202,7 +3202,7 @@
3202
3202
  */
3203
3203
  function Get(params) {
3204
3204
  return __awaiter(this, void 0, void 0, function* () {
3205
- let { api, entityId, req: reqParams, expandLocation, expandRelations, entityTypeId, historicFrom, historicKey, historicTo, historicPoint } = params;
3205
+ let { api, entityId, schemaId, req: reqParams, expandLocation, expandRelations, entityTypeId, historicFrom, historicKey, historicTo, historicPoint } = params;
3206
3206
  if (!entityId) {
3207
3207
  throw ("Entity ID is required.");
3208
3208
  }
@@ -3217,7 +3217,8 @@
3217
3217
  historicFrom,
3218
3218
  historicKey,
3219
3219
  historicTo,
3220
- historicPoint
3220
+ historicPoint,
3221
+ schemaId
3221
3222
  });
3222
3223
  const cache = api.GetCacheItem(key, reqParams);
3223
3224
  if (cache === null || cache === void 0 ? void 0 : cache.found) {
@@ -3247,6 +3248,9 @@
3247
3248
  if (historicPoint) {
3248
3249
  urlParams.set("historicPoint", historicPoint);
3249
3250
  }
3251
+ if (schemaId) {
3252
+ urlParams.set("schema", schemaId);
3253
+ }
3250
3254
  const data = yield api.GET(`entity/${entityId}?${urlParams.toString()}`, exports.Api.PrepReqParams(reqParams));
3251
3255
  res({
3252
3256
  entity: data
@@ -3272,7 +3276,7 @@
3272
3276
  */
3273
3277
  function GetListByIds(params) {
3274
3278
  return __awaiter(this, void 0, void 0, function* () {
3275
- let { api, entityIds, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint } = params;
3279
+ let { api, entityIds, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint } = params;
3276
3280
  if (!entityIds.length) {
3277
3281
  throw ("Entity IDs are required.");
3278
3282
  }
@@ -3318,9 +3322,14 @@
3318
3322
  if (historicPoint) {
3319
3323
  reqData["historicPoint"] = historicPoint;
3320
3324
  }
3325
+ const urlParams = new URLSearchParams();
3326
+ if (schemaId) {
3327
+ urlParams.set("schema", schemaId);
3328
+ }
3329
+ const url = `entities?${urlParams.toString()}`;
3321
3330
  const reqs = [];
3322
3331
  if (reqIds.length > 0) {
3323
- const req = api.POST("entities", reqData, exports.Api.PrepReqParams(reqParams));
3332
+ const req = api.POST(url, reqData, exports.Api.PrepReqParams(reqParams));
3324
3333
  for (let i = 0; i < reqIds.length; i++) {
3325
3334
  const entityId = reqIds[i];
3326
3335
  const key = GetCacheKey({
@@ -3331,7 +3340,8 @@
3331
3340
  historicFrom: historicFrom,
3332
3341
  historicKey: historicKey,
3333
3342
  historicTo: historicTo,
3334
- historicPoint: historicPoint
3343
+ historicPoint: historicPoint,
3344
+ schemaId: schemaId
3335
3345
  });
3336
3346
  const prom = new Promise((res) => __awaiter(this, void 0, void 0, function* () {
3337
3347
  try {
@@ -3616,7 +3626,7 @@
3616
3626
  function GetList(params) {
3617
3627
  var _a;
3618
3628
  return __awaiter(this, void 0, void 0, function* () {
3619
- let { api, filter, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, historicFrom, historicKey, historicTo, historicPoint } = params;
3629
+ let { api, filter, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, historicFrom, historicKey, historicTo, historicPoint } = params;
3620
3630
  if (!api) {
3621
3631
  api = exports.ENVIRONMENT.Api().GetBruceApi();
3622
3632
  }
@@ -3709,6 +3719,9 @@
3709
3719
  if (historicPoint) {
3710
3720
  urlParams.set("historicPoint", historicPoint);
3711
3721
  }
3722
+ if (schemaId) {
3723
+ urlParams.set("schema", schemaId);
3724
+ }
3712
3725
  const urlStr = url.toString() + "?" + urlParams.toString();
3713
3726
  const data = yield api.get(urlStr, exports.Api.PrepReqParams(reqParams));
3714
3727
  if (!analysis) {
@@ -3722,6 +3735,9 @@
3722
3735
  if (expandRelations) {
3723
3736
  urlParams.append("$expand", "relation");
3724
3737
  }
3738
+ if (schemaId) {
3739
+ urlParams.set("schema", schemaId);
3740
+ }
3725
3741
  const urlStr = url.toString() + "?" + urlParams.toString();
3726
3742
  const data = yield api.post(urlStr, body, exports.Api.PrepReqParams(reqParams));
3727
3743
  if (!analysis) {
@@ -3738,7 +3754,8 @@
3738
3754
  entityTypeId: filter.entityTypeId,
3739
3755
  historicFrom: historicFrom,
3740
3756
  historicKey: historicKey,
3741
- historicTo: historicTo
3757
+ historicTo: historicTo,
3758
+ schemaId: schemaId
3742
3759
  }),
3743
3760
  value: {
3744
3761
  entity: entity
@@ -3886,7 +3903,7 @@
3886
3903
  * @returns
3887
3904
  */
3888
3905
  function GetCacheKey(params) {
3889
- let { entityId, entityTypeId, expandLocation, expandRelations, historicFrom, historicKey, historicTo, historicPoint } = params;
3906
+ let { entityId, entityTypeId, schemaId, expandLocation, expandRelations, historicFrom, historicKey, historicTo, historicPoint } = params;
3890
3907
  if (!entityTypeId) {
3891
3908
  entityTypeId = "";
3892
3909
  }
@@ -3902,7 +3919,10 @@
3902
3919
  if (!historicPoint) {
3903
3920
  historicPoint = "";
3904
3921
  }
3905
- let key = `${exports.Api.ECacheKey.Entity}${exports.Api.ECacheKey.Id}${entityId}${String(entityTypeId)}`;
3922
+ if (!schemaId) {
3923
+ schemaId = "";
3924
+ }
3925
+ let key = `${exports.Api.ECacheKey.Entity}${exports.Api.ECacheKey.Id}${entityId}${String(entityTypeId)}${schemaId}`;
3906
3926
  key += `${String(Boolean(expandLocation))}${String(Boolean(expandRelations))}`;
3907
3927
  key += `${exports.Api.ECacheKey.EntityHistoricData}${exports.Api.ECacheKey.Id}${historicKey}-${historicFrom}-${historicTo}-${historicPoint}`;
3908
3928
  return key;
@@ -11251,7 +11271,7 @@
11251
11271
  })(exports.DataSource || (exports.DataSource = {}));
11252
11272
 
11253
11273
  // This is updated with the package.json version on build.
11254
- const VERSION = "3.9.5";
11274
+ const VERSION = "3.9.7";
11255
11275
 
11256
11276
  exports.VERSION = VERSION;
11257
11277
  exports.AbstractApi = AbstractApi;