@seed-hypermedia/client 0.0.31 → 0.0.32

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.
@@ -23,5 +23,9 @@ export declare function createCapability(input: CreateCapabilityInput, signer: H
23
23
  /**
24
24
  * Find a WRITER or AGENT capability for `signerAccount` on `targetAccount`.
25
25
  * Returns the capability CID if found, undefined if not needed (same account) or not found.
26
+ *
27
+ * @param path - The document path being written to (e.g. "/podcasts"). When provided,
28
+ * ListCapabilities is queried with this path so the backend returns capabilities
29
+ * scoped to that path (or any ancestor path that covers it).
26
30
  */
27
- export declare function resolveCapability(client: SeedClient, targetAccount: string, signerAccount: string): Promise<string | undefined>;
31
+ export declare function resolveCapability(client: SeedClient, targetAccount: string, signerAccount: string, path?: string): Promise<string | undefined>;
package/dist/index.mjs CHANGED
@@ -71,10 +71,20 @@ async function createCapability(input, signer) {
71
71
  unsigned.sig = await signObject(signer, unsigned);
72
72
  return toPublishInput(cborEncode2(unsigned));
73
73
  }
74
- async function resolveCapability(client, targetAccount, signerAccount) {
74
+ async function resolveCapability(client, targetAccount, signerAccount, path) {
75
75
  if (targetAccount === signerAccount) return void 0;
76
- const targetId = unpackHmId(`hm://${targetAccount}`);
77
- if (!targetId) return void 0;
76
+ const pathSegments = path ? entityQueryPathToHmIdPath(path) : null;
77
+ const targetId = {
78
+ id: packBaseId(targetAccount, pathSegments),
79
+ uid: targetAccount,
80
+ path: pathSegments,
81
+ version: null,
82
+ blockRef: null,
83
+ blockRange: null,
84
+ hostname: null,
85
+ latest: true,
86
+ scheme: null
87
+ };
78
88
  const caps = await client.request("ListCapabilities", { targetId });
79
89
  const match = caps.capabilities.find(
80
90
  (c) => c.delegate === signerAccount && (c.role === "WRITER" || c.role === "AGENT")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-hypermedia/client",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/seed-hypermedia/seed",