@mft/moneyhub-api-client 6.98.0 → 6.100.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +222 -3
- package/dist/get-auth-urls.js +5 -5
- package/dist/get-auth-urls.js.map +1 -1
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/requests/caas/categories.d.ts.map +1 -1
- package/dist/requests/caas/categories.js +29 -0
- package/dist/requests/caas/categories.js.map +1 -1
- package/dist/requests/caas/types/categories.d.ts +15 -0
- package/dist/requests/caas/types/categories.d.ts.map +1 -1
- package/dist/requests/caas/types/regular-transactions.d.ts +5 -6
- package/dist/requests/caas/types/regular-transactions.d.ts.map +1 -1
- package/dist/requests/caas/types/response-meta.d.ts +8 -0
- package/dist/requests/caas/types/response-meta.d.ts.map +1 -0
- package/dist/requests/caas/types/response-meta.js +3 -0
- package/dist/requests/caas/types/response-meta.js.map +1 -0
- package/dist/requests/caas/types/transactions.d.ts +2 -4
- package/dist/requests/caas/types/transactions.d.ts.map +1 -1
- package/dist/requests/index.d.ts +22 -0
- package/dist/requests/index.d.ts.map +1 -1
- package/dist/requests/index.js +2 -0
- package/dist/requests/index.js.map +1 -1
- package/dist/requests/standard-financial-statements.d.ts +5 -0
- package/dist/requests/standard-financial-statements.d.ts.map +1 -0
- package/dist/requests/standard-financial-statements.js +23 -0
- package/dist/requests/standard-financial-statements.js.map +1 -0
- package/dist/requests/types/standard-financial-statements.d.ts +19 -0
- package/dist/requests/types/standard-financial-statements.d.ts.map +1 -0
- package/dist/requests/types/standard-financial-statements.js +3 -0
- package/dist/requests/types/standard-financial-statements.js.map +1 -0
- package/dist/requests/types/unauthenticated.d.ts +4 -0
- package/dist/requests/types/unauthenticated.d.ts.map +1 -1
- package/dist/requests/unauthenticated.d.ts.map +1 -1
- package/dist/requests/unauthenticated.js +1 -0
- package/dist/requests/unauthenticated.js.map +1 -1
- package/dist/schema/standard-financial-statement.d.ts +21 -0
- package/dist/schema/standard-financial-statement.d.ts.map +1 -0
- package/dist/schema/standard-financial-statement.js +3 -0
- package/dist/schema/standard-financial-statement.js.map +1 -0
- package/package.json +5 -4
- package/readme.md +173 -33
- package/scripts/assert-github-actions-publish.js +11 -1
- package/scripts/check-secrets.js +66 -0
- package/.idea/codeStyles/Project.xml +0 -21
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/dbnavigator.xml +0 -450
- package/.idea/git_toolbox_blame.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/jsLinters/eslint.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/moneyhub-api-client.iml +0 -12
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -338
package/readme.md
CHANGED
|
@@ -26,6 +26,9 @@ This is an Node.JS client for the [Moneyhub API](https://docs.moneyhubenterprise
|
|
|
26
26
|
- Get a tax return for a subset of transactions
|
|
27
27
|
- Get the regular transactions on an account
|
|
28
28
|
- Get beneficiaries
|
|
29
|
+
- Create reseller check requests and get consent history
|
|
30
|
+
- Standard financial statements
|
|
31
|
+
- Legacy bank connections listing
|
|
29
32
|
- CAAS (Categorisation as a Service) API for advanced transaction enrichment and categorisation
|
|
30
33
|
|
|
31
34
|
Currently this library supports `client_secret_basic`, `client_secret_jwt` and `private_key_jwt` authentication.
|
|
@@ -64,7 +67,7 @@ const {Moneyhub} = require("@mft/moneyhub-api-client")
|
|
|
64
67
|
|
|
65
68
|
## Publishing (maintainers)
|
|
66
69
|
|
|
67
|
-
Official releases are published to npm by **GitHub Actions** when a [GitHub Release](https://github.com/moneyhub/moneyhub-api-client/releases) is published (see `.github/workflows/publish.yml`). Do not rely on publishing from a developer machine.
|
|
70
|
+
Official releases are published to npm by **GitHub Actions** when a [GitHub Release](https://github.com/moneyhub/moneyhub-api-client/releases) is published (see `.github/workflows/publish.yml`). The publish workflow runs lint and build on GitHub-hosted runners. Live integration tests are not part of publish; they run in the private synced repository (allowlisted IPs / secrets). Do not rely on publishing from a developer machine.
|
|
68
71
|
|
|
69
72
|
The `prepublishOnly` lifecycle script runs **`scripts/assert-github-actions-publish.js`** before the build. It exits with an error unless `GITHUB_ACTIONS` is set (as it is in GitHub Actions), so a normal local `npm publish` is blocked. That reduces accidental publishes; it is **not** a security boundary on its own—npm access control and trusted publishing still matter.
|
|
70
73
|
|
|
@@ -74,9 +77,10 @@ To bypass the check in a **documented emergency** only, you can run `npm publish
|
|
|
74
77
|
|
|
75
78
|
To use this API client you will need:
|
|
76
79
|
|
|
80
|
+
- Node.js >= 18.0.0
|
|
77
81
|
- A `client_id`, `client_secret` and `redirect_uri` of a registered API client
|
|
78
82
|
- The url of the Moneyhub identity service for the environment you are connecting to (https://identity.moneyhub.co.uk)
|
|
79
|
-
- The url for the API gateway for the environment that you are connecting to (https://api.moneyhub.co.uk/
|
|
83
|
+
- The url for the API gateway for the environment that you are connecting to (https://api.moneyhub.co.uk/v3)
|
|
80
84
|
|
|
81
85
|
## To install
|
|
82
86
|
|
|
@@ -257,6 +261,8 @@ The `expirationDateTime` and `transactionFromDateTime` options can be set accord
|
|
|
257
261
|
|
|
258
262
|
Set `enableAsync` to true if you wish to make an AIS connection that won't wait for accounts and transactions to be fetched.
|
|
259
263
|
|
|
264
|
+
Set `accVerification` to true to add the `mh:account_verification` claim. This is independent of `enableAsync`.
|
|
265
|
+
|
|
260
266
|
**Note:** all methods generate an authorise URL using the Pushed Authorisation Request (PAR) method, see [here](https://docs.moneyhubenterprise.com/docs/pushed-authorisation-requests-par) for more details.
|
|
261
267
|
|
|
262
268
|
#### `getAuthorizeUrl`
|
|
@@ -280,6 +286,7 @@ const url = await moneyhub.getAuthorizeUrl({
|
|
|
280
286
|
expirationDateTime: "2022-09-01T00:00:00.000Z", // optional
|
|
281
287
|
transactionFromDateTime: "2020-09-01T00:00:00.000Z", // optional,
|
|
282
288
|
enableAsync: false, // optional
|
|
289
|
+
accVerification: false, // optional - adds mh:account_verification independently of enableAsync
|
|
283
290
|
});
|
|
284
291
|
|
|
285
292
|
// Default claims if none are provided
|
|
@@ -399,24 +406,6 @@ const defaultClaims = {
|
|
|
399
406
|
|
|
400
407
|
#### `getRefreshAuthorizeUrlForCreatedUser`
|
|
401
408
|
|
|
402
|
-
#### `getAuthorizeUrlLegacy`
|
|
403
|
-
|
|
404
|
-
This method returns an authorize url for your API client using the legacy method (where a request object is generated and passed in as the `request` query parameter). You can redirect a user to this url, after which they will be redirected back to your `redirect_uri`. It has the same method signature as `getAuthorizeUrl`
|
|
405
|
-
|
|
406
|
-
```javascript
|
|
407
|
-
const url = await moneyhub.getAuthorizeUrlLegacy({
|
|
408
|
-
scope: "openid bank-id-scope other-data-scopes",
|
|
409
|
-
state: " your state value", // optional
|
|
410
|
-
nonce: "your nonce value", //optional
|
|
411
|
-
claims: claimsObject, // optional
|
|
412
|
-
permissions: ["ReadBeneficiariesDetail"], // optional - set of extra permissions to set for auth URL
|
|
413
|
-
permissionsAction: "replace" // optional - replace default consent permissions. Defaults to "add"
|
|
414
|
-
expirationDateTime: "2022-09-01T00:00:00.000Z", // optional
|
|
415
|
-
transactionFromDateTime: "2020-09-01T00:00:00.000Z", // optional,
|
|
416
|
-
enableAsync: false, // optional
|
|
417
|
-
});
|
|
418
|
-
```
|
|
419
|
-
|
|
420
409
|
This is a helper function that returns an authorize url for a specific user to refresh an existing connection. This function uses the scope `openid refresh`. (Only relevant for legacy connections)
|
|
421
410
|
|
|
422
411
|
```javascript
|
|
@@ -444,6 +433,24 @@ const defaultClaims = {
|
|
|
444
433
|
};
|
|
445
434
|
```
|
|
446
435
|
|
|
436
|
+
#### `getAuthorizeUrlLegacy`
|
|
437
|
+
|
|
438
|
+
This method returns an authorize url for your API client using the legacy method (where a request object is generated and passed in as the `request` query parameter). You can redirect a user to this url, after which they will be redirected back to your `redirect_uri`. It has the same method signature as `getAuthorizeUrl`
|
|
439
|
+
|
|
440
|
+
```javascript
|
|
441
|
+
const url = await moneyhub.getAuthorizeUrlLegacy({
|
|
442
|
+
scope: "openid bank-id-scope other-data-scopes",
|
|
443
|
+
state: " your state value", // optional
|
|
444
|
+
nonce: "your nonce value", //optional
|
|
445
|
+
claims: claimsObject, // optional
|
|
446
|
+
permissions: ["ReadBeneficiariesDetail"], // optional - set of extra permissions to set for auth URL
|
|
447
|
+
permissionsAction: "replace" // optional - replace default consent permissions. Defaults to "add"
|
|
448
|
+
expirationDateTime: "2022-09-01T00:00:00.000Z", // optional
|
|
449
|
+
transactionFromDateTime: "2020-09-01T00:00:00.000Z", // optional,
|
|
450
|
+
enableAsync: false, // optional
|
|
451
|
+
});
|
|
452
|
+
```
|
|
453
|
+
|
|
447
454
|
#### `exchangeCodeForTokensLegacy`
|
|
448
455
|
|
|
449
456
|
This is a legacy method to get tokens for a user.
|
|
@@ -850,7 +857,7 @@ Similar to getAccounts method, however this method does not return `transactionD
|
|
|
850
857
|
|
|
851
858
|
```javascript
|
|
852
859
|
const queryParams = { limit: 10, offset: 5 , showTransacionData: false, showPerformanceScore: true};
|
|
853
|
-
const accounts = await moneyhub.
|
|
860
|
+
const accounts = await moneyhub.getAccountsList({
|
|
854
861
|
userId: "userId",
|
|
855
862
|
params: queryParams,
|
|
856
863
|
}, options);
|
|
@@ -862,7 +869,7 @@ Similar to getAccountsWithDetails method, however this method does not return `t
|
|
|
862
869
|
|
|
863
870
|
```javascript
|
|
864
871
|
const queryParams = { limit: 10, offset: 5 };
|
|
865
|
-
const accounts = await moneyhub.
|
|
872
|
+
const accounts = await moneyhub.getAccountsListWithDetails({
|
|
866
873
|
userId: "userId",
|
|
867
874
|
params: queryParams,
|
|
868
875
|
}, options);
|
|
@@ -1004,6 +1011,28 @@ const statements = await moneyhub.getAccountStatementsWithDetail({
|
|
|
1004
1011
|
}, options);
|
|
1005
1012
|
```
|
|
1006
1013
|
|
|
1014
|
+
#### `getStandardFinancialStatements`
|
|
1015
|
+
|
|
1016
|
+
List standard financial statement reports for a user (Money Advice Service schema metadata). Uses the scope `standard_financial_statement:read`.
|
|
1017
|
+
|
|
1018
|
+
```javascript
|
|
1019
|
+
const statements = await moneyhub.getStandardFinancialStatements({
|
|
1020
|
+
userId: "userId",
|
|
1021
|
+
params: {limit: 10, offset: 0},
|
|
1022
|
+
}, options);
|
|
1023
|
+
```
|
|
1024
|
+
|
|
1025
|
+
#### `getStandardFinancialStatement`
|
|
1026
|
+
|
|
1027
|
+
Get a single standard financial statement report by id. Uses the scope `standard_financial_statement:read`.
|
|
1028
|
+
|
|
1029
|
+
```javascript
|
|
1030
|
+
const statement = await moneyhub.getStandardFinancialStatement({
|
|
1031
|
+
userId: "userId",
|
|
1032
|
+
reportId: "reportId",
|
|
1033
|
+
}, options);
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1007
1036
|
#### `createAccount`
|
|
1008
1037
|
|
|
1009
1038
|
Create a manual account for a user. This function uses the scopes `accounts:read accounts:write:all`
|
|
@@ -1353,11 +1382,9 @@ const accounts = await moneyhub.getOsipAccounts({
|
|
|
1353
1382
|
Get an account for a user. This function uses the scope `osip:read`.
|
|
1354
1383
|
|
|
1355
1384
|
```javascript
|
|
1356
|
-
const
|
|
1357
|
-
const accounts = await moneyhub.getOsipAccounts({
|
|
1385
|
+
const account = await moneyhub.getOsipAccount({
|
|
1358
1386
|
userId: "userId",
|
|
1359
1387
|
accountId: "accountId",
|
|
1360
|
-
params: queryParams,
|
|
1361
1388
|
});
|
|
1362
1389
|
```
|
|
1363
1390
|
|
|
@@ -1367,7 +1394,7 @@ Get account holdings for an account. This function uses the scope `osip:read`.
|
|
|
1367
1394
|
|
|
1368
1395
|
```javascript
|
|
1369
1396
|
const queryParams = { limit: 10, offset: 5 };
|
|
1370
|
-
const
|
|
1397
|
+
const holdings = await moneyhub.getOsipAccountHoldings({
|
|
1371
1398
|
userId: "userId",
|
|
1372
1399
|
accountId: "accountId",
|
|
1373
1400
|
params: queryParams,
|
|
@@ -1380,7 +1407,7 @@ Get account transactions. This function uses the scope `osip:read`.
|
|
|
1380
1407
|
|
|
1381
1408
|
```javascript
|
|
1382
1409
|
const queryParams = { limit: 10, offset: 5 };
|
|
1383
|
-
const
|
|
1410
|
+
const transactions = await moneyhub.getOsipAccountTransactions({
|
|
1384
1411
|
userId: "userId",
|
|
1385
1412
|
accountId: "accountId",
|
|
1386
1413
|
params: queryParams,
|
|
@@ -1728,6 +1755,18 @@ const payees = await moneyhub.getPayees({
|
|
|
1728
1755
|
});
|
|
1729
1756
|
```
|
|
1730
1757
|
|
|
1758
|
+
#### `getPayee`
|
|
1759
|
+
|
|
1760
|
+
Get a single registered payee by id. This function uses the scope `payee:read`.
|
|
1761
|
+
|
|
1762
|
+
```javascript
|
|
1763
|
+
const payee = await moneyhub.getPayee({
|
|
1764
|
+
id: "payee-id",
|
|
1765
|
+
});
|
|
1766
|
+
```
|
|
1767
|
+
|
|
1768
|
+
Example script: `node examples/payments/get-payee.js -i payee-id`.
|
|
1769
|
+
|
|
1731
1770
|
#### `getPayments`
|
|
1732
1771
|
|
|
1733
1772
|
This method returns a list of initiated payments. This function uses the scope `payment:read`
|
|
@@ -1995,7 +2034,7 @@ const recurringPayment = await moneyhub.getRecurringPayment({
|
|
|
1995
2034
|
This method creates a payment using the recurring payment consent. This function uses the scope `recurring_payment:create`
|
|
1996
2035
|
|
|
1997
2036
|
```javascript
|
|
1998
|
-
const
|
|
2037
|
+
const recurringPayment = await moneyhub.makeRecurringPayment({
|
|
1999
2038
|
recurringPaymentId: "Id of the recurring payment consent",
|
|
2000
2039
|
payment: {
|
|
2001
2040
|
payeeId: "payee-id", // optional
|
|
@@ -2016,6 +2055,22 @@ const revokedRecurringPayment = await moneyhub.revokeRecurringPayment({
|
|
|
2016
2055
|
});
|
|
2017
2056
|
```
|
|
2018
2057
|
|
|
2058
|
+
#### `confirmFundsForRecurringPayment`
|
|
2059
|
+
|
|
2060
|
+
Confirm that funds are available for a payment under an existing recurring payment consent. This function uses the scope `recurring_payment:funds_confirmation`.
|
|
2061
|
+
|
|
2062
|
+
```javascript
|
|
2063
|
+
const fundsConfirmation = await moneyhub.confirmFundsForRecurringPayment({
|
|
2064
|
+
recurringPaymentId: "Id of the recurring payment consent",
|
|
2065
|
+
fundsConfirmation: {
|
|
2066
|
+
amount: "10.00",
|
|
2067
|
+
currency: "GBP",
|
|
2068
|
+
},
|
|
2069
|
+
});
|
|
2070
|
+
```
|
|
2071
|
+
|
|
2072
|
+
Example script: `node examples/recurring-payments/confirm-funds.js -i recurring-payment-id -a 10.00`.
|
|
2073
|
+
|
|
2019
2074
|
#### `getRegularTransactions`
|
|
2020
2075
|
|
|
2021
2076
|
Get all the regular transactions for a user, there is an option to pass an account ID as a parameter as a filter. This function uses the scope `accounts:read`, `transactions:read:all` and `regular_transactions:read`
|
|
@@ -2221,6 +2276,20 @@ const resellerCheck = await moneyhub.createResellerCheckRequest({
|
|
|
2221
2276
|
}, options);
|
|
2222
2277
|
```
|
|
2223
2278
|
|
|
2279
|
+
#### `getConsentHistory`
|
|
2280
|
+
|
|
2281
|
+
Get consent history for the API client, optionally filtered by user. This function uses the scope `consent_history:read`.
|
|
2282
|
+
|
|
2283
|
+
```javascript
|
|
2284
|
+
const consentHistory = await moneyhub.getConsentHistory({
|
|
2285
|
+
limit: 10, // optional
|
|
2286
|
+
offset: 0, // optional
|
|
2287
|
+
userId: "user-id", // optional
|
|
2288
|
+
});
|
|
2289
|
+
```
|
|
2290
|
+
|
|
2291
|
+
Example script: `node examples/consent-history/get-history.js -u user-id`.
|
|
2292
|
+
|
|
2224
2293
|
### CAAS API
|
|
2225
2294
|
|
|
2226
2295
|
The CAAS (Categorisation as a Service) API provides advanced transaction enrichment, categorisation, and management capabilities. All CAAS endpoints use dedicated scopes prefixed with `caas:`.
|
|
@@ -2252,9 +2321,11 @@ const result = await moneyhub.caasEnrichTransactions({
|
|
|
2252
2321
|
}, options);
|
|
2253
2322
|
```
|
|
2254
2323
|
|
|
2324
|
+
Example script: `node examples/caas/transactions/enrich-transactions.js` (uses a built-in example transaction).
|
|
2325
|
+
|
|
2255
2326
|
#### `caasGetTransactions`
|
|
2256
2327
|
|
|
2257
|
-
Get transactions from the CAAS API with optional filtering by user and limit. This function uses the
|
|
2328
|
+
Get transactions from the CAAS API with optional filtering by user and limit. This function uses the scopes `caas:transactions:read caas:transaction_splits:read`. The `splits` array is included for any split transaction when the client is registered for the `caas:transaction_splits:read` scope.
|
|
2258
2329
|
|
|
2259
2330
|
```javascript
|
|
2260
2331
|
const result = await moneyhub.caasGetTransactions({
|
|
@@ -2264,6 +2335,8 @@ const result = await moneyhub.caasGetTransactions({
|
|
|
2264
2335
|
}, options);
|
|
2265
2336
|
```
|
|
2266
2337
|
|
|
2338
|
+
Example script: `node examples/caas/transactions/get-transactions.js -a accountId -u userId -l 50`.
|
|
2339
|
+
|
|
2267
2340
|
#### `caasGetEnhancedTransaction`
|
|
2268
2341
|
|
|
2269
2342
|
Retrieves Google Places–backed enhanced location and merchant data for a single CAAS transaction. Uses scope `caas:enhanced_transactions:read`. This is a premium endpoint and incurs a cost per request. Responses must not be cached or persisted when the data is sourced from Google (see API documentation).
|
|
@@ -2280,18 +2353,23 @@ const result = await moneyhub.caasGetEnhancedTransaction({
|
|
|
2280
2353
|
|
|
2281
2354
|
The response follows the usual API envelope: the enhanced transaction is `result.data` (optional `links` / `meta` may also be present).
|
|
2282
2355
|
|
|
2356
|
+
Example script: `node examples/caas/transactions/get-enhanced-transaction.js -a accountId -t transactionId -i search_pro`.
|
|
2357
|
+
|
|
2283
2358
|
#### `caasPatchTransaction`
|
|
2284
2359
|
|
|
2285
|
-
Update a transaction category via the CAAS endpoint. This function uses the scope `caas:transactions:write` and returns the updated transaction data under `data`.
|
|
2360
|
+
Update a transaction's user-defined category via the CAAS endpoint. This function uses the scope `caas:transactions:write` and returns the updated transaction data under `data`. The optional `recategorisationType` query parameter (`single` or `future`, defaulting to `single`) controls whether the change applies to this transaction only or to all future matching transactions.
|
|
2286
2361
|
|
|
2287
2362
|
```javascript
|
|
2288
2363
|
const result = await moneyhub.caasPatchTransaction({
|
|
2289
2364
|
accountId: "accountId",
|
|
2290
2365
|
transactionId: "transactionId",
|
|
2291
|
-
|
|
2366
|
+
userCategoryId: "21",
|
|
2367
|
+
recategorisationType: "single",
|
|
2292
2368
|
}, options);
|
|
2293
2369
|
```
|
|
2294
2370
|
|
|
2371
|
+
Example script: `node examples/caas/transactions/patch-transaction.js -a accountId -t transactionId -c 21 -r single`.
|
|
2372
|
+
|
|
2295
2373
|
#### `caasDeleteTransaction`
|
|
2296
2374
|
|
|
2297
2375
|
Delete a transaction via the CAAS endpoint. This function uses the scope `caas:transactions:delete`.
|
|
@@ -2303,6 +2381,8 @@ await moneyhub.caasDeleteTransaction({
|
|
|
2303
2381
|
}, options);
|
|
2304
2382
|
```
|
|
2305
2383
|
|
|
2384
|
+
Example script: `node examples/caas/transactions/delete-transaction.js -a accountId -t transactionId`.
|
|
2385
|
+
|
|
2306
2386
|
#### `caasPutTransactionSplits`
|
|
2307
2387
|
|
|
2308
2388
|
Create or replace all splits for a transaction. Requires between 2 and 10 splits; split amounts must sum to the parent transaction `amount`. Uses scope `caas:transaction_splits:write`. Returns the upserted splits under `data`.
|
|
@@ -2318,7 +2398,7 @@ const result = await moneyhub.caasPutTransactionSplits({
|
|
|
2318
2398
|
}, options);
|
|
2319
2399
|
```
|
|
2320
2400
|
|
|
2321
|
-
Example script: `npm run ts-node -- examples/caas/put-transaction-splits.js -a accTestQA123 -t testQA123 -d '[{"amount":4,"userCategoryId":"2d6078a1-06db-4c9c-b559-f36cec9e4fc1","description":"Food"},{"amount":6,"userCategoryId":"22","description":"Gift"}]'` (split amounts must sum to the parent transaction amount).
|
|
2401
|
+
Example script: `npm run ts-node -- examples/caas/transactions/put-transaction-splits.js -a accTestQA123 -t testQA123 -d '[{"amount":4,"userCategoryId":"2d6078a1-06db-4c9c-b559-f36cec9e4fc1","description":"Food"},{"amount":6,"userCategoryId":"22","description":"Gift"}]'` (split amounts must sum to the parent transaction amount).
|
|
2322
2402
|
|
|
2323
2403
|
#### `caasDeleteTransactionSplits`
|
|
2324
2404
|
|
|
@@ -2331,7 +2411,7 @@ const status = await moneyhub.caasDeleteTransactionSplits({
|
|
|
2331
2411
|
}, options);
|
|
2332
2412
|
```
|
|
2333
2413
|
|
|
2334
|
-
Example script: `node examples/caas/delete-transaction-splits.js -a accountId -t transactionId`.
|
|
2414
|
+
Example script: `node examples/caas/transactions/delete-transaction-splits.js -a accountId -t transactionId`.
|
|
2335
2415
|
|
|
2336
2416
|
#### `caasGetCategories`
|
|
2337
2417
|
|
|
@@ -2341,6 +2421,8 @@ Get all available CAAS categories. This function uses the scope `caas:categories
|
|
|
2341
2421
|
const result = await moneyhub.caasGetCategories(options);
|
|
2342
2422
|
```
|
|
2343
2423
|
|
|
2424
|
+
Example script: `node examples/caas/categories/get-categories.js`.
|
|
2425
|
+
|
|
2344
2426
|
#### `caasGetCategoryGroups`
|
|
2345
2427
|
|
|
2346
2428
|
Get all available CAAS category groups. This function uses the scope `caas:categories:read`.
|
|
@@ -2349,6 +2431,46 @@ Get all available CAAS category groups. This function uses the scope `caas:categ
|
|
|
2349
2431
|
const result = await moneyhub.caasGetCategoryGroups(options);
|
|
2350
2432
|
```
|
|
2351
2433
|
|
|
2434
|
+
Example script: `node examples/caas/categories/get-category-groups.js`.
|
|
2435
|
+
|
|
2436
|
+
#### `caasGetCustomCategories`
|
|
2437
|
+
|
|
2438
|
+
Get all custom categories created by a user. This function uses the scope `caas:categories:read` and returns the custom categories under `data`.
|
|
2439
|
+
|
|
2440
|
+
```javascript
|
|
2441
|
+
const result = await moneyhub.caasGetCustomCategories({
|
|
2442
|
+
userId: "userId",
|
|
2443
|
+
}, options);
|
|
2444
|
+
```
|
|
2445
|
+
|
|
2446
|
+
Example script: `node examples/caas/custom-categories/get-custom-categories.js -u userId`.
|
|
2447
|
+
|
|
2448
|
+
#### `caasCreateCustomCategory`
|
|
2449
|
+
|
|
2450
|
+
Create a custom category for a user. This function uses the scope `caas:categories:write` and returns the created custom category under `data`. The returned `customCategoryId` can be used as the `userCategoryId` when updating a transaction via `caasPatchTransaction`. Returns a 409 if a custom category with the same name already exists for the user.
|
|
2451
|
+
|
|
2452
|
+
```javascript
|
|
2453
|
+
const result = await moneyhub.caasCreateCustomCategory({
|
|
2454
|
+
userId: "userId",
|
|
2455
|
+
customCategoryName: "Coffee",
|
|
2456
|
+
}, options);
|
|
2457
|
+
```
|
|
2458
|
+
|
|
2459
|
+
Example script: `node examples/caas/custom-categories/create-custom-category.js -u userId -n "Coffee"`.
|
|
2460
|
+
|
|
2461
|
+
#### `caasDeleteCustomCategory`
|
|
2462
|
+
|
|
2463
|
+
Delete a custom category for a user. This function uses the scope `caas:categories:delete`. `categoryId` must be a valid UUID. Resolves with the HTTP status code (`204` on success).
|
|
2464
|
+
|
|
2465
|
+
```javascript
|
|
2466
|
+
await moneyhub.caasDeleteCustomCategory({
|
|
2467
|
+
userId: "userId",
|
|
2468
|
+
categoryId: "categoryId",
|
|
2469
|
+
}, options);
|
|
2470
|
+
```
|
|
2471
|
+
|
|
2472
|
+
Example script: `node examples/caas/custom-categories/delete-custom-category.js -u userId -c categoryId`.
|
|
2473
|
+
|
|
2352
2474
|
#### `caasGetCounterparties`
|
|
2353
2475
|
|
|
2354
2476
|
Get counterparties with optional pagination. This function uses the scope `caas:transactions:read`.
|
|
@@ -2360,6 +2482,8 @@ const result = await moneyhub.caasGetCounterparties({
|
|
|
2360
2482
|
}, options);
|
|
2361
2483
|
```
|
|
2362
2484
|
|
|
2485
|
+
Example script: `node examples/caas/counterparties/get-counterparties.js -l 50 -o 0`.
|
|
2486
|
+
|
|
2363
2487
|
#### `caasGetGeotags`
|
|
2364
2488
|
|
|
2365
2489
|
Get geotag information for specific geotag IDs. This function uses the scope `caas:transactions:read`.
|
|
@@ -2370,6 +2494,8 @@ const result = await moneyhub.caasGetGeotags({
|
|
|
2370
2494
|
}, options);
|
|
2371
2495
|
```
|
|
2372
2496
|
|
|
2497
|
+
Example script: `node examples/caas/geotags/get-geotags.js -g geotag-id-1 -g geotag-id-2`.
|
|
2498
|
+
|
|
2373
2499
|
#### `caasGetRegularTransactions`
|
|
2374
2500
|
|
|
2375
2501
|
Get regular transaction series for an account from the CaaS API. This function uses the scope `caas:regular_transactions:read`.
|
|
@@ -2380,6 +2506,8 @@ const result = await moneyhub.caasGetRegularTransactions({
|
|
|
2380
2506
|
}, options);
|
|
2381
2507
|
```
|
|
2382
2508
|
|
|
2509
|
+
Example script: `node examples/caas/transactions/get-regular-transactions.js -a accountId`.
|
|
2510
|
+
|
|
2383
2511
|
#### `caasDeleteAccount`
|
|
2384
2512
|
|
|
2385
2513
|
Delete an account via the CAAS endpoint. This function uses the scope `caas:users:delete`.
|
|
@@ -2390,6 +2518,8 @@ await moneyhub.caasDeleteAccount({
|
|
|
2390
2518
|
}, options);
|
|
2391
2519
|
```
|
|
2392
2520
|
|
|
2521
|
+
Example script: `node examples/caas/accounts/delete-account.js -a accountId`.
|
|
2522
|
+
|
|
2393
2523
|
#### `caasDeleteUser`
|
|
2394
2524
|
|
|
2395
2525
|
Delete a user via the CAAS endpoint. This function uses the scope `caas:users:delete`.
|
|
@@ -2400,6 +2530,8 @@ await moneyhub.caasDeleteUser({
|
|
|
2400
2530
|
}, options);
|
|
2401
2531
|
```
|
|
2402
2532
|
|
|
2533
|
+
Example script: `node examples/caas/users/delete-user.js -u userId`.
|
|
2534
|
+
|
|
2403
2535
|
### Financial Connections
|
|
2404
2536
|
|
|
2405
2537
|
#### `listConnections`
|
|
@@ -2418,6 +2550,14 @@ This method will resolve with a list of all the API connections that a user can
|
|
|
2418
2550
|
const availableConnections = await moneyhub.listAPIConnections();
|
|
2419
2551
|
```
|
|
2420
2552
|
|
|
2553
|
+
#### `listLegacyConnections`
|
|
2554
|
+
|
|
2555
|
+
This method will resolve with a list of legacy connections from Identity (`.well-known/legacy-connections`).
|
|
2556
|
+
|
|
2557
|
+
```javascript
|
|
2558
|
+
const availableConnections = await moneyhub.listLegacyConnections();
|
|
2559
|
+
```
|
|
2560
|
+
|
|
2421
2561
|
#### `listTestConnections`
|
|
2422
2562
|
|
|
2423
2563
|
This method will resolve with a list of all the Test connections that a user can connect to.
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// prepublishOnly guard; emergency bypass: npm publish --ignore-scripts
|
|
3
|
+
const allowedRepo = "moneyhub/moneyhub-api-client";
|
|
4
|
+
|
|
3
5
|
if (process.env.GITHUB_ACTIONS !== "true") {
|
|
4
6
|
console.error(
|
|
5
7
|
"Publishing this package is restricted to GitHub Actions. " +
|
|
6
|
-
"Create a GitHub Release to trigger the publish workflow. " +
|
|
8
|
+
"Create a GitHub Release on moneyhub/moneyhub-api-client to trigger the publish workflow. " +
|
|
7
9
|
"For a documented emergency bypass, use npm publish --ignore-scripts."
|
|
8
10
|
);
|
|
9
11
|
process.exit(1);
|
|
10
12
|
}
|
|
13
|
+
|
|
14
|
+
if (process.env.GITHUB_REPOSITORY !== allowedRepo) {
|
|
15
|
+
console.error(
|
|
16
|
+
`Publishing this package is restricted to ${allowedRepo}. ` +
|
|
17
|
+
`Current repository: ${process.env.GITHUB_REPOSITORY || "(unset)"}.`
|
|
18
|
+
);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const {execFileSync} = require("child_process")
|
|
3
|
+
|
|
4
|
+
const git = args => execFileSync("git", args, {encoding: "utf8"})
|
|
5
|
+
|
|
6
|
+
const blockedPaths = [
|
|
7
|
+
"examples/config.js",
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
const secretPatterns = [
|
|
11
|
+
{
|
|
12
|
+
name: "PEM private key",
|
|
13
|
+
regex: /-----BEGIN (?:RSA |EC |OPENSSH |DSA )?PRIVATE KEY-----/,
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "JWK private component (\"d\")",
|
|
17
|
+
regex: /"d"\s*:\s*"[A-Za-z0-9_-]{20,}"/,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "Real client_secret value",
|
|
21
|
+
regex: /client_secret"?\s*[:=]\s*"(?!your client secret")[^"]{8,}"/,
|
|
22
|
+
},
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
const getStagedFiles = () => {
|
|
26
|
+
const output = git(["diff", "--cached", "--name-only", "--diff-filter=ACM", "--no-renames"])
|
|
27
|
+
return output.split("\n").map(line => line.trim()).filter(Boolean)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const getStagedContent = file => git(["show", `:${file}`])
|
|
31
|
+
|
|
32
|
+
const scanFile = file => {
|
|
33
|
+
const findings = []
|
|
34
|
+
if (blockedPaths.includes(file)) {
|
|
35
|
+
findings.push(`${file}: file is blocked from being committed (use examples/config.example.js as a template and keep secrets in the git-ignored examples/config.js)`)
|
|
36
|
+
return findings
|
|
37
|
+
}
|
|
38
|
+
let content
|
|
39
|
+
try {
|
|
40
|
+
content = getStagedContent(file)
|
|
41
|
+
} catch (err) {
|
|
42
|
+
findings.push(`${file}: unable to read staged content, cannot verify it is secret-free (${err.message})`)
|
|
43
|
+
return findings
|
|
44
|
+
}
|
|
45
|
+
secretPatterns.forEach(({name, regex}) => {
|
|
46
|
+
if (regex.test(content)) {
|
|
47
|
+
findings.push(`${file}: matched "${name}"`)
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
return findings
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const main = () => {
|
|
54
|
+
const files = getStagedFiles()
|
|
55
|
+
const findings = files.flatMap(scanFile)
|
|
56
|
+
if (findings.length === 0) {
|
|
57
|
+
process.exit(0)
|
|
58
|
+
}
|
|
59
|
+
console.error("\nCommit blocked: potential secrets detected in staged changes\n")
|
|
60
|
+
findings.forEach(finding => console.error(` - ${finding}`))
|
|
61
|
+
console.error("\nRemove the secrets, unstage the file, and commit again.")
|
|
62
|
+
console.error("If this is a false positive, review the staged content before bypassing.\n")
|
|
63
|
+
process.exit(1)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
main()
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
-
<code_scheme name="Project" version="173">
|
|
3
|
-
<JSCodeStyleSettings version="0">
|
|
4
|
-
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
|
|
5
|
-
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
6
|
-
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
7
|
-
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
8
|
-
</JSCodeStyleSettings>
|
|
9
|
-
<codeStyleSettings language="JavaScript">
|
|
10
|
-
<option name="BLOCK_COMMENT_ADD_SPACE" value="true" />
|
|
11
|
-
<option name="KEEP_BLANK_LINES_IN_CODE" value="3" />
|
|
12
|
-
<option name="INDENT_CASE_FROM_SWITCH" value="false" />
|
|
13
|
-
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
|
14
|
-
<option name="ALIGN_MULTILINE_FOR" value="false" />
|
|
15
|
-
<indentOptions>
|
|
16
|
-
<option name="INDENT_SIZE" value="2" />
|
|
17
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
18
|
-
</indentOptions>
|
|
19
|
-
</codeStyleSettings>
|
|
20
|
-
</code_scheme>
|
|
21
|
-
</component>
|