@automate.ax/integration-contracts 0.119.1 → 0.119.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/dist/gmail/gmail.js +2 -3
- package/dist/gmail/schemas.d.ts +2 -208
- package/dist/gmail/schemas.js +7 -1
- package/dist/tidycal/schemas.d.ts +3 -3
- package/dist/tidycal/schemas.js +12 -3
- package/package.json +2 -2
- package/src/gmail/gmail.ts +2 -3
- package/src/gmail/schemas.ts +8 -1
- package/src/tidycal/schemas.ts +12 -3
package/dist/gmail/gmail.js
CHANGED
|
@@ -3,7 +3,6 @@ import { compile } from "html-to-text";
|
|
|
3
3
|
import MailComposer from "nodemailer/lib/mail-composer";
|
|
4
4
|
import PostalMime, { addressParser, } from "postal-mime";
|
|
5
5
|
import * as z from "zod";
|
|
6
|
-
import { LABEL_COLOR_SCHEMA, } from "./schemas.js";
|
|
7
6
|
export const AUTOMATE_AX_EMAIL_HEADER = "X-Sent-From-Automate-Ax";
|
|
8
7
|
const AUTOMATE_AX_EMAIL_HEADER_LOWERCASE = AUTOMATE_AX_EMAIL_HEADER.toLowerCase();
|
|
9
8
|
const AUTOMATE_EMAIL_HEADERS = {
|
|
@@ -337,10 +336,10 @@ export function toGmailLabel(label) {
|
|
|
337
336
|
return {
|
|
338
337
|
...(label.color?.backgroundColor &&
|
|
339
338
|
label.color.textColor && {
|
|
340
|
-
color:
|
|
339
|
+
color: {
|
|
341
340
|
backgroundColor: label.color.backgroundColor,
|
|
342
341
|
textColor: label.color.textColor,
|
|
343
|
-
}
|
|
342
|
+
},
|
|
344
343
|
}),
|
|
345
344
|
labelId: label.id,
|
|
346
345
|
labelListVisibility: label.labelListVisibility
|
package/dist/gmail/schemas.d.ts
CHANGED
|
@@ -823,214 +823,8 @@ export declare const DRAFT_SCHEMA: z.ZodObject<{
|
|
|
823
823
|
}, z.core.$strip>;
|
|
824
824
|
export declare const LABEL_SCHEMA: z.ZodObject<{
|
|
825
825
|
color: z.ZodOptional<z.ZodObject<{
|
|
826
|
-
backgroundColor: z.
|
|
827
|
-
|
|
828
|
-
"#434343": "#434343";
|
|
829
|
-
"#666666": "#666666";
|
|
830
|
-
"#999999": "#999999";
|
|
831
|
-
"#cccccc": "#cccccc";
|
|
832
|
-
"#efefef": "#efefef";
|
|
833
|
-
"#f3f3f3": "#f3f3f3";
|
|
834
|
-
"#ffffff": "#ffffff";
|
|
835
|
-
"#fb4c2f": "#fb4c2f";
|
|
836
|
-
"#ffad47": "#ffad47";
|
|
837
|
-
"#fad165": "#fad165";
|
|
838
|
-
"#16a766": "#16a766";
|
|
839
|
-
"#43d692": "#43d692";
|
|
840
|
-
"#4a86e8": "#4a86e8";
|
|
841
|
-
"#a479e2": "#a479e2";
|
|
842
|
-
"#f691b3": "#f691b3";
|
|
843
|
-
"#f6c5be": "#f6c5be";
|
|
844
|
-
"#ffe6c7": "#ffe6c7";
|
|
845
|
-
"#fef1d1": "#fef1d1";
|
|
846
|
-
"#b9e4d0": "#b9e4d0";
|
|
847
|
-
"#c6f3de": "#c6f3de";
|
|
848
|
-
"#c9daf8": "#c9daf8";
|
|
849
|
-
"#e4d7f5": "#e4d7f5";
|
|
850
|
-
"#fcdee8": "#fcdee8";
|
|
851
|
-
"#efa093": "#efa093";
|
|
852
|
-
"#ffd6a2": "#ffd6a2";
|
|
853
|
-
"#fce8b3": "#fce8b3";
|
|
854
|
-
"#89d3b2": "#89d3b2";
|
|
855
|
-
"#a0eac9": "#a0eac9";
|
|
856
|
-
"#a4c2f4": "#a4c2f4";
|
|
857
|
-
"#d0bcf1": "#d0bcf1";
|
|
858
|
-
"#fbc8d9": "#fbc8d9";
|
|
859
|
-
"#e66550": "#e66550";
|
|
860
|
-
"#ffbc6b": "#ffbc6b";
|
|
861
|
-
"#fcda83": "#fcda83";
|
|
862
|
-
"#44b984": "#44b984";
|
|
863
|
-
"#68dfa9": "#68dfa9";
|
|
864
|
-
"#6d9eeb": "#6d9eeb";
|
|
865
|
-
"#b694e8": "#b694e8";
|
|
866
|
-
"#f7a7c0": "#f7a7c0";
|
|
867
|
-
"#cc3a21": "#cc3a21";
|
|
868
|
-
"#eaa041": "#eaa041";
|
|
869
|
-
"#f2c960": "#f2c960";
|
|
870
|
-
"#149e60": "#149e60";
|
|
871
|
-
"#3dc789": "#3dc789";
|
|
872
|
-
"#3c78d8": "#3c78d8";
|
|
873
|
-
"#8e63ce": "#8e63ce";
|
|
874
|
-
"#e07798": "#e07798";
|
|
875
|
-
"#ac2b16": "#ac2b16";
|
|
876
|
-
"#cf8933": "#cf8933";
|
|
877
|
-
"#d5ae49": "#d5ae49";
|
|
878
|
-
"#0b804b": "#0b804b";
|
|
879
|
-
"#2a9c68": "#2a9c68";
|
|
880
|
-
"#285bac": "#285bac";
|
|
881
|
-
"#653e9b": "#653e9b";
|
|
882
|
-
"#b65775": "#b65775";
|
|
883
|
-
"#822111": "#822111";
|
|
884
|
-
"#a46a21": "#a46a21";
|
|
885
|
-
"#aa8831": "#aa8831";
|
|
886
|
-
"#076239": "#076239";
|
|
887
|
-
"#1a764d": "#1a764d";
|
|
888
|
-
"#1c4587": "#1c4587";
|
|
889
|
-
"#41236d": "#41236d";
|
|
890
|
-
"#83334c": "#83334c";
|
|
891
|
-
"#464646": "#464646";
|
|
892
|
-
"#e7e7e7": "#e7e7e7";
|
|
893
|
-
"#0d3472": "#0d3472";
|
|
894
|
-
"#b6cff5": "#b6cff5";
|
|
895
|
-
"#0d3b44": "#0d3b44";
|
|
896
|
-
"#98d7e4": "#98d7e4";
|
|
897
|
-
"#3d188e": "#3d188e";
|
|
898
|
-
"#e3d7ff": "#e3d7ff";
|
|
899
|
-
"#711a36": "#711a36";
|
|
900
|
-
"#fbd3e0": "#fbd3e0";
|
|
901
|
-
"#8a1c0a": "#8a1c0a";
|
|
902
|
-
"#f2b2a8": "#f2b2a8";
|
|
903
|
-
"#7a2e0b": "#7a2e0b";
|
|
904
|
-
"#ffc8af": "#ffc8af";
|
|
905
|
-
"#7a4706": "#7a4706";
|
|
906
|
-
"#ffdeb5": "#ffdeb5";
|
|
907
|
-
"#594c05": "#594c05";
|
|
908
|
-
"#fbe983": "#fbe983";
|
|
909
|
-
"#684e07": "#684e07";
|
|
910
|
-
"#fdedc1": "#fdedc1";
|
|
911
|
-
"#0b4f30": "#0b4f30";
|
|
912
|
-
"#b3efd3": "#b3efd3";
|
|
913
|
-
"#04502e": "#04502e";
|
|
914
|
-
"#a2dcc1": "#a2dcc1";
|
|
915
|
-
"#c2c2c2": "#c2c2c2";
|
|
916
|
-
"#4986e7": "#4986e7";
|
|
917
|
-
"#2da2bb": "#2da2bb";
|
|
918
|
-
"#b99aff": "#b99aff";
|
|
919
|
-
"#994a64": "#994a64";
|
|
920
|
-
"#f691b2": "#f691b2";
|
|
921
|
-
"#ff7537": "#ff7537";
|
|
922
|
-
"#ffad46": "#ffad46";
|
|
923
|
-
"#662e37": "#662e37";
|
|
924
|
-
"#ebdbde": "#ebdbde";
|
|
925
|
-
"#cca6ac": "#cca6ac";
|
|
926
|
-
"#094228": "#094228";
|
|
927
|
-
"#42d692": "#42d692";
|
|
928
|
-
"#16a765": "#16a765";
|
|
929
|
-
}>;
|
|
930
|
-
textColor: z.ZodEnum<{
|
|
931
|
-
"#000000": "#000000";
|
|
932
|
-
"#434343": "#434343";
|
|
933
|
-
"#666666": "#666666";
|
|
934
|
-
"#999999": "#999999";
|
|
935
|
-
"#cccccc": "#cccccc";
|
|
936
|
-
"#efefef": "#efefef";
|
|
937
|
-
"#f3f3f3": "#f3f3f3";
|
|
938
|
-
"#ffffff": "#ffffff";
|
|
939
|
-
"#fb4c2f": "#fb4c2f";
|
|
940
|
-
"#ffad47": "#ffad47";
|
|
941
|
-
"#fad165": "#fad165";
|
|
942
|
-
"#16a766": "#16a766";
|
|
943
|
-
"#43d692": "#43d692";
|
|
944
|
-
"#4a86e8": "#4a86e8";
|
|
945
|
-
"#a479e2": "#a479e2";
|
|
946
|
-
"#f691b3": "#f691b3";
|
|
947
|
-
"#f6c5be": "#f6c5be";
|
|
948
|
-
"#ffe6c7": "#ffe6c7";
|
|
949
|
-
"#fef1d1": "#fef1d1";
|
|
950
|
-
"#b9e4d0": "#b9e4d0";
|
|
951
|
-
"#c6f3de": "#c6f3de";
|
|
952
|
-
"#c9daf8": "#c9daf8";
|
|
953
|
-
"#e4d7f5": "#e4d7f5";
|
|
954
|
-
"#fcdee8": "#fcdee8";
|
|
955
|
-
"#efa093": "#efa093";
|
|
956
|
-
"#ffd6a2": "#ffd6a2";
|
|
957
|
-
"#fce8b3": "#fce8b3";
|
|
958
|
-
"#89d3b2": "#89d3b2";
|
|
959
|
-
"#a0eac9": "#a0eac9";
|
|
960
|
-
"#a4c2f4": "#a4c2f4";
|
|
961
|
-
"#d0bcf1": "#d0bcf1";
|
|
962
|
-
"#fbc8d9": "#fbc8d9";
|
|
963
|
-
"#e66550": "#e66550";
|
|
964
|
-
"#ffbc6b": "#ffbc6b";
|
|
965
|
-
"#fcda83": "#fcda83";
|
|
966
|
-
"#44b984": "#44b984";
|
|
967
|
-
"#68dfa9": "#68dfa9";
|
|
968
|
-
"#6d9eeb": "#6d9eeb";
|
|
969
|
-
"#b694e8": "#b694e8";
|
|
970
|
-
"#f7a7c0": "#f7a7c0";
|
|
971
|
-
"#cc3a21": "#cc3a21";
|
|
972
|
-
"#eaa041": "#eaa041";
|
|
973
|
-
"#f2c960": "#f2c960";
|
|
974
|
-
"#149e60": "#149e60";
|
|
975
|
-
"#3dc789": "#3dc789";
|
|
976
|
-
"#3c78d8": "#3c78d8";
|
|
977
|
-
"#8e63ce": "#8e63ce";
|
|
978
|
-
"#e07798": "#e07798";
|
|
979
|
-
"#ac2b16": "#ac2b16";
|
|
980
|
-
"#cf8933": "#cf8933";
|
|
981
|
-
"#d5ae49": "#d5ae49";
|
|
982
|
-
"#0b804b": "#0b804b";
|
|
983
|
-
"#2a9c68": "#2a9c68";
|
|
984
|
-
"#285bac": "#285bac";
|
|
985
|
-
"#653e9b": "#653e9b";
|
|
986
|
-
"#b65775": "#b65775";
|
|
987
|
-
"#822111": "#822111";
|
|
988
|
-
"#a46a21": "#a46a21";
|
|
989
|
-
"#aa8831": "#aa8831";
|
|
990
|
-
"#076239": "#076239";
|
|
991
|
-
"#1a764d": "#1a764d";
|
|
992
|
-
"#1c4587": "#1c4587";
|
|
993
|
-
"#41236d": "#41236d";
|
|
994
|
-
"#83334c": "#83334c";
|
|
995
|
-
"#464646": "#464646";
|
|
996
|
-
"#e7e7e7": "#e7e7e7";
|
|
997
|
-
"#0d3472": "#0d3472";
|
|
998
|
-
"#b6cff5": "#b6cff5";
|
|
999
|
-
"#0d3b44": "#0d3b44";
|
|
1000
|
-
"#98d7e4": "#98d7e4";
|
|
1001
|
-
"#3d188e": "#3d188e";
|
|
1002
|
-
"#e3d7ff": "#e3d7ff";
|
|
1003
|
-
"#711a36": "#711a36";
|
|
1004
|
-
"#fbd3e0": "#fbd3e0";
|
|
1005
|
-
"#8a1c0a": "#8a1c0a";
|
|
1006
|
-
"#f2b2a8": "#f2b2a8";
|
|
1007
|
-
"#7a2e0b": "#7a2e0b";
|
|
1008
|
-
"#ffc8af": "#ffc8af";
|
|
1009
|
-
"#7a4706": "#7a4706";
|
|
1010
|
-
"#ffdeb5": "#ffdeb5";
|
|
1011
|
-
"#594c05": "#594c05";
|
|
1012
|
-
"#fbe983": "#fbe983";
|
|
1013
|
-
"#684e07": "#684e07";
|
|
1014
|
-
"#fdedc1": "#fdedc1";
|
|
1015
|
-
"#0b4f30": "#0b4f30";
|
|
1016
|
-
"#b3efd3": "#b3efd3";
|
|
1017
|
-
"#04502e": "#04502e";
|
|
1018
|
-
"#a2dcc1": "#a2dcc1";
|
|
1019
|
-
"#c2c2c2": "#c2c2c2";
|
|
1020
|
-
"#4986e7": "#4986e7";
|
|
1021
|
-
"#2da2bb": "#2da2bb";
|
|
1022
|
-
"#b99aff": "#b99aff";
|
|
1023
|
-
"#994a64": "#994a64";
|
|
1024
|
-
"#f691b2": "#f691b2";
|
|
1025
|
-
"#ff7537": "#ff7537";
|
|
1026
|
-
"#ffad46": "#ffad46";
|
|
1027
|
-
"#662e37": "#662e37";
|
|
1028
|
-
"#ebdbde": "#ebdbde";
|
|
1029
|
-
"#cca6ac": "#cca6ac";
|
|
1030
|
-
"#094228": "#094228";
|
|
1031
|
-
"#42d692": "#42d692";
|
|
1032
|
-
"#16a765": "#16a765";
|
|
1033
|
-
}>;
|
|
826
|
+
backgroundColor: z.ZodString;
|
|
827
|
+
textColor: z.ZodString;
|
|
1034
828
|
}, z.core.$strip>>;
|
|
1035
829
|
labelId: z.ZodString;
|
|
1036
830
|
labelListVisibility: z.ZodOptional<z.ZodEnum<{
|
package/dist/gmail/schemas.js
CHANGED
|
@@ -119,6 +119,12 @@ export const LABEL_COLOR_SCHEMA = z.object({
|
|
|
119
119
|
/** Hex text color selected from Gmail's supported palette. */
|
|
120
120
|
textColor: LABEL_COLOR_VALUE_SCHEMA,
|
|
121
121
|
});
|
|
122
|
+
const LABEL_OUTPUT_COLOR_SCHEMA = z.object({
|
|
123
|
+
/** Hex background color returned by Gmail. */
|
|
124
|
+
backgroundColor: z.string().regex(/^#[0-9a-fA-F]{6}$/),
|
|
125
|
+
/** Hex text color returned by Gmail. */
|
|
126
|
+
textColor: z.string().regex(/^#[0-9a-fA-F]{6}$/),
|
|
127
|
+
});
|
|
122
128
|
export const MAILBOX_SCHEMA = z.object({
|
|
123
129
|
/** RFC 5322 email address. */
|
|
124
130
|
address: z.string(),
|
|
@@ -338,7 +344,7 @@ export const DRAFT_SCHEMA = z.object({
|
|
|
338
344
|
});
|
|
339
345
|
export const LABEL_SCHEMA = z.object({
|
|
340
346
|
/** Optional label color configuration. */
|
|
341
|
-
color:
|
|
347
|
+
color: LABEL_OUTPUT_COLOR_SCHEMA.optional(),
|
|
342
348
|
/** Immutable Gmail label ID. */
|
|
343
349
|
labelId: z.string(),
|
|
344
350
|
/** Visibility in Gmail's label list. */
|
|
@@ -80,7 +80,7 @@ export declare const TIDYCAL_BOOKING_TYPE_SCHEMA: z.ZodObject<{
|
|
|
80
80
|
createdAt: z.ZodISODateTime;
|
|
81
81
|
currencyCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
82
82
|
description: z.ZodString;
|
|
83
|
-
disabledAt: z.ZodNullable<z.ZodISODateTime
|
|
83
|
+
disabledAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
84
84
|
durationMinutes: z.ZodNumber;
|
|
85
85
|
id: z.ZodNumber;
|
|
86
86
|
latestAvailabilityDays: z.ZodNumber;
|
|
@@ -92,12 +92,12 @@ export declare const TIDYCAL_BOOKING_TYPE_SCHEMA: z.ZodObject<{
|
|
|
92
92
|
stripe: "stripe";
|
|
93
93
|
}>>;
|
|
94
94
|
paymentPlatformId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
95
|
-
price: z.ZodNumber
|
|
95
|
+
price: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>]>, z.ZodNumber>;
|
|
96
96
|
private: z.ZodBoolean;
|
|
97
97
|
redirectUrl: z.ZodNullable<z.ZodURL>;
|
|
98
98
|
title: z.ZodString;
|
|
99
99
|
updatedAt: z.ZodISODateTime;
|
|
100
|
-
url: z.ZodURL
|
|
100
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
101
101
|
urlSlug: z.ZodString;
|
|
102
102
|
userId: z.ZodNumber;
|
|
103
103
|
}, z.core.$strip>;
|
package/dist/tidycal/schemas.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
const DATE_TIME_SCHEMA = z.iso.datetime({ offset: true });
|
|
3
3
|
const ID_SCHEMA = z.number().int().positive();
|
|
4
|
+
const TIDYCAL_PRICE_SCHEMA = z
|
|
5
|
+
.union([
|
|
6
|
+
z.number(),
|
|
7
|
+
z
|
|
8
|
+
.string()
|
|
9
|
+
.regex(/^\d+(?:\.\d+)?$/)
|
|
10
|
+
.transform(Number),
|
|
11
|
+
])
|
|
12
|
+
.pipe(z.number().nonnegative());
|
|
4
13
|
export const TIDYCAL_ACCOUNT_SCHEMA = z.object({
|
|
5
14
|
currencySymbol: z.string(),
|
|
6
15
|
email: z.email(),
|
|
@@ -58,7 +67,7 @@ export const TIDYCAL_BOOKING_TYPE_SCHEMA = z.object({
|
|
|
58
67
|
createdAt: DATE_TIME_SCHEMA,
|
|
59
68
|
currencyCode: z.string().nullable().optional(),
|
|
60
69
|
description: z.string(),
|
|
61
|
-
disabledAt: DATE_TIME_SCHEMA.nullable(),
|
|
70
|
+
disabledAt: DATE_TIME_SCHEMA.nullable().optional(),
|
|
62
71
|
durationMinutes: z.number().int().positive(),
|
|
63
72
|
id: ID_SCHEMA,
|
|
64
73
|
latestAvailabilityDays: z.number().int().min(0),
|
|
@@ -66,12 +75,12 @@ export const TIDYCAL_BOOKING_TYPE_SCHEMA = z.object({
|
|
|
66
75
|
paddingMinutes: z.number().int().min(0),
|
|
67
76
|
paymentPlatform: z.enum(["paypal", "stripe", "tidycal"]).nullable(),
|
|
68
77
|
paymentPlatformId: z.string().nullable().optional(),
|
|
69
|
-
price:
|
|
78
|
+
price: TIDYCAL_PRICE_SCHEMA,
|
|
70
79
|
private: z.boolean(),
|
|
71
80
|
redirectUrl: z.url().nullable(),
|
|
72
81
|
title: z.string(),
|
|
73
82
|
updatedAt: DATE_TIME_SCHEMA,
|
|
74
|
-
url: z.url(),
|
|
83
|
+
url: z.url().optional(),
|
|
75
84
|
urlSlug: z.string(),
|
|
76
85
|
userId: ID_SCHEMA,
|
|
77
86
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automate.ax/integration-contracts",
|
|
3
|
-
"version": "0.119.
|
|
3
|
+
"version": "0.119.5",
|
|
4
4
|
"description": "Shared integration payload contracts and provider primitives for Automate.ax.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@automate.ax/codec": "0.119.
|
|
56
|
+
"@automate.ax/codec": "0.119.5",
|
|
57
57
|
"@cfworker/json-schema": "^4.1.1",
|
|
58
58
|
"@googleapis/calendar": "^15.0.0",
|
|
59
59
|
"@googleapis/forms": "^6.0.1",
|
package/src/gmail/gmail.ts
CHANGED
|
@@ -10,7 +10,6 @@ import * as z from "zod"
|
|
|
10
10
|
import {
|
|
11
11
|
ATTACHMENT_INPUT_SCHEMA,
|
|
12
12
|
DRAFT_IDENTIFIER_SCHEMA,
|
|
13
|
-
LABEL_COLOR_SCHEMA,
|
|
14
13
|
LABEL_SCHEMA,
|
|
15
14
|
MAILBOX_SCHEMA,
|
|
16
15
|
MESSAGE_METADATA_SCHEMA,
|
|
@@ -484,10 +483,10 @@ export function toGmailLabel(
|
|
|
484
483
|
return {
|
|
485
484
|
...(label.color?.backgroundColor &&
|
|
486
485
|
label.color.textColor && {
|
|
487
|
-
color:
|
|
486
|
+
color: {
|
|
488
487
|
backgroundColor: label.color.backgroundColor,
|
|
489
488
|
textColor: label.color.textColor,
|
|
490
|
-
}
|
|
489
|
+
},
|
|
491
490
|
}),
|
|
492
491
|
labelId: label.id,
|
|
493
492
|
labelListVisibility: label.labelListVisibility
|
package/src/gmail/schemas.ts
CHANGED
|
@@ -121,6 +121,13 @@ export const LABEL_COLOR_SCHEMA = z.object({
|
|
|
121
121
|
/** Hex text color selected from Gmail's supported palette. */
|
|
122
122
|
textColor: LABEL_COLOR_VALUE_SCHEMA,
|
|
123
123
|
})
|
|
124
|
+
const LABEL_OUTPUT_COLOR_SCHEMA = z.object({
|
|
125
|
+
/** Hex background color returned by Gmail. */
|
|
126
|
+
backgroundColor: z.string().regex(/^#[0-9a-fA-F]{6}$/),
|
|
127
|
+
|
|
128
|
+
/** Hex text color returned by Gmail. */
|
|
129
|
+
textColor: z.string().regex(/^#[0-9a-fA-F]{6}$/),
|
|
130
|
+
})
|
|
124
131
|
export const MAILBOX_SCHEMA = z.object({
|
|
125
132
|
/** RFC 5322 email address. */
|
|
126
133
|
address: z.string(),
|
|
@@ -412,7 +419,7 @@ export const DRAFT_SCHEMA = z.object({
|
|
|
412
419
|
|
|
413
420
|
export const LABEL_SCHEMA = z.object({
|
|
414
421
|
/** Optional label color configuration. */
|
|
415
|
-
color:
|
|
422
|
+
color: LABEL_OUTPUT_COLOR_SCHEMA.optional(),
|
|
416
423
|
|
|
417
424
|
/** Immutable Gmail label ID. */
|
|
418
425
|
labelId: z.string(),
|
package/src/tidycal/schemas.ts
CHANGED
|
@@ -2,6 +2,15 @@ import * as z from "zod"
|
|
|
2
2
|
|
|
3
3
|
const DATE_TIME_SCHEMA = z.iso.datetime({ offset: true })
|
|
4
4
|
const ID_SCHEMA = z.number().int().positive()
|
|
5
|
+
const TIDYCAL_PRICE_SCHEMA = z
|
|
6
|
+
.union([
|
|
7
|
+
z.number(),
|
|
8
|
+
z
|
|
9
|
+
.string()
|
|
10
|
+
.regex(/^\d+(?:\.\d+)?$/)
|
|
11
|
+
.transform(Number),
|
|
12
|
+
])
|
|
13
|
+
.pipe(z.number().nonnegative())
|
|
5
14
|
|
|
6
15
|
export const TIDYCAL_ACCOUNT_SCHEMA = z.object({
|
|
7
16
|
currencySymbol: z.string(),
|
|
@@ -65,7 +74,7 @@ export const TIDYCAL_BOOKING_TYPE_SCHEMA = z.object({
|
|
|
65
74
|
createdAt: DATE_TIME_SCHEMA,
|
|
66
75
|
currencyCode: z.string().nullable().optional(),
|
|
67
76
|
description: z.string(),
|
|
68
|
-
disabledAt: DATE_TIME_SCHEMA.nullable(),
|
|
77
|
+
disabledAt: DATE_TIME_SCHEMA.nullable().optional(),
|
|
69
78
|
durationMinutes: z.number().int().positive(),
|
|
70
79
|
id: ID_SCHEMA,
|
|
71
80
|
latestAvailabilityDays: z.number().int().min(0),
|
|
@@ -73,12 +82,12 @@ export const TIDYCAL_BOOKING_TYPE_SCHEMA = z.object({
|
|
|
73
82
|
paddingMinutes: z.number().int().min(0),
|
|
74
83
|
paymentPlatform: z.enum(["paypal", "stripe", "tidycal"]).nullable(),
|
|
75
84
|
paymentPlatformId: z.string().nullable().optional(),
|
|
76
|
-
price:
|
|
85
|
+
price: TIDYCAL_PRICE_SCHEMA,
|
|
77
86
|
private: z.boolean(),
|
|
78
87
|
redirectUrl: z.url().nullable(),
|
|
79
88
|
title: z.string(),
|
|
80
89
|
updatedAt: DATE_TIME_SCHEMA,
|
|
81
|
-
url: z.url(),
|
|
90
|
+
url: z.url().optional(),
|
|
82
91
|
urlSlug: z.string(),
|
|
83
92
|
userId: ID_SCHEMA,
|
|
84
93
|
})
|