bkper 4.26.0 → 4.27.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 (40) hide show
  1. package/lib/commands/books/copy.d.ts +16 -0
  2. package/lib/commands/books/copy.d.ts.map +1 -0
  3. package/lib/commands/books/copy.js +48 -0
  4. package/lib/commands/books/copy.js.map +1 -0
  5. package/lib/commands/books/index.d.ts +1 -0
  6. package/lib/commands/books/index.d.ts.map +1 -1
  7. package/lib/commands/books/index.js +1 -0
  8. package/lib/commands/books/index.js.map +1 -1
  9. package/lib/commands/books/register.d.ts.map +1 -1
  10. package/lib/commands/books/register.js +16 -1
  11. package/lib/commands/books/register.js.map +1 -1
  12. package/lib/commands/transactions/get.d.ts +11 -0
  13. package/lib/commands/transactions/get.d.ts.map +1 -0
  14. package/lib/commands/transactions/get.js +30 -0
  15. package/lib/commands/transactions/get.js.map +1 -0
  16. package/lib/commands/transactions/index.d.ts +3 -0
  17. package/lib/commands/transactions/index.d.ts.map +1 -1
  18. package/lib/commands/transactions/index.js +3 -0
  19. package/lib/commands/transactions/index.js.map +1 -1
  20. package/lib/commands/transactions/register.d.ts.map +1 -1
  21. package/lib/commands/transactions/register.js +28 -1
  22. package/lib/commands/transactions/register.js.map +1 -1
  23. package/lib/commands/transactions/uncheck.d.ts +10 -0
  24. package/lib/commands/transactions/uncheck.d.ts.map +1 -0
  25. package/lib/commands/transactions/uncheck.js +29 -0
  26. package/lib/commands/transactions/uncheck.js.map +1 -0
  27. package/lib/commands/transactions/untrash.d.ts +10 -0
  28. package/lib/commands/transactions/untrash.d.ts.map +1 -0
  29. package/lib/commands/transactions/untrash.js +29 -0
  30. package/lib/commands/transactions/untrash.js.map +1 -0
  31. package/lib/dev/local-outbound.d.ts.map +1 -1
  32. package/lib/dev/local-outbound.js +17 -3
  33. package/lib/dev/local-outbound.js.map +1 -1
  34. package/lib/docs/apps/ai.md +270 -0
  35. package/lib/docs/apps/configuration.md +3 -1
  36. package/lib/docs/apps/context-menu.md +47 -0
  37. package/lib/docs/apps/overview.md +6 -0
  38. package/lib/docs/cli/data-management.md +22 -0
  39. package/lib/docs/index.md +1 -0
  40. package/package.json +1 -1
@@ -0,0 +1,16 @@
1
+ import { Book } from 'bkper-js';
2
+ /** Options for copying a Bkper book. */
3
+ export interface CopyBookOptions {
4
+ name: string;
5
+ transactions?: boolean;
6
+ fromDate?: string;
7
+ }
8
+ /**
9
+ * Copies a book, optionally including transactions from an ISO date.
10
+ *
11
+ * @param bookId - The source book ID
12
+ * @param options - Copy configuration
13
+ * @returns The copied book
14
+ */
15
+ export declare function copyBook(bookId: string, options: CopyBookOptions): Promise<Book>;
16
+ //# sourceMappingURL=copy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../../src/commands/books/copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,wCAAwC;AACxC,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAStF"}
@@ -0,0 +1,48 @@
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
+ import { getBkperInstance } from '../../bkper-factory.js';
11
+ /**
12
+ * Copies a book, optionally including transactions from an ISO date.
13
+ *
14
+ * @param bookId - The source book ID
15
+ * @param options - Copy configuration
16
+ * @returns The copied book
17
+ */
18
+ export function copyBook(bookId, options) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ var _a;
21
+ if (options.fromDate !== undefined && !options.transactions) {
22
+ throw new Error('--from-date requires --transactions');
23
+ }
24
+ const fromDate = parseFromDate(options.fromDate);
25
+ const bkper = getBkperInstance();
26
+ const sourceBook = yield bkper.getBook(bookId);
27
+ return sourceBook.copy(options.name, (_a = options.transactions) !== null && _a !== void 0 ? _a : false, fromDate);
28
+ });
29
+ }
30
+ function parseFromDate(value) {
31
+ if (value === undefined) {
32
+ return undefined;
33
+ }
34
+ const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
35
+ if (match) {
36
+ const year = Number(match[1]);
37
+ const month = Number(match[2]);
38
+ const day = Number(match[3]);
39
+ const date = new Date(Date.UTC(year, month - 1, day));
40
+ if (date.getUTCFullYear() === year &&
41
+ date.getUTCMonth() === month - 1 &&
42
+ date.getUTCDate() === day) {
43
+ return year * 10000 + month * 100 + day;
44
+ }
45
+ }
46
+ throw new Error(`Invalid --from-date: ${value}. Expected a valid date in YYYY-MM-DD format`);
47
+ }
48
+ //# sourceMappingURL=copy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy.js","sourceRoot":"","sources":["../../../src/commands/books/copy.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAS1D;;;;;;GAMG;AACH,MAAM,UAAgB,QAAQ,CAAC,MAAc,EAAE,OAAwB;;;QACnE,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;YAC1D,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAC3D,CAAC;QAED,MAAM,QAAQ,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atted } from './list.js';
2
2
  export { getBook } from './get.js';
3
3
  export { createBook, CreateBookOptions } from './create.js';
4
+ export { copyBook, CopyBookOptions } from './copy.js';
4
5
  export { updateBook, UpdateBookOptions } from './update.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/books/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/books/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export { listBooks, listBooksFormatted } from './list.js';
2
2
  export { getBook } from './get.js';
3
3
  export { createBook } from './create.js';
