🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

@opencrvs/toolkit

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opencrvs/toolkit - npm Package Compare versions

Comparing version

to
1.8.0-rc.05859a0

@@ -11,2 +11,3 @@ import { EventDocument } from '../events/EventDocument';

export declare function defineConditional(schema: any): JSONSchema;
export declare function defineFormConditional(schema: Record<string, unknown>): JSONSchema;
export type UserConditionalParameters = {

@@ -52,3 +53,9 @@ $now: string;

/**
* 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.

@@ -66,2 +73,6 @@ */

};
type FieldReference = {
_fieldId: string;
[key: string]: unknown;
};
/**

@@ -76,2 +87,6 @@ * Generate conditional rules for a form field.

export declare function field(fieldId: string): {
/**
* @private Internal property used for field reference tracking.
*/
_fieldId: string;
isAfter: () => {

@@ -82,3 +97,3 @@ days: (days: number) => {

};
date: (date: string) => JSONSchema;
date: (date: string | FieldReference) => JSONSchema;
now: () => JSONSchema;

@@ -91,6 +106,6 @@ };

};
date: (date: string) => JSONSchema;
date: (date: string | FieldReference) => JSONSchema;
now: () => JSONSchema;
};
isEqualTo: (value: string | boolean) => JSONSchema;
isEqualTo: (value: string | boolean | FieldReference) => JSONSchema;
/**

@@ -97,0 +112,0 @@ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.

@@ -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: {

@@ -48,19 +52,2 @@ 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 }: {
field: FieldConfig;
values: ActionUpdate;
}): {
errors: {
message: {
id: string;
defaultMessage: string;
description: string;
};
}[];
};
/**
* Validates primitive fields defined by the FieldConfig type.

@@ -76,2 +63,10 @@ * e.g. email is proper format, date is a valid date, etc.

}[];
export declare function runFieldValidations({ field, values }: {
field: FieldConfig;
values: ActionUpdate;
}): {
errors: {
message: TranslationConfig;
}[];
};
//# sourceMappingURL=validate.d.ts.map

@@ -0,1 +1,2 @@

import { z } from 'zod';
/**

@@ -5,27 +6,35 @@ * Actions recognized by the system

export declare const ActionType: {
readonly DELETE: "DELETE";
readonly CREATE: "CREATE";
readonly ASSIGN: "ASSIGN";
readonly UNASSIGN: "UNASSIGN";
readonly NOTIFY: "NOTIFY";
readonly DECLARE: "DECLARE";
readonly VALIDATE: "VALIDATE";
readonly REGISTER: "REGISTER";
readonly VALIDATE: "VALIDATE";
readonly REQUEST_CORRECTION: "REQUEST_CORRECTION";
readonly REJECT_CORRECTION: "REJECT_CORRECTION";
readonly APPROVE_CORRECTION: "APPROVE_CORRECTION";
readonly DETECT_DUPLICATE: "DETECT_DUPLICATE";
readonly NOTIFY: "NOTIFY";
readonly DECLARE: "DECLARE";
readonly DELETE: "DELETE";
readonly PRINT_CERTIFICATE: "PRINT_CERTIFICATE";
readonly CUSTOM: "CUSTOM";
readonly REJECT: "REJECT";
readonly MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE";
readonly ARCHIVE: "ARCHIVE";
readonly PRINT_CERTIFICATE: "PRINT_CERTIFICATE";
readonly REQUEST_CORRECTION: "REQUEST_CORRECTION";
readonly REJECT_CORRECTION: "REJECT_CORRECTION";
readonly APPROVE_CORRECTION: "APPROVE_CORRECTION";
readonly READ: "READ";
readonly ASSIGN: "ASSIGN";
readonly UNASSIGN: "UNASSIGN";
};
/**
* Actions that can be attached to an event document
* even if they are not in event configuration
*/
export declare const LatentActions: ("NOTIFY" | "REJECT" | "ARCHIVE")[];
export type ActionType = (typeof ActionType)[keyof typeof ActionType];
export declare const ConfirmableActions: readonly ["NOTIFY", "DECLARE", "VALIDATE", "REGISTER", "REJECT", "ARCHIVE", "PRINT_CERTIFICATE"];
/** Testing building types from enums as an alternative */
export declare const ActionTypes: 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"]>;
/** Actions which change event data (declaration) before registration / during declaration. */
export declare const DeclarationActions: z.ZodEnum<["DECLARE", "VALIDATE", "REGISTER"]>;
export type DeclarationActionType = z.infer<typeof DeclarationActions>;
/** Actions that can modify declaration data. Request can be corrected after declaring it. */
export declare const DeclarationUpdateActions: z.ZodEnum<["DECLARE", "VALIDATE", "REGISTER", "REQUEST_CORRECTION"]>;
export type DeclarationUpdateActionType = z.infer<typeof DeclarationUpdateActions>;
/** Actions which update annotation or status of an event. */
export declare const annotationActions: z.ZodEnum<["DELETE", "CREATE", "NOTIFY", "DETECT_DUPLICATE", "REJECT", "MARKED_AS_DUPLICATE", "ARCHIVE", "PRINT_CERTIFICATE", "REQUEST_CORRECTION", "REJECT_CORRECTION", "APPROVE_CORRECTION", "READ", "ASSIGN", "UNASSIGN"]>;
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

@@ -8,2 +8,12 @@ import { EventConfigInput } from './EventConfigInput';

id: string;
declaration: {
label: import("./TranslationConfig").TranslationConfig;
pages: {
type: "FORM";
id: string;
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
}[];
};
actions: ({

@@ -19,39 +29,6 @@ type: "DECLARE";

label: import("./TranslationConfig").TranslationConfig;
forms: {
active: boolean;
version: {
id: string;
label: import("./TranslationConfig").TranslationConfig;
};
label: import("./TranslationConfig").TranslationConfig;
pages: ({
type: "FORM";
id: string;
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: import("./TranslationConfig").TranslationConfig;
actions: {
verify: {
label: import("./TranslationConfig").TranslationConfig;
};
cancel: {
label: import("./TranslationConfig").TranslationConfig;
confirmation: {
title: import("./TranslationConfig").TranslationConfig;
body: import("./TranslationConfig").TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[];
review: {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
}[];
review: {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
draft?: boolean | undefined;

@@ -68,42 +45,9 @@ } | {

label: import("./TranslationConfig").TranslationConfig;
forms: {
active: boolean;
version: {
id: string;
label: import("./TranslationConfig").TranslationConfig;
};
label: import("./TranslationConfig").TranslationConfig;
pages: ({
type: "FORM";
id: string;
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: import("./TranslationConfig").TranslationConfig;
actions: {
verify: {
label: import("./TranslationConfig").TranslationConfig;
};
cancel: {
label: import("./TranslationConfig").TranslationConfig;
confirmation: {
title: import("./TranslationConfig").TranslationConfig;
body: import("./TranslationConfig").TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[];
review: {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
}[];
review: {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
draft?: boolean | undefined;
} | {
type: "REJECT";
type: "REGISTER";
conditionals: ({

@@ -117,42 +61,9 @@ type: "SHOW";

label: import("./TranslationConfig").TranslationConfig;
forms: {
active: boolean;
version: {
id: string;
label: import("./TranslationConfig").TranslationConfig;
};
label: import("./TranslationConfig").TranslationConfig;
pages: ({
type: "FORM";
id: string;
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: import("./TranslationConfig").TranslationConfig;
actions: {
verify: {
label: import("./TranslationConfig").TranslationConfig;
};
cancel: {
label: import("./TranslationConfig").TranslationConfig;
confirmation: {
title: import("./TranslationConfig").TranslationConfig;
body: import("./TranslationConfig").TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[];
review: {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
}[];
review: {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
draft?: boolean | undefined;
} | {
type: "MARKED_AS_DUPLICATE";
type: "REJECT";
conditionals: ({

@@ -166,42 +77,5 @@ type: "SHOW";

label: import("./TranslationConfig").TranslationConfig;
forms: {
active: boolean;
version: {
id: string;
label: import("./TranslationConfig").TranslationConfig;
};
label: import("./TranslationConfig").TranslationConfig;
pages: ({
type: "FORM";
id: string;
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: import("./TranslationConfig").TranslationConfig;
actions: {
verify: {
label: import("./TranslationConfig").TranslationConfig;
};
cancel: {
label: import("./TranslationConfig").TranslationConfig;
confirmation: {
title: import("./TranslationConfig").TranslationConfig;
body: import("./TranslationConfig").TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[];
review: {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
}[];
draft?: boolean | undefined;
} | {
type: "ARCHIVE";
type: "MARKED_AS_DUPLICATE";
conditionals: ({

@@ -215,42 +89,5 @@ type: "SHOW";

label: import("./TranslationConfig").TranslationConfig;
forms: {
active: boolean;
version: {
id: string;
label: import("./TranslationConfig").TranslationConfig;
};
label: import("./TranslationConfig").TranslationConfig;
pages: ({
type: "FORM";
id: string;
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: import("./TranslationConfig").TranslationConfig;
actions: {
verify: {
label: import("./TranslationConfig").TranslationConfig;
};
cancel: {
label: import("./TranslationConfig").TranslationConfig;
confirmation: {
title: import("./TranslationConfig").TranslationConfig;
body: import("./TranslationConfig").TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[];
review: {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
}[];
draft?: boolean | undefined;
} | {
type: "REGISTER";
type: "ARCHIVE";
conditionals: ({

@@ -264,39 +101,2 @@ type: "SHOW";

label: import("./TranslationConfig").TranslationConfig;
forms: {
active: boolean;
version: {
id: string;
label: import("./TranslationConfig").TranslationConfig;
};
label: import("./TranslationConfig").TranslationConfig;
pages: ({
type: "FORM";
id: string;
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: import("./TranslationConfig").TranslationConfig;
actions: {
verify: {
label: import("./TranslationConfig").TranslationConfig;
};
cancel: {
label: import("./TranslationConfig").TranslationConfig;
confirmation: {
title: import("./TranslationConfig").TranslationConfig;
body: import("./TranslationConfig").TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[];
review: {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
}[];
draft?: boolean | undefined;

@@ -313,39 +113,2 @@ } | {

label: import("./TranslationConfig").TranslationConfig;
forms: {
active: boolean;
version: {
id: string;
label: import("./TranslationConfig").TranslationConfig;
};
label: import("./TranslationConfig").TranslationConfig;
pages: ({
type: "FORM";
id: string;
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: import("./TranslationConfig").TranslationConfig;
actions: {
verify: {
label: import("./TranslationConfig").TranslationConfig;
};
cancel: {
label: import("./TranslationConfig").TranslationConfig;
confirmation: {
title: import("./TranslationConfig").TranslationConfig;
body: import("./TranslationConfig").TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[];
review: {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
}[];
draft?: boolean | undefined;

@@ -362,8 +125,3 @@ } | {

label: import("./TranslationConfig").TranslationConfig;
forms: {
active: boolean;
version: {
id: string;
label: import("./TranslationConfig").TranslationConfig;
};
printForm: {
label: import("./TranslationConfig").TranslationConfig;

@@ -395,7 +153,3 @@ pages: ({

})[];
review: {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
}[];
};
draft?: boolean | undefined;

@@ -412,39 +166,2 @@ } | {

label: import("./TranslationConfig").TranslationConfig;
forms: {
active: boolean;
version: {
id: string;
label: import("./TranslationConfig").TranslationConfig;
};
label: import("./TranslationConfig").TranslationConfig;
pages: ({
type: "FORM";
id: string;
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: import("./TranslationConfig").TranslationConfig;
actions: {
verify: {
label: import("./TranslationConfig").TranslationConfig;
};
cancel: {
label: import("./TranslationConfig").TranslationConfig;
confirmation: {
title: import("./TranslationConfig").TranslationConfig;
body: import("./TranslationConfig").TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[];
review: {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
}[];
onboardingForm: ({

@@ -511,39 +228,2 @@ type: "FORM";

label: import("./TranslationConfig").TranslationConfig;
forms: {
active: boolean;
version: {
id: string;
label: import("./TranslationConfig").TranslationConfig;
};
label: import("./TranslationConfig").TranslationConfig;
pages: ({
type: "FORM";
id: string;
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: import("./TranslationConfig").TranslationConfig;
actions: {
verify: {
label: import("./TranslationConfig").TranslationConfig;
};
cancel: {
label: import("./TranslationConfig").TranslationConfig;
confirmation: {
title: import("./TranslationConfig").TranslationConfig;
body: import("./TranslationConfig").TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[];
review: {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
}[];
draft?: boolean | undefined;

@@ -560,88 +240,3 @@ } | {

label: import("./TranslationConfig").TranslationConfig;
forms: {
active: boolean;
version: {
id: string;
label: import("./TranslationConfig").TranslationConfig;
};
label: import("./TranslationConfig").TranslationConfig;
pages: ({
type: "FORM";
id: string;
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: import("./TranslationConfig").TranslationConfig;
actions: {
verify: {
label: import("./TranslationConfig").TranslationConfig;
};
cancel: {
label: import("./TranslationConfig").TranslationConfig;
confirmation: {
title: import("./TranslationConfig").TranslationConfig;
body: import("./TranslationConfig").TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[];
review: {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
}[];
draft?: boolean | undefined;
} | {
type: "CUSTOM";
conditionals: ({
type: "SHOW";
conditional: import(".").JSONSchema;
} | {
type: "ENABLE";
conditional: import(".").JSONSchema;
})[];
label: import("./TranslationConfig").TranslationConfig;
forms: {
active: boolean;
version: {
id: string;
label: import("./TranslationConfig").TranslationConfig;
};
label: import("./TranslationConfig").TranslationConfig;
pages: ({
type: "FORM";
id: string;
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: import("./TranslationConfig").TranslationConfig;
actions: {
verify: {
label: import("./TranslationConfig").TranslationConfig;
};
cancel: {
label: import("./TranslationConfig").TranslationConfig;
confirmation: {
title: import("./TranslationConfig").TranslationConfig;
body: import("./TranslationConfig").TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[];
review: {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
}[];
draft?: boolean | undefined;
})[];

@@ -655,8 +250,19 @@ label: import("./TranslationConfig").TranslationConfig;

};
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;
}[];
})[];
};

@@ -663,0 +269,0 @@ workqueues: {

import { z } from 'zod';
import { ActionType } from './ActionType';
export declare const Draft: z.ZodObject<{

@@ -12,3 +11,3 @@ id: z.ZodString;

createdBy: z.ZodString;
data: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
declaration: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
filename: z.ZodString;

@@ -127,3 +126,3 @@ originalFilename: z.ZodString;

}>]>>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
filename: z.ZodString;

@@ -243,9 +242,12 @@ originalFilename: z.ZodString;

createdAtLocation: z.ZodString;
status: z.ZodEnum<[import("./ActionDocument").ActionStatus.Requested, import("./ActionDocument").ActionStatus.Accepted, import("./ActionDocument").ActionStatus.Rejected]>;
updatedAt: z.ZodOptional<z.ZodString>;
status: z.ZodEnum<["Requested", "Accepted", "Rejected"]>;
originalActionId: z.ZodOptional<z.ZodString>;
}, {
type: z.ZodEnum<[ActionType, ...ActionType[]]>;
}>, "id" | "status">, "strip", z.ZodTypeAny, {
type: ActionType;
data: Record<string, string | number | boolean | {
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"]>;
}>, "id">, "strip", z.ZodTypeAny, {
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";
createdAt: string;
createdBy: string;
declaration: Record<string, string | number | boolean | {
type: string;

@@ -288,6 +290,4 @@ filename: string;

}[] | undefined>;
createdAt: string;
createdBy: string;
createdAtLocation: string;
metadata?: Record<string, string | number | boolean | {
annotation?: Record<string, string | number | boolean | {
type: string;

@@ -330,6 +330,9 @@ filename: string;

}[] | undefined> | undefined;
updatedAt?: string | undefined;
originalActionId?: string | undefined;
}, {
type: ActionType;
data: Record<string, string | number | boolean | {
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";
createdAt: string;
createdBy: string;
declaration: Record<string, string | number | boolean | {
type: string;

@@ -372,6 +375,4 @@ filename: string;

}[] | undefined>;
createdAt: string;
createdBy: string;
createdAtLocation: string;
metadata?: Record<string, string | number | boolean | {
annotation?: Record<string, string | number | boolean | {
type: string;

@@ -414,3 +415,3 @@ filename: string;

}[] | undefined> | undefined;
updatedAt?: string | undefined;
originalActionId?: string | undefined;
}>;

@@ -423,4 +424,7 @@ }, "strip", z.ZodTypeAny, {

action: {
type: ActionType;
data: Record<string, string | number | boolean | {
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";
createdAt: string;
createdBy: string;
declaration: Record<string, string | number | boolean | {
type: string;

@@ -463,6 +467,4 @@ filename: string;

}[] | undefined>;
createdAt: string;
createdBy: string;
createdAtLocation: string;
metadata?: Record<string, string | number | boolean | {
annotation?: Record<string, string | number | boolean | {
type: string;

@@ -505,3 +507,3 @@ filename: string;

}[] | undefined> | undefined;
updatedAt?: string | undefined;
originalActionId?: string | undefined;
};

@@ -514,4 +516,7 @@ }, {

action: {
type: ActionType;
data: Record<string, string | number | boolean | {
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";
createdAt: string;
createdBy: string;
declaration: Record<string, string | number | boolean | {
type: string;

@@ -554,6 +559,4 @@ filename: string;

}[] | undefined>;
createdAt: string;
createdBy: string;
createdAtLocation: string;
metadata?: Record<string, string | number | boolean | {
annotation?: Record<string, string | number | boolean | {
type: string;

@@ -596,3 +599,3 @@ filename: string;

}[] | undefined> | undefined;
updatedAt?: string | undefined;
originalActionId?: string | undefined;
};

@@ -603,3 +606,3 @@ }>;

transactionId: z.ZodString;
data: 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;

@@ -717,4 +720,4 @@ originalFilename: z.ZodString;

postcodeOrZip?: string | null | undefined;
}>]>>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
}>]>>>;
annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
filename: z.ZodString;

@@ -833,7 +836,9 @@ originalFilename: z.ZodString;

}>]>>>;
originalActionId: z.ZodOptional<z.ZodString>;
keepAssignment: z.ZodOptional<z.ZodBoolean>;
}, {
type: z.ZodEnum<[ActionType, ...ActionType[]]>;
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"]>;
}>, "strip", z.ZodTypeAny, {
type: ActionType;
data: Record<string, string | number | boolean | {
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 | {
type: string;

@@ -878,3 +883,3 @@ filename: string;

transactionId: string;
metadata?: Record<string, string | number | boolean | {
annotation?: Record<string, string | number | boolean | {
type: string;

@@ -917,5 +922,9 @@ filename: string;

}[] | undefined> | undefined;
originalActionId?: string | undefined;
keepAssignment?: boolean | undefined;
}, {
type: ActionType;
data: Record<string, string | number | boolean | {
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";
eventId: string;
transactionId: string;
declaration?: Record<string, string | number | boolean | {
type: string;

@@ -957,6 +966,4 @@ filename: string;

originalFilename: string;
}[] | undefined>;
eventId: string;
transactionId: string;
metadata?: Record<string, string | number | boolean | {
}[] | undefined> | undefined;
annotation?: Record<string, string | number | boolean | {
type: string;

@@ -999,2 +1006,4 @@ filename: string;

}[] | undefined> | undefined;
originalActionId?: string | undefined;
keepAssignment?: boolean | undefined;
}>;

@@ -1001,0 +1010,0 @@ export type Draft = z.infer<typeof Draft>;

import { z } from 'zod';
import { EventConfig } from './EventConfig';
import { FormConfig, FormConfigInput, FormPageConfig, FormPageConfigInput } from './FormConfig';
import { FormPageConfig, FormPageConfigInput, PageConfig, PageConfigInput } from './PageConfig';
import { ActionFormConfig, ActionFormConfigInput, DeclarationFormConfig, DeclarationFormConfigInput } from './FormConfig';
export type EventConfigInput = z.input<typeof EventConfig>;
export declare const defineForm: (form: FormConfigInput) => FormConfig;
export declare const defineDeclarationForm: (form: DeclarationFormConfigInput) => DeclarationFormConfig;
export declare const defineActionForm: (actionForm: ActionFormConfigInput) => ActionFormConfig;
export declare const definePage: (page: PageConfigInput) => PageConfig;
export declare const defineFormPage: (formPage: FormPageConfigInput) => FormPageConfig;
//# sourceMappingURL=EventConfigInput.d.ts.map

@@ -18,2 +18,3 @@ import { z } from 'zod';

createdAtLocation: z.ZodString;
updatedAtLocation: z.ZodString;
modifiedAt: z.ZodString;

@@ -23,4 +24,5 @@ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;

trackingId: z.ZodString;
registrationNumber: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, {
data: z.ZodRecord<z.ZodString, z.ZodAny>;
declaration: z.ZodRecord<z.ZodString, z.ZodAny>;
}>, "strip", z.ZodTypeAny, {

@@ -30,6 +32,7 @@ type: string;

status: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED";
data: Record<string, any>;
createdAt: string;
createdBy: string;
declaration: Record<string, any>;
createdAtLocation: string;
updatedAtLocation: string;
trackingId: string;

@@ -39,2 +42,3 @@ modifiedAt: string;

assignedTo?: string | null | undefined;
registrationNumber?: string | null | undefined;
}, {

@@ -44,6 +48,7 @@ type: string;

status: "ARCHIVED" | "CERTIFIED" | "DECLARED" | "REGISTERED" | "REJECTED" | "VALIDATED" | "CREATED" | "NOTIFIED";
data: Record<string, any>;
createdAt: string;
createdBy: string;
declaration: Record<string, any>;
createdAtLocation: string;
updatedAtLocation: string;
trackingId: string;

@@ -53,2 +58,3 @@ modifiedAt: string;

assignedTo?: string | null | undefined;
registrationNumber?: string | null | undefined;
}>;

@@ -55,0 +61,0 @@ export declare const EventSearchIndex: z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodObject<{

@@ -49,2 +49,3 @@ import { z } from 'zod';

createdAtLocation: z.ZodString;
updatedAtLocation: z.ZodString;
modifiedAt: z.ZodString;

@@ -54,2 +55,3 @@ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;

trackingId: z.ZodString;
registrationNumber: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {

@@ -62,2 +64,3 @@ type: string;

createdAtLocation: string;
updatedAtLocation: string;
trackingId: string;

@@ -67,2 +70,3 @@ modifiedAt: string;

assignedTo?: string | null | undefined;
registrationNumber?: string | null | undefined;
}, {

@@ -75,2 +79,3 @@ type: string;

createdAtLocation: string;
updatedAtLocation: string;
trackingId: string;

@@ -80,2 +85,3 @@ modifiedAt: string;

assignedTo?: string | null | undefined;
registrationNumber?: string | null | undefined;
}>;

@@ -82,0 +88,0 @@ export type EventMetadata = z.infer<typeof EventMetadata>;

import { z } from 'zod';
import { TranslationConfig } from './TranslationConfig';
export declare const FormPageType: {
readonly FORM: "FORM";
readonly VERIFICATION: "VERIFICATION";
};
export declare const FormPage: z.ZodObject<{
id: z.ZodString;
type: z.ZodDefault<z.ZodLiteral<"FORM">>;
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
export declare const DeclarationFormConfig: z.ZodObject<{
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;

@@ -15,13 +9,41 @@ description: 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>>;
pages: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
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>>;
}, {
type: z.ZodDefault<z.ZodLiteral<"FORM">>;
}>, "strip", z.ZodTypeAny, {
type: "FORM";
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[];
type?: "FORM" | undefined;
conditional?: import(".").JSONSchema | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
type: "FORM";
id: string;
title: TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
label: TranslationConfig;
pages: {
type: "FORM";
id: string;
title: TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
}[];
}, {
id: string;
title: {
label: {
id: string;

@@ -31,24 +53,25 @@ description: string;

};
fields: import("./FieldConfig").InferredInput[];
type?: "FORM" | undefined;
conditional?: import(".").JSONSchema | undefined;
}>;
export declare const VerificationPageConfig: z.ZodObject<{
verify: z.ZodObject<{
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
pages: {
id: string;
title: {
id: string;
description: string;
defaultMessage: string;
}>;
}, "strip", z.ZodTypeAny, {
label: TranslationConfig;
}, {
label: {
id: string;
description: string;
defaultMessage: string;
};
fields: import("./FieldConfig").InferredInput[];
type?: "FORM" | undefined;
conditional?: import(".").JSONSchema | undefined;
}[];
}>;
export type DeclarationFormConfig = z.infer<typeof DeclarationFormConfig>;
export type DeclarationFormConfigInput = z.input<typeof DeclarationFormConfig>;
export declare const ActionFormConfig: z.ZodObject<{
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;
description: string;
defaultMessage: string;
}>;
cancel: z.ZodObject<{
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
pages: z.ZodArray<z.ZodDiscriminatedUnion<"type", (z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;

@@ -58,36 +81,15 @@ description: string;

}>;
confirmation: z.ZodObject<{
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;
description: string;
defaultMessage: string;
}>;
body: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;
description: string;
defaultMessage: string;
}>;
}, "strip", z.ZodTypeAny, {
title: TranslationConfig;
body: TranslationConfig;
}, {
title: {
id: string;
description: string;
defaultMessage: string;
};
body: {
id: string;
description: string;
defaultMessage: string;
};
}>;
}, "strip", z.ZodTypeAny, {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
};
fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").InferredInput>, "many">;
conditional: z.ZodOptional<z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>>;
}, {
label: {
type: z.ZodDefault<z.ZodLiteral<"FORM">>;
}>, "strip", z.ZodTypeAny, {
type: "FORM";
id: string;
title: TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
}, {
id: string;
title: {
id: string;

@@ -97,90 +99,21 @@ description: string;

};
confirmation: {
title: {
id: string;
description: string;
defaultMessage: string;
};
body: {
id: string;
description: string;
defaultMessage: string;
};
};
}>;
}, "strip", z.ZodTypeAny, {
verify: {
label: TranslationConfig;
};
cancel: {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
};
};
}, {
verify: {
label: {
fields: import("./FieldConfig").InferredInput[];
type?: "FORM" | undefined;
conditional?: import(".").JSONSchema | undefined;
}> | z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;
description: string;
defaultMessage: string;
};
};
cancel: {
label: {
id: string;
description: string;
defaultMessage: string;
};
confirmation: {
title: {
id: string;
description: string;
defaultMessage: string;
};
body: {
id: string;
description: string;
defaultMessage: string;
};
};
};
}>;
export declare const VerificationPage: z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
type: z.ZodDefault<z.ZodLiteral<"FORM">>;
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>>;
}, {
type: z.ZodLiteral<"VERIFICATION">;
actions: z.ZodObject<{
verify: z.ZodObject<{
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;
description: string;
defaultMessage: string;
}>;
}, "strip", z.ZodTypeAny, {
label: TranslationConfig;
}, {
label: {
id: string;
description: string;
defaultMessage: string;
};
}>;
cancel: z.ZodObject<{
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;
description: string;
defaultMessage: string;
}>;
confirmation: z.ZodObject<{
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").InferredInput>, "many">;
conditional: z.ZodOptional<z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>>;
}, {
type: z.ZodDefault<z.ZodLiteral<"FORM">>;
}>, {
type: z.ZodLiteral<"VERIFICATION">;
actions: z.ZodObject<{
verify: z.ZodObject<{
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;

@@ -190,17 +123,51 @@ description: string;

}>;
body: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
}, "strip", z.ZodTypeAny, {
label: TranslationConfig;
}, {
label: {
id: string;
description: string;
defaultMessage: string;
}>;
}, "strip", z.ZodTypeAny, {
title: TranslationConfig;
body: TranslationConfig;
}, {
title: {
};
}>;
cancel: z.ZodObject<{
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;
description: string;
defaultMessage: string;
}>;
confirmation: z.ZodObject<{
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;
description: string;
defaultMessage: string;
}>;
body: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;
description: string;
defaultMessage: string;
}>;
}, "strip", z.ZodTypeAny, {
title: TranslationConfig;
body: TranslationConfig;
}, {
title: {
id: string;
description: string;
defaultMessage: string;
};
body: {
id: string;
description: string;
defaultMessage: string;
};
}>;
}, "strip", z.ZodTypeAny, {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
};
body: {
}, {
label: {
id: string;

@@ -210,17 +177,29 @@ description: string;

};
confirmation: {
title: {
id: string;
description: string;
defaultMessage: string;
};
body: {
id: string;
description: string;
defaultMessage: string;
};
};
}>;
}, "strip", z.ZodTypeAny, {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
verify: {
label: TranslationConfig;
};
cancel: {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
};
};
}, {
label: {
id: string;
description: string;
defaultMessage: string;
};
confirmation: {
title: {
verify: {
label: {
id: string;

@@ -230,3 +209,5 @@ description: string;

};
body: {
};
cancel: {
label: {
id: string;

@@ -236,31 +217,45 @@ description: string;

};
confirmation: {
title: {
id: string;
description: string;
defaultMessage: string;
};
body: {
id: string;
description: string;
defaultMessage: string;
};
};
};
}>;
}, "strip", z.ZodTypeAny, {
verify: {
label: TranslationConfig;
};
cancel: {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
}>, "strip", z.ZodTypeAny, {
type: "VERIFICATION";
id: string;
title: TranslationConfig;
actions: {
verify: {
label: TranslationConfig;
};
cancel: {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
}, {
verify: {
label: {
id: string;
description: string;
defaultMessage: string;
};
type: "VERIFICATION";
id: string;
title: {
id: string;
description: string;
defaultMessage: string;
};
cancel: {
label: {
id: string;
description: string;
defaultMessage: string;
};
confirmation: {
title: {
actions: {
verify: {
label: {
id: string;

@@ -270,3 +265,5 @@ description: string;

};
body: {
};
cancel: {
label: {
id: string;

@@ -276,27 +273,48 @@ description: string;

};
confirmation: {
title: {
id: string;
description: string;
defaultMessage: string;
};
body: {
id: string;
description: string;
defaultMessage: string;
};
};
};
};
}>;
}>, "strip", z.ZodTypeAny, {
type: "VERIFICATION";
id: string;
title: TranslationConfig;
actions: {
verify: {
label: TranslationConfig;
};
cancel: {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
fields: import("./FieldConfig").InferredInput[];
conditional?: import(".").JSONSchema | undefined;
}>)[]>, "many">;
}, "strip", z.ZodTypeAny, {
label: TranslationConfig;
pages: ({
type: "FORM";
id: string;
title: TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: TranslationConfig;
actions: {
verify: {
label: TranslationConfig;
};
cancel: {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
};
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[];
}, {
type: "VERIFICATION";
id: string;
title: {
label: {
id: string;

@@ -306,18 +324,23 @@ description: string;

};
actions: {
verify: {
label: {
id: string;
description: string;
defaultMessage: string;
};
pages: ({
id: string;
title: {
id: string;
description: string;
defaultMessage: string;
};
cancel: {
label: {
id: string;
description: string;
defaultMessage: string;
};
confirmation: {
title: {
fields: import("./FieldConfig").InferredInput[];
type?: "FORM" | undefined;
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: {
id: string;
description: string;
defaultMessage: string;
};
actions: {
verify: {
label: {
id: string;

@@ -327,3 +350,5 @@ description: string;

};
body: {
};
cancel: {
label: {
id: string;

@@ -333,14 +358,23 @@ description: string;

};
confirmation: {
title: {
id: string;
description: string;
defaultMessage: string;
};
body: {
id: string;
description: string;
defaultMessage: string;
};
};
};
};
};
fields: import("./FieldConfig").InferredInput[];
conditional?: import(".").JSONSchema | undefined;
fields: import("./FieldConfig").InferredInput[];
conditional?: import(".").JSONSchema | undefined;
})[];
}>;
export type VerificationPageConfig = z.infer<typeof VerificationPageConfig>;
type AllPageConfigs = typeof FormPage | typeof VerificationPage;
export declare const FormPageConfig: z.ZodDiscriminatedUnion<"type", AllPageConfigs[]>;
export type FormPageConfigInput = z.input<typeof FormPageConfig>;
export type FormPageConfig = z.infer<typeof FormPageConfig>;
export declare const FormConfig: z.ZodObject<{
export type ActionFormConfig = z.infer<typeof ActionFormConfig>;
export type ActionFormConfigInput = z.input<typeof ActionFormConfig>;
export declare const FormConfig: z.ZodUnion<[z.ZodObject<{
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {

@@ -351,5 +385,5 @@ id: string;

}>;
version: z.ZodObject<{
pages: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;

@@ -359,8 +393,15 @@ description: string;

}>;
}, "strip", z.ZodTypeAny, {
fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").InferredInput>, "many">;
conditional: z.ZodOptional<z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>>;
}, {
type: z.ZodDefault<z.ZodLiteral<"FORM">>;
}>, "strip", z.ZodTypeAny, {
type: "FORM";
id: string;
label: TranslationConfig;
title: TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
}, {
id: string;
label: {
title: {
id: string;

@@ -370,6 +411,40 @@ description: string;

};
fields: import("./FieldConfig").InferredInput[];
type?: "FORM" | undefined;
conditional?: import(".").JSONSchema | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
label: TranslationConfig;
pages: {
type: "FORM";
id: string;
title: TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
}[];
}, {
label: {
id: string;
description: string;
defaultMessage: string;
};
pages: {
id: string;
title: {
id: string;
description: string;
defaultMessage: string;
};
fields: import("./FieldConfig").InferredInput[];
type?: "FORM" | undefined;
conditional?: import(".").JSONSchema | undefined;
}[];
}>, z.ZodObject<{
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;
description: string;
defaultMessage: string;
}>;
active: z.ZodDefault<z.ZodBoolean>;
pages: z.ZodArray<z.ZodDiscriminatedUnion<"type", AllPageConfigs[]>, "many">;
review: z.ZodObject<{
pages: z.ZodArray<z.ZodDiscriminatedUnion<"type", (z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {

@@ -381,6 +456,13 @@ id: string;

fields: z.ZodArray<z.ZodType<import("./FieldConfig").Inferred, any, import("./FieldConfig").InferredInput>, "many">;
}, "strip", z.ZodTypeAny, {
conditional: z.ZodOptional<z.ZodType<import(".").JSONSchema, z.ZodTypeDef, import(".").JSONSchema>>;
}, {
type: z.ZodDefault<z.ZodLiteral<"FORM">>;
}>, "strip", z.ZodTypeAny, {
type: "FORM";
id: string;
title: TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
}, {
id: string;
title: {

@@ -392,9 +474,187 @@ id: string;

fields: import("./FieldConfig").InferredInput[];
}>;
type?: "FORM" | undefined;
conditional?: import(".").JSONSchema | undefined;
}> | z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
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>>;
}, {
type: z.ZodDefault<z.ZodLiteral<"FORM">>;
}>, {
type: z.ZodLiteral<"VERIFICATION">;
actions: z.ZodObject<{
verify: z.ZodObject<{
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;
description: string;
defaultMessage: string;
}>;
}, "strip", z.ZodTypeAny, {
label: TranslationConfig;
}, {
label: {
id: string;
description: string;
defaultMessage: string;
};
}>;
cancel: z.ZodObject<{
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;
description: string;
defaultMessage: string;
}>;
confirmation: z.ZodObject<{
title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;
description: string;
defaultMessage: string;
}>;
body: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
id: string;
description: string;
defaultMessage: string;
}>;
}, "strip", z.ZodTypeAny, {
title: TranslationConfig;
body: TranslationConfig;
}, {
title: {
id: string;
description: string;
defaultMessage: string;
};
body: {
id: string;
description: string;
defaultMessage: string;
};
}>;
}, "strip", z.ZodTypeAny, {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
};
}, {
label: {
id: string;
description: string;
defaultMessage: string;
};
confirmation: {
title: {
id: string;
description: string;
defaultMessage: string;
};
body: {
id: string;
description: string;
defaultMessage: string;
};
};
}>;
}, "strip", z.ZodTypeAny, {
verify: {
label: TranslationConfig;
};
cancel: {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
};
};
}, {
verify: {
label: {
id: string;
description: string;
defaultMessage: string;
};
};
cancel: {
label: {
id: string;
description: string;
defaultMessage: string;
};
confirmation: {
title: {
id: string;
description: string;
defaultMessage: string;
};
body: {
id: string;
description: string;
defaultMessage: string;
};
};
};
}>;
}>, "strip", z.ZodTypeAny, {
type: "VERIFICATION";
id: string;
title: TranslationConfig;
actions: {
verify: {
label: TranslationConfig;
};
cancel: {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
}, {
type: "VERIFICATION";
id: string;
title: {
id: string;
description: string;
defaultMessage: string;
};
actions: {
verify: {
label: {
id: string;
description: string;
defaultMessage: string;
};
};
cancel: {
label: {
id: string;
description: string;
defaultMessage: string;
};
confirmation: {
title: {
id: string;
description: string;
defaultMessage: string;
};
body: {
id: string;
description: string;
defaultMessage: string;
};
};
};
};
fields: import("./FieldConfig").InferredInput[];
conditional?: import(".").JSONSchema | undefined;
}>)[]>, "many">;
}, "strip", z.ZodTypeAny, {
active: boolean;
version: {
id: string;
label: TranslationConfig;
};
label: TranslationConfig;

@@ -426,15 +686,3 @@ pages: ({

})[];
review: {
title: TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
}, {
version: {
id: string;
label: {
id: string;
description: string;
defaultMessage: string;
};
};
label: {

@@ -494,15 +742,4 @@ id: string;

})[];
review: {
title: {
id: string;
description: string;
defaultMessage: string;
};
fields: import("./FieldConfig").InferredInput[];
};
active?: boolean | undefined;
}>;
}>]>;
export type FormConfig = z.infer<typeof FormConfig>;
export type FormConfigInput = z.input<typeof FormConfig>;
export {};
//# sourceMappingURL=FormConfig.d.ts.map

@@ -6,3 +6,3 @@ export * from './ActionConfig';

export * from './FieldConfig';
export * from './FormConfig';
export * from './PageConfig';
export * from './SummaryConfig';

@@ -19,2 +19,3 @@ export * from './WorkqueueConfig';

export * from './FieldValue';
export * from './FormConfig';
export * from './CompositeFieldValue';

@@ -34,5 +35,5 @@ export * from './state';

export * from './TemplateConfig';
export * from './scopes';
export * from '../conditionals/conditionals';
export * from '../conditionals/validate';
export * from './api';
//# sourceMappingURL=index.d.ts.map

@@ -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 interface MetaFields {
export type SystemVariables = {
$user: {

@@ -15,3 +15,3 @@ province: string;

};
}
};
/**

@@ -26,8 +26,8 @@ * Recursively flatten the keys of an object. Used to limit types when configuring default values in country config.

}[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;

@@ -34,0 +34,0 @@ /**

import { ActionDocument, ActionUpdate } from './ActionDocument';
import { ArchiveActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, ValidateActionInput } from './ActionInput';
import { ArchiveActionInput, AssignActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
import { ActionType } from './ActionType';

@@ -11,3 +11,3 @@ import { Draft } from './Draft';

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: {

@@ -62,117 +62,11 @@ create: (input?: Partial<EventInput>) => {

};
draft: (eventId: string, input?: Partial<Draft>) => {
id: import("../uuid").UUID;
draft: ({ eventId, actionType }: {
eventId: string;
createdAt: string;
transactionId: import("../uuid").UUID;
action: {
type: "REQUEST_CORRECTION";
data: {
'applicant.firstname': string;
'applicant.surname': string;
'applicant.dob': string;
'recommender.none': boolean;
};
metadata: {
'correction.requester.relationship': string;
'correction.request.reason': string;
};
createdAt: string;
createdBy: string;
createdAtLocation: string;
};
} & Partial<{
id: string;
createdAt: string;
eventId: string;
transactionId: string;
action: {
type: ActionType;
data: 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>;
createdAt: string;
createdBy: string;
createdAtLocation: string;
metadata?: 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> | undefined;
updatedAt?: string | undefined;
};
}>;
actionType: ActionType;
}, input?: Partial<Draft>) => Draft;
actions: {
declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "data">>) => {
declare: (eventId: string, input?: Partial<Pick<DeclareActionInput, "transactionId" | "declaration" | "annotation">>) => {
type: "DECLARE";
transactionId: string;
data: Record<string, string | number | boolean | {
declaration: Record<string, string | number | boolean | {
type: string;

@@ -215,2 +109,3 @@ filename: string;

}[] | undefined>;
annotation: {};
eventId: string;

@@ -223,7 +118,7 @@ };

transactionId?: string;
data?: Partial<ActionUpdate>;
declaration?: Partial<ActionUpdate>;
}) => {
type: "NOTIFY";
transactionId: string;
data: Partial<Record<string, string | number | boolean | {
declaration: Partial<Record<string, string | number | boolean | {
type: string;

@@ -268,6 +163,6 @@ filename: string;

};
validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "data">>) => {
validate: (eventId: string, input?: Partial<Pick<ValidateActionInput, "transactionId" | "declaration" | "annotation">>) => {
type: "VALIDATE";
transactionId: string;
data: Record<string, string | number | boolean | {
declaration: Record<string, string | number | boolean | {
type: string;

@@ -310,47 +205,25 @@ filename: string;

}[] | undefined>;
annotation: {};
duplicates: never[];
eventId: string;
};
archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "data">>, isDuplicate?: boolean) => {
assign: (eventId: string, input?: Partial<Pick<AssignActionInput, "transactionId" | "assignedTo">>) => {
type: "ASSIGN";
transactionId: string;
declaration: {};
assignedTo: string;
eventId: string;
};
unassign: (eventId: string, input?: Partial<Pick<UnassignActionInput, "transactionId">>) => {
type: "UNASSIGN";
transactionId: string;
declaration: {};
assignedTo: null;
eventId: string;
};
archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "declaration">>, isDuplicate?: boolean) => {
type: "ARCHIVE";
transactionId: string;
data: 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>;
metadata: {
declaration: {};
annotation: {
isDuplicate: boolean;

@@ -361,50 +234,14 @@ };

};
reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "data">>) => {
reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, "transactionId" | "annotation">>) => {
type: "REJECT";
transactionId: string;
data: 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>;
declaration: {};
annotation: {};
duplicates: never[];
eventId: string;
};
register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data">>) => {
register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation">>) => {
type: "REGISTER";
transactionId: string;
data: Record<string, string | number | boolean | {
declaration: Record<string, string | number | boolean | {
type: string;

@@ -447,53 +284,17 @@ filename: string;

}[] | undefined>;
annotation: {};
eventId: string;
};
printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "data" | "metadata">>) => {
printCertificate: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "annotation">>) => {
type: "PRINT_CERTIFICATE";
transactionId: string;
data: 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>;
metadata: {};
declaration: {};
annotation: {};
eventId: string;
};
correction: {
request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
request: (eventId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "declaration" | "annotation">>) => {
type: "REQUEST_CORRECTION";
transactionId: string;
data: Record<string, string | number | boolean | {
declaration: Record<string, string | number | boolean | {
type: string;

@@ -536,90 +337,18 @@ filename: string;

}[] | undefined>;
metadata: {};
annotation: {};
eventId: string;
};
approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
approve: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
type: "APPROVE_CORRECTION";
transactionId: string;
data: 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>;
declaration: {};
annotation: {};
eventId: string;
requestId: string;
};
reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "data">>) => {
reject: (eventId: string, requestId: string, input?: Partial<Pick<RequestCorrectionActionInput, "transactionId" | "annotation">>) => {
type: "REJECT_CORRECTION";
transactionId: string;
data: 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>;
declaration: {};
annotation: {};
eventId: string;

@@ -640,5 +369,5 @@ requestId: string;

}): EventDocument;
export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, data?: Record<string, FieldValue>): Draft;
export declare function generateEventDraftDocument(eventId: string, actionType?: ActionType, declaration?: Record<string, FieldValue>): Draft;
export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>) => EventIndex;
export declare const generateTranslationConfig: (message: string) => TranslationConfig;
//# sourceMappingURL=test.utils.d.ts.map

@@ -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

@@ -1,176 +0,88 @@

import { TranslationConfig } from './TranslationConfig';
import { ActionType } from './ActionType';
import { ActionType, DeclarationActionType } from './ActionType';
import { EventConfig } from './EventConfig';
import { EventConfigInput } from './EventConfigInput';
import { EventMetadataKeys } from './EventMetadata';
import { FieldConfig } from './FieldConfig';
import { WorkqueueConfig } from './WorkqueueConfig';
import { ActionUpdate, EventState } from './ActionDocument';
import { FormConfig, FormPageConfig } from './FormConfig';
import { Action, ActionUpdate, EventState } from './ActionDocument';
import { PageConfig, VerificationPageConfig } from './PageConfig';
import { Draft } from './Draft';
import { EventDocument } from './EventDocument';
/**
* @returns All the fields in the event configuration input.
*/
export declare const findInputPageFields: (config: EventConfigInput) => {
id: string;
label: TranslationConfig;
}[];
/**
* @returns All the fields in the event configuration.
*/
export declare const findPageFields: (config: EventConfig) => FieldConfig[];
/**
*
* @param pageFields - All the fields in the event configuration
* @param refFields - The fields referencing values within the event configuration (e.g. summary fields) or within system provided metadata fields (e.g. createdAt, updatedBy)
* @returns referenced fields with populated labels
*/
export declare const resolveLabelsFromKnownFields: ({ pageFields, refFields }: {
pageFields: {
id: string;
label: TranslationConfig;
}[];
refFields: {
id: EventMetadataKeys | string;
label?: TranslationConfig;
}[];
}) => {
id: EventMetadataKeys | string;
label?: TranslationConfig;
}[];
export declare function getAllFields(configuration: EventConfig): import("./FieldConfig").Inferred[];
export declare function getAllPages(configuration: EventConfig): ({
import { ActionConfig } from './ActionConfig';
import { FormConfig } from './FormConfig';
export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
export declare function getDeclarationPages(configuration: EventConfig): {
type: "FORM";
id: string;
title: TranslationConfig;
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: TranslationConfig;
actions: {
verify: {
label: TranslationConfig;
};
cancel: {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[];
export declare function validateWorkqueueConfig(workqueueConfigs: WorkqueueConfig[]): void;
export declare const findActiveActionForm: (configuration: EventConfig, action: ActionType) => {
active: boolean;
version: {
id: string;
label: TranslationConfig;
};
label: TranslationConfig;
pages: ({
}[];
export declare function getDeclaration(configuration: EventConfig): {
label: import("./TranslationConfig").TranslationConfig;
pages: {
type: "FORM";
id: string;
title: TranslationConfig;
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: TranslationConfig;
actions: {
verify: {
label: TranslationConfig;
};
cancel: {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[];
review: {
title: TranslationConfig;
fields: import("./FieldConfig").Inferred[];
};
} | undefined;
export declare const findActiveActionFormPages: (configuration: EventConfig, action: ActionType) => ({
type: "FORM";
id: string;
title: TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
} | {
type: "VERIFICATION";
id: string;
title: TranslationConfig;
actions: {
verify: {
label: TranslationConfig;
};
cancel: {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[] | undefined;
export declare const getFormFields: (formConfig: FormConfig) => import("./FieldConfig").Inferred[];
export declare function isPageVisible(page: FormPageConfig, formValues: ActionUpdate): boolean;
export declare const getVisiblePagesFormFields: (formConfig: FormConfig, formData: ActionUpdate) => import("./FieldConfig").Inferred[];
}[];
};
export declare const getActionAnnotationFields: (actionConfig: ActionConfig) => import("./FieldConfig").Inferred[];
export declare const getAllAnnotationFields: (config: EventConfig) => FieldConfig[];
/**
* Returns only form fields for the action type, if any, excluding review fields.
* @returns All the fields in the event configuration.
*/
export declare const findActiveActionFormFields: (configuration: EventConfig, action: ActionType) => FieldConfig[] | undefined;
export declare const findAllFields: (config: EventConfig) => FieldConfig[];
/**
* Returns all fields for the action type, including review fields, if any.
* @TODO: Request correction should have same format as print certificate
*/
export declare const findActiveActionFields: (configuration: EventConfig, action: ActionType, formData?: ActionUpdate) => FieldConfig[] | undefined;
export declare const getActiveActionFormPages: (configuration: EventConfig, action: ActionType) => ({
type: "FORM";
id: string;
title: TranslationConfig;
export declare const findRecordActionPages: (config: EventConfig, actionType: ActionType) => PageConfig[];
export declare function getActionReview(configuration: EventConfig, actionType: ActionType): {
title: import("./TranslationConfig").TranslationConfig;
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
};
export declare function getActionReviewFields(configuration: EventConfig, actionType: DeclarationActionType): import("./FieldConfig").Inferred[];
export declare function validateWorkqueueConfig(workqueueConfigs: WorkqueueConfig[]): void;
export declare function isPageVisible(page: PageConfig, formValues: ActionUpdate): boolean;
export declare function omitHiddenFields(fields: FieldConfig[], values: EventState): import("lodash").Dictionary<string | number | boolean | {
type: string;
filename: string;
originalFilename: string;
} | {
type: "VERIFICATION";
id: string;
title: TranslationConfig;
actions: {
verify: {
label: TranslationConfig;
};
cancel: {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
})[];
/**
* Returns all fields for the action type, including review fields, or throws
*/
export declare function getActiveActionFields(configuration: EventConfig, action: ActionType): FieldConfig[];
export declare function getEventConfiguration(eventConfigurations: EventConfig[], type: string): EventConfig;
export declare function stripHiddenFields(fields: FieldConfig[], data: EventState): import("lodash").Dictionary<string | number | boolean | {
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 omitHiddenPaginatedFields(formConfig: FormConfig, declaration: EventState): import("lodash").Dictionary<string | number | boolean | {
type: string;
filename: string;
originalFilename: string;
} | {

@@ -216,4 +128,7 @@ country: string;

action: {
type: ActionType;
data: Record<string, string | number | boolean | {
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";
createdAt: string;
createdBy: string;
declaration: Record<string, string | number | boolean | {
type: string;

@@ -256,6 +171,4 @@ filename: string;

}[] | undefined>;
createdAt: string;
createdBy: string;
createdAtLocation: string;
metadata?: Record<string, string | number | boolean | {
annotation?: Record<string, string | number | boolean | {
type: string;

@@ -298,3 +211,3 @@ filename: string;

}[] | undefined> | undefined;
updatedAt?: string | undefined;
originalActionId?: string | undefined;
};

@@ -309,4 +222,4 @@ }[];

type: ActionType;
data: {};
metadata: {};
declaration: {};
annotation: {};
createdAt: string;

@@ -317,21 +230,12 @@ createdBy: string;

};
export declare function isVerificationPage(page: FormPageConfig): page is {
type: "VERIFICATION";
id: string;
title: TranslationConfig;
actions: {
verify: {
label: TranslationConfig;
};
cancel: {
label: TranslationConfig;
confirmation: {
title: TranslationConfig;
body: TranslationConfig;
};
};
};
fields: import("./FieldConfig").Inferred[];
conditional?: import(".").JSONSchema | undefined;
export declare function isVerificationPage(page: PageConfig): page is VerificationPageConfig;
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

@@ -26,4 +26,6 @@ "use strict";

defineConditional: () => defineConditional,
defineFormConditional: () => defineFormConditional,
event: () => event,
field: () => field,
never: () => never,
not: () => not,

@@ -39,2 +41,12 @@ or: () => or,

}
function defineFormConditional(schema) {
const schemaWithForm = {
type: "object",
properties: {
$form: schema
},
required: ["$form"]
};
return defineConditional(schemaWithForm);
}
function alwaysTrue() {

@@ -64,2 +76,5 @@ return {};

}
function never() {
return not(alwaysTrue());
}
var user = {

@@ -112,65 +127,116 @@ hasScope: (scope) => defineConditional({

};
function getDateFromNow(days) {
return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
}
function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
return {
type: "object",
properties: {
[fieldId]: {
type: "string",
format: "date",
[clause]: { $data: `1/${comparedFieldId}` }
},
[comparedFieldId]: { type: "string", format: "date" }
},
required: [fieldId]
};
}
function isFieldReference(value) {
return typeof value === "object" && value !== null && "_fieldId" in value;
}
function field(fieldId) {
const getDateFromNow = (days) => new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
const getDateRange = (date, clause) => ({
type: "object",
properties: {
$form: {
type: "object",
properties: {
[fieldId]: {
type: "string",
format: "date",
[clause]: date
}
},
required: [fieldId]
[fieldId]: {
type: "string",
format: "date",
[clause]: date
}
},
required: ["$form"]
required: [fieldId]
});
return {
/**
* @private Internal property used for field reference tracking.
*/
_fieldId: fieldId,
isAfter: () => ({
days: (days) => ({
inPast: () => defineConditional(
inPast: () => defineFormConditional(
getDateRange(getDateFromNow(days), "formatMinimum")
),
inFuture: () => defineConditional(
inFuture: () => defineFormConditional(
getDateRange(getDateFromNow(-days), "formatMinimum")
)
}),
date: (date) => defineConditional(getDateRange(date, "formatMinimum")),
now: () => defineConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
date: (date) => {
if (isFieldReference(date)) {
const comparedFieldId = date._fieldId;
return defineFormConditional(
getDateRangeToFieldReference(
fieldId,
comparedFieldId,
"formatMinimum"
)
);
}
return defineFormConditional(getDateRange(date, "formatMinimum"));
},
now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMinimum"))
}),
isBefore: () => ({
days: (days) => ({
inPast: () => defineConditional(
inPast: () => defineFormConditional(
getDateRange(getDateFromNow(days), "formatMaximum")
),
inFuture: () => defineConditional(
inFuture: () => defineFormConditional(
getDateRange(getDateFromNow(-days), "formatMaximum")
)
}),
date: (date) => defineConditional(getDateRange(date, "formatMaximum")),
now: () => defineConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
date: (date) => {
if (isFieldReference(date)) {
const comparedFieldId = date._fieldId;
return defineFormConditional(
getDateRangeToFieldReference(
fieldId,
comparedFieldId,
"formatMaximum"
)
);
}
return defineFormConditional(getDateRange(date, "formatMaximum"));
},
now: () => defineFormConditional(getDateRange(getDateFromNow(0), "formatMaximum"))
}),
isEqualTo: (value) => defineConditional({
type: "object",
properties: {
$form: {
isEqualTo: (value) => {
if (isFieldReference(value)) {
const comparedFieldId = value._fieldId;
return defineFormConditional({
type: "object",
properties: {
[fieldId]: {
oneOf: [
{ type: "string", const: value },
{ type: "boolean", const: value }
],
const: value
}
type: ["string", "boolean"],
const: { $data: `1/${comparedFieldId}` }
},
[comparedFieldId]: { type: ["string", "boolean"] }
},
required: [fieldId]
}
},
required: ["$form"]
}),
required: [fieldId, comparedFieldId]
});
}
return defineFormConditional({
type: "object",
properties: {
[fieldId]: {
oneOf: [
{ type: "string", const: value },
{ type: "boolean", const: value }
],
const: value
}
},
required: [fieldId]
});
},
/**

@@ -184,42 +250,19 @@ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.

*/
isFalsy: () => defineConditional({
isFalsy: () => defineFormConditional({
type: "object",
properties: {
$form: {
type: "object",
properties: {
[fieldId]: {
anyOf: [
{ const: "undefined" },
{ const: false },
{ const: null },
{ const: "" }
]
}
},
[fieldId]: {
anyOf: [
{
required: [fieldId]
},
{
not: {
required: [fieldId]
}
}
{ const: "undefined" },
{ const: false },
{ const: null },
{ const: "" }
]
}
},
required: ["$form"]
}),
isUndefined: () => defineConditional({
type: "object",
properties: {
$form: {
type: "object",
properties: {
[fieldId]: {
type: "string",
enum: ["undefined"]
}
},
anyOf: [
{
required: [fieldId]
},
{
not: {

@@ -229,37 +272,36 @@ required: [fieldId]

}
]
}),
isUndefined: () => defineFormConditional({
type: "object",
properties: {
[fieldId]: {
type: "string",
enum: ["undefined"]
}
},
required: ["$form"]
not: {
required: [fieldId]
}
}),
inArray: (values) => defineConditional({
inArray: (values) => defineFormConditional({
type: "object",
properties: {
$form: {
type: "object",
properties: {
[fieldId]: {
type: "string",
enum: values
}
},
required: [fieldId]
[fieldId]: {
type: "string",
enum: values
}
},
required: ["$form"]
required: [fieldId]
}),
isValidEnglishName: () => defineConditional({
isValidEnglishName: () => defineFormConditional({
type: "object",
properties: {
$form: {
type: "object",
properties: {
[fieldId]: {
type: "string",
pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$",
description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
}
},
required: [fieldId]
[fieldId]: {
type: "string",
pattern: "^[\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*( [\\p{Script=Latin}0-9'._-]*(\\([\\p{Script=Latin}0-9'._-]+\\))?[\\p{Script=Latin}0-9'._-]*)*$",
description: "Name must contain only letters, numbers, and allowed special characters ('._-). No double spaces."
}
},
required: ["$form"]
required: [fieldId]
}),

@@ -271,36 +313,24 @@ /**

*/
matches: (pattern) => defineConditional({
matches: (pattern) => defineFormConditional({
type: "object",
properties: {
$form: {
type: "object",
properties: {
[fieldId]: {
type: "string",
pattern
}
},
required: [fieldId]
[fieldId]: {
type: "string",
pattern
}
},
required: ["$form"]
required: [fieldId]
}),
isBetween: (min, max) => defineConditional({
isBetween: (min, max) => defineFormConditional({
type: "object",
properties: {
$form: {
type: "object",
properties: {
[fieldId]: {
type: "number",
minimum: min,
maximum: max
}
},
required: [fieldId]
[fieldId]: {
type: "number",
minimum: min,
maximum: max
}
},
required: ["$form"]
required: [fieldId]
})
};
}
{
"name": "@opencrvs/toolkit",
"version": "1.8.0-rc.0547c64",
"version": "1.8.0-rc.05859a0",
"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

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display