@tinycloud/cli 1.2.3-beta.4 → 1.2.3-beta.5
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/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/tc-cli/REFERENCE.md +2 -2
package/dist/index.js
CHANGED
|
@@ -18763,15 +18763,18 @@ function createShareAuthorityAdapters(input = {}) {
|
|
|
18763
18763
|
};
|
|
18764
18764
|
const nativeReader = async (link2) => {
|
|
18765
18765
|
const { TinyCloudNode: TinyCloudNode2 } = await import("@tinycloud/node-sdk");
|
|
18766
|
+
const sharing = input.nativeSharing ?? ((host) => new TinyCloudNode2({ ...host === void 0 ? {} : { host }, autoDiscoverLocalNode: false }).sharing);
|
|
18766
18767
|
const token = parseNativeShareUrl(link2);
|
|
18767
|
-
const
|
|
18768
|
-
const decoded = decoder.sharing.decodeLink(token);
|
|
18768
|
+
const decoded = sharing(void 0).decodeLink(token);
|
|
18769
18769
|
if (typeof decoded.host !== "string") throw new Error("native share has no owner Node");
|
|
18770
|
-
const
|
|
18771
|
-
const
|
|
18770
|
+
const received = await sharing(canonicalOrigin2(decoded.host, "owner node origin")).receive(token, { autoSubdelegate: false, useSessionKey: false });
|
|
18771
|
+
const value = received.ok ? await received.data.kv.get("", { binary: true }) : void 0;
|
|
18772
|
+
const failure = !received.ok ? received.error : value !== void 0 && !value.ok ? value.error : void 0;
|
|
18773
|
+
if (failure?.meta?.status === 401 && /: 401 - (?:Invalid invocation: )?delegation-revoked: [A-Za-z0-9]+\s*$/.test(failure.message)) {
|
|
18774
|
+
throw new CLIError("SHARE_REVOKED", "This share link has been revoked by its sender.", ExitCode.NOT_FOUND);
|
|
18775
|
+
}
|
|
18772
18776
|
if (!received.ok) throw new Error("native share could not be verified");
|
|
18773
|
-
|
|
18774
|
-
if (!value.ok || !(value.data.data instanceof Uint8Array)) throw new Error("native share content could not be read");
|
|
18777
|
+
if (value === void 0 || !value.ok || !(value.data.data instanceof Uint8Array)) throw new Error("native share content could not be read");
|
|
18775
18778
|
return { bytes: value.data.data.slice(), filename: received.data.path.split("/").at(-1) || "share.md" };
|
|
18776
18779
|
};
|
|
18777
18780
|
return {
|