@intuned/browser-dev 2.2.3-unify-sdks.22 → 2.2.3-unify-sdks.23

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.
@@ -1,3 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _jsonSchema = require("./jsonSchema");
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1,5 +1,4 @@
1
1
  import { Locator, Page } from "playwright-core";
2
- import { ObjectSchema } from "./jsonSchema";
3
2
  import { JSONSchema7TypeName } from "json-schema";
4
3
 
5
4
  /**
@@ -417,13 +416,6 @@ type SUPPORTED_MODELS = SUPPORTED_CLAUDE_MODELS | SUPPORTED_OPENAI_MODELS;
417
416
  * };
418
417
  * ```
419
418
  */
420
- export type JSONSchema =
421
- | StringSchema
422
- | NumberSchema
423
- | BooleanSchema
424
- | ArraySchema
425
- | ObjectSchema
426
- | BaseSchema;
427
419
 
428
420
  /**
429
421
  * @interface HTMLStrategy
@@ -672,3 +664,11 @@ export declare function isPageLoaded(
672
664
  * LoadingStatus is a union of true, false, and "Dont know".
673
665
  */
674
666
  export type LoadingStatus = true | false | "Dont know";
667
+
668
+ export type JSONSchema =
669
+ | StringSchema
670
+ | NumberSchema
671
+ | BooleanSchema
672
+ | ArraySchema
673
+ | ObjectSchema
674
+ | BaseSchema;
@@ -1,5 +1,4 @@
1
1
  import { Locator, Page } from "playwright-core";
2
- import { ObjectSchema } from "./jsonSchema";
3
2
  import { JSONSchema7TypeName } from "json-schema";
4
3
 
5
4
  /**
@@ -417,13 +416,6 @@ type SUPPORTED_MODELS = SUPPORTED_CLAUDE_MODELS | SUPPORTED_OPENAI_MODELS;
417
416
  * };
418
417
  * ```
419
418
  */
420
- export type JSONSchema =
421
- | StringSchema
422
- | NumberSchema
423
- | BooleanSchema
424
- | ArraySchema
425
- | ObjectSchema
426
- | BaseSchema;
427
419
 
428
420
  /**
429
421
  * @interface HTMLStrategy
@@ -672,3 +664,11 @@ export declare function isPageLoaded(
672
664
  * LoadingStatus is a union of true, false, and "Dont know".
673
665
  */
674
666
  export type LoadingStatus = true | false | "Dont know";
667
+
668
+ export type JSONSchema =
669
+ | StringSchema
670
+ | NumberSchema
671
+ | BooleanSchema
672
+ | ArraySchema
673
+ | ObjectSchema
674
+ | BaseSchema;
@@ -36,11 +36,9 @@ var _validators = require("../validators");
36
36
  (0, _extendedTest.test)("should return false for array of mixed types", async () => {
37
37
  const schema = {
38
38
  type: "array",
39
- items: [{
40
- type: "string"
41
- }, {
39
+ items: {
42
40
  type: "number"
43
- }]
41
+ }
44
42
  };
45
43
  (0, _extendedTest.expect)((0, _validators.checkAllTypesAreStrings)(schema)).toBe(false);
46
44
  });
@@ -118,19 +118,21 @@ function checkAllTypesAreStrings(schema) {
118
118
  return true;
119
119
  }
