@intuned/browser-dev 2.2.3-unify-sdks.20

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 (195) hide show
  1. package/.babelrc +21 -0
  2. package/.eslintignore +10 -0
  3. package/.eslintrc.js +39 -0
  4. package/LICENSE +43 -0
  5. package/dist/ai-extractors/AnthropicClient/index.js +23 -0
  6. package/dist/ai-extractors/export.d.js +5 -0
  7. package/dist/ai-extractors/export.d.ts +422 -0
  8. package/dist/ai-extractors/extractStructuredData.js +79 -0
  9. package/dist/ai-extractors/extractionHelpers/extractStructuredDataUsingAi/constants.js +7 -0
  10. package/dist/ai-extractors/extractionHelpers/extractStructuredDataUsingAi/errors.js +42 -0
  11. package/dist/ai-extractors/extractionHelpers/extractStructuredDataUsingAi/extractStructuredDataUsingClaude.js +149 -0
  12. package/dist/ai-extractors/extractionHelpers/extractStructuredDataUsingAi/extractStructuredDataUsingGoogle.js +37 -0
  13. package/dist/ai-extractors/extractionHelpers/extractStructuredDataUsingAi/extractStructuredDataUsingOpenAi.js +144 -0
  14. package/dist/ai-extractors/extractionHelpers/extractStructuredDataUsingAi/extractStrucutredDataUsingAiInstance.js +123 -0
  15. package/dist/ai-extractors/extractionHelpers/extractStructuredDataUsingAi/index.js +55 -0
  16. package/dist/ai-extractors/extractionHelpers/extractStructuredDataUsingAi/isItemTableHeaderOrFooter.js +96 -0
  17. package/dist/ai-extractors/extractionHelpers/extractStructuredDataUsingAi/screenshotHelpers.js +55 -0
  18. package/dist/ai-extractors/extractionHelpers/extractStructuredDataUsingAi/types.js +5 -0
  19. package/dist/ai-extractors/extractionHelpers/extractStructuredDataUsingAi/utils.js +53 -0
  20. package/dist/ai-extractors/extractionHelpers/types.js +5 -0
  21. package/dist/ai-extractors/fileExtractors.js +176 -0
  22. package/dist/ai-extractors/index.js +31 -0
  23. package/dist/ai-extractors/jsonSchema.d.js +5 -0
  24. package/dist/ai-extractors/jsonSchema.d.ts +49 -0
  25. package/dist/ai-extractors/openAiClients/index.js +23 -0
  26. package/dist/ai-extractors/validators.js +239 -0
  27. package/dist/browser/ai/export.d.js +3 -0
  28. package/dist/browser/ai/export.d.ts +587 -0
  29. package/dist/browser/ai/extractMarkdown.js +15 -0
  30. package/dist/browser/ai/extractStructuredData.js +231 -0
  31. package/dist/browser/ai/extractStructuredDataUsingAi.js +140 -0
  32. package/dist/browser/ai/extractionHelpers/screenshotHelpers.js +55 -0
  33. package/dist/browser/ai/extractionHelpers/validateSchema.js +148 -0
  34. package/dist/browser/ai/index.d.ts +587 -0
  35. package/dist/browser/ai/index.js +19 -0
  36. package/dist/browser/ai/isPageLoaded.js +67 -0
  37. package/dist/browser/ai/prompt.js +39 -0
  38. package/dist/browser/ai/tests/testCheckAllTypesAreStrings.spec.js +143 -0
  39. package/dist/browser/ai/tests/testExtractStructuredData.spec.js +622 -0
  40. package/dist/browser/ai/tools/index.js +48 -0
  41. package/dist/browser/ai/types/errors.js +67 -0
  42. package/dist/browser/ai/types/models.js +45 -0
  43. package/dist/browser/ai/types/types.js +48 -0
  44. package/dist/browser/ai/validators.js +136 -0
  45. package/dist/common/Logger/index.js +60 -0
  46. package/dist/common/Logger/types.js +5 -0
  47. package/dist/common/SdkError.js +50 -0
  48. package/dist/common/aiModelsValidations.js +50 -0
  49. package/dist/common/browser_scripts.js +2596 -0
  50. package/dist/common/ensureBrowserScripts.js +17 -0
  51. package/dist/common/environmentVariables.js +16 -0
  52. package/dist/common/eventTracking/getAiTrackingHeaders.js +31 -0
  53. package/dist/common/eventTracking/getFileTrackingHeaders.js +23 -0
  54. package/dist/common/extendedTest.js +148 -0
  55. package/dist/common/extractionHelpers.js +19 -0
  56. package/dist/common/formatZodError.js +18 -0
  57. package/dist/common/fuzzySearch/fuzzySearch.test.js +250 -0
  58. package/dist/common/fuzzySearch/levenshtein-search.js +298 -0
  59. package/dist/common/fuzzySearch/utils.js +23 -0
  60. package/dist/common/getModelProvider.js +18 -0
  61. package/dist/common/getSimplifiedHtml.js +122 -0
  62. package/dist/common/hashObject.js +32 -0
  63. package/dist/common/html2markdown/convertElementToMarkdown.js +469 -0
  64. package/dist/common/html2markdown/index.js +19 -0
  65. package/dist/common/jwtTokenManager.js +18 -0
  66. package/dist/common/loadRuntime.js +16 -0
  67. package/dist/common/locatorHelpers.js +41 -0
  68. package/dist/common/matching/collectStrings.js +32 -0
  69. package/dist/common/matching/levenshtein.js +40 -0
  70. package/dist/common/matching/matching.js +317 -0
  71. package/dist/common/matching/types.js +1 -0
  72. package/dist/common/noEmpty.js +9 -0
  73. package/dist/common/saveSnapshotWithExamples.js +60 -0
  74. package/dist/common/tests/testEnsureBrowserScript.spec.js +31 -0
  75. package/dist/common/xpathMapping.js +107 -0
  76. package/dist/helpers/downloadFile.js +125 -0
  77. package/dist/helpers/export.d.js +1 -0
  78. package/dist/helpers/export.d.ts +1294 -0
  79. package/dist/helpers/extractMarkdown.js +35 -0
  80. package/dist/helpers/filterEmptyValues.js +54 -0
  81. package/dist/helpers/gotoUrl.js +93 -0
  82. package/dist/helpers/index.d.ts +1294 -0
  83. package/dist/helpers/index.js +115 -0
  84. package/dist/helpers/processDate.js +25 -0
  85. package/dist/helpers/resolveUrl.js +63 -0
  86. package/dist/helpers/sanitizeHtml.js +73 -0
  87. package/dist/helpers/saveFileToS3.js +46 -0
  88. package/dist/helpers/scrollToLoadContent.js +50 -0
  89. package/dist/helpers/tests/extendedTest.js +130 -0
  90. package/dist/helpers/tests/testDownloadFile.spec.js +197 -0
  91. package/dist/helpers/tests/testFilterEmptyValues.spec.js +151 -0
  92. package/dist/helpers/tests/testGoToUrl.spec.js +37 -0
  93. package/dist/helpers/tests/testIsPageLoaded.spec.js +285 -0
  94. package/dist/helpers/tests/testProcessDate.spec.js +13 -0
  95. package/dist/helpers/tests/testResolveUrl.spec.js +341 -0
  96. package/dist/helpers/tests/testSanitizeHtml.spec.js +330 -0
  97. package/dist/helpers/tests/testSimplifyHtml.spec.js +251 -0
  98. package/dist/helpers/tests/testValidateDataUsingSchema.spec.js +380 -0
  99. package/dist/helpers/tests/testWaitForDomSettled.spec.js +169 -0
  100. package/dist/helpers/tests/testWaitForNetworkIdle.spec.js +115 -0
  101. package/dist/helpers/types/Attachment.js +81 -0
  102. package/dist/helpers/types/CustomTypeRegistry.js +48 -0
  103. package/dist/helpers/types/RunEnvironment.js +18 -0
  104. package/dist/helpers/types/ValidationError.js +17 -0
  105. package/dist/helpers/types/index.js +51 -0
  106. package/dist/helpers/uploadFileToS3.js +153 -0
  107. package/dist/helpers/utils/getS3Client.js +21 -0
  108. package/dist/helpers/utils/index.js +73 -0
  109. package/dist/helpers/utils/isDownload.js +10 -0
  110. package/dist/helpers/utils/isGenerateCodeMode.js +9 -0
  111. package/dist/helpers/utils/isLocator.js +9 -0
  112. package/dist/helpers/utils/jwtTokenManager.js +18 -0
  113. package/dist/helpers/validateDataUsingSchema.js +119 -0
  114. package/dist/helpers/waitForDomSettled.js +182 -0
  115. package/dist/helpers/waitForNetworkIdle.js +191 -0
  116. package/dist/index.d.js +82 -0
  117. package/dist/index.d.ts +11 -0
  118. package/dist/index.js +84 -0
  119. package/dist/intunedServices/ApiGateway/aiApiGateway.js +87 -0
  120. package/dist/intunedServices/ApiGateway/factory.js +13 -0
  121. package/dist/intunedServices/ApiGateway/providers/Anthropic.js +26 -0
  122. package/dist/intunedServices/ApiGateway/providers/Gemini.js +29 -0
  123. package/dist/intunedServices/ApiGateway/providers/OpenAI.js +29 -0
  124. package/dist/intunedServices/ApiGateway/tests/testApiGateway.spec.js +221 -0
  125. package/dist/intunedServices/ApiGateway/types.js +11 -0
  126. package/dist/intunedServices/cache/cache.js +61 -0
  127. package/dist/intunedServices/cache/index.js +12 -0
  128. package/dist/intunedServices/cache/tests/testCache.spec.js +117 -0
  129. package/dist/optimized-extractors/common/buildExamplesPrompt.js +12 -0
  130. package/dist/optimized-extractors/common/buildImagesFromPage.js +55 -0
  131. package/dist/optimized-extractors/common/extractStructuredDataUsingClaude.js +149 -0
  132. package/dist/optimized-extractors/common/extractStructuredDataUsingGoogle.js +37 -0
  133. package/dist/optimized-extractors/common/extractStructuredDataUsingOpenAi.js +145 -0
  134. package/dist/optimized-extractors/common/extractStrucutredDataUsingAiInstance.js +122 -0
  135. package/dist/optimized-extractors/common/findTableHeaders.js +175 -0
  136. package/dist/optimized-extractors/common/index.js +55 -0
  137. package/dist/optimized-extractors/common/isTableHeaderOrFooter.js +97 -0
  138. package/dist/optimized-extractors/common/matching/matching.js +212 -0
  139. package/dist/optimized-extractors/common/matching/matching.test.js +655 -0
  140. package/dist/optimized-extractors/common/matching/types.js +18 -0
  141. package/dist/optimized-extractors/common/matching/utils.js +184 -0
  142. package/dist/optimized-extractors/common/utils.js +58 -0
  143. package/dist/optimized-extractors/export.d.js +5 -0
  144. package/dist/optimized-extractors/export.d.ts +397 -0
  145. package/dist/optimized-extractors/extractArray.js +120 -0
  146. package/dist/optimized-extractors/extractObject.js +104 -0
  147. package/dist/optimized-extractors/index.d.ts +397 -0
  148. package/dist/optimized-extractors/index.js +31 -0
  149. package/dist/optimized-extractors/listExtractionHelpers/__tests__/dynamicListExtractor.spec.js +312 -0
  150. package/dist/optimized-extractors/listExtractionHelpers/__tests__/findSetOfXpathsToCreateAnArrayExtractor.test.js +22 -0
  151. package/dist/optimized-extractors/listExtractionHelpers/__tests__/getContainerElement.test.js +21 -0
  152. package/dist/optimized-extractors/listExtractionHelpers/__tests__/partOfSameArrayXpath.test.js +42 -0
  153. package/dist/optimized-extractors/listExtractionHelpers/__tests__/verifyThatAllXpathsArePartOfSameArray.test.js +9 -0
  154. package/dist/optimized-extractors/listExtractionHelpers/dynamicListExtractor.js +152 -0
  155. package/dist/optimized-extractors/listExtractionHelpers/errors.js +46 -0
  156. package/dist/optimized-extractors/listExtractionHelpers/getListMatches.js +14 -0
  157. package/dist/optimized-extractors/listExtractionHelpers/runAiExtraction.js +240 -0
  158. package/dist/optimized-extractors/listExtractionHelpers/typesAndSchema.js +5 -0
  159. package/dist/optimized-extractors/listExtractionHelpers/utils/extractPropertiesUsingGPTFromArray.js +277 -0
  160. package/dist/optimized-extractors/listExtractionHelpers/utils/extractStructuredListUsingAi.js +44 -0
  161. package/dist/optimized-extractors/listExtractionHelpers/utils/getListContainerXpath.js +94 -0
  162. package/dist/optimized-extractors/listExtractionHelpers/utils/getRelativeContainerXpathSelector.js +20 -0
  163. package/dist/optimized-extractors/listExtractionHelpers/utils/getSimplifiedHtmlPerListItem.js +21 -0
  164. package/dist/optimized-extractors/listExtractionHelpers/utils/tablesUtils.js +48 -0
  165. package/dist/optimized-extractors/listExtractionHelpers/utils/validateOptions.js +52 -0
  166. package/dist/optimized-extractors/models/anthropicModel.js +23 -0
  167. package/dist/optimized-extractors/models/openaiModel.js +23 -0
  168. package/dist/optimized-extractors/objectExtractionHelpers/AIExtractors.js +73 -0
  169. package/dist/optimized-extractors/objectExtractionHelpers/__tests__/checksumUtils.test.js +103 -0
  170. package/dist/optimized-extractors/objectExtractionHelpers/__tests__/testObjectExtractorFromLocator.spec.js +107 -0
  171. package/dist/optimized-extractors/objectExtractionHelpers/__tests__/testObjectExtractorFromPage.spec.js +107 -0
  172. package/dist/optimized-extractors/objectExtractionHelpers/calculateObjectExampleHash.js +28 -0
  173. package/dist/optimized-extractors/objectExtractionHelpers/captureSnapshot.js +26 -0
  174. package/dist/optimized-extractors/objectExtractionHelpers/checksumUtils.js +32 -0
  175. package/dist/optimized-extractors/objectExtractionHelpers/constants.js +7 -0
  176. package/dist/optimized-extractors/objectExtractionHelpers/dynamicObjectExtractor.js +106 -0
  177. package/dist/optimized-extractors/objectExtractionHelpers/errors.js +42 -0
  178. package/dist/optimized-extractors/objectExtractionHelpers/findDomMatches.js +54 -0
  179. package/dist/optimized-extractors/objectExtractionHelpers/getSimplifiedHtml.js +122 -0
  180. package/dist/optimized-extractors/objectExtractionHelpers/typesAndSchemas.js +5 -0
  181. package/dist/optimized-extractors/objectExtractionHelpers/validateDynamicObjectExtractorOptions.js +52 -0
  182. package/dist/optimized-extractors/types/aiModelsValidation.js +45 -0
  183. package/dist/optimized-extractors/types/errors.js +42 -0
  184. package/dist/optimized-extractors/types/jsonSchema.d.js +5 -0
  185. package/dist/optimized-extractors/types/jsonSchema.d.ts +50 -0
  186. package/dist/optimized-extractors/types/types.js +5 -0
  187. package/dist/optimized-extractors/validators.js +152 -0
  188. package/dist/vite-env.d.js +1 -0
  189. package/dist/vite-env.d.ts +9 -0
  190. package/docs.md +14 -0
  191. package/how-to-run-tests.md +10 -0
  192. package/intuned-runtime-setup.md +13 -0
  193. package/package.json +124 -0
  194. package/tsconfig.eslint.json +5 -0
  195. package/tsconfig.json +26 -0
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.strategySchema = exports.simpleObjectJsonSchema = exports.simpleArrayItemJsonSchema = exports.extractObjectOptimizedInputSchema = exports.extractArrayOptimizedInputSchema = void 0;
7
+ var _zod = require("zod");
8
+ var _aiModelsValidation = require("./types/aiModelsValidation");
9
+ const htmlStrategySchema = _zod.z.object({
10
+ model: _zod.z.enum(_aiModelsValidation.SUPPORTED_TEXT_MODELS, {
11
+ required_error: "strategy model is required",
12
+ invalid_type_error: "strategy model is invalid"
13
+ }),
14
+ type: _zod.z.literal("HTML", {
15
+ required_error: "strategy type is required",
16
+ invalid_type_error: "strategy type is invalid"
17
+ })
18
+ });
19
+ const imageStrategySchema = _zod.z.object({
20
+ model: _zod.z.enum(_aiModelsValidation.SUPPORTED_VISION_MODELS, {
21
+ required_error: "strategy model is required",
22
+ invalid_type_error: "strategy model is invalid"
23
+ }),
24
+ type: _zod.z.literal("IMAGE", {
25
+ required_error: "strategy type is required",
26
+ invalid_type_error: "strategy type is invalid"
27
+ })
28
+ });
29
+ const simpleStringSchema = _zod.z.object({
30
+ type: _zod.z.literal("string", {
31
+ required_error: "property type is required",
32
+ invalid_type_error: "optimized extractors only support string types"
33
+ }),
34
+ description: _zod.z.string({
35
+ required_error: "property description is required",
36
+ invalid_type_error: "property description must be a string"
37
+ }).optional()
38
+ });
39
+ const simpleArrayStringSchema = simpleStringSchema.extend({
40
+ primary: _zod.z.boolean().optional()
41
+ });
42
+ const simpleObjectJsonSchema = exports.simpleObjectJsonSchema = _zod.z.object({
43
+ type: _zod.z.literal("object", {
44
+ errorMap: () => ({
45
+ message: 'schema type is required, and must have the value "object"'
46
+ })
47
+ }),
48
+ description: _zod.z.string().optional(),
49
+ properties: _zod.z.record(_zod.z.string(), simpleStringSchema, {
50
+ required_error: "properties is required in object schemas"
51
+ }),
52
+ required: _zod.z.array(_zod.z.string(), {
53
+ required_error: "required must be an array of strings",
54
+ invalid_type_error: "required must be an array of strings"
55
+ }).min(1, {
56
+ message: "at least one property must be required"
57
+ })
58
+ }, {
59
+ required_error: "schema is required"
60
+ }).refine(data => {
61
+ return data.required.every(key => Object.keys(data.properties).includes(key));
62
+ }, {
63
+ message: "All required keys must be defined in the properties object"
64
+ }).refine(data => {
65
+ return Object.keys(data.properties).length > 0;
66
+ }, {
67
+ message: "you must have at least one property in the properties object"
68
+ });
69
+ const simpleArrayItemJsonSchema = exports.simpleArrayItemJsonSchema = _zod.z.object({
70
+ type: _zod.z.literal("object", {
71
+ errorMap: () => ({
72
+ message: 'schema type is required, and must have the value "object"'
73
+ })
74
+ }),
75
+ description: _zod.z.string().optional(),
76
+ properties: _zod.z.record(_zod.z.string(), simpleArrayStringSchema, {
77
+ required_error: "properties is required in object schemas"
78
+ }),
79
+ required: _zod.z.array(_zod.z.string(), {
80
+ required_error: "required must be an array of strings",
81
+ invalid_type_error: "required must be an array of strings"
82
+ }).min(1, {
83
+ message: "at least one property must be required"
84
+ })
85
+ }, {
86
+ required_error: "schema is required"
87
+ }).refine(data => {
88
+ return data.required.every(key => Object.keys(data.properties).includes(key));
89
+ }, {
90
+ message: "All required keys must be defined in the properties object"
91
+ }).refine(data => {
92
+ const primaryField = Object.entries(data.properties).find(([k, v]) => v.primary);
93
+ return primaryField;
94
+ }, {
95
+ message: "you must have one primary property"
96
+ }).refine(data => {
97
+ const primaryField = Object.entries(data.properties).find(([k, v]) => v.primary);
98
+ if (!primaryField) {
99
+ return false;
100
+ }
101
+ return data.required.includes(primaryField[0]);
102
+ }, {
103
+ message: "The primary field must be required"
104
+ });
105
+ const strategySchema = exports.strategySchema = _zod.z.union([htmlStrategySchema, imageStrategySchema], {
106
+ errorMap: (err, context) => {
107
+ if (err.code === "invalid_union" && context.data.model === "gpt3.5-turbo" && context.data.type === "IMAGE") {
108
+ return {
109
+ message: "gpt3.5-turbo does not support IMAGE strategy"
110
+ };
111
+ }
112
+ return {
113
+ message: err.message ?? "invalid strategy configuration"
114
+ };
115
+ }
116
+ }).optional().default({
117
+ model: "claude-3-haiku",
118
+ type: "HTML"
119
+ });
120
+ const labelSchema = _zod.z.string({
121
+ invalid_type_error: "label must be a string",
122
+ required_error: "label is required"
123
+ }).min(1, "label must be at least 1 character long");
124
+ const entityNameSchema = _zod.z.string().min(1, {
125
+ message: "entity name must be at least 1 character long."
126
+ }).max(50, {
127
+ message: "entity name must be no more than 50 characters long."
128
+ }).regex(/^[a-zA-Z0-9_-]+$/, {
129
+ message: "entity name can only contain letters, digits, underscores, and hyphens."
130
+ });
131
+ const extractObjectOptimizedInputSchema = exports.extractObjectOptimizedInputSchema = _zod.z.object({
132
+ label: labelSchema,
133
+ strategy: strategySchema,
134
+ entityName: entityNameSchema,
135
+ entitySchema: simpleObjectJsonSchema,
136
+ variantKey: _zod.z.string().optional().default("about:blank"),
137
+ prompt: _zod.z.string().optional(),
138
+ optionalPropertiesInvalidator: _zod.z.function().returns(_zod.z.array(_zod.z.string())).optional().default(() => () => []),
139
+ apiKey: _zod.z.string().optional()
140
+ }, {
141
+ required_error: "extractObjectOptimized function missing configurations"
142
+ });
143
+ const extractArrayOptimizedInputSchema = exports.extractArrayOptimizedInputSchema = _zod.z.object({
144
+ label: labelSchema,
145
+ strategy: strategySchema,
146
+ prompt: _zod.z.string().optional(),
147
+ itemEntityName: entityNameSchema,
148
+ itemEntitySchema: simpleArrayItemJsonSchema,
149
+ variantKey: _zod.z.string().optional(),
150
+ optionalPropertiesInvalidator: _zod.z.function().returns(_zod.z.array(_zod.z.string())).optional().default(() => () => []),
151
+ apiKey: _zod.z.string().optional()
152
+ });
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,9 @@
1
+ interface ImportMetaEnv {
2
+ readonly VITE_S3_BUCKET: string;
3
+ readonly VITE_AWS_REGION?: string;
4
+ readonly VITE_API_URL?: string;
5
+ }
6
+
7
+ interface ImportMeta {
8
+ readonly env: ImportMetaEnv;
9
+ }
package/docs.md ADDED
@@ -0,0 +1,14 @@
1
+ to generate all docs run:
2
+ ```bash
3
+ yarn generate-all-docs
4
+ ```
5
+
6
+ or run:
7
+ ```bash
8
+ yarn generate-docs <input.d.tx> [outputdir]
9
+ ```
10
+ These commands will go to all export.d.ts file of the 5 namespaces and generate their docs.
11
+ The script in ./scripts/generate-docs reads the JSDOCs in the directories and passes them to the markdown converters. And outputs functions in outputdir/functions and Interfaces at outputdir/interfaces
12
+ The markdown converters scripts parse JSDOCs into a Mintlify compatable format.
13
+
14
+ To write a jsdoc, follow the conventions found in any export.d.ts file, especially the one in `helpers/export.d.ts`.
@@ -0,0 +1,10 @@
1
+ ## How to create a test file
2
+
3
+ - use "src/helpers/tests/extendedTest.ts", this uses vitest by default, import all test requirmenets from it and start writing your test.
4
+
5
+ ## How to run tests
6
+
7
+ - run `npx vitest` to run all tests
8
+ - `npx vitest --ui` to view live test reports on a webpage.
9
+ - `npx vitest --ui path/to/test.spec.t`s to run test from a specific file
10
+ - `npx vitest --ui -t="test description" (or --testNamePattern="test description")` to run a specific test by its description.
@@ -0,0 +1,13 @@
1
+ ## Setting Up the TypeScript SDK and Runtime
2
+
3
+ First, ensure you have Node.js and Yarn installed on your system, then run `yarn install` to set up the project dependencies.
4
+
5
+ During development, you'll need to create a symlink to use your local version of `@intuned/runtime`.
6
+
7
+ To set up the symlink:
8
+
9
+ 1. Navigate to `apps/typescript-runtime` and run `yarn build` after `yarn install` to build the runtime
10
+ 2. In the same directory, run `yarn link`
11
+ 3. Navigate to `apps/typescript-sdk` and run `yarn link "@intuned/runtime"`
12
+
13
+ Note: Whenever you make changes to the runtime code, remember to run `yarn build` in the runtime directory for the changes to reflect in the SDK.
package/package.json ADDED
@@ -0,0 +1,124 @@
1
+ {
2
+ "name": "@intuned/browser-dev",
3
+ "version": "2.2.3-unify-sdks.20",
4
+ "description": "runner package for intuned functions",
5
+ "types": "./dist/index.d.ts",
6
+ "typesVersions": {
7
+ "*": {
8
+ "ai-extractors": [
9
+ "./dist/ai-extractors/index.d.ts"
10
+ ],
11
+ "optimized-extractors": [
12
+ "./dist/optimized-extractors/index.d.ts"
13
+ ],
14
+ "browser": [
15
+ "./dist/browser/index.d.ts"
16
+ ]
17
+ }
18
+ },
19
+ "exports": {
20
+ ".": "./dist/index.js",
21
+ "./ai-extractors": "./dist/ai-extractors/index.js",
22
+ "./optimized-extractors": "./dist/optimized-extractors/index.js",
23
+ "./dist/common/settingsSchema": "./dist/common/settingsSchema.js",
24
+ "./dist/common/getPlaywrightConstructs": "./dist/common/getPlaywrightConstructs.js",
25
+ "./dist/common/contextStorageStateHelpers": "./dist/common/contextStorageStateHelpers.js",
26
+ "./dist/common/types": "./dist/common/types.js",
27
+ "./dist/common/requestMoreInfo": "./dist/common/requestMoreInfo.js",
28
+ "./dist/common/telemetry": "./dist/common/telemetry.js",
29
+ "./dist/common/jwtTokenManager": "./dist/common/jwtTokenManager.js",
30
+ "./dist/common/asyncLocalStorage": "./dist/common/asyncLocalStorage/index.js",
31
+ "./dist/common/cleanEnvironmentVariables": "./dist/common/cleanEnvironmentVariables.js",
32
+ "./dist/commands/common/getFirstLineNumber": "./dist/commands/common/getFirstLineNumber.js",
33
+ "./dist/commands/common/constants": "./dist/commands/common/constants.js",
34
+ "./dist/files/FileUploadAndDownload/utils": "./dist/files/FileUploadAndDownload/utils.js"
35
+ },
36
+ "author": "Intuned Team",
37
+ "license": "Elastic-2.0",
38
+ "scripts": {
39
+ "build": "rm -rf dist && tsc -p tsconfig.json && yarn copy-dts && cp src/common/browser_scripts.js dist/common/ && babel src --out-dir dist --extensions '.ts' && node scripts/ensure-index-types.js",
40
+ "ensure-types": "node scripts/ensure-index-types.js",
41
+ "test": "vitest run",
42
+ "test:dev": "vitest",
43
+ "test:watch": "vitest",
44
+ "clean-declarations": "find ./types-package -name \"*.d.ts\" -type f -delete",
45
+ "lint": "eslint .",
46
+ "fix": "eslint . --fix",
47
+ "generate-docs": "npx tsx ./scripts/generate-docs.ts",
48
+ "generate-all-docs": "npx tsx ./scripts/generate-docs.ts ./src/ai-extractors/export.d.ts ./docs/ai-extractors && npx tsx ./scripts/generate-docs.ts ./src/optimized-extractors/export.d.ts ./docs/optimized-extractors && npx tsx ./scripts/generate-docs.ts ./src/playwright/export.d.ts ./docs/playwright && npx tsx ./scripts/generate-docs.ts ./src/files/export.d.ts ./docs/files && npx tsx ./scripts/generate-docs.ts ./src/helpers/export.d.ts ./docs/helpers && npx tsx ./scripts/generate-docs.ts ./src/runtime/export.d.ts ./docs/runtime",
49
+ "build-browser-scripts": "rollup -c ./src/common/browserScripts/rollup.config.mjs",
50
+ "copy-dts": "copyfiles -u 1 \"src/**/*.d.ts\" dist"
51
+ },
52
+ "dependencies": {
53
+ "@ai-sdk/anthropic": "2.0.1",
54
+ "@ai-sdk/google": "1.0.12",
55
+ "@ai-sdk/openai": "2.0.4",
56
+ "@ai-sdk/provider": "2.0.0",
57
+ "@anthropic-ai/sdk": "0.22.0",
58
+ "@aws-sdk/client-s3": "3.821.0",
59
+ "@aws-sdk/s3-request-presigner": "3.821.0",
60
+ "@intuned/runtime": "^1.1.3",
61
+ "ai": "5.0.15",
62
+ "ajv": "8.13.0",
63
+ "ajv-formats": "2.1.1",
64
+ "async-mutex": "0.5.0",
65
+ "async-retry": "1.3.3",
66
+ "chalk": "4.1.2",
67
+ "chrono-node": "2.8.3",
68
+ "copyfiles": "2.4.1",
69
+ "date-fns": "4.1.0",
70
+ "doctrine": "3.0.0",
71
+ "dom-to-semantic-markdown": "1.2.14",
72
+ "dotenv": "^16.3.1",
73
+ "file-type": "16.5.4",
74
+ "fs-extra": "11.1.1",
75
+ "https-proxy-agent": "7.0.5",
76
+ "image-size": "1.1.1",
77
+ "lodash": "4.17.21",
78
+ "neverthrow": "6.1.0",
79
+ "node-html-parser": "7.0.1",
80
+ "node-xlsx": "0.23.0",
81
+ "openai": "4.77.3",
82
+ "pdfjs-dist": "2.1.266",
83
+ "read-chunk": "3.2.0",
84
+ "stack-utils": "2.0.6",
85
+ "tslib": "2.6.0",
86
+ "zod": "^3.25.76",
87
+ "zod-validation-error": "3.0.3"
88
+ },
89
+ "devDependencies": {
90
+ "@babel/cli": "^7.23.4",
91
+ "@babel/core": "^7.23.7",
92
+ "@babel/plugin-transform-export-namespace-from": "^7.24.1",
93
+ "@babel/preset-env": "^7.23.7",
94
+ "@babel/preset-typescript": "^7.23.3",
95
+ "@rollup/plugin-commonjs": "^25.0.2",
96
+ "@rollup/plugin-node-resolve": "15.1.0",
97
+ "@rollup/plugin-typescript": "11.1.2",
98
+ "@types/async-retry": "1.4.8",
99
+ "@types/fs-extra": "11.0.1",
100
+ "@types/jest": "^30.0.0",
101
+ "@types/lodash": "4.14.200",
102
+ "@types/node": "^24.1.0",
103
+ "@typescript-eslint/eslint-plugin": "^5.47.1",
104
+ "@typescript-eslint/parser": "^7.5.0",
105
+ "@vitest/ui": "^1.1.3",
106
+ "babel-plugin-macros": "^3.1.0",
107
+ "eslint": "7.32.0",
108
+ "eslint-plugin-deprecation": "^1.3.3",
109
+ "eslint-plugin-prettier": "^4.2.1",
110
+ "jest": "^30.0.4",
111
+ "msw": "^2.1.2",
112
+ "playwright": "^1.55.0",
113
+ "prettier": "^2.8.8",
114
+ "rollup": "3.26.2",
115
+ "ts-jest": "^29.4.0",
116
+ "typescript": "5.4.4",
117
+ "vite": "^5.4.12",
118
+ "vite-plugin-babel-macros": "^1.0.6",
119
+ "vitest": "^1.1.3"
120
+ },
121
+ "peerDependencies": {
122
+ "@intuned/runtime": "*"
123
+ }
124
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": ["**/*.ts", "**/*.d.ts"],
4
+ "exclude": ["node_modules"]
5
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2021",
4
+ "module": "esnext",
5
+ "esModuleInterop": true,
6
+ "moduleResolution": "bundler",
7
+ "resolveJsonModule": true,
8
+ "outDir": "./dist",
9
+ "strict": false,
10
+ "strictNullChecks": true,
11
+ "rootDir": "./src",
12
+ "sourceMap": false,
13
+ "declaration": false,
14
+ "emitDeclarationOnly": false,
15
+ "skipLibCheck": true
16
+ },
17
+ "include": [
18
+ "src/**/*.ts",
19
+ "src/**/*.d.ts",
20
+ "src/assets/**/*",
21
+ "types-package/noEmpty.ts",
22
+ "types-package/**/*.ts",
23
+ "types-package/**/*.d.ts"
24
+ , "src/common/browser_scripts.js" ],
25
+ "exclude": ["node_modules", "**/*.test.ts", "**/__tests__/*"]
26
+ }