PocketSelectors

PocketSelectors

new PocketSelectors()

Source:

Members

$projectID

Source:

Methods

$all(probeID) → {object}

$all

  • return Object copy of all setters: {id,status,campaign,task,data}
Source:
Parameters:
Name Type Description
probeID *

optional/sensitive, select new point of reference

Returns:
Type:
object

$architect()

more construct way of setting up a project and allowing few external assets to be used. This method uses $payload inheritance with access to type and async. Things to remember consecutive call to $architect thru .$condition() method, can only update existing items. - cb(()=>({project:payloadData, type,async})): return callback must return {project:payload} as minimum requirement, when running in a loop or repetitive actions, it is best to set type='update' so that concurrent call to the same task wont wont be ignored, type is state base, so last setting is kept - memberof PocketArchitect

Source:

$asset()

can access the asset declared in $architect

  • memberof PocketArchitect
Source:

$cached(dataProp{}/String, probeID)

grabs last cached $data(...) from Probe{}

Source:
Parameters:
Name Type Description
dataProp{}/String *

optional, know what you are asking for example: {assets:true}/ or > 'assets,values,somethingElse', it has catch error exception, so you wont receive any errors just null will return all available matched within our _$cached_data[probeID]. Multiples of dataProp{}/([])/(',') will return an object, if only one specified, only value will be returned

probeID *

$campaign(probeID)

returns Object copy of Probe['campaign']

Source:
Parameters:
Name Type Description
probeID *

optional/sensitive, select new point of reference

$compute(cb, projectID)

iterate thru each Probe{}/ instance in a callback, and make changes to it

  • note: you can only compute thru items that are not complete
Source:
Parameters:
Name Type Description
cb compute_cb

cb callback to current Probe instance process

projectID string

optional/sensitive, selects new point of reference.

$condition(cb, id) → {PocketSelectors}

REVIEW self is inconsistent here we may have to update this logic

run conditional statement within callback, so we can keep chaining in the same block

Source:
Parameters:
Name Type Description
cb condition_cb

required, inside callback access to self for PocketModule, or for Probe{}, depending on projectID/probeID id specified

id string

projectID/probeID optional, specify either projectID or probeID, defaults to last projectID

Returns:
Type:
PocketSelectors

by default returns Pocket/self, or any true value passed inside callback

$data(dataProp, probeID, self)

returns Object copy of Probe['data']

Source:
Parameters:
Name Type Default Description
dataProp *

optional, if you know what you are asking for example: {assets:true},or array['assets], it has catch error exception, so you wont receive any errors just null will return all available matched within our Probe{}['data]. Multiples of dataProp{}/([])/(',') will return an object, if only one specified, only value will be returned

probeID *

optional/sensitive, select new point of reference

self * false

optional,if you want to $cached() last data enquiry and return self to keep chaining, nice!

$error(probeID) → {array}

$task

  • returns Object copy of Probe['task']
Source:
Parameters:
Name Type Description
probeID *

optional/sensitive, select new point of reference

Returns:
Type:
array

$exists(probeID)

check is probe exists on PocketModule

Source:
Parameters:
Name Type Description
probeID *

required, can specify ::taskName or full id {projectID}::{probeID}

Returns:

boolean

$filter(cb, projectID) → {PocketSelectors}

Filter works together with $compute or standalone when specified .d to return filtered list memberof PocketSelectors

Source:
Parameters:
Name Type Description
cb filter_cb
projectID string
Returns:
Type:
PocketSelectors

$get(probeID, self) → {Probe}

get probe by 'id::taskName'

  • returns instance methods:{get,all} props: {id,data,tasks,status}
Source:
Parameters:
Name Type Description
probeID *

required, example format: ${payload.id}::taskName

self *

= false optional, in case you want to chain, and access Probe{} through ...).d otheriwe return Pocket

Returns:
Type:
Probe

actually {Pcket | Probe}

$getByRef(probeRef,)

REVIEW this method must be updated

Deprecated:
  • - return array of Probes matched by ref
Source:
Parameters:
Name Type Description
probeRef, *

required

Returns:

[Probe,...] array

$list(projectID, cb, type)

list active Probes{} by project id, should return all assigned probe/tasks regardless of status

  • returns array[] of active Probe{}/tasks or []
Source:
Parameters:
Name Type Default Description
projectID *

