@intuned/runtime-dev 0.1.0-test.14 → 0.1.0-test.16

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 (114) hide show
  1. package/.babelrc +1 -2
  2. package/WebTemplate/api.ts +90 -92
  3. package/WebTemplate/controllers/authSessions/create.ts +2 -2
  4. package/WebTemplate/controllers/authSessions/store.ts +1 -1
  5. package/WebTemplate/controllers/runApi/helpers.ts +14 -12
  6. package/WebTemplate/index.playwright.ts +32 -42
  7. package/WebTemplate/jobs.ts +13 -2
  8. package/WebTemplate/utils.ts +53 -1
  9. package/api/test2.ts +6 -1
  10. package/auth-sessions/check.ts +3 -1
  11. package/auth-sessions/create.ts +10 -10
  12. package/bin/intuned-api-run +1 -1
  13. package/bin/intuned-auth-session-check +1 -1
  14. package/bin/intuned-auth-session-create +1 -1
  15. package/bin/intuned-auth-session-load +1 -1
  16. package/bin/intuned-auth-session-refresh +1 -1
  17. package/bin/intuned-browser-save-state +1 -1
  18. package/bin/intuned-browser-start +1 -1
  19. package/bin/intuned-build +1 -1
  20. package/bin/intuned-ts-check +1 -1
  21. package/dist/commands/api/run.js +109 -170
  22. package/dist/commands/auth-sessions/load.js +28 -26
  23. package/dist/commands/auth-sessions/run-check.js +54 -53
  24. package/dist/commands/auth-sessions/run-create.js +93 -96
  25. package/dist/commands/browser/save-state.js +14 -16
  26. package/dist/commands/browser/start-browser.js +11 -11
  27. package/dist/commands/build.js +79 -109
  28. package/dist/commands/common/browserUtils.js +53 -51
  29. package/dist/commands/common/getFirstLineNumber.js +93 -93
  30. package/dist/commands/common/{getFirstLineNumber.test.ts → getFirstLineNumber.test.js} +53 -48
  31. package/dist/commands/common/sendMessageToClient.js +9 -4
  32. package/dist/commands/common/tsNodeImport.d.ts +1 -0
  33. package/dist/commands/common/tsNodeImport.js +18 -0
  34. package/dist/commands/common/utils/fileUtils.js +32 -22
  35. package/dist/commands/common/utils/settings.js +27 -19
  36. package/dist/commands/common/utils/unixSocket.js +43 -43
  37. package/dist/commands/common/utils/webTemplate.js +30 -28
  38. package/dist/commands/interface/run.js +162 -139
  39. package/dist/commands/ts-check.js +50 -50
  40. package/dist/common/Logger/Logger/index.js +55 -42
  41. package/dist/common/Logger/Logger/types.js +5 -1
  42. package/dist/common/Logger/index.js +55 -42
  43. package/dist/common/Logger/types.js +5 -1
  44. package/dist/common/asyncLocalStorage/index.js +16 -8
  45. package/dist/common/cleanEnvironmentVariables.js +16 -12
  46. package/dist/common/constants.js +7 -1
  47. package/dist/common/contextStorageStateHelpers.js +47 -38
  48. package/dist/common/getPlaywrightConstructs.js +178 -197
  49. package/dist/common/jwtTokenManager.js +76 -79
  50. package/dist/common/runApi/errors.js +159 -150
  51. package/dist/common/runApi/index.js +240 -232
  52. package/dist/common/runApi/types.d.ts +19 -5
  53. package/dist/common/runApi/types.js +53 -56
  54. package/dist/common/settingsSchema.js +15 -10
  55. package/dist/common/telemetry.js +28 -30
  56. package/dist/index.js +69 -4
  57. package/dist/runtime/RunError.js +18 -11
  58. package/dist/runtime/downloadDirectory.js +19 -13
  59. package/dist/runtime/enums.d.js +5 -0
  60. package/dist/runtime/enums.d.ts +11 -1
  61. package/dist/runtime/enums.js +18 -12
  62. package/dist/runtime/executionHelpers.test.js +53 -0
  63. package/dist/runtime/export.d.js +5 -0
  64. package/dist/runtime/export.d.ts +202 -1
  65. package/dist/runtime/extendPayload.js +21 -15
  66. package/dist/runtime/extendTimeout.js +28 -21
  67. package/dist/runtime/index.js +53 -6
  68. package/dist/runtime/requestMoreInfo.js +23 -16
  69. package/dist/runtime/runInfo.js +21 -14
  70. package/package.json +4 -7
  71. package/dist/commands/api/run.ts +0 -105
  72. package/dist/commands/auth-sessions/load.ts +0 -30
  73. package/dist/commands/auth-sessions/run-check.ts +0 -51
  74. package/dist/commands/auth-sessions/run-create.ts +0 -91
  75. package/dist/commands/browser/save-state.ts +0 -14
  76. package/dist/commands/browser/start-browser.ts +0 -11
  77. package/dist/commands/build.ts +0 -79
  78. package/dist/commands/common/browserUtils.ts +0 -45
  79. package/dist/commands/common/getDefaultExportFromFile.d.ts +0 -1
  80. package/dist/commands/common/getDefaultExportFromFile.js +0 -12
  81. package/dist/commands/common/getDefaultExportFromFile.ts +0 -11
  82. package/dist/commands/common/getFirstLineNumber.ts +0 -96
  83. package/dist/commands/common/sendMessageToClient.ts +0 -3
  84. package/dist/commands/common/utils/fileUtils.ts +0 -23
  85. package/dist/commands/common/utils/settings.ts +0 -22
  86. package/dist/commands/common/utils/unixSocket.ts +0 -38
  87. package/dist/commands/common/utils/webTemplate.ts +0 -23
  88. package/dist/commands/interface/run.ts +0 -156
  89. package/dist/commands/ts-check.ts +0 -51
  90. package/dist/common/Logger/Logger/index.ts +0 -53
  91. package/dist/common/Logger/Logger/types.ts +0 -1
  92. package/dist/common/Logger/index.ts +0 -53
  93. package/dist/common/Logger/types.ts +0 -1
  94. package/dist/common/asyncLocalStorage/index.ts +0 -9
  95. package/dist/common/cleanEnvironmentVariables.ts +0 -10
  96. package/dist/common/constants.ts +0 -1
  97. package/dist/common/contextStorageStateHelpers.ts +0 -43
  98. package/dist/common/getPlaywrightConstructs.ts +0 -182
  99. package/dist/common/jwtTokenManager.ts +0 -71
  100. package/dist/common/runApi/errors.ts +0 -154
  101. package/dist/common/runApi/index.ts +0 -253
  102. package/dist/common/runApi/types.ts +0 -43
  103. package/dist/common/settingsSchema.ts +0 -9
  104. package/dist/common/telemetry.ts +0 -23
  105. package/dist/index.ts +0 -4
  106. package/dist/runtime/RunError.ts +0 -12
  107. package/dist/runtime/downloadDirectory.ts +0 -13
  108. package/dist/runtime/enums.ts +0 -12
  109. package/dist/runtime/executionHelpers.test.ts +0 -51
  110. package/dist/runtime/extendPayload.ts +0 -15
  111. package/dist/runtime/extendTimeout.ts +0 -24
  112. package/dist/runtime/index.ts +0 -6
  113. package/dist/runtime/requestMoreInfo.ts +0 -18
  114. package/dist/runtime/runInfo.ts +0 -15
@@ -1,84 +1,81 @@
1
- import fetch from "cross-fetch";
2
- import * as jwt from "jsonwebtoken";
3
- import { err, ResultAsync } from "neverthrow";
4
- // Manages JWT token with renewal
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.backendFunctionsTokenManager = void 0;
7
+ exports.callBackendFunctionWithToken = callBackendFunctionWithToken;
8
+ var _crossFetch = _interopRequireDefault(require("cross-fetch"));
9
+ var jwt = _interopRequireWildcard(require("jsonwebtoken"));
10
+ var _neverthrow = require("neverthrow");
11
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5
14
  class JwtTokenManager {
6
- constructor(refreshTokenPath) {
7
- this.refreshTokenPath = refreshTokenPath;
8
- this._token = undefined;
15
+ constructor(refreshTokenPath) {
16
+ this.refreshTokenPath = refreshTokenPath;
17
+ this._token = undefined;
18
+ }
19
+ get token() {
20
+ return this._token;
21
+ }
22
+ set token(newToken) {
23
+ if (this._token != newToken) {
24
+ this._token = newToken;
25
+ void this.scheduleTokenRefresh();
9
26
  }
10
- get token() {
11
- return this._token;
12
- }
13
- // When the token is set, the schedule for renewal is issued automatically
14
- // This is currently being set it two places:
15
- // 1. Whenever the runner starts, initializes it from the environment variable (set whenever the api is run from the authoring IDE)
16
- // 2. Whenever a published api is called to run (/api/run/*), it is set to the token received in the run request.
17
- set token(newToken) {
18
- if (this._token != newToken) {
19
- this._token = newToken;
20
- void this.scheduleTokenRefresh();
21
- }
22
- }
23
- get timeToRefresh() {
24
- if (!this._token)
25
- return;
26
- const payload = jwt.decode(this._token);
27
- if (!payload || typeof payload == "string")
28
- return;
29
- const expiry = payload.expiry;
30
- if (!expiry || typeof expiry !== "number")
31
- return;
32
- const timeWindow = 60 * 1000; // 1 minute
33
- const timeToRefresh = expiry - Date.now() - timeWindow;
34
- return Math.max(timeToRefresh, timeWindow);
35
- }
36
- async scheduleTokenRefresh() {
37
- if (process.env.RUN_ENVIRONMENT?.toLowerCase() !== "authoring")
38
- return;
39
- const timeToRefresh = this.timeToRefresh;
40
- if (timeToRefresh === undefined)
41
- return;
42
- if (this.tokenRefreshTimeout)
43
- clearTimeout(this.tokenRefreshTimeout);
44
- this.tokenRefreshTimeout = setTimeout(async () => {
45
- const result = await this.refreshToken();
46
- if (result && result.isErr()) {
47
- console.error(`[Internal Error] ${result.error}`);
48
- return;
49
- }
50
- await this.scheduleTokenRefresh();
51
- }, timeToRefresh);
52
- }
53
- async refreshToken() {
54
- if (process.env.RUN_ENVIRONMENT?.toLowerCase() !== "authoring")
55
- return;
56
- const res = await this.fetchWithToken(this.refreshTokenPath, {
57
- method: "GET",
58
- });
59
- if (res.status === 401) {
60
- return err("Unauthorized");
61
- }
62
- const jsonResult = await ResultAsync.fromPromise(res.json(), () => "not json");
63
- if (jsonResult.isErr())
64
- return;
65
- const newToken = jsonResult.value.token;
66
- if (newToken)
67
- this._token = newToken;
68
- }
69
- fetchWithToken(...[input, init]) {
70
- const headers = new Headers(init?.headers);
71
- headers.set("Authorization", `Bearer ${this.token}`);
72
- return fetch(input, {
73
- ...init,
74
- headers,
75
- });
27
+ }
28
+ get timeToRefresh() {
29
+ if (!this._token) return;
30
+ const payload = jwt.decode(this._token);
31
+ if (!payload || typeof payload == "string") return;
32
+ const expiry = payload.expiry;
33
+ if (!expiry || typeof expiry !== "number") return;
34
+ const timeWindow = 60 * 1000;
35
+ const timeToRefresh = expiry - Date.now() - timeWindow;
36
+ return Math.max(timeToRefresh, timeWindow);
37
+ }
38
+ async scheduleTokenRefresh() {
39
+ var _process$env$RUN_ENVI;
40
+ if (((_process$env$RUN_ENVI = process.env.RUN_ENVIRONMENT) === null || _process$env$RUN_ENVI === void 0 ? void 0 : _process$env$RUN_ENVI.toLowerCase()) !== "authoring") return;
41
+ const timeToRefresh = this.timeToRefresh;
42
+ if (timeToRefresh === undefined) return;
43
+ if (this.tokenRefreshTimeout) clearTimeout(this.tokenRefreshTimeout);
44
+ this.tokenRefreshTimeout = setTimeout(async () => {
45
+ const result = await this.refreshToken();
46
+ if (result && result.isErr()) {
47
+ console.error(`[Internal Error] ${result.error}`);
48
+ return;
49
+ }
50
+ await this.scheduleTokenRefresh();
51
+ }, timeToRefresh);
52
+ }
53
+ async refreshToken() {
54
+ var _process$env$RUN_ENVI2;
55
+ if (((_process$env$RUN_ENVI2 = process.env.RUN_ENVIRONMENT) === null || _process$env$RUN_ENVI2 === void 0 ? void 0 : _process$env$RUN_ENVI2.toLowerCase()) !== "authoring") return;
56
+ const res = await this.fetchWithToken(this.refreshTokenPath, {
57
+ method: "GET"
58
+ });
59
+ if (res.status === 401) {
60
+ return (0, _neverthrow.err)("Unauthorized");
76
61
  }
62
+ const jsonResult = await _neverthrow.ResultAsync.fromPromise(res.json(), () => "not json");
63
+ if (jsonResult.isErr()) return;
64
+ const newToken = jsonResult.value.token;
65
+ if (newToken) this._token = newToken;
66
+ }
67
+ fetchWithToken(...[input, init]) {
68
+ const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
69
+ headers.set("Authorization", `Bearer ${this.token}`);
70
+ return (0, _crossFetch.default)(input, {
71
+ ...init,
72
+ headers
73
+ });
74
+ }
77
75
  }
78
76
  const backendFunctionsPath = `${process.env.FUNCTIONS_DOMAIN}/api/${process.env.INTUNED_WORKSPACE_ID}/functions/${process.env.INTUNED_INTEGRATION_ID}`;
79
- export const backendFunctionsTokenManager = new JwtTokenManager(`${backendFunctionsPath}/refreshBackendFunctionsToken`);
80
- backendFunctionsTokenManager.token =
81
- process.env.INTUNED_AUTHORING_SESSION_BACKEND_FUNCTIONS_TOKEN;
82
- export function callBackendFunctionWithToken(path, init) {
83
- return backendFunctionsTokenManager.fetchWithToken(`${backendFunctionsPath}/${path}`, init);
84
- }
77
+ const backendFunctionsTokenManager = exports.backendFunctionsTokenManager = new JwtTokenManager(`${backendFunctionsPath}/refreshBackendFunctionsToken`);
78
+ backendFunctionsTokenManager.token = process.env.INTUNED_AUTHORING_SESSION_BACKEND_FUNCTIONS_TOKEN;
79
+ function callBackendFunctionWithToken(path, init) {
80
+ return backendFunctionsTokenManager.fetchWithToken(`${backendFunctionsPath}/${path}`, init);
81
+ }
@@ -1,163 +1,172 @@
1
- import { RunError } from "../../runtime";
2
- import * as playwright from "@intuned/playwright-core";
3
- export const apiNotFoundErrorCode = "APINotFoundError";
4
- export const invalidApiErrorCode = "InvalidAPIError";
5
- export const invalidCheckErrorCode = "InvalidCheckError";
6
- export const abortedErrorCode = "AbortedError";
7
- export const authRequiredErrorCode = "AuthRequiredError";
8
- export const authCheckNotFoundErrorCode = "AuthCheckNotFoundError";
9
- export const authCheckFailedErrorCode = "AuthCheckFailedError";
10
- export const maxLevelsExceededErrorCode = "MaxLevelsExceededError";
11
- export const automationError = "AutomationError";
12
- export const runAutomationErrorCodes = [
13
- apiNotFoundErrorCode,
14
- invalidApiErrorCode,
15
- invalidCheckErrorCode,
16
- abortedErrorCode,
17
- authRequiredErrorCode,
18
- authCheckNotFoundErrorCode,
19
- authCheckFailedErrorCode,
20
- maxLevelsExceededErrorCode,
21
- automationError,
22
- ];
23
- export class RunAutomationError {
24
- constructor() {
25
- this.wrapped = false;
26
- }
27
- get apiResponse() {
28
- if (this.wrapped) {
29
- return {
30
- status: 200,
31
- body: {
32
- status: this.statusCode,
33
- error: this.code,
34
- message: this.message,
35
- },
36
- };
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.runAutomationErrorCodes = exports.maxLevelsExceededErrorCode = exports.invalidCheckErrorCode = exports.invalidApiErrorCode = exports.automationError = exports.authRequiredErrorCode = exports.authCheckNotFoundErrorCode = exports.authCheckFailedErrorCode = exports.apiNotFoundErrorCode = exports.abortedErrorCode = exports.RunAutomationError = exports.MaxLevelsExceededError = exports.InvalidCheckError = exports.InvalidApiError = exports.AutomationError = exports.AuthRequiredError = exports.AuthCheckNotFoundError = exports.AuthCheckFailedError = exports.ApiNotFoundError = exports.AbortedError = void 0;
7
+ var _runtime = require("../../runtime");
8
+ var playwright = _interopRequireWildcard(require("@intuned/playwright-core"));
9
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
+ const apiNotFoundErrorCode = exports.apiNotFoundErrorCode = "APINotFoundError";
12
+ const invalidApiErrorCode = exports.invalidApiErrorCode = "InvalidAPIError";
13
+ const invalidCheckErrorCode = exports.invalidCheckErrorCode = "InvalidCheckError";
14
+ const abortedErrorCode = exports.abortedErrorCode = "AbortedError";
15
+ const authRequiredErrorCode = exports.authRequiredErrorCode = "AuthRequiredError";
16
+ const authCheckNotFoundErrorCode = exports.authCheckNotFoundErrorCode = "AuthCheckNotFoundError";
17
+ const authCheckFailedErrorCode = exports.authCheckFailedErrorCode = "AuthCheckFailedError";
18
+ const maxLevelsExceededErrorCode = exports.maxLevelsExceededErrorCode = "MaxLevelsExceededError";
19
+ const automationError = exports.automationError = "AutomationError";
20
+ const runAutomationErrorCodes = exports.runAutomationErrorCodes = [apiNotFoundErrorCode, invalidApiErrorCode, invalidCheckErrorCode, abortedErrorCode, authRequiredErrorCode, authCheckNotFoundErrorCode, authCheckFailedErrorCode, maxLevelsExceededErrorCode, automationError];
21
+ class RunAutomationError {
22
+ wrapped = false;
23
+ get apiResponse() {
24
+ if (this.wrapped) {
25
+ return {
26
+ status: 200,
27
+ body: {
28
+ status: this.statusCode,
29
+ error: this.code,
30
+ message: this.message
37
31
  }
38
- return {
39
- status: this.statusCode,
40
- body: {
41
- error: this.code,
42
- message: this.message,
43
- },
44
- };
45
- }
46
- get json() {
47
- return {
48
- code: this.code,
49
- details: this.details,
50
- cause: this.cause?.json,
51
- };
32
+ };
52
33
  }
34
+ return {
35
+ status: this.statusCode,
36
+ body: {
37
+ error: this.code,
38
+ message: this.message
39
+ }
40
+ };
41
+ }
42
+ get json() {
43
+ var _this$cause;
44
+ return {
45
+ code: this.code,
46
+ details: this.details,
47
+ cause: (_this$cause = this.cause) === null || _this$cause === void 0 ? void 0 : _this$cause.json
48
+ };
49
+ }
53
50
  }
54
- export class ApiNotFoundError extends RunAutomationError {
55
- constructor(apiName) {
56
- super();
57
- this.code = apiNotFoundErrorCode;
58
- this.statusCode = 404;
59
- this.message = `API ${apiName} not found`;
60
- }
51
+ exports.RunAutomationError = RunAutomationError;
52
+ class ApiNotFoundError extends RunAutomationError {
53
+ constructor(apiName) {
54
+ super();
55
+ this.code = apiNotFoundErrorCode;
56
+ this.statusCode = 404;
57
+ this.message = `API ${apiName} not found`;
58
+ }
61
59
  }
62
- export class InvalidApiError extends RunAutomationError {
63
- constructor(message) {
64
- super();
65
- this.code = invalidApiErrorCode;
66
- this.statusCode = 400;
67
- this.message = `API is invalid: ${message}`;
68
- }
60
+ exports.ApiNotFoundError = ApiNotFoundError;
61
+ class InvalidApiError extends RunAutomationError {
62
+ constructor(message) {
63
+ super();
64
+ this.code = invalidApiErrorCode;
65
+ this.statusCode = 400;
66
+ this.message = `API is invalid: ${message}`;
67
+ }
69
68
  }
70
- export class InvalidCheckError extends RunAutomationError {
71
- constructor(message, cause) {
72
- super();
73
- this.code = invalidCheckErrorCode;
74
- this.statusCode = 400;
75
- this.message = message;
76
- this.cause = cause;
77
- }
69
+ exports.InvalidApiError = InvalidApiError;
70
+ class InvalidCheckError extends RunAutomationError {
71
+ constructor(message, cause) {
72
+ super();
73
+ this.code = invalidCheckErrorCode;
74
+ this.statusCode = 400;
75
+ this.message = message;
76
+ this.cause = cause;
77
+ }
78
78
  }
79
- export class AbortedError extends RunAutomationError {
80
- constructor() {
81
- super();
82
- this.code = abortedErrorCode;
83
- this.statusCode = 200;
84
- this.message = "Operation was aborted";
85
- }
79
+ exports.InvalidCheckError = InvalidCheckError;
80
+ class AbortedError extends RunAutomationError {
81
+ constructor() {
82
+ super();
83
+ this.code = abortedErrorCode;
84
+ this.statusCode = 200;
85
+ this.message = "Operation was aborted";
86
+ }
86
87
  }
87
- export class AuthRequiredError extends RunAutomationError {
88
- constructor() {
89
- super();
90
- this.code = authRequiredErrorCode;
91
- this.statusCode = 401;
92
- this.message = "Authentication is required";
93
- }
88
+ exports.AbortedError = AbortedError;
89
+ class AuthRequiredError extends RunAutomationError {
90
+ constructor() {
91
+ super();
92
+ this.code = authRequiredErrorCode;
93
+ this.statusCode = 401;
94
+ this.message = "Authentication is required";
95
+ }
94
96
  }
95
- export class AuthCheckNotFoundError extends RunAutomationError {
96
- constructor() {
97
- super();
98
- this.code = authCheckNotFoundErrorCode;
99
- this.statusCode = 404;
100
- this.message = "Auth check not found";
101
- }
97
+ exports.AuthRequiredError = AuthRequiredError;
98
+ class AuthCheckNotFoundError extends RunAutomationError {
99
+ constructor() {
100
+ super();
101
+ this.code = authCheckNotFoundErrorCode;
102
+ this.statusCode = 404;
103
+ this.message = "Auth check not found";
104
+ }
102
105
  }
103
- export class AuthCheckFailedError extends RunAutomationError {
104
- constructor() {
105
- super();
106
- this.code = authCheckFailedErrorCode;
107
- this.statusCode = 401;
108
- this.message = "auth session check failed";
109
- }
110
- get apiResponse() {
111
- return {
112
- status: 200,
113
- body: {
114
- status: this.statusCode,
115
- error: "AUTH_SESSION_CHECK_FAILED",
116
- message: this.message,
117
- },
118
- };
119
- }
106
+ exports.AuthCheckNotFoundError = AuthCheckNotFoundError;
107
+ class AuthCheckFailedError extends RunAutomationError {
108
+ constructor() {
109
+ super();
110
+ this.code = authCheckFailedErrorCode;
111
+ this.statusCode = 401;
112
+ this.message = "auth session check failed";
113
+ }
114
+ get apiResponse() {
115
+ return {
116
+ status: 200,
117
+ body: {
118
+ status: this.statusCode,
119
+ error: "AUTH_SESSION_CHECK_FAILED",
120
+ message: this.message
121
+ }
122
+ };
123
+ }
120
124
  }
121
- export class MaxLevelsExceededError extends RunAutomationError {
122
- constructor(levels) {
123
- super();
124
- this.code = maxLevelsExceededErrorCode;
125
- this.statusCode = 400;
126
- this.message = `Max levels exceeded. Only ${levels} levels are supported`;
127
- this.details = { levels };
128
- }
125
+ exports.AuthCheckFailedError = AuthCheckFailedError;
126
+ class MaxLevelsExceededError extends RunAutomationError {
127
+ constructor(levels) {
128
+ super();
129
+ this.code = maxLevelsExceededErrorCode;
130
+ this.statusCode = 400;
131
+ this.message = `Max levels exceeded. Only ${levels} levels are supported`;
132
+ this.details = {
133
+ levels
134
+ };
135
+ }
129
136
  }
130
- export class AutomationError extends RunAutomationError {
131
- constructor(error) {
132
- super();
133
- this.error = error;
134
- this.code = automationError;
135
- if (error instanceof playwright.errors.TimeoutError) {
136
- this.statusCode = 500;
137
- this.message = `[${error.name}] ${error.message}`;
138
- this.details = {
139
- name: error.name,
140
- message: error.message,
141
- };
142
- return;
143
- }
144
- if (error instanceof RunError) {
145
- this.wrapped = true;
146
- this.statusCode = error.options.status_code ?? 500;
147
- this.message = `[${error.options.error_code ?? error.name}] ${error.message}`;
148
- this.details = {
149
- name: error.name,
150
- statusCode: error.options.status_code,
151
- errorCode: error.options.error_code,
152
- message: error.message,
153
- options: error.options,
154
- };
155
- }
156
- this.statusCode = 500;
157
- this.message = `[${error?.name ?? error}] ${error?.message}`;
158
- this.details = {
159
- name: error?.name,
160
- message: error?.message,
161
- };
137
+ exports.MaxLevelsExceededError = MaxLevelsExceededError;
138
+ class AutomationError extends RunAutomationError {
139
+ constructor(error) {
140
+ super();
141
+ this.error = error;
142
+ this.code = automationError;
143
+ if (error instanceof playwright.errors.TimeoutError) {
144
+ this.statusCode = 500;
145
+ this.message = `[${error.name}] ${error.message}`;
146
+ this.details = {
147
+ name: error.name,
148
+ message: error.message
149
+ };
150
+ return;
151
+ }
152
+ if (error instanceof _runtime.RunError) {
153
+ this.wrapped = true;
154
+ this.statusCode = error.options.status_code ?? 500;
155
+ this.message = `[${error.options.error_code ?? error.name}] ${error.message}`;
156
+ this.details = {
157
+ name: error.name,
158
+ statusCode: error.options.status_code,
159
+ errorCode: error.options.error_code,
160
+ message: error.message,
161
+ options: error.options
162
+ };
162
163
  }
164
+ this.statusCode = 500;
165
+ this.message = `[${(error === null || error === void 0 ? void 0 : error.name) ?? error}] ${error === null || error === void 0 ? void 0 : error.message}`;
166
+ this.details = {
167
+ name: error === null || error === void 0 ? void 0 : error.name,
168
+ message: error === null || error === void 0 ? void 0 : error.message
169
+ };
170
+ }
163
171
  }
172
+ exports.AutomationError = AutomationError;