x402-surface-check 0.2.29 → 0.2.30
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/bin/x402-surface-check.mjs +19 -1
- package/package.json +1 -1
|
@@ -419,9 +419,27 @@ function endpointEntries(document, sourceUrl, limit) {
|
|
|
419
419
|
if (!Array.isArray(document.endpoints) && document.endpoints && typeof document.endpoints === 'object') {
|
|
420
420
|
endpointMaps.push(document.endpoints)
|
|
421
421
|
}
|
|
422
|
-
if (document.tools && typeof document.tools === 'object') {
|
|
422
|
+
if (document.tools && typeof document.tools === 'object' && !Array.isArray(document.tools)) {
|
|
423
423
|
endpointMaps.push(document.tools)
|
|
424
424
|
}
|
|
425
|
+
if (Array.isArray(document.tools)) {
|
|
426
|
+
for (const tool of document.tools) {
|
|
427
|
+
if (!tool || typeof tool !== 'object') continue
|
|
428
|
+
const rawPath = tool.url ?? tool.endpoint ?? tool.path
|
|
429
|
+
if (!rawPath) continue
|
|
430
|
+
const method = String(tool.method ?? 'POST').toUpperCase()
|
|
431
|
+
const paymentSignal = manifestEndpointPaymentSignal(tool)
|
|
432
|
+
const hasPathParameters = /\{[^}]+\}/.test(String(rawPath))
|
|
433
|
+
if (paymentSignal === 0 && (method !== 'GET' || hasPathParameters)) continue
|
|
434
|
+
entries.push({
|
|
435
|
+
name: tool.id ?? tool.name ?? String(rawPath).split('/').filter(Boolean).at(-1) ?? String(rawPath),
|
|
436
|
+
url: manifestEndpointUrl(rawPath, tool, baseUrl, sourceUrl),
|
|
437
|
+
method,
|
|
438
|
+
requestBody: manifestEndpointBody(tool, document),
|
|
439
|
+
publicDiscovery: paymentSignal === 0,
|
|
440
|
+
})
|
|
441
|
+
}
|
|
442
|
+
}
|
|
425
443
|
for (const endpointMap of endpointMaps) {
|
|
426
444
|
for (const [key, endpoint] of Object.entries(endpointMap)) {
|
|
427
445
|
if (typeof endpoint === 'string') {
|