@elastic/synthetics 1.0.0-beta.8 → 1.0.0

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.
Files changed (220) hide show
  1. package/README.md +5 -4
  2. package/dist/cli.js +139 -165
  3. package/dist/cli.js.map +1 -1
  4. package/dist/common_types.d.ts +158 -34
  5. package/dist/common_types.d.ts.map +1 -1
  6. package/dist/config.d.ts +1 -0
  7. package/dist/config.d.ts.map +1 -1
  8. package/dist/config.js +7 -6
  9. package/dist/config.js.map +1 -1
  10. package/dist/core/browser-service.d.ts +1 -1
  11. package/dist/core/browser-service.d.ts.map +1 -1
  12. package/dist/core/browser-service.js +7 -6
  13. package/dist/core/browser-service.js.map +1 -1
  14. package/dist/core/expect.d.ts +25 -25
  15. package/dist/core/expect.d.ts.map +1 -1
  16. package/dist/core/expect.js.map +1 -1
  17. package/dist/core/gatherer.d.ts +5 -8
  18. package/dist/core/gatherer.d.ts.map +1 -1
  19. package/dist/core/gatherer.js +75 -17
  20. package/dist/core/gatherer.js.map +1 -1
  21. package/dist/core/index.d.ts +5 -1
  22. package/dist/core/index.d.ts.map +1 -1
  23. package/dist/core/index.js +23 -11
  24. package/dist/core/index.js.map +1 -1
  25. package/dist/core/logger.d.ts +0 -1
  26. package/dist/core/logger.d.ts.map +1 -1
  27. package/dist/core/logger.js +10 -17
  28. package/dist/core/logger.js.map +1 -1
  29. package/dist/core/runner.d.ts +12 -63
  30. package/dist/core/runner.d.ts.map +1 -1
  31. package/dist/core/runner.js +159 -92
  32. package/dist/core/runner.js.map +1 -1
  33. package/dist/core/transform.d.ts +37 -0
  34. package/dist/core/transform.d.ts.map +1 -0
  35. package/dist/core/transform.js +148 -0
  36. package/dist/core/transform.js.map +1 -0
  37. package/dist/dsl/index.js +5 -1
  38. package/dist/dsl/index.js.map +1 -1
  39. package/dist/dsl/journey.d.ts +9 -7
  40. package/dist/dsl/journey.d.ts.map +1 -1
  41. package/dist/dsl/journey.js +32 -39
  42. package/dist/dsl/journey.js.map +1 -1
  43. package/dist/dsl/monitor.d.ts +93 -0
  44. package/dist/dsl/monitor.d.ts.map +1 -0
  45. package/dist/dsl/monitor.js +110 -0
  46. package/dist/dsl/monitor.js.map +1 -0
  47. package/dist/dsl/step.d.ts +3 -2
  48. package/dist/dsl/step.d.ts.map +1 -1
  49. package/dist/dsl/step.js +6 -1
  50. package/dist/dsl/step.js.map +1 -1
  51. package/dist/formatter/javascript.d.ts +115 -0
  52. package/dist/formatter/javascript.d.ts.map +1 -0
  53. package/dist/formatter/javascript.js +331 -0
  54. package/dist/formatter/javascript.js.map +1 -0
  55. package/dist/generator/index.d.ts +24 -0
  56. package/dist/generator/index.d.ts.map +1 -0
  57. package/dist/generator/index.js +241 -0
  58. package/dist/generator/index.js.map +1 -0
  59. package/dist/{reporters/reporter.js → generator/utils.d.ts} +5 -3
  60. package/dist/generator/utils.d.ts.map +1 -0
  61. package/dist/generator/utils.js +84 -0
  62. package/dist/generator/utils.js.map +1 -0
  63. package/dist/helpers.d.ts +36 -9
  64. package/dist/helpers.d.ts.map +1 -1
  65. package/dist/helpers.js +170 -24
  66. package/dist/helpers.js.map +1 -1
  67. package/dist/index.d.ts +5 -7
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +5 -26
  70. package/dist/index.js.map +1 -1
  71. package/dist/loader.d.ts +34 -0
  72. package/dist/loader.d.ts.map +1 -0
  73. package/dist/loader.js +153 -0
  74. package/dist/loader.js.map +1 -0
  75. package/dist/locations/index.d.ts +45 -0
  76. package/dist/locations/index.d.ts.map +1 -0
  77. package/dist/locations/index.js +83 -0
  78. package/dist/locations/index.js.map +1 -0
  79. package/dist/{reporters/reporter.d.ts → locations/public-locations.d.ts} +12 -8
  80. package/dist/locations/public-locations.d.ts.map +1 -0
  81. package/dist/locations/public-locations.js +41 -0
  82. package/dist/locations/public-locations.js.map +1 -0
  83. package/dist/options.d.ts +42 -0
  84. package/dist/options.d.ts.map +1 -0
  85. package/dist/options.js +146 -0
  86. package/dist/options.js.map +1 -0
  87. package/dist/plugins/browser-console.d.ts +5 -4
  88. package/dist/plugins/browser-console.d.ts.map +1 -1
  89. package/dist/plugins/browser-console.js +47 -24
  90. package/dist/plugins/browser-console.js.map +1 -1
  91. package/dist/plugins/index.js +5 -1
  92. package/dist/plugins/index.js.map +1 -1
  93. package/dist/plugins/network.d.ts +24 -31
  94. package/dist/plugins/network.d.ts.map +1 -1
  95. package/dist/plugins/network.js +226 -229
  96. package/dist/plugins/network.js.map +1 -1
  97. package/dist/plugins/performance.d.ts +4 -19
  98. package/dist/plugins/performance.d.ts.map +1 -1
  99. package/dist/plugins/performance.js +6 -5
  100. package/dist/plugins/performance.js.map +1 -1
  101. package/dist/plugins/plugin-manager.d.ts +9 -5
  102. package/dist/plugins/plugin-manager.d.ts.map +1 -1
  103. package/dist/plugins/plugin-manager.js +46 -30
  104. package/dist/plugins/plugin-manager.js.map +1 -1
  105. package/dist/plugins/tracing.d.ts +6 -6
  106. package/dist/plugins/tracing.d.ts.map +1 -1
  107. package/dist/plugins/tracing.js +13 -7
  108. package/dist/plugins/tracing.js.map +1 -1
  109. package/dist/push/bundler.d.ts +35 -0
  110. package/dist/push/bundler.d.ts.map +1 -0
  111. package/dist/push/bundler.js +131 -0
  112. package/dist/push/bundler.js.map +1 -0
  113. package/dist/push/index.d.ts +10 -0
  114. package/dist/push/index.d.ts.map +1 -0
  115. package/dist/push/index.js +235 -0
  116. package/dist/push/index.js.map +1 -0
  117. package/dist/push/kibana_api.d.ts +56 -0
  118. package/dist/push/kibana_api.d.ts.map +1 -0
  119. package/dist/push/kibana_api.js +135 -0
  120. package/dist/push/kibana_api.js.map +1 -0
  121. package/dist/push/monitor.d.ts +55 -0
  122. package/dist/push/monitor.d.ts.map +1 -0
  123. package/dist/push/monitor.js +268 -0
  124. package/dist/push/monitor.js.map +1 -0
  125. package/dist/{parse_args.d.ts → push/plugin.d.ts} +9 -6
  126. package/dist/push/plugin.d.ts.map +1 -0
  127. package/dist/push/plugin.js +66 -0
  128. package/dist/push/plugin.js.map +1 -0
  129. package/dist/push/request.d.ts +45 -0
  130. package/dist/push/request.d.ts.map +1 -0
  131. package/dist/push/request.js +109 -0
  132. package/dist/push/request.js.map +1 -0
  133. package/dist/push/utils.d.ts +31 -0
  134. package/dist/push/utils.d.ts.map +1 -0
  135. package/dist/push/utils.js +64 -0
  136. package/dist/push/utils.js.map +1 -0
  137. package/dist/reporters/base.d.ts +14 -6
  138. package/dist/reporters/base.d.ts.map +1 -1
  139. package/dist/reporters/base.js +58 -50
  140. package/dist/reporters/base.js.map +1 -1
  141. package/dist/reporters/index.d.ts +18 -8
  142. package/dist/reporters/index.d.ts.map +1 -1
  143. package/dist/reporters/index.js.map +1 -1
  144. package/dist/reporters/json.d.ts +17 -62
  145. package/dist/reporters/json.d.ts.map +1 -1
  146. package/dist/reporters/json.js +147 -177
  147. package/dist/reporters/json.js.map +1 -1
  148. package/dist/reporters/junit.d.ts +7 -1
  149. package/dist/reporters/junit.d.ts.map +1 -1
  150. package/dist/reporters/junit.js +90 -95
  151. package/dist/reporters/junit.js.map +1 -1
  152. package/dist/sdk/lh-trace-processor.d.ts +35 -9
  153. package/dist/sdk/lh-trace-processor.d.ts.map +1 -1
  154. package/dist/sdk/lh-trace-processor.js +114 -53
  155. package/dist/sdk/lh-trace-processor.js.map +1 -1
  156. package/dist/sdk/trace-metrics.d.ts +4 -4
  157. package/dist/sdk/trace-metrics.d.ts.map +1 -1
  158. package/dist/sdk/trace-metrics.js +3 -4
  159. package/dist/sdk/trace-metrics.js.map +1 -1
  160. package/dist/sdk/trace-processor.d.ts +11 -3
  161. package/dist/sdk/trace-processor.d.ts.map +1 -1
  162. package/dist/sdk/trace-processor.js +17 -9
  163. package/dist/sdk/trace-processor.js.map +1 -1
  164. package/package.json +38 -30
  165. package/src/cli.ts +223 -158
  166. package/src/common_types.ts +191 -34
  167. package/src/config.ts +1 -1
  168. package/src/core/expect.ts +58 -24
  169. package/src/core/gatherer.ts +92 -25
  170. package/src/core/index.ts +36 -15
  171. package/src/core/logger.ts +8 -12
  172. package/src/core/runner.ts +158 -148
  173. package/src/core/transform.ts +160 -0
  174. package/src/dsl/journey.ts +41 -21
  175. package/src/dsl/monitor.ts +152 -0
  176. package/src/dsl/step.ts +9 -2
  177. package/src/formatter/javascript.ts +414 -0
  178. package/src/generator/index.ts +308 -0
  179. package/src/generator/utils.ts +84 -0
  180. package/src/helpers.ts +182 -16
  181. package/src/index.ts +21 -22
  182. package/src/loader.ts +171 -0
  183. package/src/locations/index.ts +95 -0
  184. package/src/{reporters/reporter.ts → locations/public-locations.ts} +12 -9
  185. package/src/options.ts +175 -0
  186. package/src/plugins/browser-console.ts +33 -8
  187. package/src/plugins/network.ts +266 -284
  188. package/src/plugins/performance.ts +6 -22
  189. package/src/plugins/plugin-manager.ts +49 -31
  190. package/src/plugins/tracing.ts +11 -9
  191. package/src/push/bundler.ts +112 -0
  192. package/src/push/index.ts +291 -0
  193. package/src/push/kibana_api.ts +191 -0
  194. package/src/push/monitor.ts +307 -0
  195. package/src/push/plugin.ts +66 -0
  196. package/src/push/request.ts +141 -0
  197. package/src/push/utils.ts +77 -0
  198. package/src/reporters/base.ts +63 -52
  199. package/src/reporters/index.ts +26 -3
  200. package/src/reporters/json.ts +181 -201
  201. package/src/reporters/junit.ts +98 -93
  202. package/src/sdk/lh-trace-processor.ts +132 -68
  203. package/src/sdk/trace-metrics.ts +8 -4
  204. package/src/sdk/trace-processor.ts +28 -13
  205. package/templates/.github/workflows/run-synthetics.yml +27 -0
  206. package/templates/README.md +21 -0
  207. package/templates/journeys/advanced-example-helpers.ts +54 -0
  208. package/templates/journeys/advanced-example.journey.ts +43 -0
  209. package/templates/journeys/example.journey.ts +18 -0
  210. package/templates/lightweight/heartbeat.yml +9 -0
  211. package/templates/synthetics.config.ts +35 -0
  212. package/CHANGELOG.md +0 -181
  213. package/NOTICE.txt +0 -221
  214. package/dist/parse_args.d.ts.map +0 -1
  215. package/dist/parse_args.js +0 -98
  216. package/dist/parse_args.js.map +0 -1
  217. package/dist/reporters/reporter.d.ts.map +0 -1
  218. package/dist/reporters/reporter.js.map +0 -1
  219. package/dist/tsconfig.tsbuildinfo +0 -1895
  220. package/src/parse_args.ts +0 -146
@@ -0,0 +1,268 @@
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.parseSchedule = exports.parseAlertConfig = exports.buildMonitorFromYaml = exports.createLightweightMonitors = exports.buildMonitorSchema = exports.getLocalMonitors = exports.diffMonitors = void 0;
28
+ const promises_1 = require("fs/promises");
29
+ const path_1 = require("path");
30
+ const yaml_1 = require("yaml");
31
+ const colors_1 = require("kleur/colors");
32
+ const bundler_1 = require("./bundler");
33
+ const helpers_1 = require("../helpers");
34
+ const public_locations_1 = require("../locations/public-locations");
35
+ const monitor_1 = require("../dsl/monitor");
36
+ // Allowed extensions for lightweight monitor files
37
+ const ALLOWED_LW_EXTENSIONS = ['.yml', '.yaml'];
38
+ function translateLocation(locations) {
39
+ if (!locations)
40
+ return [];
41
+ return locations.map(loc => public_locations_1.LocationsMap[loc] || loc).filter(Boolean);
42
+ }
43
+ class RemoteDiffResult {
44
+ // The set of monitor IDs that have been added
45
+ newIDs = new Set();
46
+ // Monitor IDs that are different locally than remotely
47
+ changedIDs = new Set();
48
+ // Monitor IDs that are no longer present locally
49
+ removedIDs = new Set();
50
+ // Monitor IDs that are identical on the remote server
51
+ unchangedIDs = new Set();
52
+ }
53
+ function diffMonitors(local, remote) {
54
+ const result = new RemoteDiffResult();
55
+ const localMonitorsIDToHash = new Map();
56
+ for (const hashID of local) {
57
+ localMonitorsIDToHash.set(hashID.journey_id, hashID.hash);
58
+ }
59
+ const remoteMonitorsIDToHash = new Map();
60
+ for (const hashID of remote) {
61
+ remoteMonitorsIDToHash.set(hashID.journey_id, hashID.hash);
62
+ }
63
+ // Compare local to remote
64
+ for (const [localID, localHash] of localMonitorsIDToHash) {
65
+ // Hash is reset to '' when a monitor is edited on the UI
66
+ if (!remoteMonitorsIDToHash.has(localID)) {
67
+ result.newIDs.add(localID);
68
+ }
69
+ else {
70
+ const remoteHash = remoteMonitorsIDToHash.get(localID);
71
+ if (remoteHash != localHash) {
72
+ result.changedIDs.add(localID);
73
+ }
74
+ else if (remoteHash === localHash) {
75
+ result.unchangedIDs.add(localID);
76
+ }
77
+ }
78
+ // We no longer need to process this ID, removing it here
79
+ // reduces the numbers considered in the next phase
80
+ remoteMonitorsIDToHash.delete(localID);
81
+ }
82
+ for (const [id] of remoteMonitorsIDToHash) {
83
+ result.removedIDs.add(id);
84
+ }
85
+ return result;
86
+ }
87
+ exports.diffMonitors = diffMonitors;
88
+ function getLocalMonitors(monitors) {
89
+ const data = [];
90
+ for (const monitor of monitors) {
91
+ data.push({
92
+ journey_id: monitor.config.id,
93
+ hash: monitor.hash(),
94
+ });
95
+ }
96
+ return data;
97
+ }
98
+ exports.getLocalMonitors = getLocalMonitors;
99
+ async function buildMonitorSchema(monitors, isV2) {
100
+ /**
101
+ * Set up the bundle artifacts path which can be used to
102
+ * create the bundles required for uploading journeys
103
+ */
104
+ const bundlePath = (0, path_1.join)(helpers_1.SYNTHETICS_PATH, 'bundles');
105
+ await (0, promises_1.mkdir)(bundlePath, { recursive: true });
106
+ const bundler = new bundler_1.Bundler();
107
+ const schemas = [];
108
+ for (const monitor of monitors) {
109
+ const { source, config, filter, type } = monitor;
110
+ const schema = {
111
+ ...config,
112
+ locations: translateLocation(config.locations),
113
+ };
114
+ if (isV2) {
115
+ schema.hash = monitor.hash();
116
+ }
117
+ if (type === 'browser') {
118
+ const outPath = (0, path_1.join)(bundlePath, config.name + '.zip');
119
+ const content = await bundler.build(source.file, outPath);
120
+ Object.assign(schema, { content, filter });
121
+ }
122
+ schemas.push(schema);
123
+ }
124
+ await (0, promises_1.rm)(bundlePath, { recursive: true });
125
+ return schemas;
126
+ }
127
+ exports.buildMonitorSchema = buildMonitorSchema;
128
+ async function createLightweightMonitors(workDir, options) {
129
+ const lwFiles = new Set();
130
+ // Filter monitor files based on the provided pattern
131
+ const pattern = options.pattern
132
+ ? new RegExp(options.pattern, 'i')
133
+ : /.(yml|yaml)$/;
134
+ const ignore = /(node_modules|.github)/;
135
+ await (0, helpers_1.totalist)(workDir, (rel, abs) => {
136
+ if (!ignore.test(rel) &&
137
+ pattern.test(rel) &&
138
+ ALLOWED_LW_EXTENSIONS.includes((0, path_1.extname)(abs))) {
139
+ lwFiles.add(abs);
140
+ }
141
+ });
142
+ let warnOnce = false;
143
+ const monitors = [];
144
+ for (const file of lwFiles.values()) {
145
+ const content = await (0, promises_1.readFile)(file, 'utf-8');
146
+ const lineCounter = new yaml_1.LineCounter();
147
+ const parsedDoc = (0, yaml_1.parseDocument)(content, {
148
+ lineCounter,
149
+ keepSourceTokens: true,
150
+ });
151
+ // Skip other yml files that are not relevant
152
+ const monitorSeq = parsedDoc.get('heartbeat.monitors');
153
+ if (!monitorSeq) {
154
+ continue;
155
+ }
156
+ // Warn users about schedule that are less than 60 seconds
157
+ if (!warnOnce) {
158
+ (0, helpers_1.warn)('Lightweight monitor schedules will be adjusted to their nearest frequency supported by our synthetics infrastructure.');
159
+ warnOnce = true;
160
+ }
161
+ for (const monNode of monitorSeq.items) {
162
+ // Skip browser monitors and disabled monitors from pushing
163
+ if (monNode.get('type') === 'browser' ||
164
+ monNode.get('enabled') === false) {
165
+ continue;
166
+ }
167
+ const config = monNode.toJSON();
168
+ // Filter based on matched tags and name
169
+ if (!(0, helpers_1.isMatch)(config.tags, config.name, options.tags, options.match)) {
170
+ continue;
171
+ }
172
+ const { line, col } = lineCounter.linePos(monNode.srcToken.offset);
173
+ try {
174
+ const mon = buildMonitorFromYaml(config, options);
175
+ mon.setSource({ file, line, column: col });
176
+ monitors.push(mon);
177
+ }
178
+ catch (e) {
179
+ let outer = (0, colors_1.bold)(`Aborted: ${e}\n`);
180
+ outer += (0, helpers_1.indent)(`* ${config.id || config.name} - ${file}:${line}:${col}\n`);
181
+ throw (0, colors_1.red)(outer);
182
+ }
183
+ }
184
+ }
185
+ return monitors;
186
+ }
187
+ exports.createLightweightMonitors = createLightweightMonitors;
188
+ const REQUIRED_MONITOR_FIELDS = ['id', 'name'];
189
+ function buildMonitorFromYaml(config, options) {
190
+ // Validate required fields
191
+ for (const field of REQUIRED_MONITOR_FIELDS) {
192
+ if (!config[field]) {
193
+ throw `Monitor ${field} is required`;
194
+ }
195
+ }
196
+ const schedule = config.schedule && parseSchedule(String(config.schedule));
197
+ const privateLocations = config['private_locations'] || options.privateLocations;
198
+ delete config['private_locations'];
199
+ const alertConfig = (0, exports.parseAlertConfig)(config);
200
+ return new monitor_1.Monitor({
201
+ locations: options.locations,
202
+ ...config,
203
+ privateLocations,
204
+ schedule: schedule || options.schedule,
205
+ alert: alertConfig,
206
+ });
207
+ }
208
+ exports.buildMonitorFromYaml = buildMonitorFromYaml;
209
+ const parseAlertConfig = (config) => {
210
+ if (config['alert.status.enabled'] !== undefined) {
211
+ const value = config['alert.status.enabled'];
212
+ delete config['alert.status.enabled'];
213
+ return {
214
+ status: {
215
+ enabled: value,
216
+ },
217
+ };
218
+ }
219
+ return config.alert;
220
+ };
221
+ exports.parseAlertConfig = parseAlertConfig;
222
+ function parseSchedule(schedule) {
223
+ const EVERY_SYNTAX = '@every';
224
+ if (!(schedule + '').startsWith(EVERY_SYNTAX)) {
225
+ throw `Monitor schedule format(${schedule}) not supported: use '@every' syntax instead`;
226
+ }
227
+ const duration = schedule.substring(EVERY_SYNTAX.length + 1);
228
+ // split between non-digit (\D) and a digit (\d)
229
+ const durations = duration.split(/(?<=\D)(?=\d)/g);
230
+ let minutes = 0;
231
+ for (const dur of durations) {
232
+ // split between a digit and non-digit
233
+ const [value, format] = dur.split(/(?<=\d)(?=\D)/g);
234
+ // Calculate based on the duration symbol
235
+ const scheduleValue = parseInt(value, 10);
236
+ switch (format) {
237
+ case 's':
238
+ minutes += Math.round(scheduleValue / 60);
239
+ break;
240
+ case 'm':
241
+ minutes += scheduleValue;
242
+ break;
243
+ case 'h':
244
+ minutes += scheduleValue * 60;
245
+ break;
246
+ case 'd':
247
+ minutes += scheduleValue * 24 * 60;
248
+ break;
249
+ }
250
+ }
251
+ return nearestSchedule(minutes);
252
+ }
253
+ exports.parseSchedule = parseSchedule;
254
+ // Find the nearest schedule that is supported by the platform
255
+ // from the parsed schedule value
256
+ function nearestSchedule(minutes) {
257
+ let nearest = monitor_1.ALLOWED_SCHEDULES[0];
258
+ let prev = Math.abs(nearest - minutes);
259
+ for (let i = 1; i < monitor_1.ALLOWED_SCHEDULES.length; i++) {
260
+ const curr = Math.abs(monitor_1.ALLOWED_SCHEDULES[i] - minutes);
261
+ if (curr <= prev) {
262
+ nearest = monitor_1.ALLOWED_SCHEDULES[i];
263
+ prev = curr;
264
+ }
265
+ }
266
+ return nearest;
267
+ }
268
+ //# sourceMappingURL=monitor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monitor.js","sourceRoot":"","sources":["../../src/push/monitor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,0CAAkD;AAClD,+BAAqC;AACrC,+BAAoE;AACpE,yCAAyC;AACzC,uCAAoC;AACpC,wCAA8E;AAC9E,oEAA6D;AAC7D,4CAA2E;AAG3E,mDAAmD;AACnD,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAgBhD,SAAS,iBAAiB,CAAC,SAAsC;IAC/D,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,CAAC;IAC1B,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,+BAAY,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,gBAAgB;IACpB,8CAA8C;IAC9C,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IAC3B,uDAAuD;IACvD,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,iDAAiD;IACjD,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,sDAAsD;IACtD,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;CAClC;AAED,SAAgB,YAAY,CAC1B,KAAsB,EACtB,MAAuB;IAEvB,MAAM,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;IACtC,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxD,KAAK,MAAM,MAAM,IAAI,KAAK,EAAE;QAC1B,qBAAqB,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;KAC3D;IACD,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzD,KA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AAI,IAAI,IAAI,IAAI,EAAE;YAChB,OAAO,GAAG,2BAAiB,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,GAAG,IAAI,CAAC;SACb;KACF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -22,9 +22,12 @@
22
22
  * THE SOFTWARE.
23
23
  *
24
24
  */
25
- import { CliArgs } from './common_types';
26
- declare const command: import("commander").Command;
27
- declare const options: CliArgs;
28
- export { options };
29
- export default command;
30
- //# sourceMappingURL=parse_args.d.ts.map
25
+ import * as esbuild from 'esbuild';
26
+ /**
27
+ * Esbuild Plugin to create separate bundles for all the journeys.
28
+ * Treats journeys as the entry point and bundles all the dependencies
29
+ * including the node_modules and ignores bundling the synthetics package
30
+ * when imported externally or from source.
31
+ */
32
+ export declare function SyntheticsBundlePlugin(): 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;AAGH,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAenC;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAkBvD"}
@@ -0,0 +1,66 @@
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.SyntheticsBundlePlugin = void 0;
28
+ const path_1 = require("path");
29
+ // Source of the package - /src, /dist, etc.
30
+ const SOURCE_DIR = (0, path_1.join)(__dirname, '..');
31
+ /**
32
+ * Avoid importing @elastic/synthetics package from source, this avoids
33
+ * bundling the synthetics package in tests or when resolved using
34
+ * absolute paths.
35
+ * ex: import {journey} from "../../"
36
+ */
37
+ const isLocalSynthetics = (resolvedPath) => {
38
+ return resolvedPath.startsWith(SOURCE_DIR);
39
+ };
40
+ /**
41
+ * Esbuild Plugin to create separate bundles for all the journeys.
42
+ * Treats journeys as the entry point and bundles all the dependencies
43
+ * including the node_modules and ignores bundling the synthetics package
44
+ * when imported externally or from source.
45
+ */
46
+ function SyntheticsBundlePlugin() {
47
+ return {
48
+ name: 'synthetics-bundle-plugin',
49
+ setup(build) {
50
+ build.onResolve({ filter: /.*?/ }, async (args) => {
51
+ // Ignore entry points as these refer to the journey files
52
+ if (args.kind === 'entry-point') {
53
+ return;
54
+ }
55
+ const resolvedPath = (0, path_1.join)(args.resolveDir, args.path);
56
+ if (isLocalSynthetics(resolvedPath)) {
57
+ return { external: true };
58
+ }
59
+ // Allow esbuild to resolve the module
60
+ return;
61
+ });
62
+ },
63
+ };
64
+ }
65
+ exports.SyntheticsBundlePlugin = SyntheticsBundlePlugin;
66
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/push/plugin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,+BAA4B;AAG5B,4CAA4C;AAC5C,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,CAAC,YAAoB,EAAE,EAAE;IACjD,OAAO,YAAY,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,sBAAsB;IACpC,OAAO;QACL,IAAI,EAAE,0BAA0B;QAChC,KAAK,CAAC,KAAK;YACT,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;gBAC9C,0DAA0D;gBAC1D,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa,EAAE;oBAC/B,OAAO;iBACR;gBACD,MAAM,YAAY,GAAG,IAAA,WAAI,EAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBACtD,IAAI,iBAAiB,CAAC,YAAY,CAAC,EAAE;oBACnC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;iBAC3B;gBACD,sCAAsC;gBACtC,OAAO;YACT,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAlBD,wDAkBC"}
@@ -0,0 +1,45 @@
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 type { Dispatcher } from 'undici';
26
+ export declare type APIRequestOptions = {
27
+ url: string;
28
+ method: Dispatcher.HttpMethod;
29
+ auth: string;
30
+ body?: string;
31
+ };
32
+ export declare function sendRequest(options: APIRequestOptions): Promise<Dispatcher.ResponseData>;
33
+ export declare function sendReqAndHandleError<T>(options: APIRequestOptions): Promise<T>;
34
+ export declare function handleError(statusCode: number, url: string, body: Dispatcher.ResponseData['body']): Promise<Dispatcher.ResponseData['body']>;
35
+ export declare function ok(statusCode: number): boolean;
36
+ export declare type APIMonitorError = {
37
+ id?: string;
38
+ reason: string;
39
+ details: string;
40
+ };
41
+ export declare function formatNotFoundError(url: string, message: string): string;
42
+ export declare function formatAPIError(statuCode: number, error: string, message: string): string;
43
+ export declare function formatFailedMonitors(errors: APIMonitorError[]): string;
44
+ export declare function formatStaleMonitors(errors: APIMonitorError[]): string;
45
+ //# 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;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAOzC,oBAAY,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAsB,WAAW,CAAC,OAAO,EAAE,iBAAiB,oCAY3D;AAED,wBAAsB,qBAAqB,CAAC,CAAC,EAC3C,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,CAAC,CAAC,CAGZ;AAKD,wBAAsB,WAAW,CAC/B,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,GACpC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAkB1C;AAED,wBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,WAEpC;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,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAM/D;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,UAShB;AAcD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,EAAE,UAG7D;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,EAAE,UAG5D"}
@@ -0,0 +1,109 @@
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.formatStaleMonitors = exports.formatFailedMonitors = exports.formatAPIError = exports.formatNotFoundError = exports.ok = exports.handleError = exports.sendReqAndHandleError = exports.sendRequest = void 0;
28
+ const colors_1 = require("kleur/colors");
29
+ const undici_1 = require("undici");
30
+ const helpers_1 = require("../helpers");
31
+ /* eslint-disable @typescript-eslint/no-var-requires */
32
+ const { version } = require('../../package.json');
33
+ async function sendRequest(options) {
34
+ return await (0, undici_1.request)(options.url, {
35
+ method: options.method,
36
+ body: options.body,
37
+ headers: {
38
+ authorization: `ApiKey ${options.auth}`,
39
+ 'content-type': 'application/json',
40
+ 'user-agent': `Elastic/Synthetics ${version}`,
41
+ 'kbn-xsrf': 'true',
42
+ },
43
+ headersTimeout: 60 * 1000,
44
+ });
45
+ }
46
+ exports.sendRequest = sendRequest;
47
+ async function sendReqAndHandleError(options) {
48
+ const { statusCode, body } = await sendRequest(options);
49
+ return await (await handleError(statusCode, options.url, body)).json();
50
+ }
51
+ exports.sendReqAndHandleError = sendReqAndHandleError;
52
+ // Handle bad status code errors from Kibana API and format the
53
+ // error message to be displayed to the user.
54
+ // returns the response stream if no error is found
55
+ async function handleError(statusCode, url, body) {
56
+ if (statusCode === 404) {
57
+ throw formatNotFoundError(url, await body.text());
58
+ }
59
+ else if (!ok(statusCode)) {
60
+ let parsed;
61
+ try {
62
+ parsed = await body.json();
63
+ }
64
+ catch (e) {
65
+ throw formatAPIError(statusCode, 'unexpected non-JSON error', await body.text());
66
+ }
67
+ throw formatAPIError(statusCode, parsed.error, parsed.message);
68
+ }
69
+ return body;
70
+ }
71
+ exports.handleError = handleError;
72
+ function ok(statusCode) {
73
+ return statusCode >= 200 && statusCode <= 299;
74
+ }
75
+ exports.ok = ok;
76
+ function formatNotFoundError(url, message) {
77
+ return (0, colors_1.red)((0, colors_1.bold)(`${helpers_1.symbols['failed']} Please check your kibana url: ${url} and try again - 404:${message}`));
78
+ }
79
+ exports.formatNotFoundError = formatNotFoundError;
80
+ function formatAPIError(statuCode, error, message) {
81
+ let outer = (0, colors_1.bold)(`${helpers_1.symbols['failed']} Error\n`);
82
+ let inner = (0, colors_1.bold)(`${helpers_1.symbols['failed']} monitor creation failed - ${statuCode}:${error}\n`);
83
+ inner += (0, helpers_1.indent)(message, ' ');
84
+ outer += (0, helpers_1.indent)(inner);
85
+ return (0, colors_1.red)(outer);
86
+ }
87
+ exports.formatAPIError = formatAPIError;
88
+ function formatMonitorError(errors) {
89
+ let outer = '';
90
+ for (const error of errors) {
91
+ const monitorId = error.id ? `: monitor(${error.id})` : '';
92
+ let inner = (0, colors_1.bold)(`> ${error.reason}${monitorId}\n`);
93
+ inner += (0, helpers_1.indent)(error.details, ' ');
94
+ outer += (0, helpers_1.indent)(inner) + '\n';
95
+ outer += '\n';
96
+ }
97
+ return outer;
98
+ }
99
+ function formatFailedMonitors(errors) {
100
+ const heading = (0, colors_1.bold)(`${helpers_1.symbols['failed']} Error\n`);
101
+ return (0, colors_1.red)(heading + formatMonitorError(errors));
102
+ }
103
+ exports.formatFailedMonitors = formatFailedMonitors;
104
+ function formatStaleMonitors(errors) {
105
+ const heading = (0, colors_1.bold)(`${helpers_1.symbols['warning']} Warnings\n`);
106
+ return (0, colors_1.yellow)(heading + formatMonitorError(errors));
107
+ }
108
+ exports.formatStaleMonitors = formatStaleMonitors;
109
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/push/request.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,yCAAiD;AAEjD,mCAAiC;AACjC,wCAA6C;AAE7C,uDAAuD;AACvD,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAS3C,KAAK,UAAU,WAAW,CAAC,OAA0B;IAC1D,OAAO,MAAM,IAAA,gBAAO,EAAC,OAAO,CAAC,GAAG,EAAE;QAChC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,OAAO,CAAC,IAAI,EAAE;YACvC,cAAc,EAAE,kBAAkB;YAClC,YAAY,EAAE,sBAAsB,OAAO,EAAE;YAC7C,UAAU,EAAE,MAAM;SACnB;QACD,cAAc,EAAE,EAAE,GAAG,IAAI;KAC1B,CAAC,CAAC;AACL,CAAC;AAZD,kCAYC;AAEM,KAAK,UAAU,qBAAqB,CACzC,OAA0B;IAE1B,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;IACxD,OAAO,MAAM,CAAC,MAAM,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACzE,CAAC;AALD,sDAKC;AAED,+DAA+D;AAC/D,6CAA6C;AAC7C,mDAAmD;AAC5C,KAAK,U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+ * 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 { PushOptions } from '../common_types';
26
+ export declare function logDiff<T extends Set<string>>(newIDs: T, changedIDs: T, removedIDs: T, unchangedIDs: T): void;
27
+ export declare function getChunks(arr: any[], size: number): any[];
28
+ declare type Operation = 'status' | 'bulk_get' | 'bulk_update' | 'bulk_delete' | 'legacy' | 'location';
29
+ export declare function generateURL(options: PushOptions, operation: Operation): string;
30
+ export {};
31
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/push/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,wBAAgB,OAAO,CAAC,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,EAC3C,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,CAAC,EACb,UAAU,EAAE,CAAC,EACb,YAAY,EAAE,CAAC,QAShB;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,SAMjD;AAED,aAAK,SAAS,GACV,QAAQ,GACR,UAAU,GACV,aAAa,GACb,aAAa,GACb,QAAQ,GACR,UAAU,CAAC;AAEf,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,UAgBrE"}
@@ -0,0 +1,64 @@
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.generateURL = exports.getChunks = exports.logDiff = void 0;
28
+ const helpers_1 = require("../helpers");
29
+ const colors_1 = require("kleur/colors");
30
+ function logDiff(newIDs, changedIDs, removedIDs, unchangedIDs) {
31
+ (0, helpers_1.progress)('Monitor Diff: ' +
32
+ (0, colors_1.green)(`Added(${newIDs.size}) `) +
33
+ (0, colors_1.yellow)(`Updated(${changedIDs.size}) `) +
34
+ (0, colors_1.red)(`Removed(${removedIDs.size}) `) +
35
+ (0, colors_1.grey)(`Unchanged(${unchangedIDs.size})`));
36
+ }
37
+ exports.logDiff = logDiff;
38
+ function getChunks(arr, size) {
39
+ const chunks = [];
40
+ for (let i = 0; i < arr.length; i += size) {
41
+ chunks.push(arr.slice(i, i + size));
42
+ }
43
+ return chunks;
44
+ }
45
+ exports.getChunks = getChunks;
46
+ function generateURL(options, operation) {
47
+ const url = (0, helpers_1.removeTrailingSlash)(options.url);
48
+ switch (operation) {
49
+ case 'status':
50
+ return `${url}/s/${options.space}/api/status`;
51
+ case 'bulk_get':
52
+ case 'bulk_update':
53
+ case 'bulk_delete':
54
+ return `${url}/s/${options.space}/api/synthetics/project/${options.id}/monitors`;
55
+ case 'legacy':
56
+ return `${url}/s/${options.space}/api/synthetics/service/project/monitors`;
57
+ case 'location':
58
+ return `${url}/internal/uptime/service/locations`;
59
+ default:
60
+ throw new Error('Invalid operation');
61
+ }
62
+ }
63
+ exports.generateURL = generateURL;
64
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/push/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,wCAA2D;AAC3D,yCAAwD;AAGxD,SAAgB,OAAO,CACrB,MAAS,EACT,UAAa,EACb,UAAa,EACb,YAAe;IAEf,IAAA,kBAAQ,EACN,gBAAgB;QACd,IAAA,cAAK,EAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC;QAC/B,IAAA,eAAM,EAAC,WAAW,UAAU,CAAC,IAAI,IAAI,CAAC;QACtC,IAAA,YAAG,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