scrapfly-sdk 0.10.4 → 0.10.5

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.
Files changed (88) hide show
  1. package/esm/browserconfig.d.ts +70 -1
  2. package/esm/browserconfig.d.ts.map +1 -1
  3. package/esm/browserconfig.js +44 -1
  4. package/esm/client.d.ts +33 -0
  5. package/esm/client.d.ts.map +1 -1
  6. package/esm/client.js +33 -5
  7. package/esm/crawl.d.ts +4 -0
  8. package/esm/crawl.d.ts.map +1 -1
  9. package/esm/crawl.js +4 -0
  10. package/esm/crawlerresult.d.ts +7 -0
  11. package/esm/crawlerresult.d.ts.map +1 -1
  12. package/esm/errors.d.ts +43 -0
  13. package/esm/errors.d.ts.map +1 -1
  14. package/esm/errors.js +43 -16
  15. package/esm/extractionconfig.d.ts +54 -9
  16. package/esm/extractionconfig.d.ts.map +1 -1
  17. package/esm/extractionconfig.js +37 -13
  18. package/esm/logger.d.ts +1 -0
  19. package/esm/logger.d.ts.map +1 -1
  20. package/esm/logger.js +1 -0
  21. package/esm/main.d.ts +27 -0
  22. package/esm/main.d.ts.map +1 -1
  23. package/esm/main.js +27 -0
  24. package/esm/monitoringconfig.d.ts +48 -11
  25. package/esm/monitoringconfig.d.ts.map +1 -1
  26. package/esm/monitoringconfig.js +14 -0
  27. package/esm/result.d.ts +2 -0
  28. package/esm/result.d.ts.map +1 -1
  29. package/esm/scrapeconfig.d.ts +10 -8
  30. package/esm/scrapeconfig.d.ts.map +1 -1
  31. package/esm/scrapeconfig.js +10 -8
  32. package/esm/screenshotconfig.d.ts +59 -26
  33. package/esm/screenshotconfig.d.ts.map +1 -1
  34. package/esm/screenshotconfig.js +38 -26
  35. package/esm/webhookserver.d.ts +24 -0
  36. package/esm/webhookserver.d.ts.map +1 -1
  37. package/esm/webhookserver.js +24 -0
  38. package/package.json +1 -1
  39. package/script/browserconfig.d.ts +70 -1
  40. package/script/browserconfig.d.ts.map +1 -1
  41. package/script/browserconfig.js +44 -1
  42. package/script/client.d.ts +33 -0
  43. package/script/client.d.ts.map +1 -1
  44. package/script/client.js +33 -5
  45. package/script/crawl.d.ts +4 -0
  46. package/script/crawl.d.ts.map +1 -1
  47. package/script/crawl.js +4 -0
  48. package/script/crawlerresult.d.ts +7 -0
  49. package/script/crawlerresult.d.ts.map +1 -1
  50. package/script/errors.d.ts +43 -0
  51. package/script/errors.d.ts.map +1 -1
  52. package/script/errors.js +43 -16
  53. package/script/extractionconfig.d.ts +54 -9
  54. package/script/extractionconfig.d.ts.map +1 -1
  55. package/script/extractionconfig.js +37 -13
  56. package/script/logger.d.ts +1 -0
  57. package/script/logger.d.ts.map +1 -1
  58. package/script/logger.js +1 -0
  59. package/script/main.d.ts +27 -0
  60. package/script/main.d.ts.map +1 -1
  61. package/script/main.js +27 -0
  62. package/script/monitoringconfig.d.ts +48 -11
  63. package/script/monitoringconfig.d.ts.map +1 -1
  64. package/script/monitoringconfig.js +14 -0
  65. package/script/result.d.ts +2 -0
  66. package/script/result.d.ts.map +1 -1
  67. package/script/scrapeconfig.d.ts +10 -8
  68. package/script/scrapeconfig.d.ts.map +1 -1
  69. package/script/scrapeconfig.js +10 -8
  70. package/script/screenshotconfig.d.ts +59 -26
  71. package/script/screenshotconfig.d.ts.map +1 -1
  72. package/script/screenshotconfig.js +38 -26
  73. package/script/webhookserver.d.ts +24 -0
  74. package/script/webhookserver.d.ts.map +1 -1
  75. package/script/webhookserver.js +24 -0
  76. package/src/browserconfig.ts +70 -1
  77. package/src/client.ts +34 -6
  78. package/src/crawl.ts +4 -0
  79. package/src/crawlerresult.ts +7 -0
  80. package/src/errors.ts +43 -16
  81. package/src/extractionconfig.ts +58 -16
  82. package/src/logger.ts +2 -0
  83. package/src/main.ts +27 -0
  84. package/src/monitoringconfig.ts +49 -11
  85. package/src/result.ts +2 -0
  86. package/src/scrapeconfig.ts +10 -8
  87. package/src/screenshotconfig.ts +59 -26
  88. package/src/webhookserver.ts +24 -0
package/esm/errors.d.ts CHANGED
@@ -1,57 +1,100 @@
1
+ /**
2
+ * Base class for every error thrown by the Scrapfly SDK.
3
+ *
4
+ * Concrete subclasses distinguish config-level, HTTP-level, and
5
+ * API-specific failures so callers can catch the exact category they
6
+ * care about without string-matching on error messages.
7
+ */
1
8
  export declare class ScrapflyError extends Error {
9
+ /** Extra context carried alongside the error message (response body, request params, etc.). */
2
10
  args: Record<string, any>;
11
+ /**
12
+ * @param message Human-readable description of the failure.
13
+ * @param args Optional structured context to attach to the error.
14
+ */
3
15
  constructor(message: string, args?: Record<string, any>);
4
16
  }
17
+ /** Raised when a ScrapeConfig is constructed with invalid parameters. */
5
18
  export declare class ScrapeConfigError extends ScrapflyError {
6
19
  }
20
+ /** Raised when a ScreenshotConfig is constructed with invalid parameters. */
7
21
  export declare class ScreenshotConfigError extends ScrapflyError {
8
22
  }
23
+ /** Raised when an ExtractionConfig is constructed with invalid parameters. */
9
24
  export declare class ExtractionConfigError extends ScrapflyError {
10
25
  }
26
+ /** Raised when a CrawlerConfig is constructed with invalid parameters. */
11
27
  export declare class CrawlerConfigError extends ScrapflyError {
12
28
  }
29
+ /** Raised when scrape parameters cannot be encoded into a request. */
13
30
  export declare class EncodeError extends ScrapflyError {
14
31
  }
32
+ /** Raised when a response carries an unexpected or unsupported Content-Type. */
15
33
  export declare class ContentTypeError extends ScrapflyError {
16
34
  }
35
+ /** Base error for every HTTP-level failure surfaced by the SDK. */
17
36
  export declare class HttpError extends ScrapflyError {
18
37
  }
38
+ /** Raised when the upstream target returned an error to Scrapfly. */
19
39
  export declare class UpstreamHttpError extends HttpError {
20
40
  }
41
+ /** Raised when the upstream target returned a 4xx client error. */
21
42
  export declare class UpstreamHttpClientError extends UpstreamHttpError {
22
43
  }
44
+ /** Raised when the upstream target returned a 5xx server error. */
23
45
  export declare class UpstreamHttpServerError extends UpstreamHttpClientError {
24
46
  }
47
+ /** Raised when the Scrapfly API itself returned a 4xx client error. */
25
48
  export declare class ApiHttpClientError extends HttpError {
26
49
  }
50
+ /** Raised when the API key provided to the client is missing, invalid, or revoked. */
27
51
  export declare class BadApiKeyError extends ApiHttpClientError {
28
52
  }
53
+ /** Raised when the request is rate-limited (HTTP 429). */
29
54
  export declare class TooManyRequests extends HttpError {
30
55
  }
56
+ /** Raised when the Scrapfly API returned a 5xx server error. */
31
57
  export declare class ApiHttpServerError extends HttpError {
32
58
  }
59
+ /** Raised when a scrape call fails for a reason not captured by a more specific subclass. */
33
60
  export declare class ScrapflyScrapeError extends HttpError {
34
61
  }
62
+ /** Raised when proxy settings do not match an available proxy (invalid pool, unsupported country, ...). */
35
63
  export declare class ScrapflyProxyError extends HttpError {
36
64
  }
65
+ /** Raised when the request is throttled by Scrapfly (e.g. burst limits). */
37
66
  export declare class ScrapflyThrottleError extends HttpError {
38
67
  }
68
+ /** Raised when Scrapfly failed to bypass anti-scraping protection on the target. */
39
69
  export declare class ScrapflyAspError extends HttpError {
40
70
  }
71
+ /** Raised when a scheduled scrape cannot be created or fulfilled. */
41
72
  export declare class ScrapflyScheduleError extends HttpError {
42
73
  }
74
+ /** Raised when a webhook is invalid or cannot be delivered (e.g. full queue). */
43
75
  export declare class ScrapflyWebhookError extends HttpError {
44
76
  }
77
+ /** Raised when a session is accessed concurrently in a way that violates session semantics. */
45
78
  export declare class ScrapflySessionError extends HttpError {
46
79
  }
