@hatchet-dev/typescript-sdk 0.15.1 → 0.15.3

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.
@@ -79,15 +79,17 @@ class WebhookHandler {
79
79
  expressHandler({ secret }) {
80
80
  return (req, res) => {
81
81
  if (req.method === 'GET') {
82
- res.sendStatus(200);
83
- res.send(okMessage);
82
+ res.sendStatus(200).send(okMessage);
84
83
  return;
85
84
  }
86
85
  if (req.method === 'PUT') {
87
- this.getHealthcheckResponse(req.body, req.headers['x-hatchet-signature'], secret)
86
+ let { body } = req;
87
+ if (typeof body !== 'string') {
88
+ body = JSON.stringify(body);
89
+ }
90
+ this.getHealthcheckResponse(body, req.headers['x-hatchet-signature'], secret)
88
91
  .then((resp) => {
89
- res.sendStatus(200);
90
- res.json(resp);
92
+ res.sendStatus(200).json(resp);
91
93
  })
92
94
  .catch((err) => {
93
95
  res.sendStatus(500);
@@ -96,11 +98,14 @@ class WebhookHandler {
96
98
  return;
97
99
  }
98
100
  if (req.method !== 'POST') {
99
- res.sendStatus(405);
100
- res.json({ error: 'Method not allowed' });
101
+ res.sendStatus(405).json({ error: 'Method not allowed' });
101
102
  return;
102
103
  }
103
- this.handle(req.body, req.headers['x-hatchet-signature'], secret)
104
+ let action = req.body;
105
+ if (typeof action !== 'string') {
106
+ action = JSON.stringify(action);
107
+ }
108
+ this.handle(action, req.headers['x-hatchet-signature'], secret)
104
109
  .then(() => {
105
110
  res.sendStatus(200);
106
111
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hatchet-dev/typescript-sdk",
3
- "version": "0.15.1",
3
+ "version": "0.15.3",
4
4
  "description": "Background task orchestration & visibility for developers",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const HATCHET_VERSION = "0.15.1";
1
+ export declare const HATCHET_VERSION = "0.15.3";
package/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HATCHET_VERSION = void 0;
4
- exports.HATCHET_VERSION = '0.15.1';
4
+ exports.HATCHET_VERSION = '0.15.3';