@octokit/plugin-paginate-rest
Advanced tools
Comparing version 2.13.3 to 2.13.4
@@ -5,3 +5,3 @@ 'use strict'; | ||
const VERSION = "2.13.3"; | ||
const VERSION = "2.13.4"; | ||
@@ -8,0 +8,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
export const VERSION = "2.13.3"; | ||
export const VERSION = "2.13.4"; |
@@ -24,4 +24,4 @@ import { Octokit } from "@octokit/core"; | ||
declare type DataType<T> = "data" extends keyof T ? T["data"] : unknown; | ||
export interface MapFunction<T = OctokitTypes.OctokitResponse<PaginationResults<unknown>>, R = unknown[]> { | ||
(response: T, done: () => void): R; | ||
export interface MapFunction<T = OctokitTypes.OctokitResponse<PaginationResults<unknown>>, M = unknown[]> { | ||
(response: T, done: () => void): M; | ||
} | ||
@@ -36,3 +36,3 @@ export declare type PaginationResults<T = unknown> = T[]; | ||
*/ | ||
<T, R>(options: OctokitTypes.EndpointOptions, mapFn: MapFunction<OctokitTypes.OctokitResponse<PaginationResults<T>>, R[]>): Promise<PaginationResults<R>>; | ||
<T, M>(options: OctokitTypes.EndpointOptions, mapFn: MapFunction<OctokitTypes.OctokitResponse<PaginationResults<T>>, M[]>): Promise<PaginationResults<M>>; | ||
/** | ||
@@ -50,3 +50,3 @@ * Paginate a request using endpoint options | ||
*/ | ||
<R extends keyof PaginatingEndpoints, MR extends unknown[]>(route: R, mapFn: MapFunction<PaginatingEndpoints[R]["response"], MR>): Promise<MR>; | ||
<R extends keyof PaginatingEndpoints, M extends unknown[]>(route: R, mapFn: MapFunction<PaginatingEndpoints[R]["response"], M>): Promise<M>; | ||
/** | ||
@@ -59,3 +59,3 @@ * Paginate a request using a known endpoint route string and parameters, and map each response to a custom array | ||
*/ | ||
<R extends keyof PaginatingEndpoints, MR extends unknown[]>(route: R, parameters: PaginatingEndpoints[R]["parameters"], mapFn: MapFunction<PaginatingEndpoints[R]["response"], MR>): Promise<MR>; | ||
<R extends keyof PaginatingEndpoints, M extends unknown[]>(route: R, parameters: PaginatingEndpoints[R]["parameters"], mapFn: MapFunction<PaginatingEndpoints[R]["response"], M>): Promise<M>; | ||
/** | ||
@@ -81,3 +81,3 @@ * Paginate a request using an known endpoint route string | ||
*/ | ||
<R extends OctokitTypes.RequestInterface, MR extends unknown[]>(request: R, mapFn: MapFunction<NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, MR>): Promise<MR>; | ||
<R extends OctokitTypes.RequestInterface, M extends unknown[]>(request: R, mapFn: MapFunction<NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, M>): Promise<M>; | ||
/** | ||
@@ -90,3 +90,3 @@ * Paginate a request using an endpoint method, parameters, and a map function | ||
*/ | ||
<R extends OctokitTypes.RequestInterface, MR extends unknown[]>(request: R, parameters: Parameters<R>[0], mapFn: MapFunction<NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, MR>): Promise<MR>; | ||
<R extends OctokitTypes.RequestInterface, M extends unknown[]>(request: R, parameters: Parameters<R>[0], mapFn: MapFunction<NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, M>): Promise<M>; | ||
/** | ||
@@ -141,3 +141,3 @@ * Paginate a request using an endpoint method and parameters | ||
*/ | ||
<T, R>(octokit: Octokit, options: OctokitTypes.EndpointOptions, mapFn: MapFunction<OctokitTypes.OctokitResponse<PaginationResults<T>>, R[]>): Promise<PaginationResults<R>>; | ||
<T, M>(octokit: Octokit, options: OctokitTypes.EndpointOptions, mapFn: MapFunction<OctokitTypes.OctokitResponse<PaginationResults<T>>, M[]>): Promise<PaginationResults<M>>; | ||
/** | ||
@@ -157,3 +157,3 @@ * Paginate a request using endpoint options | ||
*/ | ||
<R extends keyof PaginatingEndpoints, MR extends unknown[]>(octokit: Octokit, route: R, mapFn: MapFunction<PaginatingEndpoints[R]["response"], MR>): Promise<MR>; | ||
<R extends keyof PaginatingEndpoints, M extends unknown[]>(octokit: Octokit, route: R, mapFn: MapFunction<PaginatingEndpoints[R]["response"], M>): Promise<M>; | ||
/** | ||
@@ -167,3 +167,3 @@ * Paginate a request using a known endpoint route string and parameters, and map each response to a custom array | ||
*/ | ||
<R extends keyof PaginatingEndpoints, MR extends unknown[]>(octokit: Octokit, route: R, parameters: PaginatingEndpoints[R]["parameters"], mapFn: MapFunction<PaginatingEndpoints[R]["response"], MR>): Promise<MR>; | ||
<R extends keyof PaginatingEndpoints, M extends unknown[]>(octokit: Octokit, route: R, parameters: PaginatingEndpoints[R]["parameters"], mapFn: MapFunction<PaginatingEndpoints[R]["response"], M>): Promise<M>; | ||
/** | ||
@@ -192,3 +192,3 @@ * Paginate a request using an known endpoint route string | ||
*/ | ||
<R extends OctokitTypes.RequestInterface, MR extends unknown[]>(octokit: Octokit, request: R, mapFn: MapFunction<NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, MR>): Promise<MR>; | ||
<R extends OctokitTypes.RequestInterface, M extends unknown[]>(octokit: Octokit, request: R, mapFn: MapFunction<NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, M>): Promise<M>; | ||
/** | ||
@@ -202,3 +202,3 @@ * Paginate a request using an endpoint method, parameters, and a map function | ||
*/ | ||
<R extends OctokitTypes.RequestInterface, MR extends unknown[]>(octokit: Octokit, request: R, parameters: Parameters<R>[0], mapFn: MapFunction<NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, MR>): Promise<MR>; | ||
<R extends OctokitTypes.RequestInterface, M extends unknown[]>(octokit: Octokit, request: R, parameters: Parameters<R>[0], mapFn: MapFunction<NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, M>): Promise<M>; | ||
/** | ||
@@ -205,0 +205,0 @@ * Paginate a request using an endpoint method and parameters |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "2.13.3"; | ||
export declare const VERSION = "2.13.4"; |
@@ -1,2 +0,2 @@ | ||
const VERSION = "2.13.3"; | ||
const VERSION = "2.13.4"; | ||
@@ -3,0 +3,0 @@ /** |
{ | ||
"name": "@octokit/plugin-paginate-rest", | ||
"description": "Octokit plugin to paginate REST API endpoint responses", | ||
"version": "2.13.3", | ||
"version": "2.13.4", | ||
"license": "MIT", | ||
@@ -20,3 +20,3 @@ "files": [ | ||
"dependencies": { | ||
"@octokit/types": "^6.11.0" | ||
"@octokit/types": "^6.13.0" | ||
}, | ||
@@ -28,3 +28,3 @@ "peerDependencies": { | ||
"@octokit/core": "^3.0.0", | ||
"@octokit/plugin-rest-endpoint-methods": "^4.0.0", | ||
"@octokit/plugin-rest-endpoint-methods": "^5.0.0", | ||
"@pika/pack": "^0.5.0", | ||
@@ -38,8 +38,8 @@ "@pika/plugin-build-node": "^0.9.0", | ||
"fetch-mock": "^9.0.0", | ||
"jest": "^26.0.1", | ||
"jest": "^27.0.0", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.0.4", | ||
"prettier": "2.3.1", | ||
"semantic-release": "^17.0.0", | ||
"semantic-release-plugin-update-version-in-files": "^1.0.0", | ||
"ts-jest": "^26.0.0", | ||
"ts-jest": "^27.0.0-next.12", | ||
"typescript": "^4.0.2" | ||
@@ -46,0 +46,0 @@ }, |
@@ -120,3 +120,3 @@ # plugin-paginate-rest.js | ||
```js | ||
const issues = await octokit.paginate(octokit.issues.listForRepo, { | ||
const issues = await octokit.paginate(octokit.rest.issues.listForRepo, { | ||
owner: "octocat", | ||
@@ -160,3 +160,3 @@ repo: "hello-world", | ||
for await (const response of octokit.paginate.iterator( | ||
octokit.issues.listForRepo, | ||
octokit.rest.issues.listForRepo, | ||
parameters | ||
@@ -197,3 +197,2 @@ )) { | ||
<tr><th> | ||
<tr><th> | ||
Types | ||
@@ -200,0 +199,0 @@ </th><td> |
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
183603
270
Updated@octokit/types@^6.13.0