@distilled.cloud/steel 0.0.0 → 1.0.0-rc.20

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 (102) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +66 -4
  3. package/lib/.lazy.json +1 -0
  4. package/lib/_bundle/lazy.js +4 -0
  5. package/lib/_bundle/sdk.js +2 -0
  6. package/lib/_bundle/sdk.js.map +1 -0
  7. package/lib/credentials.d.ts +24 -0
  8. package/lib/credentials.d.ts.map +1 -0
  9. package/lib/credentials.js +1 -0
  10. package/lib/errors.d.ts +39 -0
  11. package/lib/errors.d.ts.map +1 -0
  12. package/lib/errors.js +1 -0
  13. package/lib/index.d.ts +26 -0
  14. package/lib/index.d.ts.map +1 -0
  15. package/lib/index.js +7 -0
  16. package/lib/index.lazy.js +7 -0
  17. package/lib/index.lazy.js.map +1 -0
  18. package/lib/pagination.d.ts +10 -0
  19. package/lib/pagination.d.ts.map +1 -0
  20. package/lib/pagination.js +1 -0
  21. package/lib/protocol.d.ts +19 -0
  22. package/lib/protocol.d.ts.map +1 -0
  23. package/lib/protocol.js +1 -0
  24. package/lib/retry.d.ts +50 -0
  25. package/lib/retry.d.ts.map +1 -0
  26. package/lib/retry.js +1 -0
  27. package/lib/services/api_keys.d.ts +63 -0
  28. package/lib/services/api_keys.d.ts.map +1 -0
  29. package/lib/services/api_keys.js +2 -0
  30. package/lib/services/api_keys.js.map +1 -0
  31. package/lib/services/auth.d.ts +32 -0
  32. package/lib/services/auth.d.ts.map +1 -0
  33. package/lib/services/auth.js +2 -0
  34. package/lib/services/auth.js.map +1 -0
  35. package/lib/services/browser_tools.d.ts +166 -0
  36. package/lib/services/browser_tools.d.ts.map +1 -0
  37. package/lib/services/browser_tools.js +2 -0
  38. package/lib/services/browser_tools.js.map +1 -0
  39. package/lib/services/captchas.d.ts +72 -0
  40. package/lib/services/captchas.d.ts.map +1 -0
  41. package/lib/services/captchas.js +2 -0
  42. package/lib/services/captchas.js.map +1 -0
  43. package/lib/services/credentials.d.ts +127 -0
  44. package/lib/services/credentials.d.ts.map +1 -0
  45. package/lib/services/credentials.js +2 -0
  46. package/lib/services/credentials.js.map +1 -0
  47. package/lib/services/extensions.d.ts +122 -0
  48. package/lib/services/extensions.d.ts.map +1 -0
  49. package/lib/services/extensions.js +2 -0
  50. package/lib/services/extensions.js.map +1 -0
  51. package/lib/services/files.d.ts +144 -0
  52. package/lib/services/files.d.ts.map +1 -0
  53. package/lib/services/files.js +2 -0
  54. package/lib/services/files.js.map +1 -0
  55. package/lib/services/index.d.ts +11 -0
  56. package/lib/services/index.d.ts.map +1 -0
  57. package/lib/services/index.js +10 -0
  58. package/lib/services/profiles.d.ts +422 -0
  59. package/lib/services/profiles.d.ts.map +1 -0
  60. package/lib/services/profiles.js +2 -0
  61. package/lib/services/profiles.js.map +1 -0
  62. package/lib/services/projects.d.ts +50 -0
  63. package/lib/services/projects.d.ts.map +1 -0
  64. package/lib/services/projects.js +2 -0
  65. package/lib/services/projects.js.map +1 -0
  66. package/lib/services/sessions.d.ts +1977 -0
  67. package/lib/services/sessions.d.ts.map +1 -0
  68. package/lib/services/sessions.js +44 -0
  69. package/lib/services/sessions.js.map +1 -0
  70. package/lib/services.lazy/api_keys.js +1 -0
  71. package/lib/services.lazy/auth.js +1 -0
  72. package/lib/services.lazy/browser_tools.js +1 -0
  73. package/lib/services.lazy/captchas.js +1 -0
  74. package/lib/services.lazy/credentials.js +1 -0
  75. package/lib/services.lazy/extensions.js +1 -0
  76. package/lib/services.lazy/files.js +1 -0
  77. package/lib/services.lazy/index.js +3 -0
  78. package/lib/services.lazy/profiles.js +1 -0
  79. package/lib/services.lazy/projects.js +1 -0
  80. package/lib/services.lazy/sessions.js +4 -0
  81. package/lib/traits.d.ts +11 -0
  82. package/lib/traits.d.ts.map +1 -0
  83. package/lib/traits.js +1 -0
  84. package/package.json +83 -2
  85. package/src/credentials.ts +63 -0
  86. package/src/errors.ts +51 -0
  87. package/src/index.ts +25 -0
  88. package/src/pagination.ts +9 -0
  89. package/src/protocol.ts +76 -0
  90. package/src/retry.ts +69 -0
  91. package/src/services/api_keys.ts +124 -0
  92. package/src/services/auth.ts +101 -0
  93. package/src/services/browser_tools.ts +338 -0
  94. package/src/services/captchas.ts +216 -0
  95. package/src/services/credentials.ts +292 -0
  96. package/src/services/extensions.ts +338 -0
  97. package/src/services/files.ts +456 -0
  98. package/src/services/index.ts +11 -0
  99. package/src/services/profiles.ts +871 -0
  100. package/src/services/projects.ts +146 -0
  101. package/src/services/sessions.ts +4515 -0
  102. package/src/traits.ts +46 -0
