bruce-models 7.0.4 → 7.0.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 +96 -77
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +96 -77
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/calculator/calculator.js +77 -73
- package/dist/lib/calculator/calculator.js.map +1 -1
- package/dist/lib/mcp/navigator-chat.js +18 -3
- package/dist/lib/mcp/navigator-chat.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/calculator/calculator.d.ts +1 -1
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -5293,92 +5293,96 @@ var Calculator;
|
|
|
5293
5293
|
}
|
|
5294
5294
|
for (let i = 0; i < value.values.length; i++) {
|
|
5295
5295
|
const option = value.values[i];
|
|
5296
|
-
|
|
5297
|
-
//
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
return
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
}
|
|
5320
|
-
}
|
|
5321
|
-
catch (exception) {
|
|
5322
|
-
const e = exception;
|
|
5323
|
-
let suppress = false;
|
|
5324
|
-
if (e && typeof e == "object") {
|
|
5325
|
-
const msg = e.message;
|
|
5326
|
-
suppress = !!msg && (msg.includes("Unexpected end") || msg.includes("got end of script"));
|
|
5327
|
-
}
|
|
5328
|
-
if (!suppress) {
|
|
5329
|
-
console.error(e);
|
|
5330
|
-
}
|
|
5331
|
-
// Eval failed, therefor not a valid mapping-row.
|
|
5332
|
-
continue;
|
|
5333
|
-
}
|
|
5334
|
-
}
|
|
5335
|
-
let isMapValueNum = !isNaN(+mapValue);
|
|
5336
|
-
if (isMapValueNum == null) {
|
|
5337
|
-
isMapValueNum = false;
|
|
5338
|
-
}
|
|
5339
|
-
if (isValueNum && (isMapValueNum || (typeof mapValue === "string" && mapValue.includes("-")))) {
|
|
5340
|
-
if (+mapValue == +eValue) {
|
|
5341
|
-
return option.appliedValue;
|
|
5342
|
-
}
|
|
5343
|
-
const mapSplit = mapValue.split("-");
|
|
5344
|
-
if (mapSplit.length == 2) {
|
|
5345
|
-
const min = mapSplit[0];
|
|
5346
|
-
const max = mapSplit[1];
|
|
5347
|
-
if (min != "") {
|
|
5348
|
-
if (+eValue < +min) {
|
|
5349
|
-
continue;
|
|
5296
|
+
const fieldValues = Array.isArray(option.fieldValue) ? option.fieldValue : [option.fieldValue];
|
|
5297
|
+
// Check each field value in the array.
|
|
5298
|
+
for (let j = 0; j < fieldValues.length; j++) {
|
|
5299
|
+
let mapValue = fieldValues[j];
|
|
5300
|
+
// If mapValue is prefixed with "JS:", we evaluate it as JavaScript.
|
|
5301
|
+
// This lets us do things like JS:Boolean("${}") as a quick way to map 'existence' to a target value.
|
|
5302
|
+
if (typeof mapValue === "string" && mapValue.startsWith("JS:")) {
|
|
5303
|
+
try {
|
|
5304
|
+
let jsEval = mapValue.replace("JS:", "").trim();
|
|
5305
|
+
const attrPathStr = PathUtils.Wrap(attrPath);
|
|
5306
|
+
jsEval = jsEval.replace("${}", "${" + attrPathStr + "}");
|
|
5307
|
+
jsEval = BruceVariable.SwapValues({
|
|
5308
|
+
str: jsEval,
|
|
5309
|
+
entity: entity
|
|
5310
|
+
});
|
|
5311
|
+
// https://rollupjs.org/guide/en/#avoiding-eval
|
|
5312
|
+
// This stops eval warning.
|
|
5313
|
+
const eval2 = eval;
|
|
5314
|
+
mapValue = eval2(jsEval);
|
|
5315
|
+
// We currently expect eval to return a validity bool.
|
|
5316
|
+
// So it either matches and we return it, or it doesn't and we continue.
|
|
5317
|
+
if (mapValue) {
|
|
5318
|
+
return option.appliedValue;
|
|
5350
5319
|
}
|
|
5351
|
-
|
|
5352
|
-
if (max != "") {
|
|
5353
|
-
if (+eValue > +max) {
|
|
5320
|
+
else {
|
|
5354
5321
|
continue;
|
|
5355
5322
|
}
|
|
5356
5323
|
}
|
|
5357
|
-
|
|
5324
|
+
catch (exception) {
|
|
5325
|
+
const e = exception;
|
|
5326
|
+
let suppress = false;
|
|
5327
|
+
if (e && typeof e == "object") {
|
|
5328
|
+
const msg = e.message;
|
|
5329
|
+
suppress = !!msg && (msg.includes("Unexpected end") || msg.includes("got end of script"));
|
|
5330
|
+
}
|
|
5331
|
+
if (!suppress) {
|
|
5332
|
+
console.error(e);
|
|
5333
|
+
}
|
|
5334
|
+
// Eval failed, therefor not a valid mapping-row.
|
|
5358
5335
|
continue;
|
|
5359
5336
|
}
|
|
5360
|
-
return option.appliedValue;
|
|
5361
5337
|
}
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
return option.appliedValue;
|
|
5338
|
+
let isMapValueNum = !isNaN(+mapValue);
|
|
5339
|
+
if (isMapValueNum == null) {
|
|
5340
|
+
isMapValueNum = false;
|
|
5366
5341
|
}
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5342
|
+
if (isValueNum && (isMapValueNum || (typeof mapValue === "string" && mapValue.includes("-")))) {
|
|
5343
|
+
if (+mapValue == +eValue) {
|
|
5344
|
+
return option.appliedValue;
|
|
5345
|
+
}
|
|
5346
|
+
const mapSplit = mapValue.split("-");
|
|
5347
|
+
if (mapSplit.length == 2) {
|
|
5348
|
+
const min = mapSplit[0];
|
|
5349
|
+
const max = mapSplit[1];
|
|
5350
|
+
if (min != "") {
|
|
5351
|
+
if (+eValue < +min) {
|
|
5352
|
+
continue;
|
|
5353
|
+
}
|
|
5354
|
+
}
|
|
5355
|
+
if (max != "") {
|
|
5356
|
+
if (+eValue > +max) {
|
|
5357
|
+
continue;
|
|
5358
|
+
}
|
|
5359
|
+
}
|
|
5360
|
+
if (min == "" && max == "") {
|
|
5361
|
+
continue;
|
|
5362
|
+
}
|
|
5372
5363
|
return option.appliedValue;
|
|
5373
5364
|
}
|
|
5374
5365
|
}
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
else if (typeof mapValue === "boolean" && typeof eValue === "string") {
|
|
5378
|
-
const mapValueStr = mapValue ? "true" : "false";
|
|
5379
|
-
if (mapValueStr == eValue.toLowerCase()) {
|
|
5366
|
+
else {
|
|
5367
|
+
if (mapValue == eValue) {
|
|
5380
5368
|
return option.appliedValue;
|
|
5381
5369
|
}
|
|
5370
|
+
// Case where Entity value is a boolean but the mapping value is a string.
|
|
5371
|
+
// Common as mapping value is typically a user-entered string.
|
|
5372
|
+
else if (typeof eValue === "boolean" && typeof mapValue === "string") {
|
|
5373
|
+
const eValueStr = eValue ? "true" : "false";
|
|
5374
|
+
if (mapValue.toLowerCase() == eValueStr) {
|
|
5375
|
+
return option.appliedValue;
|
|
5376
|
+
}
|
|
5377
|
+
}
|
|
5378
|
+
// Handling possible case where the opposite is true.
|
|
5379
|
+
// Have not seen this happen yet, but preparing for any future cases.
|
|
5380
|
+
else if (typeof mapValue === "boolean" && typeof eValue === "string") {
|
|
5381
|
+
const mapValueStr = mapValue ? "true" : "false";
|
|
5382
|
+
if (mapValueStr == eValue.toLowerCase()) {
|
|
5383
|
+
return option.appliedValue;
|
|
5384
|
+
}
|
|
5385
|
+
}
|
|
5382
5386
|
}
|
|
5383
5387
|
}
|
|
5384
5388
|
}
|
|
@@ -16649,7 +16653,7 @@ var Tracking;
|
|
|
16649
16653
|
})(Tracking || (Tracking = {}));
|
|
16650
16654
|
|
|
16651
16655
|
const DEFAULT_JOB_POLL_INTERVAL_MS = 1000;
|
|
16652
|
-
const DEFAULT_JOB_POLL_TIMEOUT_MS =
|
|
16656
|
+
const DEFAULT_JOB_POLL_TIMEOUT_MS = 10 * 60 * 1000; // match server timeout (10 minutes)
|
|
16653
16657
|
const DEFAULT_BASE_URL = "http://localhost:8888";
|
|
16654
16658
|
/**
|
|
16655
16659
|
* Lightweight client for the Navigator MCP chat HTTP endpoints.
|
|
@@ -16732,15 +16736,17 @@ class NavigatorChatClient {
|
|
|
16732
16736
|
.map((step, idx) => (Object.assign(Object.assign({}, step), { index: typeof (step === null || step === void 0 ? void 0 : step.index) === "number" ? step.index : idx })));
|
|
16733
16737
|
}
|
|
16734
16738
|
waitForJobCompletion(envelope, auth) {
|
|
16735
|
-
var _a, _b, _c, _d, _e;
|
|
16739
|
+
var _a, _b, _c, _d, _e, _f;
|
|
16736
16740
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16737
16741
|
if (!envelope.jobId) {
|
|
16738
16742
|
throw new Error("Chat job response did not include a jobId.");
|
|
16739
16743
|
}
|
|
16740
16744
|
const pollPath = (_a = envelope.pollUrl) !== null && _a !== void 0 ? _a : `/chat/jobs/${envelope.jobId}`;
|
|
16741
16745
|
const startedAt = Date.now();
|
|
16746
|
+
let lastStatusPayload = null;
|
|
16742
16747
|
while (Date.now() - startedAt < this.jobPollTimeoutMs) {
|
|
16743
16748
|
const statusPayload = yield this.fetchJobStatus(pollPath, auth);
|
|
16749
|
+
lastStatusPayload = statusPayload;
|
|
16744
16750
|
const status = statusPayload === null || statusPayload === void 0 ? void 0 : statusPayload.status;
|
|
16745
16751
|
if (!status) {
|
|
16746
16752
|
yield this.delay(this.jobPollIntervalMs);
|
|
@@ -16770,7 +16776,20 @@ class NavigatorChatClient {
|
|
|
16770
16776
|
}
|
|
16771
16777
|
yield this.delay(this.jobPollIntervalMs);
|
|
16772
16778
|
}
|
|
16773
|
-
|
|
16779
|
+
// Timeout: return a response object instead of throwing
|
|
16780
|
+
const combinedSteps = lastStatusPayload ? [
|
|
16781
|
+
...(Array.isArray(lastStatusPayload.steps) ? lastStatusPayload.steps : []),
|
|
16782
|
+
...(Array.isArray((_f = lastStatusPayload.result) === null || _f === void 0 ? void 0 : _f.steps) ? lastStatusPayload.result.steps : [])
|
|
16783
|
+
] : [];
|
|
16784
|
+
const normalizedSteps = this.normalizeSteps(combinedSteps);
|
|
16785
|
+
return {
|
|
16786
|
+
text: "Chat job polling timed out. Please try again later.",
|
|
16787
|
+
steps: normalizedSteps,
|
|
16788
|
+
raw: lastStatusPayload !== null && lastStatusPayload !== void 0 ? lastStatusPayload : {},
|
|
16789
|
+
jobId: envelope.jobId,
|
|
16790
|
+
status: "TIMEOUT",
|
|
16791
|
+
anonymous: Boolean(lastStatusPayload === null || lastStatusPayload === void 0 ? void 0 : lastStatusPayload.anonymous)
|
|
16792
|
+
};
|
|
16774
16793
|
});
|
|
16775
16794
|
}
|
|
16776
16795
|
fetchJobStatus(path, auth) {
|
|
@@ -17017,7 +17036,7 @@ class NavigatorMcpWebSocketClient {
|
|
|
17017
17036
|
}
|
|
17018
17037
|
|
|
17019
17038
|
// This is updated with the package.json version on build.
|
|
17020
|
-
const VERSION = "7.0.
|
|
17039
|
+
const VERSION = "7.0.6";
|
|
17021
17040
|
|
|
17022
17041
|
export { VERSION, Assembly, AnnDocument, CustomForm, AbstractApi, Api, BruceApi, GlobalApi, GuardianApi, ApiGetters, Calculator, Bounds, BruceEvent, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, Geometry, UTC, BruceVariable, LRUCache, GeoJson, EntityAttachmentType, EntityAttachment, EntityComment, EntityLink, EntityLod, EntityLodCategory, EntityRelationType, EntityRelation, EntitySource, EntityTag, EntityType, Entity, EntityCoords, EntityAttribute, EntityHistoricData, EntityTableView, Comment, ClientFile, ProgramKey, ZoomControl, MenuItem, ProjectViewBookmark, ProjectView, ProjectViewLegacyTile, ProjectViewTile, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewBookmarkGroup, PendingAction, MessageBroker, HostingLocation, Style, Tileset, Permission, Session, UserGroup, User, UserMfaMethod, Account, AccountInvite, AccountFeatures, AccountLimits, AccountTemplate, AccountType, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, DataLab, DataLabGroup, ImportAssembly, ImportCad, ImportCsv, ImportJson, ImportGeoJson, ImportKml, ImportedFile, ExportBrz, ExportUsd, Markup, Uploader, Plugin, ENVIRONMENT, DataSource, Scenario, Tracking, NavigatorChatClient, NavigatorMcpWebSocketClient };
|
|
17023
17042
|
//# sourceMappingURL=bruce-models.es5.js.map
|