optional/sensitive, selects new point of reference.

cb list_cb null

((probe, probeID)=>) optional, when set will loop thru each Probe{} in callback

type * self

optional, set to list, will return latest Probes, that includes if initiated cb and made a few changes

$of(probeID)

points to Probe{} be reference

Source:
Parameters:
Name Type Description
probeID *

optional/sensitive, select new point of reference

$onChange(cb, watchProp, probeID)

  • changes are observed for [data,status,ref,error,campaign, status:complete]
  • when watchProp status:complete is selected all copy data is returned in callback
Source:
Parameters:
Name Type Description
cb onChange_cb
watchProp

specify what property to watch, defaults to all, except for status:complete

probeID *

optional/sensitive, select new point of reference

$onProbeComplete(cb, probeID)

callback initialled of any probe that was completed, unless specificity selected probeID

Source:
Parameters:
Name Type Description
cb onProbeComplete_cb
probeID *

optional if you only want to listen for changes to specific probe add the id

$probe(probeID) → {Probe}

return as Probe{}, similar as $get(...), although does additional check for instanceOf Probe{}

Source:
Parameters:
Name Type Description
probeID *
Returns:
Type:
Probe

$probeStatusAsync(probeID)

return last probe status, this is a dynamic Promise, creates new promise every time status is changed, so then it needs to bu called again to get latest update

Source:
Parameters:
Name Type Description
probeID *

$projectComplete(projectID)

Source:
Parameters:
Name Type Description
projectID

required

Returns:

boolean true/false/null, determined by project completion

$projectSet(projectID) → {boolean}

use it to check if project already available, it is similar to $projectSetAsync but not a promise, returns current status, not in future

Source:
Parameters:
Name Type Description
projectID *

required

Returns:
Type:
boolean

$ref(probeID) → {string}

$ref

  • returns Probe{}.ref
Source:
Parameters:
Name Type Description
probeID *

optional/sensitive, select new point of reference

Returns:
Type:
string

$select(projectID)

select current payloadID/project/job by id you are working on

Source:
Parameters:
Name Type Description
projectID *

optional/sensitive, selects new point of reference.

$set(dataFrom, probeID)

as name suggest sets up new new data for Probe/task, it derives from $update

Source:
Parameters:
Name Type Description
dataFrom SetUpdateModel

required, must specify what to set on Probe{}, example: dataFrom:{data:'coke',status:'complete',campaign:'cocacola'}

  • we should only use $set for initialization, this action also calls clearStoreTransfers
probeID *

required, example format: ${payload.id}::taskName

$status(probeID) → {string}

$status

  • returns Object copy of Probe['status']
Source:
Parameters:
Name Type Description
probeID *

optional/sensitive, select new point of reference

Returns:
Type:
string

$task(probeID) → {string}

$task

  • returns Object copy of Probe['task']
Source:
Parameters:
Name Type Description
probeID *

optional/sensitive, select new point of reference

Returns:
Type:
string

$to(toProbeID, pointToThisProbe, maxDelay,)

works together with $transfer, will transfer data from one Probe{} to another if _transferCache is set, the cache is cleared.

Source:
Parameters:
Name Type Default Description
toProbeID *

optional/sensitive, points to Probe{} data will be packed, it is not previous reference pointer, but the next.

  • will only work if toProbeID is not yet complete
pointToThisProbe * true

to stay on the current pointer reference

maxDelay, *

keep at minimum! Time between transaction can take place, relates to fromAverageTimeHasPast found in accessLastValidTransfer()

$transfer(fromProbeID)

select data from fromProbeID and hold it in _transferCache, until $to(probeID) is called

  • warning, action removes Probe[fromProbeID].data and overrides it on Probe[probeID].data, only when $to(probeID) is called, simple as that!
Source:
Parameters:
Name Type Description
fromProbeID *

optional/sensitive, selects new point of reference.

$update(dataFrom, mergeData, probeID)

update Probe/task, for convenience, so we dont have do this, example: pc.$get('abc123::grab').status='complete'

Source:
Parameters:
Name Type Description
dataFrom SetUpdateModel

required, must specify what to update on Probe{}, example: dataFrom:{data:'coke',status:'complete',campaign:'cocacola'}

mergeData *

optional if true will merge: Object.assing({},probe[id].data,mergeData['data'])

probeID *

required, example format: ${payload.id}::taskName