@opentabs-dev/opentabs-plugin-ynab 0.0.84 → 0.0.86

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 (68) hide show
  1. package/dist/adapter.iife.js +870 -523
  2. package/dist/adapter.iife.js.map +4 -4
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +11 -16
  6. package/dist/index.js.map +1 -1
  7. package/dist/tools/create-transaction.d.ts +2 -2
  8. package/dist/tools/create-transaction.d.ts.map +1 -1
  9. package/dist/tools/create-transaction.js +63 -22
  10. package/dist/tools/create-transaction.js.map +1 -1
  11. package/dist/tools/delete-transaction.d.ts.map +1 -1
  12. package/dist/tools/delete-transaction.js +22 -7
  13. package/dist/tools/delete-transaction.js.map +1 -1
  14. package/dist/tools/get-account.d.ts.map +1 -1
  15. package/dist/tools/get-account.js +3 -3
  16. package/dist/tools/get-account.js.map +1 -1
  17. package/dist/tools/get-month.d.ts +2 -1
  18. package/dist/tools/get-month.d.ts.map +1 -1
  19. package/dist/tools/get-month.js +10 -33
  20. package/dist/tools/get-month.js.map +1 -1
  21. package/dist/tools/get-plan.d.ts.map +1 -1
  22. package/dist/tools/get-plan.js +12 -5
  23. package/dist/tools/get-plan.js.map +1 -1
  24. package/dist/tools/get-transaction.d.ts +2 -2
  25. package/dist/tools/get-transaction.d.ts.map +1 -1
  26. package/dist/tools/get-transaction.js +5 -4
  27. package/dist/tools/get-transaction.js.map +1 -1
  28. package/dist/tools/list-accounts.d.ts.map +1 -1
  29. package/dist/tools/list-accounts.js +4 -4
  30. package/dist/tools/list-accounts.js.map +1 -1
  31. package/dist/tools/list-categories.d.ts.map +1 -1
  32. package/dist/tools/list-categories.js +9 -29
  33. package/dist/tools/list-categories.js.map +1 -1
  34. package/dist/tools/list-months.d.ts +1 -1
  35. package/dist/tools/list-months.d.ts.map +1 -1
  36. package/dist/tools/list-months.js +5 -14
  37. package/dist/tools/list-months.js.map +1 -1
  38. package/dist/tools/list-payees.d.ts.map +1 -1
  39. package/dist/tools/list-payees.js +3 -3
  40. package/dist/tools/list-payees.js.map +1 -1
  41. package/dist/tools/list-scheduled-transactions.d.ts.map +1 -1
  42. package/dist/tools/list-scheduled-transactions.js +7 -5
  43. package/dist/tools/list-scheduled-transactions.js.map +1 -1
  44. package/dist/tools/list-transactions.d.ts +4 -2
  45. package/dist/tools/list-transactions.d.ts.map +1 -1
  46. package/dist/tools/list-transactions.js +40 -8
  47. package/dist/tools/list-transactions.js.map +1 -1
  48. package/dist/tools/move-category-budget.d.ts +24 -0
  49. package/dist/tools/move-category-budget.d.ts.map +1 -0
  50. package/dist/tools/move-category-budget.js +105 -0
  51. package/dist/tools/move-category-budget.js.map +1 -0
  52. package/dist/tools/schemas.d.ts +105 -27
  53. package/dist/tools/schemas.d.ts.map +1 -1
  54. package/dist/tools/schemas.js +176 -27
  55. package/dist/tools/schemas.js.map +1 -1
  56. package/dist/tools/update-category-budget.d.ts.map +1 -1
  57. package/dist/tools/update-category-budget.js +55 -27
  58. package/dist/tools/update-category-budget.js.map +1 -1
  59. package/dist/tools/update-transaction.d.ts +3 -2
  60. package/dist/tools/update-transaction.d.ts.map +1 -1
  61. package/dist/tools/update-transaction.js +84 -31
  62. package/dist/tools/update-transaction.js.map +1 -1
  63. package/dist/tools.json +192 -43
  64. package/dist/ynab-api.d.ts +4 -1
  65. package/dist/ynab-api.d.ts.map +1 -1
  66. package/dist/ynab-api.js +47 -26
  67. package/dist/ynab-api.js.map +1 -1
  68. package/package.json +3 -3
package/dist/tools.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "sdkVersion": "0.0.88",
2
+ "sdkVersion": "0.0.90",
3
3
  "iconSvg": "<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"> <path d=\"M12.9654471,7.1372549 C12.9654471,7.1372549 13.0521782,7.17866667 13.01824,7.23137255 L9.43665461,12.7291114 C9.40271635,12.7818173 9.37254902,12.8759349 9.37254902,12.9361702 L9.37254902,15.8870588 C9.37254902,15.9472941 9.31975618,16 9.25942152,16 L6.74057848,16 C6.68024382,16 6.62745098,15.9472941 6.62745098,15.8870588 L6.62745098,12.9361702 C6.62745098,12.8721702 6.59728365,12.7818173 6.56334539,12.7291114 L2.97044729,7.23137255 C2.93650904,7.17866667 2.95536362,7.1372549 3.01946921,7.1372549 L5.96078431,7.1372549 C6.02111898,7.1372549 6.10030824,7.18243137 6.13047557,7.23513725 L7.94532171,10.3077647 C7.97925996,10.3604706 8.02828188,10.3604706 8.06222013,10.3077647 L9.86575351,7.23513725 C9.89969176,7.18243137 9.9751101,7.1372549 10.0392157,7.1372549 L12.9654471,7.1372549 Z M11.5729437,10.7557647 C11.5955692,10.7407059 11.6408202,10.7294118 11.7049258,10.7294118 C13.0021211,10.7256471 12.7871789,11.9717647 12.7306151,12.4235294 C12.2894179,12.3143529 11.0412444,12.0809412 11.5012963,10.8687059 C11.5276927,10.816 11.5503182,10.7708235 11.5729437,10.7557647 Z M4.29507424,10.7294118 C4.36295074,10.7294118 4.40443083,10.7407059 4.42705633,10.7557647 C4.44591091,10.7708235 4.47230733,10.816 4.49493283,10.8687059 C4.95498468,12.0809412 3.70681122,12.3143529 3.26561395,12.4235294 C3.21282112,11.9717647 2.99787886,10.7256471 4.29507424,10.7294118 Z M12.2630214,9.63764706 C12.2667924,9.59247059 12.3007306,9.52847059 12.372378,9.44564706 C13.7600754,7.83058824 14.9479142,9.50588235 15.4079661,10.0818824 C14.8083903,10.5072941 13.2019797,11.7872941 12.3158143,9.85223529 C12.281876,9.76564706 12.2554796,9.67905882 12.2630214,9.63764706 Z M3.74074947,9.63388235 C3.7482913,9.67529412 3.72189489,9.76188235 3.68795663,9.84847059 C2.80179119,11.7835294 1.19538063,10.5072941 0.595804855,10.0781176 C1.05208579,9.50588235 2.23992458,7.83058824 3.63139288,9.44188235 C3.69926938,9.52470588 3.73320764,9.59247059 3.74074947,9.63388235 Z M13.5451332,7.81552941 C13.5451332,7.78164706 13.5602168,7.72894118 13.597926,7.66117647 C14.3709639,6.29082353 15.5588027,7.26588235 16,7.59717647 C15.6229083,7.99623529 14.6273863,9.16705882 13.6243224,7.95858824 C13.5828423,7.90211765 13.5489041,7.84564706 13.5451332,7.81552941 Z M2.45486684,7.81176471 C2.45109592,7.84188235 2.41715767,7.89835294 2.37567759,7.95482353 C1.37261372,9.16705882 0.37709168,7.99623529 0,7.58964706 C0.441197266,7.26211765 1.62903606,6.28705882 2.402074,7.65741176 C2.44355409,7.72894118 2.45863776,7.78164706 2.45486684,7.81176471 Z M12.4817346,6.14776471 C12.46288,6.11011765 12.4515673,6.03858824 12.4591091,5.92941176 C12.6137167,3.80988235 14.5670516,4.44988235 15.2722131,4.63811765 C15.045958,5.33458824 14.5180297,7.31858824 12.6514259,6.28705882 C12.5722366,6.23811765 12.5005892,6.18541176 12.4817346,6.14776471 Z M3.51826538,6.15152941 C3.49941079,6.18917647 3.42776337,6.23811765 3.34857412,6.29082353 C1.4819703,7.31858824 0.954041951,5.33835294 0.724016026,4.64188235 C1.43294839,4.44988235 3.38251237,3.80988235 3.54089088,5.93317647 C3.54843271,6.03858824 3.53711996,6.11388235 3.51826538,6.15152941 Z M12.2856469,4.18258824 C12.2177704,4.17882353 12.1536649,4.17129412 12.1272684,4.15247059 C12.1046429,4.13741176 12.0744756,4.09223529 12.0443083,4.01317647 C11.4862126,2.54494118 12.9983502,2.26258824 13.5338204,2.13082353 C13.597926,2.67670588 13.8581193,4.19011765 12.2856469,4.18258824 Z M3.87273156,4.15623529 C3.84633514,4.17129412 3.78222955,4.18258824 3.71435305,4.18635294 C2.13810983,4.19388235 2.402074,2.68047059 2.46617959,2.13835294 C3.00164978,2.26635294 4.5100165,2.54870588 3.95569173,4.02070588 C3.92929531,4.09223529 3.89912798,4.13741176 3.87273156,4.15623529 Z M7.99434362,2.92517647 C7.95663446,2.92517647 7.88121612,2.89129412 7.80579778,2.84988235 C6.15036531,1.792 7.53052086,0.489411765 7.99434362,0 C8.46193731,0.489411765 9.84209286,1.78823529 8.18288947,2.84988235 C8.0999293,2.90258824 8.03205279,2.92517647 7.99434362,2.92517647 Z M10.1588499,3.712 C10.0834315,3.72329412 10.0117841,3.73082353 9.97784586,3.71952941 C9.94767853,3.70823529 9.90242753,3.66682353 9.84963469,3.59529412 C8.84657082,2.14588235 10.4152722,1.43058824 10.9620551,1.14447059 C11.1807683,1.72047059 11.8708461,3.29411765 10.1588499,3.712 Z M6.02215414,3.71952941 C5.98821588,3.73458824 5.91656847,3.72705882 5.84115013,3.712 C4.1291539,3.29411765 4.82300259,1.72047059 5.03794485,1.14070588 C5.58472779,1.42682353 7.15342918,2.14211765 6.15036531,3.59152941 C6.10134339,3.66682353 6.05609239,3.70823529 6.02215414,3.71952941 Z M7.85104879,5.78258824 C6.55385341,4.89411765 7.63233561,3.79858824 7.99811454,3.38823529 C8.36389347,3.79858824 9.44237568,4.89411765 8.1451803,5.78258824 C8.08107471,5.82776471 8.02828188,5.84658824 7.99811454,5.84658824 C7.96794721,5.84658824 7.91138346,5.81647059 7.85104879,5.78258824 Z M9.9401367,6.71623529 C9.84586378,6.70870588 9.75536177,6.69364706 9.72142352,6.67105882 C9.68371435,6.64847059 9.63846335,6.58823529 9.60075418,6.49035294 C8.74475607,4.54023529 10.7697384,4.19764706 11.4862126,4.03576471 C11.6106528,4.75482353 12.0707047,6.75764706 9.9401367,6.71623529 Z M7.99434362,8.68517647 C7.96417629,8.68517647 7.90761254,8.65505882 7.84727787,8.62117647 C6.55008249,7.72894118 7.63233561,6.63717647 7.99434362,6.22682353 C8.36012255,6.63717647 9.43860476,7.72894118 8.14140938,8.62117647 C8.07730379,8.66635294 8.02451096,8.68517647 7.99434362,8.68517647 Z M6.2823474,6.67105882 C6.24463823,6.69364706 6.15790714,6.70870588 6.06363422,6.71623529 C3.93306623,6.75764706 4.39311808,4.75858824 4.52132925,4.03576471 C5.23780344,4.19764706 7.26278576,4.54023529 6.40678765,6.49035294 C6.36153665,6.58823529 6.31628565,6.64847059 6.2823474,6.67105882 Z\" fill=\"black\"/> </svg>",
4
4
  "iconInactiveSvg": "<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"> <path d=\"M12.9654471,7.1372549 C12.9654471,7.1372549 13.0521782,7.17866667 13.01824,7.23137255 L9.43665461,12.7291114 C9.40271635,12.7818173 9.37254902,12.8759349 9.37254902,12.9361702 L9.37254902,15.8870588 C9.37254902,15.9472941 9.31975618,16 9.25942152,16 L6.74057848,16 C6.68024382,16 6.62745098,15.9472941 6.62745098,15.8870588 L6.62745098,12.9361702 C6.62745098,12.8721702 6.59728365,12.7818173 6.56334539,12.7291114 L2.97044729,7.23137255 C2.93650904,7.17866667 2.95536362,7.1372549 3.01946921,7.1372549 L5.96078431,7.1372549 C6.02111898,7.1372549 6.10030824,7.18243137 6.13047557,7.23513725 L7.94532171,10.3077647 C7.97925996,10.3604706 8.02828188,10.3604706 8.06222013,10.3077647 L9.86575351,7.23513725 C9.89969176,7.18243137 9.9751101,7.1372549 10.0392157,7.1372549 L12.9654471,7.1372549 Z M11.5729437,10.7557647 C11.5955692,10.7407059 11.6408202,10.7294118 11.7049258,10.7294118 C13.0021211,10.7256471 12.7871789,11.9717647 12.7306151,12.4235294 C12.2894179,12.3143529 11.0412444,12.0809412 11.5012963,10.8687059 C11.5276927,10.816 11.5503182,10.7708235 11.5729437,10.7557647 Z M4.29507424,10.7294118 C4.36295074,10.7294118 4.40443083,10.7407059 4.42705633,10.7557647 C4.44591091,10.7708235 4.47230733,10.816 4.49493283,10.8687059 C4.95498468,12.0809412 3.70681122,12.3143529 3.26561395,12.4235294 C3.21282112,11.9717647 2.99787886,10.7256471 4.29507424,10.7294118 Z M12.2630214,9.63764706 C12.2667924,9.59247059 12.3007306,9.52847059 12.372378,9.44564706 C13.7600754,7.83058824 14.9479142,9.50588235 15.4079661,10.0818824 C14.8083903,10.5072941 13.2019797,11.7872941 12.3158143,9.85223529 C12.281876,9.76564706 12.2554796,9.67905882 12.2630214,9.63764706 Z M3.74074947,9.63388235 C3.7482913,9.67529412 3.72189489,9.76188235 3.68795663,9.84847059 C2.80179119,11.7835294 1.19538063,10.5072941 0.595804855,10.0781176 C1.05208579,9.50588235 2.23992458,7.83058824 3.63139288,9.44188235 C3.69926938,9.52470588 3.73320764,9.59247059 3.74074947,9.63388235 Z M13.5451332,7.81552941 C13.5451332,7.78164706 13.5602168,7.72894118 13.597926,7.66117647 C14.3709639,6.29082353 15.5588027,7.26588235 16,7.59717647 C15.6229083,7.99623529 14.6273863,9.16705882 13.6243224,7.95858824 C13.5828423,7.90211765 13.5489041,7.84564706 13.5451332,7.81552941 Z M2.45486684,7.81176471 C2.45109592,7.84188235 2.41715767,7.89835294 2.37567759,7.95482353 C1.37261372,9.16705882 0.37709168,7.99623529 0,7.58964706 C0.441197266,7.26211765 1.62903606,6.28705882 2.402074,7.65741176 C2.44355409,7.72894118 2.45863776,7.78164706 2.45486684,7.81176471 Z M12.4817346,6.14776471 C12.46288,6.11011765 12.4515673,6.03858824 12.4591091,5.92941176 C12.6137167,3.80988235 14.5670516,4.44988235 15.2722131,4.63811765 C15.045958,5.33458824 14.5180297,7.31858824 12.6514259,6.28705882 C12.5722366,6.23811765 12.5005892,6.18541176 12.4817346,6.14776471 Z M3.51826538,6.15152941 C3.49941079,6.18917647 3.42776337,6.23811765 3.34857412,6.29082353 C1.4819703,7.31858824 0.954041951,5.33835294 0.724016026,4.64188235 C1.43294839,4.44988235 3.38251237,3.80988235 3.54089088,5.93317647 C3.54843271,6.03858824 3.53711996,6.11388235 3.51826538,6.15152941 Z M12.2856469,4.18258824 C12.2177704,4.17882353 12.1536649,4.17129412 12.1272684,4.15247059 C12.1046429,4.13741176 12.0744756,4.09223529 12.0443083,4.01317647 C11.4862126,2.54494118 12.9983502,2.26258824 13.5338204,2.13082353 C13.597926,2.67670588 13.8581193,4.19011765 12.2856469,4.18258824 Z M3.87273156,4.15623529 C3.84633514,4.17129412 3.78222955,4.18258824 3.71435305,4.18635294 C2.13810983,4.19388235 2.402074,2.68047059 2.46617959,2.13835294 C3.00164978,2.26635294 4.5100165,2.54870588 3.95569173,4.02070588 C3.92929531,4.09223529 3.89912798,4.13741176 3.87273156,4.15623529 Z M7.99434362,2.92517647 C7.95663446,2.92517647 7.88121612,2.89129412 7.80579778,2.84988235 C6.15036531,1.792 7.53052086,0.489411765 7.99434362,0 C8.46193731,0.489411765 9.84209286,1.78823529 8.18288947,2.84988235 C8.0999293,2.90258824 8.03205279,2.92517647 7.99434362,2.92517647 Z M10.1588499,3.712 C10.0834315,3.72329412 10.0117841,3.73082353 9.97784586,3.71952941 C9.94767853,3.70823529 9.90242753,3.66682353 9.84963469,3.59529412 C8.84657082,2.14588235 10.4152722,1.43058824 10.9620551,1.14447059 C11.1807683,1.72047059 11.8708461,3.29411765 10.1588499,3.712 Z M6.02215414,3.71952941 C5.98821588,3.73458824 5.91656847,3.72705882 5.84115013,3.712 C4.1291539,3.29411765 4.82300259,1.72047059 5.03794485,1.14070588 C5.58472779,1.42682353 7.15342918,2.14211765 6.15036531,3.59152941 C6.10134339,3.66682353 6.05609239,3.70823529 6.02215414,3.71952941 Z M7.85104879,5.78258824 C6.55385341,4.89411765 7.63233561,3.79858824 7.99811454,3.38823529 C8.36389347,3.79858824 9.44237568,4.89411765 8.1451803,5.78258824 C8.08107471,5.82776471 8.02828188,5.84658824 7.99811454,5.84658824 C7.96794721,5.84658824 7.91138346,5.81647059 7.85104879,5.78258824 Z M9.9401367,6.71623529 C9.84586378,6.70870588 9.75536177,6.69364706 9.72142352,6.67105882 C9.68371435,6.64847059 9.63846335,6.58823529 9.60075418,6.49035294 C8.74475607,4.54023529 10.7697384,4.19764706 11.4862126,4.03576471 C11.6106528,4.75482353 12.0707047,6.75764706 9.9401367,6.71623529 Z M7.99434362,8.68517647 C7.96417629,8.68517647 7.90761254,8.65505882 7.84727787,8.62117647 C6.55008249,7.72894118 7.63233561,6.63717647 7.99434362,6.22682353 C8.36012255,6.63717647 9.43860476,7.72894118 8.14140938,8.62117647 C8.07730379,8.66635294 8.02451096,8.68517647 7.99434362,8.68517647 Z M6.2823474,6.67105882 C6.24463823,6.69364706 6.15790714,6.70870588 6.06363422,6.71623529 C3.93306623,6.75764706 4.39311808,4.75858824 4.52132925,4.03576471 C5.23780344,4.19764706 7.26278576,4.54023529 6.40678765,6.49035294 C6.36153665,6.58823529 6.31628565,6.64847059 6.2823474,6.67105882 Z\" fill=\"#999999\"/> </svg>",
