Skip to content

Commit

Permalink
🔨chore: fixes nullish and default to linked keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Adebesin-Cell committed Nov 22, 2024
1 parent efe5d3d commit 20010d0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-carpets-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@everipedia/iq-utils": patch
---

Adds nullish and default
5 changes: 5 additions & 0 deletions .changeset/yellow-baboons-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@everipedia/iq-utils": patch
---

Adds default flag to keys
22 changes: 15 additions & 7 deletions src/schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,21 +253,29 @@ export const Wiki = z
version: z.number().default(1),
linkedWikis: z
.object({
[LinkedWikiKey.Enum.blockchains]: z.array(z.string()).nullable(),
[LinkedWikiKey.Enum.founders]: z.array(z.string()).nullable(),
[LinkedWikiKey.Enum.speakers]: z.array(z.string()).nullable(),
[LinkedWikiKey.Enum.blockchains]: z
.array(z.string())
.nullish()
.default([]),
[LinkedWikiKey.Enum.founders]: z
.array(z.string())
.nullish()
.default([]),
[LinkedWikiKey.Enum.speakers]: z
.array(z.string())
.nullish()
.default([]),
})
.nullable()
.default({
[LinkedWikiKey.Enum.blockchains]: [],
[LinkedWikiKey.Enum.founders]: [],
[LinkedWikiKey.Enum.speakers]: [],
})
.transform((val) => ({
[LinkedWikiKey.Enum.blockchains]:
val?.[LinkedWikiKey.Enum.blockchains] ?? [],
[LinkedWikiKey.Enum.founders]: val?.[LinkedWikiKey.Enum.founders] ?? [],
[LinkedWikiKey.Enum.speakers]: val?.[LinkedWikiKey.Enum.speakers] ?? [],
val[LinkedWikiKey.Enum.blockchains] ?? [],
[LinkedWikiKey.Enum.founders]: val[LinkedWikiKey.Enum.founders] ?? [],
[LinkedWikiKey.Enum.speakers]: val[LinkedWikiKey.Enum.speakers] ?? [],
})),
})
.refine(isEventWikiValid, {
Expand Down

0 comments on commit 20010d0

Please sign in to comment.