@opencrvs/toolkit
Advanced tools
Comparing version 0.0.10-events to 0.0.11-events
@@ -81,100 +81,3 @@ import { JSONSchema } from '@opencrvs/commons/conditionals'; | ||
}; | ||
isEqualTo: (value: string) => { | ||
type: string; | ||
properties: { | ||
$form: { | ||
type: string; | ||
properties: { | ||
[x: string]: { | ||
const: string; | ||
}; | ||
}; | ||
required: string[]; | ||
}; | ||
}; | ||
required: string[]; | ||
}; | ||
isInArray: (values: string[]) => { | ||
type: string; | ||
properties: { | ||
$form: { | ||
type: string; | ||
properties: { | ||
[x: string]: { | ||
enum: string[]; | ||
}; | ||
}; | ||
required: string[]; | ||
}; | ||
}; | ||
required: string[]; | ||
}; | ||
isNotInArray: (values: string[]) => { | ||
type: string; | ||
properties: { | ||
$form: { | ||
type: string; | ||
properties: { | ||
[x: string]: { | ||
not: { | ||
enum: string[]; | ||
}; | ||
}; | ||
}; | ||
required: string[]; | ||
}; | ||
}; | ||
required: string[]; | ||
}; | ||
isUndefinedOrInArray: (values: string[]) => { | ||
type: string; | ||
properties: { | ||
$form: { | ||
type: string; | ||
anyOf: ({ | ||
required: string[]; | ||
properties: { | ||
[x: string]: { | ||
enum: string[]; | ||
}; | ||
}; | ||
not?: undefined; | ||
} | { | ||
not: { | ||
required: string[]; | ||
}; | ||
required?: undefined; | ||
properties?: undefined; | ||
})[]; | ||
}; | ||
}; | ||
required: string[]; | ||
}; | ||
isUndefinedOrNotInArray: (values: string[]) => { | ||
type: string; | ||
properties: { | ||
$form: { | ||
type: string; | ||
anyOf: ({ | ||
required: string[]; | ||
properties: { | ||
[x: string]: { | ||
not: { | ||
enum: string[]; | ||
}; | ||
}; | ||
}; | ||
not?: undefined; | ||
} | { | ||
not: { | ||
required: string[]; | ||
}; | ||
required?: undefined; | ||
properties?: undefined; | ||
})[]; | ||
}; | ||
}; | ||
required: string[]; | ||
}; | ||
}; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -130,93 +130,4 @@ "use strict"; | ||
required: ["$form", "$now"] | ||
}), | ||
isEqualTo: (value) => ({ | ||
type: "object", | ||
properties: { | ||
$form: { | ||
type: "object", | ||
properties: { | ||
[fieldId]: { | ||
const: value | ||
} | ||
}, | ||
required: [fieldId] | ||
} | ||
}, | ||
required: ["$form"] | ||
}), | ||
isInArray: (values) => ({ | ||
type: "object", | ||
properties: { | ||
$form: { | ||
type: "object", | ||
properties: { | ||
[fieldId]: { | ||
enum: values | ||
} | ||
}, | ||
required: [fieldId] | ||
} | ||
}, | ||
required: ["$form"] | ||
}), | ||
isNotInArray: (values) => ({ | ||
type: "object", | ||
properties: { | ||
$form: { | ||
type: "object", | ||
properties: { | ||
[fieldId]: { | ||
not: { | ||
enum: values | ||
} | ||
} | ||
}, | ||
required: [fieldId] | ||
} | ||
}, | ||
required: ["$form"] | ||
}), | ||
isUndefinedOrInArray: (values) => ({ | ||
type: "object", | ||
properties: { | ||
$form: { | ||
type: "object", | ||
anyOf: [ | ||
{ | ||
required: [fieldId], | ||
properties: { | ||
[fieldId]: { | ||
enum: values | ||
} | ||
} | ||
}, | ||
{ not: { required: [fieldId] } } | ||
] | ||
} | ||
}, | ||
required: ["$form"] | ||
}), | ||
isUndefinedOrNotInArray: (values) => ({ | ||
type: "object", | ||
properties: { | ||
$form: { | ||
type: "object", | ||
anyOf: [ | ||
{ | ||
required: [fieldId], | ||
properties: { | ||
[fieldId]: { | ||
not: { | ||
enum: values | ||
} | ||
} | ||
} | ||
}, | ||
{ not: { required: [fieldId] } } | ||
] | ||
} | ||
}, | ||
required: ["$form"] | ||
}) | ||
}; | ||
} |
@@ -23,4 +23,2 @@ import { z } from 'zod'; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "CREATE"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -31,7 +29,8 @@ type: string; | ||
} | null>; | ||
type: "CREATE"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CREATE"; | ||
data: Record<string, string | { | ||
@@ -42,2 +41,3 @@ type: string; | ||
} | null>; | ||
type: "CREATE"; | ||
createdAt: string; | ||
@@ -69,4 +69,2 @@ createdBy: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "CREATE"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -77,7 +75,8 @@ type: string; | ||
} | null>; | ||
type: "CREATE"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CREATE"; | ||
data: Record<string, string | { | ||
@@ -88,2 +87,3 @@ type: string; | ||
} | null>; | ||
type: "CREATE"; | ||
createdAt: string; | ||
@@ -114,4 +114,2 @@ createdBy: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "VALIDATE"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -122,7 +120,8 @@ type: string; | ||
} | null>; | ||
type: "VALIDATE"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "VALIDATE"; | ||
data: Record<string, string | { | ||
@@ -133,2 +132,3 @@ type: string; | ||
} | null>; | ||
type: "VALIDATE"; | ||
createdAt: string; | ||
@@ -159,4 +159,2 @@ createdBy: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "NOTIFY"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -167,7 +165,8 @@ type: string; | ||
} | null>; | ||
type: "NOTIFY"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "NOTIFY"; | ||
data: Record<string, string | { | ||
@@ -178,2 +177,3 @@ type: string; | ||
} | null>; | ||
type: "NOTIFY"; | ||
createdAt: string; | ||
@@ -214,4 +214,2 @@ createdBy: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "REGISTER"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -222,3 +220,5 @@ type: string; | ||
} | null>; | ||
type: "REGISTER"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
@@ -231,3 +231,2 @@ createdAtLocation: string; | ||
}, { | ||
type: "REGISTER"; | ||
data: Record<string, string | { | ||
@@ -238,2 +237,3 @@ type: string; | ||
} | null>; | ||
type: "REGISTER"; | ||
createdAt: string; | ||
@@ -268,4 +268,2 @@ createdBy: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "DECLARE"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -276,7 +274,8 @@ type: string; | ||
} | null>; | ||
type: "DECLARE"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "DECLARE"; | ||
data: Record<string, string | { | ||
@@ -287,2 +286,3 @@ type: string; | ||
} | null>; | ||
type: "DECLARE"; | ||
createdAt: string; | ||
@@ -314,4 +314,2 @@ createdBy: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "ASSIGN"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -322,3 +320,5 @@ type: string; | ||
} | null>; | ||
type: "ASSIGN"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
@@ -328,3 +328,2 @@ createdAtLocation: string; | ||
}, { | ||
type: "ASSIGN"; | ||
data: Record<string, string | { | ||
@@ -335,2 +334,3 @@ type: string; | ||
} | null>; | ||
type: "ASSIGN"; | ||
createdAt: string; | ||
@@ -362,4 +362,2 @@ createdBy: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "UNASSIGN"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -370,7 +368,8 @@ type: string; | ||
} | null>; | ||
type: "UNASSIGN"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "UNASSIGN"; | ||
data: Record<string, string | { | ||
@@ -381,2 +380,3 @@ type: string; | ||
} | null>; | ||
type: "UNASSIGN"; | ||
createdAt: string; | ||
@@ -407,4 +407,2 @@ createdBy: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "CUSTOM"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -415,7 +413,8 @@ type: string; | ||
} | null>; | ||
type: "CUSTOM"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CUSTOM"; | ||
data: Record<string, string | { | ||
@@ -426,2 +425,3 @@ type: string; | ||
} | null>; | ||
type: "CUSTOM"; | ||
createdAt: string; | ||
@@ -428,0 +428,0 @@ createdBy: string; |
@@ -32,4 +32,2 @@ import { z } from 'zod'; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "REGISTER"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -40,2 +38,4 @@ type: string; | ||
} | null>; | ||
type: "REGISTER"; | ||
draft: boolean; | ||
transactionId: string; | ||
@@ -81,5 +81,4 @@ identifiers: { | ||
type: z.ZodDefault<z.ZodLiteral<"VALIDATE">>; | ||
duplicates: z.ZodArray<z.ZodString, "many">; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "VALIDATE"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -90,4 +89,7 @@ type: string; | ||
} | null>; | ||
type: "VALIDATE"; | ||
draft: boolean; | ||
transactionId: string; | ||
eventId: string; | ||
duplicates: string[]; | ||
}, { | ||
@@ -101,2 +103,3 @@ data: Record<string, string | { | ||
eventId: string; | ||
duplicates: string[]; | ||
type?: "VALIDATE" | undefined; | ||
@@ -126,4 +129,2 @@ draft?: boolean | undefined; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "NOTIFY"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -134,2 +135,4 @@ type: string; | ||
} | null>; | ||
type: "NOTIFY"; | ||
draft: boolean; | ||
transactionId: string; | ||
@@ -170,4 +173,2 @@ createdAtLocation: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "DECLARE"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -178,2 +179,4 @@ type: string; | ||
} | null>; | ||
type: "DECLARE"; | ||
draft: boolean; | ||
transactionId: string; | ||
@@ -222,4 +225,2 @@ eventId: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "CREATE"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -230,2 +231,4 @@ type: string; | ||
} | null>; | ||
type: "CREATE"; | ||
draft: boolean; | ||
transactionId: string; | ||
@@ -264,5 +267,4 @@ createdAtLocation: string; | ||
type: z.ZodDefault<z.ZodLiteral<"VALIDATE">>; | ||
duplicates: z.ZodArray<z.ZodString, "many">; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "VALIDATE"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -273,4 +275,7 @@ type: string; | ||
} | null>; | ||
type: "VALIDATE"; | ||
draft: boolean; | ||
transactionId: string; | ||
eventId: string; | ||
duplicates: string[]; | ||
}, { | ||
@@ -284,2 +289,3 @@ data: Record<string, string | { | ||
eventId: string; | ||
duplicates: string[]; | ||
type?: "VALIDATE" | undefined; | ||
@@ -317,4 +323,2 @@ draft?: boolean | undefined; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "REGISTER"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -325,2 +329,4 @@ type: string; | ||
} | null>; | ||
type: "REGISTER"; | ||
draft: boolean; | ||
transactionId: string; | ||
@@ -367,4 +373,2 @@ identifiers: { | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "NOTIFY"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -375,2 +379,4 @@ type: string; | ||
} | null>; | ||
type: "NOTIFY"; | ||
draft: boolean; | ||
transactionId: string; | ||
@@ -410,4 +416,2 @@ createdAtLocation: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "DECLARE"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -418,2 +422,4 @@ type: string; | ||
} | null>; | ||
type: "DECLARE"; | ||
draft: boolean; | ||
transactionId: string; | ||
@@ -452,4 +458,2 @@ eventId: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "ASSIGN"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -460,2 +464,4 @@ type: string; | ||
} | null>; | ||
type: "ASSIGN"; | ||
draft: boolean; | ||
transactionId: string; | ||
@@ -495,4 +501,2 @@ assignedTo: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "UNASSIGN"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -503,2 +507,4 @@ type: string; | ||
} | null>; | ||
type: "UNASSIGN"; | ||
draft: boolean; | ||
transactionId: string; | ||
@@ -505,0 +511,0 @@ eventId: string; |
@@ -29,4 +29,2 @@ import { z } from 'zod'; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "CREATE"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -37,7 +35,8 @@ type: string; | ||
} | null>; | ||
type: "CREATE"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CREATE"; | ||
data: Record<string, string | { | ||
@@ -48,2 +47,3 @@ type: string; | ||
} | null>; | ||
type: "CREATE"; | ||
createdAt: string; | ||
@@ -74,4 +74,2 @@ createdBy: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "VALIDATE"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -82,7 +80,8 @@ type: string; | ||
} | null>; | ||
type: "VALIDATE"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "VALIDATE"; | ||
data: Record<string, string | { | ||
@@ -93,2 +92,3 @@ type: string; | ||
} | null>; | ||
type: "VALIDATE"; | ||
createdAt: string; | ||
@@ -119,4 +119,2 @@ createdBy: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "NOTIFY"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -127,7 +125,8 @@ type: string; | ||
} | null>; | ||
type: "NOTIFY"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "NOTIFY"; | ||
data: Record<string, string | { | ||
@@ -138,2 +137,3 @@ type: string; | ||
} | null>; | ||
type: "NOTIFY"; | ||
createdAt: string; | ||
@@ -174,4 +174,2 @@ createdBy: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "REGISTER"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -182,3 +180,5 @@ type: string; | ||
} | null>; | ||
type: "REGISTER"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
@@ -191,3 +191,2 @@ createdAtLocation: string; | ||
}, { | ||
type: "REGISTER"; | ||
data: Record<string, string | { | ||
@@ -198,2 +197,3 @@ type: string; | ||
} | null>; | ||
type: "REGISTER"; | ||
createdAt: string; | ||
@@ -228,4 +228,2 @@ createdBy: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "DECLARE"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -236,7 +234,8 @@ type: string; | ||
} | null>; | ||
type: "DECLARE"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "DECLARE"; | ||
data: Record<string, string | { | ||
@@ -247,2 +246,3 @@ type: string; | ||
} | null>; | ||
type: "DECLARE"; | ||
createdAt: string; | ||
@@ -274,4 +274,2 @@ createdBy: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "ASSIGN"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -282,3 +280,5 @@ type: string; | ||
} | null>; | ||
type: "ASSIGN"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
@@ -288,3 +288,2 @@ createdAtLocation: string; | ||
}, { | ||
type: "ASSIGN"; | ||
data: Record<string, string | { | ||
@@ -295,2 +294,3 @@ type: string; | ||
} | null>; | ||
type: "ASSIGN"; | ||
createdAt: string; | ||
@@ -322,4 +322,2 @@ createdBy: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "UNASSIGN"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -330,7 +328,8 @@ type: string; | ||
} | null>; | ||
type: "UNASSIGN"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "UNASSIGN"; | ||
data: Record<string, string | { | ||
@@ -341,2 +340,3 @@ type: string; | ||
} | null>; | ||
type: "UNASSIGN"; | ||
createdAt: string; | ||
@@ -367,4 +367,2 @@ createdBy: string; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "CUSTOM"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -375,7 +373,8 @@ type: string; | ||
} | null>; | ||
type: "CUSTOM"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CUSTOM"; | ||
data: Record<string, string | { | ||
@@ -386,2 +385,3 @@ type: string; | ||
} | null>; | ||
type: "CUSTOM"; | ||
createdAt: string; | ||
@@ -393,10 +393,7 @@ createdBy: string; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
type: string; | ||
id: string; | ||
transactionId: string; | ||
createdAt: string; | ||
updatedAt: string; | ||
actions: ({ | ||
type: "CREATE"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -407,8 +404,8 @@ type: string; | ||
} | null>; | ||
type: "CREATE"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
} | { | ||
type: "VALIDATE"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -419,8 +416,8 @@ type: string; | ||
} | null>; | ||
type: "VALIDATE"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
} | { | ||
type: "NOTIFY"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -431,8 +428,8 @@ type: string; | ||
} | null>; | ||
type: "NOTIFY"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
} | { | ||
type: "REGISTER"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -443,3 +440,5 @@ type: string; | ||
} | null>; | ||
type: "REGISTER"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
@@ -452,4 +451,2 @@ createdAtLocation: string; | ||
} | { | ||
type: "DECLARE"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -460,8 +457,8 @@ type: string; | ||
} | null>; | ||
type: "DECLARE"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
} | { | ||
type: "ASSIGN"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -472,3 +469,5 @@ type: string; | ||
} | null>; | ||
type: "ASSIGN"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
@@ -478,4 +477,2 @@ createdAtLocation: string; | ||
} | { | ||
type: "UNASSIGN"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -486,8 +483,8 @@ type: string; | ||
} | null>; | ||
type: "UNASSIGN"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
} | { | ||
type: "CUSTOM"; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -498,14 +495,15 @@ type: string; | ||
} | null>; | ||
type: "CUSTOM"; | ||
createdAt: string; | ||
draft: boolean; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
})[]; | ||
transactionId: string; | ||
}, { | ||
id: string; | ||
type: string; | ||
id: string; | ||
transactionId: string; | ||
createdAt: string; | ||
updatedAt: string; | ||
actions: ({ | ||
type: "CREATE"; | ||
data: Record<string, string | { | ||
@@ -516,2 +514,3 @@ type: string; | ||
} | null>; | ||
type: "CREATE"; | ||
createdAt: string; | ||
@@ -522,3 +521,2 @@ createdBy: string; | ||
} | { | ||
type: "VALIDATE"; | ||
data: Record<string, string | { | ||
@@ -529,2 +527,3 @@ type: string; | ||
} | null>; | ||
type: "VALIDATE"; | ||
createdAt: string; | ||
@@ -535,3 +534,2 @@ createdBy: string; | ||
} | { | ||
type: "NOTIFY"; | ||
data: Record<string, string | { | ||
@@ -542,2 +540,3 @@ type: string; | ||
} | null>; | ||
type: "NOTIFY"; | ||
createdAt: string; | ||
@@ -548,3 +547,2 @@ createdBy: string; | ||
} | { | ||
type: "REGISTER"; | ||
data: Record<string, string | { | ||
@@ -555,2 +553,3 @@ type: string; | ||
} | null>; | ||
type: "REGISTER"; | ||
createdAt: string; | ||
@@ -565,3 +564,2 @@ createdBy: string; | ||
} | { | ||
type: "DECLARE"; | ||
data: Record<string, string | { | ||
@@ -572,2 +570,3 @@ type: string; | ||
} | null>; | ||
type: "DECLARE"; | ||
createdAt: string; | ||
@@ -578,3 +577,2 @@ createdBy: string; | ||
} | { | ||
type: "ASSIGN"; | ||
data: Record<string, string | { | ||
@@ -585,2 +583,3 @@ type: string; | ||
} | null>; | ||
type: "ASSIGN"; | ||
createdAt: string; | ||
@@ -592,3 +591,2 @@ createdBy: string; | ||
} | { | ||
type: "UNASSIGN"; | ||
data: Record<string, string | { | ||
@@ -599,2 +597,3 @@ type: string; | ||
} | null>; | ||
type: "UNASSIGN"; | ||
createdAt: string; | ||
@@ -605,3 +604,2 @@ createdBy: string; | ||
} | { | ||
type: "CUSTOM"; | ||
data: Record<string, string | { | ||
@@ -612,2 +610,3 @@ type: string; | ||
} | null>; | ||
type: "CUSTOM"; | ||
createdAt: string; | ||
@@ -618,4 +617,5 @@ createdBy: string; | ||
})[]; | ||
transactionId: string; | ||
}>; | ||
export type EventDocument = z.infer<typeof EventDocument>; | ||
//# sourceMappingURL=EventDocument.d.ts.map |
@@ -22,6 +22,6 @@ import { z } from 'zod'; | ||
}>, "strip", z.ZodTypeAny, { | ||
data: Record<string, any>; | ||
id: string; | ||
type: string; | ||
id: string; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
data: Record<string, any>; | ||
status: "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED" | "CREATED" | "NOTIFIED"; | ||
createdAt: string; | ||
@@ -34,6 +34,6 @@ createdBy: string; | ||
}, { | ||
data: Record<string, any>; | ||
id: string; | ||
type: string; | ||
id: string; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
data: Record<string, any>; | ||
status: "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED" | "CREATED" | "NOTIFIED"; | ||
createdAt: string; | ||
@@ -40,0 +40,0 @@ createdBy: string; |
@@ -15,3 +15,3 @@ import { z } from 'zod'; | ||
export type EventStatus = (typeof EventStatus)[keyof typeof EventStatus]; | ||
export declare const eventStatuses: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
export declare const eventStatuses: ("DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED" | "CREATED" | "NOTIFIED")[]; | ||
export declare const EventStatuses: z.ZodNativeEnum<{ | ||
@@ -48,5 +48,5 @@ readonly CREATED: "CREATED"; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
type: string; | ||
id: string; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
status: "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED" | "CREATED" | "NOTIFIED"; | ||
createdAt: string; | ||
@@ -59,5 +59,5 @@ createdBy: string; | ||
}, { | ||
id: string; | ||
type: string; | ||
id: string; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
status: "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED" | "CREATED" | "NOTIFIED"; | ||
createdAt: string; | ||
@@ -64,0 +64,0 @@ createdBy: string; |
@@ -18,2 +18,3 @@ export * from './ActionConfig'; | ||
export * from './defineConfig'; | ||
export * from './DeduplicationConfig'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -28,4 +28,6 @@ "use strict"; | ||
ActionType: () => ActionType, | ||
Clause: () => Clause, | ||
ConditionalTypes: () => ConditionalTypes, | ||
DeclareActionInput: () => DeclareActionInput, | ||
DeduplicationConfig: () => DeduplicationConfig, | ||
EventConfig: () => EventConfig, | ||
@@ -51,2 +53,3 @@ EventConfigInput: () => EventConfigInput, | ||
WorkqueueConfig: () => WorkqueueConfig, | ||
and: () => and, | ||
defineConfig: () => defineConfig, | ||
@@ -56,2 +59,3 @@ defineForm: () => defineForm, | ||
eventStatuses: () => eventStatuses, | ||
field: () => field, | ||
fieldTypes: () => fieldTypes, | ||
@@ -61,2 +65,3 @@ findPageFields: () => findPageFields, | ||
isUndeclaredDraft: () => isUndeclaredDraft, | ||
or: () => or, | ||
resolveFieldLabels: () => resolveFieldLabels, | ||
@@ -97,3 +102,2 @@ resolveLabelsFromKnownFields: () => resolveLabelsFromKnownFields | ||
SHOW: "SHOW", | ||
HIDE: "HIDE", | ||
ENABLE: "ENABLE" | ||
@@ -106,6 +110,2 @@ }; | ||
}); | ||
var HideConditional = import_zod3.z.object({ | ||
type: import_zod3.z.literal(ConditionalTypes.HIDE), | ||
conditional: Conditional() | ||
}); | ||
var EnableConditional = import_zod3.z.object({ | ||
@@ -117,3 +117,2 @@ type: import_zod3.z.literal(ConditionalTypes.ENABLE), | ||
ShowConditional, | ||
HideConditional, | ||
EnableConditional | ||
@@ -150,7 +149,3 @@ ]); | ||
FILE: "FILE", | ||
HIDDEN: "HIDDEN", | ||
BULLET_LIST: "BULLET_LIST", | ||
CHECKBOX: "CHECKBOX", | ||
SELECT: "SELECT", | ||
COUNTRY: "COUNTRY" | ||
HIDDEN: "HIDDEN" | ||
}; | ||
@@ -161,5 +156,4 @@ var fieldTypes = Object.values(FieldType); | ||
options: import_zod3.z.object({ | ||
maxLength: import_zod3.z.number().optional().describe("Maximum length of the text"), | ||
type: import_zod3.z.enum(["text", "email", "password", "number"]).optional() | ||
}).default({ type: "text" }).optional() | ||
maxLength: import_zod3.z.number().optional().describe("Maximum length of the text") | ||
}).default({}).optional() | ||
}).describe("Text input"); | ||
@@ -177,3 +171,3 @@ var DateField = BaseField.extend({ | ||
options: import_zod3.z.object({ | ||
fontVariant: import_zod3.z.enum(["reg12", "reg14", "reg16", "reg18", "h4", "h3", "h2", "h1"]).optional() | ||
fontVariant: import_zod3.z.literal("reg16").optional() | ||
}).default({}) | ||
@@ -193,21 +187,2 @@ }).describe("A read-only HTML <p> paragraph"); | ||
}).describe("Grouped radio options"); | ||
var BulletList = BaseField.extend({ | ||
type: import_zod3.z.literal(FieldType.BULLET_LIST), | ||
items: import_zod3.z.array(TranslationConfig).describe("A list of items"), | ||
font: import_zod3.z.enum(["reg12", "reg14", "reg16", "reg18", "h4", "h3", "h2", "h1"]) | ||
}).describe("A list of bullet points"); | ||
var SelectOption = import_zod3.z.object({ | ||
value: import_zod3.z.string().describe("The value of the option"), | ||
label: TranslationConfig.describe("The label of the option") | ||
}); | ||
var Select = BaseField.extend({ | ||
type: import_zod3.z.literal(FieldType.SELECT), | ||
options: import_zod3.z.array(SelectOption).describe("A list of options") | ||
}).describe("Select input"); | ||
var CheckBox = BaseField.extend({ | ||
type: import_zod3.z.literal(FieldType.CHECKBOX) | ||
}).describe("Check Box"); | ||
var Country = BaseField.extend({ | ||
type: import_zod3.z.literal(FieldType.COUNTRY) | ||
}).describe("Country select field"); | ||
var FieldConfig = import_zod3.z.discriminatedUnion("type", [ | ||
@@ -218,7 +193,3 @@ TextField, | ||
RadioGroup, | ||
BulletList, | ||
Select, | ||
CheckBox, | ||
File, | ||
Country | ||
File | ||
]); | ||
@@ -311,3 +282,3 @@ | ||
// ../commons/src/events/EventConfig.ts | ||
var import_zod9 = require("zod"); | ||
var import_zod10 = require("zod"); | ||
@@ -427,5 +398,68 @@ // ../commons/src/events/SummaryConfig.ts | ||
// ../commons/src/events/DeduplicationConfig.ts | ||
var import_zod9 = require("zod"); | ||
var FieldReference = import_zod9.z.string(); | ||
var Matcher = import_zod9.z.object({ | ||
fieldId: import_zod9.z.string(), | ||
options: import_zod9.z.object({ | ||
boost: import_zod9.z.number().optional() | ||
}).optional().default({}) | ||
}); | ||
var FuzzyMatcher = Matcher.extend({ | ||
type: import_zod9.z.literal("fuzzy"), | ||
options: import_zod9.z.object({ | ||
// Names of length of 3 or less characters = 0 edits allowed | ||
// Names of length of 4 - 6 characters = 1 edit allowed | ||
// Names of length of >7 characters = 2 edits allowed | ||
fuzziness: import_zod9.z.union([import_zod9.z.string(), import_zod9.z.number()]).optional().default("AUTO:4,7"), | ||
boost: import_zod9.z.number().optional().default(1) | ||
}).optional().default({}) | ||
}); | ||
var StrictMatcher = Matcher.extend({ | ||
type: import_zod9.z.literal("strict"), | ||
options: import_zod9.z.object({ | ||
boost: import_zod9.z.number().optional().default(1) | ||
}).optional().default({}) | ||
}); | ||
var DateRangeMatcher = Matcher.extend({ | ||
type: import_zod9.z.literal("dateRange"), | ||
options: import_zod9.z.object({ | ||
days: import_zod9.z.number(), | ||
origin: FieldReference, | ||
boost: import_zod9.z.number().optional().default(1) | ||
}) | ||
}); | ||
var DateDistanceMatcher = Matcher.extend({ | ||
type: import_zod9.z.literal("dateDistance"), | ||
options: import_zod9.z.object({ | ||
days: import_zod9.z.number(), | ||
origin: FieldReference, | ||
boost: import_zod9.z.number().optional().default(1) | ||
}) | ||
}); | ||
var And = import_zod9.z.object({ | ||
type: import_zod9.z.literal("and"), | ||
clauses: import_zod9.z.lazy(() => Clause.array()) | ||
}); | ||
var Or = import_zod9.z.object({ | ||
type: import_zod9.z.literal("or"), | ||
clauses: import_zod9.z.lazy(() => Clause.array()) | ||
}); | ||
var Clause = import_zod9.z.union([ | ||
And, | ||
Or, | ||
FuzzyMatcher, | ||
StrictMatcher, | ||
DateRangeMatcher, | ||
DateDistanceMatcher | ||
]); | ||
var DeduplicationConfig = import_zod9.z.object({ | ||
id: import_zod9.z.string(), | ||
label: TranslationConfig, | ||
query: Clause | ||
}); | ||
// ../commons/src/events/EventConfig.ts | ||
var EventConfig = import_zod9.z.object({ | ||
id: import_zod9.z.string().describe( | ||
var EventConfig = import_zod10.z.object({ | ||
id: import_zod10.z.string().describe( | ||
'A machine-readable identifier for the event, e.g. "birth" or "death"' | ||
@@ -435,4 +469,5 @@ ), | ||
label: TranslationConfig, | ||
actions: import_zod9.z.array(ActionConfig), | ||
workqueues: import_zod9.z.array(WorkqueueConfig) | ||
actions: import_zod10.z.array(ActionConfig), | ||
workqueues: import_zod10.z.array(WorkqueueConfig), | ||
deduplication: DeduplicationConfig.optional() | ||
}); | ||
@@ -445,26 +480,26 @@ var EventConfigInput = EventConfig.extend({ | ||
// ../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() | ||
var import_zod11 = require("zod"); | ||
var EventInput = import_zod11.z.object({ | ||
transactionId: import_zod11.z.string(), | ||
type: import_zod11.z.string() | ||
}); | ||
// ../commons/src/events/EventDocument.ts | ||
var import_zod13 = require("zod"); | ||
var import_zod14 = require("zod"); | ||
// ../commons/src/events/ActionDocument.ts | ||
var import_zod12 = require("zod"); | ||
var import_zod13 = require("zod"); | ||
// ../commons/src/events/FieldValue.ts | ||
var import_zod11 = require("zod"); | ||
var TextFieldValue = import_zod11.z.string(); | ||
var DateFieldValue = import_zod11.z.string().nullable(); | ||
var ParagraphFieldValue = import_zod11.z.string(); | ||
var FileFieldValue = import_zod11.z.object({ | ||
filename: import_zod11.z.string(), | ||
originalFilename: import_zod11.z.string(), | ||
type: import_zod11.z.string() | ||
var import_zod12 = require("zod"); | ||
var TextFieldValue = import_zod12.z.string(); | ||
var DateFieldValue = import_zod12.z.string().nullable(); | ||
var ParagraphFieldValue = import_zod12.z.string(); | ||
var FileFieldValue = import_zod12.z.object({ | ||
filename: import_zod12.z.string(), | ||
originalFilename: import_zod12.z.string(), | ||
type: import_zod12.z.string() | ||
}).nullable(); | ||
var RadioGroupFieldValue = import_zod11.z.string(); | ||
var FieldValue = import_zod11.z.union([ | ||
var RadioGroupFieldValue = import_zod12.z.string(); | ||
var FieldValue = import_zod12.z.union([ | ||
TextFieldValue, | ||
@@ -478,26 +513,26 @@ DateFieldValue, | ||
// ../commons/src/events/ActionDocument.ts | ||
var ActionBase = import_zod12.z.object({ | ||
createdAt: import_zod12.z.string().datetime(), | ||
createdBy: import_zod12.z.string(), | ||
data: import_zod12.z.record(import_zod12.z.string(), FieldValue), | ||
draft: import_zod12.z.boolean().optional().default(false), | ||
createdAtLocation: import_zod12.z.string() | ||
var ActionBase = import_zod13.z.object({ | ||
createdAt: import_zod13.z.string().datetime(), | ||
createdBy: import_zod13.z.string(), | ||
data: import_zod13.z.record(import_zod13.z.string(), FieldValue), | ||
draft: import_zod13.z.boolean().optional().default(false), | ||
createdAtLocation: import_zod13.z.string() | ||
}); | ||
var AssignedAction = ActionBase.merge( | ||
import_zod12.z.object({ | ||
type: import_zod12.z.literal(ActionType.ASSIGN), | ||
assignedTo: import_zod12.z.string() | ||
import_zod13.z.object({ | ||
type: import_zod13.z.literal(ActionType.ASSIGN), | ||
assignedTo: import_zod13.z.string() | ||
}) | ||
); | ||
var UnassignedAction = ActionBase.merge( | ||
import_zod12.z.object({ | ||
type: import_zod12.z.literal(ActionType.UNASSIGN) | ||
import_zod13.z.object({ | ||
type: import_zod13.z.literal(ActionType.UNASSIGN) | ||
}) | ||
); | ||
var RegisterAction = ActionBase.merge( | ||
import_zod12.z.object({ | ||
type: import_zod12.z.literal(ActionType.REGISTER), | ||
identifiers: import_zod12.z.object({ | ||
trackingId: import_zod12.z.string(), | ||
registrationNumber: import_zod12.z.string() | ||
import_zod13.z.object({ | ||
type: import_zod13.z.literal(ActionType.REGISTER), | ||
identifiers: import_zod13.z.object({ | ||
trackingId: import_zod13.z.string(), | ||
registrationNumber: import_zod13.z.string() | ||
}) | ||
@@ -507,27 +542,27 @@ }) | ||
var DeclareAction = ActionBase.merge( | ||
import_zod12.z.object({ | ||
type: import_zod12.z.literal(ActionType.DECLARE) | ||
import_zod13.z.object({ | ||
type: import_zod13.z.literal(ActionType.DECLARE) | ||
}) | ||
); | ||
var ValidateAction = ActionBase.merge( | ||
import_zod12.z.object({ | ||
type: import_zod12.z.literal(ActionType.VALIDATE) | ||
import_zod13.z.object({ | ||
type: import_zod13.z.literal(ActionType.VALIDATE) | ||
}) | ||
); | ||
var CreatedAction = ActionBase.merge( | ||
import_zod12.z.object({ | ||
type: import_zod12.z.literal(ActionType.CREATE) | ||
import_zod13.z.object({ | ||
type: import_zod13.z.literal(ActionType.CREATE) | ||
}) | ||
); | ||
var NotifiedAction = ActionBase.merge( | ||
import_zod12.z.object({ | ||
type: import_zod12.z.literal(ActionType.NOTIFY) | ||
import_zod13.z.object({ | ||
type: import_zod13.z.literal(ActionType.NOTIFY) | ||
}) | ||
); | ||
var CustomAction = ActionBase.merge( | ||
import_zod12.z.object({ | ||
type: import_zod12.z.literal(ActionType.CUSTOM) | ||
import_zod13.z.object({ | ||
type: import_zod13.z.literal(ActionType.CUSTOM) | ||
}) | ||
); | ||
var ActionDocument = import_zod12.z.discriminatedUnion("type", [ | ||
var ActionDocument = import_zod13.z.discriminatedUnion("type", [ | ||
CreatedAction, | ||
@@ -544,31 +579,31 @@ ValidateAction, | ||
// ../commons/src/events/EventDocument.ts | ||
var EventDocument = import_zod13.z.object({ | ||
id: import_zod13.z.string(), | ||
type: import_zod13.z.string(), | ||
transactionId: import_zod13.z.string(), | ||
createdAt: import_zod13.z.string().datetime(), | ||
updatedAt: import_zod13.z.string().datetime(), | ||
actions: import_zod13.z.array(ActionDocument) | ||
var EventDocument = import_zod14.z.object({ | ||
id: import_zod14.z.string(), | ||
type: import_zod14.z.string(), | ||
transactionId: import_zod14.z.string(), | ||
createdAt: import_zod14.z.string().datetime(), | ||
updatedAt: import_zod14.z.string().datetime(), | ||
actions: import_zod14.z.array(ActionDocument) | ||
}); | ||
// ../commons/src/events/ActionInput.ts | ||
var import_zod14 = require("zod"); | ||
var BaseActionInput = import_zod14.z.object({ | ||
eventId: import_zod14.z.string(), | ||
transactionId: import_zod14.z.string(), | ||
draft: import_zod14.z.boolean().optional().default(false), | ||
data: import_zod14.z.record(import_zod14.z.string(), FieldValue) | ||
var import_zod15 = require("zod"); | ||
var BaseActionInput = import_zod15.z.object({ | ||
eventId: import_zod15.z.string(), | ||
transactionId: import_zod15.z.string(), | ||
draft: import_zod15.z.boolean().optional().default(false), | ||
data: import_zod15.z.record(import_zod15.z.string(), FieldValue) | ||
}); | ||
var CreateActionInput = BaseActionInput.merge( | ||
import_zod14.z.object({ | ||
type: import_zod14.z.literal(ActionType.CREATE).default(ActionType.CREATE), | ||
createdAtLocation: import_zod14.z.string() | ||
import_zod15.z.object({ | ||
type: import_zod15.z.literal(ActionType.CREATE).default(ActionType.CREATE), | ||
createdAtLocation: import_zod15.z.string() | ||
}) | ||
); | ||
var RegisterActionInput = BaseActionInput.merge( | ||
import_zod14.z.object({ | ||
type: import_zod14.z.literal(ActionType.REGISTER).default(ActionType.REGISTER), | ||
identifiers: import_zod14.z.object({ | ||
trackingId: import_zod14.z.string(), | ||
registrationNumber: import_zod14.z.string() | ||
import_zod15.z.object({ | ||
type: import_zod15.z.literal(ActionType.REGISTER).default(ActionType.REGISTER), | ||
identifiers: import_zod15.z.object({ | ||
trackingId: import_zod15.z.string(), | ||
registrationNumber: import_zod15.z.string() | ||
}) | ||
@@ -578,29 +613,30 @@ }) | ||
var ValidateActionInput = BaseActionInput.merge( | ||
import_zod14.z.object({ | ||
type: import_zod14.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE) | ||
import_zod15.z.object({ | ||
type: import_zod15.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE), | ||
duplicates: import_zod15.z.array(import_zod15.z.string()) | ||
}) | ||
); | ||
var NotifyActionInput = BaseActionInput.merge( | ||
import_zod14.z.object({ | ||
type: import_zod14.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY), | ||
createdAtLocation: import_zod14.z.string() | ||
import_zod15.z.object({ | ||
type: import_zod15.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY), | ||
createdAtLocation: import_zod15.z.string() | ||
}) | ||
); | ||
var DeclareActionInput = BaseActionInput.merge( | ||
import_zod14.z.object({ | ||
type: import_zod14.z.literal(ActionType.DECLARE).default(ActionType.DECLARE) | ||
import_zod15.z.object({ | ||
type: import_zod15.z.literal(ActionType.DECLARE).default(ActionType.DECLARE) | ||
}) | ||
); | ||
var AssignActionInput = BaseActionInput.merge( | ||
import_zod14.z.object({ | ||
type: import_zod14.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN), | ||
assignedTo: import_zod14.z.string() | ||
import_zod15.z.object({ | ||
type: import_zod15.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN), | ||
assignedTo: import_zod15.z.string() | ||
}) | ||
); | ||
var UnassignActionInput = BaseActionInput.merge( | ||
import_zod14.z.object({ | ||
type: import_zod14.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN) | ||
import_zod15.z.object({ | ||
type: import_zod15.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN) | ||
}) | ||
); | ||
var ActionInput = import_zod14.z.discriminatedUnion("type", [ | ||
var ActionInput = import_zod15.z.discriminatedUnion("type", [ | ||
CreateActionInput, | ||
@@ -616,5 +652,5 @@ ValidateActionInput, | ||
// ../commons/src/events/EventIndex.ts | ||
var import_zod15 = require("zod"); | ||
var import_zod16 = require("zod"); | ||
var EventIndex = EventMetadata.extend({ | ||
data: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.any()) | ||
data: import_zod16.z.record(import_zod16.z.string(), import_zod16.z.any()) | ||
}); | ||
@@ -691,3 +727,3 @@ | ||
var import_lodash = require("lodash"); | ||
var isMetadataField = (field) => field in eventMetadataLabelMap; | ||
var isMetadataField = (field2) => field2 in eventMetadataLabelMap; | ||
var findPageFields = (config) => { | ||
@@ -712,18 +748,18 @@ return (0, import_lodash.flattenDeep)( | ||
}) => { | ||
return refFields.map((field) => { | ||
if (field.label) { | ||
return field; | ||
return refFields.map((field2) => { | ||
if (field2.label) { | ||
return field2; | ||
} | ||
if (isMetadataField(field.id)) { | ||
if (isMetadataField(field2.id)) { | ||
return { | ||
...field, | ||
label: eventMetadataLabelMap[field.id] | ||
...field2, | ||
label: eventMetadataLabelMap[field2.id] | ||
}; | ||
} | ||
const pageLabel = pageFields.find((pageField) => pageField.id === field.id); | ||
const pageLabel = pageFields.find((pageField) => pageField.id === field2.id); | ||
if (!pageLabel) { | ||
throw new Error(`Referenced field ${field.id} does not have a label`); | ||
throw new Error(`Referenced field ${field2.id} does not have a label`); | ||
} | ||
return { | ||
...field, | ||
...field2, | ||
label: pageLabel.label | ||
@@ -767,1 +803,52 @@ }; | ||
}; | ||
// src/events/deduplication.ts | ||
function and(clauses) { | ||
return { | ||
type: "and", | ||
clauses | ||
}; | ||
} | ||
function or(clauses) { | ||
return { | ||
type: "or", | ||
clauses | ||
}; | ||
} | ||
function field(fieldId) { | ||
return { | ||
fuzzyMatches: (options = {}) => ({ | ||
fieldId, | ||
type: "fuzzy", | ||
options: { | ||
fuzziness: options.fuzziness ?? "AUTO:4,7", | ||
boost: options.boost ?? 1 | ||
} | ||
}), | ||
strictMatches: (options = {}) => ({ | ||
fieldId, | ||
type: "strict", | ||
options: { | ||
boost: options.boost ?? 1 | ||
} | ||
}), | ||
dateRangeMatches: (options) => ({ | ||
fieldId, | ||
type: "dateRange", | ||
options: { | ||
days: options.days, | ||
origin: options.origin, | ||
boost: options.boost ?? 1 | ||
} | ||
}), | ||
dateDistanceMatches: (options) => ({ | ||
fieldId, | ||
type: "dateDistance", | ||
options: { | ||
days: options.days, | ||
origin: options.origin, | ||
boost: options.boost ?? 1 | ||
} | ||
}) | ||
}; | ||
} |
@@ -8,10 +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 |
@@ -62,5 +62,5 @@ import { TranslationConfig } from './TranslationConfig'; | ||
filters: { | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
status: ("DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED" | "CREATED" | "NOTIFIED")[]; | ||
}[]; | ||
}; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -60,5 +60,5 @@ import { z } from 'zod'; | ||
}, "strip", z.ZodTypeAny, { | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
status: ("DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED" | "CREATED" | "NOTIFIED")[]; | ||
}, { | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
status: ("DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED" | "CREATED" | "NOTIFIED")[]; | ||
}>, "many">; | ||
@@ -81,3 +81,3 @@ }, "strip", z.ZodTypeAny, { | ||
filters: { | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
status: ("DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED" | "CREATED" | "NOTIFIED")[]; | ||
}[]; | ||
@@ -100,3 +100,3 @@ }, { | ||
filters: { | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
status: ("DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED" | "CREATED" | "NOTIFIED")[]; | ||
}[]; | ||
@@ -103,0 +103,0 @@ }>; |
{ | ||
"name": "@opencrvs/toolkit", | ||
"version": "0.0.10-events", | ||
"version": "0.0.11-events", | ||
"description": "OpenCRVS toolkit for building country configurations", | ||
@@ -5,0 +5,0 @@ "license": "MPL-2.0", |
@@ -118,93 +118,4 @@ /* | ||
required: ['$form', '$now'] | ||
}), | ||
isEqualTo: (value: string) => ({ | ||
type: 'object', | ||
properties: { | ||
$form: { | ||
type: 'object', | ||
properties: { | ||
[fieldId]: { | ||
const: value | ||
} | ||
}, | ||
required: [fieldId] | ||
} | ||
}, | ||
required: ['$form'] | ||
}), | ||
isInArray: (values: string[]) => ({ | ||
type: 'object', | ||
properties: { | ||
$form: { | ||
type: 'object', | ||
properties: { | ||
[fieldId]: { | ||
enum: values | ||
} | ||
}, | ||
required: [fieldId] | ||
} | ||
}, | ||
required: ['$form'] | ||
}), | ||
isNotInArray: (values: string[]) => ({ | ||
type: 'object', | ||
properties: { | ||
$form: { | ||
type: 'object', | ||
properties: { | ||
[fieldId]: { | ||
not: { | ||
enum: values | ||
} | ||
} | ||
}, | ||
required: [fieldId] | ||
} | ||
}, | ||
required: ['$form'] | ||
}), | ||
isUndefinedOrInArray: (values: string[]) => ({ | ||
type: 'object', | ||
properties: { | ||
$form: { | ||
type: 'object', | ||
anyOf: [ | ||
{ | ||
required: [fieldId], | ||
properties: { | ||
[fieldId]: { | ||
enum: values | ||
} | ||
} | ||
}, | ||
{ not: { required: [fieldId] } } | ||
] | ||
} | ||
}, | ||
required: ['$form'] | ||
}), | ||
isUndefinedOrNotInArray: (values: string[]) => ({ | ||
type: 'object', | ||
properties: { | ||
$form: { | ||
type: 'object', | ||
anyOf: [ | ||
{ | ||
required: [fieldId], | ||
properties: { | ||
[fieldId]: { | ||
not: { | ||
enum: values | ||
} | ||
} | ||
} | ||
}, | ||
{ not: { required: [fieldId] } } | ||
] | ||
} | ||
}, | ||
required: ['$form'] | ||
}) | ||
} | ||
} |
@@ -12,1 +12,2 @@ /* | ||
export * from '@opencrvs/commons/events' | ||
export * from './deduplication' |
Sorry, the diff of this file is not supported yet
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 not supported yet
Sorry, the diff of this file is not supported yet
35
2448043
61837