dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
24 lines (23 loc) • 744 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SchemaDTO = void 0;
const index_js_1 = require("../../../schema/index.js");
const index_js_2 = require("./getSchemaDTO/index.js");
class SchemaDTO extends index_js_1.SchemaAction {
constructor(schema) {
super(schema);
this.type = 'item';
this.attributes = Object.fromEntries(Object.entries(this.schema.attributes).map(([attributeName, attribute]) => [
attributeName,
(0, index_js_2.getSchemaDTO)(attribute)
]));
}
toJSON() {
return {
type: this.type,
attributes: this.attributes
};
}
}
exports.SchemaDTO = SchemaDTO;
SchemaDTO.actionName = 'dto';