/** * @debt circular "Remove & prevent imports from entity to schema" */ import type { UpdateValueInput } from '../../entity/actions/update/types.js'; import type { Paths, SchemaAction, ValidValue } from '../../schema/index.js'; import type { ResetLinks } from '../../schema/utils/resetLinks.js'; import type { If, NarrowObject, Overwrite, ValueOrGetter } from '../../types/index.js'; import type { Always, AtLeastOnce, Never, Schema, SchemaProps, SchemaRequiredProp, Validator } from '../types/index.js'; import type { Light, LightObj } from '../utils/light.js'; import { MapSchema } from './schema.js'; import type { MapAttributes } from './types.js'; type MapSchemer = (attributes: NarrowObject, props?: NarrowObject) => MapSchema_, PROPS>; /** * Define a new map attribute * * @param attributes Dictionary of attributes * @param props _(optional)_ Map Props */ export declare const map: MapSchemer; /** * Map schema */ export declare class MapSchema_ extends MapSchema { /** * Tag schema values as required. Possible values are: * - `'atLeastOnce'` _(default)_: Required in PUTs, optional in UPDATEs * - `'never'`: Optional in PUTs and UPDATEs * - `'always'`: Required in PUTs and UPDATEs * * @param nextRequired SchemaRequiredProp */ required(nextRequired?: NEXT_IS_REQUIRED): MapSchema_>; /** * Shorthand for `required('never')` */ optional(): MapSchema_>; /** * Hide schema values after fetch commands and formatting */ hidden(nextHidden?: NEXT_HIDDEN): MapSchema_>; /** * Tag schema values as a primary key attribute or linked to a primary key attribute */ key(nextKey?: NEXT_KEY): MapSchema_>; /** * Rename schema values before save commands */ savedAs(nextSavedAs: NEXT_SAVED_AS): MapSchema_>; /** * Provide a default value during Primary Key computing * * @param nextKeyDefault `keyInput | (() => keyInput)` */ keyDefault(nextKeyDefault: ValueOrGetter>): MapSchema_>; /** * Provide a default value for attribute in PUT commands * * @param nextPutDefault `putAttributeInput | (() => putAttributeInput)` */ putDefault(nextPutDefault: ValueOrGetter>): MapSchema_>; /** * Provide a default value for attribute in UPDATE commands * * @param nextUpdateDefault `updateAttributeInput | (() => updateAttributeInput)` */ updateDefault(nextUpdateDefault: ValueOrGetter>): MapSchema_>; /** * Provide a default value for attribute in PUT commands OR Primary Key computing if attribute is tagged as key * * @param nextDefault `key/putAttributeInput | (() => key/putAttributeInput)` */ default(nextDefault: ValueOrGetter, ValidValue>>): If>, MapSchema_>>; /** * Provide a **linked** default value for attribute in Primary Key computing * * @param nextKeyLink `keyAttributeInput | ((keyInput) => keyAttributeInput)` */ keyLink(nextKeyLink: (keyInput: ValidValue) => ValidValue): MapSchema_>; /** * Provide a **linked** default value for attribute in PUT commands * * @param nextPutLink `putAttributeInput | ((putItemInput) => putAttributeInput)` */ putLink(nextPutLink: (putItemInput: ValidValue) => ValidValue): MapSchema_>; /** * Provide a **linked** default value for attribute in UPDATE commands * * @param nextUpdateLink `unknown | ((updateItemInput) => updateAttributeInput)` */ updateLink(nextUpdateLink: (updateItemInput: UpdateValueInput>) => UpdateValueInput): MapSchema_>; /** * Provide a **linked** default value for attribute in PUT commands OR Primary Key computing if attribute is tagged as key * * @param nextLink `key/putAttributeInput | (() => key/putAttributeInput)` */ link(nextLink: (keyOrPutItemInput: If, ValidValue>) => If, ValidValue>): If>, MapSchema_>>; /** * Provide a custom validator for attribute in Primary Key computing * * @param nextKeyValidator `(keyAttributeInput) => boolean | string` */ keyValidate(nextKeyValidator: Validator, this>): MapSchema_>; /** * Provide a custom validator for attribute in PUT commands * * @param nextPutValidator `(putAttributeInput) => boolean | string` */ putValidate(nextPutValidator: Validator, this>): MapSchema_>; /** * Provide a custom validator for attribute in UPDATE commands * * @param nextUpdateValidator `(updateAttributeInput) => boolean | string` */ updateValidate(nextUpdateValidator: Validator, this>): MapSchema_>; /** * Provide a custom validator for attribute in PUT commands OR Primary Key computing if attribute is tagged as key * * @param nextValidator `(key/putAttributeInput) => boolean | string` */ validate(nextValidator: Validator, ValidValue>, this>): If>, MapSchema_>>; pick(...attributeNames: ATTRIBUTE_NAMES): MapSchema_<{ [KEY in ATTRIBUTE_NAMES[number]]: ResetLinks; }, PROPS>; omit(...attributeNames: ATTRIBUTE_NAMES): MapSchema_<{ [KEY in Exclude]: ResetLinks; }, PROPS>; and(additionalAttr: NarrowObject | ((schema: this) => NarrowObject)): MapSchema_<{ [KEY in keyof ATTRIBUTES | keyof ADDITIONAL_ATTRIBUTES]: KEY extends keyof ADDITIONAL_ATTRIBUTES ? Light : KEY extends keyof ATTRIBUTES ? ATTRIBUTES[KEY] : never; }, PROPS>; clone(nextProps?: NarrowObject): MapSchema_>; build = SchemaAction>(Action: new (schema: this) => ACTION): ACTION; } export {};