@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.
- package/FUNCTIONS.md +153 -36
- package/README.md +475 -94
- package/docs/sdks/applications/README.md +9 -15
- package/docs/sdks/oauthtoken/README.md +5 -9
- package/docs/sdks/supportingdocuments/README.md +9 -16
- package/funcs/applicationsCreate.d.ts +3 -3
- package/funcs/applicationsCreate.d.ts.map +1 -1
- package/funcs/applicationsCreate.js +4 -6
- package/funcs/applicationsCreate.js.map +1 -1
- package/funcs/oauthTokenGet.d.ts +3 -2
- package/funcs/oauthTokenGet.d.ts.map +1 -1
- package/funcs/oauthTokenGet.js +4 -2
- package/funcs/oauthTokenGet.js.map +1 -1
- package/funcs/supportingDocumentsCreate.d.ts +3 -3
- package/funcs/supportingDocumentsCreate.d.ts.map +1 -1
- package/funcs/supportingDocumentsCreate.js +5 -8
- package/funcs/supportingDocumentsCreate.js.map +1 -1
- package/hooks/types.d.ts +2 -0
- package/hooks/types.d.ts.map +1 -1
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +7 -3
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +3 -3
- package/lib/config.js.map +1 -1
- package/lib/files.d.ts +5 -0
- package/lib/files.d.ts.map +1 -1
- package/lib/files.js +41 -0
- package/lib/files.js.map +1 -1
- package/lib/matchers.d.ts +3 -10
- package/lib/matchers.d.ts.map +1 -1
- package/lib/matchers.js +33 -31
- package/lib/matchers.js.map +1 -1
- package/lib/sdks.d.ts +1 -0
- package/lib/sdks.d.ts.map +1 -1
- package/lib/sdks.js +3 -3
- package/lib/sdks.js.map +1 -1
- package/lib/security.d.ts +2 -2
- package/lib/security.d.ts.map +1 -1
- package/models/components/addressattributes.d.ts +8 -8
- package/models/components/addressattributes.d.ts.map +1 -1
- package/models/components/addressattributes.js +14 -13
- package/models/components/addressattributes.js.map +1 -1
- package/models/components/badrequesterror.d.ts +24 -24
- package/models/components/badrequesterror.d.ts.map +1 -1
- package/models/components/badrequesterror.js +37 -38
- package/models/components/badrequesterror.js.map +1 -1
- package/models/components/commercialsecuredapplicationpayload.d.ts +8 -8
- package/models/components/commercialsecuredapplicationpayload.d.ts.map +1 -1
- package/models/components/commercialsecuredapplicationpayload.js +13 -14
- package/models/components/commercialsecuredapplicationpayload.js.map +1 -1
- package/models/components/commercialsecuredloancommercialapplicationrelationships.d.ts +90 -90
- package/models/components/commercialsecuredloancommercialapplicationrelationships.d.ts.map +1 -1
- package/models/components/commercialsecuredloancommercialapplicationrelationships.js +116 -118
- package/models/components/commercialsecuredloancommercialapplicationrelationships.js.map +1 -1
- package/models/components/customerattributes.d.ts +6 -0
- package/models/components/customerattributes.d.ts.map +1 -1
- package/models/components/customerattributes.js +3 -0
- package/models/components/customerattributes.js.map +1 -1
- package/models/components/forbiddenerror.d.ts +16 -16
- package/models/components/forbiddenerror.d.ts.map +1 -1
- package/models/components/forbiddenerror.js +25 -25
- package/models/components/forbiddenerror.js.map +1 -1
- package/models/components/loandetailsattributes.d.ts +8 -8
- package/models/components/loandetailsattributes.d.ts.map +1 -1
- package/models/components/loandetailsattributes.js +8 -8
- package/models/components/loandetailsattributes.js.map +1 -1
- package/models/components/supportingdocumentrelationships.d.ts +45 -45
- package/models/components/supportingdocumentrelationships.d.ts.map +1 -1
- package/models/components/supportingdocumentrelationships.js +54 -54
- package/models/components/supportingdocumentrelationships.js.map +1 -1
- package/models/components/supportingdocumentresource.d.ts +8 -8
- package/models/components/supportingdocumentresource.d.ts.map +1 -1
- package/models/components/supportingdocumentresource.js +13 -13
- package/models/components/supportingdocumentresource.js.map +1 -1
- package/models/errors/apierror.d.ts +8 -6
- package/models/errors/apierror.d.ts.map +1 -1
- package/models/errors/apierror.js +23 -10
- package/models/errors/apierror.js.map +1 -1
- package/models/errors/financeableerror.d.ts +19 -0
- package/models/errors/financeableerror.d.ts.map +1 -0
- package/models/errors/financeableerror.js +20 -0
- package/models/errors/financeableerror.js.map +1 -0
- package/models/errors/index.d.ts +1 -2
- package/models/errors/index.d.ts.map +1 -1
- package/models/errors/index.js +1 -2
- package/models/errors/index.js.map +1 -1
- package/models/errors/responsevalidationerror.d.ts +26 -0
- package/models/errors/responsevalidationerror.d.ts.map +1 -0
- package/models/errors/responsevalidationerror.js +66 -0
- package/models/errors/responsevalidationerror.js.map +1 -0
- package/models/errors/sdkvalidationerror.d.ts +1 -0
- package/models/errors/sdkvalidationerror.d.ts.map +1 -1
- package/models/errors/sdkvalidationerror.js +14 -0
- package/models/errors/sdkvalidationerror.js.map +1 -1
- package/models/operations/createapplication.d.ts +107 -30
- package/models/operations/createapplication.d.ts.map +1 -1
- package/models/operations/createapplication.js +125 -44
- package/models/operations/createapplication.js.map +1 -1
- package/models/operations/supportingdocumentscreate.d.ts +144 -0
- package/models/operations/supportingdocumentscreate.d.ts.map +1 -1
- package/models/operations/supportingdocumentscreate.js +186 -1
- package/models/operations/supportingdocumentscreate.js.map +1 -1
- package/package.json +1 -1
- package/sdk/applications.d.ts +1 -1
- package/sdk/applications.d.ts.map +1 -1
- package/sdk/sdk.d.ts +2 -2
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +3 -3
- package/sdk/sdk.js.map +1 -1
- package/sdk/supportingdocuments.d.ts +1 -1
- package/sdk/supportingdocuments.d.ts.map +1 -1
- package/src/funcs/applicationsCreate.ts +30 -40
- package/src/funcs/oauthTokenGet.ts +24 -20
- package/src/funcs/supportingDocumentsCreate.ts +31 -42
- package/src/hooks/types.ts +2 -0
- package/src/index.ts +2 -0
- package/src/lib/config.ts +7 -3
- package/src/lib/files.ts +42 -0
- package/src/lib/matchers.ts +44 -41
- package/src/lib/sdks.ts +10 -4
- package/src/lib/security.ts +2 -2
- package/src/models/components/addressattributes.ts +14 -18
- package/src/models/components/badrequesterror.ts +48 -44
- package/src/models/components/commercialsecuredapplicationpayload.ts +15 -20
- package/src/models/components/commercialsecuredloancommercialapplicationrelationships.ts +178 -238
- package/src/models/components/customerattributes.ts +12 -0
- package/src/models/components/forbiddenerror.ts +30 -32
- package/src/models/components/loandetailsattributes.ts +16 -16
- package/src/models/components/supportingdocumentrelationships.ts +117 -82
- package/src/models/components/supportingdocumentresource.ts +18 -15
- package/src/models/errors/apierror.ts +29 -16
- package/src/models/errors/financeableerror.ts +35 -0
- package/src/models/errors/index.ts +1 -2
- package/src/models/errors/responsevalidationerror.ts +50 -0
- package/src/models/errors/sdkvalidationerror.ts +12 -0
- package/src/models/operations/createapplication.ts +299 -64
- package/src/models/operations/supportingdocumentscreate.ts +386 -0
- package/src/sdk/applications.ts +1 -1
- package/src/sdk/sdk.ts +7 -7
- package/src/sdk/supportingdocuments.ts +1 -1
- package/src/types/constdatetime.ts +1 -1
- package/types/constdatetime.js +1 -1
- package/models/errors/createapplication.d.ts +0 -73
- package/models/errors/createapplication.d.ts.map +0 -1
- package/models/errors/createapplication.js +0 -120
- package/models/errors/createapplication.js.map +0 -1
- package/models/errors/supportingdocumentscreate.d.ts +0 -143
- package/models/errors/supportingdocumentscreate.d.ts.map +0 -1
- package/models/errors/supportingdocumentscreate.js +0 -225
- package/models/errors/supportingdocumentscreate.js.map +0 -1
- package/src/models/errors/createapplication.ts +0 -149
- package/src/models/errors/supportingdocumentscreate.ts +0 -342
|
@@ -26,13 +26,15 @@ import {
|
|
|
26
26
|
SupportingDocumentRelationships$outboundSchema,
|
|
27
27
|
} from "./supportingdocumentrelationships.js";
|
|
28
28
|
|
|
29
|
-
export const
|
|
29
|
+
export const SupportingDocumentResourceType = {
|
|
30
30
|
SupportingDocuments: "supporting-documents",
|
|
31
31
|
} as const;
|
|
32
|
-
export type
|
|
32
|
+
export type SupportingDocumentResourceType = ClosedEnum<
|
|
33
|
+
typeof SupportingDocumentResourceType
|
|
34
|
+
>;
|
|
33
35
|
|
|
34
36
|
export type SupportingDocumentResource = {
|
|
35
|
-
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
|
|
44
|
-
|
|
45
|
-
);
|
|
45
|
+
export const SupportingDocumentResourceType$inboundSchema: z.ZodNativeEnum<
|
|
46
|
+
typeof SupportingDocumentResourceType
|
|
47
|
+
> = z.nativeEnum(SupportingDocumentResourceType);
|
|
46
48
|
|
|
47
49
|
/** @internal */
|
|
48
|
-
export const
|
|
49
|
-
|
|
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
|
|
56
|
-
/** @deprecated use `
|
|
57
|
-
export const inboundSchema =
|
|
58
|
-
/** @deprecated use `
|
|
59
|
-
export const 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:
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
12
|
-
|
|
11
|
+
httpMeta: {
|
|
12
|
+
response: Response;
|
|
13
|
+
request: Request;
|
|
14
|
+
body: string;
|
|
15
|
+
},
|
|
13
16
|
) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
+
}
|
|
@@ -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";
|