Optional
stackStatic
Optional
prepareStatic
stackStatic
captureOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureEntity interface.
+Initialize an entity.
+Rest
..._rest: any[]Protected
$dataThe data proxy object.
+Protected
$dataThe data proxy handler.
+Protected
$dataThe actual data store.
+Protected
$dirtyA map of props to whether they're dirty (for patch).
+Protected
$isASleepingWhether this instance is a sleeping reference.
+The instance of Nymph to use for queries.
+Protected
$originalArray of the entity's original tags (for patch).
+Protected
$sleepingThe reference to use to wake.
+Protected
$wakeA promise that resolved when the entity's data is wake.
+The creation date of the entity as a high precision Unix timestamp.
+The entity's Globally Unique ID.
+The modified date of the entity as a high precision Unix timestamp.
+Array of the entity's tags.
+Static
classThe lookup name for this entity.
+This is used for reference arrays (and sleeping references) and server +requests.
+Static
nymphThe instance of Nymph to use for queries.
+Search the array for this object and return the corresponding index.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Whether to use stronger comparison.
+The index if the object is in the array, -1 if it isn't.
+Protected
$checkGet a patch of this entity's dirty data to be applied on the server.
+Check whether this object is in an array.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Whether to use stronger comparison.
+True if the object is in the array, false if it isn't.
+Initialize this entity from a JSON representation.
+The entity JSON.
+Protected
$referenceRefresh the object from storage. (Bypasses Nymph's cache.)
+If the object has been deleted from storage, the database cannot be
+reached, or a database error occurs, refresh()
will return 0.
False if the data has not been saved, 0 if it can't be refreshed, true on success.
+Call an instance method on the server version of this entity.
+The entity's data will be sent up to the server as well, so the server's +state can match the client's state. It won't be propagated into the DB, +though.
+The name of the method.
+The parameters to call the method with.
+Whether the server should return, and the client update, the data in the entity after the method has run.
+The value that the method on the server returned.
+Return a Nymph Entity Reference for this entity.
+If the entity hasn't been saved yet (and has no GUID), it will be +returned instead.
+A Nymph Entity Reference array as an unsaved entity.
+Ready this entity's data, and the data of entity's within this one's.
+Optional
level: numberThe number of levels deep to wake. If undefined, it will keep going until there are no more entities. (Careful of infinite loops.)
+The entity.
+Static
factoryCreate or retrieve a new entity instance.
+Note that this will always return an entity, even if the GUID is not found.
+Static
factoryCreate a new sleeping reference instance.
+Sleeping references won't retrieve their data from the server until they
+are readied with $wake()
or a parent's $wakeAll()
.
The Nymph Entity Reference to use to wake.
+The new instance.
+Static
factoryCreate a new entity instance.
+Static
serverStatic
serverCall a static iterator method on the server version of this entity.
+The name of the method.
+The parameters to call the method with.
+An iterator that iterates over values that the method on the server yields.
+Optional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureThe entity class for this instance of Nymph.
+The entity cache.
+Private
entityA simple map of names to Entity classes.
+Headers that will be sent with every request.
+These are used by Tilmeld for authentication.
+And optional PubSub client instance.
+Private
requestPrivate
responsePrivate
restPrivate
weakAdd your class to this instance.
+This will create a class that extends your class within this instance of +Nymph and return it. You can then use this class's constructor and methods, +which will use this instance of Nymph.
+Because this creates a subclass, don't use the class
+returned from getEntityClass
to check with instanceof
.
Private
requestPrivate
WebOptional
protocols: string | string[]Readonly
CLOSED: 3Readonly
CLOSING: 2Readonly
CONNECTING: 0Readonly
OPEN: 1Private
authPrivate
connectPrivate
connectionPrivate
disconnectPrivate
errorPrivate
noPrivate
nymphPrivate
pubsubPrivate
subscriptionsPrivate
switchPrivate
waitPrivate
_attemptPrivate
_isPrivate
_isPrivate
_onclosePrivate
_onmessagePrivate
_onopenPrivate
_sendPrivate
_sendPrivate
_sendUIDPrivate
_sendPrivate
_sendPrivate
_subscribePrivate
_subscribeUIDPrivate
_unsubscribePrivate
_unsubscribeUIDPrivate
_waitOptional
resolve: PubSubResolveCallback<number>Optional
reject: PubSubRejectCallbackOptional
count: PubSubCountCallbackOptional
resolve: PubSubResolveCallback<T>Optional
reject: PubSubRejectCallbackOptional
count: PubSubCountCallbackOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureThe entity class for this instance of Nymph.
+The entity cache.
+Headers that will be sent with every request.
+These are used by Tilmeld for authentication.
+And optional PubSub client instance.
+Add your class to this instance.
+This will create a class that extends your class within this instance of +Nymph and return it. You can then use this class's constructor and methods, +which will use this instance of Nymph.
+Because this creates a subclass, don't use the class
+returned from getEntityClass
to check with instanceof
.
Optional
_plural: booleanOptional
stateless: booleanOptional
resolve: PubSubResolveCallback<number>Optional
reject: PubSubRejectCallbackOptional
count: PubSubCountCallbackOptional
resolve: PubSubResolveCallback<T>Optional
reject: PubSubRejectCallbackOptional
count: PubSubCountCallbackThe MySQL Nymph database driver.
+Optional
link: PoolOptional
transaction: MySQLDriverTransactionProtected
connectedProtected
entityA cache to make entity retrieval faster.
+Protected
entityA counter for the entity cache to determine the most accessed entities.
+Protected
linkPrivate
mysqlProtected
nymphProtected
prefixProtected
transactionOptional
guid: null | stringOptional
tags: null | string[]Protected
cleanThis is used internally by Nymph. Don't call it yourself.
+A clone of this instance.
+Private
createOptional
className: null | string | EntityConstructorProtected
entitySearch through a value for an entity reference.
+Any value to search.
+An entity, GUID, or array of either to search for.
+True if the reference is found, false otherwise.
+Protected
findPrivate
getProtected
getInitialize the Nymph driver.
+This is meant to be called internally by Nymph. Don't call this directly.
+The Nymph instance.
+Protected
internalProtected
iteratePrivate
makeGenerate the MySQL query.
+The options array.
+The formatted selector array.
+Used to track internal params.
+Used to store internal params.
+Whether only a subquery should be returned.
+The SQL query.
+Protected
performProtected
posixProtected
pullPull an entity from the cache.
+The entity's GUID.
+The entity's class.
+Optional
useSkipAc: booleanWhether to tell the entity to use skip_ac.
+The entity or null if it's not cached.
+Protected
pushPush an entity onto the cache.
+The entity's GUID.
+The entity's cdate.
+The entity's mdate.
+The entity's tags.
+The entity's data.
+The entity's sdata.
+Private
queryPrivate
queryPrivate
queryPrivate
queryProtected
saveOptional
startTransactionCallback: null | (() => Promise<void>)Optional
commitTransactionCallback: null | ((success) => Promise<boolean>)Private
translateStatic
escapeStatic
escapeThe PostgreSQL Nymph database driver.
+Optional
link: PoolOptional
transaction: PostgreSQLDriverTransactionProtected
connectedProtected
entityA cache to make entity retrieval faster.
+Protected
entityA counter for the entity cache to determine the most accessed entities.
+Protected
linkProtected
nymphPrivate
postgresqlProtected
prefixProtected
transactionOptional
guid: null | stringOptional
tags: null | string[]Protected
cleanThis is used internally by Nymph. Don't call it yourself.
+A clone of this instance.
+Private
createOptional
className: null | string | EntityConstructorProtected
entitySearch through a value for an entity reference.
+Any value to search.
+An entity, GUID, or array of either to search for.
+True if the reference is found, false otherwise.
+Protected
findPrivate
getProtected
getInitialize the Nymph driver.
+This is meant to be called internally by Nymph. Don't call this directly.
+The Nymph instance.
+Protected
internalProtected
iteratePrivate
makeGenerate the PostgreSQL query.
+The options array.
+The formatted selector array.
+Used to track internal params.
+Used to store internal params.
+Whether only a subquery should be returned.
+The SQL query.
+Protected
performProtected
posixProtected
pullPull an entity from the cache.
+The entity's GUID.
+The entity's class.
+Optional
useSkipAc: booleanWhether to tell the entity to use skip_ac.
+The entity or null if it's not cached.
+Protected
pushPush an entity onto the cache.
+The entity's GUID.
+The entity's cdate.
+The entity's mdate.
+The entity's tags.
+The entity's data.
+The entity's sdata.
+Private
queryPrivate
queryPrivate
queryPrivate
queryOptional
connection?: PostgreSQLDriverConnectionOptional
etypes?: string[]Optional
params?: { Protected
saveOptional
startTransactionCallback: null | (() => Promise<void>)Optional
commitTransactionCallback: null | ((success) => Promise<boolean>)Private
translateStatic
escapeStatic
escapeStatic
escapeStatic
escapeStatic
unescapeStatic
unescapeThe SQLite3 Nymph database driver.
+Optional
store: InternalStoreProtected
entityA cache to make entity retrieval faster.
+Protected
entityA counter for the entity cache to determine the most accessed entities.
+Protected
nymphProtected
prefixProtected
storePrivate
_connectOptional
guid: null | stringOptional
tags: null | string[]Protected
cleanThis is used internally by Nymph. Don't call it yourself.
+A clone of this instance.
+Private
createOptional
className: null | string | EntityConstructorProtected
entitySearch through a value for an entity reference.
+Any value to search.
+An entity, GUID, or array of either to search for.
+True if the reference is found, false otherwise.
+Protected
findProtected
getInitialize the Nymph driver.
+This is meant to be called internally by Nymph. Don't call this directly.
+The Nymph instance.
+Protected
iteratePrivate
makeGenerate the SQLite3 query.
+The options array.
+The formatted selector array.
+Used to track internal params.
+Used to store internal params.
+Whether only a subquery should be returned.
+The SQL query.
+Protected
performProtected
posixProtected
pullPull an entity from the cache.
+The entity's GUID.
+The entity's class.
+Optional
useSkipAc: booleanWhether to tell the entity to use skip_ac.
+The entity or null if it's not cached.
+Protected
pushPush an entity onto the cache.
+The entity's GUID.
+The entity's cdate.
+The entity's mdate.
+The entity's tags.
+The entity's data.
+The entity's sdata.
+Private
queryPrivate
queryPrivate
queryPrivate
queryProtected
saveOptional
startTransactionCallback: null | (() => Promise<void>)Optional
commitTransactionCallback: null | ((success) => Promise<boolean>)Static
escapeOptional
causeOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureDatabase abstraction object.
+Provides a way to access, manipulate, and store data in Nymph.
+The GUID is not set until the entity is saved. GUIDs must be unique forever, +even after deletion. It's the job of the Nymph DB driver to make sure no two +entities ever have the same GUID. This is generally done by using a large +randomly generated ID.
+Each entity class has an etype that determines which table(s) in the database +it belongs to. If two entity classes have the same etype, their data will be +stored in the same table(s). This isn't a good idea, however, because +references to an entity store a class name, not an etype.
+Tags are used to classify entities. Where an etype is used to separate data +by tables, tags can be used to separate entities within a table. You can +define specific tags to be protected, meaning they cannot be added/removed +from the client. It can be useful to allow user defined tags, such as for +blog posts.
+Simply calling $delete() will not unset the entity. It will still take up +memory. Likewise, simply calling unset will not delete the entity from the +DB.
+Some notes about $equals() and $is(), the replacements for "==":
+The == operator will likely not give you the result you want, since two +instances of the same entity will fail that check, even though they represent +the same data in the database.
+$equals() performs a more strict comparison of the entity to another. Use +$equals() instead of the == operator when you want to check both the entities +they represent, and the data inside them. In order to return true for +$equals(), the entity and object must meet the following criteria:
+$is() performs a less strict comparison of the entity to another. Use $is() +instead of the == operator when the entity's data may have been changed, but +you only care if they represent the same entity. In order to return true, the +entity and object must meet the following criteria:
+Some notes about saving entities in other entity's properties:
+Entities use references in the DB to store an entity in their properties. The +reference is stored as an array with the values:
+Since the referenced entity's class name (meaning the class
static
+property, not the name of the class itself) is stored in the reference on the
+parent entity, if you change the class name in an update, you need to
+reassign all referenced entities of that class and resave.
When an entity is loaded, it does not request its referenced entities from +Nymph. Instead, it creates instances without data called sleeping references. +When you first access an entity's data, if it is a sleeping reference, it +will fill its data from the DB. You can call clearCache() to turn all the +entities back into sleeping references.
+Initialize an entity.
+Rest
..._rest: any[]Protected
Optional
$allowlistIf this is defined, then it lists the only properties that will be +accepted from incoming JSON. Any other properties will be ignored.
+If you use an allowlist, you don't need to use protectedData, since you +can simply leave those entries out of allowlistData.
+Protected
Optional
$allowlistIf this is defined, then it lists the only tags that will be accepted from +incoming JSON. Any other tags will be ignored.
+Protected
$clientThe names of methods allowed to be called by the frontend with serverCall.
+Protected
$dataThe data proxy object.
+Protected
$dataThe data proxy handler.
+Protected
$dataThe actual data store.
+Protected
$isASleepingWhether this instance is a sleeping reference.
+The instance of Nymph to use for queries.
+Private
$originalThe AC properties' values when the entity was loaded.
+Protected
$privateProperties that will not be serialized into JSON with toJSON(). This +can be considered a denylist, because these properties will not be set +with incoming JSON.
+Clients CAN still determine what is in these properties, unless they are +also listed in searchRestrictedData.
+Protected
$protectedProperties that can only be modified by server side code. They will still +be visible on the frontend, unlike $privateData, but any changes to them +that come from the frontend will be ignored.
+In addition to what's listed here, all of the access control properties +will be included when Tilmeld is being used. These are:
+You should modify these through client enabled methods or the $save method +instead, for safety.
+Protected
$protectedTags that can only be added/removed by server side code. They will still be +visible on the frontend, but any changes to them that come from the +frontend will be ignored.
+Protected
$sdataThe actual sdata store.
+Private
$skipWhether to use "skipAc" when accessing entity references.
+Protected
$sleepingThe reference to use to wake.
+Protected
$wakeA promise that resolved when the entity's data is wake.
+The creation date of the entity as a Unix timestamp in milliseconds.
+The entity's Globally Unique ID.
+This is a 12 byte number represented as a lower case HEX string (24 +characters).
+The modified date of the entity as a Unix timestamp in milliseconds.
+Array of the entity's tags.
+Static
ETYPEA unique name for this type of entity used to separate its data from other +types of entities in the database.
+Static
classThe lookup name for this entity.
+This is used for reference arrays (and sleeping references) and client +requests.
+Static
clientThe names of static methods allowed to be called by the frontend with +serverCallStatic.
+Static
nymphThe instance of Nymph to use for queries.
+Static
pubWhether this entity should publish changes to PubSub servers.
+Static
restWhether this entity should be accessible on the frontend through the REST +server.
+If this is false, any request from the client that attempts to use this +entity will fail.
+Static
searchProperties that will not be searchable from the frontend. If the frontend +includes any of these properties in any of their clauses, they will be +filtered out before the search is executed.
+Search the array for this object and return the corresponding index.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Whether to use stronger comparison.
+The index if the object is in the array, -1 if it isn't.
+Protected
$checkGet the current values of the AC properties.
+An object of AC properties.
+Get the original values of the AC properties.
+An object of AC properties.
+Used to retrieve the serialized data object.
+This should only be used by Nymph to save the data object into storage.
+This method is used by Nymph to avoid unserializing data that hasn't been +requested yet.
+It should always be called after getData().
+The entity's serialized data object.
+Get an array of strings that must be unique across the current etype.
+When you try to save another entity with any of the same unique strings, +Nymph will throw an error.
+The default implementation of this method returns an empty array, meaning +there are no uniqueness constraints applied to its etype.
+Resolves to an array of entity's unique constraint strings.
+Check whether this object is in an array.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Whether to use stronger comparison.
+True if the object is in the array, false if it isn't.
+Accept JSON data from the client.
+This function uses the security protection lists:
+The input data. Please note, this will be modified (destroyed).
+Allow to accept data that is older than the current data.
+Accept JSON patch from the client.
+This function uses the security protection lists:
+The patch data. Please note, this will be modified (destroyed).
+Allow to accept data that is older than the current data.
+Used to set the data.
+This should only be used by Nymph to push the data from storage.
+sdata
is used by Nymph to avoid unserializing data that hasn't been
+requested yet.
The data object.
+Optional
sdata: SerializedEntityDataThe serialized data object.
+Protected
$referenceSet up a sleeping reference.
+Refresh the object from storage. (Bypasses Nymph's cache.)
+If the object has been deleted from storage, the database cannot be
+reached, or a database error occurs, refresh()
will return 0.
False if the data has not been saved, 0 if it can't be refreshed, true on success.
+Return a Nymph Entity Reference for this entity.
+If the entity hasn't been saved yet (and has no GUID), it will be +returned instead.
+A Nymph Entity Reference array as an unsaved entity.
+Static
Optional
alterStatic
factoryCreate or retrieve a new entity instance.
+Note that this will always return an entity, even if the GUID is not found.
+Static
factoryCreate a new sleeping reference instance.
+Sleeping references won't retrieve their data from the database until they
+are readied with $wake()
or a parent's $wakeAll()
.
The Nymph Entity Reference to use to wake.
+The new instance.
+Static
factoryCreate a new entity instance.
+Static
getGet an array of strings that must be unique across the current etype.
+When you try to save another entity with any of the same unique strings, +Nymph will throw an error.
+The default implementation of this static method instantiates the entity,
+assigns all of the given data, then calls $getUniques
and returns its
+output. This can have a performance impact if a lot of extra processing
+happens during any of these steps. You can override this method to
+calculate the unique strings faster, but you must return the same strings
+that would be returned by $getUniques
.
Optional
cdate?: numberOptional
guid?: stringOptional
mdate?: numberOptional
sdata?: SerializedEntityDataResolves to an array of entity's unique constraint strings.
+Optional
causeOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureEntityInvalidDataError.
+This exception is meant to be thrown when an attempt to save an entity is +made, and validation on the data of that entity fails.
+Optional
causePrivate
fieldsOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
causeOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
causeOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
causeOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
causeOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
causeOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureAn object relational mapper for Node.js.
+Written by Hunter Perrin for SciActive.
+Initialize Nymph.
+The Nymph configuration.
+The Nymph database driver.
+Optional
tilmeld: TilmeldInterfaceThe Tilmeld user/group manager instance, if you want to use it.
+Optional
parent: NymphUsed internally by Nymph. Don't set this.
+The entity class for this instance of Nymph.
+Private
afterPrivate
afterPrivate
afterPrivate
afterPrivate
afterPrivate
afterPrivate
afterPrivate
afterPrivate
afterPrivate
afterPrivate
beforePrivate
beforePrivate
beforePrivate
beforePrivate
beforePrivate
beforePrivate
beforePrivate
beforePrivate
beforePrivate
beforePrivate
beforePrivate
beforeThe Nymph config.
+Private
connectPrivate
disconnectThe Nymph database driver.
+Private
entityA simple map of names to Entity classes.
+Private
failedPrivate
failedPrivate
failedPrivate
failedPrivate
failedPrivate
failedPrivate
failedThe Nymph instance that this one was cloned from, or null if it's not a +clone.
+Private
queryOptional
tilmeldAn optional Tilmeld user/group manager instance.
+Add your class to this instance.
+This will create a class that extends your class within this instance of +Nymph and return it. You can then use this class's constructor and methods, +which will use this instance of Nymph.
+Because this creates a subclass, don't use the class
+returned from getEntityClass
to check with instanceof
.
Delete an entity from the database.
+The entity.
+True on success, false on failure.
+Export entities to a local file.
+This is the file format:
+#nex2
# The above line must be the first thing in the file.
# Comments begin with #
# And can have white space before them.
# This defines a UID.
<name/of/uid>[5]
<another uid>[8000]
# For UIDs, the name is in angle brackets (<>) and the value follows
# in square brackets ([]).
# This starts a new entity.
{1234abcd}<etype>[tag,list,with,commas]
# For entities, the GUID is in curly brackets ({}), then the etype in
# angle brackets, then the comma separated tag list follows in square
# brackets ([]).
# Properties are stored like this:
# propname=JSON.stringify(value)
abilities=["system/admin"]
groups=[]
inheritAbilities=false
name="admin"
# White space before/after "=" and at beginning/end of line is ignored.
username = "admin"
{2}<etype>[tag,list]
another="This is another entity."
newline="\n"
+
+The file to export to.
+True on success, false on failure.
+Get an array of entities.
+options
is an object, which contains any of the following settings:
If a class is specified, it must have a factory() static method that +returns a new instance.
+Selectors are objects. Any amount of selectors can be provided. Empty
+selectors will be ignored. The type
property of a selector is required
+and can be one of the following strings:
The rest of the properties in the selectors are called selector clauses, +which can be any of the following (in the form selector.name = value, or +selector.name = [value1, value2,...]):
+These clauses can all be negated, by prefixing them with an exclamation +point, such as "!truthy" to mean falsy (or undefined).
+Any clause that accepts an array of name and value can also accept a third +element. If value is null and the third element is a string, the third +element will be used with Locutus' strtotime function to set value to a +relative timestamp. For example, the following selector will look for all +entities that were created in the last day:
+{
type: '&',
gte: ['cdate', null, '-1 day']
}
+
+Locutus' implementation: https://locutus.io/php/datetime/strtotime/ +PHP's documentation: https://www.php.net/manual/en/function.strtotime.php
+This example will retrieve the last two entities where:
+const entities = Nymph.getEntities(
{ class: Entity, reverse: true, limit: 2 },
{
type: '&', // all must be true
tag: 'person',
defined: 'spouse',
equal: [
['gender', 'male'],
['lname', 'Smith']
],
'!equal': ['warnings', 0]
},
{
type: '|', // at least one of the selectors in this must match
selector: [
{
type: '&',
tag: ['level1', 'level2']
},
{
type: '&',
tag: ['access1', 'access2']
}
]
},
{
type: '|', // at least one must be true
tag: ['employee', 'manager']
},
{
type: '|',
equal: [
['name', 'Clark'],
['name', 'James']
],
match: [
['name', 'Chris(topher)?'],
['name', 'Ja(ke|cob)']
]
},
{
type: '!|', // at least one must be false
gte: ['age', 22],
gt: ['pay', 8]
}
);
+
+An array of entities or guids, or a count.
+Use an asterisk to specify any variable.
+Get the first entity to match all options/selectors.
+options and selectors are the same as in getEntities().
+This function is equivalent to setting options.limit to 1 for +getEntities(), except that it will return null if no entity is found. +getEntities() would return an empty array.
+An entity or guid, or null on failure or nothing found, or a number.
+Get the class that uses the specified class name.
+Get the class that uses the specified etype.
+Note that it is fine, though unusual, for two classes to use the same +etype. However, this can lead to very hard to diagnose bugs, so is +generally discouraged.
+Increment or create a unique ID and return the new value.
+Unique IDs, or UIDs are similar to GUIDs, but numeric and sequential.
+A UID can be used to identify an object when the GUID doesn't suffice. On +a system where a new entity is created many times per second, referring +to something by its GUID may be unintuitive. However, the component +designer is responsible for assigning UIDs to the component's entities. +Beware that if a UID is incremented for an entity, and the entity cannot +be saved, there is no safe, and therefore, no recommended way to +decrement the UID back to its previous value.
+If newUID() is passed the name of a UID which does not exist yet, one +will be created with that name, and assigned the value 1. If the UID +already exists, its value will be incremented. The new value will be +returned.
+The UID's name.
+The UID's new value, or null on failure.
+Run all the query callbacks on a query.
+Save an entity to the database.
+If the entity has never been saved (has no GUID), a variable "cdate" +is set on it with the current Unix timestamp.
+The variable "mdate" is set to the current Unix timestamp.
+The entity.
+True on success, false on failure.
+Start an atomic transaction and returns a new instance of Nymph.
+All proceeding changes using this new instance will wait to be written to +the database's permanent storage until commit() is called. You can also +undo all the changes since this function ran with rollback().
+Transactions will nest as long as every name is unique. Internally, Nymph +uses names prefixed with "nymph-".
+A new instance of Nymph that should be used for the transaction.
+Abstract
A Nymph database driver.
+Protected
entityA cache to make entity retrieval faster.
+Protected
entityA counter for the entity cache to determine the most accessed entities.
+Protected
nymphPrivate
putProtect against infinite loops.
+Protected
cleanAbstract
cloneThis is used internally by Nymph. Don't call it yourself.
+A clone of this instance.
+Abstract
commitAbstract
connectAbstract
deleteOptional
className: stringAbstract
deleteUIDAbstract
disconnectProtected
entitySearch through a value for an entity reference.
+Any value to search.
+An entity, GUID, or array of either to search for.
+True if the reference is found, false otherwise.
+Abstract
exportProtected
findAbstract
getProtected
getAbstract
getUIDAbstract
importAbstract
importUIDAbstract
inInitialize the Nymph driver.
+This is meant to be called internally by Nymph. Don't call this directly.
+The Nymph instance.
+Protected
Abstract
internalAbstract
isProtected
iterateAbstract
needsAbstract
newUIDProtected
posixProtected
pullPull an entity from the cache.
+The entity's GUID.
+The entity's class.
+Whether to tell the entity to use skip_ac.
+The entity or null if it's not cached.
+Protected
pushPush an entity onto the cache.
+The entity's GUID.
+The entity's cdate.
+The entity's mdate.
+The entity's tags.
+The entity's data.
+The entity's sdata.
+Abstract
renameUIDAbstract
rollbackAbstract
saveProtected
saveAbstract
setUIDAbstract
startOptional
query: stringOptional
causePrivate
Optional
queryOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
causeOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureA publish/subscribe server for Nymph.
+Written by Hunter Perrin for SciActive.
+The PubSub config.
+The Nymph instance.
+Protected
queryThe WebSocket server.
+Private
sessionsOptional
switchProtected
uidProtected
Static
transactionPrivate
findQRefRest
...selectors: Selector[]Private
handleHandle an authentication from a client.
+Private
handleHandle a publish from a client.
+Private
handleHandle an entity publish from a client.
+Private
handleHandle a UID publish from a client.
+Private
handleHandle a subscribe or unsubscribe from a client.
+Private
handleHandle a subscribe or unsubscribe for a query from a client.
+Optional
qrefParent: { Private
handleHandle a subscribe or unsubscribe for a UID from a client.
+Private
relayPrivate
translateQRefPrivate
updateStatic
initPrivate
Static
isPrivate
Static
publishPrivate
Static
publishPrivate
Static
removeOptional
causeOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
causeOptional
stackOptional
statusOptional
statusStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureEntity Array Sorter
+Sorting functions sort the array in place and also return the sorted array.
+Private
collatorPrivate
comparatorPrivate
sortPrivate
sortPrivate
_arraySort an array of entities hierarchically by a specified property's value.
+Entities will be placed immediately after their parents. The
+parentProperty
property, if present, should hold either null, undefined,
+or the entity's parent.
The name of the property to sort entities by.
+The name of the property which holds the parent of the entity.
+Sort an array of entities by parent and a specified property's value.
+Entities' will be sorted by their parents' properties, then the entities' +properties.
+The name of the property to sort entities by.
+The name of the property which holds the parent of the entity.
+Sort an array of entities by a specified property's value.
+The name of the property to sort entities by.
+Abstract
AbleObject abstract class.
+Used in entities which support abilities, such as users and groups.
+Initialize an entity.
+Rest
..._rest: any[]Protected
Optional
$allowlistIf this is defined, then it lists the only properties that will be +accepted from incoming JSON. Any other properties will be ignored.
+If you use an allowlist, you don't need to use protectedData, since you +can simply leave those entries out of allowlistData.
+Protected
Optional
$allowlistIf this is defined, then it lists the only tags that will be accepted from +incoming JSON. Any other tags will be ignored.
+Protected
$clientThe names of methods allowed to be called by the frontend with serverCall.
+Protected
$dataThe data proxy object.
+Protected
$dataThe data proxy handler.
+Protected
$dataThe actual data store.
+Protected
$isASleepingWhether this instance is a sleeping reference.
+The instance of Nymph to use for queries.
+Protected
$privateProperties that will not be serialized into JSON with toJSON(). This +can be considered a denylist, because these properties will not be set +with incoming JSON.
+Clients CAN still determine what is in these properties, unless they are +also listed in searchRestrictedData.
+Protected
$protectedProperties that can only be modified by server side code. They will still +be visible on the frontend, unlike $privateData, but any changes to them +that come from the frontend will be ignored.
+In addition to what's listed here, all of the access control properties +will be included when Tilmeld is being used. These are:
+You should modify these through client enabled methods or the $save method +instead, for safety.
+Protected
$protectedTags that can only be added/removed by server side code. They will still be +visible on the frontend, but any changes to them that come from the +frontend will be ignored.
+Protected
$sdataThe actual sdata store.
+Protected
$sleepingThe reference to use to wake.
+Protected
$wakeA promise that resolved when the entity's data is wake.
+The creation date of the entity as a Unix timestamp in milliseconds.
+The entity's Globally Unique ID.
+This is a 12 byte number represented as a lower case HEX string (24 +characters).
+The modified date of the entity as a Unix timestamp in milliseconds.
+Array of the entity's tags.
+Static
ETYPEA unique name for this type of entity used to separate its data from other +types of entities in the database.
+Static
classThe lookup name for this entity.
+This is used for reference arrays (and sleeping references) and client +requests.
+Static
clientThe names of static methods allowed to be called by the frontend with +serverCallStatic.
+Static
nymphThe instance of Nymph to use for queries.
+Static
pubWhether this entity should publish changes to PubSub servers.
+Static
restWhether this entity should be accessible on the frontend through the REST +server.
+If this is false, any request from the client that attempts to use this +entity will fail.
+Static
searchProperties that will not be searchable from the frontend. If the frontend +includes any of these properties in any of their clauses, they will be +filtered out before the search is executed.
+Search the array for this object and return the corresponding index.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+The index if the object is in the array, -1 if it isn't.
+Protected
$checkGet the current values of the AC properties.
+An object of AC properties.
+Get the original values of the AC properties.
+An object of AC properties.
+Used to retrieve the serialized data object.
+This should only be used by Nymph to save the data object into storage.
+This method is used by Nymph to avoid unserializing data that hasn't been +requested yet.
+It should always be called after getData().
+The entity's serialized data object.
+Get an array of strings that must be unique across the current etype.
+When you try to save another entity with any of the same unique strings, +Nymph will throw an error.
+The default implementation of this method returns an empty array, meaning +there are no uniqueness constraints applied to its etype.
+Resolves to an array of entity's unique constraint strings.
+Check whether this object is in an array.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+True if the object is in the array, false if it isn't.
+Accept JSON data from the client.
+This function uses the security protection lists:
+The input data. Please note, this will be modified (destroyed).
+Optional
allowConflict: booleanAllow to accept data that is older than the current data.
+Accept JSON patch from the client.
+This function uses the security protection lists:
+The patch data. Please note, this will be modified (destroyed).
+Optional
allowConflict: booleanAllow to accept data that is older than the current data.
+Used to set the data.
+This should only be used by Nymph to push the data from storage.
+sdata
is used by Nymph to avoid unserializing data that hasn't been
+requested yet.
The data object.
+Optional
sdata: SerializedEntityDataThe serialized data object.
+Protected
$referenceSet up a sleeping reference.
+Refresh the object from storage. (Bypasses Nymph's cache.)
+If the object has been deleted from storage, the database cannot be
+reached, or a database error occurs, refresh()
will return 0.
False if the data has not been saved, 0 if it can't be refreshed, true on success.
+Return a Nymph Entity Reference for this entity.
+If the entity hasn't been saved yet (and has no GUID), it will be +returned instead.
+A Nymph Entity Reference array as an unsaved entity.
+Static
Optional
alterStatic
factoryCreate or retrieve a new entity instance.
+Note that this will always return an entity, even if the GUID is not found.
+Static
factoryCreate a new sleeping reference instance.
+Sleeping references won't retrieve their data from the database until they
+are readied with $wake()
or a parent's $wakeAll()
.
The Nymph Entity Reference to use to wake.
+The new instance.
+Static
factoryCreate a new entity instance.
+Static
getGet an array of strings that must be unique across the current etype.
+When you try to save another entity with any of the same unique strings, +Nymph will throw an error.
+The default implementation of this static method instantiates the entity,
+assigns all of the given data, then calls $getUniques
and returns its
+output. This can have a performance impact if a lot of extra processing
+happens during any of these steps. You can override this method to
+calculate the unique strings faster, but you must return the same strings
+that would be returned by $getUniques
.
Optional
cdate?: numberOptional
guid?: stringOptional
mdate?: numberOptional
sdata?: SerializedEntityDataResolves to an array of entity's unique constraint strings.
+Optional
causeOptional
stackOptional
statusOptional
statusStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
causeOptional
stackOptional
statusOptional
statusStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
causeOptional
stackOptional
statusOptional
statusStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
causeOptional
stackOptional
statusOptional
statusStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
causeOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureOptional
causeOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureA user group data model.
+Written by Hunter Perrin for SciActive.
+Protected
Optional
$allowlistIf this is defined, then it lists the only properties that will be +accepted from incoming JSON. Any other properties will be ignored.
+If you use an allowlist, you don't need to use protectedData, since you +can simply leave those entries out of allowlistData.
+Protected
Optional
$allowlistIf this is defined, then it lists the only tags that will be accepted from +incoming JSON. Any other tags will be ignored.
+Protected
$clientThe names of methods allowed to be called by the frontend with serverCall.
+Protected
$dataThe data proxy object.
+Protected
$dataThe data proxy handler.
+Protected
$dataThe actual data store.
+Protected
$isASleepingWhether this instance is a sleeping reference.
+The instance of Nymph to use for queries.
+Protected
$privateProperties that will not be serialized into JSON with toJSON(). This +can be considered a denylist, because these properties will not be set +with incoming JSON.
+Clients CAN still determine what is in these properties, unless they are +also listed in searchRestrictedData.
+Protected
$protectedProperties that can only be modified by server side code. They will still +be visible on the frontend, unlike $privateData, but any changes to them +that come from the frontend will be ignored.
+In addition to what's listed here, all of the access control properties +will be included when Tilmeld is being used. These are:
+You should modify these through client enabled methods or the $save method +instead, for safety.
+Protected
$protectedTags that can only be added/removed by server side code. They will still be +visible on the frontend, but any changes to them that come from the +frontend will be ignored.
+Protected
$sdataThe actual sdata store.
+Private
$skipThis should only be used by the backend.
+Private
$skipThis should only be used by the backend.
+Protected
$sleepingThe reference to use to wake.
+Protected
$tagsProtected
$wakeA promise that resolved when the entity's data is wake.
+The creation date of the entity as a Unix timestamp in milliseconds.
+The entity's Globally Unique ID.
+This is a 12 byte number represented as a lower case HEX string (24 +characters).
+The modified date of the entity as a Unix timestamp in milliseconds.
+Array of the entity's tags.
+Private
Static
DEFAULT_Private
Static
DEFAULT_Static
ETYPEThe instance of Tilmeld to use for queries.
+Static
classThe lookup name for this entity.
+This is used for reference arrays (and sleeping references) and client +requests.
+Static
clientThe names of static methods allowed to be called by the frontend with +serverCallStatic.
+Static
nymphThe instance of Nymph to use for queries.
+Static
pubWhether this entity should publish changes to PubSub servers.
+Static
restWhether this entity should be accessible on the frontend through the REST +server.
+If this is false, any request from the client that attempts to use this +entity will fail.
+Static
searchProperties that will not be searchable from the frontend. If the frontend +includes any of these properties in any of their clauses, they will be +filtered out before the search is executed.
+Search the array for this object and return the corresponding index.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+The index if the object is in the array, -1 if it isn't.
+Protected
$checkGet the current values of the AC properties.
+An object of AC properties.
+Get the number of parents the group has.
+If the group is a top level group, this will return 0. If it is a child of +a top level group, this will return 1. If it is a grandchild of a top level +group, this will return 2, and so on.
+Levels will max out at 1024 to avoid recursive loops.
+The level of the group.
+Get the original values of the AC properties.
+An object of AC properties.
+Used to retrieve the serialized data object.
+This should only be used by Nymph to save the data object into storage.
+This method is used by Nymph to avoid unserializing data that hasn't been +requested yet.
+It should always be called after getData().
+The entity's serialized data object.
+Get an array of strings that must be unique across the current etype.
+When you try to save another entity with any of the same unique strings, +Nymph will throw an error.
+The default implementation of this method returns an empty array, meaning +there are no uniqueness constraints applied to its etype.
+Resolves to an array of entity's unique constraint strings.
+Gets an array of users in the group.
+Include users in all descendant groups too.
+Optional
limit: numberThe limit for the query.
+Optional
offset: numberThe offset for the query.
+An array of users.
+Check whether this object is in an array.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+True if the object is in the array, false if it isn't.
+Accept JSON data from the client.
+This function uses the security protection lists:
+The input data. Please note, this will be modified (destroyed).
+Allow to accept data that is older than the current data.
+Accept JSON patch from the client.
+This function uses the security protection lists:
+The patch data. Please note, this will be modified (destroyed).
+Allow to accept data that is older than the current data.
+Used to set the data.
+This should only be used by Nymph to push the data from storage.
+sdata
is used by Nymph to avoid unserializing data that hasn't been
+requested yet.
The data object.
+Optional
sdata: SerializedEntityDataThe serialized data object.
+Protected
$referenceSet up a sleeping reference.
+Refresh the object from storage. (Bypasses Nymph's cache.)
+If the object has been deleted from storage, the database cannot be
+reached, or a database error occurs, refresh()
will return 0.
False if the data has not been saved, 0 if it can't be refreshed, true on success.
+Return a Nymph Entity Reference for this entity.
+If the entity hasn't been saved yet (and has no GUID), it will be +returned instead.
+A Nymph Entity Reference array as an unsaved entity.
+Static
Optional
alterStatic
factoryCreate or retrieve a new entity instance.
+Note that this will always return an entity, even if the GUID is not found.
+Static
factoryStatic
factoryCreate a new sleeping reference instance.
+Sleeping references won't retrieve their data from the database until they
+are readied with $wake()
or a parent's $wakeAll()
.
The Nymph Entity Reference to use to wake.
+The new instance.
+Static
factoryCreate a new entity instance.
+Private
Static
getStatic
getStatic
getStatic
getGet an array of strings that must be unique across the current etype.
+When you try to save another entity with any of the same unique strings, +Nymph will throw an error.
+The default implementation of this static method instantiates the entity,
+assigns all of the given data, then calls $getUniques
and returns its
+output. This can have a performance impact if a lot of extra processing
+happens during any of these steps. You can override this method to
+calculate the unique strings faster, but you must return the same strings
+that would be returned by $getUniques
.
Optional
cdate?: numberOptional
guid?: stringOptional
mdate?: numberOptional
sdata?: SerializedEntityDataResolves to an array of entity's unique constraint strings.
+A user and group system for Nymph.js.
+Written by Hunter Perrin for SciActive.
+The group class for this instance of Tilmeld.
+The user class for this instance of Tilmeld.
+Private
alreadyUsed to avoid infinite loop.
+The Tilmeld config.
+The currently logged in user.
+Private
gatekeeperGatekeeper ability cache.
+Gatekeeper will cache the user's abilities that it calculates, so it can +check faster if that user has been checked before.
+The Nymph instance.
+If you will be performing authentication functions (logging in/out), you +should set these so Tilmeld can read and write cookies and headers.
+If you want the user to be authenticated with the cookie and/or header they +provide, you should set at least the request. It's better to set both, so +the JWT can be updated if needed.
+After you set these, call authenticate()
to read user authentication data
+from them and fill the user's session.
If you want to support cookie based authentication (which still requires an +XSRF token for security), you should enable the cookie parser middleware.
+Add selectors to a list of options and selectors which will limit results +to only entities the current user has access to.
+Check for TILMELDAUTH and TILMELDSWITCH tokens, and, if set, authenticate +from it/them.
+You can also call this function after setting response.locals.user
to the
+user you want to authenticate. You should check for user.enabled
before
+setting this variable, unless you explicitly want to log in as a disabled
+user. (The user must be an instance of the User class for this Tilmeld
+instance.)
This function will set response.locals.user
to the logged in user on
+successful authentication.
Skip the XSRF token check.
+Skip the token renewal step, even if the token is close to expiration.
+True if a user was authenticated, false on any failure.
+Check a UID's permissions for a user.
+UID functions on the Node.js side are not checked automatically. This +function is only run automatically for UID functions run from the client. +You should call this function manually if you're running a UID function on +the Node.js side and you want it gated.
+This will check the Tilmeld config and the user's abilities.
+The UID to check.
+The lowest level of permission to consider a pass.
+Optional
user: false | User & UserDataThe user to check permissions for. If null, uses the current user. If false, checks for public access.
+Whether the current user has at least type
permission for the UID.
Check an entity's permissions for a user.
+This will check the AC (Access Control) properties of the entity. These +include the following properties:
+"acUser" refers to the entity's owner, "acGroup" refers to all users in the +entity's group and all ancestor groups, and "acOther" refers to any user +who doesn't fit these descriptions.
+Each of these properties should be either NO_ACCESS, READ_ACCESS, +WRITE_ACCESS, or FULL_ACCESS.
+These properties default to:
+"acRead", "acWrite", and "acFull" are arrays of users and/or groups that +also have those permissions.
+Only users with FULL_ACCESS have the ability to change any of the ac*, +user, and group properties.
+The following conditions will result in different checks, which determine +whether the check passes:
+The entity to check.
+The lowest level of permission to consider a pass.
+Optional
user: false | User & UserDataThe user to check permissions for. If null, uses the current user. If false, checks for public access.
+Optional
acProperties: ACPropertiesThe acProperties to use instead of getting them from the entity.
+Whether the current user has at least type
permission for the entity.
Initialize Tilmeld.
+This is meant to be called internally by Nymph. Don't call this directly.
+The Nymph instance.
+Private
initA user data model.
+Written by Hunter Perrin for SciActive.
+Protected
Optional
$allowlistIf this is defined, then it lists the only properties that will be +accepted from incoming JSON. Any other properties will be ignored.
+If you use an allowlist, you don't need to use protectedData, since you +can simply leave those entries out of allowlistData.
+Protected
Optional
$allowlistIf this is defined, then it lists the only tags that will be accepted from +incoming JSON. Any other tags will be ignored.
+Protected
$clientThe names of methods allowed to be called by the frontend with serverCall.
+Protected
$dataThe data proxy object.
+Protected
$dataThe data proxy handler.
+Protected
$dataThe actual data store.
+Private
Optional
$descendantThe user's group descendants.
+Private
Optional
$gatekeeperGatekeeper ability cache.
+Gatekeeper will cache the user's abilities that it calculates, so it can +check faster if that user has been checked before.
+Protected
$isASleepingWhether this instance is a sleeping reference.
+The instance of Nymph to use for queries.
+Optional
$originalUsed to save the current email address to send verification if it changes +from the frontend.
+If you are changing a user's email address and want to bypass email +verification, don't set this.
+Protected
$privateProperties that will not be serialized into JSON with toJSON(). This +can be considered a denylist, because these properties will not be set +with incoming JSON.
+Clients CAN still determine what is in these properties, unless they are +also listed in searchRestrictedData.
+Protected
$protectedProperties that can only be modified by server side code. They will still +be visible on the frontend, unlike $privateData, but any changes to them +that come from the frontend will be ignored.
+In addition to what's listed here, all of the access control properties +will be included when Tilmeld is being used. These are:
+You should modify these through client enabled methods or the $save method +instead, for safety.
+Protected
$protectedTags that can only be added/removed by server side code. They will still be +visible on the frontend, but any changes to them that come from the +frontend will be ignored.
+Protected
$sdataThe actual sdata store.
+Private
$skipThis should only be used by the backend.
+Private
$skipThis should only be used by the backend.
+Protected
$sleepingThe reference to use to wake.
+Protected
$wakeA promise that resolved when the entity's data is wake.
+The creation date of the entity as a Unix timestamp in milliseconds.
+The entity's Globally Unique ID.
+This is a 12 byte number represented as a lower case HEX string (24 +characters).
+The modified date of the entity as a Unix timestamp in milliseconds.
+Array of the entity's tags.
+Private
Static
DEFAULT_Private
Static
DEFAULT_Private
Static
DEFAULT_Static
ETYPEThe instance of Tilmeld to use for queries.
+Private
Static
afterPrivate
Static
afterPrivate
Static
afterPrivate
Static
beforePrivate
Static
beforePrivate
Static
beforePrivate
Static
checkStatic
classThe lookup name for this entity.
+This is used for reference arrays (and sleeping references) and client +requests.
+Static
clientThe names of static methods allowed to be called by the frontend with +serverCallStatic.
+Static
nymphThe instance of Nymph to use for queries.
+Static
pubWhether this entity should publish changes to PubSub servers.
+Static
restWhether this entity should be accessible on the frontend through the REST +server.
+If this is false, any request from the client that attempts to use this +entity will fail.
+Static
searchProperties that will not be searchable from the frontend. If the frontend +includes any of these properties in any of their clauses, they will be +filtered out before the search is executed.
+Search the array for this object and return the corresponding index.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+The index if the object is in the array, -1 if it isn't.
+A frontend accessible method to change the user's password.
+The input data from the client.
+Optional
revokeAn object with a boolean 'result' entry and a 'message' entry.
+Protected
$checkCheck to see if a user has an ability.
+This function will check both user and group abilities, if the user is +marked to inherit the abilities of its group.
+If ability
is undefined, it will check to see if the user is currently
+logged in.
If the user has the "system/admin" ability, this function will return true.
+Optional
ability: stringThe ability.
+True or false.
+Get the current values of the AC properties.
+An object of AC properties.
+Get the original values of the AC properties.
+An object of AC properties.
+Used to retrieve the serialized data object.
+This should only be used by Nymph to save the data object into storage.
+This method is used by Nymph to avoid unserializing data that hasn't been +requested yet.
+It should always be called after getData().
+The entity's serialized data object.
+Get an array of strings that must be unique across the current etype.
+When you try to save another entity with any of the same unique strings, +Nymph will throw an error.
+The default implementation of this method returns an empty array, meaning +there are no uniqueness constraints applied to its etype.
+Resolves to an array of entity's unique constraint strings.
+Check whether this object is in an array.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+True if the object is in the array, false if it isn't.
+Accept JSON data from the client.
+This function uses the security protection lists:
+The input data. Please note, this will be modified (destroyed).
+Allow to accept data that is older than the current data.
+Accept JSON patch from the client.
+This function uses the security protection lists:
+The patch data. Please note, this will be modified (destroyed).
+Allow to accept data that is older than the current data.
+Optional
additionalOptional
code?: stringUsed to set the data.
+This should only be used by Nymph to push the data from storage.
+sdata
is used by Nymph to avoid unserializing data that hasn't been
+requested yet.
The data object.
+Optional
sdata: SerializedEntityDataThe serialized data object.
+Protected
$referenceSet up a sleeping reference.
+Refresh the object from storage. (Bypasses Nymph's cache.)
+If the object has been deleted from storage, the database cannot be
+reached, or a database error occurs, refresh()
will return 0.
False if the data has not been saved, 0 if it can't be refreshed, true on success.
+Optional
additionalA frontend accessible method to remove the TOTP secret from the user's +account.
+Optional
data: { The input data from the client.
+An object with a boolean 'result' entry and a 'message' entry.
+A frontend accessible method to revoke all currently issued tokens.
+The input data from the client.
+An object with a boolean 'result' entry and a 'message' entry.
+A frontend accessible method to save a TOTP secret into the user's account.
+The input data from the client.
+An object with a boolean 'result' entry and a 'message' entry.
+Return a Nymph Entity Reference for this entity.
+If the entity hasn't been saved yet (and has no GUID), it will be +returned instead.
+A Nymph Entity Reference array as an unsaved entity.
+Static
Optional
alterStatic
currentStatic
factoryCreate or retrieve a new entity instance.
+Note that this will always return an entity, even if the GUID is not found.
+Static
factoryCreate a new sleeping reference instance.
+Sleeping references won't retrieve their data from the database until they
+are readied with $wake()
or a parent's $wakeAll()
.
The Nymph Entity Reference to use to wake.
+The new instance.
+Static
factoryCreate a new entity instance.
+Static
factoryStatic
getStatic
getGet an array of strings that must be unique across the current etype.
+When you try to save another entity with any of the same unique strings, +Nymph will throw an error.
+The default implementation of this static method instantiates the entity,
+assigns all of the given data, then calls $getUniques
and returns its
+output. This can have a performance impact if a lot of extra processing
+happens during any of these steps. You can override this method to
+calculate the unique strings faster, but you must return the same strings
+that would be returned by $getUniques
.
Optional
cdate?: numberOptional
guid?: stringOptional
mdate?: numberOptional
sdata?: SerializedEntityDataResolves to an array of entity's unique constraint strings.
+Static
loginOptional
additionalOptional
code?: stringStatic
offStatic
onStatic
recoverRecover account details.
+The input data from the client.
+An object with a boolean 'result' entry and a 'message' entry.
+Static
sendSend an account recovery link.
+The input data from the client.
+An object with a boolean 'result' entry and a 'message' entry.
+Entity interface.
+Protected
$dataThe data proxy object.
+Protected
$dataThe data proxy handler.
+Protected
$dataThe actual data store.
+Protected
$dirtyA map of props to whether they're dirty (for patch).
+Protected
$isASleepingWhether this instance is a sleeping reference.
+The instance of Nymph to use for queries.
+Protected
$originalArray of the entity's original tags (for patch).
+Protected
$sleepingThe reference to use to wake.
+Protected
$wakeA promise that resolved when the entity's data is wake.
+The creation date of the entity as a high precision Unix timestamp.
+The entity's Globally Unique ID.
+The modified date of the entity as a high precision Unix timestamp.
+Array of the entity's tags.
+Static
classThe lookup name for this entity.
+This is used for reference arrays (and sleeping references) and server +requests.
+Static
nymphThe instance of Nymph to use for queries.
+Search the array for this object and return the corresponding index.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+The index if the object is in the array, -1 if it isn't.
+Protected
$checkGet a patch of this entity's dirty data to be applied on the server.
+Check whether this object is in an array.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+True if the object is in the array, false if it isn't.
+Initialize this entity from a JSON representation.
+The entity JSON.
+Protected
$referenceRefresh the object from storage. (Bypasses Nymph's cache.)
+If the object has been deleted from storage, the database cannot be
+reached, or a database error occurs, refresh()
will return 0.
False if the data has not been saved, 0 if it can't be refreshed, true on success.
+Call an instance method on the server version of this entity.
+The entity's data will be sent up to the server as well, so the server's +state can match the client's state. It won't be propagated into the DB, +though.
+The name of the method.
+The parameters to call the method with.
+Optional
stateless: booleanWhether the server should return, and the client update, the data in the entity after the method has run.
+The value that the method on the server returned.
+Return a Nymph Entity Reference for this entity.
+If the entity hasn't been saved yet (and has no GUID), it will be +returned instead.
+A Nymph Entity Reference array as an unsaved entity.
+Ready this entity's data, and the data of entity's within this one's.
+Optional
level: numberThe number of levels deep to wake. If undefined, it will keep going until there are no more entities. (Careful of infinite loops.)
+The entity.
+Static
factoryCreate or retrieve a new entity instance.
+Note that this will always return an entity, even if the GUID is not found.
+Static
factoryStatic
factoryCreate a new sleeping reference instance.
+Sleeping references won't retrieve their data from the server until they
+are readied with $wake()
or a parent's $wakeAll()
.
The Nymph Entity Reference to use to wake.
+The new instance.
+Static
factoryCreate a new entity instance.
+Static
getStatic
getStatic
serverStatic
serverCall a static iterator method on the server version of this entity.
+The name of the method.
+The parameters to call the method with.
+An iterator that iterates over values that the method on the server yields.
+Optional
message: stringOptional
stackStatic
Optional
prepareOptional override for formatting stack traces
+Static
stackStatic
captureEntity interface.
+Protected
$dataThe data proxy object.
+Protected
$dataThe data proxy handler.
+Protected
$dataThe actual data store.
+Protected
$dirtyA map of props to whether they're dirty (for patch).
+Protected
$isASleepingWhether this instance is a sleeping reference.
+The instance of Nymph to use for queries.
+Protected
$originalArray of the entity's original tags (for patch).
+Protected
$sleepingThe reference to use to wake.
+Protected
$wakeA promise that resolved when the entity's data is wake.
+The creation date of the entity as a high precision Unix timestamp.
+The entity's Globally Unique ID.
+The modified date of the entity as a high precision Unix timestamp.
+Array of the entity's tags.
+Static
classThe lookup name for this entity.
+This is used for reference arrays (and sleeping references) and server +requests.
+Static
nymphThe instance of Nymph to use for queries.
+Protected
Static
storesSearch the array for this object and return the corresponding index.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+The index if the object is in the array, -1 if it isn't.
+Protected
$checkGet a patch of this entity's dirty data to be applied on the server.
+Check whether this object is in an array.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+True if the object is in the array, false if it isn't.
+Initialize this entity from a JSON representation.
+The entity JSON.
+Protected
$referenceRefresh the object from storage. (Bypasses Nymph's cache.)
+If the object has been deleted from storage, the database cannot be
+reached, or a database error occurs, refresh()
will return 0.
False if the data has not been saved, 0 if it can't be refreshed, true on success.
+Optional
additionalCall an instance method on the server version of this entity.
+The entity's data will be sent up to the server as well, so the server's +state can match the client's state. It won't be propagated into the DB, +though.
+The name of the method.
+The parameters to call the method with.
+Optional
stateless: booleanWhether the server should return, and the client update, the data in the entity after the method has run.
+The value that the method on the server returned.
+Return a Nymph Entity Reference for this entity.
+If the entity hasn't been saved yet (and has no GUID), it will be +returned instead.
+A Nymph Entity Reference array as an unsaved entity.
+Ready this entity's data, and the data of entity's within this one's.
+Optional
level: numberThe number of levels deep to wake. If undefined, it will keep going until there are no more entities. (Careful of infinite loops.)
+The entity.
+Static
currentOptional
returnObjectIfNotExist: falseStatic
factoryCreate or retrieve a new entity instance.
+Note that this will always return an entity, even if the GUID is not found.
+Static
factoryCreate a new sleeping reference instance.
+Sleeping references won't retrieve their data from the server until they
+are readied with $wake()
or a parent's $wakeAll()
.
The Nymph Entity Reference to use to wake.
+The new instance.
+Static
factoryCreate a new entity instance.
+Static
factoryStatic
getPrivate
Static
handleStatic
initStatic
loginOptional
additionalOptional
code?: stringStatic
offStatic
onStatic
recoverStatic
sendStatic
serverStatic
serverCall a static iterator method on the server version of this entity.
+The name of the method.
+The parameters to call the method with.
+An iterator that iterates over values that the method on the server yields.
+Base class for Svelte components with some minor dev-enhancements. Used when dev=true.
+Can be used to create strongly typed Svelte components.
+You have component library on npm called component-library
, from which
+you export a component called MyComponent
. For Svelte+TypeScript users,
+you want to provide typings. Therefore you create a index.d.ts
:
import { SvelteComponent } from "svelte";
export class MyComponent extends SvelteComponent<{foo: string}> {}
+
+Typing this makes it possible for IDEs like VS Code with the Svelte extension +to provide intellisense and to use the component like this in a Svelte file +with TypeScript:
+<script lang="ts">
import { MyComponent } from "component-library";
</script>
<MyComponent foo={'bar'} />
+
+Generate secure unique ID with custom alphabet.
+Alphabet must contain 256 symbols or less. Otherwise, the generator +will not be secure.
+Alphabet used to generate the ID.
+Optional
defaultSize: numberSize of the ID. The default size is 21.
+A random string generator.
+const { customAlphabet } = require('nanoid')
const nanoid = customAlphabet('0123456789абвгдеё', 5)
nanoid() //=> "8ё56а"
+
+Optional
size: numberGenerate secure URL-friendly unique ID.
+By default, the ID will have 21 symbols to have a collision probability +similar to UUID v4.
+import { nanoid } from 'nanoid'
model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
+
+Optional
size: numberSize of the ID. The default size is 21.
+A random string.
+Optional
bareOptional
defaultOptional
qrefA REST server middleware creator for Nymph.
+Written by Hunter Perrin for SciActive.
+Optional
jsonOptional
clientConfig: ClientConfigOptional
code: stringOptional
additionalData: { Optional
clientConfig: ClientConfigOptional
allowPowerful object data storage and querying.
+All you need to start using Nymph is the @nymphjs/nymph
package and one of the drivers, @nymphjs/driver-mysql
, @nymphjs/driver-postgresql
, or @nymphjs/driver-sqlite3
. Check out the readme for the Nymph package.
You can also set up a REST server to use Nymph remotely, a PubSub server to receive updates for queries, and a user and group management system to provide registration and access control.
+Check out the user guide for information about how to use Nymph once you have it set up.
+The Nymph core provides the base level classes and utilities to query the database, save data to it, and define different data types.
+The MySQL driver lets you configure Nymph to query and save data to a MySQL database.
+The PostgreSQL driver lets you configure Nymph to query and save data to a Postgres database.
+The SQLite3 driver lets you configure Nymph to query and save data to a SQLite3 database. This includes an in memory SQLite3 database.
+The REST server lets you configure an endpoint for the Nymph client to query and push data to. The server provides this endpoint as an Express middleware, which can be used in a new or existing Express (or compatible) server.
+The PubSub server provides a WebSocket server that allows Nymph to publish changes and the Nymph Client to subscribe to those changes. You can subscribe to individual entities, entity queries, or UIDs.
+The Nymph Client allows you to query and push data to a Nymph REST server from the browser. You can also subscribe to entities and queries on a Nymph PubSub server and be notified of changes.
+The Nymph Node Client let's you do everything the Nymph Client does, but from Node.JS instead of the browser.
+Tilmeld (the d is silent) is a user and group management system for Nymph. It provides strict access controls to protect entities from unauthorized access/modification. It allows for granting and revoking ad hoc abilities to users and groups, then checking for those abilities. It provides authentication services and features protection against XSRF attacks.
+The Tilmeld Client lets you register, login, and perform user account related functions remotely on a Nymph server.
+The Tilmeld Components are front end registration/login, account recovery, account details, and password change components build with Svelte and SMUI.
+The Tilmeld Setup App allows administrators to create, modify, and delete users and groups and configure how Tilmeld works. It also acts as the endpoint for email address verification.
+The Nymph Entity Sorter lets you sort entities by their properties, including hierarchically.
+The Query Parser is a utility for creating complex Nymph entity queries from a simple text input. Essentially, it turns a string into a Nymph query.
+The GUID and unique code generators are used to generate new GUIDs for Nymph objects and various random unique strings.
+In version 1.0.0-beta.78, the database schema changed significantly, and data will need to be exported with an older version, then imported into a fresh database with this version. The meaning of the contain
clause also changed to only check if the given value exists in an array.
In version 1.0.0-beta.41, the server side API was rewritten to match the client side API. All synchronous database calls were removed. This is to prevent a very rare potential bug, because synchronous database calls were made outside of transactions. Here is a list of some things that changed that could break your code:
+$gatekeeper
is now asyncconstructor
or factorySync
checkClientUIDPermissions
is now asyncauthenticate
is now asyncfillSession
is now asynclogin
is now asyncloginSwitch
is now asynclogout
is now asynclogoutSwitch
is now async$addGroup
is now async$delGroup
is now async$inGroup
is now async$getLevel
is now async$ready
changed to $wake
$readyAll
changed to $wakeAll
You will also now need to call $wake
on sleeping references before you access their data or they will throw and error.
To develop Nymph.js, checkout the repo and run:
+npm i
npm run bootstrap
rm packages/*/package-lock.json
+
+Once you make changes in one package, you can either build that package directly or build all packages with bootstrap
, then the other packages will be aware of the changes.
When you're ready to run all the tests, in a separate shell, bring up the test DBs.
+npm run test:db:start
+
+Now in your main terminal, you can run the tests.
+npm run test
+
+Once you're all done, in your main terminal, you can bring down the test DBs (don't use Ctrl-C where the tests are running).
+npm run test:db:stop
+
+Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Data Object interface.
+Objects which hold data from some type of storage.
+The object's data.
+Search the array for this object and return the corresponding index.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+The index if the object is in the array, -1 if it isn't.
+Check whether this object is in an array.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+True if the object is in the array, false if it isn't.
+Refresh the object from storage. (Bypasses Nymph's cache.)
+If the object has been deleted from storage, the database cannot be
+reached, or a database error occurs, refresh()
will return 0.
False if the data has not been saved, 0 if it can't be refreshed, true on success.
+Entity interface.
+The instance of Nymph to use for queries.
+The creation date of the entity as a Unix timestamp in milliseconds.
+The entity's Globally Unique ID.
+This is a 12 byte number represented as a lower case HEX string (24 +characters).
+The modified date of the entity as a Unix timestamp in milliseconds.
+Array of the entity's tags.
+Search the array for this object and return the corresponding index.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+The index if the object is in the array, -1 if it isn't.
+Get a patch of this entity's dirty data to be applied on the server.
+Check whether this object is in an array.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+True if the object is in the array, false if it isn't.
+Initialize this entity from a JSON representation.
+The entity JSON.
+Refresh the object from storage. (Bypasses Nymph's cache.)
+If the object has been deleted from storage, the database cannot be
+reached, or a database error occurs, refresh()
will return 0.
False if the data has not been saved, 0 if it can't be refreshed, true on success.
+Call an instance method on the server version of this entity.
+The entity's data will be sent up to the server as well, so the server's +state can match the client's state. It won't be propagated into the DB, +though.
+The name of the method.
+The parameters to call the method with.
+Whether the server should return, and the client update, the data in the entity after the method has run.
+The value that the method on the server returned.
+Return a Nymph Entity Reference for this entity.
+If the entity hasn't been saved yet (and has no GUID), it will be +returned instead.
+A Nymph Entity Reference array as an unsaved entity.
+Retrieve this entity's data from the server.
+The entity.
+Ready this entity's data, and the data of entity's within this one's.
+Optional
level: numberThe number of levels deep to wake. If undefined, it will keep going until there are no more entities. (Careful of infinite loops.)
+The entity.
+MySQL Driver Config
+If you need to use custom options, like SSL, you can provide them here in +place of the above options.
+The MySQL database.
+The MySQL table engine.
+You should use MYISAM if you are using MySQL < 5.6.
+Options are: Any MySQL storage engine supported on your server.
+Whether to use foreign keys. If your table engine doesn't support +it (like MYISAM), you should turn this off.
+The host on which to connect to MySQL. Can include a port, like +hostname:port.
+The MySQL password.
+The port on which to connect to MySQL.
+The MySQL table name prefix.
+Whether to use row locking. If your table engine doesn't support +it (like MYISAM), you should turn this off.
+Whether to use table locking. If you use row locking, this should be off. +If you can't use row locking (like with MYISAM), you can use table +locking to ensure data consistency.
+Whether to use transactions. If your table engine doesn't support +it (like MYISAM), you should turn this off.
+The MySQL user.
+PostgreSQL Driver Config
+If you need to use custom options, like SSL, you can provide them here in +place of the above options.
+The Postgres database.
+The host on which to connect to Postgres. Can include a port, like +hostname:port.
+The Postgres password.
+The port on which to connect to Postgres.
+The Postgres table name prefix.
+The Postgres user.
+SQLite3 Driver Config
+Open explicitly for writing.
+By default, the driver will always open the DB as readonly, and attempt to +open another link to perform write operations. If you know that only one +instance will be writing, you can force the driver to open for writing by +default, which will block any other instance from opening it for writing.
+One thing to note is that starting a transaction is a write operation, so +as long as an instance is in a transaction, no other instances can write.
+PubSub also needs to open the DB, and it only needs read access.
+If the file does not exist, an Error will be thrown instead of creating a +new file.
+This option is ignored for in-memory, temporary, or readonly database +connections.
+The filename of the SQLite3 DB. Use ':memory:' for an in-memory DB.
+Additional pragma statements to run upon connection.
+The default pragmas:
+(Don't include the PRAGMA keyword, but do include the semicolon.)
+The SQLite3 table name prefix.
+The timeout to use for waiting for the DB to become available.
+Function that gets called with every SQL string executed.
+Optional
message: anyRest
...additionalArgs: any[]Turn on WAL mode.
+This will generally increase performance, but does mean that the DB must be +on a local disk.
+ +Nymph Config
+Cache recently retrieved entities to speed up database queries. Uses more +memory.
+The number of recently retrieved entities to cache. If you're running out +of memory, try lowering this value. 0 means unlimited.
+Cache entities after they're accessed this many times.
+A function to log error messages. By default, uses the debug
package.
A function to log info messages. By default, uses the debug
package.
A function to log debug messages. By default, uses the debug
package.
When querying for multiple entities with NymphREST, if the list is empty, +return a 404 error.
+Data Object interface.
+Objects which hold data from some type of storage.
+The object's data.
+Search the array for this object and return the corresponding index.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+The index if the object is in the array, -1 if it isn't.
+Check whether this object is in an array.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+True if the object is in the array, false if it isn't.
+Refresh the object from storage. (Bypasses Nymph's cache.)
+If the object has been deleted from storage, the database cannot be
+reached, or a database error occurs, refresh()
will return 0.
False if the data has not been saved, 0 if it can't be refreshed, true on success.
+Entity interface.
+The instance of Nymph to use for queries.
+The creation date of the entity as a Unix timestamp in milliseconds.
+The entity's Globally Unique ID.
+This is a 12 byte number represented as a lower case HEX string (24 +characters).
+The modified date of the entity as a Unix timestamp in milliseconds.
+Array of the entity's tags.
+Search the array for this object and return the corresponding index.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+The index if the object is in the array, -1 if it isn't.
+Get the current values of the AC properties.
+An object of AC properties.
+Used to retrieve the data object.
+This should only be used by Nymph to save the data into storage.
+Optional
includeSData: booleanWhether to include the serialized data as well.
+The entity's data object.
+Get the original values of the AC properties.
+An object of AC properties.
+Used to retrieve the serialized data object.
+This should only be used by Nymph to save the data object into storage.
+This method is used by Nymph to avoid unserializing data that hasn't been +requested yet.
+It should always be called after getData().
+The entity's serialized data object.
+Get an array of strings that must be unique across the current etype.
+When you try to save another entity with any of the same unique strings, +Nymph will throw an error.
+The default implementation of this method returns an empty array, meaning +there are no uniqueness constraints applied to its etype.
+Resolves to an array of entity's unique constraint strings.
+Check whether this object is in an array.
+If strict
is false, is()
is used to compare. If strict
is true,
+equals()
is used.
The array to search.
+Optional
strict: booleanWhether to use stronger comparison.
+True if the object is in the array, false if it isn't.
+Accept JSON data from the client.
+This function uses the security protection lists:
+The input data. Please note, this will be modified (destroyed).
+Optional
allowConflict: booleanAllow to accept data that is older than the current data.
+Accept JSON patch from the client.
+This function uses the security protection lists:
+The patch data. Please note, this will be modified (destroyed).
+Optional
allowConflict: booleanAllow to accept data that is older than the current data.
+Used to set the data.
+This should only be used by Nymph to push the data from storage.
+sdata
is used by Nymph to avoid unserializing data that hasn't been
+requested yet.
The data object.
+Optional
sdata: SerializedEntityDataThe serialized data object.
+Refresh the object from storage. (Bypasses Nymph's cache.)
+If the object has been deleted from storage, the database cannot be
+reached, or a database error occurs, refresh()
will return 0.
False if the data has not been saved, 0 if it can't be refreshed, true on success.
+Return a Nymph Entity Reference for this entity.
+If the entity hasn't been saved yet (and has no GUID), it will be +returned instead.
+A Nymph Entity Reference array as an unsaved entity.
+Optional
type: TilmeldAccessLevelsNymph PubSub Config
+Allow clients to request to be notified when other clients subscribe to the +same queries.
+The URLs of the Nymph-PubSub servers to directly publish to. These servers +are how this host will enter the PubSub network. If you only have one +PubSub server, it needs to be listed here.
+Function to log PubSub info/error messages.
+Rest
...args: any[]Determine whether a client's origin is allowed to connect.
+The URLs of additional Nymph-PubSub servers to relay publishes to. If this +host is a PubSub server, these servers are how it will continue into your +PubSub network.
+Tilmeld Config
+Allow users to register.
+Allow users to change their username.
+The name of the app. Used in emails sent to users and as the TOTP issuer.
+The URL of the app. Used to define cookie domain, path, and security. Must +be accessible to the Tilmeld client JS. (Note, cookies are not specific to +individual ports, so tokens will be sent to any port running on this host.)
+After the user cancels an address change, redirect them to this URL.
+A list of UIDs that can be created from the client by anyone. (newUID)
+Inclusion in this list implies inclusion in clientReadableUIDs.
+Note: If you'd like to limit the access to logged in users, give them an + ability like "uid/new/nameofuid".
+A list of UIDs that can be read from the client by anyone. (getUID)
+Note: If you'd like to limit the access to logged in users, give them an + ability like "uid/get/nameofuid".
+A list of UIDs that can be set from the client by anyone. (setUID, +renameUID)
+Inclusion in this list implies inclusion in clientReadableUIDs and +clientEnabledUIDs.
+Note: There is no way to run renameUID from the client.
+Note: If you'd like to limit the access to logged in users, give them an + ability like "uid/set/nameofuid".
+Configure an email object to prepare for sending.
+You can use this, for example, for DKIM signing.
+See: https://github.com/forwardemail/email-templates/blob/v8.0.9/README.md#Options
+The domain of the auth cookie.
+The path of the auth cookie.
+Allow the creation of an admin user. When a user is created, if there are +no other users in the system, they will be granted all abilities.
+Don't let users change their email address more often than this. You can +enter one value and one unit of time, such as "2 weeks". Leave blank to +disable rate limiting.
+This also controls how long a user has to cancel an email address change +from a link emailed to the old address.
+The absolute path to the email template directory. Used by the default +email sender.
+Instead of a "username", a user logs in and is referred to by their email +address. Enabling this after many users have been created can be messy. +Make sure they all have email addresses first.
+Whether frontend can search groups. (Probably not a good idea if privacy is +a concern. Same risks as user search if generatePrimary is true.)
+Whether frontend can search users. (Probably not a good idea if privacy is +a concern.)
+Whether to create a new primary group for every user who registers. This +can be useful for providing access to entities the user creates.
+In the case this is set, the default primary group, rather than being +assigned to the user, is assigned as the parent of the generated group.
+The GUID of the group above the highest groups allowed to be assigned as +primary groups. True means all groups, and false means no groups.
+The GUID of the group above the highest groups allowed to be assigned as +secondary groups. True means all groups, and false means no groups.
+Function to build the JWT for user sessions.
+How long from current time, in seconds, the JWT token expires.
+Function to verify that a JWT was signed with the secret key, validate its +data, validate the XSRF token, and extract the GUID and dates.
+If no XSRF token is supplied, ignore it.
+Return false if the JWT is not valid, or an object with GUID, issued date, +and expire date otherwise.
+Optional
xsrfToken: stringHow long, in seconds, before the JWT token expires to give the user a new +one.
+The secret used to sign the JWT.
+How long from current time, in seconds, the JWT token for a user switch +expires.
+The maximum length for usernames. Infinity
for unlimited.
The minimum length for usernames.
+Method used to store passwords. Salt is more secure if the database is +compromised. Plain: store the password in plaintext. Digest: store the +password's digest (hash). Salt: store the password's digest using a +complex, unique salt.
+Digests are SHA-256, so a salt probably isn't necessary, but who knows.
+Options are: "plain", "digest", "salt"
+Allow users to recover their username and/or password through their +registered email.
+How long a recovery request is valid.
+These fields will be available for the user to fill in when they register.
+Send an email to a user. Uses email-templates
by default.
Check out the emails
directory to see the templates used.
In addition to the specific locals
for each template, there are
+additional locals added by the default email sender:
The path (with leading slash and no trailing slash) where the setup utility +is accessible. This is also used for email address verification.
+This portion of the app will not check for the XSRF token, so make sure +your REST endpoint is not under this URL.
+Unverified users will be able to log in, but will only have the "unverified +users" secondary group(s) until they verify their email. If set to false, +their account will instead be disabled until they verify.
+These will be the available fields for users. (Some fields, like username, +can't be excluded.)
+The address you'd like to receive a notification of registered users, if +any.
+Only these characters can be used when creating usernames and groupnames. +(Doesn't apply to emails as usernames.)
+When a user enters an invalid name, this message will be displayed.
+Email addresses must match this regular expression. By default, this uses +the regex from the W3C HTML email element validation:
+https://html.spec.whatwg.org/multipage/input.html#email-state-(type=email)
+When a user enters an email that doesn't match the regex, this message will +be displayed.
+Usernames and groupnames must match this regular expression. (Doesn't apply +to emails as usernames.) By default, this ensures that the name begins and +ends with an alphanumeric. (To allow anything, use .* inside the slashes.)
+When a user enters a name that doesn't match the regex, this message will +be displayed.
+The validator used to check groups before saving.
+The validator used to check users before saving.
+After the user verifies an address change, redirect them to this URL.
+Verify users' email addresses upon registration/email change before +allowing them to log in/change it.
+After the user verifies their address, redirect them to this URL.
+Powerful object data storage and querying.
+The Nymph Client allows you to query and push data to a Nymph REST server from the browser. You can also subscribe to entities and queries on a Nymph PubSub server and be notified of changes.
+npm install --save @nymphjs/client
+
+This package is the Nymph client for browsers. You can find UMD in dist
, or TS source in src
. There is also a Node.js client.
Here's an overview:
+import { Nymph, PubSub } from '@nymphjs/client';
import TodoClass from 'Todo';
const nymphOptions = {
restUrl: 'https://yournymphrestserver/path/to/your/endpoint',
pubsubUrl: 'wss://yournymphpubsubserver',
};
const nymph = new Nymph(nymphOptions);
const pubsub = new PubSub(nymphOptions, nymph);
const Todo = nymph.addEntityClass(TodoClass);
// Now you can use Nymph and PubSub.
const myTodo = new Todo();
myTodo.name = 'This is a new todo!';
myTodo.done = false;
await myTodo.$save();
let allMyTodos = await nymph.getEntities({ class: Todo });
let subscription = pubsub.subscribeWith(myTodo, () => {
// When this is called, the entity will already contain new data from the
// publish event. If the entity is deleted, the GUID will be set to null.
if (myTodo.guid != null) {
alert('Somebody touched my todo!');
} else {
alert('Somebody deleted my todo!');
subscription.unsubscribe();
}
});
// ...
// Subscribing to a query.
let todos = [];
let userCount = 0;
let subscription = pubsub.subscribeEntities(
{
class: Todo.class,
},
{
type: '&',
'!tag': 'archived',
},
)(
(update) => {
// The first time this is called, `update` will be an array of Todo
// entities. After that, `update` will be a publish event object.
// This takes an existing array of entities and either updates it to match
// another array, or performs actions from a publish event object to update
// it.
pubsub.updateArray(todos, update);
// `todos` is now up to date with the latest publishes from the server.
},
(err) => alert(err),
(count) => {
// If you provide this callback, the server will send updates of how many
// clients are subscribed to this query.
userCount = count;
},
);
// ...
// Remember to clean up your subscriptions when you no longer need them.
subscription.unsubscribe();
+
+Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Powerful object data storage and querying.
+The Nymph Node Client lets you do everything the Nymph Client does, but from Node.JS instead of the browser.
+npm install --save @nymphjs/client-node
+
+This package is the Nymph client for Node.js. You can find CJS in dist
, or TS source in src
. There is also a browser client.
This package provides fetch and WebSocket ponyfills to Nymph and handles Tilmeld auth tokens.
+To use, require it instead of @nymphjs/client
:
const { Nymph, PubSub } = require('@nymphjs/client-node');
+
+Then set up Nymph and PubSub like normal:
+const nymphOptions = {
restUrl: 'https://yournymphrestserver/path/to/your/endpoint',
pubsubUrl: 'wss://yournymphpubsubserver',
};
const nymph = new Nymph(nymphOptions);
const pubsub = new PubSub(nymphOptions, nymph);
+
+Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Powerful object data storage and querying.
+The MySQL driver lets you configure Nymph to query and save data to a MySQL database.
+npm install --save @nymphjs/driver-mysql
+
+Supply an instance of this driver with its configuration to Nymph's constructor.
+import { Nymph } from '@nymphjs/nymph';
import MySQLDriver from '@nymphjs/driver-mysql';
const mysqlConfig = {
host: 'your_db_host',
database: 'your_database',
user: 'your_user',
password: 'your_password',
};
const nymph = new Nymph({}, new MySQLDriver(mysqlConfig));
// All done. Nymph is ready to use.
+
+See the config declaration file.
+Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Powerful object data storage and querying.
+The PostgreSQL driver lets you configure Nymph to query and save data to a Postgres database.
+npm install --save @nymphjs/driver-postgresql
+
+Supply an instance of this driver with its configuration to Nymph's constructor.
+import { Nymph } from '@nymphjs/nymph';
import PostgreSQLDriver from '@nymphjs/driver-postgresql';
const postgresqlConfig = {
host: 'your_db_host',
database: 'your_database',
user: 'your_user',
password: 'your_password',
};
const nymph = new Nymph({}, new PostgreSQLDriver(postgresqlConfig));
// All done. Nymph is ready to use.
+
+See the config declaration file.
+Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Powerful object data storage and querying.
+The SQLite3 driver lets you configure Nymph to query and save data to a SQLite3 database. This includes an in memory SQLite3 database.
+npm install --save @nymphjs/driver-sqlite3
+
+Supply an instance of this driver with its configuration to Nymph's constructor.
+import { Nymph } from '@nymphjs/nymph';
import SQLite3Driver from '@nymphjs/driver-sqlite3';
const sqliteConfig = {
filename: __dirname + '/mydatabase.db',
};
const nymph = new Nymph({}, new SQLite3Driver(sqliteConfig));
// All done. Nymph is ready to use.
+
+See the config declaration file.
+Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Powerful object data storage and querying.
+The GUID and unique code generators are used to generate new GUIDs for Nymph objects and various random unique strings.
+npm install --save @nymphjs/guid
+
+There are a few functions for generating different kinds of strings.
+import {
guid,
makeTableSuffix,
humanSecret,
nanoid,
customAlphabet,
} from '@nymphjs/guid';
// This generates a GUID. It will be 24 characters long, and the first four
// characters will be the same during a whole week. (This helps make DB index
// paging more efficient.)
const myGuid = guid();
// This can be used as a table suffix in SQL queries. It will be 20 characters
// long and alphanumeric.
const myTableSuffix = makeTableSuffix();
// This will be a human readable secret code. It will be 10 characters long and
// use the nolookalikesSafe dictionary from nanoid-dictionary.
const mySecretCode = humanSecret();
// This is the nanoid library's main export. It is exported in commonjs format.
const id = nanoid();
// This is the nanoid library's customAlphabet export.
const customId = customAlphabet('abc', 20)();
+
+Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Powerful object data storage and querying.
+The Nymph core provides the base level classes and utilities to query the database, save data to it, and define different data types.
+npm install --save @nymphjs/nymph
+
+To use Nymph, you need a database driver. Nymph.js provides a MySQL driver, a PostgreSQL driver, and a SQLite3 driver. They all provide the exact same functionality.
+Here's an overview:
+// main.ts
import { Nymph } from '@nymphjs/nymph';
import MySQLDriver from '@nymphjs/driver-mysql';
import TodoClass from './Todo';
const mysqlConfig = {
host: 'your_db_host',
database: 'your_database',
user: 'your_user',
password: 'your_password',
};
// Create a new instance of Nymph.
const nymph = new Nymph({}, new MySQLDriver(mysqlConfig));
// addEntityClass returns the class you should use for this instance of Nymph.
const Todo = nymph.addEntityClass(TodoClass);
// You are set up. Now you can use entity classes like `Todo` to store data,
// and Nymph's query methods like `getEntities` to retrieve them.
async function run() {
const myEntity = await Todo.factory();
myEntity.text = 'Get it done!';
await myEntity.$save();
const otherPendingTodos = await nymph.getEntities(
{ class: Todo },
{ type: '&', '!guid': myEntity.guid, equal: ['done', false] },
);
const total = otherPendingTodos.length;
const single = total === 1;
console.log(
`Besides the one I just created, there ${
single ? 'is' : 'are'
} ${total} pending todo${single ? '' : 's'} in the database.`,
);
}
+
+// Todo.ts
import { Entity } from '@nymphjs/nymph';
export type TodoData = {
text: string;
done: boolean;
};
export default class Todo extends Entity<TodoData> {
static ETYPE = 'todo'; // This is used for the table name(s) in the DB.
static class = 'Todo'; // This is used to map references to their class.
constructor() {
super();
// Within the methods of an entity, you will use `this.$data` to access
// its data. Outside, you don't need the $data part.
this.$data.text = '';
this.$data.done = false;
}
async $getOtherTodos() {
// this.$nymph (or this.nymph in a static function) is the instance of Nymph
// this entity was loaded with. Creating transactions will create a new
// instance of Nymph, so it could be a transactional instance.
const otherTodos = await this.$nymph.getEntities(
{ class: Todo },
{ type: '!&', guid: this.guid },
);
return otherTodos;
}
}
+
+See the config declaration file.
+Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Powerful object data storage and querying.
+The PubSub server provides a WebSocket server that allows Nymph to publish changes and the Nymph Client to subscribe to those changes. You can subscribe to individual entities, entity queries, or UIDs.
+npm install --save @nymphjs/pubsub
+
+Any Nymph instance will only publish changes if you initialize PubSub publisher before Nymph is used! This step is absolutely required to have a working PubSub system.
+import SQLite3Driver from '@nymphjs/driver-sqlite3';
import { Nymph } from '@nymphjs/nymph';
import { PubSub } from '@nymphjs/pubsub';
const pubSubConfig = {
entries: ['ws://yourpubsubserver.tld:8080/'], // This should be set to your PubSub server URL(s).
};
const nymph = new Nymph(
{},
new SQLite3Driver({
filename: ':memory:', // Put the correct driver/config here.
}),
);
PubSub.initPublisher(pubSubConfig, nymph);
+
+Now, on your PubSub server, you can use the createServer function to create a new PubSub server using HTTP (without TLS). If you want, this can be done on the same server you use as a REST server, with a different port.
+import SQLite3Driver from '@nymphjs/driver-sqlite3';
import { Nymph } from '@nymphjs/nymph';
import createServer, { PubSub } from '@nymphjs/pubsub';
const pubSubConfig = {
originIsAllowed: (origin) => {
// Your logic to determine allowed origins goes here.
return true;
},
entries: ['ws://yourpubsubserver.tld:8080/'],
};
const nymph = new Nymph(
{},
new SQLite3Driver({
filename: ':memory:', // Put the correct driver/config here.
}),
);
// Don't forget to do this; even here!
PubSub.initPublisher(pubSubConfig, nymph);
const pubsub = createServer(8080, pubSubConfig, nymph);
+
+If you need to provide custom handling in your server (like TLS), you can use the PubSub class directly and provide it a WebSocket server instance.
+import http from 'http';
import { server as WebSocketServer } from 'websocket';
import SQLite3Driver from '@nymphjs/driver-sqlite3';
import { Nymph } from '@nymphjs/nymph';
import { PubSub } from '@nymphjs/pubsub';
const pubSubConfig = {
originIsAllowed: (origin) => {
// Your logic to determine allowed origins goes here.
return true;
},
entries: ['ws://yourpubsubserver.tld:8080/'],
};
// Set up Nymph.
const nymph = new Nymph(
{},
new SQLite3Driver({
filename: ':memory:', // Put the correct driver/config here.
}),
);
// Don't forget to do this; even here!
PubSub.initPublisher(pubSubConfig, nymph);
// Set up the PubSub server.
const port = 8080;
const server = http.createServer((_request, response) => {
response.writeHead(404);
response.end();
});
const listener = server.listen(port, () => {
console.log(
new Date().toISOString(),
`Nymph-PubSub server started listening on port ${port}.`,
);
});
const wsServer = new WebSocketServer({
httpServer: listener,
// You should not use autoAcceptConnections for production
// applications, as it defeats all standard cross-origin protection
// facilities built into the protocol and the browser. You should
// *always* verify the connection's origin and decide whether or not
// to accept it.
autoAcceptConnections: false,
});
const pubsub = new PubSub(pubSubConfig, nymph, wsServer);
+
+See the config declaration file.
+Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Powerful object data storage and querying.
+The Query Parser is a utility for creating complex Nymph entity queries from a simple text input. Essentially, it turns a string into a Nymph query.
+npm install --save @nymphjs/query-parser
+
+The query parser will turn a string into an Options and Selectors array for the Nymph Client. It has a syntax that allows for most features of a Nymph query to be expressed in a text input.
+import queryParser from '@nymphjs/query-parser';
import BlogPost from './BlogPost';
import Category from './Category';
async function doQuery() {
const [options, ...selectors] = queryParser({
query:
'limit:4 sort:mdate foobar (| [archived] mdate<"2 weeks ago") category<{cat Tech}>',
entityClass: BlogPost,
defaultFields: ['title', 'body'],
qrefMap: {
cat: {
class: Category,
defaultFields: ['name'],
},
},
});
/*
Options will be
{
class: BlogPost,
limit: 4,
sort: 'mdate'
}
And selectors will be (equivalent to)
[
{
type: "|",
truthy: [
"archived"
],
lt: [
["mdate", null, "2 weeks ago"]
]
},
{
type: "&",
qref: [
"category",
[
{
class: Category
},
{
type: "|",
ilike: ["name", "%Tech%"]
}
]
]
},
{
type: "|",
ilike: [
["title", "%foobar%"],
["body", "%foobar%"]
]
}
]
*/
const entities = await nymph.getEntities(options, ...selectors);
}
+
+You can set limit, offset, sort, and reverse like this.
+limit:number
offset:number
sort:string
reverse:true
, reverse:false
, reverse:1
, or reverse:0
These must appear in the top level of the query (outside of any parentheses).
+These are the available clauses, and their syntax.
+Check for string or JSON representation equality.
+name=string
or name!=string
name="string value"
or name!="string value"
name=JSON
or name!=JSON
true
, 1
, [1,2,3]
, or {"prop":"val"}
).)Check for entity GUID.
+{guid}
or {!guid}
Check for a tag.
+<name>
or <!name>
Check for truthiness.
+[name]
or [!name]
Check for a reference to another entity.
+name<{guid}>
or name!<{guid}>
Check for a reference to another entity using a query.
+name<{refclassname inner query}>
or name!<{refclassname inner query}>
Check if the array at the named property contains a value.
+name<value>
or name!<value>
name<JSON>
or name!<JSON>
true
, 1
, [1,2,3]
, or {"prop":"val"}
).)Check for POSIX regex match.
+name~/pattern/
or name!~/pattern/
Check for case insensitive POSIX regex match.
+name~/pattern/i
or name!~/pattern/i
Check for pattern match where _ is single char wildcard and % is any length wildcard.
+name~pattern
or name!~pattern
name~"pattern"
or name!~"pattern"
Check for case insensitive pattern match where _ is single char wildcard and % is any length wildcard.
+name~"pattern"i
or name!~"pattern"i
Check a prop's value is greater than a given value.
+name>number
name>relative
now
or yesterday
.)name>"relative time value"
"two days from now"
, "last thursday"
, "+4 weeks"
, or "5 minutes ago"
.)Check a prop's value is greater than or equal to a given value.
+name>=number
name>=relative
now
or yesterday
.)name>="relative time value"
"two days from now"
, "last thursday"
, "+4 weeks"
, or "5 minutes ago"
.)Check a prop's value is less than a given value.
+name<number
name<relative
now
or yesterday
.)name<"relative time value"
"two days from now"
, "last thursday"
, "+4 weeks"
, or "5 minutes ago"
.)Check a prop's value is less than or equal to a given value.
+name<=number
name<=relative
now
or yesterday
.)name<="relative time value"
"two days from now"
, "last thursday"
, "+4 weeks"
, or "5 minutes ago"
.)You can specify nested selectors with different types using pairs of parentheses. The first character (or two) inside the parentheses can be a type: "&", "!&", "|", "!|", or "!" (the same as "!&").
+Here are some examples of nested selectors.
+Either enabled is truthy and abilities contains "subscriber", or abilities contains "lifelong-subscriber".
(| ([enabled] abilities<"subscriber">) abilities<"lifeline-subscriber">)
Published is not truthy and cdate is not greater than 6 months ago.
(! [published] cdate>"6 months ago")
+
+Anything contained in the query (including in selector parentheses) that doesn't match any of the options or clause syntaxes listed above (bare query parts) will be added (at the appropriate nesting level) to a selector with an "|"
type in an ilike
clause surrounded by "%" characters for each field passed in to the defaultFields
argument.
You can also supply a function in the option bareHandler
that will handle bare query parts instead of the "Default Fields" behavior described above. It will receive three arguments, the query parts, the entity class, and the default fields entry for that class. It should return a partial selector that will replace or extend the "|"
selector.
Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Powerful object data storage and querying.
+The REST server lets you configure an endpoint for the Nymph client to query and push data to. The server provides this endpoint as an Express middleware, which can be used in a new or existing Express (or compatible) server.
+npm install --save @nymphjs/server
+
+You need to install Express, Nymph, and a Nymph driver, then you can use the REST server with an optional path. For this example, I'll use the SQLite3 driver with an in-memory database.
+import express from 'express';
import { Nymph } from '@nymphjs/nymph';
import SQLite3Driver from '@nymphjs/driver-sqlite3';
import createServer from '@nymphjs/server';
// Import all the entities you will be using on the server.
import MyEntityClass from './entities/MyEntity';
// Configure Nymph.
const nymph = new Nymph(
{},
new SQLite3Driver({
filename: ':memory:',
}),
);
const MyEntity = nymph.addEntityClass(MyEntityClass);
// Create your Express app.
const app = express();
// Create and use the REST server (with an optional path).
app.use('/rest', createServer(nymph));
// Do anything else you need to do...
// Start your server.
app.listen(80);
+
+You will need to import any entities you use on the server, so they are available to Nymph.
+Now you can configure your client, using your server's address (and the optional path, if set).
+import { Nymph } from '@nymphjs/client';
import MyEntityClass from './entities/MyEntityClient';
const nymph = new Nymph({
// You should configure your Express server to
// use HTTPS, but you don't have to.
restUrl: 'https://mydomain.tld/rest',
});
const MyEntity = nymph.addEntityClass(MyEntityClass);
+
+The REST server will authenticate for you using the Tilmeld auth cookie and XSRF token, but if you need to, you can authenticate in some other way (like OAuth2), and place the user in response.locals.user
.
import express from 'express';
import { Nymph } from '@nymphjs/nymph';
import SQLite3Driver from '@nymphjs/driver-sqlite3';
import { Tilmeld } from '@nymphjs/tilmeld';
import createServer from '@nymphjs/server';
import setup from '@nymphjs/tilmeld-setup';
// Import all the entities you will be using on the server.
import MyEntityClass from './entities/MyEntity';
// Consfigure Tilmeld.
const tilmeld = new Tilmeld({
appName: 'My Awesome App',
appUrl: 'https://mydomain.tld',
setupPath: '/user',
});
// Configure Nymph.
const nymph = new Nymph(
{},
new SQLite3Driver({
filename: ':memory:',
}),
tilmeld,
);
const MyEntity = nymph.addEntityClass(MyEntityClass);
// Create your Express app.
const app = express();
// Authenticate the user manually.
app.use('/rest', async (request, response, next) => {
const { User } = tilmeld;
try {
// Somehow authenticate the user...
const user = await User.factoryUsername(username);
if (user.guid != null && user.enabled) {
response.locals.user = user;
}
next();
} catch (e: any) {
response.status(500);
response.send('Internal server error.');
}
});
// Create and use the REST server (with an optional path).
app.use('/rest', createServer(nymph));
// Create Tilmeld setup app.
app.user(
'/user',
setup(
{
restUrl: 'https://mydomain.tld/rest',
},
nymph,
),
);
// Do anything else you need to do...
// Start your server.
app.listen(80);
+
+Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Powerful object data storage and querying.
+The Nymph Entity Sorter lets you sort entities by their properties, including hierarchically.
+npm install --save @nymphjs/sorter
+
+Here's an overview:
+import { Nymph } from '@nymphjs/nymph';
// or
import { Nymph } from '@nymphjs/client';
import PageClass from 'Page';
import { Sorter } from '@nymphjs/sorter';
const nymphOptions = {
// the options for your Nymph instance.
};
const nymph = new Nymph(nymphOptions);
const Page = nymph.addEntityClass(PageClass);
let pages = await nymph.getEntities({ class: Page });
const sorter = new Sorter(pages);
//
// ## Simple sort by some property.
//
sorter.sort('name');
// Pages are now sorted by name, with locale aware sorting.
console.log(pages);
sorter.sort('cdate');
// Pages are now sorted by creation date.
console.log(pages);
sorter.sort('cdate', { reverse: true });
// Pages are now sorted by creation date, newest first.
console.log(pages);
// Specifying your own comparator.
sorter.sort('name', { comparator: (a, b) => (a < b ? -1 : a > b ? 1 : 0) });
// Pages are now sorted by name, based on UTF-16 code points.
console.log(pages);
// Specifying options to the collator.
sorter.sort('name', {
collatorOptions: {
sensitivity: 'case',
caseFirst: 'upper',
numeric: true,
},
});
// Pages are now sorted by name, with uppercase coming first in case of
// otherwise identical entries, and numbers being sorted logically (2 < 10).
console.log(pages);
//
// ## Hierarchical sorting.
//
sorter.hsort('name', 'parent');
// Pages are now sorted by name, hierarchically. (All child pages come
// immediately after their parent.)
console.log(pages);
// You can specify the same options as before.
sorter.hsort('name', 'parent', {
collatorOptions: {
sensitivity: 'case',
caseFirst: 'upper',
numeric: true,
},
});
// Pages are now sorted by name, hierarchically, with uppercase coming first
// in case of otherwise identical entries, and numbers being sorted
// logically (2 < 10).
console.log(pages);
+
+Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Powerful object data storage and querying.
+Tilmeld (the d is silent) is a user and group management system for Nymph. It provides strict access controls to protect entities from unauthorized access/modification. It allows for granting and revoking ad hoc abilities to users and groups, then checking for those abilities. It provides authentication services and features protection against XSRF attacks.
+npm install --save @nymphjs/tilmeld
+
+When you initialize Nymph, provide it with an instance of the Tilmeld class from this package. You now have access to the User and Group classes that are specific to that instance of Nymph/Tilmeld.
+Here's an overview.
+import SQLite3Driver from '@nymphjs/driver-sqlite3';
import { Tilmeld } from '@nymphjs/tilmeld';
import { Nymph } from '@nymphjs/nymph';
const tilmeld = new Tilmeld({
appName: 'My App',
appUrl: 'http://localhost',
cookieDomain: 'localhost',
cookiePath: '/',
setupPath: '/user',
verifyRedirect: 'http://localhost',
verifyChangeRedirect: 'http://localhost',
cancelChangeRedirect: 'http://localhost',
jwtSecret: 'shhhhh',
});
const nymph = new Nymph(
{},
new SQLite3Driver({
filename: ':memory:',
}),
tilmeld,
);
// These are the classes specific to this instance of Tilmeld.
const { User, Group } = tilmeld;
+
+See the config declaration file.
+There are a few abilities that Tilmeld uses internally:
+system/admin
- A user with this ability has all abilities.tilmeld/admin
- Allow the user to manage and edit other user's account and group information and grant/revoke abilities.tilmeld/switch
- Allow the user to switch to other users (log in as them without their password).uid/get/[name]
- Allow the user to read the named UID.uid/new/[name]
- Allow the user to read, create, and increment the named UID.uid/set/[name]
- Allow the user to read, create, increment, set, and delete the named UID.The admin and switch abilities cannot be inherited from groups.
+Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Powerful object data storage and querying.
+The Tilmeld Client lets you register, login, and perform user account related functions remotely on a Nymph server.
+npm install --save @nymphjs/tilmeld-client
+
+You can find UMD in dist
, or TS source in src
.
The Tilmeld client contains the client versions of the User
and Group
entities. It also contains helpers, login
, register
, and checkUsername
.
Once you've initialized Nymph Client, set the User and Group classes on it. Then initialize the new User class with the Nymph instance. (This allows the class to set up authentication listeners.)
+import { Nymph } from '@nymphjs/client';
import {
User as UserClass,
Group as GroupClass,
} from '@nymphjs/tilmeld-client';
const nymph = new Nymph({
restUrl: 'https://yournymphrestserver/path/to/your/endpoint',
});
const User = nymph.addEntityClass(UserClass);
const Group = nymph.addEntityClass(GroupClass);
User.init(nymph);
+
+If you're running more than one instance of Nymph client, be sure to use the classes returned by addEntityClass
, so as not to accidentally submit entities from one instances to another instance.
Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Powerful object data storage and querying.
+The Tilmeld Components are front end registration/login, account recovery, account details, and password change components built with Svelte and SMUI.
+npm install --save @nymphjs/tilmeld-components
+
+You need to have an SMUI theme compiled and installed on your front end app. If you're using Svelte, you need to have TypeScript support and you should use the 'svelte' mainfield from package.json.
+Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Powerful object data storage and querying.
+The Tilmeld Setup App allows administrators to create, modify, and delete users and groups and configure how Tilmeld works. It also acts as the endpoint for email address verification.
+npm install --save @nymphjs/tilmeld-setup
+
+You need to setup a Nymph REST endpoint, then you can use the Tilmeld Setup App as another endpoint in your Express server.
+IMPORTANT: Within the setup app, Tilmeld does not check for XSRF tokens, so do not put your REST endpoint under the setup app's path, or you will be vulnerable to XSRF attacks!
+For this example, I'll use the SQLite3 driver with an in-memory database.
+import express from 'express';
import SQLite3Driver from '@nymphjs/driver-sqlite3';
import { Nymph } from '@nymphjs/nymph';
import { Tilmeld } from '@nymphjs/tilmeld';
import createServer from '@nymphjs/server';
import setup from '@nymphjs/tilmeld-setup';
// Import all the entities you will be using on the server.
import './entities/MyEntity';
// Configure Nymph.
const nymph = new Nymph(
{},
new SQLite3Driver({
filename: ':memory:',
}),
new Tilmeld({
appName: 'My App',
appUrl: 'http://localhost',
cookieDomain: 'localhost',
cookiePath: '/',
setupPath: '/user',
verifyRedirect: 'http://localhost',
verifyChangeRedirect: 'http://localhost',
cancelChangeRedirect: 'http://localhost',
jwtSecret: 'shhhhh',
}),
);
// Create your Express app.
const app = express();
// Use the REST server.
app.use('/rest', createServer(nymph));
// Create Tilmeld setup app.
app.use(
'/user',
setup(
{
restUrl: 'http://localhost/rest',
},
nymph,
),
);
// Do anything else you need to do...
// Start your server.
app.listen(80);
+
+Copyright 2021 SciActive Inc
+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.
+Optional
headers?: { Optional
WebA WebSocket implementation.
+Optional
fetch?: WindowOrWorkerGlobalScope["fetch"]A fetch implementation.
+Optional
noDon't automatically try to connect to PubSub server.
+Optional
noWhether to not output status messages to the console.
+Optional
pubsubThe URL of your Nymph PubSub server.
+Optional
renewWhether to renew tokens when a request is made.
+If you turn this off, the client will request that the server not renew an +authentication token, even if it is within the renewal time of the +expiration date.
+This defaults to true.
+The URL of your Nymph REST server.
+Optional
weakUse a WeakRef based cache of entities.
+This ensures all entities returned are the same instance if they have the +same class and GUID. This also means that whenever an entity is returned +from the server, the single instance in memory will be refreshed. This +could have annoying results, like destroying dirty data (the dreaded +triple-D).
+This could also be a potential source of memory leaks. Although the +entities themselves are referenced weakly so they get garbage collected, +the GUID used as a key and the WeakRef object itself are not weak +references, so not destroyed when the instance is garbage collected.
+However, even with these caveats, this might help you if you have a big app +with the same entities stored in several different places in memory. This +can help to synchronize them correctly and avoid data conflicts.
+The Entity class to query.
+Optional
limit?: numberThe limit of entities to be returned. Not needed when using getEntity
, as
+it always returns only one.
Optional
offset?: numberThe offset from the first matching entity, in order, to start retrieving.
+Optional
return?: "entity" | "guid" | "count"What to return, the entities with their data, just the GUIDs, or just a +count.
+Optional
reverse?: booleanIf true, entities will be retrieved from newest to oldest/largest to
+smallest (with regard to sort
).
Optional
skipIf true, Nymph will skip the cache and retrieve the entity from the DB.
+Optional
sort?: "cdate" | "mdate" | stringHow to sort the entities. Should be "cdate", "mdate", or the name of a +property.
+The error event is for unknown errors. Query errors fire their own reject +callbacks.
+Optional
resolve: PubSubResolveCallback<T>Optional
reject: PubSubRejectCallbackOptional
count: PubSubCountCallbackOptional
!contain?: Clause<OrWithTime<PrimitiveSelector["contain"]>>Optional
!defined?: Clause<PrimitiveSelector["defined"]>Optional
!equal?: Clause<OrWithTime<PrimitiveSelector["equal"]>>Optional
!gt?: Clause<OrWithTime<PrimitiveSelector["gt"]>>Optional
!gte?: Clause<OrWithTime<PrimitiveSelector["gte"]>>Optional
!guid?: Clause<PrimitiveSelector["guid"]>Optional
!ilike?: Clause<PrimitiveSelector["ilike"]>Optional
!imatch?: Clause<PrimitiveSelector["imatch"]>Optional
!like?: Clause<PrimitiveSelector["like"]>Optional
!lt?: Clause<OrWithTime<PrimitiveSelector["lt"]>>Optional
!lte?: Clause<OrWithTime<PrimitiveSelector["lte"]>>Optional
!match?: Clause<PrimitiveSelector["match"]>Optional
!qref?: Selector["qref"]Optional
!ref?: Clause<PrimitiveSelector["ref"]>Optional
!selector?: Selector["selector"]Optional
!tag?: Clause<PrimitiveSelector["tag"]>Optional
!truthy?: Clause<PrimitiveSelector["truthy"]>Optional
contain?: Clause<OrWithTime<PrimitiveSelector["contain"]>>Optional
defined?: Clause<PrimitiveSelector["defined"]>Optional
equal?: Clause<OrWithTime<PrimitiveSelector["equal"]>>Optional
gt?: Clause<OrWithTime<PrimitiveSelector["gt"]>>Optional
gte?: Clause<OrWithTime<PrimitiveSelector["gte"]>>Optional
guid?: Clause<PrimitiveSelector["guid"]>Optional
ilike?: Clause<PrimitiveSelector["ilike"]>Optional
imatch?: Clause<PrimitiveSelector["imatch"]>Optional
like?: Clause<PrimitiveSelector["like"]>Optional
lt?: Clause<OrWithTime<PrimitiveSelector["lt"]>>Optional
lte?: Clause<OrWithTime<PrimitiveSelector["lte"]>>Optional
match?: Clause<PrimitiveSelector["match"]>Optional
qref?: Clause<[string, [Options, ...Selector[]]]>Optional
ref?: Clause<PrimitiveSelector["ref"]>Optional
selector?: Clause<Selector>Optional
tag?: Clause<PrimitiveSelector["tag"]>Optional
truthy?: Clause<PrimitiveSelector["truthy"]>Optional
entity?: EntityJsonOptional
!contain?: PrimitiveSelector["contain"][]Optional
!defined?: PrimitiveSelector["defined"][][]Optional
!equal?: PrimitiveSelector["equal"][]Optional
!gt?: PrimitiveSelector["gt"][]Optional
!gte?: PrimitiveSelector["gte"][]Optional
!guid?: PrimitiveSelector["guid"][][]Optional
!ilike?: PrimitiveSelector["ilike"][]Optional
!imatch?: PrimitiveSelector["imatch"][]Optional
!like?: PrimitiveSelector["like"][]Optional
!lt?: PrimitiveSelector["lt"][]Optional
!lte?: PrimitiveSelector["lte"][]Optional
!match?: PrimitiveSelector["match"][]Optional
!qref?: FormattedSelector["qref"]Optional
!ref?: PrimitiveSelector["ref"][]Optional
!selector?: FormattedSelector["selector"]Optional
!tag?: PrimitiveSelector["tag"][][]Optional
!truthy?: PrimitiveSelector["truthy"][][]Optional
contain?: PrimitiveSelector["contain"][]Optional
defined?: PrimitiveSelector["defined"][][]Optional
equal?: PrimitiveSelector["equal"][]Optional
gt?: PrimitiveSelector["gt"][]Optional
gte?: PrimitiveSelector["gte"][]Optional
guid?: PrimitiveSelector["guid"][][]Optional
ilike?: PrimitiveSelector["ilike"][]Optional
imatch?: PrimitiveSelector["imatch"][]Optional
like?: PrimitiveSelector["like"][]Optional
lt?: PrimitiveSelector["lt"][]Optional
lte?: PrimitiveSelector["lte"][]Optional
match?: PrimitiveSelector["match"][]Optional
qref?: [string, [Options, ...FormattedSelector[]]][]Optional
ref?: PrimitiveSelector["ref"][]Optional
selector?: FormattedSelector[]Optional
tag?: PrimitiveSelector["tag"][][]Optional
truthy?: PrimitiveSelector["truthy"][][]Optional
className: stringThe NymphQueryCallback will be called on both top level and qref queries.
+This is the only callback that is not asynchronous.
+This also isn't necessarily run on every "query". It is run before a database +query for an entity, but it is not run during PubSub entity change +propagation. Therefore, it shouldn't do anything entity specific, instead +it should be query specific. For example, throw an error if the user is not +permitted to run the query at all.
+Optional
class?: TThe Entity class to query.
+Optional
limit?: numberThe limit of entities to be returned. Not needed when using getEntity
, as
+it always returns only one.
Optional
offset?: numberThe offset from the first matching entity, in order, to start retrieving.
+Optional
return?: "entity" | "guid" | "count"What to return, the entities with their data, just the GUIDs, or just a +count.
+Optional
reverse?: booleanIf true, entities will be retrieved from newest to oldest/largest to
+smallest (with regard to sort
).
Optional
skipIf true, Tilmeld will not filter returned entities according to access +controls. (If Tilmeld is installed.) (This is always set to false by the +REST endpoint and PubSub server.)
+Optional
skipIf true, Nymph will skip the cache and retrieve the entity from the DB.
+Optional
sort?: "cdate" | "mdate" | stringHow to sort the entities. Should be "cdate", "mdate", or the name of a +property.
+Optional
source?: stringWill be 'client' if the query came from a REST request or the PubSub +server. (Mainly used in Tilmeld for access control.)
+Optional
!contain?: Clause<OrWithTime<PrimitiveSelector["contain"]>>Optional
!defined?: Clause<PrimitiveSelector["defined"]>Optional
!equal?: Clause<OrWithTime<PrimitiveSelector["equal"]>>Optional
!gt?: Clause<OrWithTime<PrimitiveSelector["gt"]>>Optional
!gte?: Clause<OrWithTime<PrimitiveSelector["gte"]>>Optional
!guid?: Clause<PrimitiveSelector["guid"]>Optional
!ilike?: Clause<PrimitiveSelector["ilike"]>Optional
!imatch?: Clause<PrimitiveSelector["imatch"]>Optional
!like?: Clause<PrimitiveSelector["like"]>Optional
!lt?: Clause<OrWithTime<PrimitiveSelector["lt"]>>Optional
!lte?: Clause<OrWithTime<PrimitiveSelector["lte"]>>Optional
!match?: Clause<PrimitiveSelector["match"]>Optional
!qref?: Selector["qref"]Optional
!ref?: Clause<PrimitiveSelector["ref"]>Optional
!selector?: Selector["selector"]Optional
!tag?: Clause<PrimitiveSelector["tag"]>Optional
!truthy?: Clause<PrimitiveSelector["truthy"]>Optional
contain?: Clause<OrWithTime<PrimitiveSelector["contain"]>>Optional
defined?: Clause<PrimitiveSelector["defined"]>Optional
equal?: Clause<OrWithTime<PrimitiveSelector["equal"]>>Optional
gt?: Clause<OrWithTime<PrimitiveSelector["gt"]>>Optional
gte?: Clause<OrWithTime<PrimitiveSelector["gte"]>>Optional
guid?: Clause<PrimitiveSelector["guid"]>Optional
ilike?: Clause<PrimitiveSelector["ilike"]>Optional
imatch?: Clause<PrimitiveSelector["imatch"]>Optional
like?: Clause<PrimitiveSelector["like"]>Optional
lt?: Clause<OrWithTime<PrimitiveSelector["lt"]>>Optional
lte?: Clause<OrWithTime<PrimitiveSelector["lte"]>>Optional
match?: Clause<PrimitiveSelector["match"]>Optional
qref?: Clause<[string, [Options, ...Selector[]]]>Optional
ref?: Clause<PrimitiveSelector["ref"]>Optional
selector?: Clause<Selector>Optional
tag?: Clause<PrimitiveSelector["tag"]>Optional
truthy?: Clause<PrimitiveSelector["truthy"]>Optional
switchOptional
entity?: EntityJsonOptional
name?: stringOptional
newOptional
oldOptional
value?: numberOptional
count?: booleanThis means the user directly subscribed to this query, as opposed +to indirectly subscribing with a qref clause.
+Optional
count?: booleanOptional
entityClass: EntityConstructorOptional
defaultFields: string[]Optional
defaultOptional
caseSort case sensitively.
+Optional
collatorOptions to pass to Intl.Collator for string comparisons. This overrides the caseSensitive options.
+Optional
comparator?: ((a, b) => number)A custom comparator to use. This overrides all other options except reverse.
+Optional
reverse?: booleanReverse the sort order.
+Optional
acOptional
acOptional
acOptional
acOptional
acOptional
acOptional
group?: Group & GroupDataOptional
user?: User & UserDataOptional
abilities?: string[]The abilities granted to the group.
+Optional
avatar?: stringThe group's avatar URL. (Use getAvatar() to support Gravatar.)
+Optional
defaultWhether this group is the default primary group for new users.
+Optional
defaultWhether this group is a default secondary group for new users.
+Optional
email?: stringThe group's email address.
+Optional
enabled?: booleanWhether the group can be used.
+Optional
groupname?: stringThe group's groupname.
+Optional
name?: stringThe group's name.
+Optional
parent?: Group & GroupDataThe group's parent.
+Optional
phone?: stringThe group's telephone number.
+Optional
unverifiedWhether this group is a default secondary group for unverified users.
+Optional
user?: User & UserData | nullIf generatePrimary is on, this will be the user who generated this group.
+This is run before the transaction is committed, and you can perform
+additional functions on the transaction, which is available in user.$nymph
.
These are run after the authentication checks, but before the login action.
+Theses are run before the user data checks, so the only checks before are +whether registration is allowed and whether the user is already registered.
+This is run when the user has entered an otherwise valid username into the +signup form. It should return a result, which when false will stop the +process and return the included message, disallowing the username.
+Optional
abilities?: string[]The abilities granted to the user.
+Optional
avatar?: stringThe user's avatar URL. (Use $getAvatar() to support Gravatar.)
+Optional
cancelThe old email address.
+Optional
cancelAn email change cancellation secret.
+Optional
email?: stringThe user's email address.
+Optional
emailThe timestamp of when the email address was last changed.
+Optional
enabled?: booleanWhether the user can log in.
+Optional
group?: Group & GroupDataThe user's primary group.
+Optional
groups?: (Group & GroupData)[]The user's secondary groups.
+Optional
inheritWhether the user should inherit the abilities of his groups.
+Optional
name?: stringThe user's full name. This is generated from the first, middle, and last +names.
+Optional
nameThe user's first name.
+Optional
nameThe user's last name.
+Optional
nameThe user's middle name.
+Optional
newIf the user has changed their email address, this is the new one, awaiting +verification.
+Optional
newAn email change proceed secret.
+Optional
password?: stringThe password or password hash.
+Optional
passwordTemporary storage for passwords. This will be hashed before going into the +database.
+Optional
phone?: stringThe user's telephone number.
+Optional
recoverA recovery secret.
+Optional
recoverThe timestamp of when the recovery secret was issued.
+Optional
revokeIf set, this timestamp is the cutoff point for JWT issue dates. Any token +issued before this date will not authenticate the user.
+Optional
salt?: stringThe password hash salt.
+Optional
secret?: stringA verification secret.
+Optional
totpTwo factor auth secret.
+Optional
username?: stringThe user's username.
+Optional
cancelThe old email address.
+Optional
cancelAn email change cancellation secret.
+Optional
emailThe timestamp of when the email address was last changed.
+Optional
group?: Group & AdminGroupDataThe user's primary group.
+Optional
groups?: (Group & AdminGroupData)[]The user's secondary groups.
+Optional
newThe new email address.
+Optional
newAn email change proceed secret.
+Optional
passwordUsed by admins to change a user's password. Not saved to the database.
+Optional
recoverA recovery secret.
+Optional
recoverThe timestamp of when the recovery secret was issued.
+Optional
revokeIf set, this timestamp is the cutoff point for JWT issue dates. Any token +issued before this date will not authenticate the user.
+Optional
secret?: stringA verification secret.
+Optional
abilities?: string[]The abilities granted to the group.
+Optional
email?: stringThe group's email address.
+Optional
phone?: stringThe group's telephone number.
+Optional
user?: User & CurrentUserData | nullIf generatePrimary is on, this will be the user who generated this group.
+Optional
abilities?: string[]The abilities granted to the user.
+Optional
email?: stringThe user's email address.
+Optional
group?: Group & CurrentGroupDataThe user's primary group.
+Optional
groups?: (Group & CurrentGroupData)[]The user's secondary groups.
+Optional
inheritWhether the user should inherit the abilities of his groups.
+Optional
newIf the user has changed their email address, this is the new one, awaiting +verification.
+Optional
phone?: stringThe user's telephone number.
+Optional
avatar?: stringThe group's avatar URL. (Use getAvatar() to support Gravatar.)
+Optional
defaultWhether this group is the default primary group for new users.
+Optional
defaultWhether this group is a default secondary group for new users.
+Optional
enabled?: booleanWhether the group can be used.
+Optional
groupname?: stringThe group's groupname.
+Optional
name?: stringThe group's name.
+Optional
parent?: Group & GroupDataThe group's parent.
+Optional
unverifiedWhether this group is a default secondary group for unverified users.
+Optional
additionalAdditional data to be included in the request.
+Optional
email?: stringThe new user's email address.
+Optional
nameThe new user's given name.
+Optional
nameThe new user's surname.
+New user's password.
+Repeat the password.
+Optional
phone?: stringThe new user's phone number.
+New user's username.
+Whether the username passed verification.
+Optional
avatar?: stringThe user's avatar URL. (Use $getAvatar() to support Gravatar.)
+Optional
enabled?: booleanWhether the user can log in.
+Optional
name?: stringThe user's full name.
+Optional
nameThe user's first name.
+Optional
nameThe user's last name.
+Optional
nameThe user's middle name.
+Optional
username?: stringThe user's username.
+Const
HTTP status code to status text map.
+
Optional override for formatting stack traces
+