@wix/mcp 1.0.17 → 1.0.19
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/build/bin-standalone.js +39 -29
- package/build/bin-standalone.js.map +3 -3
- package/build/cjs/index.cjs +41 -29
- package/build/cjs/index.cjs.map +4 -4
- package/build/dts/api-call/index.d.ts.map +1 -1
- package/build/dts/api-call/index.js +8 -2
- package/build/dts/api-call/index.js.map +1 -1
- package/build/dts/docs/docs.d.ts.map +1 -1
- package/build/dts/docs/docs.js +0 -2
- package/build/dts/docs/docs.js.map +1 -1
- package/build/dts/tool-utils.js +1 -1
- package/build/dts/tool-utils.js.map +1 -1
- package/build/dts/tool-utils.spec.js +1 -3
- package/build/dts/tool-utils.spec.js.map +1 -1
- package/build/esm/index.js +14 -5
- package/build/esm/index.js.map +3 -3
- package/package.json +3 -3
package/build/bin-standalone.js
CHANGED
|
@@ -4588,7 +4588,7 @@ var require_error = __commonJS({
|
|
|
4588
4588
|
"toJSON",
|
|
4589
4589
|
"__CANCEL__"
|
|
4590
4590
|
];
|
|
4591
|
-
var
|
|
4591
|
+
var HttpError2 = class _HttpError extends Error {
|
|
4592
4592
|
constructor(error) {
|
|
4593
4593
|
super(error.message);
|
|
4594
4594
|
this.isWixHttpError = true;
|
|
@@ -4601,9 +4601,9 @@ var require_error = __commonJS({
|
|
|
4601
4601
|
return (0, headers_1.requestIdOrEmptyString)(this.response);
|
|
4602
4602
|
}
|
|
4603
4603
|
};
|
|
4604
|
-
exports.HttpError =
|
|
4604
|
+
exports.HttpError = HttpError2;
|
|
4605
4605
|
function createHttpError(...args) {
|
|
4606
|
-
return new
|
|
4606
|
+
return new HttpError2(...args);
|
|
4607
4607
|
}
|
|
4608
4608
|
exports.createHttpError = createHttpError;
|
|
4609
4609
|
}
|
|
@@ -7565,7 +7565,7 @@ var require_http_client = __commonJS({
|
|
|
7565
7565
|
var headers_1 = require_headers();
|
|
7566
7566
|
var options_1 = require_options();
|
|
7567
7567
|
var utils_1 = require_utils4();
|
|
7568
|
-
var
|
|
7568
|
+
var HttpClient3 = class {
|
|
7569
7569
|
constructor(opts = {}) {
|
|
7570
7570
|
this.opts = opts;
|
|
7571
7571
|
this.opts = defaultClientOptions(this.opts);
|
|
@@ -7697,9 +7697,9 @@ var require_http_client = __commonJS({
|
|
|
7697
7697
|
});
|
|
7698
7698
|
}
|
|
7699
7699
|
};
|
|
7700
|
-
exports.HttpClient =
|
|
7701
|
-
|
|
7702
|
-
|
|
7700
|
+
exports.HttpClient = HttpClient3;
|
|
7701
|
+
HttpClient3.CancelToken = axios_1.default.CancelToken;
|
|
7702
|
+
HttpClient3.isCancel = axios_1.default.isCancel;
|
|
7703
7703
|
function defaultClientOptions(opts) {
|
|
7704
7704
|
let adapter = opts.adapter;
|
|
7705
7705
|
if (!adapter) {
|
|
@@ -7769,7 +7769,7 @@ var require_http_client = __commonJS({
|
|
|
7769
7769
|
}
|
|
7770
7770
|
}
|
|
7771
7771
|
function createHttpClient(...args) {
|
|
7772
|
-
return new
|
|
7772
|
+
return new HttpClient3(...args);
|
|
7773
7773
|
}
|
|
7774
7774
|
exports.createHttpClient = createHttpClient;
|
|
7775
7775
|
}
|
|
@@ -9537,7 +9537,7 @@ var require_error2 = __commonJS({
|
|
|
9537
9537
|
"toJSON",
|
|
9538
9538
|
"__CANCEL__"
|
|
9539
9539
|
];
|
|
9540
|
-
var
|
|
9540
|
+
var HttpError2 = class _HttpError extends Error {
|
|
9541
9541
|
constructor(error) {
|
|
9542
9542
|
super(error.message);
|
|
9543
9543
|
this.isWixHttpError = true;
|
|
@@ -9550,9 +9550,9 @@ var require_error2 = __commonJS({
|
|
|
9550
9550
|
return (0, headers_1.requestIdOrEmptyString)(this.response);
|
|
9551
9551
|
}
|
|
9552
9552
|
};
|
|
9553
|
-
exports.HttpError =
|
|
9553
|
+
exports.HttpError = HttpError2;
|
|
9554
9554
|
function createHttpError(...args) {
|
|
9555
|
-
return new
|
|
9555
|
+
return new HttpError2(...args);
|
|
9556
9556
|
}
|
|
9557
9557
|
exports.createHttpError = createHttpError;
|
|
9558
9558
|
}
|
|
@@ -11241,7 +11241,7 @@ var require_http_client2 = __commonJS({
|
|
|
11241
11241
|
var headers_1 = require_headers2();
|
|
11242
11242
|
var options_1 = require_options2();
|
|
11243
11243
|
var utils_1 = require_utils7();
|
|
11244
|
-
var
|
|
11244
|
+
var HttpClient3 = class {
|
|
11245
11245
|
constructor(opts = {}) {
|
|
11246
11246
|
this.opts = opts;
|
|
11247
11247
|
this.opts = defaultClientOptions(this.opts);
|
|
@@ -11373,9 +11373,9 @@ var require_http_client2 = __commonJS({
|
|
|
11373
11373
|
});
|
|
11374
11374
|
}
|
|
11375
11375
|
};
|
|
11376
|
-
exports.HttpClient =
|
|
11377
|
-
|
|
11378
|
-
|
|
11376
|
+
exports.HttpClient = HttpClient3;
|
|
11377
|
+
HttpClient3.CancelToken = axios_1.default.CancelToken;
|
|
11378
|
+
HttpClient3.isCancel = axios_1.default.isCancel;
|
|
11379
11379
|
function defaultClientOptions(opts) {
|
|
11380
11380
|
let adapter = opts.adapter;
|
|
11381
11381
|
if (!adapter) {
|
|
@@ -11445,7 +11445,7 @@ var require_http_client2 = __commonJS({
|
|
|
11445
11445
|
}
|
|
11446
11446
|
}
|
|
11447
11447
|
function createHttpClient(...args) {
|
|
11448
|
-
return new
|
|
11448
|
+
return new HttpClient3(...args);
|
|
11449
11449
|
}
|
|
11450
11450
|
exports.createHttpClient = createHttpClient;
|
|
11451
11451
|
}
|
|
@@ -12181,22 +12181,26 @@ var require_error3 = __commonJS({
|
|
|
12181
12181
|
"toJSON",
|
|
12182
12182
|
"__CANCEL__"
|
|
12183
12183
|
];
|
|
12184
|
-
var
|
|
12184
|
+
var HttpError2 = class _HttpError extends Error {
|
|
12185
12185
|
constructor(error) {
|
|
12186
|
+
var _a;
|
|
12186
12187
|
super(error.message);
|
|
12187
12188
|
this.isWixHttpError = true;
|
|
12188
12189
|
Object.setPrototypeOf(this, _HttpError.prototype);
|
|
12189
12190
|
exports.axiosErrorFields.forEach((key) => {
|
|
12190
12191
|
this[key] = error[key];
|
|
12191
12192
|
});
|
|
12193
|
+
if ((_a = this.response) === null || _a === void 0 ? void 0 : _a.headers) {
|
|
12194
|
+
this.response.requestId = (0, headers_1.requestIdOrEmptyString)(this.response);
|
|
12195
|
+
}
|
|
12192
12196
|
}
|
|
12193
12197
|
get requestId() {
|
|
12194
12198
|
return (0, headers_1.requestIdOrEmptyString)(this.response);
|
|
12195
12199
|
}
|
|
12196
12200
|
};
|
|
12197
|
-
exports.HttpError =
|
|
12201
|
+
exports.HttpError = HttpError2;
|
|
12198
12202
|
function createHttpError(...args) {
|
|
12199
|
-
return new
|
|
12203
|
+
return new HttpError2(...args);
|
|
12200
12204
|
}
|
|
12201
12205
|
exports.createHttpError = createHttpError;
|
|
12202
12206
|
}
|
|
@@ -14513,7 +14517,7 @@ var require_http_client3 = __commonJS({
|
|
|
14513
14517
|
var headers_1 = require_headers3();
|
|
14514
14518
|
var options_1 = require_options3();
|
|
14515
14519
|
var utils_1 = require_utils10();
|
|
14516
|
-
var
|
|
14520
|
+
var HttpClient3 = class {
|
|
14517
14521
|
constructor(opts = {}) {
|
|
14518
14522
|
this.opts = opts;
|
|
14519
14523
|
this.opts = defaultClientOptions(this.opts);
|
|
@@ -14654,9 +14658,9 @@ var require_http_client3 = __commonJS({
|
|
|
14654
14658
|
});
|
|
14655
14659
|
}
|
|
14656
14660
|
};
|
|
14657
|
-
exports.HttpClient =
|
|
14658
|
-
|
|
14659
|
-
|
|
14661
|
+
exports.HttpClient = HttpClient3;
|
|
14662
|
+
HttpClient3.CancelToken = axios_1.default.CancelToken;
|
|
14663
|
+
HttpClient3.isCancel = axios_1.default.isCancel;
|
|
14660
14664
|
function defaultClientOptions(opts) {
|
|
14661
14665
|
let adapter = opts.adapter;
|
|
14662
14666
|
if (!adapter) {
|
|
@@ -14726,7 +14730,7 @@ var require_http_client3 = __commonJS({
|
|
|
14726
14730
|
}
|
|
14727
14731
|
}
|
|
14728
14732
|
function createHttpClient(...args) {
|
|
14729
|
-
return new
|
|
14733
|
+
return new HttpClient3(...args);
|
|
14730
14734
|
}
|
|
14731
14735
|
exports.createHttpClient = createHttpClient;
|
|
14732
14736
|
}
|
|
@@ -15588,7 +15592,7 @@ var addDocsTools = (server2, allowedTools = [
|
|
|
15588
15592
|
getToKnowWixEnabled ? WixREADME_DEPENDENT_DESCRIPTION : ""
|
|
15589
15593
|
].join("\n"),
|
|
15590
15594
|
{
|
|
15591
|
-
articleUrl: z.string().url().
|
|
15595
|
+
articleUrl: z.string().url().describe(
|
|
15592
15596
|
"The URL of the docs article or method article to fetch. Should be something like https://dev.wix.com/docs/.../.../..."
|
|
15593
15597
|
)
|
|
15594
15598
|
},
|
|
@@ -15639,7 +15643,7 @@ var addDocsTools = (server2, allowedTools = [
|
|
|
15639
15643
|
"This will give you the entire request/response schema with all the fields and their descriptions."
|
|
15640
15644
|
].join("\n"),
|
|
15641
15645
|
{
|
|
15642
|
-
articleUrl: z.string().url().
|
|
15646
|
+
articleUrl: z.string().url().describe(
|
|
15643
15647
|
"The URL of the documentation to fetch. Should be something like https://dev.wix.com/docs/.../.../..."
|
|
15644
15648
|
)
|
|
15645
15649
|
},
|
|
@@ -16049,6 +16053,7 @@ var addDocsResources = async (server2, portals) => {
|
|
|
16049
16053
|
};
|
|
16050
16054
|
|
|
16051
16055
|
// src/api-call/index.ts
|
|
16056
|
+
var import_http_client2 = __toESM(require_index_node3(), 1);
|
|
16052
16057
|
import { z as z3 } from "zod";
|
|
16053
16058
|
|
|
16054
16059
|
// src/tool-utils.ts
|
|
@@ -16075,7 +16080,7 @@ var buildErrorMessage = ({
|
|
|
16075
16080
|
].filter((str) => !!str).join("\n");
|
|
16076
16081
|
};
|
|
16077
16082
|
var handleWixAPIResponse = async (response) => {
|
|
16078
|
-
const requestId = response.headers
|
|
16083
|
+
const requestId = response.headers?.["x-wix-request-id"];
|
|
16079
16084
|
if (!response.status.toString().startsWith("2")) {
|
|
16080
16085
|
const errorMessage = buildErrorMessage({
|
|
16081
16086
|
status: response.status,
|
|
@@ -16183,10 +16188,15 @@ function addApiCallTool(server2, strategy, allowedTools = ["CallWixSiteAPI", "Li
|
|
|
16183
16188
|
]
|
|
16184
16189
|
};
|
|
16185
16190
|
} catch (error) {
|
|
16186
|
-
|
|
16191
|
+
let requestId;
|
|
16192
|
+
if (import_http_client2.HttpClient.isHttpError(error)) {
|
|
16193
|
+
requestId = error.requestId;
|
|
16194
|
+
}
|
|
16195
|
+
const errorMessage = `Failed to call Wix Site API: ${error} Request ID: ${requestId ? `Request ID: ${requestId}` : ""}`;
|
|
16196
|
+
logger.error(errorMessage);
|
|
16187
16197
|
const response = error.response;
|
|
16188
16198
|
if (!response) {
|
|
16189
|
-
throw new Error(
|
|
16199
|
+
throw new Error(errorMessage);
|
|
16190
16200
|
}
|
|
16191
16201
|
return handleWixAPIResponse(response);
|
|
16192
16202
|
}
|