record-replay-req-res-scenario 21.0.16 → 21.0.18
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_.ts → build-info._auto-generated_.js} +1 -2
- package/lib-prod/env/{env.angular-node-app.ts → env.angular-node-app.js} +1 -1
- package/lib-prod/env/{env.docs-webapp.ts → env.docs-webapp.js} +1 -1
- package/lib-prod/env/{env.electron-app.ts → env.electron-app.js} +1 -1
- package/lib-prod/env/{env.mobile-app.ts → env.mobile-app.js} +1 -1
- package/lib-prod/env/{env.npm-lib-and-cli-tool.ts → env.npm-lib-and-cli-tool.js} +1 -1
- package/lib-prod/env/{env.vscode-plugin.ts → env.vscode-plugin.js} +1 -1
- package/lib-prod/{index._auto-generated_.ts → index._auto-generated_.js} +1 -1
- package/lib-prod/{index.ts → index.js} +1 -4
- package/lib-prod/migrations/index.js +2 -0
- package/lib-prod/migrations/{migrations_index._auto-generated_.ts → migrations_index._auto-generated_.js} +0 -2
- package/lib-prod/package.json +1 -1
- package/lib-prod/{record-replay-req-res-scenario.ts → record-replay-req-res-scenario.js} +1 -49
- package/lib-prod/{scenario.backend.ts → scenario.backend.js} +1 -32
- package/lib-prod/{start.backend.ts → start.backend.js} +1 -2
- package/lib-prod/{tape.backend.ts → tape.backend.js} +1 -8
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
- package/lib-prod/lib-info.md +0 -8
- package/lib-prod/migrations/index.ts +0 -2
- package/lib-prod/migrations/migrations-info.md +0 -6
- /package/lib-prod/env/{index.ts → index.js} +0 -0
package/browser/package.json
CHANGED
|
@@ -25,6 +25,6 @@ exports.CURRENT_PACKAGE_TAON_VERSION = 'v21';
|
|
|
25
25
|
/**
|
|
26
26
|
* Autogenerated by current cli tool. Use *tnp release* to bump version.
|
|
27
27
|
*/
|
|
28
|
-
exports.CURRENT_PACKAGE_VERSION = '21.0.
|
|
28
|
+
exports.CURRENT_PACKAGE_VERSION = '21.0.18';
|
|
29
29
|
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
30
30
|
//# sourceMappingURL=build-info._auto-generated_.js.map
|
package/lib/package.json
CHANGED
|
@@ -22,6 +22,5 @@ export const CURRENT_PACKAGE_TAON_VERSION = 'v21';
|
|
|
22
22
|
/**
|
|
23
23
|
* Autogenerated by current cli tool. Use *tnp release* to bump version.
|
|
24
24
|
*/
|
|
25
|
-
export const CURRENT_PACKAGE_VERSION = '21.0.
|
|
25
|
+
export const CURRENT_PACKAGE_VERSION = '21.0.18';
|
|
26
26
|
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
27
|
-
|
|
@@ -63,4 +63,4 @@ export const ENV_ANGULAR_NODE_APP_IS_CI_PROCESS = undefined;
|
|
|
63
63
|
export const ENV_ANGULAR_NODE_APP_DOCKER_ADDITIONAL_CONTAINER = undefined;
|
|
64
64
|
export const ENV_ANGULAR_NODE_APP_DOCKER_SKIP_START_IN_ORDER = undefined;
|
|
65
65
|
export const ENV_ANGULAR_NODE_APP_DOCKER_SKIP_USING_MYSQL_DB = undefined;
|
|
66
|
-
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
66
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
@@ -63,4 +63,4 @@ export const ENV_DOCS_WEBAPP_IS_CI_PROCESS = undefined;
|
|
|
63
63
|
export const ENV_DOCS_WEBAPP_DOCKER_ADDITIONAL_CONTAINER = undefined;
|
|
64
64
|
export const ENV_DOCS_WEBAPP_DOCKER_SKIP_START_IN_ORDER = undefined;
|
|
65
65
|
export const ENV_DOCS_WEBAPP_DOCKER_SKIP_USING_MYSQL_DB = undefined;
|
|
66
|
-
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
66
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
@@ -63,4 +63,4 @@ export const ENV_ELECTRON_APP_IS_CI_PROCESS = undefined;
|
|
|
63
63
|
export const ENV_ELECTRON_APP_DOCKER_ADDITIONAL_CONTAINER = undefined;
|
|
64
64
|
export const ENV_ELECTRON_APP_DOCKER_SKIP_START_IN_ORDER = undefined;
|
|
65
65
|
export const ENV_ELECTRON_APP_DOCKER_SKIP_USING_MYSQL_DB = undefined;
|
|
66
|
-
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
66
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
@@ -63,4 +63,4 @@ export const ENV_MOBILE_APP_IS_CI_PROCESS = undefined;
|
|
|
63
63
|
export const ENV_MOBILE_APP_DOCKER_ADDITIONAL_CONTAINER = undefined;
|
|
64
64
|
export const ENV_MOBILE_APP_DOCKER_SKIP_START_IN_ORDER = undefined;
|
|
65
65
|
export const ENV_MOBILE_APP_DOCKER_SKIP_USING_MYSQL_DB = undefined;
|
|
66
|
-
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
66
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
@@ -63,4 +63,4 @@ export const ENV_NPM_LIB_AND_CLI_TOOL_IS_CI_PROCESS = undefined;
|
|
|
63
63
|
export const ENV_NPM_LIB_AND_CLI_TOOL_DOCKER_ADDITIONAL_CONTAINER = undefined;
|
|
64
64
|
export const ENV_NPM_LIB_AND_CLI_TOOL_DOCKER_SKIP_START_IN_ORDER = undefined;
|
|
65
65
|
export const ENV_NPM_LIB_AND_CLI_TOOL_DOCKER_SKIP_USING_MYSQL_DB = undefined;
|
|
66
|
-
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
66
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
@@ -63,4 +63,4 @@ export const ENV_VSCODE_PLUGIN_IS_CI_PROCESS = undefined;
|
|
|
63
63
|
export const ENV_VSCODE_PLUGIN_DOCKER_ADDITIONAL_CONTAINER = undefined;
|
|
64
64
|
export const ENV_VSCODE_PLUGIN_DOCKER_SKIP_START_IN_ORDER = undefined;
|
|
65
65
|
export const ENV_VSCODE_PLUGIN_DOCKER_SKIP_USING_MYSQL_DB = undefined;
|
|
66
|
-
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
66
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
package/lib-prod/package.json
CHANGED
|
@@ -14,20 +14,15 @@
|
|
|
14
14
|
// // import { Models } from 'tnp-models';
|
|
15
15
|
// //#endregion
|
|
16
16
|
// //#endregion
|
|
17
|
-
|
|
18
17
|
// //#region models
|
|
19
18
|
// export type RecordData = { host: number | string | URL; talkbackProxyPort?: number | string; }
|
|
20
|
-
|
|
21
19
|
// export type RecorderConfigMeta = {
|
|
22
20
|
// [recordHostName: string]: RecordData;
|
|
23
21
|
// } & { scenarioName: string; }
|
|
24
|
-
|
|
25
22
|
// export type ReplayConfigMeta = {
|
|
26
23
|
// [recordHostName: string]: { talkbackProxyPort?: number | string; }
|
|
27
24
|
// } & { scenarioPath: string; }
|
|
28
|
-
|
|
29
25
|
// type ArgsOptReplayRecordArgType = { port: string | string[]; hostName: string | string[]; };
|
|
30
|
-
|
|
31
26
|
// interface RecordArgType {
|
|
32
27
|
// record: {
|
|
33
28
|
// /**
|
|
@@ -46,12 +41,9 @@
|
|
|
46
41
|
// */
|
|
47
42
|
// talkbackProxyPort: number;
|
|
48
43
|
// }
|
|
49
|
-
|
|
50
44
|
// //#endregion
|
|
51
|
-
|
|
52
45
|
// export class RecordReplayReqResScenario {
|
|
53
46
|
// //#region @backend
|
|
54
|
-
|
|
55
47
|
// //#region consts
|
|
56
48
|
// /**
|
|
57
49
|
// * by pinging to http://localhost:5544/path/to/something
|
|
@@ -60,10 +52,8 @@
|
|
|
60
52
|
// */
|
|
61
53
|
// readonly DEFAULT_TALKBACK_PROXY_SERVER_PORT = 5544;
|
|
62
54
|
// //#endregion
|
|
63
|
-
|
|
64
55
|
// //#region singleton
|
|
65
56
|
// private static _instances = {};
|
|
66
|
-
|
|
67
57
|
// private constructor(
|
|
68
58
|
// protected readonly cwd = process.cwd()
|
|
69
59
|
// ) {
|
|
@@ -81,17 +71,14 @@
|
|
|
81
71
|
// return RecordReplayReqResScenario._instances[cwd] as RecordReplayReqResScenario;
|
|
82
72
|
// }
|
|
83
73
|
// //#endregion
|
|
84
|
-
|
|
85
74
|
// //#region resolve recoard args
|
|
86
75
|
// private resolveArgsRecord(serverHostOrPort: string | string[] | RecorderConfigMeta)
|
|
87
76
|
// : { args: RecordArgType[]; scenarioName: string; } {
|
|
88
|
-
|
|
89
77
|
// const results = [] as RecordArgType[];
|
|
90
78
|
// const configMeta = ((_.isObject(serverHostOrPort) && !_.isArray(serverHostOrPort))
|
|
91
79
|
// ? serverHostOrPort : void 0) as RecorderConfigMeta;
|
|
92
80
|
// let scenarioName = '' as string;
|
|
93
81
|
// let talkbackPorts = [this.DEFAULT_TALKBACK_PROXY_SERVER_PORT];
|
|
94
|
-
|
|
95
82
|
// if (configMeta) {
|
|
96
83
|
// //#region by config
|
|
97
84
|
// scenarioName = configMeta.scenarioName;
|
|
@@ -124,19 +111,16 @@
|
|
|
124
111
|
// }
|
|
125
112
|
// const hostName = _.isString(options.hostName) ? [options.hostName]
|
|
126
113
|
// : (_.isArray(options.hostName) ? options.hostName : [])
|
|
127
|
-
|
|
128
114
|
// if (talkbackPorts.length === 0) {
|
|
129
115
|
// Helpers.error(`[rec-scenario-rep-rec] Incorrect configuration of ports:
|
|
130
116
|
// recordHosts = ${resolved.map(c => Helpers.urlParse(c)).join(', ')}
|
|
131
117
|
// talkback ports = ${talkbackPorts.join(', ')}
|
|
132
|
-
|
|
133
118
|
// `, false, true);
|
|
134
119
|
// }
|
|
135
120
|
// if (talkbackPorts.length < resolved.length) {
|
|
136
121
|
// const lastN = talkbackPorts[talkbackPorts.length - 1];
|
|
137
122
|
// _.times((resolved.length - talkbackPorts.length), (i) => talkbackPorts.push(lastN + (i + 1)));
|
|
138
123
|
// }
|
|
139
|
-
|
|
140
124
|
// resolved.forEach((recordHost, i) => {
|
|
141
125
|
// results.push({
|
|
142
126
|
// record: {
|
|
@@ -148,11 +132,9 @@
|
|
|
148
132
|
// });
|
|
149
133
|
// //#endregion
|
|
150
134
|
// }
|
|
151
|
-
|
|
152
135
|
// return { args: results, scenarioName };
|
|
153
136
|
// }
|
|
154
137
|
// //#endregion
|
|
155
|
-
|
|
156
138
|
// //#region command from config
|
|
157
139
|
// public recordAsWorker(config: RecorderConfigMeta, cwd: string = process.cwd()) {
|
|
158
140
|
// const hosts = Object
|
|
@@ -173,7 +155,6 @@
|
|
|
173
155
|
// Helpers.run(command, { cwd }).async();
|
|
174
156
|
// }
|
|
175
157
|
// //#endregion
|
|
176
|
-
|
|
177
158
|
// //#region record
|
|
178
159
|
// /**
|
|
179
160
|
// * rest-scenario-rep-rec record http://localhost:4444 Recording localhost data
|
|
@@ -189,7 +170,6 @@
|
|
|
189
170
|
// return new Promise((resolve, reject) => {
|
|
190
171
|
// const currentDate = new Date();
|
|
191
172
|
// let { args, scenarioName } = this.resolveArgsRecord(serverHostOrPort);
|
|
192
|
-
|
|
193
173
|
// //#region prepare main scenario folder
|
|
194
174
|
// let description = scenarioName;
|
|
195
175
|
// if (!_.isString(scenarioName) || scenarioName.trim() === '') {
|
|
@@ -200,13 +180,11 @@
|
|
|
200
180
|
// const scenariosFolder = path.join(this.cwd, config.folder.tmpScenarios);
|
|
201
181
|
// const scenarioKebabPath = path.join(scenariosFolder, scenarioNameKebabKase);
|
|
202
182
|
// const packageJsonFroScenario = path.join(scenarioKebabPath, config.file.package_json);
|
|
203
|
-
|
|
204
183
|
// if (!Helpers.exists(scenariosFolder)) {
|
|
205
184
|
// Helpers.mkdirp(scenariosFolder);
|
|
206
185
|
// }
|
|
207
186
|
// Helpers.removeFolderIfExists(scenarioKebabPath);
|
|
208
187
|
// //#endregion
|
|
209
|
-
|
|
210
188
|
// //#region write package.json
|
|
211
189
|
// Helpers.writeFile(packageJsonFroScenario, {
|
|
212
190
|
// name: scenarioNameKebabKase,
|
|
@@ -221,19 +199,15 @@
|
|
|
221
199
|
// } as any,
|
|
222
200
|
// } as Partial<Models.npm.IPackageJSON>);
|
|
223
201
|
// //#endregion
|
|
224
|
-
|
|
225
202
|
// args.forEach(recData => {
|
|
226
203
|
// Helpers.log(`RECORD FROM: ${recData.record.url.href}`)
|
|
227
|
-
|
|
228
204
|
// const scenarioPath = path.join(
|
|
229
205
|
// this.cwd,
|
|
230
206
|
// config.folder.tmpScenarios,
|
|
231
207
|
// scenarioNameKebabKase,
|
|
232
208
|
// `${(_.kebabCase(recData.record.url.href)).toString()}__${_.camelCase(recData.record.name)}`
|
|
233
209
|
// );
|
|
234
|
-
|
|
235
210
|
// Helpers.remove(scenarioPath);
|
|
236
|
-
|
|
237
211
|
// const talkbackHost = recData.record.url.origin;
|
|
238
212
|
// debug && Helpers.info(`Talkback host: ${talkbackHost}`)
|
|
239
213
|
// const server = talkback({
|
|
@@ -254,7 +228,6 @@
|
|
|
254
228
|
// });
|
|
255
229
|
// }
|
|
256
230
|
// //#endregion
|
|
257
|
-
|
|
258
231
|
// //#region all scenaroios
|
|
259
232
|
// public get allScenarios() {
|
|
260
233
|
// return glob.sync(`${path.join(this.cwd, config.folder.tmpScenarios)}/*`)
|
|
@@ -263,7 +236,6 @@
|
|
|
263
236
|
// .filter(f => !!f)
|
|
264
237
|
// }
|
|
265
238
|
// //#endregion
|
|
266
|
-
|
|
267
239
|
// //#region select scenario
|
|
268
240
|
// async selectScenario(goBackButtonOnList?: boolean): Promise<Scenario> {
|
|
269
241
|
// const mainMessage = `Select scenario from list:`;
|
|
@@ -273,7 +245,6 @@
|
|
|
273
245
|
// if (goBackButtonOnList) {
|
|
274
246
|
// choices.push({ name: '<= Go back', value: void 0 });
|
|
275
247
|
// }
|
|
276
|
-
|
|
277
248
|
// const res = await inquirer.prompt({
|
|
278
249
|
// type: 'list',
|
|
279
250
|
// name: 'value',
|
|
@@ -283,7 +254,6 @@
|
|
|
283
254
|
// return res.value;
|
|
284
255
|
// }
|
|
285
256
|
// //#endregion
|
|
286
|
-
|
|
287
257
|
// //#region resolve replay args
|
|
288
258
|
// private async resolveReplayData(
|
|
289
259
|
// nameOrPathOrDescription: string | string[] | ReplayConfigMeta,
|
|
@@ -304,13 +274,10 @@
|
|
|
304
274
|
// //#endregion
|
|
305
275
|
// } else {
|
|
306
276
|
// //#region from command line
|
|
307
|
-
|
|
308
277
|
// nameOrPathOrDescription = (_.isArray(nameOrPathOrDescription)
|
|
309
278
|
// ? nameOrPathOrDescription.join(' ') : nameOrPathOrDescription) as string;
|
|
310
|
-
|
|
311
279
|
// const options = Helpers.cliTool.argsFrom<ArgsOptReplayRecordArgType>(nameOrPathOrDescription);
|
|
312
280
|
// nameOrPathOrDescription = Helpers.cliTool.cleanCommand(nameOrPathOrDescription, options);
|
|
313
|
-
|
|
314
281
|
// const { resolved, commandString } = Helpers.cliTool
|
|
315
282
|
// .argsFromBegin<Scenario>(nameOrPathOrDescription, possiblePathToScenario => {
|
|
316
283
|
// const scenarioFromPath = (
|
|
@@ -325,7 +292,6 @@
|
|
|
325
292
|
// });
|
|
326
293
|
// nameOrPathOrDescription = commandString;
|
|
327
294
|
// let scenarios = resolved;
|
|
328
|
-
|
|
329
295
|
// if (scenarios.length === 0 && commandString.trim() !== '') {
|
|
330
296
|
// const list = this.allScenarios;
|
|
331
297
|
// const { matches, results } = Helpers
|
|
@@ -333,23 +299,18 @@
|
|
|
333
299
|
// .fuzzy<Scenario>(nameOrPathOrDescription, list, (m) => m.description);
|
|
334
300
|
// scenarios = scenarios.concat(results);
|
|
335
301
|
// }
|
|
336
|
-
|
|
337
302
|
// const hostName = _.isString(options.hostName) ? [options.hostName]
|
|
338
303
|
// : (_.isArray(options.hostName) ? options.hostName : []);
|
|
339
|
-
|
|
340
304
|
// const portsOrUrlsForReplayServer = (_.isString(options.port) ? [Helpers.urlParse(options.port)]
|
|
341
305
|
// : (_.isArray(options.port) ? options.port.map(p => Helpers.urlParse(p))
|
|
342
306
|
// : [Helpers.urlParse(this.DEFAULT_TALKBACK_PROXY_SERVER_PORT)])).filter(u => u instanceof URL);
|
|
343
|
-
|
|
344
307
|
// if (portsOrUrlsForReplayServer.length === 0) {
|
|
345
308
|
// Helpers.error(`Please provide correct number or ports and hostnames
|
|
346
309
|
// host names = ${hostName.map(c => Helpers.urlParse(c)).join(', ')}
|
|
347
310
|
// talkback ports = ${portsOrUrlsForReplayServer.join(', ')}
|
|
348
311
|
// `, false, true);
|
|
349
312
|
// }
|
|
350
|
-
|
|
351
313
|
// let params = portsOrUrlsForReplayServer;
|
|
352
|
-
|
|
353
314
|
// if (hostName.length > 0) {
|
|
354
315
|
// if (hostName.length > portsOrUrlsForReplayServer.length) {
|
|
355
316
|
// const maxPort = _.maxBy(portsOrUrlsForReplayServer, p => Number(p.port));
|
|
@@ -361,12 +322,10 @@
|
|
|
361
322
|
// return _.merge(prev, { [name]: portsOrUrlsForReplayServer[i] })
|
|
362
323
|
// }, {}) as any;
|
|
363
324
|
// }
|
|
364
|
-
|
|
365
325
|
// returnValue.params = params as any;
|
|
366
326
|
// returnValue.scenarios = scenarios;
|
|
367
327
|
// //#endregion
|
|
368
328
|
// }
|
|
369
|
-
|
|
370
329
|
// //#region select menu scenraios
|
|
371
330
|
// if (returnValue.scenarios.length === 0) {
|
|
372
331
|
// if (showListIfNotMatch) {
|
|
@@ -375,29 +334,24 @@
|
|
|
375
334
|
// }
|
|
376
335
|
// }
|
|
377
336
|
// //#endregion
|
|
378
|
-
|
|
379
337
|
// return returnValue;
|
|
380
338
|
// }
|
|
381
339
|
// //#endregion
|
|
382
|
-
|
|
383
340
|
// //#region replay
|
|
384
341
|
// public async resolveScenariosData(
|
|
385
342
|
// nameOrPathOrDescription: string | string[] | ReplayConfigMeta,
|
|
386
343
|
// showListIfNotMatch = false,
|
|
387
344
|
// goBackButtonOnList = false,
|
|
388
345
|
// ) {
|
|
389
|
-
|
|
390
346
|
// const { scenarios, params } = await this.resolveReplayData(
|
|
391
347
|
// nameOrPathOrDescription,
|
|
392
348
|
// showListIfNotMatch,
|
|
393
349
|
// goBackButtonOnList,
|
|
394
350
|
// );
|
|
395
|
-
|
|
396
351
|
// if (scenarios.length === 0) {
|
|
397
352
|
// Helpers.error(`[record - replay - req - res - scenario]`
|
|
398
353
|
// + `Not able to find scenario by name or path "${nameOrPathOrDescription}"`, false, true);
|
|
399
354
|
// }
|
|
400
|
-
|
|
401
355
|
// // const tmpScenarioInfo = (s: Scenario) => {
|
|
402
356
|
// // const paramsTmpls = _.isArray(params) ? params.map(p => ` replay on ${p}`).join(',')
|
|
403
357
|
// // : _.keys(params).reduce((a, b) => {
|
|
@@ -406,7 +360,6 @@
|
|
|
406
360
|
// // return `> ${chalk.bold(s.basename)} "${s.description}"` +
|
|
407
361
|
// // paramsTmpls;
|
|
408
362
|
// // };
|
|
409
|
-
|
|
410
363
|
// // Helpers.info(`
|
|
411
364
|
// // (${chalk.bold(scenarios.length.toString())}) scenario(s) to replay: `
|
|
412
365
|
// // + `${scenarios.map(s => tmpScenarioInfo(s)).join('\n')}`
|
|
@@ -414,6 +367,5 @@
|
|
|
414
367
|
// return { scenario: _.first(scenarios), scenarios, params };
|
|
415
368
|
// }
|
|
416
369
|
// //#endregion
|
|
417
|
-
|
|
418
370
|
// //#endregion
|
|
419
|
-
// }
|
|
371
|
+
// }
|
|
@@ -16,15 +16,12 @@
|
|
|
16
16
|
// import { URL } from 'url';
|
|
17
17
|
// import { Tape } from './tape.backend';
|
|
18
18
|
// import { CLASS } from 'typescript-class-helpers';
|
|
19
|
-
|
|
20
19
|
// export type PortOrURL = URL | number;
|
|
21
20
|
// export type ScenarioParams = { [nameOfParam: string]: PortOrURL; };
|
|
22
21
|
// export type ScenarioParamsReturn = { [nameOfParam: string]: Exclude<PortOrURL, number>; };
|
|
23
22
|
// export type ScenarioParam = { name: string; portOrUrl: PortOrURL; }
|
|
24
23
|
// export type ScenarioParamReturn = { name: string; portOrUrl: Exclude<PortOrURL, number>; }
|
|
25
|
-
|
|
26
24
|
// export class Scenario {
|
|
27
|
-
|
|
28
25
|
// public static get allCurrent() {
|
|
29
26
|
// const currentScenariosFolder = path.join(process.cwd(), config.folder.tmpScenarios);
|
|
30
27
|
// return !fse.existsSync(currentScenariosFolder) ? [] : fse
|
|
@@ -32,7 +29,6 @@
|
|
|
32
29
|
// .map(p => Scenario.From(path.join(currentScenariosFolder, p)))
|
|
33
30
|
// .filter(f => !!f)
|
|
34
31
|
// }
|
|
35
|
-
|
|
36
32
|
// private static instances = {};
|
|
37
33
|
// static From(pathToScenario: string) {
|
|
38
34
|
// if (!Helpers.exists(pathToScenario)) {
|
|
@@ -50,7 +46,6 @@
|
|
|
50
46
|
// }
|
|
51
47
|
// return s;
|
|
52
48
|
// }
|
|
53
|
-
|
|
54
49
|
// public static lastFromFolder(pathToFolder: string): Scenario {
|
|
55
50
|
// const currentScenariosFolder = path.join(pathToFolder, config.folder.tmpScenarios);
|
|
56
51
|
// if (!fse.existsSync(currentScenariosFolder)) {
|
|
@@ -68,7 +63,6 @@
|
|
|
68
63
|
// );
|
|
69
64
|
// return (sorted.length > 0) ? _.first(sorted).scenario : (void 0)
|
|
70
65
|
// }
|
|
71
|
-
|
|
72
66
|
// get folderHostNames() {
|
|
73
67
|
// const res = fse
|
|
74
68
|
// .readdirSync(this.location)
|
|
@@ -82,7 +76,6 @@
|
|
|
82
76
|
// get path() {
|
|
83
77
|
// return this.location;
|
|
84
78
|
// }
|
|
85
|
-
|
|
86
79
|
// get basename() {
|
|
87
80
|
// return path.basename(this.location);
|
|
88
81
|
// }
|
|
@@ -98,19 +91,15 @@
|
|
|
98
91
|
// // Helpers.log(`path to scenario pj: ${pathToScenarioPackageJson}`)
|
|
99
92
|
// this.packageJson = Helpers.readJson(pathToScenarioPackageJson);
|
|
100
93
|
// }
|
|
101
|
-
|
|
102
94
|
// private initMidleware(app: express.Application) {
|
|
103
|
-
|
|
104
95
|
// app.use(fileUpload())
|
|
105
96
|
// app.use(bodyParser.urlencoded({ extended: true }));
|
|
106
97
|
// app.use(bodyParser.json());
|
|
107
98
|
// app.use(methodOverride());
|
|
108
99
|
// app.use(cookieParser());
|
|
109
100
|
// app.use(cors());
|
|
110
|
-
|
|
111
101
|
// (() => {
|
|
112
102
|
// app.use((req, res, next) => {
|
|
113
|
-
|
|
114
103
|
// res.set('Access-Control-Expose-Headers',
|
|
115
104
|
// [
|
|
116
105
|
// 'Content-Type',
|
|
@@ -121,11 +110,8 @@
|
|
|
121
110
|
// });
|
|
122
111
|
// })()
|
|
123
112
|
// }
|
|
124
|
-
|
|
125
|
-
|
|
126
113
|
// private initRequests(app: express.Application, name?: string) {
|
|
127
114
|
// const allReq = this.tapes(name);
|
|
128
|
-
|
|
129
115
|
// app.get(/^\/(.*)/, (req, res) => {
|
|
130
116
|
// respond(allReq, req, res);
|
|
131
117
|
// });
|
|
@@ -143,7 +129,6 @@
|
|
|
143
129
|
// });
|
|
144
130
|
// return allReq;
|
|
145
131
|
// }
|
|
146
|
-
|
|
147
132
|
// scenarioAsWorker(params: ScenarioParams, cwd = process.cwd()) {
|
|
148
133
|
// const hostNames = _.keys(params).map(hostName => hostName);
|
|
149
134
|
// const ports = _.keys(params).map(hostName => Helpers.urlParse(params[hostName]).port);
|
|
@@ -153,7 +138,6 @@
|
|
|
153
138
|
// ;
|
|
154
139
|
// Helpers.run(command, { cwd }).async();
|
|
155
140
|
// }
|
|
156
|
-
|
|
157
141
|
// async start(urlsOrPorts: number | number[] | URL | URL[] | ScenarioParams, debug = false) {
|
|
158
142
|
// if (_.isString(urlsOrPorts) || _.isNumber(urlsOrPorts)) {
|
|
159
143
|
// urlsOrPorts = [Number(urlsOrPorts)]
|
|
@@ -170,24 +154,18 @@
|
|
|
170
154
|
// }, {}) as ScenarioParams;
|
|
171
155
|
// }
|
|
172
156
|
// urlsOrPorts = urlsOrPorts as ScenarioParams;
|
|
173
|
-
|
|
174
157
|
// const proxyPorts = _
|
|
175
158
|
// .keys(urlsOrPorts)
|
|
176
159
|
// .map(name => { return { name, portOrUrl: Helpers.urlParse(urlsOrPorts[name]) } }) as ScenarioParamReturn[];
|
|
177
|
-
|
|
178
160
|
// const promises = [] as Promise<any>[];
|
|
179
161
|
// for (let index = 0; index < proxyPorts.length; index++) {
|
|
180
162
|
// let urlOrPort = proxyPorts[index];
|
|
181
163
|
// ((promises, proxyURL) => {
|
|
182
164
|
// promises.push(new Promise((resolve, reject) => {
|
|
183
165
|
// const recordedServerName = ((urlOrPort.name && urlOrPort.name.trim() !== '') ? urlOrPort.name : '').trim();
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
166
|
// const app = express()
|
|
188
167
|
// this.initMidleware(app);
|
|
189
168
|
// const tapes = this.initRequests(app, recordedServerName);
|
|
190
|
-
|
|
191
169
|
// Helpers.info(`Starting scenario server on port ${proxyURL.port}
|
|
192
170
|
// Recorded/assigned server name: ${recordedServerName !== '' ? recordedServerName : '-'}:
|
|
193
171
|
// Description: "${this.description}"
|
|
@@ -196,7 +174,6 @@
|
|
|
196
174
|
// ('Tapes:\n' + tapes.map(t => `(${t.req.method}) ${proxyURL.origin}${t.req.url}`).join('\n'))}\n`
|
|
197
175
|
// + Helpers.terminalLine()
|
|
198
176
|
// );
|
|
199
|
-
|
|
200
177
|
// const h = new http.Server(app);
|
|
201
178
|
// h.listen(proxyURL.port, () => {
|
|
202
179
|
// console.log(`Server listening on ${proxyURL.href}
|
|
@@ -206,13 +183,10 @@
|
|
|
206
183
|
// });
|
|
207
184
|
// }));
|
|
208
185
|
// })(promises, urlOrPort.portOrUrl);
|
|
209
|
-
|
|
210
186
|
// }
|
|
211
187
|
// await Promise.all(promises);
|
|
212
188
|
// return proxyPorts;
|
|
213
189
|
// }
|
|
214
|
-
|
|
215
|
-
|
|
216
190
|
// tapes(name?: string) {
|
|
217
191
|
// const allTapes = fse
|
|
218
192
|
// .readdirSync(this.location)
|
|
@@ -233,19 +207,14 @@
|
|
|
233
207
|
// }, []);
|
|
234
208
|
// return allTapes as Tape[];
|
|
235
209
|
// }
|
|
236
|
-
|
|
237
210
|
// }
|
|
238
|
-
|
|
239
|
-
|
|
240
211
|
// export interface RequestType {
|
|
241
212
|
// meta: {
|
|
242
213
|
// createdAt: string | Date;
|
|
243
214
|
// host: string;
|
|
244
215
|
// }
|
|
245
216
|
// }
|
|
246
|
-
|
|
247
217
|
// function respond(allReq: Tape[], req, res) {
|
|
248
|
-
|
|
249
218
|
// const match = allReq.find(s => s.matchToReq(req));
|
|
250
219
|
// if (match) {
|
|
251
220
|
// // Helpers.log(`MATCH: ${match.req.method} ${match.req.url}`);
|
|
@@ -259,4 +228,4 @@
|
|
|
259
228
|
// } else {
|
|
260
229
|
// res.send('REQUEST DOES NOT MATCH ANY RECORDING')
|
|
261
230
|
// }
|
|
262
|
-
// }
|
|
231
|
+
// }
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// import { URL } from 'url';
|
|
2
2
|
// import { RecordReplayReqResScenario } from './record-replay-req-res-scenario';
|
|
3
3
|
// import { Helpers } from 'tnp-helpers';
|
|
4
|
-
|
|
5
4
|
// export async function run(args: string[]) {
|
|
6
5
|
// const ins = RecordReplayReqResScenario.Instance();
|
|
7
6
|
// const command: 'record' | 'replay' = args.shift() as any;
|
|
@@ -17,4 +16,4 @@
|
|
|
17
16
|
// }
|
|
18
17
|
// process.stdin.resume();
|
|
19
18
|
// }
|
|
20
|
-
// }
|
|
19
|
+
// }
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
// import * as _ from 'lodash';
|
|
2
2
|
// import * as express from 'express';
|
|
3
3
|
// import { Tape as BaseTape } from 'ng-talkback';
|
|
4
|
-
|
|
5
4
|
// export class Tape implements Partial<BaseTape> {
|
|
6
|
-
|
|
7
5
|
// static from(data: object) {
|
|
8
6
|
// return new Tape(data);
|
|
9
7
|
// }
|
|
10
|
-
|
|
11
8
|
// constructor(data) {
|
|
12
9
|
// Object.assign(this, data);
|
|
13
10
|
// }
|
|
14
|
-
|
|
15
11
|
// matchToReq(req: express.Request) {
|
|
16
12
|
// return (
|
|
17
13
|
// (req.url === this.req.url)
|
|
@@ -20,8 +16,6 @@
|
|
|
20
16
|
// // && (req.headers == this.req.headers) // TODO
|
|
21
17
|
// )
|
|
22
18
|
// }
|
|
23
|
-
|
|
24
|
-
|
|
25
19
|
// readonly req: any; // import('ng-talkback/types').Req;
|
|
26
20
|
// readonly res?: any; //import('ng-talkback/types').Res;
|
|
27
21
|
// readonly options: any; //import('ng-talkback/options').Options;
|
|
@@ -30,5 +24,4 @@
|
|
|
30
24
|
// readonly path?: string;
|
|
31
25
|
// readonly new: boolean;
|
|
32
26
|
// readonly used: boolean;
|
|
33
|
-
|
|
34
|
-
// }
|
|
27
|
+
// }
|
package/package.json
CHANGED
package/websql/package.json
CHANGED
package/websql-prod/package.json
CHANGED
package/lib-prod/lib-info.md
DELETED
|
File without changes
|