@crawlee/http 4.0.0-beta.134 → 4.0.0-beta.136

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,9 @@
1
1
  import { Transform } from 'node:stream';
2
2
  import type { BasicCrawlerOptions } from '@crawlee/basic';
3
3
  import { BasicCrawler } from '@crawlee/basic';
4
- import type { CrawlingContext, LoadedRequest, Request } from '@crawlee/core';
5
- import { ResponseWithUrl } from '@crawlee/http-client';
4
+ import type { ContextPipeline, CrawlingContext, LoadedRequest, Request } from '@crawlee/core';
6
5
  import type { Dictionary } from '@crawlee/types';
7
6
  import type { ErrorHandler, GetUserDataFromRequest, InternalHttpHook, RequestHandler, RouterRoutes } from '../index.js';
8
- declare const kBodyDrained: unique symbol;
9
7
  export type FileDownloadErrorHandler<UserData extends Dictionary = any, // with default to Dictionary we cant use a typed router in untyped crawler
10
8
  ContextExtension = Dictionary<never>> = ErrorHandler<CrawlingContext, FileDownloadCrawlingContext<UserData> & ContextExtension>;
11
9
  export type FileDownloadHook<UserData extends Dictionary = any> = InternalHttpHook<FileDownloadCrawlingContext<UserData>>;
