{"_id":"das-budget-sdk","_rev":"44-d5a86835b6c77bba0507f6f1ccb79ed4","name":"das-budget-sdk","dist-tags":{"latest":"1.1.19"},"versions":{"1.1.13":{"name":"das-budget-sdk","version":"1.1.13","keywords":["das","budget","sdk","api"],"author":{"name":"Kristopher Linquist"},"license":"MIT","_id":"das-budget-sdk@1.1.13","maintainers":[{"name":"klinquist","email":"kris@linquist.com"}],"homepage":"https://github.com/klinquist/das-budget-sdk#readme","bugs":{"url":"https://github.com/klinquist/das-budget-sdk/issues"},"dist":{"shasum":"90f864cbad8d41ff42736ae43c54adb7f6d9cc3b","tarball":"https://registry.npmjs.org/das-budget-sdk/-/das-budget-sdk-1.1.13.tgz","fileCount":12,"integrity":"sha512-eEGPSiEWZCZtRIoby6i7WL0ryp5CkU/pl1bfFyLL+yDNr+uamhUQv+AdINOJDBVFAqm+nEmrdjoNRuxdmx+pqA==","signatures":[{"sig":"MEQCIHNwL3FPZkqh2rtwvnYRrPUC9lNvWHEOOrZJMmsvXzapAiBFy1wd1PUKr8g2q1gP0Zp9HGtR7CEzkkGdjc4M3/dv+w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":47131},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"22a19143a4bb0c50e97ccf151045eac471986458","scripts":{"lint":"eslint src/**/*.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc"},"_npmUser":{"name":"klinquist","email":"kris@linquist.com"},"repository":{"url":"git+https://github.com/klinquist/das-budget-sdk.git","type":"git"},"_npmVersion":"10.9.2","description":"An UNOFFICIAL TypeScript SDK for interacting with the DAS Budget API","directories":{},"_nodeVersion":"23.11.0","dependencies":{"axios":"^1.6.7"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.57.1","globals":"^16.0.0","@eslint/js":"^9.24.0","typescript":"~5.3.3","@types/node":"^22.14.1","@typescript-eslint/parser":"^7.18.0","@typescript-eslint/eslint-plugin":"^7.18.0"},"_npmOperationalInternal":{"tmp":"tmp/das-budget-sdk_1.1.13_1747316619363_0.8231573523055908","host":"s3://npm-registry-packages-npm-production"},"deprecated":"DAS Budget is now Beacon Budget. Use beacon-budget-sdk instead."},"1.1.14":{"name":"das-budget-sdk","version":"1.1.14","keywords":["das","budget","sdk","api"],"author":{"name":"Kristopher Linquist"},"license":"MIT","_id":"das-budget-sdk@1.1.14","maintainers":[{"name":"klinquist","email":"kris@linquist.com"}],"homepage":"https://github.com/klinquist/das-budget-sdk#readme","bugs":{"url":"https://github.com/klinquist/das-budget-sdk/issues"},"dist":{"shasum":"adbd37038afe3949fab18260615c06a098fd6c20","tarball":"https://registry.npmjs.org/das-budget-sdk/-/das-budget-sdk-1.1.14.tgz","fileCount":12,"integrity":"sha512-D3uRZnEAmJEPYN8W+h/9DtV65IZYmZehrq8D9+ZxXIUlb6QHXas4gMOJy5KOI1CVzu/nvE3EzoaBaRcf274eDw==","signatures":[{"sig":"MEUCIAN3aIg5FV/pIJpHmQ+j7PKQdjip1vIkZx3repsqgIhkAiEAnITJzi5tU/3jIccTpvrDYeQugLSwTiLEOK1KnTwqB1s=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":47153},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"caa08f5daf61460c14a9313107f11c2c5668df83","scripts":{"lint":"eslint src/**/*.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc"},"_npmUser":{"name":"klinquist","email":"kris@linquist.com"},"repository":{"url":"git+https://github.com/klinquist/das-budget-sdk.git","type":"git"},"_npmVersion":"10.9.2","description":"An UNOFFICIAL TypeScript SDK for interacting with the DAS Budget API","directories":{},"_nodeVersion":"23.11.0","dependencies":{"axios":"^1.6.7"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.57.1","globals":"^16.0.0","@eslint/js":"^9.24.0","typescript":"~5.3.3","@types/node":"^22.14.1","@typescript-eslint/parser":"^7.18.0","@typescript-eslint/eslint-plugin":"^7.18.0"},"_npmOperationalInternal":{"tmp":"tmp/das-budget-sdk_1.1.14_1747317823454_0.8699964229311601","host":"s3://npm-registry-packages-npm-production"},"deprecated":"DAS Budget is now Beacon Budget. Use beacon-budget-sdk instead."},"1.1.15":{"name":"das-budget-sdk","version":"1.1.15","keywords":["das","budget","sdk","api"],"author":{"name":"Kristopher Linquist"},"license":"MIT","_id":"das-budget-sdk@1.1.15","maintainers":[{"name":"klinquist","email":"kris@linquist.com"}],"homepage":"https://github.com/klinquist/das-budget-sdk#readme","bugs":{"url":"https://github.com/klinquist/das-budget-sdk/issues"},"dist":{"shasum":"f9a372558acc70f5355be80494898a5e7d4f7b8d","tarball":"https://registry.npmjs.org/das-budget-sdk/-/das-budget-sdk-1.1.15.tgz","fileCount":13,"integrity":"sha512-gb9agLpimeXqpaxw+f7+D8x9C5cnDVX4yx1DM/J2sAorxGuQ1ec213ik81sTgaeR0qNM/0eIUf8smi6XEp4U6w==","signatures":[{"sig":"MEQCICXBLF3ZcWn+sxIGG9fdFZpa/0qg6+xEpWUEXqFa6YaeAiAkGAk6nb87xCQ2SHXYM+W1iRCbA+JU2HIYkwKqs4OkMQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":60385},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"b332a3c1f58f6a43388e46d074ede13a37c5e92f","scripts":{"lint":"eslint src/**/*.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc"},"_npmUser":{"name":"klinquist","email":"kris@linquist.com"},"repository":{"url":"git+https://github.com/klinquist/das-budget-sdk.git","type":"git"},"_npmVersion":"10.2.4","description":"An UNOFFICIAL TypeScript SDK for interacting with the DAS Budget API","directories":{},"_nodeVersion":"21.6.1","dependencies":{"axios":"^1.9.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.57.1","globals":"^16.0.0","@eslint/js":"^9.24.0","typescript":"~5.3.3","@types/node":"^22.14.1","@typescript-eslint/parser":"^7.18.0","@typescript-eslint/eslint-plugin":"^7.18.0"},"_npmOperationalInternal":{"tmp":"tmp/das-budget-sdk_1.1.15_1748436307883_0.922028739562252","host":"s3://npm-registry-packages-npm-production"},"deprecated":"DAS Budget is now Beacon Budget. Use beacon-budget-sdk instead."},"1.1.16":{"name":"das-budget-sdk","version":"1.1.16","keywords":["das","budget","sdk","api"],"author":{"name":"Kristopher Linquist"},"license":"MIT","_id":"das-budget-sdk@1.1.16","maintainers":[{"name":"klinquist","email":"kris@linquist.com"}],"homepage":"https://github.com/klinquist/das-budget-sdk#readme","bugs":{"url":"https://github.com/klinquist/das-budget-sdk/issues"},"dist":{"shasum":"44f833aa37888c46a6282e1897d1c1e87fa446c7","tarball":"https://registry.npmjs.org/das-budget-sdk/-/das-budget-sdk-1.1.16.tgz","fileCount":13,"integrity":"sha512-ZdPb3/jj96j369MViECFEgvTc3o2Lg46SAUPEqM4qihVgxHOc6OnqH8Txk5fG+T5rCcS66KPDpdiPen4/QUloA==","signatures":[{"sig":"MEUCIQCpt8fi9fbF5B42cKgLOY4NgvQHiUcxSpzUvmStYPhfjQIgFRE3V+S+ahC84C4dPAVC7ZnBC6rJ4/ENL4b8estidmE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":65167},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"5c77d323470aa84f430b6989eda8981dff48bdcd","scripts":{"lint":"eslint src/**/*.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc"},"_npmUser":{"name":"klinquist","email":"kris@linquist.com"},"repository":{"url":"git+https://github.com/klinquist/das-budget-sdk.git","type":"git"},"_npmVersion":"10.9.2","description":"An UNOFFICIAL TypeScript SDK for interacting with the DAS Budget API","directories":{},"_nodeVersion":"23.11.0","dependencies":{"axios":"^1.9.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.57.1","globals":"^16.0.0","@eslint/js":"^9.24.0","typescript":"~5.3.3","@types/node":"^22.14.1","@typescript-eslint/parser":"^7.18.0","@typescript-eslint/eslint-plugin":"^7.18.0"},"_npmOperationalInternal":{"tmp":"tmp/das-budget-sdk_1.1.16_1748439039172_0.2558551809359253","host":"s3://npm-registry-packages-npm-production"},"deprecated":"DAS Budget is now Beacon Budget. Use beacon-budget-sdk instead."},"1.1.17":{"name":"das-budget-sdk","version":"1.1.17","keywords":["das","budget","sdk","api"],"author":{"name":"Kristopher Linquist"},"license":"MIT","_id":"das-budget-sdk@1.1.17","maintainers":[{"name":"klinquist","email":"kris@linquist.com"}],"homepage":"https://github.com/klinquist/das-budget-sdk#readme","bugs":{"url":"https://github.com/klinquist/das-budget-sdk/issues"},"dist":{"shasum":"49ab6bbc4da9aa6318e7d9661bb56d5cdda759ba","tarball":"https://registry.npmjs.org/das-budget-sdk/-/das-budget-sdk-1.1.17.tgz","fileCount":13,"integrity":"sha512-OvERZlpezQNuV7qC7ZBtrJYxGATJWhpnIF6x5XfDgpxIsXqjrZmibgdUXODaR6OSJsyC8SY3fpwBDCs7cgFw1A==","signatures":[{"sig":"MEUCIQCKQ8x3sJcH4OlxDw76yJi5mThy8O0QigQV/bCxduIkJgIgey8HHGo4H7RcM0DBJURNpZVqKLO8EtEKzi+3YmKLtiU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":62710},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"68d67db687640d00deecbdb04afcf2c4e30314cd","scripts":{"lint":"eslint src/**/*.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc"},"_npmUser":{"name":"klinquist","email":"kris@linquist.com"},"repository":{"url":"git+https://github.com/klinquist/das-budget-sdk.git","type":"git"},"_npmVersion":"10.9.4","description":"An UNOFFICIAL TypeScript SDK for interacting with the DAS Budget API","directories":{},"_nodeVersion":"22.22.0","dependencies":{"axios":"^1.9.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.57.1","globals":"^16.0.0","@eslint/js":"^9.24.0","typescript":"~5.3.3","@types/node":"^22.14.1","@typescript-eslint/parser":"^7.18.0","@typescript-eslint/eslint-plugin":"^7.18.0"},"_npmOperationalInternal":{"tmp":"tmp/das-budget-sdk_1.1.17_1771854100804_0.3271559999235858","host":"s3://npm-registry-packages-npm-production"},"deprecated":"DAS Budget is now Beacon Budget. Use beacon-budget-sdk instead."},"1.1.18":{"name":"das-budget-sdk","version":"1.1.18","keywords":["das","budget","sdk","api"],"author":{"name":"Kristopher Linquist"},"license":"MIT","_id":"das-budget-sdk@1.1.18","maintainers":[{"name":"klinquist","email":"kris@linquist.com"}],"homepage":"https://github.com/klinquist/das-budget-sdk#readme","bugs":{"url":"https://github.com/klinquist/das-budget-sdk/issues"},"dist":{"shasum":"f665699d3d45904ff3e555d96056804e6c5a4a6c","tarball":"https://registry.npmjs.org/das-budget-sdk/-/das-budget-sdk-1.1.18.tgz","fileCount":13,"integrity":"sha512-7hebOw7jxQRDo//nyR0IlXkpu3aPWUcu4Pt9QeiMGiIdNWdcyclM4hQ9DVuUdSgkSPM+y3qC9D/hmysmfGOdew==","signatures":[{"sig":"MEQCIAod+BxfOM6yvrBdyL5wtvtMzPY2MwYxBWhqimJsUE0vAiB8Bge87CPdB7a30/m8yaDmxuxnjnHdzlK4fZk6yZ1Wpw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":64246},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"226f1931e2b013c1e7ab5ef2e79fc4db030c0d63","scripts":{"lint":"eslint src/**/*.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc"},"_npmUser":{"name":"klinquist","email":"kris@linquist.com"},"repository":{"url":"git+https://github.com/klinquist/das-budget-sdk.git","type":"git"},"_npmVersion":"10.9.4","description":"An UNOFFICIAL TypeScript SDK for interacting with the DAS Budget API","directories":{},"_nodeVersion":"22.22.0","dependencies":{"axios":"^1.9.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.57.1","globals":"^16.0.0","@eslint/js":"^9.24.0","typescript":"~5.3.3","@types/node":"^22.14.1","@typescript-eslint/parser":"^7.18.0","@typescript-eslint/eslint-plugin":"^7.18.0"},"_npmOperationalInternal":{"tmp":"tmp/das-budget-sdk_1.1.18_1771855138335_0.14194886756580471","host":"s3://npm-registry-packages-npm-production"},"deprecated":"DAS Budget is now Beacon Budget. Use beacon-budget-sdk instead."},"1.1.19":{"name":"das-budget-sdk","version":"1.1.19","keywords":["das","budget","sdk","api"],"author":{"name":"Kristopher Linquist"},"license":"MIT","_id":"das-budget-sdk@1.1.19","maintainers":[{"name":"klinquist","email":"kris@linquist.com"}],"homepage":"https://github.com/klinquist/das-budget-sdk#readme","bugs":{"url":"https://github.com/klinquist/das-budget-sdk/issues"},"dist":{"shasum":"e84c3714430316a90ae23415c49a74416023721a","tarball":"https://registry.npmjs.org/das-budget-sdk/-/das-budget-sdk-1.1.19.tgz","fileCount":13,"integrity":"sha512-j1ftD3vdQs+axpmOPBNEYdd+mUA2gF0KNFzPKuGjB5Xmhc1KYO4l1Qh/Y27zLQAJJfRDYN3P+dt+R4dqpZ4Yhw==","signatures":[{"sig":"MEYCIQCWqA5GM0JWetTMTaIY+yf46ey2n/3Vp0nfGd/6nYxeQgIhAK1MV8eiQ0XJBZWPHRyb1quIb+s+KiFVFOccmoCAWmwh","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":64539},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"65a71e5681a203c290a11b2a6e7830df3b4a451c","scripts":{"lint":"eslint src/**/*.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc"},"_npmUser":{"name":"klinquist","email":"kris@linquist.com"},"repository":{"url":"git+https://github.com/klinquist/das-budget-sdk.git","type":"git"},"_npmVersion":"10.9.4","description":"An UNOFFICIAL TypeScript SDK for interacting with the DAS Budget API","directories":{},"_nodeVersion":"22.22.0","dependencies":{"axios":"^1.9.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.57.1","globals":"^16.0.0","@eslint/js":"^9.24.0","typescript":"~5.3.3","@types/node":"^22.14.1","@typescript-eslint/parser":"^7.18.0","@typescript-eslint/eslint-plugin":"^7.18.0"},"_npmOperationalInternal":{"tmp":"tmp/das-budget-sdk_1.1.19_1771856227631_0.5048236286363035","host":"s3://npm-registry-packages-npm-production"},"deprecated":"DAS Budget is now Beacon Budget. Use beacon-budget-sdk instead."}},"time":{"created":"2025-04-15T02:51:43.940Z","modified":"2026-05-21T17:04:18.376Z","1.0.0":"2025-04-15T02:51:44.176Z","1.0.1":"2025-04-15T02:56:17.434Z","1.0.2":"2025-04-15T13:57:33.377Z","1.0.3":"2025-04-16T15:20:50.894Z","1.0.4":"2025-04-16T15:22:30.815Z","1.1.0":"2025-04-17T03:58:47.971Z","1.1.1":"2025-04-17T04:04:56.351Z","1.1.2":"2025-04-17T12:35:50.252Z","1.1.3":"2025-04-17T12:55:59.581Z","1.1.4":"2025-04-17T13:00:37.298Z","1.1.5":"2025-04-17T13:36:58.388Z","1.1.6":"2025-04-17T13:53:20.665Z","1.1.7":"2025-04-17T14:11:11.103Z","1.1.8":"2025-04-18T12:29:35.869Z","1.1.9":"2025-04-19T13:35:00.915Z","1.1.10":"2025-04-21T11:50:58.009Z","1.1.11":"2025-05-15T13:37:32.424Z","1.1.12":"2025-05-15T13:39:07.295Z","1.1.13":"2025-05-15T13:43:39.545Z","1.1.14":"2025-05-15T14:03:43.657Z","1.1.15":"2025-05-28T12:45:08.062Z","1.1.16":"2025-05-28T13:30:39.354Z","1.1.17":"2026-02-23T13:41:40.971Z","1.1.18":"2026-02-23T13:58:58.475Z","1.1.19":"2026-02-23T14:17:07.766Z"},"bugs":{"url":"https://github.com/klinquist/das-budget-sdk/issues"},"author":{"name":"Kristopher Linquist"},"license":"MIT","homepage":"https://github.com/klinquist/das-budget-sdk#readme","keywords":["das","budget","sdk","api"],"repository":{"url":"git+https://github.com/klinquist/das-budget-sdk.git","type":"git"},"description":"An UNOFFICIAL TypeScript SDK for interacting with the DAS Budget API","maintainers":[{"name":"klinquist","email":"kris@linquist.com"}],"readme":"# DAS Budget SDK\n\nAn UNOFFICIAL TypeScript SDK for interacting with the DAS Budget API. I created this for one purpose: to assign transactions to buckets based on some advanced logic that is not supported by the DAS Budget App. If you'd like to see any additional features, please open an issue!\n\n## Installation\n\n```bash\nnpm install das-budget-sdk\n```\n\n## Usage\n\n### Getting Your Refresh Token\n\n1. Log in to [DAS Budget](https://app.dasbudget.com)\n2. Open your browser's developer tools (F12 or right-click -> Inspect)\n3. Go to the Console tab\n4. Paste this code to reveal the refresh token:\n\n```javascript\nindexedDB.open(\"firebaseLocalStorageDb\").onsuccess = function (event) {\n  const db = event.target.result;\n  const transaction = db.transaction(\"firebaseLocalStorage\", \"readonly\");\n  const store = transaction.objectStore(\"firebaseLocalStorage\");\n  const request = store.getAll();\n\n  request.onsuccess = function () {\n    const data = request.result[0];\n    console.log(\"Refresh Token:\", data.value.stsTokenManager.refreshToken);\n  };\n};\n```\n\n### Writing Code\n\n```typescript\nimport { DasBudget, FREE_TO_SPEND } from \"das-budget-sdk\";\n\nconst client = new DasBudget({\n  refreshToken: \"your_refresh_token\",\n  apiKey: \"AIzaSyAidm6Qvd5nsjdSSLmMdc-5RAWjIGv5a7I\", //This is the API key the app uses\n  debug: true, // Optional: enables debug logging\n});\n\n// Initialize the client\nawait client.initialize();\n\n// Get all budgets\nconst budgets = await client.budgets();\n\n// Set a default budget ID for all future API calls\nclient.setBudgetId(budgets[0].id);\n\n// Get all transactions (will use the set budget ID)\nconst transactions = await client.transactions();\n\n// Get transactions since a specific timestamp (in seconds since epoch)\nconst recentTransactions = await client.transactions({ since: 1744334993 });\n\n// Get all expenses (will use the set budget ID)\nconst expenses = await client.expenses();\n\n// Get all goals (will use the set budget ID)\nconst goals = await client.goals();\n\n// Get all vaults (will use the set budget ID)\nconst vaults = await client.vaults();\n\n// Get all accounts (will use the set budget ID)\nconst accounts = await client.accounts();\n\n// Get all items (financial institutions) (will use the set budget ID). Note that an item is a concept thatcan contain one or more accounts.\nconst items = await client.items();\n\n// Get refresh information (will use the set budget ID)\nconst refreshes = await client.refreshes();\n\n// Refresh an account's data (will use the set budget ID)\nawait client.refresh({ itemId: \"itemId\" });\n\n// Or use a premium refresh (will use the set budget ID)\nawait client.refresh({\n  itemId: \"item_id\",\n  usePremium: true,\n});\n\n// Or specify a different budget ID for this refresh\nawait client.refresh({\n  accountId: \"account_id\",\n  usePremium: true,\n  budgetId: \"other_budget_id\",\n});\n\n// Assign a transaction to a bucket (will use the set budget ID)\nconst updatedTransaction = await client.assignTransactionToBucket({\n  transactionId: \"transaction_id\",\n  bucketId: \"bucket_id\",\n});\n\n// Assign a transaction to Free to Spend (will use the set budget ID)\nconst freeToSpendTransaction = await client.assignTransactionToBucket({\n  transactionId: \"transaction_id\",\n  bucketId: FREE_TO_SPEND,\n});\n\n// You can still override the budget ID for individual calls if needed\nconst otherBudgetTransactions = await client.transactions({\n  budgetId: \"other_budget_id\",\n});\n\n// Clear the default budget ID to go back to using the oldest budget\nclient.setBudgetId(null);\n```\n\n## Advanced Example: Monitoring Transactions and Auto-Assigning\n\nHere's an example of how to use the SDK to monitor transactions and automatically assign them to buckets:\n\n```javascript\nrequire(\"dotenv\").config();\nconst DasBudget = require(\"das-budget-sdk\").default;\n\nconst log = (message) => {\n  const date = new Date();\n  const pacificTime = date.toLocaleString(\"en-US\", {\n    timeZone: \"America/Los_Angeles\",\n  });\n  console.log(`${pacificTime} ${message}`);\n};\n\nconst expenseMappings = [\n  {\n    name_contains: \"VENMO\",\n    friendly_name: \"Housekeeping\",\n    amount_between_min: 50,\n    amount_between_max: 50,\n    bucket_id: \"XXXXXXXXXX\",\n  },\n];\n\n// Initialize the client\nconst client = new DasBudget({\n  refreshToken: process.env.REFRESH_TOKEN,\n  apiKey: process.env.API_KEY,\n  debug: false,\n});\n\nconst ONE_DAY_AGO = Math.floor(Date.now() / 1000) - 86400;\n\nasync function monitorTransactions(timeSince) {\n  // Get transactions from the last hour\n  const transactions = await client.transactions({ since: timeSince });\n\n  //Look for rent payment transactions\n  for (const transaction of transactions) {\n    log(`Evaluating transaction \"${transaction.data.raw_name}\"`);\n    expenseMappings.forEach(async (expenseMapping) => {\n      if (\n        transaction.data.raw_name\n          .toUpperCase()\n          .includes(expenseMapping.name_contains.toUpperCase()) &&\n        Number(transaction.amount) >= expenseMapping.amount_between_min &&\n        Number(transaction.amount) <= expenseMapping.amount_between_max &&\n        transaction.bucket_id === null\n      ) {\n        await client.assignTransactionToBucket({\n          transactionId: transaction.id,\n          bucketId: expenseMapping.bucket_id,\n        });\n        log(\n          `Assigned transaction ${transaction.id} to ${expenseMapping.friendly_name}`\n        );\n      }\n    });\n  }\n}\n\n// Main function to run the monitoring\nasync function main() {\n  //Run the monitoring every hour\n  setInterval(() => {\n    const ONE_HOUR_AGO = Math.floor(Date.now() / 1000) - 3600;\n    monitorTransactions(ONE_HOUR_AGO).catch(console.error);\n  }, 3600000); // 1 hour\n\n  //Run immediately on startup\n  await monitorTransactions(ONE_DAY_AGO);\n}\n\n// Start the monitoring\nmain().catch(console.error);\n```\n\n## API Reference\n\n### `DasBudget(config: DasBudgetConfig)`\n\nCreates a new DAS Budget client instance.\n\n#### Configuration\n\n```typescript\ninterface DasBudgetConfig {\n  refreshToken: string; // Your DAS Budget refresh token\n  apiKey: string; // Your DAS Budget API key\n  debug?: boolean; // Optional: enables debug logging\n}\n```\n\n### Methods\n\n#### `initialize(): Promise<void>`\n\nInitializes the client by fetching an access token. This is called automatically when needed, but you can call it explicitly to ensure the client is ready.\n\n#### `setBudgetId(budgetId: string | null): void`\n\nSets the budget ID to use for all future API calls. If not set, the oldest budget will be used by default. Most accounts only have one budget, so this is usually what you want.\n\nParameters:\n\n- `budgetId`: The ID of the budget to use, or `null` to clear the setting and use the oldest budget\n\nExample:\n\n```typescript\n// Get all budgets\nconst budgets = await client.budgets();\n\n// Set a default budget ID for all future API calls\nclient.setBudgetId(budgets[0].id);\n\n// All subsequent API calls will use this budget ID\nconst transactions = await client.transactions();\n\n// You can still override the budget ID for individual calls\nconst otherBudgetTransactions = await client.transactions({\n  budgetId: \"other_budget_id\",\n});\n\n// Clear the default budget ID\nclient.setBudgetId(null);\n```\n\n#### `transactions(options?: TransactionsOptions): Promise<Transaction[]>`\n\nFetches transactions from your accounts.\n\nOptions:\n\n```typescript\ninterface TransactionsOptions {\n  since?: number; // Optional: Unix timestamp in seconds to filter transactions\n  budgetId?: string; // Optional: ID of the budget context to use\n}\n```\n\n#### `expenses(options?: ApiOptions): Promise<Bucket[]>`\n\nFetches all expense buckets.\n\nOptions:\n\n```typescript\ninterface ApiOptions {\n  budgetId?: string; // Optional: ID of the budget context to use\n}\n```\n\n#### `goals(options?: ApiOptions): Promise<Bucket[]>`\n\nFetches all goal buckets.\n\nOptions:\n\n```typescript\ninterface ApiOptions {\n  budgetId?: string; // Optional: ID of the budget context to use\n}\n```\n\n#### `vaults(options?: ApiOptions): Promise<Bucket[]>`\n\nFetches all vault buckets.\n\nOptions:\n\n```typescript\ninterface ApiOptions {\n  budgetId?: string; // Optional: ID of the budget context to use\n}\n```\n\n#### `accounts(options?: ApiOptions): Promise<Account[]>`\n\nFetches all linked accounts.\n\nOptions:\n\n```typescript\ninterface ApiOptions {\n  budgetId?: string; // Optional: ID of the budget context to use\n}\n```\n\n#### `items(options?: ApiOptions): Promise<AccountItem[]>`\n\nFetches all linked items (financial institutions). Each item contains information about the institution and its connection status.\n\nOptions:\n\n```typescript\ninterface ApiOptions {\n  budgetId?: string; // Optional: ID of the budget context to use\n}\n```\n\nReturns an array of `AccountItem` objects, which include:\n\n- Institution information (name, logo, status)\n- Connection details (last sync, sync status)\n- Associated accounts\n- Refresh capabilities\n\nExample:\n\n```typescript\nconst items = await client.items();\nitems.forEach((item) => {\n  console.log(`Institution: ${item.institution_name}`);\n  console.log(`Last sync: ${item.last_sync}`);\n  console.log(`Can refresh: ${item.can_refresh}`);\n});\n```\n\n#### `refreshes(options?: ApiOptions): Promise<RefreshesResponse>`\n\nFetches refresh information including credit balance, next available credits, and item refresh status.\n\nOptions:\n\n```typescript\ninterface ApiOptions {\n  budgetId?: string; // Optional: ID of the budget context to use\n}\n```\n\n#### `budgets(): Promise<Budget[]>`\n\nFetches all budgets in your account. This method does not accept a `budgetId` parameter since it's used to get all available budgets.\n\nReturns an array of `Budget` objects, where the first budget (index 0) is typically your oldest/primary budget.\n\nNote: For all other API methods, if you don't specify a `budgetId`, it will use your oldest budget by default. Most accounts only have one budget, so this is usually what you want.\n\n#### `refresh(accountId: string, usePremium: boolean = false, options?: ApiOptions): Promise<void>`\n\nRefreshes the data for a specific account. This will trigger a sync with the account's institution.\n\nParameters:\n\n- `accountId`: The ID of the account to refresh\n- `usePremium`: Optional. If true, will use a premium refresh credit. Defaults to false.\n- `options`: Optional. Additional options including budgetId.\n\nOptions:\n\n```typescript\ninterface ApiOptions {\n  budgetId?: string; // Optional: ID of the budget context to use\n}\n```\n\n#### `assignTransactionToBucket(options: AssignTransactionOptions): Promise<Transaction>`\n\nAssigns a transaction to a specific bucket or to Free to Spend.\n\nOptions:\n\n```typescript\ninterface AssignTransactionOptions {\n  transactionId: string; // The ID of the transaction to assign\n  bucketId: string | typeof FREE_TO_SPEND; // The ID of the bucket to assign to, or FREE_TO_SPEND\n  budgetId?: string; // Optional: ID of the budget context to use\n}\n```\n\n## Data Models\n\n### Transaction\n\n```typescript\ninterface Transaction {\n  id: string;\n  created_at: string;\n  updated_at: string;\n  name: string;\n  notes: string | null;\n  user_id: string;\n  bucket_id: string | null;\n  account_id: string;\n  category_id: number;\n  amount: string;\n  pending: boolean;\n  posted_date: string;\n  authorized_date: string;\n  data: {\n    name: string;\n    raw_name: string;\n  };\n  pending_transaction_id: string | null;\n  removed_at: string | null;\n  insufficient_funds: string | null;\n  rounded: string;\n  context_id: string;\n  hidden_at: string | null;\n  logo_url: string | null;\n  amount_adjustment: string;\n  bucket: Bucket | null;\n  category: Category | null;\n  account: Account | null;\n  original_name: string;\n  bucket_spending?: {\n    free_to_spend: string;\n    bucket_activity: string;\n    bucket_name: string;\n  };\n  metadata: {\n    raw_name: string;\n    nice_name: string;\n    merchant_name: string;\n  };\n}\n```\n\n### Bucket (Expense/Goal/Vault)\n\n```typescript\ninterface Bucket {\n  id: string;\n  created_at: string;\n  updated_at: string;\n  user_id: string;\n  name: string;\n  notes: string;\n  target_amount: string;\n  current_amount: string;\n  schedule: string;\n  schedule_desc: string;\n  schedule_date: string;\n  schedule_next_date: string;\n  recurrence_id: string;\n  funding_schedule_id: string;\n  kind: \"expense\" | \"goal\" | \"vault\";\n  contribution: string;\n  name_clean: string;\n  merchants?: string[];\n  paused: boolean;\n  schedule_timezone: string;\n  context_id: string;\n  removed_at: string | null;\n  color: string;\n  bucket_group_id: string;\n  migrated_at: string;\n  partial_spend: boolean;\n  categories: Category[];\n  funding_schedule: FundingSchedule;\n  transactions: Transaction[] | null;\n  recurrence: Recurrence;\n  bucket_group: BucketGroup;\n  next_contribution: string;\n  off_track: boolean;\n}\n```\n\n### Account\n\n```typescript\ninterface Account {\n  id: string;\n  created_at: string;\n  updated_at: string;\n  user_id: string;\n  item_id: string;\n  name: string;\n  official_name: string;\n  available_balance: string;\n  current_balance: string;\n  type: string;\n  mask: string;\n  active: boolean;\n  original_name: string;\n  original_type: string;\n  limit_balance: string;\n  removed_at: string | null;\n  context_id: string;\n  deleted_at: string | null;\n  item: AccountItem;\n  context: AccountContext | null;\n  last_sync: string;\n  spendable: boolean;\n  is_owner: boolean;\n  enabled_for_sub: boolean;\n}\n```\n\n## Constants\n\n### `FREE_TO_SPEND`\n\nA constant representing the Free to Spend bucket. Use this when assigning transactions to Free to Spend:\n\n```typescript\nimport { FREE_TO_SPEND } from \"das-budget-sdk\";\n\n// Assign a transaction to Free to Spend\nawait client.assignTransactionToBucket(\"transaction_id\", FREE_TO_SPEND);\n```\n\n## Error Handling\n\nAll methods may throw errors in case of API failures or invalid parameters. Make sure to handle these appropriately in your code.\n\n## Debugging\n\nEnable debug logging by setting `debug: true` in the configuration. This will log detailed information about API calls and responses to help with debugging.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}