@hirosystems/chainhooks-client 0.10.0 → 0.12.0-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 (46) hide show
  1. package/dist/src/client.d.ts +13 -1
  2. package/dist/src/client.d.ts.map +1 -1
  3. package/dist/src/client.js +60 -15
  4. package/dist/src/client.js.map +1 -1
  5. package/dist/src/schemas/api/index.d.ts +33 -2
  6. package/dist/src/schemas/api/index.d.ts.map +1 -1
  7. package/dist/src/schemas/api/index.js +46 -4
  8. package/dist/src/schemas/api/index.js.map +1 -1
  9. package/dist/src/schemas/chainhook/index.d.ts +8 -0
  10. package/dist/src/schemas/chainhook/index.d.ts.map +1 -1
  11. package/dist/src/schemas/chainhook/index.js +10 -7
  12. package/dist/src/schemas/chainhook/index.js.map +1 -1
  13. package/dist/src/schemas/chainhook/stacks/filters.d.ts +6 -0
  14. package/dist/src/schemas/chainhook/stacks/filters.d.ts.map +1 -1
  15. package/dist/src/schemas/chainhook/stacks/filters.js +2 -0
  16. package/dist/src/schemas/chainhook/stacks/filters.js.map +1 -1
  17. package/dist/src/schemas/errors.d.ts +22 -0
  18. package/dist/src/schemas/errors.d.ts.map +1 -0
  19. package/dist/src/schemas/errors.js +40 -0
  20. package/dist/src/schemas/errors.js.map +1 -0
  21. package/dist/src/schemas/index.d.ts +1 -0
  22. package/dist/src/schemas/index.d.ts.map +1 -1
  23. package/dist/src/schemas/index.js +1 -0
  24. package/dist/src/schemas/index.js.map +1 -1
  25. package/dist/tsconfig.build.tsbuildinfo +1 -1
  26. package/package.json +2 -3
  27. package/schemas/api/index.d.ts +33 -2
  28. package/schemas/api/index.d.ts.map +1 -1
  29. package/schemas/api/index.js +46 -4
  30. package/schemas/api/index.js.map +1 -1
  31. package/schemas/chainhook/index.d.ts +8 -0
  32. package/schemas/chainhook/index.d.ts.map +1 -1
  33. package/schemas/chainhook/index.js +10 -7
  34. package/schemas/chainhook/index.js.map +1 -1
  35. package/schemas/chainhook/stacks/filters.d.ts +6 -0
  36. package/schemas/chainhook/stacks/filters.d.ts.map +1 -1
  37. package/schemas/chainhook/stacks/filters.js +2 -0
  38. package/schemas/chainhook/stacks/filters.js.map +1 -1
  39. package/schemas/errors.d.ts +22 -0
  40. package/schemas/errors.d.ts.map +1 -0
  41. package/schemas/errors.js +40 -0
  42. package/schemas/errors.js.map +1 -0
  43. package/schemas/index.d.ts +1 -0
  44. package/schemas/index.d.ts.map +1 -1
  45. package/schemas/index.js +1 -0
  46. package/schemas/index.js.map +1 -1
@@ -0,0 +1,22 @@
1
+ export declare class ChainhooksHttpError extends Error {
2
+ readonly status: number;
3
+ readonly url: string;
4
+ readonly method: string;
5
+ readonly headers: Record<string, string | string[]>;
6
+ readonly bodyText: string;
7
+ readonly body?: unknown | undefined;
8
+ name: "ChainhooksHttpError";
9
+ constructor(status: number, url: string, method: string, headers: Record<string, string | string[]>, bodyText: string, body?: unknown | undefined);
10
+ toJSON(): {
11
+ name: "ChainhooksHttpError";
12
+ status: number;
13
+ url: string;
14
+ method: string;
15
+ headers: Record<string, string | string[]>;
16
+ bodyText: string;
17
+ body: unknown;
18
+ message: string;
19
+ stack: string | undefined;
20
+ };
21
+ }
22
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/schemas/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAoB,SAAQ,KAAK;aAI1B,MAAM,EAAE,MAAM;aACd,GAAG,EAAE,MAAM;aACX,MAAM,EAAE,MAAM;aACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;aAC1C,QAAQ,EAAE,MAAM;aAChB,IAAI,CAAC,EAAE,OAAO;IARhC,IAAI,EAAG,qBAAqB,CAAU;gBAGpB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAC1C,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,OAAO,YAAA;IAWhC,MAAM;;;;;;;;;;;CAaP"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChainhooksHttpError = void 0;
4
+ class ChainhooksHttpError extends Error {
5
+ status;
6
+ url;
7
+ method;
8
+ headers;
9
+ bodyText;
10
+ body;
11
+ name = 'ChainhooksHttpError';
12
+ constructor(status, url, method, headers, bodyText, body) {
13
+ // Include a short preview of the body to keep the message smaller
14
+ const preview = body
15
+ ? JSON.stringify(body).slice(0, 500)
16
+ : bodyText.slice(0, 500);
17
+ super(`ChainhooksClient error: HTTP ${status}${preview ? ` — ${preview}` : ''}`);
18
+ this.status = status;
19
+ this.url = url;
20
+ this.method = method;
21
+ this.headers = headers;
22
+ this.bodyText = bodyText;
23
+ this.body = body;
24
+ }
25
+ toJSON() {
26
+ return {
27
+ name: this.name,
28
+ status: this.status,
29
+ url: this.url,
30
+ method: this.method,
31
+ headers: this.headers,
32
+ bodyText: this.bodyText,
33
+ body: this.body,
34
+ message: this.message,
35
+ stack: this.stack,
36
+ };
37
+ }
38
+ }
39
+ exports.ChainhooksHttpError = ChainhooksHttpError;
40
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/schemas/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,mBAAoB,SAAQ,KAAK;IAI1B;IACA;IACA;IACA;IACA;IACA;IARlB,IAAI,GAAG,qBAA8B,CAAC;IAEtC,YACkB,MAAc,EACd,GAAW,EACX,MAAc,EACd,OAA0C,EAC1C,QAAgB,EAChB,IAAc;QAE9B,kEAAkE;QAClE,MAAM,OAAO,GAAG,IAAI;YAClB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;YACpC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC3B,KAAK,CACH,gCAAgC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAC1E,CAAC;QAbc,WAAM,GAAN,MAAM,CAAQ;QACd,QAAG,GAAH,GAAG,CAAQ;QACX,WAAM,GAAN,MAAM,CAAQ;QACd,YAAO,GAAP,OAAO,CAAmC;QAC1C,aAAQ,GAAR,QAAQ,CAAQ;QAChB,SAAI,GAAJ,IAAI,CAAU;IAShC,CAAC;IAED,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;IACJ,CAAC;CACF;AAjCD,kDAiCC"}
@@ -2,4 +2,5 @@ export * from './api';
2
2
  export * from './chainhook';
3
3
  export * from './chainhook-event';
4
4
  export * from './utils';
5
+ export * from './errors';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
@@ -18,4 +18,5 @@ __exportStar(require("./api"), exports);
18
18
  __exportStar(require("./chainhook"), exports);
19
19
  __exportStar(require("./chainhook-event"), exports);
20
20
  __exportStar(require("./utils"), exports);
21
+ __exportStar(require("./errors"), exports);
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schemas/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,8CAA4B;AAC5B,oDAAkC;AAClC,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schemas/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,8CAA4B;AAC5B,oDAAkC;AAClC,0CAAwB;AACxB,2CAAyB"}