0.6.1 • Published 8 years ago

protean v0.6.1

Weekly downloads
2
License
-
Repository
github
Last release
8 years ago

Protean

An ever changing set of utilities.

Summary

Installation

% npm install protean

API

Modules

Protean.Rx

Kind: static property of Protean

Rx.append ⇒ Observable.<String>

Kind: static property of Rx

ParamType
filepathString
dataBuffer | String
optsObject | String

Rx.mv ⇒ Observable.<String>

File: rx/fs/mv.js

Kind: static property of Rx

ParamTypeDefault
fromString
toString
optsObject
opts.mkdirpBooleanfalse
opts.clobberBooleanfalse

Rx.fsWrapper ⇒ function

Kind: static property of Rx

ParamType
methodString

Rx.write ⇒ Observable.<String>

Kind: static property of Rx

ParamType
filepathString
dataBuffer | String
optsObject | String

Rx.from(arg) ⇒ Observable

File: rx/from.js

Kind: static method of Rx

ParamType
argObservable | Promise | Array | Object

Rx.cp(from, to, opts) ⇒ Observable.<fs.Stats>

File: rx/fs/cp.js

Kind: static method of Rx

ParamTypeDefault
fromString | Array.<String> | Observable.<String> | Promise.<String>
toString
optsObject
opts.recursiveBooleantrue
opts.forceBooleanfalse

Rx.glob(pattern, opts) ⇒ Observable.<String>

File: rx/glob.js

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

ParamTypeDescription
patternStringThe glob pattern
optsObjecthttps://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

ParamType
pathsString | Array.<String> | Observable.<String>

Rx.isFile(paths) ⇒ Observable.<Boolean>

File: rx/is-file.js

Kind: static method of Rx

ParamType
pathsString | 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

ParamTypeDefault
pathsString | Array.<String> | Observable.<String>
optsObject
opts.modeString'0777'

Rx.read(patterns, enc) ⇒ Observable.<(String|Buffer)>

File: rx/read.js

Kind: static method of Rx

ParamType
patternsString | Array.<String> | Observable.<String> | Promise.<String>
encString

Rx.rm(patterns, recursive) ⇒ Observable.<String>

File: rx/rm.js

Kind: static method of Rx

ParamTypeDefault
patternsString | Array.<String> | Observable.<String> | Promise.<String>
recursiveBooleantrue

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

ParamType
patternsString | Array.<String> | Observable.<String> | Promise.<String>

stat.link(patterns) ⇒ Observable.<external:fs.Stats>

Kind: static method of stat

ParamType
patternsString | Array.<String> | Observable.<String> | Promise.<String>

stat.fd(fds) ⇒ Observable.<external:fs.Stats>

Kind: static method of stat

ParamType
fdsInteger | 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

ParamType
objObject
nameString

Protean.invoke ⇒ *

Kind: static property of Protean

ParamType
propertyString
subjectObject

Protean.pluck ⇒ * | function

File: object/pluck.js

Kind: static property of Protean

ParamType
keyString
objObject

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

ParamType
argString | 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

ParamTypeDescription
subclassfunctionThe subclass constructor function.
propsObjectBare properties for the constructor's prototype.
propertiesObjectObject.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.

ParamTypeDefaultDescription
superclassfunctionThe function to inherit from.
subclassfunctionFunctionThe Subclass constructor function. If omitted, and a constructor property is not defined in props, defaults to a function that calls the superclass' constructor function.
propsObjectBare properties to initialize the prototype with.
propertiesObject{}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

ParamTypeDescription
fnfunctionThe constructor function
argsArray.<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

ParamType
...objObject

Protean.enmap(...args) ⇒ Object

Takes a list of alternating key/values and returns an object.

File: object/enmap.js

Kind: static method of Protean

ParamType
...argsMixed

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

ParamTypeDefaultDescription
objObject
visitorvisitorFn
postBooleanfalseDo 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'.

ParamTypeDescription
pathArray.<String>The path to the value
valueMixedThe value
contextObjectThe 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

ParamType
receiverObject
supplierfunction | 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

ParamType
sourceObject
pathString | Array.<String>
value*

Graph.atoms(graph, fn)

File: falcor/graph/atoms.js

Kind: static method of Graph

ParamType
graphJSONGraph
fnGraph.atoms~visitorFn

atoms~visitorFn(path, atom, graph)

Kind: inner method of atoms

ParamType
pathPath
atomAtom
graphJSONGraph

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

ParamTypeDefault
objObject
optsObject
opts.arrayIsRefBooleantrue
opts.rootPath[]

Graph.isAtom(sentinel) ⇒ Boolean

File: falcor/graph/is-atom.js

Kind: static method of Graph

ParamType
sentinel*

Graph.isError(sentinel) ⇒ Boolean

File: falcor/graph/is-error.js

Kind: static method of Graph

ParamType
sentinel*

Graph.isRef(sentinel) ⇒ Boolean

File: falcor/graph/is-ref.js

Kind: static method of Graph

ParamType
sentinel*

Graph.isRootRef(sentinel) ⇒ Boolean

File: falcor/graph/is-root-ref.js

Kind: static method of Graph

ParamType
sentinel*

Graph.isSentinel(sentinel) ⇒ Boolean

File: falcor/graph/is-sentinel.js

Kind: static method of Graph

ParamType
sentinel*

Graph.refs(graph, fn)

File: falcor/graph/refs.js

Kind: static method of Graph

ParamType
graphJSONGraph
fnGraph.atoms~visitorFn

refs~visitorFn(path, ref, graph)

Kind: inner method of refs

ParamType
pathPath
refReference
graphJSONGraph

Graph.relative(root, graph) ⇒ JSONGraph

File: falcor/graph/relative.js

Kind: static method of Graph

ParamType
rootPath
graphJSONGraph

Graph.resolve(root, graph) ⇒ JSONGraph

File: falcor/graph/resolve.js

Kind: static method of Graph

ParamType
rootPath
graphJSONGraph

Graph.rootRef(path, value, props) ⇒ Reference

File: falcor/graph/root-ref.js

Kind: static method of Graph

ParamType
pathPath
valuePath
propsObject

Graph.sentinels(graph, fn)

File: falcor/graph/sentinels.js

Kind: static method of Graph

ParamType
graphJSONGraph
fnGraph.sentinels~visitorFn

sentinels~visitorFn(path, sentinel, graph)

Kind: inner method of sentinels

ParamType
pathPath
sentinelSentinel
graphJSONGraph

Graph.toObject(graph, opts) ⇒ JSONGraph

Takes a JSONGraph and returns a Javascript Object.

File: falcor/graph/to-object.js

Kind: static method of Graph

ParamType
graphJSONGraph
optsObject

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

ParamType
rootPath
pathsArray.<PathSet>

Path.resolve(root, paths) ⇒ Array.<PathSet>

File: falcor/path/resolve.js

Kind: static method of Path

ParamType
rootPath
pathsArray.<PathSet>

CollectionSource ⇐ ProteanClass

Kind: global class
Extends: ProteanClass
Implements: DataSource

new CollectionSource(collection, opts)

file: falcor/data-source/collection.js

ParamTypeDefault
collectionCollection
optsObject
opts.indexedPathPath'byIndex'
opts.keyedPathPath'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

ParamType
pathsArray.<PathSet>

collectionSource.set(envelope) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of CollectionSource
Implements: set

ParamType
envelopeJSONGraphEnvelope

