dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
23 lines (22 loc) • 748 B
JavaScript
import { SchemaAction } from '../../../schema/index.js';
import { itemZodFormatter, schemaZodFormatter } from './formatter/index.js';
import { itemZodParser, schemaZodParser } from './parser/index.js';
export class ZodSchemer extends SchemaAction {
formatter(options = {}) {
if (this.schema.type === 'item') {
return itemZodFormatter(this.schema, options);
}
else {
return schemaZodFormatter(this.schema, options);
}
}
parser(options = {}) {
if (this.schema.type === 'item') {
return itemZodParser(this.schema, options);
}
else {
return schemaZodParser(this.schema, options);
}
}
}
ZodSchemer.actionName = 'zodSchemer';