postman-code-generators
Advanced tools
Comparing version 1.11.0-beta.2 to 1.11.0-beta.3
@@ -5,2 +5,8 @@ # Postman Code Generators Changelog | ||
## [v1.11.0] - 2024-07-10 | ||
### Chore | ||
- Updated postman-collection to v4.4.0. | ||
## [v1.10.1] - 2024-05-06 | ||
@@ -157,6 +163,8 @@ | ||
[Unreleased]: https://github.com/postmanlabs/postman-code-generators/compare/v1.10.0...HEAD | ||
[Unreleased]: https://github.com/postmanlabs/postman-code-generators/compare/v1.11.0...HEAD | ||
[v1.10.1]: https://github.com/postmanlabs/postman-code-generators/compare/v1.9.0...v1.10.0 | ||
[v1.11.0]: https://github.com/postmanlabs/postman-code-generators/compare/v1.10.1...v1.11.0 | ||
[v1.10.1]: https://github.com/postmanlabs/postman-code-generators/compare/v1.10.0...v1.9.0 | ||
[v1.9.0]: https://github.com/postmanlabs/postman-code-generators/compare/v1.8.0...v1.9.0 | ||
@@ -163,0 +171,0 @@ |
@@ -1,10 +0,14 @@ | ||
var sanitize = require('./util').sanitize, | ||
sanitizeOptions = require('./util').sanitizeOptions, | ||
getUrlStringfromUrlObject = require('./util').getUrlStringfromUrlObject, | ||
addFormParam = require('./util').addFormParam, | ||
form = require('./util').form, | ||
shouldAddHttpMethod = require('./util').shouldAddHttpMethod, | ||
_ = require('./lodash'), | ||
self; | ||
const { | ||
sanitize, | ||
sanitizeOptions, | ||
getUrlStringfromUrlObject, | ||
getNtlmAuthInfo, | ||
addFormParam, | ||
form, | ||
shouldAddHttpMethod | ||
} = require('./util'), | ||
_ = require('./lodash'); | ||
var self; | ||
self = module.exports = { | ||
@@ -19,3 +23,3 @@ convert: function (request, options, callback) { | ||
var indent, trim, headersData, body, redirect, timeout, multiLine, | ||
format, snippet, silent, url, quoteType; | ||
format, snippet, silent, url, quoteType, ntlmAuth; | ||
@@ -30,5 +34,12 @@ redirect = options.followRedirect; | ||
url = getUrlStringfromUrlObject(request.url, quoteType); | ||
ntlmAuth = getNtlmAuthInfo(request.auth, quoteType, format); | ||
snippet = silent ? `curl ${form('-s', format)}` : 'curl'; | ||
snippet = 'curl'; | ||
if (ntlmAuth) { | ||
snippet += ntlmAuth; | ||
} | ||
if (silent) { | ||
snippet += ` ${form('-s', format)}`; | ||
} | ||
if (redirect) { | ||
@@ -35,0 +46,0 @@ snippet += ` ${form('-L', format)}`; |
@@ -147,10 +147,45 @@ const _ = require('./lodash'); | ||
/** | ||
* | ||
* @param {*} urlObject The request sdk request.url object | ||
* @param {boolean} quoteType The user given quoteType | ||
* @returns {String} The final string after parsing all the parameters of the url including | ||
* protocol, auth, host, port, path, query, hash | ||
* This will be used because the url.toString() method returned the URL with non encoded query string | ||
* and hence a manual call is made to getQueryString() method with encode option set as true. | ||
*/ | ||
* Generates args required for NTLM authentication to happen | ||
* | ||
* @param {*} auth - The request sdk request.auth object | ||
* @param {string} quoteType - user provided option to decide whether to use single or double quotes | ||
* @param {string} format - user provided option to decide whether to use long format or not | ||
* @returns {string} - The string to be added if NTLM auth is required | ||
*/ | ||
getNtlmAuthInfo: function (auth, quoteType, format) { | ||
const ntlmAuth = auth && auth.ntlm; | ||
if (!auth || auth.type !== 'ntlm' || !ntlmAuth || !ntlmAuth.count || !ntlmAuth.count()) { | ||
return ''; | ||
} | ||
const username = ntlmAuth.has('username') && ntlmAuth.get('username'), | ||
password = ntlmAuth.has('password') && ntlmAuth.get('password'), | ||
domain = ntlmAuth.has('domain') && ntlmAuth.get('domain'); | ||
if (!username && !password) { | ||
return ''; | ||
} | ||
var userArg = format ? '--user ' : '-u ', | ||
ntlmString = ' --ntlm ' + userArg + quoteType; | ||
if (domain) { | ||
ntlmString += self.sanitize(domain, true, quoteType) + '\\'; | ||
} | ||
ntlmString += self.sanitize(username, true, quoteType) + ':' + self.sanitize(password, true, quoteType); | ||
ntlmString += quoteType; | ||
return ntlmString; | ||
}, | ||
/** | ||
* | ||
* @param {*} urlObject The request sdk request.url object | ||
* @param {boolean} quoteType The user given quoteType | ||
* @returns {String} The final string after parsing all the parameters of the url including | ||
* protocol, auth, host, port, path, query, hash | ||
* This will be used because the url.toString() method returned the URL with non encoded query string | ||
* and hence a manual call is made to getQueryString() method with encode option set as true. | ||
*/ | ||
getUrlStringfromUrlObject: function (urlObject, quoteType) { | ||
@@ -157,0 +192,0 @@ var url = ''; |
var shell = require('shelljs'), | ||
path = require('path'), | ||
async = require('async'), | ||
{ detect } = require('detect-package-manager'), | ||
pm, | ||
PRODUCTION_FLAG = '', | ||
@@ -11,9 +13,2 @@ getSubfolders, | ||
if (args[2] && args[2] === 'dev') { | ||
console.log('Dev flag detected running npm install'); | ||
} | ||
else { | ||
PRODUCTION_FLAG = '--no-audit --production'; | ||
} | ||
getSubfolders = (folder) => { | ||
@@ -27,2 +22,16 @@ return fs.readdirSync(folder) | ||
function (next) { | ||
detect().then((res) => { | ||
pm = res; | ||
console.log('Detected package manager: ' + pm); | ||
return next(); | ||
}); | ||
}, | ||
function (next) { | ||
if (args[2] && args[2] === 'dev') { | ||
console.log('Dev flag detected running ' + pm + ' install'); | ||
} | ||
else { | ||
PRODUCTION_FLAG = '--no-audit --production'; | ||
} | ||
console.log('Running pre-package script'); | ||
@@ -47,7 +56,7 @@ var prepackagePath = path.resolve(__dirname, 'pre-package.js'), | ||
console.log(codegen.name + ': npm install ' + PRODUCTION_FLAG); | ||
commandOut = shell.exec('npm install ' + PRODUCTION_FLAG, { silent: true }); | ||
console.log(codegen.name + ': ' + pm + ' install ' + PRODUCTION_FLAG); | ||
commandOut = shell.exec(pm + ' install ' + PRODUCTION_FLAG, { silent: true }); | ||
if (commandOut.code !== 0) { | ||
console.error('Failed to run npm install on codegen ' + codegen.name + ', here is the error:'); | ||
console.error('Failed to run ' + pm + ' install on codegen ' + codegen.name + ', here is the error:'); | ||
return next(commandOut.stderr); | ||
@@ -54,0 +63,0 @@ } |
{ | ||
"name": "postman-code-generators", | ||
"version": "1.11.0-beta.2", | ||
"version": "1.11.0-beta.3", | ||
"description": "Generates code snippets for a postman collection", | ||
@@ -28,4 +28,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"async": "3.2.2", | ||
"detect-package-manager": "3.0.2", | ||
"lodash": "4.17.21", | ||
"async": "3.2.2", | ||
"path": "0.12.7", | ||
@@ -39,5 +40,5 @@ "postman-collection": "^4.4.0", | ||
"chalk": "2.4.2", | ||
"eslint": "5.16.0", | ||
"dependency-check": "3.0.0", | ||
"editorconfig": "0.15.3", | ||
"eslint": "5.16.0", | ||
"eslint-plugin-jsdoc": "3.15.1", | ||
@@ -49,5 +50,5 @@ "eslint-plugin-lodash": "2.7.0", | ||
"js-yaml": "3.14.1", | ||
"newman": "5.3.2", | ||
"jsdoc": "3.6.10", | ||
"mocha": "6.2.3", | ||
"newman": "5.3.2", | ||
"nyc": "14.1.1", | ||
@@ -54,0 +55,0 @@ "parse-gitignore": "1.0.1", |
Sorry, the diff of this file is not supported yet
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
1718031
44934
6
+ Addeddetect-package-manager@3.0.2
+ Addedcross-spawn@7.0.3(transitive)
+ Addeddetect-package-manager@3.0.2(transitive)
+ Addedexeca@5.1.1(transitive)
+ Addedget-stream@6.0.1(transitive)
+ Addedhuman-signals@2.1.0(transitive)
+ Addedis-stream@2.0.1(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedmerge-stream@2.0.0(transitive)
+ Addedmimic-fn@2.1.0(transitive)
+ Addednpm-run-path@4.0.1(transitive)
+ Addedonetime@5.1.2(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedstrip-final-newline@2.0.0(transitive)
+ Addedwhich@2.0.2(transitive)