bdy 1.26.3-stage → 1.26.5-beta

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 (35) hide show
  1. package/distTs/package.json +4 -3
  2. package/distTs/src/api/client.js +40 -0
  3. package/distTs/src/cliIndex.js +2 -0
  4. package/distTs/src/command/login.js +1 -0
  5. package/distTs/src/command/ruleset/create.js +32 -0
  6. package/distTs/src/command/ruleset/delete.js +33 -0
  7. package/distTs/src/command/ruleset/get.js +67 -0
  8. package/distTs/src/command/ruleset/list.js +46 -0
  9. package/distTs/src/command/ruleset/ruleset.js +58 -0
  10. package/distTs/src/command/ruleset/update.js +35 -0
  11. package/distTs/src/command/ruleset.js +20 -0
  12. package/distTs/src/command/yaml/actions/info.js +8 -3
  13. package/distTs/src/command/yaml/actions/list.js +10 -11
  14. package/distTs/src/command/yaml/actions/schema.js +1 -0
  15. package/distTs/src/command/yaml/agent.js +13 -0
  16. package/distTs/src/command/yaml/customAction.js +13 -0
  17. package/distTs/src/command/yaml/distro.js +13 -0
  18. package/distTs/src/command/yaml/documentType.js +64 -0
  19. package/distTs/src/command/yaml/domain.js +13 -0
  20. package/distTs/src/command/yaml/environment.js +14 -0
  21. package/distTs/src/command/yaml/pipeline.js +49 -2
  22. package/distTs/src/command/yaml/render.js +30 -11
  23. package/distTs/src/command/yaml/rooted.js +48 -0
  24. package/distTs/src/command/yaml/sandbox.js +13 -0
  25. package/distTs/src/command/yaml/schemaUtils.js +45 -100
  26. package/distTs/src/command/yaml/targets/info.js +84 -0
  27. package/distTs/src/command/yaml/targets/list.js +60 -0
  28. package/distTs/src/command/yaml/targets/schema.js +29 -0
  29. package/distTs/src/command/yaml/targets.js +15 -0
  30. package/distTs/src/command/yaml/validate.js +238 -287
  31. package/distTs/src/command/yaml.js +22 -0
  32. package/distTs/src/output.js +43 -0
  33. package/distTs/src/texts.js +293 -49
  34. package/distTs/src/utils.js +2 -0
  35. package/package.json +4 -3
@@ -459,6 +459,49 @@ class Output {
459
459
  const table = [...Object.entries(data)];
460
460
  this.table(table, false);
461
461
  }
462
+ static wrappedTable(data, { wrapColumn = data[0].length - 1, fixedWidths = {}, max = this.MAX_WRAP, } = {}) {
463
+ const columns = (process.stdout.isTTY && process.stdout.columns) || Infinity;
464
+ const capped = data.map((cells, row) => row === 0 ? cells : cells.map((cell, i) => (fixedWidths[i] ? this.wrapped(cell, fixedWidths[i]) : cell)));
465
+ let taken = 0;
466
+ for (let i = 0; i < data[0].length; i += 1) {
467
+ if (i === wrapColumn)
468
+ continue;
469
+ taken += Math.max(...capped.flatMap((cells) => cells[i].split('\n').map((line) => line.length))) + 1;
470
+ }
471
+ const width = Math.min(max, Math.max(this.MIN_WRAP, columns - taken - 1));
472
+ this.table(capped.map((cells, row) => row === 0 ? cells : cells.map((cell, i) => (i === wrapColumn ? this.wrapped(cell, width) : cell))));
473
+ }
474
+ static MIN_WRAP = 30;
475
+ static MAX_WRAP = 100;
476
+ static wrapped(text, width) {
477
+ return text
478
+ .split('\n')
479
+ .map((line) => this.wrappedLine(line, width))
480
+ .join('\n');
481
+ }
482
+ static wrappedLine(text, width) {
483
+ const lines = [];
484
+ let line = '';
485
+ for (let word of text.split(/\s+/).filter(Boolean)) {
486
+ while (word.length > width) {
487
+ if (line)
488
+ lines.push(line);
489
+ const head = word.slice(0, width);
490
+ const cut = (head.match(/^.*[,:;/.{[(<]/) ?? head.match(/^.*[^A-Za-z0-9_-]/))?.[0].length ?? width;
491
+ lines.push(word.slice(0, cut));
492
+ word = word.slice(cut);
493
+ line = '';
494
+ }
495
+ if (line && line.length + 1 + word.length > width) {
496
+ lines.push(line);
497
+ line = '';
498
+ }
499
+ line = line ? `${line} ${word}` : word;
500
+ }
501
+ if (line)
502
+ lines.push(line);
503
+ return lines.join('\n');
504
+ }
462
505
  static table(data, firstRowBlue = true) {
463
506
  // apply padding
464
507
  for (let i = 0; i < data.length; i += 1) {