@@ -88,16 +86,7 @@ export declare function ByteCounterStream({ logTransferredBytes, loggingInterval
88
86
  */
89
87
  export declare class FileDownload extends BasicCrawler<FileDownloadCrawlingContext> {
90
88
  constructor(options?: BasicCrawlerOptions<FileDownloadCrawlingContext>);
91
- // @ts-ignore optional peer dependency or compatibility with es2022
92
- protected buildContextPipeline(): import("@crawlee/basic").ContextPipeline<CrawlingContext<Dictionary>, CrawlingContext<Dictionary> & {
93
- request: LoadedRequest<Request>;
94
- response: ResponseWithUrl;
95
- contentType: {
96
- type: string;
97
- encoding: BufferEncoding;
98
- };
99
- [kBodyDrained]: Promise<void>;
100
- }>;
89
+ protected buildContextPipeline(): ContextPipeline<CrawlingContext, FileDownloadCrawlingContext>;
101
90
  private initiateDownload;
102
91
  }
103
92
  /**
@@ -126,4 +115,3 @@ export declare class FileDownload extends BasicCrawler<FileDownloadCrawlingConte
126
115
  */
127
116
  // @ts-ignore optional peer dependency or compatibility with es2022
128
117
  export declare function createFileRouter<Context extends FileDownloadCrawlingContext = FileDownloadCrawlingContext, UserData extends Dictionary = GetUserDataFromRequest<Context['request']>>(routes?: RouterRoutes<Context, UserData>): import("@crawlee/basic").RouterHandler<Context, Record<string, GetUserDataFromRequest<Context["request"]>>>;
129
- export {};
@@ -2,7 +2,7 @@ import type { BasicCrawlerOptions, ConcurrencySystem, ConcurrencySystemOptions,
2
2
  import { BasicCrawler, ContextPipeline } from '@crawlee/basic';
3
3
  import { type LoadedRequest } from '@crawlee/core';
4
4
  import type { Awaitable, Dictionary } from '@crawlee/types';
5
- import { type CheerioRoot } from '@crawlee/utils/internal';
5
+ import type { CheerioAPI } from 'cheerio';
6
6
  import type { JsonValue } from 'type-fest';
7
7
  import { z } from 'zod';
8
8
  /**
@@ -172,7 +172,7 @@ JSONData extends JsonValue = any> extends CrawlingContextWithResponse<UserData>
172
172
  * });
173
173
  * ```
174
174
  */
175
- parseWithCheerio(selector?: string, timeoutMs?: number): Promise<CheerioRoot>;
175
+ parseWithCheerio(selector?: string, timeoutMs?: number): Promise<CheerioAPI>;
176
176
  }
177
177
  export interface HttpCrawlingContext<UserData extends Dictionary = any, JSONData extends JsonValue = any> extends InternalHttpCrawlingContext<UserData, JSONData> {
178
178
  }
@@ -249,6 +249,9 @@ JSONData extends JsonValue = any> = RequestHandler<HttpCrawlingContext<UserData,
249
249
  */
250
250
  export declare class HttpCrawler<Context extends InternalHttpCrawlingContext<any, any> = InternalHttpCrawlingContext, ContextExtension = Dictionary<never>, ExtendedContext extends Context = Context & ContextExtension, Routes extends Record<keyof Routes, Dictionary> = Record<string, GetUserDataFromRequest<Context['request']>>, StatisticStateExtension extends object = {}> extends BasicCrawler<Context, ContextExtension, ExtendedContext, Routes, StatisticStateExtension> {
251
251
  #private;
252
+ /**
253
+ * @internal
254
+ */
252
255
  protected static optionsShape: {
253
256
  navigationTimeoutSecs: z.ZodDefault<z.ZodCustom<number, number>>;
254
257
  ignoreTlsErrors: z.ZodDefault<z.ZodBoolean>;
@@ -304,6 +307,7 @@ export declare class HttpCrawler<Context extends InternalHttpCrawlingContext<any
304
307
  statistics: z.ZodOptional<z.ZodCustom<Dictionary, Dictionary>>;
305
308
  id: z.ZodOptional<z.ZodString>;
306
309
  };
310
+ /** @internal */
307
311
  protected static optionsSchema: z.ZodObject<{
308
312
  navigationTimeoutSecs: z.ZodDefault<z.ZodCustom<number, number>>;
309
313
  ignoreTlsErrors: z.ZodDefault<z.ZodBoolean>;
@@ -1,9 +1,9 @@
1
1
  import { Readable } from 'node:stream';
2
2
  import util from 'node:util';
3
3
  import { BasicCrawler, ContextPipeline, NavigationSkippedError, remainingNavigationWindowMillis, RequestState, Router, SessionError, } from '@crawlee/basic';
4
- import { RequestThrottledError, getCookiesFromResponse, parseArgument, schemas, } from '@crawlee/core';
4
+ import { RequestThrottledError, getCookiesFromResponse } from '@crawlee/core';
5
5
  import { ResponseWithUrl } from '@crawlee/http-client';
6
- import { RETRY_CSS_SELECTORS } from '@crawlee/utils/internal';
6
+ import { parseArgument, RETRY_CSS_SELECTORS, schemas } from '@crawlee/utils/internal';
7
7
  import contentTypeParser from 'content-type';
8
8
  import iconv from 'iconv-lite';
9
9
  import { z } from 'zod';
@@ -117,6 +117,9 @@ export class HttpCrawler extends BasicCrawler {
117
117
  #suggestResponseEncoding;
118
118
  #forceResponseEncoding;
119
119
  #supportedMimeTypes;
120
+ /**
121
+ * @internal
122
+ */
120
123
  static optionsShape = {
121
124
  ...BasicCrawler.optionsShape,
122
125
  navigationTimeoutSecs: schemas.anyNumber.default(30),
@@ -128,6 +131,7 @@ export class HttpCrawler extends BasicCrawler {
128
131
  preNavigationHooks: schemas.anyArray.default(() => []),
129
132
  postNavigationHooks: schemas.anyArray.default(() => []),
130
133
  };
134
+ /** @internal */
131
135
  static optionsSchema = z.strictObject(HttpCrawler.optionsShape);
132
136
  /**
133
137
  * All `HttpCrawlerOptions` parameters are passed via an options object.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/http",
3
- "version": "4.0.0-beta.134",
3
+ "version": "4.0.0-beta.136",
4
4
  "description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
5
5
  "engines": {
6
6
  "node": ">=22.0.0"
@@ -49,11 +49,11 @@
49
49
  "dependencies": {
50
50
  "@apify/timeout": "^0.4.4",
51
51
  "@apify/utilities": "^2.15.5",
52
- "@crawlee/basic": "4.0.0-beta.134",
53
- "@crawlee/core": "4.0.0-beta.134",
54
- "@crawlee/http-client": "4.0.0-beta.134",
55
- "@crawlee/types": "4.0.0-beta.134",
56
- "@crawlee/utils": "4.0.0-beta.134",
52
+ "@crawlee/basic": "4.0.0-beta.136",
53
+ "@crawlee/core": "4.0.0-beta.136",
54
+ "@crawlee/http-client": "4.0.0-beta.136",
55
+ "@crawlee/types": "4.0.0-beta.136",
56
+ "@crawlee/utils": "4.0.0-beta.136",
57
57
  "@types/content-type": "^1.1.8",
58
58
  "cheerio": "^1.0.0",
59
59
  "content-type": "^1.0.5",
@@ -70,5 +70,5 @@
70
70
  }
71
71
  }
72
72
  },
73
- "gitHead": "0f269d5b24ec2829f3d44c19a35973fa20d95999"
73
+ "gitHead": "d425bb9841885b4b71b84ae6fb0bafbdc4a7e978"
74
74
  }