bkper 3.8.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/README.md +217 -183
  3. package/lib/auth/auth-page.d.ts +14 -0
  4. package/lib/auth/auth-page.d.ts.map +1 -0
  5. package/lib/auth/auth-page.js +110 -0
  6. package/lib/auth/auth-page.js.map +1 -0
  7. package/lib/auth/local-auth-service.d.ts.map +1 -1
  8. package/lib/auth/local-auth-service.js +135 -17
  9. package/lib/auth/local-auth-service.js.map +1 -1
  10. package/lib/bkper-factory.d.ts.map +1 -0
  11. package/lib/{mcp/bkper-factory.js → bkper-factory.js} +5 -2
  12. package/lib/bkper-factory.js.map +1 -0
  13. package/lib/cli.d.ts +1 -1
  14. package/lib/cli.d.ts.map +1 -1
  15. package/lib/cli.js +839 -67
  16. package/lib/cli.js.map +1 -1
  17. package/lib/commands/accounts/create.d.ts +10 -0
  18. package/lib/commands/accounts/create.d.ts.map +1 -0
  19. package/lib/commands/accounts/create.js +42 -0
  20. package/lib/commands/accounts/create.js.map +1 -0
  21. package/lib/commands/accounts/delete.d.ts +3 -0
  22. package/lib/commands/accounts/delete.d.ts.map +1 -0
  23. package/lib/commands/accounts/delete.js +22 -0
  24. package/lib/commands/accounts/delete.js.map +1 -0
  25. package/lib/commands/accounts/get.d.ts +3 -0
  26. package/lib/commands/accounts/get.d.ts.map +1 -0
  27. package/lib/commands/accounts/get.js +22 -0
  28. package/lib/commands/accounts/get.js.map +1 -0
  29. package/lib/commands/accounts/index.d.ts +6 -0
  30. package/lib/commands/accounts/index.d.ts.map +1 -0
  31. package/lib/commands/accounts/index.js +6 -0
  32. package/lib/commands/accounts/index.js.map +1 -0
  33. package/lib/commands/accounts/list.d.ts +3 -0
  34. package/lib/commands/accounts/list.d.ts.map +1 -0
  35. package/lib/commands/accounts/list.js +19 -0
  36. package/lib/commands/accounts/list.js.map +1 -0
  37. package/lib/commands/accounts/update.d.ts +9 -0
  38. package/lib/commands/accounts/update.d.ts.map +1 -0
  39. package/lib/commands/accounts/update.js +40 -0
  40. package/lib/commands/accounts/update.js.map +1 -0
  41. package/lib/commands/apps/build.d.ts +11 -0
  42. package/lib/commands/apps/build.d.ts.map +1 -0
  43. package/lib/commands/apps/build.js +144 -0
  44. package/lib/commands/apps/build.js.map +1 -0
  45. package/lib/commands/apps/bundler.d.ts +34 -0
  46. package/lib/commands/apps/bundler.d.ts.map +1 -0
  47. package/lib/commands/apps/bundler.js +112 -0
  48. package/lib/commands/apps/bundler.js.map +1 -0
  49. package/lib/commands/apps/config.d.ts +51 -0
  50. package/lib/commands/apps/config.d.ts.map +1 -0
  51. package/lib/commands/apps/config.js +146 -0
  52. package/lib/commands/apps/config.js.map +1 -0
  53. package/lib/commands/apps/deploy.d.ts +23 -0
  54. package/lib/commands/apps/deploy.d.ts.map +1 -0
  55. package/lib/commands/apps/deploy.js +344 -0
  56. package/lib/commands/apps/deploy.js.map +1 -0
  57. package/lib/commands/apps/dev.d.ts +28 -0
  58. package/lib/commands/apps/dev.d.ts.map +1 -0
  59. package/lib/commands/apps/dev.js +393 -0
  60. package/lib/commands/apps/dev.js.map +1 -0
  61. package/lib/commands/apps/index.d.ts +12 -0
  62. package/lib/commands/apps/index.d.ts.map +1 -0
  63. package/lib/commands/apps/index.js +24 -0
  64. package/lib/commands/apps/index.js.map +1 -0
  65. package/lib/commands/apps/init.d.ts +7 -0
  66. package/lib/commands/apps/init.d.ts.map +1 -0
  67. package/lib/commands/apps/init.js +249 -0
  68. package/lib/commands/apps/init.js.map +1 -0
  69. package/lib/commands/apps/install.d.ts +3 -0
  70. package/lib/commands/apps/install.d.ts.map +1 -0
  71. package/lib/commands/apps/install.js +18 -0
  72. package/lib/commands/apps/install.js.map +1 -0
  73. package/lib/commands/apps/list.d.ts +7 -0
  74. package/lib/commands/apps/list.d.ts.map +1 -0
  75. package/lib/commands/apps/list.js +23 -0
  76. package/lib/commands/apps/list.js.map +1 -0
  77. package/lib/commands/apps/secrets.d.ts +22 -0
  78. package/lib/commands/apps/secrets.d.ts.map +1 -0
  79. package/lib/commands/apps/secrets.js +209 -0
  80. package/lib/commands/apps/secrets.js.map +1 -0
  81. package/lib/commands/{apps.d.ts → apps/sync.d.ts} +8 -7
  82. package/lib/commands/apps/sync.d.ts.map +1 -0
  83. package/lib/commands/apps/sync.js +76 -0
  84. package/lib/commands/apps/sync.js.map +1 -0
  85. package/lib/commands/apps/types.d.ts +54 -0
  86. package/lib/commands/apps/types.d.ts.map +1 -0
  87. package/lib/commands/apps/types.js +2 -0
  88. package/lib/commands/apps/types.js.map +1 -0
  89. package/lib/commands/apps/uninstall.d.ts +3 -0
  90. package/lib/commands/apps/uninstall.d.ts.map +1 -0
  91. package/lib/commands/apps/uninstall.js +23 -0
  92. package/lib/commands/apps/uninstall.js.map +1 -0
  93. package/lib/commands/balances/get.d.ts +12 -0
  94. package/lib/commands/balances/get.d.ts.map +1 -0
  95. package/lib/commands/balances/get.js +32 -0
  96. package/lib/commands/balances/get.js.map +1 -0
  97. package/lib/commands/balances/index.d.ts +2 -0
  98. package/lib/commands/balances/index.d.ts.map +1 -0
  99. package/lib/commands/balances/index.js +2 -0
  100. package/lib/commands/balances/index.js.map +1 -0
  101. package/lib/commands/books/create.d.ts +12 -0
  102. package/lib/commands/books/create.d.ts.map +1 -0
  103. package/lib/commands/books/create.js +37 -0
  104. package/lib/commands/books/create.js.map +1 -0
  105. package/lib/commands/books/get.d.ts +3 -0
  106. package/lib/commands/books/get.d.ts.map +1 -0
  107. package/lib/commands/books/get.js +17 -0
  108. package/lib/commands/books/get.js.map +1 -0
  109. package/lib/commands/books/index.d.ts +5 -0
  110. package/lib/commands/books/index.d.ts.map +1 -0
  111. package/lib/commands/books/index.js +5 -0
  112. package/lib/commands/books/index.js.map +1 -0
  113. package/lib/commands/books/list.d.ts +3 -0
  114. package/lib/commands/books/list.d.ts.map +1 -0
  115. package/lib/commands/books/list.js +17 -0
  116. package/lib/commands/books/list.js.map +1 -0
  117. package/lib/commands/books/update.d.ts +14 -0
  118. package/lib/commands/books/update.d.ts.map +1 -0
  119. package/lib/commands/books/update.js +46 -0
  120. package/lib/commands/books/update.js.map +1 -0
  121. package/lib/commands/collections/add-book.d.ts +3 -0
  122. package/lib/commands/collections/add-book.d.ts.map +1 -0
  123. package/lib/commands/collections/add-book.js +27 -0
  124. package/lib/commands/collections/add-book.js.map +1 -0
  125. package/lib/commands/collections/create.d.ts +6 -0
  126. package/lib/commands/collections/create.d.ts.map +1 -0
  127. package/lib/commands/collections/create.js +19 -0
  128. package/lib/commands/collections/create.js.map +1 -0
  129. package/lib/commands/collections/delete.d.ts +3 -0
  130. package/lib/commands/collections/delete.d.ts.map +1 -0
  131. package/lib/commands/collections/delete.js +22 -0
  132. package/lib/commands/collections/delete.js.map +1 -0
  133. package/lib/commands/collections/get.d.ts +3 -0
  134. package/lib/commands/collections/get.d.ts.map +1 -0
  135. package/lib/commands/collections/get.js +22 -0
  136. package/lib/commands/collections/get.js.map +1 -0
  137. package/lib/commands/collections/index.d.ts +8 -0
  138. package/lib/commands/collections/index.d.ts.map +1 -0
  139. package/lib/commands/collections/index.js +8 -0
  140. package/lib/commands/collections/index.js.map +1 -0
  141. package/lib/commands/collections/list.d.ts +3 -0
  142. package/lib/commands/collections/list.d.ts.map +1 -0
  143. package/lib/commands/collections/list.js +18 -0
  144. package/lib/commands/collections/list.js.map +1 -0
  145. package/lib/commands/collections/remove-book.d.ts +3 -0
  146. package/lib/commands/collections/remove-book.d.ts.map +1 -0
  147. package/lib/commands/collections/remove-book.js +27 -0
  148. package/lib/commands/collections/remove-book.js.map +1 -0
  149. package/lib/commands/collections/update.d.ts +6 -0
  150. package/lib/commands/collections/update.d.ts.map +1 -0
  151. package/lib/commands/collections/update.js +24 -0
  152. package/lib/commands/collections/update.js.map +1 -0
  153. package/lib/commands/groups/create.d.ts +9 -0
  154. package/lib/commands/groups/create.d.ts.map +1 -0
  155. package/lib/commands/groups/create.js +40 -0
  156. package/lib/commands/groups/create.js.map +1 -0
  157. package/lib/commands/groups/delete.d.ts +3 -0
  158. package/lib/commands/groups/delete.d.ts.map +1 -0
  159. package/lib/commands/groups/delete.js +22 -0
  160. package/lib/commands/groups/delete.js.map +1 -0
  161. package/lib/commands/groups/get.d.ts +3 -0
  162. package/lib/commands/groups/get.d.ts.map +1 -0
  163. package/lib/commands/groups/get.js +22 -0
  164. package/lib/commands/groups/get.js.map +1 -0
  165. package/lib/commands/groups/index.d.ts +6 -0
  166. package/lib/commands/groups/index.d.ts.map +1 -0
  167. package/lib/commands/groups/index.js +6 -0
  168. package/lib/commands/groups/index.js.map +1 -0
  169. package/lib/commands/groups/list.d.ts +3 -0
  170. package/lib/commands/groups/list.d.ts.map +1 -0
  171. package/lib/commands/groups/list.js +19 -0
  172. package/lib/commands/groups/list.js.map +1 -0
  173. package/lib/commands/groups/update.d.ts +8 -0
  174. package/lib/commands/groups/update.d.ts.map +1 -0
  175. package/lib/commands/groups/update.js +38 -0
  176. package/lib/commands/groups/update.js.map +1 -0
  177. package/lib/commands/skills.d.ts +17 -0
  178. package/lib/commands/skills.d.ts.map +1 -0
  179. package/lib/commands/skills.js +248 -0
  180. package/lib/commands/skills.js.map +1 -0
  181. package/lib/commands/transactions/check.d.ts +3 -0
  182. package/lib/commands/transactions/check.d.ts.map +1 -0
  183. package/lib/commands/transactions/check.js +22 -0
  184. package/lib/commands/transactions/check.js.map +1 -0
  185. package/lib/commands/transactions/create.d.ts +13 -0
  186. package/lib/commands/transactions/create.d.ts.map +1 -0
  187. package/lib/commands/transactions/create.js +55 -0
  188. package/lib/commands/transactions/create.js.map +1 -0
  189. package/lib/commands/transactions/index.d.ts +8 -0
  190. package/lib/commands/transactions/index.d.ts.map +1 -0
  191. package/lib/commands/transactions/index.js +8 -0
  192. package/lib/commands/transactions/index.js.map +1 -0
  193. package/lib/commands/transactions/list.d.ts +14 -0
  194. package/lib/commands/transactions/list.d.ts.map +1 -0
  195. package/lib/commands/transactions/list.js +26 -0
  196. package/lib/commands/transactions/list.js.map +1 -0
  197. package/lib/commands/transactions/merge.d.ts +8 -0
  198. package/lib/commands/transactions/merge.d.ts.map +1 -0
  199. package/lib/commands/transactions/merge.js +44 -0
  200. package/lib/commands/transactions/merge.js.map +1 -0
  201. package/lib/commands/transactions/post.d.ts +3 -0
  202. package/lib/commands/transactions/post.d.ts.map +1 -0
  203. package/lib/commands/transactions/post.js +22 -0
  204. package/lib/commands/transactions/post.js.map +1 -0
  205. package/lib/commands/transactions/trash.d.ts +3 -0
  206. package/lib/commands/transactions/trash.d.ts.map +1 -0
  207. package/lib/commands/transactions/trash.js +22 -0
  208. package/lib/commands/transactions/trash.js.map +1 -0
  209. package/lib/commands/transactions/update.d.ts +12 -0
  210. package/lib/commands/transactions/update.d.ts.map +1 -0
  211. package/lib/commands/transactions/update.js +53 -0
  212. package/lib/commands/transactions/update.js.map +1 -0
  213. package/lib/dev/auth-middleware.d.ts +18 -0
  214. package/lib/dev/auth-middleware.d.ts.map +1 -0
  215. package/lib/dev/auth-middleware.js +113 -0
  216. package/lib/dev/auth-middleware.js.map +1 -0
  217. package/lib/dev/cleanup.d.ts +10 -0
  218. package/lib/dev/cleanup.d.ts.map +1 -0
  219. package/lib/dev/cleanup.js +36 -0
  220. package/lib/dev/cleanup.js.map +1 -0
  221. package/lib/dev/cloudflared/constants.d.ts +35 -0
  222. package/lib/dev/cloudflared/constants.d.ts.map +1 -0
  223. package/lib/dev/cloudflared/constants.js +48 -0
  224. package/lib/dev/cloudflared/constants.js.map +1 -0
  225. package/lib/dev/cloudflared/index.d.ts +11 -0
  226. package/lib/dev/cloudflared/index.d.ts.map +1 -0
  227. package/lib/dev/cloudflared/index.js +10 -0
  228. package/lib/dev/cloudflared/index.js.map +1 -0
  229. package/lib/dev/cloudflared/install.d.ts +15 -0
  230. package/lib/dev/cloudflared/install.d.ts.map +1 -0
  231. package/lib/dev/cloudflared/install.js +140 -0
  232. package/lib/dev/cloudflared/install.js.map +1 -0
  233. package/lib/dev/cloudflared/tunnel.d.ts +64 -0
  234. package/lib/dev/cloudflared/tunnel.d.ts.map +1 -0
  235. package/lib/dev/cloudflared/tunnel.js +109 -0
  236. package/lib/dev/cloudflared/tunnel.js.map +1 -0
  237. package/lib/dev/esbuild.d.ts +28 -0
  238. package/lib/dev/esbuild.d.ts.map +1 -0
  239. package/lib/dev/esbuild.js +83 -0
  240. package/lib/dev/esbuild.js.map +1 -0
  241. package/lib/dev/logger.d.ts +51 -0
  242. package/lib/dev/logger.d.ts.map +1 -0
  243. package/lib/dev/logger.js +102 -0
  244. package/lib/dev/logger.js.map +1 -0
  245. package/lib/dev/miniflare.d.ts +32 -0
  246. package/lib/dev/miniflare.d.ts.map +1 -0
  247. package/lib/dev/miniflare.js +111 -0
  248. package/lib/dev/miniflare.js.map +1 -0
  249. package/lib/dev/preflight.d.ts +7 -0
  250. package/lib/dev/preflight.d.ts.map +1 -0
  251. package/lib/dev/preflight.js +61 -0
  252. package/lib/dev/preflight.js.map +1 -0
  253. package/lib/dev/shared.d.ts +7 -0
  254. package/lib/dev/shared.d.ts.map +1 -0
  255. package/lib/dev/shared.js +99 -0
  256. package/lib/dev/shared.js.map +1 -0
  257. package/lib/dev/tunnel.d.ts +31 -0
  258. package/lib/dev/tunnel.d.ts.map +1 -0
  259. package/lib/dev/tunnel.js +110 -0
  260. package/lib/dev/tunnel.js.map +1 -0
  261. package/lib/dev/types.d.ts +53 -0
  262. package/lib/dev/types.d.ts.map +1 -0
  263. package/lib/dev/types.js +223 -0
  264. package/lib/dev/types.js.map +1 -0
  265. package/lib/dev/vite.d.ts +50 -0
  266. package/lib/dev/vite.d.ts.map +1 -0
  267. package/lib/dev/vite.js +114 -0
  268. package/lib/dev/vite.js.map +1 -0
  269. package/lib/dev/webhook-dev.d.ts +9 -0
  270. package/lib/dev/webhook-dev.d.ts.map +1 -0
  271. package/lib/dev/webhook-dev.js +28 -0
  272. package/lib/dev/webhook-dev.js.map +1 -0
  273. package/lib/domain/transaction/merge-operation.d.ts.map +1 -0
  274. package/lib/{mcp/domain → domain}/transaction/merge-operation.js +10 -11
  275. package/lib/domain/transaction/merge-operation.js.map +1 -0
  276. package/lib/domain/transaction/merge-types.d.ts.map +1 -0
  277. package/lib/domain/transaction/merge-types.js.map +1 -0
  278. package/lib/index.d.ts.map +1 -1
  279. package/lib/index.js.map +1 -1
  280. package/lib/platform/client.d.ts +37 -0
  281. package/lib/platform/client.d.ts.map +1 -0
  282. package/lib/platform/client.js +37 -0
  283. package/lib/platform/client.js.map +1 -0
  284. package/lib/render/index.d.ts +3 -0
  285. package/lib/render/index.d.ts.map +1 -0
  286. package/lib/render/index.js +3 -0
  287. package/lib/render/index.js.map +1 -0
  288. package/lib/render/output.d.ts +15 -0
  289. package/lib/render/output.d.ts.map +1 -0
  290. package/lib/render/output.js +30 -0
  291. package/lib/render/output.js.map +1 -0
  292. package/lib/render/table-formatter.d.ts +34 -0
  293. package/lib/render/table-formatter.d.ts.map +1 -0
  294. package/lib/render/table-formatter.js +221 -0
  295. package/lib/render/table-formatter.js.map +1 -0
  296. package/lib/utils/properties.d.ts +12 -0
  297. package/lib/utils/properties.d.ts.map +1 -0
  298. package/lib/utils/properties.js +23 -0
  299. package/lib/utils/properties.js.map +1 -0
  300. package/package.json +23 -22
  301. package/lib/auth/keys.json +0 -12
  302. package/lib/commands/apps.d.ts.map +0 -1
  303. package/lib/commands/apps.js +0 -93
  304. package/lib/commands/apps.js.map +0 -1
  305. package/lib/mcp/bkper-factory.d.ts.map +0 -1
  306. package/lib/mcp/bkper-factory.js.map +0 -1
  307. package/lib/mcp/domain/transaction/merge-operation.d.ts.map +0 -1
  308. package/lib/mcp/domain/transaction/merge-operation.js.map +0 -1
  309. package/lib/mcp/domain/transaction/merge-types.d.ts.map +0 -1
  310. package/lib/mcp/domain/transaction/merge-types.js.map +0 -1
  311. package/lib/mcp/server.d.ts +0 -13
  312. package/lib/mcp/server.d.ts.map +0 -1
  313. package/lib/mcp/server.js +0 -161
  314. package/lib/mcp/server.js.map +0 -1
  315. package/lib/mcp/system-prompt.md +0 -192
  316. package/lib/mcp/tools/create_transactions.d.ts +0 -59
  317. package/lib/mcp/tools/create_transactions.d.ts.map +0 -1
  318. package/lib/mcp/tools/create_transactions.js +0 -163
  319. package/lib/mcp/tools/create_transactions.js.map +0 -1
  320. package/lib/mcp/tools/get_balances.d.ts +0 -26
  321. package/lib/mcp/tools/get_balances.d.ts.map +0 -1
  322. package/lib/mcp/tools/get_balances.js +0 -106
  323. package/lib/mcp/tools/get_balances.js.map +0 -1
  324. package/lib/mcp/tools/get_book.d.ts +0 -21
  325. package/lib/mcp/tools/get_book.d.ts.map +0 -1
  326. package/lib/mcp/tools/get_book.js +0 -126
  327. package/lib/mcp/tools/get_book.js.map +0 -1
  328. package/lib/mcp/tools/list_books.d.ts +0 -21
  329. package/lib/mcp/tools/list_books.d.ts.map +0 -1
  330. package/lib/mcp/tools/list_books.js +0 -67
  331. package/lib/mcp/tools/list_books.js.map +0 -1
  332. package/lib/mcp/tools/list_transactions.d.ts +0 -38
  333. package/lib/mcp/tools/list_transactions.d.ts.map +0 -1
  334. package/lib/mcp/tools/list_transactions.js +0 -109
  335. package/lib/mcp/tools/list_transactions.js.map +0 -1
  336. package/lib/mcp/tools/merge_transactions.d.ts +0 -40
  337. package/lib/mcp/tools/merge_transactions.d.ts.map +0 -1
  338. package/lib/mcp/tools/merge_transactions.js +0 -120
  339. package/lib/mcp/tools/merge_transactions.js.map +0 -1
  340. /package/lib/{mcp/bkper-factory.d.ts → bkper-factory.d.ts} +0 -0
  341. /package/lib/{mcp/domain → domain}/transaction/merge-operation.d.ts +0 -0
  342. /package/lib/{mcp/domain → domain}/transaction/merge-types.d.ts +0 -0
  343. /package/lib/{mcp/domain → domain}/transaction/merge-types.js +0 -0
