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
40
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 0.0.5 to 0.0.6-events

dist/conditionals/conditionals.d.ts

1138

dist/events/FieldConfig.d.ts
import { z } from 'zod';
export declare const FieldConfig: z.ZodDiscriminatedUnion<"type", [z.ZodObject<z.objectUtil.extendShape<{
declare const BaseField: z.ZodObject<{
id: z.ZodString;
required: z.ZodBoolean;
conditionals: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"SHOW">;
conditional: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
}, "strip", z.ZodTypeAny, {
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
}, {
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
}>, z.ZodObject<{
type: z.ZodLiteral<"ENABLE">;
conditional: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
}, "strip", z.ZodTypeAny, {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
}, {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
}>]>, "many">>>;
initialValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
dependsOn: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
expression: z.ZodString;
}, "strip", z.ZodTypeAny, {
dependsOn: string[];
expression: string;
}, {
expression: string;
dependsOn?: string[] | undefined;
}>]>>;
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
disabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
placeholder: z.ZodOptional<z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>>;
validation: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
validator: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
message: z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>;
}, "strip", z.ZodTypeAny, {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}, {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}>, "many">>>;
dependsOn: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
label: z.ZodObject<{

@@ -11,46 +85,288 @@ id: z.ZodString;

id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>;
}, "strip", z.ZodTypeAny, {
id: string;
label: {
id: string;
defaultMessage: string;
description: string;
};
conditionals: ({
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
} | {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
})[];
validation?: {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}[] | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
initialValue?: string | {
dependsOn: string[];
expression: string;
} | undefined;
disabled?: boolean | undefined;
placeholder?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
}, {
id: string;
label: {
id: string;
defaultMessage: string;
description: string;
};
validation?: {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}[] | undefined;
required?: boolean | undefined;
conditionals?: ({
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
} | {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
})[] | undefined;
dependsOn?: string[] | undefined;
initialValue?: string | {
expression: string;
dependsOn?: string[] | undefined;
} | undefined;
disabled?: boolean | undefined;
placeholder?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
}>;
export type BaseField = z.infer<typeof BaseField>;
export declare const FieldConfig: z.ZodDiscriminatedUnion<"type", [z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
conditionals: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"SHOW">;
conditional: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
}, "strip", z.ZodTypeAny, {
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
}, {
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
}>, z.ZodObject<{
type: z.ZodLiteral<"ENABLE">;
conditional: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
}, "strip", z.ZodTypeAny, {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
}, {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
}>]>, "many">>>;
initialValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
dependsOn: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
expression: z.ZodString;
}, "strip", z.ZodTypeAny, {
dependsOn: string[];
expression: string;
}, {
expression: string;
dependsOn?: string[] | undefined;
}>]>>;
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
disabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
placeholder: z.ZodOptional<z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>>;
validation: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
validator: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
message: z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>;
}, "strip", z.ZodTypeAny, {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}, {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}>, "many">>>;
dependsOn: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
label: z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>;
}, {
type: z.ZodLiteral<"TEXT">;
options: z.ZodOptional<z.ZodObject<{
maxLength: z.ZodNumber;
options: z.ZodOptional<z.ZodDefault<z.ZodObject<{
maxLength: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
maxLength: number;
maxLength?: number | undefined;
}, {
maxLength: number;
}>>;
maxLength?: number | undefined;
}>>>;
}>, "strip", z.ZodTypeAny, {
id: string;
type: "TEXT";
id: string;
required: boolean;
label: {
id: string;
defaultMessage: string;
description: string;
defaultMessage: string;
};
conditionals: ({
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
} | {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
})[];
options?: {
maxLength: number;
maxLength?: number | undefined;
} | undefined;
validation?: {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}[] | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
initialValue?: string | {
dependsOn: string[];
expression: string;
} | undefined;
disabled?: boolean | undefined;
placeholder?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
}, {
id: string;
type: "TEXT";
id: string;
required: boolean;
label: {
id: string;
defaultMessage: string;
description: string;
defaultMessage: string;
};
options?: {
maxLength: number;
maxLength?: number | undefined;
} | undefined;
validation?: {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}[] | undefined;
required?: boolean | undefined;
conditionals?: ({
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
} | {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
})[] | undefined;
dependsOn?: string[] | undefined;
initialValue?: string | {
expression: string;
dependsOn?: string[] | undefined;
} | undefined;
disabled?: boolean | undefined;
placeholder?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
required: z.ZodBoolean;
label: z.ZodObject<{
conditionals: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"SHOW">;
conditional: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
}, "strip", z.ZodTypeAny, {
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
}, {
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
}>, z.ZodObject<{
type: z.ZodLiteral<"ENABLE">;
conditional: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
}, "strip", z.ZodTypeAny, {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
}, {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
}>]>, "many">>>;
initialValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
dependsOn: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
expression: z.ZodString;
}, "strip", z.ZodTypeAny, {
dependsOn: string[];
expression: string;
}, {
expression: string;
dependsOn?: string[] | undefined;
}>]>>;
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
disabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
placeholder: z.ZodOptional<z.ZodObject<{
id: z.ZodString;

@@ -61,8 +377,52 @@ defaultMessage: z.ZodString;

id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>>;
validation: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
validator: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
message: z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>;
}, "strip", z.ZodTypeAny, {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}, {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}>, "many">>>;
dependsOn: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
label: z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>;

