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

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 (100) hide show
  1. package/.babelrc +0 -1
  2. package/dist/commands/api/run.js +156 -83
  3. package/dist/commands/api/run.ts +105 -0
  4. package/dist/commands/auth-sessions/load.js +20 -20
  5. package/dist/commands/auth-sessions/load.ts +30 -0
  6. package/dist/commands/auth-sessions/run-check.js +45 -39
  7. package/dist/commands/auth-sessions/run-check.ts +51 -0
  8. package/dist/commands/auth-sessions/run-create.js +84 -74
  9. package/dist/commands/auth-sessions/run-create.ts +91 -0
  10. package/dist/commands/browser/save-state.js +12 -7
  11. package/dist/commands/browser/save-state.ts +14 -0
  12. package/dist/commands/browser/start-browser.js +7 -4
  13. package/dist/commands/browser/start-browser.ts +11 -0
  14. package/dist/commands/build.js +97 -61
  15. package/dist/commands/build.ts +78 -0
  16. package/dist/commands/common/browserUtils.js +42 -31
  17. package/dist/commands/common/browserUtils.ts +45 -0
  18. package/dist/commands/common/getDefaultExportFromFile.js +11 -10
  19. package/dist/commands/common/getDefaultExportFromFile.ts +11 -0
  20. package/dist/commands/common/getFirstLineNumber.js +90 -83
  21. package/dist/commands/common/{getFirstLineNumber.test.js → getFirstLineNumber.test.ts} +2 -2
  22. package/dist/commands/common/getFirstLineNumber.ts +96 -0
  23. package/dist/commands/common/sendMessageToClient.js +4 -2
  24. package/dist/commands/common/sendMessageToClient.ts +3 -0
  25. package/dist/commands/common/utils/fileUtils.js +16 -16
  26. package/dist/commands/common/utils/fileUtils.ts +23 -0
  27. package/dist/commands/common/utils/settings.js +17 -19
  28. package/dist/commands/common/utils/settings.ts +22 -0
  29. package/dist/commands/common/utils/unixSocket.js +43 -36
  30. package/dist/commands/common/utils/unixSocket.ts +38 -0
  31. package/dist/commands/common/utils/webTemplate.js +25 -18
  32. package/dist/commands/common/utils/webTemplate.ts +22 -0
  33. package/dist/commands/interface/run.js +139 -133
  34. package/dist/commands/interface/run.ts +156 -0
  35. package/dist/commands/ts-check.js +45 -41
  36. package/dist/commands/ts-check.ts +50 -0
  37. package/dist/common/Logger/Logger/index.d.ts +1 -1
  38. package/dist/common/Logger/Logger/index.js +40 -46
  39. package/dist/common/Logger/Logger/index.ts +53 -0
  40. package/dist/common/Logger/Logger/types.js +1 -1
  41. package/dist/common/Logger/index.d.ts +1 -1
  42. package/dist/common/Logger/index.js +40 -46
  43. package/dist/common/Logger/index.ts +53 -0
  44. package/dist/common/Logger/types.js +1 -1
  45. package/dist/common/asyncLocalStorage/index.js +4 -4
  46. package/dist/common/asyncLocalStorage/index.ts +9 -0
  47. package/dist/common/cleanEnvironmentVariables.js +11 -9
  48. package/dist/common/cleanEnvironmentVariables.ts +10 -0
  49. package/dist/common/constants.js +1 -1
  50. package/dist/common/constants.ts +1 -0
  51. package/dist/common/contextStorageStateHelpers.js +36 -38
  52. package/dist/common/contextStorageStateHelpers.ts +43 -0
  53. package/dist/common/getPlaywrightConstructs.d.ts +1 -1
  54. package/dist/common/getPlaywrightConstructs.js +187 -157
  55. package/dist/common/getPlaywrightConstructs.ts +181 -0
  56. package/dist/common/jwtTokenManager.js +74 -61
  57. package/dist/common/jwtTokenManager.ts +71 -0
  58. package/dist/common/runApi/errors.d.ts +1 -1
  59. package/dist/common/runApi/errors.js +130 -121
  60. package/dist/common/runApi/errors.ts +154 -0
  61. package/dist/common/runApi/index.d.ts +4 -4
  62. package/dist/common/runApi/index.js +219 -233
  63. package/dist/common/runApi/index.ts +253 -0
  64. package/dist/common/runApi/types.d.ts +1 -1
  65. package/dist/common/runApi/types.js +55 -41
  66. package/dist/common/runApi/types.ts +43 -0
  67. package/dist/common/settingsSchema.js +9 -6
  68. package/dist/common/settingsSchema.ts +9 -0
  69. package/dist/common/telemetry.js +27 -16
  70. package/dist/common/telemetry.ts +23 -0
  71. package/dist/index.d.ts +4 -4
  72. package/dist/index.js +4 -4
  73. package/dist/index.ts +4 -0
  74. package/dist/runtime/RunError.d.ts +1 -1
  75. package/dist/runtime/RunError.js +10 -10
  76. package/dist/runtime/RunError.ts +12 -0
  77. package/dist/runtime/downloadDirectory.js +10 -10
  78. package/dist/runtime/downloadDirectory.ts +13 -0
  79. package/dist/runtime/enums.d.ts +1 -11
  80. package/dist/runtime/enums.js +12 -12
  81. package/dist/runtime/enums.ts +12 -0
  82. package/dist/runtime/{executionHelpers.test.js → executionHelpers.test.ts} +2 -2
  83. package/dist/runtime/export.d.ts +1 -202
  84. package/dist/runtime/extendPayload.d.ts +1 -1
  85. package/dist/runtime/extendPayload.js +13 -13
  86. package/dist/runtime/extendPayload.ts +15 -0
  87. package/dist/runtime/extendTimeout.js +19 -20
  88. package/dist/runtime/extendTimeout.ts +24 -0
  89. package/dist/runtime/index.d.ts +7 -7
  90. package/dist/runtime/index.js +6 -6
  91. package/dist/runtime/index.ts +6 -0
  92. package/dist/runtime/requestMoreInfo.js +14 -14
  93. package/dist/runtime/requestMoreInfo.ts +18 -0
  94. package/dist/runtime/runInfo.d.ts +1 -1
  95. package/dist/runtime/runInfo.js +12 -13
  96. package/dist/runtime/runInfo.ts +15 -0
  97. package/package.json +3 -2
  98. package/tsconfig.json +1 -1
  99. /package/dist/{runtime/enums.d.js → common/Logger/Logger/types.ts} +0 -0
  100. /package/dist/{runtime/export.d.js → common/Logger/types.ts} +0 -0
@@ -3,48 +3,52 @@ import * as ts from "typescript";
3
3
  import { program } from "commander";
4
4
  import * as fs from "fs-extra";
5
5
  import * as path from "path";
6
- import { moveWebTemplateFiles } from "./common/utils/webTemplate";
7
- program.description("Check TypeScript types in the project").allowUnknownOption().action(async () => {
8
- await moveWebTemplateFiles();
9
- const templateTsConfig = path.resolve(__dirname, "..", "..", "template.tsconfig.json");
10
- await fs.copy(templateTsConfig, "./intuned/WebTemplate/tsconfig.json");
11
- checkTypes();
6
+ import { moveWebTemplateFiles } from "./common/utils/webTemplate.js";
7
+ program
8
+ .description("Check TypeScript types in the project")
9
+ .allowUnknownOption()
10
+ .action(async () => {
11
+ await moveWebTemplateFiles();
12
+ const templateTsConfig = path.resolve(path.dirname(import.meta.url), "..", "..", "template.tsconfig.json");
13
+ await fs.copy(templateTsConfig, "./intuned/WebTemplate/tsconfig.json");
14
+ checkTypes();
12
15
  });
13
16
  function checkTypes() {
14
- const configPath = ts.findConfigFile("./intuned/WebTemplate", ts.sys.fileExists, "tsconfig.json");
15
- if (!configPath) {
16
- console.error("Could not find a valid 'tsconfig.json'.");
17
- process.exit(1);
18
- }
19
- const readConfigResult = ts.readConfigFile(configPath, ts.sys.readFile);
20
- const config = readConfigResult.config;
21
- const parseConfigHost = {
22
- useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
23
- readDirectory: ts.sys.readDirectory,
24
- fileExists: ts.sys.fileExists,
25
- readFile: ts.sys.readFile
26
- };
27
- const parsed = ts.parseJsonConfigFileContent(config, parseConfigHost, "./intuned");
28
- const program = ts.createProgram(parsed.fileNames, parsed.options);
29
- const emitResult = program.emit();
30
- const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
31
- allDiagnostics.forEach(diagnostic => {
32
- if (diagnostic.file) {
33
- const {
34
- line,
35
- character
36
- } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
37
- const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
38
- console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
39
- } else {
40
- console.log(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
17
+ const configPath = ts.findConfigFile("./intuned/WebTemplate", ts.sys.fileExists, "tsconfig.json");
18
+ if (!configPath) {
19
+ console.error("Could not find a valid 'tsconfig.json'.");
20
+ process.exit(1);
21
+ }
22
+ const readConfigResult = ts.readConfigFile(configPath, ts.sys.readFile);
23
+ const config = readConfigResult.config;
24
+ const parseConfigHost = {
25
+ useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
26
+ readDirectory: ts.sys.readDirectory,
27
+ fileExists: ts.sys.fileExists,
28
+ readFile: ts.sys.readFile,
29
+ };
30
+ const parsed = ts.parseJsonConfigFileContent(config, parseConfigHost, "./intuned");
31
+ const program = ts.createProgram(parsed.fileNames, parsed.options);
32
+ const emitResult = program.emit();
33
+ const allDiagnostics = ts
34
+ .getPreEmitDiagnostics(program)
35
+ .concat(emitResult.diagnostics);
36
+ allDiagnostics.forEach((diagnostic) => {
37
+ if (diagnostic.file) {
38
+ const { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
39
+ const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
40
+ console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
41
+ }
42
+ else {
43
+ console.log(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
44
+ }
45
+ });
46
+ if (allDiagnostics.length === 0) {
47
+ console.log("✨ TypeScript type checking passed without errors.");
48
+ }
49
+ else {
50
+ console.error("Errors found during TypeScript type checking.");
51
+ process.exit(1);
41
52
  }
42
- });
43
- if (allDiagnostics.length === 0) {
44
- console.log("✨ TypeScript type checking passed without errors.");
45
- } else {
46
- console.error("Errors found during TypeScript type checking.");
47
- process.exit(1);
48
- }
49
53
  }
50
- program.parse(process.argv);
54
+ program.parse(process.argv);
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ import * as ts from "typescript";
3
+ import { program } from "commander";
4
+ import * as fs from "fs-extra";
5
+ import * as path from "path";
6
+ import { moveWebTemplateFiles } from "./common/utils/webTemplate.js";
7
+ program.description("Check TypeScript types in the project").allowUnknownOption().action(async () => {
8
+ await moveWebTemplateFiles();
9
+ const templateTsConfig = path.resolve(path.dirname(import.meta.url), "..", "..", "template.tsconfig.json");
10
+ await fs.copy(templateTsConfig, "./intuned/WebTemplate/tsconfig.json");
11
+ checkTypes();
12
+ });
13
+ function checkTypes() {
14
+ const configPath = ts.findConfigFile("./intuned/WebTemplate", ts.sys.fileExists, "tsconfig.json");
15
+ if (!configPath) {
16
+ console.error("Could not find a valid 'tsconfig.json'.");
17
+ process.exit(1);
18
+ }
19
+ const readConfigResult = ts.readConfigFile(configPath, ts.sys.readFile);
20
+ const config = readConfigResult.config;
21
+ const parseConfigHost = {
22
+ useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
23
+ readDirectory: ts.sys.readDirectory,
24
+ fileExists: ts.sys.fileExists,
25
+ readFile: ts.sys.readFile
26
+ };
27
+ const parsed = ts.parseJsonConfigFileContent(config, parseConfigHost, "./intuned");
28
+ const program = ts.createProgram(parsed.fileNames, parsed.options);
29
+ const emitResult = program.emit();
30
+ const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
31
+ allDiagnostics.forEach(diagnostic => {
32
+ if (diagnostic.file) {
33
+ const {
34
+ line,
35
+ character
36
+ } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
37
+ const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
38
+ console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
39
+ } else {
40
+ console.log(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
41
+ }
42
+ });
43
+ if (allDiagnostics.length === 0) {
44
+ console.log("✨ TypeScript type checking passed without errors.");
45
+ } else {
46
+ console.error("Errors found during TypeScript type checking.");
47
+ process.exit(1);
48
+ }
49
+ }
50
+ program.parse(process.argv);
@@ -1,4 +1,4 @@
1
- import { LogEntry, LogMetadata } from "./types";
1
+ import { LogEntry, LogMetadata } from "./types.js";
2
2
  declare class Logger {
3
3
  logFunction(entry: LogEntry): void;
4
4
  private log;
@@ -1,53 +1,47 @@
1
1
  import { formatWithOptions } from "node:util";
2
2
  import chalk from "chalk";
3
- const format = formatWithOptions.bind(undefined, {
4
- colors: true
5
- });
3
+ const format = formatWithOptions.bind(undefined, { colors: true });
6
4
  const LOG_LEVEL_COLORS = {
7
- TRACE: chalk.gray,
8
- DEBUG: chalk.blue,
9
- INFO: chalk.green,
10
- WARN: chalk.yellow,
11
- ERROR: chalk.red
5
+ TRACE: chalk.gray,
6
+ DEBUG: chalk.blue,
7
+ INFO: chalk.green,
8
+ WARN: chalk.yellow,
9
+ ERROR: chalk.red,
12
10
  };
13
11
  class Logger {
14
- logFunction(entry) {
15
- const {
16
- level,
17
- timestamp,
18
- message,
19
- meta
20
- } = entry;
21
- const date = new Date(timestamp);
22
- const levelColor = LOG_LEVEL_COLORS[level];
23
- if (meta === undefined) {
24
- process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message}\n`);
25
- } else {
26
- process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message} ${format(meta)}\n`);
12
+ logFunction(entry) {
13
+ const { level, timestamp, message, meta } = entry;
14
+ const date = new Date(timestamp);
15
+ const levelColor = LOG_LEVEL_COLORS[level];
16
+ if (meta === undefined) {
17
+ process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message}\n`);
18
+ }
19
+ else {
20
+ process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message} ${format(meta)}\n`);
21
+ }
22
+ }
23
+ log(level, message, meta) {
24
+ this.logFunction({
25
+ level,
26
+ message,
27
+ meta: meta && Object.keys(meta).length === 0 ? undefined : meta,
28
+ timestamp: Date.now(),
29
+ });
30
+ }
31
+ trace(message, meta) {
32
+ this.log("TRACE", message, meta);
33
+ }
34
+ debug(message, meta) {
35
+ this.log("DEBUG", message, meta);
36
+ }
37
+ info(message, meta) {
38
+ this.log("INFO", message, meta);
39
+ }
40
+ warn(message, meta) {
41
+ this.log("WARN", message, meta);
42
+ }
43
+ error(message, meta) {
44
+ this.log("ERROR", message, meta);
27
45
  }
28
- }
29
- log(level, message, meta) {
30
- this.logFunction({
31
- level,
32
- message,
33
- meta: meta && Object.keys(meta).length === 0 ? undefined : meta,
34
- timestamp: Date.now()
35
- });
36
- }
37
- trace(message, meta) {
38
- this.log("TRACE", message, meta);
39
- }
40
- debug(message, meta) {
41
- this.log("DEBUG", message, meta);
42
- }
43
- info(message, meta) {
44
- this.log("INFO", message, meta);
45
- }
46
- warn(message, meta) {
47
- this.log("WARN", message, meta);
48
- }
49
- error(message, meta) {
50
- this.log("ERROR", message, meta);
51
- }
52
46
  }
53
- export const logger = new Logger();
47
+ export const logger = new Logger();
@@ -0,0 +1,53 @@
1
+ import { formatWithOptions } from "node:util";
2
+ import chalk from "chalk";
3
+ const format = formatWithOptions.bind(undefined, {
4
+ colors: true
5
+ });
6
+ const LOG_LEVEL_COLORS = {
7
+ TRACE: chalk.gray,
8
+ DEBUG: chalk.blue,
9
+ INFO: chalk.green,
10
+ WARN: chalk.yellow,
11
+ ERROR: chalk.red
12
+ };
13
+ class Logger {
14
+ logFunction(entry) {
15
+ const {
16
+ level,
17
+ timestamp,
18
+ message,
19
+ meta
20
+ } = entry;
21
+ const date = new Date(timestamp);
22
+ const levelColor = LOG_LEVEL_COLORS[level];
23
+ if (meta === undefined) {
24
+ process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message}\n`);
25
+ } else {
26
+ process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message} ${format(meta)}\n`);
27
+ }
28
+ }
29
+ log(level, message, meta) {
30
+ this.logFunction({
31
+ level,
32
+ message,
33
+ meta: meta && Object.keys(meta).length === 0 ? undefined : meta,
34
+ timestamp: Date.now()
35
+ });
36
+ }
37
+ trace(message, meta) {
38
+ this.log("TRACE", message, meta);
39
+ }
40
+ debug(message, meta) {
41
+ this.log("DEBUG", message, meta);
42
+ }
43
+ info(message, meta) {
44
+ this.log("INFO", message, meta);
45
+ }
46
+ warn(message, meta) {
47
+ this.log("WARN", message, meta);
48
+ }
49
+ error(message, meta) {
50
+ this.log("ERROR", message, meta);
51
+ }
52
+ }
53
+ export const logger = new Logger();
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { LogEntry, LogMetadata } from "./types";
1
+ import { LogEntry, LogMetadata } from "./types.js";
2
2
  declare class Logger {
3
3
  logFunction(entry: LogEntry): void;
4
4
  private log;
@@ -1,53 +1,47 @@
1
1
  import { formatWithOptions } from "node:util";
2
2
  import chalk from "chalk";
3
- const format = formatWithOptions.bind(undefined, {
4
- colors: true
5
- });
3
+ const format = formatWithOptions.bind(undefined, { colors: true });
6
4
  const LOG_LEVEL_COLORS = {
7
- TRACE: chalk.gray,
8
- DEBUG: chalk.blue,
9
- INFO: chalk.green,
10
- WARN: chalk.yellow,
11
- ERROR: chalk.red
5
+ TRACE: chalk.gray,
6
+ DEBUG: chalk.blue,
7
+ INFO: chalk.green,
8
+ WARN: chalk.yellow,
9
+ ERROR: chalk.red,
12
10
  };
13
11
  class Logger {
14
- logFunction(entry) {
15
- const {
16
- level,
17
- timestamp,
18
- message,
19
- meta
20
- } = entry;
21
- const date = new Date(timestamp);
22
- const levelColor = LOG_LEVEL_COLORS[level];
23
- if (meta === undefined) {
24
- process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message}\n`);
25
- } else {
26
- process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message} ${format(meta)}\n`);
12
+ logFunction(entry) {
13
+ const { level, timestamp, message, meta } = entry;
14
+ const date = new Date(timestamp);
15
+ const levelColor = LOG_LEVEL_COLORS[level];
16
+ if (meta === undefined) {
17
+ process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message}\n`);
18
+ }
19
+ else {
20
+ process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message} ${format(meta)}\n`);
21
+ }
22
+ }
23
+ log(level, message, meta) {
24
+ this.logFunction({
25
+ level,
26
+ message,
27
+ meta: meta && Object.keys(meta).length === 0 ? undefined : meta,
28
+ timestamp: Date.now(),
29
+ });
30
+ }
31
+ trace(message, meta) {
32
+ this.log("TRACE", message, meta);
33
+ }
34
+ debug(message, meta) {
35
+ this.log("DEBUG", message, meta);
36
+ }
37
+ info(message, meta) {
38
+ this.log("INFO", message, meta);
39
+ }
40
+ warn(message, meta) {
41
+ this.log("WARN", message, meta);
42
+ }
43
+ error(message, meta) {
44
+ this.log("ERROR", message, meta);
27
45
  }
28
- }
29
- log(level, message, meta) {
30
- this.logFunction({
31
- level,
32
- message,
33
- meta: meta && Object.keys(meta).length === 0 ? undefined : meta,
34
- timestamp: Date.now()
35
- });
36
- }
37
- trace(message, meta) {
38
- this.log("TRACE", message, meta);
39
- }
40
- debug(message, meta) {
41
- this.log("DEBUG", message, meta);
42
- }
43
- info(message, meta) {
44
- this.log("INFO", message, meta);
45
- }
46
- warn(message, meta) {
47
- this.log("WARN", message, meta);
48
- }
49
- error(message, meta) {
50
- this.log("ERROR", message, meta);
51
- }
52
46
  }
53
- export const logger = new Logger();
47
+ export const logger = new Logger();
@@ -0,0 +1,53 @@
1
+ import { formatWithOptions } from "node:util";
2
+ import chalk from "chalk";
3
+ const format = formatWithOptions.bind(undefined, {
4
+ colors: true
5
+ });
6
+ const LOG_LEVEL_COLORS = {
7
+ TRACE: chalk.gray,
8
+ DEBUG: chalk.blue,
9
+ INFO: chalk.green,
10
+ WARN: chalk.yellow,
11
+ ERROR: chalk.red
12
+ };
13
+ class Logger {
14
+ logFunction(entry) {
15
+ const {
16
+ level,
17
+ timestamp,
18
+ message,
19
+ meta
20
+ } = entry;
21
+ const date = new Date(timestamp);
22
+ const levelColor = LOG_LEVEL_COLORS[level];
23
+ if (meta === undefined) {
24
+ process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message}\n`);
25
+ } else {
26
+ process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message} ${format(meta)}\n`);
27
+ }
28
+ }
29
+ log(level, message, meta) {
30
+ this.logFunction({
31
+ level,
32
+ message,
33
+ meta: meta && Object.keys(meta).length === 0 ? undefined : meta,
34
+ timestamp: Date.now()
35
+ });
36
+ }
37
+ trace(message, meta) {
38
+ this.log("TRACE", message, meta);
39
+ }
40
+ debug(message, meta) {
41
+ this.log("DEBUG", message, meta);
42
+ }
43
+ info(message, meta) {
44
+ this.log("INFO", message, meta);
45
+ }
46
+ warn(message, meta) {
47
+ this.log("WARN", message, meta);
48
+ }
49
+ error(message, meta) {
50
+ this.log("ERROR", message, meta);
51
+ }
52
+ }
53
+ export const logger = new Logger();
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,9 +1,9 @@
1
1
  import { AsyncLocalStorage } from "async_hooks";
