@hyperone/cli-core
Advanced tools
Comparing version 2.0.7 to 2.0.8
@@ -108,3 +108,3 @@ | ||
result.introspection = async () => { | ||
const token = await getAccessToken(); | ||
const token = await result.getToken(); | ||
const openid_configuration = await result.getConfiguration(); | ||
@@ -111,0 +111,0 @@ return http.post(openid_configuration.introspection_endpoint, { |
@@ -45,3 +45,2 @@ import fetch from 'node-fetch'; | ||
resp.controller = controller; | ||
if (!resp.ok) { | ||
@@ -58,6 +57,2 @@ const err = new Error('Invalid response'); | ||
const type = resp.headers.get('content-type'); | ||
const length = resp.headers.get('content-length'); | ||
if (resp.status == 204 || length == '0') { | ||
return; | ||
} | ||
const encoding = resp.headers.get('transfer-encoding'); | ||
@@ -69,14 +64,14 @@ | ||
} | ||
const respText = await resp.text(); | ||
logger.debug('response text', respText); | ||
return respText; | ||
resp.bodyText = resp.text(); | ||
logger.debug('response text', resp.bodyText); | ||
return resp; | ||
} | ||
if (type && type.startsWith('application/json')) { | ||
const respJson = await resp.json(); | ||
logger.debug('response json', respJson); | ||
return respJson; | ||
resp.bodyJson = await resp.json(); | ||
logger.debug('response json', resp.bodyJson); | ||
return resp; | ||
} | ||
throw new Error(`Unsupported content type: ${type}`); | ||
return resp; | ||
}; | ||
@@ -83,0 +78,0 @@ |
{ | ||
"name": "@hyperone/cli-core", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"@apidevtools/json-schema-ref-parser": "^9.0.3", | ||
"@hyperone/cli-framework": "^2.0.7", | ||
"@hyperone/cli-framework": "^2.0.8", | ||
"abort-controller": "^3.0.0", | ||
@@ -31,3 +31,3 @@ "camel-case": "^4.1.1", | ||
"license": "MIT", | ||
"gitHead": "f786b8cb001c45e48e91d540e3eec6b1ee233ddb" | ||
"gitHead": "4cfaa43a86700d54c7ebb2e81474a8f8f32d1b63" | ||
} |
@@ -11,3 +11,3 @@ import http from '../lib/http'; | ||
typeLabel: 'path', | ||
description: 'Passport file. Defaults to ~/.h1/passport.json.', | ||
description: 'Passport file. Default value is ~/.h1/passport.json, if available.', | ||
group: ['global'], | ||
@@ -14,0 +14,0 @@ }, |
@@ -65,2 +65,3 @@ import jmespath from 'jmespath'; | ||
type: String, | ||
defaultValue: cmd.defaultQuery, | ||
group: ['global'], | ||
@@ -73,6 +74,17 @@ }, | ||
opts.format = (opts, output) => { | ||
if (typeof output == 'string') return output; | ||
return formatter(output, optsAll.query, opts.defaultQuery); | ||
if (output && output.headers && output.status) { | ||
if (output.bodyText) { | ||
output = output.bodyText; | ||
} else if (output.bodyJson) { | ||
output = output.bodyJson; | ||
} else if (output.status <= 200 && output.status > 300) { | ||
output = 'The operation was a success'; | ||
} else { | ||
output = `The operation response status is '${output.status} ${output.statusText}'`; | ||
} | ||
} | ||
if (typeof output == 'string' || !optsAll.query) return output; | ||
return formatter(output, optsAll.query); | ||
}; | ||
}, | ||
}; |
@@ -7,6 +7,5 @@ | ||
name: 'no-wait', | ||
type: (value) => value == 'true', | ||
typeLabel: 'true,false', | ||
type: Boolean, | ||
choices: ['true', 'false'], | ||
defaultValue: true, | ||
defaultValue: false, | ||
description: 'In case of queued event do not wait for completion', | ||
@@ -19,3 +18,3 @@ group: ['global'], | ||
const prefer_async = optsAll['no-wait']; | ||
const prefer_value = prefer_async ? `respond-async,wait=${60 * 60 * 24}` : 'respond-async,wait=0'; | ||
const prefer_value = !prefer_async ? `respond-async,wait=${60 * 60 * 24}` : 'respond-async,wait=0'; | ||
opts.api.setHeaders({ | ||
@@ -22,0 +21,0 @@ Prefer: prefer_value, |
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
27609
686