jmapio / jmapio/jmap

update multiple records via ResultReference

Open
#315 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Makefile
Stars
1.4k
Forks
100
Avg merge
18h 7m
Merged PRs (30d)
2

Description

Apologies if I missed it, but there doesn't seem to be a way to use a ResultReference to do a /set completely server-side. I think there are a number of good use-cases for being able to do this efficiently (mostly around updating based on a query), and I think it could be done with fairly minimal modifications to the spec. I'm imagining the ResultReference type gaining a new (optional) property -- call it properties or setProps or something -- that would cause the reference to resolve to a JSON object with the keys being taken from the pointer resolution, and values being whatever you pass. For example:

[["Email/query", {
    "accountId": "a1",
    "filter": {"from": "nobody"}
}, "eq"],
["Email/set", {
    "accountId": "a1",
    "#update": {
        "resultOf": "eq",
        "name": "Email/query",
        "path": "/ids",
        "properties": {
            "keywords/from-nobody": true
        }
    }
}, "es"]]

If the Email/query call returned {"ids": ["e1", "e2"]}, the Email/set call would resolve to:

["Email/set", {
    "accountId": "a1",
    "update": {
        "e1": {
            "keywords/from-nobody": true
        },
        "e2": {
            "keywords/from-nobody": true
        }
    }
}]

What do you think? Does this sound like something worth considering? My hunch is that it will require some discussion before it's worthwhile to create a PR, but I can take a stab at it if it would be helpful.

Contributor guide

No contributing guide indexed for this repository

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 with issue #315 and the ResultReference proposal in the JMAP specification, then trace the Email/query and Email/set example. Work can begin only after the properties or setProps behavior is agreed; done would be a settled specification for resolving query results into the shown update object.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.