@palbase/web 7.3.2 → 7.3.3

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.d.cts CHANGED
@@ -206,6 +206,6 @@ interface MlsGlue {
206
206
  */
207
207
  declare function initMls(): Promise<MlsGlue>;
208
208
 
209
- declare const VERSION = "7.3.2";
209
+ declare const VERSION = "7.3.3";
210
210
 
211
211
  export { VERSION, initMls };
package/dist/index.d.ts CHANGED
@@ -206,6 +206,6 @@ interface MlsGlue {
206
206
  */
207
207
  declare function initMls(): Promise<MlsGlue>;
208
208
 
209
- declare const VERSION = "7.3.2";
209
+ declare const VERSION = "7.3.3";
210
210
 
211
211
  export { VERSION, initMls };
package/dist/index.js CHANGED
@@ -11,11 +11,11 @@ import {
11
11
  localStorageSessionStorage,
12
12
  memorySessionStorage,
13
13
  pb
14
- } from "./chunk-TQAQR3OP.js";
14
+ } from "./chunk-XF7NM6HF.js";
15
15
  import {
16
16
  BackendError,
17
17
  isBackendError
18
- } from "./chunk-HKZVA3I3.js";
18
+ } from "./chunk-43BGZCNU.js";
19
19
  import "./chunk-CFDU23TB.js";
20
20
  import "./chunk-PZ5AY32C.js";
21
21
  export {
package/dist/internal.cjs CHANGED
@@ -83,13 +83,16 @@ var MAX_POW_DIFFICULTY = 24;
83
83
  function powBudget(difficulty) {
84
84
  return 8 * 2 ** difficulty;
85
85
  }
86
- async function solvePowChallenge(challenge, maxIterations = powBudget(challenge.difficulty)) {
86
+ async function solvePowChallenge(challenge, maxIterations = powBudget(challenge.difficulty), signal) {
87
87
  if (challenge.difficulty > MAX_POW_DIFFICULTY) {
88
88
  throw new Error(
89
89
  `proof-of-work: refusing difficulty ${challenge.difficulty}; this client attempts at most ${MAX_POW_DIFFICULTY}, which is the highest a Palbase stack issues`
90
90
  );
91
91
  }
92
92
  for (let nonce = 0; nonce < maxIterations; nonce++) {
93
+ if ((nonce & 1023) === 0 && signal?.aborted) {
94
+ throw new DOMException("proof-of-work solve aborted", "AbortError");
95
+ }
93
96
  const digest = await crypto.subtle.digest("SHA-256", encoder.encode(challenge.prefix + nonce));
94
97
  if (leadingZeroBits(new Uint8Array(digest)) >= challenge.difficulty) {
95
98
  return {
@@ -259,7 +262,7 @@ var HttpClient = class _HttpClient {
259
262
  if (attempt < MAX_RETRIES - 1) {
260
263
  const backoff = INITIAL_BACKOFF_MS * 2 ** attempt;
261
264
  await this.delay(backoff);
262
- return this.executeWithRetry(method, path, options, attempt + 1, earned);
265
+ return this.executeWithRetry(method, path, options, attempt + 1);
263
266
  }
264
267
  throw new PalbaseError(
265
268
  "network_error",
@@ -295,7 +298,7 @@ var HttpClient = class _HttpClient {
295
298
  path,
296
299
  options,
297
300
  attempt,
298
- await solvePowChallenge(challenge)
301
+ await solvePowChallenge(challenge, void 0, options?.signal)
299
302
  );
300
303
  }
301
304
  }
@@ -9364,7 +9367,7 @@ function defaultSessionStorage(key) {
9364
9367
  }
9365
9368
 
9366
9369
  // src/version.ts
9367
- var VERSION = "7.3.2";
9370
+ var VERSION = "7.3.3";
9368
9371
 
9369
9372
  // src/runtime.ts
9370
9373
  function buildRuntime(config) {