@moovio/sdk 0.21.15 → 0.21.16
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/bin/mcp-server.js +227 -141
- package/bin/mcp-server.js.map +22 -18
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/mcp-server/mcp-server.js +1 -1
- package/mcp-server/server.js +1 -1
- package/models/components/createpaymentlink.d.ts +3 -3
- package/models/components/createpaymentlink.d.ts.map +1 -1
- package/models/components/createpaymentlink.js +3 -3
- package/models/components/createpaymentlink.js.map +1 -1
- package/models/components/createpaymentlinklineitem.d.ts +50 -0
- package/models/components/createpaymentlinklineitem.d.ts.map +1 -0
- package/models/components/createpaymentlinklineitem.js +70 -0
- package/models/components/createpaymentlinklineitem.js.map +1 -0
- package/models/components/createpaymentlinklineitemoption.d.ts +44 -0
- package/models/components/createpaymentlinklineitemoption.d.ts.map +1 -0
- package/models/components/createpaymentlinklineitemoption.js +67 -0
- package/models/components/createpaymentlinklineitemoption.js.map +1 -0
- package/models/components/createpaymentlinklineitemoptionvalidationerror.d.ts +24 -0
- package/models/components/createpaymentlinklineitemoptionvalidationerror.d.ts.map +1 -0
- package/models/components/{paymentlinklineitemoptionvalidationerror.js → createpaymentlinklineitemoptionvalidationerror.js} +10 -10
- package/models/components/createpaymentlinklineitemoptionvalidationerror.js.map +1 -0
- package/models/components/createpaymentlinklineitems.d.ts +27 -0
- package/models/components/createpaymentlinklineitems.d.ts.map +1 -0
- package/models/components/{paymentlinklineitemsupdate.js → createpaymentlinklineitems.js} +13 -13
- package/models/components/createpaymentlinklineitems.js.map +1 -0
- package/models/components/createpaymentlinklineitemsupdate.d.ts +27 -0
- package/models/components/createpaymentlinklineitemsupdate.d.ts.map +1 -0
- package/models/components/{paymentlinklineitemsvalidationerror.js → createpaymentlinklineitemsupdate.js} +13 -13
- package/models/components/createpaymentlinklineitemsupdate.js.map +1 -0
- package/models/components/createpaymentlinklineitemsvalidationerror.d.ts +22 -0
- package/models/components/createpaymentlinklineitemsvalidationerror.d.ts.map +1 -0
- package/models/components/createpaymentlinklineitemsvalidationerror.js +61 -0
- package/models/components/createpaymentlinklineitemsvalidationerror.js.map +1 -0
- package/models/components/createpaymentlinklineitemvalidationerror.d.ts +31 -0
- package/models/components/createpaymentlinklineitemvalidationerror.d.ts.map +1 -0
- package/models/components/{paymentlinklineitemvalidationerror.js → createpaymentlinklineitemvalidationerror.js} +13 -15
- package/models/components/createpaymentlinklineitemvalidationerror.js.map +1 -0
- package/models/components/index.d.ts +8 -4
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +8 -4
- package/models/components/index.js.map +1 -1
- package/models/components/paymentlinklineitem.d.ts +6 -0
- package/models/components/paymentlinklineitem.d.ts.map +1 -1
- package/models/components/paymentlinklineitem.js +3 -0
- package/models/components/paymentlinklineitem.js.map +1 -1
- package/models/components/paymentlinklineitemimagemetadata.d.ts +35 -0
- package/models/components/paymentlinklineitemimagemetadata.d.ts.map +1 -0
- package/models/components/paymentlinklineitemimagemetadata.js +64 -0
- package/models/components/paymentlinklineitemimagemetadata.js.map +1 -0
- package/models/components/paymentlinklineitemoption.d.ts +6 -0
- package/models/components/paymentlinklineitemoption.d.ts.map +1 -1
- package/models/components/paymentlinklineitemoption.js +3 -0
- package/models/components/paymentlinklineitemoption.js.map +1 -1
- package/models/components/updatepaymentlink.d.ts +3 -3
- package/models/components/updatepaymentlink.d.ts.map +1 -1
- package/models/components/updatepaymentlink.js +3 -3
- package/models/components/updatepaymentlink.js.map +1 -1
- package/models/errors/createpaymentlinkerror.d.ts +3 -3
- package/models/errors/createpaymentlinkerror.d.ts.map +1 -1
- package/models/errors/createpaymentlinkerror.js +3 -3
- package/models/errors/createpaymentlinkerror.js.map +1 -1
- package/models/errors/updatepaymentlinkerror.d.ts +3 -3
- package/models/errors/updatepaymentlinkerror.d.ts.map +1 -1
- package/models/errors/updatepaymentlinkerror.js +3 -3
- package/models/errors/updatepaymentlinkerror.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/models/components/createpaymentlink.ts +10 -10
- package/src/models/components/createpaymentlinklineitem.ts +104 -0
- package/src/models/components/createpaymentlinklineitemoption.ts +93 -0
- package/src/models/components/createpaymentlinklineitemoptionvalidationerror.ts +80 -0
- package/src/models/components/createpaymentlinklineitems.ts +66 -0
- package/src/models/components/createpaymentlinklineitemsupdate.ts +68 -0
- package/src/models/components/createpaymentlinklineitemsvalidationerror.ts +71 -0
- package/src/models/components/createpaymentlinklineitemvalidationerror.ts +96 -0
- package/src/models/components/index.ts +8 -4
- package/src/models/components/paymentlinklineitem.ts +13 -0
- package/src/models/components/paymentlinklineitemimagemetadata.ts +77 -0
- package/src/models/components/paymentlinklineitemoption.ts +13 -0
- package/src/models/components/updatepaymentlink.ts +10 -10
- package/src/models/errors/createpaymentlinkerror.ts +6 -6
- package/src/models/errors/updatepaymentlinkerror.ts +6 -6
- package/src/types/enums.ts +1 -21
- package/src/types/index.ts +2 -1
- package/src/types/unrecognized.ts +27 -0
- package/types/enums.d.ts +1 -8
- package/types/enums.d.ts.map +1 -1
- package/types/enums.js +3 -21
- package/types/enums.js.map +1 -1
- package/types/index.d.ts +2 -1
- package/types/index.d.ts.map +1 -1
- package/types/index.js +15 -0
- package/types/index.js.map +1 -1
- package/types/unrecognized.d.ts +10 -0
- package/types/unrecognized.d.ts.map +1 -0
- package/types/unrecognized.js +26 -0
- package/types/unrecognized.js.map +1 -0
- package/models/components/paymentlinklineitemoptionvalidationerror.d.ts +0 -24
- package/models/components/paymentlinklineitemoptionvalidationerror.d.ts.map +0 -1
- package/models/components/paymentlinklineitemoptionvalidationerror.js.map +0 -1
- package/models/components/paymentlinklineitemsupdate.d.ts +0 -27
- package/models/components/paymentlinklineitemsupdate.d.ts.map +0 -1
- package/models/components/paymentlinklineitemsupdate.js.map +0 -1
- package/models/components/paymentlinklineitemsvalidationerror.d.ts +0 -22
- package/models/components/paymentlinklineitemsvalidationerror.d.ts.map +0 -1
- package/models/components/paymentlinklineitemsvalidationerror.js.map +0 -1
- package/models/components/paymentlinklineitemvalidationerror.d.ts +0 -31
- package/models/components/paymentlinklineitemvalidationerror.d.ts.map +0 -1
- package/models/components/paymentlinklineitemvalidationerror.js.map +0 -1
- package/src/models/components/paymentlinklineitemoptionvalidationerror.ts +0 -78
- package/src/models/components/paymentlinklineitemsupdate.ts +0 -66
- package/src/models/components/paymentlinklineitemsvalidationerror.ts +0 -62
- package/src/models/components/paymentlinklineitemvalidationerror.ts +0 -88
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
CreatePaymentLinkLineItem,
|
|
11
|
+
CreatePaymentLinkLineItem$inboundSchema,
|
|
12
|
+
CreatePaymentLinkLineItem$Outbound,
|
|
13
|
+
CreatePaymentLinkLineItem$outboundSchema,
|
|
14
|
+
} from "./createpaymentlinklineitem.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* An optional collection of line items for a payment link.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* When line items are provided, their total plus sales tax must equal the payment link amount.
|
|
21
|
+
*/
|
|
22
|
+
export type CreatePaymentLinkLineItems = {
|
|
23
|
+
/**
|
|
24
|
+
* The list of line items.
|
|
25
|
+
*/
|
|
26
|
+
items: Array<CreatePaymentLinkLineItem>;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** @internal */
|
|
30
|
+
export const CreatePaymentLinkLineItems$inboundSchema: z.ZodType<
|
|
31
|
+
CreatePaymentLinkLineItems,
|
|
32
|
+
z.ZodTypeDef,
|
|
33
|
+
unknown
|
|
34
|
+
> = z.object({
|
|
35
|
+
items: z.array(CreatePaymentLinkLineItem$inboundSchema),
|
|
36
|
+
});
|
|
37
|
+
/** @internal */
|
|
38
|
+
export type CreatePaymentLinkLineItems$Outbound = {
|
|
39
|
+
items: Array<CreatePaymentLinkLineItem$Outbound>;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** @internal */
|
|
43
|
+
export const CreatePaymentLinkLineItems$outboundSchema: z.ZodType<
|
|
44
|
+
CreatePaymentLinkLineItems$Outbound,
|
|
45
|
+
z.ZodTypeDef,
|
|
46
|
+
CreatePaymentLinkLineItems
|
|
47
|
+
> = z.object({
|
|
48
|
+
items: z.array(CreatePaymentLinkLineItem$outboundSchema),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export function createPaymentLinkLineItemsToJSON(
|
|
52
|
+
createPaymentLinkLineItems: CreatePaymentLinkLineItems,
|
|
53
|
+
): string {
|
|
54
|
+
return JSON.stringify(
|
|
55
|
+
CreatePaymentLinkLineItems$outboundSchema.parse(createPaymentLinkLineItems),
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
export function createPaymentLinkLineItemsFromJSON(
|
|
59
|
+
jsonString: string,
|
|
60
|
+
): SafeParseResult<CreatePaymentLinkLineItems, SDKValidationError> {
|
|
61
|
+
return safeParse(
|
|
62
|
+
jsonString,
|
|
63
|
+
(x) => CreatePaymentLinkLineItems$inboundSchema.parse(JSON.parse(x)),
|
|
64
|
+
`Failed to parse 'CreatePaymentLinkLineItems' from JSON`,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
CreatePaymentLinkLineItem,
|
|
11
|
+
CreatePaymentLinkLineItem$inboundSchema,
|
|
12
|
+
CreatePaymentLinkLineItem$Outbound,
|
|
13
|
+
CreatePaymentLinkLineItem$outboundSchema,
|
|
14
|
+
} from "./createpaymentlinklineitem.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* An optional collection of line items for a payment link.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* When line items are provided, their total plus sales tax must equal the payment link amount.
|
|
21
|
+
*/
|
|
22
|
+
export type CreatePaymentLinkLineItemsUpdate = {
|
|
23
|
+
/**
|
|
24
|
+
* The list of line items.
|
|
25
|
+
*/
|
|
26
|
+
items?: Array<CreatePaymentLinkLineItem> | undefined;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** @internal */
|
|
30
|
+
export const CreatePaymentLinkLineItemsUpdate$inboundSchema: z.ZodType<
|
|
31
|
+
CreatePaymentLinkLineItemsUpdate,
|
|
32
|
+
z.ZodTypeDef,
|
|
33
|
+
unknown
|
|
34
|
+
> = z.object({
|
|
35
|
+
items: z.array(CreatePaymentLinkLineItem$inboundSchema).optional(),
|
|
36
|
+
});
|
|
37
|
+
/** @internal */
|
|
38
|
+
export type CreatePaymentLinkLineItemsUpdate$Outbound = {
|
|
39
|
+
items?: Array<CreatePaymentLinkLineItem$Outbound> | undefined;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** @internal */
|
|
43
|
+
export const CreatePaymentLinkLineItemsUpdate$outboundSchema: z.ZodType<
|
|
44
|
+
CreatePaymentLinkLineItemsUpdate$Outbound,
|
|
45
|
+
z.ZodTypeDef,
|
|
46
|
+
CreatePaymentLinkLineItemsUpdate
|
|
47
|
+
> = z.object({
|
|
48
|
+
items: z.array(CreatePaymentLinkLineItem$outboundSchema).optional(),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export function createPaymentLinkLineItemsUpdateToJSON(
|
|
52
|
+
createPaymentLinkLineItemsUpdate: CreatePaymentLinkLineItemsUpdate,
|
|
53
|
+
): string {
|
|
54
|
+
return JSON.stringify(
|
|
55
|
+
CreatePaymentLinkLineItemsUpdate$outboundSchema.parse(
|
|
56
|
+
createPaymentLinkLineItemsUpdate,
|
|
57
|
+
),
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
export function createPaymentLinkLineItemsUpdateFromJSON(
|
|
61
|
+
jsonString: string,
|
|
62
|
+
): SafeParseResult<CreatePaymentLinkLineItemsUpdate, SDKValidationError> {
|
|
63
|
+
return safeParse(
|
|
64
|
+
jsonString,
|
|
65
|
+
(x) => CreatePaymentLinkLineItemsUpdate$inboundSchema.parse(JSON.parse(x)),
|
|
66
|
+
`Failed to parse 'CreatePaymentLinkLineItemsUpdate' from JSON`,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
CreatePaymentLinkLineItemValidationError,
|
|
11
|
+
CreatePaymentLinkLineItemValidationError$inboundSchema,
|
|
12
|
+
CreatePaymentLinkLineItemValidationError$Outbound,
|
|
13
|
+
CreatePaymentLinkLineItemValidationError$outboundSchema,
|
|
14
|
+
} from "./createpaymentlinklineitemvalidationerror.js";
|
|
15
|
+
|
|
16
|
+
export type CreatePaymentLinkLineItemsValidationError = {
|
|
17
|
+
items?: { [k: string]: CreatePaymentLinkLineItemValidationError } | undefined;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** @internal */
|
|
21
|
+
export const CreatePaymentLinkLineItemsValidationError$inboundSchema: z.ZodType<
|
|
22
|
+
CreatePaymentLinkLineItemsValidationError,
|
|
23
|
+
z.ZodTypeDef,
|
|
24
|
+
unknown
|
|
25
|
+
> = z.object({
|
|
26
|
+
items: z.record(CreatePaymentLinkLineItemValidationError$inboundSchema)
|
|
27
|
+
.optional(),
|
|
28
|
+
});
|
|
29
|
+
/** @internal */
|
|
30
|
+
export type CreatePaymentLinkLineItemsValidationError$Outbound = {
|
|
31
|
+
items?:
|
|
32
|
+
| { [k: string]: CreatePaymentLinkLineItemValidationError$Outbound }
|
|
33
|
+
| undefined;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** @internal */
|
|
37
|
+
export const CreatePaymentLinkLineItemsValidationError$outboundSchema:
|
|
38
|
+
z.ZodType<
|
|
39
|
+
CreatePaymentLinkLineItemsValidationError$Outbound,
|
|
40
|
+
z.ZodTypeDef,
|
|
41
|
+
CreatePaymentLinkLineItemsValidationError
|
|
42
|
+
> = z.object({
|
|
43
|
+
items: z.record(CreatePaymentLinkLineItemValidationError$outboundSchema)
|
|
44
|
+
.optional(),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export function createPaymentLinkLineItemsValidationErrorToJSON(
|
|
48
|
+
createPaymentLinkLineItemsValidationError:
|
|
49
|
+
CreatePaymentLinkLineItemsValidationError,
|
|
50
|
+
): string {
|
|
51
|
+
return JSON.stringify(
|
|
52
|
+
CreatePaymentLinkLineItemsValidationError$outboundSchema.parse(
|
|
53
|
+
createPaymentLinkLineItemsValidationError,
|
|
54
|
+
),
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
export function createPaymentLinkLineItemsValidationErrorFromJSON(
|
|
58
|
+
jsonString: string,
|
|
59
|
+
): SafeParseResult<
|
|
60
|
+
CreatePaymentLinkLineItemsValidationError,
|
|
61
|
+
SDKValidationError
|
|
62
|
+
> {
|
|
63
|
+
return safeParse(
|
|
64
|
+
jsonString,
|
|
65
|
+
(x) =>
|
|
66
|
+
CreatePaymentLinkLineItemsValidationError$inboundSchema.parse(
|
|
67
|
+
JSON.parse(x),
|
|
68
|
+
),
|
|
69
|
+
`Failed to parse 'CreatePaymentLinkLineItemsValidationError' from JSON`,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
AmountDecimalValidationError,
|
|
11
|
+
AmountDecimalValidationError$inboundSchema,
|
|
12
|
+
AmountDecimalValidationError$Outbound,
|
|
13
|
+
AmountDecimalValidationError$outboundSchema,
|
|
14
|
+
} from "./amountdecimalvalidationerror.js";
|
|
15
|
+
import {
|
|
16
|
+
CreatePaymentLinkLineItemOptionValidationError,
|
|
17
|
+
CreatePaymentLinkLineItemOptionValidationError$inboundSchema,
|
|
18
|
+
CreatePaymentLinkLineItemOptionValidationError$Outbound,
|
|
19
|
+
CreatePaymentLinkLineItemOptionValidationError$outboundSchema,
|
|
20
|
+
} from "./createpaymentlinklineitemoptionvalidationerror.js";
|
|
21
|
+
|
|
22
|
+
export type CreatePaymentLinkLineItemValidationError = {
|
|
23
|
+
productID?: string | undefined;
|
|
24
|
+
name?: string | undefined;
|
|
25
|
+
basePrice?: AmountDecimalValidationError | undefined;
|
|
26
|
+
options?:
|
|
27
|
+
| { [k: string]: CreatePaymentLinkLineItemOptionValidationError }
|
|
28
|
+
| undefined;
|
|
29
|
+
quantity?: string | undefined;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** @internal */
|
|
33
|
+
export const CreatePaymentLinkLineItemValidationError$inboundSchema: z.ZodType<
|
|
34
|
+
CreatePaymentLinkLineItemValidationError,
|
|
35
|
+
z.ZodTypeDef,
|
|
36
|
+
unknown
|
|
37
|
+
> = z.object({
|
|
38
|
+
productID: z.string().optional(),
|
|
39
|
+
name: z.string().optional(),
|
|
40
|
+
basePrice: AmountDecimalValidationError$inboundSchema.optional(),
|
|
41
|
+
options: z.record(
|
|
42
|
+
CreatePaymentLinkLineItemOptionValidationError$inboundSchema,
|
|
43
|
+
).optional(),
|
|
44
|
+
quantity: z.string().optional(),
|
|
45
|
+
});
|
|
46
|
+
/** @internal */
|
|
47
|
+
export type CreatePaymentLinkLineItemValidationError$Outbound = {
|
|
48
|
+
productID?: string | undefined;
|
|
49
|
+
name?: string | undefined;
|
|
50
|
+
basePrice?: AmountDecimalValidationError$Outbound | undefined;
|
|
51
|
+
options?: {
|
|
52
|
+
[k: string]: CreatePaymentLinkLineItemOptionValidationError$Outbound;
|
|
53
|
+
} | undefined;
|
|
54
|
+
quantity?: string | undefined;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** @internal */
|
|
58
|
+
export const CreatePaymentLinkLineItemValidationError$outboundSchema: z.ZodType<
|
|
59
|
+
CreatePaymentLinkLineItemValidationError$Outbound,
|
|
60
|
+
z.ZodTypeDef,
|
|
61
|
+
CreatePaymentLinkLineItemValidationError
|
|
62
|
+
> = z.object({
|
|
63
|
+
productID: z.string().optional(),
|
|
64
|
+
name: z.string().optional(),
|
|
65
|
+
basePrice: AmountDecimalValidationError$outboundSchema.optional(),
|
|
66
|
+
options: z.record(
|
|
67
|
+
CreatePaymentLinkLineItemOptionValidationError$outboundSchema,
|
|
68
|
+
).optional(),
|
|
69
|
+
quantity: z.string().optional(),
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export function createPaymentLinkLineItemValidationErrorToJSON(
|
|
73
|
+
createPaymentLinkLineItemValidationError:
|
|
74
|
+
CreatePaymentLinkLineItemValidationError,
|
|
75
|
+
): string {
|
|
76
|
+
return JSON.stringify(
|
|
77
|
+
CreatePaymentLinkLineItemValidationError$outboundSchema.parse(
|
|
78
|
+
createPaymentLinkLineItemValidationError,
|
|
79
|
+
),
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
export function createPaymentLinkLineItemValidationErrorFromJSON(
|
|
83
|
+
jsonString: string,
|
|
84
|
+
): SafeParseResult<
|
|
85
|
+
CreatePaymentLinkLineItemValidationError,
|
|
86
|
+
SDKValidationError
|
|
87
|
+
> {
|
|
88
|
+
return safeParse(
|
|
89
|
+
jsonString,
|
|
90
|
+
(x) =>
|
|
91
|
+
CreatePaymentLinkLineItemValidationError$inboundSchema.parse(
|
|
92
|
+
JSON.parse(x),
|
|
93
|
+
),
|
|
94
|
+
`Failed to parse 'CreatePaymentLinkLineItemValidationError' from JSON`,
|
|
95
|
+
);
|
|
96
|
+
}
|
|
@@ -144,6 +144,13 @@ export * from "./createindividualerror.js";
|
|
|
144
144
|
export * from "./createindividualprofile.js";
|
|
145
145
|
export * from "./createinvoice.js";
|
|
146
146
|
export * from "./createpaymentlink.js";
|
|
147
|
+
export * from "./createpaymentlinklineitem.js";
|
|
148
|
+
export * from "./createpaymentlinklineitemoption.js";
|
|
149
|
+
export * from "./createpaymentlinklineitemoptionvalidationerror.js";
|
|
150
|
+
export * from "./createpaymentlinklineitems.js";
|
|
151
|
+
export * from "./createpaymentlinklineitemsupdate.js";
|
|
152
|
+
export * from "./createpaymentlinklineitemsvalidationerror.js";
|
|
153
|
+
export * from "./createpaymentlinklineitemvalidationerror.js";
|
|
147
154
|
export * from "./createproductoption.js";
|
|
148
155
|
export * from "./createproductoptiongroup.js";
|
|
149
156
|
export * from "./createprofile.js";
|
|
@@ -316,12 +323,9 @@ export * from "./paymentlinkcustomeroptions.js";
|
|
|
316
323
|
export * from "./paymentlinkdisplayoptions.js";
|
|
317
324
|
export * from "./paymentlinkdisplayoptionsupdate.js";
|
|
318
325
|
export * from "./paymentlinklineitem.js";
|
|
326
|
+
export * from "./paymentlinklineitemimagemetadata.js";
|
|
319
327
|
export * from "./paymentlinklineitemoption.js";
|
|
320
|
-
export * from "./paymentlinklineitemoptionvalidationerror.js";
|
|
321
328
|
export * from "./paymentlinklineitems.js";
|
|
322
|
-
export * from "./paymentlinklineitemsupdate.js";
|
|
323
|
-
export * from "./paymentlinklineitemsvalidationerror.js";
|
|
324
|
-
export * from "./paymentlinklineitemvalidationerror.js";
|
|
325
329
|
export * from "./paymentlinkpaymentdetails.js";
|
|
326
330
|
export * from "./paymentlinkpaymentdetailsupdate.js";
|
|
327
331
|
export * from "./paymentlinkpayoutdetails.js";
|
|
@@ -12,6 +12,12 @@ import {
|
|
|
12
12
|
AmountDecimal$Outbound,
|
|
13
13
|
AmountDecimal$outboundSchema,
|
|
14
14
|
} from "./amountdecimal.js";
|
|
15
|
+
import {
|
|
16
|
+
PaymentLinkLineItemImageMetadata,
|
|
17
|
+
PaymentLinkLineItemImageMetadata$inboundSchema,
|
|
18
|
+
PaymentLinkLineItemImageMetadata$Outbound,
|
|
19
|
+
PaymentLinkLineItemImageMetadata$outboundSchema,
|
|
20
|
+
} from "./paymentlinklineitemimagemetadata.js";
|
|
15
21
|
import {
|
|
16
22
|
PaymentLinkLineItemOption,
|
|
17
23
|
PaymentLinkLineItemOption$inboundSchema,
|
|
@@ -39,6 +45,10 @@ export type PaymentLinkLineItem = {
|
|
|
39
45
|
* Optional list of modifiers applied to this item (e.g., toppings, upgrades, customizations).
|
|
40
46
|
*/
|
|
41
47
|
options?: Array<PaymentLinkLineItemOption> | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Optional list of images associated with this line item.
|
|
50
|
+
*/
|
|
51
|
+
images?: Array<PaymentLinkLineItemImageMetadata> | undefined;
|
|
42
52
|
/**
|
|
43
53
|
* Optional unique identifier associating the line item with a product.
|
|
44
54
|
*/
|
|
@@ -55,6 +65,7 @@ export const PaymentLinkLineItem$inboundSchema: z.ZodType<
|
|
|
55
65
|
basePrice: AmountDecimal$inboundSchema,
|
|
56
66
|
quantity: z.number().int(),
|
|
57
67
|
options: z.array(PaymentLinkLineItemOption$inboundSchema).optional(),
|
|
68
|
+
images: z.array(PaymentLinkLineItemImageMetadata$inboundSchema).optional(),
|
|
58
69
|
productID: z.string().optional(),
|
|
59
70
|
});
|
|
60
71
|
/** @internal */
|
|
@@ -63,6 +74,7 @@ export type PaymentLinkLineItem$Outbound = {
|
|
|
63
74
|
basePrice: AmountDecimal$Outbound;
|
|
64
75
|
quantity: number;
|
|
65
76
|
options?: Array<PaymentLinkLineItemOption$Outbound> | undefined;
|
|
77
|
+
images?: Array<PaymentLinkLineItemImageMetadata$Outbound> | undefined;
|
|
66
78
|
productID?: string | undefined;
|
|
67
79
|
};
|
|
68
80
|
|
|
@@ -76,6 +88,7 @@ export const PaymentLinkLineItem$outboundSchema: z.ZodType<
|
|
|
76
88
|
basePrice: AmountDecimal$outboundSchema,
|
|
77
89
|
quantity: z.number().int(),
|
|
78
90
|
options: z.array(PaymentLinkLineItemOption$outboundSchema).optional(),
|
|
91
|
+
images: z.array(PaymentLinkLineItemImageMetadata$outboundSchema).optional(),
|
|
79
92
|
productID: z.string().optional(),
|
|
80
93
|
});
|
|
81
94
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type PaymentLinkLineItemImageMetadata = {
|
|
11
|
+
/**
|
|
12
|
+
* Unique identifier for a image resource.
|
|
13
|
+
*/
|
|
14
|
+
imageID: string;
|
|
15
|
+
/**
|
|
16
|
+
* Alternative text for the image.
|
|
17
|
+
*/
|
|
18
|
+
altText?: string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* The image's public URL.
|
|
21
|
+
*/
|
|
22
|
+
link: string;
|
|
23
|
+
/**
|
|
24
|
+
* A unique identifier for an image, used in public image links.
|
|
25
|
+
*/
|
|
26
|
+
publicID: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** @internal */
|
|
30
|
+
export const PaymentLinkLineItemImageMetadata$inboundSchema: z.ZodType<
|
|
31
|
+
PaymentLinkLineItemImageMetadata,
|
|
32
|
+
z.ZodTypeDef,
|
|
33
|
+
unknown
|
|
34
|
+
> = z.object({
|
|
35
|
+
imageID: z.string(),
|
|
36
|
+
altText: z.string().optional(),
|
|
37
|
+
link: z.string(),
|
|
38
|
+
publicID: z.string(),
|
|
39
|
+
});
|
|
40
|
+
/** @internal */
|
|
41
|
+
export type PaymentLinkLineItemImageMetadata$Outbound = {
|
|
42
|
+
imageID: string;
|
|
43
|
+
altText?: string | undefined;
|
|
44
|
+
link: string;
|
|
45
|
+
publicID: string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** @internal */
|
|
49
|
+
export const PaymentLinkLineItemImageMetadata$outboundSchema: z.ZodType<
|
|
50
|
+
PaymentLinkLineItemImageMetadata$Outbound,
|
|
51
|
+
z.ZodTypeDef,
|
|
52
|
+
PaymentLinkLineItemImageMetadata
|
|
53
|
+
> = z.object({
|
|
54
|
+
imageID: z.string(),
|
|
55
|
+
altText: z.string().optional(),
|
|
56
|
+
link: z.string(),
|
|
57
|
+
publicID: z.string(),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export function paymentLinkLineItemImageMetadataToJSON(
|
|
61
|
+
paymentLinkLineItemImageMetadata: PaymentLinkLineItemImageMetadata,
|
|
62
|
+
): string {
|
|
63
|
+
return JSON.stringify(
|
|
64
|
+
PaymentLinkLineItemImageMetadata$outboundSchema.parse(
|
|
65
|
+
paymentLinkLineItemImageMetadata,
|
|
66
|
+
),
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
export function paymentLinkLineItemImageMetadataFromJSON(
|
|
70
|
+
jsonString: string,
|
|
71
|
+
): SafeParseResult<PaymentLinkLineItemImageMetadata, SDKValidationError> {
|
|
72
|
+
return safeParse(
|
|
73
|
+
jsonString,
|
|
74
|
+
(x) => PaymentLinkLineItemImageMetadata$inboundSchema.parse(JSON.parse(x)),
|
|
75
|
+
`Failed to parse 'PaymentLinkLineItemImageMetadata' from JSON`,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -12,6 +12,12 @@ import {
|
|
|
12
12
|
AmountDecimal$Outbound,
|
|
13
13
|
AmountDecimal$outboundSchema,
|
|
14
14
|
} from "./amountdecimal.js";
|
|
15
|
+
import {
|
|
16
|
+
PaymentLinkLineItemImageMetadata,
|
|
17
|
+
PaymentLinkLineItemImageMetadata$inboundSchema,
|
|
18
|
+
PaymentLinkLineItemImageMetadata$Outbound,
|
|
19
|
+
PaymentLinkLineItemImageMetadata$outboundSchema,
|
|
20
|
+
} from "./paymentlinklineitemimagemetadata.js";
|
|
15
21
|
|
|
16
22
|
/**
|
|
17
23
|
* Represents a modifier or option applied to a line item.
|
|
@@ -29,6 +35,10 @@ export type PaymentLinkLineItemOption = {
|
|
|
29
35
|
* Optional price modification applied by this option. Can be positive, negative, or zero.
|
|
30
36
|
*/
|
|
31
37
|
priceModifier?: AmountDecimal | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Optional list of images associated with this line item option.
|
|
40
|
+
*/
|
|
41
|
+
images?: Array<PaymentLinkLineItemImageMetadata> | undefined;
|
|
32
42
|
/**
|
|
33
43
|
* Optional group identifier to categorize related options (e.g., 'toppings').
|
|
34
44
|
*/
|
|
@@ -44,6 +54,7 @@ export const PaymentLinkLineItemOption$inboundSchema: z.ZodType<
|
|
|
44
54
|
name: z.string(),
|
|
45
55
|
quantity: z.number().int(),
|
|
46
56
|
priceModifier: AmountDecimal$inboundSchema.optional(),
|
|
57
|
+
images: z.array(PaymentLinkLineItemImageMetadata$inboundSchema).optional(),
|
|
47
58
|
group: z.string().optional(),
|
|
48
59
|
});
|
|
49
60
|
/** @internal */
|
|
@@ -51,6 +62,7 @@ export type PaymentLinkLineItemOption$Outbound = {
|
|
|
51
62
|
name: string;
|
|
52
63
|
quantity: number;
|
|
53
64
|
priceModifier?: AmountDecimal$Outbound | undefined;
|
|
65
|
+
images?: Array<PaymentLinkLineItemImageMetadata$Outbound> | undefined;
|
|
54
66
|
group?: string | undefined;
|
|
55
67
|
};
|
|
56
68
|
|
|
@@ -63,6 +75,7 @@ export const PaymentLinkLineItemOption$outboundSchema: z.ZodType<
|
|
|
63
75
|
name: z.string(),
|
|
64
76
|
quantity: z.number().int(),
|
|
65
77
|
priceModifier: AmountDecimal$outboundSchema.optional(),
|
|
78
|
+
images: z.array(PaymentLinkLineItemImageMetadata$outboundSchema).optional(),
|
|
66
79
|
group: z.string().optional(),
|
|
67
80
|
});
|
|
68
81
|
|
|
@@ -12,6 +12,12 @@ import {
|
|
|
12
12
|
AmountUpdate$Outbound,
|
|
13
13
|
AmountUpdate$outboundSchema,
|
|
14
14
|
} from "./amountupdate.js";
|
|
15
|
+
import {
|
|
16
|
+
CreatePaymentLinkLineItemsUpdate,
|
|
17
|
+
CreatePaymentLinkLineItemsUpdate$inboundSchema,
|
|
18
|
+
CreatePaymentLinkLineItemsUpdate$Outbound,
|
|
19
|
+
CreatePaymentLinkLineItemsUpdate$outboundSchema,
|
|
20
|
+
} from "./createpaymentlinklineitemsupdate.js";
|
|
15
21
|
import {
|
|
16
22
|
PaymentLinkCustomerOptions,
|
|
17
23
|
PaymentLinkCustomerOptions$inboundSchema,
|
|
@@ -24,12 +30,6 @@ import {
|
|
|
24
30
|
PaymentLinkDisplayOptionsUpdate$Outbound,
|
|
25
31
|
PaymentLinkDisplayOptionsUpdate$outboundSchema,
|
|
26
32
|
} from "./paymentlinkdisplayoptionsupdate.js";
|
|
27
|
-
import {
|
|
28
|
-
PaymentLinkLineItemsUpdate,
|
|
29
|
-
PaymentLinkLineItemsUpdate$inboundSchema,
|
|
30
|
-
PaymentLinkLineItemsUpdate$Outbound,
|
|
31
|
-
PaymentLinkLineItemsUpdate$outboundSchema,
|
|
32
|
-
} from "./paymentlinklineitemsupdate.js";
|
|
33
33
|
import {
|
|
34
34
|
PaymentLinkPaymentDetailsUpdate,
|
|
35
35
|
PaymentLinkPaymentDetailsUpdate$inboundSchema,
|
|
@@ -62,7 +62,7 @@ export type UpdatePaymentLink = {
|
|
|
62
62
|
* @remarks
|
|
63
63
|
* When line items are provided, their total plus sales tax must equal the payment link amount.
|
|
64
64
|
*/
|
|
65
|
-
lineItems?:
|
|
65
|
+
lineItems?: CreatePaymentLinkLineItemsUpdate | undefined;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
/** @internal */
|
|
@@ -79,7 +79,7 @@ export const UpdatePaymentLink$inboundSchema: z.ZodType<
|
|
|
79
79
|
customer: PaymentLinkCustomerOptions$inboundSchema.optional(),
|
|
80
80
|
payment: PaymentLinkPaymentDetailsUpdate$inboundSchema.optional(),
|
|
81
81
|
payout: PaymentLinkPayoutDetailsUpdate$inboundSchema.optional(),
|
|
82
|
-
lineItems:
|
|
82
|
+
lineItems: CreatePaymentLinkLineItemsUpdate$inboundSchema.optional(),
|
|
83
83
|
});
|
|
84
84
|
/** @internal */
|
|
85
85
|
export type UpdatePaymentLink$Outbound = {
|
|
@@ -89,7 +89,7 @@ export type UpdatePaymentLink$Outbound = {
|
|
|
89
89
|
customer?: PaymentLinkCustomerOptions$Outbound | undefined;
|
|
90
90
|
payment?: PaymentLinkPaymentDetailsUpdate$Outbound | undefined;
|
|
91
91
|
payout?: PaymentLinkPayoutDetailsUpdate$Outbound | undefined;
|
|
92
|
-
lineItems?:
|
|
92
|
+
lineItems?: CreatePaymentLinkLineItemsUpdate$Outbound | undefined;
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
/** @internal */
|
|
@@ -104,7 +104,7 @@ export const UpdatePaymentLink$outboundSchema: z.ZodType<
|
|
|
104
104
|
customer: PaymentLinkCustomerOptions$outboundSchema.optional(),
|
|
105
105
|
payment: PaymentLinkPaymentDetailsUpdate$outboundSchema.optional(),
|
|
106
106
|
payout: PaymentLinkPayoutDetailsUpdate$outboundSchema.optional(),
|
|
107
|
-
lineItems:
|
|
107
|
+
lineItems: CreatePaymentLinkLineItemsUpdate$outboundSchema.optional(),
|
|
108
108
|
});
|
|
109
109
|
|
|
110
110
|
export function updatePaymentLinkToJSON(
|
|
@@ -15,7 +15,7 @@ export type CreatePaymentLinkErrorData = {
|
|
|
15
15
|
display?: components.DisplayOptionsError | undefined;
|
|
16
16
|
payment?: components.PaymentDetailsError | undefined;
|
|
17
17
|
payout?: components.PayoutDetailsError | undefined;
|
|
18
|
-
lineItems?: components.
|
|
18
|
+
lineItems?: components.CreatePaymentLinkLineItemsValidationError | undefined;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export class CreatePaymentLinkError extends MoovError {
|
|
@@ -27,7 +27,7 @@ export class CreatePaymentLinkError extends MoovError {
|
|
|
27
27
|
display?: components.DisplayOptionsError | undefined;
|
|
28
28
|
payment?: components.PaymentDetailsError | undefined;
|
|
29
29
|
payout?: components.PayoutDetailsError | undefined;
|
|
30
|
-
lineItems?: components.
|
|
30
|
+
lineItems?: components.CreatePaymentLinkLineItemsValidationError | undefined;
|
|
31
31
|
|
|
32
32
|
/** The original data that was passed to this error instance. */
|
|
33
33
|
data$: CreatePaymentLinkErrorData;
|
|
@@ -73,7 +73,7 @@ export const CreatePaymentLinkError$inboundSchema: z.ZodType<
|
|
|
73
73
|
display: components.DisplayOptionsError$inboundSchema.optional(),
|
|
74
74
|
payment: components.PaymentDetailsError$inboundSchema.optional(),
|
|
75
75
|
payout: components.PayoutDetailsError$inboundSchema.optional(),
|
|
76
|
-
lineItems: components.
|
|
76
|
+
lineItems: components.CreatePaymentLinkLineItemsValidationError$inboundSchema
|
|
77
77
|
.optional(),
|
|
78
78
|
request$: z.instanceof(Request),
|
|
79
79
|
response$: z.instanceof(Response),
|
|
@@ -98,7 +98,7 @@ export type CreatePaymentLinkError$Outbound = {
|
|
|
98
98
|
payment?: components.PaymentDetailsError$Outbound | undefined;
|
|
99
99
|
payout?: components.PayoutDetailsError$Outbound | undefined;
|
|
100
100
|
lineItems?:
|
|
101
|
-
| components.
|
|
101
|
+
| components.CreatePaymentLinkLineItemsValidationError$Outbound
|
|
102
102
|
| undefined;
|
|
103
103
|
};
|
|
104
104
|
|
|
@@ -118,6 +118,6 @@ export const CreatePaymentLinkError$outboundSchema: z.ZodType<
|
|
|
118
118
|
display: components.DisplayOptionsError$outboundSchema.optional(),
|
|
119
119
|
payment: components.PaymentDetailsError$outboundSchema.optional(),
|
|
120
120
|
payout: components.PayoutDetailsError$outboundSchema.optional(),
|
|
121
|
-
lineItems: components
|
|
122
|
-
.optional(),
|
|
121
|
+
lineItems: components
|
|
122
|
+
.CreatePaymentLinkLineItemsValidationError$outboundSchema.optional(),
|
|
123
123
|
}));
|
|
@@ -12,7 +12,7 @@ export type UpdatePaymentLinkErrorData = {
|
|
|
12
12
|
display?: components.DisplayOptionsError | undefined;
|
|
13
13
|
payment?: components.PaymentDetailsError | undefined;
|
|
14
14
|
payout?: components.PayoutDetailsError | undefined;
|
|
15
|
-
lineItems?: components.
|
|
15
|
+
lineItems?: components.CreatePaymentLinkLineItemsValidationError | undefined;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export class UpdatePaymentLinkError extends MoovError {
|
|
@@ -21,7 +21,7 @@ export class UpdatePaymentLinkError extends MoovError {
|
|
|
21
21
|
display?: components.DisplayOptionsError | undefined;
|
|
22
22
|
payment?: components.PaymentDetailsError | undefined;
|
|
23
23
|
payout?: components.PayoutDetailsError | undefined;
|
|
24
|
-
lineItems?: components.
|
|
24
|
+
lineItems?: components.CreatePaymentLinkLineItemsValidationError | undefined;
|
|
25
25
|
|
|
26
26
|
/** The original data that was passed to this error instance. */
|
|
27
27
|
data$: UpdatePaymentLinkErrorData;
|
|
@@ -57,7 +57,7 @@ export const UpdatePaymentLinkError$inboundSchema: z.ZodType<
|
|
|
57
57
|
display: components.DisplayOptionsError$inboundSchema.optional(),
|
|
58
58
|
payment: components.PaymentDetailsError$inboundSchema.optional(),
|
|
59
59
|
payout: components.PayoutDetailsError$inboundSchema.optional(),
|
|
60
|
-
lineItems: components.
|
|
60
|
+
lineItems: components.CreatePaymentLinkLineItemsValidationError$inboundSchema
|
|
61
61
|
.optional(),
|
|
62
62
|
request$: z.instanceof(Request),
|
|
63
63
|
response$: z.instanceof(Response),
|
|
@@ -79,7 +79,7 @@ export type UpdatePaymentLinkError$Outbound = {
|
|
|
79
79
|
payment?: components.PaymentDetailsError$Outbound | undefined;
|
|
80
80
|
payout?: components.PayoutDetailsError$Outbound | undefined;
|
|
81
81
|
lineItems?:
|
|
82
|
-
| components.
|
|
82
|
+
| components.CreatePaymentLinkLineItemsValidationError$Outbound
|
|
83
83
|
| undefined;
|
|
84
84
|
};
|
|
85
85
|
|
|
@@ -96,6 +96,6 @@ export const UpdatePaymentLinkError$outboundSchema: z.ZodType<
|
|
|
96
96
|
display: components.DisplayOptionsError$outboundSchema.optional(),
|
|
97
97
|
payment: components.PaymentDetailsError$outboundSchema.optional(),
|
|
98
98
|
payout: components.PayoutDetailsError$outboundSchema.optional(),
|
|
99
|
-
lineItems: components
|
|
100
|
-
.optional(),
|
|
99
|
+
lineItems: components
|
|
100
|
+
.CreatePaymentLinkLineItemsValidationError$outboundSchema.optional(),
|
|
101
101
|
}));
|
package/src/types/enums.ts
CHANGED
|
@@ -3,34 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
|
+
import { Unrecognized, unrecognized } from "./unrecognized.js";
|
|
6
7
|
|
|
7
|
-
declare const __brand: unique symbol;
|
|
8
|
-
export type Unrecognized<T> = T & { [__brand]: "unrecognized" };
|
|
9
8
|
export type ClosedEnum<T extends Readonly<Record<string, string | number>>> =
|
|
10
9
|
T[keyof T];
|
|
11
10
|
export type OpenEnum<T extends Readonly<Record<string, string | number>>> =
|
|
12
11
|
| T[keyof T]
|
|
13
12
|
| Unrecognized<T[keyof T] extends number ? number : string>;
|
|
14
13
|
|
|
15
|
-
function unrecognized<T>(value: T): Unrecognized<T> {
|
|
16
|
-
unrecognizedCount++;
|
|
17
|
-
return value as Unrecognized<T>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
let unrecognizedCount = 0;
|
|
21
|
-
let refCount = 0;
|
|
22
|
-
export function unrecognizedCounter() {
|
|
23
|
-
refCount++;
|
|
24
|
-
const start = unrecognizedCount;
|
|
25
|
-
return {
|
|
26
|
-
count: () => {
|
|
27
|
-
const count = unrecognizedCount - start;
|
|
28
|
-
if (--refCount === 0) unrecognizedCount = 0;
|
|
29
|
-
return count;
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
14
|
export function inboundSchema<T extends Record<string, string>>(
|
|
35
15
|
enumObj: T,
|
|
36
16
|
): z.ZodType<OpenEnum<T>, z.ZodTypeDef, unknown> {
|