@przeprogramowani/10x-cli 1.25.2 → 1.25.3

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.
Files changed (2) hide show
  1. package/dist/index.mjs +4 -33
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -3183,7 +3183,7 @@ var cac = (name = "") => new CAC(name);
3183
3183
  // package.json
3184
3184
  var package_default = {
3185
3185
  name: "@przeprogramowani/10x-cli",
3186
- version: "1.25.2",
3186
+ version: "1.25.3",
3187
3187
  description: "Open-source CLI for 10xDevs course content",
3188
3188
  repository: {
3189
3189
  type: "git",
@@ -3359,7 +3359,6 @@ function updateToolConfig(patch) {
3359
3359
  import { hostname as osHostname, release as osRelease } from "node:os";
3360
3360
 
3361
3361
  // src/lib/api-client.ts
3362
- var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
3363
3362
  var DEFAULT_API_BASE = "https://10x-toolkit-api.przeprogramowani.workers.dev";
3364
3363
  var PROD_HOSTNAME = "10x-toolkit-api.przeprogramowani.workers.dev";
3365
3364
  var DEV_HOSTNAMES = new Set(["localhost", "127.0.0.1"]);
@@ -3402,7 +3401,6 @@ var ERROR_CODE_MESSAGES = {
3402
3401
  module_locked: "This module is not available yet.",
3403
3402
  signing_failed: "Could not sign the download URL. Try again in a moment.",
3404
3403
  invalid_json: "The server received a malformed request.",
3405
- email_changed: "Your email changed. Run `10x auth` to sign in again.",
3406
3404
  unauthorized: "You are not signed in. Run `10x auth` first.",
3407
3405
  no_membership: "No active course membership was found for this email.",
3408
3406
  invalid_refresh_token: "Your session has expired. Run `10x auth` again.",
@@ -3474,21 +3472,6 @@ async function request(method, path, body, options = {}) {
3474
3472
  }
3475
3473
  if (!response.ok) {
3476
3474
  const payload = parsed && typeof parsed === "object" ? parsed : undefined;
3477
- if ((payload?.code ?? payload?.error) === "email_changed" && options.token && readAuth()?.access_token === options.token) {
3478
- try {
3479
- const release = await import_proper_lockfile.default.lock(authFilePath(), {
3480
- realpath: false,
3481
- stale: 1e4,
3482
- retries: { retries: 5, factor: 2, minTimeout: 100, maxTimeout: 1000 }
3483
- });
3484
- try {
3485
- if (readAuth()?.access_token === options.token)
3486
- deleteAuth();
3487
- } finally {
3488
- await release();
3489
- }
3490
- } catch {}
3491
- }
3492
3475
  const mapped = messageForApiError(payload);
3493
3476
  let errorMessage;
3494
3477
  if (mapped) {
@@ -3508,13 +3491,7 @@ async function request(method, path, body, options = {}) {
3508
3491
  payload
3509
3492
  };
3510
3493
  }
3511
- return {
3512
- ok: true,
3513
- status: response.status,
3514
- data: parsed,
3515
- responseHeaders: response.headers,
3516
- rawBody: text
3517
- };
3494
+ return { ok: true, status: response.status, data: parsed, responseHeaders: response.headers, rawBody: text };
3518
3495
  }
3519
3496
  function apiGet(path, options = {}) {
3520
3497
  return request("GET", path, undefined, options);
@@ -3676,7 +3653,7 @@ async function pollCircleLogin(deviceCode, options = {}) {
3676
3653
  }
3677
3654
 
3678
3655
  // src/lib/auth-guard.ts
3679
- var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
3656
+ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
3680
3657
  import { mkdirSync as mkdirSync2 } from "node:fs";
3681
3658
  import { dirname } from "node:path";
3682
3659
 
@@ -3751,7 +3728,7 @@ function isNearExpiry(auth, windowMs = DEFAULT_REFRESH_WINDOW_MS, now = new Date
3751
3728
  async function acquireRefreshLock(ctx, lockTarget) {
3752
3729
  try {
3753
3730
  mkdirSync2(dirname(lockTarget), { recursive: true });
3754
- return await import_proper_lockfile2.default.lock(lockTarget, {
3731
+ return await import_proper_lockfile.default.lock(lockTarget, {
3755
3732
  realpath: false,
3756
3733
  stale: LOCK_STALE_MS,
3757
3734
  retries: {
@@ -3809,12 +3786,6 @@ async function requireAuth(ctx, options = {}) {
3809
3786
  persist(next);
3810
3787
  return next;
3811
3788
  }
3812
- if (refreshed.code === "email_changed") {
3813
- try {
3814
- (options.remove ?? deleteAuth)();
3815
- } catch {}
3816
- outputError(ctx, "email_changed", "Your email changed. Sign in again.", ExitCodes.AUTH_REQUIRED, "Run '10x auth' to log in.");
3817
- }
3818
3789
  if (forced) {
3819
3790
  outputError(ctx, refreshed.code, refreshed.error, refreshed.status === 403 ? ExitCodes.FORBIDDEN : refreshed.status === 401 ? ExitCodes.AUTH_REQUIRED : ExitCodes.ERROR);
3820
3791
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@przeprogramowani/10x-cli",
3
- "version": "1.25.2",
3
+ "version": "1.25.3",
4
4
  "description": "Open-source CLI for 10xDevs course content",
5
5
  "repository": {
6
6
  "type": "git",