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.
- package/README.md +12 -5
- package/lib/cli.js +3 -3
- package/lib/cli.js.map +1 -1
- package/lib/commands/accounts/batch-create.d.ts +1 -1
- package/lib/commands/accounts/batch-create.d.ts.map +1 -1
- package/lib/commands/accounts/batch-create.js +3 -3
- package/lib/commands/accounts/batch-create.js.map +1 -1
- package/lib/commands/accounts/list.d.ts +2 -3
- package/lib/commands/accounts/list.d.ts.map +1 -1
- package/lib/commands/accounts/list.js +2 -12
- package/lib/commands/accounts/list.js.map +1 -1
- package/lib/commands/accounts/register.js +13 -13
- package/lib/commands/accounts/register.js.map +1 -1
- package/lib/commands/action.d.ts +2 -3
- package/lib/commands/action.d.ts.map +1 -1
- package/lib/commands/action.js +2 -3
- package/lib/commands/action.js.map +1 -1
- package/lib/commands/apps/list.d.ts +2 -3
- package/lib/commands/apps/list.d.ts.map +1 -1
- package/lib/commands/apps/list.js +2 -14
- package/lib/commands/apps/list.js.map +1 -1
- package/lib/commands/apps/register.js +10 -10
- package/lib/commands/apps/register.js.map +1 -1
- package/lib/commands/balances/list.d.ts +0 -2
- package/lib/commands/balances/list.d.ts.map +1 -1
- package/lib/commands/balances/list.js +9 -17
- package/lib/commands/balances/list.js.map +1 -1
- package/lib/commands/balances/register.d.ts.map +1 -1
- package/lib/commands/balances/register.js +3 -4
- package/lib/commands/balances/register.js.map +1 -1
- package/lib/commands/books/list.d.ts +2 -4
- package/lib/commands/books/list.d.ts.map +1 -1
- package/lib/commands/books/list.js +2 -30
- package/lib/commands/books/list.js.map +1 -1
- package/lib/commands/books/register.js +12 -12
- package/lib/commands/books/register.js.map +1 -1
- package/lib/commands/cli-helpers.d.ts +9 -4
- package/lib/commands/cli-helpers.d.ts.map +1 -1
- package/lib/commands/cli-helpers.js +18 -12
- package/lib/commands/cli-helpers.js.map +1 -1
- package/lib/commands/collections/list.d.ts +2 -3
- package/lib/commands/collections/list.d.ts.map +1 -1
- package/lib/commands/collections/list.js +2 -14
- package/lib/commands/collections/list.js.map +1 -1
- package/lib/commands/collections/register.d.ts.map +1 -1
- package/lib/commands/collections/register.js +15 -25
- package/lib/commands/collections/register.js.map +1 -1
- package/lib/commands/events/event-json.d.ts +13 -0
- package/lib/commands/events/event-json.d.ts.map +1 -0
- package/lib/commands/events/event-json.js +33 -0
- package/lib/commands/events/event-json.js.map +1 -0
- package/lib/commands/events/list.d.ts +4 -3
- package/lib/commands/events/list.d.ts.map +1 -1
- package/lib/commands/events/list.js +15 -66
- package/lib/commands/events/list.js.map +1 -1
- package/lib/commands/events/register.d.ts.map +1 -1
- package/lib/commands/events/register.js +7 -6
- package/lib/commands/events/register.js.map +1 -1
- package/lib/commands/files/list.d.ts +3 -2
- package/lib/commands/files/list.d.ts.map +1 -1
- package/lib/commands/files/list.js +13 -42
- package/lib/commands/files/list.js.map +1 -1
- package/lib/commands/files/register.d.ts.map +1 -1
- package/lib/commands/files/register.js +13 -10
- package/lib/commands/files/register.js.map +1 -1
- package/lib/commands/groups/list.d.ts +2 -3
- package/lib/commands/groups/list.d.ts.map +1 -1
- package/lib/commands/groups/list.js +2 -12
- package/lib/commands/groups/list.js.map +1 -1
- package/lib/commands/groups/register.js +12 -12
- package/lib/commands/groups/register.js.map +1 -1
- package/lib/commands/transactions/batch-create.d.ts +1 -1
- package/lib/commands/transactions/batch-create.d.ts.map +1 -1
- package/lib/commands/transactions/batch-create.js +4 -3
- package/lib/commands/transactions/batch-create.js.map +1 -1
- package/lib/commands/transactions/batch-update.d.ts +1 -1
- package/lib/commands/transactions/batch-update.d.ts.map +1 -1
- package/lib/commands/transactions/batch-update.js +4 -3
- package/lib/commands/transactions/batch-update.js.map +1 -1
- package/lib/commands/transactions/list.d.ts +4 -7
- package/lib/commands/transactions/list.d.ts.map +1 -1
- package/lib/commands/transactions/list.js +15 -32
- package/lib/commands/transactions/list.js.map +1 -1
- package/lib/commands/transactions/register.d.ts +1 -1
- package/lib/commands/transactions/register.d.ts.map +1 -1
- package/lib/commands/transactions/register.js +27 -26
- package/lib/commands/transactions/register.js.map +1 -1
- package/lib/commands/transactions/transaction-json.d.ts +23 -0
- package/lib/commands/transactions/transaction-json.d.ts.map +1 -0
- package/lib/commands/transactions/transaction-json.js +56 -0
- package/lib/commands/transactions/transaction-json.js.map +1 -0
- package/lib/docs/apps/ai.md +2 -2
- package/lib/docs/cli/app-management.md +0 -1
- package/lib/docs/cli/data-management.md +56 -54
- package/lib/docs/index.md +1 -1
- package/lib/docs-compliance/live-readme.d.ts.map +1 -1
- package/lib/docs-compliance/live-readme.js +0 -3
- package/lib/docs-compliance/live-readme.js.map +1 -1
- package/lib/docs-compliance/rules.d.ts.map +1 -1
- package/lib/docs-compliance/rules.js +9 -0
- package/lib/docs-compliance/rules.js.map +1 -1
- package/lib/render/index.d.ts +2 -4
- package/lib/render/index.d.ts.map +1 -1
- package/lib/render/index.js +1 -3
- package/lib/render/index.js.map +1 -1
- package/lib/render/output.d.ts +42 -22
- package/lib/render/output.d.ts.map +1 -1
- package/lib/render/output.js +62 -42
- package/lib/render/output.js.map +1 -1
- package/package.json +1 -1
- package/lib/render/csv-formatter.d.ts +0 -15
- package/lib/render/csv-formatter.d.ts.map +0 -1
- package/lib/render/csv-formatter.js +0 -37
- package/lib/render/csv-formatter.js.map +0 -1
- package/lib/render/table-formatter.d.ts +0 -34
- package/lib/render/table-formatter.d.ts.map +0 -1
- package/lib/render/table-formatter.js +0 -239
- package/lib/render/table-formatter.js.map +0 -1
|
@@ -188,7 +188,7 @@ Upload local files to a book and optionally route them with properties.
|
|
|
188
188
|
# List the first page of files in a book
|
|
189
189
|
bkper file list -b abc123
|
|
190
190
|
|
|
191
|
-
# Fetch the next page using the cursor
|
|
191
|
+
# Fetch the next page using the cursor from the previous output
|
|
192
192
|
bkper file list -b abc123 --limit 100 --cursor cursor_123
|
|
193
193
|
|
|
194
194
|
# Upload a file to a book
|
|
@@ -258,9 +258,6 @@ bkper transaction list -b abc123 -q 'on:2025'
|
|
|
258
258
|
# List transactions for a month (on:YYYY-MM)
|
|
259
259
|
bkper transaction list -b abc123 -q 'on:2025-01'
|
|
260
260
|
|
|
261
|
-
# List with custom properties included
|
|
262
|
-
bkper transaction list -b abc123 -q 'account:Sales' -p
|
|
263
|
-
|
|
264
261
|
# Fetch one page of transactions explicitly
|
|
265
262
|
bkper transaction list -b abc123 -q 'on:2025' --limit 100
|
|
266
263
|
|
|
@@ -296,7 +293,6 @@ bkper transaction merge tx_123 tx_456 -b abc123
|
|
|
296
293
|
- `transaction list -b <bookId> -q <query>` - List transactions matching a query (auto-paginates through all results unless `--limit` or `--cursor` is provided)
|
|
297
294
|
- `--limit <number>` - Fetch one page with up to this many transactions
|
|
298
295
|
- `--cursor <cursor>` - Cursor for fetching the next page
|
|
299
|
-
- `-p, --properties` - Include custom properties in the output
|
|
300
296
|
- `transaction create -b <bookId>` - Create a transaction
|
|
301
297
|
- `--date <date>` - Transaction date
|
|
302
298
|
- `--amount <amount>` - Transaction amount
|
|
@@ -336,11 +332,11 @@ Inspect book events and bot responses — useful for debugging automations and r
|
|
|
336
332
|
# List recent events (one page, default limit 50)
|
|
337
333
|
bkper event list -b abc123
|
|
338
334
|
|
|
339
|
-
# List only events with error bot responses
|
|
340
|
-
bkper event list -b abc123 --error
|
|
335
|
+
# List only events with error bot responses (includes full botResponses)
|
|
336
|
+
bkper event list -b abc123 --error
|
|
341
337
|
|
|
342
338
|
# Filter by resource (transaction, account, or group id)
|
|
343
|
-
bkper event list -b abc123 --resource tx_456
|
|
339
|
+
bkper event list -b abc123 --resource tx_456
|
|
344
340
|
|
|
345
341
|
# Filter by event type and date range
|
|
346
342
|
bkper event list -b abc123 --type TRANSACTION_POSTED --after 2026-01-01T00:00:00Z
|
|
@@ -349,13 +345,13 @@ bkper event list -b abc123 --type TRANSACTION_POSTED --after 2026-01-01T00:00:00
|
|
|
349
345
|
bkper event list -b abc123 --limit 50 --cursor cursor_123
|
|
350
346
|
|
|
351
347
|
# Replay one bot response after inspecting an error
|
|
352
|
-
bkper event replay evt_789 -b abc123 --agent-id tax-bot
|
|
348
|
+
bkper event replay evt_789 -b abc123 --agent-id tax-bot
|
|
353
349
|
```
|
|
354
350
|
|
|
355
351
|
<details>
|
|
356
352
|
<summary>Command reference</summary>
|
|
357
353
|
|
|
358
|
-
- `event list -b <bookId>` - List one page of events in a book (includes bot responses
|
|
354
|
+
- `event list -b <bookId>` - List one page of events in a book (includes bot responses)
|
|
359
355
|
- `--after <date>` - Start date inclusive (RFC3339)
|
|
360
356
|
- `--before <date>` - End date exclusive (RFC3339)
|
|
361
357
|
- `--resource <resourceId>` - Filter by resource ID (Transaction, Account, or Group). When set, `--error` and `--type` are ignored by the API
|
|
@@ -365,7 +361,7 @@ bkper event replay evt_789 -b abc123 --agent-id tax-bot --json
|
|
|
365
361
|
- `--cursor <cursor>` - Cursor for fetching the next page
|
|
366
362
|
- `event replay <eventId> -b <bookId> --agent-id <agentId>` - Replay one bot response for an event (returns the updated event with bot responses)
|
|
367
363
|
|
|
368
|
-
|
|
364
|
+
Output includes the full event payload, including nested `botResponses` (`agentId`, `type`, `message`, `createdAt`), for LLM-assisted debugging.
|
|
369
365
|
|
|
370
366
|
</details>
|
|
371
367
|
|
|
@@ -474,53 +470,56 @@ bkper collection delete col_789
|
|
|
474
470
|
|
|
475
471
|
## Output Format
|
|
476
472
|
|
|
477
|
-
All commands
|
|
473
|
+
All data commands output **JSON only**. Results go to stdout; hints (such as the next-page command), warnings, and notices go to stderr, so stdout is always parseable.
|
|
478
474
|
|
|
479
|
-
|
|
|
480
|
-
|
|
|
481
|
-
|
|
|
482
|
-
|
|
|
483
|
-
|
|
|
475
|
+
| Output | Shape |
|
|
476
|
+
| --------------------------------------------------- | ------------------------------------------------------- |
|
|
477
|
+
| Lists (`book list`, `transaction list`, batch writes, ...) | `{"items":[...]}`, plus `"cursor"` only when another page exists |
|
|
478
|
+
| Single items (`get`, `create`, `update`, ...) | One JSON object |
|
|
479
|
+
| Balances (`balance list`) | A 2D matrix: header row first, then one row per account or group |
|
|
484
480
|
|
|
485
481
|
```bash
|
|
486
|
-
#
|
|
482
|
+
# List output: one record per line inside the envelope
|
|
487
483
|
bkper account list -b abc123
|
|
484
|
+
# {"items":[
|
|
485
|
+
# {"id":"acc-abc","name":"Cash","type":"ASSET",...},
|
|
486
|
+
# {"id":"acc-def","name":"Revenue","type":"INCOMING",...}
|
|
487
|
+
# ]}
|
|
488
|
+
```
|
|
488
489
|
|
|
489
|
-
|
|
490
|
-
bkper account list -b abc123 --format json
|
|
491
|
-
# { "items": [...] }
|
|
490
|
+
**Layout:**
|
|
492
491
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
```
|
|
492
|
+
- Lists and balance matrices put one record or row per line, so `head`, `grep`, and `wc -l` work on records.
|
|
493
|
+
- Single items are pretty-printed on an interactive terminal and compact (one line) otherwise.
|
|
496
494
|
|
|
497
|
-
**
|
|
495
|
+
**Transactions** keep the [Bkper API Types](https://raw.githubusercontent.com/bkper/bkper-api-types/refs/heads/master/index.d.ts) shape, with `creditAccount.name` and `debitAccount.name` added so the from/to flow is readable without a separate account lookup. Custom properties are always included. Inline agent logo images are omitted.
|
|
498
496
|
|
|
499
|
-
-
|
|
500
|
-
- Paginated list commands include `cursor` only when another page is available: `{ "items": [...], "cursor": "..." }`.
|
|
501
|
-
- Use `jq '.items[]'` to iterate list output.
|
|
497
|
+
**Balances** values are unformatted JSON numbers (never locale-formatted strings), dates are ISO `yyyy-MM-dd`, and account/group properties are included as extra columns. Transaction `amount` values are exact decimal strings.
|
|
502
498
|
|
|
503
|
-
**
|
|
499
|
+
**Reshape with jq** instead of output flags:
|
|
504
500
|
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
- **Single-item commands** (e.g. `account get`, `transaction create`) fall back to JSON since CSV adds no value for non-tabular data
|
|
501
|
+
```bash
|
|
502
|
+
# Iterate list items
|
|
503
|
+
bkper transaction list -b abc123 -q 'on:2025-01' | jq '.items[]'
|
|
509
504
|
|
|
510
|
-
|
|
505
|
+
# Pick columns
|
|
506
|
+
bkper transaction list -b abc123 -q 'on:2025-01' | \
|
|
507
|
+
jq '.items[] | {date, amount, from: .creditAccount.name, to: .debitAccount.name, description}'
|
|
511
508
|
|
|
512
|
-
|
|
509
|
+
# Export to CSV
|
|
510
|
+
bkper transaction list -b abc123 -q 'on:2025-01' | \
|
|
511
|
+
jq -r '.items[] | [.date, .amount, .creditAccount.name, .debitAccount.name, .description] | @csv'
|
|
513
512
|
|
|
514
|
-
|
|
515
|
-
|
|
513
|
+
# Balance matrix to CSV
|
|
514
|
+
bkper balance list -b abc123 -q 'on:2025-12-31' | jq -r '.[] | @csv'
|
|
516
515
|
|
|
517
|
-
|
|
516
|
+
# Read the next-page cursor
|
|
517
|
+
bkper transaction list -b abc123 -q 'on:2025' --limit 100 | jq -r '.cursor // empty'
|
|
518
|
+
```
|
|
518
519
|
|
|
519
|
-
|
|
520
|
+
For accounting numbers, compute with a deterministic script or query rather than summing by eye. Balance values are JSON numbers, so extremely large values with many decimal places (beyond ~15 significant digits) can lose their last digits; use transaction `amount` strings when exact digits matter.
|
|
520
521
|
|
|
521
|
-
|
|
522
|
-
- **Programmatic processing / pipelines** → JSON
|
|
523
|
-
- **Human terminal reading** → Table
|
|
522
|
+
`--json` and `--format json` are accepted for compatibility and have no effect. Table and CSV output formats were removed; any other `--format` value fails with a jq hint.
|
|
524
523
|
|
|
525
524
|
---
|
|
526
525
|
|
|
@@ -564,43 +563,46 @@ echo '[{"name":"Cash","type":"ASSET"}]' | \
|
|
|
564
563
|
bkper account create -b abc123 -p "region=LATAM"
|
|
565
564
|
```
|
|
566
565
|
|
|
567
|
-
**Batch output:** write commands output created or updated resources
|
|
566
|
+
**Batch output:** write commands output created or updated resources in the same `{"items":[...]}` envelope as lists:
|
|
568
567
|
|
|
569
568
|
```bash
|
|
570
569
|
bkper account create -b abc123 < accounts.json
|
|
571
|
-
#
|
|
570
|
+
# {"items":[
|
|
571
|
+
# {"id":"acc-abc","name":"Cash",...},
|
|
572
|
+
# {"id":"acc-def","name":"Revenue",...}
|
|
573
|
+
# ]}
|
|
572
574
|
```
|
|
573
575
|
|
|
574
|
-
|
|
576
|
+
Stdin accepts a single object, an array, or the `{"items":[...]}` envelope, so list and batch output can be piped directly into another command.
|
|
575
577
|
|
|
576
578
|
**Piping between commands:**
|
|
577
579
|
|
|
578
|
-
For resources that support stdin creation,
|
|
580
|
+
For resources that support stdin creation, output can be piped directly into create or update commands:
|
|
579
581
|
|
|
580
582
|
```bash
|
|
581
583
|
# Copy all accounts from one book to another
|
|
582
|
-
bkper account list -b $BOOK_A
|
|
584
|
+
bkper account list -b $BOOK_A | bkper account create -b $BOOK_B
|
|
583
585
|
|
|
584
586
|
# Copy transactions matching a query
|
|
585
|
-
bkper transaction list -b $BOOK_A -q 'after:2025-01-01'
|
|
587
|
+
bkper transaction list -b $BOOK_A -q 'after:2025-01-01' | \
|
|
586
588
|
bkper transaction create -b $BOOK_B
|
|
587
589
|
|
|
588
590
|
# Clone accounts, then transactions
|
|
589
|
-
bkper account list -b $SOURCE
|
|
590
|
-
bkper transaction list -b $SOURCE -q 'after:2025-01-01'
|
|
591
|
+
bkper account list -b $SOURCE | bkper account create -b $DEST
|
|
592
|
+
bkper transaction list -b $SOURCE -q 'after:2025-01-01' | \
|
|
591
593
|
bkper transaction create -b $DEST
|
|
592
594
|
|
|
593
595
|
# Batch update: list transactions, modify, and pipe back to update
|
|
594
|
-
bkper transaction list -b $BOOK -q 'after:2025-01-01'
|
|
595
|
-
jq '[.[] | .description = "Updated: " + .description]' | \
|
|
596
|
+
bkper transaction list -b $BOOK -q 'after:2025-01-01' | \
|
|
597
|
+
jq '[.items[] | .description = "Updated: " + .description]' | \
|
|
596
598
|
bkper transaction update -b $BOOK
|
|
597
599
|
|
|
598
600
|
# Batch update: add a property to all matching transactions
|
|
599
|
-
bkper transaction list -b $BOOK -q 'account:Expenses'
|
|
601
|
+
bkper transaction list -b $BOOK -q 'account:Expenses' | \
|
|
600
602
|
bkper transaction update -b $BOOK -p "reviewed=true"
|
|
601
603
|
|
|
602
604
|
# Batch update checked transactions
|
|
603
|
-
bkper transaction list -b $BOOK -q 'is:checked after:2025-01-01'
|
|
605
|
+
bkper transaction list -b $BOOK -q 'is:checked after:2025-01-01' | \
|
|
604
606
|
bkper transaction update -b $BOOK --update-checked -p "migrated=true"
|
|
605
607
|
```
|
|
606
608
|
|
package/lib/docs/index.md
CHANGED
|
@@ -7,7 +7,7 @@ For Bkper data, accounting, reporting, tax, or financial-flow tasks, read `core/
|
|
|
7
7
|
For Bkper app implementation, refactoring, or code review, always read `apps/quality.md` alongside the task-specific references. After implementation, review the changed code against the guidelines before considering the work complete.
|
|
8
8
|
|
|
9
9
|
- `core/core-concepts.md` — canonical Bkper data model: resources, movements, balances, accounts, groups, books, transactions, properties, and the zero-sum invariant.
|
|
10
|
-
- `cli/data-management.md` — CLI reference for managing financial data and files: books, accounts, groups, files, transactions, per-account balance queries, query operators (on:, after:, before:, account:, group:), output
|
|
10
|
+
- `cli/data-management.md` — CLI reference for managing financial data and files: books, accounts, groups, files, transactions, per-account balance queries, query operators (on:, after:, before:, account:, group:), JSON output shapes and jq reshaping, human-review Bkper UI links, batch operations via stdin/piping, collections.
|
|
11
11
|
- `cli/app-management.md` — CLI reference for building and deploying Bkper apps: init/git clone/credential helpers, dev/build/deploy workflow, app install/uninstall, secrets management, app logs, bkper.yaml configuration reference (identity, branding, events, menu integration, deployment).
|
|
12
12
|
- `apps/overview.md` — Platform evaluation and capability overview: use when comparing managed Bkper hosting with self-managed infrastructure or clarifying platform responsibilities; use the task-specific app references for implementation.
|
|
13
13
|
- `apps/ai.md` — Bkper AI in Platform apps: choose Jev typed evaluations or Open Responses language models, authenticate through app `/api/*` routes, discover model capabilities, validate output, and keep Book writes under deterministic application control.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-readme.d.ts","sourceRoot":"","sources":["../../src/docs-compliance/live-readme.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,mBAAmB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AA4DD,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CActE;AAED,wBAAgB,kBAAkB,CAC9B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,eAAe,GACxB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"live-readme.d.ts","sourceRoot":"","sources":["../../src/docs-compliance/live-readme.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,mBAAmB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AA4DD,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CActE;AAED,wBAAgB,kBAAkB,CAC9B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,eAAe,GACxB,mBAAmB,CA6BrB"}
|
|
@@ -81,9 +81,6 @@ export function materializeCommand(command, config) {
|
|
|
81
81
|
skipReason: `unresolved placeholders in command: ${materialized}`,
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
if (!materialized.includes('--format ')) {
|
|
85
|
-
materialized = `${materialized} --format csv`;
|
|
86
|
-
}
|
|
87
84
|
return { command: materialized };
|
|
88
85
|
}
|
|
89
86
|
//# sourceMappingURL=live-readme.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-readme.js","sourceRoot":"","sources":["../../src/docs-compliance/live-readme.ts"],"names":[],"mappings":"AAaA,SAAS,iBAAiB,CAAC,OAAe;IACtC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,KAAK,GAAG,yBAAyB,CAAC;IACxC,IAAI,KAA6B,CAAC;IAElC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,wBAAwB,CAAC,KAAa;IAC3C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5D,MAAM,SAAS,GAAa,EAAE,CAAC;IAE/B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAChC,SAAS;QACb,CAAC;QAED,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,GAAG,IAAI,CAAC;QAClB,CAAC;aAAM,CAAC;YACJ,MAAM,GAAG,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC;QACjC,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,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,
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/docs-compliance/rules.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,eAAe,EAAE,CAAC;CAC7B;AA4BD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CA0G1E"}
|
|
@@ -67,6 +67,15 @@ export function evaluateReadmeCompliance(content) {
|
|
|
67
67
|
message: 'README should not document stdin writable fields for `bkper.Group`.',
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
+
const legacyOutputFormatPattern = /--format(?:\s+|=)(?:table|csv)\b/g;
|
|
71
|
+
let legacyOutputFormatMatch;
|
|
72
|
+
while ((legacyOutputFormatMatch = legacyOutputFormatPattern.exec(content)) !== null) {
|
|
73
|
+
errors.push({
|
|
74
|
+
code: 'legacy-output-format-documented',
|
|
75
|
+
message: 'Found `--format table|csv`. CLI output is JSON only; reshape with jq instead.',
|
|
76
|
+
line: getLineNumber(content, legacyOutputFormatMatch.index),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
70
79
|
const internalReleaseDetailPattern = /release:(patch|minor|major)|Trusted Publisher|GitHub Actions|CI\/CD|publishing policy|publish(?:ing)?\s+is\s+handled|maintainer-only procedures/i;
|
|
71
80
|
const internalReleaseDetailMatch = internalReleaseDetailPattern.exec(content);
|
|
72
81
|
if (internalReleaseDetailMatch) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/docs-compliance/rules.ts"],"names":[],"mappings":"AAUA,SAAS,aAAa,CAAC,OAAe,EAAE,KAAa;IACjD,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,KAAK,CA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,CAAC;IAED,MAAM,4BAA4B,GAC9B,kJAAkJ,CAAC;IACvJ,MAAM,0BAA0B,GAAG,4BAA4B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9E,IAAI,0BAA0B,EAAE,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC;YACR,IAAI,EAAE,qCAAqC;YAC3C,OAAO,EACH,iGAAiG;YACrG,IAAI,EAAE,aAAa,CAAC,OAAO,EAAE,0BAA0B,CAAC,KAAK,CAAC;SACjE,CAAC,CAAC;IACP,CAAC;IAED,OAAO,EAAC,MAAM,EAAC,CAAC;AACpB,CAAC"}
|
package/lib/render/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { renderTable, renderItem, renderListResult } from './output.js';
|
|
4
|
-
export type { OutputFormat, ListResult } from './output.js';
|
|
1
|
+
export { formatItem, formatList, formatMatrix, isInteractiveOutput, renderItem, renderList, renderMatrix, renderNotice, } from './output.js';
|
|
2
|
+
export type { ListResult } from './output.js';
|
|
5
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EACV,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,YAAY,GACf,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
|
package/lib/render/index.js
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { formatCsv } from './csv-formatter.js';
|
|
3
|
-
export { renderTable, renderItem, renderListResult } from './output.js';
|
|
1
|
+
export { formatItem, formatList, formatMatrix, isInteractiveOutput, renderItem, renderList, renderMatrix, renderNotice, } from './output.js';
|
|
4
2
|
//# sourceMappingURL=index.js.map
|
package/lib/render/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EACV,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,YAAY,GACf,MAAM,aAAa,CAAC"}
|
package/lib/render/output.d.ts
CHANGED
|
@@ -1,37 +1,57 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* JSON-only output rendering.
|
|
3
|
+
*
|
|
4
|
+
* Contract:
|
|
5
|
+
* - stdout carries only the JSON result, so it is always parseable (e.g. by jq).
|
|
6
|
+
* - Lists use a stable `{"items":[...]}` envelope, adding `"cursor"` only when a
|
|
7
|
+
* next page exists. Each record is compact on its own line.
|
|
8
|
+
* - Matrices (balance reports) are bare 2D arrays with one row per line.
|
|
9
|
+
* - Single items are pretty-printed only on an interactive terminal.
|
|
10
|
+
* - Hints, notices, and warnings go to stderr.
|
|
3
11
|
*/
|
|
4
|
-
export type OutputFormat = 'table' | 'json' | 'csv';
|
|
5
12
|
/**
|
|
6
|
-
* Structured result
|
|
7
|
-
* without knowing how the data was built.
|
|
13
|
+
* Structured list result returned by list commands.
|
|
8
14
|
*/
|
|
9
|
-
export
|
|
10
|
-
kind: 'json';
|
|
15
|
+
export interface ListResult {
|
|
11
16
|
items: unknown[];
|
|
17
|
+
/** Cursor for the next page, present only when more results exist. */
|
|
12
18
|
cursor?: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
footer?: string;
|
|
17
|
-
};
|
|
19
|
+
/** Human/agent guidance (e.g. next-page command), written to stderr. */
|
|
20
|
+
hint?: string;
|
|
21
|
+
}
|
|
18
22
|
/**
|
|
19
|
-
*
|
|
23
|
+
* Formats list items in the `{"items":[...]}` envelope, one record per line.
|
|
20
24
|
*/
|
|
21
|
-
export declare function
|
|
25
|
+
export declare function formatList(items: unknown[], cursor?: string): string;
|
|
22
26
|
/**
|
|
23
|
-
*
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
* Formats a 2D matrix as JSON, one row per line.
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatMatrix(matrix: unknown[][]): string;
|
|
30
|
+
/**
|
|
31
|
+
* Formats a single item as pretty (2-space) or compact JSON.
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatItem(item: object, pretty: boolean): string;
|
|
34
|
+
/**
|
|
35
|
+
* Whether stdout is an interactive terminal (a human is reading).
|
|
27
36
|
*/
|
|
28
|
-
export declare function
|
|
37
|
+
export declare function isInteractiveOutput(): boolean;
|
|
29
38
|
/**
|
|
30
|
-
* Renders a
|
|
31
|
-
|
|
39
|
+
* Renders a list result: JSON to stdout, hint to stderr.
|
|
40
|
+
*/
|
|
41
|
+
export declare function renderList(result: ListResult): void;
|
|
42
|
+
/**
|
|
43
|
+
* Renders a 2D matrix as JSON to stdout.
|
|
44
|
+
*/
|
|
45
|
+
export declare function renderMatrix(matrix: unknown[][]): void;
|
|
46
|
+
/**
|
|
47
|
+
* Renders a single item as JSON to stdout.
|
|
32
48
|
*
|
|
33
49
|
* @param item - Record to render
|
|
34
|
-
* @param
|
|
50
|
+
* @param pretty - Pretty-print; defaults to true only on an interactive terminal
|
|
51
|
+
*/
|
|
52
|
+
export declare function renderItem(item: object, pretty?: boolean): void;
|
|
53
|
+
/**
|
|
54
|
+
* Renders a human-readable notice (e.g. success without a result) to stderr.
|
|
35
55
|
*/
|
|
36
|
-
export declare function
|
|
56
|
+
export declare function renderNotice(message: string): void;
|
|
37
57
|
//# sourceMappingURL=output.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/render/output.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/render/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AASD;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAIpE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,GAAG,MAAM,CAExD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAEhE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAKnD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,GAAG,IAAI,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,UAAwB,GAAG,IAAI,CAE7E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAElD"}
|
package/lib/render/output.js
CHANGED
|
@@ -1,54 +1,74 @@
|
|
|
1
|
-
import { formatTable, formatItem } from './table-formatter.js';
|
|
2
|
-
import { formatCsv } from './csv-formatter.js';
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
2
|
+
* JSON-only output rendering.
|
|
3
|
+
*
|
|
4
|
+
* Contract:
|
|
5
|
+
* - stdout carries only the JSON result, so it is always parseable (e.g. by jq).
|
|
6
|
+
* - Lists use a stable `{"items":[...]}` envelope, adding `"cursor"` only when a
|
|
7
|
+
* next page exists. Each record is compact on its own line.
|
|
8
|
+
* - Matrices (balance reports) are bare 2D arrays with one row per line.
|
|
9
|
+
* - Single items are pretty-printed only on an interactive terminal.
|
|
10
|
+
* - Hints, notices, and warnings go to stderr.
|
|
5
11
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
renderTable(result.matrix, format);
|
|
13
|
-
if (result.footer && format === 'table') {
|
|
14
|
-
console.log(result.footer);
|
|
15
|
-
}
|
|
12
|
+
/**
|
|
13
|
+
* Serializes lines as a JSON array body with one entry per line.
|
|
14
|
+
*/
|
|
15
|
+
function formatLines(lines) {
|
|
16
|
+
return lines.length > 0 ? `[\n${lines.join(',\n')}\n]` : '[]';
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
* Formats list items in the `{"items":[...]}` envelope, one record per line.
|
|
20
|
+
*/
|
|
21
|
+
export function formatList(items, cursor) {
|
|
22
|
+
const body = formatLines(items.map(item => JSON.stringify(item)));
|
|
23
|
+
const cursorPart = cursor !== undefined ? `,"cursor":${JSON.stringify(cursor)}` : '';
|
|
24
|
+
return `{"items":${body}${cursorPart}}`;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Formats a 2D matrix as JSON, one row per line.
|
|
28
|
+
*/
|
|
29
|
+
export function formatMatrix(matrix) {
|
|
30
|
+
return formatLines(matrix.map(row => JSON.stringify(row)));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Formats a single item as pretty (2-space) or compact JSON.
|
|
34
|
+
*/
|
|
35
|
+
export function formatItem(item, pretty) {
|
|
36
|
+
return pretty ? JSON.stringify(item, null, 2) : JSON.stringify(item);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Whether stdout is an interactive terminal (a human is reading).
|
|
40
|
+
*/
|
|
41
|
+
export function isInteractiveOutput() {
|
|
42
|
+
return process.stdout.isTTY === true;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Renders a list result: JSON to stdout, hint to stderr.
|
|
46
|
+
*/
|
|
47
|
+
export function renderList(result) {
|
|
48
|
+
console.log(formatList(result.items, result.cursor));
|
|
49
|
+
if (result.hint) {
|
|
50
|
+
console.error(result.hint);
|
|
37
51
|
}
|
|
38
52
|
}
|
|
39
53
|
/**
|
|
40
|
-
* Renders a
|
|
41
|
-
|
|
54
|
+
* Renders a 2D matrix as JSON to stdout.
|
|
55
|
+
*/
|
|
56
|
+
export function renderMatrix(matrix) {
|
|
57
|
+
console.log(formatMatrix(matrix));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Renders a single item as JSON to stdout.
|
|
42
61
|
*
|
|
43
62
|
* @param item - Record to render
|
|
44
|
-
* @param
|
|
63
|
+
* @param pretty - Pretty-print; defaults to true only on an interactive terminal
|
|
45
64
|
*/
|
|
46
|
-
export function renderItem(item,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
65
|
+
export function renderItem(item, pretty = isInteractiveOutput()) {
|
|
66
|
+
console.log(formatItem(item, pretty));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Renders a human-readable notice (e.g. success without a result) to stderr.
|
|
70
|
+
*/
|
|
71
|
+
export function renderNotice(message) {
|
|
72
|
+
console.error(message);
|
|
53
73
|
}
|
|
54
74
|
//# sourceMappingURL=output.js.map
|
package/lib/render/output.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/render/output.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/render/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAaH;;GAEG;AACH,SAAS,WAAW,CAAC,KAAe;IAChC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAClE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAgB,EAAE,MAAe;IACxD,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACrF,OAAO,YAAY,IAAI,GAAG,UAAU,GAAG,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAAmB;IAC5C,OAAO,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,MAAe;IACpD,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AACzE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IAC/B,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,MAAkB;IACzC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACrD,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAAmB;IAC5C,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;AACtC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,MAAM,GAAG,mBAAmB,EAAE;IACnE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IACxC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formats a 2D matrix into an RFC 4180 compliant CSV string.
|
|
3
|
-
*
|
|
4
|
-
* - Row 0 is treated as headers, rows 1+ as data (all rendered identically)
|
|
5
|
-
* - Uses CRLF line endings per RFC 4180
|
|
6
|
-
* - Fields containing commas, double quotes, or newlines are quoted
|
|
7
|
-
* - Double quotes are escaped by doubling them ("")
|
|
8
|
-
* - null/undefined cells are rendered as empty strings
|
|
9
|
-
* - No truncation is applied to any field
|
|
10
|
-
*
|
|
11
|
-
* @param matrix - 2D array where row 0 is headers and rows 1+ are data
|
|
12
|
-
* @returns RFC 4180 CSV string
|
|
13
|
-
*/
|
|
14
|
-
export declare function formatCsv(matrix: unknown[][]): string;
|
|
15
|
-
//# sourceMappingURL=csv-formatter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"csv-formatter.d.ts","sourceRoot":"","sources":["../../src/render/csv-formatter.ts"],"names":[],"mappings":"AAqBA;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,GAAG,MAAM,CAMrD"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formats a field value according to RFC 4180 rules.
|
|
3
|
-
*
|
|
4
|
-
* - null/undefined become empty string
|
|
5
|
-
* - Fields containing commas, double quotes, or newlines are wrapped in double quotes
|
|
6
|
-
* - Double quotes within a field are escaped by doubling them ("")
|
|
7
|
-
*/
|
|
8
|
-
function formatField(value) {
|
|
9
|
-
if (value == null) {
|
|
10
|
-
return '';
|
|
11
|
-
}
|
|
12
|
-
const str = String(value);
|
|
13
|
-
if (str.includes('"') || str.includes(',') || str.includes('\n') || str.includes('\r')) {
|
|
14
|
-
return '"' + str.replace(/"/g, '""') + '"';
|
|
15
|
-
}
|
|
16
|
-
return str;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Formats a 2D matrix into an RFC 4180 compliant CSV string.
|
|
20
|
-
*
|
|
21
|
-
* - Row 0 is treated as headers, rows 1+ as data (all rendered identically)
|
|
22
|
-
* - Uses CRLF line endings per RFC 4180
|
|
23
|
-
* - Fields containing commas, double quotes, or newlines are quoted
|
|
24
|
-
* - Double quotes are escaped by doubling them ("")
|
|
25
|
-
* - null/undefined cells are rendered as empty strings
|
|
26
|
-
* - No truncation is applied to any field
|
|
27
|
-
*
|
|
28
|
-
* @param matrix - 2D array where row 0 is headers and rows 1+ are data
|
|
29
|
-
* @returns RFC 4180 CSV string
|
|
30
|
-
*/
|
|
31
|
-
export function formatCsv(matrix) {
|
|
32
|
-
if (!matrix || matrix.length === 0) {
|
|
33
|
-
return '';
|
|
34
|
-
}
|
|
35
|
-
return matrix.map(row => row.map(formatField).join(',')).join('\r\n');
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=csv-formatter.js.map
|