yungle-cli 0.3.0 → 0.3.1

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.
package/README.md CHANGED
@@ -144,6 +144,6 @@ Desktop, Claude Code, Cursor and Windsurf, whichever you have. Restart the clien
144
144
 
145
145
  Your vault and end-to-end encrypted transfers are not reachable: their keys are derived in the
146
146
  browser and never sent to Yungle. `yungle get` on an end-to-end encrypted link says so and
147
- points you to the browser. See <https://yungle.co/developers/unsupported>.
147
+ points you to the browser. See <https://docs.yungle.co/unsupported>.
148
148
 
149
- Docs: <https://yungle.co/developers/cli?ref=npm> · Source: <https://github.com/heindewilde/yungle-clients> · MIT
149
+ Docs: <https://docs.yungle.co/cli?ref=npm> · Source: <https://github.com/heindewilde/yungle-clients> · MIT
package/dist/yungle.mjs CHANGED
@@ -378,7 +378,7 @@ function pageQuery(page, extra = {}) {
378
378
  const q = params.toString();
379
379
  return q ? `?${q}` : "";
380
380
  }
381
- var CLIENT_VERSION = true ? "0.3.0" : "dev";
381
+ var CLIENT_VERSION = true ? "0.3.2" : "dev";
382
382
  var YungleClient = class {
383
383
  baseUrl;
384
384
  apiKey;
@@ -418,6 +418,10 @@ var YungleClient = class {
418
418
  me() {
419
419
  return this.request("GET", "/me");
420
420
  }
421
+ /** Your invite code and link, and the free months it has earned. */
422
+ getReferral() {
423
+ return this.request("GET", "/me/referral");
424
+ }
421
425
  // ── Transfers ─────────────────────────────────────────────────────────────
422
426
  /**
423
427
  * One page of transfers, newest first — 100 by default, up to 500. Pass the
@@ -662,22 +666,31 @@ var YungleClient = class {
662
666
  const safe = method === "GET" || method === "DELETE" || idempotencyKey !== void 0 || opts?.idempotent === true;
663
667
  let attempt = 0;
664
668
  for (; ; ) {
665
- const res = await this.doFetch(`${this.baseUrl}${path}`, {
666
- method,
667
- headers: {
668
- Authorization: `Bearer ${this.apiKey}`,
669
- Accept: "application/json",
670
- "User-Agent": this.userAgent,
671
- ...idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {},
672
- ...body === void 0 ? {} : { "Content-Type": "application/json" }
673
- },
674
- ...body === void 0 ? {} : { body: JSON.stringify(body) }
675
- });
669
+ let res;
670
+ try {
671
+ res = await this.doFetch(`${this.baseUrl}${path}`, {
672
+ method,
673
+ headers: {
674
+ Authorization: `Bearer ${this.apiKey}`,
675
+ Accept: "application/json",
676
+ "User-Agent": this.userAgent,
677
+ ...idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {},
678
+ ...body === void 0 ? {} : { "Content-Type": "application/json" }
679
+ },
680
+ ...body === void 0 ? {} : { body: JSON.stringify(body) }
681
+ });
682
+ } catch (err) {
683
+ const aborted = err instanceof Error && (err.name === "AbortError" || err.name === "TimeoutError");
684
+ if (aborted || !safe || attempt >= this.maxRetries) throw err;
685
+ await sleep(backoffMs(attempt, null));
686
+ attempt++;
687
+ continue;
688
+ }
676
689
  if (res.ok) return await res.json();
677
690
  const error = await toError(res);
678
691
  const mayRetry = error.status === 429 || safe && error.retryable;
679
692
  if (!mayRetry || attempt >= this.maxRetries) throw error;
680
- await sleep(backoffMs(attempt, error));
693
+ await sleep(backoffMs(attempt, error.retryAfterSeconds));
681
694
  attempt++;
682
695
  }
683
696
  }
@@ -713,8 +726,7 @@ function parseRetryAfter(value, now = Date.now()) {
713
726
  const seconds = Math.ceil((at - now) / 1e3);
714
727
  return seconds >= 0 ? seconds : null;
715
728
  }
716
- function backoffMs(attempt, error) {
717
- const stated = error.retryAfterSeconds;
729
+ function backoffMs(attempt, stated) {
718
730
  if (stated !== null) return stated * 1e3;
719
731
  return Math.min(2 ** attempt * 500, 8e3) + Math.floor(Math.random() * 250);
720
732
  }
@@ -1061,7 +1073,7 @@ Global flags
1061
1073
  --yes never ask; for scripts
1062
1074
  --url <base> use another Yungle (development)
1063
1075
 
1064
- Run a command with --help for examples. Docs: https://yungle.co/developers/cli`;
1076
+ Run a command with --help for examples. Docs: https://docs.yungle.co/cli`;
1065
1077
  var COMMANDS = [
1066
1078
  "login",
1067
1079
  "whoami",
@@ -3179,6 +3191,14 @@ async function uploadOne(file, endpoint, onProgress, renewal) {
3179
3191
  */
3180
3192
  ...uploadUrl ? { uploadUrl } : {},
3181
3193
  uploadSize: size,
3194
+ /**
3195
+ * One server part per PATCH, never the whole file. tus-js-client's
3196
+ * default is a single PATCH for everything, and the proxy in front of
3197
+ * the upload service cuts any request at 30 minutes — so a big file on a
3198
+ * slow line failed at the same point on every retry. The same rule the
3199
+ * website and the extension follow (`chunkSize` from yungle-client).
3200
+ */
3201
+ chunkSize: chunkSize(size),
3182
3202
  /**
3183
3203
  * The token authorizes EVERY method, not just the creation POST — the
3184
3204
  * server verifies HEAD, PATCH and DELETE too. Metadata below only reaches
@@ -3271,7 +3291,7 @@ async function saveUploaded(dir, collectionId, uploaded) {
3271
3291
  }
3272
3292
 
3273
3293
  // src/index.ts
3274
- var CLI_VERSION = true ? "0.3.0" : "dev";
3294
+ var CLI_VERSION = true ? "0.3.1" : "dev";
3275
3295
  var USER_AGENT = `yungle-cli/${CLI_VERSION}`;
3276
3296
  async function main(argvIn) {
3277
3297
  const argv = resolveAlias(argvIn);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yungle-cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "description": "Send, receive and sync large files from your terminal or CI: resumable uploads up to 100 GB, private and EU-hosted. A WeTransfer alternative for the command line.",
6
6
  "bin": {
@@ -19,7 +19,7 @@
19
19
  "picocolors": "^1.1.1",
20
20
  "tsx": "^4.19.2",
21
21
  "typescript": "^5.7.3",
22
- "yungle-client": "0.3.0"
22
+ "yungle-client": "0.3.2"
23
23
  },
24
24
  "files": [
25
25
  "dist",
@@ -48,7 +48,7 @@
48
48
  "type": "git",
49
49
  "url": "git+https://github.com/heindewilde/yungle-clients.git"
50
50
  },
51
- "homepage": "https://yungle.co/developers/cli?ref=npm",
51
+ "homepage": "https://docs.yungle.co/cli?ref=npm",
52
52
  "bugs": {
53
53
  "url": "https://github.com/heindewilde/yungle-clients/issues"
54
54
  },