@hatchet-dev/typescript-sdk 0.15.2 → 0.15.4
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 +11 -7
- package/package.json +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -79,22 +79,26 @@ class WebhookHandler {
|
|
|
79
79
|
expressHandler({ secret }) {
|
|
80
80
|
return (req, res) => {
|
|
81
81
|
if (req.method === 'GET') {
|
|
82
|
-
res.
|
|
82
|
+
res.status(200).send(okMessage);
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
if (req.method === 'PUT') {
|
|
86
|
-
|
|
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)
|
|
87
91
|
.then((resp) => {
|
|
88
|
-
res.
|
|
92
|
+
res.status(200).json(resp);
|
|
89
93
|
})
|
|
90
94
|
.catch((err) => {
|
|
91
|
-
res.
|
|
95
|
+
res.status(500);
|
|
92
96
|
this.worker.logger.error(`Error handling request: ${err.message}`);
|
|
93
97
|
});
|
|
94
98
|
return;
|
|
95
99
|
}
|
|
96
100
|
if (req.method !== 'POST') {
|
|
97
|
-
res.
|
|
101
|
+
res.status(405).json({ error: 'Method not allowed' });
|
|
98
102
|
return;
|
|
99
103
|
}
|
|
100
104
|
let action = req.body;
|
|
@@ -103,10 +107,10 @@ class WebhookHandler {
|
|
|
103
107
|
}
|
|
104
108
|
this.handle(action, req.headers['x-hatchet-signature'], secret)
|
|
105
109
|
.then(() => {
|
|
106
|
-
res.
|
|
110
|
+
res.status(200);
|
|
107
111
|
})
|
|
108
112
|
.catch((err) => {
|
|
109
|
-
res.
|
|
113
|
+
res.status(500);
|
|
110
114
|
this.worker.logger.error(`Error handling request: ${err.message}`);
|
|
111
115
|
});
|
|
112
116
|
};
|
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.4";
|
package/version.js
CHANGED