@grafana/k6-test-builder 0.8.15 → 0.8.16

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/dist/index.js CHANGED
@@ -216,7 +216,7 @@ const $924f96bd0d5c630d$export$cc0ae9a5c96bcd6f = ()=>/*#__PURE__*/ (0, $gkIgo$r
216
216
  const $1c4cc247633c6592$var$LOGGER_ENABLE_KEY = '__test_builder_logger_enabled__';
217
217
  const $1c4cc247633c6592$var$K6_VERBOSE_LOGS = '_k6_verbose_logs_';
218
218
  function $1c4cc247633c6592$var$isEnabled() {
219
- return true;
219
+ return process.env.TARGET !== 'prod' || sessionStorage.getItem($1c4cc247633c6592$var$LOGGER_ENABLE_KEY);
220
220
  }
221
221
  function $1c4cc247633c6592$var$isVerboseEnabled() {
222
222
  return !!sessionStorage.getItem($1c4cc247633c6592$var$K6_VERBOSE_LOGS) || !!sessionStorage.getItem($1c4cc247633c6592$var$LOGGER_ENABLE_KEY);
@@ -2531,16 +2531,16 @@ function $bd3480c18d26920e$var$_toPrimitive(t, r) {
2531
2531
  return ("string" === r ? String : Number)(t);
2532
2532
  }
2533
2533
  class $bd3480c18d26920e$export$4e14bd654b94b4e9 {
2534
- /**
2535
- * Decides if this instance is serialized as undefined or not
2536
- * @private
2537
- */ constructor(postData, headers){
2534
+ constructor(postData, headers){
2538
2535
  $bd3480c18d26920e$var$_defineProperty(this, "mimeType", 'text/plain');
2539
2536
  $bd3480c18d26920e$var$_defineProperty(this, "comment", '');
2540
2537
  $bd3480c18d26920e$var$_defineProperty(this, "text", void 0);
2541
2538
  $bd3480c18d26920e$var$_defineProperty(this, "params", void 0);
2542
2539
  $bd3480c18d26920e$var$_defineProperty(this, "decoded", void 0);
2543
- $bd3480c18d26920e$var$_defineProperty(this, "isUndefined", false);
2540
+ /**
2541
+ * Decides if this instance is serialized as undefined or not
2542
+ * @private
2543
+ */ $bd3480c18d26920e$var$_defineProperty(this, "isUndefined", false);
2544
2544
  if (!postData || !headers || !postData.type) throw new TypeError('PostDataNode could not be created. Invalid arguments.');
2545
2545
  switch(postData.type){
2546
2546
  case 'text':
@@ -4186,11 +4186,11 @@ class $09bbc5e14b02adac$export$3fb97e8df001f5f7 extends SyntaxError {
4186
4186
  }
4187
4187
  }
4188
4188
  class $09bbc5e14b02adac$export$dbf96015a8a67c16 {
4189
- // @ts-ignore
4190
4189
  constructor(id, scenarios, loadZones, thresholds, apm = []){
4191
4190
  $09bbc5e14b02adac$var$_defineProperty(this, $09bbc5e14b02adac$var$ID, null);
4192
4191
  $09bbc5e14b02adac$var$_defineProperty(this, $09bbc5e14b02adac$var$ARCHIVES, []);
4193
4192
  $09bbc5e14b02adac$var$_defineProperty(this, $09bbc5e14b02adac$var$SCRIPTS, []);
4193
+ // @ts-ignore
4194
4194
  $09bbc5e14b02adac$var$_defineProperty(this, $09bbc5e14b02adac$var$BASE_OPTIONS, void 0);
4195
4195
  this.id = id;
4196
4196
  this.baseOptions = $09bbc5e14b02adac$export$dbf96015a8a67c16.createLogOptions(loadZones, thresholds, apm);
@@ -15691,19 +15691,19 @@ const $723b70ee4d7f62e8$export$1ae172e61ce3735b = /*#__PURE__*/ (0, $gkIgo$react
15691
15691
 
15692
15692
 
15693
15693
 
15694
+ const $4e99116d1d1b712a$var$VUH_THRESHOLD = 100;
15694
15695
  const $4e99116d1d1b712a$export$f4f5234705b8ee7d = ({ vuh_breakdown: vuh_breakdown, vuh_usage: vuh_usage = 0 })=>{
15695
15696
  const { base_total_vuh: base_total_vuh = 0, reduction_rate: reduction_rate = 0 } = vuh_breakdown;
15696
15697
  const original = (0, $4bac6ee95b8c8b72$export$24567f54a9be5ab9)(base_total_vuh);
15697
15698
  const reduced = (0, $4bac6ee95b8c8b72$export$24567f54a9be5ab9)(vuh_usage);
15698
- const discount = (0, $4bac6ee95b8c8b72$export$c37640da124effef)(reduction_rate !== null && reduction_rate !== void 0 ? reduction_rate : 0);
15699
- const reductionText = discount > 0 ? `; however, you were billed ${reduced} VUh due to a ${discount}% discount applied based on the size of the test.` : '. This test run was not eligible for any discounts.';
15699
+ const percentage = reduction_rate !== null && reduction_rate !== void 0 ? reduction_rate : 0;
15700
+ const costText = $4e99116d1d1b712a$export$f1b66467ef7e1dfd(original);
15701
+ const reductionText = $4e99116d1d1b712a$export$753b48ee12fd002c(reduced, percentage);
15700
15702
  return /*#__PURE__*/ (0, $gkIgo$reactjsxruntime.jsxs)($4e99116d1d1b712a$var$Container, {
15701
15703
  children: [
15702
15704
  /*#__PURE__*/ (0, $gkIgo$reactjsxruntime.jsxs)("span", {
15703
15705
  children: [
15704
- "Your test utilized ",
15705
- original,
15706
- " Virtual User Hours (VUh)",
15706
+ costText,
15707
15707
  reductionText
15708
15708
  ]
15709
15709
  }),
@@ -15714,6 +15714,12 @@ const $4e99116d1d1b712a$export$f4f5234705b8ee7d = ({ vuh_breakdown: vuh_breakdow
15714
15714
  ]
15715
15715
  });
15716
15716
  };
15717
+ const $4e99116d1d1b712a$export$f1b66467ef7e1dfd = (value)=>{
15718
+ return `Your test is estimated to consume ${value} Virtual User Hours (VUh)`;
15719
+ };
15720
+ const $4e99116d1d1b712a$export$753b48ee12fd002c = (value = 0, percentage = 0)=>{
15721
+ return percentage > 0 ? `, but you will only be charged for ${value} VUh. Tests consuming more than ${$4e99116d1d1b712a$var$VUH_THRESHOLD} VUh receive volume reductions based on test size.` : `. Tests consuming less than ${$4e99116d1d1b712a$var$VUH_THRESHOLD} Vuh are not eligible for volume reductions.`;
15722
+ };
15717
15723
  const $4e99116d1d1b712a$var$Container = /*#__PURE__*/ (0, ($parcel$interopDefault($gkIgo$styledcomponents))).div.withConfig({
15718
15724
  displayName: "VUhTooltipContent__Container",
15719
15725
  componentId: "sc-1lz5zhl-0"
package/dist/module.js CHANGED
@@ -192,7 +192,7 @@ const $a80b21e889559c22$export$cc0ae9a5c96bcd6f = ()=>/*#__PURE__*/ (0, $b7VBt$j
192
192
  const $77857f570335d7ae$var$LOGGER_ENABLE_KEY = '__test_builder_logger_enabled__';
193
193
  const $77857f570335d7ae$var$K6_VERBOSE_LOGS = '_k6_verbose_logs_';
194
194
  function $77857f570335d7ae$var$isEnabled() {
195
- return true;
195
+ return process.env.TARGET !== 'prod' || sessionStorage.getItem($77857f570335d7ae$var$LOGGER_ENABLE_KEY);
196
196
  }
197
197
  function $77857f570335d7ae$var$isVerboseEnabled() {
198
198
  return !!sessionStorage.getItem($77857f570335d7ae$var$K6_VERBOSE_LOGS) || !!sessionStorage.getItem($77857f570335d7ae$var$LOGGER_ENABLE_KEY);
@@ -2507,16 +2507,16 @@ function $f4684ac194011611$var$_toPrimitive(t, r) {
2507
2507
  return ("string" === r ? String : Number)(t);
2508
2508
  }
2509
2509
  class $f4684ac194011611$export$4e14bd654b94b4e9 {
2510
- /**
2511
- * Decides if this instance is serialized as undefined or not
2512
- * @private
2513
- */ constructor(postData, headers){
2510
+ constructor(postData, headers){
2514
2511
  $f4684ac194011611$var$_defineProperty(this, "mimeType", 'text/plain');
2515
2512
  $f4684ac194011611$var$_defineProperty(this, "comment", '');
2516
2513
  $f4684ac194011611$var$_defineProperty(this, "text", void 0);
2517
2514
  $f4684ac194011611$var$_defineProperty(this, "params", void 0);
2518
2515
  $f4684ac194011611$var$_defineProperty(this, "decoded", void 0);
2519
- $f4684ac194011611$var$_defineProperty(this, "isUndefined", false);
2516
+ /**
2517
+ * Decides if this instance is serialized as undefined or not
2518
+ * @private
2519
+ */ $f4684ac194011611$var$_defineProperty(this, "isUndefined", false);
2520
2520
  if (!postData || !headers || !postData.type) throw new TypeError('PostDataNode could not be created. Invalid arguments.');
2521
2521
  switch(postData.type){
2522
2522
  case 'text':
@@ -4162,11 +4162,11 @@ class $d875af20a6533bde$export$3fb97e8df001f5f7 extends SyntaxError {
4162
4162
  }
4163
4163
  }
4164
4164
  class $d875af20a6533bde$export$dbf96015a8a67c16 {
4165
- // @ts-ignore
4166
4165
  constructor(id, scenarios, loadZones, thresholds, apm = []){
4167
4166
  $d875af20a6533bde$var$_defineProperty(this, $d875af20a6533bde$var$ID, null);
4168
4167
  $d875af20a6533bde$var$_defineProperty(this, $d875af20a6533bde$var$ARCHIVES, []);
4169
4168
  $d875af20a6533bde$var$_defineProperty(this, $d875af20a6533bde$var$SCRIPTS, []);
4169
+ // @ts-ignore
4170
4170
  $d875af20a6533bde$var$_defineProperty(this, $d875af20a6533bde$var$BASE_OPTIONS, void 0);
4171
4171
  this.id = id;
4172
4172
  this.baseOptions = $d875af20a6533bde$export$dbf96015a8a67c16.createLogOptions(loadZones, thresholds, apm);
@@ -15667,19 +15667,19 @@ const $f90e6ac18264291c$export$1ae172e61ce3735b = /*#__PURE__*/ (0, $b7VBt$forwa
15667
15667
 
15668
15668
 
15669
15669
 
15670
+ const $7c10312fad43a1ee$var$VUH_THRESHOLD = 100;
15670
15671
  const $7c10312fad43a1ee$export$f4f5234705b8ee7d = ({ vuh_breakdown: vuh_breakdown, vuh_usage: vuh_usage = 0 })=>{
15671
15672
  const { base_total_vuh: base_total_vuh = 0, reduction_rate: reduction_rate = 0 } = vuh_breakdown;
15672
15673
  const original = (0, $f54872b9dc7588c3$export$24567f54a9be5ab9)(base_total_vuh);
15673
15674
  const reduced = (0, $f54872b9dc7588c3$export$24567f54a9be5ab9)(vuh_usage);
15674
- const discount = (0, $f54872b9dc7588c3$export$c37640da124effef)(reduction_rate !== null && reduction_rate !== void 0 ? reduction_rate : 0);
15675
- const reductionText = discount > 0 ? `; however, you were billed ${reduced} VUh due to a ${discount}% discount applied based on the size of the test.` : '. This test run was not eligible for any discounts.';
15675
+ const percentage = reduction_rate !== null && reduction_rate !== void 0 ? reduction_rate : 0;
15676
+ const costText = $7c10312fad43a1ee$export$f1b66467ef7e1dfd(original);
15677
+ const reductionText = $7c10312fad43a1ee$export$753b48ee12fd002c(reduced, percentage);
15676
15678
  return /*#__PURE__*/ (0, $b7VBt$jsxs)($7c10312fad43a1ee$var$Container, {
15677
15679
  children: [
15678
15680
  /*#__PURE__*/ (0, $b7VBt$jsxs)("span", {
15679
15681
  children: [
15680
- "Your test utilized ",
15681
- original,
15682
- " Virtual User Hours (VUh)",
15682
+ costText,
15683
15683
  reductionText
15684
15684
  ]
15685
15685
  }),
@@ -15690,6 +15690,12 @@ const $7c10312fad43a1ee$export$f4f5234705b8ee7d = ({ vuh_breakdown: vuh_breakdow
15690
15690
  ]
15691
15691
  });
15692
15692
  };
15693
+ const $7c10312fad43a1ee$export$f1b66467ef7e1dfd = (value)=>{
15694
+ return `Your test is estimated to consume ${value} Virtual User Hours (VUh)`;
15695
+ };
15696
+ const $7c10312fad43a1ee$export$753b48ee12fd002c = (value = 0, percentage = 0)=>{
15697
+ return percentage > 0 ? `, but you will only be charged for ${value} VUh. Tests consuming more than ${$7c10312fad43a1ee$var$VUH_THRESHOLD} VUh receive volume reductions based on test size.` : `. Tests consuming less than ${$7c10312fad43a1ee$var$VUH_THRESHOLD} Vuh are not eligible for volume reductions.`;
15698
+ };
15693
15699
  const $7c10312fad43a1ee$var$Container = /*#__PURE__*/ (0, $b7VBt$styledcomponents).div.withConfig({
15694
15700
  displayName: "VUhTooltipContent__Container",
15695
15701
  componentId: "sc-1lz5zhl-0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/k6-test-builder",
3
- "version": "0.8.15",
3
+ "version": "0.8.16",
4
4
  "license": "AGPL-3.0",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/module.js",