@agent-score/commerce 2.6.0 → 2.6.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/README.md +1 -1
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/identity/express.js +1 -1
- package/dist/identity/express.mjs +1 -1
- package/dist/identity/fastify.js +1 -1
- package/dist/identity/fastify.mjs +1 -1
- package/dist/identity/hono.js +1 -1
- package/dist/identity/hono.mjs +1 -1
- package/dist/identity/nextjs.js +1 -1
- package/dist/identity/nextjs.mjs +1 -1
- package/dist/identity/web.js +1 -1
- package/dist/identity/web.mjs +1 -1
- package/dist/index.js +29 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -14
- package/dist/index.mjs.map +1 -1
- package/dist/stripe-multichain/index.js +7 -0
- package/dist/stripe-multichain/index.js.map +1 -1
- package/dist/stripe-multichain/index.mjs +7 -0
- package/dist/stripe-multichain/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -22572,7 +22572,7 @@ function createAgentScoreCore(options) {
|
|
|
22572
22572
|
} = options;
|
|
22573
22573
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
22574
22574
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
22575
|
-
const defaultUa = `@agent-score/commerce@${"2.6.
|
|
22575
|
+
const defaultUa = `@agent-score/commerce@${"2.6.1"}`;
|
|
22576
22576
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
22577
22577
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
22578
22578
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
|
@@ -24546,6 +24546,27 @@ async function dynamicImport(moduleName) {
|
|
|
24546
24546
|
}
|
|
24547
24547
|
}
|
|
24548
24548
|
|
|
24549
|
+
// src/forwarded_proto.ts
|
|
24550
|
+
function applyForwardedProto(url2, forwardedProto) {
|
|
24551
|
+
const proto = typeof forwardedProto === "string" ? forwardedProto.split(",")[0]?.trim() : void 0;
|
|
24552
|
+
if (!proto) return url2;
|
|
24553
|
+
try {
|
|
24554
|
+
const u = new URL(url2);
|
|
24555
|
+
u.protocol = `${proto}:`;
|
|
24556
|
+
return u.toString();
|
|
24557
|
+
} catch {
|
|
24558
|
+
return url2;
|
|
24559
|
+
}
|
|
24560
|
+
}
|
|
24561
|
+
function readForwardedProto(headers) {
|
|
24562
|
+
if (typeof headers.get === "function") {
|
|
24563
|
+
return headers.get("x-forwarded-proto") ?? void 0;
|
|
24564
|
+
}
|
|
24565
|
+
const rec = headers;
|
|
24566
|
+
const raw = rec["x-forwarded-proto"] ?? rec["X-Forwarded-Proto"];
|
|
24567
|
+
return Array.isArray(raw) ? raw[0] : raw;
|
|
24568
|
+
}
|
|
24569
|
+
|
|
24549
24570
|
// src/payment/constants.ts
|
|
24550
24571
|
var STRIPE_MIN_CHARGE_USD = 0.5;
|
|
24551
24572
|
|
|
@@ -26333,17 +26354,7 @@ function validationResponseWeb(input) {
|
|
|
26333
26354
|
return validationResponseHono(input);
|
|
26334
26355
|
}
|
|
26335
26356
|
function resolveResourceUrl(request) {
|
|
26336
|
-
|
|
26337
|
-
const proto = typeof fwd === "string" ? fwd.split(",")[0]?.trim() : void 0;
|
|
26338
|
-
if (proto) {
|
|
26339
|
-
try {
|
|
26340
|
-
const u = new URL(request.url);
|
|
26341
|
-
u.protocol = `${proto}:`;
|
|
26342
|
-
return u.toString();
|
|
26343
|
-
} catch {
|
|
26344
|
-
}
|
|
26345
|
-
}
|
|
26346
|
-
return request.url;
|
|
26357
|
+
return applyForwardedProto(request.url, readForwardedProto(request.headers));
|
|
26347
26358
|
}
|
|
26348
26359
|
function stripContentType(headers) {
|
|
26349
26360
|
const out = {};
|
|
@@ -26939,7 +26950,11 @@ function computeFirstCheckout(opts) {
|
|
|
26939
26950
|
for (const [k, v] of Object.entries(mppChallengeHeaders)) headers.set(k, v);
|
|
26940
26951
|
headers.set(
|
|
26941
26952
|
"PAYMENT-REQUIRED",
|
|
26942
|
-
paymentRequiredHeader2({
|
|
26953
|
+
paymentRequiredHeader2({
|
|
26954
|
+
x402Version: 2,
|
|
26955
|
+
accepts: accepted,
|
|
26956
|
+
resource: { url: applyForwardedProto(req.url, readForwardedProto(req.headers)) }
|
|
26957
|
+
})
|
|
26943
26958
|
);
|
|
26944
26959
|
return new Response(JSON.stringify(body402), { status: 402, headers });
|
|
26945
26960
|
}
|
|
@@ -26998,7 +27013,7 @@ function computeFirstCheckout(opts) {
|
|
|
26998
27013
|
maxTimeoutSeconds: 300
|
|
26999
27014
|
},
|
|
27000
27015
|
resourceMeta: {
|
|
27001
|
-
url: req.url,
|
|
27016
|
+
url: applyForwardedProto(req.url, readForwardedProto(req.headers)),
|
|
27002
27017
|
description: `Agent purchase via x402-exact (${opts.name})`,
|
|
27003
27018
|
mimeType: "application/json"
|
|
27004
27019
|
}
|