@elastic/synthetics 1.13.0 → 1.15.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 (94) hide show
  1. package/dist/cli.js +4 -3
  2. package/dist/cli.js.map +1 -1
  3. package/dist/common_types.d.ts +9 -16
  4. package/dist/common_types.d.ts.map +1 -1
  5. package/dist/core/gatherer.d.ts +3 -1
  6. package/dist/core/gatherer.d.ts.map +1 -1
  7. package/dist/core/gatherer.js +42 -35
  8. package/dist/core/gatherer.js.map +1 -1
  9. package/dist/core/globals.d.ts +27 -0
  10. package/dist/core/globals.d.ts.map +1 -0
  11. package/dist/core/globals.js +41 -0
  12. package/dist/core/globals.js.map +1 -0
  13. package/dist/core/index.d.ts +0 -2
  14. package/dist/core/index.d.ts.map +1 -1
  15. package/dist/core/index.js +13 -25
  16. package/dist/core/index.js.map +1 -1
  17. package/dist/core/mfa.d.ts +61 -0
  18. package/dist/core/mfa.d.ts.map +1 -0
  19. package/dist/core/mfa.js +33 -0
  20. package/dist/core/mfa.js.map +1 -0
  21. package/dist/core/runner.d.ts +30 -39
  22. package/dist/core/runner.d.ts.map +1 -1
  23. package/dist/core/runner.js +174 -179
  24. package/dist/core/runner.js.map +1 -1
  25. package/dist/dsl/journey.d.ts +24 -16
  26. package/dist/dsl/journey.d.ts.map +1 -1
  27. package/dist/dsl/journey.js +28 -15
  28. package/dist/dsl/journey.js.map +1 -1
  29. package/dist/dsl/monitor.d.ts +1 -0
  30. package/dist/dsl/monitor.d.ts.map +1 -1
  31. package/dist/dsl/monitor.js.map +1 -1
  32. package/dist/dsl/step.d.ts +12 -6
  33. package/dist/dsl/step.d.ts.map +1 -1
  34. package/dist/dsl/step.js +11 -3
  35. package/dist/dsl/step.js.map +1 -1
  36. package/dist/helpers.d.ts +1 -0
  37. package/dist/helpers.d.ts.map +1 -1
  38. package/dist/helpers.js +1 -0
  39. package/dist/helpers.js.map +1 -1
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +35 -11
  43. package/dist/index.js.map +1 -1
  44. package/dist/loader.d.ts.map +1 -1
  45. package/dist/loader.js +26 -1
  46. package/dist/loader.js.map +1 -1
  47. package/dist/options.d.ts +1 -0
  48. package/dist/options.d.ts.map +1 -1
  49. package/dist/options.js +18 -0
  50. package/dist/options.js.map +1 -1
  51. package/dist/push/index.d.ts.map +1 -1
  52. package/dist/push/index.js +1 -1
  53. package/dist/push/index.js.map +1 -1
  54. package/dist/push/monitor.d.ts +1 -0
  55. package/dist/push/monitor.d.ts.map +1 -1
  56. package/dist/push/monitor.js +18 -1
  57. package/dist/push/monitor.js.map +1 -1
  58. package/dist/reporters/base.d.ts +3 -3
  59. package/dist/reporters/base.d.ts.map +1 -1
  60. package/dist/reporters/base.js +6 -6
  61. package/dist/reporters/base.js.map +1 -1
  62. package/dist/reporters/build_kite_cli.d.ts +2 -4
  63. package/dist/reporters/build_kite_cli.d.ts.map +1 -1
  64. package/dist/reporters/build_kite_cli.js +8 -10
  65. package/dist/reporters/build_kite_cli.js.map +1 -1
  66. package/dist/reporters/json.d.ts +4 -9
  67. package/dist/reporters/json.d.ts.map +1 -1
  68. package/dist/reporters/json.js +31 -40
  69. package/dist/reporters/json.js.map +1 -1
  70. package/dist/reporters/junit.d.ts +2 -2
  71. package/dist/reporters/junit.d.ts.map +1 -1
  72. package/dist/reporters/junit.js +7 -7
  73. package/dist/reporters/junit.js.map +1 -1
  74. package/package.json +5 -4
  75. package/src/cli.ts +4 -2
  76. package/src/common_types.ts +9 -16
  77. package/src/core/gatherer.ts +44 -37
  78. package/src/core/globals.ts +37 -0
  79. package/src/core/index.ts +12 -25
  80. package/src/core/mfa.ts +65 -0
  81. package/src/core/runner.ts +201 -202
  82. package/src/dsl/journey.ts +42 -23
  83. package/src/dsl/monitor.ts +1 -0
  84. package/src/dsl/step.ts +16 -7
  85. package/src/helpers.ts +4 -3
  86. package/src/index.ts +3 -2
  87. package/src/loader.ts +3 -0
  88. package/src/options.ts +22 -0
  89. package/src/push/index.ts +3 -4
  90. package/src/push/monitor.ts +20 -0
  91. package/src/reporters/base.ts +8 -12
  92. package/src/reporters/build_kite_cli.ts +13 -18
  93. package/src/reporters/json.ts +35 -52
  94. package/src/reporters/junit.ts +8 -10
@@ -0,0 +1,33 @@
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.totp = void 0;
28
+ const otpauth_1 = require("otpauth");
29
+ function totp(secret, options = {}) {
30
+ return new otpauth_1.TOTP({ label: "SyntheticsTOTP", secret, ...options }).generate();
31
+ }
32
+ exports.totp = totp;
33
+ //# sourceMappingURL=mfa.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mfa.js","sourceRoot":"","sources":["../../src/core/mfa.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,qCAA+B;AAqC/B,SAAgB,IAAI,CAAC,MAAe,EAAE,UAAuB,EAAE;IAC7D,OAAO,IAAI,cAAI,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC9E,CAAC;AAFD,oBAEC"}
@@ -23,51 +23,42 @@
23
23
  *
24
24
  */
25
25
  import { Journey } from '../dsl/journey';
26
- import { Step } from '../dsl/step';
27
- import { HooksCallback, Params, HooksArgs, Driver, RunOptions, JourneyResult, StepResult, PushOptions } from '../common_types';
28
- import { PluginManager } from '../plugins';
26
+ import { HooksCallback, RunOptions, JourneyResult, PushOptions } from '../common_types';
29
27
  import { Monitor, MonitorConfig } from '../dsl/monitor';
30
28
  type HookType = 'beforeAll' | 'afterAll';
31
29
  export type SuiteHooks = Record<HookType, Array<HooksCallback>>;
32
- type JourneyContext = {
33
- params?: Params;
34
- browserDelay: number;
35
- start: number;
36
- driver: Driver;
37
- pluginManager: PluginManager;
38
- };
39
30
  type RunResult = Record<string, JourneyResult>;
40
- export default class Runner {
41
- #private;
42
- journeys: Journey[];
43
- hooks: SuiteHooks;
44
- hookError: Error | undefined;
45
- monitor?: Monitor;
46
- static screenshotPath: string;
47
- static createContext(options: RunOptions): Promise<JourneyContext>;
48
- captureScreenshot(page: Driver['page'], step: Step): Promise<void>;
49
- get currentJourney(): Journey;
50
- addHook(type: HookType, callback: HooksCallback): void;
51
- updateMonitor(config: MonitorConfig): void;
52
- addJourney(journey: Journey): void;
53
- setReporter(options: RunOptions): void;
54
- runBeforeAllHook(args: HooksArgs): Promise<void>;
55
- runAfterAllHook(args: HooksArgs): Promise<void>;
56
- runBeforeHook(journey: Journey, args: HooksArgs): Promise<void>;
57
- runAfterHook(journey: Journey, args: HooksArgs): Promise<void>;
58
- runStep(step: Step, context: JourneyContext, options: RunOptions): Promise<StepResult>;
59
- runSteps(journey: Journey, context: JourneyContext, options: RunOptions): Promise<StepResult[]>;
60
- registerJourney(journey: Journey, context: JourneyContext): void;
61
- endJourney(journey: any, result: JourneyContext & JourneyResult, options: RunOptions): Promise<void>;
31
+ export interface RunnerInfo {
32
+ /**
33
+ * Processed configuration from the CLI args and the config file
34
+ */
35
+ readonly config: RunOptions;
62
36
  /**
63
- * Simulate a journey run to capture errors in the beforeAll hook
37
+ * Currently active journey
64
38
  */
65
- runFakeJourney(journey: Journey, options: RunOptions): Promise<JourneyResult>;
66
- runJourney(journey: Journey, options: RunOptions): Promise<JourneyResult>;
67
- init(options: RunOptions): Promise<void>;
68
- buildMonitors(options: PushOptions): Monitor[];
69
- run(options: RunOptions): Promise<RunResult>;
70
- reset(): Promise<void>;
39
+ readonly journey: Journey | undefined;
40
+ /**
41
+ * All registerd journeys
42
+ */
43
+ readonly journeys: Journey[];
44
+ }
45
+ export default class Runner implements RunnerInfo {
46
+ #private;
47
+ config: RunOptions;
48
+ get journey(): Journey;
49
+ get journeys(): Journey[];
50
+ get hooks(): SuiteHooks;
51
+ private captureScreenshot;
52
+ _addHook(type: HookType, callback: HooksCallback): void;
53
+ private buildHookArgs;
54
+ _updateMonitor(config: MonitorConfig): void;
55
+ _addJourney(journey: Journey): void;
56
+ private setReporter;
57
+ _runJourney(journey: Journey, options: RunOptions): Promise<JourneyResult>;
58
+ _buildMonitors(options: PushOptions): Monitor[];
59
+ _run(options: RunOptions): Promise<RunResult>;
60
+ _runJourneys(options: RunOptions): Promise<RunResult>;
61
+ _reset(): Promise<void>;
71
62
  }
72
63
  export {};
73
64
  //# sourceMappingURL=runner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/core/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,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