@tinycloud/share-sdk 1.1.0-beta.2 → 1.1.1-beta.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.
- package/dist/index.cjs +7 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -8177,7 +8177,7 @@ async function revokeShare(input) {
|
|
|
8177
8177
|
if (delegationCid === void 0) return { state: "unsupported", target, reason: "share has no node-enforced delegation receipt", code: "unsupported-target" };
|
|
8178
8178
|
if (target === "bearer") {
|
|
8179
8179
|
if (input.adapter.revokeDelegation === void 0) return { state: "unsupported", target, reason: "native delegation revocation authority is required", code: "unsupported-target" };
|
|
8180
|
-
await input.adapter.revokeDelegation({ delegationCid, scope });
|
|
8180
|
+
await input.adapter.revokeDelegation({ delegationCid, scope, record: input.record });
|
|
8181
8181
|
} else {
|
|
8182
8182
|
if (input.record.ownerDid === void 0) return { state: "unsupported", target, reason: "share has no Policy/v3 owner receipt", code: "unsupported-target" };
|
|
8183
8183
|
if (input.adapter.revokePolicyRoot === void 0) return { state: "unsupported", target, reason: "Policy/v3 root revocation authority is required", code: "unsupported-target" };
|
|
@@ -8189,11 +8189,14 @@ async function revokeShare(input) {
|
|
|
8189
8189
|
nodeAudience: policyNodeAudience(input.record)
|
|
8190
8190
|
});
|
|
8191
8191
|
}
|
|
8192
|
-
|
|
8192
|
+
let revokedAt = input.record.revokedAt ?? (input.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
|
|
8193
8193
|
if (input.records?.update !== void 0) {
|
|
8194
|
-
await input.records.update(input.record.shareId, (record) => ({ ...record, revokedAt }));
|
|
8194
|
+
const updated = await input.records.update(input.record.shareId, (record) => ({ ...record, revokedAt: record.revokedAt ?? revokedAt }));
|
|
8195
|
+
revokedAt = updated?.revokedAt ?? revokedAt;
|
|
8195
8196
|
} else if (input.records !== void 0) {
|
|
8196
|
-
await input.records.
|
|
8197
|
+
const latest = await input.records.get(input.record.shareId);
|
|
8198
|
+
revokedAt = latest?.revokedAt ?? revokedAt;
|
|
8199
|
+
await input.records.put({ ...latest ?? input.record, revokedAt });
|
|
8197
8200
|
}
|
|
8198
8201
|
return { state: "revoked", target, delegationCid, revokedAt };
|
|
8199
8202
|
}
|