bruce-models 5.5.4 → 5.5.6
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 +129 -10
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +122 -9
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +2 -1
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/entity/entity.js +25 -8
- package/dist/lib/entity/entity.js.map +1 -1
- package/dist/lib/project/menu-item.js.map +1 -1
- package/dist/lib/scenario/scenario.js +116 -0
- package/dist/lib/scenario/scenario.js.map +1 -0
- package/dist/types/bruce-models.d.ts +2 -1
- package/dist/types/entity/entity.d.ts +5 -0
- package/dist/types/project/menu-item.d.ts +1 -0
- package/dist/types/scenario/scenario.d.ts +61 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -3129,7 +3129,7 @@
|
|
|
3129
3129
|
*/
|
|
3130
3130
|
function Get(params) {
|
|
3131
3131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3132
|
-
let { api, entityId, migrated, schemaId, req: reqParams, expandLocation, expandRelations, entityTypeId, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
3132
|
+
let { api, entityId, scenario, migrated, schemaId, req: reqParams, expandLocation, expandRelations, entityTypeId, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
3133
3133
|
if (!entityId) {
|
|
3134
3134
|
throw ("Entity ID is required.");
|
|
3135
3135
|
}
|
|
@@ -3145,7 +3145,8 @@
|
|
|
3145
3145
|
historicKey,
|
|
3146
3146
|
historicTo,
|
|
3147
3147
|
historicPoint,
|
|
3148
|
-
schemaId
|
|
3148
|
+
schemaId,
|
|
3149
|
+
scenario
|
|
3149
3150
|
});
|
|
3150
3151
|
const cache = api.GetCacheItem(key, reqParams);
|
|
3151
3152
|
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
@@ -3185,6 +3186,9 @@
|
|
|
3185
3186
|
if (schemaId) {
|
|
3186
3187
|
urlParams.set("schema", schemaId);
|
|
3187
3188
|
}
|
|
3189
|
+
if (scenario && scenario > 0) {
|
|
3190
|
+
urlParams.set("Scenario", String(scenario));
|
|
3191
|
+
}
|
|
3188
3192
|
urlParams.set("hasMigrated", String(Boolean(migrated)));
|
|
3189
3193
|
const data = yield api.GET(`entity/${entityId}?${urlParams.toString()}`, exports.Api.PrepReqParams(reqParams));
|
|
3190
3194
|
res({
|
|
@@ -3211,7 +3215,7 @@
|
|
|
3211
3215
|
*/
|
|
3212
3216
|
function GetListByIds(params) {
|
|
3213
3217
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3214
|
-
let { api, entityIds, migrated, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint, expandSources, expandImports, maxSearchTimeSec } = params;
|
|
3218
|
+
let { api, entityIds, scenario, migrated, schemaId, req: reqParams, expandRelations, expandLocation, historicFrom, historicKey, historicTo, historicPoint, expandSources, expandImports, maxSearchTimeSec } = params;
|
|
3215
3219
|
if (!entityIds.length) {
|
|
3216
3220
|
throw ("Entity IDs are required.");
|
|
3217
3221
|
}
|
|
@@ -3228,7 +3232,8 @@
|
|
|
3228
3232
|
historicKey: historicKey,
|
|
3229
3233
|
historicTo: historicTo,
|
|
3230
3234
|
historicPoint: historicPoint,
|
|
3231
|
-
schemaId: schemaId
|
|
3235
|
+
schemaId: schemaId,
|
|
3236
|
+
scenario: scenario
|
|
3232
3237
|
};
|
|
3233
3238
|
const crashRiskReqs = [];
|
|
3234
3239
|
const reqIds = [];
|
|
@@ -3285,6 +3290,9 @@
|
|
|
3285
3290
|
if (historicPoint) {
|
|
3286
3291
|
reqData["historicPoint"] = historicPoint;
|
|
3287
3292
|
}
|
|
3293
|
+
if (scenario) {
|
|
3294
|
+
reqData["Scenario"] = scenario;
|
|
3295
|
+
}
|
|
3288
3296
|
const urlParams = new URLSearchParams();
|
|
3289
3297
|
if (schemaId) {
|
|
3290
3298
|
urlParams.set("schema", schemaId);
|
|
@@ -3722,7 +3730,7 @@
|
|
|
3722
3730
|
function GetList(params) {
|
|
3723
3731
|
var _a;
|
|
3724
3732
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3725
|
-
let { api, filter, migrated, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, expandImports, historicFrom, historicKey, historicTo, historicPoint, expandLocation, expandSources, maxSearchTimeSec } = params;
|
|
3733
|
+
let { api, filter, scenario, migrated, schemaId, req: reqParams, viaCdn, viaCdnCacheToken, analysis, expandRelations, expandImports, historicFrom, historicKey, historicTo, historicPoint, expandLocation, expandSources, maxSearchTimeSec } = params;
|
|
3726
3734
|
if (!api) {
|
|
3727
3735
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
3728
3736
|
}
|
|
@@ -3763,7 +3771,8 @@
|
|
|
3763
3771
|
historicFrom: historicFrom,
|
|
3764
3772
|
historicTo: historicTo,
|
|
3765
3773
|
historicPoint: historicPoint,
|
|
3766
|
-
ExpandSources: expandSources
|
|
3774
|
+
ExpandSources: expandSources,
|
|
3775
|
+
Scenario: scenario
|
|
3767
3776
|
};
|
|
3768
3777
|
if (expandLocation || expandRelations || expandImports) {
|
|
3769
3778
|
let expand = "";
|
|
@@ -3840,6 +3849,9 @@
|
|
|
3840
3849
|
if (schemaId) {
|
|
3841
3850
|
urlParams.set("schema", schemaId);
|
|
3842
3851
|
}
|
|
3852
|
+
if (scenario && scenario > 0) {
|
|
3853
|
+
urlParams.set("Scenario", String(scenario));
|
|
3854
|
+
}
|
|
3843
3855
|
if (maxSearchTimeSec) {
|
|
3844
3856
|
urlParams.set("MaxSearchTimeSec", String(Math.ceil(maxSearchTimeSec)));
|
|
3845
3857
|
}
|
|
@@ -3903,7 +3915,8 @@
|
|
|
3903
3915
|
historicFrom: historicFrom,
|
|
3904
3916
|
historicKey: historicKey,
|
|
3905
3917
|
historicTo: historicTo,
|
|
3906
|
-
schemaId: schemaId
|
|
3918
|
+
schemaId: schemaId,
|
|
3919
|
+
scenario: scenario
|
|
3907
3920
|
}),
|
|
3908
3921
|
value: {
|
|
3909
3922
|
entity: entity
|
|
@@ -3962,7 +3975,10 @@
|
|
|
3962
3975
|
* @returns
|
|
3963
3976
|
*/
|
|
3964
3977
|
function GetCacheKey(params) {
|
|
3965
|
-
let { entityId, entityTypeId, schemaId, expandLocation, expandRelations, expandImports, expandSources, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
3978
|
+
let { entityId, scenario: scenarioId, entityTypeId, schemaId, expandLocation, expandRelations, expandImports, expandSources, historicFrom, historicKey, historicTo, historicPoint } = params;
|
|
3979
|
+
if (!scenarioId) {
|
|
3980
|
+
scenarioId = 0;
|
|
3981
|
+
}
|
|
3966
3982
|
if (!entityTypeId) {
|
|
3967
3983
|
entityTypeId = "";
|
|
3968
3984
|
}
|
|
@@ -3984,6 +4000,7 @@
|
|
|
3984
4000
|
let key = `${exports.Api.ECacheKey.Entity}${exports.Api.ECacheKey.Id}${entityId}${String(entityTypeId)}${schemaId}`;
|
|
3985
4001
|
key += `${String(Boolean(expandLocation))}${String(Boolean(expandRelations))}${String(Boolean(expandSources))}${String(Boolean(expandImports))}`;
|
|
3986
4002
|
key += `${exports.Api.ECacheKey.EntityHistoricData}${exports.Api.ECacheKey.Id}${historicKey}-${historicFrom}-${historicTo}-${historicPoint}`;
|
|
4003
|
+
key += `${exports.Api.ECacheKey.Id}${scenarioId}`;
|
|
3987
4004
|
return key;
|
|
3988
4005
|
}
|
|
3989
4006
|
Entity.GetCacheKey = GetCacheKey;
|
|
@@ -14709,8 +14726,104 @@
|
|
|
14709
14726
|
DataSource.GetListCacheKey = GetListCacheKey;
|
|
14710
14727
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
14711
14728
|
|
|
14729
|
+
(function (Scenario) {
|
|
14730
|
+
/**
|
|
14731
|
+
* Returns a scenario record matching the provided ID or Key.
|
|
14732
|
+
* @param params
|
|
14733
|
+
* @returns
|
|
14734
|
+
*/
|
|
14735
|
+
function Get(params) {
|
|
14736
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14737
|
+
let { scenarioId: id, scenarioKey: key, api, req } = params;
|
|
14738
|
+
if (!api) {
|
|
14739
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
14740
|
+
}
|
|
14741
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
14742
|
+
try {
|
|
14743
|
+
const url = key ? `scenario/key/${key}` : `scenario/${id}`;
|
|
14744
|
+
const data = yield api.GET(url, exports.Api.PrepReqParams(req));
|
|
14745
|
+
res({
|
|
14746
|
+
plugin: data
|
|
14747
|
+
});
|
|
14748
|
+
}
|
|
14749
|
+
catch (e) {
|
|
14750
|
+
rej(e);
|
|
14751
|
+
}
|
|
14752
|
+
}));
|
|
14753
|
+
return prom;
|
|
14754
|
+
});
|
|
14755
|
+
}
|
|
14756
|
+
Scenario.Get = Get;
|
|
14757
|
+
/**
|
|
14758
|
+
* Returns a list of scenarios.
|
|
14759
|
+
* @param params
|
|
14760
|
+
* @returns
|
|
14761
|
+
*/
|
|
14762
|
+
function GetList(params) {
|
|
14763
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14764
|
+
let { api, req } = params;
|
|
14765
|
+
if (!api) {
|
|
14766
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
14767
|
+
}
|
|
14768
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
14769
|
+
try {
|
|
14770
|
+
const data = yield api.GET("scenarios", exports.Api.PrepReqParams(req));
|
|
14771
|
+
res({
|
|
14772
|
+
scenario: data.Items
|
|
14773
|
+
});
|
|
14774
|
+
}
|
|
14775
|
+
catch (e) {
|
|
14776
|
+
rej(e);
|
|
14777
|
+
}
|
|
14778
|
+
}));
|
|
14779
|
+
return prom;
|
|
14780
|
+
});
|
|
14781
|
+
}
|
|
14782
|
+
Scenario.GetList = GetList;
|
|
14783
|
+
/**
|
|
14784
|
+
* Creates or updates a scenario.
|
|
14785
|
+
* @param params
|
|
14786
|
+
*/
|
|
14787
|
+
function Update(params) {
|
|
14788
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14789
|
+
let { scenario, api, req } = params;
|
|
14790
|
+
if (!scenario.DisplayName || !scenario.Key) {
|
|
14791
|
+
throw ("Display name and key are required.");
|
|
14792
|
+
}
|
|
14793
|
+
if (!api) {
|
|
14794
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
14795
|
+
}
|
|
14796
|
+
if (!scenario.ID) {
|
|
14797
|
+
scenario.ID = 0;
|
|
14798
|
+
}
|
|
14799
|
+
const data = yield api.POST(`scenario/${scenario.ID}`, scenario, exports.Api.PrepReqParams(req));
|
|
14800
|
+
return {
|
|
14801
|
+
scenario: data
|
|
14802
|
+
};
|
|
14803
|
+
});
|
|
14804
|
+
}
|
|
14805
|
+
Scenario.Update = Update;
|
|
14806
|
+
/**
|
|
14807
|
+
* Deletes a scenario.
|
|
14808
|
+
* @param params
|
|
14809
|
+
*/
|
|
14810
|
+
function Delete(params) {
|
|
14811
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14812
|
+
let { scenarioId, api, req } = params;
|
|
14813
|
+
if (!scenarioId) {
|
|
14814
|
+
throw ("Scenario ID is required.");
|
|
14815
|
+
}
|
|
14816
|
+
if (!api) {
|
|
14817
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
14818
|
+
}
|
|
14819
|
+
yield api.DELETE(`scenario/${scenarioId}`, exports.Api.PrepReqParams(req));
|
|
14820
|
+
});
|
|
14821
|
+
}
|
|
14822
|
+
Scenario.Delete = Delete;
|
|
14823
|
+
})(exports.Scenario || (exports.Scenario = {}));
|
|
14824
|
+
|
|
14712
14825
|
// This is updated with the package.json version on build.
|
|
14713
|
-
const VERSION = "5.5.
|
|
14826
|
+
const VERSION = "5.5.6";
|
|
14714
14827
|
|
|
14715
14828
|
exports.VERSION = VERSION;
|
|
14716
14829
|
exports.AbstractApi = AbstractApi;
|