@automattic/mcp-wordpress-remote 0.3.0 → 0.3.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/lib.js CHANGED
@@ -38006,8 +38006,9 @@ var globalSessionId = null;
38006
38006
  var lastInitializeRequest = null;
38007
38007
  var sessionRefreshPromise = null;
38008
38008
  var WP_MCP_ENDPOINT = "/wp/v2/wpmcp";
38009
- var INVALID_SESSION_ERROR_CODE = -32602;
38009
+ var INVALID_SESSION_ERROR_CODES = /* @__PURE__ */ new Set([-32602, -32005]);
38010
38010
  var INVALID_SESSION_ERROR_MESSAGE = "Invalid or expired session";
38011
+ var SESSION_NOT_FOUND_ERROR_MESSAGE = "Session not found";
38011
38012
  function validateEnvironment() {
38012
38013
  const validation = validateConfig();
38013
38014
  if (!validation.isValid) {
@@ -38157,7 +38158,10 @@ function parseApiErrorResponse(error) {
38157
38158
  }
38158
38159
  function isInvalidSessionError(error) {
38159
38160
  const errorResponse = parseApiErrorResponse(error);
38160
- return errorResponse?.code === INVALID_SESSION_ERROR_CODE && errorResponse?.message === INVALID_SESSION_ERROR_MESSAGE;
38161
+ const jsonRpcError = errorResponse?.error && typeof errorResponse.error === "object" ? errorResponse.error : errorResponse;
38162
+ const code = typeof jsonRpcError?.code === "number" ? jsonRpcError.code : null;
38163
+ const message = typeof jsonRpcError?.message === "string" ? jsonRpcError.message : "";
38164
+ return code !== null && INVALID_SESSION_ERROR_CODES.has(code) && (message === INVALID_SESSION_ERROR_MESSAGE || message.includes(SESSION_NOT_FOUND_ERROR_MESSAGE) || message.includes(INVALID_SESSION_ERROR_MESSAGE));
38161
38165
  }
38162
38166
  function updateSessionId(sessionId) {
38163
38167
  if (globalSessionId === sessionId) {
package/dist/proxy.js CHANGED
@@ -38631,8 +38631,9 @@ var globalSessionId = null;
38631
38631
  var lastInitializeRequest = null;
38632
38632
  var sessionRefreshPromise = null;
38633
38633
  var WP_MCP_ENDPOINT = "/wp/v2/wpmcp";
38634
- var INVALID_SESSION_ERROR_CODE = -32602;
38634
+ var INVALID_SESSION_ERROR_CODES = /* @__PURE__ */ new Set([-32602, -32005]);
38635
38635
  var INVALID_SESSION_ERROR_MESSAGE = "Invalid or expired session";
38636
+ var SESSION_NOT_FOUND_ERROR_MESSAGE = "Session not found";
38636
38637
  function validateEnvironment() {
38637
38638
  const validation = validateConfig();
38638
38639
  if (!validation.isValid) {
@@ -38785,7 +38786,10 @@ function parseApiErrorResponse(error) {
38785
38786
  }
38786
38787
  function isInvalidSessionError(error) {
38787
38788
  const errorResponse = parseApiErrorResponse(error);
38788
- return errorResponse?.code === INVALID_SESSION_ERROR_CODE && errorResponse?.message === INVALID_SESSION_ERROR_MESSAGE;
38789
+ const jsonRpcError = errorResponse?.error && typeof errorResponse.error === "object" ? errorResponse.error : errorResponse;
38790
+ const code = typeof jsonRpcError?.code === "number" ? jsonRpcError.code : null;
38791
+ const message = typeof jsonRpcError?.message === "string" ? jsonRpcError.message : "";
38792
+ return code !== null && INVALID_SESSION_ERROR_CODES.has(code) && (message === INVALID_SESSION_ERROR_MESSAGE || message.includes(SESSION_NOT_FOUND_ERROR_MESSAGE) || message.includes(INVALID_SESSION_ERROR_MESSAGE));
38789
38793
  }
38790
38794
  function updateSessionId(sessionId) {
38791
38795
  if (globalSessionId === sessionId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/mcp-wordpress-remote",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "MCP WordPress Remote proxy server",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"