5
5
  "iconDarkSvg": "<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"> <path d=\"M12.9654471,7.1372549 C12.9654471,7.1372549 13.0521782,7.17866667 13.01824,7.23137255 L9.43665461,12.7291114 C9.40271635,12.7818173 9.37254902,12.8759349 9.37254902,12.9361702 L9.37254902,15.8870588 C9.37254902,15.9472941 9.31975618,16 9.25942152,16 L6.74057848,16 C6.68024382,16 6.62745098,15.9472941 6.62745098,15.8870588 L6.62745098,12.9361702 C6.62745098,12.8721702 6.59728365,12.7818173 6.56334539,12.7291114 L2.97044729,7.23137255 C2.93650904,7.17866667 2.95536362,7.1372549 3.01946921,7.1372549 L5.96078431,7.1372549 C6.02111898,7.1372549 6.10030824,7.18243137 6.13047557,7.23513725 L7.94532171,10.3077647 C7.97925996,10.3604706 8.02828188,10.3604706 8.06222013,10.3077647 L9.86575351,7.23513725 C9.89969176,7.18243137 9.9751101,7.1372549 10.0392157,7.1372549 L12.9654471,7.1372549 Z M11.5729437,10.7557647 C11.5955692,10.7407059 11.6408202,10.7294118 11.7049258,10.7294118 C13.0021211,10.7256471 12.7871789,11.9717647 12.7306151,12.4235294 C12.2894179,12.3143529 11.0412444,12.0809412 11.5012963,10.8687059 C11.5276927,10.816 11.5503182,10.7708235 11.5729437,10.7557647 Z M4.29507424,10.7294118 C4.36295074,10.7294118 4.40443083,10.7407059 4.42705633,10.7557647 C4.44591091,10.7708235 4.47230733,10.816 4.49493283,10.8687059 C4.95498468,12.0809412 3.70681122,12.3143529 3.26561395,12.4235294 C3.21282112,11.9717647 2.99787886,10.7256471 4.29507424,10.7294118 Z M12.2630214,9.63764706 C12.2667924,9.59247059 12.3007306,9.52847059 12.372378,9.44564706 C13.7600754,7.83058824 14.9479142,9.50588235 15.4079661,10.0818824 C14.8083903,10.5072941 13.2019797,11.7872941 12.3158143,9.85223529 C12.281876,9.76564706 12.2554796,9.67905882 12.2630214,9.63764706 Z M3.74074947,9.63388235 C3.7482913,9.67529412 3.72189489,9.76188235 3.68795663,9.84847059 C2.80179119,11.7835294 1.19538063,10.5072941 0.595804855,10.0781176 C1.05208579,9.50588235 2.23992458,7.83058824 3.63139288,9.44188235 C3.69926938,9.52470588 3.73320764,9.59247059 3.74074947,9.63388235 Z M13.5451332,7.81552941 C13.5451332,7.78164706 13.5602168,7.72894118 13.597926,7.66117647 C14.3709639,6.29082353 15.5588027,7.26588235 16,7.59717647 C15.6229083,7.99623529 14.6273863,9.16705882 13.6243224,7.95858824 C13.5828423,7.90211765 13.5489041,7.84564706 13.5451332,7.81552941 Z M2.45486684,7.81176471 C2.45109592,7.84188235 2.41715767,7.89835294 2.37567759,7.95482353 C1.37261372,9.16705882 0.37709168,7.99623529 0,7.58964706 C0.441197266,7.26211765 1.62903606,6.28705882 2.402074,7.65741176 C2.44355409,7.72894118 2.45863776,7.78164706 2.45486684,7.81176471 Z M12.4817346,6.14776471 C12.46288,6.11011765 12.4515673,6.03858824 12.4591091,5.92941176 C12.6137167,3.80988235 14.5670516,4.44988235 15.2722131,4.63811765 C15.045958,5.33458824 14.5180297,7.31858824 12.6514259,6.28705882 C12.5722366,6.23811765 12.5005892,6.18541176 12.4817346,6.14776471 Z M3.51826538,6.15152941 C3.49941079,6.18917647 3.42776337,6.23811765 3.34857412,6.29082353 C1.4819703,7.31858824 0.954041951,5.33835294 0.724016026,4.64188235 C1.43294839,4.44988235 3.38251237,3.80988235 3.54089088,5.93317647 C3.54843271,6.03858824 3.53711996,6.11388235 3.51826538,6.15152941 Z M12.2856469,4.18258824 C12.2177704,4.17882353 12.1536649,4.17129412 12.1272684,4.15247059 C12.1046429,4.13741176 12.0744756,4.09223529 12.0443083,4.01317647 C11.4862126,2.54494118 12.9983502,2.26258824 13.5338204,2.13082353 C13.597926,2.67670588 13.8581193,4.19011765 12.2856469,4.18258824 Z M3.87273156,4.15623529 C3.84633514,4.17129412 3.78222955,4.18258824 3.71435305,4.18635294 C2.13810983,4.19388235 2.402074,2.68047059 2.46617959,2.13835294 C3.00164978,2.26635294 4.5100165,2.54870588 3.95569173,4.02070588 C3.92929531,4.09223529 3.89912798,4.13741176 3.87273156,4.15623529 Z M7.99434362,2.92517647 C7.95663446,2.92517647 7.88121612,2.89129412 7.80579778,2.84988235 C6.15036531,1.792 7.53052086,0.489411765 7.99434362,0 C8.46193731,0.489411765 9.84209286,1.78823529 8.18288947,2.84988235 C8.0999293,2.90258824 8.03205279,2.92517647 7.99434362,2.92517647 Z M10.1588499,3.712 C10.0834315,3.72329412 10.0117841,3.73082353 9.97784586,3.71952941 C9.94767853,3.70823529 9.90242753,3.66682353 9.84963469,3.59529412 C8.84657082,2.14588235 10.4152722,1.43058824 10.9620551,1.14447059 C11.1807683,1.72047059 11.8708461,3.29411765 10.1588499,3.712 Z M6.02215414,3.71952941 C5.98821588,3.73458824 5.91656847,3.72705882 5.84115013,3.712 C4.1291539,3.29411765 4.82300259,1.72047059 5.03794485,1.14070588 C5.58472779,1.42682353 7.15342918,2.14211765 6.15036531,3.59152941 C6.10134339,3.66682353 6.05609239,3.70823529 6.02215414,3.71952941 Z M7.85104879,5.78258824 C6.55385341,4.89411765 7.63233561,3.79858824 7.99811454,3.38823529 C8.36389347,3.79858824 9.44237568,4.89411765 8.1451803,5.78258824 C8.08107471,5.82776471 8.02828188,5.84658824 7.99811454,5.84658824 C7.96794721,5.84658824 7.91138346,5.81647059 7.85104879,5.78258824 Z M9.9401367,6.71623529 C9.84586378,6.70870588 9.75536177,6.69364706 9.72142352,6.67105882 C9.68371435,6.64847059 9.63846335,6.58823529 9.60075418,6.49035294 C8.74475607,4.54023529 10.7697384,4.19764706 11.4862126,4.03576471 C11.6106528,4.75482353 12.0707047,6.75764706 9.9401367,6.71623529 Z M7.99434362,8.68517647 C7.96417629,8.68517647 7.90761254,8.65505882 7.84727787,8.62117647 C6.55008249,7.72894118 7.63233561,6.63717647 7.99434362,6.22682353 C8.36012255,6.63717647 9.43860476,7.72894118 8.14140938,8.62117647 C8.07730379,8.66635294 8.02451096,8.68517647 7.99434362,8.68517647 Z M6.2823474,6.67105882 C6.24463823,6.69364706 6.15790714,6.70870588 6.06363422,6.71623529 C3.93306623,6.75764706 4.39311808,4.75858824 4.52132925,4.03576471 C5.23780344,4.19764706 7.26278576,4.54023529 6.40678765,6.49035294 C6.36153665,6.58823529 6.31628565,6.64847059 6.2823474,6.67105882 Z\" fill=\"#ffffff\"/> </svg>",
@@ -291,7 +291,7 @@
291
291
  {
292
292
  "name": "list_categories",
293
293
  "displayName": "List Categories",
294
- "description": "List all category groups and categories in the active YNAB plan. Returns budgeted amounts, activity, and available balances for the current month. Excludes hidden and deleted categories by default.",
294
+ "description": "List category groups and categories in the active YNAB plan. Returns budgeted amounts, activity, and available balances for the current month. Hidden and deleted categories are excluded by default — pass include_hidden=true to also see hidden categories (useful for editing budgets on hidden categories).",
295
295
  "summary": "List budget categories with balances",
296
296
  "icon": "tags",
297
297
  "group": "Categories",
@@ -437,7 +437,7 @@
437
437
  },
438
438
  "month": {
439
439
  "type": "string",
440
- "minLength": 1,
440
+ "pattern": "^\\d{4}-\\d{2}(-\\d{2})?$",
441
441
  "description": "Month in YYYY-MM format (e.g. 2026-03)"
442
442
  },
443
443
  "budgeted": {
@@ -535,6 +535,128 @@
535
535
  "additionalProperties": false
536
536
  }
537
537
  },
538
+ {
539
+ "name": "move_category_budget",
540
+ "displayName": "Move Category Budget",
541
+ "description": "Move budgeted money between categories or to/from Ready to Assign for a specific month. Omit from_category_id to move money out of Ready to Assign; omit to_category_id to move money back to Ready to Assign. Both null is invalid.",
542
+ "summary": "Move money between budget categories",
543
+ "icon": "arrow-left-right",
544
+ "group": "Categories",
545
+ "input_schema": {
546
+ "type": "object",
547
+ "properties": {
548
+ "month": {
549
+ "type": "string",
550
+ "pattern": "^\\d{4}-\\d{2}(-\\d{2})?$",
551
+ "description": "Month in YYYY-MM format (e.g. 2026-03)"
552
+ },
553
+ "amount": {
554
+ "type": "number",
555
+ "exclusiveMinimum": 0,
556
+ "description": "Amount to move in currency units (e.g. 50 for $50)"
557
+ },
558
+ "from_category_id": {
559
+ "description": "Source category ID. Omit to move from Ready to Assign.",
560
+ "type": "string"
561
+ },
562
+ "to_category_id": {
563
+ "description": "Destination category ID. Omit to move to Ready to Assign.",
564
+ "type": "string"
565
+ }
566
+ },
567
+ "required": [
568
+ "month",
569
+ "amount"
570
+ ],
571
+ "additionalProperties": false
572
+ },
573
+ "output_schema": {
574
+ "type": "object",
575
+ "properties": {
576
+ "categories": {
577
+ "type": "array",
578
+ "items": {
579
+ "type": "object",
580
+ "properties": {
581
+ "id": {
582
+ "type": "string",
583
+ "description": "Category ID"
584
+ },
585
+ "category_group_id": {
586
+ "type": "string",
587
+ "description": "Parent category group ID"
588
+ },
589
+ "name": {
590
+ "type": "string",
591
+ "description": "Category name"
592
+ },
593
+ "hidden": {
594
+ "type": "boolean",
595
+ "description": "Whether the category is hidden"
596
+ },
597
+ "budgeted": {
598
+ "type": "string",
599
+ "description": "Amount budgeted this month as currency string"
600
+ },
601
+ "activity": {
602
+ "type": "string",
603
+ "description": "Spending activity this month as currency string"
604
+ },
605
+ "balance": {
606
+ "type": "string",
607
+ "description": "Available balance as currency string"
608
+ },
609
+ "budgeted_milliunits": {
610
+ "type": "number",
611
+ "description": "Amount budgeted in milliunits"
612
+ },
613
+ "activity_milliunits": {
614
+ "type": "number",
615
+ "description": "Activity in milliunits"
616
+ },
617
+ "balance_milliunits": {
618
+ "type": "number",
619
+ "description": "Balance in milliunits"
620
+ },
621
+ "goal_type": {
622
+ "type": "string",
623
+ "description": "Goal type (TB, TBD, MF, NEED, DEBT, or empty if none)"
624
+ },
625
+ "goal_target": {
626
+ "type": "string",
627
+ "description": "Goal target amount as currency string"
628
+ },
629
+ "goal_percentage_complete": {
630
+ "type": "number",
631
+ "description": "Goal completion percentage (0-100)"
632
+ }
633
+ },
634
+ "required": [
635
+ "id",
636
+ "category_group_id",
637
+ "name",
638
+ "hidden",
639
+ "budgeted",
640
+ "activity",
641
+ "balance",
642
+ "budgeted_milliunits",
643
+ "activity_milliunits",
644
+ "balance_milliunits",
645
+ "goal_type",
646
+ "goal_target",
647
+ "goal_percentage_complete"
648
+ ],
649
+ "additionalProperties": false
650
+ },
651
+ "description": "Updated categories (1 if RTA is involved, 2 for category-to-category)"
652
+ }
653
+ },
654
+ "required": [
655
+ "categories"
656
+ ],
657
+ "additionalProperties": false
658
+ }
659
+ },
538
660
  {
539
661
  "name": "list_payees",
540
662
  "displayName": "List Payees",
@@ -601,6 +723,14 @@
601
723
  "since_date": {
602
724
  "description": "Only return transactions on or after this date (YYYY-MM-DD). Omit for all transactions.",
603
725
  "type": "string"
726
+ },
727
+ "until_date": {
728
+ "description": "Only return transactions on or before this date (YYYY-MM-DD). Combine with since_date for a date range.",
729
+ "type": "string"
730
+ },
731
+ "payee_search": {
732
+ "description": "Case-insensitive substring match against payee_name, imported_payee, and original_imported_payee. Useful for finding all transactions for a merchant without knowing the exact payee ID.",
733
+ "type": "string"
604
734
  }
605
735
  },
606
736
  "additionalProperties": false
@@ -645,10 +775,6 @@
645
775
  "type": "string",
646
776
  "description": "Flag color or empty string"
647
777
  },
648
- "flag_name": {
649
- "type": "string",
650
- "description": "Custom flag name or empty string"
651
- },
652
778
  "account_id": {
653
779
  "type": "string",
654
780
  "description": "Account ID"
@@ -677,9 +803,13 @@
677
803
  "type": "string",
678
804
  "description": "If a transfer, the destination account ID"
679
805
  },
