import { UUID } from '../uuid'; import { ActionDocument, ActionUpdate } from './ActionDocument'; import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, EditActionInput, MarkAsDuplicateActionInput, MarkNotDuplicateActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput } from './ActionInput'; import { ActionType } from './ActionType'; import { Draft } from './Draft'; import { EventConfig } from './EventConfig'; import { EventDocument } from './EventDocument'; import { EventIndex } from './EventIndex'; import { EventInput } from './EventInput'; import { TranslationConfig } from './TranslationConfig'; import { FieldConfig } from './FieldConfig'; import { Location, AdministrativeArea } from './locations'; import { WorkqueueConfig } from './WorkqueueConfig'; import * as z from 'zod/v4'; import { DocumentPath } from '../documents'; /** * IANA timezone used in testing. Used for queries that expect similar results independent of the users location (e.g. when event was registered.) * Since we query by range, providing UTC offset will result to different results when DST changes during the range. */ export declare const TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka"; /** * In real application, the roles are defined in the countryconfig. * These are just for testing purposes to generate realistic mock data. */ export declare const TestUserRole: z.ZodEnum<{ FIELD_AGENT: "FIELD_AGENT"; LOCAL_REGISTRAR: "LOCAL_REGISTRAR"; LOCAL_SYSTEM_ADMIN: "LOCAL_SYSTEM_ADMIN"; NATIONAL_REGISTRAR: "NATIONAL_REGISTRAR"; REGISTRATION_AGENT: "REGISTRATION_AGENT"; NATIONAL_SYSTEM_ADMIN: "NATIONAL_SYSTEM_ADMIN"; SOCIAL_WORKER: "SOCIAL_WORKER"; COMMUNITY_LEADER: "COMMUNITY_LEADER"; PROVINCIAL_REGISTRAR: "PROVINCIAL_REGISTRAR"; }>; export type TestUserRole = z.infer; export declare function pickRandom(rng: () => number, items: T[]): T; export declare function generateRandomName(rng: () => number): { firstname: string; surname: string; }; export declare function generateUuid(rng?: () => number): UUID; export declare function generateTrackingId(rng: () => number): string; export declare function generateRegistrationNumber(rng: () => number): string; export declare function generateRandomSignature(rng: () => number): DocumentPath; export declare function fieldConfigsToActionPayload(fields: FieldConfig[], rng: () => number, /** * Given hierarchy, ensures that related fields (e.g. location and administrative area) have valid values based on the hierarchy. */ administrativeHierarchy?: { administrativeAreas: AdministrativeArea[]; locations: Location[]; }): ActionUpdate; export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType, rng: () => number, overrides?: ActionUpdate, /** * Given hierarchy, ensures that related fields (e.g. location and administrative area) have valid values based on the hierarchy. */ administrativeHierarchy?: { administrativeAreas: AdministrativeArea[]; locations: Location[]; }): ActionUpdate; export declare function generateActionDuplicateDeclarationInput(...args: Parameters): ReturnType; export declare function eventPayloadGenerator(rng: () => number, configuration?: EventConfig): { create: (input?: Partial) => { transactionId: string; type: string; }; patch: (id: string, input?: Partial) => { transactionId: string; type: string; id: string; }; draft: ({ eventId, actionType, annotation, omitFields }: { eventId: UUID; actionType: Draft["action"]["type"]; annotation?: Record; omitFields?: string[]; }, input?: Partial) => Draft; actions: { declare: (eventId: string, input?: Partial>) => { transactionId: string; declaration: Record; annotation: {}; keepAssignment?: boolean | undefined; type: "DECLARE"; eventId: string; }; /** * Notify allows sending incomplete data. Think it as 'partial declare' for now. */ notify: (eventId: string, input?: Partial>) => { type: "NOTIFY"; transactionId: string; declaration: Record; eventId: string; keepAssignment: boolean | undefined; }; edit: (eventId: string, input?: Partial>) => { transactionId: string; declaration: Record; annotation: {}; keepAssignment?: boolean | undefined; type: "EDIT"; content: { comment: string; }; eventId: string; }; assign: (eventId: string, input?: Partial>) => { type: "ASSIGN"; transactionId: string; declaration: {}; assignedTo: string; eventId: string; }; unassign: (eventId: string, input?: Partial>) => { type: "UNASSIGN"; transactionId: string; declaration: {}; assignedTo: null; eventId: string; }; archive: (eventId: string, input?: Partial>) => { transactionId: string; declaration: Record; keepAssignment?: boolean | undefined; type: "ARCHIVE"; annotation: {}; eventId: string; content: { reason: string; }; }; reject: (eventId: string, input?: Partial>) => { transactionId: string; annotation: {}; keepAssignment?: boolean | undefined; type: "REJECT"; declaration: {}; eventId: string; content: { reason: string; }; }; register: (eventId: string, input?: Partial>) => { transactionId: string; declaration: Record; annotation: {}; registrationNumber?: string | undefined; keepAssignment?: boolean | undefined; type: "REGISTER"; eventId: string; }; printCertificate: (eventId: string, input?: Partial>) => { transactionId: string; annotation: {}; keepAssignment?: boolean | undefined; type: "PRINT_CERTIFICATE"; declaration: {}; eventId: string; }; correction: { request: (eventId: string, input?: Partial>) => { type: "REQUEST_CORRECTION"; transactionId: string; declaration: Record; annotation: {}; eventId: string; keepAssignment: boolean | undefined; }; approve: (eventId: string, requestId: string, input?: Partial>) => { type: "APPROVE_CORRECTION"; transactionId: string; declaration: {}; annotation: {}; eventId: string; requestId: string; keepAssignment: boolean | undefined; }; reject: (eventId: string, requestId: string, input: Partial>) => { type: "REJECT_CORRECTION"; transactionId: string; declaration: {}; annotation: {}; eventId: string; requestId: string; keepAssignment: boolean | undefined; content: { reason: string; }; }; }; duplicate: { markAsDuplicate: (eventId: string, input?: Partial>) => { type: "MARK_AS_DUPLICATE"; transactionId: string; declaration: Record; annotation: {}; eventId: string; keepAssignment: boolean | undefined; }; markNotDuplicate: (eventId: string, input?: Partial>) => { type: "MARK_AS_NOT_DUPLICATE"; transactionId: string; declaration: Record; annotation: {}; eventId: string; keepAssignment: boolean | undefined; }; }; }; }; export declare function generateActionDocument({ configuration, action, rng, defaults, declarationOverrides }: { configuration: EventConfig; action: T; rng?: () => number; defaults?: Partial>; declarationOverrides?: ActionUpdate; }): ActionDocument; export declare function generateRandomDatetime(rng: () => number, start: Date, end: Date): string; export declare function getRandomDate(rng: () => number, start: string, end: string): string; export declare function generateEventDocument({ configuration, actions, rng, defaults }: { configuration: EventConfig; actions: { type: ActionType; /** * Overrides for default event state per action */ declarationOverrides?: ActionUpdate; user?: Partial<{ signature: string; primaryOfficeId: UUID; role: TestUserRole; id: string; assignedTo: string; }>; }[]; rng?: () => number; defaults?: Partial; }): EventDocument; export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: { eventId: UUID; actionType: ActionType; rng?: () => number; declaration?: ActionUpdate; annotation?: ActionUpdate; }): Draft; /** * Useful for testing when we need deterministic outcome. * @param seed - Seed value for the pseudo-random number generator * * @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1) */ export declare function createPrng(seed: number): () => number; /** * @param overrides - Partial EventIndex object to override the default values. * @param seed - Seed value for the pseudo-random number generator. * @returns A mock EventIndex object with default values for tennis club * membership events. * * N.B. Unless a different seed is provided, the generated values will be * consistent across calls. * */ export declare const eventQueryDataGenerator: (overrides?: Partial, seed?: number) => EventIndex; export declare const generateTranslationConfig: (message: string) => TranslationConfig; export declare const BearerTokenByUserType: { fieldAgent: string; registrationAgent: string; localRegistrar: string; }; export declare const generateWorkqueues: (slug?: string) => WorkqueueConfig[]; /** * Backend focused event config generator for testing fields in a lightweight way. * * @param id - The unique identifier for the event. * @param fields - Field configurations to include in the event declaration. Everything in a single page. * @param placeOfEventId - Optional place of event field id. * @param dateOfEventId - Optional date of event field id. */ export declare const generateEventConfig: ({ id, fields, placeOfEventId, dateOfEventId }: { id: string; fields: FieldConfig[]; placeOfEventId?: string; dateOfEventId?: string; }) => EventConfig; //# sourceMappingURL=test.utils.d.ts.map