collectionSource.call(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of CollectionSource
Implements: call

ParamType
pathPathSet
argsArray.<Mixed>
refSuffixesArray.<PathSet>
thisPathsArray.<PathSet>

collectionSource.getLength() ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of CollectionSource

collectionSource.getRecordByIndex(paths) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of CollectionSource

ParamType
pathsArray.<PathSets>

collectionSource.getRecordProps(paths) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of CollectionSource

ParamType
pathsArray.<PathSets>

collectionSource.setRecordProps(graph) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of CollectionSource

ParamType
graphJSONGraph

collectionSource.addRecord(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of CollectionSource

ParamType
pathPathSet
argsArray.<Mixed>
refSuffixesArray.<PathSet>
thisPathsArray.<PathSet>

collectionSource.removeRecord(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of CollectionSource

ParamType
pathPathSet
argsArray.<Mixed>
refSuffixesArray.<PathSet>
thisPathsArray.<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

ParamType
...argsArray.<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

ParamType
pathsArray.<PathSets>

compositeSource.set(envelope) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of CompositeSource
Implements: set

ParamType
envelopeJSONGraphEnvelope

compositeSource.call(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of CompositeSource
Implements: call

ParamType
pathPath
argsArray.<Mixed>
refSuffixesArray.<PathSet>
thisPathsArray.<PathSet>

compositeSource.add(path, source) ⇒ CompositeSource

Kind: instance method of CompositeSource
Returns: CompositeSource - the CompositeSource instance

ParamType
pathPath
sourceDataSource

JSONGraphEnvelopeProxy ⇐ ProteanClass

Kind: global class
Extends: ProteanClass
Implements: JSONGraphEnevelope

new JSONGraphEnvelopeProxy(opts)

ParamTypeDescription
optsObject
opts.expectArray.<PathSet>Paths to expect
opts.pathsArray.<PathSet>A starting set of paths
opts.jsonGraphJSONGraphA starting JSONGraph
opts.invalidatedArray.<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

ParamType
pathOrGraphPath | JSONGraph
atomAtom

jsonGraphEnvelopeProxy.invalidate(...path)

Kind: instance method of JSONGraphEnvelopeProxy

ParamType
...pathPath

jsonGraphEnvelopeProxy.fulfill(path)

Mark a path as fulfilled and set the given value on our jsonGraph

Kind: instance method of JSONGraphEnvelopeProxy

ParamType
pathPath

jsonGraphEnvelopeProxy.expect(paths)

Prepare this envelope to expect to fulfill a certain set of paths.

Kind: instance method of JSONGraphEnvelopeProxy

ParamType
pathsArray.<PathSet>

jsonGraphEnvelopeProxy.relativeFrom(from) ⇒ JSONGraphEnvelopeProxy

Kind: instance method of JSONGraphEnvelopeProxy
Returns: JSONGraphEnvelopeProxy - A copy

ParamType
fromPath

jsonGraphEnvelopeProxy.resolvedFrom(from) ⇒ JSONGraphEnvelopeProxy

Kind: instance method of JSONGraphEnvelopeProxy
Returns: JSONGraphEnvelopeProxy - A copy

ParamType
fromPath

jsonGraphEnvelopeProxy.merge(other)

Merge another JSONGraphEnvelope into this one

Kind: instance method of JSONGraphEnvelopeProxy

ParamType
otherJSONGraphEnvelopeProxy | 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

ParamType
optsObject
opts.sourceDataSource

noCacheSource.get(paths) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of NoCacheSource
Implements: get

ParamType
pathsArray.<PathSets>

noCacheSource.set(envelope) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of NoCacheSource
Implements: set

ParamType
envelopeJSONGraphEnvelope

noCacheSource.call(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of NoCacheSource
Implements: call

ParamType
pathPathSet
argsArray.<Mixed>
refSuffixesArray.<PathSet>
thisPathsArray.<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.

ParamTypeDefault
optsObject
opts.readsArray.<String>[]
opts.writesArray.<String>[]
opts.partitionsObject.<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

ParamType
pathsArray.<PathSet>

partitionedSource.set(envelope) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of PartitionedSource
Implements: set

ParamType
envelopeJSONGraphEnvelope

partitionedSource.call(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of PartitionedSource
Implements: call

ParamType
pathPathSet
argsArray.<Mixed>
refSuffixesArray.<PathSet>
thisPathsArray.<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

ParamType
optsObject
opts.sourceDataSource
opts.rootPath

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

ParamType
pathsArray.<PathSets>

proxiedSource.set(envelope) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of ProxiedSource
Implements: set

ParamType
envelopeJSONGraphEnvelope

proxiedSource.call(path, args, refSuffixes, thisPaths) ⇒ Observable.<JSONGraphEnvelope>

Kind: instance method of ProxiedSource
Implements: call

ParamType
pathPathSet
argsArray.<Mixed>
refSuffixesArray.<PathSet>
thisPathsArray.<PathSet>

proxiedSource.willGet(paths) ⇒ Boolean

Will the given paths be consumed by a get request against this datasource?

Kind: instance method of ProxiedSource

ParamType
pathsArray.<PathSet>

proxiedSource.willSet(envelope) ⇒ Boolean

Will the given JSONGraphEnvelope be consumed by a set request against this datasource?

Kind: instance method of ProxiedSource

ParamType
envelopeJSONGraphEnvelope

proxiedSource.willCall(path) ⇒ Boolean

Will the given path be consumed by a call request against this datasource?

Kind: instance method of ProxiedSource

ParamType
pathPath

proxiedSource.getRelativeEnvelope(envelope) ⇒ JSONGraphEnvelope

Strip our leading path from the envelope's path(s) and jsonGraph object.

Kind: instance method of ProxiedSource

ParamType
envelopeJSONGraphEnvelope

proxiedSource.getResolvedEnvelope(envelope) ⇒ JSONGraphEnvelope

Adjust the JSONGraphEnvelope to reflect our leading path information.

Kind: instance method of ProxiedSource

ParamType
envelopeJSONGraphEnvelope

StorageSource ⇐ ProteanClass

Kind: global class
Extends: ProteanClass
Implements: DataSource

0.6.1

8 years ago

0.6.0

9 years ago

0.5.6

9 years ago

0.5.5

9 years ago

0.5.4

9 years ago

0.5.3

9 years ago

0.5.2

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.3

9 years ago

0.4.4

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.0

9 years ago

0.2.6

9 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.6

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago