@intuned/runtime-dev 0.1.0-test.25 → 0.1.0-test.26

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.
@@ -61,10 +61,11 @@ async function* runApiGenerator({
61
61
  functionsToken
62
62
  } = _types.runApiParametersSchema.parse(input);
63
63
  _jwtTokenManager.backendFunctionsTokenManager.token = functionsToken;
64
- const downloadsPath = (0, _downloadDirectory.getDownloadDirectoryPath)();
65
64
  let page;
66
65
  let context;
66
+ let downloadsPath;
67
67
  if (runOptions.environment === "deployed") {
68
+ downloadsPath = (0, _downloadDirectory.getDownloadDirectoryPath)();
68
69
  const {
69
70
  headless,
70
71
  proxy
@@ -87,30 +88,6 @@ async function* runApiGenerator({
87
88
  page,
88
89
  context
89
90
  } = await (0, _getPlaywrightConstructs.getPlaywrightConstructsForMode)(mode, cdpAddress, auth === null || auth === void 0 ? void 0 : auth.session));
90
- let isPageStable = false;
91
- let retry = 0;
92
- while (!isPageStable && retry < 10) {
93
- try {
94
- await page.locator("html").all();
95
- isPageStable = true;
96
- break;
97
- } catch (error) {
98
- var _error$message;
99
- if (error !== null && error !== void 0 && (_error$message = error.message) !== null && _error$message !== void 0 && _error$message.includes("Execution context was destroyed")) {
100
- await new Promise(resolve => setTimeout(resolve, 200));
101
- } else {
102
- throw error;
103
- }
104
- }
105
- retry++;
106
- }
107
- if (!isPageStable) {
108
- return (0, _neverthrow.err)(new _errors.AutomationError("The page is not stable, try to run again"));
109
- }
110
- }
111
- const executionContext = (0, _asyncLocalStorage.getExecutionContext)();
112
- if (!executionContext) {
113
- throw "";
114
91
  }
115
92
  async function saveTraceIfNeeded({
116
93
  errorMessage
@@ -213,7 +190,9 @@ async function* runApiGenerator({
213
190
  errorMessage: "failed to save trace"
214
191
  });
215
192
  await context.close();
216
- await fs.remove(downloadsPath);
193
+ if (downloadsPath !== undefined) {
194
+ await fs.remove(downloadsPath);
195
+ }
217
196
  }
218
197
  }
219
198
  async function runApi(params) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "0.1.0-test.25",
3
+ "version": "0.1.0-test.26",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",