@intuned/runtime-dev 0.0.1-split.0 → 0.0.1-split.2

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 (123) hide show
  1. package/WebTemplate/controllers/authSessions/create.ts +1 -1
  2. package/WebTemplate/controllers/runApi/helpers.ts +1 -3
  3. package/dist/commands/api/run.d.ts +6 -0
  4. package/dist/commands/api/run.js +135 -0
  5. package/dist/commands/auth-sessions/load.d.ts +2 -0
  6. package/dist/commands/auth-sessions/load.js +26 -0
  7. package/dist/commands/auth-sessions/run-check.d.ts +2 -0
  8. package/dist/commands/auth-sessions/run-check.js +42 -0
  9. package/dist/commands/auth-sessions/run-create.d.ts +2 -0
  10. package/dist/commands/auth-sessions/run-create.js +75 -0
  11. package/dist/commands/browser/save-state.d.ts +2 -0
  12. package/dist/commands/browser/save-state.js +17 -0
  13. package/dist/commands/browser/start-browser.d.ts +2 -0
  14. package/dist/commands/browser/start-browser.js +14 -0
  15. package/dist/commands/build.d.ts +2 -0
  16. package/dist/commands/build.js +80 -0
  17. package/dist/commands/common/browserUtils.d.ts +14 -0
  18. package/dist/commands/common/browserUtils.js +58 -0
  19. package/dist/commands/common/getDefaultExportFromFile.d.ts +1 -0
  20. package/dist/commands/common/getDefaultExportFromFile.js +19 -0
  21. package/dist/commands/common/getFirstLineNumber.d.ts +9 -0
  22. package/dist/commands/common/getFirstLineNumber.js +103 -0
  23. package/{src/commands/common/getFirstLineNumber.test.ts → dist/commands/common/getFirstLineNumber.test.js} +75 -121
  24. package/dist/commands/common/sendMessageToClient.d.ts +1 -0
  25. package/dist/commands/common/sendMessageToClient.js +10 -0
  26. package/dist/commands/common/utils/fileUtils.d.ts +6 -0
  27. package/dist/commands/common/utils/fileUtils.js +33 -0
  28. package/dist/commands/common/utils/settings.d.ts +2 -0
  29. package/dist/commands/common/utils/settings.js +28 -0
  30. package/dist/commands/common/utils/webTemplate.d.ts +1 -0
  31. package/dist/commands/common/utils/webTemplate.js +31 -0
  32. package/dist/commands/testing/saveVisibleHtml.d.ts +1 -0
  33. package/dist/commands/testing/saveVisibleHtml.js +24 -0
  34. package/dist/commands/ts-check.d.ts +2 -0
  35. package/dist/commands/ts-check.js +54 -0
  36. package/dist/common/Logger/Logger/index.d.ts +12 -0
  37. package/dist/common/Logger/Logger/index.js +60 -0
  38. package/{src/common/Logger/Logger/types.ts → dist/common/Logger/Logger/types.d.ts} +4 -5
  39. package/dist/common/Logger/Logger/types.js +5 -0
  40. package/dist/common/Logger/index.d.ts +12 -0
  41. package/dist/common/Logger/index.js +60 -0
  42. package/{src/common/Logger/types.ts → dist/common/Logger/types.d.ts} +4 -5
  43. package/dist/common/Logger/types.js +5 -0
  44. package/dist/common/asyncLocalStorage/index.d.ts +16 -0
  45. package/dist/common/asyncLocalStorage/index.js +17 -0
  46. package/dist/common/cleanEnvironmentVariables.d.ts +1 -0
  47. package/dist/common/cleanEnvironmentVariables.js +16 -0
  48. package/dist/common/constants.d.ts +1 -0
  49. package/dist/common/constants.js +7 -0
  50. package/dist/common/contextStorageStateHelpers.d.ts +15 -0
  51. package/dist/common/contextStorageStateHelpers.js +48 -0
  52. package/dist/common/getPlaywrightConstructs.d.ts +28 -0
  53. package/dist/common/getPlaywrightConstructs.js +175 -0
  54. package/dist/common/jwtTokenManager.d.ts +16 -0
  55. package/dist/common/jwtTokenManager.js +81 -0
  56. package/dist/common/settingsSchema.d.ts +19 -0
  57. package/dist/common/settingsSchema.js +17 -0
  58. package/dist/common/telemetry.d.ts +3 -0
  59. package/dist/common/telemetry.js +32 -0
  60. package/dist/index.d.ts +4 -0
  61. package/dist/index.js +69 -0
  62. package/dist/runtime/RunError.d.ts +5 -0
  63. package/dist/runtime/RunError.js +19 -0
  64. package/dist/runtime/downloadDirectory.d.ts +1 -0
  65. package/dist/runtime/downloadDirectory.js +19 -0
  66. package/dist/runtime/enums.d.js +5 -0
  67. package/dist/runtime/enums.js +18 -0
  68. package/dist/runtime/executionHelpers.test.js +53 -0
  69. package/dist/runtime/export.d.js +5 -0
  70. package/dist/runtime/extendPayload.d.ts +2 -0
  71. package/dist/runtime/extendPayload.js +21 -0
  72. package/dist/runtime/extendTimeout.d.ts +1 -0
  73. package/dist/runtime/extendTimeout.js +26 -0
  74. package/{src/runtime/index.ts → dist/runtime/index.d.ts} +1 -3
  75. package/dist/runtime/index.js +53 -0
  76. package/dist/runtime/requestMoreInfo.d.ts +17 -0
  77. package/dist/runtime/requestMoreInfo.js +25 -0
  78. package/dist/runtime/runInfo.d.ts +2 -0
  79. package/dist/runtime/runInfo.js +21 -0
  80. package/package.json +1 -1
  81. package/.vscode/extensions.json +0 -3
  82. package/.vscode/launch.json +0 -102
  83. package/.vscode/settings.json +0 -12
  84. package/playwright.config.ts +0 -48
  85. package/src/commands/api/run.ts +0 -225
  86. package/src/commands/auth-sessions/load.ts +0 -42
  87. package/src/commands/auth-sessions/run-check.ts +0 -70
  88. package/src/commands/auth-sessions/run-create.ts +0 -124
  89. package/src/commands/browser/save-state.ts +0 -22
  90. package/src/commands/browser/start-browser.ts +0 -17
  91. package/src/commands/build.ts +0 -125
  92. package/src/commands/common/browserUtils.ts +0 -80
  93. package/src/commands/common/getDefaultExportFromFile.ts +0 -13
  94. package/src/commands/common/getFirstLineNumber.ts +0 -146
  95. package/src/commands/common/sendMessageToClient.ts +0 -8
  96. package/src/commands/common/utils/fileUtils.ts +0 -25
  97. package/src/commands/common/utils/settings.ts +0 -23
  98. package/src/commands/common/utils/webTemplate.ts +0 -46
  99. package/src/commands/testing/saveVisibleHtml.ts +0 -29
  100. package/src/commands/ts-check.ts +0 -88
  101. package/src/common/Logger/Logger/index.ts +0 -64
  102. package/src/common/Logger/index.ts +0 -64
  103. package/src/common/asyncLocalStorage/index.ts +0 -29
  104. package/src/common/cleanEnvironmentVariables.ts +0 -13
  105. package/src/common/constants.ts +0 -1
  106. package/src/common/contextStorageStateHelpers.ts +0 -71
  107. package/src/common/getPlaywrightConstructs.ts +0 -283
  108. package/src/common/jwtTokenManager.ts +0 -111
  109. package/src/common/settingsSchema.ts +0 -16
  110. package/src/common/telemetry.ts +0 -49
  111. package/src/index.ts +0 -14
  112. package/src/runtime/RunError.ts +0 -16
  113. package/src/runtime/downloadDirectory.ts +0 -14
  114. package/src/runtime/enums.ts +0 -11
  115. package/src/runtime/executionHelpers.test.ts +0 -70
  116. package/src/runtime/extendPayload.ts +0 -22
  117. package/src/runtime/extendTimeout.ts +0 -32
  118. package/src/runtime/requestMoreInfo.ts +0 -40
  119. package/src/runtime/runInfo.ts +0 -19
  120. package/vite.config.ts +0 -17
  121. /package/{src → dist}/common/assets/browser_scripts.js +0 -0
  122. /package/{src → dist}/runtime/enums.d.ts +0 -0
  123. /package/{src → dist}/runtime/export.d.ts +0 -0
