@remit/api-zod-schemas 0.0.83 → 0.0.85

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
@@ -67,6 +67,8 @@ export const FilterRuleHeaderSchema = z.enum(["From", "Subject", "ListId"]);
67
67
 
68
68
  export const FilterRuleAddressPartSchema = z.enum(["All", "Localpart", "Domain", "RegistrableDomain"]);
69
69
 
70
+ export const ClassificationLabelSchema = z.enum(["Spam", "Phishing", "Priority", "Personal", "Newsletter", "Marketing", "Automated", "Transactional", "Social", "ColdOutreach"]);
71
+
70
72
  export const LabelColorSchema = z.enum(["Default", "Red", "Orange", "Yellow", "Green", "Teal", "Blue", "Purple", "Gray"]);
71
73
 
72
74
  export const OrganizeJobStateSchema = z.enum(["Pending", "Running", "Complete", "Failed"]);
@@ -107,8 +109,6 @@ export const ClassificationValueSourceSchema = z.enum(["Saved", "Deployment", "D
107
109
 
108
110
  export const ClassificationUnrunnableReasonSchema = z.enum(["NoBaseUrl", "NoApiKey"]);
109
111
 
110
- export const ClassificationLabelSchema = z.enum(["Spam", "Phishing", "Priority", "Personal", "Newsletter", "Marketing", "Automated", "Transactional", "Social", "ColdOutreach"]);
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"]);
@@ -824,30 +824,35 @@ export const FilterHasWordsTestSchema = z.object({
824
824
  words: z.array(z.string().max(256))
825
825
  });
826
826
 
827
- export type FilterAllOfTest = { test: "allof"; tests: Array<FilterAllOfTest | FilterAnyOfTest | FilterNotTest | z.infer<typeof FilterHeaderTestSchema> | z.infer<typeof FilterAddressTestSchema> | z.infer<typeof FilterHasWordsTestSchema>> };
827
+ export const FilterClassificationTestSchema = z.object({
828
+ test: z.literal("classification"),
829
+ label: ClassificationLabelSchema
830
+ });
831
+
832
+ export type FilterAllOfTest = { test: "allof"; tests: Array<FilterAllOfTest | FilterAnyOfTest | FilterNotTest | z.infer<typeof FilterHeaderTestSchema> | z.infer<typeof FilterAddressTestSchema> | z.infer<typeof FilterHasWordsTestSchema> | z.infer<typeof FilterClassificationTestSchema>> };
828
833
 
829
834
  export const FilterAllOfTestSchema: z.ZodType<FilterAllOfTest> = z.object({
830
835
  test: z.literal("allof"),
831
- tests: z.array(z.union([z.lazy(() => FilterAllOfTestSchema), z.lazy(() => FilterAnyOfTestSchema), z.lazy(() => FilterNotTestSchema), FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema]))
836
+ tests: z.array(z.union([z.lazy(() => FilterAllOfTestSchema), z.lazy(() => FilterAnyOfTestSchema), z.lazy(() => FilterNotTestSchema), FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema, FilterClassificationTestSchema])).min(1).max(50)
832
837
  });
833
838
 
834
- export type FilterAnyOfTest = { test: "anyof"; tests: Array<FilterAllOfTest | FilterAnyOfTest | FilterNotTest | z.infer<typeof FilterHeaderTestSchema> | z.infer<typeof FilterAddressTestSchema> | z.infer<typeof FilterHasWordsTestSchema>> };
839
+ export type FilterAnyOfTest = { test: "anyof"; tests: Array<FilterAllOfTest | FilterAnyOfTest | FilterNotTest | z.infer<typeof FilterHeaderTestSchema> | z.infer<typeof FilterAddressTestSchema> | z.infer<typeof FilterHasWordsTestSchema> | z.infer<typeof FilterClassificationTestSchema>> };
835
840
 
836
841
  export const FilterAnyOfTestSchema: z.ZodType<FilterAnyOfTest> = z.object({
837
842
  test: z.literal("anyof"),
838
- tests: z.array(z.union([FilterAllOfTestSchema, z.lazy(() => FilterAnyOfTestSchema), z.lazy(() => FilterNotTestSchema), FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema]))
843
+ tests: z.array(z.union([FilterAllOfTestSchema, z.lazy(() => FilterAnyOfTestSchema), z.lazy(() => FilterNotTestSchema), FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema, FilterClassificationTestSchema])).min(1).max(50)
839
844
  });
840
845
 
841
- export type FilterNotTest = { test: "not"; operand: FilterAllOfTest | FilterAnyOfTest | FilterNotTest | z.infer<typeof FilterHeaderTestSchema> | z.infer<typeof FilterAddressTestSchema> | z.infer<typeof FilterHasWordsTestSchema> };
846
+ export type FilterNotTest = { test: "not"; operand: FilterAllOfTest | FilterAnyOfTest | FilterNotTest | z.infer<typeof FilterHeaderTestSchema> | z.infer<typeof FilterAddressTestSchema> | z.infer<typeof FilterHasWordsTestSchema> | z.infer<typeof FilterClassificationTestSchema> };
842
847
 
843
848
  export const FilterNotTestSchema: z.ZodType<FilterNotTest> = z.object({
844
849
  test: z.literal("not"),
845
- operand: z.union([FilterAllOfTestSchema, FilterAnyOfTestSchema, z.lazy(() => FilterNotTestSchema), FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema])
850
+ operand: z.union([FilterAllOfTestSchema, FilterAnyOfTestSchema, z.lazy(() => FilterNotTestSchema), FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema, FilterClassificationTestSchema])
846
851
  });
847
852
 
848
853
  export const FilterRuleV1Schema = z.object({
849
854
  version: z.literal(1),
850
- test: z.union([FilterAllOfTestSchema, FilterAnyOfTestSchema, FilterNotTestSchema, FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema])
855
+ test: z.union([FilterAllOfTestSchema, FilterAnyOfTestSchema, FilterNotTestSchema, FilterHeaderTestSchema, FilterAddressTestSchema, FilterHasWordsTestSchema, FilterClassificationTestSchema])
851
856
  });
852
857
 
853
858
  export const FilterSchema = z.object({
@@ -862,8 +867,10 @@ export const FilterSchema = z.object({
862
867
  ruleChangedAt: z.number(),
863
868
  actionChangedAt: z.number(),
864
869
  matchOperator: FilterMatchOperatorSchema,
865
- literalClauses: z.array(FilterClauseSchema).min(1),
870
+ literalClauses: z.array(FilterClauseSchema),
866
871
  rule: z.union([FilterRuleV0Schema, FilterRuleV1Schema]),
872
+ priority: z.number(),
873
+ stop: z.boolean(),
867
874
  actionLabelId: z.string(),
868
875
  actionMailboxId: z.string(),
869
876
  createdAt: z.number(),
@@ -881,11 +888,14 @@ export const FilterResponseSchema = z.object({
881
888
  ruleChangedAt: z.number(),
882
889
  actionChangedAt: z.number(),
883
890
  matchOperator: FilterMatchOperatorSchema,
884
- literalClauses: z.array(FilterClauseSchema).min(1),
891
+ literalClauses: z.array(FilterClauseSchema),
892
+ priority: z.number(),
893
+ stop: z.boolean(),
885
894
  actionLabelId: z.string(),
886
895
  actionMailboxId: z.string(),
887
896
  createdAt: z.number(),
888
- updatedAt: z.number()
897
+ updatedAt: z.number(),
898
+ rule: FilterRuleV1Schema
889
899
  });
890
900
 
891
901
  export const CreateFilterInputSchema = z.object({
@@ -893,9 +903,12 @@ export const CreateFilterInputSchema = z.object({
893
903
  scope: FilterScopeSchema,
894
904
  expiresAt: z.string().optional(),
895
905
  matchOperator: FilterMatchOperatorSchema,
896
- literalClauses: z.array(FilterClauseSchema).min(1),
897
906
  actionLabelId: z.string(),
898
- actionMailboxId: z.string()
907
+ actionMailboxId: z.string(),
908
+ priority: z.number().optional(),
909
+ stop: z.boolean().optional(),
910
+ literalClauses: z.array(FilterClauseSchema).optional(),
911
+ rule: FilterRuleV1Schema.optional()
899
912
  });
900
913
 
901
914
  export const CreateFilterResponseSchema = z.object({
@@ -909,23 +922,29 @@ export const CreateFilterResponseSchema = z.object({
909
922
  ruleChangedAt: z.number(),
910
923
  actionChangedAt: z.number(),
911
924
  matchOperator: FilterMatchOperatorSchema,
912
- literalClauses: z.array(FilterClauseSchema).min(1),
925
+ literalClauses: z.array(FilterClauseSchema),
926
+ priority: z.number(),
927
+ stop: z.boolean(),
913
928
  actionLabelId: z.string(),
914
929
  actionMailboxId: z.string(),
915
930
  createdAt: z.number(),
916
931
  updatedAt: z.number(),
932
+ rule: FilterRuleV1Schema,
917
933
  organizeJobId: z.string()
918
934
  });
919
935
 
920
936
  export const UpdateFilterInputSchema = z.object({
921
- name: z.string().max(256),
922
- scope: FilterScopeSchema,
937
+ name: z.string().max(256).optional(),
938
+ scope: FilterScopeSchema.optional(),
923
939
  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()
940
+ state: FilterStateSchema.optional(),
941
+ matchOperator: FilterMatchOperatorSchema.optional(),
942
+ literalClauses: z.array(FilterClauseSchema).optional(),
943
+ priority: z.number().optional(),
944
+ stop: z.boolean().optional(),
945
+ actionLabelId: z.string().optional(),
946
+ actionMailboxId: z.string().optional(),
947
+ rule: FilterRuleV1Schema.optional()
929
948
  });
930
949
 
931
950
  export const LabelSchema = z.object({
@@ -2480,6 +2499,15 @@ export const MessageLabelSchema = z.object({
2480
2499
  updatedAt: z.number()
2481
2500
  });
2482
2501
 
2502
+ export const LabelMailboxSchema = z.object({
2503
+ labelMailboxId: z.string().min(25).max(25),
2504
+ labelId: z.string().min(25).max(25),
2505
+ accountId: z.string().min(25).max(25),
2506
+ mailboxId: z.string().min(25).max(25),
2507
+ createdAt: z.number(),
2508
+ updatedAt: z.number()
2509
+ });
2510
+
2483
2511
  export const MicrosoftOAuthStartRequestSchema = z.object({
2484
2512
  email: z.string().optional(),
2485
2513
  services: z.array(AccountServiceSchema).min(1).optional()