bruce-models 4.7.1 → 4.7.3

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.
@@ -2867,6 +2867,48 @@ var EntityHistoricData;
2867
2867
  if (typeof attrKey != "string") {
2868
2868
  attrKey = PathUtils.Wrap(attrKey);
2869
2869
  }
2870
+ // If we have more than 100 Entity IDs we'll have to split the request to avoid a URL that is too long.
2871
+ const MAX_IDS = 100;
2872
+ // We will recursively call this function to get all the data.
2873
+ // Then merge at the end and return.
2874
+ if (entityIds.length > MAX_IDS) {
2875
+ const reqs = [];
2876
+ // Making the ID batches.
2877
+ // If this is too long we can end up in a loop.
2878
+ const splitEntityIds = [];
2879
+ for (let i = 0; i < entityIds.length; i += MAX_IDS) {
2880
+ const batchIds = entityIds.slice(i, i + MAX_IDS);
2881
+ // Detecting this early to avoid infinite loops.
2882
+ if (batchIds.length > MAX_IDS) {
2883
+ throw new Error("Nextspace Developer Error: EntityHistoricData.GetList() has too many Entity IDs. Please contact support.");
2884
+ }
2885
+ splitEntityIds.push(batchIds);
2886
+ }
2887
+ for (const splitEntityId of splitEntityIds) {
2888
+ reqs.push(GetList({
2889
+ entityIds: splitEntityId,
2890
+ attrKey: attrKey,
2891
+ dateTimeFrom: dateTimeFrom,
2892
+ dateTimeTo: dateTimeTo,
2893
+ api: api,
2894
+ req: req
2895
+ }));
2896
+ }
2897
+ const res = yield Promise.all(reqs);
2898
+ const recordsByIds = {};
2899
+ let limitPerEntity = 0;
2900
+ for (const r of res) {
2901
+ limitPerEntity = r.limitPerEntity;
2902
+ for (const entityId in r.recordsByIds) {
2903
+ recordsByIds[entityId] = r.recordsByIds[entityId];
2904
+ }
2905
+ }
2906
+ // Returning merged data.
2907
+ return {
2908
+ recordsByIds: recordsByIds,
2909
+ limitPerEntity: limitPerEntity
2910
+ };
2911
+ }
2870
2912
  const cacheKey = GetListCacheKey(entityIds, attrKey, dateTimeFrom, dateTimeTo);
2871
2913
  const cached = api.GetCacheItem(cacheKey, req);
2872
2914
  if (cached === null || cached === void 0 ? void 0 : cached.found) {
@@ -14063,7 +14105,7 @@ var DataSource;
14063
14105
  })(DataSource || (DataSource = {}));
14064
14106
 
14065
14107
  // This is updated with the package.json version on build.
14066
- const VERSION = "4.7.1";
14108
+ const VERSION = "4.7.3";
14067
14109
 
14068
14110
  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, ImportCad, ImportCsv, ImportJson, ImportKml, ImportedFile, Markup, Uploader, Plugin, ENVIRONMENT, DataSource };
14069
14111
  //# sourceMappingURL=bruce-models.es5.js.map