120
120
  if (schema.type === "array") {
121
- if (!schema.items) {
121
+ const arraySchema = schema;
122
+ if (!arraySchema.items) {
122
123
  return true;
123
124
  }
124
- if (Array.isArray(schema.items)) {
125
- return schema.items.every(item => checkAllTypesAreStrings(item));
125
+ if (Array.isArray(arraySchema.items)) {
126
+ return arraySchema.items.every(item => checkAllTypesAreStrings(item));
126
127
  }
127
- return checkAllTypesAreStrings(schema.items);
128
+ return checkAllTypesAreStrings(arraySchema.items);
128
129
  }
129
130
  if (schema.type === "object") {
130
- if (!schema.properties) {
131
+ const objectSchema = schema;
132
+ if (!objectSchema.properties) {
131
133
  return true;
132
134
  }
133
- return Object.values(schema.properties).every(prop => checkAllTypesAreStrings(prop));
135
+ return Object.values(objectSchema.properties).every(prop => checkAllTypesAreStrings(prop));
134
136
  }
135
137
  return false;
136
138
  }
@@ -230,7 +230,6 @@ export declare function goToUrl(input: {
230
230
  page: Page;
231
231
  url: string;
232
232
  timeoutInMs?: number;
233
- waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
234
233
  retries?: number;
235
234
  throwOnTimeout?: boolean;
236
235
  waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
@@ -526,11 +525,17 @@ export declare function validateDataUsingSchema(input: {
526
525
  * Versatile function that waits for network requests to settle after executing an action.
527
526
  * Can be used as a simple decorator, parameterized decorator, or direct async call.
528
527
  *
529
- * @param {Function | Object} funcOrOptions - Either a function to wrap, configuration options for decorator, or full options with page and function
530
- * @param {number} [funcOrOptions.timeoutInMs=30000] - Maximum time to wait in milliseconds before timing out
531
- * @param {number} [funcOrOptions.maxInflightRequests=0] - Maximum number of pending requests to consider as "settled"
532
- * @param {Page} [funcOrOptions.page] - Playwright page object (required for direct async call)
533
- * @param {Function} [funcOrOptions.func] - Function to execute (required for direct async call)
528
+ * This function has three overloads:
529
+ * 1. Simple decorator: `waitForNetworkIdle(func)` - Wraps a function that takes Page as first argument
530
+ * 2. Parameterized decorator: `waitForNetworkIdle({timeoutInMs, maxInflightRequests})(func)` - Returns a decorator with custom options
531
+ * 3. Direct async call: `waitForNetworkIdle({page, func, timeoutInMs, maxInflightRequests})` - Executes function directly
532
+ *
533
+ * @param {Function} func - Function to wrap (for simple decorator usage)
534
+ * @param {Object} options - Configuration options (for parameterized decorator or direct call)
535
+ * @param {number} [options.timeoutInMs=30000] - Maximum time to wait in milliseconds before timing out
536
+ * @param {number} [options.maxInflightRequests=0] - Maximum number of pending requests to consider as "settled"
537
+ * @param {Page} [options.page] - Playwright page object (required for direct async call)
538
+ * @param {Function} [options.func] - Function to execute that returns a Promise (required for direct async call)
534
539
  * @returns {Function | Promise} Returns wrapped function for decorator usage, or Promise for direct async call
535
540
  *
536
541
  * @example
@@ -598,17 +603,19 @@ export declare function validateDataUsingSchema(input: {
598
603
  * // Function automatically waits for all network requests to complete
599
604
  * ```
600
605
  */
601
- export declare function waitForNetworkIdle(
602
- funcOrOptions?:
603
- | ((...args) => Promise<any>)
604
- | { timeoutInMs?: number; maxInflightRequests?: number }
605
- | {
606
- page: Page;
607
- func: (...args: T) => Promise<any>;
608
- timeoutInMs?: number;
609
- maxInflightRequests?: number;
610
- }
611
- ): any;
606
+ export declare function waitForNetworkIdle<T extends (...args: any[]) => any>(
607
+ func: T
608
+ ): T;
609
+ export declare function waitForNetworkIdle(options: {
610
+ timeoutInMs?: number;
611
+ maxInflightRequests?: number;
612
+ }): <T extends (...args: any[]) => any>(func: T) => T;
613
+ export declare function waitForNetworkIdle<T>(options: {
614
+ page: Page;
615
+ func: () => Promise<T>;
616
+ timeoutInMs?: number;
617
+ maxInflightRequests?: number;
618
+ }): Promise<T>;
612
619
 
613
620
  /**
614
621
  * Wait for the DOM to stop changing before proceeding. Useful for dynamic content
@@ -717,7 +724,7 @@ export declare function waitForNetworkIdle(
717
724
  * ```
718
725
  */
719
726
 
720
- export async function waitForDomSettled(options: {
727
+ export function waitForDomSettled(options: {
721
728
  page: Page;
722
729
  settleDuration?: number;
723
730
  timeoutInMs?: number;
@@ -1147,8 +1154,8 @@ export type S3UploadableFile = Download | Uint8Array | Buffer | ReadStream;
1147
1154
  export declare function downloadFromPageToS3(
1148
1155
  page: Page,
1149
1156
  trigger: Trigger,
1150
- timeoutInMs?: number,
1151
- uploadOptions: S3UploadOptions
1157
+ uploadOptions: S3UploadOptions,
1158
+ timeoutInMs?: number
1152
1159
  ): Promise<Attachment>;
1153
1160
  /**
1154
1161
  * Downloads a file from a web page and uploads it to S3 storage.
@@ -230,7 +230,6 @@ export declare function goToUrl(input: {
230
230
  page: Page;
231
231
  url: string;
232
232
  timeoutInMs?: number;
233
- waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
234
233
  retries?: number;
235
234
  throwOnTimeout?: boolean;
236
235
  waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
@@ -526,11 +525,17 @@ export declare function validateDataUsingSchema(input: {
526
525
  * Versatile function that waits for network requests to settle after executing an action.
527
526
  * Can be used as a simple decorator, parameterized decorator, or direct async call.
528
527
  *
529
- * @param {Function | Object} funcOrOptions - Either a function to wrap, configuration options for decorator, or full options with page and function
530
- * @param {number} [funcOrOptions.timeoutInMs=30000] - Maximum time to wait in milliseconds before timing out
531
- * @param {number} [funcOrOptions.maxInflightRequests=0] - Maximum number of pending requests to consider as "settled"
532
- * @param {Page} [funcOrOptions.page] - Playwright page object (required for direct async call)
533
- * @param {Function} [funcOrOptions.func] - Function to execute (required for direct async call)
528
+ * This function has three overloads:
529
+ * 1. Simple decorator: `waitForNetworkIdle(func)` - Wraps a function that takes Page as first argument
530
+ * 2. Parameterized decorator: `waitForNetworkIdle({timeoutInMs, maxInflightRequests})(func)` - Returns a decorator with custom options
531
+ * 3. Direct async call: `waitForNetworkIdle({page, func, timeoutInMs, maxInflightRequests})` - Executes function directly
532
+ *
533
+ * @param {Function} func - Function to wrap (for simple decorator usage)
534
+ * @param {Object} options - Configuration options (for parameterized decorator or direct call)
535
+ * @param {number} [options.timeoutInMs=30000] - Maximum time to wait in milliseconds before timing out
536
+ * @param {number} [options.maxInflightRequests=0] - Maximum number of pending requests to consider as "settled"
537
+ * @param {Page} [options.page] - Playwright page object (required for direct async call)
538
+ * @param {Function} [options.func] - Function to execute that returns a Promise (required for direct async call)
534
539
  * @returns {Function | Promise} Returns wrapped function for decorator usage, or Promise for direct async call
535
540
  *
536
541
  * @example
@@ -598,17 +603,19 @@ export declare function validateDataUsingSchema(input: {
598
603
  * // Function automatically waits for all network requests to complete
599
604
  * ```
600
605
  */
601
- export declare function waitForNetworkIdle(
602
- funcOrOptions?:
603
- | ((...args) => Promise<any>)
604
- | { timeoutInMs?: number; maxInflightRequests?: number }
605
- | {
606
- page: Page;
607
- func: (...args: T) => Promise<any>;
608
- timeoutInMs?: number;
609
- maxInflightRequests?: number;
610
- }
611
- ): any;
606
+ export declare function waitForNetworkIdle<T extends (...args: any[]) => any>(
607
+ func: T
608
+ ): T;
609
+ export declare function waitForNetworkIdle(options: {
610
+ timeoutInMs?: number;
611
+ maxInflightRequests?: number;
612
+ }): <T extends (...args: any[]) => any>(func: T) => T;
613
+ export declare function waitForNetworkIdle<T>(options: {
614
+ page: Page;
615
+ func: () => Promise<T>;
616
+ timeoutInMs?: number;
617
+ maxInflightRequests?: number;
618
+ }): Promise<T>;
612
619
 
613
620
  /**
614
621
  * Wait for the DOM to stop changing before proceeding. Useful for dynamic content
@@ -717,7 +724,7 @@ export declare function waitForNetworkIdle(
717
724
  * ```
718
725
  */
719
726
 
720
- export async function waitForDomSettled(options: {
727
+ export function waitForDomSettled(options: {
721
728
  page: Page;
722
729
  settleDuration?: number;
723
730
  timeoutInMs?: number;
@@ -1147,8 +1154,8 @@ export type S3UploadableFile = Download | Uint8Array | Buffer | ReadStream;
1147
1154
  export declare function downloadFromPageToS3(
1148
1155
  page: Page,
1149
1156
  trigger: Trigger,
1150
- timeoutInMs?: number,
1151
- uploadOptions: S3UploadOptions
1157
+ uploadOptions: S3UploadOptions,
1158
+ timeoutInMs?: number
1152
1159
  ): Promise<Attachment>;
1153
1160
  /**
1154
1161
  * Downloads a file from a web page and uploads it to S3 storage.
@@ -1,13 +1,4 @@
1
- import type { Locator, Page } from "playwright-core";
2
- import {
3
- extractMarkdownFromPage,
4
- extractStructuredDataFromPage,
5
- } from "../ai-extractors";
6
- import {
7
- extractArrayFromPage,
8
- extractObjectFromPage,
9
- } from "../optimized-extractors";
10
-
1
+ import type { Page } from "playwright-core";
11
2
  /**
12
3
  * --
13
4
  * @interface
@@ -1,13 +1,4 @@
1
- import type { Locator, Page } from "playwright-core";
2
- import {
3
- extractMarkdownFromPage,
4
- extractStructuredDataFromPage,
5
- } from "../ai-extractors";
6
- import {
7
- extractArrayFromPage,
8
- extractObjectFromPage,
9
- } from "../optimized-extractors";
10
-
1
+ import type { Page } from "playwright-core";
11
2
  /**
12
3
  * --
13
4
  * @interface
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/browser-dev",
3
- "version": "2.2.3-unify-sdks.22",
3
+ "version": "2.2.3-unify-sdks.23",
4
4
  "description": "runner package for intuned functions",
5
5
  "types": "./dist/index.d.ts",
6
6
  "typesVersions": {
@@ -105,6 +105,7 @@
105
105
  "@types/async-retry": "1.4.8",
106
106
  "@types/fs-extra": "11.0.1",
107
107
  "@types/jest": "^30.0.0",
108
+ "@types/json-schema": "^7.0.15",
108
109
  "@types/lodash": "4.14.200",
109
110
  "@types/node": "^24.1.0",
110
111
  "@typescript-eslint/eslint-plugin": "^5.47.1",