@intuned/runtime-dev 0.0.1-testing.0 → 0.0.1
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/.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/controllers/authSessions/create.ts +1 -1
- package/WebTemplate/controllers/runApi/helpers.ts +3 -1
- package/package.json +3 -3
- 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/{dist/commands/common/getFirstLineNumber.test.js → src/commands/common/getFirstLineNumber.test.ts} +121 -75
- 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/{dist/common/Logger/types.d.ts → src/common/Logger/Logger/types.ts} +5 -4
- package/src/common/Logger/index.ts +64 -0
- package/{dist/common/Logger/Logger/types.d.ts → src/common/Logger/types.ts} +5 -4
- 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.ts +11 -0
- package/src/runtime/executionHelpers.test.ts +70 -0
- package/src/runtime/extendPayload.ts +22 -0
- package/src/runtime/extendTimeout.ts +32 -0
- package/{dist/runtime/index.d.ts → src/runtime/index.ts} +3 -1
- package/src/runtime/requestMoreInfo.ts +40 -0
- package/src/runtime/runInfo.ts +19 -0
- package/vite.config.ts +17 -0
- package/bin/intuned-api-run +0 -2
- package/bin/intuned-auth-session-check +0 -2
- package/bin/intuned-auth-session-create +0 -2
- package/bin/intuned-auth-session-load +0 -2
- package/bin/intuned-auth-session-refresh +0 -2
- package/bin/intuned-browser-save-state +0 -2
- package/bin/intuned-browser-start +0 -2
- package/bin/intuned-build +0 -2
- package/bin/intuned-ts-check +0 -2
- package/dist/commands/api/run.d.ts +0 -6
- package/dist/commands/api/run.js +0 -135
- package/dist/commands/auth-sessions/load.d.ts +0 -2
- package/dist/commands/auth-sessions/load.js +0 -26
- package/dist/commands/auth-sessions/run-check.d.ts +0 -2
- package/dist/commands/auth-sessions/run-check.js +0 -42
- package/dist/commands/auth-sessions/run-create.d.ts +0 -2
- package/dist/commands/auth-sessions/run-create.js +0 -75
- package/dist/commands/browser/save-state.d.ts +0 -2
- package/dist/commands/browser/save-state.js +0 -17
- package/dist/commands/browser/start-browser.d.ts +0 -2
- package/dist/commands/browser/start-browser.js +0 -14
- package/dist/commands/build.d.ts +0 -2
- package/dist/commands/build.js +0 -80
- package/dist/commands/common/browserUtils.d.ts +0 -14
- package/dist/commands/common/browserUtils.js +0 -58
- package/dist/commands/common/getDefaultExportFromFile.d.ts +0 -1
- package/dist/commands/common/getDefaultExportFromFile.js +0 -19
- package/dist/commands/common/getFirstLineNumber.d.ts +0 -9
- package/dist/commands/common/getFirstLineNumber.js +0 -103
- package/dist/commands/common/sendMessageToClient.d.ts +0 -1
- package/dist/commands/common/sendMessageToClient.js +0 -10
- package/dist/commands/common/utils/fileUtils.d.ts +0 -6
- package/dist/commands/common/utils/fileUtils.js +0 -33
- package/dist/commands/common/utils/settings.d.ts +0 -2
- package/dist/commands/common/utils/settings.js +0 -28
- package/dist/commands/common/utils/webTemplate.d.ts +0 -1
- package/dist/commands/common/utils/webTemplate.js +0 -31
- package/dist/commands/ts-check.d.ts +0 -2
- package/dist/commands/ts-check.js +0 -54
- package/dist/common/Logger/Logger/index.d.ts +0 -12
- package/dist/common/Logger/Logger/index.js +0 -60
- package/dist/common/Logger/Logger/types.js +0 -5
- package/dist/common/Logger/index.d.ts +0 -12
- package/dist/common/Logger/index.js +0 -60
- package/dist/common/Logger/types.js +0 -5
- package/dist/common/asyncLocalStorage/index.d.ts +0 -16
- package/dist/common/asyncLocalStorage/index.js +0 -17
- package/dist/common/cleanEnvironmentVariables.d.ts +0 -1
- package/dist/common/cleanEnvironmentVariables.js +0 -16
- package/dist/common/constants.d.ts +0 -1
- package/dist/common/constants.js +0 -7
- package/dist/common/contextStorageStateHelpers.d.ts +0 -15
- package/dist/common/contextStorageStateHelpers.js +0 -48
- package/dist/common/getPlaywrightConstructs.d.ts +0 -28
- package/dist/common/getPlaywrightConstructs.js +0 -175
- package/dist/common/jwtTokenManager.d.ts +0 -16
- package/dist/common/jwtTokenManager.js +0 -81
- package/dist/common/settingsSchema.d.ts +0 -19
- package/dist/common/settingsSchema.js +0 -17
- package/dist/common/telemetry.d.ts +0 -3
- package/dist/common/telemetry.js +0 -32
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -69
- package/dist/runtime/RunError.d.ts +0 -5
- package/dist/runtime/RunError.js +0 -19
- package/dist/runtime/downloadDirectory.d.ts +0 -1
- package/dist/runtime/downloadDirectory.js +0 -19
- package/dist/runtime/enums.d.js +0 -5
- package/dist/runtime/enums.js +0 -18
- package/dist/runtime/executionHelpers.test.js +0 -53
- package/dist/runtime/export.d.js +0 -5
- package/dist/runtime/extendPayload.d.ts +0 -2
- package/dist/runtime/extendPayload.js +0 -21
- package/dist/runtime/extendTimeout.d.ts +0 -1
- package/dist/runtime/extendTimeout.js +0 -26
- package/dist/runtime/index.js +0 -53
- package/dist/runtime/requestMoreInfo.d.ts +0 -17
- package/dist/runtime/requestMoreInfo.js +0 -25
- package/dist/runtime/runInfo.d.ts +0 -2
- package/dist/runtime/runInfo.js +0 -21
- /package/{dist → src}/common/assets/browser_scripts.js +0 -0
- /package/{dist → src}/runtime/enums.d.ts +0 -0
- /package/{dist → src}/runtime/export.d.ts +0 -0
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = getFirstLineNumber;
|
|
7
|
-
exports.findFirstExecutableLine = findFirstExecutableLine;
|
|
8
|
-
var _tsMorph = require("ts-morph");
|
|
9
|
-
var _sourceMap = require("source-map");
|
|
10
|
-
function compileTypeScript(apiFilePath) {
|
|
11
|
-
const compilerOptions = {
|
|
12
|
-
lib: ["dom", "es2020"],
|
|
13
|
-
sourceMap: true,
|
|
14
|
-
inlineSourceMap: true,
|
|
15
|
-
inlineSources: true,
|
|
16
|
-
declaration: false,
|
|
17
|
-
noEmit: false,
|
|
18
|
-
module: _tsMorph.ModuleKind.CommonJS,
|
|
19
|
-
target: _tsMorph.ScriptTarget.ES2020
|
|
20
|
-
};
|
|
21
|
-
const project = new _tsMorph.Project({
|
|
22
|
-
compilerOptions
|
|
23
|
-
});
|
|
24
|
-
const sourceFile = project.addSourceFileAtPath(apiFilePath);
|
|
25
|
-
const outputJS = project.emitToMemory({
|
|
26
|
-
targetSourceFile: sourceFile
|
|
27
|
-
});
|
|
28
|
-
const outputJSText = outputJS.getFiles()[0].text;
|
|
29
|
-
return {
|
|
30
|
-
sourceFile,
|
|
31
|
-
outputJSText
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function findFirstExecutableLine(sourceFile) {
|
|
35
|
-
var _defaultExportSymbol$;
|
|
36
|
-
let functionBody;
|
|
37
|
-
const defaultExportSymbol = sourceFile.getDefaultExportSymbol();
|
|
38
|
-
const defaultExportDeclaration = defaultExportSymbol === null || defaultExportSymbol === void 0 || (_defaultExportSymbol$ = defaultExportSymbol.getDeclarations()) === null || _defaultExportSymbol$ === void 0 ? void 0 : _defaultExportSymbol$[0];
|
|
39
|
-
if (defaultExportDeclaration) {
|
|
40
|
-
if (defaultExportDeclaration.getKind() === _tsMorph.ts.SyntaxKind.FunctionDeclaration) {
|
|
41
|
-
functionBody = defaultExportDeclaration.getBody();
|
|
42
|
-
} else {
|
|
43
|
-
const exportAssignments = sourceFile.getExportAssignments();
|
|
44
|
-
for (const exportAssignment of exportAssignments) {
|
|
45
|
-
const expression = exportAssignment.getExpression();
|
|
46
|
-
if (!expression) continue;
|
|
47
|
-
if (expression.getKind() === _tsMorph.ts.SyntaxKind.Identifier || expression.getKind() === _tsMorph.ts.SyntaxKind.FunctionExpression || expression.getKind() === _tsMorph.ts.SyntaxKind.ArrowFunction) {
|
|
48
|
-
var _sourceFile$getVariab;
|
|
49
|
-
const identifier = expression.getText();
|
|
50
|
-
const possiblyExportedFunction = sourceFile.getFunction(identifier) || ((_sourceFile$getVariab = sourceFile.getVariableStatement(identifier)) === null || _sourceFile$getVariab === void 0 ? void 0 : _sourceFile$getVariab.getDescendants().find(node => node.getKind() === _tsMorph.ts.SyntaxKind.FunctionExpression || node.getKind() === _tsMorph.ts.SyntaxKind.ArrowFunction));
|
|
51
|
-
if (possiblyExportedFunction) {
|
|
52
|
-
functionBody = possiblyExportedFunction.getBody();
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (_tsMorph.Node.hasBody(expression) && (expression.getKind() === _tsMorph.ts.SyntaxKind.FunctionExpression || expression.getKind() === _tsMorph.ts.SyntaxKind.ArrowFunction)) {
|
|
57
|
-
functionBody = expression.getBody();
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (!functionBody || !_tsMorph.Node.isStatemented(functionBody)) {
|
|
64
|
-
return -1;
|
|
65
|
-
}
|
|
66
|
-
if (functionBody.getStatements().length === 0) {
|
|
67
|
-
return -1;
|
|
68
|
-
}
|
|
69
|
-
const position = functionBody.getStatements()[0].getStart();
|
|
70
|
-
return sourceFile.getLineAndColumnAtPos(position);
|
|
71
|
-
}
|
|
72
|
-
async function getSourceMap(jsCode) {
|
|
73
|
-
const sourceMapBase64 = jsCode.substring(jsCode.lastIndexOf("//# sourceMappingURL=data:application/json;base64,") + "//# sourceMappingURL=data:application/json;base64,".length);
|
|
74
|
-
const sourceMapText = Buffer.from(sourceMapBase64, "base64").toString("utf-8");
|
|
75
|
-
const sourceMap = JSON.parse(sourceMapText);
|
|
76
|
-
return new _sourceMap.SourceMapConsumer(sourceMap);
|
|
77
|
-
}
|
|
78
|
-
async function mapFirstLineNumberBySourceMap(sourceFileName, jsCode, line, column) {
|
|
79
|
-
const sourceMap = await getSourceMap(jsCode);
|
|
80
|
-
const generatedLineNumber = sourceMap.generatedPositionFor({
|
|
81
|
-
source: sourceFileName,
|
|
82
|
-
line,
|
|
83
|
-
column
|
|
84
|
-
}).line;
|
|
85
|
-
if (!generatedLineNumber) return -1;
|
|
86
|
-
return generatedLineNumber;
|
|
87
|
-
}
|
|
88
|
-
async function getFirstLineNumber(apiFilePath) {
|
|
89
|
-
const sourceFileName = apiFilePath.split("/").pop() ?? apiFilePath;
|
|
90
|
-
const {
|
|
91
|
-
sourceFile,
|
|
92
|
-
outputJSText
|
|
93
|
-
} = compileTypeScript(apiFilePath);
|
|
94
|
-
const result = findFirstExecutableLine(sourceFile);
|
|
95
|
-
if (result === -1) return {
|
|
96
|
-
sourceFileName,
|
|
97
|
-
lineNumber: -1
|
|
98
|
-
};
|
|
99
|
-
return {
|
|
100
|
-
sourceFileName,
|
|
101
|
-
lineNumber: await mapFirstLineNumberBySourceMap(sourceFileName, outputJSText, result.line, result.column)
|
|
102
|
-
};
|
|
103
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const sendBreakPointOnToClient: (sourceFileName: string, lineNumber: number) => void;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.sendBreakPointOnToClient = void 0;
|
|
7
|
-
const sendBreakPointOnToClient = (sourceFileName, lineNumber) => {
|
|
8
|
-
console.log(`breakpoint on ${sourceFileName}:${lineNumber}`);
|
|
9
|
-
};
|
|
10
|
-
exports.sendBreakPointOnToClient = sendBreakPointOnToClient;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getFullPathInProject = getFullPathInProject;
|
|
7
|
-
exports.listProjectFilesAndFolders = listProjectFilesAndFolders;
|
|
8
|
-
var path = _interopRequireWildcard(require("path"));
|
|
9
|
-
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
10
|
-
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
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); }
|
|
13
|
-
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; }
|
|
14
|
-
_dotenv.default.config();
|
|
15
|
-
function getFullPathInProject(...paths) {
|
|
16
|
-
return path.resolve(process.cwd(), process.env.ROOT || "./", ...paths);
|
|
17
|
-
}
|
|
18
|
-
async function listProjectFilesAndFolders() {
|
|
19
|
-
const projectPath = path.resolve(process.cwd(), process.env.ROOT || "./");
|
|
20
|
-
try {
|
|
21
|
-
const files = await fs.readdir(projectPath, {
|
|
22
|
-
withFileTypes: true
|
|
23
|
-
});
|
|
24
|
-
return files.map(file => ({
|
|
25
|
-
type: file.isDirectory() ? "Folder" : "File",
|
|
26
|
-
fullPath: path.join(projectPath, file.name),
|
|
27
|
-
name: file.name
|
|
28
|
-
}));
|
|
29
|
-
} catch (err) {
|
|
30
|
-
console.error("Error reading the directory:", err);
|
|
31
|
-
throw err;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getSettings = getSettings;
|
|
7
|
-
var _fileUtils = require("./fileUtils");
|
|
8
|
-
var _settingsSchema = require("../../../common/settingsSchema");
|
|
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
|
-
async function getSettings() {
|
|
12
|
-
const settingsFilePath = (0, _fileUtils.getFullPathInProject)("Intuned.json");
|
|
13
|
-
console.log("loading settings");
|
|
14
|
-
const settings = await (specifier => new Promise(r => r(`${specifier}`)).then(s => _interopRequireWildcard(require(s))))(settingsFilePath);
|
|
15
|
-
if (settings.default) {
|
|
16
|
-
const parsed = _settingsSchema.settingsSchema.safeParse(settings.default);
|
|
17
|
-
if (parsed.success) {
|
|
18
|
-
return parsed.data;
|
|
19
|
-
} else {
|
|
20
|
-
throw new Error(parsed.error.message);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
authSessions: {
|
|
25
|
-
enabled: false
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const moveWebTemplateFiles: () => Promise<void>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.moveWebTemplateFiles = void 0;
|
|
7
|
-
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
8
|
-
var path = _interopRequireWildcard(require("path"));
|
|
9
|
-
var _fileUtils = require("./fileUtils");
|
|
10
|
-
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); }
|
|
11
|
-
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; }
|
|
12
|
-
const moveWebTemplateFiles = async () => {
|
|
13
|
-
await fs.remove("./intuned");
|
|
14
|
-
await fs.ensureDir("./intuned");
|
|
15
|
-
const currentFileLocation = path.resolve(__dirname, "..", "..", "..", "..", "WebTemplate");
|
|
16
|
-
await fs.copy(`${currentFileLocation}`, "./intuned/WebTemplate", {
|
|
17
|
-
filter: (src, dest) => {
|
|
18
|
-
if (src.includes(".d.ts")) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
const filesAndFolders = await (0, _fileUtils.listProjectFilesAndFolders)();
|
|
25
|
-
const pathsIgnoreList = [(0, _fileUtils.getFullPathInProject)("intuned"), (0, _fileUtils.getFullPathInProject)("node_modules"), (0, _fileUtils.getFullPathInProject)("package.json"), (0, _fileUtils.getFullPathInProject)("yarn.lock"), (0, _fileUtils.getFullPathInProject)(".env")];
|
|
26
|
-
const filesToCopy = filesAndFolders.filter(file => !pathsIgnoreList.includes(file.fullPath));
|
|
27
|
-
for (const file of filesToCopy) {
|
|
28
|
-
await fs.copy(file.fullPath, `./intuned/WebTemplate/${file.name}`);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
exports.moveWebTemplateFiles = moveWebTemplateFiles;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var ts = _interopRequireWildcard(require("typescript"));
|
|
5
|
-
var _commander = require("commander");
|
|
6
|
-
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
7
|
-
var path = _interopRequireWildcard(require("path"));
|
|
8
|
-
var _webTemplate = require("./common/utils/webTemplate");
|
|
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
|
-
_commander.program.description("Check TypeScript types in the project").allowUnknownOption().action(async () => {
|
|
12
|
-
await (0, _webTemplate.moveWebTemplateFiles)();
|
|
13
|
-
const templateTsConfig = path.resolve(__dirname, "..", "..", "template.tsconfig.json");
|
|
14
|
-
await fs.copy(templateTsConfig, "./intuned/WebTemplate/tsconfig.json");
|
|
15
|
-
checkTypes();
|
|
16
|
-
});
|
|
17
|
-
function checkTypes() {
|
|
18
|
-
const configPath = ts.findConfigFile("./intuned/WebTemplate", ts.sys.fileExists, "tsconfig.json");
|
|
19
|
-
if (!configPath) {
|
|
20
|
-
console.error("Could not find a valid 'tsconfig.json'.");
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
const readConfigResult = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
24
|
-
const config = readConfigResult.config;
|
|
25
|
-
const parseConfigHost = {
|
|
26
|
-
useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
|
|
27
|
-
readDirectory: ts.sys.readDirectory,
|
|
28
|
-
fileExists: ts.sys.fileExists,
|
|
29
|
-
readFile: ts.sys.readFile
|
|
30
|
-
};
|
|
31
|
-
const parsed = ts.parseJsonConfigFileContent(config, parseConfigHost, "./intuned");
|
|
32
|
-
const program = ts.createProgram(parsed.fileNames, parsed.options);
|
|
33
|
-
const emitResult = program.emit();
|
|
34
|
-
const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
35
|
-
allDiagnostics.forEach(diagnostic => {
|
|
36
|
-
if (diagnostic.file) {
|
|
37
|
-
const {
|
|
38
|
-
line,
|
|
39
|
-
character
|
|
40
|
-
} = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
|
|
41
|
-
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
42
|
-
console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
|
43
|
-
} else {
|
|
44
|
-
console.log(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
if (allDiagnostics.length === 0) {
|
|
48
|
-
console.log("✨ TypeScript type checking passed without errors.");
|
|
49
|
-
} else {
|
|
50
|
-
console.error("Errors found during TypeScript type checking.");
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
_commander.program.parse(process.argv);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LogEntry, LogMetadata } from "./types";
|
|
2
|
-
declare class Logger {
|
|
3
|
-
logFunction(entry: LogEntry): void;
|
|
4
|
-
private log;
|
|
5
|
-
trace(message: string, meta?: LogMetadata): void;
|
|
6
|
-
debug(message: string, meta?: LogMetadata): void;
|
|
7
|
-
info(message: string, meta?: LogMetadata): void;
|
|
8
|
-
warn(message: string, meta?: LogMetadata): void;
|
|
9
|
-
error(message: string, meta?: LogMetadata): void;
|
|
10
|
-
}
|
|
11
|
-
export declare const logger: Logger;
|
|
12
|
-
export {};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.logger = void 0;
|
|
7
|
-
var _nodeUtil = require("node:util");
|
|
8
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
const format = _nodeUtil.formatWithOptions.bind(undefined, {
|
|
11
|
-
colors: true
|
|
12
|
-
});
|
|
13
|
-
const LOG_LEVEL_COLORS = {
|
|
14
|
-
TRACE: _chalk.default.gray,
|
|
15
|
-
DEBUG: _chalk.default.blue,
|
|
16
|
-
INFO: _chalk.default.green,
|
|
17
|
-
WARN: _chalk.default.yellow,
|
|
18
|
-
ERROR: _chalk.default.red
|
|
19
|
-
};
|
|
20
|
-
class Logger {
|
|
21
|
-
logFunction(entry) {
|
|
22
|
-
const {
|
|
23
|
-
level,
|
|
24
|
-
timestamp,
|
|
25
|
-
message,
|
|
26
|
-
meta
|
|
27
|
-
} = entry;
|
|
28
|
-
const date = new Date(timestamp);
|
|
29
|
-
const levelColor = LOG_LEVEL_COLORS[level];
|
|
30
|
-
if (meta === undefined) {
|
|
31
|
-
process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message}\n`);
|
|
32
|
-
} else {
|
|
33
|
-
process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message} ${format(meta)}\n`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
log(level, message, meta) {
|
|
37
|
-
this.logFunction({
|
|
38
|
-
level,
|
|
39
|
-
message,
|
|
40
|
-
meta: meta && Object.keys(meta).length === 0 ? undefined : meta,
|
|
41
|
-
timestamp: Date.now()
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
trace(message, meta) {
|
|
45
|
-
this.log("TRACE", message, meta);
|
|
46
|
-
}
|
|
47
|
-
debug(message, meta) {
|
|
48
|
-
this.log("DEBUG", message, meta);
|
|
49
|
-
}
|
|
50
|
-
info(message, meta) {
|
|
51
|
-
this.log("INFO", message, meta);
|
|
52
|
-
}
|
|
53
|
-
warn(message, meta) {
|
|
54
|
-
this.log("WARN", message, meta);
|
|
55
|
-
}
|
|
56
|
-
error(message, meta) {
|
|
57
|
-
this.log("ERROR", message, meta);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const logger = exports.logger = new Logger();
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LogEntry, LogMetadata } from "./types";
|
|
2
|
-
declare class Logger {
|
|
3
|
-
logFunction(entry: LogEntry): void;
|
|
4
|
-
private log;
|
|
5
|
-
trace(message: string, meta?: LogMetadata): void;
|
|
6
|
-
debug(message: string, meta?: LogMetadata): void;
|
|
7
|
-
info(message: string, meta?: LogMetadata): void;
|
|
8
|
-
warn(message: string, meta?: LogMetadata): void;
|
|
9
|
-
error(message: string, meta?: LogMetadata): void;
|
|
10
|
-
}
|
|
11
|
-
export declare const logger: Logger;
|
|
12
|
-
export {};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.logger = void 0;
|
|
7
|
-
var _nodeUtil = require("node:util");
|
|
8
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
const format = _nodeUtil.formatWithOptions.bind(undefined, {
|
|
11
|
-
colors: true
|
|
12
|
-
});
|
|
13
|
-
const LOG_LEVEL_COLORS = {
|
|
14
|
-
TRACE: _chalk.default.gray,
|
|
15
|
-
DEBUG: _chalk.default.blue,
|
|
16
|
-
INFO: _chalk.default.green,
|
|
17
|
-
WARN: _chalk.default.yellow,
|
|
18
|
-
ERROR: _chalk.default.red
|
|
19
|
-
};
|
|
20
|
-
class Logger {
|
|
21
|
-
logFunction(entry) {
|
|
22
|
-
const {
|
|
23
|
-
level,
|
|
24
|
-
timestamp,
|
|
25
|
-
message,
|
|
26
|
-
meta
|
|
27
|
-
} = entry;
|
|
28
|
-
const date = new Date(timestamp);
|
|
29
|
-
const levelColor = LOG_LEVEL_COLORS[level];
|
|
30
|
-
if (meta === undefined) {
|
|
31
|
-
process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message}\n`);
|
|
32
|
-
} else {
|
|
33
|
-
process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message} ${format(meta)}\n`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
log(level, message, meta) {
|
|
37
|
-
this.logFunction({
|
|
38
|
-
level,
|
|
39
|
-
message,
|
|
40
|
-
meta: meta && Object.keys(meta).length === 0 ? undefined : meta,
|
|
41
|
-
timestamp: Date.now()
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
trace(message, meta) {
|
|
45
|
-
this.log("TRACE", message, meta);
|
|
46
|
-
}
|
|
47
|
-
debug(message, meta) {
|
|
48
|
-
this.log("DEBUG", message, meta);
|
|
49
|
-
}
|
|
50
|
-
info(message, meta) {
|
|
51
|
-
this.log("INFO", message, meta);
|
|
52
|
-
}
|
|
53
|
-
warn(message, meta) {
|
|
54
|
-
this.log("WARN", message, meta);
|
|
55
|
-
}
|
|
56
|
-
error(message, meta) {
|
|
57
|
-
this.log("ERROR", message, meta);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const logger = exports.logger = new Logger();
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { AsyncLocalStorage } from "async_hooks";
|
|
3
|
-
import { Payload, RunInfo } from "../../runtime/export";
|
|
4
|
-
export declare const asyncLocalStorage: AsyncLocalStorage<InternalRunInfo>;
|
|
5
|
-
export declare function runWithContext<R, TArgs extends any[]>(contextData: InternalRunInfo, callback: (...args: TArgs) => R, ...args: TArgs): R;
|
|
6
|
-
interface TimeoutInfo {
|
|
7
|
-
extendTimeoutCallback?: () => Promise<void>;
|
|
8
|
-
timeoutDuration?: number;
|
|
9
|
-
timeoutTimestamp?: number;
|
|
10
|
-
}
|
|
11
|
-
interface InternalRunInfo extends RunInfo {
|
|
12
|
-
extendedPayloads: Payload[];
|
|
13
|
-
timeoutInfo?: TimeoutInfo;
|
|
14
|
-
}
|
|
15
|
-
export declare function getExecutionContext(): InternalRunInfo | undefined;
|
|
16
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
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) {
|
|
12
|
-
return asyncLocalStorage.run(contextData, callback, ...args);
|
|
13
|
-
}
|
|
14
|
-
function getExecutionContext() {
|
|
15
|
-
const contextData = asyncLocalStorage.getStore();
|
|
16
|
-
return contextData;
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function cleanEnvironmentVariables(): void;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.cleanEnvironmentVariables = cleanEnvironmentVariables;
|
|
7
|
-
function cleanEnvironmentVariables() {
|
|
8
|
-
Object.keys(process.env).filter(i => {
|
|
9
|
-
if (i.toLocaleLowerCase().startsWith("npm")) {
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
if (i.toLocaleLowerCase().startsWith("fly") && i !== "FLY_ALLOC_ID") {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
}).forEach(i => delete process.env[i]);
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const AUTH_SESSIONS_FOLDER_NAME = "auth-sessions";
|
package/dist/common/constants.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BrowserContext } from "@intuned/playwright";
|
|
2
|
-
import * as playwright from "@intuned/playwright-core";
|
|
3
|
-
interface OriginSessionStorage {
|
|
4
|
-
origin: string;
|
|
5
|
-
sessionStorage: Array<{
|
|
6
|
-
name: string;
|
|
7
|
-
value: string;
|
|
8
|
-
}>;
|
|
9
|
-
}
|
|
10
|
-
export type IntunedStorageState = Exclude<playwright.BrowserContextOptions["storageState"], string> & {
|
|
11
|
-
sessionStorage?: OriginSessionStorage[];
|
|
12
|
-
};
|
|
13
|
-
export declare function getContextStorageState(context: BrowserContext): Promise<IntunedStorageState>;
|
|
14
|
-
export declare function setContextStorageState(context: BrowserContext, storage: IntunedStorageState): Promise<void>;
|
|
15
|
-
export {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getContextStorageState = getContextStorageState;
|
|
7
|
-
exports.setContextStorageState = setContextStorageState;
|
|
8
|
-
function sessionStorageToArray(storage) {
|
|
9
|
-
const result = [];
|
|
10
|
-
for (const key in storage) {
|
|
11
|
-
result.push({
|
|
12
|
-
name: key,
|
|
13
|
-
value: storage[key]
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return result;
|
|
17
|
-
}
|
|
18
|
-
async function getContextStorageState(context) {
|
|
19
|
-
const cookiesAndLocalStorage = await context.storageState();
|
|
20
|
-
const pages = await context.pages();
|
|
21
|
-
const pagesSessions = [];
|
|
22
|
-
for (const page of pages) {
|
|
23
|
-
const [origin, session] = await page.evaluate(() => [location.origin, sessionStorage]);
|
|
24
|
-
const transformed = sessionStorageToArray(session);
|
|
25
|
-
pagesSessions.push({
|
|
26
|
-
origin,
|
|
27
|
-
sessionStorage: transformed
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
...cookiesAndLocalStorage,
|
|
32
|
-
sessionStorage: pagesSessions
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
async function setContextStorageState(context, storage) {
|
|
36
|
-
await context.intunedSetStorageState(storage);
|
|
37
|
-
const sessionStorage = storage.sessionStorage;
|
|
38
|
-
await context.addInitScript(storage => {
|
|
39
|
-
for (const {
|
|
40
|
-
origin,
|
|
41
|
-
sessionStorage
|
|
42
|
-
} of storage) {
|
|
43
|
-
if (window.location.origin === origin) {
|
|
44
|
-
for (const item of sessionStorage) window.sessionStorage.setItem(item.name, item.value);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}, sessionStorage);
|
|
48
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as playwright from "@intuned/playwright-core";
|
|
2
|
-
import { IntunedStorageState } from "./contextStorageStateHelpers";
|
|
3
|
-
interface Proxy {
|
|
4
|
-
server: string;
|
|
5
|
-
username: string;
|
|
6
|
-
password: string;
|
|
7
|
-
}
|
|
8
|
-
interface GetPlaywrightConstructsOptions {
|
|
9
|
-
proxy?: Proxy;
|
|
10
|
-
headless?: boolean;
|
|
11
|
-
storageState?: IntunedStorageState;
|
|
12
|
-
downloadsPath: string;
|
|
13
|
-
userDataDir?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare function getProductionPlaywrightConstructs({ proxy, headless, storageState, downloadsPath, }: GetPlaywrightConstructsOptions): Promise<{
|
|
16
|
-
page: playwright.Page;
|
|
17
|
-
context: playwright.BrowserContext;
|
|
18
|
-
}>;
|
|
19
|
-
export declare function getPlaywrightConstructsForMode(mode: "vanilla" | "playwright" | "playwright-standalone" | "playwright-headless", cdpAddress: string | undefined, authSessionPath?: string): Promise<{
|
|
20
|
-
page: playwright.Page;
|
|
21
|
-
context: playwright.BrowserContext;
|
|
22
|
-
}>;
|
|
23
|
-
export declare function loadAuthSessionToContext(context: playwright.BrowserContext, authSessionPath: string): Promise<void>;
|
|
24
|
-
export declare function getRemotePlaywrightContext(cdpAddress: string): Promise<{
|
|
25
|
-
browser: playwright.Browser;
|
|
26
|
-
context: playwright.BrowserContext;
|
|
27
|
-
}>;
|
|
28
|
-
export {};
|