node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

protean

Protean

An ever changing set of utilities.

Summary

Installation

% npm install protean

API

Modules

Protean
Falcor
## Classes
CollectionSourceProteanClass
CompositeSourceProteanClass
JSONGraphEnvelopeProxyProteanClass
NoCacheSourceProteanClass
PartitionedSourceProteanClass
ProxiedSourceProteanClass
StorageSourceProteanClass
ProteanClass : function
StorageProteanClass
StoreProteanClass
CollectionProteanClass
FiniteStateMachineSubject
LinkedListProteanClass
RecordProteanClass
## Typedefs
onNextFunction : function
onErrorFunction : function
onCompletedFunction : function
Observable
Observer
Disposable
SubjectObservable
DataSource
Sentinel : Object
Reference : Sentinel
RootReference : Reference
Atom : Sentinel
JSONEnvelope : Object
JSONGraph : Object
JSONGraphEnvelope : Object
Key : String | null
KeySet : Key | Range | Array.<(Key|Range)>
Path : Array.<Key>
PathSet : Array.<KeySet>
PathValue : Object
Range : Object
## Protean

### Protean.Rx Kind: static property of Protean

#### Rx.append ⇒ Observable.<String> Kind: static property of Rx

Param Type
filepath String
data Buffer | String
[opts] Object | String

#### Rx.mv ⇒ Observable.<String> File: rx/fs/mv.js

Kind: static property of Rx

Param Type Default
from String
to String
opts Object
[opts.mkdirp] Boolean false
[opts.clobber] Boolean false

#### Rx.fsWrapper ⇒ function Kind: static property of Rx

Param Type
method String

#### Rx.write ⇒ Observable.<String> Kind: static property of Rx

Param Type
filepath String
data Buffer | String
[opts] Object | String

#### Rx.from(arg) ⇒ Observable File: rx/from.js

Kind: static method of Rx

Param Type
arg Observable | Promise | Array | Object

#### Rx.cp(from, to, [opts]) ⇒ Observable.<fs.Stats> File: rx/fs/cp.js

Kind: static method of Rx

Param Type Default
from String | Array.<String> | Observable.<String> | Promise.<String>
to String
[opts] Object
[opts.recursive] Boolean true
[opts.force] Boolean false

#### Rx.glob(pattern, [opts]) ⇒ Observable.<String> File: rx/glob.js

Kind: static method of Rx
Returns: Observable.<String> - An Observable emiting the paths found

Param Type Description
pattern String The glob pattern
[opts] Object https://github.com/isaacs/node-glob#options

#### Rx.isDirectory(paths) ⇒ Observable.<Boolean> File: rx/is-directory.js

Kind: static method of Rx
Returns: Observable.<Boolean> - An Observable emiting the paths found

Param Type
paths String | Array.<String> | Observable.<String>

#### Rx.isFile(paths) ⇒ Observable.<Boolean> File: rx/is-file.js

Kind: static method of Rx

Param Type
paths String | Array.<String> | Observable.<String>

#### Rx.mkdir(paths, [opts]) ⇒ Observable.<String> Create the given paths in the file system.

File: rx/mkdir.js

Kind: static method of Rx

Param Type Default
paths String | Array.<String> | Observable.<String>
[opts] Object
[opts.mode] String '0777'

#### Rx.read(patterns, [enc]) ⇒ Observable.<(String|Buffer)> File: rx/read.js

Kind: static method of Rx

Param Type
patterns String | Array.<String> | Observable.<String> | Promise.<String>
[enc] String

#### Rx.rm(patterns, [recursive]) ⇒ Observable.<String> File: rx/rm.js

Kind: static method of Rx

Param Type Default
patterns String | Array.<String> | Observable.<String> | Promise.<String>
[recursive] Boolean true

#### Rx.stat(patterns) ⇒ Observable.<external:fs.Stats> File: rx/stat.js

Kind: static method of Rx
Returns: Observable.<external:fs.Stats> - An Observable emiting the paths found

Param Type
patterns String | Array.<String> | Observable.<String> | Promise.<String>

##### stat.link(patterns) ⇒ Observable.<external:fs.Stats> Kind: static method of stat

Param Type
patterns String | Array.<String> | Observable.<String> | Promise.<String>

##### stat.fd(fds) ⇒ Observable.<external:fs.Stats> Kind: static method of stat

Param Type
fds Integer | Array.<Integer> | Observable.<Integer> | Promise.<Integer>

### Protean.denominate ⇒ Object Kind: static property of Protean
Returns: Object - The object now with a immutable 'name' property of the given name value

Param Type
obj Object
name String

### Protean.invoke ⇒ * Kind: static property of Protean

Param Type
property String
subject Object

### Protean.pluck ⇒ * | function File: object/pluck.js

Kind: static property of Protean

Param Type
key String
[obj] Object

### Protean.classnames(arg) ⇒ String Utility function to get a className string.

Supply a list of strings, or objects with class names -> boolean indicating whether that class should be used. The returned string will contain all the class names indicated without duplicates, and separated by spaces.

