@gardenfi/utils 2.4.5-beta.3 → 2.4.6-beta.1

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 (99) hide show
  1. package/dist/index10.cjs +1 -1
  2. package/dist/index10.js +4 -4
  3. package/dist/index100.cjs +1 -1
  4. package/dist/index100.js +2 -2
  5. package/dist/index121.cjs +1 -1
  6. package/dist/index121.js +1 -1
  7. package/dist/index16.cjs +1 -1
  8. package/dist/index16.js +2 -2
  9. package/dist/index18.cjs +1 -1
  10. package/dist/index18.js +2 -2
  11. package/dist/index24.cjs +1 -1
  12. package/dist/index24.js +12 -26
  13. package/dist/index242.cjs +1 -1
  14. package/dist/index242.js +3 -3
  15. package/dist/index25.cjs +1 -1
  16. package/dist/index25.js +58 -8
  17. package/dist/index26.cjs +16 -1
  18. package/dist/index26.js +113 -12
  19. package/dist/index262.cjs +1 -1
  20. package/dist/index262.js +1 -1
  21. package/dist/index266.cjs +1 -1
  22. package/dist/index266.js +2 -2
  23. package/dist/index267.cjs +1 -2
  24. package/dist/index267.js +25 -40
  25. package/dist/index268.cjs +1 -1
  26. package/dist/index268.js +6 -2
  27. package/dist/index269.cjs +2 -1
  28. package/dist/index269.js +41 -5
  29. package/dist/index27.cjs +1 -1
  30. package/dist/index27.js +32 -58
  31. package/dist/index270.cjs +1 -1
  32. package/dist/index270.js +2 -11
  33. package/dist/index271.cjs +1 -1
  34. package/dist/index271.js +9 -18
  35. package/dist/index272.cjs +1 -1
  36. package/dist/index272.js +19 -8
  37. package/dist/index273.cjs +1 -1
  38. package/dist/index273.js +8 -66
  39. package/dist/index274.cjs +1 -1
  40. package/dist/index274.js +65 -64
  41. package/dist/index275.cjs +1 -1
  42. package/dist/index275.js +60 -181
  43. package/dist/index276.cjs +1 -1
  44. package/dist/index276.js +184 -20
  45. package/dist/index277.cjs +1 -1
  46. package/dist/index277.js +21 -41
  47. package/dist/index278.cjs +1 -1
  48. package/dist/index278.js +20 -54
  49. package/dist/index279.cjs +1 -1
  50. package/dist/index279.js +54 -18
  51. package/dist/index28.cjs +1 -16
  52. package/dist/index28.js +24 -111
  53. package/dist/index280.cjs +1 -1
  54. package/dist/index280.js +34 -10
  55. package/dist/index281.cjs +1 -1
  56. package/dist/index281.js +10 -7
  57. package/dist/index282.cjs +1 -1
  58. package/dist/index282.js +13 -12
  59. package/dist/index283.cjs +1 -2
  60. package/dist/index283.js +10 -16
  61. package/dist/index284.cjs +2 -1
  62. package/dist/index284.js +18 -14
  63. package/dist/index285.cjs +1 -1
  64. package/dist/index285.js +14 -11
  65. package/dist/index286.cjs +1 -1
  66. package/dist/index286.js +11 -26
  67. package/dist/index288.cjs +1 -1
  68. package/dist/index288.js +1 -1
  69. package/dist/index29.cjs +1 -1
  70. package/dist/index29.js +7 -31
  71. package/dist/index293.cjs +1 -1
  72. package/dist/index293.js +2 -2
  73. package/dist/index295.cjs +1 -1
  74. package/dist/index295.js +10 -41
  75. package/dist/index296.cjs +1 -1
  76. package/dist/index296.js +18 -77
  77. package/dist/index297.cjs +1 -1
  78. package/dist/index297.js +43 -2
  79. package/dist/index298.cjs +1 -1
  80. package/dist/index298.js +77 -10
  81. package/dist/index299.cjs +1 -1
  82. package/dist/index299.js +2 -20
  83. package/dist/index300.cjs +1 -1
  84. package/dist/index300.js +1 -1
  85. package/dist/index304.cjs +1 -1
  86. package/dist/index304.js +1 -1
  87. package/dist/index307.cjs +1 -1
  88. package/dist/index307.js +1 -1
  89. package/dist/index309.cjs +1 -1
  90. package/dist/index309.js +1 -1
  91. package/dist/index312.cjs +1 -1
  92. package/dist/index312.js +63 -4
  93. package/dist/index313.cjs +1 -1
  94. package/dist/index313.js +40 -59
  95. package/dist/index314.cjs +1 -1
  96. package/dist/index314.js +4 -44
  97. package/dist/index55.cjs +1 -1
  98. package/dist/index55.js +1 -1
  99. package/package.json +1 -1