680
- "import_id": {
806
+ "imported_payee": {
681
807
  "type": "string",
682
- "description": "Import ID for deduplication"
808
+ "description": "Bank-imported payee name after YNAB cleansing (empty if manually entered)"
809
+ },
810
+ "original_imported_payee": {
811
+ "type": "string",
812
+ "description": "Raw payee string from the bank feed before any cleansing (empty if manually entered)"
683
813
  },
684
814
  "deleted": {
685
815
  "type": "boolean",
@@ -695,7 +825,6 @@
695
825
  "cleared",
696
826
  "approved",
697
827
  "flag_color",
698
- "flag_name",
699
828
  "account_id",
700
829
  "account_name",
701
830
  "payee_id",
@@ -703,7 +832,8 @@
703
832
  "category_id",
704
833
  "category_name",
705
834
  "transfer_account_id",
706
- "import_id",
835
+ "imported_payee",
836
+ "original_imported_payee",
707
837
  "deleted"
708
838
  ],
709
839
  "additionalProperties": false
@@ -776,10 +906,6 @@
776
906
  "type": "string",
777
907
  "description": "Flag color or empty string"
778
908
  },
779
- "flag_name": {
780
- "type": "string",
781
- "description": "Custom flag name or empty string"
782
- },
783
909
  "account_id": {
784
910
  "type": "string",
785
911
  "description": "Account ID"
@@ -808,9 +934,13 @@
808
934
  "type": "string",
809
935
  "description": "If a transfer, the destination account ID"
810
936
  },
811
- "import_id": {
937
+ "imported_payee": {
812
938
  "type": "string",
813
- "description": "Import ID for deduplication"
939
+ "description": "Bank-imported payee name after YNAB cleansing (empty if manually entered)"
940
+ },
941
+ "original_imported_payee": {
942
+ "type": "string",
943
+ "description": "Raw payee string from the bank feed before any cleansing (empty if manually entered)"
814
944
  },
815
945
  "deleted": {
816
946
  "type": "boolean",
@@ -826,7 +956,6 @@
826
956
  "cleared",
827
957
  "approved",
828
958
  "flag_color",
829
- "flag_name",
830
959
  "account_id",
831
960
  "account_name",
832
961
  "payee_id",
@@ -834,7 +963,8 @@
834
963
  "category_id",
835
964
  "category_name",
836
965
  "transfer_account_id",
837
- "import_id",
966
+ "imported_payee",
967
+ "original_imported_payee",
838
968
  "deleted"
839
969
  ],
840
970
  "additionalProperties": false
@@ -1025,10 +1155,6 @@
1025
1155
  "type": "string",
1026
1156
  "description": "Flag color or empty string"
1027
1157
  },
1028
- "flag_name": {
1029
- "type": "string",
1030
- "description": "Custom flag name or empty string"
1031
- },
1032
1158
  "account_id": {
1033
1159
  "type": "string",
1034
1160
  "description": "Account ID"
@@ -1057,9 +1183,13 @@
1057
1183
  "type": "string",
1058
1184
  "description": "If a transfer, the destination account ID"
1059
1185
  },
1060
- "import_id": {
1186
+ "imported_payee": {
1061
1187
  "type": "string",
1062
- "description": "Import ID for deduplication"
1188
+ "description": "Bank-imported payee name after YNAB cleansing (empty if manually entered)"
1189
+ },
1190
+ "original_imported_payee": {
1191
+ "type": "string",
1192
+ "description": "Raw payee string from the bank feed before any cleansing (empty if manually entered)"
1063
1193
  },
1064
1194
  "deleted": {
1065
1195
  "type": "boolean",
@@ -1075,7 +1205,6 @@
1075
1205
  "cleared",
1076
1206
  "approved",
1077
1207
  "flag_color",
1078
- "flag_name",
1079
1208
  "account_id",
1080
1209
  "account_name",
1081
1210
  "payee_id",
@@ -1083,7 +1212,8 @@
1083
1212
  "category_id",
1084
1213
  "category_name",
1085
1214
  "transfer_account_id",
1086
- "import_id",
1215
+ "imported_payee",
1216
+ "original_imported_payee",
1087
1217
  "deleted"
1088
1218
  ],
1089
1219
  "additionalProperties": false
@@ -1098,7 +1228,7 @@
1098
1228
  {
1099
1229
  "name": "update_transaction",
1100
1230
  "displayName": "Update Transaction",
1101
- "description": "Update an existing transaction in the active YNAB plan. Only specified fields are changed; omitted fields remain unchanged. Amount is in currency units (negative for expenses, positive for income).",
1231
+ "description": "Update an existing transaction in the active YNAB plan. Only specified fields are changed; omitted fields remain unchanged. Amount is in currency units (negative for expenses, positive for income). Transfers and split transactions cannot be updated through this tool — edit them directly in YNAB.",
1102
1232
  "summary": "Update a transaction",
1103
1233
  "icon": "pencil",
1104
1234
  "group": "Transactions",
@@ -1153,7 +1283,7 @@
1153
1283
  "type": "boolean"
1154
1284
  },
1155
1285
  "flag_color": {
1156
- "description": "New flag color",
1286
+ "description": "New flag color (pass \"none\" to clear)",
1157
1287
  "type": "string",
1158
1288
  "enum": [
1159
1289
  "red",
@@ -1161,7 +1291,8 @@
1161
1291
  "yellow",
1162
1292
  "green",
1163
1293
  "blue",
1164
- "purple"
1294
+ "purple",
1295
+ "none"
1165
1296
  ]
1166
1297
  }
1167
1298
  },
@@ -1209,10 +1340,6 @@
1209
1340
  "type": "string",
1210
1341
  "description": "Flag color or empty string"
1211
1342
  },
1212
- "flag_name": {
1213
- "type": "string",
1214
- "description": "Custom flag name or empty string"
1215
- },
1216
1343
  "account_id": {
1217
1344
  "type": "string",
1218
1345
  "description": "Account ID"
@@ -1241,9 +1368,13 @@
1241
1368
  "type": "string",
1242
1369
  "description": "If a transfer, the destination account ID"
1243
1370
  },
1244
- "import_id": {
1371
+ "imported_payee": {
1245
1372
  "type": "string",
1246
- "description": "Import ID for deduplication"
1373
+ "description": "Bank-imported payee name after YNAB cleansing (empty if manually entered)"
1374
+ },
1375
+ "original_imported_payee": {
1376
+ "type": "string",
1377
+ "description": "Raw payee string from the bank feed before any cleansing (empty if manually entered)"
1247
1378
  },
1248
1379
  "deleted": {
1249
1380
  "type": "boolean",
@@ -1259,7 +1390,6 @@
1259
1390
  "cleared",
1260
1391
  "approved",
1261
1392
  "flag_color",
1262
- "flag_name",
1263
1393
  "account_id",
1264
1394
  "account_name",
1265
1395
  "payee_id",
@@ -1267,7 +1397,8 @@
1267
1397
  "category_id",
1268
1398
  "category_name",
1269
1399
  "transfer_account_id",
1270
- "import_id",
1400
+ "imported_payee",
1401
+ "original_imported_payee",
1271
1402
  "deleted"
1272
1403
  ],
1273
1404
  "additionalProperties": false
@@ -1282,7 +1413,7 @@
1282
1413
  {
1283
1414
  "name": "delete_transaction",
1284
1415
  "displayName": "Delete Transaction",
1285
- "description": "Delete a transaction from the active YNAB plan. This marks the transaction as deleted (soft delete).",
1416
+ "description": "Delete a transaction from the active YNAB plan. This marks the transaction as deleted (soft delete). Transfer transactions cannot be deleted through this tool — delete them directly in YNAB.",
1286
1417
  "summary": "Delete a transaction",
1287
1418
  "icon": "trash-2",
1288
1419
  "group": "Transactions",
@@ -1486,8 +1617,15 @@
1486
1617
  "description": "Ready to Assign in milliunits"
1487
1618
  },
1488
1619
  "age_of_money": {
1489
- "type": "number",
1490
- "description": "Age of money in days"
1620
+ "anyOf": [
1621
+ {
1622
+ "type": "number"
1623
+ },
1624
+ {
1625
+ "type": "null"
1626
+ }
1627
+ ],
1628
+ "description": "Age of money in days, or null if not yet computed"
1491
1629
  }
1492
1630
  },
