@seed-hypermedia/cli 0.0.10 → 0.0.11

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -72606,8 +72606,19 @@ async function createCapability2(input, signer) {
72606
72606
  unsigned.sig = await signObject(signer, unsigned);
72607
72607
  return toPublishInput(encode4(unsigned));
72608
72608
  }
72609
+ async function resolveCapability2(client, targetAccount, signerAccount) {
72610
+ if (targetAccount === signerAccount)
72611
+ return;
72612
+ const targetId = unpackHmId(`hm://${targetAccount}`);
72613
+ if (!targetId)
72614
+ return;
72615
+ const caps = await client.request("ListCapabilities", { targetId });
72616
+ const match = caps.capabilities.find((c) => c.delegate === signerAccount && (c.role === "WRITER" || c.role === "AGENT"));
72617
+ return match?.id;
72618
+ }
72609
72619
  var init_capability = __esm(() => {
72610
72620
  init_src();
72621
+ init_hm_types();
72611
72622
  init_base58();
72612
72623
  init_signing();
72613
72624
  });
@@ -138323,6 +138334,7 @@ __export(exports_src2, {
138323
138334
  resolveHypermediaUrl: () => resolveHypermediaUrl,
138324
138335
  resolveFileLinksInBlocks: () => resolveFileLinksInBlocks2,
138325
138336
  resolveDocumentState: () => resolveDocumentState2,
138337
+ resolveCapability: () => resolveCapability2,
138326
138338
  pushSpanToAnnotation: () => pushSpanToAnnotation2,
138327
138339
  processFulltextDocument: () => processFulltextDocument2,
138328
138340
  pdfToBlocks: () => pdfToBlocks2,
@@ -165524,16 +165536,6 @@ async function resolveFileLinks(nodes) {
165524
165536
  }
165525
165537
 
165526
165538
  // src/commands/document.ts
165527
- async function resolveCapability(client, targetAccount, signerAccount) {
165528
- if (targetAccount === signerAccount)
165529
- return;
165530
- const targetId = unpackHmId3(`hm://${targetAccount}`);
165531
- if (!targetId)
165532
- return;
165533
- const caps = await client.request("ListCapabilities", { targetId });
165534
- const match = caps.capabilities.find((c) => c.delegate === signerAccount && (c.role === "WRITER" || c.role === "AGENT"));
165535
- return match?.id;
165536
- }
165537
165539
  async function readStdinBinary() {
165538
165540
  const chunks = [];
165539
165541
  for await (const chunk of process.stdin) {
@@ -165743,7 +165745,7 @@ function registerDocumentCommands(program2) {
165743
165745
  const account = options2.account || key.accountId;
165744
165746
  let capability;
165745
165747
  if (options2.account && options2.account !== key.accountId) {
165746
- capability = await resolveCapability(client, options2.account, key.accountId);
165748
+ capability = await resolveCapability2(client, options2.account, key.accountId);
165747
165749
  if (!capability) {
165748
165750
  throw new Error(`No WRITER or AGENT capability found for key ${key.accountId} on account ${options2.account}. ` + `Use "account capabilities hm://${options2.account}" to check available capabilities.`);
165749
165751
  }
@@ -165874,7 +165876,7 @@ function registerDocumentCommands(program2) {
165874
165876
  const depCids = state.heads.map((h2) => CID.parse(h2));
165875
165877
  const newDepth = state.headDepth + 1;
165876
165878
  const signer = createSignerFromKey(key);
165877
- const capability = await resolveCapability(client, docAccount, key.accountId);
165879
+ const capability = await resolveCapability2(client, docAccount, key.accountId);
165878
165880
  const { unsignedBytes, ts } = createChangeOps({ ops, genesisCid, deps: depCids, depth: newDepth });
165879
165881
  const changeBlock = await createChange(unsignedBytes, signer);
165880
165882
  const generation = Number(ts);
@@ -165918,7 +165920,7 @@ function registerDocumentCommands(program2) {
165918
165920
  }
165919
165921
  const doc2 = resource.document;
165920
165922
  const generation = doc2.generationInfo ? Number(doc2.generationInfo.generation) : 0;
165921
- const capability = await resolveCapability(client, unpacked.uid, key.accountId);
165923
+ const capability = await resolveCapability2(client, unpacked.uid, key.accountId);
165922
165924
  const refInput = await createTombstoneRef({
165923
165925
  space: unpacked.uid,
165924
165926
  path: hmIdPathToEntityQueryPath3(unpacked.path),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-hypermedia/cli",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/seed-hypermedia/seed.git",