42 Commits

Author SHA1 Message Date
7ea55567da
⬆️ Update actual api to 25.3, cron to 4
All checks were successful
Deploy application / deploy (push) Successful in 18s
2025-03-02 08:37:38 +01:00
080b65854d
🐛 Do not upload transactions that are not booked
All checks were successful
Deploy application / deploy (push) Successful in 8s
2025-02-16 18:22:10 +01:00
a0cefcdfa1
️ Return early if no transactions were fetched 2025-02-16 18:07:48 +01:00
a2c6c55430
🐛 Fix relative dates are wrong
All checks were successful
Deploy application / deploy (push) Successful in 9s
2025-02-15 12:53:50 +01:00
0e83172558
🔪🐛 Fix docker volume in wrong directory
All checks were successful
Deploy application / deploy (push) Successful in 3s
2025-02-14 17:08:10 +01:00
95ddcbaf13
🔪🐛 Fix shutdown being called before init, fix duplicate SIGNIT catch
All checks were successful
Deploy application / deploy (push) Successful in 16s
2025-02-13 21:15:02 +01:00
4367c24fb0
🌟 Refactor
- Moved mappings into Sb1 impl
- Moved Actual types to @common
- Moved createDirIfMissing to respective functions
- Refactored main into multiple functions
- Moved create db into Sb1impl and close
- Log requests on info
2025-02-13 21:07:30 +01:00
06cc89f762
💾 Volume for cache, default values for envs in compose
All checks were successful
Deploy application / deploy (push) Successful in 3s
2025-02-09 13:54:35 +01:00
b6daf4268c
🚀 Init and shutdown Actual on job
- Renamed daily function to moveTransactions
- testConnections method to verify connection immediately
2025-02-09 13:34:00 +01:00
db30129c30
☝ Update dependencies
All checks were successful
Deploy application / deploy (push) Successful in 9s
2025-02-09 13:12:02 +01:00
3c6cb193eb
🔪🐛 Fixed pnpm in Dockerfile, moved config to src
All checks were successful
Deploy application / deploy (push) Successful in 10s
2025-02-09 13:02:02 +01:00
c5b1ec20d6
🧹 Moved Sb1 API to separate workspace and created common workspace
- Created common workspace
- Create Sparebank1Api workspace
- Moved logger to common
- Moved SB1 types to types.ts
- Logger will avoid duplicating first line when capturing console.logs
- Updated imports and added type keyword
- Added nonUniqueId type
2025-02-09 12:35:08 +01:00
efa9e785f2
🧹 Pino transports API and capture console.log
All checks were successful
Deploy application / deploy (push) Successful in 26s
2025-02-06 19:37:11 +01:00
71e70a2713
🧹 Delete token from db if expired 2025-02-06 19:13:23 +01:00
4f05382fc4
🚀 Daily is now Bank agnostic
- Separated createDir into a new file fs.ts
- Moved mapTransactions into Bank interface
- Take interval as input into importTransactions
2025-02-06 18:56:51 +01:00
066331cca8
🔪🐛 Fix corepack bug, removed unused envs, npm in docker
All checks were successful
Deploy application / deploy (push) Successful in 28s
- Replaced pnpm to npm in docker container because of a bug infestation
- Remove only allow pnpm
- Added missing envs to docker compose
2025-02-05 20:27:08 +01:00
75ad4946d2
🎉 Allow syncing multiple accounts at once
All checks were successful
Deploy application / deploy (push) Successful in 3s
- By defining multiple account keys in the .env, will fetch from all and upload to correct account
- If transaction id is 0, will not be marked as cleared
- Added accountKey to Transaction interface
2025-02-02 12:37:43 +01:00
14257fa058
❄ Nix shell using flake 2025-02-02 12:34:09 +01:00
9b0391be7c
Graceful shutdown on exceptions 2025-02-02 11:22:29 +01:00
41cb92cce5
Removed transaction logger
All checks were successful
Deploy application / deploy (push) Successful in 3s
2025-01-31 17:06:36 +01:00
18a0fbfac8
Relative from and to date in config, changed default to 3 days
All checks were successful
Deploy application / deploy (push) Successful in 7s
2025-01-31 16:58:02 +01:00
752bdbceb4
Cleared status from API, docker script
All checks were successful
Deploy application / deploy (push) Successful in 6s
2025-01-27 21:30:56 +01:00
61f0153319
Fix typo...
All checks were successful
Deploy application / deploy (push) Successful in 6s
2025-01-26 19:38:08 +01:00
d618438b14
Fix DB_DIRECTORY env is empty in Docker compose
Some checks failed
Deploy application / deploy (push) Failing after 6s
2025-01-26 19:36:17 +01:00
9850017e3a
🐋 Docker volume for Sqlite
Some checks failed
Deploy application / deploy (push) Failing after 7s
- Moved database to subdir specified by env
- Default data dir /data
- Move loggers to cronJob onTick
- Added volume for data dir in Docker compose
- Create any missing dir specified by env
2025-01-26 19:29:43 +01:00
aaa85e99cb
🐋 Docker and Gitea Workflow
All checks were successful
Deploy application / deploy (push) Successful in 19s
- Moved tsx to dependencies as node TS support is 💩
- Renamed start-once to run-once
- TODOs
2025-01-26 17:41:44 +01:00
2e73baf98b
✏ README, fix start-once bug and refactor
- Added some configuration and running to README
- Refactored some code
- Fixed exception when stopping a start-once script
- Only allow running with pnpm
- Moved transactions into sparebank1Api.ts
- Formatted
2025-01-25 22:30:52 +01:00
4977e7ad6a
🔨 Run once, graceful shutdown, db filename in env
- Refactored toISODateString function
- Added Db filename to env
- Added getOrDefault function for fetching envs, replaced LOG_LEVEL with getOrDefault
- Added script to run job once then exit
- Catch SIGINT signal and do a graceful shutdown
2025-01-25 21:12:49 +01:00
b61903f5c8
🎉 Working prototype
- Added missing field payee_name to TransactionEntity type
- Date function to convert DayJs to DateString
- Temp disabled cronjob for testing
- Fixed mapping to ActualModel
- fetchToken db function returns DayJs object for date
- Fixed fetching tokens from db
- Logging
- Fixed fetch previous day transactions
- Fixed token refresh
- Fixed stub based on model changes
2025-01-25 18:01:47 +01:00
9a00592a7a
GitIgnore database 2025-01-23 21:06:42 +01:00
4a773e4b43
🔑 Store tokens in Sqllite, moved queries, other fixes
- Create cache dir if missing
- Moved Sqlite queries to queries.ts
- Updated dependencies
- Added pino-pretty to dev-dependencies
- Changed Sqlite to store tokens as separate rows
- Removed in-memory storage of tokens
- isValidToken function
- Throw Exception if refresh token is present but invalid
- Fixed fetch query in smn http file
2025-01-22 21:00:04 +01:00
Martin Berg Alstad
3bf354b4bf
SQLite
Moved DB queries to separate file
Moved Sparebank1 API call to separate file
Create database tokens table if it doesn't exist

Signed-off-by: Martin Berg Alstad <git@martials.no>
2024-12-26 14:08:09 +01:00
Martin Berg Alstad
8854a22b40
Added better-sqlite3 dep and created default db
Signed-off-by: Martin Berg Alstad <git@martials.no>
2024-12-26 12:49:54 +01:00
Martin Berg Alstad
6650e2cd2b
Removed
- accessToken and refreshToken methods from interface
- accessToken param from transactionsPastDay
- Unused env variables from config.ts

Added
- Initial Refresh token to env
- Dayjs library for working with dates

Implemented
- getAccessToken
- getRefreshToken
- fetchNewRefreshToken
- transactionsPastDay

Signed-off-by: Martin Berg Alstad <git@martials.no>
2024-12-25 21:06:42 +01:00
480c0356f9
Fixes
- Added Actual account ids and log level to .env.example.
- Fixed timestamp error by downloading the budget after init.
- Hardcoded date in test.
- Separate logging file for configurations.
- Organized test
- More logging in main
- Fixed wrong paths for some files
- Load a .env.test.local file when running tests

Signed-off-by: Martin Berg Alstad <git@martials.no>
2024-12-23 16:47:07 +01:00
Martin Berg Alstad
29b394baf4
Moved sparebank1.ts to bank dir
Signed-off-by: Martin Berg Alstad <git@martials.no>
2024-12-22 16:06:20 +01:00
Martin Berg Alstad
966c5f50b3
Fix broken lockfile
Fix @ module path
2024-12-22 13:14:55 +01:00
c43bff3e15 testing with jest 2024-12-16 21:25:36 +00:00
9ed0a19393
Changed:
- Env key to be more generic
- Cache directory to .cache
- Multiply bank amount by 100 to get correct conversion rate

Removed:
- Unused functions in Actual.ts

Added:
- Test for main functionality
- BankStub for testing
- Added imported_id to Actual Transaction to avoid duplicates
2024-12-01 20:48:42 +01:00
cc325b9f08
Added:
- Logging library
- Account Ids to .env
- Split logic in main function
2024-12-01 19:35:45 +01:00
01af64349e
Added:
- CronJob
- interface and simple impl for Actual
- interface and simple impl for Sparebank1
- Mappings between sparebank1 transactions and actual transactions
- Requires type keyword on type imports
2024-11-17 22:27:29 +01:00
90bcf94f14
Initial commit 2024-11-15 23:16:58 +01:00