@elastic/synthetics 1.0.0-beta.25 → 1.0.0-beta.26
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 +1 -1
- package/dist/cli.js +42 -5
- package/dist/cli.js.map +1 -1
- package/dist/common_types.d.ts +59 -5
- package/dist/common_types.d.ts.map +1 -1
- package/dist/core/gatherer.d.ts +2 -2
- package/dist/core/gatherer.d.ts.map +1 -1
- package/dist/core/gatherer.js.map +1 -1
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +15 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/runner.d.ts +10 -58
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +88 -49
- package/dist/core/runner.js.map +1 -1
- package/dist/dsl/journey.d.ts +3 -0
- package/dist/dsl/journey.d.ts.map +1 -1
- package/dist/dsl/journey.js +15 -0
- package/dist/dsl/journey.js.map +1 -1
- package/dist/dsl/monitor.d.ts +64 -0
- package/dist/dsl/monitor.d.ts.map +1 -0
- package/dist/dsl/monitor.js +62 -0
- package/dist/dsl/monitor.js.map +1 -0
- package/dist/generator/index.d.ts +13 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +123 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/{reporters/reporter.js → generator/utils.d.ts} +3 -3
- package/dist/generator/utils.d.ts.map +1 -0
- package/dist/generator/utils.js +44 -0
- package/dist/generator/utils.js.map +1 -0
- package/dist/helpers.d.ts +12 -6
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +33 -43
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +2 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/loader.js +4 -4
- package/dist/loader.js.map +1 -1
- package/dist/options.d.ts +12 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +66 -4
- package/dist/options.js.map +1 -1
- package/dist/plugins/performance.d.ts +1 -16
- package/dist/plugins/performance.d.ts.map +1 -1
- package/dist/plugins/performance.js.map +1 -1
- package/dist/plugins/plugin-manager.d.ts +1 -1
- package/dist/push/bundler.d.ts +34 -0
- package/dist/push/bundler.d.ts.map +1 -0
- package/dist/push/bundler.js +119 -0
- package/dist/push/bundler.js.map +1 -0
- package/{src/reporters/reporter.ts → dist/push/index.d.ts} +4 -11
- package/dist/push/index.d.ts.map +1 -0
- package/dist/push/index.js +58 -0
- package/dist/push/index.js.map +1 -0
- package/dist/{reporters/reporter.d.ts → push/monitor.d.ts} +7 -8
- package/dist/push/monitor.d.ts.map +1 -0
- package/dist/push/monitor.js +67 -0
- package/dist/push/monitor.js.map +1 -0
- package/dist/push/plugin.d.ts +33 -0
- package/dist/push/plugin.d.ts.map +1 -0
- package/dist/push/plugin.js +123 -0
- package/dist/push/plugin.js.map +1 -0
- package/dist/push/request.d.ts +43 -0
- package/dist/push/request.d.ts.map +1 -0
- package/dist/push/request.js +95 -0
- package/dist/push/request.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 +45 -47
- 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 +7 -3
- package/dist/reporters/json.d.ts.map +1 -1
- package/dist/reporters/json.js +118 -118
- 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 +91 -86
- package/dist/reporters/junit.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -8
- package/src/cli.ts +65 -9
- package/src/common_types.ts +69 -5
- package/src/core/gatherer.ts +2 -2
- package/src/core/index.ts +15 -0
- package/src/core/runner.ts +86 -113
- package/src/dsl/journey.ts +18 -0
- package/src/dsl/monitor.ts +83 -0
- package/src/generator/index.ts +159 -0
- package/src/generator/utils.ts +41 -0
- package/src/helpers.ts +36 -52
- package/src/index.ts +9 -1
- package/src/loader.ts +4 -4
- package/src/options.ts +71 -8
- package/src/plugins/performance.ts +1 -17
- package/src/push/bundler.ts +99 -0
- package/src/push/index.ts +63 -0
- package/src/push/monitor.ts +77 -0
- package/src/push/plugin.ts +113 -0
- package/src/push/request.ts +123 -0
- package/src/reporters/base.ts +57 -56
- package/src/reporters/index.ts +26 -3
- package/src/reporters/json.ts +153 -145
- package/src/reporters/junit.ts +98 -93
- package/templates/journeys/example.journey.ts +18 -0
- package/templates/synthetics.config.ts +19 -0
- package/CHANGELOG.md +0 -348
- package/NOTICE.txt +0 -221
- package/dist/reporters/reporter.d.ts.map +0 -1
- package/dist/reporters/reporter.js.map +0 -1
package/dist/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;AAEH,0DAA8B;AAC9B,qCAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;AAEH,0DAA8B;AAC9B,qCAAsC;AACtC,uCAA6E;AAI7E;;;GAGG;AACH,MAAM,SAAS,GAAG,YAAY,CAAC;AAC/B,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;IAC9D,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC;CACzB;AAED,SAAgB,gBAAgB,CAAC,OAAgB;IAC/C,MAAM,OAAO,GAAe;QAC1B,GAAG,OAAO;QACV,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,UA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AAM,UAAU,GAAsB,EAAE,CAAC;QACzC,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEpC,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YAC7B,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACzD,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAClC,QAAQ,KAAK,EAAE;gBACb,KAAK,GAAG;oBACN,UAAU,CAAC,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;oBACtC,MAAM;gBACR,KAAK,GAAG;oBACN,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;oBACpC,MAAM;gBACR,KAAK,GAAG;oBACN,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;oBACrC,MAAM;aACT;QACH,CAAC,CAAC,CAAC;QACH,OAAO,UAAU,CAAC;KACnB;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;AACnC,CAAC;AAxBD,0CAwBC"}
|
|
@@ -22,22 +22,7 @@
|
|
|
22
22
|
* THE SOFTWARE.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
import { Driver } from '../common_types';
|
|
26
|
-
export interface PageMetrics {
|
|
27
|
-
Timestamp?: number;
|
|
28
|
-
Documents?: number;
|
|
29
|
-
Frames?: number;
|
|
30
|
-
JSEventListeners?: number;
|
|
31
|
-
Nodes?: number;
|
|
32
|
-
LayoutCount?: number;
|
|
33
|
-
RecalcStyleCount?: number;
|
|
34
|
-
LayoutDuration?: number;
|
|
35
|
-
RecalcStyleDuration?: number;
|
|
36
|
-
ScriptDuration?: number;
|
|
37
|
-
TaskDuration?: number;
|
|
38
|
-
JSHeapUsedSize?: number;
|
|
39
|
-
JSHeapTotalSize?: number;
|
|
40
|
-
}
|
|
25
|
+
import { Driver, PageMetrics } from '../common_types';
|
|
41
26
|
export declare class PerformanceManager {
|
|
42
27
|
private driver;
|
|
43
28
|
constructor(driver: Driver);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance.d.ts","sourceRoot":"","sources":["../../src/plugins/performance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"performance.d.ts","sourceRoot":"","sources":["../../src/plugins/performance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAkBtD,qBAAa,kBAAkB;IACjB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE5B,KAAK;IAIL,IAAI;IAIJ,UAAU;IAKhB,OAAO,CAAC,kBAAkB;CAO3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance.js","sourceRoot":"","sources":["../../src/plugins/performance.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAIH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAS;IACvC,WAAW;IACX,WAAW;IACX,QAAQ;IACR,kBAAkB;IAClB,OAAO;IACP,aAAa;IACb,kBAAkB;IAClB,gBAAgB;IAChB,qBAAqB;IACrB,gBAAgB;IAChB,cAAc;IACd,gBAAgB;IAChB,iBAAiB;CAClB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"performance.js","sourceRoot":"","sources":["../../src/plugins/performance.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAIH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAS;IACvC,WAAW;IACX,WAAW;IACX,QAAQ;IACR,kBAAkB;IAClB,OAAO;IACP,aAAa;IACb,kBAAkB;IAClB,gBAAgB;IAChB,qBAAqB;IACrB,gBAAgB;IAChB,cAAc;IACd,gBAAgB;IAChB,iBAAiB;CAClB,CAAC,CAAC;AAEH,MAAa,kBAAkB;IAC7B,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAEtC,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAEO,kBAAkB,CAAC,OAAO,GAAG,EAAE;QACrC,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC5B,IAAI,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;gBAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC;SAC3E;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAvBD,gDAuBC"}
|
|
@@ -36,7 +36,7 @@ export declare class PluginManager {
|
|
|
36
36
|
register(type: PluginType, options: PluginOptions): Plugin;
|
|
37
37
|
registerAll(options: PluginOptions): void;
|
|
38
38
|
unregisterAll(): void;
|
|
39
|
-
stop(type: PluginType): Promise<void | import("../common_types").NetworkInfo[] |
|
|
39
|
+
stop(type: PluginType): Promise<void | import("../common_types").NetworkInfo[] | import("../common_types").BrowserMessage[] | Partial<PluginOutput>>;
|
|
40
40
|
start(type: PluginType): Promise<Plugin>;
|
|
41
41
|
get(type: PluginType): Plugin;
|
|
42
42
|
onStep(step: Step): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
cleanup(outputPath: string): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
//# 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;AAaH,qBAAa,OAAO;IAClB,SAAS,sBAA6B;;IAGhC,OAAO,CAAC,OAAO,EAAE,MAAM;IAyBvB,GAAG,CAAC,UAAU,EAAE,MAAM;IAiBtB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAQnC,MAAM,CAAC,UAAU,EAAE,MAAM;IAIzB,OAAO,CAAC,UAAU,EAAE,MAAM;CAIjC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
29
|
+
}) : (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
o[k2] = m[k];
|
|
32
|
+
}));
|
|
33
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
34
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
35
|
+
}) : function(o, v) {
|
|
36
|
+
o["default"] = v;
|
|
37
|
+
});
|
|
38
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
|
+
};
|
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
exports.Bundler = void 0;
|
|
50
|
+
const path_1 = __importDefault(require("path"));
|
|
51
|
+
const promises_1 = require("fs/promises");
|
|
52
|
+
const fs_1 = require("fs");
|
|
53
|
+
const esbuild = __importStar(require("esbuild"));
|
|
54
|
+
const archiver_1 = __importDefault(require("archiver"));
|
|
55
|
+
const plugin_1 = require("./plugin");
|
|
56
|
+
function relativeToCwd(entry) {
|
|
57
|
+
return path_1.default.relative(process.cwd(), entry);
|
|
58
|
+
}
|
|
59
|
+
class Bundler {
|
|
60
|
+
constructor() {
|
|
61
|
+
this.moduleMap = new Map();
|
|
62
|
+
}
|
|
63
|
+
async prepare(absPath) {
|
|
64
|
+
const addToMap = (data) => {
|
|
65
|
+
this.moduleMap.set(data.path, data.contents);
|
|
66
|
+
};
|
|
67
|
+
const options = {
|
|
68
|
+
...(0, plugin_1.commonOptions)(),
|
|
69
|
+
...{
|
|
70
|
+
entryPoints: {
|
|
71
|
+
[absPath]: absPath,
|
|
72
|
+
},
|
|
73
|
+
plugins: [(0, plugin_1.MultiAssetPlugin)(addToMap)],
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
try {
|
|
77
|
+
const result = await esbuild.build(options);
|
|
78
|
+
if (result.errors.length > 0) {
|
|
79
|
+
throw result.errors;
|
|
80
|
+
}
|
|
81
|
+
this.moduleMap.set(absPath, result.outputFiles[0].text);
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
console.error(e);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async zip(outputPath) {
|
|
88
|
+
return new Promise((fulfill, reject) => {
|
|
89
|
+
const output = (0, fs_1.createWriteStream)(outputPath);
|
|
90
|
+
const archive = (0, archiver_1.default)('zip', {
|
|
91
|
+
zlib: { level: 9 },
|
|
92
|
+
});
|
|
93
|
+
archive.on('error', err => reject(err));
|
|
94
|
+
output.on('close', fulfill);
|
|
95
|
+
archive.pipe(output);
|
|
96
|
+
for (const [path, content] of this.moduleMap.entries()) {
|
|
97
|
+
const relativePath = relativeToCwd(path);
|
|
98
|
+
archive.append(content, { name: relativePath });
|
|
99
|
+
}
|
|
100
|
+
archive.finalize();
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
async build(entry, output) {
|
|
104
|
+
await this.prepare(entry);
|
|
105
|
+
await this.zip(output);
|
|
106
|
+
const data = await this.encode(output);
|
|
107
|
+
await this.cleanup(output);
|
|
108
|
+
return data;
|
|
109
|
+
}
|
|
110
|
+
async encode(outputPath) {
|
|
111
|
+
return await (0, promises_1.readFile)(outputPath, 'base64');
|
|
112
|
+
}
|
|
113
|
+
async cleanup(outputPath) {
|
|
114
|
+
this.moduleMap = new Map();
|
|
115
|
+
await (0, promises_1.unlink)(outputPath);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.Bundler = Bundler;
|
|
119
|
+
//# 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,0CAA+C;AAC/C,2BAAuC;AACvC,iDAAmC;AACnC,wDAAgC;AAChC,qCAAuE;AAEvE,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED,MAAa,OAAO;IAElB;QADA,cAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvB,CAAC;IAEhB,KAAK,CAAC,OAAO,CAAC,OAAe;QAC3B,MAAM,QAAQ,GAAG,CAAC,IAAgB,EAAE,EAAE;YACpC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/C,CAAC,CAAC;QAEF,MAAM,OAAO,GAAyB;YACpC,GAAG,IAAA,sBAAa,GAAE;YAClB,GAAG;gBACD,WAAW,EAAE;oBACX,CAAC,OAAO,CAAC,EAAE,OA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YACD,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,KAAa,EAAE,MAAc;QACvC,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC1B,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACvB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACvC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC3B,OAAO,IAAI,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,OAAO,CAAC,UAAkB;QAC9B,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;QAC3C,MAAM,IAAA,iBAAM,EAAC,UAAU,CAAC,CAAC;IAC3B,CAAC;CACF;AA9DD,0BA8DC"}
|
|
@@ -22,14 +22,7 @@
|
|
|
22
22
|
* THE SOFTWARE.
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
fd?: number;
|
|
30
|
-
colors?: boolean;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default interface Reporter {
|
|
34
|
-
new (runner: Runner, options: ReporterOptions): any;
|
|
35
|
-
}
|
|
25
|
+
import { Monitor } from '../dsl/monitor';
|
|
26
|
+
import { PushOptions } from '../common_types';
|
|
27
|
+
export declare function push(monitors: Monitor[], options: PushOptions): Promise<void>;
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/push/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAUH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI9C,wBAAsB,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,iBAwBnE"}
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.push = void 0;
|
|
28
|
+
const request_1 = require("./request");
|
|
29
|
+
const monitor_1 = require("./monitor");
|
|
30
|
+
const helpers_1 = require("../helpers");
|
|
31
|
+
async function push(monitors, options) {
|
|
32
|
+
(0, helpers_1.progress)(`preparing all monitors`);
|
|
33
|
+
const schemas = await (0, monitor_1.buildMonitorSchema)(monitors);
|
|
34
|
+
try {
|
|
35
|
+
(0, helpers_1.progress)(`creating all monitors`);
|
|
36
|
+
const { body, statusCode } = await (0, request_1.createMonitors)(schemas, options);
|
|
37
|
+
if (statusCode === 404) {
|
|
38
|
+
throw (0, request_1.formatNotFoundError)(await body.text());
|
|
39
|
+
}
|
|
40
|
+
if (!(0, request_1.ok)(statusCode)) {
|
|
41
|
+
const { error, message } = await body.json();
|
|
42
|
+
throw (0, request_1.formatAPIError)(statusCode, error, message);
|
|
43
|
+
}
|
|
44
|
+
const { staleMonitors, failedMonitors } = await body.json();
|
|
45
|
+
if (failedMonitors.length > 0) {
|
|
46
|
+
throw (0, request_1.formatFailedMonitors)(failedMonitors);
|
|
47
|
+
}
|
|
48
|
+
if (staleMonitors.length > 0) {
|
|
49
|
+
(0, helpers_1.write)((0, request_1.formatStaleMonitors)());
|
|
50
|
+
}
|
|
51
|
+
(0, helpers_1.done)('Pushed');
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
(0, helpers_1.error)(e);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.push = push;
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/push/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,uCAOmB;AAGnB,uCAA+C;AAC/C,wCAA0D;AAEnD,KAAK,UAAU,IAAI,CAAC,QAAmB,EAAE,OAAoB;IAClE,IAAA,kBAAQ,EAAC,wBA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are type MonitorSchema = Omit<MonitorConfig, 'locations'> & {
|
|
27
|
+
content: string;
|
|
28
|
+
locations: string[];
|
|
29
|
+
filter: Monitor['filter'];
|
|
29
30
|
};
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=reporter.d.ts.map
|
|
31
|
+
export declare function buildMonitorSchema(monitors: Monitor[]): Promise<MonitorSchema[]>;
|
|
32
|
+
//# sourceMappingURL=monitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitor.d.ts","sourceRoot":"","sources":["../../src/push/monitor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,OAAO,EACL,OAAO,EACP,aAAa,EAEd,MAAM,gBAAgB,CAAC;AAExB,oBAAY,aAAa,GAAG,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,GAAG;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC3B,CAAC;AAYF,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,EAAE,4BAyB3D"}
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.buildMonitorSchema = void 0;
|
|
28
|
+
const promises_1 = require("fs/promises");
|
|
29
|
+
const path_1 = require("path");
|
|
30
|
+
const bundler_1 = require("./bundler");
|
|
31
|
+
const helpers_1 = require("../helpers");
|
|
32
|
+
// Internal representation of Locations that would be used when
|
|
33
|
+
// talking to the Kibana API
|
|
34
|
+
const LocationsMap = {
|
|
35
|
+
'US East': 'us-east4-a',
|
|
36
|
+
'EU West': 'europe-west2-a',
|
|
37
|
+
};
|
|
38
|
+
function translateLocation(locations) {
|
|
39
|
+
return locations.map(loc => LocationsMap[loc]).filter(Boolean);
|
|
40
|
+
}
|
|
41
|
+
async function buildMonitorSchema(monitors) {
|
|
42
|
+
if (monitors.length == 0) {
|
|
43
|
+
throw new Error('No Monitors found');
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Set up the bundle artifacts path which can be used to
|
|
47
|
+
* create the bundles required for uploading journeys
|
|
48
|
+
*/
|
|
49
|
+
const bundlePath = (0, path_1.join)(helpers_1.CACHE_PATH, 'bundles');
|
|
50
|
+
await (0, promises_1.mkdir)(bundlePath, { recursive: true });
|
|
51
|
+
const bundler = new bundler_1.Bundler();
|
|
52
|
+
const schemas = [];
|
|
53
|
+
for (const monitor of monitors) {
|
|
54
|
+
const { source, config, filter } = monitor;
|
|
55
|
+
const outPath = (0, path_1.join)(bundlePath, config.name + '.zip');
|
|
56
|
+
const content = await bundler.build(source.file, outPath);
|
|
57
|
+
schemas.push({
|
|
58
|
+
...config,
|
|
59
|
+
content,
|
|
60
|
+
locations: translateLocation(config.locations),
|
|
61
|
+
filter: filter,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return schemas;
|
|
65
|
+
}
|
|
66
|
+
exports.buildMonitorSchema = buildMonitorSchema;
|
|
67
|
+
//# sourceMappingURL=monitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitor.js","sourceRoot":"","sources":["../../src/push/monitor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,0CAAoC;AACpC,+BAA4B;AAC5B,uCAAoC;AACpC,wCAAwC;AAaxC,+DAA+D;AAC/D,4BAA4B;AAC5B,MAAM,YAAY,GAA4C;IAC5D,SAAS,EAAE,YAAY;IACvB,SAAS,EAAE,gBAAgB;CAC5B,CAAC;AACF,SAAS,iBAAiB,CAAC,SAAqC;IAC9D,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AAEM,KAAK,UAAU,kBAAkB,CAAC,QAAmB;IAC1D,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC,EAAE;QACxB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;KACtC;IACD;;;OAGG;IACH,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,oBAAU,EAAE,SAAS,CAAC,CAAC;IAC/C,MAAM,IAAA,gBAAK,EAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,IAAI,iBAAO,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAoB,EAAE,CAAC;IAEpC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAC3C,MAAM,OAAO,GAAG,IAAA,WAAI,EAAC,UAAU,EAAE,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;QACvD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC;YACX,GAAG,MAAM;YACT,OAAO;YACP,SAAS,EAAE,iBAAiB,CAAC,MAAM,CAAC,SAAS,CAAC;YAC9C,MAAM,EAAE,MAAM;SACf,CAAC,CAAC;KACJ;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAzBD,gDAyBC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
import * as esbuild from 'esbuild';
|
|
26
|
+
export declare function commonOptions(): esbuild.BuildOptions;
|
|
27
|
+
export declare type PluginData = {
|
|
28
|
+
path: string;
|
|
29
|
+
contents: string;
|
|
30
|
+
};
|
|
31
|
+
export declare type PluginCallback = (data: PluginData) => void;
|
|
32
|
+
export declare function MultiAssetPlugin(callback: PluginCallback): esbuild.Plugin;
|
|
33
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/push/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,wBAAgB,aAAa,IAAI,OAAO,CAAC,YAAY,CAYpD;AAED,oBAAY,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AACF,oBAAY,cAAc,GAAG,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;AAExD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CA+DzE"}
|
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
29
|
+
}) : (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
o[k2] = m[k];
|
|
32
|
+
}));
|
|
33
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
34
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
35
|
+
}) : function(o, v) {
|
|
36
|
+
o["default"] = v;
|
|
37
|
+
});
|
|
38
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
|
+
};
|
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
exports.MultiAssetPlugin = exports.commonOptions = void 0;
|
|
50
|
+
const path_1 = __importDefault(require("path"));
|
|
51
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
52
|
+
const esbuild = __importStar(require("esbuild"));
|
|
53
|
+
function commonOptions() {
|
|
54
|
+
return {
|
|
55
|
+
bundle: true,
|
|
56
|
+
external: ['node_modules', '@elastic/synthetics'],
|
|
57
|
+
minify: false,
|
|
58
|
+
platform: 'node',
|
|
59
|
+
format: 'esm',
|
|
60
|
+
write: false,
|
|
61
|
+
outExtension: {
|
|
62
|
+
'.js': '.js',
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
exports.commonOptions = commonOptions;
|
|
67
|
+
function MultiAssetPlugin(callback) {
|
|
68
|
+
const isBare = (str) => {
|
|
69
|
+
if (str.startsWith('/') || str.startsWith('./') || str.startsWith('../')) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
name: 'esbuild-multiasset-plugin',
|
|
76
|
+
setup(build) {
|
|
77
|
+
build.onResolve({ filter: /.*?/ }, async (args) => {
|
|
78
|
+
// External and other packages need be marked external to
|
|
79
|
+
// be removed from the bundle
|
|
80
|
+
if (build.initialOptions.external?.includes(args.path) ||
|
|
81
|
+
!isBare(args.path)) {
|
|
82
|
+
return {
|
|
83
|
+
external: true,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (args.kind === 'entry-point') {
|
|
87
|
+
return {
|
|
88
|
+
path: args.path,
|
|
89
|
+
namespace: 'asset',
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
// If the modules are resolved locally, then
|
|
93
|
+
// use the imported path to get full path
|
|
94
|
+
const entryPath = path_1.default.join(path_1.default.dirname(args.importer), args.path) +
|
|
95
|
+
path_1.default.extname(args.importer);
|
|
96
|
+
// Spin off another build to copy over the imported modules without bundling
|
|
97
|
+
const result = await esbuild.build({
|
|
98
|
+
...commonOptions(),
|
|
99
|
+
entryPoints: {
|
|
100
|
+
[entryPath]: entryPath,
|
|
101
|
+
},
|
|
102
|
+
bundle: false,
|
|
103
|
+
external: [],
|
|
104
|
+
});
|
|
105
|
+
callback({
|
|
106
|
+
path: entryPath,
|
|
107
|
+
contents: result.outputFiles[0].text,
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
errors: result.errors,
|
|
111
|
+
external: true,
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
build.onLoad({ filter: /.*?/, namespace: 'asset' }, async (args) => {
|
|
115
|
+
const contents = await promises_1.default.readFile(args.path, 'utf-8');
|
|
116
|
+
callback({ path: args.path, contents });
|
|
117
|
+
return { contents };
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
exports.MultiAssetPlugin = MultiAssetPlugin;
|
|
123
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/push/plugin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;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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
|
+
import { PushOptions } from '../common_types';
|
|
26
|
+
import { MonitorSchema } from './monitor';
|
|
27
|
+
export declare type APISchema = {
|
|
28
|
+
project: string;
|
|
29
|
+
keep_stale: boolean;
|
|
30
|
+
monitors: MonitorSchema[];
|
|
31
|
+
};
|
|
32
|
+
export declare function ok(statusCode: number): boolean;
|
|
33
|
+
export declare function createMonitors(monitors: MonitorSchema[], options: PushOptions): Promise<import("undici/types/dispatcher").ResponseData>;
|
|
34
|
+
export declare type APIMonitorError = {
|
|
35
|
+
id?: string;
|
|
36
|
+
reason: string;
|
|
37
|
+
details: string;
|
|
38
|
+
};
|
|
39
|
+
export declare function formatNotFoundError(message: string): string;
|
|
40
|
+
export declare function formatAPIError(statuCode: number, error: string, message: string): string;
|
|
41
|
+
export declare function formatFailedMonitors(errors: APIMonitorError[]): string;
|
|
42
|
+
export declare function formatStaleMonitors(): string;
|
|
43
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/push/request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAK1C,oBAAY,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B,CAAC;AAeF,wBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,WAEpC;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,aAAa,EAAE,EACzB,OAAO,EAAE,WAAW,2DAkBrB;AAED,oBAAY,eAAe,GAAG;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,UAIlD;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,UAShB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,EAAE,UAU7D;AAED,wBAAgB,mBAAmB,WAKlC"}
|