@remit/api-zod-schemas 0.0.90 → 0.0.92

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
@@ -111,12 +111,18 @@ export const ClassificationValueSourceSchema = z.enum(["Saved", "Deployment", "D
111
111
 
112
112
  export const ClassificationUnrunnableReasonSchema = z.enum(["NoBaseUrl", "NoApiKey"]);
113
113
 
114
+ export const SpamLabelPlacementSchema = z.enum(["MoveToSpam", "WarnOnly"]);
115
+
114
116
  export const ClassificationFailureKindSchema = z.enum(["Unauthorized", "ModelNotFound", "RateLimited", "Rejected", "ProviderError", "Unreachable", "TimedOut", "Unparseable"]);
115
117
 
116
118
  export const ClassificationFieldSchema = z.enum(["ApiKey", "Model", "BaseUrl"]);
117
119
 
118
120
  export const MessageCategorySchema = z.enum(["uncategorized", "personal", "newsletter", "marketing", "automated", "transactional", "social", "coldOutreach"]);
119
121
 
122
+ export const SpamActionSchema = z.enum(["None", "Warn", "Junk"]);
123
+
124
+ export const SpamKindSchema = z.enum(["Spam", "Phishing"]);
125
+
120
126
  export const SortOrderSchema = z.enum(["asc", "desc"]);
121
127
 
122
128
  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"]);
@@ -137,11 +143,9 @@ export const PlacementConfidenceSchema = z.enum(["Confident", "Unsure"]);
137
143
 
138
144
  export const SpamSenderScreenRuleSchema = z.enum(["ReportedSender", "NeverSpam", "Vip", "WellKnown", "Newsletter"]);
139
145
 
140
- export const SpamActionSchema = z.enum(["None", "Warn", "Junk"]);
141
-
142
- export const SpamKindSchema = z.enum(["Spam", "Phishing"]);
146
+ 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"]);
143
147
 
144
- export const SpamReasonNameSchema = z.enum(["DmarcFail", "SignerMismatch", "ReplyToMismatch", "LinkTextMismatch", "LinkDomainDistant", "PunycodeDomain", "MixedScriptDomain", "ConfusableDomains", "SingleOffDomainLink", "GeneratedName", "FirstContactDomain", "RecentlyRegisteredDomain", "UnknownRegistrationDate", "ClassifierSpam", "ClassifierPhishing", "ProviderSpam", "DisplayNameForeignAddress", "DisplayNameLookalike", "ListedPhishingLink", "BackendSymbol"]);
148
+ export const SpamModelOutcomeSchema = z.enum(["Answered", "NotConfigured", "DailyLimit", "RateLimited", "OutOfBand"]);
145
149
 
146
150
  export const SpamFailureKindSchema = z.enum(["Unreachable", "TimedOut", "ServiceError", "Unparseable"]);
147
151
 
@@ -153,8 +157,6 @@ export const AddressFlagKeySchema = z.enum(["trusted", "blocked", "muted", "vip"
153
157
 
154
158
  export const MessageClassificationStateSchema = z.enum(["NotExamined", "Examined"]);
155
159
 
156
- export const AuthenticityVerdictSchema = z.enum(["NotEvaluated", "NotChecked", "Aligned", "Authenticated", "Routine", "Caution", "Impersonation"]);
157
-
158
160
  export const AuthResultVerdictSchema = z.enum(["Pass", "Fail", "None", "Neutral", "Softfail"]);
159
161
 
160
162
  export const AddressRoleSchema = z.enum(["from", "sender", "reply_to", "to", "cc", "bcc"]);
@@ -169,6 +171,8 @@ export const MultipartSubtypeSchema = z.enum(["mixed", "alternative", "digest",
169
171
 
170
172
  export const ReferenceTypeSchema = z.enum(["in_reply_to", "references"]);
171
173
 
174
+ export const RescanFailureCodeSchema = z.enum(["RateLimited", "DailyCap", "NotSettled", "NotFound", "NotPermitted"]);
175
+
172
176
  export const LabelActionSchema = z.enum(["Apply", "Remove"]);
173
177
 
174
178
  export const CalendarSuggestionStateSchema = z.enum(["Pending", "Accepted", "Declined", "Tentative", "Dismissed", "Superseded"]);
@@ -189,7 +193,7 @@ export const ContentEncodingSchema = z.enum(["none", "gzip", "zstd"]);
189
193
 
190
194
  export const SenderOverrideSchema = z.enum(["none", "blocked", "neverSpam"]);
191
195
 
192
- 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"]);
196
+ 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"]);
193
197
 
194
198
  export const ConfigImportStateSchema = z.enum(["Pending", "Complete"]);
195
199
 
@@ -1364,11 +1368,28 @@ export const ClassificationUnrunnableSchema = z.object({
1364
1368
  reason: ClassificationUnrunnableReasonSchema
1365
1369
  });
1366
1370
 
1371
+ export const SpamThresholdsUnsetSchema = z.object({
1372
+ state: z.literal("Unset")
1373
+ });
1374
+
1375
+ export const SpamThresholdsSetSchema = z.object({
1376
+ state: z.literal("Set"),
1377
+ cleanBelow: z.number().min(0).max(1),
1378
+ spamAt: z.number().min(0).max(1)
1379
+ });
1380
+
1381
+ export const SpamSettingsSchema = z.object({
1382
+ thresholds: z.union([SpamThresholdsUnsetSchema, SpamThresholdsSetSchema]),
1383
+ spamPlacement: SpamLabelPlacementSchema,
1384
+ phishingPlacement: SpamLabelPlacementSchema
1385
+ });
1386
+
1367
1387
  export const UserSettingsResponseSchema = z.object({
1368
1388
  defaultInvitationSenderAccountId: z.string().min(25).max(25).optional(),
1369
1389
  defaultInvitationSenderChosen: z.boolean(),
1370
1390
  classificationPresets: z.array(ClassificationPresetSchema),
1371
- classification: z.union([ClassificationNotConfiguredSchema, ClassificationConfiguredSchema, ClassificationUnrunnableSchema])
1391
+ classification: z.union([ClassificationNotConfiguredSchema, ClassificationConfiguredSchema, ClassificationUnrunnableSchema]),
1392
+ spam: SpamSettingsSchema
1372
1393
  });
1373
1394
 
1374
1395
  export const UpdateUserSettingsInputSchema = z.object({
@@ -1378,7 +1399,9 @@ export const UpdateUserSettingsInputSchema = z.object({
1378
1399
  classificationBaseUrl: z.string().optional(),
1379
1400
  classificationApiKey: z.string().optional(),
1380
1401
  classificationEnabled: z.boolean().optional(),
1381
- classificationDailyLimit: z.number().min(1).optional()
1402
+ classificationDailyLimit: z.number().min(1).optional(),
1403
+ spamPlacementSpam: SpamLabelPlacementSchema.optional(),
1404
+ spamPlacementPhishing: SpamLabelPlacementSchema.optional()
1382
1405
  });
1383
1406
 
1384
1407
  export const ClassificationTestInputSchema = z.object({
@@ -1419,12 +1442,26 @@ export const ClassifierCorrectionsSchema = z.object({
1419
1442
  categoryOverridden: z.number()
1420
1443
  });
1421
1444
 
1445
+ export const SpamDayCountSchema = z.object({
1446
+ date: z.string(),
1447
+ action: SpamActionSchema,
1448
+ kind: SpamKindSchema,
1449
+ count: z.number()
1450
+ });
1451
+
1452
+ export const SpamScoreBandSchema = z.object({
1453
+ from: z.number().min(0).max(1),
1454
+ count: z.number()
1455
+ });
1456
+
1422
1457
  export const ClassifierStatsSchema = z.object({
1423
1458
  since: z.string(),
1424
1459
  examined: z.number(),
1425
1460
  byCategory: z.array(ClassifierCategoryCountSchema),
1426
1461
  byLabel: z.array(ClassifierLabelCountSchema),
1427
- corrections: ClassifierCorrectionsSchema
1462
+ corrections: ClassifierCorrectionsSchema,
1463
+ spamByDay: z.array(SpamDayCountSchema),
1464
+ spamScoreBands: z.array(SpamScoreBandSchema)
1428
1465
  });
1429
1466
 
1430
1467
  export const CalendarTaskResponseSchema = z.object({
@@ -1679,7 +1716,7 @@ export const SpamCheckedSchema = z.object({
1679
1716
  action: SpamActionSchema,
1680
1717
  kind: SpamKindSchema,
1681
1718
  reasons: z.array(SpamReasonSchema),
1682
- modelCalled: z.boolean()
1719
+ modelOutcome: SpamModelOutcomeSchema
1683
1720
  });
1684
1721
 
1685
1722
  export const SpamFailedSchema = z.object({
@@ -2117,7 +2154,6 @@ export const MessageRecordSchema = z.object({
2117
2154
  category: MessageCategorySchema,
2118
2155
  classificationState: MessageClassificationStateSchema,
2119
2156
  authenticity: MessageAuthenticitySchema.optional(),
2120
- authenticityVerdict: AuthenticityVerdictSchema,
2121
2157
  authResult: MessageAuthResultSchema.optional(),
2122
2158
  providerSpam: MessageProviderSpamSchema.optional(),
2123
2159
  hasListUnsubscribe: z.boolean(),
@@ -2150,7 +2186,6 @@ export const MessageSchema = z.object({
2150
2186
  category: MessageCategorySchema,
2151
2187
  classificationState: MessageClassificationStateSchema,
2152
2188
  authenticity: MessageAuthenticitySchema.optional(),
2153
- authenticityVerdict: AuthenticityVerdictSchema,
2154
2189
  authResult: MessageAuthResultSchema.optional(),
2155
2190
  providerSpam: MessageProviderSpamSchema.optional(),
2156
2191
  hasListUnsubscribe: z.boolean(),
@@ -2210,6 +2245,28 @@ export const UpdateFlagsInputSchema = z.object({
2210
2245
  starColor: StarColorSchema.optional()
2211
2246
  });
2212
2247
 
2248
+ export const RescanInputSchema = z.object({
2249
+ messageIds: z.array(z.string().min(25).max(25)).min(1).max(10),
2250
+ move: z.boolean().optional()
2251
+ });
2252
+
2253
+ export const RescanSuccessSchema = z.object({
2254
+ messageId: z.string().min(25).max(25),
2255
+ verdict: z.union([SpamVerdictNotCheckedSchema, SpamVerdictScreenedOutSchema, SpamCheckedSchema, SpamFailedSchema]),
2256
+ labels: z.array(z.string())
2257
+ });
2258
+
2259
+ export const RescanFailureSchema = z.object({
2260
+ messageId: z.string().min(25).max(25),
2261
+ code: RescanFailureCodeSchema,
2262
+ retryable: z.boolean()
2263
+ });
2264
+
2265
+ export const RescanResultSchema = z.object({
2266
+ successful: z.array(RescanSuccessSchema),
2267
+ failed: z.array(RescanFailureSchema)
2268
+ });
2269
+
2213
2270
  export const BulkUpdateFlagsInputSchema = z.object({
2214
2271
  messageIds: z.array(z.string().min(25).max(25)).min(1).max(100),
2215
2272
  isRead: z.boolean().optional(),