import type { ItemSchema, Schema, StringSchema } from '../../../schema/index.js'; import type { Table } from '../../../table/index.js'; import type { ComputeObject } from '../../../types/computeObject.js'; import type { If } from '../../../types/if.js'; import type { EntityAttributes, SchemaOf } from '../entityAttributes.js'; import type { EntityAttrOptions, TimestampsOptions } from './options.js'; import type { EntityAttrOptionValue, IsTimestampEnabled, TimestampOptionValue } from './utils.js'; export type WithInternalAttribute = ComputeObject<{ [KEY in keyof ATTRIBUTES | ATTRIBUTE_NAME]: KEY extends ATTRIBUTE_NAME ? ATTRIBUTE_SCHEMA : KEY extends keyof ATTRIBUTES ? ATTRIBUTES[KEY] : never; }>; export type EntityAttribute = StringSchema<{ hidden: EntityAttrOptionValue; savedAs: TABLE['entityAttributeSavedAs']; enum: [ENTITY_NAME]; putDefault: unknown; updateDefault: unknown; }>; export type WithEntityAttribute = string extends ENTITY_NAME ? EntityAttributes : WithInternalAttribute, EntityAttribute>; export type TimestampAttribute