@dynamic-labs-wallet/core 1.1.31 → 1.1.32

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/index.cjs CHANGED
@@ -846,6 +846,22 @@ const invokeCeremonyComplete = ({ completion, onCeremonyComplete })=>{
846
846
  const getElapsedTime = (startTime)=>{
847
847
  return startTime ? (Date.now() - startTime).toString() : undefined;
848
848
  };
849
+ /**
850
+ * Reports a request that failed before any response (e.g. a dropped
851
+ * connection) to `onError` and returns the error to reject with. Axios errors
852
+ * carry request config (incl. auth headers) on the error itself, so onError
853
+ * only gets a fresh error with the message, never the raw error object.
854
+ */ const reportRequestFailure = (err, onError)=>{
855
+ const error = err instanceof Error ? err : new Error(String(err));
856
+ try {
857
+ onError == null ? void 0 : onError(new Error(error.message));
858
+ } catch (observerError) {
859
+ Logger.warn('Event stream error observer threw', {
860
+ observerErrorType: observerError instanceof Error ? observerError.name : typeof observerError
861
+ });
862
+ }
863
+ return error;
864
+ };
849
865
  /**
850
866
  * A promise that can be rejected from outside. Paired with the SSE stream's
851
867
  * onError callback it lets a caller race a ceremony (relay join, MPC
@@ -971,7 +987,9 @@ const getElapsedTime = (startTime)=>{
971
987
  }
972
988
  }
973
989
  })(response);
974
- }).catch(reject);
990
+ })// Without onError, a caller that races the ceremony against it (the cached-room
991
+ // sign path never awaits this promise) waits out its queue timeout instead.
992
+ .catch((err)=>reject(reportRequestFailure(err, onError)));
975
993
  });
976
994
  // Add a timeout to prevent hanging
977
995
  let timeoutId;
@@ -1197,11 +1215,7 @@ const getElapsedTime = (startTime)=>{
1197
1215
  const requestPromise = apiClient.post(endpoint, body, {
1198
1216
  headers
1199
1217
  }).then((response)=>response.data).catch((err)=>{
1200
- const error = err instanceof Error ? err : new Error(String(err));
1201
- // Axios errors carry request config (incl. auth headers) on `err` itself;
1202
- // onError only gets the message, never the raw error object.
1203
- onError == null ? void 0 : onError(new Error(error.message));
1204
- throw error;
1218
+ throw reportRequestFailure(err, onError);
1205
1219
  });
1206
1220
  return Promise.race([
1207
1221
  requestPromise,
@@ -1278,7 +1292,7 @@ const getRequiredExternalKeyShareId = (ks)=>{
1278
1292
  * before it is posted and surfaces in Datadog exactly as the recovery path does.
1279
1293
  */ const assertDynamicLocationsHaveExternalKeyShareId = (locations)=>locations.filter((location)=>location.location === BackupLocation.DYNAMIC).forEach((location)=>getRequiredExternalKeyShareId(location));
1280
1294
 
1281
- var version = "1.1.31";
1295
+ var version = "1.1.32";
1282
1296
 
1283
1297
  /**
1284
1298
  * Reads the Authorization header off an axios request config, which stores
package/index.esm.js CHANGED
@@ -847,6 +847,22 @@ const invokeCeremonyComplete = ({ completion, onCeremonyComplete })=>{
847
847
  const getElapsedTime = (startTime)=>{
848
848
  return startTime ? (Date.now() - startTime).toString() : undefined;
849
849
  };
850
+ /**
851
+ * Reports a request that failed before any response (e.g. a dropped
852
+ * connection) to `onError` and returns the error to reject with. Axios errors
853
+ * carry request config (incl. auth headers) on the error itself, so onError
854
+ * only gets a fresh error with the message, never the raw error object.
855
+ */ const reportRequestFailure = (err, onError)=>{
856
+ const error = err instanceof Error ? err : new Error(String(err));
857
+ try {
858
+ onError == null ? void 0 : onError(new Error(error.message));
859
+ } catch (observerError) {
860
+ Logger.warn('Event stream error observer threw', {
861
+ observerErrorType: observerError instanceof Error ? observerError.name : typeof observerError
862
+ });
863
+ }
864
+ return error;
865
+ };
850
866
  /**
851
867
  * A promise that can be rejected from outside. Paired with the SSE stream's
852
868
  * onError callback it lets a caller race a ceremony (relay join, MPC
@@ -972,7 +988,9 @@ const getElapsedTime = (startTime)=>{
972
988
  }
973
989
  }
974
990
  })(response);
975
- }).catch(reject);
991
+ })// Without onError, a caller that races the ceremony against it (the cached-room
992
+ // sign path never awaits this promise) waits out its queue timeout instead.
993
+ .catch((err)=>reject(reportRequestFailure(err, onError)));
976
994
  });
977
995
  // Add a timeout to prevent hanging
978
996
  let timeoutId;
@@ -1198,11 +1216,7 @@ const getElapsedTime = (startTime)=>{
1198
1216
  const requestPromise = apiClient.post(endpoint, body, {
1199
1217
  headers
1200
1218
  }).then((response)=>response.data).catch((err)=>{
1201
- const error = err instanceof Error ? err : new Error(String(err));
1202
- // Axios errors carry request config (incl. auth headers) on `err` itself;
1203
- // onError only gets the message, never the raw error object.
1204
- onError == null ? void 0 : onError(new Error(error.message));
1205
- throw error;
1219
+ throw reportRequestFailure(err, onError);
1206
1220
  });
1207
1221
  return Promise.race([
1208
1222
  requestPromise,
@@ -1279,7 +1293,7 @@ const getRequiredExternalKeyShareId = (ks)=>{
1279
1293
  * before it is posted and surfaces in Datadog exactly as the recovery path does.
1280
1294
  */ const assertDynamicLocationsHaveExternalKeyShareId = (locations)=>locations.filter((location)=>location.location === BackupLocation.DYNAMIC).forEach((location)=>getRequiredExternalKeyShareId(location));
1281
1295
 
1282
- var version = "1.1.31";
1296
+ var version = "1.1.32";
1283
1297
 
1284
1298
  /**
1285
1299
  * Reads the Authorization header off an axios request config, which stores
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/core",
3
- "version": "1.1.31",
3
+ "version": "1.1.32",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "@dynamic-labs/sdk-api-core": "0.50.0",
8
- "@dynamic-labs-wallet/primitives": "1.1.31",
8
+ "@dynamic-labs-wallet/primitives": "1.1.32",
9
9
  "axios": "1.20.0",
10
10
  "uuid": "11.1.0"
11
11
  },
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/eventStream/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAO3C,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAEjB,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AAWrB;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,qBAA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