@intuned/runner-types
Advanced tools
Comparing version 0.8.1 to 0.9.0
275
index.d.ts
declare module '@intuned/runner' { | ||
// Generated by dts-bundle-generator v8.0.1 | ||
import { PutObjectCommandInput, S3Client } from '@aws-sdk/client-s3'; | ||
import { getSignedUrl } from '@aws-sdk/s3-request-presigner'; | ||
import { BrowserContext, Download, Locator, Page } from '@intuned/playwright-core'; | ||
export type ObjectExtractor = Record<string, AbsoluteValueSelector | null>; | ||
export interface AbsoluteValueSelector { | ||
value: string; | ||
type: "xpath" | "css"; | ||
property: "direct-text" | "all-text" | { | ||
attribute: string; | ||
}; | ||
backupSelectors?: AbsoluteValueSelector[]; | ||
regex?: string; | ||
regexMatchIndex?: number; | ||
extractionType?: "string" | "string-list"; | ||
} | ||
export interface AbsoluteElementSelector { | ||
value: string; | ||
type: "xpath" | "css"; | ||
backupSelectors?: AbsoluteElementSelector[]; | ||
} | ||
export type RelativeValueSelector = { | ||
value: string; | ||
type: "relative-css" | "relative-xpath"; | ||
property: "direct-text" | "all-text" | { | ||
attribute: string; | ||
}; | ||
regex?: string; | ||
regexMatchIndex?: number; | ||
backupSelectors?: RelativeValueSelector[]; | ||
extractionType?: "sting" | "string-list"; | ||
}; | ||
export interface BasicListInfo { | ||
containerSelector: AbsoluteElementSelector; | ||
nodeSplit: { | ||
itemTagsToBeFlitteredOut: string[]; | ||
numberOfElementsPerItem: number; | ||
}; | ||
} | ||
export interface ListStaticExtractor { | ||
containerSelector: AbsoluteElementSelector; | ||
nodeSplit?: BasicListInfo["nodeSplit"] & { | ||
numberOfElementsPerItem?: number; | ||
}; | ||
propertySelectors: Record<string, RelativeValueSelector & { | ||
indexOfNodeInsideListItem?: number; | ||
}>; | ||
} | ||
export type JSONSchemaType = "object" | "array" | "string" | "number" | "integer" | "boolean"; | ||
export interface JSONSchema { | ||
type: JSONSchemaType | JSONSchemaType[]; | ||
properties?: { | ||
[key: string]: JSONSchema; | ||
}; | ||
items?: JSONSchema | JSONSchema[]; | ||
required?: string[]; | ||
enum?: any[]; | ||
description?: string; | ||
} | ||
export type ObjectJSONSchema = { | ||
properties: Record<string, { | ||
description: string; | ||
primary?: boolean; | ||
}>; | ||
}; | ||
export interface ExecutionInfo { | ||
runId: string; | ||
jobStartTime?: string; | ||
} | ||
export interface ExecutionHelpers { | ||
getExecutionInfo: () => ExecutionInfo; | ||
extendJobPayload: (payloadItem: PayloadItem) => void; | ||
} | ||
export interface PayloadItem { | ||
apiName: string; | ||
parameters: Record<string, any>; | ||
} | ||
export type ExtractObjectUsingStaticSelectorsReturnType<T extends ObjectExtractor> = { | ||
[K in keyof T]: T[K] extends { | ||
extractionType?: "string-list"; | ||
} ? string[] | null : string | null; | ||
}; | ||
export type ExtractListObjectsUsingStaticSelectorsReturnType<T extends ListStaticExtractor> = { | ||
[K in keyof T["propertySelectors"]]: T["propertySelectors"][K] extends { | ||
extractionType?: "string-list"; | ||
} ? string[] | null : string | null; | ||
}[]; | ||
export type ExtractObjectDynamicExtractorReturnType<T extends ObjectJSONSchema> = Record<keyof T["properties"], string | null>; | ||
export type ExtractListDynamicExtractorReturnType<T extends ObjectJSONSchema> = Record<keyof T["properties"], string | null>[]; | ||
export interface InputFieldsInfo { | ||
fieldType: "select" | "text-input" | "checkbox" | "radiogroup" | "submit-button"; | ||
ariaLabel: string | null; | ||
fieldLabelText: string | null; | ||
id: string | null; | ||
name: string | null; | ||
options?: { | ||
value: string | null; | ||
label: string | null; | ||
name?: string; | ||
id?: string; | ||
disabled?: boolean | null; | ||
visible?: boolean | null; | ||
}[]; | ||
visible?: boolean | null; | ||
disabled?: boolean | null; | ||
selector: AbsoluteElementSelector; | ||
} | ||
export type FieldSelector = { | ||
selector: string; | ||
type: "css" | "xpath"; | ||
}; | ||
export type InputFieldType = "text-input" | "select" | "checkbox" | "radiogroup" | "submit-button" | "auto-complete"; | ||
export type StaticFormDataItem = { | ||
fieldSelector: FieldSelector; | ||
fieldType: InputFieldType; | ||
value: { | ||
type: "static"; | ||
value: string | boolean | number; | ||
}; | ||
}; | ||
export type DynamicFormDataItem = { | ||
fieldSelector: FieldSelector; | ||
fieldType: InputFieldType; | ||
value: { | ||
type: "dynamic"; | ||
source: string | object; | ||
}; | ||
}; | ||
export type FormDataItem = DynamicFormDataItem | StaticFormDataItem; | ||
export interface FillFormConfigs { | ||
didFormSucceed: (formLocator: Locator, page: EnhancedPlaywrightPage) => Promise<boolean>; | ||
submitForm: (formLocator: Locator, page: EnhancedPlaywrightPage) => Promise<void>; | ||
autoRecovery?: { | ||
enabled: boolean; | ||
input: object; | ||
maskFields?: FieldSelector[]; | ||
maxRetries?: number; | ||
}; | ||
generateDataToUnblockForm?: { | ||
prompt: string; | ||
enabled: boolean; | ||
maxRetries?: number; | ||
maskFields?: FieldSelector[]; | ||
}; | ||
} | ||
export interface FillFormOptions { | ||
timeout?: number; | ||
fillFieldTimeout?: number; | ||
waitTimeBetweenFill?: number; | ||
} | ||
export type ClassificationCategories = { | ||
categoryName: string; | ||
categoryDescription: string; | ||
}[]; | ||
export type IntunedPageGoToOptions = Parameters<Page["goto"]>[1] & { | ||
/** | ||
* Whether to throw if the page.goto times out. Defaults to `false`. | ||
*/ | ||
throwOnTimeout?: boolean; | ||
}; | ||
class IntunedExtendedPage { | ||
private page; | ||
private constructor(); | ||
private getLocatorFromRegionElementSelector; | ||
private ـgetVisiblePageHtml; | ||
goto(url: string, options?: IntunedPageGoToOptions): ReturnType<Page["goto"]>; | ||
fillForm(formLocator: AbsoluteElementSelector | Locator, formFields: FormDataItem[], configs: FillFormConfigs, options?: FillFormOptions): Promise<boolean>; | ||
getFormFields(formLocator: Locator): Promise<InputFieldsInfo[]>; | ||
getAbsoluteElementReliableSelectors(element: Locator): Promise<string[]>; | ||
getRelativeElementReliableSelectors(anchorElement: Locator, relativeSelector: string): Promise<string[]>; | ||
extractDataUsingAiFromPage<T = any>(entityName: string, jsonSchema: JSONSchema, searchRegion?: AbsoluteElementSelector | Locator): Promise<T>; | ||
classifyUsingAi(categories: ClassificationCategories): Promise<{ | ||
status: "failed" | "success"; | ||
result: any; | ||
}>; | ||
extractDataUsingAiFromImage<T = any>(entityName: string, jsonSchema: JSONSchema, searchRegion?: Locator): Promise<T>; | ||
extractDataUsingAiFromText<T = any>(entityName: string, jsonSchema: JSONSchema, text: string): Promise<T>; | ||
extractObjectDynamicExtractor<T extends ObjectJSONSchema>(entityName: string, jsonSchema: T, searchRegion?: AbsoluteElementSelector | Locator, InvalidatePropertyIfEmpty?: boolean): Promise<ExtractObjectDynamicExtractorReturnType<T>>; | ||
private findXpathForLocator; | ||
extractListDynamicExtractor<T extends ObjectJSONSchema>(entityName: string, jsonSchema: T, searchRegion?: AbsoluteElementSelector | Locator, InvalidatePropertyIfEmpty?: boolean): Promise<ExtractListDynamicExtractorReturnType<T>>; | ||
extractObjectUsingStaticSelectors<T extends ObjectExtractor>(extractor: T): Promise<ExtractObjectUsingStaticSelectorsReturnType<T>>; | ||
extractListObjectsUsingStaticSelectors<T extends ListStaticExtractor>(listExtractor: T): Promise<ExtractListObjectsUsingStaticSelectorsReturnType<T>>; | ||
static create(page: Page): EnhancedPlaywrightPage; | ||
} | ||
export type EnhancedPlaywrightPage = IntunedExtendedPage & Page; | ||
class IntunedExtendedBrowserContext { | ||
private context; | ||
constructor(context: BrowserContext); | ||
newPage(): Promise<EnhancedPlaywrightPage>; | ||
static create(context: BrowserContext): Promise<EnhancedPlaywrightBrowserContext>; | ||
} | ||
export type EnhancedPlaywrightBrowserContext = IntunedExtendedBrowserContext & BrowserContext; | ||
const PRIVATE_KEY: unique symbol; | ||
export interface RequestMoreInfoReturnTypeBase { | ||
[PRIVATE_KEY]: true; | ||
action: "request_more_info"; | ||
} | ||
export interface RequestMultipleChoiceReturnType extends RequestMoreInfoReturnTypeBase { | ||
messageToUser: string; | ||
choices: string[]; | ||
requestType: "multiple_choice"; | ||
} | ||
export interface RequestOtpReturnType extends RequestMoreInfoReturnTypeBase { | ||
messageToUser: string; | ||
requestType: "otp"; | ||
} | ||
export function requestOTP(messageToUser: string): RequestOtpReturnType; | ||
export function requestMultipleChoice(messageToUser: string, choices: string[]): RequestMultipleChoiceReturnType; | ||
export interface IntunedErrorOptions { | ||
retry: false; | ||
} | ||
export class IntunedError extends Error { | ||
options: IntunedErrorOptions; | ||
constructor(message: string, options?: IntunedErrorOptions); | ||
} | ||
export type PersistFileConfigs = { | ||
type: "DownloadByOpeningNewTab"; | ||
trigger: ((page: EnhancedPlaywrightPage) => Promise<void>) | Locator; | ||
} | { | ||
type: "DownloadByDirectLink"; | ||
trigger: ((page: EnhancedPlaywrightPage) => Promise<void>) | Locator; | ||
} | { | ||
type: "ThirdPartyFileViewer"; | ||
link: string; | ||
downloadAction: (page: EnhancedPlaywrightPage) => Promise<void>; | ||
} | { | ||
type: "DirectLink"; | ||
link: string; | ||
}; | ||
class File { | ||
private folderName; | ||
private fileName; | ||
private s3Configs; | ||
private s3Client; | ||
constructor(folderName: string, fileName: string, s3Configs: S3Configs, s3Client: S3Client); | ||
urlDescriptor(): string; | ||
generateSignedUrl(options?: Parameters<typeof getSignedUrl>[2]): Promise<string>; | ||
} | ||
export interface S3Configs { | ||
bucket: string; | ||
region: string; | ||
accessKeyId: string; | ||
secretAccessKey: string; | ||
} | ||
export class S3FileUploadHelpers { | ||
private s3Client; | ||
private executionInfo; | ||
private context; | ||
private page; | ||
private configs; | ||
constructor(page: EnhancedPlaywrightPage, context: EnhancedPlaywrightBrowserContext, executionHelpers: ExecutionHelpers, config?: S3Configs); | ||
uploadFile(fileName: string, file: PutObjectCommandInput["Body"]): Promise<File>; | ||
uploadDownloadedFile(fileName: string, download: Download): Promise<File>; | ||
waitForPdfPreviewAndDownloadNewPage(): Promise<Download>; | ||
waitForPdfPreviewAndDownload(newPage: Page): Promise<Download>; | ||
persistFile(fileName: string, configs: PersistFileConfigs): Promise<File>; | ||
} | ||
export function extractFromPdf(pdfBuffer: Buffer, entityName: string, jsonSchema: JSONSchema, pages: [ | ||
number | ||
]): Promise<any>; | ||
export interface SearchPdfConfigs { | ||
contextWindow: number; | ||
} | ||
export type SearchPdfResult = { | ||
context: string; | ||
page: number; | ||
found: true; | ||
} | { | ||
found: false; | ||
}; | ||
export function searchPdf(dataBuffer: Buffer, search: string, options?: SearchPdfConfigs): Promise<SearchPdfResult>; | ||
export {}; | ||
} |
{ | ||
"name": "@intuned/runner-types", | ||
"version": "0.8.1", | ||
"version": "0.9.0", | ||
"description": "intuned runner types", | ||
@@ -5,0 +5,0 @@ "author": "Intuned Team", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10463
288