pareto-api v11.0.1
pareto-api
this package defines the API for the pareto package (https://github.com/corno/pareto) This package can be included in packages that only define API's and that want to use the pareto style of programming
pareto has the following interfaces:
Value
Value is a promise like interface
it supports the following method:
handle
there are 2 flavors:
IValue
andIUnsafeValue
.The unsafe value has a possible error state (which is similar to the native
Promise
class, but where the error is typesafe).The safe value does not have an error state
Lookup
supports the following method:
getEntry
there are 2 flavors:
Save
andUnsave
: An unsafe lookup can give a custom error when the getEntry method is called. This is useful when the Lookup is not guaranteed to be always available
Dictionary
extends
Lookup
, supports the following additional methodscreateEntry
deleteEntry
renameEntry
copyEntry
getKeys
there are 2 additional flavors;
Loose
vsStrict
, leading to 4 alternatives:ISafeLooseDictionary
IUnsafeLooseDictionary
ISafeStrictDictionary
IUnsafeStrictDictionary
Loose/Strict: Stict means that the provider is guaranteed to implement all methods. Loose means that the provider is not guaranteed to implement all methods
Resource
a Resource is an interface that can be opened (giving access to the content), and must be closed afterwards.
there are
Openable
andOpened
interfaces, both in 2 flavors:Safe
andUnsafe
Openable
interfaces have a method calledopen
giving access to theOpened
intefaceOpened
interfaces have a method calledclose
and a member calledcontent
Safe
vsUnsafe
indicates wether theopen
orclose
method can result in an error
Stream
a Stream is an interface that has a method called
handle
to which aStreamConsumer
must be provided. The StreamConsumer must implement a method calledonData
and a method calledonEnd
. The stream is callingonData
zero or more times until the end of the stream is reached and thenonEnd
is called.There is a specialization of the
Stream
interface calledKeyValueStream
which enforces that the data are key/value pairs
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago