@intuned/runtime-dev 1.3.28-dev1 → 1.3.32

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 (220) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/commands/common/utils/settings.d.ts +5 -0
  3. package/dist/commands/common/utils/settings.js +5 -17
  4. package/dist/common/asyncLocalStorage/index.d.ts +11 -0
  5. package/dist/common/asyncLocalStorage/index.js +4 -0
  6. package/dist/common/extension/intunedExtensionServer.js +3 -0
  7. package/dist/common/extension/types.d.ts +49 -25
  8. package/dist/common/extension/types.js +3 -2
  9. package/dist/common/launchBrowser.d.ts +11 -4
  10. package/dist/common/launchBrowser.js +27 -55
  11. package/dist/common/playwrightContext.d.ts +7 -3
  12. package/dist/common/playwrightContext.js +11 -7
  13. package/dist/common/runApi/index.js +24 -6
  14. package/dist/common/settingsSchema.d.ts +431 -25
  15. package/dist/common/settingsSchema.js +18 -2
  16. package/dist/runtime/captcha.js +15 -13
  17. package/dist/vendor/runtime-interface.js +14 -6
  18. package/{dist → package/dist}/commands/api/run.js +11 -7
  19. package/{dist → package/dist}/commands/auth-sessions/load.js +2 -2
  20. package/{dist → package/dist}/commands/auth-sessions/run-check.js +8 -8
  21. package/{dist → package/dist}/commands/auth-sessions/run-create.js +6 -6
  22. package/package/dist/commands/browser/save-state.d.ts +2 -0
  23. package/package/dist/commands/browser/save-state.js +17 -0
  24. package/package/dist/commands/browser/start-browser.d.ts +2 -0
  25. package/package/dist/commands/browser/start-browser.js +14 -0
  26. package/package/dist/commands/build.d.ts +1 -0
  27. package/package/dist/commands/build.js +84 -0
  28. package/package/dist/commands/common/browserUtils.d.ts +14 -0
  29. package/package/dist/commands/common/browserUtils.js +58 -0
  30. package/package/dist/commands/common/getFirstLineNumber.d.ts +9 -0
  31. package/package/dist/commands/common/getFirstLineNumber.js +101 -0
  32. package/package/dist/commands/common/getFirstLineNumber.test.js +228 -0
  33. package/package/dist/commands/common/projectExclusions.d.ts +2 -0
  34. package/package/dist/commands/common/projectExclusions.js +8 -0
  35. package/package/dist/commands/common/sendMessageToClient.d.ts +1 -0
  36. package/package/dist/commands/common/sendMessageToClient.js +10 -0
  37. package/package/dist/commands/common/tsNodeImport.d.ts +2 -0
  38. package/package/dist/commands/common/tsNodeImport.js +34 -0
  39. package/package/dist/commands/common/utils/fileUtils.d.ts +6 -0
  40. package/package/dist/commands/common/utils/fileUtils.js +33 -0
  41. package/package/dist/commands/common/utils/settings.d.ts +2 -0
  42. package/package/dist/commands/common/utils/settings.js +31 -0
  43. package/package/dist/commands/common/utils/template.d.ts +2 -0
  44. package/package/dist/commands/common/utils/template.js +31 -0
  45. package/package/dist/commands/common/utils/unixSocket.d.ts +9 -0
  46. package/package/dist/commands/common/utils/unixSocket.js +44 -0
  47. package/package/dist/commands/interface/run.d.ts +1 -0
  48. package/package/dist/commands/interface/run.js +216 -0
  49. package/package/dist/commands/intuned-cli/commands/attempt.command.d.ts +1 -0
  50. package/package/dist/commands/intuned-cli/commands/attempt.command.js +8 -0
  51. package/package/dist/commands/intuned-cli/commands/attempt_api.command.d.ts +1 -0
  52. package/package/dist/commands/intuned-cli/commands/attempt_api.command.js +30 -0
  53. package/package/dist/commands/intuned-cli/commands/attempt_authsession.command.d.ts +1 -0
  54. package/package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +8 -0
  55. package/package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.d.ts +1 -0
  56. package/package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +19 -0
  57. package/package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.d.ts +1 -0
  58. package/package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +24 -0
  59. package/package/dist/commands/intuned-cli/commands/authsession.command.d.ts +1 -0
  60. package/package/dist/commands/intuned-cli/commands/authsession.command.js +8 -0
  61. package/package/dist/commands/intuned-cli/commands/authsession_record.command.d.ts +1 -0
  62. package/package/dist/commands/intuned-cli/commands/authsession_record.command.js +31 -0
  63. package/package/dist/commands/intuned-cli/commands/build.command.d.ts +1 -0
  64. package/package/dist/commands/intuned-cli/commands/build.command.js +12 -0
  65. package/package/dist/commands/intuned-cli/commands/command.d.ts +2 -0
  66. package/package/dist/commands/intuned-cli/commands/command.js +9 -0
  67. package/package/dist/commands/intuned-cli/commands/deploy.command.d.ts +1 -0
  68. package/package/dist/commands/intuned-cli/commands/deploy.command.js +38 -0
  69. package/package/dist/commands/intuned-cli/commands/index.d.ts +18 -0
  70. package/package/dist/commands/intuned-cli/commands/index.js +203 -0
  71. package/package/dist/commands/intuned-cli/commands/init.command.d.ts +1 -0
  72. package/package/dist/commands/intuned-cli/commands/init.command.js +13 -0
  73. package/package/dist/commands/intuned-cli/commands/run.command.d.ts +1 -0
  74. package/package/dist/commands/intuned-cli/commands/run.command.js +8 -0
  75. package/package/dist/commands/intuned-cli/commands/run_api.command.d.ts +1 -0
  76. package/package/dist/commands/intuned-cli/commands/run_api.command.js +46 -0
  77. package/package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +28 -0
  78. package/package/dist/commands/intuned-cli/commands/run_authsession.command.js +17 -0
  79. package/package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +1 -0
  80. package/package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +35 -0
  81. package/package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +1 -0
  82. package/package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +35 -0
  83. package/package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +1 -0
  84. package/package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +33 -0
  85. package/package/dist/commands/intuned-cli/commands/save.command.d.ts +13 -0
  86. package/package/dist/commands/intuned-cli/commands/save.command.js +42 -0
  87. package/package/dist/commands/intuned-cli/commands/types.d.ts +31 -0
  88. package/package/dist/commands/intuned-cli/commands/types.js +29 -0
  89. package/package/dist/commands/intuned-cli/constants/index.d.ts +17 -0
  90. package/package/dist/commands/intuned-cli/constants/index.js +25 -0
  91. package/package/dist/commands/intuned-cli/controller/__test__/api.test.js +397 -0
  92. package/package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +1059 -0
  93. package/package/dist/commands/intuned-cli/controller/api.d.ts +42 -0
  94. package/package/dist/commands/intuned-cli/controller/api.js +189 -0
  95. package/package/dist/commands/intuned-cli/controller/authSession.d.ts +209 -0
  96. package/package/dist/commands/intuned-cli/controller/authSession.js +420 -0
  97. package/package/dist/commands/intuned-cli/controller/build.d.ts +1 -0
  98. package/package/dist/commands/intuned-cli/controller/build.js +36 -0
  99. package/package/dist/commands/intuned-cli/controller/deploy.d.ts +4 -0
  100. package/package/dist/commands/intuned-cli/controller/deploy.js +139 -0
  101. package/package/dist/commands/intuned-cli/controller/index.d.ts +1 -0
  102. package/package/dist/commands/intuned-cli/controller/index.js +46 -0
  103. package/package/dist/commands/intuned-cli/controller/save.d.ts +14 -0
  104. package/package/dist/commands/intuned-cli/controller/save.js +345 -0
  105. package/package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +103 -0
  106. package/package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +40 -0
  107. package/package/dist/commands/intuned-cli/helpers/api.d.ts +3 -0
  108. package/package/dist/commands/intuned-cli/helpers/api.js +19 -0
  109. package/package/dist/commands/intuned-cli/helpers/auth.d.ts +46 -0
  110. package/package/dist/commands/intuned-cli/helpers/auth.js +144 -0
  111. package/package/dist/commands/intuned-cli/helpers/backend.d.ts +8 -0
  112. package/package/dist/commands/intuned-cli/helpers/backend.js +27 -0
  113. package/package/dist/commands/intuned-cli/helpers/browser.d.ts +14 -0
  114. package/package/dist/commands/intuned-cli/helpers/browser.js +57 -0
  115. package/package/dist/commands/intuned-cli/helpers/context.d.ts +3 -0
  116. package/package/dist/commands/intuned-cli/helpers/context.js +33 -0
  117. package/package/dist/commands/intuned-cli/helpers/errors.d.ts +13 -0
  118. package/package/dist/commands/intuned-cli/helpers/errors.js +37 -0
  119. package/package/dist/commands/intuned-cli/helpers/index.d.ts +12 -0
  120. package/package/dist/commands/intuned-cli/helpers/index.js +137 -0
  121. package/package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +69 -0
  122. package/package/dist/commands/intuned-cli/helpers/intunedJson.js +71 -0
  123. package/package/dist/commands/intuned-cli/helpers/proxy.d.ts +5 -0
  124. package/package/dist/commands/intuned-cli/helpers/proxy.js +23 -0
  125. package/package/dist/commands/intuned-cli/helpers/terminal.d.ts +5 -0
  126. package/package/dist/commands/intuned-cli/helpers/terminal.js +13 -0
  127. package/package/dist/commands/intuned-cli/helpers/timeout.d.ts +1 -0
  128. package/package/dist/commands/intuned-cli/helpers/timeout.js +23 -0
  129. package/package/dist/commands/intuned-cli/helpers/traces.d.ts +2 -0
  130. package/package/dist/commands/intuned-cli/helpers/traces.js +32 -0
  131. package/package/dist/commands/intuned-cli/helpers/validation.d.ts +2 -0
  132. package/package/dist/commands/intuned-cli/helpers/validation.js +14 -0
  133. package/package/dist/commands/intuned-cli/helpers/wrapper.d.ts +2 -0
  134. package/package/dist/commands/intuned-cli/helpers/wrapper.js +60 -0
  135. package/package/dist/commands/intuned-cli/index.d.ts +1 -0
  136. package/package/dist/commands/intuned-cli/index.js +16 -0
  137. package/package/dist/commands/intuned-cli/main.d.ts +1 -0
  138. package/package/dist/commands/intuned-cli/main.js +22 -0
  139. package/package/dist/commands/intuned-cli/types.d.ts +41 -0
  140. package/package/dist/commands/intuned-cli/types.js +12 -0
  141. package/package/dist/commands/ts-check.d.ts +2 -0
  142. package/package/dist/commands/ts-check.js +56 -0
  143. package/package/dist/common/Logger/Logger/index.d.ts +12 -0
  144. package/package/dist/common/Logger/Logger/index.js +60 -0
  145. package/package/dist/common/Logger/Logger/types.d.ts +8 -0
  146. package/package/dist/common/Logger/Logger/types.js +5 -0
  147. package/package/dist/common/Logger/index.d.ts +12 -0
  148. package/package/dist/common/Logger/index.js +60 -0
  149. package/package/dist/common/Logger/types.d.ts +8 -0
  150. package/package/dist/common/Logger/types.js +5 -0
  151. package/package/dist/common/assets/browser_scripts.js +2580 -0
  152. package/package/dist/common/asyncLocalStorage/index.d.ts +16 -0
  153. package/package/dist/common/asyncLocalStorage/index.js +17 -0
  154. package/package/dist/common/backendFunctions/getAuthSessionParameters.d.ts +1 -0
  155. package/package/dist/common/backendFunctions/getAuthSessionParameters.js +38 -0
  156. package/package/dist/common/cleanEnvironmentVariables.d.ts +1 -0
  157. package/package/dist/common/cleanEnvironmentVariables.js +16 -0
  158. package/package/dist/common/constants.d.ts +10 -0
  159. package/package/dist/common/constants.js +16 -0
  160. package/package/dist/common/contextStorageStateHelpers.d.ts +21 -0
  161. package/package/dist/common/contextStorageStateHelpers.js +81 -0
  162. package/package/dist/common/extensionsHelpers.d.ts +8 -0
  163. package/package/dist/common/extensionsHelpers.js +80 -0
  164. package/package/dist/common/formatZodError.d.ts +2 -0
  165. package/package/dist/common/formatZodError.js +18 -0
  166. package/package/dist/common/jwtTokenManager.d.ts +17 -0
  167. package/package/dist/common/jwtTokenManager.js +109 -0
  168. package/package/dist/common/launchBrowser.d.ts +25 -0
  169. package/package/dist/common/launchBrowser.js +172 -0
  170. package/package/dist/common/playwrightContext.d.ts +31 -0
  171. package/package/dist/common/playwrightContext.js +144 -0
  172. package/package/dist/common/runApi/errors.d.ts +72 -0
  173. package/package/dist/common/runApi/errors.js +169 -0
  174. package/package/dist/common/runApi/importUsingImportFunction.d.ts +9 -0
  175. package/package/dist/common/runApi/importUsingImportFunction.js +46 -0
  176. package/package/dist/common/runApi/index.d.ts +11 -0
  177. package/package/dist/common/runApi/index.js +199 -0
  178. package/package/dist/common/runApi/types.d.ts +830 -0
  179. package/package/dist/common/runApi/types.js +73 -0
  180. package/package/dist/common/settingsSchema.d.ts +518 -0
  181. package/package/dist/common/settingsSchema.js +57 -0
  182. package/package/dist/common/setupContextHook.d.ts +17 -0
  183. package/package/dist/common/setupContextHook.js +22 -0
  184. package/package/dist/common/telemetry.d.ts +3 -0
  185. package/package/dist/common/telemetry.js +32 -0
  186. package/package/dist/index.d.ts +4 -0
  187. package/package/dist/index.js +69 -0
  188. package/package/dist/runtime/RunError.d.ts +5 -0
  189. package/package/dist/runtime/RunError.js +19 -0
  190. package/package/dist/runtime/attemptStore.d.ts +2 -0
  191. package/package/dist/runtime/attemptStore.js +23 -0
  192. package/package/dist/runtime/downloadDirectory.d.ts +1 -0
  193. package/package/dist/runtime/downloadDirectory.js +19 -0
  194. package/package/dist/runtime/enums.d.js +5 -0
  195. package/package/dist/runtime/enums.d.ts +11 -0
  196. package/package/dist/runtime/enums.js +18 -0
  197. package/package/dist/runtime/executionHelpers.test.js +52 -0
  198. package/package/dist/runtime/export.d.js +5 -0
  199. package/package/dist/runtime/export.d.ts +228 -0
  200. package/package/dist/runtime/extendPayload.d.ts +2 -0
  201. package/package/dist/runtime/extendPayload.js +21 -0
  202. package/package/dist/runtime/extendTimeout.d.ts +1 -0
  203. package/package/dist/runtime/extendTimeout.js +23 -0
  204. package/package/dist/runtime/getAuthSessionParameters.d.ts +1 -0
  205. package/package/dist/runtime/getAuthSessionParameters.js +20 -0
  206. package/package/dist/runtime/index.d.ts +7 -0
  207. package/package/dist/runtime/index.js +54 -0
  208. package/package/dist/runtime/runInfo.d.ts +2 -0
  209. package/package/dist/runtime/runInfo.js +21 -0
  210. package/package.json +2 -10
  211. package/bin/intuned-api-run +0 -4
  212. package/bin/intuned-auth-session-check +0 -4
  213. package/bin/intuned-auth-session-create +0 -4
  214. package/bin/intuned-auth-session-load +0 -4
  215. package/dist/common/intunedJson.d.ts +0 -252
  216. package/dist/common/intunedJson.js +0 -162
  217. /package/{dist → package/dist}/commands/api/run.d.ts +0 -0
  218. /package/{dist → package/dist}/commands/auth-sessions/load.d.ts +0 -0
  219. /package/{dist → package/dist}/commands/auth-sessions/run-check.d.ts +0 -0
  220. /package/{dist → package/dist}/commands/auth-sessions/run-create.d.ts +0 -0