@@ -72,3 +432,3 @@ }, {

options: z.ZodOptional<z.ZodObject<{
notice: z.ZodObject<{
notice: z.ZodOptional<z.ZodObject<{
id: z.ZodString;

@@ -79,58 +439,657 @@ defaultMessage: z.ZodString;

id: string;
defaultMessage: string;
description: string;
defaultMessage: string;
}, {
id: string;
defaultMessage: string;
description: string;
defaultMessage: string;
}>;
}>>;
}, "strip", z.ZodTypeAny, {
notice: {
notice?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
}, {
notice?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
}>>;
}>, "strip", z.ZodTypeAny, {
id: string;
type: "DATE";
label: {
id: string;
defaultMessage: string;
description: string;
};
conditionals: ({
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
} | {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
})[];
options?: {
notice?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
} | undefined;
validation?: {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}[] | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
initialValue?: string | {
dependsOn: string[];
expression: string;
} | undefined;
disabled?: boolean | undefined;
placeholder?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
}, {
id: string;
type: "DATE";
label: {
id: string;
defaultMessage: string;
description: string;
};
options?: {
notice?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
} | undefined;
validation?: {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}[] | undefined;
required?: boolean | undefined;
conditionals?: ({
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
} | {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
})[] | undefined;
dependsOn?: string[] | undefined;
initialValue?: string | {
expression: string;
dependsOn?: string[] | undefined;
} | undefined;
disabled?: boolean | undefined;
placeholder?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
conditionals: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"SHOW">;
conditional: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
}, "strip", z.ZodTypeAny, {
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
}, {
notice: {
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
}>, z.ZodObject<{
type: z.ZodLiteral<"ENABLE">;
conditional: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
}, "strip", z.ZodTypeAny, {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
}, {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
}>]>, "many">>>;
initialValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
dependsOn: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
expression: z.ZodString;
}, "strip", z.ZodTypeAny, {
dependsOn: string[];
expression: string;
}, {
expression: string;
dependsOn?: string[] | undefined;
}>]>>;
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
disabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
placeholder: z.ZodOptional<z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>>;
validation: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
validator: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
message: z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>;
}, "strip", z.ZodTypeAny, {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}, {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}>, "many">>>;
dependsOn: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
label: z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>;
}, {
type: z.ZodLiteral<"PARAGRAPH">;
options: z.ZodDefault<z.ZodObject<{
fontVariant: z.ZodOptional<z.ZodLiteral<"reg16">>;
}, "strip", z.ZodTypeAny, {
fontVariant?: "reg16" | undefined;
}, {
fontVariant?: "reg16" | undefined;
}>>;
}>, "strip", z.ZodTypeAny, {
type: "DATE";
id: string;
required: boolean;
options: {
fontVariant?: "reg16" | undefined;
};
type: "PARAGRAPH";
label: {
id: string;
defaultMessage: string;
description: string;
};
conditionals: ({
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
} | {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
})[];
validation?: {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}[] | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
initialValue?: string | {
dependsOn: string[];
expression: string;
} | undefined;
disabled?: boolean | undefined;
placeholder?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
}, {
id: string;
type: "PARAGRAPH";
label: {
id: string;
defaultMessage: string;
description: string;
};
options?: {
notice: {
fontVariant?: "reg16" | undefined;
} | undefined;
validation?: {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}[] | undefined;
required?: boolean | undefined;
conditionals?: ({
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
} | {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
})[] | undefined;
dependsOn?: string[] | undefined;
initialValue?: string | {
expression: string;
dependsOn?: string[] | undefined;
} | undefined;
disabled?: boolean | undefined;
placeholder?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
conditionals: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"SHOW">;
conditional: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
}, "strip", z.ZodTypeAny, {
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
}, {
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
}>, z.ZodObject<{
type: z.ZodLiteral<"ENABLE">;
conditional: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
}, "strip", z.ZodTypeAny, {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
}, {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
}>]>, "many">>>;
initialValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
dependsOn: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
expression: z.ZodString;
}, "strip", z.ZodTypeAny, {
dependsOn: string[];
expression: string;
}, {
expression: string;
dependsOn?: string[] | undefined;
}>]>>;
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
disabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
placeholder: z.ZodOptional<z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>>;
validation: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
validator: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
message: z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>;
}, "strip", z.ZodTypeAny, {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}, {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}>, "many">>>;
dependsOn: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
label: z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>;
}, {
type: z.ZodLiteral<"RADIO_GROUP">;
options: z.ZodArray<z.ZodObject<{
value: z.ZodString;
label: z.ZodString;
}, "strip", z.ZodTypeAny, {
value: string;
label: string;
}, {
value: string;
label: string;
}>, "many">;
}>, "strip", z.ZodTypeAny, {
id: string;
options: {
value: string;
label: string;
}[];
type: "RADIO_GROUP";
label: {
id: string;
defaultMessage: string;
description: string;
};
conditionals: ({
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
} | {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
})[];
validation?: {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}[] | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
initialValue?: string | {
dependsOn: string[];
expression: string;
} | undefined;
disabled?: boolean | undefined;
placeholder?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
}, {
type: "DATE";
id: string;
required: boolean;
options: {
value: string;
label: string;
}[];
type: "RADIO_GROUP";
label: {
id: string;
defaultMessage: string;
description: string;
};
validation?: {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}[] | undefined;
required?: boolean | undefined;
conditionals?: ({
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
} | {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
})[] | undefined;
dependsOn?: string[] | undefined;
initialValue?: string | {
expression: string;
dependsOn?: string[] | undefined;
} | undefined;
disabled?: boolean | undefined;
placeholder?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
conditionals: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"SHOW">;
conditional: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
}, "strip", z.ZodTypeAny, {
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
}, {
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
}>, z.ZodObject<{
type: z.ZodLiteral<"ENABLE">;
conditional: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
}, "strip", z.ZodTypeAny, {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
}, {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
}>]>, "many">>>;
initialValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
dependsOn: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
expression: z.ZodString;
}, "strip", z.ZodTypeAny, {
dependsOn: string[];
expression: string;
}, {
expression: string;
dependsOn?: string[] | undefined;
}>]>>;
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
disabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
placeholder: z.ZodOptional<z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>>;
validation: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
validator: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
message: z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>;
}, "strip", z.ZodTypeAny, {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}, {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}>, "many">>>;
dependsOn: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
label: z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>;
}, {
type: z.ZodLiteral<"HIDDEN">;
}>, "strip", z.ZodTypeAny, {
id: string;
type: "HIDDEN";
label: {
id: string;
defaultMessage: string;
description: string;
};
options?: {
notice: {
conditionals: ({
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
} | {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
})[];
validation?: {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}[] | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
initialValue?: string | {
dependsOn: string[];
expression: string;
} | undefined;
disabled?: boolean | undefined;
placeholder?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
}, {
id: string;
type: "HIDDEN";
label: {
id: string;
defaultMessage: string;
description: string;
};
validation?: {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}[] | undefined;
required?: boolean | undefined;
conditionals?: ({
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
} | {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
})[] | undefined;
dependsOn?: string[] | undefined;
initialValue?: string | {
expression: string;
dependsOn?: string[] | undefined;
} | undefined;
disabled?: boolean | undefined;
placeholder?: {
id: string;
defaultMessage: string;
description: string;
} | undefined;
}>, z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
required: z.ZodBoolean;
label: z.ZodObject<{
conditionals: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"SHOW">;
conditional: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
}, "strip", z.ZodTypeAny, {
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
}, {
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
}>, z.ZodObject<{
type: z.ZodLiteral<"ENABLE">;
conditional: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
}, "strip", z.ZodTypeAny, {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
}, {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
}>]>, "many">>>;
initialValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
dependsOn: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
expression: z.ZodString;
}, "strip", z.ZodTypeAny, {
dependsOn: string[];
expression: string;
}, {
expression: string;
dependsOn?: string[] | undefined;
}>]>>;
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
disabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
placeholder: z.ZodOptional<z.ZodObject<{
id: z.ZodString;

@@ -141,31 +1100,132 @@ defaultMessage: z.ZodString;

id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>>;
validation: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
validator: z.ZodType<import("../conditionals/conditionals").JSONSchema, z.ZodTypeDef, import("../conditionals/conditionals").JSONSchema>;
message: z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>;
}, "strip", z.ZodTypeAny, {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}, {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}>, "many">>>;
dependsOn: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
label: z.ZodObject<{
id: z.ZodString;
defaultMessage: z.ZodString;
description: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
defaultMessage: string;
description: string;
}, {
id: string;
defaultMessage: string;
description: string;
}>;
}, {
type: z.ZodLiteral<"PARAGRAPH">;
type: z.ZodLiteral<"FILE">;
}>, "strip", z.ZodTypeAny, {
type: "PARAGRAPH";
id: string;
required: boolean;
type: "FILE";
label: {
id: string;
defaultMessage: string;
description: string;
};
conditionals: ({
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
} | {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
})[];
validation?: {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}[] | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
initialValue?: string | {
dependsOn: string[];
expression: string;
} | undefined;
disabled?: boolean | undefined;
placeholder?: {
id: string;
defaultMessage: string;
};
description: string;
} | undefined;
}, {
type: "PARAGRAPH";
id: string;
required: boolean;
type: "FILE";
label: {
id: string;
defaultMessage: string;
description: string;
};
validation?: {
message: {
id: string;
defaultMessage: string;
description: string;
};
validator: import("../conditionals/conditionals").JSONSchema;
}[] | undefined;
required?: boolean | undefined;
conditionals?: ({
type: "SHOW";
conditional: import("../conditionals/conditionals").JSONSchema;
} | {
type: "ENABLE";
conditional: import("../conditionals/conditionals").JSONSchema;
})[] | undefined;
dependsOn?: string[] | undefined;
initialValue?: string | {
expression: string;
dependsOn?: string[] | undefined;
} | undefined;
disabled?: boolean | undefined;
placeholder?: {
id: string;
defaultMessage: string;
};
description: string;
} | undefined;
}>]>;
export type FieldConfig = z.infer<typeof FieldConfig>;
export type FieldType = FieldConfig['type'];
export type FieldProps<T extends FieldType> = Extract<FieldConfig, {
type: T;
}>;
export {};
//# sourceMappingURL=FieldConfig.d.ts.map

@@ -5,2 +5,12 @@ export * from './ActionConfig';

export * from './FormConfig';
export * from './SummaryConfig';
export * from './WorkqueueConfig';
export * from './EventMetadata';
export * from './EventInput';
export * from './EventDocument';
export * from './ActionInput';
export * from './ActionDocument';
export * from './EventIndex';
export * from './TranslationConfig';
export * from './state';
//# sourceMappingURL=index.d.ts.map

@@ -25,7 +25,28 @@ "use strict";

ActionConfigBase: () => ActionConfigBase,
ActionDocument: () => ActionDocument,
ActionInput: () => ActionInput,
ActionType: () => ActionType,
DeclareActionInput: () => DeclareActionInput,
DraftActionInput: () => DraftActionInput,
EventConfig: () => EventConfig,
EventDocument: () => EventDocument,
EventIndex: () => EventIndex,
EventIndices: () => EventIndices,
EventInput: () => EventInput,
EventMetadata: () => EventMetadata,
EventStatus: () => EventStatus,
EventStatuses: () => EventStatuses,
FieldConfig: () => FieldConfig,
FormConfig: () => FormConfig,
defineConfig: () => defineConfig
NotifyActionInput: () => NotifyActionInput,
RegisterActionInput: () => RegisterActionInput,
SummaryConfig: () => SummaryConfig,
TranslationConfig: () => TranslationConfig,
ValidateActionInput: () => ValidateActionInput,
WorkqueueConfig: () => WorkqueueConfig,
defineConfig: () => defineConfig,
defineForm: () => defineForm,
eventMetadataLabelMap: () => eventMetadataLabelMap,
eventStatuses: () => eventStatuses,
getCurrentEventState: () => getCurrentEventState
});

@@ -35,18 +56,24 @@ module.exports = __toCommonJS(events_exports);

// ../commons/src/events/ActionConfig.ts
var import_zod4 = require("zod");
var import_zod5 = require("zod");
// ../commons/src/conditionals/conditionals.ts
var import_zod = require("zod");
function Conditional() {
return import_zod.z.any();
}
// ../commons/src/events/FormConfig.ts
var import_zod3 = require("zod");
var import_zod4 = require("zod");
// ../commons/src/events/FieldConfig.ts
var import_zod2 = require("zod");
var import_zod3 = require("zod");
// ../commons/src/events/TranslationConfig.ts
var import_zod = require("zod");
var TranslationConfig = import_zod.z.object({
id: import_zod.z.string().describe(
var import_zod2 = require("zod");
var TranslationConfig = import_zod2.z.object({
id: import_zod2.z.string().describe(
"The identifier of the translation referred in translation CSV files"
),
defaultMessage: import_zod.z.string().describe("Default translation message"),
description: import_zod.z.string().describe(
defaultMessage: import_zod2.z.string().describe("Default translation message"),
description: import_zod2.z.string().describe(
"Describe the translation for a translator to be able to identify it."

@@ -57,39 +84,91 @@ )

// ../commons/src/events/FieldConfig.ts
var BaseField = import_zod2.z.object({
id: import_zod2.z.string(),
required: import_zod2.z.boolean(),
var FieldId = import_zod3.z.string();
var ShowConditional = import_zod3.z.object({
type: import_zod3.z.literal("SHOW"),
conditional: Conditional()
});
var EnableConditional = import_zod3.z.object({
type: import_zod3.z.literal("ENABLE"),
conditional: Conditional()
});
var FieldConditional = import_zod3.z.discriminatedUnion("type", [
ShowConditional,
EnableConditional
]);
var BaseField = import_zod3.z.object({
id: FieldId,
conditionals: import_zod3.z.array(FieldConditional).optional().default([]),
initialValue: import_zod3.z.union([
import_zod3.z.string(),
import_zod3.z.object({
dependsOn: import_zod3.z.array(FieldId).default([]),
expression: import_zod3.z.string()
})
]).optional(),
required: import_zod3.z.boolean().default(false).optional(),
disabled: import_zod3.z.boolean().default(false).optional(),
placeholder: TranslationConfig.optional(),
validation: import_zod3.z.array(
import_zod3.z.object({
validator: Conditional(),
message: TranslationConfig
})
).default([]).optional(),
dependsOn: import_zod3.z.array(FieldId).default([]).optional(),
label: TranslationConfig
});
var TextField = BaseField.describe("Text input").merge(
import_zod2.z.object({
type: import_zod2.z.literal("TEXT"),
options: import_zod2.z.object({
maxLength: import_zod2.z.number().describe("Maximum length of the text")
}).optional()
})
);
var DateField = BaseField.describe("A single date input (dd-mm-YYYY)").merge(
import_zod2.z.object({
type: import_zod2.z.literal("DATE"),
options: import_zod2.z.object({
notice: TranslationConfig.describe(
"Text to display above the date input"
)
}).optional()
})
);
var Paragraph = BaseField.describe("A read-only HTML <p> paragraph").merge(
import_zod2.z.object({ type: import_zod2.z.literal("PARAGRAPH") })
);
var FieldConfig = import_zod2.z.discriminatedUnion("type", [
var TextField = BaseField.extend({
type: import_zod3.z.literal("TEXT"),
options: import_zod3.z.object({
maxLength: import_zod3.z.number().optional().describe("Maximum length of the text")
}).default({}).optional()
}).describe("Text input");
var DateField = BaseField.extend({
type: import_zod3.z.literal("DATE"),
options: import_zod3.z.object({
notice: TranslationConfig.describe(
"Text to display above the date input"
).optional()
}).optional()
}).describe("A single date input (dd-mm-YYYY)");
var Paragraph = BaseField.extend({
type: import_zod3.z.literal("PARAGRAPH"),
options: import_zod3.z.object({
fontVariant: import_zod3.z.literal("reg16").optional()
}).default({})
}).describe("A read-only HTML <p> paragraph");
var File = BaseField.extend({
type: import_zod3.z.literal("FILE")
}).describe("File upload");
var Hidden = BaseField.extend({
type: import_zod3.z.literal("HIDDEN")
}).describe("Hidden field");
var RadioGroup = BaseField.extend({
type: import_zod3.z.literal("RADIO_GROUP"),
options: import_zod3.z.array(
import_zod3.z.object({
value: import_zod3.z.string().describe("The value of the option"),
label: import_zod3.z.string().describe("The label of the option")
})
)
}).describe("Grouped radio options");
var FieldConfig = import_zod3.z.discriminatedUnion("type", [
TextField,
DateField,
Paragraph
Paragraph,
RadioGroup,
Hidden,
File
]);
// ../commons/src/events/FormConfig.ts
var FormConfig = import_zod3.z.object({
var FormPage = import_zod4.z.object({
id: import_zod4.z.string().describe("Unique identifier for the page"),
title: TranslationConfig.describe("Header title of the page"),
fields: import_zod4.z.array(FieldConfig).describe("Fields to be rendered on the page")
});
var FormConfig = import_zod4.z.object({
label: TranslationConfig.describe("Human readable description of the form"),
version: import_zod3.z.object({
id: import_zod3.z.string().describe(
version: import_zod4.z.object({
id: import_zod4.z.string().describe(
"Form version. Semantic versioning recommended. Example: 0.0.1"

@@ -101,19 +180,20 @@ ),

}),
active: import_zod3.z.boolean().default(false).describe("Whether the form is active"),
pages: import_zod3.z.array(
import_zod3.z.object({
id: import_zod3.z.string().describe("Unique identifier for the page"),
title: TranslationConfig.describe("Header title of the page"),
fields: import_zod3.z.array(FieldConfig).describe("Fields to be rendered on the page")
})
)
active: import_zod4.z.boolean().default(false).describe("Whether the form is active"),
pages: import_zod4.z.array(FormPage),
review: import_zod4.z.object({
title: TranslationConfig.describe(
"Title of the form to show in review page"
)
})
});
// ../commons/src/events/ActionConfig.ts
var ActionConfigBase = import_zod4.z.object({
var ActionConfigBase = import_zod5.z.object({
label: TranslationConfig,
forms: import_zod4.z.array(FormConfig)
allowedWhen: Conditional().optional(),
forms: import_zod5.z.array(FormConfig)
});
var ActionType = {
CREATE: "CREATE",
DRAFT: "DRAFT",
ASSIGN: "ASSIGN",

@@ -126,34 +206,445 @@ UNASSIGN: "UNASSIGN",

NOTIFY: "NOTIFY",
DECLARE: "DECLARE"
DECLARE: "DECLARE",
CUSTOM: "CUSTOM"
};
var CreateConfig = ActionConfigBase.merge(
import_zod4.z.object({
type: import_zod4.z.literal(ActionType.CREATE)
import_zod5.z.object({
type: import_zod5.z.literal(ActionType.CREATE)
})
);
var DeclareConfig = ActionConfigBase.merge(
import_zod4.z.object({
type: import_zod4.z.literal(ActionType.DECLARE)
import_zod5.z.object({
type: import_zod5.z.literal(ActionType.DECLARE)
})
);
var ValidateConfig = ActionConfigBase.merge(
import_zod5.z.object({
type: import_zod5.z.literal(ActionType.VALIDATE)
})
);
var RegisterConfig = ActionConfigBase.merge(
import_zod4.z.object({
type: import_zod4.z.literal(ActionType.REGISTER)
import_zod5.z.object({
type: import_zod5.z.literal(ActionType.REGISTER)
})
);
var ActionConfig = import_zod4.z.discriminatedUnion("type", [
var CustomConfig = ActionConfigBase.merge(
import_zod5.z.object({
type: import_zod5.z.literal(ActionType.CUSTOM)
})
);
var ActionConfig = import_zod5.z.discriminatedUnion("type", [
CreateConfig,
DeclareConfig,
RegisterConfig
ValidateConfig,
RegisterConfig,
CustomConfig
]);
// ../commons/src/events/EventConfig.ts
var import_zod5 = require("zod");
var EventConfig = import_zod5.z.object({
id: import_zod5.z.string().describe(
var import_zod9 = require("zod");
// ../commons/src/events/SummaryConfig.ts
var import_zod6 = require("zod");
var SummaryConfig = import_zod6.z.object({
title: TranslationConfig.describe("Header title of summary"),
fields: import_zod6.z.array(
import_zod6.z.object({
id: import_zod6.z.string().describe("Id of a field defined under form."),
label: TranslationConfig.optional()
})
).describe("Fields to be rendered under in summary.")
}).describe("Configuration for summary in event.");
// ../commons/src/events/EventConfig.ts
var import_lodash = require("lodash");
// ../commons/src/events/WorkqueueConfig.ts
var import_zod8 = require("zod");
// ../commons/src/events/EventMetadata.ts
var import_zod7 = require("zod");
var EventStatus = {
CREATED: "CREATED",
DRAFT: "DRAFT",
NOTIFIED: "NOTIFIED",
DECLARED: "DECLARED",
REGISTERED: "REGISTERED",
CERTIFIED: "CERTIFIED"
};
var eventStatuses = Object.values(EventStatus);
var EventStatuses = import_zod7.z.nativeEnum(EventStatus);
var EventMetadata = import_zod7.z.object({
id: import_zod7.z.string(),
type: import_zod7.z.string(),
status: EventStatuses,
createdAt: import_zod7.z.string().datetime(),
createdBy: import_zod7.z.string(),
createdAtLocation: import_zod7.z.string(),
modifiedAt: import_zod7.z.string().datetime(),
assignedTo: import_zod7.z.string().nullable(),
updatedBy: import_zod7.z.string()
});
var eventMetadataLabelMap = {
"event.assignedTo": {
id: "event.assignedTo.label",
defaultMessage: "Assigned To",
description: "Assigned To"
},
"event.createdAt": {
id: "event.createdAt.label",
defaultMessage: "Created",
description: "Created At"
},
"event.createdAtLocation": {
id: "event.createdAtLocation.label",
defaultMessage: "Location",
description: "Created At Location"
},
"event.createdBy": {
id: "event.createdBy.label",
defaultMessage: "Created By",
description: "Created By"
},
"event.id": {
id: "event.id.label",
defaultMessage: "ID",
description: "ID"
},
"event.modifiedAt": {
id: "event.modifiedAt.label",
defaultMessage: "Updated",
description: "Modified At"
},
"event.status": {
id: "event.status.label",
defaultMessage: "Status",
description: "Status"
},
"event.type": {
id: "event.type.label",
defaultMessage: "Type",
description: "Type"
},
"event.updatedBy": {
id: "event.updatedBy.label",
defaultMessage: "Updated By",
description: "Updated By"
}
};
// ../commons/src/events/WorkqueueConfig.ts
var WorkqueueConfig = import_zod8.z.object({
id: import_zod8.z.string().describe("Unique identifier for workqueue."),
title: TranslationConfig.describe(
"Title for workqueue, used in navigation and header."
),
fields: import_zod8.z.array(
import_zod8.z.object({
// @TODO: Improve typing by enforcing EventMetadataKeys and form page fields as possible values
id: import_zod8.z.string().describe("Id of a field defined under form pages or system field."),
label: TranslationConfig.optional()
})
),
filters: import_zod8.z.array(
import_zod8.z.object({
status: import_zod8.z.array(EventStatuses).describe("Defines which statusese are included in the workqueue.")
})
).describe("Filters to be applied to workqueue.")
}).describe("Configuration for workqueue.");
// ../commons/src/events/EventConfig.ts
var EventConfig = import_zod9.z.object({
id: import_zod9.z.string().describe(
'A machine-readable identifier for the event, e.g. "birth" or "death"'
),
summary: SummaryConfig,
label: TranslationConfig,
actions: import_zod5.z.array(ActionConfig)
actions: import_zod9.z.array(ActionConfig),
workqueues: import_zod9.z.array(WorkqueueConfig)
});
var defineConfig = (config) => EventConfig.parse(config);
var findPageFields = (config) => {
return (0, import_lodash.flattenDeep)(
config.actions.map(
({ forms }) => forms.map(
({ pages }) => pages.map(
({ fields }) => fields.map((field) => ({ id: field.id, label: field.label }))
)
)
)
);
};
var fillFieldLabels = ({
pageFields,
refFields
}) => {
return refFields.map((field) => {
if (field.label) {
return field;
}
const metadataLabel = eventMetadataLabelMap[field.id];
if (metadataLabel) {
return {
...field,
label: metadataLabel
};
}
const pageLabel = pageFields.find((pageField) => pageField.id === field.id);
if (!pageLabel) {
throw new Error(`Referenced field ${field.id} does not have a label`);
}
return {
...field,
label: pageLabel.label
};
});
};
var defineConfig = (config) => {
const parsed = EventConfig.parse(config);
const pageFields = findPageFields(parsed);
return EventConfig.parse({
...parsed,
summary: {
...parsed.summary,
fields: fillFieldLabels({
pageFields,
refFields: parsed.summary.fields
})
},
workqueues: parsed.workqueues.map((workqueue) => ({
...workqueue,
fields: fillFieldLabels({
pageFields,
refFields: workqueue.fields
})
}))
});
};
var defineForm = (form) => FormConfig.parse(form);
// ../commons/src/events/EventInput.ts
var import_zod10 = require("zod");
var EventInput = import_zod10.z.object({
transactionId: import_zod10.z.string(),
type: import_zod10.z.string()
});
// ../commons/src/events/EventDocument.ts
var import_zod12 = require("zod");
// ../commons/src/events/ActionDocument.ts
var import_zod11 = require("zod");
var ActionBase = import_zod11.z.object({
createdAt: import_zod11.z.string().datetime(),
createdBy: import_zod11.z.string(),
data: import_zod11.z.record(import_zod11.z.string(), import_zod11.z.any())
});
var AssignedAction = ActionBase.merge(
import_zod11.z.object({
type: import_zod11.z.literal(ActionType.ASSIGN),
assignedTo: import_zod11.z.string()
})
);
var UnassignedAction = ActionBase.merge(
import_zod11.z.object({
type: import_zod11.z.literal(ActionType.UNASSIGN)
})
);
var RegisterAction = ActionBase.merge(
import_zod11.z.object({
type: import_zod11.z.literal(ActionType.REGISTER),
identifiers: import_zod11.z.object({
trackingId: import_zod11.z.string(),
registrationNumber: import_zod11.z.string()
})
})
);
var DeclareAction = ActionBase.merge(
import_zod11.z.object({
type: import_zod11.z.literal(ActionType.DECLARE)
})
);
var ValidateAction = ActionBase.merge(
import_zod11.z.object({
type: import_zod11.z.literal(ActionType.VALIDATE)
})
);
var DraftAction = ActionBase.merge(
import_zod11.z.object({
type: import_zod11.z.literal(ActionType.DRAFT)
})
);
var CreatedAction = ActionBase.merge(
import_zod11.z.object({
type: import_zod11.z.literal(ActionType.CREATE),
createdAtLocation: import_zod11.z.string()
})
);
var NotifiedAction = ActionBase.merge(
import_zod11.z.object({
type: import_zod11.z.literal(ActionType.NOTIFY),
createdAtLocation: import_zod11.z.string()
})
);
var CustomAction = ActionBase.merge(
import_zod11.z.object({
type: import_zod11.z.literal(ActionType.CUSTOM)
})
);
var ActionDocument = import_zod11.z.discriminatedUnion("type", [
CreatedAction,
DraftAction,
ValidateAction,
NotifiedAction,
RegisterAction,
DeclareAction,
AssignedAction,
UnassignedAction,
CustomAction
]);
// ../commons/src/events/EventDocument.ts
var EventDocument = import_zod12.z.object({
id: import_zod12.z.string(),
type: import_zod12.z.string(),
transactionId: import_zod12.z.string(),
createdAt: import_zod12.z.string().datetime(),
updatedAt: import_zod12.z.string().datetime(),
actions: import_zod12.z.array(ActionDocument)
});
// ../commons/src/events/ActionInput.ts
var import_zod13 = require("zod");
var BaseActionInput = import_zod13.z.object({
eventId: import_zod13.z.string(),
transactionId: import_zod13.z.string(),
data: import_zod13.z.record(import_zod13.z.any())
});
var CreateActionInput = BaseActionInput.merge(
import_zod13.z.object({
type: import_zod13.z.literal(ActionType.CREATE).default(ActionType.CREATE),
createdAtLocation: import_zod13.z.string()
})
);
var RegisterActionInput = BaseActionInput.merge(
import_zod13.z.object({
type: import_zod13.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
identifiers: import_zod13.z.object({
trackingId: import_zod13.z.string(),
registrationNumber: import_zod13.z.string()
})
})
);
var ValidateActionInput = BaseActionInput.merge(
import_zod13.z.object({
type: import_zod13.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE)
})
);
var NotifyActionInput = BaseActionInput.merge(
import_zod13.z.object({
type: import_zod13.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
createdAtLocation: import_zod13.z.string()
})
);
var DraftActionInput = BaseActionInput.merge(
import_zod13.z.object({
type: import_zod13.z.literal(ActionType.DRAFT).default(ActionType.DRAFT)
})
);
var DeclareActionInput = BaseActionInput.merge(
import_zod13.z.object({
type: import_zod13.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
})
);
var AssignActionInput = BaseActionInput.merge(
import_zod13.z.object({
type: import_zod13.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
assignedTo: import_zod13.z.string()
})
);
var UnassignActionInput = BaseActionInput.merge(
import_zod13.z.object({
type: import_zod13.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN)
})
);
var ActionInput = import_zod13.z.discriminatedUnion("type", [
CreateActionInput,
ValidateActionInput,
DraftActionInput,
RegisterActionInput,
NotifyActionInput,
DeclareActionInput,
AssignActionInput,
UnassignActionInput
]);
// ../commons/src/events/EventIndex.ts
var import_zod14 = require("zod");
var EventIndex = import_zod14.z.object({
id: import_zod14.z.string(),
type: import_zod14.z.string(),
status: EventStatuses,
createdAt: import_zod14.z.string().datetime(),
createdBy: import_zod14.z.string(),
createdAtLocation: import_zod14.z.string(),
modifiedAt: import_zod14.z.string().datetime(),
assignedTo: import_zod14.z.string().nullable(),
updatedBy: import_zod14.z.string(),
data: import_zod14.z.record(import_zod14.z.string(), import_zod14.z.unknown())
});
var EventIndices = import_zod14.z.array(EventIndex);
// ../commons/src/events/state/index.ts
function getStatusFromActions(actions) {
return actions.reduce((status, action) => {
if (action.type === "CREATE") {
return "CREATED";
}
if (action.type === "DECLARE") {
return "DECLARED";
}
if (action.type === "DRAFT") {
return "DRAFT";
}
if (action.type === "REGISTER") {
return "REGISTERED";
}
return status;
}, "CREATED");
}
function getAssignedUserFromActions(actions) {
return actions.reduce((status, action) => {
if (action.type === "ASSIGN") {
return action.assignedTo;
}
if (action.type === "UNASSIGN") {
return null;
}
return status;
}, null);
}
function getData(actions) {
return actions.reduce((status, action) => {
return {
...status,
...action.data
};
}, {});
}
function getCurrentEventState(event) {
const creationAction = event.actions.find(
(action) => action.type === "CREATE"
);
const latestAction = event.actions[event.actions.length - 1];
return {
id: event.id,
type: event.type,
status: getStatusFromActions(event.actions),
createdAt: event.createdAt,
createdBy: creationAction.createdBy,
createdAtLocation: creationAction.createdAtLocation,
modifiedAt: latestAction.createdAt,
assignedTo: getAssignedUserFromActions(event.actions),
updatedBy: latestAction.createdBy,
data: getData(event.actions)
};
}

5

dist/events/TranslationConfig.d.ts

@@ -8,9 +8,10 @@ import { z } from 'zod';

id: string;
defaultMessage: string;
description: string;
defaultMessage: string;
}, {
id: string;
defaultMessage: string;
description: string;
defaultMessage: string;
}>;
export type TranslationConfig = z.infer<typeof TranslationConfig>;
//# sourceMappingURL=TranslationConfig.d.ts.map
{
"name": "@opencrvs/toolkit",
"version": "0.0.5",
"version": "0.0.6-events",
"description": "OpenCRVS toolkit for building country configurations",

@@ -8,10 +8,15 @@ "license": "MPL-2.0",

"./lib": "./dist/lib.js",
"./events": "./dist/events/index.js"
"./events": "./dist/events/index.js",
"./conditionals": "./dist/conditionals/index.js"
},
"scripts": {
"build": "rimraf dist && tsc --build && yarn build-common-events:js && yarn copy-common-events:ts",
"build": "rimraf dist && tsc --build && yarn build-common-events:js && yarn copy-common-events:ts && yarn build-common-conditionals:js && yarn copy-common-conditionals:ts",
"build-common-events:js": "esbuild src/events/index.ts --bundle --format=cjs --outdir=./dist/events --allow-overwrite --packages=external",
"copy-common-events:ts": "cp -r ../commons/build/dist/common/events/*.d.ts ./dist/events"
"build-common-conditionals:js": "esbuild src/conditionals/index.ts --bundle --format=cjs --outdir=./dist/conditionals --allow-overwrite --packages=external",
"copy-common-events:ts": "cp -r ../commons/build/dist/common/events/*.d.ts ./dist/events",
"copy-common-conditionals:ts": "cp -r ../commons/build/dist/common/conditionals/*.d.ts ./dist/conditionals"
},
"dependencies": {},
"dependencies": {
"ajv": "^8.17.1"
},
"devDependencies": {

@@ -18,0 +23,0 @@ "esbuild": "^0.24.0",

@@ -41,3 +41,4 @@ # OpenCRVS toolkit

- All dependencies of the functions and moduless used from `packages/commons` **must** be also defined in the package.json of the toolkit. Otherwise someone installing the package will get errors.
- Package is published and should be used without knowledge of rest of the monorepo
- Package exposes `/events` directory, with types, from `packages/commons` through the library, others are excluded.

@@ -15,2 +15,5 @@ {

"paths": {
"@opencrvs/commons/conditionals": [
"../commons/src/conditionals/conditionals.ts"
],
"@opencrvs/commons/events": ["../commons/src/events/index.ts"]

@@ -17,0 +20,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 not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc