Class: Nuxeo

Nuxeo(optsopt)

The Nuxeo class allows using the REST API of a Nuxeo Platform instance.

Constructor

new Nuxeo(optsopt)

Creates a new Nuxeo instance.

Parameters:
Name Type Attributes Description
opts object <optional>

The configuration options.

Properties
Name Type Attributes Default Description
baseURL string <optional>
http://localhost:8080/nuxeo/

Base URL of the Nuxeo Platform.

apiPath string <optional>
api/v1

The API path.

auth object <optional>

The authentication configuration.

Source:
Example
var Nuxeo = require('nuxeo')
var nuxeo = new Nuxeo({
 baseURL: 'http://localhost:8080/nuxeo',
 auth: {
   method: 'basic',
   username: 'Administrator',
   password: 'Administrator'
 }
});
nuxeo.request('path/')
  .get()
  .then(function(doc) {
    // doc.uid !== null
  });

Extends

Methods

_computeOptions()

Computes a full options object from an optional opts object and the ones from this object.
schemas, enrichers, fetchProperties and headers are not merged but the ones from the opts object
override the ones from this object.

Overrides:
Source:

_http()

Does a http request.

To be used when doing any call on Nuxeo Platform.

Deprecated:
  • since version 3.3, use {#http} instead.
Source:

batchUpload(optsopt) → {BatchUpload}

Creates a new BatchUpload object.

Parameters:
Name Type Attributes Description
opts object <optional>

Options overriding the ones from this object.

Source:
Returns:
Type
BatchUpload

connect(optsopt) → {Promise}

Connects to the Nuxeo Platform instance using the configured authentication.

This method fills the user property with the current user
and the serverVersion property with the Nuxeo Server version.

Parameters:
Name Type Attributes Description
opts object <optional>

Options overriding the ones from this object.

Source:
Returns:

A promise resolved with the connected client.

Type
Promise

depth() → {Base}

Sets the depth.
Possible values are: root, children and max.

Overrides:
Source:
Returns:

The object itself.

Type
Base

directory(name, optsopt) → {Directory}

Creates a new Directory object.

Parameters:
Name Type Attributes Description
name string

The directory name.

opts object <optional>

Options overriding the ones from this object.

Source:
Returns:
Type
Directory

enricher(entity, name) → {Base}

Adds an enricher for a given entity.

Parameters:
Name Type Description
entity string

The entity name.

name string

The enricher name.

Overrides:
Source:
Returns:

The object itself.

Type
Base

enrichers(enrichers, override) → {Base}

Sets the enrichers.

By default, the new enrichers override completely the existing ones. By setting override to false,
enrichers are merged.

Parameters:
Name Type Default Description
enrichers object

The new enrichers.

override boolean true

If the new enrichers override the existing ones. Default to true.

Overrides:
Source:
Returns:

The object itself.

Type
Base
Example
{ document: ['acls', 'permissions'] }

fetchProperties(fetchProperties, override) → {Base}

Sets the properties to fetch.

By default, the new properties override completely the existing ones. By setting override to false,
the properties to fetch are merged.

Parameters:
Name Type Default Description
fetchProperties object

The new properties to fetch.

override boolean true

If the new fetchProperties override the existing ones. Default to true.

Overrides:
Source:
Returns:

The object itself.

Type
Base
Example
{ document: ['dc:creator'] }

fetchProperty(entity, name) → {Base}

Adds a property to fetch for a given entity.

Parameters:
Name Type Description
entity string

The entity name.

name string

The property name.

Overrides:
Source:
Returns:

The object itself.

Type
Base

groups(optsopt) → {Groups}

Creates a new Groups object to manage groups.

Parameters:
Name Type Attributes Description
opts object <optional>

Options overriding the ones from this object.

Source:
Returns:
Type
Groups

Adds a header.

Parameters:
Name Type Description
name string

the header name

value string

the header value

Overrides:
Source:
Returns:

The object itself..

Type
Base

headers(headers) → {Base}

Sets the headers.

Parameters:
Name Type Description
headers object

the new headers.

Overrides:
Source:
Returns:

The object itself.

Type
Base

http()

Does a http request.

To be used when doing any call on Nuxeo Platform.

Source:

httpTimeout() → {Base}

Sets the HTTP timeout, in milliseconds.

The HTTP timeout works only in a Node.js environment.

Overrides:
Source:
Returns:

The object itself.

Type
Base

login(optsopt) → {Promise}

Connects to the Nuxeo Platform instance using the configured authentication.

Parameters:
Name Type Attributes Description
opts object <optional>

Options overriding the ones from this object.

Deprecated:
  • since version 3.0, use {#connect} instead.
Source:
Returns:

A promise resolved with the logged in user.

Type
Promise

operation(id, optsopt) → {Operation}

Creates a new Operation object.

Parameters:
Name Type Attributes Description
id string

The operation ID.

opts object <optional>

Options overriding the ones from this object.

Source:
Returns:
Type
Operation

repository(name, optsopt) → {Repository}

Creates a new Repository object.

Parameters:
Name Type Attributes Default Description
name string null

The repository name. Default to the Nuxeo's repository name.

opts object <optional>

Options overriding the ones from this object.

Source:
Returns:
Type
Repository

repositoryName(repositoryName) → {Base}

Sets the repository name.

Parameters:
Name Type Description
repositoryName string

The repository name.

Overrides:
Source:
Returns:

The object itself.

Type
Base

request(path, optsopt) → {Request}

Creates a new Request object.

Parameters:
Name Type Attributes Description
path string

The request default path.

opts object <optional>

Options overriding the ones from this object.

Source:
Returns:
Type
Request

schemas(schemas) → {Base}

Sets the schemas.

Parameters:
Name Type Description
schemas Array

The schemas.

Overrides:
Source:
Returns:

The object itself.

Type
Base

timeout() → {Base}

Sets the global timeout, used as HTTP timeout and transaction timeout
by default.

Overrides:
Deprecated:
  • since 3.6.0, use {#httpTiemout} or {#transactionTimeout} instead.
Source:
Returns:

The object itself.

Type
Base

transactionTimeout() → {Base}

Sets the transaction timeout, in seconds.

Overrides:
Source:
Returns:

The object itself.

Type
Base

translateProperties(translateProperties, override) → {Base}

Sets the properties to translate.

By default, the new properties override completely the existing ones. By setting override to false,
the properties to translate are merged.

Parameters:
Name Type Default Description
translateProperties object

The new properties to translate.

override boolean true

If the new translateProperties override the existing ones. Default to true.

Overrides:
Source:
Returns:

The object itself.

Type
Base
Example
{ directoryEntry: ['label'] }

translateProperty(entity, name) → {Base}

Adds a property to translate for a given entity.

Parameters:
Name Type Description
entity string

The entity name.

name string

The property name.

Overrides:
Source:
Returns:

The object itself.

Type
Base

users(optsopt) → {Users}

Creates a new Users object to manage users.

Parameters:
Name Type Attributes Description
opts object <optional>

Options overriding the ones from this object.

Source:
Returns:
Type
Users

workflows(name, optsopt) → {Workflows}

Creates a new Workflows object.

Parameters:
Name Type Attributes Description
name string

The repository name. Default to the Nuxeo's repository name.

opts object <optional>

Options overriding the ones from this object.

Source:
Returns:
Type
Workflows

(static) promiseLibrary()

Sets the Promise library class to use.

Source:

(static) registerAuthenticator()

Registers an Authenticator for a given authentication method.

Source:

(static) registerUnmarshaller()

Registers an Unmarshaller for a given entity type.

Source: