@intuned/runtime-dev 0.1.0-test.1 → 0.1.0-test.11

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/.babelrc +3 -1
  2. package/Intuned.json +1 -1
  3. package/api/test2.ts +1 -4
  4. package/dist/commands/api/run.js +27 -35
  5. package/dist/commands/auth-sessions/load.js +11 -13
  6. package/dist/commands/auth-sessions/run-check.js +14 -19
  7. package/dist/commands/auth-sessions/run-create.js +23 -28
  8. package/dist/commands/browser/save-state.js +7 -10
  9. package/dist/commands/browser/start-browser.js +7 -10
  10. package/dist/commands/build.js +25 -30
  11. package/dist/commands/common/browserUtils.js +15 -28
  12. package/dist/commands/common/getDefaultExportFromFile.js +2 -10
  13. package/dist/commands/common/getFirstLineNumber.js +13 -20
  14. package/dist/commands/common/getFirstLineNumber.test.js +46 -51
  15. package/dist/commands/common/sendMessageToClient.js +2 -9
  16. package/dist/commands/common/utils/fileUtils.js +6 -16
  17. package/dist/commands/common/utils/settings.js +7 -13
  18. package/dist/commands/common/utils/unixSocket.js +2 -9
  19. package/dist/commands/common/utils/webTemplate.js +7 -16
  20. package/dist/commands/interface/run.js +34 -39
  21. package/dist/commands/ts-check.js +8 -12
  22. package/dist/common/Logger/Logger/index.js +9 -16
  23. package/dist/common/Logger/Logger/types.js +1 -5
  24. package/dist/common/Logger/index.js +9 -16
  25. package/dist/common/Logger/types.js +1 -5
  26. package/dist/common/asyncLocalStorage/index.js +4 -12
  27. package/dist/common/cleanEnvironmentVariables.js +1 -7
  28. package/dist/common/constants.js +1 -7
  29. package/dist/common/contextStorageStateHelpers.js +2 -9
  30. package/dist/common/getPlaywrightConstructs.js +28 -39
  31. package/dist/common/jwtTokenManager.js +8 -18
  32. package/dist/common/runApi/errors.js +24 -42
  33. package/dist/common/runApi/index.js +53 -88
  34. package/dist/common/runApi/types.js +31 -38
  35. package/dist/common/settingsSchema.js +2 -10
  36. package/dist/common/telemetry.js +3 -12
  37. package/dist/index.js +4 -69
  38. package/dist/runtime/RunError.js +1 -8
  39. package/dist/runtime/downloadDirectory.js +5 -11
  40. package/dist/runtime/enums.d.js +1 -5
  41. package/dist/runtime/enums.js +2 -8
  42. package/dist/runtime/executionHelpers.test.js +20 -22
  43. package/dist/runtime/export.d.js +1 -5
  44. package/dist/runtime/extendPayload.js +5 -11
  45. package/dist/runtime/extendTimeout.js +3 -9
  46. package/dist/runtime/index.js +6 -53
  47. package/dist/runtime/requestMoreInfo.js +2 -9
  48. package/dist/runtime/runInfo.js +5 -11
  49. package/package.json +3 -1
  50. package/preserve-dynamic-imports.js +16 -0
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ export {};
@@ -1,17 +1,9 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.asyncLocalStorage = void 0;
7
- exports.getExecutionContext = getExecutionContext;
8
- exports.runWithContext = runWithContext;
9
- var _async_hooks = require("async_hooks");
10
- const asyncLocalStorage = exports.asyncLocalStorage = new _async_hooks.AsyncLocalStorage();
11
- function runWithContext(contextData, callback, ...args) {
1
+ import { AsyncLocalStorage } from "async_hooks";
2
+ export const asyncLocalStorage = new AsyncLocalStorage();
3
+ export function runWithContext(contextData, callback, ...args) {
12
4
  return asyncLocalStorage.run(contextData, callback, ...args);
13
5
  }
14
- function getExecutionContext() {
6
+ export function getExecutionContext() {
15
7
  const contextData = asyncLocalStorage.getStore();
16
8
  return contextData;
17
9
  }
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.cleanEnvironmentVariables = cleanEnvironmentVariables;
7
- function cleanEnvironmentVariables() {
1
+ export function cleanEnvironmentVariables() {
8
2
  Object.keys(process.env).filter(i => {
9
3
  if (i.toLocaleLowerCase().startsWith("npm")) {
10
4
  return true;
@@ -1,7 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.AUTH_SESSIONS_FOLDER_NAME = void 0;
7
- const AUTH_SESSIONS_FOLDER_NAME = exports.AUTH_SESSIONS_FOLDER_NAME = "auth-sessions";
1
+ export const AUTH_SESSIONS_FOLDER_NAME = "auth-sessions";
@@ -1,10 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getContextStorageState = getContextStorageState;
7
- exports.setContextStorageState = setContextStorageState;
8
1
  function sessionStorageToArray(storage) {
9
2
  const result = [];
10
3
  for (const key in storage) {
@@ -15,7 +8,7 @@ function sessionStorageToArray(storage) {
15
8
  }
16
9
  return result;
17
10
  }
18
- async function getContextStorageState(context) {
11
+ export async function getContextStorageState(context) {
19
12
  const cookiesAndLocalStorage = await context.storageState();
20
13
  const pages = context.pages();
21
14
  const pagesSessions = [];
@@ -34,7 +27,7 @@ async function getContextStorageState(context) {
34
27
  sessionStorage: pagesSessions
35
28
  };
36
29
  }
37
- async function setContextStorageState(context, storage) {
30
+ export async function setContextStorageState(context, storage) {
38
31
  await context.intunedSetStorageState(storage);
39
32
  const sessionStorage = storage.sessionStorage;
40
33
  await context.addInitScript(storage => {
@@ -1,28 +1,17 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getPlaywrightConstructsForMode = getPlaywrightConstructsForMode;
7
- exports.getProductionPlaywrightConstructs = getProductionPlaywrightConstructs;
8
- exports.getRemotePlaywrightContext = getRemotePlaywrightContext;
9
- exports.loadSessionToContext = loadSessionToContext;
10
- var playwright = _interopRequireWildcard(require("@intuned/playwright-core"));
11
- var _fsExtra = _interopRequireWildcard(require("fs-extra"));
12
- var fs = _fsExtra;
13
- var _contextStorageStateHelpers = require("./contextStorageStateHelpers");
14
- var _path = _interopRequireWildcard(require("path"));
15
- var _fileUtils = require("../commands/common/utils/fileUtils");
16
- var _waitOn = _interopRequireDefault(require("wait-on"));
17
- var _runtime = require("../runtime");
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
- 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); }
20
- 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; }
1
+ import * as playwright from "@intuned/playwright-core";
2
+ import { existsSync, mkdir, mkdtemp, rm, writeFile, readFile } from "fs-extra";
3
+ import { setContextStorageState } from "./contextStorageStateHelpers";
4
+ import { join } from "path";
5
+ import path from "path";
6
+ import * as fs from "fs-extra";
7
+ import { getFullPathInProject } from "../commands/common/utils/fileUtils";
8
+ import waitOn from "wait-on";
9
+ import { getDownloadDirectoryPath } from "../runtime";
21
10
  async function createUserDirWithPreferences() {
22
- const playwrightTempDir = await (0, _fsExtra.mkdtemp)("/tmp/pw-");
23
- const userDir = (0, _path.join)(playwrightTempDir, "userdir");
24
- const defaultDir = (0, _path.join)(userDir, "Default");
25
- await (0, _fsExtra.mkdir)(defaultDir, {
11
+ const playwrightTempDir = await mkdtemp("/tmp/pw-");
12
+ const userDir = join(playwrightTempDir, "userdir");
13
+ const defaultDir = join(userDir, "Default");
14
+ await mkdir(defaultDir, {
26
15
  recursive: true
27
16
  });
28
17
  const preferences = {
@@ -30,10 +19,10 @@ async function createUserDirWithPreferences() {
30
19
  always_open_pdf_externally: true
31
20
  }
32
21
  };
33
- await (0, _fsExtra.writeFile)((0, _path.join)(defaultDir, "Preferences"), JSON.stringify(preferences));
22
+ await writeFile(join(defaultDir, "Preferences"), JSON.stringify(preferences));
34
23
  return userDir;
35
24
  }
36
- async function getProductionPlaywrightConstructs({
25
+ export async function getProductionPlaywrightConstructs({
37
26
  proxy,
38
27
  headless = true,
39
28
  storageState,
@@ -45,7 +34,7 @@ async function getProductionPlaywrightConstructs({
45
34
  }
46
35
  const executablePath = playwright.chromium.executablePath();
47
36
  const chromium127Path = executablePath.replace("chromium-1117", "chromium-1124");
48
- const isChrome127There = (0, _fsExtra.existsSync)(chromium127Path);
37
+ const isChrome127There = existsSync(chromium127Path);
49
38
  const userAgent = `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${isChrome127There ? 127 : 125}.0.0.0 Safari/537.36`;
50
39
  const userDataDir = await createUserDirWithPreferences();
51
40
  const context = await playwright.chromium.launchPersistentContext(userDataDir, {
@@ -59,7 +48,7 @@ async function getProductionPlaywrightConstructs({
59
48
  });
60
49
  context.once("close", async () => {
61
50
  try {
62
- await (0, _fsExtra.rm)(userDataDir, {
51
+ await rm(userDataDir, {
63
52
  recursive: true,
64
53
  force: true,
65
54
  retryDelay: 1000,
@@ -75,13 +64,13 @@ async function getProductionPlaywrightConstructs({
75
64
  session: storageState
76
65
  });
77
66
  }
78
- const assetsFile = _path.default.join(__dirname, "./assets/browser_scripts.js");
67
+ const assetsFile = path.join(__dirname, "./assets/browser_scripts.js");
79
68
  await context.addInitScript({
80
69
  path: assetsFile
81
70
  });
82
71
  let page = context.pages().at(0);
83
72
  if (page) {
84
- const scriptString = await (0, _fsExtra.readFile)(assetsFile, "utf8");
73
+ const scriptString = await readFile(assetsFile, "utf8");
85
74
  await page.evaluate(scriptString);
86
75
  } else {
87
76
  page = await context.newPage();
@@ -92,7 +81,7 @@ async function getProductionPlaywrightConstructs({
92
81
  };
93
82
  }
94
83
  const getChromiumLaunchArgsToIgnore = () => ["--disable-field-trial-config", "--disable-background-networking", "--enable-features=NetworkService,NetworkServiceInProcess", "--disable-background-timer-throttling", "--disable-backgrounding-occluded-windows", "--disable-back-forward-cache", "--disable-breakpad", "--disable-client-side-phishing-detection", "--disable-component-extensions-with-background-pages", "--disable-component-update", "--no-default-browser-check", "--disable-default-apps", "--disable-dev-shm-usage", "--disable-extensions", "--disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,TranslateUI", "--allow-pre-commit-input", "--disable-hang-monitor", "--disable-ipc-flooding-protection", "--disable-prompt-on-repost", "--disable-renderer-backgrounding", "--force-color-profile=srgb", "--metrics-recording-only", "--no-first-run", "--enable-automation", "--password-store=basic", "--use-mock-keychain", "--no-service-autorun", "--export-tagged-pdf", "--enable-use-zoom-for-dsf=false"];
95
- async function getPlaywrightConstructsForMode(mode, cdpAddress, authSession) {
84
+ export async function getPlaywrightConstructsForMode(mode, cdpAddress, authSession) {
96
85
  if (mode == "playwright-standalone") {
97
86
  if (!cdpAddress) {
98
87
  throw new Error("cdpAddress is required");
@@ -103,7 +92,7 @@ async function getPlaywrightConstructsForMode(mode, cdpAddress, authSession) {
103
92
  if (!context) {
104
93
  throw new Error("no context found");
105
94
  }
106
- const assetsFile = _path.default.join(__dirname, "./assets/browser_scripts.js");
95
+ const assetsFile = path.join(__dirname, "./assets/browser_scripts.js");
107
96
  await context.addInitScript({
108
97
  path: assetsFile
109
98
  });
@@ -127,7 +116,7 @@ async function getPlaywrightConstructsForMode(mode, cdpAddress, authSession) {
127
116
  context
128
117
  };
129
118
  }
130
- const downloadsPath = (0, _runtime.getDownloadDirectoryPath)();
119
+ const downloadsPath = getDownloadDirectoryPath();
131
120
  if (mode === "playwright" || mode === "playwright-headless") {
132
121
  const productionConstructs = await getProductionPlaywrightConstructs({
133
122
  headless: mode === "playwright-headless",
@@ -145,7 +134,7 @@ async function getPlaywrightConstructsForMode(mode, cdpAddress, authSession) {
145
134
  }
146
135
  throw "invalid mode";
147
136
  }
148
- async function loadSessionToContext({
137
+ export async function loadSessionToContext({
149
138
  context,
150
139
  session
151
140
  }) {
@@ -153,20 +142,20 @@ async function loadSessionToContext({
153
142
  if (session.type === "state") {
154
143
  sessionToLoad = session.state;
155
144
  } else {
156
- const fullPath = (0, _fileUtils.getFullPathInProject)(session.path);
145
+ const fullPath = getFullPathInProject(session.path);
157
146
  sessionToLoad = await fs.readJson(fullPath);
158
147
  }
159
- await (0, _contextStorageStateHelpers.setContextStorageState)(context, sessionToLoad);
148
+ await setContextStorageState(context, sessionToLoad);
160
149
  }
161
- async function getRemotePlaywrightContext(cdpAddress) {
162
- const playwright = await Promise.resolve().then(() => _interopRequireWildcard(require("@intuned/playwright-core")));
150
+ export async function getRemotePlaywrightContext(cdpAddress) {
151
+ const playwright = await import("@intuned/playwright-core");
163
152
  let browser = null;
164
153
  if (!cdpAddress) {
165
154
  throw new Error("cdpAddress is required");
166
155
  }
167
156
  const cdpAddressWithoutProtocol = cdpAddress.replace("http://", "").replace("https://", "").replace("localhost", "127.0.0.1");
168
157
  try {
169
- await (0, _waitOn.default)({
158
+ await waitOn({
170
159
  resources: [`http-get://${cdpAddressWithoutProtocol}/json/version`],
171
160
  delay: 100,
172
161
  interval: 100,
@@ -1,16 +1,6 @@
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 }; }
1
+ import fetch from "cross-fetch";
2
+ import * as jwt from "jsonwebtoken";
3
+ import { err, ResultAsync } from "neverthrow";
14
4
  class JwtTokenManager {
15
5
  constructor(refreshTokenPath) {
16
6
  this.refreshTokenPath = refreshTokenPath;
@@ -57,9 +47,9 @@ class JwtTokenManager {
57
47
  method: "GET"
58
48
  });
59
49
  if (res.status === 401) {
60
- return (0, _neverthrow.err)("Unauthorized");
50
+ return err("Unauthorized");
61
51
  }
62
- const jsonResult = await _neverthrow.ResultAsync.fromPromise(res.json(), () => "not json");
52
+ const jsonResult = await ResultAsync.fromPromise(res.json(), () => "not json");
63
53
  if (jsonResult.isErr()) return;
64
54
  const newToken = jsonResult.value.token;
65
55
  if (newToken) this._token = newToken;
@@ -67,15 +57,15 @@ class JwtTokenManager {
67
57
  fetchWithToken(...[input, init]) {
68
58
  const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
69
59
  headers.set("Authorization", `Bearer ${this.token}`);
70
- return (0, _crossFetch.default)(input, {
60
+ return fetch(input, {
71
61
  ...init,
72
62
  headers
73
63
  });
74
64
  }
75
65
  }
76
66
  const backendFunctionsPath = `${process.env.FUNCTIONS_DOMAIN}/api/${process.env.INTUNED_WORKSPACE_ID}/functions/${process.env.INTUNED_INTEGRATION_ID}`;
77
- const backendFunctionsTokenManager = exports.backendFunctionsTokenManager = new JwtTokenManager(`${backendFunctionsPath}/refreshBackendFunctionsToken`);
67
+ export const backendFunctionsTokenManager = new JwtTokenManager(`${backendFunctionsPath}/refreshBackendFunctionsToken`);
78
68
  backendFunctionsTokenManager.token = process.env.INTUNED_AUTHORING_SESSION_BACKEND_FUNCTIONS_TOKEN;
79
- function callBackendFunctionWithToken(path, init) {
69
+ export function callBackendFunctionWithToken(path, init) {
80
70
  return backendFunctionsTokenManager.fetchWithToken(`${backendFunctionsPath}/${path}`, init);
81
71
  }
@@ -1,24 +1,16 @@
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 {
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 = [apiNotFoundErrorCode, invalidApiErrorCode, invalidCheckErrorCode, abortedErrorCode, authRequiredErrorCode, authCheckNotFoundErrorCode, authCheckFailedErrorCode, maxLevelsExceededErrorCode, automationError];
13
+ export class RunAutomationError {
22
14
  wrapped = false;
23
15
  get apiResponse() {
24
16
  if (this.wrapped) {
@@ -48,8 +40,7 @@ class RunAutomationError {
48
40
  };
49
41
  }
50
42
  }
51
- exports.RunAutomationError = RunAutomationError;
52
- class ApiNotFoundError extends RunAutomationError {
43
+ export class ApiNotFoundError extends RunAutomationError {
53
44
  constructor(apiName) {
54
45
  super();
55
46
  this.code = apiNotFoundErrorCode;
@@ -57,8 +48,7 @@ class ApiNotFoundError extends RunAutomationError {
57
48
  this.message = `API ${apiName} not found`;
58
49
  }
59
50
  }
60
- exports.ApiNotFoundError = ApiNotFoundError;
61
- class InvalidApiError extends RunAutomationError {
51
+ export class InvalidApiError extends RunAutomationError {
62
52
  constructor(message) {
63
53
  super();
64
54
  this.code = invalidApiErrorCode;
@@ -66,8 +56,7 @@ class InvalidApiError extends RunAutomationError {
66
56
  this.message = `API is invalid: ${message}`;
67
57
  }
68
58
  }
69
- exports.InvalidApiError = InvalidApiError;
70
- class InvalidCheckError extends RunAutomationError {
59
+ export class InvalidCheckError extends RunAutomationError {
71
60
  constructor(message, cause) {
72
61
  super();
73
62
  this.code = invalidCheckErrorCode;
@@ -76,8 +65,7 @@ class InvalidCheckError extends RunAutomationError {
76
65
  this.cause = cause;
77
66
  }
78
67
  }
79
- exports.InvalidCheckError = InvalidCheckError;
80
- class AbortedError extends RunAutomationError {
68
+ export class AbortedError extends RunAutomationError {
81
69
  constructor() {
82
70
  super();
83
71
  this.code = abortedErrorCode;
@@ -85,8 +73,7 @@ class AbortedError extends RunAutomationError {
85
73
  this.message = "Operation was aborted";
86
74
  }
87
75
  }
88
- exports.AbortedError = AbortedError;
89
- class AuthRequiredError extends RunAutomationError {
76
+ export class AuthRequiredError extends RunAutomationError {
90
77
  constructor() {
91
78
  super();
92
79
  this.code = authRequiredErrorCode;
@@ -94,8 +81,7 @@ class AuthRequiredError extends RunAutomationError {
94
81
  this.message = "Authentication is required";
95
82
  }
96
83
  }
97
- exports.AuthRequiredError = AuthRequiredError;
98
- class AuthCheckNotFoundError extends RunAutomationError {
84
+ export class AuthCheckNotFoundError extends RunAutomationError {
99
85
  constructor() {
100
86
  super();
101
87
  this.code = authCheckNotFoundErrorCode;
@@ -103,8 +89,7 @@ class AuthCheckNotFoundError extends RunAutomationError {
103
89
  this.message = "Auth check not found";
104
90
  }
105
91
  }
106
- exports.AuthCheckNotFoundError = AuthCheckNotFoundError;
107
- class AuthCheckFailedError extends RunAutomationError {
92
+ export class AuthCheckFailedError extends RunAutomationError {
108
93
  constructor() {
109
94
  super();
110
95
  this.code = authCheckFailedErrorCode;
@@ -122,8 +107,7 @@ class AuthCheckFailedError extends RunAutomationError {
122
107
  };
123
108
  }
124
109
  }
125
- exports.AuthCheckFailedError = AuthCheckFailedError;
126
- class MaxLevelsExceededError extends RunAutomationError {
110
+ export class MaxLevelsExceededError extends RunAutomationError {
127
111
  constructor(levels) {
128
112
  super();
129
113
  this.code = maxLevelsExceededErrorCode;
@@ -134,8 +118,7 @@ class MaxLevelsExceededError extends RunAutomationError {
134
118
  };
135
119
  }
136
120
  }
137
- exports.MaxLevelsExceededError = MaxLevelsExceededError;
138
- class AutomationError extends RunAutomationError {
121
+ export class AutomationError extends RunAutomationError {
139
122
  constructor(error) {
140
123
  super();
141
124
  this.error = error;
@@ -149,7 +132,7 @@ class AutomationError extends RunAutomationError {
149
132
  };
150
133
  return;
151
134
  }
152
- if (error instanceof _runtime.RunError) {
135
+ if (error instanceof RunError) {
153
136
  this.wrapped = true;
154
137
  this.statusCode = error.options.status_code ?? 500;
155
138
  this.message = `[${error.options.error_code ?? error.name}] ${error.message}`;
@@ -168,5 +151,4 @@ class AutomationError extends RunAutomationError {
168
151
  message: error === null || error === void 0 ? void 0 : error.message
169
152
  };
170
153
  }
171
- }
172
- exports.AutomationError = AutomationError;
154
+ }