@opencrvs/toolkit
Advanced tools
Comparing version
@@ -52,3 +52,9 @@ import { EventDocument } from '../events/EventDocument'; | ||
/** | ||
* Returns an JSON Schema object, which is treated as always invalid. | ||
* | ||
* @returns {JSONSchema} An schema object that always evaluates to false. | ||
*/ | ||
export declare function never(): JSONSchema; | ||
/** | ||
* | ||
* Generate conditional rules for user. | ||
@@ -55,0 +61,0 @@ */ |
@@ -6,5 +6,9 @@ import { ConditionalParameters, JSONSchema } from './conditionals'; | ||
import { TranslationConfig } from '../events/TranslationConfig'; | ||
import { FieldConditional } from '../events/Conditional'; | ||
export declare function validate(schema: JSONSchema, data: ConditionalParameters): boolean; | ||
export declare function isConditionMet(conditional: JSONSchema, values: Record<string, unknown>): boolean; | ||
export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, unknown>): boolean; | ||
export declare function isFieldVisible(field: FieldConfig, form: ActionUpdate | EventState): boolean; | ||
export declare function isFieldEnabled(field: FieldConfig, form: ActionUpdate | EventState): boolean; | ||
export declare function isFieldDisplayedOnReview(field: FieldConfig, form: ActionUpdate | EventState): boolean; | ||
export declare const errorMessages: { | ||
@@ -58,8 +62,3 @@ hiddenField: { | ||
}[]; | ||
/** | ||
* Checks if a field has validation errors based on its type and custom conditionals. | ||
* | ||
* @returns an array of error messages for the field | ||
*/ | ||
export declare function getFieldValidationErrors({ field, values }: { | ||
export declare function runFieldValidations({ field, values }: { | ||
field: FieldConfig; | ||
@@ -69,9 +68,5 @@ values: ActionUpdate; | ||
errors: { | ||
message: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
message: TranslationConfig; | ||
}[]; | ||
}; | ||
//# sourceMappingURL=validate.d.ts.map |
@@ -37,2 +37,4 @@ import { z } from 'zod'; | ||
export type AnnotationActionType = z.infer<typeof annotationActions>; | ||
/** Actions which requires the user to be assigned */ | ||
export declare const writeActions: z.ZodEnum<["DELETE", "NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION"]>; | ||
//# sourceMappingURL=ActionType.d.ts.map |
@@ -120,2 +120,3 @@ import { z } from 'zod'; | ||
}>; | ||
export type UrbanAddressUpdateValue = z.infer<typeof UrbanAddressUpdateValue>; | ||
export declare const RuralAddressUpdateValue: z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -144,2 +145,3 @@ country: z.ZodString; | ||
}>; | ||
export type RuralAddressUpdateValue = z.infer<typeof RuralAddressUpdateValue>; | ||
export declare const GenericAddressValue: z.ZodObject<{ | ||
@@ -294,2 +296,3 @@ country: z.ZodString; | ||
}>; | ||
export type GenericAddressUpdateValue = z.infer<typeof GenericAddressUpdateValue>; | ||
export declare const AddressFieldUpdateValue: z.ZodUnion<[z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -296,0 +299,0 @@ country: z.ZodString; |
import { JSONSchema } from '../conditionals/conditionals'; | ||
import { z } from 'zod'; | ||
export declare function Conditional(): z.ZodType<JSONSchema, z.ZodTypeDef, JSONSchema>; | ||
export declare const Conditional: z.ZodType<JSONSchema, z.ZodTypeDef, JSONSchema>; | ||
/** | ||
@@ -8,7 +8,7 @@ * By default, when conditionals are undefined, action is visible and enabled to everyone. | ||
export declare const ConditionalType: { | ||
/** When 'SHOW' conditional is defined, the action is shown to the user only if the condition is met */ | ||
readonly SHOW: "SHOW"; | ||
/** If 'ENABLE' conditional is defined, the action is enabled only if the condition is met */ | ||
readonly ENABLE: "ENABLE"; | ||
readonly DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"; | ||
}; | ||
export type ConditionalType = (typeof ConditionalType)[keyof typeof ConditionalType]; | ||
export declare const ShowConditional: z.ZodObject<{ | ||
@@ -35,7 +35,23 @@ type: z.ZodLiteral<"SHOW">; | ||
/** @knipignore */ | ||
export type AllActionConditionalFields = typeof ShowConditional | typeof EnableConditional; | ||
export type ActionConditionalType = typeof ShowConditional | typeof EnableConditional; | ||
/** @knipignore */ | ||
export type InferredActionConditional = z.infer<typeof ShowConditional> | z.infer<typeof EnableConditional>; | ||
export declare const ActionConditional: z.ZodDiscriminatedUnion<"type", AllActionConditionalFields[]>; | ||
export declare const ActionConditional: z.ZodDiscriminatedUnion<"type", ActionConditionalType[]>; | ||
export type ActionConditional = InferredActionConditional; | ||
export declare const DisplayOnReviewConditional: z.ZodObject<{ | ||
type: z.ZodLiteral<"DISPLAY_ON_REVIEW">; | ||
conditional: z.ZodType<JSONSchema, z.ZodTypeDef, JSONSchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: JSONSchema; | ||
}, { | ||
type: "DISPLAY_ON_REVIEW"; | ||
conditional: JSONSchema; | ||
}>; | ||
/** @knipignore */ | ||
export type FieldConditionalType = typeof ShowConditional | typeof EnableConditional | typeof DisplayOnReviewConditional; | ||
/** @knipignore */ | ||
export type InferredFieldConditional = z.infer<typeof ShowConditional> | z.infer<typeof EnableConditional> | z.infer<typeof DisplayOnReviewConditional>; | ||
export declare const FieldConditional: z.ZodDiscriminatedUnion<"type", FieldConditionalType[]>; | ||
export type FieldConditional = z.infer<typeof FieldConditional>; | ||
//# sourceMappingURL=Conditional.d.ts.map |
@@ -237,8 +237,19 @@ import { EventConfigInput } from './EventConfigInput'; | ||
}; | ||
fields: { | ||
fields: ({ | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: import("./TranslationConfig").TranslationConfig | undefined; | ||
} | { | ||
id: string; | ||
value: import("./TranslationConfig").TranslationConfig; | ||
label: import("./TranslationConfig").TranslationConfig; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: import("./TranslationConfig").TranslationConfig | undefined; | ||
}[]; | ||
})[]; | ||
}; | ||
@@ -245,0 +256,0 @@ workqueues: { |
@@ -9,2 +9,3 @@ import { z } from 'zod'; | ||
id: z.ZodString; | ||
transactionId: z.ZodString; | ||
createdAt: z.ZodString; | ||
@@ -248,2 +249,3 @@ createdBy: z.ZodString; | ||
status: "Rejected" | "Requested" | "Accepted"; | ||
transactionId: string; | ||
createdAt: string; | ||
@@ -332,2 +334,3 @@ createdBy: string; | ||
status: "Rejected" | "Requested" | "Accepted"; | ||
transactionId: string; | ||
createdAt: string; | ||
@@ -416,8 +419,9 @@ createdBy: string; | ||
id: string; | ||
transactionId: string; | ||
createdAt: string; | ||
eventId: string; | ||
transactionId: string; | ||
action: { | ||
type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN"; | ||
status: "Rejected" | "Requested" | "Accepted"; | ||
transactionId: string; | ||
createdAt: string; | ||
@@ -506,8 +510,9 @@ createdBy: string; | ||
id: string; | ||
transactionId: string; | ||
createdAt: string; | ||
eventId: string; | ||
transactionId: string; | ||
action: { | ||
type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN"; | ||
status: "Rejected" | "Requested" | "Accepted"; | ||
transactionId: string; | ||
createdAt: string; | ||
@@ -598,3 +603,3 @@ createdBy: string; | ||
transactionId: z.ZodString; | ||
declaration: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
declaration: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
filename: z.ZodString; | ||
@@ -712,3 +717,3 @@ originalFilename: z.ZodString; | ||
postcodeOrZip?: string | null | undefined; | ||
}>]>>; | ||
}>]>>>; | ||
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{ | ||
@@ -829,2 +834,3 @@ filename: z.ZodString; | ||
originalActionId: z.ZodOptional<z.ZodString>; | ||
keepAssignment: z.ZodOptional<z.ZodBoolean>; | ||
}, { | ||
@@ -834,2 +840,3 @@ type: z.ZodEnum<["DELETE", "CREATE", "NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION", "READ", "ASSIGN", "UNASSIGN"]>; | ||
type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN"; | ||
transactionId: string; | ||
declaration: Record<string, string | number | boolean | { | ||
@@ -874,3 +881,2 @@ type: string; | ||
eventId: string; | ||
transactionId: string; | ||
annotation?: Record<string, string | number | boolean | { | ||
@@ -915,5 +921,8 @@ type: string; | ||
originalActionId?: string | undefined; | ||
keepAssignment?: boolean | undefined; | ||
}, { | ||
type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN"; | ||
declaration: Record<string, string | number | boolean | { | ||
transactionId: string; | ||
eventId: string; | ||
declaration?: Record<string, string | number | boolean | { | ||
type: string; | ||
@@ -955,5 +964,3 @@ filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
eventId: string; | ||
transactionId: string; | ||
}[] | undefined> | undefined; | ||
annotation?: Record<string, string | number | boolean | { | ||
@@ -998,2 +1005,3 @@ type: string; | ||
originalActionId?: string | undefined; | ||
keepAssignment?: boolean | undefined; | ||
}>; | ||
@@ -1000,0 +1008,0 @@ export type Draft = z.infer<typeof Draft>; |
@@ -40,3 +40,19 @@ import { z } from 'zod'; | ||
}>; | ||
fields: z.ZodArray<z.ZodObject<{ | ||
fields: z.ZodArray<z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{ | ||
emptyValueMessage: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
conditionals: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ | ||
type: z.ZodLiteral<"SHOW">; | ||
conditional: z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}, { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}>, "many">>>; | ||
}, { | ||
id: z.ZodString; | ||
@@ -58,6 +74,10 @@ value: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
}>>; | ||
}, "strip", z.ZodTypeAny, { | ||
}>, "strip", z.ZodTypeAny, { | ||
id: string; | ||
value: TranslationConfig; | ||
label: TranslationConfig; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
@@ -76,2 +96,6 @@ }, { | ||
}; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: { | ||
@@ -82,3 +106,39 @@ id: string; | ||
} | undefined; | ||
}>, "many">; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
emptyValueMessage: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
conditionals: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ | ||
type: z.ZodLiteral<"SHOW">; | ||
conditional: z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}, { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}>, "many">>>; | ||
}, { | ||
fieldId: z.ZodString; | ||
}>, "strip", z.ZodTypeAny, { | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
}, { | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}>]>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
@@ -90,8 +150,19 @@ title: { | ||
}; | ||
fields: { | ||
fields: ({ | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
} | { | ||
id: string; | ||
value: TranslationConfig; | ||
label: TranslationConfig; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
}[]; | ||
})[]; | ||
}, { | ||
@@ -111,3 +182,14 @@ title: { | ||
}; | ||
fields: { | ||
fields: ({ | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
} | { | ||
id: string; | ||
@@ -124,2 +206,6 @@ value: { | ||
}; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: { | ||
@@ -130,3 +216,3 @@ id: string; | ||
} | undefined; | ||
}[]; | ||
})[]; | ||
}>; | ||
@@ -528,8 +614,19 @@ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
}; | ||
fields: { | ||
fields: ({ | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
} | { | ||
id: string; | ||
value: TranslationConfig; | ||
label: TranslationConfig; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
}[]; | ||
})[]; | ||
}; | ||
@@ -939,3 +1036,14 @@ workqueues: { | ||
}; | ||
fields: { | ||
fields: ({ | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
} | { | ||
id: string; | ||
@@ -952,2 +1060,6 @@ value: { | ||
}; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: { | ||
@@ -958,3 +1070,3 @@ id: string; | ||
} | undefined; | ||
}[]; | ||
})[]; | ||
}; | ||
@@ -1220,8 +1332,19 @@ workqueues: { | ||
}; | ||
fields: { | ||
fields: ({ | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
} | { | ||
id: string; | ||
value: TranslationConfig; | ||
label: TranslationConfig; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
}[]; | ||
})[]; | ||
}; | ||
@@ -1631,3 +1754,14 @@ workqueues: { | ||
}; | ||
fields: { | ||
fields: ({ | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
} | { | ||
id: string; | ||
@@ -1644,2 +1778,6 @@ value: { | ||
}; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: { | ||
@@ -1650,3 +1788,3 @@ id: string; | ||
} | undefined; | ||
}[]; | ||
})[]; | ||
}; | ||
@@ -1653,0 +1791,0 @@ workqueues: { |
@@ -18,2 +18,3 @@ import { z } from 'zod'; | ||
createdAtLocation: z.ZodString; | ||
updatedAtLocation: z.ZodString; | ||
modifiedAt: z.ZodString; | ||
@@ -34,2 +35,3 @@ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
createdAtLocation: string; | ||
updatedAtLocation: string; | ||
trackingId: string; | ||
@@ -48,2 +50,3 @@ modifiedAt: string; | ||
createdAtLocation: string; | ||
updatedAtLocation: string; | ||
trackingId: string; | ||
@@ -50,0 +53,0 @@ modifiedAt: string; |
@@ -49,2 +49,3 @@ import { z } from 'zod'; | ||
createdAtLocation: z.ZodString; | ||
updatedAtLocation: z.ZodString; | ||
modifiedAt: z.ZodString; | ||
@@ -62,2 +63,3 @@ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
createdAtLocation: string; | ||
updatedAtLocation: string; | ||
trackingId: string; | ||
@@ -75,2 +77,3 @@ modifiedAt: string; | ||
createdAtLocation: string; | ||
updatedAtLocation: string; | ||
trackingId: string; | ||
@@ -77,0 +80,0 @@ modifiedAt: string; |
@@ -33,4 +33,5 @@ export * from './ActionConfig'; | ||
export * from './TemplateConfig'; | ||
export * from './scopes'; | ||
export * from '../conditionals/conditionals'; | ||
export * from '../conditionals/validate'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -5,26 +5,2 @@ import { z } from 'zod'; | ||
export type PageType = z.infer<typeof PageTypes>; | ||
export declare const PageConfigBase: z.ZodObject<{ | ||
id: z.ZodString; | ||
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>; | ||
fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").InferredInput>, "many">; | ||
conditional: z.ZodOptional<z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>>; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
title: TranslationConfig; | ||
fields: import("./FieldConfig").Inferred[]; | ||
conditional?: import(".").JSONSchema | undefined; | ||
}, { | ||
id: string; | ||
title: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
fields: import("./FieldConfig").InferredInput[]; | ||
conditional?: import(".").JSONSchema | undefined; | ||
}>; | ||
export declare const FormPageConfig: z.ZodObject<z.objectUtil.extendShape<{ | ||
@@ -31,0 +7,0 @@ id: z.ZodString; |
@@ -33,3 +33,19 @@ import { z } from 'zod'; | ||
}>; | ||
fields: z.ZodArray<z.ZodObject<{ | ||
fields: z.ZodArray<z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{ | ||
emptyValueMessage: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
conditionals: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ | ||
type: z.ZodLiteral<"SHOW">; | ||
conditional: z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}, { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}>, "many">>>; | ||
}, { | ||
id: z.ZodString; | ||
@@ -51,6 +67,10 @@ value: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
}>>; | ||
}, "strip", z.ZodTypeAny, { | ||
}>, "strip", z.ZodTypeAny, { | ||
id: string; | ||
value: TranslationConfig; | ||
label: TranslationConfig; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
@@ -69,2 +89,6 @@ }, { | ||
}; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: { | ||
@@ -75,3 +99,39 @@ id: string; | ||
} | undefined; | ||
}>, "many">; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
emptyValueMessage: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
conditionals: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{ | ||
type: z.ZodLiteral<"SHOW">; | ||
conditional: z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}, { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}>, "many">>>; | ||
}, { | ||
fieldId: z.ZodString; | ||
}>, "strip", z.ZodTypeAny, { | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
}, { | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}>]>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
@@ -83,8 +143,19 @@ title: { | ||
}; | ||
fields: { | ||
fields: ({ | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
} | { | ||
id: string; | ||
value: TranslationConfig; | ||
label: TranslationConfig; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: TranslationConfig | undefined; | ||
}[]; | ||
})[]; | ||
}, { | ||
@@ -104,3 +175,14 @@ title: { | ||
}; | ||
fields: { | ||
fields: ({ | ||
fieldId: string; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
} | { | ||
id: string; | ||
@@ -117,2 +199,6 @@ value: { | ||
}; | ||
conditionals?: { | ||
type: "SHOW"; | ||
conditional: import(".").JSONSchema; | ||
}[] | undefined; | ||
emptyValueMessage?: { | ||
@@ -123,5 +209,5 @@ id: string; | ||
} | undefined; | ||
}[]; | ||
})[]; | ||
}>; | ||
export type SummaryConfig = z.infer<typeof SummaryConfig>; | ||
//# sourceMappingURL=SummaryConfig.d.ts.map |
@@ -9,3 +9,3 @@ /** | ||
*/ | ||
export type MetaFields = { | ||
export type SystemVariables = { | ||
$user: { | ||
@@ -25,8 +25,8 @@ province: string; | ||
}[keyof T]; | ||
export type FlattenedMetaFields = FlattenedKeyStrings<MetaFields>; | ||
export type FlattenenedSystemVariables = FlattenedKeyStrings<SystemVariables>; | ||
/** | ||
* Default value for a field when configuring a form. | ||
*/ | ||
export type FieldConfigDefaultValue = FieldValue | FlattenedMetaFields | Record<string, FlattenedMetaFields | FieldValue>; | ||
export declare function isTemplateVariable(value: FieldConfigDefaultValue): value is FlattenedMetaFields; | ||
export type FieldConfigDefaultValue = FieldValue | FlattenenedSystemVariables | Record<string, FlattenenedSystemVariables | FieldValue>; | ||
export declare function isTemplateVariable(value: FieldConfigDefaultValue): value is FlattenenedSystemVariables; | ||
export declare function isFieldValue(value: FieldConfigDefaultValue): value is FieldValue; | ||
@@ -33,0 +33,0 @@ /** |
@@ -11,3 +11,3 @@ import { ActionDocument, ActionUpdate } from './ActionDocument'; | ||
import { TranslationConfig } from './TranslationConfig'; | ||
export declare function generateActionInput(configuration: EventConfig, action: ActionType): import("lodash").Dictionary<string | number | boolean | { | ||
export declare function generateActionDeclarationInput(configuration: EventConfig, action: ActionType): import("lodash").Dictionary<string | number | boolean | { | ||
type: string; | ||
@@ -50,3 +50,3 @@ filename: string; | ||
}[] | undefined>; | ||
export declare function generateActionMetadataInput(configuration: EventConfig, action: ActionType): {}; | ||
export declare function generateActionAnnotationInput(configuration: EventConfig, action: ActionType): {}; | ||
export declare const eventPayloadGenerator: { | ||
@@ -53,0 +53,0 @@ create: (input?: Partial<EventInput>) => { |
@@ -9,3 +9,8 @@ export type User = { | ||
role: string; | ||
/** | ||
* The filename of the user's signature stored in MinIO, ex: 'a552f64a-31c4-4e78-b44f-292c3179e2ef.png'. | ||
* This is used to retrieve the signature file from storage. | ||
*/ | ||
signatureFilename?: string; | ||
}; | ||
//# sourceMappingURL=User.d.ts.map |
@@ -5,3 +5,3 @@ import { ActionType, DeclarationActionType } from './ActionType'; | ||
import { WorkqueueConfig } from './WorkqueueConfig'; | ||
import { ActionUpdate, EventState } from './ActionDocument'; | ||
import { Action, ActionUpdate, EventState } from './ActionDocument'; | ||
import { PageConfig, VerificationPageConfig } from './PageConfig'; | ||
@@ -47,4 +47,3 @@ import { Draft } from './Draft'; | ||
export declare function isPageVisible(page: PageConfig, formValues: ActionUpdate): boolean; | ||
export declare const getVisiblePagesFormFields: (formConfig: FormConfig, formData: ActionUpdate) => import("./FieldConfig").Inferred[]; | ||
export declare function stripHiddenFields(fields: FieldConfig[], declaration: EventState): import("lodash").Dictionary<string | number | boolean | { | ||
export declare function omitHiddenFields(fields: FieldConfig[], values: EventState): import("lodash").Dictionary<string | number | boolean | { | ||
type: string; | ||
@@ -87,10 +86,49 @@ filename: string; | ||
}[] | undefined>; | ||
export declare function omitHiddenPaginatedFields(formConfig: FormConfig, declaration: EventState): import("lodash").Dictionary<string | number | boolean | { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | undefined; | ||
town?: string | undefined; | ||
residentialArea?: string | undefined; | ||
street?: string | undefined; | ||
zipCode?: string | undefined; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | undefined; | ||
} | { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | undefined; | ||
addressLine1?: string | undefined; | ||
addressLine2?: string | undefined; | ||
addressLine3?: string | undefined; | ||
postcodeOrZip?: string | undefined; | ||
} | { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]): { | ||
id: string; | ||
transactionId: string; | ||
createdAt: string; | ||
eventId: string; | ||
transactionId: string; | ||
action: { | ||
type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN"; | ||
status: "Rejected" | "Requested" | "Accepted"; | ||
transactionId: string; | ||
createdAt: string; | ||
@@ -193,40 +231,11 @@ createdBy: string; | ||
export declare function isVerificationPage(page: PageConfig): page is VerificationPageConfig; | ||
export declare function deepMerge(currentDocument: ActionUpdate, actionDocument: ActionUpdate): Record<string, string | number | boolean | { | ||
type: string; | ||
filename: string; | ||
originalFilename: string; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "URBAN"; | ||
number?: string | null | undefined; | ||
town?: string | null | undefined; | ||
residentialArea?: string | null | undefined; | ||
street?: string | null | undefined; | ||
zipCode?: string | null | undefined; | ||
} | { | ||
country: string; | ||
district: string; | ||
addressType: "DOMESTIC"; | ||
province: string; | ||
urbanOrRural: "RURAL"; | ||
village?: string | null | undefined; | ||
} | { | ||
country: string; | ||
state: string; | ||
addressType: "INTERNATIONAL"; | ||
district2: string; | ||
cityOrTown?: string | null | undefined; | ||
addressLine1?: string | null | undefined; | ||
addressLine2?: string | null | undefined; | ||
addressLine3?: string | null | undefined; | ||
postcodeOrZip?: string | null | undefined; | ||
} | { | ||
type: string; | ||
option: string; | ||
filename: string; | ||
originalFilename: string; | ||
}[] | undefined>; | ||
export declare function deepMerge<T extends Record<string, unknown>>(currentDocument: T, actionDocument: T): T; | ||
export declare function findLastAssignmentAction(actions: Action[]): Action | undefined; | ||
/** Tell compiler that accessing record with arbitrary key might result to undefined | ||
* Use when you **cannot guarantee** that key exists in the record | ||
*/ | ||
export type IndexMap<T> = { | ||
[id: string]: T | undefined; | ||
}; | ||
export declare function isWriteAction(actionType: ActionType): boolean; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -29,2 +29,3 @@ "use strict"; | ||
field: () => field, | ||
never: () => never, | ||
not: () => not, | ||
@@ -74,2 +75,5 @@ or: () => or, | ||
} | ||
function never() { | ||
return not(alwaysTrue()); | ||
} | ||
var user = { | ||
@@ -136,3 +140,3 @@ hasScope: (scope) => defineConditional({ | ||
}, | ||
required: [fieldId, comparedFieldId] | ||
required: [fieldId] | ||
}; | ||
@@ -139,0 +143,0 @@ } |
{ | ||
"name": "@opencrvs/toolkit", | ||
"version": "1.8.0-rc.1282dd6", | ||
"version": "1.8.0-rc.12b8bee", | ||
"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
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
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
60
3.45%2293173
-4.02%61066
-2.2%