bruce-models 4.7.9 → 4.8.1
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 +123 -5
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +119 -4
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +3 -1
- package/dist/lib/bruce-models.js.map +1 -1
- package/dist/lib/entity/entity-type.js.map +1 -1
- package/dist/lib/import/import-assembly.js +53 -0
- package/dist/lib/import/import-assembly.js.map +1 -0
- package/dist/lib/import/import-cad.js +1 -0
- package/dist/lib/import/import-cad.js.map +1 -1
- package/dist/lib/import/import-csv.js +1 -1
- package/dist/lib/import/import-csv.js.map +1 -1
- package/dist/lib/import/import-geojson.js +28 -0
- package/dist/lib/import/import-geojson.js.map +1 -0
- package/dist/lib/import/import-json.js +1 -1
- package/dist/lib/import/import-json.js.map +1 -1
- package/dist/lib/import/import-kml.js +1 -1
- package/dist/lib/import/import-kml.js.map +1 -1
- package/dist/lib/server/pending-action.js +64 -0
- package/dist/lib/server/pending-action.js.map +1 -1
- package/dist/types/bruce-models.d.ts +3 -1
- package/dist/types/entity/entity-type.d.ts +7 -6
- package/dist/types/import/import-assembly.d.ts +73 -0
- package/dist/types/import/import-cad.d.ts +1 -0
- package/dist/types/import/import-csv.d.ts +10 -15
- package/dist/types/import/import-geojson.d.ts +23 -0
- package/dist/types/import/import-json.d.ts +9 -12
- package/dist/types/import/import-kml.d.ts +16 -5
- package/dist/types/server/pending-action.d.ts +33 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -10548,6 +10548,70 @@
|
|
|
10548
10548
|
});
|
|
10549
10549
|
}
|
|
10550
10550
|
PendingAction.Cancel = Cancel;
|
|
10551
|
+
/**
|
|
10552
|
+
* Resolves when the Pending Action is no longer running.
|
|
10553
|
+
* @param params
|
|
10554
|
+
*
|
|
10555
|
+
* @example
|
|
10556
|
+
* try {
|
|
10557
|
+
* const { action } = await PendingAction.OnCompletion({ actionId: 123 });
|
|
10558
|
+
* }
|
|
10559
|
+
* catch (e) {
|
|
10560
|
+
* // Threw because the action failed to be found.
|
|
10561
|
+
* // Most likely scenarios are invalid actionId or server connection issues.
|
|
10562
|
+
* // If it's related to server connection issues then wait a bit and relaunch.
|
|
10563
|
+
* }
|
|
10564
|
+
*
|
|
10565
|
+
* // Here is how you can stop the loop on early disposal.
|
|
10566
|
+
* let disposed = false;
|
|
10567
|
+
* const { action } = await PendingAction.OnCompletion({
|
|
10568
|
+
* actionId: 123,
|
|
10569
|
+
* isDisposed: () => {
|
|
10570
|
+
* return disposed;
|
|
10571
|
+
* }
|
|
10572
|
+
* });
|
|
10573
|
+
* // Action will resolve as null if it was disposed early.
|
|
10574
|
+
*/
|
|
10575
|
+
function OnCompletion(params) {
|
|
10576
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
10577
|
+
let { api, actionId, req: reqParams, interval: intMs, isDisposed } = params;
|
|
10578
|
+
if (!actionId) {
|
|
10579
|
+
throw ("Action ID is required.");
|
|
10580
|
+
}
|
|
10581
|
+
if (!api) {
|
|
10582
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
10583
|
+
}
|
|
10584
|
+
if (!intMs || intMs <= 0) {
|
|
10585
|
+
intMs = 3000;
|
|
10586
|
+
}
|
|
10587
|
+
const res = yield new Promise((res, rej) => {
|
|
10588
|
+
let interval = setInterval(() => __awaiter(this, void 0, void 0, function* () {
|
|
10589
|
+
if (isDisposed && isDisposed()) {
|
|
10590
|
+
clearInterval(interval);
|
|
10591
|
+
res(null);
|
|
10592
|
+
}
|
|
10593
|
+
try {
|
|
10594
|
+
const { action } = yield Get({
|
|
10595
|
+
api,
|
|
10596
|
+
actionId,
|
|
10597
|
+
req: reqParams
|
|
10598
|
+
});
|
|
10599
|
+
if (action.Status !== EStatus.InProgress) {
|
|
10600
|
+
clearInterval(interval);
|
|
10601
|
+
res(action);
|
|
10602
|
+
}
|
|
10603
|
+
}
|
|
10604
|
+
catch (e) {
|
|
10605
|
+
rej(e);
|
|
10606
|
+
}
|
|
10607
|
+
}), intMs);
|
|
10608
|
+
});
|
|
10609
|
+
return {
|
|
10610
|
+
action: res
|
|
10611
|
+
};
|
|
10612
|
+
});
|
|
10613
|
+
}
|
|
10614
|
+
PendingAction.OnCompletion = OnCompletion;
|
|
10551
10615
|
})(exports.PendingAction || (exports.PendingAction = {}));
|
|
10552
10616
|
|
|
10553
10617
|
// Some dead accounts that we don't want to show in the UI.
|
|
@@ -12940,6 +13004,44 @@
|
|
|
12940
13004
|
DataLab.Run = Run;
|
|
12941
13005
|
})(exports.DataLab || (exports.DataLab = {}));
|
|
12942
13006
|
|
|
13007
|
+
(function (ImportAssembly) {
|
|
13008
|
+
function Analyze(params) {
|
|
13009
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13010
|
+
let { api, fileAnalyze, req: reqParams } = params;
|
|
13011
|
+
if (!api) {
|
|
13012
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
13013
|
+
}
|
|
13014
|
+
return api.POST("import/analyze/assembly", fileAnalyze, exports.Api.PrepReqParams(reqParams));
|
|
13015
|
+
});
|
|
13016
|
+
}
|
|
13017
|
+
ImportAssembly.Analyze = Analyze;
|
|
13018
|
+
function ImportEntities(params) {
|
|
13019
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13020
|
+
let { api, fileImport, req: reqParams } = params;
|
|
13021
|
+
if (!api) {
|
|
13022
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
13023
|
+
}
|
|
13024
|
+
return api.POST("import/assembly", fileImport, exports.Api.PrepReqParams(reqParams));
|
|
13025
|
+
});
|
|
13026
|
+
}
|
|
13027
|
+
ImportAssembly.ImportEntities = ImportEntities;
|
|
13028
|
+
/**
|
|
13029
|
+
* Parses the completed pending action result from running "ImportEntities".
|
|
13030
|
+
* This will return the root entity's id if any is present.
|
|
13031
|
+
* @param paResult
|
|
13032
|
+
*/
|
|
13033
|
+
function ParseAnalysisResult(paResult) {
|
|
13034
|
+
try {
|
|
13035
|
+
return typeof paResult == "string" ? JSON.parse(paResult) : paResult;
|
|
13036
|
+
}
|
|
13037
|
+
catch (_a) {
|
|
13038
|
+
// Failed to parse json.
|
|
13039
|
+
}
|
|
13040
|
+
return null;
|
|
13041
|
+
}
|
|
13042
|
+
ImportAssembly.ParseAnalysisResult = ParseAnalysisResult;
|
|
13043
|
+
})(exports.ImportAssembly || (exports.ImportAssembly = {}));
|
|
13044
|
+
|
|
12943
13045
|
(function (ImportCad) {
|
|
12944
13046
|
function Analyze(params) {
|
|
12945
13047
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -12989,7 +13091,7 @@
|
|
|
12989
13091
|
if (!api) {
|
|
12990
13092
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
12991
13093
|
}
|
|
12992
|
-
return api.POST("
|
|
13094
|
+
return api.POST("import/csv", fileImport, exports.Api.PrepReqParams(reqParams));
|
|
12993
13095
|
});
|
|
12994
13096
|
}
|
|
12995
13097
|
ImportCsv.ImportEntities = ImportEntities;
|
|
@@ -13002,12 +13104,25 @@
|
|
|
13002
13104
|
if (!api) {
|
|
13003
13105
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
13004
13106
|
}
|
|
13005
|
-
return api.POST("
|
|
13107
|
+
return api.POST("import/json", fileImport, exports.Api.PrepReqParams(reqParams));
|
|
13006
13108
|
});
|
|
13007
13109
|
}
|
|
13008
13110
|
ImportJson.ImportEntities = ImportEntities;
|
|
13009
13111
|
})(exports.ImportJson || (exports.ImportJson = {}));
|
|
13010
13112
|
|
|
13113
|
+
(function (ImportGeoJson) {
|
|
13114
|
+
function ImportEntities(params) {
|
|
13115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13116
|
+
let { api, fileImport, req: reqParams } = params;
|
|
13117
|
+
if (!api) {
|
|
13118
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
13119
|
+
}
|
|
13120
|
+
return api.POST("import/geojson", fileImport, exports.Api.PrepReqParams(reqParams));
|
|
13121
|
+
});
|
|
13122
|
+
}
|
|
13123
|
+
ImportGeoJson.ImportEntities = ImportEntities;
|
|
13124
|
+
})(exports.ImportGeoJson || (exports.ImportGeoJson = {}));
|
|
13125
|
+
|
|
13011
13126
|
(function (ImportKml) {
|
|
13012
13127
|
function ImportEntities(params) {
|
|
13013
13128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -13015,7 +13130,7 @@
|
|
|
13015
13130
|
if (!api) {
|
|
13016
13131
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
13017
13132
|
}
|
|
13018
|
-
return api.POST("
|
|
13133
|
+
return api.POST("import/kml", fileImport, exports.Api.PrepReqParams(reqParams));
|
|
13019
13134
|
});
|
|
13020
13135
|
}
|
|
13021
13136
|
ImportKml.ImportEntities = ImportEntities;
|
|
@@ -13865,7 +13980,7 @@
|
|
|
13865
13980
|
})(exports.DataSource || (exports.DataSource = {}));
|
|
13866
13981
|
|
|
13867
13982
|
// This is updated with the package.json version on build.
|
|
13868
|
-
const VERSION = "4.
|
|
13983
|
+
const VERSION = "4.8.1";
|
|
13869
13984
|
|
|
13870
13985
|
exports.VERSION = VERSION;
|
|
13871
13986
|
exports.AbstractApi = AbstractApi;
|