bkper 4.31.3 → 5.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 (118) hide show
  1. package/README.md +12 -5
  2. package/lib/cli.js +3 -3
  3. package/lib/cli.js.map +1 -1
  4. package/lib/commands/accounts/batch-create.d.ts +1 -1
  5. package/lib/commands/accounts/batch-create.d.ts.map +1 -1
  6. package/lib/commands/accounts/batch-create.js +3 -3
  7. package/lib/commands/accounts/batch-create.js.map +1 -1
  8. package/lib/commands/accounts/list.d.ts +2 -3
  9. package/lib/commands/accounts/list.d.ts.map +1 -1
  10. package/lib/commands/accounts/list.js +2 -12
  11. package/lib/commands/accounts/list.js.map +1 -1
  12. package/lib/commands/accounts/register.js +13 -13
  13. package/lib/commands/accounts/register.js.map +1 -1
  14. package/lib/commands/action.d.ts +2 -3
  15. package/lib/commands/action.d.ts.map +1 -1
  16. package/lib/commands/action.js +2 -3
  17. package/lib/commands/action.js.map +1 -1
  18. package/lib/commands/apps/list.d.ts +2 -3
  19. package/lib/commands/apps/list.d.ts.map +1 -1
  20. package/lib/commands/apps/list.js +2 -14
  21. package/lib/commands/apps/list.js.map +1 -1
  22. package/lib/commands/apps/register.js +10 -10
  23. package/lib/commands/apps/register.js.map +1 -1
  24. package/lib/commands/balances/list.d.ts +0 -2
  25. package/lib/commands/balances/list.d.ts.map +1 -1
  26. package/lib/commands/balances/list.js +9 -17
  27. package/lib/commands/balances/list.js.map +1 -1
  28. package/lib/commands/balances/register.d.ts.map +1 -1
  29. package/lib/commands/balances/register.js +3 -4
  30. package/lib/commands/balances/register.js.map +1 -1
  31. package/lib/commands/books/list.d.ts +2 -4
  32. package/lib/commands/books/list.d.ts.map +1 -1
  33. package/lib/commands/books/list.js +2 -30
  34. package/lib/commands/books/list.js.map +1 -1
  35. package/lib/commands/books/register.js +12 -12
  36. package/lib/commands/books/register.js.map +1 -1
  37. package/lib/commands/cli-helpers.d.ts +9 -4
  38. package/lib/commands/cli-helpers.d.ts.map +1 -1
  39. package/lib/commands/cli-helpers.js +18 -12
  40. package/lib/commands/cli-helpers.js.map +1 -1
  41. package/lib/commands/collections/list.d.ts +2 -3
  42. package/lib/commands/collections/list.d.ts.map +1 -1
  43. package/lib/commands/collections/list.js +2 -14
  44. package/lib/commands/collections/list.js.map +1 -1
  45. package/lib/commands/collections/register.d.ts.map +1 -1
  46. package/lib/commands/collections/register.js +15 -25
  47. package/lib/commands/collections/register.js.map +1 -1
  48. package/lib/commands/events/event-json.d.ts +13 -0
  49. package/lib/commands/events/event-json.d.ts.map +1 -0
  50. package/lib/commands/events/event-json.js +33 -0
  51. package/lib/commands/events/event-json.js.map +1 -0
  52. package/lib/commands/events/list.d.ts +4 -3
  53. package/lib/commands/events/list.d.ts.map +1 -1
  54. package/lib/commands/events/list.js +15 -66
  55. package/lib/commands/events/list.js.map +1 -1
  56. package/lib/commands/events/register.d.ts.map +1 -1
  57. package/lib/commands/events/register.js +7 -6
  58. package/lib/commands/events/register.js.map +1 -1
  59. package/lib/commands/files/list.d.ts +3 -2
  60. package/lib/commands/files/list.d.ts.map +1 -1
  61. package/lib/commands/files/list.js +13 -42
  62. package/lib/commands/files/list.js.map +1 -1
  63. package/lib/commands/files/register.d.ts.map +1 -1
  64. package/lib/commands/files/register.js +13 -10
  65. package/lib/commands/files/register.js.map +1 -1
  66. package/lib/commands/groups/list.d.ts +2 -3
  67. package/lib/commands/groups/list.d.ts.map +1 -1
  68. package/lib/commands/groups/list.js +2 -12
  69. package/lib/commands/groups/list.js.map +1 -1
  70. package/lib/commands/groups/register.js +12 -12
  71. package/lib/commands/groups/register.js.map +1 -1
  72. package/lib/commands/transactions/batch-create.d.ts +1 -1
  73. package/lib/commands/transactions/batch-create.d.ts.map +1 -1
  74. package/lib/commands/transactions/batch-create.js +4 -3
  75. package/lib/commands/transactions/batch-create.js.map +1 -1
  76. package/lib/commands/transactions/batch-update.d.ts +1 -1
  77. package/lib/commands/transactions/batch-update.d.ts.map +1 -1
  78. package/lib/commands/transactions/batch-update.js +4 -3
  79. package/lib/commands/transactions/batch-update.js.map +1 -1
  80. package/lib/commands/transactions/list.d.ts +4 -7
  81. package/lib/commands/transactions/list.d.ts.map +1 -1
  82. package/lib/commands/transactions/list.js +15 -32
  83. package/lib/commands/transactions/list.js.map +1 -1
  84. package/lib/commands/transactions/register.d.ts +1 -1
  85. package/lib/commands/transactions/register.d.ts.map +1 -1
  86. package/lib/commands/transactions/register.js +27 -26
  87. package/lib/commands/transactions/register.js.map +1 -1
  88. package/lib/commands/transactions/transaction-json.d.ts +23 -0
  89. package/lib/commands/transactions/transaction-json.d.ts.map +1 -0
  90. package/lib/commands/transactions/transaction-json.js +56 -0
  91. package/lib/commands/transactions/transaction-json.js.map +1 -0
  92. package/lib/docs/apps/ai.md +2 -2
  93. package/lib/docs/cli/app-management.md +0 -1
  94. package/lib/docs/cli/data-management.md +56 -54
  95. package/lib/docs/index.md +1 -1
  96. package/lib/docs-compliance/live-readme.d.ts.map +1 -1
  97. package/lib/docs-compliance/live-readme.js +0 -3
  98. package/lib/docs-compliance/live-readme.js.map +1 -1
  99. package/lib/docs-compliance/rules.d.ts.map +1 -1
  100. package/lib/docs-compliance/rules.js +9 -0
  101. package/lib/docs-compliance/rules.js.map +1 -1
  102. package/lib/render/index.d.ts +2 -4
  103. package/lib/render/index.d.ts.map +1 -1
  104. package/lib/render/index.js +1 -3
  105. package/lib/render/index.js.map +1 -1
  106. package/lib/render/output.d.ts +42 -22
  107. package/lib/render/output.d.ts.map +1 -1
  108. package/lib/render/output.js +62 -42
  109. package/lib/render/output.js.map +1 -1
  110. package/package.json +1 -1
  111. package/lib/render/csv-formatter.d.ts +0 -15
  112. package/lib/render/csv-formatter.d.ts.map +0 -1
  113. package/lib/render/csv-formatter.js +0 -37
  114. package/lib/render/csv-formatter.js.map +0 -1
  115. package/lib/render/table-formatter.d.ts +0 -34
  116. package/lib/render/table-formatter.d.ts.map +0 -1
  117. package/lib/render/table-formatter.js +0 -239
  118. package/lib/render/table-formatter.js.map +0 -1
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { withAction } from '../action.js';
11
- import { renderTable } from '../../render/index.js';
11
+ import { renderMatrix } from '../../render/index.js';
12
12
  import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
