@eyepop.ai/eyepop 3.25.5 → 3.25.7

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.
@@ -8929,7 +8929,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
8929
8929
 
8930
8930
  // endpoint.ts
8931
8931
  var ACCOUNT_CLAIM = "https://ident.eyepop.ai/account-uuid";
8932
- var M2M_REFUSAL = "API key or user login required";
8932
+ var NOT_EXCHANGEABLE = ["API key or user login required", "API key authentication required for token refresh"];
8933
8933
  function carriesAccount(token) {
8934
8934
  try {
8935
8935
  const payload = (token.split(".")[1] ?? "").replace(/-/g, "+").replace(/_/g, "/");
@@ -9126,13 +9126,14 @@ var Endpoint = class {
9126
9126
  this._expire_token_time = now + token.expires_in - 60;
9127
9127
  }
9128
9128
  /**
9129
- * A token that already carries an account, or that the compute API refuses as an exchanged
9130
- * token ("API key or user login required"), is used as is. Any other refusal is raised.
9129
+ * A token that already carries an account, or that the compute API refuses to exchange
9130
+ * (see NOT_EXCHANGEABLE), is used as is. Any other refusal is raised.
9131
9131
  */
9132
9132
  async exchangeLoginToken(client, loginToken, validUntil, now) {
9133
9133
  if (!carriesAccount(loginToken)) {
9134
9134
  const response = await this.exchange(client, loginToken, this._options.accountId);
9135
- if (response.status != 401 || !(await response.clone().text()).includes(M2M_REFUSAL)) {
9135
+ const refusal = response.status == 401 ? await response.clone().text() : "";
9136
+ if (!NOT_EXCHANGEABLE.some((message) => refusal.includes(message))) {
9136
9137
  await this.storeExchangedToken(response, now);
9137
9138
  return;
9138
9139
  }
@@ -14480,17 +14481,17 @@ var EyePop;
14480
14481
  if (typeof auth.oAuth2 === "boolean") {
14481
14482
  const oAuth2 = opts.eyepopUrl && opts.eyepopUrl.match(/https:(.*).staging.eyepop.xyz/i) ? {
14482
14483
  oAuth2: {
14483
- domain: "dev-eyepop.us.auth0.com",
14484
+ domain: "auth0.eyepop.xyz",
14484
14485
  clientId: "jktx3YO2UnbkNPvr05PQWf26t1kNTJyg",
14485
14486
  audience: "https://dev-app.eyepop.ai",
14486
- scope: "admin:clouds access:inference-api access:datasets"
14487
+ scope: "access:inference-api access:datasets"
14487
14488
  }
14488
14489
  } : {
14489
14490
  oAuth2: {
14490
- domain: "eyepop.us.auth0.com",
14491
+ domain: "auth0.eyepop.ai",
14491
14492
  clientId: "Lb9ubA9Hf3jlaqWLUx8XgA0zvotgViCl",
14492
14493
  audience: "https://api.eyepop.ai",
14493
- scope: "admin:clouds access:inference-api access:datasets"
14494
+ scope: "access:inference-api access:datasets"
14494
14495
  }
14495
14496
  };
14496
14497
  if (opts.oAuth2 !== void 0) {