@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.
@@ -1472,8 +1472,8 @@ declare class Endpoint<T extends Endpoint<T>> {
1472
1472
  private exchange;
1473
1473
  private storeExchangedToken;
1474
1474
  /**
1475
- * A token that already carries an account, or that the compute API refuses as an exchanged
1476
- * token ("API key or user login required"), is used as is. Any other refusal is raised.
1475
+ * A token that already carries an account, or that the compute API refuses to exchange
1476
+ * (see NOT_EXCHANGEABLE), is used as is. Any other refusal is raised.
1477
1477
  */
1478
1478
  private exchangeLoginToken;
1479
1479
  private currentAccessToken;
@@ -1472,8 +1472,8 @@ declare class Endpoint<T extends Endpoint<T>> {
1472
1472
  private exchange;
1473
1473
  private storeExchangedToken;
1474
1474
  /**
1475
- * A token that already carries an account, or that the compute API refuses as an exchanged
1476
- * token ("API key or user login required"), is used as is. Any other refusal is raised.
1475
+ * A token that already carries an account, or that the compute API refuses to exchange
1476
+ * (see NOT_EXCHANGEABLE), is used as is. Any other refusal is raised.
1477
1477
  */
1478
1478
  private exchangeLoginToken;
1479
1479
  private currentAccessToken;
@@ -9045,7 +9045,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9045
9045
 
9046
9046
  // endpoint.ts
9047
9047
  var ACCOUNT_CLAIM = "https://ident.eyepop.ai/account-uuid";
9048
- var M2M_REFUSAL = "API key or user login required";
9048
+ var NOT_EXCHANGEABLE = ["API key or user login required", "API key authentication required for token refresh"];
9049
9049
  function carriesAccount(token) {
9050
9050
  try {
9051
9051
  const payload = (token.split(".")[1] ?? "").replace(/-/g, "+").replace(/_/g, "/");
@@ -9242,13 +9242,14 @@ var Endpoint = class {
9242
9242
  this._expire_token_time = now + token.expires_in - 60;
9243
9243
  }
9244
9244
  /**
9245
- * A token that already carries an account, or that the compute API refuses as an exchanged
9246
- * token ("API key or user login required"), is used as is. Any other refusal is raised.
9245
+ * A token that already carries an account, or that the compute API refuses to exchange
9246
+ * (see NOT_EXCHANGEABLE), is used as is. Any other refusal is raised.
9247
9247
  */
9248
9248
  async exchangeLoginToken(client, loginToken, validUntil, now) {
9249
9249
  if (!carriesAccount(loginToken)) {
9250
9250
  const response = await this.exchange(client, loginToken, this._options.accountId);
9251
- if (response.status != 401 || !(await response.clone().text()).includes(M2M_REFUSAL)) {
9251
+ const refusal = response.status == 401 ? await response.clone().text() : "";
9252
+ if (!NOT_EXCHANGEABLE.some((message) => refusal.includes(message))) {
9252
9253
  await this.storeExchangedToken(response, now);
9253
9254
  return;
9254
9255
  }
@@ -14596,17 +14597,17 @@ var EyePop;
14596
14597
  if (typeof auth.oAuth2 === "boolean") {
14597
14598
  const oAuth2 = opts.eyepopUrl && opts.eyepopUrl.match(/https:(.*).staging.eyepop.xyz/i) ? {
14598
14599
  oAuth2: {
14599
- domain: "dev-eyepop.us.auth0.com",
14600
+ domain: "auth0.eyepop.xyz",
14600
14601
  clientId: "jktx3YO2UnbkNPvr05PQWf26t1kNTJyg",
14601
14602
  audience: "https://dev-app.eyepop.ai",
14602
- scope: "admin:clouds access:inference-api access:datasets"
14603
+ scope: "access:inference-api access:datasets"
14603
14604
  }
14604
14605
  } : {
14605
14606
  oAuth2: {
14606
- domain: "eyepop.us.auth0.com",
14607
+ domain: "auth0.eyepop.ai",
14607
14608
  clientId: "Lb9ubA9Hf3jlaqWLUx8XgA0zvotgViCl",
14608
14609
  audience: "https://api.eyepop.ai",
14609
- scope: "admin:clouds access:inference-api access:datasets"
14610
+ scope: "access:inference-api access:datasets"
14610
14611
  }
14611
14612
  };
14612
14613
  if (opts.oAuth2 !== void 0) {