@calimero-network/mero-js 19.27.0 → 19.27.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.
@@ -69,17 +69,18 @@ function audienceLabel(audience) {
69
69
  */
70
70
  export async function login(config) {
71
71
  const baseUrl = config.nodeUrl.replace(/\/+$/, '');
72
- const doFetch = config.fetch ?? globalThis.fetch;
73
72
  const timeoutMs = config.timeoutMs ?? 10000;
74
73
  const request = async (path, init) => {
75
74
  const controller = new AbortController();
76
75
  const timer = setTimeout(() => controller.abort(), timeoutMs);
77
76
  let response;
78
77
  try {
79
- response = await doFetch(`${baseUrl}${path}`, {
80
- ...init,
81
- signal: controller.signal,
82
- });
78
+ const requestInit = { ...init, signal: controller.signal };
79
+ // globalThis.fetch must be called as a method on globalThis, not through a
80
+ // variable, or browsers throw "Illegal invocation".
81
+ response = config.fetch
82
+ ? await config.fetch(`${baseUrl}${path}`, requestInit)
83
+ : await globalThis.fetch(`${baseUrl}${path}`, requestInit);
83
84
  }
84
85
  catch (err) {
85
86
  throw new HTTPError(0, err instanceof Error ? err.name : 'NetworkError', `${baseUrl}${path}`, new Headers(), err instanceof Error ? err.message : String(err));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calimero-network/mero-js",
3
- "version": "19.27.0",
3
+ "version": "19.27.1",
4
4
  "description": "Pure JavaScript SDK for Calimero",
5
5
  "type": "module",
6
6
  "exports": {