@xberg-io/crawlberg-wasm 1.1.3 → 1.2.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xberg-io/crawlberg-wasm",
3
- "version": "1.1.3",
3
+ "version": "1.2.1",
4
4
  "private": false,
5
5
  "description": "High-performance web crawling engine",
6
6
  "license": "MIT",
@@ -290,7 +290,7 @@ export class WasmCrawlConfig {
290
290
  free(): void;
291
291
  [Symbol.dispose](): void;
292
292
  static default(): WasmCrawlConfig;
293
- constructor(respectRobotsTxt?: boolean | null, softHttpErrors?: boolean | null, stayOnDomain?: boolean | null, allowSubdomains?: boolean | null, includePaths?: string[] | null, excludePaths?: string[] | null, customHeaders?: any | null, requestTimeout?: bigint | null, maxRedirects?: number | null, retryCount?: number | null, retryCodes?: Uint16Array | null, cookiesEnabled?: boolean | null, removeTags?: string[] | null, content?: WasmContentConfig | null, downloadAssets?: boolean | null, assetTypes?: any[] | null, browser?: WasmBrowserConfig | null, userAgents?: string[] | null, captureScreenshot?: boolean | null, followDocumentUrls?: boolean | null, downloadDocuments?: boolean | null, documentMimeTypes?: string[] | null, saveBrowserProfile?: boolean | null, ssrf?: WasmSsrfPolicy | null, maxDepth?: number | null, maxPages?: number | null, maxConcurrent?: number | null, userAgent?: string | null, rateLimitMs?: bigint | null, auth?: any | null, maxBodySize?: number | null, mapLimit?: number | null, mapSearch?: string | null, maxAssetSize?: number | null, proxy?: WasmProxyConfig | null, documentUrlDepth?: number | null, documentMaxSize?: number | null, warcOutput?: string | null, browserProfile?: string | null);
293
+ constructor(respectRobotsTxt?: boolean | null, softHttpErrors?: boolean | null, stayOnDomain?: boolean | null, allowSubdomains?: boolean | null, includePaths?: string[] | null, excludePaths?: string[] | null, customHeaders?: any | null, requestTimeout?: bigint | null, maxRedirects?: number | null, retryCount?: number | null, retryCodes?: Uint16Array | null, cookiesEnabled?: boolean | null, removeTags?: string[] | null, content?: WasmContentConfig | null, downloadAssets?: boolean | null, assetTypes?: any[] | null, browser?: WasmBrowserConfig | null, userAgents?: string[] | null, captureScreenshot?: boolean | null, followDocumentUrls?: boolean | null, downloadDocuments?: boolean | null, documentMimeTypes?: string[] | null, saveBrowserProfile?: boolean | null, ssrf?: WasmSsrfPolicy | null, maxDepth?: number | null, maxPages?: number | null, maxLinksPerPage?: number | null, maxConcurrent?: number | null, userAgent?: string | null, rateLimitMs?: bigint | null, auth?: any | null, maxBodySize?: number | null, mapLimit?: number | null, mapSearch?: string | null, maxAssetSize?: number | null, proxy?: WasmProxyConfig | null, documentUrlDepth?: number | null, documentMaxSize?: number | null, documentOutputDir?: string | null, documentContentEncoding?: WasmDocumentContentEncoding | null, warcOutput?: string | null, browserProfile?: string | null, ssrfDenyPrivateExplicit?: boolean | null);
294
294
  /**
295
295
  * Validate the configuration, returning an error if any values are invalid.
296
296
  */
@@ -306,9 +306,13 @@ export class WasmCrawlConfig {
306
306
  content: WasmContentConfig;
307
307
  cookiesEnabled: boolean;
308
308
  customHeaders: any;
309
+ get documentContentEncoding(): string | undefined;
310
+ set documentContentEncoding(value: WasmDocumentContentEncoding | null | undefined);
309
311
  get documentMaxSize(): number | undefined;
310
312
  set documentMaxSize(value: number | null | undefined);
311
313
  documentMimeTypes: string[];
314
+ get documentOutputDir(): string | undefined;
315
+ set documentOutputDir(value: string | null | undefined);
312
316
  get documentUrlDepth(): number | undefined;
313
317
  set documentUrlDepth(value: number | null | undefined);
314
318
  downloadAssets: boolean;
@@ -328,6 +332,8 @@ export class WasmCrawlConfig {
328
332
  set maxConcurrent(value: number | null | undefined);
329
333
  get maxDepth(): number | undefined;
330
334
  set maxDepth(value: number | null | undefined);
335
+ get maxLinksPerPage(): number | undefined;
336
+ set maxLinksPerPage(value: number | null | undefined);
331
337
  get maxPages(): number | undefined;
332
338
  set maxPages(value: number | null | undefined);
333
339
  maxRedirects: number;
@@ -344,6 +350,8 @@ export class WasmCrawlConfig {
344
350
  saveBrowserProfile: boolean;
345
351
  softHttpErrors: boolean;
346
352
  ssrf: WasmSsrfPolicy;
353
+ get ssrfDenyPrivateExplicit(): boolean | undefined;
354
+ set ssrfDenyPrivateExplicit(value: boolean | null | undefined);
347
355
  stayOnDomain: boolean;
348
356
  get userAgent(): string | undefined;
349
357
  set userAgent(value: string | null | undefined);
@@ -410,6 +418,13 @@ export class WasmCrawlResult {
410
418
  constructor(pages?: WasmCrawlPageResult[] | null, finalUrl?: string | null, redirectCount?: number | null, wasSkipped?: boolean | null, cookies?: WasmCookieInfo[] | null, stayedOnDomain?: boolean | null, browserUsed?: boolean | null, error?: string | null);
411
419
  /**
412
420
  * Returns the count of unique normalized URLs encountered during crawling.
421
+ *
422
+ * Computed from `pages` (not the deprecated `normalized_urls` field) so it
423
+ * is correct across every binding that reconstructs `CrawlResult` from
424
+ * `pages` alone. In streaming mode `pages` is empty, so this returns 0 on
425
+ * the opaque-handle (C/Go/C#/Zig/Dart) path where it previously counted
426
+ * streamed pages — a known, accepted cost of making the other ten binding
427
+ * families correct.
413
428
  */
414
429
  uniqueNormalizedUrls(): number;
415
430
  browserUsed: boolean;
@@ -423,6 +438,18 @@ export class WasmCrawlResult {
423
438
  wasSkipped: boolean;
424
439
  }
425
440
 
441
+ /**
442
+ * Opt-in encoding applied to a downloaded document's bytes for callers who need the
443
+ * content available in a serializable field rather than reading it from disk.
444
+ *
445
+ * `None` (the `CrawlConfig.document_content_encoding` default) produces neither — unlike
446
+ * screenshots, base64-encoding a document by default would duplicate an already
447
+ * up-to-`document_max_size` buffer (50 MB default) in memory per document.
448
+ */
449
+ export enum WasmDocumentContentEncoding {
450
+ Base64 = 0,
451
+ }
452
+
426
453
  /**
427
454
  * A downloaded asset from a page.
428
455
  */
@@ -453,13 +480,18 @@ export class WasmDownloadedDocument {
453
480
  free(): void;
454
481
  [Symbol.dispose](): void;
455
482
  static default(): WasmDownloadedDocument;
456
- constructor(url?: string | null, mimeType?: string | null, size?: number | null, contentHash?: string | null, headers?: any | null, filename?: string | null);
483
+ constructor(url?: string | null, mimeType?: string | null, size?: number | null, contentHash?: string | null, headers?: any | null, truncated?: boolean | null, filename?: string | null, contentPath?: string | null, contentBase64?: string | null);
484
+ get contentBase64(): string | undefined;
485
+ set contentBase64(value: string | null | undefined);
457
486
  contentHash: string;
487
+ get contentPath(): string | undefined;
488
+ set contentPath(value: string | null | undefined);
458
489
  get filename(): string | undefined;
459
490
  set filename(value: string | null | undefined);
460
491
  headers: any;
461
492
  mimeType: string;
462
493
  size: number;
494
+ truncated: boolean;
463
495
  url: string;
464
496
  }
465
497
 
@@ -534,6 +566,33 @@ export class WasmHeadingInfo {
534
566
  text: string;
535
567
  }
536
568
 
569
+ /**
570
+ * Hostname/IP allowlist matcher for SSRF policy.
571
+ *
572
+ * Serializes as an internally-tagged object so each variant is distinguishable on the
573
+ * wire and round-trips losslessly:
574
+ *
575
+ * ```json
576
+ * {"type": "exact", "value": "api.example.com"}
577
+ * {"type": "suffix", "value": ".example.com"}
578
+ * {"type": "cidr", "value": "10.0.0.0/8"}
579
+ * ```
580
+ *
581
+ * A bare JSON string is still accepted on deserialization and resolves to `Exact`,
582
+ * preserving configs written against the previous untagged representation.
583
+ *
584
+ * `Exact`: HostMatcher.Exact
585
+ */
586
+ export class WasmHostMatcher {
587
+ free(): void;
588
+ [Symbol.dispose](): void;
589
+ static default(): WasmHostMatcher;
590
+ constructor();
591
+ type: string;
592
+ get value(): string | undefined;
593
+ set value(value: string | null | undefined);
594
+ }
595
+
537
596
  /**
538
597
  * An hreflang alternate link entry.
539
598
  */
@@ -582,10 +641,12 @@ export class WasmInteractionResult {
582
641
  free(): void;
583
642
  [Symbol.dispose](): void;
584
643
  static default(): WasmInteractionResult;
585
- constructor(actionResults?: WasmActionResult[] | null, finalHtml?: string | null, finalUrl?: string | null);
644
+ constructor(actionResults?: WasmActionResult[] | null, finalHtml?: string | null, finalUrl?: string | null, screenshotBase64?: string | null);
586
645
  actionResults: WasmActionResult[];
587
646
  finalHtml: string;
588
647
  finalUrl: string;
648
+ get screenshotBase64(): string | undefined;
649
+ set screenshotBase64(value: string | null | undefined);
589
650
  }
590
651
 
591
652
  /**
@@ -830,7 +891,7 @@ export class WasmScrapeResult {
830
891
  free(): void;
831
892
  [Symbol.dispose](): void;
832
893
  static default(): WasmScrapeResult;
833
- constructor(statusCode?: number | null, finalUrl?: string | null, contentType?: string | null, html?: string | null, bodySize?: number | null, metadata?: WasmPageMetadata | null, links?: WasmLinkInfo[] | null, images?: WasmImageInfo[] | null, feeds?: WasmFeedInfo[] | null, jsonLd?: WasmJsonLdEntry[] | null, isAllowed?: boolean | null, noindexDetected?: boolean | null, nofollowDetected?: boolean | null, isPdf?: boolean | null, wasSkipped?: boolean | null, authHeaderSent?: boolean | null, assets?: WasmDownloadedAsset[] | null, jsRenderHint?: boolean | null, browserUsed?: boolean | null, crawlDelay?: bigint | null, xRobotsTag?: string | null, detectedCharset?: string | null, responseMeta?: WasmResponseMeta | null, markdown?: WasmMarkdownResult | null, extractedData?: any | null, extractionMeta?: WasmExtractionMeta | null, downloadedDocument?: WasmDownloadedDocument | null, browser?: WasmBrowserExtras | null);
894
+ constructor(statusCode?: number | null, finalUrl?: string | null, contentType?: string | null, html?: string | null, bodySize?: number | null, metadata?: WasmPageMetadata | null, links?: WasmLinkInfo[] | null, images?: WasmImageInfo[] | null, feeds?: WasmFeedInfo[] | null, jsonLd?: WasmJsonLdEntry[] | null, isAllowed?: boolean | null, noindexDetected?: boolean | null, nofollowDetected?: boolean | null, isPdf?: boolean | null, wasSkipped?: boolean | null, authHeaderSent?: boolean | null, assets?: WasmDownloadedAsset[] | null, jsRenderHint?: boolean | null, browserUsed?: boolean | null, crawlDelay?: bigint | null, xRobotsTag?: string | null, detectedCharset?: string | null, responseMeta?: WasmResponseMeta | null, markdown?: WasmMarkdownResult | null, extractedData?: any | null, extractionMeta?: WasmExtractionMeta | null, screenshotBase64?: string | null, downloadedDocument?: WasmDownloadedDocument | null, browser?: WasmBrowserExtras | null);
834
895
  assets: WasmDownloadedAsset[];
835
896
  authHeaderSent: boolean;
836
897
  bodySize: number;
@@ -864,6 +925,8 @@ export class WasmScrapeResult {
864
925
  noindexDetected: boolean;
865
926
  get responseMeta(): WasmResponseMeta | undefined;
866
927
  set responseMeta(value: WasmResponseMeta | null | undefined);
928
+ get screenshotBase64(): string | undefined;
929
+ set screenshotBase64(value: string | null | undefined);
867
930
  statusCode: number;
868
931
  wasSkipped: boolean;
869
932
  get xRobotsTag(): string | undefined;
@@ -913,9 +976,18 @@ export class WasmSsrfPolicy {
913
976
  * - Outbound requests in a browser go through the fetch API, which enforces its own network policies.
914
977
  * - Rust-side SSRF checking is unenforceable and redundant in a wasm32 context.
915
978
  * - For testing and localhost access, the host's network sandbox is the enforcing boundary.
979
+ *
980
+ * **Node.js caveat:** `deny_private` (whatever its value) has no effect on hostname-based
981
+ * requests under `wasm32`. There is no DNS resolution on this target, so `validate_url`
982
+ * only ever checks a literal IP host; a domain name falls straight through to `Ok(())`. In a
983
+ * browser this is covered by same-origin/CORS. Node's `fetch` enforces no CORS, so a Node
984
+ * service embedding this wasm module can be driven to internal hosts by domain name even
985
+ * though `deny_private = true`. Do not rely on this policy to stop that in Node — enforce
986
+ * egress restrictions (network policy, firewall, proxy allowlist) outside the process.
916
987
  */
917
988
  static fromEnv(): WasmSsrfPolicy;
918
- constructor(denyPrivate?: boolean | null, maxRedirects?: number | null);
989
+ constructor(denyPrivate?: boolean | null, allowlist?: any | null, maxRedirects?: number | null);
990
+ allowlist: any;
919
991
  denyPrivate: boolean;
920
992
  maxRedirects: number;
921
993
  }
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./crawlberg_wasm_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
  wasm.__wbindgen_start();
7
7
  export {
8
- WasmActionResult, WasmArticleMetadata, WasmAssetCategory, WasmAuthConfig, WasmBatchCrawlResult, WasmBatchCrawlResults, WasmBatchScrapeResult, WasmBatchScrapeResults, WasmBrowserBackend, WasmBrowserConfig, WasmBrowserExtras, WasmBrowserMode, WasmBrowserWait, WasmCitationReference, WasmCitationResult, WasmContentConfig, WasmCookieInfo, WasmCrawlConfig, WasmCrawlEngineHandle, WasmCrawlPageResult, WasmCrawlResult, WasmDownloadedAsset, WasmDownloadedDocument, WasmExtractionMeta, WasmFaviconInfo, WasmFeedInfo, WasmFeedType, WasmHeadingInfo, WasmHreflangEntry, WasmImageInfo, WasmImageSource, WasmInteractionResult, WasmJsonLdEntry, WasmLinkInfo, WasmLinkType, WasmMapResult, WasmMarkdownResult, WasmPageAction, WasmPageMetadata, WasmProxyConfig, WasmResponseMeta, WasmScrapeResult, WasmScrollDirection, WasmSitemapUrl, WasmSsrfPolicy, batchCrawl, batchScrape, crawl, createEngine, generateCitations, interact, mapUrls, scrape
8
+ WasmActionResult, WasmArticleMetadata, WasmAssetCategory, WasmAuthConfig, WasmBatchCrawlResult, WasmBatchCrawlResults, WasmBatchScrapeResult, WasmBatchScrapeResults, WasmBrowserBackend, WasmBrowserConfig, WasmBrowserExtras, WasmBrowserMode, WasmBrowserWait, WasmCitationReference, WasmCitationResult, WasmContentConfig, WasmCookieInfo, WasmCrawlConfig, WasmCrawlEngineHandle, WasmCrawlPageResult, WasmCrawlResult, WasmDocumentContentEncoding, WasmDownloadedAsset, WasmDownloadedDocument, WasmExtractionMeta, WasmFaviconInfo, WasmFeedInfo, WasmFeedType, WasmHeadingInfo, WasmHostMatcher, WasmHreflangEntry, WasmImageInfo, WasmImageSource, WasmInteractionResult, WasmJsonLdEntry, WasmLinkInfo, WasmLinkType, WasmMapResult, WasmMarkdownResult, WasmPageAction, WasmPageMetadata, WasmProxyConfig, WasmResponseMeta, WasmScrapeResult, WasmScrollDirection, WasmSitemapUrl, WasmSsrfPolicy, batchCrawl, batchScrape, crawl, createEngine, generateCitations, interact, mapUrls, scrape
9
9
  } from "./crawlberg_wasm_bg.js";