{"id":15046668,"url":"https://github.com/auth0/sandboxjs","last_synced_at":"2025-04-30T21:09:35.383Z","repository":{"id":35334842,"uuid":"39596942","full_name":"auth0/sandboxjs","owner":"auth0","description":"Sandbox node.js code like a boss","archived":false,"fork":false,"pushed_at":"2022-10-19T10:17:10.000Z","size":267,"stargazers_count":57,"open_issues_count":6,"forks_count":11,"subscribers_count":111,"default_branch":"master","last_synced_at":"2025-04-30T21:09:24.332Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/auth0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-23T22:29:31.000Z","updated_at":"2025-01-04T16:17:35.000Z","dependencies_parsed_at":"2023-01-15T18:35:17.581Z","dependency_job_id":null,"html_url":"https://github.com/auth0/sandboxjs","commit_stats":null,"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fsandboxjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fsandboxjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fsandboxjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fsandboxjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/auth0","download_url":"https://codeload.github.com/auth0/sandboxjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251782775,"owners_count":21642987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T20:53:21.787Z","updated_at":"2025-04-30T21:09:35.358Z","avatar_url":"https://github.com/auth0.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sandboxjs\n\nSandbox node.js code like a boss.\n\n## Key Features\n\n* Runs code on the public [webtask.io](https://webtask.io) cluster.\n* Your code is totally sandboxed from everyone else's.\n* Integrated with your [wt-cli](https://npmjs.org/package/wt-cli) profiles.\n* Supports returning Promises and/or invoking node-style callbacks.\n\n## Installing it\n\n```bash\nnpm install sandboxjs\n\n# Optionally configure a default wt-cli profile\n```\n\n## Using it\n\n**First, get a webtask token using [wt-cli](https://npmjs.org/package/wt-cli):**\n\n```bash\n# Create a new wt-cli profile\nnpm install -g wt-cli\nwt init\n\n# Or, if you already use wt-cli:\nwt profile ls\n```\n\n```js\nvar Assert = require('assert');\nvar Sandbox = require('sandboxjs');\n\n// You can get your webtask token using the steps above\nvar code = 'module.exports = function (ctx, cb) { cb(null, \"hello world\"); }';\nvar profile = Sandbox.fromToken(process.env.WEBTASK_TOKEN);\n\n// This library lets you create a webtask and run it in one step as a shortcut:\nprofile.run(code, function (err, res, body) {\n    Assert.ifError(err);\n    Assert.equal(res.statusCode, 200, 'The webtask executed as expected');\n    Assert.equal(body, 'hello world', 'The webtask returned the expected string');\n});\n\n// Alternatively, your application might want to to create a webtask url\n// with your (or your users') custom code and secrets.\nprofile.create(code, { secrets: { auth0: 'rocks' } }, function (err, webtask) {\n    Assert.ifError(err);\n    \n    // Making requests to this url will run the specified custom code in a\n    // node.js sandbox and will give it access to your secrets in the first\n    // argument (`ctx`) of your exported webtask function.\n    // For more information on the different styles of webtask functions that\n    // are supported, see: https://webtask.io/docs/model\n    console.log(webtask.url);\n});\n```\n\n### Examples\n\n**Update the code of an existing named webtask**\n\n```js\nvar Sandbox = require('sandboxjs');\n\nvar sandbox = Sandbox.init({ /* ... */ });\nvar webtaskName = 'my_webtask';\nvar webtaskCode = 'module.exports = ...';\n\nsandbox.inspectWebtask({\n    name: webtaskName,\n    // We need to decrypt embedded secrets so that we can set them on the\n    // replacement named webtask\n    decrypt: true,\n    // No need to fetch code since we will be updating it anyway\n    fetch_code: false,\n}).then(handleClaims);\n\nfunction handleClaims(claims) {\n    // We will pull any claims from the existing webtask that are user-defined\n    // and set them on a new claims object. Note that some claims are *NOT*\n    // copied over because they are read-only claims generated by the platform.\n    // Common examples include: `ca`, `jti` and `iat`.\n    var newClaims = {\n        jtn: webtaskName,\n        dd: claims.dd,\n        mb: claims.mb,\n        pb: claims.pb,\n        // Instead of being an opaque, encrypted blob, this will be a javascript\n        // Object mapping secret key to value because we set the `decrypt`\n        // option on the call to `inspectWebtask`.\n        ectx: claims.ectx,\n        pctx: claims.pctx,\n        code: webtaskCode,\n    };\n    \n    // Create a replacement webtask from raw claims. We use `createRaw` instead\n    // of `create` so that we can deal directly with the platform's claims\n    // instead of the more human-friendly aliases in `create`.\n    // This method will make a token issue request with the updated claims\n    // and resolve the Promise with a new `Webtask` instance based on that\n    // token.\n    return sandbox.createRaw(newClaims);\n}\n```\n\n## API\n\n## Modules\n\n\u003cdl\u003e\n\u003cdt\u003e\u003ca href=\"#module_sandboxjs\"\u003esandboxjs\u003c/a\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003cp\u003eSandbox node.js code.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\n## Classes\n\n\u003cdl\u003e\n\u003cdt\u003e\u003ca href=\"#CronJob\"\u003eCronJob\u003c/a\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003c/dd\u003e\n\u003cdt\u003e\u003ca href=\"#Webtask\"\u003eWebtask\u003c/a\u003e\u003c/dt\u003e\n\u003cdd\u003e\u003c/dd\u003e\n\u003c/dl\u003e\n\n\u003ca name=\"module_sandboxjs\"\u003e\u003c/a\u003e\n\n## sandboxjs\nSandbox node.js code.\n\n\n* [sandboxjs](#module_sandboxjs)\n    * _static_\n        * [.fromToken(token, options)](#module_sandboxjs.fromToken) ⇒ \u003ccode\u003eSandbox\u003c/code\u003e\n        * [.init(options)](#module_sandboxjs.init) ⇒ \u003ccode\u003eSandbox\u003c/code\u003e\n    * _inner_\n        * [~Sandbox](#module_sandboxjs..Sandbox)\n            * [new Sandbox(options)](#new_module_sandboxjs..Sandbox_new)\n            * [.clone(options)](#module_sandboxjs..Sandbox+clone)\n            * [.create([codeOrUrl], [options], [cb])](#module_sandboxjs..Sandbox+create) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.createRaw(claims, [cb])](#module_sandboxjs..Sandbox+createRaw) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.createUrl(options, [cb])](#module_sandboxjs..Sandbox+createUrl) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.run([codeOrUrl], [options], [cb])](#module_sandboxjs..Sandbox+run) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.createToken(options, [cb])](#module_sandboxjs..Sandbox+createToken) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.issueRequest(request, [cb])](#module_sandboxjs..Sandbox+issueRequest) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.createTokenRaw(claims, [options], [cb])](#module_sandboxjs..Sandbox+createTokenRaw) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.createLogStream(options)](#module_sandboxjs..Sandbox+createLogStream) ⇒ \u003ccode\u003eStream\u003c/code\u003e\n            * [.getWebtask(options, [cb])](#module_sandboxjs..Sandbox+getWebtask) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.createWebtask(options, [cb])](#module_sandboxjs..Sandbox+createWebtask) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.removeWebtask(options, [cb])](#module_sandboxjs..Sandbox+removeWebtask) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.updateWebtask(options, [cb])](#module_sandboxjs..Sandbox+updateWebtask) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.listWebtasks(options, [cb])](#module_sandboxjs..Sandbox+listWebtasks) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.createCronJob(options, [cb])](#module_sandboxjs..Sandbox+createCronJob) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.removeCronJob(options, [cb])](#module_sandboxjs..Sandbox+removeCronJob) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.setCronJobState(options, [cb])](#module_sandboxjs..Sandbox+setCronJobState) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.listCronJobs([options], [cb])](#module_sandboxjs..Sandbox+listCronJobs) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.getCronJob(options, [cb])](#module_sandboxjs..Sandbox+getCronJob) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.getCronJobHistory(options, [cb])](#module_sandboxjs..Sandbox+getCronJobHistory) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.inspectToken(options, [cb])](#module_sandboxjs..Sandbox+inspectToken) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.inspectWebtask(options, [cb])](#module_sandboxjs..Sandbox+inspectWebtask) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.revokeToken(token, [cb])](#module_sandboxjs..Sandbox+revokeToken) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.listNodeModuleVersions(options, [cb])](#module_sandboxjs..Sandbox+listNodeModuleVersions) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.ensureNodeModules(options, [cb])](#module_sandboxjs..Sandbox+ensureNodeModules) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.updateStorage(options, storage, [cb])](#module_sandboxjs..Sandbox+updateStorage) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n            * [.getStorage(options, [cb])](#module_sandboxjs..Sandbox+getStorage) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n\n\u003ca name=\"module_sandboxjs.fromToken\"\u003e\u003c/a\u003e\n\n### Sandbox.fromToken(token, options) ⇒ \u003ccode\u003eSandbox\u003c/code\u003e\nCreate a Sandbox instance from a webtask token\n\n**Kind**: static method of \u003ccode\u003e[sandboxjs](#module_sandboxjs)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eSandbox\u003c/code\u003e - A {@see Sandbox} instance whose url, token and container were derived from the given webtask token.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| token | \u003ccode\u003eString\u003c/code\u003e | The webtask token from which the Sandbox profile will be derived. |\n| options | \u003ccode\u003eObject\u003c/code\u003e | The options for creating the Sandbox instance that override the derived values from the token. |\n| [options.url] | \u003ccode\u003eString\u003c/code\u003e | The url of the webtask cluster. Defaults to the public 'sandbox.auth0-extend.com' cluster. |\n| options.container | \u003ccode\u003eString\u003c/code\u003e | The container with which this Sandbox instance should be associated. Note that your Webtask token must give you access to that container or all operations will fail. |\n| options.token | \u003ccode\u003eString\u003c/code\u003e | The Webtask Token. See: https://webtask.io/docs/api_issue. |\n\n\u003ca name=\"module_sandboxjs.init\"\u003e\u003c/a\u003e\n\n### Sandbox.init(options) ⇒ \u003ccode\u003eSandbox\u003c/code\u003e\nCreate a Sandbox instance\n\n**Kind**: static method of \u003ccode\u003e[sandboxjs](#module_sandboxjs)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eSandbox\u003c/code\u003e - A {@see Sandbox} instance.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | The options for creating the Sandbox instance. |\n| [options.url] | \u003ccode\u003eString\u003c/code\u003e | The url of the webtask cluster. Defaults to the public 'sandbox.auth0-extend.com' cluster. |\n| options.container | \u003ccode\u003eString\u003c/code\u003e | The container with which this Sandbox instance should be associated. Note that your Webtask token must give you access to that container or all operations will fail. |\n| options.token | \u003ccode\u003eString\u003c/code\u003e | The Webtask Token. See: https://webtask.io/docs/api_issue. |\n\n\u003ca name=\"module_sandboxjs..Sandbox\"\u003e\u003c/a\u003e\n\n### Sandbox~Sandbox\n**Kind**: inner class of \u003ccode\u003e[sandboxjs](#module_sandboxjs)\u003c/code\u003e  \n\n* [~Sandbox](#module_sandboxjs..Sandbox)\n    * [new Sandbox(options)](#new_module_sandboxjs..Sandbox_new)\n    * [.clone(options)](#module_sandboxjs..Sandbox+clone)\n    * [.create([codeOrUrl], [options], [cb])](#module_sandboxjs..Sandbox+create) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.createRaw(claims, [cb])](#module_sandboxjs..Sandbox+createRaw) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.createUrl(options, [cb])](#module_sandboxjs..Sandbox+createUrl) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.run([codeOrUrl], [options], [cb])](#module_sandboxjs..Sandbox+run) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.createToken(options, [cb])](#module_sandboxjs..Sandbox+createToken) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.issueRequest(request, [cb])](#module_sandboxjs..Sandbox+issueRequest) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.createTokenRaw(claims, [options], [cb])](#module_sandboxjs..Sandbox+createTokenRaw) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.createLogStream(options)](#module_sandboxjs..Sandbox+createLogStream) ⇒ \u003ccode\u003eStream\u003c/code\u003e\n    * [.getWebtask(options, [cb])](#module_sandboxjs..Sandbox+getWebtask) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.createWebtask(options, [cb])](#module_sandboxjs..Sandbox+createWebtask) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.removeWebtask(options, [cb])](#module_sandboxjs..Sandbox+removeWebtask) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.updateWebtask(options, [cb])](#module_sandboxjs..Sandbox+updateWebtask) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.listWebtasks(options, [cb])](#module_sandboxjs..Sandbox+listWebtasks) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.createCronJob(options, [cb])](#module_sandboxjs..Sandbox+createCronJob) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.removeCronJob(options, [cb])](#module_sandboxjs..Sandbox+removeCronJob) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.setCronJobState(options, [cb])](#module_sandboxjs..Sandbox+setCronJobState) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.listCronJobs([options], [cb])](#module_sandboxjs..Sandbox+listCronJobs) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.getCronJob(options, [cb])](#module_sandboxjs..Sandbox+getCronJob) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.getCronJobHistory(options, [cb])](#module_sandboxjs..Sandbox+getCronJobHistory) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.inspectToken(options, [cb])](#module_sandboxjs..Sandbox+inspectToken) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.inspectWebtask(options, [cb])](#module_sandboxjs..Sandbox+inspectWebtask) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.revokeToken(token, [cb])](#module_sandboxjs..Sandbox+revokeToken) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.listNodeModuleVersions(options, [cb])](#module_sandboxjs..Sandbox+listNodeModuleVersions) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.ensureNodeModules(options, [cb])](#module_sandboxjs..Sandbox+ensureNodeModules) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.updateStorage(options, storage, [cb])](#module_sandboxjs..Sandbox+updateStorage) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.getStorage(options, [cb])](#module_sandboxjs..Sandbox+getStorage) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n\n\u003ca name=\"new_module_sandboxjs..Sandbox_new\"\u003e\u003c/a\u003e\n\n#### new Sandbox(options)\nCreates an object representing a user's webtask.io credentials\n\n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options used to configure the profile |\n| options.url | \u003ccode\u003eString\u003c/code\u003e | The url of the webtask cluster where code will run |\n| options.container | \u003ccode\u003eString\u003c/code\u003e | The name of the container in which code will run |\n| options.token | \u003ccode\u003eString\u003c/code\u003e | The JWT (see: http://jwt.io) issued by webtask.io that grants rights to run code in the indicated container |\n| [options.onBeforeRequest] | \u003ccode\u003eString\u003c/code\u003e | An array of hook functions to be invoked with a prepared request |\n\n\u003ca name=\"module_sandboxjs..Sandbox+clone\"\u003e\u003c/a\u003e\n\n#### sandbox.clone(options)\nCreate a clone of this sandbox instances with one or more different parameters\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options used to configure the profile |\n| [options.url] | \u003ccode\u003eString\u003c/code\u003e | The url of the webtask cluster where code will run |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | The name of the container in which code will run |\n| [options.token] | \u003ccode\u003eString\u003c/code\u003e | The JWT (see: http://jwt.io) issued by webtask.io that grants rights to run code in the indicated container |\n| [options.onBeforeRequest] | \u003ccode\u003eString\u003c/code\u003e | An array of hook functions to be invoked with a prepared request |\n\n\u003ca name=\"module_sandboxjs..Sandbox+create\"\u003e\u003c/a\u003e\n\n#### sandbox.create([codeOrUrl], [options], [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nCreate a Webtask from the given options\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the token  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [codeOrUrl] | \u003ccode\u003eString\u003c/code\u003e | The code for the webtask or a url starting with http:// or https:// |\n| [options] | \u003ccode\u003eObject\u003c/code\u003e | Options for creating the webtask |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks |\n\n\u003ca name=\"module_sandboxjs..Sandbox+createRaw\"\u003e\u003c/a\u003e\n\n#### sandbox.createRaw(claims, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nCreate a Webtask from the given claims\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the token  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| claims | \u003ccode\u003eObject\u003c/code\u003e | Options for creating the webtask |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks |\n\n\u003ca name=\"module_sandboxjs..Sandbox+createUrl\"\u003e\u003c/a\u003e\n\n#### sandbox.createUrl(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nShortcut to create a Webtask and get its url from the given options\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the token  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options for creating the webtask |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks |\n\n\u003ca name=\"module_sandboxjs..Sandbox+run\"\u003e\u003c/a\u003e\n\n#### sandbox.run([codeOrUrl], [options], [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nShortcut to create and run a Webtask from the given options\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the token  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [codeOrUrl] | \u003ccode\u003eString\u003c/code\u003e | The code for the webtask or a url starting with http:// or https:// |\n| [options] | \u003ccode\u003eObject\u003c/code\u003e | Options for creating the webtask |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks |\n\n\u003ca name=\"module_sandboxjs..Sandbox+createToken\"\u003e\u003c/a\u003e\n\n#### sandbox.createToken(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nCreate a webtask token - A JWT (see: http://jwt.io) with the supplied options\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the token  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Claims to make for this token (see: https://webtask.io/docs/api_issue) |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks |\n\n\u003ca name=\"module_sandboxjs..Sandbox+issueRequest\"\u003e\u003c/a\u003e\n\n#### sandbox.issueRequest(request, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nRun a prepared Superagent request through any configured\nonBeforeRequest hooks.\n\nThis can be useful for enablying proxies for server-side\nconsumers of sandboxjs.\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - - A promise representing the fulfillment of the request  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| request | \u003ccode\u003eSuperagent.Request\u003c/code\u003e | Instance of a superagent request |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Node-style callback function |\n\n\u003ca name=\"module_sandboxjs..Sandbox+createTokenRaw\"\u003e\u003c/a\u003e\n\n#### sandbox.createTokenRaw(claims, [options], [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nCreate a webtask token - A JWT (see: http://jwt.io) with the supplied claims\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the token  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| claims | \u003ccode\u003eObject\u003c/code\u003e | Claims to make for this token (see: https://webtask.io/docs/api_issue) |\n| [options] | \u003ccode\u003eObject\u003c/code\u003e | Optional options. Currently only options.include_webtask_url is supported. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks |\n\n\u003ca name=\"module_sandboxjs..Sandbox+createLogStream\"\u003e\u003c/a\u003e\n\n#### sandbox.createLogStream(options) ⇒ \u003ccode\u003eStream\u003c/code\u003e\nCreate a stream of logs from the webtask container\n\nNote that the logs will include messages from our infrastructure.\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eStream\u003c/code\u003e - A stream that will emit 'data' events with container logs  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Streaming options overrides |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | The container for which you would like to stream logs. Defaults to the current profile's container. |\n\n\u003ca name=\"module_sandboxjs..Sandbox+getWebtask\"\u003e\u003c/a\u003e\n\n#### sandbox.getWebtask(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nRead a named webtask\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with an array of Webtasks  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | Set the webtask container. Defaults to the profile's container. |\n| options.name | \u003ccode\u003eString\u003c/code\u003e | The name of the webtask. |\n| [options.decrypt] | \u003ccode\u003eBoolean\u003c/code\u003e | Decrypt the webtask's secrets. |\n| [options.fetch_code] | \u003ccode\u003eBoolean\u003c/code\u003e | Fetch the code associated with the webtask. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"module_sandboxjs..Sandbox+createWebtask\"\u003e\u003c/a\u003e\n\n#### sandbox.createWebtask(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nCreate a named webtask\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with an array of Webtasks  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | Set the webtask container. Defaults to the profile's container. |\n| options.name | \u003ccode\u003eString\u003c/code\u003e | The name of the webtask. |\n| [options.secrets] | \u003ccode\u003eString\u003c/code\u003e | Set the webtask secrets. |\n| [options.meta] | \u003ccode\u003eString\u003c/code\u003e | Set the webtask metadata. |\n| [options.host] | \u003ccode\u003eString\u003c/code\u003e | Set the webtask hostname. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"module_sandboxjs..Sandbox+removeWebtask\"\u003e\u003c/a\u003e\n\n#### sandbox.removeWebtask(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nRemove a named webtask from the webtask container\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with an array of Webtasks  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | Set the webtask container. Defaults to the profile's container. |\n| options.name | \u003ccode\u003eString\u003c/code\u003e | The name of the cron job. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"module_sandboxjs..Sandbox+updateWebtask\"\u003e\u003c/a\u003e\n\n#### sandbox.updateWebtask(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nUpdate an existing webtask's code, secrets or other claims\n\nNote that this method should be used with caution as there is the potential\nfor a race condition where another agent updates the webtask between the time\nthat the webtask details and claims are resolved and when the webtask\nupdate is issued.\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with an instance of Webtask representing the updated webtask  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options |\n| options.name | \u003ccode\u003eString\u003c/code\u003e | Name of the webtask to update |\n| [options.code] | \u003ccode\u003eString\u003c/code\u003e | Updated code for the webtask |\n| [options.url] | \u003ccode\u003eString\u003c/code\u003e | Updated code URL for the webtask |\n| [options.secrets] | \u003ccode\u003eString\u003c/code\u003e | If `false`, remove existing secrets, if an object update secrets, otherwise preserve |\n| [options.params] | \u003ccode\u003eString\u003c/code\u003e | If `false`, remove existing params, if an object update params, otherwise preserve |\n| [options.host] | \u003ccode\u003eString\u003c/code\u003e | If `false`, remove existing host, if a string update host, otherwise preserve |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"module_sandboxjs..Sandbox+listWebtasks\"\u003e\u003c/a\u003e\n\n#### sandbox.listWebtasks(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nList named webtasks from the webtask container\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with an array of Webtasks  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | Set the webtask container. Defaults to the profile's container. |\n| [options.fetch_code] | \u003ccode\u003eBoolean\u003c/code\u003e | Include the webtask's code in the listing response. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"module_sandboxjs..Sandbox+createCronJob\"\u003e\u003c/a\u003e\n\n#### sandbox.createCronJob(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nCreate a cron job from an already-existing webtask\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with a {@see CronJob} instance.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options for creating a cron job |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | The container in which the job will run. Defaults to the current profile's container. |\n| options.name | \u003ccode\u003eString\u003c/code\u003e | The name of the cron job. |\n| [options.token] | \u003ccode\u003eString\u003c/code\u003e | The webtask token that will be used to run the job. |\n| options.schedule | \u003ccode\u003eString\u003c/code\u003e | The cron schedule that will be used to determine when the job will be run. |\n| options.tz | \u003ccode\u003eString\u003c/code\u003e | The cron timezone (IANA timezone). |\n| options.meta | \u003ccode\u003eString\u003c/code\u003e | The cron metadata (set of string key value pairs). |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"module_sandboxjs..Sandbox+removeCronJob\"\u003e\u003c/a\u003e\n\n#### sandbox.removeCronJob(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nRemove an existing cron job\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the response from removing the job.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options for removing the cron job |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | The container in which the job will run. Defaults to the current profile's container. |\n| options.name | \u003ccode\u003eString\u003c/code\u003e | The name of the cron job. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"module_sandboxjs..Sandbox+setCronJobState\"\u003e\u003c/a\u003e\n\n#### sandbox.setCronJobState(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nSet an existing cron job's state\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the response from removing the job.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options for updating the cron job's state |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | The container in which the job will run. Defaults to the current profile's container. |\n| options.name | \u003ccode\u003eString\u003c/code\u003e | The name of the cron job. |\n| options.state | \u003ccode\u003eString\u003c/code\u003e | The new state of the cron job. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"module_sandboxjs..Sandbox+listCronJobs\"\u003e\u003c/a\u003e\n\n#### sandbox.listCronJobs([options], [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nList cron jobs associated with this profile\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with an Array of {@see CronJob} instances.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [options] | \u003ccode\u003eObject\u003c/code\u003e | Options for listing cron jobs. |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | The container in which the job will run. Defaults to the current profile's container. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"module_sandboxjs..Sandbox+getCronJob\"\u003e\u003c/a\u003e\n\n#### sandbox.getCronJob(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nGet a CronJob instance associated with an existing cron job\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with a {@see CronJob} instance.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options for retrieving the cron job. |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | The container in which the job will run. Defaults to the current profile's container. |\n| options.name | \u003ccode\u003eString\u003c/code\u003e | The name of the cron job. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"module_sandboxjs..Sandbox+getCronJobHistory\"\u003e\u003c/a\u003e\n\n#### sandbox.getCronJobHistory(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nGet the historical results of executions of an existing cron job.\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with an Array of cron job results.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options for retrieving the cron job. |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | The container in which the job will run. Defaults to the current profile's container. |\n| options.name | \u003ccode\u003eString\u003c/code\u003e | The name of the cron job. |\n| [options.offset] | \u003ccode\u003eString\u003c/code\u003e | The offset to use when paging through results. |\n| [options.limit] | \u003ccode\u003eString\u003c/code\u003e | The limit to use when paging through results. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"module_sandboxjs..Sandbox+inspectToken\"\u003e\u003c/a\u003e\n\n#### sandbox.inspectToken(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nInspect an existing webtask token to resolve code and/or secrets\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the resolved webtask data.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options for inspecting the webtask. |\n| options.token | \u003ccode\u003eBoolean\u003c/code\u003e | The token that you would like to inspect. |\n| [options.decrypt] | \u003ccode\u003eBoolean\u003c/code\u003e | Decrypt the webtask's secrets. |\n| [options.fetch_code] | \u003ccode\u003eBoolean\u003c/code\u003e | Fetch the code associated with the webtask. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"module_sandboxjs..Sandbox+inspectWebtask\"\u003e\u003c/a\u003e\n\n#### sandbox.inspectWebtask(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nInspect an existing named webtask to resolve code and/or secrets\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the resolved webtask data.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options for inspecting the webtask. |\n| options.name | \u003ccode\u003eBoolean\u003c/code\u003e | The named webtask that you would like to inspect. |\n| [options.decrypt] | \u003ccode\u003eBoolean\u003c/code\u003e | Decrypt the webtask's secrets. |\n| [options.fetch_code] | \u003ccode\u003eBoolean\u003c/code\u003e | Fetch the code associated with the webtask. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"module_sandboxjs..Sandbox+revokeToken\"\u003e\u003c/a\u003e\n\n#### sandbox.revokeToken(token, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nRevoke a webtask token\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the token  \n**See**: https://webtask.io/docs/api_revoke  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| token | \u003ccode\u003eString\u003c/code\u003e | The token that should be revoked |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks |\n\n\u003ca name=\"module_sandboxjs..Sandbox+listNodeModuleVersions\"\u003e\u003c/a\u003e\n\n#### sandbox.listNodeModuleVersions(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nList versions of a given node module that are available on the platform\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the token  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options |\n| options.name | \u003ccode\u003eString\u003c/code\u003e | Name of the node module |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks |\n\n\u003ca name=\"module_sandboxjs..Sandbox+ensureNodeModules\"\u003e\u003c/a\u003e\n\n#### sandbox.ensureNodeModules(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nEnsure that a set of modules are available on the platform\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with an array of { name, version, state } objects  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options |\n| options.modules | \u003ccode\u003eArray\u003c/code\u003e | Array of { name, version } pairs |\n| options.reset | \u003ccode\u003eBoolean\u003c/code\u003e | Trigger a rebuild of the modules (Requires administrative token) |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks |\n\n\u003ca name=\"module_sandboxjs..Sandbox+updateStorage\"\u003e\u003c/a\u003e\n\n#### sandbox.updateStorage(options, storage, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nUpdate the storage associated to the a webtask\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with an array of Webtasks  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | Set the webtask container. Defaults to the profile's container. |\n| options.name | \u003ccode\u003eString\u003c/code\u003e | The name of the webtask. |\n| storage | \u003ccode\u003eObject\u003c/code\u003e | storage |\n| storage.data | \u003ccode\u003eObject\u003c/code\u003e | The data to be stored |\n| storage.etag | \u003ccode\u003eString\u003c/code\u003e | Pass in an optional string to be used for optimistic concurrency control to prevent simultaneous updates of the same data. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"module_sandboxjs..Sandbox+getStorage\"\u003e\u003c/a\u003e\n\n#### sandbox.getStorage(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nRead the storage associated to the a webtask\n\n**Kind**: instance method of \u003ccode\u003e[Sandbox](#module_sandboxjs..Sandbox)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with an array of Webtasks  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | Set the webtask container. Defaults to the profile's container. |\n| options.name | \u003ccode\u003eString\u003c/code\u003e | The name of the webtask. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"CronJob\"\u003e\u003c/a\u003e\n\n## CronJob\n**Kind**: global class  \n\n* [CronJob](#CronJob)\n    * [new CronJob()](#new_CronJob_new)\n    * [.sandbox](#CronJob+sandbox)\n    * [.refresh([cb])](#CronJob+refresh) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.remove([cb])](#CronJob+remove) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.getHistory(options, [cb])](#CronJob+getHistory) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.inspect(options, [cb])](#CronJob+inspect) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.setJobState(options, [cb])](#CronJob+setJobState) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n\n\u003ca name=\"new_CronJob_new\"\u003e\u003c/a\u003e\n\n### new CronJob()\nCreates an object representing a CronJob\n\n\u003ca name=\"CronJob+sandbox\"\u003e\u003c/a\u003e\n\n### cronJob.sandbox\n**Kind**: instance property of \u003ccode\u003e[CronJob](#CronJob)\u003c/code\u003e  \n**Properties**\n\n| Name | Description |\n| --- | --- |\n| sandbox | The {@see Sandbox} instance used to create this Webtask instance |\n\n\u003ca name=\"CronJob+refresh\"\u003e\u003c/a\u003e\n\n### cronJob.refresh([cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nRefresh this job's metadata\n\n**Kind**: instance method of \u003ccode\u003e[CronJob](#CronJob)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the this cron job instance  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks |\n\n\u003ca name=\"CronJob+remove\"\u003e\u003c/a\u003e\n\n### cronJob.remove([cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nRemove this cron job from the webtask cluster\n\nNote that this will not revoke the underlying webtask token, so the underlying webtask will remain functional.\n\n**Kind**: instance method of \u003ccode\u003e[CronJob](#CronJob)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the token  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks |\n\n\u003ca name=\"CronJob+getHistory\"\u003e\u003c/a\u003e\n\n### cronJob.getHistory(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nGet the history of this cron job\n\n**Kind**: instance method of \u003ccode\u003e[CronJob](#CronJob)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with an Array of cron job results.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options for retrieving the cron job. |\n| [options.offset] | \u003ccode\u003eString\u003c/code\u003e | The offset to use when paging through results. |\n| [options.limit] | \u003ccode\u003eString\u003c/code\u003e | The limit to use when paging through results. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"CronJob+inspect\"\u003e\u003c/a\u003e\n\n### cronJob.inspect(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nInspect an existing webtask to optionally get code and/or secrets\n\n**Kind**: instance method of \u003ccode\u003e[CronJob](#CronJob)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with an Array of cron job results.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options for inspecting the webtask. |\n| [options.fetch_code] | \u003ccode\u003eBoolean\u003c/code\u003e | Fetch the code associated with the webtask. |\n| [options.decrypt] | \u003ccode\u003eBoolean\u003c/code\u003e | Decrypt the webtask's secrets. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"CronJob+setJobState\"\u003e\u003c/a\u003e\n\n### cronJob.setJobState(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nSet the cron job's state\n\n**Kind**: instance method of \u003ccode\u003e[CronJob](#CronJob)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with an Array of cron job results.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options for updating the webtask. |\n| options.state | \u003ccode\u003eBoolean\u003c/code\u003e | Set the cron job's state to this. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"Webtask\"\u003e\u003c/a\u003e\n\n## Webtask\n**Kind**: global class  \n\n* [Webtask](#Webtask)\n    * [new Webtask()](#new_Webtask_new)\n    * [.claims](#Webtask+claims)\n    * [.token](#Webtask+token)\n    * [.sandbox](#Webtask+sandbox)\n    * [.meta](#Webtask+meta)\n    * [.secrets](#Webtask+secrets)\n    * [.code](#Webtask+code)\n    * [.createLogStream(options)](#Webtask+createLogStream) ⇒ \u003ccode\u003eStream\u003c/code\u003e\n    * [.run(options, [cb])](#Webtask+run) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.createCronJob(options, [cb])](#Webtask+createCronJob) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.inspect(options, [cb])](#Webtask+inspect) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.remove([cb])](#Webtask+remove) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.revoke([cb])](#Webtask+revoke) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.update([options], [cb])](#Webtask+update) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.updateStorage(options, storage, [cb])](#Webtask+updateStorage) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n    * [.getStorage(options, [cb])](#Webtask+getStorage) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\n\n\u003ca name=\"new_Webtask_new\"\u003e\u003c/a\u003e\n\n### new Webtask()\nCreates an object representing a Webtask\n\n\u003ca name=\"Webtask+claims\"\u003e\u003c/a\u003e\n\n### webtask.claims\n**Kind**: instance property of \u003ccode\u003e[Webtask](#Webtask)\u003c/code\u003e  \n**Properties**\n\n| Name | Description |\n| --- | --- |\n| claims | The claims embedded in the Webtask's token |\n\n\u003ca name=\"Webtask+token\"\u003e\u003c/a\u003e\n\n### webtask.token\n**Kind**: instance property of \u003ccode\u003e[Webtask](#Webtask)\u003c/code\u003e  \n**Properties**\n\n| Name | Description |\n| --- | --- |\n| token | The token associated with this webtask |\n\n\u003ca name=\"Webtask+sandbox\"\u003e\u003c/a\u003e\n\n### webtask.sandbox\n**Kind**: instance property of \u003ccode\u003e[Webtask](#Webtask)\u003c/code\u003e  \n**Properties**\n\n| Name | Description |\n| --- | --- |\n| sandbox | The {@see Sandbox} instance used to create this Webtask instance |\n\n\u003ca name=\"Webtask+meta\"\u003e\u003c/a\u003e\n\n### webtask.meta\n**Kind**: instance property of \u003ccode\u003e[Webtask](#Webtask)\u003c/code\u003e  \n**Properties**\n\n| Name | Description |\n| --- | --- |\n| meta | The metadata associated with this webtask |\n\n\u003ca name=\"Webtask+secrets\"\u003e\u003c/a\u003e\n\n### webtask.secrets\n**Kind**: instance property of \u003ccode\u003e[Webtask](#Webtask)\u003c/code\u003e  \n**Properties**\n\n| Name | Description |\n| --- | --- |\n| secrets | The secrets associated with this webtask if `decrypt=true` |\n\n\u003ca name=\"Webtask+code\"\u003e\u003c/a\u003e\n\n### webtask.code\n**Kind**: instance property of \u003ccode\u003e[Webtask](#Webtask)\u003c/code\u003e  \n**Properties**\n\n| Name | Description |\n| --- | --- |\n| code | The code associated with this webtask if `fetch_code=true` |\n\n\u003ca name=\"Webtask+createLogStream\"\u003e\u003c/a\u003e\n\n### webtask.createLogStream(options) ⇒ \u003ccode\u003eStream\u003c/code\u003e\nCreate a stream of logs from the webtask container\n\nNote that the logs will include messages from our infrastructure.\n\n**Kind**: instance method of \u003ccode\u003e[Webtask](#Webtask)\u003c/code\u003e  \n**Returns**: \u003ccode\u003eStream\u003c/code\u003e - A stream that will emit 'data' events with container logs  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Streaming options overrides |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | The container for which you would like to stream logs. Defaults to the current profile's container. |\n\n\u003ca name=\"Webtask+run\"\u003e\u003c/a\u003e\n\n### webtask.run(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nRun the webtask and return the result of execution\n\n**Kind**: instance method of \u003ccode\u003e[Webtask](#Webtask)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - - A Promise that will be resolved with the response from the server.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options used to tweak how the webtask will be invoked |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional node-style callback that will be invoked upon completion |\n\n\u003ca name=\"Webtask+createCronJob\"\u003e\u003c/a\u003e\n\n### webtask.createCronJob(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nSchedule the webtask to run periodically\n\n**Kind**: instance method of \u003ccode\u003e[Webtask](#Webtask)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - - A Promise that will be resolved with a {@see CronJob} instance.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options for creating the webtask |\n| options.schedule | \u003ccode\u003eObject\u003c/code\u003e | Cron-string-formatted schedule |\n| [options.name] | \u003ccode\u003eObject\u003c/code\u003e | The name for the cron job |\n| [options.tz] | \u003ccode\u003eObject\u003c/code\u003e | The timezone for the cron job (IANA timezone) |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional node-style callback that will be invoked upon completion |\n\n\u003ca name=\"Webtask+inspect\"\u003e\u003c/a\u003e\n\n### webtask.inspect(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nInspect an existing webtask to optionally get code and/or secrets\n\n**Kind**: instance method of \u003ccode\u003e[Webtask](#Webtask)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the result of inspecting the token.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options for inspecting the webtask. |\n| [options.decrypt] | \u003ccode\u003eBoolean\u003c/code\u003e | Decrypt the webtask's secrets. |\n| [options.fetch_code] | \u003ccode\u003eBoolean\u003c/code\u003e | Fetch the code associated with the webtask. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"Webtask+remove\"\u003e\u003c/a\u003e\n\n### webtask.remove([cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nRemove the named webtask\n\n**Kind**: instance method of \u003ccode\u003e[Webtask](#Webtask)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the result of inspecting the token.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"Webtask+revoke\"\u003e\u003c/a\u003e\n\n### webtask.revoke([cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nRevoke the webtask's token\n\n**Kind**: instance method of \u003ccode\u003e[Webtask](#Webtask)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the result of revoking the token.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"Webtask+update\"\u003e\u003c/a\u003e\n\n### webtask.update([options], [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nUpdate a webtask\n\n**Kind**: instance method of \u003ccode\u003e[Webtask](#Webtask)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with the result of revoking the token.  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| [options] | \u003ccode\u003eObject\u003c/code\u003e | Options for updating a webtask (@see: Sandbox.updateWebtask) |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"Webtask+updateStorage\"\u003e\u003c/a\u003e\n\n### webtask.updateStorage(options, storage, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nUpdate the storage associated to the a webtask\n\n**Kind**: instance method of \u003ccode\u003e[Webtask](#Webtask)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with an array of Webtasks  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | Set the webtask container. Defaults to the profile's container. |\n| options.name | \u003ccode\u003eString\u003c/code\u003e | The name of the webtask. |\n| storage | \u003ccode\u003eObject\u003c/code\u003e | storage |\n| storage.data | \u003ccode\u003eObject\u003c/code\u003e | The data to be stored |\n| storage.etag | \u003ccode\u003eString\u003c/code\u003e | Pass in an optional string to be used for optimistic concurrency control to prevent simultaneous updates of the same data. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\u003ca name=\"Webtask+getStorage\"\u003e\u003c/a\u003e\n\n### webtask.getStorage(options, [cb]) ⇒ \u003ccode\u003ePromise\u003c/code\u003e\nRead the storage associated to the a webtask\n\n**Kind**: instance method of \u003ccode\u003e[Webtask](#Webtask)\u003c/code\u003e  \n**Returns**: \u003ccode\u003ePromise\u003c/code\u003e - A Promise that will be fulfilled with an array of Webtasks  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eObject\u003c/code\u003e | Options |\n| [options.container] | \u003ccode\u003eString\u003c/code\u003e | Set the webtask container. Defaults to the profile's container. |\n| options.name | \u003ccode\u003eString\u003c/code\u003e | The name of the webtask. |\n| [cb] | \u003ccode\u003efunction\u003c/code\u003e | Optional callback function for node-style callbacks. |\n\n\n## Usages\n\nThis library will be used in [wt-cli](https://github.com/auth0/wt-cli).\n\n## Contributing\n\nJust clone the repo, run `npm install` and then hack away.\n\n## Issue reporting\n \nIf you have found a bug or if you have a feature request, please report them at\nthis repository issues section. Please do not report security vulnerabilities on\nthe public GitHub issue tracker. The \n[Responsible Disclosure Program](https://auth0.com/whitehat) details the \nprocedure for disclosing security issues.\n\n## License\n \nMIT\n\n## What is Auth0?\n \nAuth0 helps you to:\n\n* Add authentication with [multiple authentication sources](https://docs.auth0.com/identityproviders), either social like **Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, amont others**, or enterprise identity systems like **Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider**.\n* Add authentication through more traditional **[username/password databases](https://docs.auth0.com/mysql-connection-tutorial)**.\n* Add support for **[linking different user accounts](https://docs.auth0.com/link-accounts)** with the same user.\n* Support for generating signed [Json Web Tokens](https://docs.auth0.com/jwt) to call your APIs and **flow the user identity** securely.\n* Analytics of how, when and where users are logging in.\n* Pull data from other sources and add it to the user profile, through [JavaScript rules](https://docs.auth0.com/rules).\n\n## Create a free account in Auth0\n \n1. Go to [Auth0](https://auth0.com) and click Sign Up.\n2. Use Google, GitHub or Microsoft Account to login.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0%2Fsandboxjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauth0%2Fsandboxjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0%2Fsandboxjs/lists"}