Comparing version 0.3.8 to 0.3.9
@@ -1,4 +0,4 @@ | ||
(function(){ | ||
'use strict'; | ||
'use strict'; | ||
exports.$28 = function(apiEndpoint){ | ||
var syncLib = require('./sync'); | ||
@@ -8,9 +8,8 @@ var Options = syncLib.Options; | ||
var $28 = function(apiEndpoint) { | ||
this.api = require('28.io-nodejs').$28(apiEndpoint); | ||
this.Options = Options; | ||
}; | ||
this.api = require('28.io-nodejs').$28(apiEndpoint); | ||
this.Options = Options; | ||
var that = this; | ||
$28.prototype.sync = function(type, projectName, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore) { | ||
var client = new Client(this.api, projectName, projectToken, localProjectPath); | ||
this.sync = function(type, projectName, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore) { | ||
var client = new Client(that.api, projectName, projectToken, localProjectPath); | ||
var method = type === 'download' ? client.download : client.upload; | ||
@@ -20,17 +19,17 @@ return method(overwrite, deleteOrphaned, simulate, ignore); | ||
$28.prototype.download = function(projectName, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore) { | ||
return this.sync('download', projectName, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore); | ||
this.download = function(projectName, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore) { | ||
return that.sync('download', projectName, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore); | ||
}; | ||
$28.prototype.upload = function(projectName, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore) { | ||
return this.sync('upload', projectName, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore); | ||
this.upload = function(projectName, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore) { | ||
return that.sync('upload', projectName, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore); | ||
}; | ||
$28.prototype.truncate = function(projectName, projectToken, simulate, ignore) { | ||
var client = new Client(this.api, projectName, projectToken); | ||
this.truncate = function(projectName, projectToken, simulate, ignore) { | ||
var client = new Client(that.api, projectName, projectToken); | ||
return client.truncate(simulate, ignore); | ||
}; | ||
$28.prototype.refreshTokens = function(email, token){ | ||
return this.api.Auth.authenticate({ | ||
this.refreshTokens = function(email, token){ | ||
return that.api.Auth.authenticate({ | ||
email: email, | ||
@@ -41,5 +40,5 @@ refresh_token: token, | ||
}; | ||
$28.prototype.login = function(email, password) { | ||
return this.api.Auth.authenticate({ | ||
this.login = function(email, password) { | ||
return that.api.Auth.authenticate({ | ||
email: email, | ||
@@ -50,5 +49,5 @@ password: password, | ||
}; | ||
$28.prototype.createProject = function(projectName, token) { | ||
return this.api.Project.createProject({ | ||
this.createProject = function(projectName, token) { | ||
return that.api.Project.createProject({ | ||
projectName: projectName, | ||
@@ -59,5 +58,5 @@ package: 'free', | ||
}; | ||
$28.prototype.deleteProject = function(projectName, token){ | ||
return this.api.Project.deleteProject({ | ||
this.deleteProject = function(projectName, token){ | ||
return that.api.Project.deleteProject({ | ||
name: projectName, | ||
@@ -67,9 +66,9 @@ token: token | ||
}; | ||
$28.prototype.listDatasources = function(projectName, token){ | ||
return this.api.Datasources(projectName).listDatasources({ token: token}); | ||
this.listDatasources = function(projectName, token){ | ||
return that.api.Datasources(projectName).listDatasources({ token: token}); | ||
}; | ||
$28.prototype.createDatasource = function(projectName, category, name, token, difault, credentials){ | ||
return this.api.Datasources(projectName).createDatasource({ | ||
this.createDatasource = function(projectName, category, name, token, difault, credentials){ | ||
return that.api.Datasources(projectName).createDatasource({ | ||
category: category, | ||
@@ -83,4 +82,4 @@ name: name, | ||
$28.prototype.removeDatasource = function(projectName, category, datasource, projectToken){ | ||
return this.api.Datasources(projectName).removeDatasource({ | ||
this.removeDatasource = function(projectName, category, datasource, projectToken){ | ||
return that.api.Datasources(projectName).removeDatasource({ | ||
category: category, | ||
@@ -91,5 +90,5 @@ datasource: datasource, | ||
}; | ||
$28.prototype.getDefaultMongoDBCredentials = function(projectName, token){ | ||
return this.api.Project.getDefaultMongoDBCredentials({ | ||
this.getDefaultMongoDBCredentials = function(projectName, token){ | ||
return that.api.Project.getDefaultMongoDBCredentials({ | ||
name: projectName, | ||
@@ -100,6 +99,6 @@ token: token | ||
$28.prototype.updateDefaultMongoDBCredentials = function( | ||
this.updateDefaultMongoDBCredentials = function( | ||
projectName, token, dbType, connString, db, username, password, preDigested | ||
){ | ||
return this.api.Project.updateDefaultMongoDBCredentials({ | ||
){ | ||
return that.api.Project.updateDefaultMongoDBCredentials({ | ||
name: projectName, | ||
@@ -115,4 +114,4 @@ token: token, | ||
}; | ||
$28.prototype.overwriteCoercion = function(value, cmd){ | ||
this.overwriteCoercion = function(value, cmd){ | ||
value = value.toLowerCase(); | ||
@@ -132,4 +131,2 @@ if(value === 'yes' || value === 'all' || value === 'always') { | ||
}; | ||
exports.$28 = $28; | ||
})(); | ||
}; |
@@ -9,3 +9,3 @@ 'use strict'; | ||
var $28API = require('./28.js').$28; | ||
var $28; | ||
// Settings | ||
@@ -59,3 +59,6 @@ var defaultSettings = { | ||
getAPIClient: function(){ | ||
return new $28API(this.getAPIEndpoint()); | ||
if($28 === undefined) { | ||
$28 = new $28API(this.getAPIEndpoint()); | ||
} | ||
return $28; | ||
}, | ||
@@ -62,0 +65,0 @@ |
@@ -9,3 +9,3 @@ { | ||
"description": "Command line utility to download and upload 28.io queries.", | ||
"version": "0.3.8", | ||
"version": "0.3.9", | ||
"keywords": [ | ||
@@ -12,0 +12,0 @@ "jsoniq", |
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
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
967
159305