Skip to content

Commit

Permalink
Merge pull request #27 from jharlow/fix-docs-readme-1
Browse files Browse the repository at this point in the history
fix(docs): readme minor corrections
  • Loading branch information
jharlow authored Oct 16, 2024
2 parents 85ac1a3 + 3676716 commit aaa3b0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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<typeof accountSchema>;

interface AccountStore {
getAccount: (accountId: string) => Promise<Account | null>;
}

const accountRecordSchema = accountSchema.extend({
pk: z.literal("${_type}#${id}"),
sk: z.literal("${_type}#"),
});

const oneTableSchema = {
// other attributes collapsed
indexes: { primary: { hash: "pk", sort: "sk" } },
Expand Down Expand Up @@ -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");
```

</details>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit aaa3b0d

Please sign in to comment.