@toon-protocol/rig 4.6.0 → 4.7.0

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.
@@ -52,9 +52,14 @@ import {
52
52
  updateRef,
53
53
  writeGitObjects,
54
54
  writeToonConfig
55
- } from "./chunk-DCGV6ALH.js";
55
+ } from "./chunk-3IVO2MSZ.js";
56
+ import {
57
+ PREFERRED_GATEWAY,
58
+ mirrorGatewaysFor,
59
+ readGateways,
60
+ shaResolverFor
61
+ } from "./chunk-XQ2AWNHQ.js";
56
62
  import {
57
- ARWEAVE_GATEWAYS,
58
63
  COMMENT_KIND,
59
64
  DEFAULT_KEYSTORE_PASSWORD,
60
65
  LEGACY_COMMENT_KIND,
@@ -77,7 +82,7 @@ import {
77
82
  readClientConfigFile,
78
83
  resolveAccountIndex,
79
84
  resolveIdentity
80
- } from "./chunk-JBFBD7HV.js";
85
+ } from "./chunk-S3KKQ4IC.js";
81
86
  import {
82
87
  ChannelMapStore,
83
88
  channelStatus,
@@ -90,21 +95,6 @@ import {
90
95
  uploadChargeFor
91
96
  } from "./chunk-U5A7MHBP.js";
92
97
 
93
- // src/gateway-preference.ts
94
- var TESTNET_GATEWAY = /(^|\.)ar-io\.dev$/i;
95
- function isMainnetGateway(url) {
96
- try {
97
- return !TESTNET_GATEWAY.test(new URL(url).hostname);
98
- } catch {
99
- return false;
100
- }
101
- }
102
- var PREFERRED_GATEWAY = ARWEAVE_GATEWAYS.find(isMainnetGateway) ?? "https://arweave.net";
103
- function mirrorGatewaysFor(primary) {
104
- const p = primary.replace(/\/+$/, "");
105
- return ARWEAVE_GATEWAYS.filter((g) => g.replace(/\/+$/, "") !== p);
106
- }
107
-
108
98
  // src/cli/render.ts
109
99
  function describeAnnouncementDiff(diff) {
110
100
  return [
@@ -320,7 +310,7 @@ function loadPaidSession(deps, relayUrl) {
320
310
  });
321
311
  }
322
312
  var defaultLoadStandalone = async (options) => {
323
- const mod = await import("./standalone-mode-UQSP4677.js");
313
+ const mod = await import("./standalone-mode-FY3XVQQK.js");
324
314
  return mod.createStandaloneContext(options);
325
315
  };
326
316
  function identityReport(ctx) {
@@ -2485,7 +2475,7 @@ async function runCi(args, deps) {
2485
2475
  case "status":
2486
2476
  return runCiStatus(rest, deps);
2487
2477
  case "serve":
2488
- return (await import("./ci-serve-AYFZOY4O.js")).runCiServe(rest, deps);
2478
+ return (await import("./ci-serve-T33FCQVT.js")).runCiServe(rest, deps);
2489
2479
  case "--help":
2490
2480
  case "-h":
2491
2481
  case "help":
@@ -2525,6 +2515,11 @@ from Arweave gateways. A clone right after a push may report missing
2525
2515
  objects \u2014 retry after propagation.
2526
2516
 
2527
2517
  Options:
2518
+ --gateway <url> gateway to read objects through FIRST, on its raw-bytes
2519
+ route <url>/raw/<txId>, ahead of the public gateway
2520
+ list \u2014 name a private, local or air-gapped gateway to
2521
+ clone a repo the public ones do not carry
2522
+ (env RIG_ARWEAVE_GATEWAY also sets it)
2528
2523
  --concurrency <n> parallel gateway downloads (default 8)
2529
2524
  --json machine-readable result envelope
2530
2525
  -h, --help show this help`;
@@ -2551,6 +2546,7 @@ function parseCloneArgs(args) {
2551
2546
  options: {
2552
2547
  json: { type: "boolean", default: false },
2553
2548
  concurrency: { type: "string" },
2549
+ gateway: { type: "string" },
2554
2550
  help: { type: "boolean", short: "h", default: false }
2555
2551
  },
2556
2552
  allowPositionals: true
@@ -2586,6 +2582,7 @@ function parseCloneArgs(args) {
2586
2582
  repoId,
2587
2583
  dir,
2588
2584
  concurrency,
2585
+ gateway: values.gateway,
2589
2586
  json: values.json === true
2590
2587
  };
2591
2588
  }
@@ -2634,7 +2631,9 @@ async function runClone(args, deps) {
2634
2631
  ownerPubkey: owner,
2635
2632
  repoId,
2636
2633
  ...deps.webSocketFactory ? { webSocketFactory: deps.webSocketFactory } : {},
2637
- ...deps.resolveSha ? { resolveSha: deps.resolveSha } : {}
2634
+ // The GraphQL fallback for SHAs the map does not cover asks the SAME
2635
+ // permaweb the objects are read from (#183).
2636
+ resolveSha: deps.resolveSha ?? shaResolverFor(parsed.gateway, deps.env)
2638
2637
  });
2639
2638
  if (!remoteState.announced && remoteState.refsEvent === null) {
2640
2639
  throw new RepoNotFoundError(relayUrl, owner, repoId);
@@ -2659,6 +2658,8 @@ async function runClone(args, deps) {
2659
2658
  tips,
2660
2659
  shaToTxId: remoteState.shaToTxId,
2661
2660
  resolveMissing: (shas) => remoteState.resolveMissing(shas),
2661
+ // `--gateway` / RIG_ARWEAVE_GATEWAY first, public list behind it (#176).
2662
+ gateways: readGateways(parsed.gateway, deps.env),
2662
2663
  ...deps.fetchFn ? { fetchFn: deps.fetchFn } : {},
2663
2664
  ...parsed.concurrency !== void 0 ? { concurrency: parsed.concurrency } : {}
2664
2665
  });
@@ -4256,6 +4257,11 @@ Options:
4256
4257
  --repo-id <id> repository id / NIP-34 d-tag (default: git config)
4257
4258
  --owner <pubkey> repository owner (npub or 64-char hex; default: git config)
4258
4259
  --relay <url> ad-hoc relay override \u2014 bypasses the remote's URL
4260
+ --gateway <url> gateway to read objects through FIRST, on its raw-bytes
4261
+ route <url>/raw/<txId>, ahead of the public gateway
4262
+ list \u2014 name a private, local or air-gapped gateway to
4263
+ fetch objects the public ones do not carry
4264
+ (env RIG_ARWEAVE_GATEWAY also sets it)
4259
4265
  --concurrency <n> parallel gateway downloads (default 8)
4260
4266
  --json machine-readable result envelope
4261
4267
  -h, --help show this help`;
@@ -4288,6 +4294,7 @@ async function runFetch(args, deps) {
4288
4294
  let relayFlag;
4289
4295
  let repoIdFlag;
4290
4296
  let ownerFlag;
4297
+ let gatewayFlag;
4291
4298
  let concurrency;
4292
4299
  try {
4293
4300
  const { values, positionals } = parseArgs10({
@@ -4297,6 +4304,7 @@ async function runFetch(args, deps) {
4297
4304
  relay: { type: "string" },
4298
4305
  "repo-id": { type: "string" },
4299
4306
  owner: { type: "string" },
4307
+ gateway: { type: "string" },
4300
4308
  concurrency: { type: "string" },
4301
4309
  help: { type: "boolean", short: "h", default: false }
4302
4310
  },
@@ -4316,6 +4324,7 @@ async function runFetch(args, deps) {
4316
4324
  relayFlag = values.relay;
4317
4325
  repoIdFlag = values["repo-id"];
4318
4326
  ownerFlag = values.owner !== void 0 ? ownerToHex(values.owner) : void 0;
4327
+ gatewayFlag = values.gateway;
4319
4328
  if (values.concurrency !== void 0) {
4320
4329
  concurrency = Number.parseInt(values.concurrency, 10);
4321
4330
  if (!Number.isSafeInteger(concurrency) || concurrency < 1) {
@@ -4354,7 +4363,9 @@ async function runFetch(args, deps) {
4354
4363
  ownerPubkey: owner,
4355
4364
  repoId,
4356
4365
  ...deps.webSocketFactory ? { webSocketFactory: deps.webSocketFactory } : {},
4357
- ...deps.resolveSha ? { resolveSha: deps.resolveSha } : {}
4366
+ // The GraphQL fallback for SHAs the map does not cover asks the SAME
4367
+ // permaweb the objects are read from (#183).
4368
+ resolveSha: deps.resolveSha ?? shaResolverFor(gatewayFlag, deps.env)
4358
4369
  });
4359
4370
  const planned = [];
4360
4371
  for (const [refname, sha] of remoteState.refs) {
@@ -4381,6 +4392,8 @@ async function runFetch(args, deps) {
4381
4392
  shaToTxId: remoteState.shaToTxId,
4382
4393
  resolveMissing: (shas) => remoteState.resolveMissing(shas),
4383
4394
  presentLocally,
4395
+ // `--gateway` / RIG_ARWEAVE_GATEWAY first, public list behind it (#176).
4396
+ gateways: readGateways(gatewayFlag, deps.env),
4384
4397
  ...deps.fetchFn ? { fetchFn: deps.fetchFn } : {},
4385
4398
  ...concurrency !== void 0 ? { concurrency } : {}
4386
4399
  });
@@ -7967,7 +7980,6 @@ async function dispatch(argv, deps) {
7967
7980
  }
7968
7981
 
7969
7982
  export {
7970
- PREFERRED_GATEWAY,
7971
7983
  renderIdentityLine,
7972
7984
  withForcedStandalone,
7973
7985
  loadPaidSession,
@@ -7976,4 +7988,4 @@ export {
7976
7988
  rigVersion,
7977
7989
  dispatch
7978
7990
  };
7979
- //# sourceMappingURL=chunk-X232W4TG.js.map
7991
+ //# sourceMappingURL=chunk-J6Y3U645.js.map