oak-domain/lib/types/EntityDesc.d.ts

25 lines
949 B
TypeScript

import { LocaleDef } from './Locale';
import { Index } from './Storage';
import { EntityShape, Configuration, EntityDict } from './Entity';
import { StyleDesc } from './Style';
export type EntityDesc<Schema extends EntityShape, Action extends string = '', Relation extends string = '', V extends Record<string, string> = {
['##oak_illegal##']: '';
}> = {
locales: LocaleDef<Schema, Action, Relation, keyof V extends '##oak_illegal##' ? {} : V>;
indexes?: Index<Schema>[];
configuration?: Configuration;
recursiveDepth?: number;
} & (Action extends '' ? (keyof V extends '##oak_illegal##' ? {} : {
style: StyleDesc<Action, V>;
}) : {
style: StyleDesc<Action, V>;
});
export type AttrUpdateMatrix<ED extends EntityDict> = {
[T in keyof ED]?: {
[A in keyof ED[T]['Update']['data']]?: {
actions?: ED[T]['Action'][];
filter?: NonNullable<ED[T]['Selection']['filter']>;
};
};
};