@minia2a/x402-check 0.1.1 → 0.1.3
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 +10 -4
- package/cli.js +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,14 +29,20 @@ allowed to call.
|
|
|
29
29
|
|
|
30
30
|
## Usage
|
|
31
31
|
|
|
32
|
+
The package is scoped, so the one-shot invocation names the scope:
|
|
33
|
+
|
|
32
34
|
```bash
|
|
33
|
-
npx x402-check https://minia2a.uk/x402/x402-format-bytes
|
|
34
|
-
npx x402-check https://example.com/paid/api --json
|
|
35
|
-
npx x402-check "$URL" --max-price 0.05 --header "authorization: Bearer $TOKEN"
|
|
35
|
+
npx @minia2a/x402-check https://minia2a.uk/x402/x402-format-bytes
|
|
36
|
+
npx @minia2a/x402-check https://example.com/paid/api --json
|
|
37
|
+
npx @minia2a/x402-check "$URL" --max-price 0.05 --header "authorization: Bearer $TOKEN"
|
|
36
38
|
```
|
|
37
39
|
|
|
40
|
+
After `npm i -g @minia2a/x402-check` (or a local install) the command is simply
|
|
41
|
+
`x402-check`. The bare name is not a package on npm: `npx x402-check` fails with
|
|
42
|
+
`E404`.
|
|
43
|
+
|
|
38
44
|
```
|
|
39
|
-
x402-check 0.1.
|
|
45
|
+
x402-check 0.1.2 https://minia2a.uk/x402/x402-format-bytes
|
|
40
46
|
status 402 verdict PASS (0 fail, 0 warn, 2 info)
|
|
41
47
|
INFO static-offer two requests 1.2s apart return an identical offer ...
|
|
42
48
|
INFO unpaired-examples output.example is advertised without answerBasis ...
|
package/cli.js
CHANGED
|
@@ -140,8 +140,11 @@ function checkDiscovery(doc) {
|
|
|
140
140
|
else {
|
|
141
141
|
if (!input.method) add('WARN', 'no-method', 'info.input.method is missing');
|
|
142
142
|
const params = input.queryParams || input.body;
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
const required = Array.isArray(input.schema && input.schema.required) ? input.schema.required : [];
|
|
144
|
+
if ((!params || (typeof params === 'object' && Object.keys(params).length === 0)) && required.length === 0) {
|
|
145
|
+
// A service that takes no input legitimately has no example params. From
|
|
146
|
+
// outside we cannot tell that apart from an omitted example, so say so.
|
|
147
|
+
add('INFO', 'no-example-params', 'info.input carries no example params (fine if the service takes no input)');
|
|
145
148
|
}
|
|
146
149
|
if (input.schema && Array.isArray(input.schema.required) && params && typeof params === 'object') {
|
|
147
150
|
const missing = input.schema.required.filter(k => !(k in params));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minia2a/x402-check",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Inspect a live x402 endpoint before you pay it: challenge shape, door parity, EIP-712 domain, discovery examples, and the $1 client-cap trap.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"x402-check": "cli.js"
|