2
2
  export const asyncLocalStorage = new AsyncLocalStorage();
3
3
  export function runWithContext(contextData, callback, ...args) {
4
- return asyncLocalStorage.run(contextData, callback, ...args);
4
+ return asyncLocalStorage.run(contextData, callback, ...args);
5
5
  }
6
6
  export function getExecutionContext() {
7
- const contextData = asyncLocalStorage.getStore();
8
- return contextData;
9
- }
7
+ const contextData = asyncLocalStorage.getStore();
8
+ return contextData;
9
+ }
@@ -0,0 +1,9 @@
1
+ import { AsyncLocalStorage } from "async_hooks";
2
+ export const asyncLocalStorage = new AsyncLocalStorage();
3
+ export function runWithContext(contextData, callback, ...args) {
4
+ return asyncLocalStorage.run(contextData, callback, ...args);
5
+ }
6
+ export function getExecutionContext() {
7
+ const contextData = asyncLocalStorage.getStore();
8
+ return contextData;
9
+ }
@@ -1,10 +1,12 @@
1
1
  export function cleanEnvironmentVariables() {
2
- Object.keys(process.env).filter(i => {
3
- if (i.toLocaleLowerCase().startsWith("npm")) {
4
- return true;
5
- }
6
- if (i.toLocaleLowerCase().startsWith("fly") && i !== "FLY_ALLOC_ID") {
7
- return true;
8
- }
9
- }).forEach(i => delete process.env[i]);
10
- }
2
+ Object.keys(process.env)
3
+ .filter((i) => {
4
+ if (i.toLocaleLowerCase().startsWith("npm")) {
5
+ return true;
6
+ }
7
+ if (i.toLocaleLowerCase().startsWith("fly") && i !== "FLY_ALLOC_ID") {
8
+ return true;
9
+ }
10
+ })
11
+ .forEach((i) => delete process.env[i]);
12
+ }
@@ -0,0 +1,10 @@
1
+ export function cleanEnvironmentVariables() {
2
+ Object.keys(process.env).filter(i => {
3
+ if (i.toLocaleLowerCase().startsWith("npm")) {
4
+ return true;
5
+ }
6
+ if (i.toLocaleLowerCase().startsWith("fly") && i !== "FLY_ALLOC_ID") {
7
+ return true;
8
+ }
9
+ }).forEach(i => delete process.env[i]);
10
+ }
@@ -1 +1 @@
1
- export const AUTH_SESSIONS_FOLDER_NAME = "auth-sessions";
1
+ export const AUTH_SESSIONS_FOLDER_NAME = "auth-sessions";
@@ -0,0 +1 @@
1
+ export const AUTH_SESSIONS_FOLDER_NAME = "auth-sessions";
@@ -1,43 +1,41 @@
1
1
  function sessionStorageToArray(storage) {
2
- const result = [];
3
- for (const key in storage) {
4
- result.push({
5
- name: key,
6
- value: storage[key]
7
- });
8
- }
9
- return result;
2
+ const result = [];
3
+ for (const key in storage) {
4
+ result.push({ name: key, value: storage[key] });
5
+ }
6
+ return result;
10
7
  }
