-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from snyk-tech-services/develop
fix: Merge changes to prod
- Loading branch information
Showing
2 changed files
with
84 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { requestsManager } from './request/requestManager' | ||
|
||
const run = async () => { | ||
const manager = new requestsManager() | ||
manager.on('data', { | ||
callback:(requestId, data) => { | ||
console.log("response for request ", requestId) | ||
console.log(data) | ||
} | ||
}) | ||
|
||
manager.on('error', { | ||
callback:(requestId, data) => { | ||
console.log("response for request ", requestId) | ||
console.log(data) | ||
} | ||
}) | ||
|
||
try{ | ||
let requestSync = await manager.request({verb: "GET", url: '/', body: ''}) | ||
console.log(requestSync) | ||
console.log('done with synced request') | ||
} catch (err) { | ||
console.log('error') | ||
console.log(err) | ||
} | ||
|
||
|
||
manager.on('data', { | ||
callback:(requestId, data) => { | ||
console.log("response for request on test-channel ", requestId) | ||
console.log(data) | ||
}, | ||
channel: 'test-channel' | ||
}) | ||
|
||
try { | ||
console.log('1',manager.requestStream({verb: "GET", url: '/', body: ''})) | ||
console.log('1-channel',manager.requestStream({verb: "GET", url: '/', body: ''}, 'test-channel')) | ||
console.log('2',manager.requestStream({verb: "GET", url: '/', body: ''})) | ||
console.log('2-channel',manager.requestStream({verb: "GET", url: '/', body: ''}, 'test-channel')) | ||
console.log('3',manager.requestStream({verb: "GET", url: '/', body: ''})) | ||
console.log('3-channel',manager.requestStream({verb: "GET", url: '/', body: ''}, 'test-channel')) | ||
} catch (err) { | ||
console.log(err) | ||
} | ||
|
||
|
||
|
||
|
||
const filters = `{ | ||
"filters": { | ||
"severities": [ | ||
"high", | ||
"medium", | ||
"low" | ||
], | ||
"exploitMaturity": [ | ||
"mature", | ||
"proof-of-concept", | ||
"no-known-exploit", | ||
"no-data" | ||
], | ||
"types": [ | ||
"vuln", | ||
"license" | ||
], | ||
"ignored": false | ||
} | ||
} | ||
` | ||
try { | ||
const results = await manager.requestBulk([{verb: "GET", url: '/', body: ''}, {verb: "POST", url: '/org/334e0c45-5d3d-40f6-b882-ae82a164b317/project/0bbbfee1-2138-4322-80d4-4166d1259ae5/issues', body: filters}, {verb: "GET", url: '/', body: ''}]) | ||
console.log(results) | ||
} catch(resultsWithError) { | ||
console.log(resultsWithError) | ||
} | ||
|
||
} | ||
|
||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,6 @@ | ||
import 'source-map-support/register'; | ||
import { requestsManager } from './request/requestManager' | ||
|
||
const run = async () => { | ||
const manager = new requestsManager() | ||
manager.on('data', { | ||
callback:(requestId, data) => { | ||
console.log("response for request ", requestId) | ||
console.log(data) | ||
} | ||
}) | ||
|
||
manager.on('error', { | ||
callback:(requestId, data) => { | ||
console.log("response for request ", requestId) | ||
console.log(data) | ||
} | ||
}) | ||
|
||
try{ | ||
let requestSync = await manager.request({verb: "GET", url: '/', body: ''}) | ||
console.log(requestSync) | ||
console.log('done with synced request') | ||
} catch (err) { | ||
console.log('error') | ||
console.log(err) | ||
} | ||
|
||
|
||
manager.on('data', { | ||
callback:(requestId, data) => { | ||
console.log("response for request on test-channel ", requestId) | ||
console.log(data) | ||
}, | ||
channel: 'test-channel' | ||
}) | ||
|
||
try { | ||
console.log('1',manager.requestStream({verb: "GET", url: '/', body: ''})) | ||
console.log('1-channel',manager.requestStream({verb: "GET", url: '/', body: ''}, 'test-channel')) | ||
console.log('2',manager.requestStream({verb: "GET", url: '/', body: ''})) | ||
console.log('2-channel',manager.requestStream({verb: "GET", url: '/', body: ''}, 'test-channel')) | ||
console.log('3',manager.requestStream({verb: "GET", url: '/', body: ''})) | ||
console.log('3-channel',manager.requestStream({verb: "GET", url: '/', body: ''}, 'test-channel')) | ||
} catch (err) { | ||
console.log(err) | ||
} | ||
|
||
|
||
|
||
|
||
const filters = `{ | ||
"filters": { | ||
"severities": [ | ||
"high", | ||
"medium", | ||
"low" | ||
], | ||
"exploitMaturity": [ | ||
"mature", | ||
"proof-of-concept", | ||
"no-known-exploit", | ||
"no-data" | ||
], | ||
"types": [ | ||
"vuln", | ||
"license" | ||
], | ||
"ignored": false | ||
} | ||
} | ||
` | ||
try { | ||
const results = await manager.requestBulk([{verb: "GET", url: '/', body: ''}, {verb: "POST", url: '/org/334e0c45-5d3d-40f6-b882-ae82a164b317/project/0bbbfee1-2138-4322-80d4-4166d1259ae5/issues', body: filters}, {verb: "GET", url: '/', body: ''}]) | ||
console.log(results) | ||
} catch(resultsWithError) { | ||
console.log(resultsWithError) | ||
} | ||
|
||
} | ||
|
||
run() | ||
export { | ||
requestsManager | ||
} |