@intuned/browser-dev 0.1.7-dev.0 → 0.1.9-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.
Files changed (50) hide show
  1. package/README.md +85 -143
  2. package/dist/ai/export.d.ts +292 -144
  3. package/dist/ai/extractStructuredDataUsingAi.js +24 -1
  4. package/dist/ai/index.d.ts +292 -144
  5. package/dist/ai/tests/testExtractStructuredData.spec.js +2 -2
  6. package/dist/common/Logger/index.js +2 -2
  7. package/dist/helpers/export.d.ts +703 -577
  8. package/dist/helpers/gotoUrl.js +50 -51
  9. package/dist/helpers/index.d.ts +703 -577
  10. package/dist/helpers/tests/testClickUntilExhausted.spec.js +2 -1
  11. package/dist/helpers/withNetworkSettledWait.js +2 -7
  12. package/dist/optimized-extractors/export.d.ts +17 -18
  13. package/dist/optimized-extractors/index.d.ts +17 -18
  14. package/how-to-generate-docs.md +40 -28
  15. package/package.json +2 -3
  16. package/generated-docs/ai/functions/extractStructuredData.mdx +0 -255
  17. package/generated-docs/ai/functions/isPageLoaded.mdx +0 -89
  18. package/generated-docs/ai/interfaces/ArraySchema.mdx +0 -36
  19. package/generated-docs/ai/interfaces/BasicSchema.mdx +0 -14
  20. package/generated-docs/ai/interfaces/BooleanSchema.mdx +0 -28
  21. package/generated-docs/ai/interfaces/ImageBufferContentItem.mdx +0 -16
  22. package/generated-docs/ai/interfaces/ImageUrlContentItem.mdx +0 -16
  23. package/generated-docs/ai/interfaces/NumberSchema.mdx +0 -35
  24. package/generated-docs/ai/interfaces/ObjectSchema.mdx +0 -39
  25. package/generated-docs/ai/interfaces/StringSchema.mdx +0 -35
  26. package/generated-docs/ai/interfaces/TextContentItem.mdx +0 -14
  27. package/generated-docs/ai/type-aliases/ContentItem.mdx +0 -12
  28. package/generated-docs/ai/type-aliases/JsonSchema.mdx +0 -47
  29. package/generated-docs/ai/type-aliases/SUPPORTED_MODELS.mdx +0 -85
  30. package/generated-docs/helpers/functions/clickButtonAndWait.mdx +0 -63
  31. package/generated-docs/helpers/functions/clickUntilExhausted.mdx +0 -112
  32. package/generated-docs/helpers/functions/downloadFile.mdx +0 -99
  33. package/generated-docs/helpers/functions/extractMarkdown.mdx +0 -56
  34. package/generated-docs/helpers/functions/filterEmptyValues.mdx +0 -51
  35. package/generated-docs/helpers/functions/goToUrl.mdx +0 -124
  36. package/generated-docs/helpers/functions/processDate.mdx +0 -55
  37. package/generated-docs/helpers/functions/resolveUrl.mdx +0 -165
  38. package/generated-docs/helpers/functions/sanitizeHtml.mdx +0 -113
  39. package/generated-docs/helpers/functions/saveFileToS3.mdx +0 -127
  40. package/generated-docs/helpers/functions/scrollToLoadContent.mdx +0 -83
  41. package/generated-docs/helpers/functions/uploadFileToS3.mdx +0 -121
  42. package/generated-docs/helpers/functions/validateDataUsingSchema.mdx +0 -90
  43. package/generated-docs/helpers/functions/waitForDomSettled.mdx +0 -91
  44. package/generated-docs/helpers/functions/withNetworkSettledWait.mdx +0 -76
  45. package/generated-docs/helpers/interfaces/Attachment.mdx +0 -56
  46. package/generated-docs/helpers/interfaces/S3Configs.mdx +0 -52
  47. package/generated-docs/helpers/interfaces/SanitizeHtmlOptions.mdx +0 -22
  48. package/generated-docs/helpers/type-aliases/AttachmentType.mdx +0 -10
  49. package/generated-docs/helpers/type-aliases/FileType.mdx +0 -61
  50. package/generated-docs/helpers/type-aliases/Trigger.mdx +0 -62
@@ -231,7 +231,8 @@ const noChangeThresholdHtml = `
231
231
  const buttonLocator = page.locator("#load-more");
232
232
  await (0, _.clickUntilExhausted)({
233
233
  page,
234
- buttonLocator
234
+ buttonLocator,
235
+ maxClicks: 10
235
236
  });
236
237
  const finalCount = await page.locator(".item").count();
237
238
  (0, _extendedTest.expect)(finalCount).toBe(10);
@@ -11,7 +11,6 @@ const withNetworkSettledWait = async (callback, options) => {
11
11
  timeoutInMs = 30000,
12
12
  maxInflightRequests = 0
13
13
  } = options || {};
14
- _Logger.logger.debug(`Page object: ${page}`);
15
14
  let networkSettledResolve = null;
16
15
  let networkSettledPromise = new Promise(resolve => {
17
16
  networkSettledResolve = resolve;
@@ -50,7 +49,6 @@ const withNetworkSettledWait = async (callback, options) => {
50
49
  const timeoutPromise = new Promise(resolve => {
51
50
  setTimeout(() => {
52
51
  var _networkSettledResolv2;
53
- _Logger.logger.info("waiting for network to settle timed out");
54
52
  isTimeout = true;
55
53
  (_networkSettledResolv2 = networkSettledResolve) === null || _networkSettledResolv2 === void 0 || _networkSettledResolv2();
56
54
  resolve();
@@ -61,17 +59,15 @@ const withNetworkSettledWait = async (callback, options) => {
61
59
  actionDone = true;
62
60
  await new Promise(resolve => setTimeout(resolve, 500));
63
61
  await maybeSettle();
64
- _Logger.logger.info("-- Start waiting for network to settle... --");
65
62
  let shouldContinue = true;
66
63
  while (shouldContinue) {
67
- _Logger.logger.info(`waiting for network to settle, ${requestCounter} requests pending`);
68
64
  await Promise.race([networkSettledPromise, timeoutPromise]);
69
65
  await new Promise(resolve => setTimeout(resolve, 500));
70
66
  if (actionDone && requestCounter <= maxInflightRequests || isTimeout) {
71
67
  if (isTimeout) {
72
- _Logger.logger.info("Exiting due to timeout, network did not settle");
68
+ _Logger.logger.debug("Network did not settle within timeout.");
73
69
  } else {
74
- _Logger.logger.info("network settled, no pending requests");
70
+ _Logger.logger.debug("Network settled.");
75
71
  }
76
72
  shouldContinue = false;
77
73
  } else {
@@ -80,7 +76,6 @@ const withNetworkSettledWait = async (callback, options) => {
80
76
  });
81
77
  }
82
78
  }
83
- _Logger.logger.info("-- Finished waiting for network to settle --");
84
79
  return result;
85
80
  } finally {
86
81
  page === null || page === void 0 || page.off("request", onRequest);
@@ -2,8 +2,8 @@ import { Locator, Page } from "playwright";
2
2
  import { BasicSchema } from "./types/jsonSchema";
3
3
 
4
4
  /**
5
- * this strategy will use a screenshot of the page/locator with some processing to extract the needed data.
6
- * should be used when the information you're trying to extract is not present in the dom as a text but can be identified visually.
5
+ * This strategy uses a screenshot of the page/locator with some processing to extract the needed data.
6
+ * Use when the information you're trying to extract isn't present in the DOM as text but can be identified visually.
7
7
  * @interface
8
8
  * @property model - the model to use in the extraction process.
9
9
  * @property type - the type of the strategy
@@ -35,8 +35,8 @@ export interface ImageStrategy {
35
35
  type: "IMAGE";
36
36
  }
37
37
  /**
38
- * this strategy will use the html of the page/locator to extract the needed data. we filter out some of the attributes to reduce context.
39
- * the attributes included are only: `aria-label` `data-name` `name` `type` `placeholder` `value` `role` `title` `href` `id` `alt`,
38
+ * This strategy uses the HTML of the page/locator to extract the needed data. We filter out some attributes to reduce context.
39
+ * The attributes included are only: `aria-label` `data-name` `name` `type` `placeholder` `value` `role` `title` `href` `id` `alt`.
40
40
  *
41
41
  * @interface
42
42
  * @property model - the model to use in the extraction process
@@ -73,23 +73,22 @@ export interface HtmlStrategy {
73
73
  type: "HTML";
74
74
  }
75
75
  /**
76
- * Extracts an array of structured data from a web page in an optimized way, this function will use ai for the first n times, until it collects multiple examples
77
- * then it will build reliable selectors in the background to make the process more efficient
76
+ * Extracts an array of structured data from a web page in an optimized way. This function uses AI for the first few extractions until it collects multiple examples, then builds reliable selectors in the background for improved efficiency.
78
77
  * @deprecated This function is deprecated and will be removed in the future.
79
78
  * @param page - The Playwright Page object from which to extract the data.
80
79
  * @param options.label - A label for this extraction process, used for billing and monitoring.
81
- * @param options.itemEntityName - The name of the entity items being extracted, it must be between 1 and 50 characters long and can only contain letters, digits, periods, underscores, and hyphens.
80
+ * @param options.itemEntityName - The name of the entity items being extracted. Must be 150 characters long and can only contain letters, digits, periods, underscores, and hyphens.
82
81
  * @param options.itemEntitySchema - The schema of the entity items being extracted.
83
82
  * @param options.strategy - Optional. The strategy to use for extraction, if not provided, the html strategy with claude haiku will be used.
84
83
  * @param options.prompt - Optional. A prompt to guide the extraction process.
85
84
  * @param options.optionalPropertiesInvalidator - Optional. A function to invalidate optional properties.
86
85
  * @param options.variantKey - Optional. A variant key for the extraction process, use this when the page has multiple variants/shapes.
87
- * @param options.apiKey - Optional. An API key to use for the AI extraction. Extractions made with you API key will not be billed to your account.
86
+ * @param options.apiKey - Optional. An API key for AI extraction. Extractions made with your API key won't be billed to your account.
88
87
  * @returns A promise that resolves to a list of extracted data.
89
88
  *
90
89
  * @example
91
90
  * ```typescript extractArrayFromPage
