@relaymessenger/chat-sdk-adapter 0.2.0 → 0.2.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.
- package/dist/src/client.js +6 -1
- package/package.json +2 -2
package/dist/src/client.js
CHANGED
|
@@ -38,7 +38,12 @@ export class RelayClient {
|
|
|
38
38
|
throw new Error("Relay Agent Token is required");
|
|
39
39
|
this.token = options.token;
|
|
40
40
|
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
|
|
41
|
-
|
|
41
|
+
// Bound to the global object because the call sites invoke this through a
|
|
42
|
+
// property, which would otherwise pass the client as `this`. undici accepts
|
|
43
|
+
// that; workerd rejects it with `Illegal invocation`, so an unbound fetch
|
|
44
|
+
// fails every request on Cloudflare Workers. Binding a caller-supplied
|
|
45
|
+
// fetch is safe: an already-bound function ignores a later `bind`.
|
|
46
|
+
this.fetchImpl = (options.fetch ?? globalThis.fetch).bind(globalThis);
|
|
42
47
|
}
|
|
43
48
|
authHeaders(extra) {
|
|
44
49
|
return { Authorization: `Bearer ${this.token}`, ...extra };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relaymessenger/chat-sdk-adapter",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Relay adapter for the Vercel Chat SDK. Receive signed Relay webhooks and post replies as one canonical message.",
|
|
5
|
-
"homepage": "https://docs.relayapp.im/
|
|
5
|
+
"homepage": "https://docs.relayapp.im/integrations/chat-sdk",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/relaymessenger/Relay-SDK/issues"
|
|
8
8
|
},
|