1493
1631
  "required": [
@@ -1527,6 +1665,10 @@
1527
1665
  "type": "string",
1528
1666
  "minLength": 1,
1529
1667
  "description": "Month in YYYY-MM-DD format (first of month, e.g. 2026-03-01)"
1668
+ },
1669
+ "include_hidden": {
1670
+ "description": "Include hidden categories (default false)",
1671
+ "type": "boolean"
1530
1672
  }
1531
1673
  },
1532
1674
  "required": [
@@ -1577,8 +1719,15 @@
1577
1719
  "description": "Ready to Assign in milliunits"
1578
1720
  },
1579
1721
  "age_of_money": {
1580
- "type": "number",
1581
- "description": "Age of money in days"
1722
+ "anyOf": [
1723
+ {
1724
+ "type": "number"
1725
+ },
1726
+ {
1727
+ "type": "null"
1728
+ }
1729
+ ],
1730
+ "description": "Age of money in days, or null if not yet computed"
1582
1731
  }
1583
1732
  },
1584
1733
  "required": [
@@ -10,9 +10,12 @@ interface CatalogResponse<T = Record<string, unknown>> {
10
10
  export declare const isAuthenticated: () => boolean;
11
11
  export declare const waitForAuth: () => Promise<boolean>;
12
12
  export declare const getPlanId: () => string;
13
+ export declare const getDeviceId: () => string;
14
+ export declare const getUserId: () => string;
15
+ export declare const assertAuthenticated: () => void;
13
16
  export declare const catalog: <T = Record<string, unknown>>(operationName: string, requestData?: Record<string, unknown>) => Promise<CatalogResponse<T>>;
14
17
  export declare const syncBudget: <T = Record<string, unknown>>(planId: string) => Promise<CatalogResponse<T>>;
15
- export declare const syncWrite: (planId: string, changedEntities: Record<string, unknown>) => Promise<CatalogResponse>;
18
+ export declare const syncWrite: <T = Record<string, unknown>>(planId: string, changedEntities: Record<string, unknown>, serverKnowledge?: number) => Promise<CatalogResponse<T>>;
16
19
  export declare const api: <T>(endpoint: string, options?: {
17
20
  method?: string;
18
21
  body?: Record<string, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"ynab-api.d.ts","sourceRoot":"","sources":["../src/ynab-api.ts"],"names":[],"mappings":"AAqBA,UAAU,eAAe,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACnD,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,gBAAgB,CAAC,EAAE,CAAC,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAyCD,eAAO,MAAM,eAAe,QAAO,OAA6B,CAAC;AAEjE,eAAO,MAAM,WAAW,QAAO,OAAO,CAAC,OAAO,CAI3C,CAAC;AAEJ,eAAO,MAAM,SAAS,QAAO,MAI5B,CAAC;AAoDF,eAAO,MAAM,OAAO,GAAU,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvD,eAAe,MAAM,EACrB,cAAa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,KACxC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CA8B5B,CAAC;AAQF,eAAO,MAAM,UAAU,GAAU,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,MAAM,KAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAWrG,CAAC;AAKL,eAAO,MAAM,SAAS,GAAU,QAAQ,MAAM,EAAE,iBAAiB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,OAAO,CAAC,eAAe,CAejH,CAAC;AAIF,eAAO,MAAM,GAAG,GAAU,CAAC,EACzB,UAAU,MAAM,EAChB,UAAS;IACP,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3B,KACL,OAAO,CAAC,CAAC,CAgCX,CAAC"}
1
+ {"version":3,"file":"ynab-api.d.ts","sourceRoot":"","sources":["../src/ynab-api.ts"],"names":[],"mappings":"AAqBA,UAAU,eAAe,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACnD,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,gBAAgB,CAAC,EAAE,CAAC,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AA2CD,eAAO,MAAM,eAAe,QAAO,OAA6B,CAAC;AAEjE,eAAO,MAAM,WAAW,QAAO,OAAO,CAAC,OAAO,CAI3C,CAAC;AAEJ,eAAO,MAAM,SAAS,QAAO,MAI5B,CAAC;AAEF,eAAO,MAAM,WAAW,QAAO,MAI9B,CAAC;AAEF,eAAO,MAAM,SAAS,QAAO,MAI5B,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAO,IAEtC,CAAC;AA4DF,eAAO,MAAM,OAAO,GAAU,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvD,eAAe,MAAM,EACrB,cAAa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,KACxC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAwB5B,CAAC;AAcF,eAAO,MAAM,UAAU,GAAU,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,MAAM,KAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAWrG,CAAC;AAKL,eAAO,MAAM,SAAS,GAAU,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzD,QAAQ,MAAM,EACd,iBAAiB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,kBAAkB,MAAM,KACvB,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAmB5B,CAAC;AAIF,eAAO,MAAM,GAAG,GAAU,CAAC,EACzB,UAAU,MAAM,EAChB,UAAS;IACP,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3B,KACL,OAAO,CAAC,CAAC,CA0BX,CAAC"}
package/dist/ynab-api.js CHANGED
@@ -1,9 +1,10 @@
1
- import { ToolError, getMetaContent, getPageGlobal, getCurrentUrl, waitUntil, parseRetryAfterMs, getAuthCache, setAuthCache, clearAuthCache, } from '@opentabs-dev/plugin-sdk';
1
+ import { clearAuthCache, getAuthCache, getCurrentUrl, getMetaContent, getPageGlobal, parseRetryAfterMs, setAuthCache, ToolError, waitUntil, } from '@opentabs-dev/plugin-sdk';
2
2
  // --- Auth extraction ---
3
3
  // YNAB uses HttpOnly session cookies for primary auth, plus a session token
4
4
  // embedded in a <meta name="session-token"> tag. The internal API requires
5
5
  // this token in the X-Session-Token header along with device identification
6
6
  // headers. The user ID comes from YNAB_CLIENT_CONSTANTS.USER.
7
+ const NOT_AUTHENTICATED_MESSAGE = 'Not authenticated — please log in to YNAB.';
7
8
  const generateDeviceId = () => crypto.randomUUID();
8
9
  const extractPlanId = () => {
9
10
  const url = getCurrentUrl();
@@ -38,14 +39,30 @@ export const waitForAuth = () => waitUntil(() => isAuthenticated(), { interval:
38
39
  export const getPlanId = () => {
39
40
  const auth = getAuth();
40
41
  if (!auth)
41
- throw ToolError.auth('Not authenticated — please log in to YNAB.');
42
+ throw ToolError.auth(NOT_AUTHENTICATED_MESSAGE);
42
43
  return auth.planId;
43
44
  };
45
+ export const getDeviceId = () => {
46
+ const auth = getAuth();
47
+ if (!auth)
48
+ throw ToolError.auth(NOT_AUTHENTICATED_MESSAGE);
49
+ return auth.deviceId;
50
+ };
51
+ export const getUserId = () => {
52
+ const auth = getAuth();
53
+ if (!auth)
54
+ throw ToolError.auth(NOT_AUTHENTICATED_MESSAGE);
55
+ return auth.userId;
56
+ };
57
+ export const assertAuthenticated = () => {
58
+ if (!getAuth())
59
+ throw ToolError.auth(NOT_AUTHENTICATED_MESSAGE);
60
+ };
44
61
  // --- Internal API headers ---
45
62
  const getHeaders = () => {
46
63
  const auth = getAuth();
47
64
  if (!auth)
48
- throw ToolError.auth('Not authenticated — please log in to YNAB.');
65
+ throw ToolError.auth(NOT_AUTHENTICATED_MESSAGE);
49
66
  // Read app version fresh on every request — never cache it, since YNAB enforces
50
67
  // a minimum version via 426 and will reject stale cached values.
51
68
  const appVersion = getPageGlobal('YNAB_CLIENT_CONSTANTS.YNAB_APP_VERSION');
@@ -82,9 +99,17 @@ const handleApiError = async (response, context) => {
82
99
  throw ToolError.validation(`Validation error: ${context} — ${errorBody}`);
83
100
  throw ToolError.internal(`API error (${response.status}): ${context} — ${errorBody}`);
84
101
  };
102
+ const handleNetworkError = (err, context) => {
103
+ if (err instanceof DOMException && err.name === 'TimeoutError')
104
+ throw ToolError.timeout(`Request timed out: ${context}`);
105
+ if (err instanceof DOMException && err.name === 'AbortError')
106
+ throw new ToolError('Request was aborted', 'aborted');
107
+ throw new ToolError(`Network error: ${err instanceof Error ? err.message : String(err)}`, 'network_error', {
108
+ category: 'internal',
109
+ retryable: true,
110
+ });
111
+ };
85
112
  // --- Catalog API (internal RPC endpoint) ---
86
- // YNAB's web app uses POST /api/v1/catalog with operation_name + request_data
87
- // as the primary data access mechanism for budget operations.
88
113
  export const catalog = async (operationName, requestData = {}) => {
89
114
  const headers = getHeaders();
90
115
  headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
@@ -99,14 +124,7 @@ export const catalog = async (operationName, requestData = {}) => {
99
124
  });
100
125
  }
101
126
  catch (err) {
102
- if (err instanceof DOMException && err.name === 'TimeoutError')
103
- throw ToolError.timeout(`Catalog request timed out: ${operationName}`);
104
- if (err instanceof DOMException && err.name === 'AbortError')
105
- throw new ToolError('Request was aborted', 'aborted');
106
- throw new ToolError(`Network error: ${err instanceof Error ? err.message : String(err)}`, 'network_error', {
107
- category: 'internal',
108
- retryable: true,
109
- });
127
+ return handleNetworkError(err, operationName);
110
128
  }
111
129
  if (!response.ok)
112
130
  return handleApiError(response, operationName);
@@ -119,6 +137,12 @@ export const catalog = async (operationName, requestData = {}) => {
119
137
  // --- syncBudgetData helper ---
120
138
  // YNAB requires sync_type, schema_version, and schema_version_of_knowledge on all
121
139
  // syncBudgetData requests (enforced server-side via 426 if omitted).
140
+ //
141
+ // We send sync_type: 'delta' with starting_device_knowledge: 0 to receive a full
142
+ // snapshot of the budget. Counter-intuitively, sync_type: 'bootstrap' returns
143
+ // only the most recent ~1 month of transactions, while delta with zero device
144
+ // knowledge returns the full history (verified with the YNAB UI's own captures).
145
+ // Verified working as of schema version 41.
122
146
  const BUDGET_SCHEMA_VERSION = 41;
123
147
  export const syncBudget = async (planId) => catalog('syncBudgetData', {
124
148
  budget_version_id: planId,
@@ -132,16 +156,20 @@ export const syncBudget = async (planId) => catalog('syncBudgetData', {
132
156
  changed_entities: {},
133
157
  });
134
158
  // Write operations require the current server_knowledge to succeed.
135
- // This fetches it first, then sends the write in one round-trip.
136
- export const syncWrite = async (planId, changedEntities) => {
137
- const readResult = await syncBudget(planId);
138
- const serverKnowledge = readResult.current_server_knowledge ?? 0;
159
+ // Pass serverKnowledge from a prior syncBudget call to avoid a redundant read.
160
+ export const syncWrite = async (planId, changedEntities, serverKnowledge) => {
161
+ const knowledge = serverKnowledge ?? (await syncBudget(planId)).current_server_knowledge ?? 0;
162
+ // ending_device_knowledge is the local change counter — YNAB's UI increments
163
+ // it across the session, but since we don't persist any state we send 1 to
164
+ // signal "one new change since 0". The server only enforces monotonic
165
+ // increase relative to its own knowledge, not the client counter, so a
166
+ // constant 1 is what YNAB tolerates from us in practice.
139
167
  return catalog('syncBudgetData', {
140
168
  budget_version_id: planId,
141
169
  sync_type: 'delta',
142
170
  starting_device_knowledge: 0,
143
171
  ending_device_knowledge: 1,
144
- device_knowledge_of_server: serverKnowledge,
172
+ device_knowledge_of_server: knowledge,
145
173
  calculated_entities_included: false,
146
174
  schema_version: BUDGET_SCHEMA_VERSION,
147
175
  schema_version_of_knowledge: BUDGET_SCHEMA_VERSION,
@@ -167,14 +195,7 @@ export const api = async (endpoint, options = {}) => {
167
195
  });
168
196
  }
169
197
  catch (err) {
170
- if (err instanceof DOMException && err.name === 'TimeoutError')
171
- throw ToolError.timeout(`API request timed out: ${endpoint}`);
172
- if (err instanceof DOMException && err.name === 'AbortError')
173
- throw new ToolError('Request was aborted', 'aborted');
174
- throw new ToolError(`Network error: ${err instanceof Error ? err.message : String(err)}`, 'network_error', {
175
- category: 'internal',
176
- retryable: true,
177
- });
198
+ return handleNetworkError(err, endpoint);
178
199
  }
179
200
  if (!response.ok)
180
201
  return handleApiError(response, endpoint);