Class: Connection

Connection(baseUrl)

A connection to a back-end.

Constructor

new Connection(baseUrl)

Creates a new Connection.

Parameters:
Name Type Description
baseUrl string

URL to the back-end

Source:

Members

(nullable) authProvider :AuthProvider

Type:
Source:

(nullable) authProviderList :Array.<AuthProvider>

Type:
Source:

baseUrl :string

Type:
  • string
Source:

(nullable) capabilitiesObject :Capabilities

Type:
Source:

Methods

(async) _delete(path) → {Promise.<AxiosResponse>}

Sends a DELETE request.

Parameters:
Name Type Description
path string
Source:
Throws:
Error
Returns:
Type
Promise.<AxiosResponse>

(async) _get(path, query, responseType) → {Promise.<AxiosResponse>}

Sends a GET request.

Parameters:
Name Type Description
path string
query object.<string, *>
responseType string

Response type according to axios, defaults to json.

Source:
See:
Throws:
Error
Returns:
Type
Promise.<AxiosResponse>

(protected) _normalizeUserProcess(process, additional) → {object.<string, *>}

Takes a UserProcess, BuilderNode or a plain object containing process nodes and converts it to an API compliant object.

Parameters:
Name Type Description
process UserProcess | BuilderNode | object.<string, *>

Process to be normalized.

additional object.<string, *>

Additional properties to be merged with the resulting object.

Source:
Returns:
Type
object.<string, *>

(async) _patch(path, body) → {Promise.<AxiosResponse>}

Sends a PATCH request.

Parameters:
Name Type Description
path string
body *
Source:
Throws:
Error
Returns:
Type
Promise.<AxiosResponse>

(async) _post(path, body, responseType) → {Promise.<AxiosResponse>}

Sends a POST request.

Parameters:
Name Type Description
path string
body *
responseType string

Response type according to axios, defaults to json.

Source:
See:
Throws:
Error
Returns:
Type
Promise.<AxiosResponse>

(async) _put(path, body) → {Promise.<AxiosResponse>}

Sends a PUT request.

Parameters:
Name Type Description
path string
body *
Source:
Throws:
Error
Returns:
Type
Promise.<AxiosResponse>

(async) _send(options) → {Promise.<AxiosResponse>}

Sends a HTTP request.

Options mostly conform to axios, see https://github.com/axios/axios#request-config.

Automatically sets a baseUrl and the authorization information. Default responseType is json.

Tries to smoothly handle error responses by providing an object for all response types, instead of Streams or Blobs for non-JSON response types.

Parameters:
Name Type Description
options object.<string, *>
Source:
See:
Throws:
Error
Returns:
Type
Promise.<AxiosResponse>

(async) authenticateBasic(username, password)

Authenticates with username and password against a back-end supporting HTTP Basic Authentication.

DEPRECATED in favor of using listAuthProviders and BasicProvider.

Parameters:
Name Type Description
username string
password string
Deprecated:
  • Yes
Source:
See:

(async) buildProcess(id) → {Promise.<Builder>}

Returns an object to simply build user-defined processes.

Parameters:
Name Type Description
id string

A name for the process.

Source:
See:
Throws:
Error
Returns:
Type
Promise.<Builder>

capabilities() → {Capabilities}

Returns the capabilities of the back-end.

Source:
Returns:

Capabilities

Type
Capabilities

(async) computeResult(process, planopt, nullable, budgetopt, nullable) → {Promise.<SyncResult>}

Executes a process synchronously and returns the result as the response.

Please note that requests can take a very long time of several minutes or even hours.

Parameters:
Name Type Attributes Default Description
process Process

A user-defined process.

plan string <optional>
<nullable>
null

The billing plan to use for this computation.

budget number <optional>
<nullable>
null

The maximum budget allowed to spend for this computation.

Source:
Returns:
  • An object with the data and some metadata.
Type
Promise.<SyncResult>

(async) createJob(process, titleopt, nullable, descriptionopt, nullable, planopt, nullable, budgetopt, nullable, additionalopt) → {Promise.<Job>}

Creates a new batch job at the back-end.

Parameters:
Name Type Attributes Default Description
process Process

A user-define process to execute.

title string <optional>
<nullable>
null

A title for the batch job.

description string <optional>
<nullable>
null

A description for the batch job.

plan string <optional>
<nullable>
null

The billing plan to use for this batch job.

budget number <optional>
<nullable>
null

The maximum budget allowed to spend for this batch job.

additional object.<string, *> <optional>
{}

Proprietary parameters to pass for the batch job.

Source:
Throws:
Error
Returns:

The stored batch job.

Type
Promise.<Job>

(async) createService(process, type, titleopt, nullable, descriptionopt, nullable, enabledopt, configurationopt, planopt, nullable, budgetopt, nullable, additionalopt) → {Promise.<Service>}

Creates a new secondary web service at the back-end.

Parameters:
Name Type Attributes Default Description
process Process

A user-defined process.

type string

The type of service to be created (see Connection.listServiceTypes()).

title string <optional>
<nullable>
null

A title for the service.

description string <optional>
<nullable>
null

A description for the service.

enabled boolean <optional>
true

Enable the service (true, default) or not (false).

configuration object.<string, *> <optional>
{}

Configuration parameters to pass to the service.

plan string <optional>
<nullable>
null

The billing plan to use for this service.

budget number <optional>
<nullable>
null

The maximum budget allowed to spend for this service.

additional object.<string, *> <optional>
{}

Proprietary parameters to pass for the batch job.

Source:
Throws:
Error
Returns:

The stored service.

Type
Promise.<Service>

(async) describeAccount() → {Promise.<UserAccount>}

Get information about the authenticated user.

Updates the User ID if available.

Source:
Throws:
Error
Returns:

A response compatible to the API specification.

Type
Promise.<UserAccount>

(async) describeCollection(collectionId) → {Promise.<Collection>}

Get further information about a single collection.

Parameters:
Name Type Description
collectionId string

Collection ID to request further metadata for.

Source:
Throws:
Error
Returns:
  • A response compatible to the API specification.
Type
Promise.<Collection>

(async) describeProcess(processId) → {Promise.<?Process>}

Get information about a single process.

Parameters:
Name Type Description
processId string

Collection ID to request further metadata for.

Source:
See:
Throws:
Error
Returns:
  • A single process as object, or null if none is found.
Type
Promise.<?Process>

(async) download(url, authorize) → {Promise.<(Stream.Readable|Blob)>}

Downloads data from a URL.

May include authorization details where required.

Parameters:
Name Type Description
url string

An absolute or relative URL to download data from.

authorize boolean

Send authorization details (true) or not (false).

Source:
Throws:
Error
Returns:
  • Returns the data as Stream in NodeJS environments or as Blob in browsers
Type
Promise.<(Stream.Readable|Blob)>

(async) downloadResult(process, targetPath, planopt, nullable, budgetopt, nullable)

Executes a process synchronously and downloads to result the given path.

Please note that requests can take a very long time of several minutes or even hours.

This method has different behaviour depending on the environment. If a NodeJs environment, writes the downloaded file to the target location on the file system. In a browser environment, offers the file for downloading using the specified name (folders are not supported).

Parameters:
Name Type Attributes Default Description
process Process

A user-defined process.

targetPath string

The target, see method description for details.

plan string <optional>
<nullable>
null

The billing plan to use for this computation.

budget number <optional>
<nullable>
null

The maximum budget allowed to spend for this computation.

Source:
Throws:
Error

getAuthProvider() → (nullable) {AuthProvider}

Returns the AuthProvider.

Source:
Returns:
Type
AuthProvider

getBaseUrl() → {string}

Returns the URL of the back-end currently connected to.

Source:
Returns:

The URL or the back-end.

Type
string

(async) getFile(path) → {Promise.<UserFile>}

Opens a (existing or non-existing) file without reading any information or creating a new file at the back-end.

Parameters:
Name Type Description
path string

Path to the file, relative to the user workspace.

Source:
Throws:
Error
Returns:

A file.

Type
Promise.<UserFile>

(async) getJob(id) → {Promise.<Job>}

Get all information about a batch job.

Parameters:
Name Type Description
id string

Batch Job ID.

Source:
Throws:
Error
Returns:

The batch job.

Type
Promise.<Job>

getOidcProviderFactory() → (nullable) {oidcProviderFactoryFunction}

Get the OpenID Connect provider factory.

Returns null if OIDC is not supported by the client or an instance can't be created for whatever reason.

Source:
See:
Returns:
Type
oidcProviderFactoryFunction

(async) getService(id) → {Promise.<Service>}

Get all information about a secondary web service.

Parameters:
Name Type Description
id string

Service ID.

Source:
Throws:
Error
Returns:

The service.

Type
Promise.<Service>

(async) getUserProcess(id) → {Promise.<UserProcess>}

Get all information about a user-defined process.

Parameters:
Name Type Description
id string

Identifier of the user-defined process.

Source:
Throws:
Error
Returns:

The user-defined process.

Type
Promise.<UserProcess>

(async) init() → {Promise.<Capabilities>}

Initializes the connection by requesting the capabilities.

Source:
Returns:

Capabilities

Type
Promise.<Capabilities>

isAuthenticated() → {boolean}

Returns whether the user is authenticated (logged in) at the back-end or not.

Source:
Returns:

true if authenticated, false if not.

Type
boolean

(async) listAuthProviders() → {Promise.<Array.<AuthProvider>>}