11
8
  export async function getContextStorageState(context) {
12
- const cookiesAndLocalStorage = await context.storageState();
13
- const pages = context.pages();
14
- const pagesSessions = [];
15
- for (const page of pages) {
16
- try {
17
- const [origin, session] = await page.evaluate(() => [location.origin, sessionStorage]);
18
- const transformed = sessionStorageToArray(session);
19
- pagesSessions.push({
20
- origin,
21
- sessionStorage: transformed
22
- });
23
- } catch (e) {}
24
- }
25
- return {
26
- ...cookiesAndLocalStorage,
27
- sessionStorage: pagesSessions
28
- };
9
+ const cookiesAndLocalStorage = await context.storageState();
10
+ const pages = context.pages();
11
+ const pagesSessions = [];
12
+ for (const page of pages) {
13
+ try {
14
+ const [origin, session] = await page.evaluate(() => [
15
+ location.origin,
16
+ sessionStorage,
17
+ ]);
18
+ const transformed = sessionStorageToArray(session);
19
+ pagesSessions.push({ origin, sessionStorage: transformed });
20
+ }
21
+ catch (e) {
22
+ // ignore
23
+ }
24
+ }
25
+ return {
26
+ ...cookiesAndLocalStorage,
27
+ sessionStorage: pagesSessions,
28
+ };
29
29
  }
30
30
  export async function setContextStorageState(context, storage) {
31
- await context.intunedSetStorageState(storage);
32
- const sessionStorage = storage.sessionStorage;
33
- await context.addInitScript(storage => {
34
- for (const {
35
- origin,
36
- sessionStorage
37
- } of storage) {
38
- if (window.location.origin === origin) {
39
- for (const item of sessionStorage) window.sessionStorage.setItem(item.name, item.value);
40
- }
41
- }
42
- }, sessionStorage);
43
- }
31
+ await context.intunedSetStorageState(storage);
32
+ const sessionStorage = storage.sessionStorage;
33
+ await context.addInitScript((storage) => {
34
+ for (const { origin, sessionStorage } of storage) {
35
+ if (window.location.origin === origin) {
36
+ for (const item of sessionStorage)
37
+ window.sessionStorage.setItem(item.name, item.value);
38
+ }
39
+ }
40
+ }, sessionStorage);
41
+ }
@@ -0,0 +1,43 @@
1
+ function sessionStorageToArray(storage) {
2
+ const result = [];
3
+ for (const key in storage) {
4
+ result.push({
5
+ name: key,
6
+ value: storage[key]
7
+ });
8
+ }
9
+ return result;
10
+ }
11
+ export async function getContextStorageState(context) {
12
+ const cookiesAndLocalStorage = await context.storageState();
13
+ const pages = context.pages();
14
+ const pagesSessions = [];
15
+ for (const page of pages) {
16
+ try {
17
+ const [origin, session] = await page.evaluate(() => [location.origin, sessionStorage]);
18
+ const transformed = sessionStorageToArray(session);
19
+ pagesSessions.push({
20
+ origin,
21
+ sessionStorage: transformed
22
+ });
23
+ } catch (e) {}
24
+ }
25
+ return {
26
+ ...cookiesAndLocalStorage,
27
+ sessionStorage: pagesSessions
28
+ };
29
+ }
30
+ export async function setContextStorageState(context, storage) {
31
+ await context.intunedSetStorageState(storage);
32
+ const sessionStorage = storage.sessionStorage;
33
+ await context.addInitScript(storage => {
34
+ for (const {
35
+ origin,
36
+ sessionStorage
37
+ } of storage) {
38
+ if (window.location.origin === origin) {
39
+ for (const item of sessionStorage) window.sessionStorage.setItem(item.name, item.value);
40
+ }
41
+ }
42
+ }, sessionStorage);
43
+ }
@@ -1,5 +1,5 @@
1
1
  import * as playwright from "@intuned/playwright-core";
2
- import type { RunApiSession } from "./runApi";
2
+ import type { RunApiSession } from "./runApi/index.js";
3
3
  interface Proxy {
4
4
  server: string;
5
5
  username: string;