Functions to get, query and manipulate nodes.
Example
var nodeLib = require('/lib/xp/node');
Classes
Methods
(static) connect(params) → {RepoConnection}
Creates a connection to a repository with a given branch and authentication info.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object | JSON with the parameters. Properties
|
Returns:
Returns a new repo-connection.
- Type
- RepoConnection
Example
// Connect to repo 'myRepo', branch 'master'.
var myRepo = nodeLib.connect({
repoId: 'my-repo',
branch: 'master',
principals: ["role:system.admin"]
});
myRepo.create({
_name: "myName",
displayName: "This is brand new node"
});
(static) multiRepoConnect(params) → {MultiRepoConnection}
Creates a connection to several repositories with a given branch and authentication info.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object | JSON with the parameters. Properties
|
Returns:
Returns a new multirepo-connection.
- Type
- MultiRepoConnection
Example
// Connect to repo 'myRepo', branch 'master'.
var searchConnection = nodeLib.multiRepoConnect({
sources: [
{
repoId: 'my-repo',
branch: 'myBranch',
principals: ["role:system.admin"]
},
{
repoId: 'my-other-repo',
branch: 'master',
principals: ["role:system.admin"]
}
]
});