[AI] Export API models as separate entry point (#7581)

* [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>
This commit is contained in:
Matiss Janis Aboltins
2026-04-22 11:45:54 +01:00
committed by GitHub
parent 3c77b3d0d5
commit 7d4e28041c
4 changed files with 21 additions and 2 deletions

1
packages/api/models.ts Normal file
View File

@@ -0,0 +1 @@
export type * from '@actual-app/core/server/api-models';

View File

@@ -19,6 +19,11 @@
"types": "./@types/index.d.ts",
"development": "./index.ts",
"default": "./dist/index.js"
},
"./models": {
"types": "./@types/models.d.ts",
"development": "./models.ts",
"default": "./dist/models.js"
}
},
"publishConfig": {
@@ -26,6 +31,10 @@
".": {
"types": "./@types/index.d.ts",
"default": "./dist/index.js"
},
"./models": {
"types": "./@types/models.d.ts",
"default": "./dist/models.js"
}
}
},

View File

@@ -66,9 +66,12 @@ export default defineConfig({
emptyOutDir: true,
sourcemap: true,
lib: {
entry: path.resolve(__dirname, 'index.ts'),
entry: {
index: path.resolve(__dirname, 'index.ts'),
models: path.resolve(__dirname, 'models.ts'),
},
formats: ['cjs'],
fileName: () => 'index.js',
fileName: (_format, entryName) => `${entryName}.js`,
},
},
plugins: [

View File

@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [MatissJanis]
---
API: export model types via "@actual-app/api/models".