4
+ export { copyBook } from './copy.js';
4
5
  export { updateBook } from './update.js';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/books/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,UAAU,EAAqB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAqB,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/books/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,UAAU,EAAqB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAmB,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,UAAU,EAAqB,MAAM,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/books/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwF3D"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/books/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0G3D"}
@@ -11,7 +11,7 @@ import { withAction } from '../action.js';
11
11
  import { collectProperty } from '../cli-helpers.js';
12
12
  import { renderListResult, renderItem } from '../../render/index.js';
13
13
  import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
14
- import { listBooksFormatted, getBook, createBook, updateBook } from './index.js';
14
+ import { listBooksFormatted, getBook, createBook, copyBook, updateBook } from './index.js';
15
15
  export function registerBookCommands(program) {
16
16
  const bookCommand = program.command('book').description('Manage Books');
17
17
  bookCommand
@@ -52,6 +52,21 @@ export function registerBookCommands(program) {
52
52
  });
53
53
  renderItem(book.json(), format);
54
54
  }))());
55
+ bookCommand
56
+ .command('copy <bookId>')
57
+ .description('Copy a book')
58
+ .option('--name <name>', 'Name for the copied book')
59
+ .option('--transactions', 'Copy transactions (source book owner only)')
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* () {
62
+ throwIfErrors(validateRequiredOptions(options, [{ name: 'name', flag: '--name' }]));
63
+ const book = yield copyBook(bookId, {
64
+ name: options.name,
65
+ transactions: options.transactions,
66
+ fromDate: options.fromDate,
67
+ });
68
+ renderItem(book.json(), format);
69
+ }))());
55
70
  bookCommand
56
71
  .command('update <bookId>')
57
72
  .description('Update a book')
@@ -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,UAAU,EAAE,MAAM,YAAY,CAAC;AAEjF,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACjD,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAExE,WAAW;SACN,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,gBAAgB,CAAC;SAC7B,MAAM,CAAC,qBAAqB,EAAE,cAAc,CAAC;SAC7C,MAAM,CAAC,OAAO,CAAC,EAAE,CACd,UAAU,CAAC,eAAe,EAAE,CAAM,MAAM,EAAC,EAAE;QACvC,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,OAAO,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AC;SACpE,MAAM,CAAC,uBAAuB,EAAE,yCAAyC,CAAC;SAC1E,MAAM,CAAC,mBAAmB,EAAE,kCAAkC,CAAC;SAC/D,MAAM,CACH,4BAA4B,EAC5B,kDAAkD,EAClD,eAAe,CAClB;SACA,MAAM,CAAC,CAAC,MAAc,EAAE,OAAO,EAAE,EAAE,CAChC,UAAU,CAAC,eAAe,EAAE,CAAM,MAAM,EAAC,EAAE;QACvC,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,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;AACV,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { Transaction } from 'bkper-js';
2
+ /**
3
+ * Retrieves a single transaction by ID from the specified book.
4
+ *
5
+ * @param bookId - The target book ID
6
+ * @param transactionId - Transaction ID to look up
7
+ * @returns The matching transaction
8
+ * @throws Error if the transaction is not found
9
+ */
10
+ export declare function getTransaction(bookId: string, transactionId: string): Promise<Transaction>;
11
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAChC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GACtB,OAAO,CAAC,WAAW,CAAC,CAQtB"}
@@ -0,0 +1,30 @@
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
+ import { getBkperInstance } from '../../bkper-factory.js';
11
+ /**
12
+ * Retrieves a single transaction by ID from the specified book.
13
+ *
14
+ * @param bookId - The target book ID
15
+ * @param transactionId - Transaction ID to look up
16
+ * @returns The matching transaction
17
+ * @throws Error if the transaction is not found
18
+ */
19
+ export function getTransaction(bookId, transactionId) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ const bkper = getBkperInstance();
22
+ const book = yield bkper.getBook(bookId);
23
+ const transaction = yield book.getTransaction(transactionId);
24
+ if (!transaction) {
25
+ throw new Error(`Transaction not found: ${transactionId}`);
26
+ }
27
+ return transaction;
28
+ });
29
+ }
30
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/transactions/get.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,UAAgB,cAAc,CAChC,MAAc,EACd,aAAqB;;QAErB,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;QAC7D,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,0BAA0B,aAAa,EAAE,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,WAAW,CAAC;IACvB,CAAC;CAAA"}
@@ -1,9 +1,12 @@
1
1
  export { listTransactions, listTransactionsFormatted, ListTransactionsOptions, ListTransactionsResult, } from './list.js';
2
+ export { getTransaction } from './get.js';
2
3
  export { createTransaction, CreateTransactionOptions, resolveCreateTransactionFilePath, } from './create.js';
3
4
  export { updateTransaction, UpdateTransactionOptions } from './update.js';
4
5
  export { postTransaction } from './post.js';
5
6
  export { checkTransaction } from './check.js';
7
+ export { uncheckTransaction } from './uncheck.js';
6
8
  export { trashTransaction } from './trash.js';
9
+ export { untrashTransaction } from './untrash.js';
7
10
  export { mergeTransactions } from './merge.js';
8
11
  export { batchCreateTransactions } from './batch-create.js';
9
12
  export { batchUpdateTransactions } from './batch-update.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,yBAAyB,EACzB,uBAAuB,EACvB,sBAAsB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACH,iBAAiB,EACjB,wBAAwB,EACxB,gCAAgC,GACnC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,yBAAyB,EACzB,uBAAuB,EACvB,sBAAsB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EACH,iBAAiB,EACjB,wBAAwB,EACxB,gCAAgC,GACnC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,9 +1,12 @@
1
1
  export { listTransactions, listTransactionsFormatted, } from './list.js';
2
+ export { getTransaction } from './get.js';
2
3
  export { createTransaction, resolveCreateTransactionFilePath, } from './create.js';
3
4
  export { updateTransaction } from './update.js';
4
5
  export { postTransaction } from './post.js';
5
6
  export { checkTransaction } from './check.js';
7
+ export { uncheckTransaction } from './uncheck.js';
6
8
  export { trashTransaction } from './trash.js';
9
+ export { untrashTransaction } from './untrash.js';
7
10
  export { mergeTransactions } from './merge.js';
8
11
  export { batchCreateTransactions } from './batch-create.js';
9
12
  export { batchUpdateTransactions } from './batch-update.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/transactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,yBAAyB,GAG5B,MAAM,WAAW,CAAC;AACnB,OAAO,EACH,iBAAiB,EAEjB,gCAAgC,GACnC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAA4B,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/transactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,yBAAyB,GAG5B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EACH,iBAAiB,EAEjB,gCAAgC,GACnC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAA4B,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBzC,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiMlE"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsBzC,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqOlE"}
@@ -12,7 +12,7 @@ import { collectProperty, collectRepeatable, parsePositiveInteger } from '../cli
12
12
  import { renderListResult, renderItem } from '../../render/index.js';
13
13
  import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
14
14
  import { parseStdinItems } from '../../input/index.js';
15
- import { listTransactionsFormatted, createTransaction, updateTransaction, postTransaction, checkTransaction, trashTransaction, mergeTransactions, batchCreateTransactions, batchUpdateTransactions, resolveCreateTransactionFilePath, } from './index.js';
15
+ import { listTransactionsFormatted, getTransaction, createTransaction, updateTransaction, postTransaction, checkTransaction, uncheckTransaction, trashTransaction, untrashTransaction, mergeTransactions, batchCreateTransactions, batchUpdateTransactions, resolveCreateTransactionFilePath, } from './index.js';
16
16
  export function registerTransactionCommands(program) {
17
17
  const transactionCommand = program.command('transaction').description('Manage Transactions');
18
18
  transactionCommand
@@ -36,6 +36,15 @@ export function registerTransactionCommands(program) {
36
36
  }, format);
37
37
  renderListResult(result, format);
38
38
  }))());
39
+ transactionCommand
40
+ .command('get <transactionId>')
41
+ .description('Get a transaction by ID')
42
+ .option('-b, --book <bookId>', 'Book ID')
43
+ .action((transactionId, options) => withAction('getting transaction', (format) => __awaiter(this, void 0, void 0, function* () {
44
+ throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
45
+ const transaction = yield getTransaction(options.book, transactionId);
46
+ renderItem(transaction.json(), format);
47
+ }))());
39
48
  transactionCommand
40
49
  .command('create')
41
50
  .description('Create a transaction')
@@ -131,6 +140,15 @@ export function registerTransactionCommands(program) {
131
140
  const transaction = yield checkTransaction(options.book, transactionId);
132
141
  renderItem(transaction.json(), format);
133
142
  }))());
143
+ transactionCommand
144
+ .command('uncheck <transactionId>')
145
+ .description('Uncheck a transaction')
146
+ .option('-b, --book <bookId>', 'Book ID')
147
+ .action((transactionId, options) => withAction('unchecking transaction', (format) => __awaiter(this, void 0, void 0, function* () {
148
+ throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
149
+ const transaction = yield uncheckTransaction(options.book, transactionId);
150
+ renderItem(transaction.json(), format);
151
+ }))());
134
152
  transactionCommand
135
153
  .command('trash <transactionId>')
136
154
  .description('Trash a transaction')
@@ -140,6 +158,15 @@ export function registerTransactionCommands(program) {
140
158
  const transaction = yield trashTransaction(options.book, transactionId);
141
159
  renderItem(transaction.json(), format);
142
160
  }))());
161
+ transactionCommand
162
+ .command('untrash <transactionId>')
163
+ .description('Restore a transaction from the trash')
164
+ .option('-b, --book <bookId>', 'Book ID')
165
+ .action((transactionId, options) => withAction('restoring transaction', (format) => __awaiter(this, void 0, void 0, function* () {
166
+ throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
167
+ const transaction = yield untrashTransaction(options.book, transactionId);
168
+ renderItem(transaction.json(), format);
169
+ }))());
143
170
  transactionCommand
144
171
  .command('merge <transactionId1> <transactionId2>')