File: dom/classnames.js

Kind: static method of Protean

Param Type
arg String | Object.<String, Boolean>

### Protean.classify([subclass], props, [properties]) ⇒ ProteanClass Create a constructor function passing in it's prototype methods.

File: function/classify

Kind: static method of Protean

Param Type Description
[subclass] function The subclass constructor function.
props Object Bare properties for the constructor's prototype.
[properties] Object Object.defineProperty property definitions.

### Protean.inherit(superclass, [subclass], [props], [properties]) ⇒ ProteanClass Create a constructor function that inherits properties and methods from the given super constructor.

File: function/inherit.js

Kind: static method of Protean
Returns: ProteanClass - The constructor function.

Param Type Default Description
superclass function The function to inherit from.
[subclass] function Function The Subclass constructor function. If omitted, and a constructor property is not defined in props, defaults to a function that calls the superclass' constructor function.
[props] Object Bare properties to initialize the prototype with.
[properties] Object {} Object.defineProperty property definitions.

### Protean.instantiate(fn, [args]) ⇒ Object Create a new object and then apply the constructor function with the arguments.

File: function/instantiate.js

Kind: static method of Protean
Returns: Object - The new instance

Param Type Description
fn function The constructor function
[args] Array.<Mixed> Arguments to pass to the constructor function

### Protean.augment(...obj) ⇒ Object Like 'extend', but it preserves getters and setters, and will not overwrite existing properties defined directly on the source object.

File: object/augment.js

Kind: static method of Protean

Param Type
...obj Object

### Protean.enmap(...args) ⇒ Object Takes a list of alternating key/values and returns an object.

File: object/enmap.js

Kind: static method of Protean

Param Type
...args Mixed

### Protean.enumerate() ⇒ Object Takes an argument list of strings and returns an object with those keys, and their values being the index of that key plus one.

File: object/enumerate.js

Kind: static method of Protean

Type
String

### Protean.traverse(obj, visitor, [post]) Kind: static method of Protean

Param Type Default Description
obj Object
visitor visitorFn
[post] Boolean false Do a post traversal

#### traverse.SKIP : String Kind: static constant of traverse
#### traverse.CONTINUE : String Kind: static constant of traverse
#### traverse.BREAK : String Kind: static constant of traverse
#### traverse~visitorFn(path, value, context) ⇒ undefined | String File: object/traverse.js

Kind: inner method of traverse
Returns: undefined | String - One of the constants of 'skip', 'continue', or 'break'. Returning undefined is the same as returing 'continue'.

Param Type Description
path Array.<String> The path to the value
value Mixed The value
context Object The original object

### Protean.guid() ⇒ String Fast GUID generator, RFC4122 version 4 compliant.

File: utility/guid.js

Kind: static method of Protean
See: http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
Author: Jeff Ward (jcward.com).
License: MIT license
### Protean.mergeExports(receiver, supplier) ⇒ Object File: utility/merge-exports.js

Kind: static method of Protean

Param Type
receiver Object
supplier function | Object

## Falcor

### Falcor.Graph File: falcor/graph.js

Kind: static property of Falcor
See: https://github.com/Netflix/falcor-json-graph

#### Graph.set ⇒ Object File: falcor/graph/set.js

Kind: static property of Graph

Param Type
source Object
path String | Array.<String>
value *

#### Graph.atoms(graph, fn) File: falcor/graph/atoms.js

Kind: static method of Graph

Param Type
graph JSONGraph
fn Graph.atoms~visitorFn

##### atoms~visitorFn(path, atom, graph) Kind: inner method of atoms

Param Type
path Path
atom Atom
graph JSONGraph

#### Graph.fromObject(obj, [opts]) ⇒ JSONGraph Takes a normal javascript object and returns a JSONGraph.

File: falcor/graph/from-object.js

Kind: static method of Graph

Param Type Default
obj Object
[opts] Object
[opts.arrayIsRef] Boolean true
[opts.root] Path []

#### Graph.isAtom(sentinel) ⇒ Boolean File: falcor/graph/is-atom.js

Kind: static method of Graph

Param Type
sentinel *

#### Graph.isError(sentinel) ⇒ Boolean File: falcor/graph/is-error.js

Kind: static method of Graph

Param Type
sentinel *

#### Graph.isRef(sentinel) ⇒ Boolean File: falcor/graph/is-ref.js

Kind: static method of Graph

Param Type
sentinel *

#### Graph.isRootRef(sentinel) ⇒ Boolean File: falcor/graph/is-root-ref.js

Kind: static method of Graph

Param Type
sentinel *

#### Graph.isSentinel(sentinel) ⇒ Boolean File: falcor/graph/is-sentinel.js

Kind: static method of Graph

Param Type
sentinel *

#### Graph.refs(graph, fn) File: falcor/graph/refs.js

Kind: static method of Graph

Param Type
graph JSONGraph
fn Graph.atoms~visitorFn

##### refs~visitorFn(path, ref, graph) Kind: inner method of refs

Param Type
path Path
ref Reference
graph JSONGraph

#### Graph.relative(root, graph) ⇒ JSONGraph File: falcor/graph/relative.js

Kind: static method of Graph

Param Type
root Path
graph JSONGraph

#### Graph.resolve(root, graph) ⇒ JSONGraph File: falcor/graph/resolve.js

Kind: static method of Graph

Param Type
root Path
graph JSONGraph

#### Graph.rootRef(path, value, props) ⇒ Reference File: falcor/graph/root-ref.js

Kind: static method of Graph

Param Type
path Path
value Path
props Object

#### Graph.sentinels(graph, fn) File: falcor/graph/sentinels.js

Kind: static method of Graph

Param Type
graph JSONGraph
fn Graph.sentinels~visitorFn

##### sentinels~visitorFn(path, sentinel, graph) Kind: inner method of sentinels

Param Type
path Path
sentinel Sentinel
graph JSONGraph

#### Graph.toObject(graph, [opts]) ⇒ JSONGraph Takes a JSONGraph and returns a Javascript Object.

File: falcor/graph/to-object.js

Kind: static method of Graph

Param Type
graph JSONGraph
[opts] Object

### Falcor.Path Kind: static property of Falcor
See: https://github.com/Netflix/falcor-path-utils

#### Path.relative(root, paths) ⇒ Array.<PathSet> File: falcor/path/relative.js

Kind: static method of Path

Param Type
root Path
paths Array.<PathSet>

#### Path.resolve(root, paths) ⇒ Array.<PathSet> File: falcor/path/resolve.js

Kind: static method of Path

Param Type
root Path
paths Array.<PathSet>

## CollectionSource ⇐ ProteanClass Kind: global class
Extends: ProteanClass
Implements: DataSource

### new CollectionSource([collection], [opts]) file: falcor/data-source/collection.js

Param Type Default
[collection] Collection
[opts] Object
[opts.indexedPath] Path ['byIndex']
[opts.keyedPath] Path ['byId']

### collectionSource.options Default options

Kind: instance property of CollectionSource
Properties

Type
Object

#### options.indexedPath Kind: static property of options
Properties

Type
Path

#### options.keyedPath Kind: static property of options
Properties

Type
Path

#### options.lengthPath Kind: static property of options
Properties

Type
Path

#### options.addPath Kind: static property of options
Properties

Type
Path

#### options.removePath Kind: static property of options
Properties

Type
Path

### collectionSource.router Kind: instance property of CollectionSource
See: http://netflix.github.io/falcor/documentation/router.html
Properties

Type
external:FalcorRouter

### collectionSource.routes Kind: instance property of CollectionSource
Properties

Type
Array.<Object>

### collectionSource.get(paths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of CollectionSource
Implements: get

Param Type
paths Array.<PathSet>

### collectionSource.set(envelope) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of CollectionSource
Implements: set

Param Type
envelope JSONGraphEnvelope

### collectionSource.call(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of CollectionSource
Implements: call

Param Type
path PathSet
args Array.<Mixed>
refSuffixes Array.<PathSet>
thisPaths Array.<PathSet>

### collectionSource.getLength() ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of CollectionSource
### collectionSource.getRecordByIndex(paths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of CollectionSource

Param Type
paths Array.<PathSets>

### collectionSource.getRecordProps(paths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of CollectionSource

Param Type
paths Array.<PathSets>

### collectionSource.setRecordProps(graph) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of CollectionSource

Param Type
graph JSONGraph

### collectionSource.addRecord(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of CollectionSource

Param Type
path PathSet
args Array.<Mixed>
refSuffixes Array.<PathSet>
thisPaths Array.<PathSet>

### collectionSource.removeRecord(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of CollectionSource

Param Type
path PathSet
args Array.<Mixed>
refSuffixes Array.<PathSet>
thisPaths Array.<PathSet>

## CompositeSource ⇐ ProteanClass Kind: global class
Extends: ProteanClass
Implements: DataSource

### new CompositeSource(...args) A DataSource that allows for composing several different DataSources together through different Paths.

This allows individual DataSources to be constructed, used, and tested in their own domain. Then later you can compose them into a larger Graph.

The CompositeSource manages the re-writing of Paths and the resulting Graph so it appears that everything comes from a larger Graph.

Basically, all returned Paths/Graphs are updated to have any references relative to their Paths in the CompositeSource.

As a result, there was a need to create a new Falcor data type to express when a sub DataSource wanted to reference another part of the larger Graph. RootReference represents a Reference in the Graph that should not be kept local to the underlying DataSource, but should be interpreted from the root of the CompositeSource.

File: falcor/data-source/composite.js

Param Type
...args Array.<Path, DataSource>

### compositeSource.sources Kind: instance property of CompositeSource
Properties

Type
Object.<Path, ProxiedSource>

### compositeSource.get(paths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of CompositeSource
Implements: get

Param Type
paths Array.<PathSets>

### compositeSource.set(envelope) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of CompositeSource
Implements: set

