@elastic/synthetics 1.0.0-beta.4 → 1.0.0-beta.41
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/README.md +4 -3
- package/dist/cli.js +137 -160
- package/dist/cli.js.map +1 -1
- package/dist/common_types.d.ts +161 -31
- package/dist/common_types.d.ts.map +1 -1
- package/dist/config.d.ts +3 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -6
- package/dist/config.js.map +1 -1
- package/dist/core/browser-service.d.ts +1 -1
- package/dist/core/browser-service.d.ts.map +1 -1
- package/dist/core/browser-service.js +7 -6
- package/dist/core/browser-service.js.map +1 -1
- package/dist/core/expect.d.ts +25 -25
- package/dist/core/expect.d.ts.map +1 -1
- package/dist/core/expect.js.map +1 -1
- package/dist/core/gatherer.d.ts +4 -8
- package/dist/core/gatherer.d.ts.map +1 -1
- package/dist/core/gatherer.js +53 -15
- package/dist/core/gatherer.js.map +1 -1
- package/dist/core/index.d.ts +5 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +23 -11
- package/dist/core/index.js.map +1 -1
- package/dist/core/logger.d.ts +0 -1
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +3 -16
- package/dist/core/logger.js.map +1 -1
- package/dist/core/runner.d.ts +12 -63
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +156 -90
- package/dist/core/runner.js.map +1 -1
- package/dist/core/transform.d.ts +37 -0
- package/dist/core/transform.d.ts.map +1 -0
- package/dist/core/transform.js +148 -0
- package/dist/core/transform.js.map +1 -0
- package/dist/dsl/index.js +5 -1
- package/dist/dsl/index.js.map +1 -1
- package/dist/dsl/journey.d.ts +9 -4
- package/dist/dsl/journey.d.ts.map +1 -1
- package/dist/dsl/journey.js +37 -9
- package/dist/dsl/journey.js.map +1 -1
- package/dist/dsl/monitor.d.ts +83 -0
- package/dist/dsl/monitor.d.ts.map +1 -0
- package/dist/dsl/monitor.js +108 -0
- package/dist/dsl/monitor.js.map +1 -0
- package/dist/dsl/step.d.ts +3 -2
- package/dist/dsl/step.d.ts.map +1 -1
- package/dist/dsl/step.js +6 -1
- package/dist/dsl/step.js.map +1 -1
- package/dist/formatter/javascript.d.ts +98 -0
- package/dist/formatter/javascript.d.ts.map +1 -0
- package/dist/formatter/javascript.js +298 -0
- package/dist/formatter/javascript.js.map +1 -0
- package/dist/generator/index.d.ts +24 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +241 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/{reporters/reporter.js → generator/utils.d.ts} +5 -3
- package/dist/generator/utils.d.ts.map +1 -0
- package/dist/generator/utils.js +84 -0
- package/dist/generator/utils.js.map +1 -0
- package/dist/helpers.d.ts +28 -3
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +152 -20
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -26
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +34 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +149 -0
- package/dist/loader.js.map +1 -0
- package/dist/locations/index.d.ts +45 -0
- package/dist/locations/index.d.ts.map +1 -0
- package/dist/locations/index.js +83 -0
- package/dist/locations/index.js.map +1 -0
- package/dist/{reporters/reporter.d.ts → locations/public-locations.d.ts} +12 -8
- package/dist/locations/public-locations.d.ts.map +1 -0
- package/dist/locations/public-locations.js +41 -0
- package/dist/locations/public-locations.js.map +1 -0
- package/dist/options.d.ts +41 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +198 -0
- package/dist/options.js.map +1 -0
- package/dist/plugins/browser-console.d.ts +5 -4
- package/dist/plugins/browser-console.d.ts.map +1 -1
- package/dist/plugins/browser-console.js +44 -24
- package/dist/plugins/browser-console.js.map +1 -1
- package/dist/plugins/index.js +5 -1
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/network.d.ts +20 -33
- package/dist/plugins/network.d.ts.map +1 -1
- package/dist/plugins/network.js +177 -216
- package/dist/plugins/network.js.map +1 -1
- package/dist/plugins/performance.d.ts +4 -19
- package/dist/plugins/performance.d.ts.map +1 -1
- package/dist/plugins/performance.js +6 -5
- package/dist/plugins/performance.js.map +1 -1
- package/dist/plugins/plugin-manager.d.ts +9 -5
- package/dist/plugins/plugin-manager.d.ts.map +1 -1
- package/dist/plugins/plugin-manager.js +46 -30
- package/dist/plugins/plugin-manager.js.map +1 -1
- package/dist/plugins/tracing.d.ts +6 -6
- package/dist/plugins/tracing.d.ts.map +1 -1
- package/dist/plugins/tracing.js +10 -7
- package/dist/plugins/tracing.js.map +1 -1
- package/dist/push/bundler.d.ts +35 -0
- package/dist/push/bundler.d.ts.map +1 -0
- package/dist/push/bundler.js +131 -0
- package/dist/push/bundler.js.map +1 -0
- package/dist/push/index.d.ts +9 -0
- package/dist/push/index.d.ts.map +1 -0
- package/dist/push/index.js +227 -0
- package/dist/push/index.js.map +1 -0
- package/dist/push/kibana_api.d.ts +56 -0
- package/dist/push/kibana_api.d.ts.map +1 -0
- package/dist/push/kibana_api.js +135 -0
- package/dist/push/kibana_api.js.map +1 -0
- package/dist/push/monitor.d.ts +51 -0
- package/dist/push/monitor.d.ts.map +1 -0
- package/dist/push/monitor.js +244 -0
- package/dist/push/monitor.js.map +1 -0
- package/dist/{parse_args.d.ts → push/plugin.d.ts} +9 -6
- package/dist/push/plugin.d.ts.map +1 -0
- package/dist/push/plugin.js +66 -0
- package/dist/push/plugin.js.map +1 -0
- package/dist/push/request.d.ts +45 -0
- package/dist/push/request.d.ts.map +1 -0
- package/dist/push/request.js +109 -0
- package/dist/push/request.js.map +1 -0
- package/dist/push/utils.d.ts +31 -0
- package/dist/push/utils.d.ts.map +1 -0
- package/dist/push/utils.js +64 -0
- package/dist/push/utils.js.map +1 -0
- package/dist/reporters/base.d.ts +14 -6
- package/dist/reporters/base.d.ts.map +1 -1
- package/dist/reporters/base.js +58 -50
- package/dist/reporters/base.js.map +1 -1
- package/dist/reporters/index.d.ts +18 -8
- package/dist/reporters/index.d.ts.map +1 -1
- package/dist/reporters/index.js.map +1 -1
- package/dist/reporters/json.d.ts +17 -62
- package/dist/reporters/json.d.ts.map +1 -1
- package/dist/reporters/json.js +149 -179
- package/dist/reporters/json.js.map +1 -1
- package/dist/reporters/junit.d.ts +7 -1
- package/dist/reporters/junit.d.ts.map +1 -1
- package/dist/reporters/junit.js +90 -95
- package/dist/reporters/junit.js.map +1 -1
- package/dist/sdk/lh-trace-processor.d.ts +35 -9
- package/dist/sdk/lh-trace-processor.d.ts.map +1 -1
- package/dist/sdk/lh-trace-processor.js +114 -53
- package/dist/sdk/lh-trace-processor.js.map +1 -1
- package/dist/sdk/trace-metrics.d.ts +4 -4
- package/dist/sdk/trace-metrics.d.ts.map +1 -1
- package/dist/sdk/trace-metrics.js +3 -4
- package/dist/sdk/trace-metrics.js.map +1 -1
- package/dist/sdk/trace-processor.d.ts +11 -3
- package/dist/sdk/trace-processor.d.ts.map +1 -1
- package/dist/sdk/trace-processor.js +17 -9
- package/dist/sdk/trace-processor.js.map +1 -1
- package/package.json +39 -24
- package/src/cli.ts +219 -151
- package/src/common_types.ts +193 -31
- package/src/config.ts +3 -6
- package/src/core/expect.ts +58 -24
- package/src/core/gatherer.ts +64 -24
- package/src/core/index.ts +36 -15
- package/src/core/logger.ts +1 -12
- package/src/core/runner.ts +151 -136
- package/src/core/transform.ts +160 -0
- package/src/dsl/journey.ts +39 -6
- package/src/dsl/monitor.ts +140 -0
- package/src/dsl/step.ts +9 -2
- package/src/formatter/javascript.ts +367 -0
- package/src/generator/index.ts +308 -0
- package/src/generator/utils.ts +84 -0
- package/src/helpers.ts +159 -13
- package/src/index.ts +22 -22
- package/src/loader.ts +167 -0
- package/src/locations/index.ts +95 -0
- package/src/{reporters/reporter.ts → locations/public-locations.ts} +12 -9
- package/src/options.ts +227 -0
- package/src/plugins/browser-console.ts +30 -8
- package/src/plugins/network.ts +208 -267
- package/src/plugins/performance.ts +6 -22
- package/src/plugins/plugin-manager.ts +49 -31
- package/src/plugins/tracing.ts +8 -9
- package/src/push/bundler.ts +112 -0
- package/src/push/index.ts +282 -0
- package/src/push/kibana_api.ts +191 -0
- package/src/push/monitor.ts +276 -0
- package/src/push/plugin.ts +66 -0
- package/src/push/request.ts +141 -0
- package/src/push/utils.ts +77 -0
- package/src/reporters/base.ts +63 -52
- package/src/reporters/index.ts +26 -3
- package/src/reporters/json.ts +183 -202
- package/src/reporters/junit.ts +98 -93
- package/src/sdk/lh-trace-processor.ts +132 -68
- package/src/sdk/trace-metrics.ts +8 -4
- package/src/sdk/trace-processor.ts +28 -13
- package/templates/.github/workflows/run-synthetics.yml +27 -0
- package/templates/README.md +21 -0
- package/templates/journeys/advanced-example-helpers.ts +54 -0
- package/templates/journeys/advanced-example.journey.ts +43 -0
- package/templates/journeys/example.journey.ts +18 -0
- package/templates/lightweight/heartbeat.yml +8 -0
- package/templates/synthetics.config.ts +35 -0
- package/CHANGELOG.md +0 -131
- package/NOTICE.txt +0 -221
- package/dist/parse_args.d.ts.map +0 -1
- package/dist/parse_args.js +0 -95
- package/dist/parse_args.js.map +0 -1
- package/dist/reporters/reporter.d.ts.map +0 -1
- package/dist/reporters/reporter.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1888
- package/src/parse_args.ts +0 -135
|
@@ -27,58 +27,74 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
27
27
|
exports.PluginManager = void 0;
|
|
28
28
|
const _1 = require("./");
|
|
29
29
|
class PluginManager {
|
|
30
|
+
driver;
|
|
31
|
+
plugins = new Map();
|
|
32
|
+
PLUGIN_TYPES = [
|
|
33
|
+
'network',
|
|
34
|
+
'trace',
|
|
35
|
+
'performance',
|
|
36
|
+
'browserconsole',
|
|
37
|
+
];
|
|
30
38
|
constructor(driver) {
|
|
31
39
|
this.driver = driver;
|
|
32
|
-
this.plugins = new Map();
|
|
33
40
|
}
|
|
34
|
-
|
|
41
|
+
register(type, options) {
|
|
35
42
|
let instance;
|
|
36
43
|
switch (type) {
|
|
37
44
|
case 'network':
|
|
38
|
-
instance = new _1.NetworkManager();
|
|
39
|
-
await instance.start(this.driver.client);
|
|
45
|
+
instance = new _1.NetworkManager(this.driver);
|
|
40
46
|
break;
|
|
41
47
|
case 'trace':
|
|
42
|
-
instance = new _1.Tracing(options);
|
|
43
|
-
await instance.start(this.driver.client);
|
|
48
|
+
instance = new _1.Tracing(this.driver, options);
|
|
44
49
|
break;
|
|
45
50
|
case 'performance':
|
|
46
|
-
instance = new _1.PerformanceManager(this.driver
|
|
47
|
-
instance.start();
|
|
51
|
+
instance = new _1.PerformanceManager(this.driver);
|
|
48
52
|
break;
|
|
49
53
|
case 'browserconsole':
|
|
50
|
-
instance = new _1.BrowserConsole(this.driver
|
|
51
|
-
instance.start();
|
|
54
|
+
instance = new _1.BrowserConsole(this.driver);
|
|
52
55
|
break;
|
|
53
56
|
}
|
|
54
|
-
this.plugins.set(
|
|
57
|
+
instance && this.plugins.set(type, instance);
|
|
55
58
|
return instance;
|
|
56
59
|
}
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
registerAll(options) {
|
|
61
|
+
for (const type of this.PLUGIN_TYPES) {
|
|
62
|
+
this.register(type, options);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
unregisterAll() {
|
|
66
|
+
for (const type of this.PLUGIN_TYPES) {
|
|
67
|
+
this.plugins.delete(type);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async stop(type) {
|
|
71
|
+
const instance = this.plugins.get(type);
|
|
72
|
+
if (instance) {
|
|
73
|
+
return await instance.stop();
|
|
74
|
+
}
|
|
75
|
+
return {};
|
|
76
|
+
}
|
|
77
|
+
async start(type) {
|
|
78
|
+
const instance = this.plugins.get(type);
|
|
79
|
+
instance && (await instance.start());
|
|
80
|
+
return instance;
|
|
81
|
+
}
|
|
82
|
+
get(type) {
|
|
83
|
+
return this.plugins.get(type);
|
|
59
84
|
}
|
|
60
85
|
onStep(step) {
|
|
61
|
-
this.get(
|
|
62
|
-
this.get(
|
|
86
|
+
this.get('browserconsole')._currentStep = step;
|
|
87
|
+
this.get('network')._currentStep = step;
|
|
63
88
|
}
|
|
64
89
|
async output() {
|
|
65
90
|
const data = {};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const result = await plugin.stop(this.driver.client);
|
|
73
|
-
Object.assign(data, { ...result });
|
|
74
|
-
}
|
|
75
|
-
else if (plugin instanceof _1.BrowserConsole) {
|
|
76
|
-
data.browserconsole = plugin.stop();
|
|
77
|
-
}
|
|
91
|
+
for (const [, plugin] of this.plugins) {
|
|
92
|
+
if (plugin instanceof _1.NetworkManager) {
|
|
93
|
+
data.networkinfo = await plugin.stop();
|
|
94
|
+
}
|
|
95
|
+
else if (plugin instanceof _1.BrowserConsole) {
|
|
96
|
+
data.browserconsole = plugin.stop();
|
|
78
97
|
}
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
console.error('Error capturing data', e.message);
|
|
82
98
|
}
|
|
83
99
|
return data;
|
|
84
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-manager.js","sourceRoot":"","sources":["../../src/plugins/plugin-manager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAGH,yBAMY;
|
|
1
|
+
{"version":3,"file":"plugin-manager.js","sourceRoot":"","sources":["../../src/plugins/plugin-manager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAGH,yBAMY;AAOZ,MAAa,aAAa;IAQJ;IAPV,OAAO,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC3C,YAAY,GAAsB;QACvC,SAAS;QACT,OAAO;QACP,aAAa;QACb,gBAAgB;KACjB,CAAC;IACF,YAAoB,MAAc;QAAd,WAAM,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IAAgB;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxC,QAAQ,IAAI,CAAC,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;QACrC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,GAAG,CAAC,IAAgB;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,MAAM,CAAC,IAAU;QACd,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAoB,CAAC,YAAY,GAAG,IAAI,CAAC;QAClE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAoB,CAAC,YAAY,GAAG,IAAI,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,IAAI,GAAiB,EAAE,CAAC;QAC9B,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE;YACrC,IAAI,MAAM,YAAY,iBAAc,EAAE;gBACpC,IAAI,CAAC,WAAW,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;aACxC;iBAAM,IAAI,MAAM,YAAY,iBAAc,EAAE;gBAC3C,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;aACrC;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA5ED,sCA4EC"}
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
* THE SOFTWARE.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
import {
|
|
26
|
-
import { PluginOutput } from '../common_types';
|
|
25
|
+
import { Driver, PluginOutput } from '../common_types';
|
|
27
26
|
export declare type TraceOptions = {
|
|
28
27
|
filmstrips?: boolean;
|
|
29
28
|
trace?: boolean;
|
|
@@ -33,9 +32,10 @@ export declare type TraceOptions = {
|
|
|
33
32
|
* https://chromedevtools.github.io/devtools-protocol/tot/Tracing/
|
|
34
33
|
*/
|
|
35
34
|
export declare class Tracing {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
private driver;
|
|
36
|
+
private options;
|
|
37
|
+
constructor(driver: Driver, options: TraceOptions);
|
|
38
|
+
start(): Promise<void>;
|
|
39
|
+
stop(): Promise<Partial<PluginOutput>>;
|
|
40
40
|
}
|
|
41
41
|
//# sourceMappingURL=tracing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../src/plugins/tracing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../src/plugins/tracing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAIvD,oBAAY,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,qBAAa,OAAO;IACN,OAAO,CAAC,MAAM;IAAU,OAAO,CAAC,OAAO;gBAA/B,MAAM,EAAE,MAAM,EAAU,OAAO,EAAE,YAAY;IAE3D,KAAK;IAkCL,IAAI;CA0BX"}
|
package/dist/plugins/tracing.js
CHANGED
|
@@ -32,10 +32,13 @@ const trace_processor_1 = require("../sdk/trace-processor");
|
|
|
32
32
|
* https://chromedevtools.github.io/devtools-protocol/tot/Tracing/
|
|
33
33
|
*/
|
|
34
34
|
class Tracing {
|
|
35
|
-
|
|
35
|
+
driver;
|
|
36
|
+
options;
|
|
37
|
+
constructor(driver, options) {
|
|
38
|
+
this.driver = driver;
|
|
36
39
|
this.options = options;
|
|
37
40
|
}
|
|
38
|
-
async start(
|
|
41
|
+
async start() {
|
|
39
42
|
const includedCategories = [
|
|
40
43
|
// exclude all default categories
|
|
41
44
|
'-*',
|
|
@@ -56,20 +59,20 @@ class Tracing {
|
|
|
56
59
|
// Includes FCP, LCP, Main thread frames, process, etc.
|
|
57
60
|
'devtools.timeline', 'disabled-by-default-devtools.timeline');
|
|
58
61
|
}
|
|
59
|
-
await client.send('Tracing.start', {
|
|
62
|
+
await this.driver.client.send('Tracing.start', {
|
|
60
63
|
/**
|
|
61
64
|
* Using `ReportEvents` makes gathering trace events
|
|
62
65
|
* much faster as opposed to using `ReturnAsStream` mode
|
|
63
66
|
*/
|
|
64
67
|
transferMode: 'ReportEvents',
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
+
categories: includedCategories.join(','),
|
|
69
|
+
options: 'sampling-frequency=10000', // 1000 is default
|
|
68
70
|
});
|
|
69
71
|
}
|
|
70
|
-
async stop(
|
|
72
|
+
async stop() {
|
|
71
73
|
const events = [];
|
|
72
74
|
const collectListener = payload => events.push(...payload.value);
|
|
75
|
+
const { client } = this.driver;
|
|
73
76
|
client.on('Tracing.dataCollected', collectListener);
|
|
74
77
|
const [traceEvents] = await Promise.all([
|
|
75
78
|
new Promise(resolve => client.once('Tracing.tracingComplete', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../src/plugins/tracing.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;
|
|
1
|
+
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../src/plugins/tracing.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAGH,wDAAkD;AAClD,4DAAoE;AAOpE;;;GAGG;AACH,MAAa,OAAO;IACE;IAAwB;IAA5C,YAAoB,MAAc,EAAU,OAAqB;QAA7C,WAAM,GAAN,MAAM,CAAQ;QAAU,YAAO,GAAP,OAAO,CAAc;IAAG,CAAC;IAErE,KAAK,CAAC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C,CAAC,CACH;YACD,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;SAC3B,CAAC,CAAC;QACH,MAAM,MAAM,GAA0B,EAAE,CAAC;QACzC,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC3B,MAAM,CAAC,UAAU,GAAG,0BAAU,CAAC,OAAO,CAAC,WAAgC,CAAC,CAAC;SAC1E;QACD,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YACtB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;gBACpB,GAAG,gCAAc,CAAC,YAAY,CAAC,WAAgC,CAAC;aACjE,CAAC,CAAC;SACJ;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA/DD,0BA+DC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020-present, Elastic NV
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
* THE SOFTWARE.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
export declare class Bundler {
|
|
26
|
+
moduleMap: Map<string, string>;
|
|
27
|
+
constructor();
|
|
28
|
+
prepare(absPath: string): Promise<void>;
|
|
29
|
+
zip(outputPath: string): Promise<unknown>;
|
|
30
|
+
build(entry: string, output: string): Promise<string>;
|
|
31
|
+
encode(outputPath: string): Promise<string>;
|
|
32
|
+
checkSize(outputPath: string): Promise<void>;
|
|
33
|
+
cleanup(outputPath: string): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=bundler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../../src/push/bundler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAgBH,qBAAa,OAAO;IAClB,SAAS,sBAA6B;;IAGhC,OAAO,CAAC,OAAO,EAAE,MAAM;IAmBvB,GAAG,CAAC,UAAU,EAAE,MAAM;IAsBtB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IASnC,MAAM,CAAC,UAAU,EAAE,MAAM;IAIzB,SAAS,CAAC,UAAU,EAAE,MAAM;IAU5B,OAAO,CAAC,UAAU,EAAE,MAAM;CAIjC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MIT License
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2020-present, Elastic NV
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
|
15
|
+
* all copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
* THE SOFTWARE.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
27
|
+
if (k2 === undefined) k2 = k;
|
|
28
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
29
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
30
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(o, k2, desc);
|
|
33
|
+
}) : (function(o, m, k, k2) {
|
|
34
|
+
if (k2 === undefined) k2 = k;
|
|
35
|
+
o[k2] = m[k];
|
|
36
|
+
}));
|
|
37
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
38
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
39
|
+
}) : function(o, v) {
|
|
40
|
+
o["default"] = v;
|
|
41
|
+
});
|
|
42
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
43
|
+
if (mod && mod.__esModule) return mod;
|
|
44
|
+
var result = {};
|
|
45
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
46
|
+
__setModuleDefault(result, mod);
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.Bundler = void 0;
|
|
54
|
+
const path_1 = __importDefault(require("path"));
|
|
55
|
+
const promises_1 = require("fs/promises");
|
|
56
|
+
const fs_1 = require("fs");
|
|
57
|
+
const esbuild = __importStar(require("esbuild"));
|
|
58
|
+
const archiver_1 = __importDefault(require("archiver"));
|
|
59
|
+
const transform_1 = require("../core/transform");
|
|
60
|
+
const plugin_1 = require("./plugin");
|
|
61
|
+
const SIZE_LIMIT_KB = 800;
|
|
62
|
+
function relativeToCwd(entry) {
|
|
63
|
+
return path_1.default.relative(process.cwd(), entry);
|
|
64
|
+
}
|
|
65
|
+
class Bundler {
|
|
66
|
+
moduleMap = new Map();
|
|
67
|
+
constructor() { }
|
|
68
|
+
async prepare(absPath) {
|
|
69
|
+
const options = {
|
|
70
|
+
...(0, transform_1.commonOptions)(),
|
|
71
|
+
...{
|
|
72
|
+
entryPoints: [absPath],
|
|
73
|
+
bundle: true,
|
|
74
|
+
write: false,
|
|
75
|
+
sourcemap: 'inline',
|
|
76
|
+
external: ['@elastic/synthetics'],
|
|
77
|
+
plugins: [(0, plugin_1.SyntheticsBundlePlugin)()],
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
const result = await esbuild.build(options);
|
|
81
|
+
if (result.errors.length > 0) {
|
|
82
|
+
throw result.errors;
|
|
83
|
+
}
|
|
84
|
+
this.moduleMap.set(absPath, result.outputFiles[0].text);
|
|
85
|
+
}
|
|
86
|
+
async zip(outputPath) {
|
|
87
|
+
return new Promise((fulfill, reject) => {
|
|
88
|
+
const output = (0, fs_1.createWriteStream)(outputPath);
|
|
89
|
+
const archive = (0, archiver_1.default)('zip', {
|
|
90
|
+
zlib: { level: 9 },
|
|
91
|
+
});
|
|
92
|
+
archive.on('error', reject);
|
|
93
|
+
output.on('close', fulfill);
|
|
94
|
+
archive.pipe(output);
|
|
95
|
+
for (const [path, content] of this.moduleMap.entries()) {
|
|
96
|
+
const relativePath = relativeToCwd(path);
|
|
97
|
+
// Date is fixed to Unix epoch so the file metadata is
|
|
98
|
+
// not modified everytime when files are bundled
|
|
99
|
+
archive.append(content, {
|
|
100
|
+
name: relativePath,
|
|
101
|
+
date: new Date('1970-01-01'),
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
archive.finalize();
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
async build(entry, output) {
|
|
108
|
+
await this.prepare(entry);
|
|
109
|
+
await this.zip(output);
|
|
110
|
+
const data = await this.encode(output);
|
|
111
|
+
await this.checkSize(output);
|
|
112
|
+
await this.cleanup(output);
|
|
113
|
+
return data;
|
|
114
|
+
}
|
|
115
|
+
async encode(outputPath) {
|
|
116
|
+
return await (0, promises_1.readFile)(outputPath, 'base64');
|
|
117
|
+
}
|
|
118
|
+
async checkSize(outputPath) {
|
|
119
|
+
const { size } = await (0, promises_1.stat)(outputPath);
|
|
120
|
+
const sizeKb = size / 1024;
|
|
121
|
+
if (sizeKb > SIZE_LIMIT_KB) {
|
|
122
|
+
throw new Error(`You have monitors whose size exceeds the ${SIZE_LIMIT_KB}KB limit.`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
async cleanup(outputPath) {
|
|
126
|
+
this.moduleMap = new Map();
|
|
127
|
+
await (0, promises_1.unlink)(outputPath);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.Bundler = Bundler;
|
|
131
|
+
//# sourceMappingURL=bundler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundler.js","sourceRoot":"","sources":["../../src/push/bundler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gDAAwB;AACxB,0CAAqD;AACrD,2BAAuC;AACvC,iDAAmC;AACnC,wDAAgC;AAChC,iDAAkD;AAClD,qCAAkD;AAElD,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED,MAAa,OAAO;IAClB,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtC,gBAAe,CAAC;IAEhB,KAAK,CAAC,OAAO,CAAC,OAAe;QAC3B,MAAM,OAAO,GAAyB;YACpC,GAAG,IAAA,yBAAa,GAAE;YAClB,GAAG;gBACD,WAAW,EAAE,CAAC,OAAO,CAAC;gBACtB,MAAM,EAAE,IAAI;gBACZ,KAAK,EAAE,KAAK;gBACZ,SAAS,EAAE,QAAQ;gBACnB,QAAQ,EAAE,CAAC,qBAAqB,CAAC;gBACjC,OAAO,EAAE,CAAC,IAAA,+BAAsB,GAAE,CAAC;aACpC;SACF,CAAC;QACF,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,MAAM,MAAM,CAAC,MAAM,CAAC;SACrB;QACD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC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CAAC;IACd,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,UAAkB;QAC7B,OAAO,MAAM,IAAA,mBAAQ,EAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,UAAkB;QAChC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,eAAI,EAAC,UAAU,CAAC,CAAC;QACxC,MAAM,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;QAC3B,IAAI,MAAM,GAAG,aAAa,EAAE;YAC1B,MAAM,IAAI,KAAK,CACb,4CAA4C,aAAa,WAAW,CACrE,CAAC;SACH;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,UAAkB;QAC9B,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;QAC3C,MAAM,IAAA,iBAAM,EAAC,UAAU,CAAC,CAAC;IAC3B,CAAC;CACF;AAxED,0BAwEC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Monitor } from '../dsl/monitor';
|
|
2
|
+
import type { PushOptions, ProjectSettings } from '../common_types';
|
|
3
|
+
export declare function push(monitors: Monitor[], options: PushOptions): Promise<void>;
|
|
4
|
+
export declare function formatDuplicateError(monitors: Set<Monitor>): string;
|
|
5
|
+
export declare function loadSettings(): Promise<ProjectSettings>;
|
|
6
|
+
export declare function validateSettings(opts: PushOptions): void;
|
|
7
|
+
export declare function catchIncorrectSettings(settings: ProjectSettings, options: PushOptions): Promise<void>;
|
|
8
|
+
export declare function pushLegacy(monitors: Monitor[], options: PushOptions, version: number): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/push/index.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAqB,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAW5D,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAYpE,wBAAsB,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,iBAiDnE;AAoCD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,UAU1D;AAID,wBAAsB,YAAY,6BAajC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,QA6BjD;AAgBD,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,WAAW,iBA0BrB;AAED,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,iBAgChB"}
|
|
@@ -0,0 +1,227 @@
|
|
|
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.pushLegacy = exports.catchIncorrectSettings = exports.validateSettings = exports.loadSettings = exports.formatDuplicateError = exports.push = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* MIT License
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2020-present, Elastic NV
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in
|
|
20
|
+
* all copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
28
|
+
* THE SOFTWARE.
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
const semver_1 = __importDefault(require("semver"));
|
|
32
|
+
const promises_1 = require("fs/promises");
|
|
33
|
+
const enquirer_1 = require("enquirer");
|
|
34
|
+
const colors_1 = require("kleur/colors");
|
|
35
|
+
const monitor_1 = require("./monitor");
|
|
36
|
+
const monitor_2 = require("../dsl/monitor");
|
|
37
|
+
const helpers_1 = require("../helpers");
|
|
38
|
+
const config_1 = require("../config");
|
|
39
|
+
const kibana_api_1 = require("./kibana_api");
|
|
40
|
+
const utils_1 = require("./utils");
|
|
41
|
+
async function push(monitors, options) {
|
|
42
|
+
const duplicates = trackDuplicates(monitors);
|
|
43
|
+
if (duplicates.size > 0) {
|
|
44
|
+
throw (0, helpers_1.error)(formatDuplicateError(duplicates));
|
|
45
|
+
}
|
|
46
|
+
(0, helpers_1.progress)(`Pushing monitors for project: ${options.id}`);
|
|
47
|
+
const stackVersion = await (0, kibana_api_1.getVersion)(options);
|
|
48
|
+
const isV2 = semver_1.default.satisfies(stackVersion, '>=8.6.0');
|
|
49
|
+
if (!isV2) {
|
|
50
|
+
return await pushLegacy(monitors, options, stackVersion);
|
|
51
|
+
}
|
|
52
|
+
const local = (0, monitor_1.getLocalMonitors)(monitors);
|
|
53
|
+
const { monitors: remote } = await (0, kibana_api_1.bulkGetMonitors)(options);
|
|
54
|
+
const { newIDs, changedIDs, removedIDs, unchangedIDs } = (0, monitor_1.diffMonitors)(local, remote);
|
|
55
|
+
(0, utils_1.logDiff)(newIDs, changedIDs, removedIDs, unchangedIDs);
|
|
56
|
+
const updatedMonitors = new Set([...changedIDs, ...newIDs]);
|
|
57
|
+
if (updatedMonitors.size > 0) {
|
|
58
|
+
const toBundle = monitors.filter(m => updatedMonitors.has(m.config.id));
|
|
59
|
+
(0, helpers_1.progress)(`bundling ${toBundle.length} monitors`);
|
|
60
|
+
const schemas = await (0, monitor_1.buildMonitorSchema)(toBundle, true);
|
|
61
|
+
const chunks = (0, utils_1.getChunks)(schemas, kibana_api_1.CHUNK_SIZE);
|
|
62
|
+
for (const chunk of chunks) {
|
|
63
|
+
await (0, helpers_1.liveProgress)((0, kibana_api_1.bulkPutMonitors)(options, chunk), `creating or updating ${chunk.length} monitors`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (removedIDs.size > 0) {
|
|
67
|
+
if (updatedMonitors.size === 0 && unchangedIDs.size === 0) {
|
|
68
|
+
await promptConfirmDeleteAll(options);
|
|
69
|
+
}
|
|
70
|
+
const chunks = (0, utils_1.getChunks)(Array.from(removedIDs), kibana_api_1.CHUNK_SIZE);
|
|
71
|
+
for (const chunk of chunks) {
|
|
72
|
+
await (0, helpers_1.liveProgress)((0, kibana_api_1.bulkDeleteMonitors)(options, chunk), `deleting ${chunk.length} monitors`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
(0, helpers_1.done)(`Pushed: ${(0, colors_1.grey)((0, helpers_1.getMonitorManagementURL)(options.url))}`);
|
|
76
|
+
}
|
|
77
|
+
exports.push = push;
|
|
78
|
+
async function promptConfirmDeleteAll(options) {
|
|
79
|
+
(0, helpers_1.write)('');
|
|
80
|
+
const { deleteAll } = await (0, enquirer_1.prompt)({
|
|
81
|
+
type: 'confirm',
|
|
82
|
+
skip() {
|
|
83
|
+
if (options.yes) {
|
|
84
|
+
this.initial = process.env.TEST_OVERRIDE ?? true;
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
},
|
|
89
|
+
name: 'deleteAll',
|
|
90
|
+
message: `Pushing without any monitors will delete all monitors associated with the project.\n Do you want to continue?`,
|
|
91
|
+
initial: false,
|
|
92
|
+
});
|
|
93
|
+
if (!deleteAll) {
|
|
94
|
+
throw (0, helpers_1.warn)('Push command Aborted');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function trackDuplicates(monitors) {
|
|
98
|
+
const monitorMap = new Map();
|
|
99
|
+
const duplicates = new Set();
|
|
100
|
+
for (const monitor of monitors) {
|
|
101
|
+
const id = monitor.config.id;
|
|
102
|
+
if (monitorMap.has(id)) {
|
|
103
|
+
duplicates.add(monitorMap.get(id));
|
|
104
|
+
duplicates.add(monitor);
|
|
105
|
+
}
|
|
106
|
+
monitorMap.set(id, monitor);
|
|
107
|
+
}
|
|
108
|
+
return duplicates;
|
|
109
|
+
}
|
|
110
|
+
function formatDuplicateError(monitors) {
|
|
111
|
+
let outer = (0, colors_1.bold)(`Aborted: Duplicate monitors found\n`);
|
|
112
|
+
let inner = '';
|
|
113
|
+
for (const monitor of monitors) {
|
|
114
|
+
const { config, source } = monitor;
|
|
115
|
+
inner += `* ${config.id} - ${source.file}:${source.line}:${source.column}\n`;
|
|
116
|
+
}
|
|
117
|
+
outer += (0, helpers_1.indent)(inner);
|
|
118
|
+
return outer;
|
|
119
|
+
}
|
|
120
|
+
exports.formatDuplicateError = formatDuplicateError;
|
|
121
|
+
const INSTALLATION_HELP = `Run 'npx @elastic/synthetics init' to create project with default settings.`;
|
|
122
|
+
async function loadSettings() {
|
|
123
|
+
try {
|
|
124
|
+
const config = await (0, config_1.readConfig)(process.env['NODE_ENV'] || 'development');
|
|
125
|
+
// Missing config file, fake throw to capture as missing file
|
|
126
|
+
if (Object.keys(config).length === 0) {
|
|
127
|
+
throw '';
|
|
128
|
+
}
|
|
129
|
+
return config.project || {};
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
throw (0, helpers_1.error)(`Aborted (missing synthetics config file), Project not set up correctly.
|
|
133
|
+
|
|
134
|
+
${INSTALLATION_HELP}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.loadSettings = loadSettings;
|
|
138
|
+
function validateSettings(opts) {
|
|
139
|
+
const INVALID = 'Aborted. Invalid synthetics project settings.';
|
|
140
|
+
let reason = '';
|
|
141
|
+
if (!opts.id) {
|
|
142
|
+
reason = `Set project id via
|
|
143
|
+
- CLI '--id <id>'
|
|
144
|
+
- Config file 'project.id' field`;
|
|
145
|
+
}
|
|
146
|
+
else if (!opts.locations && !opts.privateLocations) {
|
|
147
|
+
reason = `Set default location for all monitors via
|
|
148
|
+
- CLI '--locations <values...> or --privateLocations <values...>'
|
|
149
|
+
- Config file 'monitors.locations' | 'monitors.privateLocations' field`;
|
|
150
|
+
}
|
|
151
|
+
else if (!opts.schedule) {
|
|
152
|
+
reason = `Set default schedule in minutes for all monitors via
|
|
153
|
+
- CLI '--schedule <mins>'
|
|
154
|
+
- Config file 'monitors.schedule' field`;
|
|
155
|
+
}
|
|
156
|
+
else if (opts.schedule && !monitor_2.ALLOWED_SCHEDULES.includes(opts.schedule)) {
|
|
157
|
+
reason = `Set default schedule(${opts.schedule}) to one of the allowed values - ${monitor_2.ALLOWED_SCHEDULES.join(',')}`;
|
|
158
|
+
}
|
|
159
|
+
if (!reason)
|
|
160
|
+
return;
|
|
161
|
+
throw (0, helpers_1.error)(`${INVALID}
|
|
162
|
+
|
|
163
|
+
${reason}
|
|
164
|
+
|
|
165
|
+
${INSTALLATION_HELP}`);
|
|
166
|
+
}
|
|
167
|
+
exports.validateSettings = validateSettings;
|
|
168
|
+
async function overrideSettings(oldValue, newValue) {
|
|
169
|
+
const cwd = process.cwd();
|
|
170
|
+
const configPath = await (0, config_1.findSyntheticsConfig)(cwd, cwd);
|
|
171
|
+
if (!configPath) {
|
|
172
|
+
throw (0, helpers_1.warn)(`Unable to find synthetics config file: ${configPath}`);
|
|
173
|
+
}
|
|
174
|
+
const config = await (0, promises_1.readFile)(configPath, 'utf-8');
|
|
175
|
+
const updatedConfig = config.replace(`id: '${oldValue}'`, `id: '${newValue}'`);
|
|
176
|
+
await (0, promises_1.writeFile)(configPath, updatedConfig, 'utf-8');
|
|
177
|
+
}
|
|
178
|
+
async function catchIncorrectSettings(settings, options) {
|
|
179
|
+
let override = !settings.id;
|
|
180
|
+
if (settings.id && settings.id !== options.id) {
|
|
181
|
+
// Add an extra line to make it easier to read the prompt
|
|
182
|
+
(0, helpers_1.write)('');
|
|
183
|
+
({ override } = await (0, enquirer_1.prompt)({
|
|
184
|
+
type: 'confirm',
|
|
185
|
+
name: 'override',
|
|
186
|
+
skip() {
|
|
187
|
+
if (options.yes) {
|
|
188
|
+
this.initial = process.env.TEST_OVERRIDE ?? true;
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
return false;
|
|
192
|
+
},
|
|
193
|
+
message: `Monitors were pushed under the '${settings.id}' project. Are you sure you want to push them under the new '${options.id}' (note that this will duplicate the monitors, the old ones being orphaned)`,
|
|
194
|
+
initial: false,
|
|
195
|
+
}));
|
|
196
|
+
if (!override) {
|
|
197
|
+
throw (0, helpers_1.warn)('Push command Aborted');
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (override) {
|
|
201
|
+
await overrideSettings(settings.id, options.id);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
exports.catchIncorrectSettings = catchIncorrectSettings;
|
|
205
|
+
async function pushLegacy(monitors, options, version) {
|
|
206
|
+
const noLightWeightSupport = semver_1.default.satisfies(version, '<8.5.0');
|
|
207
|
+
if (noLightWeightSupport &&
|
|
208
|
+
monitors.some(monitor => monitor.type !== 'browser')) {
|
|
209
|
+
throw (0, helpers_1.error)(`Aborted: Lightweight monitors are not supported in ${version}. Please upgrade to 8.5.0 or above.`);
|
|
210
|
+
}
|
|
211
|
+
let schemas = [];
|
|
212
|
+
if (monitors.length > 0) {
|
|
213
|
+
(0, helpers_1.progress)(`bundling ${monitors.length} monitors`);
|
|
214
|
+
schemas = await (0, monitor_1.buildMonitorSchema)(monitors, false);
|
|
215
|
+
const chunks = (0, utils_1.getChunks)(schemas, 10);
|
|
216
|
+
for (const chunk of chunks) {
|
|
217
|
+
await (0, helpers_1.liveProgress)((0, kibana_api_1.createMonitorsLegacy)({ schemas: chunk, keepStale: true, options }), `creating or updating ${chunk.length} monitors`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
await promptConfirmDeleteAll(options);
|
|
222
|
+
}
|
|
223
|
+
await (0, helpers_1.liveProgress)((0, kibana_api_1.createMonitorsLegacy)({ schemas, keepStale: false, options }), `deleting all stale monitors`);
|
|
224
|
+
(0, helpers_1.done)(`Pushed: ${(0, colors_1.grey)((0, helpers_1.getMonitorManagementURL)(options.url))}`);
|
|
225
|
+
}
|
|
226
|
+
exports.pushLegacy = pushLegacy;
|
|
227
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/push/index.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,oDAA4B;AAC5B,0CAAkD;AAClD,uCAAkC;AAClC,yCAA0C;AAC1C,uCAKmB;AACnB,4CAA4D;AAC5D,wCASoB;AAEpB,sCAA6D;AAC7D,6CAOsB;AACtB,mCAA6C;AAEtC,KAAK,UAAU,IAAI,CAAC,QAAmB,EAAE,OAAoB;IAClE,MAAM,UAAU,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,UAAU,CAAC,IAAI,GAAG,CAAC,EAAE;QACvB,MAAM,IAAA,eAAK,EAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC;KAC/C;IACD,IAAA,kBAAQ,EAAC,iC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