* [AI] Add api.importBudget() and api.exportBudget()
Add first-class import/export functions to @actual-app/api so consumers
no longer have to drive the low-level worker RPC and the engine
filesystem by hand.
- api.importBudget(pathOrBytes, { type?, filename? }) imports an Actual
.zip export (or a YNAB4/YNAB5 export), loads it, and resolves with the
imported budget id. Raw bytes are passed straight to the import-budget
handler instead of the upload-file-web temp-file dance, so it works in
both the Node and browser builds and leaves no temp files behind.
- api.exportBudget() exports the currently-loaded budget and resolves
with the zip contents as a Uint8Array.
- Both reject with an Error on failure instead of resolving { error }.
- The import-budget handler now optionally accepts raw file contents
(buffer + filename) alongside the existing filepath input, and returns
the id of the loaded budget on success; existing callers are
unaffected.
- Add round-trip, file-path, and failure integration tests; update the
API reference docs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wq2oMcHb99mLb9qpaR8SN
* [AI] Move ImportableBudgetType re-export to models.ts
Type re-exports for API consumers live in models.ts (like Preferences),
not methods.ts — follow the existing pattern.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wq2oMcHb99mLb9qpaR8SN
* [AI] Address review: relax error assertions, document type union
- Assert importBudget failures on the stable "Error importing budget:"
prefix instead of backend-specific error codes
- Document options.type as the 'actual' | 'ynab4' | 'ynab5' union in the
API reference instead of a generic string
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014wq2oMcHb99mLb9qpaR8SN
---------
Co-authored-by: Claude <noreply@anthropic.com>
* [AI] Add api.getPreferences() for reading synced preferences
Expose the internal 'preferences/get' handler as a public API method so
consumers can read the budget's synced preferences (number format,
currency, date format, etc.) without calling internal handlers directly.
Re-export the SyncedPrefs type from @actual-app/api/models and document
the new method in the API reference.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KxwSQJiPo5mEk79mA54TWg
* Update models.ts
---------
Co-authored-by: Claude <noreply@anthropic.com>
* [AI] Expose API entity types via @actual-app/api/models
Adds a new `./models` subpath export on `@actual-app/api` that re-exports
the public API entity types (`APIAccountEntity`, `APICategoryEntity`,
`APICategoryGroupEntity`, `APIFileEntity`, `APIPayeeEntity`,
`APIScheduleEntity`, `APITagEntity`, `AmountOPType`) from
`@actual-app/core/server/api-models`. Consumers can now import these types
from a stable public entry point instead of reaching into core internals:
import type {
APICategoryEntity,
APICategoryGroupEntity,
} from '@actual-app/api/models';
Uses `export type *` so the compiled `dist/models.js` is empty and no
runtime code is added. The Vite lib config is expanded to a multi-entry
map (`index`, `models`) so both bundles are produced, and tsgo already
emits `@types/models.d.ts` via the existing `declarationDir` setup.
* Add release notes for PR #7581
* Modify release notes for API model exports
Updated category from 'Features' to 'Enhancements' and added API export details.
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>