Readonly DeviceAn Device factory for user objects. The Device factory can be called to create new instances of devices or can be used to register, push to and check registration status of devices.
A File factory for file objects. The file factory can be called to create new instances for files. The created instances implements the File interface
Readonly GeoConstructor for a new GeoPoint
Readonly ListConstructor for a new List collection
Readonly MapConstructor for a new Map collection
Readonly RoleAn Role factory for role objects. The Role factory can be called to create new instances of roles, later on users can be attached to roles to manage the access permissions through this role The created instances implements the Role interface
Readonly SetConstructor for a new Set collection
Readonly UserAn User factory for user objects. The User factory can be called to create new instances of users or can be used to register/login/logout users. The created instances implements the User interface
The bloom filter which contains staleness information of cached objects
Readonly bloomBloom filter refresh Promise
Bloom filter refresh interval in seconds.
Set of object ids that were updated but are not yet included in the bloom filter. This set essentially implements revalidation by side effect which does not work in Chrome.
Set of object ids that were revalidated after the Bloom filter was loaded.
Readonly codeThe connector used for requests
The current registered device object
Readonly entityReadonly logLog messages can created by calling log directly as function, with a specific log level or with the helper methods, which a members of the log method.
Logs will be filtered by the client logger and the before they persisted. The default log level is 'info' therefore all log messages below the given message aren't persisted.
Examples:
// default log level ist info
db.log('test message %s', 'my string');
// info: test message my string
// pass a explicit log level as the first argument, one of ('trace', 'debug', 'info', 'warn', 'error')
db.log('warn', 'test message %d', 123);
// warn: test message 123
// debug log level will not be persisted by default, since the default logging level is info
db.log('debug', 'test message %j', {number: 123}, {});
// debug: test message {"number":123}
// data = {}
// One additional json object can be provided, which will be persisted together with the log entry
db.log('info', 'test message %s, %s', 'first', 'second', {number: 123});
// info: test message first, second
// data = {number: 123}
//use the log level helper
db.log.info('test message', 'first', 'second', {number: 123});
// info: test message first second
// data = {number: 123}
//change the default log level to trace, i.e. all log levels will be persisted, note that the log level can be
//additionally configured in the baqend
db.log.level = 'trace';
//trace will be persisted now
db.log.trace('test message', 'first', 'second', {number: 123});
// info: test message first second
// data = {number: 123}
The current logged in user object
Readonly metamodelReadonly modulesReturns the tokenStorage which will be used to authorize all requests.
Whether caching is disabled
Returns true if the device token is already registered, otherwise false.
Determine whether the entity manager is open. true until the entity manager has been closed
Indicates if there is currently no exclusive operation executed
true If no exclusive lock is hold
The authentication token if the user is logged in currently
The authentication token if the user is logged in currently
Configures the DB with additional config options
The additional configuration options
Optional staleness?: numberThe maximum staleness of objects that are acceptable while reading cached
data, 0 to always bypass the browser cache
Optional tokenThe tokenStorage which should be used by this emf
Optional tokenThe tokenStorage factory implementation which should be used for token storage
Connects the DB with the server and calls the callback on success
A initialized EntityManager
The host or the app name to connect with
Optional secure: booleantrue To use a secure connection
Optional doneCallback: anyThe callback, called when a connection is established and the SDK is ready to use
Optional failCallback: anyWhen an error occurred while initializing the SDK
Creates an instance of Builder
The query results are instances of the resultClass argument.
A query builder to create one ore more queries for the specified class
the type of the query result
Creates a absolute url for the given relative one
a absolute url which is optionally signed with a resource token which authenticates the currently logged in user
the relative url
Optional authorize: booleanindicates if authorization credentials should be generated and be attached to the url
Delete the entity instance.
Optional options: { The delete options
Optional depth?: number | booleanOptional force?: booleanRemove the given entity from the persistence context, causing a managed entity to become detached
Unflushed changes made to the entity if any (including removal of the entity), will not be synchronized to the database. Entities which previously referenced the detached entity will continue to reference it.
The entity instance to detach.
Returns the current MFA status of the user
A promise that resolves to the MFA status of the user. Possible values are 'ENABLED' if MFA is enabled, 'DISABLED' if MFA is disabled, or 'PENDING' if MFA status is pending.
Get an instance whose state may be lazily fetched
If the requested instance does not exist in the database, the EntityNotFoundError is thrown when the instance state is first accessed. The application should not expect that the instance state will be available upon detachment, unless it was accessed by the application while the entity manager was open.
Optional key: stringStarts the MFA initiate process - note you must be logged in, to start the mfa setup process
A promise that resolves to an object with the following properties:
const { qrCode, keyUri } = await db.initMFA();
const code = await setupMFADevice(qrCode, keyUri);
const user = await db.finishMFA(code);
Whether caching is enabled
Search for an entity of the specified oid
If the entity instance is contained in the persistence context, it is returned from there.
the loaded entity or null
Optional loginOption: boolean | LoginOptionpre-safe callback
Waits on the previously requested operation and calls the doneCallback if the operation is fulfilled
A promise which completes successfully, when the previously requested operation completes
Optional doneCallback: ((this: baqend) => any)The callback which will be invoked when the previously operations on this object is completed.
Optional failCallback: ((error: Error) => any)When the lock can't be released caused by a none recoverable error
Refresh the state of the instance from the database, overwriting changes made to the entity, if any.
entity instance
The refresh options
Optional depth?: number | booleanThe OS of the device (IOS/Android)
WebPush subscription
Optional loginOption: boolean | LoginOptionOptional options: { The save options
Optional depth?: number | booleanOptional force?: booleanOptional refresh?: booleanSet true to save the entity without locking
Optional options: { Optional depth?: number | booleanOptional force?: booleanOptional refresh?: booleanThe given entity will be checked by the validation code of the entity type.
result
Protected withProtected
Try to aquire an exclusive lock and executes the given callback.
A promise
If the lock can't be aquired
The exclusive operation to execute
Optional critical: boolean = falseIndicates if the operation is critical. If the operation is critical and the operation fails, then the lock will not be released
Generated using TypeDoc
This base class provides an lock interface to execute exclusive operations