@@ -0,0 +1,103 @@
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,33 +1,30 @@
1
- import { expect, describe, it, beforeAll, afterAll } from "vitest";
2
- import getFirstLineNumber from "./getFirstLineNumber";
3
- import * as fs from "fs";
4
- import * as path from "path";
5
-
6
- describe("getFirstLineNumber", () => {
1
+ "use strict";
2
+
3
+ var _vitest = require("vitest");
4
+ var _getFirstLineNumber = _interopRequireDefault(require("./getFirstLineNumber"));
5
+ var fs = _interopRequireWildcard(require("fs"));
6
+ var path = _interopRequireWildcard(require("path"));
7
+ 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); }
8
+ 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; }
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ (0, _vitest.describe)("getFirstLineNumber", () => {
7
11
  const testFilesDir = path.join(__dirname, "testFiles");
8
- const createTestFile = (fileName: string, content: string) => {
12
+ const createTestFile = (fileName, content) => {
9
13
  const filePath = path.join(testFilesDir, fileName);
10
14
  fs.writeFileSync(filePath, content);
11
15
  return filePath;
12
16
  };
13
-
14
- beforeAll(() => {
17
+ (0, _vitest.beforeAll)(() => {
15
18
  if (!fs.existsSync(testFilesDir)) {
16
19
  fs.mkdirSync(testFilesDir);
17
20
  }
18
21
  });
19
-
20
- afterAll(() => {
21
- fs.readdirSync(testFilesDir).forEach((file) =>
22
- fs.unlinkSync(path.join(testFilesDir, file))
23
- );
22
+ (0, _vitest.afterAll)(() => {
23
+ fs.readdirSync(testFilesDir).forEach(file => fs.unlinkSync(path.join(testFilesDir, file)));
24
24
  fs.rmdirSync(testFilesDir);
25
25
  });
26
-
27
- it("correctly identifies first line in a default exported named function", async () => {
28
- const filePath = createTestFile(
29
- "defaultFunction.ts",
30
- `import {
26
+ (0, _vitest.it)("correctly identifies first line in a default exported named function", async () => {
27
+ const filePath = createTestFile("defaultFunction.ts", `import {
31
28
  EnhancedPlaywrightPage,
32
29
  EnhancedPlaywrightBrowserContext,
33
30
  ExecutionHelpers,
@@ -48,16 +45,12 @@ describe("getFirstLineNumber", () => {
48
45
  await page.getByLabel("Search Wikipedia").press("Enter");
49
46
  return { done: "true", name: "custom name from api1" };
50
47
  }
51
- `
52
- );
53
- const result = await getFirstLineNumber(filePath);
54
- expect(result.lineNumber).toBe(4); // 4 is the index after it's compiled to commonjs
48
+ `);
49
+ const result = await (0, _getFirstLineNumber.default)(filePath);
50
+ (0, _vitest.expect)(result.lineNumber).toBe(4);
55
51
  });
56
-
57
- it("correctly identifies first line in a default exported anonymous function", async () => {
58
- const filePath = createTestFile(
59
- "defaultFunction.ts",
60
- `import {
52
+ (0, _vitest.it)("correctly identifies first line in a default exported anonymous function", async () => {
53
+ const filePath = createTestFile("defaultFunction.ts", `import {
61
54
  EnhancedPlaywrightPage,
62
55
  EnhancedPlaywrightBrowserContext,
63
56
  ExecutionHelpers,
@@ -78,16 +71,12 @@ describe("getFirstLineNumber", () => {
78
71
  await page.getByLabel("Search Wikipedia").press("Enter");
79
72
  return { done: "true", name: "custom name from api1" };
80
73
  }
81
- `
82
- );
83
- const result = await getFirstLineNumber(filePath);
84
- expect(result.lineNumber).toBe(4);
74
+ `);
75
+ const result = await (0, _getFirstLineNumber.default)(filePath);
76
+ (0, _vitest.expect)(result.lineNumber).toBe(4);
85
77
  });
86
-
87
- it("correctly identifies first line in a default exported function identifier", async () => {
88
- const filePath = createTestFile(
89
- "defaultFunction.ts",
90
- `import {
78
+ (0, _vitest.it)("correctly identifies first line in a default exported function identifier", async () => {
79
+ const filePath = createTestFile("defaultFunction.ts", `import {
91
80
  EnhancedPlaywrightPage,
92
81
  EnhancedPlaywrightBrowserContext,
93
82
  ExecutionHelpers,
@@ -109,16 +98,12 @@ describe("getFirstLineNumber", () => {
109
98
  return { done: "true", name: "custom name from api1" };
110
99
  }
111
100
  export default runApi;
112
- `
113
- );
114
- const result = await getFirstLineNumber(filePath);
115
- expect(result.lineNumber).toBe(4);
101
+ `);
102
+ const result = await (0, _getFirstLineNumber.default)(filePath);
103
+ (0, _vitest.expect)(result.lineNumber).toBe(4);
116
104
  });
117
-
118
- it("correctly identifies first line in a file with multiple exports including a default function", async () => {
119
- const filePath = createTestFile(
120
- "multipleExports.ts",
121
- `import {
105
+ (0, _vitest.it)("correctly identifies first line in a file with multiple exports including a default function", async () => {
106
+ const filePath = createTestFile("multipleExports.ts", `import {
122
107
  EnhancedPlaywrightPage,
123
108
  EnhancedPlaywrightBrowserContext,
124
109
  ExecutionHelpers,
@@ -140,16 +125,12 @@ describe("getFirstLineNumber", () => {
140
125
  await page.getByLabel("Search Wikipedia").press("Enter");
141
126
  return { done: "true", name: "custom name from api1" };
142
127
  }
143
- export default runApi;`
144
- );
145
- const result = await getFirstLineNumber(filePath);
146
- expect(result.lineNumber).toBe(7);
128
+ export default runApi;`);
129
+ const result = await (0, _getFirstLineNumber.default)(filePath);
130
+ (0, _vitest.expect)(result.lineNumber).toBe(7);
147
131
  });
148
-
149
- it("correctly identifies first line in a default exported arrow function identifier", async () => {
150
- const filePath = createTestFile(
151
- "multipleExports.ts",
152
- `import {
132
+ (0, _vitest.it)("correctly identifies first line in a default exported arrow function identifier", async () => {
133
+ const filePath = createTestFile("multipleExports.ts", `import {
153
134
  EnhancedPlaywrightPage,
154
135
  EnhancedPlaywrightBrowserContext,
155
136
  ExecutionHelpers,
@@ -170,16 +151,12 @@ describe("getFirstLineNumber", () => {
170
151
  await page.getByLabel("Search Wikipedia").press("Enter");
171
152
  return { done: "true", name: "custom name from api1" };
172
153
  }
173
- export default runApi;`
174
- );
175
- const result = await getFirstLineNumber(filePath);
176
- expect(result.lineNumber).toBe(4);
154
+ export default runApi;`);
155
+ const result = await (0, _getFirstLineNumber.default)(filePath);
156
+ (0, _vitest.expect)(result.lineNumber).toBe(4);
177
157
  });
178
-
179
- it("correctly identifies first line in a default exported anonymous arrow function", async () => {
180
- const filePath = createTestFile(
181
- "multipleExports.ts",
182
- `import {
158
+ (0, _vitest.it)("correctly identifies first line in a default exported anonymous arrow function", async () => {
159
+ const filePath = createTestFile("multipleExports.ts", `import {
183
160
  EnhancedPlaywrightPage,
184
161
  EnhancedPlaywrightBrowserContext,
185
162
  ExecutionHelpers,
@@ -199,76 +176,53 @@ describe("getFirstLineNumber", () => {
199
176
  await page.getByLabel("Search Wikipedia").type(params.name);
200
177
  await page.getByLabel("Search Wikipedia").press("Enter");
201
178
  return { done: "true", name: "custom name from api1" };
202
- };`
203
- );
204
- const result = await getFirstLineNumber(filePath);
205
- expect(result.lineNumber).toBe(4);
179
+ };`);
180
+ const result = await (0, _getFirstLineNumber.default)(filePath);
181
+ (0, _vitest.expect)(result.lineNumber).toBe(4);
206
182
  });
207
-
208
- it("identifies first executable line in a default exported arrow function", async () => {
209
- const filePath = createTestFile(
210
- "defaultArrowFunction.ts",
211
- `export default () => {
183
+ (0, _vitest.it)("identifies first executable line in a default exported arrow function", async () => {
184
+ const filePath = createTestFile("defaultArrowFunction.ts", `export default () => {
212
185
  console.log("Hello, Arrow World!");
213
- };`
214
- );
215
- const result = await getFirstLineNumber(filePath);
216
- expect(result.lineNumber).toBe(4);
186
+ };`);
187
+ const result = await (0, _getFirstLineNumber.default)(filePath);
188
+ (0, _vitest.expect)(result.lineNumber).toBe(4);
217
189
  });
218
-
219
- it("identifies first executable line within nested functions of a default export", async () => {
220
- const filePath = createTestFile(
221
- "nestedFunctions.ts",
222
- `const x = 4;
190
+ (0, _vitest.it)("identifies first executable line within nested functions of a default export", async () => {
191
+ const filePath = createTestFile("nestedFunctions.ts", `const x = 4;
223
192
  export default function() {
224
193
  const nested = (x) => console.log("Nested function call");
225
194
  nested(x);
226
- }`
227
- );
228
- const result = await getFirstLineNumber(filePath);
229
- expect(result.lineNumber).toBe(5);
195
+ }`);
196
+ const result = await (0, _getFirstLineNumber.default)(filePath);
197
+ (0, _vitest.expect)(result.lineNumber).toBe(5);
230
198
  });
231
-
232
- it("handles async default exported function correctly", async () => {
233
- const filePath = createTestFile(
234
- "asyncDefaultFunction.ts",
235
- `export default async function() {
199
+ (0, _vitest.it)("handles async default exported function correctly", async () => {
200
+ const filePath = createTestFile("asyncDefaultFunction.ts", `export default async function() {
236
201
  await Promise.resolve(console.log("Async Hello, World!"));
237
- }`
238
- );
239
- const result = await getFirstLineNumber(filePath);
240
- expect(result.lineNumber).toBe(4);
202
+ }`);
203
+ const result = await (0, _getFirstLineNumber.default)(filePath);
204
+ (0, _vitest.expect)(result.lineNumber).toBe(4);
241
205
  });
242
-
243
- it("returns -1 for a default exported class", async () => {
244
- const filePath = createTestFile(
245
- "defaultClass.ts",
246
- `export default class MyClass {
206
+ (0, _vitest.it)("returns -1 for a default exported class", async () => {
207
+ const filePath = createTestFile("defaultClass.ts", `export default class MyClass {
247
208
  constructor() {}
248
- }`
249
- );
250
- const result = await getFirstLineNumber(filePath);
251
- expect(result.lineNumber).toBe(-1);
209
+ }`);
210
+ const result = await (0, _getFirstLineNumber.default)(filePath);
211
+ (0, _vitest.expect)(result.lineNumber).toBe(-1);
252
212
  });
253
-
254
- it("returns -1 for a default exported variable", async () => {
213
+ (0, _vitest.it)("returns -1 for a default exported variable", async () => {
255
214
  const filePath = createTestFile("defaultVariable.ts", `export default 42;`);
256
- const result = await getFirstLineNumber(filePath);
257
- expect(result.lineNumber).toBe(-1);
215
+ const result = await (0, _getFirstLineNumber.default)(filePath);
216
+ (0, _vitest.expect)(result.lineNumber).toBe(-1);
258
217
  });
259
-
260
- it("returns -1 when there is no default export", async () => {
261
- const filePath = createTestFile(
262
- "noDefaultExport.ts",
263
- `export const foo = () => console.log("bar");`
264
- );
265
- const result = await getFirstLineNumber(filePath);
266
- expect(result.lineNumber).toBe(-1);
218
+ (0, _vitest.it)("returns -1 when there is no default export", async () => {
219
+ const filePath = createTestFile("noDefaultExport.ts", `export const foo = () => console.log("bar");`);
220
+ const result = await (0, _getFirstLineNumber.default)(filePath);
221
+ (0, _vitest.expect)(result.lineNumber).toBe(-1);
267
222
  });
268
-
269
- it("returns -1 for an empty file", async () => {
223
+ (0, _vitest.it)("returns -1 for an empty file", async () => {
270
224
  const filePath = createTestFile("emptyFile.ts", ``);
271
- const result = await getFirstLineNumber(filePath);
272
- expect(result.lineNumber).toBe(-1);
225
+ const result = await (0, _getFirstLineNumber.default)(filePath);
226
+ (0, _vitest.expect)(result.lineNumber).toBe(-1);
273
227
  });
274
- });
228
+ });
@@ -0,0 +1 @@
1
+ export declare const sendBreakPointOnToClient: (sourceFileName: string, lineNumber: number) => void;
@@ -0,0 +1,10 @@
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;
@@ -0,0 +1,6 @@
1
+ export declare function getFullPathInProject(...paths: string[]): string;
2
+ export declare function listProjectFilesAndFolders(): Promise<{
3
+ type: "Folder" | "File";
4
+ fullPath: string;
5
+ name: string;
6
+ }[]>;
@@ -0,0 +1,33 @@
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
+ }
@@ -0,0 +1,2 @@
1
+ import { IntunedSettings } from "../../../common/settingsSchema";
2
+ export declare function getSettings(): Promise<IntunedSettings>;
@@ -0,0 +1,28 @@
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
+ }
@@ -0,0 +1 @@
1
+ export declare const moveWebTemplateFiles: () => Promise<void>;
@@ -0,0 +1,31 @@
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;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var fs = _interopRequireWildcard(require("fs-extra"));
4
+ var _dotenv = _interopRequireDefault(require("dotenv"));
5
+ var _getPlaywrightConstructs = require("../../common/getPlaywrightConstructs");
6
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7
+ 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); }
8
+ 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; }
9
+ _dotenv.default.config({
10
+ path: `.env`
11
+ });
12
+ async function main() {
13
+ const {
14
+ page
15
+ } = await (0, _getPlaywrightConstructs.getPlaywrightConstructsForMode)("playwright", undefined);
16
+ await page.goto("https://www.marriott.com/search/findHotels.mi?roomTypeCode=&recordsPerPage=20&autoSuggestItemType=&destinationAddress.types=locality,political&destinationAddress.latitude=47.6061389&propertyCode=&destinationAddress.stateProvinceShort=&isInternalSearch=true&destinationAddress.cityPopulation=&vsInitialRequest=false&searchType=InCity&destinationAddress.locality=&showAddressPin=&miniStoreFormSubmit=&destinationAddress.stateProvinceDisplayName=&destinationAddress.destinationPageDestinationAddress=&countryName=&destinationAddress.stateProvince=WA&searchRadius=50.0&singleSearchAutoSuggest=Unmatched&missingcheckInDateMsg=Please+enter+a+check-in+date.&destinationAddress.placeId=ChIJVTPokywQkFQRmtVEaUZlJRA&is-hotelsnearme-clicked=false&destinationAddress.addressline1=&airportName=&for-hotels-nearme=Near&missingcheckOutDateMsg=Please+enter+a+check-out+date.&suggestionsPropertyCode=&pageType=advanced&destinationAddress.country=US&destinationAddress.name=&poiCity=&destinationAddress.countryShort=&marriottBrands=&poiName=&destinationAddress.address=Seattle,+WA,+USA&search-countryRegion=&collapseAccordian=is-hidden&singleSearch=true&destinationAddress.cityPopulationDensity=&destinationAddress.secondaryText=WA,+USA&destinationAddress.postalCode=&destinationAddress.city=Seattle&destinationAddress.mainText=Seattle&airportCode=&isTransient=true&destinationAddress.longitude=-122.3328481&initialRequest=false&destinationAddress.website=https://maps.google.com/?q=Seattle,+WA,+USA&ftid=0x5490102c93e83355:0x102565466944d59a&search-locality=&dimensions=0&roomTypeCode=&propertyCode=&flexibleDateSearchRateDisplay=false&propertyName=&isSearch=true&marriottRewardsNumber=&isRateCalendar=false&incentiveType_Number=&incentiveType=&flexibleDateLowestRateMonth=&flexibleDateLowestRateDate=&marrOfferId=&isMultiRateSearch=&multiRateMaxCount=&multiRateCorpCodes=&useMultiRateRewardsPoints=&multiRateClusterCodes=&multiRateCorpCodesEntered=&lowestRegularRate=&js-location-nearme-values=&destinationAddress.destination=Seattle,+WA,+USA&fromToDate=10/07/2023&fromToDate_submit=10/08/2023&fromDate=10/07/2023&toDate=10/08/2023&toDateDefaultFormat=10/08/2023&fromDateDefaultFormat=10/07/2023&flexibleDateSearch=false&isHideFlexibleDateCalendar=false&t-start=2023-10-07&t-end=2023-10-08&lengthOfStay=1&roomCountBox=1+Room&roomCount=1&guestCountBox=1+Adult+Per+Room&numAdultsPerRoom=1&childrenCountBox=0+Children+Per+Room&childrenCount=0&childrenAges=&clusterCode=none&corporateCode=&useRewardsPoints=true&view=list#/0/", {
17
+ waitUntil: "load"
18
+ });
19
+ await page.waitForTimeout(10000);
20
+ const html = "";
21
+ await fs.writeFile("./htmlFiles/marriott.html", html);
22
+ process.exit();
23
+ }
24
+ void main();
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,54 @@
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);
@@ -0,0 +1,12 @@
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 {};