Param Type
envelope JSONGraphEnvelope

### compositeSource.call(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of CompositeSource
Implements: call

Param Type
path Path
args Array.<Mixed>
refSuffixes Array.<PathSet>
thisPaths Array.<PathSet>

### compositeSource.add(path, source) ⇒ CompositeSource Kind: instance method of CompositeSource
Returns: CompositeSource - the CompositeSource instance

Param Type
path Path
source DataSource

## JSONGraphEnvelopeProxy ⇐ ProteanClass Kind: global class
Extends: ProteanClass
Implements: JSONGraphEnevelope

### new JSONGraphEnvelopeProxy([opts])

Param Type Description
[opts] Object
[opts.expect] Array.<PathSet> Paths to expect
[opts.paths] Array.<PathSet> A starting set of paths
[opts.jsonGraph] JSONGraph A starting JSONGraph
[opts.invalidated] Array.<PathSet> A starting set of paths to invalidate

### jsonGraphEnvelopeProxy.paths Kind: instance property of JSONGraphEnvelopeProxy
Properties

Type
Array.<PathSet>

### jsonGraphEnvelopeProxy.jsonGraph Kind: instance property of JSONGraphEnvelopeProxy
Properties

Type
JSONGraph

### jsonGraphEnvelopeProxy.invalidated Kind: instance property of JSONGraphEnvelopeProxy
Properties

Type
Array.<PathSet>

### jsonGraphEnvelopeProxy.expecting Kind: instance property of JSONGraphEnvelopeProxy
Properties

Type
Object

### jsonGraphEnvelopeProxy.pending Get a list of paths this envelope is still expecting to fulfill

Kind: instance property of JSONGraphEnvelopeProxy
Read only: true
Properties

Type
Array.<Path>

### jsonGraphEnvelopeProxy.set(pathOrGraph, [atom]) Kind: instance method of JSONGraphEnvelopeProxy

Param Type
pathOrGraph Path | JSONGraph
[atom] Atom

### jsonGraphEnvelopeProxy.invalidate(...path) Kind: instance method of JSONGraphEnvelopeProxy

Param Type
...path Path

### jsonGraphEnvelopeProxy.fulfill(path) Mark a path as fulfilled and set the given value on our jsonGraph

Kind: instance method of JSONGraphEnvelopeProxy

Param Type
path Path

### jsonGraphEnvelopeProxy.expect(paths) Prepare this envelope to expect to fulfill a certain set of paths.

Kind: instance method of JSONGraphEnvelopeProxy

Param Type
paths Array.<PathSet>

### jsonGraphEnvelopeProxy.relativeFrom(from) ⇒ JSONGraphEnvelopeProxy Kind: instance method of JSONGraphEnvelopeProxy
Returns: JSONGraphEnvelopeProxy - A copy

Param Type
from Path

### jsonGraphEnvelopeProxy.resolvedFrom(from) ⇒ JSONGraphEnvelopeProxy Kind: instance method of JSONGraphEnvelopeProxy
Returns: JSONGraphEnvelopeProxy - A copy

Param Type
from Path

### jsonGraphEnvelopeProxy.merge(other) Merge another JSONGraphEnvelope into this one

Kind: instance method of JSONGraphEnvelopeProxy

Param Type
other JSONGraphEnvelopeProxy | JSONGraphEnvelope

### jsonGraphEnvelopeProxy.destroy() Clear out our data so we do not have any dangling memory.

Kind: instance method of JSONGraphEnvelopeProxy
### jsonGraphEnvelopeProxy.clone() ⇒ JSONGraphEnvelopeProxy Get a copy of this proxy

Kind: instance method of JSONGraphEnvelopeProxy
### jsonGraphEnvelopeProxy.valueOf() ⇒ JSONGraphEnvelope Kind: instance method of JSONGraphEnvelopeProxy
### jsonGraphEnvelopeProxy.finalize() ⇒ JSONGraphEnvelope Kind: instance method of JSONGraphEnvelopeProxy
## NoCacheSource ⇐ ProteanClass Kind: global class
Extends: ProteanClass
Implements: DataSource

### new NoCacheSource(opts) A Falcor DataSource that proxies another data source and sets all returned atoms to expire immediately.

file: falcor/data-source/no-cache.js

Param Type
opts Object
opts.source DataSource

### noCacheSource.get(paths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of NoCacheSource
Implements: get

Param Type
paths Array.<PathSets>

### noCacheSource.set(envelope) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of NoCacheSource
Implements: set

Param Type
envelope JSONGraphEnvelope

### noCacheSource.call(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of NoCacheSource
Implements: call

Param Type
path PathSet
args Array.<Mixed>
refSuffixes Array.<PathSet>
thisPaths Array.<PathSet>

## PartitionedSource ⇐ ProteanClass Kind: global class
Extends: ProteanClass
Implements: DataSource

### new PartitionedSource([opts]) A falcor DataSource that optionally reads from and writes to a variety of 'partitions' of other DataSources.

When reading (get) it will try the partitions in the order set by the 'reads' option. Any paths gone unfilled by the first, will be requested by the second, and so on. The final graph is a merge of all returned values from those partitions.

When writing (set/call) it will send the request to all given partitions in the 'writes' option. Again, returning a merged graph of all values writen.

Param Type Default
[opts] Object
[opts.reads] Array.<String> []
[opts.writes] Array.<String> []
[opts.partitions] Object.<String, DataSource> {}

### partitionedSource.options Default options

Kind: instance property of PartitionedSource
Properties

Type
Object

#### options.reads Kind: static property of options
Properties

Type
Array.<String>

#### options.writes Kind: static property of options
Properties

Type
Array.<String>

#### options.partitions Kind: static property of options
Properties

Type
Object.<String, DataSource>

### partitionedSource.get(paths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of PartitionedSource
Implements: get

Param Type
paths Array.<PathSet>

### partitionedSource.set(envelope) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of PartitionedSource
Implements: set

Param Type
envelope JSONGraphEnvelope

### partitionedSource.call(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of PartitionedSource
Implements: call

Param Type
path PathSet
args Array.<Mixed>
refSuffixes Array.<PathSet>
thisPaths Array.<PathSet>

## ProxiedSource ⇐ ProteanClass Kind: global class
Extends: ProteanClass
Implements: DataSource

### new ProxiedSource([opts]) A Falcor DataSource that proxies to another source, re-writing the returned paths, and the paths to the values within the JSONGraph.

File: falcor/data-source/proxied.js

Param Type
[opts] Object
[opts.source] DataSource
[opts.root] Path

### proxiedSource.source Kind: instance property of ProxiedSource
Properties

Type
DataSource

### proxiedSource.root Kind: instance property of ProxiedSource
Properties

Type
Path

### proxiedSource.get(paths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of ProxiedSource
Implements: get

Param Type
paths Array.<PathSets>

### proxiedSource.set(envelope) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of ProxiedSource
Implements: set

Param Type
envelope JSONGraphEnvelope

### proxiedSource.call(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of ProxiedSource
Implements: call

Param Type
path PathSet
args Array.<Mixed>
refSuffixes Array.<PathSet>
thisPaths Array.<PathSet>

### proxiedSource.willGet(paths) ⇒ Boolean Will the given paths be consumed by a get request against this datasource?

Kind: instance method of ProxiedSource

Param Type
paths Array.<PathSet>

### proxiedSource.willSet(envelope) ⇒ Boolean Will the given JSONGraphEnvelope be consumed by a set request against this datasource?

Kind: instance method of ProxiedSource

Param Type
envelope JSONGraphEnvelope

### proxiedSource.willCall(path) ⇒ Boolean Will the given path be consumed by a call request against this datasource?

Kind: instance method of ProxiedSource

Param Type
path Path

### proxiedSource.getRelativeEnvelope(envelope) ⇒ JSONGraphEnvelope Strip our leading path from the envelope's path(s) and jsonGraph object.

Kind: instance method of ProxiedSource

Param Type
envelope JSONGraphEnvelope

### proxiedSource.getResolvedEnvelope(envelope) ⇒ JSONGraphEnvelope Adjust the JSONGraphEnvelope to reflect our leading path information.

Kind: instance method of ProxiedSource

Param Type
envelope JSONGraphEnvelope

## StorageSource ⇐ ProteanClass Kind: global class
Extends: ProteanClass
Implements: DataSource

### new StorageSource(opts) File: falcor/data-source/storage.js

Param Type
opts Object
opts.storage Storage
opts.storageKey String
[opts.cache] Object
[opts.serializer] function
[opts.deserializer] function

### storageSource.model Kind: instance property of StorageSource
Properties

Type
FalcorFModel

### storageSource.source Kind: instance property of StorageSource
Properties

Type
DataSource

### storageSource.options Kind: instance property of StorageSource
Properties

Type
Object

#### options.storageKey The key to use when accessing the Storage object to serialize the graph to.

Kind: static property of options
Properties

Type
String

#### options.storage The storage source

Kind: static property of options
Properties

Type
Storage

#### options.serializer(graph) ⇒ String A function to convert a JSONGraph to a String.

Kind: static method of options

Param Type
graph JSONGraph

#### options.deserializer(src) ⇒ JSONGraph A function to convert a String to a JSONGraph.

Kind: static method of options

Param Type
src String

### storageSource.get(paths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of StorageSource
Implements: get

Param Type
paths Array.<PathSets>

### storageSource.set(envelope) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of StorageSource
Implements: set

Param Type
envelope JSONGraphEnvelope

### storageSource.call(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of StorageSource
Implements: call

Param Type
path PathSet
args Array.<Mixed>
refSuffixes Array.<PathSet>
thisPaths Array.<PathSet>

### storageSource.clear() Clear our storage item

Kind: instance method of StorageSource
### storageSource.serialize() Write our cache to storage

Kind: instance method of StorageSource
### storageSource.deserialize() Get our cache from storage

