@mft/moneyhub-api-client 4.17.0 → 4.18.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mft/moneyhub-api-client",
3
- "version": "4.17.0",
3
+ "version": "4.18.0",
4
4
  "description": "Node.JS client for the Moneyhub API",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -96,6 +96,8 @@ The options below can be set on the following URL generating methods:
96
96
  - `getRefreshAuthorizeUrlForCreatedUser`
97
97
 
98
98
  The `expirationDateTime` and `transactionFromDateTime` options can be set according to the [AIS Consents documentation](https://docs.moneyhubenterprise.com/docs/ais-consents)
99
+
100
+ Set `enableAsync` to true if you wish to make an AIS connection that won't wait for accounts and transactions to be fetched.
99
101
  #### `getAuthorizeUrl`
100
102
 
101
103
  This method returns an authorize url for your API client. You can redirect a user to this url, after which they will be redirected back to your `redirect_uri`.
@@ -116,6 +118,7 @@ const url = await moneyhub.getAuthorizeUrl({
116
118
  permissions: ["ReadBeneficiariesDetail"], // optional - set of extra permissions to set for auth URL
117
119
  expirationDateTime: "2022-09-01T00:00:00.000Z", // optional
118
120
  transactionFromDateTime: "2020-09-01T00:00:00.000Z", // optional,
121
+ enableAsync: false // optional
119
122
  })
120
123
 
121
124
  // Default claims if none are provided
@@ -148,7 +151,8 @@ const url = await moneyhub.getAuthorizeUrlForCreatedUser({
148
151
  state: "your state value", // optional
149
152
  nonce: "your nonce value", // optional
150
153
  claims: claimsObject, // optional
151
- permissions: ["ReadBeneficiariesDetail"] // optional - set of extra permissions to set for auth URL
154
+ permissions: ["ReadBeneficiariesDetail"], // optional - set of extra permissions to set for auth URL
155
+ enableAsync: false // optional
152
156
  })
153
157
 
154
158
  // Scope used with the bankId provided
@@ -179,6 +183,7 @@ const url = await moneyhub.getReauthAuthorizeUrlForCreatedUser({
179
183
  state: "your state value", // optional
180
184
  nonce: "your nonce value", // optional
181
185
  claims: claimsObject, // optional
186
+ enableAsync: false // optional
182
187
  })
183
188
 
184
189
  // Default claims if none are provided
@@ -207,6 +212,7 @@ const url = await moneyhub.getRefreshAuthorizeUrlForCreatedUser({
207
212
  state: "your state value", // optional
208
213
  nonce: "your nonce value", // optional
209
214
  claims: claimsObject, // optional
215
+ enableAsync: false // optional
210
216
  })
211
217
 
212
218
  // Default claims if none are provided
@@ -520,6 +526,30 @@ const user = await moneyhub.deleteUserConnection({
520
526
  })
521
527
  ```
522
528
 
529
+ #### `getConnectionSyncs`
530
+
531
+ Retrieve the syncs for a given connection ID.
532
+ ```javascript
533
+ const syncs = await moneyhub.getConnectionSyncs({
534
+ userId: "user-id",
535
+ connectionId: "connection-id",
536
+ params: {
537
+ limit: 10,
538
+ offset: 0
539
+ }
540
+ })
541
+ ```
542
+
543
+ #### `getSync`
544
+
545
+ Retrieve the syncs for the given sync ID.
546
+ ```javascript
547
+ const syncs = await moneyhub.getSync({
548
+ userId: "user-id",
549
+ syncId: "sync-id"
550
+ })
551
+ ```
552
+
523
553
  ### Data API
524
554
 
525
555
  #### `getAccounts`
@@ -80,6 +80,8 @@ describe("API client", () => {
80
80
  "getUserConnections",
81
81
  "deleteUserConnection",
82
82
  "deleteUser",
83
+ "getConnectionSyncs",
84
+ "getSync",
83
85
  "getCategories",
84
86
  "getStandardCategories",
85
87
  "getCategory",
@@ -36,6 +36,7 @@ module.exports = ({client, config}) => {
36
36
  nonce,
37
37
  claims = {},
38
38
  permissions,
39
+ enableAsync,
39
40
  expirationDateTime,
40
41
  transactionFromDateTime,
41
42
  }) => {
@@ -55,6 +56,12 @@ module.exports = ({client, config}) => {
55
56
  ...transactionFromDateTime && {transactionFromDateTime},
56
57
  }
57
58
  }
59
+ },
60
+ ...enableAsync && {
61
+ "mh:sync": {
62
+ "essential": true,
63
+ "value": {"enableAsync": true}
64
+ }
58
65
  }
59
66
  },
60
67
  }
@@ -136,6 +143,7 @@ module.exports = ({client, config}) => {
136
143
  permissions,
137
144
  expirationDateTime,
138
145
  transactionFromDateTime,
146
+ enableAsync,
139
147
  }) => {
140
148
  const scope = `id:${bankId} openid`
141
149
  const defaultClaims = {
@@ -161,6 +169,7 @@ module.exports = ({client, config}) => {
161
169
  claims: _claims,
162
170
  expirationDateTime,
163
171
  transactionFromDateTime,
172
+ enableAsync,
164
173
  })
165
174
  return url
166
175
  },
@@ -173,6 +182,7 @@ module.exports = ({client, config}) => {
173
182
  claims = {},
174
183
  expirationDateTime,
175
184
  transactionFromDateTime,
185
+ enableAsync,
176
186
  }) => {
177
187
  const scope = "openid reauth"
178
188
  const defaultClaims = {
@@ -196,6 +206,7 @@ module.exports = ({client, config}) => {
196
206
  claims: _claims,
197
207
  expirationDateTime,
198
208
  transactionFromDateTime,
209
+ enableAsync,
199
210
  })
200
211
  return url
201
212
  },
@@ -208,6 +219,7 @@ module.exports = ({client, config}) => {
208
219
  claims = {},
209
220
  expirationDateTime,
210
221
  transactionFromDateTime,
222
+ enableAsync
211
223
  }) => {
212
224
  const scope = "openid refresh"
213
225
  const defaultClaims = {
@@ -231,6 +243,7 @@ module.exports = ({client, config}) => {
231
243
  claims: _claims,
232
244
  expirationDateTime,
233
245
  transactionFromDateTime,
246
+ enableAsync
234
247
  })
235
248
  return url
236
249
  },
@@ -60,5 +60,20 @@ module.exports = ({config, request}) => {
60
60
  scope: "user:delete",
61
61
  },
62
62
  }),
63
+
64
+ getConnectionSyncs: async ({userId, connectionId, params = {}}) =>
65
+ request(`${usersEndpoint}/${userId}/connections/${connectionId}/syncs`, {
66
+ searchParams: params,
67
+ cc: {
68
+ scope: "user:read"
69
+ }
70
+ }),
71
+
72
+ getSync: async ({userId, syncId}) =>
73
+ request(`${usersEndpoint}/${userId}/syncs/${syncId}`, {
74
+ cc: {
75
+ scope: "user:read"
76
+ }
77
+ })
63
78
  }
64
79
  }