feat(share): return item metadata with a share

This commit is contained in:
Juan Castro
2026-08-13 17:16:39 -04:00
parent c1680bdf0c
commit 35832d3ce4
6 changed files with 10 additions and 2 deletions
@@ -246,6 +246,8 @@ export class ShareController extends PuterController {
holder: share.holder.username,
created_at: share.createdAt,
inherited_from: share.inheritedFrom ?? null,
modified: share.modified,
size: share.size,
};
}
+1 -1
View File
@@ -28,7 +28,7 @@ An object with the following properties:
## Return value
A `Promise` that resolves to an array of share objects, each with `uid`, `mode`, `path`, `entryUid`, `isDir`, `issuer`, `holder` and `inheritedFrom`.
A `Promise` that resolves to an array of share objects, each with `uid`, `mode`, `path`, `entryUid`, `isDir`, `issuer`, `holder`, `inheritedFrom`, `modified` and `size`.
`inheritedFrom` is the path of the shared ancestor an access comes from, or `null` when the share is on the item itself. Access inherited from a parent folder is **managed on that folder** — withdrawing it here is not possible, because the grant does not live on this item.
+1 -1
View File
@@ -27,7 +27,7 @@ An object with the following properties:
A `Promise` that resolves to an object with:
- `items` (Array) - The shares on this page. Each has `uid`, `mode`, `path`, `entryUid`, `isDir`, `issuer` and `holder`.
- `items` (Array) - The shares on this page. Each has `uid`, `mode`, `path`, `entryUid`, `isDir`, `issuer`, `holder`, `modified` and `size`.
- `cursor` (String) - Pass to the next call to get the following page. **Present only while more pages remain.**
- `total` (Number) - Present only when `includeTotal` was set.
+2
View File
@@ -56,6 +56,8 @@ A `Promise` that resolves to an array of share objects, one per recipient/item p
- `issuer` (String) - Username of whoever granted the share.
- `holder` (String) - Username of whoever received it.
- `inheritedFrom` (String) - Path of the shared ancestor this access comes from, or `null` when the share is on the item itself.
- `modified` (Number) - Last-modified time of the item, in unix seconds.
- `size` (Number) - Size of the item in bytes; `null` for a directory.
Sharing the same item with the same person again **replaces** their access rather than adding a second share, so raising someone from `read` to `write` is just another call.
@@ -66,4 +66,6 @@ export const toShare = (row) => ({
issuer: /** @type {string | null} */ (row.issuer ?? null),
holder: /** @type {string | null} */ (row.holder ?? null),
inheritedFrom: /** @type {string | null} */ (row.inherited_from ?? null),
modified: /** @type {number} */ (row.modified ?? 0),
size: /** @type {number | null} */ (row.size ?? null),
});
@@ -297,6 +297,8 @@
* @property {string | null} issuer Username of whoever granted it.
* @property {string | null} holder Username of whoever received it.
* @property {string | null} [inheritedFrom] Shared ancestor this access comes from, if any.
* @property {number} modified Last-modified time of the item, unix seconds.
* @property {number | null} size Size of the item in bytes; null for a directory.
*/
/**