Kind: instance method of StorageSource
## ProteanClass : function Kind: global class

### ProteanClass.superproto : Object A reference to this class' superclass prototype

Kind: static property of ProteanClass
### ProteanClass.extend([subclass], [props], [properties]) ⇒ ProteanClass A function to extend this class into another one

Kind: static method of ProteanClass

Param Type
[subclass] function
[props] Object
[properties] Object

### ProteanClass.extended(subclass) A function that will be called when the class is extended into another

Kind: static method of ProteanClass

Param Type
subclass function

### ProteanClass.superclass() A reference to this class' superclass constructor

Kind: static method of ProteanClass
## Storage ⇐ ProteanClass Kind: global class
Extends: ProteanClass
Implements: external:Storage

### new Storage(opts) File: storage/index.js

Param Type
opts Object
opts.store external:Storage
opts.json JSON

### storage.length Kind: instance property of Storage
Read only: true
Properties

Type
Integer

### storage.getItem(key) ⇒ Mixed Kind: instance method of Storage

Param Type
key String

### storage.getJSON(key) ⇒ null | Object Kind: instance method of Storage

Param Type
key String

### storage.setItem(key, value) Kind: instance method of Storage

Param Type
key String
value String

### storage.setJSON(key, value) Kind: instance method of Storage

Param Type
key String
value String

### storage.removeItem(key) Kind: instance method of Storage

Param Type
key String

### storage.clear() Kind: instance method of Storage
### storage.key(idx) ⇒ String Kind: instance method of Storage

Param Type
idx Integer

## Store ⇐ ProteanClass Kind: global class
Extends: ProteanClass
Implements: external:Storage

### new Store() File: storage/store/index.js

### store.length Kind: instance property of Store
Read only: true
Properties

Type
Integer

### store.getItem(key) ⇒ null | String Kind: instance method of Store

Param Type
key String

### store.setItem(key, value) Kind: instance method of Store

Param Type
key String
value String

### store.removeItem(key) Kind: instance method of Store

Param Type
key String

### store.clear() Kind: instance method of Store
### store.key(idx) ⇒ String Kind: instance method of Store

Param Type
idx Integer

### Store.local : external:Storage File: storage/store/local.js

Kind: static property of Store
### Store.memory : module:Protean.Store File: storage/store/memory.js

Kind: static property of Store
### Store.session : external:Storage File: storage/store/session.js

Kind: static property of Store
## Collection ⇐ ProteanClass Kind: global class
Extends: ProteanClass

### new Collection([rec]) File: utility/collection.js

Param Type
[rec] Record | Object

### collection.idKey The unique identifier key to use for records

Kind: instance property of Collection
Default: 'id'
Properties

Type
String

### collection.comparator Used to keep the collection ordered when adding items

Kind: instance property of Collection
Properties

Type
function

### collection.length Kind: instance property of Collection
Read only: true
Properties

Type
Integer

### collection.records Kind: instance property of Collection
Read only: true
Properties

Type
Array.<Record>

### collection.has(id) ⇒ Boolean Kind: instance method of Collection

Param Type
id String

### collection.add(obj) ⇒ Record Kind: instance method of Collection
Returns: Record - The record just created

Param Type
obj Object | Record

### collection.remove(id) ⇒ Record Kind: instance method of Collection

Param Type
id String

### collection.at(idx) ⇒ Record Kind: instance method of Collection

Param Type
idx Integer

### collection.removeAt(idx) ⇒ Record Kind: instance method of Collection

Param Type
idx Integer

### collection.get(id) ⇒ Record Kind: instance method of Collection

Param Type
id String

### collection.indexOf(idOrRecord) ⇒ Integer Kind: instance method of Collection

Param Type
idOrRecord String | Record

### collection.clear() ⇒ Collection Kind: instance method of Collection
### collection.valueOf() ⇒ Array.<Object> Kind: instance method of Collection
### collection.find(predicate) ⇒ Record Kind: instance method of Collection

Param Type
predicate function

### collection.sort([comparator]) ⇒ Collection Mutates the collection to sorted based on the given comparator, or the one defined on itself.

Kind: instance method of Collection

Param Type Default
[comparator] function this.comparator

### collection.map(iteratee) ⇒ Collection Kind: instance method of Collection

Param Type
iteratee function

### collection.each(iteratee) Kind: instance method of Collection

Param Type
iteratee function

### collection.where(predicate) ⇒ Collection Kind: instance method of Collection

Param Type
predicate function

### collection.by(comparator) ⇒ Collection Kind: instance method of Collection

Param Type
comparator function

### collection.clone() ⇒ Collection Returns a copy of the collection with all the records (the records are not cloned)

Kind: instance method of Collection
### collection.cloneDeep() ⇒ Collection Returns a Collection with all records cloned.

Kind: instance method of Collection
## FiniteStateMachine ⇐ Subject Kind: global class
Extends: Subject, ProteanClass

### new FiniteStateMachine([opts]) File: utility/fsm.js

Throws:

  • Error "ProteanFiniteStateMachine needs an initial state" If no initial state is given and stateless is false.
Param Type Default Description
[opts] Object
[opts.initial] String The initial state to begin in
[opts.current] String Alias for initial
[opts.states] Object.<String, Object> {} A map of state names to objects that have inputs as keys, and resulting state names as values.
[opts.stateless] Boolean false Allow the machine to be in a stateless state. Default false.

### finiteStateMachine.options Default options

Kind: instance property of FiniteStateMachine
Properties

Type
Object

#### options.initial Kind: static property of options
Properties

Type
String

#### options.current Kind: static property of options
Properties

Type
String

#### options.stateless Kind: static property of options
Properties

Type
Boolean

#### options.states Kind: static property of options
Properties

Type
Object.<String, Object>

### finiteStateMachine.transitions Kind: instance property of FiniteStateMachine
Properties

Type
Subject

### finiteStateMachine.currentState The current state

Kind: instance property of FiniteStateMachine
Properties

Type
String

### finiteStateMachine.currentInputs Get the currently available inputs

Kind: instance property of FiniteStateMachine
Read only: true
Properties

Type
Array.<String>

### finiteStateMachine.add(name, transitions) ⇒ FiniteStateMachine Add a state and its available transitions

Kind: instance method of FiniteStateMachine

Param Type
name String
transitions Object.<String, String>

### finiteStateMachine.remove(name) ⇒ FiniteStateMachine Remove a state and its transitions

Kind: instance method of FiniteStateMachine

Param Type
name String

### finiteStateMachine.has(name) ⇒ Boolean Kind: instance method of FiniteStateMachine

Param Type
name String

### finiteStateMachine.can(input) ⇒ Boolean Kind: instance method of FiniteStateMachine

Param Type
input String

### finiteStateMachine.will(input) ⇒ String | false Kind: instance method of FiniteStateMachine
Returns: String | false - the name of the resulting state, or false

Param Type
input String

### finiteStateMachine.onNext(input) ⇒ Boolean Kind: instance method of FiniteStateMachine

Param Type
input String

### finiteStateMachine.onError(error) Kind: instance method of FiniteStateMachine

Param Type
error Error

### finiteStateMachine.onCompleted() Kind: instance method of FiniteStateMachine
### finiteStateMachine.dispose() Kind: instance method of FiniteStateMachine
### finiteStateMachine.input(input) ⇒ Boolean Kind: instance method of FiniteStateMachine

Param Type
input String

### finiteStateMachine.enter(name) ⇒ Boolean Kind: instance method of FiniteStateMachine

Param Type
name String

### finiteStateMachine.transition(input, from, to) ⇒ FiniteStateMachine Kind: instance method of FiniteStateMachine

Param Type
input String
from String
to String

### finiteStateMachine.valueOf() ⇒ Object Kind: instance method of FiniteStateMachine
## LinkedList ⇐ ProteanClass Kind: global class
Extends: ProteanClass

### new LinkedList([...items])

Param Type
[...items] *

### linkedList.head Kind: instance property of LinkedList
Properties

Type
Node

### linkedList.tail Kind: instance property of LinkedList
Properties

Type
Node

### linkedList.push(...value) ⇒ Integer Kind: instance method of LinkedList

Param Type
...value *

### linkedList.pop() ⇒ * Kind: instance method of LinkedList
### linkedList.unshift(...value) ⇒ Integer Kind: instance method of LinkedList

Param Type
...value *

### linkedList.shift() ⇒ * Kind: instance method of LinkedList
### linkedList.nodeAt(idx) ⇒ LinkdList.Node Kind: instance method of LinkedList

Param Type
idx Integer

### linkedList.at(idx) ⇒ * Kind: instance method of LinkedList

Param Type
idx Integer

### linkedList.insert(nodeOrValue, siblingOrIndex) Insert a new value (or an existing node) after the given sibling or index.

Kind: instance method of LinkedList

Param Type
nodeOrValue Node | *
siblingOrIndex LinkdeList.Node | Integer

### linkedList.remove(nodeOrIndex) Kind: instance method of LinkedList

Param Type
nodeOrIndex Node | Integer

### linkedList.reset() Reset the list

Kind: instance method of LinkedList
### linkedList.forEach(fn, [scope]) Kind: instance method of LinkedList

Param Type
fn function
[scope] Object

### linkedList.map(fn, [scope]) ⇒ LinkedList Kind: instance method of LinkedList

Param Type
fn function
[scope] Object

### linkedList.filter(fn, [scope]) ⇒ LinkedList Kind: instance method of LinkedList

Param Type
fn function
[scope] Object

### linkedList.reduce(fn, [value], [scope]) ⇒ * Kind: instance method of LinkedList

Param Type Description
fn function
[value] * Initial value
[scope] Object Scope to apply to the fn passed

### linkedList.toArray() ⇒ Array.<*> Kind: instance method of LinkedList
### LinkedList.Node ⇐ Object Kind: static class of LinkedList
Extends: Object

