import type { AnyEntityESchema, AnyUnkeyedESchema, ESchemaEncoded, ESchemaType } from '../../../eschema/index.js'; import type { LogicalTableSnapshot } from '../snapshot/index.js'; export type { LogicalEntitySnapshot, LogicalTableSnapshot, } from '../snapshot/index.js'; export interface PrimaryIndex { readonly pk: Pk; readonly sk: Sk; } export interface LocalSecondaryIndex extends PrimaryIndex { readonly name: Name; readonly kind: 'lsi'; } export interface GlobalSecondaryIndex extends PrimaryIndex { readonly name: Name; readonly kind: 'gsi'; } export type LocalSecondaryIndexMap = Readonly>; export type GlobalSecondaryIndexMap = Readonly>; type EncodedStringKey = { [Key in keyof ESchemaEncoded & string]: NonNullable[Key]> extends string ? Key : never; }[keyof ESchemaEncoded & string]; export type IndexComponent = Exclude, '_v'> | '_u'; export interface AccessPatternDefinition { readonly index?: Slot; readonly kind: Kind; readonly pk: Pk; readonly sk: Sk; } export type AccessPatternMap = Readonly>; export interface KeyedEntityDefinition { readonly kind: 'keyed'; readonly name: TSchema['name']; readonly table: TableDefinition; readonly schema: TSchema; readonly primary: { readonly pk: PrimaryPk; readonly sk: PrimarySk; }; readonly accessPatterns: Patterns; } export interface SingleEntityDefinition { readonly kind: 'single'; readonly name: TSchema['name']; readonly table: TableDefinition; readonly schema: TSchema; readonly defaultValue: ESchemaType; } export interface KeyedEntityBuilderStart { primary, '_u'>[] = []>(derivation?: { readonly pk: Pk; }): KeyedEntityBuilder>>; } type LsiDerivation = { readonly sk: readonly IndexComponent[]; readonly pk?: never; }; type GsiDerivation = { readonly pk: readonly IndexComponent[]; readonly sk?: readonly IndexComponent[]; }; export type PatternFor | GsiDerivation> = Slot extends keyof Lsis ? AccessPatternDefinition : AccessPatternDefinition; export interface KeyedEntityBuilder { index : GsiDerivation)>(slot: Slot, name: Name, derivation: Derivation): KeyedEntityBuilder>>; build(): KeyedEntityDefinition; } export interface SingleEntityBuilder { default(defaultValue: ESchemaType): SingleEntityDefinition; } export interface TableDefinition { readonly logicalName: Name; readonly primary: Primary; readonly localSecondaryIndexes: Lsis; readonly globalSecondaryIndexes: Gsis; entity(schema: TSchema): KeyedEntityBuilderStart; singleEntity(schema: TSchema): SingleEntityBuilder; snapshot(): LogicalTableSnapshot; readonly registeredEntities: readonly (KeyedEntityDefinition | SingleEntityDefinition)[]; } export interface TableTopologyBuilder { lsi(name: Slot, sk: Sk): TableTopologyBuilder>, Gsis>; gsi(name: Slot, pk: Pk, sk: Sk): TableTopologyBuilder>>; build(): TableDefinition; } export interface TableBuilder { readonly logicalName: Name; primary(pk: Pk, sk: Sk): TableTopologyBuilder, {}, {}>; } type NonEmpty = Name extends '' ? never : Name; export declare const Table: { readonly make: (logicalName: NonEmpty) => TableBuilder; readonly assertUniqueNames: (definitions: Definitions) => Definitions; }; //# sourceMappingURL=definition.d.ts.map