@financeable/aggregation 0.8.3 → 0.9.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 (156) hide show
  1. package/FUNCTIONS.md +153 -36
  2. package/README.md +475 -94
  3. package/docs/sdks/applications/README.md +9 -15
  4. package/docs/sdks/oauthtoken/README.md +5 -9
  5. package/docs/sdks/supportingdocuments/README.md +9 -16
  6. package/funcs/applicationsCreate.d.ts +3 -3
  7. package/funcs/applicationsCreate.d.ts.map +1 -1
  8. package/funcs/applicationsCreate.js +4 -6
  9. package/funcs/applicationsCreate.js.map +1 -1
  10. package/funcs/oauthTokenGet.d.ts +3 -2
  11. package/funcs/oauthTokenGet.d.ts.map +1 -1
  12. package/funcs/oauthTokenGet.js +4 -2
  13. package/funcs/oauthTokenGet.js.map +1 -1
  14. package/funcs/supportingDocumentsCreate.d.ts +3 -3
  15. package/funcs/supportingDocumentsCreate.d.ts.map +1 -1
  16. package/funcs/supportingDocumentsCreate.js +5 -8
  17. package/funcs/supportingDocumentsCreate.js.map +1 -1
  18. package/hooks/types.d.ts +2 -0
  19. package/hooks/types.d.ts.map +1 -1
  20. package/index.d.ts +2 -0
  21. package/index.d.ts.map +1 -1
  22. package/index.js +3 -1
  23. package/index.js.map +1 -1
  24. package/jsr.json +1 -1
  25. package/lib/config.d.ts +7 -3
  26. package/lib/config.d.ts.map +1 -1
  27. package/lib/config.js +3 -3
  28. package/lib/config.js.map +1 -1
  29. package/lib/files.d.ts +5 -0
  30. package/lib/files.d.ts.map +1 -1
  31. package/lib/files.js +41 -0
  32. package/lib/files.js.map +1 -1
  33. package/lib/matchers.d.ts +3 -10
  34. package/lib/matchers.d.ts.map +1 -1
  35. package/lib/matchers.js +33 -31
  36. package/lib/matchers.js.map +1 -1
  37. package/lib/sdks.d.ts +1 -0
  38. package/lib/sdks.d.ts.map +1 -1
  39. package/lib/sdks.js +3 -3
  40. package/lib/sdks.js.map +1 -1
  41. package/lib/security.d.ts +2 -2
  42. package/lib/security.d.ts.map +1 -1
  43. package/models/components/addressattributes.d.ts +8 -8
  44. package/models/components/addressattributes.d.ts.map +1 -1
  45. package/models/components/addressattributes.js +14 -13
  46. package/models/components/addressattributes.js.map +1 -1
  47. package/models/components/badrequesterror.d.ts +24 -24
  48. package/models/components/badrequesterror.d.ts.map +1 -1
  49. package/models/components/badrequesterror.js +37 -38
  50. package/models/components/badrequesterror.js.map +1 -1
  51. package/models/components/commercialsecuredapplicationpayload.d.ts +8 -8
  52. package/models/components/commercialsecuredapplicationpayload.d.ts.map +1 -1
  53. package/models/components/commercialsecuredapplicationpayload.js +13 -14
  54. package/models/components/commercialsecuredapplicationpayload.js.map +1 -1
  55. package/models/components/commercialsecuredloancommercialapplicationrelationships.d.ts +90 -90
  56. package/models/components/commercialsecuredloancommercialapplicationrelationships.d.ts.map +1 -1
  57. package/models/components/commercialsecuredloancommercialapplicationrelationships.js +116 -118
  58. package/models/components/commercialsecuredloancommercialapplicationrelationships.js.map +1 -1
  59. package/models/components/customerattributes.d.ts +6 -0
  60. package/models/components/customerattributes.d.ts.map +1 -1
  61. package/models/components/customerattributes.js +3 -0
  62. package/models/components/customerattributes.js.map +1 -1
  63. package/models/components/forbiddenerror.d.ts +16 -16
  64. package/models/components/forbiddenerror.d.ts.map +1 -1
  65. package/models/components/forbiddenerror.js +25 -25
  66. package/models/components/forbiddenerror.js.map +1 -1
  67. package/models/components/loandetailsattributes.d.ts +8 -8
  68. package/models/components/loandetailsattributes.d.ts.map +1 -1
  69. package/models/components/loandetailsattributes.js +8 -8
  70. package/models/components/loandetailsattributes.js.map +1 -1
  71. package/models/components/supportingdocumentrelationships.d.ts +45 -45
  72. package/models/components/supportingdocumentrelationships.d.ts.map +1 -1
  73. package/models/components/supportingdocumentrelationships.js +54 -54
  74. package/models/components/supportingdocumentrelationships.js.map +1 -1
  75. package/models/components/supportingdocumentresource.d.ts +8 -8
  76. package/models/components/supportingdocumentresource.d.ts.map +1 -1
  77. package/models/components/supportingdocumentresource.js +13 -13
  78. package/models/components/supportingdocumentresource.js.map +1 -1
  79. package/models/errors/apierror.d.ts +8 -6
  80. package/models/errors/apierror.d.ts.map +1 -1
  81. package/models/errors/apierror.js +23 -10
  82. package/models/errors/apierror.js.map +1 -1
  83. package/models/errors/financeableerror.d.ts +19 -0
  84. package/models/errors/financeableerror.d.ts.map +1 -0
  85. package/models/errors/financeableerror.js +20 -0
  86. package/models/errors/financeableerror.js.map +1 -0
  87. package/models/errors/index.d.ts +1 -2
  88. package/models/errors/index.d.ts.map +1 -1
  89. package/models/errors/index.js +1 -2
  90. package/models/errors/index.js.map +1 -1
  91. package/models/errors/responsevalidationerror.d.ts +26 -0
  92. package/models/errors/responsevalidationerror.d.ts.map +1 -0
  93. package/models/errors/responsevalidationerror.js +66 -0
  94. package/models/errors/responsevalidationerror.js.map +1 -0
  95. package/models/errors/sdkvalidationerror.d.ts +1 -0
  96. package/models/errors/sdkvalidationerror.d.ts.map +1 -1
  97. package/models/errors/sdkvalidationerror.js +14 -0
  98. package/models/errors/sdkvalidationerror.js.map +1 -1
  99. package/models/operations/createapplication.d.ts +107 -30
  100. package/models/operations/createapplication.d.ts.map +1 -1
  101. package/models/operations/createapplication.js +125 -44
  102. package/models/operations/createapplication.js.map +1 -1
  103. package/models/operations/supportingdocumentscreate.d.ts +144 -0
  104. package/models/operations/supportingdocumentscreate.d.ts.map +1 -1
  105. package/models/operations/supportingdocumentscreate.js +186 -1
  106. package/models/operations/supportingdocumentscreate.js.map +1 -1
  107. package/package.json +1 -1
  108. package/sdk/applications.d.ts +1 -1
  109. package/sdk/applications.d.ts.map +1 -1
  110. package/sdk/sdk.d.ts +2 -2
  111. package/sdk/sdk.d.ts.map +1 -1
  112. package/sdk/sdk.js +3 -3
  113. package/sdk/sdk.js.map +1 -1
  114. package/sdk/supportingdocuments.d.ts +1 -1
  115. package/sdk/supportingdocuments.d.ts.map +1 -1
  116. package/src/funcs/applicationsCreate.ts +30 -40
  117. package/src/funcs/oauthTokenGet.ts +24 -20
  118. package/src/funcs/supportingDocumentsCreate.ts +31 -42
  119. package/src/hooks/types.ts +2 -0
  120. package/src/index.ts +2 -0
  121. package/src/lib/config.ts +7 -3
  122. package/src/lib/files.ts +42 -0
  123. package/src/lib/matchers.ts +44 -41
  124. package/src/lib/sdks.ts +10 -4
  125. package/src/lib/security.ts +2 -2
  126. package/src/models/components/addressattributes.ts +14 -18
  127. package/src/models/components/badrequesterror.ts +48 -44
  128. package/src/models/components/commercialsecuredapplicationpayload.ts +15 -20
  129. package/src/models/components/commercialsecuredloancommercialapplicationrelationships.ts +178 -238
  130. package/src/models/components/customerattributes.ts +12 -0
  131. package/src/models/components/forbiddenerror.ts +30 -32
  132. package/src/models/components/loandetailsattributes.ts +16 -16
  133. package/src/models/components/supportingdocumentrelationships.ts +117 -82
  134. package/src/models/components/supportingdocumentresource.ts +18 -15
  135. package/src/models/errors/apierror.ts +29 -16
  136. package/src/models/errors/financeableerror.ts +35 -0
  137. package/src/models/errors/index.ts +1 -2
  138. package/src/models/errors/responsevalidationerror.ts +50 -0
  139. package/src/models/errors/sdkvalidationerror.ts +12 -0
  140. package/src/models/operations/createapplication.ts +299 -64
  141. package/src/models/operations/supportingdocumentscreate.ts +386 -0
  142. package/src/sdk/applications.ts +1 -1
  143. package/src/sdk/sdk.ts +7 -7
  144. package/src/sdk/supportingdocuments.ts +1 -1
  145. package/src/types/constdatetime.ts +1 -1
  146. package/types/constdatetime.js +1 -1
  147. package/models/errors/createapplication.d.ts +0 -73
  148. package/models/errors/createapplication.d.ts.map +0 -1
  149. package/models/errors/createapplication.js +0 -120
  150. package/models/errors/createapplication.js.map +0 -1
  151. package/models/errors/supportingdocumentscreate.d.ts +0 -143
  152. package/models/errors/supportingdocumentscreate.d.ts.map +0 -1
  153. package/models/errors/supportingdocumentscreate.js +0 -225
  154. package/models/errors/supportingdocumentscreate.js.map +0 -1
  155. package/src/models/errors/createapplication.ts +0 -149
  156. package/src/models/errors/supportingdocumentscreate.ts +0 -342
