@financeable/aggregation 0.13.3 → 0.14.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.
Files changed (332) hide show
  1. package/.devcontainer/devcontainer.json +45 -0
  2. package/FUNCTIONS.md +240 -0
  3. package/RUNTIMES.md +48 -0
  4. package/core.js +17 -0
  5. package/core.js.map +1 -0
  6. package/examples/applicationsCreate.example.ts +179 -0
  7. package/examples/package-lock.json +610 -0
  8. package/examples/package.json +18 -0
  9. package/hooks/hooks.js +84 -0
  10. package/hooks/hooks.js.map +1 -0
  11. package/hooks/index.js +22 -0
  12. package/hooks/index.js.map +1 -0
  13. package/hooks/oauth2scopes.d.ts +13 -0
  14. package/hooks/oauth2scopes.d.ts.map +1 -0
  15. package/hooks/oauth2scopes.js +6 -0
  16. package/hooks/oauth2scopes.js.map +1 -0
  17. package/hooks/types.js +6 -0
  18. package/hooks/types.js.map +1 -0
  19. package/index.js +48 -0
  20. package/index.js.map +1 -0
  21. package/jsr.json +27 -0
  22. package/lib/base64.js +71 -0
  23. package/lib/base64.js.map +1 -0
  24. package/lib/config.d.ts +38 -0
  25. package/lib/config.d.ts.map +1 -0
  26. package/lib/config.js +35 -0
  27. package/lib/config.js.map +1 -0
  28. package/lib/dlv.d.ts +14 -0
  29. package/lib/dlv.d.ts.map +1 -0
  30. package/lib/dlv.js +49 -0
  31. package/lib/dlv.js.map +1 -0
  32. package/lib/encodings.js +379 -0
  33. package/lib/encodings.js.map +1 -0
  34. package/lib/env.js +82 -0
  35. package/lib/env.js.map +1 -0
  36. package/lib/files.d.ts +13 -0
  37. package/lib/files.d.ts.map +1 -0
  38. package/lib/files.js +77 -0
  39. package/lib/files.js.map +1 -0
  40. package/lib/http.d.ts +67 -0
  41. package/lib/http.d.ts.map +1 -0
  42. package/lib/http.js +217 -0
  43. package/lib/http.js.map +1 -0
  44. package/lib/is-plain-object.d.ts +2 -0
  45. package/lib/is-plain-object.d.ts.map +1 -0
  46. package/lib/is-plain-object.js +41 -0
  47. package/lib/is-plain-object.js.map +1 -0
  48. package/lib/logger.d.ts +6 -0
  49. package/lib/logger.d.ts.map +1 -0
  50. package/lib/logger.js +6 -0
  51. package/lib/logger.js.map +1 -0
  52. package/lib/matchers.js +218 -0
  53. package/lib/matchers.js.map +1 -0
  54. package/lib/primitives.d.ts +26 -0
  55. package/lib/primitives.d.ts.map +1 -0
  56. package/lib/primitives.js +111 -0
  57. package/lib/primitives.js.map +1 -0
  58. package/lib/retries.d.ts +38 -0
  59. package/lib/retries.d.ts.map +1 -0
  60. package/lib/retries.js +153 -0
  61. package/lib/retries.js.map +1 -0
  62. package/lib/schemas.js +62 -0
  63. package/lib/schemas.js.map +1 -0
  64. package/lib/sdks.js +274 -0
  65. package/lib/sdks.js.map +1 -0
  66. package/lib/security.js +145 -0
  67. package/lib/security.js.map +1 -0
  68. package/lib/url.d.ts +5 -0
  69. package/lib/url.d.ts.map +1 -0
  70. package/lib/url.js +25 -0
  71. package/lib/url.js.map +1 -0
  72. package/models/components/abnstatus.d.ts +10 -0
  73. package/models/components/abnstatus.d.ts.map +1 -0
  74. package/models/components/abnstatus.js +48 -0
  75. package/models/components/abnstatus.js.map +1 -0
  76. package/models/components/addressattributes.js +98 -0
  77. package/models/components/addressattributes.js.map +1 -0
  78. package/models/components/apierrorlinks.js +50 -0
  79. package/models/components/apierrorlinks.js.map +1 -0
  80. package/models/components/applicationresource.js +57 -0
  81. package/models/components/applicationresource.js.map +1 -0
  82. package/models/components/applicationstatus.js +53 -0
  83. package/models/components/applicationstatus.js.map +1 -0
  84. package/models/components/australianstatesandterritories.js +55 -0
  85. package/models/components/australianstatesandterritories.js.map +1 -0
  86. package/models/components/badrequesterror.js +69 -0
  87. package/models/components/badrequesterror.js.map +1 -0
  88. package/models/components/businessapplicationjsonapirelationships.js +126 -0
  89. package/models/components/businessapplicationjsonapirelationships.js.map +1 -0
  90. package/models/components/businessapplicationpayload.js +79 -0
  91. package/models/components/businessapplicationpayload.js.map +1 -0
  92. package/models/components/businessapplicationresource.js +82 -0
  93. package/models/components/businessapplicationresource.js.map +1 -0
  94. package/models/components/businessloanbusinessapplicationrelationships.js +221 -0
  95. package/models/components/businessloanbusinessapplicationrelationships.js.map +1 -0
  96. package/models/components/commercialapplicationjsonapirelationships.js +153 -0
  97. package/models/components/commercialapplicationjsonapirelationships.js.map +1 -0
  98. package/models/components/commercialsecuredapplicationpayload.js +88 -0
  99. package/models/components/commercialsecuredapplicationpayload.js.map +1 -0
  100. package/models/components/commercialsecuredapplicationresource.js +81 -0
  101. package/models/components/commercialsecuredapplicationresource.js.map +1 -0
  102. package/models/components/commercialsecuredloanassetattributes.js +223 -0
  103. package/models/components/commercialsecuredloanassetattributes.js.map +1 -0
  104. package/models/components/commercialsecuredloanassettype.js +73 -0
  105. package/models/components/commercialsecuredloanassettype.js.map +1 -0
  106. package/models/components/commercialsecuredloancommercialapplicationrelationships.d.ts +101 -6
  107. package/models/components/commercialsecuredloancommercialapplicationrelationships.d.ts.map +1 -1
  108. package/models/components/commercialsecuredloancommercialapplicationrelationships.js +309 -0
  109. package/models/components/commercialsecuredloancommercialapplicationrelationships.js.map +1 -0
  110. package/models/components/commercialsecuredloantypeofsale.js +53 -0
  111. package/models/components/commercialsecuredloantypeofsale.js.map +1 -0
  112. package/models/components/consumerapplicationjsonapirelationships.js +127 -0
  113. package/models/components/consumerapplicationjsonapirelationships.js.map +1 -0
  114. package/models/components/consumersecuredapplicationpayload.js +89 -0
  115. package/models/components/consumersecuredapplicationpayload.js.map +1 -0
  116. package/models/components/consumersecuredapplicationresource.js +82 -0
  117. package/models/components/consumersecuredapplicationresource.js.map +1 -0
  118. package/models/components/consumersecuredloanassetattributes.js +225 -0
  119. package/models/components/consumersecuredloanassetattributes.js.map +1 -0
  120. package/models/components/consumersecuredloanassettype.js +61 -0
  121. package/models/components/consumersecuredloanassettype.js.map +1 -0
  122. package/models/components/consumersecuredloanconsumerapplicationrelationships.d.ts +105 -10
  123. package/models/components/consumersecuredloanconsumerapplicationrelationships.d.ts.map +1 -1
  124. package/models/components/consumersecuredloanconsumerapplicationrelationships.js +344 -0
  125. package/models/components/consumersecuredloanconsumerapplicationrelationships.js.map +1 -0
  126. package/models/components/consumersecuredloantypeofsale.js +53 -0
  127. package/models/components/consumersecuredloantypeofsale.js.map +1 -0
  128. package/models/components/createsupportingdocumentsresponse.js +82 -0
  129. package/models/components/createsupportingdocumentsresponse.js.map +1 -0
  130. package/models/components/currencycodeiso4217.js +48 -0
  131. package/models/components/currencycodeiso4217.js.map +1 -0
  132. package/models/components/customerassetattributes.js +66 -0
  133. package/models/components/customerassetattributes.js.map +1 -0
  134. package/models/components/customerassettype.js +55 -0
  135. package/models/components/customerassettype.js.map +1 -0
  136. package/models/components/customerattributes.js +68 -0
  137. package/models/components/customerattributes.js.map +1 -0
  138. package/models/components/customerattributescreateitem.js +73 -0
  139. package/models/components/customerattributescreateitem.js.map +1 -0
  140. package/models/components/customeridtype.js +47 -0
  141. package/models/components/customeridtype.js.map +1 -0
  142. package/models/components/customerliabilityattributes.js +77 -0
  143. package/models/components/customerliabilityattributes.js.map +1 -0
  144. package/models/components/customerliabilityrepaymentfrequency.js +50 -0
  145. package/models/components/customerliabilityrepaymentfrequency.js.map +1 -0
  146. package/models/components/customerliabilitytype.js +53 -0
  147. package/models/components/customerliabilitytype.js.map +1 -0
  148. package/models/components/customertitle.js +51 -0
  149. package/models/components/customertitle.js.map +1 -0
  150. package/models/components/documenttype.js +64 -0
  151. package/models/components/documenttype.js.map +1 -0
  152. package/models/components/employerattributes.d.ts +58 -0
  153. package/models/components/employerattributes.d.ts.map +1 -0
  154. package/models/components/employerattributes.js +69 -0
  155. package/models/components/employerattributes.js.map +1 -0
  156. package/models/components/employmentstatus.d.ts +10 -0
  157. package/models/components/employmentstatus.d.ts.map +1 -0
  158. package/models/components/employmentstatus.js +47 -0
  159. package/models/components/employmentstatus.js.map +1 -0
  160. package/models/components/employmenttype.d.ts +15 -0
  161. package/models/components/employmenttype.d.ts.map +1 -0
  162. package/models/components/employmenttype.js +52 -0
  163. package/models/components/employmenttype.js.map +1 -0
  164. package/models/components/entityattributes.d.ts +4 -4
  165. package/models/components/entityattributes.d.ts.map +1 -1
  166. package/models/components/entityattributes.js +90 -0
  167. package/models/components/entityattributes.js.map +1 -0
  168. package/models/components/entityattributesinput.js +55 -0
  169. package/models/components/entityattributesinput.js.map +1 -0
  170. package/models/components/entitytype.d.ts +152 -0
  171. package/models/components/entitytype.d.ts.map +1 -0
  172. package/models/components/entitytype.js +190 -0
  173. package/models/components/entitytype.js.map +1 -0
  174. package/models/components/errorsource.js +52 -0
  175. package/models/components/errorsource.js.map +1 -0
  176. package/models/components/expenseattributes.js +55 -0
  177. package/models/components/expenseattributes.js.map +1 -0
  178. package/models/components/expensefrequency.js +48 -0
  179. package/models/components/expensefrequency.js.map +1 -0
  180. package/models/components/expensetype.js +65 -0
  181. package/models/components/expensetype.js.map +1 -0
  182. package/models/components/forbiddenerror.js +74 -0
  183. package/models/components/forbiddenerror.js.map +1 -0
  184. package/models/components/frequencytype.js +53 -0
  185. package/models/components/frequencytype.js.map +1 -0
  186. package/models/components/incomeattributes.js +55 -0
  187. package/models/components/incomeattributes.js.map +1 -0
  188. package/models/components/incomefrequency.js +49 -0
  189. package/models/components/incomefrequency.js.map +1 -0
  190. package/models/components/incometype.js +55 -0
  191. package/models/components/incometype.js.map +1 -0
  192. package/models/components/index.d.ts +7 -0
  193. package/models/components/index.d.ts.map +1 -1
  194. package/models/components/index.js +98 -0
  195. package/models/components/index.js.map +1 -0
  196. package/models/components/industry.d.ts +27 -0
  197. package/models/components/industry.d.ts.map +1 -0
  198. package/models/components/industry.js +65 -0
  199. package/models/components/industry.js.map +1 -0
  200. package/models/components/linkobject.js +66 -0
  201. package/models/components/linkobject.js.map +1 -0
  202. package/models/components/livingarrangements.js +51 -0
  203. package/models/components/livingarrangements.js.map +1 -0
  204. package/models/components/loandetailsattributes.js +256 -0
  205. package/models/components/loandetailsattributes.js.map +1 -0
  206. package/models/components/maritalstatus.js +49 -0
  207. package/models/components/maritalstatus.js.map +1 -0
  208. package/models/components/monetaryquantity.js +71 -0
  209. package/models/components/monetaryquantity.js.map +1 -0
  210. package/models/components/occupation.d.ts +201 -0
  211. package/models/components/occupation.d.ts.map +1 -0
  212. package/models/components/occupation.js +239 -0
  213. package/models/components/occupation.js.map +1 -0
  214. package/models/components/paginationlinks.js +53 -0
  215. package/models/components/paginationlinks.js.map +1 -0
  216. package/models/components/paginationmeta.js +60 -0
  217. package/models/components/paginationmeta.js.map +1 -0
  218. package/models/components/percentagequantity.js +67 -0
  219. package/models/components/percentagequantity.js.map +1 -0
  220. package/models/components/personalapplicationjsonapirelationships.js +101 -0
  221. package/models/components/personalapplicationjsonapirelationships.js.map +1 -0
  222. package/models/components/personalapplicationpayload.js +79 -0
  223. package/models/components/personalapplicationpayload.js.map +1 -0
  224. package/models/components/personalapplicationresource.js +82 -0
  225. package/models/components/personalapplicationresource.js.map +1 -0
  226. package/models/components/personalloanpersonalapplicationrelationships.d.ts +105 -10
  227. package/models/components/personalloanpersonalapplicationrelationships.d.ts.map +1 -1
  228. package/models/components/personalloanpersonalapplicationrelationships.js +311 -0
  229. package/models/components/personalloanpersonalapplicationrelationships.js.map +1 -0
  230. package/models/components/relationshipresourcenotfound.js +74 -0
  231. package/models/components/relationshipresourcenotfound.js.map +1 -0
  232. package/models/components/repaymentstructure.js +53 -0
  233. package/models/components/repaymentstructure.js.map +1 -0
  234. package/models/components/residencystatus.js +52 -0
  235. package/models/components/residencystatus.js.map +1 -0
  236. package/models/components/resourcenotfound.js +74 -0
  237. package/models/components/resourcenotfound.js.map +1 -0
  238. package/models/components/security.js +49 -0
  239. package/models/components/security.js.map +1 -0
  240. package/models/components/supportingdocumentattributes.js +53 -0
  241. package/models/components/supportingdocumentattributes.js.map +1 -0
  242. package/models/components/supportingdocumentattributesinput.js +51 -0
  243. package/models/components/supportingdocumentattributesinput.js.map +1 -0
  244. package/models/components/supportingdocumentrelationships.js +269 -0
  245. package/models/components/supportingdocumentrelationships.js.map +1 -0
  246. package/models/components/supportingdocumentresource.js +61 -0
  247. package/models/components/supportingdocumentresource.js.map +1 -0
  248. package/models/components/tokenrequest.js +68 -0
  249. package/models/components/tokenrequest.js.map +1 -0
  250. package/models/components/tokenresponse.js +60 -0
  251. package/models/components/tokenresponse.js.map +1 -0
  252. package/models/components/uploadmimetype.js +55 -0
  253. package/models/components/uploadmimetype.js.map +1 -0
  254. package/models/errors/apierror.d.ts +10 -0
  255. package/models/errors/apierror.d.ts.map +1 -0
  256. package/models/errors/apierror.js +34 -0
  257. package/models/errors/apierror.js.map +1 -0
  258. package/models/errors/financeableerror.d.ts +19 -0
  259. package/models/errors/financeableerror.d.ts.map +1 -0
  260. package/models/errors/financeableerror.js +20 -0
  261. package/models/errors/financeableerror.js.map +1 -0
  262. package/models/errors/httpclienterrors.d.ts +44 -0
  263. package/models/errors/httpclienterrors.d.ts.map +1 -0
  264. package/models/errors/httpclienterrors.js +78 -0
  265. package/models/errors/httpclienterrors.js.map +1 -0
  266. package/models/errors/index.js +25 -0
  267. package/models/errors/index.js.map +1 -0
  268. package/models/errors/responsevalidationerror.js +66 -0
  269. package/models/errors/responsevalidationerror.js.map +1 -0
  270. package/models/errors/sdkvalidationerror.js +129 -0
  271. package/models/errors/sdkvalidationerror.js.map +1 -0
  272. package/models/operations/createapplication.js +278 -0
  273. package/models/operations/createapplication.js.map +1 -0
  274. package/models/operations/getapplication.js +256 -0
  275. package/models/operations/getapplication.js.map +1 -0
  276. package/models/operations/index.js +24 -0
  277. package/models/operations/index.js.map +1 -0
  278. package/models/operations/listapplications.js +94 -0
  279. package/models/operations/listapplications.js.map +1 -0
  280. package/models/operations/supportingdocumentscreate.js +133 -0
  281. package/models/operations/supportingdocumentscreate.js.map +1 -0
  282. package/package.json +1 -16
  283. package/sdk/index.js +21 -0
  284. package/sdk/index.js.map +1 -0
  285. package/sdk/sdk.js +23 -0
  286. package/sdk/sdk.js.map +1 -0
  287. package/src/lib/config.ts +3 -3
  288. package/src/models/components/abnstatus.ts +16 -0
  289. package/src/models/components/commercialsecuredloancommercialapplicationrelationships.ts +241 -13
  290. package/src/models/components/consumersecuredloanconsumerapplicationrelationships.ts +275 -19
  291. package/src/models/components/employerattributes.ts +97 -0
  292. package/src/models/components/employmentstatus.ts +17 -0
  293. package/src/models/components/employmenttype.ts +22 -0
  294. package/src/models/components/entityattributes.ts +9 -6
  295. package/src/models/components/entitytype.ts +215 -0
  296. package/src/models/components/index.ts +7 -0
  297. package/src/models/components/industry.ts +36 -0
  298. package/src/models/components/occupation.ts +226 -0
  299. package/src/models/components/personalloanpersonalapplicationrelationships.ts +272 -20
  300. package/tsconfig.json +40 -0
  301. package/types/async.d.ts +23 -0
  302. package/types/async.d.ts.map +1 -0
  303. package/types/async.js +44 -0
  304. package/types/async.js.map +1 -0
  305. package/types/blobs.js +62 -0
  306. package/types/blobs.js.map +1 -0
  307. package/types/constdatetime.js +46 -0
  308. package/types/constdatetime.js.map +1 -0
  309. package/types/enums.js +66 -0
  310. package/types/enums.js.map +1 -0
  311. package/types/fp.d.ts +31 -0
  312. package/types/fp.d.ts.map +1 -0
  313. package/types/fp.js +37 -0
  314. package/types/fp.js.map +1 -0
  315. package/types/index.js +29 -0
  316. package/types/index.js.map +1 -0
  317. package/types/operations.d.ts +27 -0
  318. package/types/operations.d.ts.map +1 -0
  319. package/types/operations.js +83 -0
  320. package/types/operations.js.map +1 -0
  321. package/types/rfcdate.d.ts +21 -0
  322. package/types/rfcdate.d.ts.map +1 -0
  323. package/types/rfcdate.js +46 -0
  324. package/types/rfcdate.js.map +1 -0
  325. package/types/streams.d.ts +2 -0
  326. package/types/streams.d.ts.map +1 -0
  327. package/types/streams.js +18 -0
  328. package/types/streams.js.map +1 -0
  329. package/types/unrecognized.d.ts +16 -0
  330. package/types/unrecognized.d.ts.map +1 -0
  331. package/types/unrecognized.js +34 -0
  332. package/types/unrecognized.js.map +1 -0
@@ -0,0 +1,45 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/images/tree/main/src/typescript-node
3
+ {
4
+ "name": "TypeScript",
5
+ "image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
6
+ // Features to add to the dev container. More info: https://containers.dev/features.
7
+ // "features": {},
8
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
9
+ // "forwardPorts": [],
10
+ // Use 'postCreateCommand' to run commands after the container is created.
11
+ "postCreateCommand": "sudo chmod +x ./.devcontainer/setup.sh && ./.devcontainer/setup.sh",
12
+ "customizations": {
13
+ "vscode": {
14
+ "extensions": [
15
+ "ms-vscode.vscode-typescript-tslint-plugin",
16
+ "esbenp.prettier-vscode",
17
+ "github.vscode-pull-request-github"
18
+ ],
19
+ "settings": {
20
+ "files.eol": "\n",
21
+ "editor.formatOnSave": true,
22
+ "typescript.tsc.autoDetect": "on",
23
+ "typescript.updateImportsOnFileMove.enabled": "always",
24
+ "typescript.preferences.importModuleSpecifier": "relative",
25
+ "[typescript]": {
26
+ "editor.codeActionsOnSave": {
27
+ "source.organizeImports": true
28
+ }
29
+ },
30
+ "[typescriptreact]": {
31
+ "editor.codeActionsOnSave": {
32
+ "source.organizeImports": true
33
+ }
34
+ }
35
+ }
36
+ },
37
+ "codespaces": {
38
+ "openFiles": [
39
+ ".devcontainer/README.md"
40
+ ]
41
+ }
42
+ }
43
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
44
+ // "remoteUser": "root"
45
+ }
package/FUNCTIONS.md ADDED
@@ -0,0 +1,240 @@
1
+ # Standalone Functions
2
+
3
+ > [!NOTE]
4
+ > This section is useful if you are using a bundler and targetting browsers and
5
+ > runtimes where the size of an application affects performance and load times.
6
+
7
+ Every method in this SDK is also available as a standalone function. This
8
+ alternative API is suitable when targetting the browser or serverless runtimes
9
+ and using a bundler to build your application since all unused functionality
10
+ will be tree-shaken away. This includes code for unused methods, Zod schemas,
11
+ encoding helpers and response handlers. The result is dramatically smaller
12
+ impact on the application's final bundle size which grows very slowly as you use
13
+ more and more functionality from this SDK.
14
+
15
+ Calling methods through the main SDK class remains a valid and generally more
16
+ more ergonomic option. Standalone functions represent an optimisation for a
17
+ specific category of applications.
18
+
19
+ ## Example
20
+
21
+ ```typescript
22
+ import { FinanceableCore } from "@financeable/aggregation/core.js";
23
+ import { applicationsCreate } from "@financeable/aggregation/funcs/applicationsCreate.js";
24
+
25
+ // Use `FinanceableCore` for best tree-shaking performance.
26
+ // You can create one instance of it to use across an application.
27
+ const financeable = new FinanceableCore({
28
+ clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
29
+ });
30
+
31
+ async function run() {
32
+ const res = await applicationsCreate(financeable, {
33
+ data: {
34
+ type: "entities",
35
+ attributes: {
36
+ applicationType: "consumerSecured",
37
+ associatedBrokerEmail: "<value>",
38
+ },
39
+ relationships: {
40
+ customers: {
41
+ data: [
42
+ {
43
+ type: "customers",
44
+ attributes: {
45
+ title: "Mr",
46
+ firstName: "Courtney",
47
+ lastName: "Greenfelder",
48
+ dateOfBirth: "1981-06-22",
49
+ idExpiryDate: "<value>",
50
+ },
51
+ relationships: {
52
+ addresses: {
53
+ data: [
54
+ {
55
+ type: "addresses",
56
+ attributes: {
57
+ id: "12345678901",
58
+ addressType: "residential",
59
+ fullAddress: "42 Wallaby Way, Sydney NSW 2000",
60
+ city: "Sydney",
61
+ postCode: "2000",
62
+ streetAddress: "42 Wallaby Way",
63
+ addressLine2: "",
64
+ streetNumber: "42",
65
+ streetType: "Way",
66
+ street: "Wallaby",
67
+ state: "NSW",
68
+ country: "Australia",
69
+ status: "current",
70
+ monthsAt: 24,
71
+ yearsAt: 2,
72
+ },
73
+ },
74
+ ],
75
+ },
76
+ },
77
+ },
78
+ {
79
+ type: "customers",
80
+ attributes: {
81
+ title: "Mr",
82
+ firstName: "Courtney",
83
+ lastName: "Greenfelder",
84
+ dateOfBirth: "1981-06-22",
85
+ idExpiryDate: "<value>",
86
+ },
87
+ relationships: {
88
+ addresses: {
89
+ data: [
90
+ {
91
+ type: "addresses",
92
+ attributes: {
93
+ id: "12345678901",
94
+ addressType: "residential",
95
+ fullAddress: "42 Wallaby Way, Sydney NSW 2000",
96
+ city: "Sydney",
97
+ postCode: "2000",
98
+ streetAddress: "42 Wallaby Way",
99
+ addressLine2: "",
100
+ streetNumber: "42",
101
+ streetType: "Way",
102
+ street: "Wallaby",
103
+ state: "NSW",
104
+ country: "Australia",
105
+ status: "current",
106
+ monthsAt: 24,
107
+ yearsAt: 2,
108
+ },
109
+ },
110
+ ],
111
+ },
112
+ },
113
+ },
114
+ {
115
+ type: "customers",
116
+ attributes: {
117
+ title: "Mr",
118
+ firstName: "Courtney",
119
+ lastName: "Greenfelder",
120
+ dateOfBirth: "1981-06-22",
121
+ idExpiryDate: "<value>",
122
+ },
123
+ relationships: {
124
+ addresses: {
125
+ data: [
126
+ {
127
+ type: "addresses",
128
+ attributes: {
129
+ id: "12345678901",
130
+ addressType: "residential",
131
+ fullAddress: "42 Wallaby Way, Sydney NSW 2000",
132
+ city: "Sydney",
133
+ postCode: "2000",
134
+ streetAddress: "42 Wallaby Way",
135
+ addressLine2: "",
136
+ streetNumber: "42",
137
+ streetType: "Way",
138
+ street: "Wallaby",
139
+ state: "NSW",
140
+ country: "Australia",
141
+ status: "current",
142
+ monthsAt: 24,
143
+ yearsAt: 2,
144
+ },
145
+ },
146
+ ],
147
+ },
148
+ },
149
+ },
150
+ ],
151
+ },
152
+ asset: {
153
+ data: {
154
+ type: "assets",
155
+ attributes: {
156
+ id: "12345678901",
157
+ ageOfAsset: 3,
158
+ ageOfAssetAtEnd: 8,
159
+ condition: "USED",
160
+ assetType: "CARAVAN",
161
+ assetValue: "35000.00",
162
+ make: "Toyota",
163
+ assetModel: "Camry",
164
+ registrationNumber: "ABC123",
165
+ registrationState: "VIC",
166
+ vin: "1HGCM82633A123456",
167
+ supplierName: "Mr and Mrs Smith",
168
+ supplierABN: "12345678901",
169
+ supplierAddress: "123 Car Street, Melbourne VIC 3000",
170
+ supplierPhone: "0412345678",
171
+ supplierContactName: "John Smith",
172
+ supplierEmail: "john.smith@mrandmrssmith.com.au",
173
+ privateSale: false,
174
+ typeOfSale: "AUTHORISED_SELLER",
175
+ description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
176
+ netAssetValue: "32000.00",
177
+ isLuxury: false,
178
+ additionalFees: "995.00",
179
+ additionalTaxes: "0.00",
180
+ },
181
+ },
182
+ },
183
+ },
184
+ },
185
+ });
186
+ if (res.ok) {
187
+ const { value: result } = res;
188
+ console.log(result);
189
+ } else {
190
+ console.log("applicationsCreate failed:", res.error);
191
+ }
192
+ }
193
+
194
+ run();
195
+ ```
196
+
197
+ ## Result types
198
+
199
+ Standalone functions differ from SDK methods in that they return a
200
+ `Result<Value, Error>` type to capture _known errors_ and document them using
201
+ the type system. By avoiding throwing errors, application code maintains clear
202
+ control flow and error-handling become part of the regular flow of application
203
+ code.
204
+
205
+ > We use the term "known errors" because standalone functions, and JavaScript
206
+ > code in general, can still throw unexpected errors such as `TypeError`s,
207
+ > `RangeError`s and `DOMException`s. Exhaustively catching all errors may be
208
+ > something this SDK addresses in the future. Nevertheless, there is still a lot
209
+ > of benefit from capturing most errors and turning them into values.
210
+
211
+ The second reason for this style of programming is because these functions will
212
+ typically be used in front-end applications where exception throwing is
213
+ sometimes discouraged or considered unidiomatic. React and similar ecosystems
214
+ and libraries tend to promote this style of programming so that components
215
+ render useful content under all states (loading, success, error and so on).
216
+
217
+ The general pattern when calling standalone functions looks like this:
218
+
219
+ ```typescript
220
+ import { Core } from "<sdk-package-name>";
221
+ import { fetchSomething } from "<sdk-package-name>/funcs/fetchSomething.js";
222
+
223
+ const client = new Core();
224
+
225
+ async function run() {
226
+ const result = await fetchSomething(client, { id: "123" });
227
+ if (!result.ok) {
228
+ // You can throw the error or handle it. It's your choice now.
229
+ throw result.error;
230
+ }
231
+
232
+ console.log(result.value);
233
+ }
234
+
235
+ run();
236
+ ```
237
+
238
+ Notably, `result.error` above will have an explicit type compared to a try-catch
239
+ variation where the error in the catch block can only be of type `unknown` (or
240
+ `any` depending on your TypeScript settings).
package/RUNTIMES.md ADDED
@@ -0,0 +1,48 @@
1
+ # Supported JavaScript runtimes
2
+
3
+ This SDK is intended to be used in JavaScript runtimes that support ECMAScript 2020 or newer. The SDK uses the following features:
4
+
5
+ - [Web Fetch API][web-fetch]
6
+ - [Web Streams API][web-streams] and in particular `ReadableStream`
7
+ - [Async iterables][async-iter] using `Symbol.asyncIterator`
8
+
9
+ [web-fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
10
+ [web-streams]: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
11
+ [async-iter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
12
+
13
+ Runtime environments that are explicitly supported are:
14
+
15
+ - Evergreen browsers which include: Chrome, Safari, Edge, Firefox
16
+ - Node.js active and maintenance LTS releases
17
+ - Currently, this is v18 and v20
18
+ - Bun v1 and above
19
+ - Deno v1.39
20
+ - Note that Deno does not currently have native support for streaming file uploads backed by the filesystem ([issue link][deno-file-streaming])
21
+
22
+ [deno-file-streaming]: https://github.com/denoland/deno/issues/11018
23
+
24
+ ## Recommended TypeScript compiler options
25
+
26
+ The following `tsconfig.json` options are recommended for projects using this
27
+ SDK in order to get static type support for features like async iterables,
28
+ streams and `fetch`-related APIs ([`for await...of`][for-await-of],
29
+ [`AbortSignal`][abort-signal], [`Request`][request], [`Response`][response] and
30
+ so on):
31
+
32
+ [for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
33
+ [abort-signal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
34
+ [request]: https://developer.mozilla.org/en-US/docs/Web/API/Request
35
+ [response]: https://developer.mozilla.org/en-US/docs/Web/API/Response
36
+
37
+ ```jsonc
38
+ {
39
+ "compilerOptions": {
40
+ "target": "es2020", // or higher
41
+ "lib": ["es2020", "dom", "dom.iterable"]
42
+ }
43
+ }
44
+ ```
45
+
46
+ While `target` can be set to older ECMAScript versions, it may result in extra,
47
+ unnecessary compatibility code being generated if you are not targeting old
48
+ runtimes.
package/core.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FinanceableCore = void 0;
7
+ const sdks_js_1 = require("./lib/sdks.js");
8
+ /**
9
+ * A minimal client to use when calling standalone SDK functions. Typically, an
10
+ * instance of this class would be instantiated once at the start of an
11
+ * application and passed around through some dependency injection mechanism to
12
+ * parts of an application that need to make SDK calls.
13
+ */
14
+ class FinanceableCore extends sdks_js_1.ClientSDK {
15
+ }
16
+ exports.FinanceableCore = FinanceableCore;
17
+ //# sourceMappingURL=core.js.map
package/core.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["src/core.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,2CAA0C;AAE1C;;;;;GAKG;AACH,MAAa,eAAgB,SAAQ,mBAAS;CAAG;AAAjD,0CAAiD"}
@@ -0,0 +1,179 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import dotenv from "dotenv";
6
+ dotenv.config();
7
+ /**
8
+ * Example usage of the @financeable/aggregation SDK
9
+ *
10
+ * To run this example from the examples directory:
11
+ * npm run build && npx tsx applicationsCreate.example.ts
12
+ */
13
+
14
+ import { Financeable } from "@financeable/aggregation";
15
+
16
+ const financeable = new Financeable({
17
+ clientCredentials: process.env["FINANCEABLE_CLIENT_CREDENTIALS"] ?? "",
18
+ });
19
+
20
+ async function main() {
21
+ const result = await financeable.applications.create({
22
+ data: {
23
+ type: "entities",
24
+ attributes: {
25
+ applicationType: "consumerSecured",
26
+ associatedBrokerEmail: "<value>",
27
+ },
28
+ relationships: {
29
+ customers: {
30
+ data: [
31
+ {
32
+ type: "customers",
33
+ attributes: {
34
+ title: "Mr",
35
+ firstName: "Courtney",
36
+ lastName: "Greenfelder",
37
+ dateOfBirth: "1981-06-22",
38
+ idExpiryDate: "<value>",
39
+ },
40
+ relationships: {
41
+ addresses: {
42
+ data: [
43
+ {
44
+ type: "addresses",
45
+ attributes: {
46
+ id: "12345678901",
47
+ addressType: "residential",
48
+ fullAddress: "42 Wallaby Way, Sydney NSW 2000",
49
+ city: "Sydney",
50
+ postCode: "2000",
51
+ streetAddress: "42 Wallaby Way",
52
+ addressLine2: "",
53
+ streetNumber: "42",
54
+ streetType: "Way",
55
+ street: "Wallaby",
56
+ state: "NSW",
57
+ country: "Australia",
58
+ status: "current",
59
+ monthsAt: 24,
60
+ yearsAt: 2,
61
+ },
62
+ },
63
+ ],
64
+ },
65
+ },
66
+ },
67
+ {
68
+ type: "customers",
69
+ attributes: {
70
+ title: "Mr",
71
+ firstName: "Courtney",
72
+ lastName: "Greenfelder",
73
+ dateOfBirth: "1981-06-22",
74
+ idExpiryDate: "<value>",
75
+ },
76
+ relationships: {
77
+ addresses: {
78
+ data: [
79
+ {
80
+ type: "addresses",
81
+ attributes: {
82
+ id: "12345678901",
83
+ addressType: "residential",
84
+ fullAddress: "42 Wallaby Way, Sydney NSW 2000",
85
+ city: "Sydney",
86
+ postCode: "2000",
87
+ streetAddress: "42 Wallaby Way",
88
+ addressLine2: "",
89
+ streetNumber: "42",
90
+ streetType: "Way",
91
+ street: "Wallaby",
92
+ state: "NSW",
93
+ country: "Australia",
94
+ status: "current",
95
+ monthsAt: 24,
96
+ yearsAt: 2,
97
+ },
98
+ },
99
+ ],
100
+ },
101
+ },
102
+ },
103
+ {
104
+ type: "customers",
105
+ attributes: {
106
+ title: "Mr",
107
+ firstName: "Courtney",
108
+ lastName: "Greenfelder",
109
+ dateOfBirth: "1981-06-22",
110
+ idExpiryDate: "<value>",
111
+ },
112
+ relationships: {
113
+ addresses: {
114
+ data: [
115
+ {
116
+ type: "addresses",
117
+ attributes: {
118
+ id: "12345678901",
119
+ addressType: "residential",
120
+ fullAddress: "42 Wallaby Way, Sydney NSW 2000",
121
+ city: "Sydney",
122
+ postCode: "2000",
123
+ streetAddress: "42 Wallaby Way",
124
+ addressLine2: "",
125
+ streetNumber: "42",
126
+ streetType: "Way",
127
+ street: "Wallaby",
128
+ state: "NSW",
129
+ country: "Australia",
130
+ status: "current",
131
+ monthsAt: 24,
132
+ yearsAt: 2,
133
+ },
134
+ },
135
+ ],
136
+ },
137
+ },
138
+ },
139
+ ],
140
+ },
141
+ asset: {
142
+ data: {
143
+ type: "assets",
144
+ attributes: {
145
+ id: "12345678901",
146
+ ageOfAsset: 3,
147
+ ageOfAssetAtEnd: 8,
148
+ condition: "USED",
149
+ assetType: "CARAVAN",
150
+ assetValue: "35000.00",
151
+ make: "Toyota",
152
+ assetModel: "Camry",
153
+ registrationNumber: "ABC123",
154
+ registrationState: "VIC",
155
+ vin: "1HGCM82633A123456",
156
+ supplierName: "Mr and Mrs Smith",
157
+ supplierABN: "12345678901",
158
+ supplierAddress: "123 Car Street, Melbourne VIC 3000",
159
+ supplierPhone: "0412345678",
160
+ supplierContactName: "John Smith",
161
+ supplierEmail: "john.smith@mrandmrssmith.com.au",
162
+ privateSale: false,
163
+ typeOfSale: "AUTHORISED_SELLER",
164
+ description: "2020 Toyota Camry Hybrid SL, Silver, 45,000km",
165
+ netAssetValue: "32000.00",
166
+ isLuxury: false,
167
+ additionalFees: "995.00",
168
+ additionalTaxes: "0.00",
169
+ },
170
+ },
171
+ },
172
+ },
173
+ },
174
+ });
175
+
176
+ console.log(result);
177
+ }
178
+
179
+ main().catch(console.error);