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

got

Package Overview
Dependencies
Maintainers
2
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

got - npm Package Compare versions

Comparing version 11.0.3 to 11.1.0

13

dist/source/as-promise/types.d.ts

@@ -31,13 +31,14 @@ /// <reference types="node" />

}
export interface PaginationOptions<T> {
export interface PaginationOptions<T, R> {
pagination?: {
transform?: (response: Response) => Promise<T[]> | T[];
transform?: (response: Response<R>) => Promise<T[]> | T[];
filter?: (item: T, allItems: T[], currentItems: T[]) => boolean;
paginate?: (response: Response, allItems: T[], currentItems: T[]) => Options | false;
paginate?: (response: Response<R>, allItems: T[], currentItems: T[]) => Options | false;
shouldContinue?: (item: T, allItems: T[], currentItems: T[]) => boolean;
countLimit?: number;
requestLimit?: number;
stackAllItems?: boolean;
};
}
export interface Options extends RequestOptions, PaginationOptions<unknown> {
export interface Options extends RequestOptions, PaginationOptions<unknown, unknown> {
hooks?: Hooks;

@@ -57,3 +58,3 @@ responseType?: ResponseType;

encoding?: BufferEncoding;
pagination?: Required<PaginationOptions<unknown>['pagination']>;
pagination?: Required<PaginationOptions<unknown, unknown>['pagination']>;
}

@@ -66,3 +67,3 @@ export interface Defaults extends RequestDefaults {

isStream: boolean;
pagination?: Required<PaginationOptions<unknown>['pagination']>;
pagination?: Required<PaginationOptions<unknown, unknown>['pagination']>;
}

@@ -69,0 +70,0 @@ export declare class ParseError extends RequestError {

@@ -535,3 +535,3 @@ "use strict";

// Set non-enumerable properties
setNonEnumerableProperties([defaults, options], options);
setNonEnumerableProperties([defaults, rawOptions], options);
return options;

@@ -538,0 +538,0 @@ }

@@ -143,2 +143,3 @@ "use strict";

const all = [];
let { countLimit } = pagination;
let numberOfRequests = 0;

@@ -158,5 +159,7 @@ while (numberOfRequests < pagination.requestLimit) {

yield item;
all.push(item);
if (pagination.stackAllItems) {
all.push(item);
}
current.push(item);
if (all.length === pagination.countLimit) {
if (--countLimit <= 0) {
return;

@@ -163,0 +166,0 @@ }

@@ -108,3 +108,4 @@ "use strict";

countLimit: Infinity,
requestLimit: 10000
requestLimit: 10000,
stackAllItems: true
}

@@ -111,0 +112,0 @@ },

@@ -42,8 +42,8 @@ /// <reference types="node" />

};
export declare type OptionsWithPagination<T = unknown> = Merge<Options, PaginationOptions<T>>;
export declare type OptionsWithPagination<T = unknown, R = unknown> = Merge<Options, PaginationOptions<T, R>>;
export interface GotPaginate {
<T>(url: string | URL, options?: OptionsWithPagination<T>): AsyncIterableIterator<T>;
all<T>(url: string | URL, options?: OptionsWithPagination<T>): Promise<T[]>;
<T>(options?: OptionsWithPagination<T>): AsyncIterableIterator<T>;
all<T>(options?: OptionsWithPagination<T>): Promise<T[]>;
<T, R = unknown>(url: string | URL, options?: OptionsWithPagination<T, R>): AsyncIterableIterator<T>;
all<T, R = unknown>(url: string | URL, options?: OptionsWithPagination<T, R>): Promise<T[]>;
<T, R = unknown>(options?: OptionsWithPagination<T, R>): AsyncIterableIterator<T>;
all<T, R = unknown>(options?: OptionsWithPagination<T, R>): Promise<T[]>;
}

@@ -50,0 +50,0 @@ export interface GotRequestFunction {

{
"name": "got",
"version": "11.0.3",
"version": "11.1.0",
"description": "Human-friendly and powerful HTTP request library for Node.js",

@@ -5,0 +5,0 @@ "license": "MIT",

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

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