@gardenfi/utils 2.4.6-beta.1 → 2.4.6-beta.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.
Files changed (105) hide show
  1. package/dist/index100.cjs +1 -1
  2. package/dist/index100.js +2 -2
  3. package/dist/index121.cjs +1 -1
  4. package/dist/index121.js +1 -1
  5. package/dist/index16.cjs +1 -1
  6. package/dist/index16.js +2 -2
  7. package/dist/index18.cjs +1 -1
  8. package/dist/index18.js +2 -2
  9. package/dist/index197.cjs +1 -1
  10. package/dist/index197.js +3 -3
  11. package/dist/index226.cjs +1 -1
  12. package/dist/index226.js +2 -2
  13. package/dist/index229.cjs +1 -1
  14. package/dist/index229.js +2 -2
  15. package/dist/index230.cjs +1 -1
  16. package/dist/index230.js +1 -1
  17. package/dist/index242.cjs +1 -1
  18. package/dist/index242.js +3 -3
  19. package/dist/index26.cjs +1 -1
  20. package/dist/index26.js +2 -2
  21. package/dist/index262.cjs +2 -1
  22. package/dist/index262.js +40 -102
  23. package/dist/index263.cjs +1 -1
  24. package/dist/index263.js +2 -7
  25. package/dist/index264.cjs +1 -1
  26. package/dist/index264.js +5 -224
  27. package/dist/index265.cjs +1 -1
  28. package/dist/index265.js +10 -6
  29. package/dist/index266.cjs +1 -1
  30. package/dist/index266.js +20 -7
  31. package/dist/index267.cjs +1 -1
  32. package/dist/index267.js +8 -26
  33. package/dist/index268.cjs +1 -1
  34. package/dist/index268.js +66 -5
  35. package/dist/index269.cjs +1 -2
  36. package/dist/index269.js +64 -40
  37. package/dist/index270.cjs +1 -1
  38. package/dist/index270.js +187 -2
  39. package/dist/index271.cjs +1 -1
  40. package/dist/index271.js +20 -8
  41. package/dist/index272.cjs +1 -1
  42. package/dist/index272.js +40 -17
  43. package/dist/index273.cjs +1 -1
  44. package/dist/index273.js +76 -8
  45. package/dist/index274.cjs +1 -1
  46. package/dist/index274.js +40 -66
  47. package/dist/index275.cjs +1 -1
  48. package/dist/index275.js +15 -64
  49. package/dist/index276.cjs +1 -1
  50. package/dist/index276.js +12 -185
  51. package/dist/index277.cjs +1 -1
  52. package/dist/index277.js +11 -21
  53. package/dist/index278.cjs +2 -1
  54. package/dist/index278.js +18 -42
  55. package/dist/index279.cjs +1 -1
  56. package/dist/index279.js +13 -75
  57. package/dist/index28.cjs +1 -1
  58. package/dist/index28.js +31 -27
  59. package/dist/index280.cjs +1 -1
  60. package/dist/index280.js +11 -40
  61. package/dist/index281.cjs +1 -1
  62. package/dist/index281.js +6 -16
  63. package/dist/index282.cjs +1 -1
  64. package/dist/index282.js +7 -14
  65. package/dist/index283.cjs +1 -1
  66. package/dist/index283.js +25 -11
  67. package/dist/index284.cjs +1 -2
  68. package/dist/index284.js +19 -18
  69. package/dist/index285.cjs +1 -1
  70. package/dist/index285.js +145 -13
  71. package/dist/index286.cjs +1 -1
  72. package/dist/index286.js +103 -11
  73. package/dist/index287.cjs +1 -1
  74. package/dist/index287.js +6 -19
  75. package/dist/index288.cjs +1 -1
  76. package/dist/index288.js +219 -141
  77. package/dist/index29.cjs +1 -1
  78. package/dist/index29.js +12 -8
  79. package/dist/index293.cjs +1 -1
  80. package/dist/index293.js +2 -2
  81. package/dist/index295.cjs +1 -1
  82. package/dist/index295.js +41 -10
  83. package/dist/index296.cjs +1 -1
  84. package/dist/index296.js +77 -18
  85. package/dist/index297.cjs +1 -1
  86. package/dist/index297.js +2 -43
  87. package/dist/index298.cjs +1 -1
  88. package/dist/index298.js +10 -77
  89. package/dist/index299.cjs +1 -1
  90. package/dist/index299.js +20 -2
  91. package/dist/index30.cjs +1 -1
  92. package/dist/index30.js +27 -31
  93. package/dist/index300.cjs +1 -1
  94. package/dist/index300.js +68 -698
  95. package/dist/index301.cjs +1 -1
  96. package/dist/index301.js +685 -126
  97. package/dist/index302.cjs +1 -1
  98. package/dist/index302.js +124 -186
  99. package/dist/index303.cjs +1 -1
  100. package/dist/index303.js +200 -67
  101. package/dist/index31.cjs +1 -1
  102. package/dist/index31.js +8 -12
  103. package/dist/index55.cjs +1 -1
  104. package/dist/index55.js +1 -1
  105. package/package.json +1 -1
package/dist/index31.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index49.cjs"),n=require("./index57.cjs");function l(e){const{key:t="public",name:i="Public Client"}=e;return c.createClient({...e,key:t,name:i,type:"publicClient"}).extend(n.publicActions)}exports.createPublicClient=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=e=>{try{return JSON.parse(e)}catch{return e}};exports.safeParseJson=r;
package/dist/index31.js CHANGED
@@ -1,14 +1,10 @@
1
- import { createClient as n } from "./index49.js";
2
- import { publicActions as c } from "./index57.js";
3
- function u(t) {
4
- const { key: e = "public", name: i = "Public Client" } = t;
5
- return n({
6
- ...t,
7
- key: e,
8
- name: i,
9
- type: "publicClient"
10
- }).extend(c);
11
- }
1
+ const t = (r) => {
2
+ try {
3
+ return JSON.parse(r);
4
+ } catch {
5
+ return r;
6
+ }
7
+ };
12
8
  export {
13
- u as createPublicClient
9
+ t as safeParseJson
14
10
  };
package/dist/index55.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index52.cjs"),j=require("./index222.cjs"),u=require("./index47.cjs"),l=require("./index283.cjs");function C(s,i={}){return{async request(h){var w;const{body:r,onRequest:o=i.onRequest,onResponse:p=i.onResponse,timeout:d=i.timeout??1e4}=h,f={...i.fetchOptions??{},...h.fetchOptions??{}},{headers:q,method:m,signal:T}=f;try{const t=await j.withTimeout(async({signal:a})=>{const c={...f,body:Array.isArray(r)?u.stringify(r.map(g=>({jsonrpc:"2.0",id:g.id??l.idCache.take(),...g}))):u.stringify({jsonrpc:"2.0",id:r.id??l.idCache.take(),...r}),headers:{"Content-Type":"application/json",...q},method:m||"POST",signal:T||(d>0?a:null)},R=new Request(s,c),y=await(o==null?void 0:o(R,c))??{...c,url:s};return await fetch(y.url??s,y)},{errorInstance:new n.TimeoutError({body:r,url:s}),timeout:d,signal:!0});p&&await p(t);let e;if((w=t.headers.get("Content-Type"))!=null&&w.startsWith("application/json"))e=await t.json();else{e=await t.text();try{e=JSON.parse(e||"{}")}catch(a){if(t.ok)throw a;e={error:e}}}if(!t.ok)throw new n.HttpRequestError({body:r,details:u.stringify(e.error)||t.statusText,headers:t.headers,status:t.status,url:s});return e}catch(t){throw t instanceof n.HttpRequestError||t instanceof n.TimeoutError?t:new n.HttpRequestError({body:r,cause:t,url:s})}}}}exports.getHttpRpcClient=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index52.cjs"),j=require("./index222.cjs"),u=require("./index47.cjs"),l=require("./index277.cjs");function C(s,i={}){return{async request(h){var w;const{body:r,onRequest:o=i.onRequest,onResponse:p=i.onResponse,timeout:d=i.timeout??1e4}=h,f={...i.fetchOptions??{},...h.fetchOptions??{}},{headers:q,method:m,signal:T}=f;try{const t=await j.withTimeout(async({signal:a})=>{const c={...f,body:Array.isArray(r)?u.stringify(r.map(g=>({jsonrpc:"2.0",id:g.id??l.idCache.take(),...g}))):u.stringify({jsonrpc:"2.0",id:r.id??l.idCache.take(),...r}),headers:{"Content-Type":"application/json",...q},method:m||"POST",signal:T||(d>0?a:null)},R=new Request(s,c),y=await(o==null?void 0:o(R,c))??{...c,url:s};return await fetch(y.url??s,y)},{errorInstance:new n.TimeoutError({body:r,url:s}),timeout:d,signal:!0});p&&await p(t);let e;if((w=t.headers.get("Content-Type"))!=null&&w.startsWith("application/json"))e=await t.json();else{e=await t.text();try{e=JSON.parse(e||"{}")}catch(a){if(t.ok)throw a;e={error:e}}}if(!t.ok)throw new n.HttpRequestError({body:r,details:u.stringify(e.error)||t.statusText,headers:t.headers,status:t.status,url:s});return e}catch(t){throw t instanceof n.HttpRequestError||t instanceof n.TimeoutError?t:new n.HttpRequestError({body:r,cause:t,url:s})}}}}exports.getHttpRpcClient=C;
package/dist/index55.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { TimeoutError as g, HttpRequestError as c } from "./index52.js";
2
2
  import { withTimeout as k } from "./index222.js";
3
3
  import { stringify as p } from "./index47.js";
4
- import { idCache as l } from "./index283.js";
4
+ import { idCache as l } from "./index277.js";
5
5
  function H(s, o = {}) {
6
6
  return {
7
7
  async request(h) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/utils",
3
- "version": "2.4.6-beta.1",
3
+ "version": "2.4.6-beta.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "vite build",