buckyos 0.7.164 → 0.7.165

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.
@@ -480,10 +480,21 @@ function objectEndpoint(url, origin, currentZone) {
480
480
  return `${base}/kapi/${url.host.name}/obj${formatObjectUrl(url).slice(`obj://${url.host.name}`.length)}`;
481
481
  if (url.kind === "cyfs_path" && (url.zone === null || url.zone === currentZone))
482
482
  return `${base}/kapi/dfs/obj${url.path.replace(/\/+$/, "")}`;
483
+ if (url.kind === "cyfs_object") {
484
+ const from = url.sourceZone && url.sourceZone !== currentZone ? `https://${url.sourceZone}` : base;
485
+ const inner = url.innerPath.replace(/^\/+|\/+$/g, "");
486
+ return `${from}/ndn/${url.objId.toString()}${inner ? `/@/${inner}` : ""}`;
487
+ }
483
488
  if (url.kind === "web")
484
489
  return url.url;
485
490
  return null;
486
491
  }
492
+ function ndnReadUrl(origin, objId, hint) {
493
+ const url = `${origin.replace(/\/+$/, "")}/ndn/${objId}`;
494
+ if (!hint || hint.path === void 0 && hint.token === void 0)
495
+ return url;
496
+ return `${url}?hint=${encodeURIComponent(canonicalJson(hint))}`;
497
+ }
487
498
  function normalizeObjectUrl(input) {
488
499
  return formatObjectUrl(parseObjectUrl(input));
489
500
  }
@@ -695,6 +706,7 @@ const object_url = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
695
706
  formatObjectUrl,
696
707
  isObjServiceName,
697
708
  keventSegment,
709
+ ndnReadUrl,
698
710
  normalizeObjectUrl,
699
711
  objEntityUrl,
700
712
  objEventKey,
@@ -990,6 +1002,18 @@ class BucketClient {
990
1002
  get(bucketId, key, version2) {
991
1003
  return this.call("bucket.get", { bucket_id: bucketId, key, version: version2 });
992
1004
  }
1005
+ /**
1006
+ * Asks the Zone to download a file that is already anonymously readable at another
1007
+ * Zone's `https://<zone>/ndn/<root_obj_id>` and re-serve it on `/ndn/`. Accepted now,
1008
+ * readable once a real download verified it.
1009
+ */
1010
+ cachePublic(rootObjId, source) {
1011
+ return this.call("bucket.cache_public", { root_obj_id: rootObjId, source });
1012
+ }
1013
+ /** Starts pulling ambient content that is not here; `bucket.head` shows `fetching` meanwhile. */
1014
+ prefetch(bucketId, prefix = "") {
1015
+ return this.call("bucket.prefetch", { bucket_id: bucketId, prefix });
1016
+ }
993
1017
  head(bucketId, key, version2) {
994
1018
  return this.call("bucket.head", { bucket_id: bucketId, key, version: version2 });
995
1019
  }
@@ -30779,4 +30803,4 @@ export {
30779
30803
  NOTIFY_SESSION_PREFIX as y,
30780
30804
  NOTIFY_CHOICE_CONTROL_ID as z
30781
30805
  };
30782
- //# sourceMappingURL=executor_client-86315a2f.mjs.map
30806
+ //# sourceMappingURL=executor_client-f9908517.mjs.map