bruce-models 3.9.1 → 3.9.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 +220 -128
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +219 -127
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/api.js +2 -0
- package/dist/lib/api/api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/common/cache.js +7 -0
- package/dist/lib/common/cache.js.map +1 -1
- package/dist/lib/entity/entity-historic-data.js +70 -3
- package/dist/lib/entity/entity-historic-data.js.map +1 -1
- package/dist/lib/entity/entity.js +19 -2
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/types/api/api.d.ts +3 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/common/cache.d.ts +5 -0
- package/dist/types/entity/entity-historic-data.d.ts +3 -0
- package/dist/types/entity/entity.d.ts +1 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -78,6 +78,8 @@
|
|
|
78
78
|
ECacheKey["Plugin"] = "plugin";
|
|
79
79
|
ECacheKey["PluginIndexFile"] = "pluginindexfile";
|
|
80
80
|
ECacheKey["EntityHistoricData"] = "entityhistoricdata";
|
|
81
|
+
ECacheKey["EntityHistoricDataRec"] = "entityhistoricdatarec";
|
|
82
|
+
ECacheKey["EntityHistoricDataStats"] = "entityhistoricdatastats";
|
|
81
83
|
})(ECacheKey = Api.ECacheKey || (Api.ECacheKey = {}));
|
|
82
84
|
// 1 minute.
|
|
83
85
|
Api.DEFAULT_CACHE_DURATION = 60 * 1000;
|
|
@@ -244,6 +246,13 @@
|
|
|
244
246
|
RemoveByContains(text) {
|
|
245
247
|
this.RemoveBy(key => String(key).includes(String(text)));
|
|
246
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* Removes items based on a callback's response.
|
|
251
|
+
* @param callback
|
|
252
|
+
*/
|
|
253
|
+
RemoveByCallback(callback) {
|
|
254
|
+
this.RemoveBy(callback);
|
|
255
|
+
}
|
|
247
256
|
}
|
|
248
257
|
|
|
249
258
|
// TODO: Currently checks for CSV vs json specifically,
|
|
@@ -2994,6 +3003,197 @@
|
|
|
2994
3003
|
})(EDisplayType = ZoomControl.EDisplayType || (ZoomControl.EDisplayType = {}));
|
|
2995
3004
|
})(exports.ZoomControl || (exports.ZoomControl = {}));
|
|
2996
3005
|
|
|
3006
|
+
(function (EntityHistoricData) {
|
|
3007
|
+
/**
|
|
3008
|
+
* Returns historic data for an array of Entity IDs.
|
|
3009
|
+
* A maximum number of records will be returned per Entity ID, this information is returned in the response.
|
|
3010
|
+
* @param params
|
|
3011
|
+
* @returns
|
|
3012
|
+
*/
|
|
3013
|
+
function GetList(params) {
|
|
3014
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3015
|
+
let { entityIds, attrKey, dateTimeFrom, dateTimeTo, api, req } = params;
|
|
3016
|
+
// Save time and just return a none response if no entity IDs are provided.
|
|
3017
|
+
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
3018
|
+
return {
|
|
3019
|
+
limitPerEntity: 0,
|
|
3020
|
+
recordsByIds: {}
|
|
3021
|
+
};
|
|
3022
|
+
}
|
|
3023
|
+
if (!api) {
|
|
3024
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
3025
|
+
}
|
|
3026
|
+
if (typeof attrKey != "string") {
|
|
3027
|
+
attrKey = exports.PathUtils.Wrap(attrKey);
|
|
3028
|
+
}
|
|
3029
|
+
const cacheKey = GetListCacheKey(entityIds, attrKey, dateTimeFrom, dateTimeTo);
|
|
3030
|
+
const cached = api.GetCacheItem(cacheKey, req);
|
|
3031
|
+
if (cached === null || cached === void 0 ? void 0 : cached.found) {
|
|
3032
|
+
return cached.data;
|
|
3033
|
+
}
|
|
3034
|
+
const urlParams = new URLSearchParams();
|
|
3035
|
+
for (const entityId of entityIds) {
|
|
3036
|
+
urlParams.append("entityId", entityId);
|
|
3037
|
+
}
|
|
3038
|
+
urlParams.append("attrKey", attrKey);
|
|
3039
|
+
urlParams.append("dateTimeFrom", dateTimeFrom);
|
|
3040
|
+
urlParams.append("dateTimeTo", dateTimeTo);
|
|
3041
|
+
const prom = api.GET(`v1/entity/historicData?${urlParams.toString()}`, exports.Api.PrepReqParams(req));
|
|
3042
|
+
api.SetCacheItem({
|
|
3043
|
+
key: cacheKey,
|
|
3044
|
+
value: prom,
|
|
3045
|
+
req: req,
|
|
3046
|
+
// Short cache. 30 seconds.
|
|
3047
|
+
duration: 30000
|
|
3048
|
+
});
|
|
3049
|
+
return prom;
|
|
3050
|
+
});
|
|
3051
|
+
}
|
|
3052
|
+
EntityHistoricData.GetList = GetList;
|
|
3053
|
+
/**
|
|
3054
|
+
* Returns historic data statistics for an array of Entity IDs.
|
|
3055
|
+
* @param params
|
|
3056
|
+
* @returns
|
|
3057
|
+
*/
|
|
3058
|
+
function GetStats(params) {
|
|
3059
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3060
|
+
let { entityIds, api, req } = params;
|
|
3061
|
+
// Save time and just return a none response if no entity IDs are provided.
|
|
3062
|
+
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
3063
|
+
return {
|
|
3064
|
+
stats: []
|
|
3065
|
+
};
|
|
3066
|
+
}
|
|
3067
|
+
if (!api) {
|
|
3068
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
3069
|
+
}
|
|
3070
|
+
req = exports.Api.PrepReqParams(req);
|
|
3071
|
+
const cacheKey = GetStatsCacheKey(entityIds);
|
|
3072
|
+
const cached = api.GetCacheItem(cacheKey, req);
|
|
3073
|
+
if (cached === null || cached === void 0 ? void 0 : cached.found) {
|
|
3074
|
+
return cached.data;
|
|
3075
|
+
}
|
|
3076
|
+
const prom = yield api.POST("v1/entity/historicData/stats", {
|
|
3077
|
+
entityIds: entityIds
|
|
3078
|
+
}, req);
|
|
3079
|
+
api.SetCacheItem({
|
|
3080
|
+
key: cacheKey,
|
|
3081
|
+
value: prom,
|
|
3082
|
+
req: req,
|
|
3083
|
+
// Short cache. 60 seconds.
|
|
3084
|
+
duration: 60000
|
|
3085
|
+
});
|
|
3086
|
+
return prom;
|
|
3087
|
+
});
|
|
3088
|
+
}
|
|
3089
|
+
EntityHistoricData.GetStats = GetStats;
|
|
3090
|
+
/**
|
|
3091
|
+
* Creates or updates historic data records.
|
|
3092
|
+
* Please note that the expected input/output does not include internal fields found inside the "Bruce" attribute.
|
|
3093
|
+
* @param params
|
|
3094
|
+
* @returns
|
|
3095
|
+
*/
|
|
3096
|
+
function Update(params) {
|
|
3097
|
+
var _a;
|
|
3098
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3099
|
+
let { records, api, req } = params;
|
|
3100
|
+
// Save time and just return a none response if no records are provided.
|
|
3101
|
+
if (!(records === null || records === void 0 ? void 0 : records.length)) {
|
|
3102
|
+
return {
|
|
3103
|
+
records: []
|
|
3104
|
+
};
|
|
3105
|
+
}
|
|
3106
|
+
if (!api) {
|
|
3107
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
3108
|
+
}
|
|
3109
|
+
const res = yield api.POST("v1/entity/historicData", {
|
|
3110
|
+
records: records
|
|
3111
|
+
}, exports.Api.PrepReqParams(req));
|
|
3112
|
+
// Kill cache for every unique attrKey.
|
|
3113
|
+
let attrKeys = records.map(r => r.attrKey);
|
|
3114
|
+
attrKeys = attrKeys.filter((v, i) => attrKeys.indexOf(v) === i);
|
|
3115
|
+
for (const attrKey of attrKeys) {
|
|
3116
|
+
api.Cache.RemoveByContains(exports.Entity.GetHistoricContainsKey(attrKey));
|
|
3117
|
+
}
|
|
3118
|
+
// Kill any stats cache that includes any of the Entity IDs.
|
|
3119
|
+
if ((_a = res.records) === null || _a === void 0 ? void 0 : _a.length) {
|
|
3120
|
+
const entityIds = res.records.map(r => r.entityId).filter((v, i) => v && res.records.indexOf(v) === i);
|
|
3121
|
+
ClearCacheByEntityIds(api, entityIds);
|
|
3122
|
+
}
|
|
3123
|
+
return res;
|
|
3124
|
+
});
|
|
3125
|
+
}
|
|
3126
|
+
EntityHistoricData.Update = Update;
|
|
3127
|
+
/**
|
|
3128
|
+
* Deletes historic data records for an array of Entity IDs.
|
|
3129
|
+
* This deletes all records within a provided key + range.
|
|
3130
|
+
* @param params
|
|
3131
|
+
* @returns
|
|
3132
|
+
*/
|
|
3133
|
+
function Delete(params) {
|
|
3134
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3135
|
+
let { entityIds, attrKey, dateTimeFrom, dateTimeTo, api, req } = params;
|
|
3136
|
+
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
3137
|
+
return;
|
|
3138
|
+
}
|
|
3139
|
+
if (!api) {
|
|
3140
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
3141
|
+
}
|
|
3142
|
+
if (!attrKey || !dateTimeFrom || !dateTimeTo) {
|
|
3143
|
+
throw new Error("Invalid parameters provided.");
|
|
3144
|
+
}
|
|
3145
|
+
if (typeof attrKey != "string") {
|
|
3146
|
+
attrKey = exports.PathUtils.Wrap(attrKey);
|
|
3147
|
+
}
|
|
3148
|
+
const urlParams = new URLSearchParams();
|
|
3149
|
+
for (const entityId of entityIds) {
|
|
3150
|
+
urlParams.append("entityId", entityId);
|
|
3151
|
+
}
|
|
3152
|
+
urlParams.append("attrKey", attrKey);
|
|
3153
|
+
urlParams.append("dateTimeFrom", dateTimeFrom);
|
|
3154
|
+
urlParams.append("dateTimeTo", dateTimeTo);
|
|
3155
|
+
yield api.DELETE(`v1/entity/historicData?${urlParams.toString()}`, exports.Api.PrepReqParams(req));
|
|
3156
|
+
// Kill cache for all Entity cached Entity records related to the attrKey.
|
|
3157
|
+
api.Cache.RemoveByContains(exports.Entity.GetHistoricContainsKey(attrKey));
|
|
3158
|
+
// Kill any stats cache that includes any of the Entity IDs.
|
|
3159
|
+
ClearCacheByEntityIds(api, entityIds);
|
|
3160
|
+
});
|
|
3161
|
+
}
|
|
3162
|
+
EntityHistoricData.Delete = Delete;
|
|
3163
|
+
function GetListCacheKey(entityIds, attrKey, dateTimeFrom, dateTimeTo) {
|
|
3164
|
+
return exports.Api.ECacheKey.EntityHistoricDataRec + exports.Api.ECacheKey.Id + entityIds.join(",") + exports.Api.ECacheKey.Id + attrKey + exports.Api.ECacheKey.Id + dateTimeFrom + exports.Api.ECacheKey.Id + dateTimeTo;
|
|
3165
|
+
}
|
|
3166
|
+
EntityHistoricData.GetListCacheKey = GetListCacheKey;
|
|
3167
|
+
function GetStatsCacheKey(entityIds) {
|
|
3168
|
+
return exports.Api.ECacheKey.EntityHistoricDataStats + exports.Api.ECacheKey.Id + entityIds.join(",");
|
|
3169
|
+
}
|
|
3170
|
+
EntityHistoricData.GetStatsCacheKey = GetStatsCacheKey;
|
|
3171
|
+
function ClearCacheByEntityIds(api, entityIds) {
|
|
3172
|
+
if (!api || !(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
3173
|
+
return;
|
|
3174
|
+
}
|
|
3175
|
+
const REC_KEY_PREFIX = exports.Api.ECacheKey.EntityHistoricDataRec + exports.Api.ECacheKey.Id;
|
|
3176
|
+
const STATS_KEY_PREFIX = exports.Api.ECacheKey.EntityHistoricDataStats + exports.Api.ECacheKey.Id;
|
|
3177
|
+
api.Cache.RemoveByCallback((key) => {
|
|
3178
|
+
let keyStr = String(key);
|
|
3179
|
+
if (!keyStr.startsWith(STATS_KEY_PREFIX) && !keyStr.startsWith(REC_KEY_PREFIX)) {
|
|
3180
|
+
return false;
|
|
3181
|
+
}
|
|
3182
|
+
// Shorten to speed up the next step.
|
|
3183
|
+
keyStr = keyStr.replace(STATS_KEY_PREFIX, "").replace(REC_KEY_PREFIX, "");
|
|
3184
|
+
// Look for any matching Entity IDs.
|
|
3185
|
+
for (let i = 0; i < entityIds.length; i++) {
|
|
3186
|
+
const entityId = entityIds[i];
|
|
3187
|
+
if (keyStr.includes(entityId)) {
|
|
3188
|
+
return true;
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
3191
|
+
return false;
|
|
3192
|
+
});
|
|
3193
|
+
}
|
|
3194
|
+
EntityHistoricData.ClearCacheByEntityIds = ClearCacheByEntityIds;
|
|
3195
|
+
})(exports.EntityHistoricData || (exports.EntityHistoricData = {}));
|
|
3196
|
+
|
|
2997
3197
|
(function (Entity) {
|
|
2998
3198
|
/**
|
|
2999
3199
|
* Returns an entity record for the given entity id.
|
|
@@ -3072,7 +3272,7 @@
|
|
|
3072
3272
|
*/
|
|
3073
3273
|
function GetListByIds(params) {
|
|
3074
3274
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3075
|
-
let { api, entityIds, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo } = params;
|
|
3275
|
+
let { api, entityIds, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
3076
3276
|
if (!entityIds.length) {
|
|
3077
3277
|
throw ("Entity IDs are required.");
|
|
3078
3278
|
}
|
|
@@ -3106,6 +3306,18 @@
|
|
|
3106
3306
|
else if (expandLocation) {
|
|
3107
3307
|
reqData["Expand"] = "location";
|
|
3108
3308
|
}
|
|
3309
|
+
if (historicKey) {
|
|
3310
|
+
reqData["historicKey"] = historicKey;
|
|
3311
|
+
}
|
|
3312
|
+
if (historicFrom) {
|
|
3313
|
+
reqData["historicFrom"] = historicFrom;
|
|
3314
|
+
}
|
|
3315
|
+
if (historicTo) {
|
|
3316
|
+
reqData["historicTo"] = historicTo;
|
|
3317
|
+
}
|
|
3318
|
+
if (historicPoint) {
|
|
3319
|
+
reqData["historicPoint"] = historicPoint;
|
|
3320
|
+
}
|
|
3109
3321
|
const reqs = [];
|
|
3110
3322
|
if (reqIds.length > 0) {
|
|
3111
3323
|
const req = api.POST("entities", reqData, exports.Api.PrepReqParams(reqParams));
|
|
@@ -3118,7 +3330,8 @@
|
|
|
3118
3330
|
entityTypeId: null,
|
|
3119
3331
|
historicFrom: historicFrom,
|
|
3120
3332
|
historicKey: historicKey,
|
|
3121
|
-
historicTo: historicTo
|
|
3333
|
+
historicTo: historicTo,
|
|
3334
|
+
historicPoint: historicPoint
|
|
3122
3335
|
});
|
|
3123
3336
|
const prom = new Promise((res) => __awaiter(this, void 0, void 0, function* () {
|
|
3124
3337
|
try {
|
|
@@ -3176,6 +3389,7 @@
|
|
|
3176
3389
|
}
|
|
3177
3390
|
yield api.DELETE(`entity/${entityId}`, exports.Api.PrepReqParams(reqParams));
|
|
3178
3391
|
api.Cache.RemoveByContains(GetContainsKey(entityId));
|
|
3392
|
+
exports.EntityHistoricData.ClearCacheByEntityIds(api, [entityId]);
|
|
3179
3393
|
});
|
|
3180
3394
|
}
|
|
3181
3395
|
Entity.Delete = Delete;
|
|
@@ -3199,6 +3413,7 @@
|
|
|
3199
3413
|
const entityId = entityIds[i];
|
|
3200
3414
|
api.Cache.RemoveByContains(GetContainsKey(entityId));
|
|
3201
3415
|
}
|
|
3416
|
+
exports.EntityHistoricData.ClearCacheByEntityIds(api, entityIds);
|
|
3202
3417
|
});
|
|
3203
3418
|
}
|
|
3204
3419
|
Entity.DeleteList = DeleteList;
|
|
@@ -3223,6 +3438,7 @@
|
|
|
3223
3438
|
const reqUrl = `entity/${data.Bruce.ID}/?dataoverride=${override}&BruceEntityType=${data.Bruce["EntityType.ID"]}`;
|
|
3224
3439
|
const res = yield api.POST(reqUrl, data, exports.Api.PrepReqParams(reqParams));
|
|
3225
3440
|
api.Cache.RemoveByContains(GetContainsKey(data.Bruce.ID));
|
|
3441
|
+
exports.EntityHistoricData.ClearCacheByEntityIds(api, [data.Bruce.ID]);
|
|
3226
3442
|
return {
|
|
3227
3443
|
entity: res
|
|
3228
3444
|
};
|
|
@@ -6664,130 +6880,6 @@
|
|
|
6664
6880
|
EntityAttribute.AddAttribute = AddAttribute;
|
|
6665
6881
|
})(exports.EntityAttribute || (exports.EntityAttribute = {}));
|
|
6666
6882
|
|
|
6667
|
-
(function (EntityHistoricData) {
|
|
6668
|
-
/**
|
|
6669
|
-
* Returns historic data for an array of Entity IDs.
|
|
6670
|
-
* A maximum number of records will be returned per Entity ID, this information is returned in the response.
|
|
6671
|
-
* @param params
|
|
6672
|
-
* @returns
|
|
6673
|
-
*/
|
|
6674
|
-
function GetList(params) {
|
|
6675
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
6676
|
-
let { entityIds, attrKey, dateTimeFrom, dateTimeTo, api, req } = params;
|
|
6677
|
-
// Save time and just return a none response if no entity IDs are provided.
|
|
6678
|
-
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
6679
|
-
return {
|
|
6680
|
-
limitPerEntity: 0,
|
|
6681
|
-
recordsByIds: {}
|
|
6682
|
-
};
|
|
6683
|
-
}
|
|
6684
|
-
if (!api) {
|
|
6685
|
-
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
6686
|
-
}
|
|
6687
|
-
if (typeof attrKey != "string") {
|
|
6688
|
-
attrKey = exports.PathUtils.Wrap(attrKey);
|
|
6689
|
-
}
|
|
6690
|
-
const urlParams = new URLSearchParams();
|
|
6691
|
-
for (const entityId of entityIds) {
|
|
6692
|
-
urlParams.append("entityId", entityId);
|
|
6693
|
-
}
|
|
6694
|
-
urlParams.append("attrKey", attrKey);
|
|
6695
|
-
urlParams.append("dateTimeFrom", dateTimeFrom);
|
|
6696
|
-
urlParams.append("dateTimeTo", dateTimeTo);
|
|
6697
|
-
return yield api.GET(`v1/entity/historicData?${urlParams.toString()}`, exports.Api.PrepReqParams(req));
|
|
6698
|
-
});
|
|
6699
|
-
}
|
|
6700
|
-
EntityHistoricData.GetList = GetList;
|
|
6701
|
-
/**
|
|
6702
|
-
* Returns historic data statistics for an array of Entity IDs.
|
|
6703
|
-
* @param params
|
|
6704
|
-
* @returns
|
|
6705
|
-
*/
|
|
6706
|
-
function GetStats(params) {
|
|
6707
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
6708
|
-
let { entityIds, api, req } = params;
|
|
6709
|
-
// Save time and just return a none response if no entity IDs are provided.
|
|
6710
|
-
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
6711
|
-
return {
|
|
6712
|
-
stats: []
|
|
6713
|
-
};
|
|
6714
|
-
}
|
|
6715
|
-
if (!api) {
|
|
6716
|
-
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
6717
|
-
}
|
|
6718
|
-
return yield api.POST("v1/entity/historicData/stats", {
|
|
6719
|
-
entityIds: entityIds
|
|
6720
|
-
}, exports.Api.PrepReqParams(req));
|
|
6721
|
-
});
|
|
6722
|
-
}
|
|
6723
|
-
EntityHistoricData.GetStats = GetStats;
|
|
6724
|
-
/**
|
|
6725
|
-
* Creates or updates historic data records.
|
|
6726
|
-
* Please note that the expected input/output does not include internal fields found inside the "Bruce" attribute.
|
|
6727
|
-
* @param params
|
|
6728
|
-
* @returns
|
|
6729
|
-
*/
|
|
6730
|
-
function Update(params) {
|
|
6731
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
6732
|
-
let { records, api, req } = params;
|
|
6733
|
-
// Save time and just return a none response if no records are provided.
|
|
6734
|
-
if (!(records === null || records === void 0 ? void 0 : records.length)) {
|
|
6735
|
-
return {
|
|
6736
|
-
records: []
|
|
6737
|
-
};
|
|
6738
|
-
}
|
|
6739
|
-
if (!api) {
|
|
6740
|
-
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
6741
|
-
}
|
|
6742
|
-
const res = yield api.POST("v1/entity/historicData", {
|
|
6743
|
-
records: records
|
|
6744
|
-
}, exports.Api.PrepReqParams(req));
|
|
6745
|
-
// Kill cache for every unique attrKey.
|
|
6746
|
-
let attrKeys = records.map(r => r.attrKey);
|
|
6747
|
-
attrKeys = attrKeys.filter((v, i) => attrKeys.indexOf(v) === i);
|
|
6748
|
-
for (const attrKey of attrKeys) {
|
|
6749
|
-
api.Cache.RemoveByContains(exports.Entity.GetHistoricContainsKey(attrKey));
|
|
6750
|
-
}
|
|
6751
|
-
return res;
|
|
6752
|
-
});
|
|
6753
|
-
}
|
|
6754
|
-
EntityHistoricData.Update = Update;
|
|
6755
|
-
/**
|
|
6756
|
-
* Deletes historic data records for an array of Entity IDs.
|
|
6757
|
-
* This deletes all records within a provided key + range.
|
|
6758
|
-
* @param params
|
|
6759
|
-
* @returns
|
|
6760
|
-
*/
|
|
6761
|
-
function Delete(params) {
|
|
6762
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
6763
|
-
let { entityIds, attrKey, dateTimeFrom, dateTimeTo, api, req } = params;
|
|
6764
|
-
if (!(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
6765
|
-
return;
|
|
6766
|
-
}
|
|
6767
|
-
if (!api) {
|
|
6768
|
-
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
6769
|
-
}
|
|
6770
|
-
if (!attrKey || !dateTimeFrom || !dateTimeTo) {
|
|
6771
|
-
throw new Error("Invalid parameters provided.");
|
|
6772
|
-
}
|
|
6773
|
-
if (typeof attrKey != "string") {
|
|
6774
|
-
attrKey = exports.PathUtils.Wrap(attrKey);
|
|
6775
|
-
}
|
|
6776
|
-
const urlParams = new URLSearchParams();
|
|
6777
|
-
for (const entityId of entityIds) {
|
|
6778
|
-
urlParams.append("entityId", entityId);
|
|
6779
|
-
}
|
|
6780
|
-
urlParams.append("attrKey", attrKey);
|
|
6781
|
-
urlParams.append("dateTimeFrom", dateTimeFrom);
|
|
6782
|
-
urlParams.append("dateTimeTo", dateTimeTo);
|
|
6783
|
-
yield api.DELETE(`v1/entity/historicData?${urlParams.toString()}`, exports.Api.PrepReqParams(req));
|
|
6784
|
-
// Kill cache for all Entity cached Entity records related to the attrKey.
|
|
6785
|
-
api.Cache.RemoveByContains(exports.Entity.GetHistoricContainsKey(attrKey));
|
|
6786
|
-
});
|
|
6787
|
-
}
|
|
6788
|
-
EntityHistoricData.Delete = Delete;
|
|
6789
|
-
})(exports.EntityHistoricData || (exports.EntityHistoricData = {}));
|
|
6790
|
-
|
|
6791
6883
|
(function (Uploader) {
|
|
6792
6884
|
Uploader.MIN_LARGE_FILE_SIZE = 100000000; // 100MB.
|
|
6793
6885
|
/**
|
|
@@ -11158,7 +11250,7 @@
|
|
|
11158
11250
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
11159
11251
|
|
|
11160
11252
|
// This is updated with the package.json version on build.
|
|
11161
|
-
const VERSION = "3.9.
|
|
11253
|
+
const VERSION = "3.9.3";
|
|
11162
11254
|
|
|
11163
11255
|
exports.VERSION = VERSION;
|
|
11164
11256
|
exports.AbstractApi = AbstractApi;
|