@agentcash/router 1.1.7 → 1.1.9

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/dist/index.cjs CHANGED
@@ -1482,8 +1482,12 @@ async function build402(request, routeEntry, deps, meta, pluginCtx, bodyData) {
1482
1482
  try {
1483
1483
  const { z } = await import("zod");
1484
1484
  const { declareDiscoveryExtension } = await import("@x402/extensions/bazaar");
1485
- const inputSchema = routeEntry.bodySchema ? z.toJSONSchema(routeEntry.bodySchema, { target: "draft-2020-12" }) : routeEntry.querySchema ? z.toJSONSchema(routeEntry.querySchema, { target: "draft-2020-12" }) : void 0;
1486
- const outputSchema = routeEntry.outputSchema ? z.toJSONSchema(routeEntry.outputSchema, { target: "draft-2020-12" }) : void 0;
1485
+ const toJSON = (schema) => z.toJSONSchema(schema, {
1486
+ target: "draft-2020-12",
1487
+ unrepresentable: "any"
1488
+ });
1489
+ const inputSchema = routeEntry.bodySchema ? toJSON(routeEntry.bodySchema) : routeEntry.querySchema ? toJSON(routeEntry.querySchema) : void 0;
1490
+ const outputSchema = routeEntry.outputSchema ? toJSON(routeEntry.outputSchema) : void 0;
1487
1491
  if (inputSchema) {
1488
1492
  const config = {
1489
1493
  bodyType: routeEntry.bodySchema ? "json" : void 0,
@@ -1492,7 +1496,12 @@ async function build402(request, routeEntry, deps, meta, pluginCtx, bodyData) {
1492
1496
  if (outputSchema) config.output = { schema: outputSchema, example: {} };
1493
1497
  extensions = declareDiscoveryExtension(config);
1494
1498
  }
1495
- } catch {
1499
+ } catch (err) {
1500
+ firePluginHook(deps.plugin, "onAlert", pluginCtx, {
1501
+ level: "warn",
1502
+ message: `Bazaar schema generation failed: ${err instanceof Error ? err.message : String(err)}`,
1503
+ route: routeEntry.key
1504
+ });
1496
1505
  }
1497
1506
  if (routeEntry.siwxEnabled) {
1498
1507
  try {
@@ -2252,8 +2261,8 @@ function createRouter(config) {
2252
2261
  };
2253
2262
  let feePayerAccount;
2254
2263
  if (config.mpp.feePayerKey) {
2255
- const { privateKeyToAccount } = await import("viem/accounts");
2256
- feePayerAccount = privateKeyToAccount(config.mpp.feePayerKey);
2264
+ const { Account } = await import("viem/tempo");
2265
+ feePayerAccount = Account.fromSecp256k1(config.mpp.feePayerKey);
2257
2266
  }
2258
2267
  deps.mppx = Mppx.create({
2259
2268
  methods: [
package/dist/index.js CHANGED
@@ -1443,8 +1443,12 @@ async function build402(request, routeEntry, deps, meta, pluginCtx, bodyData) {
1443
1443
  try {
1444
1444
  const { z } = await import("zod");
1445
1445
  const { declareDiscoveryExtension } = await import("@x402/extensions/bazaar");
1446
- const inputSchema = routeEntry.bodySchema ? z.toJSONSchema(routeEntry.bodySchema, { target: "draft-2020-12" }) : routeEntry.querySchema ? z.toJSONSchema(routeEntry.querySchema, { target: "draft-2020-12" }) : void 0;
1447
- const outputSchema = routeEntry.outputSchema ? z.toJSONSchema(routeEntry.outputSchema, { target: "draft-2020-12" }) : void 0;
1446
+ const toJSON = (schema) => z.toJSONSchema(schema, {
1447
+ target: "draft-2020-12",
1448
+ unrepresentable: "any"
1449
+ });
1450
+ const inputSchema = routeEntry.bodySchema ? toJSON(routeEntry.bodySchema) : routeEntry.querySchema ? toJSON(routeEntry.querySchema) : void 0;
1451
+ const outputSchema = routeEntry.outputSchema ? toJSON(routeEntry.outputSchema) : void 0;
1448
1452
  if (inputSchema) {
1449
1453
  const config = {
1450
1454
  bodyType: routeEntry.bodySchema ? "json" : void 0,
@@ -1453,7 +1457,12 @@ async function build402(request, routeEntry, deps, meta, pluginCtx, bodyData) {
1453
1457
  if (outputSchema) config.output = { schema: outputSchema, example: {} };
1454
1458
  extensions = declareDiscoveryExtension(config);
1455
1459
  }
1456
- } catch {
1460
+ } catch (err) {
1461
+ firePluginHook(deps.plugin, "onAlert", pluginCtx, {
1462
+ level: "warn",
1463
+ message: `Bazaar schema generation failed: ${err instanceof Error ? err.message : String(err)}`,
1464
+ route: routeEntry.key
1465
+ });
1457
1466
  }
1458
1467
  if (routeEntry.siwxEnabled) {
1459
1468
  try {
@@ -2213,8 +2222,8 @@ function createRouter(config) {
2213
2222
  };
2214
2223
  let feePayerAccount;
2215
2224
  if (config.mpp.feePayerKey) {
2216
- const { privateKeyToAccount } = await import("viem/accounts");
2217
- feePayerAccount = privateKeyToAccount(config.mpp.feePayerKey);
2225
+ const { Account } = await import("viem/tempo");
2226
+ feePayerAccount = Account.fromSecp256k1(config.mpp.feePayerKey);
2218
2227
  }
2219
2228
  deps.mppx = Mppx.create({
2220
2229
  methods: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentcash/router",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "Unified route builder for Next.js App Router APIs with x402, MPP, SIWX, and API key auth",
5
5
  "type": "module",
6
6
  "exports": {