@financeable/aggregation 0.8.1 → 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 (181) hide show
  1. package/FUNCTIONS.md +153 -36
  2. package/README.md +475 -94
  3. package/docs/sdks/applications/README.md +11 -17
  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/commercialsecuredloanassetattributes.d.ts +164 -18
  56. package/models/components/commercialsecuredloanassetattributes.d.ts.map +1 -1
  57. package/models/components/commercialsecuredloanassetattributes.js +163 -13
  58. package/models/components/commercialsecuredloanassetattributes.js.map +1 -1
  59. package/models/components/commercialsecuredloancommercialapplicationrelationships.d.ts +90 -90
  60. package/models/components/commercialsecuredloancommercialapplicationrelationships.d.ts.map +1 -1
  61. package/models/components/commercialsecuredloancommercialapplicationrelationships.js +116 -118
  62. package/models/components/commercialsecuredloancommercialapplicationrelationships.js.map +1 -1
  63. package/models/components/commercialsecuredloantypeofsale.d.ts +40 -0
  64. package/models/components/commercialsecuredloantypeofsale.d.ts.map +1 -0
  65. package/models/components/commercialsecuredloantypeofsale.js +64 -0
  66. package/models/components/commercialsecuredloantypeofsale.js.map +1 -0
  67. package/models/components/consumersecuredloanassetattributes.d.ts +93 -68
  68. package/models/components/consumersecuredloanassetattributes.d.ts.map +1 -1
  69. package/models/components/consumersecuredloanassetattributes.js +108 -78
  70. package/models/components/consumersecuredloanassetattributes.js.map +1 -1
  71. package/models/components/consumersecuredloantypeofsale.d.ts +40 -0
  72. package/models/components/consumersecuredloantypeofsale.d.ts.map +1 -0
  73. package/models/components/consumersecuredloantypeofsale.js +64 -0
  74. package/models/components/consumersecuredloantypeofsale.js.map +1 -0
  75. package/models/components/customerattributes.d.ts +6 -0
  76. package/models/components/customerattributes.d.ts.map +1 -1
  77. package/models/components/customerattributes.js +3 -0
  78. package/models/components/customerattributes.js.map +1 -1
  79. package/models/components/forbiddenerror.d.ts +16 -16
  80. package/models/components/forbiddenerror.d.ts.map +1 -1
  81. package/models/components/forbiddenerror.js +25 -25
  82. package/models/components/forbiddenerror.js.map +1 -1
  83. package/models/components/index.d.ts +2 -0
  84. package/models/components/index.d.ts.map +1 -1
  85. package/models/components/index.js +2 -0
  86. package/models/components/index.js.map +1 -1
  87. package/models/components/loandetailsattributes.d.ts +8 -8
  88. package/models/components/loandetailsattributes.d.ts.map +1 -1
  89. package/models/components/loandetailsattributes.js +8 -8
  90. package/models/components/loandetailsattributes.js.map +1 -1
  91. package/models/components/supportingdocumentrelationships.d.ts +45 -45
  92. package/models/components/supportingdocumentrelationships.d.ts.map +1 -1
  93. package/models/components/supportingdocumentrelationships.js +54 -54
  94. package/models/components/supportingdocumentrelationships.js.map +1 -1
  95. package/models/components/supportingdocumentresource.d.ts +8 -8
  96. package/models/components/supportingdocumentresource.d.ts.map +1 -1
  97. package/models/components/supportingdocumentresource.js +13 -13
  98. package/models/components/supportingdocumentresource.js.map +1 -1
  99. package/models/errors/apierror.d.ts +8 -6
  100. package/models/errors/apierror.d.ts.map +1 -1
  101. package/models/errors/apierror.js +23 -10
  102. package/models/errors/apierror.js.map +1 -1
  103. package/models/errors/financeableerror.d.ts +19 -0
  104. package/models/errors/financeableerror.d.ts.map +1 -0
  105. package/models/errors/financeableerror.js +20 -0
  106. package/models/errors/financeableerror.js.map +1 -0
  107. package/models/errors/index.d.ts +1 -2
  108. package/models/errors/index.d.ts.map +1 -1
  109. package/models/errors/index.js +1 -2
  110. package/models/errors/index.js.map +1 -1
  111. package/models/errors/responsevalidationerror.d.ts +26 -0
  112. package/models/errors/responsevalidationerror.d.ts.map +1 -0
  113. package/models/errors/responsevalidationerror.js +66 -0
  114. package/models/errors/responsevalidationerror.js.map +1 -0
  115. package/models/errors/sdkvalidationerror.d.ts +1 -0
  116. package/models/errors/sdkvalidationerror.d.ts.map +1 -1
  117. package/models/errors/sdkvalidationerror.js +14 -0
  118. package/models/errors/sdkvalidationerror.js.map +1 -1
  119. package/models/operations/createapplication.d.ts +107 -30
  120. package/models/operations/createapplication.d.ts.map +1 -1
  121. package/models/operations/createapplication.js +125 -44
  122. package/models/operations/createapplication.js.map +1 -1
  123. package/models/operations/supportingdocumentscreate.d.ts +144 -0
  124. package/models/operations/supportingdocumentscreate.d.ts.map +1 -1
  125. package/models/operations/supportingdocumentscreate.js +186 -1
  126. package/models/operations/supportingdocumentscreate.js.map +1 -1
  127. package/package.json +1 -1
  128. package/sdk/applications.d.ts +1 -1
  129. package/sdk/applications.d.ts.map +1 -1
  130. package/sdk/sdk.d.ts +2 -2
  131. package/sdk/sdk.d.ts.map +1 -1
  132. package/sdk/sdk.js +3 -3
  133. package/sdk/sdk.js.map +1 -1
  134. package/sdk/supportingdocuments.d.ts +1 -1
  135. package/sdk/supportingdocuments.d.ts.map +1 -1
  136. package/src/funcs/applicationsCreate.ts +30 -40
  137. package/src/funcs/oauthTokenGet.ts +24 -20
  138. package/src/funcs/supportingDocumentsCreate.ts +31 -42
  139. package/src/hooks/types.ts +2 -0
  140. package/src/index.ts +2 -0
  141. package/src/lib/config.ts +7 -3
  142. package/src/lib/files.ts +42 -0
  143. package/src/lib/matchers.ts +44 -41
  144. package/src/lib/sdks.ts +10 -4
  145. package/src/lib/security.ts +2 -2
  146. package/src/models/components/addressattributes.ts +14 -18
  147. package/src/models/components/badrequesterror.ts +48 -44
  148. package/src/models/components/commercialsecuredapplicationpayload.ts +15 -20
  149. package/src/models/components/commercialsecuredloanassetattributes.ts +347 -30
  150. package/src/models/components/commercialsecuredloancommercialapplicationrelationships.ts +178 -238
  151. package/src/models/components/commercialsecuredloantypeofsale.ts +39 -0
  152. package/src/models/components/consumersecuredloanassetattributes.ts +318 -131
  153. package/src/models/components/consumersecuredloantypeofsale.ts +39 -0
  154. package/src/models/components/customerattributes.ts +12 -0
  155. package/src/models/components/forbiddenerror.ts +30 -32
  156. package/src/models/components/index.ts +2 -0
  157. package/src/models/components/loandetailsattributes.ts +16 -16
  158. package/src/models/components/supportingdocumentrelationships.ts +117 -82
  159. package/src/models/components/supportingdocumentresource.ts +18 -15
  160. package/src/models/errors/apierror.ts +29 -16
  161. package/src/models/errors/financeableerror.ts +35 -0
  162. package/src/models/errors/index.ts +1 -2
  163. package/src/models/errors/responsevalidationerror.ts +50 -0
  164. package/src/models/errors/sdkvalidationerror.ts +12 -0
  165. package/src/models/operations/createapplication.ts +299 -64
  166. package/src/models/operations/supportingdocumentscreate.ts +386 -0
  167. package/src/sdk/applications.ts +1 -1
  168. package/src/sdk/sdk.ts +7 -7
  169. package/src/sdk/supportingdocuments.ts +1 -1
  170. package/src/types/constdatetime.ts +1 -1
  171. package/types/constdatetime.js +1 -1
  172. package/models/errors/createapplication.d.ts +0 -73
  173. package/models/errors/createapplication.d.ts.map +0 -1
  174. package/models/errors/createapplication.js +0 -120
  175. package/models/errors/createapplication.js.map +0 -1
  176. package/models/errors/supportingdocumentscreate.d.ts +0 -143
  177. package/models/errors/supportingdocumentscreate.d.ts.map +0 -1
  178. package/models/errors/supportingdocumentscreate.js +0 -225
  179. package/models/errors/supportingdocumentscreate.js.map +0 -1
  180. package/src/models/errors/createapplication.ts +0 -149
  181. package/src/models/errors/supportingdocumentscreate.ts +0 -342
@@ -21,7 +21,7 @@ export type SupportingDocumentRelationshipsType = ClosedEnum<
21
21
  typeof SupportingDocumentRelationshipsType
22
22
  >;
23
23
 
24
- export type Data = {
24
+ export type SupportingDocumentRelationshipsData = {
25
25
  type: SupportingDocumentRelationshipsType;
26
26
  id: string;
27
27
  };
@@ -30,7 +30,7 @@ export type Data = {
30
30
  * Reference to the ID of the customer record this support document relates to.
31
31
  */
32
32
  export type Customer = {
33
- data: Data;
33
+ data: SupportingDocumentRelationshipsData;
34
34
  links?: { [k: string]: LinkObject } | undefined;
35
35
  meta?: { [k: string]: any } | undefined;
36
36
  };
@@ -42,7 +42,7 @@ export type SupportingDocumentRelationshipsAssetType = ClosedEnum<
42
42
  typeof SupportingDocumentRelationshipsAssetType
43
43
  >;
44
44
 
45
- export type SupportingDocumentRelationshipsData = {
45
+ export type SupportingDocumentRelationshipsAssetData = {
46
46
  type: SupportingDocumentRelationshipsAssetType;
47
47
  id: string;
48
48
  };
@@ -50,8 +50,8 @@ export type SupportingDocumentRelationshipsData = {
50
50
  /**
51
51
  * Reference to the ID of the asset record this support document relates to.
52
52
  */
53
- export type Asset = {
54
- data: SupportingDocumentRelationshipsData;
53
+ export type SupportingDocumentRelationshipsAsset = {
54
+ data: SupportingDocumentRelationshipsAssetData;
55
55
  links?: { [k: string]: LinkObject } | undefined;
56
56
  meta?: { [k: string]: any } | undefined;
57
57
  };
@@ -111,7 +111,7 @@ export type SupportingDocumentRelationships = {
111
111
  /**
112
112
  * Reference to the ID of the asset record this support document relates to.
113
113
  */
114
- asset?: Asset | undefined;
114
+ asset?: SupportingDocumentRelationshipsAsset | undefined;
115
115
  /**
116
116
  * Reference to the ID of the entity record this support document relates to. One of: customer,asset or entity relationship must be provided.
117
117
  */
@@ -146,49 +146,64 @@ export namespace SupportingDocumentRelationshipsType$ {
146
146
  }
147
147
 
148
148
  /** @internal */
149
- export const Data$inboundSchema: z.ZodType<Data, z.ZodTypeDef, unknown> = z
150
- .object({
151
- type: SupportingDocumentRelationshipsType$inboundSchema,
152
- id: z.string(),
153
- });
149
+ export const SupportingDocumentRelationshipsData$inboundSchema: z.ZodType<
150
+ SupportingDocumentRelationshipsData,
151
+ z.ZodTypeDef,
152
+ unknown
153
+ > = z.object({
154
+ type: SupportingDocumentRelationshipsType$inboundSchema,
155
+ id: z.string(),
156
+ });
154
157
 
155
158
  /** @internal */
156
- export type Data$Outbound = {
159
+ export type SupportingDocumentRelationshipsData$Outbound = {
157
160
  type: string;
158
161
  id: string;
159
162
  };
160
163
 
161
164
  /** @internal */
162
- export const Data$outboundSchema: z.ZodType<Data$Outbound, z.ZodTypeDef, Data> =
163
- z.object({
164
- type: SupportingDocumentRelationshipsType$outboundSchema,
165
- id: z.string(),
166
- });
165
+ export const SupportingDocumentRelationshipsData$outboundSchema: z.ZodType<
166
+ SupportingDocumentRelationshipsData$Outbound,
167
+ z.ZodTypeDef,
168
+ SupportingDocumentRelationshipsData
169
+ > = z.object({
170
+ type: SupportingDocumentRelationshipsType$outboundSchema,
171
+ id: z.string(),
172
+ });
167
173
 
168
174
  /**
169
175
  * @internal
170
176
  * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
171
177
  */
172
- export namespace Data$ {
173
- /** @deprecated use `Data$inboundSchema` instead. */
174
- export const inboundSchema = Data$inboundSchema;
175
- /** @deprecated use `Data$outboundSchema` instead. */
176
- export const outboundSchema = Data$outboundSchema;
177
- /** @deprecated use `Data$Outbound` instead. */
178
- export type Outbound = Data$Outbound;
178
+ export namespace SupportingDocumentRelationshipsData$ {
179
+ /** @deprecated use `SupportingDocumentRelationshipsData$inboundSchema` instead. */
180
+ export const inboundSchema =
181
+ SupportingDocumentRelationshipsData$inboundSchema;
182
+ /** @deprecated use `SupportingDocumentRelationshipsData$outboundSchema` instead. */
183
+ export const outboundSchema =
184
+ SupportingDocumentRelationshipsData$outboundSchema;
185
+ /** @deprecated use `SupportingDocumentRelationshipsData$Outbound` instead. */
186
+ export type Outbound = SupportingDocumentRelationshipsData$Outbound;
179
187
  }
180
188
 
181
- export function dataToJSON(data: Data): string {
182
- return JSON.stringify(Data$outboundSchema.parse(data));
189
+ export function supportingDocumentRelationshipsDataToJSON(
190
+ supportingDocumentRelationshipsData: SupportingDocumentRelationshipsData,
191
+ ): string {
192
+ return JSON.stringify(
193
+ SupportingDocumentRelationshipsData$outboundSchema.parse(
194
+ supportingDocumentRelationshipsData,
195
+ ),
196
+ );
183
197
  }
184
198
 
185
- export function dataFromJSON(
199
+ export function supportingDocumentRelationshipsDataFromJSON(
186
200
  jsonString: string,
187
- ): SafeParseResult<Data, SDKValidationError> {
201
+ ): SafeParseResult<SupportingDocumentRelationshipsData, SDKValidationError> {
188
202
  return safeParse(
189
203
  jsonString,
190
- (x) => Data$inboundSchema.parse(JSON.parse(x)),
191
- `Failed to parse 'Data' from JSON`,
204
+ (x) =>
205
+ SupportingDocumentRelationshipsData$inboundSchema.parse(JSON.parse(x)),
206
+ `Failed to parse 'SupportingDocumentRelationshipsData' from JSON`,
192
207
  );
193
208
  }
194
209
 
@@ -198,14 +213,14 @@ export const Customer$inboundSchema: z.ZodType<
198
213
  z.ZodTypeDef,
199
214
  unknown
200
215
  > = z.object({
201
- data: z.lazy(() => Data$inboundSchema),
216
+ data: z.lazy(() => SupportingDocumentRelationshipsData$inboundSchema),
202
217
  links: z.record(LinkObject$inboundSchema).optional(),
203
218
  meta: z.record(z.any()).optional(),
204
219
  });
205
220
 
206
221
  /** @internal */
207
222
  export type Customer$Outbound = {
208
- data: Data$Outbound;
223
+ data: SupportingDocumentRelationshipsData$Outbound;
209
224
  links?: { [k: string]: LinkObject$Outbound } | undefined;
210
225
  meta?: { [k: string]: any } | undefined;
211
226
  };
@@ -216,7 +231,7 @@ export const Customer$outboundSchema: z.ZodType<
216
231
  z.ZodTypeDef,
217
232
  Customer
218
233
  > = z.object({
219
- data: z.lazy(() => Data$outboundSchema),
234
+ data: z.lazy(() => SupportingDocumentRelationshipsData$outboundSchema),
220
235
  links: z.record(LinkObject$outboundSchema).optional(),
221
236
  meta: z.record(z.any()).optional(),
222
237
  });
@@ -272,8 +287,8 @@ export namespace SupportingDocumentRelationshipsAssetType$ {
272
287
  }
273
288
 
274
289
  /** @internal */
275
- export const SupportingDocumentRelationshipsData$inboundSchema: z.ZodType<
276
- SupportingDocumentRelationshipsData,
290
+ export const SupportingDocumentRelationshipsAssetData$inboundSchema: z.ZodType<
291
+ SupportingDocumentRelationshipsAssetData,
277
292
  z.ZodTypeDef,
278
293
  unknown
279
294
  > = z.object({
@@ -282,16 +297,16 @@ export const SupportingDocumentRelationshipsData$inboundSchema: z.ZodType<
282
297
  });
283
298
 
284
299
  /** @internal */
285
- export type SupportingDocumentRelationshipsData$Outbound = {
300
+ export type SupportingDocumentRelationshipsAssetData$Outbound = {
286
301
  type: string;
287
302
  id: string;
288
303
  };
289
304
 
290
305
  /** @internal */
291
- export const SupportingDocumentRelationshipsData$outboundSchema: z.ZodType<
292
- SupportingDocumentRelationshipsData$Outbound,
306
+ export const SupportingDocumentRelationshipsAssetData$outboundSchema: z.ZodType<
307
+ SupportingDocumentRelationshipsAssetData$Outbound,
293
308
  z.ZodTypeDef,
294
- SupportingDocumentRelationshipsData
309
+ SupportingDocumentRelationshipsAssetData
295
310
  > = z.object({
296
311
  type: SupportingDocumentRelationshipsAssetType$outboundSchema,
297
312
  id: z.string(),
@@ -301,60 +316,69 @@ export const SupportingDocumentRelationshipsData$outboundSchema: z.ZodType<
301
316
  * @internal
302
317
  * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
303
318
  */
304
- export namespace SupportingDocumentRelationshipsData$ {
305
- /** @deprecated use `SupportingDocumentRelationshipsData$inboundSchema` instead. */
319
+ export namespace SupportingDocumentRelationshipsAssetData$ {
320
+ /** @deprecated use `SupportingDocumentRelationshipsAssetData$inboundSchema` instead. */
306
321
  export const inboundSchema =
307
- SupportingDocumentRelationshipsData$inboundSchema;
308
- /** @deprecated use `SupportingDocumentRelationshipsData$outboundSchema` instead. */
322
+ SupportingDocumentRelationshipsAssetData$inboundSchema;
323
+ /** @deprecated use `SupportingDocumentRelationshipsAssetData$outboundSchema` instead. */
309
324
  export const outboundSchema =
310
- SupportingDocumentRelationshipsData$outboundSchema;
311
- /** @deprecated use `SupportingDocumentRelationshipsData$Outbound` instead. */
312
- export type Outbound = SupportingDocumentRelationshipsData$Outbound;
325
+ SupportingDocumentRelationshipsAssetData$outboundSchema;
326
+ /** @deprecated use `SupportingDocumentRelationshipsAssetData$Outbound` instead. */
327
+ export type Outbound = SupportingDocumentRelationshipsAssetData$Outbound;
313
328
  }
314
329
 
315
- export function supportingDocumentRelationshipsDataToJSON(
316
- supportingDocumentRelationshipsData: SupportingDocumentRelationshipsData,
330
+ export function supportingDocumentRelationshipsAssetDataToJSON(
331
+ supportingDocumentRelationshipsAssetData:
332
+ SupportingDocumentRelationshipsAssetData,
317
333
  ): string {
318
334
  return JSON.stringify(
319
- SupportingDocumentRelationshipsData$outboundSchema.parse(
320
- supportingDocumentRelationshipsData,
335
+ SupportingDocumentRelationshipsAssetData$outboundSchema.parse(
336
+ supportingDocumentRelationshipsAssetData,
321
337
  ),
322
338
  );
323
339
  }
324
340
 
325
- export function supportingDocumentRelationshipsDataFromJSON(
341
+ export function supportingDocumentRelationshipsAssetDataFromJSON(
326
342
  jsonString: string,
327
- ): SafeParseResult<SupportingDocumentRelationshipsData, SDKValidationError> {
343
+ ): SafeParseResult<
344
+ SupportingDocumentRelationshipsAssetData,
345
+ SDKValidationError
346
+ > {
328
347
  return safeParse(
329
348
  jsonString,
330
349
  (x) =>
331
- SupportingDocumentRelationshipsData$inboundSchema.parse(JSON.parse(x)),
332
- `Failed to parse 'SupportingDocumentRelationshipsData' from JSON`,
350
+ SupportingDocumentRelationshipsAssetData$inboundSchema.parse(
351
+ JSON.parse(x),
352
+ ),
353
+ `Failed to parse 'SupportingDocumentRelationshipsAssetData' from JSON`,
333
354
  );
334
355
  }
335
356
 
336
357
  /** @internal */
337
- export const Asset$inboundSchema: z.ZodType<Asset, z.ZodTypeDef, unknown> = z
338
- .object({
339
- data: z.lazy(() => SupportingDocumentRelationshipsData$inboundSchema),
340
- links: z.record(LinkObject$inboundSchema).optional(),
341
- meta: z.record(z.any()).optional(),
342
- });
358
+ export const SupportingDocumentRelationshipsAsset$inboundSchema: z.ZodType<
359
+ SupportingDocumentRelationshipsAsset,
360
+ z.ZodTypeDef,
361
+ unknown
362
+ > = z.object({
363
+ data: z.lazy(() => SupportingDocumentRelationshipsAssetData$inboundSchema),
364
+ links: z.record(LinkObject$inboundSchema).optional(),
365
+ meta: z.record(z.any()).optional(),
366
+ });
343
367
 
344
368
  /** @internal */
345
- export type Asset$Outbound = {
346
- data: SupportingDocumentRelationshipsData$Outbound;
369
+ export type SupportingDocumentRelationshipsAsset$Outbound = {
370
+ data: SupportingDocumentRelationshipsAssetData$Outbound;
347
371
  links?: { [k: string]: LinkObject$Outbound } | undefined;
348
372
  meta?: { [k: string]: any } | undefined;
349
373
  };
350
374
 
351
375
  /** @internal */
352
- export const Asset$outboundSchema: z.ZodType<
353
- Asset$Outbound,
376
+ export const SupportingDocumentRelationshipsAsset$outboundSchema: z.ZodType<
377
+ SupportingDocumentRelationshipsAsset$Outbound,
354
378
  z.ZodTypeDef,
355
- Asset
379
+ SupportingDocumentRelationshipsAsset
356
380
  > = z.object({
357
- data: z.lazy(() => SupportingDocumentRelationshipsData$outboundSchema),
381
+ data: z.lazy(() => SupportingDocumentRelationshipsAssetData$outboundSchema),
358
382
  links: z.record(LinkObject$outboundSchema).optional(),
359
383
  meta: z.record(z.any()).optional(),
360
384
  });
@@ -363,26 +387,35 @@ export const Asset$outboundSchema: z.ZodType<
363
387
  * @internal
364
388
  * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
365
389
  */
366
- export namespace Asset$ {
367
- /** @deprecated use `Asset$inboundSchema` instead. */
368
- export const inboundSchema = Asset$inboundSchema;
369
- /** @deprecated use `Asset$outboundSchema` instead. */
370
- export const outboundSchema = Asset$outboundSchema;
371
- /** @deprecated use `Asset$Outbound` instead. */
372
- export type Outbound = Asset$Outbound;
390
+ export namespace SupportingDocumentRelationshipsAsset$ {
391
+ /** @deprecated use `SupportingDocumentRelationshipsAsset$inboundSchema` instead. */
392
+ export const inboundSchema =
393
+ SupportingDocumentRelationshipsAsset$inboundSchema;
394
+ /** @deprecated use `SupportingDocumentRelationshipsAsset$outboundSchema` instead. */
395
+ export const outboundSchema =
396
+ SupportingDocumentRelationshipsAsset$outboundSchema;
397
+ /** @deprecated use `SupportingDocumentRelationshipsAsset$Outbound` instead. */
398
+ export type Outbound = SupportingDocumentRelationshipsAsset$Outbound;
373
399
  }
374
400
 
375
- export function assetToJSON(asset: Asset): string {
376
- return JSON.stringify(Asset$outboundSchema.parse(asset));
401
+ export function supportingDocumentRelationshipsAssetToJSON(
402
+ supportingDocumentRelationshipsAsset: SupportingDocumentRelationshipsAsset,
403
+ ): string {
404
+ return JSON.stringify(
405
+ SupportingDocumentRelationshipsAsset$outboundSchema.parse(
406
+ supportingDocumentRelationshipsAsset,
407
+ ),
408
+ );
377
409
  }
378
410
 
379
- export function assetFromJSON(
411
+ export function supportingDocumentRelationshipsAssetFromJSON(
380
412
  jsonString: string,
381
- ): SafeParseResult<Asset, SDKValidationError> {
413
+ ): SafeParseResult<SupportingDocumentRelationshipsAsset, SDKValidationError> {
382
414
  return safeParse(
383
415
  jsonString,
384
- (x) => Asset$inboundSchema.parse(JSON.parse(x)),
385
- `Failed to parse 'Asset' from JSON`,
416
+ (x) =>
417
+ SupportingDocumentRelationshipsAsset$inboundSchema.parse(JSON.parse(x)),
418
+ `Failed to parse 'SupportingDocumentRelationshipsAsset' from JSON`,
386
419
  );
387
420
  }
388
421
 
@@ -769,7 +802,8 @@ export const SupportingDocumentRelationships$inboundSchema: z.ZodType<
769
802
  unknown
770
803
  > = z.object({
771
804
  customer: z.lazy(() => Customer$inboundSchema).optional(),
772
- asset: z.lazy(() => Asset$inboundSchema).optional(),
805
+ asset: z.lazy(() => SupportingDocumentRelationshipsAsset$inboundSchema)
806
+ .optional(),
773
807
  entity: z.lazy(() => Entity$inboundSchema).optional(),
774
808
  application: z.lazy(() => Application$inboundSchema),
775
809
  });
@@ -777,7 +811,7 @@ export const SupportingDocumentRelationships$inboundSchema: z.ZodType<
777
811
  /** @internal */
778
812
  export type SupportingDocumentRelationships$Outbound = {
779
813
  customer?: Customer$Outbound | undefined;
780
- asset?: Asset$Outbound | undefined;
814
+ asset?: SupportingDocumentRelationshipsAsset$Outbound | undefined;
781
815
  entity?: Entity$Outbound | undefined;
782
816
  application: Application$Outbound;
783
817
  };
@@ -789,7 +823,8 @@ export const SupportingDocumentRelationships$outboundSchema: z.ZodType<
789
823
  SupportingDocumentRelationships
790
824
  > = z.object({
791
825
  customer: z.lazy(() => Customer$outboundSchema).optional(),
792
- asset: z.lazy(() => Asset$outboundSchema).optional(),
826
+ asset: z.lazy(() => SupportingDocumentRelationshipsAsset$outboundSchema)
827
+ .optional(),
793
828
  entity: z.lazy(() => Entity$outboundSchema).optional(),
794
829
  application: z.lazy(() => Application$outboundSchema),
795
830
  });
@@ -26,13 +26,15 @@ import {
26
26
  SupportingDocumentRelationships$outboundSchema,
27
27
  } from "./supportingdocumentrelationships.js";
28
28
 
29
- export const Type = {
29
+ export const SupportingDocumentResourceType = {
30
30
  SupportingDocuments: "supporting-documents",
31
31
  } as const;
32
- export type Type = ClosedEnum<typeof Type>;
32
+ export type SupportingDocumentResourceType = ClosedEnum<
33
+ typeof SupportingDocumentResourceType
34
+ >;
33
35
 
34
36
  export type SupportingDocumentResource = {
35
- type: Type;
37
+ type: SupportingDocumentResourceType;
36
38
  attributes: SupportingDocumentAttributesInput;
37
39
  relationships: SupportingDocumentRelationships;
38
40
  links?: { [k: string]: LinkObject } | undefined;
@@ -40,23 +42,24 @@ export type SupportingDocumentResource = {
40
42
  };
41
43
 
42
44
  /** @internal */
43
- export const Type$inboundSchema: z.ZodNativeEnum<typeof Type> = z.nativeEnum(
44
- Type,
45
- );
45
+ export const SupportingDocumentResourceType$inboundSchema: z.ZodNativeEnum<
46
+ typeof SupportingDocumentResourceType
47
+ > = z.nativeEnum(SupportingDocumentResourceType);
46
48
 
47
49
  /** @internal */
48
- export const Type$outboundSchema: z.ZodNativeEnum<typeof Type> =
49
- Type$inboundSchema;
50
+ export const SupportingDocumentResourceType$outboundSchema: z.ZodNativeEnum<
51
+ typeof SupportingDocumentResourceType
52
+ > = SupportingDocumentResourceType$inboundSchema;
50
53
 
51
54
  /**
52
55
  * @internal
53
56
  * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
54
57
  */
55
- export namespace Type$ {
56
- /** @deprecated use `Type$inboundSchema` instead. */
57
- export const inboundSchema = Type$inboundSchema;
58
- /** @deprecated use `Type$outboundSchema` instead. */
59
- export const outboundSchema = Type$outboundSchema;
58
+ export namespace SupportingDocumentResourceType$ {
59
+ /** @deprecated use `SupportingDocumentResourceType$inboundSchema` instead. */
60
+ export const inboundSchema = SupportingDocumentResourceType$inboundSchema;
61
+ /** @deprecated use `SupportingDocumentResourceType$outboundSchema` instead. */
62
+ export const outboundSchema = SupportingDocumentResourceType$outboundSchema;
60
63
  }
61
64
 
62
65
  /** @internal */
@@ -65,7 +68,7 @@ export const SupportingDocumentResource$inboundSchema: z.ZodType<
65
68
  z.ZodTypeDef,
66
69
  unknown
67
70
  > = z.object({
68
- type: Type$inboundSchema,
71
+ type: SupportingDocumentResourceType$inboundSchema,
69
72
  attributes: SupportingDocumentAttributesInput$inboundSchema,
70
73
  relationships: SupportingDocumentRelationships$inboundSchema,
71
74
  links: z.record(LinkObject$inboundSchema).optional(),
@@ -87,7 +90,7 @@ export const SupportingDocumentResource$outboundSchema: z.ZodType<
87
90
  z.ZodTypeDef,
88
91
  SupportingDocumentResource
89
92
  > = z.object({
90
- type: Type$outboundSchema,
93
+ type: SupportingDocumentResourceType$outboundSchema,
91
94
  attributes: SupportingDocumentAttributesInput$outboundSchema,
92
95
  relationships: SupportingDocumentRelationships$outboundSchema,
93
96
  links: z.record(LinkObject$outboundSchema).optional(),
@@ -2,26 +2,39 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
- export class APIError extends Error {
6
- public readonly statusCode: number;
7
- public readonly contentType: string;
5
+ import { FinanceableError } from "./financeableerror.js";
8
6
 
7
+ /** The fallback error class if no more specific error class is matched */
8
+ export class APIError extends FinanceableError {
9
9
  constructor(
10
10
  message: string,
11
- public readonly rawResponse: Response,
12
- public readonly body: string = "",
11
+ httpMeta: {
12
+ response: Response;
13
+ request: Request;
14
+ body: string;
15
+ },
13
16
  ) {
14
- const statusCode = rawResponse.status;
15
- const contentType = rawResponse.headers.get("content-type") || "";
16
- const bodyString = body.length > 0 ? `\n${body}` : "";
17
-
18
- super(
19
- `${message}: Status ${statusCode} Content-Type ${contentType} Body ${bodyString}`,
20
- );
21
-
22
- this.statusCode = statusCode;
23
- this.contentType = contentType;
24
-
17
+ if (message) {
18
+ message += `: `;
19
+ }
20
+ message += `Status ${httpMeta.response.status}`;
21
+ const contentType = httpMeta.response.headers.get("content-type") || `""`;
22
+ if (contentType !== "application/json") {
23
+ message += ` Content-Type ${
24
+ contentType.includes(" ") ? `"${contentType}"` : contentType
25
+ }`;
26
+ }
27
+ const body = httpMeta.body || `""`;
28
+ message += body.length > 100 ? "\n" : ". ";
29
+ let bodyDisplay = body;
30
+ if (body.length > 10000) {
31
+ const truncated = body.substring(0, 10000);
32
+ const remaining = body.length - 10000;
33
+ bodyDisplay = `${truncated}...and ${remaining} more chars`;
34
+ }
35
+ message += `Body: ${bodyDisplay}`;
36
+ message = message.trim();
37
+ super(message, httpMeta);
25
38
  this.name = "APIError";
26
39
  }
27
40
  }
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ /** The base class for all HTTP error responses */
6
+ export class FinanceableError extends Error {
7
+ /** HTTP status code */
8
+ public readonly statusCode: number;
9
+ /** HTTP body */
10
+ public readonly body: string;
11
+ /** HTTP headers */
12
+ public readonly headers: Headers;
13
+ /** HTTP content type */
14
+ public readonly contentType: string;
15
+ /** Raw response */
16
+ public readonly rawResponse: Response;
17
+
18
+ constructor(
19
+ message: string,
20
+ httpMeta: {
21
+ response: Response;
22
+ request: Request;
23
+ body: string;
24
+ },
25
+ ) {
26
+ super(message);
27
+ this.statusCode = httpMeta.response.status;
28
+ this.body = httpMeta.body;
29
+ this.headers = httpMeta.response.headers;
30
+ this.contentType = httpMeta.response.headers.get("content-type") || "";
31
+ this.rawResponse = httpMeta.response;
32
+
33
+ this.name = "FinanceableError";
34
+ }
35
+ }
@@ -3,7 +3,6 @@
3
3
  */
4
4
 
5
5
  export * from "./apierror.js";
6
- export * from "./createapplication.js";
7
6
  export * from "./httpclienterrors.js";
7
+ export * from "./responsevalidationerror.js";
8
8
  export * from "./sdkvalidationerror.js";
9
- export * from "./supportingdocumentscreate.js";
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { FinanceableError } from "./financeableerror.js";
7
+ import { formatZodError } from "./sdkvalidationerror.js";
8
+
9
+ export class ResponseValidationError extends FinanceableError {
10
+ /**
11
+ * The raw value that failed validation.
12
+ */
13
+ public readonly rawValue: unknown;
14
+
15
+ /**
16
+ * The raw message that failed validation.
17
+ */
18
+ public readonly rawMessage: unknown;
19
+
20
+ constructor(
21
+ message: string,
22
+ extra: {
23
+ response: Response;
24
+ request: Request;
25
+ body: string;
26
+ cause: unknown;
27
+ rawValue: unknown;
28
+ rawMessage: unknown;
29
+ },
30
+ ) {
31
+ super(message, extra);
32
+ this.name = "ResponseValidationError";
33
+ this.cause = extra.cause;
34
+ this.rawValue = extra.rawValue;
35
+ this.rawMessage = extra.rawMessage;
36
+ }
37
+
38
+ /**
39
+ * Return a pretty-formatted error message if the underlying validation error
40
+ * is a ZodError or some other recognized error type, otherwise return the
41
+ * default error message.
42
+ */
43
+ public pretty(): string {
44
+ if (this.cause instanceof z.ZodError) {
45
+ return `${this.rawMessage}\n${formatZodError(this.cause)}`;
46
+ } else {
47
+ return this.toString();
48
+ }
49
+ }
50
+ }
@@ -15,6 +15,18 @@ export class SDKValidationError extends Error {
15
15
  */
16
16
  public readonly rawMessage: unknown;
17
17
 
18
+ // Allows for backwards compatibility for `instanceof` checks of `ResponseValidationError`
19
+ static override [Symbol.hasInstance](
20
+ instance: unknown,
21
+ ): instance is SDKValidationError {
22
+ if (!(instance instanceof Error)) return false;
23
+ if (!("rawValue" in instance)) return false;
24
+ if (!("rawMessage" in instance)) return false;
25
+ if (!("pretty" in instance)) return false;
26
+ if (typeof instance.pretty !== "function") return false;
27
+ return true;
28
+ }
29
+
18
30
  constructor(message: string, cause: unknown, rawValue: unknown) {
19
31
  super(`${message}: ${cause}`);
20
32
  this.name = "SDKValidationError";