@@ -25,6 +25,19 @@ function getObjectSizeInBytes(obj) {
25
25
  return new TextEncoder().encode(String(obj)).length;
26
26
  }
27
27
  }
28
+ const DEFAULT_MAX_RESULT_SIZE_BYTES = 2 * 1024 * 1024;
29
+ const MAX_RESULT_SIZE_BYTES_ENV_VAR = "__INTUNED__MAX_RESULT_SIZE_BYTES";
30
+ function getMaxResultSizeBytes() {
31
+ const raw = process.env[MAX_RESULT_SIZE_BYTES_ENV_VAR];
32
+ if (!raw) {
33
+ return DEFAULT_MAX_RESULT_SIZE_BYTES;
34
+ }
35
+ const parsed = Number(raw);
36
+ if (!Number.isFinite(parsed) || parsed <= 0) {
37
+ return DEFAULT_MAX_RESULT_SIZE_BYTES;
38
+ }
39
+ return Math.floor(parsed);
40
+ }
28
41
  async function runApi({
29
42
  abortSignal,
30
43
  importFunction,
@@ -43,7 +56,8 @@ async function runApi({
43
56
  },
44
57
  runOptions,
45
58
  tracing,
46
- auth
59
+ auth,
60
+ captchaSolver
47
61
  } = inputParseResult.data;
48
62
  const abortSymbol = Symbol("abort");
49
63
  const abortPromise = new Promise(resolve => {
@@ -73,6 +87,9 @@ async function runApi({
73
87
  importFunction
74
88
  };
75
89
  const intunedContext = (0, _asyncLocalStorage.getExecutionContext)();
90
+ if (intunedContext) {
91
+ intunedContext.captchaSolver = captchaSolver;
92
+ }
76
93
  const runAutomationWithContext = async (context, page) => {
77
94
  async function saveTraceIfNeeded({
78
95
  errorMessage
@@ -113,10 +130,10 @@ async function runApi({
113
130
  if (automationFunctionResult === abortSymbol) {
114
131
  return (0, _neverthrow.err)(new _runtimeInterface.AbortedError());
115
132
  }
116
- const MAX_RESULT_SIZE_BYTES = 2 * 1024 * 1024;
133
+ const maxResultSizeBytes = getMaxResultSizeBytes();
117
134
  const resultSizeInBytes = getObjectSizeInBytes(automationFunctionResult);
118
- if (resultSizeInBytes > MAX_RESULT_SIZE_BYTES) {
119
- return (0, _neverthrow.err)(new _runtimeInterface.ResultTooBigError(resultSizeInBytes, MAX_RESULT_SIZE_BYTES));
135
+ if (resultSizeInBytes > maxResultSizeBytes) {
136
+ return (0, _neverthrow.err)(new _runtimeInterface.ResultTooBigError(resultSizeInBytes, maxResultSizeBytes));
120
137
  }
121
138
  if (retrieveSession) {
122
139
  return (0, _neverthrow.ok)({
@@ -150,7 +167,9 @@ async function runApi({
150
167
  ignoreHttpErrors: runOptions.ignoreHttpErrors,
151
168
  profileTemplatePath: runOptions.profileTemplatePath,
152
169
  encryptedProfile: runOptions.encryptedProfile,
153
- profileMode: runOptions.profileMode,
170
+ browserPath: runOptions.browserPath,
171
+ browserArgs: runOptions.browserArgs,
172
+ browserSize: runOptions.browserSize,
154
173
  ...playwrightContextParameters
155
174
  }, runAutomationWithContext);
156
175
  } finally {
@@ -162,7 +181,6 @@ async function runApi({
162
181
  cdpTargetId: runOptions.cdpTargetId,
163
182
  profileTemplatePath: runOptions.profileTemplatePath,
164
183
  encryptedProfile: runOptions.encryptedProfile,
165
- profileMode: runOptions.profileMode,
166
184
  ...playwrightContextParameters
167
185
  }, runAutomationWithContext);
168
186
  }