@octokit/plugin-paginate-rest
Advanced tools
Comparing version 2.13.0 to 2.13.1
@@ -5,3 +5,3 @@ 'use strict'; | ||
const VERSION = "2.13.0"; | ||
const VERSION = "2.13.1"; | ||
@@ -8,0 +8,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
export const VERSION = "2.13.0"; | ||
export const VERSION = "2.13.1"; |
@@ -24,4 +24,4 @@ import { Octokit } from "@octokit/core"; | ||
declare type DataType<T> = "data" extends keyof T ? T["data"] : unknown; | ||
export interface MapFunction<T = unknown, R = unknown> { | ||
(response: OctokitTypes.OctokitResponse<PaginationResults<T>>, done: () => void): R[]; | ||
export interface MapFunction<T = OctokitTypes.OctokitResponse<PaginationResults<unknown>>, R = unknown[]> { | ||
(response: T, done: () => void): R; | ||
} | ||
@@ -36,3 +36,3 @@ export declare type PaginationResults<T = unknown> = T[]; | ||
*/ | ||
<T, R>(options: OctokitTypes.EndpointOptions, mapFn: MapFunction<T, R>): Promise<PaginationResults<R>>; | ||
<T, R>(options: OctokitTypes.EndpointOptions, mapFn: MapFunction<OctokitTypes.OctokitResponse<PaginationResults<T>>, R[]>): Promise<PaginationResults<R>>; | ||
/** | ||
@@ -50,3 +50,3 @@ * Paginate a request using endpoint options | ||
*/ | ||
<R extends keyof PaginatingEndpoints, MR extends unknown[]>(route: R, mapFn: (response: PaginatingEndpoints[R]["response"], done: () => void) => MR): Promise<MR>; | ||
<R extends keyof PaginatingEndpoints, MR extends unknown[]>(route: R, mapFn: MapFunction<PaginatingEndpoints[R]["response"], MR>): Promise<MR>; | ||
/** | ||
@@ -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: (response: PaginatingEndpoints[R]["response"], done: () => void) => MR): Promise<MR>; | ||
<R extends keyof PaginatingEndpoints, MR extends unknown[]>(route: R, parameters: PaginatingEndpoints[R]["parameters"], mapFn: MapFunction<PaginatingEndpoints[R]["response"], MR>): Promise<MR>; | ||
/** | ||
@@ -81,3 +81,3 @@ * Paginate a request using an known endpoint route string | ||
*/ | ||
<R extends OctokitTypes.RequestInterface, MR extends unknown[]>(request: R, mapFn: (response: NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, done: () => void) => MR): Promise<MR>; | ||
<R extends OctokitTypes.RequestInterface, MR extends unknown[]>(request: R, mapFn: MapFunction<NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, MR>): Promise<MR>; | ||
/** | ||
@@ -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: (response: NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, done: () => void) => MR): Promise<MR>; | ||
<R extends OctokitTypes.RequestInterface, MR extends unknown[]>(request: R, parameters: Parameters<R>[0], mapFn: MapFunction<NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, MR>): Promise<MR>; | ||
/** | ||
@@ -141,3 +141,3 @@ * Paginate a request using an endpoint method and parameters | ||
*/ | ||
<T, R>(octokit: Octokit, options: OctokitTypes.EndpointOptions, mapFn: MapFunction<T, R>): Promise<PaginationResults<R>>; | ||
<T, R>(octokit: Octokit, options: OctokitTypes.EndpointOptions, mapFn: MapFunction<OctokitTypes.OctokitResponse<PaginationResults<T>>, R[]>): Promise<PaginationResults<R>>; | ||
/** | ||
@@ -157,3 +157,3 @@ * Paginate a request using endpoint options | ||
*/ | ||
<R extends keyof PaginatingEndpoints, MR extends unknown[]>(octokit: Octokit, route: R, mapFn: (response: PaginatingEndpoints[R]["response"], done: () => void) => MR): Promise<MR>; | ||
<R extends keyof PaginatingEndpoints, MR extends unknown[]>(octokit: Octokit, route: R, mapFn: MapFunction<PaginatingEndpoints[R]["response"], MR>): Promise<MR>; | ||
/** | ||
@@ -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: (response: PaginatingEndpoints[R]["response"], done: () => void) => MR): Promise<MR>; | ||
<R extends keyof PaginatingEndpoints, MR extends unknown[]>(octokit: Octokit, route: R, parameters: PaginatingEndpoints[R]["parameters"], mapFn: MapFunction<PaginatingEndpoints[R]["response"], MR>): Promise<MR>; | ||
/** | ||
@@ -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: (response: NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, done: () => void) => MR): Promise<MR>; | ||
<R extends OctokitTypes.RequestInterface, MR extends unknown[]>(octokit: Octokit, request: R, mapFn: MapFunction<NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, MR>): Promise<MR>; | ||
/** | ||
@@ -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: (response: NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, done: () => void) => MR): Promise<MR>; | ||
<R extends OctokitTypes.RequestInterface, MR extends unknown[]>(octokit: Octokit, request: R, parameters: Parameters<R>[0], mapFn: MapFunction<NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, MR>): Promise<MR>; | ||
/** | ||
@@ -205,0 +205,0 @@ * Paginate a request using an endpoint method and parameters |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "2.13.0"; | ||
export declare const VERSION = "2.13.1"; |
@@ -1,2 +0,2 @@ | ||
const VERSION = "2.13.0"; | ||
const VERSION = "2.13.1"; | ||
@@ -3,0 +3,0 @@ /** |
{ | ||
"name": "@octokit/plugin-paginate-rest", | ||
"description": "Octokit plugin to paginate REST API endpoint responses", | ||
"version": "2.13.0", | ||
"version": "2.13.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
183600