13
13
  import { listBalancesMatrix } from './index.js';
14
14
  export function registerBalanceCommands(program) {
@@ -20,7 +20,7 @@ export function registerBalanceCommands(program) {
20
20
  .option('-q, --query <query>', 'Balances query')
21
21
  .option('--expanded <level>', 'Expand groups to specified depth (0+)', parseInt)
22
22
  .option('--trial', 'Split total balances into debit and credit columns')
23
- .action(options => withAction('listing balances', (format) => __awaiter(this, void 0, void 0, function* () {
23
+ .action(options => withAction('listing balances', () => __awaiter(this, void 0, void 0, function* () {
24
24
  throwIfErrors(validateRequiredOptions(options, [
25
25
  { name: 'book', flag: '--book' },
26
26
  { name: 'query', flag: '--query' },
@@ -28,10 +28,9 @@ export function registerBalanceCommands(program) {
28
28
  const matrix = yield listBalancesMatrix(options.book, {
29
29
  query: options.query,
30
30
  expanded: options.expanded,
31
- format,
32
31
  trial: options.trial,
33
32
  });
34
- renderTable(matrix, format);
33
+ renderMatrix(matrix);
35
34
  }))());
36
35
  }
37
36
  //# sourceMappingURL=register.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/balances/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACpD,MAAM,cAAc,GAAG,OAAO,CAAC,OA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AU,uBAAuB,CAAC,OAAgB;IACpD,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAEjF,cAAc;SACT,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,eAAe,CAAC;SAC5B,MAAM,CAAC,qBAAqB,EAAE,SAAS,CAAC;SACxC,MAAM,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;SAC/C,MAAM,CAAC,oBAAoB,EAAE,uCAAuC,EAAE,QAAQ,CAAC;SAC/E,MAAM,CAAC,SAAS,EAAE,oDAAoD,CAAC;SACvE,MAAM,CAAC,OAAO,CAAC,EAAE,CACd,UAAU,CAAC,kBAAkB,EAAE,GAAS,EAAE;QACtC,aAAa,CACT,uBAAuB,CAAC,OAAO,EAAE;YAC7B,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;YAChC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;SACrC,CAAC,CACL,CAAC;QACF,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,IAAI,EAAE;YAClD,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;SACvB,CAAC,CAAC;QACH,YAAY,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;AACV,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Book } from 'bkper-js';
2
- import type { OutputFormat, ListResult } from '../../render/output.js';
2
+ import type { ListResult } from '../../render/output.js';
3
3
  /**
4
4
  * Lists books matching an optional query string.
5
5
  *
@@ -9,8 +9,6 @@ import type { OutputFormat, ListResult } from '../../render/output.js';
9
9
  export declare function listBooks(query?: string): Promise<Book[]>;
10
10
  /**
11
11
  * Lists books and returns a ListResult ready for rendering.
12
- * Absorbs sorting, BooksDataTableBuilder config, and JSON mapping
13
- * so cli.ts doesn't need to know about any of this.
14
12
  */
15
- export declare function listBooksFormatted(query: string | undefined, format: OutputFormat): Promise<ListResult>;
13
+ export declare function listBooksFormatted(query: string | undefined): Promise<ListResult>;
16
14
  //# sourceMappingURL=list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/books/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAyB,MAAM,UAAU,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEvE;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAG/D;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACpC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,EAAE,YAAY,GACrB,OAAO,CAAC,UAAU,CAAC,CA6BrB"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/books/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAG/D;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAGvF"}
@@ -8,7 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { getBkperInstance } from '../../bkper-factory.js';
11
- import { BooksDataTableBuilder } from 'bkper-js';
12
11
  /**
13
12
  * Lists books matching an optional query string.
14
13
  *
@@ -23,38 +22,11 @@ export function listBooks(query) {
23
22
  }
24
23
  /**
25
24
  * Lists books and returns a ListResult ready for rendering.
26
- * Absorbs sorting, BooksDataTableBuilder config, and JSON mapping
27
- * so cli.ts doesn't need to know about any of this.
28
25
  */
29
- export function listBooksFormatted(query, format) {
26
+ export function listBooksFormatted(query) {
30
27
  return __awaiter(this, void 0, void 0, function* () {
31
28
  const books = yield listBooks(query);
32
- if (format === 'json') {
33
- return { kind: 'json', items: books.map(b => b.json()) };
34
- }
35
- if (books.length === 0) {
36
- return { kind: 'matrix', matrix: [['No results found.']] };
37
- }
38
- books.sort((a, b) => {
39
- var _a, _b;
40
- const collA = (_a = a.getCollection()) === null || _a === void 0 ? void 0 : _a.getName();
41
- const collB = (_b = b.getCollection()) === null || _b === void 0 ? void 0 : _b.getName();
42
- if (collA && !collB)
43
- return -1;
44
- if (!collA && collB)
45
- return 1;
46
- let ret = (collA || '').localeCompare(collB || '');
47
- if (ret === 0) {
48
- ret = (a.getName() || '').localeCompare(b.getName() || '');
49
- }
50
- return ret;
51
- });
52
- const builder = new BooksDataTableBuilder(books).ids(true);
53
- if (format === 'csv') {
54
- builder.properties(true).hiddenProperties(true);
55
- }
56
- const matrix = builder.build();
57
- return { kind: 'matrix', matrix };
29
+ return { items: books.map(b => b.json()) };
58
30
  });
59
31
  }
60
32
  //# sourceMappingURL=list.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/books/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAQ,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGvD;;;;;GAKG;AACH,MAAM,UAAgB,SAAS,CAAC,KAAc;;QAC1C,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;CAAA;AAED;;;;G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CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3D,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YACnB,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACpD,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;QAC/B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACtC,CAAC;CAAA"}
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/books/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D;;;;;GAKG;AACH,MAAM,UAAgB,SAAS,CAAC,KAAc;;QAC1C,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,UAAgB,kBAAkB,CAAC,KAAyB;;QAC9D,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;IAC/C,CAAC;CAAA"}
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { withAction } from '../action.js';
11
11
  import { collectProperty } from '../cli-helpers.js';
12
- import { renderListResult, renderItem } from '../../render/index.js';
12
+ import { renderList, renderItem } from '../../render/index.js';
13
13
  import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
14
14
  import { listBooksFormatted, getBook, createBook, copyBook, updateBook } from './index.js';
15
15
  export function registerBookCommands(program) {
@@ -18,16 +18,16 @@ export function registerBookCommands(program) {
18
18
  .command('list')
19
19
  .description('List all books')
20
20
  .option('-q, --query <query>', 'Search query')
21
- .action(options => withAction('listing books', (format) => __awaiter(this, void 0, void 0, function* () {
22
- const result = yield listBooksFormatted(options.query, format);
23
- renderListResult(result, format);
21
+ .action(options => withAction('listing books', () => __awaiter(this, void 0, void 0, function* () {
22
+ const result = yield listBooksFormatted(options.query);
23
+ renderList(result);
24
24
  }))());
25
25
  bookCommand
26
26
  .command('get <bookId>')
27
27
  .description('Get a book by ID')
28
- .action((bookId) => withAction('getting book', (format) => __awaiter(this, void 0, void 0, function* () {
28
+ .action((bookId) => withAction('getting book', () => __awaiter(this, void 0, void 0, function* () {
29
29
  const book = yield getBook(bookId);
30
- renderItem(book.json(), format);
30
+ renderItem(book.json());
31
31
  }))());
32
32
  bookCommand
33
33
  .command('create')
@@ -39,7 +39,7 @@ export function registerBookCommands(program) {
39
39
  .option('--time-zone <timezone>', 'IANA time zone (e.g. America/New_York, UTC)')
40
40
  .option('--period <period>', 'Period (MONTH, QUARTER, or YEAR)')
41
41
  .option('-p, --property <key=value>', 'Set a property (repeatable)', collectProperty)
42
- .action(options => withAction('creating book', (format) => __awaiter(this, void 0, void 0, function* () {
42
+ .action(options => withAction('creating book', () => __awaiter(this, void 0, void 0, function* () {
43
43
  throwIfErrors(validateRequiredOptions(options, [{ name: 'name', flag: '--name' }]));
44
44
  const book = yield createBook({
45
45
  name: options.name,
@@ -50,7 +50,7 @@ export function registerBookCommands(program) {
50
50
  period: options.period,
51
51
  property: options.property,
52
52
  });
53
- renderItem(book.json(), format);
53
+ renderItem(book.json());
54
54
  }))());
55
55
  bookCommand
56
56
  .command('copy <bookId>')
@@ -58,14 +58,14 @@ export function registerBookCommands(program) {
58
58
  .option('--name <name>', 'Name for the copied book')
59
59
  .option('--transactions', 'Copy transactions (source book owner only)')
60
60
  .option('--from-date <date>', 'Copy transactions from this date (YYYY-MM-DD)')
61
- .action((bookId, options) => withAction('copying book', (format) => __awaiter(this, void 0, void 0, function* () {
61
+ .action((bookId, options) => withAction('copying book', () => __awaiter(this, void 0, void 0, function* () {
62
62
  throwIfErrors(validateRequiredOptions(options, [{ name: 'name', flag: '--name' }]));
63
63
  const book = yield copyBook(bookId, {
64
64
  name: options.name,
65
65
  transactions: options.transactions,
66
66
  fromDate: options.fromDate,
67
67
  });
68
- renderItem(book.json(), format);
68
+ renderItem(book.json());
69
69
  }))());
70
70
  bookCommand
71
71
  .command('update <bookId>')
@@ -79,7 +79,7 @@ export function registerBookCommands(program) {
79
79
  .option('--closing-date <date>', 'Closing date in ISO format (yyyy-MM-dd)')
80
80
  .option('--period <period>', 'Period (MONTH, QUARTER, or YEAR)')
81
81
  .option('-p, --property <key=value>', 'Set a property (repeatable, empty value deletes)', collectProperty)
82
- .action((bookId, options) => withAction('updating book', (format) => __awaiter(this, void 0, void 0, function* () {
82
+ .action((bookId, options) => withAction('updating book', () => __awaiter(this, void 0, void 0, function* () {
83
83
  const book = yield updateBook(bookId, {
84
84
  name: options.name,
85
85
  fractionDigits: options.fractionDigits,
@@ -91,7 +91,7 @@ export function registerBookCommands(program) {
91
91
  period: options.period,
92
92
  property: options.property,
93
93
  });
94
- renderItem(book.json(), format);
94
+ renderItem(book.json());
95
95
  }))());
96
96
  }
97
97
  //# sourceMappingURL=register.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/books/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE3F,MAAM,UAAU,oBAAoB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AAe,EAAE,GAAS,EAAE;QACnC,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE;YAClC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,cAAc,EAAE,OAAO,CAAC,cAAc;YACtC,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC7B,CAAC,CAAC;QACH,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5B,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;AACV,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { OutputFormat } from '../render/output.js';
1
+ import { type Command } from 'commander';
2
2
  /**
3
3
  * Commander option collector for repeatable scalar flags.
4
4
  */
@@ -16,8 +16,13 @@ export declare function collectBook(value: string, previous: string[] | undefine
16
16
  */
17
17
  export declare function parsePositiveInteger(value: string): number;
18
18
  /**
19
- * Returns the active output format, considering both --format and --json flags.
20
- * --json acts as a silent alias for --format json.
19
+ * Commander parser for the legacy --format flag. Output is JSON only, so only
20
+ * `json` is accepted; other formats fail with guidance to reshape via jq.
21
21
  */
22
- export declare function getFormat(): OutputFormat;
22
+ export declare function parseOutputFormat(value: string): 'json';
23
+ /**
24
+ * Registers the legacy global output flags as hidden options.
25
+ * `--json` and `--format json` are accepted no-ops kept for compatibility.
26
+ */
27
+ export declare function registerOutputOptions(command: Command): void;
23
28
  //# sourceMappingURL=cli-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-helpers.d.ts","sourceRoot":"","sources":["../../src/commands/cli-helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM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OAAO,EAAE,OAAO,GAAG,IAAI,CAO5D"}
@@ -1,4 +1,5 @@
1
- import { program } from 'commander';
1
+ import { InvalidArgumentError, Option } from 'commander';
2
+ const JSON_ONLY_MESSAGE = "Output is JSON only. Reshape with jq, e.g. jq -r '.items[] | [.date, .amount] | @csv'";
2
3
  /**
3
4
  * Commander option collector for repeatable scalar flags.
4
5
  */
@@ -28,18 +29,23 @@ export function parsePositiveInteger(value) {
28
29
  return parsed;
29
30
  }
30
31
  /**
31
- * Returns the active output format, considering both --format and --json flags.
32
- * --json acts as a silent alias for --format json.
32
+ * Commander parser for the legacy --format flag. Output is JSON only, so only
33
+ * `json` is accepted; other formats fail with guidance to reshape via jq.
33
34
  */
34
- export function getFormat() {
35
- const opts = program.opts();
36
- if (opts.json === true) {
37
- return 'json';
35
+ export function parseOutputFormat(value) {
36
+ if (value === 'json') {
37
+ return value;
38
38
  }
39
- const format = opts.format;
40
- if (format === 'json' || format === 'csv') {
41
- return format;
42
- }
43
- return 'table';
39
+ throw new InvalidArgumentError(JSON_ONLY_MESSAGE);
40
+ }
41
+ /**
42
+ * Registers the legacy global output flags as hidden options.
43
+ * `--json` and `--format json` are accepted no-ops kept for compatibility.
44
+ */
45
+ export function registerOutputOptions(command) {
46
+ command.addOption(new Option('--format <format>', 'Output format (JSON only)')
47
+ .argParser(parseOutputFormat)
48
+ .hideHelp());
49
+ command.addOption(new Option('--json', 'Output as JSON (default)').hideHelp());
44
50
  }
45
51
  //# sourceMappingURL=cli-helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-helpers.js","sourceRoot":"","sources":["../../src/commands/cli-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,QAA8B;IAC3E,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC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at, ListResult } from '../../render/output.js';
2
+ import type { ListResult } from '../../render/output.js';
3
3
  /**
4
4
  * Fetches all collections for the authenticated user.
5
5
  *
@@ -8,7 +8,6 @@ import type { OutputFormat, ListResult } from '../../render/output.js';
8
8
  export declare function listCollections(): Promise<Collection[]>;
9
9
  /**
10
10
  * Lists collections and returns a ListResult ready for rendering.
11
- * Absorbs manual matrix building and JSON mapping.
12
11
  */
13
- export declare function listCollectionsFormatted(format: OutputFormat): Promise<ListResult>;
12
+ export declare function listCollectionsFormatted(): Promise<ListResult>;
14
13
  //# sourceMappingURL=list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEvE;;;;GAIG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAI7D;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAiBxF"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;GAIG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAI7D;AAED;;GAEG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,UAAU,CAAC,CAGpE"}
@@ -22,23 +22,11 @@ export function listCollections() {
22
22
  }
23
23
  /**
24
24
  * Lists collections and returns a ListResult ready for rendering.
25
- * Absorbs manual matrix building and JSON mapping.
26
25
  */
27
- export function listCollectionsFormatted(format) {
26
+ export function listCollectionsFormatted() {
28
27
  return __awaiter(this, void 0, void 0, function* () {
29
28
  const collections = yield listCollections();
30
- if (format === 'json') {
31
- return { kind: 'json', items: collections.map(c => c.json()) };
32
- }
33
- if (collections.length === 0) {
34
- return { kind: 'matrix', matrix: [['No collections found.']] };
35
- }
36
- const matrix = [['ID', 'Name', 'Books']];
37
- for (const col of collections) {
38
- const books = col.getBooks();
39
- matrix.push([col.getId() || '', col.getName() || '', books.length.toString()]);
40
- }
41
- return { kind: 'matrix', matrix };
29
+ return { items: collections.map(c => c.json()) };
42
30
  });
43
31
  }
44
32
  //# sourceMappingURL=list.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/collections/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D;;;;GAIG;AACH,MAAM,UAAgB,eAAe;;QACjC,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC;QACjD,OAAO,WAAW,CAAC;IACvB,CAAC;CAAA;AAED;;;GAGG;AACH,MAAM,UAAgB,wBAAwB,CAAC,MAAoB;;QAC/D,MAAM,WAAW,GAAG,MAAM,eAAe,EAAE,CAAC;QAE5C,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACpB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QACnE,CAAC;QAED,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,uBAAuB,CAAC,CAAC,EAAE,CAAC;QACnE,CAAC;QAED,MAAM,MAAM,GAAgB,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QACtD,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;YAC5B,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;YAC7B,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QACnF,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACtC,CAAC;CAAA"}
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/collections/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D;;;;GAIG;AACH,MAAM,UAAgB,eAAe;;QACjC,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC;QACjD,OAAO,WAAW,CAAC;IACvB,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,UAAgB,wBAAwB;;QAC1C,MAAM,WAAW,GAAG,MAAM,eAAe,EAAE,CAAC;QAC5C,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;IACrD,CAAC;CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyGjE"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/collections/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiFjE"}
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { withAction } from '../action.js';
11
11
  import { collectBook } from '../cli-helpers.js';
12
- import { renderListResult, renderItem } from '../../render/index.js';
12
+ import { renderList, renderItem, renderNotice } from '../../render/index.js';
13
13
  import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
14
14
  import { listCollectionsFormatted, getCollection, createCollection, updateCollection, deleteCollection, addBookToCollection, removeBookFromCollection, } from './index.js';
15
15
  export function registerCollectionCommands(program) {
@@ -17,70 +17,60 @@ export function registerCollectionCommands(program) {
17
17
  collectionCommand
18
18
  .command('list')
19
19
  .description('List all collections')
20
- .action(withAction('listing collections', (format) => __awaiter(this, void 0, void 0, function* () {
21
- const result = yield listCollectionsFormatted(format);
22
- renderListResult(result, format);
20
+ .action(withAction('listing collections', () => __awaiter(this, void 0, void 0, function* () {
21
+ const result = yield listCollectionsFormatted();
22
+ renderList(result);
23
23
  })));
24
24
  collectionCommand
25
25
  .command('get <collectionId>')
26
26
  .description('Get a collection by ID')
27
- .action((collectionId) => withAction('getting collection', (format) => __awaiter(this, void 0, void 0, function* () {
27
+ .action((collectionId) => withAction('getting collection', () => __awaiter(this, void 0, void 0, function* () {
28
28
  const collection = yield getCollection(collectionId);
29
- renderItem(collection.json(), format);
29
+ renderItem(collection.json());
30
30
  }))());
31
31
  collectionCommand
32
32
  .command('create')
33
33
  .description('Create a new collection')
34
34
  .option('--name <name>', 'Collection name')
35
- .action(options => withAction('creating collection', (format) => __awaiter(this, void 0, void 0, function* () {
35
+ .action(options => withAction('creating collection', () => __awaiter(this, void 0, void 0, function* () {
36
36
  throwIfErrors(validateRequiredOptions(options, [{ name: 'name', flag: '--name' }]));
37
37
  const collection = yield createCollection({ name: options.name });
38
- renderItem(collection.json(), format);
38
+ renderItem(collection.json());
39
39
  }))());
40
40
  collectionCommand
41
41
  .command('update <collectionId>')
42
42
  .description('Update a collection')
43
43
  .option('--name <name>', 'Collection name')
44
- .action((collectionId, options) => withAction('updating collection', (format) => __awaiter(this, void 0, void 0, function* () {
44
+ .action((collectionId, options) => withAction('updating collection', () => __awaiter(this, void 0, void 0, function* () {
45
45
  const collection = yield updateCollection(collectionId, {
46
46
  name: options.name,
47
47
  });
48
- renderItem(collection.json(), format);
48
+ renderItem(collection.json());
49
49
  }))());
50
50
  collectionCommand
51
51
  .command('delete <collectionId>')
52
52
  .description('Delete a collection')
53
53
  .action((collectionId) => withAction('deleting collection', () => __awaiter(this, void 0, void 0, function* () {
54
54
  yield deleteCollection(collectionId);
55
- console.log(`Collection ${collectionId} deleted.`);
55
+ renderNotice(`Collection ${collectionId} deleted.`);
56
56
  }))());
57
57
  collectionCommand
58
58
  .command('add-book <collectionId>')
59
59
  .description('Add books to a collection')
60
60
  .option('-b, --book <bookId>', 'Book ID (repeatable)', collectBook)
61
- .action((collectionId, options) => withAction('adding books to collection', (format) => __awaiter(this, void 0, void 0, function* () {
61
+ .action((collectionId, options) => withAction('adding books to collection', () => __awaiter(this, void 0, void 0, function* () {
62
62
  throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
63
63
  const books = yield addBookToCollection(collectionId, options.book);
64
- if (format === 'json' || format === 'csv') {
65
- console.log(JSON.stringify(books.map(b => b.json()), null, 2));
66
- }
67
- else {
68
- console.log(`Added ${options.book.length} book(s) to collection ${collectionId}.`);
69
- }
64
+ renderList({ items: books.map(b => b.json()) });
70
65
  }))());
71
66
  collectionCommand
72
67
  .command('remove-book <collectionId>')
73
68
  .description('Remove books from a collection')
74
69
  .option('-b, --book <bookId>', 'Book ID (repeatable)', collectBook)
75
- .action((collectionId, options) => withAction('removing books from collection', (format) => __awaiter(this, void 0, void 0, function* () {
70
+ .action((collectionId, options) => withAction('removing books from collection', () => __awaiter(this, void 0, void 0, function* () {
76
71
  throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
77
72
  const books = yield removeBookFromCollection(collectionId, options.book);
78
- if (format === 'json' || format === 'csv') {
79
- console.log(JSON.stringify(books.map(b => b.json()), null, 2));
80
- }
81
- else {
82
- console.log(`Removed ${options.book.length} book(s) from collection ${collectionId}.`);
83
- }
73
+ renderList({ items: books.map(b => b.json()) });
84
74
  }))());
85
75
  }
86
76
  //# sourceMappingURL=register.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/collections/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EACH,wBAAwB,EACxB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,GAC3B,MAAM,YAAY,CAAC;AAEpB,MAAM,UAAU,0BAA0B,CAAC,OAAgB;IACvD,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;IAE1F,iBAAiB;SACZ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,sBAAsB,CAAC;SACnC,MAAM,CACH,UAAU,CAAC,qBAAqB,EAAE,CAAM,MAAM,EAAC,EAAE;QAC7C,MAAM,MAAM,GAAG,MAAM,wBAAwB,CAAC,MAAM,CAAC,CAAC;QACtD,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC,CAAA,CAAC,CACL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AAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QACpF,MAAM,KAAK,GAAG,MAAM,mBAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACpE,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;IAEN,iBAAiB;SACZ,OAAO,CAAC,4BAA4B,CAAC;SACrC,WAAW,CAAC,gCAAgC,CAAC;SAC7C,MAAM,CAAC,qBAAqB,EAAE,sBAAsB,EAAE,WAAW,CAAC;SAClE,MAAM,CAAC,CAAC,YAAoB,EAAE,OAAO,EAAE,EAAE,CACtC,UAAU,CAAC,gCAAgC,EAAE,GAAS,EAAE;QACpD,aAAa,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QACpF,MAAM,KAAK,GAAG,MAAM,wBAAwB,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACzE,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;AACV,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Serializes an event for CLI output.
3
+ *
4
+ * Keeps the full event payload (including botResponses for debugging) and drops
5
+ * agent logos, which are image payloads rather than information:
6
+ * - `agent.logo` / `agent.logoDark` (the agent is identified by `agent.id`/`name`)
7
+ * - `agentLogo` / `agentLogoDark` on the embedded `data.object.transaction`
8
+ *
9
+ * @param event - The event payload
10
+ * @returns A new payload object; the input is not mutated
11
+ */
12
+ export declare function eventToJson(event: bkper.Event): bkper.Event;
13
+ //# sourceMappingURL=event-json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-json.d.ts","sourceRoot":"","sources":["../../../src/commands/events/event-json.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAsB3D"}
@@ -0,0 +1,33 @@
1
+ function isRecord(value) {
2
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
3
+ }
4
+ /**
5
+ * Serializes an event for CLI output.
6
+ *
7
+ * Keeps the full event payload (including botResponses for debugging) and drops
8
+ * agent logos, which are image payloads rather than information:
9
+ * - `agent.logo` / `agent.logoDark` (the agent is identified by `agent.id`/`name`)
10
+ * - `agentLogo` / `agentLogoDark` on the embedded `data.object.transaction`
11
+ *
12
+ * @param event - The event payload
13
+ * @returns A new payload object; the input is not mutated
14
+ */
15
+ export function eventToJson(event) {
16
+ var _a, _b, _c;
17
+ const json = Object.assign({}, event);
18
+ if (json.agent) {
19
+ const agent = Object.assign({}, json.agent);
20
+ delete agent.logo;
21
+ delete agent.logoDark;
22
+ json.agent = agent;
23
+ }
24
+ const transaction = (_b = (_a = json.data) === null || _a === void 0 ? void 0 : _a.object) === null || _b === void 0 ? void 0 : _b.transaction;
25
+ if (((_c = json.data) === null || _c === void 0 ? void 0 : _c.object) && isRecord(transaction)) {
26
+ const cleanTransaction = Object.assign({}, transaction);
27
+ delete cleanTransaction.agentLogo;
28
+ delete cleanTransaction.agentLogoDark;
29
+ json.data = Object.assign(Object.assign({}, json.data), { object: Object.assign(Object.assign({}, json.data.object), { transaction: cleanTransaction }) });
30
+ }
31
+ return json;
32
+ }
33
+ //# sourceMappingURL=event-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-json.js","sourceRoot":"","sources":["../../../src/commands/events/event-json.ts"],"names":[],"mappings":"AAAA,SAAS,QAAQ,CAAC,KAAc;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChF,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAAC,KAAkB;;IAC1C,MAAM,IAAI,qBAAqB,KAAK,CAAE,CAAC;IAEvC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,KAAK,qBAAqB,IAAI,CAAC,KAAK,CAAE,CAAC;QAC7C,OAAO,KAAK,CAAC,IAAI,CAAC;QAClB,OAAO,KAAK,CAAC,QAAQ,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,MAAM,WAAW,GAAY,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,MAAM,0CAAE,WAAW,CAAC;IAC5D,IAAI,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,MAAM,KAAI,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7C,MAAM,gBAAgB,qBAAiC,WAAW,CAAE,CAAC;QACrE,OAAO,gBAAgB,CAAC,SAAS,CAAC;QAClC,OAAO,gBAAgB,CAAC,aAAa,CAAC;QACtC,IAAI,CAAC,IAAI,mCACF,IAAI,CAAC,IAAI,KACZ,MAAM,kCAAO,IAAI,CAAC,IAAI,CAAC,MAAM,KAAE,WAAW,EAAE,gBAAgB,MAC/D,CAAC;IACN,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Event, EventType } from 'bkper-js';
2
- import type { OutputFormat, ListResult } from '../../render/output.js';
2
+ import type { ListResult } from '../../render/output.js';
3
3
  export declare const DEFAULT_EVENT_LIST_LIMIT = 50;
4
4
  /**
5
5
  * Options for listing events from a book.
@@ -30,7 +30,8 @@ export interface ListBookEventsResult {
30
30
  export declare function listEvents(bookId: string, options?: ListBookEventsOptions): Promise<ListBookEventsResult>;
31
31
  /**
32
32
  * Lists events and returns a ListResult ready for rendering.
33
- * JSON includes full event payloads with botResponses for LLM debugging.
33
+ * Includes full event payloads with botResponses for LLM debugging,
34
+ * without agent logo images.
34
35
  */
35
- export declare function listEventsFormatted(bookId: string, options: ListBookEventsOptions, format: OutputFormat): Promise<ListResult>;
36
+ export declare function listEventsFormatted(bookId: string, options: ListBookEventsOptions): Promise<ListResult>;
36
37
  //# sourceMappingURL=list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/events/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAA0B,MAAM,UAAU,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGvE,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAG3C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC5B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,qBAA0B,GACpC,OAAO,CAAC,oBAAoB,CAAC,CAc/B;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACrC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,qBAAqB,EAC9B,MAAM,EAA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