mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-28 10:33:02 -05:00
Refactor typecheck script in api package and enhance api-helpers with new schedule and rule update functions. The typecheck command was simplified by removing the strict check, and new API methods for creating schedules and updating rules were added to improve functionality.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
"build": "yarn run clean && yarn run build:node && yarn run build:migrations && yarn run build:default-db",
|
||||
"test": "yarn run clean && yarn run build:crdt && vitest --run",
|
||||
"clean": "rm -rf dist @types",
|
||||
"typecheck": "yarn build && tsc --noEmit && tsc-strict"
|
||||
"typecheck": "yarn build && tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actual-app/crdt": "workspace:^",
|
||||
|
||||
@@ -3,13 +3,15 @@
|
||||
// This provides the same interface as @actual-app/api/methods but uses handlers directly
|
||||
// to avoid cyclic dependency between loot-core and @actual-app/api
|
||||
|
||||
import { type Handlers } from '../../types/handlers';
|
||||
import type { ImportTransactionEntity } from '../../types/models';
|
||||
import type { QueryState } from '../../shared/query';
|
||||
import type { Handlers } from '../../types/handlers';
|
||||
import type { ImportTransactionEntity, RuleEntity } from '../../types/models';
|
||||
import type {
|
||||
APIAccountEntity,
|
||||
APICategoryEntity,
|
||||
APICategoryGroupEntity,
|
||||
APIPayeeEntity,
|
||||
APIScheduleEntity,
|
||||
} from '../api-models';
|
||||
import { app } from '../main-app';
|
||||
import { runHandler } from '../mutators';
|
||||
@@ -98,3 +100,23 @@ export async function setBudgetCarryover(
|
||||
) {
|
||||
return send('api/budget-set-carryover', { month, categoryId, flag });
|
||||
}
|
||||
|
||||
export async function createSchedule(
|
||||
schedule: Omit<APIScheduleEntity, 'id'>,
|
||||
): Promise<string> {
|
||||
return send('api/schedule-create', schedule);
|
||||
}
|
||||
|
||||
export function aqlQuery(
|
||||
query: QueryState | { serialize(): QueryState },
|
||||
): Promise<unknown> {
|
||||
const queryState =
|
||||
typeof (query as { serialize?: () => QueryState }).serialize === 'function'
|
||||
? (query as { serialize(): QueryState }).serialize()
|
||||
: (query as QueryState);
|
||||
return send('api/query', { query: queryState });
|
||||
}
|
||||
|
||||
export async function updateRule(rule: RuleEntity): Promise<RuleEntity> {
|
||||
return send('api/rule-update', { rule });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user