@mft/moneyhub-api-client 6.94.0 → 6.97.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/.idea/codeStyles/Project.xml +21 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/dbnavigator.xml +450 -0
- package/.idea/git_toolbox_blame.xml +6 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/jsLinters/eslint.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/moneyhub-api-client.iml +12 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/workspace.xml +337 -0
- package/CHANGELOG.md +18 -1
- package/dist/discovery.d.ts +75 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +169 -0
- package/dist/discovery.js.map +1 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -24
- package/dist/index.js.map +1 -1
- package/dist/oidc-config.d.ts +17 -0
- package/dist/oidc-config.d.ts.map +1 -0
- package/dist/oidc-config.js +44 -0
- package/dist/oidc-config.js.map +1 -0
- package/dist/request.d.ts +11 -3
- package/dist/request.d.ts.map +1 -1
- package/dist/request.js +38 -7
- package/dist/request.js.map +1 -1
- package/dist/requests/caas/accounts.d.ts +5 -0
- package/dist/requests/caas/accounts.d.ts.map +1 -0
- package/dist/requests/caas/accounts.js +18 -0
- package/dist/requests/caas/accounts.js.map +1 -0
- package/dist/requests/caas/categories.d.ts +5 -0
- package/dist/requests/caas/categories.d.ts.map +1 -0
- package/dist/requests/caas/categories.js +26 -0
- package/dist/requests/caas/categories.js.map +1 -0
- package/dist/requests/caas/counterparties.d.ts +5 -0
- package/dist/requests/caas/counterparties.d.ts.map +1 -0
- package/dist/requests/caas/counterparties.js +18 -0
- package/dist/requests/caas/counterparties.js.map +1 -0
- package/dist/requests/caas/enhanced-transactions.d.ts +5 -0
- package/dist/requests/caas/enhanced-transactions.d.ts.map +1 -0
- package/dist/requests/caas/enhanced-transactions.js +17 -0
- package/dist/requests/caas/enhanced-transactions.js.map +1 -0
- package/dist/requests/caas/geotags.d.ts +5 -0
- package/dist/requests/caas/geotags.d.ts.map +1 -0
- package/dist/requests/caas/geotags.js +18 -0
- package/dist/requests/caas/geotags.js.map +1 -0
- package/dist/requests/caas/regular-transactions.d.ts +5 -0
- package/dist/requests/caas/regular-transactions.d.ts.map +1 -0
- package/dist/requests/caas/regular-transactions.js +16 -0
- package/dist/requests/caas/regular-transactions.js.map +1 -0
- package/dist/requests/caas/transaction-splits.d.ts +5 -0
- package/dist/requests/caas/transaction-splits.d.ts.map +1 -0
- package/dist/requests/caas/transaction-splits.js +28 -0
- package/dist/requests/caas/transaction-splits.js.map +1 -0
- package/dist/requests/caas/transactions.d.ts +5 -0
- package/dist/requests/caas/transactions.d.ts.map +1 -0
- package/dist/requests/caas/transactions.js +48 -0
- package/dist/requests/caas/transactions.js.map +1 -0
- package/dist/requests/caas/types/accounts.d.ts +7 -0
- package/dist/requests/caas/types/accounts.d.ts.map +1 -0
- package/dist/requests/{types/reseller.js → caas/types/accounts.js} +1 -1
- package/dist/requests/caas/types/accounts.js.map +1 -0
- package/dist/requests/caas/types/categories.d.ts +22 -0
- package/dist/requests/caas/types/categories.d.ts.map +1 -0
- package/dist/{schema/payment-link.js → requests/caas/types/categories.js} +1 -1
- package/dist/requests/caas/types/categories.js.map +1 -0
- package/dist/requests/caas/types/counterparties.d.ts +9 -0
- package/dist/requests/caas/types/counterparties.d.ts.map +1 -0
- package/dist/requests/caas/types/counterparties.js +3 -0
- package/dist/requests/caas/types/counterparties.js.map +1 -0
- package/dist/requests/caas/types/enhanced-transactions.d.ts +250 -0
- package/dist/requests/caas/types/enhanced-transactions.d.ts.map +1 -0
- package/dist/requests/caas/types/enhanced-transactions.js +3 -0
- package/dist/requests/caas/types/enhanced-transactions.js.map +1 -0
- package/dist/requests/caas/types/geotags.d.ts +8 -0
- package/dist/requests/caas/types/geotags.d.ts.map +1 -0
- package/dist/requests/{types/payment-links.js → caas/types/geotags.js} +1 -1
- package/dist/requests/caas/types/geotags.js.map +1 -0
- package/dist/requests/caas/types/regular-transactions.d.ts +49 -0
- package/dist/requests/caas/types/regular-transactions.d.ts.map +1 -0
- package/dist/requests/caas/types/regular-transactions.js +3 -0
- package/dist/requests/caas/types/regular-transactions.js.map +1 -0
- package/dist/requests/caas/types/transaction-splits.d.ts +23 -0
- package/dist/requests/caas/types/transaction-splits.d.ts.map +1 -0
- package/dist/requests/caas/types/transaction-splits.js +3 -0
- package/dist/requests/caas/types/transaction-splits.js.map +1 -0
- package/dist/requests/caas/types/transactions.d.ts +110 -0
- package/dist/requests/caas/types/transactions.d.ts.map +1 -0
- package/dist/requests/caas/types/transactions.js +3 -0
- package/dist/requests/caas/types/transactions.js.map +1 -0
- package/dist/requests/caas/types/users.d.ts +7 -0
- package/dist/requests/caas/types/users.d.ts.map +1 -0
- package/dist/requests/caas/types/users.js +3 -0
- package/dist/requests/caas/types/users.js.map +1 -0
- package/dist/requests/caas/users.d.ts +5 -0
- package/dist/requests/caas/users.d.ts.map +1 -0
- package/dist/requests/caas/users.js +18 -0
- package/dist/requests/caas/users.js.map +1 -0
- package/dist/requests/consent-history.d.ts +5 -0
- package/dist/requests/consent-history.d.ts.map +1 -0
- package/dist/requests/consent-history.js +17 -0
- package/dist/requests/consent-history.js.map +1 -0
- package/dist/requests/index.d.ts +55 -0
- package/dist/requests/index.d.ts.map +1 -1
- package/dist/requests/index.js +20 -0
- package/dist/requests/index.js.map +1 -1
- package/dist/requests/recurring-payments.d.ts.map +1 -1
- package/dist/requests/recurring-payments.js +8 -0
- package/dist/requests/recurring-payments.js.map +1 -1
- package/dist/requests/types/consent-history.d.ts +6 -0
- package/dist/requests/types/consent-history.d.ts.map +1 -0
- package/dist/requests/types/consent-history.js +3 -0
- package/dist/requests/types/consent-history.js.map +1 -0
- package/dist/requests/types/recurring-payments.d.ts +5 -1
- package/dist/requests/types/recurring-payments.d.ts.map +1 -1
- package/dist/requests/unauthenticated.d.ts.map +1 -1
- package/dist/requests/unauthenticated.js +2 -2
- package/dist/requests/unauthenticated.js.map +1 -1
- package/dist/requests/users-and-connections.d.ts.map +1 -1
- package/dist/requests/users-and-connections.js +2 -1
- package/dist/requests/users-and-connections.js.map +1 -1
- package/dist/schema/config.d.ts +13 -0
- package/dist/schema/config.d.ts.map +1 -1
- package/dist/schema/consent-history.d.ts +31 -0
- package/dist/schema/consent-history.d.ts.map +1 -0
- package/dist/schema/consent-history.js +3 -0
- package/dist/schema/consent-history.js.map +1 -0
- package/dist/schema/counterparty.d.ts +25 -5
- package/dist/schema/counterparty.d.ts.map +1 -1
- package/dist/schema/payment.d.ts +11 -0
- package/dist/schema/payment.d.ts.map +1 -1
- package/dist/schema/scim-user.d.ts +4 -0
- package/dist/schema/scim-user.d.ts.map +1 -1
- package/dist/schema/statement.d.ts.map +1 -1
- package/dist/schema/statement.js +1 -0
- package/dist/schema/statement.js.map +1 -1
- package/dist/tokens.js +1 -1
- package/dist/tokens.js.map +1 -1
- package/package.json +15 -4
- package/readme.md +274 -9
- package/scripts/assert-github-actions-publish.js +10 -0
- package/dist/get-payment-link.d.ts +0 -15
- package/dist/get-payment-link.d.ts.map +0 -1
- package/dist/get-payment-link.js +0 -61
- package/dist/get-payment-link.js.map +0 -1
- package/dist/requests/payment-links.d.ts +0 -5
- package/dist/requests/payment-links.d.ts.map +0 -1
- package/dist/requests/payment-links.js +0 -32
- package/dist/requests/payment-links.js.map +0 -1
- package/dist/requests/reseller.d.ts +0 -5
- package/dist/requests/reseller.d.ts.map +0 -1
- package/dist/requests/reseller.js +0 -21
- package/dist/requests/reseller.js.map +0 -1
- package/dist/requests/types/payment-links.d.ts +0 -23
- package/dist/requests/types/payment-links.d.ts.map +0 -1
- package/dist/requests/types/payment-links.js.map +0 -1
- package/dist/requests/types/reseller.d.ts +0 -10
- package/dist/requests/types/reseller.d.ts.map +0 -1
- package/dist/requests/types/reseller.js.map +0 -1
- package/dist/schema/payment-link.d.ts +0 -18
- package/dist/schema/payment-link.d.ts.map +0 -1
- package/dist/schema/payment-link.js.map +0 -1
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="AutoImportSettings">
|
|
4
|
+
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ChangeListManager">
|
|
7
|
+
<list default="true" id="dc4a9aba-6094-4841-80e9-db3a0ecbe4e7" name="Changes" comment="">
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/examples/config.js" beforeDir="false" afterPath="$PROJECT_DIR$/examples/config.js" afterDir="false" />
|
|
9
|
+
</list>
|
|
10
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
11
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
12
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
13
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
14
|
+
</component>
|
|
15
|
+
<component name="Git.Settings">
|
|
16
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
17
|
+
</component>
|
|
18
|
+
<component name="GitToolBoxStore">
|
|
19
|
+
<option name="projectConfigVersion" value="5" />
|
|
20
|
+
<option name="recentBranches">
|
|
21
|
+
<RecentBranches>
|
|
22
|
+
<option name="branchesForRepo">
|
|
23
|
+
<list>
|
|
24
|
+
<RecentBranchesForRepo>
|
|
25
|
+
<option name="branches">
|
|
26
|
+
<list>
|
|
27
|
+
<RecentBranch>
|
|
28
|
+
<option name="branchName" value="master" />
|
|
29
|
+
<option name="lastUsedInstant" value="1736270362" />
|
|
30
|
+
</RecentBranch>
|
|
31
|
+
<RecentBranch>
|
|
32
|
+
<option name="branchName" value="API-1244_Adjust_savings_goals_parameters" />
|
|
33
|
+
<option name="lastUsedInstant" value="1736268297" />
|
|
34
|
+
</RecentBranch>
|
|
35
|
+
<RecentBranch>
|
|
36
|
+
<option name="branchName" value="API-1244_adjust_update_savings_goal" />
|
|
37
|
+
<option name="lastUsedInstant" value="1736178700" />
|
|
38
|
+
</RecentBranch>
|
|
39
|
+
<RecentBranch>
|
|
40
|
+
<option name="branchName" value="API-1241_add_targetDate_to_savingsGoals" />
|
|
41
|
+
<option name="lastUsedInstant" value="1735351829" />
|
|
42
|
+
</RecentBranch>
|
|
43
|
+
<RecentBranch>
|
|
44
|
+
<option name="branchName" value="auth-req-account-filtering" />
|
|
45
|
+
<option name="lastUsedInstant" value="1721817112" />
|
|
46
|
+
</RecentBranch>
|
|
47
|
+
</list>
|
|
48
|
+
</option>
|
|
49
|
+
<option name="repositoryRootUrl" value="file://$PROJECT_DIR$" />
|
|
50
|
+
</RecentBranchesForRepo>
|
|
51
|
+
</list>
|
|
52
|
+
</option>
|
|
53
|
+
</RecentBranches>
|
|
54
|
+
</option>
|
|
55
|
+
</component>
|
|
56
|
+
<component name="MarkdownSettingsMigration">
|
|
57
|
+
<option name="stateVersion" value="1" />
|
|
58
|
+
</component>
|
|
59
|
+
<component name="ProjectColorInfo">{
|
|
60
|
+
"associatedIndex": 0
|
|
61
|
+
}</component>
|
|
62
|
+
<component name="ProjectId" id="2WLqHFawFgrd0VYQ4mTpc7rMdT0" />
|
|
63
|
+
<component name="ProjectViewState">
|
|
64
|
+
<option name="hideEmptyMiddlePackages" value="true" />
|
|
65
|
+
<option name="showLibraryContents" value="true" />
|
|
66
|
+
</component>
|
|
67
|
+
<component name="PropertiesComponent"><![CDATA[{
|
|
68
|
+
"keyToString": {
|
|
69
|
+
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
|
70
|
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
71
|
+
"WebServerToolWindowFactoryState": "false",
|
|
72
|
+
"git-widget-placeholder": "main",
|
|
73
|
+
"last_opened_file_path": "/Users/ingrid.acero/Documents/Repos/moneyhub-api-client",
|
|
74
|
+
"node.js.detected.package.eslint": "true",
|
|
75
|
+
"node.js.detected.package.standard": "true",
|
|
76
|
+
"node.js.detected.package.tslint": "true",
|
|
77
|
+
"node.js.selected.package.eslint": "(autodetect)",
|
|
78
|
+
"node.js.selected.package.standard": "",
|
|
79
|
+
"node.js.selected.package.tslint": "(autodetect)",
|
|
80
|
+
"nodejs.mocha.mocha_node_package_dir": "/Users/ingrid.acero/Documents/Repos/moneyhub-api-client/node_modules/mocha",
|
|
81
|
+
"nodejs_package_manager_path": "npm",
|
|
82
|
+
"settings.editor.selected.configurable": "project.scopes",
|
|
83
|
+
"ts.external.directory.path": "/Users/ingrid.acero/Documents/Repos/moneyhub-api-client/node_modules/typescript/lib",
|
|
84
|
+
"vue.rearranger.settings.migration": "true"
|
|
85
|
+
}
|
|
86
|
+
}]]></component>
|
|
87
|
+
<component name="RunManager" selected="Mocha.src/__tests__/index.ts">
|
|
88
|
+
<configuration name="src/__tests__/index.ts" type="mocha-javascript-test-runner" temporary="true" nameIsGenerated="true">
|
|
89
|
+
<node-interpreter>project</node-interpreter>
|
|
90
|
+
<node-options />
|
|
91
|
+
<mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package>
|
|
92
|
+
<working-directory>$PROJECT_DIR$</working-directory>
|
|
93
|
+
<pass-parent-env>true</pass-parent-env>
|
|
94
|
+
<ui>bdd</ui>
|
|
95
|
+
<extra-mocha-options>--require ts-node/register</extra-mocha-options>
|
|
96
|
+
<test-kind>TEST_FILE</test-kind>
|
|
97
|
+
<test-file>$PROJECT_DIR$/src/__tests__/index.ts</test-file>
|
|
98
|
+
<method v="2" />
|
|
99
|
+
</configuration>
|
|
100
|
+
<configuration name="src/__tests__/savings-goals.ts" type="mocha-javascript-test-runner" temporary="true" nameIsGenerated="true">
|
|
101
|
+
<node-interpreter>project</node-interpreter>
|
|
102
|
+
<node-options />
|
|
103
|
+
<mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package>
|
|
104
|
+
<working-directory>$PROJECT_DIR$</working-directory>
|
|
105
|
+
<pass-parent-env>true</pass-parent-env>
|
|
106
|
+
<ui>bdd</ui>
|
|
107
|
+
<extra-mocha-options>--require ts-node/register</extra-mocha-options>
|
|
108
|
+
<test-kind>TEST_FILE</test-kind>
|
|
109
|
+
<test-file>$PROJECT_DIR$/src/__tests__/savings-goals.ts</test-file>
|
|
110
|
+
<method v="2" />
|
|
111
|
+
</configuration>
|
|
112
|
+
<recent_temporary>
|
|
113
|
+
<list>
|
|
114
|
+
<item itemvalue="Mocha.src/__tests__/index.ts" />
|
|
115
|
+
<item itemvalue="Mocha.src/__tests__/savings-goals.ts" />
|
|
116
|
+
</list>
|
|
117
|
+
</recent_temporary>
|
|
118
|
+
</component>
|
|
119
|
+
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
120
|
+
<component name="TaskManager">
|
|
121
|
+
<task active="true" id="Default" summary="Default task">
|
|
122
|
+
<changelist id="dc4a9aba-6094-4841-80e9-db3a0ecbe4e7" name="Changes" comment="" />
|
|
123
|
+
<created>1696522117454</created>
|
|
124
|
+
<option name="number" value="Default" />
|
|
125
|
+
<option name="presentableId" value="Default" />
|
|
126
|
+
<updated>1696522117454</updated>
|
|
127
|
+
<workItem from="1696522118499" duration="1908000" />
|
|
128
|
+
<workItem from="1696599338311" duration="3777000" />
|
|
129
|
+
<workItem from="1696842411351" duration="14000" />
|
|
130
|
+
<workItem from="1696842432625" duration="2354000" />
|
|
131
|
+
<workItem from="1696850236583" duration="645000" />
|
|
132
|
+
<workItem from="1696861043755" duration="7838000" />
|
|
133
|
+
<workItem from="1697032484296" duration="5574000" />
|
|
134
|
+
<workItem from="1697530070060" duration="599000" />
|
|
135
|
+
<workItem from="1698055104901" duration="6932000" />
|
|
136
|
+
<workItem from="1698399821368" duration="13174000" />
|
|
137
|
+
<workItem from="1698855859057" duration="21289000" />
|
|
138
|
+
<workItem from="1699541759033" duration="7225000" />
|
|
139
|
+
<workItem from="1699643878245" duration="4967000" />
|
|
140
|
+
<workItem from="1699887017589" duration="21867000" />
|
|
141
|
+
<workItem from="1700489404449" duration="9869000" />
|
|
142
|
+
<workItem from="1700579373630" duration="8452000" />
|
|
143
|
+
<workItem from="1700847560007" duration="1872000" />
|
|
144
|
+
<workItem from="1701258566437" duration="9303000" />
|
|
145
|
+
<workItem from="1701360437913" duration="8906000" />
|
|
146
|
+
<workItem from="1701681747628" duration="12116000" />
|
|
147
|
+
<workItem from="1702033873365" duration="193000" />
|
|
148
|
+
<workItem from="1702034080013" duration="12000" />
|
|
149
|
+
<workItem from="1702034157457" duration="18649000" />
|
|
150
|
+
<workItem from="1702639540107" duration="16538000" />
|
|
151
|
+
<workItem from="1703067091696" duration="566000" />
|
|
152
|
+
<workItem from="1704228724190" duration="5644000" />
|
|
153
|
+
<workItem from="1704389655854" duration="14590000" />
|
|
154
|
+
<workItem from="1704746016876" duration="23881000" />
|
|
155
|
+
<workItem from="1705336460196" duration="3241000" />
|
|
156
|
+
<workItem from="1707303477272" duration="13980000" />
|
|
157
|
+
<workItem from="1707401874612" duration="1046000" />
|
|
158
|
+
<workItem from="1707404929630" duration="1792000" />
|
|
159
|
+
<workItem from="1707474852304" duration="3009000" />
|
|
160
|
+
<workItem from="1707501068520" duration="1205000" />
|
|
161
|
+
<workItem from="1707999284657" duration="1721000" />
|
|
162
|
+
<workItem from="1708004116287" duration="20282000" />
|
|
163
|
+
<workItem from="1708511937605" duration="57000" />
|
|
164
|
+
<workItem from="1708512047016" duration="599000" />
|
|
165
|
+
<workItem from="1708514446947" duration="10157000" />
|
|
166
|
+
<workItem from="1708958457905" duration="9828000" />
|
|
167
|
+
<workItem from="1709304046135" duration="2121000" />
|
|
168
|
+
<workItem from="1709555432300" duration="4083000" />
|
|
169
|
+
<workItem from="1710516263031" duration="7070000" />
|
|
170
|
+
<workItem from="1712045751195" duration="590000" />
|
|
171
|
+
<workItem from="1712240416430" duration="4776000" />
|
|
172
|
+
<workItem from="1712246913675" duration="35000" />
|
|
173
|
+
<workItem from="1712247523711" duration="49208000" />
|
|
174
|
+
<workItem from="1713173779790" duration="8692000" />
|
|
175
|
+
<workItem from="1713279124637" duration="7255000" />
|
|
176
|
+
<workItem from="1713782285944" duration="10057000" />
|
|
177
|
+
<workItem from="1714410851524" duration="599000" />
|
|
178
|
+
<workItem from="1714989266485" duration="8841000" />
|
|
179
|
+
<workItem from="1715702983590" duration="3069000" />
|
|
180
|
+
<workItem from="1715957635788" duration="25736000" />
|
|
181
|
+
<workItem from="1716482042798" duration="44436000" />
|
|
182
|
+
<workItem from="1718094948712" duration="21589000" />
|
|
183
|
+
<workItem from="1718806890393" duration="9638000" />
|
|
184
|
+
<workItem from="1719328446932" duration="3502000" />
|
|
185
|
+
<workItem from="1719586270628" duration="24431000" />
|
|
186
|
+
<workItem from="1721041131098" duration="775000" />
|
|
187
|
+
<workItem from="1721734526409" duration="18464000" />
|
|
188
|
+
<workItem from="1721993015609" duration="3182000" />
|
|
189
|
+
<workItem from="1722416495820" duration="506000" />
|
|
190
|
+
<workItem from="1722417206473" duration="2577000" />
|
|
191
|
+
<workItem from="1722595979789" duration="1786000" />
|
|
192
|
+
<workItem from="1722870148871" duration="5303000" />
|
|
193
|
+
<workItem from="1723121743010" duration="6238000" />
|
|
194
|
+
<workItem from="1724246865742" duration="598000" />
|
|
195
|
+
<workItem from="1724319168831" duration="599000" />
|
|
196
|
+
<workItem from="1724340115974" duration="389000" />
|
|
197
|
+
<workItem from="1724340703376" duration="106000" />
|
|
198
|
+
<workItem from="1724340928806" duration="21575000" />
|
|
199
|
+
<workItem from="1724928332712" duration="1586000" />
|
|
200
|
+
<workItem from="1724931940386" duration="7582000" />
|
|
201
|
+
<workItem from="1725544217218" duration="4558000" />
|
|
202
|
+
<workItem from="1725904930392" duration="15506000" />
|
|
203
|
+
<workItem from="1726648049913" duration="599000" />
|
|
204
|
+
<workItem from="1726650305526" duration="11157000" />
|
|
205
|
+
<workItem from="1727184993562" duration="1089000" />
|
|
206
|
+
<workItem from="1727190262254" duration="599000" />
|
|
207
|
+
<workItem from="1728472656956" duration="3674000" />
|
|
208
|
+
<workItem from="1728642072309" duration="562000" />
|
|
209
|
+
<workItem from="1728642649832" duration="9722000" />
|
|
210
|
+
<workItem from="1728655110744" duration="1222000" />
|
|
211
|
+
<workItem from="1729015916256" duration="4841000" />
|
|
212
|
+
<workItem from="1729702509254" duration="2621000" />
|
|
213
|
+
<workItem from="1733160353656" duration="2897000" />
|
|
214
|
+
<workItem from="1733308163347" duration="14515000" />
|
|
215
|
+
<workItem from="1733503136078" duration="3410000" />
|
|
216
|
+
<workItem from="1733747863260" duration="8238000" />
|
|
217
|
+
<workItem from="1733912213167" duration="3780000" />
|
|
218
|
+
<workItem from="1734022952435" duration="46000" />
|
|
219
|
+
<workItem from="1734083873278" duration="25678000" />
|
|
220
|
+
<workItem from="1734613325964" duration="7658000" />
|
|
221
|
+
<workItem from="1735570029258" duration="308000" />
|
|
222
|
+
<workItem from="1736176628434" duration="13441000" />
|
|
223
|
+
<workItem from="1736363202637" duration="1814000" />
|
|
224
|
+
<workItem from="1736367973179" duration="3787000" />
|
|
225
|
+
<workItem from="1736452712824" duration="60000" />
|
|
226
|
+
<workItem from="1736452786706" duration="8000" />
|
|
227
|
+
<workItem from="1736452816901" duration="223000" />
|
|
228
|
+
<workItem from="1736453084591" duration="7643000" />
|
|
229
|
+
<workItem from="1736870396374" duration="16138000" />
|
|
230
|
+
<workItem from="1738169265116" duration="476000" />
|
|
231
|
+
<workItem from="1738254368720" duration="53000" />
|
|
232
|
+
<workItem from="1738606178330" duration="17365000" />
|
|
233
|
+
<workItem from="1738774404633" duration="1672000" />
|
|
234
|
+
<workItem from="1738943163530" duration="6248000" />
|
|
235
|
+
<workItem from="1739268701229" duration="4435000" />
|
|
236
|
+
<workItem from="1740140483944" duration="36634000" />
|
|
237
|
+
<workItem from="1741801593050" duration="599000" />
|
|
238
|
+
<workItem from="1741859774974" duration="7386000" />
|
|
239
|
+
<workItem from="1743092233284" duration="757000" />
|
|
240
|
+
<workItem from="1743426445696" duration="595000" />
|
|
241
|
+
<workItem from="1743502599180" duration="2540000" />
|
|
242
|
+
<workItem from="1744021184910" duration="25457000" />
|
|
243
|
+
<workItem from="1744638468601" duration="5600000" />
|
|
244
|
+
<workItem from="1744878267214" duration="15333000" />
|
|
245
|
+
<workItem from="1747062945004" duration="935000" />
|
|
246
|
+
<workItem from="1747128667865" duration="584000" />
|
|
247
|
+
<workItem from="1747648707998" duration="92000" />
|
|
248
|
+
<workItem from="1747650909387" duration="7473000" />
|
|
249
|
+
<workItem from="1747824421648" duration="10449000" />
|
|
250
|
+
<workItem from="1749027451124" duration="227000" />
|
|
251
|
+
<workItem from="1749028737138" duration="3012000" />
|
|
252
|
+
<workItem from="1749551828132" duration="595000" />
|
|
253
|
+
<workItem from="1749743415713" duration="1377000" />
|
|
254
|
+
<workItem from="1750154833015" duration="611000" />
|
|
255
|
+
<workItem from="1750170824529" duration="598000" />
|
|
256
|
+
<workItem from="1752835715569" duration="27204000" />
|
|
257
|
+
<workItem from="1753956541426" duration="14907000" />
|
|
258
|
+
<workItem from="1754402029202" duration="2425000" />
|
|
259
|
+
<workItem from="1754406742801" duration="3871000" />
|
|
260
|
+
<workItem from="1754500112721" duration="1210000" />
|
|
261
|
+
<workItem from="1754667818216" duration="5734000" />
|
|
262
|
+
<workItem from="1755250955093" duration="8985000" />
|
|
263
|
+
<workItem from="1755774270593" duration="4984000" />
|
|
264
|
+
<workItem from="1756287137870" duration="6864000" />
|
|
265
|
+
<workItem from="1756719776091" duration="596000" />
|
|
266
|
+
<workItem from="1756806091581" duration="598000" />
|
|
267
|
+
<workItem from="1756807183817" duration="1194000" />
|
|
268
|
+
<workItem from="1756983036388" duration="913000" />
|
|
269
|
+
<workItem from="1757501214008" duration="809000" />
|
|
270
|
+
<workItem from="1757602699976" duration="2119000" />
|
|
271
|
+
<workItem from="1758205661715" duration="1683000" />
|
|
272
|
+
<workItem from="1758533121784" duration="4026000" />
|
|
273
|
+
<workItem from="1759330920815" duration="616000" />
|
|
274
|
+
<workItem from="1759399267432" duration="599000" />
|
|
275
|
+
<workItem from="1761057751759" duration="10626000" />
|
|
276
|
+
<workItem from="1761230254104" duration="599000" />
|
|
277
|
+
<workItem from="1761231160769" duration="598000" />
|
|
278
|
+
<workItem from="1761648605345" duration="599000" />
|
|
279
|
+
<workItem from="1761674616966" duration="595000" />
|
|
280
|
+
<workItem from="1761758454317" duration="613000" />
|
|
281
|
+
<workItem from="1761819311576" duration="1198000" />
|
|
282
|
+
<workItem from="1761822636356" duration="2000" />
|
|
283
|
+
<workItem from="1762959471433" duration="663000" />
|
|
284
|
+
<workItem from="1762961144570" duration="15000" />
|
|
285
|
+
<workItem from="1763566255667" duration="2731000" />
|
|
286
|
+
<workItem from="1766591399442" duration="3276000" />
|
|
287
|
+
<workItem from="1768227835717" duration="597000" />
|
|
288
|
+
<workItem from="1768244813125" duration="579000" />
|
|
289
|
+
<workItem from="1768396481433" duration="595000" />
|
|
290
|
+
<workItem from="1768409518311" duration="596000" />
|
|
291
|
+
<workItem from="1768503892189" duration="187000" />
|
|
292
|
+
<workItem from="1768576915887" duration="586000" />
|
|
293
|
+
<workItem from="1769688653157" duration="2028000" />
|
|
294
|
+
<workItem from="1775559323855" duration="1233000" />
|
|
295
|
+
<workItem from="1775813644487" duration="748000" />
|
|
296
|
+
<workItem from="1776164612300" duration="226000" />
|
|
297
|
+
<workItem from="1776185498529" duration="692000" />
|
|
298
|
+
<workItem from="1779361262246" duration="1248000" />
|
|
299
|
+
</task>
|
|
300
|
+
<servers />
|
|
301
|
+
</component>
|
|
302
|
+
<component name="TypeScriptGeneratedFilesManager">
|
|
303
|
+
<option name="version" value="3" />
|
|
304
|
+
</component>
|
|
305
|
+
<component name="Vcs.Log.History.Properties">
|
|
306
|
+
<option name="COLUMN_ID_ORDER">
|
|
307
|
+
<list>
|
|
308
|
+
<option value="Default.Root" />
|
|
309
|
+
<option value="Default.Author" />
|
|
310
|
+
<option value="Default.Date" />
|
|
311
|
+
<option value="Default.Subject" />
|
|
312
|
+
<option value="Space.CommitStatus" />
|
|
313
|
+
</list>
|
|
314
|
+
</option>
|
|
315
|
+
</component>
|
|
316
|
+
<component name="XDebuggerManager">
|
|
317
|
+
<breakpoint-manager>
|
|
318
|
+
<breakpoints>
|
|
319
|
+
<line-breakpoint enabled="true" type="javascript">
|
|
320
|
+
<url>file://$PROJECT_DIR$/src/get-auth-urls.ts</url>
|
|
321
|
+
<line>172</line>
|
|
322
|
+
<option name="timeStamp" value="2" />
|
|
323
|
+
</line-breakpoint>
|
|
324
|
+
<line-breakpoint enabled="true" type="javascript">
|
|
325
|
+
<url>file://$PROJECT_DIR$/examples/token/get-client-credential-token.js</url>
|
|
326
|
+
<line>10</line>
|
|
327
|
+
<option name="timeStamp" value="3" />
|
|
328
|
+
</line-breakpoint>
|
|
329
|
+
<line-breakpoint enabled="true" type="javascript">
|
|
330
|
+
<url>file://$PROJECT_DIR$/src/exchange-code-for-token.ts</url>
|
|
331
|
+
<line>23</line>
|
|
332
|
+
<option name="timeStamp" value="5" />
|
|
333
|
+
</line-breakpoint>
|
|
334
|
+
</breakpoints>
|
|
335
|
+
</breakpoint-manager>
|
|
336
|
+
</component>
|
|
337
|
+
</project>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
6.96.0 / 2026-04-07
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
**Features**
|
|
5
|
+
|
|
6
|
+
* Add `caasGetRegularTransactions` for CaaS `GET /accounts/{accountId}/regular-transactions`.
|
|
7
|
+
|
|
8
|
+
6.95.0 / 2026-02-23
|
|
9
|
+
==========
|
|
10
|
+
|
|
11
|
+
**Features**
|
|
12
|
+
|
|
13
|
+
* **Gateway behaviour**: When `gatewayIdentityServiceUrl` is set, discovery is fetched from it and endpoint URLs in the document are rewritten to that base (discovery `issuer` is left unchanged for JWT validation). When `gatewayResourceServerUrl`, `gatewayCaasResourceServerUrl`, or `gatewayOsipResourceServerUrl` is set, the client uses that URL for that API and rewrites response link URLs in the response body to it. When `gatewayAccountConnectUrl` is set, the client uses that URL for the account-connect API (request routing only; link rewriting applies to resource server, CaaS, and OSIP only). When a gateway URL is not set for a resource, no rewriting occurs for that resource.
|
|
14
|
+
* `getOpenIdConfig()` uses a TTL cache backed by `@isaacs/ttlcache` (configurable via `options.openIdConfigCacheTtlMs`) and returns discovery with endpoint URLs rewritten to `gatewayIdentityServiceUrl` only when that option is set.
|
|
15
|
+
* Identity URLs are detected for versioning via the effective identity base (no hardcoded path prefix list); when provided, any request URL under that base does not have an API version segment added.
|
|
16
|
+
* See the readme section **Using the client behind a gateway** for configuration, verification, and security notes.
|
|
17
|
+
|
|
1
18
|
6.91.0 / 2025-05-01
|
|
2
19
|
==================
|
|
3
20
|
|
|
@@ -172,7 +189,7 @@
|
|
|
172
189
|
**Breaking Changes**
|
|
173
190
|
|
|
174
191
|
* Normalisation of all methods to use object destructuring to pass parameters. Please refer to the docs of each method when migrating to this version
|
|
175
|
-
* Delete methods only return the status code when
|
|
192
|
+
* Delete methods only return the status code when successful
|
|
176
193
|
* All methods to retrieve data return the body response as json, on previous versions some methods were returning the full response from the got library.
|
|
177
194
|
* When our API response code is not 2xx an HTTP error is thrown. Includes a response property with more information.
|
|
178
195
|
* Removal of all the methods with the suffix `WithToken`. To migrate to this version you can use the method with the same name but without the suffix. e.g `getUserConnectionsWithToken()` => `getUserConnections()`
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Agents } from "got";
|
|
2
|
+
import type { MutualTLSOptions } from "./schema/config";
|
|
3
|
+
export interface DiscoveryOptions {
|
|
4
|
+
timeout?: number;
|
|
5
|
+
agent?: Agents;
|
|
6
|
+
mTLS?: MutualTLSOptions;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Rewrites any string value in a value (object, array, or primitive) that starts with
|
|
10
|
+
* canonicalBase to use targetBase instead. Does not mutate the original.
|
|
11
|
+
* Used for both OIDC discovery documents and resource server response bodies (e.g. links).
|
|
12
|
+
* @param {*} value - Object, array or primitive to rewrite
|
|
13
|
+
* @param {string} canonicalBase - Base URL to replace
|
|
14
|
+
* @param {string} targetBase - Base URL to use instead
|
|
15
|
+
* @returns {*} A copy of value with matching URLs rewritten
|
|
16
|
+
*/
|
|
17
|
+
export declare function rewriteUrlsInObject<T>(value: T, canonicalBase: string, targetBase: string): T;
|
|
18
|
+
/**
|
|
19
|
+
* Rewrites URL fields in an OIDC discovery document so that endpoint URLs use the
|
|
20
|
+
* target base. Leaves the discovery "issuer" field unchanged so that JWT iss claim
|
|
21
|
+
* validation continues to work when the IdP still issues tokens with the canonical issuer.
|
|
22
|
+
* @param {Object} doc - OIDC discovery document
|
|
23
|
+
* @param {string} canonicalBase - Base URL to replace
|
|
24
|
+
* @param {string} targetBase - Base URL to use instead
|
|
25
|
+
* @returns {Object} Discovery document with endpoint URLs rewritten
|
|
26
|
+
*/
|
|
27
|
+
export declare function rewriteDiscoveryUrls(doc: Record<string, unknown>, canonicalBase: string, targetBase: string): Record<string, unknown>;
|
|
28
|
+
export interface OpenIDDiscoveryMetadata {
|
|
29
|
+
issuer: string;
|
|
30
|
+
authorization_endpoint?: string;
|
|
31
|
+
token_endpoint?: string;
|
|
32
|
+
jwks_uri?: string;
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Rewrites a discovery document so endpoint URLs use the identity service base (e.g. gateway).
|
|
37
|
+
* Single source of truth for canonical/target computation; used by both initial fetch and cache refresh.
|
|
38
|
+
* @param {string} identityServiceUrl - Identity service base URL (e.g. gateway or https://identity.moneyhub.co.uk)
|
|
39
|
+
* @param {Record<string, unknown>} doc - Raw OIDC discovery document
|
|
40
|
+
* @returns {Record<string, unknown>} Discovery document with endpoint URLs rewritten (issuer unchanged)
|
|
41
|
+
*/
|
|
42
|
+
export declare function rewriteDiscoveryDocForIdentityUrl(identityServiceUrl: string, doc: Record<string, unknown>): Record<string, unknown>;
|
|
43
|
+
/**
|
|
44
|
+
* Fetches the raw OpenID discovery document from identityServiceUrl/oidc (no URL rewriting).
|
|
45
|
+
* @param {string} identityServiceUrl - Identity service base URL
|
|
46
|
+
* @param {DiscoveryOptions} options - Optional timeout, agent or mTLS settings
|
|
47
|
+
* @returns {Promise<OpenIDDiscoveryMetadata>} Raw OpenID discovery metadata
|
|
48
|
+
*/
|
|
49
|
+
export declare function getDiscovery(identityServiceUrl: string, options?: DiscoveryOptions): Promise<OpenIDDiscoveryMetadata>;
|
|
50
|
+
/**
|
|
51
|
+
* Fetches the OpenID discovery document from identityServiceUrl/oidc and rewrites
|
|
52
|
+
* all endpoint URLs (but not the issuer field) to use the configured identity service url, so that
|
|
53
|
+
* when used behind a gateway all OIDC traffic goes through the gateway.
|
|
54
|
+
* @param {string} identityServiceUrl - Identity service URL (e.g. https://identity.moneyhub.co.uk)
|
|
55
|
+
* @param {DiscoveryOptions} options - Optional timeout, agent or mTLS settings
|
|
56
|
+
* @returns {Promise<OpenIDDiscoveryMetadata>} OpenID discovery metadata with URLs rewritten for the gateway
|
|
57
|
+
*/
|
|
58
|
+
export declare function getDiscoveryWithGatewayUrl(identityServiceUrl: string, options?: DiscoveryOptions): Promise<OpenIDDiscoveryMetadata>;
|
|
59
|
+
/**
|
|
60
|
+
* Infers the canonical API base from a response link URL (e.g. links.self) by taking
|
|
61
|
+
* origin and path up to and including the version segment (e.g. /v3).
|
|
62
|
+
* @param {string} linkUrl - Full link URL from a resource response
|
|
63
|
+
* @returns {string|null} Canonical base URL or null if it cannot be inferred
|
|
64
|
+
*/
|
|
65
|
+
export declare function inferCanonicalBaseFromLinkUrl(linkUrl: string): string | null;
|
|
66
|
+
/**
|
|
67
|
+
* Rewrites URL strings in a resource server response body (e.g. links.self, links.next,
|
|
68
|
+
* links.prev) so that any canonical API base is replaced with resourceServerUrl.
|
|
69
|
+
* Returns the body unchanged if no links or no canonical base can be inferred.
|
|
70
|
+
* @param {*} body - Resource server response body (typically with a links property)
|
|
71
|
+
* @param {string} resourceServerUrl - Base URL for the resource server (e.g. gateway URL)
|
|
72
|
+
* @returns {*} Body with link URLs rewritten to use resourceServerUrl
|
|
73
|
+
*/
|
|
74
|
+
export declare function rewriteResourceServerResponseUrls<T>(body: T, resourceServerUrl: string): T;
|
|
75
|
+
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,KAAK,CAAA;AAC/B,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAA;AAErD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,gBAAgB,CAAA;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,KAAK,EAAE,CAAC,EACR,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,GACjB,CAAC,CAuBH;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,GACjB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYzB;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAUD;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAC/C,kBAAkB,EAAE,MAAM,EAC1B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC3B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMzB;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,kBAAkB,EAAE,MAAM,EAC1B,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,uBAAuB,CAAC,CAkBlC;AAED;;;;;;;GAOG;AACH,wBAAsB,0BAA0B,CAC9C,kBAAkB,EAAE,MAAM,EAC1B,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,uBAAuB,CAAC,CAIlC;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAa5E;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAAC,CAAC,EACjD,IAAI,EAAE,CAAC,EACP,iBAAiB,EAAE,MAAM,GACxB,CAAC,CAaH"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.rewriteResourceServerResponseUrls = exports.inferCanonicalBaseFromLinkUrl = exports.getDiscoveryWithGatewayUrl = exports.getDiscovery = exports.rewriteDiscoveryDocForIdentityUrl = exports.rewriteDiscoveryUrls = exports.rewriteUrlsInObject = void 0;
|
|
7
|
+
const got_1 = __importDefault(require("got"));
|
|
8
|
+
/**
|
|
9
|
+
* Rewrites any string value in a value (object, array, or primitive) that starts with
|
|
10
|
+
* canonicalBase to use targetBase instead. Does not mutate the original.
|
|
11
|
+
* Used for both OIDC discovery documents and resource server response bodies (e.g. links).
|
|
12
|
+
* @param {*} value - Object, array or primitive to rewrite
|
|
13
|
+
* @param {string} canonicalBase - Base URL to replace
|
|
14
|
+
* @param {string} targetBase - Base URL to use instead
|
|
15
|
+
* @returns {*} A copy of value with matching URLs rewritten
|
|
16
|
+
*/
|
|
17
|
+
function rewriteUrlsInObject(value, canonicalBase, targetBase) {
|
|
18
|
+
if (canonicalBase === targetBase)
|
|
19
|
+
return value;
|
|
20
|
+
if (typeof value === "string") {
|
|
21
|
+
if (value.startsWith(canonicalBase)) {
|
|
22
|
+
return (targetBase + value.slice(canonicalBase.length));
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
if (Array.isArray(value)) {
|
|
27
|
+
return value.map((item) => rewriteUrlsInObject(item, canonicalBase, targetBase));
|
|
28
|
+
}
|
|
29
|
+
if (value !== null && typeof value === "object") {
|
|
30
|
+
const out = {};
|
|
31
|
+
for (const [k, v] of Object.entries(value)) {
|
|
32
|
+
out[k] = rewriteUrlsInObject(v, canonicalBase, targetBase);
|
|
33
|
+
}
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
exports.rewriteUrlsInObject = rewriteUrlsInObject;
|
|
39
|
+
/**
|
|
40
|
+
* Rewrites URL fields in an OIDC discovery document so that endpoint URLs use the
|
|
41
|
+
* target base. Leaves the discovery "issuer" field unchanged so that JWT iss claim
|
|
42
|
+
* validation continues to work when the IdP still issues tokens with the canonical issuer.
|
|
43
|
+
* @param {Object} doc - OIDC discovery document
|
|
44
|
+
* @param {string} canonicalBase - Base URL to replace
|
|
45
|
+
* @param {string} targetBase - Base URL to use instead
|
|
46
|
+
* @returns {Object} Discovery document with endpoint URLs rewritten
|
|
47
|
+
*/
|
|
48
|
+
function rewriteDiscoveryUrls(doc, canonicalBase, targetBase) {
|
|
49
|
+
if (canonicalBase === targetBase)
|
|
50
|
+
return doc;
|
|
51
|
+
const result = {};
|
|
52
|
+
for (const [key, val] of Object.entries(doc)) {
|
|
53
|
+
if (key === "issuer" && typeof val === "string") {
|
|
54
|
+
result[key] = val;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
result[key] = rewriteUrlsInObject(val, canonicalBase, targetBase);
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
exports.rewriteDiscoveryUrls = rewriteDiscoveryUrls;
|
|
62
|
+
/**
|
|
63
|
+
* Normalised OIDC base for the given identity service URL (no trailing slash).
|
|
64
|
+
* @param {string} identityServiceUrl - Identity service base URL
|
|
65
|
+
* @returns {string} OIDC base URL with no trailing slash
|
|
66
|
+
*/
|
|
67
|
+
const oidcBaseFromIdentityUrl = (identityServiceUrl) => (identityServiceUrl.replace(/\/oidc\/?$/, "") + "/oidc").replace(/\/$/, "");
|
|
68
|
+
/**
|
|
69
|
+
* Rewrites a discovery document so endpoint URLs use the identity service base (e.g. gateway).
|
|
70
|
+
* Single source of truth for canonical/target computation; used by both initial fetch and cache refresh.
|
|
71
|
+
* @param {string} identityServiceUrl - Identity service base URL (e.g. gateway or https://identity.moneyhub.co.uk)
|
|
72
|
+
* @param {Record<string, unknown>} doc - Raw OIDC discovery document
|
|
73
|
+
* @returns {Record<string, unknown>} Discovery document with endpoint URLs rewritten (issuer unchanged)
|
|
74
|
+
*/
|
|
75
|
+
function rewriteDiscoveryDocForIdentityUrl(identityServiceUrl, doc) {
|
|
76
|
+
const issuer = doc === null || doc === void 0 ? void 0 : doc.issuer;
|
|
77
|
+
if (!issuer || typeof issuer !== "string")
|
|
78
|
+
return doc;
|
|
79
|
+
const canonicalBase = issuer.replace(/\/$/, "");
|
|
80
|
+
const targetBase = oidcBaseFromIdentityUrl(identityServiceUrl);
|
|
81
|
+
return rewriteDiscoveryUrls(doc, canonicalBase, targetBase);
|
|
82
|
+
}
|
|
83
|
+
exports.rewriteDiscoveryDocForIdentityUrl = rewriteDiscoveryDocForIdentityUrl;
|
|
84
|
+
/**
|
|
85
|
+
* Fetches the raw OpenID discovery document from identityServiceUrl/oidc (no URL rewriting).
|
|
86
|
+
* @param {string} identityServiceUrl - Identity service base URL
|
|
87
|
+
* @param {DiscoveryOptions} options - Optional timeout, agent or mTLS settings
|
|
88
|
+
* @returns {Promise<OpenIDDiscoveryMetadata>} Raw OpenID discovery metadata
|
|
89
|
+
*/
|
|
90
|
+
async function getDiscovery(identityServiceUrl, options = {}) {
|
|
91
|
+
const base = oidcBaseFromIdentityUrl(identityServiceUrl);
|
|
92
|
+
const url = `${base}/.well-known/openid-configuration`;
|
|
93
|
+
const gotOpts = {
|
|
94
|
+
timeout: options.timeout,
|
|
95
|
+
responseType: "json",
|
|
96
|
+
};
|
|
97
|
+
if (options.agent) {
|
|
98
|
+
gotOpts.agent = options.agent;
|
|
99
|
+
}
|
|
100
|
+
if (options.mTLS) {
|
|
101
|
+
gotOpts.https = {
|
|
102
|
+
certificate: options.mTLS.cert,
|
|
103
|
+
key: options.mTLS.key,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const doc = (await (0, got_1.default)(url, gotOpts).json());
|
|
107
|
+
return doc;
|
|
108
|
+
}
|
|
109
|
+
exports.getDiscovery = getDiscovery;
|
|
110
|
+
/**
|
|
111
|
+
* Fetches the OpenID discovery document from identityServiceUrl/oidc and rewrites
|
|
112
|
+
* all endpoint URLs (but not the issuer field) to use the configured identity service url, so that
|
|
113
|
+
* when used behind a gateway all OIDC traffic goes through the gateway.
|
|
114
|
+
* @param {string} identityServiceUrl - Identity service URL (e.g. https://identity.moneyhub.co.uk)
|
|
115
|
+
* @param {DiscoveryOptions} options - Optional timeout, agent or mTLS settings
|
|
116
|
+
* @returns {Promise<OpenIDDiscoveryMetadata>} OpenID discovery metadata with URLs rewritten for the gateway
|
|
117
|
+
*/
|
|
118
|
+
async function getDiscoveryWithGatewayUrl(identityServiceUrl, options = {}) {
|
|
119
|
+
const doc = (await getDiscovery(identityServiceUrl, options));
|
|
120
|
+
const rewritten = rewriteDiscoveryDocForIdentityUrl(identityServiceUrl, doc);
|
|
121
|
+
return rewritten;
|
|
122
|
+
}
|
|
123
|
+
exports.getDiscoveryWithGatewayUrl = getDiscoveryWithGatewayUrl;
|
|
124
|
+
/**
|
|
125
|
+
* Infers the canonical API base from a response link URL (e.g. links.self) by taking
|
|
126
|
+
* origin and path up to and including the version segment (e.g. /v3).
|
|
127
|
+
* @param {string} linkUrl - Full link URL from a resource response
|
|
128
|
+
* @returns {string|null} Canonical base URL or null if it cannot be inferred
|
|
129
|
+
*/
|
|
130
|
+
function inferCanonicalBaseFromLinkUrl(linkUrl) {
|
|
131
|
+
try {
|
|
132
|
+
const u = new URL(linkUrl);
|
|
133
|
+
const pathParts = u.pathname.split("/").filter(Boolean);
|
|
134
|
+
const versionIndex = pathParts.findIndex((p) => /^v\d+(\.\d+)?$/i.test(p));
|
|
135
|
+
if (versionIndex >= 0) {
|
|
136
|
+
const versionPath = "/" + pathParts.slice(0, versionIndex + 1).join("/");
|
|
137
|
+
return `${u.origin}${versionPath}`;
|
|
138
|
+
}
|
|
139
|
+
return u.origin;
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.inferCanonicalBaseFromLinkUrl = inferCanonicalBaseFromLinkUrl;
|
|
146
|
+
/**
|
|
147
|
+
* Rewrites URL strings in a resource server response body (e.g. links.self, links.next,
|
|
148
|
+
* links.prev) so that any canonical API base is replaced with resourceServerUrl.
|
|
149
|
+
* Returns the body unchanged if no links or no canonical base can be inferred.
|
|
150
|
+
* @param {*} body - Resource server response body (typically with a links property)
|
|
151
|
+
* @param {string} resourceServerUrl - Base URL for the resource server (e.g. gateway URL)
|
|
152
|
+
* @returns {*} Body with link URLs rewritten to use resourceServerUrl
|
|
153
|
+
*/
|
|
154
|
+
function rewriteResourceServerResponseUrls(body, resourceServerUrl) {
|
|
155
|
+
if (body === null || typeof body !== "object")
|
|
156
|
+
return body;
|
|
157
|
+
const targetBase = resourceServerUrl.replace(/\/$/, "");
|
|
158
|
+
const links = body.links;
|
|
159
|
+
if (!links || typeof links.self !== "string")
|
|
160
|
+
return body;
|
|
161
|
+
const canonicalBase = inferCanonicalBaseFromLinkUrl(links.self);
|
|
162
|
+
if (!canonicalBase || canonicalBase === targetBase)
|
|
163
|
+
return body;
|
|
164
|
+
const result = { ...body };
|
|
165
|
+
result.links = rewriteUrlsInObject(links, canonicalBase, targetBase);
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
exports.rewriteResourceServerResponseUrls = rewriteResourceServerResponseUrls;
|
|
169
|
+
//# sourceMappingURL=discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":";;;;;;AAAA,8CAA2D;AAU3D;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CACjC,KAAQ,EACR,aAAqB,EACrB,UAAkB;IAElB,IAAI,aAAa,KAAK,UAAU;QAAE,OAAO,KAAK,CAAA;IAE9C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,IAAI,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;YACnC,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAiB,CAAA;SACxE;QACD,OAAO,KAAK,CAAA;KACb;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,CAAiB,CAAA;KACjG;IAED,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC/C,MAAM,GAAG,GAA4B,EAAE,CAAA;QACvC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAC1C,GAAG,CAAC,CAAC,CA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