#### new Node(data, [prev], [next])

Param Type
data Mixed
[prev] Node
[next] Node

#### node.next Kind: instance property of Node
Properties

Type
Node

#### node.prev Kind: instance property of Node
Properties

Type
Node

#### node.data Kind: instance property of Node
Properties

Type
*

#### node.insert(prev, next) Kind: instance method of Node

Param Type
prev Node
next Node

#### node.remove() Remove the given node, nulling out its prev and next pointers

Kind: instance method of Node
## Record ⇐ ProteanClass Kind: global class
Extends: ProteanClass

### new Record([data]) File: utility/record.js

Param Type
[data] Object

### record.length Kind: instance property of Record
Read only: true
Properties

Type
Integer

### record.get(key) ⇒ Mixed Kind: instance method of Record

Param Type
key String

### record.set(keyOrRecord, [value]) ⇒ Record Kind: instance method of Record

Param Type
keyOrRecord String | Record | Object
[value] Mixed

### record.merge(record) ⇒ Record Kind: instance method of Record

Param Type
record Record | Object

### record.remove(key) ⇒ Mixed Kind: instance method of Record

Param Type
key String

### record.has(key) ⇒ Boolean Kind: instance method of Record

Param Type
key String

### record.clear() ⇒ Record Kind: instance method of Record
### record.key(idx) ⇒ String Kind: instance method of Record

Param Type
idx Integer

### record.valueOf() ⇒ Object Kind: instance method of Record
### record.clone([values]) ⇒ Record Kind: instance method of Record

Param Type
[values] Object

## onNextFunction : function Kind: global typedef

Param Type
value Mixed

## onErrorFunction : function Kind: global typedef

Param Type
error Error

## onCompletedFunction : function Kind: global typedef
## Observable Kind: global typedef
Implements: Observable
### observable.subscribe(onNextOrObserver, [onError], [onCompleted]) ⇒ Disposable Kind: instance method of Observable

Param Type
onNextOrObserver onNextFunction | Observer
[onError] onErrorFunction
[onCompleted] onCompletedFunction

## Observer Kind: global typedef
Implements: Observer

### observer.onNext : onNextFunction Kind: instance property of Observer
### observer.onError : onErrorFunction Kind: instance property of Observer
### observer.onCompleted : onCompletedFunction Kind: instance property of Observer
## Disposable Kind: global typedef
Implements: Disposable
### disposable.dispose() Kind: instance method of Disposable
## Subject ⇐ Observable Kind: global typedef
Extends: Observable
Mixes: Observer, Disposable
See: https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/subjects/subject.md
## DataSource Kind: global typedef
Implements: DataSource

### dataSource.get(paths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of DataSource

Param Type
paths Array.<PathSet>

### dataSource.set(envelope) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of DataSource

Param Type
envelope JSONGraphEnvelope

### dataSource.call(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope> Kind: instance method of DataSource

Param Type
path PathSet
args Array.<Mixed>
refSuffixes Array.<PathSet>
thisPaths Array.<PathSet>

## Sentinel : Object Kind: global typedef
Properties

Name Type
$type String
value Mixed

## Reference : Sentinel Kind: global typedef
Properties

Name Type Default
$type String 'ref'
value Path

## RootReference : Reference Kind: global typedef
Properties

Name Type Default
$root Boolean true

## Atom : Sentinel Kind: global typedef
See: http://netflix.github.io/falcor/doc/global.html#Atom
Properties

Name Type Default
$type String 'atom'
$expires Integer

## JSONEnvelope : Object Kind: global typedef
See: http://netflix.github.io/falcor/doc/global.html#JSONGraph
Properties

Name Type
json Object

## JSONGraph : Object Kind: global typedef
See: http://netflix.github.io/falcor/doc/global.html#JSONGraph
## JSONGraphEnvelope : Object Kind: global typedef
See: http://netflix.github.io/falcor/doc/global.html#JSONGraphEnvelope
Properties

Name Type
jsonGraph JSONGraph
paths Array.<PathSet>
invalidated Array.<PathSet>

## Key : String | null Kind: global typedef
See: http://netflix.github.io/falcor/doc/global.html#Key
## KeySet : Key | Range | Array.<(Key|Range)> Kind: global typedef
See: http://netflix.github.io/falcor/doc/global.html#KeySet
## Path : Array.<Key> Kind: global typedef
See: http://netflix.github.io/falcor/doc/global.html#Path
## PathSet : Array.<KeySet> Kind: global typedef
See: http://netflix.github.io/falcor/doc/global.html#PathSet
## PathValue : Object Kind: global typedef
See: http://netflix.github.io/falcor/doc/global.html#PathValue
Properties

Name Type
path Path
value *

## Range : Object Kind: global typedef
See: http://netflix.github.io/falcor/doc/global.html#Range
Properties

Name Type
from Integer
to Integer
length Integer

Report an Issue

License

Copyright (c) 2015 Jerry Hamlet jerry@hamletink.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

The Software shall be used for Good, not Evil.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.