Adds all entities in the list to the store in bulk.
Adds a single entity to a collection in the store. If a collection does not exist in the store object, it will be created.
Creates a trigger scoped to a particular collection. This is a low-level primitive to basically map over mobx's intercept and observe for a particular collection
Creates a store for use with decorators and other helper functions. Meant to be used as a singleton, but can also be used to create multiple distinct storage areas.
Syntactic sugar functions over dropping all constraint from the store. Since constraints are triggers, this will delete all underlying triggers from the store
Drops all triggers from the store. Note: constraints are implemented as triggers, so this function will drop all constraints as well
Syntactic sugar functions over dropping a given constraint from the store. Since constraints are triggers, this will delete the underlying trigger from the store
Drops a single trigger from the store
Ensures that the store contains a collection for this entityClass
Ensures that the store is populated with the index mappings for this entityClass
Runs a given trigger, filtering out event types that aren't relevant to the current trigger
Finds all entities in the store by a given findClause that acts as a filter. Default filter is the identity function, which ensures that all entities will be returned.
Finds all entries in the store by a given value. Similar to findAll, but without dependence on a primary key. Attempts to use indexes to find a particular value, falls back to non-indexed filter.
Finds a single entry in the store by a given primaryKey. This can be useful in situations where you know the primary key but don't wish to keep an object reference around, such as in callback functions or factory functions.
Finds a single instance by value. Throws if there are too many or too few entries retrieved. Single case of
findAllBy
Joins two collections based on their applicable relationships. Currently only works for left joins based on the parent entity.
Removes all given entities from the store in bulk. Entities can be homogenous in type
or multiple types. This will also cascade any deletions to the any children with cascade: true
relationships
Removes the given entity from the store. This function will cause an auto-cascade on all relationships
referencing this object if the relationship's options include cascade: true
. This is a recursive function
in the cascading case and will force update all other relationships referencing the same child entity.
Truncates a given collection in the store and triggers any observables watching this particular collection. This is essentially a very fast form of mass deletion.
This does not automatically cascade to subsequent tables, since that's a fairly slow operation. This will
leave items in referenced tables. However, if the cascade
option is included, then it will truncate all
tables that are referenced by this table, regardless of cascade options on the relationship.
Wraps a trigger for execution
Creates a CHECK constraint against a collection in the store. CHECK constraints can be against multiple columns of the row, or a single column in the row
The name(s) of the columns to check
The ID of the trigger, for reference when deleting
Ensures that a given column in a row is not nullable. This constraint runs on every update to the collection (i.e. every time something is added to the collection)
The ID of the trigger, for reference when deleting
Ensures that a given property is not undefined. This constraint runs on every update to the collection (i.e. every time something is added to the collection)
The ID of the trigger, for reference when deleting
Creates a unique constraint on a field in a given object. This implies that the field will be indexed.
The ID of the trigger, for reference when deleting
Ensures that the prototype contains a __meta__
attribute
Ensures that the current target has a meta attribute attached, and ensures that the meta is attached to the target itself and not its prototype
Ensures that the entity has a relationship mapping in its __meta__
property
Unboxes a value from a mobx observable.box
Gets the key to use for indexing purposes. Primitives return as themselves, more complex objects return as string hashes.
Gets only a single value from a list of values. Throws if there aren't any items present or if there are too many values present
Creates an indexed value in the store. This will be used for fast lookups in the case of specialized filters. Currently not implemented.
Intializes a store and provides helper methods bound to that store for convenience. Note: calling this function multiple times will have no side effects, multiple stores will be returned for use by the user.
Determines if an invariant condition has been met and throws an error if the precondition was falsy. Includes NODE_ENV checks for dead code elimination.
Checks that a field will never receive null
as a value
Checks that a field will never receive undefined
as a value
Defines a primary key for the current target. This primary key will be used for uniquely identifying the object in the store, as well as identifying the entity in any relationships. Each model must have a primary key for identification purposes.
Note: currently the primary key must be a single value. This is due to limitations in the internal storage mechanism of ES6 Maps.
Describes a relationship to another model. The related model will be referenced by its primary key for accessing purposes.
When assigning to the relationship, all items are added to the store. When removing from the list, via pop or splice, all items removed are not necessarily removed from the store unless otherwise specified in the relationship options.
Values can also be replaced in lists via indexing. While any new values will be added to the store, replaced values will not be removed from the store unless otherwise specified in the relationship options, similar to the approach for splice and pop.
Defines a custom check function to be used while adding this object to the store.
Checks that the field has a unique value. Implies that an index will be created
Generated using TypeDoc