@resonatehq/supabase 0.1.7 → 0.1.8

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/dist/index.js CHANGED
@@ -72,9 +72,10 @@ export class Resonate {
72
72
  tracer,
73
73
  });
74
74
  const task = { kind: "unclaimed", task: body.task };
75
- const handleCallback = (data) => {
76
- this.onTerminateFn?.(data);
77
- return Promise.resolve();
75
+ const handleCallback = async (data) => {
76
+ if (this.onTerminateFn) {
77
+ await this.onTerminateFn(data);
78
+ }
78
79
  };
79
80
  return new Promise((resolve) => {
80
81
  resonateInner.process(tracer.startSpan(task.task.rootPromiseId, clock.now()), task, (error, status) => {
@@ -96,9 +97,7 @@ export class Resonate {
96
97
  status: "completed",
97
98
  result: status.promise.value,
98
99
  requestUrl: url,
99
- }), {
100
- status: 200,
101
- }));
100
+ }), { status: 200 }));
102
101
  });
103
102
  return;
104
103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resonatehq/supabase",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Resonate FaaS handler for Supabase Edge Functions (TypeScript)",
5
5
  "repository": {
6
6
  "url": "https://github.com/resonatehq/resonate-faas-supabase-ts"
package/src/index.ts CHANGED
@@ -152,13 +152,14 @@ export class Resonate {
152
152
 
153
153
  const task: Task = { kind: "unclaimed", task: body.task };
154
154
 
155
- const handleCallback = (
155
+ const handleCallback = async (
156
156
  data:
157
157
  | { status: "completed"; data?: any }
158
158
  | { status: "suspended"; result: string[] },
159
159
  ): Promise<void> => {
160
- this.onTerminateFn?.(data);
161
- return Promise.resolve();
160
+ if (this.onTerminateFn) {
161
+ await this.onTerminateFn(data);
162
+ }
162
163
  };
163
164
 
164
165
  return new Promise((resolve) => {
@@ -194,9 +195,7 @@ export class Resonate {
194
195
  result: status.promise.value,
195
196
  requestUrl: url,
196
197
  }),
197
- {
198
- status: 200,
199
- },
198
+ { status: 200 },
200
199
  ),
201
200
  );
202
201
  });