List all authentication methods supported by the back-end.

Source:
See:
Throws:
Error
Returns:

An array containing all supported AuthProviders (including all OIDC providers and HTTP Basic).

Type
Promise.<Array.<AuthProvider>>

(async) listCollections() → {Promise.<Collections>}

List all collections available on the back-end.

Source:
Throws:
Error
Returns:

A response compatible to the API specification.

Type
Promise.<Collections>

(async) listFiles() → {Promise.<Array.<UserFile>>}

Lists all files from the user workspace.

Source:
Throws:
Error
Returns:

A list of files.

Type
Promise.<Array.<UserFile>>

(async) listFileTypes() → {Promise.<FileTypes>}

List the supported output file formats.

Source:
Throws:
Error
Returns:

A response compatible to the API specification.

Type
Promise.<FileTypes>

(async) listJobs() → {Promise.<Array.<Job>>}

Lists all batch jobs of the authenticated user.

Source:
Throws:
Error
Returns:

A list of jobs.

Type
Promise.<Array.<Job>>

(async) listProcesses() → {Promise.<Processes>}

List all processes available on the back-end.

Data is cached in memory.

Source:
Throws:
Error
Returns:
  • A response compatible to the API specification.
Type
Promise.<Processes>

(async) listServices() → {Promise.<Array.<Job>>}

Lists all secondary web services of the authenticated user.

Source:
Throws:
Error
Returns:

A list of services.

Type
Promise.<Array.<Job>>

(async) listServiceTypes() → {Promise.<object.<string, ServiceType>>}

List the supported secondary service types.

Source:
Throws:
Error
Returns:

A response compatible to the API specification.

Type
Promise.<object.<string, ServiceType>>

(async) listUdfRuntimes() → {Promise.<object.<string, UdfRuntime>>}

List the supported UDF runtimes.

Source:
Throws:
Error
Returns:

A response compatible to the API specification.

Type
Promise.<object.<string, UdfRuntime>>

(async) listUserProcesses() → {Promise.<Array.<UserProcess>>}

Lists all user-defined processes of the authenticated user.

Source:
Throws:
Error
Returns:

A list of user-defined processes.

Type
Promise.<Array.<UserProcess>>

setAuthProvider(provider)

Sets the AuthProvider.

The provider must have a token set.

Parameters:
Name Type Description
provider AuthProvider
Source:
Throws:
Error

setAuthToken(type, providerId, token) → {AuthProvider}

Sets the authentication token for the connection.

This creates a new custom AuthProvider with the given details and returns it. After calling this function you can make requests against the API.

This is NOT recommended to use. Only use if you know what you are doing. It is recommended to authenticate through listAuthProviders or related functions.

Parameters:
Name Type Description
type string

The authentication type, e.g. basic or oidc.

providerId string

The provider identifier. For OIDC the id of the provider.

token string

The actual access token as given by the authentication method during the login process.

Source:
Returns:
Type
AuthProvider

setOidcProviderFactory(providerFactoryFuncnullable)

Sets a factory function that creates custom OpenID Connect provider instances.

You only need to call this if you have implemented a new AuthProvider based on the AuthProvider interface (or OIDCProvider class), e.g. to use a OIDC library other than oidc-client-js.

Parameters:
Name Type Attributes Description
providerFactoryFunc oidcProviderFactoryFunction <nullable>
Source:
See:

(async) setUserProcess(id, process) → {Promise.<UserProcess>}

Creates a new stored user-defined process at the back-end.

Parameters:
Name Type Description
id string

Unique identifier for the process.

process Process

A user-defined process.

Source:
Throws:
Error
Returns:

The new user-defined process.

Type
Promise.<UserProcess>

(async) uploadFile(source, targetPathopt, nullable, statusCallbackopt, nullable) → {Promise.<UserFile>}

Uploads a file to the user workspace. If a file with the name exists, overwrites it.

This method has different behaviour depending on the environment. In a nodeJS environment the source must be a path to a file as string. In a browser environment the source must be an object from a file upload form.

Parameters:
Name Type Attributes Default Description
source *

The source, see method description for details.

targetPath string <optional>
<nullable>
null

The target path on the server, relative to the user workspace. Defaults to the file name of the source file.

statusCallback uploadStatusCallback <optional>
<nullable>
null

Optionally, a callback that is executed on upload progress updates.

Source:
Throws:
Error
Returns:
Type
Promise.<UserFile>

(async) validateProcess(process) → {Promise.<Array.<ApiError>>}

Validates a user-defined process at the back-end.

Parameters:
Name Type Description
process Process

User-defined process to validate.

Source:
Throws:
Error
Returns:

errors - A list of API compatible error objects. A valid process returns an empty list.

Type
Promise.<Array.<ApiError>>