145
172
  .description('Merge two transactions')
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/transactions/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB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EAAE,OAAO,EAAE,EAAE,CAChE,UAAU,CAAC,sBAAsB,EAAE,CAAM,MAAM,EAAC,EAAE;QAC9C,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,WAAW,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;AACV,CAAC"}
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/transactions/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACH,yBAAyB,EACzB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,EACvB,gCAAgC,GACnC,MAAM,YAAY,CAAC;AAEpB,MAAM,UAAU,2BAA2B,CAAC,OAAgB;IACxD,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAE7F,kBAAkB;SACb,OAAO,CAAC,MAAM,CAAC;SACf,WAAW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AC,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,WAAW,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;AACV,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Transaction } from 'bkper-js';
2
+ /**
3
+ * Marks a checked transaction as unchecked (editable).
4
+ *
5
+ * @param bookId - The book ID containing the transaction
6
+ * @param transactionId - The ID of the transaction to uncheck
7
+ * @returns The unchecked transaction
8
+ */
9
+ export declare function uncheckTransaction(bookId: string, transactionId: string): Promise<Transaction>;
10
+ //# sourceMappingURL=uncheck.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uncheck.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/uncheck.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACpC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GACtB,OAAO,CAAC,WAAW,CAAC,CAQtB"}
@@ -0,0 +1,29 @@
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
+ import { getBkperInstance } from '../../bkper-factory.js';
11
+ /**
12
+ * Marks a checked transaction as unchecked (editable).
13
+ *
14
+ * @param bookId - The book ID containing the transaction
15
+ * @param transactionId - The ID of the transaction to uncheck
16
+ * @returns The unchecked transaction
17
+ */
18
+ export function uncheckTransaction(bookId, transactionId) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ const bkper = getBkperInstance();
21
+ const book = yield bkper.getBook(bookId);
22
+ const transaction = yield book.getTransaction(transactionId);
23
+ if (!transaction) {
24
+ throw new Error(`Transaction not found: ${transactionId}`);
25
+ }
26
+ return transaction.uncheck();
27
+ });
28
+ }
29
+ //# sourceMappingURL=uncheck.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uncheck.js","sourceRoot":"","sources":["../../../src/commands/transactions/uncheck.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;;;;;GAMG;AACH,MAAM,UAAgB,kBAAkB,CACpC,MAAc,EACd,aAAqB;;QAErB,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;QAC7D,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,0BAA0B,aAAa,EAAE,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,WAAW,CAAC,OAAO,EAAE,CAAC;IACjC,CAAC;CAAA"}
@@ -0,0 +1,10 @@
1
+ import { Transaction } from 'bkper-js';
2
+ /**
3
+ * Restores a transaction from the trash.
4
+ *
5
+ * @param bookId - The book ID containing the transaction
6
+ * @param transactionId - The ID of the transaction to restore
7
+ * @returns The restored transaction
8
+ */
9
+ export declare function untrashTransaction(bookId: string, transactionId: string): Promise<Transaction>;
10
+ //# sourceMappingURL=untrash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"untrash.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/untrash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACpC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GACtB,OAAO,CAAC,WAAW,CAAC,CAQtB"}
@@ -0,0 +1,29 @@
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
+ import { getBkperInstance } from '../../bkper-factory.js';
11
+ /**
12
+ * Restores a transaction from the trash.
13
+ *
14
+ * @param bookId - The book ID containing the transaction
15
+ * @param transactionId - The ID of the transaction to restore
16
+ * @returns The restored transaction
17
+ */
18
+ export function untrashTransaction(bookId, transactionId) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ const bkper = getBkperInstance();
21
+ const book = yield bkper.getBook(bookId);
22
+ const transaction = yield book.getTransaction(transactionId);
23
+ if (!transaction) {
24
+ throw new Error(`Transaction not found: ${transactionId}`);
25
+ }
26
+ return transaction.untrash();
27
+ });
28
+ }
29
+ //# sourceMappingURL=untrash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"untrash.js","sourceRoot":"","sources":["../../../src/commands/transactions/untrash.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;;;;;GAMG;AACH,MAAM,UAAgB,kBAAkB,CACpC,MAAc,EACd,aAAqB;;QAErB,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;QAC7D,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,0BAA0B,aAAa,EAAE,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,WAAW,CAAC,OAAO,EAAE,CAAC;IACjC,CAAC;CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"local-outbound.d.ts","sourceRoot":"","sources":["../../src/dev/local-outbound.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE3E,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACnD,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC1D;AAMD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,oBAAoB,GAAG,oBAAoB,CA0B9F"}
1
+ {"version":3,"file":"local-outbound.d.ts","sourceRoot":"","sources":["../../src/dev/local-outbound.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE3E,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACnD,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC1D;AAMD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,oBAAoB,GAAG,oBAAoB,CA8B9F"}
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { AUTHENTICATION_REQUIRED_MESSAGE } from '../auth/auth-errors.js';
11
11
  import { getStoredOAuthToken } from '../auth/local-auth-service.js';
12
12
  const PUBLIC_BKPER_API_HOST = 'api.bkper.app';
13
+ const BKPER_AI_HOSTS = new Set(['ai.bkper.app', 'ai-dev.bkper.app']);
13
14
  const PLATFORM_SESSION_COOKIE_NAMES = new Set([
14
15
  'bkper_session',
15
16
  'bkper_session_dev',
@@ -20,7 +21,8 @@ export function createLocalOutboundService(options) {
20
21
  const getAccessToken = (_a = options.getAccessToken) !== null && _a !== void 0 ? _a : getStoredOAuthToken;
21
22
  const forwardFetch = (_b = options.forwardFetch) !== null && _b !== void 0 ? _b : ((request) => fetch(request));
22
23
  return (request) => __awaiter(this, void 0, void 0, function* () {
23
- if (!isAllowedBkperApiRequest(request)) {
24
+ const service = getAuthorizedBkperService(request);
25
+ if (!service) {
24
26
  return forwardFetch(createForwardRequest(request, new Headers(request.headers), request.redirect));
25
27
  }
26
28
  const accessToken = normalizeBearerToken(yield getAccessToken());
@@ -33,6 +35,9 @@ export function createLocalOutboundService(options) {
33
35
  const headers = new Headers(request.headers);
34
36
  headers.set('Authorization', `Bearer ${accessToken}`);
35
37
  headers.set('bkper-agent-id', options.appId);
38
+ if (service === 'ai') {
39
+ headers.set('bkper-ai-source', options.appId);
40
+ }
36
41
  stripPlatformCookieHeaders(headers);
37
42
  return forwardFetch(createForwardRequest(request, headers, 'manual'));
38
43
  });
@@ -51,9 +56,18 @@ function createForwardRequest(request, headers, redirect) {
51
56
  }
52
57
  return new Request(request.url, init);
53
58
  }
54
- function isAllowedBkperApiRequest(request) {
59
+ function getAuthorizedBkperService(request) {
55
60
  const url = new URL(request.url);
56
- return url.protocol === 'https:' && url.host === PUBLIC_BKPER_API_HOST;
61
+ if (url.protocol !== 'https:') {
62
+ return undefined;
63
+ }
64
+ if (url.host === PUBLIC_BKPER_API_HOST) {
65
+ return 'api';
66
+ }
67
+ if (BKPER_AI_HOSTS.has(url.host)) {
68
+ return 'ai';
69
+ }
70
+ return undefined;
57
71
  }
58
72
  function normalizeBearerToken(token) {
59
73
  const trimmed = token === null || token === void 0 ? void 0 : token.trim();
@@ -1 +1 @@
1
- {"version":3,"file":"local-outbound.js","sourceRoot":"","sources":["../../src/dev/local-outbound.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAC9C,MAAM,6BAA6B,GAAG,IAAI,GAAG,CAAC;IAC1C,eAAe;IACf,mBAAmB;IACnB,qBAAqB;CACxB,CAAC,CAAC;AAcH,MAAM,UAAU,0BAA0B,CAAC,OAA6B;;IACpE,MAAM,cAAc,GAAG,MAAA,OAAO,CAAC,cAAc,mCAAI,mBAAmB,CAAC;IACrE,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,YAAY,mCAAI,CAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAEpF,OAAO,CAAO,OAAgB,EAAqB,EAAE;QACjD,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,CAAC;YACrC,OAAO,YAAY,CACf,oBAAoB,CAAC,OAAO,EAAE,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAChF,CAAC;QACN,CAAC;QAED,MAAM,WAAW,GAAG,oBAAoB,CAAC,MAAM,cAAc,EAAE,CAAC,CAAC;QACjE,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,O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KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,0CAAE,IAAI,GAAG,WAAW,EAAE,CAAC;IACrE,OAAO,6BAA6B,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,270 @@
1
+ # Add Bkper AI to an App
2
+
3
+ Bkper AI is the preferred inference provider for Bkper Platform apps. It uses the authenticated user's included AI allowance, attributes usage to the app, and does not require the app to store provider credentials.
4
+
5
+ Use another provider only when Bkper AI lacks a required capability, model, compliance boundary, or customer-mandated provider. External providers require their own authentication, secrets, billing, and privacy review.
6
+
7
+ This guide covers the preferred current pattern: a non-streaming response with strict structured output. Streaming, tool calls, file inputs, and agent runtimes require additional design.
8
+
9
+ ## Request flow
10
+
11
+ Keep model calls behind the app's typed `/api/*` contract:
12
+
13
+ 1. The web client calls an app `/api/*` route with a Bkper bearer token. The template's `auth.authenticatedFetch()` handles this.
14
+ 2. Bkper validates the token, mounts the user and app identity as outbound context, and removes the token before invoking the app Worker.
15
+ 3. The Worker calls `https://ai.bkper.app/v1/*` without reading, storing, or forwarding the token.
16
+ 4. Platform outbound injects Bkper authorization and overwrites `bkper-agent-id` and `bkper-ai-source` with the authenticated app identity.
17
+
18
+ Event handlers use the same Worker-to-Bkper-AI step. Their outbound context comes from the authenticated Bkper event. A normal page request does not establish user outbound context, so start interactive inference from an authenticated `/api/*` route rather than a page handler.
19
+
20
+ ## Call the app API from the client
21
+
22
+ Use the authenticated fetch provider already configured by the app template:
23
+
24
+ ```ts
25
+ interface AnalyzeRequest {
26
+ first: {
27
+ date: string;
28
+ amount: string;
29
+ description: string;
30
+ fromAccount: string | null;
31
+ toAccount: string | null;
32
+ };
33
+ second: {
34
+ date: string;
35
+ amount: string;
36
+ description: string;
37
+ fromAccount: string | null;
38
+ toAccount: string | null;
39
+ };
40
+ }
41
+
42
+ export async function analyzePair(auth: AuthProvider, request: AnalyzeRequest): Promise {
43
+ return auth.authenticatedFetch('/api/v1/analyze', {
44
+ method: 'POST',
45
+ headers: { 'content-type': 'application/json' },
46
+ body: JSON.stringify(request),
47
+ });
48
+ }
49
+ ```
50
+
51
+ In a full app, define this operation in the server's Zod/OpenAPI schemas and call it through the generated typed client. The important boundary is that the client authenticates the app API request; the Worker never handles that bearer token directly.
52
+
53
+ ## Discover the current default model
54
+
55
+ The live model catalog is authoritative. It publishes the current default, model IDs, modalities, structured-output support, reasoning levels, context and output limits, and effective usage rates.
56
+
57
+ ```ts
58
+ const AI_BASE_URL = 'https://ai.bkper.app/v1';
59
+ type Fetcher = (input: RequestInfo | URL, init?: RequestInit) => Promise;
60
+
61
+ function isRecord(value: unknown): value is Record<string, unknown> {
62
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
63
+ }
64
+
65
+ export async function getStructuredOutputModel(fetcher: Fetcher = fetch): Promise<string> {
66
+ const response = await fetcher(`${AI_BASE_URL}/models`);
67
+ if (!response.ok) {
68
+ throw new Error(`Bkper AI model discovery failed (${response.status}).`);
69
+ }
70
+
71
+ const catalog: unknown = await response.json();
72
+ if (
73
+ !isRecord(catalog) ||
74
+ typeof catalog.default_model !== 'string' ||
75
+ !Array.isArray(catalog.data)
76
+ ) {
77
+ throw new Error('Bkper AI returned an invalid model catalog.');
78
+ }
79
+
80
+ const defaultModel = catalog.default_model;
81
+ const model = catalog.data.find(item => isRecord(item) && item.id === defaultModel);
82
+ if (
83
+ !isRecord(model) ||
84
+ !isRecord(model.structured_output) ||
85
+ model.structured_output.json_schema !== true ||
86
+ model.structured_output.strict !== true
87
+ ) {
88
+ throw new Error('The default Bkper AI model does not support strict structured output.');
89
+ }
90
+ return defaultModel;
91
+ }
92
+ ```
93
+
94
+ This example uses `default_model` after validating the capability required by the request. If an app requires another modality, file type, reasoning level, or limit, intentionally select and validate another model from the catalog's `data` array. Apps may cache the catalog briefly rather than fetching it for every inference request.
95
+
96
+ ## Request strict structured output
97
+
98
+ Keep inference in a server service and make `fetch` injectable for unit tests. This example sends only the transaction facts needed for duplicate evaluation. It omits transaction IDs, Account IDs, unrelated properties, and other Book data.
99
+
100
+ ```ts
101
+ const EvaluationJsonSchema = {
102
+ type: 'object',
103
+ properties: {
104
+ duplicate: { type: 'boolean' },
105
+ strength: { type: 'string', enum: ['Strong', 'Possible'] },
106
+ explanation: { type: 'string', maxLength: 180 },
107
+ },
108
+ required: ['duplicate', 'strength', 'explanation'],
109
+ additionalProperties: false,
110
+ } as const;
111
+
112
+ export interface DuplicateEvaluation {
113
+ duplicate: boolean;
114
+ strength: 'Strong' | 'Possible';
115
+ explanation: string;
116
+ }
117
+
118
+ export class BkperAiError extends Error {
119
+ constructor(
120
+ readonly status: number,
121
+ readonly code: string,
122
+ message: string
123
+ ) {
124
+ super(message);
125
+ this.name = 'BkperAiError';
126
+ }
127
+ }
128
+
129
+ export async function evaluateDuplicate(
130
+ candidate: AnalyzeRequest,
131
+ fetcher: Fetcher = fetch
132
+ ): Promise {
133
+ const model = await getStructuredOutputModel(fetcher);
134
+ const response = await fetcher(`${AI_BASE_URL}/responses`, {
135
+ method: 'POST',
136
+ headers: { 'content-type': 'application/json' },
137
+ body: JSON.stringify({
138
+ model,
139
+ instructions:
140
+ 'Decide whether both records represent the same movement. ' +
141
+ 'Return Strong only when the evidence is compelling.',
142
+ input: [
143
+ {
144
+ role: 'user',
145
+ content: [
146
+ {
147
+ type: 'input_text',
148
+ text: JSON.stringify(candidate),
149
+ },
150
+ ],
151
+ },
152
+ ],
153
+ text: {
154
+ format: {
155
+ type: 'json_schema',
156
+ name: 'duplicate_evaluation',
157
+ schema: EvaluationJsonSchema,
158
+ strict: true,
159
+ },
160
+ },
161
+ stream: false,
162
+ store: false,
163
+ }),
164
+ });
165
+
166
+ const payload: unknown = await response.json();
167
+ if (!response.ok) {
168
+ const error = readAiError(payload);
169
+ throw new BkperAiError(response.status, error.code, error.message);
170
+ }
171
+
172
+ const value: unknown = JSON.parse(getOutputText(payload));
173
+ if (!isDuplicateEvaluation(value)) {
174
+ throw new Error('Bkper AI output did not match the required schema.');
175
+ }
176
+ return value;
177
+ }
178
+ ```
179
+
180
+ Do not add an `Authorization`, `bkper-agent-id`, or `bkper-ai-source` header to the Worker's Bkper AI request. Platform outbound derives those values from the authenticated app request or event and overwrites them before dispatch.
181
+
182
+ ## Validate the response and preserve errors
183
+
184
+ Strict structured output constrains generation, but the app must still parse and validate the returned value before using it.
185
+
186
+ ```ts
187
+ function getOutputText(payload: unknown): string {
188
+ if (!isRecord(payload) || payload.status !== 'completed' || !Array.isArray(payload.output)) {
189
+ throw new Error('Bkper AI did not return a complete response.');
190
+ }
191
+
192
+ const texts: string[] = [];
193
+ for (const item of payload.output) {
194
+ if (!isRecord(item) || item.type !== 'message' || !Array.isArray(item.content)) continue;
195
+ for (const part of item.content) {
196
+ if (isRecord(part) && part.type === 'output_text' && typeof part.text === 'string') {
197
+ texts.push(part.text);
198
+ }
199
+ }
200
+ }
201
+ if (texts.length === 0) throw new Error('Bkper AI returned no output text.');
202
+ return texts.join('');
203
+ }
204
+
205
+ function isDuplicateEvaluation(value: unknown): value is DuplicateEvaluation {
206
+ return (
207
+ isRecord(value) &&
208
+ typeof value.duplicate === 'boolean' &&
209
+ (value.strength === 'Strong' || value.strength === 'Possible') &&
210
+ typeof value.explanation === 'string' &&
211
+ value.explanation.length <= 180
212
+ );
213
+ }
214
+
215
+ function readAiError(payload: unknown): { code: string; message: string } {
216
+ if (
217
+ isRecord(payload) &&
218
+ isRecord(payload.error) &&
219
+ typeof payload.error.code === 'string' &&
220
+ typeof payload.error.message === 'string'
221
+ ) {
222
+ return { code: payload.error.code, message: payload.error.message };
223
+ }
224
+ return { code: 'bkper_ai_error', message: 'Bkper AI request failed.' };
225
+ }
226
+ ```
227
+
228
+ Preserve the upstream HTTP status, error code, and message when mapping a `BkperAiError` into the app's typed error envelope. Bkper AI centralizes actionable messages such as allowance guidance and pricing links. Bot event responses may reuse that message directly when the surface supports it. Interactive apps can use the status and code to provide a tailored experience without duplicating the upstream policy or CTA.
229
+
230
+ ## Test the boundary
231
+
232
+ Use a mocked `fetch` to protect the integration contract without making live model calls:
233
+
234
+ ```ts
235
+ expect(capturedRequest.headers.get('authorization')).toBeNull();
236
+ expect(requestBody.store).toBe(false);
237
+ expect(requestBody.stream).toBe(false);
238
+ expect(requestBody.text).toMatchObject({
239
+ format: { type: 'json_schema', strict: true },
240
+ });
241
+ ```
242
+
243
+ Also test that the service:
244
+
245
+ - validates that the catalog's `default_model` supports strict structured output;
246
+ - rejects malformed or schema-incompatible output;
247
+ - preserves Bkper AI error status, code, and message;
248
+ - does not send internal identifiers or unrelated Book data.
249
+
250
+ ## Implementation checklist
251
+
252
+ Before considering the integration complete:
253
+
254
+ - [ ] The client calls a typed `/api/*` route through authenticated fetch.
255
+ - [ ] Worker code never reads, stores, or forwards the Bkper bearer token.
256
+ - [ ] The app discovers models from `GET /v1/models` and intentionally chooses a returned ID.
257
+ - [ ] Inference runs in a server service with an injectable `fetch`.
258
+ - [ ] The request uses strict structured output, `stream: false`, and `store: false`.
259
+ - [ ] Only data required for the task is sent to inference.
260
+ - [ ] Returned JSON is parsed and independently validated.
261
+ - [ ] Error status, code, and message remain available to the caller.
262
+ - [ ] Unit tests cover the request, response, validation, and error boundaries.
263
+ - [ ] The app's normal `npm run check` or `bun run check` succeeds.
264
+
265
+ ## Next steps
266
+
267
+ - [Read the client-agnostic Bkper AI Provider guide](https://bkper.com/docs/ai/bkper-ai-provider.md) for privacy boundaries, the complete supported profile, and advanced features.
268
+ - [Inspect the live model catalog](https://ai.bkper.app/v1/models).
269
+ - [Browse the generated AI API reference](https://bkper.com/docs/api/ai.md) when exact request or response schema details are needed.
270
+ - [Review the Merge Duplicates implementation](https://github.com/bkper/bkper-apps/tree/main/merge-duplicates) for a platform-app example with deterministic candidate filtering, strict structured output, and human-confirmed merges.
@@ -95,7 +95,9 @@ deployment:
95
95
  | `menuText` | Custom menu text (defaults to app name). |
96
96
  | `menuOpenMode` | How the app menu opens: `SIDEBAR` (default), `EXPANDED`, or `NEW_TAB`. |
97
97
 
98
- See [Context Menu](https://bkper.com/docs/build/apps/context-menu.md) for details on building menu integrations.
98
+ `SIDEBAR` and `EXPANDED` Apps can receive live context updates while their iframe stays loaded. `NEW_TAB` Apps receive context only in the URL used to open the tab.
99
+
100
+ See [Context Menu](https://bkper.com/docs/build/apps/context-menu.md#live-context-updates) for menu URL configuration and live context updates.
99
101
 
100
102
  ### Menu URL variables
101
103
 
@@ -53,6 +53,53 @@ menuOpenMode: SIDEBAR
53
53
  | `EXPANDED` | Opens in a wider panel with more room for complex UIs. |
54
54
  | `NEW_TAB` | Opens the menu URL in a new browser tab instead of an embedded panel. |
55
55
 
56
+ ### Live context updates
57
+
58
+ Bkper keeps embedded Apps informed of context changes without reloading the iframe, allowing them to preserve their current state. For Apps opened in `SIDEBAR` or `EXPANDED`, Bkper communicates those changes by sending the updated App URL to the iframe when its origin remains the same:
59
+
60
+ ```js
61
+ {
62
+ type: 'bkper:app-url-changed',
63
+ url: 'https://my-app.bkper.app?bookId=abc123&query=account:Sales',
64
+ }
65
+ ```
66
+
67
+ Listen for the message in the App:
68
+
69
+ ```js
70
+ const BKPER_ORIGIN = 'https://bkper.app';
71
+
72
+ window.addEventListener('message', event => {
73
+ // Verify that the trusted Bkper parent sent the message.
74
+ if (event.source !== window.parent || event.origin !== BKPER_ORIGIN) return;
75
+
76
+ // Verify that this is a valid App URL update.
77
+ const message = event.data;
78
+ if (message?.type !== 'bkper:app-url-changed' || typeof message.url !== 'string') return;
79
+
80
+ // Parse the updated URL, ignoring malformed URL strings.
81
+ let nextUrl;
82
+ try {
83
+ nextUrl = new URL(message.url);
84
+
85
+ // Accept only URLs belonging to this App.
86
+ if (nextUrl.origin !== window.location.origin) return;
87
+ } catch {
88
+ return;
89
+ }
90
+
91
+ // Keep the iframe URL in sync without reloading it.
92
+ window.history.replaceState(window.history.state, '', nextUrl);
93
+
94
+ // Apply the validated context update.
95
+ handleAppUrlChange(nextUrl);
96
+ });
97
+ ```
98
+
99
+ `handleAppUrlChange` is App logic. The App can update internal state, notify components, refresh data, change its UI, or ignore the message. Bkper only communicates the new URL; it does not reload the iframe or apply the context inside the App.
100
+
101
+ Apps opened with `NEW_TAB` do not receive this message. Their context is set only by the URL used to open the tab.
102
+
56
103
  ### Available expressions
57
104
 
58
105
  The menu URL supports these dynamic expressions:
@@ -16,6 +16,12 @@ The same Worker can expose app-defined `/api/*` routes. Treat those routes as th
16
16
  - Scripts, external clients, and agents can call them too.
17
17
  - The default template documents them with an app OpenAPI spec at `/openapi.json`.
18
18
 
19
+ ### AI inference
20
+
21
+ When an app needs model inference, use Bkper AI by default. An authenticated app API route or event establishes the user and app identity, then platform outbound supplies authorization and usage attribution for the Worker's Bkper AI requests. The app does not need provider credentials.
22
+
23
+ See [Add Bkper AI to an App](https://bkper.com/docs/build/apps/ai.md) for live model discovery, strict structured output, validation, and the client-to-Worker authentication flow.
24
+
19
25
  ### Authentication
20
26
 
21
27
  OAuth is pre-configured. No client IDs, no redirect URIs, no consent screens to build.
@@ -40,6 +40,12 @@ bkper book create --name "My Company" --fraction-digits 2 \
40
40
  # Create a book with custom properties
41
41
  bkper book create --name "Project X" -p "code=PX001" -p "department=Engineering"
42
42
 
43
+ # Copy a book's structure without transactions
44
+ bkper book copy abc123 --name "My Company Copy"
45
+
46
+ # Copy a book with transactions from a specific date (source book owner only)
47
+ bkper book copy abc123 --name "My Company 2025" --transactions --from-date 2025-01-01
48
+
43
49
  # Update a book
44
50
  bkper book update abc123 --lock-date 2024-12-31
45
51
  ```
@@ -58,6 +64,10 @@ bkper book update abc123 --lock-date 2024-12-31
58
64
  - `--time-zone <timezone>` - IANA time zone (e.g. `America/New_York`, `UTC`)
59
65
  - `--period <period>` - Period (`MONTH`, `QUARTER`, or `YEAR`)
60
66
  - `-p, --property <key=value>` - Set a property (repeatable)
67
+ - `book copy <bookId>` - Copy a book
68
+ - `--name <name>` - Name for the copied book (required)
69
+ - `--transactions` - Include transactions (source book owner only)
70
+ - `--from-date <YYYY-MM-DD>` - Include transactions from this date; requires `--transactions`
61
71
  - `book update <bookId>` - Update a book
62
72
  - `--name <name>` - Book name
63
73
  - `--fraction-digits <digits>` - Number of decimal places (`0`-`8`)
@@ -235,6 +245,9 @@ bkper transaction create -b abc123 --date 2025-01-15 --amount 23.90 \
235
245
  # Create a file-only draft for receipt capture
236
246
  bkper transaction create -b abc123 --file ./invoice.pdf
237
247
 
248
+ # Get a transaction by id
249
+ bkper transaction get tx_456 -b abc123
250
+
238
251
  # List transactions for a full year (on:YYYY)
239
252
  bkper transaction list -b abc123 -q 'on:2025'
240
253
 
@@ -259,9 +272,15 @@ bkper transaction post tx_456 -b abc123
259
272
  # Check (reconcile) a transaction
260
273
  bkper transaction check tx_456 -b abc123
261
274
 
275
+ # Uncheck a transaction
276
+ bkper transaction uncheck tx_456 -b abc123
277
+
262
278
  # Trash a transaction
263
279
  bkper transaction trash tx_456 -b abc123
264
280
 
281
+ # Restore a transaction from the trash
282
+ bkper transaction untrash tx_456 -b abc123
283
+
265
284
  # Merge two duplicate transactions
266
285
  bkper transaction merge tx_123 tx_456 -b abc123
267
286
  ```
@@ -269,6 +288,7 @@ bkper transaction merge tx_123 tx_456 -b abc123
269
288
  <details>
270
289
  <summary>Command reference</summary>
271
290
 
291
+ - `transaction get <id> -b <bookId>` - Get a transaction by ID
272
292
  - `transaction list -b <bookId> -q <query>` - List transactions matching a query (auto-paginates through all results unless `--limit` or `--cursor` is provided)
273
293
  - `--limit <number>` - Fetch one page with up to this many transactions
274
294
  - `--cursor <cursor>` - Cursor for fetching the next page
@@ -294,7 +314,9 @@ bkper transaction merge tx_123 tx_456 -b abc123
294
314
  - `-p, --property <key=value>` - Set a property (repeatable, empty value deletes)
295
315
  - `transaction post <id> -b <bookId>` - Post a draft transaction
296
316
  - `transaction check <id> -b <bookId>` - Check a transaction
317
+ - `transaction uncheck <id> -b <bookId>` - Uncheck a transaction
297
318
  - `transaction trash <id> -b <bookId>` - Trash a transaction
319
+ - `transaction untrash <id> -b <bookId>` - Restore a transaction from the trash
298
320
  - `transaction merge <id1> <id2> -b <bookId>` - Merge two transactions
299
321
 
300
322
  </details>
package/lib/docs/index.md CHANGED
@@ -8,6 +8,7 @@ For Bkper data, accounting, reporting, tax, or financial-flow tasks, read `core/
8
8
  - `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 formats (table/json/csv), human-review Bkper UI links, batch operations via stdin/piping, collections.
9
9
  - `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).
10
10
  - `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.
11
+ - `apps/ai.md` — Bkper AI integration for Platform apps: authenticated `/api/*` request flow, outbound authorization and app attribution, live model discovery, strict structured output, response validation, error preservation, data minimization, and unit-test boundaries.
11
12
  - `apps/first-app.md` — First-app walkthrough: scaffold, install, run locally, trigger an event, customize the listing, establish shared source, check, and deploy.
12
13
  - `apps/architecture.md` — App and template architecture: npm workspace structure, Lit/Vite client, Hono Worker, typed `/api/*` contracts, authentication, `/events`, static assets, and supported app shapes.
13
14
  - `apps/configuration.md` — Complete `bkper.yaml` reference: identity, branding, ownership, access, context menus, event subscriptions, property schemas, and single-Worker deployment settings.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper",
3
- "version": "4.26.0",
3
+ "version": "4.27.0",
4
4
  "description": "Command line client for Bkper",
5
5
  "bin": {
6
6
  "bkper": "./lib/cli.js"