new Client(gmeConfig)
The Client class represents the Client API which is the way to communicate with your project from your user-defined UI pieces. It allows project selection, project tracking, model interpretation and model manipulation.
!! Documentation of the class is incomplete !!
What is mainly missing are the node setters. Until added here use the Core documentation and simply replace any Core nodes in the arguments with the id/path of the nodes instead.
Parameters:
Name | Type | Description |
---|---|---|
gmeConfig |
GmeConfig | the main configuration of the WebGME that holds information about the server and other options. |
- Source:
Methods
abortPlugin(executionId)
Initiates the abort of the given plugin execution.
Parameters:
Name | Type | Description |
---|---|---|
executionId |
string | unique identifier that identifies the plugin execution |
- Source:
addLibrary(name, blobHashLibraryInfoOrSeedName, callback)
Sends a server request to add specified library to the current project and branch.
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
string | Name of new library (cannot contain dots or exist already) |
||||||||||||||||
blobHashLibraryInfoOrSeedName |
string | object | If blobHash string given will import library from blob, if string will import from seed, otherwise project at info (will also be added to info at library). Properties
|
||||||||||||||||
callback |
function | Invoked when request completed. Properties
|
- Source:
addMember(path, memberPath, setId, msgopt)
Add a new member node to the given set of the specified node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
memberPath |
string | the path/id of the member node. |
|
setId |
string | the name of the set to expand. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
addMixin(path, addMixin, msgopt)
Creates a mixin connection to the node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
addMixin |
string | the path/id of the mixin node. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
addUI(uiopt, eventHandler, guidopt) → {string}
Adds a "user" for receiving events regarding nodes in a specified territory.
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ui |
object |
<optional> |
Object with additional methods to be invoked. Properties
|
||||||||
eventHandler |
function | Function invoked at changes for, or initial loading of, nodes within the "user's" territory. Properties
|
|||||||||
guid |
string |
<optional> |
Unique id of user (if not provided one will be generated). |
- Source:
Returns:
The id (guid) of the newly added "user".
- Type
- string
Example
// The eventHandler is invoked whenever there are changes to the nodes
// matching any of the patterns.
// There are three cases when it is triggered:
// 1) updateTerritory was invoked by us.
// 2) Another client made changes to nodes within the territory.
// 3) We made changes to any of the nodes (via the setters).
function eventHandler(events) {
var i,
nodeObj;
for (i = 0; i < events.length; i += 1) {
if (events[i].etype === 'load') {
// The node is loaded and we have access to it.
// It was either just created or this is the initial
// updateTerritory we invoked.
nodeObj = client.getNode(events[i].eid);
} else if (events[i].etype === 'update') {
// There were changes made to the node (or any of its bases, meta-types and/or reverse relationships).
// The node is still loaded and we have access to it.
nodeObj = client.getNode(events[i].eid);
} else if (events[i].etype === 'unload') {
// The node was removed from the model (we can no longer access it).
// We still get the path/id via events[i].eid
} else {
// "Technical events" not used.
}
}
}
var userId = client.addUI(null, eventHandler);
canRedo(branchName) → {boolean}
Returns true if the provided branchName matches the selected and if there were no commits after the previous undo.
Parameters:
Name | Type | Description |
---|---|---|
branchName |
string | Must match the active branch. |
- Source:
Returns:
True if it's fine to call client.redo()
- Type
- boolean
canUndo(branchName) → {boolean}
Returns true if the provided branchName matches the selected and if the current user did made the latest change.
Parameters:
Name | Type | Description |
---|---|---|
branchName |
string | Must match the active branch. |
- Source:
Returns:
True if it's fine to call client.undo()
- Type
- boolean
clearMetaRules(path, msgopt)
Removes all Meta rules from the node (does not have effect on the inherited rules).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
closeProject(callback)
Closes the currently selected project. If a branch is opened it will be closed as well. Will resolve with error if no project is opened.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
callback |
function | Invoked when request completed. Properties
|
- Source:
Fires:
completeTransaction(msgopt, callbackopt)
Completes any open transaction and persists the changes to server.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
msg |
string |
<optional> |
']' | End of commit-message. |
callback |
function |
<optional> |
Optional callback that's invoked when the commit has reached the server. |
- Source:
Example
var nodeId = 'someIdToANodeThatIsLoaded';
client.startTransaction('start of commitMessage');
// While transaction is open nothing will be committed to the server.
client.setAttributes(nodeId, 'name', 'newName', 'changes within the transaction');
client.setRegistry(nodeId, 'position', {x: 100, y:200}, 'some more changes');
// When we have made all of our changes we make a single commit.
client.completeTransaction('end of commitMessage', function (err, result) {
// Here we have the option to get notified when the commit has reached the server
// and been persisted in the database.
// The commit hash of the new state of our model.
console.log(result.hash);
// If we are working in a branch - this is the status of our commit.
// 'SYNCED', 'FORKED'.
console.log(result.status);
});
connectToDatabase(callback)
Establishes a websocket-connection to the storage/database on the server. If already connected - it will resolve immediately. Note that the client itself attempts to reconnect on unintended disconnections. To monitor the status register for the client.CONSTANTS.NETWORK_STATUS_CHANGED event.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
callback |
function | Invoked when request completed. Properties
|
- Source:
Fires:
copyMoreNodes(parameters, msgopt)
Copies the given nodes into the parent (does not enforce meta-rules and requires all participating nodes to be loaded in the client)
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
parameters |
object | the parameters holding parentId and nodes to be copied indexed by their ids/paths (see example) Properties
|
|||||||
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
Example
client.copyMoreNodes({
parentId: '',
'/4': {},
'/5': {
attributes: {
name: 'MyNamedCopy'
},
registry: {
position: {x: 100, y:100}
}
}
}, 'Copied two nodes with some additional init data.');
copyNode(path, parentId, descopt, msgopt) → {GMENode|undefined}
Copies the given node into parent (does not enforce meta-rules and requires all participating nodes to be loaded in the client)
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
string | the id/path of the node to copy |
|||||||||||||||||
parentId |
string | the id/path of the parent where the new copy should be created |
|||||||||||||||||
desc |
object |
<optional> |
{} | named attributes and/or registries to set for the new node (see example) Properties
|
|||||||||||||||
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
Returns:
- the newly created node if it could be copied
Example
var nodeCopy1 = client.copyNode('/4', '');
var nodeCopy2 = client.copyNode('/4', '', {
attributes: {
name: 'CopiedNode'
},
registry: {
position: {x: 100, y: 100}
}
}, 'Created node with specific name and position.');
copyNodes(paths, parentId, msgopt) → {Array.<GMENode>|undefined}
Copies the given nodes into the parent (does not enforce meta-rules and requires all participating nodes to be loaded in the client)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
paths |
Array.<string> | array of the ids/paths of the nodes to copy |
|
parentId |
string | the id/path of the parent where the new copies should be created |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
- See:
-
For reference check the correspondent Core function copyNodes
Returns:
- the newly created nodes if all could be copied
Example
var nodeCopies1 = client.copyNodes(['/4', '/3'], '');
var nodeCopies2 = client.copyNodes('/4', '/3'], '', 'Copied two nodes');
createChildren(parameters, msgopt)
Creates instances as children of the parent node based on the list of nodes among the parameters (does not enforce meta-rules and requires all participating nodes to be loaded in the client).
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
parameters |
object | the parameters holding parentId and nodes to be instantiated indexed by their ids/paths (see example) Properties
|
|||||||
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
Example
client.createChildren({
parentId: '',
'/4': {},
'/5': {
attributes: {
name: 'MyVeryOwnName'
},
registry: {
position: {x: 100, y:100}
}
}
}, 'Created new children of the root based on the list of existing nodes.');
createNode(parameters, msgopt)
Creates a new node based on the given parameters.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
parameters |
object | the parameters holding necessary information for the creation. Properties
|
|||||||||||||||||||||||||
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
Example
client.createNode({
parentId: '',
baseId:'/1',
guid:,
relid:'/aaa'
},
{
attributes: {
name: 'MyVeryOwnName'
},
registry: {
position: {x: 100, y:100}
}
},
'Created new node as the child of the root and instance of the FCO.');
createSet(path, setId, msgopt)
Creates a set that belongs to the node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
setId |
string | the name of the set. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
delAspectMeta(path, name, msgopt)
Removes a complete aspect rule set (filtered contaiment).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
name |
string | the name of the aspect. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
delAspectMetaTarget(path, name, targetPath, msgopt)
Removes an element from an aspect rule set (filtered contaiment).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
name |
string | the name of the aspect. |
|
targetPath |
string | the path/id of the member. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
delAttribute(path, name, msg)
Method to remove an attribute from a given node.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The path of the node in question. |
name |
string | The name of the attribute. |
msg |
string | The message that should be attached to the commit that covers this update. |
- Source:
delAttributeMeta(path, name, msgopt)
Removes an attribute rule from the node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
name |
string | the name of the attribute. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
delBase(path, msgopt)
Removes teh prototype ofd the node. Do not use this function as it is very dangerous!
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
delChildMeta(path, typeId, msgopt)
Removes a containment rule from the node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
typeId |
string | the path/id of the child node. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
delMemberAttribute(path, memberPath, setId, name, msgopt)
Removes the given attribute that is connected to the membership from the node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
memberPath |
string | the path/id of the member node. |
|
setId |
string | the name of the set to expand. |
|
name |
string | the name of the attribute. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
delMemberRegistry(path, memberPath, setId, name, msgopt)
Removes the given registry that is connected to the membership from the node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
memberPath |
string | the path/id of the member node. |
|
setId |
string | the name of the set to expand. |
|
name |
string | the name of the registry. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
delMixin(path, addMixin, msgopt)
Removes a mixin connection from the node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
addMixin |
string | the path/id of the mixin node. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
delPointer(path, name, msgopt)
Removes the pointer of the given node. Setting a pointer to null and deleting it is different! (one is a value, the other means the absence of value)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that we will modify. |
|
name |
string | the name of the pointer to set. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
delPointerMeta(path, name, msgopt)
Removes a complete pointer/set rule including all target/member rules.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
name |
string | the name of the pointer/set. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
delPointerMetaTarget(path, name, targetPath, msgopt)
Removes a target/member from a pointer/set rule.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
name |
string | the name of the pointer/set. |
|
targetPath |
string | the path/id of the pointer target/member. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
delRegistry(path, name, msg)
Method to remove a registry entry of a given node.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The path of the node in question. |
name |
string | The name of the registry. |
msg |
string | The message that should be attached to the commit that covers this update. |
- Source:
delSet(path, setId, msgopt)
Removes a set that belongs to the node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
setId |
string | the name of the set. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
delSetAttribute(path, setName, attrName, msgopt)
Removes the given attribute that is connected to set of the node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
setName |
string | the name of the set to change. |
|
attrName |
string | the name of the attribute. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
delSetRegistry(path, setName, attrName, msgopt)
Removes the given registry that is connected to set of the node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
setName |
string | the name of the set to change. |
|
attrName |
string | the name of the registry. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
deleteNode(path, msgopt)
Delete the given node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node to be deleted from the model. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
deleteNodes(paths, msgopt)
Delete the given node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
paths |
Array.<string> | the path/id list of the nodes to be deleted from the model. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
disconnectFromDatabase(callback)
Ends the websocket-connection to the storage/database on the server.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
callback |
function | Invoked when request completed. Properties
|
- Source:
Fires:
filterPlugins(pluginIds, nodePathopt) → {Array.<string>}
Helper method for filtering out the registered plugins from the available ones.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pluginIds |
Array.<string> | Typically all available plugins on the server. |
||
nodePath |
string |
<optional> |
'' | Node to get the validPlugins from. |
- Source:
Returns:
Filtered plugin ids.
filterValidTarget(path, name, paths) → {Array.<string>}
Filters out potential pointer targets based on wether they would be valid targets. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node that hold the pointer rule (the source of the pointer). |
name |
string | the name of the pointer to check. |
paths |
Array.<string> | the path/id of the target nodes. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- list of path/id of valid target nodes.
getActiveBranchName() → {string|null}
Returns the name of currently selected branch. Returns null if no branch is open.
- Source:
Returns:
The name of the selected branch.
getActiveCommitHash() → {string|null}
Returns the current commit-hash of either the opened branch or the selected commit. Return null if none is selected.
- Source:
Returns:
The active commit-hash.
getActiveProjectId() → {string|null}
Returns the id of currently selected project. Returns null if no project is opened.
- Source:
Returns:
The project-id of the selected project.
getActiveProjectKind() → {string|null|undefined}
Returns the kind of currently selected project at the time it was opened. Returns null if no project is opened and returns undefined if the field is not specified for the project. (To get the latest info from the server use client.getProjectObject() followed by project.getProjectInfo.)
- Source:
Returns:
The project-kind of the selected project.
getActiveProjectName() → {string|null}
Returns the name of currently selected project. Returns null if no project is opened.
- Source:
Returns:
The project-name of the selected project.
getActiveRootHash() → {string|null}
Returns the current root-hash the client is at. If there are changes inside a transaction the root-hash will correspond to the state that is being updated. Returns null if no no branch or commit selected is selected.
- Source:
Returns:
The active root-hash.
getAllMetaNodes(asObject) → {Array.<GMENode>|object}
Returns all meta-nodes as GMENodes.
Parameters:
Name | Type | Description |
---|---|---|
asObject |
boolean | If true return an object with ids/path as keys and nodes as values. |
- Source:
Returns:
If the node is loaded it will be returned, otherwise null.
getAspectTerritoryPattern(path, name) → {object}
Returns a client pattern that covers the given aspect of the node. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node. |
name |
string | the name of the aspect. |
- Source:
Returns:
- object representing the client territory
- Type
- object
getAttributeSchema(path, name) → {object}
Collects and returns the meta rules related to an attribute of the node. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node. |
name |
string | the name of the attribute. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- structured collection of the rules of the attribute.
- Type
- object
getBranchStatus() → {string|null}
Returns the current status of the opened branch. Returns null if no branch is opened.
- Source:
Returns:
One of client.CONSTANTS.BRANCH_STATUS. SYNC/AHEAD_SYNC/AHEAD_NOT_SYNC/PULLING/ERROR.
getChildrenMeta(path) → {object}
Collects and returns the meta rules related to containment of the node. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
- See:
-
For reference check the correspondent Core function getChildrenMeta
Returns:
- structured collection of the rules of the containment.
- Type
- object
getConnectedStorageVersion() → {string|null}
Returns the version (package.json version of webgme-engine) of the server the initial connection was established to.
- Source:
Returns:
null if it was never connected.
getCoreInstance(optionsopt, callback) → {Core|null}
Creates a new core instance using the state of the client and loads a new root node. Resolves with error if no project or root-hash is active.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
Properties
|
||||||||||||||||||||||||
callback |
function |
Properties
|
- Source:
Returns:
The core instance.
getCurrentPluginContext(pluginId, activeNodeIdopt, activeSelectionIdsopt) → {object}
Helper method for obtaining the context for a plugin execution. If WebGMEGlobal is defined it is used to get the activeNode and activeSelection (if not specified). The model context, that is project, branch, commitHash is obtained using the state of the client. If there is an activeNode - the namespace will be the namespace of the first base that defines the pluginId at the "validPlugins" registry.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pluginId |
string | Id of plugin. |
||
activeNodeId |
string |
<optional> |
WebGMEGlobal.State.getActiveObject() || '' | Specific id for active node. |
activeSelectionIds |
Array.<string> |
<optional> |
WebGMEGlobal.State.getActiveSelection() || [] | Specific ids for active-selection. |
- Source:
Returns:
The context needed for runBrowserPlugin/runServerPlugin.
- Type
- object
getLibraryInfo(libraryName) → {object}
Returns the info associated with the library in the current project and commit/branch.
Parameters:
Name | Type | Description |
---|---|---|
libraryName |
string | Name of library. |
- Source:
Returns:
- Info stored at library.
- Type
- object
getLibraryNames() → {Array.<string>}
Returns an array of all libraries at the current project and commit/branch.
- Source:
Returns:
- Fully qualified names of libraries (including libraries of libraries)
getMeta(path, msgopt)
Returns the JSON based meta description of the node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
getMetaAspect(path, name) → {object}
Collects and returns the meta rules related to an aspect of the node. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node. |
name |
string | the name of the aspect. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- structured collection of the rules of the aspect.
- Type
- object
getMetaAspectNames(path) → {Array.<string>}
Collect and returns a list of aspects defined for the node. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- list of valid aspect names.
getNetworkStatus() → {string|null}
Returns the current connection state or null if connectToDatabase was never invoked.
- Source:
Returns:
One of client.CONSTANTS.STORAGE. CONNECTED/DISCONNECTED/RECONNECTED/INCOMPATIBLE_CONNECTION/CONNECTION_ERROR
getNode(path) → {GMENode|null}
Returns the GMENode of the given node if it has been loaded.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path of the node in question. |
- Source:
Returns:
If the node is loaded it will be returned, otherwise null.
getOwnMetaAspectNames(path) → {Array.<string>}
Collect and returns a list of aspects defined for the node. Additionally, it filters out those aspects that are inherited for the node. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- list of valid aspect names.
getOwnValidAttributeNames(path) → {Array.<string>}
Collects the names of the valid attributes of the node. Additionally, it filters out those names that are inherited for the node. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- list of valid attribute names.
getOwnValidChildrenTypes(path) → {object}
Collects and returns the list of containment rules of the node. Additionally the list filters out elements that are inherited. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- structured collection of children types of the containment with cardinality information.
- Type
- object
getOwnValidTargetItems()
Identical to getOwnValidTargetTypes.
- Source:
getOwnValidTargetTypes(path, name) → {Array.<string>}
Collects the meta node ids, that can be instantiated for a valid target of the given pointer of the node. Additionaly it filters out those that only valid due to inherioted rules. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node that hold the pointer rule (the source of the pointer). |
name |
string | the name of the pointer to check. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- list of path/id of valid target meta-nodes.
getPointerMeta(path, name) → {object}
Collects and returns the meta rules related to a pointer/set of the node. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node that hold the pointer rule (the source of the pointer). |
name |
string | the name of the pointer/set. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- structured object of the rules related to the pointer/set.
- Type
- object
getProjectAccess() → {object|null}
Returns the access the current user had to the selected project when it was opened. Returns null if no project is open. (To get the latest info from the server use client.getProjectObject() followed by project.getProjectInfo.)
- Source:
Returns:
The access levels to the project.
Example
{ read: true, write: false, delete: false }
getProjectInfo() → {object|null}
Returns the info of the selected project when it was opened. Returns null if no project is open. (To get the latest info from the server use client.getProjectObject() followed by project.getProjectInfo.)
- Source:
Returns:
The project info - see project.getProjectInfo
getProjectObject() → {ProjectInterface|null}
Returns the project object of the selected project. Returns null if no project is open.
- Source:
Returns:
The project instance.
- Type
- ProjectInterface | null
getRunningPlugins()
Gathers the list of running plugins and information about them.
- Source:
getUserId() → {string}
Get the identity of the current user of the client/storage.
- Source:
Returns:
the userId
- Type
- string
getValidAttributeNames(path) → {Array.<string>}
Collects the names of the valid attributes of the node. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- list of valid attribute names.
getValidChildrenItems(path) → {object}
Collects and returns the list of containment rules of the node. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- structured collection of children types of the containment with cardinality information.
- Type
- object
getValidChildrenTypes(parentPath, path) → {boolean}
Checks if the node would be a valid child of the given parent. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
parentPath |
string | the path/id of the parent node. |
path |
string | the path/id of the node. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- true if the node would be a valid child of the parent, false otherwise (or if any of the nodes is missing).
- Type
- boolean
getValidChildrenTypes(path) → {Array.<string>}
Collects the meta node ids, that can be instantiated for a valid child of the given node. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- list of path/id of valid target meta-nodes.
getValidTargetItems()
Identical to getValidTargetTypes.
- Source:
getValidTargetTypes(path, name) → {Array.<string>}
Collects the meta node ids, that can be instantiated for a valid target of the given pointer of the node. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node that hold the pointer rule (the source of the pointer). |
name |
string | the name of the pointer to check. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- list of path/id of valid target meta-nodes.
hasOwnMetaRules(path, name) → {boolean}
Checks if the node has meta rules of its own (not inherited). All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node. |
name |
string | the name of the aspect. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- true if the node has some rule of its own, false if it only has inherited rules.
- Type
- boolean
isCommitReadOnly() → {boolean}
Returns true if a specific commit is selected (no branch opened).
- Source:
Returns:
True if a commit is selected
- Type
- boolean
isConnected() → {boolean}
Returns true if a connection to the database/storage has been established and is not in a disconnected state.
- Source:
Returns:
True if connected to the database/storage.
- Type
- boolean
isProjectReadOnly() → {boolean}
Returns true if the selected project is read-only for the connected user.
- Source:
Returns:
True if the user only has read-access to the project.
- Type
- boolean
isReadOnly() → {boolean}
Returns true if either the selected project is read-only for the connected user or if a commit is selected, i.e. if either isReadOnlyCommit or isProjectReadOnly return true.
- Source:
Returns:
True if in read-only state.
- Type
- boolean
isTypeOf(path, typePath) → {boolean}
Check if the given node is an instance of the type node. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node. |
typePath |
string | the path/id of the type node. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- true if the node inherits from the type node, false otherwise (or if one of the nodes is not accessible).
- Type
- boolean
isValidTarget(path, name, targetPath) → {boolean}
Check if the given node is valid target for the pointer of the other node. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Description |
---|---|---|
path |
string | the path/id of the node that hold the pointer rule (the source of the pointer). |
name |
string | the name of the pointer to check. |
targetPath |
string | the path/id of the target node. |
- Deprecated:
- The function provided in GMENode class should be used! (this one will be removed at the next major release)
- Source:
Returns:
- true if the target node is a valid target for the pointer of the node, false otherwise (or if one of the nodes is not accessible).
- Type
- boolean
moveAspectMetaTarget(path, targetPath, oldName, newName, msgopt)
Moves an aspect target rule to a new aspect. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node. |
|
targetPath |
string | the path/id of the target to be moved. |
|
oldName |
string | the name of the current aspect. |
|
newName |
string | the name of the new aspect. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
- See:
-
For reference check the correspondent Core function moveAspectMetaTarget
moveMember(path, memberPath, oldSetName, newSetName, msgopt)
Moves a set member to a new set. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node. |
|
memberPath |
string | the path/id of the member to be moved. |
|
oldSetName |
string | the name of the current set. |
|
newSetName |
string | the name of the new set. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
- See:
-
For reference check the correspondent Core function moveMember
moveMoreNodes(parameters, msgopt)
Moves the given nodes into the parent (does not enforce meta-rules and requires all participating nodes to be loaded in the client)
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
parameters |
object | the parameters holding parentId and nodes to be copied indexed by their ids/paths (see example) Properties
|
|||||||
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
Example
client.moveMoreNodes({
parentId: '',
'/4': {},
'/5': {
attributes: {
name: 'MyNamedCopy'
},
registry: {
position: {x: 100, y:100}
}
}
}, 'Copied two nodes with some additional init data.');
moveNode(path, parentPath, msgopt)
Moves a node into a new container.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
parentPath |
string | the path/id of the new container node. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
movePointerMetaTarget(path, name, targetPath, oldName, newName, msgopt)
Moves a potential target/member to a pointer/set rule from another.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
name |
string | the name of the pointer/set. |
|
targetPath |
string | the path/id of the pointer target/member. |
|
oldName |
string | the name of the current pointer rule. |
|
newName |
integer | the name of the new pointer/set rule. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
notifyUser(notificationopt)
Trigger the client to dispatch a NOTIFICATION (in the generic UI the notification widget listens to these).
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
notification |
object | string |
<optional> |
Notification to user (if string given will be set at notification.message) Properties
|
- Source:
redo(branchName, callback)
Redo the latest undo. Will immediately resolve with error if the provided branchName is not the same as the selected or if there were commits after the previous undo (see canRedo).
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
branchName |
string | Must match the active branch. |
|||||||||
callback |
function | Invoked when request completed. Properties
|
- Source:
removeLibrary(libraryName)
Remove the library from the current project and branch.
Parameters:
Name | Type | Description |
---|---|---|
libraryName |
string | Name of library to remove. |
- Source:
removeMember(path, memberPath, setId, msgopt)
Removes a member node from the given set of the specified node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
memberPath |
string | the path/id of the member node. |
|
setId |
string | the name of the set to expand. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
removeUI(guid)
Removes the user at guid and no more events will be triggered at its event-handler.
Parameters:
Name | Type | Description |
---|---|---|
guid |
string | The unique id of the "user" to remove. |
- Source:
Example
var id = client.addUI(null, function (events) {
// Say we only wanted the initial updateTerritory event.
client.removeUI(id);
});
client.updateTerritory(id);
renameAttribute(path, oldName, newName, msgopt)
Renames an attribute of the node. Effectively, it moves the value of one attribute to another. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node. |
|
oldName |
string | the name of the current attribute. |
|
newName |
string | the name of the new attribute. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
- See:
-
For reference check the correspondent Core function renameAttribute
renameAttributeMeta(path, oldName, newName, msgopt)
Renames an attribute meta rule. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node. |
|
oldName |
string | the name of the current attribute. |
|
newName |
string | the name of the new attribute. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
- See:
-
For reference check the correspondent Core function renameAttributeMeta
renameLibrary(oldName, newName)
Rename the library in the current project and branch.
Parameters:
Name | Type | Description |
---|---|---|
oldName |
string | Name of library to rename. |
newName |
string | New name of library. |
- Source:
renamePointer(path, oldName, newName, msgopt)
Renames a pointer of the node. Effectively, it moves the target of one pointer to another. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node. |
|
oldName |
string | the name of the current pointer. |
|
newName |
string | the name of the new pointer. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
- See:
-
For reference check the correspondent Core function renamePointer
renameRegistry(path, oldName, newName, msgopt)
Renames an registry of the node. Effectively, it moves the value of one registry to another. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node. |
|
oldName |
string | the name of the current registry. |
|
newName |
string | the name of the new registry. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
- See:
-
For reference check the correspondent Core function renameRegistry
renameSet(path, oldName, newName, msgopt)
Renames a set of the node. Effectively, it moves the members of one set to another. All participant nodes have to be loaded to the client
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node. |
|
oldName |
string | the name of the current set. |
|
newName |
string | the name of the new set. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
- See:
-
For reference check the correspondent Core function renameSet
runBrowserPlugin(pluginId, context, callback)
Execute the specified plugin inside the browser at the provided context.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pluginId |
string | Id of plugin. |
||||||||||||||||||||||||||||||||||||||||||||||||||
context |
object |
Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||||
callback |
function |
- Source:
Fires:
runServerPlugin(pluginId, context, callback)
Execute the specified plugin on the server at the provided context. Before invoking a plugin on the server you need to make sure that the given commitHash has been persisted in the database.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pluginId |
string | Id of plugin. |
||||||||||||||||||||||||||||||||||||||||||||||||||
context |
object |
Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||||
callback |
function |
- Source:
Fires:
selectBranch(branchName, callback)
Selects a branch in the currently opened project. It will close any currently opened branch. If the same branch is opened it will close and reselect it (this differs from how selectProject works).
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
branchName |
string | Name of branch to open. |
||||||
callback |
function | Invoked when request completed. Properties
|
- Source:
Fires:
selectCommit(commitHash, callback)
Selects a specific commit and enters "read-only" mode see isReadOnly and isReadOnlyCommit. If a branch is opened it will be closed. Will resolve with error if the commit does not exist.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
commitHash |
string | Unique id for the commit to select. |
||||||
callback |
function | Invoked when request completed. Properties
|
- Source:
Fires:
selectProject(projectId, branchNameopt, callback)
Selects a new project and opens a branch for monitoring. Any previously opened project/branch will be closed. If the same project is already open - it will resolve immediately and keep that project open. (To only change the branch use selectBranch instead). If branchName is given and it does not exist, the project will be closed and the callback will resolve with an error. If branchName is NOT given it will attempt proceed in the following in order and break if successful at any step:
- Select the 'master' if available.
- Select any available branch.
- Select the latest commit.
- Close the project and resolve with an error.
Parameters:
Name | Type | Attributes | Default | Description | ||||||
---|---|---|---|---|---|---|---|---|---|---|
projectId |
string | Id of project to be selected |
||||||||
branchName |
string |
<optional> |
'master' | branch to open |
||||||
callback |
function | Invoked when request completed. Properties
|
- Source:
Fires:
- Client#event:PROJECT_OPENED
- Client#event:PROJECT_CLOSED
- Client#event:BRANCH_OPENED
- Client#event:BRANCH_CLOSED
- Client#event:BRANCH_CHANGED
sendMessageToPlugin(executionId, messageId, content)
Sends a message to a running plugin.
Parameters:
Name | Type | Description |
---|---|---|
executionId |
string | unique identifier that identifies the plugin execution |
messageId |
string | the identifier of the message which has been specified by the plugin |
content |
any | the content of the message |
- Source:
setAspectMetaTarget(path, name, targetPath, msgopt)
Creates/extends an aspect rule set (filtered contaiment).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
name |
string | the name of the aspect. |
|
targetPath |
string | the path/id of the new member. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
setAspectMetaTargets(path, name, targetPaths, msgopt)
Creates/extends an aspect rule set (filtered contaiment) with multiple new targets.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
name |
string | the name of the aspect. |
|
targetPaths |
Array.<string> | array of path/id of the new members. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
setAttribute(path, name, value, msg)
Method to set an attribute of a given node.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The path of the node in question. |
name |
string | The name of the attribute. |
value |
any | The value of the attribute to be set. |
msg |
string | The message that should be attached to the commit that covers this update. |
- Source:
setAttributeMeta(path, name, schema, enumopt, defaultopt, multiline, multilineType, isPassword, msgopt)
Creates an attribute meta rule for the node.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|||||||
name |
string | the name of the attribute. |
|||||||
schema |
object | the description of the attribute rule. Properties
|
|||||||
enum |
Array.<string> |
<optional> |
valid choices if the attrubite is an enumeration. |
||||||
default |
string | number | boolean |
<optional> |
the default value of the attribute. |
||||||
multiline |
boolean | shows if the string attribute is a multiline one and should be edited in a code-editor style. |
|||||||
multilineType |
string | show the style of the multiline (c, js, java, ...). helps in functions like syntax highlighting. |
|||||||
isPassword |
boolean | shows if the attribute should be handled sensitively on the UI. |
|||||||
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
setBase(path, basePath, msgopt)
Changes the prototype node of the node. This function should only be used with care!
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
basePath |
string | the path/id of the new prototype node. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
setChildMeta(path, childPath, min, max, msgopt)
Creates a containment rule for the node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
childPath |
string | the path/id of the child node. |
|
min |
number | the minimum allowed number of children of this type. -1 means that there is no lower limit. |
|
max |
number | the maximum allowed number of children of this type. -1 ,eams there is no upper limit. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
setChildMeta(path, meta, msgopt)
Creates multiple containment rules for the node.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|||||||||||||||||||||||||||||
meta |
object | the collection of containment rules. Properties
|
|||||||||||||||||||||||||||||
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
Example
client.setChildMeta(
'/a/b/c',
{
min: 0,
max: 10,
items:[
{ id: 'a/b/dd',
min: 0,
max: 1 },
{ id: 'a/b/ee',
min: 4,
max: 10 },
]
},
'Adding containment rules to the node and setting global cardinality.');
setMemberAttribute(path, memberPath, setId, name, value, msgopt)
Set the given attribute value that is connected to the membership (not the member node, so it only has a meaning in the context of the membership).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
memberPath |
string | the path/id of the member node. |
|
setId |
string | the name of the set where the member exists. |
|
name |
string | the name of the attribute. |
|
value |
object | string | null | the value of the attribute. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
setMemberRegistry(path, memberPath, setId, name, value, msgopt)
Set the given registry value that is connected to the membership (not the member node, so it only has a meaning in the context of the membership).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
memberPath |
string | the path/id of the member node. |
|
setId |
string | the name of the set to expand. |
|
name |
string | the name of the registry. |
|
value |
object | string | null | the value of the registry. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
setMeta(path, meta, msgopt)
Set all the meta rules of a node based on a JSON. It has no effect on the inherited rules!
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
meta |
object | the directory of rules to be set. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
setPointer(path, name, target, msgopt)
Sets the value of the pointer of the given node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that we will modify. |
|
name |
string | the name of the pointer to set. |
|
target |
string | null | the id/path of the target node of the pointer. If the value is null, there will be no target for the pointer. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
setPointerMeta(path, meta, msgopt)
Creates a pointer/set meta rule with multiple potential target/member.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|||||||||||||||||||||||||||||
meta |
object | the collection of pointer/set rules. Properties
|
|||||||||||||||||||||||||||||
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
Examples
client.setPointerMeta(
'/a/b/c',
'myPointer',
{
min: 0,
max: 1,
items:[
{ id: 'a/b/dd',
min: 0,
max: 1 },
{ id: 'a/b/ee',
min: 0,
max: 1 },
]
},
'Adding pointer rules to the node.');
* client.setPointerMeta(
'/a/b/c',
'mySet',
{
items:[
{ id: 'a/b/dd'},
{ id: 'a/b/ee'},
]
},
'Adding set rules to the node.');
setPointerMetaTarget(path, name, targetPath, min, max, msgopt)
Add a potential target/member to a pointer/set rule.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
name |
string | the name of the pointer/set. |
|
targetPath |
string | the path/id of the new pointer target/member. |
|
min |
integer | the lower bound of the cardinality of the rule (for pointer it should be always 0). |
|
max |
integer | the upper bound of the cardinality of the rule (for pointer it should be always 1). |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
setRegistry(path, name, value, msg)
Method to set a registry entry of a given node.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | The path of the node in question. |
name |
string | The name of the registry. |
value |
any | The value of the registry to be set. |
msg |
string | The message that should be attached to the commit that covers this update. |
- Source:
setSetAttribute(path, setName, attrName, attrValue, msgopt)
Set the given attribute value of the set of the node (the value is connected to the node, but only in the context of the set).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
setName |
string | the name of the set where the member exists. |
|
attrName |
string | the name of the attribute. |
|
attrValue |
object | string | null | the value of the attribute. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
setSetRegistry(path, setName, regName, regValue, msgopt)
Set the given registry value of the set of the node (the value is connected to the node, but only in the context of the set).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string | the path/id of the node that will be modified. |
|
setName |
string | the name of the set where the member exists. |
|
regName |
string | the name of the registry. |
|
regValue |
object | string | null | the value of the registry. |
|
msg |
string |
<optional> |
optional commit message, if not supplied a default one with the function name and input parameters will be used |
- Source:
startTransaction(msgopt)
Starts a transaction where all changes to nodes are bundled into a single commit. All commit-messages for each change will be joined and separated by '\n'.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
msg |
string |
<optional> |
'[' | Start of commit-message. |
- Source:
Example
var nodeId = 'someIdToANodeThatIsLoaded';
client.startTransaction('start of commitMessage');
// While transaction is open nothing will be committed to the server.
client.setAttributes(nodeId, 'name', 'newName', 'changes within the transaction');
client.setRegistry(nodeId, 'position', {x: 100, y:200}, 'some more changes');
// When we have made all of our changes we make a single commit.
client.completeTransaction('end of commitMessage', function (err, result) {
// Here we have the option to get notified when the commit has reached the server
// and been persisted in the database.
// The commit hash of the new state of our model.
console.log(result.hash);
// If we are working in a branch - this is the status of our commit.
// 'SYNCED', 'FORKED'.
console.log(result.status);
});
undo(branchName, callback)
Undo the latest change/commit, i.e. sets the branch-hash to point to the previous commit. Will immediately resolve with error if the provided branchName is not the same as the selected or if the current user did not make the latest change (see canRedo).
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
branchName |
string | Must match the active branch. |
|||||||||
callback |
function | Invoked when request completed. Properties
|
- Source:
updateLibrary(name, blobHashLibraryInfoOrSeedName, callback)
Sends a server request to update the specified library at the current project and branch.
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
string | Name of library to update. |
||||||||||
blobHashLibraryInfoOrSeedName |
string | object | If blobHash string given will update library from blob, if string will update from seed, otherwise project at info (will also be added to info at library). |
||||||||||
blobHashOrLibraryInfo.projectId |
string | The projectId of your library. |
||||||||||
blobHashOrLibraryInfo.branchName |
string |
<optional> |
The branch that your library follows in the origin project. |
|||||||||
blobHashOrLibraryInfo.commitHash |
string |
<optional> |
The commit-hash of your library. |
|||||||||
callback |
function | Invoked when request completed. Properties
|
- Source:
updateProjectFromFile(projectId, branchName, blobHashOrSeedName, callback)
Updates the given project and branch name with the provided context.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
projectId |
string | Id of project to update. |
|||||||||
branchName |
string | Branch that should be updated. |
|||||||||
blobHashOrSeedName |
string | If blobHash string will update from the webgmex at the blob, if string will update from the webgmex seed. |
|||||||||
callback |
function | Invoked when request completed. Properties
|
- Source:
updateTerritory(guid, patterns)
Updates the patterns for the territories defined for the "user" at guid.
Parameters:
Name | Type | Description |
---|---|---|
guid |
string | The unique id of the added "user". |
patterns |
object | The definition for the new territory. |
- Source:
Example
// The patterns are defined by using the ids of the nodes and optionally specifying a depth in the containment-
hierarchy from that node
client.updateTerritory('ae1b4f8e-32ea-f26f-93b3-ab9c8daa8a42', {
'/a/b': {
children: 0 // Will only add '/a/b' to the territory
},
'/a/c': {
// children can be left out, implies 0
},
'/a/d': {
children: 1 // '/a/d' and all its children are included
},
'/a/e': {
children: 3 // We can go arbitrarily deep down (note in large models too big territories can be slow!)
}
});
Events
BRANCH_CHANGED
Fired when the open branch changed. The event could either return the name of the newly opened branch or null if there no longer is a branch opened.
Type:
- Source:
BRANCH_CLOSED
Fired when the currently opened branch is closed.
Type:
- Source:
BRANCH_OPENED
Fired when a branch is opened.
Type:
- Source:
BRANCH_STATUS_CHANGED
Fired when the branch status changes. The returned value is one of:
'SYNC'
- The local branch is in sync with the server.'AHEAD_SYNC'
- There are changes in the local branch that has not been sent to the server. The latest commit was synchronized.'AHEAD_NOT_SYNC'
- There are changes in the local branch that has not been sent to the server. The latest commit did not update the branch head. An action is required.'PULLING'
- External changes to the branch are being pulled into the branch.'ERROR'
- Some unexpected error happened.- (
'MERGING'
- a forked commit is attempted to be merged by the server (this is disabled by default))
Type:
- Source:
CONNECTED_USERS_CHANGED
Fired when there are changes among the users connected to the same branch-room (have the same project and branch opened).
Type:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string | 'BRANCH_ROOM_SOCKETS', 'CLIENT_STATE_NOTIFICATION' |
|
projectId |
string | The id of the project |
|
branchName |
string | The name of the branch |
|
userId |
string | The user-id of the user who joined or left |
|
socketId |
string | The unique socket-id of the user who joined or left (this can become hashed) |
|
join |
boolean | undefined |
<optional> |
Whether or not the user joined or left the room (undefined -> false) this only applies to the 'BRANCH_ROOM_SOCKETS' event. |
state |
object | null |
<optional> |
This only applies to the 'CLIENT_STATE_NOTIFICATION' event and is defined by the return value of the function passed in at client.registerUIStateGetter. Behind the scenes this emitted by the client when it receives a 'BRANCH_ROOM_SOCKETS' event in order to notify that new client that it has a user in the same room. But can also be emitted from the GUI by invoking client.emitStateNotification() (which is invoked by the generic webgme UI whenever its state changes). The state in the example below is specific for the generic webgme UI. |
- Source:
Examples
{
"type": "CLIENT_STATE_NOTIFICATION",
"state": {
"activeAspect": "All",
"activeTab": 0,
"layout": "DefaultLayout",
"activeVisualizer": "ModelEditor",
"activeProjectName": "demo+SignalFlowSystem",
"activeBranchName": "master",
"activeCommit": null,
"_toBeActiveObject": "/682825457/607500954",
"activeObject": "/682825457/607500954",
"activeSelection": [
"/682825457/607500954"
]
},
"projectId": "demo+SignalFlowSystem",
"branchName": "master",
"userId": "demo",
"socketId": "nczll3cDYPfoK7IeAAAT"
}
{
"projectId": "demo+SignalFlowSystem",
"branchName": "master",
"userId": "demo",
"socketId": "nczll3cDYPfoK7IeAAAT",
"type": "BRANCH_ROOM_SOCKETS",
"join": true
}
NETWORK_STATUS_CHANGED
Fired when the network status changes. The returned value is one of:
'CONNECTED'
- The websocket connection has been established (a project can be selected)'DISCONNECTED'
- The websocket connection is broken, the user can continue offline and any commits will be pushed automatically by the client when reconnected.'RECONNECTED'
- After a disconnect, the connection has been established again.'INCOMPATIBLE_CONNECTION'
- If the version of webgme-engine the server is different from the one loaded in the client at this point the browser must be refreshed.'CONNECTION_ERROR'
- Some unexpected error happened and the browser needs to be refreshed.
Type:
- Source:
NOTIFICATION
A notification with a message to the end-user. Could be generated by plugins or add-ons, but also by GUI widgets.
Type:
Properties:
Name | Type | Description |
---|---|---|
message |
string | The content of the message. |
severity |
string | One of 'success', 'info', 'warn', 'error' |
- Source:
PLUGIN_FINISHED
Fired when the execution of a plugin - initiated by this given client - finished. The event data contains information about the executed plugin.
Type:
Properties:
Name | Type | Description |
---|---|---|
id |
string | the id of the plugin |
name |
string | the name of the plugin |
executionId |
string | unique identifier that can be used for managing the execution and communicating with the running plugin |
metadata |
object | the original metadata of the plugin |
context |
object | the context of the plugin that has information about the project, active object, and configuration settings for the run |
canBeAborted |
boolean | flag that show if the plugin can be aborted |
start |
string | the exact time of the initiation of the plugin |
clientSide |
boolean | flag showing if the execution is done on the client or the server side |
result |
object | the result of the plugin - once it became available |
- Source:
PLUGIN_INITIATED
Fired when the client initiates a plugin execution. The event data contains information about the executed plugin.
Type:
Properties:
Name | Type | Description |
---|---|---|
id |
string | the id of the plugin |
name |
string | the name of the plugin |
executionId |
string | unique identifier that can be used for managing the execution and communicating with the running plugin |
metadata |
object | the original metadata of the plugin |
context |
object | the context of the plugin that has information about the project, active object, and configuration settings for the run |
canBeAborted |
boolean | flag that show if the plugin can be aborted |
start |
string | the exact time of the initiation of the plugin |
clientSide |
boolean | flag showing if the execution is done on the client or the server side |
result |
object | the result of the plugin - once it became available |
- Source:
PLUGIN_NOTIFICATION
Fired when the plugin sends a notification to the initiating client. The event data contains information about the executed plugin.
Type:
Properties:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pluginId |
string | the id of the plugin |
|||||||||||||
pluginName |
string | the name of the plugin |
|||||||||||||
pluginVersion |
string | the version of the plugin normally in the form of x.y.z |
|||||||||||||
executionId |
string | unique identifier that can be used for managing the execution and communicating with the running plugin |
|||||||||||||
projectId |
string | the id of the project context the plugin uses |
|||||||||||||
branchName |
string |
<optional> |
the name of the branch the plugin runs in. |
||||||||||||
commitHash |
string |
<optional> |
the hash of the commit that represent the version that the plugin runs at. |
||||||||||||
notification |
object | the content of the notification, as the plugin control the content there are no mandatory fields Properties
|
|||||||||||||
type |
string | the exact type of the notification which should always be 'PLUGIN_NOTIFICATION'. |
- Source:
PROJECT_CLOSED
Fired when the currently opened project is closed.
Type:
- Source:
PROJECT_OPENED
Fired when a project is opened.
Type:
- Source: