import {
  isSessionExpiredError
} from "./chunk-7RELQJIN.js";

// runtime/subsystems/auth/runtime/with-auth-retry.ts
async function withAuthRetry(authStrategy, connectionId, op, options = {}) {
  const classify = options.isSessionExpired ?? isSessionExpiredError;
  let creds = await authStrategy.resolve(connectionId);
  try {
    return await op(creds);
  } catch (e) {
    if (!classify(e)) throw e;
    creds = await authStrategy.resolve(connectionId, { forceRefresh: true });
    return op(creds);
  }
}

export {
  withAuthRetry
};
//# sourceMappingURL=chunk-WL67FZGF.js.map