@tinycloud/node-sdk 3.9.0-beta.4 → 3.9.0-beta.6

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.
@@ -467,6 +467,7 @@ var MESSAGES = {
467
467
  CANCELED: "Email verification was canceled.",
468
468
  FAILED: "Email verification failed."
469
469
  };
470
+ var LOCAL_PROFILE_UNAVAILABLE = "This SDK build doesn't enable the email verification profile.";
470
471
  function rateLimitMessage(retryAfterMs) {
471
472
  const head = "Too many codes were requested for this address.";
472
473
  if (retryAfterMs === void 0 || !Number.isFinite(retryAfterMs) || retryAfterMs <= 0) return `${head} Try again in about an hour.`;
@@ -474,8 +475,9 @@ function rateLimitMessage(retryAfterMs) {
474
475
  return `${head} Try again in ${minutes} ${minutes === 1 ? "minute" : "minutes"}.`;
475
476
  }
476
477
  var EmailProofError = class extends Error {
477
- constructor(step, code, retryAfterMs, recoverable = RECOVERABILITY[code]) {
478
- super(code === "RATE_LIMITED" ? rateLimitMessage(retryAfterMs) : MESSAGES[code]);
478
+ /** `message` overrides the code's text for one refusal whose cause the shared text would misdescribe. It never carries request data. */
479
+ constructor(step, code, retryAfterMs, recoverable = RECOVERABILITY[code], message) {
480
+ super(message ?? (code === "RATE_LIMITED" ? rateLimitMessage(retryAfterMs) : MESSAGES[code]));
479
481
  this.name = "EmailProofError";
480
482
  this.step = step;
481
483
  this.code = code;
@@ -762,7 +764,9 @@ function assertHolder(holder, step, profile) {
762
764
  }
763
765
  function profilePin(profile, step, allowHeld) {
764
766
  const entry = Object.prototype.hasOwnProperty.call(PROFILE_PINS, profile) ? PROFILE_PINS[profile] : void 0;
765
- if (!entry || !entry.enabled && !(allowHeld === true && profile === HELD_PROFILE)) throw new EmailProofError(step, "PROFILE_UNAVAILABLE");
767
+ if (!entry || !entry.enabled && !(allowHeld === true && profile === HELD_PROFILE)) {
768
+ throw new EmailProofError(step, "PROFILE_UNAVAILABLE", void 0, void 0, LOCAL_PROFILE_UNAVAILABLE);
769
+ }
766
770
  return entry;
767
771
  }
768
772
  function emailRequirement(address, profile) {