-
Notifications
You must be signed in to change notification settings - Fork 8
Update dependencies and up test coverage #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
johndyer2-mh
wants to merge
7
commits into
main
Choose a base branch
from
update-dependencies
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
67145dd
Update dependencies and improve husky scripts
johndyer2-mh b78ab19
chore(deps): upgrade jose to v6 and set Node 18 engine
johndyer2-mh fa15862
chore(deps): upgrade TypeScript to v5
johndyer2-mh e24b02c
chore(deps): upgrade ESLint to v9
johndyer2-mh ea30a2b
chore: add endpoint coverage documentation and update test scripts
johndyer2-mh 8ffc4fb
chore: update Node.js version requirements and enhance test scripts
johndyer2-mh 873ece2
chore: release version 7.0.0 with breaking changes and new features
johndyer2-mh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,22 @@ | ||
| # Dependencies | ||
| node_modules/ | ||
|
|
||
| # Local and config (secrets, environment overrides) | ||
| examples/config-local.js | ||
| examples/config.local.js | ||
| config/local.json | ||
| config/default.json | ||
| config/prod.json | ||
| config/dev.json | ||
|
|
||
| # Build output and caches | ||
| dist/ | ||
| .dccache | ||
| coverage | ||
|
|
||
| # IDE and editor | ||
| .idea/ | ||
| .DS_Store | ||
| .vscode/settings.json | ||
|
|
||
| # OS | ||
| .DS_Store |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| #!/bin/sh | ||
| . "$(dirname "$0")/_/husky.sh" | ||
|
|
||
| #!/usr/bin/env sh | ||
| npm run lint | ||
| npm run build | ||
| npm run build | ||
| npm run test:unit | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,38 @@ | ||
| #!/bin/sh | ||
| . "$(dirname "$0")/_/husky.sh" | ||
| #!/usr/bin/env sh | ||
| # Node versions to run tests on (aligned with engines ">= 20.20.0" and common LTS) | ||
| NODE_VERSIONS="20 22 24" | ||
|
|
||
| npm run lint | ||
| npm run build | ||
| npm test | ||
|
|
||
| # Load nvm when available so we can run tests on multiple Node versions in parallel | ||
| export NVM_DIR="${NVM_DIR:-$HOME/.nvm}" | ||
| if [ -s "$NVM_DIR/nvm.sh" ]; then | ||
| . "$NVM_DIR/nvm.sh" | ||
| TMPD=$(mktemp -d) | ||
| trap 'rm -rf "$TMPD"' EXIT | ||
| PIDS="" | ||
| for ver in $NODE_VERSIONS; do | ||
| nvm exec "$ver" npm test > "$TMPD/$ver" 2>&1 & | ||
| PIDS="$PIDS $!" | ||
| done | ||
| FAIL=0 | ||
| set -- $PIDS | ||
| for ver in $NODE_VERSIONS; do | ||
| r=0; wait "$1" || r=$? | ||
| if [ $r -ne 0 ]; then | ||
| FAIL=1 | ||
| echo "Node $ver failed:" | ||
| cat "$TMPD/$ver" 2>/dev/null || true | ||
| fi | ||
| shift | ||
| done | ||
| if [ $FAIL -eq 0 ]; then | ||
| echo "Tests passed on Node $NODE_VERSIONS" | ||
| fi | ||
| [ $FAIL -eq 1 ] && exit 1 | ||
| exit 0 | ||
| else | ||
| echo "nvm not found; running tests with current Node only" | ||
| npm test | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,32 @@ | ||
| # IDE and tooling | ||
| .cursor | ||
| .github | ||
| .husky | ||
| .vscode | ||
|
|
||
| # Dev and config directories | ||
| config | ||
| examples | ||
| resources | ||
|
|
||
| # Source and tests (publish dist/ only; exclude compiled tests) | ||
| src | ||
| test | ||
| __tests__ | ||
| .eslintrc.json | ||
| tsconfig.json | ||
| dist/__tests__ | ||
|
|
||
| # Build and lint config | ||
| eslint.config.js | ||
| tsconfig.json | ||
|
|
||
| # Build artefacts and caches | ||
| coverage | ||
| .dccache | ||
| *.tsbuildinfo | ||
|
|
||
| # Internal documentation | ||
| ENDPOINT_COVERAGE.md | ||
|
|
||
| # Local environment | ||
| .env | ||
| .env.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| v20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| # Endpoint coverage: Swagger / API definition vs client | ||
|
|
||
| This document maps API definitions (Swagger and router definitions) to the moneyhub-api-client methods. | ||
|
|
||
| ## 1. Request routing | ||
|
|
||
| | Config | Backend | Definition source | | ||
| |--------|---------|-------------------| | ||
| | `resourceServerUrl` | API Gateway (Data API) | api-gateway `swagger.json` (v2), `swagger-v3.json` (v3) | | ||
| | `identityServiceUrl` | Identity | identity `swagger.json` | | ||
| | `caasResourceServerUrl` | CaaS (Enrichment) | api-gateway `docs-enrichment-engine/swagger-enrichment-engine.json` | | ||
| | `osipResourceServerUrl` | OSIP | api-gateway `create-router.js` + `handlers/osip.js` (no Swagger) | | ||
|
|
||
| ## 2. API Gateway (Data API) – client mapping | ||
|
|
||
| **Swagger:** api-gateway `docs/swagger.json` (basePath `/v2.0`), `docs/swagger-v3.json` (basePath `/v3`). | ||
|
|
||
| | Path / area | Client method(s) | Module | Notes | | ||
| |-------------|------------------|--------|--------| | ||
| | GET /accounts | getAccounts, getAccountsWithDetails | accounts | | | ||
| | GET /accounts-list | getAccountsList, getAccountsListWithDetails | accounts | **v2 only** – not in v3 Swagger | | ||
| | GET/POST/PATCH/DELETE /accounts, /accounts/{id}, /balances | getAccount, getAccountWithDetails, getAccountBalances, createAccount, updateAccount, deleteAccount, addAccountBalance | accounts | | | ||
| | Holdings, counterparties, recurring-transactions, standing-orders, statements | getAccountHoldings, getAccountHoldingsWithMatches, getAccountHolding, getAccountCounterparties, getAccountRecurringTransactions, getAccountStandingOrders, getAccountStandingOrdersWithDetail, getAccountStatements, getAccountStatementsWithDetail | accounts | **v2 only:** /accounts-list, /accounts/{id}/counterparties, /accounts/{id}/recurring-transactions (no v3 path) | | ||
| | Affordability | (affordability module) | affordability | | | ||
| | Beneficiaries | getBeneficiary, getBeneficiaryWithDetail, getBeneficiaries, getBeneficiariesWithDetail | beneficiaries | | | ||
| | GET /global-counterparties | getGlobalCounterparties | unauthenticated | | | ||
| | Transactions, files, splits | getTransactions, getTransaction, getUnenrichedTransactions, getUnenrichedTransaction, addTransaction, addTransactions, getTransactionFiles, getTransactionFile, addFileToTransaction, deleteTransactionFile, getTransactionSplits, splitTransaction, patchTransactionSplit, deleteTransactionSplits | transactions, transaction-files, transaction-splits | | | ||
| | Categories, category-groups | getCategories, getCategory, getCategoryGroups, getStandardCategories, getStandardCategoryGroups, createCustomCategory, updateCategory, deleteCategory | categories | | | ||
| | Categorise, regular-transactions | categoriseTransactions, getRegularTransactions, addRegularTransaction, updateRegularTransaction, deleteRegularTransaction, detectRegularTransactions | categorise-transactions, regular-transactions | | | ||
| | Rental records | (rental-records module) | rental-records | | | ||
| | Spending analysis, spending/savings goals | getSpendingAnalysis, getSpendingGoals, getSpendingGoal, addSpendingGoal, updateSpendingGoal, deleteSpendingGoal, getSavingsGoals, getSavingsGoal, addSavingsGoal, updateSavingsGoal, deleteSavingsGoal | spending-analysis, spending-goals, savings-goals | | | ||
| | **GET /standard-financial-statements**, **GET /standard-financial-statements/{reportId}** | **getStandardFinancialStatements**, **getStandardFinancialStatement** | **standard-financial-statements** | **Added in this plan** | | ||
| | Sync, projects, tax | syncUserConnection, getProjects, getProject, addProject, updateProject, deleteProject, getTaxReturn | sync, projects, tax | | | ||
| | Notification thresholds | getNotificationThresholds, addNotificationThreshold, getNotificationThreshold, updateNotificationThreshold, deleteNotificationThreshold | notification-thresholds | | | ||
|
|
||
| ## 3. Identity – client mapping | ||
|
|
||
| **Swagger:** identity `docs/swagger.json`. | ||
|
|
||
| | Path / area | Client method(s) | Module | Notes | | ||
| |-------------|------------------|--------|--------| | ||
| | GET .well-known/all-connections | listConnections | unauthenticated | | | ||
| | GET .well-known/api-connections | listAPIConnections | unauthenticated | | | ||
| | GET .well-known/legacy-connections | listLegacyConnections | unauthenticated | **Added in this plan** | | ||
| | GET .well-known/test-connections | listTestConnections | unauthenticated | | | ||
| | GET .well-known/payments-connections | listPaymentsConnections | unauthenticated | | | ||
| | GET .well-known/beta-connections | listBetaConnections | unauthenticated | | | ||
| | GET .well-known/openid-configuration | getOpenIdConfig | unauthenticated | | | ||
| | Auth-requests, OIDC | createAuthRequest, getAuthRequest, getAllAuthRequests, completeAuthRequest, getAuthUrls, token helpers | auth-requests, get-auth-urls, tokens | | | ||
| | Users, connections, syncs, SCIM | getUser, getUsers, registerUser, deleteUser, getUserConnections, deleteUserConnection, updateUserConnection, getConnectionSyncs, getUserSyncs, getSync, getSCIMUser, registerSCIMUser, searchSCIMUsers | users-and-connections | | | ||
| | Payees, pay-links, payments | addPayee, getPayees, getPayee, getPayment, getPayments, getPaymentFromIDToken, addPayLink, getPayLink, getPayLinks | payees, pay-links, payments | | | ||
| | Standing orders, recurring payments | getStandingOrder, getStandingOrders, getRecurringPayments, getRecurringPayment, makeRecurringPayment, revokeRecurringPayment, confirmFundsForRecurringPayment | standing-orders, recurring-payments | | | ||
| | Reseller-check, consent-history | createResellerCheckRequest, getConsentHistory | reseller-check, consent-history | | | ||
| | **Pay-file** | — | — | **Client missing** | | ||
| | **Pay-file-consent** | — | — | **Client missing** | | ||
| | **GET /bank-icons/{bankRef}** | — | — | **Client missing** | | ||
| | **GET /consents/{authRequestId}** | — | — | **Client missing** | | ||
|
|
||
| ## 4. CaaS (Enrichment API) – client mapping | ||
|
|
||
| **Swagger:** api-gateway `docs/docs-enrichment-engine/swagger-enrichment-engine.json` (basePath `/caas/v1`). | ||
|
|
||
| | Path / area | Client method(s) | Module | Notes | | ||
| |-------------|------------------|--------|--------| | ||
| | DELETE /users/{userId} | caasDeleteUser | caas/users | | | ||
| | DELETE /accounts/{accountId} | caasDeleteAccount | caas/accounts | | | ||
| | GET /categories, /category-groups | caasGetCategories, caasGetCategoryGroups | caas/categories | | | ||
| | GET /counterparties | caasGetCounterparties | caas/counterparties | | | ||
| | GET /geotags | caasGetGeotags | caas/geotags | | | ||
| | GET/PATCH/DELETE /accounts/{accountId}/transactions/{transactionId} | caasGetTransactions, caasPatchTransaction, caasDeleteTransaction | caas/transactions | | | ||
| | POST /transactions/enrich | caasEnrichTransactions | caas/transactions | | | ||
| | **Custom categories** (users/{userId}/custom-categories) | — | — | **Client missing** | | ||
| | **Account regular-transactions** | — | — | **Client missing** | | ||
| | **Transaction enhanced, splits** | — | — | **Client missing** | | ||
|
|
||
| ## 5. OSIP – client mapping | ||
|
|
||
| **Definition:** api-gateway `src/api/create-router.js` and `src/api/handlers/osip.js` (no Swagger). | ||
|
|
||
| | Method + path | Client method | Module | | ||
| |---------------|---------------|--------| | ||
| | GET /osip/v1.0/accounts | getOsipAccounts | osip | | ||
| | GET /osip/v1.0/accounts/:id | getOsipAccount | osip | | ||
| | GET /osip/v1.0/accounts/:id/holdings | getOsipAccountHoldings | osip | | ||
| | GET /osip/v1.0/accounts/:id/transactions | getOsipAccountTransactions | osip | | ||
|
|
||
| All require `osip:read` scope. Client fully covers these routes. | ||
|
|
||
| ## 6. Integration test files | ||
|
|
||
| | Area | Test file(s) | | ||
| |------|--------------| | ||
| | Data API (accounts, transactions, etc.) | accounts.ts, accounts-with-extra-options.ts, transactions.ts, categories.ts, tax.ts, beneficiaries.ts, spending-analysis.ts, sync.ts, projects.ts, notification-thresholds.ts, regular-transactions.ts, rental-records.ts, savings-goals.ts, spending-goals.ts, transaction-files.ts, transaction-splits.ts, categorise-transactions.ts | | ||
| | Identity | auth-requests.ts, auth-urls.ts, payees.ts, pay-links.ts, payments.ts, standing-orders.ts, recurring-payments.ts, consent-history.ts, reseller-check.ts, users (via index) | | ||
| | Unauthenticated / connections | (listConnections etc. exercised via index or auth-urls) | | ||
| | CaaS | (optional; depends on env) | | ||
| | OSIP | osip.ts | | ||
| | Standard financial statements | standard-financial-statements.ts | | ||
|
|
||
| **Running tests and coverage** | ||
|
|
||
| - **Unit only** (no API config): `npm run test:coverage` — runs `*.unit.ts`, enforces 90% coverage. | ||
| - **Full suite** (unit + integration, requires config): `npm run test:integration:coverage` — runs all tests with hooks, enforces 90% line/function/branch/statement coverage. | ||
| - Integration tests live in `src/__tests__/*.ts` (non-`.unit.ts`); hooks in `test/hooks.js` provide `this.config` (e.g. `testUserId`, `testAccountId`). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| "use strict"; | ||
| const {baseConfigWithFiles} = require("@mft/eslint-config-momentumft/typescript") | ||
| const {base, testsWithFiles} = require("@mft/eslint-config-momentumft") | ||
|
|
||
| module.exports = [ | ||
| ...base, | ||
| ...baseConfigWithFiles, | ||
| testsWithFiles, | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.