@opencrvs/toolkit
Advanced tools
Comparing version 0.0.14-events to 0.0.16-events
@@ -1,4 +0,4 @@ | ||
import { Clause } from '@opencrvs/commons/events'; | ||
export declare function and(clauses: Clause[]): Clause; | ||
export declare function or(clauses: Clause[]): Clause; | ||
import { ClauseInput, ClauseOutput } from '@opencrvs/commons/events'; | ||
export declare function and(clauses: ClauseInput[]): ClauseOutput; | ||
export declare function or(clauses: ClauseInput[]): ClauseOutput; | ||
export declare function field(fieldId: string): { | ||
@@ -5,0 +5,0 @@ fuzzyMatches: (options?: { |
@@ -16,6 +16,7 @@ "use strict"; | ||
exports.field = field; | ||
const events_1 = require("@opencrvs/commons/events"); | ||
function and(clauses) { | ||
return { | ||
type: 'and', | ||
clauses | ||
clauses: clauses.map((clause) => events_1.Clause.parse(clause)) | ||
}; | ||
@@ -26,3 +27,3 @@ } | ||
type: 'or', | ||
clauses | ||
clauses: clauses.map((clause) => events_1.Clause.parse(clause)) | ||
}; | ||
@@ -29,0 +30,0 @@ } |
@@ -41,6 +41,589 @@ "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: clauses.map((clause) => Clause.parse(clause)) | ||
}; | ||
@@ -51,3 +634,3 @@ } | ||
type: "or", | ||
clauses | ||
clauses: clauses.map((clause) => Clause.parse(clause)) | ||
}; | ||
@@ -54,0 +637,0 @@ } |
@@ -24,3 +24,4 @@ import { z } from 'zod'; | ||
type: "CREATE"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -31,7 +32,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CREATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -42,4 +44,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -70,3 +70,4 @@ draft?: boolean | undefined; | ||
type: "CREATE"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -77,7 +78,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CREATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -88,4 +90,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -115,3 +115,4 @@ draft?: boolean | undefined; | ||
type: "VALIDATE"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -122,7 +123,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
}, { | ||
type: "VALIDATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -133,4 +135,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -160,3 +160,4 @@ draft?: boolean | undefined; | ||
type: "NOTIFY"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -167,7 +168,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
}, { | ||
type: "NOTIFY"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -178,4 +180,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -215,3 +215,4 @@ draft?: boolean | undefined; | ||
type: "REGISTER"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -222,4 +223,3 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
@@ -232,2 +232,4 @@ identifiers: { | ||
type: "REGISTER"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -238,4 +240,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -269,3 +269,4 @@ identifiers: { | ||
type: "DECLARE"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -276,7 +277,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
}, { | ||
type: "DECLARE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -287,4 +289,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -315,3 +315,4 @@ draft?: boolean | undefined; | ||
type: "ASSIGN"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -322,4 +323,3 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
@@ -329,2 +329,4 @@ assignedTo: string; | ||
type: "ASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -335,4 +337,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -363,3 +363,4 @@ assignedTo: string; | ||
type: "UNASSIGN"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -370,7 +371,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
}, { | ||
type: "UNASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -381,4 +383,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -408,3 +408,4 @@ draft?: boolean | undefined; | ||
type: "CUSTOM"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -415,7 +416,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CUSTOM"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -426,4 +428,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -430,0 +430,0 @@ draft?: boolean | undefined; |
@@ -33,3 +33,3 @@ import { z } from 'zod'; | ||
type: "REGISTER"; | ||
draft: boolean; | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -40,3 +40,3 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
draft: boolean; | ||
identifiers: { | ||
@@ -48,2 +48,3 @@ trackingId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -54,3 +55,2 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
identifiers: { | ||
@@ -86,3 +86,3 @@ trackingId: string; | ||
type: "VALIDATE"; | ||
draft: boolean; | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -93,6 +93,7 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
draft: boolean; | ||
eventId: string; | ||
duplicates: string[]; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -103,3 +104,2 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
eventId: string; | ||
@@ -133,3 +133,3 @@ duplicates: string[]; | ||
type: "NOTIFY"; | ||
draft: boolean; | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -140,6 +140,7 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
eventId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -150,3 +151,2 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
createdAtLocation: string; | ||
@@ -179,3 +179,3 @@ eventId: string; | ||
type: "DECLARE"; | ||
draft: boolean; | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -186,5 +186,6 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
draft: boolean; | ||
eventId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -195,3 +196,2 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
eventId: string; | ||
@@ -232,3 +232,3 @@ type?: "DECLARE" | undefined; | ||
type: "CREATE"; | ||
draft: boolean; | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -239,6 +239,7 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
eventId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -249,3 +250,2 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
createdAtLocation: string; | ||
@@ -277,3 +277,3 @@ eventId: string; | ||
type: "VALIDATE"; | ||
draft: boolean; | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -284,6 +284,7 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
draft: boolean; | ||
eventId: string; | ||
duplicates: string[]; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -294,3 +295,2 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
eventId: string; | ||
@@ -331,3 +331,3 @@ duplicates: string[]; | ||
type: "REGISTER"; | ||
draft: boolean; | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -338,3 +338,3 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
draft: boolean; | ||
identifiers: { | ||
@@ -346,2 +346,3 @@ trackingId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -352,3 +353,2 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
identifiers: { | ||
@@ -383,3 +383,3 @@ trackingId: string; | ||
type: "NOTIFY"; | ||
draft: boolean; | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -390,6 +390,7 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
eventId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -400,3 +401,2 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
createdAtLocation: string; | ||
@@ -427,3 +427,3 @@ eventId: string; | ||
type: "DECLARE"; | ||
draft: boolean; | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -434,5 +434,6 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
draft: boolean; | ||
eventId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -443,3 +444,2 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
eventId: string; | ||
@@ -470,3 +470,3 @@ type?: "DECLARE" | undefined; | ||
type: "ASSIGN"; | ||
draft: boolean; | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -477,6 +477,7 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
draft: boolean; | ||
assignedTo: string; | ||
eventId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -487,3 +488,2 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
assignedTo: string; | ||
@@ -514,3 +514,3 @@ eventId: string; | ||
type: "UNASSIGN"; | ||
draft: boolean; | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -521,5 +521,6 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
draft: boolean; | ||
eventId: string; | ||
}, { | ||
transactionId: string; | ||
data: Record<string, string | { | ||
@@ -530,3 +531,2 @@ type: string; | ||
} | null>; | ||
transactionId: string; | ||
eventId: string; | ||
@@ -533,0 +533,0 @@ type?: "UNASSIGN" | undefined; |
@@ -115,12 +115,3 @@ import { z } from 'zod'; | ||
}>; | ||
export type And = { | ||
type: 'and'; | ||
clauses: any[]; | ||
}; | ||
export type Or = { | ||
type: 'or'; | ||
clauses: any[]; | ||
}; | ||
export type Clause = And | Or | z.infer<typeof FuzzyMatcher> | z.infer<typeof StrictMatcher> | z.infer<typeof DateRangeMatcher>; | ||
export declare const Clause: z.ZodUnion<[z.ZodType<And, z.ZodTypeDef, And>, z.ZodType<Or, z.ZodTypeDef, Or>, z.ZodObject<z.objectUtil.extendShape<{ | ||
declare const DateDistanceMatcher: z.ZodObject<z.objectUtil.extendShape<{ | ||
fieldId: z.ZodString; | ||
@@ -135,112 +126,2 @@ options: z.ZodDefault<z.ZodOptional<z.ZodObject<{ | ||
}, { | ||
type: z.ZodLiteral<"fuzzy">; | ||
options: z.ZodDefault<z.ZodOptional<z.ZodObject<{ | ||
/** | ||
* 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: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>; | ||
boost: z.ZodDefault<z.ZodOptional<z.ZodNumber>>; | ||
}, "strip", z.ZodTypeAny, { | ||
boost: number; | ||
fuzziness: string | number; | ||
}, { | ||
boost?: number | undefined; | ||
fuzziness?: string | number | undefined; | ||
}>>>; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "fuzzy"; | ||
options: { | ||
boost: number; | ||
fuzziness: string | number; | ||
}; | ||
fieldId: string; | ||
}, { | ||
type: "fuzzy"; | ||
fieldId: string; | ||
options?: { | ||
boost?: number | undefined; | ||
fuzziness?: string | number | undefined; | ||
} | undefined; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
fieldId: z.ZodString; | ||
options: z.ZodDefault<z.ZodOptional<z.ZodObject<{ | ||
boost: z.ZodOptional<z.ZodNumber>; | ||
}, "strip", z.ZodTypeAny, { | ||
boost?: number | undefined; | ||
}, { | ||
boost?: number | undefined; | ||
}>>>; | ||
}, { | ||
type: z.ZodLiteral<"strict">; | ||
options: z.ZodDefault<z.ZodOptional<z.ZodObject<{ | ||
boost: z.ZodDefault<z.ZodOptional<z.ZodNumber>>; | ||
}, "strip", z.ZodTypeAny, { | ||
boost: number; | ||
}, { | ||
boost?: number | undefined; | ||
}>>>; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "strict"; | ||
options: { | ||
boost: number; | ||
}; | ||
fieldId: string; | ||
}, { | ||
type: "strict"; | ||
fieldId: string; | ||
options?: { | ||
boost?: number | undefined; | ||
} | undefined; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
fieldId: z.ZodString; | ||
options: z.ZodDefault<z.ZodOptional<z.ZodObject<{ | ||
boost: z.ZodOptional<z.ZodNumber>; | ||
}, "strip", z.ZodTypeAny, { | ||
boost?: number | undefined; | ||
}, { | ||
boost?: number | undefined; | ||
}>>>; | ||
}, { | ||
type: z.ZodLiteral<"dateRange">; | ||
options: z.ZodObject<{ | ||
days: z.ZodNumber; | ||
origin: z.ZodString; | ||
boost: z.ZodDefault<z.ZodOptional<z.ZodNumber>>; | ||
}, "strip", z.ZodTypeAny, { | ||
boost: number; | ||
days: number; | ||
origin: string; | ||
}, { | ||
days: number; | ||
origin: string; | ||
boost?: number | undefined; | ||
}>; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "dateRange"; | ||
options: { | ||
boost: number; | ||
days: number; | ||
origin: string; | ||
}; | ||
fieldId: string; | ||
}, { | ||
type: "dateRange"; | ||
options: { | ||
days: number; | ||
origin: string; | ||
boost?: number | undefined; | ||
}; | ||
fieldId: string; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
fieldId: z.ZodString; | ||
options: z.ZodDefault<z.ZodOptional<z.ZodObject<{ | ||
boost: z.ZodOptional<z.ZodNumber>; | ||
}, "strip", z.ZodTypeAny, { | ||
boost?: number | undefined; | ||
}, { | ||
boost?: number | undefined; | ||
}>>>; | ||
}, { | ||
type: z.ZodLiteral<"dateDistance">; | ||
@@ -276,3 +157,30 @@ options: z.ZodObject<{ | ||
fieldId: string; | ||
}>]>; | ||
}>; | ||
export type AndInput = { | ||
type: 'and'; | ||
clauses: ClauseInput[]; | ||
}; | ||
export type AndOutput = { | ||
type: 'and'; | ||
clauses: ClauseOutput[]; | ||
}; | ||
export type OrInput = { | ||
type: 'or'; | ||
clauses: ClauseInput[]; | ||
}; | ||
export type OrOutput = { | ||
type: 'or'; | ||
clauses: ClauseOutput[]; | ||
}; | ||
export type ClauseInput = AndInput | OrInput | z.input<typeof FuzzyMatcher> | z.input<typeof StrictMatcher> | z.input<typeof DateRangeMatcher> | z.input<typeof DateDistanceMatcher>; | ||
export type ClauseOutput = AndOutput | OrOutput | z.output<typeof FuzzyMatcher> | z.output<typeof StrictMatcher> | z.output<typeof DateRangeMatcher> | z.output<typeof DateDistanceMatcher>; | ||
/** | ||
* Defines a deduplication clause. Clauses are either matcher clauses or logical clauses. Logical clauses (and, or) are used to combine multiple clauses. | ||
* Since the definiton is recursive, we use z.lazy to define the schema. | ||
* Zod supports recursive schemas, but needs help with Input and Output types. | ||
* | ||
* Default assumption is that the ZodType is the input. Markers use default values, so we need to explicitly define output type, too. | ||
* | ||
*/ | ||
export declare const Clause: z.ZodType<ClauseOutput, z.ZodTypeDef, ClauseInput>; | ||
export declare const DeduplicationConfig: z.ZodObject<{ | ||
@@ -286,160 +194,10 @@ id: z.ZodString; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}, { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>; | ||
query: z.ZodUnion<[z.ZodType<And, z.ZodTypeDef, And>, z.ZodType<Or, z.ZodTypeDef, Or>, z.ZodObject<z.objectUtil.extendShape<{ | ||
fieldId: z.ZodString; | ||
options: z.ZodDefault<z.ZodOptional<z.ZodObject<{ | ||
boost: z.ZodOptional<z.ZodNumber>; | ||
}, "strip", z.ZodTypeAny, { | ||
boost?: number | undefined; | ||
}, { | ||
boost?: number | undefined; | ||
}>>>; | ||
}, { | ||
type: z.ZodLiteral<"fuzzy">; | ||
options: z.ZodDefault<z.ZodOptional<z.ZodObject<{ | ||
/** | ||
* 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: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>; | ||
boost: z.ZodDefault<z.ZodOptional<z.ZodNumber>>; | ||
}, "strip", z.ZodTypeAny, { | ||
boost: number; | ||
fuzziness: string | number; | ||
}, { | ||
boost?: number | undefined; | ||
fuzziness?: string | number | undefined; | ||
}>>>; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "fuzzy"; | ||
options: { | ||
boost: number; | ||
fuzziness: string | number; | ||
}; | ||
fieldId: string; | ||
}, { | ||
type: "fuzzy"; | ||
fieldId: string; | ||
options?: { | ||
boost?: number | undefined; | ||
fuzziness?: string | number | undefined; | ||
} | undefined; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
fieldId: z.ZodString; | ||
options: z.ZodDefault<z.ZodOptional<z.ZodObject<{ | ||
boost: z.ZodOptional<z.ZodNumber>; | ||
}, "strip", z.ZodTypeAny, { | ||
boost?: number | undefined; | ||
}, { | ||
boost?: number | undefined; | ||
}>>>; | ||
}, { | ||
type: z.ZodLiteral<"strict">; | ||
options: z.ZodDefault<z.ZodOptional<z.ZodObject<{ | ||
boost: z.ZodDefault<z.ZodOptional<z.ZodNumber>>; | ||
}, "strip", z.ZodTypeAny, { | ||
boost: number; | ||
}, { | ||
boost?: number | undefined; | ||
}>>>; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "strict"; | ||
options: { | ||
boost: number; | ||
}; | ||
fieldId: string; | ||
}, { | ||
type: "strict"; | ||
fieldId: string; | ||
options?: { | ||
boost?: number | undefined; | ||
} | undefined; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
fieldId: z.ZodString; | ||
options: z.ZodDefault<z.ZodOptional<z.ZodObject<{ | ||
boost: z.ZodOptional<z.ZodNumber>; | ||
}, "strip", z.ZodTypeAny, { | ||
boost?: number | undefined; | ||
}, { | ||
boost?: number | undefined; | ||
}>>>; | ||
}, { | ||
type: z.ZodLiteral<"dateRange">; | ||
options: z.ZodObject<{ | ||
days: z.ZodNumber; | ||
origin: z.ZodString; | ||
boost: z.ZodDefault<z.ZodOptional<z.ZodNumber>>; | ||
}, "strip", z.ZodTypeAny, { | ||
boost: number; | ||
days: number; | ||
origin: string; | ||
}, { | ||
days: number; | ||
origin: string; | ||
boost?: number | undefined; | ||
}>; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "dateRange"; | ||
options: { | ||
boost: number; | ||
days: number; | ||
origin: string; | ||
}; | ||
fieldId: string; | ||
}, { | ||
type: "dateRange"; | ||
options: { | ||
days: number; | ||
origin: string; | ||
boost?: number | undefined; | ||
}; | ||
fieldId: string; | ||
}>, z.ZodObject<z.objectUtil.extendShape<{ | ||
fieldId: z.ZodString; | ||
options: z.ZodDefault<z.ZodOptional<z.ZodObject<{ | ||
boost: z.ZodOptional<z.ZodNumber>; | ||
}, "strip", z.ZodTypeAny, { | ||
boost?: number | undefined; | ||
}, { | ||
boost?: number | undefined; | ||
}>>>; | ||
}, { | ||
type: z.ZodLiteral<"dateDistance">; | ||
options: z.ZodObject<{ | ||
days: z.ZodNumber; | ||
origin: z.ZodString; | ||
boost: z.ZodDefault<z.ZodOptional<z.ZodNumber>>; | ||
}, "strip", z.ZodTypeAny, { | ||
boost: number; | ||
days: number; | ||
origin: string; | ||
}, { | ||
days: number; | ||
origin: string; | ||
boost?: number | undefined; | ||
}>; | ||
}>, "strip", z.ZodTypeAny, { | ||
type: "dateDistance"; | ||
options: { | ||
boost: number; | ||
days: number; | ||
origin: string; | ||
}; | ||
fieldId: string; | ||
}, { | ||
type: "dateDistance"; | ||
options: { | ||
days: number; | ||
origin: string; | ||
boost?: number | undefined; | ||
}; | ||
fieldId: string; | ||
}>]>; | ||
query: z.ZodType<ClauseOutput, z.ZodTypeDef, ClauseInput>; | ||
}, "strip", z.ZodTypeAny, { | ||
@@ -449,35 +207,6 @@ id: string; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
query: { | ||
type: "fuzzy"; | ||
options: { | ||
boost: number; | ||
fuzziness: string | number; | ||
}; | ||
fieldId: string; | ||
} | { | ||
type: "strict"; | ||
options: { | ||
boost: number; | ||
}; | ||
fieldId: string; | ||
} | { | ||
type: "dateRange"; | ||
options: { | ||
boost: number; | ||
days: number; | ||
origin: string; | ||
}; | ||
fieldId: string; | ||
} | { | ||
type: "dateDistance"; | ||
options: { | ||
boost: number; | ||
days: number; | ||
origin: string; | ||
}; | ||
fieldId: string; | ||
} | And | Or; | ||
query: ClauseOutput; | ||
}, { | ||
@@ -487,35 +216,6 @@ id: string; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
query: { | ||
type: "fuzzy"; | ||
fieldId: string; | ||
options?: { | ||
boost?: number | undefined; | ||
fuzziness?: string | number | undefined; | ||
} | undefined; | ||
} | { | ||
type: "strict"; | ||
fieldId: string; | ||
options?: { | ||
boost?: number | undefined; | ||
} | undefined; | ||
} | { | ||
type: "dateRange"; | ||
options: { | ||
days: number; | ||
origin: string; | ||
boost?: number | undefined; | ||
}; | ||
fieldId: string; | ||
} | { | ||
type: "dateDistance"; | ||
options: { | ||
days: number; | ||
origin: string; | ||
boost?: number | undefined; | ||
}; | ||
fieldId: string; | ||
} | And | Or; | ||
query: ClauseInput; | ||
}>; | ||
@@ -522,0 +222,0 @@ export type DeduplicationConfig = z.infer<typeof DeduplicationConfig>; |
@@ -30,3 +30,4 @@ import { z } from 'zod'; | ||
type: "CREATE"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -37,7 +38,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CREATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -48,4 +50,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -75,3 +75,4 @@ draft?: boolean | undefined; | ||
type: "VALIDATE"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -82,7 +83,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
}, { | ||
type: "VALIDATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -93,4 +95,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -120,3 +120,4 @@ draft?: boolean | undefined; | ||
type: "NOTIFY"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -127,7 +128,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
}, { | ||
type: "NOTIFY"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -138,4 +140,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -175,3 +175,4 @@ draft?: boolean | undefined; | ||
type: "REGISTER"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -182,4 +183,3 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
@@ -192,2 +192,4 @@ identifiers: { | ||
type: "REGISTER"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -198,4 +200,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -229,3 +229,4 @@ identifiers: { | ||
type: "DECLARE"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -236,7 +237,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
}, { | ||
type: "DECLARE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -247,4 +249,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -275,3 +275,4 @@ draft?: boolean | undefined; | ||
type: "ASSIGN"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -282,4 +283,3 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
@@ -289,2 +289,4 @@ assignedTo: string; | ||
type: "ASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -295,4 +297,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -323,3 +323,4 @@ assignedTo: string; | ||
type: "UNASSIGN"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -330,7 +331,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
}, { | ||
type: "UNASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -341,4 +343,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -368,3 +368,4 @@ draft?: boolean | undefined; | ||
type: "CUSTOM"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -375,7 +376,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
}, { | ||
type: "CUSTOM"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -386,4 +388,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -393,10 +393,8 @@ draft?: boolean | undefined; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
type: string; | ||
id: string; | ||
transactionId: string; | ||
createdAt: string; | ||
updatedAt: string; | ||
actions: ({ | ||
type: "CREATE"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -407,8 +405,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
} | { | ||
type: "VALIDATE"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -419,8 +417,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
} | { | ||
type: "NOTIFY"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -431,8 +429,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
} | { | ||
type: "REGISTER"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -443,4 +441,3 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
@@ -453,3 +450,4 @@ identifiers: { | ||
type: "DECLARE"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -460,8 +458,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
} | { | ||
type: "ASSIGN"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -472,4 +470,3 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
@@ -479,3 +476,4 @@ assignedTo: string; | ||
type: "UNASSIGN"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -486,8 +484,8 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
createdAtLocation: string; | ||
} | { | ||
type: "CUSTOM"; | ||
draft: boolean; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -498,14 +496,15 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
draft: boolean; | ||
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 | { | ||
@@ -516,4 +515,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -523,2 +520,4 @@ draft?: boolean | undefined; | ||
type: "VALIDATE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -529,4 +528,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -536,2 +533,4 @@ draft?: boolean | undefined; | ||
type: "NOTIFY"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -542,4 +541,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -549,2 +546,4 @@ draft?: boolean | undefined; | ||
type: "REGISTER"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -555,4 +554,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -566,2 +563,4 @@ identifiers: { | ||
type: "DECLARE"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -572,4 +571,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -579,2 +576,4 @@ draft?: boolean | undefined; | ||
type: "ASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -585,4 +584,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -593,2 +590,4 @@ assignedTo: string; | ||
type: "UNASSIGN"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -599,4 +598,2 @@ type: string; | ||
} | null>; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
@@ -606,2 +603,4 @@ draft?: boolean | undefined; | ||
type: "CUSTOM"; | ||
createdAt: string; | ||
createdBy: string; | ||
data: Record<string, string | { | ||
@@ -612,9 +611,10 @@ 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, { | ||
id: string; | ||
type: string; | ||
id: string; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
data: Record<string, any>; | ||
status: "CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED"; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
modifiedAt: string; | ||
assignedTo: string | null; | ||
modifiedAt: string; | ||
updatedBy: string; | ||
data: Record<string, any>; | ||
}, { | ||
id: string; | ||
type: string; | ||
id: string; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
data: Record<string, any>; | ||
status: "CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED"; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
modifiedAt: string; | ||
assignedTo: string | null; | ||
modifiedAt: string; | ||
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: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
export declare const eventStatuses: ("CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED")[]; | ||
export declare const EventStatuses: z.ZodNativeEnum<{ | ||
@@ -48,20 +48,20 @@ readonly CREATED: "CREATED"; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
type: string; | ||
id: string; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
status: "CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED"; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
modifiedAt: string; | ||
assignedTo: string | null; | ||
modifiedAt: string; | ||
updatedBy: string; | ||
}, { | ||
id: string; | ||
type: string; | ||
id: string; | ||
status: "CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED"; | ||
status: "CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED"; | ||
createdAt: string; | ||
createdBy: string; | ||
createdAtLocation: string; | ||
modifiedAt: string; | ||
assignedTo: string | null; | ||
modifiedAt: string; | ||
updatedBy: string; | ||
@@ -68,0 +68,0 @@ }>; |
@@ -33,3 +33,2 @@ "use strict"; | ||
EventConfig: () => EventConfig, | ||
EventConfigInput: () => EventConfigInput, | ||
EventDocument: () => EventDocument, | ||
@@ -51,3 +50,2 @@ EventIndex: () => EventIndex, | ||
SummaryConfig: () => SummaryConfig, | ||
SummaryConfigInput: () => SummaryConfigInput, | ||
TranslationConfig: () => TranslationConfig, | ||
@@ -204,3 +202,3 @@ ValidateActionInput: () => ValidateActionInput, | ||
items: import_zod3.z.array(TranslationConfig).describe("A list of items"), | ||
font: HTMLFontVariant.optional() | ||
font: HTMLFontVariant | ||
}).describe("A list of bullet points"); | ||
@@ -323,17 +321,18 @@ var SelectOption = import_zod3.z.object({ | ||
var Field = import_zod6.z.object({ | ||
id: import_zod6.z.string().describe("Id of a field defined under form."), | ||
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 FieldInput = Field.extend({ | ||
// label is enforced during runtime. | ||
label: 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: TranslationConfig.describe("Header title of summary"), | ||
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."); | ||
var SummaryConfigInput = SummaryConfig.extend({ | ||
fields: import_zod6.z.array(FieldInput) | ||
}); | ||
@@ -485,10 +484,12 @@ // ../commons/src/events/WorkqueueConfig.ts | ||
}); | ||
var Clause = import_zod9.z.union([ | ||
And, | ||
Or, | ||
FuzzyMatcher, | ||
StrictMatcher, | ||
DateRangeMatcher, | ||
DateDistanceMatcher | ||
]); | ||
var Clause = import_zod9.z.lazy( | ||
() => import_zod9.z.discriminatedUnion("type", [ | ||
And, | ||
Or, | ||
FuzzyMatcher, | ||
StrictMatcher, | ||
DateRangeMatcher, | ||
DateDistanceMatcher | ||
]) | ||
); | ||
var DeduplicationConfig = import_zod9.z.object({ | ||
@@ -511,5 +512,2 @@ id: import_zod9.z.string(), | ||
}); | ||
var EventConfigInput = EventConfig.extend({ | ||
summary: SummaryConfigInput | ||
}); | ||
var defineForm = (form) => FormConfig.parse(form); | ||
@@ -829,3 +827,3 @@ var defineFormPage = (formPage) => FormPage.parse(formPage); | ||
var defineConfig = (config) => { | ||
const input = EventConfigInput.parse(config); | ||
const input = EventConfig.parse(config); | ||
const pageFields = findPageFields(input).map(({ id, label }) => ({ | ||
@@ -837,6 +835,2 @@ id, | ||
...input, | ||
summary: resolveFieldLabels({ | ||
config: input.summary, | ||
pageFields | ||
}), | ||
workqueues: input.workqueues.map( | ||
@@ -843,0 +837,0 @@ (workqueue) => resolveFieldLabels({ |
@@ -5,15 +5,2 @@ 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<{ | ||
@@ -25,8 +12,8 @@ id: z.ZodString; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}, { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>; | ||
@@ -39,8 +26,8 @@ emptyValueMessage: z.ZodOptional<z.ZodObject<{ | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}, { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
@@ -51,9 +38,9 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
@@ -64,66 +51,26 @@ }, { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
title: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
fields: { | ||
id: string; | ||
label: { | ||
}>; | ||
fields: z.ZodArray<z.ZodObject<{ | ||
id: z.ZodString; | ||
value: z.ZodObject<{ | ||
id: z.ZodString; | ||
defaultMessage: z.ZodString; | ||
description: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
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; | ||
}>; | ||
label: z.ZodObject<{ | ||
@@ -135,8 +82,8 @@ id: z.ZodString; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}, { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>; | ||
@@ -149,138 +96,106 @@ emptyValueMessage: z.ZodOptional<z.ZodObject<{ | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}, { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
}, "strip", z.ZodTypeAny, { | ||
id: string; | ||
value: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}, { | ||
id: string; | ||
value: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}>, "many">; | ||
}, { | ||
fields: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{ | ||
id: z.ZodString; | ||
label: z.ZodObject<{ | ||
id: z.ZodString; | ||
defaultMessage: z.ZodString; | ||
description: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
}, "strip", z.ZodTypeAny, { | ||
title: { | ||
id: string; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}, { | ||
}; | ||
emptyValueMessage?: { | ||
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; | ||
}, { | ||
} | undefined; | ||
}; | ||
fields: { | ||
id: string; | ||
value: { | ||
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; | ||
}, { | ||
}; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
}>, "strip", z.ZodTypeAny, { | ||
id: string; | ||
label?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}, { | ||
}[]; | ||
}, { | ||
title: { | ||
id: string; | ||
label?: { | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}>, "many">; | ||
}>, "strip", z.ZodTypeAny, { | ||
title: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
fields: { | ||
id: string; | ||
label?: { | ||
value: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
emptyValueMessage?: { | ||
}; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}[]; | ||
}, { | ||
title: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
fields: { | ||
id: string; | ||
label?: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}; | ||
emptyValueMessage?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
@@ -290,3 +205,2 @@ }[]; | ||
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'; | ||
@@ -35,3 +34,3 @@ import { FieldType } from './FieldConfig'; | ||
export declare const resolveFieldLabels: ({ config, pageFields }: { | ||
config: SummaryConfigInput | WorkqueueConfigInput; | ||
config: WorkqueueConfigInput; | ||
pageFields: { | ||
@@ -46,29 +45,19 @@ id: string; | ||
}[]; | ||
id: string; | ||
title: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
} | { | ||
fields: { | ||
id: EventMetadataKeys | string; | ||
label?: TranslationConfig; | ||
}[]; | ||
id: string; | ||
title: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
filters: { | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
status: ("CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED")[]; | ||
}[]; | ||
}; | ||
export declare function getAllFields(configuration: EventConfig): ({ | ||
id: string; | ||
type: "TEXT"; | ||
id: string; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -82,4 +71,4 @@ options?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -108,12 +97,12 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
} | { | ||
id: string; | ||
type: "DATE"; | ||
id: string; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -123,4 +112,4 @@ options?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
@@ -131,4 +120,4 @@ } | undefined; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -157,7 +146,6 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
} | { | ||
type: "PARAGRAPH"; | ||
id: string; | ||
@@ -167,6 +155,7 @@ options: { | ||
}; | ||
type: "PARAGRAPH"; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -176,4 +165,4 @@ validation?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -202,12 +191,16 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
} | { | ||
type: "FILE"; | ||
id: string; | ||
options: { | ||
value: string; | ||
label: string; | ||
}[]; | ||
type: "RADIO_GROUP"; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -217,4 +210,4 @@ validation?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -243,22 +236,24 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
} | { | ||
type: "RADIO_GROUP"; | ||
id: string; | ||
options: { | ||
value: string; | ||
label: string; | ||
}[]; | ||
type: "BULLET_LIST"; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
items: { | ||
id: string; | ||
defaultMessage: string; | ||
}; | ||
description: string; | ||
}[]; | ||
font: "reg12" | "reg14" | "reg16" | "reg18" | "h4" | "h3" | "h2" | "h1"; | ||
validation?: { | ||
message: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -287,23 +282,26 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
} | { | ||
type: "BULLET_LIST"; | ||
id: string; | ||
options: { | ||
value: string; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
}; | ||
}[]; | ||
type: "SELECT"; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
items: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}[]; | ||
validation?: { | ||
message: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -332,21 +330,12 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
font?: "reg12" | "reg14" | "reg16" | "reg18" | "h4" | "h3" | "h2" | "h1" | undefined; | ||
} | { | ||
type: "SELECT"; | ||
id: string; | ||
options: { | ||
value: string; | ||
label: { | ||
id: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
}[]; | ||
type: "CHECKBOX"; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -356,4 +345,4 @@ validation?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -382,12 +371,12 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
} | { | ||
type: "CHECKBOX"; | ||
id: string; | ||
type: "FILE"; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -397,4 +386,4 @@ validation?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -423,12 +412,12 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
} | { | ||
id: string; | ||
type: "COUNTRY"; | ||
id: string; | ||
label: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -438,4 +427,4 @@ validation?: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -464,6 +453,6 @@ validator: import("../client").JSONSchema; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
})[]; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -13,8 +13,8 @@ import { z } from 'zod'; | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}, { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>; | ||
@@ -29,8 +29,8 @@ fields: z.ZodArray<z.ZodObject<{ | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}, { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}>>; | ||
@@ -41,4 +41,4 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
@@ -49,4 +49,4 @@ }, { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
@@ -64,5 +64,5 @@ }>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
status: ("CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED")[]; | ||
}, { | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
status: ("CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED")[]; | ||
}>, "many">; | ||
@@ -73,4 +73,4 @@ }, "strip", z.ZodTypeAny, { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -81,8 +81,8 @@ fields: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}[]; | ||
filters: { | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
status: ("CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED")[]; | ||
}[]; | ||
@@ -93,4 +93,4 @@ }, { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
}; | ||
@@ -101,8 +101,8 @@ fields: { | ||
id: string; | ||
defaultMessage: string; | ||
description: string; | ||
defaultMessage: string; | ||
} | undefined; | ||
}[]; | ||
filters: { | ||
status: ("CERTIFIED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED")[]; | ||
status: ("CREATED" | "NOTIFIED" | "DECLARED" | "VALIDATED" | "REGISTERED" | "CERTIFIED")[]; | ||
}[]; | ||
@@ -109,0 +109,0 @@ }>; |
{ | ||
"name": "@opencrvs/toolkit", | ||
"version": "0.0.14-events", | ||
"version": "0.0.16-events", | ||
"description": "OpenCRVS toolkit for building country configurations", | ||
@@ -5,0 +5,0 @@ "license": "MPL-2.0", |
@@ -12,15 +12,15 @@ /* | ||
import { Clause } from '@opencrvs/commons/events' | ||
import { Clause, ClauseInput, ClauseOutput } from '@opencrvs/commons/events' | ||
export function and(clauses: Clause[]): Clause { | ||
export function and(clauses: ClauseInput[]): ClauseOutput { | ||
return { | ||
type: 'and', | ||
clauses | ||
clauses: clauses.map((clause) => Clause.parse(clause)) | ||
} | ||
} | ||
export function or(clauses: Clause[]): Clause { | ||
export function or(clauses: ClauseInput[]): ClauseOutput { | ||
return { | ||
type: 'or', | ||
clauses | ||
clauses: clauses.map((clause) => Clause.parse(clause)) | ||
} | ||
@@ -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
3162790
77804