@intuned/runtime-dev 0.0.1-split.0
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.
- package/.babelrc +21 -0
- package/.eslintignore +10 -0
- package/.eslintrc.js +39 -0
- package/.vite/deps_temp_01af7156/package.json +3 -0
- package/.vscode/extensions.json +3 -0
- package/.vscode/launch.json +102 -0
- package/.vscode/settings.json +12 -0
- package/WebTemplate/accessKeyHelpers.ts +28 -0
- package/WebTemplate/api.ts +139 -0
- package/WebTemplate/app.ts +18 -0
- package/WebTemplate/controllers/async.ts +138 -0
- package/WebTemplate/controllers/authSessions/check.ts +68 -0
- package/WebTemplate/controllers/authSessions/create.ts +128 -0
- package/WebTemplate/controllers/authSessions/index.ts +41 -0
- package/WebTemplate/controllers/authSessions/killOperation.ts +35 -0
- package/WebTemplate/controllers/authSessions/resumeOperation.ts +80 -0
- package/WebTemplate/controllers/authSessions/store.ts +14 -0
- package/WebTemplate/controllers/controllers.ts +73 -0
- package/WebTemplate/controllers/runApi/helpers.ts +220 -0
- package/WebTemplate/controllers/runApi/index.ts +68 -0
- package/WebTemplate/controllers/runApi/types.ts +13 -0
- package/WebTemplate/controllers/traces.ts +151 -0
- package/WebTemplate/features.ts +8 -0
- package/WebTemplate/headers.ts +6 -0
- package/WebTemplate/index.playwright.ts +47 -0
- package/WebTemplate/index.vanilla.ts +44 -0
- package/WebTemplate/jobs.ts +356 -0
- package/WebTemplate/shutdown.ts +64 -0
- package/WebTemplate/utils.ts +294 -0
- package/bin/intuned-api-run +2 -0
- package/bin/intuned-auth-session-check +2 -0
- package/bin/intuned-auth-session-create +2 -0
- package/bin/intuned-auth-session-load +2 -0
- package/bin/intuned-auth-session-refresh +2 -0
- package/bin/intuned-browser-save-state +2 -0
- package/bin/intuned-browser-start +2 -0
- package/bin/intuned-build +2 -0
- package/bin/intuned-ts-check +2 -0
- package/package.json +133 -0
- package/playwright.config.ts +48 -0
- package/src/commands/api/run.ts +225 -0
- package/src/commands/auth-sessions/load.ts +42 -0
- package/src/commands/auth-sessions/run-check.ts +70 -0
- package/src/commands/auth-sessions/run-create.ts +124 -0
- package/src/commands/browser/save-state.ts +22 -0
- package/src/commands/browser/start-browser.ts +17 -0
- package/src/commands/build.ts +125 -0
- package/src/commands/common/browserUtils.ts +80 -0
- package/src/commands/common/getDefaultExportFromFile.ts +13 -0
- package/src/commands/common/getFirstLineNumber.test.ts +274 -0
- package/src/commands/common/getFirstLineNumber.ts +146 -0
- package/src/commands/common/sendMessageToClient.ts +8 -0
- package/src/commands/common/utils/fileUtils.ts +25 -0
- package/src/commands/common/utils/settings.ts +23 -0
- package/src/commands/common/utils/webTemplate.ts +46 -0
- package/src/commands/testing/saveVisibleHtml.ts +29 -0
- package/src/commands/ts-check.ts +88 -0
- package/src/common/Logger/Logger/index.ts +64 -0
- package/src/common/Logger/Logger/types.ts +9 -0
- package/src/common/Logger/index.ts +64 -0
- package/src/common/Logger/types.ts +9 -0
- package/src/common/assets/browser_scripts.js +2214 -0
- package/src/common/asyncLocalStorage/index.ts +29 -0
- package/src/common/cleanEnvironmentVariables.ts +13 -0
- package/src/common/constants.ts +1 -0
- package/src/common/contextStorageStateHelpers.ts +71 -0
- package/src/common/getPlaywrightConstructs.ts +283 -0
- package/src/common/jwtTokenManager.ts +111 -0
- package/src/common/settingsSchema.ts +16 -0
- package/src/common/telemetry.ts +49 -0
- package/src/index.ts +14 -0
- package/src/runtime/RunError.ts +16 -0
- package/src/runtime/downloadDirectory.ts +14 -0
- package/src/runtime/enums.d.ts +11 -0
- package/src/runtime/enums.ts +11 -0
- package/src/runtime/executionHelpers.test.ts +70 -0
- package/src/runtime/export.d.ts +202 -0
- package/src/runtime/extendPayload.ts +22 -0
- package/src/runtime/extendTimeout.ts +32 -0
- package/src/runtime/index.ts +8 -0
- package/src/runtime/requestMoreInfo.ts +40 -0
- package/src/runtime/runInfo.ts +19 -0
- package/template.tsconfig.json +14 -0
- package/tsconfig.eslint.json +5 -0
- package/tsconfig.json +24 -0
- package/typedoc.json +49 -0
- package/vite.config.ts +17 -0
|
@@ -0,0 +1,88 @@
|
|
|
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";
|
|
7
|
+
|
|
8
|
+
program
|
|
9
|
+
.description("Check TypeScript types in the project")
|
|
10
|
+
.allowUnknownOption()
|
|
11
|
+
.action(async () => {
|
|
12
|
+
await moveWebTemplateFiles();
|
|
13
|
+
|
|
14
|
+
const templateTsConfig = path.resolve(
|
|
15
|
+
__dirname,
|
|
16
|
+
"..",
|
|
17
|
+
"..",
|
|
18
|
+
"template.tsconfig.json"
|
|
19
|
+
);
|
|
20
|
+
await fs.copy(templateTsConfig, "./intuned/WebTemplate/tsconfig.json");
|
|
21
|
+
|
|
22
|
+
checkTypes();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
function checkTypes() {
|
|
26
|
+
const configPath = ts.findConfigFile(
|
|
27
|
+
"./intuned/WebTemplate",
|
|
28
|
+
ts.sys.fileExists,
|
|
29
|
+
"tsconfig.json"
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
if (!configPath) {
|
|
33
|
+
console.error("Could not find a valid 'tsconfig.json'.");
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const readConfigResult = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
38
|
+
const config = readConfigResult.config;
|
|
39
|
+
|
|
40
|
+
const parseConfigHost = {
|
|
41
|
+
useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
|
|
42
|
+
readDirectory: ts.sys.readDirectory,
|
|
43
|
+
fileExists: ts.sys.fileExists,
|
|
44
|
+
readFile: ts.sys.readFile,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const parsed = ts.parseJsonConfigFileContent(
|
|
48
|
+
config,
|
|
49
|
+
parseConfigHost,
|
|
50
|
+
"./intuned"
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const program = ts.createProgram(parsed.fileNames, parsed.options);
|
|
54
|
+
const emitResult = program.emit();
|
|
55
|
+
|
|
56
|
+
const allDiagnostics = ts
|
|
57
|
+
.getPreEmitDiagnostics(program)
|
|
58
|
+
.concat(emitResult.diagnostics);
|
|
59
|
+
|
|
60
|
+
allDiagnostics.forEach((diagnostic) => {
|
|
61
|
+
if (diagnostic.file) {
|
|
62
|
+
const { line, character } = ts.getLineAndCharacterOfPosition(
|
|
63
|
+
diagnostic.file,
|
|
64
|
+
diagnostic.start!
|
|
65
|
+
);
|
|
66
|
+
const message = ts.flattenDiagnosticMessageText(
|
|
67
|
+
diagnostic.messageText,
|
|
68
|
+
"\n"
|
|
69
|
+
);
|
|
70
|
+
console.log(
|
|
71
|
+
`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`
|
|
72
|
+
);
|
|
73
|
+
} else {
|
|
74
|
+
console.log(
|
|
75
|
+
ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
if (allDiagnostics.length === 0) {
|
|
81
|
+
console.log("✨ TypeScript type checking passed without errors.");
|
|
82
|
+
} else {
|
|
83
|
+
console.error("Errors found during TypeScript type checking.");
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
program.parse(process.argv);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { formatWithOptions } from "node:util";
|
|
2
|
+
import { LogEntry, LogLevel, LogMetadata } from "./types";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
|
|
5
|
+
const format = formatWithOptions.bind(undefined, { colors: true });
|
|
6
|
+
|
|
7
|
+
const LOG_LEVEL_COLORS: Record<LogLevel, chalk.Chalk> = {
|
|
8
|
+
TRACE: chalk.gray,
|
|
9
|
+
DEBUG: chalk.blue,
|
|
10
|
+
INFO: chalk.green,
|
|
11
|
+
WARN: chalk.yellow,
|
|
12
|
+
ERROR: chalk.red,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
class Logger {
|
|
16
|
+
logFunction(entry: LogEntry): void {
|
|
17
|
+
const { level, timestamp, message, meta } = entry;
|
|
18
|
+
const date = new Date(timestamp);
|
|
19
|
+
const levelColor = LOG_LEVEL_COLORS[level];
|
|
20
|
+
|
|
21
|
+
if (meta === undefined) {
|
|
22
|
+
process.stderr.write(
|
|
23
|
+
`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message}\n`
|
|
24
|
+
);
|
|
25
|
+
} else {
|
|
26
|
+
process.stderr.write(
|
|
27
|
+
`${format(date)} [@intuned/sdk][${levelColor(
|
|
28
|
+
level
|
|
29
|
+
)}] ${message} ${format(meta)}\n`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private log(level: LogLevel, message: string, meta?: LogMetadata): void {
|
|
35
|
+
this.logFunction({
|
|
36
|
+
level,
|
|
37
|
+
message,
|
|
38
|
+
meta: meta && Object.keys(meta).length === 0 ? undefined : meta,
|
|
39
|
+
timestamp: Date.now(),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
trace(message: string, meta?: LogMetadata): void {
|
|
44
|
+
this.log("TRACE", message, meta);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
debug(message: string, meta?: LogMetadata): void {
|
|
48
|
+
this.log("DEBUG", message, meta);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
info(message: string, meta?: LogMetadata): void {
|
|
52
|
+
this.log("INFO", message, meta);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
warn(message: string, meta?: LogMetadata): void {
|
|
56
|
+
this.log("WARN", message, meta);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
error(message: string, meta?: LogMetadata): void {
|
|
60
|
+
this.log("ERROR", message, meta);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const logger = new Logger();
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { formatWithOptions } from "node:util";
|
|
2
|
+
import { LogEntry, LogLevel, LogMetadata } from "./types";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
|
|
5
|
+
const format = formatWithOptions.bind(undefined, { colors: true });
|
|
6
|
+
|
|
7
|
+
const LOG_LEVEL_COLORS: Record<LogLevel, chalk.Chalk> = {
|
|
8
|
+
TRACE: chalk.gray,
|
|
9
|
+
DEBUG: chalk.blue,
|
|
10
|
+
INFO: chalk.green,
|
|
11
|
+
WARN: chalk.yellow,
|
|
12
|
+
ERROR: chalk.red,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
class Logger {
|
|
16
|
+
logFunction(entry: LogEntry): void {
|
|
17
|
+
const { level, timestamp, message, meta } = entry;
|
|
18
|
+
const date = new Date(timestamp);
|
|
19
|
+
const levelColor = LOG_LEVEL_COLORS[level];
|
|
20
|
+
|
|
21
|
+
if (meta === undefined) {
|
|
22
|
+
process.stderr.write(
|
|
23
|
+
`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message}\n`
|
|
24
|
+
);
|
|
25
|
+
} else {
|
|
26
|
+
process.stderr.write(
|
|
27
|
+
`${format(date)} [@intuned/sdk][${levelColor(
|
|
28
|
+
level
|
|
29
|
+
)}] ${message} ${format(meta)}\n`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private log(level: LogLevel, message: string, meta?: LogMetadata): void {
|
|
35
|
+
this.logFunction({
|
|
36
|
+
level,
|
|
37
|
+
message,
|
|
38
|
+
meta: meta && Object.keys(meta).length === 0 ? undefined : meta,
|
|
39
|
+
timestamp: Date.now(),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
trace(message: string, meta?: LogMetadata): void {
|
|
44
|
+
this.log("TRACE", message, meta);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
debug(message: string, meta?: LogMetadata): void {
|
|
48
|
+
this.log("DEBUG", message, meta);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
info(message: string, meta?: LogMetadata): void {
|
|
52
|
+
this.log("INFO", message, meta);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
warn(message: string, meta?: LogMetadata): void {
|
|
56
|
+
this.log("WARN", message, meta);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
error(message: string, meta?: LogMetadata): void {
|
|
60
|
+
this.log("ERROR", message, meta);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const logger = new Logger();
|