From 36767168c5319bf85c839a17a47e320c92d28c16 Mon Sep 17 00:00:00 2001 From: John Harlow Date: Tue, 15 Oct 2024 21:27:02 -0700 Subject: [PATCH] fix(docs): readme minor corrections --- README.md | 15 +++++++-------- package.json | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d1742f6..cdf33d9 100644 --- a/README.md +++ b/README.md @@ -142,9 +142,8 @@ const table = new Table({ required: true, schema: { id: { type: String, required: true }, - // other attributes collapsed + // 👇 utilize our zod converter emails: zodOneFieldSchema( - // 👈 utilize our zod converter z.array( z.object({ email: z.string().email(), @@ -184,17 +183,17 @@ const accountSchema = z.object({ status: z.enum(["verified", "unverified"]), }); -const accountRecordSchema = accountSchema.extend({ - pk: z.literal("${_type}#${id}"), - sk: z.literal("${_type}#"), -}); - type Account = z.infer; interface AccountStore { getAccount: (accountId: string) => Promise; } +const accountRecordSchema = accountSchema.extend({ + pk: z.literal("${_type}#${id}"), + sk: z.literal("${_type}#"), +}); + const oneTableSchema = { // other attributes collapsed indexes: { primary: { hash: "pk", sort: "sk" } }, @@ -222,7 +221,7 @@ const table = new Table({ const accountStore = new AccountOneTableStore(table); -const account = accountStore.get("test-id"); +const account = await accountStore.get("test-id"); ``` diff --git a/package.json b/package.json index 47ef145..851ce0f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zod-to-dynamodb-onetable-schema", - "version": "0.0.8", + "version": "0.0.9", "description": "Auto-generate `dynamodb-onetable` model schemas using `zod`, with best-in-class autocomplete", "keywords": [ "dynamo",