bruce-models 4.7.2 → 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.
- package/dist/bruce-models.es5.js +43 -1
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +43 -1
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/entity/entity-historic-data.js +42 -0
- package/dist/lib/entity/entity-historic-data.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -2830,6 +2830,48 @@
|
|
|
2830
2830
|
if (typeof attrKey != "string") {
|
|
2831
2831
|
attrKey = exports.PathUtils.Wrap(attrKey);
|
|
2832
2832
|
}
|
|
2833
|
+
// If we have more than 100 Entity IDs we'll have to split the request to avoid a URL that is too long.
|
|
2834
|
+
const MAX_IDS = 100;
|
|
2835
|
+
// We will recursively call this function to get all the data.
|
|
2836
|
+
// Then merge at the end and return.
|
|
2837
|
+
if (entityIds.length > MAX_IDS) {
|
|
2838
|
+
const reqs = [];
|
|
2839
|
+
// Making the ID batches.
|
|
2840
|
+
// If this is too long we can end up in a loop.
|
|
2841
|
+
const splitEntityIds = [];
|
|
2842
|
+
for (let i = 0; i < entityIds.length; i += MAX_IDS) {
|
|
2843
|
+
const batchIds = entityIds.slice(i, i + MAX_IDS);
|
|
2844
|
+
// Detecting this early to avoid infinite loops.
|
|
2845
|
+
if (batchIds.length > MAX_IDS) {
|
|
2846
|
+
throw new Error("Nextspace Developer Error: EntityHistoricData.GetList() has too many Entity IDs. Please contact support.");
|
|
2847
|
+
}
|
|
2848
|
+
splitEntityIds.push(batchIds);
|
|
2849
|
+
}
|
|
2850
|
+
for (const splitEntityId of splitEntityIds) {
|
|
2851
|
+
reqs.push(GetList({
|
|
2852
|
+
entityIds: splitEntityId,
|
|
2853
|
+
attrKey: attrKey,
|
|
2854
|
+
dateTimeFrom: dateTimeFrom,
|
|
2855
|
+
dateTimeTo: dateTimeTo,
|
|
2856
|
+
api: api,
|
|
2857
|
+
req: req
|
|
2858
|
+
}));
|
|
2859
|
+
}
|
|
2860
|
+
const res = yield Promise.all(reqs);
|
|
2861
|
+
const recordsByIds = {};
|
|
2862
|
+
let limitPerEntity = 0;
|
|
2863
|
+
for (const r of res) {
|
|
2864
|
+
limitPerEntity = r.limitPerEntity;
|
|
2865
|
+
for (const entityId in r.recordsByIds) {
|
|
2866
|
+
recordsByIds[entityId] = r.recordsByIds[entityId];
|
|
2867
|
+
}
|
|
2868
|
+
}
|
|
2869
|
+
// Returning merged data.
|
|
2870
|
+
return {
|
|
2871
|
+
recordsByIds: recordsByIds,
|
|
2872
|
+
limitPerEntity: limitPerEntity
|
|
2873
|
+
};
|
|
2874
|
+
}
|
|
2833
2875
|
const cacheKey = GetListCacheKey(entityIds, attrKey, dateTimeFrom, dateTimeTo);
|
|
2834
2876
|
const cached = api.GetCacheItem(cacheKey, req);
|
|
2835
2877
|
if (cached === null || cached === void 0 ? void 0 : cached.found) {
|
|
@@ -13788,7 +13830,7 @@
|
|
|
13788
13830
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
13789
13831
|
|
|
13790
13832
|
// This is updated with the package.json version on build.
|
|
13791
|
-
const VERSION = "4.7.
|
|
13833
|
+
const VERSION = "4.7.3";
|
|
13792
13834
|
|
|
13793
13835
|
exports.VERSION = VERSION;
|
|
13794
13836
|
exports.AbstractApi = AbstractApi;
|