@wix/himalaya-cli 0.1482.0 → 0.1483.0

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.
@@ -258,6 +258,7 @@ var aliases = {
258
258
  EXPIRED_CODE: "expired_code",
259
259
  TOO_MANY_REQUESTS: "rate_limited"
260
260
  };
261
+ var iamCredentialCodes = /* @__PURE__ */ new Set(["-19999", "-19976"]);
261
262
  function authMessage(key, translate) {
262
263
  const translated = translate?.(key);
263
264
  return translated && translated !== key ? translated : copy_generated_default[key] ?? copy_generated_default["auth.feedback.unknown"];
@@ -267,8 +268,10 @@ function authFailure(raw, operation = "signIn", translate) {
267
268
  const payload = value.payload && typeof value.payload === "object" ? value.payload : value;
268
269
  const named = payload.code ?? value.code ?? value.kind;
269
270
  const status = value.statusCode ?? value.status;
271
+ const application = String(payload.details?.applicationError?.code ?? value.details?.applicationError?.code ?? payload.applicationCode ?? value.applicationCode ?? named ?? "");
270
272
  let code = codes.has(named) ? named : aliases[named] ?? "unknown";
271
- if (status === 429) code = "rate_limited";
273
+ if (operation === "signIn" && iamCredentialCodes.has(application)) code = "invalid_credentials";
274
+ else if (status === 429) code = "rate_limited";
272
275
  else if ([404, 405, 501].includes(status)) code = "unavailable";
273
276
  else if ([401, 403].includes(status) && operation === "signIn") code = "invalid_credentials";
274
277
  else if (status === 0 || status >= 500 || value.name === "TypeError" || value.name === "TimeoutError") code = "network";
@@ -269,6 +269,7 @@ var aliases = {
269
269
  EXPIRED_CODE: "expired_code",
270
270
  TOO_MANY_REQUESTS: "rate_limited"
271
271
  };
272
+ var iamCredentialCodes = /* @__PURE__ */ new Set(["-19999", "-19976"]);
272
273
  function authMessage(key, translate) {
273
274
  const translated = translate?.(key);
274
275
  return translated && translated !== key ? translated : copy_generated_default[key] ?? copy_generated_default["auth.feedback.unknown"];
@@ -278,8 +279,10 @@ function authFailure(raw, operation = "signIn", translate) {
278
279
  const payload = value.payload && typeof value.payload === "object" ? value.payload : value;
279
280
  const named = payload.code ?? value.code ?? value.kind;
280
281
  const status = value.statusCode ?? value.status;
282
+ const application = String(payload.details?.applicationError?.code ?? value.details?.applicationError?.code ?? payload.applicationCode ?? value.applicationCode ?? named ?? "");
281
283
  let code = codes.has(named) ? named : aliases[named] ?? "unknown";
282
- if (status === 429) code = "rate_limited";
284
+ if (operation === "signIn" && iamCredentialCodes.has(application)) code = "invalid_credentials";
285
+ else if (status === 429) code = "rate_limited";
283
286
  else if ([404, 405, 501].includes(status)) code = "unavailable";
284
287
  else if ([401, 403].includes(status) && operation === "signIn") code = "invalid_credentials";
285
288
  else if (status === 0 || status >= 500 || value.name === "TypeError" || value.name === "TimeoutError") code = "network";