dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
23 lines (22 loc) • 1.01 kB
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[];
}) & (SCHEMA['props'] extends {
strict: true;
} ? {
additionalProperties: false;
} : {})>;
export declare const getFormattedItemJSONSchema: <SCHEMA extends ItemSchema>(schema: SCHEMA) => FormattedItemJSONSchema<SCHEMA>;