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
|
@@ -10,9 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
11
|
import { Transaction } from 'bkper-js';
|
|
12
12
|
import { parsePropertyFlag } from '../../utils/properties.js';
|
|
13
|
+
import { renderList } from '../../render/index.js';
|
|
14
|
+
import { transactionsToJson } from './transaction-json.js';
|
|
13
15
|
/**
|
|
14
16
|
* Updates multiple transactions from stdin items using the batch API.
|
|
15
|
-
* Outputs
|
|
17
|
+
* Outputs all updated transactions in an `{"items":[...]}` envelope.
|
|
16
18
|
*
|
|
17
19
|
* Each stdin item must have an `id` field identifying the transaction to update.
|
|
18
20
|
*
|
|
@@ -48,8 +50,7 @@ export function batchUpdateTransactions(bookId, items, propertyOverrides, update
|
|
|
48
50
|
transactions.push(tx);
|
|
49
51
|
}
|
|
50
52
|
const results = yield book.batchUpdateTransactions(transactions, updateChecked);
|
|
51
|
-
|
|
52
|
-
console.log(JSON.stringify(allResults, null, 2));
|
|
53
|
+
renderList({ items: yield transactionsToJson(results) });
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
//# sourceMappingURL=batch-update.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-update.js","sourceRoot":"","sources":["../../../src/commands/transactions/batch-update.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"batch-update.js","sourceRoot":"","sources":["../../../src/commands/transactions/batch-update.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,MAAM,UAAgB,uBAAuB,CACzC,MAAc,EACd,KAAgC,EAChC,iBAA4B,EAC5B,aAAuB;;QAEvB,MAAM,OAAO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AED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;QAChF,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7D,CAAC;CAAA"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Book, Transaction, Account } from 'bkper-js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ListResult } from '../../render/output.js';
|
|
3
3
|
export declare const DEFAULT_TRANSACTION_LIST_LIMIT = 100;
|
|
4
4
|
/**
|
|
5
5
|
* Options for querying transactions from a book.
|
|
6
6
|
*/
|
|
7
7
|
export interface ListTransactionsOptions {
|
|
8
8
|
query: string;
|
|
9
|
-
properties?: boolean;
|
|
10
9
|
limit?: number;
|
|
11
10
|
cursor?: string;
|
|
12
11
|
}
|
|
@@ -24,9 +23,8 @@ export interface ListTransactionsResult {
|
|
|
24
23
|
* results until no more pages remain.
|
|
25
24
|
*
|
|
26
25
|
* Fetches the book with accounts pre-loaded in a single API call, so that
|
|
27
|
-
* account name resolution during
|
|
28
|
-
*
|
|
29
|
-
* individual API calls per transaction.
|
|
26
|
+
* account name resolution during serialization resolves from the in-memory
|
|
27
|
+
* cache instead of making individual API calls per transaction.
|
|
30
28
|
*
|
|
31
29
|
* @param bookId - The book ID to query
|
|
32
30
|
* @param options - Query parameters including search string
|
|
@@ -35,7 +33,6 @@ export interface ListTransactionsResult {
|
|
|
35
33
|
export declare function listTransactions(bookId: string, options: ListTransactionsOptions): Promise<ListTransactionsResult>;
|
|
36
34
|
/**
|
|
37
35
|
* Lists transactions and returns a ListResult ready for rendering.
|
|
38
|
-
* Absorbs TransactionsDataTableBuilder config and JSON mapping.
|
|
39
36
|
*/
|
|
40
|
-
export declare function listTransactionsFormatted(bookId: string, options: ListTransactionsOptions
|
|
37
|
+
export declare function listTransactionsFormatted(bookId: string, options: ListTransactionsOptions): Promise<ListResult>;
|
|
41
38
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAKzD,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAoBlD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,sBAAsB,CAAC,CAkDjC;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC3C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,UAAU,CAAC,CAcrB"}
|
|
@@ -8,19 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { getBkperInstance } from '../../bkper-factory.js';
|
|
11
|
+
import { transactionsToJson } from './transaction-json.js';
|
|
11
12
|
import { quoteShellArg } from '../../utils/shell-quote.js';
|
|
12
13
|
import { warnIfSuspiciousDateVariableQuery } from '../../utils/query-warning.js';
|
|
13
14
|
export const DEFAULT_TRANSACTION_LIST_LIMIT = 100;
|
|
14
|
-
function
|
|
15
|
+
function buildTransactionListHint(bookId, options, cursor) {
|
|
15
16
|
var _a;
|
|
16
17
|
if (!cursor) {
|
|
17
18
|
return undefined;
|
|
18
19
|
}
|
|
19
20
|
const pageLimit = (_a = options.limit) !== null && _a !== void 0 ? _a : DEFAULT_TRANSACTION_LIST_LIMIT;
|
|
20
|
-
const propertiesFlag = options.properties ? ' -p' : '';
|
|
21
21
|
return [
|
|
22
22
|
`Next cursor: ${cursor}`,
|
|
23
|
-
`Next page: bkper transaction list -b ${quoteShellArg(bookId)} -q ${quoteShellArg(options.query)} --limit ${pageLimit} --cursor ${quoteShellArg(cursor)}
|
|
23
|
+
`Next page: bkper transaction list -b ${quoteShellArg(bookId)} -q ${quoteShellArg(options.query)} --limit ${pageLimit} --cursor ${quoteShellArg(cursor)}`,
|
|
24
24
|
].join('\n');
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -28,9 +28,8 @@ function buildTransactionListFooter(bookId, options, cursor) {
|
|
|
28
28
|
* results until no more pages remain.
|
|
29
29
|
*
|
|
30
30
|
* Fetches the book with accounts pre-loaded in a single API call, so that
|
|
31
|
-
* account name resolution during
|
|
32
|
-
*
|
|
33
|
-
* individual API calls per transaction.
|
|
31
|
+
* account name resolution during serialization resolves from the in-memory
|
|
32
|
+
* cache instead of making individual API calls per transaction.
|
|
34
33
|
*
|
|
35
34
|
* @param bookId - The book ID to query
|
|
36
35
|
* @param options - Query parameters including search string
|
|
@@ -86,37 +85,21 @@ export function listTransactions(bookId, options) {
|
|
|
86
85
|
}
|
|
87
86
|
/**
|
|
88
87
|
* Lists transactions and returns a ListResult ready for rendering.
|
|
89
|
-
* Absorbs TransactionsDataTableBuilder config and JSON mapping.
|
|
90
88
|
*/
|
|
91
|
-
export function listTransactionsFormatted(bookId, options
|
|
89
|
+
export function listTransactionsFormatted(bookId, options) {
|
|
92
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
93
91
|
const result = yield listTransactions(bookId, options);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (result.cursor) {
|
|
100
|
-
jsonResult.cursor = result.cursor;
|
|
101
|
-
}
|
|
102
|
-
return jsonResult;
|
|
92
|
+
const listResult = {
|
|
93
|
+
items: yield transactionsToJson(result.items),
|
|
94
|
+
};
|
|
95
|
+
if (result.cursor) {
|
|
96
|
+
listResult.cursor = result.cursor;
|
|
103
97
|
}
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
|
|
98
|
+
const hint = buildTransactionListHint(bookId, options, result.cursor);
|
|
99
|
+
if (hint) {
|
|
100
|
+
listResult.hint = hint;
|
|
107
101
|
}
|
|
108
|
-
|
|
109
|
-
builder.formatDates(true).formatValues(true).recordedAt(false);
|
|
110
|
-
if (options.properties) {
|
|
111
|
-
builder.properties(true);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
const matrix = yield builder.build();
|
|
115
|
-
return {
|
|
116
|
-
kind: 'matrix',
|
|
117
|
-
matrix,
|
|
118
|
-
footer: buildTransactionListFooter(bookId, options, result.cursor),
|
|
119
|
-
};
|
|
102
|
+
return listResult;
|
|
120
103
|
});
|
|
121
104
|
}
|
|
122
105
|
//# sourceMappingURL=list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/transactions/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,iCAAiC,EAAE,MAAM,8BAA8B,CAAC;AAEjF,MAAM,CA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,MAAM;YACV,CAAC;YACD,MAAM,GAAG,UAAU,CAAC;QACxB,CAAC,QAAQ,IAAI,EAAE;QAEf,OAAO;YACH,IAAI;YACJ,KAAK,EAAE,QAAQ;YACf,OAAO;SACV,CAAC;IACN,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,UAAgB,yBAAyB,CAC3C,MAAc,EACd,OAAgC;;QAEhC,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAEvD,MAAM,UAAU,GAAe;YAC3B,KAAK,EAAE,MAAM,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC;SAChD,CAAC;QACF,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAChB,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QACtC,CAAC;QACD,MAAM,IAAI,GAAG,wBAAwB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QACtE,IAAI,IAAI,EAAE,CAAC;YACP,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC;QAC3B,CAAC;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAuBjD,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkOlE"}
|
|
@@ -7,9 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
import { Option } from 'commander';
|
|
10
11
|
import { withAction } from '../action.js';
|
|
11
12
|
import { collectProperty, collectRepeatable, parsePositiveInteger } from '../cli-helpers.js';
|
|
12
|
-
import {
|
|
13
|
+
import { renderList, renderItem } from '../../render/index.js';
|
|
14
|
+
import { transactionToJson } from './transaction-json.js';
|
|
13
15
|
import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
|
|
14
16
|
import { parseStdinItems } from '../../input/index.js';
|
|
15
17
|
import { listTransactionsFormatted, getTransaction, createTransaction, updateTransaction, postTransaction, checkTransaction, uncheckTransaction, trashTransaction, untrashTransaction, mergeTransactions, batchCreateTransactions, batchUpdateTransactions, resolveCreateTransactionFilePath, } from './index.js';
|
|
@@ -22,28 +24,27 @@ export function registerTransactionCommands(program) {
|
|
|
22
24
|
.option('-q, --query <query>', 'Search query')
|
|
23
25
|
.option('--limit <limit>', 'Fetch one page with up to this many transactions', parsePositiveInteger)
|
|
24
26
|
.option('--cursor <cursor>', 'Cursor for fetching the next page')
|
|
25
|
-
.
|
|
26
|
-
.action(options => withAction('listing transactions', (
|
|
27
|
+
.addOption(new Option('-p, --properties', 'No-op: properties are always included').hideHelp())
|
|
28
|
+
.action(options => withAction('listing transactions', () => __awaiter(this, void 0, void 0, function* () {
|
|
27
29
|
throwIfErrors(validateRequiredOptions(options, [
|
|
28
30
|
{ name: 'book', flag: '--book' },
|
|
29
31
|
{ name: 'query', flag: '--query' },
|
|
30
32
|
]));
|
|
31
33
|
const result = yield listTransactionsFormatted(options.book, {
|
|
32
34
|
query: options.query,
|
|
33
|
-
properties: options.properties,
|
|
34
35
|
limit: options.limit,
|
|
35
36
|
cursor: options.cursor,
|
|
36
|
-
}
|
|
37
|
-
|
|
37
|
+
});
|
|
38
|
+
renderList(result);
|
|
38
39
|
}))());
|
|
39
40
|
transactionCommand
|
|
40
41
|
.command('get <transactionId>')
|
|
41
42
|
.description('Get a transaction by ID')
|
|
42
43
|
.option('-b, --book <bookId>', 'Book ID')
|
|
43
|
-
.action((transactionId, options) => withAction('getting transaction', (
|
|
44
|
+
.action((transactionId, options) => withAction('getting transaction', () => __awaiter(this, void 0, void 0, function* () {
|
|
44
45
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
45
46
|
const transaction = yield getTransaction(options.book, transactionId);
|
|
46
|
-
renderItem(transaction
|
|
47
|
+
renderItem(yield transactionToJson(transaction));
|
|
47
48
|
}))());
|
|
48
49
|
transactionCommand
|
|
49
50
|
.command('create')
|
|
@@ -58,7 +59,7 @@ export function registerTransactionCommands(program) {
|
|
|
58
59
|
.option('--remote-id <remoteId>', 'Remote ID (repeatable)', collectProperty)
|
|
59
60
|
.option('--file <path>', 'Attach a local file (single-create only)', collectRepeatable)
|
|
60
61
|
.option('-p, --property <key=value>', 'Set a property (repeatable, empty value deletes)', collectProperty)
|
|
61
|
-
.action(options => withAction('creating transaction', (
|
|
62
|
+
.action(options => withAction('creating transaction', () => __awaiter(this, void 0, void 0, function* () {
|
|
62
63
|
const stdinData = !process.stdin.isTTY ? yield parseStdinItems() : null;
|
|
63
64
|
const filePath = resolveCreateTransactionFilePath(options.file, stdinData !== null);
|
|
64
65
|
if (stdinData && stdinData.items.length > 0) {
|
|
@@ -66,7 +67,7 @@ export function registerTransactionCommands(program) {
|
|
|
66
67
|
yield batchCreateTransactions(options.book, stdinData.items, options.property);
|
|
67
68
|
}
|
|
68
69
|
else if (stdinData && stdinData.items.length === 0) {
|
|
69
|
-
|
|
70
|
+
renderList({ items: [] });
|
|
70
71
|
}
|
|
71
72
|
else {
|
|
72
73
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
@@ -81,17 +82,17 @@ export function registerTransactionCommands(program) {
|
|
|
81
82
|
property: options.property,
|
|
82
83
|
file: filePath,
|
|
83
84
|
});
|
|
84
|
-
renderItem(transaction
|
|
85
|
+
renderItem(yield transactionToJson(transaction));
|
|
85
86
|
}
|
|
86
87
|
}))());
|
|
87
88
|
transactionCommand
|
|
88
89
|
.command('post <transactionId>')
|
|
89
90
|
.description('Post a transaction')
|
|
90
91
|
.option('-b, --book <bookId>', 'Book ID')
|
|
91
|
-
.action((transactionId, options) => withAction('posting transaction', (
|
|
92
|
+
.action((transactionId, options) => withAction('posting transaction', () => __awaiter(this, void 0, void 0, function* () {
|
|
92
93
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
93
94
|
const transaction = yield postTransaction(options.book, transactionId);
|
|
94
|
-
renderItem(transaction
|
|
95
|
+
renderItem(yield transactionToJson(transaction));
|
|
95
96
|
}))());
|
|
96
97
|
transactionCommand
|
|
97
98
|
.command('update [transactionId]')
|
|
@@ -105,14 +106,14 @@ export function registerTransactionCommands(program) {
|
|
|
105
106
|
.option('--url <url>', 'URL (repeatable, replaces all)', collectProperty)
|
|
106
107
|
.option('--update-checked', 'Also update checked transactions')
|
|
107
108
|
.option('-p, --property <key=value>', 'Set a property (repeatable, empty value deletes)', collectProperty)
|
|
108
|
-
.action((transactionId, options) => withAction('updating transaction', (
|
|
109
|
+
.action((transactionId, options) => withAction('updating transaction', () => __awaiter(this, void 0, void 0, function* () {
|
|
109
110
|
const stdinData = !process.stdin.isTTY ? yield parseStdinItems() : null;
|
|
110
111
|
if (stdinData && stdinData.items.length > 0) {
|
|
111
112
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
112
113
|
yield batchUpdateTransactions(options.book, stdinData.items, options.property, options.updateChecked);
|
|
113
114
|
}
|
|
114
115
|
else if (stdinData && stdinData.items.length === 0) {
|
|
115
|
-
|
|
116
|
+
renderList({ items: [] });
|
|
116
117
|
}
|
|
117
118
|
else {
|
|
118
119
|
if (!transactionId) {
|
|
@@ -128,53 +129,53 @@ export function registerTransactionCommands(program) {
|
|
|
128
129
|
url: options.url,
|
|
129
130
|
property: options.property,
|
|
130
131
|
});
|
|
131
|
-
renderItem(transaction
|
|
132
|
+
renderItem(yield transactionToJson(transaction));
|
|
132
133
|
}
|
|
133
134
|
}))());
|
|
134
135
|
transactionCommand
|
|
135
136
|
.command('check <transactionId>')
|
|
136
137
|
.description('Check a transaction')
|
|
137
138
|
.option('-b, --book <bookId>', 'Book ID')
|
|
138
|
-
.action((transactionId, options) => withAction('checking transaction', (
|
|
139
|
+
.action((transactionId, options) => withAction('checking transaction', () => __awaiter(this, void 0, void 0, function* () {
|
|
139
140
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
140
141
|
const transaction = yield checkTransaction(options.book, transactionId);
|
|
141
|
-
renderItem(transaction
|
|
142
|
+
renderItem(yield transactionToJson(transaction));
|
|
142
143
|
}))());
|
|
143
144
|
transactionCommand
|
|
144
145
|
.command('uncheck <transactionId>')
|
|
145
146
|
.description('Uncheck a transaction')
|
|
146
147
|
.option('-b, --book <bookId>', 'Book ID')
|
|
147
|
-
.action((transactionId, options) => withAction('unchecking transaction', (
|
|
148
|
+
.action((transactionId, options) => withAction('unchecking transaction', () => __awaiter(this, void 0, void 0, function* () {
|
|
148
149
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
149
150
|
const transaction = yield uncheckTransaction(options.book, transactionId);
|
|
150
|
-
renderItem(transaction
|
|
151
|
+
renderItem(yield transactionToJson(transaction));
|
|
151
152
|
}))());
|
|
152
153
|
transactionCommand
|
|
153
154
|
.command('trash <transactionId>')
|
|
154
155
|
.description('Trash a transaction')
|
|
155
156
|
.option('-b, --book <bookId>', 'Book ID')
|
|
156
|
-
.action((transactionId, options) => withAction('trashing transaction', (
|
|
157
|
+
.action((transactionId, options) => withAction('trashing transaction', () => __awaiter(this, void 0, void 0, function* () {
|
|
157
158
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
158
159
|
const transaction = yield trashTransaction(options.book, transactionId);
|
|
159
|
-
renderItem(transaction
|
|
160
|
+
renderItem(yield transactionToJson(transaction));
|
|
160
161
|
}))());
|
|
161
162
|
transactionCommand
|
|
162
163
|
.command('untrash <transactionId>')
|
|
163
164
|
.description('Restore a transaction from the trash')
|
|
164
165
|
.option('-b, --book <bookId>', 'Book ID')
|
|
165
|
-
.action((transactionId, options) => withAction('restoring transaction', (
|
|
166
|
+
.action((transactionId, options) => withAction('restoring transaction', () => __awaiter(this, void 0, void 0, function* () {
|
|
166
167
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
167
168
|
const transaction = yield untrashTransaction(options.book, transactionId);
|
|
168
|
-
renderItem(transaction
|
|
169
|
+
renderItem(yield transactionToJson(transaction));
|
|
169
170
|
}))());
|
|
170
171
|
transactionCommand
|
|
171
172
|
.command('merge <transactionId1> <transactionId2>')
|
|
172
173
|
.description('Merge two transactions')
|
|
173
174
|
.option('-b, --book <bookId>', 'Book ID')
|
|
174
|
-
.action((transactionId1, transactionId2, options) => withAction('merging transactions', (
|
|
175
|
+
.action((transactionId1, transactionId2, options) => withAction('merging transactions', () => __awaiter(this, void 0, void 0, function* () {
|
|
175
176
|
throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
|
|
176
177
|
const transaction = yield mergeTransactions(options.book, transactionId1, transactionId2);
|
|
177
|
-
renderItem(transaction
|
|
178
|
+
renderItem(yield transactionToJson(transaction));
|
|
178
179
|
}))());
|
|
179
180
|
}
|
|
180
181
|
//# sourceMappingURL=register.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/transactions/register.ts"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/transactions/register.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAgB,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB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aAAa,CAAC,CAAC;QAC1E,UAAU,CAAC,MAAM,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;IACrD,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;IAEN,kBAAkB;SACb,OAAO,CAAC,yCAAyC,CAAC;SAClD,WAAW,CAAC,wBAAwB,CAAC;SACrC,MAAM,CAAC,qBAAqB,EAAE,SAAS,CAAC;SACxC,MAAM,CAAC,CAAC,cAAsB,EAAE,cAAsB,EAAE,OAAO,EAAE,EAAE,CAChE,UAAU,CAAC,sBAAsB,EAAE,GAAS,EAAE;QAC1C,aAAa,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QACpF,MAAM,WAAW,GAAG,MAAM,iBAAiB,CACvC,OAAO,CAAC,IAAI,EACZ,cAAc,EACd,cAAc,CACjB,CAAC;QACF,UAAU,CAAC,MAAM,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;IACrD,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;AACV,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Transaction } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Serializes a transaction for CLI output.
|
|
4
|
+
*
|
|
5
|
+
* Keeps the bkper-api-types shape (so output can be piped back into
|
|
6
|
+
* `transaction create/update`) and all data fields, with two changes:
|
|
7
|
+
* - `creditAccount.name` / `debitAccount.name` are added, so the from/to flow
|
|
8
|
+
* is readable without a separate account lookup.
|
|
9
|
+
* - Inline agent logos (`agentLogo`, `agentLogoDark`) are dropped: they are
|
|
10
|
+
* image payloads, not information, and dominate output size.
|
|
11
|
+
*
|
|
12
|
+
* @param transaction - The transaction to serialize
|
|
13
|
+
* @returns A new payload object; the transaction itself is not mutated
|
|
14
|
+
*/
|
|
15
|
+
export declare function transactionToJson(transaction: Transaction): Promise<bkper.Transaction>;
|
|
16
|
+
/**
|
|
17
|
+
* Serializes a list of transactions for CLI output.
|
|
18
|
+
*
|
|
19
|
+
* Runs sequentially so an account missing from the book cache is fetched once
|
|
20
|
+
* and then served from cache, instead of one parallel request per transaction.
|
|
21
|
+
*/
|
|
22
|
+
export declare function transactionsToJson(transactions: Transaction[]): Promise<bkper.Transaction[]>;
|
|
23
|
+
//# sourceMappingURL=transaction-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-json.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/transaction-json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAkB5F;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACpC,YAAY,EAAE,WAAW,EAAE,GAC5B,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAM9B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Serializes a transaction for CLI output.
|
|
12
|
+
*
|
|
13
|
+
* Keeps the bkper-api-types shape (so output can be piped back into
|
|
14
|
+
* `transaction create/update`) and all data fields, with two changes:
|
|
15
|
+
* - `creditAccount.name` / `debitAccount.name` are added, so the from/to flow
|
|
16
|
+
* is readable without a separate account lookup.
|
|
17
|
+
* - Inline agent logos (`agentLogo`, `agentLogoDark`) are dropped: they are
|
|
18
|
+
* image payloads, not information, and dominate output size.
|
|
19
|
+
*
|
|
20
|
+
* @param transaction - The transaction to serialize
|
|
21
|
+
* @returns A new payload object; the transaction itself is not mutated
|
|
22
|
+
*/
|
|
23
|
+
export function transactionToJson(transaction) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const json = Object.assign({}, transaction.json());
|
|
26
|
+
delete json.agentLogo;
|
|
27
|
+
delete json.agentLogoDark;
|
|
28
|
+
const [creditAccount, debitAccount] = yield Promise.all([
|
|
29
|
+
json.creditAccount ? transaction.getCreditAccount() : undefined,
|
|
30
|
+
json.debitAccount ? transaction.getDebitAccount() : undefined,
|
|
31
|
+
]);
|
|
32
|
+
if (json.creditAccount && creditAccount) {
|
|
33
|
+
json.creditAccount = Object.assign(Object.assign({}, json.creditAccount), { name: creditAccount.getName() });
|
|
34
|
+
}
|
|
35
|
+
if (json.debitAccount && debitAccount) {
|
|
36
|
+
json.debitAccount = Object.assign(Object.assign({}, json.debitAccount), { name: debitAccount.getName() });
|
|
37
|
+
}
|
|
38
|
+
return json;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Serializes a list of transactions for CLI output.
|
|
43
|
+
*
|
|
44
|
+
* Runs sequentially so an account missing from the book cache is fetched once
|
|
45
|
+
* and then served from cache, instead of one parallel request per transaction.
|
|
46
|
+
*/
|
|
47
|
+
export function transactionsToJson(transactions) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const result = [];
|
|
50
|
+
for (const transaction of transactions) {
|
|
51
|
+
result.push(yield transactionToJson(transaction));
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=transaction-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-json.js","sourceRoot":"","sources":["../../../src/commands/transactions/transaction-json.ts"],"names":[],"mappings":";;;;;;;;;AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAgB,iBAAiB,CAAC,WAAwB;;QAC5D,MAAM,IAAI,qBAA2B,WAAW,CAAC,IAAI,EAAE,CAAE,CAAC;QAC1D,OAAO,IAAI,CAAC,SAAS,CAAC;QACtB,OAAO,IAAI,CAAC,aAAa,CAAC;QAE1B,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACpD,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,SAAS;YAC/D,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS;SAChE,CAAC,CAAC;QAEH,IAAI,IAAI,CAAC,aAAa,IAAI,aAAa,EAAE,CAAC;YACtC,IAAI,CAAC,aAAa,mCAAQ,IAAI,CAAC,aAAa,KAAE,IAAI,EAAE,aAAa,CAAC,OAAO,EAAE,GAAE,CAAC;QAClF,CAAC;QACD,IAAI,IAAI,CAAC,YAAY,IAAI,YAAY,EAAE,CAAC;YACpC,IAAI,CAAC,YAAY,mCAAQ,IAAI,CAAC,YAAY,KAAE,IAAI,EAAE,YAAY,CAAC,OAAO,EAAE,GAAE,CAAC;QAC/E,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CAAA;AAED;;;;;GAKG;AACH,MAAM,UAAgB,kBAAkB,CACpC,YAA2B;;QAE3B,MAAM,MAAM,GAAwB,EAAE,CAAC;QACvC,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;YACrC,MAAM,CAAC,IAAI,CAAC,MAAM,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CAAA"}
|
package/lib/docs/apps/ai.md
CHANGED
|
@@ -6,10 +6,10 @@ This guide covers a server-side, non-streaming language response. It uses AI SDK
|
|
|
6
6
|
|
|
7
7
|
## Choose the kind of response
|
|
8
8
|
|
|
9
|
-
- **A bounded yes/no, choice, or score?** Use a typed evaluation
|
|
9
|
+
- **A bounded yes/no, choice, or score?** Use a typed evaluation at `POST /v1/evaluations`.
|
|
10
10
|
- **Generated text or a custom JSON object?** Use a language model at `POST /v1/responses`. AI SDK is an option for this path.
|
|
11
11
|
|
|
12
|
-
Pick a model of the corresponding `type` from the live [`GET /v1/models` catalog](https://ai.bkper.app/v1/models). The catalog also tells you which language models support strict structured output. AI SDK's **Open Responses provider** covers language responses, not Bkper's typed evaluation endpoint. For
|
|
12
|
+
Pick a model of the corresponding `type` from the live [`GET /v1/models` catalog](https://ai.bkper.app/v1/models). The catalog also tells you which language models support strict structured output. AI SDK's **Open Responses provider** covers language responses, not Bkper's typed evaluation endpoint. For evaluation models, use HTTP or implement an AI SDK evaluation-model adapter for `experimental_evaluate`, as `bkper-agent` does. See the [Typed Evaluations guide](https://bkper.com/docs/ai/evaluations.md) for requests, responses, decision thresholds, and errors, and the [Merge Duplicates app](https://github.com/bkper/bkper-apps/tree/main/merge-duplicates) for a human-reviewed HTTP example.
|
|
13
13
|
|
|
14
14
|
## Keep authentication in the platform
|
|
15
15
|
|