ucan-wg / ucan-wg/invocation

await with selectors

Open
#32 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
20
Forks
7
PR merge metrics
No merged PRs in 30d

Description

We have discussed this in side channel, but I wanted to capture in the issue so it's available for others to followup on.

I have proposed that we replace await/ok, await/error, await/* custom promise pipelining operators with combination of general ucan/await that can work with jq like selectors that are been introduces into UCAN spec here https://github.com/ucan-wg/delegation/issues/5

Expectation is that selectors will behave as described in the table, if task selector result in output marked as ⛔️ (per table in the linked issue) failure supposed to propagate. Otherwise arguments supposed to substituted with the output of the selector.

Here is a proposed syntax for invocation spec

type Await union {
   AwaitOperand   "ucan/await"
} representation keyed

type AwaitOperand struct {
  selector String
  source   Any    
} representation tuple

here is example from the spec

{
  "bafy...getMailingList": {
    "sub": "did:key:zAlice",
    "cmd": "crud/read",
    "args": {
        "url": "https://exmaple.com/mailinglist"
     }
  },
  "bafy...sendEmail": {
    "sub": "did:key:zAlice",
    "cmd": "msg/send",
    "args": {
      "email": "alice@example.com",
      "to": { "ucan/await": [".out.ok.email", { "/": "bafy...getMailingList" }] }
      "title": "hello",
      "body": "world"
    }
  }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked UCAN delegation issue and the proposed Await operand syntax in this issue. Trace how the existing await/ok, await/error, and await/* operators are represented and processed in this repository. Done means a decided implementation of ucan/await selectors with argument substitution and failure propagation, plus the corresponding validation coverage.

Written by the indexing model from the issue text.

Assessment

Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.