@spacelr/sdk 0.10.4 → 0.10.5

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.mjs CHANGED
@@ -58,6 +58,12 @@ var SpacelrSearchFilterRequiredError = class extends SpacelrError {
58
58
  this.missingFields = Array.isArray(fields) ? fields.filter((f) => typeof f === "string") : [];
59
59
  }
60
60
  };
61
+ var SpacelrScanLimitExceededError = class extends SpacelrError {
62
+ constructor(message, details) {
63
+ super(message, "SCAN_LIMIT_EXCEEDED", 400, details);
64
+ this.name = "SpacelrScanLimitExceededError";
65
+ }
66
+ };
61
67
  var SpacelrEmailVerificationRequiredError = class extends SpacelrError {
62
68
  constructor(emailSent, details) {
63
69
  super(
@@ -313,6 +319,10 @@ var HttpClient = class {
313
319
  const missingFields = Array.isArray(flatBody["missingFields"]) ? flatBody["missingFields"] : [];
314
320
  throw new SpacelrSearchFilterRequiredError(flatMessage, { missingFields });
315
321
  }
322
+ if (statusCode === 400 && flatBody["errorCode"] === "SCAN_LIMIT_EXCEEDED") {
323
+ const flatMessage = typeof flatBody["message"] === "string" ? flatBody["message"] : message;
324
+ throw new SpacelrScanLimitExceededError(flatMessage);
325
+ }
316
326
  if (statusCode === 401 || statusCode === 403) {
317
327
  throw new SpacelrAuthError(message, statusCode, details);
318
328
  }
@@ -2316,7 +2326,7 @@ var Paginator = class {
2316
2326
  return { documents: [], hasMore: false };
2317
2327
  }
2318
2328
  this.cursor = result.documents[result.documents.length - 1]._id;
2319
- const hasMore = result.mode === "cursor" ? result.hasMore : result.documents.length < result.total;
2329
+ const hasMore = result.mode === "cursor" ? result.hasMore : result.hasMore ?? (result.total !== void 0 ? result.documents.length < result.total : false);
2320
2330
  return { documents: result.documents, hasMore };
2321
2331
  }
2322
2332
  };
@@ -3342,6 +3352,7 @@ export {
3342
3352
  SpacelrEmailVerificationRequiredError,
3343
3353
  SpacelrError,
3344
3354
  SpacelrNetworkError,
3355
+ SpacelrScanLimitExceededError,
3345
3356
  SpacelrSearchFilterRequiredError,
3346
3357
  SpacelrTimeoutError,
3347
3358
  SpacelrTwoFactorRequiredError,