Comparing version 3.2.0 to 3.2.1
@@ -10,6 +10,6 @@ 'use strict'; | ||
//Trace Command | ||
//Run Command | ||
var runCmd = cli.command('run <projectName> <path>'); | ||
runCmd | ||
.description('Run 28.io query.') | ||
.description('Run query.') | ||
.action(function(projectName, path){ | ||
@@ -22,6 +22,34 @@ projectName = projectName || Config.getDefaultProject(); | ||
} | ||
if(!u.path.endsWith('.jq') && !u.path.endsWith('.xq')) { | ||
var serializedURL = URL.format(u); | ||
console.log(`GET ${serializedURL}`.gray); | ||
request({ | ||
uri: serializedURL, | ||
method: 'GET' | ||
}, function(error, response, body){ | ||
if(error) { | ||
console.error(error); | ||
} else { | ||
console.log(body); | ||
} | ||
}); | ||
}); | ||
}); | ||
//Trace Command | ||
var traceCmd = cli.command('trace <projectName> <path>'); | ||
traceCmd | ||
.description('Trace query.') | ||
.action(function(projectName, path){ | ||
projectName = projectName || Config.getDefaultProject(); | ||
return Config.refreshTokens(projectName).then(function(){ | ||
var u = URL.parse(path); | ||
if(u.protocol === null) { | ||
u = URL.parse(Config.getProjectEndpoint(projectName) + '/_queries' + (path[0] === '/' ? '' : '/') + path); | ||
} | ||
if(!u.pathname.endsWith('.jq') && !u.pathname.endsWith('.xq')) { | ||
//Assumes JSONiq then | ||
u.path += '.jq'; | ||
u.pathname += '.jq'; | ||
} | ||
u.pathname += "/metadata/trace"; | ||
if(u.search === null) { | ||
@@ -34,2 +62,3 @@ u.search = ''; | ||
var serializedURL = URL.format(u); | ||
console.log(`GET ${serializedURL}`.gray); | ||
request({ | ||
@@ -41,7 +70,7 @@ uri: serializedURL, | ||
console.error(error); | ||
return; | ||
} else { | ||
console.log(body.green); | ||
} | ||
console.log(body.green); | ||
}); | ||
}); | ||
}); |
@@ -9,3 +9,3 @@ { | ||
"description": "Command line utility to download and upload 28.io queries.", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"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
1298
186152
35