package/FUNCTIONS.md CHANGED
@@ -20,8 +20,7 @@ specific category of applications.
20
20
 
21
21
  ```typescript
22
22
  import { FinanceableCore } from "@financeable/aggregation/core.js";
23
- import { supportingDocumentsCreate } from "@financeable/aggregation/funcs/supportingDocumentsCreate.js";
24
- import { SDKValidationError } from "@financeable/aggregation/models/errors/sdkvalidationerror.js";
23
+ import { applicationsCreate } from "@financeable/aggregation/funcs/applicationsCreate.js";
25
24
 
26
25
  // Use `FinanceableCore` for best tree-shaking performance.
27
26
  // You can create one instance of it to use across an application.
@@ -30,48 +29,166 @@ const financeable = new FinanceableCore({
30
29
  });
31
30
 
32
31
  async function run() {
33
- const res = await supportingDocumentsCreate(financeable, {
34
- mimeType: "text/csv",
35
- requestBody: {
36
- data: {
37
- type: "supporting-documents",
38
- attributes: {
39
- filename: "example.file",
40
- documentType: "BANK STATEMENT",
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
+ ],
41
151
  },
42
- relationships: {
43
- application: {
44
- data: {
45
- type: "consumer-secured-applications",
46
- id: "<id>",
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",
47
180
  },
48
181
  },
49
182
  },
50
183
  },
51
184
  },
52
185
  });
53
-
54
- switch (true) {
55
- case res.ok:
56
- // The success case will be handled outside of the switch block
57
- break;
58
- case res.error instanceof SDKValidationError:
59
- // Pretty-print validation errors.
60
- return console.log(res.error.pretty());
61
- case res.error instanceof Error:
62
- return console.log(res.error);
63
- default:
64
- // TypeScript's type checking will fail on the following line if the above
65
- // cases were not exhaustive.
66
- res.error satisfies never;
67
- throw new Error("Assertion failed: expected error checks to be exhaustive: " + res.error);
186
+ if (res.ok) {
187
+ const { value: result } = res;
188
+ console.log(result);
189
+ } else {
190
+ console.log("applicationsCreate failed:", res.error);
68
191
  }
69
-
70
-
71
- const { value: result } = res;
72
-
73
- // Handle the result
74
- console.log(result);
75
192
  }
76
193
 
77
194
  run();