UNPKG

@nerdware/ddb-single-table

Version:

A schema-based DynamoDB modeling tool, high-level API, and type-generator built to supercharge single-table designs!⚡

38 lines (37 loc) 2.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ioActions = void 0; const aliasMapping_js_1 = require("./aliasMapping.js"); const checkRequired_js_1 = require("./checkRequired.js"); const recursivelyApplyIOAction_js_1 = require("./recursivelyApplyIOAction.js"); const setDefaults_js_1 = require("./setDefaults.js"); const transformItem_js_1 = require("./transformItem.js"); const transformValues_js_1 = require("./transformValues.js"); const typeChecking_js_1 = require("./typeChecking.js"); const validate_js_1 = require("./validate.js"); const validateItem_js_1 = require("./validateItem.js"); /** * An object with various methods used to validate and transform items to/from the db. * * > This object serves as the `this` context for all `IOAction` functions. */ exports.ioActions = Object.freeze({ /** Applies the provided `ioAction` to nested attributes. */ recursivelyApplyIOAction: recursivelyApplyIOAction_js_1.recursivelyApplyIOAction, /** Swaps attribute names with their respective aliases. */ aliasMapping: aliasMapping_js_1.aliasMapping, /** Applies any schema-defined defaults to request arguments. */ setDefaults: setDefaults_js_1.setDefaults, /** Applies any `transformValue` functions defined in the schema. */ transformValues: transformValues_js_1.transformValues, /** Applies the `transformItem` function (if defined in the Model's schema options). */ transformItem: transformItem_js_1.transformItem, /** Checks attribute values for conformance with their schema-defined `type`. */ typeChecking: typeChecking_js_1.typeChecking, /** Validates attribute values using `validate` functions defined in the schema. */ validate: validate_js_1.validate, /** Uses `validateItem` function to validate an item in its entirety (if defined). */ validateItem: validateItem_js_1.validateItem, /** Performs nullish-value validation checks using `required` and `nullable` attr configs. */ checkRequired: checkRequired_js_1.checkRequired, });