bruce-models 7.1.80 → 7.1.82
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 +254 -2
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +247 -1
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/api.js +1 -0
- package/dist/lib/api/api.js.map +1 -1
- package/dist/lib/bruce-models.js +4 -1
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/data-lab/data-lab.js +20 -0
- package/dist/lib/data-lab/data-lab.js.map +1 -1
- package/dist/lib/entity/entity-type-relation.js +180 -0
- package/dist/lib/entity/entity-type-relation.js.map +1 -0
- package/dist/lib/entity/entity-type.js.map +1 -1
- package/dist/lib/export/entity-export.js +3 -0
- package/dist/lib/export/entity-export.js.map +1 -0
- package/dist/lib/export/export-csv.js +79 -0
- package/dist/lib/export/export-csv.js.map +1 -0
- package/dist/types/api/api.d.ts +1 -0
- package/dist/types/bruce-models.d.ts +4 -1
- package/dist/types/data-lab/data-lab.d.ts +37 -1
- package/dist/types/entity/entity-type-relation.d.ts +68 -0
- package/dist/types/entity/entity-type.d.ts +31 -5
- package/dist/types/export/entity-export.d.ts +17 -0
- package/dist/types/export/export-csv.d.ts +39 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
ECacheKey["Assembly"] = "assembly";
|
|
45
45
|
ECacheKey["Entity"] = "entity";
|
|
46
46
|
ECacheKey["EntityType"] = "entitytype";
|
|
47
|
+
ECacheKey["EntityTypeRelation"] = "entitytyperelation";
|
|
47
48
|
ECacheKey["Ontology"] = "ontology";
|
|
48
49
|
ECacheKey["EntityTypeTrigger"] = "entitytypetrigger";
|
|
49
50
|
ECacheKey["DataFeed"] = "datafeed";
|
|
@@ -10873,6 +10874,26 @@
|
|
|
10873
10874
|
});
|
|
10874
10875
|
}
|
|
10875
10876
|
DataLab.Run = Run;
|
|
10877
|
+
/**
|
|
10878
|
+
* Runs one or more DataLab actions.
|
|
10879
|
+
* This calls: POST v3/datalab/runAction
|
|
10880
|
+
*/
|
|
10881
|
+
function RunAction(params) {
|
|
10882
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
10883
|
+
let { api, body, req } = params;
|
|
10884
|
+
if (!body) {
|
|
10885
|
+
throw new Error("body is required.");
|
|
10886
|
+
}
|
|
10887
|
+
if (!api) {
|
|
10888
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
10889
|
+
}
|
|
10890
|
+
const res = yield api.POST("v3/datalab/runAction", body, exports.Api.PrepReqParams(req));
|
|
10891
|
+
return {
|
|
10892
|
+
action: res
|
|
10893
|
+
};
|
|
10894
|
+
});
|
|
10895
|
+
}
|
|
10896
|
+
DataLab.RunAction = RunAction;
|
|
10876
10897
|
})(exports.DataLab || (exports.DataLab = {}));
|
|
10877
10898
|
|
|
10878
10899
|
(function (DataLabGroup) {
|
|
@@ -14040,6 +14061,167 @@
|
|
|
14040
14061
|
EntityTag.GetListCacheKey = GetListCacheKey;
|
|
14041
14062
|
})(exports.EntityTag || (exports.EntityTag = {}));
|
|
14042
14063
|
|
|
14064
|
+
(function (EntityTypeRelation) {
|
|
14065
|
+
/**
|
|
14066
|
+
* Gets a single Entity Type Relation record.
|
|
14067
|
+
* This calls: GET entityType/{entityType_id}/relation/{entity_type_relation_id}
|
|
14068
|
+
*/
|
|
14069
|
+
function Get(params) {
|
|
14070
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14071
|
+
let { api, entityTypeId, entityTypeRelationId, req } = params;
|
|
14072
|
+
if (!entityTypeId) {
|
|
14073
|
+
throw ("Entity Type ID is required.");
|
|
14074
|
+
}
|
|
14075
|
+
if (!entityTypeRelationId) {
|
|
14076
|
+
throw ("Entity Type Relation ID is required.");
|
|
14077
|
+
}
|
|
14078
|
+
if (!api) {
|
|
14079
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
14080
|
+
}
|
|
14081
|
+
const key = GetCacheKey(entityTypeId, entityTypeRelationId);
|
|
14082
|
+
const cache = api.GetCacheItem(key, req);
|
|
14083
|
+
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
14084
|
+
return cache.data;
|
|
14085
|
+
}
|
|
14086
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
14087
|
+
try {
|
|
14088
|
+
const data = yield api.GET(`entityType/${entityTypeId}/relation/${entityTypeRelationId}`, exports.Api.PrepReqParams(req));
|
|
14089
|
+
res({
|
|
14090
|
+
relation: data
|
|
14091
|
+
});
|
|
14092
|
+
}
|
|
14093
|
+
catch (e) {
|
|
14094
|
+
rej(e);
|
|
14095
|
+
}
|
|
14096
|
+
}));
|
|
14097
|
+
api.SetCacheItem({
|
|
14098
|
+
key,
|
|
14099
|
+
value: prom,
|
|
14100
|
+
req
|
|
14101
|
+
});
|
|
14102
|
+
return prom;
|
|
14103
|
+
});
|
|
14104
|
+
}
|
|
14105
|
+
EntityTypeRelation.Get = Get;
|
|
14106
|
+
/**
|
|
14107
|
+
* Gets Entity Type Relation records for the specified Entity Type.
|
|
14108
|
+
* This calls: GET entityType/{entityType_id}/relations
|
|
14109
|
+
*/
|
|
14110
|
+
function GetList(params) {
|
|
14111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14112
|
+
let { api, entityTypeId, req } = params;
|
|
14113
|
+
if (!entityTypeId) {
|
|
14114
|
+
throw ("Entity Type ID is required.");
|
|
14115
|
+
}
|
|
14116
|
+
if (!api) {
|
|
14117
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
14118
|
+
}
|
|
14119
|
+
const key = GetListCacheKey(entityTypeId);
|
|
14120
|
+
const cache = api.GetCacheItem(key, req);
|
|
14121
|
+
if (cache === null || cache === void 0 ? void 0 : cache.found) {
|
|
14122
|
+
return cache.data;
|
|
14123
|
+
}
|
|
14124
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
14125
|
+
try {
|
|
14126
|
+
const data = yield api.GET(`entityType/${entityTypeId}/relations`, exports.Api.PrepReqParams(req));
|
|
14127
|
+
res({
|
|
14128
|
+
relations: Array.isArray(data === null || data === void 0 ? void 0 : data.Items) ? data.Items : []
|
|
14129
|
+
});
|
|
14130
|
+
}
|
|
14131
|
+
catch (e) {
|
|
14132
|
+
rej(e);
|
|
14133
|
+
}
|
|
14134
|
+
}));
|
|
14135
|
+
api.SetCacheItem({
|
|
14136
|
+
key,
|
|
14137
|
+
value: prom,
|
|
14138
|
+
req
|
|
14139
|
+
});
|
|
14140
|
+
return prom;
|
|
14141
|
+
});
|
|
14142
|
+
}
|
|
14143
|
+
EntityTypeRelation.GetList = GetList;
|
|
14144
|
+
/**
|
|
14145
|
+
* Creates or updates an Entity Type Relation record.
|
|
14146
|
+
* This calls: POST entityType/{entityType_id}/relation/{entity_type_relation_id}
|
|
14147
|
+
*/
|
|
14148
|
+
function Update(params) {
|
|
14149
|
+
var _a;
|
|
14150
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14151
|
+
let { api, entityTypeId, relation: data, entityTypeRelationId, req } = params;
|
|
14152
|
+
if (!entityTypeId) {
|
|
14153
|
+
throw ("Entity Type ID is required.");
|
|
14154
|
+
}
|
|
14155
|
+
if (!data) {
|
|
14156
|
+
throw ("Entity Type Relation is required.");
|
|
14157
|
+
}
|
|
14158
|
+
if (!api) {
|
|
14159
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
14160
|
+
}
|
|
14161
|
+
const relationId = (_a = entityTypeRelationId !== null && entityTypeRelationId !== void 0 ? entityTypeRelationId : data.ID) !== null && _a !== void 0 ? _a : 0;
|
|
14162
|
+
if (isCreateRoute(relationId) && (!data["A.EntityType.ID"] || !data["B.EntityType.ID"] || !data["EntityRelationType.ID"])) {
|
|
14163
|
+
throw ("A.EntityType.ID, B.EntityType.ID, and EntityRelationType.ID are required.");
|
|
14164
|
+
}
|
|
14165
|
+
const res = yield api.POST(`entityType/${entityTypeId}/relation/${relationId}`, data, exports.Api.PrepReqParams(req));
|
|
14166
|
+
removeRelationCache(api, entityTypeId, relationId, res);
|
|
14167
|
+
return {
|
|
14168
|
+
relation: res
|
|
14169
|
+
};
|
|
14170
|
+
});
|
|
14171
|
+
}
|
|
14172
|
+
EntityTypeRelation.Update = Update;
|
|
14173
|
+
/**
|
|
14174
|
+
* Deletes an Entity Type Relation record.
|
|
14175
|
+
* This calls: DELETE entityType/{entityType_id}/relation/{entity_type_relation_id}
|
|
14176
|
+
*/
|
|
14177
|
+
function Delete(params) {
|
|
14178
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14179
|
+
let { api, entityTypeId, entityTypeRelationId, req } = params;
|
|
14180
|
+
if (!entityTypeId) {
|
|
14181
|
+
throw ("Entity Type ID is required.");
|
|
14182
|
+
}
|
|
14183
|
+
if (!entityTypeRelationId) {
|
|
14184
|
+
throw ("Entity Type Relation ID is required.");
|
|
14185
|
+
}
|
|
14186
|
+
if (!api) {
|
|
14187
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
14188
|
+
}
|
|
14189
|
+
yield api.DELETE(`entityType/${entityTypeId}/relation/${entityTypeRelationId}`, exports.Api.PrepReqParams(req));
|
|
14190
|
+
removeRelationCache(api, entityTypeId, entityTypeRelationId);
|
|
14191
|
+
});
|
|
14192
|
+
}
|
|
14193
|
+
EntityTypeRelation.Delete = Delete;
|
|
14194
|
+
/**
|
|
14195
|
+
* Returns cache identifier for an Entity Type Relation record.
|
|
14196
|
+
*/
|
|
14197
|
+
function GetCacheKey(entityTypeId, entityTypeRelationId) {
|
|
14198
|
+
return exports.Api.ECacheKey.EntityTypeRelation + exports.Api.ECacheKey.Id + entityTypeId + exports.Api.ECacheKey.Id + entityTypeRelationId;
|
|
14199
|
+
}
|
|
14200
|
+
EntityTypeRelation.GetCacheKey = GetCacheKey;
|
|
14201
|
+
/**
|
|
14202
|
+
* Returns cache identifier for the list of Entity Type Relation records for an Entity Type.
|
|
14203
|
+
*/
|
|
14204
|
+
function GetListCacheKey(entityTypeId) {
|
|
14205
|
+
return exports.Api.ECacheKey.EntityTypeRelation + exports.Api.ECacheKey.Id + entityTypeId;
|
|
14206
|
+
}
|
|
14207
|
+
EntityTypeRelation.GetListCacheKey = GetListCacheKey;
|
|
14208
|
+
function isCreateRoute(entityTypeRelationId) {
|
|
14209
|
+
return entityTypeRelationId === 0 || entityTypeRelationId === "0";
|
|
14210
|
+
}
|
|
14211
|
+
function removeRelationCache(api, entityTypeId, entityTypeRelationId, relation) {
|
|
14212
|
+
api.Cache.RemoveByStartsWith(GetListCacheKey(entityTypeId));
|
|
14213
|
+
if (!isCreateRoute(entityTypeRelationId)) {
|
|
14214
|
+
api.Cache.Remove(GetCacheKey(entityTypeId, entityTypeRelationId));
|
|
14215
|
+
}
|
|
14216
|
+
if ((relation === null || relation === void 0 ? void 0 : relation["A.EntityType.ID"]) && relation["A.EntityType.ID"] !== entityTypeId) {
|
|
14217
|
+
api.Cache.RemoveByStartsWith(GetListCacheKey(relation["A.EntityType.ID"]));
|
|
14218
|
+
}
|
|
14219
|
+
if ((relation === null || relation === void 0 ? void 0 : relation["B.EntityType.ID"]) && relation["B.EntityType.ID"] !== entityTypeId) {
|
|
14220
|
+
api.Cache.RemoveByStartsWith(GetListCacheKey(relation["B.EntityType.ID"]));
|
|
14221
|
+
}
|
|
14222
|
+
}
|
|
14223
|
+
})(exports.EntityTypeRelation || (exports.EntityTypeRelation = {}));
|
|
14224
|
+
|
|
14043
14225
|
(function (EntityTypeTrigger) {
|
|
14044
14226
|
/**
|
|
14045
14227
|
* Gets a single Entity Type Trigger record.
|
|
@@ -14555,6 +14737,70 @@
|
|
|
14555
14737
|
ExportBrz.Export = Export;
|
|
14556
14738
|
})(exports.ExportBrz || (exports.ExportBrz = {}));
|
|
14557
14739
|
|
|
14740
|
+
(function (ExportCsv) {
|
|
14741
|
+
/**
|
|
14742
|
+
* Exports CSV for Entities selected by Filter.
|
|
14743
|
+
* This calls: GET entities/ExportCSV
|
|
14744
|
+
*/
|
|
14745
|
+
function Export(params) {
|
|
14746
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14747
|
+
let { api, fileExport, req } = params;
|
|
14748
|
+
if (!api) {
|
|
14749
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
14750
|
+
}
|
|
14751
|
+
if (!(fileExport === null || fileExport === void 0 ? void 0 : fileExport.BruceEntityType)) {
|
|
14752
|
+
throw ("fileExport.BruceEntityType is required.");
|
|
14753
|
+
}
|
|
14754
|
+
const urlParams = new URLSearchParams();
|
|
14755
|
+
urlParams.append("BruceEntityType", fileExport.BruceEntityType);
|
|
14756
|
+
appendStringParam(urlParams, "OrderBy", fileExport.OrderBy);
|
|
14757
|
+
appendStringParam(urlParams, "SortOrder", fileExport.SortOrder);
|
|
14758
|
+
appendStringParam(urlParams, "Filter", fileExport.Filter);
|
|
14759
|
+
appendStringParam(urlParams, "LODType", fileExport.LODType);
|
|
14760
|
+
if (fileExport.ZIP != null) {
|
|
14761
|
+
urlParams.append("ZIP", String(fileExport.ZIP));
|
|
14762
|
+
}
|
|
14763
|
+
if (fileExport.ColumnSettings) {
|
|
14764
|
+
urlParams.append("ColumnSettings", JSON.stringify(fileExport.ColumnSettings));
|
|
14765
|
+
}
|
|
14766
|
+
return api.GET(`entities/ExportCSV?${urlParams.toString()}`, exports.Api.PrepReqParams(req));
|
|
14767
|
+
});
|
|
14768
|
+
}
|
|
14769
|
+
ExportCsv.Export = Export;
|
|
14770
|
+
/**
|
|
14771
|
+
* Exports CSV for a provided list of Entity IDs.
|
|
14772
|
+
* This calls: POST entities/ExportCSV/{entityType_ID}
|
|
14773
|
+
*/
|
|
14774
|
+
function ExportEntities(params) {
|
|
14775
|
+
var _a;
|
|
14776
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14777
|
+
let { api, entityTypeId, fileExport, zip, req } = params;
|
|
14778
|
+
if (!api) {
|
|
14779
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
14780
|
+
}
|
|
14781
|
+
if (!entityTypeId) {
|
|
14782
|
+
throw ("entityTypeId is required.");
|
|
14783
|
+
}
|
|
14784
|
+
if (!((_a = fileExport === null || fileExport === void 0 ? void 0 : fileExport.EntityIDs) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
14785
|
+
throw ("fileExport.EntityIDs is required and must be a non-empty list.");
|
|
14786
|
+
}
|
|
14787
|
+
let url = `entities/ExportCSV/${exports.Api.Encode(entityTypeId)}`;
|
|
14788
|
+
if (zip != null) {
|
|
14789
|
+
const urlParams = new URLSearchParams();
|
|
14790
|
+
urlParams.append("ZIP", String(zip));
|
|
14791
|
+
url += `?${urlParams.toString()}`;
|
|
14792
|
+
}
|
|
14793
|
+
return api.POST(url, fileExport, exports.Api.PrepReqParams(req));
|
|
14794
|
+
});
|
|
14795
|
+
}
|
|
14796
|
+
ExportCsv.ExportEntities = ExportEntities;
|
|
14797
|
+
function appendStringParam(urlParams, key, value) {
|
|
14798
|
+
if (value != null && value !== "") {
|
|
14799
|
+
urlParams.append(key, String(value));
|
|
14800
|
+
}
|
|
14801
|
+
}
|
|
14802
|
+
})(exports.ExportCsv || (exports.ExportCsv = {}));
|
|
14803
|
+
|
|
14558
14804
|
(function (ExportUsd) {
|
|
14559
14805
|
function Export(params) {
|
|
14560
14806
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -20093,7 +20339,7 @@
|
|
|
20093
20339
|
})(exports.UrlUtils || (exports.UrlUtils = {}));
|
|
20094
20340
|
|
|
20095
20341
|
// This is updated with the package.json version on build.
|
|
20096
|
-
const VERSION = "7.1.
|
|
20342
|
+
const VERSION = "7.1.82";
|
|
20097
20343
|
|
|
20098
20344
|
exports.VERSION = VERSION;
|
|
20099
20345
|
exports.AbstractApi = AbstractApi;
|