Picolab / pico-engine

An implementation of the pico-engine hosted on node.js
http://picolabs.io/
MIT License
43 stars 8 forks source link

`wrangler:picoQuery` fails if ECI is for a pico that doesn't have the RID installed #608

Open b1conrad opened 2 years ago

b1conrad commented 2 years ago

This is inherited from ctx:query which behaves the same way.

The caller should ensure that this doesn't happen, but there is a workaround that could be put into the function. That is to first query a RID that is known to be installed in every pico, io.picolabs.wrangler/installedRIDs and check the result for containing the original RID. But what to do it it is not there? Pass in a failure function or answer?

b1conrad commented 2 years ago

Workaround is, for example, this code:

    coreRID = "byu.hr.core"
    wranglerRID = "io.picolabs.wrangler"
        otherDisplayName = function(eci){
          oRIDs = wrangler:picoQuery(eci,wranglerRID,"installedRIDs")
          isParticipant = oRIDs >< coreRID
          isParticipant => wrangler:picoQuery(eci,coreRID,"displayName")
                         | wrangler:picoQuery(eci,wranglerRID,"name")
        }