@marcoappio/marco-config 4.0.11 → 4.0.13
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/appwrite/appwrite.d.ts +35 -35
- package/dist/appwrite/appwrite.d.ts.map +1 -1
- package/dist/appwrite/appwrite.js +1 -2
- package/dist/appwrite/appwrite.test.js +18 -0
- package/dist/appwrite/commands.d.ts +5 -5
- package/dist/appwrite/commands.d.ts.map +1 -1
- package/dist/appwrite/commands.js +4 -6
- package/dist/appwrite/commands.test.js +18 -0
- package/dist/appwrite/functions.d.ts +12 -12
- package/dist/appwrite/functions.d.ts.map +1 -1
- package/dist/appwrite/functions.js +3 -9
- package/dist/appwrite/tableContract/identity.d.ts +2 -2
- package/dist/appwrite/tableContract/identity.d.ts.map +1 -1
- package/dist/appwrite/tableContract/identity.js +12 -12
- package/dist/appwrite/tableContract/index.d.ts +36 -36
- package/dist/appwrite/tableContract/index.js +3 -3
- package/dist/appwrite/tableContract/mailbox.d.ts +10 -10
- package/dist/appwrite/tableContract/mailbox.d.ts.map +1 -1
- package/dist/appwrite/tableContract/mailbox.js +12 -12
- package/dist/appwrite/tableContract/operational.d.ts +12 -12
- package/dist/appwrite/tableContract/operational.d.ts.map +1 -1
- package/dist/appwrite/tableContract/operational.js +12 -12
- package/dist/appwrite/tableContract/shared.d.ts +1 -7
- package/dist/appwrite/tableContract/shared.d.ts.map +1 -1
- package/dist/appwrite/tableContract/shared.js +1 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.test.js +14 -0
- package/dist/schemas/emailAccount.d.ts +6 -6
- package/dist/schemas/emailAccount.d.ts.map +1 -1
- package/dist/schemas/emailAccount.js +4 -4
- package/dist/schemas/index.d.ts +35 -46
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +0 -4
- package/dist/schemas/models/account.d.ts +2 -2
- package/dist/schemas/models/account.js +3 -3
- package/dist/schemas/models/contact.d.ts +1 -1
- package/dist/schemas/models/draft.d.ts +8 -8
- package/dist/schemas/models/draft.js +1 -1
- package/dist/schemas/models/numericSemantics.test.d.ts +2 -0
- package/dist/schemas/models/numericSemantics.test.d.ts.map +1 -0
- package/dist/schemas/models/numericSemantics.test.js +24 -0
- package/dist/schemas/models/thread.d.ts +16 -16
- package/dist/schemas/models/thread.js +2 -2
- package/dist/schemas/number.d.ts +2 -4
- package/dist/schemas/number.d.ts.map +1 -1
- package/dist/schemas/number.js +3 -4
- package/dist/schemas/scalars.d.ts +13 -0
- package/dist/schemas/scalars.d.ts.map +1 -0
- package/dist/schemas/scalars.js +15 -0
- package/dist/schemas/scalars.test.d.ts +2 -0
- package/dist/schemas/scalars.test.d.ts.map +1 -0
- package/dist/schemas/scalars.test.js +44 -0
- package/dist/schemas/string.d.ts +1 -4
- package/dist/schemas/string.d.ts.map +1 -1
- package/dist/schemas/string.js +3 -5
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/package.json +1 -1
- package/dist/schemas/boolean.d.ts +0 -5
- package/dist/schemas/boolean.d.ts.map +0 -1
- package/dist/schemas/boolean.js +0 -4
- package/dist/schemas/labels.d.ts +0 -5
- package/dist/schemas/labels.d.ts.map +0 -1
- package/dist/schemas/labels.js +0 -5
- package/dist/schemas/paginatedResponse.d.ts +0 -10
- package/dist/schemas/paginatedResponse.d.ts.map +0 -1
- package/dist/schemas/paginatedResponse.js +0 -5
- package/dist/utils/validation/flattenRequirements/flattenRequirements.d.ts +0 -8
- package/dist/utils/validation/flattenRequirements/flattenRequirements.d.ts.map +0 -1
- package/dist/utils/validation/flattenRequirements/flattenRequirements.js +0 -37
- package/dist/utils/validation/flattenRequirements/flattenRequirements.test.d.ts +0 -2
- package/dist/utils/validation/flattenRequirements/flattenRequirements.test.d.ts.map +0 -1
- package/dist/utils/validation/flattenRequirements/flattenRequirements.test.js +0 -25
- package/dist/utils/validation/flattenRequirements/index.d.ts +0 -2
- package/dist/utils/validation/flattenRequirements/index.d.ts.map +0 -1
- package/dist/utils/validation/flattenRequirements/index.js +0 -1
- package/dist/utils/validation/index.d.ts +0 -2
- package/dist/utils/validation/index.d.ts.map +0 -1
- package/dist/utils/validation/index.js +0 -1
|
@@ -7,7 +7,7 @@ export declare const threadMessageAttachmentSchema: v.ObjectSchema<{
|
|
|
7
7
|
readonly threadMessageId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "MessageId">]>, undefined>;
|
|
8
8
|
}, undefined>;
|
|
9
9
|
export declare const threadMessageRecipientSchema: v.ObjectSchema<{
|
|
10
|
-
readonly emailAddress: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
10
|
+
readonly emailAddress: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
11
11
|
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "RecipientId">]>, undefined>;
|
|
12
12
|
readonly name: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
13
13
|
readonly threadMessageId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "MessageId">]>, undefined>;
|
|
@@ -22,18 +22,18 @@ export declare const threadMessageSchema: v.ObjectSchema<{
|
|
|
22
22
|
readonly size: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
23
23
|
readonly threadMessageId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "MessageId">]>, undefined>;
|
|
24
24
|
}, undefined>, undefined>;
|
|
25
|
-
readonly envelopeDate: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number,
|
|
25
|
+
readonly envelopeDate: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
26
26
|
readonly envelopeSubject: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
27
27
|
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "MessageId">]>, undefined>;
|
|
28
28
|
readonly previewText: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
29
29
|
readonly recipients: v.ArraySchema<v.ObjectSchema<{
|
|
30
|
-
readonly emailAddress: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
30
|
+
readonly emailAddress: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
31
31
|
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "RecipientId">]>, undefined>;
|
|
32
32
|
readonly name: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
33
33
|
readonly threadMessageId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "MessageId">]>, undefined>;
|
|
34
34
|
readonly type: v.PicklistSchema<readonly ["bcc", "cc", "to", "replyTo"], undefined>;
|
|
35
35
|
}, undefined>, undefined>;
|
|
36
|
-
readonly senderEmail: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
36
|
+
readonly senderEmail: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
37
37
|
readonly senderName: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
38
38
|
readonly threadId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "ThreadId">]>, undefined>;
|
|
39
39
|
readonly unsubscribeUrl: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
@@ -44,14 +44,14 @@ export declare const threadSchema: v.ObjectSchema<{
|
|
|
44
44
|
hasAttachments: v.BooleanSchema<undefined>;
|
|
45
45
|
id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "ThreadId">]>, undefined>;
|
|
46
46
|
labelIdList: v.StringSchema<undefined>;
|
|
47
|
-
latestMessageDate: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number,
|
|
47
|
+
latestMessageDate: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
48
48
|
latestMessageId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "MessageId">]>, undefined>;
|
|
49
49
|
messageCount: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
50
50
|
previewText: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
51
51
|
seen: v.BooleanSchema<undefined>;
|
|
52
|
-
senderEmail: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
52
|
+
senderEmail: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
53
53
|
senderName: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
54
|
-
snoozedUntil: v.NullableSchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number,
|
|
54
|
+
snoozedUntil: v.NullableSchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>, undefined>;
|
|
55
55
|
subject: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
56
56
|
userId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "UserId">]>, undefined>;
|
|
57
57
|
words: v.StringSchema<undefined>;
|
|
@@ -62,14 +62,14 @@ export declare const threadListSchema: v.ObjectSchema<{
|
|
|
62
62
|
hasAttachments: v.BooleanSchema<undefined>;
|
|
63
63
|
id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "ThreadId">]>, undefined>;
|
|
64
64
|
labelIdList: v.StringSchema<undefined>;
|
|
65
|
-
latestMessageDate: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number,
|
|
65
|
+
latestMessageDate: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
66
66
|
latestMessageId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "MessageId">]>, undefined>;
|
|
67
67
|
messageCount: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
68
68
|
previewText: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
69
69
|
seen: v.BooleanSchema<undefined>;
|
|
70
|
-
senderEmail: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
70
|
+
senderEmail: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
71
71
|
senderName: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
72
|
-
snoozedUntil: v.NullableSchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number,
|
|
72
|
+
snoozedUntil: v.NullableSchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>, undefined>;
|
|
73
73
|
subject: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
74
74
|
userId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "UserId">]>, undefined>;
|
|
75
75
|
words: v.StringSchema<undefined>;
|
|
@@ -84,18 +84,18 @@ export declare const threadFullSchema: v.ObjectSchema<{
|
|
|
84
84
|
readonly size: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
85
85
|
readonly threadMessageId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "MessageId">]>, undefined>;
|
|
86
86
|
}, undefined>, undefined>;
|
|
87
|
-
readonly envelopeDate: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number,
|
|
87
|
+
readonly envelopeDate: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
88
88
|
readonly envelopeSubject: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
89
89
|
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "MessageId">]>, undefined>;
|
|
90
90
|
readonly previewText: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
91
91
|
readonly recipients: v.ArraySchema<v.ObjectSchema<{
|
|
92
|
-
readonly emailAddress: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
92
|
+
readonly emailAddress: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
93
93
|
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "RecipientId">]>, undefined>;
|
|
94
94
|
readonly name: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
95
95
|
readonly threadMessageId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "MessageId">]>, undefined>;
|
|
96
96
|
readonly type: v.PicklistSchema<readonly ["bcc", "cc", "to", "replyTo"], undefined>;
|
|
97
97
|
}, undefined>, undefined>;
|
|
98
|
-
readonly senderEmail: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
98
|
+
readonly senderEmail: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
99
99
|
readonly senderName: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
100
100
|
readonly threadId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "ThreadId">]>, undefined>;
|
|
101
101
|
readonly unsubscribeUrl: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
@@ -105,14 +105,14 @@ export declare const threadFullSchema: v.ObjectSchema<{
|
|
|
105
105
|
readonly hasAttachments: v.BooleanSchema<undefined>;
|
|
106
106
|
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "ThreadId">]>, undefined>;
|
|
107
107
|
readonly labelIdList: v.StringSchema<undefined>;
|
|
108
|
-
readonly latestMessageDate: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number,
|
|
108
|
+
readonly latestMessageDate: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
109
109
|
readonly latestMessageId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "MessageId">]>, undefined>;
|
|
110
110
|
readonly messageCount: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
111
111
|
readonly previewText: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
112
112
|
readonly seen: v.BooleanSchema<undefined>;
|
|
113
|
-
readonly senderEmail: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
113
|
+
readonly senderEmail: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
114
114
|
readonly senderName: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
115
|
-
readonly snoozedUntil: v.NullableSchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number,
|
|
115
|
+
readonly snoozedUntil: v.NullableSchema<v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>, undefined>;
|
|
116
116
|
readonly subject: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
117
117
|
readonly userId: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "UserId">]>, undefined>;
|
|
118
118
|
readonly words: v.StringSchema<undefined>;
|
|
@@ -8,7 +8,7 @@ export const threadMessageAttachmentSchema = v.object({
|
|
|
8
8
|
fileName: string.required(),
|
|
9
9
|
id: id.attachmentId.required(),
|
|
10
10
|
mimeType: string.required(),
|
|
11
|
-
size: number.
|
|
11
|
+
size: number.nonNegativeInteger(),
|
|
12
12
|
threadMessageId: id.messageId.required(),
|
|
13
13
|
});
|
|
14
14
|
export const threadMessageRecipientSchema = v.object({
|
|
@@ -39,7 +39,7 @@ const threadBaseEntries = {
|
|
|
39
39
|
labelIdList: v.string(),
|
|
40
40
|
latestMessageDate: number.positiveInteger(),
|
|
41
41
|
latestMessageId: id.messageId.required(),
|
|
42
|
-
messageCount: number.
|
|
42
|
+
messageCount: number.nonNegativeInteger(),
|
|
43
43
|
previewText: string.required(messages.PREVIEW_TEXT_MAX_LENGTH),
|
|
44
44
|
seen: v.boolean(),
|
|
45
45
|
senderEmail: string.mailboxAddress(),
|
package/dist/schemas/number.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
export declare const number: {
|
|
3
|
-
fromString: () => v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
|
|
4
3
|
minMax: (min: number, max: number) => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>;
|
|
5
|
-
|
|
6
|
-
positiveInteger: () => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number,
|
|
7
|
-
positiveIntegerFromString: () => v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.TransformAction<string, number>, v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
4
|
+
nonNegativeInteger: () => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
5
|
+
positiveInteger: () => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
8
6
|
};
|
|
9
7
|
//# sourceMappingURL=number.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/schemas/number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/schemas/number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B,eAAO,MAAM,MAAM;kBACH,MAAM,OAAO,MAAM;;;CAGlC,CAAA"}
|
package/dist/schemas/number.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
+
import { nonNegativeIntegerSchema, positiveIntegerSchema } from './scalars';
|
|
2
3
|
export const number = {
|
|
3
|
-
fromString: () => v.pipe(v.string(), v.nonEmpty(), v.transform(value => Number(value)), v.number(), v.finite()),
|
|
4
4
|
minMax: (min, max) => v.nonOptional(v.pipe(v.number(), v.minValue(min), v.maxValue(max))),
|
|
5
|
-
|
|
6
|
-
positiveInteger: () => v.nonOptional(
|
|
7
|
-
positiveIntegerFromString: () => v.pipe(number.fromString(), v.integer(), v.minValue(0)),
|
|
5
|
+
nonNegativeInteger: () => v.nonOptional(nonNegativeIntegerSchema),
|
|
6
|
+
positiveInteger: () => v.nonOptional(positiveIntegerSchema),
|
|
8
7
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
export declare const socketTypes: readonly ["SSL", "STARTTLS"];
|
|
3
|
+
export declare const socketTypeSchema: v.PicklistSchema<readonly ["SSL", "STARTTLS"], undefined>;
|
|
4
|
+
export declare const nonNegativeIntegerSchema: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
5
|
+
export declare const positiveIntegerSchema: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
6
|
+
export declare const portSchema: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, v.MaxValueAction<number, 65535, undefined>]>;
|
|
7
|
+
export declare const isoTimestampSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
|
|
8
|
+
export declare const canonicalTimestampSchema: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, v.CheckAction<string, undefined>]>;
|
|
9
|
+
export declare const webEmailSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.EmailAction<string, undefined>]>;
|
|
10
|
+
export declare const rfcEmailSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>;
|
|
11
|
+
export declare const mailboxAddressSchema: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>;
|
|
12
|
+
export declare const jsonObjectTextSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.ParseJsonAction<string, undefined, undefined>, v.CheckAction<unknown, undefined>, v.LooseObjectSchema<{}, undefined>]>;
|
|
13
|
+
//# sourceMappingURL=scalars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalars.d.ts","sourceRoot":"","sources":["../../src/schemas/scalars.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,WAAW,8BAA+B,CAAA;AACvD,eAAO,MAAM,gBAAgB,2DAA0B,CAAA;AAEvD,eAAO,MAAM,wBAAwB,oIAAiD,CAAA;AACtF,eAAO,MAAM,qBAAqB,oIAAiD,CAAA;AACnF,eAAO,MAAM,UAAU,6MAAoD,CAAA;AAE3E,eAAO,MAAM,kBAAkB,iGAAuC,CAAA;AACtE,eAAO,MAAM,wBAAwB,gKAMpC,CAAA;AAED,eAAO,MAAM,cAAc,0FAAgC,CAAA;AAC3D,eAAO,MAAM,cAAc,6FAAmC,CAAA;AAC9D,eAAO,MAAM,oBAAoB,qKAA2C,CAAA;AAE5E,eAAO,MAAM,oBAAoB,gLAKhC,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
export const socketTypes = ['SSL', 'STARTTLS'];
|
|
3
|
+
export const socketTypeSchema = v.picklist(socketTypes);
|
|
4
|
+
export const nonNegativeIntegerSchema = v.pipe(v.number(), v.integer(), v.minValue(0));
|
|
5
|
+
export const positiveIntegerSchema = v.pipe(v.number(), v.integer(), v.minValue(1));
|
|
6
|
+
export const portSchema = v.pipe(positiveIntegerSchema, v.maxValue(65_535));
|
|
7
|
+
export const isoTimestampSchema = v.pipe(v.string(), v.isoTimestamp());
|
|
8
|
+
export const canonicalTimestampSchema = v.pipe(isoTimestampSchema, v.check(timestamp => {
|
|
9
|
+
const milliseconds = Date.parse(timestamp);
|
|
10
|
+
return Number.isFinite(milliseconds) && new Date(milliseconds).toISOString() === timestamp;
|
|
11
|
+
}));
|
|
12
|
+
export const webEmailSchema = v.pipe(v.string(), v.email());
|
|
13
|
+
export const rfcEmailSchema = v.pipe(v.string(), v.rfcEmail());
|
|
14
|
+
export const mailboxAddressSchema = v.pipe(rfcEmailSchema, v.maxLength(320));
|
|
15
|
+
export const jsonObjectTextSchema = v.pipe(v.string(), v.parseJson(), v.check(value => !Array.isArray(value)), v.looseObject({}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalars.test.d.ts","sourceRoot":"","sources":["../../src/schemas/scalars.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
import * as v from 'valibot';
|
|
3
|
+
import { number } from './number';
|
|
4
|
+
import { canonicalTimestampSchema, isoTimestampSchema, jsonObjectTextSchema, mailboxAddressSchema, portSchema, rfcEmailSchema, socketTypeSchema, socketTypes, webEmailSchema, } from './scalars';
|
|
5
|
+
describe('scalar contracts', () => {
|
|
6
|
+
it('distinguishes non-negative and positive integers', () => {
|
|
7
|
+
expect(v.safeParse(number.nonNegativeInteger(), 0).success).toBe(true);
|
|
8
|
+
expect(v.safeParse(number.nonNegativeInteger(), -1).success).toBe(false);
|
|
9
|
+
expect(v.safeParse(number.nonNegativeInteger(), 0.5).success).toBe(false);
|
|
10
|
+
expect(v.safeParse(number.positiveInteger(), 0).success).toBe(false);
|
|
11
|
+
expect(v.safeParse(number.positiveInteger(), 1).success).toBe(true);
|
|
12
|
+
});
|
|
13
|
+
it('validates ports and socket types', () => {
|
|
14
|
+
expect(socketTypes).toEqual(['SSL', 'STARTTLS']);
|
|
15
|
+
for (const value of [1, 65_535]) {
|
|
16
|
+
expect(v.safeParse(portSchema, value).success).toBe(true);
|
|
17
|
+
}
|
|
18
|
+
for (const value of [0, 1.5, 65_536]) {
|
|
19
|
+
expect(v.safeParse(portSchema, value).success).toBe(false);
|
|
20
|
+
}
|
|
21
|
+
expect(v.safeParse(socketTypeSchema, 'SSL').success).toBe(true);
|
|
22
|
+
expect(v.safeParse(socketTypeSchema, 'STARTTLS').success).toBe(true);
|
|
23
|
+
expect(v.safeParse(socketTypeSchema, 'PLAIN').success).toBe(false);
|
|
24
|
+
});
|
|
25
|
+
it('keeps format-only and canonical timestamps distinct', () => {
|
|
26
|
+
expect(v.safeParse(isoTimestampSchema, '2026-06-31T12:00:30.000Z').success).toBe(true);
|
|
27
|
+
expect(v.safeParse(canonicalTimestampSchema, '2026-07-23T12:00:30.000Z').success).toBe(true);
|
|
28
|
+
expect(v.safeParse(canonicalTimestampSchema, '2026-06-31T12:00:30.000Z').success).toBe(false);
|
|
29
|
+
expect(v.safeParse(canonicalTimestampSchema, '2026-07-23T12:00:30.000+00:00').success).toBe(false);
|
|
30
|
+
});
|
|
31
|
+
it('keeps strict web, RFC, and persisted mailbox email policies distinct', () => {
|
|
32
|
+
const maximumLengthMailboxAddress = `${'a'.repeat(64)}@${'b'.repeat(63)}.${'c'.repeat(63)}.${'d'.repeat(63)}.${'e'.repeat(63)}`;
|
|
33
|
+
expect(v.safeParse(webEmailSchema, 'sender@example').success).toBe(false);
|
|
34
|
+
expect(v.safeParse(rfcEmailSchema, 'sender@example').success).toBe(true);
|
|
35
|
+
expect(v.safeParse(mailboxAddressSchema, maximumLengthMailboxAddress).success).toBe(true);
|
|
36
|
+
expect(v.safeParse(mailboxAddressSchema, `a${maximumLengthMailboxAddress}`).success).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
it('decodes JSON object text without accepting other JSON values', () => {
|
|
39
|
+
expect(v.safeParse(jsonObjectTextSchema, '{"key":"value"}').success).toBe(true);
|
|
40
|
+
for (const value of ['[]', 'null', '"value"', '1', 'invalid']) {
|
|
41
|
+
expect(v.safeParse(jsonObjectTextSchema, value).success).toBe(false);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
package/dist/schemas/string.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
export declare const string: {
|
|
3
3
|
email: () => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, undefined>;
|
|
4
|
-
|
|
5
|
-
mailboxAddress: () => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
6
|
-
matches: (regex: RegExp) => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
4
|
+
mailboxAddress: () => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RfcEmailAction<string, undefined>]>, v.MaxLengthAction<string, 320, undefined>]>, undefined>;
|
|
7
5
|
nullable: (maxLength?: number) => v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
8
|
-
optional: (maxLength?: number) => v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
9
6
|
required: (maxLength?: number) => v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
10
7
|
};
|
|
11
8
|
//# sourceMappingURL=string.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/schemas/string.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/schemas/string.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B,eAAO,MAAM,MAAM;;;;;CAKlB,CAAA"}
|
package/dist/schemas/string.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
+
import { mailboxAddressSchema, rfcEmailSchema } from './scalars';
|
|
2
3
|
export const string = {
|
|
3
|
-
email: () => v.nonOptional(
|
|
4
|
-
|
|
5
|
-
mailboxAddress: () => v.nonOptional(v.pipe(v.string(), v.rfcEmail(), v.maxLength(320))),
|
|
6
|
-
matches: (regex) => v.nonOptional(v.pipe(v.string(), v.regex(regex))),
|
|
4
|
+
email: () => v.nonOptional(rfcEmailSchema),
|
|
5
|
+
mailboxAddress: () => v.nonOptional(mailboxAddressSchema),
|
|
7
6
|
nullable: (maxLength = 255) => v.nullable(v.pipe(v.string(), v.nonEmpty(), v.maxLength(maxLength))),
|
|
8
|
-
optional: (maxLength = 255) => v.undefinedable(v.pipe(v.string(), v.nonEmpty(), v.maxLength(maxLength))),
|
|
9
7
|
required: (maxLength = 255) => v.nonOptional(v.pipe(v.string(), v.nonEmpty(), v.maxLength(maxLength))),
|
|
10
8
|
};
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as v from 'valibot';
|
|
2
|
-
export declare const boolean: {
|
|
3
|
-
fromString: () => v.SchemaWithPipe<readonly [v.PicklistSchema<["true", "false"], undefined>, v.TransformAction<"true" | "false", boolean>, v.BooleanSchema<undefined>]>;
|
|
4
|
-
};
|
|
5
|
-
//# sourceMappingURL=boolean.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../src/schemas/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,OAAO;;CAOnB,CAAA"}
|
package/dist/schemas/boolean.js
DELETED
package/dist/schemas/labels.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/schemas/labels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B,eAAO,MAAM,MAAM;;CAElB,CAAA"}
|
package/dist/schemas/labels.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as v from 'valibot';
|
|
2
|
-
export declare const paginatedResponseSchema: <T extends v.GenericSchema>(itemSchema: T) => v.ObjectSchema<{
|
|
3
|
-
readonly items: v.ArraySchema<T, undefined>;
|
|
4
|
-
readonly nextCursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
5
|
-
}, undefined>;
|
|
6
|
-
export type PaginatedResponse<T> = {
|
|
7
|
-
items: T[];
|
|
8
|
-
nextCursor: string | null;
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=paginatedResponse.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paginatedResponse.d.ts","sourceRoot":"","sources":["../../src/schemas/paginatedResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,CAAC,CAAC,aAAa,cAAc,CAAC;;;aAI5E,CAAA;AAEJ,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC,KAAK,EAAE,CAAC,EAAE,CAAA;IACV,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ReadonlyDeep } from 'type-fest';
|
|
2
|
-
import * as v from 'valibot';
|
|
3
|
-
export type SchemaRequirements = ReadonlyDeep<{
|
|
4
|
-
maxLength?: number;
|
|
5
|
-
minLength?: number;
|
|
6
|
-
}>;
|
|
7
|
-
export declare const flattenRequirements: <TEntries extends v.ObjectEntries>(schema: Pick<v.ObjectSchema<TEntries, v.ErrorMessage<v.ObjectIssue> | undefined>, "entries">) => ReadonlyDeep<Record<string, SchemaRequirements>>;
|
|
8
|
-
//# sourceMappingURL=flattenRequirements.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flattenRequirements.d.ts","sourceRoot":"","sources":["../../../../src/utils/validation/flattenRequirements/flattenRequirements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC,CAAA;AAsDF,eAAO,MAAM,mBAAmB,GAAI,QAAQ,SAAS,CAAC,CAAC,aAAa,UAC1D,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC,EAAE,SAAS,CAAC,KAC3F,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAA4G,CAAA"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as v from 'valibot';
|
|
2
|
-
const pipeSchema = v.array(v.unknown());
|
|
3
|
-
const directFieldSchema = v.looseObject({ pipe: pipeSchema });
|
|
4
|
-
const wrappedFieldSchema = v.looseObject({ wrapped: v.looseObject({ pipe: pipeSchema }) });
|
|
5
|
-
const requirementSchema = v.looseObject({
|
|
6
|
-
requirement: v.number(),
|
|
7
|
-
type: v.picklist(['max_length', 'min_length']),
|
|
8
|
-
});
|
|
9
|
-
const getPipe = (field) => {
|
|
10
|
-
const directResult = v.safeParse(directFieldSchema, field);
|
|
11
|
-
if (directResult.success) {
|
|
12
|
-
return directResult.output.pipe;
|
|
13
|
-
}
|
|
14
|
-
const wrappedResult = v.safeParse(wrappedFieldSchema, field);
|
|
15
|
-
if (wrappedResult.success) {
|
|
16
|
-
return wrappedResult.output.wrapped.pipe;
|
|
17
|
-
}
|
|
18
|
-
return [];
|
|
19
|
-
};
|
|
20
|
-
const getRequirements = (field) => Object.fromEntries(getPipe(field)
|
|
21
|
-
.reduce(([maxLength, minLength], item) => {
|
|
22
|
-
const result = v.safeParse(requirementSchema, item);
|
|
23
|
-
if (result.success && result.output.type === 'max_length') {
|
|
24
|
-
return [Math.min(maxLength ?? result.output.requirement, result.output.requirement), minLength];
|
|
25
|
-
}
|
|
26
|
-
if (result.success) {
|
|
27
|
-
return [maxLength, Math.max(minLength ?? result.output.requirement, result.output.requirement)];
|
|
28
|
-
}
|
|
29
|
-
return [maxLength, minLength];
|
|
30
|
-
}, [null, null])
|
|
31
|
-
.flatMap((requirement, index) => {
|
|
32
|
-
if (requirement !== null) {
|
|
33
|
-
return [[index === 0 ? 'maxLength' : 'minLength', requirement]];
|
|
34
|
-
}
|
|
35
|
-
return [];
|
|
36
|
-
}));
|
|
37
|
-
export const flattenRequirements = (schema) => Object.fromEntries(Object.entries(schema.entries).map(([key, field]) => [key, getRequirements(field)]));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flattenRequirements.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/validation/flattenRequirements/flattenRequirements.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
import * as v from 'valibot';
|
|
3
|
-
import { flattenRequirements } from './flattenRequirements';
|
|
4
|
-
describe('flattenRequirements', () => {
|
|
5
|
-
it('retains direct, wrapped, and unconstrained field requirements', () => {
|
|
6
|
-
const schema = v.object({
|
|
7
|
-
direct: v.pipe(v.string(), v.minLength(2), v.maxLength(64)),
|
|
8
|
-
plain: v.string(),
|
|
9
|
-
wrapped: v.optional(v.pipe(v.string(), v.minLength(3), v.maxLength(128))),
|
|
10
|
-
});
|
|
11
|
-
expect(flattenRequirements(schema)).toEqual({
|
|
12
|
-
direct: { maxLength: 64, minLength: 2 },
|
|
13
|
-
plain: {},
|
|
14
|
-
wrapped: { maxLength: 128, minLength: 3 },
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
it('retains the strictest repeated length requirements', () => {
|
|
18
|
-
const schema = v.object({
|
|
19
|
-
value: v.pipe(v.string(), v.minLength(8), v.minLength(2), v.maxLength(32), v.maxLength(128)),
|
|
20
|
-
});
|
|
21
|
-
expect(flattenRequirements(schema)).toEqual({
|
|
22
|
-
value: { maxLength: 32, minLength: 8 },
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/validation/flattenRequirements/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { flattenRequirements } from './flattenRequirements';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { flattenRequirements } from './flattenRequirements';
|