@intuned/runtime-dev 0.1.0-test.15 → 0.1.0-test.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +1 -2
- package/WebTemplate/api.ts +90 -92
- package/WebTemplate/controllers/authSessions/create.ts +2 -2
- package/WebTemplate/controllers/authSessions/store.ts +1 -1
- package/WebTemplate/controllers/runApi/helpers.ts +14 -12
- package/WebTemplate/index.playwright.ts +32 -42
- package/WebTemplate/jobs.ts +13 -2
- package/WebTemplate/utils.ts +53 -1
- package/api/test2.ts +6 -1
- package/auth-sessions/check.ts +3 -1
- package/auth-sessions/create.ts +10 -10
- package/dist/commands/api/run.js +41 -29
- package/dist/commands/auth-sessions/load.js +13 -11
- package/dist/commands/auth-sessions/run-check.js +21 -14
- package/dist/commands/auth-sessions/run-create.js +32 -25
- package/dist/commands/browser/save-state.js +10 -7
- package/dist/commands/browser/start-browser.js +10 -7
- package/dist/commands/build.js +28 -23
- package/dist/commands/common/browserUtils.js +28 -15
- package/dist/commands/common/getFirstLineNumber.js +20 -13
- package/dist/commands/common/getFirstLineNumber.test.js +53 -48
- package/dist/commands/common/sendMessageToClient.js +9 -2
- package/dist/commands/common/tsNodeImport.d.ts +1 -0
- package/dist/commands/common/tsNodeImport.js +18 -0
- package/dist/commands/common/utils/fileUtils.js +16 -6
- package/dist/commands/common/utils/settings.js +13 -7
- package/dist/commands/common/utils/unixSocket.js +9 -2
- package/dist/commands/common/utils/webTemplate.js +18 -9
- package/dist/commands/interface/run.js +163 -134
- package/dist/commands/ts-check.js +14 -10
- package/dist/common/Logger/Logger/index.js +16 -9
- package/dist/common/Logger/Logger/types.js +5 -1
- package/dist/common/Logger/index.js +16 -9
- package/dist/common/Logger/types.js +5 -1
- package/dist/common/asyncLocalStorage/index.js +12 -4
- package/dist/common/cleanEnvironmentVariables.js +7 -1
- package/dist/common/constants.js +7 -1
- package/dist/common/contextStorageStateHelpers.js +9 -2
- package/dist/common/getPlaywrightConstructs.js +40 -29
- package/dist/common/jwtTokenManager.js +18 -8
- package/dist/common/runApi/errors.js +42 -24
- package/dist/common/runApi/index.js +97 -103
- package/dist/common/runApi/types.d.ts +19 -5
- package/dist/common/runApi/types.js +42 -31
- package/dist/common/settingsSchema.js +10 -2
- package/dist/common/telemetry.js +12 -3
- package/dist/index.js +69 -4
- package/dist/runtime/RunError.js +8 -1
- package/dist/runtime/downloadDirectory.js +11 -5
- package/dist/runtime/enums.d.js +5 -1
- package/dist/runtime/enums.js +8 -2
- package/dist/runtime/executionHelpers.test.js +22 -20
- package/dist/runtime/export.d.js +5 -1
- package/dist/runtime/extendPayload.js +11 -5
- package/dist/runtime/extendTimeout.js +9 -3
- package/dist/runtime/index.js +53 -6
- package/dist/runtime/requestMoreInfo.js +9 -2
- package/dist/runtime/runInfo.js +11 -5
- package/package.json +3 -5
- package/dist/commands/common/getDefaultExportFromFile.d.ts +0 -0
- package/dist/commands/common/getDefaultExportFromFile.js +0 -0
|
@@ -1,150 +1,176 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _commander = require("commander");
|
|
5
|
+
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
6
|
+
var _asyncLocalStorage = require("../../common/asyncLocalStorage");
|
|
7
|
+
var net = _interopRequireWildcard(require("net"));
|
|
8
|
+
var _zod = _interopRequireDefault(require("zod"));
|
|
9
|
+
var _runApi = require("../../common/runApi");
|
|
10
|
+
var _enums = require("src/runtime/enums");
|
|
11
|
+
var _unixSocket = require("../common/utils/unixSocket");
|
|
12
|
+
var _promises = require("timers/promises");
|
|
13
|
+
var _jwtTokenManager = require("src/common/jwtTokenManager");
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
const nextRunApiSchema = _zod.default.object({
|
|
18
|
+
type: _zod.default.literal("next"),
|
|
19
|
+
parameters: _zod.default.object({
|
|
20
|
+
value: _zod.default.string()
|
|
21
21
|
})
|
|
22
22
|
});
|
|
23
|
-
const
|
|
24
|
-
type:
|
|
25
|
-
parameters:
|
|
26
|
-
value: z.string()
|
|
27
|
-
})
|
|
23
|
+
const abortRunApiSchema = _zod.default.object({
|
|
24
|
+
type: _zod.default.literal("abort"),
|
|
25
|
+
parameters: _zod.default.object({}).optional()
|
|
28
26
|
});
|
|
29
|
-
const
|
|
30
|
-
type:
|
|
31
|
-
parameters:
|
|
27
|
+
const tokenUpdateSchema = _zod.default.object({
|
|
28
|
+
type: _zod.default.literal("tokenUpdate"),
|
|
29
|
+
parameters: _zod.default.object({
|
|
30
|
+
functionsToken: _zod.default.string()
|
|
31
|
+
})
|
|
32
32
|
});
|
|
33
|
-
|
|
34
|
-
dotenv.config({
|
|
33
|
+
_dotenv.default.config({
|
|
35
34
|
path: `.env`
|
|
36
35
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const input = inputParseResult.data;
|
|
100
|
-
if (input.type === "abort") {
|
|
101
|
-
abortController.abort();
|
|
102
|
-
await setTimeout(10);
|
|
103
|
-
jsonUnixSocket.sendJSON({
|
|
104
|
-
type: "done",
|
|
105
|
-
result: null
|
|
106
|
-
});
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
if (input.type === "start") {
|
|
110
|
-
const gen = runApiGenerator({
|
|
111
|
-
...input.parameters,
|
|
112
|
-
abortSignal: abortController.signal
|
|
113
|
-
});
|
|
114
|
-
generator = gen;
|
|
115
|
-
context = {
|
|
116
|
-
extendedPayloads: [],
|
|
117
|
-
runEnvironment: input.parameters.runOptions.environment === "deployed" ? RunEnvironment.DEPLOYED : RunEnvironment.IDE,
|
|
118
|
-
timeoutInfo: {
|
|
119
|
-
extendTimeoutCallback: async () => {
|
|
120
|
-
if (Date.now() - timeoutTimestamp < throttleTime) return;
|
|
121
|
-
timeoutTimestamp = Date.now();
|
|
122
|
-
jsonUnixSocket.sendJSON({
|
|
123
|
-
type: "extend"
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
...(input.parameters.context ?? {}),
|
|
128
|
-
proxy: getProxyUrlFromRunOptions(input.parameters.runOptions)
|
|
129
|
-
};
|
|
130
|
-
if (await runGeneratorAndSendResult()) {
|
|
131
|
-
break;
|
|
36
|
+
function main(importFunction) {
|
|
37
|
+
_commander.program.description("run user automation and communicate using unix socket").argument("<socket-path>", "path to unix socket").action(async socketPath => {
|
|
38
|
+
const startRunApiSchema = _zod.default.object({
|
|
39
|
+
type: _zod.default.literal("start"),
|
|
40
|
+
parameters: _runApi.runApiParametersSchema.extend({
|
|
41
|
+
automationFunction: _runApi.runApiParametersSchema.shape.automationFunction.omit({
|
|
42
|
+
module: true
|
|
43
|
+
}).extend({
|
|
44
|
+
name: _zod.default.string()
|
|
45
|
+
}),
|
|
46
|
+
retrieveSession: _zod.default.boolean(),
|
|
47
|
+
context: _zod.default.object({
|
|
48
|
+
jobId: _zod.default.string().optional(),
|
|
49
|
+
jobRunId: _zod.default.string().optional(),
|
|
50
|
+
runId: _zod.default.string().optional(),
|
|
51
|
+
queueId: _zod.default.string().optional()
|
|
52
|
+
}).optional()
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
const inputSchema = _zod.default.union([startRunApiSchema, nextRunApiSchema, abortRunApiSchema, tokenUpdateSchema]);
|
|
56
|
+
let context;
|
|
57
|
+
const throttleTime = 1_000;
|
|
58
|
+
let timeoutTimestamp = Date.now();
|
|
59
|
+
const client = net.createConnection(socketPath);
|
|
60
|
+
let generator = null;
|
|
61
|
+
const abortController = new AbortController();
|
|
62
|
+
client.on("error", err => {
|
|
63
|
+
var _generator2;
|
|
64
|
+
void ((_generator2 = generator) === null || _generator2 === void 0 ? void 0 : _generator2.throw(err).catch(() => undefined));
|
|
65
|
+
});
|
|
66
|
+
process.on("SIGINT", () => {
|
|
67
|
+
var _generator3;
|
|
68
|
+
void ((_generator3 = generator) === null || _generator3 === void 0 ? void 0 : _generator3.throw(new Error("Interrupted")).catch(() => undefined));
|
|
69
|
+
client.end();
|
|
70
|
+
process.exit(1);
|
|
71
|
+
});
|
|
72
|
+
process.on("SIGTERM", () => {
|
|
73
|
+
var _generator4;
|
|
74
|
+
void ((_generator4 = generator) === null || _generator4 === void 0 ? void 0 : _generator4.throw(new Error("Interrupted")).catch(() => undefined));
|
|
75
|
+
client.end();
|
|
76
|
+
process.exit(1);
|
|
77
|
+
});
|
|
78
|
+
const jsonUnixSocket = new _unixSocket.JSONUnixSocket(client);
|
|
79
|
+
async function runGeneratorAndSendResult(next) {
|
|
80
|
+
const _generator = generator;
|
|
81
|
+
if (_generator == null) return;
|
|
82
|
+
const result = await (0, _asyncLocalStorage.runWithContext)(context, () => _generator.next(next));
|
|
83
|
+
if (result.done) {
|
|
84
|
+
const resultToSend = result.value.isOk() ? result.value.value : result.value.error.json;
|
|
85
|
+
const success = result.value.isOk();
|
|
86
|
+
jsonUnixSocket.sendJSON({
|
|
87
|
+
type: "done",
|
|
88
|
+
result: resultToSend,
|
|
89
|
+
success
|
|
90
|
+
});
|
|
91
|
+
return true;
|
|
92
|
+
} else {
|
|
93
|
+
jsonUnixSocket.sendJSON({
|
|
94
|
+
type: "yield",
|
|
95
|
+
result: result.value
|
|
96
|
+
});
|
|
97
|
+
return false;
|
|
132
98
|
}
|
|
133
|
-
continue;
|
|
134
99
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
100
|
+
for await (const data of jsonUnixSocket.receiveJSON()) {
|
|
101
|
+
const inputParseResult = inputSchema.safeParse(data);
|
|
102
|
+
if (!inputParseResult.success) {
|
|
103
|
+
console.error(inputParseResult.error.errors);
|
|
104
|
+
jsonUnixSocket.sendJSON({
|
|
105
|
+
type: "done",
|
|
106
|
+
result: {
|
|
107
|
+
error: "InvalidInput",
|
|
108
|
+
message: "Invalid input",
|
|
109
|
+
details: {
|
|
110
|
+
errors: inputParseResult.error.errors
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
success: false
|
|
114
|
+
});
|
|
115
|
+
break;
|
|
138
116
|
}
|
|
139
|
-
|
|
117
|
+
const input = inputParseResult.data;
|
|
118
|
+
if (input.type === "abort") {
|
|
119
|
+
abortController.abort();
|
|
120
|
+
await (0, _promises.setTimeout)(10);
|
|
121
|
+
jsonUnixSocket.sendJSON({
|
|
122
|
+
type: "done",
|
|
123
|
+
result: null
|
|
124
|
+
});
|
|
140
125
|
break;
|
|
141
126
|
}
|
|
142
|
-
|
|
127
|
+
if (input.type === "start") {
|
|
128
|
+
const gen = (0, _runApi.runApiGenerator)({
|
|
129
|
+
...input.parameters,
|
|
130
|
+
automationFunction: {
|
|
131
|
+
...input.parameters.automationFunction,
|
|
132
|
+
module: importFunction ? await importFunction(input.parameters.automationFunction.name) : await (specifier => new Promise(r => r(`${specifier}`)).then(s => _interopRequireWildcard(require(s))))(input.parameters.automationFunction.name)
|
|
133
|
+
},
|
|
134
|
+
abortSignal: abortController.signal
|
|
135
|
+
});
|
|
136
|
+
generator = gen;
|
|
137
|
+
context = {
|
|
138
|
+
extendedPayloads: [],
|
|
139
|
+
runEnvironment: input.parameters.runOptions.environment === "deployed" ? _enums.RunEnvironment.DEPLOYED : _enums.RunEnvironment.IDE,
|
|
140
|
+
timeoutInfo: {
|
|
141
|
+
extendTimeoutCallback: async () => {
|
|
142
|
+
if (Date.now() - timeoutTimestamp < throttleTime) return;
|
|
143
|
+
timeoutTimestamp = Date.now();
|
|
144
|
+
jsonUnixSocket.sendJSON({
|
|
145
|
+
type: "extend"
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
...(input.parameters.context ?? {}),
|
|
150
|
+
proxy: getProxyUrlFromRunOptions(input.parameters.runOptions)
|
|
151
|
+
};
|
|
152
|
+
if (await runGeneratorAndSendResult()) {
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (input.type === "next") {
|
|
158
|
+
if (!generator) {
|
|
159
|
+
throw new Error("generator not started");
|
|
160
|
+
}
|
|
161
|
+
if (await runGeneratorAndSendResult(input.parameters.value)) {
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
if (input.type === "tokenUpdate") {
|
|
167
|
+
_jwtTokenManager.backendFunctionsTokenManager.token = input.parameters.functionsToken;
|
|
168
|
+
}
|
|
143
169
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
170
|
+
process.exit(0);
|
|
171
|
+
});
|
|
172
|
+
_commander.program.parse(process.argv);
|
|
173
|
+
}
|
|
148
174
|
function getProxyUrlFromRunOptions(runOptions) {
|
|
149
175
|
if ((runOptions === null || runOptions === void 0 ? void 0 : runOptions.environment) !== "deployed") return undefined;
|
|
150
176
|
const proxy = runOptions.proxy;
|
|
@@ -153,4 +179,7 @@ function getProxyUrlFromRunOptions(runOptions) {
|
|
|
153
179
|
url.username = proxy.username;
|
|
154
180
|
url.password = proxy.password;
|
|
155
181
|
return url.toString();
|
|
182
|
+
}
|
|
183
|
+
if (require.main === module) {
|
|
184
|
+
main();
|
|
156
185
|
}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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.js");
|
|
9
|
+
var _url = require("url");
|
|
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
|
+
_commander.program.description("Check TypeScript types in the project").allowUnknownOption().action(async () => {
|
|
13
|
+
await (0, _webTemplate.moveWebTemplateFiles)();
|
|
14
|
+
const templateTsConfig = path.resolve(path.dirname((0, _url.fileURLToPath)(import.meta.url)), "..", "..", "template.tsconfig.json");
|
|
11
15
|
await fs.copy(templateTsConfig, "./intuned/WebTemplate/tsconfig.json");
|
|
12
16
|
checkTypes();
|
|
13
17
|
});
|
|
@@ -48,4 +52,4 @@ function checkTypes() {
|
|
|
48
52
|
process.exit(1);
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
|
-
program.parse(process.argv);
|
|
55
|
+
_commander.program.parse(process.argv);
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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, {
|
|
4
11
|
colors: true
|
|
5
12
|
});
|
|
6
13
|
const LOG_LEVEL_COLORS = {
|
|
7
|
-
TRACE:
|
|
8
|
-
DEBUG:
|
|
9
|
-
INFO:
|
|
10
|
-
WARN:
|
|
11
|
-
ERROR:
|
|
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
|
|
12
19
|
};
|
|
13
20
|
class Logger {
|
|
14
21
|
logFunction(entry) {
|
|
@@ -50,4 +57,4 @@ class Logger {
|
|
|
50
57
|
this.log("ERROR", message, meta);
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
|
-
|
|
60
|
+
const logger = exports.logger = new Logger();
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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, {
|
|
4
11
|
colors: true
|
|
5
12
|
});
|
|
6
13
|
const LOG_LEVEL_COLORS = {
|
|
7
|
-
TRACE:
|
|
8
|
-
DEBUG:
|
|
9
|
-
INFO:
|
|
10
|
-
WARN:
|
|
11
|
-
ERROR:
|
|
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
|
|
12
19
|
};
|
|
13
20
|
class Logger {
|
|
14
21
|
logFunction(entry) {
|
|
@@ -50,4 +57,4 @@ class Logger {
|
|
|
50
57
|
this.log("ERROR", message, meta);
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
|
-
|
|
60
|
+
const logger = exports.logger = new Logger();
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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) {
|
|
4
12
|
return asyncLocalStorage.run(contextData, callback, ...args);
|
|
5
13
|
}
|
|
6
|
-
|
|
14
|
+
function getExecutionContext() {
|
|
7
15
|
const contextData = asyncLocalStorage.getStore();
|
|
8
16
|
return contextData;
|
|
9
17
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.cleanEnvironmentVariables = cleanEnvironmentVariables;
|
|
7
|
+
function cleanEnvironmentVariables() {
|
|
2
8
|
Object.keys(process.env).filter(i => {
|
|
3
9
|
if (i.toLocaleLowerCase().startsWith("npm")) {
|
|
4
10
|
return true;
|
package/dist/common/constants.js
CHANGED
|
@@ -1 +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,3 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getContextStorageState = getContextStorageState;
|
|
7
|
+
exports.setContextStorageState = setContextStorageState;
|
|
1
8
|
function sessionStorageToArray(storage) {
|
|
2
9
|
const result = [];
|
|
3
10
|
for (const key in storage) {
|
|
@@ -8,7 +15,7 @@ function sessionStorageToArray(storage) {
|
|
|
8
15
|
}
|
|
9
16
|
return result;
|
|
10
17
|
}
|
|
11
|
-
|
|
18
|
+
async function getContextStorageState(context) {
|
|
12
19
|
const cookiesAndLocalStorage = await context.storageState();
|
|
13
20
|
const pages = context.pages();
|
|
14
21
|
const pagesSessions = [];
|
|
@@ -27,7 +34,7 @@ export async function getContextStorageState(context) {
|
|
|
27
34
|
sessionStorage: pagesSessions
|
|
28
35
|
};
|
|
29
36
|
}
|
|
30
|
-
|
|
37
|
+
async function setContextStorageState(context, storage) {
|
|
31
38
|
await context.intunedSetStorageState(storage);
|
|
32
39
|
const sessionStorage = storage.sessionStorage;
|
|
33
40
|
await context.addInitScript(storage => {
|