mirror of
https://github.com/actualbudget/actual.git
synced 2026-05-10 15:32:56 -05:00
[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:
committed by
GitHub
parent
3c77b3d0d5
commit
7d4e28041c
1
packages/api/models.ts
Normal file
1
packages/api/models.ts
Normal file
@@ -0,0 +1 @@
|
||||
export type * from '@actual-app/core/server/api-models';
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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: [
|
||||
|
||||
6
upcoming-release-notes/7581.md
Normal file
6
upcoming-release-notes/7581.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Enhancements
|
||||
authors: [MatissJanis]
|
||||
---
|
||||
|
||||
API: export model types via "@actual-app/api/models".
|
||||
Reference in New Issue
Block a user