@remit/api-zod-schemas 0.0.91 → 0.0.93

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.js CHANGED
@@ -56,21 +56,21 @@ export const ClassificationPresetGroupSchema = z.enum(["Hosted", "Custom", "Loca
56
56
  export const ClassificationAdapterShapeSchema = z.enum(["DecisionApi", "ChatJsonSchema", "JinaClassify"]);
57
57
  export const ClassificationValueSourceSchema = z.enum(["Saved", "Deployment", "Default"]);
58
58
  export const ClassificationUnrunnableReasonSchema = z.enum(["NoBaseUrl", "NoApiKey"]);
59
+ export const SpamLabelPlacementSchema = z.enum(["MoveToSpam", "WarnOnly"]);
59
60
  export const ClassificationFailureKindSchema = z.enum(["Unauthorized", "ModelNotFound", "RateLimited", "Rejected", "ProviderError", "Unreachable", "TimedOut", "Unparseable"]);
60
61
  export const ClassificationFieldSchema = z.enum(["ApiKey", "Model", "BaseUrl"]);
61
62
  export const MessageCategorySchema = z.enum(["uncategorized", "personal", "newsletter", "marketing", "automated", "transactional", "social", "coldOutreach"]);
63
+ export const SpamActionSchema = z.enum(["None", "Warn", "Junk"]);
64
+ export const SpamKindSchema = z.enum(["Spam", "Phishing"]);
62
65
  export const SortOrderSchema = z.enum(["asc", "desc"]);
63
66
  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"]);
64
67
  export const SenderTrustSchema = z.enum(["unknown", "wellknown", "vip"]);
65
- export const DisplayNameCorrespondenceSchema = z.enum(["Corresponds", "Lookalike", "ForeignAddress", "Unrelated", "NoClaim"]);
66
68
  export const MessageStatusSchema = z.enum(["active", "deleting", "deleted", "moving"]);
67
69
  export const MessageSyncStatusSchema = z.enum(["synced", "pending", "failed", "abandoned"]);
68
70
  export const MessageMutationSchema = z.enum(["none", "move", "delete", "copy"]);
69
71
  export const PlacementActionSchema = z.enum(["MoveToInbox", "MoveToJunk"]);
70
72
  export const PlacementConfidenceSchema = z.enum(["Confident", "Unsure"]);
71
73
  export const SpamSenderScreenRuleSchema = z.enum(["ReportedSender", "NeverSpam", "Vip", "WellKnown", "Newsletter"]);
72
- export const SpamActionSchema = z.enum(["None", "Warn", "Junk"]);
73
- export const SpamKindSchema = z.enum(["Spam", "Phishing"]);
74
74
  export const SpamReasonNameSchema = z.enum(["DmarcFail", "SignerMismatch", "ReplyToMismatch", "LinkTextMismatch", "LinkDomainDistant", "PunycodeDomain", "MixedScriptDomain", "ConfusableDomains", "SingleOffDomainLink", "GeneratedName", "FirstContactDomain", "RecentlyRegisteredDomain", "UnknownRegistrationDate", "ClassifierSpam", "ClassifierPhishing", "ProviderSpam", "DisplayNameForeignAddress", "DisplayNameLookalike", "ModelImpersonation", "ModelSpam", "ModelClean", "ListedPhishingLink", "BackendSymbol"]);
75
75
  export const SpamModelOutcomeSchema = z.enum(["Answered", "NotConfigured", "DailyLimit", "RateLimited", "OutOfBand"]);
76
76
  export const SpamFailureKindSchema = z.enum(["Unreachable", "TimedOut", "ServiceError", "Unparseable"]);
@@ -78,7 +78,6 @@ export const OutboxAttachmentStateSchema = z.enum(["Pending", "Stored"]);
78
78
  export const OutboxAttachmentRejectionReasonSchema = z.enum(["EmptyFile", "UnusableFilename", "FileTooLarge", "MessageTooLarge", "TooManyAttachments", "ReservationExpired", "UploadMissing", "SizeMismatch"]);
79
79
  export const AddressFlagKeySchema = z.enum(["trusted", "blocked", "muted", "vip", "junkOnly", "category", "autoArchive", "unsubscribed", "neverSpam"]);
80
80
  export const MessageClassificationStateSchema = z.enum(["NotExamined", "Examined"]);
81
- export const AuthenticityVerdictSchema = z.enum(["NotEvaluated", "NotChecked", "Aligned", "Authenticated", "Routine", "Caution", "Impersonation"]);
82
81
  export const AuthResultVerdictSchema = z.enum(["Pass", "Fail", "None", "Neutral", "Softfail"]);
83
82
  export const AddressRoleSchema = z.enum(["from", "sender", "reply_to", "to", "cc", "bcc"]);
84
83
  export const MediaTypeSchema = z.enum(["TEXT", "IMAGE", "AUDIO", "VIDEO", "APPLICATION", "MULTIPART", "MESSAGE"]);
@@ -97,9 +96,10 @@ export const MailboxAttributeSchema = z.enum(["\\NonExistent", "\\Noinferiors",
97
96
  export const StorageTypeSchema = z.enum(["s3", "filesystem", "inline", "database"]);
98
97
  export const ContentEncodingSchema = z.enum(["none", "gzip", "zstd"]);
99
98
  export const SenderOverrideSchema = z.enum(["none", "blocked", "neverSpam"]);
100
- export const AccountSettingNameSchema = z.enum(["Theme", "Density", "DefaultComposerFormat", "PinnedFolders", "AccountSignaturePlainText", "AccountSignatureHtml", "AccountDisplayName", "AccountMuted", "AccountComposeLanguages", "MailboxDisplayName", "MailboxMuted", "FolderRoleAppointment", "FolderRoleAppointmentLabel", "MailboxRole", "DefaultInvitationSenderAccountId", "ClassificationPresetId", "ClassificationModel", "ClassificationBaseUrl", "ClassificationApiKey", "ClassificationEnabled", "ClassificationDailyLimit", "ClassificationUsage"]);
99
+ export const AccountSettingNameSchema = z.enum(["Theme", "Density", "DefaultComposerFormat", "PinnedFolders", "AccountSignaturePlainText", "AccountSignatureHtml", "AccountDisplayName", "AccountMuted", "AccountComposeLanguages", "MailboxDisplayName", "MailboxMuted", "FolderRoleAppointment", "FolderRoleAppointmentLabel", "MailboxRole", "DefaultInvitationSenderAccountId", "ClassificationPresetId", "ClassificationModel", "ClassificationBaseUrl", "ClassificationApiKey", "ClassificationEnabled", "ClassificationDailyLimit", "ClassificationUsage", "SpamPlacementSpam", "SpamPlacementPhishing"]);
101
100
  export const ConfigImportStateSchema = z.enum(["Pending", "Complete"]);
102
101
  export const ConfigImportRefKindSchema = z.enum(["FolderRole", "MailboxOverride", "FilterAction"]);
102
+ export const DisplayNameCorrespondenceSchema = z.enum(["Corresponds", "Lookalike", "ForeignAddress", "Unrelated", "NoClaim"]);
103
103
  export const SyncWarningStateSchema = z.enum(["Retrying", "GaveUp"]);
104
104
  export const ProviderSpamVerdictSchema = z.enum(["Spam", "Clean", "Absent"]);
105
105
  export const MessagePlacementMoveStateSchema = z.enum(["pending", "queued", "processing", "processed"]);
@@ -1132,11 +1132,25 @@ export const ClassificationUnrunnableSchema = z.object({
1132
1132
  presetId: ClassificationPresetIdSchema,
1133
1133
  reason: ClassificationUnrunnableReasonSchema
1134
1134
  });
1135
+ export const SpamThresholdsUnsetSchema = z.object({
1136
+ state: z.literal("Unset")
1137
+ });
1138
+ export const SpamThresholdsSetSchema = z.object({
1139
+ state: z.literal("Set"),
1140
+ cleanBelow: z.number().min(0).max(1),
1141
+ spamAt: z.number().min(0).max(1)
1142
+ });
1143
+ export const SpamSettingsSchema = z.object({
1144
+ thresholds: z.union([SpamThresholdsUnsetSchema, SpamThresholdsSetSchema]),
1145
+ spamPlacement: SpamLabelPlacementSchema,
1146
+ phishingPlacement: SpamLabelPlacementSchema
1147
+ });
1135
1148
  export const UserSettingsResponseSchema = z.object({
1136
1149
  defaultInvitationSenderAccountId: z.string().min(25).max(25).optional(),
1137
1150
  defaultInvitationSenderChosen: z.boolean(),
1138
1151
  classificationPresets: z.array(ClassificationPresetSchema),
1139
- classification: z.union([ClassificationNotConfiguredSchema, ClassificationConfiguredSchema, ClassificationUnrunnableSchema])
1152
+ classification: z.union([ClassificationNotConfiguredSchema, ClassificationConfiguredSchema, ClassificationUnrunnableSchema]),
1153
+ spam: SpamSettingsSchema
1140
1154
  });
1141
1155
  export const UpdateUserSettingsInputSchema = z.object({
1142
1156
  defaultInvitationSenderAccountId: z.string().min(25).max(25).optional(),
@@ -1145,7 +1159,9 @@ export const UpdateUserSettingsInputSchema = z.object({
1145
1159
  classificationBaseUrl: z.string().optional(),
1146
1160
  classificationApiKey: z.string().optional(),
1147
1161
  classificationEnabled: z.boolean().optional(),
1148
- classificationDailyLimit: z.number().min(1).optional()
1162
+ classificationDailyLimit: z.number().min(1).optional(),
1163
+ spamPlacementSpam: SpamLabelPlacementSchema.optional(),
1164
+ spamPlacementPhishing: SpamLabelPlacementSchema.optional()
1149
1165
  });
1150
1166
  export const ClassificationTestInputSchema = z.object({
1151
1167
  presetId: ClassificationPresetIdSchema,
@@ -1179,12 +1195,24 @@ export const ClassifierCorrectionsSchema = z.object({
1179
1195
  spamReportedNotJunk: z.number(),
1180
1196
  categoryOverridden: z.number()
1181
1197
  });
1198
+ export const SpamDayCountSchema = z.object({
1199
+ date: z.string(),
1200
+ action: SpamActionSchema,
1201
+ kind: SpamKindSchema,
1202
+ count: z.number()
1203
+ });
1204
+ export const SpamScoreBandSchema = z.object({
1205
+ from: z.number().min(0).max(1),
1206
+ count: z.number()
1207
+ });
1182
1208
  export const ClassifierStatsSchema = z.object({
1183
1209
  since: z.string(),
1184
1210
  examined: z.number(),
1185
1211
  byCategory: z.array(ClassifierCategoryCountSchema),
1186
1212
  byLabel: z.array(ClassifierLabelCountSchema),
1187
- corrections: ClassifierCorrectionsSchema
1213
+ corrections: ClassifierCorrectionsSchema,
1214
+ spamByDay: z.array(SpamDayCountSchema),
1215
+ spamScoreBands: z.array(SpamScoreBandSchema)
1188
1216
  });
1189
1217
  export const CalendarTaskResponseSchema = z.object({
1190
1218
  calendarTaskId: z.string().min(25).max(25),
@@ -1357,8 +1385,6 @@ export const MessageAuthenticitySchema = z.object({
1357
1385
  fromDomain: z.string(),
1358
1386
  dkimDomain: z.string().optional(),
1359
1387
  dkimMismatch: z.boolean(),
1360
- displayNameCorrespondence: DisplayNameCorrespondenceSchema.optional(),
1361
- offDomainLinkDomains: z.array(z.string()).optional(),
1362
1388
  signerDomain: z.string().optional(),
1363
1389
  envelopeDomain: z.string().optional(),
1364
1390
  signerMessageCount: z.number().optional(),
@@ -1444,12 +1470,13 @@ export const ThreadMessageResponseSchema = z.object({
1444
1470
  status: MessageStatusSchema,
1445
1471
  syncStatus: MessageSyncStatusSchema,
1446
1472
  abandonedMutation: MessageMutationSchema,
1447
- accountId: z.string().min(25).max(25).optional(),
1473
+ accountId: z.string().min(25).max(25),
1448
1474
  autoMoved: AutoMovedInfoSchema.optional(),
1449
1475
  labels: z.array(LabelSummaryResponseSchema).optional(),
1450
1476
  spamReport: MessageSpamReportSchema.optional(),
1451
1477
  placementVerdict: MessagePlacementVerdictSchema.optional(),
1452
- spamVerdict: z.union([SpamVerdictNotCheckedSchema, SpamVerdictScreenedOutSchema, SpamCheckedSchema, SpamFailedSchema])
1478
+ spamVerdict: z.union([SpamVerdictNotCheckedSchema, SpamVerdictScreenedOutSchema, SpamCheckedSchema, SpamFailedSchema]),
1479
+ spamCleared: z.boolean()
1453
1480
  });
1454
1481
  export const ThreadMessageListResponseSchema = z.object({
1455
1482
  continuationToken: z.string().max(800).optional(),
@@ -1722,6 +1749,7 @@ export const MessageSummaryResponseSchema = z.object({
1722
1749
  abandonedMutation: MessageMutationSchema,
1723
1750
  authenticity: MessageAuthenticitySchema.optional(),
1724
1751
  spamVerdict: z.union([SpamVerdictNotCheckedSchema, SpamVerdictScreenedOutSchema, SpamCheckedSchema, SpamFailedSchema]),
1752
+ spamCleared: z.boolean(),
1725
1753
  messageIdHeader: z.string().optional(),
1726
1754
  autoMoved: AutoMovedInfoSchema.optional(),
1727
1755
  labels: z.array(LabelSummaryResponseSchema).optional(),
@@ -1811,7 +1839,6 @@ export const MessageRecordSchema = z.object({
1811
1839
  category: MessageCategorySchema,
1812
1840
  classificationState: MessageClassificationStateSchema,
1813
1841
  authenticity: MessageAuthenticitySchema.optional(),
1814
- authenticityVerdict: AuthenticityVerdictSchema,
1815
1842
  authResult: MessageAuthResultSchema.optional(),
1816
1843
  providerSpam: MessageProviderSpamSchema.optional(),
1817
1844
  hasListUnsubscribe: z.boolean(),
@@ -1822,6 +1849,7 @@ export const MessageRecordSchema = z.object({
1822
1849
  classifierScores: z.array(ClassifierScoreSchema),
1823
1850
  spamReport: MessageSpamReportSchema.optional(),
1824
1851
  spamVerdict: z.union([SpamVerdictNotCheckedSchema, SpamVerdictScreenedOutSchema, SpamCheckedSchema, SpamFailedSchema]),
1852
+ spamCleared: z.boolean(),
1825
1853
  createdAt: z.number(),
1826
1854
  updatedAt: z.number()
1827
1855
  });
@@ -1843,7 +1871,6 @@ export const MessageSchema = z.object({
1843
1871
  category: MessageCategorySchema,
1844
1872
  classificationState: MessageClassificationStateSchema,
1845
1873
  authenticity: MessageAuthenticitySchema.optional(),
1846
- authenticityVerdict: AuthenticityVerdictSchema,
1847
1874
  authResult: MessageAuthResultSchema.optional(),
1848
1875
  providerSpam: MessageProviderSpamSchema.optional(),
1849
1876
  hasListUnsubscribe: z.boolean(),
@@ -1854,6 +1881,7 @@ export const MessageSchema = z.object({
1854
1881
  classifierScores: z.array(ClassifierScoreSchema),
1855
1882
  spamReport: MessageSpamReportSchema.optional(),
1856
1883
  spamVerdict: z.union([SpamVerdictNotCheckedSchema, SpamVerdictScreenedOutSchema, SpamCheckedSchema, SpamFailedSchema]),
1884
+ spamCleared: z.boolean(),
1857
1885
  createdAt: z.number(),
1858
1886
  updatedAt: z.number(),
1859
1887
  messageIdHeader: z.string().optional()