@tradejs/cli 1.0.6 → 1.0.9

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.
@@ -502,19 +502,21 @@ var require_supports_color = __commonJS({
502
502
  var tty = require("tty");
503
503
  var hasFlag = require_has_flag();
504
504
  var { env } = process;
505
- var forceColor;
505
+ var flagForceColor;
506
506
  if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
507
- forceColor = 0;
507
+ flagForceColor = 0;
508
508
  } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
509
- forceColor = 1;
509
+ flagForceColor = 1;
510
510
  }
511
- if ("FORCE_COLOR" in env) {
512
- if (env.FORCE_COLOR === "true") {
513
- forceColor = 1;
514
- } else if (env.FORCE_COLOR === "false") {
515
- forceColor = 0;
516
- } else {
517
- forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
511
+ function envForceColor() {
512
+ if ("FORCE_COLOR" in env) {
513
+ if (env.FORCE_COLOR === "true") {
514
+ return 1;
515
+ }
516
+ if (env.FORCE_COLOR === "false") {
517
+ return 0;
518
+ }
519
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
518
520
  }
519
521
  }
520
522
  function translateLevel(level) {
@@ -528,15 +530,22 @@ var require_supports_color = __commonJS({
528
530
  has16m: level >= 3
529
531
  };
530
532
  }
531
- function supportsColor(haveStream, streamIsTTY) {
533
+ function supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
534
+ const noFlagForceColor = envForceColor();
535
+ if (noFlagForceColor !== void 0) {
536
+ flagForceColor = noFlagForceColor;
537
+ }
538
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
532
539
  if (forceColor === 0) {
533
540
  return 0;
534
541
  }
535
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
536
- return 3;
537
- }
538
- if (hasFlag("color=256")) {
539
- return 2;
542
+ if (sniffFlags) {
543
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
544
+ return 3;
545
+ }
546
+ if (hasFlag("color=256")) {
547
+ return 2;
548
+ }
540
549
  }
541
550
  if (haveStream && !streamIsTTY && forceColor === void 0) {
542
551
  return 0;
@@ -553,7 +562,7 @@ var require_supports_color = __commonJS({
553
562
  return 1;
554
563
  }
555
564
  if ("CI" in env) {
556
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
565
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
557
566
  return 1;
558
567
  }
559
568
  return min;
@@ -565,7 +574,7 @@ var require_supports_color = __commonJS({
565
574
  return 3;
566
575
  }
567
576
  if ("TERM_PROGRAM" in env) {
568
- const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
577
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
569
578
  switch (env.TERM_PROGRAM) {
570
579
  case "iTerm.app":
571
580
  return version >= 3 ? 3 : 2;
@@ -584,14 +593,17 @@ var require_supports_color = __commonJS({
584
593
  }
585
594
  return min;
586
595
  }
587
- function getSupportLevel(stream) {
588
- const level = supportsColor(stream, stream && stream.isTTY);
596
+ function getSupportLevel(stream, options = {}) {
597
+ const level = supportsColor(stream, {
598
+ streamIsTTY: stream && stream.isTTY,
599
+ ...options
600
+ });
589
601
  return translateLevel(level);
590
602
  }
591
603
  module2.exports = {
592
604
  supportsColor: getSupportLevel,
593
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
594
- stderr: translateLevel(supportsColor(true, tty.isatty(2)))
605
+ stdout: getSupportLevel({ isTTY: tty.isatty(1) }),
606
+ stderr: getSupportLevel({ isTTY: tty.isatty(2) })
595
607
  };
596
608
  }
597
609
  });
@@ -1664,6 +1676,18 @@ var toStrategyResults = (rows) => Object.fromEntries(
1664
1676
  [...rows].map((row) => [row.symbol, toStrategyResultEntry(row)])
1665
1677
  );
1666
1678
  var getTestConfigs = async (userName) => {
1679
+ const testSummariesKey = typeof import_redis.redisKeys.testSummaries === "function" ? import_redis.redisKeys.testSummaries(userName) : null;
1680
+ const indexedItems = testSummariesKey ? await (0, import_redis.getData)(testSummariesKey, null) : null;
1681
+ if (Array.isArray(indexedItems) && indexedItems.length) {
1682
+ return indexedItems.map((item) => {
1683
+ const testName = typeof item?.value === "string" ? item.value : null;
1684
+ const strategyName = typeof item?.data?.strategyName === "string" ? item.data.strategyName : null;
1685
+ if (!testName || !strategyName) {
1686
+ return null;
1687
+ }
1688
+ return { strategyName, testName };
1689
+ }).filter(Boolean);
1690
+ }
1667
1691
  const testsPrefix = import_redis.redisKeys.tests(userName);
1668
1692
  const keys = await (0, import_redis.getKeys)(testsPrefix);
1669
1693
  const configKeys = keys.filter((key) => key.endsWith(":config"));