heroku-connect-plugin
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -9,6 +9,8 @@ 'use strict'; | ||
require('./lib/commands/connect/status'), | ||
require('./lib/commands/connect/state'), | ||
require('./lib/commands/connect/preauth'), | ||
require('./lib/commands/connect/setup'), | ||
require('./lib/commands/connect/mapping'), | ||
require('./lib/commands/connect/create-mapping'), | ||
require('./lib/commands/connect/delete-mapping') | ||
]; |
@@ -29,6 +29,16 @@ 'use strict'; | ||
let data = {schema_name:schema, db_key:db}; | ||
if (context.flags.token) { | ||
data.preauth_token = context.flags.token; | ||
} | ||
api.withUserConnections(context.auth.password, context.app, context.flags).then(function(connections){ | ||
connections.forEach(function(connection) { | ||
connection_info(connection); | ||
console.log(""); | ||
if (connection.state == 'NEW') { | ||
console.log("Configuring connection with\n", data); | ||
api.request(context.auth.password, 'PATCH', '/api/v3/connections/' + connection.guid, data).then(function(response) { | ||
console.log("Patch result ", response.json); | ||
}); | ||
} else { | ||
console.log("Connection ", connection, " already in state: ", connection.state); | ||
} | ||
}); | ||
@@ -35,0 +45,0 @@ }); |
@@ -5,5 +5,16 @@ var https = require('https'); | ||
var HOST = 'dev-herokuconnect.herokuapp.com'; | ||
var HOST = 'connect.heroku.com'; | ||
var ADDON = 'herokuconnect'; | ||
var PORT = 443; | ||
var global_config = exports.global_config = function(context) { | ||
if (process.env['CONNECT_ADDON'] === 'connectqa') { | ||
var last_host = HOST; | ||
HOST = 'dev-herokuconnect.herokuapp.com'; | ||
ADDON = 'connectqa'; | ||
if (HOST != last_host) { | ||
console.error("Using " + HOST + "..."); | ||
} | ||
} | ||
} | ||
@@ -26,3 +37,3 @@ var printResponseError = exports.printResponseError = function(response){ | ||
// add data to body for POST/PUT requests | ||
if (data !== undefined && ['POST', 'PUT'].indexOf(method) !== -1) { | ||
if (data !== undefined && ['POST', 'PUT', 'PATCH'].indexOf(method) !== -1) { | ||
withBody = true; | ||
@@ -82,2 +93,4 @@ data = JSON.stringify(data); | ||
exports.withUser = function(token) { | ||
global_config(); | ||
return request(token, 'GET', '/api/v3/users/me').then(function(response) { | ||
@@ -93,2 +106,4 @@ return Q.Promise(function(resolve, reject) { | ||
var withUserConnections = exports.withUserConnections = function(token, appName, flags){ | ||
global_config(); | ||
var resource_name = null; | ||
@@ -119,2 +134,4 @@ if (flags && flags.resource) { | ||
exports.withUserConnection = function(token, appName, connectionId){ | ||
global_config(); | ||
return withUserInstance(token, appName).then(function(instance){ | ||
@@ -136,2 +153,4 @@ var connections = instance.connections; | ||
exports.withRequiredFields = function(token, connectionId, objectName){ | ||
global_config(); | ||
return request(token, 'GET', '/api/v2/connections/' + connectionId + '/schemas/' + objectName).then(function(response){ | ||
@@ -150,2 +169,4 @@ var requiredFields = []; | ||
exports.withConnectionMappings = function(token, connectionId) { | ||
global_config(); | ||
return request(token, 'GET', '/api/v2/connections/' + connectionId + '/mappings').then(function(response){ | ||
@@ -152,0 +173,0 @@ return Q.Promise(function(resolve, reject){ |
@@ -15,2 +15,3 @@ 'use strict'; | ||
command: 'status', | ||
default: true, | ||
description: 'display connection status information', | ||
@@ -17,0 +18,0 @@ help: 'display connection status information', |
{ | ||
"name": "heroku-connect-plugin", | ||
"description": "Minimal Heroku Connect plugin for Heroku Toolbelt", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"author": "Scott Persinger @persingerscott", | ||
@@ -6,0 +6,0 @@ "bugs": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
18833
13
518
2
2