bruce-models 5.2.7 → 5.2.9

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.
@@ -3311,7 +3311,7 @@ var Entity;
3311
3311
  */
3312
3312
  function GetListByIds(params) {
3313
3313
  return __awaiter(this, void 0, void 0, function* () {
3314
- let { api, entityIds, migrated, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint, expandSources, expandImports } = params;
3314
+ let { api, entityIds, migrated, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint, expandSources, expandImports, maxSearchTimeSec } = params;
3315
3315
  if (!entityIds.length) {
3316
3316
  throw ("Entity IDs are required.");
3317
3317
  }
@@ -3377,6 +3377,9 @@ var Entity;
3377
3377
  if (schemaId) {
3378
3378
  urlParams.set("schema", schemaId);
3379
3379
  }
3380
+ if (maxSearchTimeSec) {
3381
+ urlParams.set("MaxSearchTimeSec", String(Math.ceil(maxSearchTimeSec)));
3382
+ }
3380
3383
  urlParams.set("hasMigrated", String(Boolean(migrated)));
3381
3384
  const url = `entities?${urlParams.toString()}`;
3382
3385
  const reqs = [];
@@ -3487,28 +3490,63 @@ var Entity;
3487
3490
  * @returns
3488
3491
  */
3489
3492
  function Update(params) {
3490
- var _a, _b;
3491
- return __awaiter(this, void 0, void 0, function* () {
3492
- let { api, entity: data, override, req: reqParams, migrated } = params;
3493
- if (!((_a = data === null || data === void 0 ? void 0 : data.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"])) {
3494
- throw ("Entity Type ID is required.");
3495
- }
3496
- if (!api) {
3497
- api = ENVIRONMENT.Api().GetBruceApi();
3498
- }
3499
- if (!((_b = data === null || data === void 0 ? void 0 : data.Bruce) === null || _b === void 0 ? void 0 : _b.ID)) {
3500
- data.Bruce = Object.assign(Object.assign({}, data.Bruce), { ID: ObjectUtils.UId() });
3493
+ var _a, _b, _c, _d, _e;
3494
+ return __awaiter(this, void 0, void 0, function* () {
3495
+ let { api, entity: data, entities, override, req: reqParams, migrated } = params;
3496
+ // Bulk save.
3497
+ if ((entities === null || entities === void 0 ? void 0 : entities.length) && entities.length > 1) {
3498
+ // If the Entities don't have IDs, then they must have a Type ID.
3499
+ for (let i = 0; i < entities.length; i++) {
3500
+ const entity = entities[i];
3501
+ if (!((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID) && !((_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b["EntityType.ID"])) {
3502
+ throw ("Entity Type ID is required for new Entity records.");
3503
+ }
3504
+ }
3505
+ if (!api) {
3506
+ api = ENVIRONMENT.Api().GetBruceApi();
3507
+ }
3508
+ const reqUrl = `v3/entities`;
3509
+ const reqBody = {
3510
+ Items: entities,
3511
+ Override: override
3512
+ };
3513
+ const res = yield api.POST(reqUrl, reqBody, Api.PrepReqParams(reqParams));
3514
+ entities = res.Items;
3515
+ for (let i = 0; i < entities.length; i++) {
3516
+ const entity = entities[i];
3517
+ const entityId = (_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.ID; // Should never be null.
3518
+ api.Cache.RemoveByContains(GetContainsKey(entityId));
3519
+ EntityHistoricData.ClearCacheByEntityIds(api, [entityId]);
3520
+ }
3521
+ return {
3522
+ entities
3523
+ };
3501
3524
  }
3502
- let reqUrl = `entity/${data.Bruce.ID}/?dataoverride=${override}&BruceEntityType=${data.Bruce["EntityType.ID"]}`;
3503
- if (migrated) {
3504
- reqUrl += "&hasMigrated=true";
3525
+ // Single save.
3526
+ else {
3527
+ if (!data && (entities === null || entities === void 0 ? void 0 : entities.length)) {
3528
+ data = entities[0];
3529
+ }
3530
+ if (!((_d = data === null || data === void 0 ? void 0 : data.Bruce) === null || _d === void 0 ? void 0 : _d["EntityType.ID"])) {
3531
+ throw ("Entity Type ID is required.");
3532
+ }
3533
+ if (!api) {
3534
+ api = ENVIRONMENT.Api().GetBruceApi();
3535
+ }
3536
+ if (!((_e = data === null || data === void 0 ? void 0 : data.Bruce) === null || _e === void 0 ? void 0 : _e.ID)) {
3537
+ data.Bruce = Object.assign(Object.assign({}, data.Bruce), { ID: ObjectUtils.UId() });
3538
+ }
3539
+ let reqUrl = `entity/${data.Bruce.ID}/?dataoverride=${override}&BruceEntityType=${data.Bruce["EntityType.ID"]}`;
3540
+ if (migrated) {
3541
+ reqUrl += "&hasMigrated=true";
3542
+ }
3543
+ const res = yield api.POST(reqUrl, data, Api.PrepReqParams(reqParams));
3544
+ api.Cache.RemoveByContains(GetContainsKey(data.Bruce.ID));
3545
+ EntityHistoricData.ClearCacheByEntityIds(api, [data.Bruce.ID]);
3546
+ return {
3547
+ entity: res
3548
+ };
3505
3549
  }
3506
- const res = yield api.POST(reqUrl, data, Api.PrepReqParams(reqParams));
3507
- api.Cache.RemoveByContains(GetContainsKey(data.Bruce.ID));
3508
- EntityHistoricData.ClearCacheByEntityIds(api, [data.Bruce.ID]);
3509
- return {
3510
- entity: res
3511
- };
3512
3550
  });
3513
3551
  }
3514
3552
  Entity.Update = Update;
@@ -3784,7 +3822,7 @@ var Entity;
3784
3822
  function GetList(params) {
3785
3823
  var _a;
3786
3824
  return __awaiter(this, void 0, void 0, function* () {
3787
- let { api, filter, migrated, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, expandImports, historicFrom, historicKey, historicTo, historicPoint, expandLocation, expandSources } = params;
3825
+ let { api, filter, migrated, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, expandImports, historicFrom, historicKey, historicTo, historicPoint, expandLocation, expandSources, maxSearchTimeSec } = params;
3788
3826
  if (!api) {
3789
3827
  api = ENVIRONMENT.Api().GetBruceApi();
3790
3828
  }
@@ -3902,6 +3940,9 @@ var Entity;
3902
3940
  if (schemaId) {
3903
3941
  urlParams.set("schema", schemaId);
3904
3942
  }
3943
+ if (maxSearchTimeSec) {
3944
+ urlParams.set("MaxSearchTimeSec", String(Math.ceil(maxSearchTimeSec)));
3945
+ }
3905
3946
  urlParams.set("hasMigrated", String(Boolean(migrated)));
3906
3947
  let url = analysis ? "entities/summary" : "entities";
3907
3948
  // Adding url params here because this will avoid making them encoded.
@@ -3932,6 +3973,9 @@ var Entity;
3932
3973
  if (schemaId) {
3933
3974
  urlParams.set("schema", schemaId);
3934
3975
  }
3976
+ if (maxSearchTimeSec) {
3977
+ urlParams.set("MaxSearchTimeSec", String(Math.ceil(maxSearchTimeSec)));
3978
+ }
3935
3979
  urlParams.set("hasMigrated", String(Boolean(migrated)));
3936
3980
  let url = analysis ? "entities/summary" : "entities";
3937
3981
  // Adding url params here because this will avoid making them encoded.
@@ -14605,7 +14649,7 @@ var DataSource;
14605
14649
  })(DataSource || (DataSource = {}));
14606
14650
 
14607
14651
  // This is updated with the package.json version on build.
14608
- const VERSION = "5.2.7";
14652
+ const VERSION = "5.2.9";
14609
14653
 
14610
14654
  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, EntityTypeVisualSettings, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, Account, AccountInvite, AccountFeatures, AccountLimits, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
14611
14655
  //# sourceMappingURL=bruce-models.es5.js.map