Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@actual-app/api

Package Overview
Dependencies
Maintainers
4
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@actual-app/api - npm Package Compare versions

Comparing version 6.7.1 to 6.8.0

@types/app/bundle.api.d.ts

26

dist/methods.js

@@ -26,3 +26,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.deletePayee = exports.updatePayee = exports.createPayee = exports.getPayees = exports.deleteCategory = exports.updateCategory = exports.createCategory = exports.getCategories = exports.deleteCategoryGroup = exports.updateCategoryGroup = exports.createCategoryGroup = exports.getCategoryGroups = exports.deleteAccount = exports.reopenAccount = exports.closeAccount = exports.updateAccount = exports.createAccount = exports.getAccounts = exports.deleteTransaction = exports.updateTransaction = exports.getTransactions = exports.importTransactions = exports.addTransactions = exports.setBudgetCarryover = exports.setBudgetAmount = exports.getBudgetMonth = exports.getBudgetMonths = exports.runQuery = exports.batchBudgetUpdates = exports.sync = exports.downloadBudget = exports.loadBudget = exports.runImport = exports.q = void 0;
exports.deleteRule = exports.updateRule = exports.createRule = exports.getPayeeRules = exports.getRules = exports.deletePayee = exports.updatePayee = exports.createPayee = exports.getPayees = exports.deleteCategory = exports.updateCategory = exports.createCategory = exports.getCategories = exports.deleteCategoryGroup = exports.updateCategoryGroup = exports.createCategoryGroup = exports.getCategoryGroups = exports.deleteAccount = exports.reopenAccount = exports.closeAccount = exports.updateAccount = exports.createAccount = exports.getAccounts = exports.deleteTransaction = exports.updateTransaction = exports.getTransactions = exports.importTransactions = exports.addTransactions = exports.setBudgetCarryover = exports.setBudgetAmount = exports.getBudgetMonth = exports.getBudgetMonths = exports.runQuery = exports.batchBudgetUpdates = exports.runBankSync = exports.sync = exports.downloadBudget = exports.loadBudget = exports.runImport = exports.q = void 0;
const injected = __importStar(require("./injected"));

@@ -58,2 +58,6 @@ var query_1 = require("./app/query");

exports.sync = sync;
async function runBankSync(args) {
return send('api/bank-sync', args);
}
exports.runBankSync = runBankSync;
async function batchBudgetUpdates(func) {

@@ -190,1 +194,21 @@ await send('api/batch-budget-start');

exports.deletePayee = deletePayee;
function getRules() {
return send('api/rules-get');
}
exports.getRules = getRules;
function getPayeeRules(id) {
return send('api/payee-rules-get', { id });
}
exports.getPayeeRules = getPayeeRules;
function createRule(rule) {
return send('api/rule-create', { rule });
}
exports.createRule = createRule;
function updateRule(rule) {
return send('api/rule-update', { rule });
}
exports.updateRule = updateRule;
function deleteRule(id) {
return send('api/rule-delete', { id });
}
exports.deleteRule = deleteRule;

@@ -293,2 +293,193 @@ "use strict";

});
// apis: getRules, getPayeeRules, createRule, updateRule, deleteRule
test('Rules: successfully update rules', async () => {
await api.createPayee({ name: 'test-payee' });
await api.createPayee({ name: 'test-payee2' });
// create our test rules
const rule = await api.createRule({
stage: 'pre',
conditionsOp: 'and',
conditions: [
{
field: 'payee',
op: 'is',
value: 'test-payee',
},
],
actions: [
{
op: 'set',
field: 'category',
value: 'fc3825fd-b982-4b72-b768-5b30844cf832',
},
],
});
const rule2 = await api.createRule({
stage: 'pre',
conditionsOp: 'and',
conditions: [
{
field: 'payee',
op: 'is',
value: 'test-payee2',
},
],
actions: [
{
op: 'set',
field: 'category',
value: 'fc3825fd-b982-4b72-b768-5b30844cf832',
},
],
});
// get existing rules
const rules = await api.getRules();
expect(rules).toEqual(expect.arrayContaining([
expect.objectContaining({
actions: expect.arrayContaining([
expect.objectContaining({
field: 'category',
op: 'set',
type: 'id',
value: 'fc3825fd-b982-4b72-b768-5b30844cf832',
}),
]),
conditions: expect.arrayContaining([
expect.objectContaining({
field: 'payee',
op: 'is',
type: 'id',
value: 'test-payee2',
}),
]),
conditionsOp: 'and',
id: rule2.id,
stage: 'pre',
}),
expect.objectContaining({
actions: expect.arrayContaining([
expect.objectContaining({
field: 'category',
op: 'set',
type: 'id',
value: 'fc3825fd-b982-4b72-b768-5b30844cf832',
}),
]),
conditions: expect.arrayContaining([
expect.objectContaining({
field: 'payee',
op: 'is',
type: 'id',
value: 'test-payee',
}),
]),
conditionsOp: 'and',
id: rule.id,
stage: 'pre',
}),
]));
// get by payee
expect(await api.getPayeeRules('test-payee')).toEqual(expect.arrayContaining([
expect.objectContaining({
actions: expect.arrayContaining([
expect.objectContaining({
field: 'category',
op: 'set',
type: 'id',
value: 'fc3825fd-b982-4b72-b768-5b30844cf832',
}),
]),
conditions: expect.arrayContaining([
expect.objectContaining({
field: 'payee',
op: 'is',
type: 'id',
value: 'test-payee',
}),
]),
conditionsOp: 'and',
id: rule.id,
stage: 'pre',
}),
]));
expect(await api.getPayeeRules('test-payee2')).toEqual(expect.arrayContaining([
expect.objectContaining({
actions: expect.arrayContaining([
expect.objectContaining({
field: 'category',
op: 'set',
type: 'id',
value: 'fc3825fd-b982-4b72-b768-5b30844cf832',
}),
]),
conditions: expect.arrayContaining([
expect.objectContaining({
field: 'payee',
op: 'is',
type: 'id',
value: 'test-payee2',
}),
]),
conditionsOp: 'and',
id: rule2.id,
stage: 'pre',
}),
]));
// update one rule
const updatedRule = {
...rule,
stage: 'post',
conditionsOp: 'or',
};
expect(await api.updateRule(updatedRule)).toEqual(updatedRule);
expect(await api.getRules()).toEqual(expect.arrayContaining([
expect.objectContaining({
actions: expect.arrayContaining([
expect.objectContaining({
field: 'category',
op: 'set',
type: 'id',
value: 'fc3825fd-b982-4b72-b768-5b30844cf832',
}),
]),
conditions: expect.arrayContaining([
expect.objectContaining({
field: 'payee',
op: 'is',
type: 'id',
value: 'test-payee',
}),
]),
conditionsOp: 'or',
id: rule.id,
stage: 'post',
}),
expect.objectContaining({
actions: expect.arrayContaining([
expect.objectContaining({
field: 'category',
op: 'set',
type: 'id',
value: 'fc3825fd-b982-4b72-b768-5b30844cf832',
}),
]),
conditions: expect.arrayContaining([
expect.objectContaining({
field: 'payee',
op: 'is',
type: 'id',
value: 'test-payee2',
}),
]),
conditionsOp: 'and',
id: rule2.id,
stage: 'pre',
}),
]));
// delete rules
await api.deleteRule(rules[1]);
expect(await api.getRules()).toHaveLength(1);
await api.deleteRule(rules[0]);
expect(await api.getRules()).toHaveLength(0);
});
// apis: addTransactions, getTransactions, importTransactions, updateTransaction, deleteTransaction

@@ -298,4 +489,4 @@ test('Transactions: successfully update transactions', async () => {

let newTransaction = [
{ date: '2023-11-03', imported_id: '11', amount: 100 },
{ date: '2023-11-03', imported_id: '11', amount: 100 },
{ date: '2023-11-03', imported_id: '11', amount: 100, notes: 'notes' },
{ date: '2023-11-03', imported_id: '12', amount: 100, notes: '' },
];

@@ -312,4 +503,5 @@ const addResult = await api.addTransactions(accountId, newTransaction, {

newTransaction = [
{ date: '2023-12-03', imported_id: '11', amount: 100 },
{ date: '2023-12-03', imported_id: '22', amount: 200 },
{ date: '2023-12-03', imported_id: '11', amount: 100, notes: 'notes' },
{ date: '2023-12-03', imported_id: '12', amount: 100, notes: 'notes' },
{ date: '2023-12-03', imported_id: '22', amount: 200, notes: '' },
];

@@ -322,3 +514,11 @@ const reconciled = await api.importTransactions(accountId, newTransaction);

transactions = await api.getTransactions(accountId, '2023-12-01', '2023-12-31');
expect(transactions).toEqual(expect.arrayContaining(newTransaction.map(trans => expect.objectContaining(trans))));
expect(transactions).toEqual(expect.arrayContaining([
expect.objectContaining({ imported_id: '22', amount: 200 }),
]));
expect(transactions).toHaveLength(1);
// confirm imported transactions update perfomed
transactions = await api.getTransactions(accountId, '2023-11-01', '2023-11-30');
expect(transactions).toEqual(expect.arrayContaining([
expect.objectContaining({ notes: 'notes', amount: 100 }),
]));
expect(transactions).toHaveLength(2);

@@ -325,0 +525,0 @@ const idToUpdate = reconciled.added[0];

12

dist/package.json
{
"name": "@actual-app/api",
"version": "6.7.1",
"version": "6.8.0",
"license": "MIT",

@@ -12,3 +12,4 @@ "description": "An API for Actual",

"files": [
"dist"
"dist",
"@types"
],

@@ -25,3 +26,4 @@ "scripts": {

"dependencies": {
"better-sqlite3": "^9.3.0",
"@actual-app/crdt": "workspace:^",
"better-sqlite3": "^9.6.0",
"compare-versions": "^6.1.0",

@@ -32,4 +34,4 @@ "node-fetch": "^3.3.2",

"devDependencies": {
"@swc/core": "^1.3.105",
"@swc/jest": "^0.2.31",
"@swc/core": "^1.5.3",
"@swc/jest": "^0.2.36",
"@types/jest": "^27.5.2",

@@ -36,0 +38,0 @@ "@types/uuid": "^9.0.2",

{
"name": "@actual-app/api",
"version": "6.7.1",
"version": "6.8.0",
"license": "MIT",

@@ -12,3 +12,4 @@ "description": "An API for Actual",

"files": [
"dist"
"dist",
"@types"
],

@@ -25,3 +26,4 @@ "scripts": {

"dependencies": {
"better-sqlite3": "^9.3.0",
"@actual-app/crdt": "workspace:^",
"better-sqlite3": "^9.6.0",
"compare-versions": "^6.1.0",

@@ -32,4 +34,4 @@ "node-fetch": "^3.3.2",

"devDependencies": {
"@swc/core": "^1.3.105",
"@swc/jest": "^0.2.31",
"@swc/core": "^1.5.3",
"@swc/jest": "^0.2.36",
"@types/jest": "^27.5.2",

@@ -36,0 +38,0 @@ "@types/uuid": "^9.0.2",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc