@xyo-network/xl1-rpc 1.26.49 → 1.27.0
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/neutral/index.mjs +4 -5
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/transport/HttpRpcTransport.d.ts.map +1 -1
- package/dist/node/index-node.mjs +4 -5
- package/dist/node/index-node.mjs.map +1 -1
- package/dist/node/transport/HttpRpcTransport.d.ts.map +1 -1
- package/package.json +20 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpRpcTransport.d.ts","sourceRoot":"","sources":["../../../src/transport/HttpRpcTransport.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HttpRpcTransport.d.ts","sourceRoot":"","sources":["../../../src/transport/HttpRpcTransport.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,uCAAuC;AACvC,qBAAa,gBAAgB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IAC7F,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;IACxC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAClC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA;gBAElB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,UAAQ;IAMrD,WAAW,CACf,OAAO,SAAS,MAAM,CAAC,EAEvB,MAAM,EAAE,OAAO,EACf,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,GAC3C,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YAIpC,OAAO;CAqDtB"}
|
package/dist/node/index-node.mjs
CHANGED
|
@@ -1558,13 +1558,12 @@ import {
|
|
|
1558
1558
|
} from "@xyo-network/xl1-protocol-sdk";
|
|
1559
1559
|
|
|
1560
1560
|
// src/transport/HttpRpcTransport.ts
|
|
1561
|
+
import { FetchClientError, FetchJsonClient } from "@xylabs/fetch";
|
|
1561
1562
|
import {
|
|
1562
|
-
axiosJsonConfig,
|
|
1563
1563
|
isDefined,
|
|
1564
1564
|
isError,
|
|
1565
1565
|
isUndefinedOrNull
|
|
1566
1566
|
} from "@xylabs/sdk-js";
|
|
1567
|
-
import { Axios, isAxiosError } from "axios";
|
|
1568
1567
|
import { v4 } from "uuid";
|
|
1569
1568
|
import { z as z24 } from "zod";
|
|
1570
1569
|
var HttpRpcTransport = class {
|
|
@@ -1595,7 +1594,7 @@ var HttpRpcTransport = class {
|
|
|
1595
1594
|
}
|
|
1596
1595
|
}
|
|
1597
1596
|
body.params ??= [];
|
|
1598
|
-
const res = await new
|
|
1597
|
+
const res = await new FetchJsonClient().post(url, body);
|
|
1599
1598
|
const json = res.data;
|
|
1600
1599
|
if (isUndefinedOrNull(json)) {
|
|
1601
1600
|
throw new Error(`[callRpc] empty response body (status ${res.status})`);
|
|
@@ -1607,8 +1606,8 @@ var HttpRpcTransport = class {
|
|
|
1607
1606
|
return result;
|
|
1608
1607
|
} catch (ex) {
|
|
1609
1608
|
let message = isError(ex) ? ex.message : String(ex);
|
|
1610
|
-
if (
|
|
1611
|
-
message = `Http error occurred [${ex.status}
|
|
1609
|
+
if (ex instanceof FetchClientError) {
|
|
1610
|
+
message = `Http error occurred [${ex.response.status}]: ${ex.message}`;
|
|
1612
1611
|
}
|
|
1613
1612
|
throw new Error(`Error occurred while calling RPC method ${String(method)}: ${message}`, { cause: ex });
|
|
1614
1613
|
}
|