@intuned/browser-dev 0.1.6-dev.1 → 0.1.8-dev.0
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/dist/ai/export.d.ts +11 -160
- package/dist/ai/extractStructuredData.js +4 -4
- package/dist/ai/index.d.ts +11 -160
- package/dist/ai/tests/testExtractFromContent.spec.js +2 -2
- package/dist/ai/tests/testIsPageLoaded.spec.js +2 -2
- package/dist/ai/validators.js +2 -3
- package/dist/helpers/export.d.ts +4 -5
- package/dist/helpers/frame_utils/tests/testFindAllIframes.spec.js +2 -2
- package/dist/helpers/gotoUrl.js +51 -51
- package/dist/helpers/index.d.ts +4 -5
- package/dist/helpers/tests/testClickUntilExhausted.spec.js +4 -3
- package/dist/helpers/tests/testDownloadFile.spec.js +3 -3
- package/dist/helpers/tests/testGoToUrl.spec.js +2 -2
- package/dist/helpers/tests/testScrollToLoadContent.spec.js +2 -2
- package/dist/helpers/tests/testWithDomSettledWait.spec.js +2 -2
- package/dist/{common → optimized-extractors/common}/aiModelsValidations.js +4 -2
- package/dist/optimized-extractors/common/extractStructuredDataUsingClaude.js +1 -1
- package/dist/optimized-extractors/common/extractStructuredDataUsingGoogle.js +1 -1
- package/dist/optimized-extractors/common/extractStructuredDataUsingOpenAi.js +1 -1
- package/dist/optimized-extractors/export.d.ts +1 -1
- package/dist/optimized-extractors/index.d.ts +1 -1
- package/dist/optimized-extractors/types/aiModelsValidation.js +3 -1
- package/package.json +4 -3
- package/dist/ai/types/models.js +0 -42
- package/generated-docs/ai/functions/extractStructuredData.mdx +0 -255
- package/generated-docs/ai/functions/isPageLoaded.mdx +0 -89
- package/generated-docs/ai/interfaces/ArraySchema.mdx +0 -36
- package/generated-docs/ai/interfaces/BasicSchema.mdx +0 -14
- package/generated-docs/ai/interfaces/BooleanSchema.mdx +0 -28
- package/generated-docs/ai/interfaces/ImageBufferContentItem.mdx +0 -16
- package/generated-docs/ai/interfaces/ImageUrlContentItem.mdx +0 -16
- package/generated-docs/ai/interfaces/NumberSchema.mdx +0 -35
- package/generated-docs/ai/interfaces/ObjectSchema.mdx +0 -39
- package/generated-docs/ai/interfaces/StringSchema.mdx +0 -35
- package/generated-docs/ai/interfaces/TextContentItem.mdx +0 -14
- package/generated-docs/ai/type-aliases/ContentItem.mdx +0 -12
- package/generated-docs/ai/type-aliases/JsonSchema.mdx +0 -47
- package/generated-docs/ai/type-aliases/SUPPORTED_MODELS.mdx +0 -85
- package/generated-docs/helpers/functions/clickButtonAndWait.mdx +0 -63
- package/generated-docs/helpers/functions/clickUntilExhausted.mdx +0 -112
- package/generated-docs/helpers/functions/downloadFile.mdx +0 -99
- package/generated-docs/helpers/functions/extractMarkdown.mdx +0 -56
- package/generated-docs/helpers/functions/filterEmptyValues.mdx +0 -51
- package/generated-docs/helpers/functions/goToUrl.mdx +0 -124
- package/generated-docs/helpers/functions/processDate.mdx +0 -55
- package/generated-docs/helpers/functions/resolveUrl.mdx +0 -165
- package/generated-docs/helpers/functions/sanitizeHtml.mdx +0 -113
- package/generated-docs/helpers/functions/saveFileToS3.mdx +0 -127
- package/generated-docs/helpers/functions/scrollToLoadContent.mdx +0 -83
- package/generated-docs/helpers/functions/uploadFileToS3.mdx +0 -121
- package/generated-docs/helpers/functions/validateDataUsingSchema.mdx +0 -90
- package/generated-docs/helpers/functions/waitForDomSettled.mdx +0 -91
- package/generated-docs/helpers/functions/withNetworkSettledWait.mdx +0 -76
- package/generated-docs/helpers/interfaces/Attachment.mdx +0 -56
- package/generated-docs/helpers/interfaces/S3Configs.mdx +0 -52
- package/generated-docs/helpers/interfaces/SanitizeHtmlOptions.mdx +0 -22
- package/generated-docs/helpers/type-aliases/AttachmentType.mdx +0 -10
- package/generated-docs/helpers/type-aliases/FileType.mdx +0 -61
- package/generated-docs/helpers/type-aliases/Trigger.mdx +0 -62
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: SUPPORTED_MODELS
|
|
3
|
-
description: ""
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
```typescript
|
|
7
|
-
export type SUPPORTED_MODELS = | SUPPORTED_CLAUDE_MODELS
|
|
8
|
-
| SUPPORTED_OPENAI_MODELS;
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Union type representing all supported AI models for data extraction.
|
|
12
|
-
Includes models from both OpenAI and Anthropic.
|
|
13
|
-
|
|
14
|
-
**Supported OpenAI Models:**
|
|
15
|
-
"gpt-3.5-turbo"
|
|
16
|
-
"gpt-3.5-turbo-0125"
|
|
17
|
-
"gpt-3.5-turbo-0301"
|
|
18
|
-
"gpt-3.5-turbo-0613"
|
|
19
|
-
"gpt-3.5-turbo-1106"
|
|
20
|
-
"gpt-3.5-turbo-16k"
|
|
21
|
-
"gpt-3.5-turbo-16k-0613"
|
|
22
|
-
"gpt-3.5-turbo-instruct"
|
|
23
|
-
"gpt-3.5-turbo-instruct-0914"
|
|
24
|
-
"gpt-4"
|
|
25
|
-
"gpt-4-0314"
|
|
26
|
-
"gpt-4-0613"
|
|
27
|
-
"gpt-4-32k"
|
|
28
|
-
"gpt-4-32k-0314"
|
|
29
|
-
"gpt-4-32k-0613"
|
|
30
|
-
"gpt-4-turbo"
|
|
31
|
-
"gpt-4-turbo-2024-04-09"
|
|
32
|
-
"gpt-4.1"
|
|
33
|
-
"gpt-4.1-2025-04-14"
|
|
34
|
-
"gpt-4.1-mini"
|
|
35
|
-
"gpt-4.1-mini-2025-04-14"
|
|
36
|
-
"gpt-4.1-nano"
|
|
37
|
-
"gpt-4.1-nano-2025-04-14"
|
|
38
|
-
"gpt-4o"
|
|
39
|
-
"gpt-4o-2024-05-13"
|
|
40
|
-
"gpt-4o-2024-08-06"
|
|
41
|
-
"gpt-4o-2024-11-20"
|
|
42
|
-
"gpt-4o-mini"
|
|
43
|
-
"gpt-4o-mini-2024-07-18"
|
|
44
|
-
"gpt-5"
|
|
45
|
-
"gpt-5-2025-08-07"
|
|
46
|
-
"gpt-5-chat"
|
|
47
|
-
"gpt-5-chat-latest"
|
|
48
|
-
"gpt-5-mini"
|
|
49
|
-
"gpt-5-mini-2025-08-07"
|
|
50
|
-
"gpt-5-nano"
|
|
51
|
-
"gpt-5-nano-2025-08-07"
|
|
52
|
-
"o1"
|
|
53
|
-
"o1-2024-12-17"
|
|
54
|
-
"o1-mini"
|
|
55
|
-
"o1-mini-2024-09-12"
|
|
56
|
-
"o1-pro"
|
|
57
|
-
"o1-pro-2025-03-19"
|
|
58
|
-
"o3"
|
|
59
|
-
"o3-2025-04-16"
|
|
60
|
-
"o3-deep-research"
|
|
61
|
-
"o3-deep-research-2025-06-26"
|
|
62
|
-
"o3-mini"
|
|
63
|
-
"o3-mini-2025-01-31"
|
|
64
|
-
"o3-pro"
|
|
65
|
-
"o3-pro-2025-06-10"
|
|
66
|
-
"o4-mini"
|
|
67
|
-
"o4-mini-2025-04-16"
|
|
68
|
-
"o4-mini-deep-research"
|
|
69
|
-
"o4-mini-deep-research-2025-06-26"
|
|
70
|
-
|
|
71
|
-
**Supported Anthropic (Claude) Models:**
|
|
72
|
-
"claude-3-5-haiku-20241022"
|
|
73
|
-
"claude-3-5-haiku-latest"
|
|
74
|
-
"claude-3-5-sonnet-20240620"
|
|
75
|
-
"claude-3-5-sonnet-20241022"
|
|
76
|
-
"claude-3-5-sonnet-latest"
|
|
77
|
-
"claude-3-7-sonnet-20250219"
|
|
78
|
-
"claude-3-7-sonnet-latest"
|
|
79
|
-
"claude-3-haiku-20240307"
|
|
80
|
-
"claude-4-opus-20250514"
|
|
81
|
-
"claude-4-sonnet-20250514"
|
|
82
|
-
"claude-opus-4-1"
|
|
83
|
-
"claude-opus-4-1-20250805"
|
|
84
|
-
"claude-opus-4-20250514"
|
|
85
|
-
"claude-sonnet-4-20250514"
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: clickButtonAndWait
|
|
3
|
-
description: ""
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
```typescript
|
|
7
|
-
export declare function clickButtonAndWait(input: {
|
|
8
|
-
page: Page;
|
|
9
|
-
buttonLocator: Locator;
|
|
10
|
-
clickDelay?: number;
|
|
11
|
-
}): Promise<void>;
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Click a button and wait briefly for content to load.
|
|
15
|
-
|
|
16
|
-
This function clicks a button element and waits for a specified delay, allowing time for
|
|
17
|
-
any triggered content to load. It automatically waits for network activity to settle.
|
|
18
|
-
|
|
19
|
-
## Examples
|
|
20
|
-
|
|
21
|
-
<CodeGroup>
|
|
22
|
-
|
|
23
|
-
```typescript Basic Button Click
|
|
24
|
-
import { clickButtonAndWait } from "@intuned/browser";
|
|
25
|
-
export default async function handler(params, page, context){
|
|
26
|
-
await page.goto("https://example.com/products");
|
|
27
|
-
const loadMoreButton = page.locator("#load-more-button");
|
|
28
|
-
await clickButtonAndWait({
|
|
29
|
-
page,
|
|
30
|
-
buttonLocator: loadMoreButton,
|
|
31
|
-
clickDelay: 1.0
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
</CodeGroup>
|
|
37
|
-
|
|
38
|
-
## Arguments
|
|
39
|
-
|
|
40
|
-
<ParamField path="input" type="Object" required
|
|
41
|
-
>
|
|
42
|
-
Configuration options
|
|
43
|
-
|
|
44
|
-
<Expandable title="input">
|
|
45
|
-
<ParamField path="input.page" type="Page">
|
|
46
|
-
Playwright Page object
|
|
47
|
-
</ParamField>
|
|
48
|
-
|
|
49
|
-
<ParamField path="input.buttonLocator" type="Locator">
|
|
50
|
-
Locator for the button element to click
|
|
51
|
-
</ParamField>
|
|
52
|
-
|
|
53
|
-
<ParamField path="input.clickDelay" type="number">
|
|
54
|
-
Delay after clicking the button (in seconds)
|
|
55
|
-
</ParamField>
|
|
56
|
-
|
|
57
|
-
</Expandable>
|
|
58
|
-
|
|
59
|
-
</ParamField>
|
|
60
|
-
|
|
61
|
-
## Returns: `Promise<void>`
|
|
62
|
-
|
|
63
|
-
Promise that resolves when the click and wait is complete
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: clickUntilExhausted
|
|
3
|
-
description: ""
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
```typescript
|
|
7
|
-
export declare function clickUntilExhausted(input: {
|
|
8
|
-
page: Page;
|
|
9
|
-
buttonLocator: Locator;
|
|
10
|
-
heartbeat?: CallableFunction;
|
|
11
|
-
containerLocator?: Locator;
|
|
12
|
-
maxClicks?: number;
|
|
13
|
-
clickDelay?: number;
|
|
14
|
-
noChangeThreshold?: number;
|
|
15
|
-
}): Promise<void>;
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Repeatedly click a button until no new content appears or max clicks reached.
|
|
19
|
-
|
|
20
|
-
This function is useful for "Load More" buttons or paginated content where you need to
|
|
21
|
-
keep clicking until all content is loaded. It provides several stopping conditions:
|
|
22
|
-
- Button becomes invisible
|
|
23
|
-
- Button becomes disabled
|
|
24
|
-
- Maximum number of clicks reached
|
|
25
|
-
- No change detected in container content (when containerLocator is provided)
|
|
26
|
-
|
|
27
|
-
## Examples
|
|
28
|
-
|
|
29
|
-
<CodeGroup>
|
|
30
|
-
|
|
31
|
-
```typescript Load All Items
|
|
32
|
-
import { clickUntilExhausted } from "@intuned/browser";
|
|
33
|
-
export default async function handler(params, page, context){
|
|
34
|
-
await page.goto("https://example.com/products");
|
|
35
|
-
const loadMoreButton = page.locator("button:has-text('Load More')");
|
|
36
|
-
|
|
37
|
-
// Click until button disappears or is disabled
|
|
38
|
-
await clickUntilExhausted({
|
|
39
|
-
page,
|
|
40
|
-
buttonLocator: loadMoreButton,
|
|
41
|
-
maxClicks: 20
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
```typescript Track Container Changes
|
|
47
|
-
import { clickUntilExhausted } from "@intuned/browser";
|
|
48
|
-
export default async function handler(params, page, context){
|
|
49
|
-
await page.goto("https://example.com/products");
|
|
50
|
-
const loadMoreButton = page.locator("#load-more");
|
|
51
|
-
const productsContainer = page.locator("#products-list");
|
|
52
|
-
|
|
53
|
-
let clickCount = 0;
|
|
54
|
-
await clickUntilExhausted({
|
|
55
|
-
page,
|
|
56
|
-
buttonLocator: loadMoreButton,
|
|
57
|
-
containerLocator: productsContainer,
|
|
58
|
-
heartbeat: () => {
|
|
59
|
-
clickCount++;
|
|
60
|
-
console.log(`Clicked ${clickCount} times`);
|
|
61
|
-
},
|
|
62
|
-
maxClicks: 30,
|
|
63
|
-
clickDelay: 0.5,
|
|
64
|
-
noChangeThreshold: 0
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
</CodeGroup>
|
|
70
|
-
|
|
71
|
-
## Arguments
|
|
72
|
-
|
|
73
|
-
<ParamField path="input" type="Object" required
|
|
74
|
-
>
|
|
75
|
-
Configuration options
|
|
76
|
-
|
|
77
|
-
<Expandable title="input">
|
|
78
|
-
<ParamField path="input.page" type="Page">
|
|
79
|
-
Playwright Page object
|
|
80
|
-
</ParamField>
|
|
81
|
-
|
|
82
|
-
<ParamField path="input.buttonLocator" type="Locator">
|
|
83
|
-
Locator for the button to click repeatedly
|
|
84
|
-
</ParamField>
|
|
85
|
-
|
|
86
|
-
<ParamField path="input.heartbeat" type="CallableFunction">
|
|
87
|
-
Optional callback invoked after each click
|
|
88
|
-
</ParamField>
|
|
89
|
-
|
|
90
|
-
<ParamField path="input.containerLocator" type="Locator">
|
|
91
|
-
Optional content container to detect changes
|
|
92
|
-
</ParamField>
|
|
93
|
-
|
|
94
|
-
<ParamField path="input.maxClicks" type="number">
|
|
95
|
-
Maximum number of times to click the button
|
|
96
|
-
</ParamField>
|
|
97
|
-
|
|
98
|
-
<ParamField path="input.clickDelay" type="number">
|
|
99
|
-
Delay after each click (in seconds)
|
|
100
|
-
</ParamField>
|
|
101
|
-
|
|
102
|
-
<ParamField path="input.noChangeThreshold" type="number">
|
|
103
|
-
Minimum change in content size to continue clicking
|
|
104
|
-
</ParamField>
|
|
105
|
-
|
|
106
|
-
</Expandable>
|
|
107
|
-
|
|
108
|
-
</ParamField>
|
|
109
|
-
|
|
110
|
-
## Returns: `Promise<void>`
|
|
111
|
-
|
|
112
|
-
Promise that resolves when clicking is exhausted
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: downloadFile
|
|
3
|
-
description: ""
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
```typescript
|
|
7
|
-
export declare function downloadFile(input: {
|
|
8
|
-
page: Page;
|
|
9
|
-
trigger: Trigger;
|
|
10
|
-
timeoutInMs?: number;
|
|
11
|
-
}): Promise<Download>;
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
<Note>
|
|
15
|
-
**Trigger Behavior:**
|
|
16
|
-
- **URL**: Creates a new page, navigates to the URL, waits for download, then closes the page
|
|
17
|
-
- **Locator**: Uses the current page to click the element and capture the resulting download
|
|
18
|
-
- **Callback**: Executes the provided function with the page object and captures the first triggered downloads
|
|
19
|
-
</Note>
|
|
20
|
-
|
|
21
|
-
Downloads a file from a web page using various trigger methods.
|
|
22
|
-
|
|
23
|
-
This function provides three flexible ways to initiate file downloads:
|
|
24
|
-
1. **URL Navigation**: Directly navigate to a URL that triggers a download
|
|
25
|
-
2. **Element Interaction**: Click on a Playwright locator (e.g., download button or link)
|
|
26
|
-
3. **Custom Callback**: Execute a custom function to trigger the download programmatically
|
|
27
|
-
|
|
28
|
-
## Examples
|
|
29
|
-
|
|
30
|
-
<CodeGroup>
|
|
31
|
-
|
|
32
|
-
```typescript URL trigger
|
|
33
|
-
import { downloadFile } from "@intuned/browser";
|
|
34
|
-
export default async function handler(params, page, context){
|
|
35
|
-
// Download by navigating directly to a URL
|
|
36
|
-
const download = await downloadFile({
|
|
37
|
-
page,
|
|
38
|
-
trigger: "https://intuned-docs-public-images.s3.amazonaws.com/32UP83A_ENG_US.pdf"
|
|
39
|
-
});
|
|
40
|
-
console.log(`Downloaded to: ${await download.path()}`);
|
|
41
|
-
}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
```typescript Locator trigger
|
|
45
|
-
import { downloadFile } from "@intuned/browser";
|
|
46
|
-
export default async function handler(params, page, context){
|
|
47
|
-
// Download by clicking a link or button
|
|
48
|
-
await page.goto("https://sandbox.intuned.dev/pdfs")
|
|
49
|
-
const download = await downloadFile({
|
|
50
|
-
page,
|
|
51
|
-
trigger: page.locator("xpath=//tbody/tr[1]//*[name()='svg']")
|
|
52
|
-
});
|
|
53
|
-
console.log(`File saved at: ${await download.path()}`);
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
```typescript Callback trigger
|
|
58
|
-
import { downloadFile } from "@intuned/browser";
|
|
59
|
-
export default async function handler(params, page, context){
|
|
60
|
-
// Download using a custom interaction sequence
|
|
61
|
-
await page.goto("https://sandbox.intuned.dev/pdfs")
|
|
62
|
-
const download = await downloadFile({
|
|
63
|
-
page,
|
|
64
|
-
trigger: async (page) => {
|
|
65
|
-
await page.locator("xpath=//tbody/tr[1]//*[name()='svg']").click();
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
console.log(`Download completed: ${await download.path()}`);
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
</CodeGroup>
|
|
73
|
-
|
|
74
|
-
## Arguments
|
|
75
|
-
|
|
76
|
-
<ParamField path="input" type="Object" required
|
|
77
|
-
>
|
|
78
|
-
Configuration object for the download operation
|
|
79
|
-
|
|
80
|
-
<Expandable title="input">
|
|
81
|
-
<ParamField path="input.page" type="Page">
|
|
82
|
-
The Playwright Page object to use for the download
|
|
83
|
-
</ParamField>
|
|
84
|
-
|
|
85
|
-
<ParamField path="input.trigger" type="Trigger">
|
|
86
|
-
The [Trigger](../type-aliases/Trigger) method to initiate the download
|
|
87
|
-
</ParamField>
|
|
88
|
-
|
|
89
|
-
<ParamField path="input.timeoutInMs" type="number">
|
|
90
|
-
Maximum time in milliseconds to wait for download completion. Defaults to 5000.
|
|
91
|
-
</ParamField>
|
|
92
|
-
|
|
93
|
-
</Expandable>
|
|
94
|
-
|
|
95
|
-
</ParamField>
|
|
96
|
-
|
|
97
|
-
## Returns: `Promise<Download>`
|
|
98
|
-
|
|
99
|
-
Promise that resolves to a Playwright Download object
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: extractMarkdown
|
|
3
|
-
description: ""
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
```typescript
|
|
7
|
-
export declare function extractMarkdown(input: {
|
|
8
|
-
source: Page | Locator;
|
|
9
|
-
}): Promise<string>;
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
Converts HTML content from a Playwright Page or Locator to semantic markdown format.
|
|
13
|
-
|
|
14
|
-
## Examples
|
|
15
|
-
|
|
16
|
-
<CodeGroup>
|
|
17
|
-
|
|
18
|
-
```typescript locator source
|
|
19
|
-
import { extractMarkdown } from "@intuned/browser";
|
|
20
|
-
export default async function handler(params, page, context){
|
|
21
|
-
await page.goto("https://example.com");
|
|
22
|
-
const headerLocator = page.locator('h1')
|
|
23
|
-
const markdown = await extractMarkdown({ source: headerLocator })
|
|
24
|
-
console.log(markdown); // Outputs the markdown representation of the header
|
|
25
|
-
}
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
```typescript string source
|
|
29
|
-
import { extractMarkdown } from "@intuned/browser";
|
|
30
|
-
export default async function handler(params, page, context){
|
|
31
|
-
await page.goto("https://example.com");
|
|
32
|
-
const markdown = await extractMarkdown({ source: page });
|
|
33
|
-
console.log(markdown); // Outputs the markdown representation of the page
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
</CodeGroup>
|
|
38
|
-
|
|
39
|
-
## Arguments
|
|
40
|
-
|
|
41
|
-
<ParamField path="input" type="Object" required
|
|
42
|
-
>
|
|
43
|
-
The input object containing the source of the HTML content
|
|
44
|
-
|
|
45
|
-
<Expandable title="input">
|
|
46
|
-
<ParamField path="input.source" type="Page | Locator">
|
|
47
|
-
The source of the HTML content. Can be a Playwright Page or a Playwright Locator. If a Playwright Page is provided, the HTML content will be extracted from the entire page. If a Playwright Locator is provided, the HTML content will be extracted from the specific element
|
|
48
|
-
</ParamField>
|
|
49
|
-
|
|
50
|
-
</Expandable>
|
|
51
|
-
|
|
52
|
-
</ParamField>
|
|
53
|
-
|
|
54
|
-
## Returns: `Promise<string>`
|
|
55
|
-
|
|
56
|
-
Promise that resolves to the markdown representation of the HTML content
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: filterEmptyValues
|
|
3
|
-
description: ""
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
```typescript
|
|
7
|
-
export declare function filterEmptyValues<T>(input: { data: T }): T;
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
Recursively filters out empty values from nested objects and arrays.
|
|
11
|
-
|
|
12
|
-
This function removes the following empty values:
|
|
13
|
-
- `null` and `undefined` values
|
|
14
|
-
- Empty strings (after trimming whitespace)
|
|
15
|
-
- Empty arrays
|
|
16
|
-
- Empty objects
|
|
17
|
-
- Arrays and objects that become empty after filtering their contents
|
|
18
|
-
|
|
19
|
-
## Examples
|
|
20
|
-
|
|
21
|
-
<CodeGroup>
|
|
22
|
-
|
|
23
|
-
```typescript Basic Usage
|
|
24
|
-
import { filterEmptyValues } from "@intuned/browser";
|
|
25
|
-
export default async function handler(params, page, context){
|
|
26
|
-
filterEmptyValues({ data: { a: "", b: "hello", c: null } }) // Returns { b: "hello" }
|
|
27
|
-
filterEmptyValues({ data: [1, "", null, [2, ""]] }) // Returns [1, [2]]
|
|
28
|
-
filterEmptyValues({ data: { users: [{ name: "" }, { name: "John" }] } }) // Returns { users: [{ name: "John" }] }
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
</CodeGroup>
|
|
33
|
-
|
|
34
|
-
## Arguments
|
|
35
|
-
|
|
36
|
-
<ParamField path="input" type="Object" required
|
|
37
|
-
>
|
|
38
|
-
The input object containing the data to filter
|
|
39
|
-
|
|
40
|
-
<Expandable title="input">
|
|
41
|
-
<ParamField path="input.data" type="T">
|
|
42
|
-
The data structure to filter (object, array, or any other type)
|
|
43
|
-
</ParamField>
|
|
44
|
-
|
|
45
|
-
</Expandable>
|
|
46
|
-
|
|
47
|
-
</ParamField>
|
|
48
|
-
|
|
49
|
-
## Returns: `T`
|
|
50
|
-
|
|
51
|
-
Filtered data structure with empty values removed
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: goToUrl
|
|
3
|
-
description: ""
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
```typescript
|
|
7
|
-
export declare function goToUrl(input: {
|
|
8
|
-
page: Page;
|
|
9
|
-
url: string;
|
|
10
|
-
timeoutInMs?: number;
|
|
11
|
-
retries?: number;
|
|
12
|
-
throwOnTimeout?: boolean;
|
|
13
|
-
waitForLoadState?: "load" | "domcontentloaded" | "networkidle";
|
|
14
|
-
waitForLoadingStateUsingAi?: boolean;
|
|
15
|
-
model?: SUPPORTED_MODELS;
|
|
16
|
-
apiKey?: string;
|
|
17
|
-
}): Promise<void>;
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Navigates to a specified URL with enhanced reliability features including automatic retries with exponential backoff,
|
|
21
|
-
intelligent timeout detection, and optional AI-powered loading verification.
|
|
22
|
-
|
|
23
|
-
This function handles common navigation challenges by automatically retrying failed requests, detecting navigation hangs, and ensuring the page reaches a truly idle state. For dynamic applications,
|
|
24
|
-
it can optionally verify page loading completion using AI vision to detect loading spinners, blank content, or incomplete states.
|
|
25
|
-
The function can be configured to either throw errors or gracefully continue execution when navigation issues occur.
|
|
26
|
-
|
|
27
|
-
## Examples
|
|
28
|
-
|
|
29
|
-
<CodeGroup>
|
|
30
|
-
|
|
31
|
-
```typescript Basic Navigation
|
|
32
|
-
import { goToUrl } from "@intuned/browser";
|
|
33
|
-
export default async function handler(params, page, context){
|
|
34
|
-
// Navigate with automatic retries on failure
|
|
35
|
-
await goToUrl({
|
|
36
|
-
page,
|
|
37
|
-
url: 'https://example.com'
|
|
38
|
-
});
|
|
39
|
-
// Automatically retries up to 3 times with exponential backoff
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
```typescript Navigation with options
|
|
44
|
-
import { goToUrl } from "@intuned/browser";
|
|
45
|
-
export default async function handler(params, page, context){
|
|
46
|
-
// Navigate to an unreliable site without throwing on timeout
|
|
47
|
-
await goToUrl({
|
|
48
|
-
page,
|
|
49
|
-
url: 'https://www.google.com',
|
|
50
|
-
throwOnTimeout: false, // Continue even if navigation fails
|
|
51
|
-
retries: 5, // Try more times for unreliable sites
|
|
52
|
-
timeoutInMs: 60000 // Give it more time
|
|
53
|
-
});
|
|
54
|
-
// If navigation fails after all retries, execution continues
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
```typescript AI-Verified Loading for Dynamic Sites
|
|
59
|
-
import { goToUrl } from "@intuned/browser";
|
|
60
|
-
export default async function handler(params, page, context){
|
|
61
|
-
await goToUrl({
|
|
62
|
-
page,
|
|
63
|
-
url: 'https://sandbox.intuned.dev/',
|
|
64
|
-
waitForLoadState: "load",
|
|
65
|
-
waitForLoadingStateUsingAi: true, // AI checks for spinners/loading states
|
|
66
|
-
model: "gpt-4o",
|
|
67
|
-
retries: 3
|
|
68
|
-
});
|
|
69
|
-
// AI verifies no loading spinners or blank content before proceeding
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
</CodeGroup>
|
|
74
|
-
|
|
75
|
-
## Arguments
|
|
76
|
-
|
|
77
|
-
<ParamField path="input" type="Object" required
|
|
78
|
-
>
|
|
79
|
-
The input object containing the page and url
|
|
80
|
-
|
|
81
|
-
<Expandable title="input">
|
|
82
|
-
<ParamField path="input.page" type="Page">
|
|
83
|
-
The Playwright page object to navigate
|
|
84
|
-
</ParamField>
|
|
85
|
-
|
|
86
|
-
<ParamField path="input.url" type="string">
|
|
87
|
-
The URL to navigate to
|
|
88
|
-
</ParamField>
|
|
89
|
-
|
|
90
|
-
<ParamField path="input.retries" type="number">
|
|
91
|
-
Number of retry attempts with exponential backoff (factor: 2, minTimeout: 1000ms). Defaults to 3
|
|
92
|
-
</ParamField>
|
|
93
|
-
|
|
94
|
-
<ParamField path="input.timeoutInMs" type="number">
|
|
95
|
-
Maximum time in milliseconds to wait for navigation. Defaults to 30000
|
|
96
|
-
</ParamField>
|
|
97
|
-
|
|
98
|
-
<ParamField path="input.waitForLoadState" type="string">
|
|
99
|
-
When to consider navigation succeeded. Options: "load", "domcontentloaded", "networkidle", "commit". Defaults to "load"
|
|
100
|
-
</ParamField>
|
|
101
|
-
|
|
102
|
-
<ParamField path="input.throwOnTimeout" type="boolean">
|
|
103
|
-
Whether to throw an error if navigation times out. When false, the function returns without throwing, allowing continued execution. Defaults to true.
|
|
104
|
-
</ParamField>
|
|
105
|
-
|
|
106
|
-
<ParamField path="input.waitForLoadingStateUsingAi" type="boolean">
|
|
107
|
-
When true, uses AI vision to verify the page is fully loaded by checking for loading spinners, blank content, or incomplete states. Retries up to 4 times with 5-second delays. Defaults to false
|
|
108
|
-
</ParamField>
|
|
109
|
-
|
|
110
|
-
<ParamField path="input.model" type="SUPPORTED_MODELS">
|
|
111
|
-
AI model to use for loading verification. See [SUPPORTED_MODELS](../type-aliases/SUPPORTED_MODELS) for all supported models. Defaults to "gpt-4o-2024-08-06"
|
|
112
|
-
</ParamField>
|
|
113
|
-
|
|
114
|
-
<ParamField path="input.apiKey" type="string">
|
|
115
|
-
Optional API key for the AI service (if provided, will not be billed to your account)
|
|
116
|
-
</ParamField>
|
|
117
|
-
|
|
118
|
-
</Expandable>
|
|
119
|
-
|
|
120
|
-
</ParamField>
|
|
121
|
-
|
|
122
|
-
## Returns: `Promise<void>`
|
|
123
|
-
|
|
124
|
-
Promise that resolves when navigation completes successfully. If the operation fails and `throwOnTimeout` is false, resolves without error
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: processDate
|
|
3
|
-
description: ""
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
```typescript
|
|
7
|
-
export declare function processDate(input: { date: string }): Date | null;
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
Parses various date string formats into Date objects.
|
|
11
|
-
Returns only the date part (year, month, day) with time set to 00:00:00.
|
|
12
|
-
|
|
13
|
-
Supports a wide variety of date formats including:
|
|
14
|
-
- DD/MM/YYYY with optional time (e.g., "22/11/2024 21:19:05", "13/12/2024")
|
|
15
|
-
- MM/DD/YYYY with optional time and timezone (e.g., "01/17/2025 3:00:00 PM CT", "10/25/2024")
|
|
16
|
-
- MM/DD/YYYY with time and timezone abbreviations (e.g., "10/23/2024 12:06 PM CST")
|
|
17
|
-
- MM/DD/YYYY with AM/PM time format (e.g., "11/28/2024 1:59:59 AM", "12/09/2024 9:00 AM")
|
|
18
|
-
- MM/DD/YYYY with dash separator and time (e.g., "12/19/2024 - 2:00 PM")
|
|
19
|
-
- M/DD/YYYY and MM/D/YYYY formats (e.g., "8/16/2019", "9/28/2024")
|
|
20
|
-
- DD MMM YYYY with optional time and timezone (e.g., "5 Dec 2024 8:00 AM PST", "11 Sep 2024")
|
|
21
|
-
- Full month name formats (e.g., "November 14, 2024", "January 31, 2025, 5:00 pm")
|
|
22
|
-
- 24-hour time format (e.g., "22/11/2024 19:45:00", "09/01/2025 15:00:00")
|
|
23
|
-
|
|
24
|
-
## Examples
|
|
25
|
-
|
|
26
|
-
<CodeGroup>
|
|
27
|
-
|
|
28
|
-
```typescript Basic Date Processing
|
|
29
|
-
import { processDate } from "@intuned/browser";
|
|
30
|
-
export default async function handler(params, page, context){
|
|
31
|
-
processDate("22/11/2024 21:19:05") // Returns Date with 2024-11-22 00:00:00
|
|
32
|
-
processDate("5 Dec 2024 8:00 AM PST") // Returns Date with 2024-12-05 00:00:00
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
</CodeGroup>
|
|
37
|
-
|
|
38
|
-
## Arguments
|
|
39
|
-
|
|
40
|
-
<ParamField path="input" type="Object" required
|
|
41
|
-
>
|
|
42
|
-
The input object containing the date to process
|
|
43
|
-
|
|
44
|
-
<Expandable title="input">
|
|
45
|
-
<ParamField path="input.date" type="string">
|
|
46
|
-
A string containing a date in various possible formats
|
|
47
|
-
</ParamField>
|
|
48
|
-
|
|
49
|
-
</Expandable>
|
|
50
|
-
|
|
51
|
-
</ParamField>
|
|
52
|
-
|
|
53
|
-
## Returns: `Date | any`
|
|
54
|
-
|
|
55
|
-
Date object with only date components (time set to 00:00:00) if parsing successful, null if parsing fails
|