92
- * import { extractArrayFromPage } from "@intuned/sdk/optimized-extractors";
91
+ * import { extractArrayFromPage } from "@intuned/browser/optimized-extractors";
93
92
  *
94
93
  * await page.goto("https://books.toscrape.com/")
95
94
  * const books = await extractArrayFromPage(page,
@@ -149,18 +148,18 @@ export declare function extractArrayFromPage(
149
148
  * @deprecated This function is deprecated and will be removed in the future.
150
149
  * @param locator - The Playwright Locator object from which to extract the data.
151
150
  * @param options.label - A label for this extraction process, used for billing and monitoring.
152
- * @param options.itemEntityName - The name of the entity items being extracted. it must be between 1 and 50 characters long and can only contain letters, digits, periods, underscores, and hyphens.
151
+ * @param options.itemEntityName - The name of the entity items being extracted. Must be 150 characters long and can only contain letters, digits, periods, underscores, and hyphens.
153
152
  * @param options.itemEntitySchema - The schema of the entity items being extracted.
154
153
  * @param options.strategy - Optional. The strategy to use for extraction, if not provided, the html strategy with claude haiku will be used.
155
154
  * @param options.prompt - Optional. A prompt to guide the extraction process.
156
155
  * @param options.optionalPropertiesInvalidator - Optional. A function to invalidate optional properties.
157
156
  * @param options.variantKey - Optional. A variant key for the extraction process.
158
- * @param options.apiKey - Optional. An API key to use for the AI extraction. Extractions made with you API key will not be billed to your account.
157
+ * @param options.apiKey - Optional. An API key for AI extraction. Extractions made with your API key won't be billed to your account.
159
158
  * @returns A promise that resolves to a list of extracted data.
160
159
  *
161
160
  * @example
162
161
  * ```typescript extractArrayFromLocator
163
- * import { extractArrayFromLocator } from "@intuned/sdk/optimized-extractors";
162
+ * import { extractArrayFromLocator } from "@intuned/browser/optimized-extractors";
164
163
  *
165
164
  * await page.goto("https://books.toscrape.com/")
166
165
  * const books = await extractArrayFromLocator(page.locator("section"),
@@ -266,17 +265,17 @@ export interface SimpleArrayItemSchema extends BasicSchema {
266
265
  * @deprecated This function is deprecated and will be removed in the future.
267
266
  * @param page - The Playwright Page object from which to extract the data.
268
267
  * @param options.label - A label for this extraction process, used for billing and monitoring.
269
- * @param options.entityName - The name of the entity being extracted. it must be between 1 and 50 characters long and can only contain letters, digits, periods, underscores, and hyphens.
268
+ * @param options.entityName - The name of the entity being extracted. Must be 150 characters long and can only contain letters, digits, periods, underscores, and hyphens.
270
269
  * @param options.entitySchema - The schema of the entity being extracted.
271
270
  * @param options.strategy - Optional. The strategy to use for extraction, if not provided, the html strategy with claude haiku will be used.
272
271
  * @param options.prompt - Optional. A prompt to guide the extraction process.
273
272
  * @param options.optionalPropertiesInvalidator - Optional. A function to invalidate optional properties.
274
273
  * @param options.variantKey - Optional. A variant key for the extraction process.
275
- * @param options.apiKey - Optional. An API key to use for the AI extraction. Extractions made with you API key will not be billed to your account.
274
+ * @param options.apiKey - Optional. An API key for AI extraction. Extractions made with your API key won't be billed to your account.
276
275
  * @returns A promise that resolves to the extracted object.
277
276
  * @example
278
277
  * ```typescript extractObjectFromPage
279
- * import { extractObjectFromPage } from "@intuned/sdk/optimized-extractors";
278
+ * import { extractObjectFromPage } from "@intuned/browser/optimized-extractors";
280
279
  *
281
280
  * await page.goto("https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html")
282
281
  * const book = await extractObjectFromPage(page,
@@ -333,18 +332,18 @@ export declare function extractObjectFromPage(
333
332
  * @deprecated This function is deprecated and will be removed in the future.
334
333
  * @param locator - The Playwright Locator object from which to extract the data.
335
334
  * @param options.label - A label for this extraction process, used for billing and monitoring.
336
- * @param options.entityName - The name of the entity being extracted. it must be between 1 and 50 characters long and can only contain letters, digits, periods, underscores, and hyphens.
335
+ * @param options.entityName - The name of the entity being extracted. Must be 150 characters long and can only contain letters, digits, periods, underscores, and hyphens.
337
336
  * @param options.entitySchema - The schema of the entity being extracted.
338
337
  * @param options.strategy - Optional. The strategy to use for extraction, if not provided, the html strategy with claude haiku will be used.
339
338
  * @param options.prompt - Optional. A prompt to guide the extraction process.
340
339
  * @param options.optionalPropertiesInvalidator - Optional. A function to invalidate optional properties.
341
340
  * @param options.variantKey - Optional. A variant key for the extraction process.
342
- * @param options.apiKey - Optional. An API key to use for the AI extraction. Extractions made with you API key will not be billed to your account.
341
+ * @param options.apiKey - Optional. An API key for AI extraction. Extractions made with your API key won't be billed to your account.
343
342
  * @returns A promise that resolves to the extracted object.
344
343
  *
345
344
  * @example
346
345
  * ```typescript extractObjectFromLocator
347
- * import { extractObjectFromLocator } from "@intuned/sdk/optimized-extractors";
346
+ * import { extractObjectFromLocator } from "@intuned/browser/optimized-extractors";
348
347
  *
349
348
  * await page.goto("https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html")
350
349
  * const book = await extractObjectFromLocator(page.locator(".page_inner"),
@@ -2,8 +2,8 @@ import { Locator, Page } from "playwright";
2
2
  import { BasicSchema } from "./types/jsonSchema";
3
3
 
4
4
  /**
5
- * this strategy will use a screenshot of the page/locator with some processing to extract the needed data.
6
- * should be used when the information you're trying to extract is not present in the dom as a text but can be identified visually.
5
+ * This strategy uses a screenshot of the page/locator with some processing to extract the needed data.
6
+ * Use when the information you're trying to extract isn't present in the DOM as text but can be identified visually.
7
7
  * @interface
8
8
  * @property model - the model to use in the extraction process.
9
9
  * @property type - the type of the strategy
@@ -35,8 +35,8 @@ export interface ImageStrategy {
35
35
  type: "IMAGE";
36
36
  }
37
37
  /**
38
- * this strategy will use the html of the page/locator to extract the needed data. we filter out some of the attributes to reduce context.
39
- * the attributes included are only: `aria-label` `data-name` `name` `type` `placeholder` `value` `role` `title` `href` `id` `alt`,
38
+ * This strategy uses the HTML of the page/locator to extract the needed data. We filter out some attributes to reduce context.
39
+ * The attributes included are only: `aria-label` `data-name` `name` `type` `placeholder` `value` `role` `title` `href` `id` `alt`.
40
40
  *
41
41
  * @interface
42
42
  * @property model - the model to use in the extraction process
@@ -73,23 +73,22 @@ export interface HtmlStrategy {
73
73
  type: "HTML";
74
74
  }
75
75
  /**
76
- * Extracts an array of structured data from a web page in an optimized way, this function will use ai for the first n times, until it collects multiple examples
77
- * then it will build reliable selectors in the background to make the process more efficient
76
+ * Extracts an array of structured data from a web page in an optimized way. This function uses AI for the first few extractions until it collects multiple examples, then builds reliable selectors in the background for improved efficiency.
78
77
  * @deprecated This function is deprecated and will be removed in the future.
79
78
  * @param page - The Playwright Page object from which to extract the data.
80
79
  * @param options.label - A label for this extraction process, used for billing and monitoring.
81
- * @param options.itemEntityName - The name of the entity items being extracted, it must be between 1 and 50 characters long and can only contain letters, digits, periods, underscores, and hyphens.
80
+ * @param options.itemEntityName - The name of the entity items being extracted. Must be 150 characters long and can only contain letters, digits, periods, underscores, and hyphens.
82
81
  * @param options.itemEntitySchema - The schema of the entity items being extracted.
83
82
  * @param options.strategy - Optional. The strategy to use for extraction, if not provided, the html strategy with claude haiku will be used.
84
83
  * @param options.prompt - Optional. A prompt to guide the extraction process.
85
84
  * @param options.optionalPropertiesInvalidator - Optional. A function to invalidate optional properties.
86
85
  * @param options.variantKey - Optional. A variant key for the extraction process, use this when the page has multiple variants/shapes.
87
- * @param options.apiKey - Optional. An API key to use for the AI extraction. Extractions made with you API key will not be billed to your account.
86
+ * @param options.apiKey - Optional. An API key for AI extraction. Extractions made with your API key won't be billed to your account.
88
87
  * @returns A promise that resolves to a list of extracted data.
89
88
  *
90
89
  * @example
91
90
  * ```typescript extractArrayFromPage
92
- * import { extractArrayFromPage } from "@intuned/sdk/optimized-extractors";
91
+ * import { extractArrayFromPage } from "@intuned/browser/optimized-extractors";
93
92
  *
94
93
  * await page.goto("https://books.toscrape.com/")
95
94
  * const books = await extractArrayFromPage(page,
@@ -149,18 +148,18 @@ export declare function extractArrayFromPage(
149
148
  * @deprecated This function is deprecated and will be removed in the future.
150
149
  * @param locator - The Playwright Locator object from which to extract the data.
151
150
  * @param options.label - A label for this extraction process, used for billing and monitoring.
152
- * @param options.itemEntityName - The name of the entity items being extracted. it must be between 1 and 50 characters long and can only contain letters, digits, periods, underscores, and hyphens.
151
+ * @param options.itemEntityName - The name of the entity items being extracted. Must be 150 characters long and can only contain letters, digits, periods, underscores, and hyphens.
153
152
  * @param options.itemEntitySchema - The schema of the entity items being extracted.
154
153
  * @param options.strategy - Optional. The strategy to use for extraction, if not provided, the html strategy with claude haiku will be used.
155
154
  * @param options.prompt - Optional. A prompt to guide the extraction process.
156
155
  * @param options.optionalPropertiesInvalidator - Optional. A function to invalidate optional properties.
157
156
  * @param options.variantKey - Optional. A variant key for the extraction process.
158
- * @param options.apiKey - Optional. An API key to use for the AI extraction. Extractions made with you API key will not be billed to your account.
157
+ * @param options.apiKey - Optional. An API key for AI extraction. Extractions made with your API key won't be billed to your account.
159
158
  * @returns A promise that resolves to a list of extracted data.
160
159
  *
161
160
  * @example
162
161
  * ```typescript extractArrayFromLocator
163
- * import { extractArrayFromLocator } from "@intuned/sdk/optimized-extractors";
162
+ * import { extractArrayFromLocator } from "@intuned/browser/optimized-extractors";
164
163
  *
165
164
  * await page.goto("https://books.toscrape.com/")
166
165
  * const books = await extractArrayFromLocator(page.locator("section"),
@@ -266,17 +265,17 @@ export interface SimpleArrayItemSchema extends BasicSchema {
266
265
  * @deprecated This function is deprecated and will be removed in the future.
267
266
  * @param page - The Playwright Page object from which to extract the data.
268
267
  * @param options.label - A label for this extraction process, used for billing and monitoring.
269
- * @param options.entityName - The name of the entity being extracted. it must be between 1 and 50 characters long and can only contain letters, digits, periods, underscores, and hyphens.
268
+ * @param options.entityName - The name of the entity being extracted. Must be 150 characters long and can only contain letters, digits, periods, underscores, and hyphens.
270
269
  * @param options.entitySchema - The schema of the entity being extracted.
271
270
  * @param options.strategy - Optional. The strategy to use for extraction, if not provided, the html strategy with claude haiku will be used.
272
271
  * @param options.prompt - Optional. A prompt to guide the extraction process.
273
272
  * @param options.optionalPropertiesInvalidator - Optional. A function to invalidate optional properties.
274
273
  * @param options.variantKey - Optional. A variant key for the extraction process.
275
- * @param options.apiKey - Optional. An API key to use for the AI extraction. Extractions made with you API key will not be billed to your account.
274
+ * @param options.apiKey - Optional. An API key for AI extraction. Extractions made with your API key won't be billed to your account.
276
275
  * @returns A promise that resolves to the extracted object.
277
276
  * @example
278
277
  * ```typescript extractObjectFromPage
279
- * import { extractObjectFromPage } from "@intuned/sdk/optimized-extractors";
278
+ * import { extractObjectFromPage } from "@intuned/browser/optimized-extractors";
280
279
  *
281
280
  * await page.goto("https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html")
282
281
  * const book = await extractObjectFromPage(page,
@@ -333,18 +332,18 @@ export declare function extractObjectFromPage(
333
332
  * @deprecated This function is deprecated and will be removed in the future.
334
333
  * @param locator - The Playwright Locator object from which to extract the data.
335
334
  * @param options.label - A label for this extraction process, used for billing and monitoring.
336
- * @param options.entityName - The name of the entity being extracted. it must be between 1 and 50 characters long and can only contain letters, digits, periods, underscores, and hyphens.
335
+ * @param options.entityName - The name of the entity being extracted. Must be 150 characters long and can only contain letters, digits, periods, underscores, and hyphens.
337
336
  * @param options.entitySchema - The schema of the entity being extracted.
338
337
  * @param options.strategy - Optional. The strategy to use for extraction, if not provided, the html strategy with claude haiku will be used.
339
338
  * @param options.prompt - Optional. A prompt to guide the extraction process.
340
339
  * @param options.optionalPropertiesInvalidator - Optional. A function to invalidate optional properties.
341
340
  * @param options.variantKey - Optional. A variant key for the extraction process.
342
- * @param options.apiKey - Optional. An API key to use for the AI extraction. Extractions made with you API key will not be billed to your account.
341
+ * @param options.apiKey - Optional. An API key for AI extraction. Extractions made with your API key won't be billed to your account.
343
342
  * @returns A promise that resolves to the extracted object.
344
343
  *
345
344
  * @example
346
345
  * ```typescript extractObjectFromLocator
347
- * import { extractObjectFromLocator } from "@intuned/sdk/optimized-extractors";
346
+ * import { extractObjectFromLocator } from "@intuned/browser/optimized-extractors";
348
347
  *
349
348
  * await page.goto("https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html")
350
349
  * const book = await extractObjectFromLocator(page.locator(".page_inner"),
@@ -1,50 +1,62 @@
1
1
  ## How to Generate Documentation
2
2
 
3
- ### Generating Docs
3
+ ### Quick Start
4
4
 
5
5
  **Generate all docs (recommended):**
6
6
 
7
7
  ```bash
8
- yarn generate-all-docs
8
+ yarn generate-docs
9
9
  ```
10
10
 
11
- This command processes all `export.d.ts` files from the 3 namespaces and generates their documentation.
11
+ This command automatically processes all `export.d.ts` files from the 3 namespaces and outputs them to the correct paths in the docs folder to work with Mintlify.
12
12
 
13
- **Generate docs for a specific file:**
13
+ ### Output Structure
14
14
 
15
- ```bash
16
- yarn generate-docs <input.d.ts> [outputdir]
17
- ```
15
+ Docs are automatically generated to:
18
16
 
19
- **Examples:**
17
+ ```
18
+ docs/automation-sdks/intuned-sdk/typescript/
19
+ ├── helpers/
20
+ │ ├── functions/
21
+ │ ├── interfaces/
22
+ │ └── type-aliases/
23
+ ├── ai/
24
+ │ ├── functions/
25
+ │ ├── interfaces/
26
+ │ └── type-aliases/
27
+ └── optimized-extractors/
28
+ ├── functions/
29
+ ├── interfaces/
30
+ └── type-aliases/
31
+ ```
20
32
 
21
- ```bash
22
- # Generate docs for helpers (recommended)
23
- yarn generate-docs ./src/helpers/export.d.ts ./generated-docs/helpers
33
+ ### Available Namespaces
24
34
 
25
- # Generate docs for AI functions
26
- yarn generate-docs ./src/ai/export.d.ts ./generated-docs/ai
35
+ The following namespaces are automatically processed:
27
36
 
28
- # Generate docs for optimized extractors
29
- yarn generate-docs ./src/optimized-extractors/export.d.ts ./generated-docs/optimized-extractors
37
+ | Namespace | Input File | Output Path |
38
+ | -------------------- | -------------------------------------- | ------------------------------------------- |
39
+ | helpers | `src/helpers/export.d.ts` | `docs/.../typescript/helpers/` |
40
+ | ai | `src/ai/export.d.ts` | `docs/.../typescript/ai/` |
41
+ | optimized-extractors | `src/optimized-extractors/export.d.ts` | `docs/.../typescript/optimized-extractors/` |
30
42
 
31
- # Use default output directory (./generated-docs)
32
- yarn generate-docs ./src/helpers/export.d.ts
33
- ```
43
+ ### Legacy Usage (Single File)
34
44
 
35
- **Output Structure:**
45
+ You can still process a single file with a custom output directory:
36
46
 
37
- - Functions will be written to `[outputdir]/functions/`
38
- - Interfaces will be written to `[outputdir]/interfaces/`
39
- - Type aliases will be written to `[outputdir]/type-aliases/`
47
+ ```bash
48
+ yarn generate-docs <input.d.ts> [output-dir]
49
+ ```
40
50
 
41
- ### Available Namespaces
51
+ **Examples:**
42
52
 
43
- The following namespaces have `export.d.ts` files that can be processed:
53
+ ```bash
54
+ # Generate docs for helpers to a custom directory
55
+ yarn generate-docs ./src/helpers/export.d.ts ./custom-output/helpers
44
56
 
45
- - `./src/helpers/export.d.ts` - Helper functions for web automation
46
- - `./src/ai/export.d.ts` - AI-powered data extraction functions
47
- - `./src/optimized-extractors/export.d.ts` - Optimized data extraction functions
57
+ # Generate docs for AI functions to a custom directory
58
+ yarn generate-docs ./src/ai/export.d.ts ./custom-output/ai
59
+ ```
48
60
 
49
61
  ### How It Works
50
62
 
@@ -59,4 +71,4 @@ The script in `./scripts/generate-docs.ts` reads JSDocs from `export.d.ts` files
59
71
  - The markdown converters parse JSDocs into Mintlify-compatible format
60
72
  - Include `@example` blocks with TypeScript code snippets
61
73
  - Use `@param`, `@returns`, and `@interface` tags for proper documentation
62
-
74
+ - Use `@overload` tag to specify tab titles for overloaded functions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/browser-dev",
3
- "version": "0.1.7-dev.0",
3
+ "version": "0.1.9-dev.0",
4
4
  "description": "runner package for intuned functions",
5
5
  "types": "./dist/index.d.ts",
6
6
  "typesVersions": {
@@ -46,7 +46,6 @@
46
46
  "lint": "eslint .",
47
47
  "fix": "eslint . --fix",
48
48
  "generate-docs": "npx tsx ./scripts/generate-docs.ts",
49
- "generate-all-docs": "npx tsx ./scripts/generate-docs.ts ./src/helpers/export.d.ts ./generated-docs/helpers && npx tsx ./scripts/generate-docs.ts ./src/ai/export.d.ts ./generated-docs/ai && npx tsx ./scripts/generate-docs.ts ./src/optimized-extractors/export.d.ts ./generated-docs/optimized-extractors",
50
49
  "build-browser-scripts": "rollup -c ./src/common/browserScripts/rollup.config.mjs",
51
50
  "copy-dts": "copyfiles -u 1 \"src/**/*.d.ts\" dist",
52
51
  "release": "npx tsx ./scripts/release.ts"
@@ -59,7 +58,6 @@
59
58
  "@anthropic-ai/sdk": "0.22.0",
60
59
  "@aws-sdk/client-s3": "3.821.0",
61
60
  "@aws-sdk/s3-request-presigner": "3.821.0",
62
- "@intuned/runtime": "^1.3.12",
63
61
  "ai": "5.0.15",
64
62
  "ajv": "8.13.0",
65
63
  "ajv-formats": "2.1.1",
@@ -111,6 +109,7 @@
111
109
  "prettier": "^2.8.8",
112
110
  "rollup": "3.26.2",
113
111
  "ts-jest": "^29.4.0",
112
+ "ts-morph": "^27.0.2",
114
113
  "typescript": "5.4.4",
115
114
  "vite": "^5.4.12",
116
115
  "vite-plugin-babel-macros": "^1.0.6",