bruce-models 7.1.81 → 7.1.83

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.
@@ -10740,6 +10740,24 @@
10740
10740
  }
10741
10741
 
10742
10742
  (function (DataLab) {
10743
+ /**
10744
+ * What a search returns, as opposed to which Entities it matches.
10745
+ */
10746
+ let ESelectType;
10747
+ (function (ESelectType) {
10748
+ // Whole Entity records. This is the default.
10749
+ ESelectType["Entity"] = "ENTITY";
10750
+ // Just the Entity IDs.
10751
+ ESelectType["Id"] = "ID";
10752
+ // The distinct Entity Type IDs of the matches, rather than the matches themselves.
10753
+ ESelectType["EntityTypeId"] = "ENTITY_TYPE_ID";
10754
+ // The internal (Bruce) attributes at the root of each record.
10755
+ ESelectType["Internal"] = "Bruce";
10756
+ // A calculation described by Output.
10757
+ ESelectType["Calc"] = "CALC";
10758
+ // A data schema built from the matches.
10759
+ ESelectType["DataSchema"] = "DATA_SCHEMA";
10760
+ })(ESelectType = DataLab.ESelectType || (DataLab.ESelectType = {}));
10743
10761
  let EReqKey;
10744
10762
  (function (EReqKey) {
10745
10763
  EReqKey["Primary"] = "PrimarySelection";
@@ -10826,6 +10844,59 @@
10826
10844
  });
10827
10845
  }
10828
10846
  DataLab.SuggestDataLabQueryByPrompt = SuggestDataLabQueryByPrompt;
10847
+ /**
10848
+ * Runs a DataLab query for the distinct Entity Type IDs of everything it matches.
10849
+ */
10850
+ function GetEntityTypeIds(params) {
10851
+ return __awaiter(this, void 0, void 0, function* () {
10852
+ let { api, query, skip, load, req: reqParams } = params;
10853
+ if (!api) {
10854
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
10855
+ }
10856
+ if (!(query === null || query === void 0 ? void 0 : query[EReqKey.Primary])) {
10857
+ throw new Error("query must carry a PrimarySelection.");
10858
+ }
10859
+ skip = skip !== null && skip !== void 0 ? skip : 0;
10860
+ load = load !== null && load !== void 0 ? load : 200;
10861
+ // Cloned so asking this question of a query never changes what the caller goes on to run.
10862
+ const body = Object.assign(Object.assign({}, query), { [EReqKey.Primary]: Object.assign(Object.assign({}, query[EReqKey.Primary]), { Select: { Type: ESelectType.EntityTypeId } }), Skip: skip, Load: load });
10863
+ const res = yield api.POST("v3/datalab/runSearch", body, exports.Api.PrepReqParams(reqParams));
10864
+ return {
10865
+ entityTypeIds: Array.isArray(res === null || res === void 0 ? void 0 : res.Items) ? res.Items : [],
10866
+ hasMore: Boolean(res === null || res === void 0 ? void 0 : res.NextPage)
10867
+ };
10868
+ });
10869
+ }
10870
+ DataLab.GetEntityTypeIds = GetEntityTypeIds;
10871
+ /**
10872
+ * Returns the distinct Entity Type IDs used inside one or more assembly hierarchies.
10873
+ * The root Entity's own Type is included, since it is part of the hierarchy.
10874
+ */
10875
+ function GetAssemblyEntityTypeIds(params) {
10876
+ return __awaiter(this, void 0, void 0, function* () {
10877
+ const { api, rootEntityId, skip, load, req } = params;
10878
+ const rootIds = Array.isArray(rootEntityId) ? rootEntityId : [rootEntityId];
10879
+ if (!rootIds.length || rootIds.some(id => !id)) {
10880
+ throw new Error("rootEntityId must be provided.");
10881
+ }
10882
+ const criterion = {
10883
+ key: "root",
10884
+ RootID: rootIds
10885
+ };
10886
+ return GetEntityTypeIds({
10887
+ api,
10888
+ skip,
10889
+ load,
10890
+ req,
10891
+ query: {
10892
+ [EReqKey.Primary]: {
10893
+ Items: [criterion]
10894
+ }
10895
+ }
10896
+ });
10897
+ });
10898
+ }
10899
+ DataLab.GetAssemblyEntityTypeIds = GetAssemblyEntityTypeIds;
10829
10900
  /**
10830
10901
  * Runs a DataLab query.
10831
10902
  * @param params
@@ -10874,6 +10945,26 @@
10874
10945
  });
10875
10946
  }
10876
10947
  DataLab.Run = Run;
10948
+ /**
10949
+ * Runs one or more DataLab actions.
10950
+ * This calls: POST v3/datalab/runAction
10951
+ */
10952
+ function RunAction(params) {
10953
+ return __awaiter(this, void 0, void 0, function* () {
10954
+ let { api, body, req } = params;
10955
+ if (!body) {
10956
+ throw new Error("body is required.");
10957
+ }
10958
+ if (!api) {
10959
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
10960
+ }
10961
+ const res = yield api.POST("v3/datalab/runAction", body, exports.Api.PrepReqParams(req));
10962
+ return {
10963
+ action: res
10964
+ };
10965
+ });
10966
+ }
10967
+ DataLab.RunAction = RunAction;
10877
10968
  })(exports.DataLab || (exports.DataLab = {}));
