Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

await with selectors #32

Open
Gozala opened this issue Apr 2, 2024 · 1 comment
Open

await with selectors #32

Gozala opened this issue Apr 2, 2024 · 1 comment

Comments

@Gozala
Copy link
Contributor

Gozala commented Apr 2, 2024

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 ucan-wg/delegation#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"
    }
  }
}
@expede
Copy link
Member

expede commented Apr 3, 2024

Works for me 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants