Search…
Developer
Developer environment tools.
1
const developer = require('developer')
Copied!
The developer module exposes various developer-centric environment functionality.
This module is available on development endpoints.

module developer.sessions

1
const { sessions } = require('developer')
Copied!

logout(account)

Logs out sessions for an account. If called from a script by the target account during a session and the current session is in the context of the calling request, the caller's session will not be closed.
Once closed, the first authenticated access by the target account for any existing sessions will result in a cortex.accessDenied.loggedInElsewhere Fault.
Arguments
  • account { String | ObjectID } The account email or id of the target for which sessions will be forcibly ended.

module developer.locations

1
const { locations } = require('developer')
Copied!

list({ where, pipeline, sort, skip, limit })

Query environment devices.
Arguments
  • options { Object }
    • where { Object } A query match object.
    • pipeline { Object } An aggregation pipeline object.
    • sort { Object } A query sort object.
    • skip { Number = 0 }
    • limit { Number = Undefined }
Returns
  • list { Object } A list object.
    • hasMore { Boolean } true when there are more results.
    • data { Object[] } An array of location objects.
    • object { String } "list".

remove( _id )

Remove a device location by _id.
Arguments
  • _id { ObjectID } The id of the device location to be removed.
Returns
  • location { Object } The location object removed. Throws cortex.notFound.unspecified if not found.

module developer.environment

For more information about environment import and export, see the mdctl-cli tools Github page.
1
const { environment } = require('developer')
Copied!

export(options)

Exports an environment.
Arguments
  • options { Object }
    • manifest { Object } A manifest definition that determines what to export.
    • preferUrls { Boolean = true } When true, will export signed urls for File data wherever possible. When false,
      file data will be base64 encoded into chunked resource stream objects.
    • silent { Boolean = false } When true, includes manifest entries without unique keys will be ignored. By
      default, a cortex.unsupportedOperation.uniqueKeyNotSet Fault is thrown.
Returns
  • { Cursor } A cursor to output documents.

import(payload, options)

Import to an environment.
Arguments
  • payload { Cursor | Object[] } An import stream of documents defining the import (manifest and resources).
  • options { Object }
    • backup { Boolean = true } When true, the deployment mechanism puts the environment into maintenance mode and forces
      a wholesale rollback if there is an import error.
    • triggers { Boolean = true } When set to false, script triggers for updated or inserted resources are skipped.
    • production { Boolean = false } At some point, script-based imports may be allowed in production. As a safety
      measure, the production flag must be set when in production and only when in production.
Returns
  • { Cursor } A cursor to input result documents.

Examples

Exporting a definition

1
const { environment } = require('developer')
2
3
return environment.export({
4
manifest: {
5
objects: [{
6
name: 'c_example',
7
includes: ['*']
8
}]
9
}
10
})
Copied!
Last modified 2mo ago