dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
19 lines (18 loc) • 915 B
TypeScript
import type { ItemSchema } from '../../../../schema/item/index.js';
import type { ComputeObject } from '../../../../types/computeObject.js';
import type { OmitKeys } from '../../../../types/omitKeys.js';
import type { FormattedValueJSONSchema } from './schema.js';
import type { RequiredProperties } from './shared.js';
export type FormattedItemJSONSchema<SCHEMA extends ItemSchema, REQUIRED_PROPERTIES extends string = RequiredProperties<SCHEMA>> = ComputeObject<{
type: 'object';
properties: {
[KEY in OmitKeys<SCHEMA['attributes'], {
props: {
hidden: true;
};
}>]: FormattedValueJSONSchema<SCHEMA['attributes'][KEY]>;
};
} & ([REQUIRED_PROPERTIES] extends [never] ? {} : {
required: REQUIRED_PROPERTIES[];
})>;
export declare const getFormattedItemJSONSchema: <SCHEMA extends ItemSchema>(schema: SCHEMA) => FormattedItemJSONSchema<SCHEMA>;