Socket
Socket
Sign inDemoInstall

@intuned/sdk-dev-types

Package Overview
Dependencies
Maintainers
0
Versions
212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@intuned/sdk-dev-types - npm Package Compare versions

Comparing version 1.0.2-1.run-attempts.0 to 1.0.2-beta.1

166

files/index.d.ts

@@ -251,9 +251,109 @@ import type { Page, Locator } from "@intuned/playwright-core";

/**
* Downloads a file using the specified strategy.
* Downloads a file from a URL.
*
* @param {Page} page - The Playwright Page object.
* @param {PersistFileStrategy} strategy - The strategy to use for downloading the file.
* @param {DownloadFileAutoStrategy} strategy - The strategy to use for downloading the file. URL auto strategy.
* @param {string} strategy.url - The URL of the file to download.
* @returns {Promise<Download>} A promise that resolves to a Download object.
*
* @example
* ```typescript
* import { downloadFile } from "@intuned/sdk/files";
*
* const download = await downloadFile(page, { url: "https://example.com/file.pdf" });
* console.log(await download.path());
* ```
*/
export declare function downloadFile(
page: Page,
strategy: { url: string; type?: "Auto" }
): Promise<Download>;
/**
* Downloads a file by clicking the specified locator.
*
* @param {Page} page - The Playwright Page object.
* @param {DownloadFileAutoStrategy} strategy - The strategy to use for downloading the file. Locator auto strategy.
* @param {Locator} strategy.locator - The locator of the element to click to download the file.
* @param {number} [options.clickTimeout] - Optional. The maximum time in milliseconds to wait for the element to be clickable. Defaults to Playwright's default timeout.
* @returns {Promise<Download>} A promise that resolves to a Download object.
*
* @example
* ```typescript
* import { downloadFile } from "@intuned/sdk/files";
*
* const download = await downloadFile(page, { locator: page.locator(".download_button") });
* console.log(await download.path());
* ```
*/
export declare function downloadFile(
page: Page,
strategy: { locator: Locator; type?: "Auto" }
): Promise<Download>;
/**
* Downloads a file using the specified trigger function.
*
* @param {Page} page - The Playwright Page object.
* @param {DownloadFileAutoStrategy} strategy - The strategy to use for downloading the file. Trigger auto strategy.
* @param {(page: Page) => Promise<void>} strategy.trigger - The function to trigger the download.
* @returns {Promise<Download>} A promise that resolves to a Download object.
*
* @example
* ```typescript
* import { downloadFile } from "@intuned/sdk/files";
*
* const download = await downloadFile(page, {
* trigger: async (page) => {
* await page.locator(".download_button").click();
* }
* });
*
* console.log(await download.path());
* ```
*/
export declare function downloadFile(
page: Page,
strategy: { trigger: (page: Page) => Promise<void>; type?: "Auto" }
): Promise<Download>;
/**
*
* Downloads the current page as a PDF file.
*
* @param {Page} page - The Playwright Page object.
* @param {DownloadPageAsPdfStrategy} strategy - PrintPageAsPdf strategy to download the page as pdf.
*
* @example
* ```typescript PrintPageAsPdf
* import { downloadFile } from "@intuned/sdk/files";
*
* await page.goto("https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html")
*
* // use PrintPageAsPdf strategy when you download a pdf version of the open webpage.
* const downloadedFile = await downloadFile(page, {
* type: "PrintPageAsPdf",
* })
*
* console.log(await downloadedFile.path());
* ```
*/
export declare function downloadFile(
page: Page,
strategy: {
type: "PrintPageAsPdf";
options?: Parameters<Page["pdf"]>[0];
}
): Promise<Download>;
/**
* @deprecated Use `downloadFile` function with `DownloadFileAutoStrategy` instead.
*
* Downloads a file using the specified manual strategy.
*
* @param {Page} page - The Playwright Page object.
* @param {DownloadFileManualStrategy} strategy - The manual strategy to use for downloading the file.
* @returns {Promise<Download>} A promise that resolves to a Download object.
*
* @example
* ```typescript DirectLink

@@ -309,20 +409,6 @@ * import { downloadFile } from "@intuned/sdk/files";

*```
*
* @example
* ```typescript PrintPageAsPdf
* import { downloadFile } from "@intuned/sdk/files";
*
* await page.goto("https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html")
*
* // use PrintPageAsPdf strategy when you download a pdf version of the open webpage.
* const downloadedFile = await downloadFile(page, {
* type: "PrintPageAsPdf",
* })
*
* console.log(await downloadedFile.path());
* ```
*/
export declare function downloadFile(
page: Page,
strategy: PersistFileStrategy
strategy: DownloadFileManualStrategy
): Promise<Download>;

@@ -346,2 +432,33 @@

/**
* The strategy to use for downloading a file.
* Auto strategy automatically downloads the file depending on its input.
* Manual strategy requires providing the specific strategy to use for downloading the file.
*/
export type DownloadFileStrategy =
| DownloadFileAutoStrategy
| DownloadFileManualStrategy
| DownloadPageAsPdfStrategy;
/**
* In auto strategy, the file is downloaded automatically depending on the input.
* ## Inputs:
* - `url`: The URL of the file to download.
* - `locator`: The locator of the element to click to download the file.
* - `trigger`: The function to trigger the browser download.
*/
export type DownloadFileAutoStrategy =
| {
type?: "Auto";
url: string;
}
| {
type?: "Auto";
locator: Locator;
}
| {
type?: "Auto";
trigger: (page: Page) => Promise<void>;
};
/**
* ## Strategies:

@@ -353,5 +470,4 @@ *

* - `DirectLink`: use this strategy when you have the file url.
* - `PrintPageAsPdf`: use this action when you download a pdf version of the open webpage.
*/
export type PersistFileStrategy =
export type DownloadFileManualStrategy =
| {

@@ -387,9 +503,13 @@ // DownloadViaNewTab

link: string;
}
| {
type: "PrintPageAsPdf";
options?: Parameters<Page["pdf"]>[0];
};
/**
* use this action when you download a pdf version of the open webpage.
*/
export type DownloadPageAsPdfStrategy = {
type: "PrintPageAsPdf";
options?: Parameters<Page["pdf"]>[0];
};
/**
* Configuration to connect to S3 bucket

@@ -396,0 +516,0 @@ * @interface

2

package.json
{
"name": "@intuned/sdk-dev-types",
"version": "1.0.21.run-attempts.0",
"version": "1.0.2-beta.1",
"description": "intuned runner types",

@@ -5,0 +5,0 @@ "author": "Intuned Team",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc