@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.
Files changed (61) hide show
  1. package/.babelrc +1 -2
  2. package/WebTemplate/api.ts +90 -92
  3. package/WebTemplate/controllers/authSessions/create.ts +2 -2
  4. package/WebTemplate/controllers/authSessions/store.ts +1 -1
  5. package/WebTemplate/controllers/runApi/helpers.ts +14 -12
  6. package/WebTemplate/index.playwright.ts +32 -42
  7. package/WebTemplate/jobs.ts +13 -2
  8. package/WebTemplate/utils.ts +53 -1
  9. package/api/test2.ts +6 -1
  10. package/auth-sessions/check.ts +3 -1
  11. package/auth-sessions/create.ts +10 -10
  12. package/dist/commands/api/run.js +41 -29
  13. package/dist/commands/auth-sessions/load.js +13 -11
  14. package/dist/commands/auth-sessions/run-check.js +21 -14
  15. package/dist/commands/auth-sessions/run-create.js +32 -25
  16. package/dist/commands/browser/save-state.js +10 -7
  17. package/dist/commands/browser/start-browser.js +10 -7
  18. package/dist/commands/build.js +28 -23
  19. package/dist/commands/common/browserUtils.js +28 -15
  20. package/dist/commands/common/getFirstLineNumber.js +20 -13
  21. package/dist/commands/common/getFirstLineNumber.test.js +53 -48
  22. package/dist/commands/common/sendMessageToClient.js +9 -2
  23. package/dist/commands/common/tsNodeImport.d.ts +1 -0
  24. package/dist/commands/common/tsNodeImport.js +18 -0
  25. package/dist/commands/common/utils/fileUtils.js +16 -6
  26. package/dist/commands/common/utils/settings.js +13 -7
  27. package/dist/commands/common/utils/unixSocket.js +9 -2
  28. package/dist/commands/common/utils/webTemplate.js +18 -9
  29. package/dist/commands/interface/run.js +163 -134
  30. package/dist/commands/ts-check.js +14 -10
  31. package/dist/common/Logger/Logger/index.js +16 -9
  32. package/dist/common/Logger/Logger/types.js +5 -1
  33. package/dist/common/Logger/index.js +16 -9
  34. package/dist/common/Logger/types.js +5 -1
  35. package/dist/common/asyncLocalStorage/index.js +12 -4
  36. package/dist/common/cleanEnvironmentVariables.js +7 -1
  37. package/dist/common/constants.js +7 -1
  38. package/dist/common/contextStorageStateHelpers.js +9 -2
  39. package/dist/common/getPlaywrightConstructs.js +40 -29
  40. package/dist/common/jwtTokenManager.js +18 -8
  41. package/dist/common/runApi/errors.js +42 -24
  42. package/dist/common/runApi/index.js +97 -103
  43. package/dist/common/runApi/types.d.ts +19 -5
  44. package/dist/common/runApi/types.js +42 -31
  45. package/dist/common/settingsSchema.js +10 -2
  46. package/dist/common/telemetry.js +12 -3
  47. package/dist/index.js +69 -4
  48. package/dist/runtime/RunError.js +8 -1
  49. package/dist/runtime/downloadDirectory.js +11 -5
  50. package/dist/runtime/enums.d.js +5 -1
  51. package/dist/runtime/enums.js +8 -2
  52. package/dist/runtime/executionHelpers.test.js +22 -20
  53. package/dist/runtime/export.d.js +5 -1
  54. package/dist/runtime/extendPayload.js +11 -5
  55. package/dist/runtime/extendTimeout.js +9 -3
  56. package/dist/runtime/index.js +53 -6
  57. package/dist/runtime/requestMoreInfo.js +9 -2
  58. package/dist/runtime/runInfo.js +11 -5
  59. package/package.json +3 -5
  60. package/dist/commands/common/getDefaultExportFromFile.d.ts +0 -0
  61. package/dist/commands/common/getDefaultExportFromFile.js +0 -0
@@ -1,150 +1,176 @@
1
1
  #!/usr/bin/env node
2
- import { program } from "commander";
3
- import dotenv from "dotenv";
4
- import { runWithContext } from "../../common/asyncLocalStorage";
5
- import * as net from "net";
6
- import z from "zod";
7
- import { runApiGenerator, runApiParametersSchema } from "../../common/runApi";
8
- import { RunEnvironment } from "src/runtime/enums";
9
- import { JSONUnixSocket } from "../common/utils/unixSocket";
10
- import { setTimeout } from "timers/promises";
11
- const startRunApiSchema = z.object({
12
- type: z.literal("start"),
13
- parameters: runApiParametersSchema.extend({
14
- retrieveSession: z.boolean(),
15
- context: z.object({
16
- jobId: z.string().optional(),
17
- jobRunId: z.string().optional(),
18
- runId: z.string().optional(),
19
- queueId: z.string().optional()
20
- }).optional()
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 nextRunApiSchema = z.object({
24
- type: z.literal("next"),
25
- parameters: z.object({
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 abortRunApiSchema = z.object({
30
- type: z.literal("abort"),
31
- parameters: z.object({}).optional()
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
- const inputSchema = z.union([startRunApiSchema, nextRunApiSchema, abortRunApiSchema]);
34
- dotenv.config({
33
+ _dotenv.default.config({
35
34
  path: `.env`
36
35
  });
37
- program.description("run user automation and communicate using unix socket").argument("<socket-path>", "path to unix socket").action(async socketPath => {
38
- let context;
39
- const throttleTime = 1_000;
40
- let timeoutTimestamp = Date.now();
41
- const client = net.createConnection(socketPath, () => {
42
- console.log("connected to server!");
43
- });
44
- let generator = null;
45
- const abortController = new AbortController();
46
- client.on("end", () => {
47
- console.log("Disconnected from socket");
48
- });
49
- client.on("error", err => {
50
- var _generator;
51
- console.error("Child connection error:", err);
52
- void ((_generator = generator) === null || _generator === void 0 ? void 0 : _generator.throw(err).catch(() => undefined));
53
- });
54
- process.on("SIGINT", () => {
55
- var _generator2;
56
- console.log("Received SIGINT");
57
- void ((_generator2 = generator) === null || _generator2 === void 0 ? void 0 : _generator2.throw(new Error("Interrupted")).catch(() => undefined));
58
- client.end();
59
- process.exit(1);
60
- });
61
- const jsonUnixSocket = new JSONUnixSocket(client);
62
- async function runGeneratorAndSendResult(next) {
63
- if (!generator) return;
64
- const result = await runWithContext(context, () => generator.next(next));
65
- if (result.done) {
66
- const resultToSend = result.value.isOk() ? result.value.value : result.value.error.json;
67
- const success = result.value.isOk();
68
- jsonUnixSocket.sendJSON({
69
- type: "done",
70
- result: resultToSend,
71
- success
72
- });
73
- return true;
74
- } else {
75
- jsonUnixSocket.sendJSON({
76
- type: "yield",
77
- result: result.value
78
- });
79
- return false;
80
- }
81
- }
82
- for await (const data of jsonUnixSocket.receiveJSON()) {
83
- const inputParseResult = inputSchema.safeParse(data);
84
- if (!inputParseResult.success) {
85
- console.error(inputParseResult.error.errors);
86
- jsonUnixSocket.sendJSON({
87
- type: "done",
88
- result: {
89
- error: "InvalidJSON",
90
- message: "Invalid input",
91
- details: {
92
- errors: inputParseResult.error.errors
93
- }
94
- },
95
- success: false
96
- });
97
- break;
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
- if (input.type === "next") {
136
- if (!generator) {
137
- throw new Error("generator not started");
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
- if (await runGeneratorAndSendResult(input.parameters.value)) {
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
- continue;
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
- process.exit(0);
146
- });
147
- program.parse(process.argv);
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
- 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
- import { fileURLToPath } from "url";
8
- program.description("Check TypeScript types in the project").allowUnknownOption().action(async () => {
9
- await moveWebTemplateFiles();
10
- const templateTsConfig = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "template.tsconfig.json");
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
- import { formatWithOptions } from "node:util";
2
- import chalk from "chalk";
3
- const format = formatWithOptions.bind(undefined, {
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: chalk.gray,
8
- DEBUG: chalk.blue,
9
- INFO: chalk.green,
10
- WARN: chalk.yellow,
11
- ERROR: chalk.red
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
- export const logger = new Logger();
60
+ const logger = exports.logger = new Logger();
@@ -1 +1,5 @@
1
- export {};
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1,14 +1,21 @@
1
- import { formatWithOptions } from "node:util";
2
- import chalk from "chalk";
3
- const format = formatWithOptions.bind(undefined, {
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: chalk.gray,
8
- DEBUG: chalk.blue,
9
- INFO: chalk.green,
10
- WARN: chalk.yellow,
11
- ERROR: chalk.red
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
- export const logger = new Logger();
60
+ const logger = exports.logger = new Logger();
@@ -1 +1,5 @@
1
- export {};
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1,9 +1,17 @@
1
- import { AsyncLocalStorage } from "async_hooks";
2
- export const asyncLocalStorage = new AsyncLocalStorage();
3
- export function runWithContext(contextData, callback, ...args) {
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
- export function getExecutionContext() {
14
+ function getExecutionContext() {
7
15
  const contextData = asyncLocalStorage.getStore();
8
16
  return contextData;
9
17
  }
@@ -1,4 +1,10 @@
1
- export function cleanEnvironmentVariables() {
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;
@@ -1 +1,7 @@
1
- export const AUTH_SESSIONS_FOLDER_NAME = "auth-sessions";
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
- export async function getContextStorageState(context) {
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
- export async function setContextStorageState(context, storage) {
37
+ async function setContextStorageState(context, storage) {
31
38
  await context.intunedSetStorageState(storage);
32
39
  const sessionStorage = storage.sessionStorage;
33
40
  await context.addInitScript(storage => {