postman-code-generators
Advanced tools
Comparing version 1.11.0-beta.1 to 1.11.0-beta.2
@@ -5,8 +5,2 @@ # Postman Code Generators Changelog | ||
## [v1.11.0] - 2024-07-10 | ||
### Chore | ||
- Updated postman-collection to v4.4.0. | ||
## [v1.10.1] - 2024-05-06 | ||
@@ -163,8 +157,6 @@ | ||
[Unreleased]: https://github.com/postmanlabs/postman-code-generators/compare/v1.11.0...HEAD | ||
[Unreleased]: https://github.com/postmanlabs/postman-code-generators/compare/v1.10.0...HEAD | ||
[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.9.0...v1.10.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 | ||
@@ -171,0 +163,0 @@ |
let utils = require('./util'), | ||
_ = require('./lodash'), | ||
sdk = require('postman-collection'); | ||
{ Url } = require('postman-collection/lib/collection/url'); | ||
@@ -36,3 +36,3 @@ /** | ||
url = sdk.Url.parse(request.url.toString()); | ||
url = Url.parse(request.url.toString()); | ||
host = url.host ? url.host.join('.') : ''; | ||
@@ -39,0 +39,0 @@ host += url.port ? ':' + url.port : ''; |
@@ -24,3 +24,3 @@ { | ||
"dependencies": { | ||
"postman-collection": "3.6.8" | ||
"postman-collection": "^4.4.0" | ||
}, | ||
@@ -27,0 +27,0 @@ "scripts": { |
var expect = require('chai').expect, | ||
sdk = require('postman-collection'), | ||
{ Request } = require('postman-collection/lib/collection/request'), | ||
sanitize = require('../../lib/util').sanitize, | ||
@@ -18,3 +18,3 @@ parseBody = require('../../lib/parseRequest').parseBody, | ||
it('should return a Tab indented snippet ', function () { | ||
request = new sdk.Request(mainCollection.item[0].request); | ||
request = new Request(mainCollection.item[0].request); | ||
options = { | ||
@@ -39,3 +39,3 @@ indentType: 'Tab', | ||
it('should return snippet with timeout property when timeout is set to non zero', function () { | ||
request = new sdk.Request(mainCollection.item[0].request); | ||
request = new Request(mainCollection.item[0].request); | ||
options = { | ||
@@ -55,3 +55,3 @@ requestTimeout: 1000 | ||
it('should use JSON.parse if the content-type is application/vnd.api+json', function () { | ||
request = new sdk.Request({ | ||
request = new Request({ | ||
'method': 'POST', | ||
@@ -92,3 +92,3 @@ 'header': [ | ||
'0 for no follow redirect', function () { | ||
const request = new sdk.Request(mainCollection.item[0].request); | ||
const request = new Request(mainCollection.item[0].request); | ||
options = { | ||
@@ -109,3 +109,3 @@ followRedirect: false | ||
'0 for no follow redirect from request settings', function () { | ||
const request = new sdk.Request(mainCollection.item[0].request), | ||
const request = new Request(mainCollection.item[0].request), | ||
options = {}; | ||
@@ -129,3 +129,3 @@ | ||
'follow redirect is true from request settings', function () { | ||
const request = new sdk.Request(mainCollection.item[0].request), | ||
const request = new Request(mainCollection.item[0].request), | ||
options = {}; | ||
@@ -154,3 +154,3 @@ | ||
}; | ||
request = new sdk.Request(reqObject); | ||
request = new Request(reqObject); | ||
convert(request, options, function (error, snippet) { | ||
@@ -167,3 +167,3 @@ if (error) { | ||
it('should not fail for a random body mode', function () { | ||
request = new sdk.Request(mainCollection.item[2].request); | ||
request = new Request(mainCollection.item[2].request); | ||
request.body.mode = 'random'; | ||
@@ -184,3 +184,3 @@ request.body[request.body.mode] = {}; | ||
it('should generate snippet for file body mode', function () { | ||
request = new sdk.Request({ | ||
request = new Request({ | ||
'url': 'https://echo.getpostman.com/post', | ||
@@ -210,3 +210,3 @@ 'method': 'POST', | ||
it('should add content type if formdata field contains a content-type', function () { | ||
request = new sdk.Request({ | ||
request = new Request({ | ||
'method': 'POST', | ||
@@ -265,3 +265,3 @@ 'body': { | ||
*/ | ||
request = new sdk.Request(mainCollection.item[0].request); | ||
request = new Request(mainCollection.item[0].request); | ||
options = {}; | ||
@@ -287,3 +287,3 @@ convert(request, options, function (error, snippet) { | ||
'is set to non zero', function () { | ||
request = new sdk.Request(mainCollection.item[0].request); | ||
request = new Request(mainCollection.item[0].request); | ||
options = { | ||
@@ -306,3 +306,3 @@ requestTimeout: 1000 | ||
'is set to non zero and followRedirect as false', function () { | ||
request = new sdk.Request(mainCollection.item[0].request); | ||
request = new Request(mainCollection.item[0].request); | ||
options = { | ||
@@ -327,3 +327,3 @@ requestTimeout: 1000, | ||
it('should not require unused fs', function () { | ||
request = new sdk.Request({ | ||
request = new Request({ | ||
'url': 'https://postman-echo.com/get', | ||
@@ -346,3 +346,3 @@ 'method': 'GET', | ||
it('should add fs for form-data file upload', function () { | ||
request = new sdk.Request({ | ||
request = new Request({ | ||
'url': 'https://postman-echo.com/post', | ||
@@ -371,3 +371,3 @@ 'method': 'POST', | ||
it('should trim header keys and not trim header values', function () { | ||
var request = new sdk.Request({ | ||
var request = new Request({ | ||
'method': 'GET', | ||
@@ -399,3 +399,3 @@ 'header': [ | ||
it('should include JSON.stringify in the snippet for raw json bodies', function () { | ||
var request = new sdk.Request({ | ||
var request = new Request({ | ||
'method': 'POST', | ||
@@ -434,3 +434,3 @@ 'header': [ | ||
it('should generate snippets for no files in form data', function () { | ||
var request = new sdk.Request({ | ||
var request = new Request({ | ||
'method': 'POST', | ||
@@ -484,3 +484,3 @@ 'header': [], | ||
it('should return snippet with maxBodyLength property as "Infinity"', function () { | ||
request = new sdk.Request(mainCollection.item[0].request); | ||
request = new Request(mainCollection.item[0].request); | ||
options = { | ||
@@ -500,3 +500,3 @@ requestTimeout: 1000 | ||
it('should return snippet with promise based code when async_await is disabled', function () { | ||
const request = new sdk.Request(mainCollection.item[0].request); | ||
const request = new Request(mainCollection.item[0].request); | ||
@@ -515,3 +515,3 @@ convert(request, {}, function (error, snippet) { | ||
it('should return snippet with async/await based code when option is enabled', function () { | ||
const request = new sdk.Request(mainCollection.item[0].request); | ||
const request = new Request(mainCollection.item[0].request); | ||
@@ -518,0 +518,0 @@ convert(request, { asyncAwaitEnabled: true }, function (error, snippet) { |
const _ = require('./lodash'), | ||
sdk = require('postman-collection'), | ||
{ Url } = require('postman-collection/lib/collection/url'), | ||
sanitizeOptions = require('./util').sanitizeOptions, | ||
@@ -135,3 +135,3 @@ sanitize = require('./util').sanitize, | ||
url = sdk.Url.parse(request.url.toString()); | ||
url = Url.parse(request.url.toString()); | ||
host = url.host ? url.host.join('.') : ''; | ||
@@ -138,0 +138,0 @@ path = url.path ? '/' + url.path.join('/') : '/'; |
var _ = require('./lodash'), | ||
sdk = require('postman-collection'), | ||
{ Url } = require('postman-collection/lib/collection/url'), | ||
sanitize = require('./util/sanitize').sanitize, | ||
@@ -116,3 +116,3 @@ sanitizeOptions = require('./util/sanitize').sanitizeOptions, | ||
url = sdk.Url.parse(request.url.toString()); | ||
url = Url.parse(request.url.toString()); | ||
host = url.host ? url.host.join('.') : ''; | ||
@@ -119,0 +119,0 @@ path = url.path ? '/' + url.path.join('/') : '/'; |
const expect = require('chai').expect, | ||
sdk = require('postman-collection'), | ||
{ Request } = require('postman-collection/lib/collection/request'), | ||
convert = require('../../lib/index').convert; | ||
@@ -12,3 +12,3 @@ | ||
it('should set no redirect policy when followRedirect is set to false', function () { | ||
const request = new sdk.Request({ | ||
const request = new Request({ | ||
'method': 'GET', | ||
@@ -39,3 +39,3 @@ 'header': [], | ||
it('should set read timeout when requestTimeout is set to non zero value', function () { | ||
const request = new sdk.Request({ | ||
const request = new Request({ | ||
'method': 'GET', | ||
@@ -67,3 +67,3 @@ 'header': [], | ||
['GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'OPTIONS', 'CONNECT', 'PATH', 'TRACE'].forEach(function (method) { | ||
const request = new sdk.Request({ | ||
const request = new Request({ | ||
'method': method, | ||
@@ -96,3 +96,3 @@ 'header': [], | ||
['PROPFIND', 'PURGE', 'LOCK', 'UNLOCK', 'LINK', 'UNLINK', 'COPY'].forEach(function (method) { | ||
const request = new sdk.Request({ | ||
const request = new Request({ | ||
'method': method, | ||
@@ -99,0 +99,0 @@ 'header': [], |
@@ -1,2 +0,2 @@ | ||
const sdk = require('postman-collection'), | ||
const { Request } = require('postman-collection/lib/collection/request'), | ||
labelList = require('./assets/languageLabels.json'), | ||
@@ -89,3 +89,3 @@ languageMap = require('./assets/languages.js'); | ||
if (!sdk.Request.isRequest(request)) { | ||
if (!Request.isRequest(request)) { | ||
return callback('Codegen~convert: Invalid request'); | ||
@@ -92,0 +92,0 @@ } |
var shell = require('shelljs'), | ||
path = require('path'), | ||
async = require('async'), | ||
{ detect } = require('detect-package-manager'), | ||
pm, | ||
PRODUCTION_FLAG = '', | ||
@@ -13,2 +11,9 @@ getSubfolders, | ||
if (args[2] && args[2] === 'dev') { | ||
console.log('Dev flag detected running npm install'); | ||
} | ||
else { | ||
PRODUCTION_FLAG = '--no-audit --production'; | ||
} | ||
getSubfolders = (folder) => { | ||
@@ -22,16 +27,2 @@ 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'); | ||
@@ -56,7 +47,7 @@ var prepackagePath = path.resolve(__dirname, 'pre-package.js'), | ||
console.log(codegen.name + ': ' + pm + ' install ' + PRODUCTION_FLAG); | ||
commandOut = shell.exec(pm + ' install ' + PRODUCTION_FLAG, { silent: true }); | ||
console.log(codegen.name + ': npm install ' + PRODUCTION_FLAG); | ||
commandOut = shell.exec('npm install ' + PRODUCTION_FLAG, { silent: true }); | ||
if (commandOut.code !== 0) { | ||
console.error('Failed to run ' + pm + ' install on codegen ' + codegen.name + ', here is the error:'); | ||
console.error('Failed to run npm install on codegen ' + codegen.name + ', here is the error:'); | ||
return next(commandOut.stderr); | ||
@@ -63,0 +54,0 @@ } |
{ | ||
"name": "postman-code-generators", | ||
"version": "1.11.0-beta.1", | ||
"version": "1.11.0-beta.2", | ||
"description": "Generates code snippets for a postman collection", | ||
@@ -28,7 +28,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"lodash": "4.17.21", | ||
"async": "3.2.2", | ||
"detect-package-manager": "3.0.2", | ||
"lodash": "4.17.21", | ||
"path": "0.12.7", | ||
"postman-collection": "4.0.0", | ||
"postman-collection": "^4.4.0", | ||
"shelljs": "0.8.5" | ||
@@ -40,5 +39,5 @@ }, | ||
"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", | ||
@@ -50,5 +49,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", | ||
@@ -55,0 +54,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
5
1716262
44887
+ Added@faker-js/faker@5.5.3(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedpostman-collection@4.5.0(transitive)
+ Addedpostman-url-encoder@3.0.5(transitive)
+ Addedsemver@7.6.3(transitive)
- Removeddetect-package-manager@3.0.2
- Removedcross-spawn@7.0.3(transitive)
- Removeddetect-package-manager@3.0.2(transitive)
- Removedexeca@5.1.1(transitive)
- Removedfaker@5.5.3(transitive)
- Removedget-stream@6.0.1(transitive)
- Removedhuman-signals@2.1.0(transitive)
- Removedis-stream@2.0.1(transitive)
- Removedisexe@2.0.0(transitive)
- Removedlru-cache@6.0.0(transitive)
- Removedmerge-stream@2.0.0(transitive)
- Removedmime-db@1.48.0(transitive)
- Removedmime-types@2.1.31(transitive)
- Removedmimic-fn@2.1.0(transitive)
- Removednpm-run-path@4.0.1(transitive)
- Removedonetime@5.1.2(transitive)
- Removedpath-key@3.1.1(transitive)
- Removedpostman-collection@4.0.0(transitive)
- Removedpostman-url-encoder@3.0.1(transitive)
- Removedsemver@7.3.5(transitive)
- Removedshebang-command@2.0.0(transitive)
- Removedshebang-regex@3.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedstrip-final-newline@2.0.0(transitive)
- Removedwhich@2.0.2(transitive)
- Removedyallist@4.0.0(transitive)
Updatedpostman-collection@^4.4.0