-
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.
- Loading branch information
0 parents
commit 44f6c6e
Showing
20 changed files
with
810 additions
and
0 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,101 @@ | ||
version: 2.1 | ||
orbs: | ||
snyk: snyk/[email protected] | ||
|
||
jobs: | ||
build-test-monitor: | ||
docker: | ||
# specify the version | ||
- image: circleci/node:10.16.3 | ||
|
||
steps: | ||
- checkout | ||
- run: | ||
name: "Install deps" | ||
command: | | ||
npm install | ||
- run: | ||
name: "Run Tests" | ||
command: | | ||
npm test | ||
- snyk/scan: | ||
fail-on-issues: true | ||
monitor-on-build: true | ||
token-variable: SNYK_TOKEN | ||
- run: ./generate-binaries.sh | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- dist/* | ||
|
||
build-test: | ||
docker: | ||
# specify the version | ||
- image: circleci/node:10.16.3 | ||
|
||
steps: | ||
- checkout | ||
- run: | ||
name: "Install deps" | ||
command: | | ||
npm install | ||
- run: | ||
name: "Run Tests" | ||
command: | | ||
npm test | ||
- snyk/scan: | ||
fail-on-issues: true | ||
monitor-on-build: false | ||
token-variable: SNYK_TOKEN | ||
|
||
publish-github-release: | ||
docker: | ||
- image: gcr.io/snyk-technical-services/cicd-github | ||
auth: | ||
username: _json_key | ||
password: $GCLOUD_GCR_SNYK_TS_READER | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: . | ||
- run: | ||
name: "Publish Release on GitHub" | ||
command: | | ||
VERSIONJUMP=$(git log --oneline -1 --pretty=%B | cat | grep -E 'minor|major|patch' | awk -F ':' '{print $1}') | ||
VERSION=$(/workdir/nextver.sh "$VERSIONJUMP") | ||
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION} dist/ | ||
workflows: | ||
version: 2.1 | ||
nightly: | ||
triggers: | ||
- schedule: | ||
cron: "0 0 * * *" | ||
filters: | ||
branches: | ||
only: | ||
- master | ||
jobs: | ||
- build-test-monitor | ||
build-test-monitor-publish: | ||
jobs: | ||
- build-test-monitor: | ||
filters: | ||
branches: | ||
only: | ||
- master | ||
- publish-github-release: | ||
requires: | ||
- build-test-monitor | ||
filters: | ||
branches: | ||
only: | ||
- master | ||
build-test: | ||
jobs: | ||
- build-test: | ||
filters: | ||
branches: | ||
ignore: | ||
- master | ||
|
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 @@ | ||
/node_modules/ |
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,30 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint"], | ||
"parserOptions": { | ||
"ecmaVersion": 6 | ||
}, | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier", | ||
"prettier/@typescript-eslint" | ||
], | ||
"rules": { | ||
"@typescript-eslint/explicit-function-return-type": [ | ||
"error", | ||
{ | ||
"allowExpressions": true, | ||
"allowTypedFunctionExpressions": true | ||
} | ||
], | ||
"no-var": "error", | ||
"prefer-arrow-callback": "error", | ||
"prefer-const": "error" | ||
} | ||
} |
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,20 @@ | ||
- [ ] Tests written and linted [ℹ︎](https://github.com/snyk/general/wiki/Tests) | ||
- [ ] Documentation written [ℹ︎](https://github.com/snyk/general/wiki/Documentation) | ||
- [ ] Commit history is tidy [ℹ︎](https://github.com/snyk/general/wiki/Git) | ||
|
||
### What this does | ||
|
||
_Explain why this PR exists_ | ||
|
||
### Notes for the reviewer | ||
|
||
_Instructions on how to run this locally, background context, what to review, questions…_ | ||
|
||
### More information | ||
|
||
- [Jira ticket SC-0000](https://snyksec.atlassian.net/browse/SC-0000) | ||
- [Link to documentation](https://github.com/snyk/snyk-request-manager/wiki/) | ||
|
||
### Screenshots | ||
|
||
_Visuals that may help the reviewer_ |
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,10 @@ | ||
node_modules/ | ||
npm-debug.log | ||
.npmrc | ||
# output | ||
dist | ||
.DS_Store | ||
*.log | ||
package-lock.json | ||
yarn.lock | ||
.eslintcache |
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 @@ | ||
/node_modules/ |
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,6 @@ | ||
{ | ||
"arrowParens": "always", | ||
"trailingComma": "all", | ||
"singleQuote": true, | ||
"htmlWhitespaceSensitivity": "ignore" | ||
} |
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,8 @@ | ||
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities. | ||
version: v1.13.5 | ||
ignore: {} | ||
# patches apply the minimum changes required to fix a vulnerability | ||
patch: | ||
SNYK-JS-LODASH-450202: | ||
- lodash: | ||
patched: '2019-07-05T10:44:37.780Z' |
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,13 @@ | ||
Copyright 2018 Snyk Ltd. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
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,10 @@ | ||
![Snyk logo](https://snyk.io/style/asset/logo/snyk-print.svg) | ||
|
||
*** | ||
|
||
[![Known Vulnerabilities](https://snyk.io/test/github/snyk/snyk-request-manager/badge.svg)](https://snyk.io/test/github/snyk/snyk-request-manager) | ||
|
||
Snyk helps you find, fix and monitor for known vulnerabilities in your dependencies, both on an ad hoc basis and as part of your CI (Build) system. | ||
|
||
## Snyk snyk-request-manager | ||
Rate controlled and retry enabled request manager to interact with Snyk APIs |
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,6 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
collectCoverageFrom: ['lib/**/*.ts'], | ||
coverageReporters: ['text-summary', 'html'], | ||
}; |
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,75 @@ | ||
{ | ||
"name": "snyk-request-manager", | ||
"description": "Rate controlled and retry enabled request manager to interact with Snyk APIs", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"format:check": "prettier --check '{''{lib,test}/!(fixtures)/**/*,*}.{js,ts,json,yml}'", | ||
"format": "prettier --write '{''{lib,test}/!(fixtures)/**/*,*}.{js,ts,json,yml}'", | ||
"lint": "npm run format:check && npm run lint:eslint", | ||
"lint:eslint": "eslint --cache '{lib,test}/**/*.ts'", | ||
"test": "npm run lint && npm run test:unit", | ||
"test:unit": "jest", | ||
"test:coverage": "npm run test:unit -- --coverage", | ||
"test:watch": "tsc-watch --onSuccess 'npm run test:unit'", | ||
"build": "tsc", | ||
"build-watch": "tsc -w", | ||
"prepare": "npm run build", | ||
"snyk-test": "snyk test", | ||
"pkg-binaries": "npx pkg . -t node12-linux-x64,node12-macos-x64,node12-win-x64 --out-path ./dist/binaries" | ||
}, | ||
"types": "./dist/index.d.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/snyk-tech-services/snyk-request-manager" | ||
}, | ||
"author": "Snyk Tech Services", | ||
"license": "Apache-2.0", | ||
"engines": { | ||
"node": ">=12" | ||
}, | ||
"files": [ | ||
"bin", | ||
"dist" | ||
], | ||
"homepage": "https://github.com/snyk-tech-services/snyk-request-manager#readme", | ||
"dependencies": { | ||
"@snyk/configstore": "^3.2.0-rc1", | ||
"@types/uuid": "^7.0.3", | ||
"axios": "^0.19.2", | ||
"chalk": "^4.0.0", | ||
"debug": "^4.1.1", | ||
"leaky-bucket-queue": "0.0.2", | ||
"lodash": "^4.17.15", | ||
"snyk": "^1.316.2", | ||
"snyk-config": "^3.0.0", | ||
"source-map-support": "^0.5.16", | ||
"tslib": "^1.10.0", | ||
"uuid": "^8.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^25.1.1", | ||
"@types/lodash": "^4.14.149", | ||
"@types/node": "^12.12.26", | ||
"@typescript-eslint/eslint-plugin": "^2.18.0", | ||
"@typescript-eslint/parser": "^2.18.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.10.0", | ||
"jest": "^25.1.0", | ||
"nock": "^12.0.3", | ||
"prettier": "^1.19.1", | ||
"ts-jest": "^25.1.0", | ||
"ts-node": "8.6.2", | ||
"tsc-watch": "^4.1.0", | ||
"typescript": "^3.7.5" | ||
}, | ||
"pkg": { | ||
"scripts": [ | ||
"dist/**/*.js" | ||
] | ||
}, | ||
"release": { | ||
"branches": [ | ||
"master" | ||
] | ||
} | ||
} |
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,40 @@ | ||
|
||
|
||
class ApiError extends Error { | ||
constructor(message: any){ | ||
super(message) | ||
this.name = "ApiError" | ||
this.message = (message || "") | ||
} | ||
} | ||
|
||
class ApiAuthenticationError extends Error { | ||
constructor(message: any){ | ||
super(message) | ||
this.name = "ApiAuthenticationError" | ||
this.message = (message || "") | ||
} | ||
} | ||
|
||
class NotFoundError extends Error { | ||
constructor(message: any){ | ||
super(message) | ||
this.name = "NotFoundError" | ||
this.message = (message || "") | ||
} | ||
} | ||
|
||
class GenericError extends Error { | ||
constructor(message: any){ | ||
super(message) | ||
this.name = "Unknown" | ||
this.message = (message || "") | ||
} | ||
} | ||
|
||
export { | ||
ApiError, | ||
ApiAuthenticationError, | ||
NotFoundError, | ||
GenericError | ||
} |
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,13 @@ | ||
|
||
|
||
class BadInputError extends Error { | ||
constructor(message: any){ | ||
super(message) | ||
this.name = "BadInputError" | ||
this.message = (message || "") | ||
} | ||
} | ||
|
||
export { | ||
BadInputError | ||
} |
Oops, something went wrong.