@opencrvs/toolkit
Advanced tools
Comparing version
@@ -1,4 +0,4 @@ | ||
import { ClauseInput, ClauseOutput } from '@opencrvs/commons/events'; | ||
export declare function and(clauses: ClauseInput[]): ClauseOutput; | ||
export declare function or(clauses: ClauseInput[]): ClauseOutput; | ||
import { Clause } from '@opencrvs/commons/events'; | ||
export declare function and(clauses: Clause[]): Clause; | ||
export declare function or(clauses: Clause[]): Clause; | ||
export declare function field(fieldId: string): { | ||
@@ -5,0 +5,0 @@ fuzzyMatches: (options?: { |
@@ -16,7 +16,6 @@ "use strict"; | ||
exports.field = field; | ||
const events_1 = require("@opencrvs/commons/events"); | ||
function and(clauses) { | ||
return { | ||
type: 'and', | ||
clauses: clauses.map((clause) => events_1.Clause.parse(clause)) | ||
clauses | ||
}; | ||
@@ -27,3 +26,3 @@ } | ||
type: 'or', | ||
clauses: clauses.map((clause) => events_1.Clause.parse(clause)) | ||
clauses | ||
}; | ||
@@ -30,0 +29,0 @@ } |
@@ -41,589 +41,6 @@ "use strict"; | ||
}); | ||
// ../commons/src/events/ActionConfig.ts | ||
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_zod4 = require("zod"); | ||
// ../commons/src/events/FieldConfig.ts | ||
var import_zod3 = require("zod"); | ||
// ../commons/src/events/TranslationConfig.ts | ||
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_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." | ||
) | ||
}); | ||
// ../commons/src/events/FieldConfig.ts | ||
var ConditionalTypes = { | ||
SHOW: "SHOW", | ||
HIDE: "HIDE", | ||
ENABLE: "ENABLE" | ||
}; | ||
var FieldId = import_zod3.z.string(); | ||
var ShowConditional = import_zod3.z.object({ | ||
type: import_zod3.z.literal(ConditionalTypes.SHOW), | ||
conditional: Conditional() | ||
}); | ||
var HideConditional = import_zod3.z.object({ | ||
type: import_zod3.z.literal(ConditionalTypes.HIDE), | ||
conditional: Conditional() | ||
}); | ||
var EnableConditional = import_zod3.z.object({ | ||
type: import_zod3.z.literal(ConditionalTypes.ENABLE), | ||
conditional: Conditional() | ||
}); | ||
var FieldConditional = import_zod3.z.discriminatedUnion("type", [ | ||
ShowConditional, | ||
HideConditional, | ||
EnableConditional | ||
]); | ||
var BaseField = import_zod3.z.object({ | ||
id: FieldId, | ||
conditionals: import_zod3.z.array(FieldConditional).default([]).optional(), | ||
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(), | ||
hidden: 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 FieldType = { | ||
TEXT: "TEXT", | ||
DATE: "DATE", | ||
PARAGRAPH: "PARAGRAPH", | ||
RADIO_GROUP: "RADIO_GROUP", | ||
FILE: "FILE", | ||
HIDDEN: "HIDDEN", | ||
BULLET_LIST: "BULLET_LIST", | ||
CHECKBOX: "CHECKBOX", | ||
SELECT: "SELECT", | ||
COUNTRY: "COUNTRY" | ||
}; | ||
var fieldTypes = Object.values(FieldType); | ||
var TextField = BaseField.extend({ | ||
type: import_zod3.z.literal(FieldType.TEXT), | ||
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() | ||
}).describe("Text input"); | ||
var DateField = BaseField.extend({ | ||
type: import_zod3.z.literal(FieldType.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 HTMLFontVariant = import_zod3.z.enum([ | ||
"reg12", | ||
"reg14", | ||
"reg16", | ||
"reg18", | ||
"h4", | ||
"h3", | ||
"h2", | ||
"h1" | ||
]); | ||
var Paragraph = BaseField.extend({ | ||
type: import_zod3.z.literal(FieldType.PARAGRAPH), | ||
options: import_zod3.z.object({ | ||
fontVariant: HTMLFontVariant.optional() | ||
}).default({}) | ||
}).describe("A read-only HTML <p> paragraph"); | ||
var File = BaseField.extend({ | ||
type: import_zod3.z.literal(FieldType.FILE) | ||
}).describe("File upload"); | ||
var RadioGroup = BaseField.extend({ | ||
type: import_zod3.z.literal(FieldType.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 BulletList = BaseField.extend({ | ||
type: import_zod3.z.literal(FieldType.BULLET_LIST), | ||
items: import_zod3.z.array(TranslationConfig).describe("A list of items"), | ||
font: HTMLFontVariant | ||
}).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", [ | ||
TextField, | ||
DateField, | ||
Paragraph, | ||
RadioGroup, | ||
BulletList, | ||
Select, | ||
Checkbox, | ||
File, | ||
Country | ||
]); | ||
// ../commons/src/events/FormConfig.ts | ||
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_zod4.z.object({ | ||
id: import_zod4.z.string().describe( | ||
"Form version. Semantic versioning recommended. Example: 0.0.1" | ||
), | ||
label: TranslationConfig.describe( | ||
"Human readable description of the version" | ||
) | ||
}), | ||
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_zod5.z.object({ | ||
label: TranslationConfig, | ||
allowedWhen: Conditional().optional(), | ||
draft: import_zod5.z.boolean().optional(), | ||
forms: import_zod5.z.array(FormConfig) | ||
}); | ||
var ActionType = { | ||
CREATE: "CREATE", | ||
ASSIGN: "ASSIGN", | ||
UNASSIGN: "UNASSIGN", | ||
REGISTER: "REGISTER", | ||
VALIDATE: "VALIDATE", | ||
CORRECT: "CORRECT", | ||
DETECT_DUPLICATE: "DETECT_DUPLICATE", | ||
NOTIFY: "NOTIFY", | ||
DECLARE: "DECLARE", | ||
DELETE: "DELETE", | ||
CUSTOM: "CUSTOM" | ||
}; | ||
var CreateConfig = ActionConfigBase.merge( | ||
import_zod5.z.object({ | ||
type: import_zod5.z.literal(ActionType.CREATE) | ||
}) | ||
); | ||
var DeclareConfig = ActionConfigBase.merge( | ||
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_zod5.z.object({ | ||
type: import_zod5.z.literal(ActionType.REGISTER) | ||
}) | ||
); | ||
var DeleteConfig = ActionConfigBase.merge( | ||
import_zod5.z.object({ | ||
type: import_zod5.z.literal(ActionType.DELETE) | ||
}) | ||
); | ||
var CustomConfig = ActionConfigBase.merge( | ||
import_zod5.z.object({ | ||
type: import_zod5.z.literal(ActionType.CUSTOM) | ||
}) | ||
); | ||
var ActionConfig = import_zod5.z.discriminatedUnion("type", [ | ||
CreateConfig, | ||
DeclareConfig, | ||
ValidateConfig, | ||
RegisterConfig, | ||
DeleteConfig, | ||
CustomConfig | ||
]); | ||
// ../commons/src/events/EventConfig.ts | ||
var import_zod10 = require("zod"); | ||
// ../commons/src/events/SummaryConfig.ts | ||
var import_zod6 = require("zod"); | ||
var Field = import_zod6.z.object({ | ||
id: import_zod6.z.string().describe("Id of summary field"), | ||
value: TranslationConfig.describe( | ||
"Summary field value. Can utilise values defined in configuration and EventMetadata" | ||
), | ||
label: TranslationConfig, | ||
emptyValueMessage: TranslationConfig.optional() | ||
}); | ||
var Title = import_zod6.z.object({ | ||
id: import_zod6.z.string(), | ||
label: TranslationConfig.describe("Title content"), | ||
emptyValueMessage: TranslationConfig.optional() | ||
}); | ||
var SummaryConfig = import_zod6.z.object({ | ||
title: Title.describe("Title of summary view."), | ||
fields: import_zod6.z.array(Field).describe("Fields rendered in summary view.") | ||
}).describe("Configuration for summary in event."); | ||
// ../commons/src/events/WorkqueueConfig.ts | ||
var import_zod8 = require("zod"); | ||
// ../commons/src/events/EventMetadata.ts | ||
var import_zod7 = require("zod"); | ||
var EventStatus = { | ||
CREATED: "CREATED", | ||
NOTIFIED: "NOTIFIED", | ||
DECLARED: "DECLARED", | ||
VALIDATED: "VALIDATED", | ||
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() | ||
}); | ||
// ../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/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 3 or less characters = 0 edits allowed | ||
* Names of length 4 - 6 characters = 1 edit allowed | ||
* Names of length >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.lazy( | ||
() => import_zod9.z.discriminatedUnion("type", [ | ||
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_zod10.z.object({ | ||
id: import_zod10.z.string().describe( | ||
'A machine-readable identifier for the event, e.g. "birth" or "death"' | ||
), | ||
summary: SummaryConfig, | ||
label: TranslationConfig, | ||
actions: import_zod10.z.array(ActionConfig), | ||
workqueues: import_zod10.z.array(WorkqueueConfig), | ||
deduplication: import_zod10.z.array(DeduplicationConfig).optional().default([]) | ||
}); | ||
// ../commons/src/events/EventInput.ts | ||
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_zod14 = require("zod"); | ||
// ../commons/src/events/ActionDocument.ts | ||
var import_zod13 = require("zod"); | ||
// ../commons/src/events/FieldValue.ts | ||
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_zod12.z.string(); | ||
var FieldValue = import_zod12.z.union([ | ||
TextFieldValue, | ||
DateFieldValue, | ||
ParagraphFieldValue, | ||
FileFieldValue, | ||
RadioGroupFieldValue | ||
]); | ||
// ../commons/src/events/ActionDocument.ts | ||
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_zod13.z.object({ | ||
type: import_zod13.z.literal(ActionType.ASSIGN), | ||
assignedTo: import_zod13.z.string() | ||
}) | ||
); | ||
var UnassignedAction = ActionBase.merge( | ||
import_zod13.z.object({ | ||
type: import_zod13.z.literal(ActionType.UNASSIGN) | ||
}) | ||
); | ||
var RegisterAction = ActionBase.merge( | ||
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() | ||
}) | ||
}) | ||
); | ||
var DeclareAction = ActionBase.merge( | ||
import_zod13.z.object({ | ||
type: import_zod13.z.literal(ActionType.DECLARE) | ||
}) | ||
); | ||
var ValidateAction = ActionBase.merge( | ||
import_zod13.z.object({ | ||
type: import_zod13.z.literal(ActionType.VALIDATE) | ||
}) | ||
); | ||
var CreatedAction = ActionBase.merge( | ||
import_zod13.z.object({ | ||
type: import_zod13.z.literal(ActionType.CREATE) | ||
}) | ||
); | ||
var NotifiedAction = ActionBase.merge( | ||
import_zod13.z.object({ | ||
type: import_zod13.z.literal(ActionType.NOTIFY) | ||
}) | ||
); | ||
var CustomAction = ActionBase.merge( | ||
import_zod13.z.object({ | ||
type: import_zod13.z.literal(ActionType.CUSTOM) | ||
}) | ||
); | ||
var ActionDocument = import_zod13.z.discriminatedUnion("type", [ | ||
CreatedAction, | ||
ValidateAction, | ||
NotifiedAction, | ||
RegisterAction, | ||
DeclareAction, | ||
AssignedAction, | ||
UnassignedAction, | ||
CustomAction | ||
]); | ||
var ResolvedUser = import_zod13.z.object({ | ||
id: import_zod13.z.string(), | ||
systemRole: import_zod13.z.string(), | ||
name: import_zod13.z.array( | ||
import_zod13.z.object({ | ||
use: import_zod13.z.string(), | ||
given: import_zod13.z.array(import_zod13.z.string()), | ||
family: import_zod13.z.string() | ||
}) | ||
) | ||
}); | ||
// ../commons/src/events/EventDocument.ts | ||
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_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_zod15.z.object({ | ||
type: import_zod15.z.literal(ActionType.CREATE).default(ActionType.CREATE), | ||
createdAtLocation: import_zod15.z.string() | ||
}) | ||
); | ||
var RegisterActionInput = BaseActionInput.merge( | ||
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() | ||
}) | ||
}) | ||
); | ||
var ValidateActionInput = BaseActionInput.merge( | ||
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_zod15.z.object({ | ||
type: import_zod15.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY), | ||
createdAtLocation: import_zod15.z.string() | ||
}) | ||
); | ||
var DeclareActionInput = BaseActionInput.merge( | ||
import_zod15.z.object({ | ||
type: import_zod15.z.literal(ActionType.DECLARE).default(ActionType.DECLARE) | ||
}) | ||
); | ||
var AssignActionInput = BaseActionInput.merge( | ||
import_zod15.z.object({ | ||
type: import_zod15.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN), | ||
assignedTo: import_zod15.z.string() | ||
}) | ||
); | ||
var UnassignActionInput = BaseActionInput.merge( | ||
import_zod15.z.object({ | ||
type: import_zod15.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN) | ||
}) | ||
); | ||
var ActionInput = import_zod15.z.discriminatedUnion("type", [ | ||
CreateActionInput, | ||
ValidateActionInput, | ||
RegisterActionInput, | ||
NotifyActionInput, | ||
DeclareActionInput, | ||
AssignActionInput, | ||
UnassignActionInput | ||
]); | ||
// ../commons/src/events/EventIndex.ts | ||
var import_zod16 = require("zod"); | ||
var EventIndex = EventMetadata.extend({ | ||
data: import_zod16.z.record(import_zod16.z.string(), import_zod16.z.any()) | ||
}); | ||
// ../commons/src/events/utils.ts | ||
var import_lodash = require("lodash"); | ||
// src/conditionals/deduplication.ts | ||
function and(clauses) { | ||
return { | ||
type: "and", | ||
clauses: clauses.map((clause) => Clause.parse(clause)) | ||
clauses | ||
}; | ||
@@ -634,3 +51,3 @@ } | ||
type: "or", | ||
clauses: clauses.map((clause) => Clause.parse(clause)) | ||
clauses | ||
}; | ||
@@ -637,0 +54,0 @@ } |
@@ -17,3 +17,3 @@ import { z } from 'zod'; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -25,4 +25,3 @@ createdAtLocation: z.ZodString; | ||
type: "CREATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -33,8 +32,7 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CREATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -45,2 +43,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -64,3 +64,3 @@ draft?: boolean | undefined; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -72,4 +72,3 @@ createdAtLocation: z.ZodString; | ||
type: "CREATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -80,8 +79,7 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CREATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -92,2 +90,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -110,3 +110,3 @@ draft?: boolean | undefined; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -118,4 +118,3 @@ createdAtLocation: z.ZodString; | ||
type: "VALIDATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -126,8 +125,7 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "VALIDATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -138,2 +136,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -156,3 +156,3 @@ draft?: boolean | undefined; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -164,4 +164,3 @@ createdAtLocation: z.ZodString; | ||
type: "NOTIFY"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -172,8 +171,7 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "NOTIFY"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -184,2 +182,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -202,3 +202,3 @@ draft?: boolean | undefined; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -220,4 +220,3 @@ createdAtLocation: z.ZodString; | ||
type: "REGISTER"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -228,3 +227,4 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -237,4 +237,2 @@ identifiers: { | ||
type: "REGISTER"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -245,2 +243,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -267,3 +267,3 @@ identifiers: { | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -275,4 +275,3 @@ createdAtLocation: z.ZodString; | ||
type: "DECLARE"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -283,8 +282,7 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "DECLARE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -295,2 +293,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -313,3 +313,3 @@ draft?: boolean | undefined; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -322,4 +322,3 @@ createdAtLocation: z.ZodString; | ||
type: "ASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -330,3 +329,4 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -336,4 +336,2 @@ assignedTo: string; | ||
type: "ASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -344,2 +342,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -363,3 +363,3 @@ assignedTo: string; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -371,4 +371,3 @@ createdAtLocation: z.ZodString; | ||
type: "UNASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -379,8 +378,7 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "UNASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -391,2 +389,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -409,3 +409,3 @@ draft?: boolean | undefined; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -417,4 +417,3 @@ createdAtLocation: z.ZodString; | ||
type: "CUSTOM"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -425,8 +424,7 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CUSTOM"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -437,2 +435,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -439,0 +439,0 @@ draft?: boolean | undefined; |
@@ -18,3 +18,3 @@ import { z } from 'zod'; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
}, { | ||
@@ -34,3 +34,3 @@ type: z.ZodDefault<z.ZodLiteral<"REGISTER">>; | ||
type: "REGISTER"; | ||
transactionId: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -41,3 +41,3 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
transactionId: string; | ||
identifiers: { | ||
@@ -49,3 +49,2 @@ trackingId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -56,2 +55,3 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
identifiers: { | ||
@@ -81,3 +81,3 @@ trackingId: string; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
}, { | ||
@@ -88,3 +88,3 @@ type: z.ZodDefault<z.ZodLiteral<"VALIDATE">>; | ||
type: "VALIDATE"; | ||
transactionId: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -95,7 +95,6 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
transactionId: string; | ||
eventId: string; | ||
duplicates: string[]; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -106,2 +105,3 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
eventId: string; | ||
@@ -129,3 +129,3 @@ duplicates: string[]; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
}, { | ||
@@ -136,3 +136,3 @@ type: z.ZodDefault<z.ZodLiteral<"NOTIFY">>; | ||
type: "NOTIFY"; | ||
transactionId: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -143,7 +143,6 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
transactionId: string; | ||
createdAtLocation: string; | ||
eventId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -154,2 +153,3 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
createdAtLocation: string; | ||
@@ -177,3 +177,3 @@ eventId: string; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
}, { | ||
@@ -183,3 +183,3 @@ type: z.ZodDefault<z.ZodLiteral<"DECLARE">>; | ||
type: "DECLARE"; | ||
transactionId: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -190,6 +190,5 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
transactionId: string; | ||
eventId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -200,2 +199,3 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
eventId: string; | ||
@@ -230,3 +230,3 @@ type?: "DECLARE" | undefined; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
}, { | ||
@@ -237,3 +237,3 @@ type: z.ZodDefault<z.ZodLiteral<"CREATE">>; | ||
type: "CREATE"; | ||
transactionId: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -244,7 +244,6 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
transactionId: string; | ||
createdAtLocation: string; | ||
eventId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -255,2 +254,3 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
createdAtLocation: string; | ||
@@ -276,3 +276,3 @@ eventId: string; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
}, { | ||
@@ -283,3 +283,3 @@ type: z.ZodDefault<z.ZodLiteral<"VALIDATE">>; | ||
type: "VALIDATE"; | ||
transactionId: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -290,7 +290,6 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
transactionId: string; | ||
eventId: string; | ||
duplicates: string[]; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -301,2 +300,3 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
eventId: string; | ||
@@ -322,3 +322,3 @@ duplicates: string[]; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
}, { | ||
@@ -338,3 +338,3 @@ type: z.ZodDefault<z.ZodLiteral<"REGISTER">>; | ||
type: "REGISTER"; | ||
transactionId: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -345,3 +345,3 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
transactionId: string; | ||
identifiers: { | ||
@@ -353,3 +353,2 @@ trackingId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -360,2 +359,3 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
identifiers: { | ||
@@ -384,3 +384,3 @@ trackingId: string; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
}, { | ||
@@ -391,3 +391,3 @@ type: z.ZodDefault<z.ZodLiteral<"NOTIFY">>; | ||
type: "NOTIFY"; | ||
transactionId: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -398,7 +398,6 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
transactionId: string; | ||
createdAtLocation: string; | ||
eventId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -409,2 +408,3 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
createdAtLocation: string; | ||
@@ -430,3 +430,3 @@ eventId: string; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
}, { | ||
@@ -436,3 +436,3 @@ type: z.ZodDefault<z.ZodLiteral<"DECLARE">>; | ||
type: "DECLARE"; | ||
transactionId: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -443,6 +443,5 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
transactionId: string; | ||
eventId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -453,2 +452,3 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
eventId: string; | ||
@@ -473,3 +473,3 @@ type?: "DECLARE" | undefined; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
}, { | ||
@@ -480,3 +480,3 @@ type: z.ZodDefault<z.ZodLiteral<"ASSIGN">>; | ||
type: "ASSIGN"; | ||
transactionId: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -487,7 +487,6 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
transactionId: string; | ||
assignedTo: string; | ||
eventId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -498,2 +497,3 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
assignedTo: string; | ||
@@ -519,3 +519,3 @@ eventId: string; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
}, { | ||
@@ -525,3 +525,3 @@ type: z.ZodDefault<z.ZodLiteral<"UNASSIGN">>; | ||
type: "UNASSIGN"; | ||
transactionId: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -532,6 +532,5 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
transactionId: string; | ||
eventId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -542,2 +541,3 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
eventId: string; | ||
@@ -544,0 +544,0 @@ type?: "UNASSIGN" | undefined; |
@@ -183,2 +183,3 @@ import { z } from 'zod'; | ||
export declare const Clause: z.ZodType<ClauseOutput, z.ZodTypeDef, ClauseInput>; | ||
export type Clause = z.infer<typeof Clause>; | ||
export declare const DeduplicationConfig: z.ZodObject<{ | ||
@@ -192,8 +193,8 @@ id: z.ZodString; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -205,4 +206,4 @@ query: z.ZodType<ClauseOutput, z.ZodTypeDef, ClauseInput>; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -214,4 +215,4 @@ query: ClauseOutput; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -218,0 +219,0 @@ query: ClauseInput; |
@@ -23,3 +23,3 @@ import { z } from 'zod'; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -31,4 +31,3 @@ createdAtLocation: z.ZodString; | ||
type: "CREATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -39,8 +38,7 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CREATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -51,2 +49,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -69,3 +69,3 @@ draft?: boolean | undefined; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -77,4 +77,3 @@ createdAtLocation: z.ZodString; | ||
type: "VALIDATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -85,8 +84,7 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "VALIDATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -97,2 +95,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -115,3 +115,3 @@ draft?: boolean | undefined; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -123,4 +123,3 @@ createdAtLocation: z.ZodString; | ||
type: "NOTIFY"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -131,8 +130,7 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "NOTIFY"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -143,2 +141,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -161,3 +161,3 @@ draft?: boolean | undefined; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -179,4 +179,3 @@ createdAtLocation: z.ZodString; | ||
type: "REGISTER"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -187,3 +186,4 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -196,4 +196,2 @@ identifiers: { | ||
type: "REGISTER"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -204,2 +202,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -226,3 +226,3 @@ identifiers: { | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -234,4 +234,3 @@ createdAtLocation: z.ZodString; | ||
type: "DECLARE"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -242,8 +241,7 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "DECLARE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -254,2 +252,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -272,3 +272,3 @@ draft?: boolean | undefined; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -281,4 +281,3 @@ createdAtLocation: z.ZodString; | ||
type: "ASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -289,3 +288,4 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -295,4 +295,2 @@ assignedTo: string; | ||
type: "ASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -303,2 +301,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -322,3 +322,3 @@ assignedTo: string; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -330,4 +330,3 @@ createdAtLocation: z.ZodString; | ||
type: "UNASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -338,8 +337,7 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "UNASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -350,2 +348,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -368,3 +368,3 @@ draft?: boolean | undefined; | ||
originalFilename: string; | ||
}>>, z.ZodString]>>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>>; | ||
draft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; | ||
@@ -376,4 +376,3 @@ createdAtLocation: z.ZodString; | ||
type: "CUSTOM"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -384,8 +383,7 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CUSTOM"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -396,2 +394,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -401,8 +401,10 @@ draft?: boolean | undefined; | ||
}, "strip", z.ZodTypeAny, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
transactionId: string; | ||
createdAt: string; | ||
updatedAt: string; | ||
actions: ({ | ||
type: "CREATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -413,8 +415,8 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
} | { | ||
type: "VALIDATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -425,8 +427,8 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
} | { | ||
type: "NOTIFY"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -437,8 +439,8 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
} | { | ||
type: "REGISTER"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -449,3 +451,4 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -458,4 +461,3 @@ identifiers: { | ||
type: "DECLARE"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -466,8 +468,8 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
} | { | ||
type: "ASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -478,3 +480,4 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -484,4 +487,3 @@ assignedTo: string; | ||
type: "UNASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -492,8 +494,8 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
} | { | ||
type: "CUSTOM"; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
data: Record<string, string | { | ||
@@ -504,15 +506,14 @@ type: string; | ||
} | null>; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
})[]; | ||
}, { | ||
type: string; | ||
id: string; | ||
transactionId: string; | ||
createdAt: string; | ||
updatedAt: string; | ||
}, { | ||
id: string; | ||
type: string; | ||
actions: ({ | ||
type: "CREATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -523,2 +524,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -528,4 +531,2 @@ draft?: boolean | undefined; | ||
type: "VALIDATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -536,2 +537,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -541,4 +544,2 @@ draft?: boolean | undefined; | ||
type: "NOTIFY"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -549,2 +550,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -554,4 +557,2 @@ draft?: boolean | undefined; | ||
type: "REGISTER"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -562,2 +563,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -571,4 +574,2 @@ identifiers: { | ||
type: "DECLARE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -579,2 +580,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -584,4 +587,2 @@ draft?: boolean | undefined; | ||
type: "ASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -592,2 +593,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -598,4 +601,2 @@ assignedTo: string; | ||
type: "UNASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -606,2 +607,4 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -611,4 +614,2 @@ draft?: boolean | undefined; | ||
type: "CUSTOM"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -619,10 +620,9 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
draft?: boolean | undefined; | ||
})[]; | ||
transactionId: string; | ||
createdAt: string; | ||
updatedAt: string; | ||
}>; | ||
export type EventDocument = z.infer<typeof EventDocument>; | ||
//# sourceMappingURL=EventDocument.d.ts.map |
@@ -22,25 +22,25 @@ import { z } from 'zod'; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
status: "CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED"; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
assignedTo: string | null; | ||
modifiedAt: string; | ||
assignedTo: string | null; | ||
updatedBy: string; | ||
data: Record<string, any>; | ||
}, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
status: "CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED"; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
data: Record<string, any>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
assignedTo: string | null; | ||
modifiedAt: string; | ||
assignedTo: string | null; | ||
updatedBy: string; | ||
data: Record<string, any>; | ||
}>; | ||
export type EventIndex = z.infer<typeof EventIndex>; | ||
//# sourceMappingURL=EventIndex.d.ts.map |
@@ -15,3 +15,3 @@ import { z } from 'zod'; | ||
export type EventStatus = (typeof EventStatus)[keyof typeof EventStatus]; | ||
export declare const eventStatuses: ("CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED")[]; | ||
export declare const eventStatuses: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
export declare const EventStatuses: z.ZodNativeEnum<{ | ||
@@ -48,20 +48,20 @@ readonly CREATED: "CREATED"; | ||
}, "strip", z.ZodTypeAny, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
status: "CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED"; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
assignedTo: string | null; | ||
modifiedAt: string; | ||
assignedTo: string | null; | ||
updatedBy: string; | ||
}, { | ||
type: string; | ||
id: string; | ||
type: string; | ||
status: "CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED"; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
assignedTo: string | null; | ||
modifiedAt: string; | ||
assignedTo: string | null; | ||
updatedBy: string; | ||
@@ -68,0 +68,0 @@ }>; |
@@ -9,2 +9,4 @@ import { z } from 'zod'; | ||
export type ParagraphFieldValue = z.infer<typeof ParagraphFieldValue>; | ||
declare const BulletListFieldValue: z.ZodString; | ||
export type BulletListFieldValue = z.infer<typeof BulletListFieldValue>; | ||
export declare const FileFieldValue: z.ZodNullable<z.ZodObject<{ | ||
@@ -26,3 +28,11 @@ filename: z.ZodString; | ||
export type RadioGroupFieldValue = z.infer<typeof RadioGroupFieldValue>; | ||
export type FieldTypeToFieldValue<T extends FieldType> = T extends 'TEXT' ? TextFieldValue : T extends 'PARAGRAPH' ? ParagraphFieldValue : T extends 'DATE' ? DateFieldValue : T extends 'FILE' ? FileFieldValue : T extends 'RADIO_GROUP' ? RadioGroupFieldValue : never; | ||
declare const CheckboxFieldValue: z.ZodEnum<["true", "false"]>; | ||
export type CheckboxFieldValue = z.infer<typeof CheckboxFieldValue>; | ||
declare const LocationFieldValue: z.ZodString; | ||
export type LocationFieldValue = z.infer<typeof LocationFieldValue>; | ||
declare const SelectFieldValue: z.ZodString; | ||
export type SelectFieldValue = z.infer<typeof SelectFieldValue>; | ||
declare const CountryFieldValue: z.ZodString; | ||
export type CountryFieldValue = z.infer<typeof CountryFieldValue>; | ||
export type FieldTypeToFieldValue<T extends FieldType> = T extends 'TEXT' ? TextFieldValue : T extends 'PARAGRAPH' ? ParagraphFieldValue : T extends 'BULLET_LIST' ? BulletListFieldValue : T extends 'DATE' ? DateFieldValue : T extends 'FILE' ? FileFieldValue : T extends 'RADIO_GROUP' ? RadioGroupFieldValue : T extends 'CHECKBOX' ? CheckboxFieldValue : T extends 'LOCATION' ? LocationFieldValue : T extends 'COUNTRY' ? CountryFieldValue : T extends 'SELECT' ? SelectFieldValue : never; | ||
export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodNullable<z.ZodString>, z.ZodString, z.ZodNullable<z.ZodObject<{ | ||
@@ -40,5 +50,5 @@ filename: z.ZodString; | ||
originalFilename: string; | ||
}>>, z.ZodString]>; | ||
}>>, z.ZodString, z.ZodEnum<["true", "false"]>, z.ZodString, z.ZodString]>; | ||
export type FieldValue = z.infer<typeof FieldValue>; | ||
export {}; | ||
//# sourceMappingURL=FieldValue.d.ts.map |
@@ -33,2 +33,3 @@ "use strict"; | ||
EventConfig: () => EventConfig, | ||
EventConfigInput: () => EventConfigInput, | ||
EventDocument: () => EventDocument, | ||
@@ -50,2 +51,3 @@ EventIndex: () => EventIndex, | ||
SummaryConfig: () => SummaryConfig, | ||
SummaryConfigInput: () => SummaryConfigInput, | ||
TranslationConfig: () => TranslationConfig, | ||
@@ -60,2 +62,3 @@ ValidateActionInput: () => ValidateActionInput, | ||
fieldTypes: () => fieldTypes, | ||
findInputPageFields: () => findInputPageFields, | ||
findPageFields: () => findPageFields, | ||
@@ -154,3 +157,4 @@ getAllFields: () => getAllFields, | ||
SELECT: "SELECT", | ||
COUNTRY: "COUNTRY" | ||
COUNTRY: "COUNTRY", | ||
LOCATION: "LOCATION" | ||
}; | ||
@@ -192,10 +196,10 @@ var fieldTypes = Object.values(FieldType); | ||
}).describe("File upload"); | ||
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 RadioGroup = BaseField.extend({ | ||
type: import_zod3.z.literal(FieldType.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") | ||
}) | ||
) | ||
options: import_zod3.z.array(SelectOption), | ||
flexDirection: import_zod3.z.enum(["row", "row-reverse", "column", "column-reverse"]).optional().describe("Direction to stack the options") | ||
}).describe("Grouped radio options"); | ||
@@ -207,6 +211,2 @@ var BulletList = BaseField.extend({ | ||
}).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({ | ||
@@ -222,2 +222,12 @@ type: import_zod3.z.literal(FieldType.SELECT), | ||
}).describe("Country select field"); | ||
var LocationOptions = import_zod3.z.object({ | ||
partOf: import_zod3.z.object({ | ||
$data: import_zod3.z.string() | ||
}).optional().describe("Parent location"), | ||
type: import_zod3.z.enum(["ADMIN_STRUCTURE", "HEALTH_FACILITY", "CRVS_OFFICE"]) | ||
}); | ||
var Location = BaseField.extend({ | ||
type: import_zod3.z.literal(FieldType.LOCATION), | ||
options: LocationOptions | ||
}).describe("Location input field"); | ||
var FieldConfig = import_zod3.z.discriminatedUnion("type", [ | ||
@@ -232,3 +242,4 @@ TextField, | ||
File, | ||
Country | ||
Country, | ||
Location | ||
]); | ||
@@ -326,18 +337,17 @@ | ||
var Field = import_zod6.z.object({ | ||
id: import_zod6.z.string().describe("Id of summary field"), | ||
value: TranslationConfig.describe( | ||
"Summary field value. Can utilise values defined in configuration and EventMetadata" | ||
), | ||
id: import_zod6.z.string().describe("Id of a field defined under form."), | ||
label: TranslationConfig, | ||
emptyValueMessage: TranslationConfig.optional() | ||
}); | ||
var Title = import_zod6.z.object({ | ||
id: import_zod6.z.string(), | ||
label: TranslationConfig.describe("Title content"), | ||
emptyValueMessage: TranslationConfig.optional() | ||
var FieldInput = Field.extend({ | ||
// label is enforced during runtime. | ||
label: TranslationConfig.optional() | ||
}); | ||
var SummaryConfig = import_zod6.z.object({ | ||
title: Title.describe("Title of summary view."), | ||
title: TranslationConfig.describe("Header title of summary"), | ||
fields: import_zod6.z.array(Field).describe("Fields rendered in summary view.") | ||
}).describe("Configuration for summary in event."); | ||
var SummaryConfigInput = SummaryConfig.extend({ | ||
fields: import_zod6.z.array(FieldInput) | ||
}); | ||
@@ -516,2 +526,5 @@ // ../commons/src/events/WorkqueueConfig.ts | ||
}); | ||
var EventConfigInput = EventConfig.extend({ | ||
summary: SummaryConfigInput | ||
}); | ||
var defineForm = (form) => FormConfig.parse(form); | ||
@@ -538,2 +551,3 @@ var defineFormPage = (formPage) => FormPage.parse(formPage); | ||
var ParagraphFieldValue = import_zod12.z.string(); | ||
var BulletListFieldValue = import_zod12.z.string(); | ||
var FileFieldValue = import_zod12.z.object({ | ||
@@ -545,2 +559,6 @@ filename: import_zod12.z.string(), | ||
var RadioGroupFieldValue = import_zod12.z.string(); | ||
var CheckboxFieldValue = import_zod12.z.enum(["true", "false"]); | ||
var LocationFieldValue = import_zod12.z.string(); | ||
var SelectFieldValue = import_zod12.z.string(); | ||
var CountryFieldValue = import_zod12.z.string(); | ||
var FieldValue = import_zod12.z.union([ | ||
@@ -551,3 +569,6 @@ TextFieldValue, | ||
FileFieldValue, | ||
RadioGroupFieldValue | ||
RadioGroupFieldValue, | ||
CheckboxFieldValue, | ||
LocationFieldValue, | ||
SelectFieldValue | ||
]); | ||
@@ -777,3 +798,3 @@ | ||
var isMetadataField = (field) => field in eventMetadataLabelMap; | ||
var findPageFields = (config) => { | ||
var findInputPageFields = (config) => { | ||
return (0, import_lodash.flattenDeep)( | ||
@@ -783,7 +804,3 @@ config.actions.map( | ||
({ pages }) => pages.map( | ||
({ fields }) => fields.map(({ id, label, type }) => ({ | ||
id, | ||
label, | ||
type | ||
})) | ||
({ fields }) => fields.map(({ id, label }) => ({ id, label })) | ||
) | ||
@@ -794,2 +811,9 @@ ) | ||
}; | ||
var findPageFields = (config) => { | ||
return (0, import_lodash.flattenDeep)( | ||
config.actions.map( | ||
({ forms }) => forms.map(({ pages }) => pages.map(({ fields }) => fields)) | ||
) | ||
); | ||
}; | ||
var resolveLabelsFromKnownFields = ({ | ||
@@ -837,9 +861,10 @@ pageFields, | ||
var defineConfig = (config) => { | ||
const input = EventConfig.parse(config); | ||
const pageFields = findPageFields(input).map(({ id, label }) => ({ | ||
id, | ||
label | ||
})); | ||
const input = EventConfigInput.parse(config); | ||
const pageFields = findInputPageFields(input); | ||
return EventConfig.parse({ | ||
...input, | ||
summary: resolveFieldLabels({ | ||
config: input.summary, | ||
pageFields | ||
}), | ||
workqueues: input.workqueues.map( | ||
@@ -846,0 +871,0 @@ (workqueue) => resolveFieldLabels({ |
@@ -5,2 +5,15 @@ import { z } from 'zod'; | ||
id: z.ZodString; | ||
defaultMessage: z.ZodString; | ||
description: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>; | ||
fields: z.ZodArray<z.ZodObject<{ | ||
id: z.ZodString; | ||
label: z.ZodObject<{ | ||
@@ -12,8 +25,8 @@ id: z.ZodString; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -26,8 +39,8 @@ emptyValueMessage: z.ZodOptional<z.ZodObject<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>>; | ||
@@ -38,9 +51,9 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -51,14 +64,67 @@ }, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
title: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
fields: { | ||
id: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}[]; | ||
}, { | ||
title: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
fields: { | ||
id: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}[]; | ||
}>; | ||
export declare const SummaryConfigInput: z.ZodObject<z.objectUtil.extendShape<{ | ||
title: z.ZodObject<{ | ||
id: z.ZodString; | ||
defaultMessage: z.ZodString; | ||
description: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>; | ||
fields: z.ZodArray<z.ZodObject<{ | ||
id: z.ZodString; | ||
value: z.ZodObject<{ | ||
label: z.ZodObject<{ | ||
id: z.ZodString; | ||
@@ -69,9 +135,50 @@ defaultMessage: z.ZodString; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>; | ||
emptyValueMessage: z.ZodOptional<z.ZodObject<{ | ||
id: z.ZodString; | ||
defaultMessage: z.ZodString; | ||
description: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
}>; | ||
defaultMessage: string; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}, { | ||
id: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}>, "many">; | ||
}, { | ||
fields: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{ | ||
id: z.ZodString; | ||
label: z.ZodObject<{ | ||
@@ -83,8 +190,8 @@ id: z.ZodString; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -97,74 +204,65 @@ emptyValueMessage: z.ZodOptional<z.ZodObject<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
}, { | ||
label: z.ZodOptional<z.ZodObject<{ | ||
id: z.ZodString; | ||
defaultMessage: z.ZodString; | ||
description: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>>; | ||
}, "strip", z.ZodTypeAny, { | ||
}>, "strip", z.ZodTypeAny, { | ||
id: string; | ||
value: { | ||
label?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
} | undefined; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
}, { | ||
id: string; | ||
value: { | ||
label?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
} | undefined; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
}>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
}>, "strip", z.ZodTypeAny, { | ||
title: { | ||
id: string; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
fields: { | ||
id: string; | ||
value: { | ||
label?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
} | undefined; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -175,29 +273,16 @@ }[]; | ||
id: string; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
fields: { | ||
id: string; | ||
value: { | ||
label?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
} | undefined; | ||
emptyValueMessage?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -207,2 +292,3 @@ }[]; | ||
export type SummaryConfig = z.infer<typeof SummaryConfig>; | ||
export type SummaryConfigInput = z.input<typeof SummaryConfigInput>; | ||
//# sourceMappingURL=SummaryConfig.d.ts.map |
import { TranslationConfig } from './TranslationConfig'; | ||
import { EventMetadataKeys } from './EventMetadata'; | ||
import { EventConfig, EventConfigInput } from './EventConfig'; | ||
import { SummaryConfigInput } from './SummaryConfig'; | ||
import { WorkqueueConfigInput } from './WorkqueueConfig'; | ||
import { FieldType } from './FieldConfig'; | ||
import { FieldConfig } from './FieldConfig'; | ||
/** | ||
* @returns All the fields in the event configuration. | ||
* @returns All the fields in the event configuration input. | ||
*/ | ||
export declare const findPageFields: (config: EventConfigInput) => Array<{ | ||
export declare const findInputPageFields: (config: EventConfigInput) => { | ||
id: string; | ||
label: TranslationConfig; | ||
type: FieldType; | ||
}>; | ||
}[]; | ||
/** | ||
* @returns All the fields in the event configuration. | ||
*/ | ||
export declare const findPageFields: (config: EventConfig) => FieldConfig[]; | ||
/** | ||
* | ||
@@ -34,3 +38,3 @@ * @param pageFields - All the fields in the event configuration | ||
export declare const resolveFieldLabels: ({ config, pageFields }: { | ||
config: WorkqueueConfigInput; | ||
config: SummaryConfigInput | WorkqueueConfigInput; | ||
pageFields: { | ||
@@ -45,19 +49,29 @@ id: string; | ||
}[]; | ||
title: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
} | { | ||
fields: { | ||
id: EventMetadataKeys | string; | ||
label?: TranslationConfig; | ||
}[]; | ||
id: string; | ||
title: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
filters: { | ||
status: ("CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED")[]; | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
}[]; | ||
}; | ||
export declare function getAllFields(configuration: EventConfig): ({ | ||
type: "TEXT"; | ||
id: string; | ||
type: "TEXT"; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -71,4 +85,4 @@ options?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -97,12 +111,12 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
} | { | ||
type: "DATE"; | ||
id: string; | ||
type: "DATE"; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -112,4 +126,4 @@ options?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -120,4 +134,4 @@ } | undefined; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -146,6 +160,7 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
} | { | ||
type: "PARAGRAPH"; | ||
id: string; | ||
@@ -155,7 +170,6 @@ options: { | ||
}; | ||
type: "PARAGRAPH"; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -165,4 +179,4 @@ validation?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -191,16 +205,59 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
} | { | ||
type: "FILE"; | ||
id: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
validation?: { | ||
message: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
validator: import("../client").JSONSchema; | ||
}[] | undefined; | ||
required?: boolean | undefined; | ||
conditionals?: ({ | ||
type: "SHOW"; | ||
conditional: import("../client").JSONSchema; | ||
} | { | ||
type: "HIDE"; | ||
conditional: import("../client").JSONSchema; | ||
} | { | ||
type: "ENABLE"; | ||
conditional: import("../client").JSONSchema; | ||
})[] | undefined; | ||
dependsOn?: string[] | undefined; | ||
initialValue?: string | { | ||
dependsOn: string[]; | ||
expression: string; | ||
} | undefined; | ||
disabled?: boolean | undefined; | ||
hidden?: boolean | undefined; | ||
placeholder?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
} | { | ||
type: "RADIO_GROUP"; | ||
id: string; | ||
options: { | ||
value: string; | ||
label: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}[]; | ||
type: "RADIO_GROUP"; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -210,4 +267,4 @@ validation?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -236,17 +293,18 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
flexDirection?: "row" | "row-reverse" | "column" | "column-reverse" | undefined; | ||
} | { | ||
type: "BULLET_LIST"; | ||
id: string; | ||
type: "BULLET_LIST"; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
items: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}[]; | ||
@@ -257,4 +315,4 @@ font: "reg12" | "reg14" | "reg16" | "reg18" | "h4" | "h3" | "h2" | "h1"; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -283,6 +341,7 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
} | { | ||
type: "SELECT"; | ||
id: string; | ||
@@ -293,11 +352,10 @@ options: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
}[]; | ||
type: "SELECT"; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -307,4 +365,4 @@ validation?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -333,12 +391,12 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
} | { | ||
type: "CHECKBOX"; | ||
id: string; | ||
type: "CHECKBOX"; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -348,4 +406,4 @@ validation?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -374,12 +432,12 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
} | { | ||
type: "COUNTRY"; | ||
id: string; | ||
type: "FILE"; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -389,4 +447,4 @@ validation?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -415,12 +473,18 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
} | { | ||
type: "LOCATION"; | ||
id: string; | ||
type: "COUNTRY"; | ||
options: { | ||
type: "ADMIN_STRUCTURE" | "HEALTH_FACILITY" | "CRVS_OFFICE"; | ||
partOf?: { | ||
$data: string; | ||
} | undefined; | ||
}; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -430,4 +494,4 @@ validation?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -456,6 +520,6 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
})[]; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -13,8 +13,8 @@ import { z } from 'zod'; | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>; | ||
@@ -29,8 +29,8 @@ fields: z.ZodArray<z.ZodObject<{ | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}>>; | ||
@@ -41,4 +41,4 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -49,4 +49,4 @@ }, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
@@ -64,5 +64,5 @@ }>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
status: ("CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED")[]; | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
}, { | ||
status: ("CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED")[]; | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
}>, "many">; | ||
@@ -73,4 +73,4 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -81,8 +81,8 @@ fields: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
}[]; | ||
filters: { | ||
status: ("CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED")[]; | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
}[]; | ||
@@ -93,4 +93,4 @@ }, { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
@@ -101,8 +101,8 @@ fields: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
description: string; | ||
} | undefined; | ||
}[]; | ||
filters: { | ||
status: ("CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED")[]; | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
}[]; | ||
@@ -109,0 +109,0 @@ }>; |
{ | ||
"name": "@opencrvs/toolkit", | ||
"version": "0.0.16-events", | ||
"version": "0.0.17-events", | ||
"description": "OpenCRVS toolkit for building country configurations", | ||
@@ -5,0 +5,0 @@ "license": "MPL-2.0", |
@@ -12,15 +12,15 @@ /* | ||
import { Clause, ClauseInput, ClauseOutput } from '@opencrvs/commons/events' | ||
import { Clause } from '@opencrvs/commons/events' | ||
export function and(clauses: ClauseInput[]): ClauseOutput { | ||
export function and(clauses: Clause[]): Clause { | ||
return { | ||
type: 'and', | ||
clauses: clauses.map((clause) => Clause.parse(clause)) | ||
clauses | ||
} | ||
} | ||
export function or(clauses: ClauseInput[]): ClauseOutput { | ||
export function or(clauses: Clause[]): Clause { | ||
return { | ||
type: 'or', | ||
clauses: clauses.map((clause) => Clause.parse(clause)) | ||
clauses | ||
} | ||
@@ -27,0 +27,0 @@ } |
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
5082365
60.69%122334
57.23%