New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@opencrvs/toolkit

Package Overview
Dependencies
Maintainers
0
Versions
939
Alerts
File Explorer

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.863262b

dist/commons/events/CompositeFieldValue.d.ts

4

dist/commons/conditionals/conditionals.d.ts
import { EventDocument } from '../events/EventDocument';
import { ActionFormData } from '../events/ActionDocument';
import { EventState } from '../events/ActionDocument';
import { ITokenPayload as TokenPayload, Scope } from '../authentication';

@@ -21,3 +21,3 @@ import { ActionType } from '../events/ActionType';

$now: string;
$form: ActionFormData | Record<string, any>;
$form: EventState | Record<string, any>;
};

@@ -24,0 +24,0 @@ export type ConditionalParameters = UserConditionalParameters | EventConditionalParameters | FormConditionalParameters;

import { ConditionalParameters, JSONSchema } from './conditionals';
import { ActionFormData } from '../events/ActionDocument';
import { EventState, ActionUpdate } from '../events/ActionDocument';
import { FieldConfig } from '../events/FieldConfig';
import { FieldValue } from '../events/FieldValue';
import { FieldUpdateValue } from '../events/FieldValue';
import { TranslationConfig } from '../events/TranslationConfig';
export declare function validate(schema: JSONSchema, data: ConditionalParameters): boolean;
export declare function isFieldVisible(field: FieldConfig, form: ActionFormData): boolean;
export declare function isFieldEnabled(field: FieldConfig, form: ActionFormData): boolean;
export declare function isFieldVisible(field: FieldConfig, form: ActionUpdate | EventState): boolean;
export declare function isFieldEnabled(field: FieldConfig, form: ActionUpdate | EventState): boolean;
/**

@@ -26,3 +26,3 @@ * Custom error map for Zod to override the default error messages in intl-formik format.

field: FieldConfig;
values: ActionFormData;
values: ActionUpdate;
}): {

@@ -44,3 +44,3 @@ errors: {

field: FieldConfig;
value: FieldValue;
value: FieldUpdateValue;
}): {

@@ -47,0 +47,0 @@ message: TranslationConfig;

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

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

@@ -40,3 +40,3 @@ originalFilename: z.ZodString;

originalFilename: string;
}>, "many">, z.ZodBoolean, z.ZodNumber, z.ZodObject<z.objectUtil.extendShape<{
}>, "many">, z.ZodObject<z.objectUtil.extendShape<{
country: z.ZodString;

@@ -47,7 +47,7 @@ province: z.ZodString;

urbanOrRural: z.ZodLiteral<"URBAN">;
town: z.ZodOptional<z.ZodString>;
residentialArea: z.ZodOptional<z.ZodString>;
street: z.ZodOptional<z.ZodString>;
number: z.ZodOptional<z.ZodString>;
zipCode: z.ZodOptional<z.ZodString>;
town: z.ZodOptional<z.ZodNullable<z.ZodString>>;
residentialArea: z.ZodOptional<z.ZodNullable<z.ZodString>>;
street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
zipCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {

@@ -58,7 +58,7 @@ country: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
}, {

@@ -69,7 +69,7 @@ country: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{

@@ -81,3 +81,3 @@ country: z.ZodString;

urbanOrRural: z.ZodLiteral<"RURAL">;
village: z.ZodOptional<z.ZodString>;
village: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {

@@ -88,3 +88,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
}, {

@@ -95,5 +95,5 @@ country: string;

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

@@ -125,3 +125,3 @@ originalFilename: z.ZodString;

originalFilename: string;
}>, "many">, z.ZodBoolean, z.ZodNumber, z.ZodObject<z.objectUtil.extendShape<{
}>, "many">, z.ZodObject<z.objectUtil.extendShape<{
country: z.ZodString;

@@ -132,7 +132,7 @@ province: z.ZodString;

urbanOrRural: z.ZodLiteral<"URBAN">;
town: z.ZodOptional<z.ZodString>;
residentialArea: z.ZodOptional<z.ZodString>;
street: z.ZodOptional<z.ZodString>;
number: z.ZodOptional<z.ZodString>;
zipCode: z.ZodOptional<z.ZodString>;
town: z.ZodOptional<z.ZodNullable<z.ZodString>>;
residentialArea: z.ZodOptional<z.ZodNullable<z.ZodString>>;
street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
zipCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {

@@ -143,7 +143,7 @@ country: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
}, {

@@ -154,7 +154,7 @@ country: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{

@@ -166,3 +166,3 @@ country: z.ZodString;

urbanOrRural: z.ZodLiteral<"RURAL">;
village: z.ZodOptional<z.ZodString>;
village: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {

@@ -173,3 +173,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
}, {

@@ -180,3 +180,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
}>]>>>;

@@ -197,7 +197,7 @@ createdAtLocation: z.ZodString;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -208,3 +208,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -228,7 +228,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -239,3 +239,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -258,7 +258,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -269,3 +269,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -289,7 +289,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -300,3 +300,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -325,7 +325,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -336,3 +336,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -356,7 +356,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -367,3 +367,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -392,7 +392,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -403,3 +403,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -423,7 +423,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -434,3 +434,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -448,3 +448,3 @@ type: string;

incomplete: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
data: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodObject<{
data: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
filename: z.ZodString;

@@ -476,3 +476,3 @@ originalFilename: z.ZodString;

originalFilename: string;
}>, "many">, z.ZodBoolean, z.ZodNumber, z.ZodObject<z.objectUtil.extendShape<{
}>, "many">, z.ZodObject<z.objectUtil.extendShape<{
country: z.ZodString;

@@ -483,7 +483,7 @@ province: z.ZodString;

urbanOrRural: z.ZodLiteral<"URBAN">;
town: z.ZodOptional<z.ZodString>;
residentialArea: z.ZodOptional<z.ZodString>;
street: z.ZodOptional<z.ZodString>;
number: z.ZodOptional<z.ZodString>;
zipCode: z.ZodOptional<z.ZodString>;
town: z.ZodOptional<z.ZodNullable<z.ZodString>>;
residentialArea: z.ZodOptional<z.ZodNullable<z.ZodString>>;
street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
zipCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {

@@ -494,7 +494,7 @@ country: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
}, {

@@ -505,7 +505,7 @@ country: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{

@@ -517,3 +517,3 @@ country: z.ZodString;

urbanOrRural: z.ZodLiteral<"RURAL">;
village: z.ZodOptional<z.ZodString>;
village: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {

@@ -524,3 +524,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
}, {

@@ -531,5 +531,5 @@ country: string;

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

@@ -561,3 +561,3 @@ originalFilename: z.ZodString;

originalFilename: string;
}>, "many">, z.ZodBoolean, z.ZodNumber, z.ZodObject<z.objectUtil.extendShape<{
}>, "many">, z.ZodObject<z.objectUtil.extendShape<{
country: z.ZodString;

@@ -568,7 +568,7 @@ province: z.ZodString;

urbanOrRural: z.ZodLiteral<"URBAN">;
town: z.ZodOptional<z.ZodString>;
residentialArea: z.ZodOptional<z.ZodString>;
street: z.ZodOptional<z.ZodString>;
number: z.ZodOptional<z.ZodString>;
zipCode: z.ZodOptional<z.ZodString>;
town: z.ZodOptional<z.ZodNullable<z.ZodString>>;
residentialArea: z.ZodOptional<z.ZodNullable<z.ZodString>>;
street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
zipCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {

@@ -579,7 +579,7 @@ country: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
}, {

@@ -590,7 +590,7 @@ country: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{

@@ -602,3 +602,3 @@ country: z.ZodString;

urbanOrRural: z.ZodLiteral<"RURAL">;
village: z.ZodOptional<z.ZodString>;
village: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {

@@ -609,3 +609,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
}, {

@@ -616,3 +616,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
}>]>>>;

@@ -632,7 +632,7 @@ }, {

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -643,3 +643,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -663,7 +663,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -674,3 +674,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -693,7 +693,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -704,3 +704,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -723,7 +723,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -734,3 +734,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -737,0 +737,0 @@ type: string;

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

modifiedAt: z.ZodString;
assignedTo: z.ZodNullable<z.ZodString>;
assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
updatedBy: z.ZodString;

@@ -33,6 +33,6 @@ trackingId: z.ZodString;

createdAtLocation: string;
assignedTo: string | null;
trackingId: string;
modifiedAt: string;
updatedBy: string;
assignedTo?: string | null | undefined;
}, {

@@ -46,6 +46,6 @@ type: string;

createdAtLocation: string;
assignedTo: string | null;
trackingId: string;
modifiedAt: string;
updatedBy: string;
assignedTo?: string | null | undefined;
}>;

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

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

modifiedAt: z.ZodString;
assignedTo: z.ZodNullable<z.ZodString>;
assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
updatedBy: z.ZodString;

@@ -61,6 +61,6 @@ trackingId: z.ZodString;

createdAtLocation: string;
assignedTo: string | null;
trackingId: string;
modifiedAt: string;
updatedBy: string;
assignedTo?: string | null | undefined;
}, {

@@ -73,6 +73,6 @@ type: string;

createdAtLocation: string;
assignedTo: string | null;
trackingId: string;
modifiedAt: string;
updatedBy: string;
assignedTo?: string | null | undefined;
}>;

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

import { z } from 'zod';
import { AddressField, AdministrativeArea, BulletList, Checkbox, Country, DateField, Divider, Facility, EmailField, FieldConfig, File, FileUploadWithOptions, Location, Office, PageHeader, Paragraph, RadioGroup, SelectField, SignatureField, TextAreaField, TextField, NumberField } from './FieldConfig';
import { FieldType } from './FieldType';
import { AddressFieldValue, FieldValue, FieldValueSchema, FileFieldValue, FileFieldWithOptionValue, OptionalFieldValueSchema } from './FieldValue';
import { FieldValue, FieldUpdateValueSchema } from './FieldValue';
import { AddressFieldValue, FileFieldValue, FileFieldWithOptionValue } from './CompositeFieldValue';
/**

@@ -12,6 +13,11 @@ * FieldTypeMapping.ts should include functions that map field types to different formats dynamically.

/**
* Optionality of a field is defined in FieldConfig, not in FieldValue.
* Allows for nullishness of a field value during validations based on FieldConfig.
*/
type NullishFieldValueSchema = z.ZodOptional<z.ZodNullable<FieldUpdateValueSchema>>;
/**
* Mapping of field types to Zod schema.
* Useful for building dynamic validations against FieldConfig
*/
export declare function mapFieldTypeToZod(type: FieldType, required?: boolean): z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodObject<{
export declare function mapFieldTypeToZod(type: FieldType, required?: boolean): z.ZodString | z.ZodOptional<z.ZodNullable<z.ZodString>> | z.ZodObject<{
filename: z.ZodString;

@@ -28,3 +34,15 @@ originalFilename: z.ZodString;

originalFilename: string;
}>> | z.ZodOptional<z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
}> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
filename: z.ZodString;
originalFilename: z.ZodString;
type: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: string;
filename: string;
originalFilename: string;
}, {
type: string;
filename: string;
originalFilename: string;
}>>> | z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
country: z.ZodString;

@@ -35,7 +53,7 @@ province: z.ZodString;

urbanOrRural: z.ZodLiteral<"URBAN">;
town: z.ZodOptional<z.ZodString>;
residentialArea: z.ZodOptional<z.ZodString>;
street: z.ZodOptional<z.ZodString>;
number: z.ZodOptional<z.ZodString>;
zipCode: z.ZodOptional<z.ZodString>;
town: z.ZodOptional<z.ZodNullable<z.ZodString>>;
residentialArea: z.ZodOptional<z.ZodNullable<z.ZodString>>;
street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
zipCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {

@@ -46,7 +64,7 @@ country: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
}, {

@@ -57,7 +75,7 @@ country: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{

@@ -69,3 +87,3 @@ country: z.ZodString;

urbanOrRural: z.ZodLiteral<"RURAL">;
village: z.ZodOptional<z.ZodString>;
village: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {

@@ -76,3 +94,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
}, {

@@ -83,4 +101,4 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
}>]>> | z.ZodOptional<z.ZodArray<z.ZodObject<{
village?: string | null | undefined;
}>]> | z.ZodArray<z.ZodObject<{
filename: z.ZodString;

@@ -100,4 +118,69 @@ originalFilename: z.ZodString;

originalFilename: string;
}>, "many">> | z.ZodOptional<z.ZodBoolean> | z.ZodOptional<z.ZodNumber> | FieldValueSchema;
export declare function createValidationSchema(config: FieldConfig[]): z.ZodObject<Record<string, FieldValueSchema | OptionalFieldValueSchema>, "strip", z.ZodTypeAny, {
}>, "many"> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
filename: z.ZodString;
originalFilename: z.ZodString;
type: z.ZodString;
option: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: string;
option: string;
filename: string;
originalFilename: string;
}, {
type: string;
option: string;
filename: string;
originalFilename: string;
}>, "many">>> | z.ZodBoolean | z.ZodOptional<z.ZodNullable<z.ZodBoolean>> | z.ZodNumber | z.ZodOptional<z.ZodNullable<z.ZodNumber>> | z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
country: z.ZodString;
province: z.ZodString;
district: z.ZodString;
}, {
urbanOrRural: z.ZodLiteral<"URBAN">;
town: z.ZodOptional<z.ZodNullable<z.ZodString>>;
residentialArea: z.ZodOptional<z.ZodNullable<z.ZodString>>;
street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
zipCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {
country: string;
district: string;
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;
province: string;
urbanOrRural: "URBAN";
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{
country: z.ZodString;
province: z.ZodString;
district: z.ZodString;
}, {
urbanOrRural: z.ZodLiteral<"RURAL">;
village: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {
country: string;
district: string;
province: string;
urbanOrRural: "RURAL";
village?: string | null | undefined;
}, {
country: string;
district: string;
province: string;
urbanOrRural: "RURAL";
village?: string | null | undefined;
}>]>>>;
export declare function createValidationSchema(config: FieldConfig[]): z.ZodObject<Record<string, FieldUpdateValueSchema | NullishFieldValueSchema>, "strip", z.ZodTypeAny, {
[x: string]: string | number | boolean | {

@@ -112,7 +195,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -123,3 +206,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -130,3 +213,3 @@ type: string;

originalFilename: string;
}[] | undefined;
}[] | null | undefined;
}, {

@@ -142,7 +225,7 @@ [x: string]: string | number | boolean | {

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -153,3 +236,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -160,3 +243,3 @@ type: string;

originalFilename: string;
}[] | undefined;
}[] | null | undefined;
}>;

@@ -340,2 +423,3 @@ /**

};
export {};
//# sourceMappingURL=FieldTypeMapping.d.ts.map
import { z } from 'zod';
import { AddressFieldValue, AddressFieldUpdateValue, FileFieldValue, FileFieldWithOptionValue } from './CompositeFieldValue';
/**
* FieldValues defined in this file are primitive field values.
* FieldValues defined in CompositeFieldValue.ts are composed of multiple primitive field values (Address, File etc).
*
* FieldValue is a union of primitive and composite field values.
* FieldValue can never be null.
*
* FieldUpdateValue accepts null values for primitive field values when they are optional.
* API is build assuming partial (PATCH) updates. In order to edit and remove optional value, we need to accept null values.
* Omitting a field value in partial updates leaves it untouched.
*
*/
export declare const TextValue: z.ZodString;

@@ -6,3 +19,7 @@ export declare const RequiredTextValue: z.ZodString;

export declare const EmailValue: z.ZodString;
export declare const FileFieldValue: z.ZodObject<{
export declare const CheckboxFieldValue: z.ZodBoolean;
export type CheckboxFieldValue = z.infer<typeof CheckboxFieldValue>;
export declare const NumberFieldValue: z.ZodNumber;
export type NumberFieldValue = z.infer<typeof NumberFieldValue>;
export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
filename: z.ZodString;

@@ -19,5 +36,18 @@ originalFilename: z.ZodString;

originalFilename: string;
}>;
export type FileFieldValue = z.infer<typeof FileFieldValue>;
export declare const AddressFieldValue: z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
}>, z.ZodArray<z.ZodObject<{
filename: z.ZodString;
originalFilename: z.ZodString;
type: z.ZodString;
option: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: string;
option: string;
filename: string;
originalFilename: string;
}, {
type: string;
option: string;
filename: string;
originalFilename: string;
}>, "many">, z.ZodObject<z.objectUtil.extendShape<{
country: z.ZodString;

@@ -73,11 +103,9 @@ province: z.ZodString;

}>]>;
export type AddressFieldValue = z.infer<typeof AddressFieldValue>;
export declare const FileFieldValueWithOption: z.ZodObject<{
export type FieldValue = z.infer<typeof FieldValue>;
export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
filename: z.ZodString;
originalFilename: z.ZodString;
type: z.ZodString;
option: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: string;
option: string;
filename: string;

@@ -87,40 +115,4 @@ originalFilename: string;

type: string;
option: string;
filename: string;
originalFilename: string;
}>;
export type FileFieldValueWithOption = z.infer<typeof FileFieldValueWithOption>;
export declare const FileFieldWithOptionValue: z.ZodArray<z.ZodObject<{
filename: z.ZodString;
originalFilename: z.ZodString;
type: z.ZodString;
option: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: string;
option: string;
filename: string;
originalFilename: string;
}, {
type: string;
option: string;
filename: string;
originalFilename: string;
}>, "many">;
export type FileFieldWithOptionValue = z.infer<typeof FileFieldWithOptionValue>;
export declare const CheckboxFieldValue: z.ZodBoolean;
export type CheckboxFieldValue = z.infer<typeof CheckboxFieldValue>;
export declare const NumberFieldValue: z.ZodNumber;
export type NumberFieldValue = z.infer<typeof NumberFieldValue>;
export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodObject<{
filename: z.ZodString;
originalFilename: z.ZodString;
type: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: string;
filename: string;
originalFilename: string;
}, {
type: string;
filename: string;
originalFilename: string;
}>, z.ZodArray<z.ZodObject<{

@@ -141,3 +133,3 @@ filename: z.ZodString;

originalFilename: string;
}>, "many">, z.ZodBoolean, z.ZodNumber, z.ZodObject<z.objectUtil.extendShape<{
}>, "many">, z.ZodObject<z.objectUtil.extendShape<{
country: z.ZodString;

@@ -148,7 +140,7 @@ province: z.ZodString;

urbanOrRural: z.ZodLiteral<"URBAN">;
town: z.ZodOptional<z.ZodString>;
residentialArea: z.ZodOptional<z.ZodString>;
street: z.ZodOptional<z.ZodString>;
number: z.ZodOptional<z.ZodString>;
zipCode: z.ZodOptional<z.ZodString>;
town: z.ZodOptional<z.ZodNullable<z.ZodString>>;
residentialArea: z.ZodOptional<z.ZodNullable<z.ZodString>>;
street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
zipCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {

@@ -159,7 +151,7 @@ country: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
}, {

@@ -170,7 +162,7 @@ country: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{

@@ -182,3 +174,3 @@ country: z.ZodString;

urbanOrRural: z.ZodLiteral<"RURAL">;
village: z.ZodOptional<z.ZodString>;
village: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}>, "strip", z.ZodTypeAny, {

@@ -189,3 +181,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
}, {

@@ -196,5 +188,5 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
}>]>;
export type FieldValue = z.infer<typeof FieldValue>;
export type FieldUpdateValue = z.infer<typeof FieldUpdateValue>;
/**

@@ -204,3 +196,8 @@ * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.

export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | z.ZodString | z.ZodBoolean;
export type OptionalFieldValueSchema = z.ZodOptional<FieldValueSchema>;
/**
* NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
*
* FieldValueInputSchema uses Input types which have set optional values as nullish
* */
export type FieldUpdateValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | z.ZodString | z.ZodBoolean;
//# sourceMappingURL=FieldValue.d.ts.map

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

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

@@ -20,0 +21,0 @@ export * from './utils';

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

import { ActionDocument } from './ActionDocument';
import { ArchivedActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, ValidateActionInput } from './ActionInput';

@@ -82,7 +83,7 @@ import { ActionType } from './ActionType';

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -93,3 +94,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -113,7 +114,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -124,3 +125,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -147,7 +148,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -158,3 +159,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -180,7 +181,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -191,3 +192,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -214,7 +215,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -225,3 +226,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -251,7 +252,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -262,3 +263,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -285,7 +286,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -296,3 +297,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -318,7 +319,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -329,3 +330,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -352,7 +353,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -363,3 +364,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -386,7 +387,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -397,3 +398,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -420,7 +421,7 @@ type: string;

urbanOrRural: "URBAN";
number?: string | undefined;
town?: string | undefined;
residentialArea?: string | undefined;
street?: string | undefined;
zipCode?: string | undefined;
number?: string | null | undefined;
town?: string | null | undefined;
residentialArea?: string | null | undefined;
street?: string | null | undefined;
zipCode?: string | null | undefined;
} | {

@@ -431,3 +432,3 @@ country: string;

urbanOrRural: "RURAL";
village?: string | undefined;
village?: string | null | undefined;
} | {

@@ -445,2 +446,7 @@ type: string;

};
export declare function generateActionDocument({ configuration, action, defaults }: {
configuration: EventConfig;
action: ActionType;
defaults?: Partial<ActionDocument>;
}): ActionDocument;
export declare function generateEventDocument({ configuration, actions }: {

@@ -447,0 +453,0 @@ configuration: EventConfig;

@@ -8,3 +8,3 @@ import { TranslationConfig } from './TranslationConfig';

import { WorkqueueConfig } from './WorkqueueConfig';
import { ActionFormData } from './ActionDocument';
import { EventState } from './ActionDocument';
import { FormConfig } from './FormConfig';

@@ -84,4 +84,3 @@ /**

export declare function getEventConfiguration(eventConfigurations: EventConfig[], type: string): EventConfig;
export declare function isOptionalUncheckedCheckbox(field: FieldConfig, form: ActionFormData): boolean;
export declare function stripHiddenFields(fields: FieldConfig[], data: ActionFormData): import("lodash").Dictionary<string | number | boolean | {
export declare function stripHiddenFields(fields: FieldConfig[], data: EventState): import("lodash").Dictionary<string | number | boolean | {
type: string;

@@ -88,0 +87,0 @@ filename: string;

{
"name": "@opencrvs/toolkit",
"version": "1.8.0-rc.848813a",
"version": "1.8.0-rc.863262b",
"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