@@ -0,0 +1,338 @@
1
+ import * as API from "@distilled.cloud/core/api";
2
+ import * as C from "@distilled.cloud/core/category";
3
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs (specs/spec-mirror-steel/specs/openapi.json). Do not edit.
4
+ import * as S from "@distilled.cloud/core/schema-lite";
5
+ import * as __L from "@distilled.cloud/core/schema-lite";
6
+ import { UnknownSteelError } from "../errors.ts";
7
+ import { SteelProtocol, type SteelOpError, type SteelOpContext } from "../protocol.ts";
8
+ import * as Retry from "../retry.ts";
9
+ import * as T from "../traits.ts";
10
+ // Schema table, filled on first reach (see __S at the end).
11
+ const __s: any[] = [];
12
+
13
+ export type { SteelOpError, SteelOpContext };
14
+
15
+ /** Span facts shared by every operation (com.distilled.telemetry#service). */
16
+ const TELEMETRY = {
17
+ system: "steel-api",
18
+ responseHeaders: [
19
+ { header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" },
20
+ { header: "request-id", name: "http.response.header.request-id", transform: "list" },
21
+ ],
22
+ prefix: "Steel",
23
+ service: "BrowserTools",
24
+ propagate: "w3c",
25
+ } as const;
26
+
27
+ export class BadRequest
28
+ extends /*@__PURE__*/ T.applyErrorMatchers(
29
+ /*@__PURE__*/ S.TaggedError<BadRequest>()("BadRequest", {
30
+ code: S.Number,
31
+ message: S.String,
32
+ }).pipe(C.withBadRequestError),
33
+ [{ status: 400 }],
34
+ ) {}
35
+
36
+ export class UnprocessableEntity
37
+ extends /*@__PURE__*/ T.applyErrorMatchers(
38
+ /*@__PURE__*/ S.TaggedError<UnprocessableEntity>()("UnprocessableEntity", {
39
+ code: S.Number,
40
+ message: S.String,
41
+ }).pipe(C.withBadRequestError),
42
+ [{ status: 422 }],
43
+ ) {}
44
+
45
+ export interface PdfRequest {
46
+ /** Delay before generating the PDF (in milliseconds) */
47
+ delay?: number | undefined;
48
+ /** Project to execute the PDF generation in. */
49
+ projectId?: string | undefined;
50
+ /** The desired region for the action to be performed in */
51
+ region?: unknown | undefined;
52
+ /** URL of the webpage to convert to PDF */
53
+ url: string;
54
+ /** Use a Steel-provided residential proxy for generating the PDF */
55
+ useProxy?: boolean | undefined;
56
+ }
57
+ export interface PdfResponse {
58
+ /** URL where the PDF is hosted */
59
+ url: string;
60
+ }
61
+ export type ScrapeRequestFormatItem = "html" | "readability" | "cleaned_html" | "markdown";
62
+ /** Desired format(s) for the scraped content. Default is `html`. */
63
+ export type ScrapeRequestFormatList = Array<ScrapeRequestFormatItem | (string & {})>;
64
+ export interface ScrapeRequest {
65
+ /** Delay before scraping (in milliseconds) */
66
+ delay?: number | undefined;
67
+ /** Desired format(s) for the scraped content. Default is `html`. */
68
+ format?: ScrapeRequestFormatList | undefined;
69
+ /** Include a PDF in the response */
70
+ pdf?: boolean | undefined;
71
+ /** Project to execute the scrape in. */
72
+ projectId?: string | undefined;
73
+ /** The desired region for the action to be performed in */
74
+ region?: unknown | undefined;
75
+ /** Include a screenshot in the response */
76
+ screenshot?: boolean | undefined;
77
+ /** URL of the webpage to scrape. A URL without a scheme is fetched over HTTPS. */
78
+ url: string;
79
+ /** Use a Steel-provided residential proxy for the scrape */
80
+ useProxy?: boolean | undefined;
81
+ }
82
+ /** Webpage content in Readability format */
83
+ export type ScrapeResponseContentReadabilityMap = { [key: string]: unknown | undefined };
84
+ export interface ScrapeResponseContent {
85
+ /** Cleaned HTML content of the webpage */
86
+ cleaned_html?: string | undefined;
87
+ /** Raw HTML content of the webpage */
88
+ html?: string | undefined;
89
+ /** Webpage content converted to Markdown */
90
+ markdown?: string | undefined;
91
+ /** Webpage content in Readability format */
92
+ readability?: ScrapeResponseContentReadabilityMap | undefined;
93
+ }
94
+ export interface ScrapeResponseLinksItem {
95
+ /** Text content of the link */
96
+ text: string;
97
+ /** URL of the link */
98
+ url: string;
99
+ }
100
+ export type ScrapeResponseLinksList = Array<ScrapeResponseLinksItem>;
101
+ export interface ScrapeResponseMetadata {
102
+ /** Author of the article content */
103
+ articleAuthor?: string | undefined;
104
+ /** Author of the webpage content */
105
+ author?: string | undefined;
106
+ /** Canonical URL of the webpage */
107
+ canonical?: string | undefined;
108
+ /** Description of the webpage */
109
+ description?: string | undefined;
110
+ /** Favicon URL of the website */
111
+ favicon?: string | undefined;
112
+ /** JSON-LD structured data from the webpage */
113
+ jsonLd?: unknown | undefined;
114
+ /** Keywords associated with the webpage */
115
+ keywords?: string | undefined;
116
+ /** Detected language of the webpage */
117
+ language?: string | undefined;
118
+ /** Last modification time of the content */
119
+ modifiedTime?: string | undefined;
120
+ /** Open Graph description */
121
+ ogDescription?: string | undefined;
122
+ /** Open Graph image URL */
123
+ ogImage?: string | undefined;
124
+ /** Open Graph site name */
125
+ ogSiteName?: string | undefined;
126
+ /** Open Graph title */
127
+ ogTitle?: string | undefined;
128
+ /** Open Graph URL */
129
+ ogUrl?: string | undefined;
130
+ /** Publication time of the content */
131
+ publishedTime?: string | undefined;
132
+ /** HTTP status code of the response */
133
+ statusCode: number;
134
+ /** Timestamp when the scrape was performed */
135
+ timestamp?: string | undefined;
136
+ /** Title of the webpage */
137
+ title?: string | undefined;
138
+ /** Source URL of the scraped page */
139
+ urlSource?: string | undefined;
140
+ }
141
+ export interface ScrapeResponsePdf {
142
+ /** URL of the generated PDF */
143
+ url: string;
144
+ }
145
+ export interface ScrapeResponseScreenshot {
146
+ /** URL of the screenshot image */
147
+ url: string;
148
+ }
149
+ /** Response from a successful scrape request */
150
+ export interface ScrapeResponse {
151
+ content: ScrapeResponseContent;
152
+ links: ScrapeResponseLinksList;
153
+ metadata: ScrapeResponseMetadata;
154
+ pdf?: ScrapeResponsePdf | undefined;
155
+ screenshot?: ScrapeResponseScreenshot | undefined;
156
+ }
157
+ export interface ScreenshotRequest {
158
+ /** Delay before capturing the screenshot (in milliseconds) */
159
+ delay?: number | undefined;
160
+ /** Capture the full page screenshot. Default is `false`. */
161
+ fullPage?: boolean | undefined;
162
+ /** Project to execute the screenshot in. */
163
+ projectId?: string | undefined;
164
+ /** The desired region for the action to be performed in */
165
+ region?: unknown | undefined;
166
+ /** URL of the webpage to capture */
167
+ url: string;
168
+ /** Use a Steel-provided residential proxy for capturing the screenshot */
169
+ useProxy?: boolean | undefined;
170
+ }
171
+ export interface ScreenshotResponse {
172
+ /** URL where the screenshot is hosted */
173
+ url: string;
174
+ }
175
+ export type PdfError = BadRequest | UnprocessableEntity | SteelOpError;
176
+ /** Convert webpage to PDF Generates a PDF from a specified webpage. */
177
+ export const pdf: API.OperationMethod<PdfRequest, PdfResponse, PdfError, SteelOpContext> =
178
+ /*@__PURE__*/ API.make(() => ({
179
+ input: __S(0, __c0, 0) as any as S.Schema<PdfRequest>,
180
+ output: __S(8, __c1, 0) as any as S.Schema<PdfResponse>,
181
+ errors: [BadRequest, UnprocessableEntity, UnknownSteelError],
182
+ protocol: SteelProtocol,
183
+ retry: Retry.Retry,
184
+ telemetry: TELEMETRY,
185
+ span: "Pdf",
186
+ }));
187
+
188
+ export type ScrapeError = BadRequest | UnprocessableEntity | SteelOpError;
189
+ /** Scrape webpage content Extracts content from a specified URL. */
190
+ export const scrape: API.OperationMethod<
191
+ ScrapeRequest,
192
+ ScrapeResponse,
193
+ ScrapeError,
194
+ SteelOpContext
195
+ > = /*@__PURE__*/ API.make(() => ({
196
+ input: __S(17, __c2, 1) as any as S.Schema<ScrapeRequest>,
197
+ output: __S(23, __c2, 7) as any as S.Schema<ScrapeResponse>,
198
+ errors: [BadRequest, UnprocessableEntity, UnknownSteelError],
199
+ protocol: SteelProtocol,
200
+ retry: Retry.Retry,
201
+ telemetry: TELEMETRY,
202
+ span: "Scrape",
203
+ }));
204
+
205
+ export type ScreenshotError = BadRequest | UnprocessableEntity | SteelOpError;
206
+ /** Capture webpage screenshot Captures a screenshot of a specified webpage. */
207
+ export const screenshot: API.OperationMethod<
208
+ ScreenshotRequest,
209
+ ScreenshotResponse,
210
+ ScreenshotError,
211
+ SteelOpContext
212
+ > = /*@__PURE__*/ API.make(() => ({
213
+ input: __S(24, __c3, 0) as any as S.Schema<ScreenshotRequest>,
214
+ output: __S(8, __c1, 0) as any as S.Schema<ScreenshotResponse>,
215
+ errors: [BadRequest, UnprocessableEntity, UnknownSteelError],
216
+ protocol: SteelProtocol,
217
+ retry: Retry.Retry,
218
+ telemetry: TELEMETRY,
219
+ span: "Screenshot",
220
+ }));
221
+
222
+ // Schema builders: each runs one schema initializer, on that schema's first use.
223
+ function __c0(j: number): any {
224
+ switch (j) {
225
+ case 0:
226
+ return S.suspend(() =>
227
+ S.Struct({
228
+ delay: S.optional(S.Number),
229
+ projectId: S.optional(S.String),
230
+ region: S.optional(S.Unknown),
231
+ url: S.String,
232
+ useProxy: S.optional(S.Boolean),
233
+ }).pipe(T.Http({ method: "POST", uri: "/v1/pdf", code: 200 })),
234
+ ).annotate({ identifier: "PdfRequest" });
235
+ }
236
+ }
237
+ function __c1(j: number): any {
238
+ switch (j) {
239
+ case 0:
240
+ return S.suspend(() =>
241
+ S.Struct({
242
+ url: S.String,
243
+ }),
244
+ ).annotate({ identifier: "PdfResponse" });
245
+ }
246
+ }
247
+ function __c2(j: number): any {
248
+ switch (j) {
249
+ case 0:
250
+ return S.Array(S.String);
251
+ case 1:
252
+ return S.suspend(() =>
253
+ S.Struct({
254
+ delay: S.optional(S.Number),
255
+ format: S.optional(__S(16, __c2, 0)),
256
+ pdf: S.optional(S.Boolean),
257
+ projectId: S.optional(S.String),
258
+ region: S.optional(S.Unknown),
259
+ screenshot: S.optional(S.Boolean),
260
+ url: S.String,
261
+ useProxy: S.optional(S.Boolean),
262
+ }).pipe(T.Http({ method: "POST", uri: "/v1/scrape", code: 200 })),
263
+ ).annotate({ identifier: "ScrapeRequest" });
264
+ case 2:
265
+ return S.Record(S.String, S.Unknown);
266
+ case 3:
267
+ return S.suspend(() =>
268
+ S.Struct({
269
+ cleaned_html: S.optional(S.String),
270
+ html: S.optional(S.String),
271
+ markdown: S.optional(S.String),
272
+ readability: S.optional(__S(18, __c2, 2)),
273
+ }),
274
+ ).annotate({ identifier: "ScrapeResponseContent" });
275
+ case 4:
276
+ return S.suspend(() =>
277
+ S.Struct({
278
+ text: S.String,
279
+ url: S.String,
280
+ }),
281
+ ).annotate({ identifier: "ScrapeResponseLinksItem" });
282
+ case 5:
283
+ return S.Array(__S(20, __c2, 4));
284
+ case 6:
285
+ return S.suspend(() =>
286
+ S.Struct({
287
+ articleAuthor: S.optional(S.String),
288
+ author: S.optional(S.String),
289
+ canonical: S.optional(S.String),
290
+ description: S.optional(S.String),
291
+ favicon: S.optional(S.String),
292
+ jsonLd: S.optional(S.Unknown),
293
+ keywords: S.optional(S.String),
294
+ language: S.optional(S.String),
295
+ modifiedTime: S.optional(S.String),
296
+ ogDescription: S.optional(S.String),
297
+ ogImage: S.optional(S.String),
298
+ ogSiteName: S.optional(S.String),
299
+ ogTitle: S.optional(S.String),
300
+ ogUrl: S.optional(S.String),
301
+ publishedTime: S.optional(S.String),
302
+ statusCode: S.Number,
303
+ timestamp: S.optional(S.String),
304
+ title: S.optional(S.String),
305
+ urlSource: S.optional(S.String),
306
+ }),
307
+ ).annotate({ identifier: "ScrapeResponseMetadata" });
308
+ case 7:
309
+ return S.suspend(() =>
310
+ S.Struct({
311
+ content: __S(19, __c2, 3),
312
+ links: __S(21, __c2, 5),
313
+ metadata: __S(22, __c2, 6),
314
+ pdf: S.optional(__S(8, __c1, 0)),
315
+ screenshot: S.optional(__S(8, __c1, 0)),
316
+ }),
317
+ ).annotate({ identifier: "ScrapeResponse" });
318
+ }
319
+ }
320
+ function __c3(j: number): any {
321
+ switch (j) {
322
+ case 0:
323
+ return S.suspend(() =>
324
+ S.Struct({
325
+ delay: S.optional(S.Number),
326
+ fullPage: S.optional(S.Boolean),
327
+ projectId: S.optional(S.String),
328
+ region: S.optional(S.Unknown),
329
+ url: S.String,
330
+ useProxy: S.optional(S.Boolean),
331
+ }).pipe(T.Http({ method: "POST", uri: "/v1/screenshot", code: 200 })),
332
+ ).annotate({ identifier: "ScreenshotRequest" });
333
+ }
334
+ }
335
+ // Schema table: entry i is schema j of builder f, made on first reach.
336
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
337
+ return (__s[i] ??= __L.at(f, j));
338
+ }
@@ -0,0 +1,216 @@
1
+ import * as API from "@distilled.cloud/core/api";
2
+ import * as C from "@distilled.cloud/core/category";
3
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs (specs/spec-mirror-steel/specs/openapi.json). Do not edit.
4
+ import * as S from "@distilled.cloud/core/schema-lite";
5
+ import * as __L from "@distilled.cloud/core/schema-lite";
6
+ import { UnknownSteelError } from "../errors.ts";
7
+ import { SteelProtocol, type SteelOpError, type SteelOpContext } from "../protocol.ts";
8
+ import * as Retry from "../retry.ts";
9
+ import * as T from "../traits.ts";
10
+ // Schema table, filled on first reach (see __S at the end).
11
+ const __s: any[] = [];
12
+
13
+ export type { SteelOpError, SteelOpContext };
14
+
15
+ /** Span facts shared by every operation (com.distilled.telemetry#service). */
16
+ const TELEMETRY = {
17
+ system: "steel-api",
18
+ responseHeaders: [
19
+ { header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" },
20
+ { header: "request-id", name: "http.response.header.request-id", transform: "list" },
21
+ ],
22
+ prefix: "Steel",
23
+ service: "Captchas",
24
+ labels: "steel",
25
+ propagate: "w3c",
26
+ } as const;
27
+
28
+ export class BadRequest
29
+ extends /*@__PURE__*/ T.applyErrorMatchers(
30
+ /*@__PURE__*/ S.TaggedError<BadRequest>()("BadRequest", {
31
+ code: S.Number,
32
+ message: S.String,
33
+ }).pipe(C.withBadRequestError),
34
+ [{ status: 400 }],
35
+ ) {}
36
+
37
+ export interface GetCaptchaStatusRequest {
38
+ /** Session ID */
39
+ sessionId: string;
40
+ }
41
+ /** Array of captcha tasks */
42
+ export type CaptchaStateResponseItemTasksList = Array<unknown>;
43
+ export interface CaptchaStateResponseItem {
44
+ /** Timestamp when the state was created */
45
+ created?: number | undefined;
46
+ /** Whether a captcha is currently being solved */
47
+ isSolvingCaptcha: boolean;
48
+ /** Timestamp when the state was last updated */
49
+ lastUpdated?: number | undefined;
50
+ /** The page ID where the captcha is located */
51
+ pageId: string;
52
+ /** Array of captcha tasks */
53
+ tasks: CaptchaStateResponseItemTasksList;
54
+ /** The URL where the captcha is located */
55
+ url: string;
56
+ }
57
+ export type CaptchaStateResponse = Array<CaptchaStateResponseItem>;
58
+ export type GetCaptchaStatusResponse = CaptchaStateResponse;
59
+ export interface SolveCaptchaRequest {
60
+ /** Session ID */
61
+ sessionId: string;
62
+ /** The page ID where the captcha is located */
63
+ pageId?: string | undefined;
64
+ /** The task ID of the specific captcha to solve */
65
+ taskId?: string | undefined;
66
+ /** The URL where the captcha is located */
67
+ url?: string | undefined;
68
+ }
69
+ export interface CaptchaActionResponse {
70
+ /** Response message */
71
+ message?: string | undefined;
72
+ /** Whether the action was successful */
73
+ success: boolean;
74
+ }
75
+ export interface SolveImageCaptchaRequest {
76
+ /** Session ID */
77
+ sessionId: string;
78
+ /** XPath to the captcha image element */
79
+ imageXPath: string;
80
+ /** XPath to the captcha input element */
81
+ inputXPath: string;
82
+ /** URL where the captcha is located. Defaults to the current page URL */
83
+ url?: string | undefined;
84
+ }
85
+ export type GetCaptchaStatusError = BadRequest | SteelOpError;
86
+ /** Get captcha status Gets the current captcha status for a session */
87
+ export const getCaptchaStatus: API.OperationMethod<
88
+ GetCaptchaStatusRequest,
89
+ GetCaptchaStatusResponse,
90
+ GetCaptchaStatusError,
91
+ SteelOpContext
92
+ > = /*@__PURE__*/ API.make(() => ({
93
+ input: __S(0, __c0, 0) as any as S.Schema<GetCaptchaStatusRequest>,
94
+ output: __S(4, __c0, 4) as any as S.Schema<GetCaptchaStatusResponse>,
95
+ errors: [BadRequest, UnknownSteelError],
96
+ protocol: SteelProtocol,
97
+ retry: Retry.Retry,
98
+ telemetry: TELEMETRY,
99
+ span: "GetCaptchaStatus",
100
+ }));
101
+
102
+ export type SolveCaptchaError = BadRequest | SteelOpError;
103
+ /** Solve captcha(s) Solves captcha(s) for the session. If pageId, url, or taskId is provided, solves that specific captcha. If no parameters are provided, solves all detected captchas. Use this when autoCaptchaSolving is disabled in stealthConfig. */
104
+ export const solveCaptcha: API.OperationMethod<
105
+ SolveCaptchaRequest,
106
+ CaptchaActionResponse,
107
+ SolveCaptchaError,
108
+ SteelOpContext
109
+ > = /*@__PURE__*/ API.make(() => ({
110
+ input: __S(8, __c1, 0) as any as S.Schema<SolveCaptchaRequest>,
111
+ output: __S(16, __c2, 0) as any as S.Schema<CaptchaActionResponse>,
112
+ errors: [BadRequest, UnknownSteelError],
113
+ protocol: SteelProtocol,
114
+ retry: Retry.Retry,
115
+ telemetry: TELEMETRY,
116
+ span: "SolveCaptcha",
117
+ }));
118
+
119
+ export type SolveImageCaptchaError = BadRequest | SteelOpError;
120
+ /** Solve image captcha Solves an image captcha using XPath selectors */
121
+ export const solveImageCaptcha: API.OperationMethod<
122
+ SolveImageCaptchaRequest,
123
+ CaptchaActionResponse,
124
+ SolveImageCaptchaError,
125
+ SteelOpContext
126
+ > = /*@__PURE__*/ API.make(() => ({
127
+ input: __S(24, __c3, 0) as any as S.Schema<SolveImageCaptchaRequest>,
128
+ output: __S(16, __c2, 0) as any as S.Schema<CaptchaActionResponse>,
129
+ errors: [BadRequest, UnknownSteelError],
130
+ protocol: SteelProtocol,
131
+ retry: Retry.Retry,
132
+ telemetry: TELEMETRY,
133
+ span: "SolveImageCaptcha",
134
+ }));
135
+
136
+ // Schema builders: each runs one schema initializer, on that schema's first use.
137
+ function __c0(j: number): any {
138
+ switch (j) {
139
+ case 0:
140
+ return S.suspend(() =>
141
+ S.Struct({
142
+ sessionId: S.String.pipe(T.Label()),
143
+ }).pipe(
144
+ T.Http({ method: "GET", uri: "/v1/sessions/{sessionId}/captchas/status", code: 200 }),
145
+ ),
146
+ ).annotate({ identifier: "GetCaptchaStatusRequest" });
147
+ case 1:
148
+ return S.Array(S.Unknown);
149
+ case 2:
150
+ return S.suspend(() =>
151
+ S.Struct({
152
+ created: S.optional(S.Number),
153
+ isSolvingCaptcha: S.Boolean,
154
+ lastUpdated: S.optional(S.Number),
155
+ pageId: S.String,
156
+ tasks: __S(1, __c0, 1),
157
+ url: S.String,
158
+ }),
159
+ ).annotate({ identifier: "CaptchaStateResponseItem" });
160
+ case 3:
161
+ return S.Array(__S(2, __c0, 2));
162
+ case 4:
163
+ return S.suspend(() => __S(3, __c0, 3).pipe(T.RawResponseRoot())).annotate({
164
+ identifier: "GetCaptchaStatusResponse",
165
+ });
166
+ }
167
+ }
168
+ function __c1(j: number): any {
169
+ switch (j) {
170
+ case 0:
171
+ return S.suspend(() =>
172
+ S.Struct({
173
+ sessionId: S.String.pipe(T.Label()),
174
+ pageId: S.optional(S.String),
175
+ taskId: S.optional(S.String),
176
+ url: S.optional(S.String),
177
+ }).pipe(
178
+ T.Http({ method: "POST", uri: "/v1/sessions/{sessionId}/captchas/solve", code: 200 }),
179
+ ),
180
+ ).annotate({ identifier: "SolveCaptchaRequest" });
181
+ }
182
+ }
183
+ function __c2(j: number): any {
184
+ switch (j) {
185
+ case 0:
186
+ return S.suspend(() =>
187
+ S.Struct({
188
+ message: S.optional(S.String),
189
+ success: S.Boolean,
190
+ }),
191
+ ).annotate({ identifier: "CaptchaActionResponse" });
192
+ }
193
+ }
194
+ function __c3(j: number): any {
195
+ switch (j) {
196
+ case 0:
197
+ return S.suspend(() =>
198
+ S.Struct({
199
+ sessionId: S.String.pipe(T.Label()),
200
+ imageXPath: S.String,
201
+ inputXPath: S.String,
202
+ url: S.optional(S.String),
203
+ }).pipe(
204
+ T.Http({
205
+ method: "POST",
206
+ uri: "/v1/sessions/{sessionId}/captchas/solve-image",
207
+ code: 200,
208
+ }),
209
+ ),
210
+ ).annotate({ identifier: "SolveImageCaptchaRequest" });
211
+ }
212
+ }
213
+ // Schema table: entry i is schema j of builder f, made on first reach.
214
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
215
+ return (__s[i] ??= __L.at(f, j));
216
+ }