record-replay-req-res-scenario 21.0.17 → 21.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/package.json +1 -1
- package/browser-prod/package.json +1 -1
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/package.json +1 -1
- package/lib-prod/build-info._auto-generated_.js +26 -14
- package/lib-prod/env/env.angular-node-app.js +66 -130
- package/lib-prod/env/env.docs-webapp.js +66 -130
- package/lib-prod/env/env.electron-app.js +66 -130
- package/lib-prod/env/env.mobile-app.js +66 -130
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +66 -130
- package/lib-prod/env/env.vscode-plugin.js +66 -130
- package/lib-prod/env/index.js +6 -6
- package/lib-prod/index._auto-generated_.js +5 -0
- package/lib-prod/index.js +6 -4
- package/lib-prod/migrations/index.js +2 -1
- package/lib-prod/migrations/migrations_index._auto-generated_.js +3 -0
- package/lib-prod/package.json +1 -1
- package/lib-prod/record-replay-req-res-scenario.js +371 -0
- package/lib-prod/scenario.backend.js +231 -0
- package/lib-prod/start.backend.js +19 -0
- package/lib-prod/tape.backend.js +27 -0
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
|
@@ -1,130 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
export
|
|
66
|
-
|
|
67
|
-
ENV_VSCODE_PLUGIN_BUILD_ELECTRON_SHOW_DEV_TOOLS,
|
|
68
|
-
ENV_VSCODE_PLUGIN_BUILD_GEN_ONLY_CLIENT_CODE,
|
|
69
|
-
ENV_VSCODE_PLUGIN_BUILD_OVERRIDE_OUTPUT_PATH,
|
|
70
|
-
ENV_VSCODE_PLUGIN_BUILD_PROD,
|
|
71
|
-
ENV_VSCODE_PLUGIN_BUILD_PWA_DISABLE_SERVICE_WORKER,
|
|
72
|
-
ENV_VSCODE_PLUGIN_BUILD_PWA_NAME,
|
|
73
|
-
ENV_VSCODE_PLUGIN_BUILD_PWA_SHORT_NAME,
|
|
74
|
-
ENV_VSCODE_PLUGIN_BUILD_PWA_START_URL,
|
|
75
|
-
ENV_VSCODE_PLUGIN_BUILD_SSR,
|
|
76
|
-
ENV_VSCODE_PLUGIN_BUILD_WATCH,
|
|
77
|
-
ENV_VSCODE_PLUGIN_BUILD_WEBSQL,
|
|
78
|
-
ENV_VSCODE_PLUGIN_CONTAINER_END,
|
|
79
|
-
ENV_VSCODE_PLUGIN_CONTAINER_ONLY,
|
|
80
|
-
ENV_VSCODE_PLUGIN_CONTAINER_SKIP,
|
|
81
|
-
ENV_VSCODE_PLUGIN_CONTAINER_SKIP_RELEASED,
|
|
82
|
-
ENV_VSCODE_PLUGIN_CONTAINER_START,
|
|
83
|
-
ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_BEFORE_COPY_HOOK,
|
|
84
|
-
ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_COPY_TO_LOCATIONS,
|
|
85
|
-
ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_COPY_TO_PROJECTS,
|
|
86
|
-
ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_SKIP,
|
|
87
|
-
ENV_VSCODE_PLUGIN_DOCKER_ADDITIONAL_CONTAINER,
|
|
88
|
-
ENV_VSCODE_PLUGIN_DOCKER_SKIP_START_IN_ORDER,
|
|
89
|
-
ENV_VSCODE_PLUGIN_DOCKER_SKIP_USING_MYSQL_DB,
|
|
90
|
-
ENV_VSCODE_PLUGIN_INIT_BRANDING,
|
|
91
|
-
ENV_VSCODE_PLUGIN_INIT_STRUCT,
|
|
92
|
-
ENV_VSCODE_PLUGIN_IS_CI_PROCESS,
|
|
93
|
-
ENV_VSCODE_PLUGIN_LOADING_PRE_ANGULAR_BOOTSTRAP_BACKGROUND,
|
|
94
|
-
ENV_VSCODE_PLUGIN_LOADING_PRE_ANGULAR_BOOTSTRAP_LOADER,
|
|
95
|
-
ENV_VSCODE_PLUGIN_PURPOSE,
|
|
96
|
-
ENV_VSCODE_PLUGIN_RECURSIVE_ACTION,
|
|
97
|
-
ENV_VSCODE_PLUGIN_RELEASE_AUTO_RELEASE_TASK_NAME,
|
|
98
|
-
ENV_VSCODE_PLUGIN_RELEASE_AUTO_RELEASE_USING_CONFIG,
|
|
99
|
-
ENV_VSCODE_PLUGIN_RELEASE_CLI_COMPRESS,
|
|
100
|
-
ENV_VSCODE_PLUGIN_RELEASE_CLI_INCLUDE_NODE_MODULES,
|
|
101
|
-
ENV_VSCODE_PLUGIN_RELEASE_CLI_MINIFY,
|
|
102
|
-
ENV_VSCODE_PLUGIN_RELEASE_CLI_OBSCURE,
|
|
103
|
-
ENV_VSCODE_PLUGIN_RELEASE_CLI_UGLIFY,
|
|
104
|
-
ENV_VSCODE_PLUGIN_RELEASE_ENV_NAME,
|
|
105
|
-
ENV_VSCODE_PLUGIN_RELEASE_ENV_NUMBER,
|
|
106
|
-
ENV_VSCODE_PLUGIN_RELEASE_INSTALL_LOCALLY,
|
|
107
|
-
ENV_VSCODE_PLUGIN_RELEASE_LIB_COMPRESS,
|
|
108
|
-
ENV_VSCODE_PLUGIN_RELEASE_LIB_DO_NOT_INCLUDE_LIB_FILES,
|
|
109
|
-
ENV_VSCODE_PLUGIN_RELEASE_LIB_INCLUDE_SOURCE_MAPS,
|
|
110
|
-
ENV_VSCODE_PLUGIN_RELEASE_LIB_OBSCURE_FILE_BY_FILE,
|
|
111
|
-
ENV_VSCODE_PLUGIN_RELEASE_LIB_REMOVE_DTS,
|
|
112
|
-
ENV_VSCODE_PLUGIN_RELEASE_LIB_UGLIFY_FILE_BY_FILE,
|
|
113
|
-
ENV_VSCODE_PLUGIN_RELEASE_NODE_BACKEND_APP_MINIFY,
|
|
114
|
-
ENV_VSCODE_PLUGIN_RELEASE_RELEASE_TYPE,
|
|
115
|
-
ENV_VSCODE_PLUGIN_RELEASE_RELEASE_VERSION_BUMP_TYPE,
|
|
116
|
-
ENV_VSCODE_PLUGIN_RELEASE_REMOVE_RELEASE_OUTPUT_AFTER_LOCAL_INSTALL,
|
|
117
|
-
ENV_VSCODE_PLUGIN_RELEASE_RESOLVED_NEW_VERSION,
|
|
118
|
-
ENV_VSCODE_PLUGIN_RELEASE_SKIP_BUILDING_ARTIFACTS,
|
|
119
|
-
ENV_VSCODE_PLUGIN_RELEASE_SKIP_CODE_CUTTING,
|
|
120
|
-
ENV_VSCODE_PLUGIN_RELEASE_SKIP_DEPLOY,
|
|
121
|
-
ENV_VSCODE_PLUGIN_RELEASE_SKIP_NPM_PUBLISH,
|
|
122
|
-
ENV_VSCODE_PLUGIN_RELEASE_SKIP_RELEASE_QUESTION,
|
|
123
|
-
ENV_VSCODE_PLUGIN_RELEASE_SKIP_RESOLVING_GIT_CHANGES,
|
|
124
|
-
ENV_VSCODE_PLUGIN_RELEASE_SKIP_TAG_GIT_PUSH,
|
|
125
|
-
ENV_VSCODE_PLUGIN_RELEASE_TAON_INSTANCE_IP,
|
|
126
|
-
ENV_VSCODE_PLUGIN_RELEASE_TARGET_ARTIFACT,
|
|
127
|
-
ENV_VSCODE_PLUGIN_WEBSITE_DOMAIN,
|
|
128
|
-
ENV_VSCODE_PLUGIN_WEBSITE_TITLE,
|
|
129
|
-
ENV_VSCODE_PLUGIN_WEBSITE_USE_DOMAIN
|
|
130
|
-
};
|
|
1
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
2
|
+
export const ENV_VSCODE_PLUGIN_WEBSITE_DOMAIN = 'record-replay-req-res-scenario.example.domain.com';
|
|
3
|
+
export const ENV_VSCODE_PLUGIN_WEBSITE_TITLE = 'Record Replay Req Res Scenario';
|
|
4
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_TARGET_ARTIFACT = 'vscode-plugin';
|
|
5
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_ENV_NAME = '__';
|
|
6
|
+
export const ENV_VSCODE_PLUGIN_CONTAINER_ONLY = undefined;
|
|
7
|
+
export const ENV_VSCODE_PLUGIN_CONTAINER_END = undefined;
|
|
8
|
+
export const ENV_VSCODE_PLUGIN_CONTAINER_START = undefined;
|
|
9
|
+
export const ENV_VSCODE_PLUGIN_CONTAINER_SKIP_RELEASED = undefined;
|
|
10
|
+
export const ENV_VSCODE_PLUGIN_CONTAINER_SKIP = undefined;
|
|
11
|
+
export const ENV_VSCODE_PLUGIN_INIT_BRANDING = undefined;
|
|
12
|
+
export const ENV_VSCODE_PLUGIN_INIT_STRUCT = undefined;
|
|
13
|
+
export const ENV_VSCODE_PLUGIN_BUILD_PWA_DISABLE_SERVICE_WORKER = undefined;
|
|
14
|
+
export const ENV_VSCODE_PLUGIN_BUILD_PWA_NAME = undefined;
|
|
15
|
+
export const ENV_VSCODE_PLUGIN_BUILD_PWA_SHORT_NAME = undefined;
|
|
16
|
+
export const ENV_VSCODE_PLUGIN_BUILD_PWA_START_URL = undefined;
|
|
17
|
+
export const ENV_VSCODE_PLUGIN_BUILD_ELECTRON_SHOW_DEV_TOOLS = undefined;
|
|
18
|
+
export const ENV_VSCODE_PLUGIN_BUILD_SSR = undefined;
|
|
19
|
+
export const ENV_VSCODE_PLUGIN_BUILD_WEBSQL = undefined;
|
|
20
|
+
export const ENV_VSCODE_PLUGIN_BUILD_PROD = undefined;
|
|
21
|
+
export const ENV_VSCODE_PLUGIN_BUILD_OVERRIDE_OUTPUT_PATH = undefined;
|
|
22
|
+
export const ENV_VSCODE_PLUGIN_BUILD_BASE_HREF = undefined;
|
|
23
|
+
export const ENV_VSCODE_PLUGIN_BUILD_WATCH = undefined;
|
|
24
|
+
export const ENV_VSCODE_PLUGIN_BUILD_GEN_ONLY_CLIENT_CODE = undefined;
|
|
25
|
+
export const ENV_VSCODE_PLUGIN_LOADING_PRE_ANGULAR_BOOTSTRAP_LOADER = undefined;
|
|
26
|
+
export const ENV_VSCODE_PLUGIN_LOADING_PRE_ANGULAR_BOOTSTRAP_BACKGROUND = undefined;
|
|
27
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_CLI_MINIFY = undefined;
|
|
28
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_CLI_INCLUDE_NODE_MODULES = undefined;
|
|
29
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_CLI_UGLIFY = undefined;
|
|
30
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_CLI_OBSCURE = undefined;
|
|
31
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_CLI_COMPRESS = undefined;
|
|
32
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_NODE_BACKEND_APP_MINIFY = undefined;
|
|
33
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_REMOVE_DTS = undefined;
|
|
34
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_OBSCURE_FILE_BY_FILE = undefined;
|
|
35
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_UGLIFY_FILE_BY_FILE = undefined;
|
|
36
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_INCLUDE_SOURCE_MAPS = undefined;
|
|
37
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_COMPRESS = undefined;
|
|
38
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_DO_NOT_INCLUDE_LIB_FILES = undefined;
|
|
39
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_RESOLVED_NEW_VERSION = undefined;
|
|
40
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_RELEASE_VERSION_BUMP_TYPE = undefined;
|
|
41
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_ENV_NUMBER = undefined;
|
|
42
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_INSTALL_LOCALLY = undefined;
|
|
43
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_REMOVE_RELEASE_OUTPUT_AFTER_LOCAL_INSTALL = undefined;
|
|
44
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_RELEASE_TYPE = undefined;
|
|
45
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_AUTO_RELEASE_USING_CONFIG = undefined;
|
|
46
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_AUTO_RELEASE_TASK_NAME = undefined;
|
|
47
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_TAON_INSTANCE_IP = undefined;
|
|
48
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_NPM_PUBLISH = undefined;
|
|
49
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_DEPLOY = undefined;
|
|
50
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_TAG_GIT_PUSH = undefined;
|
|
51
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_RELEASE_QUESTION = undefined;
|
|
52
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_RESOLVING_GIT_CHANGES = undefined;
|
|
53
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_CODE_CUTTING = undefined;
|
|
54
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_BUILDING_ARTIFACTS = undefined;
|
|
55
|
+
export const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_BEFORE_COPY_HOOK = undefined;
|
|
56
|
+
export const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_COPY_TO_LOCATIONS = undefined;
|
|
57
|
+
export const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_COPY_TO_PROJECTS = undefined;
|
|
58
|
+
export const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_SKIP = undefined;
|
|
59
|
+
export const ENV_VSCODE_PLUGIN_WEBSITE_USE_DOMAIN = undefined;
|
|
60
|
+
export const ENV_VSCODE_PLUGIN_PURPOSE = undefined;
|
|
61
|
+
export const ENV_VSCODE_PLUGIN_RECURSIVE_ACTION = undefined;
|
|
62
|
+
export const ENV_VSCODE_PLUGIN_IS_CI_PROCESS = undefined;
|
|
63
|
+
export const ENV_VSCODE_PLUGIN_DOCKER_ADDITIONAL_CONTAINER = undefined;
|
|
64
|
+
export const ENV_VSCODE_PLUGIN_DOCKER_SKIP_START_IN_ORDER = undefined;
|
|
65
|
+
export const ENV_VSCODE_PLUGIN_DOCKER_SKIP_USING_MYSQL_DB = undefined;
|
|
66
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
package/lib-prod/env/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
1
|
+
export * from './env.angular-node-app';
|
|
2
|
+
export * from './env.docs-webapp';
|
|
3
|
+
export * from './env.electron-app';
|
|
4
|
+
export * from './env.mobile-app';
|
|
5
|
+
export * from './env.npm-lib-and-cli-tool';
|
|
6
|
+
export * from './env.vscode-plugin';
|
package/lib-prod/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// //#region @backend
|
|
2
|
+
// export * from './scenario.backend';
|
|
3
|
+
// export * from './tape.backend';
|
|
4
|
+
// //#endregion
|
|
5
|
+
// export { RecordReplayReqResScenario, RecorderConfigMeta, ReplayConfigMeta } from './record-replay-req-res-scenario';
|
|
6
|
+
export function asdaaaaa() {
|
|
2
7
|
}
|
|
3
|
-
export {
|
|
4
|
-
asdaaaaa
|
|
5
|
-
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
export * from './migrations_index._auto-generated_';
|
package/lib-prod/package.json
CHANGED
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
// //#region imports
|
|
2
|
+
// //#region @backend
|
|
3
|
+
// import * as _ from 'lodash';
|
|
4
|
+
// import * as path from 'path';
|
|
5
|
+
// import { Helpers, BaseProject as Project } from 'tnp-helpers';
|
|
6
|
+
// import { URL } from 'url';
|
|
7
|
+
// import { config } from 'tnp-core';
|
|
8
|
+
// import * as moment from 'moment';
|
|
9
|
+
// import { talkback, Options, RecordMode } from 'ng-talkback';
|
|
10
|
+
// import * as glob from 'glob';
|
|
11
|
+
// import { Scenario, ScenarioParam, ScenarioParams, ScenarioParamsReturn } from './scenario.backend';
|
|
12
|
+
// import chalk from 'chalk';
|
|
13
|
+
// import * as inquirer from 'inquirer';
|
|
14
|
+
// // import { Models } from 'tnp-models';
|
|
15
|
+
// //#endregion
|
|
16
|
+
// //#endregion
|
|
17
|
+
// //#region models
|
|
18
|
+
// export type RecordData = { host: number | string | URL; talkbackProxyPort?: number | string; }
|
|
19
|
+
// export type RecorderConfigMeta = {
|
|
20
|
+
// [recordHostName: string]: RecordData;
|
|
21
|
+
// } & { scenarioName: string; }
|
|
22
|
+
// export type ReplayConfigMeta = {
|
|
23
|
+
// [recordHostName: string]: { talkbackProxyPort?: number | string; }
|
|
24
|
+
// } & { scenarioPath: string; }
|
|
25
|
+
// type ArgsOptReplayRecordArgType = { port: string | string[]; hostName: string | string[]; };
|
|
26
|
+
// interface RecordArgType {
|
|
27
|
+
// record: {
|
|
28
|
+
// /**
|
|
29
|
+
// * url with host to record
|
|
30
|
+
// */
|
|
31
|
+
// url: URL;
|
|
32
|
+
// /**
|
|
33
|
+
// * Identifier of what was the name or id of server.
|
|
34
|
+
// * this metadata is usefull to replay back multiple servers
|
|
35
|
+
// * on different talkback ports
|
|
36
|
+
// */
|
|
37
|
+
// name: string;
|
|
38
|
+
// };
|
|
39
|
+
// /**
|
|
40
|
+
// * talkback port for localhost proxy
|
|
41
|
+
// */
|
|
42
|
+
// talkbackProxyPort: number;
|
|
43
|
+
// }
|
|
44
|
+
// //#endregion
|
|
45
|
+
// export class RecordReplayReqResScenario {
|
|
46
|
+
// //#region @backend
|
|
47
|
+
// //#region consts
|
|
48
|
+
// /**
|
|
49
|
+
// * by pinging to http://localhost:5544/path/to/something
|
|
50
|
+
// * you are actually recording request from
|
|
51
|
+
// * by pinging to http://< host for recording >/path/to/something
|
|
52
|
+
// */
|
|
53
|
+
// readonly DEFAULT_TALKBACK_PROXY_SERVER_PORT = 5544;
|
|
54
|
+
// //#endregion
|
|
55
|
+
// //#region singleton
|
|
56
|
+
// private static _instances = {};
|
|
57
|
+
// private constructor(
|
|
58
|
+
// protected readonly cwd = process.cwd()
|
|
59
|
+
// ) {
|
|
60
|
+
// const pathToScenarios = path.join(cwd, config.folder.scenarios);
|
|
61
|
+
// const pathToScenariosTemp = path.join(cwd, config.folder.tmpScenarios);
|
|
62
|
+
// if (!Helpers.exists(pathToScenarios)) {
|
|
63
|
+
// Helpers.createSymLink(pathToScenariosTemp, pathToScenarios,
|
|
64
|
+
// { continueWhenExistedFolderDoesntExists: true })
|
|
65
|
+
// }
|
|
66
|
+
// }
|
|
67
|
+
// public static Instance(cwd = process.cwd()) {
|
|
68
|
+
// if (!RecordReplayReqResScenario._instances[cwd]) {
|
|
69
|
+
// RecordReplayReqResScenario._instances[cwd] = new RecordReplayReqResScenario(cwd);
|
|
70
|
+
// }
|
|
71
|
+
// return RecordReplayReqResScenario._instances[cwd] as RecordReplayReqResScenario;
|
|
72
|
+
// }
|
|
73
|
+
// //#endregion
|
|
74
|
+
// //#region resolve recoard args
|
|
75
|
+
// private resolveArgsRecord(serverHostOrPort: string | string[] | RecorderConfigMeta)
|
|
76
|
+
// : { args: RecordArgType[]; scenarioName: string; } {
|
|
77
|
+
// const results = [] as RecordArgType[];
|
|
78
|
+
// const configMeta = ((_.isObject(serverHostOrPort) && !_.isArray(serverHostOrPort))
|
|
79
|
+
// ? serverHostOrPort : void 0) as RecorderConfigMeta;
|
|
80
|
+
// let scenarioName = '' as string;
|
|
81
|
+
// let talkbackPorts = [this.DEFAULT_TALKBACK_PROXY_SERVER_PORT];
|
|
82
|
+
// if (configMeta) {
|
|
83
|
+
// //#region by config
|
|
84
|
+
// scenarioName = configMeta.scenarioName;
|
|
85
|
+
// _.keys(configMeta)
|
|
86
|
+
// .filter(key => _.isObject(configMeta[key]))
|
|
87
|
+
// .forEach((name, i) => {
|
|
88
|
+
// const url = Helpers.urlParse(configMeta[name].host);
|
|
89
|
+
// results.push({
|
|
90
|
+
// record: {
|
|
91
|
+
// name,
|
|
92
|
+
// url
|
|
93
|
+
// },
|
|
94
|
+
// talkbackProxyPort: Number(configMeta[name].talkbackProxyPort) + i
|
|
95
|
+
// })
|
|
96
|
+
// })
|
|
97
|
+
// //#endregion
|
|
98
|
+
// } else {
|
|
99
|
+
// //#region by command line argument
|
|
100
|
+
// const { commandString, resolved } = Helpers.cliTool.argsFromBegin<URL>(
|
|
101
|
+
// serverHostOrPort as string,
|
|
102
|
+
// a => Helpers.urlParse(a)
|
|
103
|
+
// );
|
|
104
|
+
// scenarioName = commandString;
|
|
105
|
+
// let options = Helpers.cliTool.argsFrom<{ port: string; hostName: string; }>(scenarioName);
|
|
106
|
+
// scenarioName = Helpers.cliTool.cleanCommand(scenarioName, options);
|
|
107
|
+
// if (_.isArray(options.port)) {
|
|
108
|
+
// talkbackPorts = options.port;
|
|
109
|
+
// } else if (!isNaN(Number(options.port))) {
|
|
110
|
+
// talkbackPorts = [Number(options.port)];
|
|
111
|
+
// }
|
|
112
|
+
// const hostName = _.isString(options.hostName) ? [options.hostName]
|
|
113
|
+
// : (_.isArray(options.hostName) ? options.hostName : [])
|
|
114
|
+
// if (talkbackPorts.length === 0) {
|
|
115
|
+
// Helpers.error(`[rec-scenario-rep-rec] Incorrect configuration of ports:
|
|
116
|
+
// recordHosts = ${resolved.map(c => Helpers.urlParse(c)).join(', ')}
|
|
117
|
+
// talkback ports = ${talkbackPorts.join(', ')}
|
|
118
|
+
// `, false, true);
|
|
119
|
+
// }
|
|
120
|
+
// if (talkbackPorts.length < resolved.length) {
|
|
121
|
+
// const lastN = talkbackPorts[talkbackPorts.length - 1];
|
|
122
|
+
// _.times((resolved.length - talkbackPorts.length), (i) => talkbackPorts.push(lastN + (i + 1)));
|
|
123
|
+
// }
|
|
124
|
+
// resolved.forEach((recordHost, i) => {
|
|
125
|
+
// results.push({
|
|
126
|
+
// record: {
|
|
127
|
+
// name: hostName[i] ? hostName[i] : '',
|
|
128
|
+
// url: recordHost
|
|
129
|
+
// },
|
|
130
|
+
// talkbackProxyPort: talkbackPorts[i]
|
|
131
|
+
// })
|
|
132
|
+
// });
|
|
133
|
+
// //#endregion
|
|
134
|
+
// }
|
|
135
|
+
// return { args: results, scenarioName };
|
|
136
|
+
// }
|
|
137
|
+
// //#endregion
|
|
138
|
+
// //#region command from config
|
|
139
|
+
// public recordAsWorker(config: RecorderConfigMeta, cwd: string = process.cwd()) {
|
|
140
|
+
// const hosts = Object
|
|
141
|
+
// .keys(config)
|
|
142
|
+
// .filter(hostName => _.isObject(config[hostName]))
|
|
143
|
+
// .map(hostName => {
|
|
144
|
+
// const v = config[hostName] as RecordData;
|
|
145
|
+
// return (v.host as URL).origin;
|
|
146
|
+
// });
|
|
147
|
+
// const portName = Object
|
|
148
|
+
// .keys(config)
|
|
149
|
+
// .filter(hostName => _.isObject(config[hostName]))
|
|
150
|
+
// .map(hostName => {
|
|
151
|
+
// const v = config[hostName] as RecordData;
|
|
152
|
+
// return `--port ${v.talkbackProxyPort} --hostName ${hostName}`
|
|
153
|
+
// })
|
|
154
|
+
// let command = `record-replay-req-res-scenario record ${hosts.join(' ')} '${config.scenarioName}' ${portName.join(' ')}`;
|
|
155
|
+
// Helpers.run(command, { cwd }).async();
|
|
156
|
+
// }
|
|
157
|
+
// //#endregion
|
|
158
|
+
// //#region record
|
|
159
|
+
// /**
|
|
160
|
+
// * rest-scenario-rep-rec record http://localhost:4444 Recording localhost data
|
|
161
|
+
// * rest-scenario-rep-rec record http://192.168.10.22:4444 Test scenario
|
|
162
|
+
// * rest-scenario-rep-rec record 4444 local setup test
|
|
163
|
+
// * rest-scenario-rep-rec record 4444 5555 http://192.168.12.3 "my super scenario"
|
|
164
|
+
// * rest-scenario-rep-rec record 4444 5555 http://192.168.12.3 192.158.32.3 'my super scenario --port 6767'
|
|
165
|
+
// * <port or host for record > <scenario name > < talkbback server ports for proxy >
|
|
166
|
+
// * rest-scenario-rep-rec record 4444 5555 http://my.api.com 'my super scenario --port 6767 --port 7777 --port 8888'
|
|
167
|
+
// * ins.record( { portOrHost: http://192.129.23.12; name: 'localApiProxy' }, 'super scenario')
|
|
168
|
+
// */
|
|
169
|
+
// async record(serverHostOrPort: string | string[] | RecorderConfigMeta, debug = false) {
|
|
170
|
+
// return new Promise((resolve, reject) => {
|
|
171
|
+
// const currentDate = new Date();
|
|
172
|
+
// let { args, scenarioName } = this.resolveArgsRecord(serverHostOrPort);
|
|
173
|
+
// //#region prepare main scenario folder
|
|
174
|
+
// let description = scenarioName;
|
|
175
|
+
// if (!_.isString(scenarioName) || scenarioName.trim() === '') {
|
|
176
|
+
// scenarioName = `new-scenario-${_.kebabCase(moment(currentDate).format('MMMM Do YYYY, h:mm:ss a'))}`;;
|
|
177
|
+
// description = _.startCase(scenarioName);
|
|
178
|
+
// }
|
|
179
|
+
// const scenarioNameKebabKase = _.kebabCase(scenarioName);
|
|
180
|
+
// const scenariosFolder = path.join(this.cwd, config.folder.tmpScenarios);
|
|
181
|
+
// const scenarioKebabPath = path.join(scenariosFolder, scenarioNameKebabKase);
|
|
182
|
+
// const packageJsonFroScenario = path.join(scenarioKebabPath, config.file.package_json);
|
|
183
|
+
// if (!Helpers.exists(scenariosFolder)) {
|
|
184
|
+
// Helpers.mkdirp(scenariosFolder);
|
|
185
|
+
// }
|
|
186
|
+
// Helpers.removeFolderIfExists(scenarioKebabPath);
|
|
187
|
+
// //#endregion
|
|
188
|
+
// //#region write package.json
|
|
189
|
+
// Helpers.writeFile(packageJsonFroScenario, {
|
|
190
|
+
// name: scenarioNameKebabKase,
|
|
191
|
+
// description,
|
|
192
|
+
// version: '0.0.0',
|
|
193
|
+
// creationDate: currentDate.toDateString(),
|
|
194
|
+
// scripts: {
|
|
195
|
+
// start: 'firedev serve',
|
|
196
|
+
// },
|
|
197
|
+
// tnp: {
|
|
198
|
+
// type: 'scenario',
|
|
199
|
+
// } as any,
|
|
200
|
+
// } as Partial<Models.npm.IPackageJSON>);
|
|
201
|
+
// //#endregion
|
|
202
|
+
// args.forEach(recData => {
|
|
203
|
+
// Helpers.log(`RECORD FROM: ${recData.record.url.href}`)
|
|
204
|
+
// const scenarioPath = path.join(
|
|
205
|
+
// this.cwd,
|
|
206
|
+
// config.folder.tmpScenarios,
|
|
207
|
+
// scenarioNameKebabKase,
|
|
208
|
+
// `${(_.kebabCase(recData.record.url.href)).toString()}__${_.camelCase(recData.record.name)}`
|
|
209
|
+
// );
|
|
210
|
+
// Helpers.remove(scenarioPath);
|
|
211
|
+
// const talkbackHost = recData.record.url.origin;
|
|
212
|
+
// debug && Helpers.info(`Talkback host: ${talkbackHost}`)
|
|
213
|
+
// const server = talkback({
|
|
214
|
+
// host: talkbackHost,
|
|
215
|
+
// record: RecordMode.NEW,
|
|
216
|
+
// port: recData.talkbackProxyPort,
|
|
217
|
+
// path: scenarioPath,
|
|
218
|
+
// silent: true,
|
|
219
|
+
// // debug: true
|
|
220
|
+
// } as Options);
|
|
221
|
+
// server.start(() => {
|
|
222
|
+
// Helpers.info(`"Talkback Started" on port ${recData.talkbackProxyPort} `
|
|
223
|
+
// + `( click for test ${chalk.bold(recData.record?.name ? recData.record.name : '')} `
|
|
224
|
+
// + `http://localhost:${recData.talkbackProxyPort}/ng-talkback-test ) => proxy to ${recData.record.url.href}`);
|
|
225
|
+
// resolve(void 0);
|
|
226
|
+
// });
|
|
227
|
+
// })
|
|
228
|
+
// });
|
|
229
|
+
// }
|
|
230
|
+
// //#endregion
|
|
231
|
+
// //#region all scenaroios
|
|
232
|
+
// public get allScenarios() {
|
|
233
|
+
// return glob.sync(`${path.join(this.cwd, config.folder.tmpScenarios)}/*`)
|
|
234
|
+
// .filter(f => !!Project.ins.From(f))
|
|
235
|
+
// .map(f => Scenario.From(f))
|
|
236
|
+
// .filter(f => !!f)
|
|
237
|
+
// }
|
|
238
|
+
// //#endregion
|
|
239
|
+
// //#region select scenario
|
|
240
|
+
// async selectScenario(goBackButtonOnList?: boolean): Promise<Scenario> {
|
|
241
|
+
// const mainMessage = `Select scenario from list:`;
|
|
242
|
+
// const choices = Scenario.allCurrent.map(c => {
|
|
243
|
+
// return { name: `"${c.description}"`, value: c }
|
|
244
|
+
// });
|
|
245
|
+
// if (goBackButtonOnList) {
|
|
246
|
+
// choices.push({ name: '<= Go back', value: void 0 });
|
|
247
|
+
// }
|
|
248
|
+
// const res = await inquirer.prompt({
|
|
249
|
+
// type: 'list',
|
|
250
|
+
// name: 'value',
|
|
251
|
+
// message: mainMessage,
|
|
252
|
+
// choices
|
|
253
|
+
// } as any) as any;
|
|
254
|
+
// return res.value;
|
|
255
|
+
// }
|
|
256
|
+
// //#endregion
|
|
257
|
+
// //#region resolve replay args
|
|
258
|
+
// private async resolveReplayData(
|
|
259
|
+
// nameOrPathOrDescription: string | string[] | ReplayConfigMeta,
|
|
260
|
+
// showListIfNotMatch = false,
|
|
261
|
+
// goBackButtonOnList = false,
|
|
262
|
+
// ) {
|
|
263
|
+
// const returnValue = { scenarios: [] as Scenario[], params: void 0 as ScenarioParamsReturn }
|
|
264
|
+
// if (_.isObject(nameOrPathOrDescription) && !_.isArray(nameOrPathOrDescription)) {
|
|
265
|
+
// //#region config
|
|
266
|
+
// const configMeta = nameOrPathOrDescription as ReplayConfigMeta;
|
|
267
|
+
// const scenario = Scenario.From(configMeta.scenarioPath)
|
|
268
|
+
// if (!scenario) {
|
|
269
|
+
// Helpers.error(`[rest-scenario...] Scenario not found in "${configMeta.scenarioPath}"`
|
|
270
|
+
// , false, true)
|
|
271
|
+
// }
|
|
272
|
+
// returnValue.scenarios = [scenario];
|
|
273
|
+
// returnValue.params = _.pickBy(configMeta, _.isObject) as ScenarioParamsReturn;
|
|
274
|
+
// //#endregion
|
|
275
|
+
// } else {
|
|
276
|
+
// //#region from command line
|
|
277
|
+
// nameOrPathOrDescription = (_.isArray(nameOrPathOrDescription)
|
|
278
|
+
// ? nameOrPathOrDescription.join(' ') : nameOrPathOrDescription) as string;
|
|
279
|
+
// const options = Helpers.cliTool.argsFrom<ArgsOptReplayRecordArgType>(nameOrPathOrDescription);
|
|
280
|
+
// nameOrPathOrDescription = Helpers.cliTool.cleanCommand(nameOrPathOrDescription, options);
|
|
281
|
+
// const { resolved, commandString } = Helpers.cliTool
|
|
282
|
+
// .argsFromBegin<Scenario>(nameOrPathOrDescription, possiblePathToScenario => {
|
|
283
|
+
// const scenarioFromPath = (
|
|
284
|
+
// path.isAbsolute(possiblePathToScenario || '') &&
|
|
285
|
+
// Helpers.exists(possiblePathToScenario))
|
|
286
|
+
// ? possiblePathToScenario
|
|
287
|
+
// : path.join(
|
|
288
|
+
// this.cwd,
|
|
289
|
+
// config.folder.tmpScenarios,
|
|
290
|
+
// (possiblePathToScenario || '').trim());
|
|
291
|
+
// return Scenario.From(scenarioFromPath);
|
|
292
|
+
// });
|
|
293
|
+
// nameOrPathOrDescription = commandString;
|
|
294
|
+
// let scenarios = resolved;
|
|
295
|
+
// if (scenarios.length === 0 && commandString.trim() !== '') {
|
|
296
|
+
// const list = this.allScenarios;
|
|
297
|
+
// const { matches, results } = Helpers
|
|
298
|
+
// .arrays
|
|
299
|
+
// .fuzzy<Scenario>(nameOrPathOrDescription, list, (m) => m.description);
|
|
300
|
+
// scenarios = scenarios.concat(results);
|
|
301
|
+
// }
|
|
302
|
+
// const hostName = _.isString(options.hostName) ? [options.hostName]
|
|
303
|
+
// : (_.isArray(options.hostName) ? options.hostName : []);
|
|
304
|
+
// const portsOrUrlsForReplayServer = (_.isString(options.port) ? [Helpers.urlParse(options.port)]
|
|
305
|
+
// : (_.isArray(options.port) ? options.port.map(p => Helpers.urlParse(p))
|
|
306
|
+
// : [Helpers.urlParse(this.DEFAULT_TALKBACK_PROXY_SERVER_PORT)])).filter(u => u instanceof URL);
|
|
307
|
+
// if (portsOrUrlsForReplayServer.length === 0) {
|
|
308
|
+
// Helpers.error(`Please provide correct number or ports and hostnames
|
|
309
|
+
// host names = ${hostName.map(c => Helpers.urlParse(c)).join(', ')}
|
|
310
|
+
// talkback ports = ${portsOrUrlsForReplayServer.join(', ')}
|
|
311
|
+
// `, false, true);
|
|
312
|
+
// }
|
|
313
|
+
// let params = portsOrUrlsForReplayServer;
|
|
314
|
+
// if (hostName.length > 0) {
|
|
315
|
+
// if (hostName.length > portsOrUrlsForReplayServer.length) {
|
|
316
|
+
// const maxPort = _.maxBy(portsOrUrlsForReplayServer, p => Number(p.port));
|
|
317
|
+
// _.times(hostName.length - portsOrUrlsForReplayServer.length, n => {
|
|
318
|
+
// portsOrUrlsForReplayServer.push(Helpers.urlParse(Number(maxPort.port) + (n + 1)))
|
|
319
|
+
// });
|
|
320
|
+
// }
|
|
321
|
+
// params = hostName.reduce((prev, name, i) => {
|
|
322
|
+
// return _.merge(prev, { [name]: portsOrUrlsForReplayServer[i] })
|
|
323
|
+
// }, {}) as any;
|
|
324
|
+
// }
|
|
325
|
+
// returnValue.params = params as any;
|
|
326
|
+
// returnValue.scenarios = scenarios;
|
|
327
|
+
// //#endregion
|
|
328
|
+
// }
|
|
329
|
+
// //#region select menu scenraios
|
|
330
|
+
// if (returnValue.scenarios.length === 0) {
|
|
331
|
+
// if (showListIfNotMatch) {
|
|
332
|
+
// const selectedScenario = await this.selectScenario(goBackButtonOnList);
|
|
333
|
+
// returnValue.scenarios.push(selectedScenario);
|
|
334
|
+
// }
|
|
335
|
+
// }
|
|
336
|
+
// //#endregion
|
|
337
|
+
// return returnValue;
|
|
338
|
+
// }
|
|
339
|
+
// //#endregion
|
|
340
|
+
// //#region replay
|
|
341
|
+
// public async resolveScenariosData(
|
|
342
|
+
// nameOrPathOrDescription: string | string[] | ReplayConfigMeta,
|
|
343
|
+
// showListIfNotMatch = false,
|
|
344
|
+
// goBackButtonOnList = false,
|
|
345
|
+
// ) {
|
|
346
|
+
// const { scenarios, params } = await this.resolveReplayData(
|
|
347
|
+
// nameOrPathOrDescription,
|
|
348
|
+
// showListIfNotMatch,
|
|
349
|
+
// goBackButtonOnList,
|
|
350
|
+
// );
|
|
351
|
+
// if (scenarios.length === 0) {
|
|
352
|
+
// Helpers.error(`[record - replay - req - res - scenario]`
|
|
353
|
+
// + `Not able to find scenario by name or path "${nameOrPathOrDescription}"`, false, true);
|
|
354
|
+
// }
|
|
355
|
+
// // const tmpScenarioInfo = (s: Scenario) => {
|
|
356
|
+
// // const paramsTmpls = _.isArray(params) ? params.map(p => ` replay on ${p}`).join(',')
|
|
357
|
+
// // : _.keys(params).reduce((a, b) => {
|
|
358
|
+
// // return `${a}\n\t${chalk.bold(b)}:${params[b].href}`
|
|
359
|
+
// // }, '')
|
|
360
|
+
// // return `> ${chalk.bold(s.basename)} "${s.description}"` +
|
|
361
|
+
// // paramsTmpls;
|
|
362
|
+
// // };
|
|
363
|
+
// // Helpers.info(`
|
|
364
|
+
// // (${chalk.bold(scenarios.length.toString())}) scenario(s) to replay: `
|
|
365
|
+
// // + `${scenarios.map(s => tmpScenarioInfo(s)).join('\n')}`
|
|
366
|
+
// // );
|
|
367
|
+
// return { scenario: _.first(scenarios), scenarios, params };
|
|
368
|
+
// }
|
|
369
|
+
// //#endregion
|
|
370
|
+
// //#endregion
|
|
371
|
+
// }
|