80
+ /** Raised when concurrent requests exceed the account's concurrency limit. */
47
81
  export declare class TooManyConcurrentRequests extends HttpError {
48
82
  }
83
+ /** Raised when the account is out of scrape credits. */
49
84
  export declare class QuotaLimitReached extends HttpError {
50
85
  }
86
+ /** Raised for screenshot-API-specific failures. */
51
87
  export declare class ScreenshotApiError extends ApiHttpClientError {
52
88
  }
89
+ /** Raised for extraction-API-specific failures. */
53
90
  export declare class ExtractionApiError extends ApiHttpClientError {
54
91
  }
92
+ /**
93
+ * Raised for crawler-API-specific failures.
94
+ *
95
+ * Covers crawler job lifecycle errors such as ALREADY_STARTED,
96
+ * NOT_STARTED, FAILED, CANCELLED, TIMEOUT, etc.
97
+ */
55
98
  export declare class ScrapflyCrawlerError extends HttpError {
56
99
  }
57
100
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;IACtC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;gBAEd,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;CAI5D;AAGD,qBAAa,iBAAkB,SAAQ,aAAa;CAAG;AAEvD,qBAAa,qBAAsB,SAAQ,aAAa;CAAG;AAE3D,qBAAa,qBAAsB,SAAQ,aAAa;CAAG;AAE3D,qBAAa,kBAAmB,SAAQ,aAAa;CAAG;AAGxD,qBAAa,WAAY,SAAQ,aAAa;CAAG;AACjD,qBAAa,gBAAiB,SAAQ,aAAa;CAAG;AAGtD,qBAAa,SAAU,SAAQ,aAAa;CAAG;AAC/C,qBAAa,iBAAkB,SAAQ,SAAS;CAAG;AACnD,qBAAa,uBAAwB,SAAQ,iBAAiB;CAAG;AACjE,qBAAa,uBAAwB,SAAQ,uBAAuB;CAAG;AAEvE,qBAAa,kBAAmB,SAAQ,SAAS;CAAG;AAEpD,qBAAa,cAAe,SAAQ,kBAAkB;CAAG;AAEzD,qBAAa,eAAgB,SAAQ,SAAS;CAAG;AACjD,qBAAa,kBAAmB,SAAQ,SAAS;CAAG;AACpD,qBAAa,mBAAoB,SAAQ,SAAS;CAAG;AAErD,qBAAa,kBAAmB,SAAQ,SAAS;CAAG;AACpD,qBAAa,qBAAsB,SAAQ,SAAS;CAAG;AAEvD,qBAAa,gBAAiB,SAAQ,SAAS;CAAG;AAClD,qBAAa,qBAAsB,SAAQ,SAAS;CAAG;AAEvD,qBAAa,oBAAqB,SAAQ,SAAS;CAAG;AAEtD,qBAAa,oBAAqB,SAAQ,SAAS;CAAG;AAEtD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G;AACjD,gEAAgE;AAChE,qBAAa,kBAAmB,SAAQ,SAAS;CAAG;AACpD,6FAA6F;AAC7F,qBAAa,mBAAoB,SAAQ,SAAS;CAAG;AACrD,2GAA2G;AAC3G,qBAAa,kBAAmB,SAAQ,SAAS;CAAG;AACpD,4EAA4E;AAC5E,qBAAa,qBAAsB,SAAQ,SAAS;CAAG;AACvD,oFAAoF;AACpF,qBAAa,gBAAiB,SAAQ,SAAS;CAAG;AAClD,qEAAqE;AACrE,qBAAa,qBAAsB,SAAQ,SAAS;CAAG;AACvD,iFAAiF;AACjF,qBAAa,oBAAqB,SAAQ,SAAS;CAAG;AACtD,+FAA+F;AAC/F,qBAAa,oBAAqB,SAAQ,SAAS;CAAG;AACtD,8EAA8E;AAC9E,qBAAa,yBAA0B,SAAQ,SAAS;CAAG;AAC3D,wDAAwD;AACxD,qBAAa,iBAAkB,SAAQ,SAAS;CAAG;AACnD,mDAAmD;AACnD,qBAAa,kBAAmB,SAAQ,kBAAkB;CAAG;AAC7D,mDAAmD;AACnD,qBAAa,kBAAmB,SAAQ,kBAAkB;CAAG;AAC7D;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,SAAS;CAAG"}
package/esm/errors.js CHANGED
@@ -1,6 +1,18 @@
1
+ /**
2
+ * Base class for every error thrown by the Scrapfly SDK.
3
+ *
4
+ * Concrete subclasses distinguish config-level, HTTP-level, and
5
+ * API-specific failures so callers can catch the exact category they
6
+ * care about without string-matching on error messages.
7
+ */
1
8
  export class ScrapflyError extends Error {
9
+ /**
10
+ * @param message Human-readable description of the failure.
11
+ * @param args Optional structured context to attach to the error.
12
+ */
2
13
  constructor(message, args = {}) {
3
14
  super(message);
15
+ /** Extra context carried alongside the error message (response body, request params, etc.). */
4
16
  Object.defineProperty(this, "args", {
5
17
  enumerable: true,
6
18
  configurable: true,
@@ -10,71 +22,86 @@ export class ScrapflyError extends Error {
10
22
  this.args = args;
11
23
  }
12
24
  }
13
- // raised when scrape config is invalid
25
+ /** Raised when a ScrapeConfig is constructed with invalid parameters. */
14
26
  export class ScrapeConfigError extends ScrapflyError {
15
27
  }
16
- // raised when screenshot config is invalid
28
+ /** Raised when a ScreenshotConfig is constructed with invalid parameters. */
17
29
  export class ScreenshotConfigError extends ScrapflyError {
18
30
  }
19
- // raised when extraction config is invalid
31
+ /** Raised when an ExtractionConfig is constructed with invalid parameters. */
20
32
  export class ExtractionConfigError extends ScrapflyError {
21
33
  }
22
- // raised when crawler config is invalid
34
+ /** Raised when a CrawlerConfig is constructed with invalid parameters. */
23
35
  export class CrawlerConfigError extends ScrapflyError {
24
36
  }
25
- // raised when scrape parameters cannot be encoded
37
+ /** Raised when scrape parameters cannot be encoded into a request. */
26
38
  export class EncodeError extends ScrapflyError {
27
39
  }
40
+ /** Raised when a response carries an unexpected or unsupported Content-Type. */
28
41
  export class ContentTypeError extends ScrapflyError {
29
42
  }
30
- // Base error for all http related operations
43
+ /** Base error for every HTTP-level failure surfaced by the SDK. */
31
44
  export class HttpError extends ScrapflyError {
32
45
  }
46
+ /** Raised when the upstream target returned an error to Scrapfly. */
33
47
  export class UpstreamHttpError extends HttpError {
34
48
  }
49
+ /** Raised when the upstream target returned a 4xx client error. */
35
50
  export class UpstreamHttpClientError extends UpstreamHttpError {
36
51
  }
52
+ /** Raised when the upstream target returned a 5xx server error. */
37
53
  export class UpstreamHttpServerError extends UpstreamHttpClientError {
38
54
  }
55
+ /** Raised when the Scrapfly API itself returned a 4xx client error. */
39
56
  export class ApiHttpClientError extends HttpError {
40
57
  }
41
- // raised when API key provided to client is not valid or not existant
58
+ /** Raised when the API key provided to the client is missing, invalid, or revoked. */
42
59
  export class BadApiKeyError extends ApiHttpClientError {
43
60
  }
61
+ /** Raised when the request is rate-limited (HTTP 429). */
44
62
  export class TooManyRequests extends HttpError {
45
63
  }
64
+ /** Raised when the Scrapfly API returned a 5xx server error. */
46
65
  export class ApiHttpServerError extends HttpError {
47
66
  }
67
+ /** Raised when a scrape call fails for a reason not captured by a more specific subclass. */
48
68
  export class ScrapflyScrapeError extends HttpError {
49
69
  }
50
- // raised when proxy settings don't match available proxies (e.g. invalid proxy pool, country setting)
70
+ /** Raised when proxy settings do not match an available proxy (invalid pool, unsupported country, ...). */
51
71
  export class ScrapflyProxyError extends HttpError {
52
72
  }
73
+ /** Raised when the request is throttled by Scrapfly (e.g. burst limits). */
53
74
  export class ScrapflyThrottleError extends HttpError {
54
75
  }
55
- // raised when ScrapFly fails to bypass anti-scraping protection
76
+ /** Raised when Scrapfly failed to bypass anti-scraping protection on the target. */
56
77
  export class ScrapflyAspError extends HttpError {
57
78
  }
79
+ /** Raised when a scheduled scrape cannot be created or fulfilled. */
58
80
  export class ScrapflyScheduleError extends HttpError {
59
81
  }
60
- // raised when Webhook is invalid or cannot be fulfilled (i.e. full queue)
82
+ /** Raised when a webhook is invalid or cannot be delivered (e.g. full queue). */
61
83
  export class ScrapflyWebhookError extends HttpError {
62
84
  }
63
- // raised when session is access concurrently
85
+ /** Raised when a session is accessed concurrently in a way that violates session semantics. */
64
86
  export class ScrapflySessionError extends HttpError {
65
87
  }
66
- // raised when concurrent requests exceed account limits
88
+ /** Raised when concurrent requests exceed the account's concurrency limit. */
67
89
  export class TooManyConcurrentRequests extends HttpError {
68
90
  }
69
- // raised when account is out of scrape credits
91
+ /** Raised when the account is out of scrape credits. */
70
92
  export class QuotaLimitReached extends HttpError {
71
93
  }
72
- // raised with Scrapfly screenshot API related errors
94
+ /** Raised for screenshot-API-specific failures. */
73
95
  export class ScreenshotApiError extends ApiHttpClientError {
74
96
  }
75
- // raised with Scrapfly extraction API related errors
97
+ /** Raised for extraction-API-specific failures. */
76
98
  export class ExtractionApiError extends ApiHttpClientError {
77
99
  }
78
- // raised with Scrapfly crawler API related errors (job lifecycle: ALREADY_STARTED, NOT_STARTED, FAILED, CANCELLED, TIMEOUT, etc.)
100
+ /**
101
+ * Raised for crawler-API-specific failures.
102
+ *
103
+ * Covers crawler job lifecycle errors such as ALREADY_STARTED,
104
+ * NOT_STARTED, FAILED, CANCELLED, TIMEOUT, etc.
105
+ */
79
106
  export class ScrapflyCrawlerError extends HttpError {
80
107
  }
@@ -1,50 +1,95 @@
1
+ /** Compression format declared for documents submitted to the Extraction API. */
1
2
  export declare enum CompressionFormat {
2
- /**
3
- Document compression format.
4
-
5
- Attributes:
6
- GZIP: gzip format.
7
- ZSTD: zstd format.
8
- DEFLATE: deflate.
9
- """
10
- */
3
+ /** gzip compression. */
11
4
  GZIP = "gzip",
5
+ /** zstd compression. */
12
6
  ZSTD = "zstd",
7
+ /** DEFLATE compression. */
13
8
  DEFLATE = "deflate"
14
9
  }
10
+ /**
11
+ * User-facing options accepted by {@link ExtractionConfig}. See the
12
+ * [Extraction API reference](https://scrapfly.io/docs/extraction-api)
13
+ * for the authoritative list of valid values.
14
+ */
15
15
  type ExtractionConfigOptions = {
16
+ /** Document body to extract from. */
16
17
  body: string;
18
+ /** Content-Type of the body (e.g. "text/html"). */
17
19
  content_type: string;
20
+ /** URL associated with the document (used for link resolution). */
18
21
  url?: string;
22
+ /** Character set of the document. */
19
23
  charset?: string;
24
+ /** Name of a saved extraction template. */
20
25
  extraction_template?: string;
26
+ /** Inline extraction template, used instead of a saved one. */
21
27
  extraction_ephemeral_template?: object;
28
+ /** Natural-language prompt for LLM-based extraction. */
22
29
  extraction_prompt?: string;
30
+ /** Override the LLM model used for prompt-based extraction. */
23
31
  extraction_model?: string;
32
+ /** Whether the provided body is already compressed. */
24
33
  is_document_compressed?: boolean;
34
+ /** Compression format of the body. See {@link CompressionFormat}. */
25
35
  document_compression_format?: 'gzip' | 'zstd' | 'deflate' | CompressionFormat;
36
+ /** Webhook name to notify when extraction completes. */
26
37
  webhook?: string;
38
+ /** Request timeout in milliseconds. */
27
39
  timeout?: number;
40
+ /** @deprecated Use {@link extraction_template} instead. */
28
41
  template?: string;
42
+ /** @deprecated Use {@link extraction_ephemeral_template} instead. */
29
43
  ephemeral_template?: object;
30
44
  };
45
+ /**
46
+ * Configuration for an Extraction API call. Holds the document to
47
+ * extract from and the template/prompt/model that should drive the
48
+ * extraction.
49
+ */
31
50
  export declare class ExtractionConfig {
51
+ /** Document body. */
32
52
  body: string | Uint8Array;
53
+ /** Content-Type of the body. */
33
54
  content_type: string;
55
+ /** URL associated with the document. */
34
56
  url?: string;
57
+ /** Character set of the document. */
35
58
  charset?: string;
59
+ /** Saved extraction template name. */
36
60
  extraction_template?: string;
61
+ /** Inline extraction template. */
37
62
  extraction_ephemeral_template?: object;
63
+ /** Natural-language extraction prompt. */
38
64
  extraction_prompt?: string;
65
+ /** LLM model override for prompt-based extraction. */
39
66
  extraction_model?: string;
67
+ /** Whether the body is pre-compressed. */
40
68
  is_document_compressed?: boolean;
69
+ /** Compression format of the body. */
41
70
  document_compression_format?: 'gzip' | 'zstd' | 'deflate' | CompressionFormat;
71
+ /** Webhook name to notify on completion. */
42
72
  webhook?: string;
73
+ /** Request timeout in milliseconds. */
43
74
  timeout?: number;
75
+ /** @deprecated Use {@link extraction_template} instead. */
44
76
  template?: string;
77
+ /** @deprecated Use {@link extraction_ephemeral_template} instead. */
45
78
  ephemeral_template?: object;
79
+ /**
80
+ * @param options See {@link ExtractionConfigOptions}.
81
+ * @throws {@link errors.ExtractionConfigError} if an unknown option is supplied.
82
+ */
46
83
  constructor(options: ExtractionConfigOptions);
47
84
  private validateOptions;
85
+ /**
86
+ * Encode this config as the query-string parameters sent to the
87
+ * Extraction API.
88
+ *
89
+ * @param options.key Scrapfly API key.
90
+ * @returns A record suitable for `URLSearchParams` construction.
91
+ * @throws {@link ExtractionConfigError} on conflicting or incompatible options.
92
+ */
48
93
  toApiParams(options: {
49
94
  key: string;
50
95
  }): Record<string, any>;
@@ -1 +1 @@
1
- {"version":3,"file":"extractionconfig.d.ts","sourceRoot":"","sources":["../src/extractionconfig.ts"],"names":[],"mappings":"AAIA,oBAAY,iBAAiB;IAC3B;;;;;;;;SAQK;IACL,IAAI,SAAS;IACb,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED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AG,UAAU,CAAC;IAC1B,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kCAAkC;IAClC,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,0CAA0C;IAC1C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,0CAA0C;IAC1C,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,sCAAsC;IACtC,2BAA2B,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,iBAAiB,CAAC;IAC9E,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;;OAGG;gBACS,OAAO,EAAE,uBAAuB;IAyC5C,OAAO,CAAC,eAAe;IASvB;;;;;;;OAOG;IACH,WAAW,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAmE3D"}
@@ -1,102 +1,119 @@
1
1
  import * as errors from './errors.js';
2
2
  import { urlsafe_b64encode } from './utils.js';
3
3
  import { ExtractionConfigError } from './errors.js';
4
+ /** Compression format declared for documents submitted to the Extraction API. */
4
5
  export var CompressionFormat;
5
6
  (function (CompressionFormat) {
6
- /**
7
- Document compression format.
8
-
9
- Attributes:
10
- GZIP: gzip format.
11
- ZSTD: zstd format.
12
- DEFLATE: deflate.
13
- """
14
- */
7
+ /** gzip compression. */
15
8
  CompressionFormat["GZIP"] = "gzip";
9
+ /** zstd compression. */
16
10
  CompressionFormat["ZSTD"] = "zstd";
11
+ /** DEFLATE compression. */
17
12
  CompressionFormat["DEFLATE"] = "deflate";
18
13
  })(CompressionFormat || (CompressionFormat = {}));
14
+ /**
15
+ * Configuration for an Extraction API call. Holds the document to
16
+ * extract from and the template/prompt/model that should drive the
17
+ * extraction.
18
+ */
19
19
  export class ExtractionConfig {
20
+ /**
21
+ * @param options See {@link ExtractionConfigOptions}.
22
+ * @throws {@link errors.ExtractionConfigError} if an unknown option is supplied.
23
+ */
20
24
  constructor(options) {
25
+ /** Document body. */
21
26
  Object.defineProperty(this, "body", {
22
27
  enumerable: true,
23
28
  configurable: true,
24
29
  writable: true,
25
30
  value: void 0
26
31
  });
32
+ /** Content-Type of the body. */
27
33
  Object.defineProperty(this, "content_type", {
28
34
  enumerable: true,
29
35
  configurable: true,
30
36
  writable: true,
31
37
  value: void 0
32
38
  });
39
+ /** URL associated with the document. */
33
40
  Object.defineProperty(this, "url", {
34
41
  enumerable: true,
35
42
  configurable: true,
36
43
  writable: true,
37
44
  value: void 0
38
45
  });
46
+ /** Character set of the document. */
39
47
  Object.defineProperty(this, "charset", {
40
48
  enumerable: true,
41
49
  configurable: true,
42
50
  writable: true,
43
51
  value: void 0
44
52
  });
53
+ /** Saved extraction template name. */
45
54
  Object.defineProperty(this, "extraction_template", {
46
55
  enumerable: true,
47
56
  configurable: true,
48
57
  writable: true,
49
58
  value: void 0
50
- }); // saved template name
59
+ });
60
+ /** Inline extraction template. */
51
61
  Object.defineProperty(this, "extraction_ephemeral_template", {
52
62
  enumerable: true,
53
63
  configurable: true,
54
64
  writable: true,
55
65
  value: void 0
56
- }); // ephemeraly declared json template
66
+ });
67
+ /** Natural-language extraction prompt. */
57
68
  Object.defineProperty(this, "extraction_prompt", {
58
69
  enumerable: true,
59
70
  configurable: true,
60
71
  writable: true,
61
72
  value: void 0
62
73
  });
74
+ /** LLM model override for prompt-based extraction. */
63
75
  Object.defineProperty(this, "extraction_model", {
64
76
  enumerable: true,
65
77
  configurable: true,
66
78
  writable: true,
67
79
  value: void 0
68
80
  });
81
+ /** Whether the body is pre-compressed. */
69
82
  Object.defineProperty(this, "is_document_compressed", {
70
83
  enumerable: true,
71
84
  configurable: true,
72
85
  writable: true,
73
86
  value: void 0
74
87
  });
88
+ /** Compression format of the body. */
75
89
  Object.defineProperty(this, "document_compression_format", {
76
90
  enumerable: true,
77
91
  configurable: true,
78
92
  writable: true,
79
93
  value: void 0
80
94
  });
95
+ /** Webhook name to notify on completion. */
81
96
  Object.defineProperty(this, "webhook", {
82
97
  enumerable: true,
83
98
  configurable: true,
84
99
  writable: true,
85
100
  value: void 0
86
101
  });
102
+ /** Request timeout in milliseconds. */
87
103
  Object.defineProperty(this, "timeout", {
88
104
  enumerable: true,
89
105
  configurable: true,
90
106
  writable: true,
91
107
  value: void 0
92
108
  });
93
- // // deprecated options
109
+ /** @deprecated Use {@link extraction_template} instead. */
94
110
  Object.defineProperty(this, "template", {
95
111
  enumerable: true,
96
112
  configurable: true,
97
113
  writable: true,
98
114
  value: void 0
99
115
  });
116
+ /** @deprecated Use {@link extraction_ephemeral_template} instead. */
100
117
  Object.defineProperty(this, "ephemeral_template", {
101
118
  enumerable: true,
102
119
  configurable: true,
@@ -143,11 +160,18 @@ export class ExtractionConfig {
143
160
  }
144
161
  }
145
162
  }
163
+ /**
164
+ * Encode this config as the query-string parameters sent to the
165
+ * Extraction API.
166
+ *
167
+ * @param options.key Scrapfly API key.
168
+ * @returns A record suitable for `URLSearchParams` construction.
169
+ * @throws {@link ExtractionConfigError} on conflicting or incompatible options.
170
+ */
146
171
  toApiParams(options) {
147
172
  const params = {
148
173
  key: options.key,
149
174
  };
150
- // params.body = this.body;
151
175
  params.content_type = this.content_type;
152
176
  if (this.url) {
153
177
  params.url = encodeURI(this.url);
package/esm/logger.d.ts CHANGED
@@ -15,5 +15,6 @@ declare class Logger {
15
15
  setLevel(level: string): void;
16
16
  }
17
17
  export default Logger;
18
+ /** Shared logger instance used by the SDK. Callers can set its log level to silence or unmute output. */
18
19
  export declare const log: Logger;
19
20
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,aAAK,QAAQ;IACX,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,cAAM,MAAM;IACV,OAAO,CAAC,KAAK,CAAW;IACjB,IAAI,EAAE,MAAM,CAAC;gBAER,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,QAAwB;IAKzD,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAM3B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAM1B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAM1B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAM3B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAO9B;AAED,eAAe,MAAM,CAAC;AACtB,eAAO,MAAM,GAAG,EAAE,MAA+B,CAAC"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,aAAK,QAAQ;IACX,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,cAAM,MAAM;IACV,OAAO,CAAC,KAAK,CAAW;IACjB,IAAI,EAAE,MAAM,CAAC;gBAER,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,QAAwB;IAKzD,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAM3B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAM1B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAM1B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAM3B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAO9B;AAED,eAAe,MAAM,CAAC;AAEtB,yGAAyG;AACzG,eAAO,MAAM,GAAG,EAAE,MAA+B,CAAC"}
package/esm/logger.js CHANGED
@@ -52,4 +52,5 @@ class Logger {
52
52
  }
53
53
  }
54
54
  export default Logger;
55
+ /** Shared logger instance used by the SDK. Callers can set its log level to silence or unmute output. */
55
56
  export const log = new Logger('scrapfly');
package/esm/main.d.ts CHANGED
@@ -1,9 +1,36 @@
1
+ /**
2
+ * # Scrapfly SDK for TypeScript / JavaScript
3
+ *
4
+ * Official client library for the [Scrapfly](https://scrapfly.io) web
5
+ * scraping API. Provides typed wrappers around the Scrape, Screenshot,
6
+ * Extraction, Crawler, Monitoring, and Cloud Browser APIs.
7
+ *
8
+ * ## Quick start
9
+ *
10
+ * ```ts
11
+ * import { ScrapflyClient, ScrapeConfig } from '@scrapfly/scrapfly-sdk';
12
+ *
13
+ * const client = new ScrapflyClient({ key: 'your-api-key' });
14
+ * const result = await client.scrape(new ScrapeConfig({
15
+ * url: 'https://web-scraping.dev/products',
16
+ * render_js: true,
17
+ * asp: true,
18
+ * }));
19
+ * console.log(result.content);
20
+ * ```
21
+ *
22
+ * See the [Scrapfly docs](https://scrapfly.io/docs) for the full API
23
+ * reference.
24
+ *
25
+ * @module
26
+ */
1
27
  export { ScrapflyClient } from './client.js';
2
28
  export { Format as ScrapeFormat, FormatOption as ScrapeFormatOptions, ScrapeConfig, ScreenshotFlags, } from './scrapeconfig.js';
3
29
  export { Format as ScreenshotFormat, Options as ScreenshotOptions, ScreenshotConfig, VisionDeficiency, } from './screenshotconfig.js';
4
30
  export { ExtractionConfig } from './extractionconfig.js';
5
31
  export { BrowserConfig, ProxyPool, OperatingSystem } from './browserconfig.js';
6
32
  export type { BrowserConfigOptions } from './browserconfig.js';
33
+ /** Namespace of every error class the SDK can throw. See {@link ScrapflyError}. */
7
34
  export * as errors from './errors.js';
8
35
  export { ExtractionResult, ScrapeResult, ScreenshotResult } from './result.js';
9
36
  export type { AccountData, ClassifyOptions, ClassifyResult, ConfigData, ContextData, ResultData, ScreenshotMetadata } from './result.js';
package/esm/main.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,MAAM,IAAI,YAAY,EACtB,YAAY,IAAI,mBAAmB,EACnC,YAAY,EACZ,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,MAAM,IAAI,gBAAgB,EAC1B,OAAO,IAAI,iBAAiB,EAC5B,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC/E,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/E,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGzI,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC9G,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EACL,eAAe,EACf,eAAe,EAC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AE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGzI,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC9G,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EACL,eAAe,EACf,eAAe,EACf,aAAa,EACb,WAAW,EACX,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACvB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,2BAA2B,EAC3B,eAAe,EACf,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACV,6BAA6B,EAC7B,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,EAChB,8BAA8B,GAC/B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
package/esm/main.js CHANGED
@@ -1,8 +1,35 @@
1
+ /**
2
+ * # Scrapfly SDK for TypeScript / JavaScript
3
+ *
4
+ * Official client library for the [Scrapfly](https://scrapfly.io) web
5
+ * scraping API. Provides typed wrappers around the Scrape, Screenshot,
6
+ * Extraction, Crawler, Monitoring, and Cloud Browser APIs.
7
+ *
8
+ * ## Quick start
9
+ *
10
+ * ```ts
11
+ * import { ScrapflyClient, ScrapeConfig } from '@scrapfly/scrapfly-sdk';
12
+ *
13
+ * const client = new ScrapflyClient({ key: 'your-api-key' });
14
+ * const result = await client.scrape(new ScrapeConfig({
15
+ * url: 'https://web-scraping.dev/products',
16
+ * render_js: true,
17
+ * asp: true,
18
+ * }));
19
+ * console.log(result.content);
20
+ * ```
21
+ *
22
+ * See the [Scrapfly docs](https://scrapfly.io/docs) for the full API
23
+ * reference.
24
+ *
25
+ * @module
26
+ */
1
27
  export { ScrapflyClient } from './client.js';
2
28
  export { Format as ScrapeFormat, FormatOption as ScrapeFormatOptions, ScrapeConfig, ScreenshotFlags, } from './scrapeconfig.js';
3
29
  export { Format as ScreenshotFormat, Options as ScreenshotOptions, ScreenshotConfig, VisionDeficiency, } from './screenshotconfig.js';
4
30
  export { ExtractionConfig } from './extractionconfig.js';
5
31
  export { BrowserConfig, ProxyPool, OperatingSystem } from './browserconfig.js';
32
+ /** Namespace of every error class the SDK can throw. See {@link ScrapflyError}. */
6
33
  export * as errors from './errors.js';
7
34
  export { ExtractionResult, ScrapeResult, ScreenshotResult } from './result.js';
8
35
  // Crawler API