Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docs): readme minor corrections #27

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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