@tinycloud/sdk-core 3.2.0-beta.7 → 3.2.0-beta.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.d.cts CHANGED
@@ -3463,6 +3463,7 @@ declare class LocationRegistryHttpError extends Error {
3463
3463
  }
3464
3464
  declare class CloudLocationResolutionError extends Error {
3465
3465
  readonly attempts: LocationResolutionAttempt[];
3466
+ readonly cause?: Error;
3466
3467
  constructor(subject: string, attempts: LocationResolutionAttempt[]);
3467
3468
  }
3468
3469
  declare function locationPayloadForRecord(record: LocationRecord): LocationRecordPayload;
package/dist/index.d.ts CHANGED
@@ -3463,6 +3463,7 @@ declare class LocationRegistryHttpError extends Error {
3463
3463
  }
3464
3464
  declare class CloudLocationResolutionError extends Error {
3465
3465
  readonly attempts: LocationResolutionAttempt[];
3466
+ readonly cause?: Error;
3466
3467
  constructor(subject: string, attempts: LocationResolutionAttempt[]);
3467
3468
  }
3468
3469
  declare function locationPayloadForRecord(record: LocationRecord): LocationRecordPayload;
package/dist/index.js CHANGED
@@ -7540,8 +7540,9 @@ async function loadManifest(url) {
7540
7540
  }
7541
7541
  const res = await fetchFn(url);
7542
7542
  if (!res.ok) {
7543
- throw new ManifestValidationError(
7544
- `failed to fetch manifest from ${url}: HTTP ${res.status}`
7543
+ throw Object.assign(
7544
+ new ManifestValidationError(`failed to fetch manifest from ${url}: HTTP ${res.status}`),
7545
+ { status: res.status }
7545
7546
  );
7546
7547
  }
7547
7548
  const json = await res.json();
@@ -16114,7 +16115,7 @@ async function checkNodeInfo(host, sdkProtocol, fetchFn = globalThis.fetch.bind(
16114
16115
  throw new VersionCheckError(host, err6);
16115
16116
  }
16116
16117
  if (!response.ok) {
16117
- throw new VersionCheckError(host);
16118
+ throw new VersionCheckError(host, await httpResponseError(response, "node info fetch failed"));
16118
16119
  }
16119
16120
  const data = await response.json();
16120
16121
  if (sdkProtocol !== data.protocol) {
@@ -17889,6 +17890,16 @@ var CloudLocationResolutionError = class extends Error {
17889
17890
  super(`Unable to resolve TinyCloud location for ${subject}`);
17890
17891
  this.name = "CloudLocationResolutionError";
17891
17892
  this.attempts = attempts;
17893
+ let failure;
17894
+ for (const attempt of attempts) {
17895
+ if (attempt.error === void 0) continue;
17896
+ if (failure !== void 0) {
17897
+ failure = void 0;
17898
+ break;
17899
+ }
17900
+ failure = attempt.error;
17901
+ }
17902
+ this.cause = failure;
17892
17903
  }
17893
17904
  };
17894
17905
  function locationPayloadForRecord(record2) {
@@ -18390,7 +18401,9 @@ async function verifyOwnerNodeBinding(options2) {
18390
18401
  signal: lookup.signal
18391
18402
  });
18392
18403
  if (!response.ok) {
18393
- throw new LocationRecordValidationError(`target node /info returned HTTP ${response.status}`);
18404
+ const failure = new LocationRecordValidationError(`target node /info returned HTTP ${response.status}`);
18405
+ Object.assign(failure, { status: response.status });
18406
+ throw failure;
18394
18407
  }
18395
18408
  const text2 = await boundedResponseText(response, "target node /info", 16 * 1024);
18396
18409
  let body;