@xyz17711/catalog 0.1.1 → 0.1.2

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 CHANGED
@@ -27,10 +27,13 @@ npm install @xyz17711/catalog
27
27
  ```typescript
28
28
  import { Client } from "@xyz17711/catalog";
29
29
 
30
- const client = new Client("https://api.17711.xyz/registry/catalog");
30
+ const client = new Client(); // talks to https://api.17711.xyz/registry/catalog by default
31
31
  // see the Methods table above for every available call and its request/response type
32
32
  ```
33
33
 
34
+ Pass another base URL (self-hosted instance, test server) as the first argument:
35
+ `new Client("https://my-host.example/registry/catalog")`.
36
+
34
37
  ## Paying past the free quota
35
38
 
36
39
  Every gated tool allows a small number of free calls per day; beyond that it returns a 402
@@ -40,7 +43,7 @@ network, and payee address attached:
40
43
  ```typescript
41
44
  import { Client, PaymentRequiredError } from "@xyz17711/catalog";
42
45
 
43
- const client = new Client("https://api.17711.xyz/registry/catalog");
46
+ const client = new Client();
44
47
  try {
45
48
  await client.category(/* ... */);
46
49
  } catch (e) {
@@ -56,7 +59,7 @@ own environment/secrets manager, never a literal string in source code:
56
59
  ```typescript
57
60
  import { Client } from "@xyz17711/catalog";
58
61
 
59
- const client = new Client("https://api.17711.xyz/registry/catalog", {
62
+ const client = new Client({
60
63
  x402PrivateKey: process.env.X402_PRIVATE_KEY,
61
64
  x402ExpectedNetwork: "eip155:8453", // Base mainnet; use eip155:84532 for Base Sepolia testnet
62
65
  x402MaxPaymentUsdc: 0.01, // refuse any single call above this
@@ -75,7 +78,7 @@ with that same key in this process.
75
78
  import { Client } from "@xyz17711/catalog";
76
79
  import { CatalogToolkit } from "@xyz17711/catalog/langchain";
77
80
 
78
- const client = new Client("https://api.17711.xyz/registry/catalog", { /* ...wallet options... */ });
81
+ const client = new Client({ /* ...wallet options... */ });
79
82
  const tools = new CatalogToolkit(client).getTools();
80
83
  ```
81
84
 
package/dist/index.d.ts CHANGED
@@ -59,8 +59,17 @@ export interface CatalogSearchResponse {
59
59
  /** Ranked best-match-first, truncated to the request's own `limit`. */
60
60
  results: CatalogSearchResult[];
61
61
  }
62
+ /** Production base URL of this service; pass another to self-host or test. */
63
+ export declare const DEFAULT_BASE_URL = "https://api.17711.xyz/registry/catalog";
62
64
  /** Typed client for catalog, e.g. `client.category(...)`. */
63
65
  export declare class Client extends BaseClient {
66
+ /**
67
+ * `new Client()` talks to the production service. Pass a base URL to target another
68
+ * instance, and/or wallet options (`new Client({ x402PrivateKey, ... })`) to pay past the
69
+ * free quota automatically.
70
+ */
71
+ constructor(options?: ClientOptions);
72
+ constructor(baseUrl?: string, options?: ClientOptions);
64
73
  /** Lists every registration in one category, paginated (public GET) */
65
74
  category(params: {
66
75
  q: string;
package/dist/index.js CHANGED
@@ -2,8 +2,16 @@
2
2
  * Typed HTTP client and request/response interfaces for catalog.
3
3
  */
4
4
  import { Client as BaseClient } from "@xyz17711/core";
5
+ /** Production base URL of this service; pass another to self-host or test. */
6
+ export const DEFAULT_BASE_URL = "https://api.17711.xyz/registry/catalog";
5
7
  /** Typed client for catalog, e.g. `client.category(...)`. */
6
8
  export class Client extends BaseClient {
9
+ constructor(baseUrlOrOptions, options = {}) {
10
+ const [url, opts] = typeof baseUrlOrOptions === "object"
11
+ ? [DEFAULT_BASE_URL, baseUrlOrOptions]
12
+ : [baseUrlOrOptions ?? DEFAULT_BASE_URL, options];
13
+ super(url, opts);
14
+ }
7
15
  /** Lists every registration in one category, paginated (public GET) */
8
16
  async category(params) {
9
17
  return this.get("/v1/catalog/category", { q: params.q, limit: params.limit, offset: params.offset });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyz17711/catalog",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Typed TypeScript client for the 17711.xyz Catalog API: pay-per-call, settled in USDC via x402.",
5
5
  "license": "MIT",
6
6
  "author": "17711 Services",