fixes freshness parsing (#285)

resolves #273
This commit is contained in:
Sampson authored and GitHub committed 2026-04-22 09:14:30 -05:00
1 parent ae86cdc13f
commit d4e9de74cc
3 files changed
+27 -4

No files matched your search

+9 -2
View File
@@ -54,8 +54,15 @@ export const params = z.object({
)
.optional(),
freshness: z
.union([z.literal('pd'), z.literal('pw'), z.literal('pm'), z.literal('py'), z.string()])
.default('pd')
.union([
z.enum(['pd', 'pw', 'pm', 'py']),
z
.string()
.regex(
/^\d{4}-\d{2}-\d{2}to\d{4}-\d{2}-\d{2}$/,
"Use 'pd', 'pw', 'pm', or 'py' for a relative discovery window, or a custom range as YYYY-MM-DDtoYYYY-MM-DD (e.g. 2022-04-01to2022-07-30)."
),
])
.describe(
"Filters search results by when they were discovered. The following values are supported: 'pd' - Discovered within the last 24 hours. 'pw' - Discovered within the last 7 Days. 'pm' - Discovered within the last 31 Days. 'py' - Discovered within the last 365 Days. 'YYYY-MM-DDtoYYYY-MM-DD' - Timeframe is also supported by specifying the date range e.g. 2022-04-01to2022-07-30."
)
+9 -1
View File
@@ -61,7 +61,15 @@ export const params = z.object({
)
.optional(),
freshness: z
.union([z.literal('pd'), z.literal('pw'), z.literal('pm'), z.literal('py'), z.string()])
.union([
z.enum(['pd', 'pw', 'pm', 'py']),
z
.string()
.regex(
/^\d{4}-\d{2}-\d{2}to\d{4}-\d{2}-\d{2}$/,
"Use 'pd', 'pw', 'pm', or 'py' for a relative discovery window, or a custom range as YYYY-MM-DDtoYYYY-MM-DD (e.g. 2022-04-01to2022-07-30)."
),
])
.describe(
"Filters search results by when they were discovered. The following values are supported: 'pd' - Discovered within the last 24 hours. 'pw' - Discovered within the last 7 days. 'pm' - Discovered within the last 31 days. 'py' - Discovered within the last 365 days. 'YYYY-MM-DDtoYYYY-MM-DD' - timeframe is also supported by specifying the date range (e.g. '2022-04-01to2022-07-30')."
)
+9 -1
View File
@@ -179,7 +179,15 @@ export const params = z.object({
)
.optional(),
freshness: z
.enum(['pd', 'pw', 'pm', 'py', 'YYYY-MM-DDtoYYYY-MM-DD'])
.union([
z.enum(['pd', 'pw', 'pm', 'py']),
z
.string()
.regex(
/^\d{4}-\d{2}-\d{2}to\d{4}-\d{2}-\d{2}$/,
"Use 'pd', 'pw', 'pm', or 'py' for a relative discovery window, or a custom range as YYYY-MM-DDtoYYYY-MM-DD (e.g. 2022-04-01to2022-07-30)."
),
])
.describe(
"Filters search results by when they were discovered. The following values are supported: 'pd' - Discovered within the last 24 hours. 'pw' - Discovered within the last 7 days. 'pm' - Discovered within the last 31 days. 'py' - Discovered within the last 365 days. 'YYYY-MM-DDtoYYYY-MM-DD' - Timeframe is also supported by specifying the date range e.g. 2022-04-01to2022-07-30."
)