@weftlabs/sdk 0.25.0 → 0.26.0

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.
@@ -2,7 +2,6 @@
2
2
  import {
3
3
  SETTLEMENT_OVERRIDES_HEADER,
4
4
  withPrivateCacheControl,
5
- x402HTTPResourceServer,
6
5
  x402ResourceServer
7
6
  } from "@x402/core/server";
8
7
 
@@ -103,7 +102,7 @@ function createFacilitatorClient(config, weftAuthHeaders) {
103
102
  }
104
103
 
105
104
  // package.json
106
- var version = "0.25.0";
105
+ var version = "0.26.0";
107
106
 
108
107
  // src/facilitator/middleware/product.ts
109
108
  var PRODUCT_TYPES = ["api", "agent", "mcp"];
@@ -691,6 +690,7 @@ function resumePaymentResult(resourceServer, resumed, context) {
691
690
  }
692
691
 
693
692
  // src/facilitator/middleware/settlement.ts
693
+ import { x402HTTPResourceServer } from "@x402/core/server";
694
694
  import { decodePaymentResponseHeader } from "@x402/core/http";
695
695
  var CORE_FACILITATOR_UNAVAILABLE = /^Facilitator settle failed \(503\):(?: |$)/;
696
696
  function isFacilitatorUnavailable(errorReason) {
@@ -733,6 +733,17 @@ function serializeResponseBody(response) {
733
733
  }
734
734
  return typeof response.body === "string" ? response.body : String(response.body ?? "");
735
735
  }
736
+ var WeftHTTPResourceServer = class extends x402HTTPResourceServer {
737
+ processSettlement(...args) {
738
+ const request = args[3]?.request;
739
+ const method = request?.method ?? request?.adapter.getMethod();
740
+ if (method) {
741
+ const payload = { ...args[0], httpMethod: method.toUpperCase() };
742
+ args[0] = payload;
743
+ }
744
+ return super.processSettlement(...args);
745
+ }
746
+ };
736
747
 
737
748
  // src/facilitator/middleware/express.ts
738
749
  var UNSAFE_FAILURE_HEADERS = /* @__PURE__ */ new Set([
@@ -857,7 +868,7 @@ function weftPaymentMiddleware(routes, config) {
857
868
  resourceServer.register(network, schemeServer);
858
869
  });
859
870
  }
860
- const httpServer = new x402HTTPResourceServer(
871
+ const httpServer = new WeftHTTPResourceServer(
861
872
  resourceServer,
862
873
  applyProductIdentity(routes, config ?? {})
863
874
  );
@@ -1161,7 +1172,6 @@ function weftPaymentMiddleware(routes, config) {
1161
1172
  import {
1162
1173
  SETTLEMENT_OVERRIDES_HEADER as SETTLEMENT_OVERRIDES_HEADER2,
1163
1174
  withPrivateCacheControl as withPrivateCacheControl2,
1164
- x402HTTPResourceServer as x402HTTPResourceServer2,
1165
1175
  x402ResourceServer as x402ResourceServer2
1166
1176
  } from "@x402/core/server";
1167
1177
  var FACILITATOR_SYNC_RETRY_FLOOR_MS2 = 3e4;
@@ -1280,7 +1290,7 @@ function weftPaymentMiddlewareHono(routes, config) {
1280
1290
  resourceServer.register(network, schemeServer);
1281
1291
  });
1282
1292
  }
1283
- const httpServer = new x402HTTPResourceServer2(
1293
+ const httpServer = new WeftHTTPResourceServer(
1284
1294
  resourceServer,
1285
1295
  applyProductIdentity(routes, config ?? {})
1286
1296
  );