@remit/api-zod-schemas 0.0.81 → 0.0.83
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/README.md +17 -1
- package/middleware.d.ts.map +1 -1
- package/middleware.js +8 -0
- package/middleware.js.map +1 -1
- package/middleware.ts +8 -0
- package/package.json +1 -1
- package/schemas.d.ts +317 -9
- package/schemas.d.ts.map +1 -1
- package/schemas.js +68 -2
- package/schemas.js.map +1 -1
- package/schemas.ts +91 -3
package/schemas.js
CHANGED
|
@@ -31,6 +31,9 @@ export const FilterStateSchema = z.enum(["Active", "Expired", "Disabled"]);
|
|
|
31
31
|
export const FilterDisabledReasonSchema = z.enum(["None", "UserDisabled", "AwaitingFolder", "FolderCreateFailed", "FolderMissing"]);
|
|
32
32
|
export const FilterMatchOperatorSchema = z.enum(["And", "Or"]);
|
|
33
33
|
export const FilterClauseFieldSchema = z.enum(["From", "Subject", "HasWords", "ListId", "FromDomain"]);
|
|
34
|
+
export const FilterRuleMatchSchema = z.enum(["Is", "Contains"]);
|
|
35
|
+
export const FilterRuleHeaderSchema = z.enum(["From", "Subject", "ListId"]);
|
|
36
|
+
export const FilterRuleAddressPartSchema = z.enum(["All", "Localpart", "Domain", "RegistrableDomain"]);
|
|
34
37
|
export const LabelColorSchema = z.enum(["Default", "Red", "Orange", "Yellow", "Green", "Teal", "Blue", "Purple", "Gray"]);
|
|
35
38
|
export const OrganizeJobStateSchema = z.enum(["Pending", "Running", "Complete", "Failed"]);
|
|
36
39
|
export const CalendarColorSchema = z.enum(["Cal1", "Cal2", "Cal3", "Cal4", "Cal5", "Cal6"]);
|
|
@@ -51,12 +54,12 @@ export const ClassificationPresetGroupSchema = z.enum(["Hosted", "Custom", "Loca
|
|
|
51
54
|
export const ClassificationAdapterShapeSchema = z.enum(["DecisionApi", "ChatJsonSchema", "JinaClassify"]);
|
|
52
55
|
export const ClassificationValueSourceSchema = z.enum(["Saved", "Deployment", "Default"]);
|
|
53
56
|
export const ClassificationUnrunnableReasonSchema = z.enum(["NoBaseUrl", "NoApiKey"]);
|
|
54
|
-
export const ClassificationLabelSchema = z.enum(["Spam", "Phishing", "Priority", "Personal", "Newsletter", "Marketing", "Automated", "Transactional", "Social"]);
|
|
57
|
+
export const ClassificationLabelSchema = z.enum(["Spam", "Phishing", "Priority", "Personal", "Newsletter", "Marketing", "Automated", "Transactional", "Social", "ColdOutreach"]);
|
|
55
58
|
export const ClassificationFailureKindSchema = z.enum(["Unauthorized", "ModelNotFound", "RateLimited", "Rejected", "ProviderError", "Unreachable", "TimedOut", "Unparseable"]);
|
|
56
59
|
export const ClassificationFieldSchema = z.enum(["ApiKey", "Model", "BaseUrl"]);
|
|
60
|
+
export const MessageCategorySchema = z.enum(["uncategorized", "personal", "newsletter", "marketing", "automated", "transactional", "social", "coldOutreach"]);
|
|
57
61
|
export const SortOrderSchema = z.enum(["asc", "desc"]);
|
|
58
62
|
export const StarColorSchema = z.enum(["none", "yellow", "orange", "red", "purple", "blue", "teal", "green", "yellow_bang", "red_bang", "purple_question", "blue_info", "orange_guillemet", "green_check", "yellow_check", "blue_star"]);
|
|
59
|
-
export const MessageCategorySchema = z.enum(["uncategorized", "personal", "newsletter", "marketing", "automated", "transactional", "social"]);
|
|
60
63
|
export const SenderTrustSchema = z.enum(["unknown", "wellknown", "vip"]);
|
|
61
64
|
export const DisplayNameCorrespondenceSchema = z.enum(["Corresponds", "Lookalike", "ForeignAddress", "Unrelated", "NoClaim"]);
|
|
62
65
|
export const MessageStatusSchema = z.enum(["active", "deleting", "deleted", "moving"]);
|
|
@@ -635,6 +638,41 @@ export const FilterClauseSchema = z.object({
|
|
|
635
638
|
field: FilterClauseFieldSchema,
|
|
636
639
|
value: z.string().max(256)
|
|
637
640
|
});
|
|
641
|
+
export const FilterRuleV0Schema = z.object({
|
|
642
|
+
version: z.literal(0)
|
|
643
|
+
});
|
|
644
|
+
export const FilterHeaderTestSchema = z.object({
|
|
645
|
+
test: z.literal("header"),
|
|
646
|
+
match: FilterRuleMatchSchema,
|
|
647
|
+
header: FilterRuleHeaderSchema,
|
|
648
|
+
key: z.string().max(256)
|
|
649
|
+
});
|
|
650
|
+
export const FilterAddressTestSchema = z.object({
|
|
651
|
+
test: z.literal("address"),
|
|
652
|
+
match: FilterRuleMatchSchema,
|
|
653
|
+
part: FilterRuleAddressPartSchema,
|
|
654
|
+
key: z.string().max(256)
|
|
655
|
+
});
|
|
656
|
+
export const FilterHasWordsTestSchema = z.object({
|
|
657
|
+
test: z.literal("hasWords"),
|
|
658
|
+
words: z.array(z.string().max(256))
|
|
659
|
+
});
|
|
660
|
+
export const FilterAllOfTestSchema = z.object({
|
|
661
|
+
test: z.literal("allof"),
|
|
662
|
+
tests: z.array(z.union([z.lazy(() => FilterAllOfTestSchema), z.lazy(() => FilterAnyOfTestSchema), z.lazy(() => FilterNotTestSchema), FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema]))
|
|
663
|
+
});
|
|
664
|
+
export const FilterAnyOfTestSchema = z.object({
|
|
665
|
+
test: z.literal("anyof"),
|
|
666
|
+
tests: z.array(z.union([FilterAllOfTestSchema, z.lazy(() => FilterAnyOfTestSchema), z.lazy(() => FilterNotTestSchema), FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema]))
|
|
667
|
+
});
|
|
668
|
+
export const FilterNotTestSchema = z.object({
|
|
669
|
+
test: z.literal("not"),
|
|
670
|
+
operand: z.union([FilterAllOfTestSchema, FilterAnyOfTestSchema, z.lazy(() => FilterNotTestSchema), FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema])
|
|
671
|
+
});
|
|
672
|
+
export const FilterRuleV1Schema = z.object({
|
|
673
|
+
version: z.literal(1),
|
|
674
|
+
test: z.union([FilterAllOfTestSchema, FilterAnyOfTestSchema, FilterNotTestSchema, FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema])
|
|
675
|
+
});
|
|
638
676
|
export const FilterSchema = z.object({
|
|
639
677
|
filterId: z.string().min(25).max(25),
|
|
640
678
|
accountConfigId: z.string().min(25).max(25),
|
|
@@ -648,6 +686,7 @@ export const FilterSchema = z.object({
|
|
|
648
686
|
actionChangedAt: z.number(),
|
|
649
687
|
matchOperator: FilterMatchOperatorSchema,
|
|
650
688
|
literalClauses: z.array(FilterClauseSchema).min(1),
|
|
689
|
+
rule: z.union([FilterRuleV0Schema, FilterRuleV1Schema]),
|
|
651
690
|
actionLabelId: z.string(),
|
|
652
691
|
actionMailboxId: z.string(),
|
|
653
692
|
createdAt: z.number(),
|
|
@@ -757,6 +796,7 @@ export const OrganizeJobRequestSchema = z.object({
|
|
|
757
796
|
filterId: z.string(),
|
|
758
797
|
matchOperator: FilterMatchOperatorSchema,
|
|
759
798
|
literalClauses: z.array(FilterClauseSchema),
|
|
799
|
+
rule: z.union([FilterRuleV0Schema, FilterRuleV1Schema]),
|
|
760
800
|
actionLabelId: z.string(),
|
|
761
801
|
actionMailboxId: z.string(),
|
|
762
802
|
matchedCount: z.number(),
|
|
@@ -1086,6 +1126,25 @@ export const ClassificationTestFailedSchema = z.object({
|
|
|
1086
1126
|
field: ClassificationFieldSchema.optional(),
|
|
1087
1127
|
fix: z.string()
|
|
1088
1128
|
});
|
|
1129
|
+
export const ClassifierCategoryCountSchema = z.object({
|
|
1130
|
+
category: MessageCategorySchema,
|
|
1131
|
+
count: z.number()
|
|
1132
|
+
});
|
|
1133
|
+
export const ClassifierLabelCountSchema = z.object({
|
|
1134
|
+
label: ClassificationLabelSchema,
|
|
1135
|
+
count: z.number()
|
|
1136
|
+
});
|
|
1137
|
+
export const ClassifierCorrectionsSchema = z.object({
|
|
1138
|
+
spamReportedNotJunk: z.number(),
|
|
1139
|
+
categoryOverridden: z.number()
|
|
1140
|
+
});
|
|
1141
|
+
export const ClassifierStatsSchema = z.object({
|
|
1142
|
+
since: z.string(),
|
|
1143
|
+
examined: z.number(),
|
|
1144
|
+
byCategory: z.array(ClassifierCategoryCountSchema),
|
|
1145
|
+
byLabel: z.array(ClassifierLabelCountSchema),
|
|
1146
|
+
corrections: ClassifierCorrectionsSchema
|
|
1147
|
+
});
|
|
1089
1148
|
export const CalendarTaskResponseSchema = z.object({
|
|
1090
1149
|
calendarTaskId: z.string().min(25).max(25),
|
|
1091
1150
|
calendarId: z.string().min(25).max(25),
|
|
@@ -1654,6 +1713,11 @@ export const MessageFilterMoveSchema = z.object({
|
|
|
1654
1713
|
destinationMailboxId: z.string().min(25).max(25),
|
|
1655
1714
|
decidedAt: z.number()
|
|
1656
1715
|
});
|
|
1716
|
+
export const ClassifierScoreSchema = z.object({
|
|
1717
|
+
label: ClassificationLabelSchema,
|
|
1718
|
+
confidence: z.number().min(0).max(1),
|
|
1719
|
+
confident: z.boolean()
|
|
1720
|
+
});
|
|
1657
1721
|
export const MessageRecordSchema = z.object({
|
|
1658
1722
|
messageId: z.string().min(25).max(25),
|
|
1659
1723
|
mailboxId: z.string().min(25).max(25),
|
|
@@ -1680,6 +1744,7 @@ export const MessageRecordSchema = z.object({
|
|
|
1680
1744
|
placementVerdict: MessagePlacementVerdictSchema.optional(),
|
|
1681
1745
|
filterMove: MessageFilterMoveSchema.optional(),
|
|
1682
1746
|
placementDecidedAt: z.number().optional(),
|
|
1747
|
+
classifierScores: z.array(ClassifierScoreSchema),
|
|
1683
1748
|
spamReport: MessageSpamReportSchema.optional(),
|
|
1684
1749
|
createdAt: z.number(),
|
|
1685
1750
|
updatedAt: z.number()
|
|
@@ -1710,6 +1775,7 @@ export const MessageSchema = z.object({
|
|
|
1710
1775
|
placementVerdict: MessagePlacementVerdictSchema.optional(),
|
|
1711
1776
|
filterMove: MessageFilterMoveSchema.optional(),
|
|
1712
1777
|
placementDecidedAt: z.number().optional(),
|
|
1778
|
+
classifierScores: z.array(ClassifierScoreSchema),
|
|
1713
1779
|
spamReport: MessageSpamReportSchema.optional(),
|
|
1714
1780
|
createdAt: z.number(),
|
|
1715
1781
|
updatedAt: z.number(),
|