API :: Missing properties - parents, ancestors, descendants

Some missing (and some misspelled) parts in the omniJS API for Task and Resource context:

  • Task parent is missing from the omniJS interface for OP 4 (4.02) (The osascript API has parentTask, but omniJS appears to have nothing)

  • Resource.descendents() (sic) is misspelled (should be Resource.descendants() (this has been fixed in the API for other Omni Apps, but not yet for OP)

  • Task.descendents() (sic) is also misspelled – should be Task.descendants(), as (now) in other Omni apps (and as in English :-)

  • Task.ancestors is missing.

Without API access to parents and ancestors (as provided in the API to other Omni apps), it becomes impossible to write scripts which handle selections properly.

We have no way of knowing (for a script which acts on a subtree, indicated by selection in the GUI) whether the selection includes both leaves and their ancestors, or just the root node(s) of the target trees.

Inadvertent duplicate processing is then hard to avoid.

A function like the following (which we need and can write for OmniOutliner), becomes impossible to write for OmniPlan:

// commonAncestors :: [OOItem] -> [OOItem]
const commonAncestors = items => {
    // Only items which do not descend
    // from other items in the list.
        dct = items.reduce(
            (a, x) => (a[x.identifier] = true, a), {}
    return items.filter(
        x => !until(
            y => (null === y) || dct[y.identifier]
        )(v => v.parent)(x.parent)