@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.ts CHANGED
@@ -111,20 +111,24 @@ 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"]);
123
129
 
124
130
  export const SenderTrustSchema = z.enum(["unknown", "wellknown", "vip"]);
125
131
 
126
- export const DisplayNameCorrespondenceSchema = z.enum(["Corresponds", "Lookalike", "ForeignAddress", "Unrelated", "NoClaim"]);
127
-
128
132
  export const MessageStatusSchema = z.enum(["active", "deleting", "deleted", "moving"]);
129
133
 
130
134
  export const MessageSyncStatusSchema = z.enum(["synced", "pending", "failed", "abandoned"]);
@@ -137,10 +141,6 @@ export const PlacementConfidenceSchema = z.enum(["Confident", "Unsure"]);
137
141
 
138
142
  export const SpamSenderScreenRuleSchema = z.enum(["ReportedSender", "NeverSpam", "Vip", "WellKnown", "Newsletter"]);
139
143
 
140
- export const SpamActionSchema = z.enum(["None", "Warn", "Junk"]);
141
-
142
- export const SpamKindSchema = z.enum(["Spam", "Phishing"]);
143
-
144
144
  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"]);
145
145
 
146
146
  export const SpamModelOutcomeSchema = z.enum(["Answered", "NotConfigured", "DailyLimit", "RateLimited", "OutOfBand"]);
@@ -155,8 +155,6 @@ export const AddressFlagKeySchema = z.enum(["trusted", "blocked", "muted", "vip"
155
155
 
156
156
  export const MessageClassificationStateSchema = z.enum(["NotExamined", "Examined"]);
157
157
 
158
- export const AuthenticityVerdictSchema = z.enum(["NotEvaluated", "NotChecked", "Aligned", "Authenticated", "Routine", "Caution", "Impersonation"]);
159
-
160
158
  export const AuthResultVerdictSchema = z.enum(["Pass", "Fail", "None", "Neutral", "Softfail"]);
161
159
 
162
160
  export const AddressRoleSchema = z.enum(["from", "sender", "reply_to", "to", "cc", "bcc"]);
@@ -193,12 +191,14 @@ export const ContentEncodingSchema = z.enum(["none", "gzip", "zstd"]);
193
191
 
194
192
  export const SenderOverrideSchema = z.enum(["none", "blocked", "neverSpam"]);
195
193
 
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"]);
194
+ 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"]);
197
195
 
198
196
  export const ConfigImportStateSchema = z.enum(["Pending", "Complete"]);
199
197
 
200
198
  export const ConfigImportRefKindSchema = z.enum(["FolderRole", "MailboxOverride", "FilterAction"]);
201
199
 
200
+ export const DisplayNameCorrespondenceSchema = z.enum(["Corresponds", "Lookalike", "ForeignAddress", "Unrelated", "NoClaim"]);
201
+
202
202
  export const SyncWarningStateSchema = z.enum(["Retrying", "GaveUp"]);
203
203
 
204
204
  export const ProviderSpamVerdictSchema = z.enum(["Spam", "Clean", "Absent"]);
@@ -1368,11 +1368,28 @@ export const ClassificationUnrunnableSchema = z.object({
1368
1368
  reason: ClassificationUnrunnableReasonSchema
1369
1369
  });
1370
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
+
1371
1387
  export const UserSettingsResponseSchema = z.object({
1372
1388
  defaultInvitationSenderAccountId: z.string().min(25).max(25).optional(),
1373
1389
  defaultInvitationSenderChosen: z.boolean(),
1374
1390
  classificationPresets: z.array(ClassificationPresetSchema),
1375
- classification: z.union([ClassificationNotConfiguredSchema, ClassificationConfiguredSchema, ClassificationUnrunnableSchema])
1391
+ classification: z.union([ClassificationNotConfiguredSchema, ClassificationConfiguredSchema, ClassificationUnrunnableSchema]),
1392
+ spam: SpamSettingsSchema
1376
1393
  });
1377
1394
 
1378
1395
  export const UpdateUserSettingsInputSchema = z.object({
@@ -1382,7 +1399,9 @@ export const UpdateUserSettingsInputSchema = z.object({
1382
1399
  classificationBaseUrl: z.string().optional(),
1383
1400
  classificationApiKey: z.string().optional(),
1384
1401
  classificationEnabled: z.boolean().optional(),
1385
- classificationDailyLimit: z.number().min(1).optional()
1402
+ classificationDailyLimit: z.number().min(1).optional(),
1403
+ spamPlacementSpam: SpamLabelPlacementSchema.optional(),
1404
+ spamPlacementPhishing: SpamLabelPlacementSchema.optional()
1386
1405
  });
1387
1406
 
1388
1407
  export const ClassificationTestInputSchema = z.object({
@@ -1423,12 +1442,26 @@ export const ClassifierCorrectionsSchema = z.object({
1423
1442
  categoryOverridden: z.number()
1424
1443
  });
1425
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
+
1426
1457
  export const ClassifierStatsSchema = z.object({
1427
1458
  since: z.string(),
1428
1459
  examined: z.number(),
1429
1460
  byCategory: z.array(ClassifierCategoryCountSchema),
1430
1461
  byLabel: z.array(ClassifierLabelCountSchema),
1431
- corrections: ClassifierCorrectionsSchema
1462
+ corrections: ClassifierCorrectionsSchema,
1463
+ spamByDay: z.array(SpamDayCountSchema),
1464
+ spamScoreBands: z.array(SpamScoreBandSchema)
1432
1465
  });
1433
1466
 
1434
1467
  export const CalendarTaskResponseSchema = z.object({
@@ -1617,8 +1650,6 @@ export const MessageAuthenticitySchema = z.object({
1617
1650
  fromDomain: z.string(),
1618
1651
  dkimDomain: z.string().optional(),
1619
1652
  dkimMismatch: z.boolean(),
1620
- displayNameCorrespondence: DisplayNameCorrespondenceSchema.optional(),
1621
- offDomainLinkDomains: z.array(z.string()).optional(),
1622
1653
  signerDomain: z.string().optional(),
1623
1654
  envelopeDomain: z.string().optional(),
1624
1655
  signerMessageCount: z.number().optional(),
@@ -1716,12 +1747,13 @@ export const ThreadMessageResponseSchema = z.object({
1716
1747
  status: MessageStatusSchema,
1717
1748
  syncStatus: MessageSyncStatusSchema,
1718
1749
  abandonedMutation: MessageMutationSchema,
1719
- accountId: z.string().min(25).max(25).optional(),
1750
+ accountId: z.string().min(25).max(25),
1720
1751
  autoMoved: AutoMovedInfoSchema.optional(),
1721
1752
  labels: z.array(LabelSummaryResponseSchema).optional(),
1722
1753
  spamReport: MessageSpamReportSchema.optional(),
1723
1754
  placementVerdict: MessagePlacementVerdictSchema.optional(),
1724
- spamVerdict: z.union([SpamVerdictNotCheckedSchema, SpamVerdictScreenedOutSchema, SpamCheckedSchema, SpamFailedSchema])
1755
+ spamVerdict: z.union([SpamVerdictNotCheckedSchema, SpamVerdictScreenedOutSchema, SpamCheckedSchema, SpamFailedSchema]),
1756
+ spamCleared: z.boolean()
1725
1757
  });
1726
1758
 
1727
1759
  export const ThreadMessageListResponseSchema = z.object({
@@ -2022,6 +2054,7 @@ export const MessageSummaryResponseSchema = z.object({
2022
2054
  abandonedMutation: MessageMutationSchema,
2023
2055
  authenticity: MessageAuthenticitySchema.optional(),
2024
2056
  spamVerdict: z.union([SpamVerdictNotCheckedSchema, SpamVerdictScreenedOutSchema, SpamCheckedSchema, SpamFailedSchema]),
2057
+ spamCleared: z.boolean(),
2025
2058
  messageIdHeader: z.string().optional(),
2026
2059
  autoMoved: AutoMovedInfoSchema.optional(),
2027
2060
  labels: z.array(LabelSummaryResponseSchema).optional(),
@@ -2121,7 +2154,6 @@ export const MessageRecordSchema = z.object({
2121
2154
  category: MessageCategorySchema,
2122
2155
  classificationState: MessageClassificationStateSchema,
2123
2156
  authenticity: MessageAuthenticitySchema.optional(),
2124
- authenticityVerdict: AuthenticityVerdictSchema,
2125
2157
  authResult: MessageAuthResultSchema.optional(),
2126
2158
  providerSpam: MessageProviderSpamSchema.optional(),
2127
2159
  hasListUnsubscribe: z.boolean(),
@@ -2132,6 +2164,7 @@ export const MessageRecordSchema = z.object({
2132
2164
  classifierScores: z.array(ClassifierScoreSchema),
2133
2165
  spamReport: MessageSpamReportSchema.optional(),
2134
2166
  spamVerdict: z.union([SpamVerdictNotCheckedSchema, SpamVerdictScreenedOutSchema, SpamCheckedSchema, SpamFailedSchema]),
2167
+ spamCleared: z.boolean(),
2135
2168
  createdAt: z.number(),
2136
2169
  updatedAt: z.number()
2137
2170
  });
@@ -2154,7 +2187,6 @@ export const MessageSchema = z.object({
2154
2187
  category: MessageCategorySchema,
2155
2188
  classificationState: MessageClassificationStateSchema,
2156
2189
  authenticity: MessageAuthenticitySchema.optional(),
2157
- authenticityVerdict: AuthenticityVerdictSchema,
2158
2190
  authResult: MessageAuthResultSchema.optional(),
2159
2191
  providerSpam: MessageProviderSpamSchema.optional(),
2160
2192
  hasListUnsubscribe: z.boolean(),
@@ -2165,6 +2197,7 @@ export const MessageSchema = z.object({
2165
2197
  classifierScores: z.array(ClassifierScoreSchema),
2166
2198
  spamReport: MessageSpamReportSchema.optional(),
2167
2199
  spamVerdict: z.union([SpamVerdictNotCheckedSchema, SpamVerdictScreenedOutSchema, SpamCheckedSchema, SpamFailedSchema]),
2200
+ spamCleared: z.boolean(),
2168
2201
  createdAt: z.number(),
2169
2202
  updatedAt: z.number(),
2170
2203
  messageIdHeader: z.string().optional()