UNPKG

jinaga

Version:

Data management for web and mobile applications.

96 lines 3.15 kB
export interface Label { name: string; type: string; } export interface SpecificationGiven { label: Label; conditions: ExistentialCondition[]; } export interface Role { name: string; predecessorType: string; } export interface PathCondition { type: "path"; rolesLeft: Role[]; labelRight: string; rolesRight: Role[]; } export interface ExistentialCondition { type: "existential"; exists: boolean; matches: Match[]; } export type Condition = PathCondition | ExistentialCondition; export declare function isPathCondition(condition: Condition): condition is PathCondition; /** * Type guard that checks if the given condition is an existential condition. * @param condition The condition to check. * @returns True if the condition is an ExistentialCondition, false otherwise. * @example * const condition: Condition = { type: "existential", exists: true, matches: [] }; * if (isExistentialCondition(condition)) { * // condition is now typed as ExistentialCondition * console.log(condition.exists); * } */ export declare function isExistentialCondition(condition: Condition): condition is ExistentialCondition; export interface SpecificationProjection { type: "specification"; matches: Match[]; projection: Projection; } export interface FieldProjection { type: "field"; label: string; field: string; } export interface HashProjection { type: "hash"; label: string; } export interface TimeProjection { type: "time"; label: string; } export interface FactProjection { type: "fact"; label: string; } export interface CompositeProjection { type: "composite"; components: NamedComponentProjection[]; } export type NamedComponentProjection = { name: string; } & ComponentProjection; export type ComponentProjection = SpecificationProjection | SingularProjection; export type SingularProjection = FieldProjection | HashProjection | TimeProjection | FactProjection; export type Projection = CompositeProjection | SingularProjection; export interface Match { unknown: Label; conditions: Condition[]; } export interface Specification { given: SpecificationGiven[]; matches: Match[]; projection: Projection; } export declare const emptySpecification: Specification; export declare function getAllFactTypes(specification: Specification): string[]; interface RoleDescription { successorType: string; name: string; predecessorType: string; } export declare function getAllRoles(specification: Specification): RoleDescription[]; export declare function specificationIsDeterministic(specification: Specification): boolean; export declare function specificationIsNotDeterministic(specification: Specification): boolean; export declare function splitBeforeFirstSuccessor(specification: Specification): { head: Specification | undefined; tail: Specification | undefined; }; export declare function specificationIsIdentity(specification: Specification): boolean; export declare function reduceSpecification(specification: Specification): Specification; export {}; //# sourceMappingURL=specification.d.ts.map