Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@octokit/plugin-paginate-rest

Package Overview
Dependencies
Maintainers
2
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/plugin-paginate-rest - npm Package Compare versions

Comparing version 2.6.0 to 2.6.1

2

dist-node/index.js

@@ -5,3 +5,3 @@ 'use strict';

const VERSION = "2.6.0";
const VERSION = "2.6.1";

@@ -8,0 +8,0 @@ /**

@@ -1,1 +0,1 @@

export const VERSION = "2.6.0";
export const VERSION = "2.6.1";

@@ -9,3 +9,3 @@ import { Octokit } from "@octokit/core";

} | {
value: import("@octokit/types/dist-types/OctokitResponse").OctokitResponse<any>;
value: import("@octokit/types/dist-types/OctokitResponse").OctokitResponse<any, number>;
done?: undefined;

@@ -12,0 +12,0 @@ }>;

@@ -22,2 +22,3 @@ import { Octokit } from "@octokit/core";

};
declare type DataType<T> = "data" extends keyof T ? T["data"] : unknown;
export interface MapFunction<T = unknown, R = unknown> {

@@ -44,3 +45,3 @@ (response: OctokitTypes.OctokitResponse<PaginationResults<T>>, done: () => void): R[];

*
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {function} mapFn Optional method to map each response to a custom array

@@ -52,3 +53,3 @@ */

*
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {object} parameters URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.

@@ -61,10 +62,10 @@ * @param {function} mapFn Optional method to map each response to a custom array

*
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {object} parameters? URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<R extends keyof PaginatingEndpoints>(route: R, parameters?: PaginatingEndpoints[R]["parameters"]): Promise<PaginatingEndpoints[R]["response"]["data"]>;
<R extends keyof PaginatingEndpoints>(route: R, parameters?: PaginatingEndpoints[R]["parameters"]): Promise<DataType<PaginatingEndpoints[R]["response"]>>;
/**
* Paginate a request using an unknown endpoint route string
*
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {object} parameters? URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.

@@ -107,6 +108,6 @@ */

* @see {link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of} for await...of
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<R extends keyof PaginatingEndpoints>(route: R, parameters?: PaginatingEndpoints[R]["parameters"]): AsyncIterableIterator<OctokitTypes.OctokitResponse<PaginatingEndpoints[R]["response"]["data"]>>;
<R extends keyof PaginatingEndpoints>(route: R, parameters?: PaginatingEndpoints[R]["parameters"]): AsyncIterableIterator<OctokitTypes.OctokitResponse<DataType<PaginatingEndpoints[R]["response"]>>>;
/**

@@ -116,3 +117,3 @@ * Get an async iterator to paginate a request using an unknown endpoint route string and optional parameters

* @see {link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of} for await...of
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.

@@ -151,3 +152,3 @@ */

* @param {object} octokit Octokit instance
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {function} mapFn Optional method to map each response to a custom array

@@ -160,3 +161,3 @@ */

* @param {object} octokit Octokit instance
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {object} parameters URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.

@@ -170,6 +171,6 @@ * @param {function} mapFn Optional method to map each response to a custom array

* @param {object} octokit Octokit instance
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {object} parameters? URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<R extends keyof PaginatingEndpoints>(octokit: Octokit, route: R, parameters?: PaginatingEndpoints[R]["parameters"]): Promise<PaginatingEndpoints[R]["response"]["data"]>;
<R extends keyof PaginatingEndpoints>(octokit: Octokit, route: R, parameters?: PaginatingEndpoints[R]["parameters"]): Promise<DataType<PaginatingEndpoints[R]["response"]>>;
/**

@@ -179,3 +180,3 @@ * Paginate a request using an unknown endpoint route string

* @param {object} octokit Octokit instance
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {object} parameters? URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.

@@ -225,6 +226,6 @@ */

* @param {object} octokit Octokit instance
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
*/
<R extends keyof PaginatingEndpoints>(octokit: Octokit, route: R, parameters?: PaginatingEndpoints[R]["parameters"]): AsyncIterableIterator<OctokitTypes.OctokitResponse<PaginatingEndpoints[R]["response"]["data"]>>;
<R extends keyof PaginatingEndpoints>(octokit: Octokit, route: R, parameters?: PaginatingEndpoints[R]["parameters"]): AsyncIterableIterator<OctokitTypes.OctokitResponse<DataType<PaginatingEndpoints[R]["response"]>>>;
/**

@@ -236,3 +237,3 @@ * Get an async iterator to paginate a request using an unknown endpoint route string and optional parameters

* @param {object} octokit Octokit instance
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'`
* @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.

@@ -239,0 +240,0 @@ */

@@ -1,1 +0,1 @@

export declare const VERSION = "2.6.0";
export declare const VERSION = "2.6.1";

@@ -1,2 +0,2 @@

const VERSION = "2.6.0";
const VERSION = "2.6.1";

@@ -3,0 +3,0 @@ /**

{
"name": "@octokit/plugin-paginate-rest",
"description": "Octokit plugin to paginate REST API endpoint responses",
"version": "2.6.0",
"version": "2.6.1",
"license": "MIT",

@@ -20,3 +20,3 @@ "files": [

"dependencies": {
"@octokit/types": "^5.5.0"
"@octokit/types": "^6.0.1"
},

@@ -23,0 +23,0 @@ "peerDependencies": {

@@ -21,3 +21,6 @@ # plugin-paginate-rest.js

import { Octokit } from "https://cdn.skypack.dev/@octokit/core";
import { paginateRest } from "https://cdn.skypack.dev/@octokit/plugin-paginate-rest";
import {
paginateRest,
composePaginateRest,
} from "https://cdn.skypack.dev/@octokit/plugin-paginate-rest";
</script>

@@ -35,3 +38,6 @@ ```

const { Octokit } = require("@octokit/core");
const { paginateRest } = require("@octokit/plugin-paginate-rest");
const {
paginateRest,
composePaginateRest,
} = require("@octokit/plugin-paginate-rest");
```

@@ -48,3 +54,3 @@

// See https://developer.github.com/v3/issues/#list-issues-for-a-repository
const issues = await octokit.paginate("GET /repos/:owner/:repo/issues", {
const issues = await octokit.paginate("GET /repos/{owner}/{repo}/issues", {
owner: "octocat",

@@ -57,2 +63,18 @@ repo: "hello-world",

If you want to utilize the pagination methods in another plugin, use `composePaginateRest`.
```js
function myPlugin(octokit, options) {
return {
allStars({owner, repo}) => {
return composePaginateRest(
octokit,
"GET /repos/{owner}/{repo}/stargazers",
{owner, repo }
)
}
}
}
```
## `octokit.paginate()`

@@ -68,3 +90,3 @@

const issueTitles = await octokit.paginate(
"GET /repos/:owner/:repo/issues",
"GET /repos/{owner}/{repo}/issues",
{

@@ -84,3 +106,3 @@ owner: "octocat",

const issues = await octokit.paginate(
"GET /repos/:owner/:repo/issues",
"GET /repos/{owner}/{repo}/issues",
{

@@ -124,3 +146,3 @@ owner: "octocat",

for await (const response of octokit.paginate.iterator(
"GET /repos/:owner/:repo/issues",
"GET /repos/{owner}/{repo}/issues",
parameters

@@ -151,2 +173,6 @@ )) {

## `composePaginateRest` and `composePaginateRest.iterator`
The `compose*` methods work just like their `octokit.*` counterparts described above, with the differenct that both methods require an `octokit` instance to be passed as first argument
## How it works

@@ -153,0 +179,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc