Class: TaggedTransition

base.TaggedTransition()

The objects that represent transitions are tagged transition.. These are used for global defintions of particular transition type.

The global definitions are useful in short micro service modules. However, the aim is a generalization which will be further developed. One aspect of the generalization will be that some application modules will not use the global variable tagged transitions, but operations will be selected out of session keyed data objects such as state machines. Or, a way of looking at it, might be that one type of tagged transition will operate a number of state transitions where the data structure will track unamed transitions.

Applications that implement custom descendant methods of the general modules may branch on types of transitions by querying the tagged method of the transition object.

Specific data reference fields will be provided via the transition object. A worker queue is part of every tagged transition. Transition engines may access the worker queue.

Another feature of the tagged transition is the use of modules. The array of cases can be have module keys. If a module is used, a transition will be identified if the request asks for the transition type in conjunction with the module.

Most of the methods provided are normalizers for fields that go into queries or that set data aside, etc.

Constructor

new TaggedTransition()

Source:

Methods

action_selector(action) → {boolean|string}

Some transition types may govern a set of actions which can be requested seperately during a transition action.

Parameters:
Name Type Description
action string
Source:
Returns:
  • will be a governing string if the action is supported, false otherwise
Type
boolean | string

addModule(module)

Modules may be added.

Parameters:
Name Type Description
module string
Source:

back_ref() → {string}

the appliation's name of the field use to search previous/parent relationships belonging to data objects

Source:
Returns:
Type
string

dir() → {string}

In node.js this defaults to the directory the script is running from. But, this method can be overridden by applications to fix a particular directory

Source:
Returns:
Type
string

empty_queue() → {boolean}

Check to see if the work queue is empty or not.

Source:
Returns:
  • true if empty
Type
boolean

enqueue(data)

A number of transition types may enqueue work to be done after a request has returned or between rewuests, etc. The transtion context marker (the global variable in the basic case) can call up work in different contexts and do the work when the context is encountered. Or, the context may be on a separate thread.

This method enqueues a data object that

Parameters:
Name Type Description
data object
Source:

existence_query(udata) → {object}

This method is made to produce an object that will be used as the query to a database to check for the existence of a user.

Parameters:
Name Type Description
udata object
Source:
Returns:
Type
object

file_entry_id(file_key) → {string}

This method lets applications use a particular kind of name for certain kinds of files and allow for the file name to be individualized for different files (no overwrite) by changing the name or appending a suffix, such as the date.

Parameters:
Name Type Description
file_key string
Source:
Returns:
Type
string

from_cache() → {boolean}

Returns true if the type of transition takes information from cache DB rather than other DB.

Source:
Returns:
Type
boolean

get_work() → {object}

Pull a work descriptor off the worker queue.

Source:
Returns:
Type
object

has_secondary_action(asset_type) → {boolean}

Returns true if the kind of mime type requested requires a seondary action in order to finalize delivery to the client.

Parameters:
Name Type Description
asset_type string
Source:
Returns:
Type
boolean

hash_id_prefix() → {string}

An application and transition specific prefix for a more general hash that may be used to identify objects.

Source:
Returns:
Type
string

kv_store_key() → {string}

Each type of transition may use a specific field in order to query the DB for an object.

Source:
Returns:
Type
string

match_key() → {string}

This is a field in a data object that is used to perform a match test, often in the match method of the session manager.

Source:
Returns:
Type
string

primary_key() → {string}

Returns the key that is used in identifying an object for a DB query. Different types of transitions may have different key fields.

Source:
Returns:
Type
string

session_key() → {string}

This is a key found in a request body and is used to determine that a session is going for a particular user.

Source:
Returns:
Type
string

tag() → {string}

The string representing the tag type. The string returned is part of the requesting client vocabulary of transitions with repsect to the application.

Source:
Returns:
  • the tag of this transition type
Type
string

tagged(tag, module) → {boolean}

This check if a transition object has a particular tag.

This is useful in application code for branching on the requester's transition.

For instance, code might have a global variable, g_user_check. Then, code can check if operations relating to the user check might be used:

if ( g_user_check.tagged(transition) ) {
 // do things for this type of transition
} else if ( .... )  // do things for another type of transition

Code that is more general might check in other ways. E.g let tagged_op = transition_map[transition]; tagged_op(req_body)

Some of the short applications already written use global variable custom transitions.

If a module is used, a transition will be identified if the request asks for the transition type in conjunction with the module.

Parameters:
Name Type Description
tag string
module string
Source:
Returns:
Type
boolean

transform_file_name(file_name) → {string}

This method allows for less special code to call on the application's version of file naming during certain transition actions.

Parameters:
Name Type Description
file_name string
Source:
Returns:
Type
string

update(data) → {object}

This method is set asside for applications to make small changes to body data for special cases. For instance, sometimes the ID coming in from the client won't be in a field recognizable by the rest of the system.

Parameters:
Name Type Description
data object
Source:
Returns:
Type
object

update_file_db_entry(entry_obj)

Provides a way to prepare the object representing the file entry in a database prior to moving the file from some default place (determined by a framework) to an application specific place.

Parameters:
Name Type Description
entry_obj object
Source:

uuid_prefix() → {string}

An application and transition specific prefix for a uuid's that may be used to identify objects.

Source:
Returns:
Type
string