@remit/api-zod-schemas 0.0.82 → 0.0.84

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/schemas.ts CHANGED
@@ -107,18 +107,18 @@ export const ClassificationValueSourceSchema = z.enum(["Saved", "Deployment", "D
107
107
 
108
108
  export const ClassificationUnrunnableReasonSchema = z.enum(["NoBaseUrl", "NoApiKey"]);
109
109
 
110
- export const ClassificationLabelSchema = z.enum(["Spam", "Phishing", "Priority", "Personal", "Newsletter", "Marketing", "Automated", "Transactional", "Social"]);
110
+ export const ClassificationLabelSchema = z.enum(["Spam", "Phishing", "Priority", "Personal", "Newsletter", "Marketing", "Automated", "Transactional", "Social", "ColdOutreach"]);
111
111
 
112
112
  export const ClassificationFailureKindSchema = z.enum(["Unauthorized", "ModelNotFound", "RateLimited", "Rejected", "ProviderError", "Unreachable", "TimedOut", "Unparseable"]);
113
113
 
114
114
  export const ClassificationFieldSchema = z.enum(["ApiKey", "Model", "BaseUrl"]);
115
115
 
116
+ export const MessageCategorySchema = z.enum(["uncategorized", "personal", "newsletter", "marketing", "automated", "transactional", "social", "coldOutreach"]);
117
+
116
118
  export const SortOrderSchema = z.enum(["asc", "desc"]);
117
119
 
118
120
  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"]);
119
121
 
120
- export const MessageCategorySchema = z.enum(["uncategorized", "personal", "newsletter", "marketing", "automated", "transactional", "social"]);
121
-
122
122
  export const SenderTrustSchema = z.enum(["unknown", "wellknown", "vip"]);
123
123
 
124
124
  export const DisplayNameCorrespondenceSchema = z.enum(["Corresponds", "Lookalike", "ForeignAddress", "Unrelated", "NoClaim"]);
@@ -828,14 +828,14 @@ export type FilterAllOfTest = { test: "allof"; tests: Array<FilterAllOfTest | Fi
828
828
 
829
829
  export const FilterAllOfTestSchema: z.ZodType<FilterAllOfTest> = z.object({
830
830
  test: z.literal("allof"),
831
- tests: z.array(z.union([z.lazy(() => FilterAllOfTestSchema), z.lazy(() => FilterAnyOfTestSchema), z.lazy(() => FilterNotTestSchema), FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema]))
831
+ tests: z.array(z.union([z.lazy(() => FilterAllOfTestSchema), z.lazy(() => FilterAnyOfTestSchema), z.lazy(() => FilterNotTestSchema), FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema])).min(1).max(50)
832
832
  });
833
833
 
834
834
  export type FilterAnyOfTest = { test: "anyof"; tests: Array<FilterAllOfTest | FilterAnyOfTest | FilterNotTest | z.infer<typeof FilterHeaderTestSchema> | z.infer<typeof FilterAddressTestSchema> | z.infer<typeof FilterHasWordsTestSchema>> };
835
835
 
836
836
  export const FilterAnyOfTestSchema: z.ZodType<FilterAnyOfTest> = z.object({
837
837
  test: z.literal("anyof"),
838
- tests: z.array(z.union([FilterAllOfTestSchema, z.lazy(() => FilterAnyOfTestSchema), z.lazy(() => FilterNotTestSchema), FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema]))
838
+ tests: z.array(z.union([FilterAllOfTestSchema, z.lazy(() => FilterAnyOfTestSchema), z.lazy(() => FilterNotTestSchema), FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema])).min(1).max(50)
839
839
  });
840
840
 
841
841
  export type FilterNotTest = { test: "not"; operand: FilterAllOfTest | FilterAnyOfTest | FilterNotTest | z.infer<typeof FilterHeaderTestSchema> | z.infer<typeof FilterAddressTestSchema> | z.infer<typeof FilterHasWordsTestSchema> };
@@ -862,8 +862,10 @@ export const FilterSchema = z.object({
862
862
  ruleChangedAt: z.number(),
863
863
  actionChangedAt: z.number(),
864
864
  matchOperator: FilterMatchOperatorSchema,
865
- literalClauses: z.array(FilterClauseSchema).min(1),
865
+ literalClauses: z.array(FilterClauseSchema),
866
866
  rule: z.union([FilterRuleV0Schema, FilterRuleV1Schema]),
867
+ priority: z.number(),
868
+ stop: z.boolean(),
867
869
  actionLabelId: z.string(),
868
870
  actionMailboxId: z.string(),
869
871
  createdAt: z.number(),
@@ -881,11 +883,14 @@ export const FilterResponseSchema = z.object({
881
883
  ruleChangedAt: z.number(),
882
884
  actionChangedAt: z.number(),
883
885
  matchOperator: FilterMatchOperatorSchema,
884
- literalClauses: z.array(FilterClauseSchema).min(1),
886
+ literalClauses: z.array(FilterClauseSchema),
887
+ priority: z.number(),
888
+ stop: z.boolean(),
885
889
  actionLabelId: z.string(),
886
890
  actionMailboxId: z.string(),
887
891
  createdAt: z.number(),
888
- updatedAt: z.number()
892
+ updatedAt: z.number(),
893
+ rule: FilterRuleV1Schema
889
894
  });
890
895
 
891
896
  export const CreateFilterInputSchema = z.object({
@@ -893,9 +898,12 @@ export const CreateFilterInputSchema = z.object({
893
898
  scope: FilterScopeSchema,
894
899
  expiresAt: z.string().optional(),
895
900
  matchOperator: FilterMatchOperatorSchema,
896
- literalClauses: z.array(FilterClauseSchema).min(1),
897
901
  actionLabelId: z.string(),
898
- actionMailboxId: z.string()
902
+ actionMailboxId: z.string(),
903
+ priority: z.number().optional(),
904
+ stop: z.boolean().optional(),
905
+ literalClauses: z.array(FilterClauseSchema).optional(),
906
+ rule: FilterRuleV1Schema.optional()
899
907
  });
900
908
 
901
909
  export const CreateFilterResponseSchema = z.object({
@@ -909,23 +917,29 @@ export const CreateFilterResponseSchema = z.object({
909
917
  ruleChangedAt: z.number(),
910
918
  actionChangedAt: z.number(),
911
919
  matchOperator: FilterMatchOperatorSchema,
912
- literalClauses: z.array(FilterClauseSchema).min(1),
920
+ literalClauses: z.array(FilterClauseSchema),
921
+ priority: z.number(),
922
+ stop: z.boolean(),
913
923
  actionLabelId: z.string(),
914
924
  actionMailboxId: z.string(),
915
925
  createdAt: z.number(),
916
926
  updatedAt: z.number(),
927
+ rule: FilterRuleV1Schema,
917
928
  organizeJobId: z.string()
918
929
  });
919
930
 
920
931
  export const UpdateFilterInputSchema = z.object({
921
- name: z.string().max(256),
922
- scope: FilterScopeSchema,
932
+ name: z.string().max(256).optional(),
933
+ scope: FilterScopeSchema.optional(),
923
934
  expiresAt: z.string().optional(),
924
- state: FilterStateSchema,
925
- matchOperator: FilterMatchOperatorSchema,
926
- literalClauses: z.array(FilterClauseSchema).min(1),
927
- actionLabelId: z.string(),
928
- actionMailboxId: z.string()
935
+ state: FilterStateSchema.optional(),
936
+ matchOperator: FilterMatchOperatorSchema.optional(),
937
+ literalClauses: z.array(FilterClauseSchema).optional(),
938
+ priority: z.number().optional(),
939
+ stop: z.boolean().optional(),
940
+ actionLabelId: z.string().optional(),
941
+ actionMailboxId: z.string().optional(),
942
+ rule: FilterRuleV1Schema.optional()
929
943
  });
930
944
 
931
945
  export const LabelSchema = z.object({
@@ -1355,6 +1369,29 @@ export const ClassificationTestFailedSchema = z.object({
1355
1369
  fix: z.string()
1356
1370
  });
1357
1371
 
1372
+ export const ClassifierCategoryCountSchema = z.object({
1373
+ category: MessageCategorySchema,
1374
+ count: z.number()
1375
+ });
1376
+
1377
+ export const ClassifierLabelCountSchema = z.object({
1378
+ label: ClassificationLabelSchema,
1379
+ count: z.number()
1380
+ });
1381
+
1382
+ export const ClassifierCorrectionsSchema = z.object({
1383
+ spamReportedNotJunk: z.number(),
1384
+ categoryOverridden: z.number()
1385
+ });
1386
+
1387
+ export const ClassifierStatsSchema = z.object({
1388
+ since: z.string(),
1389
+ examined: z.number(),
1390
+ byCategory: z.array(ClassifierCategoryCountSchema),
1391
+ byLabel: z.array(ClassifierLabelCountSchema),
1392
+ corrections: ClassifierCorrectionsSchema
1393
+ });
1394
+
1358
1395
  export const CalendarTaskResponseSchema = z.object({
1359
1396
  calendarTaskId: z.string().min(25).max(25),
1360
1397
  calendarId: z.string().min(25).max(25),
@@ -1980,6 +2017,12 @@ export const MessageFilterMoveSchema = z.object({
1980
2017
  decidedAt: z.number()
1981
2018
  });
1982
2019
 
2020
+ export const ClassifierScoreSchema = z.object({
2021
+ label: ClassificationLabelSchema,
2022
+ confidence: z.number().min(0).max(1),
2023
+ confident: z.boolean()
2024
+ });
2025
+
1983
2026
  export const MessageRecordSchema = z.object({
1984
2027
  messageId: z.string().min(25).max(25),
1985
2028
  mailboxId: z.string().min(25).max(25),
@@ -2006,6 +2049,7 @@ export const MessageRecordSchema = z.object({
2006
2049
  placementVerdict: MessagePlacementVerdictSchema.optional(),
2007
2050
  filterMove: MessageFilterMoveSchema.optional(),
2008
2051
  placementDecidedAt: z.number().optional(),
2052
+ classifierScores: z.array(ClassifierScoreSchema),
2009
2053
  spamReport: MessageSpamReportSchema.optional(),
2010
2054
  createdAt: z.number(),
2011
2055
  updatedAt: z.number()
@@ -2037,6 +2081,7 @@ export const MessageSchema = z.object({
2037
2081
  placementVerdict: MessagePlacementVerdictSchema.optional(),
2038
2082
  filterMove: MessageFilterMoveSchema.optional(),
2039
2083
  placementDecidedAt: z.number().optional(),
2084
+ classifierScores: z.array(ClassifierScoreSchema),
2040
2085
  spamReport: MessageSpamReportSchema.optional(),
2041
2086
  createdAt: z.number(),
2042
2087
  updatedAt: z.number(),