@kentico/management-api-mcp 31.1.1-preview → 31.2.0-preview

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.
Files changed (2) hide show
  1. package/dist/index.js +36 -6
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -4725,6 +4725,7 @@ var require_pattern = __commonJS({
4725
4725
  "use strict";
4726
4726
  Object.defineProperty(exports, "__esModule", { value: true });
4727
4727
  var code_1 = require_code2();
4728
+ var util_1 = require_util();
4728
4729
  var codegen_1 = require_codegen();
4729
4730
  var error2 = {
4730
4731
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
@@ -4737,10 +4738,18 @@ var require_pattern = __commonJS({
4737
4738
  $data: true,
4738
4739
  error: error2,
4739
4740
  code(cxt) {
4740
- const { data, $data, schema, schemaCode, it } = cxt;
4741
+ const { gen, data, $data, schema, schemaCode, it } = cxt;
4741
4742
  const u = it.opts.unicodeRegExp ? "u" : "";
4742
- const regExp = $data ? (0, codegen_1._)`(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema);
4743
- cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
4743
+ if ($data) {
4744
+ const { regExp } = it.opts.code;
4745
+ const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
4746
+ const valid = gen.let("valid");
4747
+ gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
4748
+ cxt.fail$data((0, codegen_1._)`!${valid}`);
4749
+ } else {
4750
+ const regExp = (0, code_1.usePattern)(cxt, schema);
4751
+ cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
4752
+ }
4744
4753
  }
4745
4754
  };
4746
4755
  exports.default = def;
@@ -10614,6 +10623,7 @@ var require_pattern2 = __commonJS({
10614
10623
  "use strict";
10615
10624
  Object.defineProperty(exports, "__esModule", { value: true });
10616
10625
  var code_1 = require_code4();
10626
+ var util_1 = require_util2();
10617
10627
  var codegen_1 = require_codegen2();
10618
10628
  var error2 = {
10619
10629
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
@@ -10626,10 +10636,18 @@ var require_pattern2 = __commonJS({
10626
10636
  $data: true,
10627
10637
  error: error2,
10628
10638
  code(cxt) {
10629
- const { data, $data, schema, schemaCode, it } = cxt;
10639
+ const { gen, data, $data, schema, schemaCode, it } = cxt;
10630
10640
  const u = it.opts.unicodeRegExp ? "u" : "";
10631
- const regExp = $data ? (0, codegen_1._)`(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema);
10632
- cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
10641
+ if ($data) {
10642
+ const { regExp } = it.opts.code;
10643
+ const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
10644
+ const valid = gen.let("valid");
10645
+ gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
10646
+ cxt.fail$data((0, codegen_1._)`!${valid}`);
10647
+ } else {
10648
+ const regExp = (0, code_1.usePattern)(cxt, schema);
10649
+ cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
10650
+ }
10633
10651
  }
10634
10652
  };
10635
10653
  exports.default = def;
@@ -24322,6 +24340,9 @@ var Protocol = class {
24322
24340
  * The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
24323
24341
  */
24324
24342
  async connect(transport2) {
24343
+ if (this._transport) {
24344
+ throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");
24345
+ }
24325
24346
  this._transport = transport2;
24326
24347
  const _onclose = this.transport?.onclose;
24327
24348
  this._transport.onclose = () => {
@@ -24354,6 +24375,10 @@ var Protocol = class {
24354
24375
  this._progressHandlers.clear();
24355
24376
  this._taskProgressTokens.clear();
24356
24377
  this._pendingDebouncedNotifications.clear();
24378
+ for (const controller of this._requestHandlerAbortControllers.values()) {
24379
+ controller.abort();
24380
+ }
24381
+ this._requestHandlerAbortControllers.clear();
24357
24382
  const error2 = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed");
24358
24383
  this._transport = void 0;
24359
24384
  this.onclose?.();
@@ -24404,6 +24429,8 @@ var Protocol = class {
24404
24429
  sessionId: capturedTransport?.sessionId,
24405
24430
  _meta: request.params?._meta,
24406
24431
  sendNotification: async (notification) => {
24432
+ if (abortController.signal.aborted)
24433
+ return;
24407
24434
  const notificationOptions = { relatedRequestId: request.id };
24408
24435
  if (relatedTaskId) {
24409
24436
  notificationOptions.relatedTask = { taskId: relatedTaskId };
@@ -24411,6 +24438,9 @@ var Protocol = class {
24411
24438
  await this.notification(notification, notificationOptions);
24412
24439
  },
24413
24440
  sendRequest: async (r, resultSchema, options) => {
24441
+ if (abortController.signal.aborted) {
24442
+ throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
24443
+ }
24414
24444
  const requestOptions = { ...options, relatedRequestId: request.id };
24415
24445
  if (relatedTaskId && !requestOptions.relatedTask) {
24416
24446
  requestOptions.relatedTask = { taskId: relatedTaskId };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kentico/management-api-mcp",
3
- "version": "31.1.1-preview",
3
+ "version": "31.2.0-preview",
4
4
  "description": "Model Context Protocol server for Xperience by Kentico Management API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,19 +32,19 @@
32
32
  "author": "Kentico",
33
33
  "license": "SEE LICENSE IN LICENSE.txt",
34
34
  "dependencies": {
35
- "@modelcontextprotocol/sdk": "^1.25.2"
35
+ "@modelcontextprotocol/sdk": "^1.26.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@eslint/js": "^9.39.2",
39
- "@modelcontextprotocol/inspector": "^0.18.0",
40
- "@types/node": "22.19.3",
41
- "@typescript-eslint/eslint-plugin": "^8.52.0",
42
- "@typescript-eslint/parser": "^8.52.0",
43
- "esbuild": "^0.27.2",
39
+ "@modelcontextprotocol/inspector": "^0.19.0",
40
+ "@types/node": "22.19.9",
41
+ "@typescript-eslint/eslint-plugin": "^8.54.0",
42
+ "@typescript-eslint/parser": "^8.54.0",
43
+ "esbuild": "^0.27.3",
44
44
  "eslint": "^9.39.2",
45
- "prettier": "^3.7.4",
45
+ "prettier": "^3.8.1",
46
46
  "typescript": "5.9.3",
47
- "typescript-eslint": "^8.52.0",
47
+ "typescript-eslint": "^8.54.0",
48
48
  "clean-pkg-json": "^1.3.0"
49
49
  },
50
50
  "engines": {