@octokit/plugin-throttling
Advanced tools
Comparing version 2.7.1 to 3.0.0
{ | ||
"name": "@octokit/plugin-throttling", | ||
"version": "2.7.1", | ||
"publishConfig": { | ||
"access": "public", | ||
"tag": "latest" | ||
"description": "Octokit plugin for GitHub’s recommended request throttling", | ||
"version": "3.0.0", | ||
"license": "MIT", | ||
"files": [ | ||
"dist-*/", | ||
"bin/" | ||
], | ||
"pika": true, | ||
"sideEffects": false, | ||
"homepage": "https://github.com/octokit/plugin-throttling.js#readme", | ||
"bugs": { | ||
"url": "https://github.com/octokit/plugin-throttling.js/issues" | ||
}, | ||
"description": "Automatic rate limiting plugin for octokit", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"coverage": "nyc report --reporter=html && open coverage/index.html", | ||
"pretest": "standard", | ||
"test": "nyc mocha test/integration/", | ||
"update-endpoints": "npm-run-all update-endpoints:*", | ||
"update-endpoints:fetch-json": "node scripts/update-endpoints/fetch-json", | ||
"update-endpoints:code": "node scripts/update-endpoints/code" | ||
}, | ||
"repository": { | ||
@@ -22,33 +20,31 @@ "type": "git", | ||
}, | ||
"author": "Simon Grondin (http://github.com/SGrondin)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/octokit/plugin-throttling.js/issues" | ||
}, | ||
"homepage": "https://github.com/octokit/plugin-throttling.js#readme", | ||
"standard": { | ||
"globals": [ | ||
"describe", | ||
"before", | ||
"beforeEach", | ||
"afterEach", | ||
"after", | ||
"it", | ||
"expect" | ||
] | ||
}, | ||
"dependencies": { | ||
"bottleneck": "^2.15.3" | ||
"bottleneck": "^2.15.3", | ||
"@octokit/types": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"@octokit/graphql": "^4.2.0", | ||
"@octokit/core": "^2.0.0", | ||
"@octokit/request-error": "^1.0.2", | ||
"@octokit/rest": "^16.3.0", | ||
"chai": "^4.2.0", | ||
"mocha": "^6.0.2", | ||
"npm-run-all": "^4.1.5", | ||
"nyc": "^14.0.0", | ||
"semantic-release": "^15.13.25", | ||
"standard": "^14.0.2" | ||
} | ||
"@pika/pack": "^0.5.0", | ||
"@pika/plugin-build-node": "^0.8.1", | ||
"@pika/plugin-build-web": "^0.8.1", | ||
"@pika/plugin-ts-standard-pkg": "^0.8.1", | ||
"@types/fetch-mock": "^7.3.1", | ||
"@types/jest": "^24.0.18", | ||
"@types/node": "^13.1.0", | ||
"fetch-mock": "^8.0.0", | ||
"jest": "^24.9.0", | ||
"prettier": "^1.18.2", | ||
"semantic-release": "^16.0.0", | ||
"semantic-release-plugin-update-version-in-files": "^1.0.0", | ||
"ts-jest": "^24.1.0", | ||
"typescript": "^3.7.2" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"source": "dist-src/index.js", | ||
"types": "dist-types/index.d.ts", | ||
"main": "dist-node/index.js", | ||
"module": "dist-web/index.js" | ||
} |
@@ -5,4 +5,4 @@ # plugin-throttling.js | ||
[![npm](https://img.shields.io/npm/v/@octokit/plugin-throttling.svg)](https://www.npmjs.com/package/@octokit/plugin-throttling) | ||
![Build Status](https://github.com/octokit/plugin-throttling.js/workflows/Test/badge.svg) | ||
[![@latest](https://img.shields.io/npm/v/@octokit/plugin-throttling.svg)](https://www.npmjs.com/package/@octokit/plugin-throttling) | ||
[![Build Status](https://github.com/octokit/plugin-throttling.js/workflows/Test/badge.svg)](https://github.com/octokit/plugin-throttling.js/actions?workflow=Test) | ||
[![Greenkeeper](https://badges.greenkeeper.io/octokit/plugin-throttling.js.svg)](https://greenkeeper.io/) | ||
@@ -14,2 +14,33 @@ | ||
<table> | ||
<tbody valign=top align=left> | ||
<tr><th> | ||
Browsers | ||
</th><td width=100%> | ||
Load `@octokit/plugin-throttling` and [`@octokit/core`](https://github.com/octokit/core.js) (or core-compatible module) directly from [cdn.pika.dev](https://cdn.pika.dev) | ||
```html | ||
<script type="module"> | ||
import { Octokit } from "https://cdn.pika.dev/@octokit/core"; | ||
import { throttling } from "https://cdn.pika.dev/@octokit/plugin-throttling"; | ||
</script> | ||
``` | ||
</td></tr> | ||
<tr><th> | ||
Node | ||
</th><td> | ||
Install with `npm install @octokit/core @octokit/plugin-throttling`. Optionally replace `@octokit/core` with a core-compatible module | ||
```js | ||
const { Octokit } = require("@octokit/core"); | ||
const { throttling } = require("@octokit/plugin-throttling"); | ||
``` | ||
</td></tr> | ||
</tbody> | ||
</table> | ||
The code below creates a "Hello, world!" issue on every repository in a given organization. Without the throttling plugin it would send many requests in parallel and would hit rate limits very quickly. But the `@octokit/plugin-throttling` slows down your requests according to the official guidelines, so you don't get blocked before your quota is exhausted. | ||
@@ -20,7 +51,7 @@ | ||
```js | ||
const Octokit = require('@octokit/rest') | ||
.plugin(require('@octokit/plugin-throttling')) | ||
const MyOctokit = Octokit.plugin(throttling); | ||
const octokit = new MyOctokit({ auth: "secret123" }); | ||
const octokit = new Octokit({ | ||
auth: `token ${process.env.TOKEN}`, | ||
const octokit = new MyOctokit({ | ||
auth: `secret123`, | ||
throttle: { | ||
@@ -82,3 +113,4 @@ onRateLimit: (retryAfter, options) => { | ||
const octokit = new Octokit({ | ||
const octokit = new MyOctokit({ | ||
auth: 'secret123' | ||
throttle: { | ||
@@ -85,0 +117,0 @@ onAbuseLimit: (retryAfter, options) => { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
150
0
65835
2
16
17
675
1
1
+ Added@octokit/types@^2.0.1
+ Added@octokit/types@2.16.2(transitive)
+ Added@types/node@22.9.0(transitive)
+ Addedundici-types@6.19.8(transitive)