Skip to content

Commit c48c4ca

Browse files
committed
fix: build ingest command without undefineds
1 parent 0eab16d commit c48c4ca

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

src/cli/search.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -412,18 +412,18 @@ const postsCommand = Command.make(
412412
);
413413
const command = buildNetworkSearchCommand({
414414
query: queryValue,
415-
limit: limitValue,
416-
cursor: Option.getOrUndefined(cursorValue),
417-
sort: sortValue,
418-
since: Option.getOrUndefined(normalizedSince),
419-
until: Option.getOrUndefined(normalizedUntil),
420-
mentions: parsedMentions,
421-
author: parsedAuthor,
422-
lang: Option.getOrUndefined(lang),
423-
domain: Option.getOrUndefined(domain),
424-
url: Option.getOrUndefined(url),
425-
tags,
426-
ingest: ingest.value
415+
...(limitValue !== undefined ? { limit: limitValue } : {}),
416+
...(Option.isSome(cursorValue) ? { cursor: cursorValue.value } : {}),
417+
...(sortValue ? { sort: sortValue } : {}),
418+
...(Option.isSome(normalizedSince) ? { since: normalizedSince.value } : {}),
419+
...(Option.isSome(normalizedUntil) ? { until: normalizedUntil.value } : {}),
420+
...(parsedMentions ? { mentions: parsedMentions } : {}),
421+
...(parsedAuthor ? { author: parsedAuthor } : {}),
422+
...(Option.isSome(lang) ? { lang: lang.value } : {}),
423+
...(Option.isSome(domain) ? { domain: domain.value } : {}),
424+
...(Option.isSome(url) ? { url: url.value } : {}),
425+
...(tags.length > 0 ? { tags } : {}),
426+
...(Option.isSome(ingest) ? { ingest: ingest.value } : {})
427427
});
428428
const meta = EventMeta.make({
429429
source: "search",

0 commit comments

Comments
 (0)