@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.
- package/clients/worker/handler.js +13 -8
- package/package.json +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -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
|
-
|
|
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
|
-
|
|
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
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const HATCHET_VERSION = "0.15.
|
|
1
|
+
export declare const HATCHET_VERSION = "0.15.3";
|
package/version.js
CHANGED