diff --git a/cloudapi-graphql/.eslintrc b/cloudapi-graphql/.eslintrc index d1411ab2..6f05aa76 100644 --- a/cloudapi-graphql/.eslintrc +++ b/cloudapi-graphql/.eslintrc @@ -1,13 +1,27 @@ { - "extends": "semistandard", + "extends": [ + "eslint:recommended", + "prettier" + ], + "plugins": [ + "prettier" + ], "rules": { - "no-unused-vars": "error", - "space-before-function-paren": [2, "never"], - "object-curly-newline": ["error", { - "minProperties": 1 - }], - "sort-vars": ["error", { - "ignoreCase": true + "no-console": 0, + "prettier/prettier": ["error", { + "useTabs": false, + "printWidth": 80, + "tabWidth": 2, + "singleQuote": true, + "trailingComma": "none", + "bracketSpacing": true, + "jsxBracketSameLine": false, + "parser": "flow", + "semi": true }] + }, + "env": { + "es6": true, + "node": true } } diff --git a/cloudapi-graphql/README.md b/cloudapi-graphql/README.md index a0c99e73..80f39af9 100644 --- a/cloudapi-graphql/README.md +++ b/cloudapi-graphql/README.md @@ -7,7 +7,7 @@ Proof-of-Concept of the [Joyent Cloud API](https://apidocs.joyent.com/cloudapi/) ### Setup Credentials -Create `credentials.json`, TODO, use environment variables. +Create `credentials.json`: ```json5 { @@ -18,6 +18,17 @@ Create `credentials.json`, TODO, use environment variables. } ``` +Alternatively you can just use ENV variables: + +``` +SDC_URL +SDC_ACCOUNT +SDC_USER +SDC_KEY_ID +``` + +As a third option you can use a `.env` file. + ### Install Dependencies and run ```bash @@ -27,7 +38,7 @@ yarn start ### Visit GraphiQL -Go-to http://0.0.0.0:3000/graphql to use the REPL with interactive documentation. +Go-to http://0.0.0.0:4000/graphql to use the REPL with interactive documentation. ![GraphiQL](https://cloud.githubusercontent.com/assets/524382/19242455/1e371978-8f0b-11e6-9563-d6f5b93fa63c.png) @@ -152,3 +163,4 @@ Go-to http://0.0.0.0:3000/graphql to use the REPL with interactive documentation - [ ] GetNic - [ ] AddNic - [ ] RemoveNic + diff --git a/cloudapi-graphql/etc/containerpilot.json b/cloudapi-graphql/etc/containerpilot.json index 4ee6bdfa..60d9c61d 100644 --- a/cloudapi-graphql/etc/containerpilot.json +++ b/cloudapi-graphql/etc/containerpilot.json @@ -1,47 +1,38 @@ { "consul": "{{ .CONSUL }}:8500", - "services": [ - { - "name": "joyent-portal-cloudapi-graphql", - "port": 3000, - "health": "/usr/bin/curl -o /dev/null --fail -s http://localhost:3000/", - "poll": 3, - "ttl": 10 - } - ], - "backends": [ - ], + "services": [{ + "name": "joyent-portal-cloudapi-graphql", + "port": 4000, + "health": "/usr/bin/curl -o /dev/null --fail -s http://localhost:4000/graphql", + "poll": 3, + "ttl": 10 + }], "telemetry": { "port": 9090, - "sensors": [ - { - "name": "graphql_memory_percent", - "help": "percentage of memory used", - "type": "gauge", - "poll": 5, - "check": ["/bin/sensors", "memory"] - }, - { - "name": "graphql_cpu_load", - "help": "cpu load", - "type": "gauge", - "poll": 5, - "check": ["/bin/sensors", "cpu"] - }, - { - "name": "graphql_disk_capacity", - "help": "disk capacity", - "type": "gauge", - "poll": 60, - "check": ["/bin/sensors", "diskcapacity"] - }, - { - "name": "graphql_disk_usage", - "help": "disk usage", - "type": "gauge", - "poll": 60, - "check": ["/bin/sensors", "diskusage"] - } - ] + "sensors": [{ + "name": "graphql_memory_percent", + "help": "percentage of memory used", + "type": "gauge", + "poll": 5, + "check": ["/bin/sensors", "memory"] + }, { + "name": "graphql_cpu_load", + "help": "cpu load", + "type": "gauge", + "poll": 5, + "check": ["/bin/sensors", "cpu"] + }, { + "name": "graphql_disk_capacity", + "help": "disk capacity", + "type": "gauge", + "poll": 60, + "check": ["/bin/sensors", "diskcapacity"] + }, { + "name": "graphql_disk_usage", + "help": "disk usage", + "type": "gauge", + "poll": 60, + "check": ["/bin/sensors", "diskusage"] + }] } } diff --git a/cloudapi-graphql/package.json b/cloudapi-graphql/package.json index 4e7e796b..f8e843d8 100644 --- a/cloudapi-graphql/package.json +++ b/cloudapi-graphql/package.json @@ -5,6 +5,7 @@ "version": "1.0.0", "main": "src/index.js", "scripts": { + "lint": "eslint src --fix", "start": "node src/index.js", "test": "make test" }, @@ -15,22 +16,16 @@ "express-graphql": "^0.6.4", "got": "^6.7.1", "graphql": "^0.9.3", - "inherits": "^2.0.3", - "moment": "^2.18.1", "smartdc-auth": "^2.5.2", - "triton": "^5.2.0", - "user-home": "^2.0.0" + "triton": "^5.2.0" }, "devDependencies": { "ava": "^0.19.1", - "eslint": "3.19.0", - "eslint-config-semistandard": "^8.0.0", - "eslint-config-standard": "^10.2.0", - "eslint-plugin-import": "^2.2.0", - "eslint-plugin-node": "^4.2.2", - "eslint-plugin-promise": "^3.5.0", - "eslint-plugin-standard": "^3.0.1", + "eslint": "^3.19.0", + "eslint-config-prettier": "^1.7.0", + "eslint-plugin-prettier": "^2.0.1", "nyc": "^10.2.0", + "prettier": "^1.2.2", "tap-xunit": "^1.7.0" } } diff --git a/cloudapi-graphql/src/api/account.js b/cloudapi-graphql/src/api/account.js index 584c0ac5..08adaa85 100644 --- a/cloudapi-graphql/src/api/account.js +++ b/cloudapi-graphql/src/api/account.js @@ -4,6 +4,6 @@ module.exports.get = () => { return request('getAccount'); }; -module.exports.update = (ctx) => { +module.exports.update = ctx => { return request('updateAccount', ctx); }; diff --git a/cloudapi-graphql/src/api/config.js b/cloudapi-graphql/src/api/config.js index e54bb6a8..8d5a6b4f 100644 --- a/cloudapi-graphql/src/api/config.js +++ b/cloudapi-graphql/src/api/config.js @@ -1,5 +1,5 @@ // const request = require('./request'); -module.exports.get = (ctx) => { +module.exports.get = () => { // return request('', ctx); }; diff --git a/cloudapi-graphql/src/api/fabrics.js b/cloudapi-graphql/src/api/fabrics.js index 2d1f4779..bb934414 100644 --- a/cloudapi-graphql/src/api/fabrics.js +++ b/cloudapi-graphql/src/api/fabrics.js @@ -4,6 +4,6 @@ module.exports.list = () => { return request('listFirewallRules', {}); }; -module.exports.get = (ctx) => { +module.exports.get = ctx => { return request('getFirewallRule', ctx); }; diff --git a/cloudapi-graphql/src/api/firewall-rules.js b/cloudapi-graphql/src/api/firewall-rules.js index 84b816e3..60bba238 100644 --- a/cloudapi-graphql/src/api/firewall-rules.js +++ b/cloudapi-graphql/src/api/firewall-rules.js @@ -4,34 +4,34 @@ module.exports.list = () => { return request('listFirewallRules', {}); }; -module.exports.listByMachine = (ctx) => { +module.exports.listByMachine = ctx => { return request('listMachineFirewallRules', ctx); }; -module.exports.listMachines = (ctx) => { +module.exports.listMachines = ctx => { return request('listFirewallRuleMachines', ctx); }; -module.exports.get = (ctx) => { +module.exports.get = ctx => { return request('getFirewallRule', ctx); }; -module.exports.create = (ctx) => { +module.exports.create = ctx => { return request('createFirewallRule', ctx); }; -module.exports.update = (ctx) => { +module.exports.update = ctx => { return request('updateFirewallRule', ctx); }; -module.exports.enable = (ctx) => { +module.exports.enable = ctx => { return request('enableFirewallRule', ctx); }; -module.exports.disable = (ctx) => { +module.exports.disable = ctx => { return request('disableFirewallRule', ctx); }; -module.exports.destroy = (ctx) => { +module.exports.destroy = ctx => { return request('deleteFirewallRule', ctx); }; diff --git a/cloudapi-graphql/src/api/images.js b/cloudapi-graphql/src/api/images.js index ab947d60..e0c3a360 100644 --- a/cloudapi-graphql/src/api/images.js +++ b/cloudapi-graphql/src/api/images.js @@ -1,14 +1,14 @@ const request = require('./request'); -module.exports.list = (ctx) => { +module.exports.list = ctx => { return request('listImages', ctx); }; -module.exports.get = (ctx) => { +module.exports.get = ctx => { return request('getImage', ctx); }; -module.exports.create = (ctx) => { +module.exports.create = ctx => { return request('createImageFromMachine', ctx); }; @@ -16,7 +16,7 @@ module.exports.create = (ctx) => { // return request('UpdateImage', ctx); // }; -module.exports.destroy = (uuid) => { +module.exports.destroy = uuid => { return request('deleteImage', uuid); }; diff --git a/cloudapi-graphql/src/api/keys.js b/cloudapi-graphql/src/api/keys.js index 36cee16b..fee3f4f2 100644 --- a/cloudapi-graphql/src/api/keys.js +++ b/cloudapi-graphql/src/api/keys.js @@ -2,16 +2,16 @@ const request = require('./request'); module.exports = { user: { - list: (ctx) => { + list: ctx => { return request('listUserKeys', ctx); }, - get: (ctx) => { + get: ctx => { return request('getUserKey', ctx); }, - create: (ctx) => { + create: ctx => { return request('createUserKey', ctx); }, - destroy: (ctx) => { + destroy: ctx => { return request('deleteUserKey', ctx); } }, @@ -20,15 +20,15 @@ module.exports = { return request('listKeys', {}); }, - get: (ctx) => { + get: ctx => { return request('getKey', ctx); }, - create: (ctx) => { + create: ctx => { return request('createKey', ctx); }, - destroy: (ctx) => { + destroy: ctx => { return request('deleteKey', ctx); } } diff --git a/cloudapi-graphql/src/api/machines.js b/cloudapi-graphql/src/api/machines.js index 4532831b..60d99cff 100644 --- a/cloudapi-graphql/src/api/machines.js +++ b/cloudapi-graphql/src/api/machines.js @@ -1,104 +1,104 @@ const request = require('./request'); const snapshots = { - list: (ctx) => { + list: ctx => { return request('listMachineSnapshots', ctx); }, - get: (ctx) => { + get: ctx => { return request('getMachineSnapshot', ctx); }, - create: (ctx) => { + create: ctx => { return request('createMachineSnapshot', ctx); }, - destroy: (ctx) => { + destroy: ctx => { return request('deleteMachineSnapshot', ctx); } }; const metadata = { - list: (ctx) => { + list: ctx => { return request('', ctx); }, - get: (ctx) => { + get: ctx => { return request('', ctx); }, - update: (ctx) => { + update: ctx => { return request('', ctx); }, - destroy: (ctx) => { + destroy: ctx => { return request('', ctx); } }; const firewall = { - enable: (ctx) => { + enable: ctx => { return request('enableMachineFirewall', ctx); }, - disable: (ctx) => { + disable: ctx => { return request('disableMachineFirewall', ctx); } }; const tags = { - list: (ctx) => { + list: ctx => { return request('listMachineTags', ctx); }, - get: (ctx) => { + get: ctx => { return request('getMachineTag', ctx); }, - add: (ctx) => { + add: ctx => { return request('addMachineTags', ctx); }, - replace: (ctx) => { + replace: ctx => { return request('replaceMachineTags', ctx); }, - destroy: (ctx) => { + destroy: ctx => { const method = ctx.tag ? 'deleteMachineTag' : 'deleteMachineTags'; return request(method, ctx); } }; -module.exports.list = (ctx) => { +module.exports.list = ctx => { return request('listMachines', ctx); }; -module.exports.get = (ctx) => { +module.exports.get = ctx => { return request('getMachine', ctx); }; -module.exports.create = (ctx) => { +module.exports.create = ctx => { return request('createMachine', ctx); }; -module.exports.stop = (ctx) => { +module.exports.stop = ctx => { return request('stopMachine', ctx); }; -module.exports.start = (uuid) => { +module.exports.start = uuid => { return request('startMachine', uuid); }; -module.exports.startFromSnapshot = (ctx) => { +module.exports.startFromSnapshot = ctx => { return request('startMachineFromSnapshot', ctx); }; -module.exports.reboot = (ctx) => { +module.exports.reboot = ctx => { return request('rebootMachine', ctx); }; -module.exports.resize = (ctx) => { +module.exports.resize = ctx => { return request('', ctx); }; -module.exports.rename = (ctx) => { +module.exports.rename = ctx => { return request('', ctx); }; -module.exports.destroy = (ctx) => { +module.exports.destroy = ctx => { return request('deleteMachine', ctx); }; -module.exports.audit = (ctx) => { +module.exports.audit = ctx => { return request('machineAudit', ctx); }; diff --git a/cloudapi-graphql/src/api/networks.js b/cloudapi-graphql/src/api/networks.js index 1a153089..047127c8 100644 --- a/cloudapi-graphql/src/api/networks.js +++ b/cloudapi-graphql/src/api/networks.js @@ -4,6 +4,6 @@ module.exports.list = () => { return request('listNetworks'); }; -module.exports.get = (ctx) => { +module.exports.get = ctx => { return request('getNetwork', ctx); }; diff --git a/cloudapi-graphql/src/api/nics.js b/cloudapi-graphql/src/api/nics.js index d64cf87d..34ddca88 100644 --- a/cloudapi-graphql/src/api/nics.js +++ b/cloudapi-graphql/src/api/nics.js @@ -4,6 +4,6 @@ module.exports.list = () => { return request('listNics'); }; -module.exports.get = (ctx) => { +module.exports.get = ctx => { return request('getNic', ctx); }; diff --git a/cloudapi-graphql/src/api/packages.js b/cloudapi-graphql/src/api/packages.js index 425815b1..fd38f7cf 100644 --- a/cloudapi-graphql/src/api/packages.js +++ b/cloudapi-graphql/src/api/packages.js @@ -1,9 +1,9 @@ const request = require('./request'); -module.exports.list = (ctx) => { +module.exports.list = ctx => { return request('listPackages', ctx); }; -module.exports.get = (ctx) => { +module.exports.get = ctx => { return request('getPackage', ctx); }; diff --git a/cloudapi-graphql/src/api/policies.js b/cloudapi-graphql/src/api/policies.js index 205b984d..4ea9b3cc 100644 --- a/cloudapi-graphql/src/api/policies.js +++ b/cloudapi-graphql/src/api/policies.js @@ -1,21 +1,21 @@ const request = require('./request'); -module.exports.list = (ctx) => { +module.exports.list = () => { return request('listPolicies'); }; -module.exports.get = (ctx) => { +module.exports.get = ctx => { return request('getPolicy', ctx); }; -module.exports.create = (ctx) => { +module.exports.create = ctx => { return request('createPolicy', ctx); }; -module.exports.update = (ctx) => { +module.exports.update = ctx => { return request('updatePolicy', ctx); }; -module.exports.destroy = (ctx) => { +module.exports.destroy = ctx => { return request('deletePolicy', ctx); }; diff --git a/cloudapi-graphql/src/api/roles.js b/cloudapi-graphql/src/api/roles.js index 9c9aa82a..c6762f53 100644 --- a/cloudapi-graphql/src/api/roles.js +++ b/cloudapi-graphql/src/api/roles.js @@ -1,18 +1,18 @@ const request = require('./request'); -module.exports.list = (ctx) => { +module.exports.list = () => { return request('listRoles'); }; -module.exports.get = (ctx) => { +module.exports.get = ctx => { return request('getRole', ctx); }; -module.exports.create = (ctx) => { +module.exports.create = ctx => { return request('createRole', ctx); }; -module.exports.set = (ctx) => { +module.exports.set = ctx => { const id = ctx.id ? `/${ctx.id}` : ''; const resource = `/${request.client.account}/${ctx.resource}${id}`; @@ -22,10 +22,10 @@ module.exports.set = (ctx) => { }); }; -module.exports.update = (ctx) => { +module.exports.update = ctx => { return request('updateRole', ctx); }; -module.exports.destroy = (ctx) => { +module.exports.destroy = ctx => { return request('deleteRole', ctx); }; diff --git a/cloudapi-graphql/src/api/users.js b/cloudapi-graphql/src/api/users.js index 9ec8842b..e237c076 100644 --- a/cloudapi-graphql/src/api/users.js +++ b/cloudapi-graphql/src/api/users.js @@ -4,18 +4,18 @@ module.exports.list = () => { return request('listUsers'); }; -module.exports.get = (ctx) => { +module.exports.get = ctx => { return request('getUser', ctx); }; -module.exports.create = (ctx) => { +module.exports.create = ctx => { return request('createUser', ctx); }; -module.exports.destroy = (ctx) => { +module.exports.destroy = ctx => { return request('deleteUser', ctx); }; -module.exports.update = (ctx) => { +module.exports.update = ctx => { return request('updateUser', ctx); }; diff --git a/cloudapi-graphql/src/index.js b/cloudapi-graphql/src/index.js index 5ade8195..fe6e7c17 100644 --- a/cloudapi-graphql/src/index.js +++ b/cloudapi-graphql/src/index.js @@ -4,11 +4,11 @@ const app = express(); app.use('/graphql', require('./endpoint')); -const server = app.listen((err) => { +const server = app.listen(4000, err => { if (err) { - console.log(err); + console.error(err); throw err; } - console.log(`Listening at http://localhost:${server.address().port}`); + console.log(`Listening at http://0.0.0.0:${server.address().port}/graphql`); }); diff --git a/cloudapi-graphql/src/schema/index.js b/cloudapi-graphql/src/schema/index.js index 6a328ec7..a2afba74 100644 --- a/cloudapi-graphql/src/schema/index.js +++ b/cloudapi-graphql/src/schema/index.js @@ -2,9 +2,7 @@ const graphql = require('graphql'); const mutation = require('./mutations'); const query = require('./queries'); -const { - GraphQLSchema -} = graphql; +const { GraphQLSchema } = graphql; module.exports = new GraphQLSchema({ query, diff --git a/cloudapi-graphql/src/schema/mutations/account.js b/cloudapi-graphql/src/schema/mutations/account.js index 9a2374ca..842aa9fd 100644 --- a/cloudapi-graphql/src/schema/mutations/account.js +++ b/cloudapi-graphql/src/schema/mutations/account.js @@ -1,10 +1,7 @@ const AccountType = require('../types/login'); const api = require('../../api'); -const { - GraphQLBoolean, - GraphQLString -} = require('graphql'); +const { GraphQLBoolean, GraphQLString } = require('graphql'); module.exports.updateAccount = { type: AccountType, @@ -45,13 +42,15 @@ module.exports.updateAccount = { } }, resolve: (root, args) => { - return api.account.get().then((account) => { - return api.account.update(Object.assign(account, args, { - firstName: args.first_name || account.firstName, - lastName: args.first_name || account.lastName, - companyName: args.company_name || account.companyName, - postalCode: args.postal_code || account.postalCode - })); + return api.account.get().then(account => { + return api.account.update( + Object.assign(account, args, { + firstName: args.first_name || account.firstName, + lastName: args.first_name || account.lastName, + companyName: args.company_name || account.companyName, + postalCode: args.postal_code || account.postalCode + }) + ); }); } }; diff --git a/cloudapi-graphql/src/schema/mutations/firewall-rules.js b/cloudapi-graphql/src/schema/mutations/firewall-rules.js index e90e4244..5fe77cf9 100644 --- a/cloudapi-graphql/src/schema/mutations/firewall-rules.js +++ b/cloudapi-graphql/src/schema/mutations/firewall-rules.js @@ -1,15 +1,11 @@ const FirewallRuleType = require('../types/firewall-rule'); const api = require('../../api'); -const { - GraphQLID, - GraphQLBoolean, - GraphQLString -} = require('graphql'); +const { GraphQLID, GraphQLBoolean, GraphQLString } = require('graphql'); module.exports.createFirewallRule = { type: FirewallRuleType, - description: 'Adds a new firewall rule for the specified account. This rule will be added to all the account\'s instances where it may be necessary', + description: "Adds a new firewall rule for the specified account. This rule will be added to all the account's instances where it may be necessary", args: { enabled: { type: GraphQLBoolean, diff --git a/cloudapi-graphql/src/schema/mutations/images.js b/cloudapi-graphql/src/schema/mutations/images.js index 49aa29e8..31644e18 100644 --- a/cloudapi-graphql/src/schema/mutations/images.js +++ b/cloudapi-graphql/src/schema/mutations/images.js @@ -47,9 +47,7 @@ module.exports.createImage = { } }, resolve: (root, args) => { - const { - create - } = api.images; + const { create } = api.images; return create(args); } diff --git a/cloudapi-graphql/src/schema/mutations/index.js b/cloudapi-graphql/src/schema/mutations/index.js index b3ce7b63..39f35342 100644 --- a/cloudapi-graphql/src/schema/mutations/index.js +++ b/cloudapi-graphql/src/schema/mutations/index.js @@ -1,6 +1,4 @@ -const { - GraphQLObjectType -} = require('graphql'); +const { GraphQLObjectType } = require('graphql'); module.exports = new GraphQLObjectType({ name: 'RootMutationType', diff --git a/cloudapi-graphql/src/schema/mutations/keys.js b/cloudapi-graphql/src/schema/mutations/keys.js index af90d609..3cff4ecd 100644 --- a/cloudapi-graphql/src/schema/mutations/keys.js +++ b/cloudapi-graphql/src/schema/mutations/keys.js @@ -1,11 +1,7 @@ const KeyType = require('../types/key'); const api = require('../../api'); -const { - GraphQLNonNull, - GraphQLString, - GraphQLID -} = require('graphql'); +const { GraphQLNonNull, GraphQLString, GraphQLID } = require('graphql'); module.exports.createKey = { type: KeyType, diff --git a/cloudapi-graphql/src/schema/mutations/machines.js b/cloudapi-graphql/src/schema/mutations/machines.js index da4cb685..cdfe0627 100644 --- a/cloudapi-graphql/src/schema/mutations/machines.js +++ b/cloudapi-graphql/src/schema/mutations/machines.js @@ -18,7 +18,7 @@ module.exports.createMachine = { type: GraphQLString, description: 'Friendly name for this instance; default is the first 8 characters of the machine id' }, - 'package': { + package: { type: new GraphQLNonNull(GraphQLString), description: 'Id of the package to use on provisioning, obtained from ListPackages' }, @@ -59,14 +59,18 @@ module.exports.createMachine = { const tags = resolveNames(args.tags, 'tag'); const metadata = resolveNames(args.tags, 'metadata'); - const machine = Object.assign({ - name: args.name, - 'package': args['package'], - image: args.image, - networks: args.networks, - locality: args.locality, - firewall_enabled: args.firewall_enabled - }, tags, metadata); + const machine = Object.assign( + { + name: args.name, + package: args['package'], + image: args.image, + networks: args.networks, + locality: args.locality, + firewall_enabled: args.firewall_enabled + }, + tags, + metadata + ); return api.machines.create(machine); } @@ -82,7 +86,7 @@ module.exports.startMachine = { } }, resolve: (root, args) => { - return api.machines.start(args.id).then((machine) => { + return api.machines.start(args.id).then(machine => { if (machine) { return machine; } @@ -106,7 +110,7 @@ module.exports.startMachineFromSnapshot = { } }, resolve: (root, args) => { - return api.machines.startFromSnapshot(args).then((machine) => { + return api.machines.startFromSnapshot(args).then(machine => { if (machine) { return machine; } @@ -126,7 +130,7 @@ module.exports.stopMachine = { } }, resolve: (root, args) => { - return api.machines.stop(args.id).then((machine) => { + return api.machines.stop(args.id).then(machine => { if (machine) { return machine; } @@ -146,7 +150,7 @@ module.exports.rebootMachine = { } }, resolve: (root, args) => { - return api.machines.reboot(args.id).then((machine) => { + return api.machines.reboot(args.id).then(machine => { if (machine) { return machine; } @@ -172,7 +176,7 @@ module.exports.deleteMachine = { module.exports.auditMachine = { type: new GraphQLList(DynamicObjectType), - description: 'Provides a list of an instance\'s accomplished actions. Results are sorted from newest to oldest action', + description: "Provides a list of an instance's accomplished actions. Results are sorted from newest to oldest action", args: { id: { type: new GraphQLNonNull(GraphQLID), @@ -197,13 +201,11 @@ module.exports.setMachineFirewall = { } }, resolve: (root, args) => { - const { - firewall - } = api.machines; + const { firewall } = api.machines; const fn = args.enabled ? firewall.enable : firewall.disable; - return fn(args.id).then((machine) => { + return fn(args.id).then(machine => { if (machine) { return machine; } @@ -223,11 +225,9 @@ module.exports.enableMachineFirewall = { } }, resolve: (root, args) => { - const { - firewall - } = api.machines; + const { firewall } = api.machines; - return firewall.enable(args.id).then((machine) => { + return firewall.enable(args.id).then(machine => { if (machine) { return machine; } @@ -247,11 +247,9 @@ module.exports.disableMachineFirewall = { } }, resolve: (root, args) => { - const { - firewall - } = api.machines; + const { firewall } = api.machines; - return firewall.disable(args.id).then((machine) => { + return firewall.disable(args.id).then(machine => { if (machine) { return machine; } @@ -275,9 +273,7 @@ module.exports.addMachineTags = { } }, resolve: (root, args) => { - const { - tags - } = api.machines; + const { tags } = api.machines; return tags.add(args); } @@ -297,9 +293,7 @@ module.exports.replaceMachineTags = { } }, resolve: (root, args) => { - const { - tags - } = api.machines; + const { tags } = api.machines; return tags.replace(args); } @@ -319,9 +313,7 @@ module.exports.deleteMachineTags = { } }, resolve: (root, args) => { - const { - tags - } = api.machines; + const { tags } = api.machines; return tags.destroy(args); } diff --git a/cloudapi-graphql/src/schema/mutations/roles.js b/cloudapi-graphql/src/schema/mutations/roles.js index 536e31cf..dbdc76d1 100644 --- a/cloudapi-graphql/src/schema/mutations/roles.js +++ b/cloudapi-graphql/src/schema/mutations/roles.js @@ -14,19 +14,19 @@ module.exports.createRole = { args: { name: { type: new GraphQLNonNull(GraphQLString), - description: 'The role\'s name' + description: "The role's name" }, policies: { type: new GraphQLList(GraphQLString), - description: 'This account\'s policies to be given to this role (Optional)' + description: "This account's policies to be given to this role (Optional)" }, members: { type: new GraphQLList(GraphQLString), - description: 'This account\'s user logins to be added to this role (Optional)' + description: "This account's user logins to be added to this role (Optional)" }, default_members: { type: new GraphQLList(GraphQLString), - description: 'This account\'s user logins to be added to this role and have it enabled by default (Optional)' + description: "This account's user logins to be added to this role and have it enabled by default (Optional)" } }, resolve: (root, args) => { @@ -43,19 +43,19 @@ module.exports.updateRole = { }, name: { type: GraphQLString, - description: 'The role\'s name' + description: "The role's name" }, policies: { type: new GraphQLList(GraphQLString), - description: 'This account\'s policies to be given to this role (Optional)' + description: "This account's policies to be given to this role (Optional)" }, members: { type: new GraphQLList(GraphQLString), - description: 'This account\'s user logins to be added to this role (Optional)' + description: "This account's user logins to be added to this role (Optional)" }, default_members: { type: new GraphQLList(GraphQLString), - description: 'This account\'s user logins to be added to this role and have it enabled by default (Optional)' + description: "This account's user logins to be added to this role and have it enabled by default (Optional)" } }, resolve: (root, args) => { @@ -80,7 +80,7 @@ module.exports.deleteRole = { module.exports.setRoleTags = { type: RoleType.tag, - description: 'Sets the given role tags to the provided resource path. resource_path can be the path to any of the CloudAPI resources described in this document: account, keys, users, roles, policies, user\'s ssh keys, datacenters, images, packages, instances, analytics, instrumentations, firewall rules and networks.', + description: "Sets the given role tags to the provided resource path. resource_path can be the path to any of the CloudAPI resources described in this document: account, keys, users, roles, policies, user's ssh keys, datacenters, images, packages, instances, analytics, instrumentations, firewall rules and networks.", args: { resource: { type: new GraphQLNonNull(GraphQLString), @@ -96,9 +96,7 @@ module.exports.setRoleTags = { } }, resolve: (root, args) => { - const { - set - } = api.roles; + const { set } = api.roles; return set(args); } diff --git a/cloudapi-graphql/src/schema/mutations/snapshots.js b/cloudapi-graphql/src/schema/mutations/snapshots.js index 5842795f..e9cadbf3 100644 --- a/cloudapi-graphql/src/schema/mutations/snapshots.js +++ b/cloudapi-graphql/src/schema/mutations/snapshots.js @@ -1,11 +1,7 @@ const SnapshotType = require('../types/snapshot'); const api = require('../../api'); -const { - GraphQLNonNull, - GraphQLString, - GraphQLID -} = require('graphql'); +const { GraphQLNonNull, GraphQLString, GraphQLID } = require('graphql'); module.exports.createSnapshot = { type: SnapshotType, @@ -21,19 +17,14 @@ module.exports.createSnapshot = { } }, resolve: (root, args) => { - const { - snapshot: { - create, - get - } - } = api.machines; + const { snapshot: { create, get } } = api.machines; const newArgs = { id: args.machine, name: args.name }; - return create(newArgs).then((snapshot) => { + return create(newArgs).then(snapshot => { if (snapshot) { return snapshot; } @@ -57,11 +48,7 @@ module.exports.deleteSnapshot = { } }, resolve: (root, args) => { - const { - snapshot: { - destroy - } - } = api.machines; + const { snapshot: { destroy } } = api.machines; const newArgs = { id: args.machine, diff --git a/cloudapi-graphql/src/schema/mutations/users.js b/cloudapi-graphql/src/schema/mutations/users.js index 02e9cb6c..3f14c6df 100644 --- a/cloudapi-graphql/src/schema/mutations/users.js +++ b/cloudapi-graphql/src/schema/mutations/users.js @@ -1,11 +1,7 @@ const UserType = require('../types/login'); const api = require('../../api'); -const { - GraphQLNonNull, - GraphQLString, - GraphQLID -} = require('graphql'); +const { GraphQLNonNull, GraphQLString, GraphQLID } = require('graphql'); module.exports.createUser = { type: UserType, @@ -49,12 +45,14 @@ module.exports.createUser = { } }, resolve: (root, args) => { - return api.users.create(Object.assign(args, { - firstName: args.first_name, - lastName: args.first_name, - companyName: args.company_name, - postalCode: args.postal_code - })); + return api.users.create( + Object.assign(args, { + firstName: args.first_name, + lastName: args.first_name, + companyName: args.company_name, + postalCode: args.postal_code + }) + ); } }; @@ -75,7 +73,7 @@ module.exports.deleteUser = { module.exports.updateUser = { type: UserType, - description: 'Update a user\'s modifiable properties', + description: "Update a user's modifiable properties", args: { id: { type: new GraphQLNonNull(GraphQLID) @@ -115,12 +113,14 @@ module.exports.updateUser = { } }, resolve: (root, args) => { - return api.users.update(Object.assign(args, { - firstName: args.first_name, - lastName: args.first_name, - companyName: args.company_name, - postalCode: args.postal_code - })); + return api.users.update( + Object.assign(args, { + firstName: args.first_name, + lastName: args.first_name, + companyName: args.company_name, + postalCode: args.postal_code + }) + ); } }; diff --git a/cloudapi-graphql/src/schema/queries/account.js b/cloudapi-graphql/src/schema/queries/account.js index 61b9b5fe..30347e72 100644 --- a/cloudapi-graphql/src/schema/queries/account.js +++ b/cloudapi-graphql/src/schema/queries/account.js @@ -4,7 +4,7 @@ const api = require('../../api'); module.exports = { type: AccountType, resolve() { - return api.account.get().then((account) => { + return api.account.get().then(account => { return Object.assign(account, { isUser: false }); diff --git a/cloudapi-graphql/src/schema/queries/datacenters.js b/cloudapi-graphql/src/schema/queries/datacenters.js index f62646b3..81776caf 100644 --- a/cloudapi-graphql/src/schema/queries/datacenters.js +++ b/cloudapi-graphql/src/schema/queries/datacenters.js @@ -2,15 +2,13 @@ const DatacenterType = require('../types/datacenter'); const graphql = require('graphql'); const api = require('../../api'); -const { - GraphQLList -} = graphql; +const { GraphQLList } = graphql; module.exports = { type: new GraphQLList(DatacenterType), resolve() { - return api.datacenters().then((datacenters) => { - return Object.keys(datacenters).map((name) => { + return api.datacenters().then(datacenters => { + return Object.keys(datacenters).map(name => { return { url: datacenters[name], name diff --git a/cloudapi-graphql/src/schema/queries/fabrics.js b/cloudapi-graphql/src/schema/queries/fabrics.js index 95b635e8..fa09c227 100644 --- a/cloudapi-graphql/src/schema/queries/fabrics.js +++ b/cloudapi-graphql/src/schema/queries/fabrics.js @@ -2,9 +2,7 @@ const FabricType = require('../types/fabrics'); const graphql = require('graphql'); const api = require('../../api'); -const { - GraphQLList -} = graphql; +const { GraphQLList } = graphql; module.exports = { type: new GraphQLList(FabricType), diff --git a/cloudapi-graphql/src/schema/queries/firewall-rules.js b/cloudapi-graphql/src/schema/queries/firewall-rules.js index 50ae70a6..1cc72a50 100644 --- a/cloudapi-graphql/src/schema/queries/firewall-rules.js +++ b/cloudapi-graphql/src/schema/queries/firewall-rules.js @@ -2,10 +2,7 @@ const FirewallRuleType = require('../types/firewall-rule'); const graphql = require('graphql'); const api = require('../../api'); -const { - GraphQLList, - GraphQLID -} = graphql; +const { GraphQLList, GraphQLID } = graphql; module.exports = { type: new GraphQLList(FirewallRuleType), @@ -16,11 +13,8 @@ module.exports = { } }, resolve(root, args) { - const { - list, - get - } = api.firewallRules; + const { list, get } = api.firewallRules; - return !args.id ? list() : get(args.id).then((rule) => [rule]); + return !args.id ? list() : get(args.id).then(rule => [rule]); } }; diff --git a/cloudapi-graphql/src/schema/queries/images.js b/cloudapi-graphql/src/schema/queries/images.js index c33ac548..116dc016 100644 --- a/cloudapi-graphql/src/schema/queries/images.js +++ b/cloudapi-graphql/src/schema/queries/images.js @@ -2,12 +2,7 @@ const ImageType = require('../types/image'); const graphql = require('graphql'); const api = require('../../api'); -const { - GraphQLList, - GraphQLBoolean, - GraphQLString, - GraphQLID -} = graphql; +const { GraphQLList, GraphQLBoolean, GraphQLString, GraphQLID } = graphql; module.exports = { type: new GraphQLList(ImageType), @@ -28,7 +23,7 @@ module.exports = { type: GraphQLString, description: 'Filter on the version' }, - 'public': { + public: { type: GraphQLBoolean, description: 'Filter public/private images' }, @@ -46,13 +41,12 @@ module.exports = { } }, resolve(root, args) { - const { - list, - get - } = api.images; + const { list, get } = api.images; - return args.id ? get({ - id: args.id - }).then((img) => [img]) : list(args); + return args.id + ? get({ + id: args.id + }).then(img => [img]) + : list(args); } }; diff --git a/cloudapi-graphql/src/schema/queries/index.js b/cloudapi-graphql/src/schema/queries/index.js index 1cd08897..b5f5a3b6 100644 --- a/cloudapi-graphql/src/schema/queries/index.js +++ b/cloudapi-graphql/src/schema/queries/index.js @@ -1,6 +1,4 @@ -const { - GraphQLObjectType -} = require('graphql'); +const { GraphQLObjectType } = require('graphql'); module.exports = new GraphQLObjectType({ name: 'RootQueryType', diff --git a/cloudapi-graphql/src/schema/queries/machines.js b/cloudapi-graphql/src/schema/queries/machines.js index 36bf7c6a..186904a5 100644 --- a/cloudapi-graphql/src/schema/queries/machines.js +++ b/cloudapi-graphql/src/schema/queries/machines.js @@ -2,12 +2,7 @@ const MachineType = require('../types/machine'); const graphql = require('graphql'); const api = require('../../api'); -const { - GraphQLInt, - GraphQLList, - GraphQLString, - GraphQLID -} = graphql; +const { GraphQLInt, GraphQLList, GraphQLString, GraphQLID } = graphql; module.exports = { type: new GraphQLList(MachineType), @@ -60,24 +55,20 @@ module.exports = { description: 'Whether to include the generated credentials for instances, if present. Defaults to false' } }, - resolve(root, args, ctx) { - const { - list, - get - } = api.machines; + resolve(root, args) { + const { list, get } = api.machines; - const { - after, - first - } = args; + const { after, first } = args; const newArgs = Object.assign(args, { limit: first, offset: after }); - return args.id ? get({ - id: args.id - }).then((machine) => [machine]) : list(newArgs); + return args.id + ? get({ + id: args.id + }).then(machine => [machine]) + : list(newArgs); } }; diff --git a/cloudapi-graphql/src/schema/queries/networks.js b/cloudapi-graphql/src/schema/queries/networks.js index ce0e5312..d8d9643c 100644 --- a/cloudapi-graphql/src/schema/queries/networks.js +++ b/cloudapi-graphql/src/schema/queries/networks.js @@ -2,10 +2,7 @@ const NetworkType = require('../types/network'); const graphql = require('graphql'); const api = require('../../api'); -const { - GraphQLList, - GraphQLID -} = graphql; +const { GraphQLList, GraphQLID } = graphql; module.exports = { type: new GraphQLList(NetworkType), @@ -15,11 +12,8 @@ module.exports = { } }, resolve(root, args) { - const { - list, - get - } = api.networks; + const { list, get } = api.networks; - return !args.id ? list() : get(args).then((network) => [network]); + return !args.id ? list() : get(args).then(network => [network]); } }; diff --git a/cloudapi-graphql/src/schema/queries/nics.js b/cloudapi-graphql/src/schema/queries/nics.js index c1fcc1f3..97d44fa7 100644 --- a/cloudapi-graphql/src/schema/queries/nics.js +++ b/cloudapi-graphql/src/schema/queries/nics.js @@ -2,10 +2,7 @@ const NicType = require('../types/nic'); const graphql = require('graphql'); const api = require('../../api'); -const { - GraphQLList, - GraphQLString -} = graphql; +const { GraphQLList, GraphQLString } = graphql; module.exports = { type: new GraphQLList(NicType), @@ -15,11 +12,8 @@ module.exports = { } }, resolve(root, args) { - const { - list, - get - } = api.nics; + const { list, get } = api.nics; - return !args.id ? list() : get(args).then((nic) => [nic]); + return !args.id ? list() : get(args).then(nic => [nic]); } }; diff --git a/cloudapi-graphql/src/schema/queries/packages.js b/cloudapi-graphql/src/schema/queries/packages.js index 645a0858..c516c127 100644 --- a/cloudapi-graphql/src/schema/queries/packages.js +++ b/cloudapi-graphql/src/schema/queries/packages.js @@ -2,12 +2,7 @@ const PackageType = require('../types/package'); const graphql = require('graphql'); const api = require('../../api'); -const { - GraphQLInt, - GraphQLList, - GraphQLString, - GraphQLID -} = graphql; +const { GraphQLInt, GraphQLList, GraphQLString, GraphQLID } = graphql; module.exports = { type: new GraphQLList(PackageType), @@ -50,13 +45,12 @@ module.exports = { } }, resolve(root, args) { - const { - list, - get - } = api.packages; + const { list, get } = api.packages; - return args.id ? get({ - id: args.id - }).then((pkg) => [pkg]) : list(args); + return args.id + ? get({ + id: args.id + }).then(pkg => [pkg]) + : list(args); } }; diff --git a/cloudapi-graphql/src/schema/queries/policies.js b/cloudapi-graphql/src/schema/queries/policies.js index ca72d1ae..4beb94d0 100644 --- a/cloudapi-graphql/src/schema/queries/policies.js +++ b/cloudapi-graphql/src/schema/queries/policies.js @@ -2,10 +2,7 @@ const PolicyType = require('../types/policy'); const graphql = require('graphql'); const api = require('../../api'); -const { - GraphQLList, - GraphQLID -} = graphql; +const { GraphQLList, GraphQLID } = graphql; module.exports = { type: new GraphQLList(PolicyType), @@ -16,11 +13,8 @@ module.exports = { } }, resolve(root, args) { - const { - list, - get - } = api.policies; + const { list, get } = api.policies; - return !args.id ? list() : get(args).then((policy) => [policy]); + return !args.id ? list() : get(args).then(policy => [policy]); } }; diff --git a/cloudapi-graphql/src/schema/queries/roles.js b/cloudapi-graphql/src/schema/queries/roles.js index 965e1bf1..3e8b9032 100644 --- a/cloudapi-graphql/src/schema/queries/roles.js +++ b/cloudapi-graphql/src/schema/queries/roles.js @@ -2,10 +2,7 @@ const RoleType = require('../types/role'); const graphql = require('graphql'); const api = require('../../api'); -const { - GraphQLList, - GraphQLID -} = graphql; +const { GraphQLList, GraphQLID } = graphql; module.exports = { type: new GraphQLList(RoleType), @@ -16,11 +13,8 @@ module.exports = { } }, resolve(root, args) { - const { - list, - get - } = api.roles; + const { list, get } = api.roles; - return !args.id ? list() : get(args).then((role) => [role]); + return !args.id ? list() : get(args).then(role => [role]); } }; diff --git a/cloudapi-graphql/src/schema/queries/services.js b/cloudapi-graphql/src/schema/queries/services.js index 709ba79f..70658fff 100644 --- a/cloudapi-graphql/src/schema/queries/services.js +++ b/cloudapi-graphql/src/schema/queries/services.js @@ -2,15 +2,13 @@ const ServiceType = require('../types/service'); const graphql = require('graphql'); const api = require('../../api'); -const { - GraphQLList -} = graphql; +const { GraphQLList } = graphql; module.exports = { type: new GraphQLList(ServiceType), resolve() { - return api.services().then((services) => { - return Object.keys(services).map((name) => { + return api.services().then(services => { + return Object.keys(services).map(name => { return { url: services[name], name diff --git a/cloudapi-graphql/src/schema/queries/users.js b/cloudapi-graphql/src/schema/queries/users.js index 698cfb41..a0da6dc7 100644 --- a/cloudapi-graphql/src/schema/queries/users.js +++ b/cloudapi-graphql/src/schema/queries/users.js @@ -2,10 +2,7 @@ const UserType = require('../types/login'); const graphql = require('graphql'); const api = require('../../api'); -const { - GraphQLList, - GraphQLID -} = graphql; +const { GraphQLList, GraphQLID } = graphql; module.exports = { type: new GraphQLList(UserType), @@ -15,16 +12,15 @@ module.exports = { description: '`id` or `login` of the `UserType` to filter' } }, - resolve(root, args, ctx) { - const { - list, - get - } = api.users; + resolve(root, args) { + const { list, get } = api.users; - return !args.id ? list() : get(args).then((user) => [user]).then((user) => { - return Object.assign(user, { - isUser: true - }); - }); + return !args.id + ? list() + : get(args).then(user => [user]).then(user => { + return Object.assign(user, { + isUser: true + }); + }); } }; diff --git a/cloudapi-graphql/src/schema/types/audit.js b/cloudapi-graphql/src/schema/types/audit.js index 5d044b78..5ac4794a 100644 --- a/cloudapi-graphql/src/schema/types/audit.js +++ b/cloudapi-graphql/src/schema/types/audit.js @@ -1,10 +1,6 @@ const DynamicObjectType = require('./dynamic-object'); -const { - GraphQLString, - GraphQLObjectType, - GraphQLBoolean -} = require('graphql'); +const { GraphQLString, GraphQLObjectType, GraphQLBoolean } = require('graphql'); const CallerType = new GraphQLObjectType({ name: 'CallerType', @@ -41,8 +37,8 @@ module.exports = new GraphQLObjectType({ }, success: { type: GraphQLBoolean, - description: '`true` or `false`, depending on the action\'s success', - resolve: (root) => { + description: "`true` or `false`, depending on the action's success", + resolve: root => { return root.success === 'yes'; } }, diff --git a/cloudapi-graphql/src/schema/types/datacenter.js b/cloudapi-graphql/src/schema/types/datacenter.js index febf5d8f..63518ee9 100644 --- a/cloudapi-graphql/src/schema/types/datacenter.js +++ b/cloudapi-graphql/src/schema/types/datacenter.js @@ -1,7 +1,4 @@ -const { - GraphQLString, - GraphQLObjectType -} = require('graphql'); +const { GraphQLString, GraphQLObjectType } = require('graphql'); module.exports = new GraphQLObjectType({ name: 'DatacenterType', diff --git a/cloudapi-graphql/src/schema/types/dynamic-object.js b/cloudapi-graphql/src/schema/types/dynamic-object.js index 4f48cd0e..afce3f7e 100644 --- a/cloudapi-graphql/src/schema/types/dynamic-object.js +++ b/cloudapi-graphql/src/schema/types/dynamic-object.js @@ -1,22 +1,19 @@ -const { - GraphQLScalarType, - Kind -} = require('graphql'); +const { GraphQLScalarType, Kind } = require('graphql'); const kinds = { - [Kind.STRING]: (ast) => { + [Kind.STRING]: ast => { return ast.value; }, - [Kind.BOOLEAN]: (ast) => { + [Kind.BOOLEAN]: ast => { return kinds[Kind.STRING](ast); }, - [Kind.INT]: (ast) => { + [Kind.INT]: ast => { return Number(ast.value); }, - [Kind.FLOAT]: (ast) => { + [Kind.FLOAT]: ast => { return kinds[Kind.INT](ast); }, - [Kind.OBJECT]: (ast) => { + [Kind.OBJECT]: ast => { const value = Object.create(null); ast.fields.forEach(field => { value[field.name.value] = parseLiteral(field.value); @@ -24,13 +21,13 @@ const kinds = { return value; }, - [Kind.LIST]: (ast) => { + [Kind.LIST]: ast => { return ast.values.map(parseLiteral); } }; // https://github.com/taion/graphql-type-json/blob/master/src/index.js -const parseLiteral = (ast) => { +const parseLiteral = ast => { const kind = kinds[ast.kind]; return kind ? kinds[ast.kind](ast) : null; }; diff --git a/cloudapi-graphql/src/schema/types/fabric.js b/cloudapi-graphql/src/schema/types/fabric.js index 13e9af6c..cf195860 100644 --- a/cloudapi-graphql/src/schema/types/fabric.js +++ b/cloudapi-graphql/src/schema/types/fabric.js @@ -1,8 +1,4 @@ -const { - GraphQLString, - GraphQLObjectType, - GraphQLInt -} = require('graphql'); +const { GraphQLString, GraphQLObjectType, GraphQLInt } = require('graphql'); module.exports = new GraphQLObjectType({ name: 'FabricsType', @@ -13,7 +9,7 @@ module.exports = new GraphQLObjectType({ }, vlan_id: { type: GraphQLInt, - description: 'A number from 0-4095 that indicates the VLAN\'s id' + description: "A number from 0-4095 that indicates the VLAN's id" }, description: { type: GraphQLString, diff --git a/cloudapi-graphql/src/schema/types/firewall-rule.js b/cloudapi-graphql/src/schema/types/firewall-rule.js index 6981af29..d7383f39 100644 --- a/cloudapi-graphql/src/schema/types/firewall-rule.js +++ b/cloudapi-graphql/src/schema/types/firewall-rule.js @@ -15,10 +15,10 @@ const FirewallRuleSyntaxType = new GraphQLObjectType({ text: { type: GraphQLString }, - 'from': { + from: { type: GraphQLString }, - 'to': { + to: { type: GraphQLString }, action: { @@ -44,22 +44,20 @@ module.exports = new GraphQLObjectType({ enabled: { type: GraphQLBoolean, description: 'Indicates if the rule is enabled', - resolve: (root) => { + resolve: root => { return !!root.enabled; } }, rule: { type: FirewallRuleSyntaxType, description: 'Firewall rule', - resolve: ({ - rule - }) => { + resolve: ({ rule }) => { const regex = /from (.*?) to (.*?) (allow|deny) (.*?) port (\d*)/i; const tokens = rule.match(regex); return { - 'from': tokens[1], - 'to': tokens[2], + from: tokens[1], + to: tokens[2], action: tokens[3], protocol: tokens[4], port: tokens[5], @@ -70,7 +68,7 @@ module.exports = new GraphQLObjectType({ global: { type: GraphQLBoolean, description: 'Indicates if the rule is global', - resolve: (root) => { + resolve: root => { return !!root.global; } }, @@ -82,7 +80,7 @@ module.exports = new GraphQLObjectType({ // circular dependency type: new GraphQLList(require('./machine')), description: 'Lists all instances a firewall rule is applied to', - resolve: (root) => { + resolve: root => { return api.firewallRules.listMachines({ id: root.id }); diff --git a/cloudapi-graphql/src/schema/types/image.js b/cloudapi-graphql/src/schema/types/image.js index e6ad6ca0..f2df2616 100644 --- a/cloudapi-graphql/src/schema/types/image.js +++ b/cloudapi-graphql/src/schema/types/image.js @@ -85,10 +85,10 @@ module.exports = new GraphQLObjectType({ type: GraphQLString, description: 'The UUID of the user who owns this image' }, - 'public': { + public: { type: GraphQLBoolean, description: 'Indicates if this image is publicly available', - resolve: (root) => { + resolve: root => { return !!root['public']; } }, diff --git a/cloudapi-graphql/src/schema/types/key.js b/cloudapi-graphql/src/schema/types/key.js index e117073f..6937832c 100644 --- a/cloudapi-graphql/src/schema/types/key.js +++ b/cloudapi-graphql/src/schema/types/key.js @@ -1,7 +1,4 @@ -const { - GraphQLString, - GraphQLObjectType -} = require('graphql'); +const { GraphQLString, GraphQLObjectType } = require('graphql'); module.exports = new GraphQLObjectType({ name: 'KeyType', diff --git a/cloudapi-graphql/src/schema/types/login.js b/cloudapi-graphql/src/schema/types/login.js index 16cb31d4..b6fa9ba7 100644 --- a/cloudapi-graphql/src/schema/types/login.js +++ b/cloudapi-graphql/src/schema/types/login.js @@ -26,19 +26,19 @@ module.exports = new GraphQLObjectType({ }, company_name: { type: GraphQLString, - resolve: (root) => { + resolve: root => { return !!root.company_name || root.companyName; } }, first_name: { type: GraphQLString, - resolve: (root) => { + resolve: root => { return !!root.first_name || root.firstName; } }, last_name: { type: GraphQLString, - resolve: (root) => { + resolve: root => { return !!root.last_name || root.lastName; } }, @@ -47,7 +47,7 @@ module.exports = new GraphQLObjectType({ }, postal_code: { type: GraphQLString, - resolve: (root) => { + resolve: root => { return !!root.postal_code || root.postalCode; } }, @@ -66,7 +66,7 @@ module.exports = new GraphQLObjectType({ cns_enabled: { type: GraphQLBoolean, description: 'true if Triton CNS is enabled for account', - resolve: (root) => { + resolve: root => { return root.isUser ? null : !!root.triton_cns_enabled; } }, @@ -86,22 +86,19 @@ module.exports = new GraphQLObjectType({ resolve(root, args) { const _api = root.isUser ? api.keys.user : api.keys.account; - const { - list, - get - } = _api; + const { list, get } = _api; const newArgs = Object.assign(args, { userId: root.id }); const filtered = args.name || args.fingerprint; - return !filtered ? list(newArgs) : get(newArgs).then((key) => [key]); + return !filtered ? list(newArgs) : get(newArgs).then(key => [key]); } }, updated: { type: GraphQLString, - description: 'When this user/account\'s details was last updated' + description: "When this user/account's details was last updated" }, created: { type: GraphQLString, diff --git a/cloudapi-graphql/src/schema/types/machine.js b/cloudapi-graphql/src/schema/types/machine.js index 57506b8e..9fe9a90e 100644 --- a/cloudapi-graphql/src/schema/types/machine.js +++ b/cloudapi-graphql/src/schema/types/machine.js @@ -59,20 +59,18 @@ module.exports = new GraphQLObjectType({ } }, resolve: (root, args) => { - const { - tags: { - get - } - } = api.machines; + const { tags: { get } } = api.machines; - return !args.name ? root.tags : get({ - id: root.id, - tag: args.name - }).then((value) => { - return { - [args.name]: value - }; - }); + return !args.name + ? root.tags + : get({ + id: root.id, + tag: args.name + }).then(value => { + return { + [args.name]: value + }; + }); } }, created: { @@ -81,12 +79,12 @@ module.exports = new GraphQLObjectType({ }, updated: { type: GraphQLString, - description: 'When this instance\'s details was last updated' + description: "When this instance's details was last updated" }, docker: { type: GraphQLBoolean, description: 'Whether this instance is a Docker container, if present', - resolve: (root) => { + resolve: root => { return !!root.docker; } }, @@ -105,7 +103,7 @@ module.exports = new GraphQLObjectType({ firewall_enabled: { type: GraphQLBoolean, description: 'Whether firewall rules are enforced on this instance', - resolve: (root) => { + resolve: root => { return !!root.firewall_enabled; } }, @@ -113,7 +111,7 @@ module.exports = new GraphQLObjectType({ // circular dependency type: new GraphQLList(require('./firewall-rule')), description: 'List of FirewallRules affecting this machine', - resolve: (root) => { + resolve: root => { return api.firewallRules.listByMachine(root.id); } }, @@ -121,7 +119,7 @@ module.exports = new GraphQLObjectType({ type: GraphQLString, description: 'UUID of the server on which the instance is located' }, - 'package': { + package: { type: GraphQLString, description: 'The id or name of the package used to create this instance' }, @@ -135,17 +133,14 @@ module.exports = new GraphQLObjectType({ } }, resolve: (root, args) => { - const { - snapshot: { - list, - get - } - } = api.machines; + const { snapshot: { list, get } } = api.machines; - return !args.id ? list(root) : get({ - id: root.id, - name: args.name - }); + return !args.id + ? list(root) + : get({ + id: root.id, + name: args.name + }); } } }) diff --git a/cloudapi-graphql/src/schema/types/network.js b/cloudapi-graphql/src/schema/types/network.js index e45a5721..97e47da6 100644 --- a/cloudapi-graphql/src/schema/types/network.js +++ b/cloudapi-graphql/src/schema/types/network.js @@ -20,17 +20,17 @@ module.exports = new GraphQLObjectType({ type: GraphQLString, description: 'The network name' }, - 'public': { + public: { type: GraphQLBoolean, description: 'Whether this a public or private (rfc1918) network', - resolve: (root) => { + resolve: root => { return !!root['public']; } }, fabric: { type: GraphQLBoolean, description: 'Whether this network is created on a fabric', - resolve: (root) => { + resolve: root => { return !!root.fabric; } }, @@ -65,7 +65,7 @@ module.exports = new GraphQLObjectType({ internet_nat: { type: GraphQLBoolean, description: 'Provision internet NAT zone on gateway address', - resolve: (root) => { + resolve: root => { return !!root.internet_nat; } } diff --git a/cloudapi-graphql/src/schema/types/nic.js b/cloudapi-graphql/src/schema/types/nic.js index 7c894aa3..7cae5e1a 100644 --- a/cloudapi-graphql/src/schema/types/nic.js +++ b/cloudapi-graphql/src/schema/types/nic.js @@ -1,8 +1,4 @@ -const { - GraphQLBoolean, - GraphQLObjectType, - GraphQLString -} = require('graphql'); +const { GraphQLBoolean, GraphQLObjectType, GraphQLString } = require('graphql'); module.exports = new GraphQLObjectType({ name: 'NicType', @@ -10,16 +6,16 @@ module.exports = new GraphQLObjectType({ fields: { ip: { type: GraphQLString, - description: 'NIC\'s IPv4 address' + description: "NIC's IPv4 address" }, mac: { type: GraphQLString, - description: 'NIC\'s MAC address' + description: "NIC's MAC address" }, primary: { type: GraphQLBoolean, - description: 'Whether this is the instance\'s primary NIC', - resolve: (root) => { + description: "Whether this is the instance's primary NIC", + resolve: root => { return root.primary; } }, @@ -37,7 +33,7 @@ module.exports = new GraphQLObjectType({ }, network: { type: GraphQLString, - description: 'The NIC\'s network id (see ListNetworks)' + description: "The NIC's network id (see ListNetworks)" } } }); diff --git a/cloudapi-graphql/src/schema/types/role.js b/cloudapi-graphql/src/schema/types/role.js index 1cc62fca..8fe5e290 100644 --- a/cloudapi-graphql/src/schema/types/role.js +++ b/cloudapi-graphql/src/schema/types/role.js @@ -19,15 +19,15 @@ module.exports = new GraphQLObjectType({ }, policies: { type: new GraphQLList(GraphQLString), - description: 'This account\'s policies which this role obeys (Optional)' + description: "This account's policies which this role obeys (Optional)" }, members: { type: new GraphQLList(GraphQLString), - description: 'This account\'s user logins this role applies to (Optional)' + description: "This account's user logins this role applies to (Optional)" }, default_members: { type: new GraphQLList(GraphQLString), - description: 'This account\'s user logins this role applies to by default (Optional)' + description: "This account's user logins this role applies to by default (Optional)" } } }); @@ -42,7 +42,7 @@ module.exports.tag = new GraphQLObjectType({ role_tag: { type: new GraphQLList(GraphQLString), description: 'The role name', - resolve: (root) => { + resolve: root => { return root['role-tag'] || root.role_tag; } } diff --git a/cloudapi-graphql/src/schema/types/service.js b/cloudapi-graphql/src/schema/types/service.js index feabcae1..09f9ebe6 100644 --- a/cloudapi-graphql/src/schema/types/service.js +++ b/cloudapi-graphql/src/schema/types/service.js @@ -1,7 +1,4 @@ -const { - GraphQLString, - GraphQLObjectType -} = require('graphql'); +const { GraphQLString, GraphQLObjectType } = require('graphql'); module.exports = new GraphQLObjectType({ name: 'ServiceType', diff --git a/cloudapi-graphql/src/schema/types/snapshot.js b/cloudapi-graphql/src/schema/types/snapshot.js index 106bd137..f69222c3 100644 --- a/cloudapi-graphql/src/schema/types/snapshot.js +++ b/cloudapi-graphql/src/schema/types/snapshot.js @@ -1,8 +1,4 @@ -const { - GraphQLString, - GraphQLObjectType, - GraphQLID -} = require('graphql'); +const { GraphQLString, GraphQLObjectType, GraphQLID } = require('graphql'); module.exports = new GraphQLObjectType({ name: 'SnapshotType', diff --git a/cloudapi-graphql/yarn.lock b/cloudapi-graphql/yarn.lock index 3e2bd9b9..774d2af2 100644 --- a/cloudapi-graphql/yarn.lock +++ b/cloudapi-graphql/yarn.lock @@ -65,8 +65,8 @@ ajv-keywords@^1.0.0: resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" ajv@^4.7.0, ajv@^4.9.1: - version "4.11.6" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.6.tgz#947e93049790942b2a2d60a8289b28924d39f987" + version "4.11.7" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.7.tgz#8655a5d86d0824985cc471a1d913fb6729a0ec48" dependencies: co "^4.6.0" json-stable-stringify "^1.0.1" @@ -133,11 +133,11 @@ archy@^1.0.0: resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" are-we-there-yet@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.2.tgz#80e470e95a084794fe1899262c5667c6e88de1b3" + version "1.1.4" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz#bb5dca382bb94f05e15194373d16fd3ba1ca110d" dependencies: delegates "^1.0.0" - readable-stream "^2.0.0 || ^1.1.13" + readable-stream "^2.0.6" argparse@^1.0.7: version "1.0.9" @@ -156,8 +156,8 @@ arr-exclude@^1.0.0: resolved "https://registry.yarnpkg.com/arr-exclude/-/arr-exclude-1.0.0.tgz#dfc7c2e552a270723ccda04cf3128c8cbfe5c631" arr-flatten@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.0.1.tgz#e5ffe54d45e19f32f216e91eb99c8ce892bb604b" + version "1.0.3" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.0.3.tgz#a274ed85ac08849b6bd7847c4580745dc51adfb1" array-differ@^1.0.0: version "1.0.0" @@ -205,6 +205,10 @@ assert-plus@^1.0.0, assert-plus@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" +ast-types@0.9.8: + version "0.9.8" + resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.8.tgz#6cb6a40beba31f49f20928e28439fc14a3dab078" + async-each@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" @@ -322,7 +326,7 @@ aws4@^1.2.1: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" -babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: +babel-code-frame@^6.16.0, babel-code-frame@^6.22.0, babel-code-frame@6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" dependencies: @@ -609,8 +613,12 @@ babel-types@^6.18.0, babel-types@^6.24.1: to-fast-properties "^1.0.1" babylon@^6.1.0, babylon@^6.11.0, babylon@^6.13.0, babylon@^6.15.0: - version "6.16.1" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.16.1.tgz#30c5a22f481978a9e7f8cdfdf496b11d94b404d3" + version "6.17.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.0.tgz#37da948878488b9c4e3c4038893fa3314b3fc932" + +babylon@7.0.0-beta.8: + version "7.0.0-beta.8" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.8.tgz#2bdc5ae366041442c27e068cce6f0d7c06ea9949" backoff@^2.4.1: version "2.5.0" @@ -693,7 +701,7 @@ buffer-shims@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" -builtin-modules@^1.0.0, builtin-modules@^1.1.1: +builtin-modules@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -795,7 +803,7 @@ chalk@^0.4.0: has-color "~0.1.0" strip-ansi "~0.1.0" -chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: +chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3, chalk@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" dependencies: @@ -968,10 +976,6 @@ console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" -contains-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" - content-disposition@0.5.2: version "0.5.2" resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.2.tgz#0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4" @@ -1073,17 +1077,11 @@ debug-log@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f" -debug@^2.1.1, debug@^2.2.0, debug@2.6.3: - version "2.6.3" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.3.tgz#0f7eb8c30965ec08c72accfa0130c8b79984141d" +debug@^2.1.1, debug@^2.2.0: + version "2.6.5" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.5.tgz#7a76247781acd4ef2a85f0fb8abf763cd1af249e" dependencies: - ms "0.7.2" - -debug@2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" - dependencies: - ms "0.7.1" + ms "0.7.3" debug@2.6.1: version "2.6.1" @@ -1091,6 +1089,12 @@ debug@2.6.1: dependencies: ms "0.7.2" +debug@2.6.4: + version "2.6.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.4.tgz#7586a9b3c39741c0282ae33445c4e8ac74734fe0" + dependencies: + ms "0.7.3" + decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -1162,13 +1166,6 @@ doctrine@^2.0.0: esutils "^2.0.2" isarray "^1.0.0" -doctrine@1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" - dependencies: - esutils "^2.0.2" - isarray "^1.0.0" - dot-prop@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.1.1.tgz#a8493f0b7b5eeec82525b5c7587fa7de7ca859c1" @@ -1309,63 +1306,7 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-config-semistandard@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/eslint-config-semistandard/-/eslint-config-semistandard-8.0.0.tgz#fb8239379a1dcc114cde7a7dcbbc80beea3334b0" - -eslint-config-standard@^10.2.0: - version "10.2.0" - resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-10.2.0.tgz#9e5a495c32aae8aa8aeb580b703ef645a1765e9b" - -eslint-import-resolver-node@^0.2.0: - version "0.2.3" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.2.3.tgz#5add8106e8c928db2cba232bcd9efa846e3da16c" - dependencies: - debug "^2.2.0" - object-assign "^4.0.1" - resolve "^1.1.6" - -eslint-module-utils@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.0.0.tgz#a6f8c21d901358759cdc35dbac1982ae1ee58bce" - dependencies: - debug "2.2.0" - pkg-dir "^1.0.0" - -eslint-plugin-import: - version "2.2.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.2.0.tgz#72ba306fad305d67c4816348a4699a4229ac8b4e" - dependencies: - builtin-modules "^1.1.1" - contains-path "^0.1.0" - debug "^2.2.0" - doctrine "1.5.0" - eslint-import-resolver-node "^0.2.0" - eslint-module-utils "^2.0.0" - has "^1.0.1" - lodash.cond "^4.3.0" - minimatch "^3.0.3" - pkg-up "^1.0.0" - -eslint-plugin-node: - version "4.2.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-4.2.2.tgz#82959ca9aed79fcbd28bb1b188d05cac04fb3363" - dependencies: - ignore "^3.0.11" - minimatch "^3.0.2" - object-assign "^4.0.1" - resolve "^1.1.7" - semver "5.3.0" - -eslint-plugin-promise@^3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-3.5.0.tgz#78fbb6ffe047201627569e85a6c5373af2a68fca" - -eslint-plugin-standard@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-standard/-/eslint-plugin-standard-3.0.1.tgz#34d0c915b45edc6f010393c7eef3823b08565cf2" - -eslint@3.19.0: +eslint: version "3.19.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc" dependencies: @@ -1405,6 +1346,18 @@ eslint@3.19.0: text-table "~0.2.0" user-home "^2.0.0" +eslint-config-prettier: + version "1.7.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-1.7.0.tgz#cda3ce22df1e852daa9370f1f3446e8b8a02ce44" + dependencies: + get-stdin "^5.0.1" + +eslint-plugin-prettier: + version "2.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.0.1.tgz#2ae1216cf053dd728360ca8560bf1aabc8af3fa9" + dependencies: + requireindex "~1.1.0" + espower-location-detector@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/espower-location-detector/-/espower-location-detector-1.0.0.tgz#a17b7ecc59d30e179e2bef73fb4137704cb331b5" @@ -1415,8 +1368,8 @@ espower-location-detector@^1.0.0: xtend "^4.0.0" espree@^3.4.0: - version "3.4.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.1.tgz#28a83ab4aaed71ed8fe0f5efe61b76a05c13c4d2" + version "3.4.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.2.tgz#38dbdedbedc95b8961a1fbf04734a8f6a9c8c592" dependencies: acorn "^5.0.1" acorn-jsx "^3.0.0" @@ -1452,7 +1405,7 @@ estraverse@~4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2" -esutils@^2.0.2: +esutils@^2.0.2, esutils@2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" @@ -1621,10 +1574,10 @@ fill-range@^2.1.0: repeat-string "^1.5.2" finalhandler@~1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.0.1.tgz#bcd15d1689c0e5ed729b6f7f541a6df984117db8" + version "1.0.2" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.0.2.tgz#d0e36f9dbc557f2de14423df6261889e9d60c93a" dependencies: - debug "2.6.3" + debug "2.6.4" encodeurl "~1.0.1" escape-html "~1.0.3" on-finished "~2.3.0" @@ -1662,6 +1615,10 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" +flow-parser@0.43.0: + version "0.43.0" + resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.43.0.tgz#e2b8eb1ac83dd53f7b6b04a7c35b6a52c33479b7" + fn-name@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/fn-name/-/fn-name-2.0.1.tgz#5214d7537a4d06a4a301c0cc262feb84188002e7" @@ -1731,17 +1688,13 @@ fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2: mkdirp ">=0.5 0" rimraf "2" -function-bind@^1.0.2: - version "1.1.0" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771" - fuzzyset.js@^0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/fuzzyset.js/-/fuzzyset.js-0.0.1.tgz#979e22f9451b4b38f051f7937c919dbacc692958" gauge@~2.7.1: - version "2.7.3" - resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.3.tgz#1c23855f962f17b3ad3d0dc7443f304542edfe09" + version "2.7.4" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" dependencies: aproba "^1.0.3" console-control-strings "^1.0.0" @@ -1774,6 +1727,10 @@ get-stdin@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" +get-stdin@^5.0.1, get-stdin@5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398" + get-stream@^2.2.0: version "2.3.1" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-2.3.1.tgz#5f38f93f346009666ee0150a054167f91bdd95de" @@ -1785,7 +1742,13 @@ get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" -getpass@^0.1.1, getpass@0.1.6: +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + dependencies: + assert-plus "^1.0.0" + +getpass@0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.6.tgz#283ffd9fc1256840875311c1b60e8c40187110e6" dependencies: @@ -1824,7 +1787,7 @@ glob@^6.0.1: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6: +glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" dependencies: @@ -1933,12 +1896,6 @@ has-yarn@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-yarn/-/has-yarn-1.0.0.tgz#89e25db604b725c8f5976fff0addc921b828a5a7" -has@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" - dependencies: - function-bind "^1.0.2" - hawk@~3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" @@ -1960,8 +1917,8 @@ home-or-tmp@^2.0.0: os-tmpdir "^1.0.1" hosted-git-info@^2.1.4: - version "2.4.1" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.4.1.tgz#4b0445e41c004a8bd1337773a4ff790ca40318c8" + version "2.4.2" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.4.2.tgz#0076b9f46a270506ddbaaea56496897460612a67" http-errors@^1.3.0, http-errors@~1.6.1: version "1.6.1" @@ -1981,8 +1938,8 @@ http-signature@^1.0.2, http-signature@~1.1.0: sshpk "^1.7.0" hullabaloo-config-manager@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/hullabaloo-config-manager/-/hullabaloo-config-manager-1.0.0.tgz#70403e68afa009a577bb134306bb71b6b45aaa70" + version "1.0.1" + resolved "https://registry.yarnpkg.com/hullabaloo-config-manager/-/hullabaloo-config-manager-1.0.1.tgz#c72be7ba249a67c99b6ba3eb1f55837fa01acd8f" dependencies: dot-prop "^4.1.0" es6-error "^4.0.2" @@ -2006,7 +1963,7 @@ ignore-by-default@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" -ignore@^3.0.11, ignore@^3.2.0: +ignore@^3.2.0: version "3.2.7" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.7.tgz#4810ca5f1d8eca5595213a34b94f2eb4ed926bbd" @@ -2058,8 +2015,8 @@ inquirer@^0.12.0: through "^2.3.6" interpret@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.2.tgz#f4f623f0bb7122f15f5717c8e254b8161b5c5b2d" + version "1.0.3" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90" invariant@^2.2.0: version "2.2.2" @@ -2095,7 +2052,7 @@ is-binary-path@^1.0.0: dependencies: binary-extensions "^1.0.0" -is-buffer@^1.0.2: +is-buffer@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc" @@ -2395,6 +2352,15 @@ jest-validate@^19.0.2: leven "^2.0.0" pretty-format "^19.0.0" +jest-validate@19.0.0: + version "19.0.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-19.0.0.tgz#8c6318a20ecfeaba0ba5378bfbb8277abded4173" + dependencies: + chalk "^1.1.1" + jest-matcher-utils "^19.0.0" + leven "^2.0.0" + pretty-format "^19.0.0" + jodid25519@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/jodid25519/-/jodid25519-1.0.2.tgz#06d4912255093419477d425633606e0e90782967" @@ -2476,10 +2442,10 @@ keep-alive-agent@0.0.1: resolved "https://registry.yarnpkg.com/keep-alive-agent/-/keep-alive-agent-0.0.1.tgz#44847ca394ce8d6b521ae85816bd64509942b385" kind-of@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.1.0.tgz#475d698a5e49ff5e53d14e3e732429dc8bf4cf47" + version "3.2.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.0.tgz#b58abe4d5c044ad33726a8c1525b48cf891bff07" dependencies: - is-buffer "^1.0.2" + is-buffer "^1.1.5" last-line-stream@^1.0.0: version "1.0.0" @@ -2552,10 +2518,6 @@ lodash.clonedeepwith@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeepwith/-/lodash.clonedeepwith-4.5.0.tgz#6ee30573a03a1a60d670a62ef33c10cf1afdbdd4" -lodash.cond@^4.3.0: - version "4.5.2" - resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" - lodash.debounce@^4.0.3: version "4.0.8" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" @@ -2725,13 +2687,13 @@ mimic-fn@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" -minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, "minimatch@2 || 3": +minimatch@^3.0.0, minimatch@^3.0.2, "minimatch@2 || 3": version "3.0.3" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" dependencies: brace-expansion "^1.0.0" -minimist@^1.1.3, minimist@^1.2.0, minimist@~1.2.0: +minimist@^1.1.3, minimist@^1.2.0, minimist@~1.2.0, minimist@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" @@ -2749,7 +2711,7 @@ mkdirp@^0.5.0, mkdirp@^0.5.1, "mkdirp@>=0.5 0", mkdirp@~0.5.1, mkdirp@0.5.1: dependencies: minimist "0.0.8" -moment@^2.10.6, moment@^2.18.1: +moment@^2.10.6: version "2.18.1" resolved "https://registry.yarnpkg.com/moment/-/moment-2.18.1.tgz#c36193dd3ce1c2eed2adb7c802dbbc77a81b1c0f" @@ -2761,14 +2723,10 @@ mooremachine@^2.0.1: optionalDependencies: dtrace-provider "~0.8" -ms@^0.7.1: +ms@^0.7.1, ms@0.7.3: version "0.7.3" resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.3.tgz#708155a5e44e33f5fd0fc53e81d0d40a91be1fff" -ms@0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" - ms@0.7.2: version "0.7.2" resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" @@ -2840,8 +2798,8 @@ nopt@^4.0.1: osenv "^0.1.4" normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: - version "2.3.6" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.3.6.tgz#498fa420c96401f787402ba21e600def9f981fff" + version "2.3.8" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.3.8.tgz#d819eda2a9dedbd1ffa563ea4071d936782295bb" dependencies: hosted-git-info "^2.1.4" is-builtin-module "^1.0.0" @@ -2880,8 +2838,8 @@ number-is-nan@^1.0.0: resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" nyc@^10.2.0: - version "10.2.0" - resolved "https://registry.yarnpkg.com/nyc/-/nyc-10.2.0.tgz#facd90240600c9aa4dd81ea99c2fb6a85c53de0c" + version "10.2.2" + resolved "https://registry.yarnpkg.com/nyc/-/nyc-10.2.2.tgz#1b1c8ca4636d810cb3e281558dc9fcb08389f204" dependencies: archy "^1.0.0" arrify "^1.0.1" @@ -3040,8 +2998,8 @@ package-hash@^2.0.0: release-zalgo "^1.0.0" package-json@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/package-json/-/package-json-4.0.0.tgz#f3c9dc8738f5b59304d54d2cfb3f91d08fdd7998" + version "4.0.1" + resolved "https://registry.yarnpkg.com/package-json/-/package-json-4.0.1.tgz#8869a0401253661c4c4ca3da6c2121ed555f5eed" dependencies: got "^6.7.1" registry-auth-token "^3.0.1" @@ -3164,12 +3122,6 @@ pkg-dir@^1.0.0: dependencies: find-up "^1.0.0" -pkg-up@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-1.0.0.tgz#3e08fb461525c4421624a33b9f7e6d0af5b05a26" - dependencies: - find-up "^1.0.0" - plur@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/plur/-/plur-1.0.0.tgz#db85c6814f5e5e5a3b49efc28d604fec62975156" @@ -3200,6 +3152,21 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" +prettier: + version "1.2.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.2.2.tgz#22d17c1132faaaea1f1d4faea31f19f7a1959f3e" + dependencies: + ast-types "0.9.8" + babel-code-frame "6.22.0" + babylon "7.0.0-beta.8" + chalk "1.1.3" + esutils "2.0.2" + flow-parser "0.43.0" + get-stdin "5.0.1" + glob "7.1.1" + jest-validate "19.0.0" + minimist "1.2.0" + pretty-format@^19.0.0: version "19.0.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-19.0.0.tgz#56530d32acb98a3fa4851c4e2b9d37b420684c84" @@ -3315,7 +3282,7 @@ read@1.0.7: dependencies: mute-stream "~0.0.4" -readable-stream@^2, "readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, "readable-stream@>= 1.0.2": +readable-stream@^2, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, "readable-stream@>= 1.0.2": version "2.2.9" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.9.tgz#cf78ec6f4a6d1eb43d26488cac97f042e74b7fc8" dependencies: @@ -3362,8 +3329,8 @@ regenerate@^1.2.1: resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.2.tgz#d1941c67bad437e1be76433add5b385f95b19260" regenerator-runtime@^0.10.0: - version "0.10.3" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.3.tgz#8c4367a904b51ea62a908ac310bf99ff90a82a3e" + version "0.10.4" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.4.tgz#74cb6598d3ba2eb18694e968a40e2b3b4df9cf93" regex-cache@^0.4.2: version "0.4.3" @@ -3381,10 +3348,11 @@ regexpu-core@^2.0.0: regjsparser "^0.1.4" registry-auth-token@^3.0.1: - version "3.1.2" - resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.1.2.tgz#1b9e51a185c930da34a9894b12a52ea998f1adaf" + version "3.3.0" + resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.3.0.tgz#57ae67347e73d96345ed1bc01294c7237c02aa63" dependencies: rc "^1.1.6" + safe-buffer "^5.0.1" registry-url@^3.0.3: version "3.1.0" @@ -3472,6 +3440,10 @@ require-uncached@^1.0.2: caller-path "^0.1.0" resolve-from "^1.0.0" +requireindex@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/requireindex/-/requireindex-1.1.0.tgz#e5404b81557ef75db6e49c5a72004893fe03e162" + resolve-cwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-1.0.0.tgz#4eaeea41ed040d1702457df64a42b2b07d246f9f" @@ -3486,9 +3458,9 @@ resolve-from@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57" -resolve@^1.1.6, resolve@^1.1.7: - version "1.3.2" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.2.tgz#1f0442c9e0cbb8136e87b9305f932f46c7f28235" +resolve@^1.1.6: + version "1.3.3" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.3.tgz#655907c3469a8680dc2de3a275a8fdd69691f0e5" dependencies: path-parse "^1.0.5" @@ -3589,7 +3561,7 @@ semver-diff@^2.0.0: dependencies: semver "^5.0.3" -semver@^5.0.1, semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, "semver@2 || 3 || 4 || 5", semver@5.3.0: +semver@^5.0.1, semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, "semver@2 || 3 || 4 || 5": version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" @@ -3736,8 +3708,8 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" sshpk-agent@^1.3.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/sshpk-agent/-/sshpk-agent-1.5.0.tgz#9b4b4f52a8ed3759a1feef4cc6f0a013f691987a" + version "1.6.0" + resolved "https://registry.yarnpkg.com/sshpk-agent/-/sshpk-agent-1.6.0.tgz#56da869e02ad757991c247327e80b261682399af" dependencies: assert-plus "^1.0.0" mooremachine "^2.0.1" @@ -3784,8 +3756,8 @@ sshpk@^1.7.0, sshpk@^1.8.3, "sshpk@>=1.13.0 < 1.14.0": tweetnacl "~0.14.0" stack-utils@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.0.tgz#2392cd8ddbd222492ed6c047960f7414b46c0f83" + version "1.0.1" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.1.tgz#d4f33ab54e8e38778b0ca5cfd3b3afb12db68620" "statuses@>= 1.3.1 < 2", statuses@~1.3.1: version "1.3.1" @@ -4265,8 +4237,8 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" write-file-atomic@^1.1.2, write-file-atomic@^1.1.4: - version "1.3.1" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.1.tgz#7d45ba32316328dd1ec7d90f60ebc0d845bb759a" + version "1.3.4" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.4.tgz#f807a4f0b1d9e913ae7a48112e6cc3af1991b45f" dependencies: graceful-fs "^4.1.11" imurmurhash "^0.1.4" @@ -4330,8 +4302,8 @@ yargs-parser@^5.0.0: camelcase "^3.0.0" yargs@^7.0.2: - version "7.0.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.0.2.tgz#115b97df1321823e8b8648e8968c782521221f67" + version "7.1.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8" dependencies: camelcase "^3.0.0" cliui "^3.2.0"