@@ -0,0 +1,248 @@
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 fs from 'fs';
11
+ import os from 'os';
12
+ import path from 'path';
13
+ import * as YAML from 'yaml';
14
+ // =============================================================================
15
+ // Constants
16
+ // =============================================================================
17
+ const SKILLS_REPO = 'bkper/skills';
18
+ const SKILLS_BASE_PATH = 'skills';
19
+ const GITHUB_API_BASE = 'https://api.github.com';
20
+ const GITHUB_RAW_BASE = 'https://raw.githubusercontent.com';
21
+ // Global paths
22
+ const SKILLS_DIR = path.join(os.homedir(), '.claude', 'skills');
23
+ const CONFIG_DIR = path.join(os.homedir(), '.config', 'bkper');
24
+ const SKILLS_STATE_FILE = path.join(CONFIG_DIR, 'skills.yaml');
25
+ // =============================================================================
26
+ // Helper Functions
27
+ // =============================================================================
28
+ /**
29
+ * Gets the current local commit SHA from ~/.config/bkper/skills.yaml
30
+ */
31
+ function getLocalCommit() {
32
+ try {
33
+ if (fs.existsSync(SKILLS_STATE_FILE)) {
34
+ const content = fs.readFileSync(SKILLS_STATE_FILE, 'utf8');
35
+ const state = YAML.parse(content);
36
+ return state.commit || null;
37
+ }
38
+ }
39
+ catch (_a) {
40
+ // Ignore errors, treat as no commit
41
+ }
42
+ return null;
43
+ }
44
+ /**
45
+ * Saves the current commit SHA to ~/.config/bkper/skills.yaml
46
+ */
47
+ function saveLocalCommit(commit) {
48
+ fs.mkdirSync(CONFIG_DIR, { recursive: true });
49
+ const state = { commit };
50
+ fs.writeFileSync(SKILLS_STATE_FILE, YAML.stringify(state), 'utf8');
51
+ }
52
+ /**
53
+ * Fetches the latest commit SHA that touched the skills/ folder.
54
+ */
55
+ function fetchLatestCommit() {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ const url = `${GITHUB_API_BASE}/repos/${SKILLS_REPO}/commits?path=${SKILLS_BASE_PATH}&per_page=1`;
58
+ const response = yield fetch(url, {
59
+ headers: {
60
+ Accept: 'application/vnd.github.v3+json',
61
+ 'User-Agent': 'bkper-cli',
62
+ },
63
+ });
64
+ if (!response.ok) {
65
+ throw new Error(`Failed to fetch commit: ${response.statusText}`);
66
+ }
67
+ const commits = (yield response.json());
68
+ if (!commits.length) {
69
+ throw new Error('No commits found for skills path');
70
+ }
71
+ return commits[0].sha;
72
+ });
73
+ }
74
+ /**
75
+ * Fetches the list of files in a GitHub directory.
76
+ */
77
+ function fetchGitHubDirectory(repo, dirPath) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ const url = `${GITHUB_API_BASE}/repos/${repo}/contents/${dirPath}`;
80
+ const response = yield fetch(url, {
81
+ headers: {
82
+ Accept: 'application/vnd.github.v3+json',
83
+ 'User-Agent': 'bkper-cli',
84
+ },
85
+ });
86
+ if (!response.ok) {
87
+ throw new Error(`Failed to fetch ${url}: ${response.statusText}`);
88
+ }
89
+ return response.json();
90
+ });
91
+ }
92
+ /**
93
+ * Downloads a file from GitHub raw content.
94
+ */
95
+ function downloadGitHubFile(repo, filePath) {
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ const url = `${GITHUB_RAW_BASE}/${repo}/main/${filePath}`;
98
+ const response = yield fetch(url, {
99
+ headers: {
100
+ 'User-Agent': 'bkper-cli',
101
+ },
102
+ });
103
+ if (!response.ok) {
104
+ throw new Error(`Failed to download ${url}: ${response.statusText}`);
105
+ }
106
+ return response.text();
107
+ });
108
+ }
109
+ /**
110
+ * Recursively downloads a skill directory from GitHub.
111
+ */
112
+ function downloadSkillDirectory(skillName, targetDir) {
113
+ return __awaiter(this, void 0, void 0, function* () {
114
+ const skillPath = `${SKILLS_BASE_PATH}/${skillName}`;
115
+ const files = yield fetchGitHubDirectory(SKILLS_REPO, skillPath);
116
+ for (const file of files) {
117
+ const localPath = path.join(targetDir, file.name);
118
+ if (file.type === 'dir') {
119
+ fs.mkdirSync(localPath, { recursive: true });
120
+ // Recursively download subdirectory
121
+ const subFiles = yield fetchGitHubDirectory(SKILLS_REPO, file.path);
122
+ for (const subFile of subFiles) {
123
+ if (subFile.type === 'file' && subFile.download_url) {
124
+ const content = yield downloadGitHubFile(SKILLS_REPO, subFile.path);
125
+ fs.writeFileSync(path.join(localPath, subFile.name), content, 'utf8');
126
+ }
127
+ }
128
+ }
129
+ else if (file.type === 'file') {
130
+ const content = yield downloadGitHubFile(SKILLS_REPO, file.path);
131
+ fs.writeFileSync(localPath, content, 'utf8');
132
+ }
133
+ }
134
+ });
135
+ }
136
+ /**
137
+ * Removes all bkper-* skill directories from the global skills folder.
138
+ */
139
+ function clearBkperSkills() {
140
+ if (!fs.existsSync(SKILLS_DIR)) {
141
+ return;
142
+ }
143
+ const entries = fs.readdirSync(SKILLS_DIR, { withFileTypes: true });
144
+ for (const entry of entries) {
145
+ if (entry.isDirectory() && entry.name.startsWith('bkper-')) {
146
+ fs.rmSync(path.join(SKILLS_DIR, entry.name), { recursive: true });
147
+ }
148
+ }
149
+ }
150
+ /**
151
+ * Gets the list of available skills from GitHub.
152
+ */
153
+ function fetchAvailableSkills() {
154
+ return __awaiter(this, void 0, void 0, function* () {
155
+ const files = yield fetchGitHubDirectory(SKILLS_REPO, SKILLS_BASE_PATH);
156
+ return files.filter(f => f.type === 'dir' && f.name.startsWith('bkper-')).map(f => f.name);
157
+ });
158
+ }
159
+ /**
160
+ * Gets the list of installed bkper-* skills from ~/.claude/skills/
161
+ */
162
+ function getInstalledBkperSkills() {
163
+ if (!fs.existsSync(SKILLS_DIR)) {
164
+ return [];
165
+ }
166
+ const entries = fs.readdirSync(SKILLS_DIR, { withFileTypes: true });
167
+ return entries
168
+ .filter(entry => entry.isDirectory() && entry.name.startsWith('bkper-'))
169
+ .map(entry => entry.name);
170
+ }
171
+ /**
172
+ * Returns a short version of the commit SHA for display.
173
+ */
174
+ function shortSha(sha) {
175
+ return sha.substring(0, 7);
176
+ }
177
+ /**
178
+ * Updates global Bkper skills in ~/.claude/skills/
179
+ *
180
+ * Fetches the latest commit SHA that touched the skills/ folder and compares
181
+ * with ~/.config/bkper/skills.yaml. If commits differ, downloads all
182
+ * bkper-* skills.
183
+ *
184
+ * @returns Result indicating what was updated
185
+ */
186
+ export function updateSkills() {
187
+ return __awaiter(this, void 0, void 0, function* () {
188
+ try {
189
+ // 1. Fetch latest commit that touched skills/
190
+ const remoteCommit = yield fetchLatestCommit();
191
+ const localCommit = getLocalCommit();
192
+ // 2. Check if update is needed (commit differs OR skills are missing)
193
+ const installedSkills = getInstalledBkperSkills();
194
+ const skillsExist = installedSkills.length > 0;
195
+ if (remoteCommit === localCommit && skillsExist) {
196
+ return {
197
+ updated: [],
198
+ skipped: true,
199
+ reason: `Skills are up to date (${shortSha(localCommit)})`,
200
+ commit: localCommit,
201
+ };
202
+ }
203
+ // 3. Get list of available skills
204
+ const availableSkills = yield fetchAvailableSkills();
205
+ if (availableSkills.length === 0) {
206
+ return {
207
+ updated: [],
208
+ skipped: true,
209
+ reason: 'No bkper-* skills found in repository',
210
+ };
211
+ }
212
+ // 4. Clear existing bkper-* skills
213
+ clearBkperSkills();
214
+ // 5. Create skills directory
215
+ fs.mkdirSync(SKILLS_DIR, { recursive: true });
216
+ // 6. Download all skills
217
+ const updated = [];
218
+ for (const skillName of availableSkills) {
219
+ const skillTargetDir = path.join(SKILLS_DIR, skillName);
220
+ fs.mkdirSync(skillTargetDir, { recursive: true });
221
+ try {
222
+ yield downloadSkillDirectory(skillName, skillTargetDir);
223
+ updated.push(skillName);
224
+ }
225
+ catch (err) {
226
+ // Log but continue with other skills
227
+ console.error(` Warning: Failed to download skill '${skillName}':`, err instanceof Error ? err.message : err);
228
+ }
229
+ }
230
+ // 7. Save new commit
231
+ saveLocalCommit(remoteCommit);
232
+ return {
233
+ updated,
234
+ skipped: false,
235
+ commit: remoteCommit,
236
+ };
237
+ }
238
+ catch (err) {
239
+ // Network error or other failure - silently continue
240
+ return {
241
+ updated: [],
242
+ skipped: true,
243
+ reason: `Could not check for updates: ${err instanceof Error ? err.message : err}`,
244
+ };
245
+ }
246
+ });
247
+ }
248
+ //# sourceMappingURL=skills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/commands/skills.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAqB7B,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,MAAM,WAAW,GAAG,cAAc,CAAC;AACnC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAClC,MAAM,eAAe,GAAG,wBAAwB,CAAC;AACjD,MAAM,eAAe,GAAG,mCAAmC,CAAC;AAE5D,eAAe;AACf,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAChE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAC/D,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAE/D,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF;;GAEG;AACH,SAAS,cAAc;IACnB,IAAI,CAAC;QACD,IAAI,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACnC,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;YAC3D,MAAM,KAAK,GAAgB,IAAI,CAAC,KA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,CACT,wCAAwC,SAAS,IAAI,EACrD,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAC3C,CAAC;gBACN,CAAC;YACL,CAAC;YAED,qBAAqB;YACrB,eAAe,CAAC,YAAY,CAAC,CAAC;YAE9B,OAAO;gBACH,OAAO;gBACP,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,YAAY;aACvB,CAAC;QACN,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,qDAAqD;YACrD,OAAO;gBACH,OAAO,EAAE,EAAE;gBACX,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE,gCAAgC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE;aACrF,CAAC;QACN,CAAC;IACL,CAAC;CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Transaction } from 'bkper-js';
2
+ export declare function checkTransaction(bookId: string, transactionId: string): Promise<Transaction>;
3
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,gBAAgB,CAClC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GACtB,OAAO,CAAC,WAAW,CAAC,CAQtB"}
@@ -0,0 +1,22 @@
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
+ export function checkTransaction(bookId, transactionId) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ const bkper = getBkperInstance();
14
+ const book = yield bkper.getBook(bookId);
15
+ const transaction = yield book.getTransaction(transactionId);
16
+ if (!transaction) {
17
+ throw new Error(`Transaction not found: ${transactionId}`);
18
+ }
19
+ return transaction.check();
20
+ });
21
+ }
22
+ //# sourceMappingURL=check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.js","sourceRoot":"","sources":["../../../src/commands/transactions/check.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,MAAM,UAAgB,gBAAgB,CAClC,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,KAAK,EAAE,CAAC;IAC/B,CAAC;CAAA"}
@@ -0,0 +1,13 @@
1
+ import { Transaction } from 'bkper-js';
2
+ export interface CreateTransactionOptions {
3
+ date: string;
4
+ amount: string | number;
5
+ description?: string;
6
+ from?: string;
7
+ to?: string;
8
+ url?: string[];
9
+ remoteId?: string[];
10
+ property?: string[];
11
+ }
12
+ export declare function createTransaction(bookId: string, options: CreateTransactionOptions): Promise<Transaction>;
13
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,wBAAsB,iBAAiB,CACnC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,wBAAwB,GAClC,OAAO,CAAC,WAAW,CAAC,CA2CtB"}
@@ -0,0 +1,55 @@
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
+ import { Transaction } from 'bkper-js';
12
+ import { parsePropertyFlag } from '../../utils/properties.js';
13
+ export function createTransaction(bookId, options) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ const bkper = getBkperInstance();
16
+ const book = yield bkper.getBook(bookId);
17
+ const tx = new Transaction(book).setDate(options.date).setAmount(options.amount);
18
+ if (options.description)
19
+ tx.setDescription(options.description);
20
+ if (options.from) {
21
+ const creditAccount = yield book.getAccount(options.from);
22
+ if (creditAccount)
23
+ tx.setCreditAccount(creditAccount);
24
+ }
25
+ if (options.to) {
26
+ const debitAccount = yield book.getAccount(options.to);
27
+ if (debitAccount)
28
+ tx.setDebitAccount(debitAccount);
29
+ }
30
+ if (options.url) {
31
+ for (const u of options.url) {
32
+ tx.addUrl(u);
33
+ }
34
+ }
35
+ if (options.remoteId) {
36
+ for (const rid of options.remoteId) {
37
+ tx.addRemoteId(rid);
38
+ }
39
+ }
40
+ if (options.property) {
41
+ for (const raw of options.property) {
42
+ const [key, value] = parsePropertyFlag(raw);
43
+ if (value === '') {
44
+ tx.deleteProperty(key);
45
+ }
46
+ else {
47
+ tx.setProperty(key, value);
48
+ }
49
+ }
50
+ }
51
+ const results = yield book.batchCreateTransactions([tx]);
52
+ return results[0];
53
+ });
54
+ }
55
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/transactions/create.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;AAa9D,MAAM,UAAgB,iBAAiB,CACnC,MAAc,EACd,OAAiC;;QAEjC,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEzC,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEjF,IAAI,OAAO,CAAC,WAAW;YAAE,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAEhE,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,MAAM,aAAa,GAAG,MAAM,IAAI,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"}
@@ -0,0 +1,8 @@
1
+ export { listTransactions, ListTransactionsOptions, ListTransactionsResult } from './list.js';
2
+ export { createTransaction, CreateTransactionOptions } from './create.js';
3
+ export { updateTransaction, UpdateTransactionOptions } from './update.js';
4
+ export { postTransaction } from './post.js';
5
+ export { checkTransaction } from './check.js';
6
+ export { trashTransaction } from './trash.js';
7
+ export { mergeTransactions, MergeResult } from './merge.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC1E,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,WAAW,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { listTransactions } from './list.js';
2
+ export { createTransaction } from './create.js';
3
+ export { updateTransaction } from './update.js';
4
+ export { postTransaction } from './post.js';
5
+ export { checkTransaction } from './check.js';
6
+ export { trashTransaction } from './trash.js';
7
+ export { mergeTransactions } from './merge.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/transactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAmD,MAAM,WAAW,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAA4B,MAAM,aAAa,CAAC;AAC1E,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"}
@@ -0,0 +1,14 @@
1
+ import { Book, Transaction, Account } from 'bkper-js';
2
+ export interface ListTransactionsOptions {
3
+ query: string;
4
+ limit?: number;
5
+ cursor?: string;
6
+ }
7
+ export interface ListTransactionsResult {
8
+ book: Book;
9
+ items: Transaction[];
10
+ account?: Account;
11
+ cursor?: string;
12
+ }
13
+ export declare function listTransactions(bookId: string, options: ListTransactionsOptions): Promise<ListTransactionsResult>;
14
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +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,EAAmB,MAAM,UAAU,CAAC;AAEvE,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,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,wBAAsB,gBAAgB,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,sBAAsB,CAAC,CAYjC"}
@@ -0,0 +1,26 @@
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
+ export function listTransactions(bookId, options) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ const bkper = getBkperInstance();
14
+ const book = yield bkper.getBook(bookId);
15
+ const result = yield book.listTransactions(options.query, options.limit, options.cursor);
16
+ const items = result.getItems();
17
+ const account = yield result.getAccount();
18
+ return {
19
+ book,
20
+ items: items || [],
21
+ account,
22
+ cursor: result.getCursor(),
23
+ };
24
+ });
25
+ }
26
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/transactions/list.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAgB1D,MAAM,UAAgB,gBAAgB,CAClC,MAAc,EACd,OAAgC;;QAEhC,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QACzF,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QAChC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;QAC1C,OAAO;YACH,IAAI;YACJ,KAAK,EAAE,KAAK,IAAI,EAAE;YAClB,OAAO;YACP,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE;SAC7B,CAAC;IACN,CAAC;CAAA"}
@@ -0,0 +1,8 @@
1
+ import { Transaction } from 'bkper-js';
2
+ export interface MergeResult {
3
+ mergedTransaction: Transaction;
4
+ revertedTransactionId: string;
5
+ auditRecord: string | null;
6
+ }
7
+ export declare function mergeTransactions(bookId: string, transactionId1: string, transactionId2: string): Promise<MergeResult>;
8
+ //# sourceMappingURL=merge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/merge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,MAAM,WAAW,WAAW;IACxB,iBAAiB,EAAE,WAAW,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,wBAAsB,iBAAiB,CACnC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,GACvB,OAAO,CAAC,WAAW,CAAC,CAoCtB"}
@@ -0,0 +1,44 @@
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
+ import { TransactionMergeOperation } from '../../domain/transaction/merge-operation.js';
12
+ export function mergeTransactions(bookId, transactionId1, transactionId2) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ const bkper = getBkperInstance();
15
+ const book = yield bkper.getBook(bookId);
16
+ const [tx1, tx2] = yield Promise.all([
17
+ book.getTransaction(transactionId1),
18
+ book.getTransaction(transactionId2),
19
+ ]);
20
+ if (!tx1) {
21
+ throw new Error(`Transaction not found: ${transactionId1}`);
22
+ }
23
+ if (!tx2) {
24
+ throw new Error(`Transaction not found: ${transactionId2}`);
25
+ }
26
+ const mergeOp = new TransactionMergeOperation(book, tx1, tx2);
27
+ if (mergeOp.record) {
28
+ throw new Error(`Cannot merge: amounts differ. ${mergeOp.record}`);
29
+ }
30
+ // Apply merged data to the edit transaction
31
+ mergeOp.applyMergedData();
32
+ // Update the edit transaction and trash the revert transaction
33
+ const [updated] = yield Promise.all([
34
+ mergeOp.editTransaction.update(),
35
+ mergeOp.revertTransaction.trash(),
36
+ ]);
37
+ return {
38
+ mergedTransaction: updated,
39
+ revertedTransactionId: mergeOp.revertTransaction.getId() || '',
40
+ auditRecord: mergeOp.record,
41
+ };
42
+ });
43
+ }
44
+ //# sourceMappingURL=merge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.js","sourceRoot":"","sources":["../../../src/commands/transactions/merge.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAQxF,MAAM,UAAgB,iBAAiB,CACnC,MAAc,EACd,cAAsB,EACtB,cAAsB;;QAEtB,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEzC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACjC,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC;YACnC,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC;SACtC,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,EAAE,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,0BAA0B,cAAc,EAAE,CAAC,CAAC;QAChE,CAAC;QACD,IAAI,CAAC,GAAG,EAAE,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,0BAA0B,cAAc,EAAE,CAAC,CAAC;QAChE,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,yBAAyB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAE9D,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,iCAAiC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACvE,CAAC;QAED,4CAA4C;QAC5C,OAAO,CAAC,eAAe,EAAE,CAAC;QAE1B,+DAA+D;QAC/D,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAChC,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE;YAChC,OAAO,CAAC,iBAAiB,CAAC,KAAK,EAAE;SACpC,CAAC,CAAC;QAEH,OAAO;YACH,iBAAiB,EAAE,OAAO;YAC1B,qBAAqB,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE;YAC9D,WAAW,EAAE,OAAO,CAAC,MAAM;SAC9B,CAAC;IACN,CAAC;CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Transaction } from 'bkper-js';
2
+ export declare function postTransaction(bookId: string, transactionId: string): Promise<Transaction>;
3
+ //# sourceMappingURL=post.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/post.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAQjG"}
@@ -0,0 +1,22 @@
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
+ export function postTransaction(bookId, transactionId) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ const bkper = getBkperInstance();
14
+ const book = yield bkper.getBook(bookId);
15
+ const transaction = yield book.getTransaction(transactionId);
16
+ if (!transaction) {
17
+ throw new Error(`Transaction not found: ${transactionId}`);
18
+ }
19
+ return transaction.post();
20
+ });
21
+ }
22
+ //# sourceMappingURL=post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.js","sourceRoot":"","sources":["../../../src/commands/transactions/post.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,MAAM,UAAgB,eAAe,CAAC,MAAc,EAAE,aAAqB;;QACvE,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,IAAI,EAAE,CAAC;IAC9B,CAAC;CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Transaction } from 'bkper-js';
2
+ export declare function trashTransaction(bookId: string, transactionId: string): Promise<Transaction>;
3
+ //# sourceMappingURL=trash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trash.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/trash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,gBAAgB,CAClC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GACtB,OAAO,CAAC,WAAW,CAAC,CAQtB"}
@@ -0,0 +1,22 @@
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
+ export function trashTransaction(bookId, transactionId) {
12
+ return __awaiter(this, void 0, void 0, function* () {
13
+ const bkper = getBkperInstance();
14
+ const book = yield bkper.getBook(bookId);
15
+ const transaction = yield book.getTransaction(transactionId);
16
+ if (!transaction) {
17
+ throw new Error(`Transaction not found: ${transactionId}`);
18
+ }
19
+ return transaction.trash();
20
+ });
21
+ }
22
+ //# sourceMappingURL=trash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trash.js","sourceRoot":"","sources":["../../../src/commands/transactions/trash.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,MAAM,UAAgB,gBAAgB,CAClC,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,KAAK,EAAE,CAAC;IAC/B,CAAC;CAAA"}
@@ -0,0 +1,12 @@
1
+ import { Transaction } from 'bkper-js';
2
+ export interface UpdateTransactionOptions {
3
+ date?: string;
4
+ amount?: string | number;
5
+ description?: string;
6
+ from?: string;
7
+ to?: string;
8
+ url?: string[];
9
+ property?: string[];
10
+ }
11
+ export declare function updateTransaction(bookId: string, transactionId: string, options: UpdateTransactionOptions): Promise<Transaction>;
12
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/transactions/update.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,MAAM,WAAW,wBAAwB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,wBAAsB,iBAAiB,CACnC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,wBAAwB,GAClC,OAAO,CAAC,WAAW,CAAC,CAuCtB"}