bruce-models 7.1.106 → 7.1.108
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 +130 -9
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +130 -9
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account.js +13 -0
- package/dist/lib/account/account.js.map +1 -1
- package/dist/lib/api/abstract-api.js +6 -1
- package/dist/lib/api/abstract-api.js.map +1 -1
- package/dist/lib/api/bruce-api.js +3 -2
- package/dist/lib/api/bruce-api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/export/export-nsx.js +37 -0
- package/dist/lib/export/export-nsx.js.map +1 -1
- package/dist/lib/mcp/navigator-mcp-websocket.js +70 -5
- package/dist/lib/mcp/navigator-mcp-websocket.js.map +1 -1
- package/dist/types/account/account.d.ts +17 -0
- package/dist/types/api/abstract-api.d.ts +2 -1
- package/dist/types/api/bruce-api.d.ts +2 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/export/export-nsx.d.ts +40 -0
- package/dist/types/mcp/navigator-mcp-websocket.d.ts +6 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -1250,6 +1250,7 @@
|
|
|
1250
1250
|
* This will NOT prepend the base URL to the provided URL.
|
|
1251
1251
|
* @param url
|
|
1252
1252
|
* @param params
|
|
1253
|
+
* @param data Optional request body.
|
|
1253
1254
|
* @returns
|
|
1254
1255
|
*/
|
|
1255
1256
|
get(url, params) {
|
|
@@ -1274,7 +1275,7 @@
|
|
|
1274
1275
|
* @param params
|
|
1275
1276
|
* @returns
|
|
1276
1277
|
*/
|
|
1277
|
-
delete(url, params) {
|
|
1278
|
+
delete(url, params, data) {
|
|
1278
1279
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1279
1280
|
if (!params) {
|
|
1280
1281
|
params = {};
|
|
@@ -1282,9 +1283,13 @@
|
|
|
1282
1283
|
params.headers = params.headers || {};
|
|
1283
1284
|
params.headers = Object.assign({ "Content-Type": "application/json;" }, params.headers);
|
|
1284
1285
|
this.applyAuthHeader(params.headers);
|
|
1286
|
+
if (data != null && typeof data != "string") {
|
|
1287
|
+
data = JSON.stringify(data);
|
|
1288
|
+
}
|
|
1285
1289
|
const res = yield fetch(url, {
|
|
1286
1290
|
headers: params.headers,
|
|
1287
1291
|
method: "DELETE",
|
|
1292
|
+
body: data,
|
|
1288
1293
|
signal: params.abortSignal
|
|
1289
1294
|
});
|
|
1290
1295
|
return parseResult(res);
|
|
@@ -1897,16 +1902,17 @@
|
|
|
1897
1902
|
* This will prepend the base url to the url.
|
|
1898
1903
|
* @param url
|
|
1899
1904
|
* @param params
|
|
1905
|
+
* @param data Optional request body.
|
|
1900
1906
|
* @returns
|
|
1901
1907
|
*/
|
|
1902
|
-
DELETE(url, params) {
|
|
1908
|
+
DELETE(url, params, data) {
|
|
1903
1909
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1904
1910
|
return new Promise((res, rej) => {
|
|
1905
1911
|
this.loadProm.then(() => {
|
|
1906
1912
|
const full = this.ConstructUrl({
|
|
1907
1913
|
url: url
|
|
1908
1914
|
});
|
|
1909
|
-
this.delete(full, params).then(res).catch(rej);
|
|
1915
|
+
this.delete(full, params, data).then(res).catch(rej);
|
|
1910
1916
|
}).catch(rej);
|
|
1911
1917
|
});
|
|
1912
1918
|
});
|
|
@@ -2722,6 +2728,19 @@
|
|
|
2722
2728
|
});
|
|
2723
2729
|
}
|
|
2724
2730
|
Account.Cleanup = Cleanup;
|
|
2731
|
+
/**
|
|
2732
|
+
* Returns file counts and sizes for each storage category in the current account.
|
|
2733
|
+
*/
|
|
2734
|
+
function GetFilesSummary(params) {
|
|
2735
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2736
|
+
let { api, req: reqParams } = params !== null && params !== void 0 ? params : {};
|
|
2737
|
+
if (!api) {
|
|
2738
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
2739
|
+
}
|
|
2740
|
+
return api.GET("account/filesSummary", exports.Api.PrepReqParams(reqParams));
|
|
2741
|
+
});
|
|
2742
|
+
}
|
|
2743
|
+
Account.GetFilesSummary = GetFilesSummary;
|
|
2725
2744
|
/**
|
|
2726
2745
|
* Returns cache identifier for an account by ID.
|
|
2727
2746
|
* Example: {
|
|
@@ -17603,6 +17622,11 @@
|
|
|
17603
17622
|
})(exports.ExportCsv || (exports.ExportCsv = {}));
|
|
17604
17623
|
|
|
17605
17624
|
(function (ExportNsx) {
|
|
17625
|
+
let EAccountBackupFileType;
|
|
17626
|
+
(function (EAccountBackupFileType) {
|
|
17627
|
+
EAccountBackupFileType["DatabaseDump"] = "DatabaseDump";
|
|
17628
|
+
EAccountBackupFileType["NSX"] = "NSX";
|
|
17629
|
+
})(EAccountBackupFileType = ExportNsx.EAccountBackupFileType || (ExportNsx.EAccountBackupFileType = {}));
|
|
17606
17630
|
/**
|
|
17607
17631
|
* Starts a whole-account NSX backup export job.
|
|
17608
17632
|
* The generated NSX file is stored in the account's configured backup file store.
|
|
@@ -17630,6 +17654,38 @@
|
|
|
17630
17654
|
});
|
|
17631
17655
|
}
|
|
17632
17656
|
ExportNsx.GetAccountBackupList = GetAccountBackupList;
|
|
17657
|
+
/**
|
|
17658
|
+
* Returns account database dump and NSX backup files with storage metadata.
|
|
17659
|
+
*/
|
|
17660
|
+
function GetAccountBackupFilesList(params) {
|
|
17661
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17662
|
+
let { api, req: reqParams } = params !== null && params !== void 0 ? params : {};
|
|
17663
|
+
if (!api) {
|
|
17664
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
17665
|
+
}
|
|
17666
|
+
return api.GET("account/backupFilesList", exports.Api.PrepReqParams(reqParams));
|
|
17667
|
+
});
|
|
17668
|
+
}
|
|
17669
|
+
ExportNsx.GetAccountBackupFilesList = GetAccountBackupFilesList;
|
|
17670
|
+
/**
|
|
17671
|
+
* Deletes selected account database dump and NSX backup files.
|
|
17672
|
+
*/
|
|
17673
|
+
function DeleteAccountBackupFiles(params) {
|
|
17674
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17675
|
+
let { api, fileNames, req: reqParams } = params;
|
|
17676
|
+
if (!(fileNames === null || fileNames === void 0 ? void 0 : fileNames.length)) {
|
|
17677
|
+
throw new Error("At least one backup file name is required.");
|
|
17678
|
+
}
|
|
17679
|
+
if (!api) {
|
|
17680
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
17681
|
+
}
|
|
17682
|
+
const data = {
|
|
17683
|
+
Files: fileNames
|
|
17684
|
+
};
|
|
17685
|
+
return api.DELETE("account/backupFiles", exports.Api.PrepReqParams(reqParams), data);
|
|
17686
|
+
});
|
|
17687
|
+
}
|
|
17688
|
+
ExportNsx.DeleteAccountBackupFiles = DeleteAccountBackupFiles;
|
|
17633
17689
|
/**
|
|
17634
17690
|
* Downloads a saved whole-account NSX backup file.
|
|
17635
17691
|
*/
|
|
@@ -18853,6 +18909,8 @@
|
|
|
18853
18909
|
constructor(toolHandler, options = {}) {
|
|
18854
18910
|
this.ws = null;
|
|
18855
18911
|
this.isConnecting = false;
|
|
18912
|
+
this.responseGeneration = 0;
|
|
18913
|
+
this.pendingResponses = [];
|
|
18856
18914
|
this.toolHandler = toolHandler;
|
|
18857
18915
|
this.options = options;
|
|
18858
18916
|
this.currentAuth = options.auth;
|
|
@@ -18863,7 +18921,7 @@
|
|
|
18863
18921
|
connect(auth) {
|
|
18864
18922
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
18865
18923
|
if (auth) {
|
|
18866
|
-
this.
|
|
18924
|
+
this.setAuth(auth);
|
|
18867
18925
|
}
|
|
18868
18926
|
if (this.isConnecting || ((_a = this.ws) === null || _a === void 0 ? void 0 : _a.readyState) === WebSocket.OPEN) {
|
|
18869
18927
|
(_c = (_b = this.logger()).debug) === null || _c === void 0 ? void 0 : _c.call(_b, "[NavigatorMcpWS] Connection already active or in-flight; skipping connect.");
|
|
@@ -18874,24 +18932,34 @@
|
|
|
18874
18932
|
const url = this.buildUrl();
|
|
18875
18933
|
(_e = (_d = this.logger()).log) === null || _e === void 0 ? void 0 : _e.call(_d, "[NavigatorMcpWS] Connecting to", url);
|
|
18876
18934
|
this.ws = new WebSocket(url);
|
|
18935
|
+
const socket = this.ws;
|
|
18877
18936
|
this.ws.onopen = (event) => {
|
|
18878
18937
|
var _a, _b, _c, _d;
|
|
18938
|
+
if (this.ws !== socket)
|
|
18939
|
+
return;
|
|
18879
18940
|
(_b = (_a = this.logger()).log) === null || _b === void 0 ? void 0 : _b.call(_a, "[NavigatorMcpWS] Connected");
|
|
18880
18941
|
this.isConnecting = false;
|
|
18881
18942
|
this.send({ method: "server_ready" });
|
|
18943
|
+
this.flushResponses();
|
|
18882
18944
|
(_d = (_c = this.options).onOpen) === null || _d === void 0 ? void 0 : _d.call(_c, event);
|
|
18883
18945
|
};
|
|
18884
18946
|
this.ws.onmessage = (event) => {
|
|
18947
|
+
if (this.ws !== socket)
|
|
18948
|
+
return;
|
|
18885
18949
|
this.handleMessage(event.data);
|
|
18886
18950
|
};
|
|
18887
18951
|
this.ws.onerror = (event) => {
|
|
18888
18952
|
var _a, _b, _c, _d;
|
|
18953
|
+
if (this.ws !== socket)
|
|
18954
|
+
return;
|
|
18889
18955
|
(_b = (_a = this.logger()).error) === null || _b === void 0 ? void 0 : _b.call(_a, "[NavigatorMcpWS] Error", event);
|
|
18890
18956
|
(_d = (_c = this.options).onError) === null || _d === void 0 ? void 0 : _d.call(_c, event);
|
|
18891
18957
|
this.isConnecting = false;
|
|
18892
18958
|
};
|
|
18893
18959
|
this.ws.onclose = (event) => {
|
|
18894
18960
|
var _a, _b, _c, _d;
|
|
18961
|
+
if (this.ws !== socket)
|
|
18962
|
+
return;
|
|
18895
18963
|
(_b = (_a = this.logger()).log) === null || _b === void 0 ? void 0 : _b.call(_a, "[NavigatorMcpWS] Disconnected");
|
|
18896
18964
|
this.ws = null;
|
|
18897
18965
|
this.isConnecting = false;
|
|
@@ -18905,6 +18973,9 @@
|
|
|
18905
18973
|
}
|
|
18906
18974
|
disconnect() {
|
|
18907
18975
|
var _a, _b;
|
|
18976
|
+
// An explicit disconnect ends the logical session; never replay its results.
|
|
18977
|
+
this.responseGeneration++;
|
|
18978
|
+
this.pendingResponses = [];
|
|
18908
18979
|
if (this.ws) {
|
|
18909
18980
|
(_b = (_a = this.logger()).debug) === null || _b === void 0 ? void 0 : _b.call(_a, "[NavigatorMcpWS] Closing connection");
|
|
18910
18981
|
this.ws.close();
|
|
@@ -18921,6 +18992,16 @@
|
|
|
18921
18992
|
* Call connect() afterwards to establish a connection with the new auth.
|
|
18922
18993
|
*/
|
|
18923
18994
|
setAuth(auth) {
|
|
18995
|
+
const key = (value) => JSON.stringify([
|
|
18996
|
+
value === null || value === void 0 ? void 0 : value.accountId,
|
|
18997
|
+
value === null || value === void 0 ? void 0 : value.sessionId,
|
|
18998
|
+
value === null || value === void 0 ? void 0 : value.fingerprint,
|
|
18999
|
+
value === null || value === void 0 ? void 0 : value.apiBaseUrl
|
|
19000
|
+
]);
|
|
19001
|
+
if (key(auth) !== key(this.currentAuth)) {
|
|
19002
|
+
this.responseGeneration++;
|
|
19003
|
+
this.pendingResponses = [];
|
|
19004
|
+
}
|
|
18924
19005
|
this.currentAuth = auth;
|
|
18925
19006
|
}
|
|
18926
19007
|
sendChatEvent(event) {
|
|
@@ -18965,7 +19046,7 @@
|
|
|
18965
19046
|
return urlInstance.toString();
|
|
18966
19047
|
}
|
|
18967
19048
|
handleMessage(raw) {
|
|
18968
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
19049
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
18969
19050
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18970
19051
|
try {
|
|
18971
19052
|
const message = typeof raw === "string" ? JSON.parse(raw) : raw;
|
|
@@ -18987,6 +19068,7 @@
|
|
|
18987
19068
|
return;
|
|
18988
19069
|
}
|
|
18989
19070
|
let result;
|
|
19071
|
+
const generation = this.responseGeneration;
|
|
18990
19072
|
try {
|
|
18991
19073
|
result = yield this.toolHandler({
|
|
18992
19074
|
name: toolName,
|
|
@@ -18998,23 +19080,62 @@
|
|
|
18998
19080
|
(_l = (_k = this.logger()).error) === null || _l === void 0 ? void 0 : _l.call(_k, "[NavigatorMcpWS] Tool handler threw", error);
|
|
18999
19081
|
result = `Error: ${error instanceof Error ? error.message : String(error)}`;
|
|
19000
19082
|
}
|
|
19001
|
-
this.
|
|
19083
|
+
if (generation !== this.responseGeneration) {
|
|
19084
|
+
(_o = (_m = this.logger()).warn) === null || _o === void 0 ? void 0 : _o.call(_m, "[NavigatorMcpWS] Discarding result from a previous session", messageId);
|
|
19085
|
+
return;
|
|
19086
|
+
}
|
|
19087
|
+
this.sendResponse({
|
|
19002
19088
|
method: "tool_response",
|
|
19003
19089
|
id: messageId,
|
|
19004
19090
|
result
|
|
19005
19091
|
});
|
|
19006
19092
|
}
|
|
19007
19093
|
catch (error) {
|
|
19008
|
-
(
|
|
19094
|
+
(_q = (_p = this.logger()).error) === null || _q === void 0 ? void 0 : _q.call(_p, "[NavigatorMcpWS] Invalid message", error);
|
|
19009
19095
|
}
|
|
19010
19096
|
});
|
|
19011
19097
|
}
|
|
19098
|
+
sendResponse(message) {
|
|
19099
|
+
var _a, _b, _c, _d, _e;
|
|
19100
|
+
if (this.send(message))
|
|
19101
|
+
return;
|
|
19102
|
+
this.pendingResponses = this.pendingResponses.filter((entry) => entry.expiresAt > Date.now());
|
|
19103
|
+
if (this.pendingResponses.length >= NavigatorMcpWebSocketClient.MAX_PENDING_RESPONSES) {
|
|
19104
|
+
const dropped = this.pendingResponses.shift();
|
|
19105
|
+
(_b = (_a = this.logger()).warn) === null || _b === void 0 ? void 0 : _b.call(_a, "[NavigatorMcpWS] Response queue full; dropping oldest result", (_c = dropped === null || dropped === void 0 ? void 0 : dropped.message) === null || _c === void 0 ? void 0 : _c.id);
|
|
19106
|
+
}
|
|
19107
|
+
this.pendingResponses.push({ message, expiresAt: Date.now() + NavigatorMcpWebSocketClient.RESPONSE_TTL_MS });
|
|
19108
|
+
(_e = (_d = this.logger()).warn) === null || _e === void 0 ? void 0 : _e.call(_d, "[NavigatorMcpWS] Tool result queued until reconnect", message.id);
|
|
19109
|
+
}
|
|
19110
|
+
flushResponses() {
|
|
19111
|
+
var _a, _b;
|
|
19112
|
+
const pending = this.pendingResponses;
|
|
19113
|
+
this.pendingResponses = [];
|
|
19114
|
+
for (const entry of pending) {
|
|
19115
|
+
if (entry.expiresAt <= Date.now()) {
|
|
19116
|
+
(_b = (_a = this.logger()).warn) === null || _b === void 0 ? void 0 : _b.call(_a, "[NavigatorMcpWS] Tool result expired before reconnect", entry.message.id);
|
|
19117
|
+
}
|
|
19118
|
+
else if (!this.send(entry.message)) {
|
|
19119
|
+
this.pendingResponses.push(entry);
|
|
19120
|
+
}
|
|
19121
|
+
}
|
|
19122
|
+
}
|
|
19012
19123
|
send(message) {
|
|
19013
|
-
|
|
19124
|
+
var _a, _b;
|
|
19125
|
+
if (!this.ws || this.ws.readyState !== WebSocket.OPEN)
|
|
19126
|
+
return false;
|
|
19127
|
+
try {
|
|
19014
19128
|
this.ws.send(JSON.stringify(message));
|
|
19129
|
+
return true;
|
|
19130
|
+
}
|
|
19131
|
+
catch (error) {
|
|
19132
|
+
(_b = (_a = this.logger()).error) === null || _b === void 0 ? void 0 : _b.call(_a, "[NavigatorMcpWS] Send failed", error);
|
|
19133
|
+
return false;
|
|
19015
19134
|
}
|
|
19016
19135
|
}
|
|
19017
19136
|
}
|
|
19137
|
+
NavigatorMcpWebSocketClient.RESPONSE_TTL_MS = 60000;
|
|
19138
|
+
NavigatorMcpWebSocketClient.MAX_PENDING_RESPONSES = 32;
|
|
19018
19139
|
|
|
19019
19140
|
(function (Plugin) {
|
|
19020
19141
|
/**
|
|
@@ -24303,7 +24424,7 @@
|
|
|
24303
24424
|
}
|
|
24304
24425
|
|
|
24305
24426
|
// This is updated with the package.json version on build.
|
|
24306
|
-
const VERSION = "7.1.
|
|
24427
|
+
const VERSION = "7.1.108";
|
|
24307
24428
|
|
|
24308
24429
|
exports.VERSION = VERSION;
|
|
24309
24430
|
exports.AbstractApi = AbstractApi;
|