@appland/appmap 3.20.0 → 3.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/built/appmap.html +1 -1
  3. package/built/main.js.map +1 -1
  4. package/built/package.json +2 -1
  5. package/built/src/cmds/record/action/cancelRecording.js +14 -0
  6. package/built/src/cmds/record/action/cancelRecording.js.map +1 -0
  7. package/built/src/cmds/record/action/configureHostAndPort.js +35 -0
  8. package/built/src/cmds/record/action/configureHostAndPort.js.map +1 -0
  9. package/built/src/cmds/record/action/configureRemainingRequestOptions.js +36 -0
  10. package/built/src/cmds/record/action/configureRemainingRequestOptions.js.map +1 -0
  11. package/built/src/cmds/record/action/detectProcessCharacteristics.js +60 -0
  12. package/built/src/cmds/record/action/detectProcessCharacteristics.js.map +1 -0
  13. package/built/src/cmds/record/action/guessTestCommands.js +26 -0
  14. package/built/src/cmds/record/action/guessTestCommands.js.map +1 -0
  15. package/built/src/cmds/record/action/printAppMapCount.js +18 -0
  16. package/built/src/cmds/record/action/printAppMapCount.js.map +1 -0
  17. package/built/src/cmds/record/{createRecording.js → action/saveRecording.js} +9 -24
  18. package/built/src/cmds/record/action/saveRecording.js.map +1 -0
  19. package/built/src/cmds/record/action/startRecording.js +20 -0
  20. package/built/src/cmds/record/action/startRecording.js.map +1 -0
  21. package/built/src/cmds/record/action/startTestCases.js +24 -0
  22. package/built/src/cmds/record/action/startTestCases.js.map +1 -0
  23. package/built/src/cmds/record/action/stopRecording.js +11 -0
  24. package/built/src/cmds/record/action/stopRecording.js.map +1 -0
  25. package/built/src/cmds/record/configuration.js +138 -0
  26. package/built/src/cmds/record/configuration.js.map +1 -0
  27. package/built/src/cmds/record/prompt/obtainTestCommands.js +73 -0
  28. package/built/src/cmds/record/prompt/obtainTestCommands.js.map +1 -0
  29. package/built/src/cmds/record/prompt/recordingInProgress.js +29 -0
  30. package/built/src/cmds/record/prompt/recordingInProgress.js.map +1 -0
  31. package/built/src/cmds/record/record.js +61 -12
  32. package/built/src/cmds/record/record.js.map +1 -1
  33. package/built/src/cmds/record/state/abort.js +8 -0
  34. package/built/src/cmds/record/state/abort.js.map +1 -0
  35. package/built/src/cmds/record/state/agentAvailableAndReady.js +14 -0
  36. package/built/src/cmds/record/state/agentAvailableAndReady.js.map +1 -0
  37. package/built/src/cmds/record/state/agentIsRecording.js +45 -0
  38. package/built/src/cmds/record/state/agentIsRecording.js.map +1 -0
  39. package/built/src/cmds/record/state/agentNotAvailable.js +41 -0
  40. package/built/src/cmds/record/state/agentNotAvailable.js.map +1 -0
  41. package/built/src/cmds/record/state/agentProcessNotRunning.js +30 -0
  42. package/built/src/cmds/record/state/agentProcessNotRunning.js.map +1 -0
  43. package/built/src/cmds/record/state/initial.js +41 -0
  44. package/built/src/cmds/record/state/initial.js.map +1 -0
  45. package/built/src/cmds/record/state/record_remote.js +27 -0
  46. package/built/src/cmds/record/state/record_remote.js.map +1 -0
  47. package/built/src/cmds/record/state/record_test.js +20 -0
  48. package/built/src/cmds/record/state/record_test.js.map +1 -0
  49. package/built/src/cmds/record/state/recordingInProgress.js +14 -0
  50. package/built/src/cmds/record/state/recordingInProgress.js.map +1 -0
  51. package/built/src/cmds/record/state/recordingStopped.js +12 -0
  52. package/built/src/cmds/record/state/recordingStopped.js.map +1 -0
  53. package/built/src/cmds/record/state/testCasesComplete.js +15 -0
  54. package/built/src/cmds/record/state/testCasesComplete.js.map +1 -0
  55. package/built/src/cmds/record/state/testCasesRunning.js +13 -0
  56. package/built/src/cmds/record/state/testCasesRunning.js.map +1 -0
  57. package/built/src/cmds/record/state/testCommandsAvailable.js +14 -0
  58. package/built/src/cmds/record/state/testCommandsAvailable.js.map +1 -0
  59. package/built/src/cmds/record/state/testCommandsNeeded.js +13 -0
  60. package/built/src/cmds/record/state/testCommandsNeeded.js.map +1 -0
  61. package/built/src/cmds/record/test/areTestCommandsConfigured.js +32 -0
  62. package/built/src/cmds/record/test/areTestCommandsConfigured.js.map +1 -0
  63. package/built/src/cmds/record/test/isAgentAvailable.js +24 -0
  64. package/built/src/cmds/record/test/isAgentAvailable.js.map +1 -0
  65. package/built/src/cmds/record/test/isRecordingInProgress.js +13 -0
  66. package/built/src/cmds/record/test/isRecordingInProgress.js.map +1 -0
  67. package/built/src/cmds/record/testCaseRecording.js +112 -0
  68. package/built/src/cmds/record/testCaseRecording.js.map +1 -0
  69. package/built/src/cmds/record/types/exitCode.js +10 -0
  70. package/built/src/cmds/record/types/exitCode.js.map +1 -0
  71. package/built/src/cmds/record/types/fileName.js +3 -0
  72. package/built/src/cmds/record/types/fileName.js.map +1 -0
  73. package/built/src/cmds/record/types/remoteRecordingStatus.js +3 -0
  74. package/built/src/cmds/record/types/remoteRecordingStatus.js.map +1 -0
  75. package/built/src/cmds/record/types/state.js +3 -0
  76. package/built/src/cmds/record/types/state.js.map +1 -0
  77. package/built/src/cmds/userInteraction.js +19 -6
  78. package/built/src/cmds/userInteraction.js.map +1 -1
  79. package/built/src/telemetry.js.map +1 -1
  80. package/built/src/utils.js +1 -1
  81. package/built/src/utils.js.map +1 -1
  82. package/package.json +4 -3
  83. package/built/src/cmds/record/configureConnection.js +0 -16
  84. package/built/src/cmds/record/configureConnection.js.map +0 -1
  85. package/built/src/cmds/record/configureHostAndPort.js +0 -38
  86. package/built/src/cmds/record/configureHostAndPort.js.map +0 -1
  87. package/built/src/cmds/record/configureRemainingRequestOptions.js +0 -28
  88. package/built/src/cmds/record/configureRemainingRequestOptions.js.map +0 -1
  89. package/built/src/cmds/record/confirmProcessCharacteristics.js +0 -75
  90. package/built/src/cmds/record/confirmProcessCharacteristics.js.map +0 -1
  91. package/built/src/cmds/record/createRecording.js.map +0 -1
  92. package/built/src/cmds/record/intro.js +0 -22
  93. package/built/src/cmds/record/intro.js.map +0 -1
  94. package/built/src/cmds/record/ready.js +0 -19
  95. package/built/src/cmds/record/ready.js.map +0 -1
  96. package/built/src/cmds/record/testConnection.js +0 -35
  97. package/built/src/cmds/record/testConnection.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appland/appmap",
3
- "version": "3.20.0",
3
+ "version": "3.23.0",
4
4
  "description": "",
5
5
  "bin": "built/src/cli.js",
6
6
  "publishConfig": {
@@ -32,6 +32,7 @@
32
32
  "@types/jsdom": "^16.2.13",
33
33
  "@types/node": "^16.6.2",
34
34
  "@types/sinon": "^10.0.2",
35
+ "@types/tmp": "^0.2.3",
35
36
  "@types/w3c-xmlserializer": "^2.0.2",
36
37
  "babel-loader": "^8.2.2",
37
38
  "copy-webpack-plugin": "^9.0.1",
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const userInteraction_1 = __importDefault(require("../../userInteraction"));
7
+ const configuration_1 = require("../configuration");
8
+ const remoteRecording_1 = __importDefault(require("../remoteRecording"));
9
+ async function cancelRecording() {
10
+ await new remoteRecording_1.default(await (0, configuration_1.requestOptions)()).stop();
11
+ userInteraction_1.default.success('The recording has been cancelled.');
12
+ }
13
+ exports.default = cancelRecording;
14
+ //# sourceMappingURL=cancelRecording.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancelRecording.js","sourceRoot":"","sources":["../../../../../src/cmds/record/action/cancelRecording.ts"],"names":[],"mappings":";;;;;AAAA,4EAAuC;AACvC,oDAAkD;AAClD,yEAAiD;AAElC,KAAK,UAAU,eAAe;IAC3C,MAAM,IAAI,yBAAe,CAAC,MAAM,IAAA,8BAAc,GAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACzD,yBAAE,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAClD,CAAC;AAHD,kCAGC"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const userInteraction_1 = __importDefault(require("../../userInteraction"));
7
+ const configuration_1 = require("../configuration");
8
+ async function configureHostAndPort() {
9
+ const defaultHostname = await (0, configuration_1.readSetting)('remote_recording.host', 'localhost');
10
+ const { hostname } = await userInteraction_1.default.prompt({
11
+ type: 'input',
12
+ name: 'hostname',
13
+ message: 'Enter the hostname that your server is running on:',
14
+ default: defaultHostname,
15
+ });
16
+ if (hostname !== defaultHostname) {
17
+ await (0, configuration_1.writeSetting)('remote_recording.host', hostname);
18
+ }
19
+ let port;
20
+ const defaultPort = await (0, configuration_1.readSetting)('remote_recording.port', 3000);
21
+ while (!port) {
22
+ const { portNumber: answer } = await userInteraction_1.default.prompt({
23
+ type: 'input',
24
+ name: 'portNumber',
25
+ message: 'Enter the port number on which your server is listening:',
26
+ default: defaultPort,
27
+ });
28
+ port = parseInt(answer);
29
+ if (port !== NaN && port !== defaultPort) {
30
+ await (0, configuration_1.writeSetting)('remote_recording.port', port);
31
+ }
32
+ }
33
+ }
34
+ exports.default = configureHostAndPort;
35
+ //# sourceMappingURL=configureHostAndPort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configureHostAndPort.js","sourceRoot":"","sources":["../../../../../src/cmds/record/action/configureHostAndPort.ts"],"names":[],"mappings":";;;;;AAAA,4EAAuC;AACvC,oDAA6D;AAE9C,KAAK,UAAU,oBAAoB;IAChD,MAAM,eAAe,GAAG,MAAM,IAAA,2BAAW,EACvC,uBAAuB,EACvB,WAAW,CACZ,CAAC;IACF,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,yBAAE,CAAC,MAAM,CAAC;QACnC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,oDAAoD;QAC7D,OAAO,EAAE,eAAe;KACzB,CAAC,CAAC;IAEH,IAAI,QAAQ,KAAK,eAAe,EAAE;QAChC,MAAM,IAAA,4BAAY,EAAC,uBAAuB,EAAE,QAAQ,CAAC,CAAC;KACvD;IAED,IAAI,IAAwB,CAAC;IAC7B,MAAM,WAAW,GAAG,MAAM,IAAA,2BAAW,EAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;IACrE,OAAO,CAAC,IAAI,EAAE;QACZ,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,yBAAE,CAAC,MAAM,CAAC;YAC7C,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,0DAA0D;YACnE,OAAO,EAAE,WAAW;SACrB,CAAC,CAAC;QACH,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;QACxB,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,WAAW,EAAE;YACxC,MAAM,IAAA,4BAAY,EAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;SACnD;KACF;AACH,CAAC;AA9BD,uCA8BC"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const userInteraction_1 = __importDefault(require("../../userInteraction"));
7
+ const configuration_1 = require("../configuration");
8
+ async function configureRemainingRequestOptions() {
9
+ const defaultPath = await (0, configuration_1.readConfigOption)('remote_recording.path', '/');
10
+ const { baseURL: path } = await userInteraction_1.default.prompt({
11
+ type: 'input',
12
+ name: 'baseURL',
13
+ message: `Enter the base URL of your application:`,
14
+ default: defaultPath,
15
+ });
16
+ if (path !== defaultPath) {
17
+ await (0, configuration_1.writeConfigOption)('remote_recording.path', path);
18
+ }
19
+ const defaultProtocol = await (0, configuration_1.readConfigOption)('remote_recording.protocol', 'http:');
20
+ const { useSSL } = await userInteraction_1.default.prompt({
21
+ type: 'confirm',
22
+ name: 'useSSL',
23
+ message: 'Does your application require SSL / HTTPS?',
24
+ default: defaultProtocol === 'https:',
25
+ });
26
+ const protocol = useSSL ? 'https:' : 'http:';
27
+ if (protocol !== defaultProtocol) {
28
+ await (0, configuration_1.writeConfigOption)('remote_recording.protocol', protocol);
29
+ }
30
+ const ro = await (0, configuration_1.requestOptions)();
31
+ userInteraction_1.default.progress(`Here's the URL I will use to try and connect to the AppMap agent:\n`);
32
+ userInteraction_1.default.progress(`${ro.protocol}//${ro.hostname}:${ro.port}${ro.path}_appmap/record`);
33
+ userInteraction_1.default.progress('');
34
+ }
35
+ exports.default = configureRemainingRequestOptions;
36
+ //# sourceMappingURL=configureRemainingRequestOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configureRemainingRequestOptions.js","sourceRoot":"","sources":["../../../../../src/cmds/record/action/configureRemainingRequestOptions.ts"],"names":[],"mappings":";;;;;AAAA,4EAAuC;AACvC,oDAM0B;AAEX,KAAK,UAAU,gCAAgC;IAC5D,MAAM,WAAW,GAAG,MAAM,IAAA,gCAAgB,EAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;IACzE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,yBAAE,CAAC,MAAM,CAAC;QACxC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,yCAAyC;QAClD,OAAO,EAAE,WAAW;KACrB,CAAC,CAAC;IAEH,IAAI,IAAI,KAAK,WAAW,EAAE;QACxB,MAAM,IAAA,iCAAiB,EAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;KACxD;IAED,MAAM,eAAe,GAAG,MAAM,IAAA,gCAAgB,EAC5C,2BAA2B,EAC3B,OAAO,CACR,CAAC;IAEF,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,yBAAE,CAAC,MAAM,CAAC;QACjC,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,4CAA4C;QACrD,OAAO,EAAE,eAAe,KAAK,QAAQ;KACtC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;IAC7C,IAAI,QAAQ,KAAK,eAAe,EAAE;QAChC,MAAM,IAAA,iCAAiB,EAAC,2BAA2B,EAAE,QAAQ,CAAC,CAAC;KAChE;IAED,MAAM,EAAE,GAAG,MAAM,IAAA,8BAAc,GAAE,CAAC;IAClC,yBAAE,CAAC,QAAQ,CACT,qEAAqE,CACtE,CAAC;IACF,yBAAE,CAAC,QAAQ,CACT,GAAG,EAAE,CAAC,QAAQ,KAAK,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,gBAAgB,CACpE,CAAC;IACF,yBAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC;AAtCD,mDAsCC"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const userInteraction_1 = __importDefault(require("../../userInteraction"));
7
+ const port_pid_1 = __importDefault(require("port-pid"));
8
+ const ps_node_1 = __importDefault(require("ps-node"));
9
+ const configuration_1 = require("../configuration");
10
+ async function detectProcessCharacteristics() {
11
+ const ro = await (0, configuration_1.requestOptions)();
12
+ if (ro.hostname !== 'localhost') {
13
+ return false;
14
+ }
15
+ userInteraction_1.default.status = `Looking for your application process on port ${ro.port}...`;
16
+ const printPid = async (pid) => {
17
+ return new Promise((resolve) => {
18
+ ps_node_1.default.lookup({ pid }, function (err, resultList) {
19
+ if (err) {
20
+ userInteraction_1.default.error(`Process ${pid} not found: ${err}`);
21
+ resolve();
22
+ }
23
+ const process = resultList[0];
24
+ if (process) {
25
+ userInteraction_1.default.success(process.arguments.join(' '));
26
+ resolve();
27
+ }
28
+ else {
29
+ userInteraction_1.default.error(`Process ${pid} not found`);
30
+ resolve();
31
+ }
32
+ });
33
+ });
34
+ };
35
+ const start = new Date().getTime();
36
+ const pids = await (0, port_pid_1.default)(ro.port).then(async (pids) => {
37
+ if (pids && pids.tcp.length > 0) {
38
+ await Promise.all(pids.tcp.map(printPid));
39
+ return pids;
40
+ }
41
+ });
42
+ if (!pids) {
43
+ userInteraction_1.default.error();
44
+ userInteraction_1.default.progress('');
45
+ return false;
46
+ }
47
+ async function confirm() {
48
+ const { looksGood } = await userInteraction_1.default.prompt({
49
+ type: 'confirm',
50
+ name: 'looksGood',
51
+ message: `Does this look like your application?`,
52
+ default: 'y',
53
+ });
54
+ return looksGood;
55
+ }
56
+ userInteraction_1.default.progress('');
57
+ return !!pids && (await confirm());
58
+ }
59
+ exports.default = detectProcessCharacteristics;
60
+ //# sourceMappingURL=detectProcessCharacteristics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detectProcessCharacteristics.js","sourceRoot":"","sources":["../../../../../src/cmds/record/action/detectProcessCharacteristics.ts"],"names":[],"mappings":";;;;;AAAA,4EAAuC;AACvC,wDAA+B;AAC/B,sDAAyB;AACzB,oDAAkD;AAEnC,KAAK,UAAU,4BAA4B;IACxD,MAAM,EAAE,GAAG,MAAM,IAAA,8BAAc,GAAE,CAAC;IAClC,IAAI,EAAE,CAAC,QAAQ,KAAK,WAAW,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IAED,yBAAE,CAAC,MAAM,GAAG,gDAAgD,EAAE,CAAC,IAAI,KAAK,CAAC;IAEzE,MAAM,QAAQ,GAAG,KAAK,EAAE,GAAW,EAAiB,EAAE;QACpD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,iBAAE,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,UAAU,GAAQ,EAAE,UAAiB;gBACtD,IAAI,GAAG,EAAE;oBACP,yBAAE,CAAC,KAAK,CAAC,WAAW,GAAG,eAAe,GAAG,EAAE,CAAC,CAAC;oBAC7C,OAAO,EAAE,CAAC;iBACX;gBAED,MAAM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AAI,CAAC,MAAM,OAAO,EAAE,CAAC,CAAC;AACrC,CAAC;AA7DD,+CA6DC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../../../utils");
4
+ const RubyEnv = { APPMAP: 'true', DISABLE_SPRING: 'true' };
5
+ const TestCommands = {
6
+ 'Gemfile/spec': {
7
+ env: RubyEnv,
8
+ command: 'bundle exec rspec',
9
+ },
10
+ 'Gemfile/test': {
11
+ env: RubyEnv,
12
+ command: 'bundle exec rake test',
13
+ },
14
+ 'pom.xml': {
15
+ command: 'mvn test',
16
+ env: {},
17
+ },
18
+ };
19
+ async function guessTestCommands() {
20
+ const pathExists = await Promise.all(Object.keys(TestCommands).map(async (path) => await (0, utils_1.exists)(path)));
21
+ return Object.keys(TestCommands)
22
+ .filter((_, idx) => pathExists[idx])
23
+ .map((path) => TestCommands[path]);
24
+ }
25
+ exports.default = guessTestCommands;
26
+ //# sourceMappingURL=guessTestCommands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guessTestCommands.js","sourceRoot":"","sources":["../../../../../src/cmds/record/action/guessTestCommands.ts"],"names":[],"mappings":";;AAAA,0CAAiD;AAIjD,MAAM,OAAO,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC;AAE3D,MAAM,YAAY,GAAgC;IAChD,cAAc,EAAE;QACd,GAAG,EAAE,OAAO;QACZ,OAAO,EAAE,mBAAmB;KAC7B;IACD,cAAc,EAAE;QACd,GAAG,EAAE,OAAO;QACZ,OAAO,EAAE,uBAAuB;KACjC;IACD,SAAS,EAAE;QACT,OAAO,EAAE,UAAU;QACnB,GAAG,EAAE,EAAE;KACR;CACF,CAAC;AAEa,KAAK,UAAU,iBAAiB;IAG7C,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,GAAG,CAClC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,IAAA,cAAM,EAAC,IAAI,CAAC,CAAC,CAClE,CAAC;IACF,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;SAC7B,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;SACnC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC;AATD,oCASC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const utils_1 = require("../../../utils");
7
+ const userInteraction_1 = __importDefault(require("../../userInteraction"));
8
+ async function printAppMapCount(appMapDir) {
9
+ let fileCount = 0;
10
+ // This function is too verbose to be useful in this context.
11
+ const v = (0, utils_1.verbose)();
12
+ (0, utils_1.verbose)(false);
13
+ await (0, utils_1.listAppMapFiles)(appMapDir, (_fileName) => (fileCount += 1));
14
+ (0, utils_1.verbose)(v);
15
+ userInteraction_1.default.progress(`There are now ${fileCount} AppMap files in directory ${appMapDir}`);
16
+ }
17
+ exports.default = printAppMapCount;
18
+ //# sourceMappingURL=printAppMapCount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"printAppMapCount.js","sourceRoot":"","sources":["../../../../../src/cmds/record/action/printAppMapCount.ts"],"names":[],"mappings":";;;;;AAAA,0CAA0D;AAC1D,4EAAuC;AAExB,KAAK,UAAU,gBAAgB,CAAC,SAAiB;IAC9D,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,6DAA6D;IAC7D,MAAM,CAAC,GAAG,IAAA,eAAO,GAAE,CAAC;IACpB,IAAA,eAAO,EAAC,KAAK,CAAC,CAAC;IACf,MAAM,IAAA,uBAAe,EAAC,SAAS,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1E,IAAA,eAAO,EAAC,CAAC,CAAC,CAAC;IAEX,yBAAE,CAAC,QAAQ,CACT,iBAAiB,SAAS,8BAA8B,SAAS,EAAE,CACpE,CAAC;AACJ,CAAC;AAZD,mCAYC"}
@@ -3,27 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const userInteraction_1 = __importDefault(require("../userInteraction"));
7
- const remoteRecording_1 = __importDefault(require("./remoteRecording"));
8
- const fs_1 = require("fs");
9
- async function createRecording(requestOptions) {
10
- await userInteraction_1.default.prompt({
11
- type: 'confirm',
12
- name: 'startRecording',
13
- message: 'Start recording?',
14
- default: 'y',
15
- });
16
- const rr = new remoteRecording_1.default(requestOptions);
17
- rr.start();
18
- userInteraction_1.default.progress('\nRecording started.\n');
19
- userInteraction_1.default.progress(`Now, interact with your app in any way you'd like. Click through the UI, run Selenium tests that interact with it, make web service calls, whatever you like.`);
20
- userInteraction_1.default.status = 'Recording is active';
21
- await userInteraction_1.default.prompt({
22
- type: 'confirm',
23
- name: 'stopRecording',
24
- message: 'Stop recording?',
25
- default: 'y',
26
- });
6
+ const promises_1 = require("fs/promises");
7
+ const userInteraction_1 = __importDefault(require("../../userInteraction"));
8
+ const configuration_1 = require("../configuration");
9
+ const remoteRecording_1 = __importDefault(require("../remoteRecording"));
10
+ async function saveRecording() {
11
+ const rr = new remoteRecording_1.default(await (0, configuration_1.requestOptions)());
27
12
  let data = await rr.stop();
28
13
  if (data) {
29
14
  userInteraction_1.default.success(`Recording has finished, with ${data.length} bytes of data.`);
@@ -44,9 +29,9 @@ async function createRecording(requestOptions) {
44
29
  data = JSON.stringify(jsonData);
45
30
  const fileName = `${appMapName}.appmap.json`;
46
31
  userInteraction_1.default.status = `Saving recording to ${fileName}`;
47
- fs_1.promises.writeFile(fileName, data);
32
+ await (0, promises_1.writeFile)(fileName, data);
48
33
  userInteraction_1.default.success('AppMap saved');
49
34
  return fileName;
50
35
  }
51
- exports.default = createRecording;
52
- //# sourceMappingURL=createRecording.js.map
36
+ exports.default = saveRecording;
37
+ //# sourceMappingURL=saveRecording.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"saveRecording.js","sourceRoot":"","sources":["../../../../../src/cmds/record/action/saveRecording.ts"],"names":[],"mappings":";;;;;AAAA,0CAAwC;AACxC,4EAAuC;AACvC,oDAAkD;AAClD,yEAAiD;AAElC,KAAK,UAAU,aAAa;IACzC,MAAM,EAAE,GAAG,IAAI,yBAAe,CAAC,MAAM,IAAA,8BAAc,GAAE,CAAC,CAAC;IACvD,IAAI,IAAI,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;IAE3B,IAAI,IAAI,EAAE;QACR,yBAAE,CAAC,OAAO,CAAC,gCAAgC,IAAI,CAAC,MAAM,iBAAiB,CAAC,CAAC;KAC1E;SAAM;QACL,yBAAE,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;QAC5D,OAAO;KACR;IAED,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,yBAAE,CAAC,MAAM,CAAC;QACrC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,gCAAgC;QACzC,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,QAAQ,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IAClD,QAAQ,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC;IAC1C,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAEhC,MAAM,QAAQ,GAAG,GAAG,UAAU,cAAc,CAAC;IAC7C,yBAAE,CAAC,MAAM,GAAG,uBAAuB,QAAQ,EAAE,CAAC;IAC9C,MAAM,IAAA,oBAAS,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAEhC,yBAAE,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAE3B,OAAO,QAAQ,CAAC;AAClB,CAAC;AA9BD,gCA8BC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const userInteraction_1 = __importDefault(require("../../userInteraction"));
7
+ const configuration_1 = require("../configuration");
8
+ const remoteRecording_1 = __importDefault(require("../remoteRecording"));
9
+ async function startRecording() {
10
+ const ro = await (0, configuration_1.requestOptions)();
11
+ userInteraction_1.default.progress('');
12
+ await userInteraction_1.default.continue('Press enter to start recording');
13
+ const rr = new remoteRecording_1.default(ro);
14
+ await rr.start();
15
+ userInteraction_1.default.progress(`
16
+ Now, interact with your app in any way you'd like. Click through the UI, run Selenium tests that interact with it, make web service calls, etc.
17
+ `);
18
+ }
19
+ exports.default = startRecording;
20
+ //# sourceMappingURL=startRecording.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startRecording.js","sourceRoot":"","sources":["../../../../../src/cmds/record/action/startRecording.ts"],"names":[],"mappings":";;;;;AAAA,4EAAuC;AACvC,oDAAkD;AAClD,yEAAiD;AAElC,KAAK,UAAU,cAAc;IAC1C,MAAM,EAAE,GAAG,MAAM,IAAA,8BAAc,GAAE,CAAC;IAElC,yBAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAChB,MAAM,yBAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC,CAAC;IAEpD,MAAM,EAAE,GAAG,IAAI,yBAAe,CAAC,EAAE,CAAC,CAAC;IACnC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;IAEjB,yBAAE,CAAC,QAAQ,CAAC;;CAEb,CAAC,CAAC;AACH,CAAC;AAZD,iCAYC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const testCaseRecording_1 = __importDefault(require("../testCaseRecording"));
7
+ const userInteraction_1 = __importDefault(require("../../userInteraction"));
8
+ const configuration_1 = require("../configuration");
9
+ async function startTestCases() {
10
+ if (Boolean(process.stdout.isTTY)) {
11
+ const defaultMaxTime = await (0, configuration_1.readSetting)('test_recording.max_time', 30);
12
+ const { maxTime } = await userInteraction_1.default.prompt({
13
+ type: 'input',
14
+ name: 'maxTime',
15
+ message: 'Enter the maximum time (in seconds) to allow test cases to run (-1 to run forever):',
16
+ default: defaultMaxTime,
17
+ });
18
+ if (maxTime !== defaultMaxTime)
19
+ await (0, configuration_1.writeSetting)('test_recording.max_time', maxTime);
20
+ }
21
+ await testCaseRecording_1.default.start();
22
+ }
23
+ exports.default = startTestCases;
24
+ //# sourceMappingURL=startTestCases.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startTestCases.js","sourceRoot":"","sources":["../../../../../src/cmds/record/action/startTestCases.ts"],"names":[],"mappings":";;;;;AAAA,6EAAqD;AACrD,4EAAuC;AACvC,oDAA6D;AAE9C,KAAK,UAAU,cAAc;IAC1C,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QACjC,MAAM,cAAc,GAAG,MAAM,IAAA,2BAAW,EAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC;QACxE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,yBAAE,CAAC,MAAM,CAAC;YAClC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,SAAS;YACf,OAAO,EACL,qFAAqF;YACvF,OAAO,EAAE,cAAc;SACxB,CAAC,CAAC;QACH,IAAI,OAAO,KAAK,cAAc;YAC5B,MAAM,IAAA,4BAAY,EAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC;KAC1D;IAED,MAAM,2BAAiB,CAAC,KAAK,EAAE,CAAC;AAClC,CAAC;AAfD,iCAeC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const userInteraction_1 = __importDefault(require("../../userInteraction"));
7
+ async function stopRecording() {
8
+ await userInteraction_1.default.continue('Press enter to stop recording');
9
+ }
10
+ exports.default = stopRecording;
11
+ //# sourceMappingURL=stopRecording.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stopRecording.js","sourceRoot":"","sources":["../../../../../src/cmds/record/action/stopRecording.ts"],"names":[],"mappings":";;;;;AAAA,4EAAuC;AAExB,KAAK,UAAU,aAAa;IACzC,MAAM,yBAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC,CAAC;AACrD,CAAC;AAFD,gCAEC"}
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.writeConfigOption = exports.writeSetting = exports.readConfigOption = exports.readSetting = exports.requestOptions = exports.readAllSettings = exports.readConfig = exports.setAppMapSettingsFilePath = exports.setAppMapConfigFilePath = exports.TestCommand = void 0;
4
+ const fs_1 = require("fs");
5
+ const promises_1 = require("fs/promises");
6
+ const js_yaml_1 = require("js-yaml");
7
+ const path_1 = require("path");
8
+ let AppMapConfigFilePath = 'appmap.yml';
9
+ let AppMapSettingsFilePath = (0, path_1.join)(process.env.HOME || '', '.appmaprc');
10
+ class TestCommand {
11
+ constructor(command, env = {}) {
12
+ this.command = command;
13
+ this.env = env;
14
+ }
15
+ }
16
+ exports.TestCommand = TestCommand;
17
+ // Returns the previous config file path.
18
+ function setAppMapConfigFilePath(appMapFile) {
19
+ const oldPath = AppMapConfigFilePath;
20
+ AppMapConfigFilePath = appMapFile;
21
+ if (!(0, fs_1.existsSync)(appMapFile)) {
22
+ console.log(`Warning: AppMap config file ${appMapFile} does not exist.`);
23
+ }
24
+ return oldPath;
25
+ }
26
+ exports.setAppMapConfigFilePath = setAppMapConfigFilePath;
27
+ // Returns the previous settings file path.
28
+ function setAppMapSettingsFilePath(appMapFile) {
29
+ const oldPath = AppMapSettingsFilePath;
30
+ AppMapSettingsFilePath = appMapFile;
31
+ return oldPath;
32
+ }
33
+ exports.setAppMapSettingsFilePath = setAppMapSettingsFilePath;
34
+ async function readConfig() {
35
+ let fileContents;
36
+ try {
37
+ fileContents = await (0, promises_1.readFile)(AppMapConfigFilePath);
38
+ }
39
+ catch (_a) {
40
+ return;
41
+ }
42
+ return (0, js_yaml_1.load)(fileContents.toString());
43
+ }
44
+ exports.readConfig = readConfig;
45
+ function settingsKey() {
46
+ return (0, path_1.isAbsolute)(AppMapConfigFilePath)
47
+ ? AppMapConfigFilePath
48
+ : (0, path_1.join)(process.cwd(), AppMapConfigFilePath);
49
+ }
50
+ async function readAllSettings() {
51
+ let settings;
52
+ try {
53
+ const fileContents = await (0, promises_1.readFile)(AppMapSettingsFilePath);
54
+ settings = (0, js_yaml_1.load)(fileContents.toString());
55
+ // Make sure settings is an object.
56
+ settings[settingsKey()];
57
+ }
58
+ catch (_a) {
59
+ settings = {};
60
+ }
61
+ if (!settings[settingsKey()]) {
62
+ settings[settingsKey()] = {};
63
+ }
64
+ return settings;
65
+ }
66
+ exports.readAllSettings = readAllSettings;
67
+ async function readSettings() {
68
+ return (await readAllSettings())[settingsKey()];
69
+ }
70
+ async function writeConfig(config) {
71
+ await (0, promises_1.writeFile)(AppMapConfigFilePath, (0, js_yaml_1.dump)(config));
72
+ }
73
+ async function writeSettings(settings) {
74
+ await (0, promises_1.writeFile)(AppMapSettingsFilePath, (0, js_yaml_1.dump)(settings));
75
+ }
76
+ async function requestOptions() {
77
+ const requestOptions = {};
78
+ requestOptions.hostname = (await readSetting('remote_recording.host', 'localhost')).toString();
79
+ requestOptions.port = (await readSetting('remote_recording.port', 3000));
80
+ requestOptions.path = (await readConfigOption('remote_recording.path', '/')).toString();
81
+ requestOptions.protocol = (await readConfigOption('remote_recording.protocol', 'http:')).toString();
82
+ return requestOptions;
83
+ }
84
+ exports.requestOptions = requestOptions;
85
+ async function readSetting(path, defaultValue) {
86
+ const settings = await readSettings();
87
+ return findOption(settings, path, defaultValue);
88
+ }
89
+ exports.readSetting = readSetting;
90
+ async function readConfigOption(path, defaultValue) {
91
+ const config = await readConfig();
92
+ return findOption(config, path, defaultValue);
93
+ }
94
+ exports.readConfigOption = readConfigOption;
95
+ function findOption(data, path, defaultValue) {
96
+ if (!data)
97
+ return defaultValue;
98
+ const tokens = path.split('.');
99
+ let entry = data;
100
+ for (const token of tokens) {
101
+ if (!entry)
102
+ return defaultValue;
103
+ entry = entry[token];
104
+ }
105
+ return entry || defaultValue;
106
+ }
107
+ async function writeSetting(path, value) {
108
+ const allSettings = await readAllSettings();
109
+ const settings = allSettings[settingsKey()];
110
+ mergeConfigData(settings, path, value);
111
+ await writeSettings(allSettings);
112
+ }
113
+ exports.writeSetting = writeSetting;
114
+ async function writeConfigOption(path, value) {
115
+ const config = await readConfig();
116
+ if (!config)
117
+ return;
118
+ mergeConfigData(config, path, value);
119
+ await writeConfig(config);
120
+ }
121
+ exports.writeConfigOption = writeConfigOption;
122
+ function mergeConfigData(data, path, value) {
123
+ const tokens = path.split('.');
124
+ const lastToken = tokens.pop();
125
+ let entry = data;
126
+ for (const token of tokens) {
127
+ if (!entry[token]) {
128
+ entry[token] = {};
129
+ }
130
+ entry = entry[token];
131
+ }
132
+ if (typeof entry === 'object') {
133
+ if (entry[lastToken] !== value) {
134
+ entry[lastToken] = value;
135
+ }
136
+ }
137
+ }
138
+ //# sourceMappingURL=configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../../src/cmds/record/configuration.ts"],"names":[],"mappings":";;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CAAC,WAAW,CAAC,CAAC;AACnC,CAAC;AARD,oCAQC;AAEM,KAAK,UAAU,iBAAiB,CACrC,IAAY,EACZ,KAAsC;IAEtC,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,IAAI,CAAC,MAAM;QAAE,OAAO;IAEpB,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACrC,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AATD,8CASC;AAED,SAAS,eAAe,CACtB,IAAS,EACT,IAAY,EACZ,KAAsC;IAEtC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,EAAG,CAAC;IAChC,IAAI,KAAK,GAAG,IAAI,CAAC;IACjB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;QAC1B,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACjB,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;SACnB;QACD,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;KACtB;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,KAAK,EAAE;YAC9B,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;SAC1B;KACF;AACH,CAAC"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const userInteraction_1 = __importDefault(require("../../userInteraction"));
7
+ const configuration_1 = require("../configuration");
8
+ const guessTestCommands_1 = __importDefault(require("../action/guessTestCommands"));
9
+ const testCaseRecording_1 = __importDefault(require("../testCaseRecording"));
10
+ async function obtainTestCommands() {
11
+ userInteraction_1.default.progress(``);
12
+ userInteraction_1.default.progress(`In order to record test cases, you need to provide a command that I can use to run the tests. ` +
13
+ `If your project has many test cases, ` +
14
+ `enter a command that will run integration, functional, system or request tests, as opposed to unit tests. ` +
15
+ `Don't worry about how long the tests will take to run, you will specify a maximum runtime in an upcoming step.`);
16
+ userInteraction_1.default.progress(``);
17
+ const testCommands = (await (0, guessTestCommands_1.default)()) || [];
18
+ for (const testCommand of testCommands) {
19
+ userInteraction_1.default.progress(`Here's a suggested test command for your project:`);
20
+ userInteraction_1.default.progress(``);
21
+ // TODO: Colorize
22
+ userInteraction_1.default.progress(`${testCaseRecording_1.default.envString(testCommand.env)}${testCommand.command}`);
23
+ userInteraction_1.default.progress(``);
24
+ if (await userInteraction_1.default.confirm('Use this suggested test command?')) {
25
+ await (0, configuration_1.writeConfigOption)('test_recording.test_commands', [testCommand]);
26
+ userInteraction_1.default.progress(``);
27
+ userInteraction_1.default.progress(`I've written this test command to your AppMap configuration file (appmap.yml). ` +
28
+ `The next time you run this program, it will be used automatically. You can change it in the appmap.yml ` +
29
+ `if you want to. You can also delete it, in which case you'll be prompted again next time. And, you can also add ` +
30
+ `additional test commands to that file.`);
31
+ userInteraction_1.default.progress(``);
32
+ await userInteraction_1.default.continue('Press enter to continue');
33
+ return;
34
+ }
35
+ }
36
+ let confirmed = false;
37
+ while (!confirmed) {
38
+ const { testCommand } = await userInteraction_1.default.prompt({
39
+ name: 'testCommand',
40
+ type: 'input',
41
+ message: 'Test command (without env vars):',
42
+ });
43
+ const { envVars } = await userInteraction_1.default.prompt({
44
+ name: 'envVars',
45
+ type: 'input',
46
+ message: 'Environment variables:',
47
+ });
48
+ let env = {};
49
+ if (envVars.toString().trim() !== '') {
50
+ env = envVars
51
+ .toString()
52
+ .trim()
53
+ .split(/\s+/)
54
+ .reduce((acc, curr) => {
55
+ const [key, value] = curr.split('=', 2);
56
+ acc[key] = value;
57
+ return acc;
58
+ }, {});
59
+ }
60
+ userInteraction_1.default.progress(`To run the tests, I will run the following command:`);
61
+ userInteraction_1.default.progress('');
62
+ userInteraction_1.default.progress(`${testCaseRecording_1.default.envString(env)}${testCommand}`);
63
+ userInteraction_1.default.progress('');
64
+ confirmed = await userInteraction_1.default.confirm(`Continue with this command?`);
65
+ if (confirmed) {
66
+ await (0, configuration_1.writeConfigOption)('test_recording.test_commands', [
67
+ { env, command: testCommand },
68
+ ]);
69
+ }
70
+ }
71
+ }
72
+ exports.default = obtainTestCommands;
73
+ //# sourceMappingURL=obtainTestCommands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"obtainTestCommands.js","sourceRoot":"","sources":["../../../../../src/cmds/record/prompt/obtainTestCommands.ts"],"names":[],"mappings":";;;;;AAAA,4EAAuC;AACvC,oDAAqD;AACrD,oFAA4D;AAC5D,6EAAqD;AAEtC,KAAK,UAAU,kBAAkB;IAC9C,yBAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAChB,yBAAE,CAAC,QAAQ,CACT,gGAAgG;QAC9F,uCAAuC;QACvC,4GAA4G;QAC5G,gHAAgH,CACnH,CAAC;IACF,yBAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEhB,MAAM,YAAY,GAAG,CAAC,MAAM,IAAA,2BAAiB,GAAE,CAAC,IAAI,EAAE,CAAC;IACvD,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;QACtC,yBAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC,CAAC;QACjE,yBAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAChB,iBAAiB;QACjB,yBAAE,CAAC,QAAQ,CACT,GAAG,2BAAiB,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,OAAO,EAAE,CACxE,CAAC;QACF,yBAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAChB,IAAI,MAAM,yBAAE,CAAC,OAAO,CAAC,kCAAkC,CAAC,EAAE;YACxD,MAAM,IAAA,iCAAiB,EAAC,8BAA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QACnE,yBAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAChB,yBAAE,CAAC,QAAQ,CAAC,GAAG,2BAAiB,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,WAAW,EAAE,CAAC,CAAC;QACjE,yBAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAEhB,SAAS,GAAG,MAAM,yBAAE,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC;QAC5D,IAAI,SAAS,EAAE;YACb,MAAM,IAAA,iCAAiB,EAAC,8BAA8B,EAAE;gBACtD,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE;aAC9B,CAAC,CAAC;SACJ;KACF;AACH,CAAC;AA1ED,qCA0EC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RecordingAction = void 0;
7
+ const userInteraction_1 = __importDefault(require("../../userInteraction"));
8
+ var RecordingAction;
9
+ (function (RecordingAction) {
10
+ RecordingAction["Cancel"] = "cancel recording";
11
+ RecordingAction["Save"] = "save recording";
12
+ RecordingAction["Abort"] = "continue recording";
13
+ })(RecordingAction = exports.RecordingAction || (exports.RecordingAction = {}));
14
+ async function recordingInProgress() {
15
+ userInteraction_1.default.progress('The AppMap agent is already recording an AppMap.?');
16
+ const { recordingAction } = await userInteraction_1.default.prompt({
17
+ type: 'list',
18
+ choices: [
19
+ RecordingAction.Cancel,
20
+ RecordingAction.Save,
21
+ RecordingAction.Abort,
22
+ ],
23
+ name: 'recordingAction',
24
+ message: "What would you like to do with the recording that's in progress?",
25
+ });
26
+ return recordingAction;
27
+ }
28
+ exports.default = recordingInProgress;
29
+ //# sourceMappingURL=recordingInProgress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordingInProgress.js","sourceRoot":"","sources":["../../../../../src/cmds/record/prompt/recordingInProgress.ts"],"names":[],"mappings":";;;;;;AAAA,4EAAuC;AAEvC,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,8CAA2B,CAAA;IAC3B,0CAAuB,CAAA;IACvB,+CAA4B,CAAA;AAC9B,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B;AAEc,KAAK,UAAU,mBAAmB;IAC/C,yBAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC,CAAC;IACjE,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,yBAAE,CAAC,MAAM,CAAC;QAC1C,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE;YACP,eAAe,CAAC,MAAM;YACtB,eAAe,CAAC,IAAI;YACpB,eAAe,CAAC,KAAK;SACtB;QACD,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,kEAAkE;KAC5E,CAAC,CAAC;IACH,OAAO,eAAe,CAAC;AACzB,CAAC;AAbD,sCAaC"}