@financeable/aggregation 0.2.0 → 0.2.5
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 +1 -7
- package/README.md +938 -31
- package/docs/sdks/applications/README.md +2 -14
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/models/components/applicationresourcebulksubmission.d.ts +0 -6
- package/models/components/applicationresourcebulksubmission.d.ts.map +1 -1
- package/models/components/applicationresourcebulksubmission.js +0 -6
- package/models/components/applicationresourcebulksubmission.js.map +1 -1
- package/models/components/customerattributes.d.ts +5 -36
- package/models/components/customerattributes.d.ts.map +1 -1
- package/models/components/customerattributes.js +6 -41
- package/models/components/customerattributes.js.map +1 -1
- package/models/components/customeridtype.d.ts +28 -0
- package/models/components/customeridtype.d.ts.map +1 -0
- package/models/components/customeridtype.js +60 -0
- package/models/components/customeridtype.js.map +1 -0
- package/models/components/index.d.ts +1 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +1 -0
- package/models/components/index.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/config.ts +3 -3
- package/src/models/components/applicationresourcebulksubmission.ts +0 -12
- package/src/models/components/customerattributes.ts +13 -53
- package/src/models/components/customeridtype.ts +33 -0
- package/src/models/components/index.ts +1 -0
- package/financeable-typescript/.devcontainer/README.md +0 -30
- package/financeable-typescript/FUNCTIONS.md +0 -205
- package/financeable-typescript/README.md +0 -895
- package/financeable-typescript/RUNTIMES.md +0 -22
- package/financeable-typescript/docs/sdks/applications/README.md +0 -427
- package/financeable-typescript/docs/sdks/financeable/README.md +0 -5
- package/financeable-typescript/src/core.ts +0 -13
- package/financeable-typescript/src/funcs/applicationsCreate.ts +0 -124
- package/financeable-typescript/src/funcs/applicationsGet.ts +0 -128
- package/financeable-typescript/src/funcs/applicationsList.ts +0 -126
- package/financeable-typescript/src/hooks/hooks.ts +0 -129
- package/financeable-typescript/src/hooks/index.ts +0 -6
- package/financeable-typescript/src/hooks/types.ts +0 -109
- package/financeable-typescript/src/index.ts +0 -7
- package/financeable-typescript/src/lib/base64.ts +0 -37
- package/financeable-typescript/src/lib/config.ts +0 -59
- package/financeable-typescript/src/lib/dlv.ts +0 -53
- package/financeable-typescript/src/lib/encodings.ts +0 -449
- package/financeable-typescript/src/lib/env.ts +0 -37
- package/financeable-typescript/src/lib/files.ts +0 -40
- package/financeable-typescript/src/lib/http.ts +0 -323
- package/financeable-typescript/src/lib/is-plain-object.ts +0 -43
- package/financeable-typescript/src/lib/logger.ts +0 -9
- package/financeable-typescript/src/lib/matchers.ts +0 -322
- package/financeable-typescript/src/lib/primitives.ts +0 -122
- package/financeable-typescript/src/lib/retries.ts +0 -219
- package/financeable-typescript/src/lib/schemas.ts +0 -86
- package/financeable-typescript/src/lib/sdks.ts +0 -392
- package/financeable-typescript/src/lib/security.ts +0 -227
- package/financeable-typescript/src/lib/url.ts +0 -33
- package/financeable-typescript/src/models/components/addressattributes.ts +0 -148
- package/financeable-typescript/src/models/components/apierrorlinks.ts +0 -65
- package/financeable-typescript/src/models/components/applicationattributes.ts +0 -128
- package/financeable-typescript/src/models/components/applicationattributescreate.ts +0 -90
- package/financeable-typescript/src/models/components/applicationresourcebulksubmission.ts +0 -1000
- package/financeable-typescript/src/models/components/applicationstatus.ts +0 -39
- package/financeable-typescript/src/models/components/applicationtype.ts +0 -33
- package/financeable-typescript/src/models/components/assetattributes.ts +0 -400
- package/financeable-typescript/src/models/components/customerattributes.ts +0 -171
- package/financeable-typescript/src/models/components/customertitle.ts +0 -35
- package/financeable-typescript/src/models/components/errorsource.ts +0 -79
- package/financeable-typescript/src/models/components/forbiddenerror.ts +0 -207
- package/financeable-typescript/src/models/components/frequencytype.ts +0 -40
- package/financeable-typescript/src/models/components/index.ts +0 -20
- package/financeable-typescript/src/models/components/links.ts +0 -72
- package/financeable-typescript/src/models/components/loandetailsattributes.ts +0 -187
- package/financeable-typescript/src/models/components/repaymentstructure.ts +0 -40
- package/financeable-typescript/src/models/errors/apierror.ts +0 -27
- package/financeable-typescript/src/models/errors/createapplication.ts +0 -76
- package/financeable-typescript/src/models/errors/getapplication.ts +0 -76
- package/financeable-typescript/src/models/errors/getapplications.ts +0 -76
- package/financeable-typescript/src/models/errors/httpclienterrors.ts +0 -62
- package/financeable-typescript/src/models/errors/index.ts +0 -10
- package/financeable-typescript/src/models/errors/sdkvalidationerror.ts +0 -97
- package/financeable-typescript/src/models/operations/createapplication.ts +0 -1649
- package/financeable-typescript/src/models/operations/getapplication.ts +0 -1829
- package/financeable-typescript/src/models/operations/getapplications.ts +0 -1790
- package/financeable-typescript/src/models/operations/index.ts +0 -7
- package/financeable-typescript/src/sdk/applications.ts +0 -55
- package/financeable-typescript/src/sdk/index.ts +0 -5
- package/financeable-typescript/src/sdk/sdk.ts +0 -13
- package/financeable-typescript/src/types/blobs.ts +0 -31
- package/financeable-typescript/src/types/constdatetime.ts +0 -15
- package/financeable-typescript/src/types/enums.ts +0 -16
- package/financeable-typescript/src/types/fp.ts +0 -50
- package/financeable-typescript/src/types/index.ts +0 -11
- package/financeable-typescript/src/types/operations.ts +0 -105
- package/financeable-typescript/src/types/rfcdate.ts +0 -54
- package/financeable-typescript/src/types/streams.ts +0 -21
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod";
|
|
6
|
-
import * as components from "../components/index.js";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Access is forbidden.
|
|
10
|
-
*/
|
|
11
|
-
export type CreateApplicationResponseBodyData = {
|
|
12
|
-
errors: Array<components.ForbiddenError>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Access is forbidden.
|
|
17
|
-
*/
|
|
18
|
-
export class CreateApplicationResponseBody extends Error {
|
|
19
|
-
errors: Array<components.ForbiddenError>;
|
|
20
|
-
|
|
21
|
-
/** The original data that was passed to this error instance. */
|
|
22
|
-
data$: CreateApplicationResponseBodyData;
|
|
23
|
-
|
|
24
|
-
constructor(err: CreateApplicationResponseBodyData) {
|
|
25
|
-
const message = "message" in err && typeof err.message === "string"
|
|
26
|
-
? err.message
|
|
27
|
-
: `API error occurred: ${JSON.stringify(err)}`;
|
|
28
|
-
super(message);
|
|
29
|
-
this.data$ = err;
|
|
30
|
-
|
|
31
|
-
this.errors = err.errors;
|
|
32
|
-
|
|
33
|
-
this.name = "CreateApplicationResponseBody";
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** @internal */
|
|
38
|
-
export const CreateApplicationResponseBody$inboundSchema: z.ZodType<
|
|
39
|
-
CreateApplicationResponseBody,
|
|
40
|
-
z.ZodTypeDef,
|
|
41
|
-
unknown
|
|
42
|
-
> = z.object({
|
|
43
|
-
errors: z.array(components.ForbiddenError$inboundSchema),
|
|
44
|
-
})
|
|
45
|
-
.transform((v) => {
|
|
46
|
-
return new CreateApplicationResponseBody(v);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
/** @internal */
|
|
50
|
-
export type CreateApplicationResponseBody$Outbound = {
|
|
51
|
-
errors: Array<components.ForbiddenError$Outbound>;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/** @internal */
|
|
55
|
-
export const CreateApplicationResponseBody$outboundSchema: z.ZodType<
|
|
56
|
-
CreateApplicationResponseBody$Outbound,
|
|
57
|
-
z.ZodTypeDef,
|
|
58
|
-
CreateApplicationResponseBody
|
|
59
|
-
> = z.instanceof(CreateApplicationResponseBody)
|
|
60
|
-
.transform(v => v.data$)
|
|
61
|
-
.pipe(z.object({
|
|
62
|
-
errors: z.array(components.ForbiddenError$outboundSchema),
|
|
63
|
-
}));
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* @internal
|
|
67
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
68
|
-
*/
|
|
69
|
-
export namespace CreateApplicationResponseBody$ {
|
|
70
|
-
/** @deprecated use `CreateApplicationResponseBody$inboundSchema` instead. */
|
|
71
|
-
export const inboundSchema = CreateApplicationResponseBody$inboundSchema;
|
|
72
|
-
/** @deprecated use `CreateApplicationResponseBody$outboundSchema` instead. */
|
|
73
|
-
export const outboundSchema = CreateApplicationResponseBody$outboundSchema;
|
|
74
|
-
/** @deprecated use `CreateApplicationResponseBody$Outbound` instead. */
|
|
75
|
-
export type Outbound = CreateApplicationResponseBody$Outbound;
|
|
76
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod";
|
|
6
|
-
import * as components from "../components/index.js";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Access is forbidden.
|
|
10
|
-
*/
|
|
11
|
-
export type GetApplicationResponseBodyData = {
|
|
12
|
-
errors: Array<components.ForbiddenError>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Access is forbidden.
|
|
17
|
-
*/
|
|
18
|
-
export class GetApplicationResponseBody extends Error {
|
|
19
|
-
errors: Array<components.ForbiddenError>;
|
|
20
|
-
|
|
21
|
-
/** The original data that was passed to this error instance. */
|
|
22
|
-
data$: GetApplicationResponseBodyData;
|
|
23
|
-
|
|
24
|
-
constructor(err: GetApplicationResponseBodyData) {
|
|
25
|
-
const message = "message" in err && typeof err.message === "string"
|
|
26
|
-
? err.message
|
|
27
|
-
: `API error occurred: ${JSON.stringify(err)}`;
|
|
28
|
-
super(message);
|
|
29
|
-
this.data$ = err;
|
|
30
|
-
|
|
31
|
-
this.errors = err.errors;
|
|
32
|
-
|
|
33
|
-
this.name = "GetApplicationResponseBody";
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** @internal */
|
|
38
|
-
export const GetApplicationResponseBody$inboundSchema: z.ZodType<
|
|
39
|
-
GetApplicationResponseBody,
|
|
40
|
-
z.ZodTypeDef,
|
|
41
|
-
unknown
|
|
42
|
-
> = z.object({
|
|
43
|
-
errors: z.array(components.ForbiddenError$inboundSchema),
|
|
44
|
-
})
|
|
45
|
-
.transform((v) => {
|
|
46
|
-
return new GetApplicationResponseBody(v);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
/** @internal */
|
|
50
|
-
export type GetApplicationResponseBody$Outbound = {
|
|
51
|
-
errors: Array<components.ForbiddenError$Outbound>;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/** @internal */
|
|
55
|
-
export const GetApplicationResponseBody$outboundSchema: z.ZodType<
|
|
56
|
-
GetApplicationResponseBody$Outbound,
|
|
57
|
-
z.ZodTypeDef,
|
|
58
|
-
GetApplicationResponseBody
|
|
59
|
-
> = z.instanceof(GetApplicationResponseBody)
|
|
60
|
-
.transform(v => v.data$)
|
|
61
|
-
.pipe(z.object({
|
|
62
|
-
errors: z.array(components.ForbiddenError$outboundSchema),
|
|
63
|
-
}));
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* @internal
|
|
67
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
68
|
-
*/
|
|
69
|
-
export namespace GetApplicationResponseBody$ {
|
|
70
|
-
/** @deprecated use `GetApplicationResponseBody$inboundSchema` instead. */
|
|
71
|
-
export const inboundSchema = GetApplicationResponseBody$inboundSchema;
|
|
72
|
-
/** @deprecated use `GetApplicationResponseBody$outboundSchema` instead. */
|
|
73
|
-
export const outboundSchema = GetApplicationResponseBody$outboundSchema;
|
|
74
|
-
/** @deprecated use `GetApplicationResponseBody$Outbound` instead. */
|
|
75
|
-
export type Outbound = GetApplicationResponseBody$Outbound;
|
|
76
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod";
|
|
6
|
-
import * as components from "../components/index.js";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Access is forbidden.
|
|
10
|
-
*/
|
|
11
|
-
export type GetApplicationsResponseBodyData = {
|
|
12
|
-
errors: Array<components.ForbiddenError>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Access is forbidden.
|
|
17
|
-
*/
|
|
18
|
-
export class GetApplicationsResponseBody extends Error {
|
|
19
|
-
errors: Array<components.ForbiddenError>;
|
|
20
|
-
|
|
21
|
-
/** The original data that was passed to this error instance. */
|
|
22
|
-
data$: GetApplicationsResponseBodyData;
|
|
23
|
-
|
|
24
|
-
constructor(err: GetApplicationsResponseBodyData) {
|
|
25
|
-
const message = "message" in err && typeof err.message === "string"
|
|
26
|
-
? err.message
|
|
27
|
-
: `API error occurred: ${JSON.stringify(err)}`;
|
|
28
|
-
super(message);
|
|
29
|
-
this.data$ = err;
|
|
30
|
-
|
|
31
|
-
this.errors = err.errors;
|
|
32
|
-
|
|
33
|
-
this.name = "GetApplicationsResponseBody";
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** @internal */
|
|
38
|
-
export const GetApplicationsResponseBody$inboundSchema: z.ZodType<
|
|
39
|
-
GetApplicationsResponseBody,
|
|
40
|
-
z.ZodTypeDef,
|
|
41
|
-
unknown
|
|
42
|
-
> = z.object({
|
|
43
|
-
errors: z.array(components.ForbiddenError$inboundSchema),
|
|
44
|
-
})
|
|
45
|
-
.transform((v) => {
|
|
46
|
-
return new GetApplicationsResponseBody(v);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
/** @internal */
|
|
50
|
-
export type GetApplicationsResponseBody$Outbound = {
|
|
51
|
-
errors: Array<components.ForbiddenError$Outbound>;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/** @internal */
|
|
55
|
-
export const GetApplicationsResponseBody$outboundSchema: z.ZodType<
|
|
56
|
-
GetApplicationsResponseBody$Outbound,
|
|
57
|
-
z.ZodTypeDef,
|
|
58
|
-
GetApplicationsResponseBody
|
|
59
|
-
> = z.instanceof(GetApplicationsResponseBody)
|
|
60
|
-
.transform(v => v.data$)
|
|
61
|
-
.pipe(z.object({
|
|
62
|
-
errors: z.array(components.ForbiddenError$outboundSchema),
|
|
63
|
-
}));
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* @internal
|
|
67
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
68
|
-
*/
|
|
69
|
-
export namespace GetApplicationsResponseBody$ {
|
|
70
|
-
/** @deprecated use `GetApplicationsResponseBody$inboundSchema` instead. */
|
|
71
|
-
export const inboundSchema = GetApplicationsResponseBody$inboundSchema;
|
|
72
|
-
/** @deprecated use `GetApplicationsResponseBody$outboundSchema` instead. */
|
|
73
|
-
export const outboundSchema = GetApplicationsResponseBody$outboundSchema;
|
|
74
|
-
/** @deprecated use `GetApplicationsResponseBody$Outbound` instead. */
|
|
75
|
-
export type Outbound = GetApplicationsResponseBody$Outbound;
|
|
76
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Base class for all HTTP errors.
|
|
7
|
-
*/
|
|
8
|
-
export class HTTPClientError extends Error {
|
|
9
|
-
/** The underlying cause of the error. */
|
|
10
|
-
override readonly cause: unknown;
|
|
11
|
-
override name = "HTTPClientError";
|
|
12
|
-
constructor(message: string, opts?: { cause?: unknown }) {
|
|
13
|
-
let msg = message;
|
|
14
|
-
if (opts?.cause) {
|
|
15
|
-
msg += `: ${opts.cause}`;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
super(msg, opts);
|
|
19
|
-
// In older runtimes, the cause field would not have been assigned through
|
|
20
|
-
// the super() call.
|
|
21
|
-
if (typeof this.cause === "undefined") {
|
|
22
|
-
this.cause = opts?.cause;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* An error to capture unrecognised or unexpected errors when making HTTP calls.
|
|
29
|
-
*/
|
|
30
|
-
export class UnexpectedClientError extends HTTPClientError {
|
|
31
|
-
override name = "UnexpectedClientError";
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* An error that is raised when any inputs used to create a request are invalid.
|
|
36
|
-
*/
|
|
37
|
-
export class InvalidRequestError extends HTTPClientError {
|
|
38
|
-
override name = "InvalidRequestError";
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* An error that is raised when a HTTP request was aborted by the client error.
|
|
43
|
-
*/
|
|
44
|
-
export class RequestAbortedError extends HTTPClientError {
|
|
45
|
-
override readonly name = "RequestAbortedError";
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* An error that is raised when a HTTP request timed out due to an AbortSignal
|
|
50
|
-
* signal timeout.
|
|
51
|
-
*/
|
|
52
|
-
export class RequestTimeoutError extends HTTPClientError {
|
|
53
|
-
override readonly name = "RequestTimeoutError";
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* An error that is raised when a HTTP client is unable to make a request to
|
|
58
|
-
* a server.
|
|
59
|
-
*/
|
|
60
|
-
export class ConnectionError extends HTTPClientError {
|
|
61
|
-
override readonly name = "ConnectionError";
|
|
62
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export * from "./apierror.js";
|
|
6
|
-
export * from "./createapplication.js";
|
|
7
|
-
export * from "./getapplication.js";
|
|
8
|
-
export * from "./getapplications.js";
|
|
9
|
-
export * from "./httpclienterrors.js";
|
|
10
|
-
export * from "./sdkvalidationerror.js";
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod";
|
|
6
|
-
|
|
7
|
-
export class SDKValidationError extends Error {
|
|
8
|
-
/**
|
|
9
|
-
* The raw value that failed validation.
|
|
10
|
-
*/
|
|
11
|
-
public readonly rawValue: unknown;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The raw message that failed validation.
|
|
15
|
-
*/
|
|
16
|
-
public readonly rawMessage: unknown;
|
|
17
|
-
|
|
18
|
-
constructor(message: string, cause: unknown, rawValue: unknown) {
|
|
19
|
-
super(`${message}: ${cause}`);
|
|
20
|
-
this.name = "SDKValidationError";
|
|
21
|
-
this.cause = cause;
|
|
22
|
-
this.rawValue = rawValue;
|
|
23
|
-
this.rawMessage = message;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Return a pretty-formatted error message if the underlying validation error
|
|
28
|
-
* is a ZodError or some other recognized error type, otherwise return the
|
|
29
|
-
* default error message.
|
|
30
|
-
*/
|
|
31
|
-
public pretty(): string {
|
|
32
|
-
if (this.cause instanceof z.ZodError) {
|
|
33
|
-
return `${this.rawMessage}\n${formatZodError(this.cause)}`;
|
|
34
|
-
} else {
|
|
35
|
-
return this.toString();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function formatZodError(err: z.ZodError, level = 0): string {
|
|
41
|
-
let pre = " ".repeat(level);
|
|
42
|
-
pre = level > 0 ? `│${pre}` : pre;
|
|
43
|
-
pre += " ".repeat(level);
|
|
44
|
-
|
|
45
|
-
let message = "";
|
|
46
|
-
const append = (str: string) => (message += `\n${pre}${str}`);
|
|
47
|
-
|
|
48
|
-
const len = err.issues.length;
|
|
49
|
-
const headline = len === 1 ? `${len} issue found` : `${len} issues found`;
|
|
50
|
-
|
|
51
|
-
if (len) {
|
|
52
|
-
append(`┌ ${headline}:`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
for (const issue of err.issues) {
|
|
56
|
-
let path = issue.path.join(".");
|
|
57
|
-
path = path ? `<root>.${path}` : "<root>";
|
|
58
|
-
append(`│ • [${path}]: ${issue.message} (${issue.code})`);
|
|
59
|
-
switch (issue.code) {
|
|
60
|
-
case "invalid_literal":
|
|
61
|
-
case "invalid_type": {
|
|
62
|
-
append(`│ Want: ${issue.expected}`);
|
|
63
|
-
append(`│ Got: ${issue.received}`);
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
case "unrecognized_keys": {
|
|
67
|
-
append(`│ Keys: ${issue.keys.join(", ")}`);
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
case "invalid_enum_value": {
|
|
71
|
-
append(`│ Allowed: ${issue.options.join(", ")}`);
|
|
72
|
-
append(`│ Got: ${issue.received}`);
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
case "invalid_union_discriminator": {
|
|
76
|
-
append(`│ Allowed: ${issue.options.join(", ")}`);
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
case "invalid_union": {
|
|
80
|
-
const len = issue.unionErrors.length;
|
|
81
|
-
append(
|
|
82
|
-
`│ ✖︎ Attemped to deserialize into one of ${len} union members:`,
|
|
83
|
-
);
|
|
84
|
-
issue.unionErrors.forEach((err, i) => {
|
|
85
|
-
append(`│ ✖︎ Member ${i + 1} of ${len}`);
|
|
86
|
-
append(`${formatZodError(err, level + 1)}`);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (err.issues.length) {
|
|
93
|
-
append(`└─*`);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return message.slice(1);
|
|
97
|
-
}
|