package/dist/index312.js CHANGED
@@ -1,7 +1,66 @@
1
- import { version as r } from "./index316.js";
2
- function e() {
3
- return r;
1
+ import { BaseError as c } from "./index304.js";
2
+ import { padRight as h } from "./index291.js";
3
+ import { charCodeToBase16 as b, assertSize as g, pad as m } from "./index313.js";
4
+ import { assertSize as p } from "./index306.js";
5
+ const l = /* @__PURE__ */ new TextEncoder();
6
+ function E(e) {
7
+ return e instanceof Uint8Array ? e : typeof e == "string" ? y(e) : z(e);
8
+ }
9
+ function z(e) {
10
+ return e instanceof Uint8Array ? e : new Uint8Array(e);
11
+ }
12
+ function y(e, t = {}) {
13
+ const { size: r } = t;
14
+ let n = e;
15
+ r && (p(e, r), n = h(e, r));
16
+ let i = n.slice(2);
17
+ i.length % 2 && (i = `0${i}`);
18
+ const f = i.length / 2, a = new Uint8Array(f);
19
+ for (let s = 0, o = 0; s < f; s++) {
20
+ const d = b(i.charCodeAt(o++)), u = b(i.charCodeAt(o++));
21
+ if (d === void 0 || u === void 0)
22
+ throw new c(`Invalid byte sequence ("${i[o - 2]}${i[o - 1]}" in "${i}").`);
23
+ a[s] = d * 16 + u;
24
+ }
25
+ return a;
26
+ }
27
+ function C(e, t = {}) {
28
+ const { size: r } = t, n = l.encode(e);
29
+ return typeof r == "number" ? (g(n, r), x(n, r)) : n;
30
+ }
31
+ function x(e, t) {
32
+ return m(e, { dir: "right", size: t });
33
+ }
34
+ function U(e) {
35
+ return e.length;
36
+ }
37
+ class B extends c {
38
+ constructor({ givenSize: t, maxSize: r }) {
39
+ super(`Size cannot exceed \`${r}\` bytes. Given size: \`${t}\` bytes.`), Object.defineProperty(this, "name", {
40
+ enumerable: !0,
41
+ configurable: !0,
42
+ writable: !0,
43
+ value: "Bytes.SizeOverflowError"
44
+ });
45
+ }
46
+ }
47
+ class O extends c {
48
+ constructor({ size: t, targetSize: r, type: n }) {
49
+ super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${r}\`).`), Object.defineProperty(this, "name", {
50
+ enumerable: !0,
51
+ configurable: !0,
52
+ writable: !0,
53
+ value: "Bytes.SizeExceedsPaddingSizeError"
54
+ });
55
+ }
4
56
  }
5
57
  export {
6
- e as getVersion
58
+ O as SizeExceedsPaddingSizeError,
59
+ B as SizeOverflowError,
60
+ E as from,
61
+ z as fromArray,
62
+ y as fromHex,
63
+ C as fromString,
64
+ x as padRight,
65
+ U as size
7
66
  };
package/dist/index313.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index304.cjs"),y=require("./index291.cjs"),s=require("./index314.cjs"),z=require("./index306.cjs"),S=new TextEncoder;function x(e){return e instanceof Uint8Array?e:typeof e=="string"?h(e):g(e)}function g(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function h(e,t={}){const{size:r}=t;let n=e;r&&(z.assertSize(e,r),n=y.padRight(e,r));let i=n.slice(2);i.length%2&&(i=`0${i}`);const d=i.length/2,f=new Uint8Array(d);for(let c=0,o=0;c<d;c++){const u=s.charCodeToBase16(i.charCodeAt(o++)),b=s.charCodeToBase16(i.charCodeAt(o++));if(u===void 0||b===void 0)throw new a.BaseError(`Invalid byte sequence ("${i[o-2]}${i[o-1]}" in "${i}").`);f[c]=u*16+b}return f}function m(e,t={}){const{size:r}=t,n=S.encode(e);return typeof r=="number"?(s.assertSize(n,r),l(n,r)):n}function l(e,t){return s.pad(e,{dir:"right",size:t})}function E(e){return e.length}class p extends a.BaseError{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed \`${r}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}class $ extends a.BaseError{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}}exports.SizeExceedsPaddingSizeError=$;exports.SizeOverflowError=p;exports.from=x;exports.fromArray=g;exports.fromHex=h;exports.fromString=m;exports.padRight=l;exports.size=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index312.cjs");function s(e,t){if(o.size(e)>t)throw new o.SizeOverflowError({givenSize:o.size(e),maxSize:t})}const n={zero:48,nine:57,A:65,F:70,a:97,f:102};function u(e){if(e>=n.zero&&e<=n.nine)return e-n.zero;if(e>=n.A&&e<=n.F)return e-(n.A-10);if(e>=n.a&&e<=n.f)return e-(n.a-10)}function z(e,t={}){const{dir:f,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new o.SizeExceedsPaddingSizeError({size:e.length,targetSize:r,type:"Bytes"});const d=new Uint8Array(r);for(let i=0;i<r;i++){const a=f==="right";d[a?i:r-i-1]=e[a?i:e.length-i-1]}return d}exports.assertSize=s;exports.charCodeMap=n;exports.charCodeToBase16=u;exports.pad=z;
package/dist/index313.js CHANGED
@@ -1,66 +1,47 @@
1
- import { BaseError as c } from "./index304.js";
2
- import { padRight as h } from "./index291.js";
3
- import { charCodeToBase16 as b, assertSize as g, pad as m } from "./index314.js";
4
- import { assertSize as p } from "./index306.js";
5
- const l = /* @__PURE__ */ new TextEncoder();
6
- function E(e) {
7
- return e instanceof Uint8Array ? e : typeof e == "string" ? y(e) : z(e);
8
- }
9
- function z(e) {
10
- return e instanceof Uint8Array ? e : new Uint8Array(e);
11
- }
12
- function y(e, t = {}) {
13
- const { size: r } = t;
14
- let n = e;
15
- r && (p(e, r), n = h(e, r));
16
- let i = n.slice(2);
17
- i.length % 2 && (i = `0${i}`);
18
- const f = i.length / 2, a = new Uint8Array(f);
19
- for (let s = 0, o = 0; s < f; s++) {
20
- const d = b(i.charCodeAt(o++)), u = b(i.charCodeAt(o++));
21
- if (d === void 0 || u === void 0)
22
- throw new c(`Invalid byte sequence ("${i[o - 2]}${i[o - 1]}" in "${i}").`);
23
- a[s] = d * 16 + u;
24
- }
25
- return a;
26
- }
27
- function C(e, t = {}) {
28
- const { size: r } = t, n = l.encode(e);
29
- return typeof r == "number" ? (g(n, r), x(n, r)) : n;
30
- }
31
- function x(e, t) {
32
- return m(e, { dir: "right", size: t });
33
- }
34
- function U(e) {
35
- return e.length;
36
- }
37
- class B extends c {
38
- constructor({ givenSize: t, maxSize: r }) {
39
- super(`Size cannot exceed \`${r}\` bytes. Given size: \`${t}\` bytes.`), Object.defineProperty(this, "name", {
40
- enumerable: !0,
41
- configurable: !0,
42
- writable: !0,
43
- value: "Bytes.SizeOverflowError"
1
+ import { size as d, SizeOverflowError as u, SizeExceedsPaddingSizeError as a } from "./index312.js";
2
+ function p(e, t) {
3
+ if (d(e) > t)
4
+ throw new u({
5
+ givenSize: d(e),
6
+ maxSize: t
44
7
  });
45
- }
46
8
  }
47
- class O extends c {
48
- constructor({ size: t, targetSize: r, type: n }) {
49
- super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${r}\`).`), Object.defineProperty(this, "name", {
50
- enumerable: !0,
51
- configurable: !0,
52
- writable: !0,
53
- value: "Bytes.SizeExceedsPaddingSizeError"
9
+ const n = {
10
+ zero: 48,
11
+ nine: 57,
12
+ A: 65,
13
+ F: 70,
14
+ a: 97,
15
+ f: 102
16
+ };
17
+ function s(e) {
18
+ if (e >= n.zero && e <= n.nine)
19
+ return e - n.zero;
20
+ if (e >= n.A && e <= n.F)
21
+ return e - (n.A - 10);
22
+ if (e >= n.a && e <= n.f)
23
+ return e - (n.a - 10);
24
+ }
25
+ function S(e, t = {}) {
26
+ const { dir: z, size: i = 32 } = t;
27
+ if (i === 0)
28
+ return e;
29
+ if (e.length > i)
30
+ throw new a({
31
+ size: e.length,
32
+ targetSize: i,
33
+ type: "Bytes"
54
34
  });
35
+ const o = new Uint8Array(i);
36
+ for (let r = 0; r < i; r++) {
37
+ const f = z === "right";
38
+ o[f ? r : i - r - 1] = e[f ? r : e.length - r - 1];
55
39
  }
40
+ return o;
56
41
  }
57
42
  export {
58
- O as SizeExceedsPaddingSizeError,
59
- B as SizeOverflowError,
60
- E as from,
61
- z as fromArray,
62
- y as fromHex,
63
- C as fromString,
64
- x as padRight,
65
- U as size
43
+ p as assertSize,
44
+ n as charCodeMap,
45
+ s as charCodeToBase16,
46
+ S as pad
66
47
  };
package/dist/index314.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index313.cjs");function s(e,t){if(o.size(e)>t)throw new o.SizeOverflowError({givenSize:o.size(e),maxSize:t})}const n={zero:48,nine:57,A:65,F:70,a:97,f:102};function u(e){if(e>=n.zero&&e<=n.nine)return e-n.zero;if(e>=n.A&&e<=n.F)return e-(n.A-10);if(e>=n.a&&e<=n.f)return e-(n.a-10)}function z(e,t={}){const{dir:f,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new o.SizeExceedsPaddingSizeError({size:e.length,targetSize:r,type:"Bytes"});const d=new Uint8Array(r);for(let i=0;i<r;i++){const a=f==="right";d[a?i:r-i-1]=e[a?i:e.length-i-1]}return d}exports.assertSize=s;exports.charCodeMap=n;exports.charCodeToBase16=u;exports.pad=z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index316.cjs");function r(){return e.version}exports.getVersion=r;
package/dist/index314.js CHANGED
@@ -1,47 +1,7 @@
1
- import { size as d, SizeOverflowError as u, SizeExceedsPaddingSizeError as a } from "./index313.js";
2
- function p(e, t) {
3
- if (d(e) > t)
4
- throw new u({
5
- givenSize: d(e),
6
- maxSize: t
7
- });
8
- }
9
- const n = {
10
- zero: 48,
11
- nine: 57,
12
- A: 65,
13
- F: 70,
14
- a: 97,
15
- f: 102
16
- };
17
- function s(e) {
18
- if (e >= n.zero && e <= n.nine)
19
- return e - n.zero;
20
- if (e >= n.A && e <= n.F)
21
- return e - (n.A - 10);
22
- if (e >= n.a && e <= n.f)
23
- return e - (n.a - 10);
24
- }
25
- function S(e, t = {}) {
26
- const { dir: z, size: i = 32 } = t;
27
- if (i === 0)
28
- return e;
29
- if (e.length > i)
30
- throw new a({
31
- size: e.length,
32
- targetSize: i,
33
- type: "Bytes"
34
- });
35
- const o = new Uint8Array(i);
36
- for (let r = 0; r < i; r++) {
37
- const f = z === "right";
38
- o[f ? r : i - r - 1] = e[f ? r : e.length - r - 1];
39
- }
40
- return o;
1
+ import { version as r } from "./index316.js";
2
+ function e() {
3
+ return r;
41
4
  }
42
5
  export {
43
- p as assertSize,
44
- n as charCodeMap,
45
- s as charCodeToBase16,
46
- S as pad
6
+ e as getVersion
47
7
  };
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("./index282.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("./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;
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 "./index282.js";
4
+ import { idCache as l } from "./index283.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.5-beta.3",
3
+ "version": "2.4.6-beta.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "vite build",