ng-talkback 21.0.16 → 21.0.17
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 +14 -0
- package/lib-prod/env/env.angular-node-app.js +130 -0
- package/lib-prod/env/env.docs-webapp.js +130 -0
- package/lib-prod/env/env.electron-app.js +130 -0
- package/lib-prod/env/env.mobile-app.js +130 -0
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +130 -0
- package/lib-prod/env/env.vscode-plugin.js +130 -0
- package/lib-prod/env/index.js +6 -0
- package/lib-prod/es6.backend.js +5 -0
- package/lib-prod/features/error-rate.backend.js +25 -0
- package/lib-prod/features/latency.backend.js +30 -0
- package/lib-prod/index._auto-generated_.js +0 -0
- package/lib-prod/index.js +21 -0
- package/lib-prod/logger.backend.js +25 -0
- package/lib-prod/migrations/index.js +1 -0
- package/lib-prod/migrations/migrations_index._auto-generated_.js +0 -0
- package/lib-prod/options.backend.js +95 -0
- package/lib-prod/package.json +1 -1
- package/lib-prod/request-handler.backend.js +131 -0
- package/lib-prod/server.backend.js +82 -0
- package/lib-prod/summary.backend.js +24 -0
- package/lib-prod/talkback-factory.backend.js +19 -0
- package/lib-prod/tape-matcher.backend.js +95 -0
- package/lib-prod/tape-renderer.backend.js +93 -0
- package/lib-prod/tape-store.backend.js +94 -0
- package/lib-prod/tape.backend.js +75 -0
- package/lib-prod/types.backend.js +0 -0
- package/lib-prod/utils/content-encoding.backend.js +40 -0
- package/lib-prod/utils/headers.backend.js +16 -0
- package/lib-prod/utils/media-type.backend.js +54 -0
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
- package/lib-prod/build-info._auto-generated_.ts +0 -27
- package/lib-prod/env/env.angular-node-app.ts +0 -66
- package/lib-prod/env/env.docs-webapp.ts +0 -66
- package/lib-prod/env/env.electron-app.ts +0 -66
- package/lib-prod/env/env.mobile-app.ts +0 -66
- package/lib-prod/env/env.npm-lib-and-cli-tool.ts +0 -66
- package/lib-prod/env/env.vscode-plugin.ts +0 -66
- package/lib-prod/env/index.ts +0 -6
- package/lib-prod/es6.backend.ts +0 -3
- package/lib-prod/features/error-rate.backend.ts +0 -31
- package/lib-prod/features/latency.backend.ts +0 -38
- package/lib-prod/index._auto-generated_.ts +0 -5
- package/lib-prod/index.ts +0 -27
- package/lib-prod/lib-info.md +0 -8
- package/lib-prod/logger.backend.ts +0 -26
- package/lib-prod/migrations/index.ts +0 -2
- package/lib-prod/migrations/migrations-info.md +0 -6
- package/lib-prod/migrations/migrations_index._auto-generated_.ts +0 -5
- package/lib-prod/options.backend.ts +0 -140
- package/lib-prod/request-handler.backend.ts +0 -165
- package/lib-prod/server.backend.ts +0 -100
- package/lib-prod/summary.backend.ts +0 -26
- package/lib-prod/talkback-factory.backend.ts +0 -18
- package/lib-prod/tape-matcher.backend.ts +0 -113
- package/lib-prod/tape-renderer.backend.ts +0 -118
- package/lib-prod/tape-store.backend.ts +0 -111
- package/lib-prod/tape.backend.ts +0 -93
- package/lib-prod/types.backend.ts +0 -55
- package/lib-prod/utils/content-encoding.backend.ts +0 -53
- package/lib-prod/utils/headers.backend.ts +0 -14
- package/lib-prod/utils/media-type.backend.ts +0 -62
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_WEBSITE_DOMAIN = "ng-talkback.example.domain.com";
|
|
2
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_WEBSITE_TITLE = "Ng Talkback";
|
|
3
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_TARGET_ARTIFACT = "npm-lib-and-cli-tool";
|
|
4
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_ENV_NAME = "__";
|
|
5
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_CONTAINER_ONLY = void 0;
|
|
6
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_CONTAINER_END = void 0;
|
|
7
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_CONTAINER_START = void 0;
|
|
8
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_CONTAINER_SKIP_RELEASED = void 0;
|
|
9
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_CONTAINER_SKIP = void 0;
|
|
10
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_INIT_BRANDING = void 0;
|
|
11
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_INIT_STRUCT = void 0;
|
|
12
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_PWA_DISABLE_SERVICE_WORKER = void 0;
|
|
13
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_PWA_NAME = void 0;
|
|
14
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_PWA_SHORT_NAME = void 0;
|
|
15
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_PWA_START_URL = void 0;
|
|
16
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_ELECTRON_SHOW_DEV_TOOLS = void 0;
|
|
17
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_SSR = void 0;
|
|
18
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_WEBSQL = void 0;
|
|
19
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_PROD = void 0;
|
|
20
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_OVERRIDE_OUTPUT_PATH = void 0;
|
|
21
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_BASE_HREF = void 0;
|
|
22
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_WATCH = void 0;
|
|
23
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_GEN_ONLY_CLIENT_CODE = void 0;
|
|
24
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_LOADING_PRE_ANGULAR_BOOTSTRAP_LOADER = void 0;
|
|
25
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_LOADING_PRE_ANGULAR_BOOTSTRAP_BACKGROUND = void 0;
|
|
26
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_CLI_MINIFY = void 0;
|
|
27
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_CLI_INCLUDE_NODE_MODULES = void 0;
|
|
28
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_CLI_UGLIFY = void 0;
|
|
29
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_CLI_OBSCURE = void 0;
|
|
30
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_CLI_COMPRESS = void 0;
|
|
31
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_NODE_BACKEND_APP_MINIFY = void 0;
|
|
32
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_REMOVE_DTS = void 0;
|
|
33
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_OBSCURE_FILE_BY_FILE = void 0;
|
|
34
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_UGLIFY_FILE_BY_FILE = void 0;
|
|
35
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_INCLUDE_SOURCE_MAPS = void 0;
|
|
36
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_COMPRESS = void 0;
|
|
37
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_DO_NOT_INCLUDE_LIB_FILES = void 0;
|
|
38
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_RESOLVED_NEW_VERSION = void 0;
|
|
39
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_RELEASE_VERSION_BUMP_TYPE = void 0;
|
|
40
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_ENV_NUMBER = void 0;
|
|
41
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_INSTALL_LOCALLY = void 0;
|
|
42
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_REMOVE_RELEASE_OUTPUT_AFTER_LOCAL_INSTALL = void 0;
|
|
43
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_RELEASE_TYPE = void 0;
|
|
44
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_AUTO_RELEASE_USING_CONFIG = void 0;
|
|
45
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_AUTO_RELEASE_TASK_NAME = void 0;
|
|
46
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_TAON_INSTANCE_IP = void 0;
|
|
47
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_NPM_PUBLISH = void 0;
|
|
48
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_DEPLOY = void 0;
|
|
49
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_TAG_GIT_PUSH = void 0;
|
|
50
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_RELEASE_QUESTION = void 0;
|
|
51
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_RESOLVING_GIT_CHANGES = void 0;
|
|
52
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_CODE_CUTTING = void 0;
|
|
53
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_BUILDING_ARTIFACTS = void 0;
|
|
54
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_COPY_TO_MANAGER_BEFORE_COPY_HOOK = void 0;
|
|
55
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_COPY_TO_MANAGER_COPY_TO_LOCATIONS = void 0;
|
|
56
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_COPY_TO_MANAGER_COPY_TO_PROJECTS = void 0;
|
|
57
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_COPY_TO_MANAGER_SKIP = void 0;
|
|
58
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_WEBSITE_USE_DOMAIN = void 0;
|
|
59
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_PURPOSE = void 0;
|
|
60
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_RECURSIVE_ACTION = void 0;
|
|
61
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_IS_CI_PROCESS = void 0;
|
|
62
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_DOCKER_ADDITIONAL_CONTAINER = void 0;
|
|
63
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_DOCKER_SKIP_START_IN_ORDER = void 0;
|
|
64
|
+
const ENV_NPM_LIB_AND_CLI_TOOL_DOCKER_SKIP_USING_MYSQL_DB = void 0;
|
|
65
|
+
export {
|
|
66
|
+
ENV_NPM_LIB_AND_CLI_TOOL_BUILD_BASE_HREF,
|
|
67
|
+
ENV_NPM_LIB_AND_CLI_TOOL_BUILD_ELECTRON_SHOW_DEV_TOOLS,
|
|
68
|
+
ENV_NPM_LIB_AND_CLI_TOOL_BUILD_GEN_ONLY_CLIENT_CODE,
|
|
69
|
+
ENV_NPM_LIB_AND_CLI_TOOL_BUILD_OVERRIDE_OUTPUT_PATH,
|
|
70
|
+
ENV_NPM_LIB_AND_CLI_TOOL_BUILD_PROD,
|
|
71
|
+
ENV_NPM_LIB_AND_CLI_TOOL_BUILD_PWA_DISABLE_SERVICE_WORKER,
|
|
72
|
+
ENV_NPM_LIB_AND_CLI_TOOL_BUILD_PWA_NAME,
|
|
73
|
+
ENV_NPM_LIB_AND_CLI_TOOL_BUILD_PWA_SHORT_NAME,
|
|
74
|
+
ENV_NPM_LIB_AND_CLI_TOOL_BUILD_PWA_START_URL,
|
|
75
|
+
ENV_NPM_LIB_AND_CLI_TOOL_BUILD_SSR,
|
|
76
|
+
ENV_NPM_LIB_AND_CLI_TOOL_BUILD_WATCH,
|
|
77
|
+
ENV_NPM_LIB_AND_CLI_TOOL_BUILD_WEBSQL,
|
|
78
|
+
ENV_NPM_LIB_AND_CLI_TOOL_CONTAINER_END,
|
|
79
|
+
ENV_NPM_LIB_AND_CLI_TOOL_CONTAINER_ONLY,
|
|
80
|
+
ENV_NPM_LIB_AND_CLI_TOOL_CONTAINER_SKIP,
|
|
81
|
+
ENV_NPM_LIB_AND_CLI_TOOL_CONTAINER_SKIP_RELEASED,
|
|
82
|
+
ENV_NPM_LIB_AND_CLI_TOOL_CONTAINER_START,
|
|
83
|
+
ENV_NPM_LIB_AND_CLI_TOOL_COPY_TO_MANAGER_BEFORE_COPY_HOOK,
|
|
84
|
+
ENV_NPM_LIB_AND_CLI_TOOL_COPY_TO_MANAGER_COPY_TO_LOCATIONS,
|
|
85
|
+
ENV_NPM_LIB_AND_CLI_TOOL_COPY_TO_MANAGER_COPY_TO_PROJECTS,
|
|
86
|
+
ENV_NPM_LIB_AND_CLI_TOOL_COPY_TO_MANAGER_SKIP,
|
|
87
|
+
ENV_NPM_LIB_AND_CLI_TOOL_DOCKER_ADDITIONAL_CONTAINER,
|
|
88
|
+
ENV_NPM_LIB_AND_CLI_TOOL_DOCKER_SKIP_START_IN_ORDER,
|
|
89
|
+
ENV_NPM_LIB_AND_CLI_TOOL_DOCKER_SKIP_USING_MYSQL_DB,
|
|
90
|
+
ENV_NPM_LIB_AND_CLI_TOOL_INIT_BRANDING,
|
|
91
|
+
ENV_NPM_LIB_AND_CLI_TOOL_INIT_STRUCT,
|
|
92
|
+
ENV_NPM_LIB_AND_CLI_TOOL_IS_CI_PROCESS,
|
|
93
|
+
ENV_NPM_LIB_AND_CLI_TOOL_LOADING_PRE_ANGULAR_BOOTSTRAP_BACKGROUND,
|
|
94
|
+
ENV_NPM_LIB_AND_CLI_TOOL_LOADING_PRE_ANGULAR_BOOTSTRAP_LOADER,
|
|
95
|
+
ENV_NPM_LIB_AND_CLI_TOOL_PURPOSE,
|
|
96
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RECURSIVE_ACTION,
|
|
97
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_AUTO_RELEASE_TASK_NAME,
|
|
98
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_AUTO_RELEASE_USING_CONFIG,
|
|
99
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_CLI_COMPRESS,
|
|
100
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_CLI_INCLUDE_NODE_MODULES,
|
|
101
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_CLI_MINIFY,
|
|
102
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_CLI_OBSCURE,
|
|
103
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_CLI_UGLIFY,
|
|
104
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_ENV_NAME,
|
|
105
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_ENV_NUMBER,
|
|
106
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_INSTALL_LOCALLY,
|
|
107
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_COMPRESS,
|
|
108
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_DO_NOT_INCLUDE_LIB_FILES,
|
|
109
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_INCLUDE_SOURCE_MAPS,
|
|
110
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_OBSCURE_FILE_BY_FILE,
|
|
111
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_REMOVE_DTS,
|
|
112
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_UGLIFY_FILE_BY_FILE,
|
|
113
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_NODE_BACKEND_APP_MINIFY,
|
|
114
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_RELEASE_TYPE,
|
|
115
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_RELEASE_VERSION_BUMP_TYPE,
|
|
116
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_REMOVE_RELEASE_OUTPUT_AFTER_LOCAL_INSTALL,
|
|
117
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_RESOLVED_NEW_VERSION,
|
|
118
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_BUILDING_ARTIFACTS,
|
|
119
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_CODE_CUTTING,
|
|
120
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_DEPLOY,
|
|
121
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_NPM_PUBLISH,
|
|
122
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_RELEASE_QUESTION,
|
|
123
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_RESOLVING_GIT_CHANGES,
|
|
124
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_TAG_GIT_PUSH,
|
|
125
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_TAON_INSTANCE_IP,
|
|
126
|
+
ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_TARGET_ARTIFACT,
|
|
127
|
+
ENV_NPM_LIB_AND_CLI_TOOL_WEBSITE_DOMAIN,
|
|
128
|
+
ENV_NPM_LIB_AND_CLI_TOOL_WEBSITE_TITLE,
|
|
129
|
+
ENV_NPM_LIB_AND_CLI_TOOL_WEBSITE_USE_DOMAIN
|
|
130
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
const ENV_VSCODE_PLUGIN_WEBSITE_DOMAIN = "ng-talkback.example.domain.com";
|
|
2
|
+
const ENV_VSCODE_PLUGIN_WEBSITE_TITLE = "Ng Talkback";
|
|
3
|
+
const ENV_VSCODE_PLUGIN_RELEASE_TARGET_ARTIFACT = "vscode-plugin";
|
|
4
|
+
const ENV_VSCODE_PLUGIN_RELEASE_ENV_NAME = "__";
|
|
5
|
+
const ENV_VSCODE_PLUGIN_CONTAINER_ONLY = void 0;
|
|
6
|
+
const ENV_VSCODE_PLUGIN_CONTAINER_END = void 0;
|
|
7
|
+
const ENV_VSCODE_PLUGIN_CONTAINER_START = void 0;
|
|
8
|
+
const ENV_VSCODE_PLUGIN_CONTAINER_SKIP_RELEASED = void 0;
|
|
9
|
+
const ENV_VSCODE_PLUGIN_CONTAINER_SKIP = void 0;
|
|
10
|
+
const ENV_VSCODE_PLUGIN_INIT_BRANDING = void 0;
|
|
11
|
+
const ENV_VSCODE_PLUGIN_INIT_STRUCT = void 0;
|
|
12
|
+
const ENV_VSCODE_PLUGIN_BUILD_PWA_DISABLE_SERVICE_WORKER = void 0;
|
|
13
|
+
const ENV_VSCODE_PLUGIN_BUILD_PWA_NAME = void 0;
|
|
14
|
+
const ENV_VSCODE_PLUGIN_BUILD_PWA_SHORT_NAME = void 0;
|
|
15
|
+
const ENV_VSCODE_PLUGIN_BUILD_PWA_START_URL = void 0;
|
|
16
|
+
const ENV_VSCODE_PLUGIN_BUILD_ELECTRON_SHOW_DEV_TOOLS = void 0;
|
|
17
|
+
const ENV_VSCODE_PLUGIN_BUILD_SSR = void 0;
|
|
18
|
+
const ENV_VSCODE_PLUGIN_BUILD_WEBSQL = void 0;
|
|
19
|
+
const ENV_VSCODE_PLUGIN_BUILD_PROD = void 0;
|
|
20
|
+
const ENV_VSCODE_PLUGIN_BUILD_OVERRIDE_OUTPUT_PATH = void 0;
|
|
21
|
+
const ENV_VSCODE_PLUGIN_BUILD_BASE_HREF = void 0;
|
|
22
|
+
const ENV_VSCODE_PLUGIN_BUILD_WATCH = void 0;
|
|
23
|
+
const ENV_VSCODE_PLUGIN_BUILD_GEN_ONLY_CLIENT_CODE = void 0;
|
|
24
|
+
const ENV_VSCODE_PLUGIN_LOADING_PRE_ANGULAR_BOOTSTRAP_LOADER = void 0;
|
|
25
|
+
const ENV_VSCODE_PLUGIN_LOADING_PRE_ANGULAR_BOOTSTRAP_BACKGROUND = void 0;
|
|
26
|
+
const ENV_VSCODE_PLUGIN_RELEASE_CLI_MINIFY = void 0;
|
|
27
|
+
const ENV_VSCODE_PLUGIN_RELEASE_CLI_INCLUDE_NODE_MODULES = void 0;
|
|
28
|
+
const ENV_VSCODE_PLUGIN_RELEASE_CLI_UGLIFY = void 0;
|
|
29
|
+
const ENV_VSCODE_PLUGIN_RELEASE_CLI_OBSCURE = void 0;
|
|
30
|
+
const ENV_VSCODE_PLUGIN_RELEASE_CLI_COMPRESS = void 0;
|
|
31
|
+
const ENV_VSCODE_PLUGIN_RELEASE_NODE_BACKEND_APP_MINIFY = void 0;
|
|
32
|
+
const ENV_VSCODE_PLUGIN_RELEASE_LIB_REMOVE_DTS = void 0;
|
|
33
|
+
const ENV_VSCODE_PLUGIN_RELEASE_LIB_OBSCURE_FILE_BY_FILE = void 0;
|
|
34
|
+
const ENV_VSCODE_PLUGIN_RELEASE_LIB_UGLIFY_FILE_BY_FILE = void 0;
|
|
35
|
+
const ENV_VSCODE_PLUGIN_RELEASE_LIB_INCLUDE_SOURCE_MAPS = void 0;
|
|
36
|
+
const ENV_VSCODE_PLUGIN_RELEASE_LIB_COMPRESS = void 0;
|
|
37
|
+
const ENV_VSCODE_PLUGIN_RELEASE_LIB_DO_NOT_INCLUDE_LIB_FILES = void 0;
|
|
38
|
+
const ENV_VSCODE_PLUGIN_RELEASE_RESOLVED_NEW_VERSION = void 0;
|
|
39
|
+
const ENV_VSCODE_PLUGIN_RELEASE_RELEASE_VERSION_BUMP_TYPE = void 0;
|
|
40
|
+
const ENV_VSCODE_PLUGIN_RELEASE_ENV_NUMBER = void 0;
|
|
41
|
+
const ENV_VSCODE_PLUGIN_RELEASE_INSTALL_LOCALLY = void 0;
|
|
42
|
+
const ENV_VSCODE_PLUGIN_RELEASE_REMOVE_RELEASE_OUTPUT_AFTER_LOCAL_INSTALL = void 0;
|
|
43
|
+
const ENV_VSCODE_PLUGIN_RELEASE_RELEASE_TYPE = void 0;
|
|
44
|
+
const ENV_VSCODE_PLUGIN_RELEASE_AUTO_RELEASE_USING_CONFIG = void 0;
|
|
45
|
+
const ENV_VSCODE_PLUGIN_RELEASE_AUTO_RELEASE_TASK_NAME = void 0;
|
|
46
|
+
const ENV_VSCODE_PLUGIN_RELEASE_TAON_INSTANCE_IP = void 0;
|
|
47
|
+
const ENV_VSCODE_PLUGIN_RELEASE_SKIP_NPM_PUBLISH = void 0;
|
|
48
|
+
const ENV_VSCODE_PLUGIN_RELEASE_SKIP_DEPLOY = void 0;
|
|
49
|
+
const ENV_VSCODE_PLUGIN_RELEASE_SKIP_TAG_GIT_PUSH = void 0;
|
|
50
|
+
const ENV_VSCODE_PLUGIN_RELEASE_SKIP_RELEASE_QUESTION = void 0;
|
|
51
|
+
const ENV_VSCODE_PLUGIN_RELEASE_SKIP_RESOLVING_GIT_CHANGES = void 0;
|
|
52
|
+
const ENV_VSCODE_PLUGIN_RELEASE_SKIP_CODE_CUTTING = void 0;
|
|
53
|
+
const ENV_VSCODE_PLUGIN_RELEASE_SKIP_BUILDING_ARTIFACTS = void 0;
|
|
54
|
+
const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_BEFORE_COPY_HOOK = void 0;
|
|
55
|
+
const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_COPY_TO_LOCATIONS = void 0;
|
|
56
|
+
const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_COPY_TO_PROJECTS = void 0;
|
|
57
|
+
const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_SKIP = void 0;
|
|
58
|
+
const ENV_VSCODE_PLUGIN_WEBSITE_USE_DOMAIN = void 0;
|
|
59
|
+
const ENV_VSCODE_PLUGIN_PURPOSE = void 0;
|
|
60
|
+
const ENV_VSCODE_PLUGIN_RECURSIVE_ACTION = void 0;
|
|
61
|
+
const ENV_VSCODE_PLUGIN_IS_CI_PROCESS = void 0;
|
|
62
|
+
const ENV_VSCODE_PLUGIN_DOCKER_ADDITIONAL_CONTAINER = void 0;
|
|
63
|
+
const ENV_VSCODE_PLUGIN_DOCKER_SKIP_START_IN_ORDER = void 0;
|
|
64
|
+
const ENV_VSCODE_PLUGIN_DOCKER_SKIP_USING_MYSQL_DB = void 0;
|
|
65
|
+
export {
|
|
66
|
+
ENV_VSCODE_PLUGIN_BUILD_BASE_HREF,
|
|
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
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import OptionsFactory from "../options.backend";
|
|
2
|
+
class ErrorRate {
|
|
3
|
+
options;
|
|
4
|
+
constructor(options) {
|
|
5
|
+
this.options = options;
|
|
6
|
+
}
|
|
7
|
+
shouldSimulate(req, tape) {
|
|
8
|
+
const globalErrorRate = typeof this.options.errorRate === "number" ? this.options.errorRate : this.options.errorRate(req);
|
|
9
|
+
const errorRate = tape && tape.meta.errorRate !== void 0 ? tape.meta.errorRate : globalErrorRate;
|
|
10
|
+
OptionsFactory.validateErrorRate(errorRate);
|
|
11
|
+
const random = Math.random() * 100;
|
|
12
|
+
return random < errorRate;
|
|
13
|
+
}
|
|
14
|
+
simulate(req) {
|
|
15
|
+
this.options.logger.log(`Simulating error for ${req.url}`);
|
|
16
|
+
return {
|
|
17
|
+
status: 503,
|
|
18
|
+
headers: { "content-type": ["text/plain"] },
|
|
19
|
+
body: Buffer.from("talkback - failure injection")
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
ErrorRate as default
|
|
25
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import OptionsFactory from "../options.backend";
|
|
2
|
+
class Latency {
|
|
3
|
+
options;
|
|
4
|
+
constructor(options) {
|
|
5
|
+
this.options = options;
|
|
6
|
+
}
|
|
7
|
+
async simulate(req, tape) {
|
|
8
|
+
const resolved = Promise.resolve();
|
|
9
|
+
const latencyGenerator = tape && tape.meta.latency !== void 0 ? tape.meta.latency : this.options.latency;
|
|
10
|
+
if (!latencyGenerator) {
|
|
11
|
+
return resolved;
|
|
12
|
+
}
|
|
13
|
+
OptionsFactory.validateLatency(latencyGenerator);
|
|
14
|
+
let latency = 0;
|
|
15
|
+
const type = typeof latencyGenerator;
|
|
16
|
+
if (type === "number") {
|
|
17
|
+
latency = latencyGenerator;
|
|
18
|
+
} else if (Array.isArray(latencyGenerator)) {
|
|
19
|
+
const high = latencyGenerator[1];
|
|
20
|
+
const low = latencyGenerator[0];
|
|
21
|
+
latency = Math.random() * (high - low) + low;
|
|
22
|
+
} else {
|
|
23
|
+
latency = latencyGenerator(req);
|
|
24
|
+
}
|
|
25
|
+
return new Promise((r) => setTimeout(r, latency));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
Latency as default
|
|
30
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
let a = 2;
|
|
2
|
+
a++;
|
|
3
|
+
export * from "./options.backend";
|
|
4
|
+
export * from "./tape.backend";
|
|
5
|
+
import TalkbackFactory from "./talkback-factory.backend";
|
|
6
|
+
import { DefaultOptions, FallbackMode, RecordMode } from "./options.backend";
|
|
7
|
+
const talkbackFn = (options) => {
|
|
8
|
+
return TalkbackFactory.server(options);
|
|
9
|
+
};
|
|
10
|
+
talkbackFn.Options = {
|
|
11
|
+
Default: DefaultOptions,
|
|
12
|
+
FallbackMode,
|
|
13
|
+
RecordMode
|
|
14
|
+
};
|
|
15
|
+
talkbackFn.requestHandler = (options) => TalkbackFactory.requestHandler(options);
|
|
16
|
+
const talkback = talkbackFn;
|
|
17
|
+
var index_default = talkbackFn;
|
|
18
|
+
export {
|
|
19
|
+
index_default as default,
|
|
20
|
+
talkback
|
|
21
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
class Logger {
|
|
2
|
+
options;
|
|
3
|
+
constructor(options) {
|
|
4
|
+
this.options = options;
|
|
5
|
+
if (this.options.debug) {
|
|
6
|
+
console.debug("DEBUG mode active");
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
log(message) {
|
|
10
|
+
if (!this.options.silent || this.options.debug) {
|
|
11
|
+
console.log(message);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
debug(message) {
|
|
15
|
+
if (this.options.debug) {
|
|
16
|
+
console.debug(message);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
error(message) {
|
|
20
|
+
console.error(message);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
Logger as default
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./migrations_index._auto-generated_";
|
|
File without changes
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import Logger from "./logger.backend";
|
|
2
|
+
const RecordMode = {
|
|
3
|
+
NEW: "NEW",
|
|
4
|
+
// If no tape matches the request, proxy it and save the response to a tape
|
|
5
|
+
OVERWRITE: "OVERWRITE",
|
|
6
|
+
// Always proxy the request and save the response to a tape, overwriting any existing one
|
|
7
|
+
DISABLED: "DISABLED",
|
|
8
|
+
// If a matching tape exists, return it. Otherwise, don't proxy the request and use `fallbackMode` for the response
|
|
9
|
+
ALL: []
|
|
10
|
+
};
|
|
11
|
+
RecordMode.ALL = [RecordMode.NEW, RecordMode.OVERWRITE, RecordMode.DISABLED];
|
|
12
|
+
const FallbackMode = {
|
|
13
|
+
NOT_FOUND: "NOT_FOUND",
|
|
14
|
+
PROXY: "PROXY",
|
|
15
|
+
ALL: []
|
|
16
|
+
};
|
|
17
|
+
FallbackMode.ALL = [FallbackMode.NOT_FOUND, FallbackMode.PROXY];
|
|
18
|
+
const DefaultOptions = {
|
|
19
|
+
host: "",
|
|
20
|
+
port: 8080,
|
|
21
|
+
path: "./tapes/",
|
|
22
|
+
record: RecordMode.NEW,
|
|
23
|
+
fallbackMode: FallbackMode.NOT_FOUND,
|
|
24
|
+
name: "unnamed",
|
|
25
|
+
tapeNameGenerator: void 0,
|
|
26
|
+
https: {
|
|
27
|
+
enabled: false,
|
|
28
|
+
keyPath: void 0,
|
|
29
|
+
certPath: void 0
|
|
30
|
+
},
|
|
31
|
+
ignoreHeaders: ["content-length", "host"],
|
|
32
|
+
ignoreQueryParams: [],
|
|
33
|
+
ignoreBody: false,
|
|
34
|
+
bodyMatcher: void 0,
|
|
35
|
+
urlMatcher: void 0,
|
|
36
|
+
requestDecorator: void 0,
|
|
37
|
+
responseDecorator: void 0,
|
|
38
|
+
tapeDecorator: void 0,
|
|
39
|
+
latency: 0,
|
|
40
|
+
errorRate: 0,
|
|
41
|
+
silent: false,
|
|
42
|
+
summary: true,
|
|
43
|
+
debug: false,
|
|
44
|
+
logger: new Logger({})
|
|
45
|
+
};
|
|
46
|
+
class OptionsFactory {
|
|
47
|
+
static logger;
|
|
48
|
+
static prepare(usrOpts = {}) {
|
|
49
|
+
const opts = {
|
|
50
|
+
...DefaultOptions,
|
|
51
|
+
name: usrOpts.host,
|
|
52
|
+
...usrOpts,
|
|
53
|
+
ignoreHeaders: [
|
|
54
|
+
...DefaultOptions.ignoreHeaders,
|
|
55
|
+
...usrOpts.ignoreHeaders || []
|
|
56
|
+
]
|
|
57
|
+
};
|
|
58
|
+
this.logger = new Logger(opts);
|
|
59
|
+
opts.logger = this.logger;
|
|
60
|
+
this.validateOptions(opts);
|
|
61
|
+
return opts;
|
|
62
|
+
}
|
|
63
|
+
static validateOptions(opts) {
|
|
64
|
+
this.validateRecord(opts.record);
|
|
65
|
+
this.validateFallbackMode(opts.fallbackMode);
|
|
66
|
+
this.validateLatency(opts.latency);
|
|
67
|
+
this.validateErrorRate(opts.errorRate);
|
|
68
|
+
}
|
|
69
|
+
static validateRecord(record) {
|
|
70
|
+
if (typeof record === "string" && !RecordMode.ALL.includes(record)) {
|
|
71
|
+
throw `INVALID OPTION: record has an invalid value of '${record}'`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
static validateFallbackMode(fallbackMode) {
|
|
75
|
+
if (typeof fallbackMode === "string" && !FallbackMode.ALL.includes(fallbackMode)) {
|
|
76
|
+
throw `INVALID OPTION: fallbackMode has an invalid value of '${fallbackMode}'`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
static validateLatency(latency) {
|
|
80
|
+
if (Array.isArray(latency) && latency.length !== 2) {
|
|
81
|
+
throw `Invalid LATENCY option. If using a range, the array should only have 2 values [min, max]. Current=[${latency}]`;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
static validateErrorRate(errorRate) {
|
|
85
|
+
if (typeof errorRate !== "function" && (errorRate < 0 || errorRate > 100)) {
|
|
86
|
+
throw `Invalid ERRORRATE option. Value should be between 0 and 100. Current=[${errorRate}]`;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
DefaultOptions,
|
|
92
|
+
FallbackMode,
|
|
93
|
+
RecordMode,
|
|
94
|
+
OptionsFactory as default
|
|
95
|
+
};
|
package/lib-prod/package.json
CHANGED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from "uuid";
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import Tape from "./tape.backend";
|
|
4
|
+
import OptionsFactory, { RecordMode, FallbackMode } from "./options.backend";
|
|
5
|
+
import ErrorRate from "./features/error-rate.backend";
|
|
6
|
+
import Latency from "./features/latency.backend";
|
|
7
|
+
class RequestHandler {
|
|
8
|
+
tapeStore;
|
|
9
|
+
options;
|
|
10
|
+
errorRate;
|
|
11
|
+
latency;
|
|
12
|
+
constructor(tapeStore, options) {
|
|
13
|
+
this.tapeStore = tapeStore;
|
|
14
|
+
this.options = options;
|
|
15
|
+
this.errorRate = new ErrorRate(this.options);
|
|
16
|
+
this.latency = new Latency(this.options);
|
|
17
|
+
}
|
|
18
|
+
async handle(req) {
|
|
19
|
+
const matchingContext = {
|
|
20
|
+
id: uuidv4()
|
|
21
|
+
};
|
|
22
|
+
const recordMode = typeof this.options.record === "string" ? this.options.record : this.options.record(req);
|
|
23
|
+
OptionsFactory.validateRecord(recordMode);
|
|
24
|
+
if (this.options.requestDecorator) {
|
|
25
|
+
req = this.options.requestDecorator(req, matchingContext);
|
|
26
|
+
if (!req) {
|
|
27
|
+
throw new Error("requestDecorator didn't return a req object");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
let newTape = new Tape(req, this.options);
|
|
31
|
+
let matchingTape = this.tapeStore.find(newTape);
|
|
32
|
+
let resObj, responseTape;
|
|
33
|
+
if (recordMode !== RecordMode.OVERWRITE && matchingTape) {
|
|
34
|
+
responseTape = matchingTape;
|
|
35
|
+
if (this.errorRate.shouldSimulate(req, matchingTape)) {
|
|
36
|
+
return this.errorRate.simulate(req);
|
|
37
|
+
}
|
|
38
|
+
await this.latency.simulate(req, matchingTape);
|
|
39
|
+
} else {
|
|
40
|
+
if (matchingTape) {
|
|
41
|
+
responseTape = matchingTape;
|
|
42
|
+
} else {
|
|
43
|
+
responseTape = newTape;
|
|
44
|
+
}
|
|
45
|
+
if (recordMode === RecordMode.NEW || recordMode === RecordMode.OVERWRITE) {
|
|
46
|
+
resObj = await this.makeRealRequest(req);
|
|
47
|
+
responseTape.res = { ...resObj };
|
|
48
|
+
if (this.options.tapeDecorator) {
|
|
49
|
+
responseTape = this.options.tapeDecorator(responseTape, matchingContext);
|
|
50
|
+
if (!responseTape) {
|
|
51
|
+
throw new Error("tapeDecorator didn't return a tape object");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
await this.tapeStore.save(responseTape);
|
|
55
|
+
} else {
|
|
56
|
+
resObj = await this.onNoRecord(req);
|
|
57
|
+
responseTape.res = { ...resObj };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
resObj = responseTape.res;
|
|
61
|
+
if (this.options.responseDecorator) {
|
|
62
|
+
const clonedTape = await responseTape.clone();
|
|
63
|
+
const resTape = this.options.responseDecorator(clonedTape, req, matchingContext);
|
|
64
|
+
if (!resTape) {
|
|
65
|
+
throw new Error("responseDecorator didn't return a tape object");
|
|
66
|
+
}
|
|
67
|
+
if (resTape.res.headers["content-length"]) {
|
|
68
|
+
resTape.res.headers["content-length"] = resTape.res.body.length;
|
|
69
|
+
}
|
|
70
|
+
resObj = resTape.res;
|
|
71
|
+
}
|
|
72
|
+
return resObj;
|
|
73
|
+
}
|
|
74
|
+
async onNoRecord(req) {
|
|
75
|
+
const fallbackMode = typeof this.options.fallbackMode === "string" ? this.options.fallbackMode : this.options.fallbackMode(req);
|
|
76
|
+
OptionsFactory.validateFallbackMode(fallbackMode);
|
|
77
|
+
this.options.logger.log(`Tape for ${req.url} not found and recording is disabled (fallbackMode: ${fallbackMode})`);
|
|
78
|
+
this.options.logger.log({
|
|
79
|
+
url: req.url,
|
|
80
|
+
headers: req.headers
|
|
81
|
+
});
|
|
82
|
+
if (fallbackMode === FallbackMode.PROXY) {
|
|
83
|
+
if (this.errorRate.shouldSimulate(req, void 0)) {
|
|
84
|
+
return this.errorRate.simulate(req);
|
|
85
|
+
}
|
|
86
|
+
await this.latency.simulate(req, void 0);
|
|
87
|
+
return await this.makeRealRequest(req);
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
status: 404,
|
|
91
|
+
headers: { "content-type": ["text/plain"] },
|
|
92
|
+
body: Buffer.from("talkback - tape not found")
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
async makeRealRequest(req) {
|
|
96
|
+
let { method, url, body } = req;
|
|
97
|
+
const headers = { ...req.headers };
|
|
98
|
+
delete headers.host;
|
|
99
|
+
const host = this.options.host;
|
|
100
|
+
let urlToGetData = `${host}${url}`;
|
|
101
|
+
var fRes = {
|
|
102
|
+
status: 400,
|
|
103
|
+
headers: {},
|
|
104
|
+
body: new Buffer("")
|
|
105
|
+
};
|
|
106
|
+
try {
|
|
107
|
+
const r = await axios({
|
|
108
|
+
url: urlToGetData,
|
|
109
|
+
method,
|
|
110
|
+
headers,
|
|
111
|
+
data: body,
|
|
112
|
+
responseType: "arraybuffer"
|
|
113
|
+
});
|
|
114
|
+
fRes = {
|
|
115
|
+
status: r.status,
|
|
116
|
+
headers: r.headers,
|
|
117
|
+
body: r.data
|
|
118
|
+
};
|
|
119
|
+
} catch (err) {
|
|
120
|
+
fRes = {
|
|
121
|
+
status: err?.response?.status,
|
|
122
|
+
headers: err?.response?.headers,
|
|
123
|
+
body: err?.response?.data
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
return fRes;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export {
|
|
130
|
+
RequestHandler as default
|
|
131
|
+
};
|