@opencrvs/toolkit
Advanced tools
Comparing version 0.0.6-events to 0.0.7-events
@@ -11,11 +11,11 @@ import { z } from 'zod'; | ||
type: "CREATE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CREATE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
@@ -32,11 +32,11 @@ }>; | ||
type: "CREATE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CREATE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
@@ -51,10 +51,10 @@ }>, z.ZodObject<z.objectUtil.extendShape<{ | ||
type: "DRAFT"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}, { | ||
type: "DRAFT"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -68,10 +68,10 @@ createdAt: z.ZodString; | ||
type: "VALIDATE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}, { | ||
type: "VALIDATE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -86,11 +86,11 @@ createdAt: z.ZodString; | ||
type: "NOTIFY"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
}, { | ||
type: "NOTIFY"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
@@ -115,5 +115,5 @@ }>, z.ZodObject<z.objectUtil.extendShape<{ | ||
type: "REGISTER"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
identifiers: { | ||
@@ -125,5 +125,5 @@ trackingId: string; | ||
type: "REGISTER"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
identifiers: { | ||
@@ -141,10 +141,10 @@ trackingId: string; | ||
type: "DECLARE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}, { | ||
type: "DECLARE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -159,11 +159,11 @@ createdAt: z.ZodString; | ||
type: "ASSIGN"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
assignedTo: string; | ||
}, { | ||
type: "ASSIGN"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
assignedTo: string; | ||
@@ -178,10 +178,10 @@ }>, z.ZodObject<z.objectUtil.extendShape<{ | ||
type: "UNASSIGN"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}, { | ||
type: "UNASSIGN"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -195,10 +195,10 @@ createdAt: z.ZodString; | ||
type: "CUSTOM"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}, { | ||
type: "CUSTOM"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}>]>; | ||
@@ -205,0 +205,0 @@ export type ActionDocument = z.infer<typeof ActionDocument>; |
@@ -20,4 +20,4 @@ import { z } from 'zod'; | ||
type: "REGISTER"; | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
identifiers: { | ||
@@ -29,4 +29,4 @@ trackingId: string; | ||
}, { | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
identifiers: { | ||
@@ -47,8 +47,8 @@ trackingId: string; | ||
type: "VALIDATE"; | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
eventId: string; | ||
}, { | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
eventId: string; | ||
@@ -66,9 +66,9 @@ type?: "VALIDATE" | undefined; | ||
type: "NOTIFY"; | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
eventId: string; | ||
}, { | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
@@ -86,8 +86,8 @@ eventId: string; | ||
type: "DRAFT"; | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
eventId: string; | ||
}, { | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
eventId: string; | ||
@@ -105,8 +105,8 @@ type?: "DRAFT" | undefined; | ||
type: "DECLARE"; | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
eventId: string; | ||
}, { | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
eventId: string; | ||
@@ -116,2 +116,10 @@ type?: "DECLARE" | undefined; | ||
export type DeclareActionInput = z.infer<typeof DeclareActionInput>; | ||
/** | ||
* ActionInput types are used to validate the input data for the action. | ||
* In our use case, we use it directly with TRPC to validate the input data for the action. | ||
* using z.literal(ActionType.ACTION).default(ActionType.ACTION) makes them more convenient to use | ||
* without having to pass the type in the input data, when it's defined in the method. | ||
* | ||
* e.g. mutation.declare({createdAt: new Date()}) vs mutation.declare({createdAt: new Date(), type: 'DECLARE'}) | ||
*/ | ||
export declare const ActionInput: z.ZodDiscriminatedUnion<"type", [z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -126,9 +134,9 @@ eventId: z.ZodString; | ||
type: "CREATE"; | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
eventId: string; | ||
}, { | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
@@ -145,8 +153,8 @@ eventId: string; | ||
type: "VALIDATE"; | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
eventId: string; | ||
}, { | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
eventId: string; | ||
@@ -162,8 +170,8 @@ type?: "VALIDATE" | undefined; | ||
type: "DRAFT"; | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
eventId: string; | ||
}, { | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
eventId: string; | ||
@@ -189,4 +197,4 @@ type?: "DRAFT" | undefined; | ||
type: "REGISTER"; | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
identifiers: { | ||
@@ -198,4 +206,4 @@ trackingId: string; | ||
}, { | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
identifiers: { | ||
@@ -216,9 +224,9 @@ trackingId: string; | ||
type: "NOTIFY"; | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
eventId: string; | ||
}, { | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
@@ -235,8 +243,8 @@ eventId: string; | ||
type: "DECLARE"; | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
eventId: string; | ||
}, { | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
eventId: string; | ||
@@ -253,9 +261,9 @@ type?: "DECLARE" | undefined; | ||
type: "ASSIGN"; | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
assignedTo: string; | ||
eventId: string; | ||
}, { | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
assignedTo: string; | ||
@@ -272,8 +280,8 @@ eventId: string; | ||
type: "UNASSIGN"; | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
eventId: string; | ||
}, { | ||
data: Record<string, any>; | ||
transactionId: string; | ||
data: Record<string, any>; | ||
eventId: string; | ||
@@ -280,0 +288,0 @@ type?: "UNASSIGN" | undefined; |
@@ -17,11 +17,11 @@ import { z } from 'zod'; | ||
type: "CREATE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CREATE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
@@ -36,10 +36,10 @@ }>, z.ZodObject<z.objectUtil.extendShape<{ | ||
type: "DRAFT"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}, { | ||
type: "DRAFT"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -53,10 +53,10 @@ createdAt: z.ZodString; | ||
type: "VALIDATE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}, { | ||
type: "VALIDATE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -71,11 +71,11 @@ createdAt: z.ZodString; | ||
type: "NOTIFY"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
}, { | ||
type: "NOTIFY"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
@@ -100,5 +100,5 @@ }>, z.ZodObject<z.objectUtil.extendShape<{ | ||
type: "REGISTER"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
identifiers: { | ||
@@ -110,5 +110,5 @@ trackingId: string; | ||
type: "REGISTER"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
identifiers: { | ||
@@ -126,10 +126,10 @@ trackingId: string; | ||
type: "DECLARE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}, { | ||
type: "DECLARE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -144,11 +144,11 @@ createdAt: z.ZodString; | ||
type: "ASSIGN"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
assignedTo: string; | ||
}, { | ||
type: "ASSIGN"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
assignedTo: string; | ||
@@ -163,10 +163,10 @@ }>, z.ZodObject<z.objectUtil.extendShape<{ | ||
type: "UNASSIGN"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}, { | ||
type: "UNASSIGN"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -180,41 +180,44 @@ createdAt: z.ZodString; | ||
type: "CUSTOM"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}, { | ||
type: "CUSTOM"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
}>]>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
transactionId: string; | ||
createdAt: string; | ||
updatedAt: string; | ||
actions: ({ | ||
type: "CREATE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
} | { | ||
type: "DRAFT"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
} | { | ||
type: "VALIDATE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
} | { | ||
type: "NOTIFY"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
} | { | ||
type: "REGISTER"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
identifiers: { | ||
@@ -226,55 +229,55 @@ trackingId: string; | ||
type: "DECLARE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
} | { | ||
type: "ASSIGN"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
assignedTo: string; | ||
} | { | ||
type: "UNASSIGN"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
} | { | ||
type: "CUSTOM"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
})[]; | ||
}, { | ||
type: string; | ||
id: string; | ||
transactionId: string; | ||
createdAt: string; | ||
updatedAt: string; | ||
}, { | ||
id: string; | ||
type: string; | ||
actions: ({ | ||
type: "CREATE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
} | { | ||
type: "DRAFT"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
} | { | ||
type: "VALIDATE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
} | { | ||
type: "NOTIFY"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
createdAtLocation: string; | ||
} | { | ||
type: "REGISTER"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
identifiers: { | ||
@@ -286,27 +289,24 @@ trackingId: string; | ||
type: "DECLARE"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
} | { | ||
type: "ASSIGN"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
assignedTo: string; | ||
} | { | ||
type: "UNASSIGN"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
} | { | ||
type: "CUSTOM"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, any>; | ||
})[]; | ||
transactionId: string; | ||
createdAt: string; | ||
updatedAt: string; | ||
}>; | ||
export type EventDocument = z.infer<typeof EventDocument>; | ||
//# sourceMappingURL=EventDocument.d.ts.map |
import { z } from 'zod'; | ||
export declare const EventIndex: z.ZodObject<{ | ||
export declare const EventIndex: z.ZodObject<z.objectUtil.extendShape<{ | ||
id: z.ZodString; | ||
@@ -19,10 +19,11 @@ type: z.ZodString; | ||
updatedBy: z.ZodString; | ||
data: z.ZodRecord<z.ZodString, z.ZodUnknown>; | ||
}, "strip", z.ZodTypeAny, { | ||
}, { | ||
data: z.ZodRecord<z.ZodString, z.ZodAny>; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "DRAFT" | "CREATED" | "NOTIFIED"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
status: "DRAFT" | "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "CERTIFIED"; | ||
createdBy: string; | ||
data: Record<string, unknown>; | ||
createdAtLocation: string; | ||
@@ -33,8 +34,8 @@ assignedTo: string | null; | ||
}, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "DRAFT" | "CREATED" | "NOTIFIED"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
status: "DRAFT" | "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "CERTIFIED"; | ||
createdBy: string; | ||
data: Record<string, unknown>; | ||
createdAtLocation: string; | ||
@@ -46,43 +47,2 @@ assignedTo: string | null; | ||
export type EventIndex = z.infer<typeof EventIndex>; | ||
export declare const EventIndices: z.ZodArray<z.ZodObject<{ | ||
id: z.ZodString; | ||
type: z.ZodString; | ||
status: z.ZodNativeEnum<{ | ||
readonly CREATED: "CREATED"; | ||
readonly DRAFT: "DRAFT"; | ||
readonly NOTIFIED: "NOTIFIED"; | ||
readonly DECLARED: "DECLARED"; | ||
readonly REGISTERED: "REGISTERED"; | ||
readonly CERTIFIED: "CERTIFIED"; | ||
}>; | ||
createdAt: z.ZodString; | ||
createdBy: z.ZodString; | ||
createdAtLocation: z.ZodString; | ||
modifiedAt: z.ZodString; | ||
assignedTo: z.ZodNullable<z.ZodString>; | ||
updatedBy: z.ZodString; | ||
data: z.ZodRecord<z.ZodString, z.ZodUnknown>; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
type: string; | ||
createdAt: string; | ||
status: "DRAFT" | "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "CERTIFIED"; | ||
createdBy: string; | ||
data: Record<string, unknown>; | ||
createdAtLocation: string; | ||
assignedTo: string | null; | ||
modifiedAt: string; | ||
updatedBy: string; | ||
}, { | ||
id: string; | ||
type: string; | ||
createdAt: string; | ||
status: "DRAFT" | "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "CERTIFIED"; | ||
createdBy: string; | ||
data: Record<string, unknown>; | ||
createdAtLocation: string; | ||
assignedTo: string | null; | ||
modifiedAt: string; | ||
updatedBy: string; | ||
}>, "many">; | ||
//# sourceMappingURL=EventIndex.d.ts.map |
@@ -15,3 +15,3 @@ import { z } from 'zod'; | ||
export type EventStatus = (typeof EventStatus)[keyof typeof EventStatus]; | ||
export declare const eventStatuses: ("DRAFT" | "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "CERTIFIED")[]; | ||
export declare const eventStatuses: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "DRAFT" | "CREATED" | "NOTIFIED")[]; | ||
export declare const EventStatuses: z.ZodNativeEnum<{ | ||
@@ -48,6 +48,6 @@ readonly CREATED: "CREATED"; | ||
}, "strip", z.ZodTypeAny, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "DRAFT" | "CREATED" | "NOTIFIED"; | ||
createdAt: string; | ||
status: "DRAFT" | "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "CERTIFIED"; | ||
createdBy: string; | ||
@@ -59,6 +59,6 @@ createdAtLocation: string; | ||
}, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "DRAFT" | "CREATED" | "NOTIFIED"; | ||
createdAt: string; | ||
status: "DRAFT" | "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "CERTIFIED"; | ||
createdBy: string; | ||
@@ -65,0 +65,0 @@ createdAtLocation: string; |
import { z } from 'zod'; | ||
export declare const ConditionalTypes: { | ||
readonly SHOW: "SHOW"; | ||
readonly ENABLE: "ENABLE"; | ||
}; | ||
export type ConditionalTypes = (typeof ConditionalTypes)[keyof typeof ConditionalTypes]; | ||
declare const BaseField: z.ZodObject<{ | ||
@@ -41,8 +46,8 @@ id: z.ZodString; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>>; | ||
@@ -57,8 +62,8 @@ validation: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -68,4 +73,4 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -76,4 +81,4 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -89,16 +94,11 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
conditionals: ({ | ||
@@ -111,7 +111,12 @@ type: "SHOW"; | ||
})[]; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
validation?: { | ||
message: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -129,4 +134,4 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -137,4 +142,4 @@ }, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -144,4 +149,4 @@ validation?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -166,7 +171,17 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
}>; | ||
export type BaseField = z.infer<typeof BaseField>; | ||
export declare const FieldType: { | ||
readonly TEXT: "TEXT"; | ||
readonly DATE: "DATE"; | ||
readonly PARAGRAPH: "PARAGRAPH"; | ||
readonly RADIO_GROUP: "RADIO_GROUP"; | ||
readonly FILE: "FILE"; | ||
readonly HIDDEN: "HIDDEN"; | ||
}; | ||
export declare const fieldTypes: ("TEXT" | "DATE" | "PARAGRAPH" | "RADIO_GROUP" | "FILE" | "HIDDEN")[]; | ||
export type FieldType = (typeof fieldTypes)[number]; | ||
export declare const FieldConfig: z.ZodDiscriminatedUnion<"type", [z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -211,8 +226,8 @@ id: z.ZodString; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>>; | ||
@@ -227,8 +242,8 @@ validation: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -238,4 +253,4 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -246,4 +261,4 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -259,8 +274,8 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -277,9 +292,4 @@ }, { | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "TEXT"; | ||
id: string; | ||
type: "TEXT"; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
conditionals: ({ | ||
@@ -292,2 +302,7 @@ type: "SHOW"; | ||
})[]; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
options?: { | ||
@@ -299,4 +314,4 @@ maxLength?: number | undefined; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -314,12 +329,12 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
}, { | ||
type: "TEXT"; | ||
id: string; | ||
type: "TEXT"; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -332,4 +347,4 @@ options?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -354,4 +369,4 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -397,8 +412,8 @@ }>, z.ZodObject<z.objectUtil.extendShape<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>>; | ||
@@ -413,8 +428,8 @@ validation: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -424,4 +439,4 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -432,4 +447,4 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -445,8 +460,8 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -462,8 +477,8 @@ }, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>>; | ||
@@ -473,4 +488,4 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -480,14 +495,9 @@ }, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
}>>; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "DATE"; | ||
id: string; | ||
type: "DATE"; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
conditionals: ({ | ||
@@ -500,7 +510,12 @@ type: "SHOW"; | ||
})[]; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
options?: { | ||
notice?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -511,4 +526,4 @@ } | undefined; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -526,12 +541,12 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
}, { | ||
type: "DATE"; | ||
id: string; | ||
type: "DATE"; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -541,4 +556,4 @@ options?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -549,4 +564,4 @@ } | undefined; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -571,4 +586,4 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -614,8 +629,8 @@ }>, z.ZodObject<z.objectUtil.extendShape<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>>; | ||
@@ -630,8 +645,8 @@ validation: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -641,4 +656,4 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -649,4 +664,4 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -662,8 +677,8 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -680,2 +695,3 @@ }, { | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "PARAGRAPH"; | ||
id: string; | ||
@@ -685,8 +701,2 @@ options: { | ||
}; | ||
type: "PARAGRAPH"; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
conditionals: ({ | ||
@@ -699,7 +709,12 @@ type: "SHOW"; | ||
})[]; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
validation?: { | ||
message: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -717,12 +732,12 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
}, { | ||
type: "PARAGRAPH"; | ||
id: string; | ||
type: "PARAGRAPH"; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -735,4 +750,4 @@ options?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -757,4 +772,4 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -800,8 +815,8 @@ }>, z.ZodObject<z.objectUtil.extendShape<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>>; | ||
@@ -816,8 +831,8 @@ validation: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -827,4 +842,4 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -835,4 +850,4 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -848,8 +863,8 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -869,2 +884,3 @@ }, { | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "RADIO_GROUP"; | ||
id: string; | ||
@@ -875,8 +891,2 @@ options: { | ||
}[]; | ||
type: "RADIO_GROUP"; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
conditionals: ({ | ||
@@ -889,7 +899,12 @@ type: "SHOW"; | ||
})[]; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
validation?: { | ||
message: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -907,6 +922,7 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
}, { | ||
type: "RADIO_GROUP"; | ||
id: string; | ||
@@ -917,7 +933,6 @@ options: { | ||
}[]; | ||
type: "RADIO_GROUP"; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -927,4 +942,4 @@ validation?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -949,4 +964,4 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -992,8 +1007,8 @@ }>, z.ZodObject<z.objectUtil.extendShape<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>>; | ||
@@ -1008,8 +1023,8 @@ validation: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -1019,4 +1034,4 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -1027,4 +1042,4 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -1040,8 +1055,8 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -1051,9 +1066,4 @@ }, { | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "HIDDEN"; | ||
id: string; | ||
type: "HIDDEN"; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
conditionals: ({ | ||
@@ -1066,7 +1076,12 @@ type: "SHOW"; | ||
})[]; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
validation?: { | ||
message: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -1084,12 +1099,12 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
}, { | ||
type: "HIDDEN"; | ||
id: string; | ||
type: "HIDDEN"; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -1099,4 +1114,4 @@ validation?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -1121,4 +1136,4 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -1164,8 +1179,8 @@ }>, z.ZodObject<z.objectUtil.extendShape<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>>; | ||
@@ -1180,8 +1195,8 @@ validation: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -1191,4 +1206,4 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -1199,4 +1214,4 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -1212,8 +1227,8 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -1223,9 +1238,4 @@ }, { | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "FILE"; | ||
id: string; | ||
type: "FILE"; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
conditionals: ({ | ||
@@ -1238,7 +1248,12 @@ type: "SHOW"; | ||
})[]; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
validation?: { | ||
message: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -1256,12 +1271,12 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
}, { | ||
type: "FILE"; | ||
id: string; | ||
type: "FILE"; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -1271,4 +1286,4 @@ validation?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -1293,8 +1308,7 @@ validator: import("../conditionals/conditionals").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
}>]>; | ||
export type FieldConfig = z.infer<typeof FieldConfig>; | ||
export type FieldType = FieldConfig['type']; | ||
export type FieldProps<T extends FieldType> = Extract<FieldConfig, { | ||
@@ -1301,0 +1315,0 @@ type: T; |
@@ -15,2 +15,4 @@ export * from './ActionConfig'; | ||
export * from './state'; | ||
export * from './utils'; | ||
export * from './defineConfig'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -28,2 +28,3 @@ "use strict"; | ||
ActionType: () => ActionType, | ||
ConditionalTypes: () => ConditionalTypes, | ||
DeclareActionInput: () => DeclareActionInput, | ||
@@ -34,3 +35,2 @@ DraftActionInput: () => DraftActionInput, | ||
EventIndex: () => EventIndex, | ||
EventIndices: () => EventIndices, | ||
EventInput: () => EventInput, | ||
@@ -41,2 +41,3 @@ EventMetadata: () => EventMetadata, | ||
FieldConfig: () => FieldConfig, | ||
FieldType: () => FieldType, | ||
FormConfig: () => FormConfig, | ||
@@ -53,3 +54,7 @@ NotifyActionInput: () => NotifyActionInput, | ||
eventStatuses: () => eventStatuses, | ||
getCurrentEventState: () => getCurrentEventState | ||
fieldTypes: () => fieldTypes, | ||
findPageFields: () => findPageFields, | ||
getCurrentEventState: () => getCurrentEventState, | ||
resolveFieldLabels: () => resolveFieldLabels, | ||
resolveLabelsFromKnownFields: () => resolveLabelsFromKnownFields | ||
}); | ||
@@ -86,9 +91,13 @@ module.exports = __toCommonJS(events_exports); | ||
// ../commons/src/events/FieldConfig.ts | ||
var ConditionalTypes = { | ||
SHOW: "SHOW", | ||
ENABLE: "ENABLE" | ||
}; | ||
var FieldId = import_zod3.z.string(); | ||
var ShowConditional = import_zod3.z.object({ | ||
type: import_zod3.z.literal("SHOW"), | ||
type: import_zod3.z.literal(ConditionalTypes.SHOW), | ||
conditional: Conditional() | ||
}); | ||
var EnableConditional = import_zod3.z.object({ | ||
type: import_zod3.z.literal("ENABLE"), | ||
type: import_zod3.z.literal(ConditionalTypes.ENABLE), | ||
conditional: Conditional() | ||
@@ -122,4 +131,13 @@ }); | ||
}); | ||
var FieldType = { | ||
TEXT: "TEXT", | ||
DATE: "DATE", | ||
PARAGRAPH: "PARAGRAPH", | ||
RADIO_GROUP: "RADIO_GROUP", | ||
FILE: "FILE", | ||
HIDDEN: "HIDDEN" | ||
}; | ||
var fieldTypes = Object.values(FieldType); | ||
var TextField = BaseField.extend({ | ||
type: import_zod3.z.literal("TEXT"), | ||
type: import_zod3.z.literal(FieldType.TEXT), | ||
options: import_zod3.z.object({ | ||
@@ -130,3 +148,3 @@ maxLength: import_zod3.z.number().optional().describe("Maximum length of the text") | ||
var DateField = BaseField.extend({ | ||
type: import_zod3.z.literal("DATE"), | ||
type: import_zod3.z.literal(FieldType.DATE), | ||
options: import_zod3.z.object({ | ||
@@ -139,3 +157,3 @@ notice: TranslationConfig.describe( | ||
var Paragraph = BaseField.extend({ | ||
type: import_zod3.z.literal("PARAGRAPH"), | ||
type: import_zod3.z.literal(FieldType.PARAGRAPH), | ||
options: import_zod3.z.object({ | ||
@@ -146,9 +164,9 @@ fontVariant: import_zod3.z.literal("reg16").optional() | ||
var File = BaseField.extend({ | ||
type: import_zod3.z.literal("FILE") | ||
type: import_zod3.z.literal(FieldType.FILE) | ||
}).describe("File upload"); | ||
var Hidden = BaseField.extend({ | ||
type: import_zod3.z.literal("HIDDEN") | ||
type: import_zod3.z.literal(FieldType.HIDDEN) | ||
}).describe("Hidden field"); | ||
var RadioGroup = BaseField.extend({ | ||
type: import_zod3.z.literal("RADIO_GROUP"), | ||
type: import_zod3.z.literal(FieldType.RADIO_GROUP), | ||
options: import_zod3.z.array( | ||
@@ -262,5 +280,2 @@ import_zod3.z.object({ | ||
// ../commons/src/events/EventConfig.ts | ||
var import_lodash = require("lodash"); | ||
// ../commons/src/events/WorkqueueConfig.ts | ||
@@ -370,59 +385,2 @@ var import_zod8 = require("zod"); | ||
}); | ||
var findPageFields = (config) => { | ||
return (0, import_lodash.flattenDeep)( | ||
config.actions.map( | ||
({ forms }) => forms.map( | ||
({ pages }) => pages.map( | ||
({ fields }) => fields.map((field) => ({ id: field.id, label: field.label })) | ||
) | ||
) | ||
) | ||
); | ||
}; | ||
var fillFieldLabels = ({ | ||
pageFields, | ||
refFields | ||
}) => { | ||
return refFields.map((field) => { | ||
if (field.label) { | ||
return field; | ||
} | ||
const metadataLabel = eventMetadataLabelMap[field.id]; | ||
if (metadataLabel) { | ||
return { | ||
...field, | ||
label: metadataLabel | ||
}; | ||
} | ||
const pageLabel = pageFields.find((pageField) => pageField.id === field.id); | ||
if (!pageLabel) { | ||
throw new Error(`Referenced field ${field.id} does not have a label`); | ||
} | ||
return { | ||
...field, | ||
label: pageLabel.label | ||
}; | ||
}); | ||
}; | ||
var defineConfig = (config) => { | ||
const parsed = EventConfig.parse(config); | ||
const pageFields = findPageFields(parsed); | ||
return EventConfig.parse({ | ||
...parsed, | ||
summary: { | ||
...parsed.summary, | ||
fields: fillFieldLabels({ | ||
pageFields, | ||
refFields: parsed.summary.fields | ||
}) | ||
}, | ||
workqueues: parsed.workqueues.map((workqueue) => ({ | ||
...workqueue, | ||
fields: fillFieldLabels({ | ||
pageFields, | ||
refFields: workqueue.fields | ||
}) | ||
})) | ||
}); | ||
}; | ||
var defineForm = (form) => FormConfig.parse(form); | ||
@@ -588,15 +546,5 @@ | ||
var import_zod14 = require("zod"); | ||
var EventIndex = import_zod14.z.object({ | ||
id: import_zod14.z.string(), | ||
type: import_zod14.z.string(), | ||
status: EventStatuses, | ||
createdAt: import_zod14.z.string().datetime(), | ||
createdBy: import_zod14.z.string(), | ||
createdAtLocation: import_zod14.z.string(), | ||
modifiedAt: import_zod14.z.string().datetime(), | ||
assignedTo: import_zod14.z.string().nullable(), | ||
updatedBy: import_zod14.z.string(), | ||
data: import_zod14.z.record(import_zod14.z.string(), import_zod14.z.unknown()) | ||
var EventIndex = EventMetadata.extend({ | ||
data: import_zod14.z.record(import_zod14.z.string(), import_zod14.z.any()) | ||
}); | ||
var EventIndices = import_zod14.z.array(EventIndex); | ||
@@ -606,23 +554,23 @@ // ../commons/src/events/state/index.ts | ||
return actions.reduce((status, action) => { | ||
if (action.type === "CREATE") { | ||
return "CREATED"; | ||
if (action.type === ActionType.CREATE) { | ||
return EventStatus.CREATED; | ||
} | ||
if (action.type === "DECLARE") { | ||
return "DECLARED"; | ||
if (action.type === ActionType.DECLARE) { | ||
return EventStatus.DECLARED; | ||
} | ||
if (action.type === "DRAFT") { | ||
return "DRAFT"; | ||
if (action.type === ActionType.DRAFT) { | ||
return EventStatus.DRAFT; | ||
} | ||
if (action.type === "REGISTER") { | ||
return "REGISTERED"; | ||
if (action.type === ActionType.REGISTER) { | ||
return EventStatus.REGISTERED; | ||
} | ||
return status; | ||
}, "CREATED"); | ||
}, EventStatus.CREATED); | ||
} | ||
function getAssignedUserFromActions(actions) { | ||
return actions.reduce((status, action) => { | ||
if (action.type === "ASSIGN") { | ||
if (action.type === ActionType.ASSIGN) { | ||
return action.assignedTo; | ||
} | ||
if (action.type === "UNASSIGN") { | ||
if (action.type === ActionType.UNASSIGN) { | ||
return null; | ||
@@ -643,4 +591,7 @@ } | ||
const creationAction = event.actions.find( | ||
(action) => action.type === "CREATE" | ||
(action) => action.type === ActionType.CREATE | ||
); | ||
if (!creationAction) { | ||
throw new Error(`Event ${event.id} has no creation action`); | ||
} | ||
const latestAction = event.actions[event.actions.length - 1]; | ||
@@ -660,1 +611,74 @@ return { | ||
} | ||
// ../commons/src/events/utils.ts | ||
var import_lodash = require("lodash"); | ||
var isMetadataField = (field) => field in eventMetadataLabelMap; | ||
var findPageFields = (config) => { | ||
return (0, import_lodash.flattenDeep)( | ||
config.actions.map( | ||
({ forms }) => forms.map( | ||
({ pages }) => pages.map( | ||
({ fields }) => fields.map((field) => ({ | ||
id: field.id, | ||
label: field.label | ||
})) | ||
) | ||
) | ||
) | ||
); | ||
}; | ||
var resolveLabelsFromKnownFields = ({ | ||
pageFields, | ||
refFields | ||
}) => { | ||
return refFields.map((field) => { | ||
if (field.label) { | ||
return field; | ||
} | ||
if (isMetadataField(field.id)) { | ||
return { | ||
...field, | ||
label: eventMetadataLabelMap[field.id] | ||
}; | ||
} | ||
const pageLabel = pageFields.find((pageField) => pageField.id === field.id); | ||
if (!pageLabel) { | ||
throw new Error(`Referenced field ${field.id} does not have a label`); | ||
} | ||
return { | ||
...field, | ||
label: pageLabel.label | ||
}; | ||
}); | ||
}; | ||
var resolveFieldLabels = ({ | ||
config, | ||
pageFields | ||
}) => { | ||
return { | ||
...config, | ||
fields: resolveLabelsFromKnownFields({ | ||
pageFields, | ||
refFields: config.fields | ||
}) | ||
}; | ||
}; | ||
// ../commons/src/events/defineConfig.ts | ||
var defineConfig = (config) => { | ||
const parsed = EventConfig.parse(config); | ||
const pageFields = findPageFields(parsed); | ||
return EventConfig.parse({ | ||
...parsed, | ||
summary: resolveFieldLabels({ | ||
config: parsed.summary, | ||
pageFields | ||
}), | ||
workqueues: parsed.workqueues.map( | ||
(workqueue) => resolveFieldLabels({ | ||
config: workqueue, | ||
pageFields | ||
}) | ||
) | ||
}); | ||
}; |
@@ -9,8 +9,8 @@ import { z } from 'zod'; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -25,8 +25,8 @@ fields: z.ZodArray<z.ZodObject<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>>; | ||
@@ -37,4 +37,4 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -45,4 +45,4 @@ }, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -53,4 +53,4 @@ }>, "many">; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -61,4 +61,4 @@ fields: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -69,4 +69,4 @@ }[]; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -77,4 +77,4 @@ fields: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -81,0 +81,0 @@ }[]; |
@@ -8,10 +8,10 @@ import { z } from 'zod'; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
export type TranslationConfig = z.infer<typeof TranslationConfig>; | ||
//# sourceMappingURL=TranslationConfig.d.ts.map |
@@ -13,8 +13,8 @@ import { z } from 'zod'; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -29,8 +29,8 @@ fields: z.ZodArray<z.ZodObject<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>>; | ||
@@ -41,4 +41,4 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -49,4 +49,4 @@ }, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -64,5 +64,5 @@ }>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
status: ("DRAFT" | "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "CERTIFIED")[]; | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "DRAFT" | "CREATED" | "NOTIFIED")[]; | ||
}, { | ||
status: ("DRAFT" | "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "CERTIFIED")[]; | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "DRAFT" | "CREATED" | "NOTIFIED")[]; | ||
}>, "many">; | ||
@@ -73,4 +73,4 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -81,8 +81,8 @@ fields: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
}[]; | ||
filters: { | ||
status: ("DRAFT" | "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "CERTIFIED")[]; | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "DRAFT" | "CREATED" | "NOTIFIED")[]; | ||
}[]; | ||
@@ -93,4 +93,4 @@ }, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -101,11 +101,12 @@ fields: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
}[]; | ||
filters: { | ||
status: ("DRAFT" | "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "CERTIFIED")[]; | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "DRAFT" | "CREATED" | "NOTIFIED")[]; | ||
}[]; | ||
}>; | ||
export type WorkqueueConfig = z.infer<typeof WorkqueueConfig>; | ||
export type WorkqueueConfigInput = z.input<typeof WorkqueueConfig>; | ||
//# sourceMappingURL=WorkqueueConfig.d.ts.map |
{ | ||
"name": "@opencrvs/toolkit", | ||
"version": "0.0.6-events", | ||
"version": "0.0.7-events", | ||
"description": "OpenCRVS toolkit for building country configurations", | ||
@@ -5,0 +5,0 @@ "license": "MPL-2.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1609429
29
40956
0