10878
10969
 
10879
10970
  (function (DataLabGroup) {
@@ -14717,6 +14808,70 @@
14717
14808
  ExportBrz.Export = Export;
14718
14809
  })(exports.ExportBrz || (exports.ExportBrz = {}));
14719
14810
 
14811
+ (function (ExportCsv) {
14812
+ /**
14813
+ * Exports CSV for Entities selected by Filter.
14814
+ * This calls: GET entities/ExportCSV
14815
+ */
14816
+ function Export(params) {
14817
+ return __awaiter(this, void 0, void 0, function* () {
14818
+ let { api, fileExport, req } = params;
14819
+ if (!api) {
14820
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
14821
+ }
14822
+ if (!(fileExport === null || fileExport === void 0 ? void 0 : fileExport.BruceEntityType)) {
14823
+ throw ("fileExport.BruceEntityType is required.");
14824
+ }
14825
+ const urlParams = new URLSearchParams();
14826
+ urlParams.append("BruceEntityType", fileExport.BruceEntityType);
14827
+ appendStringParam(urlParams, "OrderBy", fileExport.OrderBy);
14828
+ appendStringParam(urlParams, "SortOrder", fileExport.SortOrder);
14829
+ appendStringParam(urlParams, "Filter", fileExport.Filter);
14830
+ appendStringParam(urlParams, "LODType", fileExport.LODType);
14831
+ if (fileExport.ZIP != null) {
14832
+ urlParams.append("ZIP", String(fileExport.ZIP));
14833
+ }
14834
+ if (fileExport.ColumnSettings) {
14835
+ urlParams.append("ColumnSettings", JSON.stringify(fileExport.ColumnSettings));
14836
+ }
14837
+ return api.GET(`entities/ExportCSV?${urlParams.toString()}`, exports.Api.PrepReqParams(req));
14838
+ });
14839
+ }
14840
+ ExportCsv.Export = Export;
14841
+ /**
14842
+ * Exports CSV for a provided list of Entity IDs.
14843
+ * This calls: POST entities/ExportCSV/{entityType_ID}
14844
+ */
14845
+ function ExportEntities(params) {
14846
+ var _a;
14847
+ return __awaiter(this, void 0, void 0, function* () {
14848
+ let { api, entityTypeId, fileExport, zip, req } = params;
14849
+ if (!api) {
14850
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
14851
+ }
14852
+ if (!entityTypeId) {
14853
+ throw ("entityTypeId is required.");
14854
+ }
14855
+ if (!((_a = fileExport === null || fileExport === void 0 ? void 0 : fileExport.EntityIDs) === null || _a === void 0 ? void 0 : _a.length)) {
14856
+ throw ("fileExport.EntityIDs is required and must be a non-empty list.");
14857
+ }
14858
+ let url = `entities/ExportCSV/${exports.Api.Encode(entityTypeId)}`;
14859
+ if (zip != null) {
14860
+ const urlParams = new URLSearchParams();
14861
+ urlParams.append("ZIP", String(zip));
14862
+ url += `?${urlParams.toString()}`;
14863
+ }
14864
+ return api.POST(url, fileExport, exports.Api.PrepReqParams(req));
14865
+ });
14866
+ }
14867
+ ExportCsv.ExportEntities = ExportEntities;
14868
+ function appendStringParam(urlParams, key, value) {
14869
+ if (value != null && value !== "") {
14870
+ urlParams.append(key, String(value));
14871
+ }
14872
+ }
14873
+ })(exports.ExportCsv || (exports.ExportCsv = {}));
14874
+
14720
14875
  (function (ExportUsd) {
14721
14876
  function Export(params) {
14722
14877
  return __awaiter(this, void 0, void 0, function* () {
@@ -20255,7 +20410,7 @@
20255
20410
  })(exports.UrlUtils || (exports.UrlUtils = {}));
20256
20411
 
20257
20412
  // This is updated with the package.json version on build.
20258
- const VERSION = "7.1.81";
20413
+ const VERSION = "7.1.83";
20259
20414
 
20260
20415
  exports.VERSION = VERSION;
20261
20416
  exports.AbstractApi = AbstractApi;