import { ActionType } from '../ActionType'; import { Action, ActionDocument, ActionUpdate, EventState, PotentialDuplicate } from '../ActionDocument'; import { EventDocument } from '../EventDocument'; import { EventIndex } from '../EventIndex'; import { EventStatus } from '../EventMetadata'; import { Draft } from '../Draft'; import { EventConfig } from '../EventConfig'; import { UUID } from '../../uuid'; import { DocumentPath } from '../../documents'; export declare function getStatusFromActions(actions: Array): "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "ARCHIVED"; export declare function getAssignedUserFromActions(actions: Array): string | null; type NonNullableDeep = T extends [unknown, ...unknown[]] ? { [K in keyof T]: NonNullableDeep>; } : T extends UUID ? T : T extends DocumentPath ? T : T extends string ? NonNullable : T extends (infer U)[] ? NonNullableDeep[] : T extends object ? { [K in keyof T]: NonNullableDeep>; } : NonNullable; /** * @returns Given arbitrary object, recursively remove all keys with null values * * @example * deepDropNulls({ a: null, b: { c: null, d: 'foo' } }) // { b: { d: 'foo' } } * */ export declare function deepDropNulls(obj: T): NonNullableDeep; export declare function isUndeclaredDraft(status: EventStatus): boolean; export declare const DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt"; export declare function resolveDateOfEvent(eventIndex: EventIndex, declaration: EventState, config: EventConfig): string | undefined; export declare const DEFAULT_PLACE_OF_EVENT_PROPERTY = "createdAtLocation"; export declare function resolvePlaceOfEvent(eventMetadata: { createdAtLocation?: UUID | undefined | null; }, declaration: EventState, config: EventConfig): UUID | undefined | null; export declare function extractPotentialDuplicatesFromActions(actions: Action[]): PotentialDuplicate[]; /** * NOTE: This function should not run field validations. It should return the state based on the actions, without considering context (users, roles, permissions, etc). * * If you update this function, please ensure @EventIndex type is updated accordingly. * In most cases, you won't need to add new parameters to this function. Discuss with the team before doing so. * * @returns Calculates a snapshot summary of the event based on the actions taken on it. * @see EventIndex for the description of the returned object. */ export declare function getCurrentEventState(event: EventDocument, config: EventConfig): EventIndex; /** * @returns the future state of the event with drafts applied to all fields. * * NOTE: We treat the draft as a new action that is applied to the event. This means that even the status of the is changed as if draft has been accepted. * @see applyDraftToEventIndex to apply the draft to the event without changing the status. * */ export declare function dangerouslyGetCurrentEventStateWithDrafts({ event, draft, configuration }: { event: EventDocument; draft: Draft; configuration: EventConfig; }): EventIndex; export declare function applyDeclarationToEventIndex(eventIndex: EventIndex, declaration: EventState | ActionUpdate, eventConfiguration: EventConfig): EventIndex; /** * Applies draft to the event index following internal business rules. * * Ensures only necessary fields are updated based on the draft (declaration, updatedAt, flags). * NOTE: When naively applying draft, it leads to incorrect event state, since drafts are 'Accepted' by default. * */ export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Draft, eventConfiguration: EventConfig): { id: string & import("zod").$brand<"UUID">; type: string; status: "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "ARCHIVED"; legalStatuses: { DECLARED?: { createdAt: string; createdBy: string; acceptedAt: string; createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined; createdByUserType?: "user" | "system" | null | undefined; createdByRole?: string | undefined; } | null | undefined; REGISTERED?: { createdAt: string; createdBy: string; acceptedAt: string; registrationNumber: string; createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined; createdByUserType?: "user" | "system" | null | undefined; createdByRole?: string | undefined; } | null | undefined; }; createdAt: string; createdBy: string; updatedAt: string; trackingId: string; potentialDuplicates: { id: string & import("zod").$brand<"UUID">; trackingId: string; }[]; flags: string[]; declaration: Record; dateOfEvent?: string | null | undefined; placeOfEvent?: (string & import("zod").$brand<"UUID">) | null | undefined; createdByUserType?: "user" | "system" | null | undefined; updatedByUserRole?: string | null | undefined; createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined; updatedAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined; assignedTo?: string | null | undefined; updatedBy?: string | null | undefined; }; /** * Annotation is always specific to the action. when action with annotation is triggered multiple times, * previous annotations should have no effect on the new action annotation. (e.g. printing once should not pre-select print form fields) * * @returns annotation generated from drafts */ export declare function getAnnotationFromDrafts(drafts: Draft[]): {}; export declare function getActionAnnotation({ event, actionType, draft }: { event: EventDocument; actionType: ActionType; draft?: Draft; }): EventState; export {}; //# sourceMappingURL=index.d.ts.map